@pellux/goodvibes-agent 1.0.18 → 1.0.20

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
@@ -22,7 +22,7 @@ Important baseline constraints:
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, single workspace-action lookup, built-in panels and single-panel lookup, modal/overlay/picker UI surfaces and single-surface lookup, named operator surfaces, top-level CLI mirrors, fixed shortcuts, configurable keybindings and single-keybinding lookup, slash commands, single-command lookup with policy metadata, model tools and individual model tool schemas, settings and single-setting lookup, local registries, connected-host capability boundaries, single connected-host capability inspection, and live connected-host readiness are model-visible through Agent-owned tools. Visible UI routing includes the command browser, reasoning-effort picker, live process output, runtime activity, settings, workspaces, and pickers the user can open. Local memory, note, persona, skill, and routine create editors can also run through confirmed workspace actions. Mutations and visible UI routing remain explicit and confirmation-gated, and ambiguous lookup matches are refused with candidates instead of guessed.
25
+ - User-facing Agent workspace actions, single workspace-action lookup, built-in panels and single-panel lookup, modal/overlay/picker UI surfaces and single-surface lookup, named operator surfaces, top-level CLI mirrors and single-mirror lookup, fixed shortcuts, configurable keybindings, single-keybinding lookup, shell-safe keybinding execution, slash commands, single-command lookup with policy metadata, model tools and individual model tool schemas, settings and single-setting lookup, local registries, connected-host capability boundaries, single connected-host capability inspection, and live connected-host readiness are model-visible through Agent-owned tools. Visible UI routing includes the command browser, reasoning-effort picker, live process output, runtime activity, settings, workspaces, and pickers the user can open. Local memory, note, persona, skill, and routine create editors can also run through confirmed workspace actions. Mutations, visible UI routing, and keybinding execution remain explicit and confirmation-gated; prompt-editor-only shortcuts stay direct user interaction; and ambiguous lookup matches are refused with candidates instead of guessed.
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, single workspace-action inspection by action id, command, or lookup text, built-in panel discovery/routing by panel id or lookup text, modal/overlay/picker UI surface discovery/routing by surface id or lookup text, top-level CLI mirror discovery, fixed shortcut and configurable keybinding discovery, keybinding inspection/mutation by action id or lookup text, slash-command discovery, single slash-command inspection by typed command or lookup text, command policy metadata, command execution with confirmation, model tool discovery and single-tool schema inspection, settings inspection/mutation by key or lookup text, connected-host capability inventory, single connected-host capability inspection, and live connected-host readiness 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, command browser, conversation search, prompt-history search, slash-command mode, file picker, block actions, context, runtime activity, live process output, bookmarks, model/provider/reasoning-effort pickers, TTS provider/voice pickers, session/profile pickers, the panel-picker compatibility route, security/knowledge/subscription operator surfaces, 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; single-action lookup uses the same user-facing search fields and returns lookup metadata plus the editor schema; single-panel, single-surface, single-keybinding, and single-setting lookup use their catalog search fields, return lookup metadata, and refuse ambiguous route or mutation requests with candidates. 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. Direct local create editors for memory, notes, personas, skills, and routines can execute from submitted fields through `run_workspace_action` and `agent_local_registry` with confirmation. 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, single workspace-action inspection by action id, command, or lookup text, built-in panel discovery/routing by panel id or lookup text, modal/overlay/picker UI surface discovery/routing by surface id or lookup text, top-level CLI mirror discovery and single-mirror lookup by command string, command token, or lookup text, fixed shortcut and configurable keybinding discovery, keybinding inspection/mutation by action id or lookup text, confirmation-gated shell-safe keybinding execution, slash-command discovery, single slash-command inspection by typed command or lookup text, command policy metadata, command execution with confirmation, model tool discovery and single-tool schema inspection, settings inspection/mutation by key or lookup text, connected-host capability inventory, single connected-host capability inspection, and live connected-host readiness 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, command browser, conversation search, prompt-history search, slash-command mode, file picker, block actions, context, runtime activity, live process output, bookmarks, model/provider/reasoning-effort pickers, TTS provider/voice pickers, session/profile pickers, the panel-picker compatibility route, security/knowledge/subscription operator surfaces, 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; keybinding descriptors include a model operation route, `run_keybinding` executes supported shell-safe equivalents only with confirmation, prompt-editor-only or terminal-selection shortcuts remain direct user interaction, and 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; single-action lookup uses the same user-facing search fields and returns lookup metadata plus the editor schema; single-CLI-mirror, single-panel, single-surface, single-keybinding, and single-setting lookup use their catalog search fields, return lookup metadata, and refuse ambiguous route or mutation requests with candidates. 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. Direct local create editors for memory, notes, personas, skills, and routines can execute from submitted fields through `run_workspace_action` and `agent_local_registry` with confirmation. 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, 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. Panel, UI surface, keybinding, and setting descriptors report lookup metadata when resolved from `target` or `query`; ambiguous route or mutation requests return candidates instead of guessing. Setting descriptors also 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.
125
+ When the main assistant conversation needs to change Agent settings, inspect/change/run supported 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. Panel, UI surface, keybinding, and setting descriptors report lookup metadata when resolved from `target` or `query`; ambiguous route or mutation requests return candidates instead of guessing. Setting descriptors also report writability, workspace visibility, and lock reasons. Keybinding descriptors report fixed shortcuts, resolved bindings, defaults, custom state, config path, and model-operation route; unsupported prompt-editor-only shortcuts stay direct user interaction instead of hidden model operations. 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,24 +43,26 @@ 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 and one workspace action by action id, command, or lookup text, inspect built-in panels and one panel by id or lookup text, inspect modal/overlay/picker UI surfaces and named operator surfaces by id or lookup text, inspect top-level CLI mirrors, inspect fixed shortcuts and configurable keybindings, inspect or change one keybinding by action id or lookup text, inspect slash commands and one slash command by typed command or lookup text with policy metadata, run concrete workspace or slash-command mirrors with confirmation, inspect model tools or one model tool schema, inspect or change Agent settings by exact key or lookup text, inspect connected-host capability boundaries or one connected-host capability, and inspect live connected-host readiness.
46
+ - `agent_harness`: inspect workspace categories/actions and one workspace action by action id, command, or lookup text, inspect built-in panels and one panel by id or lookup text, inspect modal/overlay/picker UI surfaces and named operator surfaces by id or lookup text, inspect top-level CLI mirrors and one mirror by command string, command token, or lookup text, inspect fixed shortcuts and configurable keybindings, inspect/change/run one keybinding by action id or lookup text where a shell-safe model route exists, inspect slash commands and one slash command by typed command or lookup text with policy metadata, run concrete workspace or slash-command mirrors with confirmation, inspect model tools or one model tool schema, inspect or change Agent settings by exact key or lookup text, inspect connected-host capability boundaries or one connected-host capability, and inspect live connected-host readiness.
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` lists the built-in panel catalog, and `panel` resolves one panel by `panelId`, `target`, or `query` with current open/focused state plus its matching Agent workspace route; `ui_surfaces` lists modal, overlay, picker, and workspace entrypoints, and `ui_surface` resolves one by `surfaceId`, `target`, or `query` 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` lists the live resolved keybinding table, and `keybinding`, `set_keybinding`, and `reset_keybinding` resolve one action by `actionId`, `target`, `key`, or `query` with default bindings, custom state, config path, and lookup metadata; `commands` lists slash-command descriptions; `command` returns one slash-command detail by `command`, `commandName`, `target`, or `query`, including parsed arguments 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 by `actionId`, `command`, `target`, or `query`, using the same user-facing action-search fields and returning lookup metadata plus its editor schema; `tools` lists model tool definitions and can inline JSON schemas with `includeParameters:true`; `tool` returns one model tool schema by `toolName`, `target`, or `query`; `settings` returns setting descriptors plus setting policy; `get_setting`, `set_setting`, and `reset_setting` resolve one setting by `key`, `target`, or `query`, return lookup metadata on success, and refuse ambiguous matches with candidate settings; `connected_host` returns the connected-host route families, allowed capabilities, blocked capabilities, and first-class tool availability; `connected_host_capability` returns one allowed or blocked connected-host capability by `capabilityId`, `target`, or `query` with related route families and boundary text; and `connected_host_status` performs a live read-only check of the connected-host status and Agent Knowledge status routes and reports endpoint bindings, token posture, SDK compatibility, route readiness, and findings without printing token values.
53
+ `agent_harness` discovery modes are read-only. `summary` reports the model access map; `panels` lists the built-in panel catalog, and `panel` resolves one panel by `panelId`, `target`, or `query` with current open/focused state plus its matching Agent workspace route; `ui_surfaces` lists modal, overlay, picker, and workspace entrypoints, and `ui_surface` resolves one by `surfaceId`, `target`, or `query` with shell-opener availability and preferred model routes; `cli_commands` lists top-level package CLI mirror metadata, and `cli_command` resolves one mirror by `cliCommand`, `command`, `commandName`, `target`, or `query`, returning parser output for concrete invocations, blocked command tokens, lookup metadata, and preferred in-process model routes; `shortcuts` returns fixed runtime/editor shortcuts plus configurable keybindings; `keybindings` lists the live resolved keybinding table, and `keybinding`, `run_keybinding`, `set_keybinding`, and `reset_keybinding` resolve one action by `actionId`, `target`, `key`, or `query` with default bindings, custom state, config path, lookup metadata, and model-operation route metadata; `commands` lists slash-command descriptions; `command` returns one slash-command detail by `command`, `commandName`, `target`, or `query`, including parsed arguments 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 by `actionId`, `command`, `target`, or `query`, using the same user-facing action-search fields and returning lookup metadata plus its editor schema; `tools` lists model tool definitions and can inline JSON schemas with `includeParameters:true`; `tool` returns one model tool schema by `toolName`, `target`, or `query`; `settings` returns setting descriptors plus setting policy; `get_setting`, `set_setting`, and `reset_setting` resolve one setting by `key`, `target`, or `query`, return lookup metadata on success, and refuse ambiguous matches with candidate settings; `connected_host` returns the connected-host route families, allowed capabilities, blocked capabilities, and first-class tool availability; `connected_host_capability` returns one allowed or blocked connected-host capability by `capabilityId`, `target`, or `query` with related route families and boundary text; and `connected_host_status` performs a live read-only check of the connected-host status and Agent Knowledge status routes and reports endpoint bindings, token posture, SDK compatibility, route readiness, and findings without printing token values.
54
54
 
