@llm-dev-ops/agentics-cli 1.4.58 → 1.4.68
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/README.md +1 -1
- package/dist/commands/agents.d.ts.map +1 -1
- package/dist/commands/agents.js +227 -19
- package/dist/commands/agents.js.map +1 -1
- package/dist/pipeline/auto-chain.d.ts +1 -0
- package/dist/pipeline/auto-chain.d.ts.map +1 -1
- package/dist/pipeline/auto-chain.js +124 -37
- package/dist/pipeline/auto-chain.js.map +1 -1
- package/dist/pipeline/execution-context.d.ts.map +1 -1
- package/dist/pipeline/execution-context.js +12 -37
- package/dist/pipeline/execution-context.js.map +1 -1
- package/dist/pipeline/phase2/phases/adr-generator.d.ts.map +1 -1
- package/dist/pipeline/phase2/phases/adr-generator.js +160 -1
- package/dist/pipeline/phase2/phases/adr-generator.js.map +1 -1
- package/dist/pipeline/phase2/phases/ddd-generator.d.ts.map +1 -1
- package/dist/pipeline/phase2/phases/ddd-generator.js +400 -3
- package/dist/pipeline/phase2/phases/ddd-generator.js.map +1 -1
- package/dist/pipeline/phase2/phases/ddd-quality-gate.d.ts +43 -0
- package/dist/pipeline/phase2/phases/ddd-quality-gate.d.ts.map +1 -0
- package/dist/pipeline/phase2/phases/ddd-quality-gate.js +413 -0
- package/dist/pipeline/phase2/phases/ddd-quality-gate.js.map +1 -0
- package/dist/pipeline/phase2/phases/research-dossier.d.ts +0 -13
- package/dist/pipeline/phase2/phases/research-dossier.d.ts.map +1 -1
- package/dist/pipeline/phase2/phases/research-dossier.js +114 -1
- package/dist/pipeline/phase2/phases/research-dossier.js.map +1 -1
- package/dist/pipeline/phase2/phases/research-quality-gate.d.ts +48 -0
- package/dist/pipeline/phase2/phases/research-quality-gate.d.ts.map +1 -0
- package/dist/pipeline/phase2/phases/research-quality-gate.js +322 -0
- package/dist/pipeline/phase2/phases/research-quality-gate.js.map +1 -0
- package/dist/pipeline/phase2/phases/sparc-quality-gate.d.ts +41 -0
- package/dist/pipeline/phase2/phases/sparc-quality-gate.d.ts.map +1 -0
- package/dist/pipeline/phase2/phases/sparc-quality-gate.js +350 -0
- package/dist/pipeline/phase2/phases/sparc-quality-gate.js.map +1 -0
- package/dist/pipeline/phase2/phases/sparc-specification.d.ts +14 -0
- package/dist/pipeline/phase2/phases/sparc-specification.d.ts.map +1 -1
- package/dist/pipeline/phase2/phases/sparc-specification.js +500 -10
- package/dist/pipeline/phase2/phases/sparc-specification.js.map +1 -1
- package/dist/pipeline/phase2/phases/tdd-plan-generator.js +1 -1
- package/dist/pipeline/phase2/phases/tdd-plan-generator.js.map +1 -1
- package/dist/pipeline/phase2/phases/tech-stack-detector.d.ts +72 -0
- package/dist/pipeline/phase2/phases/tech-stack-detector.d.ts.map +1 -0
- package/dist/pipeline/phase2/phases/tech-stack-detector.js +332 -0
- package/dist/pipeline/phase2/phases/tech-stack-detector.js.map +1 -0
- package/dist/pipeline/phase2/types.d.ts +2 -0
- package/dist/pipeline/phase2/types.d.ts.map +1 -1
- package/dist/pipeline/phase3/phases/domain-codegen.d.ts.map +1 -1
- package/dist/pipeline/phase3/phases/domain-codegen.js +169 -4
- package/dist/pipeline/phase3/phases/domain-codegen.js.map +1 -1
- package/dist/pipeline/phase3/phases/test-generator.d.ts.map +1 -1
- package/dist/pipeline/phase3/phases/test-generator.js +12 -2
- package/dist/pipeline/phase3/phases/test-generator.js.map +1 -1
- package/dist/pipeline/phase3-sparc/phase3-sparc-coordinator.d.ts.map +1 -1
- package/dist/pipeline/phase3-sparc/phase3-sparc-coordinator.js +99 -1
- package/dist/pipeline/phase3-sparc/phase3-sparc-coordinator.js.map +1 -1
- package/dist/pipeline/phase4/phases/deployment-generator.d.ts +17 -4
- package/dist/pipeline/phase4/phases/deployment-generator.d.ts.map +1 -1
- package/dist/pipeline/phase4/phases/deployment-generator.js +364 -44
- package/dist/pipeline/phase4/phases/deployment-generator.js.map +1 -1
- package/dist/pipeline/phase4/phases/erp-client-generator.d.ts.map +1 -1
- package/dist/pipeline/phase4/phases/erp-client-generator.js +27 -15
- package/dist/pipeline/phase4/phases/erp-client-generator.js.map +1 -1
- package/dist/pipeline/phase4/phases/erp-target-resolver.d.ts.map +1 -1
- package/dist/pipeline/phase4/phases/erp-target-resolver.js +49 -2
- package/dist/pipeline/phase4/phases/erp-target-resolver.js.map +1 -1
- package/dist/pipeline/phase4/phases/http-server-generator.d.ts.map +1 -1
- package/dist/pipeline/phase4/phases/http-server-generator.js +263 -3
- package/dist/pipeline/phase4/phases/http-server-generator.js.map +1 -1
- package/dist/pipeline/phase4/phases/infra-adapter-generator.d.ts.map +1 -1
- package/dist/pipeline/phase4/phases/infra-adapter-generator.js +335 -37
- package/dist/pipeline/phase4/phases/infra-adapter-generator.js.map +1 -1
- package/dist/pipeline/phase4/types.d.ts +3 -1
- package/dist/pipeline/phase4/types.d.ts.map +1 -1
- package/dist/pipeline/phase4-adrs/phase4-adrs-coordinator.d.ts.map +1 -1
- package/dist/pipeline/phase4-adrs/phase4-adrs-coordinator.js +211 -2
- package/dist/pipeline/phase4-adrs/phase4-adrs-coordinator.js.map +1 -1
- package/dist/pipeline/phase5-build/phases/implementation-quality-gate.d.ts +54 -0
- package/dist/pipeline/phase5-build/phases/implementation-quality-gate.d.ts.map +1 -0
- package/dist/pipeline/phase5-build/phases/implementation-quality-gate.js +417 -0
- package/dist/pipeline/phase5-build/phases/implementation-quality-gate.js.map +1 -0
- package/dist/pipeline/phases/prompt-generator.js +1 -1
- package/dist/pipeline/phases/prompt-generator.js.map +1 -1
- package/dist/pipeline/ruflo-phase-executor.d.ts +116 -1
- package/dist/pipeline/ruflo-phase-executor.d.ts.map +1 -1
- package/dist/pipeline/ruflo-phase-executor.js +666 -159
- package/dist/pipeline/ruflo-phase-executor.js.map +1 -1
- package/dist/pipeline/swarm-orchestrator.d.ts.map +1 -1
- package/dist/pipeline/swarm-orchestrator.js +62 -6
- package/dist/pipeline/swarm-orchestrator.js.map +1 -1
- package/dist/routing/capability-classifier.d.ts +43 -0
- package/dist/routing/capability-classifier.d.ts.map +1 -0
- package/dist/routing/capability-classifier.js +157 -0
- package/dist/routing/capability-classifier.js.map +1 -0
- package/dist/routing/composition-engine.d.ts +77 -0
- package/dist/routing/composition-engine.d.ts.map +1 -0
- package/dist/routing/composition-engine.js +249 -0
- package/dist/routing/composition-engine.js.map +1 -0
- package/dist/routing/graph-federation.d.ts +71 -0
- package/dist/routing/graph-federation.d.ts.map +1 -0
- package/dist/routing/graph-federation.js +210 -0
- package/dist/routing/graph-federation.js.map +1 -0
- package/dist/routing/graph-loader.d.ts +74 -0
- package/dist/routing/graph-loader.d.ts.map +1 -0
- package/dist/routing/graph-loader.js +383 -0
- package/dist/routing/graph-loader.js.map +1 -0
- package/dist/routing/graph-router.d.ts +103 -0
- package/dist/routing/graph-router.d.ts.map +1 -0
- package/dist/routing/graph-router.js +415 -0
- package/dist/routing/graph-router.js.map +1 -0
- package/dist/routing/graph-validator.d.ts +44 -0
- package/dist/routing/graph-validator.d.ts.map +1 -0
- package/dist/routing/graph-validator.js +329 -0
- package/dist/routing/graph-validator.js.map +1 -0
- package/dist/routing/index.d.ts +52 -0
- package/dist/routing/index.d.ts.map +1 -0
- package/dist/routing/index.js +68 -0
- package/dist/routing/index.js.map +1 -0
- package/dist/routing/outcome-recorder.d.ts +71 -0
- package/dist/routing/outcome-recorder.d.ts.map +1 -0
- package/dist/routing/outcome-recorder.js +133 -0
- package/dist/routing/outcome-recorder.js.map +1 -0
- package/dist/routing/weight-adjuster.d.ts +59 -0
- package/dist/routing/weight-adjuster.d.ts.map +1 -0
- package/dist/routing/weight-adjuster.js +167 -0
- package/dist/routing/weight-adjuster.js.map +1 -0
- package/dist/routing/weighted-resolver.d.ts +55 -0
- package/dist/routing/weighted-resolver.d.ts.map +1 -0
- package/dist/routing/weighted-resolver.js +133 -0
- package/dist/routing/weighted-resolver.js.map +1 -0
- package/dist/synthesis/ask-artifact-writer.d.ts.map +1 -1
- package/dist/synthesis/ask-artifact-writer.js +8 -0
- package/dist/synthesis/ask-artifact-writer.js.map +1 -1
- package/dist/synthesis/simulation-artifact-generator.d.ts +14 -0
- package/dist/synthesis/simulation-artifact-generator.d.ts.map +1 -1
- package/dist/synthesis/simulation-artifact-generator.js +224 -1
- package/dist/synthesis/simulation-artifact-generator.js.map +1 -1
- package/dist/synthesis/simulation-renderers.d.ts.map +1 -1
- package/dist/synthesis/simulation-renderers.js +211 -40
- package/dist/synthesis/simulation-renderers.js.map +1 -1
- package/package.json +1 -1
- package/dist/bundled-agents/connector-hub-agents/package-lock.json +0 -11697
- package/dist/bundled-agents/connector-hub-agents/package.json +0 -75
- package/dist/bundled-agents/connector-hub-agents/tsconfig.build.json +0 -22
- package/dist/bundled-agents/connector-hub-agents/tsconfig.json +0 -57
- package/dist/bundled-agents/copilot-agents/functions/.gcloudignore +0 -17
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/cors.d.ts +0 -14
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/cors.js +0 -35
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/cors.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/envelope.d.ts +0 -55
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/envelope.js +0 -40
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/envelope.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/health.d.ts +0 -22
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/health.js +0 -38
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/health.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/index.d.ts +0 -34
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/index.js +0 -186
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/router.d.ts +0 -36
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/router.js +0 -121
- package/dist/bundled-agents/copilot-agents/functions/dist/functions/src/router.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/config-validation-agent.d.ts +0 -157
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/config-validation-agent.js +0 -948
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/config-validation-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/index.d.ts +0 -9
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/index.js +0 -27
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/config-validation/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/agent-span-wrapper.d.ts +0 -23
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/agent-span-wrapper.js +0 -50
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/agent-span-wrapper.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/base-agent.d.ts +0 -214
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/base-agent.js +0 -91
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/base-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/config-validation-schemas.d.ts +0 -1166
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/config-validation-schemas.js +0 -308
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/config-validation-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decision-event.d.ts +0 -59
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decision-event.js +0 -62
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decision-event.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decomposer-schemas.d.ts +0 -400
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decomposer-schemas.js +0 -113
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/decomposer-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/execution-graph.d.ts +0 -250
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/execution-graph.js +0 -169
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/execution-graph.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/index.d.ts +0 -17
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/index.js +0 -97
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intelligence-schemas.d.ts +0 -1674
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intelligence-schemas.js +0 -246
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intelligence-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intent-classifier-schemas.d.ts +0 -1085
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intent-classifier-schemas.js +0 -218
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/intent-classifier-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/meta-reasoner-schemas.d.ts +0 -949
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/meta-reasoner-schemas.js +0 -253
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/meta-reasoner-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/objective-clarifier-schemas.d.ts +0 -657
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/objective-clarifier-schemas.js +0 -205
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/objective-clarifier-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/pipeline-schemas.d.ts +0 -285
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/pipeline-schemas.js +0 -106
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/pipeline-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/planner-schemas.d.ts +0 -581
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/planner-schemas.js +0 -136
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/planner-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/reflection-schemas.d.ts +0 -791
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/reflection-schemas.js +0 -225
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/contracts/reflection-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/decomposer-agent.d.ts +0 -120
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/decomposer-agent.js +0 -535
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/decomposer-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/index.d.ts +0 -9
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/index.js +0 -18
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/decomposer/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/index.d.ts +0 -4
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/index.js +0 -9
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/intent-classifier-agent.d.ts +0 -123
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/intent-classifier-agent.js +0 -609
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/intent-classifier/intent-classifier-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/index.d.ts +0 -10
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/index.js +0 -25
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/meta-reasoner-agent.d.ts +0 -111
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/meta-reasoner-agent.js +0 -686
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/meta-reasoner-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/telemetry.d.ts +0 -11
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/telemetry.js +0 -25
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/meta-reasoner/telemetry.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/index.d.ts +0 -6
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/index.js +0 -15
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/objective-clarifier-agent.d.ts +0 -126
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/objective-clarifier-agent.js +0 -780
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/objective-clarifier-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/ruvector-persistence.d.ts +0 -49
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/ruvector-persistence.js +0 -125
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/ruvector-persistence.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/telemetry.d.ts +0 -73
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/telemetry.js +0 -192
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/objective-clarifier/telemetry.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/index.d.ts +0 -11
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/index.js +0 -25
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/planner-agent.d.ts +0 -127
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/planner-agent.js +0 -483
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/planner-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/ruvector-persistence.d.ts +0 -49
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/ruvector-persistence.js +0 -125
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/ruvector-persistence.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/telemetry.d.ts +0 -73
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/telemetry.js +0 -192
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/planner/telemetry.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/index.d.ts +0 -11
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/index.js +0 -27
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/reflection-agent.d.ts +0 -122
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/reflection-agent.js +0 -645
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/reflection-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/ruvector-persistence.d.ts +0 -59
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/ruvector-persistence.js +0 -156
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/ruvector-persistence.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/telemetry.d.ts +0 -88
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/telemetry.js +0 -246
- package/dist/bundled-agents/copilot-agents/functions/dist/services/agents/reflection/telemetry.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/index.js +0 -4
- package/dist/bundled-agents/copilot-agents/functions/jest.config.js +0 -29
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/cors.d.ts +0 -14
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/cors.js +0 -35
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/cors.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/envelope.d.ts +0 -27
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/envelope.js +0 -21
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/envelope.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/health.d.ts +0 -22
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/health.js +0 -38
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/health.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/index.d.ts +0 -34
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/index.js +0 -174
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/router.d.ts +0 -27
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/router.js +0 -107
- package/dist/bundled-agents/copilot-agents/functions/lib/functions/src/router.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/config-validation-agent.d.ts +0 -157
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/config-validation-agent.js +0 -941
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/config-validation-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/index.d.ts +0 -9
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/index.js +0 -27
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/config-validation/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/agent-span-wrapper.d.ts +0 -23
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/agent-span-wrapper.js +0 -50
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/agent-span-wrapper.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/base-agent.d.ts +0 -185
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/base-agent.js +0 -86
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/base-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/config-validation-schemas.d.ts +0 -1081
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/config-validation-schemas.js +0 -305
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/config-validation-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decision-event.d.ts +0 -59
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decision-event.js +0 -62
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decision-event.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decomposer-schemas.d.ts +0 -315
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decomposer-schemas.js +0 -110
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/decomposer-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/execution-graph.d.ts +0 -250
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/execution-graph.js +0 -169
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/execution-graph.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/index.d.ts +0 -16
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/index.js +0 -88
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intelligence-schemas.d.ts +0 -1674
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intelligence-schemas.js +0 -246
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intelligence-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intent-classifier-schemas.d.ts +0 -1000
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intent-classifier-schemas.js +0 -215
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/intent-classifier-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/meta-reasoner-schemas.d.ts +0 -864
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/meta-reasoner-schemas.js +0 -250
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/meta-reasoner-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/objective-clarifier-schemas.d.ts +0 -572
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/objective-clarifier-schemas.js +0 -202
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/objective-clarifier-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/planner-schemas.d.ts +0 -496
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/planner-schemas.js +0 -133
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/planner-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/reflection-schemas.d.ts +0 -706
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/reflection-schemas.js +0 -222
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/contracts/reflection-schemas.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/decomposer-agent.d.ts +0 -107
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/decomposer-agent.js +0 -360
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/decomposer-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/index.d.ts +0 -9
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/index.js +0 -18
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/decomposer/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/index.d.ts +0 -4
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/index.js +0 -9
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/intent-classifier-agent.d.ts +0 -123
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/intent-classifier-agent.js +0 -609
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/intent-classifier/intent-classifier-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/index.d.ts +0 -10
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/index.js +0 -25
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/meta-reasoner-agent.d.ts +0 -111
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/meta-reasoner-agent.js +0 -686
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/meta-reasoner-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/telemetry.d.ts +0 -11
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/telemetry.js +0 -25
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/meta-reasoner/telemetry.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/index.d.ts +0 -6
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/index.js +0 -15
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/objective-clarifier-agent.d.ts +0 -126
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/objective-clarifier-agent.js +0 -780
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/objective-clarifier-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/ruvector-persistence.d.ts +0 -49
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/ruvector-persistence.js +0 -125
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/ruvector-persistence.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/telemetry.d.ts +0 -73
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/telemetry.js +0 -192
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/objective-clarifier/telemetry.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/index.d.ts +0 -11
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/index.js +0 -25
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/planner-agent.d.ts +0 -119
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/planner-agent.js +0 -421
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/planner-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/ruvector-persistence.d.ts +0 -49
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/ruvector-persistence.js +0 -125
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/ruvector-persistence.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/telemetry.d.ts +0 -73
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/telemetry.js +0 -192
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/planner/telemetry.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/index.d.ts +0 -11
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/index.js +0 -27
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/index.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/reflection-agent.d.ts +0 -122
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/reflection-agent.js +0 -645
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/reflection-agent.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/ruvector-persistence.d.ts +0 -59
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/ruvector-persistence.js +0 -156
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/ruvector-persistence.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/telemetry.d.ts +0 -88
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/telemetry.js +0 -246
- package/dist/bundled-agents/copilot-agents/functions/lib/services/agents/reflection/telemetry.js.map +0 -1
- package/dist/bundled-agents/copilot-agents/functions/package-lock.json +0 -5473
- package/dist/bundled-agents/copilot-agents/functions/package.json +0 -40
- package/dist/bundled-agents/copilot-agents/functions/src/claude.ts +0 -71
- package/dist/bundled-agents/copilot-agents/functions/src/cors.ts +0 -36
- package/dist/bundled-agents/copilot-agents/functions/src/envelope.ts +0 -77
- package/dist/bundled-agents/copilot-agents/functions/src/handler.test.ts +0 -340
- package/dist/bundled-agents/copilot-agents/functions/src/health.ts +0 -53
- package/dist/bundled-agents/copilot-agents/functions/src/index.ts +0 -201
- package/dist/bundled-agents/copilot-agents/functions/src/router.ts +0 -148
- package/dist/bundled-agents/copilot-agents/functions/tsconfig.json +0 -31
- package/dist/bundled-agents/copilot-agents/package-lock.json +0 -11825
- package/dist/bundled-agents/copilot-agents/package.json +0 -5
- package/dist/bundled-agents/governance-dashboard-agents/package-lock.json +0 -8282
- package/dist/bundled-agents/governance-dashboard-agents/package.json +0 -13
- package/dist/bundled-agents/orchestrator-agents/functions/contracts/index.js +0 -590
- package/dist/bundled-agents/orchestrator-agents/functions/index.js +0 -442
- package/dist/bundled-agents/orchestrator-agents/functions/test.js +0 -325
- package/dist/bundled-agents/orchestrator-agents/index.js +0 -6
- package/dist/bundled-agents/orchestrator-agents/package-lock.json +0 -13254
- package/dist/bundled-agents/orchestrator-agents/package.json +0 -20
- package/dist/bundled-agents/platform-agents/package-lock.json +0 -1723
- package/dist/bundled-agents/platform-agents/package.json +0 -22
- package/dist/bundled-agents/platform-agents/src/agents/decision-memo.ts +0 -463
- package/dist/bundled-agents/platform-agents/src/agents/decision.ts +0 -234
- package/dist/bundled-agents/platform-agents/src/agents/executive-summary.ts +0 -229
- package/dist/bundled-agents/platform-agents/src/agents/risk-score.ts +0 -327
- package/dist/bundled-agents/platform-agents/src/claude.ts +0 -71
- package/dist/bundled-agents/platform-agents/src/cors.ts +0 -24
- package/dist/bundled-agents/platform-agents/src/envelope.ts +0 -37
- package/dist/bundled-agents/platform-agents/src/health.ts +0 -20
- package/dist/bundled-agents/platform-agents/src/index.ts +0 -171
- package/dist/bundled-agents/platform-agents/src/router.ts +0 -38
- package/dist/bundled-agents/platform-agents/src/text-analysis.ts +0 -238
- package/dist/bundled-agents/platform-agents/tsconfig.json +0 -19
- package/dist/bundled-agents/sentinel-agents/lib/agents/alert.d.ts +0 -3
- package/dist/bundled-agents/sentinel-agents/lib/agents/alert.d.ts.map +0 -1
- package/dist/bundled-agents/sentinel-agents/lib/agents/alert.js +0 -43
- package/dist/bundled-agents/sentinel-agents/lib/agents/alert.js.map +0 -1
- package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.d.ts +0 -3
- package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.d.ts.map +0 -1
- package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.js +0 -30
- package/dist/bundled-agents/sentinel-agents/lib/agents/anomaly.js.map +0 -1
- package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.d.ts +0 -3
- package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.d.ts.map +0 -1
- package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.js +0 -53
- package/dist/bundled-agents/sentinel-agents/lib/agents/correlation.js.map +0 -1
- package/dist/bundled-agents/sentinel-agents/lib/agents/drift.d.ts +0 -3
- package/dist/bundled-agents/sentinel-agents/lib/agents/drift.d.ts.map +0 -1
- package/dist/bundled-agents/sentinel-agents/lib/agents/drift.js +0 -51
- package/dist/bundled-agents/sentinel-agents/lib/agents/drift.js.map +0 -1
- package/dist/bundled-agents/sentinel-agents/lib/agents/rca.d.ts +0 -3
- package/dist/bundled-agents/sentinel-agents/lib/agents/rca.d.ts.map +0 -1
- package/dist/bundled-agents/sentinel-agents/lib/agents/rca.js +0 -36
- package/dist/bundled-agents/sentinel-agents/lib/agents/rca.js.map +0 -1
- package/dist/bundled-agents/sentinel-agents/lib/index.d.ts +0 -2
- package/dist/bundled-agents/sentinel-agents/lib/index.d.ts.map +0 -1
- package/dist/bundled-agents/sentinel-agents/lib/index.js +0 -70
- package/dist/bundled-agents/sentinel-agents/lib/index.js.map +0 -1
- package/dist/bundled-agents/sentinel-agents/package-lock.json +0 -12591
- package/dist/bundled-agents/sentinel-agents/package.json +0 -62
- package/dist/bundled-agents/sentinel-agents/src/agents/alert.ts +0 -46
- package/dist/bundled-agents/sentinel-agents/src/agents/anomaly.ts +0 -33
- package/dist/bundled-agents/sentinel-agents/src/agents/correlation.ts +0 -56
- package/dist/bundled-agents/sentinel-agents/src/agents/drift.ts +0 -54
- package/dist/bundled-agents/sentinel-agents/src/agents/rca.ts +0 -38
- package/dist/bundled-agents/sentinel-agents/src/claude.ts +0 -71
- package/dist/bundled-agents/sentinel-agents/src/index.ts +0 -77
- package/dist/bundled-agents/sentinel-agents/tsconfig.json +0 -20
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph Federation (ADR-031 Phase 4)
|
|
3
|
+
*
|
|
4
|
+
* Supports splitting the monolithic ecosystem.graph.json into per-capability
|
|
5
|
+
* fragment files under docs/ecosystem.fragments/. The loader detects the
|
|
6
|
+
* graph format and uses either monolithic or federated loading.
|
|
7
|
+
*
|
|
8
|
+
* Fragment format: Each file declares a single capability with an owner field.
|
|
9
|
+
* Root graph in v2.0 format contains metadata, stages, compositions, and
|
|
10
|
+
* a fragments_dir pointer instead of inline capabilities.
|
|
11
|
+
*/
|
|
12
|
+
import * as fs from 'node:fs';
|
|
13
|
+
import * as path from 'node:path';
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Detection
|
|
16
|
+
// ============================================================================
|
|
17
|
+
/**
|
|
18
|
+
* Detect whether a parsed graph root uses federated mode (v2.0+).
|
|
19
|
+
* Federated graphs have a `fragments_dir` field instead of `capabilities`.
|
|
20
|
+
*/
|
|
21
|
+
export function isFederatedGraph(data) {
|
|
22
|
+
return typeof data['fragments_dir'] === 'string';
|
|
23
|
+
}
|
|
24
|
+
// ============================================================================
|
|
25
|
+
// Fragment Loading
|
|
26
|
+
// ============================================================================
|
|
27
|
+
/**
|
|
28
|
+
* Load all capability fragments from the fragments directory.
|
|
29
|
+
* Returns the merged result with fragments, warnings, and errors.
|
|
30
|
+
*/
|
|
31
|
+
export function loadFragments(rootGraphPath, fragmentsDir) {
|
|
32
|
+
const errors = [];
|
|
33
|
+
const warnings = [];
|
|
34
|
+
// Read root graph
|
|
35
|
+
let rootData;
|
|
36
|
+
try {
|
|
37
|
+
const raw = fs.readFileSync(rootGraphPath, 'utf-8');
|
|
38
|
+
rootData = JSON.parse(raw);
|
|
39
|
+
}
|
|
40
|
+
catch (err) {
|
|
41
|
+
errors.push(`Failed to read root graph: ${err.message}`);
|
|
42
|
+
return {
|
|
43
|
+
fragments: [],
|
|
44
|
+
root: { version: '2.0', fragments_dir: fragmentsDir },
|
|
45
|
+
errors,
|
|
46
|
+
warnings,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const root = {
|
|
50
|
+
version: rootData['version'] ?? '2.0',
|
|
51
|
+
description: rootData['description'],
|
|
52
|
+
stages: rootData['stages'],
|
|
53
|
+
fragments_dir: fragmentsDir,
|
|
54
|
+
compositions: rootData['compositions'],
|
|
55
|
+
overrides: rootData['overrides'],
|
|
56
|
+
};
|
|
57
|
+
// Resolve fragments directory relative to root graph
|
|
58
|
+
const rootDir = path.dirname(rootGraphPath);
|
|
59
|
+
const absFragDir = path.resolve(rootDir, fragmentsDir);
|
|
60
|
+
if (!fs.existsSync(absFragDir)) {
|
|
61
|
+
errors.push(`Fragments directory not found: ${absFragDir}`);
|
|
62
|
+
return { fragments: [], root, errors, warnings };
|
|
63
|
+
}
|
|
64
|
+
// Read all .graph.json files
|
|
65
|
+
const files = fs.readdirSync(absFragDir)
|
|
66
|
+
.filter(f => f.endsWith('.graph.json'))
|
|
67
|
+
.sort();
|
|
68
|
+
const fragments = [];
|
|
69
|
+
const capNames = new Set();
|
|
70
|
+
for (const file of files) {
|
|
71
|
+
const filePath = path.join(absFragDir, file);
|
|
72
|
+
try {
|
|
73
|
+
const raw = fs.readFileSync(filePath, 'utf-8');
|
|
74
|
+
const data = JSON.parse(raw);
|
|
75
|
+
const fragment = parseFragment(data, file);
|
|
76
|
+
if (!fragment) {
|
|
77
|
+
errors.push(`${file}: invalid fragment format — missing "capability" field`);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
// Check for duplicate capability names
|
|
81
|
+
if (capNames.has(fragment.capability)) {
|
|
82
|
+
errors.push(`${file}: duplicate capability name "${fragment.capability}"`);
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
capNames.add(fragment.capability);
|
|
86
|
+
// Check owner field
|
|
87
|
+
if (!fragment.owner) {
|
|
88
|
+
warnings.push(`${file}: missing "owner" field`);
|
|
89
|
+
}
|
|
90
|
+
// Apply root overrides
|
|
91
|
+
const override = root.overrides?.[fragment.capability];
|
|
92
|
+
const finalFragment = override ? applyOverride(fragment, override) : fragment;
|
|
93
|
+
fragments.push(finalFragment);
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
errors.push(`${file}: failed to parse — ${err.message}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return { fragments, root, errors, warnings };
|
|
100
|
+
}
|
|
101
|
+
// ============================================================================
|
|
102
|
+
// Fragment Parsing
|
|
103
|
+
// ============================================================================
|
|
104
|
+
function parseFragment(data, _fileName) {
|
|
105
|
+
if (typeof data['capability'] !== 'string')
|
|
106
|
+
return null;
|
|
107
|
+
return {
|
|
108
|
+
capability: data['capability'],
|
|
109
|
+
description: data['description'],
|
|
110
|
+
owner: data['owner'],
|
|
111
|
+
repos: data['repos'] ?? [],
|
|
112
|
+
agents: data['agents'] ?? [],
|
|
113
|
+
stage: data['stage'],
|
|
114
|
+
depends_on: data['depends_on'],
|
|
115
|
+
tags: data['tags'],
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
function applyOverride(fragment, override) {
|
|
119
|
+
return {
|
|
120
|
+
...fragment,
|
|
121
|
+
stage: override.stage ?? fragment.stage,
|
|
122
|
+
// max_agents is applied at selection time, not stored on fragment
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
// ============================================================================
|
|
126
|
+
// Federation Script Support
|
|
127
|
+
// ============================================================================
|
|
128
|
+
/**
|
|
129
|
+
* Split a monolithic graph into capability fragments.
|
|
130
|
+
* Used by the `graph federate` CLI command.
|
|
131
|
+
*
|
|
132
|
+
* @param graphPath - Path to the monolithic ecosystem.graph.json
|
|
133
|
+
* @param outputDir - Directory to write fragments to
|
|
134
|
+
* @returns Summary of the federation operation
|
|
135
|
+
*/
|
|
136
|
+
export function federateGraph(graphPath, outputDir) {
|
|
137
|
+
const errors = [];
|
|
138
|
+
let raw;
|
|
139
|
+
try {
|
|
140
|
+
raw = fs.readFileSync(graphPath, 'utf-8');
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
return { fragmentsCreated: 0, rootUpdated: false, errors: [`Cannot read graph: ${err.message}`] };
|
|
144
|
+
}
|
|
145
|
+
let data;
|
|
146
|
+
try {
|
|
147
|
+
data = JSON.parse(raw);
|
|
148
|
+
}
|
|
149
|
+
catch (err) {
|
|
150
|
+
return { fragmentsCreated: 0, rootUpdated: false, errors: [`Invalid JSON: ${err.message}`] };
|
|
151
|
+
}
|
|
152
|
+
const capabilities = data['capabilities'];
|
|
153
|
+
if (!Array.isArray(capabilities) || capabilities.length === 0) {
|
|
154
|
+
return { fragmentsCreated: 0, rootUpdated: false, errors: ['No capabilities found in graph'] };
|
|
155
|
+
}
|
|
156
|
+
// Create output directory
|
|
157
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
158
|
+
let fragmentsCreated = 0;
|
|
159
|
+
for (const cap of capabilities) {
|
|
160
|
+
const name = cap['name'];
|
|
161
|
+
if (!name) {
|
|
162
|
+
errors.push('Skipping capability with no name');
|
|
163
|
+
continue;
|
|
164
|
+
}
|
|
165
|
+
const fragment = {
|
|
166
|
+
capability: name,
|
|
167
|
+
description: cap['description'],
|
|
168
|
+
owner: '',
|
|
169
|
+
repos: cap['repos'],
|
|
170
|
+
agents: cap['agents'],
|
|
171
|
+
stage: cap['stage'],
|
|
172
|
+
depends_on: cap['depends_on'],
|
|
173
|
+
tags: cap['tags'],
|
|
174
|
+
};
|
|
175
|
+
const fileName = `${name}.graph.json`;
|
|
176
|
+
const filePath = path.join(outputDir, fileName);
|
|
177
|
+
fs.writeFileSync(filePath, JSON.stringify(fragment, null, 2) + '\n', 'utf-8');
|
|
178
|
+
fragmentsCreated++;
|
|
179
|
+
}
|
|
180
|
+
// Update root graph to v2.0 format
|
|
181
|
+
const relativeDir = path.relative(path.dirname(graphPath), outputDir);
|
|
182
|
+
const newRoot = {
|
|
183
|
+
version: '2.0',
|
|
184
|
+
description: data['description'] ?? '',
|
|
185
|
+
stages: data['stages'],
|
|
186
|
+
fragments_dir: relativeDir,
|
|
187
|
+
compositions: data['compositions'] ?? [],
|
|
188
|
+
};
|
|
189
|
+
// Write updated root (backup original first)
|
|
190
|
+
const backupPath = graphPath + '.bak';
|
|
191
|
+
fs.copyFileSync(graphPath, backupPath);
|
|
192
|
+
fs.writeFileSync(graphPath, JSON.stringify(newRoot, null, 2) + '\n', 'utf-8');
|
|
193
|
+
return { fragmentsCreated, rootUpdated: true, errors };
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Convert a capability fragment back to the monolithic format.
|
|
197
|
+
* Used internally by the graph loader to unify fragment and inline formats.
|
|
198
|
+
*/
|
|
199
|
+
export function fragmentToCapabilityEntry(fragment) {
|
|
200
|
+
return {
|
|
201
|
+
name: fragment.capability,
|
|
202
|
+
description: fragment.description,
|
|
203
|
+
repos: fragment.repos,
|
|
204
|
+
agents: fragment.agents,
|
|
205
|
+
stage: fragment.stage,
|
|
206
|
+
depends_on: fragment.depends_on ?? [],
|
|
207
|
+
tags: fragment.tags ?? [],
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=graph-federation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-federation.js","sourceRoot":"","sources":["../../src/routing/graph-federation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAyClC,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAA6B;IAC5D,OAAO,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,QAAQ,CAAC;AACnD,CAAC;AAED,+EAA+E;AAC/E,mBAAmB;AACnB,+EAA+E;AAE/E;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,aAAqB,EACrB,YAAoB;IAEpB,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,kBAAkB;IAClB,IAAI,QAAiC,CAAC;IACtC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;QACpD,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAA4B,CAAC;IACxD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,CAAC,IAAI,CAAC,8BAA+B,GAAa,CAAC,OAAO,EAAE,CAAC,CAAC;QACpE,OAAO;YACL,SAAS,EAAE,EAAE;YACb,IAAI,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE;YACrD,MAAM;YACN,QAAQ;SACT,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAuB;QAC/B,OAAO,EAAG,QAAQ,CAAC,SA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ACJ,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ecosystem Capability Graph Loader (ADR-030)
|
|
3
|
+
*
|
|
4
|
+
* Reads, validates, and caches the ecosystem capability graph from
|
|
5
|
+
* docs/ecosystem.graph.json. Provides typed lookup methods for
|
|
6
|
+
* the capability classifier and graph router.
|
|
7
|
+
*/
|
|
8
|
+
import type { AgentInput } from './weighted-resolver.js';
|
|
9
|
+
import type { CompositionRule } from './composition-engine.js';
|
|
10
|
+
export type StageName = 'simulation' | 'research' | 'specification' | 'architecture' | 'build' | 'validation' | 'deployment' | 'governance';
|
|
11
|
+
export interface CapabilityEntry {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly description?: string;
|
|
14
|
+
readonly repos: readonly string[];
|
|
15
|
+
/** Agents can be plain strings or weighted objects (ADR-031 Phase 1). */
|
|
16
|
+
readonly agents: readonly AgentInput[];
|
|
17
|
+
readonly stage?: StageName;
|
|
18
|
+
readonly depends_on?: readonly string[];
|
|
19
|
+
readonly tags?: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
export interface EcosystemGraph {
|
|
22
|
+
readonly version: string;
|
|
23
|
+
readonly description: string;
|
|
24
|
+
readonly stages: readonly StageName[];
|
|
25
|
+
readonly capabilities: readonly CapabilityEntry[];
|
|
26
|
+
/** Composition rules for capability interaction (ADR-031 Phase 3). */
|
|
27
|
+
readonly compositions?: readonly CompositionRule[];
|
|
28
|
+
/** Fragments directory for federated mode (ADR-031 Phase 4). */
|
|
29
|
+
readonly fragments_dir?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface GraphValidationError {
|
|
32
|
+
readonly path: string;
|
|
33
|
+
readonly message: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Resolve the path to the ecosystem graph file.
|
|
37
|
+
* Looks relative to the project root (the directory containing package.json).
|
|
38
|
+
*/
|
|
39
|
+
export declare function resolveGraphPath(projectRoot?: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Load and validate the ecosystem capability graph.
|
|
42
|
+
*
|
|
43
|
+
* Returns a validated, immutable graph object. The result is cached for the
|
|
44
|
+
* lifetime of the process. Pass `forceReload: true` to bypass the cache.
|
|
45
|
+
*
|
|
46
|
+
* @throws Error if the graph file cannot be read or fails validation.
|
|
47
|
+
*/
|
|
48
|
+
export declare function loadEcosystemGraph(options?: {
|
|
49
|
+
graphPath?: string;
|
|
50
|
+
forceReload?: boolean;
|
|
51
|
+
}): EcosystemGraph;
|
|
52
|
+
/**
|
|
53
|
+
* Clear the cached graph. Useful for testing.
|
|
54
|
+
*/
|
|
55
|
+
export declare function clearGraphCache(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Look up a capability by exact name.
|
|
58
|
+
*/
|
|
59
|
+
export declare function getCapabilityByName(graph: EcosystemGraph, name: string): CapabilityEntry | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Find all capabilities that have a matching tag.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getCapabilitiesByTag(graph: EcosystemGraph, tag: string): readonly CapabilityEntry[];
|
|
64
|
+
/**
|
|
65
|
+
* Find all capabilities assigned to a given stage.
|
|
66
|
+
*/
|
|
67
|
+
export declare function getCapabilitiesByStage(graph: EcosystemGraph, stage: StageName): readonly CapabilityEntry[];
|
|
68
|
+
/**
|
|
69
|
+
* Resolve the full dependency tree for a set of capability names.
|
|
70
|
+
* Returns all capability names including transitive dependencies.
|
|
71
|
+
* Uses iterative BFS to avoid stack overflow on deep graphs.
|
|
72
|
+
*/
|
|
73
|
+
export declare function resolveDependencies(graph: EcosystemGraph, capabilityNames: readonly string[]): readonly string[];
|
|
74
|
+
//# sourceMappingURL=graph-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph-loader.d.ts","sourceRoot":"","sources":["../../src/routing/graph-loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAA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AAC,OAAO,CAAC,EAAE;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,cAAc,CAkEjB;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAGtC;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,SAAS,CAEpG;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,eAAe,EAAE,CAKnG;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,SAAS,GAAG,SAAS,eAAe,EAAE,CAE1G;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,cAAc,EACrB,eAAe,EAAE,SAAS,MAAM,EAAE,GACjC,SAAS,MAAM,EAAE,CAkBnB"}
|
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ecosystem Capability Graph Loader (ADR-030)
|
|
3
|
+
*
|
|
4
|
+
* Reads, validates, and caches the ecosystem capability graph from
|
|
5
|
+
* docs/ecosystem.graph.json. Provides typed lookup methods for
|
|
6
|
+
* the capability classifier and graph router.
|
|
7
|
+
*/
|
|
8
|
+
import * as fs from 'node:fs';
|
|
9
|
+
import * as path from 'node:path';
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Validation
|
|
12
|
+
// ============================================================================
|
|
13
|
+
const VALID_STAGES = new Set([
|
|
14
|
+
'simulation',
|
|
15
|
+
'research',
|
|
16
|
+
'specification',
|
|
17
|
+
'architecture',
|
|
18
|
+
'build',
|
|
19
|
+
'validation',
|
|
20
|
+
'deployment',
|
|
21
|
+
'governance',
|
|
22
|
+
]);
|
|
23
|
+
function validateGraph(data) {
|
|
24
|
+
const errors = [];
|
|
25
|
+
if (typeof data !== 'object' || data === null || Array.isArray(data)) {
|
|
26
|
+
errors.push({ path: '$', message: 'Root must be a non-null object' });
|
|
27
|
+
return errors;
|
|
28
|
+
}
|
|
29
|
+
const obj = data;
|
|
30
|
+
// version
|
|
31
|
+
if (typeof obj['version'] !== 'string' || obj['version'].length === 0) {
|
|
32
|
+
errors.push({ path: '$.version', message: 'version must be a non-empty string' });
|
|
33
|
+
}
|
|
34
|
+
// stages (optional in v1.0, required in v1.1+)
|
|
35
|
+
if ('stages' in obj) {
|
|
36
|
+
if (!Array.isArray(obj['stages'])) {
|
|
37
|
+
errors.push({ path: '$.stages', message: 'stages must be an array' });
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
for (let i = 0; i < obj['stages'].length; i++) {
|
|
41
|
+
const s = obj['stages'][i];
|
|
42
|
+
if (typeof s !== 'string' || !VALID_STAGES.has(s)) {
|
|
43
|
+
errors.push({ path: `$.stages[${i}]`, message: `Invalid stage: ${String(s)}` });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// capabilities
|
|
49
|
+
if (!Array.isArray(obj['capabilities'])) {
|
|
50
|
+
errors.push({ path: '$.capabilities', message: 'capabilities must be an array' });
|
|
51
|
+
return errors;
|
|
52
|
+
}
|
|
53
|
+
const capNames = new Set();
|
|
54
|
+
const capabilities = obj['capabilities'];
|
|
55
|
+
for (let i = 0; i < capabilities.length; i++) {
|
|
56
|
+
const cap = capabilities[i];
|
|
57
|
+
const prefix = `$.capabilities[${i}]`;
|
|
58
|
+
if (typeof cap !== 'object' || cap === null || Array.isArray(cap)) {
|
|
59
|
+
errors.push({ path: prefix, message: 'Capability entry must be an object' });
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const c = cap;
|
|
63
|
+
// name (required)
|
|
64
|
+
if (typeof c['name'] !== 'string' || c['name'].length === 0) {
|
|
65
|
+
errors.push({ path: `${prefix}.name`, message: 'name must be a non-empty string' });
|
|
66
|
+
}
|
|
67
|
+
else if (capNames.has(c['name'])) {
|
|
68
|
+
errors.push({ path: `${prefix}.name`, message: `Duplicate capability name: ${c['name']}` });
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
capNames.add(c['name']);
|
|
72
|
+
}
|
|
73
|
+
// repos (required, non-empty array of strings)
|
|
74
|
+
if (!Array.isArray(c['repos']) || c['repos'].length === 0) {
|
|
75
|
+
errors.push({ path: `${prefix}.repos`, message: 'repos must be a non-empty array of strings' });
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
for (let j = 0; j < c['repos'].length; j++) {
|
|
79
|
+
if (typeof c['repos'][j] !== 'string') {
|
|
80
|
+
errors.push({ path: `${prefix}.repos[${j}]`, message: 'repo entry must be a string' });
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
// agents (required, non-empty array of strings or weighted objects)
|
|
85
|
+
if (!Array.isArray(c['agents']) || c['agents'].length === 0) {
|
|
86
|
+
errors.push({ path: `${prefix}.agents`, message: 'agents must be a non-empty array' });
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
for (let j = 0; j < c['agents'].length; j++) {
|
|
90
|
+
const agent = c['agents'][j];
|
|
91
|
+
if (typeof agent === 'string') {
|
|
92
|
+
// Plain string form — valid
|
|
93
|
+
if (agent.length === 0) {
|
|
94
|
+
errors.push({ path: `${prefix}.agents[${j}]`, message: 'agent name must be non-empty' });
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
else if (typeof agent === 'object' && agent !== null && !Array.isArray(agent)) {
|
|
98
|
+
// Weighted object form — validate fields
|
|
99
|
+
const agentObj = agent;
|
|
100
|
+
if (typeof agentObj['name'] !== 'string' || agentObj['name'].length === 0) {
|
|
101
|
+
errors.push({ path: `${prefix}.agents[${j}].name`, message: 'agent name must be a non-empty string' });
|
|
102
|
+
}
|
|
103
|
+
if (typeof agentObj['weight'] === 'number') {
|
|
104
|
+
if (agentObj['weight'] < 0 || agentObj['weight'] > 1) {
|
|
105
|
+
errors.push({ path: `${prefix}.agents[${j}].weight`, message: `weight must be between 0.0 and 1.0, got ${agentObj['weight']}` });
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
else if ('weight' in agentObj) {
|
|
109
|
+
errors.push({ path: `${prefix}.agents[${j}].weight`, message: 'weight must be a number' });
|
|
110
|
+
}
|
|
111
|
+
if ('role' in agentObj && agentObj['role'] !== undefined) {
|
|
112
|
+
const validRoles = ['primary', 'secondary', 'specialist'];
|
|
113
|
+
if (typeof agentObj['role'] !== 'string' || !validRoles.includes(agentObj['role'])) {
|
|
114
|
+
errors.push({ path: `${prefix}.agents[${j}].role`, message: `role must be "primary", "secondary", or "specialist"` });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
errors.push({ path: `${prefix}.agents[${j}]`, message: 'agent must be a string or { name, weight, role } object' });
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
// stage (optional, must be valid if present)
|
|
124
|
+
if ('stage' in c && c['stage'] !== undefined) {
|
|
125
|
+
if (typeof c['stage'] !== 'string' || !VALID_STAGES.has(c['stage'])) {
|
|
126
|
+
errors.push({ path: `${prefix}.stage`, message: `Invalid stage: ${String(c['stage'])}` });
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// depends_on (optional, array of strings)
|
|
130
|
+
if ('depends_on' in c && c['depends_on'] !== undefined) {
|
|
131
|
+
if (!Array.isArray(c['depends_on'])) {
|
|
132
|
+
errors.push({ path: `${prefix}.depends_on`, message: 'depends_on must be an array of strings' });
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
for (let j = 0; j < c['depends_on'].length; j++) {
|
|
136
|
+
if (typeof c['depends_on'][j] !== 'string') {
|
|
137
|
+
errors.push({ path: `${prefix}.depends_on[${j}]`, message: 'depends_on entry must be a string' });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// tags (optional, array of strings)
|
|
143
|
+
if ('tags' in c && c['tags'] !== undefined) {
|
|
144
|
+
if (!Array.isArray(c['tags'])) {
|
|
145
|
+
errors.push({ path: `${prefix}.tags`, message: 'tags must be an array of strings' });
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
for (let j = 0; j < c['tags'].length; j++) {
|
|
149
|
+
if (typeof c['tags'][j] !== 'string') {
|
|
150
|
+
errors.push({ path: `${prefix}.tags[${j}]`, message: 'tag entry must be a string' });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Cross-reference: depends_on must reference existing capability names
|
|
157
|
+
for (let i = 0; i < capabilities.length; i++) {
|
|
158
|
+
const c = capabilities[i];
|
|
159
|
+
if (Array.isArray(c['depends_on'])) {
|
|
160
|
+
for (let j = 0; j < c['depends_on'].length; j++) {
|
|
161
|
+
const dep = c['depends_on'][j];
|
|
162
|
+
if (typeof dep === 'string' && !capNames.has(dep)) {
|
|
163
|
+
errors.push({
|
|
164
|
+
path: `$.capabilities[${i}].depends_on[${j}]`,
|
|
165
|
+
message: `depends_on references unknown capability: ${dep}`,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
// Cycle detection in depends_on (Kahn's algorithm)
|
|
172
|
+
if (errors.length === 0) {
|
|
173
|
+
const cycleErrors = detectDependencyCycles(capabilities);
|
|
174
|
+
errors.push(...cycleErrors);
|
|
175
|
+
}
|
|
176
|
+
return errors;
|
|
177
|
+
}
|
|
178
|
+
function detectDependencyCycles(capabilities) {
|
|
179
|
+
const adj = new Map();
|
|
180
|
+
const inDegree = new Map();
|
|
181
|
+
for (const cap of capabilities) {
|
|
182
|
+
const name = cap['name'];
|
|
183
|
+
adj.set(name, []);
|
|
184
|
+
inDegree.set(name, 0);
|
|
185
|
+
}
|
|
186
|
+
for (const cap of capabilities) {
|
|
187
|
+
const name = cap['name'];
|
|
188
|
+
const deps = cap['depends_on'] ?? [];
|
|
189
|
+
for (const dep of deps) {
|
|
190
|
+
const neighbors = adj.get(dep);
|
|
191
|
+
if (neighbors) {
|
|
192
|
+
neighbors.push(name);
|
|
193
|
+
inDegree.set(name, (inDegree.get(name) ?? 0) + 1);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
const queue = [];
|
|
198
|
+
for (const [name, degree] of inDegree) {
|
|
199
|
+
if (degree === 0) {
|
|
200
|
+
queue.push(name);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
const sorted = [];
|
|
204
|
+
while (queue.length > 0) {
|
|
205
|
+
const node = queue.shift();
|
|
206
|
+
sorted.push(node);
|
|
207
|
+
for (const neighbor of adj.get(node) ?? []) {
|
|
208
|
+
const newDegree = (inDegree.get(neighbor) ?? 1) - 1;
|
|
209
|
+
inDegree.set(neighbor, newDegree);
|
|
210
|
+
if (newDegree === 0) {
|
|
211
|
+
queue.push(neighbor);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (sorted.length < capabilities.length) {
|
|
216
|
+
const cycleNodes = capabilities
|
|
217
|
+
.map(c => c['name'])
|
|
218
|
+
.filter(n => !sorted.includes(n));
|
|
219
|
+
return [{
|
|
220
|
+
path: '$.capabilities',
|
|
221
|
+
message: `Circular dependency detected among capabilities: ${cycleNodes.join(', ')}`,
|
|
222
|
+
}];
|
|
223
|
+
}
|
|
224
|
+
return [];
|
|
225
|
+
}
|
|
226
|
+
// ============================================================================
|
|
227
|
+
// Graph Loader
|
|
228
|
+
// ============================================================================
|
|
229
|
+
const DEFAULT_STAGES = [
|
|
230
|
+
'simulation',
|
|
231
|
+
'research',
|
|
232
|
+
'specification',
|
|
233
|
+
'architecture',
|
|
234
|
+
'build',
|
|
235
|
+
'validation',
|
|
236
|
+
'deployment',
|
|
237
|
+
'governance',
|
|
238
|
+
];
|
|
239
|
+
/** Cached graph instance — loaded once per process. */
|
|
240
|
+
let cachedGraph = null;
|
|
241
|
+
let cachedGraphPath = null;
|
|
242
|
+
/**
|
|
243
|
+
* Resolve the path to the ecosystem graph file.
|
|
244
|
+
* Looks relative to the project root (the directory containing package.json).
|
|
245
|
+
*/
|
|
246
|
+
export function resolveGraphPath(projectRoot) {
|
|
247
|
+
const root = projectRoot ?? findProjectRoot();
|
|
248
|
+
return path.join(root, 'docs', 'ecosystem.graph.json');
|
|
249
|
+
}
|
|
250
|
+
function findProjectRoot() {
|
|
251
|
+
let dir = process.cwd();
|
|
252
|
+
for (let i = 0; i < 10; i++) {
|
|
253
|
+
if (fs.existsSync(path.join(dir, 'package.json'))) {
|
|
254
|
+
return dir;
|
|
255
|
+
}
|
|
256
|
+
const parent = path.dirname(dir);
|
|
257
|
+
if (parent === dir)
|
|
258
|
+
break;
|
|
259
|
+
dir = parent;
|
|
260
|
+
}
|
|
261
|
+
return process.cwd();
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Load and validate the ecosystem capability graph.
|
|
265
|
+
*
|
|
266
|
+
* Returns a validated, immutable graph object. The result is cached for the
|
|
267
|
+
* lifetime of the process. Pass `forceReload: true` to bypass the cache.
|
|
268
|
+
*
|
|
269
|
+
* @throws Error if the graph file cannot be read or fails validation.
|
|
270
|
+
*/
|
|
271
|
+
export function loadEcosystemGraph(options) {
|
|
272
|
+
const graphPath = options?.graphPath ?? resolveGraphPath();
|
|
273
|
+
// Return cached if same path and not forcing reload
|
|
274
|
+
if (cachedGraph && cachedGraphPath === graphPath && !options?.forceReload) {
|
|
275
|
+
return cachedGraph;
|
|
276
|
+
}
|
|
277
|
+
// Read file
|
|
278
|
+
let raw;
|
|
279
|
+
try {
|
|
280
|
+
raw = fs.readFileSync(graphPath, 'utf-8');
|
|
281
|
+
}
|
|
282
|
+
catch (err) {
|
|
283
|
+
const code = err.code;
|
|
284
|
+
if (code === 'ENOENT') {
|
|
285
|
+
throw new Error(`Ecosystem graph not found at ${graphPath}. Expected docs/ecosystem.graph.json in the project root.`);
|
|
286
|
+
}
|
|
287
|
+
throw new Error(`Failed to read ecosystem graph at ${graphPath}: ${err.message}`);
|
|
288
|
+
}
|
|
289
|
+
// Parse JSON
|
|
290
|
+
let data;
|
|
291
|
+
try {
|
|
292
|
+
data = JSON.parse(raw);
|
|
293
|
+
}
|
|
294
|
+
catch (err) {
|
|
295
|
+
throw new Error(`Ecosystem graph at ${graphPath} contains invalid JSON: ${err.message}`);
|
|
296
|
+
}
|
|
297
|
+
// Validate
|
|
298
|
+
const errors = validateGraph(data);
|
|
299
|
+
if (errors.length > 0) {
|
|
300
|
+
const details = errors.map(e => ` ${e.path}: ${e.message}`).join('\n');
|
|
301
|
+
throw new Error(`Ecosystem graph validation failed:\n${details}`);
|
|
302
|
+
}
|
|
303
|
+
// Build typed graph
|
|
304
|
+
const obj = data;
|
|
305
|
+
const rawCapabilities = obj['capabilities'];
|
|
306
|
+
const stages = (Array.isArray(obj['stages']) ? obj['stages'] : DEFAULT_STAGES);
|
|
307
|
+
const graph = {
|
|
308
|
+
version: obj['version'],
|
|
309
|
+
description: obj['description'] ?? '',
|
|
310
|
+
stages,
|
|
311
|
+
capabilities: rawCapabilities.map(c => ({
|
|
312
|
+
name: c['name'],
|
|
313
|
+
description: c['description'],
|
|
314
|
+
repos: c['repos'],
|
|
315
|
+
agents: c['agents'],
|
|
316
|
+
stage: c['stage'],
|
|
317
|
+
depends_on: c['depends_on'] ?? [],
|
|
318
|
+
tags: c['tags'] ?? [],
|
|
319
|
+
})),
|
|
320
|
+
compositions: Array.isArray(obj['compositions'])
|
|
321
|
+
? obj['compositions']
|
|
322
|
+
: undefined,
|
|
323
|
+
fragments_dir: typeof obj['fragments_dir'] === 'string'
|
|
324
|
+
? obj['fragments_dir']
|
|
325
|
+
: undefined,
|
|
326
|
+
};
|
|
327
|
+
// Cache
|
|
328
|
+
cachedGraph = graph;
|
|
329
|
+
cachedGraphPath = graphPath;
|
|
330
|
+
return graph;
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Clear the cached graph. Useful for testing.
|
|
334
|
+
*/
|
|
335
|
+
export function clearGraphCache() {
|
|
336
|
+
cachedGraph = null;
|
|
337
|
+
cachedGraphPath = null;
|
|
338
|
+
}
|
|
339
|
+
// ============================================================================
|
|
340
|
+
// Lookup Helpers
|
|
341
|
+
// ============================================================================
|
|
342
|
+
/**
|
|
343
|
+
* Look up a capability by exact name.
|
|
344
|
+
*/
|
|
345
|
+
export function getCapabilityByName(graph, name) {
|
|
346
|
+
return graph.capabilities.find(c => c.name === name);
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Find all capabilities that have a matching tag.
|
|
350
|
+
*/
|
|
351
|
+
export function getCapabilitiesByTag(graph, tag) {
|
|
352
|
+
const lower = tag.toLowerCase();
|
|
353
|
+
return graph.capabilities.filter(c => c.tags?.some(t => t.toLowerCase() === lower));
|
|
354
|
+
}
|
|
355
|
+
/**
|
|
356
|
+
* Find all capabilities assigned to a given stage.
|
|
357
|
+
*/
|
|
358
|
+
export function getCapabilitiesByStage(graph, stage) {
|
|
359
|
+
return graph.capabilities.filter(c => c.stage === stage);
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Resolve the full dependency tree for a set of capability names.
|
|
363
|
+
* Returns all capability names including transitive dependencies.
|
|
364
|
+
* Uses iterative BFS to avoid stack overflow on deep graphs.
|
|
365
|
+
*/
|
|
366
|
+
export function resolveDependencies(graph, capabilityNames) {
|
|
367
|
+
const resolved = new Set(capabilityNames);
|
|
368
|
+
const queue = [...capabilityNames];
|
|
369
|
+
while (queue.length > 0) {
|
|
370
|
+
const current = queue.shift();
|
|
371
|
+
const cap = getCapabilityByName(graph, current);
|
|
372
|
+
if (!cap?.depends_on)
|
|
373
|
+
continue;
|
|
374
|
+
for (const dep of cap.depends_on) {
|
|
375
|
+
if (!resolved.has(dep)) {
|
|
376
|
+
resolved.add(dep);
|
|
377
|
+
queue.push(dep);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return Array.from(resolved);
|
|
382
|
+
}
|
|
383
|
+
//# sourceMappingURL=graph-loader.js.map
|