@vauban-org/agent-sdk 1.0.0 → 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 +46 -46
- 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 +6 -6
- package/dist/events/schemas/citadel.sprint.closed.v1.d.ts +2 -2
- package/dist/events/schemas/forge.inbox.reply_classified.v1.d.ts +6 -6
- 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.goal.checked.v1.d.ts +2 -2
- package/dist/events/schemas/vauban.rebalancing.checked.v1.d.ts +2 -2
- package/dist/events/schemas/vauban.tax.checked.v1.d.ts +2 -2
- package/dist/events/schemas/vauban.vault.analyzed.v1.d.ts +6 -6
- 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/minimal-loop.js +293 -287
- 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/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 -0
- 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/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 +34 -17
- 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/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/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/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 -0
- 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/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,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container Execution Protocol — standard contract for running automations
|
|
3
|
+
* inside containers or as local binaries.
|
|
4
|
+
*
|
|
5
|
+
* Contract:
|
|
6
|
+
*
|
|
7
|
+
* Input (via env vars):
|
|
8
|
+
* VAUBAN_EXECUTION_ID — unique execution identifier (UUID)
|
|
9
|
+
* VAUBAN_AUTOMATION_NAME — automation name (kebab-case)
|
|
10
|
+
* VAUBAN_INPUT — JSON-encoded input parameters
|
|
11
|
+
* VAUBAN_TIMEOUT — timeout in seconds
|
|
12
|
+
* VAUBAN_MODE — execution mode (default: "execute")
|
|
13
|
+
*
|
|
14
|
+
* Output (via stdout, last non-empty line, JSON):
|
|
15
|
+
* { "status": "completed", "output": <any> }
|
|
16
|
+
* { "status": "failed", "error": { "code": "...", "message": "...", "details"?: <any> } }
|
|
17
|
+
*
|
|
18
|
+
* Diagnostics (via stderr, optional, one JSON object per line):
|
|
19
|
+
* { "level": "info", "message": "...", "timestamp": "..." }
|
|
20
|
+
* { "progress": 0.5, "message": "..." }
|
|
21
|
+
*
|
|
22
|
+
* @public @since 1.2.0
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Reserved environment variable names. All caller env merged on top must NOT
|
|
26
|
+
* shadow these keys, or the automation's view of its own context becomes
|
|
27
|
+
* undefined.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export declare const PROTOCOL_ENV: {
|
|
32
|
+
readonly EXECUTION_ID: "VAUBAN_EXECUTION_ID";
|
|
33
|
+
readonly AUTOMATION_NAME: "VAUBAN_AUTOMATION_NAME";
|
|
34
|
+
readonly INPUT: "VAUBAN_INPUT";
|
|
35
|
+
readonly TIMEOUT: "VAUBAN_TIMEOUT";
|
|
36
|
+
readonly MODE: "VAUBAN_MODE";
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Default protocol mode set when caller does not specify one.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export declare const DEFAULT_PROTOCOL_MODE = "execute";
|
|
43
|
+
/**
|
|
44
|
+
* Final status reported by a container/binary on stdout.
|
|
45
|
+
* @public
|
|
46
|
+
*/
|
|
47
|
+
export type ProtocolStatus = "completed" | "failed";
|
|
48
|
+
/**
|
|
49
|
+
* Discriminated union of protocol outputs parsed from stdout.
|
|
50
|
+
* @public
|
|
51
|
+
*/
|
|
52
|
+
export type ProtocolResult<T = unknown> = {
|
|
53
|
+
readonly status: "completed";
|
|
54
|
+
readonly output: T;
|
|
55
|
+
} | {
|
|
56
|
+
readonly status: "failed";
|
|
57
|
+
readonly error: {
|
|
58
|
+
readonly code: string;
|
|
59
|
+
readonly message: string;
|
|
60
|
+
readonly details?: unknown;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Outcome of an execution attempt, combining protocol result with timing,
|
|
65
|
+
* captured logs, and propagated metadata.
|
|
66
|
+
*
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export interface ExecutionResult<T = unknown> {
|
|
70
|
+
readonly executionId: string;
|
|
71
|
+
readonly automationName: string;
|
|
72
|
+
readonly status: "completed" | "failed" | "timeout";
|
|
73
|
+
readonly input: unknown;
|
|
74
|
+
readonly output?: T;
|
|
75
|
+
readonly error?: {
|
|
76
|
+
code: string;
|
|
77
|
+
message: string;
|
|
78
|
+
details?: unknown;
|
|
79
|
+
};
|
|
80
|
+
readonly startedAt: Date;
|
|
81
|
+
readonly completedAt: Date;
|
|
82
|
+
readonly durationMs: number;
|
|
83
|
+
readonly logs: ReadonlyArray<{
|
|
84
|
+
readonly level: string;
|
|
85
|
+
readonly message: string;
|
|
86
|
+
readonly timestamp: string;
|
|
87
|
+
}>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Thrown when stdout does not contain a parseable protocol result on its last
|
|
91
|
+
* non-empty line.
|
|
92
|
+
*
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
export declare class ProtocolParseError extends Error {
|
|
96
|
+
readonly rawTail: string;
|
|
97
|
+
constructor(reason: string, rawTail: string);
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Build the protocol's environment variables. Caller `extraEnv` is merged
|
|
101
|
+
* AFTER protocol env, so it cannot accidentally override reserved keys.
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
export declare function buildProtocolEnv(args: {
|
|
106
|
+
executionId: string;
|
|
107
|
+
automationName: string;
|
|
108
|
+
input: unknown;
|
|
109
|
+
timeoutSeconds: number;
|
|
110
|
+
mode?: string;
|
|
111
|
+
extraEnv?: Readonly<Record<string, string>>;
|
|
112
|
+
}): Record<string, string>;
|
|
113
|
+
/**
|
|
114
|
+
* Parse the last non-empty line of stdout as a {@link ProtocolResult}.
|
|
115
|
+
*
|
|
116
|
+
* @throws {@link ProtocolParseError} when stdout is empty, has no JSON tail,
|
|
117
|
+
* or the JSON does not match the protocol shape.
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
export declare function parseProtocolOutput<T = unknown>(stdout: string): ProtocolResult<T>;
|
|
122
|
+
/**
|
|
123
|
+
* Parse stderr lines as JSON log entries when possible; fall back to plain
|
|
124
|
+
* text wrapped at level "info". Used by {@link ContainerRuntime} to populate
|
|
125
|
+
* `ExecutionResult.logs`.
|
|
126
|
+
*
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
export declare function parseStderrLogs(stderr: string): Array<{
|
|
130
|
+
level: string;
|
|
131
|
+
message: string;
|
|
132
|
+
timestamp: string;
|
|
133
|
+
}>;
|
|
134
|
+
//# sourceMappingURL=protocol.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/container/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;GAMG;A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,CAAC;QACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;QACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;KAC5B,CAAC,CAAC;CACJ;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;gBACb,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAK5C;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC7C,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAazB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,OAAO,EAC7C,MAAM,EAAE,MAAM,GACb,cAAc,CAAC,CAAC,CAAC,CAsDnB;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC,CA6BD"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container Execution Protocol — standard contract for running automations
|
|
3
|
+
* inside containers or as local binaries.
|
|
4
|
+
*
|
|
5
|
+
* Contract:
|
|
6
|
+
*
|
|
7
|
+
* Input (via env vars):
|
|
8
|
+
* VAUBAN_EXECUTION_ID — unique execution identifier (UUID)
|
|
9
|
+
* VAUBAN_AUTOMATION_NAME — automation name (kebab-case)
|
|
10
|
+
* VAUBAN_INPUT — JSON-encoded input parameters
|
|
11
|
+
* VAUBAN_TIMEOUT — timeout in seconds
|
|
12
|
+
* VAUBAN_MODE — execution mode (default: "execute")
|
|
13
|
+
*
|
|
14
|
+
* Output (via stdout, last non-empty line, JSON):
|
|
15
|
+
* { "status": "completed", "output": <any> }
|
|
16
|
+
* { "status": "failed", "error": { "code": "...", "message": "...", "details"?: <any> } }
|
|
17
|
+
*
|
|
18
|
+
* Diagnostics (via stderr, optional, one JSON object per line):
|
|
19
|
+
* { "level": "info", "message": "...", "timestamp": "..." }
|
|
20
|
+
* { "progress": 0.5, "message": "..." }
|
|
21
|
+
*
|
|
22
|
+
* @public @since 1.2.0
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Reserved environment variable names. All caller env merged on top must NOT
|
|
26
|
+
* shadow these keys, or the automation's view of its own context becomes
|
|
27
|
+
* undefined.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export const PROTOCOL_ENV = {
|
|
32
|
+
EXECUTION_ID: "VAUBAN_EXECUTION_ID",
|
|
33
|
+
AUTOMATION_NAME: "VAUBAN_AUTOMATION_NAME",
|
|
34
|
+
INPUT: "VAUBAN_INPUT",
|
|
35
|
+
TIMEOUT: "VAUBAN_TIMEOUT",
|
|
36
|
+
MODE: "VAUBAN_MODE",
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Default protocol mode set when caller does not specify one.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export const DEFAULT_PROTOCOL_MODE = "execute";
|
|
43
|
+
/**
|
|
44
|
+
* Thrown when stdout does not contain a parseable protocol result on its last
|
|
45
|
+
* non-empty line.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
*/
|
|
49
|
+
export class ProtocolParseError extends Error {
|
|
50
|
+
rawTail;
|
|
51
|
+
constructor(reason, rawTail) {
|
|
52
|
+
super(`container-protocol: ${reason}`);
|
|
53
|
+
this.name = "ProtocolParseError";
|
|
54
|
+
this.rawTail = rawTail;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Build the protocol's environment variables. Caller `extraEnv` is merged
|
|
59
|
+
* AFTER protocol env, so it cannot accidentally override reserved keys.
|
|
60
|
+
*
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
export function buildProtocolEnv(args) {
|
|
64
|
+
const env = {};
|
|
65
|
+
if (args.extraEnv) {
|
|
66
|
+
for (const [k, v] of Object.entries(args.extraEnv)) {
|
|
67
|
+
env[k] = v;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
env[PROTOCOL_ENV.EXECUTION_ID] = args.executionId;
|
|
71
|
+
env[PROTOCOL_ENV.AUTOMATION_NAME] = args.automationName;
|
|
72
|
+
env[PROTOCOL_ENV.INPUT] = JSON.stringify(args.input);
|
|
73
|
+
env[PROTOCOL_ENV.TIMEOUT] = String(args.timeoutSeconds);
|
|
74
|
+
env[PROTOCOL_ENV.MODE] = args.mode ?? DEFAULT_PROTOCOL_MODE;
|
|
75
|
+
return env;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Parse the last non-empty line of stdout as a {@link ProtocolResult}.
|
|
79
|
+
*
|
|
80
|
+
* @throws {@link ProtocolParseError} when stdout is empty, has no JSON tail,
|
|
81
|
+
* or the JSON does not match the protocol shape.
|
|
82
|
+
*
|
|
83
|
+
* @public
|
|
84
|
+
*/
|
|
85
|
+
export function parseProtocolOutput(stdout) {
|
|
86
|
+
const trimmed = stdout.trim();
|
|
87
|
+
if (trimmed.length === 0) {
|
|
88
|
+
throw new ProtocolParseError("stdout is empty", "");
|
|
89
|
+
}
|
|
90
|
+
const lines = trimmed.split("\n");
|
|
91
|
+
const lastLine = lines[lines.length - 1].trim();
|
|
92
|
+
if (lastLine.length === 0) {
|
|
93
|
+
throw new ProtocolParseError("last stdout line is empty", trimmed.slice(-200));
|
|
94
|
+
}
|
|
95
|
+
let parsed;
|
|
96
|
+
try {
|
|
97
|
+
parsed = JSON.parse(lastLine);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
throw new ProtocolParseError("last stdout line is not valid JSON", lastLine.slice(0, 500));
|
|
101
|
+
}
|
|
102
|
+
if (typeof parsed !== "object" || parsed === null || !("status" in parsed)) {
|
|
103
|
+
throw new ProtocolParseError("protocol JSON missing 'status' field", lastLine.slice(0, 500));
|
|
104
|
+
}
|
|
105
|
+
const obj = parsed;
|
|
106
|
+
const status = obj["status"];
|
|
107
|
+
if (status === "completed") {
|
|
108
|
+
return { status: "completed", output: (obj["output"] ?? null) };
|
|
109
|
+
}
|
|
110
|
+
if (status === "failed") {
|
|
111
|
+
const err = obj["error"] ?? {};
|
|
112
|
+
const code = typeof err["code"] === "string" ? err["code"] : "UNKNOWN";
|
|
113
|
+
const message = typeof err["message"] === "string"
|
|
114
|
+
? err["message"]
|
|
115
|
+
: "(no message)";
|
|
116
|
+
const details = err["details"];
|
|
117
|
+
return { status: "failed", error: { code, message, details } };
|
|
118
|
+
}
|
|
119
|
+
throw new ProtocolParseError(`unknown protocol status: ${String(status)}`, lastLine.slice(0, 500));
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Parse stderr lines as JSON log entries when possible; fall back to plain
|
|
123
|
+
* text wrapped at level "info". Used by {@link ContainerRuntime} to populate
|
|
124
|
+
* `ExecutionResult.logs`.
|
|
125
|
+
*
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
export function parseStderrLogs(stderr) {
|
|
129
|
+
const logs = [];
|
|
130
|
+
const lines = stderr.split("\n");
|
|
131
|
+
for (const raw of lines) {
|
|
132
|
+
const line = raw.trim();
|
|
133
|
+
if (line.length === 0)
|
|
134
|
+
continue;
|
|
135
|
+
try {
|
|
136
|
+
const obj = JSON.parse(line);
|
|
137
|
+
logs.push({
|
|
138
|
+
level: typeof obj["level"] === "string" ? obj["level"] : "info",
|
|
139
|
+
message: typeof obj["message"] === "string"
|
|
140
|
+
? obj["message"]
|
|
141
|
+
: line.slice(0, 500),
|
|
142
|
+
timestamp: typeof obj["timestamp"] === "string"
|
|
143
|
+
? obj["timestamp"]
|
|
144
|
+
: new Date().toISOString(),
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
logs.push({
|
|
149
|
+
level: "info",
|
|
150
|
+
message: line.slice(0, 500),
|
|
151
|
+
timestamp: new Date().toISOString(),
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return logs;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=protocol.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/container/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,YAAY,EAAE,qBAAqB;IACnC,eAAe,EAAE,wBAAwB;IACzC,KAAK,EAAE,cAAc;IACrB,OAAO,EAAE,gBAAgB;IACzB,IAAI,EAAE,aAAa;CACX,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAkD/C;;;;;GAKG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,OAAO,CAAS;IACzB,YAAY,MAAc,EAAE,OAAe;QACzC,KAAK,CAAC,uBAAuB,MAAM,EAAE,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAOhC;IACC,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAA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AAC;gBAC3B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aACpC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ContainerRuntime — execute automations as local binaries or as containers,
|
|
3
|
+
* speaking the {@link ./protocol.ts | Container Execution Protocol}.
|
|
4
|
+
*
|
|
5
|
+
* Two modes:
|
|
6
|
+
*
|
|
7
|
+
* - **Binary**: spawn a local executable directly (Rust/Go/Python binary).
|
|
8
|
+
* The runtime uses `node:child_process.spawn` by default; tests inject a
|
|
9
|
+
* `SpawnFn` to avoid actually running anything.
|
|
10
|
+
*
|
|
11
|
+
* - **Container**: delegate to a host-provided {@link SandboxExecutor}.
|
|
12
|
+
* This is structurally compatible with Command Center's `DockerExecutor`
|
|
13
|
+
* (hardened isolation), so the SDK stays decoupled from any specific
|
|
14
|
+
* sandbox implementation.
|
|
15
|
+
*
|
|
16
|
+
* @public @since 1.2.0
|
|
17
|
+
*/
|
|
18
|
+
import { type ChildProcess } from "node:child_process";
|
|
19
|
+
import { type ExecutionResult } from "./protocol.js";
|
|
20
|
+
/**
|
|
21
|
+
* Description of a sandboxed job — structurally identical to Command Center's
|
|
22
|
+
* `SandboxJob`. Defined here so the SDK has no dependency on a specific
|
|
23
|
+
* sandbox implementation.
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
27
|
+
export interface SandboxJob {
|
|
28
|
+
image: string;
|
|
29
|
+
command: string[];
|
|
30
|
+
stdin?: string;
|
|
31
|
+
env?: Record<string, string>;
|
|
32
|
+
cwd?: string;
|
|
33
|
+
timeoutMs: number;
|
|
34
|
+
networkMode?: "none" | "outbound" | "bridge";
|
|
35
|
+
readOnlyRoot?: boolean;
|
|
36
|
+
memoryMb?: number;
|
|
37
|
+
cpuQuota?: number;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Outcome of a sandbox run — structurally identical to Command Center's
|
|
41
|
+
* `SandboxResult`.
|
|
42
|
+
*
|
|
43
|
+
* @public
|
|
44
|
+
*/
|
|
45
|
+
export interface SandboxResult {
|
|
46
|
+
exitCode: number;
|
|
47
|
+
stdout: string;
|
|
48
|
+
stderr: string;
|
|
49
|
+
timedOut: boolean;
|
|
50
|
+
durationMs: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Port for a process sandbox (Docker, Firecracker, etc.). The host injects an
|
|
54
|
+
* implementation at runtime; the SDK never depends on a concrete sandbox.
|
|
55
|
+
*
|
|
56
|
+
* @public
|
|
57
|
+
*/
|
|
58
|
+
export interface SandboxExecutor {
|
|
59
|
+
run(job: SandboxJob): Promise<SandboxResult>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Spawn function signature, mirrors `node:child_process.spawn`. Injectable so
|
|
63
|
+
* tests can avoid spawning real subprocesses.
|
|
64
|
+
*
|
|
65
|
+
* @public
|
|
66
|
+
*/
|
|
67
|
+
export type SpawnFn = (cmd: string, args: string[], opts: {
|
|
68
|
+
env?: NodeJS.ProcessEnv;
|
|
69
|
+
cwd?: string;
|
|
70
|
+
stdio: ["pipe", "pipe", "pipe"];
|
|
71
|
+
signal?: AbortSignal;
|
|
72
|
+
}) => ChildProcess;
|
|
73
|
+
/**
|
|
74
|
+
* Options for {@link ContainerRuntime.executeContainer}.
|
|
75
|
+
*
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export interface ContainerExecutionOptions {
|
|
79
|
+
executionId?: string;
|
|
80
|
+
timeoutSeconds?: number;
|
|
81
|
+
extraEnv?: Record<string, string>;
|
|
82
|
+
mode?: string;
|
|
83
|
+
networkMode?: "none" | "outbound" | "bridge";
|
|
84
|
+
readOnlyRoot?: boolean;
|
|
85
|
+
memoryMb?: number;
|
|
86
|
+
cpuQuota?: number;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Options for {@link ContainerRuntime.executeBinary}.
|
|
90
|
+
*
|
|
91
|
+
* @public
|
|
92
|
+
*/
|
|
93
|
+
export interface BinaryExecutionOptions {
|
|
94
|
+
executionId?: string;
|
|
95
|
+
timeoutSeconds?: number;
|
|
96
|
+
extraEnv?: Record<string, string>;
|
|
97
|
+
cwd?: string;
|
|
98
|
+
mode?: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Construct a {@link ContainerRuntime} bound to a {@link SandboxExecutor}
|
|
102
|
+
* (for container mode) and optionally a custom {@link SpawnFn} (for binary
|
|
103
|
+
* mode tests).
|
|
104
|
+
*
|
|
105
|
+
* @public
|
|
106
|
+
*/
|
|
107
|
+
export interface ContainerRuntimeOptions {
|
|
108
|
+
/** Sandbox executor for container mode. Required if executeContainer() is called. */
|
|
109
|
+
sandbox?: SandboxExecutor;
|
|
110
|
+
/** Spawn function for binary mode. Defaults to node:child_process.spawn. */
|
|
111
|
+
spawnFn?: SpawnFn;
|
|
112
|
+
/** Default timeout when callers don't specify one. */
|
|
113
|
+
defaultTimeoutSeconds?: number;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Run automations via either a sandboxed container (host-injected) or a local
|
|
117
|
+
* binary subprocess. Both paths produce a uniform {@link ExecutionResult}.
|
|
118
|
+
*
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
export declare class ContainerRuntime {
|
|
122
|
+
private readonly sandbox;
|
|
123
|
+
private readonly spawnFn;
|
|
124
|
+
private readonly defaultTimeoutSeconds;
|
|
125
|
+
constructor(opts?: ContainerRuntimeOptions);
|
|
126
|
+
/**
|
|
127
|
+
* Execute an automation packaged as a container image. Delegates to the
|
|
128
|
+
* injected {@link SandboxExecutor} so isolation policy (caps, network,
|
|
129
|
+
* read-only FS) lives in the host implementation.
|
|
130
|
+
*/
|
|
131
|
+
executeContainer<T = unknown>(image: string, automationName: string, input: unknown, options?: ContainerExecutionOptions): Promise<ExecutionResult<T>>;
|
|
132
|
+
/**
|
|
133
|
+
* Execute an automation packaged as a local binary (Rust release, Python
|
|
134
|
+
* wrapper, shell script). No container — just a hardened subprocess.
|
|
135
|
+
*/
|
|
136
|
+
executeBinary<T = unknown>(command: string[], automationName: string, input: unknown, options?: BinaryExecutionOptions): Promise<ExecutionResult<T>>;
|
|
137
|
+
private runSubprocess;
|
|
138
|
+
private toExecutionResult;
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/container/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EAEL,KAAK,eAAe,EAIrB,MAAM,eAAe,CAAC;AAEvB;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,GAAG,UAAU,GAAG,QAAQ,CAAC;IAC7C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;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