@vauban-org/agent-sdk 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRACT.md +6968 -0
- package/README.md +205 -0
- package/dist/adapters/hitl/memory-state-store.d.ts +23 -0
- package/dist/adapters/hitl/memory-state-store.d.ts.map +1 -0
- package/dist/adapters/hitl/memory-state-store.js +72 -0
- package/dist/adapters/hitl/memory-state-store.js.map +1 -0
- package/dist/adapters/hitl/postgres-state-store.d.ts +29 -0
- package/dist/adapters/hitl/postgres-state-store.d.ts.map +1 -0
- package/dist/adapters/hitl/postgres-state-store.js +103 -0
- package/dist/adapters/hitl/postgres-state-store.js.map +1 -0
- package/dist/adapters/llm/anthropic-direct.d.ts +28 -0
- package/dist/adapters/llm/anthropic-direct.d.ts.map +1 -0
- package/dist/adapters/llm/anthropic-direct.js +163 -0
- package/dist/adapters/llm/anthropic-direct.js.map +1 -0
- package/dist/adapters/llm/cascade.d.ts +27 -0
- package/dist/adapters/llm/cascade.d.ts.map +1 -0
- package/dist/adapters/llm/cascade.js +88 -0
- package/dist/adapters/llm/cascade.js.map +1 -0
- package/dist/adapters/llm/litellm.d.ts +28 -0
- package/dist/adapters/llm/litellm.d.ts.map +1 -0
- package/dist/adapters/llm/litellm.js +239 -0
- package/dist/adapters/llm/litellm.js.map +1 -0
- package/dist/adapters/messaging/console.d.ts +32 -0
- package/dist/adapters/messaging/console.d.ts.map +1 -0
- package/dist/adapters/messaging/console.js +47 -0
- package/dist/adapters/messaging/console.js.map +1 -0
- package/dist/adapters/messaging/discord.d.ts +34 -0
- package/dist/adapters/messaging/discord.d.ts.map +1 -0
- package/dist/adapters/messaging/discord.js +86 -0
- package/dist/adapters/messaging/discord.js.map +1 -0
- package/dist/adapters/messaging/mcp.d.ts +53 -0
- package/dist/adapters/messaging/mcp.d.ts.map +1 -0
- package/dist/adapters/messaging/mcp.js +43 -0
- package/dist/adapters/messaging/mcp.js.map +1 -0
- package/dist/adapters/messaging/slack.d.ts +21 -0
- package/dist/adapters/messaging/slack.d.ts.map +1 -0
- package/dist/adapters/messaging/slack.js +71 -0
- package/dist/adapters/messaging/slack.js.map +1 -0
- package/dist/adapters/messaging/telegram.d.ts +31 -0
- package/dist/adapters/messaging/telegram.d.ts.map +1 -0
- package/dist/adapters/messaging/telegram.js +85 -0
- package/dist/adapters/messaging/telegram.js.map +1 -0
- package/dist/adapters/registry/memory.d.ts +40 -0
- package/dist/adapters/registry/memory.d.ts.map +1 -0
- package/dist/adapters/registry/memory.js +71 -0
- package/dist/adapters/registry/memory.js.map +1 -0
- package/dist/adapters/registry/postgres.d.ts +39 -0
- package/dist/adapters/registry/postgres.d.ts.map +1 -0
- package/dist/adapters/registry/postgres.js +124 -0
- package/dist/adapters/registry/postgres.js.map +1 -0
- package/dist/agents/index.d.ts +2 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +3 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/trading.d.ts +99 -0
- package/dist/agents/trading.d.ts.map +1 -0
- package/dist/agents/trading.js +39 -0
- package/dist/agents/trading.js.map +1 -0
- package/dist/auth/errors.d.ts +38 -0
- package/dist/auth/errors.d.ts.map +1 -0
- package/dist/auth/errors.js +57 -0
- package/dist/auth/errors.js.map +1 -0
- package/dist/auth/nonce-store.d.ts +52 -0
- package/dist/auth/nonce-store.d.ts.map +1 -0
- package/dist/auth/nonce-store.js +55 -0
- package/dist/auth/nonce-store.js.map +1 -0
- package/dist/auth/sign-event.d.ts +28 -0
- package/dist/auth/sign-event.d.ts.map +1 -0
- package/dist/auth/sign-event.js +42 -0
- package/dist/auth/sign-event.js.map +1 -0
- package/dist/auth/verify-event.d.ts +36 -0
- package/dist/auth/verify-event.d.ts.map +1 -0
- package/dist/auth/verify-event.js +78 -0
- package/dist/auth/verify-event.js.map +1 -0
- package/dist/boot/init-sdk.d.ts +69 -0
- package/dist/boot/init-sdk.d.ts.map +1 -0
- package/dist/boot/init-sdk.js +53 -0
- package/dist/boot/init-sdk.js.map +1 -0
- package/dist/boot/load-agent-context.d.ts +82 -0
- package/dist/boot/load-agent-context.d.ts.map +1 -0
- package/dist/boot/load-agent-context.js +90 -0
- package/dist/boot/load-agent-context.js.map +1 -0
- package/dist/boot/load-recent-memory.d.ts +47 -0
- package/dist/boot/load-recent-memory.d.ts.map +1 -0
- package/dist/boot/load-recent-memory.js +56 -0
- package/dist/boot/load-recent-memory.js.map +1 -0
- package/dist/budget/budget-state.d.ts +88 -0
- package/dist/budget/budget-state.d.ts.map +1 -0
- package/dist/budget/budget-state.js +172 -0
- package/dist/budget/budget-state.js.map +1 -0
- package/dist/budget/index.d.ts +3 -0
- package/dist/budget/index.d.ts.map +1 -0
- package/dist/budget/index.js +2 -0
- package/dist/budget/index.js.map +1 -0
- package/dist/clients/agents.d.ts +40 -0
- package/dist/clients/agents.d.ts.map +1 -0
- package/dist/clients/agents.js +85 -0
- package/dist/clients/agents.js.map +1 -0
- package/dist/clients/index.d.ts +7 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +7 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/messaging-adapters.d.ts +51 -0
- package/dist/clients/messaging-adapters.d.ts.map +1 -0
- package/dist/clients/messaging-adapters.js +118 -0
- package/dist/clients/messaging-adapters.js.map +1 -0
- package/dist/clients/pipelines.d.ts +43 -0
- package/dist/clients/pipelines.d.ts.map +1 -0
- package/dist/clients/pipelines.js +96 -0
- package/dist/clients/pipelines.js.map +1 -0
- package/dist/compute/strategies/best-of-n.d.ts +46 -0
- package/dist/compute/strategies/best-of-n.d.ts.map +1 -0
- package/dist/compute/strategies/best-of-n.js +112 -0
- package/dist/compute/strategies/best-of-n.js.map +1 -0
- package/dist/compute/strategies/bon-mav.d.ts +65 -0
- package/dist/compute/strategies/bon-mav.d.ts.map +1 -0
- package/dist/compute/strategies/bon-mav.js +154 -0
- package/dist/compute/strategies/bon-mav.js.map +1 -0
- package/dist/compute/strategies/single-shot.d.ts +17 -0
- package/dist/compute/strategies/single-shot.d.ts.map +1 -0
- package/dist/compute/strategies/single-shot.js +36 -0
- package/dist/compute/strategies/single-shot.js.map +1 -0
- package/dist/compute/types.d.ts +30 -0
- package/dist/compute/types.d.ts.map +1 -0
- package/dist/compute/types.js +8 -0
- package/dist/compute/types.js.map +1 -0
- package/dist/compute/verifier.d.ts +55 -0
- package/dist/compute/verifier.d.ts.map +1 -0
- package/dist/compute/verifier.js +35 -0
- package/dist/compute/verifier.js.map +1 -0
- package/dist/compute/with-compute.d.ts +50 -0
- package/dist/compute/with-compute.d.ts.map +1 -0
- package/dist/compute/with-compute.js +69 -0
- package/dist/compute/with-compute.js.map +1 -0
- package/dist/constitution/axioms.d.ts +65 -0
- package/dist/constitution/axioms.d.ts.map +1 -0
- package/dist/constitution/axioms.js +496 -0
- package/dist/constitution/axioms.js.map +1 -0
- package/dist/constitution/gate.d.ts +47 -0
- package/dist/constitution/gate.d.ts.map +1 -0
- package/dist/constitution/gate.js +143 -0
- package/dist/constitution/gate.js.map +1 -0
- package/dist/constitution/index.d.ts +20 -0
- package/dist/constitution/index.d.ts.map +1 -0
- package/dist/constitution/index.js +15 -0
- package/dist/constitution/index.js.map +1 -0
- package/dist/constitution/scorer.d.ts +67 -0
- package/dist/constitution/scorer.d.ts.map +1 -0
- package/dist/constitution/scorer.js +111 -0
- package/dist/constitution/scorer.js.map +1 -0
- package/dist/constitution/signal.d.ts +41 -0
- package/dist/constitution/signal.d.ts.map +1 -0
- package/dist/constitution/signal.js +61 -0
- package/dist/constitution/signal.js.map +1 -0
- package/dist/constitution/types.d.ts +295 -0
- package/dist/constitution/types.d.ts.map +1 -0
- package/dist/constitution/types.js +59 -0
- package/dist/constitution/types.js.map +1 -0
- package/dist/counterfactual/index.d.ts +11 -0
- package/dist/counterfactual/index.d.ts.map +1 -0
- package/dist/counterfactual/index.js +10 -0
- package/dist/counterfactual/index.js.map +1 -0
- package/dist/counterfactual/replay-with-alt.d.ts +137 -0
- package/dist/counterfactual/replay-with-alt.d.ts.map +1 -0
- package/dist/counterfactual/replay-with-alt.js +191 -0
- package/dist/counterfactual/replay-with-alt.js.map +1 -0
- package/dist/dataops/index.d.ts +5 -0
- package/dist/dataops/index.d.ts.map +1 -0
- package/dist/dataops/index.js +3 -0
- package/dist/dataops/index.js.map +1 -0
- package/dist/dataops/starkscan.d.ts +13 -0
- package/dist/dataops/starkscan.d.ts.map +1 -0
- package/dist/dataops/starkscan.js +12 -0
- package/dist/dataops/starkscan.js.map +1 -0
- package/dist/dataops/voyager.d.ts +58 -0
- package/dist/dataops/voyager.d.ts.map +1 -0
- package/dist/dataops/voyager.js +146 -0
- package/dist/dataops/voyager.js.map +1 -0
- package/dist/deprecation.d.ts +49 -0
- package/dist/deprecation.d.ts.map +1 -0
- package/dist/deprecation.js +84 -0
- package/dist/deprecation.js.map +1 -0
- package/dist/durable/bullmq-runner.d.ts +138 -0
- package/dist/durable/bullmq-runner.d.ts.map +1 -0
- package/dist/durable/bullmq-runner.js +378 -0
- package/dist/durable/bullmq-runner.js.map +1 -0
- package/dist/durable/index.d.ts +3 -0
- package/dist/durable/index.d.ts.map +1 -0
- package/dist/durable/index.js +2 -0
- package/dist/durable/index.js.map +1 -0
- package/dist/economy/circuit-breaker.d.ts +37 -0
- package/dist/economy/circuit-breaker.d.ts.map +1 -0
- package/dist/economy/circuit-breaker.js +104 -0
- package/dist/economy/circuit-breaker.js.map +1 -0
- package/dist/economy/economy-router.d.ts +103 -0
- package/dist/economy/economy-router.d.ts.map +1 -0
- package/dist/economy/economy-router.js +176 -0
- package/dist/economy/economy-router.js.map +1 -0
- package/dist/economy/index.d.ts +16 -0
- package/dist/economy/index.d.ts.map +1 -0
- package/dist/economy/index.js +11 -0
- package/dist/economy/index.js.map +1 -0
- package/dist/economy/outcome-tracker.d.ts +90 -0
- package/dist/economy/outcome-tracker.d.ts.map +1 -0
- package/dist/economy/outcome-tracker.js +172 -0
- package/dist/economy/outcome-tracker.js.map +1 -0
- package/dist/economy/router.d.ts +97 -0
- package/dist/economy/router.d.ts.map +1 -0
- package/dist/economy/router.js +181 -0
- package/dist/economy/router.js.map +1 -0
- package/dist/economy/tier-policy.d.ts +46 -0
- package/dist/economy/tier-policy.d.ts.map +1 -0
- package/dist/economy/tier-policy.js +76 -0
- package/dist/economy/tier-policy.js.map +1 -0
- package/dist/errors.d.ts +102 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +135 -0
- package/dist/errors.js.map +1 -0
- package/dist/evals/datasets/index.d.ts +27 -0
- package/dist/evals/datasets/index.d.ts.map +1 -0
- package/dist/evals/datasets/index.js +279 -0
- package/dist/evals/datasets/index.js.map +1 -0
- package/dist/evals/harness.d.ts +52 -0
- package/dist/evals/harness.d.ts.map +1 -0
- package/dist/evals/harness.js +108 -0
- package/dist/evals/harness.js.map +1 -0
- package/dist/evals/index.d.ts +5 -0
- package/dist/evals/index.d.ts.map +1 -0
- package/dist/evals/index.js +3 -0
- package/dist/evals/index.js.map +1 -0
- package/dist/factory/agent-factory.d.ts +86 -0
- package/dist/factory/agent-factory.d.ts.map +1 -0
- package/dist/factory/agent-factory.js +119 -0
- package/dist/factory/agent-factory.js.map +1 -0
- package/dist/hitl/api.d.ts +38 -0
- package/dist/hitl/api.d.ts.map +1 -0
- package/dist/hitl/api.js +58 -0
- package/dist/hitl/api.js.map +1 -0
- package/dist/hitl/approval-channel.d.ts +84 -0
- package/dist/hitl/approval-channel.d.ts.map +1 -0
- package/dist/hitl/approval-channel.js +59 -0
- package/dist/hitl/approval-channel.js.map +1 -0
- package/dist/hitl/callback-handlers.d.ts +21 -0
- package/dist/hitl/callback-handlers.d.ts.map +1 -0
- package/dist/hitl/callback-handlers.js +30 -0
- package/dist/hitl/callback-handlers.js.map +1 -0
- package/dist/hitl/index.d.ts +3 -0
- package/dist/hitl/index.d.ts.map +1 -0
- package/dist/hitl/index.js +2 -0
- package/dist/hitl/index.js.map +1 -0
- package/dist/hitl/slack.d.ts +76 -0
- package/dist/hitl/slack.d.ts.map +1 -0
- package/dist/hitl/slack.js +243 -0
- package/dist/hitl/slack.js.map +1 -0
- package/dist/hitl/telegram.d.ts +74 -0
- package/dist/hitl/telegram.d.ts.map +1 -0
- package/dist/hitl/telegram.js +227 -0
- package/dist/hitl/telegram.js.map +1 -0
- package/dist/index.d.ts +173 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/parse-structured-output.d.ts +55 -0
- package/dist/llm/parse-structured-output.d.ts.map +1 -0
- package/dist/llm/parse-structured-output.js +80 -0
- package/dist/llm/parse-structured-output.js.map +1 -0
- package/dist/loop/index.d.ts +7 -0
- package/dist/loop/index.d.ts.map +1 -0
- package/dist/loop/index.js +5 -0
- package/dist/loop/index.js.map +1 -0
- package/dist/loop/minimal-loop.d.ts +81 -0
- package/dist/loop/minimal-loop.d.ts.map +1 -0
- package/dist/loop/minimal-loop.js +318 -0
- package/dist/loop/minimal-loop.js.map +1 -0
- package/dist/loop/sdk-loop.d.ts +103 -0
- package/dist/loop/sdk-loop.d.ts.map +1 -0
- package/dist/loop/sdk-loop.js +344 -0
- package/dist/loop/sdk-loop.js.map +1 -0
- package/dist/mcp/index.d.ts +38 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +113 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/metrics/create-agent-metrics.d.ts +78 -0
- package/dist/metrics/create-agent-metrics.d.ts.map +1 -0
- package/dist/metrics/create-agent-metrics.js +115 -0
- package/dist/metrics/create-agent-metrics.js.map +1 -0
- package/dist/orchestration/bulkhead.d.ts +70 -0
- package/dist/orchestration/bulkhead.d.ts.map +1 -0
- package/dist/orchestration/bulkhead.js +99 -0
- package/dist/orchestration/bulkhead.js.map +1 -0
- package/dist/orchestration/idempotency.d.ts +52 -0
- package/dist/orchestration/idempotency.d.ts.map +1 -0
- package/dist/orchestration/idempotency.js +93 -0
- package/dist/orchestration/idempotency.js.map +1 -0
- package/dist/orchestration/index.d.ts +16 -0
- package/dist/orchestration/index.d.ts.map +1 -0
- package/dist/orchestration/index.js +15 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/orchestration/ooda/agent-config-loader.d.ts +67 -0
- package/dist/orchestration/ooda/agent-config-loader.d.ts.map +1 -0
- package/dist/orchestration/ooda/agent-config-loader.js +65 -0
- package/dist/orchestration/ooda/agent-config-loader.js.map +1 -0
- package/dist/orchestration/ooda/agent.d.ts +54 -0
- package/dist/orchestration/ooda/agent.d.ts.map +1 -0
- package/dist/orchestration/ooda/agent.js +730 -0
- package/dist/orchestration/ooda/agent.js.map +1 -0
- package/dist/orchestration/ooda/audit-log.d.ts +26 -0
- package/dist/orchestration/ooda/audit-log.d.ts.map +1 -0
- package/dist/orchestration/ooda/audit-log.js +41 -0
- package/dist/orchestration/ooda/audit-log.js.map +1 -0
- package/dist/orchestration/ooda/brain-context.d.ts +121 -0
- package/dist/orchestration/ooda/brain-context.d.ts.map +1 -0
- package/dist/orchestration/ooda/brain-context.js +149 -0
- package/dist/orchestration/ooda/brain-context.js.map +1 -0
- package/dist/orchestration/ooda/child-agent.d.ts +55 -0
- package/dist/orchestration/ooda/child-agent.d.ts.map +1 -0
- package/dist/orchestration/ooda/child-agent.js +16 -0
- package/dist/orchestration/ooda/child-agent.js.map +1 -0
- package/dist/orchestration/ooda/cron-schedule.d.ts +26 -0
- package/dist/orchestration/ooda/cron-schedule.d.ts.map +1 -0
- package/dist/orchestration/ooda/cron-schedule.js +94 -0
- package/dist/orchestration/ooda/cron-schedule.js.map +1 -0
- package/dist/orchestration/ooda/debate.d.ts +68 -0
- package/dist/orchestration/ooda/debate.d.ts.map +1 -0
- package/dist/orchestration/ooda/debate.js +39 -0
- package/dist/orchestration/ooda/debate.js.map +1 -0
- package/dist/orchestration/ooda/economic-observer.d.ts +50 -0
- package/dist/orchestration/ooda/economic-observer.d.ts.map +1 -0
- package/dist/orchestration/ooda/economic-observer.js +36 -0
- package/dist/orchestration/ooda/economic-observer.js.map +1 -0
- package/dist/orchestration/ooda/errors.d.ts +21 -0
- package/dist/orchestration/ooda/errors.d.ts.map +1 -0
- package/dist/orchestration/ooda/errors.js +30 -0
- package/dist/orchestration/ooda/errors.js.map +1 -0
- package/dist/orchestration/ooda/execution-mode-guard.d.ts +24 -0
- package/dist/orchestration/ooda/execution-mode-guard.d.ts.map +1 -0
- package/dist/orchestration/ooda/execution-mode-guard.js +31 -0
- package/dist/orchestration/ooda/execution-mode-guard.js.map +1 -0
- package/dist/orchestration/ooda/factory.d.ts +12 -0
- package/dist/orchestration/ooda/factory.d.ts.map +1 -0
- package/dist/orchestration/ooda/factory.js +27 -0
- package/dist/orchestration/ooda/factory.js.map +1 -0
- package/dist/orchestration/ooda/guardrails.d.ts +65 -0
- package/dist/orchestration/ooda/guardrails.d.ts.map +1 -0
- package/dist/orchestration/ooda/guardrails.js +127 -0
- package/dist/orchestration/ooda/guardrails.js.map +1 -0
- package/dist/orchestration/ooda/guards/always-on.d.ts +15 -0
- package/dist/orchestration/ooda/guards/always-on.d.ts.map +1 -0
- package/dist/orchestration/ooda/guards/always-on.js +19 -0
- package/dist/orchestration/ooda/guards/always-on.js.map +1 -0
- package/dist/orchestration/ooda/guards/business-hours.d.ts +46 -0
- package/dist/orchestration/ooda/guards/business-hours.d.ts.map +1 -0
- package/dist/orchestration/ooda/guards/business-hours.js +78 -0
- package/dist/orchestration/ooda/guards/business-hours.js.map +1 -0
- package/dist/orchestration/ooda/guards/index.d.ts +14 -0
- package/dist/orchestration/ooda/guards/index.d.ts.map +1 -0
- package/dist/orchestration/ooda/guards/index.js +14 -0
- package/dist/orchestration/ooda/guards/index.js.map +1 -0
- package/dist/orchestration/ooda/guards/redis-circuit-breaker.d.ts +84 -0
- package/dist/orchestration/ooda/guards/redis-circuit-breaker.d.ts.map +1 -0
- package/dist/orchestration/ooda/guards/redis-circuit-breaker.js +96 -0
- package/dist/orchestration/ooda/guards/redis-circuit-breaker.js.map +1 -0
- package/dist/orchestration/ooda/guards/rth-session.d.ts +27 -0
- package/dist/orchestration/ooda/guards/rth-session.d.ts.map +1 -0
- package/dist/orchestration/ooda/guards/rth-session.js +95 -0
- package/dist/orchestration/ooda/guards/rth-session.js.map +1 -0
- package/dist/orchestration/ooda/handoff.d.ts +82 -0
- package/dist/orchestration/ooda/handoff.d.ts.map +1 -0
- package/dist/orchestration/ooda/handoff.js +86 -0
- package/dist/orchestration/ooda/handoff.js.map +1 -0
- package/dist/orchestration/ooda/hitl-gate.d.ts +57 -0
- package/dist/orchestration/ooda/hitl-gate.d.ts.map +1 -0
- package/dist/orchestration/ooda/hitl-gate.js +107 -0
- package/dist/orchestration/ooda/hitl-gate.js.map +1 -0
- package/dist/orchestration/ooda/index.d.ts +48 -0
- package/dist/orchestration/ooda/index.d.ts.map +1 -0
- package/dist/orchestration/ooda/index.js +33 -0
- package/dist/orchestration/ooda/index.js.map +1 -0
- package/dist/orchestration/ooda/inner-monologue.d.ts +69 -0
- package/dist/orchestration/ooda/inner-monologue.d.ts.map +1 -0
- package/dist/orchestration/ooda/inner-monologue.js +69 -0
- package/dist/orchestration/ooda/inner-monologue.js.map +1 -0
- package/dist/orchestration/ooda/learn.d.ts +60 -0
- package/dist/orchestration/ooda/learn.d.ts.map +1 -0
- package/dist/orchestration/ooda/learn.js +94 -0
- package/dist/orchestration/ooda/learn.js.map +1 -0
- package/dist/orchestration/ooda/multimodal.d.ts +91 -0
- package/dist/orchestration/ooda/multimodal.d.ts.map +1 -0
- package/dist/orchestration/ooda/multimodal.js +88 -0
- package/dist/orchestration/ooda/multimodal.js.map +1 -0
- package/dist/orchestration/ooda/phase-routing.d.ts +41 -0
- package/dist/orchestration/ooda/phase-routing.d.ts.map +1 -0
- package/dist/orchestration/ooda/phase-routing.js +43 -0
- package/dist/orchestration/ooda/phase-routing.js.map +1 -0
- package/dist/orchestration/ooda/plan-execute.d.ts +55 -0
- package/dist/orchestration/ooda/plan-execute.d.ts.map +1 -0
- package/dist/orchestration/ooda/plan-execute.js +41 -0
- package/dist/orchestration/ooda/plan-execute.js.map +1 -0
- package/dist/orchestration/ooda/react-loop.d.ts +96 -0
- package/dist/orchestration/ooda/react-loop.d.ts.map +1 -0
- package/dist/orchestration/ooda/react-loop.js +90 -0
- package/dist/orchestration/ooda/react-loop.js.map +1 -0
- package/dist/orchestration/ooda/reflexion.d.ts +56 -0
- package/dist/orchestration/ooda/reflexion.d.ts.map +1 -0
- package/dist/orchestration/ooda/reflexion.js +58 -0
- package/dist/orchestration/ooda/reflexion.js.map +1 -0
- package/dist/orchestration/ooda/resource-limits.d.ts +63 -0
- package/dist/orchestration/ooda/resource-limits.d.ts.map +1 -0
- package/dist/orchestration/ooda/resource-limits.js +107 -0
- package/dist/orchestration/ooda/resource-limits.js.map +1 -0
- package/dist/orchestration/ooda/run-step-persistence.d.ts +50 -0
- package/dist/orchestration/ooda/run-step-persistence.d.ts.map +1 -0
- package/dist/orchestration/ooda/run-step-persistence.js +89 -0
- package/dist/orchestration/ooda/run-step-persistence.js.map +1 -0
- package/dist/orchestration/ooda/skills.d.ts +58 -0
- package/dist/orchestration/ooda/skills.d.ts.map +1 -0
- package/dist/orchestration/ooda/skills.js +19 -0
- package/dist/orchestration/ooda/skills.js.map +1 -0
- package/dist/orchestration/ooda/structured-output.d.ts +46 -0
- package/dist/orchestration/ooda/structured-output.d.ts.map +1 -0
- package/dist/orchestration/ooda/structured-output.js +60 -0
- package/dist/orchestration/ooda/structured-output.js.map +1 -0
- package/dist/orchestration/ooda/types.d.ts +463 -0
- package/dist/orchestration/ooda/types.d.ts.map +1 -0
- package/dist/orchestration/ooda/types.js +38 -0
- package/dist/orchestration/ooda/types.js.map +1 -0
- package/dist/otel/attributes.d.ts +71 -0
- package/dist/otel/attributes.d.ts.map +1 -0
- package/dist/otel/attributes.js +56 -0
- package/dist/otel/attributes.js.map +1 -0
- package/dist/otel/index.d.ts +5 -0
- package/dist/otel/index.d.ts.map +1 -0
- package/dist/otel/index.js +5 -0
- package/dist/otel/index.js.map +1 -0
- package/dist/otel/ingest.d.ts +99 -0
- package/dist/otel/ingest.d.ts.map +1 -0
- package/dist/otel/ingest.js +192 -0
- package/dist/otel/ingest.js.map +1 -0
- package/dist/otel/trace-context.d.ts +48 -0
- package/dist/otel/trace-context.d.ts.map +1 -0
- package/dist/otel/trace-context.js +137 -0
- package/dist/otel/trace-context.js.map +1 -0
- package/dist/otel/types.d.ts +54 -0
- package/dist/otel/types.d.ts.map +1 -0
- package/dist/otel/types.js +12 -0
- package/dist/otel/types.js.map +1 -0
- package/dist/outcomes/client.d.ts +81 -0
- package/dist/outcomes/client.d.ts.map +1 -0
- package/dist/outcomes/client.js +98 -0
- package/dist/outcomes/client.js.map +1 -0
- package/dist/outcomes/compute-roi.d.ts +40 -0
- package/dist/outcomes/compute-roi.d.ts.map +1 -0
- package/dist/outcomes/compute-roi.js +58 -0
- package/dist/outcomes/compute-roi.js.map +1 -0
- package/dist/outcomes/index.d.ts +4 -0
- package/dist/outcomes/index.d.ts.map +1 -0
- package/dist/outcomes/index.js +4 -0
- package/dist/outcomes/index.js.map +1 -0
- package/dist/outcomes/meter.d.ts +73 -0
- package/dist/outcomes/meter.d.ts.map +1 -0
- package/dist/outcomes/meter.js +140 -0
- package/dist/outcomes/meter.js.map +1 -0
- package/dist/outcomes/trajectory.d.ts +53 -0
- package/dist/outcomes/trajectory.d.ts.map +1 -0
- package/dist/outcomes/trajectory.js +110 -0
- package/dist/outcomes/trajectory.js.map +1 -0
- package/dist/outcomes/types.d.ts +93 -0
- package/dist/outcomes/types.d.ts.map +1 -0
- package/dist/outcomes/types.js +8 -0
- package/dist/outcomes/types.js.map +1 -0
- package/dist/patterns/_shared/brain-logger.d.ts +12 -0
- package/dist/patterns/_shared/brain-logger.d.ts.map +1 -0
- package/dist/patterns/_shared/brain-logger.js +6 -0
- package/dist/patterns/_shared/brain-logger.js.map +1 -0
- package/dist/patterns/circuit-breaker/index.d.ts +3 -0
- package/dist/patterns/circuit-breaker/index.d.ts.map +1 -0
- package/dist/patterns/circuit-breaker/index.js +2 -0
- package/dist/patterns/circuit-breaker/index.js.map +1 -0
- package/dist/patterns/circuit-breaker/session-cb.d.ts +3 -0
- package/dist/patterns/circuit-breaker/session-cb.d.ts.map +1 -0
- package/dist/patterns/circuit-breaker/session-cb.js +175 -0
- package/dist/patterns/circuit-breaker/session-cb.js.map +1 -0
- package/dist/patterns/circuit-breaker/types.d.ts +68 -0
- package/dist/patterns/circuit-breaker/types.d.ts.map +1 -0
- package/dist/patterns/circuit-breaker/types.js +2 -0
- package/dist/patterns/circuit-breaker/types.js.map +1 -0
- package/dist/patterns/escalation/index.d.ts +3 -0
- package/dist/patterns/escalation/index.d.ts.map +1 -0
- package/dist/patterns/escalation/index.js +2 -0
- package/dist/patterns/escalation/index.js.map +1 -0
- package/dist/patterns/escalation/pyramid.d.ts +3 -0
- package/dist/patterns/escalation/pyramid.d.ts.map +1 -0
- package/dist/patterns/escalation/pyramid.js +86 -0
- package/dist/patterns/escalation/pyramid.js.map +1 -0
- package/dist/patterns/escalation/types.d.ts +46 -0
- package/dist/patterns/escalation/types.d.ts.map +1 -0
- package/dist/patterns/escalation/types.js +2 -0
- package/dist/patterns/escalation/types.js.map +1 -0
- package/dist/patterns/quality-gate/gate.d.ts +3 -0
- package/dist/patterns/quality-gate/gate.d.ts.map +1 -0
- package/dist/patterns/quality-gate/gate.js +73 -0
- package/dist/patterns/quality-gate/gate.js.map +1 -0
- package/dist/patterns/quality-gate/index.d.ts +3 -0
- package/dist/patterns/quality-gate/index.d.ts.map +1 -0
- package/dist/patterns/quality-gate/index.js +2 -0
- package/dist/patterns/quality-gate/index.js.map +1 -0
- package/dist/patterns/quality-gate/types.d.ts +41 -0
- package/dist/patterns/quality-gate/types.d.ts.map +1 -0
- package/dist/patterns/quality-gate/types.js +2 -0
- package/dist/patterns/quality-gate/types.js.map +1 -0
- package/dist/permissions/capability-gate.d.ts +57 -0
- package/dist/permissions/capability-gate.d.ts.map +1 -0
- package/dist/permissions/capability-gate.js +26 -0
- package/dist/permissions/capability-gate.js.map +1 -0
- package/dist/permissions/index.d.ts +3 -0
- package/dist/permissions/index.d.ts.map +1 -0
- package/dist/permissions/index.js +2 -0
- package/dist/permissions/index.js.map +1 -0
- package/dist/permissions/renewal-manager.d.ts +49 -0
- package/dist/permissions/renewal-manager.d.ts.map +1 -0
- package/dist/permissions/renewal-manager.js +60 -0
- package/dist/permissions/renewal-manager.js.map +1 -0
- package/dist/permissions/sdk-permissions.d.ts +48 -0
- package/dist/permissions/sdk-permissions.d.ts.map +1 -0
- package/dist/permissions/sdk-permissions.js +94 -0
- package/dist/permissions/sdk-permissions.js.map +1 -0
- package/dist/ports/agent-registry.d.ts +95 -0
- package/dist/ports/agent-registry.d.ts.map +1 -0
- package/dist/ports/agent-registry.js +16 -0
- package/dist/ports/agent-registry.js.map +1 -0
- package/dist/ports/brain.d.ts +147 -0
- package/dist/ports/brain.d.ts.map +1 -0
- package/dist/ports/brain.js +105 -0
- package/dist/ports/brain.js.map +1 -0
- package/dist/ports/db.d.ts +8 -0
- package/dist/ports/db.d.ts.map +1 -0
- package/dist/ports/db.js +2 -0
- package/dist/ports/db.js.map +1 -0
- package/dist/ports/event-bus.d.ts +167 -0
- package/dist/ports/event-bus.d.ts.map +1 -0
- package/dist/ports/event-bus.js +25 -0
- package/dist/ports/event-bus.js.map +1 -0
- package/dist/ports/eviction-policy.d.ts +92 -0
- package/dist/ports/eviction-policy.d.ts.map +1 -0
- package/dist/ports/eviction-policy.js +120 -0
- package/dist/ports/eviction-policy.js.map +1 -0
- package/dist/ports/hitl.contract.test.d.ts +9 -0
- package/dist/ports/hitl.contract.test.d.ts.map +1 -0
- package/dist/ports/hitl.contract.test.js +100 -0
- package/dist/ports/hitl.contract.test.js.map +1 -0
- package/dist/ports/hitl.d.ts +91 -0
- package/dist/ports/hitl.d.ts.map +1 -0
- package/dist/ports/hitl.js +76 -0
- package/dist/ports/hitl.js.map +1 -0
- package/dist/ports/index.d.ts +19 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +4 -0
- package/dist/ports/index.js.map +1 -0
- package/dist/ports/key-provider.d.ts +113 -0
- package/dist/ports/key-provider.d.ts.map +1 -0
- package/dist/ports/key-provider.js +119 -0
- package/dist/ports/key-provider.js.map +1 -0
- package/dist/ports/llm-provider.contract.d.ts +24 -0
- package/dist/ports/llm-provider.contract.d.ts.map +1 -0
- package/dist/ports/llm-provider.contract.js +111 -0
- package/dist/ports/llm-provider.contract.js.map +1 -0
- package/dist/ports/llm-provider.d.ts +63 -0
- package/dist/ports/llm-provider.d.ts.map +1 -0
- package/dist/ports/llm-provider.js +13 -0
- package/dist/ports/llm-provider.js.map +1 -0
- package/dist/ports/logger.d.ts +18 -0
- package/dist/ports/logger.d.ts.map +1 -0
- package/dist/ports/logger.js +10 -0
- package/dist/ports/logger.js.map +1 -0
- package/dist/ports/messaging.contract.test.d.ts +22 -0
- package/dist/ports/messaging.contract.test.d.ts.map +1 -0
- package/dist/ports/messaging.contract.test.js +296 -0
- package/dist/ports/messaging.contract.test.js.map +1 -0
- package/dist/ports/messaging.d.ts +47 -0
- package/dist/ports/messaging.d.ts.map +1 -0
- package/dist/ports/messaging.js +24 -0
- package/dist/ports/messaging.js.map +1 -0
- package/dist/ports/outcome.d.ts +25 -0
- package/dist/ports/outcome.d.ts.map +1 -0
- package/dist/ports/outcome.js +9 -0
- package/dist/ports/outcome.js.map +1 -0
- package/dist/ports/timestamp.d.ts +53 -0
- package/dist/ports/timestamp.d.ts.map +1 -0
- package/dist/ports/timestamp.js +28 -0
- package/dist/ports/timestamp.js.map +1 -0
- package/dist/privacy/channel.d.ts +137 -0
- package/dist/privacy/channel.d.ts.map +1 -0
- package/dist/privacy/channel.js +196 -0
- package/dist/privacy/channel.js.map +1 -0
- package/dist/privacy/composition.d.ts +140 -0
- package/dist/privacy/composition.d.ts.map +1 -0
- package/dist/privacy/composition.js +182 -0
- package/dist/privacy/composition.js.map +1 -0
- package/dist/privacy/delegation.d.ts +87 -0
- package/dist/privacy/delegation.d.ts.map +1 -0
- package/dist/privacy/delegation.js +67 -0
- package/dist/privacy/delegation.js.map +1 -0
- package/dist/privacy/index.d.ts +25 -0
- package/dist/privacy/index.d.ts.map +1 -0
- package/dist/privacy/index.js +21 -0
- package/dist/privacy/index.js.map +1 -0
- package/dist/privacy/nullifier.d.ts +59 -0
- package/dist/privacy/nullifier.d.ts.map +1 -0
- package/dist/privacy/nullifier.js +70 -0
- package/dist/privacy/nullifier.js.map +1 -0
- package/dist/privacy/poseidon-felt252.d.ts +35 -0
- package/dist/privacy/poseidon-felt252.d.ts.map +1 -0
- package/dist/privacy/poseidon-felt252.js +93 -0
- package/dist/privacy/poseidon-felt252.js.map +1 -0
- package/dist/privacy/uar.d.ts +170 -0
- package/dist/privacy/uar.d.ts.map +1 -0
- package/dist/privacy/uar.js +150 -0
- package/dist/privacy/uar.js.map +1 -0
- package/dist/prompts/build-orient-prompt.d.ts +41 -0
- package/dist/prompts/build-orient-prompt.d.ts.map +1 -0
- package/dist/prompts/build-orient-prompt.js +40 -0
- package/dist/prompts/build-orient-prompt.js.map +1 -0
- package/dist/proof/chain.d.ts +90 -0
- package/dist/proof/chain.d.ts.map +1 -0
- package/dist/proof/chain.js +177 -0
- package/dist/proof/chain.js.map +1 -0
- package/dist/proof/fallback-adapter.d.ts +50 -0
- package/dist/proof/fallback-adapter.d.ts.map +1 -0
- package/dist/proof/fallback-adapter.js +99 -0
- package/dist/proof/fallback-adapter.js.map +1 -0
- package/dist/proof/index.d.ts +35 -0
- package/dist/proof/index.d.ts.map +1 -0
- package/dist/proof/index.js +161 -0
- package/dist/proof/index.js.map +1 -0
- package/dist/proof/load.d.ts +27 -0
- package/dist/proof/load.d.ts.map +1 -0
- package/dist/proof/load.js +44 -0
- package/dist/proof/load.js.map +1 -0
- package/dist/proof/otel.d.ts +25 -0
- package/dist/proof/otel.d.ts.map +1 -0
- package/dist/proof/otel.js +57 -0
- package/dist/proof/otel.js.map +1 -0
- package/dist/proof/receipt-queue.d.ts +97 -0
- package/dist/proof/receipt-queue.d.ts.map +1 -0
- package/dist/proof/receipt-queue.js +131 -0
- package/dist/proof/receipt-queue.js.map +1 -0
- package/dist/proof/sha256.d.ts +27 -0
- package/dist/proof/sha256.d.ts.map +1 -0
- package/dist/proof/sha256.js +65 -0
- package/dist/proof/sha256.js.map +1 -0
- package/dist/proof/types.d.ts +55 -0
- package/dist/proof/types.d.ts.map +1 -0
- package/dist/proof/types.js +10 -0
- package/dist/proof/types.js.map +1 -0
- package/dist/proof/verify.d.ts +28 -0
- package/dist/proof/verify.d.ts.map +1 -0
- package/dist/proof/verify.js +70 -0
- package/dist/proof/verify.js.map +1 -0
- package/dist/registry/agent-capability.d.ts +29 -0
- package/dist/registry/agent-capability.d.ts.map +1 -0
- package/dist/registry/agent-capability.js +21 -0
- package/dist/registry/agent-capability.js.map +1 -0
- package/dist/registry/agent-card.d.ts +86 -0
- package/dist/registry/agent-card.d.ts.map +1 -0
- package/dist/registry/agent-card.js +80 -0
- package/dist/registry/agent-card.js.map +1 -0
- package/dist/registry/agent-ids.d.ts +30 -0
- package/dist/registry/agent-ids.d.ts.map +1 -0
- package/dist/registry/agent-ids.js +46 -0
- package/dist/registry/agent-ids.js.map +1 -0
- package/dist/registry/agent-registry.d.ts +104 -0
- package/dist/registry/agent-registry.d.ts.map +1 -0
- package/dist/registry/agent-registry.js +277 -0
- package/dist/registry/agent-registry.js.map +1 -0
- package/dist/registry/index.d.ts +7 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +4 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/replay/clock.d.ts +69 -0
- package/dist/replay/clock.d.ts.map +1 -0
- package/dist/replay/clock.js +84 -0
- package/dist/replay/clock.js.map +1 -0
- package/dist/replay/cross-cycle.d.ts +143 -0
- package/dist/replay/cross-cycle.d.ts.map +1 -0
- package/dist/replay/cross-cycle.js +271 -0
- package/dist/replay/cross-cycle.js.map +1 -0
- package/dist/replay/http-vcr.d.ts +46 -0
- package/dist/replay/http-vcr.d.ts.map +1 -0
- package/dist/replay/http-vcr.js +87 -0
- package/dist/replay/http-vcr.js.map +1 -0
- package/dist/replay/index.d.ts +18 -0
- package/dist/replay/index.d.ts.map +1 -0
- package/dist/replay/index.js +18 -0
- package/dist/replay/index.js.map +1 -0
- package/dist/replay/llm-cache.d.ts +126 -0
- package/dist/replay/llm-cache.d.ts.map +1 -0
- package/dist/replay/llm-cache.js +114 -0
- package/dist/replay/llm-cache.js.map +1 -0
- package/dist/replay/random.d.ts +114 -0
- package/dist/replay/random.d.ts.map +1 -0
- package/dist/replay/random.js +183 -0
- package/dist/replay/random.js.map +1 -0
- package/dist/replay/replay.d.ts +160 -0
- package/dist/replay/replay.d.ts.map +1 -0
- package/dist/replay/replay.js +115 -0
- package/dist/replay/replay.js.map +1 -0
- package/dist/resilience/bulkhead.d.ts +37 -0
- package/dist/resilience/bulkhead.d.ts.map +1 -0
- package/dist/resilience/bulkhead.js +65 -0
- package/dist/resilience/bulkhead.js.map +1 -0
- package/dist/resilience/circuit-breaker.d.ts +56 -0
- package/dist/resilience/circuit-breaker.d.ts.map +1 -0
- package/dist/resilience/circuit-breaker.js +93 -0
- package/dist/resilience/circuit-breaker.js.map +1 -0
- package/dist/resilience/idempotent.d.ts +61 -0
- package/dist/resilience/idempotent.d.ts.map +1 -0
- package/dist/resilience/idempotent.js +103 -0
- package/dist/resilience/idempotent.js.map +1 -0
- package/dist/resilience/index.d.ts +28 -0
- package/dist/resilience/index.d.ts.map +1 -0
- package/dist/resilience/index.js +25 -0
- package/dist/resilience/index.js.map +1 -0
- package/dist/router/index.d.ts +3 -0
- package/dist/router/index.d.ts.map +1 -0
- package/dist/router/index.js +2 -0
- package/dist/router/index.js.map +1 -0
- package/dist/router/provider-router.d.ts +61 -0
- package/dist/router/provider-router.d.ts.map +1 -0
- package/dist/router/provider-router.js +214 -0
- package/dist/router/provider-router.js.map +1 -0
- package/dist/runs/health.d.ts +24 -0
- package/dist/runs/health.d.ts.map +1 -0
- package/dist/runs/health.js +52 -0
- package/dist/runs/health.js.map +1 -0
- package/dist/runs/index.d.ts +4 -0
- package/dist/runs/index.d.ts.map +1 -0
- package/dist/runs/index.js +4 -0
- package/dist/runs/index.js.map +1 -0
- package/dist/runs/subscribe.d.ts +34 -0
- package/dist/runs/subscribe.d.ts.map +1 -0
- package/dist/runs/subscribe.js +228 -0
- package/dist/runs/subscribe.js.map +1 -0
- package/dist/runs/types.d.ts +53 -0
- package/dist/runs/types.d.ts.map +1 -0
- package/dist/runs/types.js +11 -0
- package/dist/runs/types.js.map +1 -0
- package/dist/safety/immune.d.ts +62 -0
- package/dist/safety/immune.d.ts.map +1 -0
- package/dist/safety/immune.js +109 -0
- package/dist/safety/immune.js.map +1 -0
- package/dist/safety/index.d.ts +3 -0
- package/dist/safety/index.d.ts.map +1 -0
- package/dist/safety/index.js +2 -0
- package/dist/safety/index.js.map +1 -0
- package/dist/safety/sanitize.d.ts +71 -0
- package/dist/safety/sanitize.d.ts.map +1 -0
- package/dist/safety/sanitize.js +139 -0
- package/dist/safety/sanitize.js.map +1 -0
- package/dist/sdk-permission-mapping.d.ts +41 -0
- package/dist/sdk-permission-mapping.d.ts.map +1 -0
- package/dist/sdk-permission-mapping.js +96 -0
- package/dist/sdk-permission-mapping.js.map +1 -0
- package/dist/skills/_otel.d.ts +2 -0
- package/dist/skills/_otel.d.ts.map +1 -0
- package/dist/skills/_otel.js +29 -0
- package/dist/skills/_otel.js.map +1 -0
- package/dist/skills/alpaca-quote.d.ts +30 -0
- package/dist/skills/alpaca-quote.d.ts.map +1 -0
- package/dist/skills/alpaca-quote.js +70 -0
- package/dist/skills/alpaca-quote.js.map +1 -0
- package/dist/skills/base-skills.d.ts +30 -0
- package/dist/skills/base-skills.d.ts.map +1 -0
- package/dist/skills/base-skills.js +26 -0
- package/dist/skills/base-skills.js.map +1 -0
- package/dist/skills/brain-query.d.ts +34 -0
- package/dist/skills/brain-query.d.ts.map +1 -0
- package/dist/skills/brain-query.js +46 -0
- package/dist/skills/brain-query.js.map +1 -0
- package/dist/skills/brain-store.d.ts +44 -0
- package/dist/skills/brain-store.d.ts.map +1 -0
- package/dist/skills/brain-store.js +55 -0
- package/dist/skills/brain-store.js.map +1 -0
- package/dist/skills/calendar-check.d.ts +37 -0
- package/dist/skills/calendar-check.d.ts.map +1 -0
- package/dist/skills/calendar-check.js +87 -0
- package/dist/skills/calendar-check.js.map +1 -0
- package/dist/skills/cboe-vix-spot.d.ts +24 -0
- package/dist/skills/cboe-vix-spot.d.ts.map +1 -0
- package/dist/skills/cboe-vix-spot.js +70 -0
- package/dist/skills/cboe-vix-spot.js.map +1 -0
- package/dist/skills/errors.d.ts +33 -0
- package/dist/skills/errors.d.ts.map +1 -0
- package/dist/skills/errors.js +50 -0
- package/dist/skills/errors.js.map +1 -0
- package/dist/skills/hitl-request.d.ts +39 -0
- package/dist/skills/hitl-request.d.ts.map +1 -0
- package/dist/skills/hitl-request.js +55 -0
- package/dist/skills/hitl-request.js.map +1 -0
- package/dist/skills/http-fetch.d.ts +32 -0
- package/dist/skills/http-fetch.d.ts.map +1 -0
- package/dist/skills/http-fetch.js +82 -0
- package/dist/skills/http-fetch.js.map +1 -0
- package/dist/skills/index.d.ts +46 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +32 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/record-outcome.d.ts +49 -0
- package/dist/skills/record-outcome.d.ts.map +1 -0
- package/dist/skills/record-outcome.js +104 -0
- package/dist/skills/record-outcome.js.map +1 -0
- package/dist/skills/run-sql-query.d.ts +33 -0
- package/dist/skills/run-sql-query.d.ts.map +1 -0
- package/dist/skills/run-sql-query.js +78 -0
- package/dist/skills/run-sql-query.js.map +1 -0
- package/dist/skills/send-email.d.ts +39 -0
- package/dist/skills/send-email.d.ts.map +1 -0
- package/dist/skills/send-email.js +100 -0
- package/dist/skills/send-email.js.map +1 -0
- package/dist/skills/skill-ledger.d.ts +62 -0
- package/dist/skills/skill-ledger.d.ts.map +1 -0
- package/dist/skills/skill-ledger.js +40 -0
- package/dist/skills/skill-ledger.js.map +1 -0
- package/dist/skills/skill-registry-builder.d.ts +91 -0
- package/dist/skills/skill-registry-builder.d.ts.map +1 -0
- package/dist/skills/skill-registry-builder.js +173 -0
- package/dist/skills/skill-registry-builder.js.map +1 -0
- package/dist/skills/slack-notify.d.ts +43 -0
- package/dist/skills/slack-notify.d.ts.map +1 -0
- package/dist/skills/slack-notify.js +70 -0
- package/dist/skills/slack-notify.js.map +1 -0
- package/dist/skills/starknet-balance.d.ts +34 -0
- package/dist/skills/starknet-balance.d.ts.map +1 -0
- package/dist/skills/starknet-balance.js +91 -0
- package/dist/skills/starknet-balance.js.map +1 -0
- package/dist/skills/telegram-notify.d.ts +44 -0
- package/dist/skills/telegram-notify.d.ts.map +1 -0
- package/dist/skills/telegram-notify.js +71 -0
- package/dist/skills/telegram-notify.js.map +1 -0
- package/dist/skills/web-search.d.ts +32 -0
- package/dist/skills/web-search.d.ts.map +1 -0
- package/dist/skills/web-search.js +84 -0
- package/dist/skills/web-search.js.map +1 -0
- package/dist/templates/complex-agent.d.ts +105 -0
- package/dist/templates/complex-agent.d.ts.map +1 -0
- package/dist/templates/complex-agent.js +94 -0
- package/dist/templates/complex-agent.js.map +1 -0
- package/dist/templates/index.d.ts +17 -0
- package/dist/templates/index.d.ts.map +1 -0
- package/dist/templates/index.js +14 -0
- package/dist/templates/index.js.map +1 -0
- package/dist/templates/reasoning-agent.d.ts +160 -0
- package/dist/templates/reasoning-agent.d.ts.map +1 -0
- package/dist/templates/reasoning-agent.js +119 -0
- package/dist/templates/reasoning-agent.js.map +1 -0
- package/dist/templates/simple-agent.d.ts +108 -0
- package/dist/templates/simple-agent.d.ts.map +1 -0
- package/dist/templates/simple-agent.js +84 -0
- package/dist/templates/simple-agent.js.map +1 -0
- package/dist/testing/brain-conformance.d.ts +45 -0
- package/dist/testing/brain-conformance.d.ts.map +1 -0
- package/dist/testing/brain-conformance.js +68 -0
- package/dist/testing/brain-conformance.js.map +1 -0
- package/dist/testing/chaos.d.ts +126 -0
- package/dist/testing/chaos.d.ts.map +1 -0
- package/dist/testing/chaos.js +176 -0
- package/dist/testing/chaos.js.map +1 -0
- package/dist/testing/contracts/brain-port.contract.d.ts +23 -0
- package/dist/testing/contracts/brain-port.contract.d.ts.map +1 -0
- package/dist/testing/contracts/brain-port.contract.js +79 -0
- package/dist/testing/contracts/brain-port.contract.js.map +1 -0
- package/dist/testing/contracts/economic-observer.contract.d.ts +23 -0
- package/dist/testing/contracts/economic-observer.contract.d.ts.map +1 -0
- package/dist/testing/contracts/economic-observer.contract.js +71 -0
- package/dist/testing/contracts/economic-observer.contract.js.map +1 -0
- package/dist/testing/contracts/event-bus.contract.d.ts +30 -0
- package/dist/testing/contracts/event-bus.contract.d.ts.map +1 -0
- package/dist/testing/contracts/event-bus.contract.js +216 -0
- package/dist/testing/contracts/event-bus.contract.js.map +1 -0
- package/dist/testing/db-conformance.d.ts +22 -0
- package/dist/testing/db-conformance.d.ts.map +1 -0
- package/dist/testing/db-conformance.js +25 -0
- package/dist/testing/db-conformance.js.map +1 -0
- package/dist/testing/eval.d.ts +61 -0
- package/dist/testing/eval.d.ts.map +1 -0
- package/dist/testing/eval.js +98 -0
- package/dist/testing/eval.js.map +1 -0
- package/dist/testing/index.d.ts +32 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +38 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/integration-harness.d.ts +45 -0
- package/dist/testing/integration-harness.d.ts.map +1 -0
- package/dist/testing/integration-harness.js +57 -0
- package/dist/testing/integration-harness.js.map +1 -0
- package/dist/testing/logger-conformance.d.ts +16 -0
- package/dist/testing/logger-conformance.d.ts.map +1 -0
- package/dist/testing/logger-conformance.js +43 -0
- package/dist/testing/logger-conformance.js.map +1 -0
- package/dist/testing/outcome-conformance.d.ts +17 -0
- package/dist/testing/outcome-conformance.d.ts.map +1 -0
- package/dist/testing/outcome-conformance.js +50 -0
- package/dist/testing/outcome-conformance.js.map +1 -0
- package/dist/testing/runner.d.ts +19 -0
- package/dist/testing/runner.d.ts.map +1 -0
- package/dist/testing/runner.js +9 -0
- package/dist/testing/runner.js.map +1 -0
- package/dist/testing/test-brain-port.d.ts +25 -0
- package/dist/testing/test-brain-port.d.ts.map +1 -0
- package/dist/testing/test-brain-port.js +54 -0
- package/dist/testing/test-brain-port.js.map +1 -0
- package/dist/testing/test-child-agent.d.ts +32 -0
- package/dist/testing/test-child-agent.d.ts.map +1 -0
- package/dist/testing/test-child-agent.js +59 -0
- package/dist/testing/test-child-agent.js.map +1 -0
- package/dist/testing/test-event-bus.d.ts +57 -0
- package/dist/testing/test-event-bus.d.ts.map +1 -0
- package/dist/testing/test-event-bus.js +191 -0
- package/dist/testing/test-event-bus.js.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/registry.d.ts +20 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +102 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/types.d.ts +85 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +13 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/zod-to-json-schema.d.ts +11 -0
- package/dist/tools/zod-to-json-schema.d.ts.map +1 -0
- package/dist/tools/zod-to-json-schema.js +92 -0
- package/dist/tools/zod-to-json-schema.js.map +1 -0
- package/dist/trace/canonical.d.ts +37 -0
- package/dist/trace/canonical.d.ts.map +1 -0
- package/dist/trace/canonical.js +139 -0
- package/dist/trace/canonical.js.map +1 -0
- package/dist/trace/policy.d.ts +103 -0
- package/dist/trace/policy.d.ts.map +1 -0
- package/dist/trace/policy.js +137 -0
- package/dist/trace/policy.js.map +1 -0
- package/dist/trace/schema.d.ts +195 -0
- package/dist/trace/schema.d.ts.map +1 -0
- package/dist/trace/schema.js +18 -0
- package/dist/trace/schema.js.map +1 -0
- package/dist/trace/strict-pii-detector.d.ts +28 -0
- package/dist/trace/strict-pii-detector.d.ts.map +1 -0
- package/dist/trace/strict-pii-detector.js +144 -0
- package/dist/trace/strict-pii-detector.js.map +1 -0
- package/dist/tracing/traced-port.d.ts +50 -0
- package/dist/tracing/traced-port.d.ts.map +1 -0
- package/dist/tracing/traced-port.js +108 -0
- package/dist/tracing/traced-port.js.map +1 -0
- package/dist/tracking/agent-run-tracker.d.ts +63 -0
- package/dist/tracking/agent-run-tracker.d.ts.map +1 -0
- package/dist/tracking/agent-run-tracker.js +132 -0
- package/dist/tracking/agent-run-tracker.js.map +1 -0
- package/dist/tracking/gen-ai.d.ts +54 -0
- package/dist/tracking/gen-ai.d.ts.map +1 -0
- package/dist/tracking/gen-ai.js +101 -0
- package/dist/tracking/gen-ai.js.map +1 -0
- package/dist/tracking/index.d.ts +4 -0
- package/dist/tracking/index.d.ts.map +1 -0
- package/dist/tracking/index.js +3 -0
- package/dist/tracking/index.js.map +1 -0
- package/dist/types/agent.d.ts +84 -0
- package/dist/types/agent.d.ts.map +1 -0
- package/dist/types/agent.js +13 -0
- package/dist/types/agent.js.map +1 -0
- package/dist/types/agent.test.d.ts +11 -0
- package/dist/types/agent.test.d.ts.map +1 -0
- package/dist/types/agent.test.js +144 -0
- package/dist/types/agent.test.js.map +1 -0
- package/dist/types/escalation-mapping.d.ts +30 -0
- package/dist/types/escalation-mapping.d.ts.map +1 -0
- package/dist/types/escalation-mapping.js +32 -0
- package/dist/types/escalation-mapping.js.map +1 -0
- package/docs/byom.md +106 -0
- package/docs/contributing.md +139 -0
- package/docs/economy.md +159 -0
- package/docs/getting-started.md +179 -0
- package/docs/index.md +57 -0
- package/docs/migration/0.15-to-0.17.md +227 -0
- package/docs/papers/bon-mav-notes.md +36 -0
- package/docs/patterns.md +138 -0
- package/docs/platforms.md +137 -0
- package/docs/ports/agent-registry.md +100 -0
- package/docs/ports/event-bus.md +131 -0
- package/docs/ports/hitl.md +105 -0
- package/docs/ports/llm-provider.md +125 -0
- package/docs/ports/messaging.md +94 -0
- package/docs/templates.md +165 -0
- package/package.json +160 -0
- package/src/adapters/hitl/memory-state-store.ts +96 -0
- package/src/adapters/hitl/postgres-state-store.ts +147 -0
- package/src/adapters/llm/anthropic-direct.ts +212 -0
- package/src/adapters/llm/cascade.ts +109 -0
- package/src/adapters/llm/litellm.ts +300 -0
- package/src/adapters/messaging/console.ts +73 -0
- package/src/adapters/messaging/discord.ts +125 -0
- package/src/adapters/messaging/mcp.ts +84 -0
- package/src/adapters/messaging/slack.ts +109 -0
- package/src/adapters/messaging/telegram.ts +134 -0
- package/src/adapters/registry/memory.ts +84 -0
- package/src/adapters/registry/postgres.ts +166 -0
- package/src/agents/index.ts +2 -0
- package/src/agents/trading.ts +114 -0
- package/src/auth/errors.ts +66 -0
- package/src/auth/nonce-store.ts +79 -0
- package/src/auth/sign-event.ts +51 -0
- package/src/auth/verify-event.ts +112 -0
- package/src/boot/init-sdk.ts +92 -0
- package/src/boot/load-agent-context.ts +164 -0
- package/src/boot/load-recent-memory.ts +92 -0
- package/src/budget/budget-state.ts +234 -0
- package/src/budget/index.ts +11 -0
- package/src/clients/agents.ts +140 -0
- package/src/clients/index.ts +6 -0
- package/src/clients/messaging-adapters.ts +173 -0
- package/src/clients/pipelines.ts +160 -0
- package/src/compute/strategies/best-of-n.ts +162 -0
- package/src/compute/strategies/bon-mav.ts +221 -0
- package/src/compute/strategies/single-shot.ts +45 -0
- package/src/compute/types.ts +36 -0
- package/src/compute/verifier.ts +84 -0
- package/src/compute/with-compute.ts +108 -0
- package/src/constitution/axioms.ts +548 -0
- package/src/constitution/gate.ts +180 -0
- package/src/constitution/index.ts +53 -0
- package/src/constitution/scorer.ts +170 -0
- package/src/constitution/signal.ts +114 -0
- package/src/constitution/types.ts +195 -0
- package/src/counterfactual/index.ts +20 -0
- package/src/counterfactual/replay-with-alt.ts +357 -0
- package/src/dataops/index.ts +4 -0
- package/src/dataops/starkscan.ts +13 -0
- package/src/dataops/voyager.ts +215 -0
- package/src/deprecation.ts +102 -0
- package/src/durable/bullmq-runner.ts +560 -0
- package/src/durable/index.ts +11 -0
- package/src/economy/circuit-breaker.ts +130 -0
- package/src/economy/economy-router.ts +242 -0
- package/src/economy/index.ts +28 -0
- package/src/economy/outcome-tracker.ts +228 -0
- package/src/economy/router.ts +246 -0
- package/src/economy/tier-policy.ts +116 -0
- package/src/errors.ts +159 -0
- package/src/evals/datasets/index.ts +343 -0
- package/src/evals/harness.ts +171 -0
- package/src/evals/index.ts +4 -0
- package/src/factory/agent-factory.ts +261 -0
- package/src/hitl/api.ts +78 -0
- package/src/hitl/approval-channel.ts +128 -0
- package/src/hitl/callback-handlers.ts +61 -0
- package/src/hitl/index.ts +9 -0
- package/src/hitl/slack.ts +358 -0
- package/src/hitl/telegram.ts +342 -0
- package/src/index.ts +710 -0
- package/src/llm/parse-structured-output.ts +116 -0
- package/src/loop/index.ts +26 -0
- package/src/loop/minimal-loop.ts +448 -0
- package/src/loop/sdk-loop.ts +505 -0
- package/src/mcp/index.ts +146 -0
- package/src/metrics/create-agent-metrics.ts +231 -0
- package/src/orchestration/bulkhead.ts +145 -0
- package/src/orchestration/idempotency.ts +137 -0
- package/src/orchestration/index.ts +24 -0
- package/src/orchestration/ooda/agent-config-loader.ts +118 -0
- package/src/orchestration/ooda/agent.ts +1009 -0
- package/src/orchestration/ooda/audit-log.ts +57 -0
- package/src/orchestration/ooda/brain-context.ts +269 -0
- package/src/orchestration/ooda/child-agent.ts +60 -0
- package/src/orchestration/ooda/cron-schedule.ts +115 -0
- package/src/orchestration/ooda/debate.ts +100 -0
- package/src/orchestration/ooda/economic-observer.ts +77 -0
- package/src/orchestration/ooda/errors.ts +32 -0
- package/src/orchestration/ooda/execution-mode-guard.ts +37 -0
- package/src/orchestration/ooda/factory.ts +48 -0
- package/src/orchestration/ooda/guardrails.ts +172 -0
- package/src/orchestration/ooda/guards/always-on.ts +21 -0
- package/src/orchestration/ooda/guards/business-hours.ts +134 -0
- package/src/orchestration/ooda/guards/cme-holidays-2026.json +1 -0
- package/src/orchestration/ooda/guards/index.ts +27 -0
- package/src/orchestration/ooda/guards/redis-circuit-breaker.ts +172 -0
- package/src/orchestration/ooda/guards/rth-session.ts +133 -0
- package/src/orchestration/ooda/handoff.ts +150 -0
- package/src/orchestration/ooda/hitl-gate.ts +166 -0
- package/src/orchestration/ooda/index.ts +163 -0
- package/src/orchestration/ooda/inner-monologue.ts +99 -0
- package/src/orchestration/ooda/learn.ts +146 -0
- package/src/orchestration/ooda/multimodal.ts +174 -0
- package/src/orchestration/ooda/phase-routing.ts +74 -0
- package/src/orchestration/ooda/plan-execute.ts +87 -0
- package/src/orchestration/ooda/react-loop.ts +192 -0
- package/src/orchestration/ooda/reflexion.ts +98 -0
- package/src/orchestration/ooda/resource-limits.ts +123 -0
- package/src/orchestration/ooda/run-step-persistence.ts +137 -0
- package/src/orchestration/ooda/skills.ts +60 -0
- package/src/orchestration/ooda/structured-output.ts +93 -0
- package/src/orchestration/ooda/types.ts +508 -0
- package/src/otel/attributes.ts +104 -0
- package/src/otel/index.ts +4 -0
- package/src/otel/ingest.ts +294 -0
- package/src/otel/trace-context.ts +197 -0
- package/src/otel/types.ts +49 -0
- package/src/outcomes/client.ts +194 -0
- package/src/outcomes/compute-roi.ts +89 -0
- package/src/outcomes/index.ts +3 -0
- package/src/outcomes/meter.ts +217 -0
- package/src/outcomes/trajectory.ts +170 -0
- package/src/outcomes/types.ts +88 -0
- package/src/patterns/_shared/brain-logger.ts +18 -0
- package/src/patterns/circuit-breaker/index.ts +8 -0
- package/src/patterns/circuit-breaker/session-cb.ts +198 -0
- package/src/patterns/circuit-breaker/types.ts +72 -0
- package/src/patterns/escalation/index.ts +8 -0
- package/src/patterns/escalation/pyramid.ts +125 -0
- package/src/patterns/escalation/types.ts +62 -0
- package/src/patterns/quality-gate/gate.ts +102 -0
- package/src/patterns/quality-gate/index.ts +8 -0
- package/src/patterns/quality-gate/types.ts +45 -0
- package/src/permissions/capability-gate.ts +63 -0
- package/src/permissions/index.ts +11 -0
- package/src/permissions/renewal-manager.ts +89 -0
- package/src/permissions/sdk-permissions.ts +124 -0
- package/src/ports/agent-registry.ts +104 -0
- package/src/ports/brain.ts +255 -0
- package/src/ports/db.ts +7 -0
- package/src/ports/event-bus.ts +199 -0
- package/src/ports/eviction-policy.ts +179 -0
- package/src/ports/hitl.contract.test.ts +131 -0
- package/src/ports/hitl.ts +153 -0
- package/src/ports/index.ts +48 -0
- package/src/ports/key-provider.ts +179 -0
- package/src/ports/llm-provider.contract.ts +132 -0
- package/src/ports/llm-provider.ts +68 -0
- package/src/ports/logger.ts +23 -0
- package/src/ports/messaging.contract.test.ts +422 -0
- package/src/ports/messaging.ts +53 -0
- package/src/ports/outcome.ts +26 -0
- package/src/ports/timestamp.ts +64 -0
- package/src/privacy/channel.ts +283 -0
- package/src/privacy/composition.ts +289 -0
- package/src/privacy/delegation.ts +128 -0
- package/src/privacy/index.ts +64 -0
- package/src/privacy/nullifier.ts +79 -0
- package/src/privacy/poseidon-felt252.ts +104 -0
- package/src/privacy/uar.ts +234 -0
- package/src/prompts/build-orient-prompt.ts +78 -0
- package/src/proof/chain.ts +249 -0
- package/src/proof/fallback-adapter.ts +117 -0
- package/src/proof/index.ts +207 -0
- package/src/proof/load.ts +61 -0
- package/src/proof/otel.ts +74 -0
- package/src/proof/receipt-queue.ts +235 -0
- package/src/proof/sha256.ts +80 -0
- package/src/proof/types.ts +58 -0
- package/src/proof/verify.ts +89 -0
- package/src/registry/agent-capability.ts +48 -0
- package/src/registry/agent-card.ts +162 -0
- package/src/registry/agent-ids.ts +56 -0
- package/src/registry/agent-registry.ts +378 -0
- package/src/registry/index.ts +23 -0
- package/src/replay/clock.ts +104 -0
- package/src/replay/cross-cycle.ts +406 -0
- package/src/replay/http-vcr.ts +123 -0
- package/src/replay/index.ts +62 -0
- package/src/replay/llm-cache.ts +199 -0
- package/src/replay/random.ts +249 -0
- package/src/replay/replay.ts +271 -0
- package/src/resilience/bulkhead.ts +95 -0
- package/src/resilience/circuit-breaker.ts +129 -0
- package/src/resilience/idempotent.ts +126 -0
- package/src/resilience/index.ts +51 -0
- package/src/router/index.ts +11 -0
- package/src/router/provider-router.ts +319 -0
- package/src/runs/health.ts +84 -0
- package/src/runs/index.ts +3 -0
- package/src/runs/subscribe.ts +263 -0
- package/src/runs/types.ts +63 -0
- package/src/safety/immune.ts +145 -0
- package/src/safety/index.ts +6 -0
- package/src/safety/sanitize.ts +183 -0
- package/src/sdk-permission-mapping.ts +123 -0
- package/src/skills/_otel.ts +31 -0
- package/src/skills/alpaca-quote.ts +82 -0
- package/src/skills/base-skills.ts +38 -0
- package/src/skills/brain-query.ts +62 -0
- package/src/skills/brain-store.ts +69 -0
- package/src/skills/calendar-check.ts +111 -0
- package/src/skills/cboe-vix-spot.ts +89 -0
- package/src/skills/errors.ts +59 -0
- package/src/skills/hitl-request.ts +68 -0
- package/src/skills/http-fetch.ts +92 -0
- package/src/skills/index.ts +71 -0
- package/src/skills/record-outcome.ts +125 -0
- package/src/skills/run-sql-query.ts +87 -0
- package/src/skills/send-email.ts +111 -0
- package/src/skills/skill-ledger.ts +92 -0
- package/src/skills/skill-registry-builder.ts +264 -0
- package/src/skills/slack-notify.ts +90 -0
- package/src/skills/starknet-balance.ts +106 -0
- package/src/skills/telegram-notify.ts +88 -0
- package/src/skills/web-search.ts +108 -0
- package/src/templates/complex-agent.ts +187 -0
- package/src/templates/index.ts +27 -0
- package/src/templates/reasoning-agent.ts +251 -0
- package/src/templates/simple-agent.ts +173 -0
- package/src/testing/brain-conformance.ts +105 -0
- package/src/testing/chaos.ts +266 -0
- package/src/testing/contracts/brain-port.contract.ts +91 -0
- package/src/testing/contracts/economic-observer.contract.ts +87 -0
- package/src/testing/contracts/event-bus.contract.ts +324 -0
- package/src/testing/db-conformance.ts +43 -0
- package/src/testing/eval.ts +161 -0
- package/src/testing/index.ts +59 -0
- package/src/testing/integration-harness.ts +75 -0
- package/src/testing/logger-conformance.ts +57 -0
- package/src/testing/outcome-conformance.ts +62 -0
- package/src/testing/runner.ts +19 -0
- package/src/testing/test-brain-port.ts +69 -0
- package/src/testing/test-child-agent.ts +70 -0
- package/src/testing/test-event-bus.ts +247 -0
- package/src/tools/index.ts +11 -0
- package/src/tools/registry.ts +122 -0
- package/src/tools/types.ts +114 -0
- package/src/tools/zod-to-json-schema.ts +112 -0
- package/src/trace/canonical.ts +158 -0
- package/src/trace/policy.ts +242 -0
- package/src/trace/schema.ts +245 -0
- package/src/trace/strict-pii-detector.ts +156 -0
- package/src/tracing/traced-port.ts +149 -0
- package/src/tracking/agent-run-tracker.ts +228 -0
- package/src/tracking/gen-ai.ts +153 -0
- package/src/tracking/index.ts +19 -0
- package/src/types/agent.ts +93 -0
- package/src/types/escalation-mapping.ts +48 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outcomes module — wire types for /api/outcomes/* REST endpoints.
|
|
3
|
+
*
|
|
4
|
+
* All monetary amounts are integer cents (signed). Negative = cost.
|
|
5
|
+
* Route implementation lives in command-center /api/outcomes/* (sprint-522:quick-4).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Open-ended outcome type discriminant.
|
|
10
|
+
* Canonical values: trade_pnl, forecast_accurate, knowledge_consolidated,
|
|
11
|
+
* cost_savings, lead_qualified, sprint_completed, etc.
|
|
12
|
+
*/
|
|
13
|
+
export type OutcomeType = string;
|
|
14
|
+
|
|
15
|
+
/** A single measurable business result attributed to an agent run. */
|
|
16
|
+
export interface Outcome {
|
|
17
|
+
id: string;
|
|
18
|
+
agent_id: string;
|
|
19
|
+
/** UUID of the agent_run row that produced this outcome. Nullable when created offline. */
|
|
20
|
+
agent_run_id: string | null;
|
|
21
|
+
outcome_type: OutcomeType;
|
|
22
|
+
/** Signed integer cents. Positive = value created, negative = cost incurred. */
|
|
23
|
+
value_cents: number;
|
|
24
|
+
/** ISO 4217 currency code. Defaults to 'USD'. */
|
|
25
|
+
currency: string;
|
|
26
|
+
/** ISO 8601 timestamp of when the outcome occurred. */
|
|
27
|
+
occurred_at: string;
|
|
28
|
+
/**
|
|
29
|
+
* True when the monetary value has not yet been back-filled from an
|
|
30
|
+
* authoritative source (e.g. trade P&L still pending settlement).
|
|
31
|
+
*/
|
|
32
|
+
is_pending_backfill: boolean;
|
|
33
|
+
metadata?: Record<string, unknown> | null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Aggregated outcome statistics for a given time window. */
|
|
37
|
+
export interface OutcomeSummary {
|
|
38
|
+
period: { from: string; to: string };
|
|
39
|
+
/** Sum of positive value_cents over the period. */
|
|
40
|
+
total_value_cents: number;
|
|
41
|
+
/** Absolute sum of negative value_cents (stored as positive). */
|
|
42
|
+
total_cost_cents: number;
|
|
43
|
+
/** total_value_cents / total_cost_cents. Null when cost == 0. */
|
|
44
|
+
value_to_cost_ratio: number | null;
|
|
45
|
+
/** (total_value_cents - total_cost_cents) / total_cost_cents * 100. Null when cost == 0. */
|
|
46
|
+
net_roi_pct: number | null;
|
|
47
|
+
outcome_count: number;
|
|
48
|
+
attributed_count: number;
|
|
49
|
+
/** Outcomes where is_pending_backfill = true. */
|
|
50
|
+
pending_attribution_count: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Per-agent ROI breakdown for a time window. */
|
|
54
|
+
export interface RoiPerAgent {
|
|
55
|
+
agent_id: string;
|
|
56
|
+
period: { from: string; to: string };
|
|
57
|
+
value_cents: number;
|
|
58
|
+
cost_cents: number;
|
|
59
|
+
/** Null when cost_cents == 0. */
|
|
60
|
+
net_roi_pct: number | null;
|
|
61
|
+
outcome_count: number;
|
|
62
|
+
/** pending_count / outcome_count. 0 when outcome_count == 0. */
|
|
63
|
+
pending_ratio: number;
|
|
64
|
+
/** Week-over-week delta in net_roi_pct. Null when prior week data unavailable. */
|
|
65
|
+
wow_delta_pct: number | null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** CFO-ready burn-rate and initiative breakdown view. */
|
|
69
|
+
export interface CfoView {
|
|
70
|
+
period: { from: string; to: string };
|
|
71
|
+
/** Average daily spend in cents over the period. */
|
|
72
|
+
burn_rate_per_day_cents: number;
|
|
73
|
+
/** burn_rate_per_day_cents * 30. */
|
|
74
|
+
projected_30d_cents: number;
|
|
75
|
+
by_initiative: Array<{
|
|
76
|
+
initiative_id: string;
|
|
77
|
+
spent_cents: number;
|
|
78
|
+
/** Null when no budget is assigned to the initiative. */
|
|
79
|
+
budget_cents: number | null;
|
|
80
|
+
/** spent_cents / budget_cents * 100. Null when budget_cents is null. */
|
|
81
|
+
pct: number | null;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Sum of value_cents for is_pending_backfill=true rows.
|
|
85
|
+
* Lower-bound estimate of unrealised value.
|
|
86
|
+
*/
|
|
87
|
+
pending_value_estimate_cents: number;
|
|
88
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared non-blocking Brain archive helper for orchestration patterns.
|
|
3
|
+
*
|
|
4
|
+
* Returns void (not Promise<void>) — explicit fire-and-forget contract.
|
|
5
|
+
* Callers that accidentally await this get a compile-time warning since
|
|
6
|
+
* void is not meaningfully awaitable.
|
|
7
|
+
*
|
|
8
|
+
* @internal — do not re-export from any public pattern barrel.
|
|
9
|
+
*/
|
|
10
|
+
import type { BrainPort, BrainEntryInput } from "../../ports/brain.js";
|
|
11
|
+
|
|
12
|
+
export function logToBrain(
|
|
13
|
+
brain: BrainPort | undefined | null,
|
|
14
|
+
entry: BrainEntryInput,
|
|
15
|
+
): void {
|
|
16
|
+
if (!brain) return;
|
|
17
|
+
brain.archiveKnowledge(entry).catch(() => undefined);
|
|
18
|
+
}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern A: Session-Level Circuit Breaker — factory.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
import { logToBrain } from "../_shared/brain-logger.js";
|
|
6
|
+
import type {
|
|
7
|
+
CircuitBreakerConfig,
|
|
8
|
+
CircuitSnapshot,
|
|
9
|
+
CircuitState,
|
|
10
|
+
SessionCircuitBreaker,
|
|
11
|
+
} from "./types.js";
|
|
12
|
+
import type { OODAContext } from "../../orchestration/ooda/types.js";
|
|
13
|
+
|
|
14
|
+
const NOOP = {
|
|
15
|
+
debug: () => undefined,
|
|
16
|
+
info: () => undefined,
|
|
17
|
+
warn: () => undefined,
|
|
18
|
+
error: () => undefined,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export function createSessionCircuitBreaker(
|
|
22
|
+
config: CircuitBreakerConfig,
|
|
23
|
+
): SessionCircuitBreaker {
|
|
24
|
+
const {
|
|
25
|
+
name,
|
|
26
|
+
thresholds = {},
|
|
27
|
+
resetAfterMs = 60_000,
|
|
28
|
+
brain,
|
|
29
|
+
onTrip,
|
|
30
|
+
_now = Date.now,
|
|
31
|
+
} = config;
|
|
32
|
+
const logger = config.logger ?? NOOP;
|
|
33
|
+
|
|
34
|
+
const maxTokens = thresholds.maxTokens ?? 50_000;
|
|
35
|
+
const maxConsecutiveErrors = thresholds.maxConsecutiveErrors ?? 5;
|
|
36
|
+
const maxActionCount = thresholds.maxActionCount ?? 200;
|
|
37
|
+
const maxElapsedMs = thresholds.maxElapsedMs ?? 3_600_000;
|
|
38
|
+
const maxCostUsd = thresholds.maxCostUsd ?? 10.0;
|
|
39
|
+
|
|
40
|
+
let state: CircuitState = "closed";
|
|
41
|
+
let tripReason: string | undefined;
|
|
42
|
+
let openedAt: number | undefined;
|
|
43
|
+
const sessionStart = _now();
|
|
44
|
+
let tokenCount = 0;
|
|
45
|
+
let consecutiveErrors = 0;
|
|
46
|
+
let actionCount = 0;
|
|
47
|
+
let estimatedCostUsd = 0;
|
|
48
|
+
|
|
49
|
+
function snap(): CircuitSnapshot {
|
|
50
|
+
return {
|
|
51
|
+
state,
|
|
52
|
+
tokenCount,
|
|
53
|
+
consecutiveErrors,
|
|
54
|
+
actionCount,
|
|
55
|
+
elapsedMs: _now() - sessionStart,
|
|
56
|
+
estimatedCostUsd,
|
|
57
|
+
tripReason,
|
|
58
|
+
openedAt,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function doTrip(reason: string): void {
|
|
63
|
+
if (state === "open") return; // idempotent
|
|
64
|
+
state = "open";
|
|
65
|
+
tripReason = reason;
|
|
66
|
+
openedAt = _now();
|
|
67
|
+
logger.warn(
|
|
68
|
+
{ name, reason },
|
|
69
|
+
`[session-cb:${name}] OPEN: ${reason}`,
|
|
70
|
+
);
|
|
71
|
+
logToBrain(brain, {
|
|
72
|
+
content: `Session CB '${name}' tripped OPEN. ${reason}`,
|
|
73
|
+
content_type: "event",
|
|
74
|
+
author: `session-cb:${name}`,
|
|
75
|
+
category: "incident",
|
|
76
|
+
tags: ["circuit-breaker", "session", name, "tripped"],
|
|
77
|
+
confidence: 0.95,
|
|
78
|
+
metadata: snap() as unknown as Record<string, unknown>,
|
|
79
|
+
});
|
|
80
|
+
try {
|
|
81
|
+
onTrip?.(snap());
|
|
82
|
+
} catch {
|
|
83
|
+
/* suppress */
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function checkThresholds(): string | null {
|
|
88
|
+
if (tokenCount > maxTokens)
|
|
89
|
+
return `tokenCount(${tokenCount}) > maxTokens(${maxTokens})`;
|
|
90
|
+
if (consecutiveErrors >= maxConsecutiveErrors)
|
|
91
|
+
return `consecutiveErrors(${consecutiveErrors}) >= ${maxConsecutiveErrors}`;
|
|
92
|
+
if (actionCount > maxActionCount)
|
|
93
|
+
return `actionCount(${actionCount}) > maxActionCount(${maxActionCount})`;
|
|
94
|
+
const elapsed = _now() - sessionStart;
|
|
95
|
+
if (elapsed > maxElapsedMs)
|
|
96
|
+
return `elapsedMs(${elapsed}) > maxElapsedMs(${maxElapsedMs})`;
|
|
97
|
+
if (estimatedCostUsd > maxCostUsd)
|
|
98
|
+
return `costUsd($${estimatedCostUsd.toFixed(4)}) > maxCostUsd($${maxCostUsd})`;
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
async function check(
|
|
103
|
+
_ctx: OODAContext,
|
|
104
|
+
): Promise<{ proceed: boolean; reason?: string }> {
|
|
105
|
+
const now = _now();
|
|
106
|
+
if (state === "open") {
|
|
107
|
+
const elapsed =
|
|
108
|
+
openedAt !== undefined ? now - openedAt : resetAfterMs;
|
|
109
|
+
if (elapsed < resetAfterMs) {
|
|
110
|
+
return {
|
|
111
|
+
proceed: false,
|
|
112
|
+
reason: `session-cb:${name} OPEN (${tripReason ?? "threshold breach"})`,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
state = "half-open";
|
|
116
|
+
// Reset consecutiveErrors so the inherited count from before the trip
|
|
117
|
+
// does not immediately re-trip the probe via checkThresholds().
|
|
118
|
+
consecutiveErrors = 0;
|
|
119
|
+
logger.info({ name }, `[session-cb:${name}] HALF-OPEN probe`);
|
|
120
|
+
}
|
|
121
|
+
// In half-open state we allow the probe through without re-checking
|
|
122
|
+
// accumulated metrics (tokens, actions, cost) — only recordError() during
|
|
123
|
+
// the probe can re-trip. Threshold re-check only applies to closed state.
|
|
124
|
+
if (state !== "half-open") {
|
|
125
|
+
const violation = checkThresholds();
|
|
126
|
+
if (violation !== null) {
|
|
127
|
+
doTrip(violation);
|
|
128
|
+
return {
|
|
129
|
+
proceed: false,
|
|
130
|
+
reason: `session-cb:${name} tripped: ${violation}`,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return { proceed: true };
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return {
|
|
138
|
+
name: `session-cb:${name}`,
|
|
139
|
+
check,
|
|
140
|
+
recordTokens(count: number, costUsd?: number): void {
|
|
141
|
+
tokenCount += count;
|
|
142
|
+
if (costUsd !== undefined) estimatedCostUsd += costUsd;
|
|
143
|
+
if (state === "closed") {
|
|
144
|
+
const v = checkThresholds();
|
|
145
|
+
if (v) doTrip(v);
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
recordError(): void {
|
|
149
|
+
consecutiveErrors += 1;
|
|
150
|
+
if (state === "half-open") {
|
|
151
|
+
doTrip(`probe failed (errors=${consecutiveErrors})`);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (state === "closed") {
|
|
155
|
+
const v = checkThresholds();
|
|
156
|
+
if (v) doTrip(v);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
recordSuccess(): void {
|
|
160
|
+
// NOTE: does NOT re-check thresholds — token/action/cost counters are
|
|
161
|
+
// not reset by success; only consecutiveErrors is cleared.
|
|
162
|
+
if (state === "half-open") {
|
|
163
|
+
state = "closed";
|
|
164
|
+
consecutiveErrors = 0;
|
|
165
|
+
tripReason = undefined;
|
|
166
|
+
openedAt = undefined;
|
|
167
|
+
logger.info({ name }, `[session-cb:${name}] CLOSED (probe success)`);
|
|
168
|
+
logToBrain(brain, {
|
|
169
|
+
content: `Session CB '${name}' recovered to CLOSED after probe success.`,
|
|
170
|
+
content_type: "event",
|
|
171
|
+
author: `session-cb:${name}`,
|
|
172
|
+
category: "development",
|
|
173
|
+
tags: ["circuit-breaker", "session", name, "recovered"],
|
|
174
|
+
confidence: 0.9,
|
|
175
|
+
});
|
|
176
|
+
} else {
|
|
177
|
+
consecutiveErrors = 0;
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
recordAction(): void {
|
|
181
|
+
actionCount += 1;
|
|
182
|
+
if (state === "closed") {
|
|
183
|
+
const v = checkThresholds();
|
|
184
|
+
if (v) doTrip(v);
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
reset(): void {
|
|
188
|
+
state = "closed";
|
|
189
|
+
tokenCount = 0;
|
|
190
|
+
consecutiveErrors = 0;
|
|
191
|
+
actionCount = 0;
|
|
192
|
+
estimatedCostUsd = 0;
|
|
193
|
+
tripReason = undefined;
|
|
194
|
+
openedAt = undefined;
|
|
195
|
+
},
|
|
196
|
+
snapshot: snap,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern A: Session-Level Circuit Breaker — types.
|
|
3
|
+
*
|
|
4
|
+
* DISTINCT from `resilience/circuit-breaker.ts` which wraps async functions.
|
|
5
|
+
* This pattern tracks SESSION METRICS (tokens, errors, actions, cost, time)
|
|
6
|
+
* and integrates as a RiskGuard for the OODA cycle.
|
|
7
|
+
*
|
|
8
|
+
* State machine: closed → open (threshold breach) → half-open (after
|
|
9
|
+
* resetAfterMs) → closed (probe success via recordSuccess()).
|
|
10
|
+
*
|
|
11
|
+
* IMPORTANT: record* methods must be called manually from phase functions.
|
|
12
|
+
* The OODA loop does NOT auto-feed these metrics.
|
|
13
|
+
*
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
import type { RiskGuard } from "../../orchestration/ooda/types.js";
|
|
17
|
+
import type { BrainPort } from "../../ports/brain.js";
|
|
18
|
+
import type { LoggerPort } from "../../ports/logger.js";
|
|
19
|
+
|
|
20
|
+
export type CircuitState = "closed" | "open" | "half-open";
|
|
21
|
+
|
|
22
|
+
export interface CircuitSnapshot {
|
|
23
|
+
readonly state: CircuitState;
|
|
24
|
+
readonly tokenCount: number;
|
|
25
|
+
readonly consecutiveErrors: number;
|
|
26
|
+
readonly actionCount: number;
|
|
27
|
+
readonly elapsedMs: number;
|
|
28
|
+
readonly estimatedCostUsd: number;
|
|
29
|
+
readonly tripReason?: string;
|
|
30
|
+
readonly openedAt?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface CircuitBreakerThresholds {
|
|
34
|
+
/** Max cumulative tokens before trip. Default: 50_000 */
|
|
35
|
+
readonly maxTokens?: number;
|
|
36
|
+
/** Max consecutive errors before trip. Default: 5 */
|
|
37
|
+
readonly maxConsecutiveErrors?: number;
|
|
38
|
+
/** Max action count per session. Default: 200 */
|
|
39
|
+
readonly maxActionCount?: number;
|
|
40
|
+
/** Max session elapsed ms. Default: 3_600_000 (1h) */
|
|
41
|
+
readonly maxElapsedMs?: number;
|
|
42
|
+
/** Max estimated cost USD. Default: 10.0 */
|
|
43
|
+
readonly maxCostUsd?: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface CircuitBreakerConfig {
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly thresholds?: CircuitBreakerThresholds;
|
|
49
|
+
/** Time to stay OPEN before half-open probe. Default: 60_000 ms */
|
|
50
|
+
readonly resetAfterMs?: number;
|
|
51
|
+
readonly brain?: BrainPort;
|
|
52
|
+
readonly logger?: LoggerPort;
|
|
53
|
+
/** Called synchronously when circuit trips. Must not throw. */
|
|
54
|
+
readonly onTrip?: (snapshot: CircuitSnapshot) => void;
|
|
55
|
+
/** Injectable clock for tests. Default: Date.now */
|
|
56
|
+
readonly _now?: () => number;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Session-level circuit breaker. Implements RiskGuard + metric recording.
|
|
61
|
+
*
|
|
62
|
+
* Add to OODAAgentConfig.riskGuards. Phase functions call record* methods.
|
|
63
|
+
*/
|
|
64
|
+
export interface SessionCircuitBreaker extends RiskGuard {
|
|
65
|
+
recordTokens(count: number, costUsd?: number): void;
|
|
66
|
+
recordError(): void;
|
|
67
|
+
/** Record a successful action. Resets consecutiveErrors. Closes half-open probe. */
|
|
68
|
+
recordSuccess(): void;
|
|
69
|
+
recordAction(): void;
|
|
70
|
+
reset(): void;
|
|
71
|
+
snapshot(): CircuitSnapshot;
|
|
72
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern C: Escalation Pyramid — factory implementation.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
import { logToBrain } from "../_shared/brain-logger.js";
|
|
6
|
+
import type {
|
|
7
|
+
EscalationDecision,
|
|
8
|
+
EscalationLevel,
|
|
9
|
+
EscalationPyramid,
|
|
10
|
+
EscalationPyramidConfig,
|
|
11
|
+
} from "./types.js";
|
|
12
|
+
import type { OODAContext } from "../../orchestration/ooda/types.js";
|
|
13
|
+
|
|
14
|
+
const NOOP = {
|
|
15
|
+
debug: () => undefined,
|
|
16
|
+
info: () => undefined,
|
|
17
|
+
warn: () => undefined,
|
|
18
|
+
error: () => undefined,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const UNKNOWN_DEFAULT: EscalationLevel = "L3_hitl_required";
|
|
22
|
+
|
|
23
|
+
export function createEscalationPyramid(
|
|
24
|
+
config: EscalationPyramidConfig,
|
|
25
|
+
): EscalationPyramid {
|
|
26
|
+
const l1 = config.l1ConfidenceThreshold ?? 0.85;
|
|
27
|
+
const l2 = config.l2ConfidenceThreshold ?? 0.60;
|
|
28
|
+
if (l2 >= l1) {
|
|
29
|
+
throw new Error(
|
|
30
|
+
`[escalation:${config.name}] l2ConfidenceThreshold(${l2}) must be < l1ConfidenceThreshold(${l1})`,
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
const logger = config.logger ?? NOOP;
|
|
34
|
+
|
|
35
|
+
const declared = new Map<string, EscalationLevel>(
|
|
36
|
+
config.declarations.map((d) => [d.actionType, d.level]),
|
|
37
|
+
);
|
|
38
|
+
const overrides = new Map<string, EscalationLevel>();
|
|
39
|
+
|
|
40
|
+
function getNominal(actionType: string): EscalationLevel {
|
|
41
|
+
return overrides.get(actionType) ?? declared.get(actionType) ?? UNKNOWN_DEFAULT;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function escalate(
|
|
45
|
+
nominal: EscalationLevel,
|
|
46
|
+
confidence: number,
|
|
47
|
+
isDryRun: boolean,
|
|
48
|
+
): EscalationLevel {
|
|
49
|
+
if (isDryRun) return "L1_autonomous";
|
|
50
|
+
switch (nominal) {
|
|
51
|
+
case "L1_autonomous":
|
|
52
|
+
return confidence < l1 ? "L2_async_review" : "L1_autonomous";
|
|
53
|
+
case "L2_async_review":
|
|
54
|
+
return confidence < l2 ? "L3_hitl_required" : "L2_async_review";
|
|
55
|
+
case "L3_hitl_required":
|
|
56
|
+
return "L3_hitl_required";
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
async canProceed(
|
|
62
|
+
actionType: string,
|
|
63
|
+
confidence: number,
|
|
64
|
+
ctx: OODAContext,
|
|
65
|
+
): Promise<EscalationDecision> {
|
|
66
|
+
const nominal = getNominal(actionType);
|
|
67
|
+
const isDryRun = ctx.executionMode === "dry-run";
|
|
68
|
+
const effectiveLevel = escalate(nominal, confidence, isDryRun);
|
|
69
|
+
const proceed = effectiveLevel !== "L3_hitl_required";
|
|
70
|
+
|
|
71
|
+
const reason = isDryRun
|
|
72
|
+
? `dry-run → L1_autonomous`
|
|
73
|
+
: nominal === effectiveLevel
|
|
74
|
+
? `'${actionType}' at ${nominal} (confidence=${confidence.toFixed(3)})`
|
|
75
|
+
: `'${actionType}' escalated ${nominal} → ${effectiveLevel} (confidence=${confidence.toFixed(3)})`;
|
|
76
|
+
|
|
77
|
+
const decision: EscalationDecision = { proceed, effectiveLevel, reason };
|
|
78
|
+
|
|
79
|
+
logger.info(
|
|
80
|
+
{ pyramid: config.name, actionType, confidence, effectiveLevel, proceed },
|
|
81
|
+
`[escalation:${config.name}] ${reason}`,
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
logToBrain(config.brain, {
|
|
85
|
+
content: `Escalation '${config.name}': ${reason}`,
|
|
86
|
+
content_type: "decision",
|
|
87
|
+
author: `escalation:${config.name}`,
|
|
88
|
+
category: "decision",
|
|
89
|
+
tags: ["escalation-pyramid", config.name, effectiveLevel, actionType],
|
|
90
|
+
confidence,
|
|
91
|
+
metadata: {
|
|
92
|
+
actionType,
|
|
93
|
+
confidence,
|
|
94
|
+
nominal,
|
|
95
|
+
effectiveLevel,
|
|
96
|
+
proceed,
|
|
97
|
+
agentId: ctx.agentId,
|
|
98
|
+
runId: ctx.runId,
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
if (!proceed) {
|
|
103
|
+
logger.warn(
|
|
104
|
+
{ pyramid: config.name, actionType },
|
|
105
|
+
`[escalation:${config.name}] L3 block on '${actionType}'`,
|
|
106
|
+
);
|
|
107
|
+
try {
|
|
108
|
+
config.onHitlRequired?.(actionType, confidence, decision, ctx);
|
|
109
|
+
} catch {
|
|
110
|
+
/* suppress */
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return decision;
|
|
115
|
+
},
|
|
116
|
+
|
|
117
|
+
override(actionType: string, level: EscalationLevel): void {
|
|
118
|
+
overrides.set(actionType, level);
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
clearOverride(actionType: string): void {
|
|
122
|
+
overrides.delete(actionType);
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern C: Escalation Pyramid — types.
|
|
3
|
+
*
|
|
4
|
+
* Declares action autonomy levels and validates before execution.
|
|
5
|
+
* Confidence-based escalation: insufficient confidence escalates the level.
|
|
6
|
+
* Unknown action types default to L3 (fail-safe).
|
|
7
|
+
* dry-run always resolves to L1 (no real effects).
|
|
8
|
+
*
|
|
9
|
+
* NOTE: `confidence` must be provided by the agent's DECIDE phase.
|
|
10
|
+
* The SDK does not infer it automatically from the LLM.
|
|
11
|
+
*
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
import type { BrainPort } from "../../ports/brain.js";
|
|
15
|
+
import type { LoggerPort } from "../../ports/logger.js";
|
|
16
|
+
import type { OODAContext } from "../../orchestration/ooda/types.js";
|
|
17
|
+
|
|
18
|
+
export type EscalationLevel =
|
|
19
|
+
| "L1_autonomous"
|
|
20
|
+
| "L2_async_review"
|
|
21
|
+
| "L3_hitl_required";
|
|
22
|
+
|
|
23
|
+
export interface ActionDeclaration {
|
|
24
|
+
readonly actionType: string;
|
|
25
|
+
readonly level: EscalationLevel;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface EscalationDecision {
|
|
29
|
+
readonly proceed: boolean;
|
|
30
|
+
readonly effectiveLevel: EscalationLevel;
|
|
31
|
+
readonly reason: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface EscalationPyramidConfig {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly declarations: ReadonlyArray<ActionDeclaration>;
|
|
37
|
+
/** Min confidence for L1 without escalating to L2. Default: 0.85 */
|
|
38
|
+
readonly l1ConfidenceThreshold?: number;
|
|
39
|
+
/** Min confidence for L2 without escalating to L3. Default: 0.60 */
|
|
40
|
+
readonly l2ConfidenceThreshold?: number;
|
|
41
|
+
readonly brain?: BrainPort;
|
|
42
|
+
readonly logger?: LoggerPort;
|
|
43
|
+
/** Called when effectiveLevel = L3. Must not throw. */
|
|
44
|
+
readonly onHitlRequired?: (
|
|
45
|
+
actionType: string,
|
|
46
|
+
confidence: number,
|
|
47
|
+
decision: EscalationDecision,
|
|
48
|
+
ctx: OODAContext,
|
|
49
|
+
) => void;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface EscalationPyramid {
|
|
53
|
+
canProceed(
|
|
54
|
+
actionType: string,
|
|
55
|
+
confidence: number,
|
|
56
|
+
ctx: OODAContext,
|
|
57
|
+
): Promise<EscalationDecision>;
|
|
58
|
+
/** Runtime override without redeployment. */
|
|
59
|
+
override(actionType: string, level: EscalationLevel): void;
|
|
60
|
+
/** Remove override — restores declared level (or L3 default). */
|
|
61
|
+
clearOverride(actionType: string): void;
|
|
62
|
+
}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pattern B: Quality Gate — factory implementation.
|
|
3
|
+
* @public
|
|
4
|
+
*/
|
|
5
|
+
import { logToBrain } from "../_shared/brain-logger.js";
|
|
6
|
+
import type {
|
|
7
|
+
QualityGate,
|
|
8
|
+
QualityGateConfig,
|
|
9
|
+
QualityRouting,
|
|
10
|
+
QualityScore,
|
|
11
|
+
} from "./types.js";
|
|
12
|
+
|
|
13
|
+
const NOOP = {
|
|
14
|
+
debug: () => undefined,
|
|
15
|
+
info: () => undefined,
|
|
16
|
+
warn: () => undefined,
|
|
17
|
+
error: () => undefined,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function createQualityGate<T>(
|
|
21
|
+
config: QualityGateConfig<T>,
|
|
22
|
+
): QualityGate<T> {
|
|
23
|
+
if (config.evaluators.length === 0) {
|
|
24
|
+
throw new Error(
|
|
25
|
+
`[quality-gate:${config.name}] evaluators must not be empty`,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
const autoProceed = config.autoProceedThreshold ?? 0.8;
|
|
29
|
+
const asyncReview = config.asyncReviewThreshold ?? 0.5;
|
|
30
|
+
if (asyncReview >= autoProceed) {
|
|
31
|
+
throw new Error(
|
|
32
|
+
`[quality-gate:${config.name}] asyncReviewThreshold(${asyncReview}) must be < autoProceedThreshold(${autoProceed})`,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
const logger = config.logger ?? NOOP;
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
async evaluate(subject: T): Promise<QualityScore> {
|
|
39
|
+
const dims: Array<{ name: string; score: number; weight: number }> = [];
|
|
40
|
+
let totalWeight = 0;
|
|
41
|
+
let weightedSum = 0;
|
|
42
|
+
|
|
43
|
+
for (const ev of config.evaluators) {
|
|
44
|
+
const w = ev.weight ?? 1;
|
|
45
|
+
let s = 0;
|
|
46
|
+
try {
|
|
47
|
+
const raw = await ev.evaluate(subject);
|
|
48
|
+
// NaN/Infinity guard — misbehaving evaluators score 0 without propagating
|
|
49
|
+
s = Number.isFinite(raw) ? Math.max(0, Math.min(1, raw)) : 0;
|
|
50
|
+
} catch (err) {
|
|
51
|
+
logger.error(
|
|
52
|
+
{ evaluator: ev.name, err },
|
|
53
|
+
`[quality-gate:${config.name}] evaluator '${ev.name}' threw — scoring 0`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
dims.push({ name: ev.name, score: s, weight: w });
|
|
57
|
+
totalWeight += w;
|
|
58
|
+
weightedSum += s * w;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const overall = totalWeight > 0 ? weightedSum / totalWeight : 0;
|
|
62
|
+
const routing: QualityRouting =
|
|
63
|
+
overall >= autoProceed
|
|
64
|
+
? "auto"
|
|
65
|
+
: overall >= asyncReview
|
|
66
|
+
? "async_review"
|
|
67
|
+
: "hitl_block";
|
|
68
|
+
|
|
69
|
+
const score: QualityScore = { overall, routing, dimensions: dims };
|
|
70
|
+
|
|
71
|
+
logger.info(
|
|
72
|
+
{ gate: config.name, overall, routing },
|
|
73
|
+
`[quality-gate:${config.name}] ${overall.toFixed(3)} → ${routing}`,
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
// category: "operations" — these are production quality metrics, not debug logs
|
|
77
|
+
logToBrain(config.brain, {
|
|
78
|
+
content: `Quality gate '${config.name}': overall=${overall.toFixed(3)} routing=${routing}. ${dims.map((d) => `${d.name}=${d.score.toFixed(3)}`).join(", ")}`,
|
|
79
|
+
content_type: "metric",
|
|
80
|
+
author: `quality-gate:${config.name}`,
|
|
81
|
+
category: "operations",
|
|
82
|
+
tags: ["quality-gate", config.name, routing],
|
|
83
|
+
confidence: overall,
|
|
84
|
+
metadata: { score: score as unknown as Record<string, unknown> },
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
if (routing === "hitl_block") {
|
|
88
|
+
logger.warn(
|
|
89
|
+
{ gate: config.name, overall },
|
|
90
|
+
`[quality-gate:${config.name}] hitl_block triggered`,
|
|
91
|
+
);
|
|
92
|
+
try {
|
|
93
|
+
config.onHitlBlock?.(score, subject);
|
|
94
|
+
} catch {
|
|
95
|
+
/* suppress */
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return score;
|
|
100
|
+
},
|
|
101
|
+
};
|
|
102
|
+
}
|