@provos/ironcurtain 0.10.0 → 0.11.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/README.md +60 -8
- package/dist/auth/oauth-provider.js +1 -4
- package/dist/auth/oauth-provider.js.map +1 -1
- package/dist/cli.js +38 -0
- package/dist/cli.js.map +1 -1
- package/dist/config/config-command.js +162 -7
- package/dist/config/config-command.js.map +1 -1
- package/dist/config/first-start.js +61 -0
- package/dist/config/first-start.js.map +1 -1
- package/dist/config/generated/compiled-policy.json +528 -161
- package/dist/config/generated/test-scenarios.json +4810 -170
- package/dist/config/generated/tool-annotations.json +34 -47
- package/dist/config/index.d.ts +58 -0
- package/dist/config/index.js +97 -15
- package/dist/config/index.js.map +1 -1
- package/dist/config/mcp-servers.json +2 -2
- package/dist/config/paths.d.ts +175 -0
- package/dist/config/paths.js +308 -14
- package/dist/config/paths.js.map +1 -1
- package/dist/config/types.d.ts +7 -1
- package/dist/config/user-config.d.ts +53 -5
- package/dist/config/user-config.js +96 -30
- package/dist/config/user-config.js.map +1 -1
- package/dist/config/validate-policy-dir.d.ts +10 -0
- package/dist/config/validate-policy-dir.js +59 -0
- package/dist/config/validate-policy-dir.js.map +1 -0
- package/dist/cron/job-commands.js +22 -2
- package/dist/cron/job-commands.js.map +1 -1
- package/dist/cron/types.d.ts +16 -2
- package/dist/cron/types.js +1 -3
- package/dist/cron/types.js.map +1 -1
- package/dist/daemon/daemon-command.js +16 -2
- package/dist/daemon/daemon-command.js.map +1 -1
- package/dist/daemon/ironcurtain-daemon.d.ts +44 -1
- package/dist/daemon/ironcurtain-daemon.js +210 -8
- package/dist/daemon/ironcurtain-daemon.js.map +1 -1
- package/dist/docker/adapters/claude-code.js +194 -20
- package/dist/docker/adapters/claude-code.js.map +1 -1
- package/dist/docker/adapters/goose.d.ts +12 -11
- package/dist/docker/adapters/goose.js +80 -27
- package/dist/docker/adapters/goose.js.map +1 -1
- package/dist/docker/agent-adapter.d.ts +178 -4
- package/dist/docker/agent-adapter.js +14 -0
- package/dist/docker/agent-adapter.js.map +1 -1
- package/dist/docker/code-mode-proxy.d.ts +27 -0
- package/dist/docker/code-mode-proxy.js +3 -0
- package/dist/docker/code-mode-proxy.js.map +1 -1
- package/dist/docker/docker-agent-session.d.ts +113 -62
- package/dist/docker/docker-agent-session.js +242 -294
- package/dist/docker/docker-agent-session.js.map +1 -1
- package/dist/docker/docker-infrastructure.d.ts +246 -21
- package/dist/docker/docker-infrastructure.js +520 -29
- package/dist/docker/docker-infrastructure.js.map +1 -1
- package/dist/docker/docker-manager.d.ts +36 -1
- package/dist/docker/docker-manager.js +135 -30
- package/dist/docker/docker-manager.js.map +1 -1
- package/dist/docker/docker-progress-sink.d.ts +43 -0
- package/dist/docker/docker-progress-sink.js +299 -0
- package/dist/docker/docker-progress-sink.js.map +1 -0
- package/dist/docker/mitm-proxy.d.ts +84 -1
- package/dist/docker/mitm-proxy.js +380 -18
- package/dist/docker/mitm-proxy.js.map +1 -1
- package/dist/docker/oauth-credentials.d.ts +46 -3
- package/dist/docker/oauth-credentials.js +56 -14
- package/dist/docker/oauth-credentials.js.map +1 -1
- package/dist/docker/oauth-token-manager.js +2 -2
- package/dist/docker/oauth-token-manager.js.map +1 -1
- package/dist/docker/orientation.d.ts +1 -1
- package/dist/docker/provider-config.d.ts +49 -2
- package/dist/docker/provider-config.js +202 -28
- package/dist/docker/provider-config.js.map +1 -1
- package/dist/docker/proxy-tools.d.ts +0 -2
- package/dist/docker/proxy-tools.js +2 -7
- package/dist/docker/proxy-tools.js.map +1 -1
- package/dist/docker/pty-session.d.ts +49 -1
- package/dist/docker/pty-session.js +199 -69
- package/dist/docker/pty-session.js.map +1 -1
- package/dist/docker/pty-types.d.ts +0 -2
- package/dist/docker/pty-types.js +0 -2
- package/dist/docker/pty-types.js.map +1 -1
- package/dist/docker/resource-limits.d.ts +125 -0
- package/dist/docker/resource-limits.js +200 -0
- package/dist/docker/resource-limits.js.map +1 -0
- package/dist/docker/spawn-with-idle-timeout.d.ts +39 -0
- package/dist/docker/spawn-with-idle-timeout.js +152 -0
- package/dist/docker/spawn-with-idle-timeout.js.map +1 -0
- package/dist/docker/sse-extractor.d.ts +51 -0
- package/dist/docker/sse-extractor.js +303 -0
- package/dist/docker/sse-extractor.js.map +1 -0
- package/dist/docker/token-stream-bus.d.ts +83 -0
- package/dist/docker/token-stream-bus.js +98 -0
- package/dist/docker/token-stream-bus.js.map +1 -0
- package/dist/docker/token-stream-types.d.ts +71 -0
- package/dist/docker/token-stream-types.js +8 -0
- package/dist/docker/token-stream-types.js.map +1 -0
- package/dist/docker/types.d.ts +53 -6
- package/dist/doctor/checks.d.ts +138 -0
- package/dist/doctor/checks.js +511 -0
- package/dist/doctor/checks.js.map +1 -0
- package/dist/doctor/doctor-command.d.ts +29 -0
- package/dist/doctor/doctor-command.js +160 -0
- package/dist/doctor/doctor-command.js.map +1 -0
- package/dist/doctor/mcp-liveness.d.ts +28 -0
- package/dist/doctor/mcp-liveness.js +84 -0
- package/dist/doctor/mcp-liveness.js.map +1 -0
- package/dist/doctor/oauth-checks.d.ts +23 -0
- package/dist/doctor/oauth-checks.js +157 -0
- package/dist/doctor/oauth-checks.js.map +1 -0
- package/dist/doctor/output.d.ts +26 -0
- package/dist/doctor/output.js +82 -0
- package/dist/doctor/output.js.map +1 -0
- package/dist/escalation/listener-command.js +0 -3
- package/dist/escalation/listener-command.js.map +1 -1
- package/dist/event-bus/typed-event-bus.d.ts +26 -0
- package/dist/event-bus/typed-event-bus.js +35 -0
- package/dist/event-bus/typed-event-bus.js.map +1 -0
- package/dist/index.js +24 -9
- package/dist/index.js.map +1 -1
- package/dist/logger.js +31 -2
- package/dist/logger.js.map +1 -1
- package/dist/memory/auto-save.d.ts +18 -4
- package/dist/memory/auto-save.js +46 -6
- package/dist/memory/auto-save.js.map +1 -1
- package/dist/memory/memory-policy.d.ts +41 -0
- package/dist/memory/memory-policy.js +36 -0
- package/dist/memory/memory-policy.js.map +1 -0
- package/dist/mux/mux-command.d.ts +10 -1
- package/dist/mux/mux-command.js +56 -35
- package/dist/mux/mux-command.js.map +1 -1
- package/dist/mux/mux-renderer.js +2 -12
- package/dist/mux/mux-renderer.js.map +1 -1
- package/dist/mux/session-scanner.js +1 -2
- package/dist/mux/session-scanner.js.map +1 -1
- package/dist/{pipeline → observability}/llm-logger.d.ts +8 -3
- package/dist/{pipeline → observability}/llm-logger.js +8 -3
- package/dist/observability/llm-logger.js.map +1 -0
- package/dist/observe/observe-command.d.ts +12 -0
- package/dist/observe/observe-command.js +298 -0
- package/dist/observe/observe-command.js.map +1 -0
- package/dist/observe/observe-renderer.d.ts +24 -0
- package/dist/observe/observe-renderer.js +87 -0
- package/dist/observe/observe-renderer.js.map +1 -0
- package/dist/observe/observe-tui-rain.d.ts +42 -0
- package/dist/observe/observe-tui-rain.js +531 -0
- package/dist/observe/observe-tui-rain.js.map +1 -0
- package/dist/observe/observe-tui-text-panel.d.ts +46 -0
- package/dist/observe/observe-tui-text-panel.js +525 -0
- package/dist/observe/observe-tui-text-panel.js.map +1 -0
- package/dist/observe/observe-tui-types.d.ts +270 -0
- package/dist/observe/observe-tui-types.js +200 -0
- package/dist/observe/observe-tui-types.js.map +1 -0
- package/dist/observe/observe-tui-word-scorer.d.ts +143 -0
- package/dist/observe/observe-tui-word-scorer.js +572 -0
- package/dist/observe/observe-tui-word-scorer.js.map +1 -0
- package/dist/observe/observe-tui.d.ts +59 -0
- package/dist/observe/observe-tui.js +592 -0
- package/dist/observe/observe-tui.js.map +1 -0
- package/dist/persona/memory-gate.d.ts +19 -0
- package/dist/persona/memory-gate.js +33 -0
- package/dist/persona/memory-gate.js.map +1 -0
- package/dist/persona/persona-command.js +41 -6
- package/dist/persona/persona-command.js.map +1 -1
- package/dist/persona/resolve.d.ts +22 -0
- package/dist/persona/resolve.js +45 -2
- package/dist/persona/resolve.js.map +1 -1
- package/dist/persona/types.d.ts +16 -0
- package/dist/pipeline/constitution-compiler.d.ts +25 -14
- package/dist/pipeline/constitution-compiler.js +107 -38
- package/dist/pipeline/constitution-compiler.js.map +1 -1
- package/dist/pipeline/dynamic-list-types.d.ts +3 -6
- package/dist/pipeline/dynamic-list-types.js +3 -16
- package/dist/pipeline/dynamic-list-types.js.map +1 -1
- package/dist/pipeline/pipeline-runner.js +89 -50
- package/dist/pipeline/pipeline-runner.js.map +1 -1
- package/dist/pipeline/pipeline-shared.d.ts +1 -1
- package/dist/pipeline/pipeline-shared.js +3 -11
- package/dist/pipeline/pipeline-shared.js.map +1 -1
- package/dist/pipeline/policy-verifier.js +16 -3
- package/dist/pipeline/policy-verifier.js.map +1 -1
- package/dist/pipeline/proxy-mcp-connections.js +17 -2
- package/dist/pipeline/proxy-mcp-connections.js.map +1 -1
- package/dist/pipeline/scenario-generator.d.ts +4 -8
- package/dist/pipeline/scenario-generator.js +13 -46
- package/dist/pipeline/scenario-generator.js.map +1 -1
- package/dist/sandbox/index.d.ts +14 -0
- package/dist/sandbox/index.js +335 -116
- package/dist/sandbox/index.js.map +1 -1
- package/dist/sandbox/ironcurtain-protocol.d.ts +52 -0
- package/dist/sandbox/ironcurtain-protocol.js +185 -0
- package/dist/sandbox/ironcurtain-protocol.js.map +1 -0
- package/dist/session/agent-session.d.ts +6 -0
- package/dist/session/agent-session.js +16 -5
- package/dist/session/agent-session.js.map +1 -1
- package/dist/session/cli-transport.js +0 -6
- package/dist/session/cli-transport.js.map +1 -1
- package/dist/session/index.d.ts +35 -14
- package/dist/session/index.js +324 -130
- package/dist/session/index.js.map +1 -1
- package/dist/session/preflight.d.ts +50 -13
- package/dist/session/preflight.js +252 -80
- package/dist/session/preflight.js.map +1 -1
- package/dist/session/prompts.d.ts +2 -5
- package/dist/session/prompts.js.map +1 -1
- package/dist/session/session-manager.d.ts +61 -6
- package/dist/session/session-manager.js +72 -10
- package/dist/session/session-manager.js.map +1 -1
- package/dist/session/session-metadata.d.ts +21 -5
- package/dist/session/session-metadata.js +34 -12
- package/dist/session/session-metadata.js.map +1 -1
- package/dist/session/types.d.ts +311 -5
- package/dist/session/types.js +57 -1
- package/dist/session/types.js.map +1 -1
- package/dist/signal/setup-signal.js +13 -21
- package/dist/signal/setup-signal.js.map +1 -1
- package/dist/signal/signal-bot-daemon.d.ts +16 -1
- package/dist/signal/signal-bot-daemon.js +39 -27
- package/dist/signal/signal-bot-daemon.js.map +1 -1
- package/dist/signal/signal-container.js +7 -1
- package/dist/signal/signal-container.js.map +1 -1
- package/dist/skills/discovery.d.ts +77 -0
- package/dist/skills/discovery.js +206 -0
- package/dist/skills/discovery.js.map +1 -0
- package/dist/skills/index.d.ts +4 -0
- package/dist/skills/index.js +3 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/skills/staging.d.ts +28 -0
- package/dist/skills/staging.js +68 -0
- package/dist/skills/staging.js.map +1 -0
- package/dist/skills/types.d.ts +46 -0
- package/dist/skills/types.js +2 -0
- package/dist/skills/types.js.map +1 -0
- package/dist/trusted-process/approval-whitelist.d.ts +0 -2
- package/dist/trusted-process/approval-whitelist.js +17 -17
- package/dist/trusted-process/approval-whitelist.js.map +1 -1
- package/dist/trusted-process/async-mutex.d.ts +32 -0
- package/dist/trusted-process/async-mutex.js +50 -0
- package/dist/trusted-process/async-mutex.js.map +1 -0
- package/dist/trusted-process/audit-log.d.ts +38 -1
- package/dist/trusted-process/audit-log.js +82 -13
- package/dist/trusted-process/audit-log.js.map +1 -1
- package/dist/trusted-process/call-circuit-breaker.js +2 -1
- package/dist/trusted-process/call-circuit-breaker.js.map +1 -1
- package/dist/trusted-process/control-server.d.ts +101 -0
- package/dist/trusted-process/control-server.js +282 -0
- package/dist/trusted-process/control-server.js.map +1 -0
- package/dist/trusted-process/domain-utils.d.ts +6 -6
- package/dist/trusted-process/domain-utils.js +7 -23
- package/dist/trusted-process/domain-utils.js.map +1 -1
- package/dist/trusted-process/error-prefixes.d.ts +16 -0
- package/dist/trusted-process/error-prefixes.js +17 -0
- package/dist/trusted-process/error-prefixes.js.map +1 -0
- package/dist/trusted-process/index.d.ts +40 -23
- package/dist/trusted-process/index.js +131 -225
- package/dist/trusted-process/index.js.map +1 -1
- package/dist/trusted-process/list-matcher.d.ts +17 -0
- package/dist/trusted-process/list-matcher.js +31 -0
- package/dist/trusted-process/list-matcher.js.map +1 -0
- package/dist/trusted-process/mcp-client-manager.d.ts +35 -6
- package/dist/trusted-process/mcp-client-manager.js +40 -45
- package/dist/trusted-process/mcp-client-manager.js.map +1 -1
- package/dist/trusted-process/mcp-proxy-server.d.ts +31 -120
- package/dist/trusted-process/mcp-proxy-server.js +166 -657
- package/dist/trusted-process/mcp-proxy-server.js.map +1 -1
- package/dist/trusted-process/policy-engine.d.ts +16 -4
- package/dist/trusted-process/policy-engine.js +90 -45
- package/dist/trusted-process/policy-engine.js.map +1 -1
- package/dist/trusted-process/policy-roots.d.ts +6 -0
- package/dist/trusted-process/policy-roots.js +20 -0
- package/dist/trusted-process/policy-roots.js.map +1 -1
- package/dist/trusted-process/sandbox-integration.d.ts +12 -0
- package/dist/trusted-process/sandbox-integration.js +18 -0
- package/dist/trusted-process/sandbox-integration.js.map +1 -1
- package/dist/trusted-process/tool-call-coordinator.d.ts +269 -0
- package/dist/trusted-process/tool-call-coordinator.js +508 -0
- package/dist/trusted-process/tool-call-coordinator.js.map +1 -0
- package/dist/trusted-process/tool-call-pipeline.d.ts +205 -0
- package/dist/trusted-process/tool-call-pipeline.js +798 -0
- package/dist/trusted-process/tool-call-pipeline.js.map +1 -0
- package/dist/trusted-process/tool-description-hints.d.ts +1 -1
- package/dist/types/argument-roles.d.ts +1 -1
- package/dist/types/argument-roles.js +14 -1
- package/dist/types/argument-roles.js.map +1 -1
- package/dist/types/audit.d.ts +9 -0
- package/dist/{session → types}/errors.d.ts +8 -2
- package/dist/{session → types}/errors.js +8 -2
- package/dist/types/errors.js.map +1 -0
- package/dist/types/reserved-servers.d.ts +11 -0
- package/dist/types/reserved-servers.js +12 -0
- package/dist/types/reserved-servers.js.map +1 -0
- package/dist/types/server-listing.d.ts +14 -0
- package/dist/types/server-listing.js +2 -0
- package/dist/types/server-listing.js.map +1 -0
- package/dist/types/slug.d.ts +2 -0
- package/dist/types/slug.js +2 -0
- package/dist/types/slug.js.map +1 -1
- package/dist/types/url-normalize.d.ts +16 -0
- package/dist/types/url-normalize.js +33 -0
- package/dist/types/url-normalize.js.map +1 -0
- package/dist/utils/error-message.d.ts +8 -0
- package/dist/utils/error-message.js +11 -0
- package/dist/utils/error-message.js.map +1 -0
- package/dist/utils/exec-error.d.ts +19 -0
- package/dist/utils/exec-error.js +16 -0
- package/dist/utils/exec-error.js.map +1 -0
- package/dist/utils/is-plain-object.d.ts +7 -0
- package/dist/utils/is-plain-object.js +12 -0
- package/dist/utils/is-plain-object.js.map +1 -0
- package/dist/utils/preflight-checks.d.ts +16 -0
- package/dist/utils/preflight-checks.js +178 -0
- package/dist/utils/preflight-checks.js.map +1 -0
- package/dist/web-ui/__tests__/json-rpc-dispatch.test.d.ts +7 -0
- package/dist/web-ui/__tests__/json-rpc-dispatch.test.js +725 -0
- package/dist/web-ui/__tests__/json-rpc-dispatch.test.js.map +1 -0
- package/dist/web-ui/dispatch/escalation-dispatch.d.ts +7 -0
- package/dist/web-ui/dispatch/escalation-dispatch.js +52 -0
- package/dist/web-ui/dispatch/escalation-dispatch.js.map +1 -0
- package/dist/web-ui/dispatch/job-dispatch.d.ts +8 -0
- package/dist/web-ui/dispatch/job-dispatch.js +83 -0
- package/dist/web-ui/dispatch/job-dispatch.js.map +1 -0
- package/dist/web-ui/dispatch/persona-dispatch.d.ts +6 -0
- package/dist/web-ui/dispatch/persona-dispatch.js +116 -0
- package/dist/web-ui/dispatch/persona-dispatch.js.map +1 -0
- package/dist/web-ui/dispatch/session-dispatch.d.ts +9 -0
- package/dist/web-ui/dispatch/session-dispatch.js +201 -0
- package/dist/web-ui/dispatch/session-dispatch.js.map +1 -0
- package/dist/web-ui/dispatch/token-stream-dispatch.d.ts +15 -0
- package/dist/web-ui/dispatch/token-stream-dispatch.js +55 -0
- package/dist/web-ui/dispatch/token-stream-dispatch.js.map +1 -0
- package/dist/web-ui/dispatch/types.d.ts +31 -0
- package/dist/web-ui/dispatch/types.js +68 -0
- package/dist/web-ui/dispatch/types.js.map +1 -0
- package/dist/web-ui/dispatch/workflow-dispatch.d.ts +103 -0
- package/dist/web-ui/dispatch/workflow-dispatch.js +925 -0
- package/dist/web-ui/dispatch/workflow-dispatch.js.map +1 -0
- package/dist/web-ui/json-rpc-dispatch.d.ts +12 -0
- package/dist/web-ui/json-rpc-dispatch.js +34 -0
- package/dist/web-ui/json-rpc-dispatch.js.map +1 -0
- package/dist/web-ui/state-graph.d.ts +13 -0
- package/dist/web-ui/state-graph.js +82 -0
- package/dist/web-ui/state-graph.js.map +1 -0
- package/dist/web-ui/token-stream-bridge.d.ts +76 -0
- package/dist/web-ui/token-stream-bridge.js +265 -0
- package/dist/web-ui/token-stream-bridge.js.map +1 -0
- package/dist/web-ui/web-event-bus.d.ts +152 -0
- package/dist/web-ui/web-event-bus.js +19 -0
- package/dist/web-ui/web-event-bus.js.map +1 -0
- package/dist/web-ui/web-session-transport.d.ts +31 -0
- package/dist/web-ui/web-session-transport.js +109 -0
- package/dist/web-ui/web-session-transport.js.map +1 -0
- package/dist/web-ui/web-ui-server.d.ts +76 -0
- package/dist/web-ui/web-ui-server.js +461 -0
- package/dist/web-ui/web-ui-server.js.map +1 -0
- package/dist/web-ui/web-ui-types.d.ts +290 -0
- package/dist/web-ui/web-ui-types.js +32 -0
- package/dist/web-ui/web-ui-types.js.map +1 -0
- package/dist/web-ui/ws-utils.d.ts +5 -0
- package/dist/web-ui/ws-utils.js +12 -0
- package/dist/web-ui/ws-utils.js.map +1 -0
- package/dist/web-ui-static/assets/index-BFO5z1js.js +76 -0
- package/dist/web-ui-static/assets/index-CCUwrkIL.css +1 -0
- package/dist/web-ui-static/assets/orbitron-latin-700-normal-4jsRXGGJ.woff2 +0 -0
- package/dist/web-ui-static/assets/orbitron-latin-700-normal-DmYOh-W9.woff +0 -0
- package/dist/web-ui-static/index.html +14 -0
- package/dist/workflow/artifacts.d.ts +59 -0
- package/dist/workflow/artifacts.js +188 -0
- package/dist/workflow/artifacts.js.map +1 -0
- package/dist/workflow/checkpoint-selection.d.ts +34 -0
- package/dist/workflow/checkpoint-selection.js +48 -0
- package/dist/workflow/checkpoint-selection.js.map +1 -0
- package/dist/workflow/checkpoint.d.ts +35 -0
- package/dist/workflow/checkpoint.js +84 -0
- package/dist/workflow/checkpoint.js.map +1 -0
- package/dist/workflow/cli-support.d.ts +92 -0
- package/dist/workflow/cli-support.js +423 -0
- package/dist/workflow/cli-support.js.map +1 -0
- package/dist/workflow/definition-loader.d.ts +32 -0
- package/dist/workflow/definition-loader.js +56 -0
- package/dist/workflow/definition-loader.js.map +1 -0
- package/dist/workflow/discovery.d.ts +78 -0
- package/dist/workflow/discovery.js +203 -0
- package/dist/workflow/discovery.js.map +1 -0
- package/dist/workflow/errors.d.ts +66 -0
- package/dist/workflow/errors.js +49 -0
- package/dist/workflow/errors.js.map +1 -0
- package/dist/workflow/guards.d.ts +8 -0
- package/dist/workflow/guards.js +38 -0
- package/dist/workflow/guards.js.map +1 -0
- package/dist/workflow/lint-integration.d.ts +64 -0
- package/dist/workflow/lint-integration.js +56 -0
- package/dist/workflow/lint-integration.js.map +1 -0
- package/dist/workflow/lint.d.ts +66 -0
- package/dist/workflow/lint.js +410 -0
- package/dist/workflow/lint.js.map +1 -0
- package/dist/workflow/machine-builder.d.ts +90 -0
- package/dist/workflow/machine-builder.js +485 -0
- package/dist/workflow/machine-builder.js.map +1 -0
- package/dist/workflow/message-log.d.ts +85 -0
- package/dist/workflow/message-log.js +40 -0
- package/dist/workflow/message-log.js.map +1 -0
- package/dist/workflow/orchestrator.d.ts +450 -0
- package/dist/workflow/orchestrator.js +1941 -0
- package/dist/workflow/orchestrator.js.map +1 -0
- package/dist/workflow/prompt-builder.d.ts +39 -0
- package/dist/workflow/prompt-builder.js +242 -0
- package/dist/workflow/prompt-builder.js.map +1 -0
- package/dist/workflow/run-state-command.d.ts +9 -0
- package/dist/workflow/run-state-command.js +414 -0
- package/dist/workflow/run-state-command.js.map +1 -0
- package/dist/workflow/run-state-debug-capture.d.ts +40 -0
- package/dist/workflow/run-state-debug-capture.js +101 -0
- package/dist/workflow/run-state-debug-capture.js.map +1 -0
- package/dist/workflow/status-parser.d.ts +68 -0
- package/dist/workflow/status-parser.js +259 -0
- package/dist/workflow/status-parser.js.map +1 -0
- package/dist/workflow/types.d.ts +498 -0
- package/dist/workflow/types.js +83 -0
- package/dist/workflow/types.js.map +1 -0
- package/dist/workflow/validate.d.ts +58 -0
- package/dist/workflow/validate.js +499 -0
- package/dist/workflow/validate.js.map +1 -0
- package/dist/workflow/workflow-command.d.ts +26 -0
- package/dist/workflow/workflow-command.js +648 -0
- package/dist/workflow/workflow-command.js.map +1 -0
- package/dist/workflow/workflow-discovery.d.ts +25 -0
- package/dist/workflow/workflow-discovery.js +100 -0
- package/dist/workflow/workflow-discovery.js.map +1 -0
- package/dist/workflow/workflow-manager.d.ts +122 -0
- package/dist/workflow/workflow-manager.js +308 -0
- package/dist/workflow/workflow-manager.js.map +1 -0
- package/dist/workflow/workflows/design-and-code/workflow.yaml +169 -0
- package/dist/workflow/workflows/test-email-summary/skills/email-formatting/SKILL.md +55 -0
- package/dist/workflow/workflows/test-email-summary/skills/gmail-query-syntax/SKILL.md +63 -0
- package/dist/workflow/workflows/test-email-summary/skills/json-schema-emails/SKILL.md +41 -0
- package/dist/workflow/workflows/test-email-summary/skills/json-schema-emails/schema.json +34 -0
- package/dist/workflow/workflows/test-email-summary/skills/summary-style-guide/SKILL.md +51 -0
- package/dist/workflow/workflows/test-email-summary/workflow.yaml +89 -0
- package/dist/workflow/workflows/vuln-discovery/skills/harness-design-fuzzing/SKILL.md +201 -0
- package/dist/workflow/workflows/vuln-discovery/skills/memory-safety-c-cpp/SKILL.md +166 -0
- package/dist/workflow/workflows/vuln-discovery/skills/vulnerability-triage/SKILL.md +185 -0
- package/dist/workflow/workflows/vuln-discovery/workflow.yaml +920 -0
- package/dist/workflow/worktree.d.ts +43 -0
- package/dist/workflow/worktree.js +106 -0
- package/dist/workflow/worktree.js.map +1 -0
- package/docker/Dockerfile.base +9 -0
- package/docker/Dockerfile.base.arm64 +9 -0
- package/docker/entrypoint-claude-code.sh +46 -0
- package/docker/entrypoint-goose.sh +25 -0
- package/package.json +19 -8
- package/packages/web-ui/README.md +113 -0
- package/packages/web-ui/docs/workflow-state-machine.png +0 -0
- package/src/config/generated/compiled-policy.json +528 -161
- package/src/config/generated/test-scenarios.json +4810 -170
- package/src/config/generated/tool-annotations.json +34 -47
- package/src/config/mcp-servers.json +2 -2
- package/src/workflow/workflows/design-and-code/workflow.yaml +169 -0
- package/src/workflow/workflows/test-email-summary/skills/email-formatting/SKILL.md +55 -0
- package/src/workflow/workflows/test-email-summary/skills/gmail-query-syntax/SKILL.md +63 -0
- package/src/workflow/workflows/test-email-summary/skills/json-schema-emails/SKILL.md +41 -0
- package/src/workflow/workflows/test-email-summary/skills/json-schema-emails/schema.json +34 -0
- package/src/workflow/workflows/test-email-summary/skills/summary-style-guide/SKILL.md +51 -0
- package/src/workflow/workflows/test-email-summary/workflow.yaml +89 -0
- package/src/workflow/workflows/vuln-discovery/skills/harness-design-fuzzing/SKILL.md +201 -0
- package/src/workflow/workflows/vuln-discovery/skills/memory-safety-c-cpp/SKILL.md +166 -0
- package/src/workflow/workflows/vuln-discovery/skills/vulnerability-triage/SKILL.md +185 -0
- package/src/workflow/workflows/vuln-discovery/workflow.yaml +920 -0
- package/dist/pipeline/llm-logger.js.map +0 -1
- package/dist/session/errors.js.map +0 -1
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
import type { WorkflowId, WorkflowDefinition, WorkflowStatus, TransitionRecord, HumanGateRequest, HumanGateEvent } from './types.js';
|
|
2
|
+
import type { ResolvedUserConfig } from '../config/user-config.js';
|
|
3
|
+
import type { BundleId, Session, SessionId, SessionOptions } from '../session/types.js';
|
|
4
|
+
import { type AgentId } from '../docker/agent-adapter.js';
|
|
5
|
+
import { type DockerInfrastructure } from '../docker/docker-infrastructure.js';
|
|
6
|
+
import type { CheckpointStore } from './checkpoint.js';
|
|
7
|
+
import type { ResolvedSkill } from '../skills/types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Stages the workflow package's `skills/` tree into the run directory
|
|
10
|
+
* so the workflow becomes self-contained at start time. After this call
|
|
11
|
+
* the per-run path (`<runMetaDir>/workflow-skills/`) is the canonical
|
|
12
|
+
* source of workflow-bundled skills for both initial-set staging and
|
|
13
|
+
* per-state restage; the original package path under
|
|
14
|
+
* `getWorkflowPackageDir(definitionPath)` is no longer consulted at
|
|
15
|
+
* runtime.
|
|
16
|
+
*
|
|
17
|
+
* Returns the absolute path to the staged copy when source `skills/`
|
|
18
|
+
* exists and was copied, `undefined` when the source has no `skills/`
|
|
19
|
+
* directory (the workflow simply ships none — not an error). Throws
|
|
20
|
+
* only on copy I/O failure, since a half-copied tree would be worse
|
|
21
|
+
* than a missing one.
|
|
22
|
+
*
|
|
23
|
+
* Why copy at start (not symlink): the package directory may be
|
|
24
|
+
* deleted, moved, or rebuilt between start and resume — symlink chases
|
|
25
|
+
* lead to "skills silently empty on resume" without diagnostic. A
|
|
26
|
+
* shallow-recursive copy decouples the run from its source-of-record
|
|
27
|
+
* location.
|
|
28
|
+
*/
|
|
29
|
+
export declare function stageWorkflowSkillsAtStart(packageDir: string, runMetaDir: string): string | undefined;
|
|
30
|
+
/** Handle for writing to a workflow tab in the mux. */
|
|
31
|
+
export interface WorkflowTabHandle {
|
|
32
|
+
write(text: string): void;
|
|
33
|
+
setLabel(label: string): void;
|
|
34
|
+
close(): void;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Inputs for creating a workflow-scoped Docker infrastructure bundle.
|
|
38
|
+
* Supplied by the orchestrator when `settings.sharedContainer === true`
|
|
39
|
+
* and the workflow uses a Docker agent. One input produces one bundle;
|
|
40
|
+
* bifurcated workflows invoke the factory once per distinct
|
|
41
|
+
* `containerScope` their agent states declare.
|
|
42
|
+
*/
|
|
43
|
+
export interface CreateWorkflowInfrastructureInput {
|
|
44
|
+
readonly workflowId: WorkflowId;
|
|
45
|
+
/**
|
|
46
|
+
* Stable key for this bundle. Minted by the orchestrator via
|
|
47
|
+
* `createBundleId()` before the factory is invoked so both the
|
|
48
|
+
* coordinator's control-socket path and the bundle's on-disk
|
|
49
|
+
* directory share the same identifier. Each unique `scope` under a
|
|
50
|
+
* workflow gets its own fresh `BundleId`.
|
|
51
|
+
*/
|
|
52
|
+
readonly bundleId: BundleId;
|
|
53
|
+
readonly agentId: AgentId;
|
|
54
|
+
/**
|
|
55
|
+
* Path to the bundle's coordinator control socket. The orchestrator
|
|
56
|
+
* starts the coordinator's HTTP control server at this path after the
|
|
57
|
+
* bundle is created (see `startWorkflowControlServer` dep). The path
|
|
58
|
+
* is included here so the factory may optionally pre-create the
|
|
59
|
+
* containing directory or use it for labelling.
|
|
60
|
+
*/
|
|
61
|
+
readonly controlSocketPath: string;
|
|
62
|
+
/**
|
|
63
|
+
* Workspace directory for this workflow run. Used as the allowed
|
|
64
|
+
* directory for the filesystem MCP server and all sessions that run
|
|
65
|
+
* in the shared container. Either a user-supplied `--workspace <path>`
|
|
66
|
+
* or the default `<baseDir>/<workflowId>/workspace/`.
|
|
67
|
+
*
|
|
68
|
+
* All sessions in a workflow mount the workflow's workspace directory;
|
|
69
|
+
* no session-scoped sandbox is ever used under shared-container mode.
|
|
70
|
+
* Scoped bundles share this workspace — isolation happens at the
|
|
71
|
+
* coordinator/policy level, not the filesystem.
|
|
72
|
+
*/
|
|
73
|
+
readonly workspacePath: string;
|
|
74
|
+
/**
|
|
75
|
+
* Scope label this bundle was minted for. Emitted directly as the
|
|
76
|
+
* `ironcurtain.scope=<scope>` Docker label on the container and its
|
|
77
|
+
* sidecar. The orchestrator resolves
|
|
78
|
+
* `stateConfig.containerScope ?? DEFAULT_CONTAINER_SCOPE` before calling
|
|
79
|
+
* the factory, so this is always a concrete string.
|
|
80
|
+
*
|
|
81
|
+
* See `docs/designs/workflow-session-identity.md` §2.5.
|
|
82
|
+
*/
|
|
83
|
+
readonly scope: string;
|
|
84
|
+
/** Union of MCP server names required across every agent state in this scope. */
|
|
85
|
+
readonly requiredServers: ReadonlySet<string>;
|
|
86
|
+
/**
|
|
87
|
+
* Initial skills staged at bundle creation (user + workflow only).
|
|
88
|
+
* Persona skills are layered in per-state via `bundle.restageSkills`.
|
|
89
|
+
*/
|
|
90
|
+
readonly resolvedSkills?: readonly ResolvedSkill[];
|
|
91
|
+
}
|
|
92
|
+
/** Inputs for starting the coordinator's HTTP control server on a workflow bundle. */
|
|
93
|
+
export interface StartWorkflowControlServerInput {
|
|
94
|
+
readonly infra: DockerInfrastructure;
|
|
95
|
+
readonly socketPath: string;
|
|
96
|
+
}
|
|
97
|
+
/** Inputs for the `loadPolicy` RPC dispatched at each agent state entry. */
|
|
98
|
+
export interface LoadPolicyRpcInput {
|
|
99
|
+
readonly socketPath: string;
|
|
100
|
+
readonly persona: string;
|
|
101
|
+
readonly policyDir: string;
|
|
102
|
+
/** Hard timeout in milliseconds; the call aborts if the coordinator does not ack in time. */
|
|
103
|
+
readonly timeoutMs?: number;
|
|
104
|
+
}
|
|
105
|
+
/** Dependencies injected into the orchestrator. */
|
|
106
|
+
export interface WorkflowOrchestratorDeps {
|
|
107
|
+
/** Factory for creating agent sessions. */
|
|
108
|
+
readonly createSession: (options: SessionOptions) => Promise<Session>;
|
|
109
|
+
/** Factory for creating read-only workflow tabs in the mux. */
|
|
110
|
+
readonly createWorkflowTab: (label: string, workflowId: WorkflowId) => WorkflowTabHandle;
|
|
111
|
+
/** Callback to raise a human gate in the mux UI. */
|
|
112
|
+
readonly raiseGate: (gate: HumanGateRequest) => void;
|
|
113
|
+
/** Callback to dismiss a human gate from the mux UI. */
|
|
114
|
+
readonly dismissGate: (workflowId: WorkflowId, gateId: string) => void;
|
|
115
|
+
/** Base directory for workflow artifacts and checkpoints. */
|
|
116
|
+
readonly baseDir: string;
|
|
117
|
+
/** Persistent checkpoint store for workflow resume. */
|
|
118
|
+
readonly checkpointStore: CheckpointStore;
|
|
119
|
+
/**
|
|
120
|
+
* Resolved user config. Consulted by `getRequiredServersForScope` to
|
|
121
|
+
* decide whether to mint the memory relay for a shared-container
|
|
122
|
+
* bundle (memory is opt-in per persona; see
|
|
123
|
+
* docs/designs/per-persona-memory-optin.md).
|
|
124
|
+
*/
|
|
125
|
+
readonly userConfig: ResolvedUserConfig;
|
|
126
|
+
/**
|
|
127
|
+
* Factory for creating a workflow-scoped Docker infrastructure bundle.
|
|
128
|
+
* Called at workflow start when `settings.sharedContainer === true`
|
|
129
|
+
* and the workflow uses a Docker agent. When omitted, the orchestrator
|
|
130
|
+
* loads the default implementation lazily from `src/docker/docker-infrastructure.ts`.
|
|
131
|
+
* Tests override this to avoid spinning up real Docker resources.
|
|
132
|
+
*/
|
|
133
|
+
readonly createWorkflowInfrastructure?: (input: CreateWorkflowInfrastructureInput) => Promise<DockerInfrastructure>;
|
|
134
|
+
/**
|
|
135
|
+
* Teardown counterpart for `createWorkflowInfrastructure`. Called on
|
|
136
|
+
* workflow terminal states, abort, and shutdownAll. When omitted, the
|
|
137
|
+
* orchestrator loads the default implementation lazily from
|
|
138
|
+
* `src/docker/docker-infrastructure.ts`. Tests override this to avoid
|
|
139
|
+
* touching real Docker resources.
|
|
140
|
+
*/
|
|
141
|
+
readonly destroyWorkflowInfrastructure?: (infra: DockerInfrastructure) => Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Attaches the coordinator's HTTP control server to the workflow
|
|
144
|
+
* bundle. Called once at workflow start (after the bundle is created)
|
|
145
|
+
* whenever `settings.sharedContainer === true`. The default
|
|
146
|
+
* implementation reaches through `infra.proxy.getPolicySwapTarget()` and
|
|
147
|
+
* calls `startControlServer({ socketPath })`. Tests override this to
|
|
148
|
+
* intercept the control-server wiring entirely.
|
|
149
|
+
*/
|
|
150
|
+
readonly startWorkflowControlServer?: (input: StartWorkflowControlServerInput) => Promise<void>;
|
|
151
|
+
/**
|
|
152
|
+
* Dispatches a `POST /__ironcurtain/policy/load` request to the
|
|
153
|
+
* workflow's coordinator control socket. Called before each agent
|
|
154
|
+
* state invocation to rotate the audit stream and swap the active
|
|
155
|
+
* policy. The default implementation speaks HTTP/1.1 over a Unix
|
|
156
|
+
* domain socket (no extra dependency). Tests inject a fake handler
|
|
157
|
+
* to assert on the RPC shape without standing up a real socket.
|
|
158
|
+
*/
|
|
159
|
+
readonly loadPolicyRpc?: (input: LoadPolicyRpcInput) => Promise<void>;
|
|
160
|
+
}
|
|
161
|
+
/** Lifecycle events emitted by the orchestrator. */
|
|
162
|
+
export type WorkflowLifecycleEvent = {
|
|
163
|
+
readonly kind: 'started';
|
|
164
|
+
readonly workflowId: WorkflowId;
|
|
165
|
+
readonly name: string;
|
|
166
|
+
readonly taskDescription: string;
|
|
167
|
+
} | {
|
|
168
|
+
readonly kind: 'state_entered';
|
|
169
|
+
readonly workflowId: WorkflowId;
|
|
170
|
+
readonly state: string;
|
|
171
|
+
} | {
|
|
172
|
+
readonly kind: 'completed';
|
|
173
|
+
readonly workflowId: WorkflowId;
|
|
174
|
+
} | {
|
|
175
|
+
readonly kind: 'failed';
|
|
176
|
+
readonly workflowId: WorkflowId;
|
|
177
|
+
readonly error: string;
|
|
178
|
+
} | {
|
|
179
|
+
readonly kind: 'gate_raised';
|
|
180
|
+
readonly workflowId: WorkflowId;
|
|
181
|
+
readonly gate: HumanGateRequest;
|
|
182
|
+
} | {
|
|
183
|
+
readonly kind: 'gate_dismissed';
|
|
184
|
+
readonly workflowId: WorkflowId;
|
|
185
|
+
readonly gateId: string;
|
|
186
|
+
} | {
|
|
187
|
+
readonly kind: 'agent_started';
|
|
188
|
+
readonly workflowId: WorkflowId;
|
|
189
|
+
readonly state: string;
|
|
190
|
+
readonly persona: string;
|
|
191
|
+
/**
|
|
192
|
+
* Session ID of the agent session. Consumers (e.g. the daemon's
|
|
193
|
+
* token-stream bridge wiring) use this to register the session
|
|
194
|
+
* so token events produced by this agent are routable to
|
|
195
|
+
* `observe --all` subscribers.
|
|
196
|
+
*/
|
|
197
|
+
readonly sessionId: SessionId;
|
|
198
|
+
} | {
|
|
199
|
+
readonly kind: 'agent_completed';
|
|
200
|
+
readonly workflowId: WorkflowId;
|
|
201
|
+
readonly state: string;
|
|
202
|
+
readonly persona: string;
|
|
203
|
+
readonly verdict: string;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Emitted unconditionally in the `executeAgentState` finally block --
|
|
207
|
+
* both on success (after `agent_completed`) and on failure (when the
|
|
208
|
+
* agent state threw or the verdict retry failed). Pairs 1:1 with
|
|
209
|
+
* `agent_started` and signals that the session has been closed.
|
|
210
|
+
*
|
|
211
|
+
* Consumers that registered per-agent resources (e.g. token-stream
|
|
212
|
+
* bridge entries) must clean up in response to this event so no
|
|
213
|
+
* state leaks across rapid state transitions.
|
|
214
|
+
*/
|
|
215
|
+
| {
|
|
216
|
+
readonly kind: 'agent_session_ended';
|
|
217
|
+
readonly workflowId: WorkflowId;
|
|
218
|
+
readonly state: string;
|
|
219
|
+
readonly sessionId: SessionId;
|
|
220
|
+
};
|
|
221
|
+
/** Extended workflow detail for the web UI. */
|
|
222
|
+
export interface WorkflowDetail {
|
|
223
|
+
readonly definition: WorkflowDefinition;
|
|
224
|
+
readonly transitionHistory: readonly TransitionRecord[];
|
|
225
|
+
readonly workspacePath: string;
|
|
226
|
+
readonly context: {
|
|
227
|
+
readonly taskDescription: string;
|
|
228
|
+
readonly round: number;
|
|
229
|
+
readonly maxRounds: number;
|
|
230
|
+
readonly totalTokens: number;
|
|
231
|
+
readonly visitCounts: Record<string, number>;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/** The narrow controller interface exposed to the mux. */
|
|
235
|
+
export interface WorkflowController {
|
|
236
|
+
start(definitionPath: string, taskDescription: string, workspacePath?: string): Promise<WorkflowId>;
|
|
237
|
+
resume(workflowId: WorkflowId): Promise<void>;
|
|
238
|
+
listResumable(): WorkflowId[];
|
|
239
|
+
getStatus(id: WorkflowId): WorkflowStatus | undefined;
|
|
240
|
+
getDetail(id: WorkflowId): WorkflowDetail | undefined;
|
|
241
|
+
listActive(): readonly WorkflowId[];
|
|
242
|
+
resolveGate(id: WorkflowId, event: HumanGateEvent): void;
|
|
243
|
+
abort(id: WorkflowId): Promise<void>;
|
|
244
|
+
onEvent(callback: (event: WorkflowLifecycleEvent) => void): void;
|
|
245
|
+
shutdownAll(): Promise<void>;
|
|
246
|
+
}
|
|
247
|
+
export declare class WorkflowOrchestrator implements WorkflowController {
|
|
248
|
+
private readonly deps;
|
|
249
|
+
private readonly workflows;
|
|
250
|
+
private readonly lifecycleCallbacks;
|
|
251
|
+
constructor(deps: WorkflowOrchestratorDeps);
|
|
252
|
+
/** Build a partial log entry with shared fields for the given workflow instance. */
|
|
253
|
+
private logBase;
|
|
254
|
+
/**
|
|
255
|
+
* Validates that all non-"global" personas referenced in the workflow
|
|
256
|
+
* definition actually exist on disk. Fails fast with a clear error
|
|
257
|
+
* listing all missing personas.
|
|
258
|
+
*
|
|
259
|
+
* Only checks for persona.json existence -- does NOT verify compiled
|
|
260
|
+
* policy (that happens at session creation time via resolvePersona).
|
|
261
|
+
*/
|
|
262
|
+
private validatePersonas;
|
|
263
|
+
/**
|
|
264
|
+
* Determines whether a workflow should run in shared-container mode.
|
|
265
|
+
* Requires both an explicit opt-in via `settings.sharedContainer` and
|
|
266
|
+
* a Docker-backed agent. Builtin workflows ignore the flag entirely.
|
|
267
|
+
*/
|
|
268
|
+
private shouldUseSharedContainer;
|
|
269
|
+
/**
|
|
270
|
+
* Returns the bundle for `scope`, minting a new one on first use.
|
|
271
|
+
*
|
|
272
|
+
* Each unique `containerScope` used across the workflow's states gets
|
|
273
|
+
* exactly one bundle: the first `executeAgentState` call under a given
|
|
274
|
+
* scope creates the bundle, attaches its coordinator control server,
|
|
275
|
+
* and inserts the result into `instance.bundlesByScope`. Later states
|
|
276
|
+
* with the same scope borrow the existing entry (no factory call).
|
|
277
|
+
*
|
|
278
|
+
* Replaces the pre-Step-6 eager workflow-start mint. Only invoked when
|
|
279
|
+
* `shouldUseSharedContainer(definition)` returns true; callers must
|
|
280
|
+
* gate on that check.
|
|
281
|
+
*
|
|
282
|
+
* On control-server attach failure, the just-created bundle is torn
|
|
283
|
+
* down before the error propagates so we do not leak Docker resources
|
|
284
|
+
* on partial initialization. The map is **not** populated in that case
|
|
285
|
+
* — the scope entry remains absent so a later state can retry.
|
|
286
|
+
*
|
|
287
|
+
* Concurrency: relies on serial XState invocations — there is no
|
|
288
|
+
* parallel agent-state fan-out today. If that ever lands, add an
|
|
289
|
+
* in-flight-promise guard to prevent concurrent lazy-mint races for
|
|
290
|
+
* the same scope.
|
|
291
|
+
*
|
|
292
|
+
* Abort race: if `destroyWorkflowInfrastructure` begins while a mint
|
|
293
|
+
* is suspended at either `await factory(...)` or `await startServer(...)`,
|
|
294
|
+
* the mint completes but must not publish into `bundlesByScope` —
|
|
295
|
+
* destroy already snapshot-cleared the map and would miss the late
|
|
296
|
+
* insertion. `instance.aborted` is the barrier, consulted at both
|
|
297
|
+
* `await` points; on observed abort we tear down the just-built
|
|
298
|
+
* bundle and throw without updating the map.
|
|
299
|
+
*/
|
|
300
|
+
private ensureBundleForScope;
|
|
301
|
+
/**
|
|
302
|
+
* Returns the cached policyDir for `persona`, canonicalizing on first
|
|
303
|
+
* lookup so required-server derivation and the coordinator's
|
|
304
|
+
* `loadPolicy` RPC operate on the same realpath-resolved file (any
|
|
305
|
+
* symlink under the persona dir is collapsed once, here, instead of
|
|
306
|
+
* re-resolved by every reader).
|
|
307
|
+
*/
|
|
308
|
+
private getPolicyDir;
|
|
309
|
+
/**
|
|
310
|
+
* Computes the union of MCP server names required by every agent state
|
|
311
|
+
* sharing `scope`. Threaded into the workflow infrastructure factory so
|
|
312
|
+
* the bundle only spawns proxies the policies actually reference.
|
|
313
|
+
*/
|
|
314
|
+
private getRequiredServersForScope;
|
|
315
|
+
/**
|
|
316
|
+
* Reloads the coordinator's policy for the given persona on the given
|
|
317
|
+
* bundle. Called once per agent state invocation (including re-entries)
|
|
318
|
+
* in shared-container mode. The coordinator stamps `persona` onto every
|
|
319
|
+
* subsequent audit entry, so consumers can reconstruct per-persona /
|
|
320
|
+
* per-re-entry slices from the bundle's `audit.jsonl` file.
|
|
321
|
+
*
|
|
322
|
+
* Each scope owns its own bundle, coordinator, and control socket, so
|
|
323
|
+
* the bundle is passed explicitly — cycle the scope the state is
|
|
324
|
+
* about to enter, not some other scope's bundle.
|
|
325
|
+
*
|
|
326
|
+
* On failure (control socket unreachable, coordinator reports a load
|
|
327
|
+
* error) this throws — the workflow must not proceed under the
|
|
328
|
+
* previous persona's policy.
|
|
329
|
+
*/
|
|
330
|
+
private cyclePolicy;
|
|
331
|
+
/**
|
|
332
|
+
* Tears down every bundle this workflow owns. Walks
|
|
333
|
+
* `instance.bundlesByScope.values()` in parallel via `Promise.allSettled`
|
|
334
|
+
* so failures in one bundle's teardown do not block the others. The
|
|
335
|
+
* map is drained before the awaits so a second concurrent caller (e.g.
|
|
336
|
+
* `shutdownAll` racing the fire-and-forget destroy in
|
|
337
|
+
* `handleWorkflowComplete`) sees an empty map and returns without
|
|
338
|
+
* re-entering `destroy`.
|
|
339
|
+
*
|
|
340
|
+
* Callers in recovery paths rely on **expected** failure modes being
|
|
341
|
+
* swallowed so abort/shutdown flows can complete:
|
|
342
|
+
* - Failures in `destroy(infra)` are logged to stderr and swallowed.
|
|
343
|
+
* - Failures in socket unlinks are logged and swallowed.
|
|
344
|
+
*
|
|
345
|
+
* **One exception — intentional throw on internal invariant violation.**
|
|
346
|
+
* After teardown the helper asserts `bundlesByScope.size === 0`. A
|
|
347
|
+
* non-empty map at that point is a bug: something added an entry back
|
|
348
|
+
* while teardown was in flight. The invariant is enforced by the
|
|
349
|
+
* abort-guard in `ensureBundleForScope` (post-`factory` flag check);
|
|
350
|
+
* reaching this throw means the guard has a hole and we want it to
|
|
351
|
+
* surface loudly rather than silently strand a bundle. Callers are
|
|
352
|
+
* `abort()`, `shutdownAll()`, and the fire-and-forget `.catch()` in
|
|
353
|
+
* `handleWorkflowComplete` — in the expected invariant-holds case
|
|
354
|
+
* none of them see an exception. A thrown leak assertion in
|
|
355
|
+
* `abort()` / `shutdownAll()` will propagate to their own caller (the
|
|
356
|
+
* test or CLI layer), which is the intended signal.
|
|
357
|
+
*/
|
|
358
|
+
private destroyWorkflowInfrastructure;
|
|
359
|
+
/**
|
|
360
|
+
* Lazy-loads the default `createDockerInfrastructure` wrapper. The real
|
|
361
|
+
* helper requires Docker dependencies and the session config, so we
|
|
362
|
+
* construct them here rather than eagerly at orchestrator construction
|
|
363
|
+
* time (which would pay the import cost for every workflow run,
|
|
364
|
+
* including builtin ones that don't need Docker).
|
|
365
|
+
*/
|
|
366
|
+
private loadDefaultInfrastructureFactory;
|
|
367
|
+
/** Lazy-loads the default `destroyDockerInfrastructure` helper. */
|
|
368
|
+
private loadDefaultInfrastructureTeardown;
|
|
369
|
+
/**
|
|
370
|
+
* Subscribes the workflow to the global token-stream bus. Accumulates
|
|
371
|
+
* `message_end.outputTokens` into `instance.tokens.outputTokens` for any
|
|
372
|
+
* event whose session ID is in `instance.tokens.sessionIds`. The set is managed
|
|
373
|
+
* by `executeAgentState` (added before `agent_started`, removed in the
|
|
374
|
+
* `finally` block after `agent_session_ended`).
|
|
375
|
+
*
|
|
376
|
+
* Installed synchronously so the subscription is live before any agent
|
|
377
|
+
* state runs — no window where bus events go unobserved.
|
|
378
|
+
*/
|
|
379
|
+
private setupTokenSubscription;
|
|
380
|
+
/**
|
|
381
|
+
* Tears down the token-stream bus subscription. Idempotent: safe to
|
|
382
|
+
* call from both normal completion and abort paths.
|
|
383
|
+
*/
|
|
384
|
+
private teardownTokenSubscription;
|
|
385
|
+
start(definitionPath: string, taskDescription: string, workspacePath?: string): Promise<WorkflowId>;
|
|
386
|
+
resume(workflowId: WorkflowId): Promise<void>;
|
|
387
|
+
/**
|
|
388
|
+
* Manually executes the invoke service for a state that was restored from
|
|
389
|
+
* a checkpoint. XState does not re-trigger invocations when an actor is
|
|
390
|
+
* started from a persisted snapshot, so we run the service ourselves and
|
|
391
|
+
* send the result event to the actor.
|
|
392
|
+
*/
|
|
393
|
+
private replayInvokeForRestoredState;
|
|
394
|
+
listResumable(): WorkflowId[];
|
|
395
|
+
getStatus(id: WorkflowId): WorkflowStatus | undefined;
|
|
396
|
+
getDetail(id: WorkflowId): WorkflowDetail | undefined;
|
|
397
|
+
listActive(): readonly WorkflowId[];
|
|
398
|
+
resolveGate(id: WorkflowId, event: HumanGateEvent): void;
|
|
399
|
+
abort(id: WorkflowId): Promise<void>;
|
|
400
|
+
onEvent(callback: (event: WorkflowLifecycleEvent) => void): void;
|
|
401
|
+
shutdownAll(): Promise<void>;
|
|
402
|
+
/** Injects concrete agent/deterministic service implementations into the machine. */
|
|
403
|
+
private provideActors;
|
|
404
|
+
/** Subscribes to actor snapshot changes for lifecycle events, gates, and checkpointing. */
|
|
405
|
+
private subscribeToActor;
|
|
406
|
+
/**
|
|
407
|
+
* Returns true if `stateValue` names a terminal state in the workflow
|
|
408
|
+
* definition. Used to skip checkpointing on the final transition so the
|
|
409
|
+
* last on-disk checkpoint points at the last non-terminal state (important
|
|
410
|
+
* for resume-after-abort, which would otherwise reload an `aborted`
|
|
411
|
+
* snapshot and immediately re-terminate).
|
|
412
|
+
*/
|
|
413
|
+
private isTerminalStateValue;
|
|
414
|
+
private buildCheckpoint;
|
|
415
|
+
private saveCheckpoint;
|
|
416
|
+
private executeAgentState;
|
|
417
|
+
private executeDeterministicState;
|
|
418
|
+
private handleGateEntry;
|
|
419
|
+
private buildGateRequest;
|
|
420
|
+
private handleWorkflowComplete;
|
|
421
|
+
private findMissingArtifacts;
|
|
422
|
+
private emitLifecycleEvent;
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* Default `loadPolicyRpc`: speaks HTTP/1.1 over the supplied UDS using
|
|
426
|
+
* Node's built-in client. Resolves on a 2xx response; rejects on any
|
|
427
|
+
* non-2xx status, request timeout, or socket error. The coordinator's
|
|
428
|
+
* reply body is read only on the error path (to surface the error
|
|
429
|
+
* text) — 2xx bodies are discarded with `res.resume()`.
|
|
430
|
+
*
|
|
431
|
+
* Exported so integration tests can drive the wire format without
|
|
432
|
+
* standing up a full `WorkflowOrchestrator`. Keeping the HTTP request
|
|
433
|
+
* construction in one place guarantees tests exercise the same bytes
|
|
434
|
+
* production emits.
|
|
435
|
+
*/
|
|
436
|
+
export declare function defaultLoadPolicyRpc(input: LoadPolicyRpcInput): Promise<void>;
|
|
437
|
+
/**
|
|
438
|
+
* Computes a SHA-256 hash of output artifacts or workspace root file metadata.
|
|
439
|
+
*
|
|
440
|
+
* Hashes file metadata (path + size + mtime) — never contents. This bounds cost
|
|
441
|
+
* regardless of artifact size (fuzz logs, captured stderr, etc. can be many GiB
|
|
442
|
+
* and would otherwise trip Node's 2 GiB `readFile` ceiling). Any agent rewrite
|
|
443
|
+
* via fs ops bumps mtime, and same-mtime-same-size collisions in a single ms
|
|
444
|
+
* window are not a concern for workflow change detection.
|
|
445
|
+
*/
|
|
446
|
+
export declare function computeOutputHash(outputNames: readonly string[], artifactDir: string, workspacePath: string): string;
|
|
447
|
+
/**
|
|
448
|
+
* Collects artifact paths: maps output name -> directory path.
|
|
449
|
+
*/
|
|
450
|
+
export declare function collectArtifactPaths(outputNames: readonly string[], artifactDir: string): Record<string, string>;
|