From a83479343c297c04983720c8837e331b672eed0b Mon Sep 17 00:00:00 2001 From: Robert Gruen Date: Tue, 28 Jul 2026 07:53:23 -0700 Subject: [PATCH 01/20] action for creating new chat window --- .../agents/code/src/codeActionsSchema.ts | 28 ++- ts/packages/agents/code/src/codeSchema.agr | 23 +- .../coda/src/handleEditorCodeActions.ts | 196 +++++++++++++++--- 3 files changed, 215 insertions(+), 32 deletions(-) diff --git a/ts/packages/agents/code/src/codeActionsSchema.ts b/ts/packages/agents/code/src/codeActionsSchema.ts index bb49f44f97..5980b86cea 100644 --- a/ts/packages/agents/code/src/codeActionsSchema.ts +++ b/ts/packages/agents/code/src/codeActionsSchema.ts @@ -13,7 +13,8 @@ export type CodeActions = | GetDiagnosticsAction | ListOpenEditorsAction | GetFileContentAction - | GetWorkspaceChangesAction; + | GetWorkspaceChangesAction + | LaunchCopilotChatAction; export type CodeActivity = LaunchVSCodeAction; @@ -26,6 +27,31 @@ export type LaunchVSCodeAction = { }; }; +// Launch a new chat window with GitHub Copilot, Claude, or other chat providers +// This creates a new chat session in the specified location. +export type LaunchCopilotChatAction = { + actionName: "launchCopilotChat"; + parameters: { + // Optional initial query/prompt to send to the chat + query?: string; + // Chat provider: "copilot" (GitHub Copilot, default), "claude" (Claude/Anthropic), + // "gpt" (ChatGPT/OpenAI), or "generic" for any available chat extension + provider?: "copilot" | "claude" | "gpt" | "generic"; + // Where to open the new session: "window" (new chat window, default), + // "editor" (new chat editor in editor area), or "view" (chat panel/side view) + newSessionLocation?: "window" | "editor" | "view"; + // Copilot chat mode: "agent" (can edit workspace) or "ask" (conversational only) + // Note: not all providers support all modes + mode?: "agent" | "ask"; + // Whether to pre-fill but not auto-submit the query + isPartialQuery?: boolean; + // Whether to attach a screenshot of focused VS Code window + attachScreenshot?: boolean; + // Absolute paths to files to attach to the chat request + attachFiles?: string[]; + }; +}; + export type ColorTheme = | "Default Light+" | "Default Dark+" diff --git a/ts/packages/agents/code/src/codeSchema.agr b/ts/packages/agents/code/src/codeSchema.agr index cdae40ae24..6aa9bd88a7 100644 --- a/ts/packages/agents/code/src/codeSchema.agr +++ b/ts/packages/agents/code/src/codeSchema.agr @@ -17,7 +17,8 @@ import { CodeActions, CodeActivity } from "./codeActionsSchema.ts"; | | | - | ; + | + | ; // Theme name sub-rule — maps user-friendly tokens to canonical TS ColorTheme // literals. ColorTheme members contain '+' which isn't a valid literal token @@ -95,4 +96,24 @@ import { CodeActions, CodeActivity } from "./codeActionsSchema.ts"; = ('launch' | 'open' | 'start') ('vs code' | 'vscode' | 'code') ('in')? $(mode:) ('mode')? ('at' | 'with' | 'for')? $(path:string) -> { actionName: "launchVSCode", parameters: { mode: mode, path: path } } | ('launch' | 'open' | 'start') ('vs code' | 'vscode' | 'code') ('in')? $(mode:) ('mode')? -> { actionName: "launchVSCode", parameters: { mode: mode } }; +// Chat location — where to open the chat window + = 'window' -> "window" + | ('view' | 'panel' | 'side') -> "view" + | 'editor' -> "editor"; + +// Chat provider — which chat service to open + = ('copilot' | 'github copilot' | 'gh copilot') -> "copilot" + | ('claude' | 'anthropic') -> "claude" + | ('chatgpt' | 'gpt' | 'openai') -> "gpt" + | ('chat' | 'ai') -> "generic"; + +// Launch a new chat window +// Examples: "create a new chat window", "open claude in a new window", "launch chat in the editor" + = ('create' | 'open' | 'launch' | 'start') ('a')? ('new')? $(provider:) ('chat' | 'chat session' | 'chat window') -> { actionName: "launchCopilotChat", parameters: { provider: provider, newSessionLocation: "window" } } + | ('create' | 'open' | 'launch' | 'start') ('a')? ('new')? $(provider:) ('chat' | 'chat session' | 'chat window') ('in' | 'in a' | 'in the') $(location:) -> { actionName: "launchCopilotChat", parameters: { provider: provider, newSessionLocation: location } } + | ('create' | 'open' | 'launch' | 'start') ('a')? ('new')? ('chat' | 'chat session' | 'chat window') ('for' | 'with') $(provider:) -> { actionName: "launchCopilotChat", parameters: { provider: provider, newSessionLocation: "window" } } + | ('create' | 'open' | 'launch' | 'start') ('a')? ('new')? ('chat' | 'chat session' | 'chat window') ('for' | 'with') $(provider:) ('in' | 'in a' | 'in the') $(location:) -> { actionName: "launchCopilotChat", parameters: { provider: provider, newSessionLocation: location } } + | ('create' | 'open' | 'launch' | 'start') ('a')? ('new')? ('copilot')? ('chat' | 'chat session' | 'chat window') -> { actionName: "launchCopilotChat", parameters: { newSessionLocation: "window" } } + | ('create' | 'open' | 'launch' | 'start') ('a')? ('new')? ('copilot')? ('chat' | 'chat session' | 'chat window') ('in' | 'in a' | 'in the') $(location:) -> { actionName: "launchCopilotChat", parameters: { newSessionLocation: location } }; + = ("can you" | "please" | "would you" | "i need" | "let's")?; diff --git a/ts/packages/coda/src/handleEditorCodeActions.ts b/ts/packages/coda/src/handleEditorCodeActions.ts index 31d5188bdf..3106c591b8 100644 --- a/ts/packages/coda/src/handleEditorCodeActions.ts +++ b/ts/packages/coda/src/handleEditorCodeActions.ts @@ -955,6 +955,7 @@ function buildFallbackCopilotQuery( type LaunchCopilotChatAction = { parameters?: { query?: string; + provider?: "copilot" | "claude" | "gpt" | "generic"; mode?: "agent" | "ask"; isPartialQuery?: boolean; attachScreenshot?: boolean; @@ -978,17 +979,35 @@ export async function handleLaunchCopilotChatAction( action: LaunchCopilotChatAction, ): Promise { const params = action.parameters ?? {}; + const provider: "copilot" | "claude" | "gpt" | "generic" = + params.provider === "claude" || + params.provider === "gpt" || + params.provider === "generic" + ? params.provider + : "copilot"; + + // Route to provider-specific handler + if (provider === "claude") { + return handleClaudeChatAction(params); + } else if (provider === "gpt") { + return handleGPTChatAction(params); + } else if (provider === "generic") { + return handleGenericChatAction(params); + } else { + // Default: GitHub Copilot + return handleCopilotChatAction(params); + } +} + +// GitHub Copilot Chat handler — uses native VS Code Copilot Chat integration +async function handleCopilotChatAction(params: Record): Promise { const query: string = typeof params.query === "string" ? params.query : ""; const mode: string = params.mode === "ask" ? "ask" : "agent"; - // isPartialQuery=false means auto-send; true means pre-fill only. We open - // the chat pre-filled either way and drive the submit ourselves (below), - // so this just controls whether the prompt is auto-sent. const autoSend: boolean = params.isPartialQuery !== true; const attachScreenshot: boolean = params.attachScreenshot === true; const attachFilePaths: string[] = Array.isArray(params.attachFiles) ? params.attachFiles.filter((p: unknown) => typeof p === "string") : []; - // Whether to start a fresh session, and where to open it. const newSession: boolean = params.newSession !== false; const newSessionLocation: "view" | "editor" | "window" = params.newSessionLocation === "editor" @@ -998,10 +1017,6 @@ export async function handleLaunchCopilotChatAction( : "view"; if (!(await isCopilotChatAvailable())) { - // NOTE: `handled: true` marks that this handler recognized the action - // (see handleVSCodeActions' `results.find(r => r.handled)` selection) — - // it is not a success flag. Keep it true so this specific message is - // the one surfaced, rather than the generic "Did not handle" fallback. return { handled: true, message: @@ -1009,23 +1024,17 @@ export async function handleLaunchCopilotChatAction( }; } - // Optionally start a fresh chat session in the requested location BEFORE - // opening. `workbench.action.chat.open` targets the last-active chat widget - // (IChatWidgetService.revealWidget reveals the last active widget), so - // creating the new session first makes the handoff land there instead of - // appending to the user's current chat. if (newSession) { const newSessionCommand = newSessionLocation === "editor" - ? "workbench.action.openChat" // New Chat Editor (editor area) + ? "workbench.action.openChat" : newSessionLocation === "window" - ? "workbench.action.newChatWindow" // New Chat Window - : "workbench.action.chat.newChat"; // New chat in the panel view + ? "workbench.action.newChatWindow" + : "workbench.action.chat.newChat"; try { await vscode.commands.executeCommand(newSessionCommand); } catch { - // Best-effort: older builds may lack the command. Fall through and - // open into the current/last chat instead of a new session. + // Best-effort: older builds may lack the command } } @@ -1038,13 +1047,7 @@ export async function handleLaunchCopilotChatAction( : newSessionLocation === "window" ? "a new GitHub Copilot Chat window" : "a new GitHub Copilot Chat session"; - // Open the chat pre-filled first — this reliably reveals the target widget - // and adds the input + attachments — then drive the submit ourselves. We do - // NOT use chat.open's own auto-submit (isPartialQuery:false → acceptInput): - // on a freshly created chat editor/window that submit races widget/agent - // initialization and often leaves the prompt sitting unsent. Running - // `workbench.action.chat.submit` as a separate step after the widget is - // revealed is reliable. + let usedFallback = false; try { await vscode.commands.executeCommand("workbench.action.chat.open", { @@ -1055,8 +1058,6 @@ export async function handleLaunchCopilotChatAction( attachFiles, }); } catch { - // Older VS Code builds may not support attachScreenshot / attachFiles. - // Fall back to embedding the attachment paths in the query text. try { await vscode.commands.executeCommand("workbench.action.chat.open", { query: buildFallbackCopilotQuery(query, attachFilePaths), @@ -1074,8 +1075,6 @@ export async function handleLaunchCopilotChatAction( } } - // Submit the pre-filled prompt when auto-send is requested. Best-effort: if - // the submit command is unavailable, leave the prompt ready to send. let sent = false; if (autoSend) { try { @@ -1084,7 +1083,7 @@ export async function handleLaunchCopilotChatAction( ); sent = true; } catch { - // Couldn't auto-submit; the prompt stays pre-filled for the user. + // Couldn't auto-submit; prompt stays pre-filled } } @@ -1102,6 +1101,143 @@ export async function handleLaunchCopilotChatAction( }; } +// Claude Chat handler — tries to open Claude extension if available +async function handleClaudeChatAction(params: Record): Promise { + const query: string = typeof params.query === "string" ? params.query : ""; + const newSessionLocation: "view" | "editor" | "window" = + params.newSessionLocation === "editor" + ? "editor" + : params.newSessionLocation === "window" + ? "window" + : "view"; + + // Try Anthropic Claude for VS Code extension command + const claudeCommands = [ + "anthropic.claude.new-chat-window", // Possible Anthropic extension ID + "claude.openInNewWindow", // Alternative command + "continue.openChat", // Continue extension which often uses Claude + ]; + + for (const cmd of claudeCommands) { + try { + await vscode.commands.executeCommand(cmd, { + query, + location: newSessionLocation, + }); + return { + handled: true, + message: `✅ Opened Claude chat${query ? " with your prompt" : ""}. If Claude extension is not installed, you can install it from the VS Code Extensions marketplace.`, + }; + } catch { + // Try next command + } + } + + // Fallback: open generic chat and mention Claude + try { + if (newSessionLocation === "window") { + await vscode.commands.executeCommand("workbench.action.chat.newChat"); + } else if (newSessionLocation === "editor") { + await vscode.commands.executeCommand("workbench.action.openChat"); + } + return { + handled: true, + message: `⚠️ Opened a chat window, but Claude extension was not found. Install "Claude for VS Code" or "Anthropic" from the Extensions marketplace to use Claude.${query ? " Your prompt is ready to paste." : ""}`, + }; + } catch { + return { + handled: true, + message: + "❌ Claude extension not found and fallback chat window failed. Install a Claude extension (e.g., 'Anthropic' or 'Claude for VS Code') from the VS Code Extensions marketplace.", + }; + } +} + +// ChatGPT/OpenAI handler — tries to open ChatGPT extension if available +async function handleGPTChatAction(params: Record): Promise { + const query: string = typeof params.query === "string" ? params.query : ""; + const newSessionLocation: "view" | "editor" | "window" = + params.newSessionLocation === "editor" + ? "editor" + : params.newSessionLocation === "window" + ? "window" + : "view"; + + // Try various GPT/OpenAI related extension commands + const gptCommands = [ + "openai.chatgpt.new-chat-window", + "gptChat.openInNewWindow", + "gpt4all.openChat", + "continue.openChat", // Continue also supports GPT models + ]; + + for (const cmd of gptCommands) { + try { + await vscode.commands.executeCommand(cmd, { + query, + location: newSessionLocation, + }); + return { + handled: true, + message: `✅ Opened ChatGPT/GPT chat${query ? " with your prompt" : ""}. If GPT extension is not installed, install it from the VS Code Extensions marketplace.`, + }; + } catch { + // Try next command + } + } + + // Fallback: open generic chat + try { + if (newSessionLocation === "window") { + await vscode.commands.executeCommand("workbench.action.chat.newChat"); + } else if (newSessionLocation === "editor") { + await vscode.commands.executeCommand("workbench.action.openChat"); + } + return { + handled: true, + message: `⚠️ Opened a chat window, but ChatGPT/GPT extension was not found. Install a ChatGPT extension (e.g., 'ChatGPT' or 'Continue') from the VS Code Extensions marketplace to use ChatGPT.${query ? " Your prompt is ready to paste." : ""}`, + }; + } catch { + return { + handled: true, + message: + "❌ ChatGPT extension not found and fallback chat window failed. Install a ChatGPT extension from the VS Code Extensions marketplace.", + }; + } +} + +// Generic chat handler — opens the default VS Code chat in the requested location +async function handleGenericChatAction(params: Record): Promise { + const query: string = typeof params.query === "string" ? params.query : ""; + const newSessionLocation: "view" | "editor" | "window" = + params.newSessionLocation === "editor" + ? "editor" + : params.newSessionLocation === "window" + ? "window" + : "view"; + + try { + const chatCommand = + newSessionLocation === "editor" + ? "workbench.action.openChat" + : newSessionLocation === "window" + ? "workbench.action.newChatWindow" + : "workbench.action.chat.newChat"; + + await vscode.commands.executeCommand(chatCommand); + + return { + handled: true, + message: `✅ Opened a new chat${query ? " with your prompt" : ""}. The available chat providers depend on your installed extensions (GitHub Copilot, Claude, ChatGPT, etc.).`, + }; + } catch (err: unknown) { + return { + handled: true, + message: `❌ Failed to open chat window: ${getErrorMessage(err)}`, + }; + } +} + export async function handleEditorCodeActions( action: any, ): Promise { From bd7a37d0ce4a330964c5bfb6951eea494f7da5c5 Mon Sep 17 00:00:00 2001 From: Robert Gruen Date: Tue, 28 Jul 2026 07:59:25 -0700 Subject: [PATCH 02/20] can now check branch merge status by saying "did branch x" get merged? --- .../github-cli/src/github-cliActionHandler.ts | 43 +++++++++++++++++ .../github-cli/src/github-cliSchema.agr | 47 +++++++++++++++++++ .../agents/github-cli/src/github-cliSchema.ts | 23 +++++++++ .../test/githubCliBuildArgs.spec.ts | 38 +++++++++++++++ 4 files changed, 151 insertions(+) diff --git a/ts/packages/agents/github-cli/src/github-cliActionHandler.ts b/ts/packages/agents/github-cli/src/github-cliActionHandler.ts index 25f05b100f..d8efe97609 100644 --- a/ts/packages/agents/github-cli/src/github-cliActionHandler.ts +++ b/ts/packages/agents/github-cli/src/github-cliActionHandler.ts @@ -569,6 +569,19 @@ export function buildArgs( if (p.number) args.push(String(p.number)); return args; } + case "prMergedStatus": { + const args = ["pr", "list"]; + if (p.repo) args.push("--repo", String(p.repo)); + if (p.base) args.push("--base", String(p.base)); + if (p.branch) args.push("--head", String(p.branch)); + args.push("--state", "merged"); + args.push("--limit", String(p.limit ?? 20)); + args.push( + "--json", + "number,title,url,mergedAt,headRefName,baseRefName", + ); + return args; + } case "prMerge": { const args = ["pr", "merge"]; if (p.number) args.push(String(p.number)); @@ -1994,6 +2007,36 @@ async function executeAction( // Array results: issues, PRs, search repos if (Array.isArray(data)) { + if (action.actionName === "prMergedStatus") { + const branch = String(p.branch ?? ""); + const base = String(p.base ?? "main"); + const matches = data as Array<{ + number?: number; + title?: string; + url?: string; + mergedAt?: string; + }>; + + if (matches.length === 0) { + return createActionResultFromMarkdownDisplay( + `No merged PR found from branch **${branch}** into **${base}**.`, + ); + } + + const first = matches[0]; + const prLabel = + first.number !== undefined + ? `#${first.number}` + : "matching PR"; + const mergedAt = first.mergedAt + ? ` (merged at ${first.mergedAt})` + : ""; + const link = first.url ? `\n\n${first.url}` : ""; + return createActionResultFromMarkdownDisplay( + `Yes - branch **${branch}** was merged into **${base}** via PR **${prLabel}**${mergedAt}.${link}`, + ); + } + const result = buildStructuredListResult( data as Record[], action.actionName, diff --git a/ts/packages/agents/github-cli/src/github-cliSchema.agr b/ts/packages/agents/github-cli/src/github-cliSchema.agr index ae443243b2..c3fbd72312 100644 --- a/ts/packages/agents/github-cli/src/github-cliSchema.agr +++ b/ts/packages/agents/github-cli/src/github-cliSchema.agr @@ -141,6 +141,52 @@ } }; + = did (the)? $(branch:word) (branch)? get merged into $(base:word) -> { + actionName: "prMergedStatus", + parameters: { + branch, + base + } +} + | did (the)? $(branch:word) (branch)? get merged into $(base:word) in $(repo:wildcard) -> { + actionName: "prMergedStatus", + parameters: { + branch, + base, + repo + } +} + | has (the)? $(branch:word) (branch)? been merged into $(base:word) -> { + actionName: "prMergedStatus", + parameters: { + branch, + base + } +} + | has (the)? $(branch:word) (branch)? been merged into $(base:word) in $(repo:wildcard) -> { + actionName: "prMergedStatus", + parameters: { + branch, + base, + repo + } +} + | is (the)? $(branch:word) (branch)? merged into $(base:word) -> { + actionName: "prMergedStatus", + parameters: { + branch, + base + } +} + | is (the)? $(branch:word) (branch)? merged into $(base:word) in $(repo:wildcard) -> { + actionName: "prMergedStatus", + parameters: { + branch, + base, + repo + } +}; + = merge PR $(number:number) -> { actionName: "prMerge", parameters: { @@ -446,6 +492,7 @@ import { GithubCliActions } from "./github-cliSchema.ts"; | | | + | | | | diff --git a/ts/packages/agents/github-cli/src/github-cliSchema.ts b/ts/packages/agents/github-cli/src/github-cliSchema.ts index a9b304cafa..080dc3a585 100644 --- a/ts/packages/agents/github-cli/src/github-cliSchema.ts +++ b/ts/packages/agents/github-cli/src/github-cliSchema.ts @@ -24,6 +24,7 @@ export type GithubCliActions = | OrgViewAction | PrCreateAction | PrCloseAction + | PrMergedStatusAction | PrMergeAction | PrListAction | PrViewAction @@ -284,6 +285,28 @@ export type PrCloseAction = { }; }; +// Check whether a branch has already been merged into a base branch. +// +// Example: +// User: did dev/robgruen/dogfooding7 get merged into main? +// Agent: { actionName: "prMergedStatus", parameters: { branch: "dev/robgruen/dogfooding7", base: "main" } } +export type PrMergedStatusAction = { + actionName: "prMergedStatus"; + parameters: { + // Source branch to check (PR head branch). + branch: string; + + // Target base branch. Defaults to "main" when omitted. + base?: string; + + // OWNER/REPO slug (e.g. "microsoft/TypeAgent"). Omit to use current repo. + repo?: string; + + // Maximum number of merged PR matches to inspect. + limit?: number; + }; +}; + export type PrMergeAction = { actionName: "prMerge"; parameters: { diff --git a/ts/packages/agents/github-cli/test/githubCliBuildArgs.spec.ts b/ts/packages/agents/github-cli/test/githubCliBuildArgs.spec.ts index e7a6befb68..29d61f869e 100644 --- a/ts/packages/agents/github-cli/test/githubCliBuildArgs.spec.ts +++ b/ts/packages/agents/github-cli/test/githubCliBuildArgs.spec.ts @@ -135,6 +135,44 @@ describe("buildArgs — prList assignee handling", () => { }); }); +describe("buildArgs — prMergedStatus", () => { + test("builds a merged PR lookup with head/base filters", () => { + const args = buildArgs( + action("prMergedStatus", { + repo: "microsoft/TypeAgent", + branch: "dev/robgruen/dogfooding7", + base: "main", + }), + )!; + const joined = args.join(" "); + expect(args.slice(0, 2)).toEqual(["pr", "list"]); + expect(joined).toContain("--repo microsoft/TypeAgent"); + expect(joined).toContain("--head dev/robgruen/dogfooding7"); + expect(joined).toContain("--base main"); + expect(joined).toContain("--state merged"); + expect(joined).toContain("--json number,title,url,mergedAt,headRefName,baseRefName"); + }); + + test("defaults limit to 20 and honors explicit limit", () => { + const defaultLimit = buildArgs( + action("prMergedStatus", { + branch: "feature/x", + base: "main", + }), + )!; + expect(defaultLimit.join(" ")).toContain("--limit 20"); + + const customLimit = buildArgs( + action("prMergedStatus", { + branch: "feature/x", + base: "main", + limit: 3, + }), + )!; + expect(customLimit.join(" ")).toContain("--limit 3"); + }); +}); + describe('buildArgs — author handling ("my PRs" / "issues I opened")', () => { test("maps prList author @me to --author, not --assignee", () => { const args = buildArgs( From 5a7bdd3625eef42d75702c9fd9f0dadb7cb10410 Mon Sep 17 00:00:00 2001 From: typeagent-bot Date: Wed, 29 Jul 2026 05:03:12 +0000 Subject: [PATCH 03/20] style: apply prettier formatting and policy fixes --- .../test/githubCliBuildArgs.spec.ts | 4 +++- .../coda/src/handleEditorCodeActions.ts | 24 ++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/ts/packages/agents/github-cli/test/githubCliBuildArgs.spec.ts b/ts/packages/agents/github-cli/test/githubCliBuildArgs.spec.ts index 29d61f869e..c7d9a801c0 100644 --- a/ts/packages/agents/github-cli/test/githubCliBuildArgs.spec.ts +++ b/ts/packages/agents/github-cli/test/githubCliBuildArgs.spec.ts @@ -150,7 +150,9 @@ describe("buildArgs — prMergedStatus", () => { expect(joined).toContain("--head dev/robgruen/dogfooding7"); expect(joined).toContain("--base main"); expect(joined).toContain("--state merged"); - expect(joined).toContain("--json number,title,url,mergedAt,headRefName,baseRefName"); + expect(joined).toContain( + "--json number,title,url,mergedAt,headRefName,baseRefName", + ); }); test("defaults limit to 20 and honors explicit limit", () => { diff --git a/ts/packages/coda/src/handleEditorCodeActions.ts b/ts/packages/coda/src/handleEditorCodeActions.ts index 3106c591b8..dbc22d516b 100644 --- a/ts/packages/coda/src/handleEditorCodeActions.ts +++ b/ts/packages/coda/src/handleEditorCodeActions.ts @@ -1000,7 +1000,9 @@ export async function handleLaunchCopilotChatAction( } // GitHub Copilot Chat handler — uses native VS Code Copilot Chat integration -async function handleCopilotChatAction(params: Record): Promise { +async function handleCopilotChatAction( + params: Record, +): Promise { const query: string = typeof params.query === "string" ? params.query : ""; const mode: string = params.mode === "ask" ? "ask" : "agent"; const autoSend: boolean = params.isPartialQuery !== true; @@ -1102,7 +1104,9 @@ async function handleCopilotChatAction(params: Record): Promise): Promise { +async function handleClaudeChatAction( + params: Record, +): Promise { const query: string = typeof params.query === "string" ? params.query : ""; const newSessionLocation: "view" | "editor" | "window" = params.newSessionLocation === "editor" @@ -1136,7 +1140,9 @@ async function handleClaudeChatAction(params: Record): Promise): Promise): Promise { +async function handleGPTChatAction( + params: Record, +): Promise { const query: string = typeof params.query === "string" ? params.query : ""; const newSessionLocation: "view" | "editor" | "window" = params.newSessionLocation === "editor" @@ -1189,7 +1197,9 @@ async function handleGPTChatAction(params: Record): Promise): Promise): Promise { +async function handleGenericChatAction( + params: Record, +): Promise { const query: string = typeof params.query === "string" ? params.query : ""; const newSessionLocation: "view" | "editor" | "window" = params.newSessionLocation === "editor" From 406012d34df6cb59e930a53624515413fddf885d Mon Sep 17 00:00:00 2001 From: typeagent-bot Date: Wed, 29 Jul 2026 05:17:40 +0000 Subject: [PATCH 04/20] docs: regenerate README.AUTOGEN.md, command reference, and action browser --- ts/packages/agents/code/README.AUTOGEN.md | 16 ++-- .../agents/github-cli/README.AUTOGEN.md | 94 +++++++++---------- ts/packages/coda/README.AUTOGEN.md | 6 +- 3 files changed, 58 insertions(+), 58 deletions(-) diff --git a/ts/packages/agents/code/README.AUTOGEN.md b/ts/packages/agents/code/README.AUTOGEN.md index 7aeab956f7..e556cb0bb3 100644 --- a/ts/packages/agents/code/README.AUTOGEN.md +++ b/ts/packages/agents/code/README.AUTOGEN.md @@ -3,20 +3,20 @@ - + -# code-agent — AI-generated documentation +# @typeagent/code-agent — AI-generated documentation > 🤖 **AI-authored documentation**, regenerated daily and validated for length, tone, and link integrity. Cross-check against the deterministic Reference section below before relying on specifics. Hand-written context from [`./README.md`](./README.md) was provided to the model as authoritative source. May lag the working tree by up to 24h — see the staleness footer at the end of this file. ## Overview -The `code-agent` package is a TypeAgent application agent designed to automate tasks in Visual Studio Code (VSCode). It acts as a dispatcher for code-related actions, enabling users to interact with VSCode through natural language commands. This agent integrates with the [coda](../../coda/README.md) VSCode extension, which must be deployed for the `code-agent` to function. The agent is not enabled by default and requires explicit configuration to activate. +The `@typeagent/code-agent` package is a TypeAgent application agent designed to automate tasks in Visual Studio Code (VSCode). It enables users to interact with VSCode through natural language commands, facilitating workflows such as launching the editor, managing files, and customizing the development environment. This agent integrates with the [coda](../../coda/README.md) VSCode extension, which must be deployed for the `code-agent` to function. The agent is not enabled by default and requires explicit configuration to activate. ## What it does -The `code-agent` currently implements the `launchVSCode` action, which allows users to launch or start VSCode in different modes: +The `code-agent` currently implements the `launchVSCode` action, which allows users to start or open VSCode in various modes: - **last**: Opens the last session. - **folder**: Opens a specific folder (requires a `path` parameter). @@ -121,9 +121,9 @@ Workspace: - [@typeagent/action-grammar-compiler](../../../packages/actionGrammarCompiler/README.md) - [@typeagent/action-schema-compiler](../../../packages/actionSchemaCompiler/README.md) - [@typeagent/agent-sdk](../../../packages/agentSdk/README.md) +- [@typeagent/telemetry](../../../packages/telemetry/README.md) +- [@typeagent/websocket-channel-server](../../../packages/utils/webSocketChannelServer/README.md) - [@typeagent/websocket-utils](../../../packages/utils/webSocketUtils/README.md) -- [telemetry](../../../packages/telemetry/README.md) -- [websocket-channel-server](../../../packages/utils/webSocketChannelServer/README.md) External: `better-sqlite3`, `chalk`, `debug`, `ws` @@ -150,7 +150,7 @@ _1 environment variable referenced from `./src/` (set in `ts/.env` or your shell ### Actions -_1 action implemented by this agent, parsed deterministically from `./src/codeActionsSchema.ts`. Sample utterances and parameter shapes are illustrative; consult the schema for the full signature. 12 additional actions are declared in the schema but not yet implemented; not shown._ +_1 action implemented by this agent, parsed deterministically from `./src/codeActionsSchema.ts`. Sample utterances and parameter shapes are illustrative; consult the schema for the full signature. 13 additional actions are declared in the schema but not yet implemented; not shown._ | User says | Action | | ------------------------ | ------------------------------------- | @@ -158,6 +158,6 @@ _1 action implemented by this agent, parsed deterministically from `./src/codeAc --- -_Auto-generated against commit `6bea19a9ee02598644b1ac3ab67c705dcc495832` on `2026-07-22T11:19:17.632Z` by `docs-generate.yml`. Links validated at that commit; the working tree may have drifted by up to 24h. Re-run `pnpm --filter code-agent docs:verify-links` to spot-check._ +_Auto-generated against commit `5a7bdd3625eef42d75702c9fd9f0dadb7cb10410` on `2026-07-29T05:15:39.538Z` by `docs-generate.yml`. Links validated at that commit; the working tree may have drifted by up to 24h. Re-run `pnpm --filter @typeagent/code-agent docs:verify-links` to spot-check._ diff --git a/ts/packages/agents/github-cli/README.AUTOGEN.md b/ts/packages/agents/github-cli/README.AUTOGEN.md index ff46a1eff7..f598e25662 100644 --- a/ts/packages/agents/github-cli/README.AUTOGEN.md +++ b/ts/packages/agents/github-cli/README.AUTOGEN.md @@ -3,24 +3,24 @@ - + -# github-cli-agent — AI-generated documentation +# @typeagent/github-cli-agent — AI-generated documentation > 🤖 **AI-authored documentation**, regenerated daily and validated for length, tone, and link integrity. Cross-check against the deterministic Reference section below before relying on specifics. Hand-written context from [`./README.md`](./README.md) was provided to the model as authoritative source. May lag the working tree by up to 24h — see the staleness footer at the end of this file. ## Overview -The `github-cli-agent` is a TypeAgent application agent that integrates with the GitHub CLI (`gh`) to enable natural language-driven interactions with GitHub. It provides a wide range of actions for managing repositories, issues, pull requests, workflows, and other GitHub features. By leveraging the GitHub CLI, the agent simplifies complex GitHub operations into intuitive commands. +The `@typeagent/github-cli-agent` is a TypeAgent application agent designed to interface with the GitHub CLI (`gh`). It enables natural language-driven interactions with GitHub, allowing users to perform a wide range of GitHub operations such as managing repositories, issues, pull requests, workflows, and more. By leveraging the GitHub CLI, this agent simplifies complex GitHub tasks into intuitive, user-friendly commands. ## What it does -The `github-cli-agent` supports 65 actions, grouped into the following categories: +The `github-cli-agent` supports 66 actions, grouped into several categories: -- **Authentication**: Manage GitHub authentication with actions like `authLogin`, `authLogout`, and `authStatus`. These actions allow users to log in, log out, and check their authentication status. -- **Issues**: Create, close, reopen, delete, list, and view issues using actions such as `issueCreate`, `issueClose`, `issueReopen`, `issueDelete`, `issueList`, and `issueView`. -- **Pull Requests**: Handle pull request workflows with actions like `prCreate`, `prClose`, `prMerge`, `prList`, `prView`, and `prCheckout`. These actions support creating, managing, and reviewing pull requests. +- **Authentication**: Actions like `authLogin`, `authLogout`, and `authStatus` allow users to manage their GitHub authentication, including logging in, logging out, and checking the current authentication status. +- **Issues**: Manage GitHub issues with actions such as `issueCreate`, `issueClose`, `issueReopen`, `issueDelete`, `issueList`, and `issueView`. These actions cover the full lifecycle of an issue, from creation to closure. +- **Pull Requests**: Handle pull request workflows with actions like `prCreate`, `prClose`, `prMerge`, `prList`, `prView`, and `prCheckout`. These actions support creating, managing, and reviewing pull requests, including draft PRs and merging. - **Repositories**: Perform repository-related tasks with actions such as `repoCreate`, `repoClone`, `repoDelete`, `repoView`, `repoFork`, `starRepo`, and `searchRepos`. These actions allow users to manage repositories and retrieve specific information about them. - **Codespaces**: Manage GitHub Codespaces with actions like `codespaceCreate`, `codespaceDelete`, and `codespaceList`. - **Gists**: Create, delete, and list gists using `gistCreate`, `gistDelete`, and `gistList`. @@ -35,7 +35,7 @@ The agent enhances usability by providing features such as clickable hyperlinks ## Setup -To use the `github-cli-agent`, you need to complete the following setup steps: +To use the `@typeagent/github-cli-agent`, follow these setup steps: 1. **Install the GitHub CLI**: Download and install the GitHub CLI from `https://cli.github.com/`. Ensure it is available in your system's `PATH`. 2. **Authenticate with GitHub**: Run `gh auth login` to authenticate with your GitHub account. This step is required for the agent to interact with GitHub on your behalf. @@ -44,7 +44,7 @@ The agent performs a `gh auth status` readiness check at startup and before exec ## Key Files -The `github-cli-agent` is organized into several key files that define its behavior and functionality: +The `@typeagent/github-cli-agent` is structured around several key files that define its behavior and functionality: - **[github-cliManifest.json](./src/github-cliManifest.json)**: Contains metadata about the agent, including its description, emoji, and schema details. - **[github-cliSchema.ts](./src/github-cliSchema.ts)**: Defines the types and parameters for all supported actions. This file is the source of truth for the agent's capabilities. @@ -56,7 +56,7 @@ These files work together to define the agent's capabilities, interpret user inp ## How to extend -To add new functionality to the `github-cli-agent`, follow these steps: +To add new functionality to the `@typeagent/github-cli-agent`, follow these steps: 1. **Define the new action**: @@ -80,7 +80,7 @@ To add new functionality to the `github-cli-agent`, follow these steps: - Update the grammar file ([github-cliSchema.agr](./src/github-cliSchema.agr)) with sample utterances for the new action. - Verify that the deterministic documentation generation process includes the new action. -By following these steps, you can extend the `github-cli-agent` to support additional GitHub CLI commands or custom workflows. +By following these steps, you can extend the `@typeagent/github-cli-agent` to support additional GitHub CLI commands or custom workflows. ## Reference @@ -118,44 +118,44 @@ External: _None at runtime._ ### Actions -_65 actions implemented by this agent, parsed deterministically from `./src/github-cliSchema.ts`. Sample utterances and parameter shapes are illustrative; consult the schema for the full signature._ - -| User says | Action | -| ------------------------------------------------------------------------------------ | --------------------------------- | -| _(no sample)_ | `authLogin` | -| _(no sample)_ | `authLogout` | -| _(no sample)_ | `authStatus` | -| _(no sample)_ | `browseRepo` | -| _(no sample)_ | `browseIssue` | -| _(no sample)_ | `browsePr` | -| _(no sample)_ | `codespaceCreate` | -| _(no sample)_ | `codespaceDelete` | -| _(no sample)_ | `codespaceList` | -| _(no sample)_ | `gistCreate` | -| _(no sample)_ | `gistDelete` | -| _(no sample)_ | `gistList` | -| _(no sample)_ | `issueCreate` | -| _(no sample)_ | `issueClose` | -| _Permanently delete a GitHub issue (uses `gh issue delete --yes`)._ | `issueDelete` → `{ "number": 0 }` | -| _(no sample)_ | `issueReopen` | -| _(no sample)_ | `issueList` | -| _View / open a specific GitHub issue by number_ | `issueView` | -| _(no sample)_ | `orgList` | -| _(no sample)_ | `orgView` | -| _(no sample)_ | `prCreate` | -| _(no sample)_ | `prClose` | -| _(no sample)_ | `prMerge` | -| _List pull requests, optionally filtered by repo, state, label, author, or assignee_ | `prList` | -| _View / open a specific GitHub pull request by number_ | `prView` | -| _(no sample)_ | `prCheckout` | -| _(no sample)_ | `prChecks` → `{ "number": 0 }` | -| _(no sample)_ | `projectCreate` | -| _(no sample)_ | `projectDelete` | -| _(no sample)_ | `projectList` | -| _…and 35 more actions not shown (cap: 30)._ | | +_66 actions implemented by this agent, parsed deterministically from `./src/github-cliSchema.ts`. Sample utterances and parameter shapes are illustrative; consult the schema for the full signature._ + +| User says | Action | +| ------------------------------------------------------------------------------------ | -------------------------------------- | +| _(no sample)_ | `authLogin` | +| _(no sample)_ | `authLogout` | +| _(no sample)_ | `authStatus` | +| _(no sample)_ | `browseRepo` | +| _(no sample)_ | `browseIssue` | +| _(no sample)_ | `browsePr` | +| _(no sample)_ | `codespaceCreate` | +| _(no sample)_ | `codespaceDelete` | +| _(no sample)_ | `codespaceList` | +| _(no sample)_ | `gistCreate` | +| _(no sample)_ | `gistDelete` | +| _(no sample)_ | `gistList` | +| _(no sample)_ | `issueCreate` | +| _(no sample)_ | `issueClose` | +| _Permanently delete a GitHub issue (uses `gh issue delete --yes`)._ | `issueDelete` → `{ "number": 0 }` | +| _(no sample)_ | `issueReopen` | +| _(no sample)_ | `issueList` | +| _View / open a specific GitHub issue by number_ | `issueView` | +| _(no sample)_ | `orgList` | +| _(no sample)_ | `orgView` | +| _(no sample)_ | `prCreate` | +| _(no sample)_ | `prClose` | +| _Check whether a branch has already been merged into a base branch_ | `prMergedStatus` → `{ "branch": "…" }` | +| _(no sample)_ | `prMerge` | +| _List pull requests, optionally filtered by repo, state, label, author, or assignee_ | `prList` | +| _View / open a specific GitHub pull request by number_ | `prView` | +| _(no sample)_ | `prCheckout` | +| _(no sample)_ | `prChecks` → `{ "number": 0 }` | +| _(no sample)_ | `projectCreate` | +| _(no sample)_ | `projectDelete` | +| _…and 36 more actions not shown (cap: 30)._ | | --- -_Auto-generated against commit `f928ce70269b7d0f8942977c29147b2c8832b722` on `2026-07-15T22:42:29.947Z` by `docs-generate.yml`. Links validated at that commit; the working tree may have drifted by up to 24h. Re-run `pnpm --filter github-cli-agent docs:verify-links` to spot-check._ +_Auto-generated against commit `5a7bdd3625eef42d75702c9fd9f0dadb7cb10410` on `2026-07-29T05:15:39.538Z` by `docs-generate.yml`. Links validated at that commit; the working tree may have drifted by up to 24h. Re-run `pnpm --filter @typeagent/github-cli-agent docs:verify-links` to spot-check._ diff --git a/ts/packages/coda/README.AUTOGEN.md b/ts/packages/coda/README.AUTOGEN.md index 060c771950..343889d54e 100644 --- a/ts/packages/coda/README.AUTOGEN.md +++ b/ts/packages/coda/README.AUTOGEN.md @@ -3,7 +3,7 @@ - + # agent-coda — AI-generated documentation @@ -12,7 +12,7 @@ ## Overview -The `agent-coda` package is a TypeScript library that implements the Coda Operated Assistance (CODA) system, a voice-controlled coding assistant for Visual Studio Code (VSCode). It integrates with the TypeAgent shell or CLI to enable developers to perform coding tasks and manage their workspace using natural language commands. This package is designed to enhance accessibility and streamline workflows by enabling hands-free interaction with the VSCode environment. +The `agent-coda` package is a TypeScript library that powers the Coda Operated Assistance (CODA) system, a voice-controlled coding assistant for Visual Studio Code (VSCode). It integrates with the TypeAgent shell or CLI to enable developers to perform coding tasks and manage their workspace using natural language commands. This package is designed to enhance accessibility and streamline workflows by enabling hands-free interaction with the VSCode environment. ## What it does @@ -137,6 +137,6 @@ _2 environment variables referenced from `./src/` (set in `ts/.env` or your shel --- -_Auto-generated against commit `6bea19a9ee02598644b1ac3ab67c705dcc495832` on `2026-07-22T11:19:17.632Z` by `docs-generate.yml`. Links validated at that commit; the working tree may have drifted by up to 24h. Re-run `pnpm --filter agent-coda docs:verify-links` to spot-check._ +_Auto-generated against commit `5a7bdd3625eef42d75702c9fd9f0dadb7cb10410` on `2026-07-29T05:15:39.538Z` by `docs-generate.yml`. Links validated at that commit; the working tree may have drifted by up to 24h. Re-run `pnpm --filter agent-coda docs:verify-links` to spot-check._ From 4aeca61eb25f98f4327718547c658f89774d8c94 Mon Sep 17 00:00:00 2001 From: Robert Gruen Date: Tue, 28 Jul 2026 23:01:24 -0700 Subject: [PATCH 05/20] Updated action browser to include agent commands --- ts/docs/overview/action-browser.html | 26 +- ts/docs/overview/action-browser.json | 1645 ++++++++++++++++-- ts/tools/actionBrowser/README.md | 2 +- ts/tools/actionBrowser/package.json | 2 +- ts/tools/actionBrowser/src/cli.ts | 10 +- ts/tools/actionBrowser/src/collect.ts | 19 +- ts/tools/actionBrowser/src/commands.ts | 181 ++ ts/tools/actionBrowser/src/render.ts | 98 +- ts/tools/actionBrowser/src/systemCommands.ts | 105 -- ts/tools/actionBrowser/src/types.ts | 15 +- 10 files changed, 1847 insertions(+), 256 deletions(-) create mode 100644 ts/tools/actionBrowser/src/commands.ts delete mode 100644 ts/tools/actionBrowser/src/systemCommands.ts diff --git a/ts/docs/overview/action-browser.html b/ts/docs/overview/action-browser.html index db38b02809..afb7038bfb 100644 --- a/ts/docs/overview/action-browser.html +++ b/ts/docs/overview/action-browser.html @@ -43,7 +43,9 @@ .cell.k-action,.cell.k-command{cursor:pointer;} .lbl{position:absolute;inset:0;padding:10px 12px;display:flex;flex-direction:column;gap:3px; justify-content:flex-start;color:#fff;text-shadow:0 1px 3px rgba(0,0,0,.6);pointer-events:none;} -.lbl-name{font-weight:650;line-height:1.15;word-break:break-word;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;} +/* line-height leaves room for emoji glyphs (taller than text); flex-shrink:0 keeps the + name at full line height on short tiles instead of squashing and clipping the glyphs. */ +.lbl-name{font-weight:650;line-height:1.3;flex-shrink:0;word-break:break-word;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;} .lbl-sub{opacity:.85;font-weight:500;} .cell.sm .lbl{padding:4px 6px;gap:1px;} .cell.tiny .lbl{display:none;} @@ -134,12 +136,12 @@

🧭 TypeAgent Action Browser

-32 agents · 553 actions · 325 system commands · generated 2026-07-17 18:06:54 UTC +32 agents · 556 actions · 410 commands · generated 2026-07-29 05:59:05 UTC
- +
@@ -157,7 +159,7 @@

🧭 TypeAgent Action Browser

- + + +