@phuetz/code-buddy 2.0.0 → 2.1.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 (403) hide show
  1. package/README.fr.md +56 -0
  2. package/README.md +73 -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 +165 -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.js +19 -2
  13. package/dist/agent/facades/session-facade.d.ts +0 -6
  14. package/dist/agent/facades/session-facade.js +0 -45
  15. package/dist/agent/hermes-claw-migrate.d.ts +0 -21
  16. package/dist/agent/hermes-claw-migrate.js +9 -4
  17. package/dist/agent/hermes-protocol-gateways.js +8 -1
  18. package/dist/agent/repo-profiler.js +17 -4
  19. package/dist/agent/self-improvement/authored-tool-runtime.js +10 -2
  20. package/dist/agent/self-improvement/evolution/ast-novelty.d.ts +5 -0
  21. package/dist/agent/self-improvement/evolution/ast-novelty.js +58 -23
  22. package/dist/agent/self-improvement/evolution/code-variant-store.d.ts +3 -0
  23. package/dist/agent/self-improvement/evolution/evolution-engine.js +2 -0
  24. package/dist/agent/self-improvement/evolution/protected-paths.js +6 -0
  25. package/dist/agent/self-improvement/evolution/variant-fitness.d.ts +13 -2
  26. package/dist/agent/self-improvement/evolution/variant-fitness.js +184 -58
  27. package/dist/agent/self-improvement/evolution/worktree-scorer.d.ts +2 -0
  28. package/dist/agent/self-improvement/evolution/worktree-scorer.js +15 -0
  29. package/dist/agent/self-improvement/evolutionary-archive.d.ts +2 -1
  30. package/dist/agent/self-improvement/evolutionary-archive.js +34 -5
  31. package/dist/agent/self-improvement/proposal-store.d.ts +1 -0
  32. package/dist/agent/self-improvement/proposal-store.js +79 -17
  33. package/dist/agent/self-improvement/skill-apply-journal.d.ts +44 -0
  34. package/dist/agent/self-improvement/skill-apply-journal.js +178 -0
  35. package/dist/agent/self-improvement/skill-behavior-benchmark.d.ts +3 -0
  36. package/dist/agent/self-improvement/skill-behavior-benchmark.js +19 -0
  37. package/dist/agent/self-improvement/skill-behavior-gate.d.ts +34 -0
  38. package/dist/agent/self-improvement/skill-behavior-gate.js +96 -0
  39. package/dist/agent/self-improvement/skill-engine.d.ts +22 -0
  40. package/dist/agent/self-improvement/skill-engine.js +385 -13
  41. package/dist/agent/self-improvement/skill-gate.d.ts +2 -0
  42. package/dist/agent/self-improvement/skill-gate.js +17 -2
  43. package/dist/agent/self-improvement/skill-mutator.d.ts +6 -1
  44. package/dist/agent/self-improvement/skill-mutator.js +51 -15
  45. package/dist/agent/self-improvement/skill-types.d.ts +2 -1
  46. package/dist/agent/self-improvement/types.d.ts +11 -0
  47. package/dist/agent/tool-handler.d.ts +1 -1
  48. package/dist/agent/tool-handler.js +28 -9
  49. package/dist/auth/profile-manager.js +1 -1
  50. package/dist/channels/companion-channel-turn.d.ts +53 -4
  51. package/dist/channels/companion-channel-turn.js +218 -16
  52. package/dist/channels/slash-parity.d.ts +4 -6
  53. package/dist/channels/slash-parity.js +9 -44
  54. package/dist/cli/session-commands.d.ts +9 -0
  55. package/dist/cli/session-commands.js +45 -5
  56. package/dist/cli/session-picker.d.ts +43 -0
  57. package/dist/cli/session-picker.js +128 -0
  58. package/dist/codebuddy/a2a-call-tool-defs.d.ts +26 -0
  59. package/dist/codebuddy/a2a-call-tool-defs.js +12 -0
  60. package/dist/codebuddy/fleet-tool-defs.d.ts +1 -0
  61. package/dist/codebuddy/fleet-tool-defs.js +24 -0
  62. package/dist/codebuddy/providers/chatgpt-headers.d.ts +18 -0
  63. package/dist/codebuddy/providers/chatgpt-headers.js +37 -0
  64. package/dist/codebuddy/providers/provider-chatgpt-responses.d.ts +2 -1
  65. package/dist/codebuddy/providers/provider-chatgpt-responses.js +10 -23
  66. package/dist/codebuddy/providers/provider-openai-compat.js +1 -1
  67. package/dist/codebuddy/ragchat-tool-defs.d.ts +31 -0
  68. package/dist/codebuddy/ragchat-tool-defs.js +19 -0
  69. package/dist/codebuddy/resource-catalog-tool-defs.d.ts +28 -0
  70. package/dist/codebuddy/resource-catalog-tool-defs.js +18 -0
  71. package/dist/codebuddy/tool-definitions/agent-tools.js +2 -2
  72. package/dist/codebuddy/tool-definitions/code-exec-tools.js +5 -1
  73. package/dist/codebuddy/tool-definitions/cron-tools.js +6 -0
  74. package/dist/codebuddy/tool-definitions/self-describe-tools.js +6 -1
  75. package/dist/codebuddy/tools.d.ts +0 -6
  76. package/dist/codebuddy/tools.js +25 -3
  77. package/dist/commands/cli/daemon-commands.js +3 -1
  78. package/dist/commands/cli/evolve-command.js +21 -5
  79. package/dist/commands/cli/fleet-collaboration-commands.d.ts +2 -0
  80. package/dist/commands/cli/fleet-collaboration-commands.js +57 -0
  81. package/dist/commands/cli/fleet-commands.js +29 -0
  82. package/dist/commands/cli/fleet-mission-commands.d.ts +3 -0
  83. package/dist/commands/cli/fleet-mission-commands.js +72 -0
  84. package/dist/commands/cli/fleet-rooms-commands.d.ts +10 -0
  85. package/dist/commands/cli/fleet-rooms-commands.js +289 -0
  86. package/dist/commands/cli/tools-commands.js +2 -1
  87. package/dist/commands/cli/triage-command.d.ts +8 -0
  88. package/dist/commands/cli/triage-command.js +72 -0
  89. package/dist/commands/cli/utility-commands.js +25 -1
  90. package/dist/commands/client-dispatcher.d.ts +7 -0
  91. package/dist/commands/client-dispatcher.js +73 -21
  92. package/dist/commands/cron-cli/index.d.ts +3 -1
  93. package/dist/commands/cron-cli/index.js +25 -0
  94. package/dist/commands/device-auth.d.ts +10 -0
  95. package/dist/commands/device-auth.js +91 -0
  96. package/dist/commands/enhanced-command-handler.d.ts +9 -0
  97. package/dist/commands/enhanced-command-handler.js +28 -6
  98. package/dist/commands/handlers/agent-handlers.d.ts +1 -1
  99. package/dist/commands/handlers/agent-handlers.js +4 -4
  100. package/dist/commands/handlers/channel-handlers.js +53 -2
  101. package/dist/commands/handlers/export-handlers.d.ts +3 -2
  102. package/dist/commands/handlers/export-handlers.js +55 -28
  103. package/dist/commands/handlers/extra-handlers.js +5 -1
  104. package/dist/commands/handlers/grill-me-handler.js +26 -18
  105. package/dist/commands/handlers/memory-handlers.d.ts +6 -2
  106. package/dist/commands/handlers/memory-handlers.js +35 -15
  107. package/dist/commands/handlers/missing-handlers.d.ts +2 -2
  108. package/dist/commands/handlers/missing-handlers.js +4 -4
  109. package/dist/commands/handlers/resources-handler.d.ts +12 -0
  110. package/dist/commands/handlers/resources-handler.js +52 -0
  111. package/dist/commands/handlers/starter-handlers.d.ts +1 -1
  112. package/dist/commands/handlers/starter-handlers.js +32 -2
  113. package/dist/commands/handlers/switch-handler.d.ts +1 -1
  114. package/dist/commands/handlers/switch-handler.js +15 -0
  115. package/dist/commands/handlers/test-handlers.js +4 -86
  116. package/dist/commands/handlers/ui-handlers.js +11 -5
  117. package/dist/commands/login-chatgpt.d.ts +8 -0
  118. package/dist/commands/login-chatgpt.js +17 -0
  119. package/dist/commands/mcp-import.d.ts +11 -0
  120. package/dist/commands/mcp-import.js +67 -0
  121. package/dist/commands/mcp-invoke.d.ts +2 -0
  122. package/dist/commands/mcp-invoke.js +68 -0
  123. package/dist/commands/mcp.js +4 -0
  124. package/dist/commands/pipeline.d.ts +7 -1
  125. package/dist/commands/pipeline.js +104 -7
  126. package/dist/commands/resources.d.ts +2 -0
  127. package/dist/commands/resources.js +64 -0
  128. package/dist/commands/skills-cli/index.js +35 -12
  129. package/dist/commands/slash/builtin-commands.js +16 -3
  130. package/dist/commands/slash/index.d.ts +3 -1
  131. package/dist/commands/slash/index.js +2 -0
  132. package/dist/commands/slash/surfaces.d.ts +53 -0
  133. package/dist/commands/slash/surfaces.js +177 -0
  134. package/dist/commands/slash/types.d.ts +17 -0
  135. package/dist/commands/try.d.ts +1 -1
  136. package/dist/commands/try.js +1 -1
  137. package/dist/companion/companion-identity.d.ts +43 -0
  138. package/dist/companion/companion-identity.js +136 -0
  139. package/dist/companion/companion-toolset.d.ts +66 -0
  140. package/dist/companion/companion-toolset.js +368 -0
  141. package/dist/companion/companion-turn.d.ts +10 -2
  142. package/dist/companion/companion-turn.js +38 -1
  143. package/dist/config/code-exec-policy.d.ts +25 -0
  144. package/dist/config/code-exec-policy.js +39 -0
  145. package/dist/config/model-tools.d.ts +9 -0
  146. package/dist/config/model-tools.js +4 -0
  147. package/dist/context/context-manager-v2.js +2 -2
  148. package/dist/context/lm-resizer-compressor.js +3 -2
  149. package/dist/context/lm-resizer-diagnostics.d.ts +9 -0
  150. package/dist/context/lm-resizer-diagnostics.js +30 -0
  151. package/dist/context/tool-output-masking.js +3 -4
  152. package/dist/curator/curator.d.ts +6 -0
  153. package/dist/curator/curator.js +53 -3
  154. package/dist/daemon/cron-agent-bridge.d.ts +6 -0
  155. package/dist/daemon/cron-agent-bridge.js +31 -4
  156. package/dist/doctor/index.d.ts +11 -2
  157. package/dist/doctor/index.js +84 -21
  158. package/dist/doctor/integrations.d.ts +179 -0
  159. package/dist/doctor/integrations.js +227 -0
  160. package/dist/doctor/triage.d.ts +108 -0
  161. package/dist/doctor/triage.js +304 -0
  162. package/dist/fleet/collaboration.d.ts +44 -0
  163. package/dist/fleet/collaboration.js +170 -0
  164. package/dist/fleet/fleet-listener.d.ts +1 -0
  165. package/dist/fleet/fleet-listener.js +87 -46
  166. package/dist/fleet/fleet-registry.d.ts +2 -0
  167. package/dist/fleet/resource-catalog.d.ts +245 -0
  168. package/dist/fleet/resource-catalog.js +211 -0
  169. package/dist/fleet/rooms/room-access.d.ts +138 -0
  170. package/dist/fleet/rooms/room-access.js +196 -0
  171. package/dist/fleet/rooms/room-client.d.ts +158 -0
  172. package/dist/fleet/rooms/room-client.js +685 -0
  173. package/dist/fleet/rooms/room-event.d.ts +139 -0
  174. package/dist/fleet/rooms/room-event.js +330 -0
  175. package/dist/fleet/rooms/room-filter.d.ts +48 -0
  176. package/dist/fleet/rooms/room-filter.js +152 -0
  177. package/dist/fleet/rooms/room-hub.d.ts +154 -0
  178. package/dist/fleet/rooms/room-hub.js +363 -0
  179. package/dist/fleet/rooms/room-identity.d.ts +26 -0
  180. package/dist/fleet/rooms/room-identity.js +82 -0
  181. package/dist/fleet/rooms/room-lock.d.ts +34 -0
  182. package/dist/fleet/rooms/room-lock.js +180 -0
  183. package/dist/fleet/rooms/room-observations.d.ts +7 -0
  184. package/dist/fleet/rooms/room-observations.js +61 -0
  185. package/dist/fleet/rooms/room-server.d.ts +28 -0
  186. package/dist/fleet/rooms/room-server.js +75 -0
  187. package/dist/fleet/rooms/room-store.d.ts +119 -0
  188. package/dist/fleet/rooms/room-store.js +448 -0
  189. package/dist/fleet/rooms/room-ws-bridge.d.ts +27 -0
  190. package/dist/fleet/rooms/room-ws-bridge.js +137 -0
  191. package/dist/fleet/sensory-mission-bridge.d.ts +42 -0
  192. package/dist/fleet/sensory-mission-bridge.js +136 -0
  193. package/dist/git/worktree-sessions.js +1 -0
  194. package/dist/harness/contract.d.ts +4 -4
  195. package/dist/harness/fleet-supervisor.d.ts +16 -0
  196. package/dist/harness/fleet-supervisor.js +64 -0
  197. package/dist/harness/index.d.ts +4 -0
  198. package/dist/harness/index.js +4 -0
  199. package/dist/harness/mission-runner.d.ts +3 -0
  200. package/dist/harness/mission-runner.js +53 -0
  201. package/dist/harness/mission-store.d.ts +93 -0
  202. package/dist/harness/mission-store.js +297 -0
  203. package/dist/harness/tool-harness.d.ts +56 -0
  204. package/dist/harness/tool-harness.js +153 -0
  205. package/dist/hooks/use-enhanced-input.js +48 -4
  206. package/dist/hooks/use-input-handler.d.ts +1 -0
  207. package/dist/hooks/use-input-handler.js +82 -22
  208. package/dist/hooks/use-input-history.js +1 -0
  209. package/dist/identity/lisa-introspection.js +5 -2
  210. package/dist/identity/operational-self-model.d.ts +2 -0
  211. package/dist/identity/operational-self-model.js +4 -0
  212. package/dist/index.js +52 -6
  213. package/dist/mcp/client.js +6 -0
  214. package/dist/mcp/config.d.ts +20 -0
  215. package/dist/mcp/config.js +121 -8
  216. package/dist/mcp/import-normalize.d.ts +12 -0
  217. package/dist/mcp/import-normalize.js +114 -0
  218. package/dist/mcp/transports.d.ts +10 -5
  219. package/dist/mcp/transports.js +61 -99
  220. package/dist/mcp/types.d.ts +5 -0
  221. package/dist/media/comfyui-recipe-contract.d.ts +7 -7
  222. package/dist/memory/facts-memory.d.ts +11 -1
  223. package/dist/memory/facts-memory.js +47 -8
  224. package/dist/memory/memory-candidate-queue.d.ts +2 -2
  225. package/dist/memory/memory-candidate-queue.js +6 -6
  226. package/dist/memory/persistent-memory.d.ts +13 -8
  227. package/dist/memory/persistent-memory.js +77 -30
  228. package/dist/nodes/device-node.js +5 -9
  229. package/dist/observability/mobile-supervision-gateway-contract.js +20 -7
  230. package/dist/observability/run-event-writer.d.ts +21 -0
  231. package/dist/observability/run-event-writer.js +81 -0
  232. package/dist/observability/run-store.d.ts +5 -0
  233. package/dist/observability/run-store.js +18 -13
  234. package/dist/observability/run-trajectory.js +1 -1
  235. package/dist/optimization/prompt-cache.d.ts +19 -2
  236. package/dist/optimization/prompt-cache.js +41 -6
  237. package/dist/orchestration/orchestrator.d.ts +21 -0
  238. package/dist/orchestration/orchestrator.js +122 -15
  239. package/dist/persistence/session-content.d.ts +8 -0
  240. package/dist/persistence/session-content.js +76 -0
  241. package/dist/persistence/session-handoff.d.ts +64 -0
  242. package/dist/persistence/session-handoff.js +80 -0
  243. package/dist/persistence/session-history.d.ts +4 -0
  244. package/dist/persistence/session-history.js +38 -0
  245. package/dist/persistence/session-store.d.ts +9 -0
  246. package/dist/persistence/session-store.js +48 -20
  247. package/dist/personas/persona-manager.js +17 -1
  248. package/dist/plugins/code-explorer/CodeExplorerManager.d.ts +10 -4
  249. package/dist/plugins/code-explorer/CodeExplorerManager.js +69 -16
  250. package/dist/plugins/plugin-manager.js +10 -1
  251. package/dist/prompts/prompt-manager.js +11 -4
  252. package/dist/prompts/system-base.js +6 -2
  253. package/dist/protocols/a2a/codebuddy-executor.d.ts +11 -2
  254. package/dist/protocols/a2a/codebuddy-executor.js +9 -8
  255. package/dist/protocols/a2a/index.d.ts +1 -1
  256. package/dist/protocols/a2a/jsonrpc-v1.d.ts +41 -0
  257. package/dist/protocols/a2a/jsonrpc-v1.js +145 -0
  258. package/dist/protocols/a2a/peer-config.d.ts +20 -0
  259. package/dist/protocols/a2a/peer-config.js +55 -0
  260. package/dist/providers/codex-oauth.js +30 -6
  261. package/dist/providers/model-provider-compat.js +2 -1
  262. package/dist/sandbox/os-sandbox.d.ts +1 -1
  263. package/dist/scheduler/cron-scheduler.d.ts +15 -2
  264. package/dist/scheduler/cron-scheduler.js +35 -4
  265. package/dist/scheduler/job-notepad.d.ts +69 -0
  266. package/dist/scheduler/job-notepad.js +339 -0
  267. package/dist/security/audit-logger.d.ts +1 -1
  268. package/dist/security/compute-confinement.d.ts +4 -0
  269. package/dist/security/compute-confinement.js +89 -0
  270. package/dist/security/session-encryption.d.ts +4 -0
  271. package/dist/security/session-encryption.js +31 -0
  272. package/dist/sensory/voice-loop.d.ts +17 -0
  273. package/dist/sensory/voice-loop.js +72 -15
  274. package/dist/server/auth/device-session-context.d.ts +9 -0
  275. package/dist/server/auth/device-session-context.js +13 -0
  276. package/dist/server/auth/device-store.d.ts +89 -0
  277. package/dist/server/auth/device-store.js +261 -0
  278. package/dist/server/auth/device-token.d.ts +3 -0
  279. package/dist/server/auth/device-token.js +6 -0
  280. package/dist/server/auth/jwt.js +4 -0
  281. package/dist/server/index.d.ts +0 -10
  282. package/dist/server/index.js +28 -0
  283. package/dist/server/middleware/auth.js +3 -2
  284. package/dist/server/routes/a2a-jsonrpc.d.ts +9 -0
  285. package/dist/server/routes/a2a-jsonrpc.js +66 -0
  286. package/dist/server/routes/a2a-protocol.d.ts +12 -0
  287. package/dist/server/routes/a2a-protocol.js +1 -1
  288. package/dist/server/routes/device-auth.d.ts +4 -0
  289. package/dist/server/routes/device-auth.js +40 -0
  290. package/dist/server/types.d.ts +4 -0
  291. package/dist/server/websocket/handler.d.ts +13 -0
  292. package/dist/server/websocket/handler.js +102 -17
  293. package/dist/services/prompt-builder.d.ts +2 -0
  294. package/dist/services/prompt-builder.js +13 -5
  295. package/dist/services/runtime-settings-context.d.ts +73 -0
  296. package/dist/services/runtime-settings-context.js +69 -0
  297. package/dist/skills/executor.js +2 -0
  298. package/dist/skills/hub.js +16 -14
  299. package/dist/skills/local-inventory.d.ts +21 -0
  300. package/dist/skills/local-inventory.js +72 -0
  301. package/dist/skills/skill-loader.js +2 -2
  302. package/dist/skills/skill-usage-store.d.ts +49 -0
  303. package/dist/skills/skill-usage-store.js +121 -0
  304. package/dist/testing/ai-integration-tests.js +8 -5
  305. package/dist/themes/theme-manager.d.ts +12 -0
  306. package/dist/themes/theme-manager.js +29 -0
  307. package/dist/themes/theme-schema.d.ts +24 -24
  308. package/dist/tools/a2a-call-tool.d.ts +34 -0
  309. package/dist/tools/a2a-call-tool.js +75 -0
  310. package/dist/tools/bash/streaming-executor.d.ts +1 -0
  311. package/dist/tools/bash/streaming-executor.js +78 -90
  312. package/dist/tools/code-exec-preflight-runner.d.ts +41 -0
  313. package/dist/tools/code-exec-preflight-runner.js +254 -0
  314. package/dist/tools/code-exec-preflight.d.ts +44 -0
  315. package/dist/tools/code-exec-preflight.js +501 -0
  316. package/dist/tools/code-exec-tool.d.ts +48 -1
  317. package/dist/tools/code-exec-tool.js +191 -47
  318. package/dist/tools/comment-watcher.js +29 -12
  319. package/dist/tools/core-code-inspection.d.ts +56 -0
  320. package/dist/tools/core-code-inspection.js +86 -0
  321. package/dist/tools/create-skill-tool.d.ts +2 -3
  322. package/dist/tools/create-skill-tool.js +16 -75
  323. package/dist/tools/cronjob-tool.d.ts +1 -0
  324. package/dist/tools/cronjob-tool.js +1 -0
  325. package/dist/tools/env-doctor-tool.d.ts +2 -0
  326. package/dist/tools/env-doctor-tool.js +4 -3
  327. package/dist/tools/execute-code-rpc-invoker.d.ts +1 -1
  328. package/dist/tools/execute-code-rpc-invoker.js +35 -19
  329. package/dist/tools/execute-code-runner.d.ts +2 -0
  330. package/dist/tools/execute-code-runner.js +52 -17
  331. package/dist/tools/fleet-room-tool.d.ts +104 -0
  332. package/dist/tools/fleet-room-tool.js +124 -0
  333. package/dist/tools/integration-tool-hints.d.ts +4 -0
  334. package/dist/tools/integration-tool-hints.js +19 -0
  335. package/dist/tools/list-peers-tool.d.ts +3 -0
  336. package/dist/tools/list-peers-tool.js +11 -4
  337. package/dist/tools/media-generation-tool.d.ts +16 -1
  338. package/dist/tools/media-generation-tool.js +341 -9
  339. package/dist/tools/merge-conflict-tool.js +53 -25
  340. package/dist/tools/metadata.d.ts +1 -5
  341. package/dist/tools/metadata.js +21 -28
  342. package/dist/tools/ragchat-tool.d.ts +39 -0
  343. package/dist/tools/ragchat-tool.js +105 -0
  344. package/dist/tools/registry/fleet-tools.d.ts +9 -0
  345. package/dist/tools/registry/fleet-tools.js +22 -1
  346. package/dist/tools/registry/knowledge-tools.d.ts +2 -2
  347. package/dist/tools/registry/knowledge-tools.js +2 -2
  348. package/dist/tools/registry/lessons-tools.d.ts +7 -0
  349. package/dist/tools/registry/lessons-tools.js +43 -3
  350. package/dist/tools/registry/memory-tools.d.ts +1 -1
  351. package/dist/tools/registry/memory-tools.js +8 -8
  352. package/dist/tools/registry/research-tools.d.ts +1 -0
  353. package/dist/tools/registry/research-tools.js +4 -13
  354. package/dist/tools/registry/self-describe-tools.d.ts +1 -1
  355. package/dist/tools/registry/self-describe-tools.js +43 -30
  356. package/dist/tools/resource-catalog-tool.d.ts +38 -0
  357. package/dist/tools/resource-catalog-tool.js +46 -0
  358. package/dist/tools/skills-inspection-tool.js +30 -1
  359. package/dist/tools/stream-tool-output.d.ts +3 -0
  360. package/dist/tools/stream-tool-output.js +33 -0
  361. package/dist/tools/tool-call-scheduler.d.ts +10 -0
  362. package/dist/tools/tool-call-scheduler.js +58 -0
  363. package/dist/tools/tool-effect.d.ts +5 -0
  364. package/dist/tools/tool-effect.js +26 -0
  365. package/dist/tools/tool-search.d.ts +12 -11
  366. package/dist/tools/tool-search.js +67 -26
  367. package/dist/tools/types.d.ts +6 -0
  368. package/dist/ui/components/ChatHistory.d.ts +1 -1
  369. package/dist/ui/components/ChatHistory.js +2 -2
  370. package/dist/ui/components/ChatInput.d.ts +2 -1
  371. package/dist/ui/components/ChatInput.js +42 -88
  372. package/dist/ui/components/ChatInterface.d.ts +4 -2
  373. package/dist/ui/components/ChatInterface.js +27 -63
  374. package/dist/ui/components/CommandSuggestions.d.ts +0 -1
  375. package/dist/ui/components/CommandSuggestions.js +4 -6
  376. package/dist/ui/components/FileAutocomplete.js +1 -1
  377. package/dist/ui/components/KeyboardHelp.js +8 -6
  378. package/dist/ui/components/ModelSelection.js +6 -5
  379. package/dist/ui/components/StatusBar.d.ts +2 -1
  380. package/dist/ui/components/StatusBar.js +8 -7
  381. package/dist/ui/context/theme-context.js +3 -2
  382. package/dist/ui/index.d.ts +1 -1
  383. package/dist/ui/index.js +1 -1
  384. package/dist/ui/utils/markdown-renderer.js +4 -13
  385. package/dist/utils/atomic-write.d.ts +22 -0
  386. package/dist/utils/atomic-write.js +29 -0
  387. package/dist/utils/bounded-output.d.ts +16 -0
  388. package/dist/utils/bounded-output.js +63 -0
  389. package/dist/utils/device-store-file.d.ts +4 -0
  390. package/dist/utils/device-store-file.js +40 -0
  391. package/dist/utils/export-manager.d.ts +9 -0
  392. package/dist/utils/export-manager.js +19 -0
  393. package/dist/utils/first-use-hints.d.ts +25 -0
  394. package/dist/utils/first-use-hints.js +58 -0
  395. package/dist/utils/history-manager.js +1 -1
  396. package/dist/utils/update-notifier.js +16 -18
  397. package/dist/wizard/environment-detection.d.ts +5 -1
  398. package/dist/wizard/environment-detection.js +49 -7
  399. package/dist/wizard/onboarding.d.ts +5 -1
  400. package/dist/wizard/onboarding.js +90 -30
  401. package/dist/wizard/provider-onboarding.d.ts +2 -0
  402. package/dist/wizard/provider-onboarding.js +55 -17
  403. package/package.json +7 -3