55
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/reasoning-effort pickers, TTS provider/voice pickers, session/profile pickers, the panel-picker compatibility route, security/knowledge/subscription operator surfaces, conversation search, prompt-history search, slash-command mode, command browser, file picker, block actions, bookmarks, context inspector, runtime activity monitor, live process output, 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. Ambiguous UI surface lookup text is refused with candidate surfaces instead of routed.
56
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. Ambiguous keybinding lookup text is refused with candidate actions instead of guessed.
57
+ `cli_command` is a read-only inspection mode. Concrete CLI strings are parsed with redacted config overrides; descriptive lookup text searches the same `cli_commands` catalog and returns one match or candidate mirrors when broad.
58
+
59
+ `run_keybinding`, `set_keybinding`, and `reset_keybinding` are confirmation-gated control modes. `run_keybinding` executes only keybinding actions with a faithful current-shell route, such as cancel generation, clear screen, open/focus/dismiss visible panel workspace routes, open conversation or prompt-history search, paste through the existing clipboard handler, or open the visible block-action surface. Prompt-editor-only controls, terminal text selection, category cycling, and reserved shortcuts stay visible in descriptors but return unsupported/direct-interaction metadata instead of pretending a hidden model operation exists. `set_keybinding` and `reset_keybinding` write the same Agent `keybindings.json` file exposed by `/keybindings`, reload the runtime keybinding manager, and leave fixed runtime/editor shortcuts read-only. Ambiguous keybinding lookup text is refused with candidate actions instead of guessed.
58
60
 
