@soleri/core 9.0.3 → 9.2.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/dist/brain/intelligence.d.ts +27 -0
- package/dist/brain/intelligence.d.ts.map +1 -1
- package/dist/brain/intelligence.js +160 -14
- package/dist/brain/intelligence.js.map +1 -1
- package/dist/brain/learning-radar.d.ts +4 -0
- package/dist/brain/learning-radar.d.ts.map +1 -1
- package/dist/brain/learning-radar.js +20 -1
- package/dist/brain/learning-radar.js.map +1 -1
- package/dist/brain/strength-scorer.d.ts +31 -0
- package/dist/brain/strength-scorer.d.ts.map +1 -0
- package/dist/brain/strength-scorer.js +264 -0
- package/dist/brain/strength-scorer.js.map +1 -0
- package/dist/chat/agent-loop.d.ts.map +1 -1
- package/dist/chat/agent-loop.js +2 -0
- package/dist/chat/agent-loop.js.map +1 -1
- package/dist/chat/notifications.d.ts.map +1 -1
- package/dist/chat/notifications.js +2 -0
- package/dist/chat/notifications.js.map +1 -1
- package/dist/claudemd/compose.js +1 -1
- package/dist/claudemd/compose.js.map +1 -1
- package/dist/control/intent-router.d.ts.map +1 -1
- package/dist/control/intent-router.js +12 -4
- package/dist/control/intent-router.js.map +1 -1
- package/dist/curator/contradiction-detector.d.ts +27 -0
- package/dist/curator/contradiction-detector.d.ts.map +1 -0
- package/dist/curator/contradiction-detector.js +62 -0
- package/dist/curator/contradiction-detector.js.map +1 -0
- package/dist/curator/curator.d.ts +3 -4
- package/dist/curator/curator.d.ts.map +1 -1
- package/dist/curator/curator.js +90 -525
- package/dist/curator/curator.js.map +1 -1
- package/dist/curator/duplicate-detector.d.ts +14 -0
- package/dist/curator/duplicate-detector.d.ts.map +1 -0
- package/dist/curator/duplicate-detector.js +77 -0
- package/dist/curator/duplicate-detector.js.map +1 -0
- package/dist/curator/health-audit.d.ts +15 -0
- package/dist/curator/health-audit.d.ts.map +1 -0
- package/dist/curator/health-audit.js +97 -0
- package/dist/curator/health-audit.js.map +1 -0
- package/dist/curator/metadata-enricher.d.ts +17 -0
- package/dist/curator/metadata-enricher.d.ts.map +1 -0
- package/dist/curator/metadata-enricher.js +60 -0
- package/dist/curator/metadata-enricher.js.map +1 -0
- package/dist/curator/schema.d.ts +7 -0
- package/dist/curator/schema.d.ts.map +1 -0
- package/dist/curator/schema.js +62 -0
- package/dist/curator/schema.js.map +1 -0
- package/dist/curator/tag-manager.d.ts +36 -0
- package/dist/curator/tag-manager.d.ts.map +1 -0
- package/dist/curator/tag-manager.js +78 -0
- package/dist/curator/tag-manager.js.map +1 -0
- package/dist/engine/bin/soleri-engine.js +55 -3
- package/dist/engine/bin/soleri-engine.js.map +1 -1
- package/dist/engine/core-ops.d.ts.map +1 -1
- package/dist/engine/core-ops.js +33 -10
- package/dist/engine/core-ops.js.map +1 -1
- package/dist/engine/module-manifest.d.ts.map +1 -1
- package/dist/engine/module-manifest.js +22 -2
- package/dist/engine/module-manifest.js.map +1 -1
- package/dist/engine/register-engine.d.ts.map +1 -1
- package/dist/engine/register-engine.js +26 -2
- package/dist/engine/register-engine.js.map +1 -1
- package/dist/errors/retry.d.ts.map +1 -1
- package/dist/errors/retry.js +2 -0
- package/dist/errors/retry.js.map +1 -1
- package/dist/facades/types.d.ts +1 -1
- package/dist/flows/chain-types.d.ts +18 -18
- package/dist/flows/gate-evaluator.d.ts.map +1 -1
- package/dist/flows/gate-evaluator.js +22 -0
- package/dist/flows/gate-evaluator.js.map +1 -1
- package/dist/flows/types.d.ts +157 -28
- package/dist/flows/types.d.ts.map +1 -1
- package/dist/flows/types.js +4 -0
- package/dist/flows/types.js.map +1 -1
- package/dist/index.d.ts +10 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/intake/intake-pipeline.d.ts.map +1 -1
- package/dist/intake/intake-pipeline.js +1 -0
- package/dist/intake/intake-pipeline.js.map +1 -1
- package/dist/intake/text-ingester.d.ts.map +1 -1
- package/dist/intake/text-ingester.js +2 -0
- package/dist/intake/text-ingester.js.map +1 -1
- package/dist/llm/key-pool.d.ts +1 -1
- package/dist/llm/key-pool.d.ts.map +1 -1
- package/dist/llm/key-pool.js +3 -4
- package/dist/llm/key-pool.js.map +1 -1
- package/dist/llm/utils.d.ts.map +1 -1
- package/dist/llm/utils.js +2 -0
- package/dist/llm/utils.js.map +1 -1
- package/dist/migrations/migration-runner.test-helpers.d.ts +13 -0
- package/dist/migrations/migration-runner.test-helpers.d.ts.map +1 -0
- package/dist/migrations/migration-runner.test-helpers.js +47 -0
- package/dist/migrations/migration-runner.test-helpers.js.map +1 -0
- package/dist/operator/operator-profile.d.ts +44 -0
- package/dist/operator/operator-profile.d.ts.map +1 -0
- package/dist/operator/operator-profile.js +377 -0
- package/dist/operator/operator-profile.js.map +1 -0
- package/dist/operator/operator-signals.d.ts +45 -0
- package/dist/operator/operator-signals.d.ts.map +1 -0
- package/dist/operator/operator-signals.js +228 -0
- package/dist/operator/operator-signals.js.map +1 -0
- package/dist/operator/operator-types.d.ts +360 -0
- package/dist/operator/operator-types.d.ts.map +1 -0
- package/dist/operator/operator-types.js +24 -0
- package/dist/operator/operator-types.js.map +1 -0
- package/dist/packs/types.d.ts +27 -27
- package/dist/paths.d.ts +40 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +98 -0
- package/dist/paths.js.map +1 -0
- package/dist/persistence/index.d.ts +1 -1
- package/dist/persistence/index.d.ts.map +1 -1
- package/dist/persistence/index.js +1 -1
- package/dist/persistence/index.js.map +1 -1
- package/dist/persistence/sqlite-provider.d.ts +2 -0
- package/dist/persistence/sqlite-provider.d.ts.map +1 -1
- package/dist/persistence/sqlite-provider.js +8 -5
- package/dist/persistence/sqlite-provider.js.map +1 -1
- package/dist/planning/evidence-collector.d.ts +13 -1
- package/dist/planning/evidence-collector.d.ts.map +1 -1
- package/dist/planning/evidence-collector.js +33 -0
- package/dist/planning/evidence-collector.js.map +1 -1
- package/dist/planning/gap-analysis.d.ts +5 -4
- package/dist/planning/gap-analysis.d.ts.map +1 -1
- package/dist/planning/gap-analysis.js +7 -341
- package/dist/planning/gap-analysis.js.map +1 -1
- package/dist/planning/gap-passes.d.ts +19 -0
- package/dist/planning/gap-passes.d.ts.map +1 -0
- package/dist/planning/gap-passes.js +157 -0
- package/dist/planning/gap-passes.js.map +1 -0
- package/dist/planning/gap-patterns.d.ts +29 -0
- package/dist/planning/gap-patterns.d.ts.map +1 -0
- package/dist/planning/gap-patterns.js +129 -0
- package/dist/planning/gap-patterns.js.map +1 -0
- package/dist/planning/gap-types.d.ts +1 -1
- package/dist/planning/gap-types.d.ts.map +1 -1
- package/dist/planning/gap-types.js +1 -0
- package/dist/planning/gap-types.js.map +1 -1
- package/dist/planning/github-projection.d.ts +122 -0
- package/dist/planning/github-projection.d.ts.map +1 -0
- package/dist/planning/github-projection.js +294 -0
- package/dist/planning/github-projection.js.map +1 -0
- package/dist/planning/impact-analyzer.d.ts +26 -0
- package/dist/planning/impact-analyzer.d.ts.map +1 -0
- package/dist/planning/impact-analyzer.js +199 -0
- package/dist/planning/impact-analyzer.js.map +1 -0
- package/dist/planning/plan-lifecycle.d.ts +136 -0
- package/dist/planning/plan-lifecycle.d.ts.map +1 -0
- package/dist/planning/plan-lifecycle.js +296 -0
- package/dist/planning/plan-lifecycle.js.map +1 -0
- package/dist/planning/planner-types.d.ts +202 -0
- package/dist/planning/planner-types.d.ts.map +1 -0
- package/dist/planning/planner-types.js +6 -0
- package/dist/planning/planner-types.js.map +1 -0
- package/dist/planning/planner.d.ts +31 -383
- package/dist/planning/planner.d.ts.map +1 -1
- package/dist/planning/planner.js +154 -878
- package/dist/planning/planner.js.map +1 -1
- package/dist/planning/rationalization-detector.d.ts +32 -0
- package/dist/planning/rationalization-detector.d.ts.map +1 -0
- package/dist/planning/rationalization-detector.js +89 -0
- package/dist/planning/rationalization-detector.js.map +1 -0
- package/dist/planning/reconciliation-engine.d.ts +47 -0
- package/dist/planning/reconciliation-engine.d.ts.map +1 -0
- package/dist/planning/reconciliation-engine.js +128 -0
- package/dist/planning/reconciliation-engine.js.map +1 -0
- package/dist/planning/task-verifier.d.ts +85 -0
- package/dist/planning/task-verifier.d.ts.map +1 -0
- package/dist/planning/task-verifier.js +227 -0
- package/dist/planning/task-verifier.js.map +1 -0
- package/dist/plugins/types.d.ts +4 -4
- package/dist/runtime/admin-ops.d.ts +2 -2
- package/dist/runtime/admin-ops.d.ts.map +1 -1
- package/dist/runtime/admin-ops.js +44 -17
- package/dist/runtime/admin-ops.js.map +1 -1
- package/dist/runtime/admin-setup-ops.d.ts.map +1 -1
- package/dist/runtime/admin-setup-ops.js +21 -46
- package/dist/runtime/admin-setup-ops.js.map +1 -1
- package/dist/runtime/archive-ops.d.ts +10 -0
- package/dist/runtime/archive-ops.d.ts.map +1 -0
- package/dist/runtime/archive-ops.js +310 -0
- package/dist/runtime/archive-ops.js.map +1 -0
- package/dist/runtime/capture-ops.d.ts.map +1 -1
- package/dist/runtime/capture-ops.js +42 -7
- package/dist/runtime/capture-ops.js.map +1 -1
- package/dist/runtime/claude-md-helpers.js +1 -1
- package/dist/runtime/claude-md-helpers.js.map +1 -1
- package/dist/runtime/context-health.d.ts +31 -0
- package/dist/runtime/context-health.d.ts.map +1 -0
- package/dist/runtime/context-health.js +57 -0
- package/dist/runtime/context-health.js.map +1 -0
- package/dist/runtime/facades/archive-facade.d.ts +10 -0
- package/dist/runtime/facades/archive-facade.d.ts.map +1 -0
- package/dist/runtime/facades/archive-facade.js +11 -0
- package/dist/runtime/facades/archive-facade.js.map +1 -0
- package/dist/runtime/facades/brain-facade.d.ts.map +1 -1
- package/dist/runtime/facades/brain-facade.js +2 -0
- package/dist/runtime/facades/brain-facade.js.map +1 -1
- package/dist/runtime/facades/chat-facade.d.ts +7 -0
- package/dist/runtime/facades/chat-facade.d.ts.map +1 -1
- package/dist/runtime/facades/chat-facade.js +15 -800
- package/dist/runtime/facades/chat-facade.js.map +1 -1
- package/dist/runtime/facades/chat-service-ops.d.ts +9 -0
- package/dist/runtime/facades/chat-service-ops.d.ts.map +1 -0
- package/dist/runtime/facades/chat-service-ops.js +330 -0
- package/dist/runtime/facades/chat-service-ops.js.map +1 -0
- package/dist/runtime/facades/chat-session-ops.d.ts +8 -0
- package/dist/runtime/facades/chat-session-ops.d.ts.map +1 -0
- package/dist/runtime/facades/chat-session-ops.js +136 -0
- package/dist/runtime/facades/chat-session-ops.js.map +1 -0
- package/dist/runtime/facades/chat-state.d.ts +31 -0
- package/dist/runtime/facades/chat-state.d.ts.map +1 -0
- package/dist/runtime/facades/chat-state.js +32 -0
- package/dist/runtime/facades/chat-state.js.map +1 -0
- package/dist/runtime/facades/chat-transport-ops.d.ts +9 -0
- package/dist/runtime/facades/chat-transport-ops.d.ts.map +1 -0
- package/dist/runtime/facades/chat-transport-ops.js +337 -0
- package/dist/runtime/facades/chat-transport-ops.js.map +1 -0
- package/dist/runtime/facades/control-facade.d.ts.map +1 -1
- package/dist/runtime/facades/control-facade.js +4 -1
- package/dist/runtime/facades/control-facade.js.map +1 -1
- package/dist/runtime/facades/index.d.ts.map +1 -1
- package/dist/runtime/facades/index.js +6 -0
- package/dist/runtime/facades/index.js.map +1 -1
- package/dist/runtime/facades/memory-facade.d.ts.map +1 -1
- package/dist/runtime/facades/memory-facade.js +75 -6
- package/dist/runtime/facades/memory-facade.js.map +1 -1
- package/dist/runtime/facades/operator-facade.d.ts +8 -0
- package/dist/runtime/facades/operator-facade.d.ts.map +1 -0
- package/dist/runtime/facades/operator-facade.js +220 -0
- package/dist/runtime/facades/operator-facade.js.map +1 -0
- package/dist/runtime/facades/orchestrate-facade.js +3 -3
- package/dist/runtime/facades/orchestrate-facade.js.map +1 -1
- package/dist/runtime/facades/plan-facade.d.ts.map +1 -1
- package/dist/runtime/facades/plan-facade.js +39 -6
- package/dist/runtime/facades/plan-facade.js.map +1 -1
- package/dist/runtime/facades/review-facade.d.ts +7 -0
- package/dist/runtime/facades/review-facade.d.ts.map +1 -0
- package/dist/runtime/facades/review-facade.js +8 -0
- package/dist/runtime/facades/review-facade.js.map +1 -0
- package/dist/runtime/facades/sync-facade.d.ts +7 -0
- package/dist/runtime/facades/sync-facade.d.ts.map +1 -0
- package/dist/runtime/facades/sync-facade.js +8 -0
- package/dist/runtime/facades/sync-facade.js.map +1 -0
- package/dist/runtime/facades/vault-facade.d.ts +4 -1
- package/dist/runtime/facades/vault-facade.d.ts.map +1 -1
- package/dist/runtime/facades/vault-facade.js +13 -66
- package/dist/runtime/facades/vault-facade.js.map +1 -1
- package/dist/runtime/github-integration.d.ts +49 -0
- package/dist/runtime/github-integration.d.ts.map +1 -0
- package/dist/runtime/github-integration.js +113 -0
- package/dist/runtime/github-integration.js.map +1 -0
- package/dist/runtime/grading-ops.js +1 -1
- package/dist/runtime/grading-ops.js.map +1 -1
- package/dist/runtime/memory-extra-ops.d.ts.map +1 -1
- package/dist/runtime/memory-extra-ops.js +6 -2
- package/dist/runtime/memory-extra-ops.js.map +1 -1
- package/dist/runtime/orchestrate-ops.d.ts.map +1 -1
- package/dist/runtime/orchestrate-ops.js +367 -40
- package/dist/runtime/orchestrate-ops.js.map +1 -1
- package/dist/runtime/planning-extra-ops.d.ts.map +1 -1
- package/dist/runtime/planning-extra-ops.js +69 -4
- package/dist/runtime/planning-extra-ops.js.map +1 -1
- package/dist/runtime/review-ops.d.ts +10 -0
- package/dist/runtime/review-ops.d.ts.map +1 -0
- package/dist/runtime/review-ops.js +97 -0
- package/dist/runtime/review-ops.js.map +1 -0
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +27 -12
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/session-briefing.d.ts +3 -0
- package/dist/runtime/session-briefing.d.ts.map +1 -1
- package/dist/runtime/session-briefing.js +68 -1
- package/dist/runtime/session-briefing.js.map +1 -1
- package/dist/runtime/sync-ops.d.ts +12 -0
- package/dist/runtime/sync-ops.d.ts.map +1 -0
- package/dist/runtime/sync-ops.js +288 -0
- package/dist/runtime/sync-ops.js.map +1 -0
- package/dist/runtime/types.d.ts +10 -4
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/vault-extra-ops.d.ts +5 -4
- package/dist/runtime/vault-extra-ops.d.ts.map +1 -1
- package/dist/runtime/vault-extra-ops.js +5 -300
- package/dist/runtime/vault-extra-ops.js.map +1 -1
- package/dist/runtime/vault-sharing-ops.d.ts +4 -4
- package/dist/runtime/vault-sharing-ops.d.ts.map +1 -1
- package/dist/runtime/vault-sharing-ops.js +5 -300
- package/dist/runtime/vault-sharing-ops.js.map +1 -1
- package/dist/skills/sync-skills.d.ts +27 -0
- package/dist/skills/sync-skills.d.ts.map +1 -0
- package/dist/skills/sync-skills.js +81 -0
- package/dist/skills/sync-skills.js.map +1 -0
- package/dist/update-check.d.ts +14 -0
- package/dist/update-check.d.ts.map +1 -0
- package/dist/update-check.js +96 -0
- package/dist/update-check.js.map +1 -0
- package/dist/vault/linking.d.ts +10 -12
- package/dist/vault/linking.d.ts.map +1 -1
- package/dist/vault/linking.js +104 -161
- package/dist/vault/linking.js.map +1 -1
- package/dist/vault/vault-entries.d.ts +69 -0
- package/dist/vault/vault-entries.d.ts.map +1 -0
- package/dist/vault/vault-entries.js +257 -0
- package/dist/vault/vault-entries.js.map +1 -0
- package/dist/vault/vault-interfaces.d.ts +153 -0
- package/dist/vault/vault-interfaces.d.ts.map +1 -0
- package/dist/vault/vault-interfaces.js +2 -0
- package/dist/vault/vault-interfaces.js.map +1 -0
- package/dist/vault/vault-maintenance.d.ts +40 -0
- package/dist/vault/vault-maintenance.d.ts.map +1 -0
- package/dist/vault/vault-maintenance.js +142 -0
- package/dist/vault/vault-maintenance.js.map +1 -0
- package/dist/vault/vault-markdown-sync.d.ts +22 -0
- package/dist/vault/vault-markdown-sync.d.ts.map +1 -0
- package/dist/vault/vault-markdown-sync.js +143 -0
- package/dist/vault/vault-markdown-sync.js.map +1 -0
- package/dist/vault/vault-memories.d.ts +61 -0
- package/dist/vault/vault-memories.d.ts.map +1 -0
- package/dist/vault/vault-memories.js +240 -0
- package/dist/vault/vault-memories.js.map +1 -0
- package/dist/vault/vault-schema.d.ts +9 -0
- package/dist/vault/vault-schema.d.ts.map +1 -0
- package/dist/vault/vault-schema.js +179 -0
- package/dist/vault/vault-schema.js.map +1 -0
- package/dist/vault/vault.d.ts +29 -81
- package/dist/vault/vault.d.ts.map +1 -1
- package/dist/vault/vault.js +78 -931
- package/dist/vault/vault.js.map +1 -1
- package/package.json +1 -1
- package/src/agency/agency-manager.test.ts +600 -0
- package/src/agency/default-rules.test.ts +228 -0
- package/src/{__tests__ → brain}/brain-intelligence.test.ts +37 -14
- package/src/{__tests__ → brain}/brain.test.ts +1 -1
- package/src/brain/intelligence.ts +196 -15
- package/src/brain/learning-radar.ts +22 -1
- package/src/{__tests__ → brain}/second-brain-features.test.ts +4 -4
- package/src/{__tests__ → brain}/session-lifecycle.test.ts +2 -2
- package/src/brain/strength-scorer.ts +404 -0
- package/src/capabilities/chain-mapping.test.ts +66 -0
- package/src/capabilities/registry.test.ts +369 -0
- package/src/chat/agent-loop.test.ts +394 -0
- package/src/chat/agent-loop.ts +2 -0
- package/src/{__tests__ → chat}/chat-differentiators.test.ts +3 -3
- package/src/{__tests__ → chat}/chat-enhanced.test.ts +4 -4
- package/src/{__tests__ → chat}/chat-transport.test.ts +6 -6
- package/src/chat/mcp-bridge.test.ts +173 -0
- package/src/chat/notifications.ts +2 -0
- package/src/chat/output-compressor.test.ts +164 -0
- package/src/claudemd/compose.test.ts +178 -0
- package/src/claudemd/compose.ts +1 -1
- package/src/claudemd/inject.test.ts +211 -0
- package/src/context/context-engine.test.ts +461 -0
- package/src/control/identity-manager.test.ts +305 -0
- package/src/control/intent-router.test.ts +360 -0
- package/src/control/intent-router.ts +13 -4
- package/src/curator/classifier.test.ts +104 -0
- package/src/curator/contradiction-detector.test.ts +180 -0
- package/src/curator/contradiction-detector.ts +87 -0
- package/src/{__tests__ → curator}/curator-pipeline-e2e.test.ts +10 -10
- package/src/{__tests__ → curator}/curator.test.ts +77 -1
- package/src/curator/curator.ts +115 -777
- package/src/curator/duplicate-detector.test.ts +183 -0
- package/src/curator/duplicate-detector.ts +103 -0
- package/src/curator/health-audit.ts +126 -0
- package/src/curator/metadata-enricher.ts +84 -0
- package/src/curator/quality-gate.test.ts +135 -0
- package/src/curator/schema.ts +65 -0
- package/src/curator/tag-manager.test.ts +165 -0
- package/src/curator/tag-manager.ts +109 -0
- package/src/domain-packs/inject-rules.test.ts +117 -0
- package/src/domain-packs/knowledge-installer.test.ts +171 -0
- package/src/domain-packs/loader.test.ts +86 -0
- package/src/domain-packs/pack-runtime.test.ts +140 -0
- package/src/domain-packs/skills-installer.test.ts +135 -0
- package/src/domain-packs/token-resolver.test.ts +150 -0
- package/src/domain-packs/types.test.ts +130 -0
- package/src/enforcement/adapters/claude-code.test.ts +216 -0
- package/src/enforcement/registry.test.ts +264 -0
- package/src/engine/bin/soleri-engine.ts +59 -3
- package/src/engine/core-ops.test.ts +254 -0
- package/src/engine/core-ops.ts +35 -10
- package/src/engine/module-manifest.test.ts +124 -0
- package/src/engine/module-manifest.ts +22 -2
- package/src/engine/register-engine.test.ts +230 -0
- package/src/engine/register-engine.ts +26 -2
- package/src/errors/classify.test.ts +199 -0
- package/src/errors/retry.test.ts +156 -0
- package/src/errors/retry.ts +2 -0
- package/src/errors/types.test.ts +108 -0
- package/src/events/event-bus.test.ts +149 -0
- package/src/extensions/middleware.test.ts +234 -0
- package/src/facades/facade-factory.test.ts +424 -0
- package/src/flows/chain-runner.test.ts +273 -0
- package/src/flows/context-router.test.ts +52 -0
- package/src/flows/dispatch-registry.test.ts +128 -0
- package/src/flows/epilogue.test.ts +107 -0
- package/src/flows/executor.test.ts +263 -0
- package/src/flows/gate-evaluator.test.ts +194 -0
- package/src/flows/gate-evaluator.ts +25 -0
- package/src/flows/types.ts +4 -0
- package/src/governance/governance.test.ts +726 -0
- package/src/health/health-registry.test.ts +186 -0
- package/src/health/vault-integrity.test.ts +110 -0
- package/src/index.ts +92 -0
- package/src/intake/content-classifier.test.ts +209 -0
- package/src/intake/dedup-gate.test.ts +131 -0
- package/src/intake/intake-pipeline.test.ts +506 -0
- package/src/intake/intake-pipeline.ts +1 -0
- package/src/intake/text-ingester.test.ts +194 -0
- package/src/intake/text-ingester.ts +2 -0
- package/src/llm/key-pool.test.ts +236 -0
- package/src/llm/key-pool.ts +3 -4
- package/src/llm/llm-client.test.ts +345 -0
- package/src/llm/oauth-discovery.test.ts +180 -0
- package/src/llm/utils.test.ts +327 -0
- package/src/llm/utils.ts +2 -0
- package/src/{__tests__ → logging}/logger.test.ts +41 -62
- package/src/loop/loop-manager.test.ts +519 -0
- package/src/migrations/migration-runner.edge-cases.test.ts +319 -0
- package/src/migrations/migration-runner.test-helpers.ts +64 -0
- package/src/migrations/migration-runner.test.ts +385 -0
- package/src/operator/auto-signal-pipeline.test.ts +207 -0
- package/src/operator/operator-profile-extended.test.ts +320 -0
- package/src/operator/operator-profile.test.ts +314 -0
- package/src/operator/operator-profile.ts +469 -0
- package/src/operator/operator-signals-extended.test.ts +245 -0
- package/src/operator/operator-signals.test.ts +281 -0
- package/src/operator/operator-signals.ts +261 -0
- package/src/operator/operator-types.ts +444 -0
- package/src/operator/prompts/hook-precompact-operator-dispatch.md +94 -0
- package/src/operator/prompts/subagent-soft-signal-extractor.md +125 -0
- package/src/operator/prompts/subagent-synthesis-cognition.md +181 -0
- package/src/operator/prompts/subagent-synthesis-communication.md +140 -0
- package/src/operator/prompts/subagent-synthesis-technical.md +160 -0
- package/src/operator/prompts/subagent-synthesis-trust.md +143 -0
- package/src/{__tests__ → packs}/pack-lockfile.test.ts +3 -3
- package/src/{__tests__ → packs}/pack-system.test.ts +2 -2
- package/src/paths.ts +115 -0
- package/src/persistence/index.ts +1 -1
- package/src/persistence/sqlite-provider.test.ts +540 -0
- package/src/persistence/sqlite-provider.ts +8 -5
- package/src/persona/defaults.test.ts +59 -0
- package/src/persona/loader.test.ts +67 -0
- package/src/persona/prompt-generator.test.ts +127 -0
- package/src/planning/evidence-collector.test.ts +406 -0
- package/src/planning/evidence-collector.ts +50 -0
- package/src/planning/gap-analysis-alternatives.test.ts +169 -0
- package/src/planning/gap-analysis.ts +21 -636
- package/src/planning/gap-passes.test.ts +372 -0
- package/src/planning/gap-passes.ts +298 -0
- package/src/planning/gap-patterns.test.ts +320 -0
- package/src/planning/gap-patterns.ts +234 -0
- package/src/planning/gap-types.ts +4 -1
- package/src/planning/github-projection.test.ts +177 -0
- package/src/planning/github-projection.ts +425 -0
- package/src/planning/impact-analyzer.test.ts +180 -0
- package/src/planning/impact-analyzer.ts +264 -0
- package/src/planning/plan-lifecycle.test.ts +312 -0
- package/src/planning/plan-lifecycle.ts +346 -0
- package/src/planning/planner-types.ts +215 -0
- package/src/{__tests__ → planning}/planner.test.ts +169 -15
- package/src/planning/planner.ts +197 -1228
- package/src/planning/rationalization-detector.test.ts +171 -0
- package/src/planning/rationalization-detector.ts +138 -0
- package/src/planning/reconciliation-engine.test.ts +141 -0
- package/src/planning/reconciliation-engine.ts +162 -0
- package/src/planning/task-verifier.test.ts +235 -0
- package/src/planning/task-verifier.ts +303 -0
- package/src/planning/verification-protocol.test.ts +201 -0
- package/src/playbooks/generic/generic-playbooks.test.ts +438 -0
- package/src/playbooks/index.test.ts +77 -0
- package/src/playbooks/playbook-executor.test.ts +255 -0
- package/src/playbooks/playbook-registry.test.ts +232 -0
- package/src/playbooks/playbook-seeder.test.ts +153 -0
- package/src/plugins/plugin-loader.test.ts +212 -0
- package/src/plugins/plugin-registry.test.ts +272 -0
- package/src/project/project-registry.test.ts +428 -0
- package/src/prompts/parser.test.ts +100 -0
- package/src/prompts/template-manager.test.ts +109 -0
- package/src/{__tests__ → queue}/async-infrastructure.test.ts +3 -3
- package/src/queue/job-queue.test.ts +331 -0
- package/src/queue/pipeline-runner.test.ts +209 -0
- package/src/runtime/admin-extra-ops.test.ts +527 -0
- package/src/runtime/admin-ops.test.ts +257 -0
- package/src/runtime/admin-ops.ts +45 -17
- package/src/runtime/admin-setup-ops.test.ts +328 -0
- package/src/runtime/admin-setup-ops.ts +20 -43
- package/src/runtime/archive-ops.test.ts +269 -0
- package/src/runtime/archive-ops.ts +347 -0
- package/src/runtime/capture-ops.test.ts +433 -0
- package/src/runtime/capture-ops.ts +50 -8
- package/src/runtime/chain-ops.test.ts +149 -0
- package/src/runtime/claude-md-helpers.test.ts +191 -0
- package/src/runtime/claude-md-helpers.ts +1 -1
- package/src/runtime/context-health.test.ts +78 -0
- package/src/runtime/context-health.ts +85 -0
- package/src/runtime/curator-extra-ops.test.ts +202 -0
- package/src/runtime/deprecation.test.ts +98 -0
- package/src/runtime/domain-ops.test.ts +268 -0
- package/src/runtime/facades/admin-facade.test.ts +333 -0
- package/src/runtime/facades/agency-facade.test.ts +278 -0
- package/src/runtime/facades/archive-facade.test.ts +294 -0
- package/src/runtime/facades/archive-facade.ts +14 -0
- package/src/runtime/facades/brain-facade.test.ts +714 -0
- package/src/runtime/facades/brain-facade.ts +2 -0
- package/src/runtime/facades/chat-facade.test.ts +166 -0
- package/src/runtime/facades/chat-facade.ts +15 -906
- package/src/runtime/facades/chat-service-ops.test.ts +276 -0
- package/src/runtime/facades/chat-service-ops.ts +374 -0
- package/src/runtime/facades/chat-session-ops.test.ts +197 -0
- package/src/runtime/facades/chat-session-ops.ts +146 -0
- package/src/runtime/facades/chat-state.ts +60 -0
- package/src/runtime/facades/chat-transport-ops.test.ts +269 -0
- package/src/runtime/facades/chat-transport-ops.ts +380 -0
- package/src/runtime/facades/context-facade.test.ts +108 -0
- package/src/runtime/facades/control-facade.test.ts +436 -0
- package/src/runtime/facades/control-facade.ts +6 -1
- package/src/runtime/facades/curator-facade.test.ts +303 -0
- package/src/runtime/facades/index.ts +6 -0
- package/src/runtime/facades/loop-facade.test.ts +245 -0
- package/src/runtime/facades/memory-facade.test.ts +269 -0
- package/src/runtime/facades/memory-facade.ts +78 -6
- package/src/runtime/facades/operator-facade.test.ts +208 -0
- package/src/runtime/facades/operator-facade.ts +236 -0
- package/src/runtime/facades/orchestrate-facade.test.ts +185 -0
- package/src/runtime/facades/orchestrate-facade.ts +3 -3
- package/src/runtime/facades/plan-facade.test.ts +266 -0
- package/src/runtime/facades/plan-facade.ts +42 -6
- package/src/runtime/facades/review-facade.test.ts +82 -0
- package/src/runtime/facades/review-facade.ts +11 -0
- package/src/runtime/facades/sync-facade.test.ts +113 -0
- package/src/runtime/facades/sync-facade.ts +11 -0
- package/src/runtime/facades/vault-facade.test.ts +631 -0
- package/src/runtime/facades/vault-facade.ts +15 -70
- package/src/runtime/feature-flags.test.ts +140 -0
- package/src/runtime/github-integration.test.ts +89 -0
- package/src/runtime/github-integration.ts +159 -0
- package/src/runtime/grading-ops.test.ts +141 -0
- package/src/runtime/grading-ops.ts +1 -1
- package/src/runtime/intake-ops.test.ts +208 -0
- package/src/runtime/loop-ops.test.ts +238 -0
- package/src/runtime/memory-cross-project-ops.test.ts +177 -0
- package/src/runtime/memory-extra-ops.test.ts +453 -0
- package/src/runtime/memory-extra-ops.ts +6 -2
- package/src/runtime/orchestrate-ops.test.ts +302 -0
- package/src/runtime/orchestrate-ops.ts +435 -46
- package/src/runtime/pack-ops.test.ts +158 -0
- package/src/runtime/planning-extra-ops.test.ts +583 -0
- package/src/runtime/planning-extra-ops.ts +72 -4
- package/src/{__tests__ → runtime}/playbook-ops-execution.test.ts +3 -3
- package/src/runtime/playbook-ops.test.ts +262 -0
- package/src/runtime/plugin-ops.test.ts +201 -0
- package/src/runtime/project-ops.test.ts +235 -0
- package/src/runtime/review-ops.test.ts +142 -0
- package/src/runtime/review-ops.ts +99 -0
- package/src/runtime/runtime.test.ts +363 -0
- package/src/runtime/runtime.ts +39 -12
- package/src/runtime/session-briefing.test.ts +302 -0
- package/src/runtime/session-briefing.ts +80 -1
- package/src/runtime/sync-ops.test.ts +221 -0
- package/src/runtime/sync-ops.ts +325 -0
- package/src/runtime/telemetry-ops.test.ts +132 -0
- package/src/runtime/types.ts +10 -4
- package/src/runtime/vault-extra-ops.test.ts +246 -0
- package/src/runtime/vault-extra-ops.ts +5 -332
- package/src/runtime/vault-linking-ops.test.ts +237 -0
- package/src/runtime/vault-sharing-ops.test.ts +130 -0
- package/src/runtime/vault-sharing-ops.ts +5 -329
- package/src/skills/sync-skills.ts +108 -0
- package/src/streams/normalize.test.ts +95 -0
- package/src/streams/replayable-stream.test.ts +166 -0
- package/src/telemetry/telemetry.test.ts +143 -0
- package/src/transport/http-server.test.ts +394 -0
- package/src/transport/lsp-server.test.ts +458 -0
- package/src/transport/rate-limiter.test.ts +126 -0
- package/src/transport/session-manager.test.ts +133 -0
- package/src/transport/token-auth.test.ts +136 -0
- package/src/transport/ws-server.test.ts +294 -0
- package/src/update-check.ts +111 -0
- package/src/vault/__tests__/vault-characterization.test.ts +168 -0
- package/src/vault/content-hash.test.ts +78 -0
- package/src/vault/git-vault-sync.test.ts +234 -0
- package/src/vault/knowledge-review.test.ts +269 -0
- package/src/vault/linking.test.ts +358 -0
- package/src/vault/linking.ts +149 -183
- package/src/vault/obsidian-sync.test.ts +342 -0
- package/src/vault/playbook.test.ts +152 -0
- package/src/vault/scope-detector.test.ts +187 -0
- package/src/vault/vault-branching.test.ts +250 -0
- package/src/{__tests__ → vault}/vault-connect.test.ts +1 -1
- package/src/vault/vault-entries.ts +282 -0
- package/src/vault/vault-interfaces.ts +56 -0
- package/src/vault/vault-maintenance.ts +205 -0
- package/src/vault/vault-manager.test.ts +206 -0
- package/src/vault/vault-markdown-sync.test.ts +203 -0
- package/src/vault/vault-markdown-sync.ts +160 -0
- package/src/vault/vault-memories.ts +339 -0
- package/src/{__tests__ → vault}/vault-scaling.test.ts +1 -1
- package/src/vault/vault-schema.ts +181 -0
- package/src/{__tests__ → vault}/vault-sharing.test.ts +4 -4
- package/src/{__tests__ → vault}/vault.test.ts +2 -2
- package/src/vault/vault.ts +89 -1171
- package/dist/cognee/client.d.ts +0 -43
- package/dist/cognee/client.d.ts.map +0 -1
- package/dist/cognee/client.js +0 -375
- package/dist/cognee/client.js.map +0 -1
- package/dist/cognee/sync-manager.d.ts +0 -153
- package/dist/cognee/sync-manager.d.ts.map +0 -1
- package/dist/cognee/sync-manager.js +0 -390
- package/dist/cognee/sync-manager.js.map +0 -1
- package/dist/cognee/types.d.ts +0 -62
- package/dist/cognee/types.d.ts.map +0 -1
- package/dist/cognee/types.js +0 -3
- package/dist/cognee/types.js.map +0 -1
- package/dist/governance/index.d.ts +0 -3
- package/dist/governance/index.d.ts.map +0 -1
- package/dist/governance/index.js +0 -2
- package/dist/governance/index.js.map +0 -1
- package/dist/health/doctor-checks.d.ts +0 -15
- package/dist/health/doctor-checks.d.ts.map +0 -1
- package/dist/health/doctor-checks.js +0 -98
- package/dist/health/doctor-checks.js.map +0 -1
- package/dist/persistence/postgres-provider.d.ts +0 -81
- package/dist/persistence/postgres-provider.d.ts.map +0 -1
- package/dist/persistence/postgres-provider.js +0 -256
- package/dist/persistence/postgres-provider.js.map +0 -1
- package/dist/runtime/cognee-sync-ops.d.ts +0 -12
- package/dist/runtime/cognee-sync-ops.d.ts.map +0 -1
- package/dist/runtime/cognee-sync-ops.js +0 -93
- package/dist/runtime/cognee-sync-ops.js.map +0 -1
- package/dist/runtime/core-ops.d.ts +0 -23
- package/dist/runtime/core-ops.d.ts.map +0 -1
- package/dist/runtime/core-ops.js +0 -1296
- package/dist/runtime/core-ops.js.map +0 -1
- package/dist/runtime/facades/cognee-facade.d.ts +0 -8
- package/dist/runtime/facades/cognee-facade.d.ts.map +0 -1
- package/dist/runtime/facades/cognee-facade.js +0 -156
- package/dist/runtime/facades/cognee-facade.js.map +0 -1
- package/src/__tests__/admin-extra-ops.test.ts +0 -484
- package/src/__tests__/admin-ops.test.ts +0 -268
- package/src/__tests__/admin-setup-ops.test.ts +0 -355
- package/src/__tests__/agency-manager.test.ts +0 -374
- package/src/__tests__/agent-loop.test.ts +0 -256
- package/src/__tests__/capture-ops.test.ts +0 -784
- package/src/__tests__/claudemd.test.ts +0 -282
- package/src/__tests__/content-hash.test.ts +0 -60
- package/src/__tests__/context-engine.test.ts +0 -251
- package/src/__tests__/core-ops.test.ts +0 -550
- package/src/__tests__/curator-extra-ops.test.ts +0 -383
- package/src/__tests__/deprecation.test.ts +0 -78
- package/src/__tests__/domain-ops.test.ts +0 -226
- package/src/__tests__/domain-packs.test.ts +0 -421
- package/src/__tests__/enforcement.test.ts +0 -153
- package/src/__tests__/errors.test.ts +0 -388
- package/src/__tests__/extensions.test.ts +0 -233
- package/src/__tests__/facade-factory.test.ts +0 -271
- package/src/__tests__/feature-flags.test.ts +0 -137
- package/src/__tests__/flows.test.ts +0 -604
- package/src/__tests__/git-vault-sync.test.ts +0 -230
- package/src/__tests__/governance.test.ts +0 -522
- package/src/__tests__/grading-ops.test.ts +0 -361
- package/src/__tests__/health-registry.test.ts +0 -173
- package/src/__tests__/identity-manager.test.ts +0 -243
- package/src/__tests__/intake-pipeline.test.ts +0 -162
- package/src/__tests__/intent-router.test.ts +0 -222
- package/src/__tests__/knowledge-review.test.ts +0 -104
- package/src/__tests__/llm-client.test.ts +0 -69
- package/src/__tests__/llm.test.ts +0 -556
- package/src/__tests__/loader.test.ts +0 -176
- package/src/__tests__/loop-ops.test.ts +0 -469
- package/src/__tests__/lsp-transport.test.ts +0 -442
- package/src/__tests__/memory-cross-project-ops.test.ts +0 -248
- package/src/__tests__/memory-extra-ops.test.ts +0 -352
- package/src/__tests__/migration-runner.test.ts +0 -170
- package/src/__tests__/module-manifest-drift.test.ts +0 -59
- package/src/__tests__/normalize.test.ts +0 -85
- package/src/__tests__/obsidian-sync.test.ts +0 -354
- package/src/__tests__/orchestrate-ops.test.ts +0 -289
- package/src/__tests__/pack-ops.test.ts +0 -146
- package/src/__tests__/persistence.test.ts +0 -291
- package/src/__tests__/planning-extra-ops.test.ts +0 -706
- package/src/__tests__/playbook-executor.test.ts +0 -249
- package/src/__tests__/playbook-registry.test.ts +0 -326
- package/src/__tests__/playbook-seeder.test.ts +0 -163
- package/src/__tests__/playbook.test.ts +0 -389
- package/src/__tests__/plugin-ops.test.ts +0 -411
- package/src/__tests__/plugin-system.test.ts +0 -509
- package/src/__tests__/project-ops.test.ts +0 -381
- package/src/__tests__/replayable-stream.test.ts +0 -177
- package/src/__tests__/runtime.test.ts +0 -95
- package/src/__tests__/scope-detector.test.ts +0 -121
- package/src/__tests__/template-manager.test.ts +0 -222
- package/src/__tests__/token-resolver.test.ts +0 -79
- package/src/__tests__/transport.test.ts +0 -758
- package/src/__tests__/vault-branching.test.ts +0 -274
- package/src/__tests__/vault-extra-ops.test.ts +0 -482
- package/src/__tests__/vault-integrity.test.ts +0 -71
- package/src/__tests__/vault-manager.test.ts +0 -238
- package/src/__tests__/ws-transport.test.ts +0 -479
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
|
2
|
-
import { mkdirSync, rmSync } from 'node:fs';
|
|
3
|
-
import { join } from 'node:path';
|
|
4
|
-
import { tmpdir } from 'node:os';
|
|
5
|
-
import { createAgentRuntime } from '../runtime/runtime.js';
|
|
6
|
-
import { createSemanticFacades } from '../runtime/facades/index.js';
|
|
7
|
-
import type { AgentRuntime } from '../runtime/types.js';
|
|
8
|
-
import type { OpDefinition } from '../facades/types.js';
|
|
9
|
-
|
|
10
|
-
describe('Grading Ops', () => {
|
|
11
|
-
let runtime: AgentRuntime;
|
|
12
|
-
let ops: OpDefinition[];
|
|
13
|
-
let plannerDir: string;
|
|
14
|
-
|
|
15
|
-
beforeEach(() => {
|
|
16
|
-
plannerDir = join(tmpdir(), 'grading-ops-test-' + Date.now());
|
|
17
|
-
mkdirSync(plannerDir, { recursive: true });
|
|
18
|
-
runtime = createAgentRuntime({
|
|
19
|
-
agentId: 'test-grading',
|
|
20
|
-
vaultPath: ':memory:',
|
|
21
|
-
plansPath: join(plannerDir, 'plans.json'),
|
|
22
|
-
});
|
|
23
|
-
ops = createSemanticFacades(runtime, 'test').flatMap(f => f.ops);
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
afterEach(() => {
|
|
27
|
-
runtime.close();
|
|
28
|
-
rmSync(plannerDir, { recursive: true, force: true });
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
function findOp(name: string): OpDefinition {
|
|
32
|
-
const op = ops.find((o) => o.name === name);
|
|
33
|
-
if (!op) throw new Error(`Op "${name}" not found`);
|
|
34
|
-
return op;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// ─── Helper to create plans ─────────────────────────────────────
|
|
38
|
-
async function createPlan(opts: {
|
|
39
|
-
objective?: string;
|
|
40
|
-
scope?: string;
|
|
41
|
-
decisions?: string[];
|
|
42
|
-
tasks?: Array<{ title: string; description: string }>;
|
|
43
|
-
}): Promise<string> {
|
|
44
|
-
const result = (await findOp('create_plan').handler({
|
|
45
|
-
objective: opts.objective ?? 'Test plan objective',
|
|
46
|
-
scope: opts.scope ?? 'Test scope description',
|
|
47
|
-
decisions: opts.decisions,
|
|
48
|
-
tasks: opts.tasks,
|
|
49
|
-
})) as { plan: { id: string } };
|
|
50
|
-
return result.plan.id;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
describe('plan_grade', () => {
|
|
54
|
-
it('should grade an empty plan with very low score', async () => {
|
|
55
|
-
const planId = await createPlan({ objective: '', scope: '' });
|
|
56
|
-
const check = (await findOp('plan_grade').handler({ planId })) as {
|
|
57
|
-
score: number;
|
|
58
|
-
grade: string;
|
|
59
|
-
gaps: Array<{
|
|
60
|
-
severity: string;
|
|
61
|
-
category: string;
|
|
62
|
-
description: string;
|
|
63
|
-
recommendation: string;
|
|
64
|
-
}>;
|
|
65
|
-
iteration: number;
|
|
66
|
-
};
|
|
67
|
-
// 3 critical gaps: no objective, no scope, no tasks = -90
|
|
68
|
-
expect(check.score).toBeLessThanOrEqual(10);
|
|
69
|
-
expect(check.grade).toBe('F');
|
|
70
|
-
expect(check.gaps.length).toBeGreaterThan(0);
|
|
71
|
-
expect(check.iteration).toBe(1);
|
|
72
|
-
// Gaps should have the new format
|
|
73
|
-
expect(check.gaps[0].recommendation).toBeDefined();
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
it('should grade a well-formed plan highly on first iteration', async () => {
|
|
77
|
-
const planId = await createPlan({
|
|
78
|
-
objective: 'Build a Redis caching layer for API to reduce database load by 50%',
|
|
79
|
-
scope: 'API backend services only. Does not include frontend or CDN caching.',
|
|
80
|
-
decisions: [
|
|
81
|
-
'Use Redis because it provides sub-millisecond latency and supports TTL natively',
|
|
82
|
-
'Set TTL to 5 minutes since average data freshness requirement is 10 minutes',
|
|
83
|
-
],
|
|
84
|
-
tasks: [
|
|
85
|
-
{
|
|
86
|
-
title: 'Setup Redis client',
|
|
87
|
-
description: 'Install and configure Redis connection pool',
|
|
88
|
-
},
|
|
89
|
-
{ title: 'Add middleware', description: 'Express transparent caching middleware layer' },
|
|
90
|
-
{
|
|
91
|
-
title: 'Add invalidation',
|
|
92
|
-
description: 'Cache invalidation on writes for consistency',
|
|
93
|
-
},
|
|
94
|
-
{ title: 'Add tests', description: 'Integration tests for cache hit/miss scenarios' },
|
|
95
|
-
{ title: 'Add metrics', description: 'Track and verify cache hit rate monitoring' },
|
|
96
|
-
],
|
|
97
|
-
});
|
|
98
|
-
const check = (await findOp('plan_grade').handler({ planId })) as {
|
|
99
|
-
score: number;
|
|
100
|
-
grade: string;
|
|
101
|
-
};
|
|
102
|
-
// On iteration 1, minor gaps are free
|
|
103
|
-
expect(check.score).toBeGreaterThanOrEqual(95);
|
|
104
|
-
expect(check.grade).toMatch(/^A/);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it('should penalize duplicate task titles', async () => {
|
|
108
|
-
const planId = await createPlan({
|
|
109
|
-
objective: 'Test duplicate title detection in the grading engine',
|
|
110
|
-
scope: 'Testing only, does not include production changes',
|
|
111
|
-
decisions: [
|
|
112
|
-
'Use assertions because they provide clear error messages due to descriptive output',
|
|
113
|
-
],
|
|
114
|
-
tasks: [
|
|
115
|
-
{ title: 'Same name', description: 'First task implementation' },
|
|
116
|
-
{ title: 'Same name', description: 'Second task implementation' },
|
|
117
|
-
{ title: 'Unique name', description: 'Third task implementation' },
|
|
118
|
-
],
|
|
119
|
-
});
|
|
120
|
-
const check = (await findOp('plan_grade').handler({ planId })) as {
|
|
121
|
-
gaps: Array<{ description: string; category: string }>;
|
|
122
|
-
};
|
|
123
|
-
const dupGap = check.gaps.find((g) => g.description.includes('Duplicate'));
|
|
124
|
-
expect(dupGap).toBeDefined();
|
|
125
|
-
expect(dupGap!.category).toBe('semantic-quality');
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('should penalize tasks with short descriptions', async () => {
|
|
129
|
-
const planId = await createPlan({
|
|
130
|
-
objective: 'Test short description detection in the grading engine',
|
|
131
|
-
scope: 'Testing only, does not include production changes',
|
|
132
|
-
decisions: ['Use short tasks because they test the clarity analysis pass'],
|
|
133
|
-
tasks: [
|
|
134
|
-
{ title: 'Task good', description: 'Has a proper description here' },
|
|
135
|
-
{ title: 'Task bad', description: '' },
|
|
136
|
-
{ title: 'Task ok', description: 'Also has a description' },
|
|
137
|
-
],
|
|
138
|
-
});
|
|
139
|
-
const check = (await findOp('plan_grade').handler({ planId })) as {
|
|
140
|
-
gaps: Array<{ description: string; category: string }>;
|
|
141
|
-
};
|
|
142
|
-
const descGap = check.gaps.find((g) => g.description.includes('short descriptions'));
|
|
143
|
-
expect(descGap).toBeDefined();
|
|
144
|
-
expect(descGap!.category).toBe('clarity');
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it('should penalize plan without decisions using semantic-quality category', async () => {
|
|
148
|
-
const planId = await createPlan({
|
|
149
|
-
objective: 'Test missing decisions detection in the plan grading system',
|
|
150
|
-
scope: 'Testing only, does not include production changes',
|
|
151
|
-
tasks: [
|
|
152
|
-
{ title: 'T1', description: 'First task with details' },
|
|
153
|
-
{ title: 'T2', description: 'Second task with details' },
|
|
154
|
-
{ title: 'T3', description: 'Third task with details' },
|
|
155
|
-
],
|
|
156
|
-
});
|
|
157
|
-
const check = (await findOp('plan_grade').handler({ planId })) as {
|
|
158
|
-
gaps: Array<{ category: string; description: string }>;
|
|
159
|
-
};
|
|
160
|
-
const decGap = check.gaps.find(
|
|
161
|
-
(g) => g.category === 'semantic-quality' && g.description.includes('no decisions'),
|
|
162
|
-
);
|
|
163
|
-
expect(decGap).toBeDefined();
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
it('should penalize too few tasks', async () => {
|
|
167
|
-
const planId = await createPlan({
|
|
168
|
-
objective: 'Test task granularity detection in grading',
|
|
169
|
-
scope: 'Testing only, does not include production changes',
|
|
170
|
-
decisions: ['Use single task because it tests granularity check'],
|
|
171
|
-
tasks: [{ title: 'Only task', description: 'This is the only task' }],
|
|
172
|
-
});
|
|
173
|
-
const check = (await findOp('plan_grade').handler({ planId })) as {
|
|
174
|
-
gaps: Array<{ description: string }>;
|
|
175
|
-
};
|
|
176
|
-
const granGap = check.gaps.find((g) => g.description.includes('lack'));
|
|
177
|
-
expect(granGap).toBeDefined();
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
it('should include iteration number in check', async () => {
|
|
181
|
-
const planId = await createPlan({});
|
|
182
|
-
const check1 = (await findOp('plan_grade').handler({ planId })) as { iteration: number };
|
|
183
|
-
const check2 = (await findOp('plan_grade').handler({ planId })) as { iteration: number };
|
|
184
|
-
expect(check1.iteration).toBe(1);
|
|
185
|
-
expect(check2.iteration).toBe(2);
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
describe('plan_check_history', () => {
|
|
190
|
-
it('should return empty checks for new plan', async () => {
|
|
191
|
-
const planId = await createPlan({});
|
|
192
|
-
const result = (await findOp('plan_check_history').handler({ planId })) as {
|
|
193
|
-
count: number;
|
|
194
|
-
checks: unknown[];
|
|
195
|
-
};
|
|
196
|
-
expect(result.count).toBe(0);
|
|
197
|
-
expect(result.checks).toEqual([]);
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
it('should accumulate checks with increasing iteration', async () => {
|
|
201
|
-
const planId = await createPlan({});
|
|
202
|
-
await findOp('plan_grade').handler({ planId });
|
|
203
|
-
await findOp('plan_grade').handler({ planId });
|
|
204
|
-
await findOp('plan_grade').handler({ planId });
|
|
205
|
-
const result = (await findOp('plan_check_history').handler({ planId })) as {
|
|
206
|
-
count: number;
|
|
207
|
-
checks: Array<{ checkId: string; iteration: number }>;
|
|
208
|
-
};
|
|
209
|
-
expect(result.count).toBe(3);
|
|
210
|
-
const ids = new Set(result.checks.map((c) => c.checkId));
|
|
211
|
-
expect(ids.size).toBe(3);
|
|
212
|
-
expect(result.checks[0].iteration).toBe(1);
|
|
213
|
-
expect(result.checks[2].iteration).toBe(3);
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
describe('plan_latest_check', () => {
|
|
218
|
-
it('should return null-like response for ungraded plan', async () => {
|
|
219
|
-
const planId = await createPlan({});
|
|
220
|
-
const result = (await findOp('plan_latest_check').handler({ planId })) as {
|
|
221
|
-
check?: null;
|
|
222
|
-
message?: string;
|
|
223
|
-
};
|
|
224
|
-
expect(result.message).toBeDefined();
|
|
225
|
-
});
|
|
226
|
-
|
|
227
|
-
it('should return latest check after grading', async () => {
|
|
228
|
-
const planId = await createPlan({});
|
|
229
|
-
const gradeResult = (await findOp('plan_grade').handler({ planId })) as {
|
|
230
|
-
checkId: string;
|
|
231
|
-
};
|
|
232
|
-
const latest = (await findOp('plan_latest_check').handler({ planId })) as {
|
|
233
|
-
checkId: string;
|
|
234
|
-
};
|
|
235
|
-
expect(latest.checkId).toBe(gradeResult.checkId);
|
|
236
|
-
});
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
describe('plan_meets_grade', () => {
|
|
240
|
-
it('should return meets=true for plan meeting target', async () => {
|
|
241
|
-
const planId = await createPlan({
|
|
242
|
-
objective: 'Build a comprehensive feature for the testing module',
|
|
243
|
-
scope: 'Testing module only, does not include deployment or infrastructure',
|
|
244
|
-
decisions: [
|
|
245
|
-
'Use vitest because it integrates natively with TypeScript due to built-in support',
|
|
246
|
-
],
|
|
247
|
-
tasks: [
|
|
248
|
-
{ title: 'Write unit tests', description: 'Cover all edge cases in the module' },
|
|
249
|
-
{ title: 'Write integration tests', description: 'End-to-end API tests for the flow' },
|
|
250
|
-
{ title: 'Add CI pipeline', description: 'Run tests automatically on every PR' },
|
|
251
|
-
{ title: 'Add coverage report', description: 'Track and verify code coverage metrics' },
|
|
252
|
-
],
|
|
253
|
-
});
|
|
254
|
-
const result = (await findOp('plan_meets_grade').handler({
|
|
255
|
-
planId,
|
|
256
|
-
targetGrade: 'B',
|
|
257
|
-
})) as { meets: boolean; check: { score: number } };
|
|
258
|
-
expect(result.meets).toBe(true);
|
|
259
|
-
expect(result.check.score).toBeGreaterThanOrEqual(80);
|
|
260
|
-
});
|
|
261
|
-
|
|
262
|
-
it('should return meets=false for plan not meeting target', async () => {
|
|
263
|
-
const planId = await createPlan({ objective: '', scope: '' });
|
|
264
|
-
const result = (await findOp('plan_meets_grade').handler({
|
|
265
|
-
planId,
|
|
266
|
-
targetGrade: 'A+',
|
|
267
|
-
})) as { meets: boolean; check: { score: number } };
|
|
268
|
-
expect(result.meets).toBe(false);
|
|
269
|
-
});
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
describe('plan_auto_improve', () => {
|
|
273
|
-
it('should return gaps grouped by severity with next action', async () => {
|
|
274
|
-
const planId = await createPlan({ objective: '', scope: '' });
|
|
275
|
-
const result = (await findOp('plan_auto_improve').handler({ planId })) as {
|
|
276
|
-
grade: string;
|
|
277
|
-
score: number;
|
|
278
|
-
iteration: number;
|
|
279
|
-
totalGaps: number;
|
|
280
|
-
gapsBySeverity: Record<
|
|
281
|
-
string,
|
|
282
|
-
Array<{ category: string; description: string; recommendation: string }>
|
|
283
|
-
>;
|
|
284
|
-
nextAction: string;
|
|
285
|
-
};
|
|
286
|
-
expect(result.score).toBeLessThan(100);
|
|
287
|
-
expect(result.totalGaps).toBeGreaterThan(0);
|
|
288
|
-
expect(result.gapsBySeverity.critical).toBeDefined();
|
|
289
|
-
expect(result.gapsBySeverity.critical.length).toBeGreaterThan(0);
|
|
290
|
-
expect(result.nextAction).toBe('iterate');
|
|
291
|
-
// Each gap should have recommendation field
|
|
292
|
-
expect(result.gapsBySeverity.critical[0].recommendation).toBeDefined();
|
|
293
|
-
});
|
|
294
|
-
|
|
295
|
-
it('should return approve next action for high-scoring plan', async () => {
|
|
296
|
-
const planId = await createPlan({
|
|
297
|
-
objective: 'Build a Redis caching layer for API to reduce database load by 50%',
|
|
298
|
-
scope: 'API backend services only. Does not include frontend or CDN caching.',
|
|
299
|
-
decisions: [
|
|
300
|
-
'Use Redis because it provides sub-millisecond latency and supports TTL natively',
|
|
301
|
-
'Set TTL to 5 minutes since average data freshness requirement is 10 minutes',
|
|
302
|
-
],
|
|
303
|
-
tasks: [
|
|
304
|
-
{ title: 'Setup Redis', description: 'Install and configure Redis connection pool' },
|
|
305
|
-
{ title: 'Add middleware', description: 'Express transparent caching middleware layer' },
|
|
306
|
-
{
|
|
307
|
-
title: 'Add invalidation',
|
|
308
|
-
description: 'Cache invalidation on writes for consistency',
|
|
309
|
-
},
|
|
310
|
-
{ title: 'Add tests', description: 'Integration tests for cache hit/miss scenarios' },
|
|
311
|
-
{ title: 'Add metrics', description: 'Track and verify cache hit rate monitoring' },
|
|
312
|
-
],
|
|
313
|
-
});
|
|
314
|
-
const result = (await findOp('plan_auto_improve').handler({ planId })) as {
|
|
315
|
-
score: number;
|
|
316
|
-
nextAction: string;
|
|
317
|
-
};
|
|
318
|
-
expect(result.score).toBeGreaterThanOrEqual(90);
|
|
319
|
-
expect(result.nextAction).toBe('approve');
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
describe('grade thresholds', () => {
|
|
324
|
-
it('A+ should require >= 95', async () => {
|
|
325
|
-
const planId = await createPlan({
|
|
326
|
-
objective: 'Implement a Redis caching layer for the API to reduce DB load by 50%',
|
|
327
|
-
scope: 'Backend API services only. Does not include frontend or CDN.',
|
|
328
|
-
decisions: [
|
|
329
|
-
'Use Redis because it provides sub-millisecond latency and supports TTL natively',
|
|
330
|
-
'Set TTL to 5 minutes since average data freshness requirement is 10 minutes',
|
|
331
|
-
],
|
|
332
|
-
tasks: [
|
|
333
|
-
{ title: 'Setup Redis', description: 'Install and configure Redis connection pool' },
|
|
334
|
-
{ title: 'Add middleware', description: 'Express transparent caching middleware' },
|
|
335
|
-
{ title: 'Add invalidation', description: 'Cache invalidation on write operations' },
|
|
336
|
-
{ title: 'Add tests', description: 'Integration tests for cache hit/miss scenarios' },
|
|
337
|
-
{ title: 'Add metrics', description: 'Track and verify cache hit rate monitoring' },
|
|
338
|
-
],
|
|
339
|
-
});
|
|
340
|
-
const check = (await findOp('plan_grade').handler({ planId })) as {
|
|
341
|
-
score: number;
|
|
342
|
-
grade: string;
|
|
343
|
-
};
|
|
344
|
-
if (check.score >= 95) {
|
|
345
|
-
expect(check.grade).toBe('A+');
|
|
346
|
-
} else if (check.score >= 90) {
|
|
347
|
-
expect(check.grade).toBe('A');
|
|
348
|
-
}
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
it('F should be for score < 60', async () => {
|
|
352
|
-
const planId = await createPlan({ objective: '', scope: '' });
|
|
353
|
-
const check = (await findOp('plan_grade').handler({ planId })) as {
|
|
354
|
-
score: number;
|
|
355
|
-
grade: string;
|
|
356
|
-
};
|
|
357
|
-
expect(check.score).toBeLessThan(60);
|
|
358
|
-
expect(check.grade).toBe('F');
|
|
359
|
-
});
|
|
360
|
-
});
|
|
361
|
-
});
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, vi } from 'vitest';
|
|
2
|
-
import { HealthRegistry, withDegradation } from '../health/health-registry.js';
|
|
3
|
-
|
|
4
|
-
describe('HealthRegistry', () => {
|
|
5
|
-
it('registers subsystems with default healthy status', () => {
|
|
6
|
-
const reg = new HealthRegistry();
|
|
7
|
-
reg.register('vault');
|
|
8
|
-
const sub = reg.get('vault');
|
|
9
|
-
expect(sub).toBeDefined();
|
|
10
|
-
expect(sub!.status).toBe('healthy');
|
|
11
|
-
expect(sub!.failureCount).toBe(0);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
it('ignores duplicate registration', () => {
|
|
15
|
-
const reg = new HealthRegistry();
|
|
16
|
-
reg.register('vault', 'healthy');
|
|
17
|
-
reg.update('vault', 'degraded', 'test');
|
|
18
|
-
reg.register('vault'); // should NOT reset
|
|
19
|
-
expect(reg.get('vault')!.status).toBe('degraded');
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
it('tracks status transitions', () => {
|
|
23
|
-
const reg = new HealthRegistry();
|
|
24
|
-
reg.register('external');
|
|
25
|
-
reg.update('external', 'degraded', 'timeout');
|
|
26
|
-
expect(reg.get('external')!.status).toBe('degraded');
|
|
27
|
-
expect(reg.get('external')!.failureCount).toBe(1);
|
|
28
|
-
expect(reg.get('external')!.lastError).toBe('timeout');
|
|
29
|
-
|
|
30
|
-
reg.update('external', 'healthy');
|
|
31
|
-
expect(reg.get('external')!.failureCount).toBe(0);
|
|
32
|
-
expect(reg.get('external')!.lastError).toBeNull();
|
|
33
|
-
expect(reg.get('external')!.lastHealthyAt).toBeGreaterThan(0);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('auto-registers on update if not registered', () => {
|
|
37
|
-
const reg = new HealthRegistry();
|
|
38
|
-
reg.update('new-sub', 'degraded', 'oops');
|
|
39
|
-
expect(reg.get('new-sub')!.status).toBe('degraded');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('computes overall status', () => {
|
|
43
|
-
const reg = new HealthRegistry();
|
|
44
|
-
reg.register('a', 'healthy');
|
|
45
|
-
reg.register('b', 'healthy');
|
|
46
|
-
expect(reg.snapshot().overall).toBe('healthy');
|
|
47
|
-
|
|
48
|
-
reg.update('b', 'degraded');
|
|
49
|
-
expect(reg.snapshot().overall).toBe('degraded');
|
|
50
|
-
|
|
51
|
-
reg.update('a', 'down');
|
|
52
|
-
expect(reg.snapshot().overall).toBe('down');
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('fires status change listeners', () => {
|
|
56
|
-
const reg = new HealthRegistry();
|
|
57
|
-
reg.register('vault');
|
|
58
|
-
const changes: Array<[string, string, string]> = [];
|
|
59
|
-
reg.onStatusChange((name, prev, next) => {
|
|
60
|
-
changes.push([name, prev, next]);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
reg.update('vault', 'degraded');
|
|
64
|
-
reg.update('vault', 'degraded'); // same status — no listener
|
|
65
|
-
reg.update('vault', 'down');
|
|
66
|
-
reg.update('vault', 'healthy');
|
|
67
|
-
|
|
68
|
-
expect(changes).toEqual([
|
|
69
|
-
['vault', 'healthy', 'degraded'],
|
|
70
|
-
['vault', 'degraded', 'down'],
|
|
71
|
-
['vault', 'down', 'healthy'],
|
|
72
|
-
]);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('does not fire listener for same status', () => {
|
|
76
|
-
const reg = new HealthRegistry();
|
|
77
|
-
reg.register('llm', 'healthy');
|
|
78
|
-
const listener = vi.fn();
|
|
79
|
-
reg.onStatusChange(listener);
|
|
80
|
-
|
|
81
|
-
reg.update('llm', 'healthy');
|
|
82
|
-
expect(listener).not.toHaveBeenCalled();
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('fires recovery hooks when transitioning to healthy', () => {
|
|
86
|
-
const reg = new HealthRegistry();
|
|
87
|
-
reg.register('external', 'down');
|
|
88
|
-
const hook = vi.fn();
|
|
89
|
-
reg.onRecovery('external', hook);
|
|
90
|
-
|
|
91
|
-
reg.update('external', 'healthy');
|
|
92
|
-
expect(hook).toHaveBeenCalledWith('external');
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('does not fire recovery hooks for non-recovery transitions', () => {
|
|
96
|
-
const reg = new HealthRegistry();
|
|
97
|
-
reg.register('external', 'healthy');
|
|
98
|
-
const hook = vi.fn();
|
|
99
|
-
reg.onRecovery('external', hook);
|
|
100
|
-
|
|
101
|
-
reg.update('external', 'degraded');
|
|
102
|
-
reg.update('external', 'down');
|
|
103
|
-
expect(hook).not.toHaveBeenCalled();
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('snapshot returns copies', () => {
|
|
107
|
-
const reg = new HealthRegistry();
|
|
108
|
-
reg.register('vault', 'healthy');
|
|
109
|
-
const snap = reg.snapshot();
|
|
110
|
-
snap.subsystems['vault'].status = 'down'; // mutate copy
|
|
111
|
-
expect(reg.get('vault')!.status).toBe('healthy'); // original unchanged
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it('listener errors do not crash the registry', () => {
|
|
115
|
-
const reg = new HealthRegistry();
|
|
116
|
-
reg.register('vault');
|
|
117
|
-
reg.onStatusChange(() => {
|
|
118
|
-
throw new Error('bad listener');
|
|
119
|
-
});
|
|
120
|
-
// Should not throw
|
|
121
|
-
reg.update('vault', 'degraded');
|
|
122
|
-
expect(reg.get('vault')!.status).toBe('degraded');
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
describe('withDegradation', () => {
|
|
127
|
-
it('returns result on success and marks healthy', async () => {
|
|
128
|
-
const reg = new HealthRegistry();
|
|
129
|
-
reg.register('test', 'degraded');
|
|
130
|
-
|
|
131
|
-
const result = await withDegradation(reg, 'test', async () => 42, 0);
|
|
132
|
-
expect(result).toBe(42);
|
|
133
|
-
expect(reg.get('test')!.status).toBe('healthy');
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('returns fallback on failure and marks degraded', async () => {
|
|
137
|
-
const reg = new HealthRegistry();
|
|
138
|
-
reg.register('test');
|
|
139
|
-
|
|
140
|
-
const result = await withDegradation(
|
|
141
|
-
reg,
|
|
142
|
-
'test',
|
|
143
|
-
async () => {
|
|
144
|
-
throw new Error('boom');
|
|
145
|
-
},
|
|
146
|
-
'fallback',
|
|
147
|
-
);
|
|
148
|
-
expect(result).toBe('fallback');
|
|
149
|
-
expect(reg.get('test')!.status).toBe('degraded');
|
|
150
|
-
expect(reg.get('test')!.lastError).toBe('boom');
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it('escalates to down on repeated failures', async () => {
|
|
154
|
-
const reg = new HealthRegistry();
|
|
155
|
-
reg.register('test');
|
|
156
|
-
|
|
157
|
-
const fail = () =>
|
|
158
|
-
withDegradation(
|
|
159
|
-
reg,
|
|
160
|
-
'test',
|
|
161
|
-
async () => {
|
|
162
|
-
throw new Error('fail');
|
|
163
|
-
},
|
|
164
|
-
null,
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
await fail(); // healthy → degraded
|
|
168
|
-
expect(reg.get('test')!.status).toBe('degraded');
|
|
169
|
-
|
|
170
|
-
await fail(); // degraded → down
|
|
171
|
-
expect(reg.get('test')!.status).toBe('down');
|
|
172
|
-
});
|
|
173
|
-
});
|