attocode 0.2.4 → 0.2.5

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 (577) hide show
  1. package/CHANGELOG.md +56 -1
  2. package/dist/src/adapters.d.ts +2 -1
  3. package/dist/src/adapters.d.ts.map +1 -1
  4. package/dist/src/adapters.js +60 -2
  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 +677 -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 +173 -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 +262 -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.d.ts +14 -115
  29. package/dist/src/agent.d.ts.map +1 -1
  30. package/dist/src/agent.js +36 -1177
  31. package/dist/src/agent.js.map +1 -1
  32. package/dist/src/cli.js +1 -1
  33. package/dist/src/cli.js.map +1 -1
  34. package/dist/src/commands/handler.d.ts.map +1 -1
  35. package/dist/src/commands/handler.js +8 -7
  36. package/dist/src/commands/handler.js.map +1 -1
  37. package/dist/src/commands/init.js +1 -1
  38. package/dist/src/commands/init.js.map +1 -1
  39. package/dist/src/config/schema.d.ts +6 -6
  40. package/dist/src/core/execution-loop.d.ts.map +1 -1
  41. package/dist/src/core/execution-loop.js +155 -16
  42. package/dist/src/core/execution-loop.js.map +1 -1
  43. package/dist/src/core/response-handler.d.ts.map +1 -1
  44. package/dist/src/core/response-handler.js +3 -2
  45. package/dist/src/core/response-handler.js.map +1 -1
  46. package/dist/src/core/subagent-spawner.d.ts.map +1 -1
  47. package/dist/src/core/subagent-spawner.js +13 -6
  48. package/dist/src/core/subagent-spawner.js.map +1 -1
  49. package/dist/src/core/tool-executor.d.ts.map +1 -1
  50. package/dist/src/core/tool-executor.js +7 -2
  51. package/dist/src/core/tool-executor.js.map +1 -1
  52. package/dist/src/core/types.d.ts +1 -0
  53. package/dist/src/core/types.d.ts.map +1 -1
  54. package/dist/src/core/types.js.map +1 -1
  55. package/dist/src/integrations/agents/agent-registry.d.ts +262 -0
  56. package/dist/src/integrations/agents/agent-registry.d.ts.map +1 -0
  57. package/dist/src/integrations/agents/agent-registry.js +686 -0
  58. package/dist/src/integrations/agents/agent-registry.js.map +1 -0
  59. package/dist/src/integrations/agents/async-subagent.d.ts +135 -0
  60. package/dist/src/integrations/agents/async-subagent.d.ts.map +1 -0
  61. package/dist/src/integrations/agents/async-subagent.js +213 -0
  62. package/dist/src/integrations/agents/async-subagent.js.map +1 -0
  63. package/dist/src/integrations/agents/complexity-classifier.d.ts +86 -0
  64. package/dist/src/integrations/agents/complexity-classifier.d.ts.map +1 -0
  65. package/dist/src/integrations/agents/complexity-classifier.js +233 -0
  66. package/dist/src/integrations/agents/complexity-classifier.js.map +1 -0
  67. package/dist/src/integrations/agents/delegation-protocol.d.ts +86 -0
  68. package/dist/src/integrations/agents/delegation-protocol.d.ts.map +1 -0
  69. package/dist/src/integrations/agents/delegation-protocol.js +127 -0
  70. package/dist/src/integrations/agents/delegation-protocol.js.map +1 -0
  71. package/dist/src/integrations/agents/multi-agent.d.ts +150 -0
  72. package/dist/src/integrations/agents/multi-agent.d.ts.map +1 -0
  73. package/dist/src/integrations/agents/multi-agent.js +306 -0
  74. package/dist/src/integrations/agents/multi-agent.js.map +1 -0
  75. package/dist/src/integrations/agents/result-synthesizer.d.ts +389 -0
  76. package/dist/src/integrations/agents/result-synthesizer.d.ts.map +1 -0
  77. package/dist/src/integrations/agents/result-synthesizer.js +951 -0
  78. package/dist/src/integrations/agents/result-synthesizer.js.map +1 -0
  79. package/dist/src/integrations/agents/shared-blackboard.d.ts +406 -0
  80. package/dist/src/integrations/agents/shared-blackboard.d.ts.map +1 -0
  81. package/dist/src/integrations/agents/shared-blackboard.js +757 -0
  82. package/dist/src/integrations/agents/shared-blackboard.js.map +1 -0
  83. package/dist/src/integrations/agents/subagent-output-store.d.ts +91 -0
  84. package/dist/src/integrations/agents/subagent-output-store.d.ts.map +1 -0
  85. package/dist/src/integrations/agents/subagent-output-store.js +257 -0
  86. package/dist/src/integrations/agents/subagent-output-store.js.map +1 -0
  87. package/dist/src/integrations/budget/budget-pool.d.ts +115 -0
  88. package/dist/src/integrations/budget/budget-pool.d.ts.map +1 -0
  89. package/dist/src/integrations/budget/budget-pool.js +205 -0
  90. package/dist/src/integrations/budget/budget-pool.js.map +1 -0
  91. package/dist/src/integrations/budget/cancellation.d.ts +229 -0
  92. package/dist/src/integrations/budget/cancellation.d.ts.map +1 -0
  93. package/dist/src/integrations/budget/cancellation.js +520 -0
  94. package/dist/src/integrations/budget/cancellation.js.map +1 -0
  95. package/dist/src/integrations/budget/dynamic-budget.d.ts +81 -0
  96. package/dist/src/integrations/budget/dynamic-budget.d.ts.map +1 -0
  97. package/dist/src/integrations/budget/dynamic-budget.js +151 -0
  98. package/dist/src/integrations/budget/dynamic-budget.js.map +1 -0
  99. package/dist/src/integrations/budget/economics.d.ts +435 -0
  100. package/dist/src/integrations/budget/economics.d.ts.map +1 -0
  101. package/dist/src/integrations/budget/economics.js +1007 -0
  102. package/dist/src/integrations/budget/economics.js.map +1 -0
  103. package/dist/src/integrations/budget/injection-budget.d.ts +71 -0
  104. package/dist/src/integrations/budget/injection-budget.d.ts.map +1 -0
  105. package/dist/src/integrations/budget/injection-budget.js +137 -0
  106. package/dist/src/integrations/budget/injection-budget.js.map +1 -0
  107. package/dist/src/integrations/budget/loop-detector.d.ts +105 -0
  108. package/dist/src/integrations/budget/loop-detector.d.ts.map +1 -0
  109. package/dist/src/integrations/budget/loop-detector.js +287 -0
  110. package/dist/src/integrations/budget/loop-detector.js.map +1 -0
  111. package/dist/src/integrations/budget/phase-tracker.d.ts +114 -0
  112. package/dist/src/integrations/budget/phase-tracker.d.ts.map +1 -0
  113. package/dist/src/integrations/budget/phase-tracker.js +262 -0
  114. package/dist/src/integrations/budget/phase-tracker.js.map +1 -0
  115. package/dist/src/integrations/budget/resources.d.ts +182 -0
  116. package/dist/src/integrations/budget/resources.d.ts.map +1 -0
  117. package/dist/src/integrations/budget/resources.js +318 -0
  118. package/dist/src/integrations/budget/resources.js.map +1 -0
  119. package/dist/src/integrations/context/auto-compaction.d.ts +210 -0
  120. package/dist/src/integrations/context/auto-compaction.d.ts.map +1 -0
  121. package/dist/src/integrations/context/auto-compaction.js +477 -0
  122. package/dist/src/integrations/context/auto-compaction.js.map +1 -0
  123. package/dist/src/integrations/context/code-analyzer.d.ts +71 -0
  124. package/dist/src/integrations/context/code-analyzer.d.ts.map +1 -0
  125. package/dist/src/integrations/context/code-analyzer.js +448 -0
  126. package/dist/src/integrations/context/code-analyzer.js.map +1 -0
  127. package/dist/src/integrations/context/code-selector.d.ts +78 -0
  128. package/dist/src/integrations/context/code-selector.d.ts.map +1 -0
  129. package/dist/src/integrations/context/code-selector.js +649 -0
  130. package/dist/src/integrations/context/code-selector.js.map +1 -0
  131. package/dist/src/integrations/context/codebase-ast.d.ts +138 -0
  132. package/dist/src/integrations/context/codebase-ast.d.ts.map +1 -0
  133. package/dist/src/integrations/context/codebase-ast.js +818 -0
  134. package/dist/src/integrations/context/codebase-ast.js.map +1 -0
  135. package/dist/src/integrations/context/codebase-context.d.ts +473 -0
  136. package/dist/src/integrations/context/codebase-context.d.ts.map +1 -0
  137. package/dist/src/integrations/context/codebase-context.js +685 -0
  138. package/dist/src/integrations/context/codebase-context.js.map +1 -0
  139. package/dist/src/integrations/context/compaction.d.ts +191 -0
  140. package/dist/src/integrations/context/compaction.d.ts.map +1 -0
  141. package/dist/src/integrations/context/compaction.js +384 -0
  142. package/dist/src/integrations/context/compaction.js.map +1 -0
  143. package/dist/src/integrations/context/context-engineering.d.ts +274 -0
  144. package/dist/src/integrations/context/context-engineering.d.ts.map +1 -0
  145. package/dist/src/integrations/context/context-engineering.js +437 -0
  146. package/dist/src/integrations/context/context-engineering.js.map +1 -0
  147. package/dist/src/integrations/context/file-cache.d.ts +97 -0
  148. package/dist/src/integrations/context/file-cache.d.ts.map +1 -0
  149. package/dist/src/integrations/context/file-cache.js +218 -0
  150. package/dist/src/integrations/context/file-cache.js.map +1 -0
  151. package/dist/src/integrations/context/semantic-cache.d.ts +178 -0
  152. package/dist/src/integrations/context/semantic-cache.d.ts.map +1 -0
  153. package/dist/src/integrations/context/semantic-cache.js +372 -0
  154. package/dist/src/integrations/context/semantic-cache.js.map +1 -0
  155. package/dist/src/integrations/index.d.ts +72 -68
  156. package/dist/src/integrations/index.d.ts.map +1 -1
  157. package/dist/src/integrations/index.js +76 -68
  158. package/dist/src/integrations/index.js.map +1 -1
  159. package/dist/src/integrations/lsp/lsp.d.ts +196 -0
  160. package/dist/src/integrations/lsp/lsp.d.ts.map +1 -0
  161. package/dist/src/integrations/lsp/lsp.js +583 -0
  162. package/dist/src/integrations/lsp/lsp.js.map +1 -0
  163. package/dist/src/integrations/mcp/mcp-client.d.ts +279 -0
  164. package/dist/src/integrations/mcp/mcp-client.d.ts.map +1 -0
  165. package/dist/src/integrations/mcp/mcp-client.js +755 -0
  166. package/dist/src/integrations/mcp/mcp-client.js.map +1 -0
  167. package/dist/src/integrations/mcp/mcp-custom-tools.d.ts +102 -0
  168. package/dist/src/integrations/mcp/mcp-custom-tools.d.ts.map +1 -0
  169. package/dist/src/integrations/mcp/mcp-custom-tools.js +232 -0
  170. package/dist/src/integrations/mcp/mcp-custom-tools.js.map +1 -0
  171. package/dist/src/integrations/mcp/mcp-tool-search.d.ts +77 -0
  172. package/dist/src/integrations/mcp/mcp-tool-search.d.ts.map +1 -0
  173. package/dist/src/integrations/mcp/mcp-tool-search.js +220 -0
  174. package/dist/src/integrations/mcp/mcp-tool-search.js.map +1 -0
  175. package/dist/src/integrations/mcp/mcp-tool-validator.d.ts +60 -0
  176. package/dist/src/integrations/mcp/mcp-tool-validator.d.ts.map +1 -0
  177. package/dist/src/integrations/mcp/mcp-tool-validator.js +141 -0
  178. package/dist/src/integrations/mcp/mcp-tool-validator.js.map +1 -0
  179. package/dist/src/integrations/persistence/codebase-repository.d.ts +45 -0
  180. package/dist/src/integrations/persistence/codebase-repository.d.ts.map +1 -0
  181. package/dist/src/integrations/persistence/codebase-repository.js +81 -0
  182. package/dist/src/integrations/persistence/codebase-repository.js.map +1 -0
  183. package/dist/src/integrations/persistence/goal-repository.d.ts +71 -0
  184. package/dist/src/integrations/persistence/goal-repository.d.ts.map +1 -0
  185. package/dist/src/integrations/persistence/goal-repository.js +184 -0
  186. package/dist/src/integrations/persistence/goal-repository.js.map +1 -0
  187. package/dist/src/integrations/persistence/history.d.ts +72 -0
  188. package/dist/src/integrations/persistence/history.d.ts.map +1 -0
  189. package/dist/src/integrations/persistence/history.js +165 -0
  190. package/dist/src/integrations/persistence/history.js.map +1 -0
  191. package/dist/src/integrations/persistence/persistence.d.ts +49 -0
  192. package/dist/src/integrations/persistence/persistence.d.ts.map +1 -0
  193. package/dist/src/integrations/persistence/persistence.js +197 -0
  194. package/dist/src/integrations/persistence/persistence.js.map +1 -0
  195. package/dist/src/integrations/persistence/session-repository.d.ts +212 -0
  196. package/dist/src/integrations/persistence/session-repository.d.ts.map +1 -0
  197. package/dist/src/integrations/persistence/session-repository.js +770 -0
  198. package/dist/src/integrations/persistence/session-repository.js.map +1 -0
  199. package/dist/src/integrations/persistence/session-store.d.ts +184 -0
  200. package/dist/src/integrations/persistence/session-store.d.ts.map +1 -0
  201. package/dist/src/integrations/persistence/session-store.js +346 -0
  202. package/dist/src/integrations/persistence/session-store.js.map +1 -0
  203. package/dist/src/integrations/persistence/sqlite-store.d.ts +453 -0
  204. package/dist/src/integrations/persistence/sqlite-store.d.ts.map +1 -0
  205. package/dist/src/integrations/persistence/sqlite-store.js +676 -0
  206. package/dist/src/integrations/persistence/sqlite-store.js.map +1 -0
  207. package/dist/src/integrations/persistence/worker-repository.d.ts +65 -0
  208. package/dist/src/integrations/persistence/worker-repository.d.ts.map +1 -0
  209. package/dist/src/integrations/persistence/worker-repository.js +183 -0
  210. package/dist/src/integrations/persistence/worker-repository.js.map +1 -0
  211. package/dist/src/integrations/quality/auto-checkpoint.d.ts +98 -0
  212. package/dist/src/integrations/quality/auto-checkpoint.d.ts.map +1 -0
  213. package/dist/src/integrations/quality/auto-checkpoint.js +252 -0
  214. package/dist/src/integrations/quality/auto-checkpoint.js.map +1 -0
  215. package/dist/src/integrations/quality/dead-letter-queue.d.ts +233 -0
  216. package/dist/src/integrations/quality/dead-letter-queue.d.ts.map +1 -0
  217. package/dist/src/integrations/quality/dead-letter-queue.js +543 -0
  218. package/dist/src/integrations/quality/dead-letter-queue.js.map +1 -0
  219. package/dist/src/integrations/quality/health-check.d.ts +218 -0
  220. package/dist/src/integrations/quality/health-check.d.ts.map +1 -0
  221. package/dist/src/integrations/quality/health-check.js +415 -0
  222. package/dist/src/integrations/quality/health-check.js.map +1 -0
  223. package/dist/src/integrations/quality/learning-store.d.ts +291 -0
  224. package/dist/src/integrations/quality/learning-store.d.ts.map +1 -0
  225. package/dist/src/integrations/quality/learning-store.js +646 -0
  226. package/dist/src/integrations/quality/learning-store.js.map +1 -0
  227. package/dist/src/integrations/quality/self-improvement.d.ts +90 -0
  228. package/dist/src/integrations/quality/self-improvement.d.ts.map +1 -0
  229. package/dist/src/integrations/quality/self-improvement.js +229 -0
  230. package/dist/src/integrations/quality/self-improvement.js.map +1 -0
  231. package/dist/src/integrations/quality/tool-recommendation.d.ts +61 -0
  232. package/dist/src/integrations/quality/tool-recommendation.d.ts.map +1 -0
  233. package/dist/src/integrations/quality/tool-recommendation.js +268 -0
  234. package/dist/src/integrations/quality/tool-recommendation.js.map +1 -0
  235. package/dist/src/integrations/safety/bash-policy.d.ts +33 -0
  236. package/dist/src/integrations/safety/bash-policy.d.ts.map +1 -0
  237. package/dist/src/integrations/safety/bash-policy.js +144 -0
  238. package/dist/src/integrations/safety/bash-policy.js.map +1 -0
  239. package/dist/src/integrations/safety/edit-validator.d.ts +30 -0
  240. package/dist/src/integrations/safety/edit-validator.d.ts.map +1 -0
  241. package/dist/src/integrations/safety/edit-validator.js +87 -0
  242. package/dist/src/integrations/safety/edit-validator.js.map +1 -0
  243. package/dist/src/integrations/safety/execution-policy.d.ts +189 -0
  244. package/dist/src/integrations/safety/execution-policy.d.ts.map +1 -0
  245. package/dist/src/integrations/safety/execution-policy.js +352 -0
  246. package/dist/src/integrations/safety/execution-policy.js.map +1 -0
  247. package/dist/src/integrations/safety/policy-engine.d.ts +55 -0
  248. package/dist/src/integrations/safety/policy-engine.d.ts.map +1 -0
  249. package/dist/src/integrations/safety/policy-engine.js +247 -0
  250. package/dist/src/integrations/safety/policy-engine.js.map +1 -0
  251. package/dist/src/integrations/safety/safety.d.ts +174 -0
  252. package/dist/src/integrations/safety/safety.d.ts.map +1 -0
  253. package/dist/src/integrations/safety/safety.js +470 -0
  254. package/dist/src/integrations/safety/safety.js.map +1 -0
  255. package/dist/src/integrations/safety/sandbox/basic.d.ts +81 -0
  256. package/dist/src/integrations/safety/sandbox/basic.d.ts.map +1 -0
  257. package/dist/src/integrations/safety/sandbox/basic.js +335 -0
  258. package/dist/src/integrations/safety/sandbox/basic.js.map +1 -0
  259. package/dist/src/integrations/safety/sandbox/docker.d.ts +94 -0
  260. package/dist/src/integrations/safety/sandbox/docker.d.ts.map +1 -0
  261. package/dist/src/integrations/safety/sandbox/docker.js +294 -0
  262. package/dist/src/integrations/safety/sandbox/docker.js.map +1 -0
  263. package/dist/src/integrations/safety/sandbox/index.d.ts +188 -0
  264. package/dist/src/integrations/safety/sandbox/index.d.ts.map +1 -0
  265. package/dist/src/integrations/safety/sandbox/index.js +386 -0
  266. package/dist/src/integrations/safety/sandbox/index.js.map +1 -0
  267. package/dist/src/integrations/safety/sandbox/landlock.d.ts +59 -0
  268. package/dist/src/integrations/safety/sandbox/landlock.d.ts.map +1 -0
  269. package/dist/src/integrations/safety/sandbox/landlock.js +329 -0
  270. package/dist/src/integrations/safety/sandbox/landlock.js.map +1 -0
  271. package/dist/src/integrations/safety/sandbox/seatbelt.d.ts +68 -0
  272. package/dist/src/integrations/safety/sandbox/seatbelt.d.ts.map +1 -0
  273. package/dist/src/integrations/safety/sandbox/seatbelt.js +298 -0
  274. package/dist/src/integrations/safety/sandbox/seatbelt.js.map +1 -0
  275. package/dist/src/integrations/safety/type-checker.d.ts +53 -0
  276. package/dist/src/integrations/safety/type-checker.d.ts.map +1 -0
  277. package/dist/src/integrations/safety/type-checker.js +142 -0
  278. package/dist/src/integrations/safety/type-checker.js.map +1 -0
  279. package/dist/src/integrations/skills/skill-executor.d.ts +113 -0
  280. package/dist/src/integrations/skills/skill-executor.d.ts.map +1 -0
  281. package/dist/src/integrations/skills/skill-executor.js +270 -0
  282. package/dist/src/integrations/skills/skill-executor.js.map +1 -0
  283. package/dist/src/integrations/skills/skills.d.ts +262 -0
  284. package/dist/src/integrations/skills/skills.d.ts.map +1 -0
  285. package/dist/src/integrations/skills/skills.js +602 -0
  286. package/dist/src/integrations/skills/skills.js.map +1 -0
  287. package/dist/src/integrations/streaming/pty-shell.d.ts +169 -0
  288. package/dist/src/integrations/streaming/pty-shell.d.ts.map +1 -0
  289. package/dist/src/integrations/streaming/pty-shell.js +367 -0
  290. package/dist/src/integrations/streaming/pty-shell.js.map +1 -0
  291. package/dist/src/integrations/streaming/streaming.d.ts +102 -0
  292. package/dist/src/integrations/streaming/streaming.d.ts.map +1 -0
  293. package/dist/src/integrations/streaming/streaming.js +362 -0
  294. package/dist/src/integrations/streaming/streaming.js.map +1 -0
  295. package/dist/src/integrations/swarm/index.d.ts +2 -1
  296. package/dist/src/integrations/swarm/index.d.ts.map +1 -1
  297. package/dist/src/integrations/swarm/index.js +2 -0
  298. package/dist/src/integrations/swarm/index.js.map +1 -1
  299. package/dist/src/integrations/swarm/model-selector.js +1 -1
  300. package/dist/src/integrations/swarm/model-selector.js.map +1 -1
  301. package/dist/src/integrations/swarm/swarm-budget.d.ts +1 -1
  302. package/dist/src/integrations/swarm/swarm-budget.d.ts.map +1 -1
  303. package/dist/src/integrations/swarm/swarm-budget.js +1 -1
  304. package/dist/src/integrations/swarm/swarm-budget.js.map +1 -1
  305. package/dist/src/integrations/swarm/swarm-config-loader.d.ts.map +1 -1
  306. package/dist/src/integrations/swarm/swarm-config-loader.js +7 -0
  307. package/dist/src/integrations/swarm/swarm-config-loader.js.map +1 -1
  308. package/dist/src/integrations/swarm/swarm-events.d.ts +1 -1
  309. package/dist/src/integrations/swarm/swarm-events.d.ts.map +1 -1
  310. package/dist/src/integrations/swarm/swarm-execution.d.ts +27 -0
  311. package/dist/src/integrations/swarm/swarm-execution.d.ts.map +1 -0
  312. package/dist/src/integrations/swarm/swarm-execution.js +1021 -0
  313. package/dist/src/integrations/swarm/swarm-execution.js.map +1 -0
  314. package/dist/src/integrations/swarm/swarm-helpers.d.ts +26 -0
  315. package/dist/src/integrations/swarm/swarm-helpers.d.ts.map +1 -0
  316. package/dist/src/integrations/swarm/swarm-helpers.js +95 -0
  317. package/dist/src/integrations/swarm/swarm-helpers.js.map +1 -0
  318. package/dist/src/integrations/swarm/swarm-lifecycle.d.ts +100 -0
  319. package/dist/src/integrations/swarm/swarm-lifecycle.d.ts.map +1 -0
  320. package/dist/src/integrations/swarm/swarm-lifecycle.js +922 -0
  321. package/dist/src/integrations/swarm/swarm-lifecycle.js.map +1 -0
  322. package/dist/src/integrations/swarm/swarm-orchestrator.d.ts +84 -203
  323. package/dist/src/integrations/swarm/swarm-orchestrator.d.ts.map +1 -1
  324. package/dist/src/integrations/swarm/swarm-orchestrator.js +251 -2870
  325. package/dist/src/integrations/swarm/swarm-orchestrator.js.map +1 -1
  326. package/dist/src/integrations/swarm/swarm-quality-gate.js +1 -1
  327. package/dist/src/integrations/swarm/swarm-quality-gate.js.map +1 -1
  328. package/dist/src/integrations/swarm/swarm-recovery.d.ts +75 -0
  329. package/dist/src/integrations/swarm/swarm-recovery.d.ts.map +1 -0
  330. package/dist/src/integrations/swarm/swarm-recovery.js +550 -0
  331. package/dist/src/integrations/swarm/swarm-recovery.js.map +1 -0
  332. package/dist/src/integrations/swarm/swarm-state-store.d.ts.map +1 -1
  333. package/dist/src/integrations/swarm/swarm-state-store.js +6 -0
  334. package/dist/src/integrations/swarm/swarm-state-store.js.map +1 -1
  335. package/dist/src/integrations/swarm/task-queue.d.ts +1 -1
  336. package/dist/src/integrations/swarm/task-queue.d.ts.map +1 -1
  337. package/dist/src/integrations/swarm/task-queue.js +28 -1
  338. package/dist/src/integrations/swarm/task-queue.js.map +1 -1
  339. package/dist/src/integrations/swarm/types.d.ts +17 -5
  340. package/dist/src/integrations/swarm/types.d.ts.map +1 -1
  341. package/dist/src/integrations/swarm/types.js.map +1 -1
  342. package/dist/src/integrations/swarm/worker-pool.d.ts +1 -1
  343. package/dist/src/integrations/swarm/worker-pool.d.ts.map +1 -1
  344. package/dist/src/integrations/swarm/worker-pool.js +13 -9
  345. package/dist/src/integrations/swarm/worker-pool.js.map +1 -1
  346. package/dist/src/integrations/tasks/dependency-analyzer.d.ts +34 -0
  347. package/dist/src/integrations/tasks/dependency-analyzer.d.ts.map +1 -0
  348. package/dist/src/integrations/tasks/dependency-analyzer.js +232 -0
  349. package/dist/src/integrations/tasks/dependency-analyzer.js.map +1 -0
  350. package/dist/src/integrations/tasks/interactive-planning.d.ts +322 -0
  351. package/dist/src/integrations/tasks/interactive-planning.d.ts.map +1 -0
  352. package/dist/src/integrations/tasks/interactive-planning.js +655 -0
  353. package/dist/src/integrations/tasks/interactive-planning.js.map +1 -0
  354. package/dist/src/integrations/tasks/pending-plan.d.ts +196 -0
  355. package/dist/src/integrations/tasks/pending-plan.d.ts.map +1 -0
  356. package/dist/src/integrations/tasks/pending-plan.js +431 -0
  357. package/dist/src/integrations/tasks/pending-plan.js.map +1 -0
  358. package/dist/src/integrations/tasks/planning.d.ts +115 -0
  359. package/dist/src/integrations/tasks/planning.d.ts.map +1 -0
  360. package/dist/src/integrations/tasks/planning.js +413 -0
  361. package/dist/src/integrations/tasks/planning.js.map +1 -0
  362. package/dist/src/integrations/tasks/smart-decomposer.d.ts +316 -0
  363. package/dist/src/integrations/tasks/smart-decomposer.d.ts.map +1 -0
  364. package/dist/src/integrations/tasks/smart-decomposer.js +661 -0
  365. package/dist/src/integrations/tasks/smart-decomposer.js.map +1 -0
  366. package/dist/src/integrations/tasks/task-manager.d.ts +164 -0
  367. package/dist/src/integrations/tasks/task-manager.d.ts.map +1 -0
  368. package/dist/src/integrations/tasks/task-manager.js +383 -0
  369. package/dist/src/integrations/tasks/task-manager.js.map +1 -0
  370. package/dist/src/integrations/tasks/task-splitter.d.ts +56 -0
  371. package/dist/src/integrations/tasks/task-splitter.d.ts.map +1 -0
  372. package/dist/src/integrations/tasks/task-splitter.js +537 -0
  373. package/dist/src/integrations/tasks/task-splitter.js.map +1 -0
  374. package/dist/src/integrations/tasks/verification-gate.d.ts +103 -0
  375. package/dist/src/integrations/tasks/verification-gate.d.ts.map +1 -0
  376. package/dist/src/integrations/tasks/verification-gate.js +193 -0
  377. package/dist/src/integrations/tasks/verification-gate.js.map +1 -0
  378. package/dist/src/integrations/tasks/work-log.d.ts +87 -0
  379. package/dist/src/integrations/tasks/work-log.d.ts.map +1 -0
  380. package/dist/src/integrations/tasks/work-log.js +275 -0
  381. package/dist/src/integrations/tasks/work-log.js.map +1 -0
  382. package/dist/src/integrations/utilities/capabilities.d.ts +160 -0
  383. package/dist/src/integrations/utilities/capabilities.d.ts.map +1 -0
  384. package/dist/src/integrations/utilities/capabilities.js +426 -0
  385. package/dist/src/integrations/utilities/capabilities.js.map +1 -0
  386. package/dist/src/integrations/utilities/diff-utils.d.ts +105 -0
  387. package/dist/src/integrations/utilities/diff-utils.d.ts.map +1 -0
  388. package/dist/src/integrations/utilities/diff-utils.js +497 -0
  389. package/dist/src/integrations/utilities/diff-utils.js.map +1 -0
  390. package/dist/src/integrations/utilities/environment-facts.d.ts +52 -0
  391. package/dist/src/integrations/utilities/environment-facts.d.ts.map +1 -0
  392. package/dist/src/integrations/utilities/environment-facts.js +84 -0
  393. package/dist/src/integrations/utilities/environment-facts.js.map +1 -0
  394. package/dist/src/integrations/utilities/file-change-tracker.d.ts +162 -0
  395. package/dist/src/integrations/utilities/file-change-tracker.d.ts.map +1 -0
  396. package/dist/src/integrations/utilities/file-change-tracker.js +538 -0
  397. package/dist/src/integrations/utilities/file-change-tracker.js.map +1 -0
  398. package/dist/src/integrations/utilities/graph-visualization.d.ts +72 -0
  399. package/dist/src/integrations/utilities/graph-visualization.d.ts.map +1 -0
  400. package/dist/src/integrations/utilities/graph-visualization.js +383 -0
  401. package/dist/src/integrations/utilities/graph-visualization.js.map +1 -0
  402. package/dist/src/integrations/utilities/hierarchical-config.d.ts +215 -0
  403. package/dist/src/integrations/utilities/hierarchical-config.d.ts.map +1 -0
  404. package/dist/src/integrations/utilities/hierarchical-config.js +504 -0
  405. package/dist/src/integrations/utilities/hierarchical-config.js.map +1 -0
  406. package/dist/src/integrations/utilities/hooks.d.ts +116 -0
  407. package/dist/src/integrations/utilities/hooks.d.ts.map +1 -0
  408. package/dist/src/integrations/utilities/hooks.js +410 -0
  409. package/dist/src/integrations/utilities/hooks.js.map +1 -0
  410. package/dist/src/integrations/utilities/ignore.d.ts +143 -0
  411. package/dist/src/integrations/utilities/ignore.d.ts.map +1 -0
  412. package/dist/src/integrations/utilities/ignore.js +417 -0
  413. package/dist/src/integrations/utilities/ignore.js.map +1 -0
  414. package/dist/src/integrations/utilities/image-renderer.d.ts +119 -0
  415. package/dist/src/integrations/utilities/image-renderer.d.ts.map +1 -0
  416. package/dist/src/integrations/utilities/image-renderer.js +306 -0
  417. package/dist/src/integrations/utilities/image-renderer.js.map +1 -0
  418. package/dist/src/integrations/utilities/logger.d.ts +104 -0
  419. package/dist/src/integrations/utilities/logger.d.ts.map +1 -0
  420. package/dist/src/integrations/utilities/logger.js +219 -0
  421. package/dist/src/integrations/utilities/logger.js.map +1 -0
  422. package/dist/src/integrations/utilities/memory.d.ts +116 -0
  423. package/dist/src/integrations/utilities/memory.d.ts.map +1 -0
  424. package/dist/src/integrations/utilities/memory.js +311 -0
  425. package/dist/src/integrations/utilities/memory.js.map +1 -0
  426. package/dist/src/integrations/utilities/observability.d.ts +162 -0
  427. package/dist/src/integrations/utilities/observability.d.ts.map +1 -0
  428. package/dist/src/integrations/utilities/observability.js +407 -0
  429. package/dist/src/integrations/utilities/observability.js.map +1 -0
  430. package/dist/src/integrations/utilities/openrouter-pricing.d.ts +67 -0
  431. package/dist/src/integrations/utilities/openrouter-pricing.d.ts.map +1 -0
  432. package/dist/src/integrations/utilities/openrouter-pricing.js +166 -0
  433. package/dist/src/integrations/utilities/openrouter-pricing.js.map +1 -0
  434. package/dist/src/integrations/utilities/react.d.ts +139 -0
  435. package/dist/src/integrations/utilities/react.d.ts.map +1 -0
  436. package/dist/src/integrations/utilities/react.js +273 -0
  437. package/dist/src/integrations/utilities/react.js.map +1 -0
  438. package/dist/src/integrations/utilities/retry.d.ts +132 -0
  439. package/dist/src/integrations/utilities/retry.d.ts.map +1 -0
  440. package/dist/src/integrations/utilities/retry.js +233 -0
  441. package/dist/src/integrations/utilities/retry.js.map +1 -0
  442. package/dist/src/integrations/utilities/routing.d.ts +118 -0
  443. package/dist/src/integrations/utilities/routing.d.ts.map +1 -0
  444. package/dist/src/integrations/utilities/routing.js +348 -0
  445. package/dist/src/integrations/utilities/routing.js.map +1 -0
  446. package/dist/src/integrations/utilities/rules.d.ts +131 -0
  447. package/dist/src/integrations/utilities/rules.d.ts.map +1 -0
  448. package/dist/src/integrations/utilities/rules.js +284 -0
  449. package/dist/src/integrations/utilities/rules.js.map +1 -0
  450. package/dist/src/integrations/utilities/sourcegraph.d.ts +169 -0
  451. package/dist/src/integrations/utilities/sourcegraph.d.ts.map +1 -0
  452. package/dist/src/integrations/utilities/sourcegraph.js +379 -0
  453. package/dist/src/integrations/utilities/sourcegraph.js.map +1 -0
  454. package/dist/src/integrations/utilities/thinking-strategy.d.ts +52 -0
  455. package/dist/src/integrations/utilities/thinking-strategy.d.ts.map +1 -0
  456. package/dist/src/integrations/utilities/thinking-strategy.js +129 -0
  457. package/dist/src/integrations/utilities/thinking-strategy.js.map +1 -0
  458. package/dist/src/integrations/utilities/thread-manager.d.ts +199 -0
  459. package/dist/src/integrations/utilities/thread-manager.d.ts.map +1 -0
  460. package/dist/src/integrations/utilities/thread-manager.js +357 -0
  461. package/dist/src/integrations/utilities/thread-manager.js.map +1 -0
  462. package/dist/src/integrations/utilities/token-estimate.d.ts +11 -0
  463. package/dist/src/integrations/utilities/token-estimate.d.ts.map +1 -0
  464. package/dist/src/integrations/utilities/token-estimate.js +14 -0
  465. package/dist/src/integrations/utilities/token-estimate.js.map +1 -0
  466. package/dist/src/main.js +10 -4
  467. package/dist/src/main.js.map +1 -1
  468. package/dist/src/modes/repl.d.ts.map +1 -1
  469. package/dist/src/modes/repl.js +22 -5
  470. package/dist/src/modes/repl.js.map +1 -1
  471. package/dist/src/modes/tui.d.ts.map +1 -1
  472. package/dist/src/modes/tui.js +23 -6
  473. package/dist/src/modes/tui.js.map +1 -1
  474. package/dist/src/modes.js +1 -1
  475. package/dist/src/modes.js.map +1 -1
  476. package/dist/src/observability/tracer.js +1 -1
  477. package/dist/src/observability/tracer.js.map +1 -1
  478. package/dist/src/persistence/schema.d.ts +2 -0
  479. package/dist/src/persistence/schema.d.ts.map +1 -1
  480. package/dist/src/persistence/schema.js +31 -0
  481. package/dist/src/persistence/schema.js.map +1 -1
  482. package/dist/src/providers/adapters/anthropic.d.ts +6 -0
  483. package/dist/src/providers/adapters/anthropic.d.ts.map +1 -1
  484. package/dist/src/providers/adapters/anthropic.js +99 -15
  485. package/dist/src/providers/adapters/anthropic.js.map +1 -1
  486. package/dist/src/providers/adapters/azure.d.ts +74 -0
  487. package/dist/src/providers/adapters/azure.d.ts.map +1 -0
  488. package/dist/src/providers/adapters/azure.js +354 -0
  489. package/dist/src/providers/adapters/azure.js.map +1 -0
  490. package/dist/src/providers/adapters/mock.d.ts +16 -2
  491. package/dist/src/providers/adapters/mock.d.ts.map +1 -1
  492. package/dist/src/providers/adapters/mock.js +44 -3
  493. package/dist/src/providers/adapters/mock.js.map +1 -1
  494. package/dist/src/providers/adapters/openai.d.ts +6 -1
  495. package/dist/src/providers/adapters/openai.d.ts.map +1 -1
  496. package/dist/src/providers/adapters/openai.js +39 -8
  497. package/dist/src/providers/adapters/openai.js.map +1 -1
  498. package/dist/src/providers/adapters/openrouter.d.ts +6 -0
  499. package/dist/src/providers/adapters/openrouter.d.ts.map +1 -1
  500. package/dist/src/providers/adapters/openrouter.js +73 -3
  501. package/dist/src/providers/adapters/openrouter.js.map +1 -1
  502. package/dist/src/providers/provider.js +1 -1
  503. package/dist/src/providers/provider.js.map +1 -1
  504. package/dist/src/providers/resilient-provider.js +1 -1
  505. package/dist/src/providers/resilient-provider.js.map +1 -1
  506. package/dist/src/providers/types.d.ts +23 -2
  507. package/dist/src/providers/types.d.ts.map +1 -1
  508. package/dist/src/session-picker.d.ts +1 -1
  509. package/dist/src/session-picker.d.ts.map +1 -1
  510. package/dist/src/session-picker.js +1 -1
  511. package/dist/src/session-picker.js.map +1 -1
  512. package/dist/src/shared/budget-tracker.js +1 -1
  513. package/dist/src/shared/budget-tracker.js.map +1 -1
  514. package/dist/src/tools/agent.d.ts +1 -1
  515. package/dist/src/tools/agent.d.ts.map +1 -1
  516. package/dist/src/tools/bash.js +1 -1
  517. package/dist/src/tools/bash.js.map +1 -1
  518. package/dist/src/tools/file.js +1 -1
  519. package/dist/src/tools/file.js.map +1 -1
  520. package/dist/src/tools/permission.js +2 -2
  521. package/dist/src/tools/permission.js.map +1 -1
  522. package/dist/src/tools/registry.d.ts +1 -1
  523. package/dist/src/tools/registry.d.ts.map +1 -1
  524. package/dist/src/tools/registry.js +1 -1
  525. package/dist/src/tools/registry.js.map +1 -1
  526. package/dist/src/tools/tasks.d.ts +1 -1
  527. package/dist/src/tools/tasks.d.ts.map +1 -1
  528. package/dist/src/tools/undo.d.ts +1 -1
  529. package/dist/src/tools/undo.d.ts.map +1 -1
  530. package/dist/src/tracing/cache-boundary-tracker.d.ts.map +1 -1
  531. package/dist/src/tracing/cache-boundary-tracker.js +2 -2
  532. package/dist/src/tracing/cache-boundary-tracker.js.map +1 -1
  533. package/dist/src/tracing/trace-collector.d.ts +22 -0
  534. package/dist/src/tracing/trace-collector.d.ts.map +1 -1
  535. package/dist/src/tracing/trace-collector.js +27 -3
  536. package/dist/src/tracing/trace-collector.js.map +1 -1
  537. package/dist/src/tracing/types.d.ts +17 -1
  538. package/dist/src/tracing/types.d.ts.map +1 -1
  539. package/dist/src/tracing/types.js.map +1 -1
  540. package/dist/src/tricks/failure-evidence.js +1 -1
  541. package/dist/src/tricks/failure-evidence.js.map +1 -1
  542. package/dist/src/tricks/recitation.d.ts.map +1 -1
  543. package/dist/src/tricks/recitation.js +2 -1
  544. package/dist/src/tricks/recitation.js.map +1 -1
  545. package/dist/src/tricks/recursive-context.d.ts.map +1 -1
  546. package/dist/src/tricks/recursive-context.js +2 -2
  547. package/dist/src/tricks/recursive-context.js.map +1 -1
  548. package/dist/src/tricks/reversible-compaction.d.ts.map +1 -1
  549. package/dist/src/tricks/reversible-compaction.js +6 -2
  550. package/dist/src/tricks/reversible-compaction.js.map +1 -1
  551. package/dist/src/tui/app.d.ts +3 -3
  552. package/dist/src/tui/app.d.ts.map +1 -1
  553. package/dist/src/tui/app.js +86 -14
  554. package/dist/src/tui/app.js.map +1 -1
  555. package/dist/src/tui/components/CollapsibleDiffView.d.ts +1 -1
  556. package/dist/src/tui/components/CollapsibleDiffView.d.ts.map +1 -1
  557. package/dist/src/tui/components/DiagnosticsPanel.d.ts +24 -0
  558. package/dist/src/tui/components/DiagnosticsPanel.d.ts.map +1 -0
  559. package/dist/src/tui/components/DiagnosticsPanel.js +47 -0
  560. package/dist/src/tui/components/DiagnosticsPanel.js.map +1 -0
  561. package/dist/src/tui/components/DiffView.d.ts +1 -1
  562. package/dist/src/tui/components/DiffView.d.ts.map +1 -1
  563. package/dist/src/tui/components/ErrorBoundary.js +1 -1
  564. package/dist/src/tui/components/ErrorBoundary.js.map +1 -1
  565. package/dist/src/tui/components/TasksPanel.d.ts +1 -1
  566. package/dist/src/tui/components/TasksPanel.d.ts.map +1 -1
  567. package/dist/src/tui/event-display.js +1 -1
  568. package/dist/src/tui/event-display.js.map +1 -1
  569. package/dist/src/tui/index.js +1 -1
  570. package/dist/src/tui/index.js.map +1 -1
  571. package/dist/src/tui/transparency-aggregator.d.ts +13 -0
  572. package/dist/src/tui/transparency-aggregator.d.ts.map +1 -1
  573. package/dist/src/tui/transparency-aggregator.js +21 -0
  574. package/dist/src/tui/transparency-aggregator.js.map +1 -1
  575. package/dist/src/types.d.ts +27 -2
  576. package/dist/src/types.d.ts.map +1 -1
  577. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-splitter.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tasks/task-splitter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAEV,gBAAgB,EAChB,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAM/B,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,wBAAwB,GAAG,6BAA6B,CA+DrG;AAMD;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,gBAAgB,GACxB,MAAM,CAmCR;AAiDD;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA0BlD;AAMD;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,GAAG,IAAI,CAoD9F;AAkKD;;;;;;;;;GASG;AACH,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,MAAM,GAAG,kBAAkB,CA+F/E"}
