@pellux/goodvibes-agent 1.0.3 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/docs/README.md CHANGED
@@ -17,12 +17,12 @@ Current package docs:
17
17
  Important baseline constraints:
18
18
 
19
19
  - Agent installs one executable: `goodvibes-agent`.
20
- - Current package version is recorded in `package.json` and `CHANGELOG.md`; the latest completed `1.0.x` release in this tree is `1.0.1`.
20
+ - Current package version is recorded in `package.json` and `CHANGELOG.md`; the latest completed `1.0.x` release in this tree is `1.0.3`.
21
21
  - Agent uses Bun `1.3.10` or newer and TypeScript-authored source.
22
22
  - Agent depends on `@pellux/goodvibes-sdk@0.33.35`.
23
23
  - Agent connects to a GoodVibes host owned outside this product.
24
24
  - Agent does not start, stop, restart, install, uninstall, or own the connected GoodVibes host.
25
- - User-facing Agent workspace actions, built-in panels, top-level CLI mirrors, slash commands, command policy metadata, model tools, settings, local registries, and connected-host capability boundaries are model-visible through Agent-owned tools. Mutations remain explicit and confirmation-gated.
25
+ - User-facing Agent workspace actions, built-in panels, modal/overlay/picker UI surfaces, top-level CLI mirrors, fixed shortcuts, configurable keybindings, slash commands, command policy metadata, model tools, settings, local registries, and connected-host capability boundaries are model-visible through Agent-owned tools. Mutations and visible UI routing remain explicit and confirmation-gated.
26
26
  - Agent Knowledge uses only `/api/goodvibes-agent/knowledge/*`; there is no default knowledge or non-Agent product fallback.
27
27
  - Agent supports isolated Agent homes with `GOODVIBES_AGENT_HOME=<path>` and named profile homes with `goodvibes-agent profiles create <name> --template <starter> --yes` plus `--agent-profile <name>`.
28
28
  - Agent supports connected-host URL overrides with `--runtime-url http://host:port` or `GOODVIBES_AGENT_RUNTIME_URL=http://host:port`; these only change the Agent connection target.
@@ -44,7 +44,7 @@ After setup has been applied once, the TUI opens directly into the Agent operato
44
44
 
45
45
  Press `/` inside the Agent workspace to search every workspace action by name, category, command, or detail. Use that finder before reaching for shell commands; CLI subcommands are scriptable mirrors of these TUI workflows.
46
46
 
47
- The model can inspect and use the same harness surface through Agent-owned tools. `agent_harness` exposes workspace action discovery, built-in panel discovery/routing, top-level CLI mirror discovery, slash-command discovery, command policy metadata, command execution with confirmation, model tool discovery, settings inspection/mutation, and connected-host posture. CLI mirror modes are read-only catalog/parser inspection and point the model to the matching in-process tool, workspace action, setting mode, or slash-command mirror. Panel modes expose catalog/open state and route visible panel/workspace changes through the current Agent shell bridge with confirmation. Workspace action discovery can include editor field schemas with `includeParameters:true`, including starter-template defaults for profile creation and selected-routine defaults for routine schedule promotion when `recordId` is supplied. Selection-based local workspace actions accept a local `recordId`, so the model can use the same note promotion and local registry flows as the TUI. First-class model tools cover the main product workflows directly: Agent Knowledge, Agent Knowledge ingest, Agent-local memory/notes/personas/skills/routines, operator actions, notifications, channel sends, reminders, generated media, and work plans.
47
+ The model can inspect and use the same harness surface through Agent-owned tools. `agent_harness` exposes workspace action discovery, built-in panel discovery/routing, modal/overlay/picker UI surface discovery/routing, top-level CLI mirror discovery, fixed shortcut and configurable keybinding discovery, keybinding mutation with confirmation, slash-command discovery, command policy metadata, command execution with confirmation, model tool discovery, settings inspection/mutation, and connected-host posture. CLI mirror modes are read-only catalog/parser inspection and point the model to the matching in-process tool, workspace action, setting mode, or slash-command mirror. Panel modes expose catalog/open state and route visible panel/workspace changes through the current Agent shell bridge with confirmation. UI surface modes expose help, shortcuts, context, bookmarks, model/provider pickers, session/profile pickers, settings, MCP workspace, onboarding, and Agent workspace entrypoints; `open_ui_surface` is confirmation-gated and only performs visible shell navigation. Shortcut modes expose the fixed runtime/editor shortcuts and the live keybindings table; confirmed keybinding edits write the same `keybindings.json` file the user edits and reload the runtime manager. Workspace action discovery can include editor field schemas with `includeParameters:true`, including starter-template defaults for profile creation and selected-routine defaults for routine schedule promotion when `recordId` is supplied. Selection-based local workspace actions accept a local `recordId`, so the model can use the same note promotion and local registry flows as the TUI. First-class model tools cover the main product workflows directly: Agent Knowledge, Agent Knowledge ingest, Agent-local memory/notes/personas/skills/routines, operator actions, notifications, channel sends, reminders, generated media, and work plans.
48
48
 
