xcoder-dna 0.0.0-stage → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (390) hide show
  1. package/LICENSE +66 -0
  2. package/README.md +87 -2
  3. package/dist/agents/ai-chat-debate.d.ts +36 -0
  4. package/dist/agents/ai-chat-debate.js +300 -0
  5. package/dist/agents/ai-chat-report-writer.d.ts +7 -0
  6. package/dist/agents/ai-chat-report-writer.js +100 -0
  7. package/dist/agents/duplicate-detector.d.ts +41 -0
  8. package/dist/agents/duplicate-detector.js +65 -0
  9. package/dist/agents/genesis-agent.d.ts +61 -0
  10. package/dist/agents/genesis-agent.js +340 -0
  11. package/dist/agents/samurai-agent.d.ts +53 -0
  12. package/dist/agents/samurai-agent.js +279 -0
  13. package/dist/agents/sub-agent.d.ts +56 -0
  14. package/dist/agents/sub-agent.js +353 -0
  15. package/dist/backlog/backlog-requirement-validator.d.ts +10 -0
  16. package/dist/backlog/backlog-requirement-validator.js +60 -0
  17. package/dist/backlog/backlog-store.d.ts +29 -0
  18. package/dist/backlog/backlog-store.js +148 -0
  19. package/dist/backlog/po-agent.d.ts +16 -0
  20. package/dist/backlog/po-agent.js +121 -0
  21. package/dist/backlog/types.d.ts +25 -0
  22. package/dist/backlog/types.js +4 -0
  23. package/dist/bench/run.d.ts +11 -0
  24. package/dist/bench/run.js +185 -0
  25. package/dist/bench/types.d.ts +50 -0
  26. package/dist/bench/types.js +1 -0
  27. package/dist/cli/swarm.d.ts +10 -0
  28. package/dist/cli/swarm.js +100 -0
  29. package/dist/cli/task.d.ts +14 -0
  30. package/dist/cli/task.js +121 -0
  31. package/dist/cli/wbc-arg.d.ts +6 -0
  32. package/dist/cli/wbc-arg.js +40 -0
  33. package/dist/cli/wbc.d.ts +45 -0
  34. package/dist/cli/wbc.js +98 -0
  35. package/dist/commands/license.d.ts +9 -0
  36. package/dist/commands/license.js +140 -0
  37. package/dist/commands/release.d.ts +44 -0
  38. package/dist/commands/release.js +180 -0
  39. package/dist/commands/test.d.ts +50 -0
  40. package/dist/commands/test.js +385 -0
  41. package/dist/config/loadConfig.d.ts +82 -0
  42. package/dist/config/loadConfig.js +240 -0
  43. package/dist/config/secure-mode.d.ts +29 -0
  44. package/dist/config/secure-mode.js +63 -0
  45. package/dist/config/user-config.d.ts +39 -0
  46. package/dist/config/user-config.js +202 -0
  47. package/dist/engine/reasoning-engine.d.ts +21 -0
  48. package/dist/engine/reasoning-engine.js +59 -0
  49. package/dist/events/bus.d.ts +22 -0
  50. package/dist/events/bus.js +18 -0
  51. package/dist/index.d.ts +79 -0
  52. package/dist/index.js +77 -0
  53. package/dist/indexing/ignoreRules.d.ts +1 -0
  54. package/dist/indexing/ignoreRules.js +53 -0
  55. package/dist/instance-swarm/instance-swarm-orchestrator.d.ts +57 -0
  56. package/dist/instance-swarm/instance-swarm-orchestrator.js +204 -0
  57. package/dist/instance-swarm/protocol-name-resolver.d.ts +23 -0
  58. package/dist/instance-swarm/protocol-name-resolver.js +64 -0
  59. package/dist/license/gate.d.ts +31 -0
  60. package/dist/license/gate.js +188 -0
  61. package/dist/license/http-client.d.ts +43 -0
  62. package/dist/license/http-client.js +195 -0
  63. package/dist/license/manager.d.ts +39 -0
  64. package/dist/license/manager.js +175 -0
  65. package/dist/license/receipt.d.ts +27 -0
  66. package/dist/license/receipt.js +108 -0
  67. package/dist/license/state-codec.d.ts +72 -0
  68. package/dist/license/state-codec.js +218 -0
  69. package/dist/license/state-paths.d.ts +17 -0
  70. package/dist/license/state-paths.js +64 -0
  71. package/dist/license/store.d.ts +44 -0
  72. package/dist/license/store.js +223 -0
  73. package/dist/license/trust-anchor.d.ts +24 -0
  74. package/dist/license/trust-anchor.js +74 -0
  75. package/dist/license/types.d.ts +34 -0
  76. package/dist/license/types.js +19 -0
  77. package/dist/llm/budget.d.ts +23 -0
  78. package/dist/llm/budget.js +58 -0
  79. package/dist/llm/client.d.ts +53 -0
  80. package/dist/llm/client.js +122 -0
  81. package/dist/llm/factory.d.ts +14 -0
  82. package/dist/llm/factory.js +32 -0
  83. package/dist/orchestrator/defect-logger.d.ts +31 -0
  84. package/dist/orchestrator/defect-logger.js +101 -0
  85. package/dist/orchestrator/defect-manager.d.ts +118 -0
  86. package/dist/orchestrator/defect-manager.js +338 -0
  87. package/dist/orchestrator/defect-migration.d.ts +14 -0
  88. package/dist/orchestrator/defect-migration.js +174 -0
  89. package/dist/orchestrator/defect-store.d.ts +48 -0
  90. package/dist/orchestrator/defect-store.js +76 -0
  91. package/dist/orchestrator/healing.d.ts +14 -0
  92. package/dist/orchestrator/healing.js +11 -0
  93. package/dist/orchestrator/interactive-steering.d.ts +64 -0
  94. package/dist/orchestrator/interactive-steering.js +107 -0
  95. package/dist/orchestrator/interrupt-handler.d.ts +30 -0
  96. package/dist/orchestrator/interrupt-handler.js +70 -0
  97. package/dist/orchestrator/lesson-manager.d.ts +25 -0
  98. package/dist/orchestrator/lesson-manager.js +122 -0
  99. package/dist/orchestrator/progress-summary.d.ts +15 -0
  100. package/dist/orchestrator/progress-summary.js +106 -0
  101. package/dist/orchestrator/reasoning-score.d.ts +49 -0
  102. package/dist/orchestrator/reasoning-score.js +117 -0
  103. package/dist/orchestrator/swarm.d.ts +36 -0
  104. package/dist/orchestrator/swarm.js +77 -0
  105. package/dist/orchestrator/task-factory.d.ts +15 -0
  106. package/dist/orchestrator/task-factory.js +176 -0
  107. package/dist/orchestrator/validation-gate.d.ts +23 -0
  108. package/dist/orchestrator/validation-gate.js +155 -0
  109. package/dist/protocol/react-contract.d.ts +136 -0
  110. package/dist/protocol/react-contract.js +698 -0
  111. package/dist/protocol/wks-protocol-manager.d.ts +22 -0
  112. package/dist/protocol/wks-protocol-manager.js +72 -0
  113. package/dist/sdlc-runtime/conversation-runner.d.ts +8 -0
  114. package/dist/sdlc-runtime/conversation-runner.js +64 -0
  115. package/dist/sdlc-runtime/dag-utils.d.ts +15 -0
  116. package/dist/sdlc-runtime/dag-utils.js +67 -0
  117. package/dist/sdlc-runtime/defect-integration.d.ts +7 -0
  118. package/dist/sdlc-runtime/defect-integration.js +99 -0
  119. package/dist/sdlc-runtime/execution-loop.d.ts +38 -0
  120. package/dist/sdlc-runtime/execution-loop.js +274 -0
  121. package/dist/sdlc-runtime/lesson-recorder.d.ts +9 -0
  122. package/dist/sdlc-runtime/lesson-recorder.js +27 -0
  123. package/dist/sdlc-runtime/plan-initializer.d.ts +47 -0
  124. package/dist/sdlc-runtime/plan-initializer.js +135 -0
  125. package/dist/sdlc-runtime/progress-persister.d.ts +10 -0
  126. package/dist/sdlc-runtime/progress-persister.js +34 -0
  127. package/dist/sdlc-runtime/protocol-loader.d.ts +10 -0
  128. package/dist/sdlc-runtime/protocol-loader.js +21 -0
  129. package/dist/sdlc-runtime/reporting.d.ts +24 -0
  130. package/dist/sdlc-runtime/reporting.js +68 -0
  131. package/dist/sdlc-runtime/sdlc-orchestrator.d.ts +59 -0
  132. package/dist/sdlc-runtime/sdlc-orchestrator.js +170 -0
  133. package/dist/sdlc-runtime/sdlc-skill.d.ts +44 -0
  134. package/dist/sdlc-runtime/sdlc-skill.js +148 -0
  135. package/dist/sdlc-runtime/steering-handler.d.ts +14 -0
  136. package/dist/sdlc-runtime/steering-handler.js +51 -0
  137. package/dist/sdlc-runtime/trace-recorder.d.ts +10 -0
  138. package/dist/sdlc-runtime/trace-recorder.js +7 -0
  139. package/dist/security/index.d.ts +16 -0
  140. package/dist/security/index.js +12 -0
  141. package/dist/security/input-screen.d.ts +30 -0
  142. package/dist/security/input-screen.js +75 -0
  143. package/dist/security/tool-call-guard.d.ts +16 -0
  144. package/dist/security/tool-call-guard.js +163 -0
  145. package/dist/security/untrusted-content.d.ts +34 -0
  146. package/dist/security/untrusted-content.js +63 -0
  147. package/dist/skills/advanced-dfir/SKILL.md +85 -0
  148. package/dist/skills/advanced-pentest-lab/SKILL.md +88 -0
  149. package/dist/skills/analyst/SKILL.md +55 -0
  150. package/dist/skills/architect/SKILL.md +54 -0
  151. package/dist/skills/aws/SKILL.md +92 -0
  152. package/dist/skills/azure/SKILL.md +90 -0
  153. package/dist/skills/bylaw-context.d.ts +45 -0
  154. package/dist/skills/bylaw-context.js +61 -0
  155. package/dist/skills/bylaw-review.d.ts +20 -0
  156. package/dist/skills/bylaw-review.js +101 -0
  157. package/dist/skills/conversation/SKILL.md +29 -0
  158. package/dist/skills/design-patterns/SKILL.md +190 -0
  159. package/dist/skills/devops/SKILL.md +55 -0
  160. package/dist/skills/directives.d.ts +20 -0
  161. package/dist/skills/directives.js +313 -0
  162. package/dist/skills/docker/SKILL.md +76 -0
  163. package/dist/skills/docker-expert/SKILL.md +56 -0
  164. package/dist/skills/enterprise-systems-analyst/SKILL.md +83 -0
  165. package/dist/skills/enterprise-systems-analyst/references/crm.md +41 -0
  166. package/dist/skills/enterprise-systems-analyst/references/erp.md +40 -0
  167. package/dist/skills/enterprise-systems-analyst/references/financial-systems.md +35 -0
  168. package/dist/skills/enterprise-systems-analyst/references/hcm.md +38 -0
  169. package/dist/skills/enterprise-systems-analyst/references/mrp.md +37 -0
  170. package/dist/skills/enterprise-systems-analyst/references/scm.md +32 -0
  171. package/dist/skills/ethical-hacking-methodology/SKILL.md +119 -0
  172. package/dist/skills/externalSkillLoader.d.ts +25 -0
  173. package/dist/skills/externalSkillLoader.js +65 -0
  174. package/dist/skills/externalSkillRegistry.d.ts +33 -0
  175. package/dist/skills/externalSkillRegistry.js +94 -0
  176. package/dist/skills/filesystem-management/SKILL.md +61 -0
  177. package/dist/skills/first-run-seed.d.ts +26 -0
  178. package/dist/skills/first-run-seed.js +75 -0
  179. package/dist/skills/git-vcs/SKILL.md +84 -0
  180. package/dist/skills/kafka/SKILL.md +89 -0
  181. package/dist/skills/kubernetes/SKILL.md +93 -0
  182. package/dist/skills/kubernetes-expert/SKILL.md +54 -0
  183. package/dist/skills/openshift/SKILL.md +93 -0
  184. package/dist/skills/pentester/SKILL.md +59 -0
  185. package/dist/skills/performance-tester/SKILL.md +57 -0
  186. package/dist/skills/playwright-ui-tester/SKILL.md +67 -0
  187. package/dist/skills/programmer/SKILL.md +58 -0
  188. package/dist/skills/project-scaffolding/SKILL.md +133 -0
  189. package/dist/skills/qa-engineer/SKILL.md +91 -0
  190. package/dist/skills/rca/SKILL.md +58 -0
  191. package/dist/skills/redhat/SKILL.md +92 -0
  192. package/dist/skills/rosa/SKILL.md +80 -0
  193. package/dist/skills/scrum-framework/SKILL.md +74 -0
  194. package/dist/skills/scrum-framework/references/artifacts_and_quality.md +79 -0
  195. package/dist/skills/scrum-framework/references/roles_and_events.md +105 -0
  196. package/dist/skills/scrum-master-agent/SKILL.md +74 -0
  197. package/dist/skills/scrum-master-agent/references/behaviors.md +56 -0
  198. package/dist/skills/sdlc-skill.d.ts +1 -0
  199. package/dist/skills/sdlc-skill.js +4 -0
  200. package/dist/skills/secops/SKILL.md +52 -0
  201. package/dist/skills/secure-architect.bylaws.d.ts +68 -0
  202. package/dist/skills/secure-architect.bylaws.js +525 -0
  203. package/dist/skills/seed-skills.d.ts +48 -0
  204. package/dist/skills/seed-skills.js +213 -0
  205. package/dist/skills/skill-authoring/SKILL.md +123 -0
  206. package/dist/skills/skill-header.d.ts +51 -0
  207. package/dist/skills/skill-header.js +163 -0
  208. package/dist/skills/skill-path-guard.d.ts +41 -0
  209. package/dist/skills/skill-path-guard.js +95 -0
  210. package/dist/skills/skillRouter.d.ts +51 -0
  211. package/dist/skills/skillRouter.js +90 -0
  212. package/dist/skills/skills-root.d.ts +64 -0
  213. package/dist/skills/skills-root.js +168 -0
  214. package/dist/skills/software-architect/SKILL.md +77 -0
  215. package/dist/skills/software-engineer/SKILL.md +74 -0
  216. package/dist/skills/solid-principles/SKILL.md +94 -0
  217. package/dist/skills/task-planning/SKILL.md +115 -0
  218. package/dist/skills/tester/SKILL.md +54 -0
  219. package/dist/skills/ubuntu/SKILL.md +87 -0
  220. package/dist/skills/ui-ux-design/SKILL.md +114 -0
  221. package/dist/skills/workspace-context/SKILL.md +103 -0
  222. package/dist/sprint/controller.d.ts +37 -0
  223. package/dist/sprint/controller.js +220 -0
  224. package/dist/sprint/dag-builder.d.ts +14 -0
  225. package/dist/sprint/dag-builder.js +105 -0
  226. package/dist/sprint/reporter.d.ts +11 -0
  227. package/dist/sprint/reporter.js +97 -0
  228. package/dist/sprint/state-store.d.ts +10 -0
  229. package/dist/sprint/state-store.js +71 -0
  230. package/dist/sprint/types.d.ts +24 -0
  231. package/dist/sprint/types.js +4 -0
  232. package/dist/store/file-version-store.d.ts +24 -0
  233. package/dist/store/file-version-store.js +73 -0
  234. package/dist/store/task-store.d.ts +90 -0
  235. package/dist/store/task-store.js +166 -0
  236. package/dist/task-ingest/architect-detailer.d.ts +43 -0
  237. package/dist/task-ingest/architect-detailer.js +141 -0
  238. package/dist/task-ingest/detail-schema.d.ts +9 -0
  239. package/dist/task-ingest/detail-schema.js +195 -0
  240. package/dist/task-ingest/detailed-run.d.ts +36 -0
  241. package/dist/task-ingest/detailed-run.js +108 -0
  242. package/dist/task-ingest/extract-id.d.ts +9 -0
  243. package/dist/task-ingest/extract-id.js +24 -0
  244. package/dist/task-ingest/index.d.ts +23 -0
  245. package/dist/task-ingest/index.js +14 -0
  246. package/dist/task-ingest/ingest.d.ts +45 -0
  247. package/dist/task-ingest/ingest.js +163 -0
  248. package/dist/task-ingest/list-ingested.d.ts +13 -0
  249. package/dist/task-ingest/list-ingested.js +30 -0
  250. package/dist/task-ingest/pending-filter.d.ts +30 -0
  251. package/dist/task-ingest/pending-filter.js +59 -0
  252. package/dist/task-ingest/scanner.d.ts +56 -0
  253. package/dist/task-ingest/scanner.js +216 -0
  254. package/dist/task-ingest/source-reader.d.ts +25 -0
  255. package/dist/task-ingest/source-reader.js +93 -0
  256. package/dist/task-ingest/spec-builder.d.ts +34 -0
  257. package/dist/task-ingest/spec-builder.js +89 -0
  258. package/dist/task-ingest/wbs-extract.d.ts +50 -0
  259. package/dist/task-ingest/wbs-extract.js +226 -0
  260. package/dist/task-ingest/wbs-parser.d.ts +36 -0
  261. package/dist/task-ingest/wbs-parser.js +170 -0
  262. package/dist/tools/apiTestTool.d.ts +37 -0
  263. package/dist/tools/apiTestTool.js +128 -0
  264. package/dist/tools/ast-tools.d.ts +183 -0
  265. package/dist/tools/ast-tools.js +853 -0
  266. package/dist/tools/browse-tool.d.ts +105 -0
  267. package/dist/tools/browse-tool.js +394 -0
  268. package/dist/tools/credential.d.ts +17 -0
  269. package/dist/tools/credential.js +32 -0
  270. package/dist/tools/dependency-graph.d.ts +23 -0
  271. package/dist/tools/dependency-graph.js +164 -0
  272. package/dist/tools/edit-tool.d.ts +34 -0
  273. package/dist/tools/edit-tool.js +95 -0
  274. package/dist/tools/file-header-manager.d.ts +27 -0
  275. package/dist/tools/file-header-manager.js +153 -0
  276. package/dist/tools/fs-tools.d.ts +154 -0
  277. package/dist/tools/fs-tools.js +337 -0
  278. package/dist/tools/git-tools.d.ts +79 -0
  279. package/dist/tools/git-tools.js +348 -0
  280. package/dist/tools/github-tool.d.ts +48 -0
  281. package/dist/tools/github-tool.js +147 -0
  282. package/dist/tools/globTool.d.ts +20 -0
  283. package/dist/tools/globTool.js +34 -0
  284. package/dist/tools/grepTool.d.ts +19 -0
  285. package/dist/tools/grepTool.js +44 -0
  286. package/dist/tools/index-freshness.d.ts +58 -0
  287. package/dist/tools/index-freshness.js +190 -0
  288. package/dist/tools/index-glob.d.ts +48 -0
  289. package/dist/tools/index-glob.js +175 -0
  290. package/dist/tools/load-skill-tool.d.ts +15 -0
  291. package/dist/tools/load-skill-tool.js +114 -0
  292. package/dist/tools/patch-tools.d.ts +58 -0
  293. package/dist/tools/patch-tools.js +153 -0
  294. package/dist/tools/playwright-tool.d.ts +66 -0
  295. package/dist/tools/playwright-tool.js +121 -0
  296. package/dist/tools/project-detect.d.ts +20 -0
  297. package/dist/tools/project-detect.js +87 -0
  298. package/dist/tools/prompt-guidance.d.ts +22 -0
  299. package/dist/tools/prompt-guidance.js +23 -0
  300. package/dist/tools/scheduleTool.d.ts +19 -0
  301. package/dist/tools/scheduleTool.js +181 -0
  302. package/dist/tools/search-tools.d.ts +27 -0
  303. package/dist/tools/search-tools.js +78 -0
  304. package/dist/tools/sed-tool.d.ts +66 -0
  305. package/dist/tools/sed-tool.js +402 -0
  306. package/dist/tools/shell-result.d.ts +11 -0
  307. package/dist/tools/shell-result.js +1 -0
  308. package/dist/tools/shell-tool.d.ts +45 -0
  309. package/dist/tools/shell-tool.js +141 -0
  310. package/dist/tools/siteCrawlerTool.d.ts +32 -0
  311. package/dist/tools/siteCrawlerTool.js +205 -0
  312. package/dist/tools/tool-registry.d.ts +67 -0
  313. package/dist/tools/tool-registry.js +596 -0
  314. package/dist/tools/validate-tool.d.ts +23 -0
  315. package/dist/tools/validate-tool.js +201 -0
  316. package/dist/tools/workspace-index.d.ts +46 -0
  317. package/dist/tools/workspace-index.js +173 -0
  318. package/dist/types.d.ts +222 -0
  319. package/dist/types.js +7 -0
  320. package/dist/updater/index.d.ts +14 -0
  321. package/dist/updater/index.js +120 -0
  322. package/dist/util/banner.d.ts +25 -0
  323. package/dist/util/banner.js +140 -0
  324. package/dist/util/command-suggester.d.ts +6 -0
  325. package/dist/util/command-suggester.js +25 -0
  326. package/dist/util/confirm-interrupt.d.ts +10 -0
  327. package/dist/util/confirm-interrupt.js +31 -0
  328. package/dist/util/continue-trigger.d.ts +11 -0
  329. package/dist/util/continue-trigger.js +20 -0
  330. package/dist/util/env-info.d.ts +18 -0
  331. package/dist/util/env-info.js +37 -0
  332. package/dist/util/file-access-log.d.ts +35 -0
  333. package/dist/util/file-access-log.js +140 -0
  334. package/dist/util/footer-manager.d.ts +124 -0
  335. package/dist/util/footer-manager.js +195 -0
  336. package/dist/util/footer-renderer.d.ts +67 -0
  337. package/dist/util/footer-renderer.js +319 -0
  338. package/dist/util/footer-state.d.ts +34 -0
  339. package/dist/util/footer-state.js +18 -0
  340. package/dist/util/footer-text.d.ts +51 -0
  341. package/dist/util/footer-text.js +74 -0
  342. package/dist/util/ids.d.ts +1 -0
  343. package/dist/util/ids.js +4 -0
  344. package/dist/util/levenshtein.d.ts +6 -0
  345. package/dist/util/levenshtein.js +34 -0
  346. package/dist/util/logger.d.ts +10 -0
  347. package/dist/util/logger.js +41 -0
  348. package/dist/util/logs.d.ts +26 -0
  349. package/dist/util/logs.js +88 -0
  350. package/dist/util/output-handler.d.ts +89 -0
  351. package/dist/util/output-handler.js +193 -0
  352. package/dist/util/output-interceptor.d.ts +18 -0
  353. package/dist/util/output-interceptor.js +49 -0
  354. package/dist/util/output-paths.d.ts +43 -0
  355. package/dist/util/output-paths.js +121 -0
  356. package/dist/util/package-json.d.ts +6 -0
  357. package/dist/util/package-json.js +36 -0
  358. package/dist/util/process-kill.d.ts +27 -0
  359. package/dist/util/process-kill.js +148 -0
  360. package/dist/util/protocol-error-logger.d.ts +33 -0
  361. package/dist/util/protocol-error-logger.js +73 -0
  362. package/dist/util/redact.d.ts +25 -0
  363. package/dist/util/redact.js +103 -0
  364. package/dist/util/scroll-region-guard.d.ts +33 -0
  365. package/dist/util/scroll-region-guard.js +63 -0
  366. package/dist/util/spinner.d.ts +15 -0
  367. package/dist/util/spinner.js +49 -0
  368. package/dist/util/terminal-output.d.ts +34 -0
  369. package/dist/util/terminal-output.js +1 -0
  370. package/dist/util/terminal-silent.d.ts +6 -0
  371. package/dist/util/terminal-silent.js +20 -0
  372. package/dist/util/terminal.d.ts +56 -0
  373. package/dist/util/terminal.js +124 -0
  374. package/dist/util/text-sanitize.d.ts +8 -0
  375. package/dist/util/text-sanitize.js +45 -0
  376. package/dist/util/thinking-spinner.d.ts +27 -0
  377. package/dist/util/thinking-spinner.js +189 -0
  378. package/dist/util/tool-error-logger.d.ts +33 -0
  379. package/dist/util/tool-error-logger.js +77 -0
  380. package/dist/util/tty.d.ts +13 -0
  381. package/dist/util/tty.js +16 -0
  382. package/dist/util/xcoder-paths.d.ts +56 -0
  383. package/dist/util/xcoder-paths.js +63 -0
  384. package/dist/version.d.ts +2 -0
  385. package/dist/version.js +4 -0
  386. package/dist/worker-agent/to-subtask-node.d.ts +35 -0
  387. package/dist/worker-agent/to-subtask-node.js +41 -0
  388. package/dist/worker-agent/worker-orchestrator.d.ts +104 -0
  389. package/dist/worker-agent/worker-orchestrator.js +201 -0
  390. package/package.json +39 -4
