@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,730 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OODAAgentImpl — sequential while+sleep cycle loop with phase persistence,
|
|
3
|
+
* guards, HITL gate, resource limits, and replay-safe context propagation.
|
|
4
|
+
*
|
|
5
|
+
* Implements all 10 anti-patterns enforced by-design (see `./types.ts`).
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
import { randomUUID } from "node:crypto";
|
|
10
|
+
import { SpanStatusCode } from "@opentelemetry/api";
|
|
11
|
+
import { DEFAULT_RESOURCE_LIMITS } from "./types.js";
|
|
12
|
+
import { EMPTY_SKILL_REGISTRY } from "./skills.js";
|
|
13
|
+
import { MissingDryRunFlagError } from "../../errors.js";
|
|
14
|
+
import { agentSpan, getTracer } from "../../tracking/gen-ai.js";
|
|
15
|
+
/**
|
|
16
|
+
* Noop logger fallback when host does not inject one.
|
|
17
|
+
* Prevents TypeError: Cannot read properties of undefined (0.8.1 fix).
|
|
18
|
+
*/
|
|
19
|
+
const NOOP_LOGGER = {
|
|
20
|
+
info: () => undefined,
|
|
21
|
+
warn: () => undefined,
|
|
22
|
+
error: () => undefined,
|
|
23
|
+
debug: () => undefined,
|
|
24
|
+
};
|
|
25
|
+
/** Internal sleep helper — kept private so tests grep cannot find a global setInterval. */
|
|
26
|
+
function sleep(ms) {
|
|
27
|
+
return new Promise((resolve) => {
|
|
28
|
+
if (ms <= 0) {
|
|
29
|
+
resolve();
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
setTimeout(resolve, ms).unref?.();
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Default in-memory step persister. Hosts MUST inject `insertStepImpl` /
|
|
37
|
+
* `completeStepImpl` / `errorStepImpl` when persisting to Postgres.
|
|
38
|
+
*
|
|
39
|
+
* The default is intentionally trivial: it generates a UUID stepId and
|
|
40
|
+
* a deterministic-but-fake leaf hash. This keeps the SDK runnable in
|
|
41
|
+
* tests and dry-run hosts without requiring a DB.
|
|
42
|
+
*/
|
|
43
|
+
function defaultInsertStep() {
|
|
44
|
+
return async () => ({ stepId: randomUUID() });
|
|
45
|
+
}
|
|
46
|
+
function defaultCompleteStep() {
|
|
47
|
+
return async (stepId) => ({ leafHash: `0x${stepId.replace(/-/g, "")}` });
|
|
48
|
+
}
|
|
49
|
+
function defaultErrorStep() {
|
|
50
|
+
return async () => { };
|
|
51
|
+
}
|
|
52
|
+
function defaultNotifySlack() {
|
|
53
|
+
return async () => { };
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Race a promise against an `AbortSignal.timeout`-driven rejection.
|
|
57
|
+
* Anti-pattern #9 enforcement.
|
|
58
|
+
*/
|
|
59
|
+
function withPhaseTimeout(p, timeoutMs) {
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
const t = setTimeout(() => {
|
|
62
|
+
reject(new Error(`OODA phase timeout exceeded (${timeoutMs}ms)`));
|
|
63
|
+
}, timeoutMs);
|
|
64
|
+
t.unref?.();
|
|
65
|
+
p.then((v) => {
|
|
66
|
+
clearTimeout(t);
|
|
67
|
+
resolve(v);
|
|
68
|
+
}, (e) => {
|
|
69
|
+
clearTimeout(t);
|
|
70
|
+
reject(e);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Validate phase definitions at construction time.
|
|
76
|
+
* - observe + orient must be readOnly (anti-pattern #7)
|
|
77
|
+
* - executionMode must be a known value (anti-pattern #6)
|
|
78
|
+
*/
|
|
79
|
+
function validateConfig(config) {
|
|
80
|
+
if (config.executionMode !== "dry-run" && config.executionMode !== "live") {
|
|
81
|
+
throw new Error(`OODAAgent: executionMode is REQUIRED ('dry-run' | 'live') — got ${JSON.stringify(config.executionMode)}`);
|
|
82
|
+
}
|
|
83
|
+
if (config.phases.observe.readOnly !== true) {
|
|
84
|
+
throw new Error("OODAAgent: phases.observe MUST be readOnly:true (anti-pattern #7)");
|
|
85
|
+
}
|
|
86
|
+
if (config.phases.orient.readOnly !== true) {
|
|
87
|
+
throw new Error("OODAAgent: phases.orient MUST be readOnly:true (anti-pattern #7)");
|
|
88
|
+
}
|
|
89
|
+
if (!Number.isFinite(config.intervalMs) || config.intervalMs < 0) {
|
|
90
|
+
throw new Error(`OODAAgent: intervalMs must be >= 0, got ${config.intervalMs}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* OODAAgentImpl — concrete implementation. Prefer `createOODAAgent` factory.
|
|
95
|
+
*/
|
|
96
|
+
export class OODAAgentImpl {
|
|
97
|
+
_config;
|
|
98
|
+
_limits;
|
|
99
|
+
_running = false;
|
|
100
|
+
_cyclesCompleted = 0;
|
|
101
|
+
_lastCycleAt;
|
|
102
|
+
_activeCycle;
|
|
103
|
+
constructor(config) {
|
|
104
|
+
validateConfig(config);
|
|
105
|
+
this._config = config;
|
|
106
|
+
this._limits = {
|
|
107
|
+
phaseTimeoutMs: config.resourceLimits?.phaseTimeoutMs ??
|
|
108
|
+
DEFAULT_RESOURCE_LIMITS.phaseTimeoutMs,
|
|
109
|
+
maxStepsPerCycle: config.resourceLimits?.maxStepsPerCycle ??
|
|
110
|
+
DEFAULT_RESOURCE_LIMITS.maxStepsPerCycle,
|
|
111
|
+
maxHeapMb: config.resourceLimits?.maxHeapMb ?? DEFAULT_RESOURCE_LIMITS.maxHeapMb,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
async start() {
|
|
115
|
+
if (this._running)
|
|
116
|
+
return;
|
|
117
|
+
this._running = true;
|
|
118
|
+
// Anti-pattern #1 — sequential while + sleep. NEVER setInterval.
|
|
119
|
+
while (this._running) {
|
|
120
|
+
this._activeCycle = this.runCycle();
|
|
121
|
+
await this._activeCycle;
|
|
122
|
+
this._activeCycle = undefined;
|
|
123
|
+
if (!this._running)
|
|
124
|
+
break;
|
|
125
|
+
await sleep(this._config.intervalMs);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
async stop() {
|
|
129
|
+
this._running = false;
|
|
130
|
+
if (this._activeCycle) {
|
|
131
|
+
try {
|
|
132
|
+
await this._activeCycle;
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
// Cycle errors already surfaced via runCycle's logging.
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async triggerCycle(opts) {
|
|
140
|
+
if (opts?.dryRun === undefined) {
|
|
141
|
+
throw new MissingDryRunFlagError();
|
|
142
|
+
}
|
|
143
|
+
const overrideMode = opts.dryRun === true ? "dry-run" : undefined;
|
|
144
|
+
return this.runCycle(overrideMode, opts.initialContext);
|
|
145
|
+
}
|
|
146
|
+
async *streamCycle(opts) {
|
|
147
|
+
const runId = randomUUID();
|
|
148
|
+
const cycleIndex = this._cyclesCompleted;
|
|
149
|
+
const executionMode = opts.dryRun
|
|
150
|
+
? "dry-run"
|
|
151
|
+
: this._config.executionMode;
|
|
152
|
+
// ── Event channel ─────────────────────────────────────────────────────
|
|
153
|
+
// We need to bridge an async-function-based execution (runCycleWithSink)
|
|
154
|
+
// with an async generator consumer. We do this via a push queue + pull
|
|
155
|
+
// mechanism: the sink pushes events into the queue; the generator drains
|
|
156
|
+
// the queue as events arrive.
|
|
157
|
+
const queue = [];
|
|
158
|
+
let done = false;
|
|
159
|
+
let resolveNext;
|
|
160
|
+
function push(evt) {
|
|
161
|
+
queue.push(evt);
|
|
162
|
+
if (resolveNext) {
|
|
163
|
+
const r = resolveNext;
|
|
164
|
+
resolveNext = undefined;
|
|
165
|
+
r();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// Run the cycle body in the background; it calls push() for every event.
|
|
169
|
+
const cyclePromise = this._runCycleWithSink(runId, cycleIndex, executionMode, push, opts.initialContext).finally(() => {
|
|
170
|
+
done = true;
|
|
171
|
+
if (resolveNext) {
|
|
172
|
+
const r = resolveNext;
|
|
173
|
+
resolveNext = undefined;
|
|
174
|
+
r();
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
// Drain the queue as events arrive.
|
|
178
|
+
while (!done || queue.length > 0) {
|
|
179
|
+
if (queue.length > 0) {
|
|
180
|
+
yield queue.shift();
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
// Wait until the next push() or until done is set.
|
|
184
|
+
await new Promise((res) => {
|
|
185
|
+
resolveNext = res;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Await the cycle promise to surface any unhandled rejection.
|
|
190
|
+
await cyclePromise;
|
|
191
|
+
}
|
|
192
|
+
getStatus() {
|
|
193
|
+
return {
|
|
194
|
+
running: this._running,
|
|
195
|
+
lastCycleAt: this._lastCycleAt,
|
|
196
|
+
cyclesCompleted: this._cyclesCompleted,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
// ─── internal ────────────────────────────────────────────────────────────
|
|
200
|
+
async runCycle(overrideMode, initialContext) {
|
|
201
|
+
const runId = randomUUID();
|
|
202
|
+
const cycleIndex = this._cyclesCompleted;
|
|
203
|
+
const executionMode = overrideMode ?? this._config.executionMode;
|
|
204
|
+
const isReplay = false;
|
|
205
|
+
const logger = this._config.logger ?? NOOP_LOGGER;
|
|
206
|
+
// ── OTel: agent-level span for the full cycle ───────────────────────────
|
|
207
|
+
const tracer = getTracer("vauban-agent-sdk.ooda");
|
|
208
|
+
const rootSpan = agentSpan(tracer, {
|
|
209
|
+
agentId: this._config.agentId,
|
|
210
|
+
agentVersion: this._config.agentVersion ?? "0.0.0",
|
|
211
|
+
runId,
|
|
212
|
+
});
|
|
213
|
+
rootSpan.setAttribute("vauban.ooda.cycle_index", cycleIndex);
|
|
214
|
+
rootSpan.setAttribute("vauban.ooda.execution_mode", executionMode);
|
|
215
|
+
let stepsThisCycle = 0;
|
|
216
|
+
const limits = this._limits;
|
|
217
|
+
const baseInsertStep = this._config.insertStepImpl ?? defaultInsertStep();
|
|
218
|
+
const insertStep = async (input) => {
|
|
219
|
+
stepsThisCycle += 1;
|
|
220
|
+
if (stepsThisCycle > limits.maxStepsPerCycle) {
|
|
221
|
+
throw new Error(`OODA: maxStepsPerCycle exceeded (${limits.maxStepsPerCycle})`);
|
|
222
|
+
}
|
|
223
|
+
return baseInsertStep(input);
|
|
224
|
+
};
|
|
225
|
+
let liveConfig = (this._config.config ??
|
|
226
|
+
{});
|
|
227
|
+
if (this._config.configLoader) {
|
|
228
|
+
try {
|
|
229
|
+
liveConfig = await this._config.configLoader.get(this._config.agentId);
|
|
230
|
+
}
|
|
231
|
+
catch (e) {
|
|
232
|
+
logger.warn({ agentId: this._config.agentId, err: e.message }, "ooda.cycle.config_loader_failed — using static config");
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const ctx = Object.freeze({
|
|
236
|
+
agentId: this._config.agentId,
|
|
237
|
+
runId,
|
|
238
|
+
cycleIndex,
|
|
239
|
+
executionMode,
|
|
240
|
+
isReplay,
|
|
241
|
+
config: liveConfig,
|
|
242
|
+
configLoader: this._config.configLoader,
|
|
243
|
+
db: this._config.db,
|
|
244
|
+
skills: this._config.skills ?? EMPTY_SKILL_REGISTRY,
|
|
245
|
+
logger,
|
|
246
|
+
deps: this._config.deps ?? {},
|
|
247
|
+
insertStep,
|
|
248
|
+
completeStep: this._config.completeStepImpl ?? defaultCompleteStep(),
|
|
249
|
+
errorStep: this._config.errorStepImpl ?? defaultErrorStep(),
|
|
250
|
+
notifySlack: this._config.notifySlackImpl ?? defaultNotifySlack(),
|
|
251
|
+
});
|
|
252
|
+
// ── Session guards ──────────────────────────────────────────────────────
|
|
253
|
+
const sessionResult = await this._checkSessionGuards(this._config.sessionGuards ?? []);
|
|
254
|
+
if (!sessionResult.ok) {
|
|
255
|
+
logger.info({ runId, agentId: this._config.agentId, reason: sessionResult.reason }, "ooda.cycle.skipped.session_guard");
|
|
256
|
+
rootSpan.setAttribute("vauban.ooda.status", "skipped");
|
|
257
|
+
rootSpan.setAttribute("vauban.ooda.skip_reason", sessionResult.reason ?? "session_guard");
|
|
258
|
+
rootSpan.setStatus({ code: SpanStatusCode.OK });
|
|
259
|
+
rootSpan.end();
|
|
260
|
+
this._cyclesCompleted += 1;
|
|
261
|
+
this._lastCycleAt = new Date().toISOString();
|
|
262
|
+
return { runId, status: "skipped" };
|
|
263
|
+
}
|
|
264
|
+
// ── Risk guards ─────────────────────────────────────────────────────────
|
|
265
|
+
const riskResult = await this._checkRiskGuards(this._config.riskGuards ?? [], ctx);
|
|
266
|
+
if (!riskResult.ok) {
|
|
267
|
+
logger.info({ runId, agentId: this._config.agentId, reason: riskResult.reason }, "ooda.cycle.skipped.risk_guard");
|
|
268
|
+
rootSpan.setAttribute("vauban.ooda.status", "skipped");
|
|
269
|
+
rootSpan.setAttribute("vauban.ooda.skip_reason", riskResult.reason ?? "risk_guard");
|
|
270
|
+
rootSpan.setStatus({ code: SpanStatusCode.OK });
|
|
271
|
+
rootSpan.end();
|
|
272
|
+
this._cyclesCompleted += 1;
|
|
273
|
+
this._lastCycleAt = new Date().toISOString();
|
|
274
|
+
return { runId, status: "skipped" };
|
|
275
|
+
}
|
|
276
|
+
// ── Heap watermark ──────────────────────────────────────────────────────
|
|
277
|
+
const heapMb = process.memoryUsage().heapUsed / (1024 * 1024);
|
|
278
|
+
if (heapMb > limits.maxHeapMb) {
|
|
279
|
+
logger.warn({ runId, heapMb, limitMb: limits.maxHeapMb }, "ooda.cycle.heap_exceeded");
|
|
280
|
+
rootSpan.setAttribute("vauban.ooda.status", "skipped");
|
|
281
|
+
rootSpan.setAttribute("vauban.ooda.skip_reason", `heap_exceeded:${heapMb.toFixed(1)}mb`);
|
|
282
|
+
rootSpan.setStatus({ code: SpanStatusCode.OK });
|
|
283
|
+
rootSpan.end();
|
|
284
|
+
this._cyclesCompleted += 1;
|
|
285
|
+
this._lastCycleAt = new Date().toISOString();
|
|
286
|
+
return { runId, status: "skipped" };
|
|
287
|
+
}
|
|
288
|
+
// ── Phase chain ────────────────────────────────────────────────────────
|
|
289
|
+
try {
|
|
290
|
+
// Inject initialContext into observe phase for event-driven activation
|
|
291
|
+
const observeInput = initialContext
|
|
292
|
+
? initialContext
|
|
293
|
+
: undefined;
|
|
294
|
+
const obs = await this._runOodaPhase(this._config.phases.observe, observeInput, ctx, tracer);
|
|
295
|
+
const oriented = await this._runOodaPhase(this._config.phases.orient, obs, ctx, tracer);
|
|
296
|
+
const decision = await this._runOodaPhase(this._config.phases.decide, oriented, ctx, tracer);
|
|
297
|
+
const action = await this._runOodaPhase(this._config.phases.act, decision, ctx, tracer, { hitlGate: this._config.phases.act.hitlGate === true });
|
|
298
|
+
// Optional 6th phase — self-critique between act and feedback
|
|
299
|
+
const reflectInput = action;
|
|
300
|
+
const feedbackInput = this._config.phases.reflect
|
|
301
|
+
? (await this._runOodaPhase(this._config.phases.reflect, { ...reflectInput, decision: decision }, ctx, tracer))
|
|
302
|
+
: action;
|
|
303
|
+
const feedback = await this._runOodaPhase(this._config.phases.feedback, feedbackInput, ctx, tracer);
|
|
304
|
+
if (this._config.outcomeMapping) {
|
|
305
|
+
try {
|
|
306
|
+
const outcome = this._config.outcomeMapping(feedback);
|
|
307
|
+
if (outcome) {
|
|
308
|
+
logger.info({ runId, outcome_type: outcome.outcome_type }, "ooda.cycle.outcome");
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
catch (e) {
|
|
312
|
+
logger.error({ runId, err: e.message }, "ooda.cycle.outcome_mapping_failed");
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
rootSpan.setAttribute("vauban.ooda.status", "succeeded");
|
|
316
|
+
rootSpan.setAttribute("vauban.ooda.steps", stepsThisCycle);
|
|
317
|
+
rootSpan.setStatus({ code: SpanStatusCode.OK });
|
|
318
|
+
rootSpan.end();
|
|
319
|
+
this._cyclesCompleted += 1;
|
|
320
|
+
this._lastCycleAt = new Date().toISOString();
|
|
321
|
+
return { runId, status: "succeeded" };
|
|
322
|
+
}
|
|
323
|
+
catch (err) {
|
|
324
|
+
logger.error({
|
|
325
|
+
runId,
|
|
326
|
+
agentId: this._config.agentId,
|
|
327
|
+
err: err.message,
|
|
328
|
+
}, "ooda.cycle.failed");
|
|
329
|
+
rootSpan.setAttribute("vauban.ooda.status", "failed");
|
|
330
|
+
rootSpan.setAttribute("vauban.ooda.steps", stepsThisCycle);
|
|
331
|
+
rootSpan.setStatus({
|
|
332
|
+
code: SpanStatusCode.ERROR,
|
|
333
|
+
message: err.message,
|
|
334
|
+
});
|
|
335
|
+
rootSpan.recordException(err);
|
|
336
|
+
rootSpan.end();
|
|
337
|
+
this._cyclesCompleted += 1;
|
|
338
|
+
this._lastCycleAt = new Date().toISOString();
|
|
339
|
+
return { runId, status: "failed" };
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Execute one full cycle, pushing `CycleEvent` to `sink` as they occur.
|
|
344
|
+
* Used by `streamCycle()` to decouple event emission from async generator
|
|
345
|
+
* mechanics. Single-pass — each phase runs exactly once.
|
|
346
|
+
*/
|
|
347
|
+
async _runCycleWithSink(runId, cycleIndex, executionMode, sink, _initialContext) {
|
|
348
|
+
const cycleStart = Date.now();
|
|
349
|
+
const isReplay = false;
|
|
350
|
+
const logger = this._config.logger ?? NOOP_LOGGER;
|
|
351
|
+
// ── OTel: agent-level span for the full stream cycle ────────────────────
|
|
352
|
+
const tracer = getTracer("vauban-agent-sdk.ooda");
|
|
353
|
+
const rootSpan = agentSpan(tracer, {
|
|
354
|
+
agentId: this._config.agentId,
|
|
355
|
+
agentVersion: this._config.agentVersion ?? "0.0.0",
|
|
356
|
+
runId,
|
|
357
|
+
});
|
|
358
|
+
rootSpan.setAttribute("vauban.ooda.cycle_index", cycleIndex);
|
|
359
|
+
rootSpan.setAttribute("vauban.ooda.execution_mode", executionMode);
|
|
360
|
+
rootSpan.setAttribute("vauban.ooda.stream", true);
|
|
361
|
+
// Step counter — anti-pattern #9 (maxStepsPerCycle).
|
|
362
|
+
let stepsThisCycle = 0;
|
|
363
|
+
const limits = this._limits;
|
|
364
|
+
const baseInsertStep = this._config.insertStepImpl ?? defaultInsertStep();
|
|
365
|
+
const insertStep = async (input) => {
|
|
366
|
+
stepsThisCycle += 1;
|
|
367
|
+
if (stepsThisCycle > limits.maxStepsPerCycle) {
|
|
368
|
+
throw new Error(`OODA: maxStepsPerCycle exceeded (${limits.maxStepsPerCycle})`);
|
|
369
|
+
}
|
|
370
|
+
return baseInsertStep(input);
|
|
371
|
+
};
|
|
372
|
+
// Hot-reload config.
|
|
373
|
+
let liveConfig = (this._config.config ??
|
|
374
|
+
{});
|
|
375
|
+
if (this._config.configLoader) {
|
|
376
|
+
try {
|
|
377
|
+
liveConfig = await this._config.configLoader.get(this._config.agentId);
|
|
378
|
+
}
|
|
379
|
+
catch (e) {
|
|
380
|
+
logger.warn({ agentId: this._config.agentId, err: e.message }, "ooda.stream.config_loader_failed — using static config");
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
const ctx = Object.freeze({
|
|
384
|
+
agentId: this._config.agentId,
|
|
385
|
+
runId,
|
|
386
|
+
cycleIndex,
|
|
387
|
+
executionMode,
|
|
388
|
+
isReplay,
|
|
389
|
+
config: liveConfig,
|
|
390
|
+
configLoader: this._config.configLoader,
|
|
391
|
+
db: this._config.db,
|
|
392
|
+
skills: this._config.skills ?? EMPTY_SKILL_REGISTRY,
|
|
393
|
+
logger,
|
|
394
|
+
deps: this._config.deps ?? {},
|
|
395
|
+
insertStep,
|
|
396
|
+
completeStep: this._config.completeStepImpl ?? defaultCompleteStep(),
|
|
397
|
+
errorStep: this._config.errorStepImpl ?? defaultErrorStep(),
|
|
398
|
+
notifySlack: this._config.notifySlackImpl ?? defaultNotifySlack(),
|
|
399
|
+
});
|
|
400
|
+
// ── Session guards ───────────────────────────────────────────────────
|
|
401
|
+
const sessionResult = await this._checkSessionGuards(this._config.sessionGuards ?? []);
|
|
402
|
+
if (!sessionResult.ok) {
|
|
403
|
+
const reason = sessionResult.reason ?? "session_guard";
|
|
404
|
+
sink({
|
|
405
|
+
type: "guard_tripped",
|
|
406
|
+
runId,
|
|
407
|
+
cycleIndex,
|
|
408
|
+
guard: "session",
|
|
409
|
+
reason,
|
|
410
|
+
ts: Date.now(),
|
|
411
|
+
});
|
|
412
|
+
sink({
|
|
413
|
+
type: "cycle_skipped",
|
|
414
|
+
runId,
|
|
415
|
+
cycleIndex,
|
|
416
|
+
reason,
|
|
417
|
+
ts: Date.now(),
|
|
418
|
+
});
|
|
419
|
+
rootSpan.setAttribute("vauban.ooda.status", "skipped");
|
|
420
|
+
rootSpan.setAttribute("vauban.ooda.skip_reason", reason);
|
|
421
|
+
rootSpan.setStatus({ code: SpanStatusCode.OK });
|
|
422
|
+
rootSpan.end();
|
|
423
|
+
this._cyclesCompleted += 1;
|
|
424
|
+
this._lastCycleAt = new Date().toISOString();
|
|
425
|
+
return;
|
|
426
|
+
}
|
|
427
|
+
// ── Risk guards ──────────────────────────────────────────────────────
|
|
428
|
+
const riskResult = await this._checkRiskGuards(this._config.riskGuards ?? [], ctx);
|
|
429
|
+
if (!riskResult.ok) {
|
|
430
|
+
const reason = riskResult.reason ?? "risk_guard";
|
|
431
|
+
sink({
|
|
432
|
+
type: "guard_tripped",
|
|
433
|
+
runId,
|
|
434
|
+
cycleIndex,
|
|
435
|
+
guard: "risk",
|
|
436
|
+
reason,
|
|
437
|
+
ts: Date.now(),
|
|
438
|
+
});
|
|
439
|
+
sink({
|
|
440
|
+
type: "cycle_skipped",
|
|
441
|
+
runId,
|
|
442
|
+
cycleIndex,
|
|
443
|
+
reason,
|
|
444
|
+
ts: Date.now(),
|
|
445
|
+
});
|
|
446
|
+
rootSpan.setAttribute("vauban.ooda.status", "skipped");
|
|
447
|
+
rootSpan.setAttribute("vauban.ooda.skip_reason", reason);
|
|
448
|
+
rootSpan.setStatus({ code: SpanStatusCode.OK });
|
|
449
|
+
rootSpan.end();
|
|
450
|
+
this._cyclesCompleted += 1;
|
|
451
|
+
this._lastCycleAt = new Date().toISOString();
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
// ── Heap watermark ────────────────────────────────────────────────────
|
|
455
|
+
const heapMb = process.memoryUsage().heapUsed / (1024 * 1024);
|
|
456
|
+
if (heapMb > limits.maxHeapMb) {
|
|
457
|
+
const reason = `heap_exceeded:${heapMb.toFixed(1)}mb`;
|
|
458
|
+
sink({
|
|
459
|
+
type: "guard_tripped",
|
|
460
|
+
runId,
|
|
461
|
+
cycleIndex,
|
|
462
|
+
guard: "heap",
|
|
463
|
+
reason,
|
|
464
|
+
ts: Date.now(),
|
|
465
|
+
});
|
|
466
|
+
sink({
|
|
467
|
+
type: "cycle_skipped",
|
|
468
|
+
runId,
|
|
469
|
+
cycleIndex,
|
|
470
|
+
reason,
|
|
471
|
+
ts: Date.now(),
|
|
472
|
+
});
|
|
473
|
+
rootSpan.setAttribute("vauban.ooda.status", "skipped");
|
|
474
|
+
rootSpan.setAttribute("vauban.ooda.skip_reason", reason);
|
|
475
|
+
rootSpan.setStatus({ code: SpanStatusCode.OK });
|
|
476
|
+
rootSpan.end();
|
|
477
|
+
this._cyclesCompleted += 1;
|
|
478
|
+
this._lastCycleAt = new Date().toISOString();
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
// ── Phase runner (single-pass, emits events via sink) ─────────────────
|
|
482
|
+
const runPhaseWithSink = async (phase, input, phaseCtx, phaseOpts) => {
|
|
483
|
+
const phaseName = phase.type;
|
|
484
|
+
const phaseSpan = tracer.startSpan(`ooda.phase.${phaseName}`);
|
|
485
|
+
phaseSpan.setAttribute("vauban.ooda.run_id", runId);
|
|
486
|
+
phaseSpan.setAttribute("vauban.ooda.phase", phaseName);
|
|
487
|
+
sink({
|
|
488
|
+
type: "phase_start",
|
|
489
|
+
runId,
|
|
490
|
+
cycleIndex,
|
|
491
|
+
phase: phaseName,
|
|
492
|
+
ts: Date.now(),
|
|
493
|
+
});
|
|
494
|
+
const phaseStart = Date.now();
|
|
495
|
+
const step = await phaseCtx.insertStep({
|
|
496
|
+
type: phase.type,
|
|
497
|
+
phase: phaseName,
|
|
498
|
+
payload: { input_hash: hashPayload(input) },
|
|
499
|
+
});
|
|
500
|
+
phaseSpan.setAttribute("vauban.ooda.step_id", step.stepId);
|
|
501
|
+
try {
|
|
502
|
+
const out = await withPhaseTimeout(phase.fn(input, phaseCtx), this._limits.phaseTimeoutMs);
|
|
503
|
+
if (phaseOpts?.hitlGate === true && this._config.waitForHITL) {
|
|
504
|
+
sink({
|
|
505
|
+
type: "hitl_waiting",
|
|
506
|
+
runId,
|
|
507
|
+
cycleIndex,
|
|
508
|
+
stepId: step.stepId,
|
|
509
|
+
payloadHash: hashPayload(out),
|
|
510
|
+
ts: Date.now(),
|
|
511
|
+
});
|
|
512
|
+
await this._config.waitForHITL({
|
|
513
|
+
runId: phaseCtx.runId,
|
|
514
|
+
stepId: step.stepId,
|
|
515
|
+
payload: out,
|
|
516
|
+
});
|
|
517
|
+
sink({
|
|
518
|
+
type: "hitl_approved",
|
|
519
|
+
runId,
|
|
520
|
+
cycleIndex,
|
|
521
|
+
stepId: step.stepId,
|
|
522
|
+
ts: Date.now(),
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
await phaseCtx.completeStep(step.stepId, {
|
|
526
|
+
output_hash: hashPayload(out),
|
|
527
|
+
});
|
|
528
|
+
const durationMs = Date.now() - phaseStart;
|
|
529
|
+
phaseSpan.setAttribute("vauban.ooda.phase_duration_ms", durationMs);
|
|
530
|
+
phaseSpan.setStatus({ code: SpanStatusCode.OK });
|
|
531
|
+
phaseSpan.end();
|
|
532
|
+
sink({
|
|
533
|
+
type: "phase_complete",
|
|
534
|
+
runId,
|
|
535
|
+
cycleIndex,
|
|
536
|
+
phase: phaseName,
|
|
537
|
+
durationMs,
|
|
538
|
+
ts: Date.now(),
|
|
539
|
+
});
|
|
540
|
+
return out;
|
|
541
|
+
}
|
|
542
|
+
catch (err) {
|
|
543
|
+
await phaseCtx.errorStep(step.stepId, err);
|
|
544
|
+
const durationMs = Date.now() - phaseStart;
|
|
545
|
+
phaseSpan.setAttribute("vauban.ooda.phase_duration_ms", durationMs);
|
|
546
|
+
phaseSpan.setStatus({
|
|
547
|
+
code: SpanStatusCode.ERROR,
|
|
548
|
+
message: err.message,
|
|
549
|
+
});
|
|
550
|
+
phaseSpan.recordException(err);
|
|
551
|
+
phaseSpan.end();
|
|
552
|
+
sink({
|
|
553
|
+
type: "phase_error",
|
|
554
|
+
runId,
|
|
555
|
+
cycleIndex,
|
|
556
|
+
phase: phaseName,
|
|
557
|
+
error: { message: err.message },
|
|
558
|
+
ts: Date.now(),
|
|
559
|
+
});
|
|
560
|
+
throw err;
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
// ── Phase chain ──────────────────────────────────────────────────────
|
|
564
|
+
try {
|
|
565
|
+
const obs = await runPhaseWithSink(this._config.phases.observe, undefined, ctx);
|
|
566
|
+
const oriented = await runPhaseWithSink(this._config.phases.orient, obs, ctx);
|
|
567
|
+
const decision = await runPhaseWithSink(this._config.phases.decide, oriented, ctx);
|
|
568
|
+
const action = await runPhaseWithSink(this._config.phases.act, decision, ctx, { hitlGate: this._config.phases.act.hitlGate === true });
|
|
569
|
+
// Optional 6th phase — self-critique between act and feedback.
|
|
570
|
+
// When omitted, move directly from act → feedback.
|
|
571
|
+
const reflectInput = action;
|
|
572
|
+
const feedbackInput = this._config.phases.reflect
|
|
573
|
+
? (await runPhaseWithSink(this._config.phases.reflect, { ...reflectInput, decision: decision }, ctx))
|
|
574
|
+
: action;
|
|
575
|
+
const feedback = await runPhaseWithSink(this._config.phases.feedback, feedbackInput, ctx);
|
|
576
|
+
// Outcome mapping (optional, non-fatal in stream mode).
|
|
577
|
+
if (this._config.outcomeMapping) {
|
|
578
|
+
try {
|
|
579
|
+
const outcome = this._config.outcomeMapping(feedback);
|
|
580
|
+
if (outcome) {
|
|
581
|
+
logger.info({ runId, outcome_type: outcome.outcome_type }, "ooda.stream.outcome");
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
catch (e) {
|
|
585
|
+
logger.error({ runId, err: e.message }, "ooda.stream.outcome_mapping_failed");
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
this._cyclesCompleted += 1;
|
|
589
|
+
this._lastCycleAt = new Date().toISOString();
|
|
590
|
+
rootSpan.setAttribute("vauban.ooda.status", "succeeded");
|
|
591
|
+
rootSpan.setAttribute("vauban.ooda.steps", stepsThisCycle);
|
|
592
|
+
rootSpan.setAttribute("vauban.ooda.duration_ms", Date.now() - cycleStart);
|
|
593
|
+
rootSpan.setStatus({ code: SpanStatusCode.OK });
|
|
594
|
+
rootSpan.end();
|
|
595
|
+
sink({
|
|
596
|
+
type: "cycle_complete",
|
|
597
|
+
runId,
|
|
598
|
+
cycleIndex,
|
|
599
|
+
status: "succeeded",
|
|
600
|
+
durationMs: Date.now() - cycleStart,
|
|
601
|
+
ts: Date.now(),
|
|
602
|
+
});
|
|
603
|
+
// ── A4 timestamping (optional, non-blocking) ──────────────────────────
|
|
604
|
+
// TODO(A-DEMO): rootHash will be provided by the Trace builder once A-DEMO
|
|
605
|
+
// wires buildChain() into the cycle. Until then, no TSA call is made.
|
|
606
|
+
//
|
|
607
|
+
// When rootHash is available (A-DEMO integration), replace the block below:
|
|
608
|
+
//
|
|
609
|
+
// if (this._config.timestamping?.when === 'on-cycle-complete') {
|
|
610
|
+
// try {
|
|
611
|
+
// await this._config.timestamping.port.request(rootHash);
|
|
612
|
+
// } catch (tsaErr) {
|
|
613
|
+
// sink({ type: 'timestamp_pending', runId, cycleIndex, rootHash, ts: Date.now() });
|
|
614
|
+
// if (this._config.timestamping.queue &&
|
|
615
|
+
// this._config.timestamping.queueHmacKeyProvider &&
|
|
616
|
+
// this._config.timestamping.queueHmacKeyId) {
|
|
617
|
+
// await this._config.timestamping.queue.enqueue(
|
|
618
|
+
// { runId, rootHash, queuedAt: Date.now() },
|
|
619
|
+
// this._config.timestamping.queueHmacKeyProvider,
|
|
620
|
+
// this._config.timestamping.queueHmacKeyId,
|
|
621
|
+
// ).catch(() => {}); // best-effort
|
|
622
|
+
// }
|
|
623
|
+
// }
|
|
624
|
+
// }
|
|
625
|
+
}
|
|
626
|
+
catch (err) {
|
|
627
|
+
logger.error({ runId, agentId: this._config.agentId, err: err.message }, "ooda.stream.cycle.failed");
|
|
628
|
+
this._cyclesCompleted += 1;
|
|
629
|
+
this._lastCycleAt = new Date().toISOString();
|
|
630
|
+
rootSpan.setAttribute("vauban.ooda.status", "failed");
|
|
631
|
+
rootSpan.setAttribute("vauban.ooda.steps", stepsThisCycle);
|
|
632
|
+
rootSpan.setAttribute("vauban.ooda.duration_ms", Date.now() - cycleStart);
|
|
633
|
+
rootSpan.setStatus({
|
|
634
|
+
code: SpanStatusCode.ERROR,
|
|
635
|
+
message: err.message,
|
|
636
|
+
});
|
|
637
|
+
rootSpan.recordException(err);
|
|
638
|
+
rootSpan.end();
|
|
639
|
+
sink({
|
|
640
|
+
type: "cycle_error",
|
|
641
|
+
runId,
|
|
642
|
+
cycleIndex,
|
|
643
|
+
error: { message: err.message },
|
|
644
|
+
ts: Date.now(),
|
|
645
|
+
});
|
|
646
|
+
sink({
|
|
647
|
+
type: "cycle_complete",
|
|
648
|
+
runId,
|
|
649
|
+
cycleIndex,
|
|
650
|
+
status: "failed",
|
|
651
|
+
durationMs: Date.now() - cycleStart,
|
|
652
|
+
ts: Date.now(),
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Run a single OODA phase with OTel span instrumentation. Used by runCycle().
|
|
658
|
+
*/
|
|
659
|
+
async _runOodaPhase(phase, input, ctx, tracer, opts) {
|
|
660
|
+
const phaseSpan = tracer.startSpan(`ooda.phase.${phase.type}`);
|
|
661
|
+
phaseSpan.setAttribute("vauban.ooda.run_id", ctx.runId);
|
|
662
|
+
phaseSpan.setAttribute("vauban.ooda.phase", phase.type);
|
|
663
|
+
const phaseStart = Date.now();
|
|
664
|
+
const step = await ctx.insertStep({
|
|
665
|
+
type: phase.type,
|
|
666
|
+
phase: phase.type,
|
|
667
|
+
payload: { input_hash: hashPayload(input) },
|
|
668
|
+
});
|
|
669
|
+
phaseSpan.setAttribute("vauban.ooda.step_id", step.stepId);
|
|
670
|
+
try {
|
|
671
|
+
const out = await withPhaseTimeout(phase.fn(input, ctx), this._limits.phaseTimeoutMs);
|
|
672
|
+
if (opts?.hitlGate === true && this._config.waitForHITL) {
|
|
673
|
+
await this._config.waitForHITL({
|
|
674
|
+
runId: ctx.runId,
|
|
675
|
+
stepId: step.stepId,
|
|
676
|
+
payload: out,
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
await ctx.completeStep(step.stepId, {
|
|
680
|
+
output_hash: hashPayload(out),
|
|
681
|
+
});
|
|
682
|
+
phaseSpan.setAttribute("vauban.ooda.phase_duration_ms", Date.now() - phaseStart);
|
|
683
|
+
phaseSpan.setStatus({ code: SpanStatusCode.OK });
|
|
684
|
+
phaseSpan.end();
|
|
685
|
+
return out;
|
|
686
|
+
}
|
|
687
|
+
catch (err) {
|
|
688
|
+
await ctx.errorStep(step.stepId, err);
|
|
689
|
+
phaseSpan.setAttribute("vauban.ooda.phase_duration_ms", Date.now() - phaseStart);
|
|
690
|
+
phaseSpan.setStatus({
|
|
691
|
+
code: SpanStatusCode.ERROR,
|
|
692
|
+
message: err.message,
|
|
693
|
+
});
|
|
694
|
+
phaseSpan.recordException(err);
|
|
695
|
+
phaseSpan.end();
|
|
696
|
+
throw err;
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
async _checkSessionGuards(guards) {
|
|
700
|
+
const now = new Date();
|
|
701
|
+
for (const g of guards) {
|
|
702
|
+
const active = await g.isActive(now);
|
|
703
|
+
if (!active)
|
|
704
|
+
return { ok: false, reason: `session:${g.name}` };
|
|
705
|
+
}
|
|
706
|
+
return { ok: true };
|
|
707
|
+
}
|
|
708
|
+
async _checkRiskGuards(guards, ctx) {
|
|
709
|
+
for (const g of guards) {
|
|
710
|
+
const r = await g.check(ctx);
|
|
711
|
+
if (!r.proceed) {
|
|
712
|
+
return { ok: false, reason: `risk:${g.name}:${r.reason ?? "tripped"}` };
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
return { ok: true };
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
/** Cheap structural hash — just JSON length + first chars, NOT crypto. */
|
|
719
|
+
function hashPayload(v) {
|
|
720
|
+
try {
|
|
721
|
+
const s = JSON.stringify(v);
|
|
722
|
+
if (!s)
|
|
723
|
+
return "null";
|
|
724
|
+
return `len=${s.length}:${s.slice(0, 32)}`;
|
|
725
|
+
}
|
|
726
|
+
catch {
|
|
727
|
+
return "unserializable";
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
//# sourceMappingURL=agent.js.map
|