attocode 0.2.4 → 0.2.6

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 (813) hide show
  1. package/CHANGELOG.md +88 -1
  2. package/dist/src/adapters.d.ts +39 -1
  3. package/dist/src/adapters.d.ts.map +1 -1
  4. package/dist/src/adapters.js +201 -16
  5. package/dist/src/adapters.js.map +1 -1
  6. package/dist/src/agent/agent-builder.d.ts +117 -0
  7. package/dist/src/agent/agent-builder.d.ts.map +1 -0
  8. package/dist/src/agent/agent-builder.js +204 -0
  9. package/dist/src/agent/agent-builder.js.map +1 -0
  10. package/dist/src/agent/feature-initializer.d.ts +80 -0
  11. package/dist/src/agent/feature-initializer.d.ts.map +1 -0
  12. package/dist/src/agent/feature-initializer.js +676 -0
  13. package/dist/src/agent/feature-initializer.js.map +1 -0
  14. package/dist/src/agent/index.d.ts +13 -0
  15. package/dist/src/agent/index.d.ts.map +1 -0
  16. package/dist/src/agent/index.js +13 -0
  17. package/dist/src/agent/index.js.map +1 -0
  18. package/dist/src/agent/message-builder.d.ts +50 -0
  19. package/dist/src/agent/message-builder.d.ts.map +1 -0
  20. package/dist/src/agent/message-builder.js +176 -0
  21. package/dist/src/agent/message-builder.js.map +1 -0
  22. package/dist/src/agent/session-api.d.ts +94 -0
  23. package/dist/src/agent/session-api.d.ts.map +1 -0
  24. package/dist/src/agent/session-api.js +264 -0
  25. package/dist/src/agent/session-api.js.map +1 -0
  26. package/dist/src/agent-tools/lsp-file-tools.d.ts +1 -1
  27. package/dist/src/agent-tools/lsp-file-tools.d.ts.map +1 -1
  28. package/dist/src/agent-tools/lsp-file-tools.js +17 -13
  29. package/dist/src/agent-tools/lsp-file-tools.js.map +1 -1
  30. package/dist/src/agent.d.ts +26 -117
  31. package/dist/src/agent.d.ts.map +1 -1
  32. package/dist/src/agent.js +239 -1249
  33. package/dist/src/agent.js.map +1 -1
  34. package/dist/src/analysis/feedback-loop.d.ts.map +1 -1
  35. package/dist/src/analysis/feedback-loop.js +13 -9
  36. package/dist/src/analysis/feedback-loop.js.map +1 -1
  37. package/dist/src/analysis/index.d.ts +1 -1
  38. package/dist/src/analysis/index.d.ts.map +1 -1
  39. package/dist/src/analysis/index.js +1 -1
  40. package/dist/src/analysis/index.js.map +1 -1
  41. package/dist/src/analysis/prompt-templates.d.ts.map +1 -1
  42. package/dist/src/analysis/prompt-templates.js.map +1 -1
  43. package/dist/src/analysis/trace-summary.d.ts.map +1 -1
  44. package/dist/src/analysis/trace-summary.js +25 -9
  45. package/dist/src/analysis/trace-summary.js.map +1 -1
  46. package/dist/src/cli.d.ts.map +1 -1
  47. package/dist/src/cli.js +4 -2
  48. package/dist/src/cli.js.map +1 -1
  49. package/dist/src/commands/agents-commands.d.ts.map +1 -1
  50. package/dist/src/commands/agents-commands.js +3 -3
  51. package/dist/src/commands/agents-commands.js.map +1 -1
  52. package/dist/src/commands/handler.d.ts.map +1 -1
  53. package/dist/src/commands/handler.js +68 -44
  54. package/dist/src/commands/handler.js.map +1 -1
  55. package/dist/src/commands/init-commands.d.ts.map +1 -1
  56. package/dist/src/commands/init-commands.js +8 -10
  57. package/dist/src/commands/init-commands.js.map +1 -1
  58. package/dist/src/commands/init.js +17 -17
  59. package/dist/src/commands/init.js.map +1 -1
  60. package/dist/src/commands/skills-commands.d.ts.map +1 -1
  61. package/dist/src/commands/skills-commands.js +10 -7
  62. package/dist/src/commands/skills-commands.js.map +1 -1
  63. package/dist/src/commands/types.d.ts.map +1 -1
  64. package/dist/src/config/config-manager.d.ts.map +1 -1
  65. package/dist/src/config/config-manager.js +4 -1
  66. package/dist/src/config/config-manager.js.map +1 -1
  67. package/dist/src/config/index.d.ts +1 -1
  68. package/dist/src/config/index.d.ts.map +1 -1
  69. package/dist/src/config/schema.d.ts +6 -6
  70. package/dist/src/config/schema.d.ts.map +1 -1
  71. package/dist/src/config/schema.js +6 -2
  72. package/dist/src/config/schema.js.map +1 -1
  73. package/dist/src/core/agent-state-machine.d.ts.map +1 -1
  74. package/dist/src/core/agent-state-machine.js +5 -2
  75. package/dist/src/core/agent-state-machine.js.map +1 -1
  76. package/dist/src/core/completion-analyzer.d.ts.map +1 -1
  77. package/dist/src/core/completion-analyzer.js +2 -2
  78. package/dist/src/core/completion-analyzer.js.map +1 -1
  79. package/dist/src/core/execution-loop.d.ts +172 -1
  80. package/dist/src/core/execution-loop.d.ts.map +1 -1
  81. package/dist/src/core/execution-loop.js +597 -360
  82. package/dist/src/core/execution-loop.js.map +1 -1
  83. package/dist/src/core/index.d.ts +2 -2
  84. package/dist/src/core/index.d.ts.map +1 -1
  85. package/dist/src/core/index.js +1 -1
  86. package/dist/src/core/index.js.map +1 -1
  87. package/dist/src/core/queues/event-queue.d.ts.map +1 -1
  88. package/dist/src/core/queues/event-queue.js.map +1 -1
  89. package/dist/src/core/response-handler.d.ts.map +1 -1
  90. package/dist/src/core/response-handler.js +20 -10
  91. package/dist/src/core/response-handler.js.map +1 -1
  92. package/dist/src/core/subagent-spawner.d.ts.map +1 -1
  93. package/dist/src/core/subagent-spawner.js +98 -59
  94. package/dist/src/core/subagent-spawner.js.map +1 -1
  95. package/dist/src/core/tool-executor.d.ts.map +1 -1
  96. package/dist/src/core/tool-executor.js +63 -27
  97. package/dist/src/core/tool-executor.js.map +1 -1
  98. package/dist/src/core/types.d.ts +1 -0
  99. package/dist/src/core/types.d.ts.map +1 -1
  100. package/dist/src/core/types.js.map +1 -1
  101. package/dist/src/costs/model-registry.js +6 -6
  102. package/dist/src/costs/model-registry.js.map +1 -1
  103. package/dist/src/defaults.d.ts.map +1 -1
  104. package/dist/src/defaults.js +67 -20
  105. package/dist/src/defaults.js.map +1 -1
  106. package/dist/src/errors/index.d.ts.map +1 -1
  107. package/dist/src/errors/index.js +6 -8
  108. package/dist/src/errors/index.js.map +1 -1
  109. package/dist/src/first-run.d.ts.map +1 -1
  110. package/dist/src/first-run.js +11 -11
  111. package/dist/src/first-run.js.map +1 -1
  112. package/dist/src/integrations/agents/agent-registry.d.ts +262 -0
  113. package/dist/src/integrations/agents/agent-registry.d.ts.map +1 -0
  114. package/dist/src/integrations/agents/agent-registry.js +686 -0
  115. package/dist/src/integrations/agents/agent-registry.js.map +1 -0
  116. package/dist/src/integrations/agents/async-subagent.d.ts +135 -0
  117. package/dist/src/integrations/agents/async-subagent.d.ts.map +1 -0
  118. package/dist/src/integrations/agents/async-subagent.js +211 -0
  119. package/dist/src/integrations/agents/async-subagent.js.map +1 -0
  120. package/dist/src/integrations/agents/complexity-classifier.d.ts +86 -0
  121. package/dist/src/integrations/agents/complexity-classifier.d.ts.map +1 -0
  122. package/dist/src/integrations/agents/complexity-classifier.js +264 -0
  123. package/dist/src/integrations/agents/complexity-classifier.js.map +1 -0
  124. package/dist/src/integrations/agents/delegation-protocol.d.ts +86 -0
  125. package/dist/src/integrations/agents/delegation-protocol.d.ts.map +1 -0
  126. package/dist/src/integrations/agents/delegation-protocol.js +127 -0
  127. package/dist/src/integrations/agents/delegation-protocol.js.map +1 -0
  128. package/dist/src/integrations/agents/multi-agent.d.ts +150 -0
  129. package/dist/src/integrations/agents/multi-agent.d.ts.map +1 -0
  130. package/dist/src/integrations/agents/multi-agent.js +302 -0
  131. package/dist/src/integrations/agents/multi-agent.js.map +1 -0
  132. package/dist/src/integrations/agents/result-synthesizer.d.ts +389 -0
  133. package/dist/src/integrations/agents/result-synthesizer.d.ts.map +1 -0
  134. package/dist/src/integrations/agents/result-synthesizer.js +953 -0
  135. package/dist/src/integrations/agents/result-synthesizer.js.map +1 -0
  136. package/dist/src/integrations/agents/shared-blackboard.d.ts +406 -0
  137. package/dist/src/integrations/agents/shared-blackboard.d.ts.map +1 -0
  138. package/dist/src/integrations/agents/shared-blackboard.js +757 -0
  139. package/dist/src/integrations/agents/shared-blackboard.js.map +1 -0
  140. package/dist/src/integrations/agents/subagent-output-store.d.ts +91 -0
  141. package/dist/src/integrations/agents/subagent-output-store.d.ts.map +1 -0
  142. package/dist/src/integrations/agents/subagent-output-store.js +256 -0
  143. package/dist/src/integrations/agents/subagent-output-store.js.map +1 -0
  144. package/dist/src/integrations/budget/budget-pool.d.ts +115 -0
  145. package/dist/src/integrations/budget/budget-pool.d.ts.map +1 -0
  146. package/dist/src/integrations/budget/budget-pool.js +201 -0
  147. package/dist/src/integrations/budget/budget-pool.js.map +1 -0
  148. package/dist/src/integrations/budget/cancellation.d.ts +229 -0
  149. package/dist/src/integrations/budget/cancellation.d.ts.map +1 -0
  150. package/dist/src/integrations/budget/cancellation.js +534 -0
  151. package/dist/src/integrations/budget/cancellation.js.map +1 -0
  152. package/dist/src/integrations/budget/dynamic-budget.d.ts +81 -0
  153. package/dist/src/integrations/budget/dynamic-budget.d.ts.map +1 -0
  154. package/dist/src/integrations/budget/dynamic-budget.js +149 -0
  155. package/dist/src/integrations/budget/dynamic-budget.js.map +1 -0
  156. package/dist/src/integrations/budget/economics.d.ts +435 -0
  157. package/dist/src/integrations/budget/economics.d.ts.map +1 -0
  158. package/dist/src/integrations/budget/economics.js +1039 -0
  159. package/dist/src/integrations/budget/economics.js.map +1 -0
  160. package/dist/src/integrations/budget/injection-budget.d.ts +71 -0
  161. package/dist/src/integrations/budget/injection-budget.d.ts.map +1 -0
  162. package/dist/src/integrations/budget/injection-budget.js +137 -0
  163. package/dist/src/integrations/budget/injection-budget.js.map +1 -0
  164. package/dist/src/integrations/budget/loop-detector.d.ts +105 -0
  165. package/dist/src/integrations/budget/loop-detector.d.ts.map +1 -0
  166. package/dist/src/integrations/budget/loop-detector.js +304 -0
  167. package/dist/src/integrations/budget/loop-detector.js.map +1 -0
  168. package/dist/src/integrations/budget/phase-tracker.d.ts +114 -0
  169. package/dist/src/integrations/budget/phase-tracker.d.ts.map +1 -0
  170. package/dist/src/integrations/budget/phase-tracker.js +265 -0
  171. package/dist/src/integrations/budget/phase-tracker.js.map +1 -0
  172. package/dist/src/integrations/budget/resources.d.ts +182 -0
  173. package/dist/src/integrations/budget/resources.d.ts.map +1 -0
  174. package/dist/src/integrations/budget/resources.js +362 -0
  175. package/dist/src/integrations/budget/resources.js.map +1 -0
  176. package/dist/src/integrations/context/auto-compaction.d.ts +210 -0
  177. package/dist/src/integrations/context/auto-compaction.d.ts.map +1 -0
  178. package/dist/src/integrations/context/auto-compaction.js +485 -0
  179. package/dist/src/integrations/context/auto-compaction.js.map +1 -0
  180. package/dist/src/integrations/context/code-analyzer.d.ts +71 -0
  181. package/dist/src/integrations/context/code-analyzer.d.ts.map +1 -0
  182. package/dist/src/integrations/context/code-analyzer.js +445 -0
  183. package/dist/src/integrations/context/code-analyzer.js.map +1 -0
  184. package/dist/src/integrations/context/code-selector.d.ts +78 -0
  185. package/dist/src/integrations/context/code-selector.d.ts.map +1 -0
  186. package/dist/src/integrations/context/code-selector.js +668 -0
  187. package/dist/src/integrations/context/code-selector.js.map +1 -0
  188. package/dist/src/integrations/context/codebase-ast.d.ts +138 -0
  189. package/dist/src/integrations/context/codebase-ast.d.ts.map +1 -0
  190. package/dist/src/integrations/context/codebase-ast.js +881 -0
  191. package/dist/src/integrations/context/codebase-ast.js.map +1 -0
  192. package/dist/src/integrations/context/codebase-context.d.ts +473 -0
  193. package/dist/src/integrations/context/codebase-context.d.ts.map +1 -0
  194. package/dist/src/integrations/context/codebase-context.js +694 -0
  195. package/dist/src/integrations/context/codebase-context.js.map +1 -0
  196. package/dist/src/integrations/context/compaction.d.ts +191 -0
  197. package/dist/src/integrations/context/compaction.d.ts.map +1 -0
  198. package/dist/src/integrations/context/compaction.js +391 -0
  199. package/dist/src/integrations/context/compaction.js.map +1 -0
  200. package/dist/src/integrations/context/context-engineering.d.ts +274 -0
  201. package/dist/src/integrations/context/context-engineering.d.ts.map +1 -0
  202. package/dist/src/integrations/context/context-engineering.js +437 -0
  203. package/dist/src/integrations/context/context-engineering.js.map +1 -0
  204. package/dist/src/integrations/context/file-cache.d.ts +97 -0
  205. package/dist/src/integrations/context/file-cache.d.ts.map +1 -0
  206. package/dist/src/integrations/context/file-cache.js +218 -0
  207. package/dist/src/integrations/context/file-cache.js.map +1 -0
  208. package/dist/src/integrations/context/semantic-cache.d.ts +178 -0
  209. package/dist/src/integrations/context/semantic-cache.d.ts.map +1 -0
  210. package/dist/src/integrations/context/semantic-cache.js +377 -0
  211. package/dist/src/integrations/context/semantic-cache.js.map +1 -0
  212. package/dist/src/integrations/index.d.ts +72 -68
  213. package/dist/src/integrations/index.d.ts.map +1 -1
  214. package/dist/src/integrations/index.js +76 -68
  215. package/dist/src/integrations/index.js.map +1 -1
  216. package/dist/src/integrations/lsp/lsp.d.ts +196 -0
  217. package/dist/src/integrations/lsp/lsp.d.ts.map +1 -0
  218. package/dist/src/integrations/lsp/lsp.js +583 -0
  219. package/dist/src/integrations/lsp/lsp.js.map +1 -0
  220. package/dist/src/integrations/mcp/mcp-client.d.ts +279 -0
  221. package/dist/src/integrations/mcp/mcp-client.d.ts.map +1 -0
  222. package/dist/src/integrations/mcp/mcp-client.js +776 -0
  223. package/dist/src/integrations/mcp/mcp-client.js.map +1 -0
  224. package/dist/src/integrations/mcp/mcp-custom-tools.d.ts +102 -0
  225. package/dist/src/integrations/mcp/mcp-custom-tools.d.ts.map +1 -0
  226. package/dist/src/integrations/mcp/mcp-custom-tools.js +232 -0
  227. package/dist/src/integrations/mcp/mcp-custom-tools.js.map +1 -0
  228. package/dist/src/integrations/mcp/mcp-tool-search.d.ts +77 -0
  229. package/dist/src/integrations/mcp/mcp-tool-search.d.ts.map +1 -0
  230. package/dist/src/integrations/mcp/mcp-tool-search.js +220 -0
  231. package/dist/src/integrations/mcp/mcp-tool-search.js.map +1 -0
  232. package/dist/src/integrations/mcp/mcp-tool-validator.d.ts +60 -0
  233. package/dist/src/integrations/mcp/mcp-tool-validator.d.ts.map +1 -0
  234. package/dist/src/integrations/mcp/mcp-tool-validator.js +139 -0
  235. package/dist/src/integrations/mcp/mcp-tool-validator.js.map +1 -0
  236. package/dist/src/integrations/persistence/codebase-repository.d.ts +45 -0
  237. package/dist/src/integrations/persistence/codebase-repository.d.ts.map +1 -0
  238. package/dist/src/integrations/persistence/codebase-repository.js +85 -0
  239. package/dist/src/integrations/persistence/codebase-repository.js.map +1 -0
  240. package/dist/src/integrations/persistence/goal-repository.d.ts +71 -0
  241. package/dist/src/integrations/persistence/goal-repository.d.ts.map +1 -0
  242. package/dist/src/integrations/persistence/goal-repository.js +187 -0
  243. package/dist/src/integrations/persistence/goal-repository.js.map +1 -0
  244. package/dist/src/integrations/persistence/history.d.ts +72 -0
  245. package/dist/src/integrations/persistence/history.d.ts.map +1 -0
  246. package/dist/src/integrations/persistence/history.js +163 -0
  247. package/dist/src/integrations/persistence/history.js.map +1 -0
  248. package/dist/src/integrations/persistence/persistence.d.ts +49 -0
  249. package/dist/src/integrations/persistence/persistence.d.ts.map +1 -0
  250. package/dist/src/integrations/persistence/persistence.js +200 -0
  251. package/dist/src/integrations/persistence/persistence.js.map +1 -0
  252. package/dist/src/integrations/persistence/session-repository.d.ts +212 -0
  253. package/dist/src/integrations/persistence/session-repository.d.ts.map +1 -0
  254. package/dist/src/integrations/persistence/session-repository.js +781 -0
  255. package/dist/src/integrations/persistence/session-repository.js.map +1 -0
  256. package/dist/src/integrations/persistence/session-store.d.ts +184 -0
  257. package/dist/src/integrations/persistence/session-store.d.ts.map +1 -0
  258. package/dist/src/integrations/persistence/session-store.js +346 -0
  259. package/dist/src/integrations/persistence/session-store.js.map +1 -0
  260. package/dist/src/integrations/persistence/sqlite-store.d.ts +453 -0
  261. package/dist/src/integrations/persistence/sqlite-store.d.ts.map +1 -0
  262. package/dist/src/integrations/persistence/sqlite-store.js +680 -0
  263. package/dist/src/integrations/persistence/sqlite-store.js.map +1 -0
  264. package/dist/src/integrations/persistence/worker-repository.d.ts +65 -0
  265. package/dist/src/integrations/persistence/worker-repository.d.ts.map +1 -0
  266. package/dist/src/integrations/persistence/worker-repository.js +181 -0
  267. package/dist/src/integrations/persistence/worker-repository.js.map +1 -0
  268. package/dist/src/integrations/quality/auto-checkpoint.d.ts +98 -0
  269. package/dist/src/integrations/quality/auto-checkpoint.d.ts.map +1 -0
  270. package/dist/src/integrations/quality/auto-checkpoint.js +250 -0
  271. package/dist/src/integrations/quality/auto-checkpoint.js.map +1 -0
  272. package/dist/src/integrations/quality/dead-letter-queue.d.ts +233 -0
  273. package/dist/src/integrations/quality/dead-letter-queue.d.ts.map +1 -0
  274. package/dist/src/integrations/quality/dead-letter-queue.js +549 -0
  275. package/dist/src/integrations/quality/dead-letter-queue.js.map +1 -0
  276. package/dist/src/integrations/quality/health-check.d.ts +218 -0
  277. package/dist/src/integrations/quality/health-check.d.ts.map +1 -0
  278. package/dist/src/integrations/quality/health-check.js +418 -0
  279. package/dist/src/integrations/quality/health-check.js.map +1 -0
  280. package/dist/src/integrations/quality/learning-store.d.ts +291 -0
  281. package/dist/src/integrations/quality/learning-store.d.ts.map +1 -0
  282. package/dist/src/integrations/quality/learning-store.js +723 -0
  283. package/dist/src/integrations/quality/learning-store.js.map +1 -0
  284. package/dist/src/integrations/quality/self-improvement.d.ts +90 -0
  285. package/dist/src/integrations/quality/self-improvement.d.ts.map +1 -0
  286. package/dist/src/integrations/quality/self-improvement.js +229 -0
  287. package/dist/src/integrations/quality/self-improvement.js.map +1 -0
  288. package/dist/src/integrations/quality/tool-recommendation.d.ts +61 -0
  289. package/dist/src/integrations/quality/tool-recommendation.d.ts.map +1 -0
  290. package/dist/src/integrations/quality/tool-recommendation.js +298 -0
  291. package/dist/src/integrations/quality/tool-recommendation.js.map +1 -0
  292. package/dist/src/integrations/safety/bash-policy.d.ts +33 -0
  293. package/dist/src/integrations/safety/bash-policy.d.ts.map +1 -0
  294. package/dist/src/integrations/safety/bash-policy.js +147 -0
  295. package/dist/src/integrations/safety/bash-policy.js.map +1 -0
  296. package/dist/src/integrations/safety/edit-validator.d.ts +30 -0
  297. package/dist/src/integrations/safety/edit-validator.d.ts.map +1 -0
  298. package/dist/src/integrations/safety/edit-validator.js +87 -0
  299. package/dist/src/integrations/safety/edit-validator.js.map +1 -0
  300. package/dist/src/integrations/safety/execution-policy.d.ts +189 -0
  301. package/dist/src/integrations/safety/execution-policy.d.ts.map +1 -0
  302. package/dist/src/integrations/safety/execution-policy.js +362 -0
  303. package/dist/src/integrations/safety/execution-policy.js.map +1 -0
  304. package/dist/src/integrations/safety/policy-engine.d.ts +55 -0
  305. package/dist/src/integrations/safety/policy-engine.d.ts.map +1 -0
  306. package/dist/src/integrations/safety/policy-engine.js +287 -0
  307. package/dist/src/integrations/safety/policy-engine.js.map +1 -0
  308. package/dist/src/integrations/safety/safety.d.ts +174 -0
  309. package/dist/src/integrations/safety/safety.d.ts.map +1 -0
  310. package/dist/src/integrations/safety/safety.js +473 -0
  311. package/dist/src/integrations/safety/safety.js.map +1 -0
  312. package/dist/src/integrations/safety/sandbox/basic.d.ts +81 -0
  313. package/dist/src/integrations/safety/sandbox/basic.d.ts.map +1 -0
  314. package/dist/src/integrations/safety/sandbox/basic.js +333 -0
  315. package/dist/src/integrations/safety/sandbox/basic.js.map +1 -0
  316. package/dist/src/integrations/safety/sandbox/docker.d.ts +94 -0
  317. package/dist/src/integrations/safety/sandbox/docker.d.ts.map +1 -0
  318. package/dist/src/integrations/safety/sandbox/docker.js +294 -0
  319. package/dist/src/integrations/safety/sandbox/docker.js.map +1 -0
  320. package/dist/src/integrations/safety/sandbox/index.d.ts +188 -0
  321. package/dist/src/integrations/safety/sandbox/index.d.ts.map +1 -0
  322. package/dist/src/integrations/safety/sandbox/index.js +410 -0
  323. package/dist/src/integrations/safety/sandbox/index.js.map +1 -0
  324. package/dist/src/integrations/safety/sandbox/landlock.d.ts +59 -0
  325. package/dist/src/integrations/safety/sandbox/landlock.d.ts.map +1 -0
  326. package/dist/src/integrations/safety/sandbox/landlock.js +333 -0
  327. package/dist/src/integrations/safety/sandbox/landlock.js.map +1 -0
  328. package/dist/src/integrations/safety/sandbox/seatbelt.d.ts +68 -0
  329. package/dist/src/integrations/safety/sandbox/seatbelt.d.ts.map +1 -0
  330. package/dist/src/integrations/safety/sandbox/seatbelt.js +291 -0
  331. package/dist/src/integrations/safety/sandbox/seatbelt.js.map +1 -0
  332. package/dist/src/integrations/safety/type-checker.d.ts +53 -0
  333. package/dist/src/integrations/safety/type-checker.d.ts.map +1 -0
  334. package/dist/src/integrations/safety/type-checker.js +146 -0
  335. package/dist/src/integrations/safety/type-checker.js.map +1 -0
  336. package/dist/src/integrations/skills/skill-executor.d.ts +113 -0
  337. package/dist/src/integrations/skills/skill-executor.d.ts.map +1 -0
  338. package/dist/src/integrations/skills/skill-executor.js +266 -0
  339. package/dist/src/integrations/skills/skill-executor.js.map +1 -0
  340. package/dist/src/integrations/skills/skills.d.ts +262 -0
  341. package/dist/src/integrations/skills/skills.d.ts.map +1 -0
  342. package/dist/src/integrations/skills/skills.js +611 -0
  343. package/dist/src/integrations/skills/skills.js.map +1 -0
  344. package/dist/src/integrations/streaming/pty-shell.d.ts +169 -0
  345. package/dist/src/integrations/streaming/pty-shell.d.ts.map +1 -0
  346. package/dist/src/integrations/streaming/pty-shell.js +371 -0
  347. package/dist/src/integrations/streaming/pty-shell.js.map +1 -0
  348. package/dist/src/integrations/streaming/streaming.d.ts +102 -0
  349. package/dist/src/integrations/streaming/streaming.d.ts.map +1 -0
  350. package/dist/src/integrations/streaming/streaming.js +364 -0
  351. package/dist/src/integrations/streaming/streaming.js.map +1 -0
  352. package/dist/src/integrations/swarm/failure-classifier.d.ts.map +1 -1
  353. package/dist/src/integrations/swarm/failure-classifier.js +18 -3
  354. package/dist/src/integrations/swarm/failure-classifier.js.map +1 -1
  355. package/dist/src/integrations/swarm/index.d.ts +6 -5
  356. package/dist/src/integrations/swarm/index.d.ts.map +1 -1
  357. package/dist/src/integrations/swarm/index.js +5 -3
  358. package/dist/src/integrations/swarm/index.js.map +1 -1
  359. package/dist/src/integrations/swarm/model-selector.d.ts.map +1 -1
  360. package/dist/src/integrations/swarm/model-selector.js +21 -24
  361. package/dist/src/integrations/swarm/model-selector.js.map +1 -1
  362. package/dist/src/integrations/swarm/request-throttle.d.ts.map +1 -1
  363. package/dist/src/integrations/swarm/request-throttle.js +7 -4
  364. package/dist/src/integrations/swarm/request-throttle.js.map +1 -1
  365. package/dist/src/integrations/swarm/swarm-budget.d.ts +1 -1
  366. package/dist/src/integrations/swarm/swarm-budget.d.ts.map +1 -1
  367. package/dist/src/integrations/swarm/swarm-budget.js +1 -1
  368. package/dist/src/integrations/swarm/swarm-budget.js.map +1 -1
  369. package/dist/src/integrations/swarm/swarm-config-loader.d.ts.map +1 -1
  370. package/dist/src/integrations/swarm/swarm-config-loader.js +53 -17
  371. package/dist/src/integrations/swarm/swarm-config-loader.js.map +1 -1
  372. package/dist/src/integrations/swarm/swarm-event-bridge.d.ts.map +1 -1
  373. package/dist/src/integrations/swarm/swarm-event-bridge.js +69 -23
  374. package/dist/src/integrations/swarm/swarm-event-bridge.js.map +1 -1
  375. package/dist/src/integrations/swarm/swarm-events.d.ts +1 -1
  376. package/dist/src/integrations/swarm/swarm-events.d.ts.map +1 -1
  377. package/dist/src/integrations/swarm/swarm-events.js +1 -1
  378. package/dist/src/integrations/swarm/swarm-events.js.map +1 -1
  379. package/dist/src/integrations/swarm/swarm-execution.d.ts +27 -0
  380. package/dist/src/integrations/swarm/swarm-execution.d.ts.map +1 -0
  381. package/dist/src/integrations/swarm/swarm-execution.js +1071 -0
  382. package/dist/src/integrations/swarm/swarm-execution.js.map +1 -0
  383. package/dist/src/integrations/swarm/swarm-helpers.d.ts +26 -0
  384. package/dist/src/integrations/swarm/swarm-helpers.d.ts.map +1 -0
  385. package/dist/src/integrations/swarm/swarm-helpers.js +108 -0
  386. package/dist/src/integrations/swarm/swarm-helpers.js.map +1 -0
  387. package/dist/src/integrations/swarm/swarm-lifecycle.d.ts +100 -0
  388. package/dist/src/integrations/swarm/swarm-lifecycle.d.ts.map +1 -0
  389. package/dist/src/integrations/swarm/swarm-lifecycle.js +977 -0
  390. package/dist/src/integrations/swarm/swarm-lifecycle.js.map +1 -0
  391. package/dist/src/integrations/swarm/swarm-orchestrator.d.ts +84 -203
  392. package/dist/src/integrations/swarm/swarm-orchestrator.d.ts.map +1 -1
  393. package/dist/src/integrations/swarm/swarm-orchestrator.js +338 -2899
  394. package/dist/src/integrations/swarm/swarm-orchestrator.js.map +1 -1
  395. package/dist/src/integrations/swarm/swarm-quality-gate.d.ts.map +1 -1
  396. package/dist/src/integrations/swarm/swarm-quality-gate.js +19 -15
  397. package/dist/src/integrations/swarm/swarm-quality-gate.js.map +1 -1
  398. package/dist/src/integrations/swarm/swarm-recovery.d.ts +75 -0
  399. package/dist/src/integrations/swarm/swarm-recovery.d.ts.map +1 -0
  400. package/dist/src/integrations/swarm/swarm-recovery.js +563 -0
  401. package/dist/src/integrations/swarm/swarm-recovery.js.map +1 -0
  402. package/dist/src/integrations/swarm/swarm-state-store.d.ts.map +1 -1
  403. package/dist/src/integrations/swarm/swarm-state-store.js +8 -0
  404. package/dist/src/integrations/swarm/swarm-state-store.js.map +1 -1
  405. package/dist/src/integrations/swarm/task-queue.d.ts +8 -2
  406. package/dist/src/integrations/swarm/task-queue.d.ts.map +1 -1
  407. package/dist/src/integrations/swarm/task-queue.js +60 -26
  408. package/dist/src/integrations/swarm/task-queue.js.map +1 -1
  409. package/dist/src/integrations/swarm/types.d.ts +17 -5
  410. package/dist/src/integrations/swarm/types.d.ts.map +1 -1
  411. package/dist/src/integrations/swarm/types.js +89 -12
  412. package/dist/src/integrations/swarm/types.js.map +1 -1
  413. package/dist/src/integrations/swarm/worker-pool.d.ts +1 -1
  414. package/dist/src/integrations/swarm/worker-pool.d.ts.map +1 -1
  415. package/dist/src/integrations/swarm/worker-pool.js +43 -31
  416. package/dist/src/integrations/swarm/worker-pool.js.map +1 -1
  417. package/dist/src/integrations/tasks/dependency-analyzer.d.ts +34 -0
  418. package/dist/src/integrations/tasks/dependency-analyzer.d.ts.map +1 -0
  419. package/dist/src/integrations/tasks/dependency-analyzer.js +231 -0
  420. package/dist/src/integrations/tasks/dependency-analyzer.js.map +1 -0
  421. package/dist/src/integrations/tasks/interactive-planning.d.ts +322 -0
  422. package/dist/src/integrations/tasks/interactive-planning.d.ts.map +1 -0
  423. package/dist/src/integrations/tasks/interactive-planning.js +648 -0
  424. package/dist/src/integrations/tasks/interactive-planning.js.map +1 -0
  425. package/dist/src/integrations/tasks/pending-plan.d.ts +196 -0
  426. package/dist/src/integrations/tasks/pending-plan.d.ts.map +1 -0
  427. package/dist/src/integrations/tasks/pending-plan.js +431 -0
  428. package/dist/src/integrations/tasks/pending-plan.js.map +1 -0
  429. package/dist/src/integrations/tasks/planning.d.ts +115 -0
  430. package/dist/src/integrations/tasks/planning.d.ts.map +1 -0
  431. package/dist/src/integrations/tasks/planning.js +432 -0
  432. package/dist/src/integrations/tasks/planning.js.map +1 -0
  433. package/dist/src/integrations/tasks/smart-decomposer.d.ts +316 -0
  434. package/dist/src/integrations/tasks/smart-decomposer.d.ts.map +1 -0
  435. package/dist/src/integrations/tasks/smart-decomposer.js +668 -0
  436. package/dist/src/integrations/tasks/smart-decomposer.js.map +1 -0
  437. package/dist/src/integrations/tasks/task-manager.d.ts +164 -0
  438. package/dist/src/integrations/tasks/task-manager.d.ts.map +1 -0
  439. package/dist/src/integrations/tasks/task-manager.js +390 -0
  440. package/dist/src/integrations/tasks/task-manager.js.map +1 -0
  441. package/dist/src/integrations/tasks/task-splitter.d.ts +56 -0
  442. package/dist/src/integrations/tasks/task-splitter.d.ts.map +1 -0
  443. package/dist/src/integrations/tasks/task-splitter.js +542 -0
  444. package/dist/src/integrations/tasks/task-splitter.js.map +1 -0
  445. package/dist/src/integrations/tasks/verification-gate.d.ts +103 -0
  446. package/dist/src/integrations/tasks/verification-gate.d.ts.map +1 -0
  447. package/dist/src/integrations/tasks/verification-gate.js +195 -0
  448. package/dist/src/integrations/tasks/verification-gate.js.map +1 -0
  449. package/dist/src/integrations/tasks/work-log.d.ts +87 -0
  450. package/dist/src/integrations/tasks/work-log.d.ts.map +1 -0
  451. package/dist/src/integrations/tasks/work-log.js +287 -0
  452. package/dist/src/integrations/tasks/work-log.js.map +1 -0
  453. package/dist/src/integrations/utilities/capabilities.d.ts +160 -0
  454. package/dist/src/integrations/utilities/capabilities.d.ts.map +1 -0
  455. package/dist/src/integrations/utilities/capabilities.js +464 -0
  456. package/dist/src/integrations/utilities/capabilities.js.map +1 -0
  457. package/dist/src/integrations/utilities/diff-utils.d.ts +105 -0
  458. package/dist/src/integrations/utilities/diff-utils.d.ts.map +1 -0
  459. package/dist/src/integrations/utilities/diff-utils.js +496 -0
  460. package/dist/src/integrations/utilities/diff-utils.js.map +1 -0
  461. package/dist/src/integrations/utilities/environment-facts.d.ts +52 -0
  462. package/dist/src/integrations/utilities/environment-facts.d.ts.map +1 -0
  463. package/dist/src/integrations/utilities/environment-facts.js +94 -0
  464. package/dist/src/integrations/utilities/environment-facts.js.map +1 -0
  465. package/dist/src/integrations/utilities/file-change-tracker.d.ts +162 -0
  466. package/dist/src/integrations/utilities/file-change-tracker.d.ts.map +1 -0
  467. package/dist/src/integrations/utilities/file-change-tracker.js +537 -0
  468. package/dist/src/integrations/utilities/file-change-tracker.js.map +1 -0
  469. package/dist/src/integrations/utilities/graph-visualization.d.ts +72 -0
  470. package/dist/src/integrations/utilities/graph-visualization.d.ts.map +1 -0
  471. package/dist/src/integrations/utilities/graph-visualization.js +385 -0
  472. package/dist/src/integrations/utilities/graph-visualization.js.map +1 -0
  473. package/dist/src/integrations/utilities/hierarchical-config.d.ts +215 -0
  474. package/dist/src/integrations/utilities/hierarchical-config.d.ts.map +1 -0
  475. package/dist/src/integrations/utilities/hierarchical-config.js +508 -0
  476. package/dist/src/integrations/utilities/hierarchical-config.js.map +1 -0
  477. package/dist/src/integrations/utilities/hooks.d.ts +116 -0
  478. package/dist/src/integrations/utilities/hooks.d.ts.map +1 -0
  479. package/dist/src/integrations/utilities/hooks.js +410 -0
  480. package/dist/src/integrations/utilities/hooks.js.map +1 -0
  481. package/dist/src/integrations/utilities/ignore.d.ts +143 -0
  482. package/dist/src/integrations/utilities/ignore.d.ts.map +1 -0
  483. package/dist/src/integrations/utilities/ignore.js +417 -0
  484. package/dist/src/integrations/utilities/ignore.js.map +1 -0
  485. package/dist/src/integrations/utilities/image-renderer.d.ts +119 -0
  486. package/dist/src/integrations/utilities/image-renderer.d.ts.map +1 -0
  487. package/dist/src/integrations/utilities/image-renderer.js +301 -0
  488. package/dist/src/integrations/utilities/image-renderer.js.map +1 -0
  489. package/dist/src/integrations/utilities/logger.d.ts +104 -0
  490. package/dist/src/integrations/utilities/logger.d.ts.map +1 -0
  491. package/dist/src/integrations/utilities/logger.js +217 -0
  492. package/dist/src/integrations/utilities/logger.js.map +1 -0
  493. package/dist/src/integrations/utilities/memory.d.ts +116 -0
  494. package/dist/src/integrations/utilities/memory.d.ts.map +1 -0
  495. package/dist/src/integrations/utilities/memory.js +309 -0
  496. package/dist/src/integrations/utilities/memory.js.map +1 -0
  497. package/dist/src/integrations/utilities/observability.d.ts +162 -0
  498. package/dist/src/integrations/utilities/observability.d.ts.map +1 -0
  499. package/dist/src/integrations/utilities/observability.js +408 -0
  500. package/dist/src/integrations/utilities/observability.js.map +1 -0
  501. package/dist/src/integrations/utilities/openrouter-pricing.d.ts +67 -0
  502. package/dist/src/integrations/utilities/openrouter-pricing.d.ts.map +1 -0
  503. package/dist/src/integrations/utilities/openrouter-pricing.js +166 -0
  504. package/dist/src/integrations/utilities/openrouter-pricing.js.map +1 -0
  505. package/dist/src/integrations/utilities/react.d.ts +139 -0
  506. package/dist/src/integrations/utilities/react.d.ts.map +1 -0
  507. package/dist/src/integrations/utilities/react.js +269 -0
  508. package/dist/src/integrations/utilities/react.js.map +1 -0
  509. package/dist/src/integrations/utilities/retry.d.ts +132 -0
  510. package/dist/src/integrations/utilities/retry.d.ts.map +1 -0
  511. package/dist/src/integrations/utilities/retry.js +233 -0
  512. package/dist/src/integrations/utilities/retry.js.map +1 -0
  513. package/dist/src/integrations/utilities/routing.d.ts +118 -0
  514. package/dist/src/integrations/utilities/routing.d.ts.map +1 -0
  515. package/dist/src/integrations/utilities/routing.js +360 -0
  516. package/dist/src/integrations/utilities/routing.js.map +1 -0
  517. package/dist/src/integrations/utilities/rules.d.ts +131 -0
  518. package/dist/src/integrations/utilities/rules.d.ts.map +1 -0
  519. package/dist/src/integrations/utilities/rules.js +282 -0
  520. package/dist/src/integrations/utilities/rules.js.map +1 -0
  521. package/dist/src/integrations/utilities/sourcegraph.d.ts +169 -0
  522. package/dist/src/integrations/utilities/sourcegraph.d.ts.map +1 -0
  523. package/dist/src/integrations/utilities/sourcegraph.js +377 -0
  524. package/dist/src/integrations/utilities/sourcegraph.js.map +1 -0
  525. package/dist/src/integrations/utilities/thinking-strategy.d.ts +52 -0
  526. package/dist/src/integrations/utilities/thinking-strategy.d.ts.map +1 -0
  527. package/dist/src/integrations/utilities/thinking-strategy.js +129 -0
  528. package/dist/src/integrations/utilities/thinking-strategy.js.map +1 -0
  529. package/dist/src/integrations/utilities/thread-manager.d.ts +199 -0
  530. package/dist/src/integrations/utilities/thread-manager.d.ts.map +1 -0
  531. package/dist/src/integrations/utilities/thread-manager.js +359 -0
  532. package/dist/src/integrations/utilities/thread-manager.js.map +1 -0
  533. package/dist/src/integrations/utilities/token-estimate.d.ts +16 -0
  534. package/dist/src/integrations/utilities/token-estimate.d.ts.map +1 -0
  535. package/dist/src/integrations/utilities/token-estimate.js +20 -0
  536. package/dist/src/integrations/utilities/token-estimate.js.map +1 -0
  537. package/dist/src/main.js +50 -27
  538. package/dist/src/main.js.map +1 -1
  539. package/dist/src/modes/repl.d.ts.map +1 -1
  540. package/dist/src/modes/repl.js +73 -22
  541. package/dist/src/modes/repl.js.map +1 -1
  542. package/dist/src/modes/tui.d.ts.map +1 -1
  543. package/dist/src/modes/tui.js +93 -16
  544. package/dist/src/modes/tui.js.map +1 -1
  545. package/dist/src/modes.d.ts.map +1 -1
  546. package/dist/src/modes.js +14 -14
  547. package/dist/src/modes.js.map +1 -1
  548. package/dist/src/observability/tracer.d.ts.map +1 -1
  549. package/dist/src/observability/tracer.js +8 -4
  550. package/dist/src/observability/tracer.js.map +1 -1
  551. package/dist/src/observability/types.d.ts.map +1 -1
  552. package/dist/src/observability/types.js.map +1 -1
  553. package/dist/src/paths.d.ts.map +1 -1
  554. package/dist/src/paths.js +2 -6
  555. package/dist/src/paths.js.map +1 -1
  556. package/dist/src/persistence/migrator.d.ts.map +1 -1
  557. package/dist/src/persistence/migrator.js +7 -7
  558. package/dist/src/persistence/migrator.js.map +1 -1
  559. package/dist/src/persistence/schema.d.ts +2 -0
  560. package/dist/src/persistence/schema.d.ts.map +1 -1
  561. package/dist/src/persistence/schema.js +31 -0
  562. package/dist/src/persistence/schema.js.map +1 -1
  563. package/dist/src/providers/adapters/anthropic.d.ts +6 -0
  564. package/dist/src/providers/adapters/anthropic.d.ts.map +1 -1
  565. package/dist/src/providers/adapters/anthropic.js +132 -36
  566. package/dist/src/providers/adapters/anthropic.js.map +1 -1
  567. package/dist/src/providers/adapters/azure.d.ts +74 -0
  568. package/dist/src/providers/adapters/azure.d.ts.map +1 -0
  569. package/dist/src/providers/adapters/azure.js +369 -0
  570. package/dist/src/providers/adapters/azure.js.map +1 -0
  571. package/dist/src/providers/adapters/mock.d.ts +16 -2
  572. package/dist/src/providers/adapters/mock.d.ts.map +1 -1
  573. package/dist/src/providers/adapters/mock.js +51 -10
  574. package/dist/src/providers/adapters/mock.js.map +1 -1
  575. package/dist/src/providers/adapters/openai.d.ts +6 -1
  576. package/dist/src/providers/adapters/openai.d.ts.map +1 -1
  577. package/dist/src/providers/adapters/openai.js +57 -19
  578. package/dist/src/providers/adapters/openai.js.map +1 -1
  579. package/dist/src/providers/adapters/openrouter.d.ts +6 -0
  580. package/dist/src/providers/adapters/openrouter.d.ts.map +1 -1
  581. package/dist/src/providers/adapters/openrouter.js +127 -30
  582. package/dist/src/providers/adapters/openrouter.js.map +1 -1
  583. package/dist/src/providers/circuit-breaker.d.ts.map +1 -1
  584. package/dist/src/providers/circuit-breaker.js +4 -3
  585. package/dist/src/providers/circuit-breaker.js.map +1 -1
  586. package/dist/src/providers/fallback-chain.d.ts.map +1 -1
  587. package/dist/src/providers/fallback-chain.js +3 -3
  588. package/dist/src/providers/fallback-chain.js.map +1 -1
  589. package/dist/src/providers/llm-resilience.d.ts.map +1 -1
  590. package/dist/src/providers/llm-resilience.js +2 -2
  591. package/dist/src/providers/llm-resilience.js.map +1 -1
  592. package/dist/src/providers/provider.d.ts.map +1 -1
  593. package/dist/src/providers/provider.js +2 -3
  594. package/dist/src/providers/provider.js.map +1 -1
  595. package/dist/src/providers/resilient-fetch.d.ts.map +1 -1
  596. package/dist/src/providers/resilient-fetch.js +3 -4
  597. package/dist/src/providers/resilient-fetch.js.map +1 -1
  598. package/dist/src/providers/resilient-provider.d.ts.map +1 -1
  599. package/dist/src/providers/resilient-provider.js +9 -6
  600. package/dist/src/providers/resilient-provider.js.map +1 -1
  601. package/dist/src/providers/types.d.ts +23 -2
  602. package/dist/src/providers/types.d.ts.map +1 -1
  603. package/dist/src/session-picker.d.ts +1 -1
  604. package/dist/src/session-picker.d.ts.map +1 -1
  605. package/dist/src/session-picker.js +10 -6
  606. package/dist/src/session-picker.js.map +1 -1
  607. package/dist/src/shared/budget-tracker.d.ts.map +1 -1
  608. package/dist/src/shared/budget-tracker.js +2 -2
  609. package/dist/src/shared/budget-tracker.js.map +1 -1
  610. package/dist/src/shared/context-engine.d.ts.map +1 -1
  611. package/dist/src/shared/context-engine.js +1 -1
  612. package/dist/src/shared/context-engine.js.map +1 -1
  613. package/dist/src/shared/persistence.d.ts.map +1 -1
  614. package/dist/src/shared/persistence.js +2 -6
  615. package/dist/src/shared/persistence.js.map +1 -1
  616. package/dist/src/shared/shared-context-state.d.ts.map +1 -1
  617. package/dist/src/shared/shared-context-state.js.map +1 -1
  618. package/dist/src/shared/shared-economics-state.d.ts.map +1 -1
  619. package/dist/src/shared/shared-economics-state.js.map +1 -1
  620. package/dist/src/tools/agent.d.ts +2 -2
  621. package/dist/src/tools/agent.d.ts.map +1 -1
  622. package/dist/src/tools/agent.js +10 -7
  623. package/dist/src/tools/agent.js.map +1 -1
  624. package/dist/src/tools/bash.d.ts.map +1 -1
  625. package/dist/src/tools/bash.js +1 -1
  626. package/dist/src/tools/bash.js.map +1 -1
  627. package/dist/src/tools/coercion.js +1 -1
  628. package/dist/src/tools/coercion.js.map +1 -1
  629. package/dist/src/tools/file.d.ts.map +1 -1
  630. package/dist/src/tools/file.js +2 -2
  631. package/dist/src/tools/file.js.map +1 -1
  632. package/dist/src/tools/permission.js +7 -8
  633. package/dist/src/tools/permission.js.map +1 -1
  634. package/dist/src/tools/registry.d.ts +1 -1
  635. package/dist/src/tools/registry.d.ts.map +1 -1
  636. package/dist/src/tools/registry.js +4 -6
  637. package/dist/src/tools/registry.js.map +1 -1
  638. package/dist/src/tools/standard.d.ts.map +1 -1
  639. package/dist/src/tools/standard.js +1 -3
  640. package/dist/src/tools/standard.js.map +1 -1
  641. package/dist/src/tools/tasks.d.ts +1 -1
  642. package/dist/src/tools/tasks.d.ts.map +1 -1
  643. package/dist/src/tools/tasks.js +4 -4
  644. package/dist/src/tools/tasks.js.map +1 -1
  645. package/dist/src/tools/types.d.ts.map +1 -1
  646. package/dist/src/tools/types.js +5 -1
  647. package/dist/src/tools/types.js.map +1 -1
  648. package/dist/src/tools/undo.d.ts +1 -1
  649. package/dist/src/tools/undo.d.ts.map +1 -1
  650. package/dist/src/tools/undo.js +4 -2
  651. package/dist/src/tools/undo.js.map +1 -1
  652. package/dist/src/tracing/cache-boundary-tracker.d.ts.map +1 -1
  653. package/dist/src/tracing/cache-boundary-tracker.js +9 -13
  654. package/dist/src/tracing/cache-boundary-tracker.js.map +1 -1
  655. package/dist/src/tracing/trace-collector.d.ts +22 -0
  656. package/dist/src/tracing/trace-collector.d.ts.map +1 -1
  657. package/dist/src/tracing/trace-collector.js +55 -31
  658. package/dist/src/tracing/trace-collector.js.map +1 -1
  659. package/dist/src/tracing/types.d.ts +17 -1
  660. package/dist/src/tracing/types.d.ts.map +1 -1
  661. package/dist/src/tracing/types.js.map +1 -1
  662. package/dist/src/tricks/failure-evidence.d.ts.map +1 -1
  663. package/dist/src/tricks/failure-evidence.js +17 -27
  664. package/dist/src/tricks/failure-evidence.js.map +1 -1
  665. package/dist/src/tricks/json-utils.d.ts.map +1 -1
  666. package/dist/src/tricks/json-utils.js +1 -4
  667. package/dist/src/tricks/json-utils.js.map +1 -1
  668. package/dist/src/tricks/kv-cache-context.d.ts.map +1 -1
  669. package/dist/src/tricks/kv-cache-context.js +2 -3
  670. package/dist/src/tricks/kv-cache-context.js.map +1 -1
  671. package/dist/src/tricks/recitation.d.ts.map +1 -1
  672. package/dist/src/tricks/recitation.js +24 -19
  673. package/dist/src/tricks/recitation.js.map +1 -1
  674. package/dist/src/tricks/recursive-context.d.ts.map +1 -1
  675. package/dist/src/tricks/recursive-context.js +10 -7
  676. package/dist/src/tricks/recursive-context.js.map +1 -1
  677. package/dist/src/tricks/reversible-compaction.d.ts.map +1 -1
  678. package/dist/src/tricks/reversible-compaction.js +17 -9
  679. package/dist/src/tricks/reversible-compaction.js.map +1 -1
  680. package/dist/src/tricks/serialization-diversity.d.ts.map +1 -1
  681. package/dist/src/tricks/serialization-diversity.js +12 -12
  682. package/dist/src/tricks/serialization-diversity.js.map +1 -1
  683. package/dist/src/tui/app.d.ts +9 -5
  684. package/dist/src/tui/app.d.ts.map +1 -1
  685. package/dist/src/tui/app.js +690 -565
  686. package/dist/src/tui/app.js.map +1 -1
  687. package/dist/src/tui/components/ActiveAgentsPanel.d.ts +2 -0
  688. package/dist/src/tui/components/ActiveAgentsPanel.d.ts.map +1 -1
  689. package/dist/src/tui/components/ActiveAgentsPanel.js +5 -5
  690. package/dist/src/tui/components/ActiveAgentsPanel.js.map +1 -1
  691. package/dist/src/tui/components/ApprovalDialog.d.ts.map +1 -1
  692. package/dist/src/tui/components/ApprovalDialog.js +14 -0
  693. package/dist/src/tui/components/ApprovalDialog.js.map +1 -1
  694. package/dist/src/tui/components/BudgetExtensionDialog.d.ts +18 -0
  695. package/dist/src/tui/components/BudgetExtensionDialog.d.ts.map +1 -0
  696. package/dist/src/tui/components/BudgetExtensionDialog.js +40 -0
  697. package/dist/src/tui/components/BudgetExtensionDialog.js.map +1 -0
  698. package/dist/src/tui/components/CollapsibleDiffView.d.ts +1 -1
  699. package/dist/src/tui/components/CollapsibleDiffView.d.ts.map +1 -1
  700. package/dist/src/tui/components/CollapsibleDiffView.js +18 -13
  701. package/dist/src/tui/components/CollapsibleDiffView.js.map +1 -1
  702. package/dist/src/tui/components/DebugPanel.d.ts.map +1 -1
  703. package/dist/src/tui/components/DebugPanel.js +46 -26
  704. package/dist/src/tui/components/DebugPanel.js.map +1 -1
  705. package/dist/src/tui/components/DiagnosticsPanel.d.ts +24 -0
  706. package/dist/src/tui/components/DiagnosticsPanel.d.ts.map +1 -0
  707. package/dist/src/tui/components/DiagnosticsPanel.js +63 -0
  708. package/dist/src/tui/components/DiagnosticsPanel.js.map +1 -0
  709. package/dist/src/tui/components/DiffView.d.ts +1 -1
  710. package/dist/src/tui/components/DiffView.d.ts.map +1 -1
  711. package/dist/src/tui/components/DiffView.js +21 -14
  712. package/dist/src/tui/components/DiffView.js.map +1 -1
  713. package/dist/src/tui/components/ErrorBoundary.d.ts.map +1 -1
  714. package/dist/src/tui/components/ErrorBoundary.js +8 -3
  715. package/dist/src/tui/components/ErrorBoundary.js.map +1 -1
  716. package/dist/src/tui/components/ErrorDetailPanel.d.ts.map +1 -1
  717. package/dist/src/tui/components/ErrorDetailPanel.js +4 -4
  718. package/dist/src/tui/components/ErrorDetailPanel.js.map +1 -1
  719. package/dist/src/tui/components/FileChangeSummary.d.ts.map +1 -1
  720. package/dist/src/tui/components/FileChangeSummary.js +3 -3
  721. package/dist/src/tui/components/FileChangeSummary.js.map +1 -1
  722. package/dist/src/tui/components/InputArea.d.ts.map +1 -1
  723. package/dist/src/tui/components/InputArea.js +32 -15
  724. package/dist/src/tui/components/InputArea.js.map +1 -1
  725. package/dist/src/tui/components/LearningValidationDialog.d.ts +25 -0
  726. package/dist/src/tui/components/LearningValidationDialog.d.ts.map +1 -0
  727. package/dist/src/tui/components/LearningValidationDialog.js +35 -0
  728. package/dist/src/tui/components/LearningValidationDialog.js.map +1 -0
  729. package/dist/src/tui/components/MessageItem.d.ts.map +1 -1
  730. package/dist/src/tui/components/MessageItem.js.map +1 -1
  731. package/dist/src/tui/components/PlanPanel.d.ts +27 -0
  732. package/dist/src/tui/components/PlanPanel.d.ts.map +1 -0
  733. package/dist/src/tui/components/PlanPanel.js +45 -0
  734. package/dist/src/tui/components/PlanPanel.js.map +1 -0
  735. package/dist/src/tui/components/ScrollableBox.d.ts.map +1 -1
  736. package/dist/src/tui/components/ScrollableBox.js +2 -2
  737. package/dist/src/tui/components/ScrollableBox.js.map +1 -1
  738. package/dist/src/tui/components/SideBySideDiff.d.ts.map +1 -1
  739. package/dist/src/tui/components/SideBySideDiff.js +20 -18
  740. package/dist/src/tui/components/SideBySideDiff.js.map +1 -1
  741. package/dist/src/tui/components/StatusBar.d.ts +41 -0
  742. package/dist/src/tui/components/StatusBar.d.ts.map +1 -0
  743. package/dist/src/tui/components/StatusBar.js +114 -0
  744. package/dist/src/tui/components/StatusBar.js.map +1 -0
  745. package/dist/src/tui/components/SwarmStatusPanel.d.ts.map +1 -1
  746. package/dist/src/tui/components/SwarmStatusPanel.js +25 -17
  747. package/dist/src/tui/components/SwarmStatusPanel.js.map +1 -1
  748. package/dist/src/tui/components/TasksPanel.d.ts +1 -1
  749. package/dist/src/tui/components/TasksPanel.d.ts.map +1 -1
  750. package/dist/src/tui/components/TasksPanel.js +12 -11
  751. package/dist/src/tui/components/TasksPanel.js.map +1 -1
  752. package/dist/src/tui/components/ToolCallItem.d.ts.map +1 -1
  753. package/dist/src/tui/components/ToolCallItem.js +19 -6
  754. package/dist/src/tui/components/ToolCallItem.js.map +1 -1
  755. package/dist/src/tui/components/ToolCallsPanel.d.ts +15 -0
  756. package/dist/src/tui/components/ToolCallsPanel.d.ts.map +1 -0
  757. package/dist/src/tui/components/ToolCallsPanel.js +34 -0
  758. package/dist/src/tui/components/ToolCallsPanel.js.map +1 -0
  759. package/dist/src/tui/components/TransparencyPanel.d.ts +15 -0
  760. package/dist/src/tui/components/TransparencyPanel.d.ts.map +1 -0
  761. package/dist/src/tui/components/TransparencyPanel.js +46 -0
  762. package/dist/src/tui/components/TransparencyPanel.js.map +1 -0
  763. package/dist/src/tui/components/index.d.ts +8 -2
  764. package/dist/src/tui/components/index.d.ts.map +1 -1
  765. package/dist/src/tui/components/index.js +14 -2
  766. package/dist/src/tui/components/index.js.map +1 -1
  767. package/dist/src/tui/event-display.d.ts.map +1 -1
  768. package/dist/src/tui/event-display.js +13 -4
  769. package/dist/src/tui/event-display.js.map +1 -1
  770. package/dist/src/tui/hooks/index.d.ts +1 -0
  771. package/dist/src/tui/hooks/index.d.ts.map +1 -1
  772. package/dist/src/tui/hooks/index.js +1 -0
  773. package/dist/src/tui/hooks/index.js.map +1 -1
  774. package/dist/src/tui/hooks/use-agent-events.d.ts +53 -0
  775. package/dist/src/tui/hooks/use-agent-events.d.ts.map +1 -0
  776. package/dist/src/tui/hooks/use-agent-events.js +444 -0
  777. package/dist/src/tui/hooks/use-agent-events.js.map +1 -0
  778. package/dist/src/tui/hooks/use-throttled-state.d.ts +18 -0
  779. package/dist/src/tui/hooks/use-throttled-state.d.ts.map +1 -0
  780. package/dist/src/tui/hooks/use-throttled-state.js +93 -0
  781. package/dist/src/tui/hooks/use-throttled-state.js.map +1 -0
  782. package/dist/src/tui/hooks/useMessagePruning.d.ts.map +1 -1
  783. package/dist/src/tui/hooks/useMessagePruning.js.map +1 -1
  784. package/dist/src/tui/index.d.ts +2 -2
  785. package/dist/src/tui/index.d.ts.map +1 -1
  786. package/dist/src/tui/index.js +102 -7
  787. package/dist/src/tui/index.js.map +1 -1
  788. package/dist/src/tui/input/CommandPalette.d.ts.map +1 -1
  789. package/dist/src/tui/input/CommandPalette.js +2 -2
  790. package/dist/src/tui/input/CommandPalette.js.map +1 -1
  791. package/dist/src/tui/input/index.d.ts +1 -1
  792. package/dist/src/tui/input/index.d.ts.map +1 -1
  793. package/dist/src/tui/input/index.js +1 -1
  794. package/dist/src/tui/input/index.js.map +1 -1
  795. package/dist/src/tui/syntax/languages/bash.js +94 -16
  796. package/dist/src/tui/syntax/languages/bash.js.map +1 -1
  797. package/dist/src/tui/syntax/languages/javascript.js +65 -12
  798. package/dist/src/tui/syntax/languages/javascript.js.map +1 -1
  799. package/dist/src/tui/syntax/languages/json.js.map +1 -1
  800. package/dist/src/tui/syntax/languages/python.js +81 -15
  801. package/dist/src/tui/syntax/languages/python.js.map +1 -1
  802. package/dist/src/tui/theme/index.js.map +1 -1
  803. package/dist/src/tui/transparency-aggregator.d.ts +13 -0
  804. package/dist/src/tui/transparency-aggregator.d.ts.map +1 -1
  805. package/dist/src/tui/transparency-aggregator.js +39 -4
  806. package/dist/src/tui/transparency-aggregator.js.map +1 -1
  807. package/dist/src/tui/types.d.ts.map +1 -1
  808. package/dist/src/tui/types.js.map +1 -1
  809. package/dist/src/tui/utils/keyboard.d.ts.map +1 -1
  810. package/dist/src/tui/utils/keyboard.js.map +1 -1
  811. package/dist/src/types.d.ts +39 -2
  812. package/dist/src/types.d.ts.map +1 -1
  813. package/package.json +1 -1
