@phuetz/code-buddy 2.0.0 → 2.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 (421) hide show
  1. package/README.fr.md +56 -0
  2. package/README.md +74 -16
  3. package/codebuddy-runtime.json +5 -5
  4. package/dist/agent/codebuddy-agent.d.ts +18 -0
  5. package/dist/agent/codebuddy-agent.js +45 -8
  6. package/dist/agent/execution/agent-executor.d.ts +0 -9
  7. package/dist/agent/execution/agent-executor.js +176 -12
  8. package/dist/agent/execution/context-pipeline.d.ts +9 -0
  9. package/dist/agent/execution/context-pipeline.js +64 -2
  10. package/dist/agent/execution/tool-loop-guard.d.ts +76 -0
  11. package/dist/agent/execution/tool-loop-guard.js +165 -0
  12. package/dist/agent/execution/tool-selection-strategy.d.ts +7 -0
  13. package/dist/agent/execution/tool-selection-strategy.js +32 -2
  14. package/dist/agent/facades/session-facade.d.ts +0 -6
  15. package/dist/agent/facades/session-facade.js +0 -45
  16. package/dist/agent/hermes-claw-migrate.d.ts +0 -21
  17. package/dist/agent/hermes-claw-migrate.js +9 -4
  18. package/dist/agent/hermes-protocol-gateways.js +8 -1
  19. package/dist/agent/repo-profiler.js +17 -4
  20. package/dist/agent/self-improvement/authored-tool-runtime.js +10 -2
  21. package/dist/agent/self-improvement/evolution/ast-novelty.d.ts +5 -0
  22. package/dist/agent/self-improvement/evolution/ast-novelty.js +58 -23
  23. package/dist/agent/self-improvement/evolution/code-variant-store.d.ts +3 -0
  24. package/dist/agent/self-improvement/evolution/evolution-engine.js +2 -0
  25. package/dist/agent/self-improvement/evolution/protected-paths.js +6 -0
  26. package/dist/agent/self-improvement/evolution/variant-fitness.d.ts +13 -2
  27. package/dist/agent/self-improvement/evolution/variant-fitness.js +184 -58
  28. package/dist/agent/self-improvement/evolution/worktree-scorer.d.ts +2 -0
  29. package/dist/agent/self-improvement/evolution/worktree-scorer.js +15 -0
  30. package/dist/agent/self-improvement/evolutionary-archive.d.ts +2 -1
  31. package/dist/agent/self-improvement/evolutionary-archive.js +34 -5
  32. package/dist/agent/self-improvement/proposal-store.d.ts +1 -0
  33. package/dist/agent/self-improvement/proposal-store.js +79 -17
  34. package/dist/agent/self-improvement/skill-apply-journal.d.ts +44 -0
  35. package/dist/agent/self-improvement/skill-apply-journal.js +178 -0
  36. package/dist/agent/self-improvement/skill-behavior-benchmark.d.ts +3 -0
  37. package/dist/agent/self-improvement/skill-behavior-benchmark.js +19 -0
  38. package/dist/agent/self-improvement/skill-behavior-gate.d.ts +34 -0
  39. package/dist/agent/self-improvement/skill-behavior-gate.js +96 -0
  40. package/dist/agent/self-improvement/skill-engine.d.ts +22 -0
  41. package/dist/agent/self-improvement/skill-engine.js +385 -13
  42. package/dist/agent/self-improvement/skill-gate.d.ts +2 -0
  43. package/dist/agent/self-improvement/skill-gate.js +17 -2
  44. package/dist/agent/self-improvement/skill-mutator.d.ts +6 -1
  45. package/dist/agent/self-improvement/skill-mutator.js +51 -15
  46. package/dist/agent/self-improvement/skill-types.d.ts +2 -1
  47. package/dist/agent/self-improvement/types.d.ts +11 -0
  48. package/dist/agent/tool-handler.d.ts +1 -1
  49. package/dist/agent/tool-handler.js +28 -9
  50. package/dist/auth/profile-manager.js +1 -1
  51. package/dist/channels/companion-channel-turn.d.ts +53 -4
  52. package/dist/channels/companion-channel-turn.js +218 -16
  53. package/dist/channels/slash-parity.d.ts +4 -6
  54. package/dist/channels/slash-parity.js +9 -44
  55. package/dist/cli/session-commands.d.ts +9 -0
  56. package/dist/cli/session-commands.js +45 -5
  57. package/dist/cli/session-picker.d.ts +43 -0
  58. package/dist/cli/session-picker.js +128 -0
  59. package/dist/codebuddy/a2a-call-tool-defs.d.ts +26 -0
  60. package/dist/codebuddy/a2a-call-tool-defs.js +12 -0
  61. package/dist/codebuddy/fleet-tool-defs.d.ts +2 -0
  62. package/dist/codebuddy/fleet-tool-defs.js +55 -0
  63. package/dist/codebuddy/providers/chatgpt-headers.d.ts +18 -0
  64. package/dist/codebuddy/providers/chatgpt-headers.js +37 -0
  65. package/dist/codebuddy/providers/provider-chatgpt-responses.d.ts +2 -1
  66. package/dist/codebuddy/providers/provider-chatgpt-responses.js +10 -23
  67. package/dist/codebuddy/providers/provider-openai-compat.d.ts +7 -0
  68. package/dist/codebuddy/providers/provider-openai-compat.js +29 -1
  69. package/dist/codebuddy/ragchat-tool-defs.d.ts +31 -0
  70. package/dist/codebuddy/ragchat-tool-defs.js +19 -0
  71. package/dist/codebuddy/resource-catalog-tool-defs.d.ts +28 -0
  72. package/dist/codebuddy/resource-catalog-tool-defs.js +18 -0
  73. package/dist/codebuddy/tool-definitions/agent-tools.js +2 -2
  74. package/dist/codebuddy/tool-definitions/code-exec-tools.js +5 -1
  75. package/dist/codebuddy/tool-definitions/cron-tools.js +6 -0
  76. package/dist/codebuddy/tool-definitions/self-describe-tools.js +6 -1
  77. package/dist/codebuddy/tools.d.ts +0 -6
  78. package/dist/codebuddy/tools.js +25 -3
  79. package/dist/commands/cli/daemon-commands.js +3 -1
  80. package/dist/commands/cli/evolve-command.js +21 -5
  81. package/dist/commands/cli/fleet-collaboration-commands.d.ts +2 -0
  82. package/dist/commands/cli/fleet-collaboration-commands.js +57 -0
  83. package/dist/commands/cli/fleet-commands.js +29 -0
  84. package/dist/commands/cli/fleet-mission-commands.d.ts +3 -0
  85. package/dist/commands/cli/fleet-mission-commands.js +72 -0
  86. package/dist/commands/cli/fleet-rooms-commands.d.ts +10 -0
  87. package/dist/commands/cli/fleet-rooms-commands.js +289 -0
  88. package/dist/commands/cli/tools-commands.js +2 -1
  89. package/dist/commands/cli/triage-command.d.ts +8 -0
  90. package/dist/commands/cli/triage-command.js +72 -0
  91. package/dist/commands/cli/utility-commands.js +25 -1
  92. package/dist/commands/client-dispatcher.d.ts +7 -0
  93. package/dist/commands/client-dispatcher.js +73 -21
  94. package/dist/commands/cron-cli/index.d.ts +3 -1
  95. package/dist/commands/cron-cli/index.js +25 -0
  96. package/dist/commands/device-auth.d.ts +10 -0
  97. package/dist/commands/device-auth.js +91 -0
  98. package/dist/commands/enhanced-command-handler.d.ts +9 -0
  99. package/dist/commands/enhanced-command-handler.js +28 -6
  100. package/dist/commands/handlers/agent-handlers.d.ts +1 -1
  101. package/dist/commands/handlers/agent-handlers.js +4 -4
  102. package/dist/commands/handlers/channel-handlers.js +53 -2
  103. package/dist/commands/handlers/export-handlers.d.ts +3 -2
  104. package/dist/commands/handlers/export-handlers.js +55 -28
  105. package/dist/commands/handlers/extra-handlers.js +5 -1
  106. package/dist/commands/handlers/grill-me-handler.js +26 -18
  107. package/dist/commands/handlers/memory-handlers.d.ts +6 -2
  108. package/dist/commands/handlers/memory-handlers.js +35 -15
  109. package/dist/commands/handlers/missing-handlers.d.ts +2 -2
  110. package/dist/commands/handlers/missing-handlers.js +12 -4
  111. package/dist/commands/handlers/resources-handler.d.ts +12 -0
  112. package/dist/commands/handlers/resources-handler.js +52 -0
  113. package/dist/commands/handlers/starter-handlers.d.ts +1 -1
  114. package/dist/commands/handlers/starter-handlers.js +32 -2
  115. package/dist/commands/handlers/switch-handler.d.ts +1 -1
  116. package/dist/commands/handlers/switch-handler.js +15 -0
  117. package/dist/commands/handlers/test-handlers.js +4 -86
  118. package/dist/commands/handlers/ui-handlers.js +11 -5
  119. package/dist/commands/login-chatgpt.d.ts +8 -0
  120. package/dist/commands/login-chatgpt.js +17 -0
  121. package/dist/commands/mcp-import.d.ts +11 -0
  122. package/dist/commands/mcp-import.js +67 -0
  123. package/dist/commands/mcp-invoke.d.ts +2 -0
  124. package/dist/commands/mcp-invoke.js +68 -0
  125. package/dist/commands/mcp.d.ts +13 -0
  126. package/dist/commands/mcp.js +66 -21
  127. package/dist/commands/pipeline.d.ts +7 -1
  128. package/dist/commands/pipeline.js +104 -7
  129. package/dist/commands/resources.d.ts +2 -0
  130. package/dist/commands/resources.js +64 -0
  131. package/dist/commands/skills-cli/index.js +35 -12
  132. package/dist/commands/slash/builtin-commands.js +16 -3
  133. package/dist/commands/slash/index.d.ts +3 -1
  134. package/dist/commands/slash/index.js +2 -0
  135. package/dist/commands/slash/surfaces.d.ts +53 -0
  136. package/dist/commands/slash/surfaces.js +177 -0
  137. package/dist/commands/slash/types.d.ts +17 -0
  138. package/dist/commands/try.d.ts +1 -1
  139. package/dist/commands/try.js +1 -1
  140. package/dist/companion/companion-identity.d.ts +43 -0
  141. package/dist/companion/companion-identity.js +136 -0
  142. package/dist/companion/companion-toolset.d.ts +66 -0
  143. package/dist/companion/companion-toolset.js +368 -0
  144. package/dist/companion/companion-turn.d.ts +10 -2
  145. package/dist/companion/companion-turn.js +38 -1
  146. package/dist/config/code-exec-policy.d.ts +25 -0
  147. package/dist/config/code-exec-policy.js +39 -0
  148. package/dist/config/model-tools.d.ts +9 -0
  149. package/dist/config/model-tools.js +103 -0
  150. package/dist/context/context-manager-v2.js +2 -2
  151. package/dist/context/lm-resizer-compressor.js +3 -2
  152. package/dist/context/lm-resizer-diagnostics.d.ts +9 -0
  153. package/dist/context/lm-resizer-diagnostics.js +30 -0
  154. package/dist/context/tool-output-masking.js +3 -4
  155. package/dist/curator/curator.d.ts +6 -0
  156. package/dist/curator/curator.js +53 -3
  157. package/dist/daemon/cron-agent-bridge.d.ts +6 -0
  158. package/dist/daemon/cron-agent-bridge.js +31 -4
  159. package/dist/doctor/index.d.ts +11 -2
  160. package/dist/doctor/index.js +84 -21
  161. package/dist/doctor/integrations.d.ts +197 -0
  162. package/dist/doctor/integrations.js +241 -0
  163. package/dist/doctor/triage.d.ts +108 -0
  164. package/dist/doctor/triage.js +304 -0
  165. package/dist/errors/crash-handler.js +2 -0
  166. package/dist/fleet/collaboration.d.ts +44 -0
  167. package/dist/fleet/collaboration.js +170 -0
  168. package/dist/fleet/fleet-listener.d.ts +1 -0
  169. package/dist/fleet/fleet-listener.js +87 -46
  170. package/dist/fleet/fleet-registry.d.ts +2 -0
  171. package/dist/fleet/resource-catalog.d.ts +245 -0
  172. package/dist/fleet/resource-catalog.js +211 -0
  173. package/dist/fleet/rooms/room-access.d.ts +138 -0
  174. package/dist/fleet/rooms/room-access.js +196 -0
  175. package/dist/fleet/rooms/room-client.d.ts +158 -0
  176. package/dist/fleet/rooms/room-client.js +685 -0
  177. package/dist/fleet/rooms/room-event.d.ts +139 -0
  178. package/dist/fleet/rooms/room-event.js +330 -0
  179. package/dist/fleet/rooms/room-filter.d.ts +48 -0
  180. package/dist/fleet/rooms/room-filter.js +152 -0
  181. package/dist/fleet/rooms/room-hub.d.ts +154 -0
  182. package/dist/fleet/rooms/room-hub.js +363 -0
  183. package/dist/fleet/rooms/room-identity.d.ts +26 -0
  184. package/dist/fleet/rooms/room-identity.js +82 -0
  185. package/dist/fleet/rooms/room-lock.d.ts +34 -0
  186. package/dist/fleet/rooms/room-lock.js +180 -0
  187. package/dist/fleet/rooms/room-observations.d.ts +7 -0
  188. package/dist/fleet/rooms/room-observations.js +61 -0
  189. package/dist/fleet/rooms/room-server.d.ts +28 -0
  190. package/dist/fleet/rooms/room-server.js +75 -0
  191. package/dist/fleet/rooms/room-store.d.ts +119 -0
  192. package/dist/fleet/rooms/room-store.js +448 -0
  193. package/dist/fleet/rooms/room-ws-bridge.d.ts +27 -0
  194. package/dist/fleet/rooms/room-ws-bridge.js +137 -0
  195. package/dist/fleet/sensory-mission-bridge.d.ts +42 -0
  196. package/dist/fleet/sensory-mission-bridge.js +136 -0
  197. package/dist/git/worktree-sessions.js +1 -0
  198. package/dist/harness/contract.d.ts +4 -4
  199. package/dist/harness/fleet-supervisor.d.ts +16 -0
  200. package/dist/harness/fleet-supervisor.js +64 -0
  201. package/dist/harness/index.d.ts +4 -0
  202. package/dist/harness/index.js +4 -0
  203. package/dist/harness/mission-runner.d.ts +3 -0
  204. package/dist/harness/mission-runner.js +53 -0
  205. package/dist/harness/mission-store.d.ts +93 -0
  206. package/dist/harness/mission-store.js +297 -0
  207. package/dist/harness/tool-harness.d.ts +56 -0
  208. package/dist/harness/tool-harness.js +153 -0
  209. package/dist/hooks/use-enhanced-input.js +48 -4
  210. package/dist/hooks/use-input-handler.d.ts +1 -0
  211. package/dist/hooks/use-input-handler.js +82 -22
  212. package/dist/hooks/use-input-history.js +1 -0
  213. package/dist/identity/lisa-introspection.js +5 -2
  214. package/dist/identity/operational-self-model.d.ts +2 -0
  215. package/dist/identity/operational-self-model.js +4 -0
  216. package/dist/index.js +52 -6
  217. package/dist/mcp/client.d.ts +11 -0
  218. package/dist/mcp/client.js +68 -3
  219. package/dist/mcp/config.d.ts +20 -0
  220. package/dist/mcp/config.js +121 -8
  221. package/dist/mcp/import-normalize.d.ts +12 -0
  222. package/dist/mcp/import-normalize.js +114 -0
  223. package/dist/mcp/mcp-oauth-constants.d.ts +8 -0
  224. package/dist/mcp/mcp-oauth-constants.js +9 -0
  225. package/dist/mcp/mcp-oauth-provider.d.ts +80 -0
  226. package/dist/mcp/mcp-oauth-provider.js +241 -0
  227. package/dist/mcp/mcp-oauth.d.ts +60 -1
  228. package/dist/mcp/mcp-oauth.js +241 -65
  229. package/dist/mcp/transports.d.ts +14 -5
  230. package/dist/mcp/transports.js +112 -101
  231. package/dist/mcp/types.d.ts +5 -0
  232. package/dist/media/comfyui-recipe-contract.d.ts +7 -7
  233. package/dist/memory/facts-memory.d.ts +11 -1
  234. package/dist/memory/facts-memory.js +47 -8
  235. package/dist/memory/memory-candidate-queue.d.ts +2 -2
  236. package/dist/memory/memory-candidate-queue.js +6 -6
  237. package/dist/memory/persistent-memory.d.ts +13 -8
  238. package/dist/memory/persistent-memory.js +77 -30
  239. package/dist/nodes/device-node.js +5 -9
  240. package/dist/observability/mobile-supervision-gateway-contract.js +20 -7
  241. package/dist/observability/run-event-writer.d.ts +21 -0
  242. package/dist/observability/run-event-writer.js +81 -0
  243. package/dist/observability/run-store.d.ts +5 -0
  244. package/dist/observability/run-store.js +18 -13
  245. package/dist/observability/run-trajectory.js +1 -1
  246. package/dist/optimization/prompt-cache.d.ts +19 -2
  247. package/dist/optimization/prompt-cache.js +41 -6
  248. package/dist/orchestration/orchestrator.d.ts +21 -0
  249. package/dist/orchestration/orchestrator.js +122 -15
  250. package/dist/persistence/session-content.d.ts +8 -0
  251. package/dist/persistence/session-content.js +76 -0
  252. package/dist/persistence/session-handoff.d.ts +64 -0
  253. package/dist/persistence/session-handoff.js +80 -0
  254. package/dist/persistence/session-history.d.ts +4 -0
  255. package/dist/persistence/session-history.js +38 -0
  256. package/dist/persistence/session-store.d.ts +9 -0
  257. package/dist/persistence/session-store.js +48 -20
  258. package/dist/personas/persona-manager.js +17 -1
  259. package/dist/plugins/code-explorer/CodeExplorerManager.d.ts +10 -4
  260. package/dist/plugins/code-explorer/CodeExplorerManager.js +69 -16
  261. package/dist/plugins/plugin-manager.js +10 -1
  262. package/dist/prompts/prompt-manager.js +11 -4
  263. package/dist/prompts/system-base.js +6 -2
  264. package/dist/protocols/a2a/codebuddy-executor.d.ts +11 -2
  265. package/dist/protocols/a2a/codebuddy-executor.js +9 -8
  266. package/dist/protocols/a2a/index.d.ts +1 -1
  267. package/dist/protocols/a2a/jsonrpc-v1.d.ts +41 -0
  268. package/dist/protocols/a2a/jsonrpc-v1.js +145 -0
  269. package/dist/protocols/a2a/peer-config.d.ts +20 -0
  270. package/dist/protocols/a2a/peer-config.js +55 -0
  271. package/dist/providers/codex-oauth.js +30 -6
  272. package/dist/providers/model-provider-compat.js +2 -1
  273. package/dist/sandbox/os-sandbox.d.ts +1 -1
  274. package/dist/scheduler/cron-scheduler.d.ts +15 -2
  275. package/dist/scheduler/cron-scheduler.js +35 -4
  276. package/dist/scheduler/job-notepad.d.ts +69 -0
  277. package/dist/scheduler/job-notepad.js +339 -0
  278. package/dist/security/audit-logger.d.ts +1 -1
  279. package/dist/security/compute-confinement.d.ts +4 -0
  280. package/dist/security/compute-confinement.js +89 -0
  281. package/dist/security/session-encryption.d.ts +4 -0
  282. package/dist/security/session-encryption.js +31 -0
  283. package/dist/sensory/voice-loop.d.ts +17 -0
  284. package/dist/sensory/voice-loop.js +72 -15
  285. package/dist/server/auth/device-session-context.d.ts +9 -0
  286. package/dist/server/auth/device-session-context.js +13 -0
  287. package/dist/server/auth/device-store.d.ts +89 -0
  288. package/dist/server/auth/device-store.js +261 -0
  289. package/dist/server/auth/device-token.d.ts +3 -0
  290. package/dist/server/auth/device-token.js +6 -0
  291. package/dist/server/auth/jwt.js +4 -0
  292. package/dist/server/index.d.ts +0 -10
  293. package/dist/server/index.js +28 -0
  294. package/dist/server/middleware/auth.js +3 -2
  295. package/dist/server/routes/a2a-jsonrpc.d.ts +9 -0
  296. package/dist/server/routes/a2a-jsonrpc.js +66 -0
  297. package/dist/server/routes/a2a-protocol.d.ts +12 -0
  298. package/dist/server/routes/a2a-protocol.js +1 -1
  299. package/dist/server/routes/device-auth.d.ts +4 -0
  300. package/dist/server/routes/device-auth.js +40 -0
  301. package/dist/server/types.d.ts +4 -0
  302. package/dist/server/websocket/handler.d.ts +13 -0
  303. package/dist/server/websocket/handler.js +102 -17
  304. package/dist/services/prompt-builder.d.ts +2 -0
  305. package/dist/services/prompt-builder.js +16 -6
  306. package/dist/services/runtime-settings-context.d.ts +81 -0
  307. package/dist/services/runtime-settings-context.js +79 -0
  308. package/dist/skills/executor.js +2 -0
  309. package/dist/skills/hub.js +16 -14
  310. package/dist/skills/local-inventory.d.ts +21 -0
  311. package/dist/skills/local-inventory.js +72 -0
  312. package/dist/skills/skill-loader.js +2 -2
  313. package/dist/skills/skill-usage-store.d.ts +49 -0
  314. package/dist/skills/skill-usage-store.js +121 -0
  315. package/dist/testing/ai-integration-tests.js +8 -5
  316. package/dist/themes/theme-manager.d.ts +12 -0
  317. package/dist/themes/theme-manager.js +29 -0
  318. package/dist/themes/theme-schema.d.ts +24 -24
  319. package/dist/tools/a2a-call-tool.d.ts +34 -0
  320. package/dist/tools/a2a-call-tool.js +75 -0
  321. package/dist/tools/bash/streaming-executor.d.ts +1 -0
  322. package/dist/tools/bash/streaming-executor.js +78 -90
  323. package/dist/tools/code-exec-preflight-runner.d.ts +41 -0
  324. package/dist/tools/code-exec-preflight-runner.js +254 -0
  325. package/dist/tools/code-exec-preflight.d.ts +44 -0
  326. package/dist/tools/code-exec-preflight.js +501 -0
  327. package/dist/tools/code-exec-tool.d.ts +48 -1
  328. package/dist/tools/code-exec-tool.js +191 -47
  329. package/dist/tools/comment-watcher.js +29 -12
  330. package/dist/tools/core-code-inspection.d.ts +56 -0
  331. package/dist/tools/core-code-inspection.js +86 -0
  332. package/dist/tools/create-skill-tool.d.ts +2 -3
  333. package/dist/tools/create-skill-tool.js +16 -75
  334. package/dist/tools/cronjob-tool.d.ts +1 -0
  335. package/dist/tools/cronjob-tool.js +1 -0
  336. package/dist/tools/env-doctor-tool.d.ts +2 -0
  337. package/dist/tools/env-doctor-tool.js +4 -3
  338. package/dist/tools/execute-code-rpc-invoker.d.ts +1 -1
  339. package/dist/tools/execute-code-rpc-invoker.js +35 -19
  340. package/dist/tools/execute-code-runner.d.ts +2 -0
  341. package/dist/tools/execute-code-runner.js +52 -17
  342. package/dist/tools/fleet-room-tool.d.ts +104 -0
  343. package/dist/tools/fleet-room-tool.js +124 -0
  344. package/dist/tools/integration-tool-hints.d.ts +4 -0
  345. package/dist/tools/integration-tool-hints.js +19 -0
  346. package/dist/tools/list-peers-tool.d.ts +3 -0
  347. package/dist/tools/list-peers-tool.js +11 -4
  348. package/dist/tools/media-generation-tool.d.ts +16 -1
  349. package/dist/tools/media-generation-tool.js +341 -9
  350. package/dist/tools/merge-conflict-tool.js +53 -25
  351. package/dist/tools/metadata.d.ts +1 -5
  352. package/dist/tools/metadata.js +30 -28
  353. package/dist/tools/peer-tool-invoke-tool.d.ts +61 -0
  354. package/dist/tools/peer-tool-invoke-tool.js +396 -0
  355. package/dist/tools/ragchat-tool.d.ts +39 -0
  356. package/dist/tools/ragchat-tool.js +105 -0
  357. package/dist/tools/registry/fleet-tools.d.ts +21 -3
  358. package/dist/tools/registry/fleet-tools.js +137 -4
  359. package/dist/tools/registry/index.d.ts +1 -1
  360. package/dist/tools/registry/index.js +2 -2
  361. package/dist/tools/registry/knowledge-tools.d.ts +2 -2
  362. package/dist/tools/registry/knowledge-tools.js +2 -2
  363. package/dist/tools/registry/lessons-tools.d.ts +7 -0
  364. package/dist/tools/registry/lessons-tools.js +43 -3
  365. package/dist/tools/registry/memory-tools.d.ts +1 -1
  366. package/dist/tools/registry/memory-tools.js +8 -8
  367. package/dist/tools/registry/research-tools.d.ts +1 -0
  368. package/dist/tools/registry/research-tools.js +4 -13
  369. package/dist/tools/registry/self-describe-tools.d.ts +1 -1
  370. package/dist/tools/registry/self-describe-tools.js +43 -30
  371. package/dist/tools/resource-catalog-tool.d.ts +38 -0
  372. package/dist/tools/resource-catalog-tool.js +46 -0
  373. package/dist/tools/skills-inspection-tool.js +30 -1
  374. package/dist/tools/stream-tool-output.d.ts +3 -0
  375. package/dist/tools/stream-tool-output.js +33 -0
  376. package/dist/tools/tool-call-scheduler.d.ts +10 -0
  377. package/dist/tools/tool-call-scheduler.js +58 -0
  378. package/dist/tools/tool-effect.d.ts +5 -0
  379. package/dist/tools/tool-effect.js +26 -0
  380. package/dist/tools/tool-search.d.ts +12 -11
  381. package/dist/tools/tool-search.js +67 -26
  382. package/dist/tools/types.d.ts +6 -0
  383. package/dist/ui/components/ChatHistory.d.ts +1 -1
  384. package/dist/ui/components/ChatHistory.js +2 -2
  385. package/dist/ui/components/ChatInput.d.ts +2 -1
  386. package/dist/ui/components/ChatInput.js +42 -88
  387. package/dist/ui/components/ChatInterface.d.ts +4 -2
  388. package/dist/ui/components/ChatInterface.js +27 -63
  389. package/dist/ui/components/CommandSuggestions.d.ts +0 -1
  390. package/dist/ui/components/CommandSuggestions.js +4 -6
  391. package/dist/ui/components/FileAutocomplete.js +1 -1
  392. package/dist/ui/components/KeyboardHelp.js +8 -6
  393. package/dist/ui/components/ModelSelection.js +6 -5
  394. package/dist/ui/components/StatusBar.d.ts +2 -1
  395. package/dist/ui/components/StatusBar.js +8 -7
  396. package/dist/ui/context/theme-context.js +3 -2
  397. package/dist/ui/index.d.ts +1 -1
  398. package/dist/ui/index.js +1 -1
  399. package/dist/ui/utils/markdown-renderer.js +4 -13
  400. package/dist/utils/atomic-write.d.ts +22 -0
  401. package/dist/utils/atomic-write.js +29 -0
  402. package/dist/utils/bounded-output.d.ts +16 -0
  403. package/dist/utils/bounded-output.js +63 -0
  404. package/dist/utils/config-validation/schema.d.ts +2 -2
  405. package/dist/utils/device-store-file.d.ts +4 -0
  406. package/dist/utils/device-store-file.js +40 -0
  407. package/dist/utils/export-manager.d.ts +9 -0
  408. package/dist/utils/export-manager.js +19 -0
  409. package/dist/utils/first-use-hints.d.ts +25 -0
  410. package/dist/utils/first-use-hints.js +58 -0
  411. package/dist/utils/graceful-shutdown.d.ts +8 -0
  412. package/dist/utils/graceful-shutdown.js +23 -7
  413. package/dist/utils/history-manager.js +1 -1
  414. package/dist/utils/update-notifier.js +16 -18
  415. package/dist/wizard/environment-detection.d.ts +5 -1
  416. package/dist/wizard/environment-detection.js +49 -7
  417. package/dist/wizard/onboarding.d.ts +5 -1
  418. package/dist/wizard/onboarding.js +90 -30
  419. package/dist/wizard/provider-onboarding.d.ts +2 -0
  420. package/dist/wizard/provider-onboarding.js +55 -17
  421. package/package.json +7 -3
