-
Notifications
You must be signed in to change notification settings - Fork 960
feat(docs): Add MCP improvements / improve MCP local command flakiness #1608
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
5 commits
Select commit
Hold shift + click to select a range
fed95db
feat(docs): restructure docs site and add workflow, task management, …
saddlepaddle 924ad39
fix: remove accidentally committed .mcp.json
saddlepaddle 3cc5d61
refactor: move persistCommandStatus to useCommandWatcher, remove no-o…
saddlepaddle 78671ff
fix: remove trailing newline (lint)
saddlepaddle d8dbf40
fix: use shared apiTrpcClient and pass claimedAt to persistCommandStatus
saddlepaddle 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
36 changes: 36 additions & 0 deletions
36
...utes/_authenticated/components/AgentHooks/hooks/useCommandWatcher/persistCommandStatus.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,36 @@ | ||
| import type { CommandStatus } from "@superset/db/schema"; | ||
| import { apiTrpcClient } from "renderer/lib/api-trpc-client"; | ||
|
|
||
| export async function persistCommandStatus(params: { | ||
| id: string; | ||
| status: CommandStatus; | ||
| claimedBy?: string; | ||
| claimedAt?: Date; | ||
| result?: Record<string, unknown>; | ||
| error?: string; | ||
| executedAt?: Date; | ||
| }): Promise<void> { | ||
| const delays = [500, 1000, 2000]; | ||
| let lastError: unknown; | ||
|
|
||
| for (let attempt = 0; attempt <= delays.length; attempt++) { | ||
| try { | ||
| await apiTrpcClient.agent.updateCommand.mutate(params); | ||
| return; | ||
| } catch (err) { | ||
| lastError = err; | ||
| console.warn( | ||
| `[persistCommandStatus] Attempt ${attempt + 1} failed for ${params.id}:`, | ||
| err, | ||
| ); | ||
| if (attempt < delays.length) { | ||
| await new Promise((resolve) => setTimeout(resolve, delays[attempt])); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| console.error( | ||
| `[persistCommandStatus] All retries exhausted for ${params.id}:`, | ||
| lastError, | ||
| ); | ||
| } |
69 changes: 69 additions & 0 deletions
69
...uthenticated/components/AgentHooks/hooks/useCommandWatcher/tools/get-workspace-details.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,69 @@ | ||
| import { useTabsStore } from "renderer/stores/tabs/store"; | ||
| import { z } from "zod"; | ||
| import type { CommandResult, ToolContext, ToolDefinition } from "./types"; | ||
|
|
||
| const schema = z.object({ | ||
| workspaceId: z.string(), | ||
| }); | ||
|
|
||
| async function execute( | ||
| params: z.infer<typeof schema>, | ||
| ctx: ToolContext, | ||
| ): Promise<CommandResult> { | ||
| const workspaces = ctx.getWorkspaces(); | ||
| if (!workspaces || workspaces.length === 0) { | ||
| return { success: false, error: "No workspaces available" }; | ||
| } | ||
|
|
||
| const workspace = workspaces.find((ws) => ws.id === params.workspaceId); | ||
| if (!workspace) { | ||
| return { | ||
| success: false, | ||
| error: `Workspace not found: ${params.workspaceId}`, | ||
| }; | ||
| } | ||
|
|
||
| const tabsStore = useTabsStore.getState(); | ||
| const activeTabId = tabsStore.activeTabIds[workspace.id] ?? null; | ||
| const workspaceTabs = tabsStore.tabs.filter( | ||
| (t) => t.workspaceId === workspace.id, | ||
| ); | ||
|
|
||
| const tabs = workspaceTabs.map((tab) => { | ||
| const tabPanes = Object.entries(tabsStore.panes) | ||
| .filter(([, pane]) => pane.tabId === tab.id) | ||
| .map(([id, pane]) => ({ | ||
| id, | ||
| type: pane.type, | ||
| name: pane.name, | ||
| status: pane.status ?? "idle", | ||
| })); | ||
|
|
||
| return { | ||
| id: tab.id, | ||
| name: tab.userTitle ?? tab.name, | ||
| isActive: tab.id === activeTabId, | ||
| panes: tabPanes, | ||
| }; | ||
| }); | ||
|
|
||
| return { | ||
| success: true, | ||
| data: { | ||
| workspace: { | ||
| id: workspace.id, | ||
| name: workspace.name, | ||
| branch: workspace.branch, | ||
| projectId: workspace.projectId, | ||
| }, | ||
| activeTabId, | ||
| tabs, | ||
| }, | ||
| }; | ||
| } | ||
|
|
||
| export const getWorkspaceDetails: ToolDefinition<typeof schema> = { | ||
| name: "get_workspace_details", | ||
| schema, | ||
| execute, | ||
| }; |
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
42 changes: 0 additions & 42 deletions
42
...uthenticated/components/AgentHooks/hooks/useCommandWatcher/tools/start-claude-subagent.ts
This file was deleted.
Oops, something went wrong.
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
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.