@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,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shielded inter-agent communication channels — ML-KEM-768 stub.
|
|
3
|
+
*
|
|
4
|
+
* Implements checkpoint 2 of sprint-576:agentic-privacy-impl.
|
|
5
|
+
*
|
|
6
|
+
* Design references:
|
|
7
|
+
* - vauban-privacy-protocol/docs/research/03-agentic-privacy.md — agent privacy design.
|
|
8
|
+
* - vauban-privacy-protocol/docs/research/07-orq-stealth-addressing.md §3.5 — channel-key
|
|
9
|
+
* construction adapted for inter-agent use.
|
|
10
|
+
*
|
|
11
|
+
* STUB note: The key exchange uses a Poseidon-based derivation as a placeholder for
|
|
12
|
+
* ML-KEM-768 (CRYSTALS-Kyber, NIST PQC standard). The stream cipher uses a
|
|
13
|
+
* Poseidon-derived keystream as a placeholder for a proper AEAD (e.g., AES-256-GCM
|
|
14
|
+
* or ChaCha20-Poly1305). Both are deterministic and separation-preserving but NOT
|
|
15
|
+
* cryptographically sound for production use.
|
|
16
|
+
*
|
|
17
|
+
* TODO (ORQ-1): Replace establishChannel with ML-KEM-768 Encaps + Poseidon2 KDF.
|
|
18
|
+
* TODO (ORQ-1): Replace sendOverChannel stream cipher with AES-256-GCM or ChaCha20-Poly1305.
|
|
19
|
+
*
|
|
20
|
+
* @module privacy/channel
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { feltMod, labelToFelt, poseidonHashBigInt } from "./poseidon-felt252.js";
|
|
24
|
+
|
|
25
|
+
// ─── Domain labels ────────────────────────────────────────────────────────────
|
|
26
|
+
|
|
27
|
+
const LABEL_CHANNEL = labelToFelt("vauban-agent-channel-v1");
|
|
28
|
+
const LABEL_CHANNEL_ID = labelToFelt("channel-id");
|
|
29
|
+
const LABEL_KEYSTREAM = labelToFelt("keystream");
|
|
30
|
+
const LABEL_AUTH_TAG = labelToFelt("auth-tag");
|
|
31
|
+
|
|
32
|
+
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A shielded bidirectional channel between two agents.
|
|
36
|
+
*
|
|
37
|
+
* The channel is directional: sender and receiver roles are asymmetric.
|
|
38
|
+
* Swapping sender/receiver produces a different channel_id and shared_secret,
|
|
39
|
+
* preventing cross-direction replay attacks.
|
|
40
|
+
*/
|
|
41
|
+
export interface AgentChannel {
|
|
42
|
+
/** Sender's Starknet public key (felt252). */
|
|
43
|
+
sender_pubkey: bigint;
|
|
44
|
+
/** Receiver's Starknet public key (felt252). */
|
|
45
|
+
receiver_pubkey: bigint;
|
|
46
|
+
/**
|
|
47
|
+
* Channel identifier — derived from the shared secret.
|
|
48
|
+
* Safe to include in message headers (public) without revealing the secret.
|
|
49
|
+
*/
|
|
50
|
+
channel_id: bigint;
|
|
51
|
+
/**
|
|
52
|
+
* Shared secret — output of STUB key exchange (Poseidon-derived).
|
|
53
|
+
* TODO (ORQ-1): Replace with ML-KEM-768 Encaps output + Poseidon2 KDF.
|
|
54
|
+
* NEVER expose on-chain or in logs.
|
|
55
|
+
*/
|
|
56
|
+
shared_secret: bigint;
|
|
57
|
+
/** Unix timestamp (ms) when the channel was established. */
|
|
58
|
+
established_at: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* An encrypted message sent over a shielded agent channel.
|
|
63
|
+
*
|
|
64
|
+
* The integrity tag (`tag`) authenticates `(channel_id, nonce, ciphertext)` using
|
|
65
|
+
* the shared secret. A tampered ciphertext or wrong channel produces a tag mismatch.
|
|
66
|
+
*/
|
|
67
|
+
export interface EncryptedAgentMessage {
|
|
68
|
+
/** Channel this message belongs to (public, used for routing). */
|
|
69
|
+
channel_id: bigint;
|
|
70
|
+
/** Monotonically increasing nonce (felt252). Replay protection. */
|
|
71
|
+
nonce: bigint;
|
|
72
|
+
/** Encrypted payload — XOR of plaintext with Poseidon-derived keystream (STUB). */
|
|
73
|
+
ciphertext: Uint8Array;
|
|
74
|
+
/**
|
|
75
|
+
* HMAC-style authentication tag.
|
|
76
|
+
* tag = Poseidon(shared_secret, nonce, hash(ciphertext)).
|
|
77
|
+
* Verifying this tag before decryption prevents chosen-ciphertext attacks.
|
|
78
|
+
*/
|
|
79
|
+
tag: bigint;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ─── Errors ───────────────────────────────────────────────────────────────────
|
|
83
|
+
|
|
84
|
+
export const ChannelError = {
|
|
85
|
+
/** The message's channel_id does not match the provided channel. */
|
|
86
|
+
MismatchedChannel: "MismatchedChannel",
|
|
87
|
+
/** The authentication tag does not match — ciphertext tampered or wrong key. */
|
|
88
|
+
InvalidTag: "InvalidTag",
|
|
89
|
+
/** The message nonce is not strictly greater than the expected previous nonce. */
|
|
90
|
+
ReplayedNonce: "ReplayedNonce",
|
|
91
|
+
/** Channel has not been established (stub for future async establishment). */
|
|
92
|
+
ChannelNotEstablished: "ChannelNotEstablished",
|
|
93
|
+
} as const;
|
|
94
|
+
|
|
95
|
+
export type ChannelErrorKind = (typeof ChannelError)[keyof typeof ChannelError];
|
|
96
|
+
|
|
97
|
+
// ─── Internal helpers ─────────────────────────────────────────────────────────
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Hash a Uint8Array into a felt252 BigInt for use in the auth tag computation.
|
|
101
|
+
* Uses a simple XOR-folding into felt252 — not a cryptographic hash.
|
|
102
|
+
* TODO (ORQ-1): Replace with Poseidon2 sponge over byte chunks.
|
|
103
|
+
*/
|
|
104
|
+
function hashBytes(bytes: Uint8Array): bigint {
|
|
105
|
+
// Fold byte array into felt252: accumulate in 31-byte (248-bit) chunks.
|
|
106
|
+
let acc = 0n;
|
|
107
|
+
let chunk = 0n;
|
|
108
|
+
let shift = 0n;
|
|
109
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
110
|
+
chunk = chunk | (BigInt(bytes[i] ?? 0) << shift);
|
|
111
|
+
shift += 8n;
|
|
112
|
+
if (shift >= 248n || i === bytes.length - 1) {
|
|
113
|
+
acc = feltMod(acc ^ chunk);
|
|
114
|
+
chunk = 0n;
|
|
115
|
+
shift = 0n;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return acc;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Derive a 248-bit keystream word from the shared secret and a nonce.
|
|
123
|
+
* Used as a one-time pad for a single 31-byte block of plaintext.
|
|
124
|
+
* TODO (ORQ-1): Replace with proper AEAD keystream (ChaCha20-Poly1305 or AES-256-GCM).
|
|
125
|
+
*/
|
|
126
|
+
function deriveKeystreamWord(sharedSecret: bigint, nonce: bigint, blockIndex: bigint): bigint {
|
|
127
|
+
return poseidonHashBigInt([
|
|
128
|
+
feltMod(sharedSecret),
|
|
129
|
+
feltMod(nonce),
|
|
130
|
+
LABEL_KEYSTREAM,
|
|
131
|
+
feltMod(blockIndex),
|
|
132
|
+
]);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ─── Public API ───────────────────────────────────────────────────────────────
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Establish a shielded inter-agent channel.
|
|
139
|
+
*
|
|
140
|
+
* STUB implementation: derives shared_secret via Poseidon over (senderSk, receiverPk,
|
|
141
|
+
* domain label). The channel is directional — sender and receiver roles are asymmetric
|
|
142
|
+
* by design (swapping them produces a different channel_id).
|
|
143
|
+
*
|
|
144
|
+
* TODO (ORQ-1): Replace with ML-KEM-768 Encaps + Poseidon2 KDF per
|
|
145
|
+
* vauban-privacy-protocol/docs/research/07-orq-stealth-addressing.md §3.5.
|
|
146
|
+
*
|
|
147
|
+
* @param senderSk - Sender's secret key (felt252, NEVER expose).
|
|
148
|
+
* @param receiverPk - Receiver's public key (felt252).
|
|
149
|
+
* @returns AgentChannel with shared_secret and channel_id.
|
|
150
|
+
*/
|
|
151
|
+
export function establishChannel(senderSk: bigint, receiverPk: bigint): AgentChannel {
|
|
152
|
+
// TODO: ML-KEM-768 Encaps + Poseidon2 KDF (ORQ-1)
|
|
153
|
+
const senderPk = poseidonHashBigInt([feltMod(senderSk), LABEL_CHANNEL]);
|
|
154
|
+
|
|
155
|
+
const sharedSecret = poseidonHashBigInt([feltMod(senderSk), feltMod(receiverPk), LABEL_CHANNEL]);
|
|
156
|
+
|
|
157
|
+
const channelId = poseidonHashBigInt([sharedSecret, LABEL_CHANNEL_ID]);
|
|
158
|
+
|
|
159
|
+
return {
|
|
160
|
+
sender_pubkey: senderPk,
|
|
161
|
+
receiver_pubkey: feltMod(receiverPk),
|
|
162
|
+
channel_id: channelId,
|
|
163
|
+
shared_secret: sharedSecret,
|
|
164
|
+
established_at: Date.now(),
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Compute the authentication tag for a message.
|
|
170
|
+
*
|
|
171
|
+
* tag = Poseidon(shared_secret, nonce, hash(ciphertext))
|
|
172
|
+
*
|
|
173
|
+
* @param sharedSecret - Channel shared secret (felt252).
|
|
174
|
+
* @param ciphertext - Encrypted payload bytes.
|
|
175
|
+
* @param nonce - Message nonce (felt252).
|
|
176
|
+
* @returns Authentication tag as felt252 BigInt.
|
|
177
|
+
*/
|
|
178
|
+
export function computeAuthTag(
|
|
179
|
+
sharedSecret: bigint,
|
|
180
|
+
ciphertext: Uint8Array,
|
|
181
|
+
nonce: bigint,
|
|
182
|
+
): bigint {
|
|
183
|
+
const ciphertextHash = hashBytes(ciphertext);
|
|
184
|
+
return poseidonHashBigInt([
|
|
185
|
+
feltMod(sharedSecret),
|
|
186
|
+
feltMod(nonce),
|
|
187
|
+
ciphertextHash,
|
|
188
|
+
LABEL_AUTH_TAG,
|
|
189
|
+
]);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Encrypt plaintext and send over a shielded agent channel.
|
|
194
|
+
*
|
|
195
|
+
* Uses a Poseidon-derived keystream (XOR cipher, STUB). The nonce_counter is
|
|
196
|
+
* provided by the caller to support stateless multi-message sessions with replay
|
|
197
|
+
* protection. Each call must use a strictly increasing nonce.
|
|
198
|
+
*
|
|
199
|
+
* TODO (ORQ-1): Replace XOR keystream with ChaCha20-Poly1305 or AES-256-GCM.
|
|
200
|
+
*
|
|
201
|
+
* @param channel - Established AgentChannel.
|
|
202
|
+
* @param plaintext - Plaintext bytes to encrypt.
|
|
203
|
+
* @param nonceCounter - Monotonically increasing nonce (caller-managed). Must be
|
|
204
|
+
* strictly greater than the last nonce used on this channel.
|
|
205
|
+
* @returns EncryptedAgentMessage ready to transmit.
|
|
206
|
+
*/
|
|
207
|
+
export function sendOverChannel(
|
|
208
|
+
channel: AgentChannel,
|
|
209
|
+
plaintext: Uint8Array,
|
|
210
|
+
nonceCounter: bigint,
|
|
211
|
+
): EncryptedAgentMessage {
|
|
212
|
+
const ciphertext = new Uint8Array(plaintext.length);
|
|
213
|
+
const BLOCK_SIZE = 31; // 248 bits — safe within felt252
|
|
214
|
+
|
|
215
|
+
for (let i = 0; i < plaintext.length; i++) {
|
|
216
|
+
const blockIndex = BigInt(Math.floor(i / BLOCK_SIZE));
|
|
217
|
+
const keystreamWord = deriveKeystreamWord(channel.shared_secret, nonceCounter, blockIndex);
|
|
218
|
+
// Extract the byte at position (i % BLOCK_SIZE) from the keystream word.
|
|
219
|
+
const byteOffset = BigInt(i % BLOCK_SIZE);
|
|
220
|
+
const keystreamByte = Number((keystreamWord >> (byteOffset * 8n)) & 0xffn);
|
|
221
|
+
ciphertext[i] = ((plaintext[i] ?? 0) ^ keystreamByte) & 0xff;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const tag = computeAuthTag(channel.shared_secret, ciphertext, nonceCounter);
|
|
225
|
+
|
|
226
|
+
return {
|
|
227
|
+
channel_id: channel.channel_id,
|
|
228
|
+
nonce: nonceCounter,
|
|
229
|
+
ciphertext,
|
|
230
|
+
tag,
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Receive and decrypt a message from a shielded agent channel.
|
|
236
|
+
*
|
|
237
|
+
* Validates:
|
|
238
|
+
* 1. channel_id matches (MismatchedChannel).
|
|
239
|
+
* 2. nonce > expectedNoncePrev (ReplayedNonce).
|
|
240
|
+
* 3. auth tag matches computed tag (InvalidTag).
|
|
241
|
+
*
|
|
242
|
+
* @param channel - Established AgentChannel (must match sender's channel).
|
|
243
|
+
* @param message - EncryptedAgentMessage to decrypt.
|
|
244
|
+
* @param expectedNoncePrev - Last accepted nonce on this channel. The message nonce
|
|
245
|
+
* must be strictly greater than this value.
|
|
246
|
+
* @returns Decrypted plaintext bytes.
|
|
247
|
+
* @throws {ChannelErrorKind} On validation failure.
|
|
248
|
+
*/
|
|
249
|
+
export function receiveOverChannel(
|
|
250
|
+
channel: AgentChannel,
|
|
251
|
+
message: EncryptedAgentMessage,
|
|
252
|
+
expectedNoncePrev: bigint,
|
|
253
|
+
): Uint8Array {
|
|
254
|
+
// 1. Channel ID check (routing validation)
|
|
255
|
+
if (message.channel_id !== channel.channel_id) {
|
|
256
|
+
throw new Error(ChannelError.MismatchedChannel);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// 2. Replay protection: nonce must be strictly increasing
|
|
260
|
+
if (message.nonce <= expectedNoncePrev) {
|
|
261
|
+
throw new Error(ChannelError.ReplayedNonce);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// 3. Auth tag verification (verify before decrypt — authentication first)
|
|
265
|
+
const expectedTag = computeAuthTag(channel.shared_secret, message.ciphertext, message.nonce);
|
|
266
|
+
if (expectedTag !== message.tag) {
|
|
267
|
+
throw new Error(ChannelError.InvalidTag);
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// 4. Decrypt (same XOR keystream as encryption)
|
|
271
|
+
const plaintext = new Uint8Array(message.ciphertext.length);
|
|
272
|
+
const BLOCK_SIZE = 31;
|
|
273
|
+
|
|
274
|
+
for (let i = 0; i < message.ciphertext.length; i++) {
|
|
275
|
+
const blockIndex = BigInt(Math.floor(i / BLOCK_SIZE));
|
|
276
|
+
const keystreamWord = deriveKeystreamWord(channel.shared_secret, message.nonce, blockIndex);
|
|
277
|
+
const byteOffset = BigInt(i % BLOCK_SIZE);
|
|
278
|
+
const keystreamByte = Number((keystreamWord >> (byteOffset * 8n)) & 0xffn);
|
|
279
|
+
plaintext[i] = ((message.ciphertext[i] ?? 0) ^ keystreamByte) & 0xff;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return plaintext;
|
|
283
|
+
}
|
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Multi-agent Claim composition — recursive-AND (∧) operator.
|
|
3
|
+
*
|
|
4
|
+
* Implements checkpoint 4 of sprint-576:agentic-privacy-impl (ORQ-2):
|
|
5
|
+
* - `composeAgents(agents)` produces a recursive-AND ShieldedClaim over n≥2 agents.
|
|
6
|
+
* - n=2: flat pairwise ∧ (no recursion needed).
|
|
7
|
+
* - n≥3: left-fold recursive ∧ placeholder — future STARK aggregation via Stwo.
|
|
8
|
+
*
|
|
9
|
+
* Scenario: identity → credit-score → loan-approval (3 agents)
|
|
10
|
+
* 1. Agent A: verifies identity (Glacis nullifier → pseudonym claim)
|
|
11
|
+
* 2. Agent B: verifies credit (pseudonym + bank data → credit-score claim)
|
|
12
|
+
* 3. Agent C: approves loan (credit-score claim → loan-approval claim)
|
|
13
|
+
* Composition: C_final = ((C_A ∧ C_B) ∧ C_C)
|
|
14
|
+
*
|
|
15
|
+
* References:
|
|
16
|
+
* - docs/research/03-agentic-privacy.md §3 (Scenario 3: Multi-Agent Composition)
|
|
17
|
+
* - docs/research/09-orq-recursive-starks.md §3 (recursive ∧ deferred to Phase 2)
|
|
18
|
+
* - vauban-privacy-protocol/sdk/typescript/src/composition.ts (compose operator pattern)
|
|
19
|
+
*
|
|
20
|
+
* @module privacy/composition
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import {
|
|
24
|
+
type DelegationClaim,
|
|
25
|
+
buildDelegationClaim,
|
|
26
|
+
isDelegationScopeValid,
|
|
27
|
+
} from "./delegation.js";
|
|
28
|
+
import { feltMod, labelToFelt, poseidonHashBigInt } from "./poseidon-felt252.js";
|
|
29
|
+
|
|
30
|
+
// ─── Domain labels ────────────────────────────────────────────────────────────
|
|
31
|
+
|
|
32
|
+
const LABEL_COMPOSE_AND = labelToFelt("vauban-agent-compose-and-v1");
|
|
33
|
+
const LABEL_RECURSIVE = labelToFelt("vauban-recursive-and-v1");
|
|
34
|
+
const LABEL_TRANSCRIPT = labelToFelt("vauban-transcript-v1");
|
|
35
|
+
|
|
36
|
+
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A claim produced by a single agent in a multi-agent workflow.
|
|
40
|
+
*
|
|
41
|
+
* Each `AgentClaim` carries its agent's nullifier (the cryptographic identity
|
|
42
|
+
* of the agent in the HDNT hierarchy) and a role label describing its position
|
|
43
|
+
* in the workflow (e.g. "identity", "credit-score", "loan-approval").
|
|
44
|
+
*
|
|
45
|
+
* The `delegationChain` is optional: when present, it anchors the agent's
|
|
46
|
+
* claim to a parent claim via the Claim Algebra → operator.
|
|
47
|
+
*/
|
|
48
|
+
export interface AgentClaim {
|
|
49
|
+
/** Agent's nullifier (felt252 BigInt). Output of `deriveAgentNullifier`. */
|
|
50
|
+
agentNullifier: bigint;
|
|
51
|
+
/** Role label for this agent in the workflow. Used for domain separation. */
|
|
52
|
+
role: string;
|
|
53
|
+
/** Arbitrary claim payload (predicate, evidence, etc.). */
|
|
54
|
+
payload: Record<string, unknown>;
|
|
55
|
+
/**
|
|
56
|
+
* Optional delegation chain anchoring this claim to a parent.
|
|
57
|
+
* When set, the composition will verify the delegation is still valid.
|
|
58
|
+
*/
|
|
59
|
+
delegationChain?: DelegationClaim;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The composition mode used for a given invocation of `composeAgents`.
|
|
64
|
+
*
|
|
65
|
+
* - `"flat"`: pairwise ∧ for n=2. Proofs are independent (checkpoint 3 style).
|
|
66
|
+
* - `"recursive"`: left-fold recursive ∧ for n≥3. Phase 2 will replace the
|
|
67
|
+
* placeholder with actual Stwo STARK aggregation.
|
|
68
|
+
*/
|
|
69
|
+
export type CompositionMode = "flat" | "recursive";
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* A ShieldedClaim produced by `composeAgents`.
|
|
73
|
+
*
|
|
74
|
+
* The `composedNullifier` is the binding commitment over all participating
|
|
75
|
+
* agents' nullifiers — it changes if any agent is swapped out.
|
|
76
|
+
*
|
|
77
|
+
* The `transcriptDigest` binds the claim to the composition's public inputs
|
|
78
|
+
* (ordered agent roles + composition mode) for external proof anchoring.
|
|
79
|
+
*/
|
|
80
|
+
export interface ShieldedClaim {
|
|
81
|
+
/**
|
|
82
|
+
* Poseidon-derived commitment over all agent nullifiers in order.
|
|
83
|
+
* Different orderings → different composedNullifier (order matters).
|
|
84
|
+
*/
|
|
85
|
+
composedNullifier: bigint;
|
|
86
|
+
/** Merged payload from all agent claims (first agent wins on key conflicts). */
|
|
87
|
+
payload: Record<string, unknown>;
|
|
88
|
+
/** Agent roles in composition order. */
|
|
89
|
+
roles: string[];
|
|
90
|
+
/** Mode used ("flat" for n=2, "recursive" for n≥3). */
|
|
91
|
+
mode: CompositionMode;
|
|
92
|
+
/**
|
|
93
|
+
* Transcript digest: Poseidon(composedNullifier, rolesFelt, LABEL_TRANSCRIPT).
|
|
94
|
+
* Binds the ShieldedClaim to its public inputs for proof anchoring (ORQ-5).
|
|
95
|
+
*/
|
|
96
|
+
transcriptDigest: bigint;
|
|
97
|
+
/**
|
|
98
|
+
* Delegation witnesses for any claims that had a `delegationChain`.
|
|
99
|
+
* Keyed by role label. Empty if no delegations were present.
|
|
100
|
+
*/
|
|
101
|
+
delegationWitnesses: Map<string, DelegationClaim>;
|
|
102
|
+
/** Number of agents composed. */
|
|
103
|
+
n: number;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// ─── Errors ───────────────────────────────────────────────────────────────────
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Error thrown by `composeAgents` on invalid input or constraint violation.
|
|
110
|
+
*/
|
|
111
|
+
export class CompositionError extends Error {
|
|
112
|
+
readonly kind: "EmptyComposition" | "ExpiredDelegation" | "SingleAgent";
|
|
113
|
+
|
|
114
|
+
constructor(kind: "EmptyComposition" | "ExpiredDelegation" | "SingleAgent", message?: string) {
|
|
115
|
+
super(message ?? kind);
|
|
116
|
+
this.kind = kind;
|
|
117
|
+
this.name = "CompositionError";
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ─── Internal helpers ─────────────────────────────────────────────────────────
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Encode an array of role strings as a single felt252 for use in the
|
|
125
|
+
* transcript digest. Roles are XOR-folded with their position index to
|
|
126
|
+
* preserve ordering (different orderings → different felt).
|
|
127
|
+
*/
|
|
128
|
+
function rolesToFelt(roles: string[]): bigint {
|
|
129
|
+
let acc = 0n;
|
|
130
|
+
for (let i = 0; i < roles.length; i++) {
|
|
131
|
+
const roleFelt = labelToFelt(roles[i] ?? "");
|
|
132
|
+
// Mix role felt with position to make ordering matter.
|
|
133
|
+
acc = feltMod(acc ^ (roleFelt + BigInt(i + 1) * 0x1b1b1b1bn));
|
|
134
|
+
}
|
|
135
|
+
return acc;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Pairwise ∧: combine two agent nullifiers into a composed nullifier.
|
|
140
|
+
* Poseidon(a, b, LABEL_COMPOSE_AND) — order-sensitive by construction.
|
|
141
|
+
*/
|
|
142
|
+
function composePair(aNullifier: bigint, bNullifier: bigint): bigint {
|
|
143
|
+
return poseidonHashBigInt([feltMod(aNullifier), feltMod(bNullifier), LABEL_COMPOSE_AND]);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Recursive-AND placeholder for n≥3.
|
|
148
|
+
*
|
|
149
|
+
* Left-fold: ((a ∧ b) ∧ c) ∧ d … with LABEL_RECURSIVE to domain-separate
|
|
150
|
+
* from flat ∧. Phase 2 replaces this with Stwo STARK aggregation proof.
|
|
151
|
+
*
|
|
152
|
+
* TODO (ORQ-2, Phase 2): Replace with real recursive STARK aggregation via Stwo.
|
|
153
|
+
*/
|
|
154
|
+
function composeRecursive(nullifiers: bigint[]): bigint {
|
|
155
|
+
// Seed: Poseidon(first, second, LABEL_RECURSIVE)
|
|
156
|
+
let acc = poseidonHashBigInt([
|
|
157
|
+
feltMod(nullifiers[0] ?? 0n),
|
|
158
|
+
feltMod(nullifiers[1] ?? 0n),
|
|
159
|
+
LABEL_RECURSIVE,
|
|
160
|
+
]);
|
|
161
|
+
// Fold in remaining nullifiers.
|
|
162
|
+
for (let i = 2; i < nullifiers.length; i++) {
|
|
163
|
+
acc = poseidonHashBigInt([acc, feltMod(nullifiers[i] ?? 0n), LABEL_RECURSIVE]);
|
|
164
|
+
}
|
|
165
|
+
return acc;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Merge payloads from all agents (left-to-right, first agent wins on conflict).
|
|
170
|
+
*/
|
|
171
|
+
function mergePayloads(claims: AgentClaim[]): Record<string, unknown> {
|
|
172
|
+
const merged: Record<string, unknown> = {};
|
|
173
|
+
// Iterate in reverse so first agent wins (earlier keys overwrite later).
|
|
174
|
+
for (let i = claims.length - 1; i >= 0; i--) {
|
|
175
|
+
const payload = claims[i]?.payload ?? {};
|
|
176
|
+
for (const [k, v] of Object.entries(payload)) {
|
|
177
|
+
merged[k] = v;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return merged;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// ─── Public API ───────────────────────────────────────────────────────────────
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Compose n≥2 AgentClaims into a single recursive-AND ShieldedClaim.
|
|
187
|
+
*
|
|
188
|
+
* Algorithm:
|
|
189
|
+
* - n=2: flat pairwise ∧ (Poseidon(a, b, LABEL_AND)).
|
|
190
|
+
* - n≥3: left-fold recursive ∧ (Poseidon accumulator with LABEL_RECURSIVE).
|
|
191
|
+
*
|
|
192
|
+
* If any agent claim carries a `delegationChain`, its validity is checked
|
|
193
|
+
* (expiry). Expired delegations cause an `ExpiredDelegation` error.
|
|
194
|
+
*
|
|
195
|
+
* The `transcriptDigest` binds the result to the ordered list of roles and
|
|
196
|
+
* the composedNullifier for external proof anchoring.
|
|
197
|
+
*
|
|
198
|
+
* Example (identity → credit-score → loan-approval, n=3):
|
|
199
|
+
* ```ts
|
|
200
|
+
* const result = composeAgents([identityClaim, creditClaim, loanClaim]);
|
|
201
|
+
* // result.mode === "recursive"
|
|
202
|
+
* // result.n === 3
|
|
203
|
+
* // result.roles === ["identity", "credit-score", "loan-approval"]
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @param agents - Ordered list of AgentClaims (at least 2).
|
|
207
|
+
* @returns ShieldedClaim with composedNullifier, transcriptDigest, and merged payload.
|
|
208
|
+
* @throws {CompositionError} EmptyComposition if agents is empty.
|
|
209
|
+
* @throws {CompositionError} SingleAgent if only 1 agent is provided.
|
|
210
|
+
* @throws {CompositionError} ExpiredDelegation if any delegation chain has expired.
|
|
211
|
+
*/
|
|
212
|
+
export function composeAgents(agents: AgentClaim[]): ShieldedClaim {
|
|
213
|
+
if (agents.length === 0) {
|
|
214
|
+
throw new CompositionError("EmptyComposition", "composeAgents requires at least 2 agents");
|
|
215
|
+
}
|
|
216
|
+
if (agents.length === 1) {
|
|
217
|
+
throw new CompositionError("SingleAgent", "composeAgents requires at least 2 agents, got 1");
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Validate delegation chains.
|
|
221
|
+
const delegationWitnesses = new Map<string, DelegationClaim>();
|
|
222
|
+
for (const agent of agents) {
|
|
223
|
+
if (agent.delegationChain !== undefined) {
|
|
224
|
+
if (!isDelegationScopeValid(agent.delegationChain.scope)) {
|
|
225
|
+
throw new CompositionError(
|
|
226
|
+
"ExpiredDelegation",
|
|
227
|
+
`delegation for role "${agent.role}" has expired`,
|
|
228
|
+
);
|
|
229
|
+
}
|
|
230
|
+
delegationWitnesses.set(agent.role, agent.delegationChain);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const nullifiers = agents.map((a) => a.agentNullifier);
|
|
235
|
+
const roles = agents.map((a) => a.role);
|
|
236
|
+
const n = agents.length;
|
|
237
|
+
|
|
238
|
+
// Compose nullifiers.
|
|
239
|
+
const mode: CompositionMode = n === 2 ? "flat" : "recursive";
|
|
240
|
+
const composedNullifier =
|
|
241
|
+
mode === "flat"
|
|
242
|
+
? composePair(nullifiers[0] ?? 0n, nullifiers[1] ?? 0n)
|
|
243
|
+
: composeRecursive(nullifiers);
|
|
244
|
+
|
|
245
|
+
// Transcript digest — binds composedNullifier + ordered roles + domain label.
|
|
246
|
+
const rolesFelt = rolesToFelt(roles);
|
|
247
|
+
const transcriptDigest = poseidonHashBigInt([composedNullifier, rolesFelt, LABEL_TRANSCRIPT]);
|
|
248
|
+
|
|
249
|
+
// Merge payloads.
|
|
250
|
+
const payload = mergePayloads(agents);
|
|
251
|
+
|
|
252
|
+
return {
|
|
253
|
+
composedNullifier,
|
|
254
|
+
payload,
|
|
255
|
+
roles,
|
|
256
|
+
mode,
|
|
257
|
+
transcriptDigest,
|
|
258
|
+
delegationWitnesses,
|
|
259
|
+
n,
|
|
260
|
+
};
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Build an AgentClaim with an attached DelegationClaim.
|
|
265
|
+
*
|
|
266
|
+
* Convenience factory that calls `buildDelegationClaim` from `delegation.ts`
|
|
267
|
+
* and wires the result into an `AgentClaim.delegationChain`.
|
|
268
|
+
*
|
|
269
|
+
* @param agentNullifier - Derived nullifier of this agent.
|
|
270
|
+
* @param role - Workflow role label.
|
|
271
|
+
* @param payload - Claim payload.
|
|
272
|
+
* @param parentClaimDigest - Parent claim digest bytes (from the authorizing claim).
|
|
273
|
+
* @param scope - Delegation scope (allowed actions + expiry).
|
|
274
|
+
* @returns AgentClaim with populated delegationChain.
|
|
275
|
+
*/
|
|
276
|
+
export function buildAgentClaimWithDelegation(
|
|
277
|
+
agentNullifier: bigint,
|
|
278
|
+
role: string,
|
|
279
|
+
payload: Record<string, unknown>,
|
|
280
|
+
parentClaimDigest: number[],
|
|
281
|
+
scope: { allowedActions: string[]; expiry: number },
|
|
282
|
+
): AgentClaim {
|
|
283
|
+
const delegation = buildDelegationClaim(
|
|
284
|
+
{ digest: parentClaimDigest, "digest-alg": "poseidon-felt252" },
|
|
285
|
+
agentNullifier,
|
|
286
|
+
scope,
|
|
287
|
+
);
|
|
288
|
+
return { agentNullifier, role, payload, delegationChain: delegation };
|
|
289
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Delegation-as-Claim skeleton — agent authorization via Claim Algebra.
|
|
3
|
+
*
|
|
4
|
+
* Implements the delegation operator from §3 of
|
|
5
|
+
* `vauban-privacy-protocol/docs/research/03-agentic-privacy.md`.
|
|
6
|
+
*
|
|
7
|
+
* A DelegationClaim records that a parent Claim (held by a human or another agent)
|
|
8
|
+
* authorizes a delegatee pseudonym to act within a bounded scope and time window.
|
|
9
|
+
*
|
|
10
|
+
* The full ZK proof of delegation (STARK proof walking the chain) is out of scope
|
|
11
|
+
* for this TypeScript slice. This module provides the data structures and builder
|
|
12
|
+
* so the agent SDK can produce delegation-compatible payloads for future proof
|
|
13
|
+
* generation (handled by the Rust HDNT crate).
|
|
14
|
+
*
|
|
15
|
+
* @module privacy/delegation
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
// ─── ClaimRef (local mirror of @vauban/claim ClaimRef) ───────────────────────
|
|
19
|
+
// Deliberately not importing @vauban/claim to avoid adding a new dependency.
|
|
20
|
+
// This mirror type is structurally compatible with the package's ClaimRef.
|
|
21
|
+
// Align with vauban-privacy-protocol/docs/research/03-agentic-privacy.md §3.
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Minimal Claim reference (digest + optional algorithm tag).
|
|
25
|
+
* Structurally compatible with `ClaimRef` from the `@vauban/claim` package.
|
|
26
|
+
*/
|
|
27
|
+
export interface ClaimRef {
|
|
28
|
+
/** SHA-256 or Poseidon-felt252 digest of the parent Claim, as byte array. */
|
|
29
|
+
digest: number[];
|
|
30
|
+
/** Hash algorithm used for the digest. Defaults to "sha-256". */
|
|
31
|
+
"digest-alg"?: "sha-256" | "poseidon-felt252";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// ─── Types ────────────────────────────────────────────────────────────────────
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Scope of actions the delegatee is authorized to perform.
|
|
38
|
+
*
|
|
39
|
+
* - `allowedActions`: action-type identifiers the agent may produce N_action for.
|
|
40
|
+
* Use `["*"]` for unrestricted delegation (max_depth enforcement still applies).
|
|
41
|
+
* - `expiry`: Unix timestamp (seconds) after which this delegation is invalid.
|
|
42
|
+
*/
|
|
43
|
+
export interface DelegationScope {
|
|
44
|
+
allowedActions: string[];
|
|
45
|
+
expiry: number;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Delegation Claim produced by `buildDelegationClaim`.
|
|
50
|
+
*
|
|
51
|
+
* Wire-compatible with the Claim Algebra composition record
|
|
52
|
+
* (`operator: "delegation"`) from `@vauban-org/claim`.
|
|
53
|
+
*/
|
|
54
|
+
export interface DelegationClaim {
|
|
55
|
+
/** Reference to the parent Claim that grants authority. */
|
|
56
|
+
parentClaim: ClaimRef;
|
|
57
|
+
/** Pseudonym (felt252 BigInt as hex string) of the delegatee agent. */
|
|
58
|
+
delegateePseudonym: string;
|
|
59
|
+
/** Authorized scope for the delegatee. */
|
|
60
|
+
scope: DelegationScope;
|
|
61
|
+
/** ISO-8601 timestamp of claim issuance. */
|
|
62
|
+
issuedAt: string;
|
|
63
|
+
/** Serialized scope for inclusion in a STARK proof witness. */
|
|
64
|
+
scopeWitness: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Serialize a DelegationScope to a deterministic JSON witness string.
|
|
71
|
+
* Keys are sorted (JCS-compatible) for reproducibility in proof circuits.
|
|
72
|
+
*/
|
|
73
|
+
export function serializeDelegationScope(scope: DelegationScope): string {
|
|
74
|
+
return JSON.stringify({
|
|
75
|
+
allowedActions: [...scope.allowedActions].sort(),
|
|
76
|
+
expiry: scope.expiry,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Return true if the scope is still valid at the given Unix timestamp.
|
|
82
|
+
*
|
|
83
|
+
* @param scope - DelegationScope to check.
|
|
84
|
+
* @param nowSec - Current time in Unix seconds. Defaults to `Date.now() / 1000`.
|
|
85
|
+
*/
|
|
86
|
+
export function isDelegationScopeValid(
|
|
87
|
+
scope: DelegationScope,
|
|
88
|
+
nowSec: number = Math.floor(Date.now() / 1000),
|
|
89
|
+
): boolean {
|
|
90
|
+
return nowSec < scope.expiry;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Return true if the given action type is permitted by the scope.
|
|
95
|
+
*
|
|
96
|
+
* `["*"]` grants permission to all action types (wildcard).
|
|
97
|
+
*/
|
|
98
|
+
export function isActionAllowed(scope: DelegationScope, actionType: string): boolean {
|
|
99
|
+
return scope.allowedActions.includes("*") || scope.allowedActions.includes(actionType);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// ─── Public API ───────────────────────────────────────────────────────────────
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Build a DelegationClaim from a parent ClaimRef, delegatee pseudonym, and scope.
|
|
106
|
+
*
|
|
107
|
+
* The returned object is a proof-ready payload. The STARK proof of correct
|
|
108
|
+
* delegation (proving the delegation chain without revealing identity) is
|
|
109
|
+
* generated by the Rust HDNT crate from this payload.
|
|
110
|
+
*
|
|
111
|
+
* @param parentClaim - ClaimRef of the root or intermediate claim granting authority.
|
|
112
|
+
* @param delegateePseudonym - Agent nullifier (felt252 BigInt) for the delegatee.
|
|
113
|
+
* @param scope - Authorized action scope and expiry.
|
|
114
|
+
* @returns DelegationClaim ready for proof generation.
|
|
115
|
+
*/
|
|
116
|
+
export function buildDelegationClaim(
|
|
117
|
+
parentClaim: ClaimRef,
|
|
118
|
+
delegateePseudonym: bigint,
|
|
119
|
+
scope: DelegationScope,
|
|
120
|
+
): DelegationClaim {
|
|
121
|
+
return {
|
|
122
|
+
parentClaim,
|
|
123
|
+
delegateePseudonym: `0x${delegateePseudonym.toString(16)}`,
|
|
124
|
+
scope,
|
|
125
|
+
issuedAt: new Date().toISOString(),
|
|
126
|
+
scopeWitness: serializeDelegationScope(scope),
|
|
127
|
+
};
|
|
128
|
+
}
|