@pellux/goodvibes-agent 1.1.6 → 1.2.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 (256) hide show
  1. package/CHANGELOG.md +176 -0
  2. package/README.md +46 -30
  3. package/dist/package/{ast-grep-napi.linux-x64-gnu-mkk8xwww.node → ast-grep-napi.linux-x64-gnu-swtppvy9.node} +0 -0
  4. package/dist/package/{ast-grep-napi.linux-x64-musl-ryqtgdv6.node → ast-grep-napi.linux-x64-musl-ttfcdtap.node} +0 -0
  5. package/dist/package/main.js +132662 -91399
  6. package/docs/README.md +14 -7
  7. package/docs/channels-remote-and-api.md +8 -5
  8. package/docs/connected-host.md +14 -12
  9. package/docs/getting-started.md +56 -30
  10. package/docs/knowledge-artifacts-and-multimodal.md +7 -5
  11. package/docs/project-planning.md +2 -2
  12. package/docs/providers-and-routing.md +11 -3
  13. package/docs/tools-and-commands.md +114 -45
  14. package/docs/voice-and-live-tts.md +3 -1
  15. package/package.json +3 -2
  16. package/release/release-notes.md +130 -5
  17. package/release/release-readiness.json +120 -90
  18. package/src/agent/assistant-cockpit.ts +247 -0
  19. package/src/agent/autonomy-schedule-format.ts +96 -0
  20. package/src/agent/autonomy-schedule.ts +514 -0
  21. package/src/agent/channel-delivery-receipts.ts +292 -0
  22. package/src/agent/competitive-feature-inventory.ts +296 -0
  23. package/src/agent/document-registry-types.ts +106 -0
  24. package/src/agent/document-registry.ts +734 -0
  25. package/src/agent/harness-control.ts +2 -2
  26. package/src/agent/memory-prompt.ts +2 -2
  27. package/src/agent/operator-actions.ts +50 -6
  28. package/src/agent/persona-registry.ts +8 -0
  29. package/src/agent/project-context-files.ts +273 -0
  30. package/src/agent/prompt-context-receipts.ts +502 -0
  31. package/src/agent/reminder-schedule-format.ts +16 -2
  32. package/src/agent/research-run-registry.ts +582 -0
  33. package/src/agent/research-source-registry.ts +441 -0
  34. package/src/agent/routine-registry.ts +19 -3
  35. package/src/agent/routine-schedule-format.ts +27 -2
  36. package/src/agent/runtime-profile-starters.ts +7 -0
  37. package/src/agent/runtime-profile.ts +106 -4
  38. package/src/agent/schedule-edit-format.ts +129 -0
  39. package/src/agent/schedule-edit.ts +496 -0
  40. package/src/agent/schedule-next-routes.ts +42 -0
  41. package/src/agent/setup-wizard-checkpoint.ts +140 -0
  42. package/src/agent/setup-wizard.ts +447 -0
  43. package/src/agent/skill-registry-types.ts +102 -0
  44. package/src/agent/skill-registry.ts +81 -107
  45. package/src/agent/vibe-confirmation-routes.ts +62 -0
  46. package/src/agent/vibe-file.ts +285 -0
  47. package/src/cli/agent-knowledge-command.ts +45 -2
  48. package/src/cli/help.ts +3 -0
  49. package/src/cli/profiles-command.ts +25 -11
  50. package/src/config/agent-settings-policy.ts +1 -18
  51. package/src/input/agent-workspace-activation.ts +53 -0
  52. package/src/input/agent-workspace-artifact-browser-editor.ts +494 -0
  53. package/src/input/agent-workspace-artifact-metadata.ts +17 -0
  54. package/src/input/agent-workspace-basic-command-editors.ts +5 -1
  55. package/src/input/agent-workspace-categories.ts +153 -155
  56. package/src/input/agent-workspace-channel-triage.ts +481 -0
  57. package/src/input/agent-workspace-channels.ts +263 -0
  58. package/src/input/agent-workspace-command-editor.ts +152 -0
  59. package/src/input/agent-workspace-context-snapshot.ts +349 -0
  60. package/src/input/agent-workspace-delegation-editor-submission.ts +8 -0
  61. package/src/input/agent-workspace-document-editor.ts +502 -0
  62. package/src/input/agent-workspace-document-ops-editor.ts +523 -0
  63. package/src/input/agent-workspace-host-category.ts +1 -1
  64. package/src/input/agent-workspace-local-library-snapshot.ts +167 -0
  65. package/src/input/agent-workspace-model-compare-editor.ts +376 -0
  66. package/src/input/agent-workspace-model-compare-prompt-submission.ts +552 -0
  67. package/src/input/agent-workspace-model-compare-types.ts +82 -0
  68. package/src/input/agent-workspace-model-compare-utils.ts +35 -0
  69. package/src/input/agent-workspace-onboarding-categories.ts +141 -0
  70. package/src/input/agent-workspace-operations-command-editor-submission.ts +53 -0
  71. package/src/input/agent-workspace-operations-command-editors.ts +22 -0
  72. package/src/input/agent-workspace-research-report-editor.ts +212 -0
  73. package/src/input/agent-workspace-research-run-editor.ts +144 -0
  74. package/src/input/agent-workspace-research-source-editor.ts +167 -0
  75. package/src/input/agent-workspace-review-packet-snapshot.ts +593 -0
  76. package/src/input/agent-workspace-review-packet-utils.ts +265 -0
  77. package/src/input/agent-workspace-settings.ts +262 -30
  78. package/src/input/agent-workspace-setup-checkpoint-action.ts +127 -0
  79. package/src/input/agent-workspace-setup-snapshot.ts +198 -0
  80. package/src/input/agent-workspace-setup.ts +34 -1
  81. package/src/input/agent-workspace-snapshot.ts +162 -147
  82. package/src/input/agent-workspace-types.ts +287 -2
  83. package/src/input/agent-workspace.ts +18 -0
  84. package/src/input/command-registry.ts +9 -2
  85. package/src/input/commands/agent-runtime-profile-runtime.ts +28 -13
  86. package/src/input/commands/channels-runtime.ts +102 -114
  87. package/src/input/commands/delegation-runtime.ts +87 -24
  88. package/src/input/commands/knowledge-browser-flags.ts +12 -0
  89. package/src/input/commands/knowledge.ts +28 -14
  90. package/src/input/commands/operator-actions-runtime.ts +6 -3
  91. package/src/input/commands/schedule-runtime.ts +71 -14
  92. package/src/input/commands/session-content.ts +2 -2
  93. package/src/input/commands/shell-core.ts +2 -0
  94. package/src/input/commands/vibe-runtime.ts +140 -0
  95. package/src/input/commands.ts +2 -0
  96. package/src/input/connected-host-routes.ts +123 -0
  97. package/src/input/settings-modal-types.ts +14 -0
  98. package/src/main.ts +15 -15
  99. package/src/panels/qr-panel.ts +2 -2
  100. package/src/renderer/agent-workspace-context-lines.ts +686 -0
  101. package/src/renderer/agent-workspace.ts +30 -419
  102. package/src/renderer/settings-modal-helpers.ts +12 -0
  103. package/src/renderer/settings-modal.ts +12 -0
  104. package/src/runtime/bootstrap-command-context.ts +11 -1
  105. package/src/runtime/bootstrap-command-parts.ts +14 -3
  106. package/src/runtime/bootstrap-core.ts +43 -1
  107. package/src/runtime/bootstrap-shell.ts +6 -0
  108. package/src/runtime/bootstrap.ts +113 -30
  109. package/src/runtime/connected-host-auth.ts +3 -2
  110. package/src/runtime/execution-ledger.ts +231 -0
  111. package/src/runtime/services.ts +88 -10
  112. package/src/runtime/tool-permission-safety.ts +287 -0
  113. package/src/shell/session-continuity-hints.ts +39 -0
  114. package/src/tools/agent-artifacts-tool.ts +606 -0
  115. package/src/tools/agent-audit-tool.ts +155 -0
  116. package/src/tools/agent-autonomy-schedule-tool.ts +238 -0
  117. package/src/tools/agent-autonomy-tool.ts +140 -0
  118. package/src/tools/agent-channel-send-tool.ts +24 -2
  119. package/src/tools/agent-channels-tool.ts +140 -0
  120. package/src/tools/agent-computer-tool.ts +168 -0
  121. package/src/tools/agent-context-policy.ts +267 -10
  122. package/src/tools/agent-context-tool.ts +143 -0
  123. package/src/tools/agent-delegation-tool.ts +128 -0
  124. package/src/tools/agent-device-tool.ts +240 -0
  125. package/src/tools/agent-documents-tool.ts +684 -0
  126. package/src/tools/agent-execution-tool.ts +230 -0
  127. package/src/tools/agent-harness-agent-orchestration.ts +703 -0
  128. package/src/tools/agent-harness-autonomy-intake.ts +785 -0
  129. package/src/tools/agent-harness-autonomy-live-records.ts +588 -0
  130. package/src/tools/agent-harness-autonomy-queue-types.ts +88 -0
  131. package/src/tools/agent-harness-autonomy-queue.ts +560 -0
  132. package/src/tools/agent-harness-background-processes-types.ts +35 -0
  133. package/src/tools/agent-harness-background-processes.ts +794 -0
  134. package/src/tools/agent-harness-browser-cockpit-route.ts +219 -0
  135. package/src/tools/agent-harness-browser-control.ts +338 -0
  136. package/src/tools/agent-harness-channel-metadata.ts +168 -10
  137. package/src/tools/agent-harness-cli-command-policy.ts +110 -0
  138. package/src/tools/agent-harness-command-catalog.ts +4 -2
  139. package/src/tools/agent-harness-command-runner.ts +42 -0
  140. package/src/tools/agent-harness-connected-host-status.ts +7 -4
  141. package/src/tools/agent-harness-delegation-posture.ts +234 -19
  142. package/src/tools/agent-harness-document-ops-reviewer-readiness.ts +234 -0
  143. package/src/tools/agent-harness-document-ops-types.ts +72 -0
  144. package/src/tools/agent-harness-document-ops.ts +671 -0
  145. package/src/tools/agent-harness-execution-history.ts +489 -0
  146. package/src/tools/agent-harness-execution-posture.ts +382 -0
  147. package/src/tools/agent-harness-file-recovery.ts +135 -0
  148. package/src/tools/agent-harness-keybinding-metadata.ts +16 -12
  149. package/src/tools/agent-harness-learning-curator-common.ts +102 -0
  150. package/src/tools/agent-harness-learning-curator-consolidation.ts +295 -0
  151. package/src/tools/agent-harness-learning-curator-proposals.ts +606 -0
  152. package/src/tools/agent-harness-learning-curator-types.ts +151 -0
  153. package/src/tools/agent-harness-learning-curator.ts +417 -0
  154. package/src/tools/agent-harness-local-model-benchmarks.ts +199 -0
  155. package/src/tools/agent-harness-local-model-cookbook.ts +238 -0
  156. package/src/tools/agent-harness-local-model-endpoints.ts +673 -0
  157. package/src/tools/agent-harness-media-posture.ts +208 -2
  158. package/src/tools/agent-harness-memory-posture.ts +556 -0
  159. package/src/tools/agent-harness-metadata.ts +100 -168
  160. package/src/tools/agent-harness-mode-catalog.ts +84 -33
  161. package/src/tools/agent-harness-model-catalog.ts +162 -0
  162. package/src/tools/agent-harness-model-provider-health.ts +186 -0
  163. package/src/tools/agent-harness-model-readiness.ts +406 -0
  164. package/src/tools/agent-harness-model-routing-types.ts +266 -0
  165. package/src/tools/agent-harness-model-routing-utils.ts +30 -0
  166. package/src/tools/agent-harness-model-routing.ts +137 -190
  167. package/src/tools/agent-harness-operator-methods.ts +115 -133
  168. package/src/tools/agent-harness-pairing-posture.ts +431 -18
  169. package/src/tools/agent-harness-personal-ops-discovery.ts +533 -0
  170. package/src/tools/agent-harness-personal-ops-intake.ts +385 -0
  171. package/src/tools/agent-harness-personal-ops-lanes.ts +204 -0
  172. package/src/tools/agent-harness-personal-ops-records.ts +732 -0
  173. package/src/tools/agent-harness-personal-ops-runner.ts +637 -0
  174. package/src/tools/agent-harness-personal-ops-types.ts +222 -0
  175. package/src/tools/agent-harness-personal-ops.ts +606 -0
  176. package/src/tools/agent-harness-project-context.ts +144 -0
  177. package/src/tools/agent-harness-prompt-context.ts +589 -0
  178. package/src/tools/agent-harness-provider-account-metadata.ts +2 -2
  179. package/src/tools/agent-harness-release-evidence.ts +9 -7
  180. package/src/tools/agent-harness-release-readiness.ts +9 -7
  181. package/src/tools/agent-harness-research-briefing.ts +427 -0
  182. package/src/tools/agent-harness-research-queue.ts +250 -0
  183. package/src/tools/agent-harness-research-runs.ts +295 -0
  184. package/src/tools/agent-harness-research-workflow.ts +322 -0
  185. package/src/tools/agent-harness-security-posture.ts +2 -2
  186. package/src/tools/agent-harness-service-posture.ts +9 -9
  187. package/src/tools/agent-harness-session-metadata.ts +3 -3
  188. package/src/tools/agent-harness-setup-connected-host.ts +501 -0
  189. package/src/tools/agent-harness-setup-describe.ts +557 -0
  190. package/src/tools/agent-harness-setup-handoffs.ts +502 -0
  191. package/src/tools/agent-harness-setup-model-helpers.ts +101 -0
  192. package/src/tools/agent-harness-setup-plan.ts +253 -0
  193. package/src/tools/agent-harness-setup-posture-types.ts +218 -0
  194. package/src/tools/agent-harness-setup-posture-utils.ts +173 -0
  195. package/src/tools/agent-harness-setup-posture.ts +449 -221
  196. package/src/tools/agent-harness-setup-smoke.ts +508 -0
  197. package/src/tools/agent-harness-sudo-posture.ts +114 -0
  198. package/src/tools/agent-harness-tool-schema.ts +120 -7
  199. package/src/tools/agent-harness-tool-types.ts +78 -0
  200. package/src/tools/agent-harness-tool-utils.ts +43 -0
  201. package/src/tools/agent-harness-tool.ts +311 -370
  202. package/src/tools/agent-harness-ui-surface-metadata.ts +76 -69
  203. package/src/tools/agent-harness-ui-surface-types.ts +46 -0
  204. package/src/tools/agent-harness-vibe-health.ts +105 -0
  205. package/src/tools/agent-harness-workspace-action-runner.ts +149 -0
  206. package/src/tools/agent-harness-workspace-actions.ts +114 -8
  207. package/src/tools/agent-harness-workspace-editor-execution.ts +214 -0
  208. package/src/tools/agent-harness-workspace-editor-runner.ts +755 -0
  209. package/src/tools/agent-host-tool.ts +159 -0
  210. package/src/tools/agent-knowledge-ingest-tool.ts +34 -1
  211. package/src/tools/agent-learning-consolidation-core.ts +327 -0
  212. package/src/tools/agent-learning-consolidation-tool.ts +758 -0
  213. package/src/tools/agent-memory-tool.ts +214 -0
  214. package/src/tools/agent-model-compare-export.ts +315 -0
  215. package/src/tools/agent-model-compare-handoff.ts +592 -0
  216. package/src/tools/agent-model-compare-judgment.ts +633 -0
  217. package/src/tools/agent-model-compare-run.ts +722 -0
  218. package/src/tools/agent-model-compare-tool.ts +698 -0
  219. package/src/tools/agent-model-compare-types.ts +191 -0
  220. package/src/tools/agent-model-compare-utils.ts +93 -0
  221. package/src/tools/agent-models-tool.ts +208 -0
  222. package/src/tools/agent-operator-action-tool.ts +1 -1
  223. package/src/tools/agent-operator-method-tool.ts +643 -0
  224. package/src/tools/agent-personal-ops-tool.ts +197 -0
  225. package/src/tools/agent-policy-explanation.ts +415 -0
  226. package/src/tools/agent-research-report-tool.ts +608 -0
  227. package/src/tools/agent-research-runs-tool.ts +434 -0
  228. package/src/tools/agent-research-sources-tool.ts +443 -0
  229. package/src/tools/agent-research-tool.ts +687 -0
  230. package/src/tools/agent-review-packet-presets-core.ts +757 -0
  231. package/src/tools/agent-review-packet-presets-tool.ts +466 -0
  232. package/src/tools/agent-review-packet-share-tool.ts +305 -0
  233. package/src/tools/agent-route-planner-candidates-setup.ts +411 -0
  234. package/src/tools/agent-route-planner-candidates-surfaces.ts +432 -0
  235. package/src/tools/agent-route-planner-candidates-work.ts +251 -0
  236. package/src/tools/agent-route-planner-helpers.ts +667 -0
  237. package/src/tools/agent-route-planner.ts +185 -0
  238. package/src/tools/agent-route-tool.ts +105 -0
  239. package/src/tools/agent-schedule-edit-tool.ts +210 -0
  240. package/src/tools/agent-schedule-tool.ts +282 -0
  241. package/src/tools/agent-security-tool.ts +145 -0
  242. package/src/tools/agent-sessions-tool.ts +122 -0
  243. package/src/tools/agent-settings-import-tool.ts +104 -0
  244. package/src/tools/agent-settings-tool.ts +176 -0
  245. package/src/tools/agent-setup-tool.ts +226 -0
  246. package/src/tools/agent-support-tool.ts +122 -0
  247. package/src/tools/agent-terminal-process-tools.ts +167 -0
  248. package/src/tools/agent-tool-policy-guard-types.ts +77 -0
  249. package/src/tools/agent-tool-policy-guard.ts +110 -89
  250. package/src/tools/agent-vibe-tool.ts +297 -0
  251. package/src/tools/agent-work-plan-tool.ts +265 -6
  252. package/src/tools/agent-workspace-tool.ts +305 -0
  253. package/src/tools/artifact-archive.ts +169 -0
  254. package/src/tools/tool-definition-compaction.ts +36 -0
  255. package/src/tools/tool-execution-safety.ts +41 -0
  256. package/src/version.ts +1 -1