@@ -0,0 +1,196 @@
1
+ /**
2
+ * Pending Plan Manager
3
+ *
4
+ * Manages plans that are awaiting user approval before execution.
5
+ * Used in "plan mode" where write operations are intercepted and queued
6
+ * as proposed changes rather than being executed immediately.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const planManager = createPendingPlanManager();
11
+ *
12
+ * // In plan mode, intercept a write operation
13
+ * planManager.addProposedChange({
14
+ * tool: 'write_file',
15
+ * args: { path: 'src/main.ts', content: '...' },
16
+ * reason: 'Create entry point for the application',
17
+ * });
18
+ *
19
+ * // User approves the plan
20
+ * const changes = planManager.approve();
21
+ * for (const change of changes) {
22
+ * await executeTool(change.tool, change.args);
23
+ * }
24
+ * ```
25
+ */
26
+ /**
27
+ * Status of a pending plan.
28
+ */
29
+ export type PlanStatus = 'pending' | 'approved' | 'rejected' | 'partially_approved';
30
+ /**
31
+ * A proposed change that will be executed if the plan is approved.
32
+ */
33
+ export interface ProposedChange {
34
+ /** Unique ID for this change */
35
+ id: string;
36
+ /** The tool that would be called */
37
+ tool: string;
38
+ /** Arguments for the tool call */
39
+ args: Record<string, unknown>;
40
+ /** LLM's explanation of why this change is needed */
41
+ reason: string;
42
+ /** Order in which this change should be executed */
43
+ order: number;
44
+ /** Timestamp when this change was proposed */
45
+ proposedAt: string;
46
+ /** Optional: The tool call ID from the LLM response */
47
+ toolCallId?: string;
48
+ }
49
+ /**
50
+ * A pending plan awaiting user approval.
51
+ */
52
+ export interface PendingPlan {
53
+ /** Unique plan ID */
54
+ id: string;
55
+ /** The original task/prompt that led to this plan */
56
+ task: string;
57
+ /** When the plan was created */
58
+ createdAt: string;
59
+ /** When the plan was last updated */
60
+ updatedAt: string;
61
+ /** The proposed changes in execution order */
62
+ proposedChanges: ProposedChange[];
63
+ /** Summary of exploration done before proposing changes */
64
+ explorationSummary: string;
65
+ /** Current status of the plan */
66
+ status: PlanStatus;
67
+ /** Session ID this plan belongs to */
68
+ sessionId?: string;
69
+ }
70
+ /**
71
+ * Result of approving a plan.
72
+ */
73
+ export interface PlanApprovalResult {
74
+ /** Changes to execute */
75
+ changes: ProposedChange[];
76
+ /** Number of changes skipped (if partial approval) */
77
+ skippedCount: number;
78
+ }
79
+ /**
80
+ * Event types emitted by the plan manager.
81
+ */
82
+ export type PendingPlanEvent = {
83
+ type: 'plan.created';
84
+ plan: PendingPlan;
85
+ } | {
86
+ type: 'plan.change.added';
87
+ change: ProposedChange;
88
+ planId: string;
89
+ } | {
90
+ type: 'plan.approved';
91
+ planId: string;
92
+ changeCount: number;
93
+ } | {
94
+ type: 'plan.rejected';
95
+ planId: string;
96
+ } | {
97
+ type: 'plan.cleared';
98
+ planId: string;
99
+ };
100
+ export type PendingPlanEventListener = (event: PendingPlanEvent) => void;
101
+ /**
102
+ * Manages pending plans that await user approval.
103
+ */
104
+ export declare class PendingPlanManager {
105
+ private currentPlan;
106
+ private changeCounter;
107
+ private eventListeners;
108
+ /**
109
+ * Start a new pending plan.
110
+ * Clears any existing plan.
111
+ */
112
+ startPlan(task: string, sessionId?: string): PendingPlan;
113
+ /**
114
+ * Add a proposed change to the current plan.
115
+ * Returns the created change, or null if no plan is active.
116
+ */
117
+ addProposedChange(tool: string, args: Record<string, unknown>, reason: string, toolCallId?: string): ProposedChange | null;
118
+ /**
119
+ * Set the exploration summary for the current plan.
120
+ * Can be called multiple times - will append to existing summary.
121
+ *
122
+ * @param summary - The exploration content to add
123
+ * @param append - If true, appends to existing summary (default: false, replaces)
124
+ */
125
+ setExplorationSummary(summary: string, append?: boolean): void;
126
+ /**
127
+ * Append exploration findings to the current plan.
128
+ * Useful for capturing incremental exploration during planning.
129
+ */
130
+ appendExplorationFinding(finding: string): void;
131
+ /**
132
+ * Get the current pending plan.
133
+ */
134
+ getPendingPlan(): PendingPlan | null;
135
+ /**
136
+ * Check if there's an active pending plan.
137
+ */
138
+ hasPendingPlan(): boolean;
139
+ /**
140
+ * Get the number of proposed changes.
141
+ */
142
+ getChangeCount(): number;
143
+ /**
144
+ * Approve the pending plan.
145
+ * @param count - If provided, only approve the first N changes
146
+ * @returns The changes to execute
147
+ */
148
+ approve(count?: number): PlanApprovalResult;
149
+ /**
150
+ * Reject the pending plan.
151
+ * Clears all proposed changes.
152
+ */
153
+ reject(): void;
154
+ /**
155
+ * Clear the current plan without changing status.
156
+ */
157
+ clear(): void;
158
+ /**
159
+ * Restore a plan from storage.
160
+ */
161
+ restorePlan(plan: PendingPlan): void;
162
+ /**
163
+ * Format the pending plan for display.
164
+ */
165
+ formatPlan(): string;
166
+ /**
167
+ * Synthesize a coherent plan summary.
168
+ * This creates a well-structured executive summary from the proposed changes.
169
+ *
170
+ * @param llmProvider - Optional LLM provider for AI-generated synthesis.
171
+ * If not provided, uses structured template formatting.
172
+ * @returns A coherent plan summary string
173
+ */
174
+ synthesizePlan(llmProvider?: {
175
+ chat(messages: Array<{
176
+ role: 'user' | 'assistant' | 'system';
177
+ content: string;
178
+ }>): Promise<{
179
+ content: string;
180
+ }>;
181
+ }): Promise<string>;
182
+ /**
183
+ * Subscribe to plan events.
184
+ */
185
+ subscribe(listener: PendingPlanEventListener): () => void;
186
+ private emit;
187
+ }
188
+ /**
189
+ * Create a new pending plan manager.
190
+ */
191
+ export declare function createPendingPlanManager(): PendingPlanManager;
192
+ /**
193
+ * Format a plan for compact display (e.g., in status bar).
194
+ */
195
+ export declare function formatPlanStatus(plan: PendingPlan | null): string;
196
+ //# sourceMappingURL=pending-plan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pending-plan.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tasks/pending-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAMH;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,oBAAoB,CAAC;AAEpF;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,EAAE,EAAE,MAAM,CAAC;IAEX,oCAAoC;IACpC,IAAI,EAAE,MAAM,CAAC;IAEb,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE9B,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IAEf,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IAEd,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IAEnB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,qBAAqB;IACrB,EAAE,EAAE,MAAM,CAAC;IAEX,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IAEb,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+1,431 @@
1
+ /**
2
+ * Pending Plan Manager
3
+ *
4
+ * Manages plans that are awaiting user approval before execution.
5
+ * Used in "plan mode" where write operations are intercepted and queued
6
+ * as proposed changes rather than being executed immediately.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * const planManager = createPendingPlanManager();
11
+ *
12
+ * // In plan mode, intercept a write operation
13
+ * planManager.addProposedChange({
14
+ * tool: 'write_file',
15
+ * args: { path: 'src/main.ts', content: '...' },
16
+ * reason: 'Create entry point for the application',
17
+ * });
18
+ *
19
+ * // User approves the plan
20
+ * const changes = planManager.approve();
21
+ * for (const change of changes) {
22
+ * await executeTool(change.tool, change.args);
23
+ * }
24
+ * ```
25
+ */
26
+ // =============================================================================
27
+ // PENDING PLAN MANAGER
28
+ // =============================================================================
29
+ /**
30
+ * Manages pending plans that await user approval.
31
+ */
32
+ export class PendingPlanManager {
33
+ currentPlan = null;
34
+ changeCounter = 0;
35
+ eventListeners = new Set();
36
+ /**
37
+ * Start a new pending plan.
38
+ * Clears any existing plan.
39
+ */
40
+ startPlan(task, sessionId) {
41
+ const now = new Date().toISOString();
42
+ const plan = {
43
+ id: `plan-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`,
44
+ task,
45
+ createdAt: now,
46
+ updatedAt: now,
47
+ proposedChanges: [],
48
+ explorationSummary: '',
49
+ status: 'pending',
50
+ sessionId,
51
+ };
52
+ this.currentPlan = plan;
53
+ this.changeCounter = 0;
54
+ this.emit({ type: 'plan.created', plan });
55
+ return plan;
56
+ }
57
+ /**
58
+ * Add a proposed change to the current plan.
59
+ * Returns the created change, or null if no plan is active.
60
+ */
61
+ addProposedChange(tool, args, reason, toolCallId) {
62
+ if (!this.currentPlan) {
63
+ return null;
64
+ }
65
+ const change = {
66
+ id: `change-${++this.changeCounter}`,
67
+ tool,
68
+ args,
69
+ reason,
70
+ order: this.currentPlan.proposedChanges.length + 1,
71
+ proposedAt: new Date().toISOString(),
72
+ toolCallId,
73
+ };
74
+ this.currentPlan.proposedChanges.push(change);
75
+ this.currentPlan.updatedAt = new Date().toISOString();
76
+ this.emit({ type: 'plan.change.added', change, planId: this.currentPlan.id });
77
+ return change;
78
+ }
79
+ /**
80
+ * Set the exploration summary for the current plan.
81
+ * Can be called multiple times - will append to existing summary.
82
+ *
83
+ * @param summary - The exploration content to add
84
+ * @param append - If true, appends to existing summary (default: false, replaces)
85
+ */
86
+ setExplorationSummary(summary, append = false) {
87
+ if (this.currentPlan) {
88
+ if (append && this.currentPlan.explorationSummary) {
89
+ // Avoid duplicates by checking if this content is already included
90
+ if (!this.currentPlan.explorationSummary.includes(summary.slice(0, 100))) {
91
+ this.currentPlan.explorationSummary += '\n\n' + summary;
92
+ }
93
+ }
94
+ else {
95
+ this.currentPlan.explorationSummary = summary;
96
+ }
97
+ this.currentPlan.updatedAt = new Date().toISOString();
98
+ }
99
+ }
100
+ /**
101
+ * Append exploration findings to the current plan.
102
+ * Useful for capturing incremental exploration during planning.
103
+ */
104
+ appendExplorationFinding(finding) {
105
+ this.setExplorationSummary(finding, true);
106
+ }
107
+ /**
108
+ * Get the current pending plan.
109
+ */
110
+ getPendingPlan() {
111
+ return this.currentPlan;
112
+ }
113
+ /**
114
+ * Check if there's an active pending plan.
115
+ */
116
+ hasPendingPlan() {
117
+ return this.currentPlan !== null && this.currentPlan.status === 'pending';
118
+ }
119
+ /**
120
+ * Get the number of proposed changes.
121
+ */
122
+ getChangeCount() {
123
+ return this.currentPlan?.proposedChanges.length ?? 0;
124
+ }
125
+ /**
126
+ * Approve the pending plan.
127
+ * @param count - If provided, only approve the first N changes
128
+ * @returns The changes to execute
129
+ */
130
+ approve(count) {
131
+ if (!this.currentPlan) {
132
+ return { changes: [], skippedCount: 0 };
133
+ }
134
+ const allChanges = this.currentPlan.proposedChanges;
135
+ const approvedChanges = count !== undefined ? allChanges.slice(0, count) : allChanges;
136
+ const skippedCount = allChanges.length - approvedChanges.length;
137
+ this.currentPlan.status = skippedCount > 0 ? 'partially_approved' : 'approved';
138
+ this.currentPlan.updatedAt = new Date().toISOString();
139
+ this.emit({
140
+ type: 'plan.approved',
141
+ planId: this.currentPlan.id,
142
+ changeCount: approvedChanges.length,
143
+ });
144
+ // Clear the plan after approval
145
+ const result = { changes: approvedChanges, skippedCount };
146
+ this.currentPlan = null;
147
+ return result;
148
+ }
149
+ /**
150
+ * Reject the pending plan.
151
+ * Clears all proposed changes.
152
+ */
153
+ reject() {
154
+ if (!this.currentPlan) {
155
+ return;
156
+ }
157
+ this.currentPlan.status = 'rejected';
158
+ this.currentPlan.updatedAt = new Date().toISOString();
159
+ this.emit({ type: 'plan.rejected', planId: this.currentPlan.id });
160
+ this.currentPlan = null;
161
+ }
162
+ /**
163
+ * Clear the current plan without changing status.
164
+ */
165
+ clear() {
166
+ if (this.currentPlan) {
167
+ this.emit({ type: 'plan.cleared', planId: this.currentPlan.id });
168
+ this.currentPlan = null;
169
+ }
170
+ }
171
+ /**
172
+ * Restore a plan from storage.
173
+ */
174
+ restorePlan(plan) {
175
+ this.currentPlan = plan;
176
+ this.changeCounter = plan.proposedChanges.length;
177
+ }
178
+ /**
179
+ * Format the pending plan for display.
180
+ */
181
+ formatPlan() {
182
+ if (!this.currentPlan) {
183
+ return 'No pending plan.';
184
+ }
185
+ const lines = [
186
+ `━━━ PENDING PLAN ━━━`,
187
+ ``,
188
+ `Task: "${this.currentPlan.task}"`,
189
+ `Status: ${this.currentPlan.status}`,
190
+ `Created: ${this.currentPlan.createdAt}`,
191
+ '',
192
+ ];
193
+ // Show exploration summary if available
194
+ if (this.currentPlan.explorationSummary) {
195
+ lines.push('📋 Exploration Summary:');
196
+ lines.push(this.currentPlan.explorationSummary);
197
+ lines.push('');
198
+ }
199
+ if (this.currentPlan.proposedChanges.length === 0) {
200
+ lines.push('No proposed changes yet.');
201
+ }
202
+ else {
203
+ // Extract overall approach from first change's reason (often shared across spawn_agent calls)
204
+ const firstReason = this.currentPlan.proposedChanges[0]?.reason || '';
205
+ const allSameReason = this.currentPlan.proposedChanges.every((c) => c.reason === firstReason);
206
+ if (allSameReason && firstReason && this.currentPlan.proposedChanges.length > 1) {
207
+ lines.push('🎯 Overall Approach:');
208
+ lines.push(` ${firstReason}`);
209
+ lines.push('');
210
+ }
211
+ lines.push(`📝 Proposed Actions (${this.currentPlan.proposedChanges.length}):`);
212
+ lines.push('');
213
+ for (const change of this.currentPlan.proposedChanges) {
214
+ // Format based on tool type
215
+ if (change.tool === 'write_file' || change.tool === 'edit_file') {
216
+ const path = change.args.path || change.args.file_path || '(no path specified)';
217
+ lines.push(`${change.order}. [${change.tool}] ${path}`);
218
+ if (!allSameReason) {
219
+ lines.push(` └─ ${change.reason}`);
220
+ }
221
+ }
222
+ else if (change.tool === 'bash') {
223
+ const cmd = String(change.args.command || '').slice(0, 80);
224
+ lines.push(`${change.order}. [bash] ${cmd}${cmd.length >= 80 ? '...' : ''}`);
225
+ if (!allSameReason) {
226
+ lines.push(` └─ ${change.reason}`);
227
+ }
228
+ }
229
+ else if (change.tool === 'spawn_agent') {
230
+ // For spawn_agent, the task IS the plan - show it prominently
231
+ const agentType = change.args.agent || change.args.type || 'subagent';
232
+ const task = String(change.args.task || change.args.prompt || '');
233
+ lines.push(`${change.order}. [${agentType}]`);
234
+ // Show the full task, properly formatted with line breaks
235
+ const taskLines = task.split(/\n/).filter((l) => l.trim());
236
+ if (taskLines.length <= 3) {
237
+ // Short task - show inline
238
+ for (const taskLine of taskLines) {
239
+ lines.push(` ${taskLine.trim()}`);
240
+ }
241
+ }
242
+ else {
243
+ // Longer task - show first few lines and indicate more
244
+ for (let i = 0; i < Math.min(4, taskLines.length); i++) {
245
+ const line = taskLines[i].trim();
246
+ if (line.length > 100) {
247
+ lines.push(` ${line.slice(0, 97)}...`);
248
+ }
249
+ else {
250
+ lines.push(` ${line}`);
251
+ }
252
+ }
253
+ if (taskLines.length > 4) {
254
+ lines.push(` ... (${taskLines.length - 4} more lines)`);
255
+ }
256
+ }
257
+ if (!allSameReason) {
258
+ lines.push(` └─ ${change.reason}`);
259
+ }
260
+ }
261
+ else {
262
+ // Generic tool
263
+ lines.push(`${change.order}. [${change.tool}]`);
264
+ const argsStr = JSON.stringify(change.args);
265
+ if (argsStr.length > 100) {
266
+ lines.push(` Args: ${argsStr.slice(0, 97)}...`);
267
+ }
268
+ else {
269
+ lines.push(` Args: ${argsStr}`);
270
+ }
271
+ if (!allSameReason) {
272
+ lines.push(` └─ ${change.reason}`);
273
+ }
274
+ }
275
+ lines.push('');
276
+ }
277
+ }
278
+ lines.push('━━━━━━━━━━━━━━━━━━━━━━━');
279
+ lines.push('Commands: /approve, /reject, /show-plan');
280
+ return lines.join('\n');
281
+ }
282
+ /**
283
+ * Synthesize a coherent plan summary.
284
+ * This creates a well-structured executive summary from the proposed changes.
285
+ *
286
+ * @param llmProvider - Optional LLM provider for AI-generated synthesis.
287
+ * If not provided, uses structured template formatting.
288
+ * @returns A coherent plan summary string
289
+ */
290
+ async synthesizePlan(llmProvider) {
291
+ if (!this.currentPlan) {
292
+ return 'No pending plan.';
293
+ }
294
+ const plan = this.currentPlan;
295
+ const changes = plan.proposedChanges;
296
+ // If LLM provider is available, use it for intelligent synthesis
297
+ if (llmProvider && changes.length > 0) {
298
+ try {
299
+ const changesDescription = changes
300
+ .map((c) => {
301
+ const target = c.tool === 'spawn_agent'
302
+ ? `Delegate to subagent: ${String(c.args.agent || c.args.type || 'subagent')}`
303
+ : c.tool === 'bash'
304
+ ? `Execute: ${String(c.args.command || '').slice(0, 100)}`
305
+ : `${c.tool}: ${String(c.args.path || c.args.file_path || JSON.stringify(c.args)).slice(0, 100)}`;
306
+ return `${c.order}. [${c.tool}] ${target}\n Reason: ${c.reason}`;
307
+ })
308
+ .join('\n\n');
309
+ const prompt = `Analyze this plan and provide a concise executive summary.
310
+
311
+ Task: ${plan.task}
312
+ ${plan.explorationSummary ? `\nExploration findings:\n${plan.explorationSummary.slice(0, 1000)}` : ''}
313
+
314
+ Proposed Changes:
315
+ ${changesDescription}
316
+
317
+ Provide:
318
+ 1. A 2-3 sentence executive summary explaining what this plan accomplishes
319
+ 2. Key files/components that will be affected
320
+ 3. Any dependencies between the changes (what must happen first)
321
+ 4. Brief verification steps after completion
322
+
323
+ Keep it concise and actionable. Focus on the "why" not just the "what".`;
324
+ const response = await llmProvider.chat([{ role: 'user', content: prompt }]);
325
+ if (response.content && response.content.length > 50) {
326
+ return response.content;
327
+ }
328
+ }
329
+ catch {
330
+ // Fall through to template-based synthesis
331
+ }
332
+ }
333
+ // Template-based synthesis (no LLM or LLM failed)
334
+ const lines = [];
335
+ // Executive summary based on change types
336
+ const fileChanges = changes.filter((c) => ['write_file', 'edit_file'].includes(c.tool));
337
+ const bashCommands = changes.filter((c) => c.tool === 'bash');
338
+ const subagentTasks = changes.filter((c) => c.tool === 'spawn_agent');
339
+ lines.push('## Executive Summary');
340
+ lines.push('');
341
+ if (subagentTasks.length > 0) {
342
+ lines.push(`This plan delegates ${subagentTasks.length} task(s) to specialized subagents.`);
343
+ }
344
+ if (fileChanges.length > 0) {
345
+ const uniqueFiles = new Set(fileChanges.map((c) => String(c.args.path || c.args.file_path || '')));
346
+ lines.push(`${fileChanges.length} file operation(s) across ${uniqueFiles.size} file(s).`);
347
+ }
348
+ if (bashCommands.length > 0) {
349
+ lines.push(`${bashCommands.length} shell command(s) to execute.`);
350
+ }
351
+ lines.push('');
352
+ // Exploration context if available
353
+ if (plan.explorationSummary && plan.explorationSummary.length > 0) {
354
+ lines.push('## Context from Exploration');
355
+ // Take first 500 chars or first paragraph
356
+ const summary = plan.explorationSummary.split('\n\n')[0].slice(0, 500);
357
+ lines.push(summary + (plan.explorationSummary.length > 500 ? '...' : ''));
358
+ lines.push('');
359
+ }
360
+ // Key targets
361
+ if (fileChanges.length > 0) {
362
+ lines.push('## Files Affected');
363
+ const uniqueFiles = [
364
+ ...new Set(fileChanges.map((c) => String(c.args.path || c.args.file_path || 'unknown'))),
365
+ ];
366
+ for (const file of uniqueFiles.slice(0, 10)) {
367
+ lines.push(`- ${file}`);
368
+ }
369
+ if (uniqueFiles.length > 10) {
370
+ lines.push(`... and ${uniqueFiles.length - 10} more`);
371
+ }
372
+ lines.push('');
373
+ }
374
+ // Dependencies (simple sequential assumption)
375
+ if (changes.length > 1) {
376
+ lines.push('## Execution Order');
377
+ lines.push('Changes will be executed sequentially in the order shown.');
378
+ lines.push('');
379
+ }
380
+ // Verification suggestion
381
+ lines.push('## Verification');
382
+ if (bashCommands.some((c) => String(c.args.command || '').includes('test'))) {
383
+ lines.push('- Tests are included in this plan');
384
+ }
385
+ else {
386
+ lines.push('- Consider running tests after approval: `npm test` or relevant test command');
387
+ }
388
+ if (fileChanges.length > 0) {
389
+ lines.push('- Review changed files after execution');
390
+ }
391
+ return lines.join('\n');
392
+ }
393
+ /**
394
+ * Subscribe to plan events.
395
+ */
396
+ subscribe(listener) {
397
+ this.eventListeners.add(listener);
398
+ return () => this.eventListeners.delete(listener);
399
+ }
400
+ // Internal
401
+ emit(event) {
402
+ for (const listener of this.eventListeners) {
403
+ try {
404
+ listener(event);
405
+ }
406
+ catch {
407
+ // Ignore listener errors
408
+ }
409
+ }
410
+ }
411
+ }
412
+ // =============================================================================
413
+ // FACTORY
414
+ // =============================================================================
415
+ /**
416
+ * Create a new pending plan manager.
417
+ */
418
+ export function createPendingPlanManager() {
419
+ return new PendingPlanManager();
420
+ }
421
+ /**
422
+ * Format a plan for compact display (e.g., in status bar).
423
+ */
424
+ export function formatPlanStatus(plan) {
425
+ if (!plan) {
426
+ return '';
427
+ }
428
+ const count = plan.proposedChanges.length;
429
+ return `${count} change${count === 1 ? '' : 's'} pending`;
430
+ }
431
+ //# sourceMappingURL=pending-plan.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pending-plan.js","sourceRoot":"","sources":["../../../../src/integrations/tasks/pending-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAyFH,gFAAgF;AAChF,uBAAuB;AACvB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,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