49
49
  Use the Artifacts area for concrete files and generated output: attach images to prompts, export conversations or saved sessions, ingest local source files and URL lists into Agent Knowledge, import bookmarks or browser history, inspect source records, and generate media artifacts from confirmed prompts.
50
50
 
@@ -122,7 +122,7 @@ Use `/channels` inside the TUI for channel readiness and exact confirmed sends.
122
122
 
123
123
  The main assistant conversation can perform narrow confirmed operator actions when the user explicitly asks for a specific target: approve/deny/cancel one approval, run/pause/resume one automation job, cancel/retry one automation run, or run one schedule. Those calls use only public connected-host routes, require confirmation, and do not create, edit, or delete automation definitions.
124
124
 
125
- When the main assistant conversation needs to change Agent settings or run a user-facing harness action, it should use `agent_harness` rather than generic SDK context/settings tools. Setting descriptors report writability, workspace visibility, and lock reasons; secret-backed settings store raw values through the secret manager; connected-host lifecycle settings stay read-only in Agent; and destructive local record deletion requires explicit confirmation.
125
+ When the main assistant conversation needs to change Agent settings, change Agent keybindings, open a visible UI surface, or run a user-facing harness action, it should use `agent_harness` rather than generic SDK context/settings tools. Setting descriptors report writability, workspace visibility, and lock reasons; keybinding descriptors report fixed shortcuts, resolved bindings, defaults, custom state, and config path; UI surface descriptors report the visible shell opener, preferred model route, and confirmation policy; secret-backed settings store raw values through the secret manager; connected-host lifecycle settings stay read-only in Agent; and destructive local record deletion requires explicit confirmation.
126
126
 
127
127
  ## Connected GoodVibes Host
128
128
 
@@ -43,20 +43,24 @@ Host-management and coding-first commands that would imply connected-host lifecy
43
43
 
44
44
  The main Agent model has an Agent-owned harness bridge rather than generic SDK settings/context control. Use these model tools as the supported parity layer:
45
45
 
46
- - `agent_harness`: inspect workspace categories/actions, inspect built-in panels, inspect top-level CLI mirrors, inspect slash commands and command policy metadata, run concrete workspace or slash-command mirrors with confirmation, inspect model tools, inspect or change Agent settings, and inspect connected-host posture.
46
+ - `agent_harness`: inspect workspace categories/actions, inspect built-in panels, inspect modal/overlay/picker UI surfaces, inspect top-level CLI mirrors, inspect fixed shortcuts and configurable keybindings, inspect slash commands and command policy metadata, run concrete workspace or slash-command mirrors with confirmation, inspect model tools, inspect or change Agent settings/keybindings, and inspect connected-host posture.
47
47
  - `agent_local_registry`: inspect and maintain Agent-local memory, notes, personas, skills, skill bundles, and routines. Deleting local records requires `confirm:true` and `explicitUserRequest`.
48
48
  - `agent_knowledge` and `agent_knowledge_ingest`: ask/search and ingest into the isolated Agent Knowledge segment.