@@ -0,0 +1,136 @@
1
+ /** Outbound status only. This module never emits perceptions or authorizes actions. */
2
+ import { randomUUID } from 'node:crypto';
3
+ import { logger } from '../utils/logger.js';
4
+ /** Adapt a local signed-room publisher without importing the hub or its keys.
5
+ * The injected publisher must retain the same signing key across retries, build
6
+ * a kind-9 message with these exact content/createdAt values, and resolve only
7
+ * on durable acceptance (including an already-stored duplicate).
8
+ * JSON includes observation.id, so equal samples from distinct observations
9
+ * cannot collide; stable receivedAt keeps the signed event id stable on retry.
10
+ */
11
+ export function createMissionObservationRoomPublisher(room, publish) {
12
+ if (!/^[a-z0-9][a-z0-9_-]{0,63}$/.test(room))
13
+ throw new Error('Invalid observation room');
14
+ return async (observation, signal) => {
15
+ signal.throwIfAborted();
16
+ await publish(room, JSON.stringify(observation), Math.floor(observation.receivedAt / 1000), signal);
17
+ };
18
+ }
19
+ const FIELDS = {
20
+ heartbeat: ['load1'], // beat/uptime counters intentionally do not defeat change dedupe
21
+ resource_threshold: ['rssMb', 'heapUsedMb', 'load1', 'vramPct', 'vramUsedMb', 'diskPct', 'diskFreeBytes', 'fleetUtilization', 'fleetSaturated'],
22
+ disk_low: ['diskPct', 'diskFreeBytes'],
23
+ fleet_saturated: ['fleetUtilization'],
24
+ };
25
+ function record(value) {
26
+ return value !== null && typeof value === 'object' && !Array.isArray(value);
27
+ }
28
+ /** Disabled or unconfigured means zero subscriptions, timers, and publications.
29
+ * Exactly four possible keys bound queued status snapshots and dedupe memory.
30
+ * Replacing a queued snapshot coalesces bursts; this is status, not an audit log
31
+ * of every physical transition. Incoming remote messages must use a separate bus.
32
+ */
33
+ export function wireSensoryMissionBridge(options) {
34
+ const missionId = options.missionId;
35
+ if (options.enabled !== true || !missionId || !/^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/.test(missionId))
36
+ return () => { };
37
+ const intervalMs = options.intervalMs ?? 5_000;
38
+ if (!Number.isFinite(intervalMs) || intervalMs < 1_000 || intervalMs > 60_000) {
39
+ throw new Error('Observation interval must be between 1000 and 60000 ms');
40
+ }
41
+ const now = options.now ?? Date.now;
42
+ const pending = new Map();
43
+ const delivered = new Map();
44
+ const controller = new AbortController();
45
+ let active = true;
46
+ let publishing = false;
47
+ const listenerId = options.bus.on('sensory:perception', (event) => {
48
+ if (!active || !record(event.metadata))
49
+ return;
50
+ const meta = event.metadata;
51
+ const kind = meta.kind;
52
+ if (typeof kind !== 'string' || !Object.hasOwn(FIELDS, kind))
53
+ return;
54
+ if (event.source === 'buddy-sense') {
55
+ if (meta.modality !== 'vital' || kind !== 'heartbeat')
56
+ return;
57
+ }
58
+ else if (event.source === 'system-vitals') {
59
+ if (meta.modality !== 'system' || kind === 'heartbeat')
60
+ return;
61
+ }
62
+ else
63
+ return; // Includes remote, domain-bridge, and missing sources.
64
+ if (!record(meta.payload))
65
+ return;
66
+ const values = {};
67
+ for (const field of FIELDS[kind]) {
68
+ const value = meta.payload[field];
69
+ if (value === undefined || value === null)
70
+ continue;
71
+ if (field === 'fleetSaturated') {
72
+ if (typeof value !== 'boolean')
73
+ return;
74
+ }
75
+ else if (typeof value !== 'number' || !Number.isFinite(value) || value < 0 || value > Number.MAX_SAFE_INTEGER
76
+ || ((field === 'diskPct' || field === 'vramPct') && value > 100))
77
+ return;
78
+ values[field] = value;
79
+ }
80
+ if (Object.keys(values).length === 0)
81
+ return;
82
+ const fingerprint = JSON.stringify(values);
83
+ if (pending.get(kind)?.fingerprint === fingerprint)
84
+ return;
85
+ const receivedAt = now();
86
+ if (!Number.isFinite(receivedAt) || receivedAt < 0)
87
+ return;
88
+ pending.set(kind, {
89
+ observation: {
90
+ id: randomUUID(), missionId, type: 'observation', source: event.source,
91
+ kind: kind, receivedAt,
92
+ ...(typeof meta.tsMs === 'number' && Number.isFinite(meta.tsMs) && meta.tsMs >= 0 ? { observedAt: meta.tsMs } : {}),
93
+ values,
94
+ },
95
+ fingerprint, attempts: 0,
96
+ });
97
+ });
98
+ const timer = setInterval(() => {
99
+ if (!active || publishing)
100
+ return;
101
+ const first = pending.entries().next().value;
102
+ if (!first)
103
+ return;
104
+ const [key, item] = first;
105
+ pending.delete(key);
106
+ if (delivered.get(key) === item.fingerprint)
107
+ return;
108
+ publishing = true;
109
+ // Promise boundary captures synchronous publisher failures too.
110
+ void Promise.resolve().then(() => {
111
+ if (active)
112
+ return options.publish(item.observation, controller.signal);
113
+ return undefined;
114
+ }).then(() => {
115
+ if (active)
116
+ delivered.set(key, item.fingerprint);
117
+ }).catch(() => {
118
+ if (active && !pending.has(key) && ++item.attempts < 3)
119
+ pending.set(key, item);
120
+ if (active)
121
+ logger.warn('[sensory-mission] observation publication failed');
122
+ }).finally(() => { publishing = false; });
123
+ }, intervalMs);
124
+ timer.unref();
125
+ return () => {
126
+ if (!active)
127
+ return;
128
+ active = false;
129
+ clearInterval(timer);
130
+ options.bus.off(listenerId);
131
+ pending.clear();
132
+ delivered.clear();
133
+ controller.abort();
134
+ };
135
+ }
136
+ //# sourceMappingURL=sensory-mission-bridge.js.map
@@ -76,6 +76,7 @@ export class WorktreeSessionManager {
76
76
  return false;
77
77
  try {
78
78
  execSync(`git worktree remove "${session.worktreePath}" --force`, {
79
+ cwd: session.worktreePath,
79
80
  stdio: 'pipe',
80
81
  });
81
82
  }
@@ -137,7 +137,7 @@ export declare const runSchema: z.ZodObject<{
137
137
  organ?: string | undefined;
138
138
  }>>;
139
139
  }, "strict", z.ZodTypeAny, {
140
- status: "cancelled" | "running" | "completed" | "failed" | "queued" | "waiting_approval";
140
+ status: "cancelled" | "failed" | "running" | "completed" | "queued" | "waiting_approval";
141
141
  id: string;
142
142
  kind: "run";
143
143
  schemaVersion: 1;
@@ -167,7 +167,7 @@ export declare const runSchema: z.ZodObject<{
167
167
  parentRunId?: string | undefined;
168
168
  endedAt?: number | undefined;
169
169
  }, {
170
- status: "cancelled" | "running" | "completed" | "failed" | "queued" | "waiting_approval";
170
+ status: "cancelled" | "failed" | "running" | "completed" | "queued" | "waiting_approval";
171
171
  id: string;
172
172
  kind: "run";
173
173
  schemaVersion: 1;
@@ -565,7 +565,7 @@ export declare const harnessArtifactSchema: z.ZodDiscriminatedUnion<"kind", [z.Z
565
565
  organ?: string | undefined;
566
566
  }>>;
567
567
  }, "strict", z.ZodTypeAny, {
568
- status: "cancelled" | "running" | "completed" | "failed" | "queued" | "waiting_approval";
568
+ status: "cancelled" | "failed" | "running" | "completed" | "queued" | "waiting_approval";
569
569
  id: string;
570
570
  kind: "run";
571
571
  schemaVersion: 1;
@@ -595,7 +595,7 @@ export declare const harnessArtifactSchema: z.ZodDiscriminatedUnion<"kind", [z.Z
595
595
  parentRunId?: string | undefined;
596
596
  endedAt?: number | undefined;
597
597
  }, {
598
- status: "cancelled" | "running" | "completed" | "failed" | "queued" | "waiting_approval";
598
+ status: "cancelled" | "failed" | "running" | "completed" | "queued" | "waiting_approval";
599
599
  id: string;
600
600
  kind: "run";
601
601
  schemaVersion: 1;
@@ -0,0 +1,16 @@
1
+ import type { ToolResult } from '../types/index.js';
2
+ interface SupervisorOperation {
3
+ command: string;
4
+ args: string[];
5
+ timeoutMs: number;
6
+ description: string;
7
+ }
8
+ export interface SupervisorManifest {
9
+ workspace: string;
10
+ operations: Map<string, SupervisorOperation>;
11
+ }
12
+ export declare function parseSupervisorManifest(input: unknown, baseDir: string, maxTimeoutMs?: number): SupervisorManifest;
13
+ export declare function runSupervisor(manifestPath: string, action: string, options?: {
14
+ signal?: AbortSignal;
15
+ }): Promise<ToolResult>;
16
+ export {};
@@ -0,0 +1,64 @@
1
+ /** Fixed host operations exposed through Code Buddy's programmatic tool harness.
2
+ * The manifest is an operator-owned permission boundary, never model-generated input.
3
+ */
4
+ import fs from 'node:fs/promises';
5
+ import path from 'node:path';
6
+ import { ToolHarness } from './tool-harness.js';
7
+ import { runProc } from '../agent/self-improvement/evolution/variant-fitness.js';
8
+ function record(value) { return !!value && typeof value === 'object' && !Array.isArray(value); }
9
+ export function parseSupervisorManifest(input, baseDir, maxTimeoutMs = 45000) {
10
+ if (!record(input) || typeof input.workspace !== 'string')
11
+ throw new Error('workspace is required');
12
+ const workspace = path.resolve(baseDir, input.workspace);
13
+ if (!record(input.operations))
14
+ throw new Error('operations must be an object');
15
+ const operations = new Map();
16
+ for (const [name, operation] of Object.entries(input.operations)) {
17
+ if (!/^[a-z][a-z0-9_]{0,63}$/.test(name) || ['tool_search', 'exec', 'code_exec'].includes(name))
18
+ throw new Error(`Invalid operation name: ${name}`);
19
+ if (!record(operation) || typeof operation.command !== 'string' || !operation.command || operation.command.includes('\0'))
20
+ throw new Error(`Invalid command: ${name}`);
21
+ if (!Array.isArray(operation.args) || !operation.args.every(arg => typeof arg === 'string' && !arg.includes('\0')))
22
+ throw new Error(`Invalid arguments: ${name}`);
23
+ const timeoutMs = operation.timeoutMs ?? 30000;
24
+ if (typeof timeoutMs !== 'number' || !Number.isInteger(timeoutMs) || timeoutMs < 100 || timeoutMs > maxTimeoutMs)
25
+ throw new Error(`Invalid timeout: ${name}`);
26
+ operations.set(name, { command: operation.command, args: [...operation.args], timeoutMs, description: typeof operation.description === 'string' ? operation.description : name });
27
+ }
28
+ if (!operations.size || operations.size > 64)
29
+ throw new Error('Define between 1 and 64 fixed operations');
30
+ return { workspace, operations };
31
+ }
32
+ export async function runSupervisor(manifestPath, action, options = {}) {
33
+ const resolved = path.resolve(manifestPath);
34
+ const manifest = parseSupervisorManifest(JSON.parse(await fs.readFile(resolved, 'utf8')), path.dirname(resolved));
35
+ if (!manifest.operations.has(action))
36
+ throw new Error(`Unknown operation: ${action}`);
37
+ const harness = new ToolHarness({
38
+ cwd: manifest.workspace,
39
+ tools: [...manifest.operations].map(([name, operation]) => ({ type: 'function', function: {
40
+ name, description: operation.description,
41
+ parameters: { type: 'object', properties: {}, required: [], additionalProperties: false },
42
+ } })),
43
+ dispatch: async (name, args, signal) => {
44
+ const operation = manifest.operations.get(name);
45
+ if (!operation || Object.keys(args).length)
46
+ return { success: false, error: 'Only fixed manifest operations are authorized' };
47
+ if (signal?.aborted)
48
+ return { success: false, error: 'Cancelled before dispatch' };
49
+ const result = await runProc(operation.command, operation.args, {
50
+ checkoutDir: manifest.workspace, timeoutMs: operation.timeoutMs, signal,
51
+ });
52
+ return { success: result.code === 0 && !result.timedOut, output: result.stdout,
53
+ ...(result.code ? { error: result.stderr || `Operation exited with code ${result.code}` } : {}),
54
+ data: { exitCode: result.code, timedOut: result.timedOut } };
55
+ },
56
+ });
57
+ try {
58
+ return await harness.exec(`const r=await tools.call(${JSON.stringify(action)},{}); text(r); if(!r.success) throw new Error(r.error);`, { timeoutMs: 60000, signal: options.signal });
59
+ }
60
+ finally {
61
+ await harness.dispose();
62
+ }
63
+ }
64
+ //# sourceMappingURL=fleet-supervisor.js.map
@@ -1,2 +1,6 @@
1
1
  export * from './contract.js';
2
2
  export * from './run-store-adapter.js';
3
+ export * from './tool-harness.js';
4
+ export * from './fleet-supervisor.js';
5
+ export * from './mission-store.js';
6
+ export * from './mission-runner.js';
@@ -1,3 +1,7 @@
1
1
  export * from './contract.js';
2
2
  export * from './run-store-adapter.js';
3
+ export * from './tool-harness.js';
4
+ export * from './fleet-supervisor.js';
5
+ export * from './mission-store.js';
6
+ export * from './mission-runner.js';
3
7
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
1
+ import { MissionStore, type Mission, type MissionAuthority } from './mission-store.js';
2
+ /** Runs in the calling process; persisted intent survives a pilot crash, execution is never replayed implicitly. */
3
+ export declare function runMission(store: MissionStore, id: string, authority: MissionAuthority, signal?: AbortSignal): Promise<Mission>;
@@ -0,0 +1,53 @@
1
+ import { runProc } from '../agent/self-improvement/evolution/variant-fitness.js';
2
+ import { MissionBusyError } from './mission-store.js';
3
+ /** Runs in the calling process; persisted intent survives a pilot crash, execution is never replayed implicitly. */
4
+ export async function runMission(store, id, authority, signal) {
5
+ const controller = new AbortController();
6
+ const cancel = () => controller.abort();
7
+ if (signal?.aborted)
8
+ throw new Error('Cancelled before starting mission');
9
+ signal?.addEventListener('abort', cancel, { once: true });
10
+ let timer;
11
+ let lostAuthority;
12
+ try {
13
+ store.renew(id, authority);
14
+ const mission = store.start(id, authority);
15
+ timer = setInterval(() => {
16
+ try {
17
+ store.renew(id, authority);
18
+ }
19
+ catch (error) {
20
+ try {
21
+ if (error instanceof MissionBusyError && (store.get(id).expiresAt ?? 0) > Date.now() + 20000)
22
+ return;
23
+ }
24
+ catch { /* An unreadable lease is not authority to keep executing. */ }
25
+ lostAuthority = error;
26
+ controller.abort();
27
+ }
28
+ }, 15000);
29
+ const op = mission.operation;
30
+ const result = await runProc(op.command, op.args, { checkoutDir: op.workspace, timeoutMs: op.timeoutMs, signal: controller.signal });
31
+ if (lostAuthority)
32
+ throw lostAuthority;
33
+ const finish = () => store.complete(id, authority, {
34
+ success: result.code === 0 && !result.timedOut, stdout: result.stdout, stderr: result.stderr, exitCode: result.code,
35
+ });
36
+ for (let retry = 0;; retry++) {
37
+ try {
38
+ return finish();
39
+ }
40
+ catch (error) {
41
+ if (!(error instanceof MissionBusyError) || retry >= 20)
42
+ throw error;
43
+ await new Promise(resolve => setTimeout(resolve, 50));
44
+ }
45
+ }
46
+ }
47
+ finally {
48
+ if (timer)
49
+ clearInterval(timer);
50
+ signal?.removeEventListener('abort', cancel);
51
+ }
52
+ }
53
+ //# sourceMappingURL=mission-runner.js.map
@@ -0,0 +1,93 @@
1
+ export interface MissionAuthority {
2
+ owner: string;
3
+ generation: string;
4
+ }
5
+ export interface MissionHandoff {
6
+ succeeded: string[];
7
+ failed: string[];
8
+ keyFiles: string[];
9
+ deadEnds: string[];
10
+ nextAction: string;
11
+ }
12
+ export interface MissionOperation {
13
+ command: string;
14
+ args: string[];
15
+ workspace: string;
16
+ timeoutMs: number;
17
+ }
18
+ export interface Mission {
19
+ schema: 1;
20
+ id: string;
21
+ revision: number;
22
+ status: 'ready' | 'claimed' | 'running' | 'handoff' | 'completed';
23
+ operation: MissionOperation;
24
+ authority?: MissionAuthority;
25
+ expiresAt?: number;
26
+ handoff?: MissionHandoff;
27
+ result?: {
28
+ success: boolean;
29
+ stdout: string;
30
+ stderr: string;
31
+ exitCode: number;
32
+ truncated?: boolean;
33
+ };
34
+ review?: {
35
+ commit: string;
36
+ author: string;
37
+ reviewer?: string;
38
+ };
39
+ acknowledgedBy?: string;
40
+ updatedAt: number;
41
+ }
42
+ /** Public catalogue projection: no command, result text, handoff or authority token. */
43
+ export interface MissionSummary {
44
+ id: string;
45
+ revision: number;
46
+ status: Mission['status'];
47
+ updatedAt: number;
48
+ owner?: string;
49
+ expiresAt?: number;
50
+ leaseExpired?: boolean;
51
+ success?: boolean;
52
+ acknowledged: boolean;
53
+ }
54
+ export interface MissionListPage {
55
+ missions: MissionSummary[];
56
+ errors: Array<{
57
+ file: string;
58
+ error: 'Invalid or unreadable mission record';
59
+ }>;
60
+ /** Last scanned filename hash; pages reflect live state, not a frozen snapshot. */
61
+ nextCursor?: string;
62
+ }
63
+ export declare class MissionBusyError extends Error {
64
+ constructor();
65
+ }
66
+ export declare class MissionStore {
67
+ readonly directory: string;
68
+ private readonly now;
69
+ constructor(directory: string, now?: () => number);
70
+ private file;
71
+ get(id: string): Mission;
72
+ private read;
73
+ /** Metadata only in the result. Validate at most one bounded record per page slot. */
74
+ list(options?: {
75
+ limit?: number;
76
+ cursor?: string;
77
+ }): MissionListPage;
78
+ /** Synchronous critical section, exclusive across processes; never steal a mutation lock. */
79
+ private change;
80
+ create(id: string, operation: MissionOperation): Mission;
81
+ claim(id: string, owner: string, leaseMs?: number): Mission;
82
+ private lease;
83
+ private owned;
84
+ renew(id: string, a: MissionAuthority, leaseMs?: number): Mission;
85
+ start(id: string, a: MissionAuthority): Mission;
86
+ complete(id: string, a: MissionAuthority, result: NonNullable<Mission['result']>): Mission;
87
+ handoff(id: string, a: MissionAuthority, handoff: MissionHandoff): Mission;
88
+ /** Explicit operator reconciliation only; an ambiguous effect is never retried automatically. */
89
+ reconcile(id: string, generation: string, resolution: 'retry' | 'completed', note: string): Mission;
90
+ acknowledge(id: string, consumer: string): Mission;
91
+ submit(id: string, a: MissionAuthority, commit: string): Mission;
92
+ approve(id: string, reviewer: string, expectedCommit: string): Mission;
93
+ }