@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,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow definition discovery.
|
|
3
|
+
*
|
|
4
|
+
* Workflows are packaged as directories: each workflow lives under its
|
|
5
|
+
* own directory containing a `workflow.yaml` (or `workflow.yml`)
|
|
6
|
+
* manifest plus optional sibling resources like a `skills/` subdir.
|
|
7
|
+
*
|
|
8
|
+
* src/workflow/workflows/<name>/workflow.yaml (bundled)
|
|
9
|
+
* ~/.ironcurtain/workflows/<name>/workflow.yaml (user)
|
|
10
|
+
*
|
|
11
|
+
* The directory shape is what allows skills (and other future co-packaged
|
|
12
|
+
* resources) to travel with the workflow definition. Single-file and
|
|
13
|
+
* JSON manifest forms are not accepted as inputs; JSON remains an
|
|
14
|
+
* internal serialization format used by workflow-resume checkpointing.
|
|
15
|
+
*/
|
|
16
|
+
export type WorkflowSource = 'bundled' | 'user' | 'custom';
|
|
17
|
+
export interface WorkflowEntry {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
readonly description: string;
|
|
20
|
+
readonly path: string;
|
|
21
|
+
readonly source: WorkflowSource;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Parses a workflow definition file. Dispatches on extension:
|
|
25
|
+
* - `.yaml` / `.yml` -> YAML parse with alias expansion disabled
|
|
26
|
+
* (prevents YAML-bomb DoS via reference amplification)
|
|
27
|
+
* - `.json` -> JSON parse
|
|
28
|
+
*
|
|
29
|
+
* Returns the parsed value unvalidated — the workflow definition Zod
|
|
30
|
+
* schema enforces structure downstream.
|
|
31
|
+
*
|
|
32
|
+
* Note on the JSON branch: user-facing manifests must be YAML; the
|
|
33
|
+
* discovery layer (`discoverWorkflows`, `resolveWorkflowPath`) only
|
|
34
|
+
* looks for `workflow.{yaml,yml}` and rejects JSON path-style refs.
|
|
35
|
+
* The JSON branch survives only for internal serialization — the
|
|
36
|
+
* resume path reads `<runDir>/definition.json` written at workflow
|
|
37
|
+
* start, which is JSON for compactness and because it round-trips a
|
|
38
|
+
* validated `WorkflowDefinition` rather than user-authored markup.
|
|
39
|
+
*
|
|
40
|
+
* @throws if the file cannot be read or parsed
|
|
41
|
+
*/
|
|
42
|
+
export declare function parseDefinitionFile(filePath: string): unknown;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the path to the bundled workflows directory.
|
|
45
|
+
* Works in both dev (src/workflow/workflows/) and production (dist/workflow/workflows/).
|
|
46
|
+
*/
|
|
47
|
+
export declare function getBundledWorkflowsDir(): string;
|
|
48
|
+
/**
|
|
49
|
+
* Returns the directory containing a workflow's package, given the
|
|
50
|
+
* absolute path to its manifest. Co-packaged resources (currently the
|
|
51
|
+
* optional `skills/` subdir) live here.
|
|
52
|
+
*/
|
|
53
|
+
export declare function getWorkflowPackageDir(workflowFilePath: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Discovers all available workflow definitions from bundled and user
|
|
56
|
+
* directories. User workflows override bundled ones on name collision.
|
|
57
|
+
* Returned entries are sorted alphabetically by name.
|
|
58
|
+
*/
|
|
59
|
+
export declare function discoverWorkflows(): WorkflowEntry[];
|
|
60
|
+
/**
|
|
61
|
+
* Resolves a workflow reference to an absolute manifest path. User-facing
|
|
62
|
+
* refs are YAML-only — JSON path-style refs are silently dropped because
|
|
63
|
+
* `definition.json` is an internal serialization format produced by
|
|
64
|
+
* workflow-resume checkpointing, not a manifest authors should reference.
|
|
65
|
+
*
|
|
66
|
+
* Resolution matrix:
|
|
67
|
+
* - bare name (`my-flow`) → probe user dir then bundled dir for
|
|
68
|
+
* `<root>/<ref>/workflow.{yaml,yml}`
|
|
69
|
+
* - path with no extension → treat as a package directory, probe
|
|
70
|
+
* (`./my-flow`, `/abs/foo`) `<ref>/workflow.{yaml,yml}`
|
|
71
|
+
* - explicit `.yaml` / `.yml` → return as-is when the file exists
|
|
72
|
+
* - any other extension → undefined (JSON refs included; the
|
|
73
|
+
* resume path reads `definition.json`
|
|
74
|
+
* directly, not via this resolver)
|
|
75
|
+
*
|
|
76
|
+
* Returns `undefined` when the reference cannot be resolved.
|
|
77
|
+
*/
|
|
78
|
+
export declare function resolveWorkflowPath(ref: string): string | undefined;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Workflow definition discovery.
|
|
3
|
+
*
|
|
4
|
+
* Workflows are packaged as directories: each workflow lives under its
|
|
5
|
+
* own directory containing a `workflow.yaml` (or `workflow.yml`)
|
|
6
|
+
* manifest plus optional sibling resources like a `skills/` subdir.
|
|
7
|
+
*
|
|
8
|
+
* src/workflow/workflows/<name>/workflow.yaml (bundled)
|
|
9
|
+
* ~/.ironcurtain/workflows/<name>/workflow.yaml (user)
|
|
10
|
+
*
|
|
11
|
+
* The directory shape is what allows skills (and other future co-packaged
|
|
12
|
+
* resources) to travel with the workflow definition. Single-file and
|
|
13
|
+
* JSON manifest forms are not accepted as inputs; JSON remains an
|
|
14
|
+
* internal serialization format used by workflow-resume checkpointing.
|
|
15
|
+
*/
|
|
16
|
+
import { existsSync, readdirSync, readFileSync, statSync } from 'node:fs';
|
|
17
|
+
import { dirname, resolve, extname } from 'node:path';
|
|
18
|
+
import { fileURLToPath } from 'node:url';
|
|
19
|
+
import YAML from 'yaml';
|
|
20
|
+
import { getUserWorkflowsDir } from '../config/paths.js';
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// File format support
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
/** Manifest filenames probed inside a workflow package directory. */
|
|
25
|
+
const MANIFEST_BASENAMES = ['workflow.yaml', 'workflow.yml'];
|
|
26
|
+
/** Recognized YAML extensions for ad-hoc file-path workflow refs. */
|
|
27
|
+
const YAML_EXTENSIONS = new Set(['.yaml', '.yml']);
|
|
28
|
+
/**
|
|
29
|
+
* Parses a workflow definition file. Dispatches on extension:
|
|
30
|
+
* - `.yaml` / `.yml` -> YAML parse with alias expansion disabled
|
|
31
|
+
* (prevents YAML-bomb DoS via reference amplification)
|
|
32
|
+
* - `.json` -> JSON parse
|
|
33
|
+
*
|
|
34
|
+
* Returns the parsed value unvalidated — the workflow definition Zod
|
|
35
|
+
* schema enforces structure downstream.
|
|
36
|
+
*
|
|
37
|
+
* Note on the JSON branch: user-facing manifests must be YAML; the
|
|
38
|
+
* discovery layer (`discoverWorkflows`, `resolveWorkflowPath`) only
|
|
39
|
+
* looks for `workflow.{yaml,yml}` and rejects JSON path-style refs.
|
|
40
|
+
* The JSON branch survives only for internal serialization — the
|
|
41
|
+
* resume path reads `<runDir>/definition.json` written at workflow
|
|
42
|
+
* start, which is JSON for compactness and because it round-trips a
|
|
43
|
+
* validated `WorkflowDefinition` rather than user-authored markup.
|
|
44
|
+
*
|
|
45
|
+
* @throws if the file cannot be read or parsed
|
|
46
|
+
*/
|
|
47
|
+
export function parseDefinitionFile(filePath) {
|
|
48
|
+
const ext = extname(filePath).toLowerCase();
|
|
49
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
50
|
+
if (ext === '.yaml' || ext === '.yml') {
|
|
51
|
+
return YAML.parse(content, { maxAliasCount: 0 });
|
|
52
|
+
}
|
|
53
|
+
if (ext === '.json') {
|
|
54
|
+
return JSON.parse(content);
|
|
55
|
+
}
|
|
56
|
+
throw new Error(`Unsupported workflow file extension: ${ext}`);
|
|
57
|
+
}
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
// Directory helpers
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
62
|
+
/**
|
|
63
|
+
* Returns the path to the bundled workflows directory.
|
|
64
|
+
* Works in both dev (src/workflow/workflows/) and production (dist/workflow/workflows/).
|
|
65
|
+
*/
|
|
66
|
+
export function getBundledWorkflowsDir() {
|
|
67
|
+
return resolve(__dirname, 'workflows');
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Returns the directory containing a workflow's package, given the
|
|
71
|
+
* absolute path to its manifest. Co-packaged resources (currently the
|
|
72
|
+
* optional `skills/` subdir) live here.
|
|
73
|
+
*/
|
|
74
|
+
export function getWorkflowPackageDir(workflowFilePath) {
|
|
75
|
+
return dirname(workflowFilePath);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Locates the manifest file inside a workflow package directory.
|
|
79
|
+
* Returns the absolute path to `workflow.yaml` or `workflow.yml` if
|
|
80
|
+
* present (yaml takes precedence on collision), `undefined` otherwise.
|
|
81
|
+
*/
|
|
82
|
+
function findManifest(packageDir) {
|
|
83
|
+
for (const basename of MANIFEST_BASENAMES) {
|
|
84
|
+
const candidate = resolve(packageDir, basename);
|
|
85
|
+
if (existsSync(candidate))
|
|
86
|
+
return candidate;
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
// ---------------------------------------------------------------------------
|
|
91
|
+
// Discovery
|
|
92
|
+
// ---------------------------------------------------------------------------
|
|
93
|
+
/**
|
|
94
|
+
* Scans a workflows root for package directories and returns one entry
|
|
95
|
+
* per directory that contains a valid manifest. Subdirectories without
|
|
96
|
+
* a `workflow.yaml`/`workflow.yml`, or whose manifest fails to parse,
|
|
97
|
+
* are skipped silently — the same forgiving posture other discovery
|
|
98
|
+
* paths in this project take (e.g., `discoverSkills`).
|
|
99
|
+
*
|
|
100
|
+
* The entry's `name` is the package directory's name, NOT the
|
|
101
|
+
* manifest's `name:` field. This matches `resolveWorkflowPath`, which
|
|
102
|
+
* looks up workflows by directory name.
|
|
103
|
+
*/
|
|
104
|
+
function scanDirectory(dir, source) {
|
|
105
|
+
if (!existsSync(dir))
|
|
106
|
+
return [];
|
|
107
|
+
let entries;
|
|
108
|
+
try {
|
|
109
|
+
entries = readdirSync(dir);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return [];
|
|
113
|
+
}
|
|
114
|
+
const out = [];
|
|
115
|
+
for (const name of entries) {
|
|
116
|
+
const packageDir = resolve(dir, name);
|
|
117
|
+
let stats;
|
|
118
|
+
try {
|
|
119
|
+
stats = statSync(packageDir);
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
continue;
|
|
123
|
+
}
|
|
124
|
+
if (!stats.isDirectory())
|
|
125
|
+
continue;
|
|
126
|
+
const manifest = findManifest(packageDir);
|
|
127
|
+
if (!manifest)
|
|
128
|
+
continue;
|
|
129
|
+
let description = '';
|
|
130
|
+
try {
|
|
131
|
+
const raw = parseDefinitionFile(manifest);
|
|
132
|
+
if (typeof raw.description === 'string')
|
|
133
|
+
description = raw.description;
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
// Skip packages with unparseable manifests
|
|
137
|
+
continue;
|
|
138
|
+
}
|
|
139
|
+
out.push({ name, description, path: manifest, source });
|
|
140
|
+
}
|
|
141
|
+
return out;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Discovers all available workflow definitions from bundled and user
|
|
145
|
+
* directories. User workflows override bundled ones on name collision.
|
|
146
|
+
* Returned entries are sorted alphabetically by name.
|
|
147
|
+
*/
|
|
148
|
+
export function discoverWorkflows() {
|
|
149
|
+
const bundled = scanDirectory(getBundledWorkflowsDir(), 'bundled');
|
|
150
|
+
const user = scanDirectory(getUserWorkflowsDir(), 'user');
|
|
151
|
+
// User entries override bundled on name collision
|
|
152
|
+
const byName = new Map();
|
|
153
|
+
for (const entry of bundled) {
|
|
154
|
+
byName.set(entry.name, entry);
|
|
155
|
+
}
|
|
156
|
+
for (const entry of user) {
|
|
157
|
+
byName.set(entry.name, entry);
|
|
158
|
+
}
|
|
159
|
+
return [...byName.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Resolves a workflow reference to an absolute manifest path. User-facing
|
|
163
|
+
* refs are YAML-only — JSON path-style refs are silently dropped because
|
|
164
|
+
* `definition.json` is an internal serialization format produced by
|
|
165
|
+
* workflow-resume checkpointing, not a manifest authors should reference.
|
|
166
|
+
*
|
|
167
|
+
* Resolution matrix:
|
|
168
|
+
* - bare name (`my-flow`) → probe user dir then bundled dir for
|
|
169
|
+
* `<root>/<ref>/workflow.{yaml,yml}`
|
|
170
|
+
* - path with no extension → treat as a package directory, probe
|
|
171
|
+
* (`./my-flow`, `/abs/foo`) `<ref>/workflow.{yaml,yml}`
|
|
172
|
+
* - explicit `.yaml` / `.yml` → return as-is when the file exists
|
|
173
|
+
* - any other extension → undefined (JSON refs included; the
|
|
174
|
+
* resume path reads `definition.json`
|
|
175
|
+
* directly, not via this resolver)
|
|
176
|
+
*
|
|
177
|
+
* Returns `undefined` when the reference cannot be resolved.
|
|
178
|
+
*/
|
|
179
|
+
export function resolveWorkflowPath(ref) {
|
|
180
|
+
const ext = extname(ref).toLowerCase();
|
|
181
|
+
const isPathStyle = ref.includes('/') || ref.includes('\\');
|
|
182
|
+
if (YAML_EXTENSIONS.has(ext)) {
|
|
183
|
+
const resolved = resolve(ref);
|
|
184
|
+
return existsSync(resolved) ? resolved : undefined;
|
|
185
|
+
}
|
|
186
|
+
if (isPathStyle) {
|
|
187
|
+
// No extension → package directory. A non-yaml extension (e.g.
|
|
188
|
+
// `.json`) on a path-style ref falls through to undefined: not a
|
|
189
|
+
// user-facing form.
|
|
190
|
+
if (ext === '') {
|
|
191
|
+
return findManifest(resolve(ref));
|
|
192
|
+
}
|
|
193
|
+
return undefined;
|
|
194
|
+
}
|
|
195
|
+
const userManifest = findManifest(resolve(getUserWorkflowsDir(), ref));
|
|
196
|
+
if (userManifest)
|
|
197
|
+
return userManifest;
|
|
198
|
+
const bundledManifest = findManifest(resolve(getBundledWorkflowsDir(), ref));
|
|
199
|
+
if (bundledManifest)
|
|
200
|
+
return bundledManifest;
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.js","sourceRoot":"","sources":["../../src/workflow/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAezD,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,qEAAqE;AACrE,MAAM,kBAAkB,GAAG,CAAC,eAAe,EAAE,cAAc,CAAU,CAAC;AAEtE,qEAAqE;AACrE,MAAM,eAAe,G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A+D;QAC/D,iEAAiE;QACjE,oBAAoB;QACpB,IAAI,GAAG,KAAK,EAAE,EAAE,CAAC;YACf,OAAO,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,YAAY,GAAG,YAAY,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;IACvE,IAAI,YAAY;QAAE,OAAO,YAAY,CAAC;IAEtC,MAAM,eAAe,GAAG,YAAY,CAAC,OAAO,CAAC,sBAAsB,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;IAC7E,IAAI,eAAe;QAAE,OAAO,eAAe,CAAC;IAE5C,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { AgentConversationId } from '../session/types.js';
|
|
2
|
+
import { type TransientFailureKind } from '../docker/agent-adapter.js';
|
|
3
|
+
/**
|
|
4
|
+
* Wraps an error thrown from within `executeAgentState()` so the XState
|
|
5
|
+
* error handler can recover the `agentConversationId` that was minted for
|
|
6
|
+
* the failing invocation and persist it into `context.agentConversationsByState`.
|
|
7
|
+
*
|
|
8
|
+
* Without this, states that error mid-invocation drop their conversation
|
|
9
|
+
* id on the floor — the `onDone` path stamps the id into context, but
|
|
10
|
+
* `onError` used to record only `lastError`. For states configured with
|
|
11
|
+
* `freshSession: false`, that silently broke resume on the next visit.
|
|
12
|
+
*/
|
|
13
|
+
export interface AgentInvocationErrorOptions {
|
|
14
|
+
readonly stateId: string;
|
|
15
|
+
readonly agentConversationId: AgentConversationId;
|
|
16
|
+
readonly cause: unknown;
|
|
17
|
+
}
|
|
18
|
+
export declare class AgentInvocationError extends Error {
|
|
19
|
+
readonly stateId: string;
|
|
20
|
+
readonly agentConversationId: AgentConversationId;
|
|
21
|
+
readonly cause: unknown;
|
|
22
|
+
constructor(options: AgentInvocationErrorOptions);
|
|
23
|
+
}
|
|
24
|
+
export declare function isAgentInvocationError(err: unknown): err is AgentInvocationError;
|
|
25
|
+
/**
|
|
26
|
+
* Thrown when the agent adapter reports upstream quota exhaustion for a
|
|
27
|
+
* state's turn. Distinct from a generic `Error` so M4's paused-phase
|
|
28
|
+
* handling (follow-up work) can intercept it cleanly and drive a
|
|
29
|
+
* `paused` terminal instead of the current `aborted` terminal.
|
|
30
|
+
*
|
|
31
|
+
* `resetAt` is the provider-advertised reset time when the adapter
|
|
32
|
+
* could parse one; `rawMessage` is the original provider/CLI text.
|
|
33
|
+
*/
|
|
34
|
+
export interface WorkflowQuotaExhaustedOptions {
|
|
35
|
+
readonly stateId: string;
|
|
36
|
+
readonly resetAt?: Date;
|
|
37
|
+
readonly rawMessage: string;
|
|
38
|
+
}
|
|
39
|
+
export declare class WorkflowQuotaExhaustedError extends Error {
|
|
40
|
+
readonly stateId: string;
|
|
41
|
+
readonly resetAt?: Date;
|
|
42
|
+
readonly rawMessage: string;
|
|
43
|
+
constructor(options: WorkflowQuotaExhaustedOptions);
|
|
44
|
+
}
|
|
45
|
+
export declare function isWorkflowQuotaExhaustedError(err: unknown): err is WorkflowQuotaExhaustedError;
|
|
46
|
+
/**
|
|
47
|
+
* Thrown when the agent adapter reports a transient upstream failure
|
|
48
|
+
* (see `AgentResponse.transientFailure`). Sibling of
|
|
49
|
+
* `WorkflowQuotaExhaustedError`: both signal terminal-but-resumable
|
|
50
|
+
* conditions. Consumers MUST NOT remove the on-disk checkpoint; the
|
|
51
|
+
* orchestrator forces `phase: 'aborted'` so `isCheckpointResumable`
|
|
52
|
+
* returns true regardless of which terminal `findErrorTarget` resolved
|
|
53
|
+
* to.
|
|
54
|
+
*/
|
|
55
|
+
export interface WorkflowTransientFailureOptions {
|
|
56
|
+
readonly stateId: string;
|
|
57
|
+
readonly kind: TransientFailureKind;
|
|
58
|
+
readonly rawMessage: string;
|
|
59
|
+
}
|
|
60
|
+
export declare class WorkflowTransientFailureError extends Error {
|
|
61
|
+
readonly stateId: string;
|
|
62
|
+
readonly kind: TransientFailureKind;
|
|
63
|
+
readonly rawMessage: string;
|
|
64
|
+
constructor(options: WorkflowTransientFailureOptions);
|
|
65
|
+
}
|
|
66
|
+
export declare function isWorkflowTransientFailureError(err: unknown): err is WorkflowTransientFailureError;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { describeTransientFailureKind } from '../docker/agent-adapter.js';
|
|
2
|
+
export class AgentInvocationError extends Error {
|
|
3
|
+
stateId;
|
|
4
|
+
agentConversationId;
|
|
5
|
+
cause;
|
|
6
|
+
constructor(options) {
|
|
7
|
+
const message = options.cause instanceof Error ? options.cause.message : String(options.cause);
|
|
8
|
+
super(message);
|
|
9
|
+
this.name = 'AgentInvocationError';
|
|
10
|
+
this.stateId = options.stateId;
|
|
11
|
+
this.agentConversationId = options.agentConversationId;
|
|
12
|
+
this.cause = options.cause;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export function isAgentInvocationError(err) {
|
|
16
|
+
return err instanceof AgentInvocationError;
|
|
17
|
+
}
|
|
18
|
+
export class WorkflowQuotaExhaustedError extends Error {
|
|
19
|
+
stateId;
|
|
20
|
+
resetAt;
|
|
21
|
+
rawMessage;
|
|
22
|
+
constructor(options) {
|
|
23
|
+
const resetHint = options.resetAt ? ` (resets at ${options.resetAt.toISOString()})` : '';
|
|
24
|
+
super(`Agent turn aborted: upstream quota exhausted${resetHint}`);
|
|
25
|
+
this.name = 'WorkflowQuotaExhaustedError';
|
|
26
|
+
this.stateId = options.stateId;
|
|
27
|
+
this.resetAt = options.resetAt;
|
|
28
|
+
this.rawMessage = options.rawMessage;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function isWorkflowQuotaExhaustedError(err) {
|
|
32
|
+
return err instanceof WorkflowQuotaExhaustedError;
|
|
33
|
+
}
|
|
34
|
+
export class WorkflowTransientFailureError extends Error {
|
|
35
|
+
stateId;
|
|
36
|
+
kind;
|
|
37
|
+
rawMessage;
|
|
38
|
+
constructor(options) {
|
|
39
|
+
super(`Agent turn aborted: transient upstream failure — ${describeTransientFailureKind(options.kind)}`);
|
|
40
|
+
this.name = 'WorkflowTransientFailureError';
|
|
41
|
+
this.stateId = options.stateId;
|
|
42
|
+
this.kind = options.kind;
|
|
43
|
+
this.rawMessage = options.rawMessage;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function isWorkflowTransientFailureError(err) {
|
|
47
|
+
return err instanceof WorkflowTransientFailureError;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/workflow/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAA6B,MAAM,4BAA4B,CAAC;AAkBrG,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,OAAO,CAAS;IAChB,mBAAmB,CAAsB;IAChC,KAAK,CAAU;IAEjC,YAAY,OAAoC;QAC9C,MAAM,OAAO,GAAG,OAAO,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC/F,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;QACvD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,UAAU,sBAAsB,CAAC,GAAY;IACjD,OAAO,GAAG,YAAY,oBAAoB,CAAC;AAC7C,CAAC;AAiBD,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IAC3C,OAAO,CAAS;IAChB,OAAO,CAAQ;IACf,UAAU,CAAS;IAE5B,YAAY,OAAsC;QAChD,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QACzF,KAAK,CAAC,+CAA+C,SAAS,EAAE,CAAC,CAAC;QAClE,IAAI,CAAC,IAAI,GAAG,6BAA6B,CAAC;QAC1C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACvC,CAAC;CACF;AAED,MAAM,UAAU,6BAA6B,CAAC,GAAY;IACxD,OAAO,GAAG,YAAY,2BAA2B,CAAC;AACpD,CAAC;AAiBD,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAC7C,OAAO,CAAS;IAChB,IAAI,CAAuB;IAC3B,UAAU,CAAS;IAE5B,YAAY,OAAwC;QAClD,KAAK,CAAC,oDAAoD,4BAA4B,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxG,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACvC,CAAC;CACF;AAED,MAAM,UAAU,+BAA+B,CAAC,GAAY;IAC1D,OAAO,GAAG,YAAY,6BAA6B,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WorkflowContext, WorkflowEvent } from './types.js';
|
|
2
|
+
export type GuardFunction = (params: {
|
|
3
|
+
readonly context: WorkflowContext;
|
|
4
|
+
readonly event: WorkflowEvent;
|
|
5
|
+
}) => boolean;
|
|
6
|
+
export declare const guardImplementations: Readonly<Record<string, GuardFunction>>;
|
|
7
|
+
/** Set of all registered guard names. Used by validation to check definitions. */
|
|
8
|
+
export declare const REGISTERED_GUARDS: ReadonlySet<string>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Guard implementations
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
/**
|
|
5
|
+
* Per-state round limit check. Compares the maximum visit count
|
|
6
|
+
* across all states against maxRounds. This fires when any state
|
|
7
|
+
* has been visited enough times to hit the limit.
|
|
8
|
+
*
|
|
9
|
+
* In the typical coder-critic loop, this checks whether the loop
|
|
10
|
+
* has iterated enough times to warrant escalation.
|
|
11
|
+
*/
|
|
12
|
+
const isRoundLimitReached = ({ context }) => {
|
|
13
|
+
const counts = Object.values(context.visitCounts);
|
|
14
|
+
if (counts.length === 0)
|
|
15
|
+
return false;
|
|
16
|
+
const maxVisits = Math.max(...counts);
|
|
17
|
+
return maxVisits >= context.maxRounds;
|
|
18
|
+
};
|
|
19
|
+
// Stubs for guards whose real logic lives in machine-builder.ts (they need
|
|
20
|
+
// closure over per-state config or invoke-result data). These exist so the
|
|
21
|
+
// names pass REGISTERED_GUARDS validation.
|
|
22
|
+
const isStalled = () => false;
|
|
23
|
+
const isStateVisitLimitReached = () => false;
|
|
24
|
+
const isPassed = ({ event }) => {
|
|
25
|
+
return event.type === 'VALIDATION_PASSED';
|
|
26
|
+
};
|
|
27
|
+
// ---------------------------------------------------------------------------
|
|
28
|
+
// Guard registry
|
|
29
|
+
// ---------------------------------------------------------------------------
|
|
30
|
+
export const guardImplementations = {
|
|
31
|
+
isRoundLimitReached,
|
|
32
|
+
isStalled,
|
|
33
|
+
isStateVisitLimitReached,
|
|
34
|
+
isPassed,
|
|
35
|
+
};
|
|
36
|
+
/** Set of all registered guard names. Used by validation to check definitions. */
|
|
37
|
+
export const REGISTERED_GUARDS = new Set(Object.keys(guardImplementations));
|
|
38
|
+
//# sourceMappingURL=guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/workflow/guards.ts"],"names":[],"mappings":"AAQA,8EAA8E;AAC9E,wBAAwB;AACxB,8EAA8E;AAE9E;;;;;;;GAOG;AACH,MAAM,mBAAmB,GAAkB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACzD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;IAClD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;IACtC,OAAO,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC;AACxC,CAAC,CAAC;AAEF,2EAA2E;AAC3E,2EAA2E;AAC3E,2CAA2C;AAC3C,MAAM,SAAS,GAAkB,GAAG,EAAE,CAAC,KAAK,CAAC;AAC7C,MAAM,wBAAwB,GAAkB,GAAG,EAAE,CAAC,KAAK,CAAC;AAE5D,MAAM,QAAQ,GAAkB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5C,OAAO,KAAK,CAAC,IAAI,KAAK,mBAAmB,CAAC;AAC5C,CAAC,CAAC;AAEF,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E,MAAM,CAAC,MAAM,oBAAoB,GAA4C;IAC3E,mBAAmB;IACnB,SAAS;IACT,wBAAwB;IACxB,QAAQ;CACT,CAAC;AAEF,kFAAkF;AAClF,MAAM,CAAC,MAAM,iBAAiB,GAAwB,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared pre-flight lint integration used by both the CLI and the daemon.
|
|
3
|
+
* UI-agnostic: returns a `PreflightResult` that callers format themselves
|
|
4
|
+
* (stderr for CLI, JSON-RPC error data for the daemon).
|
|
5
|
+
*/
|
|
6
|
+
import { type Diagnostic, type LintContext } from './lint.js';
|
|
7
|
+
import type { WorkflowDefinition } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Default `LintContext` shared by both the CLI and the daemon. Backed by the
|
|
10
|
+
* real filesystem-resolving `personaExists` from `src/persona/resolve.ts`.
|
|
11
|
+
*/
|
|
12
|
+
export declare const defaultLintContext: LintContext;
|
|
13
|
+
/**
|
|
14
|
+
* How strict the pre-flight should be:
|
|
15
|
+
* - `off` : skip linting entirely; always ok.
|
|
16
|
+
* - `warn` : fail only on error-severity diagnostics; warnings pass.
|
|
17
|
+
* - `strict`: fail on any diagnostic, including warnings.
|
|
18
|
+
*/
|
|
19
|
+
export type LintMode = 'off' | 'warn' | 'strict';
|
|
20
|
+
export interface PreflightResult {
|
|
21
|
+
readonly ok: boolean;
|
|
22
|
+
readonly diagnostics: readonly Diagnostic[];
|
|
23
|
+
}
|
|
24
|
+
export declare function preflightLint(definition: WorkflowDefinition, context: LintContext, mode: LintMode): PreflightResult;
|
|
25
|
+
/**
|
|
26
|
+
* Discriminated result for {@link runPreflight}. Three variants:
|
|
27
|
+
*
|
|
28
|
+
* - `{ ok: true, ... }`: the definition loaded and lint either had no
|
|
29
|
+
* diagnostics or had only diagnostics tolerated by `mode`. `warnings`
|
|
30
|
+
* counts the (passing) warnings present.
|
|
31
|
+
* - `{ ok: false, kind: 'load', ... }`: the definition file could not be
|
|
32
|
+
* parsed or did not validate. `loadKind` distinguishes the two.
|
|
33
|
+
* - `{ ok: false, kind: 'lint', ... }`: the definition loaded but lint
|
|
34
|
+
* produced diagnostics that fail `mode`. The definition is still returned
|
|
35
|
+
* so callers can render it alongside the diagnostics.
|
|
36
|
+
*/
|
|
37
|
+
export type RunPreflightResult = {
|
|
38
|
+
ok: true;
|
|
39
|
+
definition: WorkflowDefinition;
|
|
40
|
+
diagnostics: readonly Diagnostic[];
|
|
41
|
+
warnings: number;
|
|
42
|
+
} | {
|
|
43
|
+
ok: false;
|
|
44
|
+
kind: 'load';
|
|
45
|
+
loadKind: 'parse' | 'validate';
|
|
46
|
+
message: string;
|
|
47
|
+
} | {
|
|
48
|
+
ok: false;
|
|
49
|
+
kind: 'lint';
|
|
50
|
+
definition: WorkflowDefinition;
|
|
51
|
+
diagnostics: readonly Diagnostic[];
|
|
52
|
+
errors: number;
|
|
53
|
+
warnings: number;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Loads + validates a definition from `definitionPath`, then runs
|
|
57
|
+
* {@link preflightLint} with a {@link LintContext} derived from
|
|
58
|
+
* {@link defaultLintContext} but bound to `definitionPath` so
|
|
59
|
+
* package-relative checks (currently WF010 — skill references) can
|
|
60
|
+
* resolve sibling resources. Never throws — returns a discriminated
|
|
61
|
+
* result that callers map to their own error surfaces (stderr+exit
|
|
62
|
+
* for CLI, RpcError for the daemon).
|
|
63
|
+
*/
|
|
64
|
+
export declare function runPreflight(definitionPath: string, mode: LintMode): RunPreflightResult;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared pre-flight lint integration used by both the CLI and the daemon.
|
|
3
|
+
* UI-agnostic: returns a `PreflightResult` that callers format themselves
|
|
4
|
+
* (stderr for CLI, JSON-RPC error data for the daemon).
|
|
5
|
+
*/
|
|
6
|
+
import { countBySeverity, lintWorkflow } from './lint.js';
|
|
7
|
+
import { personaExists } from '../persona/resolve.js';
|
|
8
|
+
import { loadDefinition } from './definition-loader.js';
|
|
9
|
+
/**
|
|
10
|
+
* Default `LintContext` shared by both the CLI and the daemon. Backed by the
|
|
11
|
+
* real filesystem-resolving `personaExists` from `src/persona/resolve.ts`.
|
|
12
|
+
*/
|
|
13
|
+
export const defaultLintContext = { personaExists };
|
|
14
|
+
export function preflightLint(definition, context, mode) {
|
|
15
|
+
if (mode === 'off')
|
|
16
|
+
return { ok: true, diagnostics: [] };
|
|
17
|
+
const diagnostics = lintWorkflow(definition, context);
|
|
18
|
+
const { errors } = countBySeverity(diagnostics);
|
|
19
|
+
const failed = mode === 'strict' ? diagnostics.length > 0 : errors > 0;
|
|
20
|
+
return { ok: !failed, diagnostics };
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Loads + validates a definition from `definitionPath`, then runs
|
|
24
|
+
* {@link preflightLint} with a {@link LintContext} derived from
|
|
25
|
+
* {@link defaultLintContext} but bound to `definitionPath` so
|
|
26
|
+
* package-relative checks (currently WF010 — skill references) can
|
|
27
|
+
* resolve sibling resources. Never throws — returns a discriminated
|
|
28
|
+
* result that callers map to their own error surfaces (stderr+exit
|
|
29
|
+
* for CLI, RpcError for the daemon).
|
|
30
|
+
*/
|
|
31
|
+
export function runPreflight(definitionPath, mode) {
|
|
32
|
+
const loaded = loadDefinition(definitionPath);
|
|
33
|
+
if (!loaded.ok) {
|
|
34
|
+
return { ok: false, kind: 'load', loadKind: loaded.kind, message: loaded.message };
|
|
35
|
+
}
|
|
36
|
+
const ctx = { ...defaultLintContext, workflowFilePath: definitionPath };
|
|
37
|
+
const lintResult = preflightLint(loaded.definition, ctx, mode);
|
|
38
|
+
const { errors, warnings } = countBySeverity(lintResult.diagnostics);
|
|
39
|
+
if (lintResult.ok) {
|
|
40
|
+
return {
|
|
41
|
+
ok: true,
|
|
42
|
+
definition: loaded.definition,
|
|
43
|
+
diagnostics: lintResult.diagnostics,
|
|
44
|
+
warnings,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
ok: false,
|
|
49
|
+
kind: 'lint',
|
|
50
|
+
definition: loaded.definition,
|
|
51
|
+
diagnostics: lintResult.diagnostics,
|
|
52
|
+
errors,
|
|
53
|
+
warnings,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=lint-integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lint-integration.js","sourceRoot":"","sources":["../../src/work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G,aAAa,CAAC,MAAM,CAAC,UAAU,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IAC/D,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,eAAe,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAErE,IAAI,UAAU,CAAC,EAAE,EAAE,CAAC;QAClB,OAAO;YACL,EAAE,EAAE,IAAI;YACR,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,QAAQ;SACT,CAAC;IACJ,CAAC;IAED,OAAO;QACL,EAAE,EAAE,KAAK;QACT,IAAI,EAAE,MAAM;QACZ,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,WAAW,EAAE,UAAU,CAAC,WAAW;QACnC,MAAM;QACN,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { WorkflowDefinition } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Diagnostic codes.
|
|
4
|
+
*
|
|
5
|
+
* WF008 occupies the slot previously used for a raw-YAML check that
|
|
6
|
+
* `maxVisits` is only declared on agent states. That check now throws
|
|
7
|
+
* `WorkflowValidationError` before lint runs, so it never emits a WF code;
|
|
8
|
+
* the slot is reclaimed here for the visit-cap transition-ordering rule.
|
|
9
|
+
* WF009 is retired for the same reason (state-ID regex is a validation
|
|
10
|
+
* error) and must not be reused.
|
|
11
|
+
*
|
|
12
|
+
* WF005 (parallelKey + worktree needs gitRepoPath) is retired: the
|
|
13
|
+
* `parallelKey` schema field was removed as unused, so the trigger
|
|
14
|
+
* condition can no longer fire. Must not be reused.
|
|
15
|
+
*
|
|
16
|
+
* WF010 covers two related concerns under a single code:
|
|
17
|
+
* 1. State-scoped: an agent state's `skills:` entry is invalid or
|
|
18
|
+
* doesn't match any discoverable skill in the package.
|
|
19
|
+
* 2. Package-scoped: a `SKILL.md` under the workflow package's
|
|
20
|
+
* `skills/` tree is malformed, unreadable, or missing required
|
|
21
|
+
* frontmatter fields. These are surfaced even when no state
|
|
22
|
+
* references the broken skill, so authors get fast feedback on a
|
|
23
|
+
* typo in frontmatter rather than discovering it via a "skill not
|
|
24
|
+
* found" message at runtime.
|
|
25
|
+
*
|
|
26
|
+
* Both concerns are skipped cleanly when the lint caller did not
|
|
27
|
+
* supply a `workflowFilePath` (the package dir is the only place skill
|
|
28
|
+
* manifests can live).
|
|
29
|
+
*/
|
|
30
|
+
export type DiagnosticCode = 'WF001' | 'WF002' | 'WF003' | 'WF004' | 'WF006' | 'WF007' | 'WF008' | 'WF010';
|
|
31
|
+
export type DiagnosticSeverity = 'error' | 'warning';
|
|
32
|
+
export interface Diagnostic {
|
|
33
|
+
readonly code: DiagnosticCode;
|
|
34
|
+
readonly severity: DiagnosticSeverity;
|
|
35
|
+
readonly message: string;
|
|
36
|
+
readonly stateId?: string;
|
|
37
|
+
readonly hint?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Injected facts the linter cannot derive from the definition alone.
|
|
41
|
+
*
|
|
42
|
+
* Kept minimal: methods/fields are added only when a new check
|
|
43
|
+
* genuinely needs external context.
|
|
44
|
+
*/
|
|
45
|
+
export interface LintContext {
|
|
46
|
+
/** Returns true iff the named persona is installed locally. */
|
|
47
|
+
personaExists(name: string): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Absolute path to the workflow file being linted, when known. Used
|
|
50
|
+
* by checks that resolve co-packaged resources off the manifest's
|
|
51
|
+
* directory (currently WF010 — skill references). Lint callers that
|
|
52
|
+
* do not have a path on hand (e.g., synthesized definitions in tests)
|
|
53
|
+
* may omit this; rules that need it skip cleanly when absent.
|
|
54
|
+
*/
|
|
55
|
+
readonly workflowFilePath?: string;
|
|
56
|
+
}
|
|
57
|
+
export type LintResult = readonly Diagnostic[];
|
|
58
|
+
/**
|
|
59
|
+
* Runs all registered checks against `def`. Pure: same input => same
|
|
60
|
+
* output. Diagnostics come back in stable order (WF001 first, WF007 last).
|
|
61
|
+
*/
|
|
62
|
+
export declare function lintWorkflow(def: WorkflowDefinition, ctx: LintContext): LintResult;
|
|
63
|
+
export declare function countBySeverity(diagnostics: readonly Diagnostic[]): {
|
|
64
|
+
errors: number;
|
|
65
|
+
warnings: number;
|
|
66
|
+
};
|