@pellux/goodvibes-agent 1.1.7 → 1.3.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 (274) hide show
  1. package/CHANGELOG.md +329 -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 +138903 -91477
  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 +58 -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 +116 -45
  14. package/docs/voice-and-live-tts.md +3 -1
  15. package/package.json +3 -2
  16. package/release/release-notes.md +142 -5
  17. package/release/release-readiness.json +124 -94
  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 +294 -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-artifact-receipts.ts +366 -0
  42. package/src/agent/setup-wizard-checkpoint.ts +140 -0
  43. package/src/agent/setup-wizard.ts +683 -0
  44. package/src/agent/skill-registry-types.ts +102 -0
  45. package/src/agent/skill-registry.ts +81 -107
  46. package/src/agent/vibe-confirmation-routes.ts +62 -0
  47. package/src/agent/vibe-file.ts +285 -0
  48. package/src/cli/agent-knowledge-command.ts +45 -2
  49. package/src/cli/help.ts +3 -0
  50. package/src/cli/profiles-command.ts +25 -11
  51. package/src/config/agent-settings-policy.ts +1 -18
  52. package/src/input/agent-workspace-activation.ts +53 -0
  53. package/src/input/agent-workspace-artifact-browser-editor.ts +494 -0
  54. package/src/input/agent-workspace-artifact-metadata.ts +17 -0
  55. package/src/input/agent-workspace-basic-command-editors.ts +5 -1
  56. package/src/input/agent-workspace-categories.ts +153 -155
  57. package/src/input/agent-workspace-channel-triage.ts +481 -0
  58. package/src/input/agent-workspace-channels.ts +263 -0
  59. package/src/input/agent-workspace-command-editor.ts +152 -0
  60. package/src/input/agent-workspace-context-snapshot.ts +349 -0
  61. package/src/input/agent-workspace-delegation-editor-submission.ts +8 -0
  62. package/src/input/agent-workspace-document-editor.ts +502 -0
  63. package/src/input/agent-workspace-document-ops-editor.ts +523 -0
  64. package/src/input/agent-workspace-host-category.ts +1 -1
  65. package/src/input/agent-workspace-local-library-snapshot.ts +167 -0
  66. package/src/input/agent-workspace-model-compare-editor.ts +376 -0
  67. package/src/input/agent-workspace-model-compare-prompt-submission.ts +552 -0
  68. package/src/input/agent-workspace-model-compare-types.ts +82 -0
  69. package/src/input/agent-workspace-model-compare-utils.ts +35 -0
  70. package/src/input/agent-workspace-onboarding-categories.ts +141 -0
  71. package/src/input/agent-workspace-operations-command-editor-submission.ts +53 -0
  72. package/src/input/agent-workspace-operations-command-editors.ts +22 -0
  73. package/src/input/agent-workspace-research-report-editor.ts +212 -0
  74. package/src/input/agent-workspace-research-run-editor.ts +144 -0
  75. package/src/input/agent-workspace-research-source-editor.ts +167 -0
  76. package/src/input/agent-workspace-review-packet-snapshot.ts +593 -0
  77. package/src/input/agent-workspace-review-packet-utils.ts +265 -0
  78. package/src/input/agent-workspace-settings.ts +313 -30
  79. package/src/input/agent-workspace-setup-checkpoint-action.ts +127 -0
  80. package/src/input/agent-workspace-setup-snapshot.ts +217 -0
  81. package/src/input/agent-workspace-setup.ts +61 -1
  82. package/src/input/agent-workspace-snapshot.ts +184 -149
  83. package/src/input/agent-workspace-types.ts +287 -2
  84. package/src/input/agent-workspace.ts +23 -1
  85. package/src/input/command-registry.ts +9 -2
  86. package/src/input/commands/agent-runtime-profile-runtime.ts +28 -13
  87. package/src/input/commands/channels-runtime.ts +102 -114
  88. package/src/input/commands/delegation-runtime.ts +87 -24
  89. package/src/input/commands/knowledge-browser-flags.ts +12 -0
  90. package/src/input/commands/knowledge.ts +28 -14
  91. package/src/input/commands/operator-actions-runtime.ts +6 -3
  92. package/src/input/commands/schedule-runtime.ts +71 -14
  93. package/src/input/commands/session-content.ts +2 -2
  94. package/src/input/commands/shell-core.ts +2 -0
  95. package/src/input/commands/vibe-runtime.ts +140 -0
  96. package/src/input/commands.ts +2 -0
  97. package/src/input/connected-host-routes.ts +123 -0
  98. package/src/input/settings-modal-types.ts +14 -0
  99. package/src/input/setup-wizard-live-receipts.ts +76 -0
  100. package/src/main.ts +15 -15
  101. package/src/panels/qr-panel.ts +2 -2
  102. package/src/renderer/agent-workspace-context-lines.ts +701 -0
  103. package/src/renderer/agent-workspace.ts +68 -421
  104. package/src/renderer/settings-modal-helpers.ts +12 -0
  105. package/src/renderer/settings-modal.ts +12 -0
  106. package/src/runtime/bootstrap-command-context.ts +11 -1
  107. package/src/runtime/bootstrap-command-parts.ts +14 -3
  108. package/src/runtime/bootstrap-core.ts +39 -1
  109. package/src/runtime/bootstrap-shell.ts +6 -0
  110. package/src/runtime/bootstrap.ts +113 -30
  111. package/src/runtime/connected-host-auth.ts +3 -2
  112. package/src/runtime/execution-ledger.ts +231 -0
  113. package/src/runtime/services.ts +88 -10
  114. package/src/runtime/tool-permission-safety.ts +199 -5
  115. package/src/shell/session-continuity-hints.ts +39 -0
  116. package/src/tools/agent-artifacts-tool.ts +606 -0
  117. package/src/tools/agent-audit-tool.ts +155 -0
  118. package/src/tools/agent-autonomy-schedule-tool.ts +238 -0
  119. package/src/tools/agent-autonomy-tool.ts +140 -0
  120. package/src/tools/agent-channel-send-tool.ts +24 -2
  121. package/src/tools/agent-channels-tool.ts +140 -0
  122. package/src/tools/agent-computer-tool.ts +168 -0
  123. package/src/tools/agent-context-policy.ts +137 -7
  124. package/src/tools/agent-context-tool.ts +143 -0
  125. package/src/tools/agent-delegation-tool.ts +128 -0
  126. package/src/tools/agent-device-tool.ts +240 -0
  127. package/src/tools/agent-documents-tool.ts +684 -0
  128. package/src/tools/agent-execution-tool.ts +230 -0
  129. package/src/tools/agent-harness-agent-orchestration-policy.ts +75 -0
  130. package/src/tools/agent-harness-agent-orchestration.ts +791 -0
  131. package/src/tools/agent-harness-autonomy-intake.ts +785 -0
  132. package/src/tools/agent-harness-autonomy-live-records.ts +742 -0
  133. package/src/tools/agent-harness-autonomy-queue-types.ts +88 -0
  134. package/src/tools/agent-harness-autonomy-queue.ts +571 -0
  135. package/src/tools/agent-harness-autonomy-watcher-read-models.ts +509 -0
  136. package/src/tools/agent-harness-background-processes-types.ts +35 -0
  137. package/src/tools/agent-harness-background-processes.ts +798 -0
  138. package/src/tools/agent-harness-browser-cockpit-route.ts +373 -0
  139. package/src/tools/agent-harness-browser-control.ts +346 -0
  140. package/src/tools/agent-harness-browser-pwa-read-models.ts +622 -0
  141. package/src/tools/agent-harness-channel-metadata.ts +168 -10
  142. package/src/tools/agent-harness-cli-command-policy.ts +110 -0
  143. package/src/tools/agent-harness-command-catalog.ts +4 -2
  144. package/src/tools/agent-harness-command-runner.ts +42 -0
  145. package/src/tools/agent-harness-connected-host-status.ts +7 -4
  146. package/src/tools/agent-harness-delegation-posture.ts +234 -19
  147. package/src/tools/agent-harness-device-live-read-models.ts +366 -0
  148. package/src/tools/agent-harness-document-ops-reviewer-readiness.ts +234 -0
  149. package/src/tools/agent-harness-document-ops-types.ts +72 -0
  150. package/src/tools/agent-harness-document-ops.ts +671 -0
  151. package/src/tools/agent-harness-execution-history.ts +489 -0
  152. package/src/tools/agent-harness-execution-posture.ts +385 -0
  153. package/src/tools/agent-harness-file-recovery.ts +135 -0
  154. package/src/tools/agent-harness-interactive-runtime-records.ts +421 -0
  155. package/src/tools/agent-harness-keybinding-metadata.ts +16 -12
  156. package/src/tools/agent-harness-learning-curator-common.ts +102 -0
  157. package/src/tools/agent-harness-learning-curator-consolidation.ts +295 -0
  158. package/src/tools/agent-harness-learning-curator-proposals.ts +606 -0
  159. package/src/tools/agent-harness-learning-curator-types.ts +151 -0
  160. package/src/tools/agent-harness-learning-curator.ts +417 -0
  161. package/src/tools/agent-harness-local-model-benchmarks.ts +269 -0
  162. package/src/tools/agent-harness-local-model-cookbook.ts +238 -0
  163. package/src/tools/agent-harness-local-model-endpoints.ts +788 -0
  164. package/src/tools/agent-harness-local-model-smoke.ts +277 -0
  165. package/src/tools/agent-harness-local-model-url.ts +78 -0
  166. package/src/tools/agent-harness-media-posture.ts +223 -2
  167. package/src/tools/agent-harness-memory-external-providers.ts +796 -0
  168. package/src/tools/agent-harness-memory-posture.ts +672 -0
  169. package/src/tools/agent-harness-memory-provider-certification.ts +219 -0
  170. package/src/tools/agent-harness-memory-refinement.ts +340 -0
  171. package/src/tools/agent-harness-metadata.ts +100 -168
  172. package/src/tools/agent-harness-mode-catalog.ts +86 -33
  173. package/src/tools/agent-harness-model-catalog.ts +162 -0
  174. package/src/tools/agent-harness-model-provider-health.ts +283 -0
  175. package/src/tools/agent-harness-model-readiness.ts +432 -0
  176. package/src/tools/agent-harness-model-routing-types.ts +327 -0
  177. package/src/tools/agent-harness-model-routing-utils.ts +30 -0
  178. package/src/tools/agent-harness-model-routing.ts +165 -193
  179. package/src/tools/agent-harness-operator-methods.ts +115 -133
  180. package/src/tools/agent-harness-pairing-posture.ts +452 -18
  181. package/src/tools/agent-harness-personal-ops-certification.ts +116 -0
  182. package/src/tools/agent-harness-personal-ops-discovery.ts +533 -0
  183. package/src/tools/agent-harness-personal-ops-intake.ts +385 -0
  184. package/src/tools/agent-harness-personal-ops-lanes.ts +270 -0
  185. package/src/tools/agent-harness-personal-ops-operations.ts +225 -0
  186. package/src/tools/agent-harness-personal-ops-provider-records.ts +358 -0
  187. package/src/tools/agent-harness-personal-ops-provider-task-records.ts +321 -0
  188. package/src/tools/agent-harness-personal-ops-records.ts +684 -0
  189. package/src/tools/agent-harness-personal-ops-runner.ts +637 -0
  190. package/src/tools/agent-harness-personal-ops-types.ts +240 -0
  191. package/src/tools/agent-harness-personal-ops.ts +613 -0
  192. package/src/tools/agent-harness-project-context.ts +144 -0
  193. package/src/tools/agent-harness-prompt-context.ts +589 -0
  194. package/src/tools/agent-harness-provider-account-metadata.ts +2 -2
  195. package/src/tools/agent-harness-release-evidence.ts +9 -7
  196. package/src/tools/agent-harness-release-readiness.ts +9 -7
  197. package/src/tools/agent-harness-remote-read-models.ts +541 -0
  198. package/src/tools/agent-harness-research-briefing.ts +446 -0
  199. package/src/tools/agent-harness-research-live-read-models.ts +500 -0
  200. package/src/tools/agent-harness-research-queue.ts +250 -0
  201. package/src/tools/agent-harness-research-runs.ts +307 -0
  202. package/src/tools/agent-harness-research-workflow.ts +395 -0
  203. package/src/tools/agent-harness-security-posture.ts +2 -2
  204. package/src/tools/agent-harness-service-posture.ts +9 -9
  205. package/src/tools/agent-harness-session-metadata.ts +3 -3
  206. package/src/tools/agent-harness-setup-connected-host.ts +501 -0
  207. package/src/tools/agent-harness-setup-describe.ts +557 -0
  208. package/src/tools/agent-harness-setup-handoffs.ts +502 -0
  209. package/src/tools/agent-harness-setup-model-helpers.ts +102 -0
  210. package/src/tools/agent-harness-setup-plan.ts +253 -0
  211. package/src/tools/agent-harness-setup-posture-types.ts +218 -0
  212. package/src/tools/agent-harness-setup-posture-utils.ts +173 -0
  213. package/src/tools/agent-harness-setup-posture.ts +449 -221
  214. package/src/tools/agent-harness-setup-smoke.ts +533 -0
  215. package/src/tools/agent-harness-sudo-posture.ts +114 -0
  216. package/src/tools/agent-harness-tool-schema.ts +142 -7
  217. package/src/tools/agent-harness-tool-types.ts +83 -0
  218. package/src/tools/agent-harness-tool-utils.ts +43 -0
  219. package/src/tools/agent-harness-tool.ts +319 -370
  220. package/src/tools/agent-harness-ui-surface-metadata.ts +76 -69
  221. package/src/tools/agent-harness-ui-surface-types.ts +46 -0
  222. package/src/tools/agent-harness-vibe-health.ts +105 -0
  223. package/src/tools/agent-harness-workspace-action-runner.ts +149 -0
  224. package/src/tools/agent-harness-workspace-actions.ts +114 -8
  225. package/src/tools/agent-harness-workspace-editor-execution.ts +214 -0
  226. package/src/tools/agent-harness-workspace-editor-runner.ts +755 -0
  227. package/src/tools/agent-host-tool.ts +159 -0
  228. package/src/tools/agent-knowledge-ingest-tool.ts +34 -1
  229. package/src/tools/agent-learning-consolidation-core.ts +327 -0
  230. package/src/tools/agent-learning-consolidation-tool.ts +758 -0
  231. package/src/tools/agent-memory-tool.ts +253 -0
  232. package/src/tools/agent-model-compare-export.ts +315 -0
  233. package/src/tools/agent-model-compare-handoff.ts +592 -0
  234. package/src/tools/agent-model-compare-judgment.ts +633 -0
  235. package/src/tools/agent-model-compare-run.ts +735 -0
  236. package/src/tools/agent-model-compare-tool.ts +698 -0
  237. package/src/tools/agent-model-compare-types.ts +191 -0
  238. package/src/tools/agent-model-compare-utils.ts +93 -0
  239. package/src/tools/agent-models-tool.ts +208 -0
  240. package/src/tools/agent-operator-action-tool.ts +1 -1
  241. package/src/tools/agent-operator-method-tool.ts +643 -0
  242. package/src/tools/agent-personal-ops-tool.ts +197 -0
  243. package/src/tools/agent-policy-explanation.ts +415 -0
  244. package/src/tools/agent-research-report-tool.ts +608 -0
  245. package/src/tools/agent-research-runner.ts +367 -0
  246. package/src/tools/agent-research-runs-tool.ts +434 -0
  247. package/src/tools/agent-research-sources-tool.ts +443 -0
  248. package/src/tools/agent-research-tool.ts +515 -0
  249. package/src/tools/agent-review-packet-presets-core.ts +757 -0
  250. package/src/tools/agent-review-packet-presets-tool.ts +466 -0
  251. package/src/tools/agent-review-packet-share-tool.ts +305 -0
  252. package/src/tools/agent-route-planner-candidates-setup.ts +411 -0
  253. package/src/tools/agent-route-planner-candidates-surfaces.ts +432 -0
  254. package/src/tools/agent-route-planner-candidates-work.ts +251 -0
  255. package/src/tools/agent-route-planner-helpers.ts +667 -0
  256. package/src/tools/agent-route-planner.ts +185 -0
  257. package/src/tools/agent-route-tool.ts +105 -0
  258. package/src/tools/agent-schedule-edit-tool.ts +210 -0
  259. package/src/tools/agent-schedule-tool.ts +282 -0
  260. package/src/tools/agent-security-tool.ts +145 -0
  261. package/src/tools/agent-sessions-tool.ts +122 -0
  262. package/src/tools/agent-settings-import-tool.ts +104 -0
  263. package/src/tools/agent-settings-tool.ts +176 -0
  264. package/src/tools/agent-setup-tool.ts +226 -0
  265. package/src/tools/agent-support-tool.ts +122 -0
  266. package/src/tools/agent-terminal-process-tools.ts +167 -0
  267. package/src/tools/agent-tool-policy-guard-types.ts +77 -0
  268. package/src/tools/agent-tool-policy-guard.ts +106 -85
  269. package/src/tools/agent-vibe-tool.ts +297 -0
  270. package/src/tools/agent-work-plan-tool.ts +265 -6
  271. package/src/tools/agent-workspace-tool.ts +305 -0
  272. package/src/tools/artifact-archive.ts +169 -0
  273. package/src/tools/tool-definition-compaction.ts +36 -0
  274. package/src/version.ts +1 -1
