@provos/ironcurtain 0.9.1 → 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 +69 -10
- package/dist/auth/oauth-provider.js +1 -4
- package/dist/auth/oauth-provider.js.map +1 -1
- package/dist/cli.js +40 -2
- package/dist/cli.js.map +1 -1
- package/dist/config/config-command.js +174 -10
- 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/model-provider.d.ts +8 -2
- package/dist/config/model-provider.js +52 -9
- package/dist/config/model-provider.js.map +1 -1
- package/dist/config/paths.d.ts +181 -0
- package/dist/config/paths.js +326 -23
- package/dist/config/paths.js.map +1 -1
- package/dist/config/types.d.ts +7 -1
- package/dist/config/user-config.d.ts +61 -4
- package/dist/config/user-config.js +108 -21
- 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/compile-task-policy.js +1 -0
- package/dist/cron/compile-task-policy.js.map +1 -1
- 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.d.ts +2 -1
- package/dist/docker/adapters/claude-code.js +320 -131
- 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/agent-registry.js +3 -2
- package/dist/docker/agent-registry.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/container-lifecycle.d.ts +15 -0
- package/dist/docker/container-lifecycle.js +32 -0
- package/dist/docker/container-lifecycle.js.map +1 -0
- package/dist/docker/docker-agent-session.d.ts +113 -62
- package/dist/docker/docker-agent-session.js +241 -300
- package/dist/docker/docker-agent-session.js.map +1 -1
- package/dist/docker/docker-infrastructure.d.ts +256 -21
- package/dist/docker/docker-infrastructure.js +585 -30
- package/dist/docker/docker-infrastructure.js.map +1 -1
- package/dist/docker/docker-manager.d.ts +36 -1
- package/dist/docker/docker-manager.js +168 -26
- 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 +90 -1
- package/dist/docker/mitm-proxy.js +720 -40
- 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 +81 -2
- package/dist/docker/provider-config.js +222 -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 +212 -90
- 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 +61 -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 +32 -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-app.d.ts +2 -0
- package/dist/mux/mux-app.js +30 -34
- package/dist/mux/mux-app.js.map +1 -1
- package/dist/mux/mux-command.d.ts +10 -1
- package/dist/mux/mux-command.js +62 -35
- package/dist/mux/mux-command.js.map +1 -1
- package/dist/mux/mux-renderer.js +22 -17
- package/dist/mux/mux-renderer.js.map +1 -1
- package/dist/mux/pty-bridge.d.ts +2 -0
- package/dist/mux/pty-bridge.js +3 -0
- package/dist/mux/pty-bridge.js.map +1 -1
- package/dist/mux/session-scanner.d.ts +7 -0
- package/dist/mux/session-scanner.js +21 -2
- package/dist/mux/session-scanner.js.map +1 -1
- package/dist/mux/types.d.ts +0 -4
- package/dist/mux/types.js.map +1 -1
- package/dist/{pipeline → observability}/llm-logger.d.ts +9 -3
- package/dist/{pipeline → observability}/llm-logger.js +16 -4
- 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/compile-persona-policy.js +1 -0
- package/dist/persona/compile-persona-policy.js.map +1 -1
- 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/annotate.d.ts +7 -1
- package/dist/pipeline/annotate.js +92 -2
- package/dist/pipeline/annotate.js.map +1 -1
- package/dist/pipeline/compile.js +2 -0
- package/dist/pipeline/compile.js.map +1 -1
- 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/parallel-progress.d.ts +59 -0
- package/dist/pipeline/parallel-progress.js +263 -0
- package/dist/pipeline/parallel-progress.js.map +1 -0
- package/dist/pipeline/pipeline-runner.d.ts +49 -8
- package/dist/pipeline/pipeline-runner.js +419 -231
- package/dist/pipeline/pipeline-runner.js.map +1 -1
- package/dist/pipeline/pipeline-shared.d.ts +59 -1
- package/dist/pipeline/pipeline-shared.js +127 -12
- 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/pipeline/server-prefilter.d.ts +31 -0
- package/dist/pipeline/server-prefilter.js +115 -0
- package/dist/pipeline/server-prefilter.js.map +1 -0
- package/dist/pipeline/types.d.ts +5 -0
- 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 +26 -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 +12 -1
- package/docker/Dockerfile.base.arm64 +17 -1
- package/docker/entrypoint-claude-code.sh +46 -0
- package/docker/entrypoint-goose.sh +25 -0
- package/package.json +22 -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,498 @@
|
|
|
1
|
+
import type { AgentConversationId } from '../session/types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Directory name for workflow artifacts inside the agent workspace.
|
|
4
|
+
* All artifact subdirectories (plan/, code/, reviews/, etc.) live under this.
|
|
5
|
+
*/
|
|
6
|
+
export declare const WORKFLOW_ARTIFACT_DIR = ".workflow";
|
|
7
|
+
/**
|
|
8
|
+
* Reserved persona alias meaning "use the global policy".
|
|
9
|
+
* When a workflow state specifies this as its persona, the session
|
|
10
|
+
* factory strips the persona field (same as undefined), so the
|
|
11
|
+
* session uses the default global compiled policy and memory.
|
|
12
|
+
*
|
|
13
|
+
* Any other persona value is passed through to `createSession()`,
|
|
14
|
+
* which resolves it to a per-persona policy, memory, and prompt.
|
|
15
|
+
*/
|
|
16
|
+
export declare const GLOBAL_PERSONA = "global";
|
|
17
|
+
/**
|
|
18
|
+
* Sentinel value for an agent state's `skills:` field meaning "no skills
|
|
19
|
+
* of any kind". Strictly stronger than `[]` (which still loads
|
|
20
|
+
* user-global + persona skills); this disables every layer.
|
|
21
|
+
*/
|
|
22
|
+
export declare const SKILLS_NONE = "none";
|
|
23
|
+
/**
|
|
24
|
+
* Translate an agent state's `skills:` field into the subset of
|
|
25
|
+
* `WorkflowBorrowOptions` that controls skill resolution. `disableAllSkills`
|
|
26
|
+
* is mutually exclusive with `skillsDir` / `skillFilter`: when the sentinel
|
|
27
|
+
* is present, only `disableAllSkills: true` is set; otherwise `skillsDir`
|
|
28
|
+
* and `skillFilter` may co-occur. Used by both the orchestrator and the
|
|
29
|
+
* run-state CLI so the invariant lives in one place.
|
|
30
|
+
*/
|
|
31
|
+
export declare function resolveWorkflowSkillsOptions(skills: readonly string[] | typeof SKILLS_NONE | undefined, skillsDir: string | undefined): {
|
|
32
|
+
skillsDir?: string;
|
|
33
|
+
skillFilter?: ReadonlySet<string>;
|
|
34
|
+
disableAllSkills?: true;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Default `containerScope` value assigned to agent states that do not
|
|
38
|
+
* declare one explicitly. Every such state shares the workflow's primary
|
|
39
|
+
* bundle. The orchestrator's scope-lookup path resolves
|
|
40
|
+
* `stateConfig.containerScope ?? DEFAULT_CONTAINER_SCOPE` before dispatch.
|
|
41
|
+
*
|
|
42
|
+
* Scope strings are opaque Map lookup keys — they are never embedded in
|
|
43
|
+
* filesystem paths (bundle directory names use the UUID `bundleId`).
|
|
44
|
+
*
|
|
45
|
+
* See `docs/designs/workflow-session-identity.md` §2.4 / §6.
|
|
46
|
+
*/
|
|
47
|
+
export declare const DEFAULT_CONTAINER_SCOPE = "primary";
|
|
48
|
+
/**
|
|
49
|
+
* Unique identifier for a workflow instance. Branded to prevent accidental
|
|
50
|
+
* mixing with other string identifiers.
|
|
51
|
+
*/
|
|
52
|
+
export type WorkflowId = string & {
|
|
53
|
+
readonly __brand: 'WorkflowId';
|
|
54
|
+
};
|
|
55
|
+
/** Creates a new unique WorkflowId. */
|
|
56
|
+
export declare function createWorkflowId(): WorkflowId;
|
|
57
|
+
export interface WorkflowDefinition {
|
|
58
|
+
readonly name: string;
|
|
59
|
+
readonly description: string;
|
|
60
|
+
readonly initial: string;
|
|
61
|
+
readonly states: Record<string, WorkflowStateDefinition>;
|
|
62
|
+
readonly settings?: WorkflowSettings;
|
|
63
|
+
}
|
|
64
|
+
export interface WorkflowSettings {
|
|
65
|
+
/** Session mode. Default: 'docker'. */
|
|
66
|
+
readonly mode?: 'docker' | 'builtin';
|
|
67
|
+
/** Agent ID for Docker mode. Default: 'claude-code'. */
|
|
68
|
+
readonly dockerAgent?: string;
|
|
69
|
+
/** Default max rounds for iterative loops. Default: 4. */
|
|
70
|
+
readonly maxRounds?: number;
|
|
71
|
+
/** Git repository path for worktree management. */
|
|
72
|
+
readonly gitRepoPath?: string;
|
|
73
|
+
/** Max parallel agent sessions. Default: 3. */
|
|
74
|
+
readonly maxParallelism?: number;
|
|
75
|
+
/**
|
|
76
|
+
* Optional system prompt text appended to the base system prompt
|
|
77
|
+
* for ALL agent states in this workflow. Use for workspace
|
|
78
|
+
* conventions, project-level context, or shared instructions.
|
|
79
|
+
* Sent via --append-system-prompt.
|
|
80
|
+
*/
|
|
81
|
+
readonly systemPrompt?: string;
|
|
82
|
+
/**
|
|
83
|
+
* Per-turn wall-clock timeout in seconds for agent sessions.
|
|
84
|
+
* Overrides the global resourceBudget.maxSessionSeconds for this workflow.
|
|
85
|
+
* Default: uses the global setting (1800s / 30 minutes).
|
|
86
|
+
*/
|
|
87
|
+
readonly maxSessionSeconds?: number;
|
|
88
|
+
/** Output artifact names excluded from versioning (e.g., append-only journals). */
|
|
89
|
+
readonly unversionedArtifacts?: readonly string[];
|
|
90
|
+
/**
|
|
91
|
+
* Default model ID for all agent states in this workflow.
|
|
92
|
+
* Format: "provider:model-name" (e.g., "anthropic:claude-sonnet-4-6").
|
|
93
|
+
* Can be overridden per state via `states.<name>.model`.
|
|
94
|
+
* Takes precedence over `agentModelId` from user config but is
|
|
95
|
+
* overridden by the `--model` CLI flag.
|
|
96
|
+
*/
|
|
97
|
+
readonly model?: string;
|
|
98
|
+
/**
|
|
99
|
+
* When true, the workflow runs in shared-container mode: the engine
|
|
100
|
+
* creates one DockerInfrastructure bundle at workflow start and
|
|
101
|
+
* reuses it across all states. When false (default), each state
|
|
102
|
+
* gets a fresh container (today's behavior).
|
|
103
|
+
*
|
|
104
|
+
* Shared-container mode is the prerequisite for policy hot-swap at
|
|
105
|
+
* state transitions. See docs/designs/workflow-container-lifecycle.md.
|
|
106
|
+
*
|
|
107
|
+
* Ignored for builtin workflows (no Docker infrastructure to share).
|
|
108
|
+
*/
|
|
109
|
+
readonly sharedContainer?: boolean;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* State definition. Discriminated on `type`.
|
|
113
|
+
*/
|
|
114
|
+
export type WorkflowStateDefinition = AgentStateDefinition | HumanGateStateDefinition | DeterministicStateDefinition | TerminalStateDefinition;
|
|
115
|
+
export interface AgentStateDefinition {
|
|
116
|
+
readonly type: 'agent';
|
|
117
|
+
readonly description: string;
|
|
118
|
+
readonly persona: string;
|
|
119
|
+
/**
|
|
120
|
+
* Role instructions for the agent. Embedded in the full prompt assembled
|
|
121
|
+
* by the orchestrator; see `buildFirstVisitPrompt` / `buildReVisitPrompt`
|
|
122
|
+
* in prompt-builder.ts for the section layout. The role prompt is
|
|
123
|
+
* positioned for recency bias on first visit; re-invocations reuse the
|
|
124
|
+
* conversation history via `--continue`.
|
|
125
|
+
*/
|
|
126
|
+
readonly prompt: string;
|
|
127
|
+
/**
|
|
128
|
+
* Input artifact names assembled into the agent's command.
|
|
129
|
+
* Trailing `?` marks optional inputs (no error if absent).
|
|
130
|
+
*/
|
|
131
|
+
readonly inputs: readonly string[];
|
|
132
|
+
/** Output artifact names the agent is expected to produce. */
|
|
133
|
+
readonly outputs: readonly string[];
|
|
134
|
+
/** Transitions evaluated in order; first match wins. */
|
|
135
|
+
readonly transitions: readonly AgentTransitionDefinition[];
|
|
136
|
+
/** When true, each parallel instance gets a dedicated git worktree. */
|
|
137
|
+
readonly worktree?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* When false, re-invocations of this state resume the previous agent
|
|
140
|
+
* session via --continue, receiving an abbreviated re-visit prompt.
|
|
141
|
+
* Use this for iterative refinement loops where the agent benefits
|
|
142
|
+
* from retaining its prior reasoning (e.g., harness design/build after
|
|
143
|
+
* critique feedback).
|
|
144
|
+
*
|
|
145
|
+
* Default: true (each invocation starts a fresh session, bootstrapping
|
|
146
|
+
* from artifacts on disk).
|
|
147
|
+
*/
|
|
148
|
+
readonly freshSession?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Per-state model override. Format: "provider:model-name".
|
|
151
|
+
* Takes precedence over `settings.model` at the workflow level.
|
|
152
|
+
* Overridden only by the `--model` CLI flag.
|
|
153
|
+
*/
|
|
154
|
+
readonly model?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Per-state visit cap. When set, the `isStateVisitLimitReached` guard
|
|
157
|
+
* returns true once `context.visitCounts[stateId] >= maxVisits`. Use
|
|
158
|
+
* this to bound an iterative loop (e.g., harness_design_review) and
|
|
159
|
+
* route to a human gate once the cap is reached. Independent of the
|
|
160
|
+
* workflow-level `maxRounds` setting.
|
|
161
|
+
*
|
|
162
|
+
* Because visit counts are incremented on state entry (before
|
|
163
|
+
* `invoke`), the guard fires on the onDone transitions of the Nth
|
|
164
|
+
* visit — i.e., after the Nth invocation completes.
|
|
165
|
+
*/
|
|
166
|
+
readonly maxVisits?: number;
|
|
167
|
+
/**
|
|
168
|
+
* Container scope label. States sharing a scope share a bundle (one
|
|
169
|
+
* container, one coordinator, one audit log, one control socket);
|
|
170
|
+
* states with different scopes live in different bundles. When unset,
|
|
171
|
+
* defaults to `"primary"`, so every state lands on the workflow's
|
|
172
|
+
* primary bundle by default.
|
|
173
|
+
*
|
|
174
|
+
* Meaningful only under `sharedContainer: true`. Under
|
|
175
|
+
* `sharedContainer: false` (legacy default, one container per state)
|
|
176
|
+
* declaring a `containerScope` is a validation error — silent no-ops
|
|
177
|
+
* are footguns; we reject at validate.ts.
|
|
178
|
+
*
|
|
179
|
+
* Charset: `/^[a-zA-Z0-9_-]+$/`. Scope strings are opaque Map lookup
|
|
180
|
+
* keys — they are NEVER embedded in filesystem paths; the on-disk
|
|
181
|
+
* bundle directory name is the UUID `bundleId`, not the scope.
|
|
182
|
+
*
|
|
183
|
+
* See `docs/designs/workflow-session-identity.md` §2.4.
|
|
184
|
+
*/
|
|
185
|
+
readonly containerScope?: string;
|
|
186
|
+
/**
|
|
187
|
+
* Per-state filter on workflow-package skills (`<workflow-pkg>/skills/`).
|
|
188
|
+
* When omitted (default), the state receives every workflow-package
|
|
189
|
+
* skill. When set to an array, only the named entries from the
|
|
190
|
+
* workflow package are layered in — referenced names that do not
|
|
191
|
+
* exist as `<workflow-pkg>/skills/<name>/SKILL.md` fail validation at
|
|
192
|
+
* workflow load. User-global skills always apply regardless of this
|
|
193
|
+
* field. The literal sentinel `'none'` is a true off-switch: no skills
|
|
194
|
+
* of any kind (workflow-package, user-global, or persona) are loaded
|
|
195
|
+
* for the state.
|
|
196
|
+
*/
|
|
197
|
+
readonly skills?: readonly string[] | typeof SKILLS_NONE;
|
|
198
|
+
}
|
|
199
|
+
export interface HumanGateStateDefinition {
|
|
200
|
+
readonly type: 'human_gate';
|
|
201
|
+
readonly description: string;
|
|
202
|
+
/** Event types this gate accepts. Each maps to a HUMAN_* WorkflowEvent. */
|
|
203
|
+
readonly acceptedEvents: readonly HumanGateEventType[];
|
|
204
|
+
/** Artifact names to present to the human for review. */
|
|
205
|
+
readonly present?: readonly string[];
|
|
206
|
+
/**
|
|
207
|
+
* Transitions keyed by accepted event type.
|
|
208
|
+
* Each transition specifies which event triggers it and where to go.
|
|
209
|
+
*/
|
|
210
|
+
readonly transitions: readonly HumanGateTransitionDefinition[];
|
|
211
|
+
}
|
|
212
|
+
export interface DeterministicStateDefinition {
|
|
213
|
+
readonly type: 'deterministic';
|
|
214
|
+
readonly description: string;
|
|
215
|
+
/**
|
|
216
|
+
* Commands to execute. Each command is an array of [binary, ...args].
|
|
217
|
+
* Never a shell string -- per CLAUDE.md safe coding rules.
|
|
218
|
+
*/
|
|
219
|
+
readonly run: readonly (readonly string[])[];
|
|
220
|
+
readonly transitions: readonly AgentTransitionDefinition[];
|
|
221
|
+
}
|
|
222
|
+
export interface TerminalStateDefinition {
|
|
223
|
+
readonly type: 'terminal';
|
|
224
|
+
readonly description: string;
|
|
225
|
+
readonly outputs?: readonly string[];
|
|
226
|
+
readonly cleanup?: readonly (readonly string[])[];
|
|
227
|
+
}
|
|
228
|
+
/** Allowed value types in a `when` clause. Matches AgentOutput field types. */
|
|
229
|
+
export type WhenValue = string | number | boolean | null;
|
|
230
|
+
/**
|
|
231
|
+
* Per-key typed shape for `when` clauses. Using a mapped type here
|
|
232
|
+
* enforces compile-time validation of both key names (must be in
|
|
233
|
+
* AgentOutput) and value types (must match the field's type, e.g.
|
|
234
|
+
* `completed` must be boolean, `verdict` must be a valid union member).
|
|
235
|
+
*
|
|
236
|
+
* Prefer this type over `Readonly<Record<string, WhenValue>>` when
|
|
237
|
+
* writing workflow definitions in TypeScript.
|
|
238
|
+
*/
|
|
239
|
+
export type WhenClause = {
|
|
240
|
+
readonly [K in keyof AgentOutput]?: AgentOutput[K];
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Action executed on a transition, in addition to the default context
|
|
244
|
+
* update actions (updateContextFromAgentResult / ...). Discriminated on
|
|
245
|
+
* `type`. Implementations live in `machine-builder.ts` — this is a
|
|
246
|
+
* closed set, not an open extension point.
|
|
247
|
+
*
|
|
248
|
+
* Today there is only a single variant, but the discriminated-union
|
|
249
|
+
* shape is retained so new action types can be added without changing
|
|
250
|
+
* the surrounding shape of transition definitions.
|
|
251
|
+
*/
|
|
252
|
+
export type WorkflowTransitionAction = {
|
|
253
|
+
readonly type: 'resetVisitCounts';
|
|
254
|
+
readonly stateIds: readonly string[];
|
|
255
|
+
};
|
|
256
|
+
export interface AgentTransitionDefinition {
|
|
257
|
+
readonly to: string;
|
|
258
|
+
/**
|
|
259
|
+
* Guard name matching a registered XState guard. No translation
|
|
260
|
+
* layer -- use names directly: isRoundLimitReached, isStalled, isPassed,
|
|
261
|
+
* isStateVisitLimitReached. For verdict-based routing, prefer `when`
|
|
262
|
+
* clauses instead. Mutually exclusive with `when`.
|
|
263
|
+
*/
|
|
264
|
+
readonly guard?: string;
|
|
265
|
+
/**
|
|
266
|
+
* Declarative field-match condition on AgentOutput.
|
|
267
|
+
* Keys must be valid AgentOutput field names and values must match
|
|
268
|
+
* the field's type (enforced at compile time via the mapped type).
|
|
269
|
+
* All entries must match (AND semantics).
|
|
270
|
+
* Mutually exclusive with `guard`.
|
|
271
|
+
*/
|
|
272
|
+
readonly when?: WhenClause;
|
|
273
|
+
/**
|
|
274
|
+
* Optional ordered list of actions to run on this transition, in
|
|
275
|
+
* addition to the default context-update action. Actions execute
|
|
276
|
+
* in the order listed.
|
|
277
|
+
*/
|
|
278
|
+
readonly actions?: readonly WorkflowTransitionAction[];
|
|
279
|
+
}
|
|
280
|
+
export interface HumanGateTransitionDefinition {
|
|
281
|
+
readonly to: string;
|
|
282
|
+
/** The accepted event type that triggers this transition. */
|
|
283
|
+
readonly event: HumanGateEventType;
|
|
284
|
+
/**
|
|
285
|
+
* Optional ordered list of actions to run on this transition, in
|
|
286
|
+
* addition to the default gate context-update actions (storeHumanPrompt,
|
|
287
|
+
* clearError). Actions execute in the order listed.
|
|
288
|
+
*/
|
|
289
|
+
readonly actions?: readonly WorkflowTransitionAction[];
|
|
290
|
+
}
|
|
291
|
+
export type HumanGateEventType = 'APPROVE' | 'FORCE_REVISION' | 'REPLAN' | 'ABORT';
|
|
292
|
+
export declare const CONFIDENCE_VALUES: readonly ["high", "medium", "low"];
|
|
293
|
+
export type Confidence = (typeof CONFIDENCE_VALUES)[number];
|
|
294
|
+
/** Structured output parsed from the agent's response text. */
|
|
295
|
+
export interface AgentOutput {
|
|
296
|
+
/**
|
|
297
|
+
* @deprecated Maintained for backward compatibility. Defaults to `true`
|
|
298
|
+
* at parse time. Workflows should use free-form `verdict` strings for
|
|
299
|
+
* routing decisions instead of relying on this boolean.
|
|
300
|
+
*/
|
|
301
|
+
readonly completed: boolean;
|
|
302
|
+
/** Free-form verdict string. Well-known values: approved, rejected, blocked, spec_flaw. Workflows may define custom verdicts for direct routing. */
|
|
303
|
+
readonly verdict: string;
|
|
304
|
+
/**
|
|
305
|
+
* @deprecated Maintained for backward compatibility. Defaults to `'high'`
|
|
306
|
+
* at parse time. Should not be relied upon for routing decisions; use
|
|
307
|
+
* `verdict` and `notes` instead.
|
|
308
|
+
*/
|
|
309
|
+
readonly confidence: Confidence;
|
|
310
|
+
/**
|
|
311
|
+
* @deprecated Maintained for backward compatibility. Defaults to `null`
|
|
312
|
+
* at parse time. Use `notes` for inter-agent context instead.
|
|
313
|
+
*/
|
|
314
|
+
readonly escalation: string | null;
|
|
315
|
+
/**
|
|
316
|
+
* @deprecated Maintained for backward compatibility. Defaults to `null`
|
|
317
|
+
* at parse time. Should not be relied upon for routing decisions.
|
|
318
|
+
*/
|
|
319
|
+
readonly testCount: number | null;
|
|
320
|
+
readonly notes: string | null;
|
|
321
|
+
}
|
|
322
|
+
/** Valid keys for `when` clauses. Must match AgentOutput field names. */
|
|
323
|
+
export declare const AGENT_OUTPUT_FIELDS: readonly ["completed", "verdict", "confidence", "escalation", "testCount", "notes"];
|
|
324
|
+
export type WorkflowEvent = {
|
|
325
|
+
readonly type: 'AGENT_COMPLETED';
|
|
326
|
+
readonly output: AgentOutput;
|
|
327
|
+
} | {
|
|
328
|
+
readonly type: 'VALIDATION_PASSED';
|
|
329
|
+
readonly testCount: number;
|
|
330
|
+
} | {
|
|
331
|
+
readonly type: 'VALIDATION_FAILED';
|
|
332
|
+
readonly errors: string;
|
|
333
|
+
} | {
|
|
334
|
+
readonly type: 'HUMAN_APPROVE';
|
|
335
|
+
readonly prompt?: string;
|
|
336
|
+
} | {
|
|
337
|
+
readonly type: 'HUMAN_FORCE_REVISION';
|
|
338
|
+
readonly prompt?: string;
|
|
339
|
+
} | {
|
|
340
|
+
readonly type: 'HUMAN_REPLAN';
|
|
341
|
+
readonly prompt?: string;
|
|
342
|
+
} | {
|
|
343
|
+
readonly type: 'HUMAN_ABORT';
|
|
344
|
+
} | {
|
|
345
|
+
readonly type: 'PARALLEL_ALL_COMPLETED';
|
|
346
|
+
readonly results: readonly ParallelSlotResult[];
|
|
347
|
+
} | {
|
|
348
|
+
readonly type: 'PARALLEL_SLOT_FAILED';
|
|
349
|
+
readonly key: string;
|
|
350
|
+
readonly error: string;
|
|
351
|
+
} | {
|
|
352
|
+
readonly type: 'MERGE_SUCCEEDED';
|
|
353
|
+
} | {
|
|
354
|
+
readonly type: 'MERGE_CONFLICT';
|
|
355
|
+
readonly conflictDetails: string;
|
|
356
|
+
};
|
|
357
|
+
export interface WorkflowContext {
|
|
358
|
+
readonly taskDescription: string;
|
|
359
|
+
readonly artifacts: Record<string, string>;
|
|
360
|
+
readonly round: number;
|
|
361
|
+
readonly maxRounds: number;
|
|
362
|
+
/** Per-role output hash for stall detection. */
|
|
363
|
+
readonly previousOutputHashes: Record<string, string>;
|
|
364
|
+
readonly previousTestCount: number | null;
|
|
365
|
+
readonly humanPrompt: string | null;
|
|
366
|
+
readonly reviewHistory: readonly string[];
|
|
367
|
+
readonly parallelResults: Record<string, ParallelSlotResult>;
|
|
368
|
+
readonly worktreeBranches: readonly string[];
|
|
369
|
+
readonly totalTokens: number;
|
|
370
|
+
readonly lastError: string | null;
|
|
371
|
+
/**
|
|
372
|
+
* Maps a stateId to the agent-CLI conversation id assigned on the last
|
|
373
|
+
* successful invocation of that state. Consumed by `freshSession: false`
|
|
374
|
+
* re-entries so the CLI can `--resume` the prior conversation.
|
|
375
|
+
*
|
|
376
|
+
* See `docs/designs/workflow-session-identity.md` §2.4.
|
|
377
|
+
*/
|
|
378
|
+
readonly agentConversationsByState: Record<string, AgentConversationId>;
|
|
379
|
+
/**
|
|
380
|
+
* Response text from the last completed agent state, with the trailing
|
|
381
|
+
* `agent_status` YAML block stripped. Truncated at 32KB. Used as the
|
|
382
|
+
* "body" portion of the "Scoping from the previous agent" section in the
|
|
383
|
+
* next agent's prompt — carries the full directive, not just the summary.
|
|
384
|
+
*/
|
|
385
|
+
readonly previousAgentOutput: string | null;
|
|
386
|
+
/**
|
|
387
|
+
* The `notes` field from the last agent's `agent_status` block. Rendered
|
|
388
|
+
* as the "Notes" sub-section under "Scoping from the previous agent".
|
|
389
|
+
* When the orchestrator writes a bare status block with no directive, this
|
|
390
|
+
* is often the only surviving scoping signal.
|
|
391
|
+
*/
|
|
392
|
+
readonly previousAgentNotes: string | null;
|
|
393
|
+
/**
|
|
394
|
+
* The state name that produced `previousAgentOutput`. Used to
|
|
395
|
+
* label the output in the next agent's prompt.
|
|
396
|
+
*/
|
|
397
|
+
readonly previousStateName: string | null;
|
|
398
|
+
/**
|
|
399
|
+
* Per-state visit counter. Maps state ID to the number of times
|
|
400
|
+
* that state has been entered. Used for first-visit vs re-visit
|
|
401
|
+
* prompt selection and per-state round limit checking.
|
|
402
|
+
*/
|
|
403
|
+
readonly visitCounts: Readonly<Record<string, number>>;
|
|
404
|
+
}
|
|
405
|
+
export type WorkflowStatus = {
|
|
406
|
+
readonly phase: 'running';
|
|
407
|
+
readonly currentState: string;
|
|
408
|
+
readonly activeAgents: readonly AgentSlot[];
|
|
409
|
+
} | {
|
|
410
|
+
readonly phase: 'waiting_human';
|
|
411
|
+
readonly gate: HumanGateRequest;
|
|
412
|
+
} | {
|
|
413
|
+
readonly phase: 'completed';
|
|
414
|
+
readonly result: WorkflowResult;
|
|
415
|
+
} | {
|
|
416
|
+
readonly phase: 'failed';
|
|
417
|
+
readonly error: string;
|
|
418
|
+
readonly lastState: string;
|
|
419
|
+
} | {
|
|
420
|
+
readonly phase: 'aborted';
|
|
421
|
+
readonly reason: string;
|
|
422
|
+
};
|
|
423
|
+
export interface AgentSlot {
|
|
424
|
+
readonly stateId: string;
|
|
425
|
+
readonly persona: string;
|
|
426
|
+
}
|
|
427
|
+
export interface WorkflowResult {
|
|
428
|
+
readonly finalArtifacts: Record<string, string>;
|
|
429
|
+
}
|
|
430
|
+
export interface ParallelSlotResult {
|
|
431
|
+
readonly key: string;
|
|
432
|
+
readonly status: 'success' | 'failed';
|
|
433
|
+
readonly error?: string;
|
|
434
|
+
readonly worktreeBranch?: string;
|
|
435
|
+
}
|
|
436
|
+
export interface HumanGateRequest {
|
|
437
|
+
readonly gateId: string;
|
|
438
|
+
readonly workflowId: string;
|
|
439
|
+
readonly stateName: string;
|
|
440
|
+
readonly acceptedEvents: readonly HumanGateEventType[];
|
|
441
|
+
readonly presentedArtifacts: ReadonlyMap<string, string>;
|
|
442
|
+
readonly summary: string;
|
|
443
|
+
}
|
|
444
|
+
/**
|
|
445
|
+
* JSON-serializable view of HumanGateRequest. The domain type's
|
|
446
|
+
* `presentedArtifacts` is a `ReadonlyMap` which doesn't JSON-encode;
|
|
447
|
+
* the DTO replaces it with the artifact names as a plain array.
|
|
448
|
+
*/
|
|
449
|
+
export interface HumanGateRequestDto {
|
|
450
|
+
readonly gateId: string;
|
|
451
|
+
readonly workflowId: string;
|
|
452
|
+
readonly stateName: string;
|
|
453
|
+
readonly acceptedEvents: readonly string[];
|
|
454
|
+
/** Artifact names only (not content). */
|
|
455
|
+
readonly presentedArtifacts: readonly string[];
|
|
456
|
+
readonly summary: string;
|
|
457
|
+
}
|
|
458
|
+
export declare function toHumanGateRequestDto(gate: HumanGateRequest): HumanGateRequestDto;
|
|
459
|
+
export interface HumanGateEvent {
|
|
460
|
+
readonly type: HumanGateEventType;
|
|
461
|
+
readonly prompt?: string;
|
|
462
|
+
}
|
|
463
|
+
export interface WorkflowCheckpoint {
|
|
464
|
+
/** Serialized XState snapshot.value (string or nested object). */
|
|
465
|
+
readonly machineState: unknown;
|
|
466
|
+
readonly context: WorkflowContext;
|
|
467
|
+
readonly timestamp: string;
|
|
468
|
+
readonly transitionHistory: readonly TransitionRecord[];
|
|
469
|
+
readonly definitionPath: string;
|
|
470
|
+
/** Workspace root directory. Used on resume to reconstruct artifactDir. */
|
|
471
|
+
readonly workspacePath?: string;
|
|
472
|
+
/**
|
|
473
|
+
* Per-run staged copy of the workflow package's `skills/` tree (when
|
|
474
|
+
* the package shipped one). The orchestrator copies this at start
|
|
475
|
+
* under `<baseDir>/<workflowId>/workflow-skills/` so the run is
|
|
476
|
+
* self-contained: resume reads from the staged copy regardless of
|
|
477
|
+
* whether the original package path is still on disk. Absent when
|
|
478
|
+
* the workflow ships no skills, and absent on legacy checkpoints
|
|
479
|
+
* written before this field existed (resume falls back to re-staging
|
|
480
|
+
* from `definitionPath`'s package dir).
|
|
481
|
+
*/
|
|
482
|
+
readonly workflowSkillsDir?: string;
|
|
483
|
+
/**
|
|
484
|
+
* Terminal-phase status, populated only when the workflow has reached a terminal
|
|
485
|
+
* phase (completed / aborted / failed / waiting_human). Absent for mid-run
|
|
486
|
+
* checkpoints and for legacy retained checkpoints written before this field existed.
|
|
487
|
+
*/
|
|
488
|
+
readonly finalStatus?: WorkflowStatus;
|
|
489
|
+
}
|
|
490
|
+
export interface TransitionRecord {
|
|
491
|
+
readonly from: string;
|
|
492
|
+
readonly to: string;
|
|
493
|
+
readonly event: string;
|
|
494
|
+
readonly timestamp: string;
|
|
495
|
+
readonly duration_ms: number;
|
|
496
|
+
/** Summary of the agent's output that produced this transition (if any). */
|
|
497
|
+
readonly agentMessage?: string;
|
|
498
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
// ---------------------------------------------------------------------------
|
|
3
|
+
// Constants
|
|
4
|
+
// ---------------------------------------------------------------------------
|
|
5
|
+
/**
|
|
6
|
+
* Directory name for workflow artifacts inside the agent workspace.
|
|
7
|
+
* All artifact subdirectories (plan/, code/, reviews/, etc.) live under this.
|
|
8
|
+
*/
|
|
9
|
+
export const WORKFLOW_ARTIFACT_DIR = '.workflow';
|
|
10
|
+
/**
|
|
11
|
+
* Reserved persona alias meaning "use the global policy".
|
|
12
|
+
* When a workflow state specifies this as its persona, the session
|
|
13
|
+
* factory strips the persona field (same as undefined), so the
|
|
14
|
+
* session uses the default global compiled policy and memory.
|
|
15
|
+
*
|
|
16
|
+
* Any other persona value is passed through to `createSession()`,
|
|
17
|
+
* which resolves it to a per-persona policy, memory, and prompt.
|
|
18
|
+
*/
|
|
19
|
+
export const GLOBAL_PERSONA = 'global';
|
|
20
|
+
/**
|
|
21
|
+
* Sentinel value for an agent state's `skills:` field meaning "no skills
|
|
22
|
+
* of any kind". Strictly stronger than `[]` (which still loads
|
|
23
|
+
* user-global + persona skills); this disables every layer.
|
|
24
|
+
*/
|
|
25
|
+
export const SKILLS_NONE = 'none';
|
|
26
|
+
/**
|
|
27
|
+
* Translate an agent state's `skills:` field into the subset of
|
|
28
|
+
* `WorkflowBorrowOptions` that controls skill resolution. `disableAllSkills`
|
|
29
|
+
* is mutually exclusive with `skillsDir` / `skillFilter`: when the sentinel
|
|
30
|
+
* is present, only `disableAllSkills: true` is set; otherwise `skillsDir`
|
|
31
|
+
* and `skillFilter` may co-occur. Used by both the orchestrator and the
|
|
32
|
+
* run-state CLI so the invariant lives in one place.
|
|
33
|
+
*/
|
|
34
|
+
export function resolveWorkflowSkillsOptions(skills, skillsDir) {
|
|
35
|
+
if (skills === SKILLS_NONE)
|
|
36
|
+
return { disableAllSkills: true };
|
|
37
|
+
const result = {};
|
|
38
|
+
if (skillsDir !== undefined)
|
|
39
|
+
result.skillsDir = skillsDir;
|
|
40
|
+
if (Array.isArray(skills))
|
|
41
|
+
result.skillFilter = new Set(skills);
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Default `containerScope` value assigned to agent states that do not
|
|
46
|
+
* declare one explicitly. Every such state shares the workflow's primary
|
|
47
|
+
* bundle. The orchestrator's scope-lookup path resolves
|
|
48
|
+
* `stateConfig.containerScope ?? DEFAULT_CONTAINER_SCOPE` before dispatch.
|
|
49
|
+
*
|
|
50
|
+
* Scope strings are opaque Map lookup keys — they are never embedded in
|
|
51
|
+
* filesystem paths (bundle directory names use the UUID `bundleId`).
|
|
52
|
+
*
|
|
53
|
+
* See `docs/designs/workflow-session-identity.md` §2.4 / §6.
|
|
54
|
+
*/
|
|
55
|
+
export const DEFAULT_CONTAINER_SCOPE = 'primary';
|
|
56
|
+
/** Creates a new unique WorkflowId. */
|
|
57
|
+
export function createWorkflowId() {
|
|
58
|
+
return randomUUID();
|
|
59
|
+
}
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// Agent output
|
|
62
|
+
// ---------------------------------------------------------------------------
|
|
63
|
+
export const CONFIDENCE_VALUES = ['high', 'medium', 'low'];
|
|
64
|
+
/** Valid keys for `when` clauses. Must match AgentOutput field names. */
|
|
65
|
+
export const AGENT_OUTPUT_FIELDS = [
|
|
66
|
+
'completed',
|
|
67
|
+
'verdict',
|
|
68
|
+
'confidence',
|
|
69
|
+
'escalation',
|
|
70
|
+
'testCount',
|
|
71
|
+
'notes',
|
|
72
|
+
];
|
|
73
|
+
export function toHumanGateRequestDto(gate) {
|
|
74
|
+
return {
|
|
75
|
+
gateId: gate.gateId,
|
|
76
|
+
workflowId: gate.workflowId,
|
|
77
|
+
stateName: gate.stateName,
|
|
78
|
+
acceptedEvents: gate.acceptedEvents,
|
|
79
|
+
presentedArtifacts: Array.from(gate.presentedArtifacts.keys()),
|
|
80
|
+
summary: gate.summary,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/workflow/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,8EAA8E;AAC9E,YAAY;AACZ,8EAA8E;AAE9E;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,WAAW,CAAC;AAEjD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEvC;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAC1C,MAA0D,EAC1D,SAA6B;IAM7B,IAAI,MAAM,KAAK,WAAW;QAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAAC;IAC9D,MAAM,MAAM,GAA8D,EAAE,CAAC;IAC7E,IAAI,SAAS,KAAK,SAAS;QAAE,MAAM,CAAC,SAAS,GAAG,SAAS,CAAC;IAC1D,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAAE,MAAM,CAAC,WAAW,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC;IAChE,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,SAAS,CAAC;AAYjD,uCAAuC;AACvC,MAAM,UAAU,gBAAgB;IAC9B,OAAO,UAAU,EAAgB,CAAC;AACpC,CAAC;AAoQD,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAU,CAAC;AAgCpE,yEAAyE;AACzE,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,WAAW;IACX,SAAS;IACT,YAAY;IACZ,YAAY;IACZ,WAAW;IACX,OAAO;CAC0C,CAAC;AA+HpD,MAAM,UAAU,qBAAqB,CAAC,IAAsB;IAC1D,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,UAAU,EAAE,IAAI,CAAC,UAAU;QAC3B,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,cAAc,EAAE,IAAI,CAAC,cAAc;QACnC,kBAAkB,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;QAC9D,OAAO,EAAE,IAAI,CAAC,OAAO;KACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { WorkflowDefinition, WorkflowStateDefinition } from './types.js';
|
|
2
|
+
export declare class WorkflowValidationError extends Error {
|
|
3
|
+
readonly issues: readonly string[];
|
|
4
|
+
constructor(issues: readonly string[]);
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Parses a workflow input artifact reference. A trailing `?` marks the
|
|
8
|
+
* input as optional — the consumer may skip it if the artifact isn't
|
|
9
|
+
* produced.
|
|
10
|
+
*/
|
|
11
|
+
export declare function parseArtifactRef(ref: string): {
|
|
12
|
+
readonly name: string;
|
|
13
|
+
readonly isOptional: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function collectOutputArtifacts(states: Record<string, WorkflowStateDefinition>): Set<string>;
|
|
16
|
+
export declare function findReachableStates(initial: string, states: Record<string, WorkflowStateDefinition>): Set<string>;
|
|
17
|
+
/**
|
|
18
|
+
* One issue produced by {@link iterateSkillRefIssues}. Surface code
|
|
19
|
+
* (validate vs lint) formats the user-facing wording.
|
|
20
|
+
*/
|
|
21
|
+
export type SkillRefIssue = {
|
|
22
|
+
kind: 'invalid-name';
|
|
23
|
+
stateId: string;
|
|
24
|
+
name: string;
|
|
25
|
+
detail: string;
|
|
26
|
+
} | {
|
|
27
|
+
kind: 'unknown-name';
|
|
28
|
+
stateId: string;
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Walks every agent state's `skills[]` and yields a structured issue
|
|
33
|
+
* per offending entry, classifying shape failures (`invalid-name`)
|
|
34
|
+
* separately from membership failures (`unknown-name`). Shape-first:
|
|
35
|
+
* an entry that fails the shape check is yielded as such and not
|
|
36
|
+
* checked for membership, which would otherwise emit a confusing
|
|
37
|
+
* "skill not found" message for inputs that were never valid names.
|
|
38
|
+
*/
|
|
39
|
+
export declare function iterateSkillRefIssues(definition: WorkflowDefinition, discoveredNames: ReadonlySet<string>): Generator<SkillRefIssue>;
|
|
40
|
+
/**
|
|
41
|
+
* Verifies every `skills[]` entry on an agent state matches a SKILL.md
|
|
42
|
+
* frontmatter `name:` under `<packageDir>/skills/`. Membership is
|
|
43
|
+
* keyed on the frontmatter name (also what `workflowSkillFilter` in
|
|
44
|
+
* `src/skills/discovery.ts` matches), not the directory name —
|
|
45
|
+
* `existsSync` on the dir would miss dir-vs-frontmatter mismatches.
|
|
46
|
+
* Called from orchestrator `start()` only.
|
|
47
|
+
*
|
|
48
|
+
* @throws {WorkflowValidationError} when any entry is invalid or unknown
|
|
49
|
+
*/
|
|
50
|
+
export declare function validateWorkflowSkillReferences(definition: WorkflowDefinition, packageDir: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Validates a parsed object as a WorkflowDefinition.
|
|
53
|
+
* Performs structural parsing (Zod) then semantic checks.
|
|
54
|
+
* The input can come from JSON.parse() or YAML.parse().
|
|
55
|
+
*
|
|
56
|
+
* @throws {WorkflowValidationError} with structured list of issues
|
|
57
|
+
*/
|
|
58
|
+
export declare function validateDefinition(raw: unknown): WorkflowDefinition;
|