59
61
  `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. Ambiguous panel lookup text is refused with candidate panels instead of routed.
60
62
 
61
63
  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.
62
64
 
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.
65
+ Setting writes, setting resets, supported keybinding actions, 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.
64
66
 
65
67
  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`. Direct local create editors for memory, notes, personas, skills, and routines can execute from submitted `fields` through `run_workspace_action`; the harness validates required fields, requires `confirm:true` and `explicitUserRequest`, and dispatches through `agent_local_registry`. 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.
66
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pellux/goodvibes-agent",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
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",
@@ -13,9 +13,16 @@ export interface AgentHarnessCliArgs {
13
13
  readonly command?: unknown;
14
14
  readonly cliCommand?: unknown;
15
15
  readonly commandName?: unknown;
16
+ readonly target?: unknown;
16
17
  readonly limit?: unknown;
17
18
  }
18
19
 
20
+ interface CliCommandLookup {
21
+ readonly source: 'cliCommand' | 'command' | 'commandName' | 'target' | 'query' | 'default';
22
+ readonly input: string;
23
+ readonly resolvedBy: 'invocation' | 'default' | 'search';
24
+ }
25
+
19
26
  function readString(value: unknown): string {
20
27
  return typeof value === 'string' ? value.trim() : '';
21
28
  }
@@ -26,6 +33,12 @@ function readLimit(value: unknown, fallback: number): number {
26
33
  return Math.max(1, Math.min(500, Math.trunc(parsed)));
27
34
  }
28
35
 