49
49
  - `agent_operator_briefing` and `agent_operator_action`: inspect connected work/approval/automation posture, or run exact confirmed approval/automation actions.
50
50
  - `agent_work_plan`: keep the visible Agent-local work plan current from the conversation.
51
51
  - `agent_channel_send`, `agent_notify`, `agent_reminder_schedule`, and `agent_media_generate`: perform confirmed external delivery, notification, reminder, or media actions when the user explicitly asks.
52
52
 
53
- `agent_harness` discovery modes are read-only. `summary` reports the model access map; `panels` and `panel` return the built-in panel catalog, current open/focused state, and each panel's matching Agent workspace route; `cli_commands` and `cli_command` return top-level package CLI mirror metadata, parser output, blocked command tokens, and preferred in-process model routes; `commands` and `command` return slash-command descriptions plus effect/confirmation/preferred-tool/boundary policy metadata; `workspace_actions` lists Agent workspace actions and can inline editor field schemas with `includeParameters:true`; `workspace_action` returns one action with its editor schema; `tools` can inline model tool JSON schemas with `includeParameters:true`; `settings` returns setting descriptors plus setting policy; and `connected_host` returns the connected-host route families, allowed capabilities, blocked capabilities, and first-class tool availability.
53
+ `agent_harness` discovery modes are read-only. `summary` reports the model access map; `panels` and `panel` return the built-in panel catalog, current open/focused state, and each panel's matching Agent workspace route; `ui_surfaces` and `ui_surface` return modal, overlay, picker, and workspace entrypoints with shell-opener availability and preferred model routes; `cli_commands` and `cli_command` return top-level package CLI mirror metadata, parser output, blocked command tokens, and preferred in-process model routes; `shortcuts` returns fixed runtime/editor shortcuts plus configurable keybindings; `keybindings` and `keybinding` return the live resolved keybinding table, default bindings, custom state, and config path; `commands` and `command` return slash-command descriptions plus effect/confirmation/preferred-tool/boundary policy metadata; `workspace_actions` lists Agent workspace actions and can inline editor field schemas with `includeParameters:true`; `workspace_action` returns one action with its editor schema; `tools` can inline model tool JSON schemas with `includeParameters:true`; `settings` returns setting descriptors plus setting policy; and `connected_host` returns the connected-host route families, allowed capabilities, blocked capabilities, and first-class tool availability.
54
+
55
+ `open_ui_surface` is a confirmation-gated visible navigation mode for the same shell surfaces the user can open: Agent workspace, settings, MCP workspace, model/provider pickers, session/profile pickers, bookmarks, context inspector, help, shortcuts, and onboarding. It does not perform hidden operations; use first-class model tools, settings modes, workspace actions, or confirmed slash-command mirrors for actual state changes.
56
+
57
+ `set_keybinding` and `reset_keybinding` are confirmation-gated control modes. They write the same Agent `keybindings.json` file exposed by `/keybindings`, reload the runtime keybinding manager, and leave fixed runtime/editor shortcuts read-only.
54
58
 
55
59
  `open_panel` is a confirmation-gated UI routing mode. It hands a visible panel/workspace route to the current Agent shell bridge and does not mutate connected-host lifecycle, listener posture, or external accounts.
56
60
 
57
61
  CLI mirror modes are catalog and parser inspection only. When the user asks the model to operate from inside the main conversation, use the returned first-class model tool, workspace action, setting mode, or confirmed slash-command mirror instead of launching a hidden nested `goodvibes-agent` process.
58
62
 
59
- Setting writes, setting resets, slash-command invocation, workspace-action invocation, local record deletion, channel sends, notifications, reminders, media generation, and connected-host operator mutations require explicit user request and confirmation. Secret-backed settings are stored through the secret manager, and connected-host lifecycle/listener settings remain read-only in Agent.
63
+ Setting writes, setting resets, keybinding writes/resets, UI surface routing, slash-command invocation, workspace-action invocation, local record deletion, channel sends, notifications, reminders, media generation, and connected-host operator mutations require explicit user request and confirmation. Secret-backed settings are stored through the secret manager, and connected-host lifecycle/listener settings remain read-only in Agent.
60
64
 