@@ -0,0 +1,537 @@
1
+ /**
2
+ * Task Splitter — LLM-driven splitting logic for task decomposition.
3
+ *
4
+ * Extracted from smart-decomposer.ts (Phase 3e).
5
+ * Contains: prompt building, response parsing, JSON repair,
6
+ * natural language extraction, and decomposition validation.
7
+ */
8
+ /**
9
+ * F5: Validate a decomposition result for structural correctness, feasibility, and granularity.
10
+ *
11
+ * Checks:
12
+ * 1. Structural: no cycles, valid dependency refs, each subtask has description
13
+ * 2. Feasibility: referenced files exist (warning only)
14
+ * 3. Granularity: no subtask complexity > 7 (should split further)
15
+ */
16
+ export function validateDecomposition(result) {
17
+ const issues = [];
18
+ const warnings = [];
19
+ const taskIds = new Set(result.subtasks.map(s => s.id));
20
+ // 1. Structural checks
21
+ // Cycle detection
22
+ if (result.dependencyGraph.cycles.length > 0) {
23
+ for (const cycle of result.dependencyGraph.cycles) {
24
+ issues.push(`Dependency cycle detected: ${cycle.join(' \u2192 ')}`);
25
+ }
26
+ }
27
+ // Valid dependency references
28
+ for (const subtask of result.subtasks) {
29
+ for (const dep of subtask.dependencies) {
30
+ if (!taskIds.has(dep)) {
31
+ issues.push(`Task ${subtask.id} references non-existent dependency: ${dep}`);
32
+ }
33
+ if (dep === subtask.id) {
34
+ issues.push(`Task ${subtask.id} depends on itself`);
35
+ }
36
+ }
37
+ // Each subtask must have a meaningful description
38
+ if (!subtask.description || subtask.description.trim().length < 5) {
39
+ issues.push(`Task ${subtask.id} has empty or trivial description`);
40
+ }
41
+ }
42
+ // 2. Feasibility: check if referenced files exist (warnings only — files may be created by earlier tasks)
43
+ for (const subtask of result.subtasks) {
44
+ if (subtask.relevantFiles) {
45
+ for (const file of subtask.relevantFiles) {
46
+ try {
47
+ const fs = require('node:fs');
48
+ const path = require('node:path');
49
+ if (!fs.existsSync(path.resolve(file))) {
50
+ warnings.push(`Task ${subtask.id} references non-existent file: ${file}`);
51
+ }
52
+ }
53
+ catch {
54
+ // Can't check — skip
55
+ }
56
+ }
57
+ }
58
+ }
59
+ // 3. Granularity: flag overly complex subtasks
60
+ for (const subtask of result.subtasks) {
61
+ if (subtask.complexity > 7) {
62
+ warnings.push(`Task ${subtask.id} has complexity ${subtask.complexity} (>7) — consider splitting further`);
63
+ }
64
+ }
65
+ // Additional structural check: at least 2 subtasks
66
+ if (result.subtasks.length < 2) {
67
+ issues.push(`Decomposition produced only ${result.subtasks.length} subtask(s) — too few for swarm mode`);
68
+ }
69
+ return {
70
+ valid: issues.length === 0,
71
+ issues,
72
+ warnings,
73
+ };
74
+ }
75
+ // =============================================================================
76
+ // PROMPT BUILDING
77
+ // =============================================================================
78
+ /**
79
+ * Create an LLM prompt for task decomposition.
80
+ */
81
+ export function createDecompositionPrompt(task, context) {
82
+ const parts = [
83
+ 'You are a task decomposition expert. Break down the following task into subtasks.',
84
+ '',
85
+ `Task: ${task}`,
86
+ '',
87
+ ];
88
+ if (context.repoMap) {
89
+ parts.push('Codebase context:');
90
+ parts.push(`- ${context.repoMap.chunks.size} files`);
91
+ parts.push(`- Entry points: ${context.repoMap.entryPoints.slice(0, 3).join(', ')}`);
92
+ parts.push('');
93
+ }
94
+ if (context.hints && context.hints.length > 0) {
95
+ parts.push('Hints:');
96
+ for (const hint of context.hints) {
97
+ parts.push(`- ${hint}`);
98
+ }
99
+ parts.push('');
100
+ }
101
+ parts.push('For each subtask, provide:');
102
+ parts.push('1. Description');
103
+ parts.push('2. Type (research, analysis, design, implement, test, refactor, review, document, integrate, deploy, merge)');
104
+ parts.push('3. Complexity (1-10)');
105
+ parts.push('4. Dependencies (which other subtasks must complete first)');
106
+ parts.push('5. Whether it can run in parallel with other tasks');
107
+ parts.push('');
108
+ parts.push('Also suggest an overall strategy: sequential, parallel, hierarchical, adaptive, or pipeline.');
109
+ parts.push('');
110
+ parts.push('Respond in JSON format.');
111
+ return parts.join('\n');
112
+ }
113
+ // =============================================================================
114
+ // JSON REPAIR
115
+ // =============================================================================
116
+ /**
117
+ * Normalize a raw subtask object from JSON into a consistent shape.
118
+ */
119
+ function normalizeSubtask(s) {
120
+ return {
121
+ description: s.description || s.desc || s.title || s.name || '',
122
+ type: s.type || s.task_type || s.category || 'implement',
123
+ complexity: s.complexity || s.difficulty || 3,
124
+ dependencies: s.dependencies || s.deps || s.depends_on || [],
125
+ parallelizable: s.parallelizable ?? s.parallel ?? true,
126
+ relevantFiles: s.relevantFiles || s.relevant_files || s.files,
127
+ suggestedRole: s.suggestedRole || s.suggested_role || s.role,
128
+ };
129
+ }
130
+ /**
131
+ * Try to extract subtasks from a parsed JSON object/array.
132
+ * Returns null if the structure doesn't contain usable subtask data.
133
+ */
134
+ function extractSubtasksFromParsed(parsed) {
135
+ // Handle array-at-root: some models return [{...}, {...}] instead of {"subtasks": [...]}
136
+ if (Array.isArray(parsed)) {
137
+ parsed = { subtasks: parsed, strategy: 'adaptive', reasoning: '(array-at-root)' };
138
+ }
139
+ // Normalize alternative key names: tasks, steps, task_list -> subtasks
140
+ const subtasksArray = parsed.subtasks
141
+ ?? parsed.tasks
142
+ ?? parsed.steps
143
+ ?? parsed.task_list
144
+ ?? parsed.decomposition;
145
+ if (!subtasksArray || !Array.isArray(subtasksArray) || subtasksArray.length === 0) {
146
+ return null;
147
+ }
148
+ return {
149
+ subtasks: subtasksArray.map(normalizeSubtask),
150
+ strategy: parsed.strategy || 'adaptive',
151
+ reasoning: parsed.reasoning || '',
152
+ };
153
+ }
154
+ /**
155
+ * Layer 1: Lenient JSON repair.
156
+ * Fixes common LLM JSON mistakes before parsing:
157
+ * - Trailing commas before ] and }
158
+ * - JS-style comments (// and block comments)
159
+ * - Single-quoted strings -> double-quoted
160
+ * - Unquoted object keys
161
+ */
162
+ export function repairJSON(jsonStr) {
163
+ let s = jsonStr;
164
+ // Strip JS-style line comments (// ...) outside strings
165
+ s = s.replace(/("(?:[^"\\]|\\.)*")|\/\/[^\n]*/g, (_match, str) => str ?? '');
166
+ // Strip JS-style block comments outside strings
167
+ s = s.replace(/("(?:[^"\\]|\\.)*")|\/\*[\s\S]*?\*\//g, (_match, str) => str ?? '');
168
+ // Replace single-quoted strings with double-quoted (outside existing double-quoted strings)
169
+ s = s.replace(/("(?:[^"\\]|\\.)*")|'((?:[^'\\]|\\.)*)'/g, (_match, dq, sq) => {
170
+ if (dq)
171
+ return dq; // Already double-quoted, keep as-is
172
+ const escaped = sq.replace(/(?<!\\)"/g, '\\"');
173
+ return `"${escaped}"`;
174
+ });
175
+ // Fix unquoted object keys: { key: "value" } -> { "key": "value" }
176
+ s = s.replace(/("(?:[^"\\]|\\.)*")|\b([a-zA-Z_][a-zA-Z0-9_]*)\s*:/g, (match, str, key) => {
177
+ if (str)
178
+ return match; // Inside a string, keep as-is
179
+ return `"${key}":`;
180
+ });
181
+ // Strip trailing commas before ] and }
182
+ s = s.replace(/,\s*([}\]])/g, '$1');
183
+ return s;
184
+ }
185
+ // =============================================================================
186
+ // NATURAL LANGUAGE EXTRACTION
187
+ // =============================================================================
188
+ /**
189
+ * Layer 2: Extract subtasks from natural language (numbered/bulleted lists).
190
+ * Handles formats like:
191
+ * - "1. Description" / "1) Description"
192
+ * - "- Description" / "* Description"
193
+ * - "Task 1: Description" / "Step 1: Description"
194
+ * - "- [ ] Description" / "- [x] Description" (markdown task lists)
195
+ */
196
+ export function extractSubtasksFromNaturalLanguage(response) {
197
+ const items = [];
198
+ // Try markdown task lists first: - [ ] Task / - [x] Task
199
+ const taskListPattern = /^[ \t]*[-*]\s*\[[ x]\]\s+(.+)$/gm;
200
+ let match;
201
+ while ((match = taskListPattern.exec(response)) !== null) {
202
+ const desc = match[1].trim();
203
+ if (desc.length > 5)
204
+ items.push(desc);
205
+ }
206
+ if (items.length >= 2)
207
+ return buildSubtasksFromList(items);
208
+ // Try numbered lists: 1. Desc / 1) Desc / 1: Desc
209
+ items.length = 0;
210
+ const numberedPattern = /^[ \t]*\d+[.):\-]\s+(.+)$/gm;
211
+ while ((match = numberedPattern.exec(response)) !== null) {
212
+ const desc = match[1].trim();
213
+ if (desc.length > 5)
214
+ items.push(desc);
215
+ }
216
+ if (items.length >= 2)
217
+ return buildSubtasksFromList(items);
218
+ // Try bulleted lists: - Desc / * Desc (but not markdown task lists already tried)
219
+ items.length = 0;
220
+ const bulletPattern = /^[ \t]*[-*]\s+(?!\[[ x]\])(.+)$/gm;
221
+ while ((match = bulletPattern.exec(response)) !== null) {
222
+ const desc = match[1].trim();
223
+ if (desc.length > 5)
224
+ items.push(desc);
225
+ }
226
+ if (items.length >= 2)
227
+ return buildSubtasksFromList(items);
228
+ // Try "Task N:" / "Step N:" / "Subtask N:" style headers
229
+ items.length = 0;
230
+ const headerPattern = /^[ \t]*(?:task|step|subtask|phase)\s*\d+[:.]\s*(.+)$/gim;
231
+ while ((match = headerPattern.exec(response)) !== null) {
232
+ const desc = match[1].trim();
233
+ if (desc.length > 5)
234
+ items.push(desc);
235
+ }
236
+ if (items.length >= 2)
237
+ return buildSubtasksFromList(items);
238
+ // Try markdown headers: ## Subtask 1 / ### Step: Description
239
+ items.length = 0;
240
+ const mdHeaderPattern = /^#{2,4}\s+(?:(?:subtask|step|task|phase)\s*\d*[:.]*\s*)?(.+)$/gim;
241
+ while ((match = mdHeaderPattern.exec(response)) !== null) {
242
+ const desc = match[1].trim();
243
+ // Skip generic headers like "Summary", "Strategy", "Overview"
244
+ if (desc.length > 5 && !/^(summary|strategy|overview|reasoning|conclusion|notes?)$/i.test(desc)) {
245
+ items.push(desc);
246
+ }
247
+ }
248
+ if (items.length >= 2)
249
+ return buildSubtasksFromList(items);
250
+ return null;
251
+ }
252
+ /**
253
+ * Build an LLMDecomposeResult from a flat list of description strings.
254
+ * Assigns sequential dependencies and infers task type from keywords.
255
+ */
256
+ function buildSubtasksFromList(items) {
257
+ const TYPE_KEYWORDS = {
258
+ research: ['research', 'investigate', 'explore', 'analyze', 'understand', 'study', 'review existing'],
259
+ design: ['design', 'plan', 'architect', 'schema', 'structure'],
260
+ test: ['test', 'verify', 'validate', 'assert', 'check'],
261
+ refactor: ['refactor', 'clean up', 'reorganize', 'simplify'],
262
+ document: ['document', 'readme', 'docs', 'comment'],
263
+ integrate: ['integrate', 'wire', 'connect', 'combine', 'merge'],
264
+ deploy: ['deploy', 'release', 'publish', 'ship'],
265
+ };
266
+ return {
267
+ subtasks: items.map((desc, i) => {
268
+ const lower = desc.toLowerCase();
269
+ let type = 'implement';
270
+ for (const [t, keywords] of Object.entries(TYPE_KEYWORDS)) {
271
+ if (keywords.some(k => lower.includes(k))) {
272
+ type = t;
273
+ break;
274
+ }
275
+ }
276
+ return {
277
+ description: desc,
278
+ type,
279
+ complexity: 3,
280
+ dependencies: i > 0 ? [String(i - 1)] : [],
281
+ parallelizable: i === 0 || type === 'research' || type === 'test',
282
+ };
283
+ }),
284
+ strategy: 'sequential',
285
+ reasoning: '(extracted from natural language list)',
286
+ };
287
+ }
288
+ // =============================================================================
289
+ // TRUNCATED JSON RECOVERY
290
+ // =============================================================================
291
+ /**
292
+ * Layer 3: Last-ditch single mega-task extraction.
293
+ * If there's meaningful text but no structure could be found,
294
+ * wrap the response as a single "implement" subtask so the swarm
295
+ * has something to work with rather than aborting entirely.
296
+ */
297
+ function extractMegaTask(response) {
298
+ // Strip code blocks, JSON fragments, and whitespace to get prose content
299
+ const prose = response
300
+ .replace(/```[\s\S]*?```/g, '')
301
+ .replace(/\{[\s\S]*?\}/g, '')
302
+ .replace(/\[[\s\S]*?\]/g, '')
303
+ .trim();
304
+ // Only create mega-task if there's substantial text (not just JSON garbage)
305
+ if (prose.length < 20)
306
+ return null;
307
+ const desc = prose.length > 200
308
+ ? prose.slice(0, 200).replace(/\s+\S*$/, '') + '...'
309
+ : prose;
310
+ return {
311
+ subtasks: [{
312
+ description: desc,
313
+ type: 'implement',
314
+ complexity: 5,
315
+ dependencies: [],
316
+ parallelizable: false,
317
+ }],
318
+ strategy: 'adaptive',
319
+ reasoning: '(single mega-task — parser could not extract structured subtasks)',
320
+ };
321
+ }
322
+ /**
323
+ * Attempt to recover a truncated JSON response by trimming incomplete trailing
324
+ * content and adding missing closing brackets/braces.
325
+ *
326
+ * Works for the common case where the LLM output was cut off mid-JSON-array,
327
+ * e.g.: `{"subtasks": [ {...}, {...}, {"desc` -> trim last incomplete object -> close array & object.
328
+ */
329
+ function tryRecoverTruncatedJSON(response) {
330
+ // Extract JSON portion (from code block or raw)
331
+ let jsonStr;
332
+ const codeBlockMatch = response.match(/```(?:json)?\s*\n?([\s\S]*)/);
333
+ if (codeBlockMatch) {
334
+ // No closing ``` required — that's the truncation
335
+ jsonStr = codeBlockMatch[1].replace(/```\s*$/, '').trim();
336
+ }
337
+ if (!jsonStr) {
338
+ const jsonMatch = response.match(/\{[\s\S]*/);
339
+ if (jsonMatch)
340
+ jsonStr = jsonMatch[0].trim();
341
+ }
342
+ if (!jsonStr)
343
+ return null;
344
+ // Find the last complete JSON object in the subtasks array.
345
+ // Strategy: find last `}` that closes a complete array element, trim there, close brackets.
346
+ // We search backwards for `},` or `}\n` patterns that likely end a complete subtask object.
347
+ let lastGoodPos = -1;
348
+ let braceDepth = 0;
349
+ let bracketDepth = 0;
350
+ let inString = false;
351
+ let escape = false;
352
+ for (let i = 0; i < jsonStr.length; i++) {
353
+ const ch = jsonStr[i];
354
+ if (escape) {
355
+ escape = false;
356
+ continue;
357
+ }
358
+ if (ch === '\\' && inString) {
359
+ escape = true;
360
+ continue;
361
+ }
362
+ if (ch === '"') {
363
+ inString = !inString;
364
+ continue;
365
+ }
366
+ if (inString)
367
+ continue;
368
+ if (ch === '{')
369
+ braceDepth++;
370
+ else if (ch === '}') {
371
+ braceDepth--;
372
+ // When we close an object at brace depth 1 (inside the top-level object),
373
+ // this is likely a complete subtask object inside the array
374
+ if (braceDepth === 1 && bracketDepth === 1) {
375
+ lastGoodPos = i;
376
+ }
377
+ }
378
+ else if (ch === '[')
379
+ bracketDepth++;
380
+ else if (ch === ']')
381
+ bracketDepth--;
382
+ }
383
+ if (lastGoodPos === -1)
384
+ return null;
385
+ // Trim to last complete subtask object, then close the JSON structure
386
+ let trimmed = jsonStr.slice(0, lastGoodPos + 1);
387
+ // Remove trailing comma if present
388
+ trimmed = trimmed.replace(/,\s*$/, '');
389
+ // Close open brackets: we need to close the subtasks array and the root object
390
+ // Count what's still open
391
+ let openBraces = 0;
392
+ let openBrackets = 0;
393
+ inString = false;
394
+ escape = false;
395
+ for (let i = 0; i < trimmed.length; i++) {
396
+ const ch = trimmed[i];
397
+ if (escape) {
398
+ escape = false;
399
+ continue;
400
+ }
401
+ if (ch === '\\' && inString) {
402
+ escape = true;
403
+ continue;
404
+ }
405
+ if (ch === '"') {
406
+ inString = !inString;
407
+ continue;
408
+ }
409
+ if (inString)
410
+ continue;
411
+ if (ch === '{')
412
+ openBraces++;
413
+ else if (ch === '}')
414
+ openBraces--;
415
+ else if (ch === '[')
416
+ openBrackets++;
417
+ else if (ch === ']')
418
+ openBrackets--;
419
+ }
420
+ // Close remaining open structures
421
+ for (let i = 0; i < openBrackets; i++)
422
+ trimmed += ']';
423
+ for (let i = 0; i < openBraces; i++)
424
+ trimmed += '}';
425
+ return trimmed;
426
+ }
427
+ // =============================================================================
428
+ // MAIN PARSE FUNCTION
429
+ // =============================================================================
430
+ /**
431
+ * Parse LLM response into decomposition result.
432
+ *
433
+ * Uses progressive fallback layers to handle messy LLM output:
434
+ * 1. Standard JSON extraction (code blocks, raw JSON)
435
+ * 2. Lenient JSON repair (trailing commas, comments, single quotes, unquoted keys)
436
+ * 3. Truncated JSON recovery (missing closing brackets)
437
+ * 4. Natural language extraction (numbered/bulleted lists, markdown task lists)
438
+ * 5. Single mega-task fallback (wrap prose as one subtask)
439
+ */
440
+ export function parseDecompositionResponse(response) {
441
+ if (!response || response.trim().length === 0) {
442
+ return {
443
+ subtasks: [],
444
+ strategy: 'adaptive',
445
+ reasoning: '',
446
+ parseError: 'Empty response from LLM',
447
+ };
448
+ }
449
+ // -- Step 1: Extract JSON string (code block or raw) --
450
+ let jsonStr;
451
+ const codeBlockMatch = response.match(/```(?:json)?\s*\n?([\s\S]*?)```/);
452
+ if (codeBlockMatch) {
453
+ jsonStr = codeBlockMatch[1].trim();
454
+ }
455
+ if (!jsonStr) {
456
+ // If the response starts with `[`, try array regex first to avoid
457
+ // \{[\s\S]*\} greedily matching across multiple objects in the array
458
+ const trimmed = response.trim();
459
+ const jsonMatch = trimmed.startsWith('[')
460
+ ? (response.match(/\[[\s\S]*\]/) || response.match(/\{[\s\S]*\}/))
461
+ : (response.match(/\{[\s\S]*\}/) || response.match(/\[[\s\S]*\]/));
462
+ if (jsonMatch)
463
+ jsonStr = jsonMatch[0];
464
+ }
465
+ // -- Step 2: Try strict JSON parse --
466
+ if (jsonStr) {
467
+ try {
468
+ const parsed = JSON.parse(jsonStr);
469
+ const result = extractSubtasksFromParsed(parsed);
470
+ if (result)
471
+ return result;
472
+ }
473
+ catch {
474
+ // Strict parse failed — continue to lenient repair
475
+ }
476
+ // -- Step 3: Lenient JSON repair + parse --
477
+ try {
478
+ const repaired = repairJSON(jsonStr);
479
+ const parsed = JSON.parse(repaired);
480
+ const result = extractSubtasksFromParsed(parsed);
481
+ if (result) {
482
+ result.reasoning = result.reasoning
483
+ ? result.reasoning + ' (repaired JSON)'
484
+ : '(repaired JSON)';
485
+ return result;
486
+ }
487
+ }
488
+ catch {
489
+ // Repaired parse also failed — continue to truncation recovery
490
+ }
491
+ }
492
+ // -- Step 4: Truncated JSON recovery --
493
+ const recovered = tryRecoverTruncatedJSON(response);
494
+ if (recovered) {
495
+ try {
496
+ const parsed = JSON.parse(recovered);
497
+ const result = extractSubtasksFromParsed(parsed);
498
+ if (result) {
499
+ result.reasoning = result.reasoning
500
+ ? result.reasoning + ' (recovered from truncated response)'
501
+ : '(recovered from truncated response)';
502
+ return result;
503
+ }
504
+ }
505
+ catch {
506
+ // Truncation recovery also failed — try repaired version
507
+ try {
508
+ const repairedRecovered = repairJSON(recovered);
509
+ const parsed = JSON.parse(repairedRecovered);
510
+ const result = extractSubtasksFromParsed(parsed);
511
+ if (result) {
512
+ result.reasoning = '(recovered from truncated + repaired JSON)';
513
+ return result;
514
+ }
515
+ }
516
+ catch {
517
+ // All JSON approaches exhausted
518
+ }
519
+ }
520
+ }
521
+ // -- Step 5: Natural language extraction --
522
+ const nlResult = extractSubtasksFromNaturalLanguage(response);
523
+ if (nlResult)
524
+ return nlResult;
525
+ // -- Step 6: Single mega-task fallback --
526
+ const megaResult = extractMegaTask(response);
527
+ if (megaResult)
528
+ return megaResult;
529
+ // -- Truly nothing worked --
530
+ return {
531
+ subtasks: [],
532
+ strategy: 'adaptive',
533
+ reasoning: '',
534
+ parseError: `All parse strategies failed. First 200 chars: ${response.slice(0, 200)}`,
535
+ };
536
+ }
537
+ //# sourceMappingURL=task-splitter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-splitter.js","sourceRoot":"","sources":["../../../../src/integrations/tasks/task-splitter.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAmBH;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAgC;IACpE,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,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QACL,QAAQ,EAAE,EAAE;QACZ,QAAQ,EAAE,UAAU;QACpB,SAAS,EAAE,EAAE;QACb,UAAU,EAAE,iDAAiD,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE;KACtF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Verification Gate - Opt-in Completion Verification
3
+ *
4
+ * Prevents premature completion by checking if required verification
5
+ * steps (like running tests) have been performed before allowing
6
+ * the agent to stop.
7
+ *
8
+ * Configuration:
9
+ * - TUI mode: off by default
10
+ * - Eval mode: auto-configured from FAIL_TO_PASS tests
11
+ * - Swarm mode: set by orchestrator per worker
12
+ */
13
+ export interface VerificationCriteria {
14
+ /** Tests that must be run (e.g., pytest test paths) */
15
+ requiredTests?: string[];
16
+ /** Must have edited at least one file */
17
+ requireFileChanges?: boolean;
18
+ /** Max nudges before giving up and allowing completion */
19
+ maxAttempts?: number;
20
+ /** Require TypeScript compilation to pass before completion */
21
+ requireCompilation?: boolean;
22
+ /** Max compilation-specific nudges before giving up (default: 8) */
23
+ compilationMaxAttempts?: number;
24
+ }
25
+ export interface VerificationState {
26
+ /** Tests that have been detected as run */
27
+ testsRun: Set<string>;
28
+ /** Whether any test passed */
29
+ anyTestPassed: boolean;
30
+ /** Whether file changes were made */
31
+ hasFileChanges: boolean;
32
+ /** Number of verification nudges already sent */
33
+ nudgeCount: number;
34
+ /** Whether TypeScript compilation passed */
35
+ compilationPassed: boolean;
36
+ /** Number of TypeScript compilation errors */
37
+ compilationErrorCount: number;
38
+ /** Number of compilation-specific nudges sent */
39
+ compilationNudgeCount: number;
40
+ }
41
+ export interface VerificationCheckResult {
42
+ /** Whether verification criteria are satisfied */
43
+ satisfied: boolean;
44
+ /** If not satisfied, a nudge message to inject */
45
+ nudge?: string;
46
+ /** If max attempts exceeded, allow anyway */
47
+ forceAllow: boolean;
48
+ /** What's still missing */
49
+ missing: string[];
50
+ }
51
+ export declare class VerificationGate {
52
+ private criteria;
53
+ private state;
54
+ constructor(criteria: VerificationCriteria);
55
+ /**
56
+ * Record that a bash command was executed.
57
+ * Detects test execution from command patterns and output.
58
+ */
59
+ recordBashExecution(command: string, output: string, exitCode: number | null): void;
60
+ /**
61
+ * Record that a file was modified.
62
+ */
63
+ recordFileChange(): void;
64
+ /**
65
+ * Record the result of a TypeScript compilation check.
66
+ */
67
+ recordCompilationResult(passed: boolean, errorCount: number): void;
68
+ /**
69
+ * Increment the compilation nudge counter.
70
+ * Called from the TSC gate in the execution loop (which uses `continue`
71
+ * and therefore never reaches verificationGate.check()).
72
+ */
73
+ incrementCompilationNudge(): void;
74
+ /**
75
+ * Check if the agent can complete.
76
+ * Returns satisfied=true if criteria are met, or a nudge message if not.
77
+ */
78
+ check(): VerificationCheckResult;
79
+ /**
80
+ * Get the current verification state.
81
+ */
82
+ getState(): {
83
+ testsRun: number;
84
+ anyTestPassed: boolean;
85
+ hasFileChanges: boolean;
86
+ nudgeCount: number;
87
+ maxAttempts: number;
88
+ compilationPassed: boolean;
89
+ compilationErrorCount: number;
90
+ compilationNudgeCount: number;
91
+ };
92
+ /**
93
+ * Reset the gate state (for reuse).
94
+ */
95
+ reset(): void;
96
+ private buildNudge;
97
+ }
98
+ /**
99
+ * Create a verification gate from criteria.
100
+ * Returns null if no criteria provided (gate disabled).
101
+ */
102
+ export declare function createVerificationGate(criteria?: VerificationCriteria | null): VerificationGate | null;
103
+ //# sourceMappingURL=verification-gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verification-gate.d.ts","sourceRoot":"","sources":["../../../../src/integrations/tasks/verification-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,yCAAyC;IACzC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACr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