@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,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ManifestRegistryPort contract tests (T-S1-1..T-S1-12).
|
|
3
|
+
*
|
|
4
|
+
* Applied to in-memory reference impl. Any ManifestRegistryPort adapter must satisfy all tests.
|
|
5
|
+
* Tests cover: registration, lookup, versioning, signature validation, revocation, compliance gating.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { describe, expect, test } from "vitest";
|
|
9
|
+
import {
|
|
10
|
+
type Manifest,
|
|
11
|
+
type ManifestRegistryPort,
|
|
12
|
+
type RegistrationResult,
|
|
13
|
+
ManifestNotFoundError,
|
|
14
|
+
ManifestSignatureInvalidError,
|
|
15
|
+
} from "./manifest-registry.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* In-memory reference implementation for contract testing.
|
|
19
|
+
*/
|
|
20
|
+
class InMemoryManifestRegistry implements ManifestRegistryPort {
|
|
21
|
+
private manifests = new Map<
|
|
22
|
+
string,
|
|
23
|
+
Manifest & { status: string; revokedAt?: Date; revokedReason?: string }
|
|
24
|
+
>();
|
|
25
|
+
private claimIds = new Map<string, string>(); // claim_id → manifest key
|
|
26
|
+
|
|
27
|
+
async register(
|
|
28
|
+
manifest: Manifest,
|
|
29
|
+
_options?: { operatorId?: string; timestamp?: Date }
|
|
30
|
+
): Promise<RegistrationResult> {
|
|
31
|
+
// I-S1-2: tier=production + mode=audit_only → reject
|
|
32
|
+
if (
|
|
33
|
+
manifest.tier === "production" &&
|
|
34
|
+
manifest.compliance_mode === "audit_only"
|
|
35
|
+
) {
|
|
36
|
+
return {
|
|
37
|
+
claim_id: "",
|
|
38
|
+
status: "failed",
|
|
39
|
+
errors: [
|
|
40
|
+
{
|
|
41
|
+
code: "I-S1-2",
|
|
42
|
+
description: "Production tier requires strict compliance mode",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Verify signature
|
|
49
|
+
try {
|
|
50
|
+
await this.verifySignature(manifest);
|
|
51
|
+
} catch (e) {
|
|
52
|
+
return {
|
|
53
|
+
claim_id: "",
|
|
54
|
+
status: "failed",
|
|
55
|
+
errors: [
|
|
56
|
+
{
|
|
57
|
+
code: "SIGNATURE_INVALID",
|
|
58
|
+
description: `Signature verification failed: ${String(e)}`,
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const key = `${manifest.name}@${manifest.version}`;
|
|
65
|
+
const existing = this.manifests.get(key);
|
|
66
|
+
|
|
67
|
+
// No duplicate versions allowed
|
|
68
|
+
if (existing) {
|
|
69
|
+
return {
|
|
70
|
+
claim_id: "",
|
|
71
|
+
status: "failed",
|
|
72
|
+
errors: [
|
|
73
|
+
{
|
|
74
|
+
code: "VERSION_CONFLICT",
|
|
75
|
+
description: `Version already registered: ${key}`,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// Register success
|
|
82
|
+
const claimId = crypto.randomUUID();
|
|
83
|
+
this.manifests.set(key, {
|
|
84
|
+
...manifest,
|
|
85
|
+
status: "active",
|
|
86
|
+
});
|
|
87
|
+
this.claimIds.set(claimId, key);
|
|
88
|
+
|
|
89
|
+
return {
|
|
90
|
+
claim_id: claimId,
|
|
91
|
+
status: "registered",
|
|
92
|
+
manifest_id: claimId,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async lookup(name: string, version: string): Promise<Manifest | null> {
|
|
97
|
+
const key = `${name}@${version}`;
|
|
98
|
+
const m = this.manifests.get(key);
|
|
99
|
+
|
|
100
|
+
if (!m) return null;
|
|
101
|
+
if (m.status === "revoked") return null;
|
|
102
|
+
|
|
103
|
+
return m;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
async revoke(claim_id: string, reason: string): Promise<void> {
|
|
107
|
+
const key = this.claimIds.get(claim_id);
|
|
108
|
+
if (!key) {
|
|
109
|
+
throw new ManifestNotFoundError("unknown", "unknown");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
const m = this.manifests.get(key);
|
|
113
|
+
if (m) {
|
|
114
|
+
m.status = "revoked";
|
|
115
|
+
m.revokedAt = new Date();
|
|
116
|
+
m.revokedReason = reason;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
async listVersions(name: string): Promise<readonly string[]> {
|
|
121
|
+
const versions = Array.from(this.manifests.keys())
|
|
122
|
+
.filter((key) => key.startsWith(`${name}@`))
|
|
123
|
+
.map((key) => key.split("@")[1]);
|
|
124
|
+
|
|
125
|
+
// Sort by semver
|
|
126
|
+
return versions.sort((a, b) => {
|
|
127
|
+
const aParts = a.split(".").map(Number);
|
|
128
|
+
const bParts = b.split(".").map(Number);
|
|
129
|
+
for (let i = 0; i < 3; i++) {
|
|
130
|
+
const cmp = (aParts[i] ?? 0) - (bParts[i] ?? 0);
|
|
131
|
+
if (cmp !== 0) return cmp;
|
|
132
|
+
}
|
|
133
|
+
return 0;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async verifySignature(manifest: Manifest): Promise<boolean> {
|
|
138
|
+
// Simple stub: just check that signature and pubkey are non-empty hex
|
|
139
|
+
const sigHex = /^[0-9a-f]{128}$/i;
|
|
140
|
+
const pubkeyHex = /^[0-9a-f]{64}$/i;
|
|
141
|
+
|
|
142
|
+
if (!sigHex.test(manifest.signature)) {
|
|
143
|
+
throw new ManifestSignatureInvalidError(
|
|
144
|
+
manifest.name,
|
|
145
|
+
manifest.version,
|
|
146
|
+
"signature not 64-byte hex"
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
if (!pubkeyHex.test(manifest.ed25519_pubkey)) {
|
|
150
|
+
throw new ManifestSignatureInvalidError(
|
|
151
|
+
manifest.name,
|
|
152
|
+
manifest.version,
|
|
153
|
+
"pubkey not 32-byte hex"
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function makeManifest(overrides: Partial<Manifest> = {}): Manifest {
|
|
162
|
+
return {
|
|
163
|
+
name: "vauban.bastion.test-agent",
|
|
164
|
+
version: "1.0.0",
|
|
165
|
+
tier: "test",
|
|
166
|
+
compliance_mode: "strict",
|
|
167
|
+
capabilities: ["bastion.swap"],
|
|
168
|
+
compliance: {
|
|
169
|
+
jurisdictions: ["FR.v1"],
|
|
170
|
+
legal_bases: ["gdpr.art6_1_b"],
|
|
171
|
+
data_classification: "internal",
|
|
172
|
+
},
|
|
173
|
+
runtime: {
|
|
174
|
+
max_compute_seconds: 30,
|
|
175
|
+
max_llm_tokens: 10000,
|
|
176
|
+
},
|
|
177
|
+
ed25519_pubkey:
|
|
178
|
+
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
|
|
179
|
+
signature:
|
|
180
|
+
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
|
|
181
|
+
manifestHash: "abc123def456",
|
|
182
|
+
...overrides,
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export const manifestRegistryPortContract = (
|
|
187
|
+
factory: () => ManifestRegistryPort
|
|
188
|
+
) => {
|
|
189
|
+
describe("ManifestRegistryPort contract", () => {
|
|
190
|
+
test("T-S1-1: registers + retrieves manifest", async () => {
|
|
191
|
+
const registry = factory();
|
|
192
|
+
const manifest = makeManifest();
|
|
193
|
+
|
|
194
|
+
const result = await registry.register(manifest);
|
|
195
|
+
expect(result.status).toBe("registered");
|
|
196
|
+
expect(result.claim_id).toBeTruthy();
|
|
197
|
+
|
|
198
|
+
const retrieved = await registry.lookup(manifest.name, manifest.version);
|
|
199
|
+
expect(retrieved).not.toBeNull();
|
|
200
|
+
expect(retrieved?.name).toBe(manifest.name);
|
|
201
|
+
expect(retrieved?.version).toBe(manifest.version);
|
|
202
|
+
expect(retrieved?.tier).toBe(manifest.tier);
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
test("T-S1-3: rejects production tier with audit_only mode (I-S1-2)", async () => {
|
|
206
|
+
const registry = factory();
|
|
207
|
+
const manifest = makeManifest({
|
|
208
|
+
tier: "production",
|
|
209
|
+
compliance_mode: "audit_only",
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
const result = await registry.register(manifest);
|
|
213
|
+
expect(result.status).toBe("failed");
|
|
214
|
+
expect(result.errors).toBeDefined();
|
|
215
|
+
expect(result.errors!.length).toBeGreaterThan(0);
|
|
216
|
+
expect(result.errors![0].code).toBe("I-S1-2");
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
test("T-S1-5: rejects duplicate version (I-S1-1 monotone)", async () => {
|
|
220
|
+
const registry = factory();
|
|
221
|
+
const manifest = makeManifest({ version: "1.0.0" });
|
|
222
|
+
|
|
223
|
+
// First registration succeeds
|
|
224
|
+
const result1 = await registry.register(manifest);
|
|
225
|
+
expect(result1.status).toBe("registered");
|
|
226
|
+
|
|
227
|
+
// Second with same version fails
|
|
228
|
+
const result2 = await registry.register(manifest);
|
|
229
|
+
expect(result2.status).toBe("failed");
|
|
230
|
+
expect(result2.errors).toBeDefined();
|
|
231
|
+
expect(result2.errors![0].code).toBe("VERSION_CONFLICT");
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
test("T-S1-6: revoke makes lookup return null + emits revocation", async () => {
|
|
235
|
+
const registry = factory();
|
|
236
|
+
const manifest = makeManifest();
|
|
237
|
+
|
|
238
|
+
const result = await registry.register(manifest);
|
|
239
|
+
expect(result.status).toBe("registered");
|
|
240
|
+
const claimId = result.claim_id;
|
|
241
|
+
|
|
242
|
+
// Before revoke: lookup succeeds
|
|
243
|
+
let retrieved = await registry.lookup(manifest.name, manifest.version);
|
|
244
|
+
expect(retrieved).not.toBeNull();
|
|
245
|
+
|
|
246
|
+
// Revoke
|
|
247
|
+
await registry.revoke(claimId, "deprecated");
|
|
248
|
+
|
|
249
|
+
// After revoke: lookup returns null
|
|
250
|
+
retrieved = await registry.lookup(manifest.name, manifest.version);
|
|
251
|
+
expect(retrieved).toBeNull();
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
test("T-S1-7: listVersions returns sorted semver", async () => {
|
|
255
|
+
const registry = factory();
|
|
256
|
+
|
|
257
|
+
// Register multiple versions
|
|
258
|
+
const versions = ["1.0.0", "1.1.0", "1.0.1", "2.0.0"];
|
|
259
|
+
for (const v of versions) {
|
|
260
|
+
const manifest = makeManifest({ version: v });
|
|
261
|
+
await registry.register(manifest);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
// List should be sorted
|
|
265
|
+
const listed = await registry.listVersions("vauban.bastion.test-agent");
|
|
266
|
+
expect(listed).toEqual(["1.0.0", "1.0.1", "1.1.0", "2.0.0"]);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
test("T-S1-2: concurrent registration of v1 and v2 succeeds", async () => {
|
|
270
|
+
const registry = factory();
|
|
271
|
+
|
|
272
|
+
const v1 = makeManifest({ version: "1.0.0" });
|
|
273
|
+
const v2 = makeManifest({ version: "2.0.0" });
|
|
274
|
+
|
|
275
|
+
const [result1, result2] = await Promise.all([
|
|
276
|
+
registry.register(v1),
|
|
277
|
+
registry.register(v2),
|
|
278
|
+
]);
|
|
279
|
+
|
|
280
|
+
expect(result1.status).toBe("registered");
|
|
281
|
+
expect(result2.status).toBe("registered");
|
|
282
|
+
|
|
283
|
+
const retrieved1 = await registry.lookup(
|
|
284
|
+
"vauban.bastion.test-agent",
|
|
285
|
+
"1.0.0"
|
|
286
|
+
);
|
|
287
|
+
const retrieved2 = await registry.lookup(
|
|
288
|
+
"vauban.bastion.test-agent",
|
|
289
|
+
"2.0.0"
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
expect(retrieved1).toBeTruthy();
|
|
293
|
+
expect(retrieved2).toBeTruthy();
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
test("verifySignature validates Ed25519 signature format", async () => {
|
|
297
|
+
const registry = factory();
|
|
298
|
+
const manifest = makeManifest({
|
|
299
|
+
signature: "invalid", // Not 64-byte hex
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
await expect(registry.verifySignature(manifest)).rejects.toThrow(
|
|
303
|
+
ManifestSignatureInvalidError
|
|
304
|
+
);
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
test("revoke on unknown claim_id throws ManifestNotFoundError", async () => {
|
|
308
|
+
const registry = factory();
|
|
309
|
+
await expect(registry.revoke("unknown-claim-id", "test")).rejects.toThrow(
|
|
310
|
+
ManifestNotFoundError
|
|
311
|
+
);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
test("lookup on unknown name returns empty array from listVersions", async () => {
|
|
315
|
+
const registry = factory();
|
|
316
|
+
const versions = await registry.listVersions("unknown.agent.name");
|
|
317
|
+
expect(versions).toEqual([]);
|
|
318
|
+
});
|
|
319
|
+
});
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
// ─── Apply contract to InMemoryManifestRegistry ────────────────────────────
|
|
323
|
+
|
|
324
|
+
manifestRegistryPortContract(() => new InMemoryManifestRegistry());
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ManifestRegistryPort — agent manifest registration and lifecycle management (S1 spec).
|
|
3
|
+
*
|
|
4
|
+
* Implements: manifest registration with Ed25519 signatures, lifecycle states
|
|
5
|
+
* (active/deprecated/revoked), version monotonicity, and tier-based compliance gating.
|
|
6
|
+
*
|
|
7
|
+
* Invariants enforced: I-S1-1..12 (capabilities, tier constraints, versioning).
|
|
8
|
+
* Errors: ManifestNotFoundError, ManifestSignatureInvalidError, ManifestVersionConflictError,
|
|
9
|
+
* ManifestComplianceConflictError (from S5 Cedar G-3).
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
// ─── Tiers ────────────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
export type Tier =
|
|
15
|
+
| "dev"
|
|
16
|
+
| "test"
|
|
17
|
+
| "pilot"
|
|
18
|
+
| "production"
|
|
19
|
+
| "internal"
|
|
20
|
+
| "legacy";
|
|
21
|
+
|
|
22
|
+
export const SUPPORTED_TIERS: Tier[] = [
|
|
23
|
+
"dev",
|
|
24
|
+
"test",
|
|
25
|
+
"pilot",
|
|
26
|
+
"production",
|
|
27
|
+
"internal",
|
|
28
|
+
"legacy",
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
// ─── Compliance modes (S5 §3.1, I-S1-2) ──────────────────────────────────────
|
|
32
|
+
|
|
33
|
+
export type ComplianceMode = "strict" | "audit_only";
|
|
34
|
+
|
|
35
|
+
// ─── Manifest representation ───────────────────────────────────────────────────
|
|
36
|
+
|
|
37
|
+
export interface Manifest {
|
|
38
|
+
readonly name: string; // agent identifier, e.g. vauban.bastion.vault-rebalancer
|
|
39
|
+
readonly version: string; // semver
|
|
40
|
+
readonly tier: Tier;
|
|
41
|
+
readonly compliance_mode: ComplianceMode;
|
|
42
|
+
readonly capabilities: readonly string[]; // e.g. ["bastion.swap", "brain.archive"]
|
|
43
|
+
readonly compliance: {
|
|
44
|
+
readonly jurisdictions: readonly string[];
|
|
45
|
+
readonly legal_bases: readonly string[];
|
|
46
|
+
readonly data_classification: string;
|
|
47
|
+
};
|
|
48
|
+
readonly runtime: {
|
|
49
|
+
readonly max_compute_seconds: number;
|
|
50
|
+
readonly max_llm_tokens: number;
|
|
51
|
+
};
|
|
52
|
+
readonly ed25519_pubkey: string; // hex, 32 bytes
|
|
53
|
+
readonly signature: string; // hex, 64 bytes (Ed25519 signature of manifestHash)
|
|
54
|
+
readonly manifestHash: string; // Poseidon-felt252 or SHA-256 hex
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// ─── Registration result ───────────────────────────────────────────────────────
|
|
58
|
+
|
|
59
|
+
export type RegistrationStatus = "registered" | "partial" | "failed";
|
|
60
|
+
|
|
61
|
+
export interface ComplianceError {
|
|
62
|
+
readonly code: string;
|
|
63
|
+
readonly description: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface RegistrationResult {
|
|
67
|
+
readonly claim_id: string; // UUID for the Claim (registered artifact)
|
|
68
|
+
readonly status: RegistrationStatus;
|
|
69
|
+
readonly manifest_id?: string; // set only if status includes "registered"
|
|
70
|
+
readonly errors?: readonly ComplianceError[];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ─── Registration options ─────────────────────────────────────────────────────
|
|
74
|
+
|
|
75
|
+
export interface RegisterOptions {
|
|
76
|
+
readonly operatorId?: string; // who registered (audit trail)
|
|
77
|
+
readonly timestamp?: Date;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// ─── Lookup result ────────────────────────────────────────────────────────────
|
|
81
|
+
|
|
82
|
+
export interface LookupResult {
|
|
83
|
+
readonly manifest: Manifest | null;
|
|
84
|
+
readonly status?: "active" | "deprecated" | "revoked";
|
|
85
|
+
readonly deprecated_at?: Date;
|
|
86
|
+
readonly revoked_at?: Date;
|
|
87
|
+
readonly revocation_reason?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ─── ManifestRegistryPort interface ───────────────────────────────────────────
|
|
91
|
+
|
|
92
|
+
export interface ManifestRegistryPort {
|
|
93
|
+
/**
|
|
94
|
+
* Register a manifest with Ed25519 signature validation.
|
|
95
|
+
* Validates I-S1-1..12 invariants before persisting.
|
|
96
|
+
* Rejects I-S1-2 violation: tier='production' + mode='audit_only'.
|
|
97
|
+
* Returns claim_id (signed Claim artifact) or ComplianceErrors.
|
|
98
|
+
*/
|
|
99
|
+
register(
|
|
100
|
+
manifest: Manifest,
|
|
101
|
+
options?: RegisterOptions
|
|
102
|
+
): Promise<RegistrationResult>;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Look up a manifest by name + version.
|
|
106
|
+
* Returns null if not found or revoked.
|
|
107
|
+
* Does not include errors list (use getValidationErrors for detailed checks).
|
|
108
|
+
*/
|
|
109
|
+
lookup(name: string, version: string): Promise<Manifest | null>;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Revoke a manifest by claim_id.
|
|
113
|
+
* After revocation, lookup() returns null.
|
|
114
|
+
* Emits revocation event (audit trail).
|
|
115
|
+
* Returns void on success; throws ManifestNotFoundError if claim_id invalid.
|
|
116
|
+
*/
|
|
117
|
+
revoke(claim_id: string, reason: string): Promise<void>;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* List all versions of a manifest by name, sorted by semver.
|
|
121
|
+
* Returns versions in ascending order (0.1.0 < 1.0.0).
|
|
122
|
+
* Returns empty array if name not found.
|
|
123
|
+
*/
|
|
124
|
+
listVersions(name: string): Promise<readonly string[]>;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Validate a manifest signature against its ed25519_pubkey.
|
|
128
|
+
* Recomputes manifestHash and checks signature.
|
|
129
|
+
* Returns true if valid; throws ManifestSignatureInvalidError if invalid.
|
|
130
|
+
*/
|
|
131
|
+
verifySignature(manifest: Manifest): Promise<boolean>;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// ─── Typed errors ─────────────────────────────────────────────────────────────
|
|
135
|
+
|
|
136
|
+
export class ManifestNotFoundError extends Error {
|
|
137
|
+
constructor(public readonly name: string, public readonly version: string) {
|
|
138
|
+
super(`Manifest not found: ${name}@${version}`);
|
|
139
|
+
this.name = "ManifestNotFoundError";
|
|
140
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export class ManifestSignatureInvalidError extends Error {
|
|
145
|
+
constructor(
|
|
146
|
+
public readonly name: string,
|
|
147
|
+
public readonly version: string,
|
|
148
|
+
public readonly cause?: unknown
|
|
149
|
+
) {
|
|
150
|
+
super(`Manifest signature invalid for ${name}@${version}`);
|
|
151
|
+
this.name = "ManifestSignatureInvalidError";
|
|
152
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export class ManifestVersionConflictError extends Error {
|
|
157
|
+
constructor(
|
|
158
|
+
public readonly name: string,
|
|
159
|
+
public readonly version: string,
|
|
160
|
+
public readonly existingStatus: string
|
|
161
|
+
) {
|
|
162
|
+
super(
|
|
163
|
+
`Manifest version conflict: ${name}@${version} already registered as ${existingStatus}`
|
|
164
|
+
);
|
|
165
|
+
this.name = "ManifestVersionConflictError";
|
|
166
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export class ManifestComplianceConflictError extends Error {
|
|
171
|
+
constructor(
|
|
172
|
+
public readonly name: string,
|
|
173
|
+
public readonly version: string,
|
|
174
|
+
public readonly violation: string
|
|
175
|
+
) {
|
|
176
|
+
super(`Compliance violation for ${name}@${version}: ${violation}`);
|
|
177
|
+
this.name = "ManifestComplianceConflictError";
|
|
178
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export class ManifestValidationError extends Error {
|
|
183
|
+
constructor(public readonly violations: readonly ComplianceError[]) {
|
|
184
|
+
super(`Manifest validation failed with ${violations.length} violation(s)`);
|
|
185
|
+
this.name = "ManifestValidationError";
|
|
186
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
187
|
+
}
|
|
188
|
+
}
|