Skip to content

Commit 0a63218

Browse files
stevelucclaude
andauthored
Add voice-first UI mode and MCP command executor improvements (#1940)
## Summary - **Voice-first UI mode**: New `.voice-mode` CSS layer for large-screen/AR/car use cases — animated `VoiceOrb` component with idle/wake-word-waiting/listening/thinking/speaking states, last-result glanceable card, mode banner, and settings toggle. Auto-starts/stops continuous wake word detection. Wake word changed from `"hey type agent"` → `"type agent"` with normalization for `"typeagent"`. - **MCP command executor improvements**: Live agent schema resolution via new `getAgentSchemas()` dispatcher RPC (with static registry fallback). Added `naturalLanguage` param to `execute_action` so TypeAgent's NL cache gets populated. Fixed apostrophe-in-JSON bug using `\u0027` Unicode escape. Updated tool descriptions to steer Claude toward `discover_agents` + `execute_action` for multi-step orchestration. - **Dispatcher schema RPC**: New `ActionInfo`, `AgentSubSchemaInfo`, `AgentSchemaInfo` types; `getAgentSchemas(agentName?)` wired through dispatcher types, server, and client. - **Shell agent manifests**: Added code, email, image, photo, video agents to shell manifest registrations. ## Test plan - [ ] Build: `pnpm run build` from `ts/` — no type errors - [ ] Voice mode: `@shell voice on` → body gets `voice-mode` class, orb appears, "Voice Mode" banner visible - [ ] Voice orb states: submit a message → orb shows `thinking`, response arrives → back to `idle` - [ ] Wake word: with mic enabled, voice mode auto-starts continuous; say "type agent, what time is it?" → `wake-word-waiting` → `listening` → `thinking` → `idle` - [ ] Settings: Settings panel shows "Voice mode" checkbox that persists across reload - [ ] `@shell voice off` → desktop UI unchanged, orb hidden - [ ] MCP: `execute_action` with apostrophes in params (e.g., song titles) no longer breaks JSON parsing - [ ] MCP: `discover_agents` returns live schema data from dispatcher - [ ] MCP: `execute_action` with `naturalLanguage` populates TypeAgent NL cache 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9aa6de4 commit 0a63218

35 files changed

+2685
-1100
lines changed

ts/packages/actionGrammar/src/generation/grammarGenerator.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface RuleRHS {
1717
// Parameters that map to the action
1818
actionParameters: Array<{
1919
parameterName: string;
20-
parameterValue: string; // e.g., "$(track)" or fixed value like "kitchen"
20+
parameterValue: string; // e.g., "track" (bare var name) or fixed value like "kitchen"; arrays: "[artist]"
2121
}>;
2222
}
2323

@@ -97,7 +97,7 @@ WILDCARD RULES:
9797
2. Structure words (the, a, in, by, to, for, etc.) = fixed text
9898
3. Question words (what, where, when, who, why, how) = fixed text
9999
4. For array parameters: if only one item is given, use singular variable name
100-
- Example Pattern: "by $(artist:wildcard)" → maps to artists: [$(artist)]
100+
- Example Pattern: "by $(artist:wildcard)" → maps to artists: [artist]
101101
102102
WILDCARD TYPES:
103103
- Built-in entity types: $(varName:CalendarDate), $(varName:CalendarTime), $(varName:CalendarTimeRange)
@@ -125,7 +125,7 @@ interface RuleRHS {
125125
matchPattern: string; // The grammar pattern like "play $(track:wildcard) by $(artist:wildcard)"
126126
actionParameters: Array<{
127127
parameterName: string;
128-
parameterValue: string; // e.g., "$(track)" or fixed value like "kitchen"
128+
parameterValue: string; // e.g., "track" (bare var name) or fixed value like "kitchen"; arrays: "[artist]"
129129
}>;
130130
}
131131
@@ -172,7 +172,7 @@ Output:
172172
{ "parameterName": "deviceName", "sourceText": "kitchen", "targetValue": "kitchen", "isWildcard": true }
173173
],
174174
"fixedPhrases": ["select", "device"],
175-
"grammarPattern": { "matchPattern": "select $(deviceName:wildcard) device", "actionParameters": [ { "parameterName": "deviceName", "parameterValue": "$(deviceName)" } ] },
175+
"grammarPattern": { "matchPattern": "select $(deviceName:wildcard) device", "actionParameters": [ { "parameterName": "deviceName", "parameterValue": "deviceName" } ] },
176176
"reasoning": "Fixed structure 'select...device'. Parameter deviceName is validated (checked_wildcard), use wildcard type."
177177
}
178178
@@ -191,7 +191,7 @@ Output:
191191
{ "parameterName": "artists", "sourceText": "queen", "targetValue": ["queen"], "isWildcard": true }
192192
],
193193
"fixedPhrases": ["play", "by"],
194-
"grammarPattern": { "matchPattern": "play $(trackName:wildcard) by $(artist:wildcard)", "actionParameters": [ { "parameterName": "trackName", "parameterValue": "$(trackName)" }, { "parameterName": "artists", "parameterValue": "[$(artist)]" } ] },
194+
"grammarPattern": { "matchPattern": "play $(trackName:wildcard) by $(artist:wildcard)", "actionParameters": [ { "parameterName": "trackName", "parameterValue": "trackName" }, { "parameterName": "artists", "parameterValue": "[artist]" } ] },
195195
"reasoning": "Fixed structure 'play...by'. Both parameters are validated so adjacent wildcards are OK. Use singular 'artist' for array parameter 'artists'."
196196
}`;
197197

ts/packages/actionGrammar/src/generation/schemaToGrammarGenerator.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ CRITICAL SYNTAX RULES:
7070
4. Wildcard type annotations CANNOT contain pipes or unions
7171
For parameters with union types (e.g., CalendarTime | CalendarTimeRange):
7272
OPTION A: Create a sub-rule with alternation
73-
@ <TimeSpec> = $(t:CalendarTime) -> $(t) | $(t:CalendarTimeRange) -> $(t)
73+
@ <TimeSpec> = $(t:CalendarTime) -> t | $(t:CalendarTimeRange) -> t
7474
OPTION B: Just use one of the types
7575
@ <TimeExpr> = $(time:CalendarTime)
7676
WRONG: $(time:CalendarTime | CalendarTimeRange)

ts/packages/agentServer/server/src/server.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ async function main() {
2626
const instanceDir = getInstanceDir();
2727

2828
// did the launch request a specific config? (e.g. "test" to load "config.test.json")
29+
const configIdx = process.argv.indexOf("--config");
2930
const configName =
30-
process.argv[process.argv.indexOf("--config") + 1] || undefined;
31+
configIdx !== -1 ? process.argv[configIdx + 1] : undefined;
3132

3233
// Create single shared dispatcher with routing ClientIO
3334
const sharedDispatcher = await createSharedDispatcher("agent server", {

ts/packages/agents/calendar/src/calendarActionHandlerV3.ts

Lines changed: 183 additions & 55 deletions
Large diffs are not rendered by default.

ts/packages/agents/code/package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@
1717
"./agent/handlers": "./dist/codeActionHandler.js"
1818
},
1919
"scripts": {
20-
"build": "npm run tsc",
20+
"asc": "asc -i ./src/codeActionsSchema.ts -o ./dist/codeSchema.pas.json -t CodeActions -a CodeActivity",
21+
"asc:all": "concurrently npm:asc npm:asc:debug npm:asc:display npm:asc:general npm:asc:editor npm:asc:workbench npm:asc:extension",
22+
"asc:debug": "asc -i ./src/vscode/debugActionsSchema.ts -o ./dist/debugSchema.pas.json -t CodeDebugActions",
23+
"asc:display": "asc -i ./src/vscode/displayActionsSchema.ts -o ./dist/displaySchema.pas.json -t CodeDisplayActions",
24+
"asc:editor": "asc -i ./src/vscode/editorCodeActionsSchema.ts -o ./dist/editorSchema.pas.json -t EditorCodeActions",
25+
"asc:extension": "asc -i ./src/vscode/extensionsActionsSchema.ts -o ./dist/extensionSchema.pas.json -t CodeWorkbenchExtensionActions",
26+
"asc:general": "asc -i ./src/vscode/generalActionsSchema.ts -o ./dist/generalSchema.pas.json -t CodeGeneralActions",
27+
"asc:workbench": "asc -i ./src/vscode/workbenchCommandActionsSchema.ts -o ./dist/workbenchSchema.pas.json -t CodeWorkbenchActions",
28+
"build": "concurrently npm:tsc npm:asc:all",
2129
"clean": "rimraf --glob dist *.tsbuildinfo *.done.build.log",
2230
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
2331
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
@@ -33,9 +41,11 @@
3341
"ws": "^8.17.1"
3442
},
3543
"devDependencies": {
44+
"@typeagent/action-schema-compiler": "workspace:*",
3645
"@types/better-sqlite3": "7.6.13",
3746
"@types/debug": "^4.1.12",
3847
"@types/ws": "^8.5.10",
48+
"concurrently": "^9.1.2",
3949
"prettier": "^3.5.3",
4050
"rimraf": "^6.0.1",
4151
"typescript": "~5.4.5"

ts/packages/agents/code/src/codeManifest.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"schema": {
66
"description": "Code agent helps you with productivity in using an editor and performing actions like creating files, editor customization, writing code, intelligent code suggestions, real-time error detection, debugging, and source control tasks etc.",
77
"schemaFile": "./codeActionsSchema.ts",
8+
"compiledSchemaFile": "agents/code/dist/codeSchema.pas.json",
89
"schemaType": {
910
"action": "CodeActions",
1011
"activity": "CodeActivity"
@@ -15,41 +16,47 @@
1516
"schema": {
1617
"description": "Code agent that helps you debug code including handling actions like showing the debug panel, adding/toggling breakpoints, stepping in/out of code etc.",
1718
"schemaFile": "./vscode/debugActionsSchema.ts",
19+
"compiledSchemaFile": "agents/code/dist/debugSchema.pas.json",
1820
"schemaType": "CodeDebugActions"
1921
}
2022
},
2123
"code-display": {
2224
"schema": {
2325
"description": "Code agent that helps you work with display keyboard bindings, Zoom in, Zoom out, do text search and replace, show extensions etc.",
2426
"schemaFile": "./vscode/displayActionsSchema.ts",
27+
"compiledSchemaFile": "agents/code/dist/displaySchema.pas.json",
2528
"schemaType": "CodeDisplayActions"
2629
}
2730
},
2831
"code-general": {
2932
"schema": {
3033
"description": "Code agent that helps you perform actions like finding a file, go to a symbol or a line in a file, Open new vscode window, show the command palette, user settings json etc.",
3134
"schemaFile": "./vscode/generalActionsSchema.ts",
35+
"compiledSchemaFile": "agents/code/dist/generalSchema.pas.json",
3236
"schemaType": "CodeGeneralActions"
3337
}
3438
},
3539
"code-editor": {
3640
"schema": {
3741
"description": "Code agent that helps you perform vscode editor actions like create a new file, go to a reference, reveal a declaration, clipboard copy or paste, add a comment line etc.",
3842
"schemaFile": "./vscode/editorCodeActionsSchema.ts",
43+
"compiledSchemaFile": "agents/code/dist/editorSchema.pas.json",
3944
"schemaType": "EditorCodeActions"
4045
}
4146
},
4247
"code-workbench": {
4348
"schema": {
4449
"description": "Code agent that helps you perform vscode workbench actions like open a file, close a file etc.",
4550
"schemaFile": "./vscode/workbenchCommandActionsSchema.ts",
51+
"compiledSchemaFile": "agents/code/dist/workbenchSchema.pas.json",
4652
"schemaType": "CodeWorkbenchActions"
4753
}
4854
},
4955
"code-extension": {
5056
"schema": {
5157
"description": "Code agent that helps you perform vscode extension actions like show, install, update, enable, disable, uninstall extensions etc.",
5258
"schemaFile": "./vscode/extensionsActionsSchema.ts",
59+
"compiledSchemaFile": "agents/code/dist/extensionSchema.pas.json",
5360
"schemaType": "CodeWorkbenchExtensionActions"
5461
}
5562
}

ts/packages/agents/email/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"./agent/handlers": "./dist/emailActionHandler.js"
1818
},
1919
"scripts": {
20-
"build": "npm run tsc",
20+
"asc": "asc -i ./src/emailActionsSchema.ts -o ./dist/emailSchema.pas.json -t EmailAction",
21+
"build": "concurrently npm:tsc npm:asc",
2122
"clean": "rimraf --glob dist *.tsbuildinfo *.done.build.log",
2223
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
2324
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
@@ -34,7 +35,9 @@
3435
"typeagent": "workspace:*"
3536
},
3637
"devDependencies": {
38+
"@typeagent/action-schema-compiler": "workspace:*",
3739
"@types/debug": "^4.1.12",
40+
"concurrently": "^9.1.2",
3841
"prettier": "^3.5.3",
3942
"rimraf": "^6.0.1",
4043
"typescript": "~5.4.5"

ts/packages/agents/email/src/emailManifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"schema": {
55
"description": "Email agent helps manage email messages. Use it to send, reply, forward, find messages etc.",
66
"schemaFile": "./emailActionsSchema.ts",
7+
"compiledSchemaFile": "agents/email/dist/emailSchema.pas.json",
78
"schemaType": "EmailAction"
89
}
910
}

ts/packages/agents/image/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
"./agent/handlers": "./dist/imageActionHandler.js"
1818
},
1919
"scripts": {
20-
"build": "npm run tsc",
20+
"asc": "asc -i ./src/imageActionSchema.ts -o ./dist/imageSchema.pas.json -t ImageAction",
21+
"build": "concurrently npm:tsc npm:asc",
2122
"clean": "rimraf --glob dist *.tsbuildinfo *.done.build.log",
2223
"prettier": "prettier --check . --ignore-path ../../../.prettierignore",
2324
"prettier:fix": "prettier --write . --ignore-path ../../../.prettierignore",
@@ -30,6 +31,8 @@
3031
"typechat-utils": "workspace:*"
3132
},
3233
"devDependencies": {
34+
"@typeagent/action-schema-compiler": "workspace:*",
35+
"concurrently": "^9.1.2",
3336
"prettier": "^3.5.3",
3437
"rimraf": "^6.0.1",
3538
"typescript": "~5.4.5"

ts/packages/agents/image/src/imageManifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"schema": {
55
"description": "Image agent that creates images using AI image modes.",
66
"schemaFile": "./imageActionSchema.ts",
7+
"compiledSchemaFile": "agents/image/dist/imageSchema.pas.json",
78
"schemaType": "ImageAction"
89
}
910
}

0 commit comments

Comments
 (0)