pi-improve-interation 0.0.1
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/LICENSE +21 -0
- package/README.en.md +57 -0
- package/README.md +57 -0
- package/extensions/plus.ts +93 -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/jiti/LICENSE +21 -0
- package/node_modules/jiti/README.md +258 -0
- package/node_modules/jiti/dist/babel.cjs +257 -0
- package/node_modules/jiti/dist/jiti.cjs +1 -0
- package/node_modules/jiti/lib/jiti-cli.mjs +34 -0
- package/node_modules/jiti/lib/jiti-hooks.mjs +124 -0
- package/node_modules/jiti/lib/jiti-native.mjs +121 -0
- package/node_modules/jiti/lib/jiti-register.d.mts +1 -0
- package/node_modules/jiti/lib/jiti-register.mjs +4 -0
- package/node_modules/jiti/lib/jiti-static.mjs +23 -0
- package/node_modules/jiti/lib/jiti.cjs +30 -0
- package/node_modules/jiti/lib/jiti.d.cts +8 -0
- package/node_modules/jiti/lib/jiti.d.mts +8 -0
- package/node_modules/jiti/lib/jiti.mjs +29 -0
- package/node_modules/jiti/lib/types.d.ts +420 -0
- package/node_modules/jiti/package.json +146 -0
- package/node_modules/pi-subagents/CHANGELOG.md +2282 -0
- package/node_modules/pi-subagents/LICENSE +21 -0
- package/node_modules/pi-subagents/README.md +126 -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/delegate.md +14 -0
- package/node_modules/pi-subagents/agents/oracle.md +78 -0
- package/node_modules/pi-subagents/agents/researcher.md +52 -0
- package/node_modules/pi-subagents/agents/reviewer.md +89 -0
- package/node_modules/pi-subagents/agents/scout.md +50 -0
- package/node_modules/pi-subagents/agents/worker.md +59 -0
- package/node_modules/pi-subagents/async-retention-discovery-worker.mjs +180 -0
- package/node_modules/pi-subagents/docs/agents.md +492 -0
- package/node_modules/pi-subagents/docs/configuration.md +508 -0
- package/node_modules/pi-subagents/docs/extension-api.md +443 -0
- package/node_modules/pi-subagents/docs/missions.md +121 -0
- package/node_modules/pi-subagents/docs/models.md +258 -0
- package/node_modules/pi-subagents/docs/observability.md +262 -0
- package/node_modules/pi-subagents/docs/tool-reference.md +482 -0
- package/node_modules/pi-subagents/docs/watchdog.md +176 -0
- package/node_modules/pi-subagents/docs/workflows.md +475 -0
- package/node_modules/pi-subagents/index.ts +10 -0
- package/node_modules/pi-subagents/inspector-runner.mjs +11 -0
- package/node_modules/pi-subagents/install.mjs +93 -0
- package/node_modules/pi-subagents/package.json +109 -0
- package/node_modules/pi-subagents/prompts/council.md +60 -0
- package/node_modules/pi-subagents/prompts/gather-context-and-clarify.md +13 -0
- package/node_modules/pi-subagents/prompts/parallel-cleanup.md +59 -0
- package/node_modules/pi-subagents/prompts/parallel-research.md +50 -0
- package/node_modules/pi-subagents/prompts/parallel-review.md +58 -0
- package/node_modules/pi-subagents/prompts/review-loop.md +47 -0
- 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 +103 -0
- package/node_modules/pi-subagents/skills/pi-subagents/references/constraints-and-recipes.md +70 -0
- package/node_modules/pi-subagents/skills/pi-subagents/references/execution-controls.md +538 -0
- package/node_modules/pi-subagents/skills/pi-subagents/references/management-authoring-rpc.md +161 -0
- 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 +295 -0
- 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 +1355 -0
- package/node_modules/pi-subagents/src/agents/agent-memory.ts +254 -0
- package/node_modules/pi-subagents/src/agents/agent-refinements.ts +624 -0
- package/node_modules/pi-subagents/src/agents/agent-scope.ts +6 -0
- package/node_modules/pi-subagents/src/agents/agent-selection.ts +25 -0
- package/node_modules/pi-subagents/src/agents/agent-serializer.ts +179 -0
- package/node_modules/pi-subagents/src/agents/agents.ts +2808 -0
- package/node_modules/pi-subagents/src/agents/builtin-names.ts +15 -0
- package/node_modules/pi-subagents/src/agents/chain-serializer.ts +280 -0
- package/node_modules/pi-subagents/src/agents/frontmatter.ts +153 -0
- package/node_modules/pi-subagents/src/agents/identity.ts +30 -0
- package/node_modules/pi-subagents/src/agents/proactive-skills.ts +194 -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 +754 -0
- package/node_modules/pi-subagents/src/api/agents.ts +12 -0
- package/node_modules/pi-subagents/src/api/background-work.ts +206 -0
- package/node_modules/pi-subagents/src/api/capability-ceiling.ts +17 -0
- package/node_modules/pi-subagents/src/api/control-channel.ts +4 -0
- package/node_modules/pi-subagents/src/api/delegation.ts +112 -0
- package/node_modules/pi-subagents/src/api/external-job-provider.ts +195 -0
- package/node_modules/pi-subagents/src/api/external-runs.ts +282 -0
- package/node_modules/pi-subagents/src/api/intercom-bridge.ts +3 -0
- package/node_modules/pi-subagents/src/api/pi-args.ts +5 -0
- package/node_modules/pi-subagents/src/api/preflight.ts +501 -0
- package/node_modules/pi-subagents/src/api/project-panes.ts +32 -0
- package/node_modules/pi-subagents/src/api/shared-types.ts +24 -0
- package/node_modules/pi-subagents/src/extension/config.ts +235 -0
- package/node_modules/pi-subagents/src/extension/control-notices.ts +58 -0
- package/node_modules/pi-subagents/src/extension/doctor.ts +278 -0
- package/node_modules/pi-subagents/src/extension/fanout-child.ts +205 -0
- package/node_modules/pi-subagents/src/extension/index.ts +1093 -0
- package/node_modules/pi-subagents/src/extension/public-execution.ts +210 -0
- package/node_modules/pi-subagents/src/extension/rpc.ts +860 -0
- package/node_modules/pi-subagents/src/extension/schemas.ts +419 -0
- package/node_modules/pi-subagents/src/extension/steering-notices.ts +35 -0
- package/node_modules/pi-subagents/src/extension/subagent-guide.ts +39 -0
- package/node_modules/pi-subagents/src/extension/tool-description.ts +221 -0
- package/node_modules/pi-subagents/src/extension/tool-result.ts +19 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/actions.ts +235 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/client.ts +130 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/focus.ts +55 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/inspector-runner.ts +147 -0
- package/node_modules/pi-subagents/src/inspectors/herdr/project-panes.ts +730 -0
- 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 +400 -0
- package/node_modules/pi-subagents/src/intercom/intercom-bridge.ts +191 -0
- package/node_modules/pi-subagents/src/intercom/native-supervisor-channel.ts +812 -0
- package/node_modules/pi-subagents/src/intercom/result-intercom.ts +423 -0
- package/node_modules/pi-subagents/src/missions/actions.ts +433 -0
- package/node_modules/pi-subagents/src/missions/goal-driver.ts +164 -0
- package/node_modules/pi-subagents/src/missions/lifecycle.ts +367 -0
- package/node_modules/pi-subagents/src/missions/store.ts +584 -0
- package/node_modules/pi-subagents/src/missions/types.ts +190 -0
- package/node_modules/pi-subagents/src/missions/workflow-state.ts +260 -0
- package/node_modules/pi-subagents/src/policy/authority.ts +46 -0
- package/node_modules/pi-subagents/src/profiles/profiles.ts +662 -0
- 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 +139 -0
- package/node_modules/pi-subagents/src/runs/background/async-execution.ts +2031 -0
- package/node_modules/pi-subagents/src/runs/background/async-job-tracker.ts +781 -0
- package/node_modules/pi-subagents/src/runs/background/async-resume.ts +628 -0
- 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 +736 -0
- package/node_modules/pi-subagents/src/runs/background/auto-drain.ts +68 -0
- package/node_modules/pi-subagents/src/runs/background/chain-append.ts +321 -0
- package/node_modules/pi-subagents/src/runs/background/chain-root-attachment.ts +270 -0
- package/node_modules/pi-subagents/src/runs/background/completion-batcher.ts +168 -0
- package/node_modules/pi-subagents/src/runs/background/completion-dedupe.ts +58 -0
- package/node_modules/pi-subagents/src/runs/background/completion-replay.ts +287 -0
- package/node_modules/pi-subagents/src/runs/background/control-channel.ts +768 -0
- package/node_modules/pi-subagents/src/runs/background/fleet-view.ts +620 -0
- 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 +594 -0
- package/node_modules/pi-subagents/src/runs/background/owned-process-tree.ts +104 -0
- package/node_modules/pi-subagents/src/runs/background/parallel-groups.ts +45 -0
- package/node_modules/pi-subagents/src/runs/background/process-terminal.ts +310 -0
- 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 +792 -0
- package/node_modules/pi-subagents/src/runs/background/resume-guidance.ts +56 -0
- package/node_modules/pi-subagents/src/runs/background/retained-children.ts +135 -0
- 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 +175 -0
- package/node_modules/pi-subagents/src/runs/background/run-status.ts +694 -0
- package/node_modules/pi-subagents/src/runs/background/scheduled-runs.ts +965 -0
- package/node_modules/pi-subagents/src/runs/background/stale-run-reconciler.ts +410 -0
- package/node_modules/pi-subagents/src/runs/background/steering.ts +242 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-runner.ts +5649 -0
- package/node_modules/pi-subagents/src/runs/background/subagent-wait.ts +725 -0
- package/node_modules/pi-subagents/src/runs/background/terminal-run-index.ts +138 -0
- package/node_modules/pi-subagents/src/runs/background/top-level-async.ts +14 -0
- package/node_modules/pi-subagents/src/runs/background/wait-completions.ts +196 -0
- package/node_modules/pi-subagents/src/runs/background/wait-config.ts +50 -0
- package/node_modules/pi-subagents/src/runs/background/wait-subscriptions.ts +348 -0
- package/node_modules/pi-subagents/src/runs/background/wait-tool.ts +43 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-dismiss-action.ts +86 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-steering-action.ts +262 -0
- package/node_modules/pi-subagents/src/runs/foreground/async-stop-action.ts +86 -0
- package/node_modules/pi-subagents/src/runs/foreground/execution.ts +2437 -0
- package/node_modules/pi-subagents/src/runs/foreground/foreground-control.ts +153 -0
- package/node_modules/pi-subagents/src/runs/foreground/foreground-history.ts +160 -0
- package/node_modules/pi-subagents/src/runs/foreground/prompt-audit.ts +172 -0
- package/node_modules/pi-subagents/src/runs/foreground/subagent-executor.ts +6916 -0
- 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 +188 -0
- package/node_modules/pi-subagents/src/runs/shared/abort-recovery.ts +119 -0
- package/node_modules/pi-subagents/src/runs/shared/acceptance.ts +1509 -0
- package/node_modules/pi-subagents/src/runs/shared/agent-contract.ts +38 -0
- 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 +210 -0
- package/node_modules/pi-subagents/src/runs/shared/chain-outputs.ts +116 -0
- 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 +415 -0
- 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 +252 -0
- package/node_modules/pi-subagents/src/runs/shared/context-mode.ts +44 -0
- 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 +297 -0
- 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 +429 -0
- 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 +221 -0
- 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 +483 -0
- 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 +578 -0
- package/node_modules/pi-subagents/src/runs/shared/model-scope.ts +205 -0
- package/node_modules/pi-subagents/src/runs/shared/mutation-evidence.ts +199 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-events.ts +1086 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-path.ts +52 -0
- package/node_modules/pi-subagents/src/runs/shared/nested-render.ts +127 -0
- 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 +692 -0
- package/node_modules/pi-subagents/src/runs/shared/parallel-utils.ts +275 -0
- package/node_modules/pi-subagents/src/runs/shared/permissions.ts +99 -0
- package/node_modules/pi-subagents/src/runs/shared/pi-args.ts +1056 -0
- package/node_modules/pi-subagents/src/runs/shared/pi-spawn.ts +197 -0
- package/node_modules/pi-subagents/src/runs/shared/process-signal.ts +32 -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 +201 -0
- package/node_modules/pi-subagents/src/runs/shared/runtime-acknowledged-extensions.ts +71 -0
- package/node_modules/pi-subagents/src/runs/shared/session-lease.ts +293 -0
- package/node_modules/pi-subagents/src/runs/shared/single-output.ts +304 -0
- package/node_modules/pi-subagents/src/runs/shared/spawn-budget.ts +128 -0
- package/node_modules/pi-subagents/src/runs/shared/structured-output.ts +223 -0
- package/node_modules/pi-subagents/src/runs/shared/subagent-control.ts +290 -0
- package/node_modules/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +824 -0
- package/node_modules/pi-subagents/src/runs/shared/subagent-startup-retry.ts +116 -0
- package/node_modules/pi-subagents/src/runs/shared/task-intent.ts +208 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-availability.ts +81 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-budget.ts +80 -0
- package/node_modules/pi-subagents/src/runs/shared/tool-timeout.ts +93 -0
- package/node_modules/pi-subagents/src/runs/shared/usage-budget.ts +65 -0
- package/node_modules/pi-subagents/src/runs/shared/workflow-graph.ts +225 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree-cleanup-plan.ts +847 -0
- package/node_modules/pi-subagents/src/runs/shared/worktree.ts +802 -0
- package/node_modules/pi-subagents/src/shared/accessible-dir.ts +47 -0
- package/node_modules/pi-subagents/src/shared/agent-stream-options.ts +5 -0
- package/node_modules/pi-subagents/src/shared/artifacts.ts +281 -0
- package/node_modules/pi-subagents/src/shared/atomic-json.ts +83 -0
- 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/child-transcript.ts +264 -0
- package/node_modules/pi-subagents/src/shared/completion-owner.ts +14 -0
- package/node_modules/pi-subagents/src/shared/display-text.ts +150 -0
- package/node_modules/pi-subagents/src/shared/extension-context.ts +24 -0
- package/node_modules/pi-subagents/src/shared/file-coalescer.ts +49 -0
- package/node_modules/pi-subagents/src/shared/file-system-retry.ts +95 -0
- package/node_modules/pi-subagents/src/shared/fork-context.ts +293 -0
- package/node_modules/pi-subagents/src/shared/fork-session-cwd.ts +27 -0
- package/node_modules/pi-subagents/src/shared/formatters.ts +146 -0
- package/node_modules/pi-subagents/src/shared/jsonl-writer.ts +81 -0
- package/node_modules/pi-subagents/src/shared/launch-contract.ts +138 -0
- package/node_modules/pi-subagents/src/shared/model-info.ts +101 -0
- package/node_modules/pi-subagents/src/shared/node-executable.ts +21 -0
- package/node_modules/pi-subagents/src/shared/post-exit-stdio-guard.ts +85 -0
- package/node_modules/pi-subagents/src/shared/prompt-resources.ts +11 -0
- 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-identity.ts +10 -0
- package/node_modules/pi-subagents/src/shared/session-tokens.ts +55 -0
- package/node_modules/pi-subagents/src/shared/settings.ts +409 -0
- package/node_modules/pi-subagents/src/shared/shortcuts.ts +17 -0
- package/node_modules/pi-subagents/src/shared/status-format.ts +55 -0
- package/node_modules/pi-subagents/src/shared/thinking-ceiling.ts +52 -0
- package/node_modules/pi-subagents/src/shared/types.ts +2836 -0
- package/node_modules/pi-subagents/src/shared/utf8.ts +11 -0
- package/node_modules/pi-subagents/src/shared/utils.ts +590 -0
- 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 +426 -0
- package/node_modules/pi-subagents/src/slash/delegation-json.ts +108 -0
- package/node_modules/pi-subagents/src/slash/delegation-request.ts +162 -0
- package/node_modules/pi-subagents/src/slash/prompt-template-bridge.ts +419 -0
- package/node_modules/pi-subagents/src/slash/prompt-workflows.ts +287 -0
- package/node_modules/pi-subagents/src/slash/selector.ts +147 -0
- package/node_modules/pi-subagents/src/slash/slash-bridge.ts +192 -0
- package/node_modules/pi-subagents/src/slash/slash-commands.ts +1336 -0
- package/node_modules/pi-subagents/src/slash/slash-live-state.ts +310 -0
- package/node_modules/pi-subagents/src/slash/subagents-admin.ts +437 -0
- package/node_modules/pi-subagents/src/tui/fleet-status.ts +905 -0
- package/node_modules/pi-subagents/src/tui/fleet-transcript.ts +536 -0
- package/node_modules/pi-subagents/src/tui/fleet.ts +1436 -0
- package/node_modules/pi-subagents/src/tui/render-helpers.ts +111 -0
- package/node_modules/pi-subagents/src/tui/render.ts +3146 -0
- package/node_modules/pi-subagents/src/types/pi-runtime-compat.d.ts +8 -0
- package/node_modules/pi-subagents/src/watchdog/change-signature.ts +260 -0
- package/node_modules/pi-subagents/src/watchdog/child-status.ts +205 -0
- package/node_modules/pi-subagents/src/watchdog/emission-guard.ts +123 -0
- package/node_modules/pi-subagents/src/watchdog/lsp-diagnostics.ts +538 -0
- package/node_modules/pi-subagents/src/watchdog/model-selection.ts +167 -0
- package/node_modules/pi-subagents/src/watchdog/permission-arbiter.ts +154 -0
- package/node_modules/pi-subagents/src/watchdog/register-child.ts +117 -0
- package/node_modules/pi-subagents/src/watchdog/register-main.ts +440 -0
- package/node_modules/pi-subagents/src/watchdog/render.ts +54 -0
- package/node_modules/pi-subagents/src/watchdog/review.ts +303 -0
- package/node_modules/pi-subagents/src/watchdog/runtime.ts +868 -0
- package/node_modules/pi-subagents/src/watchdog/scope.ts +62 -0
- package/node_modules/pi-subagents/src/watchdog/settings.ts +568 -0
- package/node_modules/pi-subagents/src/watchdog/tool-actions.ts +155 -0
- package/node_modules/pi-subagents/src/watchdog/turn-delta.ts +161 -0
- package/node_modules/pi-subagents/src/watchdog/types.ts +198 -0
- package/node_modules/pi-subagents/src/watchdog/warning-format.ts +73 -0
- package/node_modules/pi-subagents/src/workflows/chat-progress.ts +151 -0
- package/node_modules/pi-subagents/src/workflows/host-command.ts +235 -0
- package/node_modules/pi-subagents/src/workflows/scripted-workflow.ts +2183 -0
- 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/typebox/build/compile/code.d.mts +12 -0
- package/node_modules/typebox/build/compile/code.mjs +65 -0
- package/node_modules/typebox/build/compile/compile.d.mts +6 -0
- package/node_modules/typebox/build/compile/compile.mjs +12 -0
- package/node_modules/typebox/build/compile/index.d.mts +8 -0
- package/node_modules/typebox/build/compile/index.mjs +14 -0
- package/node_modules/typebox/build/compile/validator.d.mts +43 -0
- package/node_modules/typebox/build/compile/validator.mjs +121 -0
- package/node_modules/typebox/build/error/errors.d.mts +214 -0
- package/node_modules/typebox/build/error/errors.mjs +18 -0
- package/node_modules/typebox/build/error/index.d.mts +1 -0
- package/node_modules/typebox/build/error/index.mjs +1 -0
- package/node_modules/typebox/build/format/_idna.d.mts +2 -0
- package/node_modules/typebox/build/format/_idna.mjs +216 -0
- package/node_modules/typebox/build/format/_puny.d.mts +1 -0
- package/node_modules/typebox/build/format/_puny.mjs +74 -0
- package/node_modules/typebox/build/format/_registry.d.mts +15 -0
- package/node_modules/typebox/build/format/_registry.mjs +96 -0
- package/node_modules/typebox/build/format/date.d.mts +6 -0
- package/node_modules/typebox/build/format/date.mjs +19 -0
- package/node_modules/typebox/build/format/date_time.d.mts +6 -0
- package/node_modules/typebox/build/format/date_time.mjs +11 -0
- package/node_modules/typebox/build/format/duration.d.mts +5 -0
- package/node_modules/typebox/build/format/duration.mjs +8 -0
- package/node_modules/typebox/build/format/email.d.mts +5 -0
- package/node_modules/typebox/build/format/email.mjs +8 -0
- package/node_modules/typebox/build/format/format.d.mts +22 -0
- package/node_modules/typebox/build/format/format.mjs +22 -0
- package/node_modules/typebox/build/format/hostname.d.mts +7 -0
- package/node_modules/typebox/build/format/hostname.mjs +18 -0
- package/node_modules/typebox/build/format/idn_email.d.mts +5 -0
- package/node_modules/typebox/build/format/idn_email.mjs +8 -0
- package/node_modules/typebox/build/format/idn_hostname.d.mts +7 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +19 -0
- package/node_modules/typebox/build/format/index.d.mts +4 -0
- package/node_modules/typebox/build/format/index.mjs +4 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +6 -0
- package/node_modules/typebox/build/format/ipv4.mjs +38 -0
- package/node_modules/typebox/build/format/ipv6.d.mts +5 -0
- package/node_modules/typebox/build/format/ipv6.mjs +67 -0
- package/node_modules/typebox/build/format/iri.d.mts +5 -0
- package/node_modules/typebox/build/format/iri.mjs +13 -0
- package/node_modules/typebox/build/format/iri_reference.d.mts +5 -0
- package/node_modules/typebox/build/format/iri_reference.mjs +60 -0
- package/node_modules/typebox/build/format/json_pointer.d.mts +6 -0
- package/node_modules/typebox/build/format/json_pointer.mjs +9 -0
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.d.mts +6 -0
- package/node_modules/typebox/build/format/json_pointer_uri_fragment.mjs +9 -0
- package/node_modules/typebox/build/format/regex.d.mts +6 -0
- package/node_modules/typebox/build/format/regex.mjs +17 -0
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +6 -0
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +9 -0
- package/node_modules/typebox/build/format/time.d.mts +5 -0
- package/node_modules/typebox/build/format/time.mjs +27 -0
- package/node_modules/typebox/build/format/uri.d.mts +5 -0
- package/node_modules/typebox/build/format/uri.mjs +135 -0
- package/node_modules/typebox/build/format/uri_reference.d.mts +5 -0
- package/node_modules/typebox/build/format/uri_reference.mjs +9 -0
- package/node_modules/typebox/build/format/uri_template.d.mts +6 -0
- package/node_modules/typebox/build/format/uri_template.mjs +10 -0
- package/node_modules/typebox/build/format/url.d.mts +6 -0
- package/node_modules/typebox/build/format/url.mjs +9 -0
- package/node_modules/typebox/build/format/uuid.d.mts +6 -0
- package/node_modules/typebox/build/format/uuid.mjs +9 -0
- package/node_modules/typebox/build/guard/emit.d.mts +58 -0
- package/node_modules/typebox/build/guard/emit.mjs +194 -0
- package/node_modules/typebox/build/guard/globals.d.mts +35 -0
- package/node_modules/typebox/build/guard/globals.mjs +90 -0
- package/node_modules/typebox/build/guard/guard.d.mts +69 -0
- package/node_modules/typebox/build/guard/guard.mjs +217 -0
- package/node_modules/typebox/build/guard/index.d.mts +6 -0
- package/node_modules/typebox/build/guard/index.mjs +6 -0
- package/node_modules/typebox/build/guard/native.d.mts +20 -0
- package/node_modules/typebox/build/guard/native.mjs +60 -0
- package/node_modules/typebox/build/guard/string.d.mts +6 -0
- package/node_modules/typebox/build/guard/string.mjs +164 -0
- package/node_modules/typebox/build/index.d.mts +8 -0
- package/node_modules/typebox/build/index.mjs +14 -0
- package/node_modules/typebox/build/schema/build.d.mts +39 -0
- package/node_modules/typebox/build/schema/build.mjs +118 -0
- package/node_modules/typebox/build/schema/check.d.mts +6 -0
- package/node_modules/typebox/build/schema/check.mjs +14 -0
- package/node_modules/typebox/build/schema/compile.d.mts +22 -0
- package/node_modules/typebox/build/schema/compile.mjs +46 -0
- package/node_modules/typebox/build/schema/engine/_context.d.mts +35 -0
- package/node_modules/typebox/build/schema/engine/_context.mjs +129 -0
- package/node_modules/typebox/build/schema/engine/_exact_optional.d.mts +3 -0
- package/node_modules/typebox/build/schema/engine/_exact_optional.mjs +20 -0
- package/node_modules/typebox/build/schema/engine/_externals.d.mts +7 -0
- package/node_modules/typebox/build/schema/engine/_externals.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/_functions.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/_functions.mjs +47 -0
- package/node_modules/typebox/build/schema/engine/_guard.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/_guard.mjs +26 -0
- package/node_modules/typebox/build/schema/engine/_reducer.d.mts +4 -0
- package/node_modules/typebox/build/schema/engine/_reducer.mjs +45 -0
- package/node_modules/typebox/build/schema/engine/_refine.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/_refine.mjs +29 -0
- package/node_modules/typebox/build/schema/engine/_stack.d.mts +18 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +107 -0
- package/node_modules/typebox/build/schema/engine/_unique.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_unique.mjs +5 -0
- package/node_modules/typebox/build/schema/engine/additionalItems.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +50 -0
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +9 -0
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +110 -0
- package/node_modules/typebox/build/schema/engine/allOf.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/allOf.mjs +47 -0
- package/node_modules/typebox/build/schema/engine/anyOf.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/anyOf.mjs +52 -0
- package/node_modules/typebox/build/schema/engine/boolean.d.mts +5 -0
- package/node_modules/typebox/build/schema/engine/boolean.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/const.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/const.mjs +30 -0
- package/node_modules/typebox/build/schema/engine/contains.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/contains.mjs +42 -0
- package/node_modules/typebox/build/schema/engine/dependencies.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/dependencies.mjs +45 -0
- package/node_modules/typebox/build/schema/engine/dependentRequired.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/dependentRequired.mjs +40 -0
- package/node_modules/typebox/build/schema/engine/dependentSchemas.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +38 -0
- package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/enum.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/enum.mjs +33 -0
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/exclusiveMaximum.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/exclusiveMinimum.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/format.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/format.mjs +26 -0
- package/node_modules/typebox/build/schema/engine/if.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/if.mjs +47 -0
- package/node_modules/typebox/build/schema/engine/index.d.mts +49 -0
- package/node_modules/typebox/build/schema/engine/index.mjs +55 -0
- package/node_modules/typebox/build/schema/engine/items.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/items.mjs +68 -0
- package/node_modules/typebox/build/schema/engine/maxContains.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +42 -0
- package/node_modules/typebox/build/schema/engine/maxItems.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/maxItems.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/maxLength.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/maxLength.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/maxProperties.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/maxProperties.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/maximum.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/maximum.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/minContains.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/minContains.mjs +41 -0
- package/node_modules/typebox/build/schema/engine/minItems.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/minItems.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/minLength.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/minLength.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/minProperties.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/minProperties.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/minimum.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/minimum.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/multipleOf.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/multipleOf.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/not.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/not.mjs +37 -0
- package/node_modules/typebox/build/schema/engine/oneOf.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +58 -0
- package/node_modules/typebox/build/schema/engine/pattern.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/pattern.mjs +28 -0
- package/node_modules/typebox/build/schema/engine/patternProperties.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +44 -0
- package/node_modules/typebox/build/schema/engine/prefixItems.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/prefixItems.mjs +35 -0
- package/node_modules/typebox/build/schema/engine/properties.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/properties.mjs +75 -0
- package/node_modules/typebox/build/schema/engine/propertyNames.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +39 -0
- package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +25 -0
- package/node_modules/typebox/build/schema/engine/ref.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/ref.mjs +58 -0
- package/node_modules/typebox/build/schema/engine/required.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/required.mjs +32 -0
- package/node_modules/typebox/build/schema/engine/schema.d.mts +9 -0
- package/node_modules/typebox/build/schema/engine/schema.mjs +352 -0
- package/node_modules/typebox/build/schema/engine/type.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/type.mjs +74 -0
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +51 -0
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +51 -0
- package/node_modules/typebox/build/schema/engine/uniqueItems.d.mts +6 -0
- package/node_modules/typebox/build/schema/engine/uniqueItems.mjs +51 -0
- package/node_modules/typebox/build/schema/errors.d.mts +6 -0
- package/node_modules/typebox/build/schema/errors.mjs +24 -0
- package/node_modules/typebox/build/schema/index.d.mts +3 -0
- package/node_modules/typebox/build/schema/index.mjs +9 -0
- package/node_modules/typebox/build/schema/parse.d.mts +13 -0
- package/node_modules/typebox/build/schema/parse.mjs +27 -0
- package/node_modules/typebox/build/schema/pointer/index.d.mts +2 -0
- package/node_modules/typebox/build/schema/pointer/index.mjs +2 -0
- package/node_modules/typebox/build/schema/pointer/pointer.d.mts +10 -0
- package/node_modules/typebox/build/schema/pointer/pointer.mjs +106 -0
- package/node_modules/typebox/build/schema/pointer/pointer_get.d.mts +9 -0
- package/node_modules/typebox/build/schema/pointer/pointer_get.mjs +2 -0
- package/node_modules/typebox/build/schema/resolve/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/resolve/index.mjs +1 -0
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +3 -0
- package/node_modules/typebox/build/schema/resolve/ref.mjs +146 -0
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +1 -0
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +1 -0
- package/node_modules/typebox/build/schema/schema.d.mts +10 -0
- package/node_modules/typebox/build/schema/schema.mjs +10 -0
- package/node_modules/typebox/build/schema/static/_canonical.d.mts +7 -0
- package/node_modules/typebox/build/schema/static/_canonical.mjs +2 -0
- package/node_modules/typebox/build/schema/static/_comparer.d.mts +6 -0
- package/node_modules/typebox/build/schema/static/_comparer.mjs +2 -0
- package/node_modules/typebox/build/schema/static/_elements.d.mts +18 -0
- package/node_modules/typebox/build/schema/static/_elements.mjs +2 -0
- package/node_modules/typebox/build/schema/static/additionalProperties.d.mts +7 -0
- package/node_modules/typebox/build/schema/static/additionalProperties.mjs +3 -0
- package/node_modules/typebox/build/schema/static/allOf.d.mts +3 -0
- package/node_modules/typebox/build/schema/static/allOf.mjs +2 -0
- package/node_modules/typebox/build/schema/static/anyOf.d.mts +3 -0
- package/node_modules/typebox/build/schema/static/anyOf.mjs +2 -0
- package/node_modules/typebox/build/schema/static/const.d.mts +1 -0
- package/node_modules/typebox/build/schema/static/const.mjs +2 -0
- package/node_modules/typebox/build/schema/static/enum.d.mts +1 -0
- package/node_modules/typebox/build/schema/static/enum.mjs +2 -0
- package/node_modules/typebox/build/schema/static/if.d.mts +15 -0
- package/node_modules/typebox/build/schema/static/if.mjs +2 -0
- package/node_modules/typebox/build/schema/static/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/static/index.mjs +1 -0
- package/node_modules/typebox/build/schema/static/items.d.mts +7 -0
- package/node_modules/typebox/build/schema/static/items.mjs +2 -0
- package/node_modules/typebox/build/schema/static/oneOf.d.mts +3 -0
- package/node_modules/typebox/build/schema/static/oneOf.mjs +2 -0
- package/node_modules/typebox/build/schema/static/patternProperties.d.mts +7 -0
- package/node_modules/typebox/build/schema/static/patternProperties.mjs +2 -0
- package/node_modules/typebox/build/schema/static/prefixItems.d.mts +3 -0
- package/node_modules/typebox/build/schema/static/prefixItems.mjs +2 -0
- package/node_modules/typebox/build/schema/static/properties.d.mts +32 -0
- package/node_modules/typebox/build/schema/static/properties.mjs +2 -0
- package/node_modules/typebox/build/schema/static/ref.d.mts +8 -0
- package/node_modules/typebox/build/schema/static/ref.mjs +3 -0
- package/node_modules/typebox/build/schema/static/required.d.mts +3 -0
- package/node_modules/typebox/build/schema/static/required.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +56 -0
- package/node_modules/typebox/build/schema/static/schema.mjs +2 -0
- package/node_modules/typebox/build/schema/static/static.d.mts +4 -0
- package/node_modules/typebox/build/schema/static/static.mjs +3 -0
- package/node_modules/typebox/build/schema/static/type.d.mts +4 -0
- package/node_modules/typebox/build/schema/static/type.mjs +3 -0
- package/node_modules/typebox/build/schema/static/unevaluatedProperties.d.mts +7 -0
- package/node_modules/typebox/build/schema/static/unevaluatedProperties.mjs +3 -0
- package/node_modules/typebox/build/schema/types/_guard.d.mts +10 -0
- package/node_modules/typebox/build/schema/types/_guard.mjs +16 -0
- package/node_modules/typebox/build/schema/types/_refine.d.mts +13 -0
- package/node_modules/typebox/build/schema/types/_refine.mjs +18 -0
- package/node_modules/typebox/build/schema/types/additionalItems.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/additionalItems.mjs +14 -0
- package/node_modules/typebox/build/schema/types/additionalProperties.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/additionalProperties.mjs +14 -0
- package/node_modules/typebox/build/schema/types/allOf.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/allOf.mjs +15 -0
- package/node_modules/typebox/build/schema/types/anchor.d.mts +8 -0
- package/node_modules/typebox/build/schema/types/anchor.mjs +12 -0
- package/node_modules/typebox/build/schema/types/anyOf.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/anyOf.mjs +15 -0
- package/node_modules/typebox/build/schema/types/const.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/const.mjs +12 -0
- package/node_modules/typebox/build/schema/types/contains.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/contains.mjs +14 -0
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +13 -0
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +13 -0
- package/node_modules/typebox/build/schema/types/default.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/default.mjs +12 -0
- package/node_modules/typebox/build/schema/types/defs.d.mts +6 -0
- package/node_modules/typebox/build/schema/types/defs.mjs +12 -0
- package/node_modules/typebox/build/schema/types/dependencies.d.mts +11 -0
- package/node_modules/typebox/build/schema/types/dependencies.mjs +16 -0
- package/node_modules/typebox/build/schema/types/dependentRequired.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/dependentRequired.mjs +15 -0
- package/node_modules/typebox/build/schema/types/dependentSchemas.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/dependentSchemas.mjs +15 -0
- package/node_modules/typebox/build/schema/types/dynamicAnchor.d.mts +8 -0
- package/node_modules/typebox/build/schema/types/dynamicAnchor.mjs +12 -0
- package/node_modules/typebox/build/schema/types/dynamicRef.d.mts +8 -0
- package/node_modules/typebox/build/schema/types/dynamicRef.mjs +12 -0
- package/node_modules/typebox/build/schema/types/else.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/else.mjs +14 -0
- package/node_modules/typebox/build/schema/types/enum.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/enum.mjs +13 -0
- package/node_modules/typebox/build/schema/types/exclusiveMaximum.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/exclusiveMaximum.mjs +13 -0
- package/node_modules/typebox/build/schema/types/exclusiveMinimum.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/exclusiveMinimum.mjs +13 -0
- package/node_modules/typebox/build/schema/types/format.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/format.mjs +13 -0
- package/node_modules/typebox/build/schema/types/id.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/id.mjs +13 -0
- package/node_modules/typebox/build/schema/types/if.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/if.mjs +14 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +54 -0
- package/node_modules/typebox/build/schema/types/index.mjs +60 -0
- package/node_modules/typebox/build/schema/types/items.d.mts +19 -0
- package/node_modules/typebox/build/schema/types/items.mjs +26 -0
- package/node_modules/typebox/build/schema/types/maxContains.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/maxContains.mjs +13 -0
- package/node_modules/typebox/build/schema/types/maxItems.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/maxItems.mjs +13 -0
- package/node_modules/typebox/build/schema/types/maxLength.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/maxLength.mjs +13 -0
- package/node_modules/typebox/build/schema/types/maxProperties.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/maxProperties.mjs +13 -0
- package/node_modules/typebox/build/schema/types/maximum.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/maximum.mjs +13 -0
- package/node_modules/typebox/build/schema/types/minContains.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/minContains.mjs +13 -0
- package/node_modules/typebox/build/schema/types/minItems.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/minItems.mjs +13 -0
- package/node_modules/typebox/build/schema/types/minLength.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/minLength.mjs +13 -0
- package/node_modules/typebox/build/schema/types/minProperties.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/minProperties.mjs +13 -0
- package/node_modules/typebox/build/schema/types/minimum.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/minimum.mjs +13 -0
- package/node_modules/typebox/build/schema/types/multipleOf.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/multipleOf.mjs +13 -0
- package/node_modules/typebox/build/schema/types/not.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/not.mjs +14 -0
- package/node_modules/typebox/build/schema/types/oneOf.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/oneOf.mjs +15 -0
- package/node_modules/typebox/build/schema/types/pattern.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/pattern.mjs +14 -0
- package/node_modules/typebox/build/schema/types/patternProperties.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/patternProperties.mjs +15 -0
- package/node_modules/typebox/build/schema/types/prefixItems.d.mts +8 -0
- package/node_modules/typebox/build/schema/types/prefixItems.mjs +14 -0
- package/node_modules/typebox/build/schema/types/properties.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/properties.mjs +15 -0
- package/node_modules/typebox/build/schema/types/propertyNames.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/propertyNames.mjs +15 -0
- package/node_modules/typebox/build/schema/types/recursiveAnchor.d.mts +12 -0
- package/node_modules/typebox/build/schema/types/recursiveAnchor.mjs +19 -0
- package/node_modules/typebox/build/schema/types/recursiveRef.d.mts +8 -0
- package/node_modules/typebox/build/schema/types/recursiveRef.mjs +12 -0
- package/node_modules/typebox/build/schema/types/ref.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/ref.mjs +13 -0
- package/node_modules/typebox/build/schema/types/required.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/required.mjs +14 -0
- package/node_modules/typebox/build/schema/types/schema.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/schema.mjs +14 -0
- package/node_modules/typebox/build/schema/types/then.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/then.mjs +14 -0
- package/node_modules/typebox/build/schema/types/type.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/type.mjs +15 -0
- package/node_modules/typebox/build/schema/types/unevaluatedItems.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/unevaluatedItems.mjs +14 -0
- package/node_modules/typebox/build/schema/types/unevaluatedProperties.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/unevaluatedProperties.mjs +14 -0
- package/node_modules/typebox/build/schema/types/uniqueItems.d.mts +9 -0
- package/node_modules/typebox/build/schema/types/uniqueItems.mjs +13 -0
- package/node_modules/typebox/build/system/arguments/arguments.d.mts +5 -0
- package/node_modules/typebox/build/system/arguments/arguments.mjs +9 -0
- package/node_modules/typebox/build/system/arguments/index.d.mts +1 -0
- package/node_modules/typebox/build/system/arguments/index.mjs +1 -0
- package/node_modules/typebox/build/system/environment/environment.d.mts +1 -0
- package/node_modules/typebox/build/system/environment/environment.mjs +1 -0
- package/node_modules/typebox/build/system/environment/evaluate.d.mts +9 -0
- package/node_modules/typebox/build/system/environment/evaluate.mjs +37 -0
- package/node_modules/typebox/build/system/environment/index.d.mts +1 -0
- package/node_modules/typebox/build/system/environment/index.mjs +1 -0
- package/node_modules/typebox/build/system/hashing/hash.d.mts +4 -0
- package/node_modules/typebox/build/system/hashing/hash.mjs +232 -0
- package/node_modules/typebox/build/system/hashing/index.d.mts +1 -0
- package/node_modules/typebox/build/system/hashing/index.mjs +1 -0
- package/node_modules/typebox/build/system/index.d.mts +4 -0
- package/node_modules/typebox/build/system/index.mjs +4 -0
- package/node_modules/typebox/build/system/locale/_config.d.mts +7 -0
- package/node_modules/typebox/build/system/locale/_config.mjs +15 -0
- package/node_modules/typebox/build/system/locale/_locale.d.mts +40 -0
- package/node_modules/typebox/build/system/locale/_locale.mjs +40 -0
- package/node_modules/typebox/build/system/locale/ar_001.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/ar_001.mjs +41 -0
- package/node_modules/typebox/build/system/locale/bn_BD.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/bn_BD.mjs +41 -0
- package/node_modules/typebox/build/system/locale/cs_CZ.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/cs_CZ.mjs +41 -0
- package/node_modules/typebox/build/system/locale/de_DE.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/de_DE.mjs +41 -0
- package/node_modules/typebox/build/system/locale/el_GR.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/el_GR.mjs +41 -0
- package/node_modules/typebox/build/system/locale/en_US.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/en_US.mjs +40 -0
- package/node_modules/typebox/build/system/locale/es_419.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/es_419.mjs +41 -0
- package/node_modules/typebox/build/system/locale/es_AR.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/es_AR.mjs +41 -0
- package/node_modules/typebox/build/system/locale/es_ES.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/es_ES.mjs +41 -0
- package/node_modules/typebox/build/system/locale/es_MX.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/es_MX.mjs +41 -0
- package/node_modules/typebox/build/system/locale/fa_IR.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/fa_IR.mjs +41 -0
- package/node_modules/typebox/build/system/locale/fil_PH.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/fil_PH.mjs +41 -0
- package/node_modules/typebox/build/system/locale/fr_CA.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/fr_CA.mjs +41 -0
- package/node_modules/typebox/build/system/locale/fr_FR.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/fr_FR.mjs +41 -0
- package/node_modules/typebox/build/system/locale/ha_NG.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/ha_NG.mjs +41 -0
- package/node_modules/typebox/build/system/locale/hi_IN.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/hi_IN.mjs +41 -0
- package/node_modules/typebox/build/system/locale/hu_HU.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/hu_HU.mjs +41 -0
- package/node_modules/typebox/build/system/locale/id_ID.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/id_ID.mjs +41 -0
- package/node_modules/typebox/build/system/locale/index.d.mts +1 -0
- package/node_modules/typebox/build/system/locale/index.mjs +1 -0
- package/node_modules/typebox/build/system/locale/it_IT.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/it_IT.mjs +41 -0
- package/node_modules/typebox/build/system/locale/ja_JP.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/ja_JP.mjs +41 -0
- package/node_modules/typebox/build/system/locale/ko_KR.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/ko_KR.mjs +41 -0
- package/node_modules/typebox/build/system/locale/ms_MY.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/ms_MY.mjs +41 -0
- package/node_modules/typebox/build/system/locale/nl_NL.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/nl_NL.mjs +41 -0
- package/node_modules/typebox/build/system/locale/pl_PL.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/pl_PL.mjs +41 -0
- package/node_modules/typebox/build/system/locale/pt_BR.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/pt_BR.mjs +41 -0
- package/node_modules/typebox/build/system/locale/pt_PT.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/pt_PT.mjs +41 -0
- package/node_modules/typebox/build/system/locale/ro_RO.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/ro_RO.mjs +41 -0
- package/node_modules/typebox/build/system/locale/ru_RU.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/ru_RU.mjs +41 -0
- package/node_modules/typebox/build/system/locale/sv_SE.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/sv_SE.mjs +41 -0
- package/node_modules/typebox/build/system/locale/sw_TZ.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/sw_TZ.mjs +41 -0
- package/node_modules/typebox/build/system/locale/th_TH.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/th_TH.mjs +41 -0
- package/node_modules/typebox/build/system/locale/tr_TR.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/tr_TR.mjs +41 -0
- package/node_modules/typebox/build/system/locale/uk_UA.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/uk_UA.mjs +41 -0
- package/node_modules/typebox/build/system/locale/ur_PK.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/ur_PK.mjs +41 -0
- package/node_modules/typebox/build/system/locale/vi_VN.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/vi_VN.mjs +41 -0
- package/node_modules/typebox/build/system/locale/yo_NG.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/yo_NG.mjs +41 -0
- package/node_modules/typebox/build/system/locale/zh_Hans.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/zh_Hans.mjs +41 -0
- package/node_modules/typebox/build/system/locale/zh_Hant.d.mts +3 -0
- package/node_modules/typebox/build/system/locale/zh_Hant.mjs +41 -0
- package/node_modules/typebox/build/system/memory/assign.d.mts +14 -0
- package/node_modules/typebox/build/system/memory/assign.mjs +11 -0
- package/node_modules/typebox/build/system/memory/clone.d.mts +6 -0
- package/node_modules/typebox/build/system/memory/clone.mjs +63 -0
- package/node_modules/typebox/build/system/memory/create.d.mts +8 -0
- package/node_modules/typebox/build/system/memory/create.mjs +30 -0
- package/node_modules/typebox/build/system/memory/discard.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/discard.mjs +17 -0
- package/node_modules/typebox/build/system/memory/index.d.mts +1 -0
- package/node_modules/typebox/build/system/memory/index.mjs +1 -0
- package/node_modules/typebox/build/system/memory/memory.d.mts +6 -0
- package/node_modules/typebox/build/system/memory/memory.mjs +7 -0
- package/node_modules/typebox/build/system/memory/metrics.d.mts +14 -0
- package/node_modules/typebox/build/system/memory/metrics.mjs +8 -0
- package/node_modules/typebox/build/system/memory/update.d.mts +7 -0
- package/node_modules/typebox/build/system/memory/update.mjs +32 -0
- package/node_modules/typebox/build/system/settings/index.d.mts +1 -0
- package/node_modules/typebox/build/system/settings/index.mjs +1 -0
- package/node_modules/typebox/build/system/settings/settings.d.mts +56 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +32 -0
- package/node_modules/typebox/build/system/system.d.mts +6 -0
- package/node_modules/typebox/build/system/system.mjs +6 -0
- package/node_modules/typebox/build/system/unreachable/index.d.mts +1 -0
- package/node_modules/typebox/build/system/unreachable/index.mjs +1 -0
- package/node_modules/typebox/build/system/unreachable/unreachable.d.mts +3 -0
- package/node_modules/typebox/build/system/unreachable/unreachable.mjs +6 -0
- package/node_modules/typebox/build/type/action/_optional.d.mts +19 -0
- package/node_modules/typebox/build/type/action/_optional.mjs +40 -0
- package/node_modules/typebox/build/type/action/_readonly.d.mts +19 -0
- package/node_modules/typebox/build/type/action/_readonly.mjs +40 -0
- package/node_modules/typebox/build/type/action/awaited.d.mts +15 -0
- package/node_modules/typebox/build/type/action/awaited.mjs +15 -0
- package/node_modules/typebox/build/type/action/capitalize.d.mts +11 -0
- package/node_modules/typebox/build/type/action/capitalize.mjs +11 -0
- package/node_modules/typebox/build/type/action/conditional.d.mts +13 -0
- package/node_modules/typebox/build/type/action/conditional.mjs +12 -0
- package/node_modules/typebox/build/type/action/constructor_parameters.d.mts +11 -0
- package/node_modules/typebox/build/type/action/constructor_parameters.mjs +11 -0
- package/node_modules/typebox/build/type/action/evaluate.d.mts +11 -0
- package/node_modules/typebox/build/type/action/evaluate.mjs +11 -0
- package/node_modules/typebox/build/type/action/exclude.d.mts +11 -0
- package/node_modules/typebox/build/type/action/exclude.mjs +11 -0
- package/node_modules/typebox/build/type/action/extract.d.mts +11 -0
- package/node_modules/typebox/build/type/action/extract.mjs +11 -0
- package/node_modules/typebox/build/type/action/index.d.mts +27 -0
- package/node_modules/typebox/build/type/action/index.mjs +27 -0
- package/node_modules/typebox/build/type/action/indexed.d.mts +14 -0
- package/node_modules/typebox/build/type/action/indexed.mjs +14 -0
- package/node_modules/typebox/build/type/action/instance_type.d.mts +11 -0
- package/node_modules/typebox/build/type/action/instance_type.mjs +11 -0
- package/node_modules/typebox/build/type/action/interface.d.mts +14 -0
- package/node_modules/typebox/build/type/action/interface.mjs +22 -0
- package/node_modules/typebox/build/type/action/keyof.d.mts +11 -0
- package/node_modules/typebox/build/type/action/keyof.mjs +11 -0
- package/node_modules/typebox/build/type/action/lowercase.d.mts +11 -0
- package/node_modules/typebox/build/type/action/lowercase.mjs +11 -0
- package/node_modules/typebox/build/type/action/mapped.d.mts +14 -0
- package/node_modules/typebox/build/type/action/mapped.mjs +12 -0
- package/node_modules/typebox/build/type/action/module.d.mts +12 -0
- package/node_modules/typebox/build/type/action/module.mjs +12 -0
- package/node_modules/typebox/build/type/action/non_nullable.d.mts +11 -0
- package/node_modules/typebox/build/type/action/non_nullable.mjs +11 -0
- package/node_modules/typebox/build/type/action/omit.d.mts +14 -0
- package/node_modules/typebox/build/type/action/omit.mjs +14 -0
- package/node_modules/typebox/build/type/action/options.d.mts +11 -0
- package/node_modules/typebox/build/type/action/options.mjs +11 -0
- package/node_modules/typebox/build/type/action/parameters.d.mts +11 -0
- package/node_modules/typebox/build/type/action/parameters.mjs +11 -0
- package/node_modules/typebox/build/type/action/partial.d.mts +11 -0
- package/node_modules/typebox/build/type/action/partial.mjs +11 -0
- package/node_modules/typebox/build/type/action/pick.d.mts +14 -0
- package/node_modules/typebox/build/type/action/pick.mjs +14 -0
- package/node_modules/typebox/build/type/action/readonly_object.d.mts +16 -0
- package/node_modules/typebox/build/type/action/readonly_object.mjs +16 -0
- package/node_modules/typebox/build/type/action/required.d.mts +11 -0
- package/node_modules/typebox/build/type/action/required.mjs +11 -0
- package/node_modules/typebox/build/type/action/return_type.d.mts +11 -0
- package/node_modules/typebox/build/type/action/return_type.mjs +11 -0
- package/node_modules/typebox/build/type/action/uncapitalize.d.mts +11 -0
- package/node_modules/typebox/build/type/action/uncapitalize.mjs +11 -0
- package/node_modules/typebox/build/type/action/uppercase.d.mts +11 -0
- package/node_modules/typebox/build/type/action/uppercase.mjs +11 -0
- package/node_modules/typebox/build/type/engine/awaited/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/awaited/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/awaited/instantiate.d.mts +11 -0
- package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +20 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +15 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +53 -0
- package/node_modules/typebox/build/type/engine/call/instantiate.d.mts +23 -0
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +48 -0
- package/node_modules/typebox/build/type/engine/call/resolve_arguments.d.mts +13 -0
- package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +33 -0
- package/node_modules/typebox/build/type/engine/call/resolve_target.d.mts +25 -0
- package/node_modules/typebox/build/type/engine/call/resolve_target.mjs +27 -0
- package/node_modules/typebox/build/type/engine/conditional/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/conditional/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/conditional/instantiate.d.mts +12 -0
- package/node_modules/typebox/build/type/engine/conditional/instantiate.mjs +23 -0
- package/node_modules/typebox/build/type/engine/constructor_parameters/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/constructor_parameters/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.d.mts +15 -0
- package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +24 -0
- package/node_modules/typebox/build/type/engine/cyclic/candidates.d.mts +9 -0
- package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +19 -0
- package/node_modules/typebox/build/type/engine/cyclic/check.d.mts +24 -0
- package/node_modules/typebox/build/type/engine/cyclic/check.mjs +51 -0
- package/node_modules/typebox/build/type/engine/cyclic/dependencies.d.mts +25 -0
- package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +53 -0
- package/node_modules/typebox/build/type/engine/cyclic/extends.d.mts +31 -0
- package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +53 -0
- package/node_modules/typebox/build/type/engine/cyclic/index.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/cyclic/index.mjs +6 -0
- package/node_modules/typebox/build/type/engine/cyclic/instantiate.d.mts +20 -0
- package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +30 -0
- package/node_modules/typebox/build/type/engine/cyclic/target.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/cyclic/target.mjs +16 -0
- package/node_modules/typebox/build/type/engine/enum/enum_to_union.d.mts +14 -0
- package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +24 -0
- package/node_modules/typebox/build/type/engine/enum/index.d.mts +2 -0
- package/node_modules/typebox/build/type/engine/enum/index.mjs +2 -0
- package/node_modules/typebox/build/type/engine/enum/typescript_enum_to_enum_values.d.mts +8 -0
- package/node_modules/typebox/build/type/engine/enum/typescript_enum_to_enum_values.mjs +9 -0
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +16 -0
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +47 -0
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +15 -0
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +22 -0
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +30 -0
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +63 -0
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +27 -0
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +45 -0
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +14 -0
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +27 -0
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +11 -0
- package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +8 -0
- package/node_modules/typebox/build/type/engine/evaluate/index.mjs +8 -0
- package/node_modules/typebox/build/type/engine/evaluate/instantiate.d.mts +8 -0
- package/node_modules/typebox/build/type/engine/evaluate/instantiate.mjs +12 -0
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +11 -0
- package/node_modules/typebox/build/type/engine/exclude/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/exclude/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/exclude/instantiate.d.mts +9 -0
- package/node_modules/typebox/build/type/engine/exclude/instantiate.mjs +16 -0
- package/node_modules/typebox/build/type/engine/exclude/operation.d.mts +11 -0
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +24 -0
- package/node_modules/typebox/build/type/engine/extract/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/extract/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/extract/instantiate.d.mts +9 -0
- package/node_modules/typebox/build/type/engine/extract/instantiate.mjs +16 -0
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +11 -0
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +24 -0
- package/node_modules/typebox/build/type/engine/helpers/index.d.mts +3 -0
- package/node_modules/typebox/build/type/engine/helpers/index.mjs +3 -0
- package/node_modules/typebox/build/type/engine/helpers/keys.d.mts +3 -0
- package/node_modules/typebox/build/type/engine/helpers/keys.mjs +8 -0
- package/node_modules/typebox/build/type/engine/helpers/keys_to_indexer.d.mts +7 -0
- package/node_modules/typebox/build/type/engine/helpers/keys_to_indexer.mjs +15 -0
- package/node_modules/typebox/build/type/engine/helpers/union.d.mts +7 -0
- package/node_modules/typebox/build/type/engine/helpers/union.mjs +3 -0
- package/node_modules/typebox/build/type/engine/index.d.mts +31 -0
- package/node_modules/typebox/build/type/engine/index.mjs +37 -0
- package/node_modules/typebox/build/type/engine/indexable/from_cyclic.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/indexable/from_cyclic.mjs +8 -0
- package/node_modules/typebox/build/type/engine/indexable/from_enum.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +8 -0
- package/node_modules/typebox/build/type/engine/indexable/from_intersect.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/indexable/from_intersect.mjs +8 -0
- package/node_modules/typebox/build/type/engine/indexable/from_literal.d.mts +3 -0
- package/node_modules/typebox/build/type/engine/indexable/from_literal.mjs +5 -0
- package/node_modules/typebox/build/type/engine/indexable/from_template_literal.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +8 -0
- package/node_modules/typebox/build/type/engine/indexable/from_type.d.mts +17 -0
- package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +22 -0
- package/node_modules/typebox/build/type/engine/indexable/from_union.d.mts +4 -0
- package/node_modules/typebox/build/type/engine/indexable/from_union.mjs +7 -0
- package/node_modules/typebox/build/type/engine/indexable/to_indexable.d.mts +9 -0
- package/node_modules/typebox/build/type/engine/indexable/to_indexable.mjs +14 -0
- package/node_modules/typebox/build/type/engine/indexable/to_indexable_keys.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/indexable/to_indexable_keys.mjs +12 -0
- package/node_modules/typebox/build/type/engine/indexed/array_indexer.d.mts +12 -0
- package/node_modules/typebox/build/type/engine/indexed/array_indexer.mjs +18 -0
- package/node_modules/typebox/build/type/engine/indexed/from_array.d.mts +15 -0
- package/node_modules/typebox/build/type/engine/indexed/from_array.mjs +35 -0
- package/node_modules/typebox/build/type/engine/indexed/from_object.d.mts +16 -0
- package/node_modules/typebox/build/type/engine/indexed/from_object.mjs +40 -0
- package/node_modules/typebox/build/type/engine/indexed/from_tuple.d.mts +13 -0
- package/node_modules/typebox/build/type/engine/indexed/from_tuple.mjs +35 -0
- package/node_modules/typebox/build/type/engine/indexed/from_type.d.mts +11 -0
- package/node_modules/typebox/build/type/engine/indexed/from_type.mjs +14 -0
- package/node_modules/typebox/build/type/engine/indexed/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/indexed/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/indexed/instantiate.d.mts +15 -0
- package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +25 -0
- package/node_modules/typebox/build/type/engine/instance_type/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/instance_type/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/instance_type/instantiate.d.mts +12 -0
- package/node_modules/typebox/build/type/engine/instance_type/instantiate.mjs +21 -0
- package/node_modules/typebox/build/type/engine/instantiate.d.mts +165 -0
- package/node_modules/typebox/build/type/engine/instantiate.mjs +159 -0
- package/node_modules/typebox/build/type/engine/interface/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/interface/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/interface/instantiate.d.mts +18 -0
- package/node_modules/typebox/build/type/engine/interface/instantiate.mjs +23 -0
- package/node_modules/typebox/build/type/engine/intrinsics/from_literal.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/intrinsics/from_literal.mjs +9 -0
- package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +8 -0
- package/node_modules/typebox/build/type/engine/intrinsics/from_type.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/intrinsics/from_type.mjs +13 -0
- package/node_modules/typebox/build/type/engine/intrinsics/from_union.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/intrinsics/from_union.mjs +7 -0
- package/node_modules/typebox/build/type/engine/intrinsics/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/intrinsics/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/intrinsics/instantiate.d.mts +38 -0
- package/node_modules/typebox/build/type/engine/intrinsics/instantiate.mjs +52 -0
- package/node_modules/typebox/build/type/engine/intrinsics/mapping.d.mts +9 -0
- package/node_modules/typebox/build/type/engine/intrinsics/mapping.mjs +4 -0
- package/node_modules/typebox/build/type/engine/keyof/from_any.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/keyof/from_any.mjs +8 -0
- package/node_modules/typebox/build/type/engine/keyof/from_array.d.mts +4 -0
- package/node_modules/typebox/build/type/engine/keyof/from_array.mjs +5 -0
- package/node_modules/typebox/build/type/engine/keyof/from_object.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/keyof/from_object.mjs +20 -0
- package/node_modules/typebox/build/type/engine/keyof/from_record.d.mts +4 -0
- package/node_modules/typebox/build/type/engine/keyof/from_record.mjs +5 -0
- package/node_modules/typebox/build/type/engine/keyof/from_tuple.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/keyof/from_tuple.mjs +7 -0
- package/node_modules/typebox/build/type/engine/keyof/from_type.d.mts +15 -0
- package/node_modules/typebox/build/type/engine/keyof/from_type.mjs +23 -0
- package/node_modules/typebox/build/type/engine/keyof/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/keyof/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/keyof/instantiate.d.mts +15 -0
- package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +25 -0
- package/node_modules/typebox/build/type/engine/mapped/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/mapped/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/mapped/instantiate.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/mapped/instantiate.mjs +15 -0
- package/node_modules/typebox/build/type/engine/mapped/mapped_operation.d.mts +22 -0
- package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +42 -0
- package/node_modules/typebox/build/type/engine/mapped/mapped_variants.d.mts +16 -0
- package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +34 -0
- package/node_modules/typebox/build/type/engine/module/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/module/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/module/instantiate.d.mts +21 -0
- package/node_modules/typebox/build/type/engine/module/instantiate.mjs +34 -0
- package/node_modules/typebox/build/type/engine/non_nullable/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/non_nullable/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/non_nullable/instantiate.d.mts +14 -0
- package/node_modules/typebox/build/type/engine/non_nullable/instantiate.mjs +22 -0
- package/node_modules/typebox/build/type/engine/object/collapse.d.mts +12 -0
- package/node_modules/typebox/build/type/engine/object/collapse.mjs +14 -0
- package/node_modules/typebox/build/type/engine/object/from_cyclic.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/object/from_cyclic.mjs +8 -0
- package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +17 -0
- package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +22 -0
- package/node_modules/typebox/build/type/engine/object/from_object.d.mts +3 -0
- package/node_modules/typebox/build/type/engine/object/from_object.mjs +4 -0
- package/node_modules/typebox/build/type/engine/object/from_tuple.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/object/from_tuple.mjs +9 -0
- package/node_modules/typebox/build/type/engine/object/from_type.d.mts +14 -0
- package/node_modules/typebox/build/type/engine/object/from_type.mjs +20 -0
- package/node_modules/typebox/build/type/engine/object/from_union.d.mts +12 -0
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +19 -0
- package/node_modules/typebox/build/type/engine/object/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/object/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/omit/from_type.d.mts +12 -0
- package/node_modules/typebox/build/type/engine/omit/from_type.mjs +18 -0
- package/node_modules/typebox/build/type/engine/omit/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/omit/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/omit/instantiate.d.mts +9 -0
- package/node_modules/typebox/build/type/engine/omit/instantiate.mjs +16 -0
- package/node_modules/typebox/build/type/engine/options/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/options/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/options/instantiate.d.mts +8 -0
- package/node_modules/typebox/build/type/engine/options/instantiate.mjs +14 -0
- package/node_modules/typebox/build/type/engine/parameters/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/parameters/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/parameters/instantiate.d.mts +15 -0
- package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +24 -0
- package/node_modules/typebox/build/type/engine/partial/from_cyclic.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/partial/from_cyclic.mjs +11 -0
- package/node_modules/typebox/build/type/engine/partial/from_intersect.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +7 -0
- package/node_modules/typebox/build/type/engine/partial/from_object.d.mts +8 -0
- package/node_modules/typebox/build/type/engine/partial/from_object.mjs +11 -0
- package/node_modules/typebox/build/type/engine/partial/from_type.d.mts +12 -0
- package/node_modules/typebox/build/type/engine/partial/from_type.mjs +17 -0
- package/node_modules/typebox/build/type/engine/partial/from_union.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/partial/from_union.mjs +7 -0
- package/node_modules/typebox/build/type/engine/partial/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/partial/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/partial/instantiate.d.mts +9 -0
- package/node_modules/typebox/build/type/engine/partial/instantiate.mjs +15 -0
- package/node_modules/typebox/build/type/engine/patterns/index.d.mts +2 -0
- package/node_modules/typebox/build/type/engine/patterns/index.mjs +2 -0
- package/node_modules/typebox/build/type/engine/patterns/pattern.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/patterns/pattern.mjs +11 -0
- package/node_modules/typebox/build/type/engine/patterns/template.d.mts +7 -0
- package/node_modules/typebox/build/type/engine/patterns/template.mjs +20 -0
- package/node_modules/typebox/build/type/engine/pick/from_type.d.mts +13 -0
- package/node_modules/typebox/build/type/engine/pick/from_type.mjs +20 -0
- package/node_modules/typebox/build/type/engine/pick/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/pick/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/pick/instantiate.d.mts +9 -0
- package/node_modules/typebox/build/type/engine/pick/instantiate.mjs +16 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_array.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +7 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_cyclic.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_cyclic.mjs +11 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +7 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_object.d.mts +8 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +11 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +7 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_type.d.mts +16 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +22 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_union.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/readonly_object/from_union.mjs +7 -0
- package/node_modules/typebox/build/type/engine/readonly_object/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/readonly_object/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/readonly_object/instantiate.d.mts +9 -0
- package/node_modules/typebox/build/type/engine/readonly_object/instantiate.mjs +15 -0
- package/node_modules/typebox/build/type/engine/record/from_key.d.mts +24 -0
- package/node_modules/typebox/build/type/engine/record/from_key.mjs +40 -0
- package/node_modules/typebox/build/type/engine/record/from_key_any.d.mts +4 -0
- package/node_modules/typebox/build/type/engine/record/from_key_any.mjs +6 -0
- package/node_modules/typebox/build/type/engine/record/from_key_boolean.d.mts +7 -0
- package/node_modules/typebox/build/type/engine/record/from_key_boolean.mjs +5 -0
- package/node_modules/typebox/build/type/engine/record/from_key_enum.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +8 -0
- package/node_modules/typebox/build/type/engine/record/from_key_integer.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/record/from_key_integer.mjs +7 -0
- package/node_modules/typebox/build/type/engine/record/from_key_intersect.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/record/from_key_intersect.mjs +8 -0
- package/node_modules/typebox/build/type/engine/record/from_key_literal.d.mts +11 -0
- package/node_modules/typebox/build/type/engine/record/from_key_literal.mjs +10 -0
- package/node_modules/typebox/build/type/engine/record/from_key_number.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/record/from_key_number.mjs +7 -0
- package/node_modules/typebox/build/type/engine/record/from_key_string.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/record/from_key_string.mjs +12 -0
- package/node_modules/typebox/build/type/engine/record/from_key_template_literal.d.mts +8 -0
- package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +12 -0
- package/node_modules/typebox/build/type/engine/record/from_key_union.d.mts +20 -0
- package/node_modules/typebox/build/type/engine/record/from_key_union.mjs +39 -0
- package/node_modules/typebox/build/type/engine/record/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/record/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/record/instantiate.d.mts +9 -0
- package/node_modules/typebox/build/type/engine/record/instantiate.mjs +17 -0
- package/node_modules/typebox/build/type/engine/record/record_create.d.mts +3 -0
- package/node_modules/typebox/build/type/engine/record/record_create.mjs +7 -0
- package/node_modules/typebox/build/type/engine/ref/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/ref/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/ref/instantiate.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +10 -0
- package/node_modules/typebox/build/type/engine/required/from_cyclic.d.mts +10 -0
- package/node_modules/typebox/build/type/engine/required/from_cyclic.mjs +11 -0
- package/node_modules/typebox/build/type/engine/required/from_intersect.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +7 -0
- package/node_modules/typebox/build/type/engine/required/from_object.d.mts +8 -0
- package/node_modules/typebox/build/type/engine/required/from_object.mjs +11 -0
- package/node_modules/typebox/build/type/engine/required/from_type.d.mts +12 -0
- package/node_modules/typebox/build/type/engine/required/from_type.mjs +17 -0
- package/node_modules/typebox/build/type/engine/required/from_union.d.mts +5 -0
- package/node_modules/typebox/build/type/engine/required/from_union.mjs +7 -0
- package/node_modules/typebox/build/type/engine/required/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/required/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/required/instantiate.d.mts +9 -0
- package/node_modules/typebox/build/type/engine/required/instantiate.mjs +15 -0
- package/node_modules/typebox/build/type/engine/rest/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/rest/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/rest/spread.d.mts +12 -0
- package/node_modules/typebox/build/type/engine/rest/spread.mjs +19 -0
- package/node_modules/typebox/build/type/engine/return_type/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/return_type/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/return_type/instantiate.d.mts +12 -0
- package/node_modules/typebox/build/type/engine/return_type/instantiate.mjs +21 -0
- package/node_modules/typebox/build/type/engine/template_literal/create.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/template_literal/create.mjs +5 -0
- package/node_modules/typebox/build/type/engine/template_literal/decode.d.mts +30 -0
- package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +81 -0
- package/node_modules/typebox/build/type/engine/template_literal/encode.d.mts +33 -0
- package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +81 -0
- package/node_modules/typebox/build/type/engine/template_literal/index.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/template_literal/index.mjs +6 -0
- package/node_modules/typebox/build/type/engine/template_literal/instantiate.d.mts +9 -0
- package/node_modules/typebox/build/type/engine/template_literal/instantiate.mjs +15 -0
- package/node_modules/typebox/build/type/engine/template_literal/is_finite.d.mts +12 -0
- package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +26 -0
- package/node_modules/typebox/build/type/engine/template_literal/is_pattern.d.mts +6 -0
- package/node_modules/typebox/build/type/engine/template_literal/is_pattern.mjs +9 -0
- package/node_modules/typebox/build/type/engine/template_literal/static.d.mts +18 -0
- package/node_modules/typebox/build/type/engine/template_literal/static.mjs +2 -0
- package/node_modules/typebox/build/type/engine/this/expand_this.d.mts +19 -0
- package/node_modules/typebox/build/type/engine/this/expand_this.mjs +32 -0
- package/node_modules/typebox/build/type/engine/tuple/to_object.d.mts +12 -0
- package/node_modules/typebox/build/type/engine/tuple/to_object.mjs +14 -0
- package/node_modules/typebox/build/type/extends/any.d.mts +9 -0
- package/node_modules/typebox/build/type/extends/any.mjs +12 -0
- package/node_modules/typebox/build/type/extends/array.d.mts +20 -0
- package/node_modules/typebox/build/type/extends/array.mjs +21 -0
- package/node_modules/typebox/build/type/extends/async_iterator.d.mts +7 -0
- package/node_modules/typebox/build/type/extends/async_iterator.mjs +9 -0
- package/node_modules/typebox/build/type/extends/bigint.d.mts +7 -0
- package/node_modules/typebox/build/type/extends/bigint.mjs +9 -0
- package/node_modules/typebox/build/type/extends/boolean.d.mts +7 -0
- package/node_modules/typebox/build/type/extends/boolean.mjs +9 -0
- package/node_modules/typebox/build/type/extends/constructor.d.mts +10 -0
- package/node_modules/typebox/build/type/extends/constructor.mjs +17 -0
- package/node_modules/typebox/build/type/extends/enum.d.mts +7 -0
- package/node_modules/typebox/build/type/extends/enum.mjs +6 -0
- package/node_modules/typebox/build/type/extends/extends.d.mts +13 -0
- package/node_modules/typebox/build/type/extends/extends.mjs +17 -0
- package/node_modules/typebox/build/type/extends/extends_left.d.mts +55 -0
- package/node_modules/typebox/build/type/extends/extends_left.mjs +83 -0
- package/node_modules/typebox/build/type/extends/extends_right.d.mts +25 -0
- package/node_modules/typebox/build/type/extends/extends_right.mjs +44 -0
- package/node_modules/typebox/build/type/extends/function.d.mts +10 -0
- package/node_modules/typebox/build/type/extends/function.mjs +17 -0
- package/node_modules/typebox/build/type/extends/index.d.mts +2 -0
- package/node_modules/typebox/build/type/extends/index.mjs +2 -0
- package/node_modules/typebox/build/type/extends/inference.d.mts +34 -0
- package/node_modules/typebox/build/type/extends/inference.mjs +62 -0
- package/node_modules/typebox/build/type/extends/integer.d.mts +8 -0
- package/node_modules/typebox/build/type/extends/integer.mjs +10 -0
- package/node_modules/typebox/build/type/extends/intersect.d.mts +6 -0
- package/node_modules/typebox/build/type/extends/intersect.mjs +15 -0
- package/node_modules/typebox/build/type/extends/iterator.d.mts +7 -0
- package/node_modules/typebox/build/type/extends/iterator.mjs +9 -0
- package/node_modules/typebox/build/type/extends/literal.d.mts +18 -0
- package/node_modules/typebox/build/type/extends/literal.mjs +44 -0
- package/node_modules/typebox/build/type/extends/never.d.mts +8 -0
- package/node_modules/typebox/build/type/extends/never.mjs +9 -0
- package/node_modules/typebox/build/type/extends/null.d.mts +7 -0
- package/node_modules/typebox/build/type/extends/null.mjs +9 -0
- package/node_modules/typebox/build/type/extends/number.d.mts +7 -0
- package/node_modules/typebox/build/type/extends/number.mjs +9 -0
- package/node_modules/typebox/build/type/extends/object.d.mts +25 -0
- package/node_modules/typebox/build/type/extends/object.mjs +87 -0
- package/node_modules/typebox/build/type/extends/parameters.d.mts +15 -0
- package/node_modules/typebox/build/type/extends/parameters.mjs +28 -0
- package/node_modules/typebox/build/type/extends/promise.d.mts +7 -0
- package/node_modules/typebox/build/type/extends/promise.mjs +9 -0
- package/node_modules/typebox/build/type/extends/result.d.mts +24 -0
- package/node_modules/typebox/build/type/extends/result.mjs +36 -0
- package/node_modules/typebox/build/type/extends/return_type.d.mts +7 -0
- package/node_modules/typebox/build/type/extends/return_type.mjs +9 -0
- package/node_modules/typebox/build/type/extends/string.d.mts +7 -0
- package/node_modules/typebox/build/type/extends/string.mjs +9 -0
- package/node_modules/typebox/build/type/extends/symbol.d.mts +7 -0
- package/node_modules/typebox/build/type/extends/symbol.mjs +9 -0
- package/node_modules/typebox/build/type/extends/template_literal.d.mts +6 -0
- package/node_modules/typebox/build/type/extends/template_literal.mjs +7 -0
- package/node_modules/typebox/build/type/extends/tuple.d.mts +25 -0
- package/node_modules/typebox/build/type/extends/tuple.mjs +60 -0
- package/node_modules/typebox/build/type/extends/undefined.d.mts +8 -0
- package/node_modules/typebox/build/type/extends/undefined.mjs +10 -0
- package/node_modules/typebox/build/type/extends/union.d.mts +11 -0
- package/node_modules/typebox/build/type/extends/union.mjs +24 -0
- package/node_modules/typebox/build/type/extends/unknown.d.mts +9 -0
- package/node_modules/typebox/build/type/extends/unknown.mjs +12 -0
- package/node_modules/typebox/build/type/extends/void.d.mts +7 -0
- package/node_modules/typebox/build/type/extends/void.mjs +9 -0
- package/node_modules/typebox/build/type/index.d.mts +5 -0
- package/node_modules/typebox/build/type/index.mjs +5 -0
- package/node_modules/typebox/build/type/script/index.d.mts +1 -0
- package/node_modules/typebox/build/type/script/index.mjs +1 -0
- package/node_modules/typebox/build/type/script/mapping.d.mts +365 -0
- package/node_modules/typebox/build/type/script/mapping.mjs +532 -0
- package/node_modules/typebox/build/type/script/parser.d.mts +260 -0
- package/node_modules/typebox/build/type/script/parser.mjs +135 -0
- package/node_modules/typebox/build/type/script/script.d.mts +17 -0
- package/node_modules/typebox/build/type/script/script.mjs +21 -0
- package/node_modules/typebox/build/type/script/token/bigint.d.mts +8 -0
- package/node_modules/typebox/build/type/script/token/bigint.mjs +14 -0
- package/node_modules/typebox/build/type/script/token/const.d.mts +11 -0
- package/node_modules/typebox/build/type/script/token/const.mjs +18 -0
- package/node_modules/typebox/build/type/script/token/ident.d.mts +16 -0
- package/node_modules/typebox/build/type/script/token/ident.mjs +26 -0
- package/node_modules/typebox/build/type/script/token/index.d.mts +12 -0
- package/node_modules/typebox/build/type/script/token/index.mjs +12 -0
- package/node_modules/typebox/build/type/script/token/integer.d.mts +11 -0
- package/node_modules/typebox/build/type/script/token/integer.mjs +19 -0
- package/node_modules/typebox/build/type/script/token/internal/char.d.mts +75 -0
- package/node_modules/typebox/build/type/script/token/internal/char.mjs +26 -0
- package/node_modules/typebox/build/type/script/token/internal/guard.d.mts +1 -0
- package/node_modules/typebox/build/type/script/token/internal/guard.mjs +15 -0
- package/node_modules/typebox/build/type/script/token/internal/many.d.mts +7 -0
- package/node_modules/typebox/build/type/script/token/internal/many.mjs +14 -0
- package/node_modules/typebox/build/type/script/token/internal/match.d.mts +6 -0
- package/node_modules/typebox/build/type/script/token/internal/match.mjs +11 -0
- package/node_modules/typebox/build/type/script/token/internal/optional.d.mts +5 -0
- package/node_modules/typebox/build/type/script/token/internal/optional.mjs +9 -0
- package/node_modules/typebox/build/type/script/token/internal/take.d.mts +6 -0
- package/node_modules/typebox/build/type/script/token/internal/take.mjs +30 -0
- package/node_modules/typebox/build/type/script/token/internal/trim.d.mts +19 -0
- package/node_modules/typebox/build/type/script/token/internal/trim.mjs +34 -0
- package/node_modules/typebox/build/type/script/token/number.d.mts +11 -0
- package/node_modules/typebox/build/type/script/token/number.mjs +19 -0
- package/node_modules/typebox/build/type/script/token/rest.d.mts +4 -0
- package/node_modules/typebox/build/type/script/token/rest.mjs +9 -0
- package/node_modules/typebox/build/type/script/token/span.d.mts +11 -0
- package/node_modules/typebox/build/type/script/token/span.mjs +24 -0
- package/node_modules/typebox/build/type/script/token/string.d.mts +11 -0
- package/node_modules/typebox/build/type/script/token/string.mjs +20 -0
- package/node_modules/typebox/build/type/script/token/unsigned_integer.d.mts +16 -0
- package/node_modules/typebox/build/type/script/token/unsigned_integer.mjs +26 -0
- package/node_modules/typebox/build/type/script/token/unsigned_number.d.mts +17 -0
- package/node_modules/typebox/build/type/script/token/unsigned_number.mjs +38 -0
- package/node_modules/typebox/build/type/script/token/until.d.mts +7 -0
- package/node_modules/typebox/build/type/script/token/until.mjs +21 -0
- package/node_modules/typebox/build/type/script/token/until_1.d.mts +5 -0
- package/node_modules/typebox/build/type/script/token/until_1.mjs +12 -0
- package/node_modules/typebox/build/type/types/_codec.d.mts +30 -0
- package/node_modules/typebox/build/type/types/_codec.mjs +61 -0
- package/node_modules/typebox/build/type/types/_immutable.d.mts +16 -0
- package/node_modules/typebox/build/type/types/_immutable.mjs +26 -0
- package/node_modules/typebox/build/type/types/_optional.d.mts +16 -0
- package/node_modules/typebox/build/type/types/_optional.mjs +27 -0
- package/node_modules/typebox/build/type/types/_readonly.d.mts +16 -0
- package/node_modules/typebox/build/type/types/_readonly.mjs +26 -0
- package/node_modules/typebox/build/type/types/_refine.d.mts +26 -0
- package/node_modules/typebox/build/type/types/_refine.mjs +37 -0
- package/node_modules/typebox/build/type/types/any.d.mts +10 -0
- package/node_modules/typebox/build/type/types/any.mjs +18 -0
- package/node_modules/typebox/build/type/types/array.d.mts +18 -0
- package/node_modules/typebox/build/type/types/array.mjs +25 -0
- package/node_modules/typebox/build/type/types/async_iterator.d.mts +20 -0
- package/node_modules/typebox/build/type/types/async_iterator.mjs +28 -0
- package/node_modules/typebox/build/type/types/base.d.mts +50 -0
- package/node_modules/typebox/build/type/types/base.mjs +84 -0
- package/node_modules/typebox/build/type/types/bigint.d.mts +12 -0
- package/node_modules/typebox/build/type/types/bigint.mjs +21 -0
- package/node_modules/typebox/build/type/types/boolean.d.mts +11 -0
- package/node_modules/typebox/build/type/types/boolean.mjs +17 -0
- package/node_modules/typebox/build/type/types/call.d.mts +16 -0
- package/node_modules/typebox/build/type/types/call.mjs +22 -0
- package/node_modules/typebox/build/type/types/constructor.d.mts +18 -0
- package/node_modules/typebox/build/type/types/constructor.mjs +24 -0
- package/node_modules/typebox/build/type/types/cyclic.d.mts +16 -0
- package/node_modules/typebox/build/type/types/cyclic.mjs +29 -0
- package/node_modules/typebox/build/type/types/deferred.d.mts +12 -0
- package/node_modules/typebox/build/type/types/deferred.mjs +16 -0
- package/node_modules/typebox/build/type/types/enum.d.mts +16 -0
- package/node_modules/typebox/build/type/types/enum.mjs +17 -0
- package/node_modules/typebox/build/type/types/function.d.mts +21 -0
- package/node_modules/typebox/build/type/types/function.mjs +25 -0
- package/node_modules/typebox/build/type/types/generic.d.mts +13 -0
- package/node_modules/typebox/build/type/types/generic.mjs +17 -0
- package/node_modules/typebox/build/type/types/identifier.d.mts +11 -0
- package/node_modules/typebox/build/type/types/identifier.mjs +17 -0
- package/node_modules/typebox/build/type/types/index.d.mts +48 -0
- package/node_modules/typebox/build/type/types/index.mjs +54 -0
- package/node_modules/typebox/build/type/types/infer.d.mts +15 -0
- package/node_modules/typebox/build/type/types/infer.mjs +20 -0
- package/node_modules/typebox/build/type/types/integer.d.mts +12 -0
- package/node_modules/typebox/build/type/types/integer.mjs +21 -0
- package/node_modules/typebox/build/type/types/intersect.d.mts +15 -0
- package/node_modules/typebox/build/type/types/intersect.mjs +24 -0
- package/node_modules/typebox/build/type/types/iterator.d.mts +20 -0
- package/node_modules/typebox/build/type/types/iterator.mjs +28 -0
- package/node_modules/typebox/build/type/types/literal.d.mts +31 -0
- package/node_modules/typebox/build/type/types/literal.mjs +62 -0
- package/node_modules/typebox/build/type/types/never.d.mts +12 -0
- package/node_modules/typebox/build/type/types/never.mjs +22 -0
- package/node_modules/typebox/build/type/types/null.d.mts +11 -0
- package/node_modules/typebox/build/type/types/null.mjs +17 -0
- package/node_modules/typebox/build/type/types/number.d.mts +12 -0
- package/node_modules/typebox/build/type/types/number.mjs +21 -0
- package/node_modules/typebox/build/type/types/object.d.mts +18 -0
- package/node_modules/typebox/build/type/types/object.mjs +28 -0
- package/node_modules/typebox/build/type/types/parameter.d.mts +17 -0
- package/node_modules/typebox/build/type/types/parameter.mjs +21 -0
- package/node_modules/typebox/build/type/types/promise.d.mts +21 -0
- package/node_modules/typebox/build/type/types/promise.mjs +29 -0
- package/node_modules/typebox/build/type/types/properties.d.mts +43 -0
- package/node_modules/typebox/build/type/types/properties.mjs +15 -0
- package/node_modules/typebox/build/type/types/record.d.mts +46 -0
- package/node_modules/typebox/build/type/types/record.mjs +60 -0
- package/node_modules/typebox/build/type/types/ref.d.mts +19 -0
- package/node_modules/typebox/build/type/types/ref.mjs +18 -0
- package/node_modules/typebox/build/type/types/rest.d.mts +11 -0
- package/node_modules/typebox/build/type/types/rest.mjs +17 -0
- package/node_modules/typebox/build/type/types/schema.d.mts +176 -0
- package/node_modules/typebox/build/type/types/schema.mjs +15 -0
- package/node_modules/typebox/build/type/types/static.d.mts +48 -0
- package/node_modules/typebox/build/type/types/static.mjs +3 -0
- package/node_modules/typebox/build/type/types/string.d.mts +12 -0
- package/node_modules/typebox/build/type/types/string.mjs +22 -0
- package/node_modules/typebox/build/type/types/symbol.d.mts +11 -0
- package/node_modules/typebox/build/type/types/symbol.mjs +17 -0
- package/node_modules/typebox/build/type/types/template_literal.d.mts +28 -0
- package/node_modules/typebox/build/type/types/template_literal.mjs +37 -0
- package/node_modules/typebox/build/type/types/this.d.mts +14 -0
- package/node_modules/typebox/build/type/types/this.mjs +17 -0
- package/node_modules/typebox/build/type/types/tuple.d.mts +38 -0
- package/node_modules/typebox/build/type/types/tuple.mjs +25 -0
- package/node_modules/typebox/build/type/types/undefined.d.mts +11 -0
- package/node_modules/typebox/build/type/types/undefined.mjs +17 -0
- package/node_modules/typebox/build/type/types/union.d.mts +15 -0
- package/node_modules/typebox/build/type/types/union.mjs +24 -0
- package/node_modules/typebox/build/type/types/unknown.d.mts +10 -0
- package/node_modules/typebox/build/type/types/unknown.mjs +17 -0
- package/node_modules/typebox/build/type/types/unsafe.d.mts +10 -0
- package/node_modules/typebox/build/type/types/unsafe.mjs +20 -0
- package/node_modules/typebox/build/type/types/void.d.mts +11 -0
- package/node_modules/typebox/build/type/types/void.mjs +17 -0
- package/node_modules/typebox/build/typebox.d.mts +73 -0
- package/node_modules/typebox/build/typebox.mjs +89 -0
- package/node_modules/typebox/build/value/assert/assert.d.mts +14 -0
- package/node_modules/typebox/build/value/assert/assert.mjs +28 -0
- package/node_modules/typebox/build/value/assert/index.d.mts +1 -0
- package/node_modules/typebox/build/value/assert/index.mjs +1 -0
- package/node_modules/typebox/build/value/check/check.d.mts +5 -0
- package/node_modules/typebox/build/value/check/check.mjs +11 -0
- package/node_modules/typebox/build/value/check/index.d.mts +1 -0
- package/node_modules/typebox/build/value/check/index.mjs +1 -0
- package/node_modules/typebox/build/value/clean/additional.d.mts +2 -0
- package/node_modules/typebox/build/value/clean/additional.mjs +6 -0
- package/node_modules/typebox/build/value/clean/clean.d.mts +15 -0
- package/node_modules/typebox/build/value/clean/clean.mjs +15 -0
- package/node_modules/typebox/build/value/clean/from_array.d.mts +2 -0
- package/node_modules/typebox/build/value/clean/from_array.mjs +8 -0
- package/node_modules/typebox/build/value/clean/from_base.d.mts +2 -0
- package/node_modules/typebox/build/value/clean/from_base.mjs +4 -0
- package/node_modules/typebox/build/value/clean/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/clean/from_cyclic.mjs +6 -0
- package/node_modules/typebox/build/value/clean/from_intersect.d.mts +2 -0
- package/node_modules/typebox/build/value/clean/from_intersect.mjs +26 -0
- package/node_modules/typebox/build/value/clean/from_object.d.mts +2 -0
- package/node_modules/typebox/build/value/clean/from_object.mjs +31 -0
- package/node_modules/typebox/build/value/clean/from_record.d.mts +2 -0
- package/node_modules/typebox/build/value/clean/from_record.mjs +32 -0
- package/node_modules/typebox/build/value/clean/from_ref.d.mts +2 -0
- package/node_modules/typebox/build/value/clean/from_ref.mjs +8 -0
- package/node_modules/typebox/build/value/clean/from_tuple.d.mts +2 -0
- package/node_modules/typebox/build/value/clean/from_tuple.mjs +14 -0
- package/node_modules/typebox/build/value/clean/from_type.d.mts +2 -0
- package/node_modules/typebox/build/value/clean/from_type.mjs +23 -0
- package/node_modules/typebox/build/value/clean/from_union.d.mts +2 -0
- package/node_modules/typebox/build/value/clean/from_union.mjs +13 -0
- package/node_modules/typebox/build/value/clean/index.d.mts +1 -0
- package/node_modules/typebox/build/value/clean/index.mjs +1 -0
- package/node_modules/typebox/build/value/clone/clone.d.mts +5 -0
- package/node_modules/typebox/build/value/clone/clone.mjs +83 -0
- package/node_modules/typebox/build/value/clone/index.d.mts +1 -0
- package/node_modules/typebox/build/value/clone/index.mjs +1 -0
- package/node_modules/typebox/build/value/codec/callback.d.mts +2 -0
- package/node_modules/typebox/build/value/codec/callback.mjs +25 -0
- package/node_modules/typebox/build/value/codec/decode.d.mts +12 -0
- package/node_modules/typebox/build/value/codec/decode.mjs +50 -0
- package/node_modules/typebox/build/value/codec/encode.d.mts +12 -0
- package/node_modules/typebox/build/value/codec/encode.mjs +50 -0
- package/node_modules/typebox/build/value/codec/from_array.d.mts +2 -0
- package/node_modules/typebox/build/value/codec/from_array.mjs +38 -0
- package/node_modules/typebox/build/value/codec/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/codec/from_cyclic.mjs +8 -0
- package/node_modules/typebox/build/value/codec/from_intersect.d.mts +2 -0
- package/node_modules/typebox/build/value/codec/from_intersect.mjs +58 -0
- package/node_modules/typebox/build/value/codec/from_object.d.mts +2 -0
- package/node_modules/typebox/build/value/codec/from_object.mjs +45 -0
- package/node_modules/typebox/build/value/codec/from_record.d.mts +2 -0
- package/node_modules/typebox/build/value/codec/from_record.mjs +44 -0
- package/node_modules/typebox/build/value/codec/from_ref.d.mts +2 -0
- package/node_modules/typebox/build/value/codec/from_ref.mjs +31 -0
- package/node_modules/typebox/build/value/codec/from_tuple.d.mts +2 -0
- package/node_modules/typebox/build/value/codec/from_tuple.mjs +35 -0
- package/node_modules/typebox/build/value/codec/from_type.d.mts +2 -0
- package/node_modules/typebox/build/value/codec/from_type.mjs +22 -0
- package/node_modules/typebox/build/value/codec/from_union.d.mts +2 -0
- package/node_modules/typebox/build/value/codec/from_union.mjs +40 -0
- package/node_modules/typebox/build/value/codec/has.d.mts +5 -0
- package/node_modules/typebox/build/value/codec/has.mjs +93 -0
- package/node_modules/typebox/build/value/codec/index.d.mts +3 -0
- package/node_modules/typebox/build/value/codec/index.mjs +3 -0
- package/node_modules/typebox/build/value/convert/convert.d.mts +13 -0
- package/node_modules/typebox/build/value/convert/convert.mjs +15 -0
- package/node_modules/typebox/build/value/convert/from_additional.d.mts +6 -0
- package/node_modules/typebox/build/value/convert/from_additional.mjs +18 -0
- package/node_modules/typebox/build/value/convert/from_array.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_array.mjs +7 -0
- package/node_modules/typebox/build/value/convert/from_base.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_base.mjs +4 -0
- package/node_modules/typebox/build/value/convert/from_bigint.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_bigint.mjs +6 -0
- package/node_modules/typebox/build/value/convert/from_boolean.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_boolean.mjs +6 -0
- package/node_modules/typebox/build/value/convert/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_cyclic.mjs +6 -0
- package/node_modules/typebox/build/value/convert/from_enum.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_enum.mjs +7 -0
- package/node_modules/typebox/build/value/convert/from_integer.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_integer.mjs +6 -0
- package/node_modules/typebox/build/value/convert/from_intersect.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_intersect.mjs +8 -0
- package/node_modules/typebox/build/value/convert/from_literal.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_literal.mjs +44 -0
- package/node_modules/typebox/build/value/convert/from_null.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_null.mjs +6 -0
- package/node_modules/typebox/build/value/convert/from_number.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_number.mjs +6 -0
- package/node_modules/typebox/build/value/convert/from_object.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_object.mjs +28 -0
- package/node_modules/typebox/build/value/convert/from_record.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_record.mjs +23 -0
- package/node_modules/typebox/build/value/convert/from_ref.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_ref.mjs +8 -0
- package/node_modules/typebox/build/value/convert/from_string.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_string.mjs +6 -0
- package/node_modules/typebox/build/value/convert/from_template_literal.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_template_literal.mjs +7 -0
- package/node_modules/typebox/build/value/convert/from_tuple.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_tuple.mjs +11 -0
- package/node_modules/typebox/build/value/convert/from_type.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_type.mjs +45 -0
- package/node_modules/typebox/build/value/convert/from_undefined.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_undefined.mjs +6 -0
- package/node_modules/typebox/build/value/convert/from_union.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_union.mjs +13 -0
- package/node_modules/typebox/build/value/convert/from_void.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/from_void.mjs +6 -0
- package/node_modules/typebox/build/value/convert/index.d.mts +1 -0
- package/node_modules/typebox/build/value/convert/index.mjs +1 -0
- package/node_modules/typebox/build/value/convert/try/index.d.mts +1 -0
- package/node_modules/typebox/build/value/convert/try/index.mjs +1 -0
- package/node_modules/typebox/build/value/convert/try/try.d.mts +8 -0
- package/node_modules/typebox/build/value/convert/try/try.mjs +8 -0
- package/node_modules/typebox/build/value/convert/try/try_array.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/try/try_array.mjs +6 -0
- package/node_modules/typebox/build/value/convert/try/try_bigint.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/try/try_bigint.mjs +45 -0
- package/node_modules/typebox/build/value/convert/try/try_boolean.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/try/try_boolean.mjs +41 -0
- package/node_modules/typebox/build/value/convert/try/try_null.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/try/try_null.mjs +44 -0
- package/node_modules/typebox/build/value/convert/try/try_number.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/try/try_number.mjs +44 -0
- package/node_modules/typebox/build/value/convert/try/try_result.d.mts +8 -0
- package/node_modules/typebox/build/value/convert/try/try_result.mjs +17 -0
- package/node_modules/typebox/build/value/convert/try/try_string.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/try/try_string.mjs +12 -0
- package/node_modules/typebox/build/value/convert/try/try_undefined.d.mts +2 -0
- package/node_modules/typebox/build/value/convert/try/try_undefined.mjs +44 -0
- package/node_modules/typebox/build/value/create/create.d.mts +5 -0
- package/node_modules/typebox/build/value/create/create.mjs +11 -0
- package/node_modules/typebox/build/value/create/error.d.mts +5 -0
- package/node_modules/typebox/build/value/create/error.mjs +7 -0
- package/node_modules/typebox/build/value/create/from_array.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_array.mjs +10 -0
- package/node_modules/typebox/build/value/create/from_async_iterator.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_async_iterator.mjs +5 -0
- package/node_modules/typebox/build/value/create/from_base.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_base.mjs +4 -0
- package/node_modules/typebox/build/value/create/from_bigint.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_bigint.mjs +7 -0
- package/node_modules/typebox/build/value/create/from_boolean.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_boolean.mjs +4 -0
- package/node_modules/typebox/build/value/create/from_constructor.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_constructor.mjs +10 -0
- package/node_modules/typebox/build/value/create/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_cyclic.mjs +6 -0
- package/node_modules/typebox/build/value/create/from_default.d.mts +3 -0
- package/node_modules/typebox/build/value/create/from_default.mjs +10 -0
- package/node_modules/typebox/build/value/create/from_enum.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_enum.mjs +6 -0
- package/node_modules/typebox/build/value/create/from_function.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_function.mjs +6 -0
- package/node_modules/typebox/build/value/create/from_integer.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_integer.mjs +8 -0
- package/node_modules/typebox/build/value/create/from_intersect.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_intersect.mjs +8 -0
- package/node_modules/typebox/build/value/create/from_iterator.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_iterator.mjs +5 -0
- package/node_modules/typebox/build/value/create/from_literal.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_literal.mjs +4 -0
- package/node_modules/typebox/build/value/create/from_never.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_never.mjs +5 -0
- package/node_modules/typebox/build/value/create/from_null.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_null.mjs +4 -0
- package/node_modules/typebox/build/value/create/from_number.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_number.mjs +8 -0
- package/node_modules/typebox/build/value/create/from_object.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_object.mjs +9 -0
- package/node_modules/typebox/build/value/create/from_promise.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_promise.mjs +5 -0
- package/node_modules/typebox/build/value/create/from_record.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_record.mjs +8 -0
- package/node_modules/typebox/build/value/create/from_ref.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_ref.mjs +9 -0
- package/node_modules/typebox/build/value/create/from_string.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_string.mjs +9 -0
- package/node_modules/typebox/build/value/create/from_symbol.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_symbol.mjs +4 -0
- package/node_modules/typebox/build/value/create/from_template_literal.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_template_literal.mjs +11 -0
- package/node_modules/typebox/build/value/create/from_tuple.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_tuple.mjs +5 -0
- package/node_modules/typebox/build/value/create/from_type.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_type.mjs +69 -0
- package/node_modules/typebox/build/value/create/from_undefined.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_undefined.mjs +4 -0
- package/node_modules/typebox/build/value/create/from_union.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_union.mjs +9 -0
- package/node_modules/typebox/build/value/create/from_void.d.mts +2 -0
- package/node_modules/typebox/build/value/create/from_void.mjs +4 -0
- package/node_modules/typebox/build/value/create/index.d.mts +2 -0
- package/node_modules/typebox/build/value/create/index.mjs +2 -0
- package/node_modules/typebox/build/value/default/default.d.mts +13 -0
- package/node_modules/typebox/build/value/default/default.mjs +15 -0
- package/node_modules/typebox/build/value/default/from_array.d.mts +2 -0
- package/node_modules/typebox/build/value/default/from_array.mjs +12 -0
- package/node_modules/typebox/build/value/default/from_base.d.mts +2 -0
- package/node_modules/typebox/build/value/default/from_base.mjs +5 -0
- package/node_modules/typebox/build/value/default/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/default/from_cyclic.mjs +7 -0
- package/node_modules/typebox/build/value/default/from_default.d.mts +3 -0
- package/node_modules/typebox/build/value/default/from_default.mjs +13 -0
- package/node_modules/typebox/build/value/default/from_intersect.d.mts +2 -0
- package/node_modules/typebox/build/value/default/from_intersect.mjs +9 -0
- package/node_modules/typebox/build/value/default/from_object.d.mts +2 -0
- package/node_modules/typebox/build/value/default/from_object.mjs +32 -0
- package/node_modules/typebox/build/value/default/from_record.d.mts +2 -0
- package/node_modules/typebox/build/value/default/from_record.mjs +26 -0
- package/node_modules/typebox/build/value/default/from_ref.d.mts +2 -0
- package/node_modules/typebox/build/value/default/from_ref.mjs +9 -0
- package/node_modules/typebox/build/value/default/from_tuple.d.mts +2 -0
- package/node_modules/typebox/build/value/default/from_tuple.mjs +14 -0
- package/node_modules/typebox/build/value/default/from_type.d.mts +2 -0
- package/node_modules/typebox/build/value/default/from_type.mjs +27 -0
- package/node_modules/typebox/build/value/default/from_union.d.mts +2 -0
- package/node_modules/typebox/build/value/default/from_union.mjs +14 -0
- package/node_modules/typebox/build/value/default/index.d.mts +1 -0
- package/node_modules/typebox/build/value/default/index.mjs +1 -0
- package/node_modules/typebox/build/value/delta/diff.d.mts +10 -0
- package/node_modules/typebox/build/value/delta/diff.mjs +135 -0
- package/node_modules/typebox/build/value/delta/edit.d.mts +24 -0
- package/node_modules/typebox/build/value/delta/edit.mjs +17 -0
- package/node_modules/typebox/build/value/delta/index.d.mts +3 -0
- package/node_modules/typebox/build/value/delta/index.mjs +3 -0
- package/node_modules/typebox/build/value/delta/patch.d.mts +8 -0
- package/node_modules/typebox/build/value/delta/patch.mjs +42 -0
- package/node_modules/typebox/build/value/equal/equal.d.mts +2 -0
- package/node_modules/typebox/build/value/equal/equal.mjs +6 -0
- package/node_modules/typebox/build/value/equal/index.d.mts +1 -0
- package/node_modules/typebox/build/value/equal/index.mjs +1 -0
- package/node_modules/typebox/build/value/errors/errors.d.mts +16 -0
- package/node_modules/typebox/build/value/errors/errors.mjs +17 -0
- package/node_modules/typebox/build/value/errors/index.d.mts +1 -0
- package/node_modules/typebox/build/value/errors/index.mjs +1 -0
- package/node_modules/typebox/build/value/hash/hash.d.mts +6 -0
- package/node_modules/typebox/build/value/hash/hash.mjs +10 -0
- package/node_modules/typebox/build/value/hash/index.d.mts +1 -0
- package/node_modules/typebox/build/value/hash/index.mjs +1 -0
- package/node_modules/typebox/build/value/index.d.mts +21 -0
- package/node_modules/typebox/build/value/index.mjs +30 -0
- package/node_modules/typebox/build/value/mutate/error.d.mts +3 -0
- package/node_modules/typebox/build/value/mutate/error.mjs +6 -0
- package/node_modules/typebox/build/value/mutate/from_array.d.mts +2 -0
- package/node_modules/typebox/build/value/mutate/from_array.mjs +16 -0
- package/node_modules/typebox/build/value/mutate/from_object.d.mts +2 -0
- package/node_modules/typebox/build/value/mutate/from_object.mjs +40 -0
- package/node_modules/typebox/build/value/mutate/from_unknown.d.mts +2 -0
- package/node_modules/typebox/build/value/mutate/from_unknown.mjs +7 -0
- package/node_modules/typebox/build/value/mutate/from_value.d.mts +2 -0
- package/node_modules/typebox/build/value/mutate/from_value.mjs +12 -0
- package/node_modules/typebox/build/value/mutate/index.d.mts +1 -0
- package/node_modules/typebox/build/value/mutate/index.mjs +1 -0
- package/node_modules/typebox/build/value/mutate/mutate.d.mts +11 -0
- package/node_modules/typebox/build/value/mutate/mutate.mjs +41 -0
- package/node_modules/typebox/build/value/parse/index.d.mts +1 -0
- package/node_modules/typebox/build/value/parse/index.mjs +1 -0
- package/node_modules/typebox/build/value/parse/parse.d.mts +11 -0
- package/node_modules/typebox/build/value/parse/parse.mjs +47 -0
- package/node_modules/typebox/build/value/pipeline/index.d.mts +1 -0
- package/node_modules/typebox/build/value/pipeline/index.mjs +1 -0
- package/node_modules/typebox/build/value/pipeline/pipeline.d.mts +10 -0
- package/node_modules/typebox/build/value/pipeline/pipeline.mjs +15 -0
- package/node_modules/typebox/build/value/pointer/index.d.mts +1 -0
- package/node_modules/typebox/build/value/pointer/index.mjs +1 -0
- package/node_modules/typebox/build/value/repair/error.d.mts +7 -0
- package/node_modules/typebox/build/value/repair/error.mjs +8 -0
- package/node_modules/typebox/build/value/repair/from_array.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_array.mjs +39 -0
- package/node_modules/typebox/build/value/repair/from_base.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_base.mjs +8 -0
- package/node_modules/typebox/build/value/repair/from_enum.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_enum.mjs +7 -0
- package/node_modules/typebox/build/value/repair/from_intersect.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_intersect.mjs +8 -0
- package/node_modules/typebox/build/value/repair/from_object.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_object.mjs +33 -0
- package/node_modules/typebox/build/value/repair/from_record.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_record.mjs +33 -0
- package/node_modules/typebox/build/value/repair/from_ref.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_ref.mjs +9 -0
- package/node_modules/typebox/build/value/repair/from_template_literal.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_template_literal.mjs +7 -0
- package/node_modules/typebox/build/value/repair/from_tuple.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_tuple.mjs +12 -0
- package/node_modules/typebox/build/value/repair/from_type.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_type.mjs +86 -0
- package/node_modules/typebox/build/value/repair/from_union.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_union.mjs +24 -0
- package/node_modules/typebox/build/value/repair/from_unknown.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_unknown.mjs +12 -0
- package/node_modules/typebox/build/value/repair/index.d.mts +1 -0
- package/node_modules/typebox/build/value/repair/index.mjs +1 -0
- package/node_modules/typebox/build/value/repair/repair.d.mts +17 -0
- package/node_modules/typebox/build/value/repair/repair.mjs +20 -0
- package/node_modules/typebox/build/value/shared/index.d.mts +3 -0
- package/node_modules/typebox/build/value/shared/index.mjs +4 -0
- package/node_modules/typebox/build/value/shared/optional_undefined.d.mts +2 -0
- package/node_modules/typebox/build/value/shared/optional_undefined.mjs +15 -0
- package/node_modules/typebox/build/value/shared/union_priority_sort.d.mts +3 -0
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +36 -0
- package/node_modules/typebox/build/value/shared/union_score_select.d.mts +3 -0
- package/node_modules/typebox/build/value/shared/union_score_select.mjs +51 -0
- package/node_modules/typebox/build/value/value.d.mts +16 -0
- package/node_modules/typebox/build/value/value.mjs +16 -0
- package/node_modules/typebox/license +23 -0
- package/node_modules/typebox/package.json +87 -0
- package/node_modules/typebox/readme.md +356 -0
- package/node_modules/yaml/LICENSE +13 -0
- package/node_modules/yaml/README.md +172 -0
- package/node_modules/yaml/bin.mjs +11 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
- package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
- package/node_modules/yaml/browser/dist/compose/composer.js +217 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +223 -0
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
- package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
- package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
- package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
- package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
- package/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/yaml/browser/dist/index.js +17 -0
- package/node_modules/yaml/browser/dist/log.js +11 -0
- package/node_modules/yaml/browser/dist/nodes/Alias.js +114 -0
- package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
- package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
- package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/yaml/browser/dist/parse/lexer.js +717 -0
- package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +967 -0
- package/node_modules/yaml/browser/dist/public-api.js +102 -0
- package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
- package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +64 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
- package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +24 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
- package/node_modules/yaml/browser/dist/util.js +11 -0
- package/node_modules/yaml/browser/dist/visit.js +233 -0
- package/node_modules/yaml/browser/index.js +5 -0
- package/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/yaml/dist/cli.d.ts +8 -0
- package/node_modules/yaml/dist/cli.mjs +201 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/node_modules/yaml/dist/compose/composer.js +222 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +225 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/node_modules/yaml/dist/doc/Document.js +337 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/yaml/dist/doc/directives.js +178 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +25 -0
- package/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +19 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/Alias.js +116 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +43 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/yaml/dist/options.d.ts +350 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +719 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +972 -0
- package/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/node_modules/yaml/dist/public-api.js +107 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/node_modules/yaml/dist/schema/tags.js +99 -0
- package/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +68 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +26 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/yaml/dist/util.d.ts +16 -0
- package/node_modules/yaml/dist/util.js +28 -0
- package/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/yaml/package.json +97 -0
- package/node_modules/yaml/util.js +2 -0
- package/package.json +60 -0
- package/src/adapters/index.ts +13 -0
- package/src/adapters/pi-subagents/agents.ts +136 -0
- package/src/adapters/pi-subagents/autocomplete.ts +46 -0
- package/src/adapters/pi-subagents/index.ts +48 -0
- package/src/adapters/types.ts +25 -0
- package/src/commands/delegation.ts +32 -0
- package/src/commands/doctor.ts +36 -0
- package/test/agent-palette.test.ts +215 -0
- package/test/wiring.test.ts +15 -0
|
@@ -0,0 +1,2183 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import { dirname, resolve as resolvePath } from "node:path";
|
|
4
|
+
import { Worker } from "node:worker_threads";
|
|
5
|
+
import { DEFAULT_GLOBAL_CONCURRENCY_LIMIT, Semaphore } from "../runs/shared/parallel-utils.ts";
|
|
6
|
+
import { HOST_STEP_MAX_COUNT } from "../runs/shared/host-step-status.ts";
|
|
7
|
+
import { classifyTaskMutationIntent } from "../runs/shared/task-intent.ts";
|
|
8
|
+
import type { AcceptanceRecoveryMetadata, HostStepNodeV1, SingleResult } from "../shared/types.ts";
|
|
9
|
+
import { normalizeWorkflowHostCommandParams, type WorkflowHostCommandParams, type WorkflowHostCommandResult } from "./host-command.ts";
|
|
10
|
+
|
|
11
|
+
const KEY_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
12
|
+
const requireFromPackage = createRequire(import.meta.url);
|
|
13
|
+
|
|
14
|
+
export interface WorkflowScriptValidationError {
|
|
15
|
+
message: string;
|
|
16
|
+
line?: number;
|
|
17
|
+
column?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface WorkflowScriptValidationResult {
|
|
21
|
+
ok: boolean;
|
|
22
|
+
errors: WorkflowScriptValidationError[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const WORKER_SOURCE = String.raw`
|
|
26
|
+
const { parentPort, workerData } = require("node:worker_threads");
|
|
27
|
+
const vm = require("node:vm");
|
|
28
|
+
const { inspect } = require("node:util");
|
|
29
|
+
const { parse } = require(workerData.acornPath);
|
|
30
|
+
|
|
31
|
+
let promiseHooks;
|
|
32
|
+
try {
|
|
33
|
+
({ promiseHooks } = require("node:v8"));
|
|
34
|
+
} catch {}
|
|
35
|
+
|
|
36
|
+
function createWorkflowPromiseHook(callbacks) {
|
|
37
|
+
if (!promiseHooks || typeof promiseHooks.createHook !== "function") return () => {};
|
|
38
|
+
try {
|
|
39
|
+
return promiseHooks.createHook(callbacks);
|
|
40
|
+
} catch (error) {
|
|
41
|
+
if (error?.name !== "NotImplementedError") throw error;
|
|
42
|
+
return () => {};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let nextCallId = 0;
|
|
47
|
+
let topLevelWorkflowPromise;
|
|
48
|
+
let suppressNativePromiseConsumption = 0;
|
|
49
|
+
const activeNativePromises = [];
|
|
50
|
+
const pending = new Map();
|
|
51
|
+
const runKeyPattern = /^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$/;
|
|
52
|
+
const trackedPromiseTrackers = new WeakMap();
|
|
53
|
+
const trackedPromiseTargets = new WeakMap();
|
|
54
|
+
let nativePromiseTrackers = new WeakMap();
|
|
55
|
+
let nativePromiseParents = new WeakMap();
|
|
56
|
+
const observedCallIds = new Set();
|
|
57
|
+
|
|
58
|
+
function stableRunJson(value) {
|
|
59
|
+
if (Array.isArray(value)) return "[" + value.map(stableRunJson).join(",") + "]";
|
|
60
|
+
if (value && typeof value === "object") return "{" + Object.keys(value).sort().map((key) => JSON.stringify(key) + ":" + stableRunJson(value[key])).join(",") + "}";
|
|
61
|
+
return JSON.stringify(value) ?? "undefined";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function isDirectWorkflowScriptPromiseHandlerCall() {
|
|
65
|
+
const stack = new Error().stack;
|
|
66
|
+
if (typeof stack !== "string") return false;
|
|
67
|
+
return stack.split("\n").some((line) => line.includes("workflow-script.js") && !line.includes("at async "));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function nativePromiseTracker(promise) {
|
|
71
|
+
if (!promise || (typeof promise !== "object" && typeof promise !== "function")) return undefined;
|
|
72
|
+
let tracker = nativePromiseTrackers.get(promise);
|
|
73
|
+
if (!tracker) {
|
|
74
|
+
tracker = { observations: [], consumed: false, dependencies: [] };
|
|
75
|
+
nativePromiseTrackers.set(promise, tracker);
|
|
76
|
+
}
|
|
77
|
+
return tracker;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function promiseObservationTracker(value) {
|
|
81
|
+
if (!value || (typeof value !== "object" && typeof value !== "function")) return undefined;
|
|
82
|
+
return trackedPromiseTrackers.get(value) ?? nativePromiseTrackers.get(value);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function addTrackerDependency(tracker, dependency) {
|
|
86
|
+
if (!dependency) return;
|
|
87
|
+
tracker.dependencies ??= [];
|
|
88
|
+
if (!tracker.dependencies.includes(dependency)) tracker.dependencies.push(dependency);
|
|
89
|
+
if (tracker.consumed) markTrackedObservationsConsumed(dependency);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function descendsFromTopLevelWorkflow(promise) {
|
|
93
|
+
const seen = new Set();
|
|
94
|
+
for (let current = promise; current && !seen.has(current); current = nativePromiseParents.get(current)) {
|
|
95
|
+
if (current === topLevelWorkflowPromise) return true;
|
|
96
|
+
seen.add(current);
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function withSuppressedNativePromiseConsumption(callback) {
|
|
102
|
+
suppressNativePromiseConsumption++;
|
|
103
|
+
try {
|
|
104
|
+
return callback();
|
|
105
|
+
} finally {
|
|
106
|
+
suppressNativePromiseConsumption--;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function mergeObservations(...groups) {
|
|
111
|
+
const seen = new Set();
|
|
112
|
+
const merged = [];
|
|
113
|
+
for (const group of groups) {
|
|
114
|
+
for (const observation of group) {
|
|
115
|
+
if (!observation || typeof observation.callId !== "number" || typeof observation.key !== "string" || typeof observation.operation !== "string" || seen.has(observation.callId)) continue;
|
|
116
|
+
seen.add(observation.callId);
|
|
117
|
+
merged.push(observation);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return merged;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function trackedObservationTracker(value) {
|
|
124
|
+
return value && (typeof value === "object" || typeof value === "function") ? trackedPromiseTrackers.get(value) : undefined;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function trackedPromiseTarget(value) {
|
|
128
|
+
return value && (typeof value === "object" || typeof value === "function") ? trackedPromiseTargets.get(value) ?? value : value;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function addTrackedObservations(tracker, observations) {
|
|
132
|
+
tracker.observations = mergeObservations(tracker.observations, observations);
|
|
133
|
+
if (!tracker.consumed) return;
|
|
134
|
+
for (const observation of tracker.observations) {
|
|
135
|
+
if (observedCallIds.has(observation.callId)) continue;
|
|
136
|
+
observedCallIds.add(observation.callId);
|
|
137
|
+
parentPort.postMessage({ type: "callObserved", callId: observation.callId, key: observation.key, operation: observation.operation });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function markTrackedObservationsConsumed(tracker, seen = new Set()) {
|
|
142
|
+
if (seen.has(tracker)) return;
|
|
143
|
+
seen.add(tracker);
|
|
144
|
+
tracker.consumed = true;
|
|
145
|
+
addTrackedObservations(tracker, []);
|
|
146
|
+
for (const dependency of tracker.dependencies ?? []) markTrackedObservationsConsumed(dependency, seen);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function consumeTrackedObservations(tracker) {
|
|
150
|
+
if (isDirectWorkflowScriptPromiseHandlerCall()) return;
|
|
151
|
+
const activePromise = activeNativePromises.at(-1);
|
|
152
|
+
if (activePromise === topLevelWorkflowPromise || descendsFromTopLevelWorkflow(activePromise)) {
|
|
153
|
+
markTrackedObservationsConsumed(tracker);
|
|
154
|
+
} else if (activePromise) {
|
|
155
|
+
addTrackerDependency(nativePromiseTracker(activePromise), tracker);
|
|
156
|
+
} else {
|
|
157
|
+
markTrackedObservationsConsumed(tracker);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
function trackObservationTracker(tracker, promise, allowFutureObservations = false) {
|
|
162
|
+
const target = trackedPromiseTarget(promise);
|
|
163
|
+
if ((!allowFutureObservations && tracker.observations.length === 0) || !target || typeof target.then !== "function") return promise;
|
|
164
|
+
|
|
165
|
+
const tracked = new Proxy(target, {
|
|
166
|
+
get(promiseTarget, prop) {
|
|
167
|
+
if (prop === "then") return function promiseThen(onFulfilled, onRejected) {
|
|
168
|
+
consumeTrackedObservations(tracker);
|
|
169
|
+
const chainTracker = { observations: tracker.observations, consumed: false, dependencies: [tracker] };
|
|
170
|
+
const wrapHandler = (handler) => typeof handler === "function"
|
|
171
|
+
? function trackedThenHandler(...args) {
|
|
172
|
+
const value = handler.apply(this, args);
|
|
173
|
+
addTrackerDependency(chainTracker, promiseObservationTracker(value));
|
|
174
|
+
return trackedPromiseTarget(value);
|
|
175
|
+
}
|
|
176
|
+
: handler;
|
|
177
|
+
return trackObservationTracker(chainTracker, promiseTarget.then(wrapHandler(onFulfilled), wrapHandler(onRejected)), true);
|
|
178
|
+
};
|
|
179
|
+
if (prop === "catch") return function promiseCatch(onRejected) {
|
|
180
|
+
consumeTrackedObservations(tracker);
|
|
181
|
+
return trackObservationTracker({ observations: tracker.observations, consumed: false, dependencies: [tracker] }, promiseTarget.catch(onRejected), true);
|
|
182
|
+
};
|
|
183
|
+
if (prop === "finally") return function promiseFinally(onFinally) {
|
|
184
|
+
consumeTrackedObservations(tracker);
|
|
185
|
+
return trackObservationTracker({ observations: tracker.observations, consumed: false, dependencies: [tracker] }, promiseTarget.finally(onFinally), true);
|
|
186
|
+
};
|
|
187
|
+
return Reflect.get(promiseTarget, prop, promiseTarget);
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
trackedPromiseTrackers.set(tracked, tracker);
|
|
191
|
+
trackedPromiseTargets.set(tracked, target);
|
|
192
|
+
return tracked;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
function trackRunObservation(observations, promise) {
|
|
196
|
+
const tracker = trackedObservationTracker(promise) ?? { observations: [], consumed: false };
|
|
197
|
+
addTrackedObservations(tracker, observations);
|
|
198
|
+
return trackObservationTracker(tracker, promise);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function trackPromiseCombinator(items, createPromise) {
|
|
202
|
+
const values = Array.from(items);
|
|
203
|
+
const dependencies = [...new Set(values.map(promiseObservationTracker).filter(Boolean))];
|
|
204
|
+
const promise = withSuppressedNativePromiseConsumption(() => createPromise(values.map(trackedPromiseTarget)));
|
|
205
|
+
if (dependencies.length === 0) return promise;
|
|
206
|
+
return trackObservationTracker({ observations: [], consumed: false, dependencies }, promise, true);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const workflowPromise = new Proxy(Promise, {
|
|
210
|
+
construct(target, [executor]) {
|
|
211
|
+
if (typeof executor !== "function") return new target(executor);
|
|
212
|
+
const tracker = { observations: [], consumed: false };
|
|
213
|
+
const promise = new target((resolve, reject) => {
|
|
214
|
+
let settled = false;
|
|
215
|
+
try {
|
|
216
|
+
executor((value) => {
|
|
217
|
+
if (settled) return;
|
|
218
|
+
settled = true;
|
|
219
|
+
addTrackerDependency(tracker, promiseObservationTracker(value));
|
|
220
|
+
resolve(trackedPromiseTarget(value));
|
|
221
|
+
}, (reason) => {
|
|
222
|
+
if (settled) return;
|
|
223
|
+
settled = true;
|
|
224
|
+
reject(reason);
|
|
225
|
+
});
|
|
226
|
+
} catch (error) {
|
|
227
|
+
settled = true;
|
|
228
|
+
throw error;
|
|
229
|
+
}
|
|
230
|
+
});
|
|
231
|
+
return trackObservationTracker(tracker, promise, true);
|
|
232
|
+
},
|
|
233
|
+
get(target, prop) {
|
|
234
|
+
if (prop === "all") return (items) => trackPromiseCombinator(items, (values) => target.all(values));
|
|
235
|
+
if (prop === "allSettled") return (items) => trackPromiseCombinator(items, (values) => target.allSettled(values));
|
|
236
|
+
if (prop === "race") return (items) => trackPromiseCombinator(items, (values) => target.race(values));
|
|
237
|
+
if (prop === "any") return (items) => trackPromiseCombinator(items, (values) => target.any(values));
|
|
238
|
+
if (prop === "resolve") return (value) => {
|
|
239
|
+
const dependency = promiseObservationTracker(value);
|
|
240
|
+
const promise = withSuppressedNativePromiseConsumption(() => target.resolve(trackedPromiseTarget(value)));
|
|
241
|
+
if (!dependency) return promise;
|
|
242
|
+
return trackObservationTracker({ observations: [], consumed: false, dependencies: [dependency] }, promise, true);
|
|
243
|
+
};
|
|
244
|
+
const value = target[prop];
|
|
245
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
246
|
+
},
|
|
247
|
+
});
|
|
248
|
+
|
|
249
|
+
function hostCall(method, args, observation) {
|
|
250
|
+
const callId = ++nextCallId;
|
|
251
|
+
const promise = new Promise((resolve, reject) => {
|
|
252
|
+
pending.set(callId, { resolve, reject });
|
|
253
|
+
parentPort.postMessage({ type: "call", callId, method, args });
|
|
254
|
+
});
|
|
255
|
+
return observation && typeof observation.key === "string" && typeof observation.operation === "string"
|
|
256
|
+
? trackRunObservation([{ key: observation.key, operation: observation.operation, callId }], promise)
|
|
257
|
+
: promise;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
function runHostCall(key, params, collectFailure, batch, generatedLaneKey) {
|
|
261
|
+
const callId = ++nextCallId;
|
|
262
|
+
const promise = new Promise((resolve, reject) => {
|
|
263
|
+
pending.set(callId, { resolve, reject });
|
|
264
|
+
parentPort.postMessage({ type: "call", callId, method: "run", args: { key, params, ...(collectFailure ? { collectFailure: true } : {}), ...(batch ? { batch } : {}), ...(generatedLaneKey ? { generatedLaneKey } : {}) } });
|
|
265
|
+
});
|
|
266
|
+
return { key, callId, promise };
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
function isArrayIndexProperty(prop) {
|
|
270
|
+
if (!/^(0|[1-9]\d*)$/.test(prop)) return false;
|
|
271
|
+
const index = Number(prop);
|
|
272
|
+
return Number.isSafeInteger(index) && index >= 0 && index < 4294967295;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const runsAllResultTargets = new WeakMap();
|
|
276
|
+
|
|
277
|
+
const MAX_LANES = 32;
|
|
278
|
+
const MAX_LANE_STAGES = 16;
|
|
279
|
+
const MAX_LANE_STAGE_COUNT = 64;
|
|
280
|
+
const MAX_LANE_SPEC_BYTES = 64 * 1024;
|
|
281
|
+
const MAX_LANE_TASK_BYTES = 1024 * 1024;
|
|
282
|
+
const MAX_LANE_PATH_BYTES = 32 * 1024;
|
|
283
|
+
const MAX_LANE_BOARD_TEXT_BYTES = 256;
|
|
284
|
+
const LANE_PATH_FIELDS = new Set(["cwd", "output", "sessionDir"]);
|
|
285
|
+
|
|
286
|
+
function runsAllKeyAccessError(prop) {
|
|
287
|
+
return new Error("Cannot read runs.all result property '" + prop + "'. runs.all resolves to an ordered array, not a key map. Use results[0], array destructuring, or results.map((result) => result.output), not results." + prop + ".");
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function wrapRunsAllResults(results, keys) {
|
|
291
|
+
const keySet = new Set(keys);
|
|
292
|
+
const proxy = new Proxy(results, {
|
|
293
|
+
get(target, prop, receiver) {
|
|
294
|
+
if (typeof prop !== "string") return Reflect.get(target, prop, receiver);
|
|
295
|
+
if (prop === "then" || prop === "toJSON") return undefined;
|
|
296
|
+
if (prop in target || isArrayIndexProperty(prop)) return Reflect.get(target, prop, receiver);
|
|
297
|
+
if (keySet.has(prop)) throw runsAllKeyAccessError(prop);
|
|
298
|
+
throw runsAllKeyAccessError(prop);
|
|
299
|
+
},
|
|
300
|
+
});
|
|
301
|
+
runsAllResultTargets.set(proxy, results);
|
|
302
|
+
return proxy;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
function laneByteLength(value) {
|
|
306
|
+
return new TextEncoder().encode(value).byteLength;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function laneBoardText(value) {
|
|
310
|
+
if (typeof value !== "string" || !value) return undefined;
|
|
311
|
+
if (laneByteLength(value) <= MAX_LANE_BOARD_TEXT_BYTES) return value;
|
|
312
|
+
const bytes = new TextEncoder().encode(value).subarray(0, MAX_LANE_BOARD_TEXT_BYTES - 3);
|
|
313
|
+
return new TextDecoder().decode(bytes) + "...";
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
function laneBoardPath(value) {
|
|
317
|
+
if (typeof value !== "string" || !value || laneByteLength(value) > MAX_LANE_BOARD_TEXT_BYTES) return undefined;
|
|
318
|
+
return value;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function validateLaneStageBounds(params, label) {
|
|
322
|
+
if (typeof params.task === "string" && laneByteLength(params.task) > MAX_LANE_TASK_BYTES) throw new Error(label + " task exceeds 1 MiB when UTF-8 encoded.");
|
|
323
|
+
for (const field of LANE_PATH_FIELDS) if (typeof params[field] === "string" && laneByteLength(params[field]) > MAX_LANE_PATH_BYTES) throw new Error(label + " " + field + " exceeds 32 KiB when UTF-8 encoded.");
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function validateLaneKey(value, owner) {
|
|
327
|
+
if (typeof value !== "string" || !runKeyPattern.test(value)) throw new Error(owner + " key must be 1-128 characters using letters, numbers, '.', '_' or '-', and start with a letter or number.");
|
|
328
|
+
return value;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
function laneStageParams(stage, previous) {
|
|
332
|
+
const resume = stage.resume;
|
|
333
|
+
const params = { ...stage.params };
|
|
334
|
+
if (resume !== "previous") return params;
|
|
335
|
+
if (!previous || typeof previous.runId !== "string" || !previous.runId.trim()) return undefined;
|
|
336
|
+
return { ...params, resume: previous.runId.trim() };
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
function laneStageVerdict(result) {
|
|
340
|
+
const structured = result && typeof result === "object" && !Array.isArray(result) ? result.structuredOutput : undefined;
|
|
341
|
+
const verdict = structured && typeof structured === "object" && !Array.isArray(structured) ? structured.verdict : undefined;
|
|
342
|
+
return typeof verdict === "string" && verdict.trim() ? laneBoardText(verdict.trim()) : undefined;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
function laneStageIsBlocked(result) {
|
|
346
|
+
const structured = result && typeof result === "object" && !Array.isArray(result) ? result.structuredOutput : undefined;
|
|
347
|
+
return structured && typeof structured === "object" && !Array.isArray(structured) && structured.verdict === "blocked";
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
function laneStageRecord(stageKey, child, forcedState) {
|
|
351
|
+
const result = child && typeof child === "object" && !Array.isArray(child) ? child : undefined;
|
|
352
|
+
const ok = result?.ok === true;
|
|
353
|
+
const verdict = laneStageVerdict(result);
|
|
354
|
+
const blocked = laneStageIsBlocked(result);
|
|
355
|
+
const state = forcedState ?? (result?.stopped ? "stopped" : result?.detached ? "detached" : ok ? blocked ? "blocked" : "completed" : "failed");
|
|
356
|
+
const error = state !== "completed"
|
|
357
|
+
? state === "blocked" && blocked
|
|
358
|
+
? "Stage returned a blocked verdict."
|
|
359
|
+
: typeof result?.error === "string"
|
|
360
|
+
? result.error
|
|
361
|
+
: typeof result?.output === "string"
|
|
362
|
+
? result.output
|
|
363
|
+
: "Stage did not complete successfully."
|
|
364
|
+
: undefined;
|
|
365
|
+
return {
|
|
366
|
+
key: stageKey,
|
|
367
|
+
...(typeof result?.runId === "string" && result.runId.trim() ? { runId: laneBoardText(result.runId.trim()) } : {}),
|
|
368
|
+
...(result ? { ok } : {}),
|
|
369
|
+
state,
|
|
370
|
+
...(typeof result?.outputReference === "string" ? (laneBoardPath(result.outputReference) ? { outputReference: laneBoardPath(result.outputReference) } : {}) : {}),
|
|
371
|
+
...(verdict ? { verdict } : {}),
|
|
372
|
+
...(error ? { error: laneBoardText(error) } : {}),
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function laneFailure(stageKey, error) {
|
|
377
|
+
const text = error instanceof Error ? error.message : String(error);
|
|
378
|
+
return { key: stageKey, ok: false, output: text, error: text, artifactPaths: [] };
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function runCollected(key, params, observe, generatedLaneKey) {
|
|
382
|
+
validateRunCall(key, params, "runs.lanes stage", runFingerprints);
|
|
383
|
+
const launched = runHostCall(key, params, true, undefined, generatedLaneKey);
|
|
384
|
+
observe([{ key, operation: "run", callId: launched.callId }]);
|
|
385
|
+
return launched.promise.then(decorateWorkflowChildResult);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function validateLaneSpecs(laneSpecs) {
|
|
389
|
+
if (!Array.isArray(laneSpecs)) throw new Error("runs.lanes(lanes) requires an array.");
|
|
390
|
+
if (laneSpecs.length === 0) throw new Error("runs.lanes(lanes) requires at least one lane.");
|
|
391
|
+
if (laneSpecs.length > MAX_LANES) throw new Error("runs.lanes supports at most " + MAX_LANES + " lanes.");
|
|
392
|
+
assertJsonValue(laneSpecs, "runs.lanes lanes");
|
|
393
|
+
if (laneByteLength(stableRunJson(laneSpecs)) > MAX_LANE_SPEC_BYTES) throw new Error("runs.lanes canonical JSON exceeds 64 KiB.");
|
|
394
|
+
const generatedKeys = new Set();
|
|
395
|
+
const validationFingerprints = new Map();
|
|
396
|
+
let stageCount = 0;
|
|
397
|
+
const normalized = [];
|
|
398
|
+
for (let laneIndex = 0; laneIndex < laneSpecs.length; laneIndex++) {
|
|
399
|
+
const lane = laneSpecs[laneIndex];
|
|
400
|
+
const laneLabel = "runs.lanes lane " + laneIndex;
|
|
401
|
+
if (!lane || typeof lane !== "object" || Array.isArray(lane)) throw new Error(laneLabel + " must be an object.");
|
|
402
|
+
const laneFields = Object.keys(lane);
|
|
403
|
+
if (laneFields.some((field) => field !== "key" && field !== "stages")) throw new Error(laneLabel + " contains unsupported fields.");
|
|
404
|
+
const laneKey = validateLaneKey(lane.key, laneLabel);
|
|
405
|
+
if (!Array.isArray(lane.stages) || lane.stages.length === 0) throw new Error(laneLabel + " stages must contain at least one stage.");
|
|
406
|
+
if (lane.stages.length > MAX_LANE_STAGES) throw new Error(laneLabel + " supports at most " + MAX_LANE_STAGES + " stages.");
|
|
407
|
+
const stageKeys = new Set();
|
|
408
|
+
const stages = [];
|
|
409
|
+
for (let stageIndex = 0; stageIndex < lane.stages.length; stageIndex++) {
|
|
410
|
+
stageCount++;
|
|
411
|
+
if (stageCount > MAX_LANE_STAGE_COUNT) throw new Error("runs.lanes supports at most " + MAX_LANE_STAGE_COUNT + " total stages.");
|
|
412
|
+
const stage = lane.stages[stageIndex];
|
|
413
|
+
const stageLabel = laneLabel + " stage " + stageIndex;
|
|
414
|
+
if (!stage || typeof stage !== "object" || Array.isArray(stage)) throw new Error(stageLabel + " must be an object.");
|
|
415
|
+
const stageKey = validateLaneKey(stage.key, stageLabel);
|
|
416
|
+
if (stageKeys.has(stageKey)) throw new Error(laneLabel + " contains duplicate stage key '" + stageKey + "'.");
|
|
417
|
+
stageKeys.add(stageKey);
|
|
418
|
+
const generatedKey = laneKey + "." + stageKey;
|
|
419
|
+
validateLaneKey(generatedKey, stageLabel + " generated");
|
|
420
|
+
if (generatedKeys.has(generatedKey)) throw new Error("runs.lanes generated child key '" + generatedKey + "' is duplicated.");
|
|
421
|
+
generatedKeys.add(generatedKey);
|
|
422
|
+
const resume = stage.resume;
|
|
423
|
+
if (resume !== undefined && resume !== "previous") {
|
|
424
|
+
if (stageIndex === 0 && typeof resume === "string") {
|
|
425
|
+
throw new Error(stageLabel + " cannot resume a retained run id in runs.lanes; use runs.run(key, { resume: id }) outside lanes, or start the lane with an agent stage and use resume: \"previous\" later.");
|
|
426
|
+
}
|
|
427
|
+
throw new Error(stageLabel + " resume must be 'previous'.");
|
|
428
|
+
}
|
|
429
|
+
if (stageIndex === 0 && resume === "previous") throw new Error(stageLabel + " cannot resume previous without a predecessor stage.");
|
|
430
|
+
const { key: _stageKey, resume: _resume, ...params } = stage;
|
|
431
|
+
const validationParams = resume === "previous" ? { ...params, resume: "retained-run-placeholder" } : params;
|
|
432
|
+
validateLaneStageBounds(validationParams, stageLabel);
|
|
433
|
+
validateRunCall(generatedKey, validationParams, stageLabel, validationFingerprints);
|
|
434
|
+
const existingFingerprint = runFingerprints.get(generatedKey);
|
|
435
|
+
if (existingFingerprint !== undefined && (resume === "previous" || existingFingerprint !== stableRunJson(params))) {
|
|
436
|
+
throw new Error("runs.lanes generated child key '" + generatedKey + "' is already used with incompatible launch params.");
|
|
437
|
+
}
|
|
438
|
+
stages.push({ key: stageKey, generatedKey, resume, params });
|
|
439
|
+
}
|
|
440
|
+
normalized.push({ key: laneKey, stages });
|
|
441
|
+
}
|
|
442
|
+
return normalized;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function runLane(lane, firstResult, observe) {
|
|
446
|
+
const records = [];
|
|
447
|
+
const appendSkipped = (start) => {
|
|
448
|
+
for (let index = start; index < lane.stages.length; index++) records.push({ key: lane.stages[index].key, state: "skipped" });
|
|
449
|
+
};
|
|
450
|
+
const finish = (state, failedStage) => ({ key: lane.key, state, ...(failedStage ? { failedStage } : {}), stages: records });
|
|
451
|
+
const visit = (index, previous) => {
|
|
452
|
+
if (index >= lane.stages.length) return Promise.resolve(finish("complete"));
|
|
453
|
+
const stage = lane.stages[index];
|
|
454
|
+
if (index === 0) {
|
|
455
|
+
const record = laneStageRecord(stage.key, previous);
|
|
456
|
+
records.push(record);
|
|
457
|
+
if (record.state !== "completed") {
|
|
458
|
+
appendSkipped(index + 1);
|
|
459
|
+
return Promise.resolve(finish("blocked", stage.key));
|
|
460
|
+
}
|
|
461
|
+
return visit(index + 1, previous);
|
|
462
|
+
}
|
|
463
|
+
if (stage.resume === "previous" && (!previous || typeof previous.runId !== "string" || !previous.runId.trim())) {
|
|
464
|
+
records.push({ key: stage.key, state: "blocked", error: "Previous stage did not return a retained run id." });
|
|
465
|
+
appendSkipped(index + 1);
|
|
466
|
+
return Promise.resolve(finish("blocked", stage.key));
|
|
467
|
+
}
|
|
468
|
+
if (!previous || previous.ok !== true || laneStageIsBlocked(previous)) {
|
|
469
|
+
records.push({ key: stage.key, state: "blocked", error: "Previous stage did not complete successfully." });
|
|
470
|
+
appendSkipped(index + 1);
|
|
471
|
+
return Promise.resolve(finish("blocked", stage.key));
|
|
472
|
+
}
|
|
473
|
+
const params = laneStageParams(stage, previous);
|
|
474
|
+
if (!params) {
|
|
475
|
+
records.push({ key: stage.key, state: "blocked", error: "Previous stage did not return a retained run id." });
|
|
476
|
+
appendSkipped(index + 1);
|
|
477
|
+
return Promise.resolve(finish("blocked", stage.key));
|
|
478
|
+
}
|
|
479
|
+
let launched;
|
|
480
|
+
try {
|
|
481
|
+
launched = runCollected(stage.generatedKey, params, observe, lane.key);
|
|
482
|
+
} catch (error) {
|
|
483
|
+
const failed = laneFailure(stage.generatedKey, error);
|
|
484
|
+
records.push(laneStageRecord(stage.key, failed));
|
|
485
|
+
appendSkipped(index + 1);
|
|
486
|
+
return Promise.resolve(finish("blocked", stage.key));
|
|
487
|
+
}
|
|
488
|
+
return launched.then((result) => {
|
|
489
|
+
const record = laneStageRecord(stage.key, result);
|
|
490
|
+
records.push(record);
|
|
491
|
+
if (record.state === "completed") return visit(index + 1, result);
|
|
492
|
+
appendSkipped(index + 1);
|
|
493
|
+
return finish("blocked", stage.key);
|
|
494
|
+
}, (error) => {
|
|
495
|
+
const failed = laneFailure(stage.generatedKey, error);
|
|
496
|
+
records.push(laneStageRecord(stage.key, failed));
|
|
497
|
+
appendSkipped(index + 1);
|
|
498
|
+
return finish("blocked", stage.key);
|
|
499
|
+
});
|
|
500
|
+
};
|
|
501
|
+
return visit(0, firstResult);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
function workflowPlanStringMetadata(params) {
|
|
505
|
+
return {
|
|
506
|
+
...(typeof params.phase === "string" && params.phase.trim() ? { phase: params.phase.trim() } : {}),
|
|
507
|
+
...(typeof params.label === "string" && params.label.trim() ? { label: params.label.trim() } : {}),
|
|
508
|
+
...(typeof params.agent === "string" && params.agent.trim() ? { agent: params.agent.trim() } : {}),
|
|
509
|
+
};
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
function runLanes(laneSpecs) {
|
|
513
|
+
const lanes = validateLaneSpecs(laneSpecs);
|
|
514
|
+
parentPort.postMessage({ type: "lanePlan", lanes: lanes.map((lane) => ({
|
|
515
|
+
key: lane.key,
|
|
516
|
+
stages: lane.stages.map((stage) => ({
|
|
517
|
+
key: stage.key,
|
|
518
|
+
generatedKey: stage.generatedKey,
|
|
519
|
+
...workflowPlanStringMetadata(stage.params),
|
|
520
|
+
...(typeof stage.params.as === "string" && stage.params.as.trim() ? { outputName: stage.params.as.trim() } : {}),
|
|
521
|
+
...(stage.params.outputSchema !== undefined ? { structured: true } : {}),
|
|
522
|
+
})),
|
|
523
|
+
})) });
|
|
524
|
+
const firstItems = lanes.map((lane) => {
|
|
525
|
+
const first = lane.stages[0];
|
|
526
|
+
return { key: first.generatedKey, ...first.params };
|
|
527
|
+
});
|
|
528
|
+
// Share the runs.all batch launcher while allowing each lane to advance independently.
|
|
529
|
+
const firstBatch = launchRunsAll(firstItems, lanes.map((lane) => lane.key));
|
|
530
|
+
const firstResults = firstBatch.launched.map(({ promise }) => promise.then(decorateWorkflowChildResult));
|
|
531
|
+
let trackedAggregate;
|
|
532
|
+
const observe = (observations) => trackRunObservation(observations, trackedAggregate);
|
|
533
|
+
const laneAggregate = Promise.all(lanes.map((lane, index) => firstResults[index].then(
|
|
534
|
+
(result) => runLane(lane, result, observe),
|
|
535
|
+
(error) => runLane(lane, laneFailure(lane.stages[0].generatedKey, error), observe),
|
|
536
|
+
)));
|
|
537
|
+
trackedAggregate = trackRunObservation(firstBatch.launched.map(({ key, callId }) => ({ key, operation: "run", callId })), laneAggregate);
|
|
538
|
+
return trackedAggregate;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
function formatRef(result) {
|
|
542
|
+
if (!result || typeof result !== "object") throw new Error("runs.ref(result) requires a run result object.");
|
|
543
|
+
const parts = ["run " + (result.key || "unknown")];
|
|
544
|
+
if (result.runId) parts.push("id=" + String(result.runId).slice(0, 8));
|
|
545
|
+
return "[" + parts.join("; ") + "]";
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
function formatChildResultString(result) {
|
|
549
|
+
const output = typeof result?.output === "string" ? result.output.trim() : "";
|
|
550
|
+
return output || formatRef(result);
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
function decorateWorkflowChildResult(result) {
|
|
554
|
+
if (!result || typeof result !== "object" || Array.isArray(result)) return result;
|
|
555
|
+
Object.defineProperties(result, {
|
|
556
|
+
toString: { value() { return formatChildResultString(this); }, enumerable: false, configurable: true },
|
|
557
|
+
});
|
|
558
|
+
return result;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
let runFingerprints = new Map();
|
|
562
|
+
|
|
563
|
+
function validateExtensionBindings(value, label) {
|
|
564
|
+
if (value === undefined) return;
|
|
565
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(label + " extensionBindings must be a plain JSON object.");
|
|
566
|
+
const keys = Object.keys(value);
|
|
567
|
+
if (keys.length > 16) throw new Error(label + " extensionBindings supports at most 16 namespaces.");
|
|
568
|
+
for (const key of keys) if (!/^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,62})\/[1-9][0-9]{0,8}$/.test(key)) throw new Error(label + " extensionBindings namespace '" + key + "' must use a package-like name followed by '/<positive-version>'.");
|
|
569
|
+
assertJsonValue(value, label + " extensionBindings");
|
|
570
|
+
let propertyCount = 0;
|
|
571
|
+
function visit(entry, depth) {
|
|
572
|
+
if (!entry || typeof entry !== "object") return;
|
|
573
|
+
if (depth > 16) throw new Error(label + " extensionBindings exceeds the maximum nesting depth of 16.");
|
|
574
|
+
if (Array.isArray(entry)) { for (const item of entry) visit(item, depth + 1); return; }
|
|
575
|
+
for (const child of Object.values(entry)) {
|
|
576
|
+
propertyCount++;
|
|
577
|
+
if (propertyCount > 256) throw new Error(label + " extensionBindings exceeds 256 total properties.");
|
|
578
|
+
visit(child, depth + 1);
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
visit(value, 0);
|
|
582
|
+
if (new TextEncoder().encode(stableRunJson(value)).byteLength > 16384) throw new Error(label + " extensionBindings canonical JSON exceeds 16384 bytes.");
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
function validateLaneMetadata(value, label, workflowKey) {
|
|
586
|
+
if (value === undefined) return;
|
|
587
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(label + " must be a plain JSON object.");
|
|
588
|
+
const fields = Object.keys(value);
|
|
589
|
+
const allowed = ["version", "key", "mode", "sourceRef", "claims", "outputPaths"];
|
|
590
|
+
const unknown = fields.filter((field) => !allowed.includes(field));
|
|
591
|
+
if (unknown.length > 0) throw new Error(label + " has unsupported fields: " + unknown.join(", ") + ".");
|
|
592
|
+
if (value.version !== 1) throw new Error(label + ".version must be 1.");
|
|
593
|
+
if (typeof value.key !== "string" || !value.key.trim() || !runKeyPattern.test(value.key.trim())) throw new Error(label + ".key is invalid.");
|
|
594
|
+
if (workflowKey !== undefined && value.key.trim() !== workflowKey) throw new Error(label + ".key must match workflow key '" + workflowKey + "'.");
|
|
595
|
+
if (value.mode !== undefined && !["mutation", "review", "scout", "gate"].includes(value.mode)) throw new Error(label + ".mode is invalid.");
|
|
596
|
+
const bounded = (entry, maxBytes) => typeof entry === "string" && entry.trim() && new TextEncoder().encode(entry.trim()).byteLength <= maxBytes && !/[\r\n\u0000]/.test(entry);
|
|
597
|
+
if (value.sourceRef !== undefined && !bounded(value.sourceRef, 128)) throw new Error(label + ".sourceRef is invalid.");
|
|
598
|
+
for (const [name, maxItems, maxLength] of [["claims", 20, 160], ["outputPaths", 10, 256]]) {
|
|
599
|
+
if (value[name] === undefined) continue;
|
|
600
|
+
if (!Array.isArray(value[name]) || value[name].length > maxItems || value[name].some((entry) => !bounded(entry, maxLength))) throw new Error(label + "." + name + " is invalid.");
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
function validateRunCall(key, params, label, fingerprints) {
|
|
605
|
+
if (typeof key !== "string" || !runKeyPattern.test(key)) throw new Error(label + " has an invalid key.");
|
|
606
|
+
if (hostKeys.has(key)) throw new Error("Workflow key '" + key + "' is already used by runs.host.");
|
|
607
|
+
if (!params || typeof params !== "object" || Array.isArray(params)) throw new Error(label + " requires a params object.");
|
|
608
|
+
if (Object.prototype.hasOwnProperty.call(params, "action") || Object.prototype.hasOwnProperty.call(params, "workflowScript") || Object.prototype.hasOwnProperty.call(params, "globalConcurrencyLimit") || Object.prototype.hasOwnProperty.call(params, "maxSubagentSpawnsPerRun") || Object.prototype.hasOwnProperty.call(params, "tasks") || Object.prototype.hasOwnProperty.call(params, "chain") || Object.prototype.hasOwnProperty.call(params, "parallel") || Object.prototype.hasOwnProperty.call(params, "concurrency") || Object.prototype.hasOwnProperty.call(params, "chainDir")) {
|
|
609
|
+
const hint = label === "runs.run" ? "; use runs.all(...) and JavaScript control flow for orchestration." : ".";
|
|
610
|
+
throw new Error(label + " accepts one child via { agent, task } and execution controls only" + hint);
|
|
611
|
+
}
|
|
612
|
+
if (Object.prototype.hasOwnProperty.call(params, "clarify")) throw new Error(label + " does not support clarify UI.");
|
|
613
|
+
if (params.worktree !== undefined && typeof params.worktree !== "boolean") throw new Error(label + " worktree must be true or false.");
|
|
614
|
+
validateLaneMetadata(params.lane, label + " lane", key);
|
|
615
|
+
if (params.gate !== undefined && (typeof params.gate !== "string" || !params.gate.trim())) throw new Error(label + " gate must be a non-empty command string.");
|
|
616
|
+
if (params.gate !== undefined && params.acceptance !== undefined) throw new Error(label + " gate cannot be combined with acceptance; use one gate command or acceptance.verify.");
|
|
617
|
+
if (params.gate !== undefined && params.resume !== undefined) throw new Error(label + " gate is not supported with retained resume.");
|
|
618
|
+
if (params.extensionBindings !== undefined && params.resume !== undefined) throw new Error(label + " extensionBindings is not supported with retained resume; resume uses the original retained child binding.");
|
|
619
|
+
if (params.resume !== undefined && typeof params.resume !== "string") {
|
|
620
|
+
const reference = params.resume;
|
|
621
|
+
if (!reference || typeof reference !== "object" || Array.isArray(reference)) throw new Error(label + " resume must be a retained run id or keyed workflow receipt reference.");
|
|
622
|
+
const fields = Object.keys(reference);
|
|
623
|
+
if (fields.some((field) => field !== "workflowRunId" && field !== "key" && field !== "latest")) throw new Error(label + " keyed resume contains unsupported fields.");
|
|
624
|
+
if (typeof reference.workflowRunId !== "string" || !reference.workflowRunId.trim()) throw new Error(label + " keyed resume workflowRunId must be non-empty.");
|
|
625
|
+
if (typeof reference.key !== "string" || !runKeyPattern.test(reference.key)) throw new Error(label + " keyed resume key is invalid.");
|
|
626
|
+
if (reference.latest !== true) throw new Error(label + " keyed resume requires latest: true.");
|
|
627
|
+
}
|
|
628
|
+
if (typeof params.resume === "string" && !params.resume.trim()) throw new Error(label + " resume must be a non-empty retained run id.");
|
|
629
|
+
if (params.resume !== undefined && params.agent !== undefined) throw new Error(label + " resume and agent are mutually exclusive.");
|
|
630
|
+
if (params.resume !== undefined && (typeof params.task !== "string" || !params.task.trim())) throw new Error(label + " resume requires a non-empty task follow-up.");
|
|
631
|
+
validateExtensionBindings(params.extensionBindings, label);
|
|
632
|
+
assertJsonValue(params, label + " params");
|
|
633
|
+
const fingerprint = stableRunJson(params);
|
|
634
|
+
const existing = fingerprints.get(key);
|
|
635
|
+
if (existing !== undefined && existing !== fingerprint) throw new Error("Duplicate workflow key '" + key + "' used with incompatible launch params.");
|
|
636
|
+
fingerprints.set(key, fingerprint);
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
const hostKeys = new Set();
|
|
640
|
+
|
|
641
|
+
function validateHostCommand(key, params) {
|
|
642
|
+
validateLaneKey(key, "runs.host");
|
|
643
|
+
if (!params || typeof params !== "object" || Array.isArray(params)) throw new Error("runs.host('" + key + "') params must be an object.");
|
|
644
|
+
const allowed = new Set(["kind", "command", "timeoutMs", "output", "role", "provider"]);
|
|
645
|
+
const unknown = Object.keys(params).filter((field) => !allowed.has(field));
|
|
646
|
+
if (unknown.length) {
|
|
647
|
+
const cwdHint = unknown.includes("cwd")
|
|
648
|
+
? " The host step does not accept per-step cwd; commands and relative output paths use the workflow cwd. Set cwd on the outer subagent request, or put a trusted directory change in command (for example, 'cd /path/to/worktree && npm test')."
|
|
649
|
+
: "";
|
|
650
|
+
throw new Error("runs.host('" + key + "') params have unsupported fields: " + unknown.join(", ") + "." + cwdHint);
|
|
651
|
+
}
|
|
652
|
+
if (params.kind !== "command") throw new Error("runs.host('" + key + "') kind must be 'command'.");
|
|
653
|
+
if (typeof params.command !== "string" || !params.command.trim() || params.command.includes("\u0000") || new TextEncoder().encode(params.command.trim()).byteLength > 16384) throw new Error("runs.host('" + key + "') command must be a non-empty string of at most 16384 bytes without NUL.");
|
|
654
|
+
if (!Number.isInteger(params.timeoutMs) || params.timeoutMs < 1 || params.timeoutMs > 86400000) throw new Error("runs.host('" + key + "') timeoutMs must be an integer from 1 to 86400000.");
|
|
655
|
+
if (params.output !== undefined && (typeof params.output !== "string" || !params.output.trim() || /^[/\\]|(?:^|[/\\])\.\.(?:[/\\]|$)/.test(params.output) || /[\u0000-\u001f\u007f]/.test(params.output) || new TextEncoder().encode(params.output.trim()).byteLength > 240)) throw new Error("runs.host('" + key + "') output must be a bounded relative path without traversal or control characters.");
|
|
656
|
+
if (params.role !== undefined && params.role !== "ci" && params.role !== "gate") throw new Error("runs.host('" + key + "') role must be 'ci' or 'gate'.");
|
|
657
|
+
if (params.provider !== undefined && (typeof params.provider !== "string" || !params.provider.trim() || /[\r\n\u0000]/.test(params.provider) || new TextEncoder().encode(params.provider.trim()).byteLength > 64)) throw new Error("runs.host('" + key + "') provider must be a non-empty single-line string of at most 64 bytes.");
|
|
658
|
+
assertJsonValue(params, "runs.host('" + key + "') params");
|
|
659
|
+
if (hostKeys.has(key) || runFingerprints.has(key)) throw new Error("Workflow key '" + key + "' is already in use.");
|
|
660
|
+
if (hostKeys.size >= 32) throw new Error("workflowScript supports at most 32 runs.host calls.");
|
|
661
|
+
hostKeys.add(key);
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
function launchRunsAll(items, generatedLaneKeys) {
|
|
665
|
+
if (!Array.isArray(items)) throw new Error("runs.all(items) requires an array.");
|
|
666
|
+
const fingerprints = new Map(runFingerprints);
|
|
667
|
+
const calls = [];
|
|
668
|
+
for (let index = 0; index < items.length; index++) {
|
|
669
|
+
if (!Object.prototype.hasOwnProperty.call(items, index)) throw new Error("runs.all items must not contain sparse entries.");
|
|
670
|
+
const item = items[index];
|
|
671
|
+
if (!item || typeof item !== "object" || Array.isArray(item)) throw new Error("runs.all item " + index + " must be an object.");
|
|
672
|
+
const { key, ...params } = item;
|
|
673
|
+
validateRunCall(key, params, "runs.all item " + index, fingerprints);
|
|
674
|
+
calls.push({ key, params });
|
|
675
|
+
}
|
|
676
|
+
runFingerprints = fingerprints;
|
|
677
|
+
const batch = { id: "batch-" + (++nextCallId), calls };
|
|
678
|
+
const launched = calls.map(({ key, params }, index) => runHostCall(key, params, true, batch, generatedLaneKeys?.[index]));
|
|
679
|
+
return { calls, launched };
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
const runs = Object.freeze({
|
|
683
|
+
run(key, params) {
|
|
684
|
+
validateRunCall(key, params, "runs.run", runFingerprints);
|
|
685
|
+
const launched = runHostCall(key, params, false);
|
|
686
|
+
return trackRunObservation([{ key, operation: "run", callId: launched.callId }], launched.promise.then(decorateWorkflowChildResult));
|
|
687
|
+
},
|
|
688
|
+
all(items) {
|
|
689
|
+
const { calls, launched } = launchRunsAll(items);
|
|
690
|
+
return trackRunObservation(launched.map(({ key, callId }) => ({ key, operation: "run", callId })), Promise.all(launched.map(({ promise }) => promise)).then((results) => wrapRunsAllResults(results.map(decorateWorkflowChildResult), calls.map(({ key }) => key))));
|
|
691
|
+
},
|
|
692
|
+
lanes(laneSpecs) {
|
|
693
|
+
return runLanes(laneSpecs);
|
|
694
|
+
},
|
|
695
|
+
host(key, params) {
|
|
696
|
+
validateHostCommand(key, params);
|
|
697
|
+
return hostCall("host", { key, params }, { key, operation: "host" });
|
|
698
|
+
},
|
|
699
|
+
steer(key, message, options = {}) {
|
|
700
|
+
if (typeof key !== "string" || !runKeyPattern.test(key)) throw new Error("runs.steer has an invalid key.");
|
|
701
|
+
if (typeof message !== "string" || !message.trim()) throw new Error("runs.steer message must be a non-empty string.");
|
|
702
|
+
if (!options || typeof options !== "object" || Array.isArray(options)) throw new Error("runs.steer options must be an object.");
|
|
703
|
+
const allowed = new Set(["mode", "index", "ackTimeoutMs"]);
|
|
704
|
+
for (const option of Object.keys(options)) if (!allowed.has(option)) throw new Error("runs.steer options contain unsupported field '" + option + "'.");
|
|
705
|
+
if (options.mode !== undefined && options.mode !== "steer" && options.mode !== "follow_up" && options.mode !== "auto") throw new Error("runs.steer mode must be 'steer', 'follow_up', or 'auto'.");
|
|
706
|
+
if (options.index !== undefined && (!Number.isInteger(options.index) || options.index < 0 || options.index > 1000000)) throw new Error("runs.steer index must be an integer between 0 and 1000000.");
|
|
707
|
+
if (options.ackTimeoutMs !== undefined && (!Number.isInteger(options.ackTimeoutMs) || options.ackTimeoutMs < 1)) throw new Error("runs.steer ackTimeoutMs must be a positive integer.");
|
|
708
|
+
return hostCall("steer", { key, message: message.trim(), options }, { key, operation: "steer" });
|
|
709
|
+
},
|
|
710
|
+
status(keyOrRunId) { return hostCall("status", { keyOrRunId }); },
|
|
711
|
+
ref: formatRef,
|
|
712
|
+
refs(results) {
|
|
713
|
+
if (!Array.isArray(results)) throw new Error("runs.refs(results) requires an array.");
|
|
714
|
+
return results.map(formatRef).join("\n");
|
|
715
|
+
},
|
|
716
|
+
});
|
|
717
|
+
|
|
718
|
+
function validateStateKey(key) {
|
|
719
|
+
if (typeof key !== "string" || !runKeyPattern.test(key)) throw new Error("state key must be 1-128 characters using letters, numbers, '.', '_' or '-', and start with a letter or number.");
|
|
720
|
+
return key;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
const state = Object.freeze({
|
|
724
|
+
get(key) { return hostCall("state.get", { key: validateStateKey(key) }); },
|
|
725
|
+
set(key, value) {
|
|
726
|
+
const validKey = validateStateKey(key);
|
|
727
|
+
assertJsonValue(value, "state.set('" + validKey + "') value");
|
|
728
|
+
return hostCall("state.set", { key: validKey, value });
|
|
729
|
+
},
|
|
730
|
+
});
|
|
731
|
+
|
|
732
|
+
let contextObjectPrototype;
|
|
733
|
+
|
|
734
|
+
const capturedConsole = Object.freeze(Object.fromEntries(
|
|
735
|
+
["log", "info", "warn", "error"].map((level) => [level, (...args) => {
|
|
736
|
+
parentPort.postMessage({ type: "console", level, text: args.map((value) => typeof value === "string" ? value : inspect(value, { depth: 4, breakLength: 120 })).join(" ") });
|
|
737
|
+
}]),
|
|
738
|
+
));
|
|
739
|
+
|
|
740
|
+
function formatWorkflowScriptSyntaxError(error) {
|
|
741
|
+
const details = formatWorkflowScriptError(error);
|
|
742
|
+
return [
|
|
743
|
+
"workflowScript must be valid JavaScript.",
|
|
744
|
+
"If task text contains Markdown fences or backticks, use an array joined with \"\\n\" or escaped strings instead of a raw backtick template literal.",
|
|
745
|
+
"",
|
|
746
|
+
"Original SyntaxError:",
|
|
747
|
+
details,
|
|
748
|
+
].join("\n");
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
function formatWorkflowScriptError(error) {
|
|
752
|
+
const message = error && typeof error.message === "string" ? error.message : String(error);
|
|
753
|
+
const stack = error && typeof error.stack === "string" ? error.stack : "";
|
|
754
|
+
if (!stack) return message;
|
|
755
|
+
return stack.includes(message) ? stack : message + "\n" + stack;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
function isSyntaxError(error) {
|
|
759
|
+
return error instanceof SyntaxError || error?.name === "SyntaxError";
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
const NESTED_ASYNC_WORKFLOW_ERROR = "workflowScript validation failed before child launch; no children launched. workflowScript does not support nested async functions. Use top-level await, plain helper functions that return runs.run(...), or explicit Promise chains so workflows stay portable across Node and Bun. Parallel plus sequential rewrite: const a = runs.run(\"a\", { agent: \"worker\", task: \"A\" }); const writer = await runs.run(\"writer\", { agent: \"worker\", task: \"Write\" }); const review = await runs.run(\"review\", { agent: \"reviewer\", task: writer.output }); const [aResult] = await Promise.all([a]); return { a: aResult.output, issue: { writerRunId: writer.runId, reviewRunId: review.runId } };";
|
|
763
|
+
const AST_SCALAR_KEYS = new Set(["type", "start", "end"]);
|
|
764
|
+
|
|
765
|
+
function assertPortableWorkflowScript(source) {
|
|
766
|
+
const wrapped = "(async () => {\n" + source + "\n})()";
|
|
767
|
+
const ast = parse(wrapped, { ecmaVersion: "latest", sourceType: "script" });
|
|
768
|
+
const wrapper = workflowWrapperFunction(ast);
|
|
769
|
+
walkWorkflowAst(wrapper.body, wrapper);
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
function workflowWrapperFunction(ast) {
|
|
773
|
+
const wrapper = ast.body?.[0]?.expression?.callee;
|
|
774
|
+
if (!wrapper || wrapper.type !== "ArrowFunctionExpression") throw new Error("workflowScript wrapper parse invariant failed.");
|
|
775
|
+
return wrapper;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
function isAsyncFunctionNode(node) {
|
|
779
|
+
return node.async === true && (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression");
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
function walkWorkflowAst(node, allowedAsyncFunction) {
|
|
783
|
+
if (!node || typeof node !== "object") return;
|
|
784
|
+
if (Array.isArray(node)) {
|
|
785
|
+
for (const item of node) walkWorkflowAst(item, allowedAsyncFunction);
|
|
786
|
+
return;
|
|
787
|
+
}
|
|
788
|
+
if (node !== allowedAsyncFunction && isAsyncFunctionNode(node)) {
|
|
789
|
+
throw new Error(NESTED_ASYNC_WORKFLOW_ERROR);
|
|
790
|
+
}
|
|
791
|
+
for (const [key, child] of Object.entries(node)) {
|
|
792
|
+
if (AST_SCALAR_KEYS.has(key)) continue;
|
|
793
|
+
walkWorkflowAst(child, allowedAsyncFunction);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
function assertJsonValue(value, path = "emit", seen = new Set()) {
|
|
798
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return;
|
|
799
|
+
if (typeof value === "number") {
|
|
800
|
+
if (!Number.isFinite(value)) throw new Error(path + " must contain only finite JSON numbers.");
|
|
801
|
+
return;
|
|
802
|
+
}
|
|
803
|
+
if (typeof value !== "object") throw new Error(path + " must be a JSON value; received " + typeof value + ".");
|
|
804
|
+
if (seen.has(value)) throw new Error(path + " must not contain cycles.");
|
|
805
|
+
seen.add(value);
|
|
806
|
+
if (Array.isArray(value)) {
|
|
807
|
+
for (let index = 0; index < value.length; index++) {
|
|
808
|
+
if (!Object.prototype.hasOwnProperty.call(value, index)) throw new Error(path + " must not contain sparse array entries.");
|
|
809
|
+
assertJsonValue(value[index], path + "[" + index + "]", seen);
|
|
810
|
+
}
|
|
811
|
+
} else {
|
|
812
|
+
const prototype = Object.getPrototypeOf(value);
|
|
813
|
+
if (prototype !== null && prototype !== Object.prototype && prototype !== contextObjectPrototype) throw new Error(path + " must contain only plain JSON objects.");
|
|
814
|
+
if (Object.getOwnPropertySymbols(value).length > 0) throw new Error(path + " must not contain symbol keys.");
|
|
815
|
+
for (const [key, entry] of Object.entries(value)) assertJsonValue(entry, path + "." + key, seen);
|
|
816
|
+
}
|
|
817
|
+
seen.delete(value);
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
function isPlainWorkflowObject(value) {
|
|
821
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return false;
|
|
822
|
+
const prototype = Object.getPrototypeOf(value);
|
|
823
|
+
return prototype === null || prototype === Object.prototype || prototype === contextObjectPrototype;
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
function unwrapRunsAllResults(value, seen = new Map()) {
|
|
827
|
+
if (value === null || typeof value !== "object") return value;
|
|
828
|
+
const runsAllTarget = runsAllResultTargets.get(value);
|
|
829
|
+
const target = runsAllTarget || value;
|
|
830
|
+
if (seen.has(target)) return seen.get(target);
|
|
831
|
+
if (Array.isArray(target)) {
|
|
832
|
+
const copy = [];
|
|
833
|
+
seen.set(target, copy);
|
|
834
|
+
let changed = !!runsAllTarget;
|
|
835
|
+
for (let index = 0; index < target.length; index++) {
|
|
836
|
+
copy[index] = unwrapRunsAllResults(target[index], seen);
|
|
837
|
+
changed ||= copy[index] !== target[index];
|
|
838
|
+
}
|
|
839
|
+
return changed ? copy : target;
|
|
840
|
+
}
|
|
841
|
+
if (!isPlainWorkflowObject(target) || Object.getOwnPropertySymbols(target).length > 0) return target;
|
|
842
|
+
let changed = false;
|
|
843
|
+
const entries = Object.entries(target).map(([key, entry]) => {
|
|
844
|
+
const unwrapped = unwrapRunsAllResults(entry, seen);
|
|
845
|
+
changed ||= unwrapped !== entry;
|
|
846
|
+
return [key, unwrapped];
|
|
847
|
+
});
|
|
848
|
+
return changed ? Object.fromEntries(entries) : target;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
function omitUndefinedWorkflowValues(value, seen = new Set()) {
|
|
852
|
+
if (value === null || typeof value !== "object") return value;
|
|
853
|
+
if (seen.has(value)) return value;
|
|
854
|
+
seen.add(value);
|
|
855
|
+
const normalized = Array.isArray(value)
|
|
856
|
+
? value.map((entry) => entry === undefined ? null : omitUndefinedWorkflowValues(entry, seen))
|
|
857
|
+
: isPlainWorkflowObject(value) && Object.getOwnPropertySymbols(value).length === 0
|
|
858
|
+
? Object.fromEntries(Object.entries(value).flatMap(([key, entry]) => entry === undefined ? [] : [[key, omitUndefinedWorkflowValues(entry, seen)]]))
|
|
859
|
+
: value;
|
|
860
|
+
seen.delete(value);
|
|
861
|
+
return normalized;
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
parentPort.on("message", async (message) => {
|
|
865
|
+
if (message.type === "response") {
|
|
866
|
+
const entry = pending.get(message.callId);
|
|
867
|
+
if (!entry) return;
|
|
868
|
+
pending.delete(message.callId);
|
|
869
|
+
if (message.ok) entry.resolve(message.value);
|
|
870
|
+
else {
|
|
871
|
+
const error = new Error(message.error);
|
|
872
|
+
if (message.errorKind === "detached-child") error.workflowErrorKind = "detached-child";
|
|
873
|
+
entry.reject(error);
|
|
874
|
+
}
|
|
875
|
+
return;
|
|
876
|
+
}
|
|
877
|
+
if (message.type !== "start") return;
|
|
878
|
+
try {
|
|
879
|
+
const sandbox = { runs, Promise: workflowPromise, emit(value) { const emittedValue = unwrapRunsAllResults(value); assertJsonValue(emittedValue); parentPort.postMessage({ type: "emit", value: emittedValue }); }, console: capturedConsole };
|
|
880
|
+
if (message.stateEnabled) sandbox.state = state;
|
|
881
|
+
const context = vm.createContext(sandbox, { codeGeneration: { strings: false, wasm: false } });
|
|
882
|
+
contextObjectPrototype = vm.runInContext("Object.prototype", context);
|
|
883
|
+
let compiled;
|
|
884
|
+
try {
|
|
885
|
+
assertPortableWorkflowScript(message.script);
|
|
886
|
+
compiled = new vm.Script("(async () => {\n" + message.script + "\n})()", { filename: "workflow-script.js" });
|
|
887
|
+
} catch (error) {
|
|
888
|
+
parentPort.postMessage({ type: "error", error: isSyntaxError(error) ? formatWorkflowScriptSyntaxError(error) : formatWorkflowScriptError(error) });
|
|
889
|
+
return;
|
|
890
|
+
}
|
|
891
|
+
const nativePromisePrototype = vm.runInContext("(async () => {})().constructor.prototype", context);
|
|
892
|
+
const nativeThenDescriptor = Object.getOwnPropertyDescriptor(nativePromisePrototype, "then");
|
|
893
|
+
if (!nativeThenDescriptor || typeof nativeThenDescriptor.value !== "function") throw new Error("workflowScript could not inspect the VM Promise.prototype.then method.");
|
|
894
|
+
const nativeThen = nativeThenDescriptor.value;
|
|
895
|
+
let stopWorkflowPromiseHook;
|
|
896
|
+
let value;
|
|
897
|
+
try {
|
|
898
|
+
Object.defineProperty(nativePromisePrototype, "then", {
|
|
899
|
+
...nativeThenDescriptor,
|
|
900
|
+
value: function workflowPromiseThen(...args) {
|
|
901
|
+
if (isDirectWorkflowScriptPromiseHandlerCall() || suppressNativePromiseConsumption > 0) {
|
|
902
|
+
return withSuppressedNativePromiseConsumption(() => Reflect.apply(nativeThen, this, args));
|
|
903
|
+
}
|
|
904
|
+
return Reflect.apply(nativeThen, this, args);
|
|
905
|
+
},
|
|
906
|
+
});
|
|
907
|
+
stopWorkflowPromiseHook = createWorkflowPromiseHook({
|
|
908
|
+
before(promise) {
|
|
909
|
+
activeNativePromises.push(promise);
|
|
910
|
+
},
|
|
911
|
+
after(promise) {
|
|
912
|
+
const index = activeNativePromises.lastIndexOf(promise);
|
|
913
|
+
if (index !== -1) activeNativePromises.splice(index, 1);
|
|
914
|
+
},
|
|
915
|
+
init(promise, parent) {
|
|
916
|
+
const childTracker = nativePromiseTracker(promise);
|
|
917
|
+
if (!parent) return;
|
|
918
|
+
nativePromiseParents.set(promise, parent);
|
|
919
|
+
const parentTracker = nativePromiseTracker(parent);
|
|
920
|
+
addTrackerDependency(childTracker, parentTracker);
|
|
921
|
+
const activePromise = activeNativePromises.at(-1);
|
|
922
|
+
if (activePromise && activePromise !== parent) {
|
|
923
|
+
addTrackerDependency(nativePromiseTracker(activePromise), parentTracker);
|
|
924
|
+
} else if (!activePromise && suppressNativePromiseConsumption === 0) {
|
|
925
|
+
markTrackedObservationsConsumed(parentTracker);
|
|
926
|
+
}
|
|
927
|
+
},
|
|
928
|
+
});
|
|
929
|
+
const workflowResultPromise = compiled.runInContext(context);
|
|
930
|
+
topLevelWorkflowPromise = workflowResultPromise;
|
|
931
|
+
markTrackedObservationsConsumed(nativePromiseTracker(workflowResultPromise));
|
|
932
|
+
value = await workflowResultPromise;
|
|
933
|
+
} finally {
|
|
934
|
+
try {
|
|
935
|
+
stopWorkflowPromiseHook?.();
|
|
936
|
+
} finally {
|
|
937
|
+
try {
|
|
938
|
+
Object.defineProperty(nativePromisePrototype, "then", nativeThenDescriptor);
|
|
939
|
+
} finally {
|
|
940
|
+
topLevelWorkflowPromise = undefined;
|
|
941
|
+
activeNativePromises.length = 0;
|
|
942
|
+
suppressNativePromiseConsumption = 0;
|
|
943
|
+
nativePromiseTrackers = new WeakMap();
|
|
944
|
+
nativePromiseParents = new WeakMap();
|
|
945
|
+
}
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
const persistedValue = value === undefined ? null : omitUndefinedWorkflowValues(value);
|
|
949
|
+
try {
|
|
950
|
+
assertJsonValue(persistedValue, "return");
|
|
951
|
+
} catch (error) {
|
|
952
|
+
parentPort.postMessage({ type: "error", errorPhase: "return-serialization", error: formatWorkflowScriptError(error) });
|
|
953
|
+
return;
|
|
954
|
+
}
|
|
955
|
+
parentPort.postMessage({ type: "complete", value: persistedValue });
|
|
956
|
+
} catch (error) {
|
|
957
|
+
parentPort.postMessage({ type: "error", error: isSyntaxError(error) ? formatWorkflowScriptSyntaxError(error) : formatWorkflowScriptError(error), ...(error && error.workflowErrorKind === "detached-child" ? { errorKind: "detached-child" } : {}) });
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
`;
|
|
961
|
+
|
|
962
|
+
export interface WorkflowScriptChildResult {
|
|
963
|
+
key: string;
|
|
964
|
+
ok: boolean;
|
|
965
|
+
lane?: import("../shared/types.ts").WorkflowLaneMetadata;
|
|
966
|
+
terminalOutcome?: import("../shared/types.ts").WorkflowTerminalOutcome;
|
|
967
|
+
stopped?: boolean;
|
|
968
|
+
/** Canonical child agent name when launch resolution produced one. */
|
|
969
|
+
agent?: string;
|
|
970
|
+
runId?: string;
|
|
971
|
+
output: string;
|
|
972
|
+
error?: string;
|
|
973
|
+
detached?: boolean;
|
|
974
|
+
interrupted?: boolean;
|
|
975
|
+
structuredOutput?: unknown;
|
|
976
|
+
requestedContext?: "fresh" | "fork";
|
|
977
|
+
resolvedContext?: "fresh" | "fork" | "mixed";
|
|
978
|
+
outputReference?: string;
|
|
979
|
+
recovery?: AcceptanceRecoveryMetadata;
|
|
980
|
+
outputPathMapping?: { requestedPath: string; savedPath: string };
|
|
981
|
+
externalAdapter?: import("../shared/types.ts").ExternalCliReceiptMetadata;
|
|
982
|
+
resumability?: { state: "resumable" } | { state: "not-resumable"; reason: string };
|
|
983
|
+
continuation?: { runIds: string[] };
|
|
984
|
+
artifactPaths: string[];
|
|
985
|
+
results?: SingleResult[];
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
export interface WorkflowScriptTraceEntry {
|
|
989
|
+
operation: "run" | "status" | "steer" | "host";
|
|
990
|
+
key: string;
|
|
991
|
+
state: "started" | "completed" | "failed" | "detached" | "stopped" | "reused" | "queued" | "delivered" | "missed";
|
|
992
|
+
/** Canonical child agent name when resolved launch or result data is available. */
|
|
993
|
+
agent?: string;
|
|
994
|
+
runId?: string;
|
|
995
|
+
durationMs?: number;
|
|
996
|
+
phase?: string;
|
|
997
|
+
label?: string;
|
|
998
|
+
error?: string;
|
|
999
|
+
/** Internal provenance for a generated runs.lanes child key. */
|
|
1000
|
+
generatedLaneKey?: string;
|
|
1001
|
+
lane?: import("../shared/types.ts").WorkflowLaneMetadata;
|
|
1002
|
+
warning?: string;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/** Bounded plan metadata emitted when a workflow materializes a runs.lanes graph. */
|
|
1006
|
+
export interface WorkflowLanePlanStage {
|
|
1007
|
+
key: string;
|
|
1008
|
+
generatedKey: string;
|
|
1009
|
+
agent?: string;
|
|
1010
|
+
phase?: string;
|
|
1011
|
+
label?: string;
|
|
1012
|
+
outputName?: string;
|
|
1013
|
+
structured?: boolean;
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
export interface WorkflowLanePlan {
|
|
1017
|
+
key: string;
|
|
1018
|
+
stages: WorkflowLanePlanStage[];
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
export interface WorkflowSteerOptions {
|
|
1022
|
+
mode?: "steer" | "follow_up" | "auto";
|
|
1023
|
+
index?: number;
|
|
1024
|
+
ackTimeoutMs?: number;
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
export interface WorkflowSteerResult {
|
|
1028
|
+
key: string;
|
|
1029
|
+
state: "queued" | "delivered" | "missed" | "failed";
|
|
1030
|
+
requestId?: string;
|
|
1031
|
+
deliveryStatus?: "queued" | "delivered";
|
|
1032
|
+
targets?: Array<{ index: number; state: string; reason?: string }>;
|
|
1033
|
+
error?: string;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
export interface WorkflowReceiptResumeReference {
|
|
1037
|
+
workflowRunId: string;
|
|
1038
|
+
key: string;
|
|
1039
|
+
latest: true;
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
export interface WorkflowResolvedResumeReference {
|
|
1043
|
+
runId: string;
|
|
1044
|
+
runIds?: string[];
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
export interface WorkflowScriptResult {
|
|
1048
|
+
value: unknown;
|
|
1049
|
+
emits: unknown[];
|
|
1050
|
+
console: Array<{ level: "log" | "info" | "warn" | "error"; text: string }>;
|
|
1051
|
+
trace: WorkflowScriptTraceEntry[];
|
|
1052
|
+
children: WorkflowScriptChildResult[];
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
export class WorkflowScriptError extends Error {
|
|
1056
|
+
readonly partial: Omit<WorkflowScriptResult, "value">;
|
|
1057
|
+
readonly errorKind?: "detached-child" | "timeout";
|
|
1058
|
+
|
|
1059
|
+
constructor(message: string, partial: Omit<WorkflowScriptResult, "value">, errorKind?: "detached-child" | "timeout") {
|
|
1060
|
+
super(message);
|
|
1061
|
+
this.name = "WorkflowScriptError";
|
|
1062
|
+
this.partial = partial;
|
|
1063
|
+
this.errorKind = errorKind;
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
|
|
1067
|
+
export interface RunWorkflowScriptOptions {
|
|
1068
|
+
script: string;
|
|
1069
|
+
/** Host-only first-slice admission context. It is never sent to the workflow worker. */
|
|
1070
|
+
oneUsePermit?: { claim: (key: string) => string | undefined };
|
|
1071
|
+
timeoutMs?: number;
|
|
1072
|
+
signal?: AbortSignal;
|
|
1073
|
+
/** Maximum children executing concurrently within this workflow. Defaults to 20. */
|
|
1074
|
+
globalConcurrencyLimit?: number;
|
|
1075
|
+
admit?: (calls: Array<{ key: string; params: Record<string, unknown> }>) => void | Promise<void>;
|
|
1076
|
+
launch: (key: string, params: Record<string, unknown>, signal: AbortSignal, admission: { admitted: boolean; batch: boolean }) => Promise<WorkflowScriptChildResult>;
|
|
1077
|
+
resolveResume?: (reference: WorkflowReceiptResumeReference, signal: AbortSignal) => string | WorkflowResolvedResumeReference | Promise<string | WorkflowResolvedResumeReference>;
|
|
1078
|
+
status: (keyOrRunId: string, signal: AbortSignal) => Promise<WorkflowScriptChildResult>;
|
|
1079
|
+
steer?: (key: string, message: string, options: WorkflowSteerOptions, signal: AbortSignal) => Promise<WorkflowSteerResult>;
|
|
1080
|
+
host?: (key: string, params: WorkflowHostCommandParams, signal: AbortSignal) => Promise<WorkflowHostCommandResult>;
|
|
1081
|
+
onHostStep?: (hostStep: HostStepNodeV1) => void;
|
|
1082
|
+
state?: {
|
|
1083
|
+
get: (key: string) => unknown | Promise<unknown>;
|
|
1084
|
+
set: (key: string, value: unknown) => void | Promise<void>;
|
|
1085
|
+
};
|
|
1086
|
+
registerStopChild?: (stop: ((key: string, message?: string) => boolean) | undefined) => void;
|
|
1087
|
+
onTrace?: (trace: WorkflowScriptTraceEntry[]) => void;
|
|
1088
|
+
onLanePlan?: (lanes: WorkflowLanePlan[]) => void;
|
|
1089
|
+
onEmit?: (emits: unknown[]) => void;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
function combinedAbortSignal(signals: AbortSignal[]): AbortSignal {
|
|
1093
|
+
const controller = new AbortController();
|
|
1094
|
+
const abort = (signal: AbortSignal): void => {
|
|
1095
|
+
if (controller.signal.aborted) return;
|
|
1096
|
+
controller.abort(signal.reason);
|
|
1097
|
+
};
|
|
1098
|
+
for (const signal of signals) {
|
|
1099
|
+
if (signal.aborted) {
|
|
1100
|
+
abort(signal);
|
|
1101
|
+
break;
|
|
1102
|
+
}
|
|
1103
|
+
signal.addEventListener("abort", () => abort(signal), { once: true });
|
|
1104
|
+
}
|
|
1105
|
+
return controller.signal;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
1109
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
function isAcceptanceMetadataRecovery(result: WorkflowScriptChildResult): boolean {
|
|
1113
|
+
return !result.ok
|
|
1114
|
+
&& result.recovery?.status === "available-for-review"
|
|
1115
|
+
&& result.recovery.reason === "acceptance-metadata-rejected";
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
const RECOVERY_REVIEW_MUTATION_VERB_PATTERN = /\b(?:add(?:ing)?|append(?:ing)?|apply(?:ing)?|cherry[ -]pick(?:ing)?|change|changing|clean(?:ing)?|commit(?:ting)?|cop(?:y|ying)|create|creating|delete|deleting|edit(?:ing)?|fix(?:ing)?|implement(?:ing)?|insert(?:ing)?|make|making|merge|merging|mov(?:e|ing)|modify(?:ing)?|mutate|mutating|open(?:ing)?|patch(?:ing)?|prepend(?:ing)?|push(?:ing)?|rebase|rebasing|refactor(?:ing)?|remove|removing|rename|renaming|replace|replacing|revert(?:ing)?|revise|revising|rewrite|rewriting|sav(?:e|ing)|stag(?:e|ing)|stash(?:ing)?|tag(?:ging)?|touch(?:ing)?|update|updating|write|writing)\b/i;
|
|
1119
|
+
const RECOVERY_REVIEW_READ_ONLY_PATTERN = /\b(?:read[- ]only|review only|only return findings|return findings only|suggest fixes only|without\s+(?:editing|modifying|changing|writing|touching)|do not\s+(?:edit|modify|change|write|touch)|don't\s+(?:edit|modify|change|write|touch)|must not\s+(?:edit|modify|change|write|touch))\b/i;
|
|
1120
|
+
const RECOVERY_REVIEW_NO_MUTATION_CLAUSE_PATTERN = /\b(?:do not|don't|must not)\s+(?:edit|modify|change|write|touch)(?:\s+files?)?(?:\s*,\s*(?:commit|push|comment|merge|launch(?:\s+subagents?)?)(?=\s*(?:,|\bor\b|[.;!?\n)]|$)))*(?:\s*,?\s*or\s+(?:commit|push|comment|merge|launch(?:\s+subagents?)?)(?=\s*(?:[.;!?\n)]|$)))?/gi;
|
|
1121
|
+
const RECOVERY_REVIEW_DELIVERABLE_PATTERN = /\b(?:compose|create|draft|prepare|produce|write)\s+(?:(?:a|an|the|your)\s+)?(?:findings?|review|report|summary|analysis|recommendations?)(?:\s+(?:to|at|in)\s+\S+)?/gi;
|
|
1122
|
+
const RECOVERY_REVIEW_CONTEXT_OBJECT_PATTERN = /\breview\s+(?:(?:the|this|that|saved)\s+)?(?:patch|diff|changes?|implementation|report)\b/gi;
|
|
1123
|
+
const RECOVERY_REVIEW_MUTATION_NOUN_CONTEXT_PATTERN = /\b(?:later\s+real\s+)?update\s+imperatives?\b/gi;
|
|
1124
|
+
const RECOVERY_REVIEW_PRIOR_FIX_CONTEXT_PATTERN = /\bthe\s+prior\s+fix\s+keeps\b/gi;
|
|
1125
|
+
const RECOVERY_REVIEW_DETECTION_CONTEXT_PATTERN = /\b(?:mutation\s+detection\s+now\s+includes\s+move\/rename\/copy\s+file\s+mutation\s+imperatives|delegation\s+detection\s+now\s+blocks\s+get\/let\/have\/tell\/ask\s+follow-up\s+forms)(?=[,.;!?\n]|\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b|$)/gi;
|
|
1126
|
+
const RECOVERY_REVIEW_PATTERN_CHANGE_CONTEXT_PATTERN = /\bRECOVERY_REVIEW_MUTATION_VERB_PATTERN\s+now\s+includes\s+append,\s+prepend,\s+and\s+sav(?:e|ing)\b(?=\s*(?:[,.;!?\n)]|$))/gi;
|
|
1127
|
+
const RECOVERY_REVIEW_GIT_PATTERN_CHANGE_CONTEXT_PATTERN = /\bfixed\s+mutating\s+git\s+follow-up\s+bypasses\b|\b(?:added|adding)\s+[a-z][a-z-]*(?:\/[a-z][a-z-]*)*(?:(?:\s*,\s*(?:and\s+)?|\s+and\s+)[a-z][a-z-]*(?:\/[a-z][a-z-]*)*)*\s+to\s+the\s+(?:mutation\s+imperative|mutating\s+git\s+command)\s+pattern\b|\band\s+[a-z][a-z-]*(?:\/[a-z][a-z-]*)*(?:(?:\s*,\s*(?:and\s+)?|\s+and\s+)[a-z][a-z-]*(?:\/[a-z][a-z-]*)*)*\s+to\s+the\s+mutating\s+git\s+command\s+pattern\b/gi;
|
|
1128
|
+
const RECOVERY_REVIEW_VALIDATION_EVIDENCE_PATTERN = /\bvalidation(?:\s+after\s+fix)?\s*:/gi;
|
|
1129
|
+
const RECOVERY_REVIEW_CONTRACT_PROHIBITION_PATTERN = /\b(?:do not|don't|must not)\s+(?:mutate\s+durable\s+state|launch\s+(?:mutating|destructive|mutating\/destructive)\s+work)(?:\s+or\s+(?:mutate\s+durable\s+state|launch\s+(?:mutating|destructive|mutating\/destructive)\s+work))*/gi;
|
|
1130
|
+
const RECOVERY_REVIEW_ONLY_REVIEW_CONTRACT_PATTERN = /\bmay\s+only\s+launch\s+explicit\s+read-only\s+review\s+children\s+with\s+acceptance:false\b/gi;
|
|
1131
|
+
const RECOVERY_REVIEW_BLOCKED_CONTEXT_FRAGMENT_PATTERN = /\bstate\.set, runs\.host, runs\.steer, ordinary\/mutating children, and destructive command wording are blocked(?=[,.;!?\n)\]}]|$)/gi;
|
|
1132
|
+
const RECOVERY_REVIEW_REGRESSION_EVIDENCE_PATTERN = /\b(?:existing regressions cover plain rm and git clean\/reset\/restore|prior regressions covering rm\/git clean as evidence only)(?=[,.;!?\n)\]}]|$)/gi;
|
|
1133
|
+
const RECOVERY_REVIEW_BLOCKED_QUOTED_EXAMPLE_PATTERN = /(?:`[^`\n]+`|'[^'\n]+'|"[^"\n]+")(?:(?:\s*,\s*(?:and\s+)?|\s+and\s+)(?:`[^`\n]+`|'[^'\n]+'|"[^"\n]+"))*\s+(?:is|are|remains?)\s+(?:blocked|(?:an?\s+)?blocked\s+examples?)(?=[,.;!?\n)\]}]|$)/gi;
|
|
1134
|
+
const RECOVERY_REVIEW_CONTEXT_QUOTED_EXAMPLE_PATTERN = /\b(?:examples?|phrasing|forms|variants):\s*(?:`[^`\n]+`|'[^'\n]+'|"[^"\n]+")(?:(?:\s*,\s*(?:and\s+)?|\s+and\s+)(?:`[^`\n]+`|'[^'\n]+'|"[^"\n]+"))*/gi;
|
|
1135
|
+
const RECOVERY_REVIEW_LISTED_BLOCKED_EXAMPLE_PATTERN = /(?:^|[.;!?\n]\s*)blocked\s+examples:\s*(?:\r?\n[ \t]*(?:[-*]|\d+[.)])\s+[^\r\n]+)+/gim;
|
|
1136
|
+
const RECOVERY_REVIEW_BLOCKS_QUOTED_EXAMPLE_PATTERN = /\b(?:this\s+)?blocks?\s+examples?\s+like\s+(?:`[^`\n]+`|'[^'\n]+'|"[^"\n]+")(?:(?:\s*,\s*(?:and\s+)?|\s+and\s+)(?:`[^`\n]+`|'[^'\n]+'|"[^"\n]+"))*/gi;
|
|
1137
|
+
const RECOVERY_REVIEW_EXAMPLES_LIKE_BLOCKED_PATTERN = /\bexamples?\s+like\s+(?:`[^`\n]+`|'[^'\n]+'|"[^"\n]+")(?:(?:\s*,\s*(?:and\s+)?|\s+and\s+)(?:`[^`\n]+`|'[^'\n]+'|"[^"\n]+"))*\s+(?:is|are|remains?)\s+blocked\b/gi;
|
|
1138
|
+
const RECOVERY_REVIEW_QUOTED_VISIBLE_BLOCKED_PATTERN = /(?:\b(?:(?:the\s+)?examples?|commands?\s+hidden\s+in)\s+|(?:^|[\s([{]))(?:`[^`\n]+`|'[^'\n]+'|"[^"\n]+")(?:(?:\s*,\s*(?:and\s+|or\s+)?|\s+(?:and|or)\s+)(?:`[^`\n]+`|'[^'\n]+'|"[^"\n]+"))*\s+(?:(?:is|are|remains?)\s+)?visible\s+and\s+blocked\b/gi;
|
|
1139
|
+
const RECOVERY_REVIEW_PROMPTS_LIKE_BLOCKED_PATTERN = /\bdescribed\s+prompts?\s+like\s+Run\s+git\s+rebase\s+main,\s+git\s+rebase\s+main,\s+Run\s+git\s+cherry-pick\s+abc123,\s+cherry-pick\s+abc123,\s+and\s+Stage\s+the\s+changed\s+files\s+as\s+blocked\b/gi;
|
|
1140
|
+
const RECOVERY_REVIEW_GIT_MUTATIONS_BROADER_CONTEXT_PATTERN = /\bpositive\s+git\s+mutations\s+are\s+broader:\s*git\s+branch\s+-D\s+old,\s+git\s+tag\s+-d\s+v1\.0,\s+git\s+stash,\s+git\s+revert\s+abc123,\s+and\s+natural\s+cherry\s+pick\s+abc123\s+now\s+trips?\s+the\s+recovery\s+barrier\b/gi;
|
|
1141
|
+
const RECOVERY_REVIEW_GIT_COVERAGE_CONTEXT_PATTERN = /\bbroadened\s+positive\s+git\s+mutation\s+coverage\s+for\s+natural\s+`cherry\s+pick`,\s+`revert`,\s+`stash`,\s+`tag`,\s+plus\s+git\s+`branch\|revert\|stash\|tag`/gi;
|
|
1142
|
+
const RECOVERY_REVIEW_REGRESSION_QUOTED_EXAMPLE_PATTERN = /\b(?:added\s+)?exact\s+regressions?\s+for\s+(?:`[^`\n]+`|'[^'\n]+'|"[^"\n]+")(?:(?:\s*,\s*(?:and\s+)?|\s+and\s+)(?:`[^`\n]+`|'[^'\n]+'|"[^"\n]+"))*/gi;
|
|
1143
|
+
const RECOVERY_REVIEW_REGRESSION_ANAPHORIC_EXAMPLE_PATTERN = /\b(?:added\s+)?exact\s+regressions?\s+for\s+(?:do|run|execute|perform|apply)\s+(?:it|that|this|(?:the\s+)?(?:(?:previous(?:ly)?|prior|above|quoted|blocked)\s+){0,4}(?:command|example|operation|action|phrase|instruction|request))(?:[\s,]+(?:now|still|again|really|actually|immediately)){0,3}[\s,]+anyway(?:(?:\s*,\s*(?:and\s+)?|\s+and\s+)(?:do|run|execute|perform|apply)\s+(?:it|that|this|(?:the\s+)?(?:(?:previous(?:ly)?|prior|above|quoted|blocked)\s+){0,4}(?:command|example|operation|action|phrase|instruction|request))(?:[\s,]+(?:now|still|again|really|actually|immediately)){0,3}[\s,]+anyway)*/gi;
|
|
1144
|
+
const RECOVERY_REVIEW_REGRESSION_FOLLOWED_BY_ANAPHORIC_PATTERN = /\badded\s+(?:exact\s+)?regressions?\s+for\s+quoted\s+rm\s+remaining\s+blocked\s+followed\s+by\s+execute\s+the\s+previous\s+command\b(?=\s*(?:[,.;!?\n)]|\bwhile\b|$))/gi;
|
|
1145
|
+
const RECOVERY_REVIEW_REGRESSION_FOLLOWED_BY_NAMED_RM_PATTERN = /\b(?:added\s+)?(?:exact\s+)?regressions?\s+for\s+quoted\s+rm\s+remaining\s+blocked\s+followed\s+by\s+(?:do|run|execute|perform|apply)\s+(?:it|that|this|(?:the\s+)?(?:(?:previous(?:ly)?|prior|above|quoted|blocked)\s+){0,4}(?:command|example|operation|action|phrase|instruction|request))(?:[\s,]+(?:now|still|again|really|actually|immediately)){0,3}(?:[\s,]+anyway)?(?=\s*(?:[,.;!?\n)]|\bwhile\b|$))/gi;
|
|
1146
|
+
const RECOVERY_REVIEW_BLOCKED_LIVE_VARIANT_CONTEXT_PATTERN = /\b(?:while\s+)?keeping\s+live-command\s+variants\s+such\s+as\s+followed\s+by\s+execute\s+the\s+previous\s+command\s+then\s+update\s+tests\s+blocked\b(?=\s*(?:[,.;!?\n)]|$))/gi;
|
|
1147
|
+
const RECOVERY_REVIEW_ANAPHORIC_REFERENCES_CONTEXT_PATTERN = /\bdirect\s+anaphoric\s+references\s+now\s+include\s+numeric\s+and\s+word\s+ordinals\s+through\s+tenth\s+plus\s+one,\s+so\s+(?:do|run|execute|perform|apply)\s+(?:it|that|this|(?:the\s+)?(?:(?:\d+(?:st|nd|rd|th)|first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|last|next|previous(?:ly)?|prior|above|quoted|blocked)\s+){0,4}(?:command|example|operation|action|phrase|instruction|request|one))(?:[\s,]+(?:right|now|still|again|really|actually|immediately)){0,4}[\s,]+anyway(?:(?:\s*,\s*(?:and\s+)?|\s+and\s+)(?:do|run|execute|perform|apply)\s+(?:it|that|this|(?:the\s+)?(?:(?:\d+(?:st|nd|rd|th)|first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|last|next|previous(?:ly)?|prior|above|quoted|blocked)\s+){0,4}(?:command|example|operation|action|phrase|instruction|request|one))(?:[\s,]+(?:right|now|still|again|really|actually|immediately)){0,4}[\s,]+anyway)*\s+(?:is|are|remains?)\s+blocked\b(?:\s+after\s+quoted\s+destructive\s+examples\s+are\s+scrubbed)?/gi;
|
|
1148
|
+
const RECOVERY_REVIEW_NO_ANAPHORIC_MUTATION_CLAUSE_PATTERN = /\b(?:do not|don't|must not)\s+(?:do|run|execute|perform|apply)\s+(?:it|that|this|(?:the\s+)?(?:(?:\d+(?:st|nd|rd|th)|first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|last|next|previous(?:ly)?|prior|above|quoted|blocked)\s+){0,4}(?:command|example|operation|action|phrase|instruction|request|one))(?:(?!\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b)[^,.;!?\n—–-]){0,80}/gi;
|
|
1149
|
+
const RECOVERY_REVIEW_NO_DELEGATION_CLAUSE_PATTERN = /\b(?:do not|don't|must not)\s+(?:(?:launch|start|spawn|run)\b(?:(?!\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b)[^,.;!?\n])*(?:workers?|reviewers?|agents?|subagents?|children|child|runs?)|(?:get|let|request|hand\s+off|assign|use|have|tell)\b(?:(?!\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b)[^,.;!?\n])*(?:workers?|reviewers?|agents?|subagents?|children|child)|(?:get|let|have|tell|request)\b(?:(?!\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b)[^,.;!?\n])*(?:review|implementation|fix(?:es)?|changes?|follow-up)\b(?:(?!\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b)[^,.;!?\n])*\b(?:from|with|via|by)\b(?:(?!\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b)[^,.;!?\n])*(?:workers?|reviewers?|agents?|subagents?|children|child)|ask\b(?:(?!\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b)[^,.;!?\n])*(?:(?:workers?|reviewers?|agents?|subagents?|children|child)\b(?:(?!\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b)[^,.;!?\n])*\b(?:continue|implement|review|fix|edit|write|modify|change|patch|update|delete|remove|create|follow-up)|(?:review|implementation|fix(?:es)?|changes?|follow-up)\b(?:(?!\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b)[^,.;!?\n])*\b(?:from|via)\b(?:(?!\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b)[^,.;!?\n])*(?:workers?|reviewers?|agents?|subagents?|children|child)))\b/gi;
|
|
1150
|
+
const RECOVERY_REVIEW_DELEGATION_PATTERN = /\b(?:launch|start|spawn|run)\b[^,.;!?\n]*(?:workers?|reviewers?|agents?|subagents?|children|child|runs?)\b|\b(?:delegate|hand\s+off|assign)\s+(?:remediation|implementation(?:\s+follow-up)?|changes?|fix(?:es)?|follow-up)\s+to\s+(?:(?:a|an|the)\s+)?(?:workers?|reviewers?|agents?|subagents?|children|child)\b|\b(?:get|let|have|tell|request)\b[^,.;!?\n]*(?:workers?|reviewers?|agents?|subagents?|children|child)\b[^,.;!?\n]*\b(?:continue|implement|review|fix|edit|write|modify|change|patch|update|delete|remove|create|follow-up)\b|\b(?:get|let|have|tell|request)\b[^,.;!?\n]*(?:review|implementation|fix(?:es)?|changes?|follow-up)\b[^,.;!?\n]*\b(?:from|with|via|by)\b[^,.;!?\n]*(?:workers?|reviewers?|agents?|subagents?|children|child)\b|\bask\b[^,.;!?\n]*(?:(?:workers?|reviewers?|agents?|subagents?|children|child)\b[^,.;!?\n]*\b(?:continue|implement|review|fix|edit|write|modify|change|patch|update|delete|remove|create|follow-up)|(?:review|implementation|fix(?:es)?|changes?|follow-up)\b[^,.;!?\n]*\b(?:from|via)\b[^,.;!?\n]*(?:workers?|reviewers?|agents?|subagents?|children|child))\b|\buse\b[^,.;!?\n]*(?:workers?|reviewers?|agents?|subagents?|children|child|runs?)\s+(?:for|to)\s+(?:implementation|follow-up|remediation|fix|edit|write|modify|change|patch|update|delete|remove|create)\b/i;
|
|
1151
|
+
const RECOVERY_REVIEW_ANAPHORIC_MUTATION_PATTERN = /\b(?:do|run|execute|perform|apply)\s+(?:it|that|this|(?:the\s+)?(?:(?:\d+(?:st|nd|rd|th)|first|second|third|fourth|fifth|sixth|seventh|eighth|ninth|tenth|last|next|previous(?:ly)?|prior|above|quoted|blocked)\s+){0,4}(?:command|example|operation|action|phrase|instruction|request|one))(?!(?:\s+(?:(?:now|still|also|already)\s+)*(?:is|are|remains?)\s+blocked\b))(?:(?:[\s,]+\w+){0,4}[\s,]+anyway|(?:(?!\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b)[^,.;!?\n]){0,80})(?=\s*(?:[,.;!?\n)]|\b(?:and|but|then|however|nevertheless|nonetheless|yet)\b|$))/i;
|
|
1152
|
+
const RECOVERY_REVIEW_DESTRUCTIVE_COMMAND_PATTERN = /(?:^|[\s;,.`'"([{])(?:\S*\/)?(?:rm|rmdir|unlink|truncate|mv|cp|chmod|chown)\b|\bgit\b(?:\s+(?:-[A-Za-z](?:\s+(?:"[^"\n]*"|'[^'\n]*'|\S+))?|--(?:git-dir|work-tree|namespace|exec-path|config-env)(?:=(?:"[^"\n]*"|'[^'\n]*'|\S+)|\s+(?:"[^"\n]*"|'[^'\n]*'|\S+))|--[A-Za-z0-9-]+(?:=(?:"[^"\n]*"|'[^'\n]*'|\S+))?))*\s+(?:add|branch|cherry-pick|clean|commit|merge|rebase|reset|restore|revert|stash|tag|checkout|switch)\b/i;
|
|
1153
|
+
const RECOVERY_REVIEW_DASH_LIVE_ACTION_PATTERN = /(?:[—–]|--|\s-\s|:|\s\/\s)\s*(?:then\s+)?(?:(?:add|append|apply|change|cherry[ -]pick|clean|commit|copy|create|delete|edit|fix|implement|insert|make|merge|move|modify|mutate|open|patch|prepend|push|rebase|refactor|remove|rename|replace|revert|revise|rewrite|save|stage|stash|tag|touch|update|write)\b|(?:launch|start|spawn|run)\b[^,.;!?\n]*(?:workers?|reviewers?|agents?|subagents?|children|child|runs?)\b|(?:\S*\/)?(?:rm|rmdir|unlink|truncate|mv|cp|chmod|chown)\b|git\b[^,.;!?\n]*\b(?:add|branch|cherry-pick|clean|commit|merge|rebase|reset|restore|revert|stash|tag|checkout|switch)\b)/i;
|
|
1154
|
+
|
|
1155
|
+
function isExplicitReadOnlyRecoveryReview(params: Record<string, unknown>): boolean {
|
|
1156
|
+
const agent = typeof params.agent === "string" ? params.agent.trim() : "";
|
|
1157
|
+
const task = typeof params.task === "string" ? params.task.trim() : "";
|
|
1158
|
+
const taskDestructiveCommandText = task
|
|
1159
|
+
.replace(RECOVERY_REVIEW_BLOCKED_CONTEXT_FRAGMENT_PATTERN, " ")
|
|
1160
|
+
.replace(RECOVERY_REVIEW_REGRESSION_EVIDENCE_PATTERN, " ")
|
|
1161
|
+
.replace(RECOVERY_REVIEW_BLOCKED_QUOTED_EXAMPLE_PATTERN, " ")
|
|
1162
|
+
.replace(RECOVERY_REVIEW_CONTEXT_QUOTED_EXAMPLE_PATTERN, " ")
|
|
1163
|
+
.replace(RECOVERY_REVIEW_LISTED_BLOCKED_EXAMPLE_PATTERN, " ")
|
|
1164
|
+
.replace(RECOVERY_REVIEW_BLOCKS_QUOTED_EXAMPLE_PATTERN, " ")
|
|
1165
|
+
.replace(RECOVERY_REVIEW_EXAMPLES_LIKE_BLOCKED_PATTERN, " ")
|
|
1166
|
+
.replace(RECOVERY_REVIEW_QUOTED_VISIBLE_BLOCKED_PATTERN, " ")
|
|
1167
|
+
.replace(RECOVERY_REVIEW_PROMPTS_LIKE_BLOCKED_PATTERN, " ")
|
|
1168
|
+
.replace(RECOVERY_REVIEW_GIT_MUTATIONS_BROADER_CONTEXT_PATTERN, " ")
|
|
1169
|
+
.replace(RECOVERY_REVIEW_GIT_COVERAGE_CONTEXT_PATTERN, " ")
|
|
1170
|
+
.replace(RECOVERY_REVIEW_REGRESSION_FOLLOWED_BY_NAMED_RM_PATTERN, " ");
|
|
1171
|
+
const taskDashLiveActionText = task
|
|
1172
|
+
.replace(RECOVERY_REVIEW_DELIVERABLE_PATTERN, " ")
|
|
1173
|
+
.replace(RECOVERY_REVIEW_CONTEXT_OBJECT_PATTERN, " ")
|
|
1174
|
+
.replace(RECOVERY_REVIEW_MUTATION_NOUN_CONTEXT_PATTERN, " ")
|
|
1175
|
+
.replace(RECOVERY_REVIEW_PRIOR_FIX_CONTEXT_PATTERN, " ")
|
|
1176
|
+
.replace(RECOVERY_REVIEW_DETECTION_CONTEXT_PATTERN, " ")
|
|
1177
|
+
.replace(RECOVERY_REVIEW_PATTERN_CHANGE_CONTEXT_PATTERN, " ")
|
|
1178
|
+
.replace(RECOVERY_REVIEW_GIT_PATTERN_CHANGE_CONTEXT_PATTERN, " ")
|
|
1179
|
+
.replace(RECOVERY_REVIEW_VALIDATION_EVIDENCE_PATTERN, " ")
|
|
1180
|
+
.replace(RECOVERY_REVIEW_CONTRACT_PROHIBITION_PATTERN, " ")
|
|
1181
|
+
.replace(RECOVERY_REVIEW_ONLY_REVIEW_CONTRACT_PATTERN, " ")
|
|
1182
|
+
.replace(RECOVERY_REVIEW_BLOCKED_QUOTED_EXAMPLE_PATTERN, " ")
|
|
1183
|
+
.replace(RECOVERY_REVIEW_CONTEXT_QUOTED_EXAMPLE_PATTERN, " ")
|
|
1184
|
+
.replace(RECOVERY_REVIEW_LISTED_BLOCKED_EXAMPLE_PATTERN, " ")
|
|
1185
|
+
.replace(RECOVERY_REVIEW_BLOCKS_QUOTED_EXAMPLE_PATTERN, " ")
|
|
1186
|
+
.replace(RECOVERY_REVIEW_EXAMPLES_LIKE_BLOCKED_PATTERN, " ")
|
|
1187
|
+
.replace(RECOVERY_REVIEW_QUOTED_VISIBLE_BLOCKED_PATTERN, " ")
|
|
1188
|
+
.replace(RECOVERY_REVIEW_PROMPTS_LIKE_BLOCKED_PATTERN, " ")
|
|
1189
|
+
.replace(RECOVERY_REVIEW_GIT_MUTATIONS_BROADER_CONTEXT_PATTERN, " ")
|
|
1190
|
+
.replace(RECOVERY_REVIEW_GIT_COVERAGE_CONTEXT_PATTERN, " ")
|
|
1191
|
+
.replace(RECOVERY_REVIEW_REGRESSION_QUOTED_EXAMPLE_PATTERN, " ")
|
|
1192
|
+
.replace(RECOVERY_REVIEW_REGRESSION_ANAPHORIC_EXAMPLE_PATTERN, " ")
|
|
1193
|
+
.replace(RECOVERY_REVIEW_REGRESSION_FOLLOWED_BY_ANAPHORIC_PATTERN, " ")
|
|
1194
|
+
.replace(RECOVERY_REVIEW_BLOCKED_LIVE_VARIANT_CONTEXT_PATTERN, " ")
|
|
1195
|
+
.replace(RECOVERY_REVIEW_ANAPHORIC_REFERENCES_CONTEXT_PATTERN, " ");
|
|
1196
|
+
const taskMutationText = task
|
|
1197
|
+
.replace(RECOVERY_REVIEW_DELIVERABLE_PATTERN, " ")
|
|
1198
|
+
.replace(RECOVERY_REVIEW_CONTEXT_OBJECT_PATTERN, " ")
|
|
1199
|
+
.replace(RECOVERY_REVIEW_MUTATION_NOUN_CONTEXT_PATTERN, " ")
|
|
1200
|
+
.replace(RECOVERY_REVIEW_PRIOR_FIX_CONTEXT_PATTERN, " ")
|
|
1201
|
+
.replace(RECOVERY_REVIEW_DETECTION_CONTEXT_PATTERN, " ")
|
|
1202
|
+
.replace(RECOVERY_REVIEW_PATTERN_CHANGE_CONTEXT_PATTERN, " ")
|
|
1203
|
+
.replace(RECOVERY_REVIEW_GIT_PATTERN_CHANGE_CONTEXT_PATTERN, " ")
|
|
1204
|
+
.replace(RECOVERY_REVIEW_VALIDATION_EVIDENCE_PATTERN, " ")
|
|
1205
|
+
.replace(RECOVERY_REVIEW_CONTRACT_PROHIBITION_PATTERN, " ")
|
|
1206
|
+
.replace(RECOVERY_REVIEW_ONLY_REVIEW_CONTRACT_PATTERN, " ")
|
|
1207
|
+
.replace(RECOVERY_REVIEW_BLOCKED_CONTEXT_FRAGMENT_PATTERN, " ")
|
|
1208
|
+
.replace(RECOVERY_REVIEW_REGRESSION_EVIDENCE_PATTERN, " ")
|
|
1209
|
+
.replace(RECOVERY_REVIEW_BLOCKED_QUOTED_EXAMPLE_PATTERN, " ")
|
|
1210
|
+
.replace(RECOVERY_REVIEW_CONTEXT_QUOTED_EXAMPLE_PATTERN, " ")
|
|
1211
|
+
.replace(RECOVERY_REVIEW_LISTED_BLOCKED_EXAMPLE_PATTERN, " ")
|
|
1212
|
+
.replace(RECOVERY_REVIEW_BLOCKS_QUOTED_EXAMPLE_PATTERN, " ")
|
|
1213
|
+
.replace(RECOVERY_REVIEW_EXAMPLES_LIKE_BLOCKED_PATTERN, " ")
|
|
1214
|
+
.replace(RECOVERY_REVIEW_QUOTED_VISIBLE_BLOCKED_PATTERN, " ")
|
|
1215
|
+
.replace(RECOVERY_REVIEW_PROMPTS_LIKE_BLOCKED_PATTERN, " ")
|
|
1216
|
+
.replace(RECOVERY_REVIEW_GIT_MUTATIONS_BROADER_CONTEXT_PATTERN, " ")
|
|
1217
|
+
.replace(RECOVERY_REVIEW_GIT_COVERAGE_CONTEXT_PATTERN, " ")
|
|
1218
|
+
.replace(RECOVERY_REVIEW_REGRESSION_QUOTED_EXAMPLE_PATTERN, " ")
|
|
1219
|
+
.replace(RECOVERY_REVIEW_REGRESSION_ANAPHORIC_EXAMPLE_PATTERN, " ")
|
|
1220
|
+
.replace(RECOVERY_REVIEW_REGRESSION_FOLLOWED_BY_ANAPHORIC_PATTERN, " ")
|
|
1221
|
+
.replace(RECOVERY_REVIEW_BLOCKED_LIVE_VARIANT_CONTEXT_PATTERN, " ")
|
|
1222
|
+
.replace(RECOVERY_REVIEW_ANAPHORIC_REFERENCES_CONTEXT_PATTERN, " ")
|
|
1223
|
+
.replace(RECOVERY_REVIEW_NO_ANAPHORIC_MUTATION_CLAUSE_PATTERN, " ")
|
|
1224
|
+
.replace(RECOVERY_REVIEW_NO_DELEGATION_CLAUSE_PATTERN, " ")
|
|
1225
|
+
.replace(RECOVERY_REVIEW_NO_MUTATION_CLAUSE_PATTERN, " ")
|
|
1226
|
+
.replace(new RegExp(RECOVERY_REVIEW_READ_ONLY_PATTERN.source, "gi"), " ");
|
|
1227
|
+
return params.acceptance === false
|
|
1228
|
+
&& agent !== ""
|
|
1229
|
+
&& /\b(?:advisor|oracle|review|reviewer)\b/i.test(agent)
|
|
1230
|
+
&& RECOVERY_REVIEW_READ_ONLY_PATTERN.test(task)
|
|
1231
|
+
&& !RECOVERY_REVIEW_DESTRUCTIVE_COMMAND_PATTERN.test(taskDestructiveCommandText)
|
|
1232
|
+
&& !RECOVERY_REVIEW_MUTATION_VERB_PATTERN.test(taskMutationText)
|
|
1233
|
+
&& !RECOVERY_REVIEW_DELEGATION_PATTERN.test(taskMutationText)
|
|
1234
|
+
&& !RECOVERY_REVIEW_ANAPHORIC_MUTATION_PATTERN.test(taskMutationText)
|
|
1235
|
+
&& !RECOVERY_REVIEW_DESTRUCTIVE_COMMAND_PATTERN.test(taskMutationText)
|
|
1236
|
+
&& !RECOVERY_REVIEW_DASH_LIVE_ACTION_PATTERN.test(taskDashLiveActionText)
|
|
1237
|
+
&& classifyTaskMutationIntent(agent, task).kind === "read-only";
|
|
1238
|
+
}
|
|
1239
|
+
|
|
1240
|
+
function recoveryBarrierMessage(sourceKey: string, target: string): string {
|
|
1241
|
+
return `Run '${target}' cannot launch after run '${sourceKey}' returned rejected acceptance recovery; only explicit read-only review children with acceptance:false may follow.`;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
function isPlainJsonObject(value: unknown): value is Record<string, unknown> {
|
|
1245
|
+
if (!isRecord(value)) return false;
|
|
1246
|
+
const prototype = Object.getPrototypeOf(value);
|
|
1247
|
+
return prototype === null || prototype === Object.prototype;
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
function parseWorkflowResumeReference(value: unknown): WorkflowReceiptResumeReference | undefined {
|
|
1251
|
+
if (!isRecord(value)) return undefined;
|
|
1252
|
+
const fields = Object.keys(value);
|
|
1253
|
+
if (fields.some((field) => field !== "workflowRunId" && field !== "key" && field !== "latest")) throw new Error("keyed resume contains unsupported fields.");
|
|
1254
|
+
if (typeof value.workflowRunId !== "string" || !value.workflowRunId.trim()) throw new Error("keyed resume workflowRunId must be non-empty.");
|
|
1255
|
+
const key = validateKey(value.key, "keyed resume");
|
|
1256
|
+
if (value.latest !== true) throw new Error("keyed resume requires latest: true.");
|
|
1257
|
+
return { workflowRunId: value.workflowRunId.trim(), key, latest: true };
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
function omitUndefinedWorkflowValues(value: unknown, seen = new Set<object>()): unknown {
|
|
1261
|
+
if (value === null || typeof value !== "object") return value;
|
|
1262
|
+
if (seen.has(value)) return value;
|
|
1263
|
+
seen.add(value);
|
|
1264
|
+
const normalized = Array.isArray(value)
|
|
1265
|
+
? value.map((entry) => entry === undefined ? null : omitUndefinedWorkflowValues(entry, seen))
|
|
1266
|
+
: isPlainJsonObject(value)
|
|
1267
|
+
? Object.fromEntries(Object.entries(value).flatMap(([key, entry]) => entry === undefined ? [] : [[key, omitUndefinedWorkflowValues(entry, seen)]]))
|
|
1268
|
+
: value;
|
|
1269
|
+
seen.delete(value);
|
|
1270
|
+
return normalized;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
function omitNonJsonWorkflowResultMetadata(value: unknown): unknown {
|
|
1274
|
+
const normalized = omitUndefinedWorkflowValues(value);
|
|
1275
|
+
if (!isPlainJsonObject(normalized) || !Object.hasOwn(normalized, "results")) return normalized;
|
|
1276
|
+
try {
|
|
1277
|
+
assertWorkflowJsonValue(normalized.results, "runs.run result.results");
|
|
1278
|
+
return normalized;
|
|
1279
|
+
} catch {
|
|
1280
|
+
const { results: _results, ...safeResult } = normalized;
|
|
1281
|
+
return safeResult;
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
export function assertWorkflowJsonValue(value: unknown, path = "value", seen = new Set<object>()): void {
|
|
1286
|
+
if (value === null || typeof value === "string" || typeof value === "boolean") return;
|
|
1287
|
+
if (typeof value === "number") {
|
|
1288
|
+
if (!Number.isFinite(value)) throw new Error(`${path} must contain only finite JSON numbers.`);
|
|
1289
|
+
return;
|
|
1290
|
+
}
|
|
1291
|
+
if (typeof value !== "object") throw new Error(`${path} must be a JSON value; received ${typeof value}.`);
|
|
1292
|
+
if (seen.has(value)) throw new Error(`${path} must not contain cycles.`);
|
|
1293
|
+
seen.add(value);
|
|
1294
|
+
if (Array.isArray(value)) {
|
|
1295
|
+
for (let index = 0; index < value.length; index++) {
|
|
1296
|
+
if (!Object.hasOwn(value, index)) throw new Error(`${path} must not contain sparse array entries.`);
|
|
1297
|
+
assertWorkflowJsonValue(value[index], `${path}[${index}]`, seen);
|
|
1298
|
+
}
|
|
1299
|
+
} else {
|
|
1300
|
+
const prototype = Object.getPrototypeOf(value);
|
|
1301
|
+
if (prototype !== null && prototype !== Object.prototype) throw new Error(`${path} must contain only plain JSON objects.`);
|
|
1302
|
+
if (Object.getOwnPropertySymbols(value).length > 0) throw new Error(`${path} must not contain symbol keys.`);
|
|
1303
|
+
for (const [key, entry] of Object.entries(value)) assertWorkflowJsonValue(entry, `${path}.${key}`, seen);
|
|
1304
|
+
}
|
|
1305
|
+
seen.delete(value);
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
export function formatWorkflowJsonPreview(value: unknown, maxLength: number): string | undefined {
|
|
1309
|
+
try {
|
|
1310
|
+
assertWorkflowJsonValue(value);
|
|
1311
|
+
const serialized = JSON.stringify(value);
|
|
1312
|
+
return typeof serialized === "string" ? serialized.slice(0, maxLength) : undefined;
|
|
1313
|
+
} catch {
|
|
1314
|
+
return undefined;
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
function workflowReturnRecoveryHint(children: WorkflowScriptChildResult[]): string {
|
|
1319
|
+
if (children.length === 0) return " Return only plain JSON data. For a child result, select fields such as { runId: child.runId, ok: child.ok, outputReference: child.outputReference }.";
|
|
1320
|
+
const references = children.slice(0, 10).map((child) => {
|
|
1321
|
+
const fields = [child.runId ? `runId=${child.runId.slice(0, 500)}` : undefined, child.outputReference ? `outputReference=${child.outputReference.slice(0, 500)}` : undefined, child.artifactPaths[0] ? `artifact=${child.artifactPaths[0].slice(0, 500)}` : undefined].filter((field): field is string => field !== undefined);
|
|
1322
|
+
return `'${child.key}'${fields.length > 0 ? ` (${fields.join(", ")})` : ""}`;
|
|
1323
|
+
});
|
|
1324
|
+
return ` Child work completed before return serialization failed. Recover outputs from: ${references.join(", ")}${children.length > references.length ? `, and ${children.length - references.length} more` : ""}. Return a plain projection such as { runId: child.runId, ok: child.ok, outputReference: child.outputReference }.`;
|
|
1325
|
+
}
|
|
1326
|
+
|
|
1327
|
+
export interface SimpleWorkflowRunPreview {
|
|
1328
|
+
agent?: string;
|
|
1329
|
+
task?: string;
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
/** Display-only preview for the exact simple `return runs.run(key, {...})` form. */
|
|
1333
|
+
export function previewSimpleWorkflowRun(script: string | undefined): SimpleWorkflowRunPreview | undefined {
|
|
1334
|
+
const body = script?.match(/^\s*return\s+(?:await\s+)?runs\.run\s*\(\s*(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|`[^`$\\]*`)\s*,\s*\{([\s\S]*)\}\s*\)\s*;?\s*$/)?.[1];
|
|
1335
|
+
if (body === undefined) return undefined;
|
|
1336
|
+
const readProperty = (name: "agent" | "task"): string | undefined => {
|
|
1337
|
+
const match = body.match(new RegExp(`(?:^|,)\\s*(?:${name}|["']${name}["'])\\s*:\\s*("(?:\\\\.|[^"\\\\])*"|'(?:\\\\.|[^'\\\\])*'|\u0060[^\u0060$\\\\]*\u0060)`));
|
|
1338
|
+
if (!match?.[1]) return undefined;
|
|
1339
|
+
const literal = match[1];
|
|
1340
|
+
if (literal.startsWith('"')) {
|
|
1341
|
+
try { return JSON.parse(literal) as string; } catch { return undefined; }
|
|
1342
|
+
}
|
|
1343
|
+
if (literal.slice(1, -1).includes("\\")) return undefined;
|
|
1344
|
+
return literal.slice(1, -1);
|
|
1345
|
+
};
|
|
1346
|
+
const agent = readProperty("agent");
|
|
1347
|
+
const task = readProperty("task");
|
|
1348
|
+
return { ...(agent !== undefined ? { agent } : {}), ...(task !== undefined ? { task } : {}) };
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
function stableJson(value: unknown): string {
|
|
1352
|
+
if (Array.isArray(value)) return `[${value.map(stableJson).join(",")}]`;
|
|
1353
|
+
if (isRecord(value)) return `{${Object.keys(value).sort().map((key) => `${JSON.stringify(key)}:${stableJson(value[key])}`).join(",")}}`;
|
|
1354
|
+
return JSON.stringify(value) ?? "undefined";
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
function validateKey(value: unknown, owner = "runs.run"): string {
|
|
1358
|
+
if (typeof value !== "string" || !KEY_PATTERN.test(value)) {
|
|
1359
|
+
throw new Error(`${owner} key must be 1-128 characters using letters, numbers, '.', '_' or '-', and start with a letter or number.`);
|
|
1360
|
+
}
|
|
1361
|
+
return value;
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
type AstNode = {
|
|
1365
|
+
type: string;
|
|
1366
|
+
loc?: { start: { line: number; column: number } };
|
|
1367
|
+
[key: string]: unknown;
|
|
1368
|
+
};
|
|
1369
|
+
|
|
1370
|
+
const AST_LOCATION_KEYS = new Set(["type", "start", "end", "loc", "range"]);
|
|
1371
|
+
|
|
1372
|
+
function astNode(value: unknown): value is AstNode {
|
|
1373
|
+
return Boolean(value) && typeof value === "object" && typeof (value as { type?: unknown }).type === "string";
|
|
1374
|
+
}
|
|
1375
|
+
|
|
1376
|
+
function literalString(node: unknown): string | undefined {
|
|
1377
|
+
if (!astNode(node)) return undefined;
|
|
1378
|
+
if (node.type === "Literal" && typeof node.value === "string") return node.value;
|
|
1379
|
+
if (node.type === "TemplateLiteral" && Array.isArray(node.expressions) && node.expressions.length === 0 && Array.isArray(node.quasis)) {
|
|
1380
|
+
const first = node.quasis[0] as { value?: { cooked?: unknown } } | undefined;
|
|
1381
|
+
if (typeof first?.value?.cooked === "string") return first.value.cooked;
|
|
1382
|
+
}
|
|
1383
|
+
return undefined;
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
function directRunsCall(node: unknown, method: "run" | "all" | "host"): node is AstNode {
|
|
1387
|
+
if (!astNode(node) || node.type !== "CallExpression" || !astNode(node.callee) || node.callee.type !== "MemberExpression") return false;
|
|
1388
|
+
const property = node.callee.computed === true ? literalString(node.callee.property) : astNode(node.callee.property) && node.callee.property.type === "Identifier" ? node.callee.property.name : undefined;
|
|
1389
|
+
return property === method && astNode(node.callee.object) && node.callee.object.type === "Identifier" && node.callee.object.name === "runs";
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
function validateStaticHostCall(call: AstNode): WorkflowScriptValidationError[] {
|
|
1393
|
+
const args = Array.isArray(call.arguments) ? call.arguments : [];
|
|
1394
|
+
const keyNode = astNode(args[0]) ? args[0] : undefined;
|
|
1395
|
+
const params = astNode(args[1]) ? args[1] : undefined;
|
|
1396
|
+
const errors: WorkflowScriptValidationError[] = [];
|
|
1397
|
+
const key = literalString(keyNode);
|
|
1398
|
+
if (keyNode && key !== undefined && !KEY_PATTERN.test(key)) errors.push({ message: "runs.host key must be 1-128 characters using letters, numbers, '.', '_' or '-', and start with a letter or number.", ...nodeLocation(keyNode) });
|
|
1399
|
+
if (!params || params.type !== "ObjectExpression" || !Array.isArray(params.properties) || params.properties.some((property) => !astNode(property) || property.type !== "Property")) return errors;
|
|
1400
|
+
const allowed = new Set(["kind", "command", "timeoutMs", "output", "role", "provider"]);
|
|
1401
|
+
for (const property of params.properties) {
|
|
1402
|
+
if (!astNode(property)) continue;
|
|
1403
|
+
const name = staticPropertyKey(property);
|
|
1404
|
+
if (name !== undefined && !allowed.has(name)) errors.push({ message: name === "cwd" ? "runs.host params contain unsupported field 'cwd'. The host step does not accept per-step cwd; commands and relative output paths use the workflow cwd. Set cwd on the outer subagent request, or put a trusted directory change in command (for example, 'cd /path/to/worktree && npm test')." : `runs.host params contain unsupported field '${name}'.`, ...nodeLocation(property) });
|
|
1405
|
+
}
|
|
1406
|
+
const kindNode = directObjectPropertyValue(params, "kind");
|
|
1407
|
+
const commandNode = directObjectPropertyValue(params, "command");
|
|
1408
|
+
const timeoutNode = directObjectPropertyValue(params, "timeoutMs");
|
|
1409
|
+
const kind = literalString(kindNode);
|
|
1410
|
+
const command = literalString(commandNode);
|
|
1411
|
+
const timeout = astNode(timeoutNode) && timeoutNode.type === "Literal" ? timeoutNode.value : undefined;
|
|
1412
|
+
if (!kindNode) errors.push({ message: "runs.host params require kind: 'command'.", ...nodeLocation(params) });
|
|
1413
|
+
else if (kind !== undefined && kind !== "command") errors.push({ message: "runs.host params kind must be 'command'.", ...nodeLocation(kindNode) });
|
|
1414
|
+
if (!commandNode) errors.push({ message: "runs.host params require command.", ...nodeLocation(params) });
|
|
1415
|
+
else if (command !== undefined && !command.trim()) errors.push({ message: "runs.host params command must be non-empty.", ...nodeLocation(commandNode) });
|
|
1416
|
+
if (!timeoutNode) errors.push({ message: "runs.host params require timeoutMs.", ...nodeLocation(params) });
|
|
1417
|
+
else if (typeof timeout === "number" && (!Number.isInteger(timeout) || timeout < 1)) errors.push({ message: "runs.host params timeoutMs must be a positive integer.", ...nodeLocation(timeoutNode) });
|
|
1418
|
+
const outputNode = directObjectPropertyValue(params, "output");
|
|
1419
|
+
const output = literalString(outputNode);
|
|
1420
|
+
if (outputNode && output !== undefined && (!output.trim() || /^[/\\]|(?:^|[/\\])\.\.(?:[/\\]|$)/.test(output))) errors.push({ message: "runs.host params output must be a non-empty relative path without traversal.", ...nodeLocation(outputNode) });
|
|
1421
|
+
const roleNode = directObjectPropertyValue(params, "role");
|
|
1422
|
+
const role = literalString(roleNode);
|
|
1423
|
+
if (roleNode && role !== undefined && role !== "ci" && role !== "gate") errors.push({ message: "runs.host params role must be 'ci' or 'gate'.", ...nodeLocation(roleNode) });
|
|
1424
|
+
return errors;
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
function nodeLocation(node: AstNode): Pick<WorkflowScriptValidationError, "line" | "column"> {
|
|
1428
|
+
return node.loc ? { line: Math.max(1, node.loc.start.line - 1), column: node.loc.start.column + 1 } : {};
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
function walkAst(node: unknown, visit: (node: AstNode) => void, includeNestedFunctions = true): void {
|
|
1432
|
+
if (Array.isArray(node)) {
|
|
1433
|
+
for (const item of node) walkAst(item, visit, includeNestedFunctions);
|
|
1434
|
+
return;
|
|
1435
|
+
}
|
|
1436
|
+
if (!astNode(node)) return;
|
|
1437
|
+
visit(node);
|
|
1438
|
+
if (!includeNestedFunctions && (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression")) return;
|
|
1439
|
+
for (const [key, child] of Object.entries(node)) {
|
|
1440
|
+
if (!AST_LOCATION_KEYS.has(key)) walkAst(child, visit, includeNestedFunctions);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
function definitelyNonJson(node: AstNode, normalizeUndefined = false): string | undefined {
|
|
1445
|
+
if (node.type === "Literal") {
|
|
1446
|
+
if (typeof node.bigint === "string") return "BigInt values are not JSON-representable";
|
|
1447
|
+
if (node.regex !== undefined) return "regular expressions are not JSON-representable";
|
|
1448
|
+
return undefined;
|
|
1449
|
+
}
|
|
1450
|
+
if (node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") return "functions are not JSON-representable";
|
|
1451
|
+
if (node.type === "Identifier" && node.name === "undefined") return normalizeUndefined ? undefined : "undefined is not JSON-representable";
|
|
1452
|
+
if (node.type === "UnaryExpression" && node.operator === "void") return normalizeUndefined ? undefined : "undefined is not JSON-representable";
|
|
1453
|
+
if (node.type === "ArrayExpression" && Array.isArray(node.elements)) {
|
|
1454
|
+
if (node.elements.some((entry) => entry === null)) return "sparse arrays are not JSON-representable";
|
|
1455
|
+
for (const entry of node.elements) if (astNode(entry)) {
|
|
1456
|
+
const error = definitelyNonJson(entry, normalizeUndefined);
|
|
1457
|
+
if (error) return error;
|
|
1458
|
+
}
|
|
1459
|
+
}
|
|
1460
|
+
if (node.type === "ObjectExpression" && Array.isArray(node.properties)) {
|
|
1461
|
+
const values = new Map<string, AstNode>();
|
|
1462
|
+
for (const property of node.properties) {
|
|
1463
|
+
if (!astNode(property) || property.type !== "Property" || !astNode(property.value)) return undefined;
|
|
1464
|
+
const key = staticPropertyKey(property);
|
|
1465
|
+
if (key === undefined) return undefined;
|
|
1466
|
+
values.set(key, property.value);
|
|
1467
|
+
}
|
|
1468
|
+
for (const value of values.values()) {
|
|
1469
|
+
const error = definitelyNonJson(value, normalizeUndefined);
|
|
1470
|
+
if (error) return error;
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
return undefined;
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
function staticPropertyKey(property: AstNode): string | undefined {
|
|
1477
|
+
return property.computed === true
|
|
1478
|
+
? literalString(property.key)
|
|
1479
|
+
: literalString(property.key) ?? (astNode(property.key) && property.key.type === "Identifier" ? property.key.name as string : undefined);
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
function directObjectPropertyValue(node: AstNode, name: string): AstNode | undefined {
|
|
1483
|
+
if (node.type !== "ObjectExpression" || !Array.isArray(node.properties)) return undefined;
|
|
1484
|
+
let value: AstNode | undefined;
|
|
1485
|
+
for (const property of node.properties) {
|
|
1486
|
+
if (!astNode(property) || property.type !== "Property" || !astNode(property.value)) continue;
|
|
1487
|
+
if (staticPropertyKey(property) === name) value = property.value;
|
|
1488
|
+
}
|
|
1489
|
+
return value;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
function directRunsAllKeys(call: AstNode): Array<{ key: string; node: AstNode }> {
|
|
1493
|
+
const args = Array.isArray(call.arguments) ? call.arguments : [];
|
|
1494
|
+
const items = astNode(args[0]) && args[0].type === "ArrayExpression" && Array.isArray(args[0].elements) ? args[0].elements : [];
|
|
1495
|
+
return items.flatMap((item) => {
|
|
1496
|
+
if (!astNode(item)) return [];
|
|
1497
|
+
const keyNode = directObjectPropertyValue(item, "key");
|
|
1498
|
+
const key = literalString(keyNode);
|
|
1499
|
+
return keyNode && key !== undefined ? [{ key, node: keyNode }] : [];
|
|
1500
|
+
});
|
|
1501
|
+
}
|
|
1502
|
+
|
|
1503
|
+
/** Parse a workflowScript and apply only rules that are decidable from its local syntax. */
|
|
1504
|
+
export function validateWorkflowScript(script: string): WorkflowScriptValidationResult {
|
|
1505
|
+
const errors: WorkflowScriptValidationError[] = [];
|
|
1506
|
+
if (!script.trim()) return { ok: false, errors: [{ message: "workflowScript must not be empty." }] };
|
|
1507
|
+
let root: AstNode;
|
|
1508
|
+
try {
|
|
1509
|
+
const parser = requireFromPackage(resolveWorkflowParserEntry()) as { parse(source: string, options: Record<string, unknown>): unknown };
|
|
1510
|
+
root = parser.parse(`(async () => {\n${script}\n})()`, { ecmaVersion: "latest", sourceType: "script", locations: true }) as AstNode;
|
|
1511
|
+
} catch (error) {
|
|
1512
|
+
const location = error && typeof error === "object" && "loc" in error && error.loc && typeof error.loc === "object"
|
|
1513
|
+
? error.loc as { line?: unknown; column?: unknown }
|
|
1514
|
+
: undefined;
|
|
1515
|
+
const message = (error instanceof Error ? error.message : String(error)).replace(/\s+\(\d+:\d+\)$/, "");
|
|
1516
|
+
return { ok: false, errors: [{ message, ...(typeof location?.line === "number" ? { line: Math.max(1, location.line - 1) } : {}), ...(typeof location?.column === "number" ? { column: location.column + 1 } : {}) }] };
|
|
1517
|
+
}
|
|
1518
|
+
|
|
1519
|
+
const wrapper = astNode(root.body) ? undefined : Array.isArray(root.body) && astNode(root.body[0]) && astNode(root.body[0].expression) && astNode(root.body[0].expression.callee)
|
|
1520
|
+
? root.body[0].expression.callee
|
|
1521
|
+
: undefined;
|
|
1522
|
+
const workflowBody = wrapper && astNode(wrapper.body) ? wrapper.body : root;
|
|
1523
|
+
walkAst(workflowBody, (node) => {
|
|
1524
|
+
if (node !== wrapper && node.async === true && (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression")) {
|
|
1525
|
+
errors.push({ message: "workflowScript does not support nested async functions. Use top-level await, plain helper functions that return runs.run(...), or explicit Promise chains.", ...nodeLocation(node) });
|
|
1526
|
+
}
|
|
1527
|
+
if (directRunsCall(node, "run")) {
|
|
1528
|
+
const args = Array.isArray(node.arguments) ? node.arguments : [];
|
|
1529
|
+
const keyNode = astNode(args[0]) ? args[0] : undefined;
|
|
1530
|
+
const key = literalString(keyNode);
|
|
1531
|
+
if (keyNode && key !== undefined && !KEY_PATTERN.test(key)) errors.push({ message: "runs.run key must be 1-128 characters using letters, numbers, '.', '_' or '-', and start with a letter or number.", ...nodeLocation(keyNode) });
|
|
1532
|
+
if (astNode(args[1])) {
|
|
1533
|
+
const message = definitelyNonJson(args[1]);
|
|
1534
|
+
if (message) errors.push({ message: `runs.run params are invalid: ${message}.`, ...nodeLocation(args[1]) });
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
if (directRunsCall(node, "all")) {
|
|
1538
|
+
for (const entry of directRunsAllKeys(node)) if (!KEY_PATTERN.test(entry.key)) errors.push({ message: "runs.all item key must be 1-128 characters using letters, numbers, '.', '_' or '-', and start with a letter or number.", ...nodeLocation(entry.node) });
|
|
1539
|
+
const args = Array.isArray(node.arguments) ? node.arguments : [];
|
|
1540
|
+
if (astNode(args[0]) && args[0].type === "ArrayExpression" && Array.isArray(args[0].elements)) {
|
|
1541
|
+
for (const item of args[0].elements) if (astNode(item)) {
|
|
1542
|
+
const message = definitelyNonJson(item);
|
|
1543
|
+
if (message) errors.push({ message: `runs.all item params are invalid: ${message}.`, ...nodeLocation(item) });
|
|
1544
|
+
}
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
if (directRunsCall(node, "host")) errors.push(...validateStaticHostCall(node));
|
|
1548
|
+
const boundaryValue = node.type === "CallExpression" && astNode(node.callee) && node.callee.type === "Identifier" && node.callee.name === "emit" && Array.isArray(node.arguments) && astNode(node.arguments[0])
|
|
1549
|
+
? node.arguments[0]
|
|
1550
|
+
: node.type === "CallExpression" && astNode(node.callee) && node.callee.type === "MemberExpression" && astNode(node.callee.object) && node.callee.object.type === "Identifier" && node.callee.object.name === "state" && astNode(node.callee.property) && node.callee.property.type === "Identifier" && node.callee.property.name === "set" && Array.isArray(node.arguments) && astNode(node.arguments[1])
|
|
1551
|
+
? node.arguments[1]
|
|
1552
|
+
: undefined;
|
|
1553
|
+
if (boundaryValue) {
|
|
1554
|
+
const message = definitelyNonJson(boundaryValue);
|
|
1555
|
+
if (message) errors.push({ message: `workflowScript boundary value is invalid: ${message}.`, ...nodeLocation(boundaryValue) });
|
|
1556
|
+
}
|
|
1557
|
+
});
|
|
1558
|
+
walkAst(workflowBody, (node) => {
|
|
1559
|
+
if (node.type !== "ReturnStatement" || !astNode(node.argument)) return;
|
|
1560
|
+
const message = definitelyNonJson(node.argument, true);
|
|
1561
|
+
if (message) errors.push({ message: `workflowScript boundary value is invalid: ${message}.`, ...nodeLocation(node.argument) });
|
|
1562
|
+
}, false);
|
|
1563
|
+
|
|
1564
|
+
if (workflowBody.type === "BlockStatement" && Array.isArray(workflowBody.body)) {
|
|
1565
|
+
for (let statementIndex = 0; statementIndex < workflowBody.body.length; statementIndex++) {
|
|
1566
|
+
const statement = workflowBody.body[statementIndex];
|
|
1567
|
+
if (!astNode(statement) || statement.type !== "VariableDeclaration" || !Array.isArray(statement.declarations)) continue;
|
|
1568
|
+
for (const declaration of statement.declarations) {
|
|
1569
|
+
if (!astNode(declaration) || !astNode(declaration.id) || declaration.id.type !== "Identifier" || !astNode(declaration.init) || declaration.init.type !== "AwaitExpression" || !directRunsCall(declaration.init.argument, "all")) continue;
|
|
1570
|
+
const name = declaration.id.name as string;
|
|
1571
|
+
const keys = new Set(directRunsAllKeys(declaration.init.argument).map((entry) => entry.key));
|
|
1572
|
+
if (keys.size === 0) continue;
|
|
1573
|
+
const args = Array.isArray(declaration.init.argument.arguments) ? declaration.init.argument.arguments : [];
|
|
1574
|
+
const itemCount = astNode(args[0]) && args[0].type === "ArrayExpression" && Array.isArray(args[0].elements) ? args[0].elements.length : 0;
|
|
1575
|
+
const arrayResultShape = Array.from({ length: itemCount });
|
|
1576
|
+
for (const later of workflowBody.body.slice(statementIndex + 1)) walkAst(later, (node) => {
|
|
1577
|
+
if (node.type !== "MemberExpression" || !astNode(node.object) || node.object.type !== "Identifier" || node.object.name !== name) return;
|
|
1578
|
+
const property = node.computed === true ? literalString(node.property) : astNode(node.property) && node.property.type === "Identifier" ? node.property.name as string : undefined;
|
|
1579
|
+
if (property && keys.has(property) && !(property in arrayResultShape)) errors.push({ message: `runs.all returns an ordered array; '${name}.${property}' is keyed access. Use an index, destructuring, or map(...).`, ...nodeLocation(node) });
|
|
1580
|
+
}, false);
|
|
1581
|
+
}
|
|
1582
|
+
}
|
|
1583
|
+
}
|
|
1584
|
+
|
|
1585
|
+
const unique = errors.filter((error, index) => errors.findIndex((candidate) => candidate.message === error.message && candidate.line === error.line && candidate.column === error.column) === index);
|
|
1586
|
+
return { ok: unique.length === 0, errors: unique };
|
|
1587
|
+
}
|
|
1588
|
+
function workflowStringMetadata(params: Record<string, unknown>): Pick<WorkflowScriptTraceEntry, "phase" | "label" | "agent"> {
|
|
1589
|
+
return {
|
|
1590
|
+
...(typeof params.phase === "string" && params.phase.trim() ? { phase: params.phase.trim() } : {}),
|
|
1591
|
+
...(typeof params.label === "string" && params.label.trim() ? { label: params.label.trim() } : {}),
|
|
1592
|
+
// Requested agent name, so a child is identifiable while it runs. Launch
|
|
1593
|
+
// resolution overwrites this with the canonical name on the terminal entry.
|
|
1594
|
+
...(typeof params.agent === "string" && params.agent.trim() ? { agent: params.agent.trim() } : {}),
|
|
1595
|
+
};
|
|
1596
|
+
}
|
|
1597
|
+
|
|
1598
|
+
function resolveWorkflowParserEntry(): string {
|
|
1599
|
+
try {
|
|
1600
|
+
return requireFromPackage.resolve("acorn");
|
|
1601
|
+
} catch (primaryError) {
|
|
1602
|
+
// Some runtimes (e.g. Bun-compiled single-file binaries) fail bare
|
|
1603
|
+
// package-specifier resolution through createRequire while subpath
|
|
1604
|
+
// resolution still works. Resolve the manifest and derive the
|
|
1605
|
+
// CommonJS entry from its "main" field instead.
|
|
1606
|
+
try {
|
|
1607
|
+
const manifestPath = requireFromPackage.resolve("acorn/package.json");
|
|
1608
|
+
const manifest = JSON.parse(readFileSync(manifestPath, "utf8")) as { main?: unknown };
|
|
1609
|
+
const entry = typeof manifest.main === "string" && manifest.main ? manifest.main : "./dist/acorn.js";
|
|
1610
|
+
return resolvePath(dirname(manifestPath), entry);
|
|
1611
|
+
} catch {
|
|
1612
|
+
throw primaryError;
|
|
1613
|
+
}
|
|
1614
|
+
}
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
const AUTO_RESUME_PARAM_KEYS = ["acceptance", "agentContract", "index", "intercomBridge", "label", "lane", "maxRuntimeMs", "output", "outputMode", "outputSchema", "phase", "skill", "skills", "task", "timeoutMs", "toolBudget", "worktree"] as const;
|
|
1618
|
+
|
|
1619
|
+
function isZeroUsage(usage: unknown): boolean {
|
|
1620
|
+
if (!isRecord(usage)) return false;
|
|
1621
|
+
const cost = usage.cost;
|
|
1622
|
+
return (usage.input ?? 0) === 0
|
|
1623
|
+
&& (usage.output ?? 0) === 0
|
|
1624
|
+
&& (usage.cacheRead ?? 0) === 0
|
|
1625
|
+
&& (usage.cacheWrite ?? 0) === 0
|
|
1626
|
+
&& (!isRecord(cost) || (cost.total ?? 0) === 0);
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
function setupAbortResumeParams(params: Record<string, unknown>, result: WorkflowScriptChildResult, signal: AbortSignal): Record<string, unknown> | undefined {
|
|
1630
|
+
if (signal.aborted || result.ok || result.stopped || result.interrupted || !result.runId) return undefined;
|
|
1631
|
+
const childResult = Array.isArray(result.results) && result.results.length === 1 && isRecord(result.results[0]) ? result.results[0] : undefined;
|
|
1632
|
+
const error = typeof childResult?.error === "string" ? childResult.error : result.error;
|
|
1633
|
+
if (error !== "This operation was aborted" || !isZeroUsage(childResult?.usage)) return undefined;
|
|
1634
|
+
const messages = Array.isArray(childResult?.messages) ? childResult.messages : [];
|
|
1635
|
+
const message = messages.findLast((entry) => isRecord(entry) && entry.role === "assistant");
|
|
1636
|
+
if (message !== undefined) {
|
|
1637
|
+
if (!isRecord(message)) return undefined;
|
|
1638
|
+
if (message.stopReason !== "error" || message.errorMessage !== error) return undefined;
|
|
1639
|
+
if (!Array.isArray(message.content) || message.content.length > 0 || !isZeroUsage(message.usage)) return undefined;
|
|
1640
|
+
if (Object.hasOwn(message, "diagnostics") || Object.hasOwn(message, "responseId")) return undefined;
|
|
1641
|
+
}
|
|
1642
|
+
const task = typeof params.task === "string" && params.task.trim() ? params.task.trim() : "Continue after the setup abort.";
|
|
1643
|
+
const resumeParams: Record<string, unknown> = { resume: result.runId, task };
|
|
1644
|
+
for (const key of AUTO_RESUME_PARAM_KEYS) {
|
|
1645
|
+
if (Object.hasOwn(params, key)) resumeParams[key] = params[key];
|
|
1646
|
+
}
|
|
1647
|
+
resumeParams.resume = result.runId;
|
|
1648
|
+
resumeParams.task = task;
|
|
1649
|
+
return resumeParams;
|
|
1650
|
+
}
|
|
1651
|
+
|
|
1652
|
+
export async function runWorkflowScript(options: RunWorkflowScriptOptions): Promise<WorkflowScriptResult> {
|
|
1653
|
+
if (!options.script.trim()) throw new Error("workflowScript must not be empty.");
|
|
1654
|
+
if (options.timeoutMs !== undefined && (!Number.isInteger(options.timeoutMs) || options.timeoutMs < 1)) throw new Error("workflow script timeout must be a positive integer.");
|
|
1655
|
+
if (options.globalConcurrencyLimit !== undefined && (!Number.isSafeInteger(options.globalConcurrencyLimit) || options.globalConcurrencyLimit < 1)) {
|
|
1656
|
+
throw new Error("workflow script global concurrency limit must be a positive integer.");
|
|
1657
|
+
}
|
|
1658
|
+
const launchSemaphore = new Semaphore(options.globalConcurrencyLimit ?? DEFAULT_GLOBAL_CONCURRENCY_LIMIT);
|
|
1659
|
+
|
|
1660
|
+
let acornPath: string;
|
|
1661
|
+
try {
|
|
1662
|
+
acornPath = resolveWorkflowParserEntry();
|
|
1663
|
+
} catch (error) {
|
|
1664
|
+
throw new Error("Workflow parser dependency 'acorn' is unavailable from pi-subagents. Reinstall pi-subagents dependencies before launching workflowScript.", { cause: error });
|
|
1665
|
+
}
|
|
1666
|
+
const worker = new Worker(WORKER_SOURCE, { eval: true, workerData: { acornPath } });
|
|
1667
|
+
const emits: unknown[] = [];
|
|
1668
|
+
const consoleEntries: WorkflowScriptResult["console"] = [];
|
|
1669
|
+
const trace: WorkflowScriptTraceEntry[] = [];
|
|
1670
|
+
const children = new Map<string, WorkflowScriptChildResult>();
|
|
1671
|
+
const childOrder: string[] = [];
|
|
1672
|
+
const launches = new Map<string, { fingerprint: string; promise: Promise<WorkflowScriptChildResult>; observed: boolean; generatedLaneKey?: string }>();
|
|
1673
|
+
const steers = new Map<number, { key: string; promise: Promise<WorkflowSteerResult>; observed: boolean }>();
|
|
1674
|
+
const hostCalls = new Map<number, { key: string; promise: Promise<WorkflowHostCommandResult>; observed: boolean }>();
|
|
1675
|
+
const stoppedLaunches = new Set<string>();
|
|
1676
|
+
const childStopControllers = new Map<string, AbortController>();
|
|
1677
|
+
const batchAdmissions = new Map<string, Promise<void>>();
|
|
1678
|
+
const observedRunCalls = new Set<number>();
|
|
1679
|
+
const observedSteerCalls = new Set<number>();
|
|
1680
|
+
const observedHostCalls = new Set<number>();
|
|
1681
|
+
const childController = new AbortController();
|
|
1682
|
+
let acceptanceRecoveryBarrier: { key: string } | undefined;
|
|
1683
|
+
let settled = false;
|
|
1684
|
+
let finishing = false;
|
|
1685
|
+
|
|
1686
|
+
const partial = (): Omit<WorkflowScriptResult, "value"> => ({ emits, console: consoleEntries, trace, children: childOrder.flatMap((key) => {
|
|
1687
|
+
const child = children.get(key);
|
|
1688
|
+
return child ? [child] : [];
|
|
1689
|
+
}) });
|
|
1690
|
+
// Hosts use onTrace to persist a progress journal, and it is invoked from inside
|
|
1691
|
+
// the run-promise handlers below. A throw here would reject the child promise the
|
|
1692
|
+
// script is awaiting, so a single failed status write could mark a completed child
|
|
1693
|
+
// failed and abort its siblings through Promise.all. Telemetry must not decide
|
|
1694
|
+
// workflow outcomes, so a failing callback is reported and the run continues.
|
|
1695
|
+
const traceChanged = () => {
|
|
1696
|
+
try {
|
|
1697
|
+
options.onTrace?.([...trace]);
|
|
1698
|
+
} catch (error) {
|
|
1699
|
+
console.error("Workflow onTrace callback failed:", error);
|
|
1700
|
+
}
|
|
1701
|
+
};
|
|
1702
|
+
const lanePlanChanged = (lanes: WorkflowLanePlan[]) => {
|
|
1703
|
+
try {
|
|
1704
|
+
options.onLanePlan?.(lanes);
|
|
1705
|
+
} catch (error) {
|
|
1706
|
+
console.error("Workflow onLanePlan callback failed:", error);
|
|
1707
|
+
}
|
|
1708
|
+
};
|
|
1709
|
+
const hostStepChanged = (hostStep: HostStepNodeV1) => {
|
|
1710
|
+
try {
|
|
1711
|
+
options.onHostStep?.(hostStep);
|
|
1712
|
+
} catch (error) {
|
|
1713
|
+
console.error("Workflow onHostStep callback failed:", error);
|
|
1714
|
+
}
|
|
1715
|
+
};
|
|
1716
|
+
const stoppedChildResult = (key: string, message: string): WorkflowScriptChildResult => ({ key, ok: false, stopped: true, output: message, error: message, artifactPaths: [] });
|
|
1717
|
+
const responseBoundaryFailure = (key: string, error: unknown): WorkflowScriptChildResult => {
|
|
1718
|
+
const text = error instanceof Error ? error.message : String(error);
|
|
1719
|
+
return { key, ok: false, output: text, error: text, artifactPaths: [] };
|
|
1720
|
+
};
|
|
1721
|
+
const assertRecoveryBarrierAllowsRun = (key: string, params: Record<string, unknown>): void => {
|
|
1722
|
+
if (!acceptanceRecoveryBarrier || isExplicitReadOnlyRecoveryReview(params)) return;
|
|
1723
|
+
throw new Error(recoveryBarrierMessage(acceptanceRecoveryBarrier.key, key));
|
|
1724
|
+
};
|
|
1725
|
+
const recordAcceptanceRecoveryBarrier = (key: string, result: WorkflowScriptChildResult): void => {
|
|
1726
|
+
if (isAcceptanceMetadataRecovery(result)) acceptanceRecoveryBarrier = { key };
|
|
1727
|
+
};
|
|
1728
|
+
const stopChild = (key: string, message = `Workflow child '${key}' stopped by user.`): boolean => {
|
|
1729
|
+
if (!launches.has(key) || children.has(key)) return false;
|
|
1730
|
+
stoppedLaunches.add(key);
|
|
1731
|
+
children.set(key, stoppedChildResult(key, message));
|
|
1732
|
+
childStopControllers.get(key)?.abort(new Error(message));
|
|
1733
|
+
const started = trace.findLast((entry) => entry.operation === "run" && entry.key === key && entry.state === "started");
|
|
1734
|
+
trace.push({
|
|
1735
|
+
operation: "run",
|
|
1736
|
+
key,
|
|
1737
|
+
state: "stopped",
|
|
1738
|
+
...(started?.agent ? { agent: started.agent } : {}),
|
|
1739
|
+
...(started?.phase ? { phase: started.phase } : {}),
|
|
1740
|
+
...(started?.label ? { label: started.label } : {}),
|
|
1741
|
+
...(started?.generatedLaneKey ? { generatedLaneKey: started.generatedLaneKey } : {}),
|
|
1742
|
+
error: message,
|
|
1743
|
+
});
|
|
1744
|
+
traceChanged();
|
|
1745
|
+
return true;
|
|
1746
|
+
};
|
|
1747
|
+
options.registerStopChild?.(stopChild);
|
|
1748
|
+
|
|
1749
|
+
return await new Promise<WorkflowScriptResult>((resolve, reject) => {
|
|
1750
|
+
const finish = (outcome: { value: unknown } | { error: Error & { workflowErrorKind?: unknown } }) => {
|
|
1751
|
+
if (settled || finishing) return;
|
|
1752
|
+
finishing = true;
|
|
1753
|
+
childController.abort("error" in outcome ? outcome.error : new Error("Workflow script completed."));
|
|
1754
|
+
void Promise.allSettled([...steers.values(), ...hostCalls.values()].map(({ promise }) => promise)).then(() => {
|
|
1755
|
+
if (settled) return;
|
|
1756
|
+
settled = true;
|
|
1757
|
+
options.registerStopChild?.(undefined);
|
|
1758
|
+
if (timer) clearTimeout(timer);
|
|
1759
|
+
options.signal?.removeEventListener("abort", onAbort);
|
|
1760
|
+
void worker.terminate();
|
|
1761
|
+
const unobservedKeys = "value" in outcome ? [...launches].filter(([, launch]) => !launch.observed).map(([key]) => key) : [];
|
|
1762
|
+
const completionError = unobservedKeys.length > 0
|
|
1763
|
+
? new Error(`workflowScript completed with unawaited runs.run launch(es): ${unobservedKeys.map((key) => `'${key}'`).join(", ")}. For ordinary parallel fanout use await runs.all([{key, agent, task}, ...]); do not read .output from unawaited launches.`)
|
|
1764
|
+
: "value" in outcome
|
|
1765
|
+
? (() => {
|
|
1766
|
+
const unobservedSteers = [...steers.values()].filter((steer) => !steer.observed).map((steer) => steer.key);
|
|
1767
|
+
if (unobservedSteers.length > 0) return new Error(`workflowScript completed with unawaited runs.steer call(s): ${unobservedSteers.map((key) => `'${key}'`).join(", ")}. Await or return each call.`);
|
|
1768
|
+
const unobservedHosts = [...hostCalls.values()].filter((host) => !host.observed).map((host) => host.key);
|
|
1769
|
+
return unobservedHosts.length > 0 ? new Error(`workflowScript completed with unawaited runs.host call(s): ${unobservedHosts.map((key) => `'${key}'`).join(", ")}. Await or return each call.`) : undefined;
|
|
1770
|
+
})()
|
|
1771
|
+
: undefined;
|
|
1772
|
+
if ("error" in outcome) reject(new WorkflowScriptError(outcome.error.message, partial(), outcome.error.workflowErrorKind === "detached-child" || outcome.error.workflowErrorKind === "timeout" ? outcome.error.workflowErrorKind : undefined));
|
|
1773
|
+
else if (completionError) reject(new WorkflowScriptError(completionError.message, partial()));
|
|
1774
|
+
else resolve({ value: outcome.value, ...partial() });
|
|
1775
|
+
});
|
|
1776
|
+
};
|
|
1777
|
+
const onAbort = () => {
|
|
1778
|
+
const signalReason = options.signal?.reason;
|
|
1779
|
+
const error = signalReason instanceof Error
|
|
1780
|
+
? signalReason
|
|
1781
|
+
: typeof signalReason === "string"
|
|
1782
|
+
? new Error(signalReason)
|
|
1783
|
+
: new Error("Workflow script aborted.");
|
|
1784
|
+
for (const key of launches.keys()) {
|
|
1785
|
+
if (children.has(key)) continue;
|
|
1786
|
+
stoppedLaunches.add(key);
|
|
1787
|
+
const started = trace.findLast((entry) => entry.operation === "run" && entry.key === key && entry.state === "started");
|
|
1788
|
+
trace.push({
|
|
1789
|
+
operation: "run",
|
|
1790
|
+
key,
|
|
1791
|
+
state: "stopped",
|
|
1792
|
+
...(started?.agent ? { agent: started.agent } : {}),
|
|
1793
|
+
...(started?.phase ? { phase: started.phase } : {}),
|
|
1794
|
+
...(started?.label ? { label: started.label } : {}),
|
|
1795
|
+
...(started?.generatedLaneKey ? { generatedLaneKey: started.generatedLaneKey } : {}),
|
|
1796
|
+
error: error.message,
|
|
1797
|
+
});
|
|
1798
|
+
}
|
|
1799
|
+
traceChanged();
|
|
1800
|
+
finish({ error });
|
|
1801
|
+
};
|
|
1802
|
+
const timer = options.timeoutMs === undefined
|
|
1803
|
+
? undefined
|
|
1804
|
+
: setTimeout(() => {
|
|
1805
|
+
const error = new Error(`Workflow script timed out after ${options.timeoutMs}ms.`) as Error & { workflowErrorKind: "timeout" };
|
|
1806
|
+
error.workflowErrorKind = "timeout";
|
|
1807
|
+
finish({ error });
|
|
1808
|
+
}, options.timeoutMs);
|
|
1809
|
+
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
1810
|
+
if (options.signal?.aborted) return onAbort();
|
|
1811
|
+
|
|
1812
|
+
worker.on("error", (error) => finish({ error: new Error(`Workflow worker failed: ${error instanceof Error ? error.message : String(error)}`) }));
|
|
1813
|
+
worker.on("exit", (code) => {
|
|
1814
|
+
if (!settled && code !== 0) finish({ error: new Error(`Workflow worker exited with code ${code}.`) });
|
|
1815
|
+
});
|
|
1816
|
+
worker.on("message", (message: Record<string, unknown>) => {
|
|
1817
|
+
if (settled) return;
|
|
1818
|
+
if (message.type === "lanePlan" && Array.isArray(message.lanes)) {
|
|
1819
|
+
lanePlanChanged(message.lanes as WorkflowLanePlan[]);
|
|
1820
|
+
return;
|
|
1821
|
+
}
|
|
1822
|
+
if (message.type === "emit") {
|
|
1823
|
+
try {
|
|
1824
|
+
assertWorkflowJsonValue(message.value, "emit");
|
|
1825
|
+
} catch (error) {
|
|
1826
|
+
finish({ error: new Error(`Workflow emit could not be persisted: ${error instanceof Error ? error.message : String(error)}`) });
|
|
1827
|
+
return;
|
|
1828
|
+
}
|
|
1829
|
+
emits.push(message.value);
|
|
1830
|
+
try {
|
|
1831
|
+
options.onEmit?.([...emits]);
|
|
1832
|
+
} catch (error) {
|
|
1833
|
+
emits.pop();
|
|
1834
|
+
finish({ error: new Error(`Workflow emit could not be persisted: ${error instanceof Error ? error.message : String(error)}`) });
|
|
1835
|
+
}
|
|
1836
|
+
return;
|
|
1837
|
+
}
|
|
1838
|
+
if (message.type === "console") {
|
|
1839
|
+
const level = message.level;
|
|
1840
|
+
if ((level === "log" || level === "info" || level === "warn" || level === "error") && typeof message.text === "string") consoleEntries.push({ level, text: message.text });
|
|
1841
|
+
return;
|
|
1842
|
+
}
|
|
1843
|
+
if (message.type === "complete") {
|
|
1844
|
+
try {
|
|
1845
|
+
assertWorkflowJsonValue(message.value, "return");
|
|
1846
|
+
} catch (error) {
|
|
1847
|
+
return finish({ error: new Error(`Workflow return could not be persisted: ${error instanceof Error ? error.message : String(error)}`) });
|
|
1848
|
+
}
|
|
1849
|
+
return finish({ value: message.value });
|
|
1850
|
+
}
|
|
1851
|
+
if (message.type === "error") {
|
|
1852
|
+
const rawError = typeof message.error === "string" ? message.error : "Workflow script failed.";
|
|
1853
|
+
const text = message.errorPhase === "return-serialization" ? `${rawError}${workflowReturnRecoveryHint(partial().children)}` : rawError;
|
|
1854
|
+
const workflowError = new Error(text) as Error & { workflowErrorKind?: "detached-child" };
|
|
1855
|
+
if (message.errorKind === "detached-child") workflowError.workflowErrorKind = "detached-child";
|
|
1856
|
+
return finish({ error: workflowError });
|
|
1857
|
+
}
|
|
1858
|
+
if (message.type === "callObserved" && typeof message.callId === "number") {
|
|
1859
|
+
const key = typeof message.key === "string" ? message.key : undefined;
|
|
1860
|
+
if (message.operation === "run") {
|
|
1861
|
+
const launch = key ? launches.get(key) : undefined;
|
|
1862
|
+
if (launch) launch.observed = true;
|
|
1863
|
+
else observedRunCalls.add(message.callId);
|
|
1864
|
+
} else if (message.operation === "steer") {
|
|
1865
|
+
const steer = steers.get(message.callId);
|
|
1866
|
+
if (steer) steer.observed = true;
|
|
1867
|
+
else observedSteerCalls.add(message.callId);
|
|
1868
|
+
} else if (message.operation === "host") {
|
|
1869
|
+
const host = hostCalls.get(message.callId);
|
|
1870
|
+
if (host) host.observed = true;
|
|
1871
|
+
else observedHostCalls.add(message.callId);
|
|
1872
|
+
}
|
|
1873
|
+
return;
|
|
1874
|
+
}
|
|
1875
|
+
if (message.type !== "call" || typeof message.callId !== "number" || typeof message.method !== "string" || !isRecord(message.args)) return;
|
|
1876
|
+
|
|
1877
|
+
const respond = (promise: Promise<unknown>, responsePath?: string, onBoundaryError?: (error: unknown) => void) => {
|
|
1878
|
+
void promise.then(
|
|
1879
|
+
(value) => {
|
|
1880
|
+
if (settled) return;
|
|
1881
|
+
const normalized = responsePath ? omitNonJsonWorkflowResultMetadata(value) : omitUndefinedWorkflowValues(value);
|
|
1882
|
+
if (!responsePath) {
|
|
1883
|
+
worker.postMessage({ type: "response", callId: message.callId, ok: true, value: normalized });
|
|
1884
|
+
return;
|
|
1885
|
+
}
|
|
1886
|
+
try {
|
|
1887
|
+
assertWorkflowJsonValue(normalized, responsePath);
|
|
1888
|
+
worker.postMessage({ type: "response", callId: message.callId, ok: true, value: normalized });
|
|
1889
|
+
} catch (error) {
|
|
1890
|
+
onBoundaryError?.(error);
|
|
1891
|
+
worker.postMessage({ type: "response", callId: message.callId, ok: false, error: `${responsePath} must contain only JSON data before it can be returned from workflowScript. Return a plain projection such as { runId, ok, output }. ${error instanceof Error ? error.message : String(error)}` });
|
|
1892
|
+
}
|
|
1893
|
+
},
|
|
1894
|
+
(error: unknown) => {
|
|
1895
|
+
if (!settled) worker.postMessage({ type: "response", callId: message.callId, ok: false, error: error instanceof Error ? error.message : String(error), ...(error instanceof Error && (error as { workflowErrorKind?: unknown }).workflowErrorKind === "detached-child" ? { errorKind: "detached-child" } : {}) });
|
|
1896
|
+
},
|
|
1897
|
+
);
|
|
1898
|
+
};
|
|
1899
|
+
if (message.method === "state.get" || message.method === "state.set") {
|
|
1900
|
+
if (!options.state) return respond(Promise.reject(new Error("Workflow state is unavailable without a mission.")));
|
|
1901
|
+
let key: string;
|
|
1902
|
+
try {
|
|
1903
|
+
key = validateKey(message.args.key, "state");
|
|
1904
|
+
} catch (error) {
|
|
1905
|
+
return respond(Promise.reject(error));
|
|
1906
|
+
}
|
|
1907
|
+
if (message.method === "state.get") return respond(Promise.resolve().then(() => options.state!.get(key)));
|
|
1908
|
+
if (acceptanceRecoveryBarrier) return respond(Promise.reject(new Error(recoveryBarrierMessage(acceptanceRecoveryBarrier.key, `state.set('${key}')`))));
|
|
1909
|
+
const value = message.args.value;
|
|
1910
|
+
try {
|
|
1911
|
+
assertWorkflowJsonValue(value, `state.set('${key}') value`);
|
|
1912
|
+
} catch (error) {
|
|
1913
|
+
return respond(Promise.reject(error));
|
|
1914
|
+
}
|
|
1915
|
+
return respond(Promise.resolve().then(() => options.state!.set(key, value)));
|
|
1916
|
+
}
|
|
1917
|
+
|
|
1918
|
+
if (message.method === "status") {
|
|
1919
|
+
const keyOrRunId = message.args.keyOrRunId;
|
|
1920
|
+
if (typeof keyOrRunId !== "string" || !keyOrRunId.trim()) return respond(Promise.reject(new Error("runs.status(keyOrRunId) requires a non-empty string.")));
|
|
1921
|
+
const known = children.get(keyOrRunId);
|
|
1922
|
+
const target = known?.runId ?? keyOrRunId;
|
|
1923
|
+
trace.push({ operation: "status", key: keyOrRunId, state: "started", ...(known?.runId ? { runId: known.runId } : {}) });
|
|
1924
|
+
traceChanged();
|
|
1925
|
+
if (settled || finishing) return;
|
|
1926
|
+
respond(options.status(target, childController.signal).then((result) => {
|
|
1927
|
+
if (settled || finishing) return result;
|
|
1928
|
+
trace.push({ operation: "status", key: keyOrRunId, state: result.ok ? "completed" : "failed", ...(result.runId ? { runId: result.runId } : {}), ...(!result.ok ? { error: result.output } : {}) });
|
|
1929
|
+
traceChanged();
|
|
1930
|
+
if (!result.ok) throw new Error(`Status '${keyOrRunId}' failed: ${result.output}`);
|
|
1931
|
+
return result;
|
|
1932
|
+
}));
|
|
1933
|
+
return;
|
|
1934
|
+
}
|
|
1935
|
+
if (message.method === "steer") {
|
|
1936
|
+
let key: string;
|
|
1937
|
+
try {
|
|
1938
|
+
key = validateKey(message.args.key, "runs.steer");
|
|
1939
|
+
} catch (error) {
|
|
1940
|
+
return respond(Promise.reject(error));
|
|
1941
|
+
}
|
|
1942
|
+
const steerMessage = message.args.message;
|
|
1943
|
+
if (typeof steerMessage !== "string" || !steerMessage.trim()) return respond(Promise.reject(new Error(`runs.steer('${key}') requires a non-empty message.`)));
|
|
1944
|
+
const steerOptions = isRecord(message.args.options) ? message.args.options as WorkflowSteerOptions : {};
|
|
1945
|
+
if (acceptanceRecoveryBarrier) return respond(Promise.reject(new Error(recoveryBarrierMessage(acceptanceRecoveryBarrier.key, `runs.steer('${key}')`))));
|
|
1946
|
+
const startedAt = Date.now();
|
|
1947
|
+
trace.push({ operation: "steer", key, state: "started" });
|
|
1948
|
+
traceChanged();
|
|
1949
|
+
const promise = Promise.resolve().then(() => {
|
|
1950
|
+
if (!launches.has(key)) throw new Error(`runs.steer('${key}') requires a prior runs.run/runs.all launch with that key.`);
|
|
1951
|
+
if (!options.steer) throw new Error("Workflow steering is unavailable in this host.");
|
|
1952
|
+
return options.steer(key, steerMessage.trim(), steerOptions, childController.signal);
|
|
1953
|
+
}).then((receipt) => {
|
|
1954
|
+
trace.push({ operation: "steer", key, state: receipt.state, durationMs: Date.now() - startedAt, ...(receipt.error ? { error: receipt.error } : {}) });
|
|
1955
|
+
traceChanged();
|
|
1956
|
+
return receipt;
|
|
1957
|
+
}, (error: unknown) => {
|
|
1958
|
+
const text = error instanceof Error ? error.message : String(error);
|
|
1959
|
+
trace.push({ operation: "steer", key, state: "failed", durationMs: Date.now() - startedAt, error: text });
|
|
1960
|
+
traceChanged();
|
|
1961
|
+
throw error;
|
|
1962
|
+
});
|
|
1963
|
+
steers.set(message.callId, { key, promise, observed: observedSteerCalls.delete(message.callId) });
|
|
1964
|
+
respond(promise);
|
|
1965
|
+
return;
|
|
1966
|
+
}
|
|
1967
|
+
if (message.method === "host") {
|
|
1968
|
+
let key: string;
|
|
1969
|
+
let params: WorkflowHostCommandParams;
|
|
1970
|
+
try {
|
|
1971
|
+
key = validateKey(message.args.key, "runs.host");
|
|
1972
|
+
params = normalizeWorkflowHostCommandParams(message.args.params, `runs.host('${key}') params`);
|
|
1973
|
+
} catch (error) {
|
|
1974
|
+
return respond(Promise.reject(error));
|
|
1975
|
+
}
|
|
1976
|
+
if (acceptanceRecoveryBarrier) return respond(Promise.reject(new Error(recoveryBarrierMessage(acceptanceRecoveryBarrier.key, `runs.host('${key}')`))));
|
|
1977
|
+
if (!options.host) return respond(Promise.reject(new Error("runs.host is unavailable in this host context.")));
|
|
1978
|
+
if (hostCalls.size >= HOST_STEP_MAX_COUNT) return respond(Promise.reject(new Error(`workflowScript supports at most ${HOST_STEP_MAX_COUNT} runs.host calls.`)));
|
|
1979
|
+
const startedAt = Date.now();
|
|
1980
|
+
const startedStep: HostStepNodeV1 = {
|
|
1981
|
+
version: 1,
|
|
1982
|
+
kind: "host-step",
|
|
1983
|
+
monitorKind: "command",
|
|
1984
|
+
id: key,
|
|
1985
|
+
label: key,
|
|
1986
|
+
...(params.role ? { role: params.role } : {}),
|
|
1987
|
+
...(params.provider ? { provider: params.provider } : {}),
|
|
1988
|
+
state: "running",
|
|
1989
|
+
updatedAt: startedAt,
|
|
1990
|
+
deadlineAt: startedAt + params.timeoutMs,
|
|
1991
|
+
};
|
|
1992
|
+
hostStepChanged(startedStep);
|
|
1993
|
+
trace.push({ operation: "host", key, state: "started" });
|
|
1994
|
+
traceChanged();
|
|
1995
|
+
const promise = Promise.resolve().then(() => options.host!(key, params, childController.signal)).then((result) => {
|
|
1996
|
+
const state = result.state === "stopped" ? "cancelled" : result.ok ? "done" : "error";
|
|
1997
|
+
const detail = [result.error, result.stderr.trim() || result.stdout.trim()].filter(Boolean).join(" ").replace(/\s+/g, " ").trim().slice(0, 200);
|
|
1998
|
+
hostStepChanged({ ...startedStep, state, ...(state === "done" ? { verdict: "pass" as const } : {}), ...(!result.ok ? { reasonCode: result.state === "timed-out" ? "timed_out" : result.state === "stopped" ? "aborted" : "command_failed" } : {}), ...(detail ? { detail } : {}), reportPath: params.output ?? result.outputPath.split(/[\\/]/).at(-1), exitCode: result.exitCode, updatedAt: Date.now() });
|
|
1999
|
+
trace.push({ operation: "host", key, state: result.ok ? "completed" : result.state === "stopped" ? "stopped" : "failed", durationMs: result.durationMs, ...(!result.ok ? { error: result.error ?? "Host command failed." } : {}) });
|
|
2000
|
+
traceChanged();
|
|
2001
|
+
if (!result.ok) throw new Error(`Host command '${key}' failed: ${detail || result.error || `exit code ${result.exitCode ?? "unknown"}`}`);
|
|
2002
|
+
return result;
|
|
2003
|
+
}, (error: unknown) => {
|
|
2004
|
+
const text = error instanceof Error ? error.message : String(error);
|
|
2005
|
+
hostStepChanged({ ...startedStep, state: "error", reasonCode: "execution_failed", detail: text.replace(/\s+/g, " ").slice(0, 200), updatedAt: Date.now() });
|
|
2006
|
+
trace.push({ operation: "host", key, state: "failed", durationMs: Date.now() - startedAt, error: text });
|
|
2007
|
+
traceChanged();
|
|
2008
|
+
throw error;
|
|
2009
|
+
});
|
|
2010
|
+
hostCalls.set(message.callId, { key, promise, observed: observedHostCalls.delete(message.callId) });
|
|
2011
|
+
respond(promise, `runs.host('${key}') result`);
|
|
2012
|
+
return;
|
|
2013
|
+
}
|
|
2014
|
+
if (message.method !== "run") return respond(Promise.reject(new Error(`Unknown runs API method '${message.method}'.`)));
|
|
2015
|
+
|
|
2016
|
+
let key: string;
|
|
2017
|
+
try {
|
|
2018
|
+
key = validateKey(message.args.key);
|
|
2019
|
+
} catch (error) {
|
|
2020
|
+
return respond(Promise.reject(error));
|
|
2021
|
+
}
|
|
2022
|
+
const params = message.args.params;
|
|
2023
|
+
if (!isRecord(params)) return respond(Promise.reject(new Error(`runs.run('${key}', params) requires a params object.`)));
|
|
2024
|
+
const generatedLaneKey = typeof message.args.generatedLaneKey === "string" && KEY_PATTERN.test(message.args.generatedLaneKey) && key.startsWith(`${message.args.generatedLaneKey}.`)
|
|
2025
|
+
? message.args.generatedLaneKey
|
|
2026
|
+
: undefined;
|
|
2027
|
+
const collectFailure = message.args.collectFailure === true;
|
|
2028
|
+
const callObserved = observedRunCalls.delete(message.callId);
|
|
2029
|
+
const deliver = (promise: Promise<WorkflowScriptChildResult>) => collectFailure
|
|
2030
|
+
? promise
|
|
2031
|
+
: promise.then((result) => {
|
|
2032
|
+
const recoverableAcceptanceMetadata = result.recovery?.status === "available-for-review"
|
|
2033
|
+
&& result.recovery.reason === "acceptance-metadata-rejected";
|
|
2034
|
+
if (!result.ok && !result.stopped && !recoverableAcceptanceMetadata) {
|
|
2035
|
+
const childError = new Error(result.detached ? `Run '${key}' detached: ${result.error ?? result.output}` : `Run '${key}' failed: ${result.error ?? result.output}`) as Error & { workflowErrorKind?: "detached-child" };
|
|
2036
|
+
if (result.detached) childError.workflowErrorKind = "detached-child";
|
|
2037
|
+
throw childError;
|
|
2038
|
+
}
|
|
2039
|
+
return result;
|
|
2040
|
+
});
|
|
2041
|
+
const fingerprint = stableJson(params);
|
|
2042
|
+
const existing = launches.get(key);
|
|
2043
|
+
if (existing) {
|
|
2044
|
+
if (existing.fingerprint !== fingerprint) return respond(Promise.reject(new Error(`Duplicate workflow key '${key}' used with incompatible launch params.`)));
|
|
2045
|
+
if (callObserved) existing.observed = true;
|
|
2046
|
+
trace.push({ operation: "run", key, state: "reused", ...workflowStringMetadata(params), ...(existing.generatedLaneKey ? { generatedLaneKey: existing.generatedLaneKey } : {}) });
|
|
2047
|
+
traceChanged();
|
|
2048
|
+
return respond(deliver(existing.promise), `runs.run('${key}') result`, (error) => children.set(key, responseBoundaryFailure(key, error)));
|
|
2049
|
+
}
|
|
2050
|
+
const permitError = options.oneUsePermit?.claim(key);
|
|
2051
|
+
if (permitError) return respond(Promise.reject(new Error(permitError)));
|
|
2052
|
+
if (options.oneUsePermit && message.args.batch !== undefined) return respond(Promise.reject(new Error("Workflow child permit does not support runs.all.")));
|
|
2053
|
+
if (options.oneUsePermit && params.resume !== undefined) return respond(Promise.reject(new Error("Workflow child permit does not support retained resume.")));
|
|
2054
|
+
if (params.action !== undefined) return respond(Promise.reject(new Error(`runs.run('${key}') accepts execution params only; management action is not allowed.`)));
|
|
2055
|
+
if (params.workflowScript !== undefined) return respond(Promise.reject(new Error(`runs.run('${key}') cannot start a nested workflow script.`)));
|
|
2056
|
+
if (params.tasks !== undefined || params.chain !== undefined || params.parallel !== undefined || params.concurrency !== undefined || params.chainDir !== undefined) {
|
|
2057
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') accepts one child via { agent, task }; use runs.all(...) and JavaScript control flow for orchestration.`)));
|
|
2058
|
+
}
|
|
2059
|
+
if (params.worktree !== undefined && typeof params.worktree !== "boolean") {
|
|
2060
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') worktree must be true or false.`)));
|
|
2061
|
+
}
|
|
2062
|
+
if (params.gate !== undefined && (typeof params.gate !== "string" || !params.gate.trim())) {
|
|
2063
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') gate must be a non-empty command string.`)));
|
|
2064
|
+
}
|
|
2065
|
+
if (params.gate !== undefined && params.acceptance !== undefined) {
|
|
2066
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') gate cannot be combined with acceptance; use one gate command or acceptance.verify.`)));
|
|
2067
|
+
}
|
|
2068
|
+
if (params.gate !== undefined && params.resume !== undefined) {
|
|
2069
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') gate is not supported with retained resume.`)));
|
|
2070
|
+
}
|
|
2071
|
+
let resumeReference: WorkflowReceiptResumeReference | undefined;
|
|
2072
|
+
try {
|
|
2073
|
+
if (params.resume !== undefined && typeof params.resume !== "string") resumeReference = parseWorkflowResumeReference(params.resume);
|
|
2074
|
+
} catch (error) {
|
|
2075
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') ${error instanceof Error ? error.message : String(error)}`)));
|
|
2076
|
+
}
|
|
2077
|
+
if (typeof params.resume === "string" && !params.resume.trim()) return respond(Promise.reject(new Error(`runs.run('${key}') resume must be a non-empty retained run id.`)));
|
|
2078
|
+
if (params.resume !== undefined && params.agent !== undefined) {
|
|
2079
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') resume and agent are mutually exclusive.`)));
|
|
2080
|
+
}
|
|
2081
|
+
if (params.resume !== undefined && (typeof params.task !== "string" || !params.task.trim())) {
|
|
2082
|
+
return respond(Promise.reject(new Error(`runs.run('${key}') resume requires a non-empty task follow-up.`)));
|
|
2083
|
+
}
|
|
2084
|
+
const startedAt = Date.now();
|
|
2085
|
+
const batch = isRecord(message.args.batch) && typeof message.args.batch.id === "string" && Array.isArray(message.args.batch.calls)
|
|
2086
|
+
? { id: message.args.batch.id, calls: message.args.batch.calls.filter((call): call is { key: string; params: Record<string, unknown> } => isRecord(call) && typeof call.key === "string" && isRecord(call.params)) }
|
|
2087
|
+
: undefined;
|
|
2088
|
+
let admission = batch ? batchAdmissions.get(batch.id) : undefined;
|
|
2089
|
+
if (!admission) {
|
|
2090
|
+
const seenKeys = new Set<string>();
|
|
2091
|
+
const calls = (batch?.calls ?? [{ key, params }]).filter((call) => {
|
|
2092
|
+
if (seenKeys.has(call.key) || launches.has(call.key)) return false;
|
|
2093
|
+
seenKeys.add(call.key);
|
|
2094
|
+
return true;
|
|
2095
|
+
});
|
|
2096
|
+
admission = Promise.resolve().then(() => {
|
|
2097
|
+
if (settled || finishing) return;
|
|
2098
|
+
for (const call of calls) assertRecoveryBarrierAllowsRun(call.key, call.params);
|
|
2099
|
+
return options.admit?.(calls);
|
|
2100
|
+
});
|
|
2101
|
+
if (batch) batchAdmissions.set(batch.id, admission);
|
|
2102
|
+
}
|
|
2103
|
+
let resolvedResumeLineage: string[] | undefined;
|
|
2104
|
+
const promise = admission.then(async () => {
|
|
2105
|
+
if (settled || finishing || stoppedLaunches.has(key)) {
|
|
2106
|
+
const reason = childController.signal.reason;
|
|
2107
|
+
const text = children.get(key)?.error ?? (reason instanceof Error ? reason.message : typeof reason === "string" ? reason : "Workflow script aborted.");
|
|
2108
|
+
return stoppedChildResult(key, text);
|
|
2109
|
+
}
|
|
2110
|
+
const childStopController = new AbortController();
|
|
2111
|
+
childStopControllers.set(key, childStopController);
|
|
2112
|
+
const childSignal = combinedAbortSignal([childController.signal, childStopController.signal]);
|
|
2113
|
+
const resolvedResumeValue = resumeReference
|
|
2114
|
+
? await Promise.resolve().then(() => {
|
|
2115
|
+
if (!options.resolveResume) throw new Error("Keyed workflow receipt resume is unavailable in this host.");
|
|
2116
|
+
return options.resolveResume(resumeReference, childSignal);
|
|
2117
|
+
})
|
|
2118
|
+
: undefined;
|
|
2119
|
+
const resolvedResume = typeof resolvedResumeValue === "string"
|
|
2120
|
+
? resolvedResumeValue
|
|
2121
|
+
: isRecord(resolvedResumeValue) && typeof resolvedResumeValue.runId === "string"
|
|
2122
|
+
? resolvedResumeValue.runId
|
|
2123
|
+
: undefined;
|
|
2124
|
+
if (resumeReference && (typeof resolvedResume !== "string" || !resolvedResume.trim())) throw new Error("Keyed workflow receipt resume resolved without a retained run id.");
|
|
2125
|
+
const resolvedResumeId = resolvedResume?.trim();
|
|
2126
|
+
if (isRecord(resolvedResumeValue)) {
|
|
2127
|
+
const lineage = Array.isArray(resolvedResumeValue.runIds)
|
|
2128
|
+
? resolvedResumeValue.runIds.filter((runId): runId is string => typeof runId === "string" && Boolean(runId.trim())).map((runId) => runId.trim())
|
|
2129
|
+
: [];
|
|
2130
|
+
resolvedResumeLineage = [...new Set(lineage.length ? lineage : [resolvedResumeId!])];
|
|
2131
|
+
if (resolvedResumeLineage.at(-1) !== resolvedResumeId) resolvedResumeLineage.push(resolvedResumeId!);
|
|
2132
|
+
}
|
|
2133
|
+
const launchParams = resolvedResumeId ? { ...params, resume: resolvedResumeId } : params;
|
|
2134
|
+
await launchSemaphore.acquire();
|
|
2135
|
+
try {
|
|
2136
|
+
if (settled || finishing || stoppedLaunches.has(key) || childSignal.aborted) {
|
|
2137
|
+
const reason = childSignal.reason;
|
|
2138
|
+
const text = children.get(key)?.error ?? (reason instanceof Error ? reason.message : typeof reason === "string" ? reason : "Workflow script aborted.");
|
|
2139
|
+
return stoppedChildResult(key, text);
|
|
2140
|
+
}
|
|
2141
|
+
const result = await options.launch(key, launchParams, childSignal, { admitted: true, batch: batch !== undefined });
|
|
2142
|
+
const autoResumeParams = setupAbortResumeParams(params, result, childSignal);
|
|
2143
|
+
if (!autoResumeParams) return result;
|
|
2144
|
+
resolvedResumeLineage = [...new Set([...(resolvedResumeLineage ?? []), result.runId!])];
|
|
2145
|
+
trace.push({ operation: "run", key, state: "started", ...workflowStringMetadata(autoResumeParams), ...(generatedLaneKey ? { generatedLaneKey } : {}), phase: "auto-resume", runId: result.runId });
|
|
2146
|
+
traceChanged();
|
|
2147
|
+
return options.launch(key, autoResumeParams, childSignal, { admitted: true, batch: batch !== undefined });
|
|
2148
|
+
} finally {
|
|
2149
|
+
launchSemaphore.release();
|
|
2150
|
+
}
|
|
2151
|
+
}).then((result) => {
|
|
2152
|
+
let normalized = !result.ok && !result.error ? { ...result, error: result.output } : result;
|
|
2153
|
+
if (resolvedResumeLineage?.length && normalized.runId) {
|
|
2154
|
+
normalized = { ...normalized, continuation: { runIds: [...new Set([...resolvedResumeLineage, normalized.runId])] } };
|
|
2155
|
+
}
|
|
2156
|
+
childStopControllers.delete(key);
|
|
2157
|
+
if (stoppedLaunches.has(key)) return children.get(key) ?? normalized;
|
|
2158
|
+
children.set(key, normalized);
|
|
2159
|
+
recordAcceptanceRecoveryBarrier(key, normalized);
|
|
2160
|
+
const state = normalized.ok ? "completed" : normalized.stopped ? "stopped" : normalized.detached ? "detached" : "failed";
|
|
2161
|
+
trace.push({ operation: "run", key, state, durationMs: Date.now() - startedAt, ...workflowStringMetadata(params), ...(generatedLaneKey ? { generatedLaneKey } : {}), ...(normalized.agent ? { agent: normalized.agent } : {}), ...(normalized.runId ? { runId: normalized.runId } : {}), ...(!normalized.ok ? { error: normalized.error ?? normalized.output } : {}) });
|
|
2162
|
+
traceChanged();
|
|
2163
|
+
return normalized;
|
|
2164
|
+
}, (error: unknown) => {
|
|
2165
|
+
const text = error instanceof Error ? error.message : String(error);
|
|
2166
|
+
const failure: WorkflowScriptChildResult = { key, ok: false, output: text, error: text, artifactPaths: [] };
|
|
2167
|
+
childStopControllers.delete(key);
|
|
2168
|
+
if (stoppedLaunches.has(key)) return children.get(key) ?? { ...failure, stopped: true };
|
|
2169
|
+
children.set(key, failure);
|
|
2170
|
+
trace.push({ operation: "run", key, state: "failed", durationMs: Date.now() - startedAt, ...workflowStringMetadata(params), ...(generatedLaneKey ? { generatedLaneKey } : {}), error: text });
|
|
2171
|
+
traceChanged();
|
|
2172
|
+
return failure;
|
|
2173
|
+
});
|
|
2174
|
+
launches.set(key, { fingerprint, promise, observed: callObserved, ...(generatedLaneKey ? { generatedLaneKey } : {}) });
|
|
2175
|
+
childOrder.push(key);
|
|
2176
|
+
trace.push({ operation: "run", key, state: "started", ...workflowStringMetadata(params), ...(generatedLaneKey ? { generatedLaneKey } : {}) });
|
|
2177
|
+
traceChanged();
|
|
2178
|
+
respond(deliver(promise), `runs.run('${key}') result`, (error) => children.set(key, responseBoundaryFailure(key, error)));
|
|
2179
|
+
});
|
|
2180
|
+
|
|
2181
|
+
worker.postMessage({ type: "start", script: options.script, stateEnabled: options.state !== undefined });
|
|
2182
|
+
});
|
|
2183
|
+
}
|