@@ -0,0 +1,515 @@
1
+ import type { Tool } from '@pellux/goodvibes-sdk/platform/types';
2
+ import type { ToolRegistry } from '@pellux/goodvibes-sdk/platform/tools';
3
+ import type { CommandContext, CommandRegistry } from '../input/command-registry.ts';
4
+ import { createAgentArtifactsTool } from './agent-artifacts-tool.ts';
5
+ import { createAgentHarnessTool } from './agent-harness-tool.ts';
6
+ import { createAgentResearchReportTool } from './agent-research-report-tool.ts';
7
+ import { createAgentResearchRunsTool } from './agent-research-runs-tool.ts';
8
+ import { runConfirmedResearchRunner, runPublicSearch } from './agent-research-runner.ts';
9
+ import { createAgentResearchSourcesTool } from './agent-research-sources-tool.ts';
10
+
11
+ type AgentResearchAction =
12
+ | 'briefing'
13
+ | 'plan'
14
+ | 'runner'
15
+ | 'runs'
16
+ | 'run'
17
+ | 'sources'
18
+ | 'source'
19
+ | 'bundle'
20
+ | 'search'
21
+ | 'reports'
22
+ | 'report_artifact'
23
+ | 'create_run'
24
+ | 'start_run'
25
+ | 'checkpoint'
26
+ | 'pause'
27
+ | 'resume'
28
+ | 'cancel'
29
+ | 'complete'
30
+ | 'fail'
31
+ | 'delete_run'
32
+ | 'add_source'
33
+ | 'review_source'
34
+ | 'reject_source'
35
+ | 'use_source'
36
+ | 'delete_source'
37
+ | 'report';
38
+
39
+ export interface AgentResearchToolArgs {
40
+ readonly action?: unknown;
41
+ readonly mode?: unknown;
42
+ readonly id?: unknown;
43
+ readonly runId?: unknown;
44
+ readonly sourceId?: unknown;
45
+ readonly artifactId?: unknown;
46
+ readonly query?: unknown;
47
+ readonly target?: unknown;
48
+ readonly providerId?: unknown;
49
+ readonly maxResults?: unknown;
50
+ readonly region?: unknown;
51
+ readonly safeSearch?: unknown;
52
+ readonly timeRange?: unknown;
53
+ readonly evidenceTopN?: unknown;
54
+ readonly evidenceExtract?: unknown;
55
+ readonly title?: unknown;
56
+ readonly question?: unknown;
57
+ readonly goal?: unknown;
58
+ readonly plan?: unknown;
59
+ readonly nextSteps?: unknown;
60
+ readonly sourceIds?: unknown;
61
+ readonly status?: unknown;
62
+ readonly phase?: unknown;
63
+ readonly progress?: unknown;
64
+ readonly url?: unknown;
65
+ readonly publisher?: unknown;
66
+ readonly publishedAt?: unknown;
67
+ readonly accessedAt?: unknown;
68
+ readonly summary?: unknown;
69
+ readonly evidence?: unknown;
70
+ readonly credibility?: unknown;
71
+ readonly score?: unknown;
72
+ readonly tags?: unknown;
73
+ readonly note?: unknown;
74
+ readonly reportArtifactId?: unknown;
75
+ readonly error?: unknown;
76
+ readonly reportMarkdown?: unknown;
77
+ readonly sources?: unknown;
78
+ readonly findings?: unknown;
79
+ readonly gaps?: unknown;
80
+ readonly recommendations?: unknown;
81
+ readonly methodology?: unknown;
82
+ readonly confidence?: unknown;
83
+ readonly requireCitationCoverage?: unknown;
84
+ readonly visualReport?: unknown;
85
+ readonly includeReportLines?: unknown;
86
+ readonly includeParameters?: unknown;
87
+ readonly includeContent?: unknown;
88
+ readonly previewBytes?: unknown;
89
+ readonly limit?: unknown;
90
+ readonly confirm?: unknown;
91
+ readonly explicitUserRequest?: unknown;
92
+ }
93
+
94
+ interface AgentResearchToolDeps {
95
+ readonly commandRegistry: CommandRegistry;
96
+ readonly commandContext: CommandContext;
97
+ readonly toolRegistry: ToolRegistry;
98
+ readonly harnessTool?: Tool;
99
+ readonly runsTool?: Tool;
100
+ readonly sourcesTool?: Tool;
101
+ readonly reportTool?: Tool;
102
+ readonly artifactTool?: Tool;
103
+ readonly webSearchTool?: Tool;
104
+ }
105
+
106
+ function error(message: string): { readonly success: false; readonly error: string } {
107
+ return { success: false, error: message };
108
+ }
109
+
110
+ function readString(value: unknown): string {
111
+ return typeof value === 'string' ? value.trim() : '';
112
+ }
113
+
114
+ function normalizeResearchAction(value: unknown): AgentResearchAction | null {
115
+ const action = readString(value).toLowerCase().replace(/-/g, '_');
116
+ if (!action) return null;
117
+ if (action === 'briefing' || action === 'brief' || action === 'status' || action === 'dashboard' || action === 'cockpit' || action === 'next') return 'briefing';
118
+ if (action === 'plan' || action === 'workflow' || action === 'research') return 'plan';
119
+ if (action === 'runner' || action === 'browser' || action === 'browser_runner' || action === 'browser_backed' || action === 'deep_research') return 'runner';
120
+ if (action === 'runs' || action === 'list_runs' || action === 'run_list') return 'runs';
121
+ if (action === 'run' || action === 'show_run' || action === 'inspect_run') return 'run';
122
+ if (action === 'sources' || action === 'queue' || action === 'source_queue') return 'sources';
123
+ if (action === 'source' || action === 'show_source' || action === 'inspect_source') return 'source';
124
+ if (action === 'bundle' || action === 'bundle_sources' || action === 'source_bundle') return 'bundle';
125
+ if (action === 'search' || action === 'public_search' || action === 'collect' || action === 'collect_sources' || action === 'source_candidates') return 'search';
126
+ if (action === 'reports' || action === 'list_reports' || action === 'report_list' || action === 'visual_reports') return 'reports';
127
+ if (action === 'report_artifact' || action === 'show_report' || action === 'inspect_report' || action === 'show_visual_report' || action === 'visual_report_artifact') return 'report_artifact';
128
+ if (action === 'create_run' || action === 'new_run') return 'create_run';
129
+ if (action === 'start' || action === 'start_run' || action === 'begin_run' || action === 'run_start') return 'start_run';
130
+ if (action === 'checkpoint' || action === 'checkpoint_run') return 'checkpoint';
131
+ if (action === 'pause' || action === 'pause_run') return 'pause';
132
+ if (action === 'resume' || action === 'resume_run') return 'resume';
133
+ if (action === 'cancel' || action === 'cancel_run') return 'cancel';
134
+ if (action === 'complete' || action === 'complete_run') return 'complete';
135
+ if (action === 'fail' || action === 'fail_run') return 'fail';
136
+ if (action === 'delete_run' || action === 'remove_run') return 'delete_run';
137
+ if (action === 'add_source' || action === 'capture_source' || action === 'new_source') return 'add_source';
138
+ if (action === 'review_source' || action === 'score_source') return 'review_source';
139
+ if (action === 'reject_source' || action === 'reject') return 'reject_source';
140
+ if (action === 'use_source' || action === 'mark_source_used' || action === 'mark_used') return 'use_source';
141
+ if (action === 'delete_source' || action === 'remove_source') return 'delete_source';
142
+ if (action === 'report' || action === 'save_report' || action === 'visual_report') return 'report';
143
+ return null;
144
+ }
145
+
146
+ function readAction(args: AgentResearchToolArgs): AgentResearchAction {
147
+ const explicit = normalizeResearchAction(args.action) ?? normalizeResearchAction(args.mode);
148
+ if (explicit) return explicit;
149
+ if (readString(args.sourceId)) return 'source';
150
+ if (readString(args.runId)) return 'run';
151
+ if (readString(args.query) || readString(args.target)) return 'plan';
152
+ return 'plan';
153
+ }
154
+
155
+ function compactArgs(entries: Record<string, unknown>): Record<string, unknown> {
156
+ return Object.fromEntries(Object.entries(entries).filter(([, value]) => value !== undefined && value !== ''));
157
+ }
158
+
159
+ function lookupId(args: AgentResearchToolArgs): string {
160
+ return readString(args.id) || readString(args.runId) || readString(args.sourceId) || readString(args.artifactId) || readString(args.reportArtifactId);
161
+ }
162
+
163
+ function planArgs(args: AgentResearchToolArgs): Record<string, unknown> {
164
+ return compactArgs({
165
+ mode: 'research_workflow',
166
+ query: args.query,
167
+ target: args.target,
168
+ runId: args.runId || args.id,
169
+ includeParameters: args.includeParameters,
170
+ });
171
+ }
172
+
173
+ function briefingArgs(args: AgentResearchToolArgs): Record<string, unknown> {
174
+ return compactArgs({
175
+ mode: 'research_briefing',
176
+ query: args.query,
177
+ target: args.target,
178
+ limit: args.limit,
179
+ includeParameters: args.includeParameters,
180
+ });
181
+ }
182
+
183
+ function runsArgs(args: AgentResearchToolArgs): Record<string, unknown> {
184
+ return compactArgs({
185
+ mode: 'research_runs',
186
+ query: args.query,
187
+ limit: args.limit,
188
+ includeParameters: args.includeParameters,
189
+ });
190
+ }
191
+
192
+ function runnerArgs(args: AgentResearchToolArgs): Record<string, unknown> {
193
+ return compactArgs({
194
+ mode: 'research_workflow',
195
+ query: args.query ?? args.target ?? 'browser-backed research runner',
196
+ runId: args.runId || args.id,
197
+ includeParameters: args.includeParameters ?? true,
198
+ });
199
+ }
200
+
201
+ function runArgs(args: AgentResearchToolArgs): Record<string, unknown> {
202
+ return compactArgs({
203
+ mode: 'research_run',
204
+ runId: lookupId(args),
205
+ target: lookupId(args) ? undefined : args.target,
206
+ query: lookupId(args) ? undefined : args.query,
207
+ includeParameters: args.includeParameters,
208
+ });
209
+ }
210
+
211
+ function sourcesArgs(args: AgentResearchToolArgs): Record<string, unknown> {
212
+ return compactArgs({
213
+ mode: 'research_queue',
214
+ query: args.query,
215
+ limit: args.limit,
216
+ includeParameters: args.includeParameters,
217
+ });
218
+ }
219
+
220
+ function sourceArgs(args: AgentResearchToolArgs): Record<string, unknown> {
221
+ return compactArgs({
222
+ mode: 'research_source',
223
+ sourceId: lookupId(args),
224
+ target: lookupId(args) ? undefined : args.target,
225
+ query: lookupId(args) ? undefined : args.query,
226
+ includeParameters: args.includeParameters,
227
+ });
228
+ }
229
+
230
+ function confirmedArgs(args: AgentResearchToolArgs): Record<string, unknown> {
231
+ return compactArgs({
232
+ confirm: args.confirm,
233
+ explicitUserRequest: args.explicitUserRequest,
234
+ });
235
+ }
236
+
237
+ function createRunArgs(args: AgentResearchToolArgs): Record<string, unknown> {
238
+ return compactArgs({
239
+ mode: 'create',
240
+ title: args.title,
241
+ question: args.question ?? args.query,
242
+ goal: args.goal,
243
+ plan: args.plan,
244
+ nextSteps: args.nextSteps,
245
+ sourceIds: args.sourceIds,
246
+ note: args.note,
247
+ ...confirmedArgs(args),
248
+ });
249
+ }
250
+
251
+ function runMutationArgs(args: AgentResearchToolArgs, mode: string): Record<string, unknown> {
252
+ return compactArgs({
253
+ mode,
254
+ id: lookupId(args),
255
+ status: args.status,
256
+ phase: args.phase,
257
+ progress: args.progress,
258
+ note: args.note,
259
+ nextSteps: args.nextSteps,
260
+ sourceIds: args.sourceIds,
261
+ reportArtifactId: args.reportArtifactId,
262
+ error: args.error,
263
+ ...confirmedArgs(args),
264
+ });
265
+ }
266
+
267
+ function bundleArgs(args: AgentResearchToolArgs): Record<string, unknown> {
268
+ return compactArgs({
269
+ mode: 'bundle',
270
+ query: args.query ?? args.target,
271
+ limit: args.limit,
272
+ includeReportLines: args.includeReportLines ?? true,
273
+ });
274
+ }
275
+
276
+ function reportsArgs(args: AgentResearchToolArgs): Record<string, unknown> {
277
+ return compactArgs({
278
+ mode: 'list',
279
+ purpose: 'agent-research-report',
280
+ query: args.query ?? args.target,
281
+ limit: args.limit,
282
+ });
283
+ }
284
+
285
+ function reportArtifactArgs(args: AgentResearchToolArgs): Record<string, unknown> {
286
+ return compactArgs({
287
+ mode: 'show',
288
+ artifactId: lookupId(args),
289
+ includeContent: args.includeContent ?? true,
290
+ previewBytes: args.previewBytes,
291
+ });
292
+ }
293
+
294
+ function addSourceArgs(args: AgentResearchToolArgs): Record<string, unknown> {
295
+ return compactArgs({
296
+ mode: 'add',
297
+ question: args.question ?? args.query,
298
+ title: args.title,
299
+ url: args.url,
300
+ publisher: args.publisher,
301
+ publishedAt: args.publishedAt,
302
+ accessedAt: args.accessedAt,
303
+ summary: args.summary,
304
+ evidence: args.evidence,
305
+ credibility: args.credibility,
306
+ score: args.score,
307
+ tags: args.tags,
308
+ note: args.note,
309
+ ...confirmedArgs(args),
310
+ });
311
+ }
312
+
313
+ function reviewSourceArgs(args: AgentResearchToolArgs): Record<string, unknown> {
314
+ return compactArgs({
315
+ mode: 'review',
316
+ id: lookupId(args),
317
+ credibility: args.credibility,
318
+ score: args.score,
319
+ note: args.note,
320
+ summary: args.summary,
321
+ evidence: args.evidence,
322
+ tags: args.tags,
323
+ ...confirmedArgs(args),
324
+ });
325
+ }
326
+
327
+ function sourceMutationArgs(args: AgentResearchToolArgs, mode: string): Record<string, unknown> {
328
+ return compactArgs({
329
+ mode,
330
+ id: lookupId(args),
331
+ note: args.note,
332
+ reportArtifactId: args.reportArtifactId,
333
+ ...confirmedArgs(args),
334
+ });
335
+ }
336
+
337
+ function reportArgs(args: AgentResearchToolArgs): Record<string, unknown> {
338
+ return compactArgs({
339
+ runId: args.runId ?? args.id,
340
+ title: args.title,
341
+ question: args.question ?? args.query,
342
+ summary: args.summary,
343
+ reportMarkdown: args.reportMarkdown,
344
+ sources: args.sources,
345
+ findings: args.findings,
346
+ gaps: args.gaps,
347
+ recommendations: args.recommendations,
348
+ methodology: args.methodology,
349
+ confidence: args.confidence,
350
+ requireCitationCoverage: args.requireCitationCoverage,
351
+ visualReport: args.visualReport,
352
+ tags: args.tags,
353
+ ...confirmedArgs(args),
354
+ });
355
+ }
356
+
357
+ export function createAgentResearchTool(deps: AgentResearchToolDeps): Tool {
358
+ const shellPaths = deps.commandContext.workspace?.shellPaths;
359
+ const harnessTool = deps.harnessTool ?? createAgentHarnessTool({
360
+ commandRegistry: deps.commandRegistry,
361
+ commandContext: deps.commandContext,
362
+ toolRegistry: deps.toolRegistry,
363
+ });
364
+ const runsTool = deps.runsTool ?? createAgentResearchRunsTool(shellPaths);
365
+ const sourcesTool = deps.sourcesTool ?? createAgentResearchSourcesTool(shellPaths);
366
+ const reportTool = deps.reportTool ?? createAgentResearchReportTool(deps.commandContext.platform?.artifactStore);
367
+ const artifactTool = deps.artifactTool
368
+ ?? deps.toolRegistry.list().find((entry) => entry.definition.name === 'agent_artifacts')
369
+ ?? createAgentArtifactsTool(deps.commandContext.platform?.artifactStore);
370
+ const webSearchTool = deps.webSearchTool
371
+ ?? deps.toolRegistry.list().find((entry) => entry.definition.name === 'web_search');
372
+
373
+ return {
374
+ definition: {
375
+ name: 'research',
376
+ description: 'Plan, track, source, and save research.',
377
+ parameters: {
378
+ type: 'object',
379
+ properties: {
380
+ action: {
381
+ type: 'string',
382
+ enum: [
383
+ 'briefing',
384
+ 'plan',
385
+ 'runner',
386
+ 'runs',
387
+ 'run',
388
+ 'sources',
389
+ 'source',
390
+ 'bundle',
391
+ 'search',
392
+ 'reports',
393
+ 'report_artifact',
394
+ 'create_run',
395
+ 'start_run',
396
+ 'checkpoint',
397
+ 'pause',
398
+ 'resume',
399
+ 'cancel',
400
+ 'complete',
401
+ 'fail',
402
+ 'delete_run',
403
+ 'add_source',
404
+ 'review_source',
405
+ 'reject_source',
406
+ 'use_source',
407
+ 'delete_source',
408
+ 'report',
409
+ ],
410
+ description: 'Read plans/queues; confirm writes.',
411
+ },
412
+ mode: { type: 'string', description: 'Alias for action.' },
413
+ id: { type: 'string', description: 'Run or source id alias.' },
414
+ runId: { type: 'string', description: 'Research run id.' },
415
+ sourceId: { type: 'string', description: 'Research source id.' },
416
+ artifactId: { type: 'string', description: 'Research report artifact id.' },
417
+ query: { type: 'string', description: 'Research request or queue search.' },
418
+ target: { type: 'string', description: 'Lookup target alias.' },
419
+ providerId: { type: 'string', description: 'Optional web_search provider id for action:"search".' },
420
+ maxResults: { type: 'number', maximum: 10, description: 'Maximum public search results for action:"search".' },
421
+ region: { type: 'string', description: 'Provider-specific region for action:"search".' },
422
+ safeSearch: { type: 'string', enum: ['strict', 'moderate'], description: 'Safe-search setting for action:"search".' },
423
+ timeRange: { type: 'string', enum: ['any', 'day', 'week', 'month', 'year'], description: 'Optional search time range.' },
424
+ evidenceTopN: { type: 'number', maximum: 3, description: 'Maximum evidence fetches for action:"search".' },
425
+ evidenceExtract: { type: 'string', enum: ['text', 'markdown', 'readable', 'code_blocks', 'links', 'metadata', 'tables'], description: 'Bounded evidence extraction mode.' },
426
+ title: { type: 'string', description: 'Run, source, or report title.' },
427
+ question: { type: 'string', description: 'Research question.' },
428
+ goal: { type: 'string', description: 'Visible outcome for a new run.' },
429
+ plan: { type: 'array', items: { type: 'string' }, description: 'Run plan steps.' },
430
+ nextSteps: { type: 'array', items: { type: 'string' }, description: 'Next visible run steps.' },
431
+ sourceIds: { type: 'array', items: { type: 'string' }, description: 'Run source ids.' },
432
+ status: { type: 'string', description: 'Mutable run status.' },
433
+ phase: { type: 'string', description: 'Research run phase.' },
434
+ progress: { type: 'number', description: '0-100 run progress.' },
435
+ url: { type: 'string', description: 'Source URL.' },
436
+ publisher: { type: 'string', description: 'Source publisher.' },
437
+ publishedAt: { type: 'string', description: 'Source published date.' },
438
+ accessedAt: { type: 'string', description: 'Source access date.' },
439
+ summary: { type: 'string', description: 'Summary for source or report.' },
440
+ evidence: { type: 'string', description: 'Source evidence notes.' },
441
+ credibility: { type: 'string', enum: ['unreviewed', 'low', 'medium', 'high', 'mixed'], description: 'Source credibility.' },
442
+ score: { type: 'number', description: '0-100 source score.' },
443
+ tags: { type: 'array', items: { type: 'string' }, description: 'Optional tags.' },
444
+ note: { type: 'string', description: 'Run or source note.' },
445
+ reportArtifactId: { type: 'string', description: 'Saved report artifact id.' },
446
+ error: { type: 'string', description: 'Run failure detail.' },
447
+ reportMarkdown: { type: 'string', description: 'Full report markdown.' },
448
+ sources: { type: 'array', items: { type: 'object' }, description: 'Reviewed report sources.' },
449
+ findings: { type: 'array', items: { type: 'string' }, description: 'Key findings.' },
450
+ gaps: { type: 'array', items: { type: 'string' }, description: 'Open caveats.' },
451
+ recommendations: { type: 'array', items: { type: 'string' }, description: 'Recommended actions.' },
452
+ methodology: { type: 'string', description: 'Source selection method.' },
453
+ confidence: { type: 'string', description: 'Overall confidence label.' },
454
+ requireCitationCoverage: { type: 'boolean', description: 'Require cited sources.' },
455
+ visualReport: { type: 'boolean', description: 'Append visual packet sections.' },
456
+ includeReportLines: { type: 'boolean', description: 'Include report source lines.' },
457
+ includeParameters: { type: 'boolean', description: 'Include bounded route details.' },
458
+ includeContent: { type: 'boolean', description: 'Preview saved report artifact content.' },
459
+ previewBytes: { type: 'number', description: 'Maximum saved report preview bytes.' },
460
+ limit: { type: 'number', description: 'Maximum rows.' },
461
+ confirm: { type: 'boolean', description: 'Required true for writes.' },
462
+ explicitUserRequest: { type: 'string', description: 'User request authorizing writes.' },
463
+ },
464
+ additionalProperties: false,
465
+ },
466
+ sideEffects: ['state'],
467
+ concurrency: 'serial',
468
+ },
469
+ execute: async (rawArgs: unknown) => {
470
+ const args = (rawArgs && typeof rawArgs === 'object' && !Array.isArray(rawArgs) ? rawArgs : {}) as AgentResearchToolArgs;
471
+ const action = readAction(args);
472
+
473
+ if (action === 'briefing') return harnessTool.execute(briefingArgs(args));
474
+ if (action === 'plan') return harnessTool.execute(planArgs(args));
475
+ if (action === 'runner') {
476
+ return args.confirm === true
477
+ ? runConfirmedResearchRunner(webSearchTool, args, shellPaths)
478
+ : harnessTool.execute(runnerArgs(args));
479
+ }
480
+ if (action === 'runs') return harnessTool.execute(runsArgs(args));
481
+ if (action === 'run') return harnessTool.execute(runArgs(args));
482
+ if (action === 'sources') return harnessTool.execute(sourcesArgs(args));
483
+ if (action === 'source') return harnessTool.execute(sourceArgs(args));
484
+ if (action === 'bundle') return sourcesTool.execute(bundleArgs(args));
485
+ if (action === 'search') return runPublicSearch(webSearchTool, args, shellPaths);
486
+ if (action === 'reports') return artifactTool.execute(reportsArgs(args));
487
+ if (action === 'report_artifact') return artifactTool.execute(reportArtifactArgs(args));
488
+ if (action === 'create_run') return runsTool.execute(createRunArgs(args));
489
+ if (action === 'start_run') return runsTool.execute(runMutationArgs(args, 'start'));
490
+ if (action === 'checkpoint') return runsTool.execute(runMutationArgs(args, 'checkpoint'));
491
+ if (action === 'pause') return runsTool.execute(runMutationArgs(args, 'pause'));
492
+ if (action === 'resume') return runsTool.execute(runMutationArgs(args, 'resume'));
493
+ if (action === 'cancel') return runsTool.execute(runMutationArgs(args, 'cancel'));
494
+ if (action === 'complete') return runsTool.execute(runMutationArgs(args, 'complete'));
495
+ if (action === 'fail') return runsTool.execute(runMutationArgs(args, 'fail'));
496
+ if (action === 'delete_run') return runsTool.execute(runMutationArgs(args, 'delete'));
497
+ if (action === 'add_source') return sourcesTool.execute(addSourceArgs(args));
498
+ if (action === 'review_source') return sourcesTool.execute(reviewSourceArgs(args));
499
+ if (action === 'reject_source') return sourcesTool.execute(sourceMutationArgs(args, 'reject'));
500
+ if (action === 'use_source') return sourcesTool.execute(sourceMutationArgs(args, 'use'));
501
+ if (action === 'delete_source') return sourcesTool.execute(sourceMutationArgs(args, 'delete'));
502
+ if (action === 'report') return reportTool.execute(reportArgs(args));
503
+
504
+ return error('Unknown research action. Use action:"plan" for research routing.');
505
+ },
506
+ };
507
+ }
508
+
509
+ export function registerAgentResearchTool(
510
+ registry: ToolRegistry,
511
+ commandRegistry: CommandRegistry,
512
+ commandContext: CommandContext,
513
+ ): void {
514
+ if (!registry.has('research')) registry.register(createAgentResearchTool({ commandRegistry, commandContext, toolRegistry: registry }));
515
+ }