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,40 @@
|
|
|
1
|
+
export interface FileLock {
|
|
2
|
+
filePath: string;
|
|
3
|
+
agent: string;
|
|
4
|
+
taskId: string;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
expiresAt: number;
|
|
7
|
+
_release?: () => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Try to acquire a lock on a file using proper-lockfile
|
|
11
|
+
*/
|
|
12
|
+
export declare function tryAcquireLock(directory: string, filePath: string, agent: string, taskId: string): Promise<{
|
|
13
|
+
acquired: true;
|
|
14
|
+
lock: FileLock;
|
|
15
|
+
} | {
|
|
16
|
+
acquired: false;
|
|
17
|
+
existing?: FileLock;
|
|
18
|
+
}>;
|
|
19
|
+
/**
|
|
20
|
+
* Release a lock on a file.
|
|
21
|
+
*
|
|
22
|
+
* The preferred release path is `lockResult.lock._release()` at the call site.
|
|
23
|
+
* This function is kept for API compatibility but is a no-op: callers that
|
|
24
|
+
* stored a proper-lockfile release function on `lock._release` should call
|
|
25
|
+
* that directly. Callers that do not have the release function (e.g. tests
|
|
26
|
+
* that write lock sentinel files by hand) can ignore the return value.
|
|
27
|
+
*/
|
|
28
|
+
export declare function releaseLock(_directory: string, _filePath: string, _taskId: string): Promise<boolean>;
|
|
29
|
+
/**
|
|
30
|
+
* Check if a file is locked
|
|
31
|
+
*/
|
|
32
|
+
export declare function isLocked(directory: string, filePath: string): FileLock | null;
|
|
33
|
+
/**
|
|
34
|
+
* Clean up expired locks
|
|
35
|
+
*/
|
|
36
|
+
export declare function cleanupExpiredLocks(directory: string): number;
|
|
37
|
+
/**
|
|
38
|
+
* List all active locks
|
|
39
|
+
*/
|
|
40
|
+
export declare function listActiveLocks(directory: string): FileLock[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { EvidenceLockTimeoutError, withEvidenceLock, } from '../evidence/lock.js';
|
|
2
|
+
export { type DependencyGraph, getDependencyChain, getExecutionOrder, getRunnableTasks, isTaskBlocked, parseDependencyGraph, type TaskNode, } from './dependency-graph.js';
|
|
3
|
+
export { cleanupExpiredLocks, type FileLock, isLocked, listActiveLocks, releaseLock, tryAcquireLock, } from './file-locks.js';
|
|
4
|
+
export { extractMetaSummaries, getLatestTaskSummary, indexMetaSummaries, type MetaSummaryEntry, querySummaries, } from './meta-indexer.js';
|
|
5
|
+
export { type ComplexityMetrics, computeComplexity, type ReviewDepth, type ReviewRouting, routeReview, routeReviewForChanges, shouldParallelizeReview, } from './review-router.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface MetaSummaryEntry {
|
|
2
|
+
timestamp: string;
|
|
3
|
+
phase?: number;
|
|
4
|
+
taskId?: string;
|
|
5
|
+
agent?: string;
|
|
6
|
+
summary: string;
|
|
7
|
+
source?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Extract meta.summary from event JSONL files
|
|
11
|
+
*/
|
|
12
|
+
export declare function extractMetaSummaries(eventsPath: string): MetaSummaryEntry[];
|
|
13
|
+
/**
|
|
14
|
+
* Index meta summaries to external knowledge store
|
|
15
|
+
*/
|
|
16
|
+
export declare function indexMetaSummaries(directory: string, externalKnowledgeDir?: string): Promise<{
|
|
17
|
+
indexed: number;
|
|
18
|
+
path: string;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Query indexed summaries
|
|
22
|
+
*/
|
|
23
|
+
export declare function querySummaries(directory: string, options?: {
|
|
24
|
+
phase?: number;
|
|
25
|
+
taskId?: string;
|
|
26
|
+
agent?: string;
|
|
27
|
+
since?: string;
|
|
28
|
+
}): MetaSummaryEntry[];
|
|
29
|
+
/**
|
|
30
|
+
* Get latest summary for a task
|
|
31
|
+
*/
|
|
32
|
+
export declare function getLatestTaskSummary(directory: string, taskId: string): MetaSummaryEntry | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type ReviewDepth = 'single' | 'double';
|
|
2
|
+
export interface ReviewRouting {
|
|
3
|
+
reviewerCount: number;
|
|
4
|
+
testEngineerCount: number;
|
|
5
|
+
depth: ReviewDepth;
|
|
6
|
+
reason: string;
|
|
7
|
+
}
|
|
8
|
+
export interface ComplexityMetrics {
|
|
9
|
+
fileCount: number;
|
|
10
|
+
functionCount: number;
|
|
11
|
+
astChangeCount: number;
|
|
12
|
+
maxFileComplexity: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Compute complexity metrics for a set of files
|
|
16
|
+
*/
|
|
17
|
+
export declare function computeComplexity(directory: string, changedFiles: string[]): Promise<ComplexityMetrics>;
|
|
18
|
+
/**
|
|
19
|
+
* Determine review routing based on complexity
|
|
20
|
+
*/
|
|
21
|
+
export declare function routeReview(metrics: ComplexityMetrics): ReviewRouting;
|
|
22
|
+
/**
|
|
23
|
+
* Route review with full analysis
|
|
24
|
+
*/
|
|
25
|
+
export declare function routeReviewForChanges(directory: string, changedFiles: string[]): Promise<ReviewRouting>;
|
|
26
|
+
/**
|
|
27
|
+
* Check if review should be parallelized
|
|
28
|
+
*/
|
|
29
|
+
export declare function shouldParallelizeReview(routing: ReviewRouting): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type Plan } from '../config/plan-schema';
|
|
2
|
+
/**
|
|
3
|
+
* Write SWARM_PLAN.json and SWARM_PLAN.md to the project root directory.
|
|
4
|
+
* Non-blocking: logs a warning on failure but never throws.
|
|
5
|
+
* @param directory - The working directory (project root)
|
|
6
|
+
*/
|
|
7
|
+
export declare function writeCheckpoint(directory: string): Promise<void>;
|
|
8
|
+
/**
|
|
9
|
+
* Result of an importCheckpoint operation.
|
|
10
|
+
*/
|
|
11
|
+
export interface ImportCheckpointResult {
|
|
12
|
+
success: boolean;
|
|
13
|
+
plan?: Plan;
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Import a checkpoint from SWARM_PLAN.json at the project root.
|
|
18
|
+
* Validates the checkpoint against PlanSchema, persists it as the live plan
|
|
19
|
+
* via savePlan, and appends a 'plan_rebuilt' ledger event.
|
|
20
|
+
*
|
|
21
|
+
* @param directory - The working directory (project root)
|
|
22
|
+
* @param source - Optional source identifier for the ledger event (defaults to 'external_reseed')
|
|
23
|
+
* @returns ImportCheckpointResult indicating success or failure with error message
|
|
24
|
+
*/
|
|
25
|
+
export declare function importCheckpoint(directory: string, source?: string): Promise<ImportCheckpointResult>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { derivePlanMarkdown, loadPlan, migrateLegacyPlan, savePlan, updateTaskStatus, } from './manager';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Append-only Plan Ledger
|
|
3
|
+
*
|
|
4
|
+
* Provides durable, immutable audit trail of plan evolution events.
|
|
5
|
+
* Each event is written as a JSON line to .swarm/plan-ledger.jsonl
|
|
6
|
+
*/
|
|
7
|
+
import { type Plan } from '../config/plan-schema';
|
|
8
|
+
/**
|
|
9
|
+
* Ledger schema version
|
|
10
|
+
*/
|
|
11
|
+
export declare const LEDGER_SCHEMA_VERSION = "1.0.0";
|
|
12
|
+
/**
|
|
13
|
+
* Valid ledger event types
|
|
14
|
+
*/
|
|
15
|
+
export declare const LEDGER_EVENT_TYPES: readonly ["plan_created", "task_added", "task_updated", "task_status_changed", "task_reordered", "phase_completed", "plan_rebuilt", "plan_exported", "plan_reset", "snapshot", "execution_profile_set", "execution_profile_locked"];
|
|
16
|
+
export type LedgerEventType = (typeof LEDGER_EVENT_TYPES)[number];
|
|
17
|
+
/**
|
|
18
|
+
* A ledger event representing a plan mutation.
|
|
19
|
+
* All fields are required unless marked optional.
|
|
20
|
+
*/
|
|
21
|
+
export interface LedgerEvent {
|
|
22
|
+
/** Monotonically increasing sequence number (starts at 1) */
|
|
23
|
+
seq: number;
|
|
24
|
+
/** ISO 8601 timestamp when event was recorded */
|
|
25
|
+
timestamp: string;
|
|
26
|
+
/** Unique identifier for the plan */
|
|
27
|
+
plan_id: string;
|
|
28
|
+
/** Type of event that occurred */
|
|
29
|
+
event_type: LedgerEventType;
|
|
30
|
+
/** Task ID when event relates to a specific task */
|
|
31
|
+
task_id?: string;
|
|
32
|
+
/** Phase ID when event relates to a specific phase */
|
|
33
|
+
phase_id?: number;
|
|
34
|
+
/** Previous status (for status change events) */
|
|
35
|
+
from_status?: string;
|
|
36
|
+
/** New status (for status change events) */
|
|
37
|
+
to_status?: string;
|
|
38
|
+
/** What triggered this event */
|
|
39
|
+
source: string;
|
|
40
|
+
/** SHA-256 hash of plan state before this event */
|
|
41
|
+
plan_hash_before: string;
|
|
42
|
+
/** SHA-256 hash of plan state after this event */
|
|
43
|
+
plan_hash_after: string;
|
|
44
|
+
/** Schema version for this ledger entry */
|
|
45
|
+
schema_version: string;
|
|
46
|
+
/** Optional payload for events that carry additional data */
|
|
47
|
+
payload?: Record<string, unknown>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Input type for appendLedgerEvent (excludes auto-generated fields)
|
|
51
|
+
*/
|
|
52
|
+
export type LedgerEventInput = Omit<LedgerEvent, 'seq' | 'timestamp' | 'plan_hash_before' | 'plan_hash_after' | 'schema_version'>;
|
|
53
|
+
/**
|
|
54
|
+
* Payload for snapshot ledger events.
|
|
55
|
+
* Embeds the full Plan payload for ledger-only rebuild.
|
|
56
|
+
*/
|
|
57
|
+
export interface SnapshotEventPayload {
|
|
58
|
+
plan: Plan;
|
|
59
|
+
payload_hash: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Error thrown when a writer attempts to append to the ledger with stale state.
|
|
63
|
+
* Indicates another writer has modified the ledger since the caller last read it.
|
|
64
|
+
*/
|
|
65
|
+
export declare class LedgerStaleWriterError extends Error {
|
|
66
|
+
constructor(message: string);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Compute a SHA-256 hash of the plan state.
|
|
70
|
+
* Uses deterministic JSON serialization for consistent hashing.
|
|
71
|
+
*
|
|
72
|
+
* @param plan - The plan to hash
|
|
73
|
+
* @returns Hex-encoded SHA-256 hash
|
|
74
|
+
*/
|
|
75
|
+
export declare function computePlanHash(plan: Plan): string;
|
|
76
|
+
/**
|
|
77
|
+
* Read the current plan.json and compute its hash.
|
|
78
|
+
*
|
|
79
|
+
* @param directory - The working directory
|
|
80
|
+
* @returns Hash of current plan.json, or empty string if not found
|
|
81
|
+
*/
|
|
82
|
+
export declare function computeCurrentPlanHash(directory: string): string;
|
|
83
|
+
/**
|
|
84
|
+
* Check if the ledger file exists.
|
|
85
|
+
*
|
|
86
|
+
* @param directory - The working directory
|
|
87
|
+
* @returns true if ledger file exists
|
|
88
|
+
*/
|
|
89
|
+
export declare function ledgerExists(directory: string): Promise<boolean>;
|
|
90
|
+
/**
|
|
91
|
+
* Get the latest sequence number in the ledger.
|
|
92
|
+
*
|
|
93
|
+
* @param directory - The working directory
|
|
94
|
+
* @returns Highest seq value, or 0 if ledger is empty/doesn't exist
|
|
95
|
+
*/
|
|
96
|
+
export declare function getLatestLedgerSeq(directory: string): Promise<number>;
|
|
97
|
+
/**
|
|
98
|
+
* Read all events from the ledger.
|
|
99
|
+
*
|
|
100
|
+
* @param directory - The working directory
|
|
101
|
+
* @returns Array of LedgerEvent sorted by seq
|
|
102
|
+
*/
|
|
103
|
+
export declare function readLedgerEvents(directory: string): Promise<LedgerEvent[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Initialize a new ledger with a plan_created event.
|
|
106
|
+
* Only call this if the ledger doesn't exist.
|
|
107
|
+
*
|
|
108
|
+
* @param directory - The working directory
|
|
109
|
+
* @param planId - Unique identifier for the plan
|
|
110
|
+
*/
|
|
111
|
+
export declare function initLedger(directory: string, planId: string, initialPlanHash?: string, initialPlan?: Plan): Promise<void>;
|
|
112
|
+
/**
|
|
113
|
+
* Append a new event to the ledger.
|
|
114
|
+
* Uses atomic write: write to temp file then rename.
|
|
115
|
+
*
|
|
116
|
+
* @param directory - The working directory
|
|
117
|
+
* @param eventInput - Event data to append (without seq, timestamp, hashes)
|
|
118
|
+
* @param options - Optional concurrency control options
|
|
119
|
+
* @returns The full LedgerEvent that was written
|
|
120
|
+
*/
|
|
121
|
+
export declare function appendLedgerEvent(directory: string, eventInput: LedgerEventInput, options?: {
|
|
122
|
+
expectedSeq?: number;
|
|
123
|
+
expectedHash?: string;
|
|
124
|
+
planHashAfter?: string;
|
|
125
|
+
}): Promise<LedgerEvent>;
|
|
126
|
+
/**
|
|
127
|
+
* Append a ledger event with optimistic retry on stale-writer conflicts.
|
|
128
|
+
*
|
|
129
|
+
* When another writer advances the ledger between the caller's read and
|
|
130
|
+
* their append, `appendLedgerEvent` throws `LedgerStaleWriterError`. This
|
|
131
|
+
* helper wraps that call in a bounded retry loop, refreshing the
|
|
132
|
+
* `expectedHash` concurrency token against the current plan.json before
|
|
133
|
+
* each retry.
|
|
134
|
+
*
|
|
135
|
+
* IMPORTANT: refreshing the hash is only safe when the event input is
|
|
136
|
+
* *still semantically valid* after the intervening write. For audit
|
|
137
|
+
* events computed from an in-memory plan the caller is about to persist,
|
|
138
|
+
* it is always valid. For `task_status_changed` events, pass a
|
|
139
|
+
* `verifyValid` callback that returns false when the transition no
|
|
140
|
+
* longer applies (e.g. the task's on-disk status already matches the
|
|
141
|
+
* `to_status`, or has moved past it). When `verifyValid` returns false,
|
|
142
|
+
* the retry loop exits and the helper returns `null` to signal that the
|
|
143
|
+
* event was skipped — it is not an error.
|
|
144
|
+
*
|
|
145
|
+
* @param directory - Working directory containing `.swarm/plan-ledger.jsonl`
|
|
146
|
+
* @param eventInput - Event to append (required fields minus auto-generated)
|
|
147
|
+
* @param options - Concurrency and retry configuration:
|
|
148
|
+
* - expectedHash: the hash of plan.json the caller observed (REQUIRED)
|
|
149
|
+
* - planHashAfter: precomputed hash of the mutated plan
|
|
150
|
+
* - maxRetries: max stale-writer retries (default: 3)
|
|
151
|
+
* - backoffMs: base delay in milliseconds (default: 10; exponential)
|
|
152
|
+
* - verifyValid: callback invoked before each retry to confirm the
|
|
153
|
+
* event input is still meaningful. Returning false aborts and
|
|
154
|
+
* resolves the helper to `null`.
|
|
155
|
+
* @returns The written LedgerEvent, or `null` if verifyValid aborted.
|
|
156
|
+
* @throws LedgerStaleWriterError if retries are exhausted.
|
|
157
|
+
*/
|
|
158
|
+
export declare function appendLedgerEventWithRetry(directory: string, eventInput: LedgerEventInput, options: {
|
|
159
|
+
expectedHash: string;
|
|
160
|
+
planHashAfter?: string;
|
|
161
|
+
maxRetries?: number;
|
|
162
|
+
backoffMs?: number;
|
|
163
|
+
verifyValid?: () => Promise<boolean> | boolean;
|
|
164
|
+
}): Promise<LedgerEvent | null>;
|
|
165
|
+
/**
|
|
166
|
+
* Take a snapshot event and append it to the ledger.
|
|
167
|
+
* The snapshot embeds the full Plan payload for ledger-only rebuild.
|
|
168
|
+
*
|
|
169
|
+
* @param directory - The working directory
|
|
170
|
+
* @param plan - The current plan state to snapshot
|
|
171
|
+
* @param options - Optional configuration:
|
|
172
|
+
* - planHashAfter: precomputed hash of the mutated plan (bypasses the
|
|
173
|
+
* on-disk plan.json read when available)
|
|
174
|
+
* - source: attribution string stored on the ledger event. Defaults to
|
|
175
|
+
* `'takeSnapshotEvent'`. Use `'critic_approved'` to mark a snapshot as
|
|
176
|
+
* the immutable phase-approved checkpoint readable by
|
|
177
|
+
* `loadLastApprovedPlan`.
|
|
178
|
+
* - approvalMetadata: optional free-form metadata embedded into the
|
|
179
|
+
* snapshot payload (e.g. phase number, verdict, summary) so that
|
|
180
|
+
* downstream readers can filter without decoding prompts.
|
|
181
|
+
* @returns The LedgerEvent that was written
|
|
182
|
+
*/
|
|
183
|
+
export declare function takeSnapshotEvent(directory: string, plan: Plan, options?: {
|
|
184
|
+
planHashAfter?: string;
|
|
185
|
+
source?: string;
|
|
186
|
+
approvalMetadata?: Record<string, unknown>;
|
|
187
|
+
}): Promise<LedgerEvent>;
|
|
188
|
+
/**
|
|
189
|
+
* Options for replayFromLedger
|
|
190
|
+
*/
|
|
191
|
+
interface ReplayOptions {
|
|
192
|
+
/** If true, use the latest snapshot to speed up replay */
|
|
193
|
+
useSnapshot?: boolean;
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Replay ledger events to reconstruct plan state.
|
|
197
|
+
* Loads plan.json as the base state and applies ledger events in sequence.
|
|
198
|
+
*
|
|
199
|
+
* NOTE: This function requires plan.json to exist as the base state.
|
|
200
|
+
* The ledger only stores task_status_changed events, not the full plan payload.
|
|
201
|
+
* If plan.json is missing, replay cannot proceed — this is a known limitation.
|
|
202
|
+
* The fix would be to store the initial plan payload in the ledger, but that
|
|
203
|
+
* is a larger architectural change beyond the current scope.
|
|
204
|
+
*
|
|
205
|
+
* @param directory - The working directory
|
|
206
|
+
* @param options - Optional replay options
|
|
207
|
+
* @returns Reconstructed Plan from ledger events, or null if plan.json doesn't exist or ledger is empty
|
|
208
|
+
*/
|
|
209
|
+
export declare function replayFromLedger(directory: string, _options?: ReplayOptions): Promise<Plan | null>;
|
|
210
|
+
/**
|
|
211
|
+
* Result type for readLedgerEventsWithIntegrity
|
|
212
|
+
*/
|
|
213
|
+
export interface LedgerIntegrityResult {
|
|
214
|
+
/** Valid events up to (but not including) the first malformed line */
|
|
215
|
+
events: LedgerEvent[];
|
|
216
|
+
/** True if a bad line was found and replay was stopped early */
|
|
217
|
+
truncated: boolean;
|
|
218
|
+
/** Raw content from the first bad line to end of file, for quarantine */
|
|
219
|
+
badSuffix: string | null;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Read ledger events with integrity checking.
|
|
223
|
+
* Stops at the first malformed/unparseable line and returns the remainder for quarantine.
|
|
224
|
+
*
|
|
225
|
+
* @param directory - The working directory
|
|
226
|
+
* @returns LedgerIntegrityResult with events, truncated flag, and bad suffix
|
|
227
|
+
*/
|
|
228
|
+
export declare function readLedgerEventsWithIntegrity(directory: string): Promise<LedgerIntegrityResult>;
|
|
229
|
+
/**
|
|
230
|
+
* Quarantine a corrupted ledger suffix to a separate file.
|
|
231
|
+
* Does NOT modify the ledger file itself.
|
|
232
|
+
*
|
|
233
|
+
* @param directory - The working directory
|
|
234
|
+
* @param badSuffix - The corrupted content to quarantine
|
|
235
|
+
*/
|
|
236
|
+
export declare function quarantineLedgerSuffix(directory: string, badSuffix: string): Promise<void>;
|
|
237
|
+
/**
|
|
238
|
+
* Replay ledger events with integrity checking.
|
|
239
|
+
* If corruption is detected, quarantines the bad suffix and falls back to snapshot+prefix replay.
|
|
240
|
+
* Never throws — all errors return null.
|
|
241
|
+
*
|
|
242
|
+
* @param directory - The working directory
|
|
243
|
+
* @returns Reconstructed Plan from ledger events, or null if replay fails
|
|
244
|
+
*/
|
|
245
|
+
export declare function replayWithIntegrity(directory: string): Promise<Plan | null>;
|
|
246
|
+
/**
|
|
247
|
+
* Metadata describing an approved snapshot recovered from the ledger.
|
|
248
|
+
*/
|
|
249
|
+
export interface ApprovedSnapshotInfo {
|
|
250
|
+
/** The immutable plan payload captured at critic approval time */
|
|
251
|
+
plan: Plan;
|
|
252
|
+
/** The ledger sequence number of the snapshot event */
|
|
253
|
+
seq: number;
|
|
254
|
+
/** ISO 8601 timestamp of the snapshot event */
|
|
255
|
+
timestamp: string;
|
|
256
|
+
/** Arbitrary metadata the caller attached (phase, verdict, summary, ...) */
|
|
257
|
+
approval?: Record<string, unknown>;
|
|
258
|
+
/** Hash of the plan payload at snapshot time */
|
|
259
|
+
payloadHash: string;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Find the most recent critic-approved immutable plan snapshot in the ledger.
|
|
263
|
+
*
|
|
264
|
+
* Snapshots are tagged at write time with a distinguishing `source` string
|
|
265
|
+
* (see `takeSnapshotEvent`). The `critic_approved` marker identifies snapshots
|
|
266
|
+
* persisted by the orchestrator after a phase Critic returns APPROVED. This
|
|
267
|
+
* function scans the ledger in reverse order and returns the first matching
|
|
268
|
+
* snapshot, including its embedded plan payload and approval metadata.
|
|
269
|
+
*
|
|
270
|
+
* Intended for use as a fallback when plan.json is lost, overwritten, or
|
|
271
|
+
* suspected of drift: the Architect can fall back to the last approved plan
|
|
272
|
+
* and the Critic can drift-check against it.
|
|
273
|
+
*
|
|
274
|
+
* SAFETY: when `expectedPlanId` is supplied, only snapshots whose event
|
|
275
|
+
* `plan_id` matches are considered. Callers MUST pass an expected identity
|
|
276
|
+
* whenever they have one (e.g. from the ledger's first `plan_created` anchor)
|
|
277
|
+
* to prevent cross-identity contamination: a stale `critic_approved` snapshot
|
|
278
|
+
* left in a reused directory could otherwise be resurrected as the active plan.
|
|
279
|
+
*
|
|
280
|
+
* @param directory - Working directory containing `.swarm/plan-ledger.jsonl`
|
|
281
|
+
* @param expectedPlanId - Optional plan identity filter. When provided, only
|
|
282
|
+
* snapshots whose ledger event `plan_id` matches are considered.
|
|
283
|
+
* @returns The most recent approved snapshot info, or null if none exists
|
|
284
|
+
*/
|
|
285
|
+
export declare function loadLastApprovedPlan(directory: string, expectedPlanId?: string): Promise<ApprovedSnapshotInfo | null>;
|
|
286
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for retryCasWithBackoff — Phase 4 (CAS retry with exponential backoff).
|
|
3
|
+
*
|
|
4
|
+
* Verifies:
|
|
5
|
+
* - Backoff schedule: 5ms start, doubles each attempt, cap 250ms, ±25% jitter
|
|
6
|
+
* - plan_ledger_cas_retry telemetry is emitted on each retry (hash prefixes only)
|
|
7
|
+
* - PlanConcurrentModificationError is thrown when retries are exhausted
|
|
8
|
+
* - verifyValid returning false causes early exit without error
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed error for concurrent plan modification (#444 item 3).
|
|
3
|
+
* Thrown when savePlan exhausts CAS retries due to concurrent writers.
|
|
4
|
+
* Callers can catch this specifically to refresh and retry at the outer level.
|
|
5
|
+
*/
|
|
6
|
+
export declare class PlanConcurrentModificationError extends Error {
|
|
7
|
+
constructor(message: string);
|
|
8
|
+
}
|
|
9
|
+
import { type Plan, type RuntimePlan, type TaskStatus } from '../config/plan-schema';
|
|
10
|
+
import { type LedgerEvent, type LedgerEventInput } from './ledger';
|
|
11
|
+
/** Reset the startup ledger check flag. For testing only. */
|
|
12
|
+
export declare function resetStartupLedgerCheck(): void;
|
|
13
|
+
/**
|
|
14
|
+
* Append a ledger event with exponential-backoff retry on stale-writer conflicts.
|
|
15
|
+
*
|
|
16
|
+
* Replaces the raw `appendLedgerEventWithRetry` call in savePlan with a helper
|
|
17
|
+
* that uses the project-standard backoff schedule and emits observable telemetry
|
|
18
|
+
* on each retry. Hash values in telemetry are truncated to 8-char prefixes to
|
|
19
|
+
* avoid leaking full content hashes into event streams.
|
|
20
|
+
*
|
|
21
|
+
* Backoff schedule: start=5ms, doubles each attempt, cap=250ms, ±25% jitter.
|
|
22
|
+
*/
|
|
23
|
+
export declare function retryCasWithBackoff(directory: string, eventInput: LedgerEventInput, options: {
|
|
24
|
+
expectedHash: string;
|
|
25
|
+
planHashAfter?: string;
|
|
26
|
+
verifyValid?: () => Promise<boolean> | boolean;
|
|
27
|
+
maxRetries?: number;
|
|
28
|
+
}): Promise<LedgerEvent | null>;
|
|
29
|
+
/**
|
|
30
|
+
* Load plan.json ONLY without auto-migration from plan.md.
|
|
31
|
+
* Returns null if plan.json doesn't exist or is invalid.
|
|
32
|
+
* Use this when you want to check for structured plans without triggering migration.
|
|
33
|
+
*/
|
|
34
|
+
export declare function loadPlanJsonOnly(directory: string): Promise<Plan | null>;
|
|
35
|
+
/**
|
|
36
|
+
* Regenerate plan.md from valid plan.json (auto-heal case 1).
|
|
37
|
+
*/
|
|
38
|
+
export declare function regeneratePlanMarkdown(directory: string, plan: Plan): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Load and validate plan from .swarm/plan.json with auto-heal sync.
|
|
41
|
+
*
|
|
42
|
+
* 4-step precedence with auto-heal:
|
|
43
|
+
* 1. .swarm/plan.json exists AND validates ->
|
|
44
|
+
* a) If plan.md missing or stale -> regenerate plan.md from plan.json
|
|
45
|
+
* b) Return parsed Plan
|
|
46
|
+
* 2. .swarm/plan.json exists but FAILS validation ->
|
|
47
|
+
* a) If plan.md exists -> migrate from plan.md, save valid plan.json, then derive plan.md
|
|
48
|
+
* b) Return migrated Plan
|
|
49
|
+
* 3. .swarm/plan.md exists only -> migrate from plan.md, save both files, return Plan
|
|
50
|
+
* 4. Neither exists -> return null
|
|
51
|
+
*/
|
|
52
|
+
export declare function loadPlan(directory: string): Promise<RuntimePlan | null>;
|
|
53
|
+
/**
|
|
54
|
+
* Validate against PlanSchema (throw on invalid), write to .swarm/plan.json via atomic temp+rename pattern,
|
|
55
|
+
* then derive and write .swarm/plan.md
|
|
56
|
+
*/
|
|
57
|
+
export declare function savePlan(directory: string, plan: Plan, options?: {
|
|
58
|
+
preserveCompletedStatuses?: boolean;
|
|
59
|
+
}): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Rebuild plan from ledger events.
|
|
62
|
+
* Replays the ledger to reconstruct plan state, then writes the result.
|
|
63
|
+
* Uses direct atomic writes to avoid circular ledger append (savePlan appends ledger events).
|
|
64
|
+
*
|
|
65
|
+
* @param directory - The working directory
|
|
66
|
+
* @returns Reconstructed Plan from ledger, or null if ledger is empty/missing
|
|
67
|
+
*/
|
|
68
|
+
export declare function rebuildPlan(directory: string, plan?: Plan): Promise<Plan | null>;
|
|
69
|
+
/**
|
|
70
|
+
* Load plan → find task by ID → update status → save → return updated plan.
|
|
71
|
+
* Throw if plan not found or task not found.
|
|
72
|
+
*
|
|
73
|
+
* Uses loadPlan() (not loadPlanJsonOnly) so that legitimate same-identity ledger
|
|
74
|
+
* drift is detected and healed before the status update is applied. Without this,
|
|
75
|
+
* a stale plan.json would silently overwrite ledger-ahead task state with only the
|
|
76
|
+
* one targeted status change applied on top.
|
|
77
|
+
*
|
|
78
|
+
* The migration guard in loadPlan() (plan_id identity check) prevents destructive
|
|
79
|
+
* revert after a swarm rename — so this is safe even in post-migration scenarios.
|
|
80
|
+
*/
|
|
81
|
+
export declare function updateTaskStatus(directory: string, taskId: string, status: TaskStatus): Promise<Plan>;
|
|
82
|
+
/**
|
|
83
|
+
* Generate deterministic markdown view from plan object.
|
|
84
|
+
* Ensures stable ordering: phases by ID (ascending), tasks by ID (natural numeric).
|
|
85
|
+
*/
|
|
86
|
+
export declare function derivePlanMarkdown(plan: Plan): string;
|
|
87
|
+
/**
|
|
88
|
+
* Convert existing plan.md to plan.json. PURE function — no I/O.
|
|
89
|
+
*/
|
|
90
|
+
export declare function migrateLegacyPlan(planContent: string, swarmId?: string): Plan;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for the migration-aware identity guard in loadPlan()'s validation-failure
|
|
3
|
+
* catch path (lines ~299-323 of manager.ts).
|
|
4
|
+
*
|
|
5
|
+
* When plan.json fails schema validation, the old code unconditionally called
|
|
6
|
+
* replayFromLedger(). This allowed a post-migration ledger (old identity) to
|
|
7
|
+
* overwrite a schema-invalid but correctly migrated plan.json.
|
|
8
|
+
*
|
|
9
|
+
* The fix: extract swarm+title from the raw JSON (even if schema validation
|
|
10
|
+
* fails), compare against the first ledger event's plan_id, and only replay
|
|
11
|
+
* when identities match.
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Regression tests for GitHub issues #383/#384:
|
|
3
|
+
* PlanSyncWorker Aggressively Reverts Plan Files
|
|
4
|
+
*
|
|
5
|
+
* These tests verify that the fixes introduced in the debug-issues-383-384 branch
|
|
6
|
+
* prevent the destructive revert behavior and related edge cases.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Course Correction Module
|
|
3
|
+
* Generates structured guidance messages from pattern detection results
|
|
4
|
+
*/
|
|
5
|
+
import type { CourseCorrection, PatternMatch, TrajectoryEntry } from './types';
|
|
6
|
+
/**
|
|
7
|
+
* Generates a structured CourseCorrection guidance message from a PatternMatch and trajectory context
|
|
8
|
+
*
|
|
9
|
+
* @param match - The pattern match result from pattern detection
|
|
10
|
+
* @param trajectory - The trajectory entries providing context for the correction
|
|
11
|
+
* @returns A structured CourseCorrection object with alert, category, guidance, action, pattern, and stepRange
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateCourseCorrection(match: PatternMatch, trajectory: TrajectoryEntry[]): CourseCorrection;
|
|
14
|
+
/**
|
|
15
|
+
* Formats a CourseCorrection for injection into agent messages
|
|
16
|
+
*
|
|
17
|
+
* @param correction - The course correction to format
|
|
18
|
+
* @returns A formatted string suitable for injection into messages
|
|
19
|
+
*/
|
|
20
|
+
export declare function formatCourseCorrectionForInjection(correction: CourseCorrection): string;
|