36
+ function redactCliLookupInput(input: string): string {
37
+ return input
38
+ .replace(/(--config=)([^=\s]+)=\S+/g, '$1$2=<redacted>')
39
+ .replace(/(--config\s+)([^=\s]+)=\S+/g, '$1$2=<redacted>');
40
+ }
41
+
29
42
  function cliCommandTokens(command: GoodVibesCliCommand): readonly string[] {
30
43
  if (command === 'unknown') return [];
31
44
  if (command === 'tui') return ['(no command)'];
@@ -41,13 +54,14 @@ function fallbackCliSummary(command: GoodVibesCliCommand): string {
41
54
  return 'Inspect the CLI help for this Agent package command.';
42
55
  }
43
56
 
44
- function describeCliCommand(command: GoodVibesCliCommand): Record<string, unknown> {
57
+ function describeCliCommand(command: GoodVibesCliCommand, lookup?: CliCommandLookup): Record<string, unknown> {
45
58
  const help = describeGoodVibesCommandHelp(command);
46
59
  const tokens = cliCommandTokens(command);
47
60
  return {
48
61
  name: command,
49
62
  tokens,
50
63
  invocation: command === 'tui' ? 'goodvibes-agent' : `goodvibes-agent ${tokens[0] ?? command}`,
64
+ ...(lookup ? { lookup } : {}),
51
65
  helpTopic: help?.command ?? command,
52
66
  summary: help?.summary ?? fallbackCliSummary(command),
53
67
  usage: help?.usage ?? (command === 'tui' ? ['goodvibes-agent [OPTIONS]'] : [`goodvibes-agent ${command} [ARGS]`]),
@@ -72,6 +86,15 @@ function cliCommandMatches(command: Record<string, unknown>, query: string): boo
72
86
  ].map((value) => JSON.stringify(value)).join('\n').toLowerCase().includes(query.toLowerCase());
73
87
  }
74
88
 
89
+ function cliCommandCandidate(command: Record<string, unknown>): Record<string, unknown> {
90
+ return {
91
+ name: command.name,
92
+ tokens: command.tokens,
93
+ invocation: command.invocation,
94
+ summary: command.summary,
95
+ };
96
+ }
97
+
75
98
  export function totalHarnessCliCommands(): number {
76
99
  return listGoodVibesCliCommands().filter((command) => command !== 'unknown').length;
77
100
  }
@@ -85,25 +108,67 @@ export function listHarnessCliCommands(args: AgentHarnessCliArgs): readonly Reco
85
108
  const limit = readLimit(args.limit, 200);
86
109
  return listGoodVibesCliCommands()
87
110
  .filter((command) => command !== 'unknown')
88
- .map(describeCliCommand)
111
+ .map((command) => describeCliCommand(command))
89
112
  .filter((command) => cliCommandMatches(command, query))
90
113
  .sort((a, b) => String(a.name).localeCompare(String(b.name)))
91
114
  .slice(0, limit);
92
115
  }
93
116
 
94
- function cliTokensFromArgs(args: AgentHarnessCliArgs): readonly string[] {
95
- const raw = readString(args.cliCommand) || readString(args.command) || readString(args.commandName) || readString(args.query);
96
- if (!raw) return [];
117
+ function cliInputFromArgs(args: AgentHarnessCliArgs): { readonly source: CliCommandLookup['source']; readonly input: string } | null {
118
+ const cliCommand = readString(args.cliCommand);
119
+ if (cliCommand) return { source: 'cliCommand', input: cliCommand };
120
+ const command = readString(args.command);
121
+ if (command) return { source: 'command', input: command };
122
+ const commandName = readString(args.commandName);
123
+ if (commandName) return { source: 'commandName', input: commandName };
124
+ const target = readString(args.target);
125
+ if (target) return { source: 'target', input: target };
126
+ const query = readString(args.query);
127
+ if (query) return { source: 'query', input: query };
128
+ return null;
129
+ }
130
+
131
+ function cliTokensFromRaw(raw: string): readonly string[] {
97
132
  const tokens = raw.split(/\s+/).filter((token) => token.length > 0);
98
133
  if (tokens[0] === 'goodvibes-agent' || tokens[0]?.endsWith('/goodvibes-agent')) return tokens.slice(1);
99
134
  return tokens;
100
135
  }
101
136
 
137
+ function isConcreteCliSource(source: CliCommandLookup['source']): boolean {
138
+ return source === 'cliCommand' || source === 'command' || source === 'commandName';
139
+ }
140
+
102
141
  export function describeHarnessCliCommand(args: AgentHarnessCliArgs): Record<string, unknown> {
103
- const tokens = cliTokensFromArgs(args);
104
- if (tokens.length === 0) return describeCliCommand('tui');
142
+ const input = cliInputFromArgs(args);
143
+ if (!input) return describeCliCommand('tui', { source: 'default', input: '', resolvedBy: 'default' });
144
+ const lookupInput = redactCliLookupInput(input.input);
145
+ const tokens = cliTokensFromRaw(input.input);
105
146
  const parsed = parseGoodVibesCli(tokens);
106
- if (parsed.command === 'unknown') {
147
+ const directInvocation = parsed.command !== 'unknown' && (
148
+ isConcreteCliSource(input.source)
149
+ || String(parsed.rawCommand ?? '').toLowerCase() === String(tokens[0] ?? '').toLowerCase()
150
+ );
151
+ if (!directInvocation) {
152
+ const matches = listGoodVibesCliCommands()
153
+ .filter((command) => command !== 'unknown')
154
+ .map((command) => describeCliCommand(command))
155
+ .filter((command) => cliCommandMatches(command, input.input))
156
+ .sort((a, b) => String(a.name).localeCompare(String(b.name)));
157
+ if (matches.length === 1) {
158
+ return {
159
+ ...matches[0]!,
160
+ lookup: { source: input.source, input: lookupInput, resolvedBy: 'search' },
161
+ };
162
+ }
163
+ if (matches.length > 1) {
164
+ return {
165
+ supported: false,
166
+ status: 'ambiguous',
167
+ input: lookupInput,
168
+ candidates: matches.map(cliCommandCandidate).slice(0, 8),
169
+ note: 'Multiple top-level CLI mirrors matched this lookup. Provide cliCommand or commandName with one concrete command token.',
170
+ };
171
+ }
107
172
  return {
108
173
  supported: false,
109
174
  token: parsed.rawCommand ?? tokens[0],
@@ -113,7 +178,7 @@ export function describeHarnessCliCommand(args: AgentHarnessCliArgs): Record<str
113
178
  };
114
179
  }
115
180
  return {
116
- ...describeCliCommand(parsed.command),
181
+ ...describeCliCommand(parsed.command, { source: input.source, input: lookupInput, resolvedBy: 'invocation' }),
117
182
  parsed: {
118
183
  command: parsed.command,
119
184
  rawCommand: parsed.rawCommand,
@@ -32,6 +32,25 @@ interface HarnessKeybindingArgs {
32
32
  readonly limit?: unknown;
33
33
  }
34
34
 
35
+ type KeybindingOperationEffect =
36
+ | 'shell-action'
37
+ | 'visible-ui-navigation'
38
+ | 'visible-ui-interaction'
39
+ | 'prompt-editor-state'
40
+ | 'clipboard-selection'
41
+ | 'reserved'
42
+ | 'disabled';
43
+
44
+ interface KeybindingOperationRoute {
45
+ readonly supported: boolean;
46
+ readonly effect: KeybindingOperationEffect;
47
+ readonly confirmation: string;
48
+ readonly preferredMode?: 'run_keybinding' | 'open_ui_surface' | 'run_command' | 'direct-user-interaction';
49
+ readonly surfaceId?: string;
50
+ readonly command?: string;
51
+ readonly note: string;
52
+ }
53
+
35
54
  type KeybindingsOverrideFile = Record<string, unknown>;
36
55
 
37
56
  interface KeybindingLookup {
@@ -214,9 +233,134 @@ function describeBinding(manager: KeybindingsManager, action: KeyAction, combos:
214
233
  defaultBindings: defaults.map((combo) => describeCombo(manager, combo)),
215
234
  customized,
216
235
  source: customized ? 'custom' : 'default',
236
+ modelOperation: keybindingOperationRoute(action),
217
237
  };
218
238
  }
219
239
 
240
+ function keybindingOperationRoute(action: KeyAction): KeybindingOperationRoute {
241
+ switch (action) {
242
+ case 'clear-cancel':
243
+ return {
244
+ supported: true,
245
+ effect: 'shell-action',
246
+ preferredMode: 'run_keybinding',
247
+ confirmation: 'agent_harness mode:"run_keybinding" requires confirm:true and explicitUserRequest.',
248
+ note: 'Routes the cancel-generation side of this shortcut through commandContext.cancelGeneration. Prompt clearing and double-press exit remain direct user interaction.',
249
+ };
250
+ case 'screen-clear':
251
+ return {
252
+ supported: true,
253
+ effect: 'shell-action',
254
+ preferredMode: 'run_keybinding',
255
+ confirmation: 'agent_harness mode:"run_keybinding" requires confirm:true and explicitUserRequest.',
256
+ note: 'Routes through commandContext.clearScreen.',
257
+ };
258
+ case 'panel-picker':
259
+ return {
260
+ supported: true,
261
+ effect: 'visible-ui-navigation',
262
+ preferredMode: 'run_keybinding',
263
+ surfaceId: 'agent-workspace',
264
+ confirmation: 'agent_harness mode:"run_keybinding" requires confirm:true and explicitUserRequest.',
265
+ note: 'Opens the same Agent workspace home route as the panel-picker shortcut.',
266
+ };
267
+ case 'panel-close':
268
+ return {
269
+ supported: true,
270
+ effect: 'visible-ui-navigation',
271
+ preferredMode: 'run_keybinding',
272
+ confirmation: 'agent_harness mode:"run_keybinding" requires confirm:true and explicitUserRequest.',
273
+ note: 'Closes the active legacy panel if present, then focuses the prompt when the shell bridge exposes focusPrompt.',
274
+ };
275
+ case 'panel-close-all':
276
+ return {
277
+ supported: true,
278
+ effect: 'visible-ui-navigation',
279
+ preferredMode: 'run_keybinding',
280
+ confirmation: 'agent_harness mode:"run_keybinding" requires confirm:true and explicitUserRequest.',
281
+ note: 'Closes all legacy panels if present, hides the panel manager, then focuses the prompt when the shell bridge exposes focusPrompt.',
282
+ };
283
+ case 'history-search':
284
+ return {
285
+ supported: true,
286
+ effect: 'visible-ui-navigation',
287
+ preferredMode: 'run_keybinding',
288
+ surfaceId: 'prompt-history-search',
289
+ confirmation: 'agent_harness mode:"run_keybinding" requires confirm:true and explicitUserRequest.',
290
+ note: 'Opens the visible prompt-history search overlay; optional search text may be supplied with value.',
291
+ };
292
+ case 'search':
293
+ return {
294
+ supported: true,
295
+ effect: 'visible-ui-navigation',
296
+ preferredMode: 'run_keybinding',
297
+ surfaceId: 'conversation-search',
298
+ confirmation: 'agent_harness mode:"run_keybinding" requires confirm:true and explicitUserRequest.',
299
+ note: 'Opens the visible conversation search overlay; optional search text may be supplied with value.',
300
+ };
301
+ case 'paste':
302
+ return {
303
+ supported: true,
304
+ effect: 'shell-action',
305
+ preferredMode: 'run_keybinding',
306
+ command: '/paste',
307
+ confirmation: 'agent_harness mode:"run_keybinding" requires confirm:true and explicitUserRequest.',
308
+ note: 'Routes through commandContext.pasteFromClipboard and reports whether text, image, or nothing was pasted.',
309
+ };
310
+ case 'block-copy':
311
+ case 'bookmark':
312
+ case 'block-save':
313
+ return {
314
+ supported: true,
315
+ effect: 'visible-ui-interaction',
316
+ preferredMode: 'run_keybinding',
317
+ surfaceId: 'block-actions',
318
+ confirmation: 'agent_harness mode:"run_keybinding" requires confirm:true and explicitUserRequest.',
319
+ note: 'Opens the visible nearest-block actions surface. The exact block action remains an interactive visible-shell selection because it depends on cursor/scroll position.',
320
+ };
321
+ case 'panel-tab-next':
322
+ case 'panel-tab-prev':
323
+ return {
324
+ supported: false,
325
+ effect: 'visible-ui-navigation',
326
+ preferredMode: 'open_ui_surface',
327
+ surfaceId: 'agent-workspace',
328
+ confirmation: 'Use open_ui_surface with confirm:true and an explicit categoryId/target instead of cycling hidden UI state.',
329
+ note: 'Category cycling depends on the live workspace focus position. The model should open the intended Agent workspace category directly.',
330
+ };
331
+ case 'copy-selection':
332
+ return {
333
+ supported: false,
334
+ effect: 'clipboard-selection',
335
+ preferredMode: 'direct-user-interaction',
336
+ confirmation: 'No model operation is exposed.',
337
+ note: 'Terminal text selection is outside the Agent command context. Use transcript/session export or a content-specific model route when a concrete artifact is needed.',
338
+ };
339
+ case 'delete-word':
340
+ case 'line-start':
341
+ case 'next-error-line-end':
342
+ case 'kill-line':
343
+ case 'clear-prompt':
344
+ case 'undo':
345
+ case 'redo':
346
+ return {
347
+ supported: false,
348
+ effect: 'prompt-editor-state',
349
+ preferredMode: 'direct-user-interaction',
350
+ confirmation: 'No model operation is exposed.',
351
+ note: 'This shortcut mutates live prompt-buffer cursor/edit state that is not part of the model tool contract.',
352
+ };
353
+ case 'replay-panel':
354
+ return {
355
+ supported: false,
356
+ effect: 'reserved',
357
+ preferredMode: 'direct-user-interaction',
358
+ confirmation: 'No model operation is exposed.',
359
+ note: 'This shortcut is reserved and has no current Agent operation route.',
360
+ };
361
+ }
362
+ }
363
+
220
364
  function readOverrideFile(configPath: string): KeybindingsOverrideFile {
221
365
  if (!existsSync(configPath)) return {};
222
366
  const parsed = JSON.parse(readFileSync(configPath, 'utf-8')) as unknown;
@@ -252,7 +396,7 @@ export function listHarnessShortcuts(context: CommandContext, args: HarnessKeybi
252
396
  configurableKeybindings: keybindings.keybindings,
253
397
  returned: fixed.length + Number(keybindings.returned ?? 0),
254
398
  total: totalHarnessShortcuts(context),
255
- policy: 'Fixed shortcuts are runtime/editor controls. Configurable keybindings can be changed with set_keybinding/reset_keybinding.',
399
+ policy: 'Fixed shortcuts are runtime/editor controls. Configurable keybindings can be inspected, supported shell-safe actions can be run with run_keybinding, and bindings can be changed with set_keybinding/reset_keybinding.',
256
400
  };
257
401
  }
258
402
 
@@ -268,7 +412,7 @@ export function listHarnessKeybindings(context: CommandContext, args: HarnessKey
268
412
  keybindings: entries,
269
413
  returned: entries.length,
270
414
  total: manager.getAll().length,
271
- 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.',
415
+ policy: 'Reads the live resolved keybindings, including modelOperation route metadata. run_keybinding executes only supported shell-safe actions. set_keybinding/reset_keybinding write the same keybindings.json file the user can edit and reload the runtime manager.',
272
416
  };
273
417
  }
274
418
 
@@ -284,6 +428,133 @@ export function describeHarnessKeybinding(context: CommandContext, args: Harness
284
428
  } : null;
285
429
  }
286
430
 
431
+ function runUnavailable(action: KeyAction, route: KeybindingOperationRoute, reason?: string): Record<string, unknown> {
432
+ return {
433
+ status: 'keybinding_route_unavailable',
434
+ action,
435
+ modelOperation: route,
436
+ ...(reason ? { reason } : {}),
437
+ };
438
+ }
439
+
440
+ export function runHarnessKeybinding(context: CommandContext, args: HarnessKeybindingArgs): Record<string, unknown> {
441
+ const manager = requireKeybindingsManager(context);
442
+ const resolved = resolveHarnessKeybinding(context, args);
443
+ if (resolved?.status === 'ambiguous') return { status: 'ambiguous', input: resolved.input, candidates: resolved.candidates };
444
+ if (!resolved) throw new Error('run_keybinding requires a valid keybinding action id, target, key, or query.');
445
+ const entry = manager.getAll().find((candidate) => candidate.action === resolved.action);
446
+ if (!entry) throw new Error(`No live keybinding entry found for ${resolved.action}.`);
447
+ const route = keybindingOperationRoute(resolved.action);
448
+ const descriptor = {
449
+ configPath: manager.getConfigPath(),
450
+ ...describeBinding(manager, entry.action, entry.combos, resolved.lookup),
451
+ };
452
+ if (!route.supported) {
453
+ return {
454
+ status: 'unsupported_keybinding_action',
455
+ action: resolved.action,
456
+ keybinding: descriptor,
457
+ modelOperation: route,
458
+ };
459
+ }
460
+
461
+ switch (resolved.action) {
462
+ case 'clear-cancel':
463
+ if (!context.cancelGeneration) return runUnavailable(resolved.action, route, 'commandContext.cancelGeneration is unavailable.');
464
+ context.cancelGeneration();
465
+ return { status: 'executed', action: resolved.action, effect: 'cancel-generation', keybinding: descriptor };
466
+ case 'screen-clear':
467
+ if (!context.clearScreen) return runUnavailable(resolved.action, route, 'commandContext.clearScreen is unavailable.');
468
+ context.clearScreen();
469
+ return { status: 'executed', action: resolved.action, effect: 'screen-clear', keybinding: descriptor };
470
+ case 'panel-picker':
471
+ if (context.openPanelPicker) {
472
+ context.openPanelPicker();
473
+ return { status: 'executed', action: resolved.action, effect: 'agent-workspace-opened', route: 'openPanelPicker', keybinding: descriptor };
474
+ }
475
+ if (context.openAgentWorkspace) {
476
+ context.openAgentWorkspace('home');
477
+ return { status: 'executed', action: resolved.action, effect: 'agent-workspace-opened', route: 'openAgentWorkspace', categoryId: 'home', keybinding: descriptor };
478
+ }
479
+ return runUnavailable(resolved.action, route, 'No panel picker or Agent workspace opener is available.');
480
+ case 'panel-close': {
481
+ const active = context.workspace.panelManager?.getActivePanel() ?? null;
482
+ if (active) context.workspace.panelManager?.close(active.id);
483
+ if (!active && !context.focusPrompt) return runUnavailable(resolved.action, route, 'No active legacy panel or prompt focus route is available.');
484
+ if (context.focusPrompt) context.focusPrompt();
485
+ context.renderRequest();
486
+ return {
487
+ status: 'executed',
488
+ action: resolved.action,
489
+ effect: active ? 'active-panel-closed' : 'prompt-focused',
490
+ ...(active ? { panelId: active.id } : {}),
491
+ keybinding: descriptor,
492
+ };
493
+ }
494
+ case 'panel-close-all': {
495
+ const managerPanel = context.workspace.panelManager;
496
+ const openPanels = managerPanel?.getAllOpen() ?? [];
497
+ for (const panel of openPanels) managerPanel?.close(panel.id);
498
+ managerPanel?.hide();
499
+ if (openPanels.length === 0 && !context.focusPrompt) return runUnavailable(resolved.action, route, 'No open legacy panels or prompt focus route is available.');
500
+ if (context.focusPrompt) context.focusPrompt();
501
+ context.renderRequest();
502
+ return {
503
+ status: 'executed',
504
+ action: resolved.action,
505
+ effect: 'all-panels-closed',
506
+ closedPanels: openPanels.map((panel) => panel.id),
507
+ keybinding: descriptor,
508
+ };
509
+ }
510
+ case 'history-search': {
511
+ if (!context.openPromptHistorySearch) return runUnavailable(resolved.action, route, 'commandContext.openPromptHistorySearch is unavailable.');
512
+ const query = readString(args.value);
513
+ context.openPromptHistorySearch(query || undefined);
514
+ return { status: 'executed', action: resolved.action, effect: 'prompt-history-search-opened', query, keybinding: descriptor };
515
+ }
516
+ case 'search': {
517
+ if (!context.openConversationSearch) return runUnavailable(resolved.action, route, 'commandContext.openConversationSearch is unavailable.');
518
+ const query = readString(args.value);
519
+ context.openConversationSearch(query || undefined);
520
+ return { status: 'executed', action: resolved.action, effect: 'conversation-search-opened', query, keybinding: descriptor };
521
+ }
522
+ case 'paste': {
523
+ if (!context.pasteFromClipboard) return runUnavailable(resolved.action, route, 'commandContext.pasteFromClipboard is unavailable.');
524
+ const pasted = context.pasteFromClipboard();
525
+ return { status: 'executed', action: resolved.action, effect: 'paste-from-clipboard', pasted, keybinding: descriptor };
526
+ }
527
+ case 'block-copy':
528
+ case 'bookmark':
529
+ case 'block-save': {
530
+ if (!context.openBlockActions) return runUnavailable(resolved.action, route, 'commandContext.openBlockActions is unavailable.');
531
+ const opened = context.openBlockActions();
532
+ return opened
533
+ ? {
534
+ status: 'visible_interaction_required',
535
+ action: resolved.action,
536
+ effect: 'block-actions-opened',
537
+ keybinding: descriptor,
538
+ note: 'The block action surface is open. Selecting the exact nearest-block action remains visible interactive shell work.',
539
+ }
540
+ : {
541
+ status: 'not_opened',
542
+ action: resolved.action,
543
+ effect: 'block-actions',
544
+ keybinding: descriptor,
545
+ note: 'The current shell did not have an empty prompt plus nearby block required for block actions.',
546
+ };
547
+ }
548
+ default:
549
+ return {
550
+ status: 'unsupported_keybinding_action',
551
+ action: resolved.action,
552
+ keybinding: descriptor,
553
+ modelOperation: route,
554
+ };
555
+ }
556
+ }
557
+
287
558
  export function setHarnessKeybinding(context: CommandContext, args: HarnessKeybindingArgs): Record<string, unknown> {
288
559
  const manager = requireKeybindingsManager(context);
289
560
  const resolved = resolveHarnessKeybinding(context, args);
@@ -1,7 +1,7 @@
1
1
  export const AGENT_HARNESS_MODES = [
2
2
  'summary', 'cli_commands', 'cli_command', 'panels', 'panel', 'open_panel',
3
3
  'ui_surfaces', 'ui_surface', 'open_ui_surface',
4
- 'shortcuts', 'keybindings', 'keybinding', 'set_keybinding', 'reset_keybinding',
4
+ 'shortcuts', 'keybindings', 'keybinding', 'run_keybinding', 'set_keybinding', 'reset_keybinding',
5
5
  'commands', 'command', 'run_command', 'settings', 'get_setting', 'set_setting',
6
6
  'reset_setting', 'workspace', 'workspace_categories', 'workspace_actions',
7
7
  'workspace_action', 'run_workspace_action', 'tools', 'tool', 'connected_host', 'connected_host_status',
@@ -23,7 +23,7 @@ export const AGENT_HARNESS_PARAMETER_PROPERTIES = {
23
23
  },
24
24
  query: {
25
25
  type: 'string',
26
- description: 'Search text for command, panel, UI surface, keybinding, workspace action, setting, or tool catalogs; also slash-command, setting, panel, UI surface, or keybinding lookup for single-item modes.',
26
+ description: 'Search text for command, CLI mirror, panel, UI surface, keybinding, workspace action, setting, or tool catalogs; also slash-command, CLI mirror, setting, panel, UI surface, or keybinding lookup for single-item modes.',
27
27
  },
28
28
  command: {
29
29
  type: 'string',
@@ -31,7 +31,7 @@ export const AGENT_HARNESS_PARAMETER_PROPERTIES = {
31
31
  },
32
32
  cliCommand: {
33
33
  type: 'string',
34
- 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
+ description: 'Top-level CLI command string for mode cli_command, for example "goodvibes-agent status --json" or "profiles list". target or query can also look up one CLI mirror when the exact command token is not known. This mode is read-only metadata/parse inspection.',
35
35
  },
36
36
  commandName: {
37
37
  type: 'string',
@@ -56,7 +56,7 @@ export const AGENT_HARNESS_PARAMETER_PROPERTIES = {
56
56
  },
57
57
  actionId: {
58
58
  type: 'string',
59
- description: 'Agent workspace action id for workspace_action or run_workspace_action, or keybinding action id for keybinding/set_keybinding/reset_keybinding. target or query can also look up one keybinding action.',
59
+ description: 'Agent workspace action id for workspace_action or run_workspace_action, or keybinding action id for keybinding/run_keybinding/set_keybinding/reset_keybinding. target or query can also look up one keybinding action.',
60
60
  },
61
61
  fields: {
62
62
  type: 'object',
@@ -86,11 +86,11 @@ export const AGENT_HARNESS_PARAMETER_PROPERTIES = {
86
86
  { type: 'number' },
87
87
  { type: 'boolean' },
88
88
  ],
89
- description: 'Setting value for set_setting. Strings, booleans, numbers, and enum strings are accepted.',
89
+ description: 'Setting value for set_setting. Strings, booleans, numbers, and enum strings are accepted. In run_keybinding, value can provide visible search text for search/history-search shortcut routes.',
90
90
  },
91
91
  target: {
92
92
  type: 'string',
93
- description: 'Optional lookup target, such as a model-picker target, panel id/search text, UI surface id/search text, workspace action id/search text, slash command root or invocation, setting key/search text, keybinding action/search text, model tool name, or connected-host capability id.',
93
+ description: 'Optional lookup target, such as a model-picker target, top-level CLI mirror/search text, panel id/search text, UI surface id/search text, workspace action id/search text, slash command root or invocation, setting key/search text, keybinding action/search text, model tool name, or connected-host capability id.',
94
94
  },
95
95
  capabilityId: {
96
96
  type: 'string',
@@ -127,10 +127,10 @@ export const AGENT_HARNESS_PARAMETER_PROPERTIES = {
127
127
  },
128
128
  confirm: {
129
129
  type: 'boolean',
130
- 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.',
130
+ description: 'Required true for set_setting, reset_setting, run_keybinding, run_command, open_panel, open_ui_surface, and mutating run_workspace_action calls after an explicit user request.',
131
131
  },
132
132
  explicitUserRequest: {
133
133
  type: 'string',
134
- description: 'Exact user request or faithful short summary authorizing a setting mutation or harness UI/command invocation.',
134
+ description: 'Exact user request or faithful short summary authorizing a setting mutation, keybinding action, or harness UI/command invocation.',
135
135
  },
136
136
  } as const;