-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(jetbrains): open sub-agent sessions in editor tabs #13255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
cbd4b1c
feat(jetbrains): open sub-agent sessions in editor tabs
kirillk f6ccea4
fix(jetbrains): register subagent editor kind before VFS open
kirillk b65d11a
fix(jetbrains): open sub-agent via shared header open action
kirillk 1f669a7
fix(jetbrains): place sub-agent open action after summary text
kirillk ba87c72
chore(jetbrains): sync bun.lock version to 7.4.22
kirillk 61f3892
feat(jetbrains): live sub-agent body in collapsed task popup
kirillk aac2898
fix(jetbrains): bound task popup instead of resizing the frame
kirillk 009dd19
fix(jetbrains): keep task open action in the non-fit left group
kirillk b743c00
Merge remote-tracking branch 'origin/main' into branch-pick
kirillk b39277a
refactor(jetbrains): unify changes card open action; add sub-agent tr…
kirillk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@kilocode/kilo-jetbrains": minor | ||
| --- | ||
|
|
||
| Open sub-agent task sessions in read-only editor tabs from JetBrains task cards. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
...frontend/src/main/kotlin/ai/kilocode/client/session/subagent/SubagentSessionEditorHost.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,86 @@ | ||
| package ai.kilocode.client.session.subagent | ||
|
|
||
| import ai.kilocode.client.app.KiloWorkspaceService | ||
| import ai.kilocode.client.app.Workspace | ||
| import ai.kilocode.client.plugin.KiloBundle | ||
| import ai.kilocode.client.session.SessionActivityKind | ||
| import ai.kilocode.client.session.SessionHost | ||
| import ai.kilocode.client.session.SessionManager | ||
| import ai.kilocode.client.session.SessionRef | ||
| import ai.kilocode.client.session.SessionUi | ||
| import ai.kilocode.client.session.SessionUiFactory | ||
| import ai.kilocode.client.session.controller.SessionController | ||
| import ai.kilocode.client.session.ui.empty.EmptySessionPanel | ||
| import ai.kilocode.client.util.UiTimerSource | ||
| import ai.kilocode.client.util.UiTimers | ||
| import com.intellij.openapi.Disposable | ||
| import com.intellij.openapi.application.ApplicationManager | ||
| import com.intellij.openapi.application.ModalityState | ||
| import com.intellij.openapi.components.service | ||
| import com.intellij.openapi.project.Project | ||
| import com.intellij.openapi.util.Disposer | ||
| import com.intellij.openapi.wm.IdeFocusManager | ||
| import com.intellij.util.concurrency.annotations.RequiresEdt | ||
| import java.awt.BorderLayout | ||
| import javax.swing.JComponent | ||
| import javax.swing.JPanel | ||
|
|
||
| class SubagentSessionEditorHost( | ||
| parent: Disposable, | ||
| project: Project, | ||
| workspace: Workspace, | ||
| create: (Project, Workspace, SessionManager, SessionRef?, UiTimerSource) -> SessionUi = | ||
| { project, workspace, manager, ref, timers -> | ||
| service<SessionUiFactory>().create(project, workspace, manager, ref, timers) | ||
| }, | ||
| resolve: (String) -> Workspace = { dir -> service<KiloWorkspaceService>().workspace(dir) }, | ||
| status: () -> Map<String, SessionActivityKind> = { emptyMap() }, | ||
| timers: UiTimerSource = UiTimers, | ||
| request: (JComponent) -> Unit = { focus -> | ||
| ApplicationManager.getApplication().invokeLater({ | ||
| IdeFocusManager.getInstance(project).requestFocusInProject(focus, project) | ||
| }, ModalityState.defaultModalityState()) | ||
| }, | ||
| ) : SessionHost(project, workspace, create, resolve, status, timers, request) { | ||
| override val readonly: Boolean get() = true | ||
| override val hostedInEditorTab: Boolean get() = true | ||
| override val showsBranchBadgeInHeader: Boolean get() = false | ||
|
|
||
| val component = JPanel(BorderLayout()) | ||
|
|
||
| init { | ||
| Disposer.register(parent, this) | ||
| } | ||
|
|
||
| @RequiresEdt | ||
| fun open(sessionId: String) { | ||
| openSession(SessionRef.Local(sessionId), focus = true) | ||
| } | ||
|
|
||
| @RequiresEdt | ||
| fun currentFocus(): JComponent? = currentUi()?.defaultFocusedComponent | ||
|
|
||
| @RequiresEdt | ||
| override fun newSession() = Unit | ||
|
|
||
| @RequiresEdt | ||
| override fun showHistory(back: (() -> Unit)?) = Unit | ||
|
|
||
| @RequiresEdt | ||
| override fun emptyPanel(parent: Disposable, controller: SessionController): EmptySessionPanel = EmptySessionPanel( | ||
| parent, | ||
| controller, | ||
| recents = emptyList(), | ||
| history = {}, | ||
| timers = timers, | ||
| minimal = true, | ||
| ) | ||
|
|
||
| @RequiresEdt | ||
| override fun present(ui: SessionUi?) { | ||
| component.removeAll() | ||
| if (ui != null) component.add(ui, BorderLayout.CENTER) | ||
| component.revalidate() | ||
| component.repaint() | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.