@explyt/ai-agent 0.1.0-rc.1 → 0.1.3
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 +14 -15
- package/THIRD-PARTY-NOTICES.md +153 -5
- package/agent-docs/README.md +43 -0
- package/agent-docs/mcp.md +111 -0
- package/agent-docs/rules.md +92 -0
- package/agent-docs/settings.md +54 -0
- package/agent-docs/skills.md +90 -0
- package/dist/app-bridge.bundle.js +67 -0
- package/dist/cli/engine.js +680 -135
- package/dist/cli/index.js +152 -194
- package/dist/extensions/bash.js +1 -0
- package/dist/extensions/custom-provider.js +1 -0
- package/dist/extensions/hello.js +1 -1
- package/dist/extensions/identity.js +1 -0
- package/dist/extensions/mcp.js +1 -0
- package/dist/extensions/misc-hacks.js +1 -0
- package/dist/extensions/policy.js +1 -1
- package/dist/extensions/rules.js +1 -0
- package/dist/extensions/skills.js +1 -0
- package/dist/mcp-adapter.js +602 -0
- package/dist/mcp-keyring-helper.cjs +89 -0
- package/dist/mcp-script-worker.mjs +130 -0
- package/node_modules/acorn/CHANGELOG.md +998 -0
- package/node_modules/acorn/LICENSE +21 -0
- package/node_modules/acorn/README.md +309 -0
- package/node_modules/acorn/bin/acorn +4 -0
- package/node_modules/acorn/dist/acorn.d.mts +897 -0
- package/node_modules/acorn/dist/acorn.d.ts +897 -0
- package/node_modules/acorn/dist/acorn.js +6342 -0
- package/node_modules/acorn/dist/acorn.mjs +6313 -0
- package/node_modules/acorn/dist/bin.js +90 -0
- package/node_modules/acorn/package.json +50 -0
- package/node_modules/default-browser/package.json +1 -1
- package/node_modules/default-browser/windows.js +3 -1
- package/node_modules/fast-uri/index.js +221 -49
- package/node_modules/fast-uri/lib/schemes.js +9 -4
- package/node_modules/fast-uri/lib/utils.js +396 -92
- package/node_modules/fast-uri/package.json +1 -1
- package/node_modules/fast-uri/test/component-safe-serialization.test.js +163 -0
- package/node_modules/fast-uri/test/equal.test.js +31 -3
- package/node_modules/fast-uri/test/fixtures/uri-js-parse.json +2 -0
- package/node_modules/fast-uri/test/ipv6-canonical.test.js +34 -0
- package/node_modules/fast-uri/test/ipv6-validation.test.js +124 -0
- package/node_modules/fast-uri/test/malformed-percent.test.js +77 -0
- package/node_modules/fast-uri/test/malformed-urn.test.js +61 -0
- package/node_modules/fast-uri/test/parse.test.js +7 -3
- package/node_modules/fast-uri/test/query-fragment-normalization.test.js +33 -0
- package/node_modules/fast-uri/test/reserved-path-normalization.test.js +109 -0
- package/node_modules/fast-uri/test/scheme-validation.test.js +124 -0
- package/node_modules/fast-uri/test/security-normalization.test.js +139 -0
- package/node_modules/fast-uri/test/security.test.js +75 -3
- package/node_modules/fast-uri/test/urn-full-input.test.js +29 -0
- package/node_modules/fast-uri/test/websocket-query-preservation.test.js +24 -0
- package/node_modules/jose/dist/types/index.d.ts +1 -2
- package/node_modules/jose/dist/types/jwe/compact/decrypt.d.ts +12 -25
- package/node_modules/jose/dist/types/jwe/compact/encrypt.d.ts +18 -31
- package/node_modules/jose/dist/types/jwe/flattened/decrypt.d.ts +12 -25
- package/node_modules/jose/dist/types/jwe/flattened/encrypt.d.ts +24 -49
- package/node_modules/jose/dist/types/jwe/general/decrypt.d.ts +15 -30
- package/node_modules/jose/dist/types/jwe/general/encrypt.d.ts +29 -51
- package/node_modules/jose/dist/types/jwk/embedded.d.ts +5 -8
- package/node_modules/jose/dist/types/jwk/thumbprint.d.ts +7 -9
- package/node_modules/jose/dist/types/jwks/local.d.ts +10 -13
- package/node_modules/jose/dist/types/jwks/remote.d.ts +30 -42
- package/node_modules/jose/dist/types/jws/compact/sign.d.ts +8 -13
- package/node_modules/jose/dist/types/jws/compact/verify.d.ts +14 -26
- package/node_modules/jose/dist/types/jws/flattened/sign.d.ts +10 -19
- package/node_modules/jose/dist/types/jws/flattened/verify.d.ts +14 -26
- package/node_modules/jose/dist/types/jws/general/sign.d.ts +19 -33
- package/node_modules/jose/dist/types/jws/general/verify.d.ts +17 -32
- package/node_modules/jose/dist/types/jwt/decrypt.d.ts +20 -27
- package/node_modules/jose/dist/types/jwt/encrypt.d.ts +32 -42
- package/node_modules/jose/dist/types/jwt/sign.d.ts +10 -21
- package/node_modules/jose/dist/types/jwt/unsecured.d.ts +13 -28
- package/node_modules/jose/dist/types/jwt/verify.d.ts +19 -22
- package/node_modules/jose/dist/types/key/export.d.ts +10 -10
- package/node_modules/jose/dist/types/key/generate_key_pair.d.ts +15 -22
- package/node_modules/jose/dist/types/key/generate_secret.d.ts +12 -19
- package/node_modules/jose/dist/types/key/import.d.ts +25 -31
- package/node_modules/jose/dist/types/types.d.ts +186 -319
- package/node_modules/jose/dist/types/util/base64url.d.ts +7 -7
- package/node_modules/jose/dist/types/util/decode_jwt.d.ts +5 -7
- package/node_modules/jose/dist/types/util/decode_protected_header.d.ts +6 -5
- package/node_modules/jose/dist/types/util/errors.d.ts +50 -88
- package/node_modules/jose/dist/webapi/index.js +70 -32
- package/node_modules/jose/dist/webapi/jwe/compact/decrypt.js +6 -8
- package/node_modules/jose/dist/webapi/jwe/compact/encrypt.js +25 -26
- package/node_modules/jose/dist/webapi/jwe/flattened/decrypt.js +14 -10
- package/node_modules/jose/dist/webapi/jwe/flattened/encrypt.js +34 -71
- package/node_modules/jose/dist/webapi/jwe/general/decrypt.js +38 -49
- package/node_modules/jose/dist/webapi/jwe/general/encrypt.js +100 -161
- package/node_modules/jose/dist/webapi/jwk/embedded.js +29 -18
- package/node_modules/jose/dist/webapi/jwk/thumbprint.js +51 -64
- package/node_modules/jose/dist/webapi/jwks/local.js +55 -74
- package/node_modules/jose/dist/webapi/jwks/remote.js +91 -160
- package/node_modules/jose/dist/webapi/jws/compact/sign.js +19 -20
- package/node_modules/jose/dist/webapi/jws/compact/verify.js +7 -8
- package/node_modules/jose/dist/webapi/jws/flattened/sign.js +22 -30
- package/node_modules/jose/dist/webapi/jws/flattened/verify.js +11 -23
- package/node_modules/jose/dist/webapi/jws/general/sign.js +55 -71
- package/node_modules/jose/dist/webapi/jws/general/verify.js +45 -41
- package/node_modules/jose/dist/webapi/jwt/decrypt.js +12 -22
- package/node_modules/jose/dist/webapi/jwt/encrypt.js +44 -100
- package/node_modules/jose/dist/webapi/jwt/sign.js +18 -50
- package/node_modules/jose/dist/webapi/jwt/unsecured.js +33 -63
- package/node_modules/jose/dist/webapi/jwt/verify.js +12 -14
- package/node_modules/jose/dist/webapi/key/export.js +32 -41
- package/node_modules/jose/dist/webapi/key/generate_key_pair.js +32 -45
- package/node_modules/jose/dist/webapi/key/generate_secret.js +35 -39
- package/node_modules/jose/dist/webapi/key/import.js +48 -52
- package/node_modules/jose/dist/webapi/lib/asn1.js +128 -164
- package/node_modules/jose/dist/webapi/lib/buffer_utils.js +72 -41
- package/node_modules/jose/dist/webapi/lib/content_encryption.js +75 -127
- package/node_modules/jose/dist/webapi/lib/deflate.js +36 -40
- package/node_modules/jose/dist/webapi/lib/jwe_algorithms.js +102 -93
- package/node_modules/jose/dist/webapi/lib/jwe_decrypt.js +178 -177
- package/node_modules/jose/dist/webapi/lib/jwe_encrypt.js +72 -107
- package/node_modules/jose/dist/webapi/lib/jws_algorithms.js +62 -61
- package/node_modules/jose/dist/webapi/lib/jws_sign.js +44 -72
- package/node_modules/jose/dist/webapi/lib/jws_verify.js +82 -103
- package/node_modules/jose/dist/webapi/lib/jwt_claims_set.js +134 -185
- package/node_modules/jose/dist/webapi/lib/key.js +147 -124
- package/node_modules/jose/dist/webapi/lib/key_algorithm.js +13 -8
- package/node_modules/jose/dist/webapi/lib/key_descriptor.js +8 -6
- package/node_modules/jose/dist/webapi/lib/key_management.js +169 -229
- package/node_modules/jose/dist/webapi/lib/validate.js +122 -0
- package/node_modules/jose/dist/webapi/util/base64url.js +14 -37
- package/node_modules/jose/dist/webapi/util/decode_jwt.js +32 -31
- package/node_modules/jose/dist/webapi/util/decode_protected_header.js +18 -23
- package/node_modules/jose/dist/webapi/util/errors.js +94 -84
- package/node_modules/jose/package.json +17 -81
- package/node_modules/pi-mcp-adapter/CHANGELOG.md +156 -0
- package/node_modules/pi-mcp-adapter/README.md +121 -13
- package/node_modules/pi-mcp-adapter/agent-dir.ts +12 -4
- package/node_modules/pi-mcp-adapter/agent-plugin-loader.ts +1 -1
- package/node_modules/pi-mcp-adapter/cli.js +188 -5
- package/node_modules/pi-mcp-adapter/commands.ts +136 -20
- package/node_modules/pi-mcp-adapter/config.ts +74 -15
- package/node_modules/pi-mcp-adapter/direct-tools.ts +134 -72
- package/node_modules/pi-mcp-adapter/dist/agent-dir.d.ts +10 -0
- package/node_modules/pi-mcp-adapter/dist/agent-dir.js +63 -0
- package/node_modules/pi-mcp-adapter/dist/agent-dir.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.d.ts +8 -0
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js +356 -0
- package/node_modules/pi-mcp-adapter/dist/agent-plugin-loader.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/config.d.ts +123 -0
- package/node_modules/pi-mcp-adapter/dist/config.js +1088 -0
- package/node_modules/pi-mcp-adapter/dist/config.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.d.ts +24 -0
- package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js +336 -0
- package/node_modules/pi-mcp-adapter/dist/mcp-bearer-store.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/metadata-cache.d.ts +19 -0
- package/node_modules/pi-mcp-adapter/dist/metadata-cache.js +319 -0
- package/node_modules/pi-mcp-adapter/dist/metadata-cache.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.d.ts +2 -0
- package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js +156 -0
- package/node_modules/pi-mcp-adapter/dist/package-mcp-loader.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/resource-tools.d.ts +1 -0
- package/node_modules/pi-mcp-adapter/dist/resource-tools.js +15 -0
- package/node_modules/pi-mcp-adapter/dist/resource-tools.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/types.d.ts +566 -0
- package/node_modules/pi-mcp-adapter/dist/types.js +287 -0
- package/node_modules/pi-mcp-adapter/dist/types.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.d.ts +6 -0
- package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js +37 -0
- package/node_modules/pi-mcp-adapter/dist/ui-app-bridge-helpers.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/ui-stream-types.d.ts +104 -0
- package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js +59 -0
- package/node_modules/pi-mcp-adapter/dist/ui-stream-types.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.d.ts +4 -0
- package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js +27 -0
- package/node_modules/pi-mcp-adapter/dist/ui-tool-visibility.js.map +1 -0
- package/node_modules/pi-mcp-adapter/dist/utils.d.ts +32 -0
- package/node_modules/pi-mcp-adapter/dist/utils.js +338 -0
- package/node_modules/pi-mcp-adapter/dist/utils.js.map +1 -0
- package/node_modules/pi-mcp-adapter/failure-backoff.ts +23 -0
- package/node_modules/pi-mcp-adapter/host-html-template.ts +0 -8
- package/node_modules/pi-mcp-adapter/index.ts +434 -36
- package/node_modules/pi-mcp-adapter/init.ts +102 -35
- package/node_modules/pi-mcp-adapter/lifecycle.ts +323 -28
- package/node_modules/pi-mcp-adapter/mcp-auth-flow.ts +161 -37
- package/node_modules/pi-mcp-adapter/mcp-auth.ts +60 -2
- package/node_modules/pi-mcp-adapter/mcp-bearer-store.ts +385 -0
- package/node_modules/pi-mcp-adapter/mcp-callback-server.ts +27 -3
- package/node_modules/pi-mcp-adapter/mcp-code.ts +6 -0
- package/node_modules/pi-mcp-adapter/mcp-oauth-provider.ts +155 -16
- package/node_modules/pi-mcp-adapter/mcp-output-guard.ts +95 -7
- package/node_modules/pi-mcp-adapter/mcp-panel.ts +87 -22
- package/node_modules/pi-mcp-adapter/mcp-probe.ts +18 -4
- package/node_modules/pi-mcp-adapter/mcp-references.ts +376 -0
- package/node_modules/pi-mcp-adapter/mcp-script-worker.mjs +22 -20
- package/node_modules/pi-mcp-adapter/mcp-setup-panel.ts +2 -1
- package/node_modules/pi-mcp-adapter/mcp-status.ts +8 -19
- package/node_modules/pi-mcp-adapter/metadata-cache.ts +66 -14
- package/node_modules/pi-mcp-adapter/namespace-tools.ts +276 -0
- package/node_modules/pi-mcp-adapter/npx-resolver.ts +81 -26
- package/node_modules/pi-mcp-adapter/package-mcp-loader.ts +168 -0
- package/node_modules/pi-mcp-adapter/package.json +29 -8
- package/node_modules/pi-mcp-adapter/proxy-modes.ts +229 -50
- package/node_modules/pi-mcp-adapter/request-headers-command.ts +330 -0
- package/node_modules/pi-mcp-adapter/search-ranking.ts +167 -16
- package/node_modules/pi-mcp-adapter/server-manager.ts +243 -14
- package/node_modules/pi-mcp-adapter/session-recovery.ts +15 -2
- package/node_modules/pi-mcp-adapter/state.ts +1 -3
- package/node_modules/pi-mcp-adapter/tool-approval.ts +63 -9
- package/node_modules/pi-mcp-adapter/tool-metadata.ts +62 -4
- package/node_modules/pi-mcp-adapter/tool-result-renderer.ts +195 -15
- package/node_modules/pi-mcp-adapter/types.ts +229 -29
- package/node_modules/pi-mcp-adapter/ui-server.ts +41 -36
- package/node_modules/pi-mcp-adapter/ui-session.ts +2 -1
- package/node_modules/pi-mcp-adapter/utils.ts +91 -19
- package/node_modules/pi-subagents/CHANGELOG.md +582 -0
- package/node_modules/pi-subagents/README.md +6 -0
- package/node_modules/pi-subagents/agents/claude-code-writer.md +15 -0
- package/node_modules/pi-subagents/agents/claude-code.md +15 -0
- package/node_modules/pi-subagents/agents/codex-exec-writer.md +15 -0
- package/node_modules/pi-subagents/agents/codex-exec.md +15 -0
- package/node_modules/pi-subagents/agents/cursor-agent-writer.md +14 -0
- package/node_modules/pi-subagents/agents/cursor-agent.md +14 -0
- package/node_modules/pi-subagents/agents/oracle.md +9 -5
- package/node_modules/pi-subagents/agents/researcher.md +1 -1
- package/node_modules/pi-subagents/agents/reviewer.md +15 -4
- package/node_modules/pi-subagents/agents/scout.md +3 -3
- package/node_modules/pi-subagents/agents/worker.md +3 -2
- package/node_modules/pi-subagents/async-retention-discovery-worker.mjs +180 -0
- package/node_modules/pi-subagents/docs/agents.md +164 -14
- package/node_modules/pi-subagents/docs/configuration.md +204 -24
- package/node_modules/pi-subagents/docs/extension-api.md +146 -11
- package/node_modules/pi-subagents/docs/missions.md +5 -3
- package/node_modules/pi-subagents/docs/models.md +74 -8
- package/node_modules/pi-subagents/docs/observability.md +100 -12
- package/node_modules/pi-subagents/docs/tool-reference.md +185 -46
- package/node_modules/pi-subagents/docs/workflows.md +317 -5
- package/node_modules/pi-subagents/index.ts +10 -1
- package/node_modules/pi-subagents/install.mjs +1 -1
- package/node_modules/pi-subagents/package.json +7 -2
- package/node_modules/pi-subagents/prompts/council.md +60 -0
- package/node_modules/pi-subagents/prompts/parallel-review.md +5 -1
- package/node_modules/pi-subagents/prompts/review-loop.md +11 -7
- package/node_modules/pi-subagents/skills/council-mode/SKILL.md +59 -0
- package/node_modules/pi-subagents/skills/council-mode/references/pass-contracts.md +150 -0
- package/node_modules/pi-subagents/skills/pi-subagents/SKILL.md +87 -25
- package/node_modules/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +40 -221
- package/node_modules/pi-subagents/skills/pi-subagents/references/execution-controls.md +136 -26
- package/node_modules/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +8 -8
- package/node_modules/pi-subagents/skills/pi-subagents/references/multi-lane-orchestration.md +51 -0
- package/node_modules/pi-subagents/skills/pi-subagents/references/prompting-and-roles.md +99 -46
- package/node_modules/pi-subagents/skills/pi-subagents/references/review-and-validation.md +73 -0
- package/node_modules/pi-subagents/src/agents/agent-management.ts +541 -442
- package/node_modules/pi-subagents/src/agents/agent-refinements.ts +4 -4
- package/node_modules/pi-subagents/src/agents/agent-serializer.ts +20 -4
- package/node_modules/pi-subagents/src/agents/agents.ts +1177 -267
- package/node_modules/pi-subagents/src/agents/builtin-names.ts +15 -0
- package/node_modules/pi-subagents/src/agents/runtime-agent-events.ts +70 -0
- package/node_modules/pi-subagents/src/agents/runtime-agent-registry.ts +429 -0
- package/node_modules/pi-subagents/src/agents/skills.ts +1 -1
- package/node_modules/pi-subagents/src/api/agents.ts +12 -0
- package/node_modules/pi-subagents/src/api/background-work.ts +12 -3
- package/node_modules/pi-subagents/src/api/delegation.ts +0 -7
- package/node_modules/pi-subagents/src/api/external-job-provider.ts +195 -0
- package/node_modules/pi-subagents/src/api/external-runs.ts +237 -84
- package/node_modules/pi-subagents/src/api/preflight.ts +140 -42
- package/node_modules/pi-subagents/src/api/project-panes.ts +2 -0
- package/node_modules/pi-subagents/src/api/shared-types.ts +5 -0
- package/node_modules/pi-subagents/src/extension/config.ts +134 -2
- package/node_modules/pi-subagents/src/extension/doctor.ts +54 -6
- package/node_modules/pi-subagents/src/extension/fanout-child.ts +9 -6
- package/node_modules/pi-subagents/src/extension/index.ts +361 -118
- package/node_modules/pi-subagents/src/extension/public-execution.ts +149 -10
- package/node_modules/pi-subagents/src/extension/rpc.ts +229 -23
- package/node_modules/pi-subagents/src/extension/schemas.ts +81 -58
- package/node_modules/pi-subagents/src/extension/tool-description.ts +70 -31
- package/node_modules/pi-subagents/src/extension/tool-result.ts +19 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/actions.ts +16 -10
- package/node_modules/pi-subagents/src/inspectors/herdr/client.ts +3 -3
- package/node_modules/pi-subagents/src/inspectors/herdr/focus.ts +55 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/inspector-runner.ts +10 -4
- package/node_modules/pi-subagents/src/inspectors/herdr/project-panes.ts +230 -50
- package/node_modules/pi-subagents/src/inspectors/herdr/session-roots-codec.ts +42 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/shell-command.ts +16 -0
- package/node_modules/pi-subagents/src/integrations/herdr-status.ts +75 -5
- package/node_modules/pi-subagents/src/intercom/intercom-bridge.ts +9 -5
- package/node_modules/pi-subagents/src/intercom/native-supervisor-channel.ts +51 -52
- package/node_modules/pi-subagents/src/intercom/result-intercom.ts +2 -0
- package/node_modules/pi-subagents/src/missions/goal-driver.ts +3 -1
- package/node_modules/pi-subagents/src/missions/lifecycle.ts +10 -8
- package/node_modules/pi-subagents/src/missions/store.ts +16 -16
- package/node_modules/pi-subagents/src/missions/workflow-state.ts +8 -4
- package/node_modules/pi-subagents/src/profiles/profiles.ts +8 -7
- package/node_modules/pi-subagents/src/runs/background/active-async-capacity.ts +517 -0
- package/node_modules/pi-subagents/src/runs/background/active-run-index.ts +100 -3
- package/node_modules/pi-subagents/src/runs/background/async-execution.ts +630 -184
- package/node_modules/pi-subagents/src/runs/background/async-job-tracker.ts +143 -33
- package/node_modules/pi-subagents/src/runs/background/async-resume.ts +117 -44
- package/node_modules/pi-subagents/src/runs/background/async-retention.ts +903 -0
- package/node_modules/pi-subagents/src/runs/background/async-status-snapshot.ts +48 -0
- package/node_modules/pi-subagents/src/runs/background/async-status.ts +235 -69
- package/node_modules/pi-subagents/src/runs/background/auto-drain.ts +2 -1
- package/node_modules/pi-subagents/src/runs/background/chain-append.ts +44 -51
- package/node_modules/pi-subagents/src/runs/background/chain-root-attachment.ts +79 -8
- package/node_modules/pi-subagents/src/runs/background/completion-dedupe.ts +5 -1
- package/node_modules/pi-subagents/src/runs/background/completion-replay.ts +33 -13
- package/node_modules/pi-subagents/src/runs/background/control-channel.ts +108 -73
- package/node_modules/pi-subagents/src/runs/background/fleet-view.ts +125 -45
- package/node_modules/pi-subagents/src/runs/background/index-segment.ts +59 -0
- package/node_modules/pi-subagents/src/runs/background/inspect-rpc.ts +443 -0
- package/node_modules/pi-subagents/src/runs/background/notify.ts +272 -10
- package/node_modules/pi-subagents/src/runs/background/owned-process-tree.ts +104 -0
- package/node_modules/pi-subagents/src/runs/background/process-terminal.ts +33 -3
- package/node_modules/pi-subagents/src/runs/background/result-delivery-ownership.ts +45 -0
- package/node_modules/pi-subagents/src/runs/background/result-files.ts +519 -0
- package/node_modules/pi-subagents/src/runs/background/result-watcher.ts +329 -54
- package/node_modules/pi-subagents/src/runs/background/resume-guidance.ts +35 -12
- package/node_modules/pi-subagents/src/runs/background/retained-children.ts +85 -18
- package/node_modules/pi-subagents/src/runs/background/run-id-query.ts +7 -0
- package/node_modules/pi-subagents/src/runs/background/run-id-resolver.ts +37 -29
- package/node_modules/pi-subagents/src/runs/background/run-status.ts +204 -32
- package/node_modules/pi-subagents/src/runs/background/scheduled-runs.ts +228 -40
- package/node_modules/pi-subagents/src/runs/background/stale-run-reconciler.ts +42 -16
- package/node_modules/pi-subagents/src/runs/background/steering.ts +18 -15
- package/node_modules/pi-subagents/src/runs/background/subagent-runner.ts +1419 -546
- package/node_modules/pi-subagents/src/runs/background/subagent-wait.ts +105 -44
- package/node_modules/pi-subagents/src/runs/background/terminal-run-index.ts +138 -0
- package/node_modules/pi-subagents/src/runs/background/wait-completions.ts +54 -4
- package/node_modules/pi-subagents/src/runs/background/wait-config.ts +23 -9
- package/node_modules/pi-subagents/src/runs/background/wait-subscriptions.ts +81 -2
- package/node_modules/pi-subagents/src/runs/background/wait-tool.ts +28 -19
- package/node_modules/pi-subagents/src/runs/foreground/async-dismiss-action.ts +2 -1
- package/node_modules/pi-subagents/src/runs/foreground/async-steering-action.ts +23 -16
- package/node_modules/pi-subagents/src/runs/foreground/async-stop-action.ts +23 -2
- package/node_modules/pi-subagents/src/runs/foreground/execution.ts +730 -168
- package/node_modules/pi-subagents/src/runs/foreground/foreground-control.ts +21 -0
- package/node_modules/pi-subagents/src/runs/foreground/foreground-history.ts +26 -3
- package/node_modules/pi-subagents/src/runs/foreground/prompt-audit.ts +172 -0
- package/node_modules/pi-subagents/src/runs/foreground/subagent-executor.ts +2705 -1726
- package/node_modules/pi-subagents/src/runs/foreground/workflow-detach-reconcile.ts +299 -0
- package/node_modules/pi-subagents/src/runs/foreground/workflow-foreground-steering.ts +6 -5
- package/node_modules/pi-subagents/src/runs/shared/abort-recovery.ts +119 -0
- package/node_modules/pi-subagents/src/runs/shared/acceptance.ts +183 -39
- package/node_modules/pi-subagents/src/runs/shared/agent-contract.ts +1 -1
- package/node_modules/pi-subagents/src/runs/shared/async-status-projection.ts +597 -0
- package/node_modules/pi-subagents/src/runs/shared/background-process-options.ts +9 -0
- package/node_modules/pi-subagents/src/runs/shared/capability-ceiling.ts +1 -0
- package/node_modules/pi-subagents/src/runs/shared/chain-outputs.ts +1 -3
- package/node_modules/pi-subagents/src/runs/shared/child-identity.ts +51 -0
- package/node_modules/pi-subagents/src/runs/shared/child-launch-plan.ts +151 -0
- package/node_modules/pi-subagents/src/runs/shared/child-protocol.ts +21 -7
- package/node_modules/pi-subagents/src/runs/shared/claude-code-adapter.ts +129 -0
- package/node_modules/pi-subagents/src/runs/shared/codex-exec-adapter.ts +129 -0
- package/node_modules/pi-subagents/src/runs/shared/completion-evidence.ts +89 -0
- package/node_modules/pi-subagents/src/runs/shared/completion-guard.ts +163 -6
- package/node_modules/pi-subagents/src/runs/shared/cursor-agent-adapter.ts +114 -0
- package/node_modules/pi-subagents/src/runs/shared/dynamic-fanout.ts +4 -4
- package/node_modules/pi-subagents/src/runs/shared/extension-bindings.ts +78 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-contract.ts +167 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-preflight.ts +122 -0
- package/node_modules/pi-subagents/src/runs/shared/external-cli-runner.ts +353 -54
- package/node_modules/pi-subagents/src/runs/shared/external-job-bridge.ts +460 -0
- package/node_modules/pi-subagents/src/runs/shared/external-job-runner.ts +389 -0
- package/node_modules/pi-subagents/src/runs/shared/fast-mode-extension.ts +10 -0
- package/node_modules/pi-subagents/src/runs/shared/host-step-status.ts +231 -0
- package/node_modules/pi-subagents/src/runs/shared/lane-metadata.ts +105 -0
- package/node_modules/pi-subagents/src/runs/shared/launch-cwd.ts +16 -0
- package/node_modules/pi-subagents/src/runs/shared/llm-intent-arbiter.ts +302 -0
- package/node_modules/pi-subagents/src/runs/shared/long-running-guard.ts +2 -1
- package/node_modules/pi-subagents/src/runs/shared/mcp-config-sources.ts +422 -0
- package/node_modules/pi-subagents/src/runs/shared/mcp-direct-tool-allowlist.ts +230 -153
- package/node_modules/pi-subagents/src/runs/shared/mcp-direct-tool-grant.ts +194 -0
- package/node_modules/pi-subagents/src/runs/shared/model-exclusions.ts +305 -0
- package/node_modules/pi-subagents/src/runs/shared/model-fallback.ts +300 -62
- package/node_modules/pi-subagents/src/runs/shared/model-scope.ts +106 -39
- package/node_modules/pi-subagents/src/runs/shared/mutation-evidence.ts +199 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-events.ts +75 -65
- package/node_modules/pi-subagents/src/runs/shared/nested-render.ts +9 -5
- package/node_modules/pi-subagents/src/runs/shared/orca-progress-tabs.ts +499 -0
- package/node_modules/pi-subagents/src/runs/shared/parallel-handoff.ts +464 -10
- package/node_modules/pi-subagents/src/runs/shared/parallel-utils.ts +38 -20
- package/node_modules/pi-subagents/src/runs/shared/permissions.ts +6 -2
- package/node_modules/pi-subagents/src/runs/shared/pi-args.ts +279 -21
- package/node_modules/pi-subagents/src/runs/shared/pi-spawn.ts +69 -35
- package/node_modules/pi-subagents/src/runs/shared/process-signal.ts +13 -0
- package/node_modules/pi-subagents/src/runs/shared/run-fanout-budget.ts +280 -0
- package/node_modules/pi-subagents/src/runs/shared/run-history.ts +21 -1
- package/node_modules/pi-subagents/src/runs/shared/session-lease.ts +0 -6
- package/node_modules/pi-subagents/src/runs/shared/single-output.ts +93 -24
- package/node_modules/pi-subagents/src/runs/shared/structured-output.ts +46 -5
- package/node_modules/pi-subagents/src/runs/shared/subagent-control.ts +66 -7
- package/node_modules/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +195 -44
- package/node_modules/pi-subagents/src/runs/shared/subagent-startup-retry.ts +12 -0
- package/node_modules/pi-subagents/src/runs/shared/task-intent.ts +36 -9
- package/node_modules/pi-subagents/src/runs/shared/tool-availability.ts +1 -3
- package/node_modules/pi-subagents/src/runs/shared/tool-timeout.ts +93 -0
- package/node_modules/pi-subagents/src/runs/shared/workflow-graph.ts +17 -23
- package/node_modules/pi-subagents/src/runs/shared/worktree-cleanup-plan.ts +847 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree.ts +49 -7
- package/node_modules/pi-subagents/src/shared/agent-stream-options.ts +5 -0
- package/node_modules/pi-subagents/src/shared/artifacts.ts +2 -6
- package/node_modules/pi-subagents/src/shared/atomic-json.ts +24 -2
- package/node_modules/pi-subagents/src/shared/capacity-resilient-json.ts +102 -0
- package/node_modules/pi-subagents/src/shared/child-session-name.ts +46 -0
- package/node_modules/pi-subagents/src/shared/completion-owner.ts +14 -0
- package/node_modules/pi-subagents/src/shared/display-text.ts +50 -0
- package/node_modules/pi-subagents/src/shared/extension-context.ts +24 -0
- package/node_modules/pi-subagents/src/shared/file-system-retry.ts +49 -1
- package/node_modules/pi-subagents/src/shared/fork-context.ts +80 -13
- package/node_modules/pi-subagents/src/shared/fork-session-cwd.ts +27 -0
- package/node_modules/pi-subagents/src/shared/formatters.ts +18 -3
- package/node_modules/pi-subagents/src/shared/launch-contract.ts +20 -6
- package/node_modules/pi-subagents/src/shared/model-info.ts +20 -0
- package/node_modules/pi-subagents/src/shared/node-executable.ts +21 -0
- package/node_modules/pi-subagents/src/shared/prompt-resources.ts +0 -40
- package/node_modules/pi-subagents/src/shared/pruned-fork.ts +450 -0
- package/node_modules/pi-subagents/src/shared/session-file-trust.ts +19 -0
- package/node_modules/pi-subagents/src/shared/session-tokens.ts +14 -3
- package/node_modules/pi-subagents/src/shared/settings.ts +25 -130
- package/node_modules/pi-subagents/src/shared/shortcuts.ts +17 -0
- package/node_modules/pi-subagents/src/shared/thinking-ceiling.ts +52 -0
- package/node_modules/pi-subagents/src/shared/types.ts +788 -64
- package/node_modules/pi-subagents/src/shared/utils.ts +52 -85
- package/node_modules/pi-subagents/src/shared/watch-strategy.ts +10 -0
- package/node_modules/pi-subagents/src/shared/workflow-child-permit.ts +207 -0
- package/node_modules/pi-subagents/src/slash/delegation-adapters.ts +1 -9
- package/node_modules/pi-subagents/src/slash/delegation-request.ts +0 -4
- package/node_modules/pi-subagents/src/slash/prompt-template-bridge.ts +37 -1
- package/node_modules/pi-subagents/src/slash/slash-commands.ts +457 -135
- package/node_modules/pi-subagents/src/slash/slash-live-state.ts +28 -14
- package/node_modules/pi-subagents/src/slash/subagents-admin.ts +5 -0
- package/node_modules/pi-subagents/src/tui/fleet-status.ts +402 -71
- package/node_modules/pi-subagents/src/tui/fleet-transcript.ts +12 -53
- package/node_modules/pi-subagents/src/tui/fleet.ts +500 -53
- package/node_modules/pi-subagents/src/tui/render-helpers.ts +31 -0
- package/node_modules/pi-subagents/src/tui/render.ts +1192 -192
- package/node_modules/pi-subagents/src/watchdog/change-signature.ts +41 -2
- package/node_modules/pi-subagents/src/watchdog/lsp-diagnostics.ts +1 -0
- package/node_modules/pi-subagents/src/watchdog/permission-arbiter.ts +60 -51
- package/node_modules/pi-subagents/src/watchdog/review.ts +4 -3
- package/node_modules/pi-subagents/src/watchdog/turn-delta.ts +1 -1
- package/node_modules/pi-subagents/src/workflows/chat-progress.ts +17 -6
- package/node_modules/pi-subagents/src/workflows/host-command.ts +235 -0
- package/node_modules/pi-subagents/src/workflows/scripted-workflow.ts +1654 -174
- package/node_modules/pi-subagents/src/workflows/workflow-child-summary.ts +121 -0
- package/node_modules/pi-subagents/src/workflows/workflow-preflight.ts +270 -0
- package/node_modules/pi-subagents/src/workflows/workflow-receipt.ts +366 -0
- package/node_modules/pi-subagents/src/workflows/workflow-resources.ts +150 -0
- package/node_modules/pi-subagents/src/workflows/workflow-settlement.ts +246 -0
- package/node_modules/zod/README.md +29 -2
- package/node_modules/zod/compile.cjs +96 -0
- package/node_modules/zod/compile.d.cts +1 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +21 -2
- package/node_modules/zod/index.d.cts +1 -2
- package/node_modules/zod/index.d.ts +1 -2
- package/node_modules/zod/index.js +5 -2
- package/node_modules/zod/locales/index.cjs +19 -0
- package/node_modules/zod/mini/index.cjs +19 -0
- package/node_modules/zod/package.json +20 -8
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +5 -2
- package/node_modules/zod/src/v3/ZodError.ts +22 -12
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
- package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
- package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
- package/node_modules/zod/src/v3/types.ts +5 -5
- package/node_modules/zod/src/v4/classic/checks.ts +1 -0
- package/node_modules/zod/src/v4/classic/compat.ts +26 -18
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +59 -44
- package/node_modules/zod/src/v4/classic/external.ts +14 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +363 -78
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +2 -2
- package/node_modules/zod/src/v4/classic/iso.ts +2 -72
- package/node_modules/zod/src/v4/classic/parse.ts +10 -4
- package/node_modules/zod/src/v4/classic/schemas.ts +640 -375
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +186 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +3 -3
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +261 -13
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +403 -6
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +582 -10
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +67 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +12 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +85 -9
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +301 -12
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +79 -3
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +222 -6
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +44 -3
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1812 -204
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +87 -35
- package/node_modules/zod/src/v4/core/checks.ts +119 -146
- package/node_modules/zod/src/v4/core/compile.ts +2313 -0
- package/node_modules/zod/src/v4/core/core.ts +99 -22
- package/node_modules/zod/src/v4/core/doc.ts +17 -9
- package/node_modules/zod/src/v4/core/errors.ts +113 -25
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +8 -3
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +424 -156
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
- package/node_modules/zod/src/v4/core/parse.ts +164 -50
- package/node_modules/zod/src/v4/core/regexes.ts +42 -15
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +1000 -538
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +1004 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +283 -48
- package/node_modules/zod/src/v4/core/util.ts +454 -157
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/index.ts +3 -3
- package/node_modules/zod/src/v4/locales/ar.ts +5 -0
- package/node_modules/zod/src/v4/locales/az.ts +5 -0
- package/node_modules/zod/src/v4/locales/be.ts +12 -0
- package/node_modules/zod/src/v4/locales/bg.ts +5 -0
- package/node_modules/zod/src/v4/locales/bn.ts +123 -0
- package/node_modules/zod/src/v4/locales/ca.ts +5 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
- package/node_modules/zod/src/v4/locales/cs.ts +5 -0
- package/node_modules/zod/src/v4/locales/da.ts +7 -2
- package/node_modules/zod/src/v4/locales/de.ts +5 -0
- package/node_modules/zod/src/v4/locales/el.ts +3 -0
- package/node_modules/zod/src/v4/locales/en.ts +17 -4
- package/node_modules/zod/src/v4/locales/eo.ts +5 -0
- package/node_modules/zod/src/v4/locales/es.ts +4 -0
- package/node_modules/zod/src/v4/locales/fa.ts +5 -0
- package/node_modules/zod/src/v4/locales/fi.ts +5 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +5 -0
- package/node_modules/zod/src/v4/locales/fr.ts +21 -14
- package/node_modules/zod/src/v4/locales/gu.ts +123 -0
- package/node_modules/zod/src/v4/locales/he.ts +8 -1
- package/node_modules/zod/src/v4/locales/hi.ts +126 -0
- package/node_modules/zod/src/v4/locales/hr.ts +4 -0
- package/node_modules/zod/src/v4/locales/hu.ts +5 -0
- package/node_modules/zod/src/v4/locales/hy.ts +11 -0
- package/node_modules/zod/src/v4/locales/id.ts +5 -0
- package/node_modules/zod/src/v4/locales/index.ts +11 -0
- package/node_modules/zod/src/v4/locales/is.ts +5 -0
- package/node_modules/zod/src/v4/locales/it.ts +5 -0
- package/node_modules/zod/src/v4/locales/ja.ts +5 -0
- package/node_modules/zod/src/v4/locales/ka.ts +5 -0
- package/node_modules/zod/src/v4/locales/km.ts +5 -0
- package/node_modules/zod/src/v4/locales/kn.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +5 -0
- package/node_modules/zod/src/v4/locales/lt.ts +4 -0
- package/node_modules/zod/src/v4/locales/mk.ts +5 -0
- package/node_modules/zod/src/v4/locales/ms.ts +5 -0
- package/node_modules/zod/src/v4/locales/ne.ts +128 -0
- package/node_modules/zod/src/v4/locales/nl.ts +5 -0
- package/node_modules/zod/src/v4/locales/nn.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +7 -2
- package/node_modules/zod/src/v4/locales/ota.ts +5 -0
- package/node_modules/zod/src/v4/locales/pl.ts +5 -0
- package/node_modules/zod/src/v4/locales/ps.ts +5 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
- package/node_modules/zod/src/v4/locales/pt.ts +101 -58
- package/node_modules/zod/src/v4/locales/ro.ts +3 -0
- package/node_modules/zod/src/v4/locales/ru.ts +12 -0
- package/node_modules/zod/src/v4/locales/sk.ts +123 -0
- package/node_modules/zod/src/v4/locales/sl.ts +5 -0
- package/node_modules/zod/src/v4/locales/sv.ts +7 -2
- package/node_modules/zod/src/v4/locales/ta.ts +5 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +5 -0
- package/node_modules/zod/src/v4/locales/tk.ts +113 -0
- package/node_modules/zod/src/v4/locales/tr.ts +5 -0
- package/node_modules/zod/src/v4/locales/uk.ts +5 -0
- package/node_modules/zod/src/v4/locales/ur.ts +5 -0
- package/node_modules/zod/src/v4/locales/uz.ts +3 -0
- package/node_modules/zod/src/v4/locales/vi.ts +5 -0
- package/node_modules/zod/src/v4/locales/yo.ts +5 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +5 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +5 -0
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +12 -1
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/parse.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +167 -63
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +158 -5
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +44 -0
- package/node_modules/zod/v3/ZodError.cjs +41 -12
- package/node_modules/zod/v3/ZodError.d.cts +1 -1
- package/node_modules/zod/v3/ZodError.d.ts +1 -1
- package/node_modules/zod/v3/ZodError.js +22 -12
- package/node_modules/zod/v3/errors.cjs +19 -0
- package/node_modules/zod/v3/external.cjs +19 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
- package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
- package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
- package/node_modules/zod/v3/helpers/util.cjs +19 -0
- package/node_modules/zod/v3/index.cjs +19 -0
- package/node_modules/zod/v3/standard-schema.cjs +19 -0
- package/node_modules/zod/v3/types.cjs +26 -5
- package/node_modules/zod/v3/types.js +7 -5
- package/node_modules/zod/v4/classic/checks.cjs +21 -1
- package/node_modules/zod/v4/classic/checks.d.cts +1 -1
- package/node_modules/zod/v4/classic/checks.d.ts +1 -1
- package/node_modules/zod/v4/classic/checks.js +1 -1
- package/node_modules/zod/v4/classic/coerce.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.d.cts +9 -11
- package/node_modules/zod/v4/classic/compat.d.ts +9 -11
- package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +62 -34
- package/node_modules/zod/v4/classic/errors.d.cts +3 -4
- package/node_modules/zod/v4/classic/errors.d.ts +3 -4
- package/node_modules/zod/v4/classic/errors.js +43 -34
- package/node_modules/zod/v4/classic/external.cjs +51 -27
- package/node_modules/zod/v4/classic/external.d.cts +5 -2
- package/node_modules/zod/v4/classic/external.d.ts +5 -2
- package/node_modules/zod/v4/classic/external.js +5 -8
- package/node_modules/zod/v4/classic/from-json-schema.cjs +376 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +357 -75
- package/node_modules/zod/v4/classic/in-out.cjs +82 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +21 -2
- package/node_modules/zod/v4/classic/index.d.cts +1 -2
- package/node_modules/zod/v4/classic/index.d.ts +1 -2
- package/node_modules/zod/v4/classic/index.js +2 -2
- package/node_modules/zod/v4/classic/iso.cjs +30 -22
- package/node_modules/zod/v4/classic/iso.d.cts +2 -17
- package/node_modules/zod/v4/classic/iso.d.ts +2 -17
- package/node_modules/zod/v4/classic/iso.js +2 -17
- package/node_modules/zod/v4/classic/parse.cjs +23 -1
- package/node_modules/zod/v4/classic/parse.d.cts +17 -4
- package/node_modules/zod/v4/classic/parse.d.ts +17 -4
- package/node_modules/zod/v4/classic/parse.js +1 -0
- package/node_modules/zod/v4/classic/schemas.cjs +591 -426
- package/node_modules/zod/v4/classic/schemas.d.cts +68 -19
- package/node_modules/zod/v4/classic/schemas.d.ts +68 -19
- package/node_modules/zod/v4/classic/schemas.js +564 -424
- package/node_modules/zod/v4/core/api.cjs +66 -24
- package/node_modules/zod/v4/core/api.d.cts +22 -12
- package/node_modules/zod/v4/core/api.d.ts +22 -12
- package/node_modules/zod/v4/core/api.js +44 -24
- package/node_modules/zod/v4/core/checks.cjs +88 -128
- package/node_modules/zod/v4/core/checks.d.cts +29 -13
- package/node_modules/zod/v4/core/checks.d.ts +29 -13
- package/node_modules/zod/v4/core/checks.js +68 -127
- package/node_modules/zod/v4/core/compile.cjs +1908 -0
- package/node_modules/zod/v4/core/compile.d.cts +65 -0
- package/node_modules/zod/v4/core/compile.d.ts +65 -0
- package/node_modules/zod/v4/core/compile.js +1858 -0
- package/node_modules/zod/v4/core/core.cjs +101 -19
- package/node_modules/zod/v4/core/core.d.cts +16 -4
- package/node_modules/zod/v4/core/core.d.ts +16 -4
- package/node_modules/zod/v4/core/core.js +83 -20
- package/node_modules/zod/v4/core/doc.cjs +31 -9
- package/node_modules/zod/v4/core/doc.d.cts +3 -1
- package/node_modules/zod/v4/core/doc.d.ts +3 -1
- package/node_modules/zod/v4/core/doc.js +12 -9
- package/node_modules/zod/v4/core/errors.cjs +126 -25
- package/node_modules/zod/v4/core/errors.d.cts +4 -0
- package/node_modules/zod/v4/core/errors.d.ts +4 -0
- package/node_modules/zod/v4/core/errors.js +107 -25
- package/node_modules/zod/v4/core/index.cjs +24 -1
- package/node_modules/zod/v4/core/index.d.cts +3 -0
- package/node_modules/zod/v4/core/index.d.ts +3 -0
- package/node_modules/zod/v4/core/index.js +3 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +24 -1
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.js +6 -2
- package/node_modules/zod/v4/core/json-schema-processors.cjs +441 -156
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +400 -158
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
- package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
- package/node_modules/zod/v4/core/memoizer.cjs +360 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +311 -0
- package/node_modules/zod/v4/core/parse.cjs +148 -46
- package/node_modules/zod/v4/core/parse.d.cts +14 -11
- package/node_modules/zod/v4/core/parse.d.ts +14 -11
- package/node_modules/zod/v4/core/parse.js +127 -45
- package/node_modules/zod/v4/core/regexes.cjs +54 -17
- package/node_modules/zod/v4/core/regexes.d.cts +5 -0
- package/node_modules/zod/v4/core/regexes.d.ts +5 -0
- package/node_modules/zod/v4/core/regexes.js +32 -15
- package/node_modules/zod/v4/core/registries.cjs +19 -0
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +785 -386
- package/node_modules/zod/v4/core/schemas.d.cts +123 -34
- package/node_modules/zod/v4/core/schemas.d.ts +123 -34
- package/node_modules/zod/v4/core/schemas.js +753 -386
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +269 -45
- package/node_modules/zod/v4/core/to-json-schema.d.cts +45 -5
- package/node_modules/zod/v4/core/to-json-schema.d.ts +45 -5
- package/node_modules/zod/v4/core/to-json-schema.js +247 -44
- package/node_modules/zod/v4/core/util.cjs +372 -157
- package/node_modules/zod/v4/core/util.d.cts +79 -1
- package/node_modules/zod/v4/core/util.d.ts +79 -1
- package/node_modules/zod/v4/core/util.js +341 -156
- package/node_modules/zod/v4/core/versions.cjs +21 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/core/visit.cjs +214 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +34 -5
- package/node_modules/zod/v4/index.d.cts +2 -2
- package/node_modules/zod/v4/index.d.ts +2 -2
- package/node_modules/zod/v4/index.js +3 -2
- package/node_modules/zod/v4/locales/ar.cjs +5 -0
- package/node_modules/zod/v4/locales/ar.js +5 -0
- package/node_modules/zod/v4/locales/az.cjs +5 -0
- package/node_modules/zod/v4/locales/az.js +5 -0
- package/node_modules/zod/v4/locales/be.cjs +12 -0
- package/node_modules/zod/v4/locales/be.js +12 -0
- package/node_modules/zod/v4/locales/bg.cjs +5 -0
- package/node_modules/zod/v4/locales/bg.js +5 -0
- package/node_modules/zod/v4/locales/bn.cjs +140 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +113 -0
- package/node_modules/zod/v4/locales/ca.cjs +5 -0
- package/node_modules/zod/v4/locales/ca.js +5 -0
- package/node_modules/zod/v4/locales/ckb.cjs +160 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +133 -0
- package/node_modules/zod/v4/locales/cs.cjs +5 -0
- package/node_modules/zod/v4/locales/cs.js +5 -0
- package/node_modules/zod/v4/locales/da.cjs +7 -2
- package/node_modules/zod/v4/locales/da.js +7 -2
- package/node_modules/zod/v4/locales/de.cjs +5 -0
- package/node_modules/zod/v4/locales/de.js +5 -0
- package/node_modules/zod/v4/locales/el.cjs +3 -0
- package/node_modules/zod/v4/locales/el.js +3 -0
- package/node_modules/zod/v4/locales/en.cjs +16 -4
- package/node_modules/zod/v4/locales/en.js +16 -4
- package/node_modules/zod/v4/locales/eo.cjs +5 -0
- package/node_modules/zod/v4/locales/eo.js +5 -0
- package/node_modules/zod/v4/locales/es.cjs +4 -0
- package/node_modules/zod/v4/locales/es.js +4 -0
- package/node_modules/zod/v4/locales/fa.cjs +5 -0
- package/node_modules/zod/v4/locales/fa.js +5 -0
- package/node_modules/zod/v4/locales/fi.cjs +5 -0
- package/node_modules/zod/v4/locales/fi.js +5 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +5 -0
- package/node_modules/zod/v4/locales/fr-CA.js +5 -0
- package/node_modules/zod/v4/locales/fr.cjs +18 -14
- package/node_modules/zod/v4/locales/fr.js +18 -14
- package/node_modules/zod/v4/locales/gu.cjs +140 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +113 -0
- package/node_modules/zod/v4/locales/he.cjs +7 -0
- package/node_modules/zod/v4/locales/he.js +7 -0
- package/node_modules/zod/v4/locales/hi.cjs +138 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +111 -0
- package/node_modules/zod/v4/locales/hr.cjs +4 -0
- package/node_modules/zod/v4/locales/hr.js +4 -0
- package/node_modules/zod/v4/locales/hu.cjs +5 -0
- package/node_modules/zod/v4/locales/hu.js +5 -0
- package/node_modules/zod/v4/locales/hy.cjs +11 -0
- package/node_modules/zod/v4/locales/hy.js +11 -0
- package/node_modules/zod/v4/locales/id.cjs +5 -0
- package/node_modules/zod/v4/locales/id.js +5 -0
- package/node_modules/zod/v4/locales/index.cjs +43 -2
- package/node_modules/zod/v4/locales/index.d.cts +11 -0
- package/node_modules/zod/v4/locales/index.d.ts +11 -0
- package/node_modules/zod/v4/locales/index.js +11 -0
- package/node_modules/zod/v4/locales/is.cjs +5 -0
- package/node_modules/zod/v4/locales/is.js +5 -0
- package/node_modules/zod/v4/locales/it.cjs +5 -0
- package/node_modules/zod/v4/locales/it.js +5 -0
- package/node_modules/zod/v4/locales/ja.cjs +5 -0
- package/node_modules/zod/v4/locales/ja.js +5 -0
- package/node_modules/zod/v4/locales/ka.cjs +5 -0
- package/node_modules/zod/v4/locales/ka.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +5 -0
- package/node_modules/zod/v4/locales/km.js +5 -0
- package/node_modules/zod/v4/locales/kn.cjs +143 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +116 -0
- package/node_modules/zod/v4/locales/ko.cjs +5 -0
- package/node_modules/zod/v4/locales/ko.js +5 -0
- package/node_modules/zod/v4/locales/lt.cjs +4 -0
- package/node_modules/zod/v4/locales/lt.js +4 -0
- package/node_modules/zod/v4/locales/mk.cjs +5 -0
- package/node_modules/zod/v4/locales/mk.js +5 -0
- package/node_modules/zod/v4/locales/ms.cjs +5 -0
- package/node_modules/zod/v4/locales/ms.js +5 -0
- package/node_modules/zod/v4/locales/ne.cjs +138 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +111 -0
- package/node_modules/zod/v4/locales/nl.cjs +5 -0
- package/node_modules/zod/v4/locales/nl.js +5 -0
- package/node_modules/zod/v4/locales/nn.cjs +140 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +113 -0
- package/node_modules/zod/v4/locales/no.cjs +7 -2
- package/node_modules/zod/v4/locales/no.js +7 -2
- package/node_modules/zod/v4/locales/ota.cjs +5 -0
- package/node_modules/zod/v4/locales/ota.js +5 -0
- package/node_modules/zod/v4/locales/pl.cjs +5 -0
- package/node_modules/zod/v4/locales/pl.js +5 -0
- package/node_modules/zod/v4/locales/ps.cjs +5 -0
- package/node_modules/zod/v4/locales/ps.js +5 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +143 -0
- package/node_modules/zod/v4/locales/pt.cjs +89 -55
- package/node_modules/zod/v4/locales/pt.js +89 -55
- package/node_modules/zod/v4/locales/ro.cjs +3 -0
- package/node_modules/zod/v4/locales/ro.js +3 -0
- package/node_modules/zod/v4/locales/ru.cjs +12 -0
- package/node_modules/zod/v4/locales/ru.js +12 -0
- package/node_modules/zod/v4/locales/sk.cjs +143 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +116 -0
- package/node_modules/zod/v4/locales/sl.cjs +5 -0
- package/node_modules/zod/v4/locales/sl.js +5 -0
- package/node_modules/zod/v4/locales/sv.cjs +7 -2
- package/node_modules/zod/v4/locales/sv.js +7 -2
- package/node_modules/zod/v4/locales/ta.cjs +5 -0
- package/node_modules/zod/v4/locales/ta.js +5 -0
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +5 -0
- package/node_modules/zod/v4/locales/th.js +5 -0
- package/node_modules/zod/v4/locales/tk.cjs +134 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +107 -0
- package/node_modules/zod/v4/locales/tr.cjs +5 -0
- package/node_modules/zod/v4/locales/tr.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +5 -0
- package/node_modules/zod/v4/locales/uk.js +5 -0
- package/node_modules/zod/v4/locales/ur.cjs +5 -0
- package/node_modules/zod/v4/locales/ur.js +5 -0
- package/node_modules/zod/v4/locales/uz.cjs +3 -0
- package/node_modules/zod/v4/locales/uz.js +3 -0
- package/node_modules/zod/v4/locales/vi.cjs +5 -0
- package/node_modules/zod/v4/locales/vi.js +5 -0
- package/node_modules/zod/v4/locales/yo.cjs +5 -0
- package/node_modules/zod/v4/locales/yo.js +5 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +5 -0
- package/node_modules/zod/v4/locales/zh-CN.js +5 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +5 -0
- package/node_modules/zod/v4/locales/zh-TW.js +5 -0
- package/node_modules/zod/v4/mini/checks.cjs +21 -1
- package/node_modules/zod/v4/mini/checks.d.cts +1 -1
- package/node_modules/zod/v4/mini/checks.d.ts +1 -1
- package/node_modules/zod/v4/mini/checks.js +1 -1
- package/node_modules/zod/v4/mini/coerce.cjs +19 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +33 -1
- package/node_modules/zod/v4/mini/external.d.cts +5 -2
- package/node_modules/zod/v4/mini/external.d.ts +5 -2
- package/node_modules/zod/v4/mini/external.js +3 -1
- package/node_modules/zod/v4/mini/in-out.cjs +82 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -0
- package/node_modules/zod/v4/mini/index.cjs +19 -0
- package/node_modules/zod/v4/mini/iso.cjs +19 -0
- package/node_modules/zod/v4/mini/parse.cjs +22 -1
- package/node_modules/zod/v4/mini/parse.d.cts +1 -1
- package/node_modules/zod/v4/mini/parse.d.ts +1 -1
- package/node_modules/zod/v4/mini/parse.js +1 -1
- package/node_modules/zod/v4/mini/schemas.cjs +117 -53
- package/node_modules/zod/v4/mini/schemas.d.cts +49 -14
- package/node_modules/zod/v4/mini/schemas.d.ts +49 -14
- package/node_modules/zod/v4/mini/schemas.js +92 -51
- package/node_modules/zod/v4-mini/index.cjs +19 -0
- package/package.json +172 -11
- package/dist/acp/index.js +0 -62
- package/dist/extensions/tool-gradle.js +0 -1
- package/dist/extensions/usage.js +0 -1
- package/node_modules/jose/dist/webapi/lib/base64.js +0 -22
- package/node_modules/jose/dist/webapi/lib/crypto_key.js +0 -28
- package/node_modules/jose/dist/webapi/lib/helpers.js +0 -42
- package/node_modules/jose/dist/webapi/lib/invalid_key_input.js +0 -26
- package/node_modules/jose/dist/webapi/lib/is_key_like.js +0 -17
- package/node_modules/jose/dist/webapi/lib/jwk_to_key.js +0 -17
- package/node_modules/jose/dist/webapi/lib/options.js +0 -48
- package/node_modules/jose/dist/webapi/lib/signing.js +0 -26
- package/node_modules/jose/dist/webapi/lib/type_checks.js +0 -35
- package/node_modules/pi-subagents/src/runs/foreground/chain-clarify.ts +0 -1354
- package/node_modules/pi-subagents/src/runs/foreground/chain-execution.ts +0 -1530
- package/node_modules/pi-subagents/src/runs/shared/turn-budget.ts +0 -98
- package/node_modules/zod/src/v4/core/config.ts +0 -15
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/LICENSE +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/README.md +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/bin.mjs +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/compose-collection.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/compose-doc.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/compose-node.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/compose-scalar.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/composer.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/resolve-block-map.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/resolve-block-scalar.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/resolve-block-seq.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/resolve-end.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/resolve-flow-collection.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/resolve-flow-scalar.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/resolve-props.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/util-contains-newline.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/util-empty-scalar-position.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/util-flow-indent-check.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/compose/util-map-includes.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/doc/Document.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/doc/anchors.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/doc/applyReviver.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/doc/createNode.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/doc/directives.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/errors.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/index.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/log.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/nodes/Alias.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/nodes/Collection.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/nodes/Node.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/nodes/Pair.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/nodes/Scalar.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/nodes/YAMLMap.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/nodes/YAMLSeq.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/nodes/addPairToJSMap.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/nodes/identity.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/nodes/toJS.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/parse/cst-scalar.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/parse/cst-stringify.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/parse/cst-visit.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/parse/cst.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/parse/lexer.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/parse/line-counter.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/parse/parser.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/public-api.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/Schema.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/common/map.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/common/null.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/common/seq.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/common/string.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/core/bool.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/core/float.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/core/int.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/core/schema.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/json/schema.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/tags.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/yaml-1.1/binary.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/yaml-1.1/bool.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/yaml-1.1/float.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/yaml-1.1/int.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/yaml-1.1/merge.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/yaml-1.1/omap.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/yaml-1.1/pairs.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/yaml-1.1/schema.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/yaml-1.1/set.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/schema/yaml-1.1/timestamp.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/stringify/foldFlowLines.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/stringify/stringify.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/stringify/stringifyCollection.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/stringify/stringifyComment.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/stringify/stringifyDocument.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/stringify/stringifyNumber.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/stringify/stringifyPair.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/stringify/stringifyString.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/util.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/dist/visit.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/index.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/browser/package.json +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/cli.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/cli.mjs +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/compose-collection.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/compose-collection.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/compose-doc.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/compose-doc.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/compose-node.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/compose-node.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/compose-scalar.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/compose-scalar.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/composer.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/composer.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-block-map.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-block-map.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-block-scalar.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-block-scalar.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-block-seq.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-block-seq.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-end.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-end.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-flow-collection.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-flow-collection.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-flow-scalar.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-flow-scalar.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-props.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/resolve-props.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/util-contains-newline.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/util-contains-newline.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/util-empty-scalar-position.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/util-empty-scalar-position.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/util-flow-indent-check.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/util-flow-indent-check.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/util-map-includes.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/compose/util-map-includes.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/doc/Document.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/doc/Document.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/doc/anchors.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/doc/anchors.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/doc/applyReviver.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/doc/applyReviver.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/doc/createNode.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/doc/createNode.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/doc/directives.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/doc/directives.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/errors.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/errors.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/index.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/index.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/log.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/log.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/Alias.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/Alias.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/Collection.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/Collection.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/Node.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/Node.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/Pair.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/Pair.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/Scalar.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/Scalar.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/YAMLMap.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/YAMLMap.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/YAMLSeq.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/YAMLSeq.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/addPairToJSMap.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/addPairToJSMap.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/identity.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/identity.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/toJS.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/nodes/toJS.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/options.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/cst-scalar.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/cst-scalar.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/cst-stringify.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/cst-stringify.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/cst-visit.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/cst-visit.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/cst.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/cst.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/lexer.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/lexer.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/line-counter.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/line-counter.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/parser.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/parse/parser.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/public-api.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/public-api.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/Schema.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/Schema.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/common/map.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/common/map.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/common/null.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/common/null.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/common/seq.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/common/seq.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/common/string.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/common/string.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/core/bool.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/core/bool.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/core/float.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/core/float.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/core/int.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/core/int.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/core/schema.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/core/schema.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/json/schema.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/json/schema.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/json-schema.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/tags.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/tags.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/types.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/binary.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/binary.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/bool.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/bool.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/float.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/float.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/int.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/int.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/merge.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/merge.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/omap.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/omap.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/pairs.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/pairs.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/schema.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/schema.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/set.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/set.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/timestamp.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/schema/yaml-1.1/timestamp.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/foldFlowLines.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/foldFlowLines.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringify.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringify.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringifyCollection.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringifyCollection.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringifyComment.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringifyComment.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringifyDocument.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringifyDocument.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringifyNumber.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringifyNumber.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringifyPair.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringifyPair.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringifyString.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/stringify/stringifyString.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/test-events.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/test-events.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/util.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/util.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/visit.d.ts +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/dist/visit.js +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/package.json +0 -0
- /package/node_modules/{yaml → pi-subagents/node_modules/yaml}/util.js +0 -0
|
@@ -5,45 +5,57 @@
|
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
import * as fs from "node:fs";
|
|
8
|
-
import * as os from "node:os";
|
|
9
8
|
import * as path from "node:path";
|
|
10
9
|
import { fileURLToPath } from "node:url";
|
|
11
10
|
import { createRequire } from "node:module";
|
|
12
11
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
13
|
-
import type
|
|
12
|
+
import { discoverAgents, formatUnknownAgentError, unknownAgentDiagnosticContext, type AgentConfig, type UnknownAgentDiagnosticContext } from "../../agents/agents.ts";
|
|
14
13
|
import { appendAgentRefinementOverlay } from "../../agents/agent-refinements.ts";
|
|
15
|
-
import { writePrivateAtomicJson } from "../../shared/atomic-json.ts";
|
|
14
|
+
import { createAtomicJsonWriter, writePrivateAtomicJson } from "../../shared/atomic-json.ts";
|
|
15
|
+
import { currentCompletionOwnerId } from "../../shared/completion-owner.ts";
|
|
16
|
+
import { planChildLaunch, resolveStepBehavior, suppressProgressForReadOnlyTask, type ResolvedStepBehavior } from "../shared/child-launch-plan.ts";
|
|
16
17
|
import { applyThinkingSuffix, projectLaunchResolvedChildExtensions, resolvePiLaunchToolPlan } from "../shared/pi-args.ts";
|
|
17
18
|
import { injectOutputPathSystemPrompt, injectSingleOutputInstruction, normalizeSingleOutputOverride, resolveSingleOutputPath, validateFileOnlyOutputMode } from "../shared/single-output.ts";
|
|
18
|
-
import { buildChainInstructions,
|
|
19
|
+
import { buildChainInstructions, isDynamicParallelStep, isParallelStep, resolveExistingReadPaths, writeInitialProgressFile, type ChainStep, type SequentialStep, type StepOverrides } from "../../shared/settings.ts";
|
|
19
20
|
import type { RunnerStep } from "../shared/parallel-utils.ts";
|
|
20
21
|
import type { ContextMode } from "../shared/context-mode.ts";
|
|
21
|
-
import { resolvePiPackageRoot } from "../shared/pi-spawn.ts";
|
|
22
|
+
import { resolveInstalledPiPackageRoot, resolvePiPackageRoot } from "../shared/pi-spawn.ts";
|
|
23
|
+
import { preflightLaunchCwd } from "../shared/launch-cwd.ts";
|
|
24
|
+
import { resolveNodeExecutable } from "../../shared/node-executable.ts";
|
|
25
|
+
import { backgroundProcessOptions } from "../shared/background-process-options.ts";
|
|
22
26
|
import { buildSkillInjection, normalizeSkillInput, resolveSkillsWithFallback } from "../../agents/skills.ts";
|
|
23
27
|
import { buildAgentMemoryInjection } from "../../agents/agent-memory.ts";
|
|
24
|
-
import { PI_CODING_AGENT_PACKAGE_ROOT_ENV, resolveChildCwd } from "../../shared/utils.ts";
|
|
25
|
-
import { buildModelCandidates, resolveEffectiveSubagentModel,
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
+
import { PI_CODING_AGENT_PACKAGE_ROOT_ENV, PROMPT_REDACTED, resolveChildCwd } from "../../shared/utils.ts";
|
|
29
|
+
import { buildModelCandidates, resolveEffectiveSubagentModel, resolveModelOrigin, resolveSubagentModelOverride, type AvailableModelInfo, type ModelOrigin, type ParentModel } from "../shared/model-fallback.ts";
|
|
30
|
+
import { resolveToolTimeoutMs, toolTimeoutFromEnv } from "../shared/tool-timeout.ts";
|
|
31
|
+
import { resolveModelScopesForAgent, type ModelScopeConfig } from "../shared/model-scope.ts";
|
|
32
|
+
import { findModelInfo, resolveEffectiveThinking } from "../../shared/model-info.ts";
|
|
33
|
+
import { assertThinkingWithinCeiling, decodeThinkingCeiling, intersectThinkingCeilings, SUBAGENT_THINKING_CEILING_ENV, type ThinkingLevel } from "../../shared/thinking-ceiling.ts";
|
|
28
34
|
import { resolveExpectedWorktreeAgentCwd } from "../shared/worktree.ts";
|
|
29
35
|
import { buildWorkflowGraphSnapshot } from "../shared/workflow-graph.ts";
|
|
30
36
|
import { ChainOutputValidationError, validateChainOutputBindings } from "../shared/chain-outputs.ts";
|
|
31
37
|
import { createStructuredOutputRuntime } from "../shared/structured-output.ts";
|
|
32
|
-
import { resolveEffectiveAcceptance, validateAcceptanceInput, validateExecutionAcceptance } from "../shared/acceptance.ts";
|
|
38
|
+
import { resolveAcceptanceReportMode, resolveEffectiveAcceptance, validateAcceptanceInput, validateExecutionAcceptance } from "../shared/acceptance.ts";
|
|
39
|
+
import { createRunFanoutBudget, writeRunFanoutBudgetDescriptor } from "../shared/run-fanout-budget.ts";
|
|
40
|
+
import { validateImplementationToolContract } from "../shared/completion-guard.ts";
|
|
33
41
|
import {
|
|
34
42
|
type AcceptanceInput,
|
|
35
43
|
type AgentContract,
|
|
44
|
+
type AsyncParallelGroupStatus,
|
|
45
|
+
type AsyncStatus,
|
|
36
46
|
type ArtifactConfig,
|
|
37
47
|
type Details,
|
|
48
|
+
type IntercomBridgeConfig,
|
|
38
49
|
type JsonSchemaObject,
|
|
39
50
|
type MaxOutputConfig,
|
|
40
51
|
type NestedRouteInfo,
|
|
41
52
|
type ResolvedControlConfig,
|
|
42
|
-
type ResolvedTurnBudget,
|
|
43
53
|
type ResolvedToolBudget,
|
|
54
|
+
type RunFanoutBudgetDescriptor,
|
|
44
55
|
type ToolBudgetConfig,
|
|
45
56
|
type SubagentRunMode,
|
|
46
57
|
type SteeringRecoveryDescriptor,
|
|
58
|
+
type WorkflowLaneMetadata,
|
|
47
59
|
type UsageBudgetConfig,
|
|
48
60
|
DIRS,
|
|
49
61
|
SUBAGENT_ASYNC_STARTED_EVENT,
|
|
@@ -53,19 +65,23 @@ import {
|
|
|
53
65
|
resolveChildMaxSubagentDepth,
|
|
54
66
|
} from "../../shared/types.ts";
|
|
55
67
|
import { nestedResultsPath, nestedSummaryFromAsyncStatus, resolveInheritedNestedRouteFromEnv, resolveNestedParentAddressFromEnv, writeNestedEvent } from "../shared/nested-events.ts";
|
|
56
|
-
import {
|
|
68
|
+
import { resultFilePath } from "./result-files.ts";
|
|
57
69
|
import { validateToolBudgetConfig } from "../shared/tool-budget.ts";
|
|
58
70
|
import { usageBudgetState } from "../shared/usage-budget.ts";
|
|
59
71
|
import type { ImportedAsyncRoot } from "./chain-root-attachment.ts";
|
|
60
72
|
import type { SessionLeaseRequest } from "../shared/session-lease.ts";
|
|
61
|
-
import { finalizeProcessTerminal, readProcessTerminal } from "./process-terminal.ts";
|
|
73
|
+
import { finalizeProcessTerminal, initializeProcessTerminal, readProcessTerminal } from "./process-terminal.ts";
|
|
74
|
+
import type { ActiveAsyncCapacityHandle } from "./active-async-capacity.ts";
|
|
75
|
+
import { statusStepDescription } from "./chain-append.ts";
|
|
62
76
|
import { SUBAGENT_PROCESS_TERMINAL_EVENT } from "../../shared/types.ts";
|
|
63
77
|
import { assertAgentAllowedByCapabilityCeiling, decodeSubagentCapabilityCeiling, intersectSubagentCapabilityCeilings, resolveCurrentSubagentCapabilityCeiling, SUBAGENT_CAPABILITY_CEILING_ENV, type ResolvedSubagentCapabilityCeiling } from "../shared/capability-ceiling.ts";
|
|
64
78
|
import { agentDefinitionDigest, launchBindingDigest } from "../../shared/launch-contract.ts";
|
|
65
79
|
import { resolvePermissionRules, type PermissionConfig } from "../shared/permissions.ts";
|
|
80
|
+
import { normalizeExtensionBindings, omitExtensionBindingsEnv, type ExtensionBindings } from "../shared/extension-bindings.ts";
|
|
81
|
+
import { assertWorkflowLaneKey, normalizeWorkflowLaneMetadata } from "../shared/lane-metadata.ts";
|
|
66
82
|
|
|
67
83
|
const require = createRequire(import.meta.url);
|
|
68
|
-
const piPackageRoot = resolvePiPackageRoot();
|
|
84
|
+
const piPackageRoot = resolvePiPackageRoot() ?? resolveInstalledPiPackageRoot();
|
|
69
85
|
|
|
70
86
|
function resolveJitiCliFromPackageJson(packageJsonPath: string): string | undefined {
|
|
71
87
|
if (!fs.existsSync(packageJsonPath)) return undefined;
|
|
@@ -117,6 +133,7 @@ interface AsyncExecutionContext {
|
|
|
117
133
|
pi: ExtensionAPI;
|
|
118
134
|
cwd: string;
|
|
119
135
|
currentSessionId: string;
|
|
136
|
+
completionOwnerId?: string;
|
|
120
137
|
/** Parent session id used by permission-system ask forwarding. */
|
|
121
138
|
parentSessionId?: string;
|
|
122
139
|
permissions?: PermissionConfig;
|
|
@@ -136,8 +153,10 @@ interface AsyncChainParams {
|
|
|
136
153
|
/** Raw caller-facing goal used only by the started event. */
|
|
137
154
|
goal?: string;
|
|
138
155
|
attachRoot?: ImportedAsyncRoot & { agent: string; outputName?: string; label?: string };
|
|
139
|
-
resultMode?:
|
|
156
|
+
resultMode?: SubagentRunMode;
|
|
140
157
|
agents: AgentConfig[];
|
|
158
|
+
/** Original discovery provenance, retained by normal callers for unknown-agent diagnostics. */
|
|
159
|
+
unknownAgentDiagnosticContext?: UnknownAgentDiagnosticContext;
|
|
141
160
|
ctx: AsyncExecutionContext;
|
|
142
161
|
availableModels?: AvailableModelInfo[];
|
|
143
162
|
cwd?: string;
|
|
@@ -155,6 +174,7 @@ interface AsyncChainParams {
|
|
|
155
174
|
dynamicFanoutMaxItems?: number;
|
|
156
175
|
maxSubagentDepth: number;
|
|
157
176
|
waitToolEnabled?: boolean;
|
|
177
|
+
waitToolDefaultTimeoutMs?: number;
|
|
158
178
|
worktreeSetupHook?: string;
|
|
159
179
|
worktreeSetupHookTimeoutMs?: number;
|
|
160
180
|
worktreeBaseDir?: string;
|
|
@@ -163,16 +183,26 @@ interface AsyncChainParams {
|
|
|
163
183
|
childIntercomTarget?: (agent: string, index: number) => string | undefined;
|
|
164
184
|
nestedRoute?: NestedRouteInfo;
|
|
165
185
|
acceptance?: AcceptanceInput;
|
|
186
|
+
fast?: boolean;
|
|
166
187
|
timeoutMs?: number;
|
|
167
|
-
turnBudget?: ResolvedTurnBudget;
|
|
168
188
|
toolBudget?: ResolvedToolBudget;
|
|
169
189
|
usageBudget?: UsageBudgetConfig;
|
|
170
190
|
configToolBudget?: ResolvedToolBudget;
|
|
191
|
+
/** Optional per-call hard toolTimeoutMs override (highest precedence). */
|
|
192
|
+
callToolTimeoutMs?: number;
|
|
193
|
+
/** Global config.toolTimeoutMs (third precedence, after agent frontmatter). */
|
|
194
|
+
configToolTimeoutMs?: number;
|
|
195
|
+
/** PI_SUBAGENT_TOOL_TIMEOUT_MS override (lowest precedence). */
|
|
196
|
+
toolTimeoutMsEnv?: string | undefined;
|
|
171
197
|
/** Global cap on simultaneously-running subagent tasks within the async run. */
|
|
172
198
|
globalConcurrencyLimit?: number;
|
|
173
199
|
capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
|
|
200
|
+
thinkingCeiling?: ThinkingLevel;
|
|
201
|
+
runFanoutBudget?: RunFanoutBudgetDescriptor;
|
|
174
202
|
parentWorkflowRunId?: string;
|
|
175
203
|
workflowKey?: string;
|
|
204
|
+
lane?: WorkflowLaneMetadata;
|
|
205
|
+
activeAsyncCapacity?: ActiveAsyncCapacityHandle;
|
|
176
206
|
}
|
|
177
207
|
|
|
178
208
|
interface AsyncSingleParams {
|
|
@@ -181,8 +211,11 @@ interface AsyncSingleParams {
|
|
|
181
211
|
/** Raw caller-facing goal used only by the started event. */
|
|
182
212
|
goal?: string;
|
|
183
213
|
agentConfig: AgentConfig;
|
|
214
|
+
/** Agent contract before per-run bridge injection, used only for recovery persistence. */
|
|
215
|
+
recoveryAgentConfig?: AgentConfig;
|
|
184
216
|
ctx: AsyncExecutionContext;
|
|
185
217
|
cwd?: string;
|
|
218
|
+
requestedCwd?: string;
|
|
186
219
|
maxOutput?: MaxOutputConfig;
|
|
187
220
|
artifactsDir?: string;
|
|
188
221
|
artifactConfig: ArtifactConfig;
|
|
@@ -197,31 +230,56 @@ interface AsyncSingleParams {
|
|
|
197
230
|
reads?: string[] | false;
|
|
198
231
|
outputMode?: "inline" | "file-only";
|
|
199
232
|
outputBaseDir?: string;
|
|
233
|
+
outputClaimPath?: string;
|
|
200
234
|
agentContract?: AgentContract;
|
|
201
235
|
structuredOutputSchema?: JsonSchemaObject;
|
|
202
236
|
modelOverride?: string;
|
|
237
|
+
modelOverrideFromParent?: boolean;
|
|
238
|
+
modelOrigin?: ModelOrigin;
|
|
239
|
+
fast?: boolean;
|
|
203
240
|
thinkingOverride?: AgentConfig["thinking"];
|
|
204
241
|
availableModels?: AvailableModelInfo[];
|
|
205
242
|
maxSubagentDepth: number;
|
|
206
243
|
waitToolEnabled?: boolean;
|
|
244
|
+
waitToolDefaultTimeoutMs?: number;
|
|
207
245
|
worktreeSetupHook?: string;
|
|
208
246
|
worktreeSetupHookTimeoutMs?: number;
|
|
209
247
|
worktreeBaseDir?: string;
|
|
248
|
+
worktree?: boolean;
|
|
210
249
|
controlConfig?: ResolvedControlConfig;
|
|
250
|
+
intercomBridge?: IntercomBridgeConfig;
|
|
211
251
|
controlIntercomTarget?: string;
|
|
212
252
|
childIntercomTarget?: (agent: string, index: number) => string | undefined;
|
|
213
253
|
nestedRoute?: NestedRouteInfo;
|
|
214
254
|
acceptance?: AcceptanceInput;
|
|
215
255
|
timeoutMs?: number;
|
|
216
256
|
absoluteDeadlineAt?: number;
|
|
217
|
-
|
|
257
|
+
/** Optional per-call hard toolTimeoutMs override (highest precedence). */
|
|
258
|
+
toolTimeoutMs?: number;
|
|
218
259
|
toolBudget?: ResolvedToolBudget | ToolBudgetConfig;
|
|
219
260
|
usageBudget?: UsageBudgetConfig;
|
|
220
261
|
configToolBudget?: ResolvedToolBudget;
|
|
262
|
+
/** Global config.toolTimeoutMs (third precedence, after agent frontmatter). */
|
|
263
|
+
configToolTimeoutMs?: number;
|
|
264
|
+
/** PI_SUBAGENT_TOOL_TIMEOUT_MS override (lowest precedence). */
|
|
265
|
+
toolTimeoutMsEnv?: string | undefined;
|
|
221
266
|
allowZeroToolBudget?: boolean;
|
|
222
267
|
capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
|
|
268
|
+
thinkingCeiling?: ThinkingLevel;
|
|
269
|
+
runFanoutBudget?: RunFanoutBudgetDescriptor;
|
|
223
270
|
parentWorkflowRunId?: string;
|
|
224
271
|
workflowKey?: string;
|
|
272
|
+
lane?: WorkflowLaneMetadata;
|
|
273
|
+
workflowAwaitAsync?: boolean;
|
|
274
|
+
activeAsyncCapacity?: ActiveAsyncCapacityHandle;
|
|
275
|
+
externalJobFollowUp?: {
|
|
276
|
+
sourceRunId: string;
|
|
277
|
+
sourceStepIndex: number;
|
|
278
|
+
parentProviderJobId: string;
|
|
279
|
+
requestId: string;
|
|
280
|
+
requestDigest: string;
|
|
281
|
+
};
|
|
282
|
+
extensionBindings?: ExtensionBindings;
|
|
225
283
|
}
|
|
226
284
|
|
|
227
285
|
interface AsyncExecutionResult {
|
|
@@ -236,6 +294,8 @@ export interface AsyncRunnerStepBuildParams {
|
|
|
236
294
|
attachRoot?: ImportedAsyncRoot & { agent: string; outputName?: string; label?: string };
|
|
237
295
|
resultMode?: SubagentRunMode;
|
|
238
296
|
agents: AgentConfig[];
|
|
297
|
+
/** Exact discovery provenance for failed resolution; omission triggers defensive fallback discovery. */
|
|
298
|
+
unknownAgentDiagnosticContext?: UnknownAgentDiagnosticContext;
|
|
239
299
|
ctx: AsyncExecutionContext;
|
|
240
300
|
availableModels?: AvailableModelInfo[];
|
|
241
301
|
cwd?: string;
|
|
@@ -248,13 +308,22 @@ export interface AsyncRunnerStepBuildParams {
|
|
|
248
308
|
dynamicFanoutMaxItems?: number;
|
|
249
309
|
maxSubagentDepth: number;
|
|
250
310
|
waitToolEnabled?: boolean;
|
|
311
|
+
waitToolDefaultTimeoutMs?: number;
|
|
251
312
|
worktreeBaseDir?: string;
|
|
252
313
|
asyncDir: string;
|
|
253
314
|
outputBaseDir?: string;
|
|
254
315
|
validateOutputBindings?: boolean;
|
|
316
|
+
fast?: boolean;
|
|
255
317
|
toolBudget?: ResolvedToolBudget;
|
|
256
318
|
configToolBudget?: ResolvedToolBudget;
|
|
319
|
+
/** Optional per-call hard toolTimeoutMs override from the subagent invocation. */
|
|
320
|
+
callToolTimeoutMs?: number;
|
|
321
|
+
/** Global config.toolTimeoutMs (third precedence, after agent frontmatter). */
|
|
322
|
+
configToolTimeoutMs?: number;
|
|
323
|
+
/** PI_SUBAGENT_TOOL_TIMEOUT_MS override (lowest precedence). */
|
|
324
|
+
toolTimeoutMsEnv?: string | undefined;
|
|
257
325
|
capabilityCeiling?: ResolvedSubagentCapabilityCeiling;
|
|
326
|
+
thinkingCeiling?: ThinkingLevel;
|
|
258
327
|
}
|
|
259
328
|
|
|
260
329
|
export type AsyncRunnerStepBuildResult =
|
|
@@ -271,15 +340,15 @@ export function formatAsyncStartedMessage(headline: string, interactive: boolean
|
|
|
271
340
|
const guidance = interactive
|
|
272
341
|
? [
|
|
273
342
|
"The async run is detached and running in the background.",
|
|
274
|
-
"You are in an interactive session.
|
|
275
|
-
"
|
|
276
|
-
"
|
|
343
|
+
"You are in an interactive session. Return control to the user now; Pi will wake you through the native completion notification when this subagent completes or needs attention. Do not run sleep/polling loops to wait for this async subagent; it does not need a wait call.",
|
|
344
|
+
"Use bg_wait only for provider, detached, or other background work that lacks a native completion notification.",
|
|
345
|
+
"If the current turn must receive results from work without a native notification before it ends, call blocking bg_wait(); ordinary async subagent runs do not need a wait call because their completion is delivered natively.",
|
|
277
346
|
"Otherwise, continue any independent work or return control to the user. Use subagent({ action: \"status\", id: \"...\" }) for a one-shot status/result or to inspect a blocked/stale run, never as a wait loop.",
|
|
278
347
|
]
|
|
279
348
|
: [
|
|
280
349
|
"The async run is detached. Do not run sleep timers or polling loops just to wait for it.",
|
|
281
|
-
"This is a non-interactive run: Pi auto-drains current-session
|
|
282
|
-
"Use subagent({ action: \"status\", id: \"...\" }) when you need a one-shot status/result or to inspect a blocked/stale run
|
|
350
|
+
"This is a non-interactive run: Pi auto-drains current-session subagent work at agent_end so detached children are not abandoned. Use bg_wait only when this turn must receive provider, detached, or other background-work results that have no native completion notification.",
|
|
351
|
+
"Use subagent({ action: \"status\", id: \"...\" }) when you need a one-shot status/result or to inspect a blocked/stale run; do not poll in a loop.",
|
|
283
352
|
];
|
|
284
353
|
return [headline, "", ...guidance].join("\n");
|
|
285
354
|
}
|
|
@@ -291,27 +360,6 @@ export function isAsyncAvailable(): boolean {
|
|
|
291
360
|
return jitiCliPath !== undefined;
|
|
292
361
|
}
|
|
293
362
|
|
|
294
|
-
function isNodeExecutableName(execPath: string): boolean {
|
|
295
|
-
const basename = path.basename(execPath).toLowerCase();
|
|
296
|
-
return basename === "node" || basename === "node.exe" || basename === "nodejs" || basename === "nodejs.exe";
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
function canUseCurrentNodeExecutable(execPath: string): boolean {
|
|
300
|
-
try {
|
|
301
|
-
fs.accessSync(execPath, process.platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
|
|
302
|
-
return true;
|
|
303
|
-
} catch {
|
|
304
|
-
return false;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
function resolveAsyncRunnerNodeCommand(): string {
|
|
309
|
-
if (isNodeExecutableName(process.execPath) && canUseCurrentNodeExecutable(process.execPath)) {
|
|
310
|
-
return process.execPath;
|
|
311
|
-
}
|
|
312
|
-
return process.platform === "win32" ? "node.exe" : "node";
|
|
313
|
-
}
|
|
314
|
-
|
|
315
363
|
export function resolveAsyncRunnerLogPaths(cfg: object): { stdoutPath: string; stderrPath: string } | undefined {
|
|
316
364
|
const asyncDir = typeof (cfg as { asyncDir?: unknown }).asyncDir === "string"
|
|
317
365
|
? (cfg as { asyncDir: string }).asyncDir
|
|
@@ -343,7 +391,7 @@ type RunnerStartupState = "ready" | "acknowledged";
|
|
|
343
391
|
|
|
344
392
|
type RunnerStartupWaitResult =
|
|
345
393
|
| { ok: true; token: string }
|
|
346
|
-
| { ok: false; error: string };
|
|
394
|
+
| { ok: false; error: string; startupDidNotProceed?: boolean };
|
|
347
395
|
|
|
348
396
|
function waitForStartupInterval(delayMs = 20): void {
|
|
349
397
|
if (RUNNER_STARTUP_WAIT_VIEW) {
|
|
@@ -360,14 +408,14 @@ function readRunnerStartup(startupPath: string, expectedState: RunnerStartupStat
|
|
|
360
408
|
if (!fs.existsSync(startupPath)) return undefined;
|
|
361
409
|
try {
|
|
362
410
|
const payload = JSON.parse(fs.readFileSync(startupPath, "utf-8")) as { state?: unknown; token?: unknown; error?: unknown };
|
|
363
|
-
if (payload.state === "error" && typeof payload.error === "string") return { ok: false, error: payload.error };
|
|
411
|
+
if (payload.state === "error" && typeof payload.error === "string") return { ok: false, error: payload.error, startupDidNotProceed: true };
|
|
364
412
|
if (payload.state !== expectedState) return undefined;
|
|
365
413
|
if (typeof payload.token !== "string" || (expectedToken !== undefined && payload.token !== expectedToken)) {
|
|
366
|
-
return { ok: false, error: `Async runner wrote an invalid ${expectedState} startup handshake: ${startupPath}
|
|
414
|
+
return { ok: false, error: `Async runner wrote an invalid ${expectedState} startup handshake: ${startupPath}`, startupDidNotProceed: true };
|
|
367
415
|
}
|
|
368
416
|
return { ok: true, token: payload.token };
|
|
369
417
|
} catch (error) {
|
|
370
|
-
return { ok: false, error: `Failed to read async runner startup handshake '${startupPath}': ${error instanceof Error ? error.message : String(error)}
|
|
418
|
+
return { ok: false, error: `Failed to read async runner startup handshake '${startupPath}': ${error instanceof Error ? error.message : String(error)}`, startupDidNotProceed: true };
|
|
371
419
|
}
|
|
372
420
|
}
|
|
373
421
|
|
|
@@ -381,16 +429,18 @@ function waitForRunnerStartup(startupPath: string, expectedState: RunnerStartupS
|
|
|
381
429
|
}
|
|
382
430
|
const finalResult = readRunnerStartup(startupPath, expectedState, expectedToken);
|
|
383
431
|
if (finalResult) return finalResult;
|
|
384
|
-
return { ok: false, error: `Timed out after ${timeoutMs}ms waiting for the async runner startup state '${expectedState}'
|
|
432
|
+
return { ok: false, error: `Timed out after ${timeoutMs}ms waiting for the async runner startup state '${expectedState}'.`, startupDidNotProceed: true };
|
|
385
433
|
}
|
|
386
434
|
|
|
435
|
+
const writePrivateStartupControlJson = createAtomicJsonWriter({ mode: 0o600, ignoreCleanupErrorAfterSuccess: true });
|
|
436
|
+
|
|
387
437
|
function writeRunnerStartupControl(filePath: string, payload: { action: "ack" | "proceed"; token: string }): void {
|
|
388
438
|
// Delegate to the shared atomic JSON writer (temp file + rename, retrying
|
|
389
439
|
// transient Windows EPERM/EBUSY/EACCES locks and cleaning up the temp file
|
|
390
440
|
// on failure), so the startup handshake gets the same locking resilience as
|
|
391
441
|
// every other async control/result file. This is exercised by
|
|
392
442
|
// test/unit/atomic-json.test.ts.
|
|
393
|
-
|
|
443
|
+
writePrivateStartupControlJson(filePath, payload);
|
|
394
444
|
}
|
|
395
445
|
|
|
396
446
|
function runnerIsAlive(pid: number): boolean {
|
|
@@ -402,47 +452,105 @@ function runnerIsAlive(pid: number): boolean {
|
|
|
402
452
|
}
|
|
403
453
|
}
|
|
404
454
|
|
|
405
|
-
function terminateRunnerBeforeProceed(pid: number):
|
|
455
|
+
function terminateRunnerBeforeProceed(pid: number): boolean {
|
|
406
456
|
for (const signal of ["SIGTERM", "SIGKILL"] as const) {
|
|
407
|
-
if (!runnerIsAlive(pid)) return;
|
|
457
|
+
if (!runnerIsAlive(pid)) return true;
|
|
408
458
|
try {
|
|
409
459
|
process.kill(pid, signal);
|
|
410
460
|
} catch {
|
|
411
|
-
if (!runnerIsAlive(pid)) return;
|
|
461
|
+
if (!runnerIsAlive(pid)) return true;
|
|
412
462
|
}
|
|
413
463
|
const deadline = Date.now() + 1000;
|
|
414
464
|
while (runnerIsAlive(pid) && Date.now() < deadline) waitForStartupInterval();
|
|
415
465
|
}
|
|
466
|
+
return !runnerIsAlive(pid);
|
|
416
467
|
}
|
|
417
468
|
|
|
418
|
-
function
|
|
419
|
-
|
|
420
|
-
|
|
469
|
+
function persistPreProceedStartupFailure(asyncDir: string, runId: string, runnerProcessInstanceId: string, sessionId: string | undefined, completionOwnerId: string | undefined, message: string): void {
|
|
470
|
+
const now = Date.now();
|
|
471
|
+
try {
|
|
472
|
+
const statusPath = path.join(asyncDir, "status.json");
|
|
473
|
+
let status: Partial<AsyncStatus> = {};
|
|
474
|
+
try {
|
|
475
|
+
status = JSON.parse(fs.readFileSync(statusPath, "utf-8")) as Partial<AsyncStatus>;
|
|
476
|
+
} catch {}
|
|
477
|
+
writePrivateAtomicJson(statusPath, {
|
|
478
|
+
...status,
|
|
479
|
+
runId,
|
|
480
|
+
...(sessionId ? { sessionId } : {}),
|
|
481
|
+
...(completionOwnerId ? { completionOwnerId } : {}),
|
|
482
|
+
state: "failed",
|
|
483
|
+
lastUpdate: now,
|
|
484
|
+
error: message,
|
|
485
|
+
processTerminal: {
|
|
486
|
+
version: 1,
|
|
487
|
+
state: "not-started",
|
|
488
|
+
runId,
|
|
489
|
+
runnerProcessInstanceId,
|
|
490
|
+
},
|
|
491
|
+
});
|
|
492
|
+
writePrivateAtomicJson(path.join(asyncDir, "process-terminal-candidate.json"), {
|
|
493
|
+
version: 1,
|
|
494
|
+
runId,
|
|
495
|
+
runnerProcessInstanceId,
|
|
496
|
+
writers: {},
|
|
497
|
+
expectedWriters: { 0: 0 },
|
|
498
|
+
});
|
|
499
|
+
} catch {
|
|
500
|
+
// Startup failures must still return the original launch error.
|
|
421
501
|
}
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
interface SpawnRunnerResult {
|
|
505
|
+
pid?: number;
|
|
506
|
+
runnerProcessInstanceId?: string;
|
|
507
|
+
error?: string;
|
|
508
|
+
terminationObserved?: boolean;
|
|
509
|
+
startupDidNotProceed?: boolean;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
function isStaleExtensionContextError(error: unknown): boolean {
|
|
513
|
+
return error instanceof Error && /extension ctx is stale|stale after session replacement or reload/i.test(error.message);
|
|
514
|
+
}
|
|
422
515
|
|
|
516
|
+
export function emitProcessTerminalEvent(ctx: AsyncExecutionContext, proof: unknown): void {
|
|
423
517
|
try {
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
}
|
|
429
|
-
|
|
518
|
+
ctx.pi.events.emit(SUBAGENT_PROCESS_TERMINAL_EVENT, proof);
|
|
519
|
+
} catch (error) {
|
|
520
|
+
if (isStaleExtensionContextError(error)) return;
|
|
521
|
+
console.error("Failed to emit subagent process-terminal event:", error);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
function spawnRunner(cfg: object, suffix: string, cwd: string, initialStatus: Omit<AsyncStatus, "pid" | "processTerminal">, initialStatusPath: string, onProcessTerminal?: (proof: unknown) => void, onBeforeProceed?: (runnerProcessInstanceId: string) => void, requestedCwd = cwd): SpawnRunnerResult {
|
|
526
|
+
const cwdError = preflightLaunchCwd(requestedCwd, cwd);
|
|
527
|
+
if (cwdError) return { error: cwdError };
|
|
528
|
+
|
|
529
|
+
if (!jitiCliPath) {
|
|
530
|
+
return { error: "upstream jiti for TypeScript execution could not be found; ensure package dependencies are installed" };
|
|
430
531
|
}
|
|
431
532
|
|
|
432
533
|
fs.mkdirSync(TEMP_ROOT_DIR, { recursive: true });
|
|
433
534
|
const cfgPath = getAsyncConfigPath(suffix);
|
|
434
535
|
const runnerProcessInstanceId = randomUUID();
|
|
435
|
-
const
|
|
436
|
-
|
|
536
|
+
const hasRevivalLease = typeof (cfg as { revivalLease?: unknown }).revivalLease === "object";
|
|
537
|
+
const launchBarrierToken = hasRevivalLease ? undefined : runnerProcessInstanceId;
|
|
538
|
+
const launchConfig = { ...cfg, runnerProcessInstanceId, ...(launchBarrierToken ? { launchBarrierToken } : {}) };
|
|
539
|
+
writePrivateAtomicJson(cfgPath, launchConfig);
|
|
437
540
|
const runner = path.join(path.dirname(fileURLToPath(import.meta.url)), "subagent-runner.ts");
|
|
438
|
-
const nodeCommand =
|
|
439
|
-
const launchForStartup = launchConfig as typeof launchConfig & { asyncDir?: unknown; revivalLease?: unknown };
|
|
541
|
+
const nodeCommand = resolveNodeExecutable();
|
|
542
|
+
const launchForStartup = launchConfig as typeof launchConfig & { asyncDir?: unknown; id?: unknown; sessionId?: unknown; completionOwnerId?: unknown; revivalLease?: unknown };
|
|
440
543
|
const launchAsyncDir = typeof launchForStartup.asyncDir === "string" ? launchForStartup.asyncDir : undefined;
|
|
544
|
+
const launchRunId = typeof launchForStartup.id === "string" ? launchForStartup.id : suffix;
|
|
545
|
+
const launchSessionId = typeof launchForStartup.sessionId === "string" ? launchForStartup.sessionId : undefined;
|
|
546
|
+
const launchCompletionOwnerId = typeof launchForStartup.completionOwnerId === "string" ? launchForStartup.completionOwnerId : undefined;
|
|
441
547
|
const startupPath = typeof launchForStartup.revivalLease === "object" && launchAsyncDir
|
|
442
548
|
? path.join(launchAsyncDir, "runner-startup.json")
|
|
443
549
|
: undefined;
|
|
444
550
|
const startupAckPath = startupPath ? path.join(path.dirname(startupPath), "runner-startup-ack.json") : undefined;
|
|
445
|
-
const startupProceedPath =
|
|
551
|
+
const startupProceedPath = launchAsyncDir && (startupPath || launchBarrierToken)
|
|
552
|
+
? path.join(launchAsyncDir, "runner-startup-proceed.json")
|
|
553
|
+
: undefined;
|
|
446
554
|
if (startupPath) fs.rmSync(startupPath, { force: true });
|
|
447
555
|
if (startupAckPath) fs.rmSync(startupAckPath, { force: true });
|
|
448
556
|
if (startupProceedPath) fs.rmSync(startupProceedPath, { force: true });
|
|
@@ -458,11 +566,10 @@ function spawnRunner(cfg: object, suffix: string, cwd: string, onProcessTerminal
|
|
|
458
566
|
}
|
|
459
567
|
const proc = spawn(nodeCommand, [jitiCliPath, runner, cfgPath], {
|
|
460
568
|
cwd,
|
|
461
|
-
|
|
569
|
+
...backgroundProcessOptions(),
|
|
462
570
|
stdio: ["ignore", stdoutFd ?? "ignore", stderrFd ?? "ignore"],
|
|
463
|
-
windowsHide: true,
|
|
464
571
|
env: {
|
|
465
|
-
...process.env,
|
|
572
|
+
...omitExtensionBindingsEnv(process.env),
|
|
466
573
|
...(piPackageRoot ? { [PI_CODING_AGENT_PACKAGE_ROOT_ENV]: piPackageRoot } : {}),
|
|
467
574
|
},
|
|
468
575
|
});
|
|
@@ -524,29 +631,77 @@ function spawnRunner(cfg: object, suffix: string, cwd: string, onProcessTerminal
|
|
|
524
631
|
if (typeof proc.pid !== "number") {
|
|
525
632
|
return { error: `async runner did not produce a pid for cwd: ${cwd}` };
|
|
526
633
|
}
|
|
634
|
+
try {
|
|
635
|
+
writePrivateAtomicJson(initialStatusPath, {
|
|
636
|
+
...initialStatus,
|
|
637
|
+
pid: proc.pid,
|
|
638
|
+
processTerminal: { version: 1, state: "pending", runId: initialStatus.runId, runnerProcessInstanceId },
|
|
639
|
+
});
|
|
640
|
+
} catch (error) {
|
|
641
|
+
const message = `Failed to persist initial async status: ${error instanceof Error ? error.message : String(error)}`;
|
|
642
|
+
if (launchAsyncDir) persistPreProceedStartupFailure(launchAsyncDir, launchRunId, runnerProcessInstanceId, launchSessionId, launchCompletionOwnerId, message);
|
|
643
|
+
const terminationObserved = terminateRunnerBeforeProceed(proc.pid);
|
|
644
|
+
return { pid: proc.pid, runnerProcessInstanceId, error: message, terminationObserved, startupDidNotProceed: true };
|
|
645
|
+
}
|
|
646
|
+
try {
|
|
647
|
+
if (!launchAsyncDir) throw new Error("Async runner is missing its lifecycle directory.");
|
|
648
|
+
initializeProcessTerminal(launchAsyncDir, launchRunId, runnerProcessInstanceId);
|
|
649
|
+
} catch (error) {
|
|
650
|
+
const message = `Failed to establish async runner lifecycle sidecar: ${error instanceof Error ? error.message : String(error)}`;
|
|
651
|
+
if (launchAsyncDir) persistPreProceedStartupFailure(launchAsyncDir, launchRunId, runnerProcessInstanceId, launchSessionId, launchCompletionOwnerId, message);
|
|
652
|
+
const terminationObserved = terminateRunnerBeforeProceed(proc.pid);
|
|
653
|
+
return { pid: proc.pid, runnerProcessInstanceId, error: message, terminationObserved, startupDidNotProceed: true };
|
|
654
|
+
}
|
|
655
|
+
try {
|
|
656
|
+
onBeforeProceed?.(runnerProcessInstanceId);
|
|
657
|
+
} catch (error) {
|
|
658
|
+
const message = `Failed to establish async runner capacity ownership: ${error instanceof Error ? error.message : String(error)}`;
|
|
659
|
+
if (launchAsyncDir) persistPreProceedStartupFailure(launchAsyncDir, launchRunId, runnerProcessInstanceId, launchSessionId, launchCompletionOwnerId, message);
|
|
660
|
+
const terminationObserved = terminateRunnerBeforeProceed(proc.pid);
|
|
661
|
+
return { pid: proc.pid, runnerProcessInstanceId, error: message, terminationObserved, startupDidNotProceed: true };
|
|
662
|
+
}
|
|
663
|
+
if (launchBarrierToken && startupProceedPath) {
|
|
664
|
+
try {
|
|
665
|
+
writeRunnerStartupControl(startupProceedPath, { action: "proceed", token: launchBarrierToken });
|
|
666
|
+
} catch (error) {
|
|
667
|
+
const message = `Failed to authorize async runner startup: ${error instanceof Error ? error.message : String(error)}`;
|
|
668
|
+
if (launchAsyncDir) persistPreProceedStartupFailure(launchAsyncDir, launchRunId, runnerProcessInstanceId, launchSessionId, launchCompletionOwnerId, message);
|
|
669
|
+
const terminationObserved = terminateRunnerBeforeProceed(proc.pid);
|
|
670
|
+
return { pid: proc.pid, runnerProcessInstanceId, error: message, terminationObserved, startupDidNotProceed: true };
|
|
671
|
+
}
|
|
672
|
+
}
|
|
527
673
|
proc.unref();
|
|
528
674
|
if (startupPath && startupAckPath && startupProceedPath) {
|
|
675
|
+
const persistStartupFailure = (message: string) => {
|
|
676
|
+
if (launchAsyncDir) persistPreProceedStartupFailure(launchAsyncDir, launchRunId, runnerProcessInstanceId, launchSessionId, launchCompletionOwnerId, message);
|
|
677
|
+
};
|
|
529
678
|
const ready = waitForRunnerStartup(startupPath, "ready", RUNNER_STARTUP_TIMEOUT_MS);
|
|
530
679
|
if (ready.ok === false) {
|
|
531
|
-
|
|
532
|
-
|
|
680
|
+
persistStartupFailure(ready.error);
|
|
681
|
+
const terminationObserved = terminateRunnerBeforeProceed(proc.pid);
|
|
682
|
+
return { pid: proc.pid, runnerProcessInstanceId, error: ready.error, terminationObserved, startupDidNotProceed: ready.startupDidNotProceed };
|
|
533
683
|
}
|
|
534
684
|
try {
|
|
535
685
|
writeRunnerStartupControl(startupAckPath, { action: "ack", token: ready.token });
|
|
536
686
|
} catch (error) {
|
|
537
|
-
|
|
538
|
-
|
|
687
|
+
const message = `Failed to acknowledge async runner startup: ${error instanceof Error ? error.message : String(error)}`;
|
|
688
|
+
persistStartupFailure(message);
|
|
689
|
+
const terminationObserved = terminateRunnerBeforeProceed(proc.pid);
|
|
690
|
+
return { pid: proc.pid, runnerProcessInstanceId, error: message, terminationObserved, startupDidNotProceed: true };
|
|
539
691
|
}
|
|
540
692
|
const acknowledged = waitForRunnerStartup(startupPath, "acknowledged", RUNNER_STARTUP_TIMEOUT_MS, ready.token);
|
|
541
693
|
if (acknowledged.ok === false) {
|
|
542
|
-
|
|
543
|
-
|
|
694
|
+
persistStartupFailure(acknowledged.error);
|
|
695
|
+
const terminationObserved = terminateRunnerBeforeProceed(proc.pid);
|
|
696
|
+
return { pid: proc.pid, runnerProcessInstanceId, error: acknowledged.error, terminationObserved, startupDidNotProceed: acknowledged.startupDidNotProceed };
|
|
544
697
|
}
|
|
545
698
|
try {
|
|
546
699
|
writeRunnerStartupControl(startupProceedPath, { action: "proceed", token: ready.token });
|
|
547
700
|
} catch (error) {
|
|
548
|
-
|
|
549
|
-
|
|
701
|
+
const message = `Failed to authorize async runner startup: ${error instanceof Error ? error.message : String(error)}`;
|
|
702
|
+
persistStartupFailure(message);
|
|
703
|
+
const terminationObserved = terminateRunnerBeforeProceed(proc.pid);
|
|
704
|
+
return { pid: proc.pid, runnerProcessInstanceId, error: message, terminationObserved, startupDidNotProceed: true };
|
|
550
705
|
}
|
|
551
706
|
try {
|
|
552
707
|
fs.rmSync(startupPath, { force: true });
|
|
@@ -554,7 +709,7 @@ function spawnRunner(cfg: object, suffix: string, cwd: string, onProcessTerminal
|
|
|
554
709
|
// Proceed is the commit point; handshake cleanup cannot turn a running revival into a start error.
|
|
555
710
|
}
|
|
556
711
|
}
|
|
557
|
-
return { pid: proc.pid };
|
|
712
|
+
return { pid: proc.pid, runnerProcessInstanceId };
|
|
558
713
|
} catch (error) {
|
|
559
714
|
closeFd(stdoutFd);
|
|
560
715
|
closeFd(stderrFd);
|
|
@@ -603,13 +758,11 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
603
758
|
: chain;
|
|
604
759
|
const firstStep = chain[0];
|
|
605
760
|
const originalTask = params.task ?? (firstStep
|
|
606
|
-
? (
|
|
607
|
-
?
|
|
608
|
-
:
|
|
609
|
-
? firstStep.parallel
|
|
610
|
-
:
|
|
611
|
-
? firstStep.parallel.task
|
|
612
|
-
: (firstStep as SequentialStep).task)
|
|
761
|
+
? (isParallelStep(firstStep)
|
|
762
|
+
? firstStep.parallel[0]?.task
|
|
763
|
+
: isDynamicParallelStep(firstStep)
|
|
764
|
+
? firstStep.parallel.task
|
|
765
|
+
: (firstStep as SequentialStep).task)
|
|
613
766
|
: undefined);
|
|
614
767
|
try {
|
|
615
768
|
if (params.validateOutputBindings !== false) {
|
|
@@ -621,18 +774,16 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
621
774
|
}
|
|
622
775
|
const workflowGraph = buildWorkflowGraphSnapshot({ runId: id, mode: resultMode, steps: graphChain });
|
|
623
776
|
|
|
777
|
+
const diagnosticContext = params.unknownAgentDiagnosticContext
|
|
778
|
+
?? unknownAgentDiagnosticContext(discoverAgents(path.resolve(runnerCwd), "both"));
|
|
624
779
|
for (const s of chain) {
|
|
625
|
-
const stepAgents =
|
|
626
|
-
?
|
|
627
|
-
:
|
|
628
|
-
? s.parallel.
|
|
629
|
-
:
|
|
630
|
-
? [s.parallel.agent]
|
|
631
|
-
: [(s as SequentialStep).agent];
|
|
780
|
+
const stepAgents = isParallelStep(s)
|
|
781
|
+
? s.parallel.map((t) => t.agent)
|
|
782
|
+
: isDynamicParallelStep(s)
|
|
783
|
+
? [s.parallel.agent]
|
|
784
|
+
: [(s as SequentialStep).agent];
|
|
632
785
|
for (const agentName of stepAgents) {
|
|
633
|
-
if (!agents.find((x) => x.name === agentName)) {
|
|
634
|
-
return { error: `Unknown agent: ${agentName}` };
|
|
635
|
-
}
|
|
786
|
+
if (!agents.find((x) => x.name === agentName)) return { error: formatUnknownAgentError(agentName, diagnosticContext) };
|
|
636
787
|
}
|
|
637
788
|
}
|
|
638
789
|
|
|
@@ -646,19 +797,22 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
646
797
|
...(s.progress !== undefined ? { progress: s.progress } : {}),
|
|
647
798
|
...(stepSkillInput !== undefined ? { skills: stepSkillInput } : {}),
|
|
648
799
|
...(s.model !== undefined ? { model: s.model } : {}),
|
|
800
|
+
...(s.fast !== undefined ? { fast: s.fast } : {}),
|
|
649
801
|
};
|
|
650
802
|
};
|
|
651
|
-
const buildSeqStep = (s: SequentialStep, sessionFile?: string, behaviorCwd?: string, progressPrecreated = false, resolvedBehavior?: ResolvedStepBehavior, flatIndex?: number, parallelOutputNamespace?: { stepIndex: number; taskIndex?: number }) => {
|
|
803
|
+
const buildSeqStep = (s: SequentialStep, sessionFile?: string, behaviorCwd?: string, progressPrecreated = false, resolvedBehavior?: ResolvedStepBehavior, flatIndex?: number, parallelOutputNamespace?: { stepIndex: number; taskIndex?: number }, runFanoutPath?: string) => {
|
|
652
804
|
const a = agents.find((x) => x.name === s.agent)!;
|
|
653
|
-
const externalRunner = a.runner?.type === "external-cli";
|
|
805
|
+
const externalRunner = a.runner?.type === "external-cli" || a.runner?.type === "external-job";
|
|
806
|
+
const externalRunnerType = a.runner?.type;
|
|
654
807
|
if (externalRunner) {
|
|
655
808
|
const unsupported: string[] = [];
|
|
656
809
|
if (s.model !== undefined) unsupported.push("model override");
|
|
657
810
|
if (s.outputSchema !== undefined) unsupported.push("structured output");
|
|
658
811
|
if (s.acceptance !== undefined || params.agentContract !== undefined || s.agentContract !== undefined) unsupported.push("acceptance/agent contract");
|
|
659
812
|
if (s.toolBudget !== undefined || params.toolBudget !== undefined || a.toolBudget !== undefined || params.configToolBudget !== undefined) unsupported.push("tool budget");
|
|
813
|
+
if ((s.fast ?? params.fast ?? a.fast) === true) unsupported.push("fast mode");
|
|
660
814
|
if (params.contextForAgent?.(s.agent) === "fork") unsupported.push("fork context");
|
|
661
|
-
if (unsupported.length > 0) throw new AsyncStartValidationError(`Agent '${a.name}' uses runner.type='
|
|
815
|
+
if (unsupported.length > 0) throw new AsyncStartValidationError(`Agent '${a.name}' uses runner.type='${externalRunnerType}' and does not support: ${unsupported.join(", ")}.`);
|
|
662
816
|
}
|
|
663
817
|
try {
|
|
664
818
|
assertAgentAllowedByCapabilityCeiling(a.name, intersectSubagentCapabilityCeilings(params.capabilityCeiling, decodeSubagentCapabilityCeiling(process.env[SUBAGENT_CAPABILITY_CEILING_ENV])));
|
|
@@ -668,19 +822,28 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
668
822
|
const toolBudgetInput = s.toolBudget ?? params.toolBudget ?? a.toolBudget ?? params.configToolBudget;
|
|
669
823
|
const resolvedToolBudget = validateToolBudgetConfig(toolBudgetInput, s.toolBudget ? "toolBudget" : a.toolBudget ? "agent.toolBudget" : "config.toolBudget");
|
|
670
824
|
if (resolvedToolBudget.error) throw new AsyncStartValidationError(resolvedToolBudget.error);
|
|
671
|
-
const
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
825
|
+
const resolvedToolTimeout = resolveToolTimeoutMs({
|
|
826
|
+
callValue: params.callToolTimeoutMs,
|
|
827
|
+
agentValue: a.defaultToolTimeoutMs,
|
|
828
|
+
configValue: params.configToolTimeoutMs,
|
|
829
|
+
envValue: params.toolTimeoutMsEnv ?? toolTimeoutFromEnv(),
|
|
830
|
+
});
|
|
831
|
+
if (resolvedToolTimeout.error) throw new AsyncStartValidationError(resolvedToolTimeout.error);
|
|
832
|
+
const launchPlan = planChildLaunch({
|
|
833
|
+
agentConfig: a,
|
|
834
|
+
stepOverrides: buildStepOverrides(s),
|
|
835
|
+
task: s.task,
|
|
836
|
+
originalTask,
|
|
837
|
+
runnerCwd,
|
|
838
|
+
runtimeCwd: ctx.cwd,
|
|
839
|
+
stepCwdInput: s.cwd,
|
|
840
|
+
behaviorCwd,
|
|
841
|
+
chainSkills,
|
|
842
|
+
outputBaseDir,
|
|
843
|
+
parallelOutputNamespace,
|
|
844
|
+
resolvedBehavior,
|
|
845
|
+
});
|
|
846
|
+
const { stepCwd, instructionCwd, readExistenceCwd, behavior, namespaceOutputPath, outputPath, skillNames } = launchPlan;
|
|
684
847
|
const { resolved: resolvedSkills, missing: missingSkills } = resolveSkillsWithFallback(
|
|
685
848
|
skillNames,
|
|
686
849
|
stepCwd,
|
|
@@ -705,7 +868,6 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
705
868
|
const isFirstProgressAgent = behavior.progress && !progressPrecreated && !progressInstructionCreated;
|
|
706
869
|
if (behavior.progress) progressInstructionCreated = true;
|
|
707
870
|
const progressInstructions = buildChainInstructions({ ...behavior, output: false, reads: false }, progressDir, isFirstProgressAgent);
|
|
708
|
-
const outputPath = resolveSingleOutputPath(behavior.output, ctx.cwd, instructionCwd, outputBaseDir);
|
|
709
871
|
if (!namespaceOutputPath) systemPrompt = injectOutputPathSystemPrompt(systemPrompt, outputPath, a);
|
|
710
872
|
const validationError = validateFileOnlyOutputMode(behavior.outputMode, outputPath, `Async step (${s.agent})`);
|
|
711
873
|
if (validationError) throw new AsyncStartValidationError(validationError);
|
|
@@ -715,39 +877,94 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
715
877
|
const taskText = `${readInstructions.prefix}${taskTemplate}${progressInstructions.suffix}`;
|
|
716
878
|
const task = namespaceOutputPath ? taskText : injectSingleOutputInstruction(taskText, outputPath, a);
|
|
717
879
|
|
|
880
|
+
const modelScopes = resolveModelScopesForAgent(ctx.modelScope, a.name, ctx.currentModel);
|
|
881
|
+
const modelOrigin = resolveModelOrigin({ explicitModel: s.model, agentModel: a.model, parentModel: ctx.currentModel });
|
|
882
|
+
const primaryModelFromParent = modelOrigin === "inherited";
|
|
718
883
|
const primaryModel = externalRunner ? undefined : resolveEffectiveSubagentModel(
|
|
719
884
|
s.model,
|
|
720
885
|
a.model,
|
|
721
886
|
ctx.currentModel,
|
|
722
887
|
availableModels,
|
|
723
|
-
ctx.currentModelProvider,
|
|
724
|
-
{ scope:
|
|
888
|
+
a.modelProvider ?? ctx.currentModelProvider,
|
|
889
|
+
{ scope: modelScopes, source: modelOrigin === "explicit" ? "explicit" : "inherited" },
|
|
725
890
|
);
|
|
726
891
|
const thinkingOverride = flatIndex === undefined ? undefined : thinkingOverridesByFlatIndex?.[flatIndex];
|
|
727
892
|
const effectiveThinking = externalRunner ? undefined : thinkingOverride ?? a.thinking;
|
|
728
893
|
const model = externalRunner ? undefined : applyThinkingSuffix(primaryModel, effectiveThinking, thinkingOverride !== undefined);
|
|
894
|
+
const contextLimit = model ? findModelInfo(model, availableModels, a.modelProvider ?? ctx.currentModelProvider)?.contextWindow : undefined;
|
|
895
|
+
const thinkingCeiling = externalRunner ? undefined : intersectThinkingCeilings(
|
|
896
|
+
params.thinkingCeiling,
|
|
897
|
+
a.maxThinking,
|
|
898
|
+
decodeThinkingCeiling(process.env[SUBAGENT_THINKING_CEILING_ENV]),
|
|
899
|
+
);
|
|
900
|
+
if (!externalRunner) {
|
|
901
|
+
try {
|
|
902
|
+
assertThinkingWithinCeiling({ model, configThinking: effectiveThinking, ceiling: thinkingCeiling, agent: a.name, runId: id });
|
|
903
|
+
} catch (error) {
|
|
904
|
+
throw new AsyncStartValidationError(error instanceof Error ? error.message : String(error));
|
|
905
|
+
}
|
|
906
|
+
}
|
|
729
907
|
const agentContract = s.agentContract ?? params.agentContract;
|
|
908
|
+
const permissionRules = resolvePermissionRules(ctx.permissions, a.permissions);
|
|
909
|
+
let modelCandidates: string[] = [];
|
|
910
|
+
if (!externalRunner) {
|
|
911
|
+
try {
|
|
912
|
+
modelCandidates = buildModelCandidates(primaryModel, a.fallbackModels, availableModels, a.modelProvider ?? ctx.currentModelProvider, {
|
|
913
|
+
scope: modelScopes,
|
|
914
|
+
primaryModelFromParent,
|
|
915
|
+
origin: modelOrigin,
|
|
916
|
+
}).flatMap((candidate) => {
|
|
917
|
+
const resolved = applyThinkingSuffix(candidate, effectiveThinking, thinkingOverride !== undefined);
|
|
918
|
+
return resolved ? [resolved] : [];
|
|
919
|
+
});
|
|
920
|
+
for (const candidate of modelCandidates) assertThinkingWithinCeiling({ model: candidate, configThinking: effectiveThinking, ceiling: thinkingCeiling, agent: a.name, runId: id });
|
|
921
|
+
} catch (error) {
|
|
922
|
+
throw new AsyncStartValidationError(error instanceof Error ? error.message : String(error));
|
|
923
|
+
}
|
|
924
|
+
}
|
|
925
|
+
const fast = s.fast ?? params.fast ?? a.fast;
|
|
730
926
|
const toolPlan = resolvePiLaunchToolPlan({
|
|
731
927
|
tools: a.tools,
|
|
928
|
+
excludeTools: a.excludeTools,
|
|
929
|
+
allowNestedSubagents: a.allowNestedSubagents,
|
|
732
930
|
extensions: a.extensions,
|
|
733
931
|
subagentOnlyExtensions: a.subagentOnlyExtensions,
|
|
734
932
|
mcpDirectTools: a.mcpDirectTools,
|
|
735
933
|
cwd: stepCwd,
|
|
736
934
|
requireReadTool: Boolean(resolvedSkills.length),
|
|
737
935
|
structuredOutput: Boolean(s.outputSchema),
|
|
936
|
+
fast,
|
|
937
|
+
model,
|
|
938
|
+
modelCandidates,
|
|
738
939
|
capabilityCeiling: params.capabilityCeiling,
|
|
739
940
|
inheritedCapabilityCeiling: decodeSubagentCapabilityCeiling(process.env[SUBAGENT_CAPABILITY_CEILING_ENV]),
|
|
740
941
|
agentName: a.name,
|
|
942
|
+
permissionRules,
|
|
943
|
+
runtimeSnapshotHost: ctx.pi,
|
|
741
944
|
});
|
|
742
945
|
const launchResolvedExtensions = externalRunner ? undefined : projectLaunchResolvedChildExtensions(toolPlan);
|
|
743
|
-
const permissionRules = resolvePermissionRules(ctx.permissions, a.permissions);
|
|
744
946
|
if (externalRunner && permissionRules) {
|
|
745
|
-
throw new AsyncStartValidationError(`Agent '${a.name}' uses runner.type='
|
|
947
|
+
throw new AsyncStartValidationError(`Agent '${a.name}' uses runner.type='${externalRunnerType}', which cannot enforce native Pi child permission rules.`);
|
|
948
|
+
}
|
|
949
|
+
if (!externalRunner) {
|
|
950
|
+
const contractTools = toolPlan.explicitToolAllowlist ? toolPlan.effectiveToolAllowlist : undefined;
|
|
951
|
+
const contractError = validateImplementationToolContract({
|
|
952
|
+
agent: a.name,
|
|
953
|
+
task,
|
|
954
|
+
tools: contractTools,
|
|
955
|
+
mcpDirectTools: toolPlan.effectiveMcpTools,
|
|
956
|
+
configuredExtensions: toolPlan.configuredExtensions,
|
|
957
|
+
requestedTools: toolPlan.requestedBuiltinTools,
|
|
958
|
+
acceptanceRole: a.acceptanceRole,
|
|
959
|
+
completionGuard: a.completionGuard,
|
|
960
|
+
});
|
|
961
|
+
if (contractError) throw new AsyncStartValidationError(contractError);
|
|
746
962
|
}
|
|
747
963
|
return {
|
|
748
964
|
parentSessionId: ctx.parentSessionId ?? ctx.currentSessionId,
|
|
749
965
|
permissionRules,
|
|
750
966
|
...(params.capabilityCeiling ? { capabilityCeiling: params.capabilityCeiling } : {}),
|
|
967
|
+
...(runFanoutPath ? { runFanoutPath } : {}),
|
|
751
968
|
agent: s.agent,
|
|
752
969
|
task,
|
|
753
970
|
...(a.runner ? { runner: a.runner } : {}),
|
|
@@ -758,20 +975,30 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
758
975
|
outputName: s.as,
|
|
759
976
|
structured: Boolean(s.outputSchema),
|
|
760
977
|
cwd: stepCwd,
|
|
978
|
+
requestedCwd: s.cwd ?? stepCwd,
|
|
761
979
|
model,
|
|
980
|
+
...(contextLimit !== undefined ? { contextLimit } : {}),
|
|
981
|
+
...(fast !== undefined ? { fast } : {}),
|
|
762
982
|
thinking: resolveEffectiveThinking(model, effectiveThinking),
|
|
983
|
+
...(thinkingCeiling ? { thinkingCeiling } : {}),
|
|
763
984
|
launchResolvedExtensions,
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
985
|
+
...(toolPlan.mcpConfig ? { mcpConfig: toolPlan.mcpConfig } : {}),
|
|
986
|
+
...(toolPlan.runtimeServerNames ? { runtimeServerNames: toolPlan.runtimeServerNames } : {}),
|
|
987
|
+
modelCandidates: externalRunner ? undefined : modelCandidates,
|
|
988
|
+
...(primaryModelFromParent ? { skipPrimaryModelVerification: true } : {}),
|
|
989
|
+
...(availableModels && availableModels.length > 0 ? { modelVerificationRegistry: availableModels } : {}),
|
|
767
990
|
tools: a.tools,
|
|
991
|
+
excludeTools: a.excludeTools,
|
|
992
|
+
allowNestedSubagents: a.allowNestedSubagents,
|
|
768
993
|
extensions: a.extensions,
|
|
769
994
|
subagentOnlyExtensions: a.subagentOnlyExtensions,
|
|
770
995
|
mcpDirectTools: a.mcpDirectTools,
|
|
996
|
+
mutationTools: a.mutationTools,
|
|
771
997
|
completionGuard: a.completionGuard,
|
|
772
998
|
systemPrompt,
|
|
773
999
|
systemPromptMode: a.systemPromptMode,
|
|
774
1000
|
inheritProjectContext: a.inheritProjectContext,
|
|
1001
|
+
inheritGlobalContext: a.inheritGlobalContext,
|
|
775
1002
|
inheritSkills: a.inheritSkills,
|
|
776
1003
|
skills: resolvedSkills.map((r) => r.name),
|
|
777
1004
|
outputPath,
|
|
@@ -780,7 +1007,9 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
780
1007
|
sessionFile,
|
|
781
1008
|
maxSubagentDepth: resolveChildMaxSubagentDepth(maxSubagentDepth, a.maxSubagentDepth),
|
|
782
1009
|
timeoutMs: a.defaultTimeoutMs ?? DEFAULT_ASYNC_TIMEOUT_MS,
|
|
1010
|
+
toolTimeoutMs: resolvedToolTimeout.toolTimeoutMs,
|
|
783
1011
|
waitToolEnabled: params.waitToolEnabled,
|
|
1012
|
+
waitToolDefaultTimeoutMs: params.waitToolDefaultTimeoutMs,
|
|
784
1013
|
effectiveAcceptance: resolveEffectiveAcceptance({
|
|
785
1014
|
explicit: s.acceptance,
|
|
786
1015
|
agentName: s.agent,
|
|
@@ -795,8 +1024,9 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
795
1024
|
acceptanceRole: a.acceptanceRole,
|
|
796
1025
|
...(s.gateOn ? { gateOn: s.gateOn } : {}),
|
|
797
1026
|
...(s.outputSchema ? { structuredOutputSchema: s.outputSchema } : {}),
|
|
798
|
-
...(s.outputSchema ? { structuredOutput: createStructuredOutputRuntime(s.outputSchema, path.join(asyncDir, "structured-output")) } : {}),
|
|
1027
|
+
...(s.outputSchema ? { structuredOutput: createStructuredOutputRuntime(s.outputSchema, path.join(asyncDir, "structured-output"), { acceptanceReport: resolveAcceptanceReportMode(s.acceptance) }) } : {}),
|
|
799
1028
|
...(resolvedToolBudget.budget ? { toolBudget: resolvedToolBudget.budget } : {}),
|
|
1029
|
+
...(s.worktree ? { worktree: true } : {}),
|
|
800
1030
|
};
|
|
801
1031
|
};
|
|
802
1032
|
|
|
@@ -815,9 +1045,6 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
815
1045
|
|
|
816
1046
|
try {
|
|
817
1047
|
const builtSteps = chain.map((s, stepIndex) => {
|
|
818
|
-
if (isCheckpointStep(s)) {
|
|
819
|
-
return { checkpoint: s.checkpoint, ...(s.message ? { message: s.message } : {}), phase: s.phase, label: s.label };
|
|
820
|
-
}
|
|
821
1048
|
if (isParallelStep(s)) {
|
|
822
1049
|
const parallelBehaviors = s.parallel.map((task) => {
|
|
823
1050
|
const agent = agents.find((candidate) => candidate.name === task.agent)!;
|
|
@@ -839,7 +1066,7 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
839
1066
|
}
|
|
840
1067
|
}
|
|
841
1068
|
const staticStep = nextFlatStep();
|
|
842
|
-
return buildSeqStep({ ...t, agentContract: t.agentContract ?? s.agentContract, gateOn: t.gateOn ?? s.gateOn }, staticStep.sessionFile, behaviorCwd, progressPrecreated, parallelBehaviors[taskIndex], staticStep.index, { stepIndex, taskIndex });
|
|
1069
|
+
return buildSeqStep({ ...t, agentContract: t.agentContract ?? s.agentContract, gateOn: t.gateOn ?? s.gateOn }, staticStep.sessionFile, behaviorCwd, progressPrecreated, parallelBehaviors[taskIndex], staticStep.index, { stepIndex, taskIndex }, resultMode === "parallel" ? `tasks[${taskIndex}]` : `chain[${stepIndex}].parallel[${taskIndex}]`);
|
|
843
1070
|
}),
|
|
844
1071
|
concurrency: s.concurrency,
|
|
845
1072
|
failFast: s.failFast,
|
|
@@ -881,10 +1108,20 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
881
1108
|
acceptanceRole: agent.acceptanceRole,
|
|
882
1109
|
...(s.agentContract ?? params.agentContract ? { agentContract: s.agentContract ?? params.agentContract } : {}),
|
|
883
1110
|
...(s.gateOn ? { gateOn: s.gateOn } : {}),
|
|
1111
|
+
...(parallel.thinkingCeiling ? { thinkingCeiling: parallel.thinkingCeiling } : {}),
|
|
884
1112
|
};
|
|
885
1113
|
}
|
|
1114
|
+
const sequential = s as SequentialStep;
|
|
1115
|
+
let behaviorCwd: string | undefined;
|
|
1116
|
+
if (sequential.worktree) {
|
|
1117
|
+
try {
|
|
1118
|
+
behaviorCwd = resolveExpectedWorktreeAgentCwd(runnerCwd, `${id}-s${stepIndex}`, 0, worktreeBaseDir);
|
|
1119
|
+
} catch {
|
|
1120
|
+
behaviorCwd = undefined;
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
886
1123
|
const staticStep = nextFlatStep();
|
|
887
|
-
return buildSeqStep(
|
|
1124
|
+
return buildSeqStep(sequential, staticStep.sessionFile, behaviorCwd, false, undefined, staticStep.index, undefined, `chain[${stepIndex}]`);
|
|
888
1125
|
});
|
|
889
1126
|
const steps = params.attachRoot
|
|
890
1127
|
? [{
|
|
@@ -899,6 +1136,7 @@ export function buildAsyncRunnerSteps(id: string, params: AsyncRunnerStepBuildPa
|
|
|
899
1136
|
index: params.attachRoot.index,
|
|
900
1137
|
},
|
|
901
1138
|
inheritProjectContext: false,
|
|
1139
|
+
inheritGlobalContext: false,
|
|
902
1140
|
inheritSkills: false,
|
|
903
1141
|
}, ...builtSteps]
|
|
904
1142
|
: builtSteps;
|
|
@@ -953,10 +1191,9 @@ export function executeAsyncChain(
|
|
|
953
1191
|
const resultMode = params.resultMode ?? "chain";
|
|
954
1192
|
const acceptanceErrors = validateExecutionAcceptance({
|
|
955
1193
|
chain: chain.map((step) => {
|
|
956
|
-
if (isCheckpointStep(step)) return {};
|
|
957
1194
|
if (isParallelStep(step)) return { parallel: step.parallel };
|
|
958
1195
|
if (isDynamicParallelStep(step)) return { acceptance: step.acceptance, parallel: step.parallel };
|
|
959
|
-
return { acceptance: step.acceptance };
|
|
1196
|
+
return { acceptance: step.acceptance, outputSchema: step.outputSchema };
|
|
960
1197
|
}),
|
|
961
1198
|
});
|
|
962
1199
|
if (acceptanceErrors.length > 0) return formatAsyncStartError(resultMode, acceptanceErrors.join(" "));
|
|
@@ -966,8 +1203,11 @@ export function executeAsyncChain(
|
|
|
966
1203
|
const asyncDir = inheritedNestedRoute
|
|
967
1204
|
? path.join(TEMP_ROOT_DIR, "nested-subagent-runs", inheritedNestedRoute.rootRunId, id)
|
|
968
1205
|
: path.join(DIRS.async, id);
|
|
1206
|
+
let runFanoutBudget: RunFanoutBudgetDescriptor;
|
|
969
1207
|
try {
|
|
1208
|
+
runFanoutBudget = params.runFanoutBudget ?? createRunFanoutBudget(id, 64);
|
|
970
1209
|
fs.mkdirSync(asyncDir, { recursive: true });
|
|
1210
|
+
writeRunFanoutBudgetDescriptor(asyncDir, runFanoutBudget);
|
|
971
1211
|
} catch (error) {
|
|
972
1212
|
const message = error instanceof Error ? error.message : String(error);
|
|
973
1213
|
return {
|
|
@@ -983,6 +1223,7 @@ export function executeAsyncChain(
|
|
|
983
1223
|
attachRoot: params.attachRoot,
|
|
984
1224
|
resultMode,
|
|
985
1225
|
agents,
|
|
1226
|
+
unknownAgentDiagnosticContext: params.unknownAgentDiagnosticContext,
|
|
986
1227
|
ctx,
|
|
987
1228
|
availableModels: params.availableModels,
|
|
988
1229
|
cwd,
|
|
@@ -996,11 +1237,17 @@ export function executeAsyncChain(
|
|
|
996
1237
|
dynamicFanoutMaxItems: params.dynamicFanoutMaxItems,
|
|
997
1238
|
maxSubagentDepth,
|
|
998
1239
|
waitToolEnabled: params.waitToolEnabled,
|
|
1240
|
+
waitToolDefaultTimeoutMs: params.waitToolDefaultTimeoutMs,
|
|
999
1241
|
worktreeBaseDir,
|
|
1000
1242
|
asyncDir,
|
|
1243
|
+
fast: params.fast,
|
|
1001
1244
|
toolBudget: params.toolBudget,
|
|
1002
1245
|
configToolBudget: params.configToolBudget,
|
|
1246
|
+
callToolTimeoutMs: params.callToolTimeoutMs,
|
|
1247
|
+
configToolTimeoutMs: params.configToolTimeoutMs,
|
|
1248
|
+
toolTimeoutMsEnv: params.toolTimeoutMsEnv ?? toolTimeoutFromEnv(),
|
|
1003
1249
|
capabilityCeiling,
|
|
1250
|
+
thinkingCeiling: params.thinkingCeiling,
|
|
1004
1251
|
});
|
|
1005
1252
|
if ("error" in built) {
|
|
1006
1253
|
try {
|
|
@@ -1012,7 +1259,6 @@ export function executeAsyncChain(
|
|
|
1012
1259
|
}
|
|
1013
1260
|
const { steps, runnerCwd, workflowGraph, eventChain } = built;
|
|
1014
1261
|
const deadlineAt = params.timeoutMs !== undefined ? Date.now() + params.timeoutMs : undefined;
|
|
1015
|
-
const initialTurnBudget = params.turnBudget ? initialTurnBudgetState(params.turnBudget) : undefined;
|
|
1016
1262
|
const initialUsageBudget = usageBudgetState(params.usageBudget, undefined);
|
|
1017
1263
|
let childTargetIndex = 0;
|
|
1018
1264
|
const childIntercomTargets = childIntercomTarget ? steps.flatMap((step) => {
|
|
@@ -1029,14 +1275,29 @@ export function executeAsyncChain(
|
|
|
1029
1275
|
}
|
|
1030
1276
|
return "agent" in step ? [childIntercomTarget(step.agent, childTargetIndex++)] : [undefined];
|
|
1031
1277
|
}) : undefined;
|
|
1278
|
+
const initialStatusSteps = eventChain.flatMap((step) => isParallelStep(step)
|
|
1279
|
+
? step.parallel.map((task) => ({ agent: task.agent, ...(statusStepDescription(task.task) ? { description: statusStepDescription(task.task) } : {}), ...(task.label ? { label: task.label } : {}), ...(task.as ? { outputName: task.as } : {}), status: "pending" as const }))
|
|
1280
|
+
: isDynamicParallelStep(step)
|
|
1281
|
+
? [{ agent: `expand:${step.parallel.agent}`, label: step.label ?? step.parallel.label ?? `Dynamic fanout (${step.collect.as})`, outputName: step.collect.as, status: "pending" as const }]
|
|
1282
|
+
: [{ agent: (step as SequentialStep).agent, ...(statusStepDescription((step as SequentialStep).task) ? { description: statusStepDescription((step as SequentialStep).task) } : {}), ...((step as SequentialStep).label ? { label: (step as SequentialStep).label } : {}), ...((step as SequentialStep).as ? { outputName: (step as SequentialStep).as } : {}), status: "pending" as const }]);
|
|
1283
|
+
const initialParallelGroups: AsyncParallelGroupStatus[] = [];
|
|
1284
|
+
let initialFlatIndex = 0;
|
|
1285
|
+
for (let stepIndex = 0; stepIndex < eventChain.length; stepIndex++) {
|
|
1286
|
+
const step = eventChain[stepIndex]!;
|
|
1287
|
+
if (isParallelStep(step)) initialParallelGroups.push({ start: initialFlatIndex, count: step.parallel.length, stepIndex });
|
|
1288
|
+
else if (isDynamicParallelStep(step)) initialParallelGroups.push({ start: initialFlatIndex, count: 1, stepIndex });
|
|
1289
|
+
initialFlatIndex += isParallelStep(step) ? step.parallel.length : 1;
|
|
1290
|
+
}
|
|
1291
|
+
const initialStatusAt = Date.now();
|
|
1292
|
+
const initialCompletionOwnerId = ctx.completionOwnerId ?? currentCompletionOwnerId();
|
|
1032
1293
|
|
|
1033
|
-
let spawnResult:
|
|
1294
|
+
let spawnResult: SpawnRunnerResult = {};
|
|
1034
1295
|
try {
|
|
1035
1296
|
spawnResult = spawnRunner(
|
|
1036
1297
|
{
|
|
1037
1298
|
id,
|
|
1038
1299
|
steps,
|
|
1039
|
-
resultPath: inheritedNestedRoute ? nestedResultsPath(inheritedNestedRoute.rootRunId, id) :
|
|
1300
|
+
resultPath: inheritedNestedRoute ? nestedResultsPath(inheritedNestedRoute.rootRunId, id) : resultFilePath(DIRS.results, id),
|
|
1040
1301
|
cwd: runnerCwd,
|
|
1041
1302
|
placeholder: "{previous}",
|
|
1042
1303
|
maxOutput,
|
|
@@ -1046,6 +1307,7 @@ export function executeAsyncChain(
|
|
|
1046
1307
|
sessionDir: sessionRoot ? path.join(sessionRoot, `async-${id}`) : undefined,
|
|
1047
1308
|
asyncDir,
|
|
1048
1309
|
sessionId: ctx.currentSessionId,
|
|
1310
|
+
completionOwnerId: ctx.completionOwnerId ?? currentCompletionOwnerId(),
|
|
1049
1311
|
...(capabilityCeiling ? { capabilityCeiling } : {}),
|
|
1050
1312
|
piPackageRoot,
|
|
1051
1313
|
piArgv1: process.argv[1],
|
|
@@ -1053,7 +1315,6 @@ export function executeAsyncChain(
|
|
|
1053
1315
|
worktreeSetupHookTimeoutMs,
|
|
1054
1316
|
worktreeBaseDir,
|
|
1055
1317
|
controlConfig,
|
|
1056
|
-
turnBudget: params.turnBudget,
|
|
1057
1318
|
toolBudget: params.toolBudget,
|
|
1058
1319
|
usageBudget: params.usageBudget,
|
|
1059
1320
|
controlIntercomTarget,
|
|
@@ -1063,6 +1324,7 @@ export function executeAsyncChain(
|
|
|
1063
1324
|
timeoutMs: params.timeoutMs,
|
|
1064
1325
|
deadlineAt,
|
|
1065
1326
|
globalConcurrencyLimit: params.globalConcurrencyLimit,
|
|
1327
|
+
runFanoutBudget,
|
|
1066
1328
|
workflowGraph,
|
|
1067
1329
|
...(params.parentWorkflowRunId ? { parentWorkflowRunId: params.parentWorkflowRunId } : {}),
|
|
1068
1330
|
...(params.workflowKey ? { workflowKey: params.workflowKey } : {}),
|
|
@@ -1076,17 +1338,42 @@ export function executeAsyncChain(
|
|
|
1076
1338
|
},
|
|
1077
1339
|
id,
|
|
1078
1340
|
runnerCwd,
|
|
1079
|
-
|
|
1341
|
+
{
|
|
1342
|
+
lifecycleArtifactVersion: SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
|
|
1343
|
+
runId: id,
|
|
1344
|
+
...(ctx.currentSessionId ? { sessionId: ctx.currentSessionId } : {}),
|
|
1345
|
+
...(initialCompletionOwnerId ? { completionOwnerId: initialCompletionOwnerId } : {}),
|
|
1346
|
+
mode: resultMode,
|
|
1347
|
+
state: "running",
|
|
1348
|
+
startedAt: initialStatusAt,
|
|
1349
|
+
lastUpdate: initialStatusAt,
|
|
1350
|
+
currentStep: 0,
|
|
1351
|
+
chainStepCount: eventChain.length,
|
|
1352
|
+
...(initialParallelGroups.length ? { parallelGroups: initialParallelGroups } : {}),
|
|
1353
|
+
steps: initialStatusSteps,
|
|
1354
|
+
},
|
|
1355
|
+
path.join(asyncDir, "status.json"),
|
|
1356
|
+
(proof) => emitProcessTerminalEvent(ctx, proof),
|
|
1357
|
+
(runnerProcessInstanceId) => params.activeAsyncCapacity?.markStarted(runnerProcessInstanceId),
|
|
1080
1358
|
);
|
|
1081
1359
|
} catch (error) {
|
|
1360
|
+
params.activeAsyncCapacity?.rollback();
|
|
1082
1361
|
const message = error instanceof Error ? error.message : String(error);
|
|
1083
1362
|
return formatAsyncStartError(resultMode, `Failed to start async ${resultMode} '${id}': ${message}`);
|
|
1084
1363
|
}
|
|
1085
1364
|
|
|
1086
1365
|
if (spawnResult.error) {
|
|
1366
|
+
if (spawnResult.startupDidNotProceed) {
|
|
1367
|
+
if (!spawnResult.runnerProcessInstanceId || params.activeAsyncCapacity?.rollbackBeforeRunnerProceed(spawnResult.runnerProcessInstanceId) !== true) params.activeAsyncCapacity?.rollback();
|
|
1368
|
+
}
|
|
1369
|
+
else if (!spawnResult.pid || !spawnResult.runnerProcessInstanceId) params.activeAsyncCapacity?.rollback();
|
|
1370
|
+
else params.activeAsyncCapacity?.markStarted(spawnResult.runnerProcessInstanceId);
|
|
1087
1371
|
return formatAsyncStartError(resultMode, `Failed to start async ${resultMode} '${id}': ${spawnResult.error}`);
|
|
1088
1372
|
}
|
|
1089
|
-
|
|
1373
|
+
if (!spawnResult.pid || !spawnResult.runnerProcessInstanceId) {
|
|
1374
|
+
params.activeAsyncCapacity?.rollback();
|
|
1375
|
+
return formatAsyncStartError(resultMode, `Failed to start async ${resultMode} '${id}': runner identity unavailable`);
|
|
1376
|
+
}
|
|
1090
1377
|
if (spawnResult.pid) {
|
|
1091
1378
|
const eventFirstStep = eventChain[0];
|
|
1092
1379
|
if (!eventFirstStep) {
|
|
@@ -1148,7 +1435,6 @@ export function executeAsyncChain(
|
|
|
1148
1435
|
chainStepCount: eventChain.length,
|
|
1149
1436
|
parallelGroups,
|
|
1150
1437
|
...(params.timeoutMs !== undefined ? { timeoutMs: params.timeoutMs, deadlineAt } : {}),
|
|
1151
|
-
...(initialTurnBudget ? { turnBudget: initialTurnBudget } : {}),
|
|
1152
1438
|
startedAt: now,
|
|
1153
1439
|
lastUpdate: now,
|
|
1154
1440
|
...(capabilityCeiling ? { capabilityCeiling } : {}),
|
|
@@ -1163,11 +1449,12 @@ export function executeAsyncChain(
|
|
|
1163
1449
|
id,
|
|
1164
1450
|
pid: spawnResult.pid,
|
|
1165
1451
|
sessionId: ctx.currentSessionId,
|
|
1452
|
+
completionOwnerId: ctx.completionOwnerId ?? currentCompletionOwnerId(),
|
|
1166
1453
|
mode: resultMode,
|
|
1167
1454
|
agent: firstAgents[0],
|
|
1168
1455
|
agents: flatAgents,
|
|
1169
|
-
task: firstTask?.
|
|
1170
|
-
goal: workflowGoal?.
|
|
1456
|
+
task: firstTask?.trim() ? PROMPT_REDACTED : undefined,
|
|
1457
|
+
goal: workflowGoal?.trim() ? PROMPT_REDACTED : undefined,
|
|
1171
1458
|
chain: eventChain.map((s) =>
|
|
1172
1459
|
isParallelStep(s) ? `[${s.parallel.map((t) => t.agent).join("+")}]` : isDynamicParallelStep(s) ? `expand:${s.parallel.agent}` : (s as SequentialStep).agent,
|
|
1173
1460
|
),
|
|
@@ -1176,8 +1463,8 @@ export function executeAsyncChain(
|
|
|
1176
1463
|
workflowGraph,
|
|
1177
1464
|
cwd: runnerCwd,
|
|
1178
1465
|
asyncDir,
|
|
1466
|
+
...(sessionRoot ? { sessionRoot } : {}),
|
|
1179
1467
|
...(params.timeoutMs !== undefined ? { timeoutMs: params.timeoutMs, deadlineAt } : {}),
|
|
1180
|
-
...(initialTurnBudget ? { turnBudget: initialTurnBudget } : {}),
|
|
1181
1468
|
...(initialUsageBudget ? { usageBudget: initialUsageBudget } : {}),
|
|
1182
1469
|
...(capabilityCeiling ? { capabilityCeiling } : {}),
|
|
1183
1470
|
...(params.parentWorkflowRunId ? { parentWorkflowRunId: params.parentWorkflowRunId } : {}),
|
|
@@ -1194,7 +1481,7 @@ export function executeAsyncChain(
|
|
|
1194
1481
|
|
|
1195
1482
|
return {
|
|
1196
1483
|
content: [{ type: "text", text: formatAsyncStartedMessage(`Async ${resultMode}: ${chainDesc} [${id}]`, ctx.interactive === true) }],
|
|
1197
|
-
details: { mode: resultMode, runId: id, results: [], asyncId: id, asyncDir, workflowGraph, ...(capabilityCeiling ? { capabilityCeiling } : {}), ...(params.parentWorkflowRunId ? { parentWorkflowRunId: params.parentWorkflowRunId } : {}), ...(params.workflowKey ? { workflowKey: params.workflowKey } : {}), ...(params.timeoutMs !== undefined ? { timeoutMs: params.timeoutMs, deadlineAt } : {}), ...(params.
|
|
1484
|
+
details: { mode: resultMode, runId: id, results: [], asyncId: id, asyncDir, workflowGraph, ...(capabilityCeiling ? { capabilityCeiling } : {}), ...(params.parentWorkflowRunId ? { parentWorkflowRunId: params.parentWorkflowRunId } : {}), ...(params.workflowKey ? { workflowKey: params.workflowKey } : {}), ...(params.timeoutMs !== undefined ? { timeoutMs: params.timeoutMs, deadlineAt } : {}), ...(params.toolBudget ? { toolBudget: params.toolBudget } : {}), ...(initialUsageBudget ? { usageBudget: initialUsageBudget } : {}) },
|
|
1198
1485
|
};
|
|
1199
1486
|
}
|
|
1200
1487
|
|
|
@@ -1229,14 +1516,29 @@ export function executeAsyncSingle(
|
|
|
1229
1516
|
childIntercomTarget,
|
|
1230
1517
|
nestedRoute,
|
|
1231
1518
|
} = params;
|
|
1519
|
+
let lane: WorkflowLaneMetadata | undefined;
|
|
1520
|
+
try {
|
|
1521
|
+
lane = normalizeWorkflowLaneMetadata(params.lane, "lane");
|
|
1522
|
+
assertWorkflowLaneKey(lane, params.workflowKey, "lane");
|
|
1523
|
+
} catch (error) {
|
|
1524
|
+
return formatAsyncStartError("single", error instanceof Error ? error.message : String(error));
|
|
1525
|
+
}
|
|
1232
1526
|
const task = params.task ?? "";
|
|
1527
|
+
let extensionBindings: ExtensionBindings | undefined;
|
|
1528
|
+
try {
|
|
1529
|
+
extensionBindings = normalizeExtensionBindings(params.extensionBindings)?.value;
|
|
1530
|
+
} catch (error) {
|
|
1531
|
+
return formatAsyncStartError("single", error instanceof Error ? error.message : String(error));
|
|
1532
|
+
}
|
|
1233
1533
|
const acceptanceErrors = validateAcceptanceInput(params.acceptance);
|
|
1234
1534
|
if (acceptanceErrors.length > 0) return formatAsyncStartError("single", acceptanceErrors.join(" "));
|
|
1235
|
-
const externalRunner = agentConfig.runner?.type === "external-cli";
|
|
1535
|
+
const externalRunner = agentConfig.runner?.type === "external-cli" || agentConfig.runner?.type === "external-job";
|
|
1536
|
+
const externalRunnerType = agentConfig.runner?.type;
|
|
1236
1537
|
const permissionRules = resolvePermissionRules(ctx.permissions, agentConfig.permissions);
|
|
1237
1538
|
if (externalRunner) {
|
|
1238
1539
|
const unsupported: string[] = [];
|
|
1239
1540
|
if (params.modelOverride !== undefined) unsupported.push("model override");
|
|
1541
|
+
if ((params.fast ?? agentConfig.fast) === true) unsupported.push("fast mode");
|
|
1240
1542
|
if (params.thinkingOverride !== undefined) unsupported.push("thinking override");
|
|
1241
1543
|
if (params.structuredOutputSchema !== undefined) unsupported.push("structured output");
|
|
1242
1544
|
if (params.acceptance !== undefined || params.agentContract !== undefined) unsupported.push("acceptance/agent contract");
|
|
@@ -1244,7 +1546,8 @@ export function executeAsyncSingle(
|
|
|
1244
1546
|
if (params.context === "fork") unsupported.push("fork context");
|
|
1245
1547
|
if ((params.skills?.length ?? 0) > 0) unsupported.push("skills");
|
|
1246
1548
|
if (permissionRules) unsupported.push("native Pi child permissions");
|
|
1247
|
-
if (
|
|
1549
|
+
if (extensionBindings !== undefined) unsupported.push("extension bindings");
|
|
1550
|
+
if (unsupported.length > 0) return formatAsyncStartError("single", `Agent '${agentConfig.name}' uses runner.type='${externalRunnerType}' and does not support: ${unsupported.join(", ")}.`);
|
|
1248
1551
|
}
|
|
1249
1552
|
const capabilityCeiling = intersectSubagentCapabilityCeilings(params.capabilityCeiling ?? resolveCurrentSubagentCapabilityCeiling(ctx.currentSessionId), decodeSubagentCapabilityCeiling(process.env[SUBAGENT_CAPABILITY_CEILING_ENV]));
|
|
1250
1553
|
try {
|
|
@@ -1253,6 +1556,10 @@ export function executeAsyncSingle(
|
|
|
1253
1556
|
return formatAsyncStartError("single", error instanceof Error ? error.message : String(error));
|
|
1254
1557
|
}
|
|
1255
1558
|
const runnerCwd = resolveChildCwd(ctx.cwd, cwd);
|
|
1559
|
+
const instructionCwd = params.worktree === true
|
|
1560
|
+
? resolveExpectedWorktreeAgentCwd(runnerCwd, `${id}-s0`, 0, worktreeBaseDir)
|
|
1561
|
+
: runnerCwd;
|
|
1562
|
+
const readExistenceCwd = params.worktree === true ? runnerCwd : instructionCwd;
|
|
1256
1563
|
const skillNames = params.skills ?? agentConfig.skills ?? [];
|
|
1257
1564
|
const availableModels = params.availableModels;
|
|
1258
1565
|
const { resolved: resolvedSkills, missing: missingSkills } = resolveSkillsWithFallback(
|
|
@@ -1279,8 +1586,11 @@ export function executeAsyncSingle(
|
|
|
1279
1586
|
const asyncDir = inheritedNestedRoute
|
|
1280
1587
|
? path.join(TEMP_ROOT_DIR, "nested-subagent-runs", inheritedNestedRoute.rootRunId, id)
|
|
1281
1588
|
: path.join(DIRS.async, id);
|
|
1589
|
+
let runFanoutBudget: RunFanoutBudgetDescriptor;
|
|
1282
1590
|
try {
|
|
1591
|
+
runFanoutBudget = params.runFanoutBudget ?? createRunFanoutBudget(id, 64);
|
|
1283
1592
|
fs.mkdirSync(asyncDir, { recursive: true });
|
|
1593
|
+
writeRunFanoutBudgetDescriptor(asyncDir, runFanoutBudget);
|
|
1284
1594
|
} catch (error) {
|
|
1285
1595
|
const message = error instanceof Error ? error.message : String(error);
|
|
1286
1596
|
return {
|
|
@@ -1291,28 +1601,57 @@ export function executeAsyncSingle(
|
|
|
1291
1601
|
}
|
|
1292
1602
|
|
|
1293
1603
|
const effectiveOutput = normalizeSingleOutputOverride(params.output, agentConfig.output);
|
|
1294
|
-
const outputPath = resolveSingleOutputPath(effectiveOutput, ctx.cwd,
|
|
1604
|
+
const outputPath = resolveSingleOutputPath(effectiveOutput, ctx.cwd, instructionCwd, params.outputBaseDir ?? (artifactsDir ? path.join(artifactsDir, "outputs", id) : undefined));
|
|
1295
1605
|
systemPrompt = injectOutputPathSystemPrompt(systemPrompt, outputPath, agentConfig);
|
|
1296
|
-
const outputMode = params.outputMode ?? "inline";
|
|
1606
|
+
const outputMode = params.outputMode ?? agentConfig.outputMode ?? "inline";
|
|
1297
1607
|
const validationError = validateFileOnlyOutputMode(outputMode, outputPath, `Async single run (${agent})`);
|
|
1298
1608
|
if (validationError) return formatAsyncStartError("single", validationError);
|
|
1299
1609
|
const taskWithOutputInstruction = injectSingleOutputInstruction(task, outputPath, agentConfig);
|
|
1300
1610
|
// Reads: caller override > agent defaultReads > none. `~`/`~/` expand to home;
|
|
1301
1611
|
// absolute paths pass through; relative paths resolve against the child cwd.
|
|
1302
1612
|
const reads = params.reads !== undefined ? params.reads : agentConfig.defaultReads ?? false;
|
|
1303
|
-
const readPaths = Array.isArray(reads) ? resolveExistingReadPaths(reads,
|
|
1613
|
+
const readPaths = Array.isArray(reads) ? resolveExistingReadPaths(reads, readExistenceCwd) : [];
|
|
1304
1614
|
const readsInstruction = readPaths.length > 0
|
|
1305
1615
|
? `[Read from: ${readPaths.join(", ")}]\n\n`
|
|
1306
1616
|
: "";
|
|
1307
1617
|
const taskText = readsInstruction + taskWithOutputInstruction;
|
|
1308
|
-
const
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1618
|
+
const modelScopes = resolveModelScopesForAgent(ctx.modelScope, agentConfig.name, ctx.currentModel);
|
|
1619
|
+
const modelOrigin = resolveModelOrigin({
|
|
1620
|
+
fromParent: params.modelOverrideFromParent,
|
|
1621
|
+
storedOrigin: params.modelOrigin,
|
|
1622
|
+
explicitModel: params.modelOverrideFromParent ? undefined : params.modelOverride,
|
|
1623
|
+
agentModel: agentConfig.model,
|
|
1624
|
+
parentModel: ctx.currentModel,
|
|
1625
|
+
});
|
|
1626
|
+
let primaryModel: string | undefined;
|
|
1627
|
+
try {
|
|
1628
|
+
primaryModel = externalRunner ? undefined : modelOrigin === "inherited"
|
|
1629
|
+
? params.modelOverride ?? (ctx.currentModel ? `${ctx.currentModel.provider}/${ctx.currentModel.id}` : undefined)
|
|
1630
|
+
: resolveSubagentModelOverride(
|
|
1631
|
+
params.modelOverride ?? agentConfig.model,
|
|
1632
|
+
ctx.currentModel,
|
|
1633
|
+
availableModels,
|
|
1634
|
+
ctx.currentModelProvider,
|
|
1635
|
+
{ scope: modelScopes, source: modelOrigin === "explicit" ? "explicit" : "inherited" },
|
|
1636
|
+
);
|
|
1637
|
+
} catch (error) {
|
|
1638
|
+
return formatAsyncStartError("single", error instanceof Error ? error.message : String(error));
|
|
1639
|
+
}
|
|
1314
1640
|
const effectiveThinking = externalRunner ? undefined : params.thinkingOverride ?? agentConfig.thinking;
|
|
1315
1641
|
const model = externalRunner ? undefined : applyThinkingSuffix(primaryModel, effectiveThinking, params.thinkingOverride !== undefined);
|
|
1642
|
+
const contextLimit = model ? findModelInfo(model, availableModels, agentConfig.modelProvider ?? ctx.currentModelProvider)?.contextWindow : undefined;
|
|
1643
|
+
const thinkingCeiling = externalRunner ? undefined : intersectThinkingCeilings(
|
|
1644
|
+
params.thinkingCeiling,
|
|
1645
|
+
agentConfig.maxThinking,
|
|
1646
|
+
decodeThinkingCeiling(process.env[SUBAGENT_THINKING_CEILING_ENV]),
|
|
1647
|
+
);
|
|
1648
|
+
if (!externalRunner) {
|
|
1649
|
+
try {
|
|
1650
|
+
assertThinkingWithinCeiling({ model, configThinking: effectiveThinking, ceiling: thinkingCeiling, agent: agentConfig.name, runId: id });
|
|
1651
|
+
} catch (error) {
|
|
1652
|
+
return formatAsyncStartError("single", error instanceof Error ? error.message : String(error));
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1316
1655
|
const toolBudgetInput = params.toolBudget ?? agentConfig.toolBudget ?? params.configToolBudget;
|
|
1317
1656
|
const resolvedToolBudget = validateToolBudgetConfig(toolBudgetInput, params.toolBudget ? "toolBudget" : agentConfig.toolBudget ? "agent.toolBudget" : "config.toolBudget");
|
|
1318
1657
|
if (resolvedToolBudget.error) return formatAsyncStartError("single", resolvedToolBudget.error);
|
|
@@ -1321,48 +1660,91 @@ export function executeAsyncSingle(
|
|
|
1321
1660
|
? deadlineAt - Date.now()
|
|
1322
1661
|
: params.timeoutMs;
|
|
1323
1662
|
if (timeoutMs !== undefined && timeoutMs <= 0) return formatAsyncStartError("single", "The source run's absolute deadline expired before recovery could launch.");
|
|
1324
|
-
const
|
|
1663
|
+
const resolvedToolTimeout = resolveToolTimeoutMs({
|
|
1664
|
+
callValue: params.toolTimeoutMs,
|
|
1665
|
+
agentValue: agentConfig.defaultToolTimeoutMs,
|
|
1666
|
+
configValue: params.configToolTimeoutMs,
|
|
1667
|
+
envValue: params.toolTimeoutMsEnv ?? toolTimeoutFromEnv(),
|
|
1668
|
+
});
|
|
1669
|
+
if (resolvedToolTimeout.error) return formatAsyncStartError("single", resolvedToolTimeout.error);
|
|
1670
|
+
const toolTimeoutMs = resolvedToolTimeout.toolTimeoutMs;
|
|
1325
1671
|
const initialUsageBudget = usageBudgetState(params.usageBudget, undefined);
|
|
1326
1672
|
const resolvedSessionDir = params.sessionDir ?? (sessionRoot ? path.join(sessionRoot, `async-${id}`) : undefined);
|
|
1327
1673
|
const structuredOutput = params.structuredOutputSchema
|
|
1328
|
-
? createStructuredOutputRuntime(params.structuredOutputSchema, path.join(asyncDir, "structured-output"))
|
|
1674
|
+
? createStructuredOutputRuntime(params.structuredOutputSchema, path.join(asyncDir, "structured-output"), { acceptanceReport: resolveAcceptanceReportMode(params.acceptance) })
|
|
1329
1675
|
: undefined;
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1676
|
+
let modelCandidates: string[] = [];
|
|
1677
|
+
if (!externalRunner) {
|
|
1678
|
+
try {
|
|
1679
|
+
modelCandidates = buildModelCandidates(primaryModel, agentConfig.fallbackModels, availableModels, agentConfig.modelProvider ?? ctx.currentModelProvider, {
|
|
1680
|
+
scope: modelScopes,
|
|
1681
|
+
primaryModelFromParent: modelOrigin === "inherited",
|
|
1682
|
+
origin: modelOrigin,
|
|
1683
|
+
}).flatMap((candidate) => {
|
|
1684
|
+
const resolved = applyThinkingSuffix(candidate, effectiveThinking, params.thinkingOverride !== undefined);
|
|
1685
|
+
return resolved ? [resolved] : [];
|
|
1686
|
+
});
|
|
1687
|
+
for (const candidate of modelCandidates) assertThinkingWithinCeiling({ model: candidate, configThinking: effectiveThinking, ceiling: thinkingCeiling, agent: agentConfig.name, runId: id });
|
|
1688
|
+
} catch (error) {
|
|
1689
|
+
return formatAsyncStartError("single", error instanceof Error ? error.message : String(error));
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1336
1692
|
const toolPlan = resolvePiLaunchToolPlan({
|
|
1337
1693
|
tools: agentConfig.tools,
|
|
1694
|
+
excludeTools: agentConfig.excludeTools,
|
|
1695
|
+
allowNestedSubagents: agentConfig.allowNestedSubagents,
|
|
1338
1696
|
extensions: agentConfig.extensions,
|
|
1339
1697
|
subagentOnlyExtensions: agentConfig.subagentOnlyExtensions,
|
|
1340
1698
|
mcpDirectTools: agentConfig.mcpDirectTools,
|
|
1341
1699
|
cwd: runnerCwd,
|
|
1342
1700
|
requireReadTool: Boolean(resolvedSkills.length),
|
|
1343
1701
|
structuredOutput: Boolean(params.structuredOutputSchema),
|
|
1702
|
+
fast: params.fast ?? agentConfig.fast,
|
|
1703
|
+
model,
|
|
1704
|
+
modelCandidates,
|
|
1344
1705
|
capabilityCeiling,
|
|
1345
1706
|
inheritedCapabilityCeiling: decodeSubagentCapabilityCeiling(process.env[SUBAGENT_CAPABILITY_CEILING_ENV]),
|
|
1346
1707
|
agentName: agentConfig.name,
|
|
1708
|
+
permissionRules: resolvePermissionRules(ctx.permissions, agentConfig.permissions),
|
|
1709
|
+
runtimeSnapshotHost: ctx.pi,
|
|
1347
1710
|
});
|
|
1348
1711
|
const launchResolvedExtensions = externalRunner ? undefined : projectLaunchResolvedChildExtensions(toolPlan);
|
|
1712
|
+
if (!externalRunner) {
|
|
1713
|
+
const contractTools = toolPlan.explicitToolAllowlist ? toolPlan.effectiveToolAllowlist : undefined;
|
|
1714
|
+
const contractError = validateImplementationToolContract({
|
|
1715
|
+
agent: agentConfig.name,
|
|
1716
|
+
task: taskText,
|
|
1717
|
+
tools: contractTools,
|
|
1718
|
+
mcpDirectTools: toolPlan.effectiveMcpTools,
|
|
1719
|
+
configuredExtensions: toolPlan.configuredExtensions,
|
|
1720
|
+
requestedTools: toolPlan.requestedBuiltinTools,
|
|
1721
|
+
acceptanceRole: agentConfig.acceptanceRole,
|
|
1722
|
+
completionGuard: agentConfig.completionGuard,
|
|
1723
|
+
});
|
|
1724
|
+
if (contractError) return formatAsyncStartError("single", contractError);
|
|
1725
|
+
}
|
|
1349
1726
|
const launchContractDigest = launchBindingDigest({
|
|
1350
1727
|
definitionDigest: agentDefinitionDigest(agentConfig),
|
|
1351
1728
|
task,
|
|
1352
1729
|
...(model ? { model } : {}),
|
|
1353
1730
|
modelCandidates,
|
|
1731
|
+
...((params.fast ?? agentConfig.fast) !== undefined ? { fast: params.fast ?? agentConfig.fast } : {}),
|
|
1354
1732
|
...(resolveEffectiveThinking(model, effectiveThinking) ? { thinking: resolveEffectiveThinking(model, effectiveThinking) } : {}),
|
|
1355
|
-
|
|
1733
|
+
...(thinkingCeiling ? { thinkingCeiling } : {}),
|
|
1734
|
+
systemPrompt,
|
|
1356
1735
|
systemPromptMode: agentConfig.systemPromptMode,
|
|
1357
1736
|
inheritProjectContext: agentConfig.inheritProjectContext,
|
|
1737
|
+
inheritGlobalContext: agentConfig.inheritGlobalContext,
|
|
1358
1738
|
inheritSkills: agentConfig.inheritSkills,
|
|
1359
1739
|
skills: resolvedSkills.map((skill) => skill.name),
|
|
1360
1740
|
tools: toolPlan.effectiveToolAllowlist,
|
|
1741
|
+
...(toolPlan.excludeTools.length > 0 ? { excludeTools: toolPlan.excludeTools } : {}),
|
|
1361
1742
|
extensions: toolPlan.extensionArgs,
|
|
1362
1743
|
mcpDirectTools: toolPlan.effectiveMcpTools,
|
|
1363
1744
|
...(outputPath ? { outputPath } : {}),
|
|
1364
1745
|
outputMode,
|
|
1365
1746
|
...(params.structuredOutputSchema ? { structuredOutputSchema: params.structuredOutputSchema } : {}),
|
|
1747
|
+
...(extensionBindings ? { extensionBindings } : {}),
|
|
1366
1748
|
});
|
|
1367
1749
|
const resolvedAcceptance = resolveEffectiveAcceptance({
|
|
1368
1750
|
explicit: params.acceptance,
|
|
@@ -1373,9 +1755,13 @@ export function executeAsyncSingle(
|
|
|
1373
1755
|
async: true,
|
|
1374
1756
|
agentContract: params.agentContract,
|
|
1375
1757
|
});
|
|
1758
|
+
const recoveryAgentConfig = params.recoveryAgentConfig ?? agentConfig;
|
|
1376
1759
|
const recoveryDescriptor: SteeringRecoveryDescriptor = {
|
|
1377
1760
|
version: 1,
|
|
1761
|
+
...(lane ? { lane } : {}),
|
|
1378
1762
|
launchContractDigest,
|
|
1763
|
+
...(extensionBindings ? { extensionBindings } : {}),
|
|
1764
|
+
runFanoutBudget,
|
|
1379
1765
|
sourceRunId: id,
|
|
1380
1766
|
...(params.agentContract ? { agentContract: params.agentContract } : {}),
|
|
1381
1767
|
agent,
|
|
@@ -1383,30 +1769,40 @@ export function executeAsyncSingle(
|
|
|
1383
1769
|
...(sessionFile ? { sessionFile } : {}),
|
|
1384
1770
|
cwd: runnerCwd,
|
|
1385
1771
|
...(model ? { model } : {}),
|
|
1386
|
-
...(
|
|
1772
|
+
...(params.fast ?? recoveryAgentConfig.fast ? { fast: params.fast ?? recoveryAgentConfig.fast } : {}),
|
|
1773
|
+
...(recoveryAgentConfig.modelProvider ? { modelProvider: recoveryAgentConfig.modelProvider } : {}),
|
|
1774
|
+
...(modelOrigin === "inherited" ? { modelOverrideFromParent: true } : {}),
|
|
1775
|
+
modelOrigin,
|
|
1776
|
+
...(recoveryAgentConfig.fallbackModels ? { fallbackModels: [...recoveryAgentConfig.fallbackModels] } : {}),
|
|
1387
1777
|
...(effectiveThinking ? { thinking: resolveEffectiveThinking(model, effectiveThinking) } : {}),
|
|
1388
|
-
...(
|
|
1389
|
-
...(
|
|
1390
|
-
...(
|
|
1391
|
-
...(
|
|
1392
|
-
...(
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1778
|
+
...(thinkingCeiling ? { thinkingCeiling } : {}),
|
|
1779
|
+
...(recoveryAgentConfig.tools ? { tools: [...recoveryAgentConfig.tools] } : {}),
|
|
1780
|
+
...(recoveryAgentConfig.excludeTools ? { excludeTools: [...recoveryAgentConfig.excludeTools] } : {}),
|
|
1781
|
+
...(recoveryAgentConfig.allowNestedSubagents !== undefined ? { allowNestedSubagents: recoveryAgentConfig.allowNestedSubagents } : {}),
|
|
1782
|
+
...(recoveryAgentConfig.extensions ? { extensions: [...recoveryAgentConfig.extensions] } : {}),
|
|
1783
|
+
...(recoveryAgentConfig.subagentOnlyExtensions ? { subagentOnlyExtensions: [...recoveryAgentConfig.subagentOnlyExtensions] } : {}),
|
|
1784
|
+
...(recoveryAgentConfig.mcpDirectTools ? { mcpDirectTools: [...recoveryAgentConfig.mcpDirectTools] } : {}),
|
|
1785
|
+
...(recoveryAgentConfig.mutationTools ? { mutationTools: [...recoveryAgentConfig.mutationTools] } : {}),
|
|
1786
|
+
...(recoveryAgentConfig.systemPrompt ? { systemPrompt: recoveryAgentConfig.systemPrompt } : {}),
|
|
1787
|
+
systemPromptMode: recoveryAgentConfig.systemPromptMode,
|
|
1788
|
+
inheritProjectContext: recoveryAgentConfig.inheritProjectContext,
|
|
1789
|
+
inheritGlobalContext: recoveryAgentConfig.inheritGlobalContext,
|
|
1790
|
+
inheritSkills: recoveryAgentConfig.inheritSkills,
|
|
1396
1791
|
...(resolvedSkills.length ? { skills: resolvedSkills.map((skill) => skill.name) } : {}),
|
|
1397
|
-
...(
|
|
1398
|
-
...(
|
|
1399
|
-
...(
|
|
1400
|
-
...(
|
|
1792
|
+
...(recoveryAgentConfig.skillPath ? { skillPath: [...recoveryAgentConfig.skillPath] } : {}),
|
|
1793
|
+
...(recoveryAgentConfig.filePath ? { agentFilePath: recoveryAgentConfig.filePath } : {}),
|
|
1794
|
+
...(recoveryAgentConfig.completionGuard !== undefined ? { completionGuard: recoveryAgentConfig.completionGuard } : {}),
|
|
1795
|
+
...(recoveryAgentConfig.memory ? { memory: { ...recoveryAgentConfig.memory } } : {}),
|
|
1401
1796
|
...(outputPath ? { outputPath } : {}),
|
|
1402
1797
|
outputMode,
|
|
1403
1798
|
...(params.structuredOutputSchema ? { structuredOutputSchema: params.structuredOutputSchema } : {}),
|
|
1404
1799
|
...(params.acceptance !== undefined ? { acceptance: params.acceptance } : {}),
|
|
1405
1800
|
...(controlConfig ? { controlConfig } : {}),
|
|
1801
|
+
...(params.context ? { context: params.context } : {}),
|
|
1802
|
+
...(params.intercomBridge !== undefined ? { intercomBridge: params.intercomBridge } : {}),
|
|
1406
1803
|
...(deadlineAt !== undefined ? { absoluteDeadlineAt: deadlineAt } : {}),
|
|
1407
|
-
...(initialTurnBudget ? { initialTurnBudget: { maxTurns: initialTurnBudget.maxTurns, graceTurns: initialTurnBudget.graceTurns } } : {}),
|
|
1408
1804
|
...(resolvedToolBudget.budget ? { initialToolBudget: resolvedToolBudget.budget } : {}),
|
|
1409
|
-
maxSubagentDepth: resolveChildMaxSubagentDepth(maxSubagentDepth,
|
|
1805
|
+
maxSubagentDepth: resolveChildMaxSubagentDepth(maxSubagentDepth, recoveryAgentConfig.maxSubagentDepth),
|
|
1410
1806
|
...(maxOutput ? { maxOutput } : {}),
|
|
1411
1807
|
share: shareEnabled,
|
|
1412
1808
|
...(resolvedSessionDir ? { sessionDir: resolvedSessionDir } : {}),
|
|
@@ -1421,7 +1817,9 @@ export function executeAsyncSingle(
|
|
|
1421
1817
|
return formatAsyncStartError("single", `Failed to persist async recovery descriptor for '${id}': ${error instanceof Error ? error.message : String(error)}`);
|
|
1422
1818
|
}
|
|
1423
1819
|
}
|
|
1424
|
-
let spawnResult:
|
|
1820
|
+
let spawnResult: SpawnRunnerResult = {};
|
|
1821
|
+
const initialStatusAt = Date.now();
|
|
1822
|
+
const initialCompletionOwnerId = ctx.completionOwnerId ?? currentCompletionOwnerId();
|
|
1425
1823
|
try {
|
|
1426
1824
|
spawnResult = spawnRunner(
|
|
1427
1825
|
{
|
|
@@ -1434,40 +1832,59 @@ export function executeAsyncSingle(
|
|
|
1434
1832
|
agent,
|
|
1435
1833
|
task: taskText,
|
|
1436
1834
|
...(agentConfig.runner ? { runner: agentConfig.runner } : {}),
|
|
1835
|
+
...(params.externalJobFollowUp ? { externalJobFollowUp: params.externalJobFollowUp } : {}),
|
|
1437
1836
|
...(params.context ? { context: params.context } : {}),
|
|
1438
1837
|
cwd: runnerCwd,
|
|
1838
|
+
requestedCwd: params.requestedCwd ?? runnerCwd,
|
|
1439
1839
|
model,
|
|
1840
|
+
...(contextLimit !== undefined ? { contextLimit } : {}),
|
|
1841
|
+
...(params.fast ?? agentConfig.fast ? { fast: params.fast ?? agentConfig.fast } : {}),
|
|
1440
1842
|
thinking: resolveEffectiveThinking(model, effectiveThinking),
|
|
1843
|
+
...(thinkingCeiling ? { thinkingCeiling } : {}),
|
|
1441
1844
|
modelCandidates,
|
|
1845
|
+
...(modelOrigin === "inherited" ? { skipPrimaryModelVerification: true } : {}),
|
|
1846
|
+
...(availableModels && availableModels.length > 0 ? { modelVerificationRegistry: availableModels } : {}),
|
|
1442
1847
|
tools: agentConfig.tools,
|
|
1848
|
+
excludeTools: agentConfig.excludeTools,
|
|
1849
|
+
allowNestedSubagents: agentConfig.allowNestedSubagents,
|
|
1443
1850
|
extensions: agentConfig.extensions,
|
|
1444
1851
|
subagentOnlyExtensions: agentConfig.subagentOnlyExtensions,
|
|
1445
1852
|
mcpDirectTools: agentConfig.mcpDirectTools,
|
|
1853
|
+
...(toolPlan.mcpConfig ? { mcpConfig: toolPlan.mcpConfig } : {}),
|
|
1854
|
+
...(toolPlan.runtimeServerNames ? { runtimeServerNames: toolPlan.runtimeServerNames } : {}),
|
|
1855
|
+
mutationTools: agentConfig.mutationTools,
|
|
1446
1856
|
completionGuard: agentConfig.completionGuard,
|
|
1447
1857
|
systemPrompt,
|
|
1448
1858
|
systemPromptMode: agentConfig.systemPromptMode,
|
|
1449
1859
|
inheritProjectContext: agentConfig.inheritProjectContext,
|
|
1860
|
+
inheritGlobalContext: agentConfig.inheritGlobalContext,
|
|
1450
1861
|
inheritSkills: agentConfig.inheritSkills,
|
|
1451
1862
|
skills: resolvedSkills.map((r) => r.name),
|
|
1452
1863
|
outputPath,
|
|
1864
|
+
...(params.outputClaimPath ? { outputClaimPath: params.outputClaimPath } : {}),
|
|
1453
1865
|
outputMode,
|
|
1454
1866
|
...(!externalRunner && sessionFile ? { sessionFile } : {}),
|
|
1455
1867
|
maxSubagentDepth: resolveChildMaxSubagentDepth(maxSubagentDepth, agentConfig.maxSubagentDepth),
|
|
1456
1868
|
waitToolEnabled: params.waitToolEnabled,
|
|
1869
|
+
waitToolDefaultTimeoutMs: params.waitToolDefaultTimeoutMs,
|
|
1457
1870
|
...(params.agentContract ? { agentContract: params.agentContract } : {}),
|
|
1458
1871
|
definitionDigest: agentDefinitionDigest(agentConfig),
|
|
1459
1872
|
launchBindingTask: task,
|
|
1460
1873
|
launchContractDigest,
|
|
1874
|
+
...(extensionBindings ? { extensionBindings } : {}),
|
|
1461
1875
|
launchResolvedExtensions,
|
|
1462
1876
|
effectiveAcceptance: resolvedAcceptance,
|
|
1877
|
+
acceptanceInput: params.acceptance,
|
|
1463
1878
|
...(structuredOutput ? { structuredOutput } : {}),
|
|
1464
1879
|
...(params.structuredOutputSchema ? { structuredOutputSchema: params.structuredOutputSchema } : {}),
|
|
1465
1880
|
...(resolvedToolBudget.budget ? { toolBudget: resolvedToolBudget.budget } : {}),
|
|
1881
|
+
...(params.worktree === true ? { worktree: true } : {}),
|
|
1882
|
+
...(lane ? { lane } : {}),
|
|
1466
1883
|
},
|
|
1467
1884
|
],
|
|
1468
|
-
resultPath: params.parentWorkflowRunId !== undefined && params.revivalLease !== undefined
|
|
1885
|
+
resultPath: params.parentWorkflowRunId !== undefined && (params.revivalLease !== undefined || params.workflowAwaitAsync === true)
|
|
1469
1886
|
? workflowAwaitedAsyncResultPath(asyncDir)
|
|
1470
|
-
: inheritedNestedRoute ? nestedResultsPath(inheritedNestedRoute.rootRunId, id) :
|
|
1887
|
+
: inheritedNestedRoute ? nestedResultsPath(inheritedNestedRoute.rootRunId, id) : resultFilePath(DIRS.results, id),
|
|
1471
1888
|
cwd: runnerCwd,
|
|
1472
1889
|
placeholder: "{previous}",
|
|
1473
1890
|
maxOutput,
|
|
@@ -1477,6 +1894,7 @@ export function executeAsyncSingle(
|
|
|
1477
1894
|
sessionDir: resolvedSessionDir,
|
|
1478
1895
|
asyncDir,
|
|
1479
1896
|
sessionId: ctx.currentSessionId,
|
|
1897
|
+
completionOwnerId: ctx.completionOwnerId ?? currentCompletionOwnerId(),
|
|
1480
1898
|
...(capabilityCeiling ? { capabilityCeiling } : {}),
|
|
1481
1899
|
piPackageRoot,
|
|
1482
1900
|
piArgv1: process.argv[1],
|
|
@@ -1486,7 +1904,7 @@ export function executeAsyncSingle(
|
|
|
1486
1904
|
controlConfig,
|
|
1487
1905
|
timeoutMs,
|
|
1488
1906
|
deadlineAt,
|
|
1489
|
-
|
|
1907
|
+
toolTimeoutMs,
|
|
1490
1908
|
toolBudget: params.toolBudget,
|
|
1491
1909
|
usageBudget: params.usageBudget,
|
|
1492
1910
|
controlIntercomTarget,
|
|
@@ -1494,8 +1912,10 @@ export function executeAsyncSingle(
|
|
|
1494
1912
|
resultMode: "single",
|
|
1495
1913
|
launchContractDigest,
|
|
1496
1914
|
launchResolvedExtensions,
|
|
1915
|
+
runFanoutBudget,
|
|
1497
1916
|
...(params.parentWorkflowRunId ? { parentWorkflowRunId: params.parentWorkflowRunId } : {}),
|
|
1498
1917
|
...(params.workflowKey ? { workflowKey: params.workflowKey } : {}),
|
|
1918
|
+
...(lane ? { lane } : {}),
|
|
1499
1919
|
...(params.revivalLease ? { revivalLease: params.revivalLease } : {}),
|
|
1500
1920
|
nestedRoute: nestedRoute ?? inheritedNestedRoute,
|
|
1501
1921
|
nestedSelf: inheritedNestedRoute && nestedAddress ? {
|
|
@@ -1507,17 +1927,43 @@ export function executeAsyncSingle(
|
|
|
1507
1927
|
},
|
|
1508
1928
|
id,
|
|
1509
1929
|
runnerCwd,
|
|
1510
|
-
|
|
1930
|
+
{
|
|
1931
|
+
lifecycleArtifactVersion: SUBAGENT_LIFECYCLE_ARTIFACT_VERSION,
|
|
1932
|
+
runId: id,
|
|
1933
|
+
...(ctx.currentSessionId ? { sessionId: ctx.currentSessionId } : {}),
|
|
1934
|
+
...(initialCompletionOwnerId ? { completionOwnerId: initialCompletionOwnerId } : {}),
|
|
1935
|
+
mode: "single",
|
|
1936
|
+
state: "running",
|
|
1937
|
+
startedAt: initialStatusAt,
|
|
1938
|
+
lastUpdate: initialStatusAt,
|
|
1939
|
+
currentStep: 0,
|
|
1940
|
+
chainStepCount: 1,
|
|
1941
|
+
...(lane ? { lane } : {}),
|
|
1942
|
+
steps: [{ agent, status: "pending", ...(lane ? { lane } : {}), ...(model ? { model } : {}), ...(contextLimit !== undefined ? { contextLimit } : {}) }],
|
|
1943
|
+
},
|
|
1944
|
+
path.join(asyncDir, "status.json"),
|
|
1945
|
+
(proof) => emitProcessTerminalEvent(ctx, proof),
|
|
1946
|
+
(runnerProcessInstanceId) => params.activeAsyncCapacity?.markStarted(runnerProcessInstanceId),
|
|
1947
|
+
params.requestedCwd ?? runnerCwd,
|
|
1511
1948
|
);
|
|
1512
1949
|
} catch (error) {
|
|
1950
|
+
params.activeAsyncCapacity?.rollback();
|
|
1513
1951
|
const message = error instanceof Error ? error.message : String(error);
|
|
1514
1952
|
return formatAsyncStartError("single", `Failed to start async run '${id}': ${message}`);
|
|
1515
1953
|
}
|
|
1516
1954
|
|
|
1517
1955
|
if (spawnResult.error) {
|
|
1956
|
+
if (spawnResult.startupDidNotProceed) {
|
|
1957
|
+
if (!spawnResult.runnerProcessInstanceId || params.activeAsyncCapacity?.rollbackBeforeRunnerProceed(spawnResult.runnerProcessInstanceId) !== true) params.activeAsyncCapacity?.rollback();
|
|
1958
|
+
}
|
|
1959
|
+
else if (!spawnResult.pid || !spawnResult.runnerProcessInstanceId) params.activeAsyncCapacity?.rollback();
|
|
1960
|
+
else params.activeAsyncCapacity?.markStarted(spawnResult.runnerProcessInstanceId);
|
|
1518
1961
|
return formatAsyncStartError("single", `Failed to start async run '${id}': ${spawnResult.error}`);
|
|
1519
1962
|
}
|
|
1520
|
-
|
|
1963
|
+
if (!spawnResult.pid || !spawnResult.runnerProcessInstanceId) {
|
|
1964
|
+
params.activeAsyncCapacity?.rollback();
|
|
1965
|
+
return formatAsyncStartError("single", `Failed to start async run '${id}': runner identity unavailable`);
|
|
1966
|
+
}
|
|
1521
1967
|
if (spawnResult.pid) {
|
|
1522
1968
|
if (inheritedNestedRoute && nestedAddress) {
|
|
1523
1969
|
const now = Date.now();
|
|
@@ -1545,7 +1991,6 @@ export function executeAsyncSingle(
|
|
|
1545
1991
|
agents: [agent],
|
|
1546
1992
|
chainStepCount: 1,
|
|
1547
1993
|
...(timeoutMs !== undefined ? { timeoutMs, deadlineAt } : {}),
|
|
1548
|
-
...(initialTurnBudget ? { turnBudget: initialTurnBudget } : {}),
|
|
1549
1994
|
startedAt: now,
|
|
1550
1995
|
lastUpdate: now,
|
|
1551
1996
|
...(capabilityCeiling ? { capabilityCeiling } : {}),
|
|
@@ -1560,18 +2005,19 @@ export function executeAsyncSingle(
|
|
|
1560
2005
|
id,
|
|
1561
2006
|
pid: spawnResult.pid,
|
|
1562
2007
|
sessionId: ctx.currentSessionId,
|
|
2008
|
+
completionOwnerId: ctx.completionOwnerId ?? currentCompletionOwnerId(),
|
|
1563
2009
|
mode: "single",
|
|
1564
2010
|
agent,
|
|
1565
|
-
task: task?.
|
|
1566
|
-
goal: (params.goal ?? task).
|
|
2011
|
+
task: task?.trim() ? PROMPT_REDACTED : undefined,
|
|
2012
|
+
goal: (params.goal ?? task).trim() ? PROMPT_REDACTED : undefined,
|
|
1567
2013
|
cwd: runnerCwd,
|
|
1568
2014
|
asyncDir,
|
|
2015
|
+
...(sessionRoot ? { sessionRoot } : {}),
|
|
1569
2016
|
launchContractDigest,
|
|
1570
2017
|
launchResolvedExtensions,
|
|
1571
2018
|
...(params.parentWorkflowRunId ? { parentWorkflowRunId: params.parentWorkflowRunId } : {}),
|
|
1572
2019
|
...(params.workflowKey ? { workflowKey: params.workflowKey } : {}),
|
|
1573
2020
|
...(timeoutMs !== undefined ? { timeoutMs, deadlineAt } : {}),
|
|
1574
|
-
...(initialTurnBudget ? { turnBudget: initialTurnBudget } : {}),
|
|
1575
2021
|
...(initialUsageBudget ? { usageBudget: initialUsageBudget } : {}),
|
|
1576
2022
|
...(capabilityCeiling ? { capabilityCeiling } : {}),
|
|
1577
2023
|
nestedRoute,
|
|
@@ -1580,6 +2026,6 @@ export function executeAsyncSingle(
|
|
|
1580
2026
|
|
|
1581
2027
|
return {
|
|
1582
2028
|
content: [{ type: "text", text: formatAsyncStartedMessage(`Async: ${agent} [${id}]`, ctx.interactive === true) }],
|
|
1583
|
-
details: { mode: "single", runId: id, results: [], asyncId: id, asyncDir, launchContractDigest, launchResolvedExtensions, ...(capabilityCeiling ? { capabilityCeiling } : {}), ...(params.context ? { context: params.context } : {}), ...(timeoutMs !== undefined ? { timeoutMs, deadlineAt } : {}), ...(params.
|
|
2029
|
+
details: { mode: "single", runId: id, results: [], asyncId: id, asyncDir, launchContractDigest, launchResolvedExtensions, ...(capabilityCeiling ? { capabilityCeiling } : {}), ...(params.context ? { context: params.context } : {}), ...(timeoutMs !== undefined ? { timeoutMs, deadlineAt } : {}), ...(params.toolBudget ? { toolBudget: resolvedToolBudget.budget ?? params.toolBudget } : {}), ...(initialUsageBudget ? { usageBudget: initialUsageBudget } : {}) } as Details,
|
|
1584
2030
|
};
|
|
1585
2031
|
}
|