@soleri/core 9.0.4 → 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 +24 -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 +23 -8
- 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 +28 -4
- package/src/engine/core-ops.test.ts +254 -0
- package/src/engine/core-ops.ts +25 -8
- 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
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for session-briefing — session_briefing op + buildAdaptationSummary.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { describe, it, expect } from 'vitest';
|
|
6
|
+
import { captureOps, executeOp } from '../engine/test-helpers.js';
|
|
7
|
+
import { createSessionBriefingOps, buildAdaptationSummary } from './session-briefing.js';
|
|
8
|
+
import type { AgentRuntime } from './types.js';
|
|
9
|
+
import type { OperatorProfile } from '../operator/operator-types.js';
|
|
10
|
+
|
|
11
|
+
function makeRuntime(overrides?: {
|
|
12
|
+
vaultStats?: { totalEntries: number; byType?: Record<string, number> };
|
|
13
|
+
sessions?: Array<{ endedAt: string | null; domain: string | null; context: string | null; toolsUsed: string[]; filesModified: string[] }>;
|
|
14
|
+
plans?: Array<{ id: string; status: string; objective?: string; tasks: Array<{ status: string }> }>;
|
|
15
|
+
recentEntries?: Array<{ title: string }>;
|
|
16
|
+
recommendations?: Array<{ pattern: string; strength: number }>;
|
|
17
|
+
proposals?: Array<{ title: string; confidence: number; type: string; promoted: boolean }>;
|
|
18
|
+
healthScore?: number;
|
|
19
|
+
healthRecs?: string[];
|
|
20
|
+
operatorProfile?: OperatorProfile | null;
|
|
21
|
+
}) {
|
|
22
|
+
const o = overrides ?? {};
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
brainIntelligence: {
|
|
26
|
+
listSessions: (_opts: { limit: number; active: boolean }) => o.sessions ?? [],
|
|
27
|
+
recommend: (_opts: { limit: number }) => o.recommendations ?? [],
|
|
28
|
+
getProposals: (_opts: { promoted: boolean }) => o.proposals ?? [],
|
|
29
|
+
},
|
|
30
|
+
planner: {
|
|
31
|
+
list: () => o.plans ?? [],
|
|
32
|
+
},
|
|
33
|
+
vault: {
|
|
34
|
+
stats: () => o.vaultStats ?? { totalEntries: 50, byType: { playbook: 5 } },
|
|
35
|
+
getRecent: (_n: number) => o.recentEntries ?? [],
|
|
36
|
+
},
|
|
37
|
+
curator: {
|
|
38
|
+
healthAudit: () => ({
|
|
39
|
+
score: o.healthScore ?? 85,
|
|
40
|
+
recommendations: o.healthRecs ?? [],
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
operatorProfile: {
|
|
44
|
+
getProfile: () => o.operatorProfile ?? null,
|
|
45
|
+
},
|
|
46
|
+
} as unknown as AgentRuntime;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
describe('session-briefing', () => {
|
|
50
|
+
describe('session_briefing op', () => {
|
|
51
|
+
it('returns minimal briefing when all subsystems are empty', async () => {
|
|
52
|
+
const runtime = makeRuntime();
|
|
53
|
+
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
54
|
+
const res = await executeOp(ops, 'session_briefing', {});
|
|
55
|
+
|
|
56
|
+
expect(res.success).toBe(true);
|
|
57
|
+
const data = res.data as { sections: Array<{ label: string }>; generatedAt: number; dataPointsConsulted: number };
|
|
58
|
+
expect(data.generatedAt).toBeGreaterThan(0);
|
|
59
|
+
expect(Array.isArray(data.sections)).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('shows Welcome section when vault has few entries', async () => {
|
|
63
|
+
const runtime = makeRuntime({ vaultStats: { totalEntries: 3, byType: { playbook: 0 } } });
|
|
64
|
+
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
65
|
+
const res = await executeOp(ops, 'session_briefing', {});
|
|
66
|
+
|
|
67
|
+
const data = res.data as { sections: Array<{ label: string; content: string }> };
|
|
68
|
+
const welcome = data.sections.find((s) => s.label === 'Welcome');
|
|
69
|
+
expect(welcome).toBeDefined();
|
|
70
|
+
expect(welcome!.content).toContain('3 knowledge entries');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('skips Welcome when vault has enough entries', async () => {
|
|
74
|
+
const runtime = makeRuntime({ vaultStats: { totalEntries: 50, byType: { playbook: 5 } } });
|
|
75
|
+
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
76
|
+
const res = await executeOp(ops, 'session_briefing', {});
|
|
77
|
+
|
|
78
|
+
const data = res.data as { sections: Array<{ label: string }> };
|
|
79
|
+
expect(data.sections.find((s) => s.label === 'Welcome')).toBeUndefined();
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('includes Last session section', async () => {
|
|
83
|
+
const runtime = makeRuntime({
|
|
84
|
+
sessions: [{
|
|
85
|
+
endedAt: new Date(Date.now() - 3600000).toISOString(),
|
|
86
|
+
domain: 'frontend',
|
|
87
|
+
context: 'Refactored button component',
|
|
88
|
+
toolsUsed: ['vault_search', 'brain_recommend'],
|
|
89
|
+
filesModified: ['src/button.tsx'],
|
|
90
|
+
}],
|
|
91
|
+
});
|
|
92
|
+
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
93
|
+
const res = await executeOp(ops, 'session_briefing', {});
|
|
94
|
+
|
|
95
|
+
const data = res.data as { sections: Array<{ label: string; content: string }> };
|
|
96
|
+
const session = data.sections.find((s) => s.label === 'Last session');
|
|
97
|
+
expect(session).toBeDefined();
|
|
98
|
+
expect(session!.content).toContain('[frontend]');
|
|
99
|
+
expect(session!.content).toContain('Refactored button component');
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('includes Active plans section', async () => {
|
|
103
|
+
const runtime = makeRuntime({
|
|
104
|
+
plans: [
|
|
105
|
+
{ id: 'p1', status: 'executing', objective: 'Build dashboard', tasks: [{ status: 'completed' }, { status: 'pending' }] },
|
|
106
|
+
{ id: 'p2', status: 'completed', objective: 'Done', tasks: [] },
|
|
107
|
+
],
|
|
108
|
+
});
|
|
109
|
+
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
110
|
+
const res = await executeOp(ops, 'session_briefing', {});
|
|
111
|
+
|
|
112
|
+
const data = res.data as { sections: Array<{ label: string; content: string }> };
|
|
113
|
+
const plans = data.sections.find((s) => s.label === 'Active plan' || s.label.startsWith('Active plans'));
|
|
114
|
+
expect(plans).toBeDefined();
|
|
115
|
+
expect(plans!.content).toContain('Build dashboard');
|
|
116
|
+
expect(plans!.content).toContain('1/2 tasks');
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
it('includes Recent captures section', async () => {
|
|
120
|
+
const runtime = makeRuntime({
|
|
121
|
+
recentEntries: [
|
|
122
|
+
{ title: 'Semantic token pattern' },
|
|
123
|
+
{ title: 'Error boundary anti-pattern' },
|
|
124
|
+
],
|
|
125
|
+
});
|
|
126
|
+
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
127
|
+
const res = await executeOp(ops, 'session_briefing', {});
|
|
128
|
+
|
|
129
|
+
const data = res.data as { sections: Array<{ label: string; content: string }> };
|
|
130
|
+
const captures = data.sections.find((s) => s.label === 'Recent captures');
|
|
131
|
+
expect(captures).toBeDefined();
|
|
132
|
+
expect(captures!.content).toContain('Semantic token pattern');
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it('includes Brain recommends section', async () => {
|
|
136
|
+
const runtime = makeRuntime({
|
|
137
|
+
recommendations: [
|
|
138
|
+
{ pattern: 'TDD', strength: 0.92 },
|
|
139
|
+
{ pattern: 'Vault-first', strength: 0.85 },
|
|
140
|
+
],
|
|
141
|
+
});
|
|
142
|
+
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
143
|
+
const res = await executeOp(ops, 'session_briefing', {});
|
|
144
|
+
|
|
145
|
+
const data = res.data as { sections: Array<{ label: string; content: string }> };
|
|
146
|
+
const brain = data.sections.find((s) => s.label === 'Brain recommends');
|
|
147
|
+
expect(brain).toBeDefined();
|
|
148
|
+
expect(brain!.content).toContain('TDD');
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('includes Attention section when health is low', async () => {
|
|
152
|
+
const runtime = makeRuntime({ healthScore: 50, healthRecs: ['Run curator groom'] });
|
|
153
|
+
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
154
|
+
const res = await executeOp(ops, 'session_briefing', {});
|
|
155
|
+
|
|
156
|
+
const data = res.data as { sections: Array<{ label: string; content: string }> };
|
|
157
|
+
const attention = data.sections.find((s) => s.label === 'Attention');
|
|
158
|
+
expect(attention).toBeDefined();
|
|
159
|
+
expect(attention!.content).toContain('50/100');
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('respects maxSections limit', async () => {
|
|
163
|
+
const runtime = makeRuntime({
|
|
164
|
+
vaultStats: { totalEntries: 2, byType: {} },
|
|
165
|
+
sessions: [{ endedAt: new Date().toISOString(), domain: 'd', context: 'c', toolsUsed: ['t'], filesModified: ['f'] }],
|
|
166
|
+
plans: [{ id: 'p', status: 'executing', objective: 'o', tasks: [] }],
|
|
167
|
+
recentEntries: [{ title: 't' }],
|
|
168
|
+
recommendations: [{ pattern: 'p', strength: 0.9 }],
|
|
169
|
+
healthScore: 40,
|
|
170
|
+
healthRecs: ['Fix it'],
|
|
171
|
+
});
|
|
172
|
+
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
173
|
+
const res = await executeOp(ops, 'session_briefing', { maxSections: 2 });
|
|
174
|
+
|
|
175
|
+
const data = res.data as { sections: unknown[] };
|
|
176
|
+
expect(data.sections.length).toBeLessThanOrEqual(2);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it('gracefully handles subsystem errors', async () => {
|
|
180
|
+
const runtime = {
|
|
181
|
+
brainIntelligence: {
|
|
182
|
+
listSessions: () => { throw new Error('DB closed'); },
|
|
183
|
+
recommend: () => { throw new Error('DB closed'); },
|
|
184
|
+
getProposals: () => { throw new Error('DB closed'); },
|
|
185
|
+
},
|
|
186
|
+
planner: { list: () => { throw new Error('no plans'); } },
|
|
187
|
+
vault: {
|
|
188
|
+
stats: () => { throw new Error('no vault'); },
|
|
189
|
+
getRecent: () => { throw new Error('no vault'); },
|
|
190
|
+
},
|
|
191
|
+
curator: { healthAudit: () => { throw new Error('no curator'); } },
|
|
192
|
+
operatorProfile: { getProfile: () => { throw new Error('no profile'); } },
|
|
193
|
+
} as unknown as AgentRuntime;
|
|
194
|
+
|
|
195
|
+
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
196
|
+
const res = await executeOp(ops, 'session_briefing', {});
|
|
197
|
+
expect(res.success).toBe(true);
|
|
198
|
+
const data = res.data as { sections: unknown[] };
|
|
199
|
+
expect(data.sections).toEqual([]);
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('includes Pending proposals when present', async () => {
|
|
203
|
+
const runtime = makeRuntime({
|
|
204
|
+
proposals: [
|
|
205
|
+
{ title: 'Use TDD for all new features', confidence: 0.8, type: 'pattern', promoted: false },
|
|
206
|
+
{ title: 'Low confidence', confidence: 0.2, type: 'anti-pattern', promoted: false },
|
|
207
|
+
],
|
|
208
|
+
});
|
|
209
|
+
const ops = captureOps(createSessionBriefingOps(runtime));
|
|
210
|
+
const res = await executeOp(ops, 'session_briefing', {});
|
|
211
|
+
|
|
212
|
+
const data = res.data as { sections: Array<{ label: string; content: string }> };
|
|
213
|
+
const proposals = data.sections.find((s) => s.label === 'Pending proposals');
|
|
214
|
+
expect(proposals).toBeDefined();
|
|
215
|
+
expect(proposals!.content).toContain('Use TDD');
|
|
216
|
+
// Low confidence (0.2 < 0.4) should be filtered out
|
|
217
|
+
expect(proposals!.content).not.toContain('Low confidence');
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
describe('buildAdaptationSummary', () => {
|
|
222
|
+
function makeProfile(overrides?: Partial<OperatorProfile>): OperatorProfile {
|
|
223
|
+
return {
|
|
224
|
+
id: 'test',
|
|
225
|
+
operatorId: 'op',
|
|
226
|
+
version: 1,
|
|
227
|
+
identity: { name: null, timezone: null, locale: null, personalDetails: [] },
|
|
228
|
+
cognition: { learningStyle: 'visual', decisionStyle: 'analytical', abstractionPreference: 0.5, detailOrientation: 0.5, attentionPatterns: [] },
|
|
229
|
+
communication: { style: 'mixed', formality: 0.5, verbosity: 0.5, preferredFormats: [], reactionPatterns: [] },
|
|
230
|
+
workingRules: { rules: [], inferredPriorities: [] },
|
|
231
|
+
trustModel: { level: 'new', currentLevel: 0.5, challengeThreshold: 0.5, autonomyGrants: [], corrections: [] },
|
|
232
|
+
tasteProfile: { aestheticPreferences: [], toolPreferences: [], workflowPreferences: [] },
|
|
233
|
+
growthEdges: { observed: [], selfReported: [], progressNotes: [] },
|
|
234
|
+
technicalContext: { primaryLanguages: [], frameworks: [], expertiseLevels: [], environmentDetails: [] },
|
|
235
|
+
sessionCount: 0,
|
|
236
|
+
lastSynthesis: null,
|
|
237
|
+
createdAt: new Date().toISOString(),
|
|
238
|
+
updatedAt: new Date().toISOString(),
|
|
239
|
+
...overrides,
|
|
240
|
+
} as OperatorProfile;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
it('returns null when profile has no distinguishing data', () => {
|
|
244
|
+
const result = buildAdaptationSummary(makeProfile());
|
|
245
|
+
expect(result).toBeNull();
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it('includes communication style when not mixed', () => {
|
|
249
|
+
const result = buildAdaptationSummary(makeProfile({
|
|
250
|
+
communication: { style: 'terse', formality: 0.8, verbosity: 0.3, preferredFormats: [], reactionPatterns: [] },
|
|
251
|
+
}));
|
|
252
|
+
expect(result).toContain('Communication: terse, formal');
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('includes trust level when not new', () => {
|
|
256
|
+
const result = buildAdaptationSummary(makeProfile({
|
|
257
|
+
trustModel: { level: 'established', currentLevel: 0.8, challengeThreshold: 0.5, autonomyGrants: [], corrections: [] },
|
|
258
|
+
}));
|
|
259
|
+
expect(result).toContain('Trust: established');
|
|
260
|
+
expect(result).toContain('high autonomy');
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
it('includes working rules as priorities', () => {
|
|
264
|
+
const result = buildAdaptationSummary(makeProfile({
|
|
265
|
+
workingRules: {
|
|
266
|
+
rules: [
|
|
267
|
+
{ rule: 'Always write tests first', source: 'observed', confidence: 0.9, addedAt: '' },
|
|
268
|
+
{ rule: 'Prefer small PRs', source: 'observed', confidence: 0.8, addedAt: '' },
|
|
269
|
+
],
|
|
270
|
+
inferredPriorities: [],
|
|
271
|
+
},
|
|
272
|
+
}));
|
|
273
|
+
expect(result).toContain('Priorities:');
|
|
274
|
+
expect(result).toContain('Always write tests first');
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it('includes growth edges', () => {
|
|
278
|
+
const result = buildAdaptationSummary(makeProfile({
|
|
279
|
+
growthEdges: {
|
|
280
|
+
observed: [{ area: 'TypeScript generics', evidence: 'struggled with mapped types', observedAt: '' }],
|
|
281
|
+
selfReported: [],
|
|
282
|
+
progressNotes: [],
|
|
283
|
+
},
|
|
284
|
+
}));
|
|
285
|
+
expect(result).toContain('Growth edges: TypeScript generics');
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
it('shows casual for low formality', () => {
|
|
289
|
+
const result = buildAdaptationSummary(makeProfile({
|
|
290
|
+
communication: { style: 'conversational', formality: 0.2, verbosity: 0.5, preferredFormats: [], reactionPatterns: [] },
|
|
291
|
+
}));
|
|
292
|
+
expect(result).toContain('casual');
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
it('shows check before acting for low trust level', () => {
|
|
296
|
+
const result = buildAdaptationSummary(makeProfile({
|
|
297
|
+
trustModel: { level: 'developing', currentLevel: 0.2, challengeThreshold: 0.5, autonomyGrants: [], corrections: [] },
|
|
298
|
+
}));
|
|
299
|
+
expect(result).toContain('check before acting');
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
});
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
import { z } from 'zod';
|
|
12
12
|
import type { OpDefinition } from '../facades/types.js';
|
|
13
13
|
import type { AgentRuntime } from './types.js';
|
|
14
|
+
import type { OperatorProfile } from '../operator/operator-types.js';
|
|
14
15
|
|
|
15
16
|
export interface BriefingSection {
|
|
16
17
|
label: string;
|
|
@@ -133,7 +134,36 @@ export function createSessionBriefingOps(runtime: AgentRuntime): OpDefinition[]
|
|
|
133
134
|
// Brain unavailable — skip
|
|
134
135
|
}
|
|
135
136
|
|
|
136
|
-
// 5.
|
|
137
|
+
// 5. Pending brain proposals
|
|
138
|
+
try {
|
|
139
|
+
const pending = brainIntelligence
|
|
140
|
+
.getProposals({ promoted: false })
|
|
141
|
+
.filter((p) => p.confidence >= 0.4)
|
|
142
|
+
.sort((a, b) => b.confidence - a.confidence);
|
|
143
|
+
dataPoints += pending.length;
|
|
144
|
+
if (pending.length > 0) {
|
|
145
|
+
const top = pending
|
|
146
|
+
.slice(0, 3)
|
|
147
|
+
.map(
|
|
148
|
+
(p) =>
|
|
149
|
+
`"${p.title.slice(0, 50)}" (confidence: ${p.confidence.toFixed(2)}, type: ${p.type})`,
|
|
150
|
+
);
|
|
151
|
+
const lines = [`${pending.length} awaiting review`, ...top.map((t) => ` - ${t}`)];
|
|
152
|
+
if (pending.length > 3) {
|
|
153
|
+
lines.push(
|
|
154
|
+
` Use \`brain_promote_proposals\` to review, or \`radar_flush\` to batch-approve above threshold.`,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
sections.push({
|
|
158
|
+
label: 'Pending proposals',
|
|
159
|
+
content: lines.join('\n'),
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
} catch {
|
|
163
|
+
// Brain proposals unavailable — skip
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// 6. Stale knowledge / health warnings
|
|
137
167
|
try {
|
|
138
168
|
const health = curator.healthAudit();
|
|
139
169
|
dataPoints += 1;
|
|
@@ -154,6 +184,20 @@ export function createSessionBriefingOps(runtime: AgentRuntime): OpDefinition[]
|
|
|
154
184
|
// Curator unavailable — skip
|
|
155
185
|
}
|
|
156
186
|
|
|
187
|
+
// 7. Operator adaptation
|
|
188
|
+
try {
|
|
189
|
+
const profile = runtime.operatorProfile.getProfile();
|
|
190
|
+
if (profile) {
|
|
191
|
+
const summary = buildAdaptationSummary(profile);
|
|
192
|
+
if (summary) {
|
|
193
|
+
sections.push({ label: 'Operator Adaptation', content: summary });
|
|
194
|
+
dataPoints += 1;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
} catch {
|
|
198
|
+
// Operator profile unavailable — skip
|
|
199
|
+
}
|
|
200
|
+
|
|
157
201
|
return {
|
|
158
202
|
sections: sections.slice(0, maxSections),
|
|
159
203
|
generatedAt: Date.now(),
|
|
@@ -164,6 +208,41 @@ export function createSessionBriefingOps(runtime: AgentRuntime): OpDefinition[]
|
|
|
164
208
|
];
|
|
165
209
|
}
|
|
166
210
|
|
|
211
|
+
/** Build a concise adaptation summary from an operator profile (5-8 lines max). */
|
|
212
|
+
export function buildAdaptationSummary(profile: OperatorProfile): string | null {
|
|
213
|
+
const lines: string[] = [];
|
|
214
|
+
const { communication, trustModel, workingRules, growthEdges } = profile;
|
|
215
|
+
|
|
216
|
+
// Communication style
|
|
217
|
+
if (communication.style && communication.style !== 'mixed') {
|
|
218
|
+
const formality = communication.formality >= 0.7 ? 'formal' : communication.formality <= 0.3 ? 'casual' : '';
|
|
219
|
+
const parts = [communication.style, formality].filter(Boolean);
|
|
220
|
+
lines.push(`Communication: ${parts.join(', ')}`);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// Challenge threshold / pushback level
|
|
224
|
+
if (trustModel.level !== 'new') {
|
|
225
|
+
const autonomy = trustModel.currentLevel >= 0.7 ? 'high autonomy' : trustModel.currentLevel <= 0.3 ? 'check before acting' : 'moderate autonomy';
|
|
226
|
+
lines.push(`Trust: ${trustModel.level} — ${autonomy}`);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Work priorities (from top working rules)
|
|
230
|
+
const topRules = workingRules.rules.slice(0, 3);
|
|
231
|
+
if (topRules.length > 0) {
|
|
232
|
+
const ruleTexts = topRules.map((r) => r.rule.slice(0, 60));
|
|
233
|
+
lines.push(`Priorities: ${ruleTexts.join('; ')}`);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Growth edges
|
|
237
|
+
const edges = [...growthEdges.observed, ...growthEdges.selfReported];
|
|
238
|
+
if (edges.length > 0) {
|
|
239
|
+
const edgeNames = edges.slice(0, 3).map((e) => e.area);
|
|
240
|
+
lines.push(`Growth edges: ${edgeNames.join(', ')}`);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
return lines.length > 0 ? lines.join('\n') : null;
|
|
244
|
+
}
|
|
245
|
+
|
|
167
246
|
function formatTimeAgo(timestamp: number): string {
|
|
168
247
|
const diff = Date.now() - timestamp;
|
|
169
248
|
const minutes = Math.floor(diff / 60000);
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
2
|
+
import { createSyncOps } from './sync-ops.js';
|
|
3
|
+
import type { AgentRuntime } from './types.js';
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// Mocks
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
vi.mock('../vault/git-vault-sync.js', () => ({
|
|
10
|
+
GitVaultSync: vi.fn().mockImplementation(function (this: Record<string, unknown>) {
|
|
11
|
+
this.init = vi.fn().mockResolvedValue(undefined);
|
|
12
|
+
this.syncAll = vi.fn().mockResolvedValue({ pushed: 5 });
|
|
13
|
+
this.pull = vi.fn().mockResolvedValue({ imported: 3, conflicts: 0 });
|
|
14
|
+
this.sync = vi.fn().mockResolvedValue({ pushed: 2, pulled: 1 });
|
|
15
|
+
}),
|
|
16
|
+
}));
|
|
17
|
+
|
|
18
|
+
vi.mock('../vault/linking.js', () => ({
|
|
19
|
+
LinkManager: vi.fn().mockImplementation(function (this: Record<string, unknown>) {
|
|
20
|
+
this.getAllLinksForEntries = vi.fn().mockReturnValue([]);
|
|
21
|
+
this.addLink = vi.fn();
|
|
22
|
+
}),
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
vi.mock('../vault/obsidian-sync.js', () => ({
|
|
26
|
+
ObsidianSync: vi.fn().mockImplementation(function (this: Record<string, unknown>) {
|
|
27
|
+
this.export = vi.fn().mockResolvedValue({ exported: 10 });
|
|
28
|
+
this.import = vi.fn().mockResolvedValue({ imported: 5 });
|
|
29
|
+
this.sync = vi.fn().mockResolvedValue({ pushed: 3, pulled: 2 });
|
|
30
|
+
}),
|
|
31
|
+
}));
|
|
32
|
+
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Mock runtime
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
|
|
37
|
+
function mockRuntime(): AgentRuntime {
|
|
38
|
+
return {
|
|
39
|
+
config: { agentId: 'test-agent' },
|
|
40
|
+
vault: {
|
|
41
|
+
get: vi.fn(),
|
|
42
|
+
seed: vi.fn(),
|
|
43
|
+
seedDedup: vi.fn().mockReturnValue([]),
|
|
44
|
+
list: vi.fn().mockReturnValue([]),
|
|
45
|
+
exportAll: vi.fn().mockReturnValue({ entries: [] }),
|
|
46
|
+
getProvider: vi.fn().mockReturnValue({
|
|
47
|
+
all: vi.fn().mockReturnValue([]),
|
|
48
|
+
get: vi.fn(),
|
|
49
|
+
run: vi.fn(),
|
|
50
|
+
}),
|
|
51
|
+
},
|
|
52
|
+
} as unknown as AgentRuntime;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function findOp(ops: ReturnType<typeof createSyncOps>, name: string) {
|
|
56
|
+
const op = ops.find((o) => o.name === name);
|
|
57
|
+
if (!op) throw new Error(`Op "${name}" not found`);
|
|
58
|
+
return op;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
// Tests
|
|
63
|
+
// ---------------------------------------------------------------------------
|
|
64
|
+
|
|
65
|
+
describe('createSyncOps', () => {
|
|
66
|
+
let rt: AgentRuntime;
|
|
67
|
+
let ops: ReturnType<typeof createSyncOps>;
|
|
68
|
+
|
|
69
|
+
beforeEach(() => {
|
|
70
|
+
vi.clearAllMocks();
|
|
71
|
+
rt = mockRuntime();
|
|
72
|
+
ops = createSyncOps(rt);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('returns 8 ops', () => {
|
|
76
|
+
expect(ops.length).toBe(8);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('has the expected op names', () => {
|
|
80
|
+
const names = ops.map((o) => o.name);
|
|
81
|
+
expect(names).toEqual([
|
|
82
|
+
'vault_git_push',
|
|
83
|
+
'vault_git_pull',
|
|
84
|
+
'vault_git_sync',
|
|
85
|
+
'obsidian_export',
|
|
86
|
+
'obsidian_import',
|
|
87
|
+
'obsidian_sync',
|
|
88
|
+
'vault_export_pack',
|
|
89
|
+
'vault_import_pack',
|
|
90
|
+
]);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
// ─── vault_git_push ───────────────────────────────────────────
|
|
94
|
+
|
|
95
|
+
describe('vault_git_push', () => {
|
|
96
|
+
it('initializes sync and pushes entries', async () => {
|
|
97
|
+
const op = findOp(ops, 'vault_git_push');
|
|
98
|
+
const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<
|
|
99
|
+
string,
|
|
100
|
+
unknown
|
|
101
|
+
>;
|
|
102
|
+
expect(result.pushed).toBe(5);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// ─── vault_git_pull ───────────────────────────────────────────
|
|
107
|
+
|
|
108
|
+
describe('vault_git_pull', () => {
|
|
109
|
+
it('pulls entries from git directory', async () => {
|
|
110
|
+
const op = findOp(ops, 'vault_git_pull');
|
|
111
|
+
const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<
|
|
112
|
+
string,
|
|
113
|
+
unknown
|
|
114
|
+
>;
|
|
115
|
+
expect(result.imported).toBe(3);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
// ─── vault_git_sync ───────────────────────────────────────────
|
|
120
|
+
|
|
121
|
+
describe('vault_git_sync', () => {
|
|
122
|
+
it('performs bidirectional sync', async () => {
|
|
123
|
+
const op = findOp(ops, 'vault_git_sync');
|
|
124
|
+
const result = (await op.handler({ repoDir: '/tmp/vault-repo' })) as Record<
|
|
125
|
+
string,
|
|
126
|
+
unknown
|
|
127
|
+
>;
|
|
128
|
+
expect(result.pushed).toBe(2);
|
|
129
|
+
expect(result.pulled).toBe(1);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
// ─── obsidian_export ──────────────────────────────────────────
|
|
134
|
+
|
|
135
|
+
describe('obsidian_export', () => {
|
|
136
|
+
it('exports entries to Obsidian format', async () => {
|
|
137
|
+
const op = findOp(ops, 'obsidian_export');
|
|
138
|
+
const result = (await op.handler({ obsidianDir: '/tmp/obsidian' })) as Record<
|
|
139
|
+
string,
|
|
140
|
+
unknown
|
|
141
|
+
>;
|
|
142
|
+
expect(result.exported).toBe(10);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// ─── obsidian_import ──────────────────────────────────────────
|
|
147
|
+
|
|
148
|
+
describe('obsidian_import', () => {
|
|
149
|
+
it('imports from Obsidian directory', async () => {
|
|
150
|
+
const op = findOp(ops, 'obsidian_import');
|
|
151
|
+
const result = (await op.handler({ obsidianDir: '/tmp/obsidian' })) as Record<
|
|
152
|
+
string,
|
|
153
|
+
unknown
|
|
154
|
+
>;
|
|
155
|
+
expect(result.imported).toBe(5);
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
// ─── obsidian_sync ────────────────────────────────────────────
|
|
160
|
+
|
|
161
|
+
describe('obsidian_sync', () => {
|
|
162
|
+
it('performs bidirectional Obsidian sync', async () => {
|
|
163
|
+
const op = findOp(ops, 'obsidian_sync');
|
|
164
|
+
const result = (await op.handler({ obsidianDir: '/tmp/obsidian' })) as Record<
|
|
165
|
+
string,
|
|
166
|
+
unknown
|
|
167
|
+
>;
|
|
168
|
+
expect(result.pushed).toBe(3);
|
|
169
|
+
expect(result.pulled).toBe(2);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
// ─── vault_export_pack ────────────────────────────────────────
|
|
174
|
+
|
|
175
|
+
describe('vault_export_pack', () => {
|
|
176
|
+
it('exports entries as intelligence bundles', async () => {
|
|
177
|
+
const op = findOp(ops, 'vault_export_pack');
|
|
178
|
+
vi.mocked(rt.vault.list).mockReturnValue([
|
|
179
|
+
{ id: 'e1', domain: 'testing', tier: 'team', tags: [] },
|
|
180
|
+
{ id: 'e2', domain: 'testing', tier: 'team', tags: [] },
|
|
181
|
+
] as never);
|
|
182
|
+
const result = (await op.handler({ tier: 'team' })) as Record<string, unknown>;
|
|
183
|
+
expect(result.totalEntries).toBe(2);
|
|
184
|
+
expect(result.name).toBe('test-agent');
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('excludes specified IDs', async () => {
|
|
188
|
+
const op = findOp(ops, 'vault_export_pack');
|
|
189
|
+
vi.mocked(rt.vault.list).mockReturnValue([
|
|
190
|
+
{ id: 'e1', domain: 'd', tier: 'team', tags: [] },
|
|
191
|
+
{ id: 'e2', domain: 'd', tier: 'team', tags: [] },
|
|
192
|
+
] as never);
|
|
193
|
+
const result = (await op.handler({ excludeIds: ['e1'] })) as Record<string, unknown>;
|
|
194
|
+
expect(result.totalEntries).toBe(1);
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// ─── vault_import_pack ────────────────────────────────────────
|
|
199
|
+
|
|
200
|
+
describe('vault_import_pack', () => {
|
|
201
|
+
it('imports bundles and returns counts', async () => {
|
|
202
|
+
const op = findOp(ops, 'vault_import_pack');
|
|
203
|
+
vi.mocked(rt.vault.seedDedup).mockReturnValue([
|
|
204
|
+
{ id: 'new-1', action: 'inserted' },
|
|
205
|
+
{ id: 'dup-1', action: 'skipped', existingId: 'existing-1' },
|
|
206
|
+
] as never);
|
|
207
|
+
const result = (await op.handler({
|
|
208
|
+
bundles: [
|
|
209
|
+
{
|
|
210
|
+
domain: 'testing',
|
|
211
|
+
version: '1.0.0',
|
|
212
|
+
entries: [{ id: 'e1' }, { id: 'e2' }],
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
})) as Record<string, unknown>;
|
|
216
|
+
expect(result.imported).toBe(1);
|
|
217
|
+
expect(result.duplicates).toBe(1);
|
|
218
|
+
expect(result.total).toBe(2);
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
});
|