@@ -1,14 +1,17 @@
1
1
  /**
2
2
  * Fleet Tool Adapters — Phase (d).17.
3
3
  *
4
- * ITool-compliant wrappers for `peer_delegate` and `list_peers`.
5
- * Both tools are explicitly NOT fleetSafe — they're outbound from the
6
- * caller; inbound peers run their own gating via the A2A executor.
4
+ * ITool-compliant wrappers for `peer_delegate`, `peer_tool_invoke`,
5
+ * `list_peers`, and `fleet_room`. Fleet tools are explicitly NOT fleetSafe —
6
+ * they're outbound from the caller; inbound peers run their own gating.
7
7
  */
8
8
  import { executePeerDelegate } from '../peer-delegate-tool.js';
9
9
  import { executePeerChain } from '../peer-chain-tool.js';
10
10
  import { executeListPeers } from '../list-peers-tool.js';
11
+ import { executeFleetRoom, fleetRoomInputSchema } from '../fleet-room-tool.js';
12
+ import { FLEET_ROOM_TOOL_DEF } from '../../codebuddy/fleet-tool-defs.js';
11
13
  import { executeRoutePeer } from '../route-peer-tool.js';
14
+ import { PEER_TOOL_INVOKE_DESCRIPTION, PEER_TOOL_INVOKE_PARAM_DESCRIPTIONS, executePeerToolInvoke, isFlatToolArgs, } from '../peer-tool-invoke-tool.js';
12
15
  import { FLEET_DISPATCH_PROFILES, FLEET_DISPATCH_PROFILE_GUIDANCE_TEXT, isFleetDispatchProfile, } from '../../fleet/dispatch-profile.js';
