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,39 @@
|
|
|
1
|
+
import { type FileNode, type RepoGraph } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Build a full repository graph by walking the workspace, parsing source files
|
|
4
|
+
* for imports and exported symbols, and assembling them into a `RepoGraph`.
|
|
5
|
+
*
|
|
6
|
+
* Performance:
|
|
7
|
+
* - File scanning skips well-known build/dep directories (node_modules, dist, .git, etc.)
|
|
8
|
+
* - Per-file parsing runs with a concurrency limit to avoid overwhelming I/O.
|
|
9
|
+
* - Files larger than `MAX_FILE_SIZE_BYTES` are skipped (would also fail downstream extractors).
|
|
10
|
+
*
|
|
11
|
+
* Targets ~5s for a 50k LOC repo (~500 files) on commodity hardware.
|
|
12
|
+
*/
|
|
13
|
+
export interface BuildOptions {
|
|
14
|
+
/** Optional cap on file count to bound runtime on huge repos. */
|
|
15
|
+
maxFiles?: number;
|
|
16
|
+
/** Concurrency for per-file parsing. Defaults to 16. */
|
|
17
|
+
concurrency?: number;
|
|
18
|
+
/** Additional directory names to skip (merged with defaults). */
|
|
19
|
+
skipDirs?: string[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Hard upper bound on file count if the caller does not supply one. Protects
|
|
23
|
+
* against unbounded memory growth on extremely large monorepos. Callers can
|
|
24
|
+
* pass an explicit `maxFiles` (including a larger one) to override.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEFAULT_MAX_FILES = 10000;
|
|
27
|
+
/**
|
|
28
|
+
* Walk the workspace and return absolute paths of all supported source files.
|
|
29
|
+
* Cross-platform: emits absolute paths using the host's path separator.
|
|
30
|
+
*/
|
|
31
|
+
export declare function findSourceFiles(workspaceRoot: string, skipDirs?: Set<string>): string[];
|
|
32
|
+
/**
|
|
33
|
+
* Build the repo graph from scratch.
|
|
34
|
+
*/
|
|
35
|
+
export declare function buildRepoGraph(workspaceRoot: string, options?: BuildOptions): Promise<RepoGraph>;
|
|
36
|
+
/**
|
|
37
|
+
* Process a single file into a FileNode. Returns null if the file cannot be processed.
|
|
38
|
+
*/
|
|
39
|
+
export declare function processFile(absoluteFilePath: string, workspaceRoot: string): Promise<FileNode | null>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { BlastRadiusResult, FileNode, FileReference, LocalizationBlock, RepoGraph, SymbolReference } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Query API for the repo graph.
|
|
4
|
+
*
|
|
5
|
+
* All functions accept normalized RELATIVE forward-slash paths and return the
|
|
6
|
+
* same. Callers responsible for normalizing input paths (helper provided).
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizeGraphPath(p: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Files that import the given file (direct dependents).
|
|
11
|
+
*/
|
|
12
|
+
export declare function getImporters(graph: RepoGraph, filePath: string): FileReference[];
|
|
13
|
+
/**
|
|
14
|
+
* Files this file imports (direct dependencies, resolved targets only).
|
|
15
|
+
*/
|
|
16
|
+
export declare function getDependencies(graph: RepoGraph, filePath: string): FileReference[];
|
|
17
|
+
/**
|
|
18
|
+
* Find all importers of a specific exported symbol from a file.
|
|
19
|
+
*/
|
|
20
|
+
export declare function getSymbolConsumers(graph: RepoGraph, filePath: string, symbolName: string): SymbolReference[];
|
|
21
|
+
/**
|
|
22
|
+
* Compute the transitive blast radius of changing one or more files.
|
|
23
|
+
*
|
|
24
|
+
* Performs a BFS over the reverse-edge index up to `maxDepth` levels.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getBlastRadius(graph: RepoGraph, filePaths: string[], maxDepth?: number): BlastRadiusResult;
|
|
27
|
+
/**
|
|
28
|
+
* Top-N most-imported files (by in-degree) — useful for surfacing
|
|
29
|
+
* architectural pillars.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getKeyFiles(graph: RepoGraph, topN?: number): FileNode[];
|
|
32
|
+
/**
|
|
33
|
+
* Build a compact localization block for a single file. This is the primary
|
|
34
|
+
* payload injected into the coder agent's pre-edit context.
|
|
35
|
+
*/
|
|
36
|
+
export declare function getLocalizationContext(graph: RepoGraph, filePath: string, options?: {
|
|
37
|
+
maxImporters?: number;
|
|
38
|
+
maxDeps?: number;
|
|
39
|
+
maxDepth?: number;
|
|
40
|
+
}): LocalizationBlock;
|
|
41
|
+
/** Reset the cached reverse index. Call this when a graph is mutated in place. */
|
|
42
|
+
export declare function resetQueryCache(): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type RepoGraph } from './types';
|
|
2
|
+
export declare function getGraphPath(workspaceRoot: string): string;
|
|
3
|
+
export declare function loadGraph(workspaceRoot: string): RepoGraph | null;
|
|
4
|
+
export declare function saveGraph(workspaceRoot: string, graph: RepoGraph): void;
|
|
5
|
+
/**
|
|
6
|
+
* Build the graph from scratch and persist it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function buildAndSaveGraph(workspaceRoot: string): Promise<RepoGraph>;
|
|
9
|
+
/**
|
|
10
|
+
* Apply incremental updates for a list of changed (or potentially-changed) files.
|
|
11
|
+
*
|
|
12
|
+
* For each file:
|
|
13
|
+
* - If the file no longer exists, its node is removed.
|
|
14
|
+
* - Otherwise its node is re-parsed and replaced.
|
|
15
|
+
*
|
|
16
|
+
* Returns the updated graph (mutated in place AND returned for convenience).
|
|
17
|
+
* Caller must call `saveGraph` to persist if desired.
|
|
18
|
+
*/
|
|
19
|
+
export declare function updateGraphIncremental(workspaceRoot: string, changedRelativePaths: string[], graph: RepoGraph): Promise<RepoGraph>;
|
|
20
|
+
/**
|
|
21
|
+
* Determine if a stored graph is fresh enough to reuse.
|
|
22
|
+
*
|
|
23
|
+
* Default freshness window: 5 minutes. Files added/removed outside this
|
|
24
|
+
* window are not detected without an explicit incremental update — callers
|
|
25
|
+
* that care about up-to-the-second accuracy should rebuild.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isGraphFresh(graph: RepoGraph | null, maxAgeMs?: number): boolean;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ImportEdge } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Extract import edges from a source file.
|
|
4
|
+
*
|
|
5
|
+
* Uses regex-based parsing (the same proven approach as `src/tools/imports.ts`
|
|
6
|
+
* and `src/tools/co-change-analyzer.ts`). Tree-sitter is intentionally not used
|
|
7
|
+
* here because:
|
|
8
|
+
* 1. The existing regex patterns are battle-tested across the codebase.
|
|
9
|
+
* 2. Import statements have stable, simple syntax that regex handles reliably.
|
|
10
|
+
* 3. Avoiding the per-file Tree-sitter parse keeps full-graph builds fast
|
|
11
|
+
* enough to be interactive (target: <5s for 50k LOC).
|
|
12
|
+
*
|
|
13
|
+
* Supported languages:
|
|
14
|
+
* - TypeScript / JavaScript (.ts/.tsx/.js/.jsx/.mjs/.cjs) — ES modules + CJS require
|
|
15
|
+
* - Python (.py) — `import x` and `from x import y`
|
|
16
|
+
* - Go (.go) — `import "path"` and `import (...)` blocks
|
|
17
|
+
* - Rust (.rs) — `use path::module`
|
|
18
|
+
*
|
|
19
|
+
* Only RELATIVE imports are tracked as graph edges. External package imports
|
|
20
|
+
* (e.g. 'react', 'fmt', 'std::fs') are skipped — they are not part of the
|
|
21
|
+
* intra-repo dependency graph.
|
|
22
|
+
*/
|
|
23
|
+
export interface ExtractImportsOptions {
|
|
24
|
+
/** Absolute path to the source file (used for relative resolution). */
|
|
25
|
+
absoluteFilePath: string;
|
|
26
|
+
/** Absolute workspace root (used for relative path computation). */
|
|
27
|
+
workspaceRoot: string;
|
|
28
|
+
/** Optional pre-read content; if omitted the file is read from disk. */
|
|
29
|
+
content?: string;
|
|
30
|
+
}
|
|
31
|
+
/** Source file extensions we know how to scan. */
|
|
32
|
+
export declare const SOURCE_EXTENSIONS: readonly [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".py", ".go", ".rs"];
|
|
33
|
+
export declare function getLanguageFromExtension(ext: string): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Extract import edges for a single file. Returns an empty array when the
|
|
36
|
+
* language is unsupported or the file cannot be parsed.
|
|
37
|
+
*
|
|
38
|
+
* Resolution strategy for edge.target:
|
|
39
|
+
* - TS/JS: probe extensions (.ts, .tsx, .js, .jsx, .mjs, .cjs, /index.*).
|
|
40
|
+
* - Python: probe .py and /__init__.py for relative imports only.
|
|
41
|
+
* - Go/Rust: target left empty (intra-repo resolution requires module/crate
|
|
42
|
+
* metadata that is out of scope for Phase 1). The raw module is preserved.
|
|
43
|
+
*/
|
|
44
|
+
export declare function extractImports(opts: ExtractImportsOptions): ImportEdge[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repo graph: structural codebase awareness for swarm agents.
|
|
3
|
+
*
|
|
4
|
+
* Public surface:
|
|
5
|
+
* - Types (RepoGraph, FileNode, ImportEdge, ExportedSymbol, ...)
|
|
6
|
+
* - Builders (buildRepoGraph, processFile, findSourceFiles)
|
|
7
|
+
* - Store (loadGraph, saveGraph, buildAndSaveGraph, updateGraphIncremental, isGraphFresh, getGraphPath)
|
|
8
|
+
* - Query (getImporters, getDependencies, getSymbolConsumers, getBlastRadius,
|
|
9
|
+
* getKeyFiles, getLocalizationContext, normalizeGraphPath, resetQueryCache)
|
|
10
|
+
*/
|
|
11
|
+
export { type BuildOptions, buildRepoGraph, findSourceFiles, processFile, } from './graph-builder';
|
|
12
|
+
export { getBlastRadius, getDependencies, getImporters, getKeyFiles, getLocalizationContext, getSymbolConsumers, normalizeGraphPath, resetQueryCache, } from './graph-query';
|
|
13
|
+
export { buildAndSaveGraph, getGraphPath, isGraphFresh, loadGraph, saveGraph, updateGraphIncremental, } from './graph-store';
|
|
14
|
+
export { extractImports, getLanguageFromExtension, SOURCE_EXTENSIONS, } from './import-extractor';
|
|
15
|
+
export { extractExportedSymbols } from './symbol-extractor';
|
|
16
|
+
export * from './types';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ExportedSymbol } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Extract exported symbols from a single file.
|
|
4
|
+
*
|
|
5
|
+
* Reuses the proven regex-based extractors from `src/tools/symbols.ts`
|
|
6
|
+
* (`extractTSSymbols` / `extractPythonSymbols`) and maps their internal
|
|
7
|
+
* SymbolInfo shape to our `ExportedSymbol` type.
|
|
8
|
+
*
|
|
9
|
+
* For Go and Rust, exported-symbol extraction is best-effort (out of scope
|
|
10
|
+
* for Phase 1) — empty arrays are returned. The graph still tracks file-level
|
|
11
|
+
* import edges for these languages.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* @param relativeFilePath - file path relative to workspace root (forward-slash)
|
|
15
|
+
* @param workspaceRoot - absolute workspace root
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractExportedSymbols(relativeFilePath: string, workspaceRoot: string): ExportedSymbol[];
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repo graph data structures.
|
|
3
|
+
*
|
|
4
|
+
* The graph captures structural relationships between source files
|
|
5
|
+
* (imports/exports) so agents can reason about blast radius before editing.
|
|
6
|
+
*
|
|
7
|
+
* All paths are RELATIVE to the workspace root and FORWARD-SLASH normalized
|
|
8
|
+
* for cross-platform comparison.
|
|
9
|
+
*/
|
|
10
|
+
export type ImportType = 'named' | 'default' | 'namespace' | 'sideeffect' | 'require';
|
|
11
|
+
export interface ImportEdge {
|
|
12
|
+
/** Importing file (relative, forward-slash). */
|
|
13
|
+
source: string;
|
|
14
|
+
/** Resolved imported file (relative, forward-slash). May be empty for unresolved imports. */
|
|
15
|
+
target: string;
|
|
16
|
+
/** Raw module specifier as written in the source (e.g. '../utils/path-security'). */
|
|
17
|
+
rawModule: string;
|
|
18
|
+
/** Named imports brought in (empty for sideeffect/namespace/default). */
|
|
19
|
+
importedSymbols: string[];
|
|
20
|
+
/** What kind of import statement this is. */
|
|
21
|
+
importType: ImportType;
|
|
22
|
+
/** 1-indexed line number where the import appears. */
|
|
23
|
+
line: number;
|
|
24
|
+
}
|
|
25
|
+
export type SymbolKind = 'function' | 'class' | 'interface' | 'type' | 'enum' | 'const' | 'variable' | 'method' | 'property';
|
|
26
|
+
export interface ExportedSymbol {
|
|
27
|
+
name: string;
|
|
28
|
+
kind: SymbolKind;
|
|
29
|
+
signature?: string;
|
|
30
|
+
line: number;
|
|
31
|
+
}
|
|
32
|
+
export interface FileNode {
|
|
33
|
+
/** Relative, forward-slash path. */
|
|
34
|
+
path: string;
|
|
35
|
+
/** Detected language id (e.g. 'typescript', 'python', 'go', 'rust'). */
|
|
36
|
+
language: string;
|
|
37
|
+
/** Symbols this file exports (or top-level definitions for languages without explicit exports). */
|
|
38
|
+
exports: ExportedSymbol[];
|
|
39
|
+
/** Outgoing import edges from this file. */
|
|
40
|
+
imports: ImportEdge[];
|
|
41
|
+
/** mtime of the source file (ms epoch) for incremental updates. */
|
|
42
|
+
mtimeMs: number;
|
|
43
|
+
}
|
|
44
|
+
export interface RepoGraph {
|
|
45
|
+
/** Schema version for migration. */
|
|
46
|
+
version: number;
|
|
47
|
+
/** ISO timestamp when this graph was built. */
|
|
48
|
+
buildTimestamp: string;
|
|
49
|
+
/** Workspace root used at build time (absolute, for diagnostics only). */
|
|
50
|
+
rootDir: string;
|
|
51
|
+
/** Files keyed by their relative forward-slash path. */
|
|
52
|
+
files: Record<string, FileNode>;
|
|
53
|
+
}
|
|
54
|
+
export interface FileReference {
|
|
55
|
+
file: string;
|
|
56
|
+
line?: number;
|
|
57
|
+
importType?: ImportType;
|
|
58
|
+
}
|
|
59
|
+
export interface SymbolReference {
|
|
60
|
+
file: string;
|
|
61
|
+
line: number;
|
|
62
|
+
importedAs: string;
|
|
63
|
+
}
|
|
64
|
+
export interface BlastRadiusResult {
|
|
65
|
+
target: string[];
|
|
66
|
+
directDependents: string[];
|
|
67
|
+
transitiveDependents: string[];
|
|
68
|
+
depthReached: number;
|
|
69
|
+
totalDependents: number;
|
|
70
|
+
riskLevel: 'low' | 'medium' | 'high' | 'critical';
|
|
71
|
+
}
|
|
72
|
+
export interface LocalizationBlock {
|
|
73
|
+
target: string;
|
|
74
|
+
importerCount: number;
|
|
75
|
+
importers: FileReference[];
|
|
76
|
+
dependencyCount: number;
|
|
77
|
+
dependencies: FileReference[];
|
|
78
|
+
exportedSymbolsUsedExternally: string[];
|
|
79
|
+
blastRadius: BlastRadiusResult;
|
|
80
|
+
/** Compact human/LLM-readable summary suitable for context injection. */
|
|
81
|
+
summary: string;
|
|
82
|
+
}
|
|
83
|
+
export declare const REPO_GRAPH_SCHEMA_VERSION = 1;
|
|
84
|
+
export declare const REPO_GRAPH_FILENAME = "repo-graph.json";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { PluginConfig } from '../config';
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the model for a given agent by checking config overrides,
|
|
4
|
+
* swarm configurations, and falling back to defaults.
|
|
5
|
+
*/
|
|
6
|
+
export declare function resolveAgentModel(agentName: string, config: PluginConfig): string;
|
|
7
|
+
/**
|
|
8
|
+
* Detect if two agents share the same model (adversarial pair).
|
|
9
|
+
* Returns the shared model string if matched, null otherwise.
|
|
10
|
+
*/
|
|
11
|
+
export declare function detectAdversarialPair(agentA: string, agentB: string, config: PluginConfig): string | null;
|
|
12
|
+
/**
|
|
13
|
+
* Format an adversarial warning message based on policy.
|
|
14
|
+
*/
|
|
15
|
+
export declare function formatAdversarialWarning(agentA: string, agentB: string, sharedModel: string, policy: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Adversarial pattern detection for semantic analysis of agent outputs.
|
|
18
|
+
* Uses string/regex matching to detect sophisticated adversarial behaviors.
|
|
19
|
+
*/
|
|
20
|
+
export interface AdversarialPatternMatch {
|
|
21
|
+
pattern: 'PRECEDENT_MANIPULATION' | 'SELF_REVIEW' | 'CONTENT_EXEMPTION' | 'GATE_DELEGATION_BYPASS' | 'VELOCITY_RATIONALIZATION' | 'INTER_AGENT_MANIPULATION' | 'GATE_MISCLASSIFICATION' | 'REJECTION_SPIRAL';
|
|
22
|
+
severity: 'HIGHEST' | 'HIGH' | 'MEDIUM' | 'LOW';
|
|
23
|
+
matchedText: string;
|
|
24
|
+
confidence: 'HIGH' | 'MEDIUM' | 'LOW';
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Detect adversarial patterns in agent output text.
|
|
28
|
+
* Returns array of matches or empty array if no patterns detected.
|
|
29
|
+
*/
|
|
30
|
+
export declare function detectAdversarialPatterns(text: string): AdversarialPatternMatch[];
|
|
31
|
+
/**
|
|
32
|
+
* Format a precedent manipulation detection event for JSONL emission.
|
|
33
|
+
*/
|
|
34
|
+
export declare function formatPrecedentManipulationEvent(match: AdversarialPatternMatch, agentName: string, phase: number): string;
|
|
35
|
+
export declare function formatDebuggingSpiralEvent(match: AdversarialPatternMatch, taskId: string): string;
|
|
36
|
+
export declare function handleDebuggingSpiral(match: AdversarialPatternMatch, taskId: string, directory: string): Promise<{
|
|
37
|
+
eventLogged: boolean;
|
|
38
|
+
checkpointCreated: boolean;
|
|
39
|
+
message: string;
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Record a tool call for debugging spiral detection.
|
|
43
|
+
* Call this from toolAfter to track repetitive patterns.
|
|
44
|
+
*/
|
|
45
|
+
export declare function recordToolCall(tool: string, args: unknown, sessionId: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Detect debugging spiral: same tool called 5+ times in a row with similar args
|
|
48
|
+
* within a 5-minute window. Indicates the agent is stuck in a loop.
|
|
49
|
+
*/
|
|
50
|
+
export declare function detectDebuggingSpiral(_directory: string, sessionId: string): Promise<AdversarialPatternMatch | null>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Activity Tracking Hooks
|
|
3
|
+
*
|
|
4
|
+
* Tracks tool usage through tool.execute.before and tool.execute.after hooks.
|
|
5
|
+
* Records timing, success/failure, and periodically flushes aggregated stats.
|
|
6
|
+
*/
|
|
7
|
+
import type { PluginConfig } from '../config/schema';
|
|
8
|
+
/**
|
|
9
|
+
* Creates agent activity tracking hooks
|
|
10
|
+
* @param config Plugin configuration
|
|
11
|
+
* @param directory Project directory path
|
|
12
|
+
* @returns Tool before and after hook handlers
|
|
13
|
+
*/
|
|
14
|
+
export declare function createAgentActivityHooks(config: PluginConfig, directory: string): {
|
|
15
|
+
toolBefore: (input: {
|
|
16
|
+
tool: string;
|
|
17
|
+
sessionID: string;
|
|
18
|
+
callID: string;
|
|
19
|
+
}, output: {
|
|
20
|
+
args: unknown;
|
|
21
|
+
}) => Promise<void>;
|
|
22
|
+
toolAfter: (input: {
|
|
23
|
+
tool: string;
|
|
24
|
+
sessionID: string;
|
|
25
|
+
callID: string;
|
|
26
|
+
}, output: {
|
|
27
|
+
title: string;
|
|
28
|
+
output: string;
|
|
29
|
+
metadata: unknown;
|
|
30
|
+
}) => Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Flushes activity data to context.md file
|
|
34
|
+
* Ensures only one flush operation runs at a time
|
|
35
|
+
* @param directory Project directory path
|
|
36
|
+
*/
|
|
37
|
+
declare function flushActivityToFile(directory: string): Promise<void>;
|
|
38
|
+
export { flushActivityToFile as _flushForTesting };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Co-Change Suggester Hook
|
|
3
|
+
*
|
|
4
|
+
* Analyzes file modifications and suggests co-change partners based on
|
|
5
|
+
* historical co-change data from .swarm/co-change.json. This hook fires
|
|
6
|
+
* after file-write tools complete and logs suggestions when co-change
|
|
7
|
+
* partners are detected.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Represents a single co-change entry from the JSON file
|
|
11
|
+
*/
|
|
12
|
+
export interface CoChangeJsonEntry {
|
|
13
|
+
/** First file in the co-change pair */
|
|
14
|
+
fileA: string;
|
|
15
|
+
/** Second file in the co-change pair */
|
|
16
|
+
fileB: string;
|
|
17
|
+
/** Number of times these files were changed together */
|
|
18
|
+
coChangeCount: number;
|
|
19
|
+
/** Normalized Pointwise Mutual Information score (0-1) */
|
|
20
|
+
npmi: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Root structure of the co-change JSON file
|
|
24
|
+
*/
|
|
25
|
+
export interface CoChangeJson {
|
|
26
|
+
/** File format version */
|
|
27
|
+
version: string;
|
|
28
|
+
/** ISO timestamp when the file was generated */
|
|
29
|
+
generated: string;
|
|
30
|
+
/** Array of co-change entries */
|
|
31
|
+
entries: CoChangeJsonEntry[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Reads and parses the .swarm/co-change.json file
|
|
35
|
+
* @param directory - The project directory containing .swarm folder
|
|
36
|
+
* @returns Parsed CoChangeJson or null if not found/invalid
|
|
37
|
+
*/
|
|
38
|
+
export declare function readCoChangeJson(directory: string): Promise<CoChangeJson | null>;
|
|
39
|
+
/**
|
|
40
|
+
* Finds co-change partners for a given file
|
|
41
|
+
* @param entries - Array of co-change entries to search
|
|
42
|
+
* @param filePath - The file path to find partners for
|
|
43
|
+
* @returns Array of entries where the file appears as fileA or fileB
|
|
44
|
+
*/
|
|
45
|
+
export declare function getCoChangePartnersForFile(entries: CoChangeJsonEntry[], filePath: string): CoChangeJsonEntry[];
|
|
46
|
+
/**
|
|
47
|
+
* Creates the co-change suggester hook
|
|
48
|
+
* @param directory - The project directory containing .swarm folder
|
|
49
|
+
* @returns A hook function that analyzes file writes for co-change suggestions
|
|
50
|
+
*/
|
|
51
|
+
export declare function createCoChangeSuggesterHook(directory: string): (input: unknown, output: unknown) => Promise<void>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compaction Customizer Hook
|
|
3
|
+
*
|
|
4
|
+
* Enhances session compaction by injecting swarm context from plan.md and context.md.
|
|
5
|
+
* Adds current phase information and key decisions to the compaction context.
|
|
6
|
+
*/
|
|
7
|
+
import type { PluginConfig } from '../config';
|
|
8
|
+
/**
|
|
9
|
+
* Creates the experimental.session.compacting hook for compaction customization.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createCompactionCustomizerHook(config: PluginConfig, directory: string): Record<string, unknown>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AgentConflictDetectedEvent } from '../types/events.js';
|
|
2
|
+
export interface ResolveAgentConflictInput {
|
|
3
|
+
sessionID: string;
|
|
4
|
+
phase: number;
|
|
5
|
+
taskId?: string;
|
|
6
|
+
sourceAgent: AgentConflictDetectedEvent['sourceAgent'];
|
|
7
|
+
targetAgent: AgentConflictDetectedEvent['targetAgent'];
|
|
8
|
+
conflictType: AgentConflictDetectedEvent['conflictType'];
|
|
9
|
+
rejectionCount?: number;
|
|
10
|
+
summary: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function resolveAgentConflict(input: ResolveAgentConflictInput): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Budget Tracker Hook
|
|
3
|
+
*
|
|
4
|
+
* Estimates token usage across all messages and injects budget warnings
|
|
5
|
+
* when thresholds are exceeded. Uses experimental.chat.messages.transform
|
|
6
|
+
* to provide proactive context management guidance to the architect agent.
|
|
7
|
+
*/
|
|
8
|
+
import type { PluginConfig } from '../config';
|
|
9
|
+
interface MessageInfo {
|
|
10
|
+
role: string;
|
|
11
|
+
agent?: string;
|
|
12
|
+
sessionID?: string;
|
|
13
|
+
modelID?: string;
|
|
14
|
+
providerID?: string;
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
interface MessagePart {
|
|
18
|
+
type: string;
|
|
19
|
+
text?: string;
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
interface MessageWithParts {
|
|
23
|
+
info: MessageInfo;
|
|
24
|
+
parts: MessagePart[];
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates the experimental.chat.messages.transform hook for context budget tracking.
|
|
28
|
+
* Injects warnings when context usage exceeds configured thresholds.
|
|
29
|
+
* Only operates on messages for the architect agent.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createContextBudgetHandler(config: PluginConfig): (_input: Record<string, never>, _output: {
|
|
32
|
+
messages?: MessageWithParts[];
|
|
33
|
+
}) => Promise<void>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context Scoring Utility
|
|
3
|
+
*
|
|
4
|
+
* Pure scoring/ranking helpers for context injection budget.
|
|
5
|
+
* Implements deterministic, reproducible candidate ranking based on configurable weights.
|
|
6
|
+
*/
|
|
7
|
+
export type ContentType = 'prose' | 'code' | 'markdown' | 'json';
|
|
8
|
+
export type CandidateKind = 'phase' | 'task' | 'decision' | 'evidence' | 'agent_context';
|
|
9
|
+
export interface ContextCandidate {
|
|
10
|
+
id: string;
|
|
11
|
+
kind: CandidateKind;
|
|
12
|
+
text: string;
|
|
13
|
+
tokens: number;
|
|
14
|
+
priority: number;
|
|
15
|
+
metadata: {
|
|
16
|
+
contentType: ContentType;
|
|
17
|
+
dependencyDepth?: number;
|
|
18
|
+
decisionAgeHours?: number;
|
|
19
|
+
isCurrentTask?: boolean;
|
|
20
|
+
isBlockedTask?: boolean;
|
|
21
|
+
hasFailure?: boolean;
|
|
22
|
+
hasSuccess?: boolean;
|
|
23
|
+
hasEvidence?: boolean;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface RankedCandidate extends ContextCandidate {
|
|
27
|
+
score: number;
|
|
28
|
+
}
|
|
29
|
+
export interface ScoringWeights {
|
|
30
|
+
phase: number;
|
|
31
|
+
current_task: number;
|
|
32
|
+
blocked_task: number;
|
|
33
|
+
recent_failure: number;
|
|
34
|
+
recent_success: number;
|
|
35
|
+
evidence_presence: number;
|
|
36
|
+
decision_recency: number;
|
|
37
|
+
dependency_proximity: number;
|
|
38
|
+
}
|
|
39
|
+
export interface DecisionDecayConfig {
|
|
40
|
+
mode: 'linear' | 'exponential';
|
|
41
|
+
half_life_hours: number;
|
|
42
|
+
}
|
|
43
|
+
export interface TokenRatios {
|
|
44
|
+
prose: number;
|
|
45
|
+
code: number;
|
|
46
|
+
markdown: number;
|
|
47
|
+
json: number;
|
|
48
|
+
}
|
|
49
|
+
export interface ScoringConfig {
|
|
50
|
+
enabled: boolean;
|
|
51
|
+
max_candidates: number;
|
|
52
|
+
weights: ScoringWeights;
|
|
53
|
+
decision_decay: DecisionDecayConfig;
|
|
54
|
+
token_ratios: TokenRatios;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Rank context candidates by importance score.
|
|
58
|
+
*
|
|
59
|
+
* Scoring formula:
|
|
60
|
+
* - base_score = sum of (weight * feature_flag)
|
|
61
|
+
* - For items with dependency depth: adjusted_score = base_score / (1 + depth)
|
|
62
|
+
* - For decisions with age: age_factor = 2^(-age_hours / half_life_hours), score = decision_recency * age_factor
|
|
63
|
+
*
|
|
64
|
+
* Tie-breaker: score desc → priority desc → id asc (stable sort)
|
|
65
|
+
*
|
|
66
|
+
* @param candidates - Array of context candidates
|
|
67
|
+
* @param config - Scoring configuration
|
|
68
|
+
* @returns Ranked candidates (truncated to max_candidates, original order if disabled)
|
|
69
|
+
*/
|
|
70
|
+
export declare function rankCandidates(candidates: ContextCandidate[], config: ScoringConfig): RankedCandidate[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { CriticDriftResult, CuratorConfig, CuratorPhaseResult, DriftReport } from './curator-types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Read all prior drift reports from .swarm/drift-report-phase-*.json files.
|
|
4
|
+
* Returns reports sorted ascending by phase number.
|
|
5
|
+
* Skips corrupt/unreadable files with a console.warn.
|
|
6
|
+
*/
|
|
7
|
+
export declare function readPriorDriftReports(directory: string): Promise<DriftReport[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Write a drift report to .swarm/drift-report-phase-{N}.json.
|
|
10
|
+
* Creates .swarm/ if it doesn't exist.
|
|
11
|
+
* Returns the absolute path of the written file.
|
|
12
|
+
*/
|
|
13
|
+
export declare function writeDriftReport(directory: string, report: DriftReport): Promise<string>;
|
|
14
|
+
/**
|
|
15
|
+
* Deterministic drift check for the given phase.
|
|
16
|
+
* Builds a structured DriftReport from curator data, plan, spec, and prior reports.
|
|
17
|
+
* Writes the report to .swarm/drift-report-phase-N.json.
|
|
18
|
+
* Emits 'curator.drift.completed' event on success.
|
|
19
|
+
* On any error: emits 'curator.error' event and returns a safe default result.
|
|
20
|
+
* NEVER throws — drift failures must not block phase_complete.
|
|
21
|
+
*/
|
|
22
|
+
export declare function runDeterministicDriftCheck(directory: string, phase: number, curatorResult: CuratorPhaseResult, config: CuratorConfig, injectAdvisory?: (message: string) => void): Promise<CriticDriftResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Build a truncated summary suitable for architect context injection.
|
|
25
|
+
* Format: "<drift_report>Phase N: {alignment} ({drift_score}) — {key finding}. {correction if any}.</drift_report>"
|
|
26
|
+
* Truncate to maxChars (simple slice). Tags may be broken when truncation occurs mid-tag.
|
|
27
|
+
* If ALIGNED with drift_score < 0.1: minimal output "Phase N: ALIGNED, all requirements on track."
|
|
28
|
+
* If MINOR_DRIFT or worse: include first_deviation and top correction.
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildDriftInjectionText(report: DriftReport, maxChars: number): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CuratorLLMDelegate } from './curator.js';
|
|
2
|
+
/**
|
|
3
|
+
* Create a CuratorLLMDelegate that uses the opencode SDK to call
|
|
4
|
+
* the registered curator agent in CURATOR_INIT or CURATOR_PHASE mode.
|
|
5
|
+
*
|
|
6
|
+
* Uses an ephemeral session (create → prompt → delete) to avoid
|
|
7
|
+
* re-entrancy with the current session's message flow.
|
|
8
|
+
*
|
|
9
|
+
* The `mode` parameter determines which registered named agent is used:
|
|
10
|
+
* - 'init' → curator_init (e.g. 'curator_init' or 'swarm1_curator_init')
|
|
11
|
+
* - 'phase' → curator_phase (e.g. 'curator_phase' or 'swarm1_curator_phase')
|
|
12
|
+
*
|
|
13
|
+
* The optional `sessionId` parameter enables deterministic swarm resolution:
|
|
14
|
+
* when provided, the factory uses the calling session's registered agent to
|
|
15
|
+
* identify the swarm prefix, rather than scanning all active sessions.
|
|
16
|
+
* Pass `ctx?.sessionID` from tool handlers that have it available.
|
|
17
|
+
*
|
|
18
|
+
* Returns undefined if swarmState.opencodeClient is not set (e.g. in unit tests).
|
|
19
|
+
*/
|
|
20
|
+
export declare function createCuratorLLMDelegate(directory: string, mode?: 'init' | 'phase', sessionId?: string): CuratorLLMDelegate | undefined;
|