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,2437 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core execution logic for running subagents
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { spawn } from "node:child_process";
|
|
6
|
+
import { existsSync } from "node:fs";
|
|
7
|
+
import * as path from "node:path";
|
|
8
|
+
import type { Message } from "@earendil-works/pi-ai";
|
|
9
|
+
import { discoverAgents, formatUnknownAgentError, unknownAgentDiagnosticContext, type AgentConfig } from "../../agents/agents.ts";
|
|
10
|
+
import { appendAgentRefinementOverlay } from "../../agents/agent-refinements.ts";
|
|
11
|
+
import { alignForkedSessionCwd } from "../../shared/fork-session-cwd.ts";
|
|
12
|
+
import {
|
|
13
|
+
ensureArtifactsDir,
|
|
14
|
+
formatOutputArtifactContent,
|
|
15
|
+
getArtifactPaths,
|
|
16
|
+
writeArtifact,
|
|
17
|
+
writeMetadata,
|
|
18
|
+
} from "../../shared/artifacts.ts";
|
|
19
|
+
import { createChildTranscriptWriter, type ChildTranscriptWriter } from "../../shared/child-transcript.ts";
|
|
20
|
+
import {
|
|
21
|
+
type AgentProgress,
|
|
22
|
+
type ArtifactPaths,
|
|
23
|
+
type ControlEvent,
|
|
24
|
+
type ModelAttempt,
|
|
25
|
+
type RunSyncOptions,
|
|
26
|
+
type SingleResult,
|
|
27
|
+
type Usage,
|
|
28
|
+
DEFAULT_MAX_OUTPUT,
|
|
29
|
+
INTERCOM_DETACH_REQUEST_EVENT,
|
|
30
|
+
INTERCOM_DETACH_RESPONSE_EVENT,
|
|
31
|
+
type AcceptanceLedger,
|
|
32
|
+
type ResolvedAcceptanceConfig,
|
|
33
|
+
truncateOutput,
|
|
34
|
+
getSubagentDepthEnv,
|
|
35
|
+
} from "../../shared/types.ts";
|
|
36
|
+
import {
|
|
37
|
+
DEFAULT_CONTROL_CONFIG,
|
|
38
|
+
buildControlEvent,
|
|
39
|
+
claimControlNotification,
|
|
40
|
+
deriveActivityState,
|
|
41
|
+
shouldEmitOpenToolAttention,
|
|
42
|
+
shouldNotifyControlEvent,
|
|
43
|
+
} from "../shared/subagent-control.ts";
|
|
44
|
+
import {
|
|
45
|
+
getFinalOutput,
|
|
46
|
+
findLatestSessionFile,
|
|
47
|
+
detectSubagentError,
|
|
48
|
+
hasEmptyTerminalAssistantResponse,
|
|
49
|
+
formatEmptyTerminalAssistantResponseError,
|
|
50
|
+
extractToolArgsPreview,
|
|
51
|
+
extractTextFromContent,
|
|
52
|
+
MAX_STREAMED_RECENT_TOOLS,
|
|
53
|
+
boundStreamedRecentTools,
|
|
54
|
+
boundStreamedRecentOutput,
|
|
55
|
+
boundStreamedToolCalls,
|
|
56
|
+
} from "../../shared/utils.ts";
|
|
57
|
+
import { buildSkillInjection, resolveSkillsWithFallback } from "../../agents/skills.ts";
|
|
58
|
+
import { buildAgentMemoryInjection } from "../../agents/agent-memory.ts";
|
|
59
|
+
import { effectiveToolTimeoutMs, formatToolTimeoutMessage, resolveToolTimeoutMs, toolTimeoutCallKey, toolTimeoutFromEnv } from "../shared/tool-timeout.ts";
|
|
60
|
+
import { evaluateCompletionMutationGuard, expectsImplementationMutation, hasMutationToolCapability, validateImplementationToolContract } from "../shared/completion-guard.ts";
|
|
61
|
+
import { planCompletionEvidence } from "../shared/completion-evidence.ts";
|
|
62
|
+
import { planAbortRecovery } from "../shared/abort-recovery.ts";
|
|
63
|
+
import { arbitrateCompletionGuardRescue } from "../shared/llm-intent-arbiter.ts";
|
|
64
|
+
import { getPiSpawnCommand } from "../shared/pi-spawn.ts";
|
|
65
|
+
import { preflightLaunchCwd } from "../shared/launch-cwd.ts";
|
|
66
|
+
import { createJsonlWriter } from "../../shared/jsonl-writer.ts";
|
|
67
|
+
import { createOrcaProgressTab, type OrcaProgressTab } from "../shared/orca-progress-tabs.ts";
|
|
68
|
+
import { attachPostExitStdioGuard, trySignalChild } from "../../shared/post-exit-stdio-guard.ts";
|
|
69
|
+
import { resolvePermissionRules } from "../shared/permissions.ts";
|
|
70
|
+
import { applyThinkingSuffix, buildPiArgs, cleanupTempDir, deriveForkPromptCacheKey, projectLaunchResolvedChildExtensions, resolvePiLaunchToolPlan, type SubagentTaskDelivery } from "../shared/pi-args.ts";
|
|
71
|
+
import { deriveChildSessionName } from "../../shared/child-session-name.ts";
|
|
72
|
+
import { readRuntimeAcknowledgedExtensions } from "../shared/runtime-acknowledged-extensions.ts";
|
|
73
|
+
import { assertAgentAllowedByCapabilityCeiling, decodeSubagentCapabilityCeiling, intersectSubagentCapabilityCeilings, resolveCurrentSubagentCapabilityCeiling, SUBAGENT_CAPABILITY_CEILING_ENV } from "../shared/capability-ceiling.ts";
|
|
74
|
+
import { resolveEffectiveThinking } from "../../shared/model-info.ts";
|
|
75
|
+
import { assertThinkingWithinCeiling, decodeThinkingCeiling, intersectThinkingCeilings, SUBAGENT_THINKING_CEILING_ENV } from "../../shared/thinking-ceiling.ts";
|
|
76
|
+
import { clearStructuredOutputCaptures, MISSING_STRUCTURED_OUTPUT_CALL_ERROR, readStructuredOutput, readStructuredOutputAcceptanceReport } from "../shared/structured-output.ts";
|
|
77
|
+
import { formatMidToolExitError, formatProcessSignalError, isOrdinaryToolForMidToolExit, isUnexplainedProcessSignal } from "../shared/process-signal.ts";
|
|
78
|
+
import { readChildToolDiagnosticError } from "../shared/tool-availability.ts";
|
|
79
|
+
import { buildTimeoutRecoverySummary, collectTrackedMutationEvidence, snapshotTrackedMutations } from "../shared/mutation-evidence.ts";
|
|
80
|
+
import { captureSingleOutputSnapshot, extractChildWrittenOutput, finalizeSingleOutput, formatSavedOutputReference, hasSingleOutputChangedSinceSnapshot, injectOutputPathSystemPrompt, resolveSingleOutput, validateFileOnlyOutputMode, type SingleOutputSnapshot } from "../shared/single-output.ts";
|
|
81
|
+
import {
|
|
82
|
+
buildModelCandidates,
|
|
83
|
+
formatSubagentModelVerificationError,
|
|
84
|
+
formatModelAttemptNote,
|
|
85
|
+
isContextOverflow,
|
|
86
|
+
isRetryableModelFailureAttempt,
|
|
87
|
+
recordRetryableModelFailure,
|
|
88
|
+
} from "../shared/model-fallback.ts";
|
|
89
|
+
import {
|
|
90
|
+
SUBAGENT_STARTUP_RETRY_DELAYS_MS,
|
|
91
|
+
formatSubagentExtensionConflictError,
|
|
92
|
+
formatSubagentStartupRetryExhaustedError,
|
|
93
|
+
formatSubagentStartupRetryNote,
|
|
94
|
+
isRetryableSubagentStartupFailure,
|
|
95
|
+
waitForSubagentStartupRetry,
|
|
96
|
+
} from "../shared/subagent-startup-retry.ts";
|
|
97
|
+
import {
|
|
98
|
+
createMutatingFailureState,
|
|
99
|
+
didMutatingToolFail,
|
|
100
|
+
isMutatingTool,
|
|
101
|
+
nextLongRunningTrigger,
|
|
102
|
+
recordMutatingFailure,
|
|
103
|
+
resetMutatingFailureState,
|
|
104
|
+
resolveCurrentPath,
|
|
105
|
+
shouldEscalateMutatingFailures,
|
|
106
|
+
summarizeRecentMutatingFailures,
|
|
107
|
+
} from "../shared/long-running-guard.ts";
|
|
108
|
+
import { acceptanceFailureMessage, buildSkippedAcceptanceLedger, evaluateAcceptance, formatAcceptancePrompt, resolveEffectiveAcceptance, stripAcceptanceReport, validateAcceptanceInput } from "../shared/acceptance.ts";
|
|
109
|
+
import { PROMPT_REDACTED } from "../../shared/utils.ts";
|
|
110
|
+
import { attachContractProjections, isAgentContractV1 } from "../shared/agent-contract.ts";
|
|
111
|
+
import { initialToolBudgetState, toolBudgetState } from "../shared/tool-budget.ts";
|
|
112
|
+
import { resolveWatchdogConfig } from "../../watchdog/settings.ts";
|
|
113
|
+
import { agentDefinitionDigest, launchBindingDigest } from "../../shared/launch-contract.ts";
|
|
114
|
+
import { consumeWorkflowChildPermit } from "../../shared/workflow-child-permit.ts";
|
|
115
|
+
import { createBoundedByteTail, createBoundedLineReader, formatProtocolOutputLimit, MAX_CHILD_STDERR_BYTES, PI_AGGREGATE_EVENT_PROJECTOR, projectChildLifecycle, type ChildLifecycleAction, type ChildLifecycleState, type ProtocolOutputLimit } from "../shared/child-protocol.ts";
|
|
116
|
+
import {
|
|
117
|
+
acceptChildWatchdogEvent,
|
|
118
|
+
childWatchdogIsActive,
|
|
119
|
+
isChildWatchdogStatusEvent,
|
|
120
|
+
resolveChildWatchdogConfig,
|
|
121
|
+
type ChildWatchdogStateSnapshot,
|
|
122
|
+
} from "../../watchdog/child-status.ts";
|
|
123
|
+
|
|
124
|
+
const artifactOutputByResult = new WeakMap<SingleResult, string>();
|
|
125
|
+
const acceptanceOutputByResult = new WeakMap<SingleResult, string>();
|
|
126
|
+
|
|
127
|
+
function emptyUsage(): Usage {
|
|
128
|
+
return { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0, turns: 0 };
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function withRunContext<T extends SingleResult>(result: T, context: RunSyncOptions["context"]): T {
|
|
132
|
+
if (!context) return result;
|
|
133
|
+
result.context = context;
|
|
134
|
+
return result;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function redactResultPrompt<T extends SingleResult>(result: T): T {
|
|
138
|
+
result.task = PROMPT_REDACTED;
|
|
139
|
+
if (result.progress) result.progress.task = PROMPT_REDACTED;
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function sumUsage(target: Usage, source: Usage): void {
|
|
144
|
+
target.input += source.input;
|
|
145
|
+
target.output += source.output;
|
|
146
|
+
target.cacheRead += source.cacheRead;
|
|
147
|
+
target.cacheWrite += source.cacheWrite;
|
|
148
|
+
target.cost += source.cost;
|
|
149
|
+
target.turns += source.turns;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function persistSingleResultMetadata(input: {
|
|
153
|
+
metadataPath?: string;
|
|
154
|
+
enabled: boolean;
|
|
155
|
+
runId?: string;
|
|
156
|
+
agent: string;
|
|
157
|
+
task: string;
|
|
158
|
+
result: SingleResult;
|
|
159
|
+
}): void {
|
|
160
|
+
if (!input.enabled || !input.metadataPath) return;
|
|
161
|
+
const target = input.result;
|
|
162
|
+
writeMetadata(input.metadataPath, {
|
|
163
|
+
runId: input.runId,
|
|
164
|
+
agent: input.agent,
|
|
165
|
+
task: PROMPT_REDACTED,
|
|
166
|
+
exitCode: target.exitCode,
|
|
167
|
+
processSignal: target.processSignal,
|
|
168
|
+
usage: target.usage,
|
|
169
|
+
model: target.model,
|
|
170
|
+
attemptedModels: target.attemptedModels,
|
|
171
|
+
modelAttempts: target.modelAttempts,
|
|
172
|
+
durationMs: target.progressSummary?.durationMs,
|
|
173
|
+
toolCount: target.progressSummary?.toolCount,
|
|
174
|
+
error: target.error,
|
|
175
|
+
agentContract: target.agentContract,
|
|
176
|
+
launchContractDigest: target.launchContractDigest,
|
|
177
|
+
launchResolvedExtensions: target.launchResolvedExtensions,
|
|
178
|
+
runtimeAcknowledgedExtensions: target.runtimeAcknowledgedExtensions,
|
|
179
|
+
execution: target.execution,
|
|
180
|
+
acceptance: target.acceptance,
|
|
181
|
+
capabilityCeiling: target.capabilityCeiling,
|
|
182
|
+
capabilityAudit: target.capabilityAudit,
|
|
183
|
+
review: target.review,
|
|
184
|
+
effects: target.effects,
|
|
185
|
+
transcriptPath: target.transcriptPath,
|
|
186
|
+
transcriptError: target.transcriptError,
|
|
187
|
+
skills: target.skills,
|
|
188
|
+
skillsWarning: target.skillsWarning,
|
|
189
|
+
timestamp: Date.now(),
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function formatTimeoutMessage(timeoutMs: number): string {
|
|
194
|
+
return `Subagent timed out after ${timeoutMs}ms.`;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function resolveAttemptTimeout(options: RunSyncOptions): { timeoutMs: number; remainingMs: number; message: string } | undefined {
|
|
198
|
+
if (options.timeoutMs === undefined) return undefined;
|
|
199
|
+
const deadlineAt = options.deadlineAt ?? Date.now() + options.timeoutMs;
|
|
200
|
+
return {
|
|
201
|
+
timeoutMs: options.timeoutMs,
|
|
202
|
+
remainingMs: Math.max(0, deadlineAt - Date.now()),
|
|
203
|
+
message: formatTimeoutMessage(options.timeoutMs),
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function buildPendingAcceptanceLedger(acceptance: ResolvedAcceptanceConfig): AcceptanceLedger {
|
|
208
|
+
return {
|
|
209
|
+
status: "pending",
|
|
210
|
+
evidenceStatus: "pending",
|
|
211
|
+
explicit: acceptance.explicit,
|
|
212
|
+
effectiveAcceptance: acceptance,
|
|
213
|
+
inferredReason: acceptance.inferredReason,
|
|
214
|
+
criteria: acceptance.criteria,
|
|
215
|
+
runtimeChecks: [],
|
|
216
|
+
verifyRuns: [],
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function buildInterruptedAcceptanceLedger(acceptance: ResolvedAcceptanceConfig): AcceptanceLedger {
|
|
221
|
+
const pending = buildPendingAcceptanceLedger(acceptance);
|
|
222
|
+
if (acceptance.level === "none") {
|
|
223
|
+
pending.status = "not-required";
|
|
224
|
+
pending.evidenceStatus = "not-required";
|
|
225
|
+
} else {
|
|
226
|
+
pending.runtimeChecks = [{
|
|
227
|
+
id: "interrupted",
|
|
228
|
+
status: "not-applicable",
|
|
229
|
+
message: "Acceptance was not evaluated because the subagent was interrupted.",
|
|
230
|
+
}];
|
|
231
|
+
}
|
|
232
|
+
return pending;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function appendRecentOutput(progress: AgentProgress, lines: string[]): void {
|
|
236
|
+
if (lines.length === 0) return;
|
|
237
|
+
progress.recentOutput.push(...lines.filter((line) => line.trim()));
|
|
238
|
+
if (progress.recentOutput.length > 50) {
|
|
239
|
+
progress.recentOutput.splice(0, progress.recentOutput.length - 50);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function stripAcceptanceReportsFromMessages(messages: Message[] | undefined): void {
|
|
244
|
+
for (const message of messages ?? []) {
|
|
245
|
+
if (message.role !== "assistant" || !Array.isArray(message.content)) continue;
|
|
246
|
+
for (const part of message.content) {
|
|
247
|
+
if (part.type === "text" && "text" in part && typeof part.text === "string") {
|
|
248
|
+
part.text = stripAcceptanceReport(part.text);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function snapshotProgress(progress: AgentProgress): AgentProgress {
|
|
255
|
+
return {
|
|
256
|
+
...progress,
|
|
257
|
+
task: PROMPT_REDACTED,
|
|
258
|
+
skills: progress.skills ? [...progress.skills] : undefined,
|
|
259
|
+
recentTools: boundStreamedRecentTools(progress.recentTools),
|
|
260
|
+
recentOutput: boundStreamedRecentOutput(progress.recentOutput),
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
function snapshotResult(result: SingleResult, progress: AgentProgress): SingleResult {
|
|
265
|
+
return {
|
|
266
|
+
...result,
|
|
267
|
+
task: PROMPT_REDACTED,
|
|
268
|
+
messages: result.outputMode === "file-only" && result.savedOutputPath ? undefined : result.messages ? [...result.messages] : undefined,
|
|
269
|
+
usage: { ...result.usage },
|
|
270
|
+
skills: result.skills ? [...result.skills] : undefined,
|
|
271
|
+
attemptedModels: result.attemptedModels ? [...result.attemptedModels] : undefined,
|
|
272
|
+
modelAttempts: result.modelAttempts
|
|
273
|
+
? result.modelAttempts.map((attempt) => ({
|
|
274
|
+
...attempt,
|
|
275
|
+
usage: attempt.usage ? { ...attempt.usage } : undefined,
|
|
276
|
+
}))
|
|
277
|
+
: undefined,
|
|
278
|
+
controlEvents: result.controlEvents ? result.controlEvents.map((event) => ({ ...event })) : undefined,
|
|
279
|
+
progress,
|
|
280
|
+
progressSummary: result.progressSummary ? { ...result.progressSummary } : undefined,
|
|
281
|
+
artifactPaths: result.artifactPaths ? { ...result.artifactPaths } : undefined,
|
|
282
|
+
truncation: result.truncation ? { ...result.truncation } : undefined,
|
|
283
|
+
outputReference: result.outputReference ? { ...result.outputReference } : undefined,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Streaming variant of snapshotResult for `onUpdate` progress events: it drops the
|
|
289
|
+
* unbounded `messages` transcript in favour of compact tool-call summaries so a
|
|
290
|
+
* single `tool_execution_update` line stays well under the child-stdout protocol
|
|
291
|
+
* cap (`MAX_CHILD_PENDING_LINE_BYTES`). Non-streaming consumers such as
|
|
292
|
+
* foreground detach receipts and terminal consumers use snapshotResult directly.
|
|
293
|
+
*/
|
|
294
|
+
function snapshotStreamResult(result: SingleResult, progress: AgentProgress): SingleResult {
|
|
295
|
+
const snapshot = snapshotResult(result, progress);
|
|
296
|
+
snapshot.messages = undefined;
|
|
297
|
+
snapshot.toolCalls = boundStreamedToolCalls(result);
|
|
298
|
+
return snapshot;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
interface StructuredDelegationProgressState {
|
|
302
|
+
currentTool?: string;
|
|
303
|
+
currentToolArgs?: string;
|
|
304
|
+
recentOutput: string[];
|
|
305
|
+
recentTools: Array<{ tool: string; args: string }>;
|
|
306
|
+
activityState?: AgentProgress["activityState"];
|
|
307
|
+
model?: string;
|
|
308
|
+
toolCount: number;
|
|
309
|
+
tokens: number;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function captureStructuredDelegationProgressState(progress: AgentProgress, result: SingleResult): StructuredDelegationProgressState {
|
|
313
|
+
return {
|
|
314
|
+
currentTool: progress.currentTool,
|
|
315
|
+
currentToolArgs: progress.currentToolArgs,
|
|
316
|
+
recentOutput: [...progress.recentOutput],
|
|
317
|
+
recentTools: progress.recentTools.slice(-MAX_STREAMED_RECENT_TOOLS).map(({ tool, args }) => ({ tool, args })),
|
|
318
|
+
activityState: progress.activityState,
|
|
319
|
+
model: progress.model ?? result.model,
|
|
320
|
+
toolCount: progress.toolCount,
|
|
321
|
+
tokens: progress.tokens,
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function structuredDelegationProgressChanged(
|
|
326
|
+
previous: StructuredDelegationProgressState,
|
|
327
|
+
progress: AgentProgress,
|
|
328
|
+
result: SingleResult,
|
|
329
|
+
): boolean {
|
|
330
|
+
if (previous.currentTool !== progress.currentTool
|
|
331
|
+
|| previous.currentToolArgs !== progress.currentToolArgs
|
|
332
|
+
|| previous.activityState !== progress.activityState
|
|
333
|
+
|| previous.model !== (progress.model ?? result.model)
|
|
334
|
+
|| previous.toolCount !== progress.toolCount
|
|
335
|
+
|| previous.tokens !== progress.tokens
|
|
336
|
+
|| previous.recentOutput.length !== progress.recentOutput.length) return true;
|
|
337
|
+
for (let index = 0; index < progress.recentOutput.length; index++) {
|
|
338
|
+
if (previous.recentOutput[index] !== progress.recentOutput[index]) return true;
|
|
339
|
+
}
|
|
340
|
+
const recentToolsStart = Math.max(0, progress.recentTools.length - MAX_STREAMED_RECENT_TOOLS);
|
|
341
|
+
if (previous.recentTools.length !== progress.recentTools.length - recentToolsStart) return true;
|
|
342
|
+
for (let index = recentToolsStart; index < progress.recentTools.length; index++) {
|
|
343
|
+
const previousTool = previous.recentTools[index - recentToolsStart];
|
|
344
|
+
const currentTool = progress.recentTools[index];
|
|
345
|
+
if (previousTool?.tool !== currentTool?.tool || previousTool?.args !== currentTool?.args) return true;
|
|
346
|
+
}
|
|
347
|
+
return false;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
const AFTER_COMPACTION_SETTLEMENT = Symbol("afterCompactionSettlement");
|
|
351
|
+
type AbortRecoverySingleResult = SingleResult & { [AFTER_COMPACTION_SETTLEMENT]?: true };
|
|
352
|
+
|
|
353
|
+
async function runSingleAttempt(
|
|
354
|
+
runtimeCwd: string,
|
|
355
|
+
agent: AgentConfig,
|
|
356
|
+
task: string,
|
|
357
|
+
model: string | undefined,
|
|
358
|
+
options: RunSyncOptions,
|
|
359
|
+
shared: {
|
|
360
|
+
sessionEnabled: boolean;
|
|
361
|
+
systemPrompt: string;
|
|
362
|
+
resolvedSkillNames?: string[];
|
|
363
|
+
modelCandidates?: string[];
|
|
364
|
+
skillsWarning?: string;
|
|
365
|
+
jsonlPath?: string;
|
|
366
|
+
artifactPaths?: ArtifactPaths;
|
|
367
|
+
transcriptWriter?: ChildTranscriptWriter;
|
|
368
|
+
attemptNotes: string[];
|
|
369
|
+
outputSnapshot?: SingleOutputSnapshot;
|
|
370
|
+
originalTask?: string;
|
|
371
|
+
taskDelivery?: SubagentTaskDelivery;
|
|
372
|
+
orcaProgressTab?: OrcaProgressTab;
|
|
373
|
+
launchWarnings: { emitted: boolean };
|
|
374
|
+
verifyModel: boolean;
|
|
375
|
+
},
|
|
376
|
+
): Promise<SingleResult> {
|
|
377
|
+
const effectiveThinking = options.thinkingOverride ?? agent.thinking;
|
|
378
|
+
const modelArg = applyThinkingSuffix(model, effectiveThinking, options.thinkingOverride !== undefined);
|
|
379
|
+
assertThinkingWithinCeiling({ model: modelArg, configThinking: effectiveThinking, ceiling: options.thinkingCeiling, agent: agent.name, runId: options.runId });
|
|
380
|
+
const expectedModelForVerification = shared.verifyModel ? modelArg : undefined;
|
|
381
|
+
const resolvedThinking = resolveEffectiveThinking(modelArg, effectiveThinking);
|
|
382
|
+
// Display name for the child session: applied inside the child via
|
|
383
|
+
// PI_SUBAGENT_SESSION_NAME and echoed back on the result payload so hosts
|
|
384
|
+
// can label this run without reading the child's session file.
|
|
385
|
+
const childSessionName = deriveChildSessionName({ agent: agent.name, task: shared.originalTask ?? task });
|
|
386
|
+
const watchdogConfig = resolveWatchdogConfig(options.cwd ?? runtimeCwd);
|
|
387
|
+
const childWatchdog = watchdogConfig.ok
|
|
388
|
+
? resolveChildWatchdogConfig({
|
|
389
|
+
config: watchdogConfig.config,
|
|
390
|
+
agent: agent.name,
|
|
391
|
+
runId: options.runId,
|
|
392
|
+
childIndex: options.index ?? 0,
|
|
393
|
+
})
|
|
394
|
+
: undefined;
|
|
395
|
+
const permissionRules = resolvePermissionRules(options.permissions, agent.permissions);
|
|
396
|
+
const permissionAuditPath = permissionRules && options.artifactsDir
|
|
397
|
+
? path.join(options.artifactsDir, "permission-audit", `${options.runId}-${options.index ?? 0}.jsonl`)
|
|
398
|
+
: undefined;
|
|
399
|
+
const { args, env: sharedEnv, tempDir, toolDiagnosticPath, runtimeAcknowledgedExtensionsPath, capabilityAudit, warnings } = buildPiArgs({
|
|
400
|
+
baseArgs: ["--mode", "json", "-p"],
|
|
401
|
+
task,
|
|
402
|
+
taskDelivery: shared.taskDelivery,
|
|
403
|
+
sessionEnabled: shared.sessionEnabled,
|
|
404
|
+
sessionDir: options.sessionDir,
|
|
405
|
+
sessionFile: options.sessionFile,
|
|
406
|
+
model: modelArg,
|
|
407
|
+
thinking: effectiveThinking,
|
|
408
|
+
systemPromptMode: agent.systemPromptMode,
|
|
409
|
+
inheritProjectContext: agent.inheritProjectContext,
|
|
410
|
+
inheritGlobalContext: agent.inheritGlobalContext,
|
|
411
|
+
inheritSkills: agent.inheritSkills,
|
|
412
|
+
requireReadTool: Boolean(shared.resolvedSkillNames?.length),
|
|
413
|
+
tools: agent.tools,
|
|
414
|
+
excludeTools: agent.excludeTools,
|
|
415
|
+
allowNestedSubagents: agent.allowNestedSubagents,
|
|
416
|
+
extensions: agent.extensions,
|
|
417
|
+
subagentOnlyExtensions: agent.subagentOnlyExtensions,
|
|
418
|
+
systemPrompt: shared.systemPrompt,
|
|
419
|
+
mcpDirectTools: agent.mcpDirectTools,
|
|
420
|
+
cwd: options.cwd ?? runtimeCwd,
|
|
421
|
+
promptFileStem: agent.name,
|
|
422
|
+
intercomSessionName: options.intercomSessionName,
|
|
423
|
+
sessionName: childSessionName,
|
|
424
|
+
orchestratorIntercomTarget: options.orchestratorIntercomTarget,
|
|
425
|
+
runId: options.runId,
|
|
426
|
+
childAgentName: agent.name,
|
|
427
|
+
childIndex: options.index ?? 0,
|
|
428
|
+
parentEventSink: options.nestedRoute?.eventSink,
|
|
429
|
+
parentControlInbox: options.nestedRoute?.controlInbox,
|
|
430
|
+
parentRootRunId: options.nestedRoute?.rootRunId,
|
|
431
|
+
parentCapabilityToken: options.nestedRoute?.capabilityToken,
|
|
432
|
+
runFanoutBudget: options.runFanoutBudget,
|
|
433
|
+
parentSessionId: options.parentSessionId,
|
|
434
|
+
forkCacheKey: options.context === "fork" ? deriveForkPromptCacheKey(options.parentSessionId) : undefined,
|
|
435
|
+
steerInboxDir: options.steerInboxDir,
|
|
436
|
+
steerCapabilityPath: options.steerCapabilityPath,
|
|
437
|
+
steerAckDir: options.steerAckDir,
|
|
438
|
+
structuredOutput: options.structuredOutput,
|
|
439
|
+
fast: options.fast ?? agent.fast,
|
|
440
|
+
modelCandidates: shared.modelCandidates,
|
|
441
|
+
toolBudget: options.toolBudget,
|
|
442
|
+
allowZeroToolBudget: options.allowZeroToolBudget,
|
|
443
|
+
permissionRules,
|
|
444
|
+
permissionAuditPath,
|
|
445
|
+
childWatchdog,
|
|
446
|
+
waitToolEnabled: options.waitToolEnabled,
|
|
447
|
+
waitToolDefaultTimeoutMs: options.waitToolDefaultTimeoutMs,
|
|
448
|
+
capabilityCeiling: options.capabilityCeiling,
|
|
449
|
+
thinkingCeiling: options.thinkingCeiling,
|
|
450
|
+
extensionBindings: options.extensionBindings,
|
|
451
|
+
runtimeSnapshotHost: options.runtimeSnapshotHost,
|
|
452
|
+
});
|
|
453
|
+
if (!shared.launchWarnings.emitted && warnings.length > 0) {
|
|
454
|
+
for (const warning of warnings) console.warn(`[pi-subagents] ${warning}`);
|
|
455
|
+
shared.launchWarnings.emitted = true;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
const effectiveSystemPrompt = shared.systemPrompt;
|
|
459
|
+
const toolPlan = resolvePiLaunchToolPlan({
|
|
460
|
+
tools: agent.tools,
|
|
461
|
+
allowNestedSubagents: agent.allowNestedSubagents,
|
|
462
|
+
extensions: agent.extensions,
|
|
463
|
+
subagentOnlyExtensions: agent.subagentOnlyExtensions,
|
|
464
|
+
mcpDirectTools: agent.mcpDirectTools,
|
|
465
|
+
cwd: options.cwd ?? runtimeCwd,
|
|
466
|
+
requireReadTool: Boolean(shared.resolvedSkillNames?.length),
|
|
467
|
+
structuredOutput: Boolean(options.structuredOutput),
|
|
468
|
+
excludeTools: agent.excludeTools,
|
|
469
|
+
fast: options.fast ?? agent.fast,
|
|
470
|
+
model: modelArg,
|
|
471
|
+
modelCandidates: shared.modelCandidates,
|
|
472
|
+
capabilityCeiling: options.capabilityCeiling,
|
|
473
|
+
inheritedCapabilityCeiling: decodeSubagentCapabilityCeiling(process.env[SUBAGENT_CAPABILITY_CEILING_ENV]),
|
|
474
|
+
agentName: agent.name,
|
|
475
|
+
permissionRules,
|
|
476
|
+
runtimeSnapshotHost: options.runtimeSnapshotHost,
|
|
477
|
+
});
|
|
478
|
+
const contractTools = toolPlan.explicitToolAllowlist ? toolPlan.effectiveToolAllowlist : undefined;
|
|
479
|
+
const contractError = validateImplementationToolContract({
|
|
480
|
+
agent: agent.name,
|
|
481
|
+
task: shared.originalTask ?? task,
|
|
482
|
+
tools: contractTools,
|
|
483
|
+
mcpDirectTools: toolPlan.effectiveMcpTools,
|
|
484
|
+
configuredExtensions: toolPlan.configuredExtensions,
|
|
485
|
+
requestedTools: toolPlan.requestedBuiltinTools,
|
|
486
|
+
acceptanceRole: agent.acceptanceRole,
|
|
487
|
+
completionGuard: agent.completionGuard,
|
|
488
|
+
});
|
|
489
|
+
if (contractError) {
|
|
490
|
+
cleanupTempDir(tempDir);
|
|
491
|
+
return {
|
|
492
|
+
index: options.index ?? 0,
|
|
493
|
+
agent: agent.name,
|
|
494
|
+
task,
|
|
495
|
+
...(childSessionName ? { sessionName: childSessionName } : {}),
|
|
496
|
+
messages: [],
|
|
497
|
+
finalOutput: "",
|
|
498
|
+
exitCode: 1,
|
|
499
|
+
error: contractError,
|
|
500
|
+
usage: emptyUsage(),
|
|
501
|
+
model: modelArg,
|
|
502
|
+
modelAttempts: [],
|
|
503
|
+
attemptedModels: [],
|
|
504
|
+
progressSummary: { status: "failed", toolCount: 0, tokens: 0, durationMs: 0 },
|
|
505
|
+
...(toolPlan.capabilityCeiling ? { capabilityCeiling: toolPlan.capabilityCeiling } : {}),
|
|
506
|
+
...(toolPlan.capabilityAudit ? { capabilityAudit: toolPlan.capabilityAudit } : {}),
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
const launchResolvedExtensions = projectLaunchResolvedChildExtensions(toolPlan);
|
|
510
|
+
const launchContractDigest = launchBindingDigest({
|
|
511
|
+
definitionDigest: agentDefinitionDigest(agent),
|
|
512
|
+
task: shared.originalTask ?? task,
|
|
513
|
+
...(modelArg ? { model: modelArg } : {}),
|
|
514
|
+
modelCandidates: shared.modelCandidates,
|
|
515
|
+
...((options.fast ?? agent.fast) !== undefined ? { fast: options.fast ?? agent.fast } : {}),
|
|
516
|
+
...(resolvedThinking ? { thinking: resolvedThinking } : {}),
|
|
517
|
+
...(options.thinkingCeiling ? { thinkingCeiling: options.thinkingCeiling } : {}),
|
|
518
|
+
systemPrompt: effectiveSystemPrompt,
|
|
519
|
+
systemPromptMode: agent.systemPromptMode,
|
|
520
|
+
inheritProjectContext: agent.inheritProjectContext,
|
|
521
|
+
inheritGlobalContext: agent.inheritGlobalContext,
|
|
522
|
+
inheritSkills: agent.inheritSkills,
|
|
523
|
+
skills: shared.resolvedSkillNames ?? [],
|
|
524
|
+
tools: toolPlan.effectiveToolAllowlist,
|
|
525
|
+
...(toolPlan.excludeTools.length > 0 ? { excludeTools: toolPlan.excludeTools } : {}),
|
|
526
|
+
extensions: toolPlan.extensionArgs,
|
|
527
|
+
mcpDirectTools: toolPlan.effectiveMcpTools,
|
|
528
|
+
...(options.outputPath ? { outputPath: options.outputPath } : {}),
|
|
529
|
+
outputMode: options.outputMode ?? "inline",
|
|
530
|
+
...(options.structuredOutput ? { structuredOutputSchema: options.structuredOutput.schema } : {}),
|
|
531
|
+
...(options.extensionBindings ? { extensionBindings: options.extensionBindings } : {}),
|
|
532
|
+
});
|
|
533
|
+
const result: SingleResult = withRunContext({
|
|
534
|
+
index: options.index ?? 0,
|
|
535
|
+
agent: agent.name,
|
|
536
|
+
task: shared.originalTask ?? task,
|
|
537
|
+
...(childSessionName ? { sessionName: childSessionName } : {}),
|
|
538
|
+
...(options.agentContract ? { agentContract: options.agentContract } : {}),
|
|
539
|
+
launchContractDigest,
|
|
540
|
+
launchResolvedExtensions,
|
|
541
|
+
exitCode: 0,
|
|
542
|
+
outputState: "absent",
|
|
543
|
+
messages: [],
|
|
544
|
+
usage: emptyUsage(),
|
|
545
|
+
model: modelArg,
|
|
546
|
+
...(resolvedThinking ? { thinking: resolvedThinking } : {}),
|
|
547
|
+
artifactPaths: shared.artifactPaths,
|
|
548
|
+
transcriptPath: shared.transcriptWriter ? shared.artifactPaths?.transcriptPath : undefined,
|
|
549
|
+
skills: shared.resolvedSkillNames,
|
|
550
|
+
skillsWarning: shared.skillsWarning,
|
|
551
|
+
...(options.toolBudget ? { toolBudget: initialToolBudgetState(options.toolBudget) } : {}),
|
|
552
|
+
...(options.capabilityCeiling ? { capabilityCeiling: options.capabilityCeiling } : {}),
|
|
553
|
+
...(capabilityAudit ? { capabilityAudit } : {}),
|
|
554
|
+
}, options.context);
|
|
555
|
+
const startTime = Date.now();
|
|
556
|
+
if (options.structuredOutput) {
|
|
557
|
+
const cleanupError = clearStructuredOutputCaptures(options.structuredOutput);
|
|
558
|
+
if (cleanupError) {
|
|
559
|
+
cleanupTempDir(tempDir);
|
|
560
|
+
result.exitCode = 1;
|
|
561
|
+
result.error = cleanupError;
|
|
562
|
+
result.finalOutput = cleanupError;
|
|
563
|
+
result.progressSummary = { toolCount: 0, tokens: 0, durationMs: Date.now() - startTime };
|
|
564
|
+
return result;
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
const controlConfig = options.controlConfig ?? DEFAULT_CONTROL_CONFIG;
|
|
568
|
+
let interruptedByControl = false;
|
|
569
|
+
const allControlEvents: ControlEvent[] = [];
|
|
570
|
+
let pendingControlEvents: ControlEvent[] = [];
|
|
571
|
+
const emittedControlEventKeys = new Set<string>();
|
|
572
|
+
const emitControlEvent = (event: ControlEvent) => {
|
|
573
|
+
if (!shouldNotifyControlEvent(controlConfig, event)) return;
|
|
574
|
+
if (!claimControlNotification(controlConfig, event, emittedControlEventKeys)) return;
|
|
575
|
+
allControlEvents.push(event);
|
|
576
|
+
pendingControlEvents.push(event);
|
|
577
|
+
options.onControlEvent?.(event);
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
const progress: AgentProgress = {
|
|
581
|
+
index: options.index ?? 0,
|
|
582
|
+
agent: agent.name,
|
|
583
|
+
...(childSessionName ? { sessionName: childSessionName } : {}),
|
|
584
|
+
status: "running",
|
|
585
|
+
task,
|
|
586
|
+
skills: shared.resolvedSkillNames,
|
|
587
|
+
recentTools: [],
|
|
588
|
+
recentOutput: [...shared.attemptNotes],
|
|
589
|
+
toolCount: 0,
|
|
590
|
+
tokens: 0,
|
|
591
|
+
...(modelArg ? { model: modelArg } : {}),
|
|
592
|
+
...(resolvedThinking ? { thinking: resolvedThinking } : {}),
|
|
593
|
+
inputTokens: 0,
|
|
594
|
+
outputTokens: 0,
|
|
595
|
+
durationMs: 0,
|
|
596
|
+
lastActivityAt: startTime,
|
|
597
|
+
};
|
|
598
|
+
result.progress = progress;
|
|
599
|
+
const attemptTimeout = resolveAttemptTimeout(options);
|
|
600
|
+
if (attemptTimeout?.remainingMs === 0) {
|
|
601
|
+
cleanupTempDir(tempDir);
|
|
602
|
+
result.exitCode = 1;
|
|
603
|
+
result.timedOut = true;
|
|
604
|
+
result.error = attemptTimeout.message;
|
|
605
|
+
result.finalOutput = attemptTimeout.message;
|
|
606
|
+
progress.status = "failed";
|
|
607
|
+
progress.error = attemptTimeout.message;
|
|
608
|
+
result.progressSummary = {
|
|
609
|
+
toolCount: progress.toolCount,
|
|
610
|
+
tokens: progress.tokens,
|
|
611
|
+
durationMs: progress.durationMs,
|
|
612
|
+
};
|
|
613
|
+
return result;
|
|
614
|
+
}
|
|
615
|
+
const spawnEnv = { ...process.env, ...sharedEnv, ...getSubagentDepthEnv(options.maxSubagentDepth) };
|
|
616
|
+
const mutationSnapshot = snapshotTrackedMutations(options.cwd ?? runtimeCwd);
|
|
617
|
+
let observedMutationAttempt = false;
|
|
618
|
+
let structuredOutputToolInvoked = false;
|
|
619
|
+
let structuredOutputMessageStartIndex: number | undefined;
|
|
620
|
+
let toolAvailabilityError: string | undefined;
|
|
621
|
+
let abortedBySignal = options.signal?.aborted === true;
|
|
622
|
+
|
|
623
|
+
const spawnSpec = getPiSpawnCommand(args);
|
|
624
|
+
if (options.workflowChildPermitLaunch) {
|
|
625
|
+
const permitError = consumeWorkflowChildPermit(options.workflowChildPermitLaunch.permit, {
|
|
626
|
+
workflowRunId: options.workflowChildPermitLaunch.workflowRunId,
|
|
627
|
+
childKey: options.workflowChildPermitLaunch.childKey,
|
|
628
|
+
agent: agent.name,
|
|
629
|
+
launchContractDigest,
|
|
630
|
+
context: options.context ?? "fresh",
|
|
631
|
+
runner: "pi",
|
|
632
|
+
});
|
|
633
|
+
if (permitError) {
|
|
634
|
+
cleanupTempDir(tempDir);
|
|
635
|
+
result.exitCode = 1;
|
|
636
|
+
result.error = permitError;
|
|
637
|
+
result.finalOutput = permitError;
|
|
638
|
+
progress.status = "failed";
|
|
639
|
+
progress.error = permitError;
|
|
640
|
+
return result;
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
let afterCompactionSettlement = false;
|
|
644
|
+
const exitCode = await new Promise<number>((resolve) => {
|
|
645
|
+
const proc = spawn(spawnSpec.command, spawnSpec.args, {
|
|
646
|
+
cwd: options.cwd ?? runtimeCwd,
|
|
647
|
+
env: spawnEnv,
|
|
648
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
649
|
+
windowsHide: true,
|
|
650
|
+
});
|
|
651
|
+
const jsonlWriter = createJsonlWriter(shared.jsonlPath, proc.stdout);
|
|
652
|
+
let processClosed = false;
|
|
653
|
+
let lifecycleFinished = false;
|
|
654
|
+
let detached = false;
|
|
655
|
+
let intercomStarted = false;
|
|
656
|
+
let assistantError: string | undefined;
|
|
657
|
+
let removeAbortListener: (() => void) | undefined;
|
|
658
|
+
let removeInterruptListener: (() => void) | undefined;
|
|
659
|
+
let activityTimer: NodeJS.Timeout | undefined;
|
|
660
|
+
let timeoutTimer: NodeJS.Timeout | undefined;
|
|
661
|
+
let timeoutTerminationTimer: NodeJS.Timeout | undefined;
|
|
662
|
+
let timeoutHardKillTimer: NodeJS.Timeout | undefined;
|
|
663
|
+
let protocolHardKillTimer: NodeJS.Timeout | undefined;
|
|
664
|
+
const clearTimeoutTimers = () => {
|
|
665
|
+
if (timeoutTimer) {
|
|
666
|
+
clearTimeout(timeoutTimer);
|
|
667
|
+
timeoutTimer = undefined;
|
|
668
|
+
}
|
|
669
|
+
if (timeoutTerminationTimer) {
|
|
670
|
+
clearTimeout(timeoutTerminationTimer);
|
|
671
|
+
timeoutTerminationTimer = undefined;
|
|
672
|
+
}
|
|
673
|
+
if (timeoutHardKillTimer) {
|
|
674
|
+
clearTimeout(timeoutHardKillTimer);
|
|
675
|
+
timeoutHardKillTimer = undefined;
|
|
676
|
+
}
|
|
677
|
+
};
|
|
678
|
+
|
|
679
|
+
const detachForeground = (reason: string): boolean => {
|
|
680
|
+
if (detached || processClosed || lifecycleFinished || options.signal?.aborted) return false;
|
|
681
|
+
const receiptProgress = snapshotProgress(progress);
|
|
682
|
+
receiptProgress.status = "detached";
|
|
683
|
+
receiptProgress.durationMs = Date.now() - startTime;
|
|
684
|
+
const receipt = snapshotResult(result, receiptProgress);
|
|
685
|
+
receipt.exitCode = -2;
|
|
686
|
+
receipt.detached = true;
|
|
687
|
+
receipt.detachedReason = reason;
|
|
688
|
+
receipt.finalOutput = reason === "intercom coordination"
|
|
689
|
+
? "Detached for intercom coordination before task completion."
|
|
690
|
+
: reason === "user request"
|
|
691
|
+
? "Detached at user request before task completion."
|
|
692
|
+
: `Detached for ${reason} before task completion.`;
|
|
693
|
+
receipt.outputMode = options.outputMode ?? "inline";
|
|
694
|
+
if (options.outputPath) {
|
|
695
|
+
receipt.outputSaveError = reason === "user request"
|
|
696
|
+
? "Output file was not finalized because the subagent detached at user request."
|
|
697
|
+
: `Output file was not finalized because the subagent detached for ${reason}.`;
|
|
698
|
+
}
|
|
699
|
+
receipt.progressSummary = {
|
|
700
|
+
toolCount: receiptProgress.toolCount,
|
|
701
|
+
tokens: receiptProgress.tokens,
|
|
702
|
+
durationMs: receiptProgress.durationMs,
|
|
703
|
+
};
|
|
704
|
+
// The attempt is not detached until the outer coordinator has accepted and
|
|
705
|
+
// synchronously published the receipt. A persistence/callback failure must
|
|
706
|
+
// leave this attempt attached and abortable rather than orphaning it.
|
|
707
|
+
let accepted = false;
|
|
708
|
+
try {
|
|
709
|
+
accepted = options.onDetachReceipt?.(receipt) === true;
|
|
710
|
+
} catch {
|
|
711
|
+
return false;
|
|
712
|
+
}
|
|
713
|
+
if (!accepted) return false;
|
|
714
|
+
detached = true;
|
|
715
|
+
return true;
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
// If the child emits a terminal assistant stop but never exits,
|
|
719
|
+
// give it a short grace period to flush naturally, then clean it up.
|
|
720
|
+
const FINAL_STOP_GRACE_MS = 1000;
|
|
721
|
+
const HARD_KILL_MS = 3000;
|
|
722
|
+
let childExited = false;
|
|
723
|
+
let forcedTerminationSignal = false;
|
|
724
|
+
let cleanTerminalAssistantStopReceived = false;
|
|
725
|
+
let agentSettledReceived = false;
|
|
726
|
+
let compactionStartedReceived = false;
|
|
727
|
+
let finalDrainTimer: NodeJS.Timeout | undefined;
|
|
728
|
+
let finalHardKillTimer: NodeJS.Timeout | undefined;
|
|
729
|
+
let watchdogTailTimer: NodeJS.Timeout | undefined;
|
|
730
|
+
let childWatchdogState: ChildWatchdogStateSnapshot | undefined;
|
|
731
|
+
const updateChildWatchdogState = (snapshot: ChildWatchdogStateSnapshot): void => {
|
|
732
|
+
childWatchdogState = snapshot;
|
|
733
|
+
result.watchdog = snapshot;
|
|
734
|
+
progress.watchdog = snapshot;
|
|
735
|
+
};
|
|
736
|
+
const clearWatchdogTailTimer = () => {
|
|
737
|
+
if (watchdogTailTimer) {
|
|
738
|
+
clearTimeout(watchdogTailTimer);
|
|
739
|
+
watchdogTailTimer = undefined;
|
|
740
|
+
}
|
|
741
|
+
};
|
|
742
|
+
const clearFinalDrainTimers = () => {
|
|
743
|
+
if (finalDrainTimer) {
|
|
744
|
+
clearTimeout(finalDrainTimer);
|
|
745
|
+
finalDrainTimer = undefined;
|
|
746
|
+
}
|
|
747
|
+
if (finalHardKillTimer) {
|
|
748
|
+
clearTimeout(finalHardKillTimer);
|
|
749
|
+
finalHardKillTimer = undefined;
|
|
750
|
+
}
|
|
751
|
+
};
|
|
752
|
+
const startFinalDrain = () => {
|
|
753
|
+
if (childWatchdogIsActive(childWatchdogState)) {
|
|
754
|
+
armWatchdogTail();
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
757
|
+
if (childExited || finalDrainTimer || lifecycleFinished || processClosed) return;
|
|
758
|
+
finalDrainTimer = setTimeout(() => {
|
|
759
|
+
if (lifecycleFinished || processClosed) return;
|
|
760
|
+
const termSent = trySignalChild(proc, "SIGTERM");
|
|
761
|
+
if (!termSent) return;
|
|
762
|
+
forcedTerminationSignal = true;
|
|
763
|
+
if (!cleanTerminalAssistantStopReceived && !agentSettledReceived && !assistantError) {
|
|
764
|
+
result.error = result.error ?? `Subagent process did not exit within ${FINAL_STOP_GRACE_MS}ms after its terminal event. Forcing termination.`;
|
|
765
|
+
}
|
|
766
|
+
finalHardKillTimer = setTimeout(() => {
|
|
767
|
+
if (lifecycleFinished || processClosed) return;
|
|
768
|
+
forcedTerminationSignal = trySignalChild(proc, "SIGKILL") || forcedTerminationSignal;
|
|
769
|
+
}, HARD_KILL_MS);
|
|
770
|
+
finalHardKillTimer.unref?.();
|
|
771
|
+
}, FINAL_STOP_GRACE_MS);
|
|
772
|
+
finalDrainTimer.unref?.();
|
|
773
|
+
};
|
|
774
|
+
function armWatchdogTail(): void {
|
|
775
|
+
if ((!cleanTerminalAssistantStopReceived && !agentSettledReceived) || watchdogTailTimer || lifecycleFinished || processClosed) return;
|
|
776
|
+
watchdogTailTimer = setTimeout(() => {
|
|
777
|
+
watchdogTailTimer = undefined;
|
|
778
|
+
updateChildWatchdogState({
|
|
779
|
+
phase: "stale",
|
|
780
|
+
seq: (childWatchdogState?.seq ?? 0) + 1,
|
|
781
|
+
lastUpdate: Date.now(),
|
|
782
|
+
followUpPending: false,
|
|
783
|
+
reason: "child watchdog tail timeout",
|
|
784
|
+
timedOut: true,
|
|
785
|
+
});
|
|
786
|
+
startFinalDrain();
|
|
787
|
+
fireUpdate();
|
|
788
|
+
}, childWatchdog?.watchdogTailTimeoutMs ?? 120_000);
|
|
789
|
+
watchdogTailTimer.unref?.();
|
|
790
|
+
}
|
|
791
|
+
const applyChildLifecycle = (action: ChildLifecycleAction): void => {
|
|
792
|
+
if (action === "cancel-drain") {
|
|
793
|
+
clearFinalDrainTimers();
|
|
794
|
+
clearWatchdogTailTimer();
|
|
795
|
+
return;
|
|
796
|
+
}
|
|
797
|
+
if (action === "start-drain") startFinalDrain();
|
|
798
|
+
};
|
|
799
|
+
const childLifecycleState: ChildLifecycleState = { compactionRetryActive: false };
|
|
800
|
+
|
|
801
|
+
const unsubscribeIntercomDetach = options.intercomEvents?.on?.(INTERCOM_DETACH_REQUEST_EVENT, (payload) => {
|
|
802
|
+
if (!options.allowIntercomDetach || processClosed) return;
|
|
803
|
+
if (!payload || typeof payload !== "object") return;
|
|
804
|
+
const event = payload as { requestId?: unknown; runId?: unknown; agent?: unknown; childIndex?: unknown };
|
|
805
|
+
const requestId = event.requestId;
|
|
806
|
+
if (typeof requestId !== "string" || requestId.length === 0) return;
|
|
807
|
+
const hasRoute = event.runId !== undefined || event.agent !== undefined || event.childIndex !== undefined;
|
|
808
|
+
if (hasRoute) {
|
|
809
|
+
if (typeof event.runId === "string" && event.runId !== options.runId) return;
|
|
810
|
+
if (typeof event.agent === "string" && event.agent !== agent.name) return;
|
|
811
|
+
if (typeof event.childIndex === "number" && event.childIndex !== (options.index ?? 0)) return;
|
|
812
|
+
} else if (!intercomStarted) return;
|
|
813
|
+
const accepted = detachForeground("intercom coordination");
|
|
814
|
+
options.intercomEvents?.emit(INTERCOM_DETACH_RESPONSE_EVENT, { requestId, accepted, runId: options.runId, agent: agent.name, childIndex: options.index ?? 0 });
|
|
815
|
+
});
|
|
816
|
+
|
|
817
|
+
const finish = (code: number) => {
|
|
818
|
+
if (lifecycleFinished) return;
|
|
819
|
+
lifecycleFinished = true;
|
|
820
|
+
clearFinalDrainTimers();
|
|
821
|
+
clearWatchdogTailTimer();
|
|
822
|
+
clearStdioGuard();
|
|
823
|
+
clearTimeoutTimers();
|
|
824
|
+
clearAllToolTimeouts();
|
|
825
|
+
if (protocolHardKillTimer) {
|
|
826
|
+
clearTimeout(protocolHardKillTimer);
|
|
827
|
+
protocolHardKillTimer = undefined;
|
|
828
|
+
}
|
|
829
|
+
if (activityTimer) {
|
|
830
|
+
clearInterval(activityTimer);
|
|
831
|
+
activityTimer = undefined;
|
|
832
|
+
}
|
|
833
|
+
unsubscribeIntercomDetach?.();
|
|
834
|
+
removeAbortListener?.();
|
|
835
|
+
removeInterruptListener?.();
|
|
836
|
+
resolve(code);
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
const drainPendingControlEvents = (): ControlEvent[] | undefined => {
|
|
840
|
+
if (pendingControlEvents.length === 0) return undefined;
|
|
841
|
+
const events = pendingControlEvents;
|
|
842
|
+
pendingControlEvents = [];
|
|
843
|
+
return events;
|
|
844
|
+
};
|
|
845
|
+
|
|
846
|
+
let activeLongRunningNotified = false;
|
|
847
|
+
let pendingToolResult: { tool: string; path?: string; mutates: boolean; startedAt?: number } | undefined;
|
|
848
|
+
type ActiveToolCall = { key: string; tool: string; args: string; startedAt: number; path?: string };
|
|
849
|
+
let activeToolSequence = 0;
|
|
850
|
+
const activeToolCalls = new Map<string, ActiveToolCall>();
|
|
851
|
+
const activeToolKeysByName = new Map<string, string[]>();
|
|
852
|
+
const latestActiveToolCall = (): ActiveToolCall | undefined => [...activeToolCalls.values()].sort((left, right) => right.startedAt - left.startedAt)[0];
|
|
853
|
+
const refreshCurrentTool = (): void => {
|
|
854
|
+
const active = latestActiveToolCall();
|
|
855
|
+
if (!active) {
|
|
856
|
+
progress.currentTool = undefined;
|
|
857
|
+
progress.currentToolArgs = undefined;
|
|
858
|
+
progress.currentToolStartedAt = undefined;
|
|
859
|
+
progress.currentPath = undefined;
|
|
860
|
+
return;
|
|
861
|
+
}
|
|
862
|
+
progress.currentTool = active.tool;
|
|
863
|
+
progress.currentToolArgs = active.args;
|
|
864
|
+
progress.currentToolStartedAt = active.startedAt;
|
|
865
|
+
progress.currentPath = active.path;
|
|
866
|
+
};
|
|
867
|
+
const recordActiveToolCall = (event: { toolCallId?: unknown; toolName: string }, args: Record<string, unknown>, now: number): ActiveToolCall => {
|
|
868
|
+
const key = toolTimeoutCallKey(event, ++activeToolSequence);
|
|
869
|
+
const path = resolveCurrentPath(event.toolName, args);
|
|
870
|
+
const active: ActiveToolCall = {
|
|
871
|
+
key,
|
|
872
|
+
tool: event.toolName,
|
|
873
|
+
args: extractToolArgsPreview(args),
|
|
874
|
+
startedAt: now,
|
|
875
|
+
...(path !== undefined ? { path } : {}),
|
|
876
|
+
};
|
|
877
|
+
activeToolCalls.set(key, active);
|
|
878
|
+
const keys = activeToolKeysByName.get(active.tool) ?? [];
|
|
879
|
+
keys.push(key);
|
|
880
|
+
activeToolKeysByName.set(active.tool, keys);
|
|
881
|
+
refreshCurrentTool();
|
|
882
|
+
return active;
|
|
883
|
+
};
|
|
884
|
+
const removeActiveToolCallKey = (key: string): ActiveToolCall | undefined => {
|
|
885
|
+
const active = activeToolCalls.get(key);
|
|
886
|
+
if (!active) return undefined;
|
|
887
|
+
activeToolCalls.delete(key);
|
|
888
|
+
const keys = activeToolKeysByName.get(active.tool)?.filter((candidate) => candidate !== key) ?? [];
|
|
889
|
+
if (keys.length > 0) activeToolKeysByName.set(active.tool, keys);
|
|
890
|
+
else activeToolKeysByName.delete(active.tool);
|
|
891
|
+
return active;
|
|
892
|
+
};
|
|
893
|
+
const removeActiveToolCall = (event: { toolCallId?: unknown; toolName?: unknown }): ActiveToolCall | undefined => {
|
|
894
|
+
const key = typeof event.toolCallId === "string" && event.toolCallId.length > 0
|
|
895
|
+
? `id:${event.toolCallId}`
|
|
896
|
+
: typeof event.toolName === "string"
|
|
897
|
+
? activeToolKeysByName.get(event.toolName)?.[0]
|
|
898
|
+
: activeToolCalls.size === 1
|
|
899
|
+
? [...activeToolCalls.keys()][0]
|
|
900
|
+
: undefined;
|
|
901
|
+
return key ? removeActiveToolCallKey(key) : undefined;
|
|
902
|
+
};
|
|
903
|
+
const openToolAttentionTarget = (now: number): ActiveToolCall | undefined => [...activeToolCalls.values()]
|
|
904
|
+
.filter((active) => shouldEmitOpenToolAttention({ config: controlConfig, currentTool: active.tool, currentToolStartedAt: active.startedAt, now }))
|
|
905
|
+
.sort((left, right) => left.startedAt - right.startedAt)[0];
|
|
906
|
+
const mutatingFailures = createMutatingFailureState();
|
|
907
|
+
const mutatingFailureWindowMs = 5 * 60_000;
|
|
908
|
+
const currentToolDurationMs = (now: number) => progress.currentToolStartedAt ? Math.max(0, now - progress.currentToolStartedAt) : undefined;
|
|
909
|
+
const emitNeedsAttention = (now: number, input: { message?: string; reason?: ControlEvent["reason"]; recentFailureSummary?: string; currentTool?: string; currentPath?: string; currentToolDurationMs?: number } = {}): boolean => {
|
|
910
|
+
if (!controlConfig.enabled) return false;
|
|
911
|
+
const previous = progress.activityState;
|
|
912
|
+
progress.activityState = "needs_attention";
|
|
913
|
+
const event = buildControlEvent({
|
|
914
|
+
type: "needs_attention",
|
|
915
|
+
from: previous,
|
|
916
|
+
to: "needs_attention",
|
|
917
|
+
runId: options.runId,
|
|
918
|
+
agent: agent.name,
|
|
919
|
+
index: options.index,
|
|
920
|
+
ts: now,
|
|
921
|
+
lastActivityAt: progress.lastActivityAt,
|
|
922
|
+
message: input.message,
|
|
923
|
+
reason: input.reason ?? "idle",
|
|
924
|
+
turns: result.usage.turns,
|
|
925
|
+
tokens: progress.tokens,
|
|
926
|
+
toolCount: progress.toolCount,
|
|
927
|
+
currentTool: input.currentTool ?? progress.currentTool,
|
|
928
|
+
currentToolDurationMs: input.currentToolDurationMs ?? currentToolDurationMs(now),
|
|
929
|
+
currentPath: input.currentPath ?? progress.currentPath,
|
|
930
|
+
recentFailureSummary: input.recentFailureSummary,
|
|
931
|
+
taskPreview: task,
|
|
932
|
+
});
|
|
933
|
+
emitControlEvent(event);
|
|
934
|
+
return previous !== "needs_attention";
|
|
935
|
+
};
|
|
936
|
+
const emitActiveLongRunning = (now: number, reason: ControlEvent["reason"]): boolean => {
|
|
937
|
+
if (!controlConfig.enabled || activeLongRunningNotified || progress.activityState === "needs_attention") return false;
|
|
938
|
+
activeLongRunningNotified = true;
|
|
939
|
+
const previous = progress.activityState;
|
|
940
|
+
progress.activityState = "active_long_running";
|
|
941
|
+
emitControlEvent(buildControlEvent({
|
|
942
|
+
type: "active_long_running",
|
|
943
|
+
from: previous,
|
|
944
|
+
to: "active_long_running",
|
|
945
|
+
runId: options.runId,
|
|
946
|
+
agent: agent.name,
|
|
947
|
+
index: options.index,
|
|
948
|
+
ts: now,
|
|
949
|
+
message: `${agent.name} is still active but long-running`,
|
|
950
|
+
reason,
|
|
951
|
+
turns: result.usage.turns,
|
|
952
|
+
tokens: progress.tokens,
|
|
953
|
+
toolCount: progress.toolCount,
|
|
954
|
+
currentTool: progress.currentTool,
|
|
955
|
+
currentToolDurationMs: currentToolDurationMs(now),
|
|
956
|
+
currentPath: progress.currentPath,
|
|
957
|
+
elapsedMs: now - startTime,
|
|
958
|
+
taskPreview: task,
|
|
959
|
+
}));
|
|
960
|
+
return true;
|
|
961
|
+
};
|
|
962
|
+
const updateActivityState = (now: number): boolean => {
|
|
963
|
+
if (!controlConfig.enabled) return false;
|
|
964
|
+
const idleState = deriveActivityState({
|
|
965
|
+
config: controlConfig,
|
|
966
|
+
startedAt: startTime,
|
|
967
|
+
lastActivityAt: progress.lastActivityAt,
|
|
968
|
+
currentTool: progress.currentTool,
|
|
969
|
+
thinking: resolvedThinking,
|
|
970
|
+
now,
|
|
971
|
+
});
|
|
972
|
+
if (idleState === "needs_attention") {
|
|
973
|
+
return progress.activityState === "needs_attention" ? false : emitNeedsAttention(now);
|
|
974
|
+
}
|
|
975
|
+
const toolAttentionTarget = progress.activityState !== "needs_attention" ? openToolAttentionTarget(now) : undefined;
|
|
976
|
+
if (toolAttentionTarget) {
|
|
977
|
+
const durationMs = Math.max(0, now - toolAttentionTarget.startedAt);
|
|
978
|
+
return emitNeedsAttention(now, {
|
|
979
|
+
message: `${agent.name} has had tool '${toolAttentionTarget.tool}' open for ${Math.floor(durationMs / 1000)}s`,
|
|
980
|
+
reason: "tool_open_threshold",
|
|
981
|
+
currentTool: toolAttentionTarget.tool,
|
|
982
|
+
currentPath: toolAttentionTarget.path,
|
|
983
|
+
currentToolDurationMs: durationMs,
|
|
984
|
+
});
|
|
985
|
+
}
|
|
986
|
+
const activeReason = nextLongRunningTrigger(controlConfig, {
|
|
987
|
+
startedAt: startTime,
|
|
988
|
+
now,
|
|
989
|
+
turns: result.usage.turns,
|
|
990
|
+
tokens: progress.tokens,
|
|
991
|
+
});
|
|
992
|
+
return activeReason ? emitActiveLongRunning(now, activeReason) : false;
|
|
993
|
+
};
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
let lastStructuredDelegationProgressState: StructuredDelegationProgressState | undefined;
|
|
997
|
+
const emitUpdateSnapshot = (text: string) => {
|
|
998
|
+
if (!options.onUpdate || processClosed) return;
|
|
999
|
+
const progressSnapshot = snapshotProgress(progress);
|
|
1000
|
+
const resultSnapshot = snapshotStreamResult(result, progressSnapshot);
|
|
1001
|
+
const controlEvents = drainPendingControlEvents();
|
|
1002
|
+
options.onUpdate({
|
|
1003
|
+
content: [{ type: "text", text }],
|
|
1004
|
+
details: {
|
|
1005
|
+
mode: "single",
|
|
1006
|
+
results: [resultSnapshot],
|
|
1007
|
+
progress: [progressSnapshot],
|
|
1008
|
+
controlEvents,
|
|
1009
|
+
},
|
|
1010
|
+
});
|
|
1011
|
+
};
|
|
1012
|
+
|
|
1013
|
+
const fireUpdate = () => {
|
|
1014
|
+
if (!options.onUpdate || processClosed) return;
|
|
1015
|
+
progress.durationMs = Date.now() - startTime;
|
|
1016
|
+
if (options.suppressUnchangedDelegationUpdates) {
|
|
1017
|
+
if (lastStructuredDelegationProgressState && !structuredDelegationProgressChanged(lastStructuredDelegationProgressState, progress, result)) return;
|
|
1018
|
+
lastStructuredDelegationProgressState = captureStructuredDelegationProgressState(progress, result);
|
|
1019
|
+
}
|
|
1020
|
+
const output = result.timedOut && result.finalOutput ? result.finalOutput : getFinalOutput(result.messages ?? []);
|
|
1021
|
+
emitUpdateSnapshot(output || "(running...)");
|
|
1022
|
+
};
|
|
1023
|
+
|
|
1024
|
+
const rawStdoutTail = createBoundedByteTail();
|
|
1025
|
+
const processLine = (line: string) => {
|
|
1026
|
+
if (!line.trim()) return;
|
|
1027
|
+
jsonlWriter.writeLine(line);
|
|
1028
|
+
let evt: { type?: string; message?: Message; toolName?: string; toolCallId?: string; args?: unknown; willRetry?: unknown };
|
|
1029
|
+
try {
|
|
1030
|
+
evt = JSON.parse(line) as { type?: string; message?: Message; toolName?: string; toolCallId?: string; args?: unknown; willRetry?: unknown };
|
|
1031
|
+
} catch {
|
|
1032
|
+
rawStdoutTail.push(`${line}\n`);
|
|
1033
|
+
shared.transcriptWriter?.writeStdoutLine(line);
|
|
1034
|
+
shared.orcaProgressTab?.append(`${line}\n`);
|
|
1035
|
+
// Non-JSON stdout lines are expected; only structured events are parsed.
|
|
1036
|
+
return;
|
|
1037
|
+
}
|
|
1038
|
+
shared.transcriptWriter?.writeChildEvent(evt);
|
|
1039
|
+
shared.orcaProgressTab?.event(evt);
|
|
1040
|
+
if (evt.type === "compaction_start") compactionStartedReceived = true;
|
|
1041
|
+
if (evt.type === "compaction_end" && evt.willRetry === true) {
|
|
1042
|
+
compactionStartedReceived = false;
|
|
1043
|
+
afterCompactionSettlement = false;
|
|
1044
|
+
}
|
|
1045
|
+
if (evt.type === "agent_start" || evt.type === "auto_retry_start") {
|
|
1046
|
+
compactionStartedReceived = false;
|
|
1047
|
+
afterCompactionSettlement = false;
|
|
1048
|
+
}
|
|
1049
|
+
const lifecycleAction = projectChildLifecycle(evt, false, childLifecycleState);
|
|
1050
|
+
if (evt.type === "agent_settled" && lifecycleAction === "start-drain") {
|
|
1051
|
+
agentSettledReceived = true;
|
|
1052
|
+
afterCompactionSettlement = compactionStartedReceived;
|
|
1053
|
+
}
|
|
1054
|
+
applyChildLifecycle(lifecycleAction);
|
|
1055
|
+
|
|
1056
|
+
if (isChildWatchdogStatusEvent(evt)) {
|
|
1057
|
+
if (!childWatchdog) return;
|
|
1058
|
+
const next = acceptChildWatchdogEvent({
|
|
1059
|
+
current: childWatchdogState,
|
|
1060
|
+
event: evt,
|
|
1061
|
+
runId: options.runId,
|
|
1062
|
+
agent: agent.name,
|
|
1063
|
+
childIndex: options.index ?? 0,
|
|
1064
|
+
});
|
|
1065
|
+
if (!next) return;
|
|
1066
|
+
updateChildWatchdogState(next);
|
|
1067
|
+
if (childWatchdogIsActive(next)) {
|
|
1068
|
+
clearFinalDrainTimers();
|
|
1069
|
+
armWatchdogTail();
|
|
1070
|
+
} else {
|
|
1071
|
+
clearWatchdogTailTimer();
|
|
1072
|
+
if (cleanTerminalAssistantStopReceived || agentSettledReceived) startFinalDrain();
|
|
1073
|
+
}
|
|
1074
|
+
fireUpdate();
|
|
1075
|
+
return;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
const now = Date.now();
|
|
1079
|
+
progress.durationMs = now - startTime;
|
|
1080
|
+
progress.lastActivityAt = now;
|
|
1081
|
+
updateActivityState(now);
|
|
1082
|
+
|
|
1083
|
+
if (evt.type === "tool_execution_start") {
|
|
1084
|
+
const toolArgs = evt.args && typeof evt.args === "object" && !Array.isArray(evt.args)
|
|
1085
|
+
? evt.args as Record<string, unknown>
|
|
1086
|
+
: {};
|
|
1087
|
+
const activeTool = evt.toolName !== undefined ? recordActiveToolCall(evt as { toolCallId?: unknown; toolName: string }, toolArgs, now) : undefined;
|
|
1088
|
+
if (evt.toolName !== undefined) armToolTimeout(evt as { toolCallId?: unknown; toolName: string });
|
|
1089
|
+
if (options.structuredOutput && evt.toolName === "structured_output") {
|
|
1090
|
+
structuredOutputToolInvoked = true;
|
|
1091
|
+
structuredOutputMessageStartIndex = result.messages?.length ?? 0;
|
|
1092
|
+
}
|
|
1093
|
+
if (options.allowIntercomDetach && (evt.toolName === "intercom" || evt.toolName === "contact_supervisor")) {
|
|
1094
|
+
intercomStarted = true;
|
|
1095
|
+
}
|
|
1096
|
+
progress.toolCount++;
|
|
1097
|
+
if (options.toolBudget) {
|
|
1098
|
+
result.toolBudget = toolBudgetState(options.toolBudget, progress.toolCount);
|
|
1099
|
+
}
|
|
1100
|
+
const mutates = isMutatingTool(evt.toolName, toolArgs, agent.mutationTools);
|
|
1101
|
+
observedMutationAttempt = observedMutationAttempt || mutates;
|
|
1102
|
+
pendingToolResult = { tool: evt.toolName ?? "tool", path: activeTool?.path, mutates, startedAt: now };
|
|
1103
|
+
fireUpdate();
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
if (evt.type === "tool_execution_end") {
|
|
1107
|
+
clearActiveToolTimeout(evt);
|
|
1108
|
+
const endedTool = removeActiveToolCall(evt);
|
|
1109
|
+
if (endedTool) {
|
|
1110
|
+
progress.recentTools.push({
|
|
1111
|
+
tool: endedTool.tool,
|
|
1112
|
+
args: endedTool.args,
|
|
1113
|
+
endMs: now,
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
refreshCurrentTool();
|
|
1117
|
+
fireUpdate();
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
if (evt.type === "message_end" && evt.message) {
|
|
1121
|
+
result.messages!.push(evt.message);
|
|
1122
|
+
if (evt.message.role === "assistant") {
|
|
1123
|
+
result.usage.turns++;
|
|
1124
|
+
progress.turnCount = result.usage.turns;
|
|
1125
|
+
const toolCalls = Array.isArray(evt.message.content)
|
|
1126
|
+
? evt.message.content.filter((part) => (part as { type?: string }).type === "toolCall")
|
|
1127
|
+
: [];
|
|
1128
|
+
const hasToolCall = toolCalls.length > 0;
|
|
1129
|
+
const terminalAssistantStop = (evt.message as { stopReason?: string }).stopReason === "stop" && !hasToolCall;
|
|
1130
|
+
const u = evt.message.usage;
|
|
1131
|
+
if (u) {
|
|
1132
|
+
const window = (u.input || 0) + (u.cacheRead || 0);
|
|
1133
|
+
result.usage.input += u.input || 0;
|
|
1134
|
+
result.usage.output += u.output || 0;
|
|
1135
|
+
result.usage.cacheRead += u.cacheRead || 0;
|
|
1136
|
+
result.usage.cacheWrite += u.cacheWrite || 0;
|
|
1137
|
+
result.usage.cost += u.cost?.total || 0;
|
|
1138
|
+
progress.tokens = result.usage.input + result.usage.output;
|
|
1139
|
+
progress.inputTokens = result.usage.input;
|
|
1140
|
+
progress.outputTokens = result.usage.output;
|
|
1141
|
+
progress.window = window;
|
|
1142
|
+
progress.windowPeak = Math.max(progress.windowPeak ?? 0, window);
|
|
1143
|
+
}
|
|
1144
|
+
if (evt.message.model) {
|
|
1145
|
+
progress.model = evt.message.model;
|
|
1146
|
+
if (!result.model) result.model = evt.message.model;
|
|
1147
|
+
if (expectedModelForVerification && !hasToolCall) {
|
|
1148
|
+
const modelVerificationError = formatSubagentModelVerificationError(expectedModelForVerification, evt.message.model, options.availableModels);
|
|
1149
|
+
if (modelVerificationError && !result.error) result.error = modelVerificationError;
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
if (evt.message.errorMessage) assistantError = evt.message.errorMessage;
|
|
1153
|
+
const assistantText = extractTextFromContent(evt.message.content);
|
|
1154
|
+
appendRecentOutput(progress, assistantText.split("\n").slice(-10));
|
|
1155
|
+
// Final assistant message: start the exit drain window.
|
|
1156
|
+
if (terminalAssistantStop) {
|
|
1157
|
+
if (!evt.message.errorMessage && assistantText.trim()) assistantError = undefined;
|
|
1158
|
+
cleanTerminalAssistantStopReceived ||= !evt.message.errorMessage;
|
|
1159
|
+
clearAllToolTimeouts();
|
|
1160
|
+
activeToolCalls.clear();
|
|
1161
|
+
activeToolKeysByName.clear();
|
|
1162
|
+
refreshCurrentTool();
|
|
1163
|
+
applyChildLifecycle(projectChildLifecycle(evt, true, childLifecycleState));
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
updateActivityState(now);
|
|
1167
|
+
fireUpdate();
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
if (evt.type === "tool_result_end" && evt.message) {
|
|
1171
|
+
const toolResultCompletion = {
|
|
1172
|
+
toolCallId: (evt.message as { toolCallId?: unknown }).toolCallId ?? (evt as { toolCallId?: unknown }).toolCallId,
|
|
1173
|
+
toolName: (evt.message as { toolName?: unknown }).toolName ?? (evt as { toolName?: unknown }).toolName,
|
|
1174
|
+
};
|
|
1175
|
+
clearActiveToolTimeout(toolResultCompletion);
|
|
1176
|
+
const endedTool = removeActiveToolCall(toolResultCompletion);
|
|
1177
|
+
if (endedTool) {
|
|
1178
|
+
progress.recentTools.push({
|
|
1179
|
+
tool: endedTool.tool,
|
|
1180
|
+
args: endedTool.args,
|
|
1181
|
+
endMs: now,
|
|
1182
|
+
});
|
|
1183
|
+
refreshCurrentTool();
|
|
1184
|
+
}
|
|
1185
|
+
result.messages!.push(evt.message);
|
|
1186
|
+
const resultText = extractTextFromContent(evt.message.content);
|
|
1187
|
+
if (options.toolBudget && pendingToolResult && resultText.includes("Tool budget hard limit reached")) {
|
|
1188
|
+
result.toolBudgetBlocked = true;
|
|
1189
|
+
result.toolBudget = toolBudgetState(options.toolBudget, progress.toolCount, pendingToolResult.tool);
|
|
1190
|
+
}
|
|
1191
|
+
appendRecentOutput(progress, resultText.split("\n").slice(-10));
|
|
1192
|
+
const toolSnapshot = pendingToolResult;
|
|
1193
|
+
pendingToolResult = undefined;
|
|
1194
|
+
if (toolSnapshot?.mutates && didMutatingToolFail(resultText)) {
|
|
1195
|
+
recordMutatingFailure(mutatingFailures, {
|
|
1196
|
+
tool: toolSnapshot.tool,
|
|
1197
|
+
path: toolSnapshot.path,
|
|
1198
|
+
error: resultText.split("\n").find((line) => line.trim())?.trim().slice(0, 180) ?? "mutating tool failed",
|
|
1199
|
+
ts: now,
|
|
1200
|
+
}, mutatingFailureWindowMs);
|
|
1201
|
+
if (shouldEscalateMutatingFailures(mutatingFailures, controlConfig.failedToolAttemptsBeforeAttention)) {
|
|
1202
|
+
emitNeedsAttention(now, {
|
|
1203
|
+
message: `${agent.name} needs attention after repeated mutating tool failures`,
|
|
1204
|
+
reason: "tool_failures",
|
|
1205
|
+
currentTool: toolSnapshot.tool,
|
|
1206
|
+
currentPath: toolSnapshot.path,
|
|
1207
|
+
currentToolDurationMs: toolSnapshot.startedAt ? Math.max(0, now - toolSnapshot.startedAt) : undefined,
|
|
1208
|
+
recentFailureSummary: summarizeRecentMutatingFailures(mutatingFailures),
|
|
1209
|
+
});
|
|
1210
|
+
}
|
|
1211
|
+
} else if (toolSnapshot?.mutates) {
|
|
1212
|
+
resetMutatingFailureState(mutatingFailures);
|
|
1213
|
+
}
|
|
1214
|
+
fireUpdate();
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
|
|
1218
|
+
fireUpdate();
|
|
1219
|
+
if (controlConfig.enabled || options.onUpdate) {
|
|
1220
|
+
activityTimer = setInterval(() => {
|
|
1221
|
+
if (processClosed || lifecycleFinished) {
|
|
1222
|
+
return;
|
|
1223
|
+
}
|
|
1224
|
+
updateActivityState(Date.now());
|
|
1225
|
+
fireUpdate();
|
|
1226
|
+
}, 1000);
|
|
1227
|
+
activityTimer.unref?.();
|
|
1228
|
+
}
|
|
1229
|
+
|
|
1230
|
+
if (attemptTimeout) {
|
|
1231
|
+
timeoutTimer = setTimeout(() => {
|
|
1232
|
+
if (processClosed || lifecycleFinished || interruptedByControl) return;
|
|
1233
|
+
result.timedOut = true;
|
|
1234
|
+
clearAllToolTimeouts();
|
|
1235
|
+
result.error = attemptTimeout.message;
|
|
1236
|
+
result.finalOutput = attemptTimeout.message;
|
|
1237
|
+
progress.status = "failed";
|
|
1238
|
+
progress.error = attemptTimeout.message;
|
|
1239
|
+
progress.durationMs = Date.now() - startTime;
|
|
1240
|
+
fireUpdate();
|
|
1241
|
+
trySignalChild(proc, "SIGINT");
|
|
1242
|
+
timeoutTerminationTimer = setTimeout(() => {
|
|
1243
|
+
if (processClosed || lifecycleFinished) return;
|
|
1244
|
+
trySignalChild(proc, "SIGTERM");
|
|
1245
|
+
}, 1000);
|
|
1246
|
+
timeoutTerminationTimer.unref?.();
|
|
1247
|
+
timeoutHardKillTimer = setTimeout(() => {
|
|
1248
|
+
if (processClosed || lifecycleFinished) return;
|
|
1249
|
+
trySignalChild(proc, "SIGKILL");
|
|
1250
|
+
}, 4000);
|
|
1251
|
+
timeoutHardKillTimer.unref?.();
|
|
1252
|
+
}, attemptTimeout.remainingMs);
|
|
1253
|
+
timeoutTimer.unref?.();
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
let toolTimeoutSequence = 0;
|
|
1257
|
+
const activeToolTimeouts = new Map<string, { toolName: string; timer: ReturnType<typeof setTimeout> }>();
|
|
1258
|
+
const activeToolTimeoutKeysByName = new Map<string, string[]>();
|
|
1259
|
+
let toolTimeoutTerminationTimer: ReturnType<typeof setTimeout> | undefined;
|
|
1260
|
+
let toolTimeoutHardKillTimer: ReturnType<typeof setTimeout> | undefined;
|
|
1261
|
+
const removeToolTimeoutKey = (key: string): void => {
|
|
1262
|
+
const active = activeToolTimeouts.get(key);
|
|
1263
|
+
if (!active) return;
|
|
1264
|
+
clearTimeout(active.timer);
|
|
1265
|
+
activeToolTimeouts.delete(key);
|
|
1266
|
+
const keys = activeToolTimeoutKeysByName.get(active.toolName)?.filter((candidate) => candidate !== key) ?? [];
|
|
1267
|
+
if (keys.length > 0) activeToolTimeoutKeysByName.set(active.toolName, keys);
|
|
1268
|
+
else activeToolTimeoutKeysByName.delete(active.toolName);
|
|
1269
|
+
};
|
|
1270
|
+
const clearActiveToolTimeout = (event: { toolCallId?: unknown; toolName?: unknown }): void => {
|
|
1271
|
+
const key = typeof event.toolCallId === "string" && event.toolCallId.length > 0
|
|
1272
|
+
? `id:${event.toolCallId}`
|
|
1273
|
+
: typeof event.toolName === "string"
|
|
1274
|
+
? activeToolTimeoutKeysByName.get(event.toolName)?.[0]
|
|
1275
|
+
: activeToolTimeouts.size === 1
|
|
1276
|
+
? [...activeToolTimeouts.keys()][0]
|
|
1277
|
+
: undefined;
|
|
1278
|
+
if (key) removeToolTimeoutKey(key);
|
|
1279
|
+
};
|
|
1280
|
+
const clearAllToolTimeouts = (): void => {
|
|
1281
|
+
for (const key of [...activeToolTimeouts.keys()]) removeToolTimeoutKey(key);
|
|
1282
|
+
if (toolTimeoutTerminationTimer) {
|
|
1283
|
+
clearTimeout(toolTimeoutTerminationTimer);
|
|
1284
|
+
toolTimeoutTerminationTimer = undefined;
|
|
1285
|
+
}
|
|
1286
|
+
if (toolTimeoutHardKillTimer) {
|
|
1287
|
+
clearTimeout(toolTimeoutHardKillTimer);
|
|
1288
|
+
toolTimeoutHardKillTimer = undefined;
|
|
1289
|
+
}
|
|
1290
|
+
};
|
|
1291
|
+
const terminateForToolTimeout = (message: string): void => {
|
|
1292
|
+
if (processClosed || lifecycleFinished || interruptedByControl) return;
|
|
1293
|
+
result.timedOut = true;
|
|
1294
|
+
result.error = message;
|
|
1295
|
+
result.finalOutput = message;
|
|
1296
|
+
progress.status = "failed";
|
|
1297
|
+
progress.error = message;
|
|
1298
|
+
progress.durationMs = Date.now() - startTime;
|
|
1299
|
+
fireUpdate();
|
|
1300
|
+
trySignalChild(proc, "SIGINT");
|
|
1301
|
+
toolTimeoutTerminationTimer = setTimeout(() => {
|
|
1302
|
+
if (processClosed || lifecycleFinished) return;
|
|
1303
|
+
trySignalChild(proc, "SIGTERM");
|
|
1304
|
+
}, 1000);
|
|
1305
|
+
toolTimeoutTerminationTimer.unref?.();
|
|
1306
|
+
toolTimeoutHardKillTimer = setTimeout(() => {
|
|
1307
|
+
if (processClosed || lifecycleFinished) return;
|
|
1308
|
+
trySignalChild(proc, "SIGKILL");
|
|
1309
|
+
}, 4000);
|
|
1310
|
+
toolTimeoutHardKillTimer.unref?.();
|
|
1311
|
+
};
|
|
1312
|
+
const armToolTimeout = (event: { toolCallId?: unknown; toolName: string }): void => {
|
|
1313
|
+
const timeoutForTool = effectiveToolTimeoutMs(event.toolName, options.toolTimeoutMs);
|
|
1314
|
+
if (timeoutForTool === undefined) return;
|
|
1315
|
+
const elapsed = Date.now() - startTime;
|
|
1316
|
+
const runRemaining = attemptTimeout ? Math.max(0, attemptTimeout.remainingMs - elapsed) : undefined;
|
|
1317
|
+
if (runRemaining !== undefined && timeoutForTool >= runRemaining) return;
|
|
1318
|
+
const key = toolTimeoutCallKey(event, ++toolTimeoutSequence);
|
|
1319
|
+
const toolName = event.toolName;
|
|
1320
|
+
const timer = setTimeout(() => {
|
|
1321
|
+
removeToolTimeoutKey(key);
|
|
1322
|
+
terminateForToolTimeout(formatToolTimeoutMessage(toolName, timeoutForTool));
|
|
1323
|
+
}, timeoutForTool);
|
|
1324
|
+
timer.unref?.();
|
|
1325
|
+
activeToolTimeouts.set(key, { toolName, timer });
|
|
1326
|
+
const keys = activeToolTimeoutKeysByName.get(toolName) ?? [];
|
|
1327
|
+
keys.push(key);
|
|
1328
|
+
activeToolTimeoutKeysByName.set(toolName, keys);
|
|
1329
|
+
};
|
|
1330
|
+
|
|
1331
|
+
const stderrTail = createBoundedByteTail();
|
|
1332
|
+
const failProtocol = (limit: ProtocolOutputLimit): void => {
|
|
1333
|
+
if (result.protocolError) return;
|
|
1334
|
+
result.protocolError = limit;
|
|
1335
|
+
result.error = formatProtocolOutputLimit(limit);
|
|
1336
|
+
progress.status = "failed";
|
|
1337
|
+
progress.error = result.error;
|
|
1338
|
+
progress.durationMs = Date.now() - startTime;
|
|
1339
|
+
fireUpdate();
|
|
1340
|
+
if (!childExited) {
|
|
1341
|
+
trySignalChild(proc, "SIGTERM");
|
|
1342
|
+
protocolHardKillTimer = setTimeout(() => {
|
|
1343
|
+
if (!childExited) trySignalChild(proc, "SIGKILL");
|
|
1344
|
+
}, 3000);
|
|
1345
|
+
protocolHardKillTimer.unref?.();
|
|
1346
|
+
}
|
|
1347
|
+
};
|
|
1348
|
+
const stdoutReader = createBoundedLineReader({
|
|
1349
|
+
oversizedLineProjector: PI_AGGREGATE_EVENT_PROJECTOR,
|
|
1350
|
+
onLine: processLine,
|
|
1351
|
+
onLimit: failProtocol,
|
|
1352
|
+
});
|
|
1353
|
+
const stderrReader = createBoundedLineReader({
|
|
1354
|
+
stream: "stderr",
|
|
1355
|
+
maxPendingLineBytes: MAX_CHILD_STDERR_BYTES,
|
|
1356
|
+
onLine: (line) => shared.transcriptWriter?.writeStderrLine(line),
|
|
1357
|
+
onLimit: (limit) => shared.transcriptWriter?.writeStderrLine(formatProtocolOutputLimit(limit)),
|
|
1358
|
+
});
|
|
1359
|
+
|
|
1360
|
+
const clearStdioGuard = attachPostExitStdioGuard(proc, { idleMs: 2000, hardMs: 8000 });
|
|
1361
|
+
proc.stdout.on("data", (chunk: Buffer) => stdoutReader.push(chunk));
|
|
1362
|
+
proc.stderr.on("data", (chunk: Buffer) => {
|
|
1363
|
+
stderrTail.push(chunk);
|
|
1364
|
+
stderrReader.push(chunk);
|
|
1365
|
+
shared.orcaProgressTab?.append(chunk.toString("utf-8"));
|
|
1366
|
+
});
|
|
1367
|
+
proc.on("exit", () => {
|
|
1368
|
+
childExited = true;
|
|
1369
|
+
clearFinalDrainTimers();
|
|
1370
|
+
});
|
|
1371
|
+
proc.on("close", (code, signal) => {
|
|
1372
|
+
if (lifecycleFinished) return;
|
|
1373
|
+
processClosed = true;
|
|
1374
|
+
clearFinalDrainTimers();
|
|
1375
|
+
clearStdioGuard();
|
|
1376
|
+
void jsonlWriter.close().catch(() => {
|
|
1377
|
+
// JSONL artifact flush is best effort.
|
|
1378
|
+
});
|
|
1379
|
+
const toolDiagnosticError = readChildToolDiagnosticError(toolDiagnosticPath);
|
|
1380
|
+
toolAvailabilityError = toolDiagnosticError;
|
|
1381
|
+
result.runtimeAcknowledgedExtensions = readRuntimeAcknowledgedExtensions(runtimeAcknowledgedExtensionsPath);
|
|
1382
|
+
cleanupTempDir(tempDir);
|
|
1383
|
+
stdoutReader.end();
|
|
1384
|
+
stderrReader.end();
|
|
1385
|
+
const stderr = stderrTail.text();
|
|
1386
|
+
const rawStdout = rawStdoutTail.text();
|
|
1387
|
+
let closeError = result.error ?? toolDiagnosticError ?? assistantError;
|
|
1388
|
+
const forcedDrainAfterFinalSuccess = Boolean(forcedTerminationSignal || signal) && (cleanTerminalAssistantStopReceived || agentSettledReceived) && !closeError;
|
|
1389
|
+
const forcedDrainAfterEmptyTerminal = forcedDrainAfterFinalSuccess && hasEmptyTerminalAssistantResponse(result.messages ?? []);
|
|
1390
|
+
if (signal) result.processSignal = signal;
|
|
1391
|
+
if (!closeError && forcedDrainAfterEmptyTerminal && stderr.trim()) {
|
|
1392
|
+
closeError = stderr.trim();
|
|
1393
|
+
}
|
|
1394
|
+
if (!closeError && isUnexplainedProcessSignal({
|
|
1395
|
+
processSignal: signal,
|
|
1396
|
+
interrupted: result.interrupted,
|
|
1397
|
+
timedOut: result.timedOut,
|
|
1398
|
+
stopped: result.stopped,
|
|
1399
|
+
forcedDrainAfterFinalSuccess: forcedDrainAfterFinalSuccess && !forcedDrainAfterEmptyTerminal,
|
|
1400
|
+
})) {
|
|
1401
|
+
closeError = formatProcessSignalError(signal!);
|
|
1402
|
+
}
|
|
1403
|
+
if (code !== 0 && rawStdout.trim() && !closeError && !forcedDrainAfterFinalSuccess) {
|
|
1404
|
+
closeError = rawStdout.trim();
|
|
1405
|
+
}
|
|
1406
|
+
if (code !== 0 && stderr.trim() && !closeError && !forcedDrainAfterFinalSuccess) {
|
|
1407
|
+
closeError = stderr.trim();
|
|
1408
|
+
}
|
|
1409
|
+
const finalCode = forcedDrainAfterFinalSuccess && !forcedDrainAfterEmptyTerminal ? 0 : forcedTerminationSignal || signal ? (code ?? 1) : (code ?? 0);
|
|
1410
|
+
if (!result.error && closeError) result.error = closeError;
|
|
1411
|
+
finish(finalCode);
|
|
1412
|
+
});
|
|
1413
|
+
proc.on("error", (error) => {
|
|
1414
|
+
if (lifecycleFinished) return;
|
|
1415
|
+
processClosed = true;
|
|
1416
|
+
clearFinalDrainTimers();
|
|
1417
|
+
clearStdioGuard();
|
|
1418
|
+
void jsonlWriter.close().catch(() => {
|
|
1419
|
+
// JSONL artifact flush is best effort.
|
|
1420
|
+
});
|
|
1421
|
+
cleanupTempDir(tempDir);
|
|
1422
|
+
stdoutReader.end();
|
|
1423
|
+
stderrReader.end();
|
|
1424
|
+
if (!result.error) {
|
|
1425
|
+
result.error = error instanceof Error ? error.message : String(error);
|
|
1426
|
+
}
|
|
1427
|
+
finish(1);
|
|
1428
|
+
});
|
|
1429
|
+
|
|
1430
|
+
if (options.signal) {
|
|
1431
|
+
const kill = () => {
|
|
1432
|
+
if (processClosed || lifecycleFinished) return;
|
|
1433
|
+
abortedBySignal = true;
|
|
1434
|
+
proc.kill("SIGTERM");
|
|
1435
|
+
setTimeout(() => !proc.killed && proc.kill("SIGKILL"), 3000);
|
|
1436
|
+
};
|
|
1437
|
+
if (options.signal.aborted) kill();
|
|
1438
|
+
else {
|
|
1439
|
+
options.signal.addEventListener("abort", kill, { once: true });
|
|
1440
|
+
removeAbortListener = () => options.signal?.removeEventListener("abort", kill);
|
|
1441
|
+
}
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
if (options.interruptSignal) {
|
|
1445
|
+
const interrupt = () => {
|
|
1446
|
+
if (processClosed || lifecycleFinished) return;
|
|
1447
|
+
if (result.timedOut) return;
|
|
1448
|
+
interruptedByControl = true;
|
|
1449
|
+
clearTimeoutTimers();
|
|
1450
|
+
clearAllToolTimeouts();
|
|
1451
|
+
progress.status = "running";
|
|
1452
|
+
progress.durationMs = Date.now() - startTime;
|
|
1453
|
+
result.interrupted = true;
|
|
1454
|
+
result.finalOutput = "Interrupted. Waiting for explicit next action.";
|
|
1455
|
+
progress.activityState = undefined;
|
|
1456
|
+
fireUpdate();
|
|
1457
|
+
trySignalChild(proc, "SIGINT");
|
|
1458
|
+
setTimeout(() => {
|
|
1459
|
+
if (lifecycleFinished || processClosed) return;
|
|
1460
|
+
trySignalChild(proc, "SIGTERM");
|
|
1461
|
+
}, 1000).unref?.();
|
|
1462
|
+
};
|
|
1463
|
+
if (options.interruptSignal.aborted) interrupt();
|
|
1464
|
+
else {
|
|
1465
|
+
options.interruptSignal.addEventListener("abort", interrupt, { once: true });
|
|
1466
|
+
removeInterruptListener = () => options.interruptSignal?.removeEventListener("abort", interrupt);
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
// Publish only after every callback and cleanup guard captured by detach or
|
|
1471
|
+
// later lifecycle events has initialized. Consumers may invoke synchronously.
|
|
1472
|
+
try {
|
|
1473
|
+
options.onDetachReady?.((reason = "user request") => detachForeground(reason));
|
|
1474
|
+
} catch (error) {
|
|
1475
|
+
// A consumer callback is advisory. Keep the child attached and observable
|
|
1476
|
+
// rather than rejecting this attempt and orphaning its live process.
|
|
1477
|
+
appendRecentOutput(progress, [`Foreground detach callback failed: ${error instanceof Error ? error.message : String(error)}`]);
|
|
1478
|
+
}
|
|
1479
|
+
});
|
|
1480
|
+
result.exitCode = exitCode;
|
|
1481
|
+
if (afterCompactionSettlement) {
|
|
1482
|
+
(result as AbortRecoverySingleResult)[AFTER_COMPACTION_SETTLEMENT] = true;
|
|
1483
|
+
}
|
|
1484
|
+
if (interruptedByControl) {
|
|
1485
|
+
result.exitCode = 0;
|
|
1486
|
+
result.interrupted = true;
|
|
1487
|
+
result.error = undefined;
|
|
1488
|
+
result.finalOutput = result.finalOutput || "Interrupted. Waiting for explicit next action.";
|
|
1489
|
+
result.controlEvents = allControlEvents.length ? allControlEvents : undefined;
|
|
1490
|
+
progress.activityState = undefined;
|
|
1491
|
+
progress.durationMs = Date.now() - startTime;
|
|
1492
|
+
result.progressSummary = {
|
|
1493
|
+
toolCount: progress.toolCount,
|
|
1494
|
+
tokens: progress.tokens,
|
|
1495
|
+
durationMs: progress.durationMs,
|
|
1496
|
+
};
|
|
1497
|
+
return result;
|
|
1498
|
+
}
|
|
1499
|
+
if (progress.currentTool
|
|
1500
|
+
&& isOrdinaryToolForMidToolExit(progress.currentTool)
|
|
1501
|
+
&& !abortedBySignal
|
|
1502
|
+
&& !result.timedOut
|
|
1503
|
+
&& !result.stopped
|
|
1504
|
+
&& !result.protocolError
|
|
1505
|
+
&& !toolAvailabilityError) {
|
|
1506
|
+
const processExitCode = result.exitCode;
|
|
1507
|
+
result.exitCode = 1;
|
|
1508
|
+
result.error = formatMidToolExitError({
|
|
1509
|
+
toolName: progress.currentTool,
|
|
1510
|
+
exitCode: processExitCode,
|
|
1511
|
+
processSignal: result.processSignal,
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
result.error = formatSubagentExtensionConflictError(result.error, {
|
|
1515
|
+
agent: agent.name,
|
|
1516
|
+
ambientExtensionsEnabled: !launchResolvedExtensions.disableAmbientExtensions,
|
|
1517
|
+
});
|
|
1518
|
+
if (result.error && result.exitCode === 0) {
|
|
1519
|
+
result.exitCode = 1;
|
|
1520
|
+
}
|
|
1521
|
+
let validatedStructuredOutput = false;
|
|
1522
|
+
if (options.structuredOutput && result.exitCode === 0 && !result.error) {
|
|
1523
|
+
result.structuredOutputSchemaPath = options.structuredOutput.schemaPath;
|
|
1524
|
+
result.structuredOutputPath = options.structuredOutput.outputPath;
|
|
1525
|
+
if (!structuredOutputToolInvoked) {
|
|
1526
|
+
result.exitCode = 1;
|
|
1527
|
+
result.error = MISSING_STRUCTURED_OUTPUT_CALL_ERROR;
|
|
1528
|
+
result.structuredOutputFailed = true;
|
|
1529
|
+
} else {
|
|
1530
|
+
const structured = await readStructuredOutput({
|
|
1531
|
+
schema: options.structuredOutput.schema,
|
|
1532
|
+
schemaPath: options.structuredOutput.schemaPath,
|
|
1533
|
+
outputPath: options.structuredOutput.outputPath,
|
|
1534
|
+
});
|
|
1535
|
+
if (structured.error) {
|
|
1536
|
+
result.exitCode = 1;
|
|
1537
|
+
result.error = structured.error;
|
|
1538
|
+
result.structuredOutputFailed = true;
|
|
1539
|
+
} else {
|
|
1540
|
+
result.structuredOutput = structured.value;
|
|
1541
|
+
const acceptanceReport = readStructuredOutputAcceptanceReport(options.structuredOutput);
|
|
1542
|
+
(result as SingleResult & { structuredAcceptanceReport?: unknown; structuredAcceptanceReportError?: string }).structuredAcceptanceReport = acceptanceReport.value;
|
|
1543
|
+
(result as SingleResult & { structuredAcceptanceReport?: unknown; structuredAcceptanceReportError?: string }).structuredAcceptanceReportError = acceptanceReport.error;
|
|
1544
|
+
validatedStructuredOutput = true;
|
|
1545
|
+
}
|
|
1546
|
+
}
|
|
1547
|
+
}
|
|
1548
|
+
if (result.exitCode === 0 && !result.error) {
|
|
1549
|
+
const messages = result.messages ?? [];
|
|
1550
|
+
const finalText = getFinalOutput(messages);
|
|
1551
|
+
const errorMessages = validatedStructuredOutput
|
|
1552
|
+
? messages.slice(structuredOutputMessageStartIndex ?? messages.length)
|
|
1553
|
+
: messages;
|
|
1554
|
+
const errInfo = detectSubagentError(errorMessages);
|
|
1555
|
+
const missingOutput = !finalText?.trim() && !validatedStructuredOutput;
|
|
1556
|
+
const terminalEmptyAfterUsefulWork = !validatedStructuredOutput
|
|
1557
|
+
&& hasEmptyTerminalAssistantResponse(messages)
|
|
1558
|
+
&& (progress.toolCount > 0 || Boolean(finalText?.trim()));
|
|
1559
|
+
if ((missingOutput || terminalEmptyAfterUsefulWork) && (!errInfo.hasError || hasEmptyTerminalAssistantResponse(messages))) {
|
|
1560
|
+
result.exitCode = 1;
|
|
1561
|
+
result.error = formatEmptyTerminalAssistantResponseError(messages);
|
|
1562
|
+
} else if (errInfo.hasError) {
|
|
1563
|
+
result.exitCode = errInfo.exitCode ?? 1;
|
|
1564
|
+
result.error = errInfo.details
|
|
1565
|
+
? `${errInfo.errorType} failed (exit ${errInfo.exitCode}): ${errInfo.details}`
|
|
1566
|
+
: `${errInfo.errorType} failed with exit code ${errInfo.exitCode}`;
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
progress.status = result.exitCode === 0 ? "completed" : "failed";
|
|
1571
|
+
progress.durationMs = Date.now() - startTime;
|
|
1572
|
+
if (result.error) {
|
|
1573
|
+
progress.error = result.error;
|
|
1574
|
+
if (progress.currentTool) {
|
|
1575
|
+
progress.failedTool = progress.currentTool;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
result.progressSummary = {
|
|
1580
|
+
...(childSessionName ? { sessionName: childSessionName } : {}),
|
|
1581
|
+
toolCount: progress.toolCount,
|
|
1582
|
+
tokens: progress.tokens,
|
|
1583
|
+
durationMs: progress.durationMs,
|
|
1584
|
+
};
|
|
1585
|
+
const mutationEvidence = collectTrackedMutationEvidence(mutationSnapshot, options.cwd ?? runtimeCwd);
|
|
1586
|
+
|
|
1587
|
+
const acceptanceOutput = getFinalOutput(result.messages ?? []);
|
|
1588
|
+
let fullOutput = stripAcceptanceReport(acceptanceOutput);
|
|
1589
|
+
if (!fullOutput.trim() && result.structuredOutput !== undefined) fullOutput = JSON.stringify(result.structuredOutput, null, 2);
|
|
1590
|
+
result.outputState = fullOutput.trim() || result.structuredOutput !== undefined ? "present" : "absent";
|
|
1591
|
+
if (result.timedOut) {
|
|
1592
|
+
const timeoutMessage = formatTimeoutMessage(options.timeoutMs ?? 0);
|
|
1593
|
+
let requiredOutputMissing: boolean | undefined;
|
|
1594
|
+
if (options.outputMode === "file-only" && options.outputPath) {
|
|
1595
|
+
const outputChanged = hasSingleOutputChangedSinceSnapshot(options.outputPath, shared.outputSnapshot);
|
|
1596
|
+
requiredOutputMissing = outputChanged === undefined ? undefined : !outputChanged;
|
|
1597
|
+
} else if (options.structuredOutput) {
|
|
1598
|
+
requiredOutputMissing = !existsSync(options.structuredOutput.outputPath);
|
|
1599
|
+
}
|
|
1600
|
+
result.timeoutRecovery = buildTimeoutRecoverySummary({
|
|
1601
|
+
termination: "timed-out",
|
|
1602
|
+
evidence: mutationEvidence,
|
|
1603
|
+
requiredOutputMissing,
|
|
1604
|
+
currentTool: progress.currentTool,
|
|
1605
|
+
currentToolArgs: progress.currentToolArgs,
|
|
1606
|
+
currentPath: progress.currentPath,
|
|
1607
|
+
sessionFile: options.sessionFile,
|
|
1608
|
+
transcriptPath: shared.transcriptWriter ? shared.artifactPaths?.transcriptPath : undefined,
|
|
1609
|
+
artifactPaths: shared.artifactPaths,
|
|
1610
|
+
});
|
|
1611
|
+
fullOutput = fullOutput.trim()
|
|
1612
|
+
? `${timeoutMessage}\n\n${result.timeoutRecovery.message}\n\nPartial output before timeout:\n${fullOutput}`
|
|
1613
|
+
: `${timeoutMessage}\n\n${result.timeoutRecovery.message}`;
|
|
1614
|
+
}
|
|
1615
|
+
const completionGuardEnabled = isAgentContractV1(options.agentContract) ? agent.completionGuard === true : agent.completionGuard !== false;
|
|
1616
|
+
const completionGuard = ((result.exitCode === 0 && !result.error) || toolAvailabilityError) && completionGuardEnabled
|
|
1617
|
+
? evaluateCompletionMutationGuard({
|
|
1618
|
+
agent: agent.name,
|
|
1619
|
+
task: shared.originalTask ?? task,
|
|
1620
|
+
messages: result.messages ?? [],
|
|
1621
|
+
tools: contractTools,
|
|
1622
|
+
mcpDirectTools: toolPlan.effectiveMcpTools,
|
|
1623
|
+
mutationTools: agent.mutationTools,
|
|
1624
|
+
toolAvailabilityError,
|
|
1625
|
+
mutationEvidence,
|
|
1626
|
+
})
|
|
1627
|
+
: undefined;
|
|
1628
|
+
const mutationAttemptObserved = observedMutationAttempt || mutationEvidence.attemptedMutation;
|
|
1629
|
+
let completionGuardTriggered = completionGuard?.triggered === true && !mutationAttemptObserved;
|
|
1630
|
+
// The classifier is deliberately narrow, so a read-only review task can
|
|
1631
|
+
// still be misread as implementation. Arbitrate BEFORE any failure side
|
|
1632
|
+
// effect is published (effects, exit code, progress, notifications,
|
|
1633
|
+
// acceptance, output persistence): only a confident read-only verdict
|
|
1634
|
+
// rescues, and the task text alone is evidence — never the child's own
|
|
1635
|
+
// final message.
|
|
1636
|
+
let arbiterRescued = false;
|
|
1637
|
+
if (completionGuardTriggered) {
|
|
1638
|
+
const arbitration = await arbitrateCompletionGuardRescue({
|
|
1639
|
+
guardTriggered: true,
|
|
1640
|
+
task: shared.originalTask ?? task,
|
|
1641
|
+
arbiter: options.llmIntentArbiter,
|
|
1642
|
+
});
|
|
1643
|
+
completionGuardTriggered = arbitration.triggered;
|
|
1644
|
+
arbiterRescued = arbitration.rescued;
|
|
1645
|
+
}
|
|
1646
|
+
const completionEvidence = planCompletionEvidence({
|
|
1647
|
+
guard: completionGuard,
|
|
1648
|
+
guardTriggered: completionGuardTriggered,
|
|
1649
|
+
completionGuardEnabled,
|
|
1650
|
+
mutationCapable: hasMutationToolCapability(contractTools, toolPlan.effectiveMcpTools),
|
|
1651
|
+
implementationMutationExpected: expectsImplementationMutation(agent.name, shared.originalTask ?? task),
|
|
1652
|
+
mutationAttemptObserved,
|
|
1653
|
+
mutationEvidence,
|
|
1654
|
+
arbiterRescued,
|
|
1655
|
+
agentContractV1: isAgentContractV1(options.agentContract),
|
|
1656
|
+
});
|
|
1657
|
+
if (completionEvidence.fileMutation) {
|
|
1658
|
+
result.effects = {
|
|
1659
|
+
...(result.effects ?? {}),
|
|
1660
|
+
fileMutation: completionEvidence.fileMutation,
|
|
1661
|
+
};
|
|
1662
|
+
}
|
|
1663
|
+
if (completionEvidence.legacyFailureError) {
|
|
1664
|
+
result.exitCode = 1;
|
|
1665
|
+
result.error = completionEvidence.legacyFailureError;
|
|
1666
|
+
progress.status = "failed";
|
|
1667
|
+
progress.error = result.error;
|
|
1668
|
+
emitControlEvent(buildControlEvent({
|
|
1669
|
+
from: progress.activityState,
|
|
1670
|
+
to: "needs_attention",
|
|
1671
|
+
runId: options.runId ?? agent.name,
|
|
1672
|
+
agent: agent.name,
|
|
1673
|
+
index: options.index,
|
|
1674
|
+
ts: Date.now(),
|
|
1675
|
+
message: `${agent.name} completed without making edits for an implementation task`,
|
|
1676
|
+
reason: "completion_guard",
|
|
1677
|
+
}));
|
|
1678
|
+
}
|
|
1679
|
+
if (options.outputPath && result.exitCode === 0) {
|
|
1680
|
+
const resolvedOutput = resolveSingleOutput(options.outputPath, fullOutput, shared.outputSnapshot, options.outputClaimPath);
|
|
1681
|
+
fullOutput = stripAcceptanceReport(resolvedOutput.fullOutput);
|
|
1682
|
+
result.savedOutputPath = resolvedOutput.savedPath;
|
|
1683
|
+
result.outputSaveError = resolvedOutput.saveError;
|
|
1684
|
+
if (resolvedOutput.fatalError) {
|
|
1685
|
+
result.exitCode = 1;
|
|
1686
|
+
result.error = result.error ? `${result.error}\n${resolvedOutput.saveError}` : resolvedOutput.saveError;
|
|
1687
|
+
}
|
|
1688
|
+
if (resolvedOutput.savedPath) {
|
|
1689
|
+
result.outputReference = formatSavedOutputReference(resolvedOutput.savedPath, fullOutput);
|
|
1690
|
+
if (result.outputState === "absent") result.outputState = "unknown";
|
|
1691
|
+
}
|
|
1692
|
+
}
|
|
1693
|
+
artifactOutputByResult.set(result, fullOutput);
|
|
1694
|
+
acceptanceOutputByResult.set(result, acceptanceOutput);
|
|
1695
|
+
result.outputMode = options.outputMode ?? "inline";
|
|
1696
|
+
result.finalOutput = options.outputMode === "file-only" && result.savedOutputPath && result.outputReference
|
|
1697
|
+
? result.outputReference.message
|
|
1698
|
+
: fullOutput;
|
|
1699
|
+
result.controlEvents = allControlEvents.length ? allControlEvents : undefined;
|
|
1700
|
+
if (options.onUpdate) {
|
|
1701
|
+
const finalText = result.finalOutput || result.error || "(no output)";
|
|
1702
|
+
const progressSnapshot = snapshotProgress(progress);
|
|
1703
|
+
const resultSnapshot = snapshotStreamResult(result, progressSnapshot);
|
|
1704
|
+
options.onUpdate({
|
|
1705
|
+
content: [{ type: "text", text: finalText }],
|
|
1706
|
+
details: {
|
|
1707
|
+
mode: "single",
|
|
1708
|
+
results: [resultSnapshot],
|
|
1709
|
+
progress: [progressSnapshot],
|
|
1710
|
+
controlEvents: allControlEvents.length ? allControlEvents : undefined,
|
|
1711
|
+
},
|
|
1712
|
+
});
|
|
1713
|
+
}
|
|
1714
|
+
return result;
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
/**
|
|
1718
|
+
* Run a subagent synchronously (blocking until complete)
|
|
1719
|
+
*/
|
|
1720
|
+
async function runSyncCompletionInner(
|
|
1721
|
+
runtimeCwd: string,
|
|
1722
|
+
agents: AgentConfig[],
|
|
1723
|
+
agentName: string,
|
|
1724
|
+
task: string,
|
|
1725
|
+
options: RunSyncOptions,
|
|
1726
|
+
): Promise<SingleResult> {
|
|
1727
|
+
const effectiveCwd = options.cwd ?? runtimeCwd;
|
|
1728
|
+
const cwdError = preflightLaunchCwd(options.requestedCwd ?? effectiveCwd, effectiveCwd);
|
|
1729
|
+
if (cwdError) {
|
|
1730
|
+
return redactResultPrompt(withRunContext({
|
|
1731
|
+
index: options.index ?? 0,
|
|
1732
|
+
agent: agentName,
|
|
1733
|
+
task,
|
|
1734
|
+
exitCode: 1,
|
|
1735
|
+
messages: [],
|
|
1736
|
+
usage: emptyUsage(),
|
|
1737
|
+
error: cwdError,
|
|
1738
|
+
}, options.context));
|
|
1739
|
+
}
|
|
1740
|
+
options = {
|
|
1741
|
+
...options,
|
|
1742
|
+
capabilityCeiling: intersectSubagentCapabilityCeilings(options.capabilityCeiling ?? resolveCurrentSubagentCapabilityCeiling(options.parentSessionId), decodeSubagentCapabilityCeiling(process.env[SUBAGENT_CAPABILITY_CEILING_ENV])),
|
|
1743
|
+
};
|
|
1744
|
+
const childSessionName = deriveChildSessionName({ agent: agentName, task });
|
|
1745
|
+
const agent = agents.find((a) => a.name === agentName);
|
|
1746
|
+
if (!agent) {
|
|
1747
|
+
const diagnosticContext = options.unknownAgentDiagnosticContext
|
|
1748
|
+
?? unknownAgentDiagnosticContext(discoverAgents(path.resolve(options.cwd ?? runtimeCwd), "both"));
|
|
1749
|
+
return redactResultPrompt(withRunContext({
|
|
1750
|
+
index: options.index ?? 0,
|
|
1751
|
+
agent: agentName,
|
|
1752
|
+
task,
|
|
1753
|
+
exitCode: 1,
|
|
1754
|
+
messages: [],
|
|
1755
|
+
usage: emptyUsage(),
|
|
1756
|
+
error: formatUnknownAgentError(agentName, diagnosticContext),
|
|
1757
|
+
}, options.context));
|
|
1758
|
+
}
|
|
1759
|
+
options = {
|
|
1760
|
+
...options,
|
|
1761
|
+
thinkingCeiling: intersectThinkingCeilings(
|
|
1762
|
+
options.thinkingCeiling,
|
|
1763
|
+
agent.maxThinking,
|
|
1764
|
+
decodeThinkingCeiling(process.env[SUBAGENT_THINKING_CEILING_ENV]),
|
|
1765
|
+
),
|
|
1766
|
+
};
|
|
1767
|
+
try {
|
|
1768
|
+
assertAgentAllowedByCapabilityCeiling(agent.name, options.capabilityCeiling);
|
|
1769
|
+
} catch (error) {
|
|
1770
|
+
return redactResultPrompt(withRunContext({
|
|
1771
|
+
index: options.index ?? 0,
|
|
1772
|
+
agent: agent.name,
|
|
1773
|
+
task,
|
|
1774
|
+
exitCode: 1,
|
|
1775
|
+
messages: [],
|
|
1776
|
+
usage: emptyUsage(),
|
|
1777
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1778
|
+
...(options.capabilityCeiling ? { capabilityCeiling: options.capabilityCeiling } : {}),
|
|
1779
|
+
}, options.context));
|
|
1780
|
+
}
|
|
1781
|
+
const acceptanceErrors = validateAcceptanceInput(options.acceptance);
|
|
1782
|
+
if (acceptanceErrors.length > 0) {
|
|
1783
|
+
return redactResultPrompt(withRunContext({
|
|
1784
|
+
index: options.index ?? 0,
|
|
1785
|
+
agent: agentName,
|
|
1786
|
+
task,
|
|
1787
|
+
exitCode: 1,
|
|
1788
|
+
messages: [],
|
|
1789
|
+
usage: emptyUsage(),
|
|
1790
|
+
error: acceptanceErrors.join(" "),
|
|
1791
|
+
}, options.context));
|
|
1792
|
+
}
|
|
1793
|
+
const toolTimeout = resolveToolTimeoutMs({
|
|
1794
|
+
callValue: options.toolTimeoutMs,
|
|
1795
|
+
agentValue: agent.defaultToolTimeoutMs,
|
|
1796
|
+
configValue: options.configToolTimeoutMs,
|
|
1797
|
+
envValue: toolTimeoutFromEnv(),
|
|
1798
|
+
});
|
|
1799
|
+
if (toolTimeout.error) {
|
|
1800
|
+
return redactResultPrompt(withRunContext({
|
|
1801
|
+
index: options.index ?? 0,
|
|
1802
|
+
agent: agentName,
|
|
1803
|
+
task,
|
|
1804
|
+
exitCode: 1,
|
|
1805
|
+
messages: [],
|
|
1806
|
+
usage: emptyUsage(),
|
|
1807
|
+
error: toolTimeout.error,
|
|
1808
|
+
}, options.context));
|
|
1809
|
+
}
|
|
1810
|
+
options = { ...options, toolTimeoutMs: toolTimeout.toolTimeoutMs };
|
|
1811
|
+
const outputModeValidationError = validateFileOnlyOutputMode(options.outputMode, options.outputPath, `Single run (${agentName})`);
|
|
1812
|
+
if (outputModeValidationError) {
|
|
1813
|
+
return redactResultPrompt(withRunContext({
|
|
1814
|
+
index: options.index ?? 0,
|
|
1815
|
+
agent: agentName,
|
|
1816
|
+
task,
|
|
1817
|
+
exitCode: 1,
|
|
1818
|
+
messages: [],
|
|
1819
|
+
usage: emptyUsage(),
|
|
1820
|
+
outputMode: options.outputMode,
|
|
1821
|
+
error: outputModeValidationError,
|
|
1822
|
+
}, options.context));
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
const shareEnabled = options.share === true;
|
|
1826
|
+
const effectiveAcceptance = resolveEffectiveAcceptance({
|
|
1827
|
+
explicit: options.acceptance,
|
|
1828
|
+
agentName,
|
|
1829
|
+
acceptanceRole: agent.acceptanceRole,
|
|
1830
|
+
task,
|
|
1831
|
+
mode: options.acceptanceContext?.mode ?? "single",
|
|
1832
|
+
async: options.acceptanceContext?.async,
|
|
1833
|
+
dynamic: options.acceptanceContext?.dynamic,
|
|
1834
|
+
dynamicGroup: options.acceptanceContext?.dynamicGroup,
|
|
1835
|
+
agentContract: options.agentContract,
|
|
1836
|
+
});
|
|
1837
|
+
const acceptancePrompt = formatAcceptancePrompt(effectiveAcceptance, { reportOptional: isAgentContractV1(options.agentContract), structuredOutput: Boolean(options.structuredOutput?.acceptanceReportPath) });
|
|
1838
|
+
const taskWithAcceptance = acceptancePrompt ? `${task}\n${acceptancePrompt}` : task;
|
|
1839
|
+
options.onEffectivePrompt?.(taskWithAcceptance);
|
|
1840
|
+
const sessionEnabled = Boolean(options.sessionFile || options.sessionDir) || shareEnabled;
|
|
1841
|
+
if (options.context === "fork" && options.sessionFile && existsSync(options.sessionFile)) {
|
|
1842
|
+
alignForkedSessionCwd(options.sessionFile, options.cwd ?? runtimeCwd);
|
|
1843
|
+
}
|
|
1844
|
+
const skillNames = options.skills ?? agent.skills ?? [];
|
|
1845
|
+
const skillCwd = options.cwd ?? runtimeCwd;
|
|
1846
|
+
const { resolved: resolvedSkills, missing: missingSkills } = resolveSkillsWithFallback(
|
|
1847
|
+
skillNames,
|
|
1848
|
+
skillCwd,
|
|
1849
|
+
runtimeCwd,
|
|
1850
|
+
agent.skillPath,
|
|
1851
|
+
agent.filePath ? path.dirname(agent.filePath) : skillCwd,
|
|
1852
|
+
);
|
|
1853
|
+
if (skillNames.some((skill) => skill.trim() === "pi-subagents") && missingSkills.includes("pi-subagents")) {
|
|
1854
|
+
return redactResultPrompt(withRunContext({
|
|
1855
|
+
index: options.index ?? 0,
|
|
1856
|
+
agent: agentName,
|
|
1857
|
+
task,
|
|
1858
|
+
exitCode: 1,
|
|
1859
|
+
messages: [],
|
|
1860
|
+
usage: emptyUsage(),
|
|
1861
|
+
error: "Skills not found: pi-subagents",
|
|
1862
|
+
}, options.context));
|
|
1863
|
+
}
|
|
1864
|
+
let systemPrompt = agent.systemPrompt?.trim() || "";
|
|
1865
|
+
if (resolvedSkills.length > 0) {
|
|
1866
|
+
const skillInjection = buildSkillInjection(resolvedSkills);
|
|
1867
|
+
systemPrompt = systemPrompt ? `${systemPrompt}\n\n${skillInjection}` : skillInjection;
|
|
1868
|
+
}
|
|
1869
|
+
const memoryInjection = buildAgentMemoryInjection(agent, skillCwd);
|
|
1870
|
+
if (memoryInjection) {
|
|
1871
|
+
systemPrompt = systemPrompt ? `${systemPrompt}\n\n${memoryInjection}` : memoryInjection;
|
|
1872
|
+
}
|
|
1873
|
+
systemPrompt = appendAgentRefinementOverlay(systemPrompt, { cwd: skillCwd, agentName });
|
|
1874
|
+
systemPrompt = injectOutputPathSystemPrompt(systemPrompt, options.outputPath, agent);
|
|
1875
|
+
|
|
1876
|
+
const candidates = buildModelCandidates(
|
|
1877
|
+
options.modelOverride ?? agent.model,
|
|
1878
|
+
agent.fallbackModels,
|
|
1879
|
+
options.availableModels,
|
|
1880
|
+
agent.modelProvider ?? options.preferredModelProvider,
|
|
1881
|
+
{
|
|
1882
|
+
scope: options.modelScope,
|
|
1883
|
+
primaryModelFromParent: options.modelOverrideFromParent,
|
|
1884
|
+
origin: options.modelOrigin ?? (options.modelOverrideFromParent ? "inherited" : "configured"),
|
|
1885
|
+
},
|
|
1886
|
+
);
|
|
1887
|
+
if (options.workflowChildPermitLaunch && candidates.length > 1) {
|
|
1888
|
+
const error = "Workflow child permit does not support model fallback.";
|
|
1889
|
+
return redactResultPrompt(withRunContext({
|
|
1890
|
+
index: options.index ?? 0,
|
|
1891
|
+
agent: agent.name,
|
|
1892
|
+
task,
|
|
1893
|
+
exitCode: 1,
|
|
1894
|
+
messages: [],
|
|
1895
|
+
usage: emptyUsage(),
|
|
1896
|
+
error,
|
|
1897
|
+
}, options.context));
|
|
1898
|
+
}
|
|
1899
|
+
try {
|
|
1900
|
+
for (const candidate of candidates) {
|
|
1901
|
+
const model = applyThinkingSuffix(candidate, options.thinkingOverride ?? agent.thinking, options.thinkingOverride !== undefined);
|
|
1902
|
+
assertThinkingWithinCeiling({ model, configThinking: options.thinkingOverride ?? agent.thinking, ceiling: options.thinkingCeiling, agent: agent.name, runId: options.runId });
|
|
1903
|
+
}
|
|
1904
|
+
} catch (error) {
|
|
1905
|
+
return redactResultPrompt(withRunContext({
|
|
1906
|
+
index: options.index ?? 0,
|
|
1907
|
+
agent: agent.name,
|
|
1908
|
+
task,
|
|
1909
|
+
exitCode: 1,
|
|
1910
|
+
messages: [],
|
|
1911
|
+
usage: emptyUsage(),
|
|
1912
|
+
error: error instanceof Error ? error.message : String(error),
|
|
1913
|
+
}, options.context));
|
|
1914
|
+
}
|
|
1915
|
+
const attemptedModels: string[] = [];
|
|
1916
|
+
const modelAttempts: ModelAttempt[] = [];
|
|
1917
|
+
const aggregateUsage = emptyUsage();
|
|
1918
|
+
const attemptNotes: string[] = [];
|
|
1919
|
+
const launchWarnings = { emitted: false };
|
|
1920
|
+
let totalToolCount = 0;
|
|
1921
|
+
let totalDurationMs = 0;
|
|
1922
|
+
|
|
1923
|
+
let artifactPathsResult: ArtifactPaths | undefined;
|
|
1924
|
+
let jsonlPath: string | undefined;
|
|
1925
|
+
let transcriptWriter: ChildTranscriptWriter | undefined;
|
|
1926
|
+
if (options.artifactsDir && options.artifactConfig?.enabled !== false) {
|
|
1927
|
+
artifactPathsResult = getArtifactPaths(options.artifactsDir, options.runId, agentName, options.index);
|
|
1928
|
+
ensureArtifactsDir(options.artifactsDir);
|
|
1929
|
+
if (options.artifactConfig?.includeInput !== false) {
|
|
1930
|
+
writeArtifact(artifactPathsResult.inputPath, `# Task for ${agentName}\n\n${PROMPT_REDACTED}; live Prompt Audit only.\n`);
|
|
1931
|
+
}
|
|
1932
|
+
if (options.artifactConfig?.includeJsonl !== false) {
|
|
1933
|
+
jsonlPath = artifactPathsResult.jsonlPath;
|
|
1934
|
+
}
|
|
1935
|
+
if (options.artifactConfig?.includeTranscript !== false) {
|
|
1936
|
+
transcriptWriter = createChildTranscriptWriter({
|
|
1937
|
+
transcriptPath: artifactPathsResult.transcriptPath,
|
|
1938
|
+
source: "foreground",
|
|
1939
|
+
runId: options.runId,
|
|
1940
|
+
agent: agentName,
|
|
1941
|
+
childIndex: options.index,
|
|
1942
|
+
cwd: options.cwd ?? runtimeCwd,
|
|
1943
|
+
});
|
|
1944
|
+
transcriptWriter.writeInitialUserMessage(`${PROMPT_REDACTED}; live Prompt Audit only.`);
|
|
1945
|
+
}
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
const orcaProgressTab = createOrcaProgressTab({
|
|
1949
|
+
cwd: options.cwd ?? runtimeCwd,
|
|
1950
|
+
runId: options.runId,
|
|
1951
|
+
agent: agentName,
|
|
1952
|
+
index: options.index ?? 0,
|
|
1953
|
+
});
|
|
1954
|
+
if (orcaProgressTab) options.onOrcaProgressTabCreated?.(orcaProgressTab);
|
|
1955
|
+
|
|
1956
|
+
const persistResultMetadata = (target: SingleResult): void => {
|
|
1957
|
+
persistSingleResultMetadata({
|
|
1958
|
+
metadataPath: artifactPathsResult?.metadataPath,
|
|
1959
|
+
enabled: options.artifactConfig?.enabled !== false && options.artifactConfig?.includeMetadata !== false,
|
|
1960
|
+
runId: options.runId,
|
|
1961
|
+
agent: agentName,
|
|
1962
|
+
task,
|
|
1963
|
+
result: target,
|
|
1964
|
+
});
|
|
1965
|
+
};
|
|
1966
|
+
|
|
1967
|
+
let intercomDetached = false;
|
|
1968
|
+
let detachedReason: string | undefined;
|
|
1969
|
+
const attemptOptions: RunSyncOptions = {
|
|
1970
|
+
...options,
|
|
1971
|
+
onDetachReceipt: (receipt) => {
|
|
1972
|
+
receipt.acceptance = buildPendingAcceptanceLedger(effectiveAcceptance);
|
|
1973
|
+
try {
|
|
1974
|
+
persistResultMetadata(receipt);
|
|
1975
|
+
} catch (error) {
|
|
1976
|
+
receipt.metadataSaveError = error instanceof Error ? error.message : String(error);
|
|
1977
|
+
}
|
|
1978
|
+
const accepted = options.onDetachReceipt?.(receipt) === true;
|
|
1979
|
+
if (accepted) {
|
|
1980
|
+
detachedReason = receipt.detachedReason;
|
|
1981
|
+
if (receipt.detachedReason === "intercom coordination") intercomDetached = true;
|
|
1982
|
+
}
|
|
1983
|
+
return accepted;
|
|
1984
|
+
},
|
|
1985
|
+
};
|
|
1986
|
+
let lastResult: SingleResult | undefined;
|
|
1987
|
+
const modelsToTry = candidates.length > 0 ? candidates : [undefined];
|
|
1988
|
+
// Escalated to "file" after an unexplained zero-activity startup failure so
|
|
1989
|
+
// retries keep the task text out of argv (endpoint pre-exec scans may deny it).
|
|
1990
|
+
let taskDeliveryOverride: SubagentTaskDelivery | undefined;
|
|
1991
|
+
let abortRecoveryAttempted = false;
|
|
1992
|
+
let nextAttemptTask = taskWithAcceptance;
|
|
1993
|
+
modelAttemptsLoop: for (let modelIndex = 0; modelIndex < modelsToTry.length; modelIndex++) {
|
|
1994
|
+
const candidate = modelsToTry[modelIndex];
|
|
1995
|
+
for (let startupAttemptIndex = 0; ; startupAttemptIndex++) {
|
|
1996
|
+
const recoveringAbort = abortRecoveryAttempted;
|
|
1997
|
+
const attemptTask = nextAttemptTask;
|
|
1998
|
+
const verifyModel = Boolean(candidate) && !(options.modelOverrideFromParent && modelIndex === 0);
|
|
1999
|
+
const outputSnapshot = captureSingleOutputSnapshot(options.outputPath);
|
|
2000
|
+
const result = await runSingleAttempt(runtimeCwd, agent, attemptTask, candidate, attemptOptions, {
|
|
2001
|
+
sessionEnabled,
|
|
2002
|
+
systemPrompt,
|
|
2003
|
+
resolvedSkillNames: resolvedSkills.length > 0 ? resolvedSkills.map((skill) => skill.name) : undefined,
|
|
2004
|
+
skillsWarning: missingSkills.length > 0 ? `Skills not found: ${missingSkills.join(", ")}` : undefined,
|
|
2005
|
+
jsonlPath,
|
|
2006
|
+
artifactPaths: artifactPathsResult,
|
|
2007
|
+
transcriptWriter,
|
|
2008
|
+
attemptNotes,
|
|
2009
|
+
modelCandidates: candidates
|
|
2010
|
+
.map((modelCandidate) => applyThinkingSuffix(modelCandidate, options.thinkingOverride ?? agent.thinking, options.thinkingOverride !== undefined))
|
|
2011
|
+
.filter((modelCandidate): modelCandidate is string => Boolean(modelCandidate)),
|
|
2012
|
+
outputSnapshot,
|
|
2013
|
+
originalTask: task,
|
|
2014
|
+
taskDelivery: taskDeliveryOverride,
|
|
2015
|
+
orcaProgressTab,
|
|
2016
|
+
launchWarnings,
|
|
2017
|
+
verifyModel,
|
|
2018
|
+
});
|
|
2019
|
+
lastResult = result;
|
|
2020
|
+
if (!recoveringAbort && startupAttemptIndex === 0) {
|
|
2021
|
+
if (result.model) attemptedModels.push(result.model);
|
|
2022
|
+
else if (candidate) attemptedModels.push(candidate);
|
|
2023
|
+
}
|
|
2024
|
+
sumUsage(aggregateUsage, result.usage);
|
|
2025
|
+
totalToolCount += result.progressSummary?.toolCount ?? 0;
|
|
2026
|
+
totalDurationMs += result.progressSummary?.durationMs ?? 0;
|
|
2027
|
+
const attemptSucceeded = result.exitCode === 0 && !result.error;
|
|
2028
|
+
const attempt: ModelAttempt = {
|
|
2029
|
+
model: result.model ?? candidate ?? agent.model ?? "default",
|
|
2030
|
+
success: attemptSucceeded,
|
|
2031
|
+
exitCode: result.exitCode,
|
|
2032
|
+
error: result.error,
|
|
2033
|
+
usage: { ...result.usage },
|
|
2034
|
+
};
|
|
2035
|
+
modelAttempts.push(attempt);
|
|
2036
|
+
if (!attemptSucceeded) {
|
|
2037
|
+
const afterCompactionSettlement = (result as AbortRecoverySingleResult)[AFTER_COMPACTION_SETTLEMENT];
|
|
2038
|
+
const abortRecovery = planAbortRecovery({
|
|
2039
|
+
messages: result.messages ?? [],
|
|
2040
|
+
error: result.error,
|
|
2041
|
+
processSignal: result.processSignal,
|
|
2042
|
+
sessionAvailable: Boolean(options.sessionFile && existsSync(options.sessionFile)),
|
|
2043
|
+
alreadyResumed: abortRecoveryAttempted,
|
|
2044
|
+
stopped: result.stopped || result.detached || options.signal?.aborted,
|
|
2045
|
+
interrupted: result.interrupted || intercomDetached || options.interruptSignal?.aborted,
|
|
2046
|
+
timedOut: result.timedOut,
|
|
2047
|
+
toolBudgetExhausted: result.toolBudgetBlocked,
|
|
2048
|
+
usageBudgetExhausted: false,
|
|
2049
|
+
structuredOutputFailed: result.structuredOutputFailed,
|
|
2050
|
+
acceptanceFailed: false,
|
|
2051
|
+
currentTool: result.progress?.currentTool,
|
|
2052
|
+
afterCompactionSettlement,
|
|
2053
|
+
});
|
|
2054
|
+
if (abortRecovery.action === "resume") {
|
|
2055
|
+
abortRecoveryAttempted = true;
|
|
2056
|
+
nextAttemptTask = abortRecovery.prompt;
|
|
2057
|
+
attemptNotes.push("[abort-recovery] provider/transport abort after useful progress; resuming the retained child session once.");
|
|
2058
|
+
continue;
|
|
2059
|
+
}
|
|
2060
|
+
if (abortRecovery.diagnostic) {
|
|
2061
|
+
result.error = result.error ? `${result.error}\n${abortRecovery.diagnostic}` : abortRecovery.diagnostic;
|
|
2062
|
+
attempt.error = result.error;
|
|
2063
|
+
break modelAttemptsLoop;
|
|
2064
|
+
}
|
|
2065
|
+
}
|
|
2066
|
+
if (recoveringAbort && !attemptSucceeded) break modelAttemptsLoop;
|
|
2067
|
+
if (options.workflowChildPermitLaunch && !attemptSucceeded) break modelAttemptsLoop;
|
|
2068
|
+
// Preserve the legacy intercom handoff contract: once this logical run has
|
|
2069
|
+
// been handed to a supervisor, terminating that attempt must not launch a
|
|
2070
|
+
// startup retry or model fallback. Explicit user detach retains fallback.
|
|
2071
|
+
if (intercomDetached || result.timedOut) break modelAttemptsLoop;
|
|
2072
|
+
if (attemptSucceeded) break modelAttemptsLoop;
|
|
2073
|
+
|
|
2074
|
+
const startupFailure = isRetryableSubagentStartupFailure({
|
|
2075
|
+
exitCode: result.exitCode,
|
|
2076
|
+
error: result.error,
|
|
2077
|
+
finalOutput: result.finalOutput,
|
|
2078
|
+
messageCount: result.messages?.length ?? 0,
|
|
2079
|
+
toolCount: result.progressSummary?.toolCount ?? 0,
|
|
2080
|
+
usage: result.usage,
|
|
2081
|
+
durationMs: result.progressSummary?.durationMs ?? Number.POSITIVE_INFINITY,
|
|
2082
|
+
protocolError: result.protocolError,
|
|
2083
|
+
processSignal: result.processSignal,
|
|
2084
|
+
detached: result.detached,
|
|
2085
|
+
interrupted: result.interrupted,
|
|
2086
|
+
timedOut: result.timedOut,
|
|
2087
|
+
stopped: result.stopped,
|
|
2088
|
+
});
|
|
2089
|
+
const retryDelayMs = SUBAGENT_STARTUP_RETRY_DELAYS_MS[startupAttemptIndex];
|
|
2090
|
+
if (startupFailure && retryDelayMs !== undefined) {
|
|
2091
|
+
const retryNote = formatSubagentStartupRetryNote({
|
|
2092
|
+
model: attempt.model,
|
|
2093
|
+
attempt: startupAttemptIndex + 1,
|
|
2094
|
+
maxAttempts: SUBAGENT_STARTUP_RETRY_DELAYS_MS.length + 1,
|
|
2095
|
+
delayMs: retryDelayMs,
|
|
2096
|
+
});
|
|
2097
|
+
const shouldRetry = await waitForSubagentStartupRetry(retryDelayMs, [options.signal, options.interruptSignal]);
|
|
2098
|
+
if (!shouldRetry) {
|
|
2099
|
+
if (options.interruptSignal?.aborted) {
|
|
2100
|
+
result.exitCode = 0;
|
|
2101
|
+
result.interrupted = true;
|
|
2102
|
+
result.error = undefined;
|
|
2103
|
+
result.finalOutput = "Interrupted. Waiting for explicit next action.";
|
|
2104
|
+
if (result.progress) {
|
|
2105
|
+
result.progress.status = "running";
|
|
2106
|
+
result.progress.error = undefined;
|
|
2107
|
+
}
|
|
2108
|
+
} else {
|
|
2109
|
+
const cancellationError = "Subagent startup retry cancelled before relaunch.";
|
|
2110
|
+
result.error = cancellationError;
|
|
2111
|
+
result.finalOutput = cancellationError;
|
|
2112
|
+
attempt.error = cancellationError;
|
|
2113
|
+
if (result.progress) result.progress.error = cancellationError;
|
|
2114
|
+
}
|
|
2115
|
+
break modelAttemptsLoop;
|
|
2116
|
+
}
|
|
2117
|
+
if (!taskDeliveryOverride && result.processSignal === "SIGKILL") {
|
|
2118
|
+
taskDeliveryOverride = "file";
|
|
2119
|
+
attemptNotes.push("[startup-retry] retrying with file task delivery to keep the task text out of the child process argv.");
|
|
2120
|
+
}
|
|
2121
|
+
attempt.error = retryNote;
|
|
2122
|
+
attemptNotes.push(retryNote);
|
|
2123
|
+
continue;
|
|
2124
|
+
}
|
|
2125
|
+
if (startupFailure) {
|
|
2126
|
+
const startupError = formatSubagentStartupRetryExhaustedError({
|
|
2127
|
+
model: attempt.model,
|
|
2128
|
+
attempts: startupAttemptIndex + 1,
|
|
2129
|
+
});
|
|
2130
|
+
result.error = startupError;
|
|
2131
|
+
result.finalOutput = startupError;
|
|
2132
|
+
if (result.progress) {
|
|
2133
|
+
result.progress.error = startupError;
|
|
2134
|
+
result.progress.status = "failed";
|
|
2135
|
+
}
|
|
2136
|
+
attempt.error = startupError;
|
|
2137
|
+
break modelAttemptsLoop;
|
|
2138
|
+
}
|
|
2139
|
+
const retryableModelFailure = isRetryableModelFailureAttempt({ error: result.error, messages: result.messages, toolCount: result.progressSummary?.toolCount });
|
|
2140
|
+
if (retryableModelFailure) recordRetryableModelFailure(result.model ?? candidate, result.error);
|
|
2141
|
+
if (isContextOverflow(result.error)) {
|
|
2142
|
+
result.contextOverflow = true;
|
|
2143
|
+
attemptNotes.push(`[fallback] ${attempt.model} failed: context overflow — the input exceeds this model's context window. Reduce the task input or use a model with a larger context window.`);
|
|
2144
|
+
break modelAttemptsLoop;
|
|
2145
|
+
}
|
|
2146
|
+
if (!retryableModelFailure || modelIndex === modelsToTry.length - 1) break modelAttemptsLoop;
|
|
2147
|
+
attemptNotes.push(formatModelAttemptNote(attempt, modelsToTry[modelIndex + 1]));
|
|
2148
|
+
break;
|
|
2149
|
+
}
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
const result = withRunContext(lastResult ?? {
|
|
2153
|
+
index: options.index ?? 0,
|
|
2154
|
+
agent: agentName,
|
|
2155
|
+
task,
|
|
2156
|
+
exitCode: 1,
|
|
2157
|
+
messages: [],
|
|
2158
|
+
usage: emptyUsage(),
|
|
2159
|
+
error: "Subagent did not produce a result.",
|
|
2160
|
+
} satisfies SingleResult, options.context);
|
|
2161
|
+
result.task = task;
|
|
2162
|
+
|
|
2163
|
+
result.usage = aggregateUsage;
|
|
2164
|
+
result.attemptedModels = attemptedModels.length > 0 ? attemptedModels : undefined;
|
|
2165
|
+
result.modelAttempts = modelAttempts.length > 0 ? modelAttempts : undefined;
|
|
2166
|
+
result.progressSummary = {
|
|
2167
|
+
...(childSessionName ? { sessionName: childSessionName } : {}),
|
|
2168
|
+
toolCount: totalToolCount,
|
|
2169
|
+
tokens: aggregateUsage.input + aggregateUsage.output,
|
|
2170
|
+
durationMs: totalDurationMs,
|
|
2171
|
+
};
|
|
2172
|
+
if (transcriptWriter) result.transcriptPath = artifactPathsResult?.transcriptPath;
|
|
2173
|
+
if (transcriptWriter?.getError()) result.transcriptError = transcriptWriter.getError();
|
|
2174
|
+
|
|
2175
|
+
try {
|
|
2176
|
+
if (artifactPathsResult && options.artifactConfig?.enabled !== false) {
|
|
2177
|
+
result.artifactPaths = artifactPathsResult;
|
|
2178
|
+
if (options.artifactConfig?.includeOutput !== false) {
|
|
2179
|
+
writeArtifact(artifactPathsResult.outputPath, formatOutputArtifactContent({
|
|
2180
|
+
output: artifactOutputByResult.get(result) ?? result.finalOutput ?? "",
|
|
2181
|
+
error: result.error,
|
|
2182
|
+
transcriptPath: result.transcriptPath,
|
|
2183
|
+
metadataPath: options.artifactConfig?.includeMetadata === false ? undefined : artifactPathsResult.metadataPath,
|
|
2184
|
+
}));
|
|
2185
|
+
}
|
|
2186
|
+
if (options.maxOutput) {
|
|
2187
|
+
const config = { ...DEFAULT_MAX_OUTPUT, ...options.maxOutput };
|
|
2188
|
+
const truncationResult = truncateOutput(result.finalOutput ?? "", config, artifactPathsResult.outputPath);
|
|
2189
|
+
if (truncationResult.truncated) result.truncation = truncationResult;
|
|
2190
|
+
}
|
|
2191
|
+
} else if (options.maxOutput) {
|
|
2192
|
+
const config = { ...DEFAULT_MAX_OUTPUT, ...options.maxOutput };
|
|
2193
|
+
const truncationResult = truncateOutput(result.finalOutput ?? "", config);
|
|
2194
|
+
if (truncationResult.truncated) result.truncation = truncationResult;
|
|
2195
|
+
}
|
|
2196
|
+
} catch (error) {
|
|
2197
|
+
const message = `Artifact output post-processing failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
2198
|
+
result.outputSaveError = result.outputSaveError ? `${result.outputSaveError}\n${message}` : message;
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
if (options.sessionFile && (existsSync(options.sessionFile) || result.messages?.length)) {
|
|
2202
|
+
result.sessionFile = options.sessionFile;
|
|
2203
|
+
} else if (shareEnabled && options.sessionDir) {
|
|
2204
|
+
const sessionFile = findLatestSessionFile(options.sessionDir);
|
|
2205
|
+
if (sessionFile) result.sessionFile = sessionFile;
|
|
2206
|
+
}
|
|
2207
|
+
|
|
2208
|
+
const childWrittenOutput = options.outputPath
|
|
2209
|
+
? extractChildWrittenOutput(result.messages, options.outputPath, options.cwd ?? runtimeCwd)
|
|
2210
|
+
: undefined;
|
|
2211
|
+
try {
|
|
2212
|
+
if (result.interrupted && detachedReason === "user request") {
|
|
2213
|
+
// Only an accepted user-detach receipt needs a non-rejecting terminal
|
|
2214
|
+
// ledger. Attached and background execution retain their baseline
|
|
2215
|
+
// acceptance behavior.
|
|
2216
|
+
result.acceptance = buildInterruptedAcceptanceLedger(effectiveAcceptance);
|
|
2217
|
+
} else if (result.stopped) {
|
|
2218
|
+
result.acceptance = buildSkippedAcceptanceLedger(effectiveAcceptance, { id: "stopped", message: "Acceptance was not evaluated because the subagent was stopped." });
|
|
2219
|
+
} else if (result.timedOut) {
|
|
2220
|
+
result.acceptance = buildSkippedAcceptanceLedger(effectiveAcceptance, { id: "timeout", message: "Acceptance was not evaluated because the subagent timed out." });
|
|
2221
|
+
} else {
|
|
2222
|
+
result.acceptance = await evaluateAcceptance({
|
|
2223
|
+
acceptance: effectiveAcceptance,
|
|
2224
|
+
output: acceptanceOutputByResult.get(result) ?? result.finalOutput ?? "",
|
|
2225
|
+
report: (result as SingleResult & { structuredAcceptanceReport?: import("../../shared/types.ts").AcceptanceReport; structuredAcceptanceReportError?: string }).structuredAcceptanceReport,
|
|
2226
|
+
reportError: (result as SingleResult & { structuredAcceptanceReport?: import("../../shared/types.ts").AcceptanceReport; structuredAcceptanceReportError?: string }).structuredAcceptanceReportError,
|
|
2227
|
+
fileOutput: childWrittenOutput !== undefined && options.outputPath
|
|
2228
|
+
? { content: childWrittenOutput, path: options.outputPath, authoritative: options.outputMode === "file-only", durable: result.savedOutputPath !== undefined }
|
|
2229
|
+
: undefined,
|
|
2230
|
+
cwd: options.cwd ?? runtimeCwd,
|
|
2231
|
+
reportOptional: isAgentContractV1(options.agentContract),
|
|
2232
|
+
artifactsDir: options.artifactsDir,
|
|
2233
|
+
runId: options.runId,
|
|
2234
|
+
});
|
|
2235
|
+
}
|
|
2236
|
+
} catch (error) {
|
|
2237
|
+
const message = `Acceptance evaluation failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
2238
|
+
result.acceptance = buildSkippedAcceptanceLedger(effectiveAcceptance, { id: "acceptance-evaluation", message });
|
|
2239
|
+
}
|
|
2240
|
+
const acceptanceFailure = acceptanceFailureMessage(result.acceptance);
|
|
2241
|
+
stripAcceptanceReportsFromMessages(result.messages);
|
|
2242
|
+
if (acceptanceFailure && result.acceptance.explicit && result.exitCode === 0 && !result.interrupted && !result.timedOut && !isAgentContractV1(options.agentContract)) {
|
|
2243
|
+
result.exitCode = 1;
|
|
2244
|
+
if (result.savedOutputPath) {
|
|
2245
|
+
result.finalOutput = finalizeSingleOutput({
|
|
2246
|
+
fullOutput: result.finalOutput ?? "",
|
|
2247
|
+
outputPath: options.outputPath,
|
|
2248
|
+
outputMode: result.outputMode,
|
|
2249
|
+
exitCode: result.exitCode,
|
|
2250
|
+
preserveSavedOutput: true,
|
|
2251
|
+
savedPath: result.savedOutputPath,
|
|
2252
|
+
outputReference: result.outputReference,
|
|
2253
|
+
}).displayOutput;
|
|
2254
|
+
artifactOutputByResult.set(result, result.finalOutput);
|
|
2255
|
+
}
|
|
2256
|
+
result.error = result.error ? `${result.error}\n${acceptanceFailure}` : acceptanceFailure;
|
|
2257
|
+
if (artifactPathsResult && options.artifactConfig?.enabled !== false && options.artifactConfig?.includeOutput !== false) {
|
|
2258
|
+
try {
|
|
2259
|
+
writeArtifact(artifactPathsResult.outputPath, formatOutputArtifactContent({
|
|
2260
|
+
output: artifactOutputByResult.get(result) ?? result.finalOutput ?? "",
|
|
2261
|
+
error: result.error,
|
|
2262
|
+
transcriptPath: result.transcriptPath,
|
|
2263
|
+
metadataPath: options.artifactConfig?.includeMetadata === false ? undefined : artifactPathsResult.metadataPath,
|
|
2264
|
+
}));
|
|
2265
|
+
} catch (error) {
|
|
2266
|
+
const message = `Artifact output post-processing failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
2267
|
+
result.outputSaveError = result.outputSaveError ? `${result.outputSaveError}\n${message}` : message;
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
if (result.progress) {
|
|
2271
|
+
result.progress.status = "failed";
|
|
2272
|
+
result.progress.error = result.error;
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2275
|
+
if (isAgentContractV1(options.agentContract)) attachContractProjections(result);
|
|
2276
|
+
redactResultPrompt(result);
|
|
2277
|
+
try {
|
|
2278
|
+
persistResultMetadata(result);
|
|
2279
|
+
} catch (error) {
|
|
2280
|
+
result.metadataSaveError = error instanceof Error ? error.message : String(error);
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
return result;
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
async function runSyncCompletion(
|
|
2287
|
+
runtimeCwd: string,
|
|
2288
|
+
agents: AgentConfig[],
|
|
2289
|
+
agentName: string,
|
|
2290
|
+
task: string,
|
|
2291
|
+
options: RunSyncOptions,
|
|
2292
|
+
): Promise<SingleResult> {
|
|
2293
|
+
let orcaProgressTab: OrcaProgressTab | undefined;
|
|
2294
|
+
try {
|
|
2295
|
+
const result = await runSyncCompletionInner(runtimeCwd, agents, agentName, task, {
|
|
2296
|
+
...options,
|
|
2297
|
+
onOrcaProgressTabCreated: (tab) => { orcaProgressTab = tab; },
|
|
2298
|
+
});
|
|
2299
|
+
orcaProgressTab?.finish(result.stopped ? "stopped" : result.exitCode === 0 && !result.error ? "completed" : "failed", result.sessionFile);
|
|
2300
|
+
return result;
|
|
2301
|
+
} catch (error) {
|
|
2302
|
+
orcaProgressTab?.finish("failed");
|
|
2303
|
+
throw error;
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
/**
|
|
2308
|
+
* Runs the authoritative completion pipeline independently from the foreground
|
|
2309
|
+
* receipt. Detachment is same-runtime only: it does not adopt or daemonize work.
|
|
2310
|
+
*/
|
|
2311
|
+
export async function runSync(
|
|
2312
|
+
runtimeCwd: string,
|
|
2313
|
+
agents: AgentConfig[],
|
|
2314
|
+
agentName: string,
|
|
2315
|
+
task: string,
|
|
2316
|
+
options: RunSyncOptions,
|
|
2317
|
+
): Promise<SingleResult> {
|
|
2318
|
+
// Capture the strict contract before consumer-owned objects can be mutated
|
|
2319
|
+
// after a detached receipt is published.
|
|
2320
|
+
const strictContract = isAgentContractV1(options.agentContract);
|
|
2321
|
+
let detachedReason: string | undefined;
|
|
2322
|
+
let publishedReceipt: SingleResult | undefined;
|
|
2323
|
+
let activeDetachAttempt: ((reason?: string) => boolean) | undefined;
|
|
2324
|
+
let detachReadyPublished = false;
|
|
2325
|
+
let resolveReceipt!: (result: SingleResult) => void;
|
|
2326
|
+
const receipt = new Promise<SingleResult>((resolve) => { resolveReceipt = resolve; });
|
|
2327
|
+
const originSignal = options.signal;
|
|
2328
|
+
const originController = new AbortController();
|
|
2329
|
+
const forwardOriginAbort = () => {
|
|
2330
|
+
if (!detachedReason) originController.abort(originSignal?.reason);
|
|
2331
|
+
};
|
|
2332
|
+
if (originSignal?.aborted) forwardOriginAbort();
|
|
2333
|
+
else originSignal?.addEventListener("abort", forwardOriginAbort, { once: true });
|
|
2334
|
+
|
|
2335
|
+
const completion = runSyncCompletion(runtimeCwd, agents, agentName, task, {
|
|
2336
|
+
...options,
|
|
2337
|
+
signal: originController.signal,
|
|
2338
|
+
onDetachedExit: undefined,
|
|
2339
|
+
onDetachReceipt: (detachedReceipt) => {
|
|
2340
|
+
if (detachedReason || publishedReceipt) return false;
|
|
2341
|
+
// Keep the authoritative result, fallback snapshot, and caller receipt
|
|
2342
|
+
// separately owned while the completion pipeline remains live.
|
|
2343
|
+
publishedReceipt = structuredClone(detachedReceipt);
|
|
2344
|
+
const callerReceipt = structuredClone(detachedReceipt);
|
|
2345
|
+
// A strict contract was already validated before detach; normalize private
|
|
2346
|
+
// and caller snapshots to the only safely known version.
|
|
2347
|
+
publishedReceipt.agentContract = strictContract ? { version: 1 } : undefined;
|
|
2348
|
+
callerReceipt.agentContract = strictContract ? { version: 1 } : undefined;
|
|
2349
|
+
detachedReason = detachedReceipt.detachedReason ?? "user request";
|
|
2350
|
+
resolveReceipt(callerReceipt);
|
|
2351
|
+
return true;
|
|
2352
|
+
},
|
|
2353
|
+
onDetachReady: (detachAttempt) => {
|
|
2354
|
+
activeDetachAttempt = detachAttempt;
|
|
2355
|
+
if (detachReadyPublished) return;
|
|
2356
|
+
detachReadyPublished = true;
|
|
2357
|
+
options.onDetachReady?.((reason = "user request") => {
|
|
2358
|
+
if (detachedReason || originController.signal.aborted) return false;
|
|
2359
|
+
return activeDetachAttempt?.(reason) ?? false;
|
|
2360
|
+
});
|
|
2361
|
+
},
|
|
2362
|
+
});
|
|
2363
|
+
|
|
2364
|
+
const authoritativeCompletion = completion.catch((error: unknown) => {
|
|
2365
|
+
if (!publishedReceipt || !detachedReason) throw error;
|
|
2366
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2367
|
+
const failureMessage = `Detached completion pipeline failed after receipt: ${message}`;
|
|
2368
|
+
const failedProgress: AgentProgress = publishedReceipt.progress
|
|
2369
|
+
? { ...publishedReceipt.progress, status: "failed", error: failureMessage }
|
|
2370
|
+
: {
|
|
2371
|
+
index: options.index ?? 0,
|
|
2372
|
+
agent: publishedReceipt.agent,
|
|
2373
|
+
status: "failed",
|
|
2374
|
+
task: publishedReceipt.task,
|
|
2375
|
+
recentTools: [],
|
|
2376
|
+
recentOutput: [],
|
|
2377
|
+
toolCount: publishedReceipt.progressSummary?.toolCount ?? 0,
|
|
2378
|
+
tokens: publishedReceipt.progressSummary?.tokens ?? 0,
|
|
2379
|
+
durationMs: publishedReceipt.progressSummary?.durationMs ?? 0,
|
|
2380
|
+
error: failureMessage,
|
|
2381
|
+
};
|
|
2382
|
+
const failedResult: SingleResult = redactResultPrompt({
|
|
2383
|
+
...publishedReceipt,
|
|
2384
|
+
detached: undefined,
|
|
2385
|
+
detachedReason,
|
|
2386
|
+
exitCode: 1,
|
|
2387
|
+
error: failureMessage,
|
|
2388
|
+
finalOutput: failureMessage,
|
|
2389
|
+
progress: failedProgress,
|
|
2390
|
+
progressSummary: {
|
|
2391
|
+
toolCount: failedProgress.toolCount,
|
|
2392
|
+
tokens: failedProgress.tokens,
|
|
2393
|
+
durationMs: failedProgress.durationMs,
|
|
2394
|
+
},
|
|
2395
|
+
acceptance: publishedReceipt.acceptance
|
|
2396
|
+
? buildSkippedAcceptanceLedger(publishedReceipt.acceptance.effectiveAcceptance, { id: "completion-pipeline", message: failureMessage })
|
|
2397
|
+
: undefined,
|
|
2398
|
+
});
|
|
2399
|
+
if (strictContract) attachContractProjections(failedResult);
|
|
2400
|
+
try {
|
|
2401
|
+
// Replace the provisional detach receipt metadata with the authoritative
|
|
2402
|
+
// terminal failure. Persistence remains best-effort and cannot orphan work.
|
|
2403
|
+
persistSingleResultMetadata({
|
|
2404
|
+
metadataPath: failedResult.artifactPaths?.metadataPath,
|
|
2405
|
+
enabled: options.artifactConfig?.enabled !== false && options.artifactConfig?.includeMetadata !== false,
|
|
2406
|
+
runId: options.runId,
|
|
2407
|
+
agent: failedResult.agent,
|
|
2408
|
+
task: failedResult.task,
|
|
2409
|
+
result: failedResult,
|
|
2410
|
+
});
|
|
2411
|
+
} catch (metadataError) {
|
|
2412
|
+
failedResult.metadataSaveError = metadataError instanceof Error ? metadataError.message : String(metadataError);
|
|
2413
|
+
}
|
|
2414
|
+
return failedResult;
|
|
2415
|
+
});
|
|
2416
|
+
|
|
2417
|
+
let terminalCallbackInvoked = false;
|
|
2418
|
+
void authoritativeCompletion.then((terminalResult) => {
|
|
2419
|
+
if (!detachedReason || terminalCallbackInvoked) return;
|
|
2420
|
+
terminalCallbackInvoked = true;
|
|
2421
|
+
terminalResult.detached = undefined;
|
|
2422
|
+
terminalResult.detachedReason = detachedReason;
|
|
2423
|
+
try {
|
|
2424
|
+
options.onDetachedExit?.(terminalResult);
|
|
2425
|
+
} catch {
|
|
2426
|
+
// The authoritative result has settled. Consumer callback failures are
|
|
2427
|
+
// contained here; each consumer owns cleanup through its own finally block.
|
|
2428
|
+
}
|
|
2429
|
+
}).catch(() => {
|
|
2430
|
+
// Attached completion rejection remains observable through the returned
|
|
2431
|
+
// promise without becoming an unhandled side-channel rejection.
|
|
2432
|
+
}).finally(() => {
|
|
2433
|
+
originSignal?.removeEventListener("abort", forwardOriginAbort);
|
|
2434
|
+
});
|
|
2435
|
+
|
|
2436
|
+
return Promise.race([authoritativeCompletion, receipt]);
|
|
2437
|
+
}
|