@vauban-org/agent-sdk 0.17.4 → 1.2.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 +6401 -813
- package/dist/adapters/llm/anthropic-direct.d.ts +1 -0
- package/dist/adapters/llm/anthropic-direct.d.ts.map +1 -1
- package/dist/adapters/llm/anthropic-direct.js +43 -0
- package/dist/adapters/llm/anthropic-direct.js.map +1 -1
- package/dist/adapters/llm/cascade.d.ts.map +1 -1
- package/dist/adapters/llm/cascade.js +57 -14
- package/dist/adapters/llm/cascade.js.map +1 -1
- package/dist/adapters/llm/litellm.d.ts +2 -0
- package/dist/adapters/llm/litellm.d.ts.map +1 -1
- package/dist/adapters/llm/litellm.js +44 -0
- package/dist/adapters/llm/litellm.js.map +1 -1
- package/dist/compute/difficulty-estimator.d.ts +53 -0
- package/dist/compute/difficulty-estimator.d.ts.map +1 -0
- package/dist/compute/difficulty-estimator.js +82 -0
- package/dist/compute/difficulty-estimator.js.map +1 -0
- package/dist/compute/strategies/mixture-of-agents.d.ts +40 -0
- package/dist/compute/strategies/mixture-of-agents.d.ts.map +1 -0
- package/dist/compute/strategies/mixture-of-agents.js +110 -0
- package/dist/compute/strategies/mixture-of-agents.js.map +1 -0
- package/dist/compute/strategies/tree-of-thoughts.d.ts +48 -0
- package/dist/compute/strategies/tree-of-thoughts.d.ts.map +1 -0
- package/dist/compute/strategies/tree-of-thoughts.js +242 -0
- package/dist/compute/strategies/tree-of-thoughts.js.map +1 -0
- package/dist/compute/strategies/two-phase-orient.d.ts +72 -0
- package/dist/compute/strategies/two-phase-orient.d.ts.map +1 -0
- package/dist/compute/strategies/two-phase-orient.js +85 -0
- package/dist/compute/strategies/two-phase-orient.js.map +1 -0
- package/dist/constitution/types.d.ts +10 -10
- package/dist/container/protocol.d.ts +134 -0
- package/dist/container/protocol.d.ts.map +1 -0
- package/dist/container/protocol.js +157 -0
- package/dist/container/protocol.js.map +1 -0
- package/dist/container/runtime.d.ts +140 -0
- package/dist/container/runtime.d.ts.map +1 -0
- package/dist/container/runtime.js +256 -0
- package/dist/container/runtime.js.map +1 -0
- package/dist/events/catalogue.d.ts +327 -30
- package/dist/events/catalogue.d.ts.map +1 -1
- package/dist/events/catalogue.js +18 -0
- package/dist/events/catalogue.js.map +1 -1
- package/dist/events/index.d.ts +9 -0
- package/dist/events/index.d.ts.map +1 -1
- package/dist/events/index.js +9 -0
- package/dist/events/index.js.map +1 -1
- package/dist/events/schemas/agent.completed.v1.d.ts +4 -4
- package/dist/events/schemas/agent.failed.v1.d.ts +2 -2
- package/dist/events/schemas/agent.hitl_resolved.v1.d.ts +2 -2
- package/dist/events/schemas/agent.started.v1.d.ts +2 -2
- package/dist/events/schemas/brain.skill.extracted.v1.d.ts +4 -4
- package/dist/events/schemas/cc.cost.anomaly_detected.v1.d.ts +2 -2
- package/dist/events/schemas/cc.cost.recorded.v1.d.ts +4 -4
- package/dist/events/schemas/citadel.sprint.analyzed.v1.d.ts +55 -0
- package/dist/events/schemas/citadel.sprint.analyzed.v1.d.ts.map +1 -0
- package/dist/events/schemas/citadel.sprint.analyzed.v1.js +22 -0
- package/dist/events/schemas/citadel.sprint.analyzed.v1.js.map +1 -0
- package/dist/events/schemas/citadel.sprint.closed.v1.d.ts +2 -2
- package/dist/events/schemas/forge.inbox.reply_classified.v1.d.ts +33 -0
- package/dist/events/schemas/forge.inbox.reply_classified.v1.d.ts.map +1 -0
- package/dist/events/schemas/forge.inbox.reply_classified.v1.js +15 -0
- package/dist/events/schemas/forge.inbox.reply_classified.v1.js.map +1 -0
- package/dist/events/schemas/forge.lead.qualified.v1.d.ts +2 -2
- package/dist/events/schemas/forge.outreach.sent.v1.d.ts +4 -4
- package/dist/events/schemas/incident.detected.v1.d.ts +2 -2
- package/dist/events/schemas/vauban-finance.forecast.generated.v1.d.ts +21 -0
- package/dist/events/schemas/vauban-finance.forecast.generated.v1.d.ts.map +1 -0
- package/dist/events/schemas/vauban-finance.forecast.generated.v1.js +11 -0
- package/dist/events/schemas/vauban-finance.forecast.generated.v1.js.map +1 -0
- package/dist/events/schemas/vauban-finance.trade.executed.v1.d.ts +24 -0
- package/dist/events/schemas/vauban-finance.trade.executed.v1.d.ts.map +1 -0
- package/dist/events/schemas/vauban-finance.trade.executed.v1.js +12 -0
- package/dist/events/schemas/vauban-finance.trade.executed.v1.js.map +1 -0
- package/dist/events/schemas/vauban.goal.checked.v1.d.ts +21 -0
- package/dist/events/schemas/vauban.goal.checked.v1.d.ts.map +1 -0
- package/dist/events/schemas/vauban.goal.checked.v1.js +11 -0
- package/dist/events/schemas/vauban.goal.checked.v1.js.map +1 -0
- package/dist/events/schemas/vauban.rebalancing.checked.v1.d.ts +21 -0
- package/dist/events/schemas/vauban.rebalancing.checked.v1.d.ts.map +1 -0
- package/dist/events/schemas/vauban.rebalancing.checked.v1.js +11 -0
- package/dist/events/schemas/vauban.rebalancing.checked.v1.js.map +1 -0
- package/dist/events/schemas/vauban.tax.checked.v1.d.ts +21 -0
- package/dist/events/schemas/vauban.tax.checked.v1.d.ts.map +1 -0
- package/dist/events/schemas/vauban.tax.checked.v1.js +11 -0
- package/dist/events/schemas/vauban.tax.checked.v1.js.map +1 -0
- package/dist/events/schemas/vauban.vault.analyzed.v1.d.ts +59 -0
- package/dist/events/schemas/vauban.vault.analyzed.v1.d.ts.map +1 -0
- package/dist/events/schemas/vauban.vault.analyzed.v1.js +19 -0
- package/dist/events/schemas/vauban.vault.analyzed.v1.js.map +1 -0
- package/dist/events/schemas/vauban.vault.compounded.v1.d.ts +24 -0
- package/dist/events/schemas/vauban.vault.compounded.v1.d.ts.map +1 -0
- package/dist/events/schemas/vauban.vault.compounded.v1.js +12 -0
- package/dist/events/schemas/vauban.vault.compounded.v1.js.map +1 -0
- package/dist/identity/agent-persona.d.ts +73 -0
- package/dist/identity/agent-persona.d.ts.map +1 -0
- package/dist/identity/agent-persona.js +165 -0
- package/dist/identity/agent-persona.js.map +1 -0
- package/dist/identity/persona-prompt.d.ts +25 -0
- package/dist/identity/persona-prompt.d.ts.map +1 -0
- package/dist/identity/persona-prompt.js +71 -0
- package/dist/identity/persona-prompt.js.map +1 -0
- package/dist/identity/persona-schema.d.ts +120 -0
- package/dist/identity/persona-schema.d.ts.map +1 -0
- package/dist/identity/persona-schema.js +103 -0
- package/dist/identity/persona-schema.js.map +1 -0
- package/dist/index.d.ts +37 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29 -1
- package/dist/index.js.map +1 -1
- package/dist/loop/index.d.ts +1 -1
- package/dist/loop/index.d.ts.map +1 -1
- package/dist/loop/index.js.map +1 -1
- package/dist/loop/minimal-loop.js +293 -287
- package/dist/loop/sdk-loop.d.ts +1 -3
- package/dist/loop/sdk-loop.d.ts.map +1 -1
- package/dist/loop/sdk-loop.js +1 -1
- package/dist/loop/sdk-loop.js.map +1 -1
- package/dist/memory/episodic-rrf.d.ts +114 -0
- package/dist/memory/episodic-rrf.d.ts.map +1 -0
- package/dist/memory/episodic-rrf.js +148 -0
- package/dist/memory/episodic-rrf.js.map +1 -0
- package/dist/mesh/attenuation.d.ts +78 -0
- package/dist/mesh/attenuation.d.ts.map +1 -0
- package/dist/mesh/attenuation.js +141 -0
- package/dist/mesh/attenuation.js.map +1 -0
- package/dist/mesh/delegate.d.ts +96 -0
- package/dist/mesh/delegate.d.ts.map +1 -0
- package/dist/mesh/delegate.js +172 -0
- package/dist/mesh/delegate.js.map +1 -0
- package/dist/mesh/dispatcher.d.ts +119 -0
- package/dist/mesh/dispatcher.d.ts.map +1 -0
- package/dist/mesh/dispatcher.js +207 -0
- package/dist/mesh/dispatcher.js.map +1 -0
- package/dist/mesh/index.d.ts +12 -0
- package/dist/mesh/index.d.ts.map +1 -0
- package/dist/mesh/index.js +11 -0
- package/dist/mesh/index.js.map +1 -0
- package/dist/mesh/types.d.ts +30 -0
- package/dist/mesh/types.d.ts.map +1 -0
- package/dist/mesh/types.js +11 -0
- package/dist/mesh/types.js.map +1 -0
- package/dist/orchestration/ooda/skills.d.ts +104 -0
- package/dist/orchestration/ooda/skills.d.ts.map +1 -1
- package/dist/orchestration/ooda/skills.js +106 -0
- package/dist/orchestration/ooda/skills.js.map +1 -1
- package/dist/orchestration/ooda/types.d.ts +3 -8
- package/dist/orchestration/ooda/types.d.ts.map +1 -1
- package/dist/ports/bastion-action.contract.test.d.ts +11 -0
- package/dist/ports/bastion-action.contract.test.d.ts.map +1 -0
- package/dist/ports/bastion-action.contract.test.js +238 -0
- package/dist/ports/bastion-action.contract.test.js.map +1 -0
- package/dist/ports/bastion-action.d.ts +133 -0
- package/dist/ports/bastion-action.d.ts.map +1 -0
- package/dist/ports/bastion-action.js +73 -0
- package/dist/ports/bastion-action.js.map +1 -0
- package/dist/ports/brain.d.ts +31 -0
- package/dist/ports/brain.d.ts.map +1 -1
- package/dist/ports/brain.js +115 -1
- package/dist/ports/brain.js.map +1 -1
- package/dist/ports/citadel-action.contract.test.d.ts +11 -0
- package/dist/ports/citadel-action.contract.test.d.ts.map +1 -0
- package/dist/ports/citadel-action.contract.test.js +317 -0
- package/dist/ports/citadel-action.contract.test.js.map +1 -0
- package/dist/ports/citadel-action.d.ts +111 -0
- package/dist/ports/citadel-action.d.ts.map +1 -0
- package/dist/ports/citadel-action.js +62 -0
- package/dist/ports/citadel-action.js.map +1 -0
- package/dist/ports/compliance-contract.d.ts +123 -0
- package/dist/ports/compliance-contract.d.ts.map +1 -0
- package/dist/ports/compliance-contract.js +35 -0
- package/dist/ports/compliance-contract.js.map +1 -0
- package/dist/ports/db.d.ts +38 -0
- package/dist/ports/db.d.ts.map +1 -1
- package/dist/ports/db.js +88 -1
- package/dist/ports/db.js.map +1 -1
- package/dist/ports/delegation.contract.test.d.ts +9 -0
- package/dist/ports/delegation.contract.test.d.ts.map +1 -0
- package/dist/ports/delegation.contract.test.js +337 -0
- package/dist/ports/delegation.contract.test.js.map +1 -0
- package/dist/ports/delegation.d.ts +134 -0
- package/dist/ports/delegation.d.ts.map +1 -0
- package/dist/ports/delegation.js +105 -0
- package/dist/ports/delegation.js.map +1 -0
- package/dist/ports/event-bus.d.ts +29 -13
- package/dist/ports/event-bus.d.ts.map +1 -1
- package/dist/ports/event-bus.js +106 -1
- package/dist/ports/event-bus.js.map +1 -1
- package/dist/ports/federation.contract.test.d.ts +9 -0
- package/dist/ports/federation.contract.test.d.ts.map +1 -0
- package/dist/ports/federation.contract.test.js +279 -0
- package/dist/ports/federation.contract.test.js.map +1 -0
- package/dist/ports/federation.d.ts +140 -0
- package/dist/ports/federation.d.ts.map +1 -0
- package/dist/ports/federation.js +57 -0
- package/dist/ports/federation.js.map +1 -0
- package/dist/ports/index.d.ts +28 -2
- package/dist/ports/index.d.ts.map +1 -1
- package/dist/ports/index.js +17 -2
- package/dist/ports/index.js.map +1 -1
- package/dist/ports/llm-provider.d.ts +37 -0
- package/dist/ports/llm-provider.d.ts.map +1 -1
- package/dist/ports/llm-provider.js +99 -1
- package/dist/ports/llm-provider.js.map +1 -1
- package/dist/ports/logger.d.ts +27 -0
- package/dist/ports/logger.d.ts.map +1 -1
- package/dist/ports/logger.js +87 -0
- package/dist/ports/logger.js.map +1 -1
- package/dist/ports/manifest-registry.contract.test.d.ts +9 -0
- package/dist/ports/manifest-registry.contract.test.d.ts.map +1 -0
- package/dist/ports/manifest-registry.contract.test.js +246 -0
- package/dist/ports/manifest-registry.contract.test.js.map +1 -0
- package/dist/ports/manifest-registry.d.ts +116 -0
- package/dist/ports/manifest-registry.d.ts.map +1 -0
- package/dist/ports/manifest-registry.js +79 -0
- package/dist/ports/manifest-registry.js.map +1 -0
- package/dist/ports/observability.contract.test.d.ts +12 -0
- package/dist/ports/observability.contract.test.d.ts.map +1 -0
- package/dist/ports/observability.contract.test.js +260 -0
- package/dist/ports/observability.contract.test.js.map +1 -0
- package/dist/ports/observability.d.ts +98 -0
- package/dist/ports/observability.d.ts.map +1 -0
- package/dist/ports/observability.js +59 -0
- package/dist/ports/observability.js.map +1 -0
- package/dist/ports/outcome.d.ts +26 -0
- package/dist/ports/outcome.d.ts.map +1 -1
- package/dist/ports/outcome.js +62 -1
- package/dist/ports/outcome.js.map +1 -1
- package/dist/ports/privacy.contract.test.d.ts +12 -0
- package/dist/ports/privacy.contract.test.d.ts.map +1 -0
- package/dist/ports/privacy.contract.test.js +325 -0
- package/dist/ports/privacy.contract.test.js.map +1 -0
- package/dist/ports/privacy.d.ts +132 -0
- package/dist/ports/privacy.d.ts.map +1 -0
- package/dist/ports/privacy.js +83 -0
- package/dist/ports/privacy.js.map +1 -0
- package/dist/ports/tenant-context.contract.test.d.ts +14 -0
- package/dist/ports/tenant-context.contract.test.d.ts.map +1 -0
- package/dist/ports/tenant-context.contract.test.js +352 -0
- package/dist/ports/tenant-context.contract.test.js.map +1 -0
- package/dist/ports/tenant-context.d.ts +103 -0
- package/dist/ports/tenant-context.d.ts.map +1 -0
- package/dist/ports/tenant-context.js +48 -0
- package/dist/ports/tenant-context.js.map +1 -0
- package/dist/ports/vauban-finance-action.contract.test.d.ts +11 -0
- package/dist/ports/vauban-finance-action.contract.test.d.ts.map +1 -0
- package/dist/ports/vauban-finance-action.contract.test.js +260 -0
- package/dist/ports/vauban-finance-action.contract.test.js.map +1 -0
- package/dist/ports/vauban-finance-action.d.ts +106 -0
- package/dist/ports/vauban-finance-action.d.ts.map +1 -0
- package/dist/ports/vauban-finance-action.js +60 -0
- package/dist/ports/vauban-finance-action.js.map +1 -0
- package/dist/ports/workflow-runtime.d.ts +204 -0
- package/dist/ports/workflow-runtime.d.ts.map +1 -0
- package/dist/ports/workflow-runtime.js +72 -0
- package/dist/ports/workflow-runtime.js.map +1 -0
- package/dist/proof/cert-verify.d.ts +80 -0
- package/dist/proof/cert-verify.d.ts.map +1 -0
- package/dist/proof/cert-verify.js +178 -0
- package/dist/proof/cert-verify.js.map +1 -0
- package/dist/replay/replay.d.ts.map +1 -1
- package/dist/replay/replay.js +5 -1
- package/dist/replay/replay.js.map +1 -1
- package/dist/retry/index.d.ts +129 -0
- package/dist/retry/index.d.ts.map +1 -0
- package/dist/retry/index.js +156 -0
- package/dist/retry/index.js.map +1 -0
- package/dist/retry/presets.d.ts +39 -0
- package/dist/retry/presets.d.ts.map +1 -0
- package/dist/retry/presets.js +69 -0
- package/dist/retry/presets.js.map +1 -0
- package/dist/skill-loop/ab-runner.d.ts +67 -0
- package/dist/skill-loop/ab-runner.d.ts.map +1 -0
- package/dist/skill-loop/ab-runner.js +160 -0
- package/dist/skill-loop/ab-runner.js.map +1 -0
- package/dist/skill-loop/adoption.d.ts +67 -0
- package/dist/skill-loop/adoption.d.ts.map +1 -0
- package/dist/skill-loop/adoption.js +126 -0
- package/dist/skill-loop/adoption.js.map +1 -0
- package/dist/skill-loop/candidate.d.ts +45 -0
- package/dist/skill-loop/candidate.d.ts.map +1 -0
- package/dist/skill-loop/candidate.js +43 -0
- package/dist/skill-loop/candidate.js.map +1 -0
- package/dist/skill-loop/evaluator.d.ts +42 -0
- package/dist/skill-loop/evaluator.d.ts.map +1 -0
- package/dist/skill-loop/evaluator.js +184 -0
- package/dist/skill-loop/evaluator.js.map +1 -0
- package/dist/skill-loop/index.d.ts +27 -0
- package/dist/skill-loop/index.d.ts.map +1 -0
- package/dist/skill-loop/index.js +27 -0
- package/dist/skill-loop/index.js.map +1 -0
- package/dist/skill-loop/reflexion-replay.d.ts +87 -0
- package/dist/skill-loop/reflexion-replay.d.ts.map +1 -0
- package/dist/skill-loop/reflexion-replay.js +110 -0
- package/dist/skill-loop/reflexion-replay.js.map +1 -0
- package/dist/skill-loop/sign-off.d.ts +88 -0
- package/dist/skill-loop/sign-off.d.ts.map +1 -0
- package/dist/skill-loop/sign-off.js +146 -0
- package/dist/skill-loop/sign-off.js.map +1 -0
- package/dist/skill-loop/value-metric.d.ts +55 -0
- package/dist/skill-loop/value-metric.d.ts.map +1 -0
- package/dist/skill-loop/value-metric.js +69 -0
- package/dist/skill-loop/value-metric.js.map +1 -0
- package/dist/skill-loop/versioning.d.ts +36 -0
- package/dist/skill-loop/versioning.d.ts.map +1 -0
- package/dist/skill-loop/versioning.js +47 -0
- package/dist/skill-loop/versioning.js.map +1 -0
- package/dist/skill-manifest/anchor.d.ts +91 -0
- package/dist/skill-manifest/anchor.d.ts.map +1 -0
- package/dist/skill-manifest/anchor.js +331 -0
- package/dist/skill-manifest/anchor.js.map +1 -0
- package/dist/skill-manifest/builder.d.ts +47 -0
- package/dist/skill-manifest/builder.d.ts.map +1 -0
- package/dist/skill-manifest/builder.js +93 -0
- package/dist/skill-manifest/builder.js.map +1 -0
- package/dist/skill-manifest/index.d.ts +13 -0
- package/dist/skill-manifest/index.d.ts.map +1 -0
- package/dist/skill-manifest/index.js +9 -0
- package/dist/skill-manifest/index.js.map +1 -0
- package/dist/skill-manifest/types.d.ts +67 -0
- package/dist/skill-manifest/types.d.ts.map +1 -0
- package/dist/skill-manifest/types.js +16 -0
- package/dist/skill-manifest/types.js.map +1 -0
- package/dist/skill-manifest/verifier.d.ts +42 -0
- package/dist/skill-manifest/verifier.d.ts.map +1 -0
- package/dist/skill-manifest/verifier.js +136 -0
- package/dist/skill-manifest/verifier.js.map +1 -0
- package/dist/skills/brain-query.d.ts +4 -4
- package/dist/skills/brain-store.d.ts +6 -6
- package/dist/skills/errors.d.ts +15 -0
- package/dist/skills/errors.d.ts.map +1 -1
- package/dist/skills/errors.js +21 -0
- package/dist/skills/errors.js.map +1 -1
- package/dist/skills/hitl-request.d.ts +2 -2
- package/dist/skills/index.d.ts +3 -1
- package/dist/skills/index.d.ts.map +1 -1
- package/dist/skills/index.js +4 -1
- package/dist/skills/index.js.map +1 -1
- package/dist/skills/markdown/loader.d.ts +52 -0
- package/dist/skills/markdown/loader.d.ts.map +1 -0
- package/dist/skills/markdown/loader.js +93 -0
- package/dist/skills/markdown/loader.js.map +1 -0
- package/dist/skills/markdown/schema.d.ts +432 -0
- package/dist/skills/markdown/schema.d.ts.map +1 -0
- package/dist/skills/markdown/schema.js +121 -0
- package/dist/skills/markdown/schema.js.map +1 -0
- package/dist/skills/poc-md-loader/markdown-loader.d.ts +77 -0
- package/dist/skills/poc-md-loader/markdown-loader.d.ts.map +1 -0
- package/dist/skills/poc-md-loader/markdown-loader.js +125 -0
- package/dist/skills/poc-md-loader/markdown-loader.js.map +1 -0
- package/dist/skills/poc-md-loader/runner.d.ts +24 -0
- package/dist/skills/poc-md-loader/runner.d.ts.map +1 -0
- package/dist/skills/poc-md-loader/runner.js +57 -0
- package/dist/skills/poc-md-loader/runner.js.map +1 -0
- package/dist/skills/poc-md-loader/vitest.poc.config.d.ts +3 -0
- package/dist/skills/poc-md-loader/vitest.poc.config.d.ts.map +1 -0
- package/dist/skills/poc-md-loader/vitest.poc.config.js +13 -0
- package/dist/skills/poc-md-loader/vitest.poc.config.js.map +1 -0
- package/dist/skills/poc-md-loader/web-search/script.d.ts +33 -0
- package/dist/skills/poc-md-loader/web-search/script.d.ts.map +1 -0
- package/dist/skills/poc-md-loader/web-search/script.js +75 -0
- package/dist/skills/poc-md-loader/web-search/script.js.map +1 -0
- package/dist/skills/record-outcome.d.ts +4 -4
- package/dist/skills/send-email.d.ts.map +1 -1
- package/dist/skills/send-email.js +15 -3
- package/dist/skills/send-email.js.map +1 -1
- package/dist/skills/slack-notify.d.ts +4 -4
- package/dist/skills/starknet-balance.d.ts +1 -1
- package/dist/skills/telegram-notify.d.ts +4 -4
- package/dist/skills/web-search.d.ts +1 -1
- package/dist/testing/contracts/event-bus.contract.d.ts.map +1 -1
- package/dist/testing/contracts/event-bus.contract.js +14 -12
- package/dist/testing/contracts/event-bus.contract.js.map +1 -1
- package/dist/testing/index.d.ts +3 -0
- package/dist/testing/test-brain-port.d.ts +4 -0
- package/dist/testing/test-brain-port.d.ts.map +1 -1
- package/dist/testing/test-brain-port.js +75 -20
- package/dist/testing/test-brain-port.js.map +1 -1
- package/dist/testing/test-event-bus.d.ts.map +1 -1
- package/dist/testing/test-event-bus.js +89 -36
- package/dist/testing/test-event-bus.js.map +1 -1
- package/dist/trace/schema.d.ts +1 -1
- package/dist/trace/schema.d.ts.map +1 -1
- package/dist/trace/schema.js +1 -1
- package/dist/trace/schema.js.map +1 -1
- package/dist/verify/formal/index.d.ts +44 -0
- package/dist/verify/formal/index.d.ts.map +1 -0
- package/dist/verify/formal/index.js +98 -0
- package/dist/verify/formal/index.js.map +1 -0
- package/dist/verify/formal/policy.d.ts +105 -0
- package/dist/verify/formal/policy.d.ts.map +1 -0
- package/dist/verify/formal/policy.js +159 -0
- package/dist/verify/formal/policy.js.map +1 -0
- package/dist/verify/formal/result.d.ts +50 -0
- package/dist/verify/formal/result.d.ts.map +1 -0
- package/dist/verify/formal/result.js +21 -0
- package/dist/verify/formal/result.js.map +1 -0
- package/dist/verify/formal/solver.d.ts +67 -0
- package/dist/verify/formal/solver.d.ts.map +1 -0
- package/dist/verify/formal/solver.js +184 -0
- package/dist/verify/formal/solver.js.map +1 -0
- package/dist/verify/formal/spec-language.d.ts +80 -0
- package/dist/verify/formal/spec-language.d.ts.map +1 -0
- package/dist/verify/formal/spec-language.js +219 -0
- package/dist/verify/formal/spec-language.js.map +1 -0
- package/docs/attestation.md +199 -0
- package/docs/identity.md +193 -0
- package/package.json +22 -1
- package/src/adapters/llm/anthropic-direct.ts +51 -0
- package/src/adapters/llm/cascade.ts +64 -19
- package/src/adapters/llm/litellm.ts +49 -0
- package/src/compute/difficulty-estimator.ts +111 -0
- package/src/compute/strategies/mixture-of-agents.ts +150 -0
- package/src/compute/strategies/tree-of-thoughts.ts +293 -0
- package/src/compute/strategies/two-phase-orient.ts +147 -0
- package/src/container/protocol.ts +243 -0
- package/src/container/runtime.ts +424 -0
- package/src/db/migrations/026_formal_verify_results.sql +30 -0
- package/src/events/catalogue.ts +54 -0
- package/src/events/index.ts +9 -0
- package/src/events/schemas/citadel.sprint.analyzed.v1.ts +23 -0
- package/src/events/schemas/forge.inbox.reply_classified.v1.ts +15 -0
- package/src/events/schemas/vauban-finance.forecast.generated.v1.ts +11 -0
- package/src/events/schemas/vauban-finance.trade.executed.v1.ts +12 -0
- package/src/events/schemas/vauban.goal.checked.v1.ts +11 -0
- package/src/events/schemas/vauban.rebalancing.checked.v1.ts +11 -0
- package/src/events/schemas/vauban.tax.checked.v1.ts +11 -0
- package/src/events/schemas/vauban.vault.analyzed.v1.ts +21 -0
- package/src/events/schemas/vauban.vault.compounded.v1.ts +12 -0
- package/src/identity/agent-persona.ts +203 -0
- package/src/identity/persona-prompt.ts +84 -0
- package/src/identity/persona-schema.ts +127 -0
- package/src/index.ts +338 -1
- package/src/loop/index.ts +0 -1
- package/src/loop/sdk-loop.ts +5 -8
- package/src/memory/episodic-rrf.ts +224 -0
- package/src/mesh/attenuation.ts +190 -0
- package/src/mesh/delegate.ts +254 -0
- package/src/mesh/dispatcher.ts +301 -0
- package/src/mesh/index.ts +39 -0
- package/src/mesh/types.ts +31 -0
- package/src/orchestration/ooda/skills.ts +177 -0
- package/src/orchestration/ooda/types.ts +3 -9
- package/src/ports/bastion-action.contract.test.ts +355 -0
- package/src/ports/bastion-action.ts +198 -0
- package/src/ports/brain.ts +177 -15
- package/src/ports/citadel-action.contract.test.ts +430 -0
- package/src/ports/citadel-action.ts +174 -0
- package/src/ports/compliance-contract.ts +191 -0
- package/src/ports/db.ts +98 -0
- package/src/ports/delegation.contract.test.ts +428 -0
- package/src/ports/delegation.ts +211 -0
- package/src/ports/event-bus.ts +133 -18
- package/src/ports/federation.contract.test.ts +355 -0
- package/src/ports/federation.ts +190 -0
- package/src/ports/index.ts +186 -1
- package/src/ports/llm-provider.ts +123 -0
- package/src/ports/logger.ts +104 -0
- package/src/ports/manifest-registry.contract.test.ts +324 -0
- package/src/ports/manifest-registry.ts +188 -0
- package/src/ports/observability.contract.test.ts +315 -0
- package/src/ports/observability.ts +150 -0
- package/src/ports/outcome.ts +69 -0
- package/src/ports/privacy.contract.test.ts +413 -0
- package/src/ports/privacy.ts +207 -0
- package/src/ports/tenant-context.contract.test.ts +454 -0
- package/src/ports/tenant-context.ts +150 -0
- package/src/ports/vauban-finance-action.contract.test.ts +335 -0
- package/src/ports/vauban-finance-action.ts +166 -0
- package/src/ports/workflow-runtime.ts +327 -0
- package/src/proof/cert-verify.ts +249 -0
- package/src/replay/replay.ts +11 -8
- package/src/retry/index.ts +227 -0
- package/src/retry/presets.ts +75 -0
- package/src/skill-loop/ab-runner.ts +196 -0
- package/src/skill-loop/adoption.ts +188 -0
- package/src/skill-loop/candidate.ts +75 -0
- package/src/skill-loop/evaluator.ts +238 -0
- package/src/skill-loop/index.ts +51 -0
- package/src/skill-loop/reflexion-replay.ts +173 -0
- package/src/skill-loop/sign-off.ts +247 -0
- package/src/skill-loop/value-metric.ts +120 -0
- package/src/skill-loop/versioning.ts +75 -0
- package/src/skill-manifest/anchor.ts +401 -0
- package/src/skill-manifest/builder.ts +129 -0
- package/src/skill-manifest/index.ts +18 -0
- package/src/skill-manifest/types.ts +72 -0
- package/src/skill-manifest/verifier.ts +198 -0
- package/src/skills/errors.ts +30 -2
- package/src/skills/index.ts +19 -0
- package/src/skills/markdown/loader.ts +129 -0
- package/src/skills/markdown/schema.ts +144 -0
- package/src/skills/poc-md-loader/e2e-parity.test.ts +237 -0
- package/src/skills/poc-md-loader/markdown-loader.ts +161 -0
- package/src/skills/poc-md-loader/runner.ts +82 -0
- package/src/skills/poc-md-loader/vitest.poc.config.ts +13 -0
- package/src/skills/poc-md-loader/web-search/SKILL.md +42 -0
- package/src/skills/poc-md-loader/web-search/script.ts +109 -0
- package/src/skills/send-email.ts +15 -3
- package/src/testing/contracts/event-bus.contract.ts +16 -14
- package/src/testing/test-brain-port.ts +98 -24
- package/src/testing/test-event-bus.ts +104 -43
- package/src/trace/schema.ts +1 -1
- package/src/verify/formal/index.ts +154 -0
- package/src/verify/formal/policy.ts +253 -0
- package/src/verify/formal/result.ts +52 -0
- package/src/verify/formal/solver.ts +235 -0
- package/src/verify/formal/spec-language.ts +274 -0
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* src/verify/formal/spec-language.ts
|
|
3
|
+
*
|
|
4
|
+
* Sprint-587 — DSL for axiom specifications, compiled to SMT-LIB v2.
|
|
5
|
+
*
|
|
6
|
+
* Design philosophy (inspired by FormalJudge, arXiv:2602.11136) : agent-cycle
|
|
7
|
+
* properties are expressed as small, typed pre/post-condition tuples. Each
|
|
8
|
+
* condition is mapped to an SMT-LIB fragment by {@link compileToSmt}, which
|
|
9
|
+
* frames the property as a NEGATION of the post-conditions under the
|
|
10
|
+
* pre-conditions. This way, Z3 returning `sat` means a counterexample exists
|
|
11
|
+
* (= UNSAFE) and `unsat` means the post-conditions hold (= SAFE).
|
|
12
|
+
*
|
|
13
|
+
* Bound types : Reals for budgets and ratios, Bools for binary properties,
|
|
14
|
+
* Sets-as-symbols for scope subset checks.
|
|
15
|
+
*
|
|
16
|
+
* @module verify/formal/spec-language
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* One verifiable axiom-level property.
|
|
21
|
+
*/
|
|
22
|
+
export interface AxiomSpec {
|
|
23
|
+
/** Human-readable axiom label (e.g. "Robuste", "Profitable"). */
|
|
24
|
+
axiom: string;
|
|
25
|
+
/** Conditions that must hold for the spec to be meaningful. */
|
|
26
|
+
preconditions: Condition[];
|
|
27
|
+
/** Conditions whose conjunction defines the post-state to verify. */
|
|
28
|
+
postconditions: Condition[];
|
|
29
|
+
/** Solver timeout in ms — see {@link DEFAULT_POLICIES}. */
|
|
30
|
+
timeout_ms?: number;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Tagged union of all supported condition kinds.
|
|
35
|
+
*
|
|
36
|
+
* `custom_smt` is the escape hatch : the consumer supplies a raw SMT-LIB
|
|
37
|
+
* fragment that will be inlined under an `(assert ...)`. Use sparingly —
|
|
38
|
+
* mistakes here are silent semantic bugs.
|
|
39
|
+
*/
|
|
40
|
+
export type Condition =
|
|
41
|
+
| { type: "budget_constraint"; child_max_fraction: number }
|
|
42
|
+
| { type: "scope_subset"; parent_scope: string[]; child_scope: string[] }
|
|
43
|
+
| { type: "no_pii_in_output"; pii_count_var?: string }
|
|
44
|
+
| { type: "cost_positive_roi"; min_roi_ratio: number }
|
|
45
|
+
| { type: "response_time"; max_ms: number }
|
|
46
|
+
| { type: "custom_smt"; smt_fragment: string };
|
|
47
|
+
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Compilation : condition → SMT-LIB fragment
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
|
|
52
|
+
interface CompileContext {
|
|
53
|
+
/** Declared symbols (so we don't double-declare). */
|
|
54
|
+
declared: Set<string>;
|
|
55
|
+
/** Accumulated declarations. */
|
|
56
|
+
declarations: string[];
|
|
57
|
+
/** Accumulated assertions (precondition + negated postcondition). */
|
|
58
|
+
assertions: string[];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function ensureDecl(ctx: CompileContext, decl: string, name: string): void {
|
|
62
|
+
if (ctx.declared.has(name)) return;
|
|
63
|
+
ctx.declared.add(name);
|
|
64
|
+
ctx.declarations.push(decl);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Lower a single Condition into SMT-LIB assertions appended to `ctx`.
|
|
69
|
+
* `negated` flag : when true, the condition is being added as a negated
|
|
70
|
+
* post-condition (i.e. we want to find a counterexample).
|
|
71
|
+
*/
|
|
72
|
+
function lowerCondition(
|
|
73
|
+
c: Condition,
|
|
74
|
+
ctx: CompileContext,
|
|
75
|
+
negated: boolean
|
|
76
|
+
): void {
|
|
77
|
+
switch (c.type) {
|
|
78
|
+
case "budget_constraint": {
|
|
79
|
+
// parent_budget >= 0, child_budget >= 0, child_budget <= parent_budget * fraction
|
|
80
|
+
ensureDecl(ctx, "(declare-const parent_budget Real)", "parent_budget");
|
|
81
|
+
ensureDecl(ctx, "(declare-const child_budget Real)", "child_budget");
|
|
82
|
+
// Positivity is part of the pre-state, always assert.
|
|
83
|
+
ctx.assertions.push("(assert (>= parent_budget 0))");
|
|
84
|
+
ctx.assertions.push("(assert (>= child_budget 0))");
|
|
85
|
+
const expr = `(<= child_budget (* parent_budget ${c.child_max_fraction}))`;
|
|
86
|
+
ctx.assertions.push(`(assert ${negated ? `(not ${expr})` : expr})`);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
case "scope_subset": {
|
|
91
|
+
// Encode each child element as a Bool : it must be present in parent.
|
|
92
|
+
// We do this by reducing to a boolean conjunction over the listed
|
|
93
|
+
// child elements. Mismatches surface as a counterexample.
|
|
94
|
+
const parentSet = new Set(c.parent_scope);
|
|
95
|
+
const childOk = c.child_scope.every((s) => parentSet.has(s));
|
|
96
|
+
// No declarations needed — fold the result statically into a bool.
|
|
97
|
+
const expr = childOk ? "true" : "false";
|
|
98
|
+
ctx.assertions.push(`(assert ${negated ? `(not ${expr})` : expr})`);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
case "no_pii_in_output": {
|
|
103
|
+
const name = c.pii_count_var ?? "pii_count";
|
|
104
|
+
ensureDecl(ctx, `(declare-const ${name} Int)`, name);
|
|
105
|
+
// pii_count >= 0 (always)
|
|
106
|
+
ctx.assertions.push(`(assert (>= ${name} 0))`);
|
|
107
|
+
const expr = `(= ${name} 0)`;
|
|
108
|
+
ctx.assertions.push(`(assert ${negated ? `(not ${expr})` : expr})`);
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
case "cost_positive_roi": {
|
|
113
|
+
ensureDecl(ctx, "(declare-const cost Real)", "cost");
|
|
114
|
+
ensureDecl(ctx, "(declare-const value Real)", "value");
|
|
115
|
+
ctx.assertions.push("(assert (> cost 0))");
|
|
116
|
+
ctx.assertions.push("(assert (>= value 0))");
|
|
117
|
+
const expr = `(>= (/ value cost) ${c.min_roi_ratio})`;
|
|
118
|
+
ctx.assertions.push(`(assert ${negated ? `(not ${expr})` : expr})`);
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
case "response_time": {
|
|
123
|
+
ensureDecl(ctx, "(declare-const response_ms Real)", "response_ms");
|
|
124
|
+
ctx.assertions.push("(assert (>= response_ms 0))");
|
|
125
|
+
const expr = `(<= response_ms ${c.max_ms})`;
|
|
126
|
+
ctx.assertions.push(`(assert ${negated ? `(not ${expr})` : expr})`);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
case "custom_smt": {
|
|
131
|
+
const frag = c.smt_fragment.trim();
|
|
132
|
+
// The custom fragment is expected to be a parenthesised assertion body.
|
|
133
|
+
if (negated) {
|
|
134
|
+
ctx.assertions.push(`(assert (not ${frag}))`);
|
|
135
|
+
} else {
|
|
136
|
+
ctx.assertions.push(`(assert ${frag})`);
|
|
137
|
+
}
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Compile an {@link AxiomSpec} into an SMT-LIB v2 program string.
|
|
145
|
+
*
|
|
146
|
+
* Pattern : preconditions are asserted as-is ; postconditions are joined by
|
|
147
|
+
* conjunction and asserted NEGATED. A counterexample (z3 returns `sat`)
|
|
148
|
+
* therefore means : "pre-conditions hold AND at least one post-condition
|
|
149
|
+
* fails" — i.e. an UNSAFE outcome.
|
|
150
|
+
*
|
|
151
|
+
* Includes `(check-sat)` and `(get-model)` as terminating commands.
|
|
152
|
+
*/
|
|
153
|
+
export function compileToSmt(spec: AxiomSpec): string {
|
|
154
|
+
const ctx: CompileContext = {
|
|
155
|
+
declared: new Set(),
|
|
156
|
+
declarations: [],
|
|
157
|
+
assertions: [],
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
// Header — set logic to QF_LRA (quantifier-free linear real arithmetic
|
|
161
|
+
// plus integers) which covers all our supported condition kinds.
|
|
162
|
+
const header = ["(set-logic ALL)", `; AxiomSpec : ${spec.axiom}`];
|
|
163
|
+
|
|
164
|
+
// Preconditions : assert as-is (positive form).
|
|
165
|
+
for (const pre of spec.preconditions) {
|
|
166
|
+
lowerCondition(pre, ctx, false);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// Postconditions : conjoin and negate.
|
|
170
|
+
// Strategy : assert each one negated separately using De Morgan. We want
|
|
171
|
+
// NOT (post1 AND post2 AND …) ≡ (NOT post1) OR (NOT post2) OR …
|
|
172
|
+
// For check-sat-as-counterexample, we want the solver to find *any*
|
|
173
|
+
// violation, so we encode the disjunction with an auxiliary Bool flag
|
|
174
|
+
// per postcondition. Simpler equivalent : assert (or (not post1) (not post2) …).
|
|
175
|
+
if (spec.postconditions.length === 0) {
|
|
176
|
+
// Empty postcondition set : trivially SAFE (no obligation to verify).
|
|
177
|
+
ctx.assertions.push("(assert false)");
|
|
178
|
+
} else if (spec.postconditions.length === 1) {
|
|
179
|
+
lowerCondition(spec.postconditions[0]!, ctx, true);
|
|
180
|
+
} else {
|
|
181
|
+
// Build per-postcondition expression strings via a side-context, then
|
|
182
|
+
// emit a single `(assert (or ...))`.
|
|
183
|
+
const subCtx: CompileContext = {
|
|
184
|
+
declared: ctx.declared,
|
|
185
|
+
declarations: ctx.declarations,
|
|
186
|
+
assertions: [],
|
|
187
|
+
};
|
|
188
|
+
const negatedExprs: string[] = [];
|
|
189
|
+
for (const post of spec.postconditions) {
|
|
190
|
+
const before = subCtx.assertions.length;
|
|
191
|
+
lowerCondition(post, subCtx, true);
|
|
192
|
+
// The last appended assertion is "(assert <neg expr>)" or pre-assertions.
|
|
193
|
+
// To recover only the negated post-condition body, we accept that some
|
|
194
|
+
// conditions append additional non-negotiable preconditions (positivity).
|
|
195
|
+
// Those are valid in any case and stay in the main assertion list.
|
|
196
|
+
for (let i = before; i < subCtx.assertions.length; i++) {
|
|
197
|
+
const a = subCtx.assertions[i]!;
|
|
198
|
+
// Heuristic : split positivity asserts (>= x 0) and the negated body.
|
|
199
|
+
// The negated body always contains "(not ".
|
|
200
|
+
if (a.includes("(not ")) {
|
|
201
|
+
// Extract the inner expr "(not …)" inside the outer assert.
|
|
202
|
+
const inner = a.slice("(assert ".length, -1);
|
|
203
|
+
negatedExprs.push(inner);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
// Drop the negated body assertions from subCtx so we only keep
|
|
207
|
+
// the positivity ones in the main assertion list.
|
|
208
|
+
subCtx.assertions = subCtx.assertions.filter((a) => !a.includes("(not "));
|
|
209
|
+
}
|
|
210
|
+
ctx.assertions = subCtx.assertions;
|
|
211
|
+
ctx.assertions.push(`(assert (or ${negatedExprs.join(" ")}))`);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return [
|
|
215
|
+
...header,
|
|
216
|
+
...ctx.declarations,
|
|
217
|
+
...ctx.assertions,
|
|
218
|
+
"(check-sat)",
|
|
219
|
+
"(get-model)",
|
|
220
|
+
].join("\n");
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
// ---------------------------------------------------------------------------
|
|
224
|
+
// Pre-built specs for the 5 Vauban axioms
|
|
225
|
+
// ---------------------------------------------------------------------------
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Default per-axiom AxiomSpec presets. Consumers can override the timeout
|
|
229
|
+
* or augment with additional conditions before passing to `formalVerify`.
|
|
230
|
+
*
|
|
231
|
+
* Robuste : 5s — engineering robustness, may need richer checks
|
|
232
|
+
* Institutionnel : 10s — strongest spec, PII + scope-subset + budget
|
|
233
|
+
* SOTA : 2s — lightweight (single ROI check on cost)
|
|
234
|
+
* AntiFragile : 1s — response-time bound only
|
|
235
|
+
* Profitable : 1s — cost-vs-value ROI check
|
|
236
|
+
*/
|
|
237
|
+
export const AXIOM_SPECS: Record<string, AxiomSpec> = {
|
|
238
|
+
Robuste: {
|
|
239
|
+
axiom: "Robuste",
|
|
240
|
+
preconditions: [],
|
|
241
|
+
postconditions: [
|
|
242
|
+
{ type: "budget_constraint", child_max_fraction: 1.0 },
|
|
243
|
+
{ type: "response_time", max_ms: 30_000 },
|
|
244
|
+
],
|
|
245
|
+
timeout_ms: 5000,
|
|
246
|
+
},
|
|
247
|
+
Institutionnel: {
|
|
248
|
+
axiom: "Institutionnel",
|
|
249
|
+
preconditions: [],
|
|
250
|
+
postconditions: [
|
|
251
|
+
{ type: "no_pii_in_output" },
|
|
252
|
+
{ type: "budget_constraint", child_max_fraction: 1.0 },
|
|
253
|
+
],
|
|
254
|
+
timeout_ms: 10_000,
|
|
255
|
+
},
|
|
256
|
+
SOTA: {
|
|
257
|
+
axiom: "SOTA",
|
|
258
|
+
preconditions: [],
|
|
259
|
+
postconditions: [{ type: "cost_positive_roi", min_roi_ratio: 1.0 }],
|
|
260
|
+
timeout_ms: 2000,
|
|
261
|
+
},
|
|
262
|
+
AntiFragile: {
|
|
263
|
+
axiom: "AntiFragile",
|
|
264
|
+
preconditions: [],
|
|
265
|
+
postconditions: [{ type: "response_time", max_ms: 60_000 }],
|
|
266
|
+
timeout_ms: 1000,
|
|
267
|
+
},
|
|
268
|
+
Profitable: {
|
|
269
|
+
axiom: "Profitable",
|
|
270
|
+
preconditions: [],
|
|
271
|
+
postconditions: [{ type: "cost_positive_roi", min_roi_ratio: 1.5 }],
|
|
272
|
+
timeout_ms: 1000,
|
|
273
|
+
},
|
|
274
|
+
};
|