xcoder-dna 0.0.0-stage → 1.3.1

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 +21 -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 +38 -3
@@ -0,0 +1,124 @@
1
+ // xcoder:version 4 | xcoder:task task-4f2baf | xcoder:updated 2026-08-05T05:48:55.314Z | xcoder:subtask code-st-11b531
2
+ import * as clack from "@clack/prompts";
3
+ import { createSpinner } from "./spinner.js";
4
+ import { FooterManager } from "./footer-manager.js";
5
+ const C = {
6
+ reset: "\x1b[0m",
7
+ dim: "\x1b[2m",
8
+ bold: "\x1b[1m",
9
+ amber: "\x1b[38;5;214m",
10
+ cyan: "\x1b[38;5;80m",
11
+ green: "\x1b[38;5;78m",
12
+ coral: "\x1b[38;5;203m",
13
+ violet: "\x1b[38;5;140m",
14
+ };
15
+ function useColor() {
16
+ return process.stdout.isTTY === true && process.env.NO_COLOR === undefined;
17
+ }
18
+ function paint(code, text) {
19
+ return useColor() ? `${code}${text}${C.reset}` : text;
20
+ }
21
+ /**
22
+ * One spinner per Sub Agent turn — "thinking" while the LLM call is in
23
+ * flight. This is the piece that makes a long silent wait (previously
24
+ * indistinguishable from a hang, which is part of what made a crash look
25
+ * like nothing was happening) visibly alive. Backend/style is selectable
26
+ * via `--spinner` — see `util/spinner.ts`.
27
+ */
28
+ export function startThinking(agentId) {
29
+ const s = createSpinner(paint(C.dim, `[${agentId}] thinking…`));
30
+ FooterManager.instance()?.updateThinkingStart(agentId);
31
+ return {
32
+ stop: (thought) => {
33
+ const preview = thought.length > 100 ? thought.slice(0, 97) + "..." : thought;
34
+ s.stop(`${paint(C.violet, `[${agentId}] Thought`)} ${preview}`);
35
+ FooterManager.instance()?.updateThinkingStop();
36
+ },
37
+ fail: (message) => {
38
+ s.fail(paint(C.coral, `[${agentId}] ${message}`));
39
+ FooterManager.instance()?.updateThinkingStop();
40
+ },
41
+ };
42
+ }
43
+ export function printAction(agentId, tool, input) {
44
+ const inputPreview = JSON.stringify(input);
45
+ const truncated = inputPreview && inputPreview.length > 160 ? inputPreview.slice(0, 157) + "..." : inputPreview;
46
+ clack.log.info(`${paint(C.amber, `[${agentId}] Action`)} ${paint(C.bold, tool)} ${paint(C.dim, truncated ?? "")}`);
47
+ FooterManager.instance()?.updateAction(tool);
48
+ }
49
+ export function printObservation(agentId, ok, text) {
50
+ const preview = text.length > 220 ? text.slice(0, 217) + "..." : text;
51
+ const label = ok ? paint(C.green, `[${agentId}] Observation ✓`) : paint(C.coral, `[${agentId}] Observation ✗`);
52
+ (ok ? clack.log.success : clack.log.error)(`${label} ${preview}`);
53
+ FooterManager.instance()?.updateObservation(ok, text);
54
+ }
55
+ export function printTokens(agentId, turn, cumulative) {
56
+ clack.log.message(paint(C.dim, ` ↳ tokens: +${turn.inputTokens} in / +${turn.outputTokens} out` +
57
+ ` (task total: ${cumulative.inputTokens} in / ${cumulative.outputTokens} out)`));
58
+ FooterManager.instance()?.updateTokens(cumulative.inputTokens, cumulative.outputTokens);
59
+ }
60
+ export function printProtocolError(agentId, message) {
61
+ clack.log.warn(paint(C.coral, `[${agentId}] protocol_error: ${message}`));
62
+ }
63
+ export function printDuplicateWarning(agentId, message) {
64
+ clack.log.warn(paint(C.amber, `[${agentId}] ⟲ ${message}`));
65
+ }
66
+ export function printCrash(agentId, message) {
67
+ clack.log.error(paint(C.coral, `[${agentId}] CRASHED (isolated — orchestrator continues): ${message}`));
68
+ }
69
+ export function printFinalAnswer(agentId, summary) {
70
+ clack.log.success(paint(C.green, `[${agentId}] final_answer`) + ` ${summary}`);
71
+ }
72
+ export function taskIntro(taskId, goal) {
73
+ clack.intro(paint(C.bold, `xcoder · ${taskId}`));
74
+ clack.log.step(goal);
75
+ }
76
+ export function taskOutro(status) {
77
+ const color = status === "done" ? C.green : status === "escalated" ? C.coral : C.amber;
78
+ clack.outro(paint(color, `run finished: ${status}`));
79
+ }
80
+ export function orchestratorNote(message) {
81
+ clack.log.step(paint(C.amber, "[orchestrator] ") + message);
82
+ }
83
+ /**
84
+ * Printed exactly once per interrupt, after state is flushed to disk.
85
+ * Shows task ID, done/total count, exact --resume command, and file path.
86
+ */
87
+ export function printInterruptSummary(summary) {
88
+ clack.log.message(paint(C.bold, `\nInterrupted — progress saved.`) +
89
+ `\n Task: ${summary.taskId}` +
90
+ `\n Done: ${summary.doneCount}/${summary.totalCount} subtasks` +
91
+ `\n Resume with: ${paint(C.cyan, summary.resumeCommand)}` +
92
+ `\n Task file: ${paint(C.dim, summary.taskFilePath)}`);
93
+ }
94
+ /**
95
+ * Print a color-coded summary of an Instance Swarm run.
96
+ * Uses the same palette as the rest of the terminal module:
97
+ * - green for completed workers
98
+ * - coral for crashed/failed workers
99
+ * - amber for the swarm-level status line
100
+ * - dim for metadata (tokens, output dir)
101
+ */
102
+ export function printSwarmSummary(result) {
103
+ const statusColor = result.status === "completed" ? C.green : result.status === "timeout" ? C.amber : C.coral;
104
+ const statusIcon = result.status === "completed" ? "✓" : result.status === "timeout" ? "⏱" : "✗";
105
+ clack.log.message(paint(C.bold, `\nSwarm finished`) +
106
+ ` ${paint(statusColor, `${statusIcon} ${result.status}`)}`);
107
+ clack.log.message(` ${paint(C.cyan, "instanceId:")} ${paint(C.dim, result.instanceId)}`);
108
+ const workerLine = ` ${paint(C.cyan, "workers:")} ` +
109
+ `${paint(C.green, String(result.workerCount - result.crashedCount))} completed`;
110
+ if (result.crashedCount > 0) {
111
+ clack.log.message(workerLine + `, ${paint(C.coral, String(result.crashedCount))} crashed`);
112
+ }
113
+ else {
114
+ clack.log.message(workerLine);
115
+ }
116
+ clack.log.message(` ${paint(C.cyan, "tokens:")} ${paint(C.dim, `${result.totalInputTokens} in / ${result.totalOutputTokens} out`)}`);
117
+ clack.log.message(` ${paint(C.cyan, "outputDir:")} ${paint(C.dim, result.outputDir)}`);
118
+ if (result.errors.length > 0) {
119
+ clack.log.message(paint(C.bold, `\n Errors:`));
120
+ for (const err of result.errors) {
121
+ clack.log.error(paint(C.coral, ` ✗ ${err}`));
122
+ }
123
+ }
124
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Strip terminal control sequences and invisible characters, collapse CR/LF
3
+ * to a single space, and truncate to `maxLen` (default 60 — the column width
4
+ * `statusList` already uses).
5
+ *
6
+ * Never used on data that is persisted; call it on the way to `log.raw`.
7
+ */
8
+ export declare function sanitizeForTerminal(input: string, maxLen?: number): string;
@@ -0,0 +1,45 @@
1
+ // xcoder:version 1 | xcoder:task task-a91099 | xcoder:updated 2026-10-23T10:52:28.927Z | xcoder:subtask code-st-03748c
2
+ // Terminal render-time neutralization.
3
+ //
4
+ // Task goals and provenance paths are attacker-influenced data: a markdown/WBS
5
+ // source a user ingests can contain ANSI escape sequences, OSC hyperlink
6
+ // payloads, zero-width characters or bidi overrides. Anything printed straight
7
+ // from such a record to a terminal can repaint the screen, forge log lines, or
8
+ // misrepresent what was written. This module neutralizes those characters at
9
+ // the point of display ONLY — the stored JSON keeps the verbatim text.
10
+ const CSI_AND_OSC = new RegExp([
11
+ // CSI: ESC [ ... final byte (@-~)
12
+ "\\u001b\\[[0-?]*[ -/]*[@-~]",
13
+ // OSC: ESC ] ... terminated by BEL or ST
14
+ "\\u001b\\][^\\u0007\\u001b]*(?:\\u0007|\\u001b\\\\)",
15
+ // Any other ESC-introduced two/three byte sequence
16
+ "\\u001b[@-Z\\\\-_]",
17
+ // 8-bit CSI (C1)
18
+ "\\u009b[0-?]*[ -/]*[@-~]",
19
+ // 8-bit OSC (C1)
20
+ "\\u009d[^\\u0007\\u009c]*(?:\\u0007|\\u009c)",
21
+ ].join("|"), "g");
22
+ const C0_C1_CONTROLS = /[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/g;
23
+ const ZERO_WIDTH = /[\u200b-\u200d\ufeff]/g;
24
+ const BIDI = /[\u202a-\u202e\u2066-\u2069]/g;
25
+ /**
26
+ * Strip terminal control sequences and invisible characters, collapse CR/LF
27
+ * to a single space, and truncate to `maxLen` (default 60 — the column width
28
+ * `statusList` already uses).
29
+ *
30
+ * Never used on data that is persisted; call it on the way to `log.raw`.
31
+ */
32
+ export function sanitizeForTerminal(input, maxLen = 60) {
33
+ if (typeof input !== "string")
34
+ return "";
35
+ let out = input.replace(CSI_AND_OSC, "");
36
+ out = out.replace(C0_C1_CONTROLS, "");
37
+ out = out.replace(ZERO_WIDTH, "");
38
+ out = out.replace(BIDI, "");
39
+ // Tabs are permitted in the control strip above; flatten all line breaks.
40
+ out = out.replace(/[\r\n]+/g, " ").replace(/\t/g, " ");
41
+ out = out.replace(/\s{2,}/g, " ").trim();
42
+ if (maxLen >= 0 && out.length > maxLen)
43
+ out = out.slice(0, maxLen);
44
+ return out;
45
+ }
@@ -0,0 +1,27 @@
1
+ export interface ThinkingHandle {
2
+ /** Stop the spinner and replace it with a success message (erases the spinner line). */
3
+ stop(message: string): void;
4
+ /** Stop the spinner and replace it with a failure message (erases the spinner line). */
5
+ fail(message: string): void;
6
+ /** Pause the spinner animation and clear its line so other log output can
7
+ * be printed without mangling. Call resume() to restart. */
8
+ pause(): void;
9
+ /** Resume the spinner animation after a pause(). */
10
+ resume(): void;
11
+ }
12
+ /**
13
+ * Start a colorful animated thinking spinner on stdout.
14
+ *
15
+ * When stdout is a TTY and NO_COLOR is not set:
16
+ * - Renders a rotating glyph (Unicode Braille or ASCII fallback on cp1252
17
+ * terminals) with a color-cycling label on a single line.
18
+ * - Updates every ~100ms via setInterval (non-blocking to the event loop).
19
+ * - Hides the cursor while active.
20
+ *
21
+ * When stdout is NOT a TTY or NO_COLOR is set:
22
+ * - Emits one static "Thinking…" line, then appends a dot every ~2s.
23
+ * - No ANSI codes, no animation, no cursor control.
24
+ *
25
+ * @param label - A short identifier shown next to the spinner (e.g. "samurai").
26
+ */
27
+ export declare function startThinking(label: string): ThinkingHandle;
@@ -0,0 +1,189 @@
1
+ // ── Colorful animated thinking spinner for the samurai agent (and eventually beyond). ──
2
+ //
3
+ // When stdout is a TTY and NO_COLOR is not set:
4
+ // - Color-cycling label + rotating glyph (Unicode Braille, ASCII fallback on
5
+ // non-UTF-8 Windows consoles).
6
+ // - Updates every ~100ms via setInterval (non-blocking).
7
+ // - Hides/shows the cursor around the animation.
8
+ // - Supports pause() / resume() so interleaved log messages don't mangle
9
+ // the spinner line.
10
+ //
11
+ // When stdout is NOT a TTY or NO_COLOR is set:
12
+ // - Emits one static "Thinking…" line, then appends dots periodically.
13
+ // - No ANSI, no animation, no cursor control.
14
+ // ── Internal constants ──
15
+ const COLOR_PALETTE = [
16
+ "\x1b[38;5;78m", // green
17
+ "\x1b[38;5;80m", // cyan
18
+ "\x1b[38;5;141m", // magenta
19
+ "\x1b[38;5;220m", // yellow
20
+ ];
21
+ const COLOR_RESET = "\x1b[0m";
22
+ // Unicode Braille spinner (works on Windows Terminal, WSL, macOS, most Linux)
23
+ const BRAILLE_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
24
+ // ASCII fallback for legacy Windows console (cp1252, cmd.exe without modern Terminal)
25
+ const ASCII_FRAMES = ["|", "/", "-", "\\"];
26
+ // ── Platform detection ──
27
+ function isInteractive() {
28
+ return process.stdout.isTTY === true && process.env.NO_COLOR === undefined;
29
+ }
30
+ function shouldUseAscii() {
31
+ // On Windows, check if the console encoding supports Unicode.
32
+ // process.stdout.encoding is the most reliable signal (added in Node 20+).
33
+ if (process.platform === "win32") {
34
+ const enc = process.stdout.encoding;
35
+ // encoding is typically "utf8" on modern terminals (Windows Terminal, VSCode, etc.)
36
+ // and "buffer" or absent on legacy cmd.exe.
37
+ if (enc !== "utf8" && enc !== "utf-8") {
38
+ // Additional check: WT_SESSION indicates Windows Terminal, which handles Braille fine.
39
+ if (!process.env.WT_SESSION && !process.env.TERMINAL_EMULATOR) {
40
+ return true;
41
+ }
42
+ }
43
+ }
44
+ return false;
45
+ }
46
+ function getFrames() {
47
+ return shouldUseAscii() ? ASCII_FRAMES : BRAILLE_FRAMES;
48
+ }
49
+ // ── ANSI helpers ──
50
+ const HIDE_CURSOR = "\x1b[?25l";
51
+ const SHOW_CURSOR = "\x1b[?25h";
52
+ const CLEAR_LINE = "\x1b[2K";
53
+ const CARRIAGE_RETURN = "\r";
54
+ function writeToStdout(text) {
55
+ process.stdout.write(text);
56
+ }
57
+ // ── Implementation ──
58
+ /**
59
+ * Start a colorful animated thinking spinner on stdout.
60
+ *
61
+ * When stdout is a TTY and NO_COLOR is not set:
62
+ * - Renders a rotating glyph (Unicode Braille or ASCII fallback on cp1252
63
+ * terminals) with a color-cycling label on a single line.
64
+ * - Updates every ~100ms via setInterval (non-blocking to the event loop).
65
+ * - Hides the cursor while active.
66
+ *
67
+ * When stdout is NOT a TTY or NO_COLOR is set:
68
+ * - Emits one static "Thinking…" line, then appends a dot every ~2s.
69
+ * - No ANSI codes, no animation, no cursor control.
70
+ *
71
+ * @param label - A short identifier shown next to the spinner (e.g. "samurai").
72
+ */
73
+ export function startThinking(label) {
74
+ const interactive = isInteractive();
75
+ if (!interactive) {
76
+ return createStaticSpinner(label);
77
+ }
78
+ return createAnimatedSpinner(label);
79
+ }
80
+ // ── Non-interactive (static) spinner ──
81
+ function createStaticSpinner(label) {
82
+ let stopped = false;
83
+ let dots = 0;
84
+ let interval = null;
85
+ writeToStdout(`Thinking… [${label}]`);
86
+ interval = setInterval(() => {
87
+ if (stopped)
88
+ return;
89
+ dots = (dots + 1) % 4;
90
+ writeToStdout(".");
91
+ }, 2000);
92
+ function cleanup(finalMessage) {
93
+ if (stopped)
94
+ return;
95
+ stopped = true;
96
+ if (interval !== null) {
97
+ clearInterval(interval);
98
+ interval = null;
99
+ }
100
+ writeToStdout(`\n${finalMessage}\n`);
101
+ }
102
+ return {
103
+ stop(message) {
104
+ cleanup(message);
105
+ },
106
+ fail(message) {
107
+ cleanup(`✗ ${message}`);
108
+ },
109
+ pause() {
110
+ // No-op in static mode — dots are harmless and interleaved logs
111
+ // won't mangle because we append dots in-place without carriage-return.
112
+ },
113
+ resume() {
114
+ // No-op.
115
+ },
116
+ };
117
+ }
118
+ // ── Animated (TTY) spinner ──
119
+ function createAnimatedSpinner(label) {
120
+ let tick = 0;
121
+ let stopped = false;
122
+ let paused = false;
123
+ let interval = null;
124
+ const frames = getFrames();
125
+ // Hide cursor
126
+ writeToStdout(HIDE_CURSOR);
127
+ function render() {
128
+ if (stopped || paused)
129
+ return;
130
+ const colorCode = COLOR_PALETTE[tick % COLOR_PALETTE.length];
131
+ const glyph = frames[tick % frames.length];
132
+ // Format: <CR><clear-line><color><glyph> <label> thinking…<reset>
133
+ writeToStdout(`${CARRIAGE_RETURN}${CLEAR_LINE}${colorCode}${glyph} ${label} thinking…${COLOR_RESET}`);
134
+ }
135
+ // First frame immediately
136
+ render();
137
+ tick++;
138
+ interval = setInterval(() => {
139
+ render();
140
+ tick++;
141
+ }, 100);
142
+ function eraseLine() {
143
+ writeToStdout(`${CARRIAGE_RETURN}${CLEAR_LINE}`);
144
+ }
145
+ function cleanup(finalMessage) {
146
+ if (stopped)
147
+ return;
148
+ stopped = true;
149
+ if (interval !== null) {
150
+ clearInterval(interval);
151
+ interval = null;
152
+ }
153
+ eraseLine();
154
+ writeToStdout(`${finalMessage}\n`);
155
+ // Show cursor
156
+ writeToStdout(SHOW_CURSOR);
157
+ }
158
+ return {
159
+ stop(message) {
160
+ cleanup(`✓ ${message}`);
161
+ },
162
+ fail(message) {
163
+ cleanup(`✗ ${message}`);
164
+ },
165
+ pause() {
166
+ if (stopped || paused)
167
+ return;
168
+ paused = true;
169
+ if (interval !== null) {
170
+ clearInterval(interval);
171
+ interval = null;
172
+ }
173
+ eraseLine();
174
+ writeToStdout(SHOW_CURSOR);
175
+ },
176
+ resume() {
177
+ if (stopped || !paused)
178
+ return;
179
+ paused = false;
180
+ writeToStdout(HIDE_CURSOR);
181
+ render();
182
+ tick++;
183
+ interval = setInterval(() => {
184
+ render();
185
+ tick++;
186
+ }, 100);
187
+ },
188
+ };
189
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Called once at startup by the CLI preAction hook when --debug-tools
3
+ * or DEBUG_TOOLS is active. Sets module-level enabled flag. If customPath
4
+ * is provided, uses it; otherwise defaults to <cwd>/tools.log.
5
+ */
6
+ export declare function enableToolErrorLogging(customPath?: string, opts?: {
7
+ silent?: boolean;
8
+ }): void;
9
+ /** Read-only guard so call sites can skip data collection when disabled. */
10
+ export declare function isToolErrorLoggingEnabled(): boolean;
11
+ /** The data contract for each ndjson line. */
12
+ export interface ToolErrorLogEntry {
13
+ ts: string;
14
+ tool: string;
15
+ error: string;
16
+ ok: false;
17
+ taskId?: string;
18
+ subtaskId?: string;
19
+ input?: string;
20
+ iteration?: number;
21
+ }
22
+ /**
23
+ * Appends one ndjson line to the log file. Never throws — all write
24
+ * failures are silently swallowed. Uses an internal promise-chain mutex to
25
+ * serialise appends without blocking the caller.
26
+ *
27
+ * On the FIRST call, writes a `#`-prefixed header block if the file
28
+ * doesn't already exist (checked via synchronous existsSync — cheap,
29
+ * and only happens on the first error which is rare).
30
+ *
31
+ * Truncates entry.input to MAX_INPUT_LENGTH + "...[truncated]" suffix.
32
+ */
33
+ export declare function logToolError(entry: ToolErrorLogEntry): void;
@@ -0,0 +1,77 @@
1
+ // xcoder:version 1 | xcoder:task task-54c54e | xcoder:updated 2026-08-04T15:30:04.218Z | xcoder:subtask code-st-43fc58
2
+ import fs from "node:fs";
3
+ import { promises as fsp } from "node:fs";
4
+ import path from "node:path";
5
+ import { log } from "./logger.js";
6
+ // ── Module-level state ──
7
+ let enabled = false;
8
+ let logPath = null;
9
+ /** Serialises writes so parallel agents don't interleave lines. */
10
+ let writeChain = Promise.resolve();
11
+ let headerWritten = false;
12
+ // ── Public API ──
13
+ /**
14
+ * Called once at startup by the CLI preAction hook when --debug-tools
15
+ * or DEBUG_TOOLS is active. Sets module-level enabled flag. If customPath
16
+ * is provided, uses it; otherwise defaults to <cwd>/tools.log.
17
+ */
18
+ export function enableToolErrorLogging(customPath, opts) {
19
+ enabled = true;
20
+ logPath = customPath
21
+ ? path.resolve(customPath)
22
+ : path.join(process.cwd(), "tools.log");
23
+ if (!opts?.silent) {
24
+ log.dim(`tool_error diagnostic log: ${logPath}`);
25
+ }
26
+ }
27
+ /** Read-only guard so call sites can skip data collection when disabled. */
28
+ export function isToolErrorLoggingEnabled() {
29
+ return enabled;
30
+ }
31
+ /** Maximum length of input before truncation. */
32
+ const MAX_INPUT_LENGTH = 2000;
33
+ /**
34
+ * Appends one ndjson line to the log file. Never throws — all write
35
+ * failures are silently swallowed. Uses an internal promise-chain mutex to
36
+ * serialise appends without blocking the caller.
37
+ *
38
+ * On the FIRST call, writes a `#`-prefixed header block if the file
39
+ * doesn't already exist (checked via synchronous existsSync — cheap,
40
+ * and only happens on the first error which is rare).
41
+ *
42
+ * Truncates entry.input to MAX_INPUT_LENGTH + "...[truncated]" suffix.
43
+ */
44
+ export function logToolError(entry) {
45
+ if (!enabled || !logPath)
46
+ return;
47
+ writeChain = writeChain.then(async () => {
48
+ try {
49
+ // Write header once, before the first entry.
50
+ if (!headerWritten) {
51
+ const fileExists = fs.existsSync(logPath);
52
+ if (!fileExists) {
53
+ const header = [
54
+ "# Xcoder SDLC tool_error diagnostic log",
55
+ `# Created: ${new Date().toISOString()}`,
56
+ "# Fields: ts, tool, error, ok, taskId, subtaskId, input, iteration",
57
+ "# Enabled by: --debug-tools flag | DEBUG_TOOLS env var",
58
+ "# Only tool errors (ok=false) are logged — successful calls are omitted.",
59
+ "",
60
+ ].join("\n");
61
+ await fsp.appendFile(logPath, header, "utf-8");
62
+ }
63
+ headerWritten = true;
64
+ }
65
+ // Truncate input if necessary
66
+ const entryToWrite = { ...entry };
67
+ if (entryToWrite.input && entryToWrite.input.length > MAX_INPUT_LENGTH) {
68
+ entryToWrite.input = entryToWrite.input.slice(0, MAX_INPUT_LENGTH) + "...[truncated]";
69
+ }
70
+ const line = JSON.stringify(entryToWrite) + "\n";
71
+ await fsp.appendFile(logPath, line, "utf-8");
72
+ }
73
+ catch {
74
+ // Silently swallow — diagnostic logging must never break the agent loop.
75
+ }
76
+ });
77
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Centralized TTY detection for interactive CLI surfaces.
3
+ *
4
+ * The footer (and any ANSI-driven UI) is only safe when stdout is attached
5
+ * to a real terminal AND NO_COLOR is unset. Piped output and NO_COLOR runs
6
+ * must stay raw so downstream tooling and redirected logs never see escape
7
+ * sequences.
8
+ *
9
+ * This is the single source of truth for the gate; SdlcOrchestrator._runLoop
10
+ * calls it when initializing FooterManager, and tests use it to simulate the
11
+ * orchestrator's availability decision.
12
+ */
13
+ export declare function isInteractiveStdout(): boolean;
@@ -0,0 +1,16 @@
1
+ // xcoder:version 1 | xcoder:task task-e53af9 | xcoder:updated 2026-08-13T13:58:49.496Z | xcoder:subtask code-st-a2df76
2
+ /**
3
+ * Centralized TTY detection for interactive CLI surfaces.
4
+ *
5
+ * The footer (and any ANSI-driven UI) is only safe when stdout is attached
6
+ * to a real terminal AND NO_COLOR is unset. Piped output and NO_COLOR runs
7
+ * must stay raw so downstream tooling and redirected logs never see escape
8
+ * sequences.
9
+ *
10
+ * This is the single source of truth for the gate; SdlcOrchestrator._runLoop
11
+ * calls it when initializing FooterManager, and tests use it to simulate the
12
+ * orchestrator's availability decision.
13
+ */
14
+ export function isInteractiveStdout() {
15
+ return process.stdout.isTTY === true && process.env.NO_COLOR === undefined;
16
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Resolves the base directory name for Xcoder SDLC's runtime data.
3
+ * Controlled by XCODER_DIR env var; defaults to ".xcoder".
4
+ *
5
+ * Workspace-relative by default. If XCODER_DIR starts with `/`, `\\`,
6
+ * `C:`, or is otherwise an absolute path, treat it as absolute.
7
+ */
8
+ export declare function xcoderBaseName(): string;
9
+ /**
10
+ * Resolve the full .xcoder directory path given a workspace root.
11
+ * If XCODER_DIR is an absolute path, uses it directly; otherwise
12
+ * joins it with the workspace root.
13
+ */
14
+ export declare function resolveXcoderDir(workspaceRoot: string): string;
15
+ /**
16
+ * Canonical sub-paths — every module that reads/writes Xcoder SDLC data
17
+ * MUST go through these functions, never hardcode "scrum" or "xcoder".
18
+ */
19
+ export interface XcoderPaths {
20
+ /** Root: <workspace>/.xcoder/ */
21
+ readonly root: string;
22
+ /** Task run JSON file: <root>/tasks/<taskId>.json */
23
+ taskFile(taskId: string): string;
24
+ /** Progress markdown: <root>/tasks/<taskId>.md */
25
+ taskProgressFile(taskId: string): string;
26
+ /** Tasks directory: <root>/tasks/ */
27
+ tasksDir(): string;
28
+ /** Backlog directory: <root>/backlog/ */
29
+ backlogDir(): string;
30
+ /** Backlog JSON: <root>/backlog/_backlog.json */
31
+ backlogFile(): string;
32
+ /** Individual requirement doc: <root>/backlog/<id>.md */
33
+ backlogDoc(id: string): string;
34
+ /** Sprint runs directory: <root>/sprint/runs/ */
35
+ sprintRunsDir(): string;
36
+ /** Individual sprint run: <root>/sprint/runs/<id>.json */
37
+ sprintRunFile(sprintRunId: string): string;
38
+ /** Defects directory: <root>/defects/ */
39
+ defectsDir(): string;
40
+ /** Config directory: <root>/config/ */
41
+ configDir(): string;
42
+ /** LLM config: <root>/config/llm.yaml */
43
+ llmConfigPath(): string;
44
+ /** Architecture blueprint: <root>/blueprint.md */
45
+ blueprintPath(): string;
46
+ /** Release/installer output: <root>/release/ */
47
+ releaseDir(): string;
48
+ /** Lessons file: <root>/lessons/learned.md */
49
+ lessonsPath(): string;
50
+ }
51
+ /**
52
+ * Create a XcoderPaths instance bound to a workspace root.
53
+ * This is the single factory — every consumer calls this once and
54
+ * passes the instance down.
55
+ */
56
+ export declare function createXcoderPaths(workspaceRoot: string): XcoderPaths;
@@ -0,0 +1,63 @@
1
+ // xcoder:version 1 | xcoder:task task-12fb57 | xcoder:updated 2026-08-04T12:06:13.381Z | xcoder:subtask code-st-33c7d1
2
+ import path from "node:path";
3
+ // ---------------------------------------------------------------------------
4
+ // XCODER_DIR resolution
5
+ // ---------------------------------------------------------------------------
6
+ /**
7
+ * Resolves the base directory name for Xcoder SDLC's runtime data.
8
+ * Controlled by XCODER_DIR env var; defaults to ".xcoder".
9
+ *
10
+ * Workspace-relative by default. If XCODER_DIR starts with `/`, `\\`,
11
+ * `C:`, or is otherwise an absolute path, treat it as absolute.
12
+ */
13
+ export function xcoderBaseName() {
14
+ return process.env.XCODER_DIR || ".xcoder";
15
+ }
16
+ /**
17
+ * Resolve the full .xcoder directory path given a workspace root.
18
+ * If XCODER_DIR is an absolute path, uses it directly; otherwise
19
+ * joins it with the workspace root.
20
+ */
21
+ export function resolveXcoderDir(workspaceRoot) {
22
+ const base = xcoderBaseName();
23
+ if (path.isAbsolute(base)) {
24
+ return base;
25
+ }
26
+ return path.resolve(workspaceRoot, base);
27
+ }
28
+ // ---------------------------------------------------------------------------
29
+ // Factory
30
+ // ---------------------------------------------------------------------------
31
+ /**
32
+ * Create a XcoderPaths instance bound to a workspace root.
33
+ * This is the single factory — every consumer calls this once and
34
+ * passes the instance down.
35
+ */
36
+ export function createXcoderPaths(workspaceRoot) {
37
+ const root = resolveXcoderDir(workspaceRoot);
38
+ return {
39
+ root,
40
+ // ── Task data ───────────────────────────────────────────
41
+ tasksDir: () => path.join(root, "tasks"),
42
+ taskFile: (taskId) => path.join(root, "tasks", `${taskId}.json`),
43
+ taskProgressFile: (taskId) => path.join(root, "tasks", `${taskId}.md`),
44
+ // ── Backlog ─────────────────────────────────────────────
45
+ backlogDir: () => path.join(root, "backlog"),
46
+ backlogFile: () => path.join(root, "backlog", "_backlog.json"),
47
+ backlogDoc: (id) => path.join(root, "backlog", `${id}.md`),
48
+ // ── Sprint ──────────────────────────────────────────────
49
+ sprintRunsDir: () => path.join(root, "sprint", "runs"),
50
+ sprintRunFile: (sprintRunId) => path.join(root, "sprint", "runs", `${sprintRunId}.json`),
51
+ // ── Defects ─────────────────────────────────────────────
52
+ defectsDir: () => path.join(root, "defects"),
53
+ // ── Config ──────────────────────────────────────────────
54
+ configDir: () => path.join(root, "config"),
55
+ llmConfigPath: () => path.join(root, "config", "llm.yaml"),
56
+ // ── Blueprint ───────────────────────────────────────────
57
+ blueprintPath: () => path.join(root, "blueprint.md"),
58
+ // ── Release ─────────────────────────────────────────────
59
+ releaseDir: () => path.join(root, "release"),
60
+ // ── Lessons ─────────────────────────────────────────────
61
+ lessonsPath: () => path.join(root, "lessons", "learned.md"),
62
+ };
63
+ }
@@ -0,0 +1,2 @@
1
+ export declare const XCODER_VERSION = "1.3.0";
2
+ export declare const XCODER_BUILD_TIMESTAMP = "2026-10-26T00:00:00.000Z";
@@ -0,0 +1,4 @@
1
+ // AUTO-GENERATED by scripts/inject-version.mjs — DO NOT EDIT
2
+ // Regenerate: npm run build (or: node scripts/inject-version.mjs)
3
+ export const XCODER_VERSION = "1.3.0";
4
+ export const XCODER_BUILD_TIMESTAMP = "2026-10-26T00:00:00.000Z";