@neural-node-labs/xcoder-dna 0.0.0-stage → 1.4.2
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.
- package/LICENSE +21 -0
- package/README.md +132 -2
- package/dist/agents/agent-catalog.d.ts +87 -0
- package/dist/agents/agent-catalog.js +159 -0
- package/dist/agents/agent-registry.d.ts +76 -0
- package/dist/agents/agent-registry.js +189 -0
- package/dist/agents/ai-chat-debate.d.ts +36 -0
- package/dist/agents/ai-chat-debate.js +300 -0
- package/dist/agents/ai-chat-report-writer.d.ts +7 -0
- package/dist/agents/ai-chat-report-writer.js +100 -0
- package/dist/agents/duplicate-detector.d.ts +41 -0
- package/dist/agents/duplicate-detector.js +65 -0
- package/dist/agents/genesis-agent.d.ts +61 -0
- package/dist/agents/genesis-agent.js +340 -0
- package/dist/agents/samurai-agent.d.ts +53 -0
- package/dist/agents/samurai-agent.js +279 -0
- package/dist/agents/sub-agent.d.ts +56 -0
- package/dist/agents/sub-agent.js +353 -0
- package/dist/backlog/backlog-requirement-validator.d.ts +10 -0
- package/dist/backlog/backlog-requirement-validator.js +60 -0
- package/dist/backlog/backlog-store.d.ts +29 -0
- package/dist/backlog/backlog-store.js +148 -0
- package/dist/backlog/po-agent.d.ts +16 -0
- package/dist/backlog/po-agent.js +121 -0
- package/dist/backlog/types.d.ts +25 -0
- package/dist/backlog/types.js +4 -0
- package/dist/bench/run.d.ts +11 -0
- package/dist/bench/run.js +185 -0
- package/dist/bench/types.d.ts +50 -0
- package/dist/bench/types.js +1 -0
- package/dist/cli/delegate.d.ts +90 -0
- package/dist/cli/delegate.js +220 -0
- package/dist/cli/swarm.d.ts +10 -0
- package/dist/cli/swarm.js +100 -0
- package/dist/cli/task.d.ts +14 -0
- package/dist/cli/task.js +121 -0
- package/dist/cli/wbc-arg.d.ts +6 -0
- package/dist/cli/wbc-arg.js +40 -0
- package/dist/cli/wbc.d.ts +45 -0
- package/dist/cli/wbc.js +98 -0
- package/dist/commands/license.d.ts +9 -0
- package/dist/commands/license.js +140 -0
- package/dist/commands/release.d.ts +44 -0
- package/dist/commands/release.js +180 -0
- package/dist/commands/test.d.ts +50 -0
- package/dist/commands/test.js +385 -0
- package/dist/config/env-guard.d.ts +35 -0
- package/dist/config/env-guard.js +100 -0
- package/dist/config/env-snapshot.d.ts +18 -0
- package/dist/config/env-snapshot.js +30 -0
- package/dist/config/loadConfig.d.ts +82 -0
- package/dist/config/loadConfig.js +249 -0
- package/dist/config/secure-mode.d.ts +29 -0
- package/dist/config/secure-mode.js +63 -0
- package/dist/config/user-config.d.ts +39 -0
- package/dist/config/user-config.js +202 -0
- package/dist/engine/reasoning-engine.d.ts +21 -0
- package/dist/engine/reasoning-engine.js +59 -0
- package/dist/events/bus.d.ts +22 -0
- package/dist/events/bus.js +18 -0
- package/dist/index.d.ts +87 -0
- package/dist/index.js +88 -0
- package/dist/indexing/ignoreRules.d.ts +1 -0
- package/dist/indexing/ignoreRules.js +53 -0
- package/dist/instance-swarm/instance-swarm-orchestrator.d.ts +57 -0
- package/dist/instance-swarm/instance-swarm-orchestrator.js +204 -0
- package/dist/instance-swarm/protocol-name-resolver.d.ts +23 -0
- package/dist/instance-swarm/protocol-name-resolver.js +64 -0
- package/dist/license/gate.d.ts +31 -0
- package/dist/license/gate.js +188 -0
- package/dist/license/http-client.d.ts +43 -0
- package/dist/license/http-client.js +195 -0
- package/dist/license/manager.d.ts +39 -0
- package/dist/license/manager.js +175 -0
- package/dist/license/receipt.d.ts +27 -0
- package/dist/license/receipt.js +108 -0
- package/dist/license/state-codec.d.ts +72 -0
- package/dist/license/state-codec.js +218 -0
- package/dist/license/state-paths.d.ts +17 -0
- package/dist/license/state-paths.js +64 -0
- package/dist/license/store.d.ts +44 -0
- package/dist/license/store.js +223 -0
- package/dist/license/trust-anchor.d.ts +24 -0
- package/dist/license/trust-anchor.js +74 -0
- package/dist/license/types.d.ts +34 -0
- package/dist/license/types.js +19 -0
- package/dist/llm/budget.d.ts +23 -0
- package/dist/llm/budget.js +58 -0
- package/dist/llm/client.d.ts +53 -0
- package/dist/llm/client.js +122 -0
- package/dist/llm/factory.d.ts +14 -0
- package/dist/llm/factory.js +32 -0
- package/dist/orchestrator/defect-logger.d.ts +31 -0
- package/dist/orchestrator/defect-logger.js +101 -0
- package/dist/orchestrator/defect-manager.d.ts +118 -0
- package/dist/orchestrator/defect-manager.js +338 -0
- package/dist/orchestrator/defect-migration.d.ts +14 -0
- package/dist/orchestrator/defect-migration.js +174 -0
- package/dist/orchestrator/defect-store.d.ts +48 -0
- package/dist/orchestrator/defect-store.js +76 -0
- package/dist/orchestrator/healing.d.ts +14 -0
- package/dist/orchestrator/healing.js +11 -0
- package/dist/orchestrator/interactive-steering.d.ts +64 -0
- package/dist/orchestrator/interactive-steering.js +107 -0
- package/dist/orchestrator/interrupt-handler.d.ts +30 -0
- package/dist/orchestrator/interrupt-handler.js +70 -0
- package/dist/orchestrator/lesson-manager.d.ts +25 -0
- package/dist/orchestrator/lesson-manager.js +122 -0
- package/dist/orchestrator/progress-summary.d.ts +15 -0
- package/dist/orchestrator/progress-summary.js +106 -0
- package/dist/orchestrator/reasoning-score.d.ts +49 -0
- package/dist/orchestrator/reasoning-score.js +117 -0
- package/dist/orchestrator/swarm.d.ts +36 -0
- package/dist/orchestrator/swarm.js +77 -0
- package/dist/orchestrator/task-factory.d.ts +15 -0
- package/dist/orchestrator/task-factory.js +176 -0
- package/dist/orchestrator/validation-gate.d.ts +23 -0
- package/dist/orchestrator/validation-gate.js +155 -0
- package/dist/protocol/react-contract.d.ts +136 -0
- package/dist/protocol/react-contract.js +698 -0
- package/dist/protocol/wks-protocol-manager.d.ts +22 -0
- package/dist/protocol/wks-protocol-manager.js +72 -0
- package/dist/sdlc-runtime/conversation-runner.d.ts +8 -0
- package/dist/sdlc-runtime/conversation-runner.js +64 -0
- package/dist/sdlc-runtime/dag-utils.d.ts +15 -0
- package/dist/sdlc-runtime/dag-utils.js +67 -0
- package/dist/sdlc-runtime/defect-integration.d.ts +7 -0
- package/dist/sdlc-runtime/defect-integration.js +99 -0
- package/dist/sdlc-runtime/execution-loop.d.ts +38 -0
- package/dist/sdlc-runtime/execution-loop.js +274 -0
- package/dist/sdlc-runtime/lesson-recorder.d.ts +9 -0
- package/dist/sdlc-runtime/lesson-recorder.js +27 -0
- package/dist/sdlc-runtime/plan-initializer.d.ts +47 -0
- package/dist/sdlc-runtime/plan-initializer.js +135 -0
- package/dist/sdlc-runtime/progress-persister.d.ts +10 -0
- package/dist/sdlc-runtime/progress-persister.js +34 -0
- package/dist/sdlc-runtime/protocol-loader.d.ts +10 -0
- package/dist/sdlc-runtime/protocol-loader.js +21 -0
- package/dist/sdlc-runtime/reporting.d.ts +24 -0
- package/dist/sdlc-runtime/reporting.js +68 -0
- package/dist/sdlc-runtime/run-task.d.ts +81 -0
- package/dist/sdlc-runtime/run-task.js +210 -0
- package/dist/sdlc-runtime/sdlc-orchestrator.d.ts +59 -0
- package/dist/sdlc-runtime/sdlc-orchestrator.js +170 -0
- package/dist/sdlc-runtime/sdlc-skill.d.ts +44 -0
- package/dist/sdlc-runtime/sdlc-skill.js +148 -0
- package/dist/sdlc-runtime/steering-handler.d.ts +14 -0
- package/dist/sdlc-runtime/steering-handler.js +51 -0
- package/dist/sdlc-runtime/trace-recorder.d.ts +10 -0
- package/dist/sdlc-runtime/trace-recorder.js +7 -0
- package/dist/security/index.d.ts +16 -0
- package/dist/security/index.js +12 -0
- package/dist/security/input-screen.d.ts +30 -0
- package/dist/security/input-screen.js +75 -0
- package/dist/security/tool-call-guard.d.ts +16 -0
- package/dist/security/tool-call-guard.js +174 -0
- package/dist/security/untrusted-content.d.ts +34 -0
- package/dist/security/untrusted-content.js +63 -0
- package/dist/skills/advanced-dfir/SKILL.md +85 -0
- package/dist/skills/advanced-pentest-lab/SKILL.md +88 -0
- package/dist/skills/analyst/SKILL.md +55 -0
- package/dist/skills/architect/SKILL.md +54 -0
- package/dist/skills/aws/SKILL.md +92 -0
- package/dist/skills/azure/SKILL.md +90 -0
- package/dist/skills/bylaw-context.d.ts +45 -0
- package/dist/skills/bylaw-context.js +61 -0
- package/dist/skills/bylaw-review.d.ts +20 -0
- package/dist/skills/bylaw-review.js +101 -0
- package/dist/skills/conversation/SKILL.md +29 -0
- package/dist/skills/design-patterns/SKILL.md +190 -0
- package/dist/skills/devops/SKILL.md +55 -0
- package/dist/skills/directives.d.ts +20 -0
- package/dist/skills/directives.js +313 -0
- package/dist/skills/docker/SKILL.md +76 -0
- package/dist/skills/docker-expert/SKILL.md +56 -0
- package/dist/skills/enterprise-systems-analyst/SKILL.md +83 -0
- package/dist/skills/enterprise-systems-analyst/references/crm.md +41 -0
- package/dist/skills/enterprise-systems-analyst/references/erp.md +40 -0
- package/dist/skills/enterprise-systems-analyst/references/financial-systems.md +35 -0
- package/dist/skills/enterprise-systems-analyst/references/hcm.md +38 -0
- package/dist/skills/enterprise-systems-analyst/references/mrp.md +37 -0
- package/dist/skills/enterprise-systems-analyst/references/scm.md +32 -0
- package/dist/skills/ethical-hacking-methodology/SKILL.md +119 -0
- package/dist/skills/externalSkillLoader.d.ts +25 -0
- package/dist/skills/externalSkillLoader.js +65 -0
- package/dist/skills/externalSkillRegistry.d.ts +33 -0
- package/dist/skills/externalSkillRegistry.js +94 -0
- package/dist/skills/filesystem-management/SKILL.md +61 -0
- package/dist/skills/first-run-seed.d.ts +26 -0
- package/dist/skills/first-run-seed.js +75 -0
- package/dist/skills/git-vcs/SKILL.md +84 -0
- package/dist/skills/kafka/SKILL.md +89 -0
- package/dist/skills/kubernetes/SKILL.md +93 -0
- package/dist/skills/kubernetes-expert/SKILL.md +54 -0
- package/dist/skills/openshift/SKILL.md +93 -0
- package/dist/skills/pentester/SKILL.md +59 -0
- package/dist/skills/performance-tester/SKILL.md +57 -0
- package/dist/skills/playwright-ui-tester/SKILL.md +67 -0
- package/dist/skills/programmer/SKILL.md +58 -0
- package/dist/skills/project-scaffolding/SKILL.md +133 -0
- package/dist/skills/qa-engineer/SKILL.md +91 -0
- package/dist/skills/rca/SKILL.md +58 -0
- package/dist/skills/redhat/SKILL.md +92 -0
- package/dist/skills/rosa/SKILL.md +80 -0
- package/dist/skills/scrum-framework/SKILL.md +74 -0
- package/dist/skills/scrum-framework/references/artifacts_and_quality.md +79 -0
- package/dist/skills/scrum-framework/references/roles_and_events.md +105 -0
- package/dist/skills/scrum-master-agent/SKILL.md +74 -0
- package/dist/skills/scrum-master-agent/references/behaviors.md +56 -0
- package/dist/skills/sdlc-skill.d.ts +1 -0
- package/dist/skills/sdlc-skill.js +4 -0
- package/dist/skills/secops/SKILL.md +52 -0
- package/dist/skills/secure-architect.bylaws.d.ts +68 -0
- package/dist/skills/secure-architect.bylaws.js +525 -0
- package/dist/skills/seed-skills.d.ts +48 -0
- package/dist/skills/seed-skills.js +213 -0
- package/dist/skills/skill-authoring/SKILL.md +123 -0
- package/dist/skills/skill-header.d.ts +51 -0
- package/dist/skills/skill-header.js +163 -0
- package/dist/skills/skill-path-guard.d.ts +41 -0
- package/dist/skills/skill-path-guard.js +95 -0
- package/dist/skills/skillRouter.d.ts +51 -0
- package/dist/skills/skillRouter.js +90 -0
- package/dist/skills/skills-root.d.ts +64 -0
- package/dist/skills/skills-root.js +168 -0
- package/dist/skills/software-architect/SKILL.md +77 -0
- package/dist/skills/software-engineer/SKILL.md +74 -0
- package/dist/skills/solid-principles/SKILL.md +94 -0
- package/dist/skills/task-planning/SKILL.md +115 -0
- package/dist/skills/tester/SKILL.md +54 -0
- package/dist/skills/ubuntu/SKILL.md +87 -0
- package/dist/skills/ui-ux-design/SKILL.md +114 -0
- package/dist/skills/workspace-context/SKILL.md +103 -0
- package/dist/sprint/controller.d.ts +37 -0
- package/dist/sprint/controller.js +220 -0
- package/dist/sprint/dag-builder.d.ts +14 -0
- package/dist/sprint/dag-builder.js +105 -0
- package/dist/sprint/reporter.d.ts +11 -0
- package/dist/sprint/reporter.js +97 -0
- package/dist/sprint/state-store.d.ts +10 -0
- package/dist/sprint/state-store.js +71 -0
- package/dist/sprint/types.d.ts +24 -0
- package/dist/sprint/types.js +4 -0
- package/dist/store/file-version-store.d.ts +24 -0
- package/dist/store/file-version-store.js +73 -0
- package/dist/store/task-store.d.ts +90 -0
- package/dist/store/task-store.js +166 -0
- package/dist/task-ingest/architect-detailer.d.ts +43 -0
- package/dist/task-ingest/architect-detailer.js +141 -0
- package/dist/task-ingest/detail-schema.d.ts +9 -0
- package/dist/task-ingest/detail-schema.js +195 -0
- package/dist/task-ingest/detailed-run.d.ts +36 -0
- package/dist/task-ingest/detailed-run.js +108 -0
- package/dist/task-ingest/extract-id.d.ts +9 -0
- package/dist/task-ingest/extract-id.js +24 -0
- package/dist/task-ingest/index.d.ts +23 -0
- package/dist/task-ingest/index.js +14 -0
- package/dist/task-ingest/ingest.d.ts +45 -0
- package/dist/task-ingest/ingest.js +163 -0
- package/dist/task-ingest/list-ingested.d.ts +13 -0
- package/dist/task-ingest/list-ingested.js +30 -0
- package/dist/task-ingest/pending-filter.d.ts +30 -0
- package/dist/task-ingest/pending-filter.js +59 -0
- package/dist/task-ingest/scanner.d.ts +56 -0
- package/dist/task-ingest/scanner.js +216 -0
- package/dist/task-ingest/source-reader.d.ts +25 -0
- package/dist/task-ingest/source-reader.js +93 -0
- package/dist/task-ingest/spec-builder.d.ts +34 -0
- package/dist/task-ingest/spec-builder.js +89 -0
- package/dist/task-ingest/wbs-extract.d.ts +50 -0
- package/dist/task-ingest/wbs-extract.js +226 -0
- package/dist/task-ingest/wbs-parser.d.ts +36 -0
- package/dist/task-ingest/wbs-parser.js +170 -0
- package/dist/tools/apiTestTool.d.ts +37 -0
- package/dist/tools/apiTestTool.js +128 -0
- package/dist/tools/ast-tools.d.ts +183 -0
- package/dist/tools/ast-tools.js +853 -0
- package/dist/tools/browse-tool.d.ts +105 -0
- package/dist/tools/browse-tool.js +394 -0
- package/dist/tools/credential.d.ts +17 -0
- package/dist/tools/credential.js +32 -0
- package/dist/tools/dependency-graph.d.ts +23 -0
- package/dist/tools/dependency-graph.js +164 -0
- package/dist/tools/edit-tool.d.ts +34 -0
- package/dist/tools/edit-tool.js +95 -0
- package/dist/tools/file-header-manager.d.ts +27 -0
- package/dist/tools/file-header-manager.js +153 -0
- package/dist/tools/fs-tools.d.ts +154 -0
- package/dist/tools/fs-tools.js +337 -0
- package/dist/tools/git-tools.d.ts +79 -0
- package/dist/tools/git-tools.js +348 -0
- package/dist/tools/github-tool.d.ts +48 -0
- package/dist/tools/github-tool.js +147 -0
- package/dist/tools/globTool.d.ts +20 -0
- package/dist/tools/globTool.js +34 -0
- package/dist/tools/grepTool.d.ts +19 -0
- package/dist/tools/grepTool.js +44 -0
- package/dist/tools/index-freshness.d.ts +58 -0
- package/dist/tools/index-freshness.js +196 -0
- package/dist/tools/index-glob.d.ts +48 -0
- package/dist/tools/index-glob.js +175 -0
- package/dist/tools/load-skill-tool.d.ts +15 -0
- package/dist/tools/load-skill-tool.js +114 -0
- package/dist/tools/patch-tools.d.ts +58 -0
- package/dist/tools/patch-tools.js +153 -0
- package/dist/tools/playwright-tool.d.ts +66 -0
- package/dist/tools/playwright-tool.js +121 -0
- package/dist/tools/project-detect.d.ts +20 -0
- package/dist/tools/project-detect.js +87 -0
- package/dist/tools/prompt-guidance.d.ts +22 -0
- package/dist/tools/prompt-guidance.js +23 -0
- package/dist/tools/schedule-audit.d.ts +50 -0
- package/dist/tools/schedule-audit.js +124 -0
- package/dist/tools/schedule-validation.d.ts +67 -0
- package/dist/tools/schedule-validation.js +210 -0
- package/dist/tools/scheduleTool.d.ts +62 -0
- package/dist/tools/scheduleTool.js +313 -0
- package/dist/tools/search-tools.d.ts +27 -0
- package/dist/tools/search-tools.js +78 -0
- package/dist/tools/sed-tool.d.ts +66 -0
- package/dist/tools/sed-tool.js +402 -0
- package/dist/tools/shell-result.d.ts +11 -0
- package/dist/tools/shell-result.js +1 -0
- package/dist/tools/shell-tool.d.ts +45 -0
- package/dist/tools/shell-tool.js +141 -0
- package/dist/tools/siteCrawlerTool.d.ts +32 -0
- package/dist/tools/siteCrawlerTool.js +205 -0
- package/dist/tools/tool-registry.d.ts +67 -0
- package/dist/tools/tool-registry.js +606 -0
- package/dist/tools/validate-tool.d.ts +23 -0
- package/dist/tools/validate-tool.js +201 -0
- package/dist/tools/workspace-index.d.ts +46 -0
- package/dist/tools/workspace-index.js +173 -0
- package/dist/types.d.ts +222 -0
- package/dist/types.js +7 -0
- package/dist/updater/index.d.ts +14 -0
- package/dist/updater/index.js +120 -0
- package/dist/util/banner.d.ts +25 -0
- package/dist/util/banner.js +140 -0
- package/dist/util/command-suggester.d.ts +6 -0
- package/dist/util/command-suggester.js +25 -0
- package/dist/util/confirm-interrupt.d.ts +10 -0
- package/dist/util/confirm-interrupt.js +31 -0
- package/dist/util/continue-trigger.d.ts +11 -0
- package/dist/util/continue-trigger.js +20 -0
- package/dist/util/env-info.d.ts +18 -0
- package/dist/util/env-info.js +37 -0
- package/dist/util/file-access-log.d.ts +35 -0
- package/dist/util/file-access-log.js +140 -0
- package/dist/util/footer-manager.d.ts +124 -0
- package/dist/util/footer-manager.js +195 -0
- package/dist/util/footer-renderer.d.ts +67 -0
- package/dist/util/footer-renderer.js +319 -0
- package/dist/util/footer-state.d.ts +34 -0
- package/dist/util/footer-state.js +18 -0
- package/dist/util/footer-text.d.ts +51 -0
- package/dist/util/footer-text.js +74 -0
- package/dist/util/ids.d.ts +1 -0
- package/dist/util/ids.js +4 -0
- package/dist/util/levenshtein.d.ts +6 -0
- package/dist/util/levenshtein.js +34 -0
- package/dist/util/logger.d.ts +10 -0
- package/dist/util/logger.js +41 -0
- package/dist/util/logs.d.ts +80 -0
- package/dist/util/logs.js +135 -0
- package/dist/util/output-handler.d.ts +89 -0
- package/dist/util/output-handler.js +193 -0
- package/dist/util/output-interceptor.d.ts +18 -0
- package/dist/util/output-interceptor.js +49 -0
- package/dist/util/output-paths.d.ts +43 -0
- package/dist/util/output-paths.js +121 -0
- package/dist/util/package-json.d.ts +6 -0
- package/dist/util/package-json.js +36 -0
- package/dist/util/process-kill.d.ts +27 -0
- package/dist/util/process-kill.js +148 -0
- package/dist/util/protocol-error-logger.d.ts +33 -0
- package/dist/util/protocol-error-logger.js +73 -0
- package/dist/util/redact.d.ts +25 -0
- package/dist/util/redact.js +119 -0
- package/dist/util/scroll-region-guard.d.ts +33 -0
- package/dist/util/scroll-region-guard.js +63 -0
- package/dist/util/spinner.d.ts +15 -0
- package/dist/util/spinner.js +49 -0
- package/dist/util/terminal-output.d.ts +34 -0
- package/dist/util/terminal-output.js +1 -0
- package/dist/util/terminal-silent.d.ts +6 -0
- package/dist/util/terminal-silent.js +20 -0
- package/dist/util/terminal.d.ts +56 -0
- package/dist/util/terminal.js +124 -0
- package/dist/util/text-sanitize.d.ts +8 -0
- package/dist/util/text-sanitize.js +45 -0
- package/dist/util/thinking-spinner.d.ts +27 -0
- package/dist/util/thinking-spinner.js +189 -0
- package/dist/util/tool-error-logger.d.ts +33 -0
- package/dist/util/tool-error-logger.js +77 -0
- package/dist/util/tty.d.ts +13 -0
- package/dist/util/tty.js +16 -0
- package/dist/util/xcoder-paths.d.ts +56 -0
- package/dist/util/xcoder-paths.js +63 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +5 -0
- package/dist/worker-agent/to-subtask-node.d.ts +35 -0
- package/dist/worker-agent/to-subtask-node.js +41 -0
- package/dist/worker-agent/worker-orchestrator.d.ts +104 -0
- package/dist/worker-agent/worker-orchestrator.js +201 -0
- package/package.json +43 -3
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// xcoder:version 1 | xcoder:task task-0d242c | xcoder:updated 2026-11-19T13:06:09.224Z | xcoder:subtask code-st-8d2337
|
|
2
|
+
// xcoder:subtask code-st-8d2337
|
|
3
|
+
/**
|
|
4
|
+
* `runSdlcTask` — the in-process entry point for embedding the SDLC
|
|
5
|
+
* orchestrator (design C1/D2).
|
|
6
|
+
*
|
|
7
|
+
* Why this exists: other packages used to shell out to the `xcoder` CLI and
|
|
8
|
+
* interpret its exit codes (0 done, 1 error, 2 escalated, 3 halted, 4 license).
|
|
9
|
+
* That is a process-boundary contract that cannot express *why* something
|
|
10
|
+
* stopped, and it costs a Node process, two global installs and a PATH entry.
|
|
11
|
+
* This facade turns the same CLI construction into a typed call so a host can
|
|
12
|
+
* depend on xcoder-dna directly and switch on a status union instead.
|
|
13
|
+
*
|
|
14
|
+
* Contract, deliberately narrow and total:
|
|
15
|
+
*
|
|
16
|
+
* - NEVER throws. Every failure comes back as `{ status: "error", error }`.
|
|
17
|
+
* A failed subtask is data, not an exception, at this boundary.
|
|
18
|
+
* - Builds the TaskSpec through `buildTaskSpec`, the same function the CLI
|
|
19
|
+
* uses, so task ids, stage routing and intake rules cannot drift.
|
|
20
|
+
* - Projects a small result rather than returning `TaskRun`: hosts must not
|
|
21
|
+
* start depending on `orchestratorTrace`, which is the orchestrator's
|
|
22
|
+
* self-report. Side-effect truth stays with the caller's own diff.
|
|
23
|
+
* - Reports abort honestly. The engine only checks its signal *between
|
|
24
|
+
* rounds* (see `execution-loop.ts`), so a long LLM call or `run_command` can
|
|
25
|
+
* overrun a deadline. `abortObservedAt` says which actually happened —
|
|
26
|
+
* `not-observed` means the run finished anyway and may still be doing work.
|
|
27
|
+
*/
|
|
28
|
+
import { assertXcoderEnvIntact, installCwdEnvKillSwitch } from "../config/env-guard.js";
|
|
29
|
+
import { isLicensedFeature, requireLicense } from "../license/gate.js";
|
|
30
|
+
import { createLlmClient } from "../llm/factory.js";
|
|
31
|
+
import { buildTaskSpec } from "../orchestrator/task-factory.js";
|
|
32
|
+
import { redact } from "../tools/credential.js";
|
|
33
|
+
import { SdlcOrchestrator } from "./sdlc-orchestrator.js";
|
|
34
|
+
/** Default swarm size, matching `xcoder run --concurrency` (sdlc-cli.ts). */
|
|
35
|
+
export const DEFAULT_CONCURRENCY = 3;
|
|
36
|
+
/** Default healing attempts, matching `xcoder run --max-healing`. */
|
|
37
|
+
export const DEFAULT_MAX_HEALING = 2;
|
|
38
|
+
/** Env var names whose values must never reach a log, a result or a prompt. */
|
|
39
|
+
const SECRET_REFS = [
|
|
40
|
+
"XCODER_API_KEY",
|
|
41
|
+
"XCODER_ANTHROPIC_KEY",
|
|
42
|
+
"XCODER_OPENAI_KEY",
|
|
43
|
+
"XCODER_DEEPSEEK_KEY",
|
|
44
|
+
"XCODER_LICENSE_KEY",
|
|
45
|
+
"ANTHROPIC_API_KEY",
|
|
46
|
+
"OPENAI_API_KEY",
|
|
47
|
+
];
|
|
48
|
+
/** Apply every known secret ref to a string bound for a sink. */
|
|
49
|
+
export function scrub(text) {
|
|
50
|
+
let out = text;
|
|
51
|
+
for (const ref of SECRET_REFS)
|
|
52
|
+
out = redact(out, ref);
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
function emptyResult(code, message, extra = {}) {
|
|
56
|
+
return {
|
|
57
|
+
status: "error",
|
|
58
|
+
taskId: extra.taskId ?? "",
|
|
59
|
+
dag: extra.dag ?? [],
|
|
60
|
+
doneCount: extra.doneCount ?? 0,
|
|
61
|
+
totalCount: extra.totalCount ?? 0,
|
|
62
|
+
tokenUsage: extra.tokenUsage ?? { inputTokens: 0, outputTokens: 0 },
|
|
63
|
+
...(extra.abortObservedAt ? { abortObservedAt: extra.abortObservedAt } : {}),
|
|
64
|
+
error: { code, message: scrub(message) },
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** Drop the event loop so a pending deadline cannot keep the host process alive. */
|
|
68
|
+
function unref(timer) {
|
|
69
|
+
const t = timer;
|
|
70
|
+
if (typeof t.unref === "function")
|
|
71
|
+
t.unref();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Run one SDLC task in-process and return a projected, self-contained result.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* const r = await runSdlcTask({ workspaceRoot: cwd, task: "add a slug field", quiet: true });
|
|
78
|
+
* if (r.status === "completed") { ... }
|
|
79
|
+
*/
|
|
80
|
+
export async function runSdlcTask(options) {
|
|
81
|
+
const o = { quiet: true, ...options };
|
|
82
|
+
// Layer 1 of the secret boundary: keep a workspace `.env` out of the LLM
|
|
83
|
+
// config, and refuse to run on an environment rewritten since startup.
|
|
84
|
+
installCwdEnvKillSwitch();
|
|
85
|
+
try {
|
|
86
|
+
assertXcoderEnvIntact();
|
|
87
|
+
}
|
|
88
|
+
catch (e) {
|
|
89
|
+
const err = e;
|
|
90
|
+
return emptyResult(err.code ?? "env_tampered", err.message ?? "environment was modified after startup");
|
|
91
|
+
}
|
|
92
|
+
// Dormant-but-wired licence gate. Gating is currently disabled inside
|
|
93
|
+
// sdlc-cli.ts (checkLicense returns true with a TODO), so enforcing it here
|
|
94
|
+
// by default would change behaviour for every existing user. With
|
|
95
|
+
// XCODER_ENFORCE_LICENSE=1 a denial no longer blocks — it degrades the run to
|
|
96
|
+
// `license_warning`, which is exactly what exit code 4 meant: "the run may
|
|
97
|
+
// still have happened".
|
|
98
|
+
let licenseBlocked = false;
|
|
99
|
+
if (process.env.XCODER_ENFORCE_LICENSE === "1" && isLicensedFeature("run")) {
|
|
100
|
+
try {
|
|
101
|
+
licenseBlocked = !requireLicense().allowed;
|
|
102
|
+
}
|
|
103
|
+
catch {
|
|
104
|
+
licenseBlocked = true;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const controller = new AbortController();
|
|
108
|
+
let deadlineFired = false;
|
|
109
|
+
const caller = o.signal;
|
|
110
|
+
const preAborted = caller?.aborted === true;
|
|
111
|
+
const onCallerAbort = () => controller.abort();
|
|
112
|
+
if (preAborted) {
|
|
113
|
+
controller.abort();
|
|
114
|
+
}
|
|
115
|
+
else if (caller) {
|
|
116
|
+
caller.addEventListener("abort", onCallerAbort, { once: true });
|
|
117
|
+
}
|
|
118
|
+
let timer;
|
|
119
|
+
if (typeof o.deadlineMs === "number" && o.deadlineMs > 0) {
|
|
120
|
+
timer = setTimeout(() => {
|
|
121
|
+
deadlineFired = true;
|
|
122
|
+
controller.abort();
|
|
123
|
+
}, o.deadlineMs);
|
|
124
|
+
unref(timer);
|
|
125
|
+
}
|
|
126
|
+
/** Map (abort requested?, did the run finish normally?) to an honest observation. */
|
|
127
|
+
const observe = (finishedNormally) => {
|
|
128
|
+
if (!controller.signal.aborted)
|
|
129
|
+
return undefined;
|
|
130
|
+
if (preAborted)
|
|
131
|
+
return "before-run";
|
|
132
|
+
if (finishedNormally)
|
|
133
|
+
return "not-observed";
|
|
134
|
+
return deadlineFired ? "deadline" : "round-boundary";
|
|
135
|
+
};
|
|
136
|
+
const cleanup = () => {
|
|
137
|
+
if (timer !== undefined)
|
|
138
|
+
clearTimeout(timer);
|
|
139
|
+
caller?.removeEventListener("abort", onCallerAbort);
|
|
140
|
+
};
|
|
141
|
+
try {
|
|
142
|
+
const spec = buildTaskSpec(o.task, o.inputs ?? {}, {
|
|
143
|
+
maxHealingAttempts: DEFAULT_MAX_HEALING,
|
|
144
|
+
concurrency: o.concurrency ?? DEFAULT_CONCURRENCY,
|
|
145
|
+
});
|
|
146
|
+
const llm = createLlmClient("orchestrator", o.model ? { model: o.model } : {});
|
|
147
|
+
const orchestrator = new SdlcOrchestrator({
|
|
148
|
+
workspaceRoot: o.workspaceRoot,
|
|
149
|
+
llm,
|
|
150
|
+
concurrency: o.concurrency ?? DEFAULT_CONCURRENCY,
|
|
151
|
+
maxRounds: o.maxRounds,
|
|
152
|
+
lessonLearned: o.lessonLearned,
|
|
153
|
+
quiet: o.quiet,
|
|
154
|
+
signal: controller.signal,
|
|
155
|
+
reindex: o.reindex,
|
|
156
|
+
});
|
|
157
|
+
const run = await orchestrator.run(spec);
|
|
158
|
+
const dag = run.dag.map((n) => ({
|
|
159
|
+
id: n.id,
|
|
160
|
+
stage: String(n.stage),
|
|
161
|
+
role: String(n.role),
|
|
162
|
+
status: String(n.status),
|
|
163
|
+
goal: scrub(n.goal),
|
|
164
|
+
}));
|
|
165
|
+
const doneCount = dag.filter((n) => n.status === "done").length;
|
|
166
|
+
const totalCount = dag.length;
|
|
167
|
+
const base = {
|
|
168
|
+
taskId: spec.taskId,
|
|
169
|
+
dag,
|
|
170
|
+
doneCount,
|
|
171
|
+
totalCount,
|
|
172
|
+
tokenUsage: run.totalTokenUsage,
|
|
173
|
+
};
|
|
174
|
+
// A returned run must be terminal. planning/running here means the facade
|
|
175
|
+
// contract was violated — report it rather than claim success.
|
|
176
|
+
if (run.status === "planning" || run.status === "running") {
|
|
177
|
+
return emptyResult("non_terminal_run", `orchestrator returned a ${run.status} run; expected a terminal status`, { ...base, abortObservedAt: observe(false) });
|
|
178
|
+
}
|
|
179
|
+
const abortObservedAt = observe(run.status === "done");
|
|
180
|
+
let status;
|
|
181
|
+
if (run.status === "done")
|
|
182
|
+
status = "completed";
|
|
183
|
+
else if (run.status === "escalated")
|
|
184
|
+
status = "escalated";
|
|
185
|
+
else if (abortObservedAt && abortObservedAt !== "not-observed")
|
|
186
|
+
status = "aborted";
|
|
187
|
+
else
|
|
188
|
+
status = "halted";
|
|
189
|
+
if (licenseBlocked && status === "completed")
|
|
190
|
+
status = "license_warning";
|
|
191
|
+
return {
|
|
192
|
+
status,
|
|
193
|
+
...base,
|
|
194
|
+
...(run.finalDeliverable === undefined ? {} : { finalDeliverable: scrub(run.finalDeliverable) }),
|
|
195
|
+
...(abortObservedAt ? { abortObservedAt } : {}),
|
|
196
|
+
...(licenseBlocked ? { licenseBlocked: true } : {}),
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
catch (e) {
|
|
200
|
+
const err = e;
|
|
201
|
+
const message = err?.message ?? String(e);
|
|
202
|
+
// createLlmClient throws when no provider is configured — a configuration
|
|
203
|
+
// problem, not an orchestrator failure, so name it explicitly.
|
|
204
|
+
const code = err?.code ?? (/provider|api.?key|model/i.test(message) ? "llm_unconfigured" : "run_failed");
|
|
205
|
+
return emptyResult(code, message, { abortObservedAt: observe(false) });
|
|
206
|
+
}
|
|
207
|
+
finally {
|
|
208
|
+
cleanup();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { SubtaskNode, TaskRun, TaskSpec } from "../types.js";
|
|
2
|
+
import type { InterruptAction } from "../orchestrator/interrupt-handler.js";
|
|
3
|
+
import { LlmClient } from "../llm/client.js";
|
|
4
|
+
import { InteractiveSteeringManager } from "../orchestrator/interactive-steering.js";
|
|
5
|
+
export { dagSnapshot, recomputeReady, inlineIntoDependents } from "./dag-utils.js";
|
|
6
|
+
export { summarize, buildExhaustionTrace } from "./reporting.js";
|
|
7
|
+
export interface OrchestratorOptions {
|
|
8
|
+
workspaceRoot: string;
|
|
9
|
+
/** Orchestrator role client — used by the coordinator/conversation loops. */
|
|
10
|
+
llm: LlmClient;
|
|
11
|
+
/** Swarm/Sub Agent role client — used by dispatchSwarm workers. Defaults to `llm`. */
|
|
12
|
+
subAgentLlm?: LlmClient;
|
|
13
|
+
/** Explicit per-role clients — highest priority when all are provided. */
|
|
14
|
+
roleLlm?: Partial<Record<import("../config/loadConfig.js").AgentRole, LlmClient>>;
|
|
15
|
+
concurrency: number;
|
|
16
|
+
maxRounds?: number;
|
|
17
|
+
lessonLearned?: boolean;
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
quiet?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Force a full index rebuild before the run instead of probing it first.
|
|
22
|
+
* Backs the `--reindex` flag; freshness is otherwise automatic, so this is
|
|
23
|
+
* an override rather than the only route to an up-to-date index.
|
|
24
|
+
*/
|
|
25
|
+
reindex?: boolean;
|
|
26
|
+
}
|
|
27
|
+
export declare class SdlcOrchestrator {
|
|
28
|
+
private opts;
|
|
29
|
+
private protocolMap;
|
|
30
|
+
private masterProtocolSection;
|
|
31
|
+
private lessonContext;
|
|
32
|
+
private _abortController;
|
|
33
|
+
private _steering;
|
|
34
|
+
private _currentRun;
|
|
35
|
+
private _haltDeferred;
|
|
36
|
+
private _index?;
|
|
37
|
+
constructor(opts: OrchestratorOptions);
|
|
38
|
+
/**
|
|
39
|
+
* Gate the workspace index once per task run.
|
|
40
|
+
*
|
|
41
|
+
* Every ingress path needs this: the index is the source of truth for which
|
|
42
|
+
* files exist, and it used to be reused no matter how stale it was. The gate
|
|
43
|
+
* is stat-only while the index is still accurate, so the price of
|
|
44
|
+
* correctness here is one filesystem walk, not a full re-hash.
|
|
45
|
+
*
|
|
46
|
+
* It never throws. A cache refresh failure degrades to the best index
|
|
47
|
+
* available rather than aborting the run — the authorization boundary is
|
|
48
|
+
* `resolveInWorkspace()`, which is untouched and still fails closed.
|
|
49
|
+
*/
|
|
50
|
+
private gateIndex;
|
|
51
|
+
/** The index gated for the current run, if a run has started. */
|
|
52
|
+
get index(): import("../tools/workspace-index.js").WorkspaceIndex | undefined;
|
|
53
|
+
get currentRun(): TaskRun | null;
|
|
54
|
+
get steering(): InteractiveSteeringManager;
|
|
55
|
+
run(spec: TaskSpec, customDag?: SubtaskNode[]): Promise<TaskRun>;
|
|
56
|
+
resume(taskId: string): Promise<TaskRun>;
|
|
57
|
+
halt(currentRun: TaskRun): Promise<InterruptAction["summary"]>;
|
|
58
|
+
private _runLoop;
|
|
59
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { ensureFreshIndex } from "../tools/index-freshness.js";
|
|
2
|
+
import { logIndexRefresh } from "../util/file-access-log.js";
|
|
3
|
+
import { saveTaskRunSync } from "../store/task-store.js";
|
|
4
|
+
import { FooterManager } from "../util/footer-manager.js";
|
|
5
|
+
import { isInteractiveStdout } from "../util/tty.js";
|
|
6
|
+
import { InteractiveSteeringManager } from "../orchestrator/interactive-steering.js";
|
|
7
|
+
// Helper modules
|
|
8
|
+
import { loadProtocol } from "./protocol-loader.js";
|
|
9
|
+
import { initializeRun, resumeRun } from "./plan-initializer.js";
|
|
10
|
+
import { runConversation } from "./conversation-runner.js";
|
|
11
|
+
import { executeLoop } from "./execution-loop.js";
|
|
12
|
+
import { saveProgress } from "./progress-persister.js";
|
|
13
|
+
import { haltInternal, checkSteeringInjection } from "./steering-handler.js";
|
|
14
|
+
// Re-exported for consumer compatibility
|
|
15
|
+
export { dagSnapshot, recomputeReady, inlineIntoDependents } from "./dag-utils.js";
|
|
16
|
+
export { summarize, buildExhaustionTrace } from "./reporting.js";
|
|
17
|
+
export class SdlcOrchestrator {
|
|
18
|
+
opts;
|
|
19
|
+
protocolMap = {};
|
|
20
|
+
masterProtocolSection = undefined;
|
|
21
|
+
lessonContext = undefined;
|
|
22
|
+
_abortController = null;
|
|
23
|
+
_steering = new InteractiveSteeringManager();
|
|
24
|
+
_currentRun = null;
|
|
25
|
+
_haltDeferred = null;
|
|
26
|
+
_index;
|
|
27
|
+
constructor(opts) {
|
|
28
|
+
this.opts = opts;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gate the workspace index once per task run.
|
|
32
|
+
*
|
|
33
|
+
* Every ingress path needs this: the index is the source of truth for which
|
|
34
|
+
* files exist, and it used to be reused no matter how stale it was. The gate
|
|
35
|
+
* is stat-only while the index is still accurate, so the price of
|
|
36
|
+
* correctness here is one filesystem walk, not a full re-hash.
|
|
37
|
+
*
|
|
38
|
+
* It never throws. A cache refresh failure degrades to the best index
|
|
39
|
+
* available rather than aborting the run — the authorization boundary is
|
|
40
|
+
* `resolveInWorkspace()`, which is untouched and still fails closed.
|
|
41
|
+
*/
|
|
42
|
+
async gateIndex(taskId) {
|
|
43
|
+
const result = await ensureFreshIndex(this.opts.workspaceRoot, {
|
|
44
|
+
force: this.opts.reindex === true,
|
|
45
|
+
});
|
|
46
|
+
this._index = result.index;
|
|
47
|
+
if (!this.opts.quiet) {
|
|
48
|
+
try {
|
|
49
|
+
await logIndexRefresh(this.opts.workspaceRoot, result, {
|
|
50
|
+
taskId: taskId ?? "session",
|
|
51
|
+
subtaskId: "-",
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
// observability must never break a run
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** The index gated for the current run, if a run has started. */
|
|
60
|
+
get index() {
|
|
61
|
+
return this._index;
|
|
62
|
+
}
|
|
63
|
+
get currentRun() {
|
|
64
|
+
return this._currentRun;
|
|
65
|
+
}
|
|
66
|
+
get steering() {
|
|
67
|
+
return this._steering;
|
|
68
|
+
}
|
|
69
|
+
// ── run ──────────────────────────────────────────────────────────
|
|
70
|
+
async run(spec, customDag) {
|
|
71
|
+
await this.gateIndex();
|
|
72
|
+
// Load protocol.
|
|
73
|
+
const { protocolMap, masterProtocolSection } = await loadProtocol(this.opts.workspaceRoot);
|
|
74
|
+
this.protocolMap = protocolMap;
|
|
75
|
+
this.masterProtocolSection = masterProtocolSection;
|
|
76
|
+
const init = await initializeRun(spec, this.opts, protocolMap, masterProtocolSection, customDag);
|
|
77
|
+
this.lessonContext = init.lessonContext;
|
|
78
|
+
if (init.isConversation) {
|
|
79
|
+
return runConversation(spec, this.opts, protocolMap, masterProtocolSection);
|
|
80
|
+
}
|
|
81
|
+
const run = init.run;
|
|
82
|
+
await saveProgress(this.opts.workspaceRoot, run);
|
|
83
|
+
return this._runLoop(run);
|
|
84
|
+
}
|
|
85
|
+
// ── resume ───────────────────────────────────────────────────────
|
|
86
|
+
async resume(taskId) {
|
|
87
|
+
await this.gateIndex();
|
|
88
|
+
const { protocolMap, masterProtocolSection } = await loadProtocol(this.opts.workspaceRoot);
|
|
89
|
+
this.protocolMap = protocolMap;
|
|
90
|
+
this.masterProtocolSection = masterProtocolSection;
|
|
91
|
+
const init = await resumeRun(taskId, this.opts, protocolMap, masterProtocolSection);
|
|
92
|
+
if (init.run.status === "done")
|
|
93
|
+
return init.run;
|
|
94
|
+
const run = init.run;
|
|
95
|
+
await saveProgress(this.opts.workspaceRoot, run);
|
|
96
|
+
return this._runLoop(run);
|
|
97
|
+
}
|
|
98
|
+
// ── halt ─────────────────────────────────────────────────────────
|
|
99
|
+
async halt(currentRun) {
|
|
100
|
+
if (!this._abortController) {
|
|
101
|
+
this._abortController = new AbortController();
|
|
102
|
+
}
|
|
103
|
+
this._abortController.abort();
|
|
104
|
+
if (this._currentRun) {
|
|
105
|
+
return new Promise((resolve, reject) => {
|
|
106
|
+
this._haltDeferred = { resolve, reject };
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
// Not running — compute halt inline.
|
|
110
|
+
const summary = await haltInternal(currentRun, this.opts, saveTaskRunSync);
|
|
111
|
+
return summary;
|
|
112
|
+
}
|
|
113
|
+
// ── Private: wraps executeLoop with halt/abort lifecycle ────────
|
|
114
|
+
async _runLoop(run) {
|
|
115
|
+
this._currentRun = run;
|
|
116
|
+
this._abortController = new AbortController();
|
|
117
|
+
const signal = this.opts.signal ?? this._abortController.signal;
|
|
118
|
+
// Wire up the orchestration context with callbacks.
|
|
119
|
+
const ctx = {
|
|
120
|
+
opts: this.opts,
|
|
121
|
+
protocolMap: this.protocolMap,
|
|
122
|
+
masterProtocolSection: this.masterProtocolSection,
|
|
123
|
+
lessonContext: this.lessonContext,
|
|
124
|
+
signal,
|
|
125
|
+
steering: this._steering,
|
|
126
|
+
quiet: this.opts.quiet ?? false,
|
|
127
|
+
onSteeringInjection: async (r) => {
|
|
128
|
+
return checkSteeringInjection(r, this.opts, this._steering);
|
|
129
|
+
},
|
|
130
|
+
onSaveProgress: async (r) => {
|
|
131
|
+
await saveProgress(this.opts.workspaceRoot, r);
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
try {
|
|
135
|
+
// Initialize footer iff the interactive gate passes.
|
|
136
|
+
// Availability matrix (single source of truth in src/util/tty.ts):
|
|
137
|
+
// TTY attached AND NO_COLOR unset. Quiet run mode mutes painting.
|
|
138
|
+
FooterManager.init({
|
|
139
|
+
tty: isInteractiveStdout(),
|
|
140
|
+
// Raw goal — the renderer owns the ≤50-char title field (footer-text.ts).
|
|
141
|
+
taskTitle: run.spec.goal,
|
|
142
|
+
quiet: this.opts.quiet ?? false,
|
|
143
|
+
});
|
|
144
|
+
const result = await executeLoop(run, ctx);
|
|
145
|
+
// Cleanup.
|
|
146
|
+
this._currentRun = null;
|
|
147
|
+
this._abortController = null;
|
|
148
|
+
// If halt() was called but the task finished before the abort check,
|
|
149
|
+
// still provide a summary.
|
|
150
|
+
if (this._haltDeferred) {
|
|
151
|
+
const dag = result.dag;
|
|
152
|
+
const summary = {
|
|
153
|
+
taskId: result.spec.taskId,
|
|
154
|
+
doneCount: dag.filter((n) => n.status === "done").length,
|
|
155
|
+
totalCount: dag.length,
|
|
156
|
+
resumeCommand: `xcoder resume ${result.spec.taskId}`,
|
|
157
|
+
taskFilePath: `.xcoder/tasks/${result.spec.taskId}.json`,
|
|
158
|
+
};
|
|
159
|
+
this._haltDeferred.resolve(summary);
|
|
160
|
+
this._haltDeferred = null;
|
|
161
|
+
}
|
|
162
|
+
return result;
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
this._currentRun = null;
|
|
166
|
+
this._abortController = null;
|
|
167
|
+
throw e;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { Role, SdlcStage, TaskInputs } from "../types.js";
|
|
2
|
+
export declare const SDLC_STAGES: {
|
|
3
|
+
stage: SdlcStage;
|
|
4
|
+
description: string;
|
|
5
|
+
}[];
|
|
6
|
+
export declare const STAGE_ROLE: Record<SdlcStage, Role>;
|
|
7
|
+
/**
|
|
8
|
+
* Internal roles that exist for traceability and system functions but are
|
|
9
|
+
* not mapped to any DAG stage — they are invoked inline by the orchestrator
|
|
10
|
+
* rather than dispatched as standalone Sub Agents.
|
|
11
|
+
*/
|
|
12
|
+
export declare const INTERNAL_ROLES: Role[];
|
|
13
|
+
/**
|
|
14
|
+
* Explicit intake classification. This exists specifically because "the
|
|
15
|
+
* orchestrator infers where to start" was a hidden judgment call in the
|
|
16
|
+
* original sketch — inconsistent behavior waiting to happen. Every rule
|
|
17
|
+
* here is a plain, inspectable predicate over what inputs are actually
|
|
18
|
+
* present, checked top to bottom, first match wins.
|
|
19
|
+
*/
|
|
20
|
+
export interface IntakeRule {
|
|
21
|
+
name: string;
|
|
22
|
+
when: (inputs: TaskInputs) => boolean;
|
|
23
|
+
startStage: SdlcStage;
|
|
24
|
+
/** The stage sequence this kind of task walks, in order. */
|
|
25
|
+
sequence: SdlcStage[];
|
|
26
|
+
}
|
|
27
|
+
export declare const INTAKE_RULES: IntakeRule[];
|
|
28
|
+
export declare const CONVERSATION_RULE: IntakeRule;
|
|
29
|
+
export declare function classifyIntake(inputs: TaskInputs): IntakeRule;
|
|
30
|
+
export declare function classifyDesignRole(inputs: TaskInputs): Role;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the Role for a given SdlcStage. For the `design` stage, when
|
|
33
|
+
* `inputs` is provided, this delegates to `classifyDesignRole` to decide
|
|
34
|
+
* between `architect` and `business-analyst`. All other stages — and the
|
|
35
|
+
* `design` stage when `inputs` is omitted — use the static default mapping
|
|
36
|
+
* below, preserving backward compatibility with every existing call site.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getStageRole(stage: SdlcStage, inputs?: TaskInputs): Role;
|
|
39
|
+
/**
|
|
40
|
+
* Returns true when the given role is one of the internal (non-DAG-stage)
|
|
41
|
+
* roles such as `defect-manager`. These roles are never dispatched as Sub
|
|
42
|
+
* Agents — they exist for traceability and orchestrator-inline decisions.
|
|
43
|
+
*/
|
|
44
|
+
export declare function isInternalRole(role: Role): boolean;
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
export const SDLC_STAGES = [
|
|
2
|
+
{ stage: "requirements", description: "Explore and write down what's actually being asked for." },
|
|
3
|
+
{ stage: "design", description: "Architecture and functionality/feature documentation." },
|
|
4
|
+
{ stage: "code", description: "Implementation of the design." },
|
|
5
|
+
{ stage: "refactor", description: "Correct existing code against a known defect, without re-deriving the design." },
|
|
6
|
+
{ stage: "test", description: "Unit-level validation that the implementation behaves as intended." },
|
|
7
|
+
{ stage: "ui_api_test", description: "End-to-end validation against a running UI or API surface." },
|
|
8
|
+
{ stage: "fix_defect", description: "The retest half of the fix→retest loop, run after `refactor`." },
|
|
9
|
+
{ stage: "document", description: "Write up what was built for humans who weren't in the loop." },
|
|
10
|
+
{ stage: "deploy", description: "Ship it." },
|
|
11
|
+
{ stage: "conversation", description: "Answer a question or discuss something — no plan, no deliverable contract." },
|
|
12
|
+
{ stage: "quality_gate", description: "A quality-gate review — checked by a specialist Sub Agent (scrum-master, system-architect, or security-lead)." },
|
|
13
|
+
];
|
|
14
|
+
export const STAGE_ROLE = {
|
|
15
|
+
requirements: "requirements-analyst",
|
|
16
|
+
design: "architect",
|
|
17
|
+
code: "programmer",
|
|
18
|
+
refactor: "refactorer",
|
|
19
|
+
test: "tester",
|
|
20
|
+
ui_api_test: "ui-api-tester",
|
|
21
|
+
fix_defect: "tester",
|
|
22
|
+
document: "technical-writer",
|
|
23
|
+
deploy: "devops",
|
|
24
|
+
conversation: "conversation",
|
|
25
|
+
quality_gate: "requirements-analyst", // default; actual role is set by the DAG builder
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Internal roles that exist for traceability and system functions but are
|
|
29
|
+
* not mapped to any DAG stage — they are invoked inline by the orchestrator
|
|
30
|
+
* rather than dispatched as standalone Sub Agents.
|
|
31
|
+
*/
|
|
32
|
+
export const INTERNAL_ROLES = ["defect-manager"];
|
|
33
|
+
export const INTAKE_RULES = [
|
|
34
|
+
{
|
|
35
|
+
name: "qa coverage run",
|
|
36
|
+
when: (i) => !!i.requirementsPath,
|
|
37
|
+
startStage: "requirements",
|
|
38
|
+
sequence: ["requirements", "design", "code", "ui_api_test", "document"],
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "ui/api test with credential + url",
|
|
42
|
+
when: (i) => !!i.url,
|
|
43
|
+
startStage: "ui_api_test",
|
|
44
|
+
sequence: ["ui_api_test", "document"],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: "refactor with code + defect detail",
|
|
48
|
+
when: (i) => !!i.code && !!i.defectDetail,
|
|
49
|
+
startStage: "refactor",
|
|
50
|
+
sequence: ["refactor", "fix_defect", "document"],
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "unit test with code, no defect",
|
|
54
|
+
when: (i) => !!i.code && !i.defectDetail && /\btest(s|ing)?\b/i.test(i.freeText ?? ""),
|
|
55
|
+
startStage: "test",
|
|
56
|
+
sequence: ["test", "document"],
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "write code from a design",
|
|
60
|
+
when: (i) => !!i.design && !i.code,
|
|
61
|
+
startStage: "code",
|
|
62
|
+
sequence: ["code", "test", "document"],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "write design/requirements",
|
|
66
|
+
when: (i) => !i.design && !i.code && !i.url && !i.defectDetail && !i.requirementsPath,
|
|
67
|
+
startStage: "requirements",
|
|
68
|
+
sequence: ["requirements", "design", "code", "test", "document"],
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
export const CONVERSATION_RULE = {
|
|
72
|
+
name: "conversation",
|
|
73
|
+
when: () => true,
|
|
74
|
+
startStage: "conversation",
|
|
75
|
+
sequence: ["conversation"],
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Distinguishes "conversation" (input is code|design|test artifacts OR
|
|
79
|
+
* nothing, and the free-text reads as a question/discussion, not a work
|
|
80
|
+
* order) from the pipeline rules above. Conversation is a deliberate
|
|
81
|
+
* side-path per design feedback: forcing chat through a full PLAN/tracker/
|
|
82
|
+
* deliverable-contract model is overhead it doesn't need.
|
|
83
|
+
*/
|
|
84
|
+
const CONVERSATION_MARKERS = /^(what|why|how|explain|discuss|thoughts|should i|can you tell me)\b/i;
|
|
85
|
+
export function classifyIntake(inputs) {
|
|
86
|
+
if (!inputs.code && !inputs.design && !inputs.url && !inputs.defectDetail && !inputs.requirementsPath) {
|
|
87
|
+
if (CONVERSATION_MARKERS.test((inputs.freeText ?? "").trim())) {
|
|
88
|
+
return CONVERSATION_RULE;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
for (const rule of INTAKE_RULES) {
|
|
92
|
+
if (rule.when(inputs))
|
|
93
|
+
return rule;
|
|
94
|
+
}
|
|
95
|
+
return CONVERSATION_RULE;
|
|
96
|
+
}
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
// Design-stage role classifier
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
/**
|
|
101
|
+
* Detects UI/business-domain keywords in the freeText or inlined design
|
|
102
|
+
* text. When matched, the `design` stage should run `business-analyst`
|
|
103
|
+
* rather than `architect` — the deliverable is the same (design document:
|
|
104
|
+
* components, interfaces, tradeoffs), but the business-analyst directive
|
|
105
|
+
* interprets those terms through a UI-domain lens (pages, page schemas,
|
|
106
|
+
* UX decisions).
|
|
107
|
+
*/
|
|
108
|
+
const UI_DOMAIN_KEYWORDS = /\b(?:flow|pages?|UI|screen|screenflow|dashboard|user +journey|wireframe|mockup|ERP|CRM|CMS|checkout|onboarding|form +flow|navigation +flow|page +flow)\b/i;
|
|
109
|
+
export function classifyDesignRole(inputs) {
|
|
110
|
+
const haystack = [inputs.freeText ?? "", inputs.design ?? ""]
|
|
111
|
+
.filter(Boolean)
|
|
112
|
+
.join(" ");
|
|
113
|
+
return UI_DOMAIN_KEYWORDS.test(haystack) ? "business-analyst" : "architect";
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Returns the Role for a given SdlcStage. For the `design` stage, when
|
|
117
|
+
* `inputs` is provided, this delegates to `classifyDesignRole` to decide
|
|
118
|
+
* between `architect` and `business-analyst`. All other stages — and the
|
|
119
|
+
* `design` stage when `inputs` is omitted — use the static default mapping
|
|
120
|
+
* below, preserving backward compatibility with every existing call site.
|
|
121
|
+
*/
|
|
122
|
+
export function getStageRole(stage, inputs) {
|
|
123
|
+
if (stage === "design" && inputs) {
|
|
124
|
+
return classifyDesignRole(inputs);
|
|
125
|
+
}
|
|
126
|
+
const STATIC_DEFAULT = {
|
|
127
|
+
requirements: "requirements-analyst",
|
|
128
|
+
design: "architect",
|
|
129
|
+
code: "programmer",
|
|
130
|
+
refactor: "refactorer",
|
|
131
|
+
test: "tester",
|
|
132
|
+
ui_api_test: "ui-api-tester",
|
|
133
|
+
fix_defect: "tester",
|
|
134
|
+
document: "technical-writer",
|
|
135
|
+
deploy: "devops",
|
|
136
|
+
conversation: "conversation",
|
|
137
|
+
quality_gate: "requirements-analyst",
|
|
138
|
+
};
|
|
139
|
+
return STATIC_DEFAULT[stage];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Returns true when the given role is one of the internal (non-DAG-stage)
|
|
143
|
+
* roles such as `defect-manager`. These roles are never dispatched as Sub
|
|
144
|
+
* Agents — they exist for traceability and orchestrator-inline decisions.
|
|
145
|
+
*/
|
|
146
|
+
export function isInternalRole(role) {
|
|
147
|
+
return INTERNAL_ROLES.includes(role);
|
|
148
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TaskRun } from "../types.js";
|
|
2
|
+
import type { OrchestratorOptions } from "./sdlc-orchestrator.js";
|
|
3
|
+
import type { InterruptAction } from "../orchestrator/interrupt-handler.js";
|
|
4
|
+
import { InteractiveSteeringManager } from "../orchestrator/interactive-steering.js";
|
|
5
|
+
/**
|
|
6
|
+
* Checks for pending steering input or abort signal.
|
|
7
|
+
* Returns true if a steering injection was applied (caller should persist).
|
|
8
|
+
*/
|
|
9
|
+
export declare function checkSteeringInjection(run: TaskRun, opts: OrchestratorOptions, steering: InteractiveSteeringManager): Promise<boolean>;
|
|
10
|
+
/**
|
|
11
|
+
* Internal halt logic: computes interrupt action, mutates DAG, persists, resolves deferred promise.
|
|
12
|
+
* Returns the InterruptAction summary.
|
|
13
|
+
*/
|
|
14
|
+
export declare function haltInternal(run: TaskRun, opts: OrchestratorOptions, saveTaskRunSync: (root: string, run: TaskRun) => void): Promise<InterruptAction["summary"]>;
|