@@ -0,0 +1,319 @@
1
+ import { titleField, versionLabel } from "./footer-text.js";
2
+ /**
3
+ * ANSI escape sequences for the built-in terminal color palette.
4
+ * Matches the existing palette in terminal.ts.
5
+ */
6
+ const C = {
7
+ reset: "\x1b[0m",
8
+ dim: "\x1b[2m",
9
+ bold: "\x1b[1m",
10
+ amber: "\x1b[38;5;214m",
11
+ cyan: "\x1b[38;5;80m",
12
+ green: "\x1b[38;5;78m",
13
+ coral: "\x1b[38;5;203m",
14
+ violet: "\x1b[38;5;140m",
15
+ white: "\x1b[38;5;255m",
16
+ bgFooter: "\x1b[48;5;236m",
17
+ };
18
+ // ── Scroll region helpers ──
19
+ const SAVE_CURSOR = "\x1b7";
20
+ const RESTORE_CURSOR = "\x1b8";
21
+ const RESET_SCROLL_REGION = "\x1b[r";
22
+ const CURSOR_TO_BOTTOM = "\x1b[999;1H";
23
+ const CLEAR_LINE = "\x1b[2K";
24
+ const HIDE_CURSOR = "\x1b[?25l";
25
+ const SHOW_CURSOR = "\x1b[?25h";
26
+ // Scroll up by 1 to make room for the footer when enabling.
27
+ const SCROLL_UP = "\x1b[1S";
28
+ /** Resolve current terminal width, with a fallback. */
29
+ function getWidth() {
30
+ if (process.stdout && typeof process.stdout.columns === "number" && process.stdout.columns > 0) {
31
+ return process.stdout.columns;
32
+ }
33
+ return 80;
34
+ }
35
+ /** Truncate a single segment with "…" if too long. */
36
+ function truncate(text, maxLen) {
37
+ if (text.length <= maxLen)
38
+ return text;
39
+ return text.slice(0, maxLen - 1) + "…";
40
+ }
41
+ /** Spinner frames compatible with clack — simple Braille spinner. */
42
+ const SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
43
+ /**
44
+ * Converts a FooterState into a single ANSI escape sequence string
45
+ * that paints a 1-row footer at the bottom of the terminal.
46
+ *
47
+ * Design:
48
+ * - 1-row footer using scroll region to reserve the bottom line.
49
+ * - Truncation priority: stage+spinner > action > tokens > agentId > taskDesc > docs.
50
+ * - Respects NO_COLOR and TTY detection.
51
+ * - Handles window resize by re-reading process.stdout.columns.
52
+ */
53
+ export class FooterRenderer {
54
+ _active = false;
55
+ _hidden = false;
56
+ _spinnerIdx = 0;
57
+ _spinnerInterval = null;
58
+ _currentState = null;
59
+ _noColor = false;
60
+ /**
61
+ * Perform one-time setup: enable scroll region, hide cursor.
62
+ * Must be called before render(). Safe to call when already active (no-op).
63
+ */
64
+ setup(state) {
65
+ this._noColor = !state.tty;
66
+ if (!state.tty || this._active)
67
+ return;
68
+ this._active = true;
69
+ this._hidden = false;
70
+ // Reserve bottom row via scroll region (all rows except last).
71
+ const height = process.stdout.rows ?? 24;
72
+ // Scroll region: rows 1 to (height - 1), keeping row `height` free.
73
+ const scrollBottom = Math.max(1, height - 1);
74
+ process.stdout.write(HIDE_CURSOR);
75
+ process.stdout.write(`\x1b[1;${scrollBottom}r`);
76
+ this._render(state);
77
+ }
78
+ /**
79
+ * Render the current state to the reserved bottom row.
80
+ * Handles layout, truncation, and spinner animation.
81
+ */
82
+ render(state) {
83
+ if (!this._active || this._hidden || !state.tty) {
84
+ this._currentState = state;
85
+ return;
86
+ }
87
+ this._render(state);
88
+ }
89
+ /** Re-read terminal size and re-apply scroll region after a resize. */
90
+ reconfigure(state, partial) {
91
+ if (!state.tty || !this._active)
92
+ return;
93
+ const height = process.stdout.rows ?? 24;
94
+ const scrollBottom = Math.max(1, height - 1);
95
+ process.stdout.write(RESET_SCROLL_REGION);
96
+ process.stdout.write(`\x1b[1;${scrollBottom}r`);
97
+ if (partial) {
98
+ this.render({ ...state, ...partial });
99
+ }
100
+ else {
101
+ this.render(state);
102
+ }
103
+ }
104
+ /** Temporarily hide the footer (e.g. during interrupt prompts). */
105
+ hide() {
106
+ if (!this._active || this._hidden)
107
+ return;
108
+ this._hidden = true;
109
+ process.stdout.write(RESET_SCROLL_REGION);
110
+ process.stdout.write(SHOW_CURSOR);
111
+ // Clear the footer row.
112
+ this._clearFooterRow();
113
+ }
114
+ /** Restore the footer after being hidden. */
115
+ show(state) {
116
+ if (!this._active || !this._hidden)
117
+ return;
118
+ this._hidden = false;
119
+ const height = process.stdout.rows ?? 24;
120
+ const scrollBottom = Math.max(1, height - 1);
121
+ process.stdout.write(HIDE_CURSOR);
122
+ process.stdout.write(`\x1b[1;${scrollBottom}r`);
123
+ if (this._currentState) {
124
+ this._render(this._currentState);
125
+ }
126
+ else {
127
+ this._render(state);
128
+ }
129
+ }
130
+ /**
131
+ * Return the current reserved scroll-region bottom row index (height - 1).
132
+ * Used by ScrollRegionGuard to know which row to keep free.
133
+ */
134
+ getScrollBottom() {
135
+ const height = process.stdout.rows ?? 24;
136
+ return Math.max(1, height - 1);
137
+ }
138
+ /**
139
+ * Force-render the footer without checking _hidden/_active guards.
140
+ * Used by ScrollRegionGuard during re-establish after a guarded write.
141
+ */
142
+ forceRender(state) {
143
+ if (!state.tty)
144
+ return;
145
+ this._render(state);
146
+ }
147
+ /**
148
+ * Write text above the footer safely. Saves cursor, resets scroll region,
149
+ * writes the text, re-establishes scroll region, re-renders footer,
150
+ * and restores cursor. This is the core defensive write — it ensures
151
+ * no output can break the scroll region.
152
+ */
153
+ writeAbove(text, state) {
154
+ if (!this._active || !state.tty) {
155
+ process.stdout.write(text);
156
+ return;
157
+ }
158
+ const scrollBottom = this.getScrollBottom();
159
+ // Save cursor
160
+ process.stdout.write(SAVE_CURSOR);
161
+ // Reset scroll region so write lands in the scrollable area
162
+ process.stdout.write(RESET_SCROLL_REGION);
163
+ // Perform the write
164
+ process.stdout.write(text);
165
+ // Re-establish scroll region
166
+ process.stdout.write(`\x1b[1;${scrollBottom}r`);
167
+ // Re-render footer
168
+ this.forceRender(state);
169
+ // Restore cursor
170
+ process.stdout.write(RESTORE_CURSOR);
171
+ }
172
+ /**
173
+ * Tear down: reset scroll region, show cursor, clear footer.
174
+ */
175
+ teardown() {
176
+ if (!this._active)
177
+ return;
178
+ this._active = false;
179
+ this._hidden = false;
180
+ if (this._spinnerInterval) {
181
+ clearInterval(this._spinnerInterval);
182
+ this._spinnerInterval = null;
183
+ }
184
+ process.stdout.write(RESET_SCROLL_REGION);
185
+ process.stdout.write(SHOW_CURSOR);
186
+ this._clearFooterRow();
187
+ }
188
+ // ── private helpers ──
189
+ _render(state) {
190
+ this._currentState = state;
191
+ const width = getWidth();
192
+ // Build PAINTED segments as {text,color} — never measure colour codes.
193
+ // Order is fixed by design §3.7: phase, action, tokens, agent, TITLE, docs.
194
+ const segs = [];
195
+ // Stage (amber) + optional spinner
196
+ if (state.stage) {
197
+ const frame = SPINNER_FRAMES[this._spinnerIdx % SPINNER_FRAMES.length];
198
+ const stageText = state.spinner ? `${frame} ${state.stage}` : state.stage;
199
+ segs.push({ text: stageText, color: C.amber });
200
+ }
201
+ // Action
202
+ if (state.action) {
203
+ segs.push({ text: state.action, color: C.cyan });
204
+ }
205
+ // Tokens
206
+ if (state.tokens) {
207
+ segs.push({ text: state.tokens, color: C.dim });
208
+ }
209
+ // AgentId
210
+ if (state.agentId) {
211
+ segs.push({ text: `[${state.agentId}]`, color: C.green });
212
+ }
213
+ // Task title — the ≤50-char field. sanitizeTitle() also strips terminal
214
+ // control characters, so an untrusted goal can never inject ANSI here.
215
+ const title = titleField(state.taskDesc);
216
+ if (title) {
217
+ segs.push({ text: title, color: C.white });
218
+ }
219
+ // Docs
220
+ if (state.docs) {
221
+ segs.push({ text: state.docs, color: C.dim });
222
+ }
223
+ // Protected tail: "Xcoder <version>". Required fields are never the thing
224
+ // that gets dropped, so the core cluster is truncated to make room for it.
225
+ const tail = versionLabel(state.version);
226
+ const tailGap = 2; // two spaces between core and tail
227
+ const coreBudget = Math.max(0, width - visibleLength(tail) - (tail ? tailGap : 0));
228
+ const core = composeCore(segs, coreBudget, this._noColor);
229
+ const plain = tail ? (core ? `${core}${" ".repeat(tailGap)}${tail}` : tail) : core;
230
+ // Pad to full width (visible length, so ANSI codes don't inflate the count).
231
+ const pad = Math.max(0, width - visibleLength(plain));
232
+ const padded = plain + " ".repeat(pad);
233
+ // Paint the full line with background
234
+ const bgLine = this._noColor ? padded : `${C.bgFooter}${padded}${C.reset}`;
235
+ // Write: save cursor, go to bottom row, draw, restore cursor
236
+ process.stdout.write(SAVE_CURSOR);
237
+ process.stdout.write(CURSOR_TO_BOTTOM);
238
+ process.stdout.write(CLEAR_LINE);
239
+ process.stdout.write(bgLine);
240
+ process.stdout.write(RESTORE_CURSOR);
241
+ }
242
+ _clearFooterRow() {
243
+ process.stdout.write(CURSOR_TO_BOTTOM);
244
+ process.stdout.write(CLEAR_LINE);
245
+ }
246
+ /**
247
+ * Start spinner tick — called by FooterManager when initiating thinking.
248
+ * Managed here so the renderer owns the interval lifecycle.
249
+ */
250
+ startSpinner() {
251
+ if (this._spinnerInterval)
252
+ return;
253
+ this._spinnerInterval = setInterval(() => {
254
+ this._spinnerIdx++;
255
+ if (this._currentState && this._currentState.tty && !this._hidden) {
256
+ this._render({ ...this._currentState, spinner: true });
257
+ }
258
+ }, 100);
259
+ }
260
+ /**
261
+ * Stop spinner tick — called by FooterManager when thinking stops.
262
+ */
263
+ stopSpinner() {
264
+ if (this._spinnerInterval) {
265
+ clearInterval(this._spinnerInterval);
266
+ this._spinnerInterval = null;
267
+ }
268
+ }
269
+ }
270
+ function paint(code, text, noColor) {
271
+ return noColor ? text : `${code}${text}${C.reset}`;
272
+ }
273
+ /** ANSI CSI/OSC sequence matcher — used ONLY to measure, never to render. */
274
+ // eslint-disable-next-line no-control-regex
275
+ const ANSI_RE = /\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b[\]P^_][\s\S]*?(?:\x07|\x1b\\)|\x1b[@-Z\\-_]/g;
276
+ /**
277
+ * Visible (printable) length of a string. Escape sequences occupy no terminal
278
+ * columns, so measuring `.length` on a paint()ed string inflates the count and
279
+ * silently truncated the footer short — the defect this replaced.
280
+ */
281
+ function visibleLength(text) {
282
+ if (!text)
283
+ return 0;
284
+ return text.replace(ANSI_RE, "").length;
285
+ }
286
+ /**
287
+ * Join segments with a dim ` │ ` separator and truncate the result to `budget`
288
+ * VISIBLE characters (ending in `…`).
289
+ *
290
+ * Segments are consumed in priority order (phase first, docs last), so the
291
+ * optional tail is what gets dropped on a narrow terminal.
292
+ */
293
+ function composeCore(segs, budget, noColor) {
294
+ if (segs.length === 0 || budget <= 0)
295
+ return "";
296
+ const sepVisible = 3; // " │ "
297
+ let used = 0;
298
+ const kept = [];
299
+ for (const seg of segs) {
300
+ const cost = visibleLength(seg.text) + (kept.length > 0 ? sepVisible : 0);
301
+ if (used + cost <= budget) {
302
+ kept.push(seg);
303
+ used += cost;
304
+ continue;
305
+ }
306
+ // Does not fit whole — take as much as the budget allows, appending "…"
307
+ // so the reader knows text was dropped.
308
+ const room = budget - used - (kept.length > 0 ? sepVisible : 0);
309
+ if (room > 1) {
310
+ const cut = Array.from(seg.text).slice(0, room - 1).join("") + "…";
311
+ kept.push({ text: cut, color: seg.color });
312
+ }
313
+ break;
314
+ }
315
+ if (kept.length === 0)
316
+ return "";
317
+ const sep = paint(C.dim, " │ ", noColor);
318
+ return kept.map((s) => paint(s.color, s.text, noColor)).join(sep);
319
+ }
@@ -0,0 +1,34 @@
1
+ import type { SdlcStage } from "../types.js";
2
+ /**
3
+ * The current values for every footer field.
4
+ * Single source of truth — FooterManager writes, FooterRenderer reads.
5
+ */
6
+ export interface FooterState {
7
+ /** Current SDLC stage, derived from the DAG. */
8
+ stage: SdlcStage | null;
9
+ /** Agent currently thinking (or null if idle). */
10
+ agentId: string | null;
11
+ /**
12
+ * RAW task title. NOT pre-truncated by callers — the renderer owns the
13
+ * 50-character field (`titleField()` in footer-text.ts).
14
+ */
15
+ taskDesc: string | null;
16
+ /** Last action tool name. */
17
+ action: string | null;
18
+ /** Whether an observation is in flight. */
19
+ observing: boolean;
20
+ /** Whether the spinner should be active. */
21
+ spinner: boolean;
22
+ /** Cumulative token usage display string. */
23
+ tokens: string | null;
24
+ /** Document count or doc-related info. */
25
+ docs: string | null;
26
+ /** Whether the terminal supports ANSI (TTY + no NO_COLOR). */
27
+ tty: boolean;
28
+ /** Version string injected by FooterManager from XCODER_VERSION. null = omit the token. */
29
+ version: string | null;
30
+ }
31
+ /**
32
+ * Creates a default, idle footer state.
33
+ */
34
+ export declare function createFooterState(overrides?: Partial<FooterState>): FooterState;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Creates a default, idle footer state.
3
+ */
4
+ export function createFooterState(overrides) {
5
+ return {
6
+ stage: null,
7
+ agentId: null,
8
+ taskDesc: null,
9
+ action: null,
10
+ observing: false,
11
+ spinner: false,
12
+ tokens: null,
13
+ docs: null,
14
+ tty: false,
15
+ version: null,
16
+ ...overrides,
17
+ };
18
+ }
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Footer text fields — the single place that decides what the task-title and
3
+ * version fields of the bottom footer look like.
4
+ *
5
+ * Why this is a separate module: the title comes from an untrusted source
6
+ * (`run.spec.goal`, which can originate from a CLI argument, an ingested
7
+ * markdown/WBS file, or a backlog item). Anything written to stdout is an
8
+ * interpreter input for the terminal emulator, so it is sanitised HERE, once,
9
+ * rather than trusted at every call site (PRM-01, PRM-08).
10
+ */
11
+ /** Maximum visible characters the task-title field may occupy (design AC-9). */
12
+ export declare const FOOTER_TITLE_MAX = 50;
13
+ /** Single-character ellipsis used when a title is cut. */
14
+ export declare const ELLIPSIS = "\u2026";
15
+ /**
16
+ * Strip terminal-control characters from untrusted text before it reaches
17
+ * stdout.
18
+ *
19
+ * Removes:
20
+ * - `ESC` (0x1B) and any other C0 control (`0x00-0x1F`), which is what makes
21
+ * ANSI CSI/OSC sequences possible (colour, cursor moves, OSC-52 clipboard
22
+ * writes, window-title sets).
23
+ * - `DEL` (0x7F) and the C1 block (`0x80-0x9F`), the 8-bit equivalents of
24
+ * the same sequences.
25
+ *
26
+ * Newlines, carriage returns and tabs are collapsed to a single space first so
27
+ * a title can never break the one-row footer layout.
28
+ *
29
+ * This is a security control, not cosmetics — see design section 6.
30
+ */
31
+ export declare function sanitizeTitle(raw: string | null): string;
32
+ /**
33
+ * The task-title field: at most `max` visible characters.
34
+ *
35
+ * This is a MAXIMUM, not a fixed-width box — short titles are not right-padded
36
+ * (design tradeoff T3). When the sanitised title is longer than `max`, it is
37
+ * cut to `max - 1` characters and a single `…` is appended, so the result is
38
+ * exactly `max` characters.
39
+ *
40
+ * Splitting is done by code point, so an emoji or other astral character is
41
+ * never cut in half.
42
+ */
43
+ export declare function titleField(raw: string | null, max?: number): string;
44
+ /**
45
+ * The version segment of the footer: `"Xcoder <version>"`.
46
+ *
47
+ * Built in exactly one place so the product name and the spacing can never
48
+ * drift between call sites. A null/empty version yields an empty string, which
49
+ * the renderer treats as "omit the token".
50
+ */
51
+ export declare function versionLabel(version: string | null): string;
@@ -0,0 +1,74 @@
1
+ // xcoder:version 2 | xcoder:task task-3e056b | xcoder:updated 2026-11-03T17:56:20.605Z | xcoder:subtask code-st-f19254
2
+ /**
3
+ * Footer text fields — the single place that decides what the task-title and
4
+ * version fields of the bottom footer look like.
5
+ *
6
+ * Why this is a separate module: the title comes from an untrusted source
7
+ * (`run.spec.goal`, which can originate from a CLI argument, an ingested
8
+ * markdown/WBS file, or a backlog item). Anything written to stdout is an
9
+ * interpreter input for the terminal emulator, so it is sanitised HERE, once,
10
+ * rather than trusted at every call site (PRM-01, PRM-08).
11
+ */
12
+ /** Maximum visible characters the task-title field may occupy (design AC-9). */
13
+ export const FOOTER_TITLE_MAX = 50;
14
+ /** Single-character ellipsis used when a title is cut. */
15
+ export const ELLIPSIS = "…";
16
+ /**
17
+ * Strip terminal-control characters from untrusted text before it reaches
18
+ * stdout.
19
+ *
20
+ * Removes:
21
+ * - `ESC` (0x1B) and any other C0 control (`0x00-0x1F`), which is what makes
22
+ * ANSI CSI/OSC sequences possible (colour, cursor moves, OSC-52 clipboard
23
+ * writes, window-title sets).
24
+ * - `DEL` (0x7F) and the C1 block (`0x80-0x9F`), the 8-bit equivalents of
25
+ * the same sequences.
26
+ *
27
+ * Newlines, carriage returns and tabs are collapsed to a single space first so
28
+ * a title can never break the one-row footer layout.
29
+ *
30
+ * This is a security control, not cosmetics — see design section 6.
31
+ */
32
+ export function sanitizeTitle(raw) {
33
+ if (raw == null)
34
+ return "";
35
+ // Collapse line-breaking whitespace before stripping, so "a\nb" -> "a b",
36
+ // not "ab".
37
+ const collapsed = raw.replace(/[\r\n\t]+/g, " ");
38
+ // ESC + remaining C0, then DEL + C1. No control character survives.
39
+ const stripped = collapsed.replace(/\x1b/g, "").replace(/[\x00-\x1f\x7f-\x9f]/g, "");
40
+ return stripped.trim();
41
+ }
42
+ /**
43
+ * The task-title field: at most `max` visible characters.
44
+ *
45
+ * This is a MAXIMUM, not a fixed-width box — short titles are not right-padded
46
+ * (design tradeoff T3). When the sanitised title is longer than `max`, it is
47
+ * cut to `max - 1` characters and a single `…` is appended, so the result is
48
+ * exactly `max` characters.
49
+ *
50
+ * Splitting is done by code point, so an emoji or other astral character is
51
+ * never cut in half.
52
+ */
53
+ export function titleField(raw, max = FOOTER_TITLE_MAX) {
54
+ const clean = sanitizeTitle(raw);
55
+ if (clean === "")
56
+ return "";
57
+ const codePoints = Array.from(clean);
58
+ if (codePoints.length <= max)
59
+ return clean;
60
+ if (max <= 1)
61
+ return ELLIPSIS;
62
+ return codePoints.slice(0, max - 1).join("") + ELLIPSIS;
63
+ }
64
+ /**
65
+ * The version segment of the footer: `"Xcoder <version>"`.
66
+ *
67
+ * Built in exactly one place so the product name and the spacing can never
68
+ * drift between call sites. A null/empty version yields an empty string, which
69
+ * the renderer treats as "omit the token".
70
+ */
71
+ export function versionLabel(version) {
72
+ const v = sanitizeTitle(version ?? "");
73
+ return v === "" ? "" : `Xcoder ${v}`;
74
+ }
@@ -0,0 +1 @@
1
+ export declare function shortId(prefix: string): string;
@@ -0,0 +1,4 @@
1
+ import crypto from "node:crypto";
2
+ export function shortId(prefix) {
3
+ return `${prefix}-${crypto.randomBytes(3).toString("hex")}`;
4
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Compute the Levenshtein distance between two case-folded strings.
3
+ * The distance is the minimum number of single-character insertions,
4
+ * deletions, or substitutions required to transform `a` into `b`.
5
+ */
6
+ export declare function levenshtein(a: string, b: string): number;
@@ -0,0 +1,34 @@
1
+ // xcoder:version 1 | xcoder:task task-c776f2 | xcoder:updated 2026-08-03T19:28:35.957Z | xcoder:subtask code-st-5c254e
2
+ /**
3
+ * Compute the Levenshtein distance between two case-folded strings.
4
+ * The distance is the minimum number of single-character insertions,
5
+ * deletions, or substitutions required to transform `a` into `b`.
6
+ */
7
+ export function levenshtein(a, b) {
8
+ const s = a.toLowerCase();
9
+ const t = b.toLowerCase();
10
+ // Ensure s is the shorter string (O(min(n,m)) space)
11
+ if (s.length > t.length) {
12
+ return levenshtein(b, a);
13
+ }
14
+ const m = s.length;
15
+ const n = t.length;
16
+ // Two-row DP arrays
17
+ let prev = new Array(m + 1);
18
+ let curr = new Array(m + 1);
19
+ for (let i = 0; i <= m; i++) {
20
+ prev[i] = i;
21
+ }
22
+ for (let j = 1; j <= n; j++) {
23
+ curr[0] = j;
24
+ for (let i = 1; i <= m; i++) {
25
+ const substitutionCost = s[i - 1] === t[j - 1] ? 0 : 1;
26
+ curr[i] = Math.min(prev[i] + 1, // deletion
27
+ curr[i - 1] + 1, // insertion
28
+ prev[i - 1] + substitutionCost);
29
+ }
30
+ // Swap rows
31
+ [prev, curr] = [curr, prev];
32
+ }
33
+ return prev[m];
34
+ }
@@ -0,0 +1,10 @@
1
+ export declare const log: {
2
+ orchestrator(msg: string): void;
3
+ agent(id: string, msg: string): void;
4
+ ok(msg: string): void;
5
+ fail(msg: string): void;
6
+ dim(msg: string): void;
7
+ raw(msg: string): void;
8
+ sumurai(msg: string): void;
9
+ ninj(msg: string): void;
10
+ };
@@ -0,0 +1,41 @@
1
+ // xcoder:version 2 | xcoder:task task-e23ea7 | xcoder:updated 2026-08-05T09:43:25.115Z | xcoder:subtask code-st-a00941
2
+ const COLOR = {
3
+ reset: "\x1b[0m",
4
+ dim: "\x1b[2m",
5
+ amber: "\x1b[38;5;214m",
6
+ cyan: "\x1b[38;5;80m",
7
+ green: "\x1b[38;5;78m",
8
+ coral: "\x1b[38;5;203m",
9
+ };
10
+ function useColor() {
11
+ return process.stdout.isTTY === true && process.env.NO_COLOR === undefined;
12
+ }
13
+ function paint(code, text) {
14
+ return useColor() ? `${code}${text}${COLOR.reset}` : text;
15
+ }
16
+ export const log = {
17
+ orchestrator(msg) {
18
+ console.log(paint(COLOR.amber, "[orchestrator]"), msg);
19
+ },
20
+ agent(id, msg) {
21
+ console.log(paint(COLOR.cyan, `[${id}]`), msg);
22
+ },
23
+ ok(msg) {
24
+ console.log(paint(COLOR.green, "✓"), msg);
25
+ },
26
+ fail(msg) {
27
+ console.log(paint(COLOR.coral, "✗"), msg);
28
+ },
29
+ dim(msg) {
30
+ console.log(paint(COLOR.dim, msg));
31
+ },
32
+ raw(msg) {
33
+ console.log(msg);
34
+ },
35
+ sumurai(msg) {
36
+ console.log(paint(COLOR.amber, "[Sumurai]"), msg);
37
+ },
38
+ ninj(msg) {
39
+ console.log(paint(COLOR.cyan, "[Ninj]"), msg);
40
+ },
41
+ };
@@ -0,0 +1,26 @@
1
+ export { redactSecrets, REDACTED } from "./redact.js";
2
+ export type { RedactionResult, RedactionCount } from "./redact.js";
3
+ /** Reason (Thought) → Action → Observation trace, one line per step, human-readable. */
4
+ export declare function appendThink(root: string, taskId: string, subtaskId: string, line: string): Promise<void>;
5
+ /** System-level errors: crashes, tool exceptions, anything that would otherwise vanish silently. */
6
+ export declare function appendSys(root: string, taskId: string, line: string): Promise<void>;
7
+ /** Raw LLM request/response pairs, one JSON line each. */
8
+ export declare function appendLlm(root: string, taskId: string, subtaskId: string, entry: {
9
+ direction: "request" | "response";
10
+ content: string;
11
+ stopReason?: string | null;
12
+ }): Promise<void>;
13
+ /** Token usage per LLM call, plus running totals — one line per call. */
14
+ export declare function appendToken(root: string, taskId: string, subtaskId: string, usage: {
15
+ inputTokens: number;
16
+ outputTokens: number;
17
+ cumulativeInput: number;
18
+ cumulativeOutput: number;
19
+ }): Promise<void>;
20
+ /** Reasoning-effectiveness score per subtask attempt, with its full breakdown — see orchestrator/reasoning-score.ts for what this is and isn't. */
21
+ export declare function appendScore(root: string, taskId: string, subtaskId: string, score: {
22
+ score: number;
23
+ breakdown: string[];
24
+ }): Promise<void>;
25
+ export declare function appendFiles(root: string, taskId: string, subtaskId: string, line: string): Promise<void>;
26
+ export declare function taskLogDir(root: string, taskId: string): string;