@neural-node-labs/xcoder-dna 0.0.0-stage → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,141 @@
|
|
|
1
|
+
// xcoder:version 2 | xcoder:task task-a73fdc | xcoder:updated 2026-08-03T20:52:06.503Z | xcoder:subtask code-st-dd8b38
|
|
2
|
+
import { exec } from "node:child_process";
|
|
3
|
+
/**
|
|
4
|
+
* A denylist, not a sandbox. This catches the obviously destructive
|
|
5
|
+
* one-liners a model might produce while "cleaning up" or "starting
|
|
6
|
+
* fresh" — it is NOT a security boundary against an adversarial actor.
|
|
7
|
+
* Xcoder SDLC is designed to run each task inside its own disposable container
|
|
8
|
+
* or VM (the same isolation principle Agent Factory's Tool Execution
|
|
9
|
+
* Sandbox uses) — this denylist is a courtesy guardrail on top of that,
|
|
10
|
+
* not a substitute for it.
|
|
11
|
+
*/
|
|
12
|
+
const DENYLIST_PATTERNS = [
|
|
13
|
+
/\brm\s+-rf\s+\/(?:\s|$)/, // rm -rf /
|
|
14
|
+
/\brm\s+-rf\s+~(?:\s|$)/, // rm -rf ~
|
|
15
|
+
/\bmkfs\b/,
|
|
16
|
+
/:\(\)\{.*:\|:.*\};:/, // fork bomb
|
|
17
|
+
/\bdd\s+if=.*of=\/dev\/(sd|nvme|hd)/,
|
|
18
|
+
/\bchmod\s+-R\s+777\s+\//,
|
|
19
|
+
/\bcurl\b.*\|\s*sh\b/, // pipe-to-shell from a URL — force an explicit review step instead
|
|
20
|
+
/>\s*\/dev\/sd/,
|
|
21
|
+
];
|
|
22
|
+
/**
|
|
23
|
+
* Minimal shell-quote-aware split: respects single-quoted and double-quoted
|
|
24
|
+
* strings. Does NOT handle escaped quotes, nested quoting, or advanced
|
|
25
|
+
* features — it just needs to be good enough to split "npm run build" into
|
|
26
|
+
* ["npm", "run", "build"] and preserve "echo 'hello world'" as
|
|
27
|
+
* ["echo", "hello world"].
|
|
28
|
+
*
|
|
29
|
+
* Migrated from runCommandTool.ts. Exported for testing but intended as
|
|
30
|
+
* an internal utility of shell-tool.ts.
|
|
31
|
+
*/
|
|
32
|
+
export function splitCommand(command) {
|
|
33
|
+
const parts = [];
|
|
34
|
+
let current = "";
|
|
35
|
+
let quote = null;
|
|
36
|
+
for (let i = 0; i < command.length; i++) {
|
|
37
|
+
const ch = command[i];
|
|
38
|
+
if (quote) {
|
|
39
|
+
if (ch === quote) {
|
|
40
|
+
quote = null;
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
current += ch;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
else if (ch === "'" || ch === '"') {
|
|
47
|
+
quote = ch;
|
|
48
|
+
}
|
|
49
|
+
else if (ch === " " || ch === "\t") {
|
|
50
|
+
if (current.length > 0) {
|
|
51
|
+
parts.push(current);
|
|
52
|
+
current = "";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
current += ch;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
if (current.length > 0) {
|
|
60
|
+
parts.push(current);
|
|
61
|
+
}
|
|
62
|
+
return parts;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Windows-specific PATHEXT resolution: wraps .cmd/.bat/.ps1 commands
|
|
66
|
+
* with the appropriate interpreter so they work on Windows even when
|
|
67
|
+
* passed to exec(). This is a transparent safety net — exec() already
|
|
68
|
+
* handles .cmd/.bat natively in many shells, but wrapping ensures
|
|
69
|
+
* consistent behavior across all Windows configurations.
|
|
70
|
+
*
|
|
71
|
+
* On non-Windows platforms this is a no-op.
|
|
72
|
+
*
|
|
73
|
+
* Migrated from runCommandTool.ts. Exported for testing but intended as
|
|
74
|
+
* an internal utility of shell-tool.ts.
|
|
75
|
+
*/
|
|
76
|
+
export function resolveWindowsExecutable(command, args) {
|
|
77
|
+
if (process.platform !== "win32")
|
|
78
|
+
return { command, args };
|
|
79
|
+
const lower = command.toLowerCase();
|
|
80
|
+
if (lower.endsWith(".cmd") || lower.endsWith(".bat")) {
|
|
81
|
+
return { command: "cmd.exe", args: ["/c", command, ...args] };
|
|
82
|
+
}
|
|
83
|
+
if (lower.endsWith(".ps1")) {
|
|
84
|
+
return { command: "powershell.exe", args: ["-File", command, ...args] };
|
|
85
|
+
}
|
|
86
|
+
return { command, args };
|
|
87
|
+
}
|
|
88
|
+
export function isDenied(command) {
|
|
89
|
+
for (const pattern of DENYLIST_PATTERNS) {
|
|
90
|
+
if (pattern.test(command)) {
|
|
91
|
+
return `command matches a denylisted destructive pattern (${pattern}) and was not run.`;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The single entry point for executing shell commands via the run_command
|
|
98
|
+
* tool. Internally:
|
|
99
|
+
* 1. Checks the denylist — denied commands return immediately.
|
|
100
|
+
* 2. Splits the command to identify the executable.
|
|
101
|
+
* 3. On Windows, wraps .cmd/.bat/.ps1 executables with the appropriate
|
|
102
|
+
* interpreter via resolveWindowsExecutable().
|
|
103
|
+
* 4. Executes via child_process.exec().
|
|
104
|
+
*
|
|
105
|
+
* @param command - The full command string, e.g. "npm run build".
|
|
106
|
+
* @param cwd - Working directory (the workspace root).
|
|
107
|
+
* @param timeoutMs - Optional timeout in milliseconds (default 120_000).
|
|
108
|
+
* @returns A ShellResult promise.
|
|
109
|
+
*/
|
|
110
|
+
export function runCommandTool(command, cwd, timeoutMs = 120_000) {
|
|
111
|
+
const denyReason = isDenied(command);
|
|
112
|
+
if (denyReason) {
|
|
113
|
+
return Promise.resolve({ ok: false, exitCode: null, stdout: "", stderr: denyReason, timedOut: false });
|
|
114
|
+
}
|
|
115
|
+
// Apply OS-aware executable wrapping for Windows .cmd/.bat/.ps1 commands
|
|
116
|
+
const trimmed = command.trim();
|
|
117
|
+
let finalCommand = trimmed;
|
|
118
|
+
if (trimmed.length > 0 && process.platform === "win32") {
|
|
119
|
+
const parts = splitCommand(trimmed);
|
|
120
|
+
const executable = parts[0];
|
|
121
|
+
const rawArgs = parts.slice(1);
|
|
122
|
+
const { command: resolvedCmd, args } = resolveWindowsExecutable(executable, rawArgs);
|
|
123
|
+
if (resolvedCmd !== executable) {
|
|
124
|
+
// The executable was wrapped — reconstruct the command string
|
|
125
|
+
finalCommand = [resolvedCmd, ...args].map((a) => a.includes(" ") ? `"${a}"` : a).join(" ");
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
return new Promise((resolve) => {
|
|
129
|
+
const child = exec(finalCommand, { cwd, timeout: timeoutMs, maxBuffer: 10 * 1024 * 1024 }, (error, stdout, stderr) => {
|
|
130
|
+
const timedOut = !!error && error.killed === true && error.signal === "SIGTERM";
|
|
131
|
+
resolve({
|
|
132
|
+
ok: !error,
|
|
133
|
+
exitCode: error ? (typeof error.code === "number" ? error.code : 1) : 0,
|
|
134
|
+
stdout,
|
|
135
|
+
stderr,
|
|
136
|
+
timedOut,
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
void child;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface SitePage {
|
|
2
|
+
url: string;
|
|
3
|
+
title: string;
|
|
4
|
+
depth: number;
|
|
5
|
+
links: string[];
|
|
6
|
+
status: number;
|
|
7
|
+
}
|
|
8
|
+
export interface SiteMap {
|
|
9
|
+
rootUrl: string;
|
|
10
|
+
totalPages: number;
|
|
11
|
+
maxDepth: number;
|
|
12
|
+
pages: SitePage[];
|
|
13
|
+
/** Adjacency list: page URL -> list of linked page URLs (internal only) */
|
|
14
|
+
graph: Record<string, string[]>;
|
|
15
|
+
/** Breadcrumb / hierarchy: page URL -> parent URL (first discovered parent) */
|
|
16
|
+
parent: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Crawl a URL and build a site map of all discoverable internal pages.
|
|
20
|
+
*
|
|
21
|
+
* Uses BFS to traverse same-domain links up to `maxPages` pages.
|
|
22
|
+
* Respects `maxDepth` to limit how deep the crawl goes.
|
|
23
|
+
*/
|
|
24
|
+
export declare function crawlSiteMap(url: string, options?: {
|
|
25
|
+
maxPages?: number;
|
|
26
|
+
maxDepth?: number;
|
|
27
|
+
sameDomain?: boolean;
|
|
28
|
+
}): Promise<SiteMap>;
|
|
29
|
+
/**
|
|
30
|
+
* Format the site map as a human-readable tree string.
|
|
31
|
+
*/
|
|
32
|
+
export declare function formatSiteMap(siteMap: SiteMap): string;
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// xcoder:version 2 | xcoder:task task-456d3f | xcoder:updated 2026-08-03T16:08:43.709Z | xcoder:subtask code-st-97a4d4
|
|
2
|
+
import * as cheerio from "cheerio";
|
|
3
|
+
/**
|
|
4
|
+
* Crawl a URL and build a site map of all discoverable internal pages.
|
|
5
|
+
*
|
|
6
|
+
* Uses BFS to traverse same-domain links up to `maxPages` pages.
|
|
7
|
+
* Respects `maxDepth` to limit how deep the crawl goes.
|
|
8
|
+
*/
|
|
9
|
+
export async function crawlSiteMap(url, options = {}) {
|
|
10
|
+
const { maxPages = 50, maxDepth = 5, sameDomain = true } = options;
|
|
11
|
+
const rootUrl = normalizeUrl(url) ?? url;
|
|
12
|
+
const rootDomain = extractDomain(rootUrl);
|
|
13
|
+
const visited = new Set();
|
|
14
|
+
const pages = [];
|
|
15
|
+
const graph = {};
|
|
16
|
+
const parent = {};
|
|
17
|
+
// BFS queue: [url, depth, parentUrl?]
|
|
18
|
+
const queue = [[rootUrl, 0, null]];
|
|
19
|
+
while (queue.length > 0 && pages.length < maxPages) {
|
|
20
|
+
const [currentUrl, depth, parentUrl] = queue.shift();
|
|
21
|
+
if (visited.has(currentUrl))
|
|
22
|
+
continue;
|
|
23
|
+
if (depth > maxDepth)
|
|
24
|
+
continue;
|
|
25
|
+
visited.add(currentUrl);
|
|
26
|
+
try {
|
|
27
|
+
const page = await fetchPage(currentUrl);
|
|
28
|
+
if (!page)
|
|
29
|
+
continue;
|
|
30
|
+
// Record parent relationship
|
|
31
|
+
if (parentUrl) {
|
|
32
|
+
parent[currentUrl] = parentUrl;
|
|
33
|
+
}
|
|
34
|
+
// Filter internal links
|
|
35
|
+
const internalLinks = [];
|
|
36
|
+
for (const link of page.links) {
|
|
37
|
+
const normalized = normalizeUrl(link, currentUrl);
|
|
38
|
+
if (!normalized)
|
|
39
|
+
continue;
|
|
40
|
+
if (sameDomain && extractDomain(normalized) !== rootDomain)
|
|
41
|
+
continue;
|
|
42
|
+
if (normalized.startsWith("mailto:") || normalized.startsWith("tel:") || normalized.startsWith("javascript:"))
|
|
43
|
+
continue;
|
|
44
|
+
if (visited.has(normalized))
|
|
45
|
+
continue;
|
|
46
|
+
internalLinks.push(normalized);
|
|
47
|
+
}
|
|
48
|
+
// Deduplicate internal links
|
|
49
|
+
const uniqueInternal = [...new Set(internalLinks)];
|
|
50
|
+
// Record in graph
|
|
51
|
+
graph[currentUrl] = uniqueInternal;
|
|
52
|
+
// Add to pages
|
|
53
|
+
pages.push({
|
|
54
|
+
url: currentUrl,
|
|
55
|
+
title: page.title,
|
|
56
|
+
depth,
|
|
57
|
+
links: uniqueInternal,
|
|
58
|
+
status: page.status,
|
|
59
|
+
});
|
|
60
|
+
// Enqueue unvisited internal links
|
|
61
|
+
for (const link of uniqueInternal) {
|
|
62
|
+
if (!visited.has(link)) {
|
|
63
|
+
queue.push([link, depth + 1, currentUrl]);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
// Skip pages that fail to load
|
|
69
|
+
console.error(`[crawlSiteMap] Failed to fetch ${currentUrl}: ${err}`);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const maxDepthReached = pages.reduce((max, p) => Math.max(max, p.depth), 0);
|
|
73
|
+
return {
|
|
74
|
+
rootUrl,
|
|
75
|
+
totalPages: pages.length,
|
|
76
|
+
maxDepth: maxDepthReached,
|
|
77
|
+
pages,
|
|
78
|
+
graph,
|
|
79
|
+
parent,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Format the site map as a human-readable tree string.
|
|
84
|
+
*/
|
|
85
|
+
export function formatSiteMap(siteMap) {
|
|
86
|
+
const lines = [];
|
|
87
|
+
lines.push(`Site Map for: ${siteMap.rootUrl}`);
|
|
88
|
+
lines.push(`Total pages: ${siteMap.totalPages}, Max depth: ${siteMap.maxDepth}`);
|
|
89
|
+
lines.push("");
|
|
90
|
+
// Build a tree from the parent map
|
|
91
|
+
const treeLines = buildTreeLines(siteMap);
|
|
92
|
+
lines.push(...treeLines);
|
|
93
|
+
lines.push("");
|
|
94
|
+
lines.push("--- Page Details ---");
|
|
95
|
+
for (const page of siteMap.pages) {
|
|
96
|
+
lines.push(` [${page.status}] ${page.url}`);
|
|
97
|
+
lines.push(` Title: ${page.title}`);
|
|
98
|
+
if (page.links.length > 0) {
|
|
99
|
+
lines.push(` Internal links (${page.links.length}):`);
|
|
100
|
+
for (const link of page.links.slice(0, 10)) {
|
|
101
|
+
lines.push(` - ${link}`);
|
|
102
|
+
}
|
|
103
|
+
if (page.links.length > 10) {
|
|
104
|
+
lines.push(` ... and ${page.links.length - 10} more`);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
lines.push("");
|
|
108
|
+
}
|
|
109
|
+
return lines.join("\n");
|
|
110
|
+
}
|
|
111
|
+
function buildTreeLines(siteMap) {
|
|
112
|
+
const lines = [];
|
|
113
|
+
const { rootUrl, parent, pages } = siteMap;
|
|
114
|
+
// Build children map
|
|
115
|
+
const children = {};
|
|
116
|
+
for (const [child, par] of Object.entries(parent)) {
|
|
117
|
+
if (!children[par])
|
|
118
|
+
children[par] = [];
|
|
119
|
+
children[par].push(child);
|
|
120
|
+
}
|
|
121
|
+
// Build a page lookup
|
|
122
|
+
const pageByUrl = new Map();
|
|
123
|
+
for (const p of pages) {
|
|
124
|
+
pageByUrl.set(p.url, p);
|
|
125
|
+
}
|
|
126
|
+
function printTree(url, indent, isLast) {
|
|
127
|
+
const page = pageByUrl.get(url);
|
|
128
|
+
const prefix = isLast ? "└── " : "├── ";
|
|
129
|
+
const title = page ? page.title : "(unknown)";
|
|
130
|
+
lines.push(`${indent}${prefix}${url} [${page?.status ?? "?"}] "${title}"`);
|
|
131
|
+
const childList = children[url] || [];
|
|
132
|
+
const newIndent = indent + (isLast ? " " : "│ ");
|
|
133
|
+
for (let i = 0; i < childList.length; i++) {
|
|
134
|
+
printTree(childList[i], newIndent, i === childList.length - 1);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
lines.push(rootUrl);
|
|
138
|
+
const rootChildren = children[rootUrl] || [];
|
|
139
|
+
for (let i = 0; i < rootChildren.length; i++) {
|
|
140
|
+
printTree(rootChildren[i], "", i === rootChildren.length - 1);
|
|
141
|
+
}
|
|
142
|
+
return lines;
|
|
143
|
+
}
|
|
144
|
+
// --- Helpers ---
|
|
145
|
+
function normalizeUrl(href, base) {
|
|
146
|
+
try {
|
|
147
|
+
const url = new URL(href, base || undefined);
|
|
148
|
+
// Remove trailing slash for consistency
|
|
149
|
+
let normalized = url.origin + url.pathname.replace(/\/$/, "") + url.search;
|
|
150
|
+
// If pathname is empty, keep root
|
|
151
|
+
if (normalized.endsWith(url.origin)) {
|
|
152
|
+
normalized = url.origin + "/";
|
|
153
|
+
}
|
|
154
|
+
return normalized;
|
|
155
|
+
}
|
|
156
|
+
catch {
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
function extractDomain(url) {
|
|
161
|
+
try {
|
|
162
|
+
return new URL(url).hostname;
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return url;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
async function fetchPage(url) {
|
|
169
|
+
const controller = new AbortController();
|
|
170
|
+
const timeout = setTimeout(() => controller.abort(), 10000); // 10s timeout
|
|
171
|
+
try {
|
|
172
|
+
const res = await fetch(url, {
|
|
173
|
+
signal: controller.signal,
|
|
174
|
+
headers: {
|
|
175
|
+
"User-Agent": "xcoder-site-crawler/1.0",
|
|
176
|
+
Accept: "text/html,application/xhtml+xml",
|
|
177
|
+
},
|
|
178
|
+
redirect: "follow",
|
|
179
|
+
});
|
|
180
|
+
if (!res.ok) {
|
|
181
|
+
return { title: `(HTTP ${res.status})`, links: [], status: res.status };
|
|
182
|
+
}
|
|
183
|
+
const contentType = res.headers.get("content-type") || "";
|
|
184
|
+
if (!contentType.includes("text/html") && !contentType.includes("application/xhtml")) {
|
|
185
|
+
return null; // Skip non-HTML resources
|
|
186
|
+
}
|
|
187
|
+
const html = await res.text();
|
|
188
|
+
const $ = cheerio.load(html);
|
|
189
|
+
const title = $("title").first().text().trim() || "(no title)";
|
|
190
|
+
const links = [];
|
|
191
|
+
$("a[href]").each((_index, el) => {
|
|
192
|
+
const href = $(el).attr("href");
|
|
193
|
+
if (href && href.trim()) {
|
|
194
|
+
links.push(href.trim());
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
return { title, links, status: res.status };
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
return null;
|
|
201
|
+
}
|
|
202
|
+
finally {
|
|
203
|
+
clearTimeout(timeout);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { TokenUsage } from "../types.js";
|
|
2
|
+
export interface ToolManifestEntry {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputHint: string;
|
|
6
|
+
/**
|
|
7
|
+
* Where this tool's answer about *which files exist* comes from.
|
|
8
|
+
*
|
|
9
|
+
* `index` — the workspace index, and nothing else (no filesystem walk).
|
|
10
|
+
* `file-bytes` — reads contents of files the index selected.
|
|
11
|
+
* `process` — shells out; results are not index-derived.
|
|
12
|
+
* `none` — does not discover files.
|
|
13
|
+
*/
|
|
14
|
+
discoverySource?: "index" | "file-bytes" | "process" | "none";
|
|
15
|
+
}
|
|
16
|
+
export interface CallSwarmInput {
|
|
17
|
+
goal: string;
|
|
18
|
+
protocol: string;
|
|
19
|
+
concurrency?: number;
|
|
20
|
+
maxIterations?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface CallSwarmOutput {
|
|
23
|
+
instanceId: string;
|
|
24
|
+
status: "completed" | "failed" | "timeout";
|
|
25
|
+
workersCompleted: number;
|
|
26
|
+
workersFailed: number;
|
|
27
|
+
errors: string[];
|
|
28
|
+
tokenUsage: TokenUsage;
|
|
29
|
+
summary: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Tools whose file discovery must be answered by the index alone.
|
|
33
|
+
*
|
|
34
|
+
* Exported so a test can assert the property instead of trusting prose:
|
|
35
|
+
* `globTool` imports no filesystem enumerator, and every result it returns is
|
|
36
|
+
* a strict subset of `WorkspaceIndex.entries`.
|
|
37
|
+
*/
|
|
38
|
+
export declare const INDEX_ONLY_DISCOVERY_TOOLS: readonly ["glob", "grep", "search_workspace", "list_dir"];
|
|
39
|
+
export declare const TOOL_MANIFEST: ToolManifestEntry[];
|
|
40
|
+
/**
|
|
41
|
+
* Build the tool manifest array, conditionally including record_lesson.
|
|
42
|
+
* A function rather than a mutable global so that the manifest is
|
|
43
|
+
* immutable per call — testable and predictable.
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildToolManifest(opts: {
|
|
46
|
+
lessonLearned: boolean;
|
|
47
|
+
}): ToolManifestEntry[];
|
|
48
|
+
export interface ToolCallResult {
|
|
49
|
+
tool: string;
|
|
50
|
+
ok: boolean;
|
|
51
|
+
output: unknown;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The one place a subtask's tool call actually executes. `root` pins every
|
|
55
|
+
* filesystem/shell action to this task's workspace — a subtask can never
|
|
56
|
+
* reach outside it (see `fs-tools.ts`'s `resolveInWorkspace`).
|
|
57
|
+
*
|
|
58
|
+
* Every branch is wrapped in try/catch here in addition to the caller's own
|
|
59
|
+
* try/catch (see `agents/sub-agent.ts`) — deliberate defense in depth: a
|
|
60
|
+
* tool throwing should never bring down the Sub Agent's loop, and a Sub
|
|
61
|
+
* Agent throwing should never bring down the Master Orchestrator (see
|
|
62
|
+
* `orchestrator/swarm.ts`).
|
|
63
|
+
*/
|
|
64
|
+
export declare function dispatchTool(root: string, toolName: string, input: unknown, ctx?: {
|
|
65
|
+
taskId: string;
|
|
66
|
+
subtaskId: string;
|
|
67
|
+
}): Promise<ToolCallResult>;
|