13
16
  const DISPATCH_PROFILE_PARAMETER_DESCRIPTION = 'Optional Fleet dispatch profile. When set, Code Buddy carries the operating posture ' +
14
17
  'through peer.chat and returns peer-side policy metadata when supported. Selection guide: ' +
@@ -126,6 +129,110 @@ export class PeerDelegateTool {
126
129
  return true;
127
130
  }
128
131
  }
132
+ export class PeerToolInvokeTool {
133
+ name = 'peer_tool_invoke';
134
+ description = PEER_TOOL_INVOKE_DESCRIPTION;
135
+ async execute(input) {
136
+ return executePeerToolInvoke({
137
+ peer: typeof input.peer === 'string' ? input.peer : '',
138
+ tool: typeof input.tool === 'string' ? input.tool : '',
139
+ args: input.args,
140
+ timeoutMs: typeof input.timeoutMs === 'number' ? input.timeoutMs : undefined,
141
+ });
142
+ }
143
+ getSchema() {
144
+ return {
145
+ name: this.name,
146
+ description: this.description,
147
+ parameters: {
148
+ type: 'object',
149
+ properties: {
150
+ peer: {
151
+ type: 'string',
152
+ minLength: 1,
153
+ description: PEER_TOOL_INVOKE_PARAM_DESCRIPTIONS.peer,
154
+ },
155
+ tool: {
156
+ type: 'string',
157
+ minLength: 1,
158
+ description: PEER_TOOL_INVOKE_PARAM_DESCRIPTIONS.tool,
159
+ },
160
+ args: {
161
+ type: 'object',
162
+ description: PEER_TOOL_INVOKE_PARAM_DESCRIPTIONS.args,
163
+ properties: {
164
+ path: {
165
+ type: 'string',
166
+ description: 'Peer-relative path, e.g. "oracle.txt" (accepted by view_file and list_directory).',
167
+ },
168
+ file_path: {
169
+ type: 'string',
170
+ description: 'Alias of path for view_file.',
171
+ },
172
+ query: {
173
+ type: 'string',
174
+ description: 'Search query when tool is search.',
175
+ },
176
+ },
177
+ },
178
+ timeoutMs: {
179
+ type: 'number',
180
+ description: PEER_TOOL_INVOKE_PARAM_DESCRIPTIONS.timeoutMs,
181
+ },
182
+ },
183
+ required: ['peer', 'tool'],
184
+ },
185
+ };
186
+ }
187
+ validate(input) {
188
+ if (typeof input !== 'object' || input === null) {
189
+ return { valid: false, errors: ['Input must be an object'] };
190
+ }
191
+ const inp = input;
192
+ const errors = [];
193
+ const keys = Object.keys(inp).join(',') || '(none)';
194
+ if (typeof inp.peer !== 'string' || !inp.peer) {
195
+ errors.push(`peer is required (string); received keys: ${keys}`);
196
+ }
197
+ if (typeof inp.tool !== 'string' || !inp.tool) {
198
+ errors.push(`tool is required (string); received keys: ${keys}`);
199
+ }
200
+ if (inp.args !== undefined && !isFlatToolArgs(inp.args)) {
201
+ errors.push('args must be a flat object of string/number/boolean values');
202
+ }
203
+ return errors.length === 0 ? { valid: true } : { valid: false, errors };
204
+ }
205
+ getMetadata() {
206
+ return {
207
+ name: this.name,
208
+ description: this.description,
209
+ category: 'utility',
210
+ keywords: [
211
+ 'peer',
212
+ 'tool',
213
+ 'invoke',
214
+ 'fleet',
215
+ 'view_file',
216
+ 'list_directory',
217
+ 'search',
218
+ 'read',
219
+ 'remote',
220
+ 'workspace',
221
+ 'allowlist',
222
+ 'file',
223
+ 'oracle',
224
+ ],
225
+ priority: 8,
226
+ modifiesFiles: false,
227
+ makesNetworkRequests: true,
228
+ effect: 'emission',
229
+ fleetSafe: false,
230
+ };
231
+ }
232
+ isAvailable() {
233
+ return true;
234
+ }
235
+ }
129
236
  export class ListPeersTool {
130
237
  name = 'list_peers';
131
238
  description = 'List all connected fleet peers with their status (last seen, compacting, peer chat availability). ' +
@@ -478,8 +585,34 @@ export class PeerChainTool {
478
585
  return true;
479
586
  }
480
587
  }
