diff --git a/src/features/chat/application/composer/slash-commands.ts b/src/features/chat/application/composer/slash-commands.ts index 4e17811a..30087cc8 100644 --- a/src/features/chat/application/composer/slash-commands.ts +++ b/src/features/chat/application/composer/slash-commands.ts @@ -141,7 +141,7 @@ export const SLASH_COMMANDS = [ usage: "/tools", argsKind: "none", surface: "diagnostic", - detail: "Show Codex plugins, tool providers, and skills reported by App Server.", + detail: "Show Codex plugins, MCP servers, and skills reported by App Server.", }, { command: "/model", diff --git a/src/features/chat/application/conversation/composition.ts b/src/features/chat/application/conversation/composition.ts index e38df134..8773620f 100644 --- a/src/features/chat/application/conversation/composition.ts +++ b/src/features/chat/application/conversation/composition.ts @@ -29,7 +29,7 @@ export interface ConversationTurnActionsContext { modelStatusLines: () => string[]; effortStatusLines: () => string[]; statusSummaryLines: () => string[]; - toolInventoryDetails: () => MessageStreamNoticeSection[]; + toolInventoryDetails: () => MessageStreamNoticeSection[] | Promise; }; thread: { ensureRestoredThreadLoaded: () => Promise; diff --git a/src/features/chat/application/conversation/slash-command-execution.ts b/src/features/chat/application/conversation/slash-command-execution.ts index 4b722ab8..0d9f183a 100644 --- a/src/features/chat/application/conversation/slash-command-execution.ts +++ b/src/features/chat/application/conversation/slash-command-execution.ts @@ -53,7 +53,7 @@ export interface SlashCommandExecutionPorts { }; statusSummaryLines: () => string[]; connectionDiagnosticDetails: () => MessageStreamNoticeSection[]; - toolInventoryDetails: () => MessageStreamNoticeSection[]; + toolInventoryDetails: () => MessageStreamNoticeSection[] | Promise; modelStatusLines: () => string[]; effortStatusLines: () => string[]; } @@ -186,7 +186,7 @@ export async function executeSlashCommand( context.addStructuredSystemMessage("Connection diagnostics", context.connectionDiagnosticDetails()); return; case "tools": - context.addStructuredSystemMessage("Codex capabilities", context.toolInventoryDetails()); + context.addStructuredSystemMessage("Codex capabilities", await context.toolInventoryDetails()); return; case "model": { const requested = parseModelOverride(args); diff --git a/src/features/chat/host/session-graph.ts b/src/features/chat/host/session-graph.ts index a8789199..566f033f 100644 --- a/src/features/chat/host/session-graph.ts +++ b/src/features/chat/host/session-graph.ts @@ -177,6 +177,7 @@ export function createChatPanelSessionGraph(host: ChatPanelSessionGraphHost): Ch threadFoundation.invalidateThreadWork(); }, runtimeProjection: runtime.projection, + refreshDiagnostics: () => connectionController.refreshDiagnostics(), refreshLiveState, notifyActiveThreadIdentityChanged, }); diff --git a/src/features/chat/host/turn-bundle.ts b/src/features/chat/host/turn-bundle.ts index 98f64ab1..28c372b8 100644 --- a/src/features/chat/host/turn-bundle.ts +++ b/src/features/chat/host/turn-bundle.ts @@ -68,6 +68,7 @@ interface ChatPanelTurnInput { autoTitleCoordinator: AutoTitleCoordinator; invalidateThreadWork: () => void; runtimeProjection: ChatPanelRuntimeProjection; + refreshDiagnostics: () => Promise; refreshLiveState: () => void; notifyActiveThreadIdentityChanged: () => void; } @@ -91,6 +92,7 @@ export function createTurnBundle(host: ChatPanelTurnHost, input: ChatPanelTurnIn autoTitleCoordinator, invalidateThreadWork, runtimeProjection, + refreshDiagnostics, refreshLiveState, notifyActiveThreadIdentityChanged, } = input; @@ -148,7 +150,10 @@ export function createTurnBundle(host: ChatPanelTurnHost, input: ChatPanelTurnIn modelStatusLines: runtimeProjection.modelStatusLines, effortStatusLines: runtimeProjection.effortStatusLines, statusSummaryLines: runtimeProjection.statusSummaryLines, - toolInventoryDetails: runtimeProjection.toolInventoryDetails, + toolInventoryDetails: async () => { + await refreshDiagnostics(); + return runtimeProjection.toolInventoryDetails(); + }, }, thread: { ensureRestoredThreadLoaded: () => diff --git a/tests/features/chat/application/conversation/slash-command-execution.test.ts b/tests/features/chat/application/conversation/slash-command-execution.test.ts index 4bb0f384..ce8117f8 100644 --- a/tests/features/chat/application/conversation/slash-command-execution.test.ts +++ b/tests/features/chat/application/conversation/slash-command-execution.test.ts @@ -47,7 +47,7 @@ function context(overrides: Partial = {}): SlashCo }, statusSummaryLines: () => ["status"], connectionDiagnosticDetails: () => [{ title: "Process", rows: [{ key: "connection", value: "connected" }] }], - toolInventoryDetails: vi.fn(() => [{ title: "Tool providers", auditFacts: [{ key: "codex_apps", value: "GitHub" }] }]), + toolInventoryDetails: vi.fn(() => [{ title: "MCP servers", auditFacts: [{ key: "codex_apps", value: "GitHub" }] }]), modelStatusLines: () => ["model"], effortStatusLines: () => ["effort"], ...overrides, @@ -674,13 +674,16 @@ describe("slash commands", () => { }); it("shows Codex capabilities", async () => { - const ctx = context(); + const toolInventoryDetails = vi + .fn() + .mockResolvedValue([{ title: "MCP servers", auditFacts: [{ key: "codex_apps", value: "GitHub" }] }]); + const ctx = context({ toolInventoryDetails }); await executeSlashCommand("tools", "", ctx); - expect(ctx.toolInventoryDetails).toHaveBeenCalledOnce(); + expect(toolInventoryDetails).toHaveBeenCalledOnce(); expect(ctx.addStructuredSystemMessage).toHaveBeenCalledWith("Codex capabilities", [ - { title: "Tool providers", auditFacts: [{ key: "codex_apps", value: "GitHub" }] }, + { title: "MCP servers", auditFacts: [{ key: "codex_apps", value: "GitHub" }] }, ]); }); @@ -703,7 +706,7 @@ describe("slash commands", () => { }); it("documents Codex capabilities", () => { - expect(slashCommandHelpValue("/tools")).toBe("Show Codex plugins, tool providers, and skills reported by App Server."); + expect(slashCommandHelpValue("/tools")).toBe("Show Codex plugins, MCP servers, and skills reported by App Server."); }); });