@pellux/goodvibes-tui 1.1.0 → 1.7.0

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.
Files changed (194) hide show
  1. package/CHANGELOG.md +85 -21
  2. package/README.md +20 -11
  3. package/docs/foundation-artifacts/operator-contract.json +1 -1
  4. package/package.json +2 -2
  5. package/src/core/alert-gating.ts +67 -0
  6. package/src/core/approval-alert.ts +72 -0
  7. package/src/core/budget-breach-notifier.ts +106 -0
  8. package/src/core/conversation-rendering.ts +19 -0
  9. package/src/core/conversation.ts +18 -0
  10. package/src/core/focus-tracker.ts +41 -0
  11. package/src/core/long-task-notifier.ts +33 -6
  12. package/src/core/system-message-router.ts +37 -51
  13. package/src/core/turn-cancellation.ts +20 -0
  14. package/src/core/turn-event-wiring.ts +64 -3
  15. package/src/export/cost-utils.ts +36 -0
  16. package/src/input/command-registry.ts +38 -1
  17. package/src/input/commands/checkpoint-runtime.ts +280 -0
  18. package/src/input/commands/codebase-runtime.ts +192 -0
  19. package/src/input/commands/eval.ts +1 -1
  20. package/src/input/commands/health-runtime.ts +1 -1
  21. package/src/input/commands/image-runtime.ts +112 -0
  22. package/src/input/commands/intelligence-runtime.ts +11 -1
  23. package/src/input/commands/local-auth-runtime.ts +4 -1
  24. package/src/input/commands/local-runtime.ts +9 -3
  25. package/src/input/commands/marketplace-runtime.ts +2 -2
  26. package/src/input/commands/memory.ts +6 -1
  27. package/src/input/commands/operator-panel-runtime.ts +40 -24
  28. package/src/input/commands/planning-runtime.ts +26 -3
  29. package/src/input/commands/platform-sandbox-runtime.ts +1 -6
  30. package/src/input/commands/plugin-runtime.ts +2 -2
  31. package/src/input/commands/policy-dispatch.ts +21 -0
  32. package/src/input/commands/provider-accounts-runtime.ts +1 -1
  33. package/src/input/commands/qrcode-runtime.ts +3 -3
  34. package/src/input/commands/recall-review.ts +35 -0
  35. package/src/input/commands/remote-runtime.ts +3 -3
  36. package/src/input/commands/runtime-services.ts +54 -13
  37. package/src/input/commands/services-runtime.ts +1 -1
  38. package/src/input/commands/session-workflow.ts +16 -1
  39. package/src/input/commands/settings-sync-runtime.ts +1 -1
  40. package/src/input/commands/shell-core.ts +15 -7
  41. package/src/input/commands/skills-runtime.ts +2 -8
  42. package/src/input/commands/subscription-runtime.ts +2 -2
  43. package/src/input/commands/test-runtime.ts +277 -0
  44. package/src/input/commands/websearch-runtime.ts +101 -0
  45. package/src/input/commands/work-plan-runtime.ts +36 -10
  46. package/src/input/commands/workstream-runtime.ts +338 -0
  47. package/src/input/commands.ts +12 -0
  48. package/src/input/config-modal-types.ts +161 -0
  49. package/src/input/config-modal.ts +377 -0
  50. package/src/input/feed-context-factory.ts +7 -8
  51. package/src/input/handler-command-route.ts +27 -17
  52. package/src/input/handler-feed-routes.ts +61 -23
  53. package/src/input/handler-feed.ts +47 -23
  54. package/src/input/handler-interactions.ts +1 -3
  55. package/src/input/handler-modal-routes.ts +65 -0
  56. package/src/input/handler-modal-stack.ts +3 -5
  57. package/src/input/handler-modal-token-routes.ts +16 -49
  58. package/src/input/handler-picker-routes.ts +11 -94
  59. package/src/input/handler-shortcuts.ts +24 -14
  60. package/src/input/handler-types.ts +2 -6
  61. package/src/input/handler-ui-state.ts +10 -22
  62. package/src/input/handler.ts +6 -28
  63. package/src/input/keybindings.ts +22 -8
  64. package/src/input/model-picker-types.ts +24 -6
  65. package/src/input/model-picker.ts +58 -0
  66. package/src/input/panel-integration-actions.ts +9 -170
  67. package/src/input/settings-modal-data.ts +95 -0
  68. package/src/input/settings-modal-mutations.ts +6 -4
  69. package/src/main.ts +24 -27
  70. package/src/panels/agent-inspector-shared.ts +2 -1
  71. package/src/panels/base-panel.ts +22 -1
  72. package/src/panels/builtin/agent.ts +21 -107
  73. package/src/panels/builtin/development.ts +15 -61
  74. package/src/panels/builtin/knowledge.ts +8 -32
  75. package/src/panels/builtin/operations.ts +84 -428
  76. package/src/panels/builtin/session.ts +21 -112
  77. package/src/panels/builtin/shared.ts +9 -43
  78. package/src/panels/builtin-modals.ts +218 -0
  79. package/src/panels/builtin-panels.ts +5 -0
  80. package/src/panels/cost-tracker-panel.ts +36 -10
  81. package/src/panels/diff-panel.ts +12 -43
  82. package/src/panels/eval-registry.ts +60 -0
  83. package/src/panels/fleet-panel.ts +800 -0
  84. package/src/panels/fleet-read-model.ts +477 -0
  85. package/src/panels/fleet-steer.ts +92 -0
  86. package/src/panels/fleet-stop.ts +125 -0
  87. package/src/panels/fleet-tabs.ts +230 -0
  88. package/src/panels/fleet-transcript.ts +356 -0
  89. package/src/panels/index.ts +7 -31
  90. package/src/panels/modals/hooks-modal.ts +187 -0
  91. package/src/panels/modals/keybindings-modal.ts +151 -0
  92. package/src/panels/modals/knowledge-modal.ts +158 -0
  93. package/src/panels/modals/local-auth-modal.ts +132 -0
  94. package/src/panels/modals/marketplace-modal.ts +218 -0
  95. package/src/panels/modals/memory-modal.ts +180 -0
  96. package/src/panels/modals/modal-surface-helpers.ts +54 -0
  97. package/src/panels/modals/modal-theme.ts +36 -0
  98. package/src/panels/modals/pairing-modal.ts +144 -0
  99. package/src/panels/modals/planning-modal.ts +282 -0
  100. package/src/panels/modals/plugins-modal.ts +174 -0
  101. package/src/panels/modals/policy-modal.ts +256 -0
  102. package/src/panels/modals/provider-health-modal.ts +136 -0
  103. package/src/panels/modals/remote-modal.ts +115 -0
  104. package/src/panels/modals/sandbox-modal.ts +150 -0
  105. package/src/panels/modals/security-modal.ts +217 -0
  106. package/src/panels/modals/services-modal.ts +179 -0
  107. package/src/panels/modals/settings-sync-modal.ts +142 -0
  108. package/src/panels/modals/skills-modal.ts +189 -0
  109. package/src/panels/modals/subscription-modal.ts +172 -0
  110. package/src/panels/modals/work-plan-modal.ts +149 -0
  111. package/src/panels/panel-confirm-overlay.ts +72 -0
  112. package/src/panels/panel-manager.ts +108 -5
  113. package/src/panels/project-planning-answer-actions.ts +4 -2
  114. package/src/panels/skills-panel.ts +7 -51
  115. package/src/panels/types.ts +13 -0
  116. package/src/permissions/hunk-selection.ts +179 -0
  117. package/src/permissions/prompt.ts +60 -4
  118. package/src/renderer/compaction-history-modal.ts +19 -3
  119. package/src/renderer/compaction-preview.ts +13 -2
  120. package/src/renderer/compaction-quality.ts +100 -0
  121. package/src/renderer/config-modal.ts +81 -0
  122. package/src/renderer/conversation-overlays.ts +10 -17
  123. package/src/renderer/fleet-tab-strip.ts +56 -0
  124. package/src/renderer/footer-tips.ts +10 -2
  125. package/src/renderer/git-status.ts +40 -0
  126. package/src/renderer/help-overlay.ts +2 -2
  127. package/src/renderer/model-workspace.ts +44 -1
  128. package/src/renderer/panel-workspace-bar.ts +8 -2
  129. package/src/renderer/turn-injection.ts +114 -0
  130. package/src/runtime/bootstrap-command-context.ts +21 -1
  131. package/src/runtime/bootstrap-command-parts.ts +34 -7
  132. package/src/runtime/bootstrap-core.ts +14 -4
  133. package/src/runtime/bootstrap-shell.ts +29 -16
  134. package/src/runtime/bootstrap.ts +11 -17
  135. package/src/runtime/code-index-services.ts +112 -0
  136. package/src/runtime/orchestrator-core-services.ts +49 -0
  137. package/src/runtime/process-lifecycle.ts +3 -1
  138. package/src/runtime/services.ts +91 -43
  139. package/src/runtime/ui-services.ts +8 -0
  140. package/src/runtime/workstream-services.ts +195 -0
  141. package/src/shell/blocking-input.ts +22 -1
  142. package/src/shell/ui-openers.ts +129 -17
  143. package/src/utils/format-duration.ts +8 -18
  144. package/src/utils/splash-lines.ts +1 -1
  145. package/src/version.ts +1 -1
  146. package/src/panels/agent-inspector-panel.ts +0 -786
  147. package/src/panels/approval-panel.ts +0 -252
  148. package/src/panels/automation-control-panel.ts +0 -479
  149. package/src/panels/cockpit-panel.ts +0 -481
  150. package/src/panels/cockpit-read-model.ts +0 -238
  151. package/src/panels/communication-panel.ts +0 -256
  152. package/src/panels/control-plane-panel.ts +0 -470
  153. package/src/panels/debug-panel.ts +0 -615
  154. package/src/panels/docs-panel.ts +0 -384
  155. package/src/panels/eval-panel.ts +0 -627
  156. package/src/panels/file-explorer-panel.ts +0 -673
  157. package/src/panels/file-preview-panel.ts +0 -517
  158. package/src/panels/hooks-panel.ts +0 -401
  159. package/src/panels/incident-review-panel.ts +0 -406
  160. package/src/panels/intelligence-panel.ts +0 -383
  161. package/src/panels/knowledge-graph-panel.ts +0 -515
  162. package/src/panels/marketplace-panel.ts +0 -399
  163. package/src/panels/memory-panel.ts +0 -558
  164. package/src/panels/ops-control-panel.ts +0 -329
  165. package/src/panels/ops-strategy-panel.ts +0 -321
  166. package/src/panels/orchestration-panel.ts +0 -465
  167. package/src/panels/panel-list-panel.ts +0 -566
  168. package/src/panels/plan-dashboard-panel.ts +0 -707
  169. package/src/panels/policy-panel.ts +0 -517
  170. package/src/panels/project-planning-panel.ts +0 -731
  171. package/src/panels/provider-health-panel.ts +0 -678
  172. package/src/panels/provider-health-tracker.ts +0 -310
  173. package/src/panels/provider-health-views.ts +0 -567
  174. package/src/panels/qr-panel.ts +0 -280
  175. package/src/panels/remote-panel.ts +0 -534
  176. package/src/panels/routes-panel.ts +0 -241
  177. package/src/panels/sandbox-panel.ts +0 -456
  178. package/src/panels/security-panel.ts +0 -447
  179. package/src/panels/services-panel.ts +0 -329
  180. package/src/panels/session-browser-panel.ts +0 -496
  181. package/src/panels/settings-sync-panel.ts +0 -398
  182. package/src/panels/subscription-panel.ts +0 -342
  183. package/src/panels/symbol-outline-panel.ts +0 -619
  184. package/src/panels/system-messages-panel.ts +0 -364
  185. package/src/panels/tasks-panel.ts +0 -608
  186. package/src/panels/thinking-panel.ts +0 -333
  187. package/src/panels/tool-inspector-panel.ts +0 -537
  188. package/src/panels/work-plan-panel.ts +0 -540
  189. package/src/panels/worktree-panel.ts +0 -360
  190. package/src/panels/wrfc-panel.ts +0 -790
  191. package/src/renderer/agent-detail-modal.ts +0 -466
  192. package/src/renderer/live-tail-modal.ts +0 -156
  193. package/src/renderer/process-modal.ts +0 -671
  194. package/src/renderer/qr-renderer.ts +0 -120