588
+ export class FleetRoomTool {
589
+ name = 'fleet_room';
590
+ description = FLEET_ROOM_TOOL_DEF.function.description;
591
+ async execute(input) {
592
+ return executeFleetRoom(input);
593
+ }
594
+ getSchema() {
595
+ return { name: this.name, description: this.description, parameters: FLEET_ROOM_TOOL_DEF.function.parameters };
596
+ }
597
+ validate(input) {
598
+ return fleetRoomInputSchema.safeParse(input).success
599
+ ? { valid: true }
600
+ : { valid: false, errors: ['Invalid fleet_room action or arguments; destination and identity cannot be overridden.'] };
601
+ }
602
+ getMetadata() {
603
+ return { name: this.name, description: this.description, category: 'utility', keywords: ['fleet', 'room', 'salon', 'message', 'coordination', 'history', 'robot'], priority: 7, modifiesFiles: false, makesNetworkRequests: true, effect: 'emission', fleetSafe: false, requiresConfirmation: true };
604
+ }
605
+ isAvailable() { return true; }
606
+ }
481
607
  export function createFleetTools() {
482
- return [new PeerDelegateTool(), new PeerChainTool(), new ListPeersTool(), new RoutePeerTool()];
608
+ return [
609
+ new PeerDelegateTool(),
610
+ new PeerToolInvokeTool(),
611
+ new PeerChainTool(),
612
+ new ListPeersTool(),
613
+ new RoutePeerTool(),
614
+ new FleetRoomTool(),
615
+ ];
483
616
  }
