-
Notifications
You must be signed in to change notification settings - Fork 987
feat(host-service): terminalAgents tracker + pane wiring #4901
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
14 commits
Select commit
Hold shift + click to select a range
6caa3bc
docs(host-service): plan for terminalAgents tracker
Kitenite 17ee0bf
feat(host-service): add terminalAgents tracker
Kitenite d6afee0
refactor(desktop): wire TerminalPaneIcon to host-service terminalAgents
Kitenite d0a8236
Merge remote-tracking branch 'origin/main' into agent-session-tracking
Kitenite e7b3c1b
chore(plans): move agent-session-tracking plan to done
Kitenite 616f65c
Merge remote-tracking branch 'origin' into agent-session-tracking
Kitenite 9c3c4a7
fix(host-service): address PR review on terminalAgents
Kitenite 1d207b1
feat(catalog): promote droid to a first-class builtin agent
Kitenite e670857
refactor(catalog): derive HOST_AGENT_PRESETS from BUILTIN, seed all b…
Kitenite 80f50c2
feat(agents): re-run per-agent setup on Add
Kitenite a9ca374
chore(renderer): drop dead preset-icon SVG duplicates
Kitenite cc24aec
fix(ui): tighten droid icon viewBox
Kitenite 23d6f46
fix: address follow-up review comments
Kitenite 5f6ecc8
chore: trim restated comments and docstrings
Kitenite 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
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
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
1 change: 0 additions & 1 deletion
1
apps/desktop/src/renderer/assets/app-icons/preset-icons/claude.svg
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
apps/desktop/src/renderer/assets/app-icons/preset-icons/codex-white.svg
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
apps/desktop/src/renderer/assets/app-icons/preset-icons/codex.svg
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
apps/desktop/src/renderer/assets/app-icons/preset-icons/cursor.svg
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
apps/desktop/src/renderer/assets/app-icons/preset-icons/gemini.svg
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
apps/desktop/src/renderer/assets/app-icons/preset-icons/opencode-white.svg
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
apps/desktop/src/renderer/assets/app-icons/preset-icons/opencode.svg
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
apps/desktop/src/renderer/hooks/host-service/useTerminalAgentBindings/index.ts
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 @@ | ||
| export { | ||
| type TerminalAgentBinding, | ||
| useTerminalAgentBinding, | ||
| useTerminalAgentBindings, | ||
| } from "./useTerminalAgentBindings"; |
66 changes: 66 additions & 0 deletions
66
...ktop/src/renderer/hooks/host-service/useTerminalAgentBindings/useTerminalAgentBindings.ts
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,66 @@ | ||
| import { useQuery, useQueryClient } from "@tanstack/react-query"; | ||
| import { useCallback, useMemo } from "react"; | ||
| import { getHostServiceClientByUrl } from "renderer/lib/host-service-client"; | ||
| import { useWorkspaceEvent } from "../useWorkspaceEvent"; | ||
| import { useWorkspaceHostUrl } from "../useWorkspaceHostUrl"; | ||
|
|
||
| type ListByWorkspaceClient = ReturnType< | ||
| typeof getHostServiceClientByUrl | ||
| >["terminalAgents"]["listByWorkspace"]; | ||
| type TerminalAgentBindings = Awaited< | ||
| ReturnType<ListByWorkspaceClient["query"]> | ||
| >; | ||
| export type TerminalAgentBinding = TerminalAgentBindings[number]; | ||
|
|
||
| /** | ||
| * Map of `terminalId → agent binding` for a workspace, read from the host | ||
| * store and invalidated on `agent:lifecycle` / `terminal:lifecycle` events. | ||
| */ | ||
| export function useTerminalAgentBindings( | ||
| workspaceId: string, | ||
| ): Map<string, TerminalAgentBinding> { | ||
| const hostUrl = useWorkspaceHostUrl(workspaceId); | ||
| const queryClient = useQueryClient(); | ||
| const queryKey = useMemo( | ||
| () => ["terminal-agent-bindings", hostUrl, workspaceId] as const, | ||
| [hostUrl, workspaceId], | ||
| ); | ||
|
|
||
| const enabled = Boolean(workspaceId) && Boolean(hostUrl); | ||
|
|
||
| const { data } = useQuery({ | ||
| queryKey, | ||
| enabled, | ||
| queryFn: () => { | ||
| if (!hostUrl) return [] as TerminalAgentBindings; | ||
| return getHostServiceClientByUrl( | ||
| hostUrl, | ||
| ).terminalAgents.listByWorkspace.query({ workspaceId }); | ||
| }, | ||
| refetchOnWindowFocus: false, | ||
| staleTime: Number.POSITIVE_INFINITY, | ||
| }); | ||
|
|
||
| const invalidate = useCallback(() => { | ||
| void queryClient.invalidateQueries({ queryKey }); | ||
| }, [queryClient, queryKey]); | ||
|
|
||
| useWorkspaceEvent("agent:lifecycle", workspaceId, invalidate, enabled); | ||
| useWorkspaceEvent("terminal:lifecycle", workspaceId, invalidate, enabled); | ||
|
|
||
| return useMemo(() => { | ||
| const map = new Map<string, TerminalAgentBinding>(); | ||
| for (const binding of data ?? []) { | ||
| map.set(binding.terminalId, binding); | ||
| } | ||
| return map; | ||
| }, [data]); | ||
| } | ||
|
|
||
| export function useTerminalAgentBinding( | ||
| workspaceId: string, | ||
| terminalId: string, | ||
| ): TerminalAgentBinding | undefined { | ||
| const bindings = useTerminalAgentBindings(workspaceId); | ||
| return bindings.get(terminalId); | ||
| } |
22 changes: 12 additions & 10 deletions
22
.../usePaneRegistry/components/TerminalPane/components/TerminalPaneIcon/TerminalPaneIcon.tsx
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
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.