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,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Curator types — phase context consolidation and drift detection.
|
|
3
|
+
* No runtime logic. Types only.
|
|
4
|
+
*/
|
|
5
|
+
import type { KnowledgeCategory } from './knowledge-types.js';
|
|
6
|
+
/** Curator summary — anchored iterative format. Persisted to .swarm/curator-summary.json */
|
|
7
|
+
export interface CuratorSummary {
|
|
8
|
+
schema_version: 1;
|
|
9
|
+
session_id: string;
|
|
10
|
+
last_updated: string;
|
|
11
|
+
last_phase_covered: number;
|
|
12
|
+
/** Running digest — extended each phase, never regenerated */
|
|
13
|
+
digest: string;
|
|
14
|
+
/** Phase-level digests for lookup */
|
|
15
|
+
phase_digests: PhaseDigestEntry[];
|
|
16
|
+
/** Accumulated compliance observations */
|
|
17
|
+
compliance_observations: ComplianceObservation[];
|
|
18
|
+
/** Knowledge update recommendations from the last curator run */
|
|
19
|
+
knowledge_recommendations: KnowledgeRecommendation[];
|
|
20
|
+
}
|
|
21
|
+
export interface PhaseDigestEntry {
|
|
22
|
+
phase: number;
|
|
23
|
+
timestamp: string;
|
|
24
|
+
summary: string;
|
|
25
|
+
agents_used: string[];
|
|
26
|
+
tasks_completed: number;
|
|
27
|
+
tasks_total: number;
|
|
28
|
+
key_decisions: string[];
|
|
29
|
+
blockers_resolved: string[];
|
|
30
|
+
}
|
|
31
|
+
export interface ComplianceObservation {
|
|
32
|
+
phase: number;
|
|
33
|
+
timestamp: string;
|
|
34
|
+
type: 'missing_reviewer' | 'missing_retro' | 'missing_sme' | 'skipped_test' | 'workflow_deviation';
|
|
35
|
+
description: string;
|
|
36
|
+
severity: 'info' | 'warning';
|
|
37
|
+
}
|
|
38
|
+
export interface KnowledgeRecommendation {
|
|
39
|
+
action: 'promote' | 'archive' | 'flag_contradiction' | 'rewrite';
|
|
40
|
+
entry_id?: string;
|
|
41
|
+
lesson: string;
|
|
42
|
+
reason: string;
|
|
43
|
+
category?: KnowledgeCategory;
|
|
44
|
+
confidence?: number;
|
|
45
|
+
}
|
|
46
|
+
/** Drift report — produced by critic after curator phase run */
|
|
47
|
+
export interface DriftReport {
|
|
48
|
+
schema_version: 1;
|
|
49
|
+
phase: number;
|
|
50
|
+
timestamp: string;
|
|
51
|
+
/** Overall alignment verdict */
|
|
52
|
+
alignment: 'ALIGNED' | 'MINOR_DRIFT' | 'MAJOR_DRIFT' | 'OFF_SPEC';
|
|
53
|
+
/** Severity score 0.0-1.0 (0 = perfectly aligned, 1 = completely off-spec) */
|
|
54
|
+
drift_score: number;
|
|
55
|
+
/** First deviation point if drift detected */
|
|
56
|
+
first_deviation: {
|
|
57
|
+
phase: number;
|
|
58
|
+
task: string;
|
|
59
|
+
description: string;
|
|
60
|
+
} | null;
|
|
61
|
+
/** Compounding effects across phases */
|
|
62
|
+
compounding_effects: string[];
|
|
63
|
+
/** Recommended course corrections */
|
|
64
|
+
corrections: string[];
|
|
65
|
+
/** Spec requirements checked */
|
|
66
|
+
requirements_checked: number;
|
|
67
|
+
/** Spec requirements satisfied */
|
|
68
|
+
requirements_satisfied: number;
|
|
69
|
+
/** Scope additions not in original plan */
|
|
70
|
+
scope_additions: string[];
|
|
71
|
+
/** Truncated summary for architect context injection */
|
|
72
|
+
injection_summary: string;
|
|
73
|
+
}
|
|
74
|
+
export interface CuratorConfig {
|
|
75
|
+
enabled: boolean;
|
|
76
|
+
init_enabled: boolean;
|
|
77
|
+
phase_enabled: boolean;
|
|
78
|
+
max_summary_tokens: number;
|
|
79
|
+
min_knowledge_confidence: number;
|
|
80
|
+
compliance_report: boolean;
|
|
81
|
+
suppress_warnings: boolean;
|
|
82
|
+
drift_inject_max_chars: number;
|
|
83
|
+
llm_timeout_ms?: number;
|
|
84
|
+
}
|
|
85
|
+
export interface CuratorInitResult {
|
|
86
|
+
briefing: string;
|
|
87
|
+
contradictions: string[];
|
|
88
|
+
knowledge_entries_reviewed: number;
|
|
89
|
+
prior_phases_covered: number;
|
|
90
|
+
}
|
|
91
|
+
export interface CuratorPhaseResult {
|
|
92
|
+
phase: number;
|
|
93
|
+
digest: PhaseDigestEntry;
|
|
94
|
+
compliance: ComplianceObservation[];
|
|
95
|
+
knowledge_recommendations: KnowledgeRecommendation[];
|
|
96
|
+
summary_updated: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface CriticDriftResult {
|
|
99
|
+
phase: number;
|
|
100
|
+
report: DriftReport;
|
|
101
|
+
report_path: string;
|
|
102
|
+
injection_text: string;
|
|
103
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Curator core — file I/O for curator summary persistence.
|
|
3
|
+
* Extended incrementally: filterPhaseEvents, checkPhaseCompliance,
|
|
4
|
+
* runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates added in subsequent tasks.
|
|
5
|
+
*
|
|
6
|
+
* LLM delegation: runCuratorPhase and runCuratorInit accept an optional llmDelegate
|
|
7
|
+
* callback for LLM-based analysis. When provided, the prepared data context is sent
|
|
8
|
+
* to the explorer agent in CURATOR_PHASE/CURATOR_INIT mode for richer analysis.
|
|
9
|
+
* When the delegate is absent or fails, falls back to data-only behavior.
|
|
10
|
+
*
|
|
11
|
+
* ## Curator Agent Dispatch Modes
|
|
12
|
+
*
|
|
13
|
+
* Curator agents are dispatched in two ways:
|
|
14
|
+
*
|
|
15
|
+
* 1. **Factory dispatch** (standard): Created via `createCuratorAgent` from curator-agent.ts,
|
|
16
|
+
* exposed through agents/index.ts. These appear in agent lists and are part of the
|
|
17
|
+
* standard agent factory.
|
|
18
|
+
*
|
|
19
|
+
* 2. **Hook dispatch** (internal): curator.ts imports CURATOR_INIT_PROMPT and CURATOR_PHASE_PROMPT
|
|
20
|
+
* from explorer.ts and dispatches curator analysis directly via hook callbacks. These
|
|
21
|
+
* hook-dispatched curators do NOT go through the standard agent factory and are NOT
|
|
22
|
+
* included in agent lists (e.g., AGENTS.md, agent discovery, the agent registry).
|
|
23
|
+
*
|
|
24
|
+
* This dual dispatch means agent lists are incomplete — they capture factory-dispatched
|
|
25
|
+
* curators but omit hook-dispatched ones. This is by design for hook-internal operations.
|
|
26
|
+
*/
|
|
27
|
+
import type { ComplianceObservation, CuratorConfig, CuratorInitResult, CuratorPhaseResult, CuratorSummary, KnowledgeRecommendation } from './curator-types.js';
|
|
28
|
+
import type { KnowledgeConfig } from './knowledge-types.js';
|
|
29
|
+
/**
|
|
30
|
+
* Optional LLM delegate callback type.
|
|
31
|
+
* Takes a system prompt and user input, returns the LLM output text.
|
|
32
|
+
* Used to delegate analysis to the explorer agent in CURATOR mode.
|
|
33
|
+
*/
|
|
34
|
+
export type CuratorLLMDelegate = (systemPrompt: string, userInput: string, signal?: AbortSignal) => Promise<string>;
|
|
35
|
+
/**
|
|
36
|
+
* Parse OBSERVATIONS section from curator LLM output.
|
|
37
|
+
* Expected format per line: "- entry <uuid> (<observable>): [text]"
|
|
38
|
+
* Observable types: appears high-confidence, appears stale, could be tighter,
|
|
39
|
+
* contradicts project state, new candidate
|
|
40
|
+
* Action hints are extracted from parenthetical directives like "(suggests boost confidence, mark hive_eligible)"
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseKnowledgeRecommendations(llmOutput: string): KnowledgeRecommendation[];
|
|
43
|
+
/**
|
|
44
|
+
* Read curator summary from .swarm/curator-summary.json
|
|
45
|
+
* @param directory - The workspace directory
|
|
46
|
+
* @returns CuratorSummary if valid, null if missing or invalid
|
|
47
|
+
*/
|
|
48
|
+
export declare function readCuratorSummary(directory: string): Promise<CuratorSummary | null>;
|
|
49
|
+
/**
|
|
50
|
+
* Write curator summary to .swarm/curator-summary.json
|
|
51
|
+
* @param directory - The workspace directory
|
|
52
|
+
* @param summary - The curator summary to write
|
|
53
|
+
*/
|
|
54
|
+
export declare function writeCuratorSummary(directory: string, summary: CuratorSummary): Promise<void>;
|
|
55
|
+
/**
|
|
56
|
+
* Filter events from JSONL by phase or timestamp.
|
|
57
|
+
* @param eventsJsonl - Raw JSONL string of events
|
|
58
|
+
* @param phase - Phase number to filter by
|
|
59
|
+
* @param sinceTimestamp - Optional ISO 8601 timestamp to filter events after
|
|
60
|
+
* @returns Array of parsed event objects
|
|
61
|
+
*/
|
|
62
|
+
export declare function filterPhaseEvents(eventsJsonl: string, phase: number, sinceTimestamp?: string): object[];
|
|
63
|
+
/**
|
|
64
|
+
* Check compliance for a phase based on events and dispatched agents.
|
|
65
|
+
* @param phaseEvents - Array of events for the phase
|
|
66
|
+
* @param agentsDispatched - List of agent names that were dispatched
|
|
67
|
+
* @param requiredAgents - List of required agent names for this phase
|
|
68
|
+
* @param phase - Phase number
|
|
69
|
+
* @returns Array of compliance observations
|
|
70
|
+
*/
|
|
71
|
+
export declare function checkPhaseCompliance(phaseEvents: object[], agentsDispatched: string[], requiredAgents: string[], phase: number): ComplianceObservation[];
|
|
72
|
+
/**
|
|
73
|
+
* Prepare curator init data: reads prior summary, knowledge entries, and context.md.
|
|
74
|
+
* When an llmDelegate is provided, delegates to the explorer agent in CURATOR_INIT mode
|
|
75
|
+
* for LLM-based analysis that enhances the data-only briefing.
|
|
76
|
+
* @param directory - The workspace directory
|
|
77
|
+
* @param config - Curator configuration
|
|
78
|
+
* @param llmDelegate - Optional LLM delegate for enhanced analysis
|
|
79
|
+
* @returns CuratorInitResult with briefing text, contradictions, and stats
|
|
80
|
+
*/
|
|
81
|
+
export declare function runCuratorInit(directory: string, config: CuratorConfig, llmDelegate?: CuratorLLMDelegate): Promise<CuratorInitResult>;
|
|
82
|
+
/**
|
|
83
|
+
* Run curator phase analysis: reads events, runs compliance, updates and writes summary.
|
|
84
|
+
* When an llmDelegate is provided, delegates to the explorer agent in CURATOR_PHASE mode
|
|
85
|
+
* for LLM-based architectural drift analysis and knowledge recommendations.
|
|
86
|
+
* @param directory - The workspace directory
|
|
87
|
+
* @param phase - The phase number that just completed
|
|
88
|
+
* @param agentsDispatched - List of agent names dispatched in this phase
|
|
89
|
+
* @param config - Curator configuration
|
|
90
|
+
* @param knowledgeConfig - Knowledge configuration (used for knowledge path resolution)
|
|
91
|
+
* @param llmDelegate - Optional LLM delegate for enhanced analysis
|
|
92
|
+
* @returns CuratorPhaseResult with digest, compliance, and recommendations
|
|
93
|
+
*/
|
|
94
|
+
export declare function runCuratorPhase(directory: string, phase: number, agentsDispatched: string[], config: CuratorConfig, _knowledgeConfig: {
|
|
95
|
+
directory?: string;
|
|
96
|
+
}, llmDelegate?: CuratorLLMDelegate): Promise<CuratorPhaseResult>;
|
|
97
|
+
/**
|
|
98
|
+
* Apply curator knowledge recommendations: promote, archive, or flag contradictions.
|
|
99
|
+
* Uses readKnowledge + rewriteKnowledge pattern for atomic updates.
|
|
100
|
+
* @param directory - The workspace directory
|
|
101
|
+
* @param recommendations - Array of knowledge recommendations to apply
|
|
102
|
+
* @param knowledgeConfig - Knowledge configuration (for path resolution)
|
|
103
|
+
* @returns Counts of applied and skipped recommendations
|
|
104
|
+
*/
|
|
105
|
+
export declare function applyCuratorKnowledgeUpdates(directory: string, recommendations: KnowledgeRecommendation[], knowledgeConfig: KnowledgeConfig): Promise<{
|
|
106
|
+
applied: number;
|
|
107
|
+
skipped: number;
|
|
108
|
+
}>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dark Matter Detector Hook
|
|
3
|
+
*
|
|
4
|
+
* This hook reads `.swarm/dark-matter.md` — a markdown file that lists
|
|
5
|
+
* unresolved coupling gaps. When unconsumed items exist in this file,
|
|
6
|
+
* the hook logs a reminder hint to the user.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Parses dark matter gaps from markdown content
|
|
10
|
+
*
|
|
11
|
+
* @param content - The markdown content to parse
|
|
12
|
+
* @returns Object containing arrays of unresolved and resolved gap descriptions
|
|
13
|
+
*/
|
|
14
|
+
export declare function parseDarkMatterGaps(content: string): {
|
|
15
|
+
unresolved: string[];
|
|
16
|
+
resolved: string[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Reads and parses the dark matter gaps file
|
|
20
|
+
*
|
|
21
|
+
* @param directory - The project directory containing .swarm folder
|
|
22
|
+
* @returns Object with unresolved and resolved gaps, or null if file not found/empty
|
|
23
|
+
*/
|
|
24
|
+
export declare function readDarkMatterMd(directory: string): Promise<{
|
|
25
|
+
unresolved: string[];
|
|
26
|
+
resolved: string[];
|
|
27
|
+
} | null>;
|
|
28
|
+
/**
|
|
29
|
+
* Creates the dark matter detector hook
|
|
30
|
+
*
|
|
31
|
+
* This hook fires on `toolAfter` and checks for unresolved coupling gaps
|
|
32
|
+
* in `.swarm/dark-matter.md`. It logs a reminder hint when gaps exist,
|
|
33
|
+
* with rate-limiting to avoid excessive file I/O.
|
|
34
|
+
*
|
|
35
|
+
* @param directory - The project directory containing .swarm folder
|
|
36
|
+
* @returns Hook function that checks for unresolved dark matter gaps
|
|
37
|
+
*/
|
|
38
|
+
export declare function createDarkMatterDetectorHook(directory: string): (input: unknown, output: unknown) => Promise<void>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegation Gate Hook
|
|
3
|
+
*
|
|
4
|
+
* Warns the architect when coder delegations are too large or batched.
|
|
5
|
+
* Uses experimental.chat.messages.transform to provide non-blocking guidance.
|
|
6
|
+
*/
|
|
7
|
+
import type { PluginConfig } from '../config';
|
|
8
|
+
import type { DelegationEnvelope, EnvelopeValidationResult } from '../types/delegation.js';
|
|
9
|
+
/**
|
|
10
|
+
* v6.33.1 CRIT-1: Fallback map for declared coder scope by taskId.
|
|
11
|
+
* When messagesTransform sets declaredCoderScope on the architect session,
|
|
12
|
+
* the coder session may not exist yet. This map allows scope-guard to look up
|
|
13
|
+
* the scope by taskId when the session's declaredCoderScope is null.
|
|
14
|
+
*
|
|
15
|
+
* v6.70.0 gap-closure: this map is module-scoped (not inside `swarmState`) and
|
|
16
|
+
* is cleared by `resetSwarmState` via `clearPendingCoderScope()` below. Without
|
|
17
|
+
* that cleanup, a `/swarm close` followed by a new session with a colliding
|
|
18
|
+
* taskId (e.g. "1.1") would inherit stale scope from the previous swarm.
|
|
19
|
+
*/
|
|
20
|
+
export declare const pendingCoderScopeByTaskId: Map<string, string[]>;
|
|
21
|
+
/**
|
|
22
|
+
* v6.70.0 gap-closure: clears the pending coder-scope map. Exported as a
|
|
23
|
+
* helper (rather than importing the map directly from state.ts) to avoid the
|
|
24
|
+
* circular import `state.ts ↔ delegation-gate.ts`. Called by `resetSwarmState`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function clearPendingCoderScope(): void;
|
|
27
|
+
/**
|
|
28
|
+
* Parses a string to extract a DelegationEnvelope.
|
|
29
|
+
* Returns null if no valid envelope is found.
|
|
30
|
+
* Never throws - all errors are caught and result in null.
|
|
31
|
+
*/
|
|
32
|
+
export declare function parseDelegationEnvelope(content: string, directory?: string): DelegationEnvelope | null;
|
|
33
|
+
interface ValidationContext {
|
|
34
|
+
planTasks: string[];
|
|
35
|
+
validAgents: string[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Validates a DelegationEnvelope against the current plan and agent list.
|
|
39
|
+
* Returns { valid: true } on success, or { valid: false; reason: string } on failure.
|
|
40
|
+
*/
|
|
41
|
+
export declare function validateDelegationEnvelope(envelope: unknown, context: ValidationContext): EnvelopeValidationResult;
|
|
42
|
+
interface MessageInfo {
|
|
43
|
+
role: string;
|
|
44
|
+
agent?: string;
|
|
45
|
+
sessionID?: string;
|
|
46
|
+
}
|
|
47
|
+
interface MessagePart {
|
|
48
|
+
type: string;
|
|
49
|
+
text?: string;
|
|
50
|
+
[key: string]: unknown;
|
|
51
|
+
}
|
|
52
|
+
interface MessageWithParts {
|
|
53
|
+
info: MessageInfo;
|
|
54
|
+
parts: MessagePart[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Creates the experimental.chat.messages.transform hook for delegation gating.
|
|
58
|
+
* Inspects coder delegations and warns when tasks are oversized or batched.
|
|
59
|
+
*/
|
|
60
|
+
export declare function createDelegationGateHook(config: PluginConfig, directory: string): {
|
|
61
|
+
messagesTransform: (input: Record<string, never>, output: {
|
|
62
|
+
messages?: MessageWithParts[];
|
|
63
|
+
}) => Promise<void>;
|
|
64
|
+
toolBefore: (input: {
|
|
65
|
+
tool: string;
|
|
66
|
+
sessionID: string;
|
|
67
|
+
callID: string;
|
|
68
|
+
}, output: {
|
|
69
|
+
args: unknown;
|
|
70
|
+
}) => Promise<void>;
|
|
71
|
+
toolAfter: (input: {
|
|
72
|
+
tool: string;
|
|
73
|
+
sessionID: string;
|
|
74
|
+
callID: string;
|
|
75
|
+
args?: Record<string, unknown>;
|
|
76
|
+
}, output: unknown) => Promise<void>;
|
|
77
|
+
};
|
|
78
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* delegation-gate.getEvidenceTaskId.test.ts
|
|
3
|
+
*
|
|
4
|
+
* Verification tests for the async conversion of getEvidenceTaskId.
|
|
5
|
+
* Tests the function behavior by recreating its logic in isolation since
|
|
6
|
+
* the function is private (not exported) and depends on fs.promises.
|
|
7
|
+
*
|
|
8
|
+
* Covers:
|
|
9
|
+
* 1. Function returns a Promise (is async)
|
|
10
|
+
* 2. Function resolves to correct task ID when currentTaskId is set
|
|
11
|
+
* 3. Function resolves to correct task ID when lastCoderDelegationTaskId is set
|
|
12
|
+
* 4. Function falls back to taskWorkflowStates when above are null
|
|
13
|
+
* 5. Function returns null when plan.json doesn't exist (ENOENT)
|
|
14
|
+
* 6. Function returns null when plan.json has no in_progress tasks
|
|
15
|
+
* 7. Function returns null when session has direct task_id (early return path via currentTaskId)
|
|
16
|
+
* 8. Path traversal is blocked (security hardening)
|
|
17
|
+
* 9. Malformed JSON returns null
|
|
18
|
+
* 10. Empty/invalid directory returns null
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Adversarial security tests for getEvidenceTaskId plan.json fallback.
|
|
3
|
+
*
|
|
4
|
+
* Tests security-hardened fallback mechanism that reads .swarm/plan.json only after
|
|
5
|
+
* exhausting live task state. Focuses on attack vectors:
|
|
6
|
+
* - Path traversal via plan.json path
|
|
7
|
+
* - Malformed durable state (JSON bombs, circular refs)
|
|
8
|
+
* - Invalid directory inputs
|
|
9
|
+
* - Oversized/hostile inputs
|
|
10
|
+
* - Boundary violations
|
|
11
|
+
* - Symlink attacks
|
|
12
|
+
*/
|
|
13
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for Task 3.16: Propagate turboMode through evidence recording
|
|
3
|
+
*
|
|
4
|
+
* This verifies that when a session has turboMode enabled, the turbo flag is
|
|
5
|
+
* recorded in the evidence JSON files for all agent delegations (reviewer,
|
|
6
|
+
* test_engineer, docs, designer, critic, explorer, sme, coder).
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Verification tests for callID→evidenceTaskId map in delegation-gate.ts
|
|
3
|
+
*
|
|
4
|
+
* Tests verify the map behavior indirectly through evidence recording outcomes:
|
|
5
|
+
* 1. Map stores callID→evidenceTaskId after determining the taskId
|
|
6
|
+
* 2. Map is checked first before getEvidenceTaskId fallback
|
|
7
|
+
* 3. Map entry is cleaned up after successful evidence recording
|
|
8
|
+
* 4. Map entry is cleaned up even when evidence recording errors
|
|
9
|
+
* 5. Fallback works when storedTaskId is not in map
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DELEGATION LEDGER (v6.31 Task 3.2)
|
|
3
|
+
*
|
|
4
|
+
* tool.execute.after hook that maintains a per-session in-memory ledger of tool calls
|
|
5
|
+
* made during a delegation. When the architect session receives a message (resume),
|
|
6
|
+
* injects a compact DELEGATION SUMMARY via pendingAdvisoryMessages.
|
|
7
|
+
*
|
|
8
|
+
* No file I/O — fully in-memory.
|
|
9
|
+
*/
|
|
10
|
+
export interface LedgerEntry {
|
|
11
|
+
agent: string;
|
|
12
|
+
tool: string;
|
|
13
|
+
file?: string;
|
|
14
|
+
duration_ms: number;
|
|
15
|
+
success: boolean;
|
|
16
|
+
timestamp: number;
|
|
17
|
+
}
|
|
18
|
+
export interface DelegationLedgerConfig {
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Creates the delegation ledger hook pair (toolAfter + summary injection).
|
|
23
|
+
*/
|
|
24
|
+
export declare function createDelegationLedgerHook(config: Partial<DelegationLedgerConfig>, _directory: string, // reserved for future use
|
|
25
|
+
injectAdvisory: (sessionId: string, message: string) => void): {
|
|
26
|
+
toolAfter: (input: {
|
|
27
|
+
tool: string;
|
|
28
|
+
sessionID: string;
|
|
29
|
+
callID: string;
|
|
30
|
+
args?: Record<string, unknown>;
|
|
31
|
+
}, output: {
|
|
32
|
+
title: string;
|
|
33
|
+
output: string;
|
|
34
|
+
metadata: unknown;
|
|
35
|
+
}) => Promise<void>;
|
|
36
|
+
onArchitectResume: (sessionId: string) => void;
|
|
37
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* delegation-ledger.test.ts
|
|
3
|
+
*
|
|
4
|
+
* Tests for delegation-ledger hook (Task 3.2):
|
|
5
|
+
* 1. toolAfter records entries in ledgerBySession
|
|
6
|
+
* 2. onArchitectResume generates DELEGATION SUMMARY when non-architect tool calls exist
|
|
7
|
+
* 3. onArchitectResume is no-op when no entries exist
|
|
8
|
+
* 4. Success is false when output starts with 'Error:'
|
|
9
|
+
* 5. Success is true for normal output
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegation message sanitization - Layer 2 defense against inter-agent manipulation.
|
|
3
|
+
* Strips attempt metadata, urgency references, and consequence claims from gate agent messages.
|
|
4
|
+
*/
|
|
5
|
+
declare const SANITIZATION_PATTERNS: RegExp[];
|
|
6
|
+
/**
|
|
7
|
+
* Sanitize a message by stripping manipulation patterns.
|
|
8
|
+
* Returns sanitized text and logs if any stripping occurred.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sanitizeMessage(text: string, patterns?: RegExp[]): {
|
|
11
|
+
sanitized: string;
|
|
12
|
+
modified: boolean;
|
|
13
|
+
stripped: string[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Check if message is to a gate agent (reviewer, test_engineer, critic).
|
|
17
|
+
*/
|
|
18
|
+
export declare function isGateAgentMessage(agentName: string): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Create a hook that sanitizes delegation messages to gate agents.
|
|
21
|
+
* @param directory - The project directory containing the .swarm folder
|
|
22
|
+
*/
|
|
23
|
+
export declare function createDelegationSanitizerHook(directory: string): (input: unknown, output: unknown) => Promise<void>;
|
|
24
|
+
export { SANITIZATION_PATTERNS };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegation Tracker Hook
|
|
3
|
+
*
|
|
4
|
+
* Tracks agent delegation by monitoring chat.message events with agent fields.
|
|
5
|
+
* Updates the active agent map and optionally logs delegation chain entries.
|
|
6
|
+
*/
|
|
7
|
+
import type { PluginConfig } from '../config/schema';
|
|
8
|
+
export type { DelegationReason } from '../state';
|
|
9
|
+
/**
|
|
10
|
+
* Creates the chat.message hook for delegation tracking.
|
|
11
|
+
*/
|
|
12
|
+
export declare function createDelegationTrackerHook(config: PluginConfig, guardrailsEnabled?: boolean): (input: {
|
|
13
|
+
sessionID: string;
|
|
14
|
+
agent?: string;
|
|
15
|
+
}, output: Record<string, unknown>) => Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Diff scope validator — compares files changed in git against the declared scope
|
|
3
|
+
* for a given task in plan.json. Returns a warning string if undeclared files
|
|
4
|
+
* were modified, or null if in-scope, no scope declared, or git unavailable.
|
|
5
|
+
* Never throws.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Validate that git-changed files match the declared scope for a task.
|
|
9
|
+
* Returns a warning string if undeclared files were modified, null otherwise.
|
|
10
|
+
* Never throws.
|
|
11
|
+
*/
|
|
12
|
+
export declare function validateDiffScope(taskId: string, directory: string): Promise<string | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { Plan } from '../config/plan-schema';
|
|
2
|
+
/**
|
|
3
|
+
* Swarm File Extractors
|
|
4
|
+
*
|
|
5
|
+
* Pure parsing functions for extracting structured data from .swarm/ files.
|
|
6
|
+
* Used by system-enhancer and compaction-customizer hooks.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Extracts the current phase information from plan content.
|
|
10
|
+
*/
|
|
11
|
+
export declare function extractCurrentPhase(planContent: string): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Extracts the first incomplete task from the current IN PROGRESS phase.
|
|
14
|
+
*/
|
|
15
|
+
export declare function extractCurrentTask(planContent: string): string | null;
|
|
16
|
+
/**
|
|
17
|
+
* Extracts decisions section from context content.
|
|
18
|
+
*/
|
|
19
|
+
export declare function extractDecisions(contextContent: string, maxChars?: number): string | null;
|
|
20
|
+
/**
|
|
21
|
+
* Extracts incomplete tasks from plan content under the current IN PROGRESS phase.
|
|
22
|
+
*/
|
|
23
|
+
export declare function extractIncompleteTasks(planContent: string, maxChars?: number): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Extracts patterns section from context content.
|
|
26
|
+
*/
|
|
27
|
+
export declare function extractPatterns(contextContent: string, maxChars?: number): string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Extracts current phase info from a Plan object.
|
|
30
|
+
*/
|
|
31
|
+
export declare function extractCurrentPhaseFromPlan(plan: Plan): string | null;
|
|
32
|
+
/**
|
|
33
|
+
* Extracts the first incomplete task from the current phase of a Plan object.
|
|
34
|
+
*/
|
|
35
|
+
export declare function extractCurrentTaskFromPlan(plan: Plan): string | null;
|
|
36
|
+
/**
|
|
37
|
+
* Extracts incomplete tasks from the current phase of a Plan object.
|
|
38
|
+
*/
|
|
39
|
+
export declare function extractIncompleteTasksFromPlan(plan: Plan, maxChars?: number): string | null;
|
|
40
|
+
/**
|
|
41
|
+
* Extracts plan cursor - a concise summary of current phase, current task,
|
|
42
|
+
* and lookahead tasks for context-aware agent communication.
|
|
43
|
+
*
|
|
44
|
+
* @param planContent - The raw plan markdown content
|
|
45
|
+
* @param options - Optional configuration
|
|
46
|
+
* @param options.maxTokens - Target max tokens (default 1500, ~6000 chars)
|
|
47
|
+
* @param options.lookaheadTasks - Number of lookahead tasks (default 2)
|
|
48
|
+
* @returns A [SWARM PLAN CURSOR] block with phase summaries and task details
|
|
49
|
+
*/
|
|
50
|
+
export declare function extractPlanCursor(planContent: string, options?: {
|
|
51
|
+
maxTokens?: number;
|
|
52
|
+
lookaheadTasks?: number;
|
|
53
|
+
}): string;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Full-Auto Intercept Hook
|
|
3
|
+
*
|
|
4
|
+
* Intercepts architect messages in full-auto mode and triggers autonomous oversight
|
|
5
|
+
* when the architect outputs escalation patterns (questions, phase completion prompts).
|
|
6
|
+
*
|
|
7
|
+
* This hook runs as a chat.message transform — it inspects the architect's output
|
|
8
|
+
* and injects the critic's autonomous oversight response when escalation is detected.
|
|
9
|
+
*/
|
|
10
|
+
import type { PluginConfig } from '../config';
|
|
11
|
+
interface MessageWithParts {
|
|
12
|
+
info: {
|
|
13
|
+
role: string;
|
|
14
|
+
agent?: string;
|
|
15
|
+
sessionID?: string;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
parts: Array<{
|
|
19
|
+
type: string;
|
|
20
|
+
text?: string;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Result from critic dispatch — used to inject verdict into message stream.
|
|
26
|
+
*/
|
|
27
|
+
interface CriticDispatchResult {
|
|
28
|
+
verdict: string;
|
|
29
|
+
reasoning: string;
|
|
30
|
+
evidenceChecked: string[];
|
|
31
|
+
antiPatternsDetected: string[];
|
|
32
|
+
escalationNeeded: boolean;
|
|
33
|
+
rawResponse: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Parses the critic's structured text response into a CriticDispatchResult.
|
|
37
|
+
* The critic response format is:
|
|
38
|
+
* VERDICT: APPROVED | NEEDS_REVISION | ...
|
|
39
|
+
* REASONING: [text with possible multi-line content]
|
|
40
|
+
* EVIDENCE_CHECKED: [list]
|
|
41
|
+
* ANTI_PATTERNS_DETECTED: [list or "none"]
|
|
42
|
+
* ESCALATION_NEEDED: YES | NO
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseCriticResponse(rawResponse: string): CriticDispatchResult;
|
|
45
|
+
/**
|
|
46
|
+
* Injects the critic's verdict as an assistant message after the architect's message.
|
|
47
|
+
* This makes the verdict visible in the chat without modifying the architect's output.
|
|
48
|
+
*
|
|
49
|
+
* Verdict handling:
|
|
50
|
+
* - ANSWER: injects critic's reasoning as the assistant's answer
|
|
51
|
+
* - ESCALATE_TO_HUMAN: triggers escalation (handled separately)
|
|
52
|
+
* - APPROVED / NEEDS_REVISION / REJECTED / BLOCKED / REPHRASE: injects verdict message
|
|
53
|
+
*/
|
|
54
|
+
export declare function injectVerdictIntoMessages(messages: MessageWithParts[], architectIndex: number, criticResult: CriticDispatchResult, escalationType: 'phase_completion' | 'question', oversightAgentName: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Handles critic dispatch and writes the auto_oversight event after the critic responds.
|
|
57
|
+
*
|
|
58
|
+
* This function encapsulates the critic invocation and event writing flow.
|
|
59
|
+
* The critic response is awaited before writing the event to events.jsonl.
|
|
60
|
+
*/
|
|
61
|
+
export declare function dispatchCriticAndWriteEvent(directory: string, architectOutput: string, criticContext: string, criticModel: string, escalationType: 'phase_completion' | 'question', interactionCount: number, deadlockCount: number, oversightAgentName: string): Promise<CriticDispatchResult>;
|
|
62
|
+
/**
|
|
63
|
+
* Creates the full-auto intercept hook factory.
|
|
64
|
+
*
|
|
65
|
+
* This hook intercepts architect messages in full-auto mode and triggers
|
|
66
|
+
* autonomous oversight when escalation patterns are detected.
|
|
67
|
+
*
|
|
68
|
+
* @param config - Plugin configuration containing full_auto settings
|
|
69
|
+
* @param directory - Working directory from plugin init context
|
|
70
|
+
* @returns Hook object with messagesTransform function
|
|
71
|
+
*/
|
|
72
|
+
export declare function createFullAutoInterceptHook(config: PluginConfig, directory: string): {
|
|
73
|
+
messagesTransform: (input: Record<string, never>, output: {
|
|
74
|
+
messages?: MessageWithParts[];
|
|
75
|
+
}) => Promise<void>;
|
|
76
|
+
};
|
|
77
|
+
export {};
|