@@ -19,7 +19,7 @@ import {
19
19
  type EcosystemCatalogEntry,
20
20
  type EcosystemEntryKind,
21
21
  } from '@/runtime/index.ts';
22
- import { openCommandPanel, requireEcosystemCatalogPaths, requireReadModels, requireShellPaths } from './runtime-services.ts';
22
+ import { openModalCommand, requireEcosystemCatalogPaths, requireReadModels, requireShellPaths } from './runtime-services.ts';
23
23
 
24
24
  function resolveMarketplaceEntry(
25
25
  kind: EcosystemEntryKind,
@@ -45,7 +45,7 @@ export function registerMarketplaceRuntimeCommands(registry: CommandRegistry): v
45
45
  const ecosystemPaths = requireEcosystemCatalogPaths(ctx);
46
46
  const sub = args[0] ?? 'open';
47
47
  if (sub === 'open' || sub === 'panel') {
48
- openCommandPanel(ctx, 'marketplace');
48
+ openModalCommand(ctx, 'marketplace-modal');
49
49
  return;
50
50
  }
51
51
  if (sub === 'overview') {
@@ -17,7 +17,7 @@ import type { SlashCommand, CommandContext } from '../command-registry.ts';
17
17
  import { handleRecallAdd, handleRecallCapture } from './recall-capture.ts';
18
18
  import { handleRecallExport, handleRecallHandoffExport, handleRecallHandoffImport, handleRecallHandoffInspect, handleRecallImport } from './recall-bundle.ts';
19
19
  import { handleRecallGet, handleRecallLink, handleRecallList, handleRecallRemove, handleRecallSearch, handleRecallVector } from './recall-query.ts';
20
- import { handleRecallExplain, handleRecallPromote, handleRecallQueue, handleRecallReview } from './recall-review.ts';
20
+ import { handleRecallExplain, handleRecallInjections, handleRecallPromote, handleRecallQueue, handleRecallReview } from './recall-review.ts';
21
21
  import { VALID_CLASSES, VALID_REVIEW_STATES, VALID_SCOPES } from './recall-shared.ts';
22
22
 
23
23
  // ── Top-level command ─────────────────────────────────────────────────────────
@@ -76,6 +76,10 @@ export const recallCommand: SlashCommand = {
76
76
  handleRecallExplain(rest, context);
77
77
  break;
78
78
 
79
+ case 'injections':
80
+ handleRecallInjections(rest, context);
81
+ break;
82
+
79
83
  case 'promote':
80
84
  handleRecallPromote(rest, context);
81
85
  break;
@@ -134,6 +138,7 @@ export const recallCommand: SlashCommand = {
134
138
  ' stale <id> [reason...] — Mark a record stale with an operator reason',
135
139
  ' contradict <id> [reason...] — Mark a record contradicted with an operator reason',
136
140
  ' explain <task...> [--scope <path> ...] — Show the knowledge records that would be injected for a task',
141
+ ' injections [agentId] — Show per-turn passive knowledge injection records (Wave-5); no id shows the main session, an id shows that spawned agent',
137
142
  ' promote <id> <scope> — Promote a memory record into session|project|team scope',
138
143
  ' export <path> [--scope <scope>] [--cls <class>] — Export a durable knowledge bundle',
139
144
  ' import <path> — Import a durable knowledge bundle',
@@ -13,31 +13,29 @@ export function registerOperatorPanelCommand(registry: CommandRegistry): void {
13
13
  const pm = requirePanelManager(ctx);
14
14
  const sub = args[0]?.toLowerCase() ?? '';
15
15
  if (!sub || sub === 'toggle') {
16
- try {
17
- if (ctx.showPanel) ctx.showPanel('panel-list');
18
- else {
19
- pm.open('panel-list');
20
- pm.show();
21
- ctx.focusPanels?.();
22
- ctx.renderRequest();
23
- }
24
- } catch {
25
- pm.toggle();
26
- ctx.renderRequest();
27
- }
16
+ // W6.1 (the purge): 'panel-list' (the browse-all-panels picker) was
17
+ // DELETE-disposition — a picker over a handful of panels is dead
18
+ // weight now (see the Ctrl+P selectionModal repoint in
19
+ // shell/ui-openers.ts for its interactive replacement). Bare
20
+ // `/panel` and `/panel toggle` now do what "toggle" actually means:
21
+ // toggle the workspace, which opens 'fleet' by default when nothing
22
+ // is open (PanelManager.toggle()) rather than force-opening a
23
+ // specific browse panel.
24
+ pm.toggle();
25
+ ctx.renderRequest();
28
26
  } else if (sub === 'list') {
29
- try {
30
- if (ctx.showPanel) ctx.showPanel('panel-list');
31
- else {
32
- pm.open('panel-list');
33
- pm.show();
34
- ctx.focusPanels?.();
35
- ctx.renderRequest();
27
+ // Print a text listing instead of opening a picker panel — grouped
28
+ // by category from the live registry, so this can never drift from
29
+ // what's actually registered.
30
+ const byCategory = pm.getTypesByCategory();
31
+ const lines: string[] = [];
32
+ for (const [category, entries] of byCategory) {
33
+ lines.push(`${category}:`);
34
+ for (const entry of entries) {
35
+ lines.push(` ${entry.icon} ${entry.id} — ${entry.name}`);
36
36
  }
37
- } catch {
38
- pm.show();
39
- ctx.renderRequest();
40
37
  }
38
+ ctx.print(lines.length > 0 ? lines.join('\n') : 'No panels registered.');
41
39
  } else if (sub === 'open') {
42
40
  const id = args[1];
43
41
  const pane = args[2]?.toLowerCase();
@@ -47,6 +45,11 @@ export function registerOperatorPanelCommand(registry: CommandRegistry): void {
47
45
  return;
48
46
  }
49
47
  try {
48
+ // A MIGRATE-TO-MODAL id (e.g. 'sessions' -> the session-picker modal)
49
+ // resolves to a modal, not a panel: opening it fires the redirect and
50
+ // no panel lands in the workspace. Report that honestly rather than
51
+ // claiming "Panel opened: <id>".
52
+ const redirectTarget = pm.getModalRedirect(id);
50
53
  if (ctx.showPanel) ctx.showPanel(id, pane as 'top' | 'bottom' | undefined);
51
54
  else {
52
55
  pm.open(id, pane as 'top' | 'bottom' | undefined);
@@ -54,9 +57,22 @@ export function registerOperatorPanelCommand(registry: CommandRegistry): void {
54
57
  ctx.focusPanels?.();
55
58
  ctx.renderRequest();
56
59
  }
57
- ctx.print(`Panel opened: ${id}${pane ? ` (${pane} pane)` : ''}`);
60
+ if (redirectTarget) {
61
+ ctx.print(`"${id}" moved to the ${redirectTarget} modal — opening it.`);
62
+ } else {
63
+ ctx.print(`Panel opened: ${id}${pane ? ` (${pane} pane)` : ''}`);
64
+ }
58
65
  } catch (e) {
59
- ctx.print(`Error: ${summarizeError(e)}`);
66
+ // A deleted/unknown panel id throws "No panel type registered with
67
+ // id: <id>" from PanelManager.open — surface the same friendly line
68
+ // the bare-/panel path uses instead of leaking the raw error. Any
69
+ // genuinely unexpected failure still shows its real message.
70
+ const message = summarizeError(e);
71
+ if (message.includes('No panel type registered with id')) {
72
+ ctx.print(`Unknown panel "${id}". Use /panel list to see available panels.`);
73
+ } else {
74
+ ctx.print(`Error: ${message}`);
75
+ }
60
76
  }
61
77
  } else if (sub === 'close') {
62
78
  const id = args[1];
@@ -5,7 +5,15 @@ import type {
5
5
  ProjectPlanningState,
6
6
  } from '@pellux/goodvibes-sdk/platform/knowledge';
7
7
  import type { CommandRegistry } from '../command-registry.ts';
8
- import { requirePlanManager, requireSessionLineageTracker } from './runtime-services.ts';
8
+ import { openModalCommand, requirePlanManager, requireSessionLineageTracker } from './runtime-services.ts';
9
+
10
+ /**
11
+ * Single-token verbs that look like a `/plan` subcommand but are not real ones
12
+ * (some, like `dismiss`, were dispatched by UI that assumed a subcommand that
13
+ * never existed). A lone one of these is refused rather than seeded as a goal,
14
+ * so a stray verb can never overwrite the project goal with itself.
15
+ */
16
+ const PSEUDO_SUBCOMMAND_VERBS = new Set(['dismiss', 'answer', 'pause', 'stop', 'cancel']);
9
17
 
10
18
  function recordNextQuestion(
11
19
  state: Partial<ProjectPlanningState>,
@@ -43,7 +51,7 @@ function formatNextQuestion(question: ProjectPlanningQuestion | undefined): stri
43
51
  if (!question) return 'No next question recorded.';
44
52
  const lines = [`Next question: ${question.prompt}`];
45
53
  if (question.recommendedAnswer) lines.push(`Recommended answer: ${question.recommendedAnswer}`);
46
- lines.push('Answer in the prompt, or focus the Planning panel to choose/type an answer.');
54
+ lines.push('Answer in the prompt, or open the Planning modal to choose/type an answer.');
47
55
  return lines.join('\n');
48
56
  }
49
57
 
@@ -67,7 +75,7 @@ export function registerPlanningRuntimeCommands(registry: CommandRegistry): void
67
75
 
68
76
  const projectPlanningService = ctx.workspace.projectPlanningService;
69
77
  const projectId = ctx.workspace.projectPlanningProjectId;
70
- const openProjectPlanningPanel = () => ctx.showPanel?.('project-planning');
78
+ const openProjectPlanningPanel = () => openModalCommand(ctx, 'planning-modal');
71
79
 
72
80
  if (args.length === 0) {
73
81
  if (projectPlanningService && projectId) {
@@ -165,6 +173,21 @@ export function registerPlanningRuntimeCommands(registry: CommandRegistry): void
165
173
  return;
166
174
  }
167
175
 
176
+ // Defense (Wave 6 review): a single verb-looking token is almost never a
177
+ // real planning goal — it is a mistyped or removed subcommand. The
178
+ // Planning modal used to dispatch `/plan dismiss`, which has no
179
+ // subcommand and silently fell through to this free-form branch, seeding
180
+ // the goal with the literal "dismiss". Refuse to seed on a lone
181
+ // known-or-formerly-planned verb and point at the real usage instead of
182
+ // corrupting the goal.
183
+ if (args.length === 1 && PSEUDO_SUBCOMMAND_VERBS.has(args[0].toLowerCase())) {
184
+ ctx.print(
185
+ `Unknown /plan subcommand "${args[0]}" — did you mean panel, approve, list, show, or status? ` +
186
+ `To seed a planning goal, use /plan <a real sentence describing the change>.`,
187
+ );
188
+ return;
189
+ }
190
+
168
191
  const taskDescription = args.join(' ');
169
192
  if (!projectPlanningService || !projectId) {
170
193
  ctx.print('Project planning service is not available in this runtime.');
@@ -98,12 +98,7 @@ export function registerPlatformSandboxRuntimeCommands(registry: CommandRegistry
98
98
  const shellPaths = requireShellPaths(ctx);
99
99
  const sub = args[0] ?? 'open';
100
100
  if (sub === 'open' || sub === 'panel') {
101
- if (ctx.showPanel) ctx.showPanel('sandbox');
102
- else {
103
- const panelManager = requirePanelManager(ctx);
104
- panelManager.open('sandbox');
105
- panelManager.show();
106
- }
101
+ ctx.openModal?.('sandbox-modal'); // W6.1: sandbox panel -> config modal
107
102
  return;
108
103
  }
109
104
  if (sub === 'review') {
@@ -13,7 +13,7 @@ import {
13
13
  upsertEcosystemCatalogEntry,
14
14
  uninstallEcosystemCatalogEntry,
15
15
  } from '@/runtime/index.ts';
16
- import { requireEcosystemCatalogPaths, requirePluginPathOptions } from './runtime-services.ts';
16
+ import { openModalCommand, requireEcosystemCatalogPaths, requirePluginPathOptions } from './runtime-services.ts';
17
17
 
18
18
  export function registerPluginRuntimeCommands(registry: CommandRegistry): void {
19
19
  registry.register({
@@ -33,7 +33,7 @@ export function registerPluginRuntimeCommands(registry: CommandRegistry): void {
33
33
  const sub = args[0];
34
34
 
35
35
  if (!sub || sub === 'open' || sub === 'panel') {
36
- if (ctx.showPanel) ctx.showPanel('plugins');
36
+ openModalCommand(ctx, 'plugins-modal');
37
37
  return;
38
38
  }
39
39
 
@@ -301,6 +301,23 @@ export function renderPolicyUsage(): string {
301
301
  ].join('\n');
302
302
  }
303
303
 
304
+ // W6 command-path parity: the policy modal dropped its 'r' (record a
305
+ // divergence-dashboard trend sample) action because the panel used to call
306
+ // this._state.recordTrendEntry() directly and /policy had no equivalent verb.
307
+ // This exposes it as a thin wrapper: recordTrendEntry() forwards to the attached
308
+ // DivergencePanel, so it only captures a sample while a simulation dashboard is
309
+ // active — reported honestly here rather than silently no-op'ing.
310
+ function handleRecordTrend(_args: string[], context: CommandContext): void {
311
+ const policyState = getPolicyState(context);
312
+ if (!policyState.getDashboard()) {
313
+ context.print('[policy] No active simulation dashboard — nothing to sample. Run `/policy simulate` first, then `/policy record-trend`.');
314
+ return;
315
+ }
316
+ policyState.recordTrendEntry();
317
+ const snap = policyState.getSnapshot();
318
+ context.print(`[policy] Recorded a divergence trend sample (${snap.divergence?.trend.length ?? 0} point(s) total).`);
319
+ }
320
+
304
321
  export async function dispatchPolicyCommand(args: string[], context: CommandContext): Promise<void> {
305
322
  const [sub, ...rest] = args;
306
323
  switch (sub) {
@@ -332,6 +349,10 @@ export async function dispatchPolicyCommand(args: string[], context: CommandCont
332
349
  case 'st':
333
350
  await handleStatus(rest, context);
334
351
  break;
352
+ case 'record-trend':
353
+ case 'trend':
354
+ handleRecordTrend(rest, context);
355
+ break;
335
356
  default:
336
357
  context.print(renderPolicyUsage());
337
358
  break;
@@ -29,7 +29,7 @@ export function registerProviderAccountsRuntimeCommands(registry: CommandRegistr
29
29
  async handler(args, ctx) {
30
30
  const sub = (args[0] ?? 'review').toLowerCase();
31
31
  if (sub === 'panel' || sub === 'open') {
32
- openCommandPanel(ctx, 'accounts');
32
+ ctx.openModal?.('providers-modal'); // W6.1: accounts alias -> provider-health modal
33
33
  return;
34
34
  }
35
35
  const snapshot = await loadProviderAccountSnapshot(ctx);
@@ -1,5 +1,5 @@
1
1
  import type { CommandRegistry } from '../command-registry.ts';
2
- import { openCommandPanel } from './runtime-services.ts';
2
+ import { openModalCommand } from './runtime-services.ts';
3
3
 
4
4
  /**
5
5
  * Register the /qrcode command.
@@ -11,9 +11,9 @@ export function registerQrcodeRuntimeCommands(registry: CommandRegistry): void {
11
11
  registry.register({
12
12
  name: 'qrcode',
13
13
  aliases: ['qr', 'pair'],
14
- description: 'Open the QR code panel for companion app pairing',
14
+ description: 'Open the companion-app pairing modal (QR code)',
15
15
  handler(_args, ctx) {
16
- openCommandPanel(ctx, 'qr-code');
16
+ openModalCommand(ctx, 'pairing-modal');
17
17
  },
18
18
  });
19
19
  }
@@ -1,6 +1,7 @@
1
1
  import type { CommandContext } from '../command-registry.ts';
2
2
  import { VALID_REVIEW_STATES, VALID_SCOPES, isValidReviewState, isValidScope } from './recall-shared.ts';
3
3
  import { getMemoryApi } from './recall-query.ts';
4
+ import { buildMainSessionTurnInjectionsText, buildTurnInjectionsText } from '../../renderer/turn-injection.ts';
4
5
 
5
6
  export function handleRecallQueue(args: string[], context: CommandContext): void {
6
7
  const memory = getMemoryApi(context);
@@ -102,6 +103,40 @@ export function handleRecallExplain(args: string[], context: CommandContext): vo
102
103
  context.print(explanation.prompt ?? '[recall] No explainable project knowledge was selected.');
103
104
  }
104
105
 
106
+ /**
107
+ * W5.2 (wo803) — per-turn passive knowledge injection inspectability.
108
+ *
109
+ * With an explicit agent id, reads `AgentRecord.turnInjections` (Wave-5 wo801)
110
+ * via `context.ops.agentManager.exportState()` — the CommandContext-exposed
111
+ * `ShellAgentManagerService` doesn't have a `getStatus`/`list` pair, but
112
+ * `exportState()` returns the same full `AgentRecord[]` (it's what
113
+ * compactConversation() already uses for the same reason).
114
+ *
115
+ * With NO agent id (wo805 wiring), renders the MAIN interactive session's own
116
+ * per-turn injection ring — `Orchestrator.getTurnInjections()`, threaded onto
117
+ * the command context as `session.getMainSessionTurnInjections`. As of wo805 the
118
+ * main session DOES route through the passive-injection engine, so this is the
119
+ * honest main-session default (previously there was no record source, so the
120
+ * no-id path could only print a usage hint). When the accessor isn't wired
121
+ * (headless/test contexts built without an orchestrator), the main-session
122
+ * renderer's honest empty state stands in.
123
+ */
124
+ export function handleRecallInjections(args: string[], context: CommandContext): void {
125
+ const agentId = args[0];
126
+ if (!agentId) {
127
+ const mainSessionInjections = context.session.getMainSessionTurnInjections?.() ?? [];
128
+ context.print(buildMainSessionTurnInjectionsText(mainSessionInjections));
129
+ return;
130
+ }
131
+ const records = context.ops.agentManager?.exportState() ?? [];
132
+ const record = records.find((candidate) => candidate.id === agentId);
133
+ if (!record) {
134
+ context.print(`[recall] Agent not found: ${agentId}`);
135
+ return;
136
+ }
137
+ context.print(buildTurnInjectionsText(agentId, record.turnInjections ?? []));
138
+ }
139
+
105
140
  export function handleRecallPromote(args: string[], context: CommandContext): void {
106
141
  const memory = getMemoryApi(context);
107
142
  if (!memory) {
@@ -47,11 +47,11 @@ export function registerRemoteRuntimeCommands(registry: CommandRegistry): void {
47
47
  usage: '[list | show [agentId] | supervisor [runnerId] | capabilities [runnerId] | recover [runnerId] | setup [export <path>] | env [export <path>] | tunnel [review|export <path>] | bootstrap [export <path>|inspect <path>] | session <export|inspect|import> <path> | pool <list|show|create|assign|unassign> ... | dispatch [template] <description> | dispatch-pool <pool> [template] <description> | contract [agentId] | cancel <agentId> | export <agentId> [path] | artifact list | artifact show <id> | artifact export <id> [path] | review <id> | rerun-local <id> | import <path>]',
48
48
  async handler(args, ctx) {
49
49
  if (args.length === 0) {
50
- if (ctx.openRemotePanel) {
51
- ctx.openRemotePanel();
50
+ if (ctx.openModal) {
51
+ ctx.openModal('remote-modal'); // W6.1: remote panel -> config modal
52
52
  return;
53
53
  }
54
- ctx.print('Remote panel is not available in this runtime.');
54
+ ctx.print('Remote surface is not available in this runtime.');
55
55
  return;
56
56
  }
57
57
 
@@ -9,6 +9,8 @@ import type {
9
9
  } from '../command-registry.ts';
10
10
  import { compactSmallWindow, getLastCompactionEvent, SMALL_WINDOW_THRESHOLD } from '@pellux/goodvibes-sdk/platform/core';
11
11
  import type { CompactionContext, CompactionEvent } from '@pellux/goodvibes-sdk/platform/core';
12
+ import { recordCompactionQualityScore, scoreCompactionRun } from '../../renderer/compaction-quality.ts';
13
+ import type { CompactionQualityScore } from '../../renderer/compaction-quality.ts';
12
14
  import type { UiReadModels } from '../../runtime/ui-read-models.ts';
13
15
  import type { ShellPathService } from '@/runtime/index.ts';
14
16
  import type { EcosystemCatalogPathOptions } from '@/runtime/index.ts';
@@ -101,6 +103,21 @@ export function openCommandPanel(
101
103
  showPanel(panelId, pane);
102
104
  }
103
105
 
106
+ /**
107
+ * W6.1 (group-B migration): open a config-modal surface by name via the
108
+ * ctx.openModal seam (ui-openers wires it; the WO-A host replaces the interim
109
+ * "not available yet" implementation with real dispatch). Front-doors for
110
+ * panels that migrated to modals call this instead of openCommandPanel — the
111
+ * modal is the surface's new home. Stubbed in tests by setting ctx.openModal.
112
+ */
113
+ export function openModalCommand(
114
+ context: Pick<CommandContext, 'openModal'>,
115
+ modalName: string,
116
+ ): void {
117
+ const openModal = requireContextValue(context.openModal, 'openModal');
118
+ openModal(modalName);
119
+ }
120
+
104
121
  export function openOnboardingWizard(
105
122
  context: Pick<CommandContext, 'openOnboardingWizard'>,
106
123
  modeOrOptions?: import('../onboarding/onboarding-wizard.ts').OnboardingWizardMode
@@ -238,12 +255,19 @@ export function requireProviderApi(context: CommandContext): ProviderApi {
238
255
  return requireContextValue(context.clients?.providerApi, 'clients.providerApi');
239
256
  }
240
257
 
258
+ /** Result of a manual /compact run: the SDK's CompactionEvent, plus an
259
+ * out-of-band quality score (W5.4/B28) when one could be computed. */
260
+ export interface CompactionRunResult {
261
+ readonly event: CompactionEvent;
262
+ readonly qualityScore: CompactionQualityScore | null;
263
+ }
264
+
241
265
  /**
242
- * Compact the conversation and return the CompactionEvent recorded by the SDK,
243
- * or null if no event was recorded (e.g. compaction was skipped or produced no
244
- * change).
266
+ * Compact the conversation and return the CompactionEvent recorded by the SDK
267
+ * (plus an out-of-band quality score), or null if no event was recorded (e.g.
268
+ * compaction was skipped or produced no change).
245
269
  */
246
- export async function compactConversation(context: CommandContext): Promise<CompactionEvent | null> {
270
+ export async function compactConversation(context: CommandContext): Promise<CompactionRunResult | null> {
247
271
  const conversationManager = context.session.conversationManager;
248
272
  const providerRegistry = context.provider.providerRegistry;
249
273
  // Resolve the live context window for the current model so manual /compact
@@ -263,20 +287,20 @@ export async function compactConversation(context: CommandContext): Promise<Comp
263
287
  }
264
288
 
265
289
  const eventBefore = getLastCompactionEvent();
290
+ const messagesBefore = conversationManager.getMessagesForLLM();
266
291
  const sessionMemories = context.session.sessionMemoryStore?.list() ?? [];
267
292
  const lineageTracker = context.session.sessionLineageTracker;
268
293
  const agentManager = context.ops.agentManager;
269
294
  const planManager = context.ops.planManager;
270
295
  const compactionCtx: CompactionContext = {
271
- messages: conversationManager.getMessagesForLLM(),
296
+ messages: messagesBefore,
272
297
  sessionMemories,
273
- // Mirror buildAutoCompactionContext: pass the running/pending agents, the
274
- // active execution plan, and the session-lineage log so the handoff summary
275
- // and lineage section are populated correctly (not "compaction #0").
276
- agents:
277
- agentManager
278
- ?.exportState()
279
- .filter((agent) => agent.status === 'running' || agent.status === 'pending') ?? [],
298
+ // Mirror buildAutoCompactionContext: pass ALL agent records (not just
299
+ // running/pending) so completed/failed subagent work reaches the
300
+ // "Completed Agent Work" / "Currently Running" compaction sections, plus
301
+ // the active execution plan and the session-lineage log so the handoff
302
+ // summary and lineage section are populated correctly (not "compaction #0").
303
+ agents: agentManager?.exportState() ?? [],
280
304
  // Mirror buildAutoCompactionContext: include the live WRFC chains (wired
281
305
  // through context.session.wrfcController) so the handoff summary's
282
306
  // orchestration section matches the SDK auto-compaction path.
@@ -284,6 +308,11 @@ export async function compactConversation(context: CommandContext): Promise<Comp
284
308
  activePlan: planManager?.getActive(context.session.runtime.sessionId) ?? null,
285
309
  lineageEntries: lineageTracker?.getEntries() ?? [],
286
310
  compactionCount: lineageTracker?.getCompactionCount() ?? 0,
311
+ // Mirror buildAutoCompactionContext: pass the recorded original task so
312
+ // the "Original task" lineage line reflects the session's actual first
313
+ // task instead of falling back to the current message on every manual
314
+ // compaction after the first.
315
+ originalTask: lineageTracker?.getOriginalTask() ?? undefined,
287
316
  contextWindow,
288
317
  trigger: 'manual',
289
318
  extractionModelId: context.session.runtime.model,
@@ -299,7 +328,19 @@ export async function compactConversation(context: CommandContext): Promise<Comp
299
328
  const eventAfter = getLastCompactionEvent();
300
329
  // Return the new event only if it differs from the one recorded before the call.
301
330
  if (eventAfter !== null && eventAfter !== eventBefore) {
302
- return eventAfter;
331
+ // W5.4/B28: score this run out-of-band (see compaction-quality.ts for why
332
+ // this can't just subscribe to the SDK's own CompactionManager pipeline)
333
+ // and keep the score keyed by this event's timestamp for /compact-history.
334
+ const qualityScore = scoreCompactionRun({
335
+ sessionId: context.session.runtime.sessionId,
336
+ contextWindow,
337
+ messagesBefore,
338
+ messagesAfter: conversationManager.getMessagesForLLM(),
339
+ tokensBefore: eventAfter.tokensBeforeEstimate,
340
+ tokensAfter: eventAfter.tokensAfterEstimate,
341
+ });
342
+ recordCompactionQualityScore(eventAfter.timestamp, qualityScore);
343
+ return { event: eventAfter, qualityScore };
303
344
  }
304
345
  return null;
305
346
  }
@@ -16,7 +16,7 @@ export function registerServicesRuntimeCommands(registry: CommandRegistry): void
16
16
  const sub = args[0] ?? 'open';
17
17
  const shellPaths = requireShellPaths(ctx);
18
18
  if (sub === 'open' || sub === 'panel') {
19
- openCommandPanel(ctx, 'services');
19
+ ctx.openModal?.('services-modal'); // W6.1: services panel -> config modal
20
20
  return;
21
21
  }
22
22
  const svcRegistry = requireServiceRegistry(ctx);
@@ -79,11 +79,23 @@ function buildTranscriptReviewLines(
79
79
  ];
80
80
  }
81
81
 
82
- function reopenPanelsFromReturnContext(ctx: CommandContext, summary: SessionReturnContextSummary | undefined): string[] {
82
+ // Exported (test-only concern) so the MIGRATE-TO-MODAL redirect-skip honesty
83
+ // (W6 review, finding 3: saved-layout restore with 'sessions' must not lie)
84
+ // can be unit-tested directly instead of through a full /resume harness.
85
+ export function reopenPanelsFromReturnContext(ctx: CommandContext, summary: SessionReturnContextSummary | undefined): string[] {
83
86
  if (!summary?.openPanels || summary.openPanels.length === 0) return [];
84
87
  const panelManager = requirePanelManager(ctx);
85
88
  const reopened: string[] = [];
89
+ const movedToModal: string[] = [];
86
90
  for (const panelId of summary.openPanels.slice(0, 4)) {
91
+ // W6.1 (the purge): a MIGRATE-TO-MODAL id has no panel to restore — a modal
92
+ // is not part of the saved panel layout. Skip it (don't pop a modal
93
+ // mid-resume) and note it once, rather than firing openModal + revealing an
94
+ // empty workspace during resume.
95
+ if (panelManager.getModalRedirect(panelId) !== undefined) {
96
+ movedToModal.push(panelId);
97
+ continue;
98
+ }
87
99
  try {
88
100
  panelManager.open(panelId);
89
101
  reopened.push(panelId);
@@ -92,6 +104,9 @@ function reopenPanelsFromReturnContext(ctx: CommandContext, summary: SessionRetu
92
104
  }
93
105
  }
94
106
  if (reopened.length > 0) panelManager.show();
107
+ if (movedToModal.length > 0) {
108
+ ctx.print(`Note: ${movedToModal.join(', ')} moved to a modal — reopen via its command instead of as a panel.`);
109
+ }
95
110
  return reopened;
96
111
  }
97
112
 
@@ -33,7 +33,7 @@ export function registerSettingsSyncRuntimeCommands(registry: CommandRegistry):
33
33
  const controlPlaneConfigDir = ctx.platform.configManager.getControlPlaneConfigDir();
34
34
  const sub = (args[0] ?? 'review').toLowerCase();
35
35
  if (sub === 'panel' || sub === 'open') {
36
- openCommandPanel(ctx, 'settings-sync');
36
+ ctx.openModal?.('settings-sync-modal'); // W6.1: settings-sync panel -> config modal
37
37
  return;
38
38
  }
39
39
  if (sub === 'show') {
@@ -153,6 +153,8 @@ export function registerShellCoreCommands(registry: CommandRegistry): void {
153
153
  { id: '/template save', label: '/template save <name>', detail: 'Save prompt as template', category: 'Templates' },
154
154
  { id: '/template use', label: '/template use <name>', detail: 'Execute template', category: 'Templates' },
155
155
  { id: '/tools', label: '/tools', detail: 'List available tools', category: 'Tools & System' },
156
+ { id: '/search', label: '/search <query> [--limit <n>]', detail: 'Search the web and show ranked results', category: 'Tools & System' },
157
+ { id: '/imagine', label: '/imagine <prompt>', detail: 'Generate an image from a prompt', category: 'Tools & System' },
156
158
  { id: '/paste', label: '/paste', detail: 'Insert clipboard text or image into the prompt', category: 'Tools & System' },
157
159
  { id: '/shortcuts', label: '/shortcuts', detail: 'View keyboard shortcuts reference', category: 'Tools & System' },
158
160
  { id: '/commands', label: '/commands', detail: 'Browse all commands in a scrollable list', category: 'Tools & System' },
@@ -207,18 +209,24 @@ export function registerShellCoreCommands(registry: CommandRegistry): void {
207
209
  description: 'Summarize conversation to free context window',
208
210
  async handler(_args, ctx) {
209
211
  const messages = ctx.session.conversationManager.getMessagesForLLM();
210
- // contextWindow is not on CommandContext; preview shows message/token counts
211
- // without the capacity-% clause (still honest; no fabricated value).
212
- const contextWindow = 0;
212
+ // W5.4 (wo803): contextWindow IS reachable from CommandContext the same
213
+ // call compactConversation() (runtime-services.ts) already makes to scale
214
+ // its own behaviour by window size. Previously hardcoded to 0 here, which
215
+ // silently suppressed buildCompactionPreview()'s capacity-% clause even
216
+ // though the builder has always supported it.
217
+ const contextWindow = ctx.provider.providerRegistry.getContextWindowForModel(
218
+ ctx.provider.providerRegistry.getCurrentModel(),
219
+ );
213
220
  const memStore = ctx.session.sessionMemoryStore;
214
221
  const pinnedMemoryCount = memStore ? memStore.list().length : 0;
215
222
  // Pre-compact preview: honest estimate, clearly labelled.
216
223
  const preview = buildCompactionPreview({ messages, contextWindow, pinnedMemoryCount, trigger: 'manual' });
217
224
  ctx.print(preview);
218
- const event = await compactConversation(ctx);
219
- if (event) {
220
- // Post-compact notice: uses real CompactionEvent figures.
221
- ctx.print(buildCompactionAfterNotice({ event, pinnedMemoryCount }));
225
+ const result = await compactConversation(ctx);
226
+ if (result) {
227
+ // Post-compact notice: uses real CompactionEvent figures, plus an
228
+ // out-of-band quality-score grade line when one was computed (W5.4/B28).
229
+ ctx.print(buildCompactionAfterNotice({ event: result.event, pinnedMemoryCount, qualityScore: result.qualityScore }));
222
230
  } else {
223
231
  ctx.print('[Context] Compact complete.');
224
232
  }
@@ -11,7 +11,7 @@ import {
11
11
  updateInstalledEcosystemEntry,
12
12
  upsertEcosystemCatalogEntry,
13
13
  } from '@/runtime/index.ts';
14
- import { requireEcosystemCatalogPaths, requirePanelManager, requireShellPaths } from './runtime-services.ts';
14
+ import { openModalCommand, requireEcosystemCatalogPaths, requireShellPaths } from './runtime-services.ts';
15
15
 
16
16
  export function registerSkillsRuntimeCommands(registry: CommandRegistry): void {
17
17
  registry.register({
@@ -22,13 +22,7 @@ export function registerSkillsRuntimeCommands(registry: CommandRegistry): void {
22
22
  async handler(args, ctx) {
23
23
  const sub = args[0] ?? 'open';
24
24
  if (sub === 'open' || sub === 'panel') {
25
- if (ctx.showPanel) ctx.showPanel('skills');
26
- else {
27
- const panelManager = requirePanelManager(ctx);
28
- panelManager.open('skills');
29
- panelManager.show();
30
- ctx.renderRequest();
31
- }
25
+ openModalCommand(ctx, 'skills-modal');
32
26
  return;
33
27
  }
34
28
  const skills = await discoverSkills(requireShellPaths(ctx));
@@ -79,8 +79,8 @@ export function registerSubscriptionRuntimeCommands(registry: CommandRegistry):
79
79
  usage: '[review|list|providers|inspect <provider>|login <provider> start [--no-browser] [--manual]|finish <code-or-url>|logout <provider>|bundle export <path>|bundle inspect <path>]',
80
80
  async handler(args, ctx) {
81
81
  const shellPaths = requireShellPaths(ctx);
82
- if (args.length === 0 && ctx.openSubscriptionPanel) {
83
- ctx.openSubscriptionPanel();
82
+ if (args.length === 0 && ctx.openModal) {
83
+ ctx.openModal('subscription-modal'); // W6.1: subscription panel -> config modal
84
84
  return;
85
85
  }
86
86
  const sub = (args[0] ?? 'review').toLowerCase();