@@ -0,0 +1,501 @@
1
+ import { getOperatorContract } from '@pellux/goodvibes-sdk/contracts';
2
+ import { requireShellPaths } from '../input/commands/runtime-services.ts';
3
+ import type { CommandContext } from '../input/command-registry.ts';
4
+ import type { CliServicePosture } from '../cli/service-posture.ts';
5
+ import { connectedHostOperatorTokenFingerprint, readConnectedHostOperatorToken } from '../runtime/connected-host-auth.ts';
6
+ import { previewHarnessText } from './agent-harness-text.ts';
7
+ import { operatorMethodRoute, provisionConnectedHostTokenRoute } from './agent-harness-setup-posture-utils.ts';
8
+ import type { OperatorContractMethod, SetupBootstrapPlan, SetupConnectedHostAuthPosture, SetupPlanStatus, SetupRepairCard, SetupRepairCardEffect, SetupRepairLiveEvidence, SetupRepairOutcome, SetupRepairRecommendation, SetupRepairCardState, SetupServiceLifecycleDecision, SetupServiceProbe, SetupServiceProbeStatus } from './agent-harness-setup-posture-types.ts';
9
+ import type { collectSnapshot } from './agent-harness-setup-posture-utils.ts';
10
+
11
+ export function connectedHostServiceProbe(posture: CliServicePosture | null): SetupServiceProbe {
12
+ const endpoint = posture?.endpoints.find((candidate) => candidate.id === 'controlPlane');
13
+ if (!posture || !endpoint) {
14
+ return {
15
+ status: 'not-probed',
16
+ endpointId: 'controlPlane',
17
+ label: 'runtime connection',
18
+ enabled: false,
19
+ binding: '(unavailable)',
20
+ diagnosticRoute: 'host action:"services" includeParameters:true',
21
+ issues: ['Service posture probe is unavailable in this runtime.'],
22
+ };
23
+ }
24
+ const binding = `${endpoint.binding.host}:${endpoint.binding.port}`;
25
+ const status: SetupServiceProbeStatus = !endpoint.enabled
26
+ ? 'not-enabled'
27
+ : endpoint.reachable === true
28
+ ? 'reachable'
29
+ : endpoint.reachable === false
30
+ ? 'unreachable'
31
+ : 'not-probed';
32
+ return {
33
+ status,
34
+ endpointId: endpoint.id,
35
+ label: endpoint.label,
36
+ enabled: endpoint.enabled,
37
+ binding,
38
+ diagnosticRoute: 'host action:"service" endpointId:"controlPlane" includeParameters:true',
39
+ issues: posture.issues,
40
+ };
41
+ }
42
+
43
+ export function serviceProbeSignal(probe: SetupServiceProbe): string {
44
+ return `runtime connection probe: ${probe.status} ${probe.binding}`;
45
+ }
46
+
47
+ export function repairLiveEvidence(probe: SetupServiceProbe, summary: string): SetupRepairLiveEvidence {
48
+ return {
49
+ probeStatus: probe.status,
50
+ summary,
51
+ };
52
+ }
53
+
54
+ export function lifecycleRepairRecommendation(probe: SetupServiceProbe): SetupRepairRecommendation {
55
+ if (probe.status === 'reachable') return 'not-needed';
56
+ if (probe.status === 'unreachable') return 'inspect-first';
57
+ return 'inspect-first';
58
+ }
59
+
60
+ export function hostSetupStatus(snapshot: Awaited<ReturnType<typeof collectSnapshot>>, probe: SetupServiceProbe): SetupPlanStatus {
61
+ if (snapshot.collectionIssues.some((issue) => issue.area === 'host')) return 'blocked';
62
+ if (probe.status === 'unreachable') return 'blocked';
63
+ return 'check';
64
+ }
65
+
66
+ export function connectedHostAuthPosture(
67
+ context: CommandContext,
68
+ snapshot: Awaited<ReturnType<typeof collectSnapshot>>,
69
+ ): SetupConnectedHostAuthPosture {
70
+ const shellPaths = requireShellPaths(context);
71
+ const token = readConnectedHostOperatorToken(shellPaths.homeDirectory);
72
+ const usable = Boolean(token.token);
73
+ return {
74
+ owner: 'connected-host',
75
+ operatorToken: {
76
+ present: token.present,
77
+ usable,
78
+ path: token.path,
79
+ ...(token.token ? { fingerprint: connectedHostOperatorTokenFingerprint(token.token) } : {}),
80
+ ...(token.error ? { error: previewHarnessText(token.error, 120) } : {}),
81
+ },
82
+ compatibilityAuth: {
83
+ userStorePath: snapshot.auth.snapshot.userStorePath,
84
+ userStorePresent: snapshot.auth.snapshot.persisted,
85
+ bootstrapCredentialPath: snapshot.auth.snapshot.bootstrapCredentialPath,
86
+ bootstrapCredentialPresent: snapshot.auth.snapshot.bootstrapCredentialPresent,
87
+ users: snapshot.auth.snapshot.userCount,
88
+ sessions: snapshot.auth.snapshot.sessionCount,
89
+ },
90
+ routes: {
91
+ reviewCommand: '/auth review',
92
+ connectedHostStatus: 'host action:"status" includeParameters:true',
93
+ pairingPosture: 'agent_harness mode:"pairing_posture" includeParameters:true',
94
+ qrPairingRoute: 'agent_harness mode:"pairing_route" pairingRouteId:"qr-pairing"',
95
+ manualTokenRoute: 'agent_harness mode:"pairing_route" pairingRouteId:"manual-token-display"',
96
+ provisionTokenRoute: provisionConnectedHostTokenRoute(),
97
+ tokenProvisioningOwner: 'connected GoodVibes host canonical token store',
98
+ tokenProvisioningSource: 'SDK getOrCreateCompanionToken writes ~/.goodvibes/daemon/operator-tokens.json with mode 0600; Agent exposes it only through confirmed setup and never returns the raw token',
99
+ },
100
+ };
101
+ }
102
+
103
+ export function connectedHostAuthStatus(posture: SetupConnectedHostAuthPosture): SetupPlanStatus {
104
+ if (!posture.operatorToken.usable) return 'blocked';
105
+ if (posture.compatibilityAuth.bootstrapCredentialPresent) return 'check';
106
+ return 'ready';
107
+ }
108
+
109
+ export function connectedHostAuthNextAction(posture: SetupConnectedHostAuthPosture): string {
110
+ if (!posture.operatorToken.present) {
111
+ return 'Run the confirmed connected-host token provisioning route, inspect pairing posture for visible handoff routes, then rerun auth review and connected-host status.';
112
+ }
113
+ if (!posture.operatorToken.usable) {
114
+ return 'Run the confirmed connected-host token provisioning route to repair the local token file, then rerun auth review and connected-host status.';
115
+ }
116
+ if (posture.compatibilityAuth.bootstrapCredentialPresent) {
117
+ return 'Review auth status and clear or rotate the compatibility bootstrap credential through the owning GoodVibes host if it is no longer needed.';
118
+ }
119
+ return 'Verify the token against connected-host status and Agent Knowledge readiness before relying on protected daemon routes.';
120
+ }
121
+
122
+ export function connectedHostAuthSignals(posture: SetupConnectedHostAuthPosture): readonly string[] {
123
+ return [
124
+ `operator token: ${posture.operatorToken.usable ? 'usable' : posture.operatorToken.present ? 'present but unusable' : 'missing'} (${posture.operatorToken.path})`,
125
+ ...(posture.operatorToken.fingerprint ? [`operator token fingerprint: ${posture.operatorToken.fingerprint}`] : []),
126
+ ...(posture.operatorToken.error ? [`operator token parse error: ${posture.operatorToken.error}`] : []),
127
+ `token provisioning route: ${posture.routes.provisionTokenRoute}`,
128
+ `compatibility auth users: ${posture.compatibilityAuth.users}`,
129
+ `compatibility auth sessions: ${posture.compatibilityAuth.sessions}`,
130
+ `bootstrap credential: ${posture.compatibilityAuth.bootstrapCredentialPresent ? 'present' : 'missing'} (${posture.compatibilityAuth.bootstrapCredentialPath})`,
131
+ `token provisioning owner: ${posture.routes.tokenProvisioningOwner}`,
132
+ `token provisioning source: ${posture.routes.tokenProvisioningSource}`,
133
+ ];
134
+ }
135
+
136
+ export function operatorMethodIds(): ReadonlySet<string> {
137
+ const contract = getOperatorContract();
138
+ const methods = Array.isArray(contract.operator?.methods)
139
+ ? contract.operator.methods as OperatorContractMethod[]
140
+ : [];
141
+ return new Set(methods.map((method) => method.id).filter(Boolean));
142
+ }
143
+
144
+ export function setupRepairCard(
145
+ methodIds: ReadonlySet<string>,
146
+ options: {
147
+ readonly id: string;
148
+ readonly label: string;
149
+ readonly methodId?: string;
150
+ readonly effect: SetupRepairCardEffect;
151
+ readonly userRoute: string;
152
+ readonly prerequisite?: string;
153
+ readonly recommendation?: SetupRepairRecommendation;
154
+ readonly liveEvidence?: SetupRepairLiveEvidence;
155
+ readonly outcome?: SetupRepairOutcome;
156
+ readonly recommendedWhen: string;
157
+ readonly safety: string;
158
+ readonly liveHostRequired?: boolean;
159
+ },
160
+ ): SetupRepairCard {
161
+ const methodPresent = options.methodId ? methodIds.has(options.methodId) : true;
162
+ const state: SetupRepairCardState = !methodPresent
163
+ ? 'missing'
164
+ : options.liveHostRequired
165
+ ? 'requires-live-host'
166
+ : 'available';
167
+ return {
168
+ id: options.id,
169
+ label: options.label,
170
+ state,
171
+ effect: options.effect,
172
+ ...(options.methodId ? { methodId: options.methodId } : {}),
173
+ ...(options.methodId && methodPresent ? { modelRoute: operatorMethodRoute(options.methodId, options.effect === 'confirmed-effect') } : {}),
174
+ userRoute: options.userRoute,
175
+ ...(options.prerequisite ? { prerequisite: options.prerequisite } : {}),
176
+ recommendation: !methodPresent || state === 'requires-live-host' ? 'unavailable' : options.recommendation ?? 'inspect-first',
177
+ ...(options.liveEvidence ? { liveEvidence: options.liveEvidence } : {}),
178
+ ...(options.outcome ? { outcome: options.outcome } : {}),
179
+ recommendedWhen: options.recommendedWhen,
180
+ safety: options.safety,
181
+ };
182
+ }
183
+
184
+ export function serviceRepairOutcome(methodId: 'services.status' | 'services.install' | 'services.start' | 'services.restart'): SetupRepairOutcome {
185
+ const common = {
186
+ evidenceFields: ['installed', 'autostart', 'running', 'pid', 'lastAction', 'actionError', 'network.controlPlane.ready'],
187
+ verificationRoute: operatorMethodRoute('services.status', false),
188
+ recoveryRoute: 'setup action:"item" setupItemId:"connected-host-readiness" includeParameters:true',
189
+ };
190
+ if (methodId === 'services.status') {
191
+ return {
192
+ target: 'read-current-posture',
193
+ successCriteria: [
194
+ 'The daemon returns installed, autostart, and running booleans.',
195
+ 'The receipt has no actionError.',
196
+ ],
197
+ ...common,
198
+ };
199
+ }
200
+ if (methodId === 'services.install') {
201
+ return {
202
+ target: 'installed-service',
203
+ successCriteria: [
204
+ 'The confirmed services.install receipt reports installed:true.',
205
+ 'The receipt has no actionError.',
206
+ 'A follow-up services.status read confirms the same installed posture before retrying another lifecycle action.',
207
+ ],
208
+ ...common,
209
+ };
210
+ }
211
+ if (methodId === 'services.start') {
212
+ return {
213
+ target: 'running-service',
214
+ successCriteria: [
215
+ 'The confirmed services.start receipt reports running:true.',
216
+ 'The receipt has no actionError.',
217
+ 'A follow-up services.status read confirms running:true before retrying start or escalating.',
218
+ ],
219
+ ...common,
220
+ };
221
+ }
222
+ return {
223
+ target: 'restarted-running-service',
224
+ successCriteria: [
225
+ 'The confirmed services.restart receipt reports running:true after restart.',
226
+ 'The receipt has no actionError.',
227
+ 'A follow-up services.status read confirms running:true before retrying restart or escalating.',
228
+ ],
229
+ ...common,
230
+ };
231
+ }
232
+
233
+ export function connectedHostRepairCards(
234
+ snapshot: Awaited<ReturnType<typeof collectSnapshot>>,
235
+ probe: SetupServiceProbe,
236
+ ): readonly SetupRepairCard[] {
237
+ const methodIds = operatorMethodIds();
238
+ const hostIssue = snapshot.collectionIssues.some((issue) => issue.area === 'host');
239
+ const liveHostPrerequisite = hostIssue
240
+ ? 'Run connected-host status first; confirmed service methods require a reachable compatible operator endpoint and usable token.'
241
+ : 'Requires a reachable compatible operator endpoint and usable token.';
242
+ const statusRecommendation: SetupRepairRecommendation = probe.status === 'unreachable'
243
+ ? 'recommended'
244
+ : probe.status === 'reachable'
245
+ ? 'not-needed'
246
+ : 'inspect-first';
247
+ const postureRecommendation: SetupRepairRecommendation = probe.status === 'unreachable' || probe.issues.length > 0
248
+ ? 'recommended'
249
+ : probe.status === 'reachable'
250
+ ? 'not-needed'
251
+ : 'inspect-first';
252
+ const lifecycleRecommendation = lifecycleRepairRecommendation(probe);
253
+ return [
254
+ {
255
+ id: 'connected-host-status',
256
+ label: 'Inspect connected-host status',
257
+ state: 'available',
258
+ effect: 'read-only',
259
+ modelRoute: 'host action:"status" includeParameters:true',
260
+ userRoute: 'Agent Workspace -> Home -> Host compatibility',
261
+ recommendation: statusRecommendation,
262
+ liveEvidence: repairLiveEvidence(probe, probe.status === 'reachable'
263
+ ? 'Runtime endpoint is reachable; use connected-host status when token, compatibility, or Knowledge readiness still needs review.'
264
+ : probe.status === 'unreachable'
265
+ ? 'Runtime endpoint is enabled but not reachable; inspect connected-host status and service posture before any lifecycle mutation.'
266
+ : 'Runtime endpoint reachability is not proven; inspect connected-host status before lifecycle mutation.'),
267
+ recommendedWhen: 'Use first for every host setup or repair question.',
268
+ safety: 'Read-only diagnostic; returns redacted token posture and route readiness.',
269
+ },
270
+ {
271
+ id: 'service-posture',
272
+ label: 'Inspect service posture',
273
+ state: 'available',
274
+ effect: 'read-only',
275
+ modelRoute: 'host action:"services" includeParameters:true',
276
+ userRoute: 'Agent Workspace -> Home -> Doctor diagnostics',
277
+ recommendation: postureRecommendation,
278
+ liveEvidence: repairLiveEvidence(probe, probe.issues.length > 0
279
+ ? `Service posture reports ${probe.issues.length} issue(s); inspect endpoint binding, reachability, and logs before mutation.`
280
+ : probe.status === 'reachable'
281
+ ? 'Runtime endpoint is reachable and service posture has no current probe issue.'
282
+ : 'Inspect endpoint binding, reachability, and logs before choosing a lifecycle action.'),
283
+ recommendedWhen: 'Use when endpoints, bind addresses, ports, logs, or listener exposure may be the blocker.',
284
+ safety: 'Read-only diagnostic; probes endpoints only when requested with includeParameters.',
285
+ },
286
+ setupRepairCard(methodIds, {
287
+ id: 'service-status',
288
+ label: 'Read service install/runtime status',
289
+ methodId: 'services.status',
290
+ effect: 'read-only',
291
+ userRoute: 'Agent Workspace -> Home -> Host compatibility',
292
+ prerequisite: liveHostPrerequisite,
293
+ recommendation: statusRecommendation,
294
+ liveEvidence: repairLiveEvidence(probe, probe.status === 'reachable'
295
+ ? 'Runtime endpoint is reachable; service status is optional unless the user is auditing install/autostart posture.'
296
+ : 'Read service status before deciding whether install, start, or restart is actually needed.'),
297
+ outcome: serviceRepairOutcome('services.status'),
298
+ recommendedWhen: 'Use when the daemon is reachable and the user needs install/autostart/running posture.',
299
+ safety: 'Read-only daemon method.',
300
+ liveHostRequired: hostIssue,
301
+ }),
302
+ setupRepairCard(methodIds, {
303
+ id: 'service-install',
304
+ label: 'Install service',
305
+ methodId: 'services.install',
306
+ effect: 'confirmed-effect',
307
+ userRoute: 'Connected-host service control',
308
+ prerequisite: liveHostPrerequisite,
309
+ recommendation: lifecycleRecommendation,
310
+ liveEvidence: repairLiveEvidence(probe, probe.status === 'reachable'
311
+ ? 'Runtime endpoint is already reachable; install is not recommended without service status evidence.'
312
+ : 'Install is not recommended from endpoint reachability alone; require service status to prove the service is not installed.'),
313
+ outcome: serviceRepairOutcome('services.install'),
314
+ recommendedWhen: 'Use only when service status says the platform service is not installed and the user explicitly asks to install it.',
315
+ safety: 'Confirmed service mutation; no uninstall or stop action is included in first-run setup.',
316
+ liveHostRequired: hostIssue,
317
+ }),
318
+ setupRepairCard(methodIds, {
319
+ id: 'service-start',
320
+ label: 'Start service',
321
+ methodId: 'services.start',
322
+ effect: 'confirmed-effect',
323
+ userRoute: 'Connected-host service control',
324
+ prerequisite: liveHostPrerequisite,
325
+ recommendation: lifecycleRecommendation,
326
+ liveEvidence: repairLiveEvidence(probe, probe.status === 'reachable'
327
+ ? 'Runtime endpoint is already reachable; start is not recommended without service status evidence.'
328
+ : 'Start is not recommended from endpoint reachability alone; require service status to prove the service is installed but stopped.'),
329
+ outcome: serviceRepairOutcome('services.start'),
330
+ recommendedWhen: 'Use only when service status says the service is installed but not running and the user explicitly asks to start it.',
331
+ safety: 'Confirmed service mutation.',
332
+ liveHostRequired: hostIssue,
333
+ }),
334
+ setupRepairCard(methodIds, {
335
+ id: 'service-restart',
336
+ label: 'Restart service',
337
+ methodId: 'services.restart',
338
+ effect: 'confirmed-effect',
339
+ userRoute: 'Connected-host service control',
340
+ prerequisite: liveHostPrerequisite,
341
+ recommendation: lifecycleRecommendation,
342
+ liveEvidence: repairLiveEvidence(probe, probe.status === 'reachable'
343
+ ? 'Runtime endpoint is reachable; restart is not recommended unless diagnostics prove the host is unhealthy or incompatible.'
344
+ : 'Restart is not recommended from endpoint reachability alone; require diagnostics or service status to prove a running unhealthy service.'),
345
+ outcome: serviceRepairOutcome('services.restart'),
346
+ recommendedWhen: 'Use only when the service is running but unhealthy or incompatible and the user explicitly asks to restart it.',
347
+ safety: 'Confirmed service mutation; use diagnostics first to avoid disrupting a healthy host.',
348
+ liveHostRequired: hostIssue,
349
+ }),
350
+ ];
351
+ }
352
+
353
+ export function serviceLifecycleReceiptRules(): readonly string[] {
354
+ return [
355
+ 'installed:false -> recommend confirmed services.install.',
356
+ 'installed:true and running:false -> recommend confirmed services.start.',
357
+ 'installed:true and running:true and network.controlPlane.ready:false -> recommend confirmed services.restart.',
358
+ 'installed:true and running:true with no failed control-plane evidence -> no service lifecycle mutation.',
359
+ ];
360
+ }
361
+
362
+ export function setupServiceLifecycleDecision(
363
+ snapshot: Awaited<ReturnType<typeof collectSnapshot>>,
364
+ probe: SetupServiceProbe,
365
+ ): SetupServiceLifecycleDecision {
366
+ const methodIds = operatorMethodIds();
367
+ const statusPublished = methodIds.has('services.status');
368
+ const hostIssue = snapshot.collectionIssues.some((issue) => issue.area === 'host');
369
+ const evidence = {
370
+ probeStatus: probe.status,
371
+ binding: probe.binding,
372
+ hostIssue,
373
+ serviceStatusMethodPublished: statusPublished,
374
+ };
375
+ const blockedMutations = [
376
+ 'services.install until a services.status receipt reports installed:false',
377
+ 'services.start until a services.status receipt reports installed:true and running:false',
378
+ 'services.restart until a services.status receipt reports installed:true, running:true, and network.controlPlane.ready:false or diagnostics prove an unhealthy running service',
379
+ ];
380
+ if (hostIssue) {
381
+ return {
382
+ status: 'bootstrap-first',
383
+ recommendedAction: 'inspect-service-posture',
384
+ modelRoute: 'host action:"services" includeParameters:true',
385
+ reason: 'Agent cannot trust connected-host lifecycle methods until the owning host is reachable enough to return compatible status evidence.',
386
+ evidence,
387
+ receiptRules: serviceLifecycleReceiptRules(),
388
+ blockedMutations,
389
+ };
390
+ }
391
+ if (!statusPublished) {
392
+ return {
393
+ status: 'status-route-unavailable',
394
+ recommendedAction: 'inspect-service-posture',
395
+ modelRoute: 'host action:"services" includeParameters:true',
396
+ reason: 'The connected-host operator contract does not publish services.status, so setup cannot select install/start/restart from a service receipt.',
397
+ evidence,
398
+ receiptRules: serviceLifecycleReceiptRules(),
399
+ blockedMutations,
400
+ };
401
+ }
402
+ if (probe.status === 'reachable') {
403
+ return {
404
+ status: 'no-lifecycle-action',
405
+ recommendedAction: 'none',
406
+ modelRoute: operatorMethodRoute('services.status', false),
407
+ reason: 'The runtime endpoint is reachable; no install/start/restart mutation is justified by probe evidence alone. Read services.status only for install/autostart audit or setup closeout.',
408
+ evidence,
409
+ receiptRules: serviceLifecycleReceiptRules(),
410
+ blockedMutations,
411
+ };
412
+ }
413
+ return {
414
+ status: 'needs-status-receipt',
415
+ recommendedAction: 'read-services-status',
416
+ modelRoute: operatorMethodRoute('services.status', false),
417
+ reason: 'Probe evidence is not enough to choose install, start, or restart. Read a services.status receipt first and let agent_operator_method return the exact lifecycle decision.',
418
+ evidence,
419
+ receiptRules: serviceLifecycleReceiptRules(),
420
+ blockedMutations,
421
+ };
422
+ }
423
+
424
+ export function connectedHostBootstrapPlan(
425
+ snapshot: Awaited<ReturnType<typeof collectSnapshot>>,
426
+ probe: SetupServiceProbe,
427
+ ): SetupBootstrapPlan {
428
+ const hostIssue = snapshot.collectionIssues.some((issue) => issue.area === 'host');
429
+ const probeIssue = probe.status === 'unreachable';
430
+ return {
431
+ status: hostIssue || probeIssue ? 'recommended' : 'optional',
432
+ source: 'goodvibes-tui README, package.json, and bin launchers from the connected-host checkout',
433
+ recommendedWhen: hostIssue
434
+ ? 'Use when Agent cannot reach a compatible connected host, so operator service methods cannot be trusted yet.'
435
+ : probeIssue
436
+ ? 'Use when the configured runtime connection is enabled but unreachable, before confirmed service methods have proven an install/start fix.'
437
+ : 'Use only when the user is setting up a new GoodVibes host or wants to verify the owning host install.',
438
+ steps: [
439
+ {
440
+ id: 'verify-bun',
441
+ label: 'Verify Bun is installed',
442
+ purpose: 'GoodVibes TUI and the daemon package are Bun programs; package lifecycle scripts also need Bun.',
443
+ commands: ['bun --version'],
444
+ expected: 'Prints a Bun version.',
445
+ fallback: 'Install Bun, reopen the terminal so PATH is refreshed, then retry.',
446
+ },
447
+ {
448
+ id: 'install-goodvibes-host',
449
+ label: 'Install the owning GoodVibes host',
450
+ purpose: 'Install the package that provides both the TUI and goodvibes-daemon launchers.',
451
+ commands: [
452
+ 'bun add -g @pellux/goodvibes-tui',
453
+ 'bun pm trust -g @pellux/goodvibes-tui @pellux/goodvibes-sdk core-js tree-sitter-css tree-sitter-javascript tree-sitter-json tree-sitter-python tree-sitter-typescript',
454
+ ],
455
+ expected: 'Global package install completes and Bun reports lifecycle scripts are trusted.',
456
+ fallback: 'If release assets cannot download, use the goodvibes-tui source checkout and run bun install before bun run daemon.',
457
+ },
458
+ {
459
+ id: 'verify-goodvibes-binaries',
460
+ label: 'Verify host binaries',
461
+ purpose: 'Confirm the package installed both user-facing and daemon entrypoints.',
462
+ commands: [
463
+ 'bun pm -g untrusted',
464
+ 'goodvibes --version',
465
+ 'goodvibes-daemon --version',
466
+ ],
467
+ expected: 'Untrusted reports zero remaining lifecycle-script packages, and both binaries print versions.',
468
+ fallback: 'Rerun the full trust command if Bun still reports untrusted package scripts.',
469
+ },
470
+ {
471
+ id: 'start-goodvibes-host',
472
+ label: 'Start or install the host service',
473
+ purpose: 'Bring up the daemon/API host that owns schedules, channels, Knowledge, media, and operator routes.',
474
+ commands: [
475
+ 'goodvibes service status',
476
+ 'goodvibes service install',
477
+ 'goodvibes service start',
478
+ ],
479
+ expected: 'Service status reports an installed running service, or the interactive GoodVibes TUI starts the daemon/listener surfaces configured by the user.',
480
+ fallback: 'For a one-shot headless host from source, use GOODVIBES_DAEMON_TOKEN=... GOODVIBES_HTTP_TOKEN=... bun run daemon inside goodvibes-tui.',
481
+ },
482
+ {
483
+ id: 'reconnect-agent',
484
+ label: 'Reconnect Agent to the host',
485
+ purpose: 'Verify Agent can reach the default host or an explicitly configured runtime URL.',
486
+ commands: [
487
+ 'goodvibes-agent status --json',
488
+ 'goodvibes-agent compat',
489
+ ],
490
+ expected: 'Agent status reports reachable connected-host and compatible Agent Knowledge routes.',
491
+ fallback: 'Use goodvibes-agent --runtime-url http://host:port or GOODVIBES_AGENT_RUNTIME_URL=http://host:port when the host is not on http://127.0.0.1:3421.',
492
+ },
493
+ ],
494
+ reconnectRoutes: {
495
+ agentStatus: 'host action:"status" includeParameters:true',
496
+ serviceDiagnostics: 'host action:"services" includeParameters:true',
497
+ setupItem: 'setup action:"item" setupItemId:"connected-host-readiness"',
498
+ },
499
+ policy: 'Bootstrap commands are user-run setup guidance. Agent does not run host install/start commands implicitly; once the host is reachable, exact service mutations stay on confirmed operator methods.',
500
+ };
501
+ }