opencode-swarm 7.0.0-beta.1 → 7.0.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 +1265 -40
- package/dist/__tests__/acknowledge-spec-drift.test.d.ts +1 -0
- package/dist/__tests__/cli-version.adversarial.test.d.ts +1 -0
- package/dist/__tests__/cli-version.test.d.ts +1 -0
- package/dist/__tests__/conflict-resolution.test.d.ts +1 -0
- package/dist/__tests__/convene-general-council.test.d.ts +10 -0
- package/dist/__tests__/critic_drift_verifier-whitelist.test.d.ts +1 -0
- package/dist/__tests__/critic_hallucination_verifier-whitelist.test.d.ts +1 -0
- package/dist/__tests__/disagreement-detector.test.d.ts +7 -0
- package/dist/__tests__/evidence-lock.adversarial.test.d.ts +8 -0
- package/dist/__tests__/evidence-lock.test.d.ts +6 -0
- package/dist/__tests__/gate-evidence.adversarial.test.d.ts +7 -0
- package/dist/__tests__/general-council-service.test.d.ts +7 -0
- package/dist/__tests__/lint-spec.test.d.ts +1 -0
- package/dist/__tests__/preflight-phase.test.d.ts +1 -0
- package/dist/__tests__/qa-gate-hardening.test.d.ts +12 -0
- package/dist/__tests__/req-coverage.test.d.ts +1 -0
- package/dist/__tests__/security-adversarial.test.d.ts +1 -0
- package/dist/__tests__/sounding-board-parser.test.d.ts +1 -0
- package/dist/__tests__/spec-hash.test.d.ts +1 -0
- package/dist/__tests__/spec-schema.test.d.ts +1 -0
- package/dist/__tests__/web-search-provider.test.d.ts +6 -0
- package/dist/__tests__/write-drift-evidence-requirement-coverage.test.d.ts +4 -0
- package/dist/adversarial-tests.test.d.ts +1 -0
- package/dist/agents/architect-permission.adversarial.test.d.ts +5 -0
- package/dist/agents/architect.commands-list.adversarial.test.d.ts +1 -0
- package/dist/agents/architect.commands-list.test.d.ts +1 -0
- package/dist/agents/architect.d.ts +57 -0
- package/dist/agents/architect.dark-matter.test.d.ts +1 -0
- package/dist/agents/architect.designer-gate.test.d.ts +1 -0
- package/dist/agents/coder.d.ts +2 -0
- package/dist/agents/council-member.d.ts +30 -0
- package/dist/agents/council-member.test.d.ts +8 -0
- package/dist/agents/council-moderator.d.ts +20 -0
- package/dist/agents/critic.d.ts +34 -0
- package/dist/agents/curator-agent.d.ts +14 -0
- package/dist/agents/designer.d.ts +2 -0
- package/dist/agents/docs.d.ts +2 -0
- package/dist/agents/explorer-consumer-contract.test.d.ts +1 -0
- package/dist/agents/explorer-role-boundary.test.d.ts +1 -0
- package/dist/agents/explorer.d.ts +5 -0
- package/dist/agents/index.d.ts +52 -0
- package/dist/agents/reviewer.d.ts +5 -0
- package/dist/agents/sme.d.ts +2 -0
- package/dist/agents/test-engineer.adversarial.test.d.ts +5 -0
- package/dist/agents/test-engineer.d.ts +2 -0
- package/dist/agents/test-engineer.security.test.d.ts +1 -0
- package/dist/background/circuit-breaker.d.ts +149 -0
- package/dist/background/event-bus.d.ts +60 -0
- package/dist/background/evidence-summary-integration.d.ts +73 -0
- package/dist/background/index.d.ts +22 -0
- package/dist/background/manager.d.ts +122 -0
- package/dist/background/plan-sync-worker.d.ts +122 -0
- package/dist/background/queue.d.ts +117 -0
- package/dist/background/status-artifact.d.ts +115 -0
- package/dist/background/trigger.d.ts +179 -0
- package/dist/background/trigger.vulnerability.test.d.ts +1 -0
- package/dist/background/worker.d.ts +92 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.js +31227 -11423
- package/dist/commands/acknowledge-spec-drift.d.ts +5 -0
- package/dist/commands/brainstorm.d.ts +13 -0
- package/dist/commands/brainstorm.test.d.ts +1 -0
- package/dist/commands/checkpoint.d.ts +5 -0
- package/dist/commands/close.d.ts +11 -0
- package/dist/commands/command-adapters.security.test.d.ts +14 -0
- package/dist/commands/commands.test.d.ts +1 -0
- package/dist/commands/config.d.ts +5 -0
- package/dist/commands/council.d.ts +17 -0
- package/dist/commands/council.test.d.ts +4 -0
- package/dist/commands/curate.test.d.ts +1 -0
- package/dist/commands/doctor.d.ts +17 -0
- package/dist/commands/full-auto-config-guard.test.d.ts +7 -0
- package/dist/commands/full-auto-discoverability.test.d.ts +8 -0
- package/dist/commands/full-auto-registration.test.d.ts +5 -0
- package/dist/commands/full-auto-sessionid.test.d.ts +5 -0
- package/dist/commands/full-auto.d.ts +10 -0
- package/dist/commands/full-auto.regression.test.d.ts +10 -0
- package/dist/commands/full-auto.test.d.ts +6 -0
- package/dist/commands/index.d.ts +50 -0
- package/dist/commands/index.help-text.test.d.ts +1 -0
- package/dist/commands/issue.d.ts +13 -0
- package/dist/{knowledge.d.ts → commands/knowledge.d.ts} +2 -0
- package/dist/commands/pr-review.d.ts +11 -0
- package/dist/commands/qa-gates.d.ts +15 -0
- package/dist/commands/qa-gates.test.d.ts +1 -0
- package/dist/commands/registry-documentation.test.d.ts +1 -0
- package/dist/commands/registry-type.test.d.ts +1 -0
- package/dist/commands/registry.d.ts +282 -0
- package/dist/commands/reset-session.d.ts +7 -0
- package/dist/commands/shortcut-routing.test.d.ts +11 -0
- package/dist/{sync-plan.d.ts → commands/sync-plan.d.ts} +3 -1
- package/dist/commands/turbo-registration.test.d.ts +5 -0
- package/dist/commands/turbo-sessionid.test.d.ts +5 -0
- package/dist/commands/turbo.regression.test.d.ts +11 -0
- package/dist/commands/turbo.test.d.ts +5 -0
- package/dist/config/agent-categories.d.ts +12 -0
- package/dist/config/cache-paths.d.ts +11 -0
- package/dist/config/constants.architect-whitelist.test.d.ts +1 -0
- package/dist/config/constants.d.ts +72 -0
- package/dist/config/evidence-schema.d.ts +1352 -0
- package/dist/config/index.d.ts +11 -0
- package/dist/{config.d.ts → config/loader.d.ts} +11 -6
- package/dist/config/plan-schema.d.ts +191 -0
- package/dist/config/schema.d.ts +1078 -0
- package/dist/config/spec-schema.d.ts +113 -0
- package/dist/context/role-filter.d.ts +27 -0
- package/dist/context/zone-classifier.d.ts +17 -0
- package/dist/council/__tests__/council-evidence-writer.adversarial.test.d.ts +6 -0
- package/dist/council/council-advisory.d.ts +46 -0
- package/dist/council/council-evidence-writer.d.ts +18 -0
- package/dist/council/council-service.d.ts +21 -0
- package/dist/council/criteria-store.d.ts +9 -0
- package/dist/council/disagreement-detector.d.ts +24 -0
- package/dist/council/general-council-advisory.d.ts +29 -0
- package/dist/council/general-council-service.d.ts +22 -0
- package/dist/council/general-council-types.d.ts +98 -0
- package/dist/council/types.d.ts +126 -0
- package/dist/council/web-search-provider.d.ts +35 -0
- package/dist/db/global-db.d.ts +22 -0
- package/dist/db/global-db.test.d.ts +7 -0
- package/dist/db/index.d.ts +13 -0
- package/dist/db/project-db.d.ts +40 -0
- package/dist/db/project-db.test.d.ts +4 -0
- package/dist/db/qa-gate-profile.d.ts +107 -0
- package/dist/db/qa-gate-profile.test.d.ts +4 -0
- package/dist/diff/__tests__/semantic-classifier.test.d.ts +1 -0
- package/dist/diff/__tests__/summary-generator.test.d.ts +1 -0
- package/dist/diff/ast-diff.d.ts +21 -0
- package/dist/diff/semantic-classifier.d.ts +59 -0
- package/dist/diff/summary-generator.d.ts +33 -0
- package/dist/environment/index.d.ts +3 -0
- package/dist/environment/profile.d.ts +50 -0
- package/dist/environment/prompt-renderer.d.ts +6 -0
- package/dist/evidence/index.d.ts +2 -0
- package/dist/evidence/lock.d.ts +36 -0
- package/dist/evidence/manager.d.ts +78 -0
- package/dist/gate-evidence.d.ts +69 -0
- package/dist/gate-evidence.test.d.ts +1 -0
- package/dist/git/branch.d.ts +70 -0
- package/dist/git/index.d.ts +22 -0
- package/dist/git/pr.d.ts +28 -0
- package/dist/graph/graph-builder.d.ts +39 -0
- package/dist/graph/graph-query.d.ts +42 -0
- package/dist/graph/graph-store.d.ts +27 -0
- package/dist/graph/import-extractor.d.ts +44 -0
- package/dist/graph/index.d.ts +16 -0
- package/dist/graph/symbol-extractor.d.ts +17 -0
- package/dist/graph/types.d.ts +84 -0
- package/dist/hooks/__tests__/semantic-diff-injection.test.d.ts +1 -0
- package/dist/hooks/adversarial-detector.d.ts +50 -0
- package/dist/hooks/agent-activity.d.ts +38 -0
- package/dist/hooks/co-change-suggester.d.ts +51 -0
- package/dist/hooks/compaction-customizer.d.ts +11 -0
- package/dist/hooks/conflict-resolution.d.ts +12 -0
- package/dist/hooks/context-budget.d.ts +34 -0
- package/dist/hooks/context-scoring.d.ts +70 -0
- package/dist/hooks/curator-drift-advisory.test.d.ts +1 -0
- package/dist/hooks/curator-drift.d.ts +30 -0
- package/dist/hooks/curator-llm-factory.d.ts +20 -0
- package/dist/hooks/curator-types.d.ts +103 -0
- package/dist/hooks/curator.d.ts +108 -0
- package/dist/hooks/dark-matter-detector.d.ts +38 -0
- package/dist/hooks/delegation-gate.d.ts +78 -0
- package/dist/hooks/delegation-gate.evidence.test.d.ts +4 -0
- package/dist/hooks/delegation-gate.getEvidenceTaskId.test.d.ts +20 -0
- package/dist/hooks/delegation-gate.plan-fallback-security.test.d.ts +13 -0
- package/dist/hooks/delegation-gate.plan-fallback.test.d.ts +5 -0
- package/dist/hooks/delegation-gate.seed-state.test.d.ts +1 -0
- package/dist/hooks/delegation-gate.turbo-evidence.test.d.ts +8 -0
- package/dist/hooks/delegation-gate.verify.test.d.ts +11 -0
- package/dist/hooks/delegation-ledger.d.ts +37 -0
- package/dist/hooks/delegation-ledger.test.d.ts +11 -0
- package/dist/hooks/delegation-sanitizer.d.ts +24 -0
- package/dist/hooks/delegation-tracker.d.ts +15 -0
- package/dist/hooks/diff-scope.d.ts +12 -0
- package/dist/hooks/diff-scope.test.d.ts +1 -0
- package/dist/hooks/extractors.d.ts +53 -0
- package/dist/hooks/full-auto-intercept.d.ts +77 -0
- package/dist/hooks/guardrails.d.ts +174 -0
- package/dist/hooks/hive-promoter.d.ts +40 -0
- package/dist/hooks/incremental-verify.d.ts +34 -0
- package/dist/hooks/incremental-verify.test.d.ts +1 -0
- package/dist/hooks/index.d.ts +20 -0
- package/dist/hooks/knowledge-curator.d.ts +27 -0
- package/dist/hooks/knowledge-injector.d.ts +20 -0
- package/dist/hooks/knowledge-migrator.d.ts +11 -0
- package/dist/hooks/knowledge-reader.d.ts +22 -0
- package/dist/hooks/knowledge-store.d.ts +30 -0
- package/dist/hooks/knowledge-types.d.ts +131 -0
- package/dist/hooks/knowledge-validator.d.ts +29 -0
- package/dist/hooks/loop-detector.d.ts +17 -0
- package/dist/hooks/loop-detector.test.d.ts +1 -0
- package/dist/hooks/message-priority.d.ts +105 -0
- package/dist/hooks/messages-transform.d.ts +13 -0
- package/dist/hooks/model-limits.d.ts +96 -0
- package/dist/hooks/normalize-tool-name.d.ts +25 -0
- package/dist/hooks/phase-monitor.d.ts +29 -0
- package/dist/hooks/pipeline-tracker.d.ts +41 -0
- package/dist/hooks/repo-graph-builder.d.ts +32 -0
- package/dist/hooks/repo-graph-injection.d.ts +45 -0
- package/dist/hooks/review-receipt.d.ts +189 -0
- package/dist/hooks/scope-guard-throw-behavior.test.d.ts +15 -0
- package/dist/hooks/scope-guard.adversarial.test.d.ts +1 -0
- package/dist/hooks/scope-guard.d.ts +43 -0
- package/dist/hooks/scope-guard.test.d.ts +14 -0
- package/dist/hooks/self-review.d.ts +14 -0
- package/dist/hooks/self-review.test.d.ts +14 -0
- package/dist/hooks/semantic-diff-injection.d.ts +24 -0
- package/dist/hooks/slop-detector.adversarial.test.d.ts +1 -0
- package/dist/hooks/slop-detector.d.ts +17 -0
- package/dist/hooks/slop-detector.test.d.ts +1 -0
- package/dist/hooks/spawn-helper.d.ts +5 -0
- package/dist/hooks/spawn-helper.test.d.ts +1 -0
- package/dist/hooks/steering-consumed.d.ts +30 -0
- package/dist/hooks/system-enhancer.d.ts +30 -0
- package/dist/hooks/tool-summarizer.d.ts +28 -0
- package/dist/hooks/trajectory-logger.d.ts +69 -0
- package/dist/hooks/utils.d.ts +20 -0
- package/dist/hooks/watchdog.integration.test.d.ts +9 -0
- package/dist/index.adversarial-bootstrap.test.d.ts +1 -0
- package/dist/index.bootstrap-adversarial.test.d.ts +1 -0
- package/dist/index.bootstrap-directory.test.d.ts +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.js +74704 -47714
- package/dist/knowledge/identity.d.ts +25 -0
- package/dist/knowledge/index.d.ts +2 -0
- package/dist/lang/detector.d.ts +20 -0
- package/dist/lang/framework-detector.d.ts +98 -0
- package/dist/lang/grammars/tree-sitter-dart.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-kotlin.wasm +0 -0
- package/dist/lang/grammars/tree-sitter-swift.wasm +0 -0
- package/dist/lang/grammars/tree-sitter.wasm +0 -0
- package/dist/lang/index.d.ts +4 -0
- package/dist/lang/profiles.d.ts +72 -0
- package/dist/lang/registry.d.ts +24 -0
- package/dist/lang/runtime.d.ts +35 -0
- package/dist/model-fallback.adversarial.test.d.ts +22 -0
- package/dist/model-fallback.test.d.ts +12 -0
- package/dist/mutation/__tests__/engine.adversarial.test.d.ts +1 -0
- package/dist/mutation/__tests__/engine.test.d.ts +1 -0
- package/dist/mutation/__tests__/equivalence.adversarial.test.d.ts +1 -0
- package/dist/mutation/__tests__/equivalence.test.d.ts +1 -0
- package/dist/mutation/__tests__/gate.adversarial.test.d.ts +1 -0
- package/dist/mutation/__tests__/gate.test.d.ts +1 -0
- package/dist/mutation/__tests__/generator.test.d.ts +1 -0
- package/dist/mutation/engine.d.ts +47 -0
- package/dist/mutation/equivalence.d.ts +35 -0
- package/dist/mutation/gate.d.ts +28 -0
- package/dist/mutation/generator.d.ts +16 -0
- package/dist/output/agent-writer.d.ts +27 -0
- package/dist/output/index.d.ts +1 -0
- package/dist/parallel/dependency-graph.d.ts +34 -0
- package/dist/parallel/dispatcher/index.d.ts +12 -0
- package/dist/parallel/dispatcher/noop-dispatcher.d.ts +18 -0
- package/dist/parallel/dispatcher/noop-dispatcher.test.d.ts +10 -0
- package/dist/parallel/dispatcher/parallel-dispatcher.d.ts +18 -0
- package/dist/parallel/dispatcher/types.d.ts +33 -0
- package/dist/parallel/file-locks.d.ts +40 -0
- package/dist/parallel/index.d.ts +5 -0
- package/dist/parallel/meta-indexer.d.ts +32 -0
- package/dist/parallel/review-router.d.ts +29 -0
- package/dist/plan/checkpoint.d.ts +25 -0
- package/dist/plan/checkpoint.test.d.ts +1 -0
- package/dist/plan/index.d.ts +1 -0
- package/dist/plan/ledger-integrity.test.d.ts +5 -0
- package/dist/plan/ledger-snapshot-adversarial.test.d.ts +1 -0
- package/dist/plan/ledger.d.ts +286 -0
- package/dist/plan/ledger.test.d.ts +1 -0
- package/dist/plan/manager.cas-backoff.test.d.ts +10 -0
- package/dist/plan/manager.d.ts +90 -0
- package/dist/plan/manager.ledger-aware.test.d.ts +1 -0
- package/dist/plan/manager.loadplan-validation-guard.test.d.ts +13 -0
- package/dist/plan/manager.update-task-status.test.d.ts +1 -0
- package/dist/plan/migration-revert.regression.test.d.ts +8 -0
- package/dist/prm/__tests__/course-correction.test.d.ts +1 -0
- package/dist/prm/__tests__/escalation-queue-drain.test.d.ts +1 -0
- package/dist/prm/__tests__/escalation.test.d.ts +1 -0
- package/dist/prm/__tests__/index.test.d.ts +1 -0
- package/dist/prm/__tests__/integration.test.d.ts +1 -0
- package/dist/prm/__tests__/pattern-detector.test.d.ts +5 -0
- package/dist/prm/__tests__/replay.test.d.ts +1 -0
- package/dist/prm/__tests__/trajectory-store.test.d.ts +7 -0
- package/dist/prm/course-correction.d.ts +20 -0
- package/dist/prm/escalation.d.ts +73 -0
- package/dist/prm/index.d.ts +58 -0
- package/dist/prm/pattern-detector.d.ts +71 -0
- package/dist/prm/replay.d.ts +44 -0
- package/dist/prm/trajectory-store.d.ts +66 -0
- package/dist/prm/types.d.ts +120 -0
- package/dist/quality/index.d.ts +1 -0
- package/dist/quality/metrics.d.ts +25 -0
- package/dist/sast/rules/c.d.ts +9 -0
- package/dist/sast/rules/csharp.d.ts +9 -0
- package/dist/sast/rules/go.d.ts +9 -0
- package/dist/sast/rules/index.d.ts +72 -0
- package/dist/sast/rules/java.d.ts +9 -0
- package/dist/sast/rules/javascript.d.ts +9 -0
- package/dist/sast/rules/php.d.ts +9 -0
- package/dist/sast/rules/python.d.ts +9 -0
- package/dist/sast/semgrep.d.ts +68 -0
- package/dist/sast/semgrep.test.d.ts +1 -0
- package/dist/sbom/cyclonedx.d.ts +101 -0
- package/dist/sbom/detectors/dart.d.ts +7 -0
- package/dist/sbom/detectors/dotnet.d.ts +7 -0
- package/dist/sbom/detectors/go.d.ts +7 -0
- package/dist/sbom/detectors/index.d.ts +53 -0
- package/dist/sbom/detectors/java.d.ts +7 -0
- package/dist/sbom/detectors/nodejs.d.ts +7 -0
- package/dist/sbom/detectors/python.d.ts +7 -0
- package/dist/sbom/detectors/rust.d.ts +7 -0
- package/dist/sbom/detectors/swift.d.ts +7 -0
- package/dist/scope/scope-persistence.d.ts +109 -0
- package/dist/scope/scope-persistence.test.d.ts +13 -0
- package/dist/services/compaction-service.d.ts +28 -0
- package/dist/services/compaction-service.test.d.ts +1 -0
- package/dist/services/config-doctor.d.ts +125 -0
- package/dist/services/config-doctor.security.test.d.ts +1 -0
- package/dist/services/config-doctor.test.d.ts +1 -0
- package/dist/services/context-budget-service.d.ts +101 -0
- package/dist/services/decision-drift-analyzer.d.ts +96 -0
- package/dist/services/diagnose-service.d.ts +41 -0
- package/dist/services/evidence-service.d.ts +65 -0
- package/dist/services/evidence-summary-service.d.ts +75 -0
- package/dist/services/export-service.d.ts +30 -0
- package/dist/services/handoff-service.d.ts +74 -0
- package/dist/services/history-service.d.ts +35 -0
- package/dist/services/index.d.ts +13 -0
- package/dist/services/plan-service.d.ts +25 -0
- package/dist/services/preflight-integration.d.ts +38 -0
- package/dist/services/preflight-service.d.ts +62 -0
- package/dist/services/run-memory.d.ts +66 -0
- package/dist/services/status-service.d.ts +35 -0
- package/dist/services/status-service.turbo-indicator.test.d.ts +5 -0
- package/dist/services/tool-doctor.d.ts +26 -0
- package/dist/services/tool-doctor.test.d.ts +1 -0
- package/dist/services/version-check.d.ts +28 -0
- package/dist/services/warning-buffer.d.ts +9 -0
- package/dist/session/snapshot-reader.d.ts +37 -0
- package/dist/session/snapshot-writer.d.ts +115 -0
- package/dist/skills/index.d.ts +30 -0
- package/dist/state/agent-run-context.d.ts +24 -0
- package/dist/state.agent-run-context.test.d.ts +10 -0
- package/dist/state.d.ts +501 -1
- package/dist/state.rehydrate.test.d.ts +1 -0
- package/dist/state.rehydration-adversarial.test.d.ts +1 -0
- package/dist/state.rehydration-integration.test.d.ts +1 -0
- package/dist/state.session-restart.test.d.ts +7 -0
- package/dist/summaries/index.d.ts +2 -0
- package/dist/summaries/manager.d.ts +29 -0
- package/dist/summaries/summarizer.d.ts +38 -0
- package/dist/telemetry.d.ts +59 -0
- package/dist/telemetry.test.d.ts +1 -0
- package/dist/test-impact/__tests__/analyzer-import-fix.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/analyzer-import-fix.test.d.ts +1 -0
- package/dist/test-impact/__tests__/analyzer.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/analyzer.test.d.ts +1 -0
- package/dist/test-impact/__tests__/council-fixes.test.d.ts +1 -0
- package/dist/test-impact/__tests__/failure-classifier.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/failure-classifier.test.d.ts +1 -0
- package/dist/test-impact/__tests__/flaky-detector.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/flaky-detector.test.d.ts +1 -0
- package/dist/test-impact/__tests__/history-store.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/history-store.test.d.ts +1 -0
- package/dist/test-impact/__tests__/test-impact.adversarial.test.d.ts +1 -0
- package/dist/test-impact/__tests__/test-impact.test.d.ts +1 -0
- package/dist/test-impact/analyzer.d.ts +9 -0
- package/dist/test-impact/failure-classifier.d.ts +26 -0
- package/dist/test-impact/flaky-detector.d.ts +14 -0
- package/dist/test-impact/history-store.d.ts +15 -0
- package/dist/tools/__tests__/barrel-exports.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-ast-fallback.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-markdown-summary.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-semantic.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-summary.adversarial.test.d.ts +1 -0
- package/dist/tools/__tests__/diff-summary.test.d.ts +1 -0
- package/dist/tools/__tests__/mutation-test.adversarial.test.d.ts +1 -0
- package/dist/tools/__tests__/mutation-test.sourcefiles.test.d.ts +1 -0
- package/dist/tools/__tests__/mutation-test.test.d.ts +1 -0
- package/dist/tools/__tests__/test-runner-history.test.d.ts +1 -0
- package/dist/tools/__tests__/test-runner-impact.adversarial.test.d.ts +1 -0
- package/dist/tools/__tests__/test-runner-impact.test.d.ts +1 -0
- package/dist/tools/__tests__/test-runner-source-files.test.d.ts +1 -0
- package/dist/tools/barrel-export-check-gate-status.test.d.ts +6 -0
- package/dist/tools/batch-symbols.d.ts +24 -0
- package/dist/tools/batch-symbols.test.d.ts +1 -0
- package/dist/tools/build-check.d.ts +50 -0
- package/dist/tools/check-gate-status.adversarial.test.d.ts +1 -0
- package/dist/tools/check-gate-status.d.ts +7 -0
- package/dist/tools/check-gate-status.gates.test.d.ts +1 -0
- package/dist/tools/check-gate-status.plugin-registration.test.d.ts +1 -0
- package/dist/tools/checkpoint.d.ts +2 -0
- package/dist/tools/co-change-analyzer.d.ts +45 -0
- package/dist/tools/completion-verify.d.ts +25 -0
- package/dist/tools/complexity-hotspots.d.ts +2 -0
- package/dist/tools/convene-council.d.ts +53 -0
- package/dist/tools/convene-general-council.d.ts +25 -0
- package/dist/{create-tool.d.ts → tools/create-tool.d.ts} +13 -1
- package/dist/tools/curator-analyze.d.ts +7 -0
- package/dist/tools/curator-analyze.test.d.ts +1 -0
- package/dist/tools/declare-council-criteria.d.ts +14 -0
- package/dist/tools/declare-scope.d.ts +50 -0
- package/dist/tools/diff-summary.d.ts +12 -0
- package/dist/tools/diff.d.ts +24 -0
- package/dist/tools/doc-scan.d.ts +38 -0
- package/dist/tools/domain-detector.d.ts +6 -0
- package/dist/tools/evidence-check.d.ts +8 -0
- package/dist/tools/file-extractor.d.ts +9 -0
- package/dist/tools/generate-mutants.d.ts +15 -0
- package/dist/tools/get-approved-plan.d.ts +55 -0
- package/dist/tools/get-qa-gate-profile.d.ts +27 -0
- package/dist/tools/gitingest.d.ts +18 -0
- package/dist/tools/imports.d.ts +5 -0
- package/dist/tools/index.d.ts +66 -0
- package/dist/tools/knowledge-add.d.ts +2 -0
- package/dist/tools/knowledge-query.d.ts +5 -0
- package/dist/tools/knowledge-recall.d.ts +2 -0
- package/dist/tools/knowledge-remove.d.ts +2 -0
- package/dist/tools/knowledge-tools.integration.test.d.ts +1 -0
- package/dist/tools/lint-spec.d.ts +2 -0
- package/dist/tools/lint.d.ts +63 -0
- package/dist/tools/mutation-test.d.ts +2 -0
- package/dist/tools/mutation-test.security.test.d.ts +1 -0
- package/dist/tools/phase-complete.d.ts +25 -0
- package/dist/tools/pkg-audit.d.ts +2 -0
- package/dist/tools/placeholder-scan.d.ts +28 -0
- package/dist/tools/plugin-registration-adversarial.test.d.ts +1 -0
- package/dist/tools/pre-check-batch.d.ts +89 -0
- package/dist/tools/quality-budget.d.ts +26 -0
- package/dist/tools/repo-graph.d.ts +226 -0
- package/dist/tools/repo-map.d.ts +2 -0
- package/dist/tools/req-coverage.d.ts +47 -0
- package/dist/tools/resolve-working-directory.d.ts +35 -0
- package/dist/tools/resolve-working-directory.test.d.ts +1 -0
- package/dist/tools/retrieve-summary.d.ts +2 -0
- package/dist/tools/sast-baseline.d.ts +126 -0
- package/dist/tools/sast-scan.d.ts +87 -0
- package/dist/tools/save-plan.d.ts +95 -0
- package/dist/tools/save-plan.subdirectory-rejection.test.d.ts +1 -0
- package/dist/tools/sbom-generate.d.ts +26 -0
- package/dist/tools/schema-drift.d.ts +2 -0
- package/dist/tools/search.adversarial.test.d.ts +1 -0
- package/dist/tools/search.d.ts +29 -0
- package/dist/tools/search.test.d.ts +1 -0
- package/dist/tools/secretscan.d.ts +35 -0
- package/dist/tools/set-qa-gates.d.ts +40 -0
- package/dist/tools/suggest-patch.adversarial.test.d.ts +1 -0
- package/dist/tools/suggest-patch.d.ts +37 -0
- package/dist/tools/suggest-patch.test.d.ts +1 -0
- package/dist/tools/symbols.d.ts +21 -0
- package/dist/tools/syntax-check.d.ts +37 -0
- package/dist/tools/test-impact.d.ts +2 -0
- package/dist/tools/test-runner.d.ts +86 -0
- package/dist/tools/test-runner.security-adversarial.test.d.ts +5 -0
- package/dist/tools/todo-extract.d.ts +2 -0
- package/dist/tools/tool-names.d.ts +10 -0
- package/dist/tools/update-task-status.adversarial.test.d.ts +13 -0
- package/dist/tools/update-task-status.d.ts +114 -0
- package/dist/tools/update-task-status.gates.test.d.ts +1 -0
- package/dist/tools/update-task-status.test.d.ts +1 -0
- package/dist/tools/update-task-status.turbo-bypass.test.d.ts +1 -0
- package/dist/tools/verify-six-tools-registration.test.d.ts +9 -0
- package/dist/tools/web-search.d.ts +13 -0
- package/dist/tools/write-drift-evidence.d.ts +31 -0
- package/dist/tools/write-hallucination-evidence.d.ts +30 -0
- package/dist/tools/write-mutation-evidence.d.ts +34 -0
- package/dist/tools/write-mutation-evidence.test.d.ts +1 -0
- package/dist/tools/write-retro.d.ts +55 -0
- package/dist/transient-retry.test.d.ts +10 -0
- package/dist/types/delegation.d.ts +24 -0
- package/dist/types/events.d.ts +125 -0
- package/dist/utils/errors.d.ts +33 -0
- package/dist/utils/gitignore-warning.d.ts +17 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/merge.d.ts +5 -0
- package/dist/utils/path-security.d.ts +36 -0
- package/dist/utils/regex.d.ts +30 -0
- package/dist/utils/spec-hash.d.ts +15 -0
- package/dist/utils/tool-output.d.ts +12 -0
- package/dist/validation/task-id.d.ts +43 -0
- package/package.json +21 -14
- package/dist/architect.d.ts +0 -7
- package/dist/checkpoint.d.ts +0 -7
- package/dist/co-change-analyzer.d.ts +0 -1
- package/dist/compat.d.ts +0 -12
- package/dist/config-doctor.d.ts +0 -1
- package/dist/detector.d.ts +0 -7
- package/dist/diagnose-service.d.ts +0 -1
- package/dist/doctor.d.ts +0 -5
- package/dist/evidence-schema.d.ts +0 -2
- package/dist/evidence-service.d.ts +0 -1
- package/dist/export-service.d.ts +0 -1
- package/dist/handoff-service.d.ts +0 -1
- package/dist/history-service.d.ts +0 -1
- package/dist/hive-promoter.d.ts +0 -2
- package/dist/knowledge-migrator.d.ts +0 -2
- package/dist/knowledge-store.d.ts +0 -1
- package/dist/knowledge-types.d.ts +0 -1
- package/dist/knowledge-validator.d.ts +0 -2
- package/dist/loader.d.ts +0 -1
- package/dist/manager.d.ts +0 -1
- package/dist/models.d.ts +0 -1
- package/dist/plan-service.d.ts +0 -1
- package/dist/preflight-service.d.ts +0 -1
- package/dist/profiles.d.ts +0 -7
- package/dist/register.d.ts +0 -36
- package/dist/schema.d.ts +0 -2
- package/dist/snapshot-writer.d.ts +0 -1
- package/dist/status-service.d.ts +0 -15
- package/dist/telemetry/src/events.d.ts +0 -308
- package/dist/telemetry/src/guards.d.ts +0 -14
- package/dist/telemetry/src/index.d.ts +0 -4
- package/dist/telemetry/src/version.d.ts +0 -1
- package/dist/utils.d.ts +0 -1
- package/dist/write-retro.d.ts +0 -1
- /package/dist/{discovery.d.ts → build/discovery.d.ts} +0 -0
- /package/dist/{agents.d.ts → commands/agents.d.ts} +0 -0
- /package/dist/{analyze.d.ts → commands/analyze.d.ts} +0 -0
- /package/dist/{archive.d.ts → commands/archive.d.ts} +0 -0
- /package/dist/{benchmark.d.ts → commands/benchmark.d.ts} +0 -0
- /package/dist/{clarify.d.ts → commands/clarify.d.ts} +0 -0
- /package/dist/{curate.d.ts → commands/curate.d.ts} +0 -0
- /package/dist/{dark-matter.d.ts → commands/dark-matter.d.ts} +0 -0
- /package/dist/{diagnose.d.ts → commands/diagnose.d.ts} +0 -0
- /package/dist/{evidence.d.ts → commands/evidence.d.ts} +0 -0
- /package/dist/{export.d.ts → commands/export.d.ts} +0 -0
- /package/dist/{handoff.d.ts → commands/handoff.d.ts} +0 -0
- /package/dist/{history.d.ts → commands/history.d.ts} +0 -0
- /package/dist/{plan.d.ts → commands/plan.d.ts} +0 -0
- /package/dist/{preflight.d.ts → commands/preflight.d.ts} +0 -0
- /package/dist/{promote.d.ts → commands/promote.d.ts} +0 -0
- /package/dist/{reset.d.ts → commands/reset.d.ts} +0 -0
- /package/dist/{retrieve.d.ts → commands/retrieve.d.ts} +0 -0
- /package/dist/{rollback.d.ts → commands/rollback.d.ts} +0 -0
- /package/dist/{simulate.d.ts → commands/simulate.d.ts} +0 -0
- /package/dist/{specify.d.ts → commands/specify.d.ts} +0 -0
- /package/dist/{status.d.ts → commands/status.d.ts} +0 -0
- /package/dist/{turbo.d.ts → commands/turbo.d.ts} +0 -0
- /package/dist/{write_retro.d.ts → commands/write-retro.d.ts} +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CycloneDX SBOM Emitter
|
|
3
|
+
*
|
|
4
|
+
* Generates CycloneDX BOM format (v1.5 spec)
|
|
5
|
+
*/
|
|
6
|
+
import type { SbomComponent } from './detectors/index.js';
|
|
7
|
+
import { type Ecosystem } from './detectors/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* CycloneDX Component
|
|
10
|
+
* Corresponds to a software dependency
|
|
11
|
+
*/
|
|
12
|
+
export interface CycloneDXComponent {
|
|
13
|
+
/** Component type */
|
|
14
|
+
type: 'library' | 'framework' | 'application';
|
|
15
|
+
/** Package name */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Package version */
|
|
18
|
+
version: string;
|
|
19
|
+
/** Package URL (PURL) */
|
|
20
|
+
purl?: string;
|
|
21
|
+
/** License information */
|
|
22
|
+
licenses?: [{
|
|
23
|
+
license: {
|
|
24
|
+
id?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
};
|
|
27
|
+
}];
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* CycloneDX Metadata
|
|
31
|
+
*/
|
|
32
|
+
export interface CycloneDXMetadata {
|
|
33
|
+
/** ISO 8601 timestamp */
|
|
34
|
+
timestamp: string;
|
|
35
|
+
/** Tools used to create the BOM */
|
|
36
|
+
tools: [
|
|
37
|
+
{
|
|
38
|
+
/** Tool vendor */
|
|
39
|
+
vendor: string;
|
|
40
|
+
/** Tool name */
|
|
41
|
+
name: string;
|
|
42
|
+
/** Tool version */
|
|
43
|
+
version: string;
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* CycloneDX BOM Document
|
|
49
|
+
* Conforms to CycloneDX v1.5 specification
|
|
50
|
+
*/
|
|
51
|
+
export interface CycloneDXBom {
|
|
52
|
+
/** BOM format identifier */
|
|
53
|
+
bomFormat: 'CycloneDX';
|
|
54
|
+
/** CycloneDX specification version */
|
|
55
|
+
specVersion: '1.5';
|
|
56
|
+
/** Incremental BOM version */
|
|
57
|
+
version: number;
|
|
58
|
+
/** BOM metadata */
|
|
59
|
+
metadata: CycloneDXMetadata;
|
|
60
|
+
/** List of components */
|
|
61
|
+
components: CycloneDXComponent[];
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Options for generating CycloneDX BOM
|
|
65
|
+
*/
|
|
66
|
+
export interface CycloneDXOptions {
|
|
67
|
+
/** Custom tool name (default: 'sbom_generate') */
|
|
68
|
+
toolName?: string;
|
|
69
|
+
/** Custom tool version (default: '6.9.0') */
|
|
70
|
+
toolVersion?: string;
|
|
71
|
+
/** BOM version number (default: 1) */
|
|
72
|
+
bomVersion?: number;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Generate a CycloneDX BOM from SBOM components
|
|
76
|
+
*
|
|
77
|
+
* @param components - List of SBOM components
|
|
78
|
+
* @param options - Optional configuration
|
|
79
|
+
* @returns CycloneDX BOM object
|
|
80
|
+
*/
|
|
81
|
+
export declare function generateCycloneDX(components: SbomComponent[], options?: CycloneDXOptions): CycloneDXBom;
|
|
82
|
+
/**
|
|
83
|
+
* Serialize a CycloneDX BOM to a JSON string
|
|
84
|
+
*
|
|
85
|
+
* @param bom - CycloneDX BOM object
|
|
86
|
+
* @returns JSON string representation
|
|
87
|
+
*/
|
|
88
|
+
export declare function serializeCycloneDX(bom: CycloneDXBom): string;
|
|
89
|
+
/**
|
|
90
|
+
* Generate PURL for a component based on its ecosystem
|
|
91
|
+
* This is a convenience function that can be used externally
|
|
92
|
+
*
|
|
93
|
+
* @param ecosystem - The package ecosystem
|
|
94
|
+
* @param name - Package name
|
|
95
|
+
* @param version - Package version
|
|
96
|
+
* @param namespace - Optional namespace (for golang, maven, swift)
|
|
97
|
+
* @returns Package URL
|
|
98
|
+
*/
|
|
99
|
+
export declare function generateComponentPurl(ecosystem: Ecosystem, name: string, version: string, namespace?: string): string;
|
|
100
|
+
export type { Ecosystem, SbomComponent } from './detectors/index.js';
|
|
101
|
+
export { generatePurl } from './detectors/index.js';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SBOM Detector Registry and Common Types
|
|
3
|
+
*
|
|
4
|
+
* Provides detectors for extracting dependency information from
|
|
5
|
+
* manifest and lock files across 8 ecosystems.
|
|
6
|
+
*/
|
|
7
|
+
export interface SbomComponent {
|
|
8
|
+
/** Package name */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Package version */
|
|
11
|
+
version: string;
|
|
12
|
+
/** Component type */
|
|
13
|
+
type: 'library' | 'framework' | 'application';
|
|
14
|
+
/** Package URL (PURL) per SPDX spec */
|
|
15
|
+
purl?: string;
|
|
16
|
+
/** Detected license (best effort) */
|
|
17
|
+
license?: string;
|
|
18
|
+
}
|
|
19
|
+
/** Detector interface for parsing manifest/lock files */
|
|
20
|
+
export interface Detector {
|
|
21
|
+
/** Human-readable detector name */
|
|
22
|
+
name: string;
|
|
23
|
+
/** File glob patterns this detector handles */
|
|
24
|
+
patterns: string[];
|
|
25
|
+
/** Parse a file and extract components */
|
|
26
|
+
detect: (filePath: string, content: string) => SbomComponent[];
|
|
27
|
+
}
|
|
28
|
+
/** Ecosystem identifiers */
|
|
29
|
+
export type Ecosystem = 'npm' | 'pypi' | 'cargo' | 'golang' | 'maven' | 'nuget' | 'swift' | 'pub';
|
|
30
|
+
/** Map of ecosystem to its detectors */
|
|
31
|
+
export interface EcosystemDetector {
|
|
32
|
+
ecosystem: Ecosystem;
|
|
33
|
+
detectors: Detector[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Generate a Package URL (PURL) per SPDX specification
|
|
37
|
+
* Format: pkg:<type>/<namespace>/<name>@<version>
|
|
38
|
+
*/
|
|
39
|
+
export declare function generatePurl(ecosystem: Ecosystem, name: string, version: string, namespace?: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Detect ecosystem from file path
|
|
42
|
+
*/
|
|
43
|
+
export declare function detectEcosystemFromPath(filePath: string): Ecosystem | null;
|
|
44
|
+
/** All registered detectors */
|
|
45
|
+
export declare const allDetectors: Detector[];
|
|
46
|
+
/**
|
|
47
|
+
* Find detectors matching a file path
|
|
48
|
+
*/
|
|
49
|
+
export declare function findDetectorsForFile(filePath: string): Detector[];
|
|
50
|
+
/**
|
|
51
|
+
* Detect components from a file using appropriate detectors
|
|
52
|
+
*/
|
|
53
|
+
export declare function detectComponents(filePath: string, content: string): SbomComponent[];
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scope persistence for #519 (v6.71.1 hotfix).
|
|
3
|
+
*
|
|
4
|
+
* Persists declared coder scope to `.swarm/scopes/scope-{taskId}.json` so that
|
|
5
|
+
* scope survives cross-process delegation — in-memory `session.declaredCoderScope`
|
|
6
|
+
* is lost when a coder session starts in a separate process (#496 root cause B).
|
|
7
|
+
*
|
|
8
|
+
* Also exposes a fallback reader that reads `plan.json:phases[].tasks[].files_touched`
|
|
9
|
+
* for the active task, so architect-authored plans become a durable scope source
|
|
10
|
+
* even when `declare_scope` was never called (#496 root cause C mitigation).
|
|
11
|
+
*
|
|
12
|
+
* Read/write contract:
|
|
13
|
+
* - Atomic write via temp + rename (POSIX atomic on same filesystem).
|
|
14
|
+
* - File lock via proper-lockfile while writing.
|
|
15
|
+
* - Schema versioning: readers fail closed on unknown version.
|
|
16
|
+
* - TTL: default 24h from declaredAt; expired scopes return null.
|
|
17
|
+
* - Symlink guards (defence in depth):
|
|
18
|
+
* * realpath containment check on `.swarm/scopes/` (closes parent-dir attack)
|
|
19
|
+
* * O_NOFOLLOW on both write-create and read-fd (closes leaf-file TOCTOU)
|
|
20
|
+
* * taskId-in-file must match the filename (closes cross-pollination)
|
|
21
|
+
* * declaredAt must be <= now (closes future-timestamp attack)
|
|
22
|
+
* * files array capped at MAX_FILES_PER_SCOPE (DoS cap)
|
|
23
|
+
* * plan.json size capped at MAX_PLAN_BYTES (DoS cap)
|
|
24
|
+
* * Windows reserved device names rejected (CON, NUL, LPT1, …)
|
|
25
|
+
*
|
|
26
|
+
* RESIDUAL RISKS — explicitly accepted (#520 tracks full syscall-layer remediation):
|
|
27
|
+
* 1. Bash / interpreter writes bypass the tool-layer authority check. This
|
|
28
|
+
* module does not protect against a coder process running `sed -i`,
|
|
29
|
+
* `echo >`, `python -c`, etc. Mitigation is prompt-only (see coder.ts
|
|
30
|
+
* WRITE BLOCKED PROTOCOL) until #520 lands.
|
|
31
|
+
* 2. Platform-portability of symlink guards:
|
|
32
|
+
* - realpath resolves POSIX symlinks and Windows junctions, but the
|
|
33
|
+
* Windows behaviour is not covered by CI (Linux-only test matrix).
|
|
34
|
+
* - O_NOFOLLOW is a no-op on Windows (falls back to 0). The realpath
|
|
35
|
+
* containment check on `.swarm/scopes/` remains the primary guard
|
|
36
|
+
* on that platform; leaf-file TOCTOU on Windows is not closed.
|
|
37
|
+
* 3. Stale lockfile DoS: a crashed writer leaves a lock for up to
|
|
38
|
+
* LOCK_STALE_MS (30s). During that window, concurrent `declare_scope`
|
|
39
|
+
* calls fail silently and the architect relies on in-memory state.
|
|
40
|
+
* Acceptable because in-memory state remains authoritative inside the
|
|
41
|
+
* live process; disk is a fallback.
|
|
42
|
+
* 4. Temp-file leak: a crash between `Bun.write(tmp)` and `renameSync`
|
|
43
|
+
* leaves `scope-{id}.json.tmp.{ts}.{rand}` files. No sweeper runs today;
|
|
44
|
+
* accumulation is bounded by `/swarm close` (which rm -rf's .swarm/scopes/).
|
|
45
|
+
*
|
|
46
|
+
* NOT a security boundary. Bash remains unguarded at the write-authority layer.
|
|
47
|
+
* The durable fix lives at the syscall layer (#520). This module closes the
|
|
48
|
+
* cross-process gap and the plan-as-scope gap, both of which are mitigations.
|
|
49
|
+
*/
|
|
50
|
+
declare const SCOPE_SCHEMA_VERSION: 1;
|
|
51
|
+
export interface PersistedScope {
|
|
52
|
+
version: typeof SCOPE_SCHEMA_VERSION;
|
|
53
|
+
taskId: string;
|
|
54
|
+
declaredAt: number;
|
|
55
|
+
expiresAt: number;
|
|
56
|
+
files: string[];
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Write declared scope to `.swarm/scopes/scope-{taskId}.json` atomically.
|
|
60
|
+
* Safe to call concurrently — proper-lockfile serialises writers per-file.
|
|
61
|
+
*
|
|
62
|
+
* Silent on I/O failure: scope persistence is a defense-in-depth layer, not a
|
|
63
|
+
* hard requirement. In-memory state remains authoritative for the live process.
|
|
64
|
+
*/
|
|
65
|
+
export declare function writeScopeToDisk(directory: string, taskId: string, files: string[], ttlMs?: number): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Read persisted scope for a task. Returns null on:
|
|
68
|
+
* - file missing
|
|
69
|
+
* - file is a symlink (lstat guard — prevents hostile repo pre-seeding)
|
|
70
|
+
* - unknown schema version (fail-closed)
|
|
71
|
+
* - expired TTL
|
|
72
|
+
* - malformed JSON
|
|
73
|
+
* - invalid taskId
|
|
74
|
+
*/
|
|
75
|
+
export declare function readScopeFromDisk(directory: string, taskId: string): string[] | null;
|
|
76
|
+
/**
|
|
77
|
+
* Read declared scope for a task from `.swarm/plan.json:phases[].tasks[].files_touched`.
|
|
78
|
+
* Mirrors the logic in src/hooks/diff-scope.ts:15-47 but kept independent so a
|
|
79
|
+
* future diff-scope refactor doesn't ripple into authority-layer reads.
|
|
80
|
+
*
|
|
81
|
+
* Returns null on missing plan, task not found, no files_touched, or parse error.
|
|
82
|
+
*/
|
|
83
|
+
export declare function readPlanScope(directory: string, taskId: string): string[] | null;
|
|
84
|
+
/**
|
|
85
|
+
* Remove scope file for a single task. Called when a task transitions to
|
|
86
|
+
* completed/closed so stale scope doesn't leak into later tasks with the same id.
|
|
87
|
+
*/
|
|
88
|
+
export declare function clearScopeForTask(directory: string, taskId: string): void;
|
|
89
|
+
/**
|
|
90
|
+
* Remove the entire `.swarm/scopes/` directory. Called by /swarm close so the
|
|
91
|
+
* next session starts without inherited scope.
|
|
92
|
+
*/
|
|
93
|
+
export declare function clearAllScopes(directory: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* Resolve scope for a task with the full fallback chain:
|
|
96
|
+
* 1. in-memory session.declaredCoderScope (fast path; live process)
|
|
97
|
+
* 2. `.swarm/scopes/scope-{taskId}.json` (cross-process durable)
|
|
98
|
+
* 3. `.swarm/plan.json:phases[].tasks[].files_touched` (architect-authored)
|
|
99
|
+
* 4. caller-supplied pending-map fallback (delegation-gate module map)
|
|
100
|
+
*
|
|
101
|
+
* Any null/empty result falls through to the next layer. First non-empty wins.
|
|
102
|
+
*/
|
|
103
|
+
export declare function resolveScopeWithFallbacks(input: {
|
|
104
|
+
directory: string;
|
|
105
|
+
taskId: string | null | undefined;
|
|
106
|
+
inMemoryScope: string[] | null | undefined;
|
|
107
|
+
pendingMapScope: string[] | null | undefined;
|
|
108
|
+
}): string[] | null;
|
|
109
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for scope-persistence (#519 v6.71.1).
|
|
3
|
+
*
|
|
4
|
+
* Covers:
|
|
5
|
+
* - Atomic write + read round-trip
|
|
6
|
+
* - Schema-version fail-closed on unknown version
|
|
7
|
+
* - TTL expiry returns null
|
|
8
|
+
* - lstat symlink guard
|
|
9
|
+
* - Plan.json fallback (files_touched) for active task
|
|
10
|
+
* - Resolve chain order: memory → disk → plan.json → pending-map
|
|
11
|
+
* - Invalid taskId rejection
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compaction service — monitors context budget and triggers graduated compaction
|
|
3
|
+
* when usage crosses configured thresholds.
|
|
4
|
+
*
|
|
5
|
+
* Three tiers (all thresholds as percentages 0-100):
|
|
6
|
+
* - Observation (default 40%): summarise older turns, preserve key decisions
|
|
7
|
+
* - Reflection (default 60%): re-summarise into tighter format
|
|
8
|
+
* - Emergency (default 80%): hard truncation to system + current task + last N turns
|
|
9
|
+
*
|
|
10
|
+
* Consumes `swarmState.lastBudgetPct` (set by system-enhancer.ts after each budget calc).
|
|
11
|
+
* Never throws. Advisory system message injection via callback.
|
|
12
|
+
*/
|
|
13
|
+
import type { CompactionConfig } from '../config/schema';
|
|
14
|
+
export type { CompactionConfig };
|
|
15
|
+
export interface CompactionServiceHook {
|
|
16
|
+
toolAfter: (input: {
|
|
17
|
+
tool: string;
|
|
18
|
+
sessionID: string;
|
|
19
|
+
}, output: {
|
|
20
|
+
output?: unknown;
|
|
21
|
+
}) => Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
export declare function createCompactionService(config: CompactionConfig, directory: string, injectMessage: (sessionId: string, message: string) => void): CompactionServiceHook;
|
|
24
|
+
export declare function getCompactionMetrics(sessionId?: string): {
|
|
25
|
+
compactionCount: number;
|
|
26
|
+
lastSnapshotAt: string | null;
|
|
27
|
+
};
|
|
28
|
+
export declare function resetCompactionState(sessionId?: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Config Doctor Service
|
|
3
|
+
*
|
|
4
|
+
* Validates opencode-swarm config shape, detects stale/invalid settings,
|
|
5
|
+
* classifies findings by severity, and proposes safe auto-fixes.
|
|
6
|
+
*/
|
|
7
|
+
import type { PluginConfig } from '../config/schema';
|
|
8
|
+
/** Severity levels for config findings */
|
|
9
|
+
export type FindingSeverity = 'info' | 'warn' | 'error';
|
|
10
|
+
/** A single config finding */
|
|
11
|
+
export interface ConfigFinding {
|
|
12
|
+
/** Unique identifier for this finding type */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Human-readable title */
|
|
15
|
+
title: string;
|
|
16
|
+
/** Detailed description */
|
|
17
|
+
description: string;
|
|
18
|
+
/** Severity level */
|
|
19
|
+
severity: FindingSeverity;
|
|
20
|
+
/** Path to the config key (dot notation) */
|
|
21
|
+
path: string;
|
|
22
|
+
/** Current invalid/stale value */
|
|
23
|
+
currentValue?: unknown;
|
|
24
|
+
/** Proposed safe fix (if available) */
|
|
25
|
+
proposedFix?: ConfigFix;
|
|
26
|
+
/** Whether this is auto-fixable (safe, non-destructive) */
|
|
27
|
+
autoFixable: boolean;
|
|
28
|
+
}
|
|
29
|
+
/** A proposed config fix */
|
|
30
|
+
export interface ConfigFix {
|
|
31
|
+
/** Type of fix */
|
|
32
|
+
type: 'remove' | 'update' | 'add';
|
|
33
|
+
/** Path to the config key (dot notation) */
|
|
34
|
+
path: string;
|
|
35
|
+
/** Value to set (for update/add) */
|
|
36
|
+
value?: unknown;
|
|
37
|
+
/** Description of what the fix does */
|
|
38
|
+
description: string;
|
|
39
|
+
/** Risk level - only 'low' is auto-fixable */
|
|
40
|
+
risk: 'low' | 'medium' | 'high';
|
|
41
|
+
}
|
|
42
|
+
/** Result of running the config doctor */
|
|
43
|
+
export interface ConfigDoctorResult {
|
|
44
|
+
/** All findings from the doctor run */
|
|
45
|
+
findings: ConfigFinding[];
|
|
46
|
+
/** Findings by severity */
|
|
47
|
+
summary: {
|
|
48
|
+
info: number;
|
|
49
|
+
warn: number;
|
|
50
|
+
error: number;
|
|
51
|
+
};
|
|
52
|
+
/** Whether any auto-fixable issues were found */
|
|
53
|
+
hasAutoFixableIssues: boolean;
|
|
54
|
+
/** Timestamp of the run */
|
|
55
|
+
timestamp: number;
|
|
56
|
+
/** The config that was analyzed */
|
|
57
|
+
configSource: string;
|
|
58
|
+
}
|
|
59
|
+
/** Backup artifact for rollback */
|
|
60
|
+
export interface ConfigBackup {
|
|
61
|
+
/** When the backup was created */
|
|
62
|
+
createdAt: number;
|
|
63
|
+
/** The backed up config content */
|
|
64
|
+
configPath: string;
|
|
65
|
+
/** The raw config content */
|
|
66
|
+
content: string;
|
|
67
|
+
/** Hash of content for integrity verification */
|
|
68
|
+
contentHash: string;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get config file paths
|
|
72
|
+
*/
|
|
73
|
+
export declare function getConfigPaths(directory: string): {
|
|
74
|
+
userConfigPath: string;
|
|
75
|
+
projectConfigPath: string;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Create a backup of the current config
|
|
79
|
+
*/
|
|
80
|
+
export declare function createConfigBackup(directory: string): ConfigBackup | null;
|
|
81
|
+
/**
|
|
82
|
+
* Write a backup artifact to .swarm directory
|
|
83
|
+
* Persists full backup content to support rollback/restore
|
|
84
|
+
*/
|
|
85
|
+
export declare function writeBackupArtifact(directory: string, backup: ConfigBackup): string;
|
|
86
|
+
/**
|
|
87
|
+
* Restore config from a backup artifact
|
|
88
|
+
* @param backupPath - Path to the backup artifact file
|
|
89
|
+
* @param directory - The working directory (for validating config paths)
|
|
90
|
+
* @returns the path to the restored config file, or null if restore failed
|
|
91
|
+
*/
|
|
92
|
+
export declare function restoreFromBackup(backupPath: string, directory: string): string | null;
|
|
93
|
+
/**
|
|
94
|
+
* Run the config doctor on a loaded config
|
|
95
|
+
*/
|
|
96
|
+
export declare function runConfigDoctor(config: PluginConfig, directory: string): ConfigDoctorResult;
|
|
97
|
+
/**
|
|
98
|
+
* Apply safe auto-fixes to config
|
|
99
|
+
* Only applies low-risk, non-destructive fixes
|
|
100
|
+
*/
|
|
101
|
+
export declare function applySafeAutoFixes(directory: string, result: ConfigDoctorResult): {
|
|
102
|
+
appliedFixes: ConfigFix[];
|
|
103
|
+
updatedConfigPath: string | null;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Write doctor result to .swarm directory for GUI consumption
|
|
107
|
+
*/
|
|
108
|
+
export declare function writeDoctorArtifact(directory: string, result: ConfigDoctorResult): string;
|
|
109
|
+
/**
|
|
110
|
+
* Check if config doctor should run on startup
|
|
111
|
+
*/
|
|
112
|
+
export declare function shouldRunOnStartup(automationConfig: {
|
|
113
|
+
mode: string;
|
|
114
|
+
capabilities?: Record<string, boolean>;
|
|
115
|
+
} | undefined): boolean;
|
|
116
|
+
/**
|
|
117
|
+
* Full config doctor run with backup and fix application
|
|
118
|
+
*/
|
|
119
|
+
export declare function runConfigDoctorWithFixes(directory: string, config: PluginConfig, autoFix?: boolean): Promise<{
|
|
120
|
+
result: ConfigDoctorResult;
|
|
121
|
+
backupPath: string | null;
|
|
122
|
+
appliedFixes: ConfigFix[];
|
|
123
|
+
updatedConfigPath: string | null;
|
|
124
|
+
artifactPath: string | null;
|
|
125
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Budget Service
|
|
3
|
+
*
|
|
4
|
+
* Provides context budget monitoring for swarm sessions.
|
|
5
|
+
* Tracks token usage across all context components and provides
|
|
6
|
+
* warnings when approaching budget limits.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Context budget report with detailed token breakdown
|
|
10
|
+
*/
|
|
11
|
+
export interface ContextBudgetReport {
|
|
12
|
+
/** ISO timestamp when the report was generated */
|
|
13
|
+
timestamp: string;
|
|
14
|
+
/** Tokens used for the assembled system prompt */
|
|
15
|
+
systemPromptTokens: number;
|
|
16
|
+
/** Tokens used for the plan cursor */
|
|
17
|
+
planCursorTokens: number;
|
|
18
|
+
/** Tokens used for knowledge entries */
|
|
19
|
+
knowledgeTokens: number;
|
|
20
|
+
/** Tokens used for run memory */
|
|
21
|
+
runMemoryTokens: number;
|
|
22
|
+
/** Tokens used for handoff content */
|
|
23
|
+
handoffTokens: number;
|
|
24
|
+
/** Tokens used for context.md */
|
|
25
|
+
contextMdTokens: number;
|
|
26
|
+
/** Total swarm context tokens (sum of all components) */
|
|
27
|
+
swarmTotalTokens: number;
|
|
28
|
+
/** Estimated number of turns in this session */
|
|
29
|
+
estimatedTurnCount: number;
|
|
30
|
+
/** Estimated total tokens for the session */
|
|
31
|
+
estimatedSessionTokens: number;
|
|
32
|
+
/** Budget usage percentage */
|
|
33
|
+
budgetPct: number;
|
|
34
|
+
/** Current budget status */
|
|
35
|
+
status: 'ok' | 'warning' | 'critical';
|
|
36
|
+
/** Recommendation message if any */
|
|
37
|
+
recommendation: string | null;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Configuration for context budget monitoring
|
|
41
|
+
*/
|
|
42
|
+
export interface ContextBudgetConfig {
|
|
43
|
+
/** Enable or disable budget monitoring */
|
|
44
|
+
enabled: boolean;
|
|
45
|
+
/** Maximum token budget (default: 40000) */
|
|
46
|
+
budgetTokens: number;
|
|
47
|
+
/** Warning threshold percentage (default: 70) */
|
|
48
|
+
warningPct: number;
|
|
49
|
+
/** Critical threshold percentage (default: 90) */
|
|
50
|
+
criticalPct: number;
|
|
51
|
+
/** Warning mode: 'once', 'every', or 'interval' */
|
|
52
|
+
warningMode: 'once' | 'every' | 'interval';
|
|
53
|
+
/** Interval for warning mode (default: 20 turns) */
|
|
54
|
+
warningIntervalTurns: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Budget state for tracking warning suppression
|
|
58
|
+
*/
|
|
59
|
+
export interface BudgetState {
|
|
60
|
+
/** Turn number when warning was last fired */
|
|
61
|
+
warningFiredAtTurn: number | null;
|
|
62
|
+
/** Turn number when critical was last fired */
|
|
63
|
+
criticalFiredAtTurn: number | null;
|
|
64
|
+
/** Turn number when context was last injected */
|
|
65
|
+
lastInjectedAtTurn: number | null;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Default context budget configuration
|
|
69
|
+
*/
|
|
70
|
+
export declare const DEFAULT_CONTEXT_BUDGET_CONFIG: ContextBudgetConfig;
|
|
71
|
+
/**
|
|
72
|
+
* Estimate token count for text using character-based approximation
|
|
73
|
+
*
|
|
74
|
+
* @param text - The text to estimate tokens for
|
|
75
|
+
* @returns Estimated token count (ceiling of chars / 3.5)
|
|
76
|
+
*/
|
|
77
|
+
export declare function estimateTokens(text: string): number;
|
|
78
|
+
/**
|
|
79
|
+
* Get context budget report with detailed token breakdown
|
|
80
|
+
*
|
|
81
|
+
* @param directory - The swarm workspace directory
|
|
82
|
+
* @param assembledSystemPrompt - The fully assembled system prompt
|
|
83
|
+
* @param config - Budget configuration
|
|
84
|
+
* @returns Context budget report
|
|
85
|
+
*/
|
|
86
|
+
export declare function getContextBudgetReport(directory: string, assembledSystemPrompt: string, config: ContextBudgetConfig): Promise<ContextBudgetReport>;
|
|
87
|
+
/**
|
|
88
|
+
* Format budget warning message based on report
|
|
89
|
+
*
|
|
90
|
+
* @param report - The context budget report
|
|
91
|
+
* @param directory - Directory for state persistence (required for suppression logic)
|
|
92
|
+
* @param config - Budget configuration for warning mode settings
|
|
93
|
+
* @returns Warning message string or null if suppressed/ok
|
|
94
|
+
*/
|
|
95
|
+
export declare function formatBudgetWarning(report: ContextBudgetReport, directory: string, config: ContextBudgetConfig): Promise<string | null>;
|
|
96
|
+
/**
|
|
97
|
+
* Get default context budget config
|
|
98
|
+
*
|
|
99
|
+
* @returns Default configuration
|
|
100
|
+
*/
|
|
101
|
+
export declare function getDefaultConfig(): ContextBudgetConfig;
|