@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
package/src/events/catalogue.ts
CHANGED
|
@@ -6,6 +6,7 @@ import { AgentHitlRequestedV1 } from "./schemas/agent.hitl_requested.v1.js";
|
|
|
6
6
|
import { AgentHitlResolvedV1 } from "./schemas/agent.hitl_resolved.v1.js";
|
|
7
7
|
import { IncidentSloBurnV1 } from "./schemas/incident.slo_burn.v1.js";
|
|
8
8
|
import { IncidentDetectedV1 } from "./schemas/incident.detected.v1.js";
|
|
9
|
+
import { ForgeInboxReplyClassifiedV1 } from "./schemas/forge.inbox.reply_classified.v1.js";
|
|
9
10
|
import { ForgeLeadQualifiedV1 } from "./schemas/forge.lead.qualified.v1.js";
|
|
10
11
|
import { ForgeOutreachSentV1 } from "./schemas/forge.outreach.sent.v1.js";
|
|
11
12
|
import { ForgePolicyTriggeredV1 } from "./schemas/forge.policy.triggered.v1.js";
|
|
@@ -13,11 +14,19 @@ import { VaubanVaultRebalanceProposedV1 } from "./schemas/vauban.vault.rebalance
|
|
|
13
14
|
import { VaubanVaultRebalancedV1 } from "./schemas/vauban.vault.rebalanced.v1.js";
|
|
14
15
|
import { GlacisIdentityVerifiedV1 } from "./schemas/glacis.identity.verified.v1.js";
|
|
15
16
|
import { CitadelSprintClosedV1 } from "./schemas/citadel.sprint.closed.v1.js";
|
|
17
|
+
import { CitadelSprintAnalyzedV1 } from "./schemas/citadel.sprint.analyzed.v1.js";
|
|
16
18
|
import { BrainSkillExtractedV1 } from "./schemas/brain.skill.extracted.v1.js";
|
|
17
19
|
import { CcCostRecordedV1 } from "./schemas/cc.cost.recorded.v1.js";
|
|
18
20
|
import { CcCostAnomalyDetectedV1 } from "./schemas/cc.cost.anomaly_detected.v1.js";
|
|
19
21
|
import { TenantProvisionedV1 } from "./schemas/tenant.provisioned.v1.js";
|
|
20
22
|
import { TenantBudgetExceededV1 } from "./schemas/tenant.budget.exceeded.v1.js";
|
|
23
|
+
import { VaubanVaultAnalyzedV1 } from "./schemas/vauban.vault.analyzed.v1.js";
|
|
24
|
+
import { VaubanGoalCheckedV1 } from "./schemas/vauban.goal.checked.v1.js";
|
|
25
|
+
import { VaubanRebalancingCheckedV1 } from "./schemas/vauban.rebalancing.checked.v1.js";
|
|
26
|
+
import { VaubanTaxCheckedV1 } from "./schemas/vauban.tax.checked.v1.js";
|
|
27
|
+
import { VaubanVaultCompoundedV1 } from "./schemas/vauban.vault.compounded.v1.js";
|
|
28
|
+
import { VaubanFinanceForecastGeneratedV1 } from "./schemas/vauban-finance.forecast.generated.v1.js";
|
|
29
|
+
import { VaubanFinanceTradeExecutedV1 } from "./schemas/vauban-finance.trade.executed.v1.js";
|
|
21
30
|
|
|
22
31
|
export const EventSchemas = {
|
|
23
32
|
"agent.started": AgentStartedV1,
|
|
@@ -27,13 +36,22 @@ export const EventSchemas = {
|
|
|
27
36
|
"agent.hitl_resolved": AgentHitlResolvedV1,
|
|
28
37
|
"incident.slo_burn": IncidentSloBurnV1,
|
|
29
38
|
"incident.detected": IncidentDetectedV1,
|
|
39
|
+
"forge.inbox.reply_classified": ForgeInboxReplyClassifiedV1,
|
|
30
40
|
"forge.lead.qualified": ForgeLeadQualifiedV1,
|
|
31
41
|
"forge.outreach.sent": ForgeOutreachSentV1,
|
|
32
42
|
"forge.policy.triggered": ForgePolicyTriggeredV1,
|
|
33
43
|
"vauban.vault.rebalance_proposed": VaubanVaultRebalanceProposedV1,
|
|
34
44
|
"vauban.vault.rebalanced": VaubanVaultRebalancedV1,
|
|
45
|
+
"vauban.vault.analyzed": VaubanVaultAnalyzedV1,
|
|
46
|
+
"vauban.goal.checked": VaubanGoalCheckedV1,
|
|
47
|
+
"vauban.rebalancing.checked": VaubanRebalancingCheckedV1,
|
|
48
|
+
"vauban.tax.checked": VaubanTaxCheckedV1,
|
|
49
|
+
"vauban.vault.compounded": VaubanVaultCompoundedV1,
|
|
50
|
+
"vauban-finance.forecast.generated": VaubanFinanceForecastGeneratedV1,
|
|
51
|
+
"vauban-finance.trade.executed": VaubanFinanceTradeExecutedV1,
|
|
35
52
|
"glacis.identity.verified": GlacisIdentityVerifiedV1,
|
|
36
53
|
"citadel.sprint.closed": CitadelSprintClosedV1,
|
|
54
|
+
"citadel.sprint.analyzed": CitadelSprintAnalyzedV1,
|
|
37
55
|
"brain.skill.extracted": BrainSkillExtractedV1,
|
|
38
56
|
"cc.cost.recorded": CcCostRecordedV1,
|
|
39
57
|
"cc.cost.anomaly_detected": CcCostAnomalyDetectedV1,
|
|
@@ -55,6 +73,10 @@ export type EventType =
|
|
|
55
73
|
}
|
|
56
74
|
| { type: "incident.slo_burn"; payload: z.infer<typeof IncidentSloBurnV1> }
|
|
57
75
|
| { type: "incident.detected"; payload: z.infer<typeof IncidentDetectedV1> }
|
|
76
|
+
| {
|
|
77
|
+
type: "forge.inbox.reply_classified";
|
|
78
|
+
payload: z.infer<typeof ForgeInboxReplyClassifiedV1>;
|
|
79
|
+
}
|
|
58
80
|
| {
|
|
59
81
|
type: "forge.lead.qualified";
|
|
60
82
|
payload: z.infer<typeof ForgeLeadQualifiedV1>;
|
|
@@ -83,6 +105,10 @@ export type EventType =
|
|
|
83
105
|
type: "citadel.sprint.closed";
|
|
84
106
|
payload: z.infer<typeof CitadelSprintClosedV1>;
|
|
85
107
|
}
|
|
108
|
+
| {
|
|
109
|
+
type: "citadel.sprint.analyzed";
|
|
110
|
+
payload: z.infer<typeof CitadelSprintAnalyzedV1>;
|
|
111
|
+
}
|
|
86
112
|
| {
|
|
87
113
|
type: "brain.skill.extracted";
|
|
88
114
|
payload: z.infer<typeof BrainSkillExtractedV1>;
|
|
@@ -96,6 +122,34 @@ export type EventType =
|
|
|
96
122
|
| {
|
|
97
123
|
type: "tenant.budget.exceeded";
|
|
98
124
|
payload: z.infer<typeof TenantBudgetExceededV1>;
|
|
125
|
+
}
|
|
126
|
+
| {
|
|
127
|
+
type: "vauban.vault.analyzed";
|
|
128
|
+
payload: z.infer<typeof VaubanVaultAnalyzedV1>;
|
|
129
|
+
}
|
|
130
|
+
| {
|
|
131
|
+
type: "vauban.goal.checked";
|
|
132
|
+
payload: z.infer<typeof VaubanGoalCheckedV1>;
|
|
133
|
+
}
|
|
134
|
+
| {
|
|
135
|
+
type: "vauban.rebalancing.checked";
|
|
136
|
+
payload: z.infer<typeof VaubanRebalancingCheckedV1>;
|
|
137
|
+
}
|
|
138
|
+
| {
|
|
139
|
+
type: "vauban.tax.checked";
|
|
140
|
+
payload: z.infer<typeof VaubanTaxCheckedV1>;
|
|
141
|
+
}
|
|
142
|
+
| {
|
|
143
|
+
type: "vauban.vault.compounded";
|
|
144
|
+
payload: z.infer<typeof VaubanVaultCompoundedV1>;
|
|
145
|
+
}
|
|
146
|
+
| {
|
|
147
|
+
type: "vauban-finance.forecast.generated";
|
|
148
|
+
payload: z.infer<typeof VaubanFinanceForecastGeneratedV1>;
|
|
149
|
+
}
|
|
150
|
+
| {
|
|
151
|
+
type: "vauban-finance.trade.executed";
|
|
152
|
+
payload: z.infer<typeof VaubanFinanceTradeExecutedV1>;
|
|
99
153
|
};
|
|
100
154
|
|
|
101
155
|
export type EventTypeName = keyof typeof EventSchemas;
|
package/src/events/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export { AgentHitlRequestedV1 } from "./schemas/agent.hitl_requested.v1.js";
|
|
|
6
6
|
export { AgentHitlResolvedV1 } from "./schemas/agent.hitl_resolved.v1.js";
|
|
7
7
|
export { IncidentSloBurnV1 } from "./schemas/incident.slo_burn.v1.js";
|
|
8
8
|
export { IncidentDetectedV1 } from "./schemas/incident.detected.v1.js";
|
|
9
|
+
export { ForgeInboxReplyClassifiedV1 } from "./schemas/forge.inbox.reply_classified.v1.js";
|
|
9
10
|
export { ForgeLeadQualifiedV1 } from "./schemas/forge.lead.qualified.v1.js";
|
|
10
11
|
export { ForgeOutreachSentV1 } from "./schemas/forge.outreach.sent.v1.js";
|
|
11
12
|
export { ForgePolicyTriggeredV1 } from "./schemas/forge.policy.triggered.v1.js";
|
|
@@ -13,8 +14,16 @@ export { VaubanVaultRebalanceProposedV1 } from "./schemas/vauban.vault.rebalance
|
|
|
13
14
|
export { VaubanVaultRebalancedV1 } from "./schemas/vauban.vault.rebalanced.v1.js";
|
|
14
15
|
export { GlacisIdentityVerifiedV1 } from "./schemas/glacis.identity.verified.v1.js";
|
|
15
16
|
export { CitadelSprintClosedV1 } from "./schemas/citadel.sprint.closed.v1.js";
|
|
17
|
+
export { CitadelSprintAnalyzedV1 } from "./schemas/citadel.sprint.analyzed.v1.js";
|
|
16
18
|
export { BrainSkillExtractedV1 } from "./schemas/brain.skill.extracted.v1.js";
|
|
17
19
|
export { CcCostRecordedV1 } from "./schemas/cc.cost.recorded.v1.js";
|
|
18
20
|
export { CcCostAnomalyDetectedV1 } from "./schemas/cc.cost.anomaly_detected.v1.js";
|
|
19
21
|
export { TenantProvisionedV1 } from "./schemas/tenant.provisioned.v1.js";
|
|
20
22
|
export { TenantBudgetExceededV1 } from "./schemas/tenant.budget.exceeded.v1.js";
|
|
23
|
+
export { VaubanVaultAnalyzedV1 } from "./schemas/vauban.vault.analyzed.v1.js";
|
|
24
|
+
export { VaubanGoalCheckedV1 } from "./schemas/vauban.goal.checked.v1.js";
|
|
25
|
+
export { VaubanRebalancingCheckedV1 } from "./schemas/vauban.rebalancing.checked.v1.js";
|
|
26
|
+
export { VaubanTaxCheckedV1 } from "./schemas/vauban.tax.checked.v1.js";
|
|
27
|
+
export { VaubanVaultCompoundedV1 } from "./schemas/vauban.vault.compounded.v1.js";
|
|
28
|
+
export { VaubanFinanceForecastGeneratedV1 } from "./schemas/vauban-finance.forecast.generated.v1.js";
|
|
29
|
+
export { VaubanFinanceTradeExecutedV1 } from "./schemas/vauban-finance.trade.executed.v1.js";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
const SprintInsightV1 = z
|
|
4
|
+
.object({
|
|
5
|
+
type: z.string(),
|
|
6
|
+
severity: z.enum(["info", "warning", "error", "critical"]),
|
|
7
|
+
metric: z.string(),
|
|
8
|
+
description: z.string(),
|
|
9
|
+
})
|
|
10
|
+
.strict();
|
|
11
|
+
|
|
12
|
+
export const CitadelSprintAnalyzedV1 = z
|
|
13
|
+
.object({
|
|
14
|
+
sprintId: z.string(),
|
|
15
|
+
healthScore: z.number().int().min(0).max(100),
|
|
16
|
+
overallSeverity: z.enum(["info", "warning", "error", "critical"]),
|
|
17
|
+
insights: z.array(SprintInsightV1),
|
|
18
|
+
blockers: z.array(z.string()),
|
|
19
|
+
recommendations: z.array(z.string()),
|
|
20
|
+
timestamp: z.string(),
|
|
21
|
+
schemaVersion: z.string(),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const ForgeInboxReplyClassifiedV1 = z
|
|
4
|
+
.object({
|
|
5
|
+
uid: z.string(),
|
|
6
|
+
from: z.string(),
|
|
7
|
+
subject: z.string(),
|
|
8
|
+
type: z.enum(["INTERESTED", "NOT_INTERESTED", "BOUNCE", "SPAM", "OTHER"]),
|
|
9
|
+
priority: z.enum(["HIGH", "MEDIUM", "LOW"]),
|
|
10
|
+
signal: z.string(),
|
|
11
|
+
nextAction: z.string(),
|
|
12
|
+
timestamp: z.string(),
|
|
13
|
+
schemaVersion: z.string(),
|
|
14
|
+
})
|
|
15
|
+
.strict();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const VaubanFinanceForecastGeneratedV1 = z
|
|
4
|
+
.object({
|
|
5
|
+
scenarioId: z.string(),
|
|
6
|
+
successRate: z.number().min(0).max(1),
|
|
7
|
+
paramVelocity: z.number(),
|
|
8
|
+
timestamp: z.string(),
|
|
9
|
+
schemaVersion: z.string(),
|
|
10
|
+
})
|
|
11
|
+
.strict();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const VaubanFinanceTradeExecutedV1 = z
|
|
4
|
+
.object({
|
|
5
|
+
symbol: z.string(),
|
|
6
|
+
direction: z.enum(["long", "short", "hold"]),
|
|
7
|
+
quantity: z.number(),
|
|
8
|
+
conviction: z.number().min(0).max(1),
|
|
9
|
+
timestamp: z.string(),
|
|
10
|
+
schemaVersion: z.string(),
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const VaubanRebalancingCheckedV1 = z
|
|
4
|
+
.object({
|
|
5
|
+
portfolioId: z.string(),
|
|
6
|
+
maxDrift: z.number(),
|
|
7
|
+
alertLevel: z.enum(["none", "warning", "critical"]),
|
|
8
|
+
timestamp: z.string(),
|
|
9
|
+
schemaVersion: z.string(),
|
|
10
|
+
})
|
|
11
|
+
.strict();
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const VaubanTaxCheckedV1 = z
|
|
4
|
+
.object({
|
|
5
|
+
userId: z.string(),
|
|
6
|
+
rulesTriggered: z.array(z.string()),
|
|
7
|
+
alertLevel: z.enum(["none", "warning", "critical"]),
|
|
8
|
+
timestamp: z.string(),
|
|
9
|
+
schemaVersion: z.string(),
|
|
10
|
+
})
|
|
11
|
+
.strict();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const VaubanVaultAnalyzedV1 = z
|
|
4
|
+
.object({
|
|
5
|
+
vaultId: z.string(),
|
|
6
|
+
tvlUsd: z.number(),
|
|
7
|
+
anomalies: z.array(
|
|
8
|
+
z.object({
|
|
9
|
+
type: z.string(),
|
|
10
|
+
severity: z.enum(["info", "warning", "error", "critical"]),
|
|
11
|
+
metric: z.string(),
|
|
12
|
+
current: z.union([z.string(), z.number()]),
|
|
13
|
+
expected: z.union([z.string(), z.number()]),
|
|
14
|
+
description: z.string(),
|
|
15
|
+
})
|
|
16
|
+
),
|
|
17
|
+
overallSeverity: z.enum(["info", "warning", "error", "critical"]),
|
|
18
|
+
timestamp: z.string(),
|
|
19
|
+
schemaVersion: z.string(),
|
|
20
|
+
})
|
|
21
|
+
.strict();
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const VaubanVaultCompoundedV1 = z
|
|
4
|
+
.object({
|
|
5
|
+
vaultId: z.string(),
|
|
6
|
+
compoundedAt: z.string(),
|
|
7
|
+
rewardsUsd: z.number(),
|
|
8
|
+
caller: z.string(),
|
|
9
|
+
txHash: z.string().optional(),
|
|
10
|
+
schemaVersion: z.string(),
|
|
11
|
+
})
|
|
12
|
+
.strict();
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentPersona — load, save, and resolve a per-agent persona.
|
|
3
|
+
*
|
|
4
|
+
* Pipeline:
|
|
5
|
+
* 1. Resolve persona for agent X
|
|
6
|
+
* 2. base = DEFAULT_PERSONA
|
|
7
|
+
* 3. brain = loadFromBrain(X) (Tier 3 semantic memory query)
|
|
8
|
+
* 4. local = loadFromFile(`.cc/persona.yaml`) — optional
|
|
9
|
+
* 5. effective = merge(base, brain, local)
|
|
10
|
+
*
|
|
11
|
+
* Brain entries use category `agent-persona`, tags `["persona", agentId]`.
|
|
12
|
+
* The latest entry per agent wins (Brain query returns entries sorted by
|
|
13
|
+
* recency).
|
|
14
|
+
*
|
|
15
|
+
* @see ./persona-schema.ts
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
20
|
+
import { parse as parseYaml, stringify as stringifyYaml } from "yaml";
|
|
21
|
+
import type { SemanticMemoryPort } from "../ports/brain.js";
|
|
22
|
+
import {
|
|
23
|
+
DEFAULT_PERSONA,
|
|
24
|
+
mergePersona,
|
|
25
|
+
PersonaSchema,
|
|
26
|
+
validatePersona,
|
|
27
|
+
type AgentPersona,
|
|
28
|
+
} from "./persona-schema.js";
|
|
29
|
+
|
|
30
|
+
export const PERSONA_BRAIN_CATEGORY = "agent-persona";
|
|
31
|
+
|
|
32
|
+
/** Tags used to query/archive a persona for a given agent. */
|
|
33
|
+
export function personaTags(agentId: string): string[] {
|
|
34
|
+
return ["persona", agentId];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// ─── Brain layer ────────────────────────────────────────────────────────────
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Save (archive) a persona for an agent in Brain Tier 3 (semantic).
|
|
41
|
+
*
|
|
42
|
+
* The persona is serialized as JSON in the `content` field — keep this
|
|
43
|
+
* structured so future queries can parse it deterministically. Tags include
|
|
44
|
+
* the agent id so per-agent retrieval is precise.
|
|
45
|
+
*
|
|
46
|
+
* Returns the archived entry id, or null when the brain port returns null
|
|
47
|
+
* (e.g. replay mode, no brain configured).
|
|
48
|
+
*/
|
|
49
|
+
export async function savePersonaToBrain(
|
|
50
|
+
brain: SemanticMemoryPort,
|
|
51
|
+
agentId: string,
|
|
52
|
+
persona: AgentPersona
|
|
53
|
+
): Promise<string | null> {
|
|
54
|
+
validatePersona(persona);
|
|
55
|
+
// Wrap the JSON body with a discoverable header line — FTS-backed Brain
|
|
56
|
+
// backends use the query string as a keyword filter, so the content MUST
|
|
57
|
+
// contain the literal "persona" + agent id for `query("persona ...")` hits.
|
|
58
|
+
const content = `persona for agent ${agentId}\n${JSON.stringify(persona)}`;
|
|
59
|
+
const entry = await brain.archive({
|
|
60
|
+
content,
|
|
61
|
+
content_type: "persona",
|
|
62
|
+
category: PERSONA_BRAIN_CATEGORY,
|
|
63
|
+
tags: personaTags(agentId),
|
|
64
|
+
metadata: { agent_id: agentId, schema_version: 1 },
|
|
65
|
+
});
|
|
66
|
+
return entry?.id ?? null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Extract the JSON body from a persona Brain entry (strips the header line).
|
|
71
|
+
* Returns null if the content doesn't follow the wrapper format.
|
|
72
|
+
*/
|
|
73
|
+
function extractPersonaJson(content: string): string | null {
|
|
74
|
+
const nl = content.indexOf("\n");
|
|
75
|
+
if (nl === -1) {
|
|
76
|
+
// Backward-compat: legacy entries stored raw JSON.
|
|
77
|
+
return content;
|
|
78
|
+
}
|
|
79
|
+
return content.slice(nl + 1);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Query Brain for the latest persona for an agent.
|
|
84
|
+
*
|
|
85
|
+
* Returns the parsed persona or `null` if no entry is found (or if the
|
|
86
|
+
* latest entry's content does not parse).
|
|
87
|
+
*/
|
|
88
|
+
export async function loadPersonaFromBrain(
|
|
89
|
+
brain: SemanticMemoryPort,
|
|
90
|
+
agentId: string
|
|
91
|
+
): Promise<AgentPersona | null> {
|
|
92
|
+
const results = await brain.query("persona", {
|
|
93
|
+
category: PERSONA_BRAIN_CATEGORY,
|
|
94
|
+
tags: personaTags(agentId),
|
|
95
|
+
limit: 5,
|
|
96
|
+
});
|
|
97
|
+
if (results.length === 0) return null;
|
|
98
|
+
// Prefer the most recent entry by created_at if available.
|
|
99
|
+
const sorted = [...results].sort((a, b) => {
|
|
100
|
+
const ta = a.created_at ? Date.parse(a.created_at) : 0;
|
|
101
|
+
const tb = b.created_at ? Date.parse(b.created_at) : 0;
|
|
102
|
+
return tb - ta;
|
|
103
|
+
});
|
|
104
|
+
for (const entry of sorted) {
|
|
105
|
+
const json = extractPersonaJson(entry.content);
|
|
106
|
+
if (!json) continue;
|
|
107
|
+
try {
|
|
108
|
+
const parsed = JSON.parse(json) as unknown;
|
|
109
|
+
const validated = PersonaSchema.safeParse(parsed);
|
|
110
|
+
if (validated.success) return validated.data;
|
|
111
|
+
} catch {
|
|
112
|
+
// skip malformed entry, try next
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// ─── File layer ─────────────────────────────────────────────────────────────
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Load a persona from a YAML file. Returns null if the file is missing or
|
|
122
|
+
* the content does not validate. Throws only on filesystem errors other
|
|
123
|
+
* than ENOENT.
|
|
124
|
+
*/
|
|
125
|
+
export async function loadPersonaFromFile(
|
|
126
|
+
path: string
|
|
127
|
+
): Promise<AgentPersona | null> {
|
|
128
|
+
let raw: string;
|
|
129
|
+
try {
|
|
130
|
+
raw = await readFile(path, "utf-8");
|
|
131
|
+
} catch (err) {
|
|
132
|
+
const code = (err as NodeJS.ErrnoException).code;
|
|
133
|
+
if (code === "ENOENT") return null;
|
|
134
|
+
throw err;
|
|
135
|
+
}
|
|
136
|
+
let parsed: unknown;
|
|
137
|
+
try {
|
|
138
|
+
parsed = parseYaml(raw);
|
|
139
|
+
} catch {
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
const result = PersonaSchema.safeParse(parsed);
|
|
143
|
+
return result.success ? result.data : null;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Persist a persona to a YAML file (overwrites). Validates first.
|
|
148
|
+
*/
|
|
149
|
+
export async function savePersonaToFile(
|
|
150
|
+
path: string,
|
|
151
|
+
persona: AgentPersona
|
|
152
|
+
): Promise<void> {
|
|
153
|
+
const validated = validatePersona(persona);
|
|
154
|
+
const yaml = stringifyYaml(validated, { indent: 2 });
|
|
155
|
+
await writeFile(path, yaml, "utf-8");
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// ─── Resolution ─────────────────────────────────────────────────────────────
|
|
159
|
+
|
|
160
|
+
export interface ResolvePersonaOptions {
|
|
161
|
+
agentId: string;
|
|
162
|
+
brain?: SemanticMemoryPort;
|
|
163
|
+
localPath?: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface ResolvedPersona {
|
|
167
|
+
effective: AgentPersona;
|
|
168
|
+
/** Layers actually applied, in order (latest wins). */
|
|
169
|
+
layers: Array<"defaults" | "brain" | "local">;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Resolve the effective persona for an agent.
|
|
174
|
+
*
|
|
175
|
+
* Composition order (each layer overrides the previous):
|
|
176
|
+
* 1. DEFAULT_PERSONA
|
|
177
|
+
* 2. Brain entry (Tier 3 semantic, optional)
|
|
178
|
+
* 3. Local `.cc/persona.yaml` (optional)
|
|
179
|
+
*
|
|
180
|
+
* The returned `layers` array documents which sources contributed, useful
|
|
181
|
+
* for diagnostics (e.g. `cc persona show --explain`).
|
|
182
|
+
*/
|
|
183
|
+
export async function resolvePersona(
|
|
184
|
+
opts: ResolvePersonaOptions
|
|
185
|
+
): Promise<ResolvedPersona> {
|
|
186
|
+
const layers: ResolvedPersona["layers"] = ["defaults"];
|
|
187
|
+
let effective: AgentPersona = DEFAULT_PERSONA;
|
|
188
|
+
if (opts.brain) {
|
|
189
|
+
const fromBrain = await loadPersonaFromBrain(opts.brain, opts.agentId);
|
|
190
|
+
if (fromBrain) {
|
|
191
|
+
effective = mergePersona(effective, fromBrain);
|
|
192
|
+
layers.push("brain");
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (opts.localPath) {
|
|
196
|
+
const fromFile = await loadPersonaFromFile(opts.localPath);
|
|
197
|
+
if (fromFile) {
|
|
198
|
+
effective = mergePersona(effective, fromFile);
|
|
199
|
+
layers.push("local");
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
return { effective, layers };
|
|
203
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* buildPersonaPromptBlock — converts an AgentPersona into a system-prompt block.
|
|
3
|
+
*
|
|
4
|
+
* The output is a compact, model-neutral instruction block that can be prepended
|
|
5
|
+
* to any system prompt. It is intentionally terse — LLMs handle short, directive
|
|
6
|
+
* blocks better than verbose persona descriptions.
|
|
7
|
+
*
|
|
8
|
+
* Format contract:
|
|
9
|
+
* - Starts with a blank line so callers can safely concatenate to an existing
|
|
10
|
+
* system prompt with `${base}\n${buildPersonaPromptBlock(persona)}`.
|
|
11
|
+
* - Empty fields are omitted — the function never emits empty bullet points.
|
|
12
|
+
* - The block is bounded by `--- persona ---` / `--- end persona ---` markers
|
|
13
|
+
* for easy parsing / stripping in tests and audits.
|
|
14
|
+
*
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import type { AgentPersona } from "./persona-schema.js";
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Build a system-prompt instruction block from a resolved `AgentPersona`.
|
|
22
|
+
*
|
|
23
|
+
* Returns an empty string if the persona has no actionable fields, so
|
|
24
|
+
* callers can unconditionally concatenate without emitting noise.
|
|
25
|
+
*/
|
|
26
|
+
export function buildPersonaPromptBlock(persona: AgentPersona): string {
|
|
27
|
+
const lines: string[] = [];
|
|
28
|
+
|
|
29
|
+
const { identity, traits, domain_expertise, communication } = persona;
|
|
30
|
+
|
|
31
|
+
if (identity?.name) {
|
|
32
|
+
lines.push(`You are ${identity.name}.`);
|
|
33
|
+
}
|
|
34
|
+
if (identity?.role) {
|
|
35
|
+
lines.push(`Role: ${identity.role}.`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const styleLines: string[] = [];
|
|
39
|
+
if (identity?.tone) styleLines.push(identity.tone);
|
|
40
|
+
if (identity?.formality) styleLines.push(identity.formality);
|
|
41
|
+
if (styleLines.length) {
|
|
42
|
+
lines.push(`Communication style: ${styleLines.join(", ")}.`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (identity?.language && identity.language !== "en") {
|
|
46
|
+
lines.push(`Respond in ${identity.language}.`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (traits && traits.length > 0) {
|
|
50
|
+
lines.push(`Traits: ${traits.join(", ")}.`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (domain_expertise && domain_expertise.length > 0) {
|
|
54
|
+
lines.push(`Domain expertise: ${domain_expertise.join(", ")}.`);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (communication?.max_response_length) {
|
|
58
|
+
lines.push(
|
|
59
|
+
`Keep responses under ${communication.max_response_length} characters.`
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (communication?.explain_reasoning === "always") {
|
|
64
|
+
lines.push("Always explain your reasoning step by step.");
|
|
65
|
+
} else if (communication?.explain_reasoning === "never") {
|
|
66
|
+
lines.push("Do not explain your reasoning. Emit results only.");
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (communication?.acknowledgment_style === "none") {
|
|
70
|
+
lines.push(
|
|
71
|
+
'Do not acknowledge the task. Skip preamble like "Sure," or "I will".'
|
|
72
|
+
);
|
|
73
|
+
} else if (communication?.acknowledgment_style === "minimal") {
|
|
74
|
+
lines.push("Skip task acknowledgment preamble. Go directly to output.");
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (communication?.use_analogies === false) {
|
|
78
|
+
lines.push("Do not use analogies.");
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (lines.length === 0) return "";
|
|
82
|
+
|
|
83
|
+
return `\n--- persona ---\n${lines.join("\n")}\n--- end persona ---`;
|
|
84
|
+
}
|