@soleri/core 2.12.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/data/flows/build.flow.yaml +128 -0
- package/data/flows/deliver.flow.yaml +110 -0
- package/data/flows/design.flow.yaml +108 -0
- package/data/flows/enhance.flow.yaml +90 -0
- package/data/flows/explore.flow.yaml +84 -0
- package/data/flows/fix.flow.yaml +90 -0
- package/data/flows/plan.flow.yaml +87 -0
- package/data/flows/review.flow.yaml +90 -0
- package/dist/agency/agency-manager.d.ts +27 -1
- package/dist/agency/agency-manager.d.ts.map +1 -1
- package/dist/agency/agency-manager.js +180 -9
- package/dist/agency/agency-manager.js.map +1 -1
- package/dist/agency/default-rules.d.ts +7 -0
- package/dist/agency/default-rules.d.ts.map +1 -0
- package/dist/agency/default-rules.js +79 -0
- package/dist/agency/default-rules.js.map +1 -0
- package/dist/agency/types.d.ts +48 -0
- package/dist/agency/types.d.ts.map +1 -1
- package/dist/brain/brain.d.ts +17 -2
- package/dist/brain/brain.d.ts.map +1 -1
- package/dist/brain/brain.js +118 -8
- package/dist/brain/brain.js.map +1 -1
- package/dist/brain/intelligence.d.ts.map +1 -1
- package/dist/brain/intelligence.js +16 -2
- package/dist/brain/intelligence.js.map +1 -1
- package/dist/brain/knowledge-synthesizer.d.ts +37 -0
- package/dist/brain/knowledge-synthesizer.d.ts.map +1 -0
- package/dist/brain/knowledge-synthesizer.js +161 -0
- package/dist/brain/knowledge-synthesizer.js.map +1 -0
- package/dist/brain/learning-radar.d.ts +96 -0
- package/dist/brain/learning-radar.d.ts.map +1 -0
- package/dist/brain/learning-radar.js +202 -0
- package/dist/brain/learning-radar.js.map +1 -0
- package/dist/brain/types.d.ts +15 -0
- package/dist/brain/types.d.ts.map +1 -1
- package/dist/capabilities/chain-mapping.d.ts +21 -0
- package/dist/capabilities/chain-mapping.d.ts.map +1 -0
- package/dist/capabilities/chain-mapping.js +86 -0
- package/dist/capabilities/chain-mapping.js.map +1 -0
- package/dist/capabilities/index.d.ts +10 -0
- package/dist/capabilities/index.d.ts.map +1 -0
- package/dist/capabilities/index.js +8 -0
- package/dist/capabilities/index.js.map +1 -0
- package/dist/capabilities/registry.d.ts +95 -0
- package/dist/capabilities/registry.d.ts.map +1 -0
- package/dist/capabilities/registry.js +227 -0
- package/dist/capabilities/registry.js.map +1 -0
- package/dist/capabilities/types.d.ts +106 -0
- package/dist/capabilities/types.d.ts.map +1 -0
- package/dist/capabilities/types.js +12 -0
- package/dist/capabilities/types.js.map +1 -0
- package/dist/context/context-engine.d.ts.map +1 -1
- package/dist/context/context-engine.js +82 -17
- package/dist/context/context-engine.js.map +1 -1
- package/dist/context/types.d.ts +5 -0
- package/dist/context/types.d.ts.map +1 -1
- package/dist/control/intent-router.d.ts +12 -1
- package/dist/control/intent-router.d.ts.map +1 -1
- package/dist/control/intent-router.js +126 -2
- package/dist/control/intent-router.js.map +1 -1
- package/dist/control/types.d.ts +17 -0
- package/dist/control/types.d.ts.map +1 -1
- package/dist/curator/classifier.d.ts +18 -0
- package/dist/curator/classifier.d.ts.map +1 -0
- package/dist/curator/classifier.js +61 -0
- package/dist/curator/classifier.js.map +1 -0
- package/dist/curator/quality-gate.d.ts +29 -0
- package/dist/curator/quality-gate.d.ts.map +1 -0
- package/dist/curator/quality-gate.js +88 -0
- package/dist/curator/quality-gate.js.map +1 -0
- package/dist/domain-packs/index.d.ts +8 -0
- package/dist/domain-packs/index.d.ts.map +1 -0
- package/dist/domain-packs/index.js +8 -0
- package/dist/domain-packs/index.js.map +1 -0
- package/dist/domain-packs/inject-rules.d.ts +24 -0
- package/dist/domain-packs/inject-rules.d.ts.map +1 -0
- package/dist/domain-packs/inject-rules.js +65 -0
- package/dist/domain-packs/inject-rules.js.map +1 -0
- package/dist/domain-packs/knowledge-installer.d.ts +27 -0
- package/dist/domain-packs/knowledge-installer.d.ts.map +1 -0
- package/dist/domain-packs/knowledge-installer.js +89 -0
- package/dist/domain-packs/knowledge-installer.js.map +1 -0
- package/dist/domain-packs/loader.d.ts +28 -0
- package/dist/domain-packs/loader.d.ts.map +1 -0
- package/dist/domain-packs/loader.js +105 -0
- package/dist/domain-packs/loader.js.map +1 -0
- package/dist/domain-packs/pack-runtime.d.ts +80 -0
- package/dist/domain-packs/pack-runtime.d.ts.map +1 -0
- package/dist/domain-packs/pack-runtime.js +36 -0
- package/dist/domain-packs/pack-runtime.js.map +1 -0
- package/dist/domain-packs/skills-installer.d.ts +21 -0
- package/dist/domain-packs/skills-installer.d.ts.map +1 -0
- package/dist/domain-packs/skills-installer.js +38 -0
- package/dist/domain-packs/skills-installer.js.map +1 -0
- package/dist/domain-packs/token-resolver.d.ts +37 -0
- package/dist/domain-packs/token-resolver.d.ts.map +1 -0
- package/dist/domain-packs/token-resolver.js +109 -0
- package/dist/domain-packs/token-resolver.js.map +1 -0
- package/dist/domain-packs/types.d.ts +91 -0
- package/dist/domain-packs/types.d.ts.map +1 -0
- package/dist/domain-packs/types.js +122 -0
- package/dist/domain-packs/types.js.map +1 -0
- package/dist/engine/bin/soleri-engine.d.ts +12 -0
- package/dist/engine/bin/soleri-engine.d.ts.map +1 -0
- package/dist/engine/bin/soleri-engine.js +184 -0
- package/dist/engine/bin/soleri-engine.js.map +1 -0
- package/dist/engine/core-ops.d.ts +27 -0
- package/dist/engine/core-ops.d.ts.map +1 -0
- package/dist/engine/core-ops.js +159 -0
- package/dist/engine/core-ops.js.map +1 -0
- package/dist/engine/index.d.ts +19 -0
- package/dist/engine/index.d.ts.map +1 -0
- package/dist/engine/index.js +17 -0
- package/dist/engine/index.js.map +1 -0
- package/dist/engine/register-engine.d.ts +54 -0
- package/dist/engine/register-engine.d.ts.map +1 -0
- package/dist/engine/register-engine.js +270 -0
- package/dist/engine/register-engine.js.map +1 -0
- package/dist/engine/test-helpers.d.ts +30 -0
- package/dist/engine/test-helpers.d.ts.map +1 -0
- package/dist/engine/test-helpers.js +59 -0
- package/dist/engine/test-helpers.js.map +1 -0
- package/dist/events/event-bus.d.ts +30 -0
- package/dist/events/event-bus.d.ts.map +1 -0
- package/dist/events/event-bus.js +51 -0
- package/dist/events/event-bus.js.map +1 -0
- package/dist/flows/chain-runner.d.ts +46 -0
- package/dist/flows/chain-runner.d.ts.map +1 -0
- package/dist/flows/chain-runner.js +271 -0
- package/dist/flows/chain-runner.js.map +1 -0
- package/dist/flows/chain-types.d.ts +103 -0
- package/dist/flows/chain-types.d.ts.map +1 -0
- package/dist/flows/chain-types.js +23 -0
- package/dist/flows/chain-types.js.map +1 -0
- package/dist/flows/context-router.d.ts +39 -0
- package/dist/flows/context-router.d.ts.map +1 -0
- package/dist/flows/context-router.js +206 -0
- package/dist/flows/context-router.js.map +1 -0
- package/dist/flows/dispatch-registry.d.ts +24 -0
- package/dist/flows/dispatch-registry.d.ts.map +1 -0
- package/dist/flows/dispatch-registry.js +70 -0
- package/dist/flows/dispatch-registry.js.map +1 -0
- package/dist/flows/epilogue.d.ts +24 -0
- package/dist/flows/epilogue.d.ts.map +1 -0
- package/dist/flows/epilogue.js +52 -0
- package/dist/flows/epilogue.js.map +1 -0
- package/dist/flows/executor.d.ts +25 -0
- package/dist/flows/executor.d.ts.map +1 -0
- package/dist/flows/executor.js +153 -0
- package/dist/flows/executor.js.map +1 -0
- package/dist/flows/gate-evaluator.d.ts +26 -0
- package/dist/flows/gate-evaluator.d.ts.map +1 -0
- package/dist/flows/gate-evaluator.js +162 -0
- package/dist/flows/gate-evaluator.js.map +1 -0
- package/dist/flows/index.d.ts +14 -0
- package/dist/flows/index.d.ts.map +1 -0
- package/dist/flows/index.js +20 -0
- package/dist/flows/index.js.map +1 -0
- package/dist/flows/loader.d.ts +17 -0
- package/dist/flows/loader.d.ts.map +1 -0
- package/dist/flows/loader.js +61 -0
- package/dist/flows/loader.js.map +1 -0
- package/dist/flows/plan-builder.d.ts +40 -0
- package/dist/flows/plan-builder.d.ts.map +1 -0
- package/dist/flows/plan-builder.js +213 -0
- package/dist/flows/plan-builder.js.map +1 -0
- package/dist/flows/probes.d.ts +11 -0
- package/dist/flows/probes.d.ts.map +1 -0
- package/dist/flows/probes.js +62 -0
- package/dist/flows/probes.js.map +1 -0
- package/dist/flows/types.d.ts +950 -0
- package/dist/flows/types.d.ts.map +1 -0
- package/dist/flows/types.js +105 -0
- package/dist/flows/types.js.map +1 -0
- package/dist/health/doctor-checks.d.ts +15 -0
- package/dist/health/doctor-checks.d.ts.map +1 -0
- package/dist/health/doctor-checks.js +98 -0
- package/dist/health/doctor-checks.js.map +1 -0
- package/dist/index.d.ts +11 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/intake/text-ingester.d.ts +52 -0
- package/dist/intake/text-ingester.d.ts.map +1 -0
- package/dist/intake/text-ingester.js +181 -0
- package/dist/intake/text-ingester.js.map +1 -0
- package/dist/intelligence/loader.d.ts +19 -0
- package/dist/intelligence/loader.d.ts.map +1 -1
- package/dist/intelligence/loader.js +35 -0
- package/dist/intelligence/loader.js.map +1 -1
- package/dist/intelligence/types.d.ts +1 -0
- package/dist/intelligence/types.d.ts.map +1 -1
- package/dist/llm/llm-client.d.ts.map +1 -1
- package/dist/llm/llm-client.js +37 -1
- package/dist/llm/llm-client.js.map +1 -1
- package/dist/llm/oauth-discovery.d.ts +26 -0
- package/dist/llm/oauth-discovery.d.ts.map +1 -0
- package/dist/llm/oauth-discovery.js +149 -0
- package/dist/llm/oauth-discovery.js.map +1 -0
- package/dist/packs/types.d.ts +58 -19
- package/dist/packs/types.d.ts.map +1 -1
- package/dist/packs/types.js +14 -0
- package/dist/packs/types.js.map +1 -1
- package/dist/planning/evidence-collector.d.ts +41 -0
- package/dist/planning/evidence-collector.d.ts.map +1 -0
- package/dist/planning/evidence-collector.js +194 -0
- package/dist/planning/evidence-collector.js.map +1 -0
- package/dist/planning/planner.d.ts +4 -0
- package/dist/planning/planner.d.ts.map +1 -1
- package/dist/planning/planner.js +11 -0
- package/dist/planning/planner.js.map +1 -1
- package/dist/playbooks/generic/onboarding.d.ts +9 -0
- package/dist/playbooks/generic/onboarding.d.ts.map +1 -0
- package/dist/playbooks/generic/onboarding.js +74 -0
- package/dist/playbooks/generic/onboarding.js.map +1 -0
- package/dist/playbooks/playbook-registry.d.ts.map +1 -1
- package/dist/playbooks/playbook-registry.js +2 -0
- package/dist/playbooks/playbook-registry.js.map +1 -1
- package/dist/queue/job-queue.d.ts +92 -0
- package/dist/queue/job-queue.d.ts.map +1 -0
- package/dist/queue/job-queue.js +180 -0
- package/dist/queue/job-queue.js.map +1 -0
- package/dist/queue/pipeline-runner.d.ts +62 -0
- package/dist/queue/pipeline-runner.d.ts.map +1 -0
- package/dist/queue/pipeline-runner.js +126 -0
- package/dist/queue/pipeline-runner.js.map +1 -0
- package/dist/runtime/admin-extra-ops.d.ts.map +1 -1
- package/dist/runtime/admin-extra-ops.js +15 -9
- package/dist/runtime/admin-extra-ops.js.map +1 -1
- package/dist/runtime/admin-ops.js +4 -4
- package/dist/runtime/admin-ops.js.map +1 -1
- package/dist/runtime/admin-setup-ops.d.ts +20 -0
- package/dist/runtime/admin-setup-ops.d.ts.map +1 -0
- package/dist/runtime/admin-setup-ops.js +583 -0
- package/dist/runtime/admin-setup-ops.js.map +1 -0
- package/dist/runtime/capture-ops.d.ts.map +1 -1
- package/dist/runtime/capture-ops.js +33 -1
- package/dist/runtime/capture-ops.js.map +1 -1
- package/dist/runtime/chain-ops.d.ts +9 -0
- package/dist/runtime/chain-ops.d.ts.map +1 -0
- package/dist/runtime/chain-ops.js +107 -0
- package/dist/runtime/chain-ops.js.map +1 -0
- package/dist/runtime/claude-md-helpers.d.ts +65 -0
- package/dist/runtime/claude-md-helpers.d.ts.map +1 -0
- package/dist/runtime/claude-md-helpers.js +173 -0
- package/dist/runtime/claude-md-helpers.js.map +1 -0
- package/dist/runtime/curator-extra-ops.d.ts +3 -2
- package/dist/runtime/curator-extra-ops.d.ts.map +1 -1
- package/dist/runtime/curator-extra-ops.js +81 -3
- package/dist/runtime/curator-extra-ops.js.map +1 -1
- package/dist/runtime/domain-ops.d.ts +21 -5
- package/dist/runtime/domain-ops.d.ts.map +1 -1
- package/dist/runtime/domain-ops.js +64 -6
- package/dist/runtime/domain-ops.js.map +1 -1
- package/dist/runtime/facades/admin-facade.d.ts.map +1 -1
- package/dist/runtime/facades/admin-facade.js +4 -0
- package/dist/runtime/facades/admin-facade.js.map +1 -1
- package/dist/runtime/facades/agency-facade.d.ts.map +1 -1
- package/dist/runtime/facades/agency-facade.js +64 -0
- package/dist/runtime/facades/agency-facade.js.map +1 -1
- package/dist/runtime/facades/brain-facade.d.ts.map +1 -1
- package/dist/runtime/facades/brain-facade.js +122 -1
- package/dist/runtime/facades/brain-facade.js.map +1 -1
- package/dist/runtime/facades/cognee-facade.d.ts.map +1 -1
- package/dist/runtime/facades/cognee-facade.js +3 -1
- package/dist/runtime/facades/cognee-facade.js.map +1 -1
- package/dist/runtime/facades/control-facade.d.ts.map +1 -1
- package/dist/runtime/facades/control-facade.js +42 -0
- 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 +10 -6
- 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 +20 -2
- package/dist/runtime/facades/memory-facade.js.map +1 -1
- package/dist/runtime/facades/plan-facade.d.ts.map +1 -1
- package/dist/runtime/facades/plan-facade.js +2 -0
- package/dist/runtime/facades/plan-facade.js.map +1 -1
- package/dist/runtime/facades/vault-facade.d.ts.map +1 -1
- package/dist/runtime/facades/vault-facade.js +27 -5
- package/dist/runtime/facades/vault-facade.js.map +1 -1
- package/dist/runtime/intake-ops.d.ts +7 -5
- package/dist/runtime/intake-ops.d.ts.map +1 -1
- package/dist/runtime/intake-ops.js +98 -5
- package/dist/runtime/intake-ops.js.map +1 -1
- package/dist/runtime/memory-extra-ops.d.ts +6 -3
- package/dist/runtime/memory-extra-ops.d.ts.map +1 -1
- package/dist/runtime/memory-extra-ops.js +292 -4
- package/dist/runtime/memory-extra-ops.js.map +1 -1
- package/dist/runtime/orchestrate-ops.d.ts +8 -7
- package/dist/runtime/orchestrate-ops.d.ts.map +1 -1
- package/dist/runtime/orchestrate-ops.js +217 -61
- 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 +85 -0
- package/dist/runtime/planning-extra-ops.js.map +1 -1
- package/dist/runtime/playbook-ops.js +1 -1
- package/dist/runtime/playbook-ops.js.map +1 -1
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +165 -18
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/session-briefing.d.ts +23 -0
- package/dist/runtime/session-briefing.d.ts.map +1 -0
- package/dist/runtime/session-briefing.js +140 -0
- package/dist/runtime/session-briefing.js.map +1 -0
- package/dist/runtime/types.d.ts +29 -2
- package/dist/runtime/types.d.ts.map +1 -1
- package/dist/runtime/vault-linking-ops.d.ts +13 -0
- package/dist/runtime/vault-linking-ops.d.ts.map +1 -0
- package/dist/runtime/vault-linking-ops.js +365 -0
- package/dist/runtime/vault-linking-ops.js.map +1 -0
- package/dist/vault/linking.d.ts +46 -0
- package/dist/vault/linking.d.ts.map +1 -0
- package/dist/vault/linking.js +275 -0
- package/dist/vault/linking.js.map +1 -0
- package/dist/vault/vault-types.d.ts +37 -0
- package/dist/vault/vault-types.d.ts.map +1 -1
- package/dist/vault/vault.d.ts +37 -0
- package/dist/vault/vault.d.ts.map +1 -1
- package/dist/vault/vault.js +152 -9
- package/dist/vault/vault.js.map +1 -1
- package/package.json +4 -1
- package/src/__tests__/admin-extra-ops.test.ts +1 -1
- package/src/__tests__/admin-ops.test.ts +2 -1
- package/src/__tests__/admin-setup-ops.test.ts +355 -0
- package/src/__tests__/async-infrastructure.test.ts +307 -0
- package/src/__tests__/cognee-client-gaps.test.ts +474 -0
- package/src/__tests__/cognee-hybrid-search.test.ts +492 -0
- package/src/__tests__/cognee-sync-manager-deep.test.ts +654 -0
- package/src/__tests__/cognee-sync-manager.test.ts +1 -0
- package/src/__tests__/core-ops.test.ts +9 -61
- package/src/__tests__/curator-extra-ops.test.ts +6 -2
- package/src/__tests__/curator-pipeline-e2e.test.ts +358 -0
- package/src/__tests__/domain-packs.test.ts +421 -0
- package/src/__tests__/flows.test.ts +604 -0
- package/src/__tests__/memory-extra-ops.test.ts +2 -2
- package/src/__tests__/planning-extra-ops.test.ts +2 -2
- package/src/__tests__/playbook-registry.test.ts +2 -2
- package/src/__tests__/playbook-seeder.test.ts +8 -8
- package/src/__tests__/playbook.test.ts +5 -5
- package/src/__tests__/second-brain-features.test.ts +583 -0
- package/src/__tests__/token-resolver.test.ts +79 -0
- package/src/agency/agency-manager.ts +217 -9
- package/src/agency/default-rules.ts +83 -0
- package/src/agency/types.ts +61 -0
- package/src/brain/brain.ts +110 -8
- package/src/brain/intelligence.ts +21 -2
- package/src/brain/knowledge-synthesizer.ts +218 -0
- package/src/brain/learning-radar.ts +340 -0
- package/src/brain/types.ts +16 -0
- package/src/capabilities/chain-mapping.ts +93 -0
- package/src/capabilities/index.ts +21 -0
- package/src/capabilities/registry.ts +290 -0
- package/src/capabilities/types.ts +143 -0
- package/src/context/context-engine.ts +114 -15
- package/src/context/types.ts +5 -0
- package/src/control/intent-router.ts +153 -2
- package/src/control/types.ts +10 -0
- package/src/curator/classifier.ts +88 -0
- package/src/curator/quality-gate.ts +129 -0
- package/src/domain-packs/index.ts +27 -0
- package/src/domain-packs/inject-rules.ts +74 -0
- package/src/domain-packs/knowledge-installer.ts +116 -0
- package/src/domain-packs/loader.ts +124 -0
- package/src/domain-packs/pack-runtime.ts +99 -0
- package/src/domain-packs/skills-installer.ts +56 -0
- package/src/domain-packs/token-resolver.ts +126 -0
- package/src/domain-packs/types.ts +229 -0
- package/src/engine/__tests__/register-engine.test.ts +104 -0
- package/src/engine/bin/soleri-engine.ts +218 -0
- package/src/engine/core-ops.ts +178 -0
- package/src/engine/index.ts +19 -0
- package/src/engine/register-engine.ts +385 -0
- package/src/engine/test-helpers.ts +83 -0
- package/src/events/event-bus.ts +58 -0
- package/src/flows/chain-runner.ts +369 -0
- package/src/flows/chain-types.ts +57 -0
- package/src/flows/context-router.ts +257 -0
- package/src/flows/dispatch-registry.ts +80 -0
- package/src/flows/epilogue.ts +65 -0
- package/src/flows/executor.ts +182 -0
- package/src/flows/gate-evaluator.ts +171 -0
- package/src/flows/index.ts +52 -0
- package/src/flows/loader.ts +63 -0
- package/src/flows/plan-builder.ts +250 -0
- package/src/flows/probes.ts +70 -0
- package/src/flows/types.ts +217 -0
- package/src/health/doctor-checks.ts +115 -0
- package/src/index.ts +68 -1
- package/src/intake/text-ingester.ts +234 -0
- package/src/intelligence/loader.ts +38 -0
- package/src/intelligence/types.ts +1 -0
- package/src/llm/llm-client.ts +38 -1
- package/src/llm/oauth-discovery.ts +169 -0
- package/src/packs/types.ts +19 -0
- package/src/planning/evidence-collector.ts +247 -0
- package/src/planning/planner.ts +11 -0
- package/src/playbooks/generic/onboarding.ts +79 -0
- package/src/playbooks/playbook-registry.ts +2 -0
- package/src/queue/job-queue.ts +281 -0
- package/src/queue/pipeline-runner.ts +149 -0
- package/src/runtime/admin-extra-ops.ts +14 -8
- package/src/runtime/admin-ops.ts +4 -4
- package/src/runtime/admin-setup-ops.ts +664 -0
- package/src/runtime/capture-ops.ts +40 -1
- package/src/runtime/chain-ops.ts +121 -0
- package/src/runtime/claude-md-helpers.ts +236 -0
- package/src/runtime/curator-extra-ops.ts +86 -3
- package/src/runtime/domain-ops.ts +71 -5
- package/src/runtime/facades/admin-facade.ts +4 -0
- package/src/runtime/facades/agency-facade.ts +68 -0
- package/src/runtime/facades/brain-facade.ts +142 -1
- package/src/runtime/facades/cognee-facade.ts +3 -1
- package/src/runtime/facades/control-facade.ts +45 -0
- package/src/runtime/facades/index.ts +12 -6
- package/src/runtime/facades/memory-facade.ts +20 -2
- package/src/runtime/facades/plan-facade.ts +2 -0
- package/src/runtime/facades/vault-facade.ts +30 -5
- package/src/runtime/intake-ops.ts +107 -5
- package/src/runtime/memory-extra-ops.ts +312 -4
- package/src/runtime/orchestrate-ops.ts +261 -65
- package/src/runtime/planning-extra-ops.ts +94 -0
- package/src/runtime/playbook-ops.ts +1 -1
- package/src/runtime/runtime.ts +164 -19
- package/src/runtime/session-briefing.ts +161 -0
- package/src/runtime/types.ts +29 -2
- package/src/runtime/vault-linking-ops.ts +452 -0
- package/src/vault/linking.ts +333 -0
- package/src/vault/vault-types.ts +46 -0
- package/src/vault/vault.ts +173 -11
|
@@ -1,57 +1,180 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Orchestration operations —
|
|
2
|
+
* Orchestration operations — flow-engine-driven workflows.
|
|
3
3
|
*
|
|
4
|
-
* These ops
|
|
5
|
-
* - orchestrate_plan:
|
|
6
|
-
* - orchestrate_execute:
|
|
7
|
-
* - orchestrate_complete:
|
|
4
|
+
* These ops wire the YAML flow engine into the facade layer:
|
|
5
|
+
* - orchestrate_plan: intent detection + buildPlan from flow engine
|
|
6
|
+
* - orchestrate_execute: FlowExecutor dispatches steps to facade ops
|
|
7
|
+
* - orchestrate_complete: runEpilogue captures knowledge + session
|
|
8
8
|
* - orchestrate_status: combined status across all modules
|
|
9
9
|
* - orchestrate_quick_capture: one-call knowledge capture without full planning
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { z } from 'zod';
|
|
13
|
-
import type { OpDefinition } from '../facades/types.js';
|
|
13
|
+
import type { OpDefinition, FacadeConfig } from '../facades/types.js';
|
|
14
14
|
import type { AgentRuntime } from './types.js';
|
|
15
|
+
import { buildPlan } from '../flows/plan-builder.js';
|
|
16
|
+
import { FlowExecutor } from '../flows/executor.js';
|
|
17
|
+
import { createDispatcher } from '../flows/dispatch-registry.js';
|
|
18
|
+
import { runEpilogue } from '../flows/epilogue.js';
|
|
19
|
+
import type { OrchestrationPlan, ExecutionResult } from '../flows/types.js';
|
|
20
|
+
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Intent detection — keyword-based mapping from prompt to intent
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
const INTENT_KEYWORDS: [RegExp, string][] = [
|
|
26
|
+
[/\b(fix|bug|broken|error|crash|issue)\b/i, 'FIX'],
|
|
27
|
+
[/\b(review|audit|check|inspect)\b/i, 'REVIEW'],
|
|
28
|
+
[/\b(build|create|add|new|implement|scaffold)\b/i, 'BUILD'],
|
|
29
|
+
[/\b(plan|architect|design-system|roadmap)\b/i, 'PLAN'],
|
|
30
|
+
[/\b(enhance|improve|refactor|optimize)\b/i, 'ENHANCE'],
|
|
31
|
+
[/\b(explore|research|investigate|spike)\b/i, 'EXPLORE'],
|
|
32
|
+
[/\b(deploy|ship|release|publish)\b/i, 'DELIVER'],
|
|
33
|
+
[/\b(design|palette|theme|color|typography)\b/i, 'DESIGN'],
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
function detectIntent(prompt: string): string {
|
|
37
|
+
for (const [pattern, intent] of INTENT_KEYWORDS) {
|
|
38
|
+
if (pattern.test(prompt)) return intent;
|
|
39
|
+
}
|
|
40
|
+
return 'BUILD'; // default
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ---------------------------------------------------------------------------
|
|
44
|
+
// In-memory plan store
|
|
45
|
+
// ---------------------------------------------------------------------------
|
|
46
|
+
|
|
47
|
+
interface PlanEntry {
|
|
48
|
+
plan: OrchestrationPlan;
|
|
49
|
+
executionResult?: ExecutionResult;
|
|
50
|
+
createdAt: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const planStore = new Map<string, PlanEntry>();
|
|
54
|
+
|
|
55
|
+
// ---------------------------------------------------------------------------
|
|
56
|
+
// Helper: create a runtime-backed dispatcher
|
|
57
|
+
// ---------------------------------------------------------------------------
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Build a dispatch function that routes tool names to runtime modules.
|
|
61
|
+
* If facades are provided, uses the full dispatch registry.
|
|
62
|
+
* Otherwise, falls back to a simple runtime-based dispatcher.
|
|
63
|
+
*/
|
|
64
|
+
function buildDispatch(
|
|
65
|
+
agentId: string,
|
|
66
|
+
runtime: AgentRuntime,
|
|
67
|
+
facades?: FacadeConfig[],
|
|
68
|
+
) {
|
|
69
|
+
if (facades && facades.length > 0) {
|
|
70
|
+
return createDispatcher(agentId, facades);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Fallback: runtime-based dispatch for known tool patterns
|
|
74
|
+
return async (
|
|
75
|
+
toolName: string,
|
|
76
|
+
params: Record<string, unknown>,
|
|
77
|
+
): Promise<{ tool: string; status: string; data?: unknown; error?: string }> => {
|
|
78
|
+
try {
|
|
79
|
+
// Handle well-known epilogue tools directly via runtime
|
|
80
|
+
if (toolName === 'capture_knowledge' || toolName.endsWith('_capture_knowledge')) {
|
|
81
|
+
const title = (params.title as string) ?? 'Flow execution';
|
|
82
|
+
const description = (params.content as string) ?? (params.description as string) ?? '';
|
|
83
|
+
const tags = (params.tags as string[]) ?? ['workflow'];
|
|
84
|
+
runtime.vault.add({
|
|
85
|
+
id: `flow-${Date.now()}`,
|
|
86
|
+
title,
|
|
87
|
+
description,
|
|
88
|
+
type: 'pattern',
|
|
89
|
+
domain: 'workflow',
|
|
90
|
+
severity: 'suggestion',
|
|
91
|
+
tags,
|
|
92
|
+
});
|
|
93
|
+
return { tool: toolName, status: 'ok', data: { title } };
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if (toolName === 'session_capture' || toolName.endsWith('_session_capture')) {
|
|
97
|
+
// Session capture is best-effort
|
|
98
|
+
return { tool: toolName, status: 'ok', data: { sessionId: 'flow-session' } };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// For other tools: mark as unregistered (graceful degradation)
|
|
102
|
+
return { tool: toolName, status: 'unregistered' };
|
|
103
|
+
} catch (err) {
|
|
104
|
+
return {
|
|
105
|
+
tool: toolName,
|
|
106
|
+
status: 'error',
|
|
107
|
+
error: err instanceof Error ? err.message : String(err),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// ---------------------------------------------------------------------------
|
|
114
|
+
// Op factory
|
|
115
|
+
// ---------------------------------------------------------------------------
|
|
15
116
|
|
|
16
117
|
/**
|
|
17
118
|
* Create the 5 orchestration operations for an agent runtime.
|
|
119
|
+
* Optionally accepts facades for full dispatch capability.
|
|
18
120
|
*/
|
|
19
|
-
export function createOrchestrateOps(
|
|
121
|
+
export function createOrchestrateOps(
|
|
122
|
+
runtime: AgentRuntime,
|
|
123
|
+
facades?: FacadeConfig[],
|
|
124
|
+
): OpDefinition[] {
|
|
20
125
|
const { planner, brainIntelligence, vault } = runtime;
|
|
126
|
+
const agentId = runtime.config.agentId;
|
|
21
127
|
|
|
22
128
|
return [
|
|
23
129
|
// ─── orchestrate_plan ─────────────────────────────────────────
|
|
24
130
|
{
|
|
25
131
|
name: 'orchestrate_plan',
|
|
26
132
|
description:
|
|
27
|
-
'Create a
|
|
28
|
-
'
|
|
29
|
-
'
|
|
133
|
+
'Create a flow-engine-driven plan. Detects intent from the prompt, ' +
|
|
134
|
+
'loads the matching YAML flow, probes runtime capabilities, and builds ' +
|
|
135
|
+
'a pruned orchestration plan with gate-guarded steps.',
|
|
30
136
|
auth: 'write',
|
|
31
137
|
schema: z.object({
|
|
32
|
-
|
|
33
|
-
|
|
138
|
+
prompt: z
|
|
139
|
+
.string()
|
|
140
|
+
.describe('Natural language description of what to do'),
|
|
141
|
+
projectPath: z
|
|
142
|
+
.string()
|
|
143
|
+
.optional()
|
|
144
|
+
.default('.')
|
|
145
|
+
.describe('Project root path'),
|
|
146
|
+
// Legacy params — still accepted for backward compat
|
|
147
|
+
objective: z
|
|
148
|
+
.string()
|
|
149
|
+
.optional()
|
|
150
|
+
.describe('(Legacy) Plan objective — use prompt instead'),
|
|
151
|
+
scope: z
|
|
152
|
+
.string()
|
|
153
|
+
.optional()
|
|
154
|
+
.describe('(Legacy) Plan scope'),
|
|
34
155
|
domain: z
|
|
35
156
|
.string()
|
|
36
157
|
.optional()
|
|
37
|
-
.describe('Domain for brain recommendations
|
|
158
|
+
.describe('Domain hint for brain recommendations'),
|
|
38
159
|
tasks: z
|
|
39
160
|
.array(z.object({ title: z.string(), description: z.string() }))
|
|
40
161
|
.optional()
|
|
41
162
|
.describe('Optional pre-defined tasks'),
|
|
42
163
|
}),
|
|
43
164
|
handler: async (params) => {
|
|
44
|
-
const
|
|
45
|
-
const
|
|
165
|
+
const prompt = (params.prompt as string) ?? (params.objective as string) ?? '';
|
|
166
|
+
const projectPath = (params.projectPath as string) ?? '.';
|
|
46
167
|
const domain = params.domain as string | undefined;
|
|
47
|
-
const tasks = (params.tasks as Array<{ title: string; description: string }>) ?? [];
|
|
48
168
|
|
|
49
|
-
//
|
|
169
|
+
// 1. Detect intent from prompt
|
|
170
|
+
const intent = detectIntent(prompt);
|
|
171
|
+
|
|
172
|
+
// 2. Get brain recommendations — graceful degradation
|
|
50
173
|
let recommendations: Array<{ pattern: string; strength: number }> = [];
|
|
51
174
|
try {
|
|
52
175
|
const raw = brainIntelligence.recommend({
|
|
53
176
|
domain,
|
|
54
|
-
task:
|
|
177
|
+
task: prompt,
|
|
55
178
|
limit: 5,
|
|
56
179
|
});
|
|
57
180
|
recommendations = raw.map((r) => ({
|
|
@@ -59,36 +182,63 @@ export function createOrchestrateOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
59
182
|
strength: r.strength,
|
|
60
183
|
}));
|
|
61
184
|
} catch {
|
|
62
|
-
// Brain has no data yet
|
|
185
|
+
// Brain has no data yet
|
|
63
186
|
}
|
|
64
187
|
|
|
65
|
-
// Fallback
|
|
188
|
+
// Fallback to vault if brain empty
|
|
66
189
|
if (recommendations.length === 0) {
|
|
67
190
|
try {
|
|
68
|
-
const vaultResults = vault.search(
|
|
191
|
+
const vaultResults = vault.search(prompt, { domain, limit: 5 });
|
|
69
192
|
recommendations = vaultResults.map((r) => ({
|
|
70
193
|
pattern: r.entry.title,
|
|
71
194
|
strength: 50,
|
|
72
195
|
}));
|
|
73
196
|
} catch {
|
|
74
|
-
// Vault search failed
|
|
197
|
+
// Vault search failed
|
|
75
198
|
}
|
|
76
199
|
}
|
|
77
200
|
|
|
78
|
-
// Build
|
|
201
|
+
// 3. Build flow-engine plan
|
|
202
|
+
const plan = await buildPlan(intent, agentId, projectPath, runtime, prompt);
|
|
203
|
+
|
|
204
|
+
// 4. Store in planStore
|
|
205
|
+
planStore.set(plan.planId, { plan, createdAt: Date.now() });
|
|
206
|
+
|
|
207
|
+
// 5. Also create a planner plan for lifecycle tracking (backward compat)
|
|
79
208
|
const decisions = recommendations.map(
|
|
80
209
|
(r) => `Brain pattern: ${r.pattern} (strength: ${r.strength.toFixed(1)})`,
|
|
81
210
|
);
|
|
211
|
+
const tasks = (params.tasks as Array<{ title: string; description: string }>) ?? [];
|
|
82
212
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
213
|
+
let legacyPlan;
|
|
214
|
+
try {
|
|
215
|
+
legacyPlan = planner.create({
|
|
216
|
+
objective: prompt,
|
|
217
|
+
scope: (params.scope as string) ?? `${intent} workflow`,
|
|
218
|
+
decisions,
|
|
219
|
+
tasks,
|
|
220
|
+
});
|
|
221
|
+
} catch {
|
|
222
|
+
// Planner creation failed — flow plan still valid
|
|
223
|
+
}
|
|
90
224
|
|
|
91
|
-
return {
|
|
225
|
+
return {
|
|
226
|
+
plan: legacyPlan ?? {
|
|
227
|
+
id: plan.planId,
|
|
228
|
+
objective: prompt,
|
|
229
|
+
decisions,
|
|
230
|
+
},
|
|
231
|
+
recommendations,
|
|
232
|
+
flow: {
|
|
233
|
+
planId: plan.planId,
|
|
234
|
+
intent: plan.intent,
|
|
235
|
+
flowId: plan.flowId,
|
|
236
|
+
stepsCount: plan.steps.length,
|
|
237
|
+
skippedCount: plan.skipped.length,
|
|
238
|
+
warnings: plan.warnings,
|
|
239
|
+
estimatedTools: plan.estimatedTools,
|
|
240
|
+
},
|
|
241
|
+
};
|
|
92
242
|
},
|
|
93
243
|
},
|
|
94
244
|
|
|
@@ -96,11 +246,11 @@ export function createOrchestrateOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
96
246
|
{
|
|
97
247
|
name: 'orchestrate_execute',
|
|
98
248
|
description:
|
|
99
|
-
'
|
|
100
|
-
'
|
|
249
|
+
'Execute a flow-engine plan. Dispatches each step to its facade ops, ' +
|
|
250
|
+
'evaluates gates, and tracks execution with a brain session.',
|
|
101
251
|
auth: 'write',
|
|
102
252
|
schema: z.object({
|
|
103
|
-
planId: z.string().describe('ID of the
|
|
253
|
+
planId: z.string().describe('ID of the plan to execute (flow planId or legacy planId)'),
|
|
104
254
|
domain: z.string().optional().describe('Domain for brain session tracking'),
|
|
105
255
|
context: z.string().optional().describe('Additional context for the brain session'),
|
|
106
256
|
}),
|
|
@@ -109,10 +259,41 @@ export function createOrchestrateOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
109
259
|
const domain = params.domain as string | undefined;
|
|
110
260
|
const context = params.context as string | undefined;
|
|
111
261
|
|
|
112
|
-
//
|
|
113
|
-
const
|
|
262
|
+
// Look up flow plan
|
|
263
|
+
const entry = planStore.get(planId);
|
|
114
264
|
|
|
115
|
-
|
|
265
|
+
if (entry) {
|
|
266
|
+
// Flow-engine execution path
|
|
267
|
+
const dispatch = buildDispatch(agentId, runtime, facades);
|
|
268
|
+
const executor = new FlowExecutor(dispatch);
|
|
269
|
+
const executionResult = await executor.execute(entry.plan);
|
|
270
|
+
|
|
271
|
+
// Store result
|
|
272
|
+
entry.executionResult = executionResult;
|
|
273
|
+
|
|
274
|
+
// Start brain session
|
|
275
|
+
const session = brainIntelligence.lifecycle({
|
|
276
|
+
action: 'start',
|
|
277
|
+
domain,
|
|
278
|
+
context,
|
|
279
|
+
planId,
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
return {
|
|
283
|
+
plan: { id: planId, status: 'executing' },
|
|
284
|
+
session,
|
|
285
|
+
execution: {
|
|
286
|
+
status: executionResult.status,
|
|
287
|
+
stepsCompleted: executionResult.stepsCompleted,
|
|
288
|
+
totalSteps: executionResult.totalSteps,
|
|
289
|
+
toolsCalled: executionResult.toolsCalled,
|
|
290
|
+
durationMs: executionResult.durationMs,
|
|
291
|
+
},
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Legacy path: no flow plan found, use planner directly
|
|
296
|
+
const plan = planner.startExecution(planId);
|
|
116
297
|
const session = brainIntelligence.lifecycle({
|
|
117
298
|
action: 'start',
|
|
118
299
|
domain,
|
|
@@ -128,9 +309,8 @@ export function createOrchestrateOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
128
309
|
{
|
|
129
310
|
name: 'orchestrate_complete',
|
|
130
311
|
description:
|
|
131
|
-
'Complete plan execution,
|
|
132
|
-
'
|
|
133
|
-
'and runs knowledge extraction on the session.',
|
|
312
|
+
'Complete plan execution, run epilogue (knowledge capture + session capture), ' +
|
|
313
|
+
'end brain session, and clean up.',
|
|
134
314
|
auth: 'write',
|
|
135
315
|
schema: z.object({
|
|
136
316
|
planId: z.string().describe('ID of the executing plan to complete'),
|
|
@@ -150,10 +330,10 @@ export function createOrchestrateOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
150
330
|
const toolsUsed = (params.toolsUsed as string[]) ?? [];
|
|
151
331
|
const filesModified = (params.filesModified as string[]) ?? [];
|
|
152
332
|
|
|
153
|
-
// Complete the plan
|
|
333
|
+
// Complete the planner plan (legacy lifecycle)
|
|
154
334
|
const plan = planner.complete(planId);
|
|
155
335
|
|
|
156
|
-
// End brain session
|
|
336
|
+
// End brain session
|
|
157
337
|
const session = brainIntelligence.lifecycle({
|
|
158
338
|
action: 'end',
|
|
159
339
|
sessionId,
|
|
@@ -163,15 +343,36 @@ export function createOrchestrateOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
163
343
|
filesModified,
|
|
164
344
|
});
|
|
165
345
|
|
|
166
|
-
// Extract knowledge
|
|
346
|
+
// Extract knowledge
|
|
167
347
|
let extraction = null;
|
|
168
348
|
try {
|
|
169
349
|
extraction = brainIntelligence.extractKnowledge(sessionId);
|
|
170
350
|
} catch {
|
|
171
|
-
//
|
|
351
|
+
// Not enough signal
|
|
172
352
|
}
|
|
173
353
|
|
|
174
|
-
|
|
354
|
+
// Run flow-engine epilogue if we have a flow plan
|
|
355
|
+
let epilogueResult = null;
|
|
356
|
+
const entry = planStore.get(planId);
|
|
357
|
+
if (entry) {
|
|
358
|
+
try {
|
|
359
|
+
const dispatch = buildDispatch(agentId, runtime, facades);
|
|
360
|
+
const summary = `${outcome}: ${entry.plan.summary}. Tools: ${toolsUsed.join(', ') || 'none'}. Files: ${filesModified.join(', ') || 'none'}.`;
|
|
361
|
+
epilogueResult = await runEpilogue(
|
|
362
|
+
dispatch,
|
|
363
|
+
entry.plan.context.probes,
|
|
364
|
+
entry.plan.context.projectPath,
|
|
365
|
+
summary,
|
|
366
|
+
);
|
|
367
|
+
} catch {
|
|
368
|
+
// Epilogue is best-effort
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
// Clean up plan store
|
|
372
|
+
planStore.delete(planId);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
return { plan, session, extraction, epilogue: epilogueResult };
|
|
175
376
|
},
|
|
176
377
|
},
|
|
177
378
|
|
|
@@ -180,7 +381,7 @@ export function createOrchestrateOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
180
381
|
name: 'orchestrate_status',
|
|
181
382
|
description:
|
|
182
383
|
'Get combined orchestration status: active plans, brain session context, ' +
|
|
183
|
-
'vault stats,
|
|
384
|
+
'vault stats, recent brain recommendations, and flow plan store.',
|
|
184
385
|
auth: 'read',
|
|
185
386
|
schema: z.object({
|
|
186
387
|
domain: z.string().optional().describe('Filter recommendations by domain'),
|
|
@@ -193,22 +394,13 @@ export function createOrchestrateOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
193
394
|
const domain = params.domain as string | undefined;
|
|
194
395
|
const sessionLimit = (params.sessionLimit as number) ?? 5;
|
|
195
396
|
|
|
196
|
-
// Active plans
|
|
197
397
|
const activePlans = planner.getActive();
|
|
198
|
-
|
|
199
|
-
// Brain session context
|
|
200
398
|
const sessionContext = brainIntelligence.getSessionContext(sessionLimit);
|
|
201
|
-
|
|
202
|
-
// Vault stats
|
|
203
399
|
const vaultStats = vault.stats();
|
|
204
400
|
|
|
205
|
-
// Recent recommendations — graceful degradation
|
|
206
401
|
let recommendations: Array<{ pattern: string; strength: number }> = [];
|
|
207
402
|
try {
|
|
208
|
-
const raw = brainIntelligence.recommend({
|
|
209
|
-
domain,
|
|
210
|
-
limit: 5,
|
|
211
|
-
});
|
|
403
|
+
const raw = brainIntelligence.recommend({ domain, limit: 5 });
|
|
212
404
|
recommendations = raw.map((r) => ({
|
|
213
405
|
pattern: r.pattern,
|
|
214
406
|
strength: r.strength,
|
|
@@ -217,15 +409,25 @@ export function createOrchestrateOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
217
409
|
// No recommendations available
|
|
218
410
|
}
|
|
219
411
|
|
|
220
|
-
// Brain intelligence stats
|
|
221
412
|
const brainStats = brainIntelligence.getStats();
|
|
222
413
|
|
|
414
|
+
// Include flow plan store info
|
|
415
|
+
const flowPlans = Array.from(planStore.entries()).map(([id, e]) => ({
|
|
416
|
+
planId: id,
|
|
417
|
+
intent: e.plan.intent,
|
|
418
|
+
flowId: e.plan.flowId,
|
|
419
|
+
stepsCount: e.plan.steps.length,
|
|
420
|
+
hasResult: !!e.executionResult,
|
|
421
|
+
createdAt: e.createdAt,
|
|
422
|
+
}));
|
|
423
|
+
|
|
223
424
|
return {
|
|
224
425
|
activePlans,
|
|
225
426
|
sessionContext,
|
|
226
427
|
vaultStats,
|
|
227
428
|
recommendations,
|
|
228
429
|
brainStats,
|
|
430
|
+
flowPlans,
|
|
229
431
|
};
|
|
230
432
|
},
|
|
231
433
|
},
|
|
@@ -255,7 +457,6 @@ export function createOrchestrateOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
255
457
|
const filesModified = (params.filesModified as string[]) ?? [];
|
|
256
458
|
const outcome = (params.outcome as string) ?? 'completed';
|
|
257
459
|
|
|
258
|
-
// Start session
|
|
259
460
|
const startedSession = brainIntelligence.lifecycle({
|
|
260
461
|
action: 'start',
|
|
261
462
|
domain,
|
|
@@ -264,7 +465,6 @@ export function createOrchestrateOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
264
465
|
filesModified,
|
|
265
466
|
});
|
|
266
467
|
|
|
267
|
-
// End session immediately with outcome
|
|
268
468
|
const endedSession = brainIntelligence.lifecycle({
|
|
269
469
|
action: 'end',
|
|
270
470
|
sessionId: startedSession.id,
|
|
@@ -273,18 +473,14 @@ export function createOrchestrateOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
273
473
|
planOutcome: outcome,
|
|
274
474
|
});
|
|
275
475
|
|
|
276
|
-
// Extract knowledge — graceful if nothing to extract
|
|
277
476
|
let extraction = null;
|
|
278
477
|
try {
|
|
279
478
|
extraction = brainIntelligence.extractKnowledge(startedSession.id);
|
|
280
479
|
} catch {
|
|
281
|
-
// Not enough signal
|
|
480
|
+
// Not enough signal
|
|
282
481
|
}
|
|
283
482
|
|
|
284
|
-
return {
|
|
285
|
-
session: endedSession,
|
|
286
|
-
extraction,
|
|
287
|
-
};
|
|
483
|
+
return { session: endedSession, extraction };
|
|
288
484
|
},
|
|
289
485
|
},
|
|
290
486
|
];
|
|
@@ -13,6 +13,7 @@ import { z } from 'zod';
|
|
|
13
13
|
import type { OpDefinition } from '../facades/types.js';
|
|
14
14
|
import type { AgentRuntime } from './types.js';
|
|
15
15
|
import type { DriftItem, TaskEvidence } from '../planning/planner.js';
|
|
16
|
+
import { collectGitEvidence } from '../planning/evidence-collector.js';
|
|
16
17
|
import { matchPlaybooks, type PlaybookMatchResult } from '../playbooks/index.js';
|
|
17
18
|
import { entryToPlaybookDefinition } from '../playbooks/index.js';
|
|
18
19
|
|
|
@@ -714,5 +715,98 @@ export function createPlanningExtraOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
714
715
|
}
|
|
715
716
|
},
|
|
716
717
|
},
|
|
718
|
+
|
|
719
|
+
// ─── Evidence-Based Reconciliation (#206) ─────────────────────
|
|
720
|
+
{
|
|
721
|
+
name: 'plan_reconcile_with_evidence',
|
|
722
|
+
description:
|
|
723
|
+
'Cross-reference plan tasks against git diff to produce an evidence-based drift report. ' +
|
|
724
|
+
'Shows which tasks have matching file changes, which are missing, and what unplanned work was done.',
|
|
725
|
+
auth: 'read',
|
|
726
|
+
schema: z.object({
|
|
727
|
+
planId: z.string().describe('Plan ID to verify against git'),
|
|
728
|
+
projectPath: z.string().describe('Project root (must be a git repo)'),
|
|
729
|
+
baseBranch: z
|
|
730
|
+
.string()
|
|
731
|
+
.optional()
|
|
732
|
+
.default('main')
|
|
733
|
+
.describe('Branch to diff against (default: main)'),
|
|
734
|
+
}),
|
|
735
|
+
handler: async (params) => {
|
|
736
|
+
try {
|
|
737
|
+
const plan = planner.get(params.planId as string);
|
|
738
|
+
if (!plan) return { error: `Plan not found: ${params.planId}` };
|
|
739
|
+
|
|
740
|
+
return collectGitEvidence(
|
|
741
|
+
plan,
|
|
742
|
+
params.projectPath as string,
|
|
743
|
+
params.baseBranch as string,
|
|
744
|
+
);
|
|
745
|
+
} catch (err) {
|
|
746
|
+
return { error: (err as Error).message };
|
|
747
|
+
}
|
|
748
|
+
},
|
|
749
|
+
},
|
|
750
|
+
|
|
751
|
+
// ─── Purge Plans (#215) ──────────────────────────────────────────
|
|
752
|
+
{
|
|
753
|
+
name: 'plan_purge',
|
|
754
|
+
description:
|
|
755
|
+
'Permanently delete plans by mode: "archived" (only archived), "completed" (completed + archived), ' +
|
|
756
|
+
'"stale" (draft/approved older than 24h), or "specific" (by IDs). Use dryRun to preview.',
|
|
757
|
+
auth: 'admin',
|
|
758
|
+
schema: z.object({
|
|
759
|
+
mode: z.enum(['archived', 'completed', 'stale', 'specific']).describe('Purge mode'),
|
|
760
|
+
planIds: z.array(z.string()).optional().describe('Plan IDs for specific mode'),
|
|
761
|
+
dryRun: z.boolean().optional().default(false).describe('Preview without deleting'),
|
|
762
|
+
}),
|
|
763
|
+
handler: async (params) => {
|
|
764
|
+
const mode = params.mode as string;
|
|
765
|
+
const dryRun = params.dryRun as boolean;
|
|
766
|
+
const plans = planner.list();
|
|
767
|
+
const now = Date.now();
|
|
768
|
+
const staleThresholdMs = 24 * 60 * 60 * 1000;
|
|
769
|
+
|
|
770
|
+
let toPurge: typeof plans;
|
|
771
|
+
if (mode === 'archived') {
|
|
772
|
+
toPurge = plans.filter((p) => p.status === 'archived');
|
|
773
|
+
} else if (mode === 'completed') {
|
|
774
|
+
toPurge = plans.filter((p) => p.status === 'completed' || p.status === 'archived');
|
|
775
|
+
} else if (mode === 'stale') {
|
|
776
|
+
toPurge = plans.filter(
|
|
777
|
+
(p) =>
|
|
778
|
+
(p.status === 'draft' || p.status === 'approved' || p.status === 'brainstorming') &&
|
|
779
|
+
p.createdAt &&
|
|
780
|
+
now - p.createdAt > staleThresholdMs,
|
|
781
|
+
);
|
|
782
|
+
} else if (mode === 'specific') {
|
|
783
|
+
const ids = new Set((params.planIds as string[]) ?? []);
|
|
784
|
+
toPurge = plans.filter((p) => ids.has(p.id));
|
|
785
|
+
} else {
|
|
786
|
+
return { error: `Unknown purge mode: ${mode}` };
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
if (dryRun) {
|
|
790
|
+
return {
|
|
791
|
+
dryRun: true,
|
|
792
|
+
mode,
|
|
793
|
+
wouldPurge: toPurge.length,
|
|
794
|
+
plans: toPurge.map((p) => ({ id: p.id, status: p.status, objective: p.objective })),
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
let purged = 0;
|
|
799
|
+
for (const p of toPurge) {
|
|
800
|
+
try {
|
|
801
|
+
planner.remove(p.id);
|
|
802
|
+
purged++;
|
|
803
|
+
} catch {
|
|
804
|
+
// Skip plans that can't be removed
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
return { purged, mode };
|
|
809
|
+
},
|
|
810
|
+
},
|
|
717
811
|
];
|
|
718
812
|
}
|
|
@@ -88,7 +88,7 @@ export function createPlaybookOps(runtime: AgentRuntime): OpDefinition[] {
|
|
|
88
88
|
validation?: string;
|
|
89
89
|
}>;
|
|
90
90
|
|
|
91
|
-
const steps = rawSteps.map((s, i) => ({
|
|
91
|
+
const steps = rawSteps.map((s, i) => Object.assign({}, s, { order: i + 1 }));
|
|
92
92
|
const id =
|
|
93
93
|
(params.id as string | undefined) ??
|
|
94
94
|
`playbook-${domain}-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|