61
65
  Selection-based local workspace actions use the same bridge. `agent_harness` reports the required model tool for each local action; for actions that depend on the TUI selection, call `run_workspace_action` with the selected local `recordId`. Note promotion actions can prefill and create memory, personas, skills, routines, or isolated Agent Knowledge URL ingests through the matching first-class model tool. Profile creation schemas include the current runtime starter-template inventory, and routine schedule schemas prefill the selected routine when `recordId` or a `routineId` field matches a local routine.
62
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pellux/goodvibes-agent",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "private": false,
5
5
  "description": "GoodVibes personal operator assistant TUI with a proactive Agent product brain, isolated Agent Knowledge, local profiles, routines, skills, personas, and explicit build delegation.",
6
6
  "type": "module",
@@ -0,0 +1,262 @@
1
+ import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
2
+ import { dirname } from 'node:path';
3
+ import type { CommandContext } from '../input/command-registry.ts';
4
+ import {
5
+ ACTION_DESCRIPTIONS,
6
+ DEFAULT_KEYBINDINGS,
7
+ type KeyAction,
8
+ type KeyCombo,
9
+ type KeybindingsManager,
10
+ } from '../input/keybindings.ts';
11
+
12
+ const FIXED_SHORTCUTS: readonly Record<string, string>[] = [
13
+ { key: 'Enter', description: 'Send prompt' },
14
+ { key: 'Shift+Enter / Ctrl+J', description: 'Insert newline' },
15
+ { key: 'Up / Down', description: 'Navigate input history, lists, and scrollable overlays' },
16
+ { key: 'Tab', description: 'Autocomplete slash command or file mention' },
17
+ { key: 'Esc', description: 'Close overlays, pickers, and transient input modes' },
18
+ { key: '? / F1', description: 'Toggle help overlay' },
19
+ { key: 'F2 / /shortcuts', description: 'Open keyboard shortcut reference' },
20
+ { key: '/keybindings', description: 'List configurable keybindings and config path' },
21
+ ];
22
+
23
+ interface HarnessKeybindingArgs {
24
+ readonly query?: unknown;
25
+ readonly actionId?: unknown;
26
+ readonly key?: unknown;
27
+ readonly fields?: unknown;
28
+ readonly combo?: unknown;
29
+ readonly combos?: unknown;
30
+ readonly value?: unknown;
31
+ readonly limit?: unknown;
32
+ }
33
+
34
+ type KeybindingsOverrideFile = Record<string, unknown>;
35
+
36
+ function readString(value: unknown): string {
37
+ return typeof value === 'string' ? value.trim() : '';
38
+ }
39
+
40
+ function readLimit(value: unknown, fallback: number): number {
41
+ const parsed = typeof value === 'string' && value.trim() ? Number(value) : value;
42
+ if (typeof parsed !== 'number' || !Number.isFinite(parsed)) return fallback;
43
+ return Math.max(1, Math.min(500, Math.trunc(parsed)));
44
+ }
45
+
46
+ function readFieldMap(value: unknown): Readonly<Record<string, string>> {
47
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) return {};
48
+ return Object.fromEntries(Object.entries(value).map(([key, entry]) => [key, typeof entry === 'string' ? entry : String(entry)]));
49
+ }
50
+
51
+ function requireKeybindingsManager(context: CommandContext): KeybindingsManager {
52
+ const manager = context.workspace.keybindingsManager;
53
+ if (!manager) throw new Error('workspace.keybindingsManager is unavailable in this Agent runtime');
54
+ return manager;
55
+ }
56
+
57
+ function isKeyAction(action: string): action is KeyAction {
58
+ return Object.hasOwn(ACTION_DESCRIPTIONS, action);
59
+ }
60
+
61
+ function actionFromArgs(args: HarnessKeybindingArgs): KeyAction | null {
62
+ const action = readString(args.actionId || args.key || args.query);
63
+ return action && isKeyAction(action) ? action : null;
64
+ }
65
+
66
+ function readBoolean(value: unknown): boolean | undefined {
67
+ if (typeof value === 'boolean') return value;
68
+ if (typeof value !== 'string') return undefined;
69
+ const normalized = value.trim().toLowerCase();
70
+ if (['true', 'yes', 'y', '1', 'on'].includes(normalized)) return true;
71
+ if (['false', 'no', 'n', '0', 'off'].includes(normalized)) return false;
72
+ return undefined;
73
+ }
74
+
75
+ function normalizeCombo(value: unknown): KeyCombo | null {
76
+ if (typeof value !== 'object' || value === null || Array.isArray(value)) return null;
77
+ const raw = value as Record<string, unknown>;
78
+ const key = readString(raw.key);
79
+ if (!key) return null;
80
+ const combo: KeyCombo = { key };
81
+ const ctrl = readBoolean(raw.ctrl);
82
+ const shift = readBoolean(raw.shift);
83
+ const alt = readBoolean(raw.alt);
84
+ if (ctrl !== undefined) combo.ctrl = ctrl;
85
+ if (shift !== undefined) combo.shift = shift;
86
+ if (alt !== undefined) combo.alt = alt;
87
+ return combo;
88
+ }
89
+
90
+ function parseComboLabel(value: string): KeyCombo | null {
91
+ const parts = value.split('+').map((part) => part.trim()).filter(Boolean);
92
+ if (parts.length === 0) return null;
93
+ const key = parts.at(-1);
94
+ if (!key) return null;
95
+ const combo: KeyCombo = { key: key.length === 1 ? key.toLowerCase() : key.toLowerCase() };
96
+ for (const part of parts.slice(0, -1)) {
97
+ const normalized = part.toLowerCase();
98
+ if (normalized === 'ctrl' || normalized === 'control') combo.ctrl = true;
99
+ else if (normalized === 'shift') combo.shift = true;
100
+ else if (normalized === 'alt' || normalized === 'option') combo.alt = true;
101
+ else return null;
102
+ }
103
+ return combo;
104
+ }
105
+
106
+ function combosFromArgs(args: HarnessKeybindingArgs): KeyCombo[] {
107
+ if (Array.isArray(args.combos)) {
108
+ const combos = args.combos.map(normalizeCombo);
109
+ if (combos.every((combo): combo is KeyCombo => combo !== null)) return combos;
110
+ throw new Error('set_keybinding combos must be objects with key and optional boolean ctrl/shift/alt fields.');
111
+ }
112
+ const combo = normalizeCombo(args.combo);
113
+ if (combo) return [combo];
114
+ const fields = readFieldMap(args.fields);
115
+ const fieldCombo = normalizeCombo(fields);
116
+ if (fieldCombo) return [fieldCombo];
117
+ const labelCombo = parseComboLabel(readString(args.value));
118
+ if (labelCombo) return [labelCombo];
119
+ throw new Error('set_keybinding requires combo, combos, fields.key, or a value such as "Ctrl+G".');
120
+ }
121
+
122
+ function comboFingerprint(combo: KeyCombo): string {
123
+ return `${combo.key}:${combo.ctrl ? 1 : 0}:${combo.shift ? 1 : 0}:${combo.alt ? 1 : 0}`;
124
+ }
125
+
126
+ function combosEqual(left: readonly KeyCombo[], right: readonly KeyCombo[]): boolean {
127
+ if (left.length !== right.length) return false;
128
+ return left.every((combo, index) => comboFingerprint(combo) === comboFingerprint(right[index]));
129
+ }
130
+
131
+ function describeCombo(manager: KeybindingsManager, combo: KeyCombo): Record<string, unknown> {
132
+ return {
133
+ key: combo.key,
134
+ ctrl: combo.ctrl === true,
135
+ shift: combo.shift === true,
136
+ alt: combo.alt === true,
137
+ label: manager.formatCombo(combo),
138
+ };
139
+ }
140
+
141
+ function bindingMatches(entry: { readonly action: KeyAction; readonly description: string; readonly combos: KeyCombo[] }, query: string): boolean {
142
+ if (!query) return true;
143
+ const haystack = [
144
+ entry.action,
145
+ entry.description,
146
+ ...entry.combos.map((combo) => comboFingerprint(combo)),
147
+ ].join('\n').toLowerCase();
148
+ return haystack.includes(query.toLowerCase());
149
+ }
150
+
151
+ function describeBinding(manager: KeybindingsManager, action: KeyAction, combos: KeyCombo[]): Record<string, unknown> {
152
+ const defaults = DEFAULT_KEYBINDINGS[action];
153
+ const customized = !combosEqual(combos, defaults);
154
+ return {
155
+ action,
156
+ description: ACTION_DESCRIPTIONS[action],
157
+ bindings: combos.map((combo) => describeCombo(manager, combo)),
158
+ labels: combos.map((combo) => manager.formatCombo(combo)),
159
+ defaultBindings: defaults.map((combo) => describeCombo(manager, combo)),
160
+ customized,
161
+ source: customized ? 'custom' : 'default',
162
+ };
163
+ }
164
+
165
+ function readOverrideFile(configPath: string): KeybindingsOverrideFile {
166
+ if (!existsSync(configPath)) return {};
167
+ const parsed = JSON.parse(readFileSync(configPath, 'utf-8')) as unknown;
168
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
169
+ throw new Error(`Keybindings config ${configPath} must contain a JSON object.`);
170
+ }
171
+ return parsed as KeybindingsOverrideFile;
172
+ }
173
+
174
+ function writeOverrideFile(configPath: string, overrides: KeybindingsOverrideFile): void {
175
+ mkdirSync(dirname(configPath), { recursive: true });
176
+ writeFileSync(configPath, `${JSON.stringify(overrides, null, 2)}\n`, 'utf-8');
177
+ }
178
+
179
+ export function totalHarnessKeybindings(context: CommandContext): number {
180
+ return context.workspace.keybindingsManager?.getAll().length ?? 0;
181
+ }
182
+
183
+ export function totalHarnessShortcuts(context: CommandContext): number {
184
+ return totalHarnessKeybindings(context) + FIXED_SHORTCUTS.length;
185
+ }
186
+
187
+ export function listHarnessShortcuts(context: CommandContext, args: HarnessKeybindingArgs): Record<string, unknown> {
188
+ const keybindings = listHarnessKeybindings(context, args);
189
+ const query = readString(args.query).toLowerCase();
190
+ const fixed = FIXED_SHORTCUTS
191
+ .filter((shortcut) => !query || `${shortcut.key}\n${shortcut.description}`.toLowerCase().includes(query))
192
+ .slice(0, readLimit(args.limit, 200))
193
+ .map((shortcut) => ({ ...shortcut, source: 'fixed', userEditable: false }));
194
+ return {
195
+ configPath: keybindings.configPath,
196
+ fixedShortcuts: fixed,
197
+ configurableKeybindings: keybindings.keybindings,
198
+ returned: fixed.length + Number(keybindings.returned ?? 0),
199
+ total: totalHarnessShortcuts(context),
200
+ policy: 'Fixed shortcuts are runtime/editor controls. Configurable keybindings can be changed with set_keybinding/reset_keybinding.',
201
+ };
202
+ }
203
+
204
+ export function listHarnessKeybindings(context: CommandContext, args: HarnessKeybindingArgs): Record<string, unknown> {
205
+ const manager = requireKeybindingsManager(context);
206
+ const query = readString(args.query);
207
+ const entries = manager.getAll()
208
+ .filter((entry) => bindingMatches(entry, query))
209
+ .slice(0, readLimit(args.limit, 200))
210
+ .map((entry) => describeBinding(manager, entry.action, entry.combos));
211
+ return {
212
+ configPath: manager.getConfigPath(),
213
+ keybindings: entries,
214
+ returned: entries.length,
215
+ total: manager.getAll().length,
216
+ policy: 'Reads the live resolved keybindings. set_keybinding/reset_keybinding write the same keybindings.json file the user can edit and reload the runtime manager.',
217
+ };
218
+ }
219
+
220
+ export function describeHarnessKeybinding(context: CommandContext, args: HarnessKeybindingArgs): Record<string, unknown> | null {
221
+ const manager = requireKeybindingsManager(context);
222
+ const action = actionFromArgs(args);
223
+ if (!action) return null;
224
+ const entry = manager.getAll().find((candidate) => candidate.action === action);
225
+ return entry ? {
226
+ configPath: manager.getConfigPath(),
227
+ ...describeBinding(manager, entry.action, entry.combos),
228
+ } : null;
229
+ }
230
+
231
+ export function setHarnessKeybinding(context: CommandContext, args: HarnessKeybindingArgs): Record<string, unknown> {
232
+ const manager = requireKeybindingsManager(context);
233
+ const action = actionFromArgs(args);
234
+ if (!action) throw new Error('set_keybinding requires a valid keybinding action id.');
235
+ const combos = combosFromArgs(args);
236
+ const configPath = manager.getConfigPath();
237
+ const overrides = readOverrideFile(configPath);
238
+ overrides[action] = combos.length === 1 ? combos[0] : combos;
239
+ writeOverrideFile(configPath, overrides);
240
+ manager.loadFromDisk();
241
+ return {
242
+ status: 'updated',
243
+ configPath,
244
+ keybinding: describeHarnessKeybinding(context, { actionId: action }),
245
+ };
246
+ }
247
+
248
+ export function resetHarnessKeybinding(context: CommandContext, args: HarnessKeybindingArgs): Record<string, unknown> {
249
+ const manager = requireKeybindingsManager(context);
250
+ const action = actionFromArgs(args);
251
+ if (!action) throw new Error('reset_keybinding requires a valid keybinding action id.');
252
+ const configPath = manager.getConfigPath();
253
+ const overrides = readOverrideFile(configPath);
254
+ delete overrides[action];
255
+ writeOverrideFile(configPath, overrides);
256
+ manager.loadFromDisk();
257
+ return {
258
+ status: 'reset',
259
+ configPath,
260
+ keybinding: describeHarnessKeybinding(context, { actionId: action }),
261
+ };
262
+ }
@@ -0,0 +1,127 @@
1
+ export const AGENT_HARNESS_MODES = [
2
+ 'summary', 'cli_commands', 'cli_command', 'panels', 'panel', 'open_panel',
3
+ 'ui_surfaces', 'ui_surface', 'open_ui_surface',
4
+ 'shortcuts', 'keybindings', 'keybinding', 'set_keybinding', 'reset_keybinding',
5
+ 'commands', 'command', 'run_command', 'settings', 'get_setting', 'set_setting',
6
+ 'reset_setting', 'workspace', 'workspace_categories', 'workspace_actions',
7
+ 'workspace_action', 'run_workspace_action', 'tools', 'connected_host',
8
+ ] as const;
9
+
10
+ const KEY_COMBO_PARAMETER_SCHEMA = {
11
+ type: 'object',
12
+ properties: { key: { type: 'string' }, ctrl: { type: 'boolean' }, shift: { type: 'boolean' }, alt: { type: 'boolean' } },
13
+ required: ['key'],
14
+ additionalProperties: false,
15
+ } as const;
16
+
17
+ export const AGENT_HARNESS_PARAMETER_PROPERTIES = {
18
+ mode: {
19
+ type: 'string',
20
+ enum: AGENT_HARNESS_MODES,
21
+ description: 'Harness operation to perform.',
22
+ },
23
+ query: {
24
+ type: 'string',
25
+ description: 'Search text for command, setting, tool, or UI surface catalogs.',
26
+ },
27
+ command: {
28
+ type: 'string',
29
+ description: 'Full slash command string for mode run_command, for example "/settings get provider.model". In cli_command mode this may also hold a top-level CLI string such as "goodvibes-agent status --json".',
30
+ },
31
+ cliCommand: {
32
+ type: 'string',
33
+ description: 'Top-level CLI command string for mode cli_command, for example "goodvibes-agent status --json" or "profiles list". This mode is read-only metadata/parse inspection.',
34
+ },
35
+ commandName: {
36
+ type: 'string',
37
+ description: 'Slash command root without the leading slash for mode command or run_command, or a top-level CLI command token for cli_command.',
38
+ },
39
+ args: {
40
+ type: 'array',
41
+ items: { type: 'string' },
42
+ description: 'Slash command argument tokens for mode run_command when commandName is used.',
43
+ },
44
+ categoryId: {
45
+ type: 'string',
46
+ description: 'Agent workspace category id for workspace action filtering or ui surface routing.',
47
+ },
48
+ surfaceId: {
49
+ type: 'string',
50
+ description: 'UI surface id for ui_surface or open_ui_surface modes.',
51
+ },
52
+ panelId: {
53
+ type: 'string',
54
+ description: 'Built-in panel id for panel or open_panel modes.',
55
+ },
56
+ actionId: {
57
+ type: 'string',
58
+ description: 'Agent workspace action id for workspace_action or run_workspace_action, or keybinding action id for keybinding/set_keybinding/reset_keybinding.',
59
+ },
60
+ fields: {
61
+ type: 'object',
62
+ additionalProperties: { type: 'string' },
63
+ description: 'Field values for run_workspace_action when the workspace action opens an editor form.',
64
+ },
65
+ combo: {
66
+ ...KEY_COMBO_PARAMETER_SCHEMA,
67
+ description: 'Single key combo for set_keybinding, for example { "key": "g", "ctrl": true }.',
68
+ },
69
+ combos: {
70
+ type: 'array',
71
+ items: KEY_COMBO_PARAMETER_SCHEMA,
72
+ description: 'Multiple key combos for set_keybinding.',
73
+ },
74
+ recordId: {
75
+ type: 'string',
76
+ description: 'Selected Agent-local record id for selection-based local workspace operations.',
77
+ },
78
+ key: {
79
+ type: 'string',
80
+ description: 'Agent setting key for get_setting, set_setting, or reset_setting.',
81
+ },
82
+ value: {
83
+ anyOf: [
84
+ { type: 'string' },
85
+ { type: 'number' },
86
+ { type: 'boolean' },
87
+ ],
88
+ description: 'Setting value for set_setting. Strings, booleans, numbers, and enum strings are accepted.',
89
+ },
90
+ target: {
91
+ type: 'string',
92
+ description: 'Optional UI target, such as a model-picker target or settings target key.',
93
+ },
94
+ category: {
95
+ type: 'string',
96
+ description: 'Setting category filter such as provider, behavior, tools, ui, tts, permissions, automation, or surfaces.',
97
+ },
98
+ prefix: {
99
+ type: 'string',
100
+ description: 'Setting key prefix filter such as surfaces.slack.',
101
+ },
102
+ includeHidden: {
103
+ type: 'boolean',
104
+ description: 'Include settings hidden from the Agent workspace because they are host-owned or non-Agent lifecycle settings.',
105
+ },
106
+ includeParameters: {
107
+ type: 'boolean',
108
+ description: 'Include model tool JSON schemas in tools mode, or workspace editor field schemas in workspace_actions mode.',
109
+ },
110
+ limit: {
111
+ type: 'number',
112
+ description: 'Maximum catalog entries to return.',
113
+ },
114
+ pane: {
115
+ type: 'string',
116
+ enum: ['top', 'bottom'],
117
+ description: 'Preferred panel pane for open_panel when the current shell supports panel routing.',
118
+ },
119
+ confirm: {
120
+ type: 'boolean',
121
+ description: 'Required true for set_setting, reset_setting, run_command, open_panel, open_ui_surface, and mutating run_workspace_action calls after an explicit user request.',
122
+ },
123
+ explicitUserRequest: {
124
+ type: 'string',
125
+ description: 'Exact user request or faithful short summary authorizing a setting mutation or harness UI/command invocation.',
126
+ },
127
+ } as const;