484
617
  export function resetFleetToolInstances() {
485
618
  // Stateless adapter classes — nothing to reset.
@@ -76,7 +76,7 @@ export { VerifyTool, createVerifyTools, resetVerifyInstances, setVerifyToolProvi
76
76
  export type { VerifyToolProvider, VerifyLlmCall, VerifyExecuteTool, } from './verify-tools.js';
77
77
  export { DelegateAgentTool, createDelegateAgentTools, resetDelegateAgentInstances, setDelegateAgentProvider, resetDelegateAgentProvider, } from './delegate-agent-tools.js';
78
78
  export type { DelegateAgentProvider, DelegateLlmCall, DelegateExecuteTool, } from './delegate-agent-tools.js';
79
- export { PeerDelegateTool, PeerChainTool, ListPeersTool, RoutePeerTool, createFleetTools, resetFleetToolInstances, } from './fleet-tools.js';
79
+ export { PeerDelegateTool, PeerToolInvokeTool, PeerChainTool, ListPeersTool, RoutePeerTool, createFleetTools, resetFleetToolInstances, } from './fleet-tools.js';
80
80
  export { CodeExplorerAskTool, createCodeExplorerTools, resetCodeExplorerInstances, } from './code-explorer-tools.js';
81
81
  export { ScreenMemoryTool, createScreenpipeTools, resetScreenpipeInstances, } from './screenpipe-tools.js';
82
82
  export { AskUserQuestionExecuteTool, createAskUserQuestionTools, resetAskUserQuestionInstances, } from './ask-user-question-tools.js';
@@ -129,8 +129,8 @@ export { AdvisorExecuteTool, createAdvisorTools, resetAdvisorInstances, setAdvis
129
129
  export { VerifyTool, createVerifyTools, resetVerifyInstances, setVerifyToolProvider, resetVerifyToolProvider, } from './verify-tools.js';
130
130
  // Tool Adapters - Delegate Agent (reaches the built-in specialized agents)
131
131
  export { DelegateAgentTool, createDelegateAgentTools, resetDelegateAgentInstances, setDelegateAgentProvider, resetDelegateAgentProvider, } from './delegate-agent-tools.js';
132
- // Tool Adapters - Fleet (peer_delegate, list_peers, route_peer)
133
- export { PeerDelegateTool, PeerChainTool, ListPeersTool, RoutePeerTool, createFleetTools, resetFleetToolInstances, } from './fleet-tools.js';
132
+ // Tool Adapters - Fleet (peer_delegate, peer_tool_invoke, list_peers, route_peer)
133
+ export { PeerDelegateTool, PeerToolInvokeTool, PeerChainTool, ListPeersTool, RoutePeerTool, createFleetTools, resetFleetToolInstances, } from './fleet-tools.js';
134
134
  // Tool Adapters - CodeExplorer
135
135
  export { CodeExplorerAskTool, createCodeExplorerTools, resetCodeExplorerInstances, } from './code-explorer-tools.js';
136
136
  // Tool Adapters - Screenpipe (screen_memory)
@@ -6,7 +6,7 @@
6
6
  * - knowledge_add: create a new knowledge entry from within a session
7
7
  */
8
8
  import type { ToolResult } from '../../types/index.js';
9
- import type { ITool, ToolSchema, IToolMetadata, IValidationResult } from './types.js';
9
+ import type { ITool, IToolExecutionContext, ToolSchema, IToolMetadata, IValidationResult } from './types.js';
10
10
  export declare class KnowledgeSearchTool implements ITool {
11
11
  readonly name = "knowledge_search";
12
12
  readonly description = "Search the agent knowledge base for domain knowledge, conventions, or procedures. Returns ranked excerpts from loaded Knowledge.md files.";
@@ -37,7 +37,7 @@ export declare class AskHumanExecuteTool implements ITool {
37
37
  export declare class CreateSkillExecuteTool implements ITool {
38
38
  readonly name = "create_skill";
39
39
  readonly description = "Create a new SKILL.md file in the workspace skills directory. Use this to codify reusable workflows or procedures for future sessions. Skills are hot-reloaded immediately.";
40
- execute(input: Record<string, unknown>): Promise<ToolResult>;
40
+ execute(input: Record<string, unknown>, context?: IToolExecutionContext): Promise<ToolResult>;
41
41
  getSchema(): ToolSchema;
42
42
  validate(input: unknown): IValidationResult;
43
43
  getMetadata(): IToolMetadata;
@@ -233,7 +233,7 @@ import { getCreateSkillTool } from '../create-skill-tool.js';
233
233
  export class CreateSkillExecuteTool {
234
234
  name = 'create_skill';
235
235
  description = 'Create a new SKILL.md file in the workspace skills directory. Use this to codify reusable workflows or procedures for future sessions. Skills are hot-reloaded immediately.';
236
- async execute(input) {
236
+ async execute(input, context) {
237
237
  return await getCreateSkillTool().execute({
238
238
  name: input.name,
239
239
  description: input.description,
@@ -242,7 +242,7 @@ export class CreateSkillExecuteTool {
242
242
  env: input.env,
243
243
  requires: input.requires,
244
244
  overwrite: input.overwrite,
245
- });
245
+ }, context?.cwd);
246
246
  }
247
247
  getSchema() {
248
248
  return getCreateSkillTool().getSchema();
@@ -55,6 +55,13 @@ export declare class LessonsGraphTool implements ITool {
55
55
  getMetadata(): IToolMetadata;
56
56
  isAvailable(): boolean;
57
57
  }
58
+ /**
59
+ * Resolve a project-local binary (`node_modules/.bin/<name>`, walking up from
60
+ * `cwd`). `npx <name>` is deliberately avoided: when the tool is not installed
61
+ * it silently fetches a package from the npm registry (for `tsc`, an unrelated
62
+ * package), which is slow, offline-hostile and not the project's compiler.
63
+ */
64
+ export declare function resolveProjectBin(name: string, cwd: string): string | null;
58
65
  export declare class TaskVerifyTool implements ITool {
59
66
  readonly name = "task_verify";
60
67
  readonly description: string;
@@ -9,6 +9,8 @@
9
9
  * - TaskVerifyTool (`task_verify`) — run tsc/tests/lint verification contract
10
10
  */
11
11
  import { spawnSync } from 'child_process';
12
+ import * as fs from 'fs';
13
+ import * as path from 'path';
12
14
  import { getLessonsTracker, renderLessonConceptGraph, } from '../../agent/lessons-tracker.js';
13
15
  // ============================================================================
14
16
  // LessonsAddTool
@@ -480,11 +482,49 @@ function runCheck(cmd, args, cwd, timeoutMs = 60_000) {
480
482
  const pass = result.status === 0 && !result.error;
481
483
  return { pass, output };
482
484
  }
485
+ /**
486
+ * Resolve a project-local binary (`node_modules/.bin/<name>`, walking up from
487
+ * `cwd`). `npx <name>` is deliberately avoided: when the tool is not installed
488
+ * it silently fetches a package from the npm registry (for `tsc`, an unrelated
489
+ * package), which is slow, offline-hostile and not the project's compiler.
490
+ */
491
+ export function resolveProjectBin(name, cwd) {
492
+ const candidates = process.platform === 'win32' ? [`${name}.cmd`, name] : [name];
493
+ let dir = path.resolve(cwd);
494
+ for (;;) {
495
+ for (const candidate of candidates) {
496
+ const full = path.join(dir, 'node_modules', '.bin', candidate);
497
+ if (fs.existsSync(full))
498
+ return full;
499
+ }
500
+ const parent = path.dirname(dir);
501
+ if (parent === dir)
502
+ return null;
503
+ dir = parent;
504
+ }
505
+ }
506
+ function runProjectBin(name, args, cwd, packageHint, timeoutMs = 60_000) {
507
+ const bin = resolveProjectBin(name, cwd);
508
+ if (!bin) {
509
+ return {
510
+ pass: false,
511
+ output: `${name} not found in node_modules/.bin of ${cwd} or its parents; install ${packageHint} in the project (nothing was downloaded).`,
512
+ };
513
+ }
514
+ if (bin.endsWith('.cmd')) {
515
+ // Windows shims need a shell; args are fixed internal flags, only the path needs quoting.
516
+ const quoted = [`"${bin}"`, ...args].join(' ');
517
+ const result = spawnSync(quoted, { cwd, encoding: 'utf-8', timeout: timeoutMs, shell: true });
518
+ const raw = [result.stdout ?? '', result.stderr ?? ''].join('\n').trim();
519
+ return { pass: result.status === 0 && !result.error, output: raw.length > 2000 ? '...(truncated)\n' + raw.slice(-2000) : raw };
520
+ }
521
+ return runCheck(bin, args, cwd, timeoutMs);
522
+ }
483
523
  export class TaskVerifyTool {
484
524
  name = 'task_verify';
485
525
  description = [
486
526
  'Run verification checks before marking a task complete (Verification Contract).',
487
- 'Checks: typescript (npx tsc --noEmit), tests (auto-detected from package.json), lint (eslint).',
527
+ 'Checks: typescript (project-local tsc --noEmit), tests (auto-detected from package.json), lint (project-local eslint).',
488
528
  'Returns pass/fail per check with truncated output.',
489
529
  'Call this before every task completion to satisfy the Verification Contract.',
490
530
  ].join(' ');
@@ -501,7 +541,7 @@ export class TaskVerifyTool {
501
541
  for (const check of checks) {
502
542
  let res;
503
543
  if (check === 'typescript') {
504
- res = runCheck('npx', ['tsc', '--noEmit'], workDir);
544
+ res = runProjectBin('tsc', ['--noEmit'], workDir, 'typescript');
505
545
  }
506
546
  else if (check === 'tests') {
507
547
  // Try to detect test command from RepoProfiler cache
@@ -526,7 +566,7 @@ export class TaskVerifyTool {
526
566
  }
527
567
  else {
528
568
  // lint
529
- res = runCheck('npx', ['eslint', '.', '--max-warnings=0'], workDir, 60_000);
569
+ res = runProjectBin('eslint', ['.', '--max-warnings=0'], workDir, 'eslint', 60_000);
530
570
  }
531
571
  results.push({ check, pass: res.pass, output: res.output });
532
572
  }
@@ -31,7 +31,7 @@ export declare class ReplaceMemoryTool implements ITool {
31
31
  export declare class MemoryProposeTool implements ITool {
32
32
  readonly name = "memory_propose";
33
33
  readonly description = "Propose a long-term memory candidate for human review. Use this instead of remember when the fact is inferred, ambiguous, or should not be silently injected into future prompts.";
34
- execute(input: Record<string, unknown>): Promise<ToolResult>;
34
+ execute(input: Record<string, unknown>, context?: IToolExecutionContext): Promise<ToolResult>;
35
35
  getSchema(): ToolSchema;
36
36
  validate(input: unknown): IValidationResult;
37
37
  getMetadata(): IToolMetadata;
@@ -21,14 +21,14 @@ export class RememberTool {
21
21
  // Per-bot memory (multi-bot channels): scope by botId so bots don't share
22
22
  // each other's facts. No botId = global memory (default). initialize() is
23
23
  // idempotent, so this is cheap for the already-initialized global instance.
24
- const mm = getMemoryManager(undefined, context?.botId);
24
+ const mm = getMemoryManager(undefined, context?.botId, context?.cwd);
25
25
  await mm.initialize();
26
26
  let key = input.key;
27
27
  let value = input.value;
28
28
  let scope = input.scope ?? 'project';
29
29
  let category = input.category ?? 'custom';
30
30
  try {
31
- const hookResult = await executeHermesLifecycleHook(process.cwd(), 'before_memory_write', {
31
+ const hookResult = await executeHermesLifecycleHook(context?.cwd ?? process.cwd(), 'before_memory_write', {
32
32
  toolName: this.name,
33
33
  toolInput: { key, value, scope, category },
34
34
  memoryKey: key,
@@ -134,14 +134,14 @@ export class ReplaceMemoryTool {
134
134
  // Per-bot memory (multi-bot channels): scope by botId so bots don't share
135
135
  // each other's facts. No botId = global memory (default). initialize() is
136
136
  // idempotent, so this is cheap for the already-initialized global instance.
137
- const mm = getMemoryManager(undefined, context?.botId);
137
+ const mm = getMemoryManager(undefined, context?.botId, context?.cwd);
138
138
  await mm.initialize();
139
139
  let key = input.key;
140
140
  let value = input.value;
141
141
  let scope = input.scope ?? 'project';
142
142
  let category = input.category;
143
143
  try {
144
- const hookResult = await executeHermesLifecycleHook(process.cwd(), 'before_memory_write', {
144
+ const hookResult = await executeHermesLifecycleHook(context?.cwd ?? process.cwd(), 'before_memory_write', {
145
145
  toolName: this.name,
146
146
  toolInput: { key, value, scope, category },
147
147
  memoryKey: key,
@@ -249,7 +249,7 @@ export class ReplaceMemoryTool {
249
249
  export class MemoryProposeTool {
250
250
  name = 'memory_propose';
251
251
  description = 'Propose a long-term memory candidate for human review. Use this instead of remember when the fact is inferred, ambiguous, or should not be silently injected into future prompts.';
252
- async execute(input) {
252
+ async execute(input, context) {
253
253
  const key = input.key;
254
254
  const value = input.value;
255
255
  const scope = input.scope ?? 'project';
@@ -257,7 +257,7 @@ export class MemoryProposeTool {
257
257
  const confidence = typeof input.confidence === 'number' ? input.confidence : undefined;
258
258
  const rationale = typeof input.rationale === 'string' ? input.rationale : undefined;
259
259
  try {
260
- const { candidate, deduped } = getMemoryCandidateQueue(process.cwd()).propose({
260
+ const { candidate, deduped } = getMemoryCandidateQueue(context?.cwd ?? process.cwd(), context?.botId).propose({
261
261
  key,
262
262
  value,
263
263
  scope,
@@ -355,7 +355,7 @@ export class RecallTool {
355
355
  // Per-bot memory (multi-bot channels): scope by botId so bots don't share
356
356
  // each other's facts. No botId = global memory (default). initialize() is
357
357
  // idempotent, so this is cheap for the already-initialized global instance.
358
- const mm = getMemoryManager(undefined, context?.botId);
358
+ const mm = getMemoryManager(undefined, context?.botId, context?.cwd);
359
359
  try {
360
360
  await mm.initialize();
361
361
  const key = input.key;
@@ -438,7 +438,7 @@ export class ForgetTool {
438
438
  // Per-bot memory (multi-bot channels): scope by botId so bots don't share
439
439
  // each other's facts. No botId = global memory (default). initialize() is
440
440
  // idempotent, so this is cheap for the already-initialized global instance.
441
- const mm = getMemoryManager(undefined, context?.botId);
441
+ const mm = getMemoryManager(undefined, context?.botId, context?.cwd);
442
442
  try {
443
443
  await mm.initialize();
444
444
  const key = input.key;
@@ -5,6 +5,7 @@
5
5
  * DISPATCHABLE in interactive chat (via `ToolHandler.initializeRegistry`), not
6
6
  * only in headless/multi-agent runs:
7
7
  * - `deep_research` — src/tools/deep-research-tool.ts (multi-source web research).
8
+ * - `ragchat_search` — authenticated read-only RagChat PDF passages.
8
9
  * - `paper_qa` — src/tools/paper-qa-tool.ts (grounded, cited QA over a PDF corpus).
9
10
  *
10
11
  * The adapters themselves (business delegation + conservative in-chat bounds)
@@ -1,21 +1,12 @@
1
- /**
2
- * Research Tool Adapters (factory)
3
- *
4
- * Wires the research ITool adapters into the FormalToolRegistry so they are
5
- * DISPATCHABLE in interactive chat (via `ToolHandler.initializeRegistry`), not
6
- * only in headless/multi-agent runs:
7
- * - `deep_research` — src/tools/deep-research-tool.ts (multi-source web research).
8
- * - `paper_qa` — src/tools/paper-qa-tool.ts (grounded, cited QA over a PDF corpus).
9
- *
10
- * The adapters themselves (business delegation + conservative in-chat bounds)
11
- * live in those files; this factory only instantiates them.
12
- */
1
+ import { A2ACallTool } from '../a2a-call-tool.js';
13
2
  import { DeepResearchTool } from '../deep-research-tool.js';
3
+ import { ResourceCatalogTool } from '../resource-catalog-tool.js';
4
+ import { RagChatTool } from '../ragchat-tool.js';
14
5
  import { PaperQaTool } from '../paper-qa-tool.js';
15
6
  /**
16
7
  * Create all research tool instances.
17
8
  */
18
9
  export function createResearchTools() {
19
- return [new DeepResearchTool(), new PaperQaTool()];
10
+ return [new DeepResearchTool(), new PaperQaTool(), new RagChatTool(), new ResourceCatalogTool(), new A2ACallTool()];
20
11
  }
21
12
  //# sourceMappingURL=research-tools.js.map
@@ -12,7 +12,7 @@ import type { ToolResult } from '../../types/index.js';
12
12
  import type { ITool, ToolSchema, IToolMetadata, IValidationResult, IToolExecutionContext } from './types.js';
13
13
  export declare class SelfDescribeTool implements ITool {
14
14
  readonly name = "self_describe";
15
- readonly description = "Inspect what THIS robot/agent is made of and what is evidenced on the current turn: constituent bricks, source/build revision, relevant curated code areas, model/provider/surface, registered versus exposed tools, configuration-only faculties, and limits. Hardware/service availability is omitted unless the host supplied an attestation; this tool performs no live probes. Use it for technical introspection, capabilities, version, and 'de quoi es-tu compos\u00E9'. It reports a verifiable operational self-model, never subjective consciousness. Read-only, auto-approved.";
15
+ readonly description: string;
16
16
  execute(input: Record<string, unknown>, context?: IToolExecutionContext): Promise<ToolResult>;
17
17
  getSchema(): ToolSchema;
18
18
  validate(input: unknown): IValidationResult;
@@ -1,13 +1,4 @@
1
- /**
2
- * Self-describe tool adapter.
3
- *
4
- * ITool exposing `self_describe` — "de quoi es-tu fait ?": the robot's live
5
- * manifest of the bricks that compose it (buddy-sense, buddy-vision,
6
- * buddy-memory) plus its registered/configured faculties (tools, providers,
7
- * sensors), without inferring runtime liveness. Read-only,
8
- * auto-approved. The result text flows back through the normal agent→voice path
9
- * so the companion can speak it. See src/tools/self-describe.ts.
10
- */
1
+ import { SELF_DESCRIBE_TOOL } from '../../codebuddy/tool-definitions/self-describe-tools.js';
11
2
  import { buildSelfDescription } from '../self-describe.js';
12
3
  import { buildOperationalSelfModel, resolveCodeBuddyCoreRoot, } from '../../identity/operational-self-model.js';
13
4
  function stringList(value) {
@@ -32,7 +23,7 @@ function contextString(context, key) {
32
23
  }
33
24
  export class SelfDescribeTool {
34
25
  name = 'self_describe';
35
- description = "Inspect what THIS robot/agent is made of and what is evidenced on the current turn: constituent bricks, source/build revision, relevant curated code areas, model/provider/surface, registered versus exposed tools, configuration-only faculties, and limits. Hardware/service availability is omitted unless the host supplied an attestation; this tool performs no live probes. Use it for technical introspection, capabilities, version, and 'de quoi es-tu composé'. It reports a verifiable operational self-model, never subjective consciousness. Read-only, auto-approved.";
26
+ description = SELF_DESCRIBE_TOOL.function.description;
36
27
  async execute(input, context) {
37
28
  // Resolve registered/configured faculties best-effort — a failure just omits that detail.
38
29
  let toolNames;
@@ -49,7 +40,14 @@ export class SelfDescribeTool {
49
40
  // environment); otherwise identity remains omitted.
50
41
  const personaRobotName = contextString(context, 'robotName') ?? process.env.CODEBUDDY_ROBOT_NAME?.trim();
51
42
  const exposedToolNames = stringList(context?.extra?.exposedToolNames);
43
+ const { getRuntimeSettingsSnapshot } = await import('../../services/runtime-settings-context.js');
44
+ const settings = getRuntimeSettingsSnapshot({
45
+ surface: contextString(context, 'surface'), model: contextString(context, 'model'),
46
+ provider: contextString(context, 'provider'),
47
+ maxToolRounds: typeof context?.extra?.maxToolRounds === 'number' ? context.extra.maxToolRounds : undefined,
48
+ });
52
49
  const runtime = {
50
+ ...(settings.theme ? { theme: settings.theme.active } : {}),
53
51
  ...(contextString(context, 'model') ? { model: contextString(context, 'model') } : {}),
54
52
  ...(contextString(context, 'provider') ? { provider: contextString(context, 'provider') } : {}),
55
53
  ...(contextString(context, 'surface') ? { surface: contextString(context, 'surface') } : {}),
@@ -68,6 +66,22 @@ export class SelfDescribeTool {
68
66
  exposedToolNames,
69
67
  personaRobotName,
70
68
  });
69
+ if (input.operation) {
70
+ try {
71
+ const { inspectCoreCode } = await import('../core-code-inspection.js');
72
+ const inspection = inspectCoreCode(core, {
73
+ operation: input.operation,
74
+ path: typeof input.path === 'string' ? input.path : undefined,
75
+ query: typeof input.query === 'string' ? input.query : undefined,
76
+ line: typeof input.line === 'number' ? input.line : undefined,
77
+ offset: typeof input.offset === 'number' ? input.offset : undefined,
78
+ });
79
+ return { success: true, output: JSON.stringify({ settings, inspection }), data: { settings, inspection } };
80
+ }
81
+ catch (error) {
82
+ return { success: false, error: error instanceof Error ? error.message : String(error) };
83
+ }
84
+ }
71
85
  const operational = buildOperationalSelfModel({
72
86
  coreResolution: core,
73
87
  focus,
@@ -77,8 +91,9 @@ export class SelfDescribeTool {
77
91
  });
78
92
  return {
79
93
  success: true,
80
- output: `${description.text}\n\n${operational.text}`,
94
+ output: `${description.text}\n\n${operational.text}\n\nCurrent runtime settings: ${JSON.stringify(settings)}`,
81
95
  data: {
96
+ settings,
82
97
  description: description,
83
98
  operational: operational,
84
99
  },
@@ -88,23 +103,7 @@ export class SelfDescribeTool {
88
103
  return {
89
104
  name: this.name,
90
105
  description: this.description,
91
- parameters: {
92
- type: 'object',
93
- properties: {
94
- focus: {
95
- type: 'string',
96
- maxLength: 320,
97
- description: 'Aspect of this agent to inspect (voice, memory, routing, architecture, limitation).',
98
- },
99
- depth: {
100
- type: 'string',
101
- enum: ['summary', 'deep'],
102
- description: 'Depth of the curated code inspection.',
103
- },
104
- },
105
- required: [],
106
- additionalProperties: false,
107
- },
106
+ parameters: SELF_DESCRIBE_TOOL.function.parameters,
108
107
  };
109
108
  }
110
109
  validate(input) {
@@ -118,7 +117,21 @@ export class SelfDescribeTool {
118
117
  if (value.depth !== undefined && value.depth !== 'summary' && value.depth !== 'deep') {
119
118
  return { valid: false, errors: ['depth must be summary or deep'] };
120
119
  }
121
- const unknown = Object.keys(value).filter((key) => key !== 'focus' && key !== 'depth');
120
+ if (value.operation !== undefined && !['list', 'read', 'search'].includes(String(value.operation))) {
121
+ return { valid: false, errors: ['operation must be list, read or search'] };
122
+ }
123
+ for (const key of ['path', 'query']) {
124
+ if (value[key] !== undefined && (typeof value[key] !== 'string' || value[key].length > 160)) {
125
+ return { valid: false, errors: [`${key} must be a string of at most 160 characters`] };
126
+ }
127
+ }
128
+ if (value.line !== undefined && (!Number.isSafeInteger(value.line) || Number(value.line) < 1)) {
129
+ return { valid: false, errors: ['line must be a positive integer'] };
130
+ }
131
+ if (value.offset !== undefined && (!Number.isSafeInteger(value.offset) || Number(value.offset) < 0)) {
132
+ return { valid: false, errors: ['offset must be a non-negative integer'] };
133
+ }
134
+ const unknown = Object.keys(value).filter((key) => !['focus', 'depth', 'operation', 'path', 'query', 'line', 'offset'].includes(key));
122
135
  if (unknown.length > 0) {
123
136
  return { valid: false, errors: [`unknown input field(s): ${unknown.join(', ')}`] };
124
137
  }
@@ -0,0 +1,38 @@
1
+ import { ResourceCatalog } from '../fleet/resource-catalog.js';
2
+ import type { ToolResult } from '../types/index.js';
3
+ import type { ITool, IToolMetadata, IValidationResult } from './registry/types.js';
4
+ export declare class ResourceCatalogTool implements ITool {
5
+ private readonly catalog;
6
+ readonly name = "resource_catalog";
7
+ readonly description: string;
8
+ constructor(catalog?: ResourceCatalog);
9
+ getSchema(): {
10
+ name: string;
11
+ description: string;
12
+ parameters: {
13
+ type: "object";
14
+ properties: {
15
+ operation: {
16
+ type: "string";
17
+ enum: string[];
18
+ description: string;
19
+ };
20
+ capability: {
21
+ type: "string";
22
+ description: string;
23
+ };
24
+ kind: {
25
+ type: "string";
26
+ enum: string[];
27
+ description: string;
28
+ };
29
+ };
30
+ required: string[];
31
+ additionalProperties: false;
32
+ };
33
+ };
34
+ getMetadata(): IToolMetadata;
35
+ isAvailable(): boolean;
36
+ validate(input: unknown): IValidationResult;
37
+ execute(input: Record<string, unknown>): Promise<ToolResult>;
38
+ }
@@ -0,0 +1,46 @@
1
+ import { z } from 'zod';
2
+ import { publicResourceStatus, ResourceCatalog, resourceSchema, selectionWarning } from '../fleet/resource-catalog.js';
3
+ import { RESOURCE_CATALOG_TOOL_DEF } from '../codebuddy/resource-catalog-tool-defs.js';
4
+ const schema = z.discriminatedUnion('operation', [
5
+ z.object({ operation: z.literal('list') }).strict(),
6
+ z.object({ operation: z.literal('select'), capability: z.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,95}$/),
7
+ kind: resourceSchema.shape.kind.optional() }).strict(),
8
+ ]);
9
+ export class ResourceCatalogTool {
10
+ catalog;
11
+ name = 'resource_catalog';
12
+ description = RESOURCE_CATALOG_TOOL_DEF.function.description;
13
+ constructor(catalog = new ResourceCatalog()) {
14
+ this.catalog = catalog;
15
+ }
16
+ getSchema() { return RESOURCE_CATALOG_TOOL_DEF.function; }
17
+ getMetadata() {
18
+ return { name: this.name, description: this.description, category: 'system',
19
+ keywords: ['resource', 'catalog', 'network', 'fleet', 'ragchat', 'available', 'ressources', 'réseau'],
20
+ priority: 7, modifiesFiles: false, makesNetworkRequests: false };
21
+ }
22
+ isAvailable() { return true; }
23
+ validate(input) {
24
+ return schema.safeParse(input).success ? { valid: true } : { valid: false, errors: ['Paramètres du catalogue invalides.'] };
25
+ }
26
+ async execute(input) {
27
+ const parsed = schema.safeParse(input);
28
+ if (!parsed.success)
29
+ return { success: false, error: 'Paramètres du catalogue invalides ; seules list et select sont disponibles.' };
30
+ try {
31
+ const args = parsed.data;
32
+ const result = args.operation === 'list' ? { resources: (await this.catalog.list()).map(publicResourceStatus) }
33
+ : await this.catalog.select(args.capability, args.kind).then(choice => {
34
+ const warning = selectionWarning(choice.selected);
35
+ return { excluded: choice.excluded, reason: choice.reason,
36
+ selected: choice.selected ? publicResourceStatus(choice.selected) : null, ...(warning ? { warning } : {}) };
37
+ });
38
+ return { success: true, output: JSON.stringify({ ...result, dispatched: false, probed: false,
39
+ instruction: 'Déclarations explicites, santé observée sans preuve d’usage et charge inconnue. Aucune sonde ni exécution effectuée. Une sélection ne change pas les endpoints des autres outils ; ragchat_search utilise RAGCHAT_BASE_URL configuré séparément.' }) };
40
+ }
41
+ catch {
42
+ return { success: false, error: 'Catalogue indisponible ou invalide ; aucune sonde, écriture ni exécution effectuée.' };
43
+ }
44
+ }
45
+ }
46
+ //# sourceMappingURL=resource-catalog-tool.js.map