@llm-dev-ops/agentics-cli 1.4.59 → 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 +167 -0
- 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
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
import crypto from "crypto";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import { callClaude, extractJson } from "../claude";
|
|
4
|
-
import { analyzeText, type TextAnalysis } from "../text-analysis";
|
|
5
|
-
|
|
6
|
-
const InputSchema = z
|
|
7
|
-
.object({
|
|
8
|
-
objective: z.string(),
|
|
9
|
-
text: z.string().optional(),
|
|
10
|
-
context: z.record(z.unknown()).optional(),
|
|
11
|
-
})
|
|
12
|
-
.strict();
|
|
13
|
-
|
|
14
|
-
interface RiskFactor {
|
|
15
|
-
factor: string;
|
|
16
|
-
score: number;
|
|
17
|
-
weight: number;
|
|
18
|
-
description: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
interface RiskResult {
|
|
22
|
-
overall_risk_score: number;
|
|
23
|
-
risk_level: "low" | "medium" | "high" | "critical";
|
|
24
|
-
risk_factors: RiskFactor[];
|
|
25
|
-
mitigations: string[];
|
|
26
|
-
confidence: number;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
|
-
// Claude-powered analysis
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
|
-
|
|
33
|
-
const SYSTEM_PROMPT = `You are an expert risk analyst. Analyze the given objective and produce a thorough, domain-specific risk assessment.
|
|
34
|
-
|
|
35
|
-
Return ONLY valid JSON (no markdown fences, no explanation) with this exact structure:
|
|
36
|
-
{
|
|
37
|
-
"overall_risk_score": <number 0-100>,
|
|
38
|
-
"risk_level": "low" | "medium" | "high" | "critical",
|
|
39
|
-
"risk_factors": [
|
|
40
|
-
{
|
|
41
|
-
"factor": "<specific, domain-relevant risk factor name>",
|
|
42
|
-
"score": <number 0-100>,
|
|
43
|
-
"weight": <number 0.0-1.0>,
|
|
44
|
-
"description": "<2-3 sentence justification derived from the objective>"
|
|
45
|
-
}
|
|
46
|
-
],
|
|
47
|
-
"mitigations": ["<specific, actionable mitigation>"],
|
|
48
|
-
"confidence": <number 0.0-1.0>
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
Rules:
|
|
52
|
-
- Extract DOMAIN-SPECIFIC risk factors from the objective, not generic ones.
|
|
53
|
-
- Include 4-7 risk factors covering: technology risks (migration complexity, vendor lock-in, integration challenges), business risks (timeline, budget, regulatory compliance), and operational risks (team readiness, data migration, rollback strategy) as applicable.
|
|
54
|
-
- All factor weights must sum to 1.0.
|
|
55
|
-
- overall_risk_score must equal the weighted sum of factor scores (rounded).
|
|
56
|
-
- risk_level: <=25 "low", <=50 "medium", <=75 "high", >75 "critical".
|
|
57
|
-
- Provide 3-7 specific, actionable mitigations tied to the identified risks.
|
|
58
|
-
- confidence reflects how much information was available for assessment (0.5-0.95).
|
|
59
|
-
- Every description and mitigation must reference specifics from the objective.`;
|
|
60
|
-
|
|
61
|
-
async function analyzeWithClaude(
|
|
62
|
-
objective: string,
|
|
63
|
-
text: string | undefined,
|
|
64
|
-
apiKey: string
|
|
65
|
-
): Promise<RiskResult> {
|
|
66
|
-
const userMsg = text
|
|
67
|
-
? `Objective: ${objective}\n\nAdditional context:\n${text}`
|
|
68
|
-
: `Objective: ${objective}`;
|
|
69
|
-
const raw = await callClaude(apiKey, SYSTEM_PROMPT, userMsg);
|
|
70
|
-
const parsed = extractJson<RiskResult>(raw);
|
|
71
|
-
// Validate and clamp values
|
|
72
|
-
parsed.overall_risk_score = clamp(Math.round(parsed.overall_risk_score), 0, 100);
|
|
73
|
-
parsed.confidence = clamp(parsed.confidence, 0, 1);
|
|
74
|
-
parsed.risk_level = riskLevelFromScore(parsed.overall_risk_score);
|
|
75
|
-
for (const f of parsed.risk_factors) {
|
|
76
|
-
f.score = clamp(Math.round(f.score), 0, 100);
|
|
77
|
-
f.weight = clamp(f.weight, 0, 1);
|
|
78
|
-
}
|
|
79
|
-
return parsed;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// ---------------------------------------------------------------------------
|
|
83
|
-
// Heuristic analysis (no API key)
|
|
84
|
-
// ---------------------------------------------------------------------------
|
|
85
|
-
|
|
86
|
-
function analyzeHeuristic(
|
|
87
|
-
objective: string,
|
|
88
|
-
text: string | undefined,
|
|
89
|
-
context: Record<string, unknown> | undefined
|
|
90
|
-
): RiskResult {
|
|
91
|
-
const content = `${objective} ${text || ""}`;
|
|
92
|
-
const ta = analyzeText(content);
|
|
93
|
-
const factors: RiskFactor[] = [];
|
|
94
|
-
|
|
95
|
-
// Build domain-specific risk factors based on what was actually found
|
|
96
|
-
if (ta.actionType === "migration") {
|
|
97
|
-
factors.push(buildMigrationRisks(ta, objective));
|
|
98
|
-
}
|
|
99
|
-
if (ta.entities.length > 0) {
|
|
100
|
-
factors.push(buildTechnologyRisks(ta));
|
|
101
|
-
}
|
|
102
|
-
if (ta.riskSignals.includes("tight timeline pressure") || ta.constraints.includes("timeline constraint")) {
|
|
103
|
-
factors.push({
|
|
104
|
-
factor: `Timeline pressure for ${ta.actionType}`,
|
|
105
|
-
score: 65,
|
|
106
|
-
weight: 0,
|
|
107
|
-
description: `The objective indicates time-sensitive delivery. ${ta.actionType !== "general" ? `A ${ta.actionType} effort under time pressure increases risk of incomplete testing and rushed decision-making.` : "Rushed timelines increase risk of quality issues."}`,
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
if (ta.riskSignals.includes("resource constraints") || ta.constraints.includes("resource limitation")) {
|
|
111
|
-
factors.push({
|
|
112
|
-
factor: "Resource and capacity risk",
|
|
113
|
-
score: 60,
|
|
114
|
-
weight: 0,
|
|
115
|
-
description: `Resource constraints detected in the objective. Limited staffing or budget for "${truncate(objective, 60)}" may lead to bottlenecks and delivery risk.`,
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
if (ta.riskSignals.includes("vendor/third-party dependency")) {
|
|
119
|
-
factors.push({
|
|
120
|
-
factor: `Third-party dependency risk`,
|
|
121
|
-
score: 55,
|
|
122
|
-
weight: 0,
|
|
123
|
-
description: `The objective involves external vendor or partner dependencies. This introduces risks around vendor reliability, lock-in, and alignment with ${ta.entities.length > 0 ? ta.entities.join(", ") : "project"} requirements.`,
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
if (ta.riskSignals.includes("regulatory/compliance exposure") || ta.constraints.includes("regulatory requirement")) {
|
|
127
|
-
const complianceEntities = ta.entities.filter((e) =>
|
|
128
|
-
/PCI|HIPAA|GDPR|SOC|SOX|CCPA|ISO|NIST|FedRAMP/i.test(e)
|
|
129
|
-
);
|
|
130
|
-
factors.push({
|
|
131
|
-
factor: `Compliance risk${complianceEntities.length > 0 ? ` (${complianceEntities.join(", ")})` : ""}`,
|
|
132
|
-
score: 60,
|
|
133
|
-
weight: 0,
|
|
134
|
-
description: `Regulatory or compliance requirements add constraints to the ${ta.actionType}. Non-compliance could result in legal liability, fines, or project delays.`,
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
if (ta.riskSignals.includes("data integrity/migration risk")) {
|
|
138
|
-
factors.push({
|
|
139
|
-
factor: "Data integrity and migration risk",
|
|
140
|
-
score: 65,
|
|
141
|
-
weight: 0,
|
|
142
|
-
description: `Data migration or transformation is involved. Risks include data loss, corruption, schema incompatibilities, and validation gaps during the transition.`,
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
if (ta.riskSignals.includes("security exposure")) {
|
|
146
|
-
factors.push({
|
|
147
|
-
factor: "Security exposure risk",
|
|
148
|
-
score: 55,
|
|
149
|
-
weight: 0,
|
|
150
|
-
description: `Security considerations are present in the objective. Changes to systems or infrastructure may introduce new attack surfaces or temporarily weaken security posture.`,
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
if (ta.riskSignals.includes("technical complexity") && !factors.some((f) => f.factor.includes("complexity"))) {
|
|
154
|
-
factors.push({
|
|
155
|
-
factor: `Technical complexity of ${ta.actionType}`,
|
|
156
|
-
score: 60,
|
|
157
|
-
weight: 0,
|
|
158
|
-
description: `The scope described in "${truncate(objective, 50)}" indicates significant technical complexity involving ${ta.entities.length > 0 ? ta.entities.slice(0, 3).join(", ") : "multiple systems"}.`,
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
// Ensure we have at least 3 factors
|
|
163
|
-
if (factors.length < 3) {
|
|
164
|
-
if (!factors.some((f) => f.factor.toLowerCase().includes("scope"))) {
|
|
165
|
-
factors.push({
|
|
166
|
-
factor: `Scope management for ${ta.actionType || "initiative"}`,
|
|
167
|
-
score: 40,
|
|
168
|
-
weight: 0,
|
|
169
|
-
description: `Without clearly bounded scope, "${truncate(objective, 50)}" risks expanding beyond original intent, impacting timelines and resources.`,
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
if (factors.length < 3) {
|
|
173
|
-
factors.push({
|
|
174
|
-
factor: "Stakeholder alignment risk",
|
|
175
|
-
score: 35,
|
|
176
|
-
weight: 0,
|
|
177
|
-
description: `Ensuring all stakeholders agree on approach, priorities, and success criteria for "${truncate(objective, 50)}" is critical for avoiding mid-project pivots.`,
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
if (factors.length < 3) {
|
|
181
|
-
factors.push({
|
|
182
|
-
factor: "Execution and delivery risk",
|
|
183
|
-
score: 40,
|
|
184
|
-
weight: 0,
|
|
185
|
-
description: `General execution risk for the described initiative. Unforeseen technical or organizational challenges may arise during implementation.`,
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
// Assign weights evenly then adjust
|
|
191
|
-
const evenWeight = parseFloat((1.0 / factors.length).toFixed(3));
|
|
192
|
-
for (const f of factors) f.weight = evenWeight;
|
|
193
|
-
// Fix rounding: give remainder to first factor
|
|
194
|
-
const remainder = parseFloat((1.0 - evenWeight * factors.length).toFixed(3));
|
|
195
|
-
if (factors.length > 0) factors[0].weight = parseFloat((factors[0].weight + remainder).toFixed(3));
|
|
196
|
-
|
|
197
|
-
// Calculate weighted score
|
|
198
|
-
const overallRiskScore = clamp(
|
|
199
|
-
Math.round(factors.reduce((sum, f) => sum + f.score * f.weight, 0)),
|
|
200
|
-
0,
|
|
201
|
-
100
|
|
202
|
-
);
|
|
203
|
-
|
|
204
|
-
// Generate mitigations tied to the specific factors
|
|
205
|
-
const mitigations = factors
|
|
206
|
-
.filter((f) => f.score >= 40)
|
|
207
|
-
.map((f) => generateMitigation(f, ta));
|
|
208
|
-
if (mitigations.length < 2) {
|
|
209
|
-
mitigations.push(
|
|
210
|
-
`Establish regular risk review checkpoints throughout the ${ta.actionType} process`
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
// Confidence based on input richness
|
|
215
|
-
let confidence = 0.55;
|
|
216
|
-
if (text) confidence += 0.1;
|
|
217
|
-
if (context) confidence += 0.05;
|
|
218
|
-
if (ta.wordCount > 20) confidence += 0.05;
|
|
219
|
-
if (ta.wordCount > 50) confidence += 0.05;
|
|
220
|
-
if (ta.entities.length > 0) confidence += 0.05;
|
|
221
|
-
confidence = clamp(confidence, 0.4, 0.85);
|
|
222
|
-
|
|
223
|
-
return {
|
|
224
|
-
overall_risk_score: overallRiskScore,
|
|
225
|
-
risk_level: riskLevelFromScore(overallRiskScore),
|
|
226
|
-
risk_factors: factors,
|
|
227
|
-
mitigations,
|
|
228
|
-
confidence,
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function buildMigrationRisks(ta: TextAnalysis, objective: string): RiskFactor {
|
|
233
|
-
const from = ta.entities.length > 0 ? ta.entities[0] : "source system";
|
|
234
|
-
const to = ta.entities.length > 1 ? ta.entities[1] : "target system";
|
|
235
|
-
return {
|
|
236
|
-
factor: `Migration complexity (${from} to ${to})`,
|
|
237
|
-
score: 65,
|
|
238
|
-
weight: 0,
|
|
239
|
-
description: `Migrating from ${from} to ${to} involves compatibility risks, data transfer challenges, and potential downtime. ${ta.constraints.length > 0 ? `Additional constraints: ${ta.constraints.join(", ")}.` : "Careful planning and rollback strategies are essential."}`,
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
function buildTechnologyRisks(ta: TextAnalysis): RiskFactor {
|
|
244
|
-
const techs = ta.entities.slice(0, 4).join(", ");
|
|
245
|
-
return {
|
|
246
|
-
factor: `Technology risk (${techs})`,
|
|
247
|
-
score: ta.entities.length > 3 ? 60 : 45,
|
|
248
|
-
weight: 0,
|
|
249
|
-
description: `The objective involves ${techs}. ${ta.entities.length > 3 ? "Multiple technology dependencies increase integration complexity and potential for compatibility issues." : "Technology-specific risks include learning curve, ecosystem maturity, and vendor support."}`,
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
function generateMitigation(factor: RiskFactor, ta: TextAnalysis): string {
|
|
254
|
-
const name = factor.factor.toLowerCase();
|
|
255
|
-
if (name.includes("migration"))
|
|
256
|
-
return `Develop a detailed migration plan with rollback procedures, dry-run testing, and phased cutover for the ${ta.entities.slice(0, 2).join(" to ") || "system"} migration`;
|
|
257
|
-
if (name.includes("timeline"))
|
|
258
|
-
return `Build schedule buffers and define a minimum viable scope that can be delivered within the constrained timeline`;
|
|
259
|
-
if (name.includes("resource"))
|
|
260
|
-
return `Identify critical skill gaps early and secure dedicated team capacity before the ${ta.actionType} begins`;
|
|
261
|
-
if (name.includes("compliance") || name.includes("regulatory"))
|
|
262
|
-
return `Engage compliance/legal review early and build compliance checkpoints into the project plan`;
|
|
263
|
-
if (name.includes("vendor") || name.includes("third-party"))
|
|
264
|
-
return `Negotiate SLAs with vendors and identify alternative providers to reduce single-vendor dependency`;
|
|
265
|
-
if (name.includes("data"))
|
|
266
|
-
return `Implement data validation and reconciliation procedures at every stage of the data migration pipeline`;
|
|
267
|
-
if (name.includes("security"))
|
|
268
|
-
return `Conduct security review and threat modeling before and after system changes`;
|
|
269
|
-
if (name.includes("technology"))
|
|
270
|
-
return `Run a proof-of-concept or spike to validate technology choices (${ta.entities.slice(0, 2).join(", ")}) before committing to full implementation`;
|
|
271
|
-
if (name.includes("scope"))
|
|
272
|
-
return `Define clear scope boundaries and a formal change-request process to prevent scope creep`;
|
|
273
|
-
return `Address ${factor.factor} through proactive monitoring, stakeholder communication, and contingency planning`;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
// ---------------------------------------------------------------------------
|
|
277
|
-
// Utilities
|
|
278
|
-
// ---------------------------------------------------------------------------
|
|
279
|
-
|
|
280
|
-
function clamp(n: number, min: number, max: number): number {
|
|
281
|
-
return Math.max(min, Math.min(max, n));
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function riskLevelFromScore(score: number): "low" | "medium" | "high" | "critical" {
|
|
285
|
-
if (score <= 25) return "low";
|
|
286
|
-
if (score <= 50) return "medium";
|
|
287
|
-
if (score <= 75) return "high";
|
|
288
|
-
return "critical";
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
function truncate(s: string, len: number): string {
|
|
292
|
-
return s.length > len ? s.slice(0, len) + "..." : s;
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// ---------------------------------------------------------------------------
|
|
296
|
-
// Handler
|
|
297
|
-
// ---------------------------------------------------------------------------
|
|
298
|
-
|
|
299
|
-
export async function handleRiskScore(
|
|
300
|
-
body: Record<string, unknown>,
|
|
301
|
-
traceId?: string,
|
|
302
|
-
apiKey?: string
|
|
303
|
-
): Promise<Record<string, unknown>> {
|
|
304
|
-
const parsed = InputSchema.parse(body);
|
|
305
|
-
|
|
306
|
-
let result: RiskResult;
|
|
307
|
-
if (apiKey) {
|
|
308
|
-
try {
|
|
309
|
-
result = await analyzeWithClaude(parsed.objective, parsed.text, apiKey);
|
|
310
|
-
} catch {
|
|
311
|
-
// Fall back to heuristic on any Claude failure
|
|
312
|
-
result = analyzeHeuristic(parsed.objective, parsed.text, parsed.context);
|
|
313
|
-
}
|
|
314
|
-
} else {
|
|
315
|
-
result = analyzeHeuristic(parsed.objective, parsed.text, parsed.context);
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
return {
|
|
319
|
-
risk_id: crypto.randomUUID(),
|
|
320
|
-
objective: parsed.objective,
|
|
321
|
-
overall_risk_score: result.overall_risk_score,
|
|
322
|
-
risk_level: result.risk_level,
|
|
323
|
-
risk_factors: result.risk_factors,
|
|
324
|
-
mitigations: result.mitigations,
|
|
325
|
-
confidence: result.confidence,
|
|
326
|
-
};
|
|
327
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.callClaude = callClaude;
|
|
4
|
-
exports.extractJson = extractJson;
|
|
5
|
-
|
|
6
|
-
const { execFileSync } = require("child_process");
|
|
7
|
-
|
|
8
|
-
function findClaudeBinary() {
|
|
9
|
-
for (const name of ["claude", "claude-code"]) {
|
|
10
|
-
try {
|
|
11
|
-
const result = execFileSync("which", [name], { encoding: "utf-8", timeout: 5000 }).trim();
|
|
12
|
-
if (result) return result;
|
|
13
|
-
} catch {}
|
|
14
|
-
}
|
|
15
|
-
throw new Error("Claude Code binary not found. Install: npm i -g @anthropic-ai/claude-code");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
let _binary = null;
|
|
19
|
-
function getBinary() {
|
|
20
|
-
if (!_binary) _binary = findClaudeBinary();
|
|
21
|
-
return _binary;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async function callClaude(apiKey, systemPrompt, userMessage) {
|
|
25
|
-
const binary = getBinary();
|
|
26
|
-
const prompt = systemPrompt + "\n\n" + userMessage;
|
|
27
|
-
const env = Object.assign({}, process.env, { CI: "1" });
|
|
28
|
-
// Use short timeout when called from a child process (to avoid blocking the
|
|
29
|
-
// child's event loop for 120s). The parent will kill us anyway at timeoutMs.
|
|
30
|
-
const timeoutMs = process.env.AGENTICS_CHILD_PROCESS ? 8000 : 120000;
|
|
31
|
-
delete env.CLAUDECODE;
|
|
32
|
-
delete env.AGENTICS_DEV;
|
|
33
|
-
|
|
34
|
-
const raw = execFileSync(binary, [
|
|
35
|
-
"--print", "--output-format", "json", "--model", "claude-sonnet-4-20250514", prompt
|
|
36
|
-
], {
|
|
37
|
-
encoding: "utf-8",
|
|
38
|
-
timeout: timeoutMs,
|
|
39
|
-
stdio: ["pipe", "pipe", "pipe"],
|
|
40
|
-
env: env,
|
|
41
|
-
maxBuffer: 10 * 1024 * 1024,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
// Unwrap claude --output-format json envelope
|
|
45
|
-
try {
|
|
46
|
-
const parsed = JSON.parse(raw);
|
|
47
|
-
if (parsed.type === "result" && typeof parsed.result === "string") {
|
|
48
|
-
return parsed.result;
|
|
49
|
-
}
|
|
50
|
-
return raw;
|
|
51
|
-
} catch {
|
|
52
|
-
return raw;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function extractJson(text) {
|
|
57
|
-
const fenceMatch = text.match(/```(?:json)?\s*([\s\S]*?)```/);
|
|
58
|
-
if (fenceMatch) return JSON.parse(fenceMatch[1].trim());
|
|
59
|
-
const startIdx = text.search(/[{[]/);
|
|
60
|
-
if (startIdx >= 0) {
|
|
61
|
-
const startChar = text[startIdx];
|
|
62
|
-
const endChar = startChar === "{" ? "}" : "]";
|
|
63
|
-
let depth = 0;
|
|
64
|
-
for (let i = startIdx; i < text.length; i++) {
|
|
65
|
-
if (text[i] === startChar) depth++;
|
|
66
|
-
else if (text[i] === endChar) depth--;
|
|
67
|
-
if (depth === 0) return JSON.parse(text.slice(startIdx, i + 1));
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return JSON.parse(text.trim());
|
|
71
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage, ServerResponse } from "http";
|
|
2
|
-
|
|
3
|
-
export function setCorsHeaders(res: ServerResponse): void {
|
|
4
|
-
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
5
|
-
res.setHeader("Access-Control-Allow-Methods", "GET, POST, OPTIONS");
|
|
6
|
-
res.setHeader(
|
|
7
|
-
"Access-Control-Allow-Headers",
|
|
8
|
-
"Content-Type, Authorization, X-Correlation-ID"
|
|
9
|
-
);
|
|
10
|
-
res.setHeader("Access-Control-Max-Age", "86400");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export function handleCors(
|
|
14
|
-
req: IncomingMessage,
|
|
15
|
-
res: ServerResponse
|
|
16
|
-
): boolean {
|
|
17
|
-
setCorsHeaders(res);
|
|
18
|
-
if (req.method === "OPTIONS") {
|
|
19
|
-
res.writeHead(204);
|
|
20
|
-
res.end();
|
|
21
|
-
return true;
|
|
22
|
-
}
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import crypto from "crypto";
|
|
2
|
-
|
|
3
|
-
export interface LayerEntry {
|
|
4
|
-
layer: string;
|
|
5
|
-
status: "completed" | "failed" | "skipped";
|
|
6
|
-
duration_ms?: number;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export interface ExecutionMetadata {
|
|
10
|
-
trace_id: string;
|
|
11
|
-
timestamp: string;
|
|
12
|
-
service: string;
|
|
13
|
-
execution_id: string;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface EnvelopedResponse {
|
|
17
|
-
data: Record<string, unknown>;
|
|
18
|
-
execution_metadata: ExecutionMetadata;
|
|
19
|
-
layers_executed: LayerEntry[];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function buildEnvelope(
|
|
23
|
-
data: Record<string, unknown>,
|
|
24
|
-
layers: LayerEntry[],
|
|
25
|
-
traceId?: string
|
|
26
|
-
): EnvelopedResponse {
|
|
27
|
-
return {
|
|
28
|
-
data,
|
|
29
|
-
execution_metadata: {
|
|
30
|
-
trace_id: traceId || crypto.randomUUID(),
|
|
31
|
-
timestamp: new Date().toISOString(),
|
|
32
|
-
service: "platform-agents",
|
|
33
|
-
execution_id: crypto.randomUUID(),
|
|
34
|
-
},
|
|
35
|
-
layers_executed: layers,
|
|
36
|
-
};
|
|
37
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ServerResponse } from "http";
|
|
2
|
-
import { setCorsHeaders } from "./cors";
|
|
3
|
-
|
|
4
|
-
export function handleHealth(res: ServerResponse): void {
|
|
5
|
-
setCorsHeaders(res);
|
|
6
|
-
res.writeHead(200, { "Content-Type": "application/json" });
|
|
7
|
-
res.end(
|
|
8
|
-
JSON.stringify({
|
|
9
|
-
status: "healthy",
|
|
10
|
-
service: "platform-agents",
|
|
11
|
-
timestamp: new Date().toISOString(),
|
|
12
|
-
agents: [
|
|
13
|
-
"decision",
|
|
14
|
-
"executive-summary",
|
|
15
|
-
"decision-memo",
|
|
16
|
-
"risk-score",
|
|
17
|
-
],
|
|
18
|
-
})
|
|
19
|
-
);
|
|
20
|
-
}
|
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage, ServerResponse } from "http";
|
|
2
|
-
import { handleCors, setCorsHeaders } from "./cors";
|
|
3
|
-
import { handleHealth } from "./health";
|
|
4
|
-
import { resolveAgent } from "./router";
|
|
5
|
-
import { buildEnvelope } from "./envelope";
|
|
6
|
-
import type { LayerEntry } from "./envelope";
|
|
7
|
-
import * as functions from "@google-cloud/functions-framework";
|
|
8
|
-
|
|
9
|
-
function parseBody(req: IncomingMessage): Promise<Record<string, unknown>> {
|
|
10
|
-
return new Promise((resolve, reject) => {
|
|
11
|
-
// Cloud Functions may have already parsed the body
|
|
12
|
-
if ((req as any).body) {
|
|
13
|
-
resolve((req as any).body as Record<string, unknown>);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const chunks: Buffer[] = [];
|
|
17
|
-
req.on("data", (chunk: Buffer) => chunks.push(chunk));
|
|
18
|
-
req.on("end", () => {
|
|
19
|
-
try {
|
|
20
|
-
const raw = Buffer.concat(chunks).toString("utf-8");
|
|
21
|
-
resolve(raw ? JSON.parse(raw) : {});
|
|
22
|
-
} catch {
|
|
23
|
-
reject(new Error("Invalid JSON body"));
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
req.on("error", reject);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function sendJson(
|
|
31
|
-
res: ServerResponse,
|
|
32
|
-
status: number,
|
|
33
|
-
body: unknown
|
|
34
|
-
): void {
|
|
35
|
-
setCorsHeaders(res);
|
|
36
|
-
res.writeHead(status, { "Content-Type": "application/json" });
|
|
37
|
-
res.end(JSON.stringify(body));
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function persistToRuvector(
|
|
41
|
-
data: Record<string, unknown>,
|
|
42
|
-
traceId: string
|
|
43
|
-
): Promise<void> {
|
|
44
|
-
const url = process.env.RUVECTOR_SERVICE_URL;
|
|
45
|
-
if (!url) return;
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
await fetch(`${url}/v1/vectors/store`, {
|
|
49
|
-
method: "POST",
|
|
50
|
-
headers: {
|
|
51
|
-
"Content-Type": "application/json",
|
|
52
|
-
"X-Correlation-ID": traceId,
|
|
53
|
-
},
|
|
54
|
-
body: JSON.stringify({
|
|
55
|
-
source: "platform-agents",
|
|
56
|
-
trace_id: traceId,
|
|
57
|
-
payload: data,
|
|
58
|
-
timestamp: new Date().toISOString(),
|
|
59
|
-
}),
|
|
60
|
-
signal: AbortSignal.timeout(5000),
|
|
61
|
-
});
|
|
62
|
-
} catch {
|
|
63
|
-
// Non-blocking, failure-tolerant — silently ignore
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
async function handleRequest(
|
|
68
|
-
req: IncomingMessage,
|
|
69
|
-
res: ServerResponse
|
|
70
|
-
): Promise<void> {
|
|
71
|
-
// CORS preflight
|
|
72
|
-
if (handleCors(req, res)) return;
|
|
73
|
-
|
|
74
|
-
const url = (req as any).url || req.url || "/";
|
|
75
|
-
const path = url.split("?")[0].replace(/\/+$/, "") || "/";
|
|
76
|
-
|
|
77
|
-
// Health check
|
|
78
|
-
if (path === "/health" || path.endsWith("/health")) {
|
|
79
|
-
handleHealth(res);
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
// Route: /v1/platform/<agent-slug>
|
|
84
|
-
const match = path.match(/\/v1\/platform\/([a-z-]+)$/);
|
|
85
|
-
if (!match || req.method !== "POST") {
|
|
86
|
-
sendJson(res, 404, {
|
|
87
|
-
error: "Not found",
|
|
88
|
-
message: `No route for ${req.method} ${path}`,
|
|
89
|
-
available_routes: [
|
|
90
|
-
"POST /v1/platform/decision",
|
|
91
|
-
"POST /v1/platform/executive-summary",
|
|
92
|
-
"POST /v1/platform/decision-memo",
|
|
93
|
-
"POST /v1/platform/risk-score",
|
|
94
|
-
"GET /health",
|
|
95
|
-
],
|
|
96
|
-
});
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const slug = match[1];
|
|
101
|
-
const agent = resolveAgent(slug);
|
|
102
|
-
if (!agent) {
|
|
103
|
-
sendJson(res, 404, {
|
|
104
|
-
error: "Unknown agent",
|
|
105
|
-
message: `Agent "${slug}" not found`,
|
|
106
|
-
});
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const traceId =
|
|
111
|
-
(req.headers["x-correlation-id"] as string) ||
|
|
112
|
-
crypto.randomUUID();
|
|
113
|
-
|
|
114
|
-
let body: Record<string, unknown>;
|
|
115
|
-
try {
|
|
116
|
-
body = await parseBody(req);
|
|
117
|
-
} catch {
|
|
118
|
-
sendJson(res, 400, buildEnvelope(
|
|
119
|
-
{ error: "Invalid JSON body" },
|
|
120
|
-
[{ layer: "AGENT_ROUTING", status: "failed" }],
|
|
121
|
-
traceId
|
|
122
|
-
));
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
const layers: LayerEntry[] = [
|
|
127
|
-
{ layer: "AGENT_ROUTING", status: "completed" },
|
|
128
|
-
];
|
|
129
|
-
|
|
130
|
-
const start = performance.now();
|
|
131
|
-
try {
|
|
132
|
-
const apiKey =
|
|
133
|
-
(req.headers["x-anthropic-api-key"] as string) || undefined;
|
|
134
|
-
const data = await agent.handler(body, traceId, apiKey);
|
|
135
|
-
const duration_ms = Math.round(performance.now() - start);
|
|
136
|
-
|
|
137
|
-
layers.push({
|
|
138
|
-
layer: agent.layerName,
|
|
139
|
-
status: "completed",
|
|
140
|
-
duration_ms,
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
const envelope = buildEnvelope(data, layers, traceId);
|
|
144
|
-
sendJson(res, 200, envelope);
|
|
145
|
-
|
|
146
|
-
// Fire-and-forget persistence
|
|
147
|
-
persistToRuvector(data, traceId);
|
|
148
|
-
} catch (err: any) {
|
|
149
|
-
const duration_ms = Math.round(performance.now() - start);
|
|
150
|
-
layers.push({
|
|
151
|
-
layer: agent.layerName,
|
|
152
|
-
status: "failed",
|
|
153
|
-
duration_ms,
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
const status = err.statusCode || 400;
|
|
157
|
-
sendJson(
|
|
158
|
-
res,
|
|
159
|
-
status,
|
|
160
|
-
buildEnvelope(
|
|
161
|
-
{ error: err.message || "Agent execution failed" },
|
|
162
|
-
layers,
|
|
163
|
-
traceId
|
|
164
|
-
)
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
import crypto from "crypto";
|
|
170
|
-
|
|
171
|
-
functions.http("handler", handleRequest);
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { handleDecision } from "./agents/decision";
|
|
2
|
-
import { handleExecutiveSummary } from "./agents/executive-summary";
|
|
3
|
-
import { handleDecisionMemo } from "./agents/decision-memo";
|
|
4
|
-
import { handleRiskScore } from "./agents/risk-score";
|
|
5
|
-
|
|
6
|
-
export type AgentHandler = (
|
|
7
|
-
body: Record<string, unknown>,
|
|
8
|
-
traceId?: string,
|
|
9
|
-
apiKey?: string
|
|
10
|
-
) => Promise<Record<string, unknown>>;
|
|
11
|
-
|
|
12
|
-
interface AgentRoute {
|
|
13
|
-
handler: AgentHandler;
|
|
14
|
-
layerName: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const routes: Record<string, AgentRoute> = {
|
|
18
|
-
decision: {
|
|
19
|
-
handler: handleDecision,
|
|
20
|
-
layerName: "PLATFORM_DECISION",
|
|
21
|
-
},
|
|
22
|
-
"executive-summary": {
|
|
23
|
-
handler: handleExecutiveSummary,
|
|
24
|
-
layerName: "PLATFORM_EXECUTIVE_SUMMARY",
|
|
25
|
-
},
|
|
26
|
-
"decision-memo": {
|
|
27
|
-
handler: handleDecisionMemo,
|
|
28
|
-
layerName: "PLATFORM_DECISION_MEMO",
|
|
29
|
-
},
|
|
30
|
-
"risk-score": {
|
|
31
|
-
handler: handleRiskScore,
|
|
32
|
-
layerName: "PLATFORM_RISK_SCORE",
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export function resolveAgent(slug: string): AgentRoute | undefined {
|
|
37
|
-
return routes[slug];
|
|
38
|
-
}
|