@qqbrowser/qbot-dsh 0.0.10 → 0.0.12
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/lib/bin.js +1 -1
- package/lib/{dump-config-BD79jvHi.js → dump-config-xQTUTTDD.js} +1 -1
- package/lib/{plugin-B3Ecl7VN.js → plugin-DNAeLZbb.js} +1 -1
- package/lib/profile-boot-BkordgJK.js +1 -0
- package/node_modules/@deepseek-ai/cordis/package.json +1 -1
- package/node_modules/@deepseek-ai/cordis-plugin-hmr/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/cordis-plugin-hmr/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-agent/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-agent/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-agent-default-model/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-agent-instructions/lib/index.js +3 -3
- package/node_modules/@deepseek-ai/dsh-agent-instructions/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-agent-loop/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-agent-presets/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-agent-tool-presentation/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-anonymous-user-id/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-api-gateway/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-api-remotes/lib/client.js +2 -2
- package/node_modules/@deepseek-ai/dsh-api-remotes/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-app-boot/lib/index.js +12 -12
- package/node_modules/@deepseek-ai/dsh-app-boot/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-atomic-write/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-attachment/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-attachment-local/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-attachment-local/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-base/cordis.patch.yml +4 -4
- package/node_modules/@deepseek-ai/dsh-base/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-bash-local/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-bash-local/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-bash-sandbox/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-brand/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-connection/lib/client.js +6 -6
- package/node_modules/@deepseek-ai/dsh-client-connection/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-client-connection/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-hmr/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-hmr/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-locale/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-locale/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-modules/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-runtime/lib/client.js +2 -2
- package/node_modules/@deepseek-ai/dsh-client-runtime/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-schema-form/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-agent-preset/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-attachment/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-commands/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-commands/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-conversation/lib/client.js +6 -6
- package/node_modules/@deepseek-ai/dsh-client-ui-conversation/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-cordis/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-cordis/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-deliverables/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-browse/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-directory-picker-native/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-goal/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-goal/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-input-trigger/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-jobs/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-jobs/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-layout/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-layout/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-message-feedback/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-model-selection/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-permission-presets/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-plan/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-plan/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-primitives/lib/index.js +11 -11
- package/node_modules/@deepseek-ai/dsh-client-ui-primitives/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-settings/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-settings-general/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-settings-models/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugin-inventory/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-settings-plugins/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-skill/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-skill/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-slots/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-slots/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-subagent/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-subagent/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-theme/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-theme/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-tool/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-tool/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/lib/client.js +13 -13
- package/node_modules/@deepseek-ai/dsh-client-ui-trajectory/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-user-questions/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-workflow-run/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-workspace/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-workspace/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-web/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-web-react/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-web-react/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-cmdline/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-code-runtime/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-code-runtime-worker-thread/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-code-runtime-worker-thread/lib/worker.cjs +4 -2
- package/node_modules/@deepseek-ai/dsh-code-runtime-worker-thread/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-command-compact/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-command-feedback/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-command-goal/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-commands/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-compaction/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-compaction-basic/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-compaction-basic/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-compaction-tool-result-pruner/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-content-review/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-cordis-client-runner/lib/client.js +7 -7
- package/node_modules/@deepseek-ai/dsh-cordis-client-runner/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-cordis-host-runner/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-credentials/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-credentials-local/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-fs/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-fs-local/lib/index.js +4 -4
- package/node_modules/@deepseek-ai/dsh-fs-local/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-fs-observation-policy/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-fs-sandbox/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-goal/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-goal-round-driver/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-headless/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-home-paths/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-home-paths/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-home-quarantine-macos/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-home-quarantine-macos/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/index.js +4 -4
- package/node_modules/@deepseek-ai/dsh-host-apiproxy/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-host-directory-picker/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-host-directory-picker-auto/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-host-directory-picker-browse/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-host-directory-picker-native/lib/worker.cjs +9 -7
- package/node_modules/@deepseek-ai/dsh-host-directory-picker-native/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-host-frontend-static/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-host-plugin-inventory/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-host-webserver/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-invariants/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-jobs/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-jobs-local/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-launch-environment/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-llm/lib/invariant.js +1 -1
- package/node_modules/@deepseek-ai/dsh-llm/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-deepseek/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-deepseek/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-gateway-openai/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-gateway-openai/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-llm-retry/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-mcp-client/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-mcp-client/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-message-feedback/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-native-command/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-output-retention/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-output-retention/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-permission-presets/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-permission-presets/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-persona/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-plan-mode/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-pwsh-local/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-pwsh-local/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-pwsh-sandbox/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-qb-auth/lib/index.js +3 -3
- package/node_modules/@deepseek-ai/dsh-qb-auth/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-repeat-tool-reminder/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-sandbox/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-sandbox-local/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-sandbox-policy/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/runner.js +1 -1
- package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/types-D2_FQYSK.js +1 -0
- package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-schedule/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-schedule/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-scope/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-session/lib/invariant.js +1 -1
- package/node_modules/@deepseek-ai/dsh-session/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-checkpoint-policy/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-log-export/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-session-log-export/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-persistence/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-session-persistence/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-session-persistence-jsonl/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-projection/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-projection-cache/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-query/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-query-sqlite/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-reference/lib/index.js +4 -4
- package/node_modules/@deepseek-ai/dsh-session-reference/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-stats/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-telemetry/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-telemetry-otel/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-title/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-session-title/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-title-first-prompt-llm/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-title-llm/lib/index.js +3 -3
- package/node_modules/@deepseek-ai/dsh-session-title-llm/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-settings/lib/invariant.js +1 -1
- package/node_modules/@deepseek-ai/dsh-settings/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-settings-file/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-shell/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-shell-env/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-skill/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-skill-badge/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-skill-filesystem/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-skill-filesystem/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-spill/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-spill-local/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-spill-local/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-spill-policy/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-spill-policy/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-storage/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-storage-domain/lib/invariant.js +1 -1
- package/node_modules/@deepseek-ai/dsh-storage-domain/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-storage-json/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-subagent/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-subagent/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-subagent-fork-in-process/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-subagent-in-process-driver/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-subagent-spawn-in-process/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-subprocess/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-subprocess-local/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-system-prompt/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-terminal/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-terminal-bash/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-terminal-bash/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-time-context/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-time-context/lib/invariant.js +1 -1
- package/node_modules/@deepseek-ai/dsh-time-context/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-timeout/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tmux-context/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-token-meter/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-token-meter/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-ask-user/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-bash/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-bash-persistent/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-call-timeout-policy/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-cordis/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-fs/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-tool-fs/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-fs-search/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-fs-search/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-goal/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-jobs/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-pwsh/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-ralph/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-ralph/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-skill/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-str-replace-editor/lib/index.js +6 -6
- package/node_modules/@deepseek-ai/dsh-tool-str-replace-editor/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-subagent/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-subagent-control/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-subagent-report/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-todo/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-web/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-workflow/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-tool-workflow/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tools/lib/index.js +26 -26
- package/node_modules/@deepseek-ai/dsh-tools/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-typert-loader/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-typert-protocol/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-typert-registry/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-user-approval/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-user-questions/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-web/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-web/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-web-app/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/{index-Dqw48FrP.js → index-BQQQ5Qt-.js} +2 -2
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/langs/cpp-DddhVWhK.js +1 -0
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/langs/{php-D-uCvoST.js → php-9bx0az3O.js} +1 -1
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/langs/{ruby-DEItuUFs.js → ruby-HDLHRjSL.js} +1 -1
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/langs/swift-C2oV4EkX.js +1 -0
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/{vendor-Cjbwl5VI.js → vendor-CeMKrCZm.js} +24 -24
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/index.html +2 -2
- package/node_modules/@deepseek-ai/dsh-web-frontend/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-web-search-deepseek/LICENSE +21 -0
- package/node_modules/@deepseek-ai/dsh-web-search-deepseek/lib/index.js +1 -0
- package/node_modules/@deepseek-ai/dsh-web-search-deepseek/lib/invariant.js +1 -0
- package/node_modules/@deepseek-ai/dsh-web-search-deepseek/package.json +1 -0
- package/node_modules/@deepseek-ai/dsh-web-search-dsh/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-web-search-dsh/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-workflow/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-workflow-worker-thread/lib/index.js +2 -2
- package/node_modules/@deepseek-ai/dsh-workflow-worker-thread/lib/worker.cjs +3 -4
- package/node_modules/@deepseek-ai/dsh-workflow-worker-thread/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-workspace/lib/invariant.js +1 -1
- package/node_modules/@deepseek-ai/dsh-workspace/package.json +1 -1
- package/node_modules/@deepseek-ai/node-addon-landlock-run/package.json +1 -1
- package/package.json +1 -1
- package/lib/profile-boot-_PCyp_wB.js +0 -1
- package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/types-BjBvdldw.js +0 -1
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/langs/cpp-DIPi6g--.js +0 -1
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/langs/swift-D82vCrfD.js +0 -1
- /package/lib/{profile-boot-B71dQloK.js → profile-boot-DDo03lXi.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var id=Object.defineProperty;var r=(on,He)=>id(on,"name",{value:He,configurable:!0});window.__ModuleLoader__.load({id:"@deepseek-ai/dsh-client-connection",factory:r(on=>{var He={exports:{}},Ie=He.exports;Object.defineProperty(Ie,Symbol.toStringTag,{value:"Module"});const eo={backoffBaseMs:500,backoffFactor:2,backoffMaxMs:1e4,streamOpenTimeoutMs:3e3};function rn(e,t){return new Promise(n=>{const s=setTimeout(o,e);t.addEventListener("abort",o,{once:!0});function o(){clearTimeout(s),t.removeEventListener("abort",o),n()}r(o,"done")})}r(rn,"sleep");var to=class{static{r(this,"ConnectionController")}api;sinks;generation=0;attempt=0;current=null;running=!1;lastState=null;config;constructor(e,t={},n={}){this.api=e,this.sinks=t,this.config={...eo,...n}}start(){this.running||(this.running=!0,this.loop())}stop(){this.running=!1,this.current?.abort(),this.current=null}backoffDelay(e){const{backoffBaseMs:t,backoffFactor:n,backoffMaxMs:s}=this.config,o=Math.min(s,t*n**Math.max(0,e-1));return o/2+Math.random()*(o/2)}isRunning(){return this.running}isGenerationActive(e){return this.isRunning()&&!e.signal.aborted}async loop(){for(;this.running;){const e=++this.generation,t=new AbortController;this.current=t;let n=r(()=>{},"muxOpened"),s=r(()=>{},"hostOpened");const o=Promise.all([new Promise(u=>{n=u}),new Promise(u=>{s=u})]),a=new Promise(u=>{const f=r(()=>{e===this.generation&&!t.signal.aborted&&t.abort(),u()},"settle");this.pumpStream(this.api.events.mux({},t.signal,n),this.sinks.onMuxEnvelope,f),this.pumpStream(this.api.events.host({},t.signal,s),this.sinks.onHostEnvelope,f)});try{const u=new AbortController,[f]=await Promise.all([this.api.host.describe({}),Promise.race([o,rn(this.config.streamOpenTimeoutMs,u.signal)])]);u.abort();const m=f.result;if(!m.ok)throw new Error(`host.describe failed: ${m.error.code}: ${m.error.message}`);if(t.signal.aborted)throw new Error("generation aborted during readiness handshake");this.attempt=0,this.emitState("connected"),this.isGenerationActive(t)&&this.callSink(()=>{this.sinks.onConnected?.(m.value)})}catch{t.signal.aborted||t.abort()}if(await a,!this.isRunning())return;this.emitState("reconnecting"),this.attempt+=1,console.warn(`[web-runtime] connection lost, retry #${this.attempt}`);const i=new AbortController;await rn(this.backoffDelay(this.attempt),i.signal)}}emitState(e){this.lastState!==e&&(this.lastState=e,this.callSink(()=>this.sinks.onStateChange?.(e)))}async pumpStream(e,t,n){try{for await(const s of e){if(s.payload.type==="stream/error")break;t!==void 0&&this.callSink(()=>{t(s)})}}catch{}n()}callSink(e){try{e()}catch(t){console.error("[web-runtime] connection sink threw:",t)}}};function cd(e){return e}r(cd,"MessageId");function ud(e){return e}r(ud,"CallId");function no(e){const t=new WeakSet,n=[{kind:"visit",node:e}];for(;n.length>0;){const s=n.pop();if(s===void 0)continue;if(s.kind==="property"){n.push({kind:"visit",node:s.source[s.key]});continue}const o=s.node;if(o===null||typeof o!="object"||o instanceof AbortSignal||t.has(o))continue;t.add(o),Object.freeze(o);const a=Object.keys(o);for(let i=a.length-1;i>=0;i--){const u=a[i];u!==void 0&&n.push({kind:"property",source:o,key:u})}}return e}r(no,"deepFreeze");function so(e){return no(structuredClone(e))}r(so,"freezeMessage");function an(e){return so({...e,id:crypto.randomUUID()})}r(an,"createMessage");function cn(e){return an({...e,role:"user"})}r(cn,"createUserMessage");function oo(e){return an({role:"assistant",content:e.content,source:{kind:"model",...e.source}})}r(oo,"createAssistantMessage");function ro(e){return cn({source:{kind:"tool",callId:e.callId},content:[{type:"tool-result",toolCallId:e.callId,content:e.content,isError:e.isError}]})}r(ro,"createToolResultMessage");function ao(e){switch(e.type){case"text-delta":case"reasoning-delta":return e.text!=="";case"tool-call-delta":return e.argumentsDelta!==""||e.name!==void 0;default:return!1}}r(ao,"isTokenDelta");const io=new Set(["user/message","assistant/message","tool/result"]);function co(e){return io.has(e)}r(co,"isSurfaceEligibleType");function uo(e){switch(e.type){case"user/message":return e.data;case"assistant/message":return e.data.message.content.length===0?null:e.data.message;case"tool/result":return e.data.message;default:return null}}r(uo,"deriveEventMessage");function lo(){return{nodes:[],replaceGeneration:0}}r(lo,"createFoldState");function wt(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}r(wt,"isEventSeq");function po(e){const t=e;return Object.keys(t).length===3&&Object.hasOwn(t,"op")&&Object.hasOwn(t,"start")&&Object.hasOwn(t,"end")&&t.op==="replace"&&wt(t.start)&&wt(t.end)}r(po,"isReplaceOp");function fo(e){const t=e;if(!co(e.type)){if(t.surfaceOp!==void 0)throw new Error(`session event "${e.type}" is not surface-eligible and cannot carry surfaceOp`);if(t.sourceEventSeqs!==void 0)throw new Error(`session event "${e.type}" is not surface-eligible and cannot carry sourceEventSeqs`);return}const n=t.surfaceOp;if(n===void 0)throw new Error(`session event "${e.type}" is surface-eligible and requires a surfaceOp marker`);if(n==="append")return n;if(n===null||typeof n!="object"||Array.isArray(n))throw new Error(`session event "${e.type}" carries an invalid surfaceOp`);if(!po(n))throw new Error(`session event "${e.type}" carries an invalid replace surfaceOp`);return n}r(fo,"surfaceOpOf");function un(e,t){const n=e.sourceEventSeqs,s=new Set;if(n!==void 0){if(!Array.isArray(n))throw new Error(`sourceEventSeqs on event at seq ${e.seq} must be an array when present`);if(n.length===0&&e.type!=="assistant/message")throw new Error("sourceEventSeqs must not be empty except on assistant/message");let a;for(const i of n){if(!wt(i))throw new Error(`session event "${e.type}" sourceEventSeqs must densely contain non-negative safe integers`);s.add(i),a===void 0&&i>=e.seq&&(a=i)}if(s.size!==n.length)throw new Error("sourceEventSeqs must not contain duplicates");if(a!==void 0)throw new Error(`sourceEventSeqs must reference earlier events: ${a} >= current seq ${e.seq}`)}const o=t.filter(a=>!s.has(a));if(o.length>0)throw new Error(`surface replace: sourceEventSeqs must include every shadowed surface node; missing ${o.join(", ")}`)}r(un,"assertProvenance");function ho(e,t){const n=e.nodes.indexOf(t.start);if(n===-1)throw new Error(`surface replace: start seq ${t.start} not found in surface`);const s=e.nodes.indexOf(t.end);if(s===-1)throw new Error(`surface replace: end seq ${t.end} not found in surface`);if(n>s)throw new Error(`surface replace: start seq ${t.start} (index ${n}) is after end seq ${t.end} (index ${s})`);return{startIdx:n,endIdx:s,shadowedSeqs:e.nodes.slice(n,s+1)}}r(ho,"replacementRange");function kt(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((o,a)=>kt(o,t[a]));if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;const n=Object.keys(e),s=t;return n.length!==Object.keys(t).length?!1:n.every(o=>Object.hasOwn(t,o)&&kt(e[o],s[o]))}r(kt,"isDeepEqualJson");function mo(e,t,n,s){if(e.type==="tool/result"){if(t.length!==1)throw new Error("tool/result surface replacement must rewrite exactly one current node");for(const o of t){const a=n[o-s];if(a?.type!=="tool/result")throw new Error("tool/result surface replacement must target a current tool/result");const i={...a.data},u={...e.data},f=a.data.message.content[0],m=e.data.message.content[0];if(i.message={...a.data.message,content:[{...f,content:null}]},u.message={...e.data.message,content:[{...m,content:null}]},!kt(i,u))throw new Error("tool/result surface replacement may change only content")}}}r(mo,"assertToolResultRewrite");function go(e,t,n,s,o){if(t.seq!==n)throw new Error(`session event seq ${t.seq} is not contiguous; expected ${n}`);const a=fo(t);if(a===void 0)return;if(a==="append")return un(t,[]),{kind:"append",seq:t.seq};const i=ho(e,a);return un(t,i.shadowedSeqs),mo(t,i.shadowedSeqs,s,o),{kind:"replace",seq:t.seq,start:a.start,end:a.end,...i}}r(go,"planSurfaceEvent");function vo(e,t,n,s,o){return yo(e,go(e,t,n,s,o))}r(vo,"applySurfaceEvent");function yo(e,t){if(t?.kind==="append"?e.nodes.push(t.seq):t?.kind==="replace"&&(e.nodes.splice(t.startIdx,t.endIdx-t.startIdx+1,t.seq),e.replaceGeneration+=1),t?.kind==="replace")return{seq:t.seq,start:t.start,end:t.end,shadowedSeqs:t.shadowedSeqs}}r(yo,"applySurfacePlan");function ln(e){const t=lo(),n=[];for(const[s,o]of e.entries()){const a=vo(t,o,s,e,0);a!==void 0&&n.push(a)}return{nodes:[...t.nodes],replacements:n}}r(ln,"foldSurface");function wo(e){return e}r(wo,"RpcId");function ko(e){return{ok:!1,error:{code:"internal",message:e instanceof Error?e.message:String(e),details:{}}}}r(ko,"transportError");var dn;function y(e,t,n){function s(u,f){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:f,constr:i,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,f);const m=i.prototype,k=Object.keys(m);for(let _=0;_<k.length;_++){const b=k[_];b in u||(u[b]=m[b].bind(u))}}r(s,"init");const o=n?.Parent??Object;class a extends o{static{r(this,"Definition")}}Object.defineProperty(a,"name",{value:e});function i(u){var f;const m=n?.Parent?new a:this;s(m,u),(f=m._zod).deferred??(f.deferred=[]);for(const k of m._zod.deferred)k();return m}return r(i,"_"),Object.defineProperty(i,"init",{value:s}),Object.defineProperty(i,Symbol.hasInstance,{value:r(u=>n?.Parent&&u instanceof n.Parent?!0:u?._zod?.traits?.has(e),"value")}),Object.defineProperty(i,"name",{value:e}),i}r(y,"$constructor");var xe=class extends Error{static{r(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},pn=class extends Error{static{r(this,"$ZodEncodeError")}constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(dn=globalThis).__zod_globalConfig??(dn.__zod_globalConfig={});const Ke=globalThis.__zod_globalConfig;function pe(e){return e&&Object.assign(Ke,e),Ke}r(pe,"config");function fn(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}r(fn,"getEnumValues");function bt(e,t){return typeof t=="bigint"?t.toString():t}r(bt,"jsonStringifyReplacer");function Ye(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}throw new Error("cached value already set")}}}r(Ye,"cached");function _t(e){return e==null}r(_t,"nullish");function St(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}r(St,"cleanRegex");function bo(e,t){const n=e/t,s=Math.round(n),o=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-s)<o?0:n-s}r(bo,"floatSafeRemainder");const hn=Symbol("evaluating");function N(e,t,n){let s;Object.defineProperty(e,t,{get(){if(s!==hn)return s===void 0&&(s=hn,s=n()),s},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}r(N,"defineLazy");function _e(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}r(_e,"assignProp");function ve(...e){const t={};for(const n of e)Object.assign(t,Object.getOwnPropertyDescriptors(n));return Object.defineProperties({},t)}r(ve,"mergeDefs");function mn(e){return JSON.stringify(e)}r(mn,"esc");function _o(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}r(_o,"slugify");const gn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function je(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}r(je,"isObject");const So=Ye(()=>{if(Ke.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch{return!1}});function $e(e){if(je(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(je(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}r($e,"isPlainObject");function vn(e){return $e(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}r(vn,"shallowClone");const Io=new Set(["string","number","symbol"]);function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}r(Ee,"escapeRegex");function ye(e,t,n){const s=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(s._zod.parent=e),s}r(ye,"clone");function x(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:r(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:r(()=>t.error,"error")}:t}r(x,"normalizeParams");function xo(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}r(xo,"optionalKeys");const $o={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Eo(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return ye(e,ve(e._zod.def,{get shape(){const o={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=n.shape[a])}return _e(this,"shape",o),o},checks:[]}))}r(Eo,"pick");function zo(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");return ye(e,ve(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete o[a]}return _e(this,"shape",o),o},checks:[]}))}r(zo,"omit");function Ao(e,t){if(!$e(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const o in t)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ye(e,ve(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return _e(this,"shape",s),s}}))}r(Ao,"extend");function To(e,t){if(!$e(t))throw new Error("Invalid input to safeExtend: expected a plain object");return ye(e,ve(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return _e(this,"shape",n),n}}))}r(To,"safeExtend");function Oo(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");return ye(e,ve(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return _e(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}r(Oo,"merge");function Po(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");return ye(t,ve(t._zod.def,{get shape(){const o=t._zod.def.shape,a={...o};if(n)for(const i in n){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(a[i]=e?new e({type:"optional",innerType:o[i]}):o[i])}else for(const i in o)a[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return _e(this,"shape",a),a},checks:[]}))}r(Po,"partial");function Ro(e,t,n){return ye(t,ve(t._zod.def,{get shape(){const s=t._zod.def.shape,o={...s};if(n)for(const a in n){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(o[a]=new e({type:"nonoptional",innerType:s[a]}))}else for(const a in s)o[a]=new e({type:"nonoptional",innerType:s[a]});return _e(this,"shape",o),o}}))}r(Ro,"required");function ze(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}r(ze,"aborted");function Zo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}r(Zo,"explicitlyAborted");function Ae(e,t){return t.map(n=>{var s;return(s=n).path??(s.path=[]),n.path.unshift(e),n})}r(Ae,"prefixIssues");function Xe(e){return typeof e=="string"?e:e?.message}r(Xe,"unwrapMessage");function fe(e,t,n){const s=e.message?e.message:Xe(e.inst?._zod.def?.error?.(e))??Xe(t?.error?.(e))??Xe(n.customError?.(e))??Xe(n.localeError?.(e))??"Invalid input",{inst:o,continue:a,input:i,...u}=e;return u.path??(u.path=[]),u.message=s,t?.reportInput&&(u.input=i),u}r(fe,"finalizeIssue");function It(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}r(It,"getLengthableOrigin");function Me(...e){const[t,n,s]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:s}:{...t}}r(Me,"issue");const yn=r((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,bt,2),Object.defineProperty(e,"toString",{value:r(()=>e.message,"value"),enumerable:!1})},"initializer$1"),wn=y("$ZodError",yn),kn=y("$ZodError",yn,{Parent:Error});function No(e,t=n=>n.message){const n={},s=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):s.push(t(o));return{formErrors:s,fieldErrors:n}}r(No,"flattenError");function jo(e,t=n=>n.message){const n={_errors:[]},s=r((o,a=[])=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(u=>s({issues:u},[...a,...i.path]));else if(i.code==="invalid_key")s({issues:i.issues},[...a,...i.path]);else if(i.code==="invalid_element")s({issues:i.issues},[...a,...i.path]);else{const u=[...a,...i.path];if(u.length===0)n._errors.push(t(i));else{let f=n,m=0;for(;m<u.length;){const k=u[m];m!==u.length-1?f[k]=f[k]||{_errors:[]}:(f[k]=f[k]||{_errors:[]},f[k]._errors.push(t(i))),f=f[k],m++}}}},"processError");return s(e),n}r(jo,"formatError");const xt=r(e=>(t,n,s,o)=>{const a=s?{...s,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise)throw new xe;if(i.issues.length){const u=new(o?.Err??e)(i.issues.map(f=>fe(f,a,pe())));throw gn(u,o?.callee),u}return i.value},"_parse"),$t=r(e=>async(t,n,s,o)=>{const a=s?{...s,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise&&(i=await i),i.issues.length){const u=new(o?.Err??e)(i.issues.map(f=>fe(f,a,pe())));throw gn(u,o?.callee),u}return i.value},"_parseAsync"),Qe=r(e=>(t,n,s)=>{const o=s?{...s,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new xe;return a.issues.length?{success:!1,error:new(e??wn)(a.issues.map(i=>fe(i,o,pe())))}:{success:!0,data:a.value}},"_safeParse"),Mo=Qe(kn),qe=r(e=>async(t,n,s)=>{const o=s?{...s,async:!0}:{async:!0};let a=t._zod.run({value:n,issues:[]},o);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(i=>fe(i,o,pe())))}:{success:!0,data:a.value}},"_safeParseAsync"),Do=qe(kn),Co=r(e=>(t,n,s)=>{const o=s?{...s,direction:"backward"}:{direction:"backward"};return xt(e)(t,n,o)},"_encode"),Uo=r(e=>(t,n,s)=>xt(e)(t,n,s),"_decode"),Lo=r(e=>async(t,n,s)=>{const o=s?{...s,direction:"backward"}:{direction:"backward"};return $t(e)(t,n,o)},"_encodeAsync"),Fo=r(e=>async(t,n,s)=>$t(e)(t,n,s),"_decodeAsync"),Vo=r(e=>(t,n,s)=>{const o=s?{...s,direction:"backward"}:{direction:"backward"};return Qe(e)(t,n,o)},"_safeEncode"),Bo=r(e=>(t,n,s)=>Qe(e)(t,n,s),"_safeDecode"),Jo=r(e=>async(t,n,s)=>{const o=s?{...s,direction:"backward"}:{direction:"backward"};return qe(e)(t,n,o)},"_safeEncodeAsync"),Go=r(e=>async(t,n,s)=>qe(e)(t,n,s),"_safeDecodeAsync"),Wo=/^[cC][0-9a-z]{6,}$/,Ho=/^[0-9a-z]+$/,Ko=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Yo=/^[0-9a-vA-V]{20}$/,Xo=/^[A-Za-z0-9]{27}$/,Qo=/^[a-zA-Z0-9_-]{21}$/,qo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,er=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,bn=r(e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,"uuid"),tr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,nr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function sr(){return new RegExp(nr,"u")}r(sr,"emoji");const or=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ar=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ir=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_n=/^[A-Za-z0-9_-]*$/,ur=/^https?$/,lr=/^\+[1-9]\d{6,14}$/,Sn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",dr=new RegExp(`^${Sn}$`);function In(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}r(In,"timeSource");function pr(e){return new RegExp(`^${In(e)}$`)}r(pr,"time$1");function fr(e){const t=In({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${n.join("|")})`;return new RegExp(`^${Sn}T(?:${s})$`)}r(fr,"datetime$1");const hr=r(e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string$1"),mr=/^-?\d+$/,xn=/^-?\d+(?:\.\d+)?$/,gr=/^(?:true|false)$/i,vr=/^[^A-Z]*$/,yr=/^[^a-z]*$/,se=y("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),$n={number:"number",bigint:"bigint",object:"date"},En=y("$ZodCheckLessThan",(e,t)=>{se.init(e,t);const n=$n[typeof t.value];e._zod.onattach.push(s=>{const o=s._zod.bag,a=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),zn=y("$ZodCheckGreaterThan",(e,t)=>{se.init(e,t);const n=$n[typeof t.value];e._zod.onattach.push(s=>{const o=s._zod.bag,a=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wr=y("$ZodCheckMultipleOf",(e,t)=>{se.init(e,t),e._zod.onattach.push(n=>{var s;(s=n._zod.bag).multipleOf??(s.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):bo(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),kr=y("$ZodCheckNumberFormat",(e,t)=>{se.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),s=n?"int":"number",[o,a]=$o[t.format];e._zod.onattach.push(i=>{const u=i._zod.bag;u.format=t.format,u.minimum=o,u.maximum=a,n&&(u.pattern=mr)}),e._zod.check=i=>{const u=i.value;if(n){if(!Number.isInteger(u)){i.issues.push({expected:s,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?i.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort}):i.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort});return}}u<o&&i.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),u>a&&i.issues.push({origin:"number",input:u,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),br=y("$ZodCheckMaxLength",(e,t)=>{var n;se.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!_t(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(s._zod.bag.maximum=t.maximum)}),e._zod.check=s=>{const o=s.value;if(o.length<=t.maximum)return;const a=It(o);s.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_r=y("$ZodCheckMinLength",(e,t)=>{var n;se.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!_t(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(s._zod.bag.minimum=t.minimum)}),e._zod.check=s=>{const o=s.value;if(o.length>=t.minimum)return;const a=It(o);s.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Sr=y("$ZodCheckLengthEquals",(e,t)=>{var n;se.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!_t(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=s=>{const o=s.value,a=o.length;if(a===t.length)return;const i=It(o),u=a>t.length;s.issues.push({origin:i,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!t.abort})}}),et=y("$ZodCheckStringFormat",(e,t)=>{var n,s;se.init(e,t),e._zod.onattach.push(o=>{const a=o._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(s=e._zod).check??(s.check=()=>{})}),Ir=y("$ZodCheckRegex",(e,t)=>{et.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),xr=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=vr),et.init(e,t)}),$r=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=yr),et.init(e,t)}),Er=y("$ZodCheckIncludes",(e,t)=>{se.init(e,t);const n=Ee(t.includes),s=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=s,e._zod.onattach.push(o=>{const a=o._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(s)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),zr=y("$ZodCheckStartsWith",(e,t)=>{se.init(e,t);const n=new RegExp(`^${Ee(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.startsWith(t.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:s.value,inst:e,continue:!t.abort})}}),Ar=y("$ZodCheckEndsWith",(e,t)=>{se.init(e,t);const n=new RegExp(`.*${Ee(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.endsWith(t.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:s.value,inst:e,continue:!t.abort})}}),Tr=y("$ZodCheckOverwrite",(e,t)=>{se.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var Or=class{static{r(this,"Doc")}constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const t=e.split(`
|
|
1
|
+
var id=Object.defineProperty;var r=(on,He)=>id(on,"name",{value:He,configurable:!0});window.__ModuleLoader__.load({id:"@deepseek-ai/dsh-client-connection",factory:r(on=>{var He={exports:{}},Ie=He.exports;Object.defineProperty(Ie,Symbol.toStringTag,{value:"Module"});const eo={backoffBaseMs:500,backoffFactor:2,backoffMaxMs:1e4,streamOpenTimeoutMs:3e3};function rn(e,t){return new Promise(n=>{const s=setTimeout(o,e);t.addEventListener("abort",o,{once:!0});function o(){clearTimeout(s),t.removeEventListener("abort",o),n()}r(o,"done")})}r(rn,"sleep");var to=class{static{r(this,"ConnectionController")}api;sinks;generation=0;attempt=0;current=null;running=!1;lastState=null;config;constructor(e,t={},n={}){this.api=e,this.sinks=t,this.config={...eo,...n}}start(){this.running||(this.running=!0,this.loop())}stop(){this.running=!1,this.current?.abort(),this.current=null}backoffDelay(e){const{backoffBaseMs:t,backoffFactor:n,backoffMaxMs:s}=this.config,o=Math.min(s,t*n**Math.max(0,e-1));return o/2+Math.random()*(o/2)}isRunning(){return this.running}isGenerationActive(e){return this.isRunning()&&!e.signal.aborted}async loop(){for(;this.running;){const e=++this.generation,t=new AbortController;this.current=t;let n=r(()=>{},"muxOpened"),s=r(()=>{},"hostOpened");const o=Promise.all([new Promise(u=>{n=u}),new Promise(u=>{s=u})]),a=new Promise(u=>{const f=r(()=>{e===this.generation&&!t.signal.aborted&&t.abort(),u()},"settle");this.pumpStream(this.api.events.mux({},t.signal,n),this.sinks.onMuxEnvelope,f),this.pumpStream(this.api.events.host({},t.signal,s),this.sinks.onHostEnvelope,f)});try{const u=new AbortController,[f]=await Promise.all([this.api.host.describe({}),Promise.race([o,rn(this.config.streamOpenTimeoutMs,u.signal)])]);u.abort();const m=f.result;if(!m.ok)throw new Error(`host.describe failed: ${m.error.code}: ${m.error.message}`);if(t.signal.aborted)throw new Error("generation aborted during readiness handshake");this.attempt=0,this.emitState("connected"),this.isGenerationActive(t)&&this.callSink(()=>{this.sinks.onConnected?.(m.value)})}catch{t.signal.aborted||t.abort()}if(await a,!this.isRunning())return;this.emitState("reconnecting"),this.attempt+=1,console.warn(`[web-runtime] connection lost, retry #${this.attempt}`);const i=new AbortController;await rn(this.backoffDelay(this.attempt),i.signal)}}emitState(e){this.lastState!==e&&(this.lastState=e,this.callSink(()=>this.sinks.onStateChange?.(e)))}async pumpStream(e,t,n){try{for await(const s of e){if(s.payload.type==="stream/error")break;t!==void 0&&this.callSink(()=>{t(s)})}}catch{}n()}callSink(e){try{e()}catch(t){console.error("[web-runtime] connection sink threw:",t)}}};function cd(e){return e}r(cd,"MessageId");function ud(e){return e}r(ud,"CallId");function no(e){const t=new WeakSet,n=[{kind:"visit",node:e}];for(;n.length>0;){const s=n.pop();if(s===void 0)continue;if(s.kind==="property"){n.push({kind:"visit",node:s.source[s.key]});continue}const o=s.node;if(o===null||typeof o!="object"||o instanceof AbortSignal||t.has(o))continue;t.add(o),Object.freeze(o);const a=Object.keys(o);for(let i=a.length-1;i>=0;i--){const u=a[i];u!==void 0&&n.push({kind:"property",source:o,key:u})}}return e}r(no,"deepFreeze");function so(e){return no(structuredClone(e))}r(so,"freezeMessage");function an(e){return so({...e,id:crypto.randomUUID()})}r(an,"createMessage");function cn(e){return an({...e,role:"user"})}r(cn,"createUserMessage");function oo(e){return an({role:"assistant",content:e.content,source:{kind:"model",...e.source}})}r(oo,"createAssistantMessage");function ro(e){return cn({source:{kind:"tool",callId:e.callId},content:[{type:"tool-result",toolCallId:e.callId,content:e.content,isError:e.isError}]})}r(ro,"createToolResultMessage");function ao(e){switch(e.type){case"text-delta":case"reasoning-delta":return e.text!=="";case"tool-call-delta":return e.argumentsDelta!==""||e.name!==void 0;default:return!1}}r(ao,"isTokenDelta");const io=new Set(["user/message","assistant/message","tool/result"]);function co(e){return io.has(e)}r(co,"isSurfaceEligibleType");function uo(e){switch(e.type){case"user/message":return e.data;case"assistant/message":return e.data.message.content.length===0?null:e.data.message;case"tool/result":return e.data.message;default:return null}}r(uo,"deriveEventMessage");function lo(){return{nodes:[],replaceGeneration:0}}r(lo,"createFoldState");function wt(e){return typeof e=="number"&&Number.isSafeInteger(e)&&e>=0}r(wt,"isEventSeq");function po(e){const t=e;return Object.keys(t).length===3&&Object.hasOwn(t,"op")&&Object.hasOwn(t,"start")&&Object.hasOwn(t,"end")&&t.op==="replace"&&wt(t.start)&&wt(t.end)}r(po,"isReplaceOp");function fo(e){const t=e;if(!co(e.type)){if(t.surfaceOp!==void 0)throw new Error(`session event "${e.type}" is not surface-eligible and cannot carry surfaceOp`);if(t.sourceEventSeqs!==void 0)throw new Error(`session event "${e.type}" is not surface-eligible and cannot carry sourceEventSeqs`);return}const n=t.surfaceOp;if(n===void 0)throw new Error(`session event "${e.type}" is surface-eligible and requires a surfaceOp marker`);if(n==="append")return n;if(n===null||typeof n!="object"||Array.isArray(n))throw new Error(`session event "${e.type}" carries an invalid surfaceOp`);if(!po(n))throw new Error(`session event "${e.type}" carries an invalid replace surfaceOp`);return n}r(fo,"surfaceOpOf");function un(e,t){const n=e.sourceEventSeqs,s=new Set;if(n!==void 0){if(!Array.isArray(n))throw new Error(`sourceEventSeqs on event at seq ${e.seq} must be an array when present`);if(n.length===0&&e.type!=="assistant/message")throw new Error("sourceEventSeqs must not be empty except on assistant/message");let a;for(const i of n){if(!wt(i))throw new Error(`session event "${e.type}" sourceEventSeqs must densely contain non-negative safe integers`);s.add(i),a===void 0&&i>=e.seq&&(a=i)}if(s.size!==n.length)throw new Error("sourceEventSeqs must not contain duplicates");if(a!==void 0)throw new Error(`sourceEventSeqs must reference earlier events: ${a} >= current seq ${e.seq}`)}const o=t.filter(a=>!s.has(a));if(o.length>0)throw new Error(`surface replace: sourceEventSeqs must include every shadowed surface node; missing ${o.join(", ")}`)}r(un,"assertProvenance");function ho(e,t){const n=e.nodes.indexOf(t.start);if(n===-1)throw new Error(`surface replace: start seq ${t.start} not found in surface`);const s=e.nodes.indexOf(t.end);if(s===-1)throw new Error(`surface replace: end seq ${t.end} not found in surface`);if(n>s)throw new Error(`surface replace: start seq ${t.start} (index ${n}) is after end seq ${t.end} (index ${s})`);return{startIdx:n,endIdx:s,shadowedSeqs:e.nodes.slice(n,s+1)}}r(ho,"replacementRange");function kt(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((o,a)=>kt(o,t[a]));if(typeof e!="object"||typeof t!="object"||e===null||t===null)return!1;const n=Object.keys(e),s=t;return n.length!==Object.keys(t).length?!1:n.every(o=>Object.hasOwn(t,o)&&kt(e[o],s[o]))}r(kt,"isDeepEqualJson");function mo(e,t,n,s){if(e.type==="tool/result"){if(t.length!==1)throw new Error("tool/result surface replacement must rewrite exactly one current node");for(const o of t){const a=n[o-s];if(a?.type!=="tool/result")throw new Error("tool/result surface replacement must target a current tool/result");const i={...a.data},u={...e.data},f=a.data.message.content[0],m=e.data.message.content[0];if(i.message={...a.data.message,content:[{...f,content:null}]},u.message={...e.data.message,content:[{...m,content:null}]},!kt(i,u))throw new Error("tool/result surface replacement may change only content")}}}r(mo,"assertToolResultRewrite");function go(e,t,n,s,o){if(t.seq!==n)throw new Error(`session event seq ${t.seq} is not contiguous; expected ${n}`);const a=fo(t);if(a===void 0)return;if(a==="append")return un(t,[]),{kind:"append",seq:t.seq};const i=ho(e,a);return un(t,i.shadowedSeqs),mo(t,i.shadowedSeqs,s,o),{kind:"replace",seq:t.seq,start:a.start,end:a.end,...i}}r(go,"planSurfaceEvent");function vo(e,t,n,s,o){return yo(e,go(e,t,n,s,o))}r(vo,"applySurfaceEvent");function yo(e,t){if(t?.kind==="append"?e.nodes.push(t.seq):t?.kind==="replace"&&(e.nodes.splice(t.startIdx,t.endIdx-t.startIdx+1,t.seq),e.replaceGeneration+=1),t?.kind==="replace")return{seq:t.seq,start:t.start,end:t.end,shadowedSeqs:t.shadowedSeqs}}r(yo,"applySurfacePlan");function ln(e){const t=lo(),n=[];for(const[s,o]of e.entries()){const a=vo(t,o,s,e,0);a!==void 0&&n.push(a)}return{nodes:[...t.nodes],replacements:n}}r(ln,"foldSurface");function wo(e){return e}r(wo,"RpcId");function ko(e){return{ok:!1,error:{code:"internal",message:e instanceof Error?e.message:String(e),details:{}}}}r(ko,"transportError");var dn;function y(e,t,n){function s(u,f){if(u._zod||Object.defineProperty(u,"_zod",{value:{def:f,constr:i,traits:new Set},enumerable:!1}),u._zod.traits.has(e))return;u._zod.traits.add(e),t(u,f);const m=i.prototype,k=Object.keys(m);for(let _=0;_<k.length;_++){const b=k[_];b in u||(u[b]=m[b].bind(u))}}r(s,"init");const o=n?.Parent??Object;class a extends o{static{r(this,"Definition")}}Object.defineProperty(a,"name",{value:e});function i(u){var f;const m=n?.Parent?new a:this;s(m,u),(f=m._zod).deferred??(f.deferred=[]);for(const k of m._zod.deferred)k();return m}return r(i,"_"),Object.defineProperty(i,"init",{value:s}),Object.defineProperty(i,Symbol.hasInstance,{value:r(u=>n?.Parent&&u instanceof n.Parent?!0:u?._zod?.traits?.has(e),"value")}),Object.defineProperty(i,"name",{value:e}),i}r(y,"$constructor");var xe=class extends Error{static{r(this,"$ZodAsyncError")}constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},pn=class extends Error{static{r(this,"$ZodEncodeError")}constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(dn=globalThis).__zod_globalConfig??(dn.__zod_globalConfig={});const Ke=globalThis.__zod_globalConfig;function pe(e){return e&&Object.assign(Ke,e),Ke}r(pe,"config");function fn(e){const t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,s])=>t.indexOf(+n)===-1).map(([n,s])=>s)}r(fn,"getEnumValues");function bt(e,t){return typeof t=="bigint"?t.toString():t}r(bt,"jsonStringifyReplacer");function Ye(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}r(Ye,"cached");function _t(e){return e==null}r(_t,"nullish");function St(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}r(St,"cleanRegex");function bo(e,t){const n=e/t,s=Math.round(n),o=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-s)<o?0:n-s}r(bo,"floatSafeRemainder");const hn=Symbol("evaluating");function N(e,t,n){let s;Object.defineProperty(e,t,{get(){if(s!==hn)return s===void 0&&(s=hn,s=n()),s},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}r(N,"defineLazy");function _e(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}r(_e,"assignProp");function ve(...e){const t={};for(const n of e){const s=Object.getOwnPropertyDescriptors(n);Object.assign(t,s)}return Object.defineProperties({},t)}r(ve,"mergeDefs");function mn(e){return JSON.stringify(e)}r(mn,"esc");function _o(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}r(_o,"slugify");const gn="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function je(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}r(je,"isObject");const So=Ye(()=>{if(Ke.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch{return!1}});function $e(e){if(je(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(je(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}r($e,"isPlainObject");function vn(e){return $e(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}r(vn,"shallowClone");const Io=new Set(["string","number","symbol"]);function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}r(Ee,"escapeRegex");function ye(e,t,n){const s=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(s._zod.parent=e),s}r(ye,"clone");function x(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:r(()=>t,"error")};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:r(()=>t.error,"error")}:t}r(x,"normalizeParams");function xo(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}r(xo,"optionalKeys");const $o={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function Eo(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return ye(e,ve(e._zod.def,{get shape(){const o={};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(o[a]=n.shape[a])}return _e(this,"shape",o),o},checks:[]}))}r(Eo,"pick");function zo(e,t){const n=e._zod.def,s=n.checks;if(s&&s.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");return ye(e,ve(e._zod.def,{get shape(){const o={...e._zod.def.shape};for(const a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete o[a]}return _e(this,"shape",o),o},checks:[]}))}r(zo,"omit");function Ao(e,t){if(!$e(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const s=e._zod.def.shape;for(const o in t)if(Object.getOwnPropertyDescriptor(s,o)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ye(e,ve(e._zod.def,{get shape(){const s={...e._zod.def.shape,...t};return _e(this,"shape",s),s}}))}r(Ao,"extend");function To(e,t){if(!$e(t))throw new Error("Invalid input to safeExtend: expected a plain object");return ye(e,ve(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return _e(this,"shape",n),n}}))}r(To,"safeExtend");function Oo(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");return ye(e,ve(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return _e(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}r(Oo,"merge");function Po(e,t,n){const s=t._zod.def.checks;if(s&&s.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");return ye(t,ve(t._zod.def,{get shape(){const o=t._zod.def.shape,a={...o};if(n)for(const i in n){if(!(i in o))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(a[i]=e?new e({type:"optional",innerType:o[i]}):o[i])}else for(const i in o)a[i]=e?new e({type:"optional",innerType:o[i]}):o[i];return _e(this,"shape",a),a},checks:[]}))}r(Po,"partial");function Ro(e,t,n){return ye(t,ve(t._zod.def,{get shape(){const s=t._zod.def.shape,o={...s};if(n)for(const a in n){if(!(a in o))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(o[a]=new e({type:"nonoptional",innerType:s[a]}))}else for(const a in s)o[a]=new e({type:"nonoptional",innerType:s[a]});return _e(this,"shape",o),o}}))}r(Ro,"required");function ze(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}r(ze,"aborted");function Zo(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}r(Zo,"explicitlyAborted");function Ae(e,t){return t.map(n=>{var s;return(s=n).path??(s.path=[]),n.path.unshift(e),n})}r(Ae,"prefixIssues");function Xe(e){return typeof e=="string"?e:e?.message}r(Xe,"unwrapMessage");function fe(e,t,n){const s=e.message?e.message:Xe(e.inst?._zod.def?.error?.(e))??Xe(t?.error?.(e))??Xe(n.customError?.(e))??Xe(n.localeError?.(e))??"Invalid input",{inst:o,continue:a,input:i,...u}=e;return u.path??(u.path=[]),u.message=s,t?.reportInput&&(u.input=i),u}r(fe,"finalizeIssue");function It(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}r(It,"getLengthableOrigin");function Me(...e){const[t,n,s]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:s}:{...t}}r(Me,"issue");const yn=r((e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,bt,2),Object.defineProperty(e,"toString",{value:r(()=>e.message,"value"),enumerable:!1})},"initializer$1"),wn=y("$ZodError",yn),kn=y("$ZodError",yn,{Parent:Error});function No(e,t=n=>n.message){const n={},s=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):s.push(t(o));return{formErrors:s,fieldErrors:n}}r(No,"flattenError");function jo(e,t=n=>n.message){const n={_errors:[]},s=r((o,a=[])=>{for(const i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(u=>s({issues:u},[...a,...i.path]));else if(i.code==="invalid_key")s({issues:i.issues},[...a,...i.path]);else if(i.code==="invalid_element")s({issues:i.issues},[...a,...i.path]);else{const u=[...a,...i.path];if(u.length===0)n._errors.push(t(i));else{let f=n,m=0;for(;m<u.length;){const k=u[m];m!==u.length-1?f[k]=f[k]||{_errors:[]}:(f[k]=f[k]||{_errors:[]},f[k]._errors.push(t(i))),f=f[k],m++}}}},"processError");return s(e),n}r(jo,"formatError");const xt=r(e=>(t,n,s,o)=>{const a=s?{...s,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise)throw new xe;if(i.issues.length){const u=new(o?.Err??e)(i.issues.map(f=>fe(f,a,pe())));throw gn(u,o?.callee),u}return i.value},"_parse"),$t=r(e=>async(t,n,s,o)=>{const a=s?{...s,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},a);if(i instanceof Promise&&(i=await i),i.issues.length){const u=new(o?.Err??e)(i.issues.map(f=>fe(f,a,pe())));throw gn(u,o?.callee),u}return i.value},"_parseAsync"),Qe=r(e=>(t,n,s)=>{const o=s?{...s,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},o);if(a instanceof Promise)throw new xe;return a.issues.length?{success:!1,error:new(e??wn)(a.issues.map(i=>fe(i,o,pe())))}:{success:!0,data:a.value}},"_safeParse"),Mo=Qe(kn),qe=r(e=>async(t,n,s)=>{const o=s?{...s,async:!0}:{async:!0};let a=t._zod.run({value:n,issues:[]},o);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(i=>fe(i,o,pe())))}:{success:!0,data:a.value}},"_safeParseAsync"),Do=qe(kn),Co=r(e=>(t,n,s)=>{const o=s?{...s,direction:"backward"}:{direction:"backward"};return xt(e)(t,n,o)},"_encode"),Uo=r(e=>(t,n,s)=>xt(e)(t,n,s),"_decode"),Lo=r(e=>async(t,n,s)=>{const o=s?{...s,direction:"backward"}:{direction:"backward"};return $t(e)(t,n,o)},"_encodeAsync"),Fo=r(e=>async(t,n,s)=>$t(e)(t,n,s),"_decodeAsync"),Vo=r(e=>(t,n,s)=>{const o=s?{...s,direction:"backward"}:{direction:"backward"};return Qe(e)(t,n,o)},"_safeEncode"),Bo=r(e=>(t,n,s)=>Qe(e)(t,n,s),"_safeDecode"),Jo=r(e=>async(t,n,s)=>{const o=s?{...s,direction:"backward"}:{direction:"backward"};return qe(e)(t,n,o)},"_safeEncodeAsync"),Go=r(e=>async(t,n,s)=>qe(e)(t,n,s),"_safeDecodeAsync"),Wo=/^[cC][0-9a-z]{6,}$/,Ho=/^[0-9a-z]+$/,Ko=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Yo=/^[0-9a-vA-V]{20}$/,Xo=/^[A-Za-z0-9]{27}$/,Qo=/^[a-zA-Z0-9_-]{21}$/,qo=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,er=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,bn=r(e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,"uuid"),tr=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,nr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function sr(){return new RegExp(nr,"u")}r(sr,"emoji");const or=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rr=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,ar=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ir=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,cr=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,_n=/^[A-Za-z0-9_-]*$/,ur=/^https?$/,lr=/^\+[1-9]\d{6,14}$/,Sn="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",dr=new RegExp(`^${Sn}$`);function In(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}r(In,"timeSource");function pr(e){return new RegExp(`^${In(e)}$`)}r(pr,"time$1");function fr(e){const t=In({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const s=`${t}(?:${n.join("|")})`;return new RegExp(`^${Sn}T(?:${s})$`)}r(fr,"datetime$1");const hr=r(e=>{const t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},"string$1"),mr=/^-?\d+$/,xn=/^-?\d+(?:\.\d+)?$/,gr=/^(?:true|false)$/i,vr=/^[^A-Z]*$/,yr=/^[^a-z]*$/,se=y("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),$n={number:"number",bigint:"bigint",object:"date"},En=y("$ZodCheckLessThan",(e,t)=>{se.init(e,t);const n=$n[typeof t.value];e._zod.onattach.push(s=>{const o=s._zod.bag,a=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<a&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value<=t.value:s.value<t.value)||s.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),zn=y("$ZodCheckGreaterThan",(e,t)=>{se.init(e,t);const n=$n[typeof t.value];e._zod.onattach.push(s=>{const o=s._zod.bag,a=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>a&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=s=>{(t.inclusive?s.value>=t.value:s.value>t.value)||s.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:s.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),wr=y("$ZodCheckMultipleOf",(e,t)=>{se.init(e,t),e._zod.onattach.push(n=>{var s;(s=n._zod.bag).multipleOf??(s.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):bo(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),kr=y("$ZodCheckNumberFormat",(e,t)=>{se.init(e,t),t.format=t.format||"float64";const n=t.format?.includes("int"),s=n?"int":"number",[o,a]=$o[t.format];e._zod.onattach.push(i=>{const u=i._zod.bag;u.format=t.format,u.minimum=o,u.maximum=a,n&&(u.pattern=mr)}),e._zod.check=i=>{const u=i.value;if(n){if(!Number.isInteger(u)){i.issues.push({expected:s,format:t.format,code:"invalid_type",continue:!1,input:u,inst:e});return}if(!Number.isSafeInteger(u)){u>0?i.issues.push({input:u,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort}):i.issues.push({input:u,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:s,inclusive:!0,continue:!t.abort});return}}u<o&&i.issues.push({origin:"number",input:u,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),u>a&&i.issues.push({origin:"number",input:u,code:"too_big",maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),br=y("$ZodCheckMaxLength",(e,t)=>{var n;se.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!_t(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(s._zod.bag.maximum=t.maximum)}),e._zod.check=s=>{const o=s.value;if(o.length<=t.maximum)return;const a=It(o);s.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_r=y("$ZodCheckMinLength",(e,t)=>{var n;se.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!_t(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(s._zod.bag.minimum=t.minimum)}),e._zod.check=s=>{const o=s.value;if(o.length>=t.minimum)return;const a=It(o);s.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Sr=y("$ZodCheckLengthEquals",(e,t)=>{var n;se.init(e,t),(n=e._zod.def).when??(n.when=s=>{const o=s.value;return!_t(o)&&o.length!==void 0}),e._zod.onattach.push(s=>{const o=s._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=s=>{const o=s.value,a=o.length;if(a===t.length)return;const i=It(o),u=a>t.length;s.issues.push({origin:i,...u?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:s.value,inst:e,continue:!t.abort})}}),et=y("$ZodCheckStringFormat",(e,t)=>{var n,s;se.init(e,t),e._zod.onattach.push(o=>{const a=o._zod.bag;a.format=t.format,t.pattern&&(a.patterns??(a.patterns=new Set),a.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(s=e._zod).check??(s.check=()=>{})}),Ir=y("$ZodCheckRegex",(e,t)=>{et.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),xr=y("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=vr),et.init(e,t)}),$r=y("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=yr),et.init(e,t)}),Er=y("$ZodCheckIncludes",(e,t)=>{se.init(e,t);const n=Ee(t.includes),s=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=s,e._zod.onattach.push(o=>{const a=o._zod.bag;a.patterns??(a.patterns=new Set),a.patterns.add(s)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),zr=y("$ZodCheckStartsWith",(e,t)=>{se.init(e,t);const n=new RegExp(`^${Ee(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.startsWith(t.prefix)||s.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:s.value,inst:e,continue:!t.abort})}}),Ar=y("$ZodCheckEndsWith",(e,t)=>{se.init(e,t);const n=new RegExp(`.*${Ee(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(s=>{const o=s._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=s=>{s.value.endsWith(t.suffix)||s.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:s.value,inst:e,continue:!t.abort})}}),Tr=y("$ZodCheckOverwrite",(e,t)=>{se.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var Or=class{static{r(this,"Doc")}constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}const t=e.split(`
|
|
2
2
|
`).filter(o=>o),n=Math.min(...t.map(o=>o.length-o.trimStart().length)),s=t.map(o=>o.slice(n)).map(o=>" ".repeat(this.indent*2)+o);for(const o of s)this.content.push(o)}compile(){const e=Function,t=this?.args,n=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...t,n.join(`
|
|
3
3
|
`))}};const Pr={major:4,minor:4,patch:3},V=y("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pr;const s=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&s.unshift(e);for(const o of s)for(const a of o._zod.onattach)a(e);if(s.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const o=r((i,u,f)=>{let m=ze(i),k;for(const _ of u){if(_._zod.def.when){if(Zo(i)||!_._zod.def.when(i))continue}else if(m)continue;const b=i.issues.length,S=_._zod.check(i);if(S instanceof Promise&&f?.async===!1)throw new xe;if(k||S instanceof Promise)k=(k??Promise.resolve()).then(async()=>{await S,i.issues.length!==b&&(m||(m=ze(i,b)))});else{if(i.issues.length===b)continue;m||(m=ze(i,b))}}return k?k.then(()=>i):i},"runChecks"),a=r((i,u,f)=>{if(ze(i))return i.aborted=!0,i;const m=o(u,s,f);if(m instanceof Promise){if(f.async===!1)throw new xe;return m.then(k=>e._zod.parse(k,f))}return e._zod.parse(m,f)},"handleCanaryResult");e._zod.run=(i,u)=>{if(u.skipChecks)return e._zod.parse(i,u);if(u.direction==="backward"){const m=e._zod.parse({value:i.value,issues:[]},{...u,skipChecks:!0});return m instanceof Promise?m.then(k=>a(k,i,u)):a(m,i,u)}const f=e._zod.parse(i,u);if(f instanceof Promise){if(u.async===!1)throw new xe;return f.then(m=>o(m,s,u))}return o(f,s,u)}}N(e,"~standard",()=>({validate:r(o=>{try{const a=Mo(e,o);return a.success?{value:a.data}:{issues:a.error?.issues}}catch{return Do(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},"validate"),vendor:"zod",version:1}))}),Et=y("$ZodString",(e,t)=>{V.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??hr(e._zod.bag),e._zod.parse=(n,s)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),B=y("$ZodStringFormat",(e,t)=>{et.init(e,t),Et.init(e,t)}),Rr=y("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=er),B.init(e,t)}),Zr=y("$ZodUUID",(e,t)=>{if(t.version){const n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=bn(n))}else t.pattern??(t.pattern=bn());B.init(e,t)}),Nr=y("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=tr),B.init(e,t)}),jr=y("$ZodURL",(e,t)=>{B.init(e,t),e._zod.check=n=>{try{const s=n.value.trim();if(!t.normalize&&t.protocol?.source===ur.source&&!/^https?:\/\//i.test(s)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const o=new URL(s);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=s;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Mr=y("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=sr()),B.init(e,t)}),Dr=y("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Qo),B.init(e,t)}),Cr=y("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Wo),B.init(e,t)}),Ur=y("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ho),B.init(e,t)}),Lr=y("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Ko),B.init(e,t)}),Fr=y("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Yo),B.init(e,t)}),Vr=y("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Xo),B.init(e,t)}),Br=y("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=fr(t)),B.init(e,t)}),Jr=y("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=dr),B.init(e,t)}),Gr=y("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=pr(t)),B.init(e,t)}),Wr=y("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=qo),B.init(e,t)}),Hr=y("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=or),B.init(e,t),e._zod.bag.format="ipv4"}),Kr=y("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=rr),B.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Yr=y("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ar),B.init(e,t)}),Xr=y("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ir),B.init(e,t),e._zod.check=n=>{const s=n.value.split("/");try{if(s.length!==2)throw new Error;const[o,a]=s;if(!a)throw new Error;const i=Number(a);if(`${i}`!==a)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function An(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}r(An,"isValidBase64");const Qr=y("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=cr),B.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{An(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function qr(e){if(!_n.test(e))return!1;const t=e.replace(/[-_]/g,n=>n==="-"?"+":"/");return An(t.padEnd(Math.ceil(t.length/4)*4,"="))}r(qr,"isValidBase64URL");const ea=y("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=_n),B.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{qr(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),ta=y("$ZodE164",(e,t)=>{t.pattern??(t.pattern=lr),B.init(e,t)});function na(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[s]=n;if(!s)return!1;const o=JSON.parse(atob(s));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}r(na,"isValidJWT");const sa=y("$ZodJWT",(e,t)=>{B.init(e,t),e._zod.check=n=>{na(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Tn=y("$ZodNumber",(e,t)=>{V.init(e,t),e._zod.pattern=e._zod.bag.pattern??xn,e._zod.parse=(n,s)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const a=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...a?{received:a}:{}}),n}}),oa=y("$ZodNumberFormat",(e,t)=>{kr.init(e,t),Tn.init(e,t)}),ra=y("$ZodBoolean",(e,t)=>{V.init(e,t),e._zod.pattern=gr,e._zod.parse=(n,s)=>{if(t.coerce)try{n.value=!!n.value}catch{}const o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}}),aa=y("$ZodUnknown",(e,t)=>{V.init(e,t),e._zod.parse=n=>n}),ia=y("$ZodNever",(e,t)=>{V.init(e,t),e._zod.parse=(n,s)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function On(e,t,n){e.issues.length&&t.issues.push(...Ae(n,e.issues)),t.value[n]=e.value}r(On,"handleArrayResult");const ca=y("$ZodArray",(e,t)=>{V.init(e,t),e._zod.parse=(n,s)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const a=[];for(let i=0;i<o.length;i++){const u=o[i],f=t.element._zod.run({value:u,issues:[]},s);f instanceof Promise?a.push(f.then(m=>On(m,n,i))):On(f,n,i)}return a.length?Promise.all(a).then(()=>n):n}});function tt(e,t,n,s,o,a){const i=n in s;if(e.issues.length){if(o&&a&&!i)return;t.issues.push(...Ae(n,e.issues))}if(!i&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?i&&(t.value[n]=void 0):t.value[n]=e.value}r(tt,"handlePropertyResult");function Pn(e){const t=Object.keys(e.shape);for(const s of t)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${s}": expected a Zod schema`);const n=xo(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}r(Pn,"normalizeDef");function Rn(e,t,n,s,o,a){const i=[],u=o.keySet,f=o.catchall._zod,m=f.def.type,k=f.optin==="optional",_=f.optout==="optional";for(const b in t){if(b==="__proto__"||u.has(b))continue;if(m==="never"){i.push(b);continue}const S=f.run({value:t[b],issues:[]},s);S instanceof Promise?e.push(S.then(E=>tt(E,n,b,t,k,_))):tt(S,n,b,t,k,_)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}r(Rn,"handleCatchall");const ua=y("$ZodObject",(e,t)=>{if(V.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){const i=t.shape;Object.defineProperty(t,"shape",{get:r(()=>{const u={...i};return Object.defineProperty(t,"shape",{value:u}),u},"get")})}const n=Ye(()=>Pn(t));N(e._zod,"propValues",()=>{const i=t.shape,u={};for(const f in i){const m=i[f]._zod;if(m.values){u[f]??(u[f]=new Set);for(const k of m.values)u[f].add(k)}}return u});const s=je,o=t.catchall;let a;e._zod.parse=(i,u)=>{a??(a=n.value);const f=i.value;if(!s(f))return i.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),i;i.value={};const m=[],k=a.shape;for(const _ of a.keys){const b=k[_],S=b._zod.optin==="optional",E=b._zod.optout==="optional",D=b._zod.run({value:f[_],issues:[]},u);D instanceof Promise?m.push(D.then(ce=>tt(ce,i,_,f,S,E))):tt(D,i,_,f,S,E)}return o?Rn(m,f,i,u,n.value,e):m.length?Promise.all(m).then(()=>i):i}}),la=y("$ZodObjectJIT",(e,t)=>{ua.init(e,t);const n=e._zod.parse,s=Ye(()=>Pn(t)),o=r(_=>{const b=new Or(["shape","payload","ctx"]),S=s.value,E=r(te=>{const F=mn(te);return`shape[${F}]._zod.run({ value: input[${F}], issues: [] }, ctx)`},"parseStr");b.write("const input = payload.value;");const D=Object.create(null);let ce=0;for(const te of S.keys)D[te]=`key_${ce++}`;b.write("const newResult = {};");for(const te of S.keys){const F=D[te],Q=mn(te),ge=_[te],Be=ge?._zod?.optin==="optional",Je=ge?._zod?.optout==="optional";b.write(`const ${F} = ${E(te)};`),Be&&Je?b.write(`
|
|
4
4
|
if (${F}.issues.length) {
|
|
@@ -61,7 +61,7 @@ var id=Object.defineProperty;var r=(on,He)=>id(on,"name",{value:He,configurable:
|
|
|
61
61
|
|
|
62
62
|
`)}b.write("payload.value = newResult;"),b.write("return payload;");const Se=b.compile();return(te,F)=>Se(_,te,F)},"generateFastpass");let a;const i=je,u=!Ke.jitless,f=u&&So.value,m=t.catchall;let k;e._zod.parse=(_,b)=>{k??(k=s.value);const S=_.value;return i(S)?u&&f&&b?.async===!1&&b.jitless!==!0?(a||(a=o(t.shape)),_=a(_,b),m?Rn([],S,_,b,k,e):_):n(_,b):(_.issues.push({expected:"object",code:"invalid_type",input:S,inst:e}),_)}});function Zn(e,t,n,s){for(const a of e)if(a.issues.length===0)return t.value=a.value,t;const o=e.filter(a=>!ze(a));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(a=>a.issues.map(i=>fe(i,s,pe())))}),t)}r(Zn,"handleUnionResults");const Nn=y("$ZodUnion",(e,t)=>{V.init(e,t),N(e._zod,"optin",()=>t.options.some(s=>s._zod.optin==="optional")?"optional":void 0),N(e._zod,"optout",()=>t.options.some(s=>s._zod.optout==="optional")?"optional":void 0),N(e._zod,"values",()=>{if(t.options.every(s=>s._zod.values))return new Set(t.options.flatMap(s=>Array.from(s._zod.values)))}),N(e._zod,"pattern",()=>{if(t.options.every(s=>s._zod.pattern)){const s=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${s.map(o=>St(o.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(s,o)=>{if(n)return n(s,o);let a=!1;const i=[];for(const u of t.options){const f=u._zod.run({value:s.value,issues:[]},o);if(f instanceof Promise)i.push(f),a=!0;else{if(f.issues.length===0)return f;i.push(f)}}return a?Promise.all(i).then(u=>Zn(u,s,e,o)):Zn(i,s,e,o)}}),da=y("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Nn.init(e,t);const n=e._zod.parse;N(e._zod,"propValues",()=>{const o={};for(const a of t.options){const i=a._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(a)}"`);for(const[u,f]of Object.entries(i)){o[u]||(o[u]=new Set);for(const m of f)o[u].add(m)}}return o});const s=Ye(()=>{const o=t.options,a=new Map;for(const i of o){const u=i._zod.propValues?.[t.discriminator];if(!u||u.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const f of u){if(a.has(f))throw new Error(`Duplicate discriminator value "${String(f)}"`);a.set(f,i)}}return a});e._zod.parse=(o,a)=>{const i=o.value;if(!je(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const u=s.value.get(i?.[t.discriminator]);return u?u._zod.run(o,a):t.unionFallback||a.direction==="backward"?n(o,a):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(s.value.keys()),input:i,path:[t.discriminator],inst:e}),o)}}),pa=y("$ZodIntersection",(e,t)=>{V.init(e,t),e._zod.parse=(n,s)=>{const o=n.value,a=t.left._zod.run({value:o,issues:[]},s),i=t.right._zod.run({value:o,issues:[]},s);return a instanceof Promise||i instanceof Promise?Promise.all([a,i]).then(([u,f])=>jn(n,u,f)):jn(n,a,i)}});function zt(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if($e(e)&&$e(t)){const n=Object.keys(t),s=Object.keys(e).filter(a=>n.indexOf(a)!==-1),o={...e,...t};for(const a of s){const i=zt(e[a],t[a]);if(!i.valid)return{valid:!1,mergeErrorPath:[a,...i.mergeErrorPath]};o[a]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let s=0;s<e.length;s++){const o=e[s],a=t[s],i=zt(o,a);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}r(zt,"mergeValues");function jn(e,t,n){const s=new Map;let o;for(const u of t.issues)if(u.code==="unrecognized_keys"){o??(o=u);for(const f of u.keys)s.has(f)||s.set(f,{}),s.get(f).l=!0}else e.issues.push(u);for(const u of n.issues)if(u.code==="unrecognized_keys")for(const f of u.keys)s.has(f)||s.set(f,{}),s.get(f).r=!0;else e.issues.push(u);const a=[...s].filter(([,u])=>u.l&&u.r).map(([u])=>u);if(a.length&&o&&e.issues.push({...o,keys:a}),ze(e))return e;const i=zt(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}r(jn,"handleIntersectionResults");const fa=y("$ZodRecord",(e,t)=>{V.init(e,t),e._zod.parse=(n,s)=>{const o=n.value;if(!$e(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const a=[],i=t.keyType._zod.values;if(i){n.value={};const u=new Set;for(const m of i)if(typeof m=="string"||typeof m=="number"||typeof m=="symbol"){u.add(typeof m=="number"?m.toString():m);const k=t.keyType._zod.run({value:m,issues:[]},s);if(k instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(k.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:k.issues.map(S=>fe(S,s,pe())),input:m,path:[m],inst:e});continue}const _=k.value,b=t.valueType._zod.run({value:o[m],issues:[]},s);b instanceof Promise?a.push(b.then(S=>{S.issues.length&&n.issues.push(...Ae(m,S.issues)),n.value[_]=S.value})):(b.issues.length&&n.issues.push(...Ae(m,b.issues)),n.value[_]=b.value)}let f;for(const m in o)u.has(m)||(f=f??[],f.push(m));f&&f.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:f})}else{n.value={};for(const u of Reflect.ownKeys(o)){if(u==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,u))continue;let f=t.keyType._zod.run({value:u,issues:[]},s);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof u=="string"&&xn.test(u)&&f.issues.length){const k=t.keyType._zod.run({value:Number(u),issues:[]},s);if(k instanceof Promise)throw new Error("Async schemas not supported in object keys currently");k.issues.length===0&&(f=k)}if(f.issues.length){t.mode==="loose"?n.value[u]=o[u]:n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(k=>fe(k,s,pe())),input:u,path:[u],inst:e});continue}const m=t.valueType._zod.run({value:o[u],issues:[]},s);m instanceof Promise?a.push(m.then(k=>{k.issues.length&&n.issues.push(...Ae(u,k.issues)),n.value[f.value]=k.value})):(m.issues.length&&n.issues.push(...Ae(u,m.issues)),n.value[f.value]=m.value)}}return a.length?Promise.all(a).then(()=>n):n}}),ha=y("$ZodEnum",(e,t)=>{V.init(e,t);const n=fn(t.entries),s=new Set(n);e._zod.values=s,e._zod.pattern=new RegExp(`^(${n.filter(o=>Io.has(typeof o)).map(o=>typeof o=="string"?Ee(o):o.toString()).join("|")})$`),e._zod.parse=(o,a)=>{const i=o.value;return s.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),ma=y("$ZodLiteral",(e,t)=>{if(V.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");const n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(s=>typeof s=="string"?Ee(s):s?Ee(s.toString()):String(s)).join("|")})$`),e._zod.parse=(s,o)=>{const a=s.value;return n.has(a)||s.issues.push({code:"invalid_value",values:t.values,input:a,inst:e}),s}}),ga=y("$ZodTransform",(e,t)=>{V.init(e,t),e._zod.optin="optional",e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new pn(e.constructor.name);const o=t.transform(n.value,n);if(s.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n.fallback=!0,n));if(o instanceof Promise)throw new xe;return n.value=o,n.fallback=!0,n}});function Mn(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}r(Mn,"handleOptionalResult");const Dn=y("$ZodOptional",(e,t)=>{V.init(e,t),e._zod.optin="optional",e._zod.optout="optional",N(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),N(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${St(n.source)})?$`):void 0}),e._zod.parse=(n,s)=>{if(t.innerType._zod.optin==="optional"){const o=n.value,a=t.innerType._zod.run(n,s);return a instanceof Promise?a.then(i=>Mn(i,o)):Mn(a,o)}return n.value===void 0?n:t.innerType._zod.run(n,s)}}),va=y("$ZodExactOptional",(e,t)=>{Dn.init(e,t),N(e._zod,"values",()=>t.innerType._zod.values),N(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,s)=>t.innerType._zod.run(n,s)}),ya=y("$ZodNullable",(e,t)=>{V.init(e,t),N(e._zod,"optin",()=>t.innerType._zod.optin),N(e._zod,"optout",()=>t.innerType._zod.optout),N(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${St(n.source)}|null)$`):void 0}),N(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,s)=>n.value===null?n:t.innerType._zod.run(n,s)}),wa=y("$ZodDefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",N(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(a=>Cn(a,t)):Cn(o,t)}});function Cn(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}r(Cn,"handleDefaultResult");const ka=y("$ZodPrefault",(e,t)=>{V.init(e,t),e._zod.optin="optional",N(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>(s.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,s))}),ba=y("$ZodNonOptional",(e,t)=>{V.init(e,t),N(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(s=>s!==void 0)):void 0}),e._zod.parse=(n,s)=>{const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(a=>Un(a,e)):Un(o,e)}});function Un(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}r(Un,"handleNonOptionalResult");const _a=y("$ZodCatch",(e,t)=>{V.init(e,t),e._zod.optin="optional",N(e._zod,"optout",()=>t.innerType._zod.optout),N(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(a=>(n.value=a.value,a.issues.length&&(n.value=t.catchValue({...n,error:{issues:a.issues.map(i=>fe(i,s,pe()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(a=>fe(a,s,pe()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Sa=y("$ZodPipe",(e,t)=>{V.init(e,t),N(e._zod,"values",()=>t.in._zod.values),N(e._zod,"optin",()=>t.in._zod.optin),N(e._zod,"optout",()=>t.out._zod.optout),N(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,s)=>{if(s.direction==="backward"){const a=t.out._zod.run(n,s);return a instanceof Promise?a.then(i=>nt(i,t.in,s)):nt(a,t.in,s)}const o=t.in._zod.run(n,s);return o instanceof Promise?o.then(a=>nt(a,t.out,s)):nt(o,t.out,s)}});function nt(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}r(nt,"handlePipeResult");const Ia=y("$ZodReadonly",(e,t)=>{V.init(e,t),N(e._zod,"propValues",()=>t.innerType._zod.propValues),N(e._zod,"values",()=>t.innerType._zod.values),N(e._zod,"optin",()=>t.innerType?._zod?.optin),N(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,s)=>{if(s.direction==="backward")return t.innerType._zod.run(n,s);const o=t.innerType._zod.run(n,s);return o instanceof Promise?o.then(Ln):Ln(o)}});function Ln(e){return e.value=Object.freeze(e.value),e}r(Ln,"handleReadonlyResult");const xa=y("$ZodLazy",(e,t)=>{V.init(e,t),N(e._zod,"innerType",()=>{const n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),N(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),N(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),N(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),N(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,s)=>e._zod.innerType._zod.run(n,s)}),$a=y("$ZodCustom",(e,t)=>{se.init(e,t),V.init(e,t),e._zod.parse=(n,s)=>n,e._zod.check=n=>{const s=n.value,o=t.fn(s);if(o instanceof Promise)return o.then(a=>Fn(a,n,s,e));Fn(o,n,s,e)}});function Fn(e,t,n,s){if(!e){const o={code:"custom",input:n,inst:s,path:[...s._zod.def.path??[]],continue:!s._zod.def.abort};s._zod.def.params&&(o.params=s._zod.def.params),t.issues.push(Me(o))}}r(Fn,"handleRefineResult");var Vn,Ea=class{static{r(this,"$ZodRegistry")}constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&typeof n=="object"&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&typeof t=="object"&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const s={...n,...this._map.get(e)};return Object.keys(s).length?s:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function za(){return new Ea}r(za,"registry"),(Vn=globalThis).__zod_globalRegistry??(Vn.__zod_globalRegistry=za());const De=globalThis.__zod_globalRegistry;function Aa(e,t){return new e({type:"string",...x(t)})}r(Aa,"_string");function Ta(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...x(t)})}r(Ta,"_email");function Bn(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...x(t)})}r(Bn,"_guid");function Oa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...x(t)})}r(Oa,"_uuid");function Pa(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...x(t)})}r(Pa,"_uuidv4");function Ra(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...x(t)})}r(Ra,"_uuidv6");function Za(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...x(t)})}r(Za,"_uuidv7");function Na(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...x(t)})}r(Na,"_url");function ja(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...x(t)})}r(ja,"_emoji");function Ma(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...x(t)})}r(Ma,"_nanoid");function Da(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...x(t)})}r(Da,"_cuid");function Ca(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...x(t)})}r(Ca,"_cuid2");function Ua(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...x(t)})}r(Ua,"_ulid");function La(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...x(t)})}r(La,"_xid");function Fa(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...x(t)})}r(Fa,"_ksuid");function Va(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...x(t)})}r(Va,"_ipv4");function Ba(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...x(t)})}r(Ba,"_ipv6");function Ja(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...x(t)})}r(Ja,"_cidrv4");function Ga(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...x(t)})}r(Ga,"_cidrv6");function Wa(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...x(t)})}r(Wa,"_base64");function Ha(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...x(t)})}r(Ha,"_base64url");function Ka(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...x(t)})}r(Ka,"_e164");function Ya(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...x(t)})}r(Ya,"_jwt");function Xa(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...x(t)})}r(Xa,"_isoDateTime");function Qa(e,t){return new e({type:"string",format:"date",check:"string_format",...x(t)})}r(Qa,"_isoDate");function qa(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...x(t)})}r(qa,"_isoTime");function ei(e,t){return new e({type:"string",format:"duration",check:"string_format",...x(t)})}r(ei,"_isoDuration");function ti(e,t){return new e({type:"number",checks:[],...x(t)})}r(ti,"_number");function ni(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...x(t)})}r(ni,"_int");function si(e,t){return new e({type:"boolean",...x(t)})}r(si,"_boolean");function oi(e){return new e({type:"unknown"})}r(oi,"_unknown");function ri(e,t){return new e({type:"never",...x(t)})}r(ri,"_never");function Jn(e,t){return new En({check:"less_than",...x(t),value:e,inclusive:!1})}r(Jn,"_lt");function At(e,t){return new En({check:"less_than",...x(t),value:e,inclusive:!0})}r(At,"_lte");function Gn(e,t){return new zn({check:"greater_than",...x(t),value:e,inclusive:!1})}r(Gn,"_gt");function Tt(e,t){return new zn({check:"greater_than",...x(t),value:e,inclusive:!0})}r(Tt,"_gte");function Wn(e,t){return new wr({check:"multiple_of",...x(t),value:e})}r(Wn,"_multipleOf");function Hn(e,t){return new br({check:"max_length",...x(t),maximum:e})}r(Hn,"_maxLength");function st(e,t){return new _r({check:"min_length",...x(t),minimum:e})}r(st,"_minLength");function Kn(e,t){return new Sr({check:"length_equals",...x(t),length:e})}r(Kn,"_length");function ai(e,t){return new Ir({check:"string_format",format:"regex",...x(t),pattern:e})}r(ai,"_regex");function ii(e){return new xr({check:"string_format",format:"lowercase",...x(e)})}r(ii,"_lowercase");function ci(e){return new $r({check:"string_format",format:"uppercase",...x(e)})}r(ci,"_uppercase");function ui(e,t){return new Er({check:"string_format",format:"includes",...x(t),includes:e})}r(ui,"_includes");function li(e,t){return new zr({check:"string_format",format:"starts_with",...x(t),prefix:e})}r(li,"_startsWith");function di(e,t){return new Ar({check:"string_format",format:"ends_with",...x(t),suffix:e})}r(di,"_endsWith");function Te(e){return new Tr({check:"overwrite",tx:e})}r(Te,"_overwrite");function pi(e){return Te(t=>t.normalize(e))}r(pi,"_normalize");function fi(){return Te(e=>e.trim())}r(fi,"_trim");function hi(){return Te(e=>e.toLowerCase())}r(hi,"_toLowerCase");function mi(){return Te(e=>e.toUpperCase())}r(mi,"_toUpperCase");function gi(){return Te(e=>_o(e))}r(gi,"_slugify");function vi(e,t,n){return new e({type:"array",element:t,...x(n)})}r(vi,"_array");function yi(e,t,n){const s=x(n);return s.abort??(s.abort=!0),new e({type:"custom",check:"custom",fn:t,...s})}r(yi,"_custom");function wi(e,t,n){return new e({type:"custom",check:"custom",fn:t,...x(n)})}r(wi,"_refine");function ki(e,t){const n=bi(s=>(s.addIssue=o=>{if(typeof o=="string")s.issues.push(Me(o,s.value,n._zod.def));else{const a=o;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=s.value),a.inst??(a.inst=n),a.continue??(a.continue=!n._zod.def.abort),s.issues.push(Me(a))}},e(s.value,s)),t);return n}r(ki,"_superRefine");function bi(e,t){const n=new se({check:"custom",...x(t)});return n._zod.check=e,n}r(bi,"_check");function Yn(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??De,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}r(Yn,"initializeContext");function K(e,t,n={path:[],schemaPath:[]}){var s;const o=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;const i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);const u=e._zod.toJSONSchema?.();if(u)i.schema=u;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,m);else{const _=i.schema,b=t.processors[o.type];if(!b)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);b(e,t,_,m)}const k=e._zod.parent;k&&(i.ref||(i.ref=k),K(k,t,m),t.seen.get(k).isParent=!0)}const f=t.metadataRegistry.get(e);return f&&Object.assign(i.schema,f),t.io==="input"&&ee(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((s=i.schema).default??(s.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}r(K,"process");function Xn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=new Map;for(const i of e.seen.entries()){const u=e.metadataRegistry.get(i[0])?.id;if(u){const f=s.get(u);if(f&&f!==i[0])throw new Error(`Duplicate schema id "${u}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);s.set(u,i[0])}}const o=r(i=>{const u=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const k=e.external.registry.get(i[0])?.id,_=e.external.uri??(S=>S);if(k)return{ref:_(k)};const b=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=b,{defId:b,ref:`${_("__shared")}#/${u}/${b}`}}if(i[1]===n)return{ref:"#"};const f=`#/${u}/`,m=i[1].schema.id??`__schema${e.counter++}`;return{defId:m,ref:f+m}},"makeURI"),a=r(i=>{if(i[1].schema.$ref)return;const u=i[1],{ref:f,defId:m}=o(i);u.def={...u.schema},m&&(u.defId=m);const k=u.schema;for(const _ in k)delete k[_];k.$ref=f},"extractToDef");if(e.cycles==="throw")for(const i of e.seen.entries()){const u=i[1];if(u.cycle)throw new Error(`Cycle detected: #/${u.cycle?.join("/")}/<root>
|
|
63
63
|
|
|
64
|
-
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const u=i[1];if(t===i[0]){a(i);continue}if(e.external){const f=e.external.registry.get(i[0])?.id;if(t!==i[0]&&f){a(i);continue}}if(e.metadataRegistry.get(i[0])?.id){a(i);continue}if(u.cycle){a(i);continue}if(u.count>1&&e.reused==="ref"){a(i);continue}}}r(Xn,"extractDefs");function Qn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=r(u=>{const f=e.seen.get(u);if(f.ref===null)return;const m=f.def??f.schema,k={...m},_=f.ref;if(f.ref=null,_){s(_);const S=e.seen.get(_),E=S.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(E)):Object.assign(m,E),Object.assign(m,k),u._zod.parent===_)for(const D in m)D==="$ref"||D==="allOf"||D in k||delete m[D];if(E.$ref&&S.def)for(const D in m)D==="$ref"||D==="allOf"||D in S.def&&JSON.stringify(m[D])===JSON.stringify(S.def[D])&&delete m[D]}const b=u._zod.parent;if(b&&b!==_){s(b);const S=e.seen.get(b);if(S?.schema.$ref&&(m.$ref=S.schema.$ref,S.def))for(const E in m)E==="$ref"||E==="allOf"||E in S.def&&JSON.stringify(m[E])===JSON.stringify(S.def[E])&&delete m[E]}e.override({zodSchema:u,jsonSchema:m,path:f.path??[]})},"flattenRef");for(const u of[...e.seen.entries()].reverse())s(u[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}Object.assign(o,n.def??n.schema);const a=e.metadataRegistry.get(t)?.id;a!==void 0&&o.id===a&&delete o.id;const i=e.external?.defs??{};for(const u of e.seen.entries()){const f=u[1];f.def&&f.defId&&(f.def.id===f.defId&&delete f.def.id,i[f.defId]=f.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:ot(t,"input",e.processors),output:ot(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}r(Qn,"finalize");function ee(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return ee(s.element,n);if(s.type==="set")return ee(s.valueType,n);if(s.type==="lazy")return ee(s.getter(),n);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return ee(s.innerType,n);if(s.type==="intersection")return ee(s.left,n)||ee(s.right,n);if(s.type==="record"||s.type==="map")return ee(s.keyType,n)||ee(s.valueType,n);if(s.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ee(s.in,n)||ee(s.out,n);if(s.type==="object"){for(const o in s.shape)if(ee(s.shape[o],n))return!0;return!1}if(s.type==="union"){for(const o of s.options)if(ee(o,n))return!0;return!1}if(s.type==="tuple"){for(const o of s.items)if(ee(o,n))return!0;return!!(s.rest&&ee(s.rest,n))}return!1}r(ee,"isTransforming");const _i=r((e,t={})=>n=>{const s=Yn({...n,processors:t});return K(e,s),Xn(s,e),Qn(s,e)},"createToJSONSchemaMethod"),ot=r((e,t,n={})=>s=>{const{libraryOptions:o,target:a}=s??{},i=Yn({...o??{},target:a,io:t,processors:n});return K(e,i),Xn(i,e),Qn(i,e)},"createStandardJSONSchemaMethod"),Si={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ii=r((e,t,n,s)=>{const o=n;o.type="string";const{minimum:a,maximum:i,format:u,patterns:f,contentEncoding:m}=e._zod.bag;if(typeof a=="number"&&(o.minLength=a),typeof i=="number"&&(o.maxLength=i),u&&(o.format=Si[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),m&&(o.contentEncoding=m),f&&f.size>0){const k=[...f];k.length===1?o.pattern=k[0].source:k.length>1&&(o.allOf=[...k.map(_=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:_.source}))])}},"stringProcessor"),xi=r((e,t,n,s)=>{const o=n,{minimum:a,maximum:i,format:u,multipleOf:f,exclusiveMaximum:m,exclusiveMinimum:k}=e._zod.bag;typeof u=="string"&&u.includes("int")?o.type="integer":o.type="number";const _=typeof k=="number"&&k>=(a??Number.NEGATIVE_INFINITY),b=typeof m=="number"&&m<=(i??Number.POSITIVE_INFINITY),S=t.target==="draft-04"||t.target==="openapi-3.0";_?S?(o.minimum=k,o.exclusiveMinimum=!0):o.exclusiveMinimum=k:typeof a=="number"&&(o.minimum=a),b?S?(o.maximum=m,o.exclusiveMaximum=!0):o.exclusiveMaximum=m:typeof i=="number"&&(o.maximum=i),typeof f=="number"&&(o.multipleOf=f)},"numberProcessor"),$i=r((e,t,n,s)=>{n.type="boolean"},"booleanProcessor"),Ei=r((e,t,n,s)=>{n.not={}},"neverProcessor"),zi=r((e,t,n,s)=>{const o=e._zod.def,a=fn(o.entries);a.every(i=>typeof i=="number")&&(n.type="number"),a.every(i=>typeof i=="string")&&(n.type="string"),n.enum=a},"enumProcessor"),Ai=r((e,t,n,s)=>{const o=e._zod.def,a=[];for(const i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(i))}else a.push(i);if(a.length!==0)if(a.length===1){const i=a[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else a.every(i=>typeof i=="number")&&(n.type="number"),a.every(i=>typeof i=="string")&&(n.type="string"),a.every(i=>typeof i=="boolean")&&(n.type="boolean"),a.every(i=>i===null)&&(n.type="null"),n.enum=a},"literalProcessor"),Ti=r((e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},"customProcessor"),Oi=r((e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},"transformProcessor"),Pi=r((e,t,n,s)=>{const o=n,a=e._zod.def,{minimum:i,maximum:u}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=K(a.element,t,{...s,path:[...s.path,"items"]})},"arrayProcessor"),Ri=r((e,t,n,s)=>{const o=n,a=e._zod.def;o.type="object",o.properties={};const i=a.shape;for(const m in i)o.properties[m]=K(i[m],t,{...s,path:[...s.path,"properties",m]});const u=new Set(Object.keys(i)),f=new Set([...u].filter(m=>{const k=a.shape[m]._zod;return t.io==="input"?k.optin===void 0:k.optout===void 0}));f.size>0&&(o.required=Array.from(f)),a.catchall?._zod.def.type==="never"?o.additionalProperties=!1:a.catchall?a.catchall&&(o.additionalProperties=K(a.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},"objectProcessor"),Zi=r((e,t,n,s)=>{const o=e._zod.def,a=o.inclusive===!1,i=o.options.map((u,f)=>K(u,t,{...s,path:[...s.path,a?"oneOf":"anyOf",f]}));a?n.oneOf=i:n.anyOf=i},"unionProcessor"),Ni=r((e,t,n,s)=>{const o=e._zod.def,a=K(o.left,t,{...s,path:[...s.path,"allOf",0]}),i=K(o.right,t,{...s,path:[...s.path,"allOf",1]}),u=r(f=>"allOf"in f&&Object.keys(f).length===1,"isSimpleIntersection");n.allOf=[...u(a)?a.allOf:[a],...u(i)?i.allOf:[i]]},"intersectionProcessor"),ji=r((e,t,n,s)=>{const o=n,a=e._zod.def;o.type="object";const i=a.keyType,u=i._zod.bag?.patterns;if(a.mode==="loose"&&u&&u.size>0){const m=K(a.valueType,t,{...s,path:[...s.path,"patternProperties","*"]});o.patternProperties={};for(const k of u)o.patternProperties[k.source]=m}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=K(a.keyType,t,{...s,path:[...s.path,"propertyNames"]})),o.additionalProperties=K(a.valueType,t,{...s,path:[...s.path,"additionalProperties"]});const f=i._zod.values;if(f){const m=[...f].filter(k=>typeof k=="string"||typeof k=="number");m.length>0&&(o.required=m)}},"recordProcessor"),Mi=r((e,t,n,s)=>{const o=e._zod.def,a=K(o.innerType,t,s),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[a,{type:"null"}]},"nullableProcessor"),Di=r((e,t,n,s)=>{const o=e._zod.def;K(o.innerType,t,s);const a=t.seen.get(e);a.ref=o.innerType},"nonoptionalProcessor"),Ci=r((e,t,n,s)=>{const o=e._zod.def;K(o.innerType,t,s);const a=t.seen.get(e);a.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},"defaultProcessor"),Ui=r((e,t,n,s)=>{const o=e._zod.def;K(o.innerType,t,s);const a=t.seen.get(e);a.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},"prefaultProcessor"),Li=r((e,t,n,s)=>{const o=e._zod.def;K(o.innerType,t,s);const a=t.seen.get(e);a.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},"catchProcessor"),Fi=r((e,t,n,s)=>{const o=e._zod.def,a=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?a?o.out:o.in:o.out;K(i,t,s);const u=t.seen.get(e);u.ref=i},"pipeProcessor"),Vi=r((e,t,n,s)=>{const o=e._zod.def;K(o.innerType,t,s);const a=t.seen.get(e);a.ref=o.innerType,n.readOnly=!0},"readonlyProcessor"),qn=r((e,t,n,s)=>{const o=e._zod.def;K(o.innerType,t,s);const a=t.seen.get(e);a.ref=o.innerType},"optionalProcessor"),Bi=r((e,t,n,s)=>{const o=e._zod.innerType;K(o,t,s);const a=t.seen.get(e);a.ref=o},"lazyProcessor"),Ji=y("ZodISODateTime",(e,t)=>{Br.init(e,t),G.init(e,t)});function Gi(e){return Xa(Ji,e)}r(Gi,"datetime");const Wi=y("ZodISODate",(e,t)=>{Jr.init(e,t),G.init(e,t)});function Hi(e){return Qa(Wi,e)}r(Hi,"date");const Ki=y("ZodISOTime",(e,t)=>{Gr.init(e,t),G.init(e,t)});function Yi(e){return qa(Ki,e)}r(Yi,"time");const Xi=y("ZodISODuration",(e,t)=>{Wr.init(e,t),G.init(e,t)});function Qi(e){return ei(Xi,e)}r(Qi,"duration");const re=y("ZodError",r((e,t)=>{wn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r(n=>jo(e,n),"value")},flatten:{value:r(n=>No(e,n),"value")},addIssue:{value:r(n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,bt,2)},"value")},addIssues:{value:r(n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,bt,2)},"value")},isEmpty:{get(){return e.issues.length===0}}})},"initializer"),{Parent:Error}),qi=xt(re),ec=$t(re),tc=Qe(re),nc=qe(re),sc=Co(re),oc=Uo(re),rc=Lo(re),ac=Fo(re),ic=Vo(re),cc=Bo(re),uc=Jo(re),lc=Go(re),es=new WeakMap;function Ce(e,t,n){const s=Object.getPrototypeOf(e);let o=es.get(s);if(o||(o=new Set,es.set(s,o)),!o.has(t)){o.add(t);for(const a in n){const i=n[a];Object.defineProperty(s,a,{configurable:!0,enumerable:!1,get(){const u=i.bind(this);return Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:u}),u},set(u){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:u})}})}}}r(Ce,"_installLazyMethods");const J=y("ZodType",(e,t)=>(V.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ot(e,"input"),output:ot(e,"output")}}),e.toJSONSchema=_i(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,s)=>qi(e,n,s,{callee:e.parse}),e.safeParse=(n,s)=>tc(e,n,s),e.parseAsync=async(n,s)=>ec(e,n,s,{callee:e.parseAsync}),e.safeParseAsync=async(n,s)=>nc(e,n,s),e.spa=e.safeParseAsync,e.encode=(n,s)=>sc(e,n,s),e.decode=(n,s)=>oc(e,n,s),e.encodeAsync=async(n,s)=>rc(e,n,s),e.decodeAsync=async(n,s)=>ac(e,n,s),e.safeEncode=(n,s)=>ic(e,n,s),e.safeDecode=(n,s)=>cc(e,n,s),e.safeEncodeAsync=async(n,s)=>uc(e,n,s),e.safeDecodeAsync=async(n,s)=>lc(e,n,s),Ce(e,"ZodType",{check(...n){const s=this.def;return this.clone(ve(s,{checks:[...s.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,s){return ye(this,n,s)},brand(){return this},register(n,s){return n.add(this,s),this},refine(n,s){return this.check(ou(n,s))},superRefine(n,s){return this.check(ru(n,s))},overwrite(n){return this.check(Te(n))},optional(){return us(this)},exactOptional(){return Vc(this)},nullable(){return ls(this)},nullish(){return us(ls(this))},nonoptional(n){return Kc(this,n)},array(){return T(this)},or(n){return W([this,n])},and(n){return Mc(this,n)},transform(n){return ps(this,Lc(n))},default(n){return Gc(this,n)},prefault(n){return Hc(this,n)},catch(n){return Xc(this,n)},pipe(n){return ps(this,n)},readonly(){return eu(this)},describe(n){const s=this.clone();return De.add(s,{description:n}),s},meta(...n){if(n.length===0)return De.get(this);const s=this.clone();return De.add(s,n[0]),s},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return De.get(e)?.description},configurable:!0}),e)),ts=y("_ZodString",(e,t)=>{Et.init(e,t),J.init(e,t),e._zod.processJSONSchema=(s,o,a)=>Ii(e,s,o,a);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Ce(e,"_ZodString",{regex(...s){return this.check(ai(...s))},includes(...s){return this.check(ui(...s))},startsWith(...s){return this.check(li(...s))},endsWith(...s){return this.check(di(...s))},min(...s){return this.check(st(...s))},max(...s){return this.check(Hn(...s))},length(...s){return this.check(Kn(...s))},nonempty(...s){return this.check(st(1,...s))},lowercase(s){return this.check(ii(s))},uppercase(s){return this.check(ci(s))},trim(){return this.check(fi())},normalize(...s){return this.check(pi(...s))},toLowerCase(){return this.check(hi())},toUpperCase(){return this.check(mi())},slugify(){return this.check(gi())}})}),dc=y("ZodString",(e,t)=>{Et.init(e,t),ts.init(e,t),e.email=n=>e.check(Ta(pc,n)),e.url=n=>e.check(Na(fc,n)),e.jwt=n=>e.check(Ya(zc,n)),e.emoji=n=>e.check(ja(hc,n)),e.guid=n=>e.check(Bn(ns,n)),e.uuid=n=>e.check(Oa(rt,n)),e.uuidv4=n=>e.check(Pa(rt,n)),e.uuidv6=n=>e.check(Ra(rt,n)),e.uuidv7=n=>e.check(Za(rt,n)),e.nanoid=n=>e.check(Ma(mc,n)),e.guid=n=>e.check(Bn(ns,n)),e.cuid=n=>e.check(Da(gc,n)),e.cuid2=n=>e.check(Ca(vc,n)),e.ulid=n=>e.check(Ua(yc,n)),e.base64=n=>e.check(Wa(xc,n)),e.base64url=n=>e.check(Ha($c,n)),e.xid=n=>e.check(La(wc,n)),e.ksuid=n=>e.check(Fa(kc,n)),e.ipv4=n=>e.check(Va(bc,n)),e.ipv6=n=>e.check(Ba(_c,n)),e.cidrv4=n=>e.check(Ja(Sc,n)),e.cidrv6=n=>e.check(Ga(Ic,n)),e.e164=n=>e.check(Ka(Ec,n)),e.datetime=n=>e.check(Gi(n)),e.date=n=>e.check(Hi(n)),e.time=n=>e.check(Yi(n)),e.duration=n=>e.check(Qi(n))});function p(e){return Aa(dc,e)}r(p,"string");const G=y("ZodStringFormat",(e,t)=>{B.init(e,t),ts.init(e,t)}),pc=y("ZodEmail",(e,t)=>{Nr.init(e,t),G.init(e,t)}),ns=y("ZodGUID",(e,t)=>{Rr.init(e,t),G.init(e,t)}),rt=y("ZodUUID",(e,t)=>{Zr.init(e,t),G.init(e,t)}),fc=y("ZodURL",(e,t)=>{jr.init(e,t),G.init(e,t)}),hc=y("ZodEmoji",(e,t)=>{Mr.init(e,t),G.init(e,t)}),mc=y("ZodNanoID",(e,t)=>{Dr.init(e,t),G.init(e,t)}),gc=y("ZodCUID",(e,t)=>{Cr.init(e,t),G.init(e,t)}),vc=y("ZodCUID2",(e,t)=>{Ur.init(e,t),G.init(e,t)}),yc=y("ZodULID",(e,t)=>{Lr.init(e,t),G.init(e,t)}),wc=y("ZodXID",(e,t)=>{Fr.init(e,t),G.init(e,t)}),kc=y("ZodKSUID",(e,t)=>{Vr.init(e,t),G.init(e,t)}),bc=y("ZodIPv4",(e,t)=>{Hr.init(e,t),G.init(e,t)}),_c=y("ZodIPv6",(e,t)=>{Kr.init(e,t),G.init(e,t)}),Sc=y("ZodCIDRv4",(e,t)=>{Yr.init(e,t),G.init(e,t)}),Ic=y("ZodCIDRv6",(e,t)=>{Xr.init(e,t),G.init(e,t)}),xc=y("ZodBase64",(e,t)=>{Qr.init(e,t),G.init(e,t)}),$c=y("ZodBase64URL",(e,t)=>{ea.init(e,t),G.init(e,t)}),Ec=y("ZodE164",(e,t)=>{ta.init(e,t),G.init(e,t)}),zc=y("ZodJWT",(e,t)=>{sa.init(e,t),G.init(e,t)}),ss=y("ZodNumber",(e,t)=>{Tn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(s,o,a)=>xi(e,s,o,a),Ce(e,"ZodNumber",{gt(s,o){return this.check(Gn(s,o))},gte(s,o){return this.check(Tt(s,o))},min(s,o){return this.check(Tt(s,o))},lt(s,o){return this.check(Jn(s,o))},lte(s,o){return this.check(At(s,o))},max(s,o){return this.check(At(s,o))},int(s){return this.check(os(s))},safe(s){return this.check(os(s))},positive(s){return this.check(Gn(0,s))},nonnegative(s){return this.check(Tt(0,s))},negative(s){return this.check(Jn(0,s))},nonpositive(s){return this.check(At(0,s))},multipleOf(s,o){return this.check(Wn(s,o))},step(s,o){return this.check(Wn(s,o))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function R(e){return ti(ss,e)}r(R,"number");const Ac=y("ZodNumberFormat",(e,t)=>{oa.init(e,t),ss.init(e,t)});function os(e){return ni(Ac,e)}r(os,"int");const Tc=y("ZodBoolean",(e,t)=>{ra.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>$i(e,n,s,o)});function U(e){return si(Tc,e)}r(U,"boolean");const Oc=y("ZodUnknown",(e,t)=>{aa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>{}});function X(){return oi(Oc)}r(X,"unknown");const Pc=y("ZodNever",(e,t)=>{ia.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ei(e,n,s,o)});function Rc(e){return ri(Pc,e)}r(Rc,"never");const Zc=y("ZodArray",(e,t)=>{ca.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Pi(e,n,s,o),e.element=t.element,Ce(e,"ZodArray",{min(n,s){return this.check(st(n,s))},nonempty(n){return this.check(st(1,n))},max(n,s){return this.check(Hn(n,s))},length(n,s){return this.check(Kn(n,s))},unwrap(){return this.element}})});function T(e,t){return vi(Zc,e,t)}r(T,"array");const rs=y("ZodObject",(e,t)=>{la.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ri(e,n,s,o),N(e,"shape",()=>t.shape),Ce(e,"ZodObject",{keyof(){return Dc(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:X()})},loose(){return this.clone({...this._zod.def,catchall:X()})},strict(){return this.clone({...this._zod.def,catchall:Rc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Ao(this,n)},safeExtend(n){return To(this,n)},merge(n){return Oo(this,n)},pick(n){return Eo(this,n)},omit(n){return zo(this,n)},partial(...n){return Po(cs,this,n[0])},required(...n){return Ro(ds,this,n[0])}})});function d(e,t){return new rs({type:"object",shape:e??{},...x(t)})}r(d,"object");function at(e,t){return new rs({type:"object",shape:e,catchall:X(),...x(t)})}r(at,"looseObject");const as=y("ZodUnion",(e,t)=>{Nn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Zi(e,n,s,o),e.options=t.options});function W(e,t){return new as({type:"union",options:e,...x(t)})}r(W,"union");const Nc=y("ZodDiscriminatedUnion",(e,t)=>{as.init(e,t),da.init(e,t)});function he(e,t,n){return new Nc({type:"union",options:t,discriminator:e,...x(n)})}r(he,"discriminatedUnion");const jc=y("ZodIntersection",(e,t)=>{pa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ni(e,n,s,o)});function Mc(e,t){return new jc({type:"intersection",left:e,right:t})}r(Mc,"intersection");const is=y("ZodRecord",(e,t)=>{fa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>ji(e,n,s,o),e.keyType=t.keyType,e.valueType=t.valueType});function it(e,t,n){return!t||!t._zod?new is({type:"record",keyType:p(),valueType:e,...x(t)}):new is({type:"record",keyType:e,valueType:t,...x(n)})}r(it,"record");const Ot=y("ZodEnum",(e,t)=>{ha.init(e,t),J.init(e,t),e._zod.processJSONSchema=(s,o,a)=>zi(e,s,o,a),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(s,o)=>{const a={};for(const i of s)if(n.has(i))a[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ot({...t,checks:[],...x(o),entries:a})},e.exclude=(s,o)=>{const a={...t.entries};for(const i of s)if(n.has(i))delete a[i];else throw new Error(`Key ${i} not found in enum`);return new Ot({...t,checks:[],...x(o),entries:a})}});function Dc(e,t){return new Ot({type:"enum",entries:Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e,...x(t)})}r(Dc,"_enum");const Cc=y("ZodLiteral",(e,t)=>{ma.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ai(e,n,s,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function g(e,t){return new Cc({type:"literal",values:Array.isArray(e)?e:[e],...x(t)})}r(g,"literal");const Uc=y("ZodTransform",(e,t)=>{ga.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Oi(e,n,s,o),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new pn(e.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(Me(a,n.value,t));else{const i=a;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Me(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(a=>(n.value=a,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function Lc(e){return new Uc({type:"transform",transform:e})}r(Lc,"transform");const cs=y("ZodOptional",(e,t)=>{Dn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>qn(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function us(e){return new cs({type:"optional",innerType:e})}r(us,"optional");const Fc=y("ZodExactOptional",(e,t)=>{va.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>qn(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Vc(e){return new Fc({type:"optional",innerType:e})}r(Vc,"exactOptional");const Bc=y("ZodNullable",(e,t)=>{ya.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Mi(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function ls(e){return new Bc({type:"nullable",innerType:e})}r(ls,"nullable");const Jc=y("ZodDefault",(e,t)=>{wa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ci(e,n,s,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Gc(e,t){return new Jc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():vn(t)}})}r(Gc,"_default");const Wc=y("ZodPrefault",(e,t)=>{ka.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ui(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Hc(e,t){return new Wc({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():vn(t)}})}r(Hc,"prefault");const ds=y("ZodNonOptional",(e,t)=>{ba.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Di(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Kc(e,t){return new ds({type:"nonoptional",innerType:e,...x(t)})}r(Kc,"nonoptional");const Yc=y("ZodCatch",(e,t)=>{_a.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Li(e,n,s,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Xc(e,t){return new Yc({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}r(Xc,"_catch");const Qc=y("ZodPipe",(e,t)=>{Sa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Fi(e,n,s,o),e.in=t.in,e.out=t.out});function ps(e,t){return new Qc({type:"pipe",in:e,out:t})}r(ps,"pipe");const qc=y("ZodReadonly",(e,t)=>{Ia.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Vi(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function eu(e){return new qc({type:"readonly",innerType:e})}r(eu,"readonly");const tu=y("ZodLazy",(e,t)=>{xa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Bi(e,n,s,o),e.unwrap=()=>e._zod.def.getter()});function nu(e){return new tu({type:"lazy",getter:e})}r(nu,"lazy");const fs=y("ZodCustom",(e,t)=>{$a.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ti(e,n,s,o)});function su(e,t){return yi(fs,e??(()=>!0),t)}r(su,"custom");function ou(e,t={}){return wi(fs,e,t)}r(ou,"refine");function ru(e,t){return ki(e,t)}r(ru,"superRefine");const Ue=p(),Pt=he("code",[d({code:g("bad-request"),message:p(),details:d({issues:T(su())})}),d({code:g("cancelled"),message:p(),details:d({})}),d({code:g("session-not-found"),message:p(),details:d({sessionId:p()})}),d({code:g("model-unavailable"),message:p(),details:d({provider:p(),model:p()})}),d({code:g("session-conflict"),message:p(),details:d({sessionId:p(),requestedCwd:p(),existingCwd:p().optional()})}),d({code:g("invalid-time-zone"),message:p(),details:d({value:p()})}),d({code:g("workspace-attach-failed"),message:p(),details:d({sessionId:p(),workspaceId:p()})}),d({code:g("workspace-not-found"),message:p(),details:d({workspaceId:p()})}),d({code:g("workspace-invalid-path"),message:p(),details:d({path:p()})}),d({code:g("workspace-name-conflict"),message:p(),details:d({name:p()})}),d({code:g("workspace-move-invalid"),message:p(),details:d({workspaceId:p(),sessionId:p(),beforeSessionId:p().optional()})}),d({code:g("directory-unreadable"),message:p(),details:d({path:p()})}),d({code:g("directory-exists"),message:p(),details:d({path:p()})}),d({code:g("directory-create-failed"),message:p(),details:d({path:p()})}),d({code:g("directory-picker-unavailable"),message:p(),details:d({capability:p()})}),d({code:g("agent-preset-read-only"),message:p(),details:d({agentPreset:p(),reason:p()})}),d({code:g("agent-preset-locked"),message:p(),details:d({sessionId:p(),agentPreset:p()})}),d({code:g("agent-preset-conflict"),message:p(),details:d({sessionId:p(),requestedPreset:p(),existingPreset:p().optional()})}),d({code:g("agent-preset-not-found"),message:p(),details:d({agentPreset:p(),available:T(p())})}),d({code:g("agent-preset-invalid"),message:p(),details:d({agentPreset:p(),reason:p()})}),d({code:g("agent-busy"),message:p(),details:d({reason:p()})}),d({code:g("attachment-error"),message:p(),details:d({reason:p()})}),d({code:g("queue-item-not-found"),message:p(),details:d({itemId:p()})}),d({code:g("steer-unavailable"),message:p(),details:d({itemId:p()})}),d({code:g("command-error"),message:p(),details:d({})}),d({code:g("unknown-command"),message:p(),details:d({})}),d({code:g("settings-rejected"),message:p(),details:d({ns:p()})}),d({code:g("settings-not-exposed"),message:p(),details:d({ns:p()})}),d({code:g("settings-conflict"),message:p(),details:d({ns:p(),expected:R(),actual:R()})}),d({code:g("credential-rejected"),message:p(),details:d({ref:p()})}),d({code:g("model-discovery-failed"),message:p(),details:d({settingsNs:p(),baseURL:p().optional()})}),d({code:g("title-invalid"),message:p(),details:d({sessionId:p()})}),d({code:g("fork-unavailable"),message:p(),details:d({sessionId:p()})}),d({code:g("subagent-parent-unavailable"),message:p(),details:d({parentSessionId:p()})}),d({code:g("subagent-not-found"),message:p(),details:d({parentSessionId:p(),childSessionId:p()})}),d({code:g("subagent-catalog-diagnostic"),message:p(),details:d({parentSessionId:p(),childSessionId:p(),reason:W([g("corrupt"),g("unsupported"),g("unavailable")])})}),d({code:g("subagent-not-resumable"),message:p(),details:d({childSessionId:p()})}),d({code:g("subagent-unauthorized"),message:p(),details:d({childSessionId:p()})}),d({code:g("subagent-delivery-unavailable"),message:p(),details:d({childSessionId:p()})}),d({code:g("internal"),message:p(),details:d({})})]);function hs(e){return W([d({ok:g(!0),value:e}),d({ok:g(!1),error:Pt})])}r(hs,"rpcResultSchema");const au=d({type:g("client-request"),rpcId:Ue,method:p(),payload:X()}),Rt=d({type:g("server-response"),rpcId:Ue,result:hs(X().optional())}),Zt=d({type:g("server-request"),rpcId:Ue,method:p(),payload:X()});he("type",[au,Rt,Zt,d({type:g("client-response"),rpcId:Ue,result:hs(X().optional())})]);const iu=W([d({accepted:g(!0)}),d({accepted:g(!1),reason:W([g("not-pending"),g("bad-response")])})]);function cu(e,t){let n=0,s=0;for(const o of e){if(n===t)return e.slice(0,s);n++,s+=o.length}return e}r(cu,"truncateUnicodeCodePoints");const z=p().min(1),ms=p().min(1),de=p().min(1),gs=d({type:p(),seq:R().int().nonnegative(),time:R(),data:X(),sourceEventSeqs:T(R()).optional(),surfaceOp:X().optional(),ignorable:g(!0).optional()}),uu=d({sessionId:z,updatedAt:R(),running:U(),blank:U(),parentSessionId:z.optional(),origin:g("subagent").optional(),cwd:p().optional(),agentPreset:p().optional(),projections:nu(()=>Nt).optional()});d({cursor:p().optional()});const lu=d({items:T(uu)});d({query:p().trim().min(1).max(500).refine(e=>!e.includes("\0"),{message:"search query must not contain NUL"})});const du=d({items:T(d({sessionId:z,snippet:p().refine(e=>cu(e,240)===e,{message:"search snippet must contain at most 240 Unicode code points"})})).max(20),hasMore:U()});d({workspaceId:de.optional(),cwd:p().optional(),sessionId:z.optional(),agentPreset:p().optional()}).refine(e=>e.workspaceId===void 0||e.cwd===void 0,{message:"session.create accepts workspaceId or cwd, not both"});const pu=d({sessionId:z,agentPreset:p().optional()});d({sessionId:z,title:p()});const fu=d({title:p().min(1),seq:R().int().nonnegative()});d({sessionId:z,atSeq:R().int().nonnegative().optional()});const hu=d({sessionId:z});d({sessionId:z,beforeSeq:R().int().nonnegative().optional(),maxMessages:R().int().positive().optional()});const vs=d({provider:p().min(1),model:p().min(1),reasoningEffort:p().min(1).optional()}),mu=d({efforts:T(d({id:p().min(1),name:p().min(1),description:p().optional()})).min(1),defaultEffort:p().min(1).optional()}),gu=d({id:p().min(1),name:p().min(1),description:p().optional(),reasoning:mu.optional()}),ys=d({id:p().min(1),name:p().min(1),models:T(gu)}),ws=d({id:p().min(1),name:p().min(1),message:p()}),ks=he("for",[d({for:g("call"),view:at({card:p()})}),d({for:g("result"),view:at({card:p()})})]),bs=d({event:gs,view:ks.optional()}),Nt=d({asOfSeq:R().int().min(-1),values:it(p(),X())});d({blank:U(),lastPromptAt:R().nullable()}),d({maxImageBytes:R().int().positive(),maxImagesPerMessage:R().int().positive(),maxMessageImageBytes:R().int().positive(),maxImagePixels:R().int().positive(),mediaTypes:T(p())});const vu=d({events:T(bs),hasMore:U(),projections:Nt.optional()});d({sessionId:z});const yu=d({current:vs,routable:U(),groups:T(ys),failures:T(ws)});d({sessionId:z,provider:p().min(1),model:p().min(1),reasoningEffort:p().min(1).optional()});const wu=d({selected:vs}),jt=at({type:p()}),_s=W([g("image/png"),g("image/jpeg"),g("image/webp"),g("image/gif")]),ku=he("type",[d({type:g("text"),text:p()}),d({type:g("image"),mediaType:_s,data:p(),name:p().optional()})]);d({sessionId:z,mode:W([g("queue"),g("steer")]),content:T(ku),clientTimeZone:p().optional()});const bu=d({accepted:g(!0),command:d({kind:g("success"),text:p().optional()}).optional()}),Ss=p().min(1),_u=d({attachmentId:Ss,mediaType:_s,bytes:R().int().positive(),width:R().int().positive(),height:R().int().positive(),name:p().optional()});d({sessionId:z,attachmentId:Ss});const Su=d({attachment:_u,data:p()});d({sessionId:z,itemId:ms,action:he("kind",[d({kind:g("edit"),content:T(jt)}),d({kind:g("remove")}),d({kind:g("steer")})])});const Iu=d({accepted:g(!0)});d({sessionId:z});const xu=d({accepted:g(!0)}),Mt=p().min(1);d({sessionId:z,approvalId:Mt,outcome:W([g("allowed-once"),g("rejected")])});const $u=d({id:p().min(1),kind:p().min(1),label:p().min(1),status:W([g("running"),g("stopping"),g("completed"),g("killed"),g("failed")]),detail:p().optional(),startedAt:R().int().nonnegative(),finishedAt:R().int().nonnegative().optional()}),Le=d({workspaceId:de,path:p(),title:p(),sessionIds:T(z),createdAt:p(),updatedAt:p()});d({});const Eu=d({items:T(Le),archivedSessionIds:T(z)});d({path:p()});const zu=d({workspace:Le,created:U()});d({workspaceId:de,title:p()}).refine(e=>e.title.trim()!=="",{message:"workspace.rename requires a non-blank title"});const Au=d({workspace:Le});d({workspaceId:de});const Tu=d({deleted:g(!0)});d({workspaceId:de,beforeWorkspaceId:de.optional()});const Ou=d({workspaceIds:T(de)});d({workspaceId:de,sessionId:z,beforeSessionId:z.optional()});const Pu=d({workspace:Le});d({sessionId:z});const Ru=d({archivedSessionIds:T(z)}),Zu=d({id:p(),question:p(),header:p().optional(),detail:p().optional(),options:T(d({label:p(),description:p().optional()})).optional(),multiSelect:U().optional(),intent:he("kind",[d({kind:g("plan-review"),approve:p()})]).optional()}),Nu=d({id:p().min(1),role:W([g("system"),g("user"),g("assistant")]),content:T(jt),source:at({kind:p()})}),Is=he("type",[d({type:g("session/event"),sessionId:z,event:gs,view:ks.optional()}),d({type:g("session/subscribed"),sessionId:z,lastSeq:R().int()}),d({type:g("approval/requested"),sessionId:z,approvalId:Mt,toolName:p(),callId:p().optional(),reason:p().optional()}),d({type:g("approval/resolved"),sessionId:z,approvalId:Mt,outcome:W([g("allowed-once"),g("rejected"),g("cancelled"),g("unavailable")])}),d({type:g("question/requested"),sessionId:z,questions:T(Zu).min(1)}),d({type:g("question/resolved"),sessionId:z,questionRpcId:Ue,outcome:W([g("answered"),g("cancelled")])}),d({type:g("session/queue"),sessionId:z,items:T(d({id:ms,placement:W([g("queued"),g("steering"),g("context")]),message:Nu}))}),d({type:g("session/jobs"),sessionId:z,jobs:T($u)}),d({type:g("session/projection"),sessionId:z,key:p().min(1),value:X(),seq:R().int().nonnegative()}),d({type:g("stream/error"),error:Pt})]),xs=he("type",[d({type:g("host/session-added"),sessionId:z,blank:U(),parentSessionId:z.optional(),origin:g("subagent").optional(),cwd:p().optional(),agentPreset:p().optional()}),d({type:g("host/session-removed"),sessionId:z}),d({type:g("host/session-status"),sessionId:z,running:U()}),d({type:g("host/agent-error"),sessionId:z,message:p()}),d({type:g("host/workspace-changed"),workspace:Le}),d({type:g("host/workspace-removed"),workspaceId:de}),d({type:g("host/workspace-order-changed"),workspaceIds:T(de)}),d({type:g("host/archived-sessions-changed"),archivedSessionIds:T(z)}),d({type:g("host/remote-event"),event:p().min(1),args:T(X())}),d({type:g("stream/error"),error:Pt})]);d({});const ju=d({version:p(),cwd:p(),provider:p().optional(),model:p().optional(),attachedSessions:R().int().nonnegative(),canOpenPath:U()});d({});const Mu=d({path:p().nullable()}),$s=d({name:p(),path:p(),hidden:U()});d({path:p().optional()});const Du=d({path:p(),home:p(),crumbs:T($s),entries:T($s),truncated:U()});d({path:p(),name:p()}).refine(e=>e.name.trim()!==""&&e.name!=="."&&e.name!==".."&&!/[/\\]/.test(e.name),{message:"host.createDirectory requires a single non-blank path segment name"});const Cu=d({path:p()});d({path:p().min(1)});const Uu=d({opened:g(!0)}),Lu=d({name:p().min(1),description:p(),whenToUse:p().optional(),modelInvocable:U()});d({sessionId:z});const Fu=d({skills:T(Lu)}),Vu=d({id:p().min(1),trust:W([g("system"),g("user")]),isDefault:U(),name:p().optional(),description:p().optional(),broken:p().min(1).optional()});d({});const Bu=d({presets:T(Vu),authorable:U(),hasDocument:U()});d({sessionId:z,agentPreset:p().min(1)});const Ju=d({agentPreset:p()});d({agentPreset:p().min(1)});const Gu=d({agentPreset:p(),trust:W([g("system"),g("user")]),content:p(),name:p().optional(),description:p().optional()});d({from:p().min(1),agentPreset:p().min(1),name:p().optional()});const Wu=d({agentPreset:p()});d({agentPreset:p().min(1)});const Hu=W([d({opened:g(!0)}),d({opened:g(!1),path:p()})]);d({agentPreset:p().min(1)});const Ku=d({}),Oe=d({id:p(),revision:R().int().positive()}),Fe=d({ref:Oe});d({sessionId:p(),objective:p().min(1),maxGoalRounds:R().int().positive().optional()});const Yu=Fe;d({sessionId:p(),ref:Oe,objective:p().min(1).optional(),maxGoalRounds:R().int().positive().optional()}).refine(e=>e.objective!==void 0||e.maxGoalRounds!==void 0,{message:"goal.edit requires objective or maxGoalRounds"});const Xu=Fe;d({sessionId:p(),ref:Oe});const Qu=Fe;d({sessionId:p(),ref:Oe});const qu=Fe;d({sessionId:p(),ref:Oe});const el=Fe;d({sessionId:p(),ref:Oe});const tl=d({cleared:g(!0)}),nl=d({path:T(p()),set:U()}),ct=d({ns:p().min(1),schema:X(),value:X(),base:X().optional(),user:X().optional(),applies:W([g("live"),g("restart")]),secrets:T(nl),revision:R()});d({});const sl=d({writable:U(),hasDocument:U(),namespaces:T(ct)});d({});const ol=d({opened:g(!0)});d({ns:p().min(1),patch:it(p(),X()),expectedRevision:R().optional()});const rl=ct;d({ns:p().min(1),section:it(p(),X()),expectedRevision:R().optional()});const al=he("op",[d({op:g("set"),path:T(p()),value:X()}),d({op:g("unset"),path:T(p())})]);d({ns:p().min(1),ops:T(al),expectedRevision:R().optional()});const il=ct,cl=ct,Dt=p().regex(/^[A-Za-z_][A-Za-z0-9_]*$/),ul=d({configured:U(),source:p().optional(),writable:U()});d({refs:T(Dt).max(64)});const ll=d({credentials:it(p(),ul)});d({ref:Dt,value:p().min(1)});const dl=d({});d({ref:Dt});const pl=d({}),fl=d({provider:p().min(1),displayName:p().min(1),settingsNs:p(),settingsPath:T(p()),active:U(),declared:U().optional()});d({});const hl=d({providers:T(fl)});d({});const ml=d({groups:T(ys),failures:T(ws)}),gl=d({id:p().min(1),name:p().min(1).optional(),contextWindow:R().int().positive().optional(),maxTokens:R().int().positive().optional()});d({settingsNs:p().min(1),provider:p().min(1).optional(),baseURL:p().min(1).optional(),api:p().min(1).optional(),apiKey:p().min(1).optional()});const vl=d({models:T(gl)}),yl=W([d({kind:g("child"),id:z,mode:g("one-shot"),activity:W([g("running"),g("inactive")]),hasChildren:U(),label:p().optional()}),d({kind:g("child"),id:z,mode:g("continuable"),activity:W([g("running"),g("inactive")]),hasChildren:U(),label:p()}),d({kind:g("diagnostic"),id:z,reason:W([g("corrupt"),g("unsupported"),g("unavailable")])})]);d({parentSessionId:z});const wl=d({entries:T(yl),parentAvailable:U()});d({parentSessionId:z,childSessionId:z,mode:W([g("one-shot"),g("continuable")]),beforeSeq:R().int().nonnegative().optional(),maxMessages:R().int().positive().optional()});const kl=d({events:T(bs),hasMore:U(),projections:Nt.optional()});d({parentSessionId:z,childSessionId:z,mode:g("continuable"),content:T(jt),clientTimeZone:p().optional()}),d({parentSessionId:z,childSessionId:z,mode:g("continuable")});const bl=d({accepted:g(!0)}),_l={"session.list":lu,"session.search":du,"session.create":pu,"session.history":vu,"session.models":yu,"session.selectModel":wu,"session.rename":fu,"session.fork":hu,"session.prompt":bu,"session.attachment":Su,"session.updateQueue":Iu,"session.cancel":xu,"subagent.list":wl,"subagent.history":kl,"subagent.prompt":d({messageId:p()}),"subagent.interrupt":bl,"host.describe":ju,"host.pickDirectory":Mu,"host.listDirectory":Du,"host.createDirectory":Cu,"host.openPath":Uu,"workspace.list":Eu,"workspace.create":zu,"workspace.rename":Au,"workspace.delete":Tu,"workspace.insertBefore":Ou,"workspace.insertSessionBefore":Pu,"workspace.archiveSession":Ru,"skill.list":Fu,"agentPreset.list":Bu,"agentPreset.select":Ju,"agentPreset.read":Gu,"agentPreset.copy":Wu,"agentPreset.openDocument":Hu,"agentPreset.remove":Ku,"goal.create":Yu,"goal.edit":Xu,"goal.pause":Qu,"goal.resume":qu,"goal.complete":el,"goal.clear":tl,"settings.describe":sl,"settings.openDocument":ol,"settings.update":rl,"settings.replace":cl,"settings.mutate":il,"credentials.describe":ll,"credentials.set":dl,"credentials.unset":pl,"llm.providers":hl,"llm.models":ml,"llm.discoverModels":vl},Sl=3e4,Il="http://dsh.internal";var Ct=class{static{r(this,"AbstractApiClient")}timeoutMs;envelopeBatch=[];flushScheduled=!1;envelopeListeners=new Set;constructor(e=Sl){this.timeoutMs=e}subscribeEnvelopes(e){return this.envelopeListeners.add(e),()=>{this.envelopeListeners.delete(e)}}onEnvelope(e){this.envelopeListeners.size!==0&&(this.envelopeBatch.push(e),!this.flushScheduled&&(this.flushScheduled=!0,queueMicrotask(()=>{this.flushScheduled=!1;const t=this.envelopeBatch;this.envelopeBatch=[];for(const n of this.envelopeListeners)try{n(t)}catch(s){console.error("[apiproxy] envelope listener threw:",s)}})))}resolveBase(){const e=globalThis.location;return e?.origin!==void 0&&e.origin!=="null"?e.origin:Il}mintRpcId(){return crypto.randomUUID()}async postJson(e,t,n,s="default"){const o=s==="default"?n===void 0?AbortSignal.timeout(this.timeoutMs):AbortSignal.any([AbortSignal.timeout(this.timeoutMs),n]):n,a=await this.doFetch(new URL(e,this.resolveBase()),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t),...o===void 0?{}:{signal:o}});if(!a.ok)throw new Error(`transport failure for ${e}: HTTP ${a.status}`);return a}async callUnary(e,t,n,s="default"){const o={type:"client-request",rpcId:this.mintRpcId(),method:e,payload:t};this.onEnvelope(o);const a=await this.postJson(`/api/${e}`,o,n,s),i=Rt.parse(await a.json());if(this.onEnvelope(i),i.rpcId!==o.rpcId)throw new Error(`rpcId mismatch for ${e}: sent ${o.rpcId}, got ${i.rpcId}`);if(!i.result.ok)return{rpcId:i.rpcId,result:i.result};const u=_l[e].parse(i.result.value);return{rpcId:i.rpcId,result:{ok:!0,value:u}}}openMux(e,t,n){return this.readSse("/api/events.mux",t,Is,n)}openHost(e,t,n){return this.readSse("/api/events.host",t,xs,n)}async*readSse(e,t,n,s){const o=await this.doFetch(new URL(e,this.resolveBase()),{signal:t});if(!o.ok||o.body===null)throw new Error(`transport failure for ${e}: HTTP ${o.status}`);s?.();const a=o.body.getReader(),i=new TextDecoder;let u="";try{for(;;){const{done:f,value:m}=await a.read();if(f)return;u+=i.decode(m,{stream:!0});let k;for(;(k=u.indexOf(`
|
|
64
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const i of e.seen.entries()){const u=i[1];if(t===i[0]){a(i);continue}if(e.external){const f=e.external.registry.get(i[0])?.id;if(t!==i[0]&&f){a(i);continue}}if(e.metadataRegistry.get(i[0])?.id){a(i);continue}if(u.cycle){a(i);continue}if(u.count>1&&e.reused==="ref"){a(i);continue}}}r(Xn,"extractDefs");function Qn(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const s=r(u=>{const f=e.seen.get(u);if(f.ref===null)return;const m=f.def??f.schema,k={...m},_=f.ref;if(f.ref=null,_){s(_);const S=e.seen.get(_),E=S.schema;if(E.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(m.allOf=m.allOf??[],m.allOf.push(E)):Object.assign(m,E),Object.assign(m,k),u._zod.parent===_)for(const D in m)D==="$ref"||D==="allOf"||D in k||delete m[D];if(E.$ref&&S.def)for(const D in m)D==="$ref"||D==="allOf"||D in S.def&&JSON.stringify(m[D])===JSON.stringify(S.def[D])&&delete m[D]}const b=u._zod.parent;if(b&&b!==_){s(b);const S=e.seen.get(b);if(S?.schema.$ref&&(m.$ref=S.schema.$ref,S.def))for(const E in m)E==="$ref"||E==="allOf"||E in S.def&&JSON.stringify(m[E])===JSON.stringify(S.def[E])&&delete m[E]}e.override({zodSchema:u,jsonSchema:m,path:f.path??[]})},"flattenRef");for(const u of[...e.seen.entries()].reverse())s(u[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const u=e.external.registry.get(t)?.id;if(!u)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(u)}Object.assign(o,n.def??n.schema);const a=e.metadataRegistry.get(t)?.id;a!==void 0&&o.id===a&&delete o.id;const i=e.external?.defs??{};for(const u of e.seen.entries()){const f=u[1];f.def&&f.defId&&(f.def.id===f.defId&&delete f.def.id,i[f.defId]=f.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{const u=JSON.parse(JSON.stringify(o));return Object.defineProperty(u,"~standard",{value:{...t["~standard"],jsonSchema:{input:ot(t,"input",e.processors),output:ot(t,"output",e.processors)}},enumerable:!1,writable:!1}),u}catch{throw new Error("Error converting schema to JSON.")}}r(Qn,"finalize");function ee(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const s=e._zod.def;if(s.type==="transform")return!0;if(s.type==="array")return ee(s.element,n);if(s.type==="set")return ee(s.valueType,n);if(s.type==="lazy")return ee(s.getter(),n);if(s.type==="promise"||s.type==="optional"||s.type==="nonoptional"||s.type==="nullable"||s.type==="readonly"||s.type==="default"||s.type==="prefault")return ee(s.innerType,n);if(s.type==="intersection")return ee(s.left,n)||ee(s.right,n);if(s.type==="record"||s.type==="map")return ee(s.keyType,n)||ee(s.valueType,n);if(s.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:ee(s.in,n)||ee(s.out,n);if(s.type==="object"){for(const o in s.shape)if(ee(s.shape[o],n))return!0;return!1}if(s.type==="union"){for(const o of s.options)if(ee(o,n))return!0;return!1}if(s.type==="tuple"){for(const o of s.items)if(ee(o,n))return!0;return!!(s.rest&&ee(s.rest,n))}return!1}r(ee,"isTransforming");const _i=r((e,t={})=>n=>{const s=Yn({...n,processors:t});return K(e,s),Xn(s,e),Qn(s,e)},"createToJSONSchemaMethod"),ot=r((e,t,n={})=>s=>{const{libraryOptions:o,target:a}=s??{},i=Yn({...o??{},target:a,io:t,processors:n});return K(e,i),Xn(i,e),Qn(i,e)},"createStandardJSONSchemaMethod"),Si={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Ii=r((e,t,n,s)=>{const o=n;o.type="string";const{minimum:a,maximum:i,format:u,patterns:f,contentEncoding:m}=e._zod.bag;if(typeof a=="number"&&(o.minLength=a),typeof i=="number"&&(o.maxLength=i),u&&(o.format=Si[u]??u,o.format===""&&delete o.format,u==="time"&&delete o.format),m&&(o.contentEncoding=m),f&&f.size>0){const k=[...f];k.length===1?o.pattern=k[0].source:k.length>1&&(o.allOf=[...k.map(_=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:_.source}))])}},"stringProcessor"),xi=r((e,t,n,s)=>{const o=n,{minimum:a,maximum:i,format:u,multipleOf:f,exclusiveMaximum:m,exclusiveMinimum:k}=e._zod.bag;typeof u=="string"&&u.includes("int")?o.type="integer":o.type="number";const _=typeof k=="number"&&k>=(a??Number.NEGATIVE_INFINITY),b=typeof m=="number"&&m<=(i??Number.POSITIVE_INFINITY),S=t.target==="draft-04"||t.target==="openapi-3.0";_?S?(o.minimum=k,o.exclusiveMinimum=!0):o.exclusiveMinimum=k:typeof a=="number"&&(o.minimum=a),b?S?(o.maximum=m,o.exclusiveMaximum=!0):o.exclusiveMaximum=m:typeof i=="number"&&(o.maximum=i),typeof f=="number"&&(o.multipleOf=f)},"numberProcessor"),$i=r((e,t,n,s)=>{n.type="boolean"},"booleanProcessor"),Ei=r((e,t,n,s)=>{n.not={}},"neverProcessor"),zi=r((e,t,n,s)=>{const o=e._zod.def,a=fn(o.entries);a.every(i=>typeof i=="number")&&(n.type="number"),a.every(i=>typeof i=="string")&&(n.type="string"),n.enum=a},"enumProcessor"),Ai=r((e,t,n,s)=>{const o=e._zod.def,a=[];for(const i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");a.push(Number(i))}else a.push(i);if(a.length!==0)if(a.length===1){const i=a[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else a.every(i=>typeof i=="number")&&(n.type="number"),a.every(i=>typeof i=="string")&&(n.type="string"),a.every(i=>typeof i=="boolean")&&(n.type="boolean"),a.every(i=>i===null)&&(n.type="null"),n.enum=a},"literalProcessor"),Ti=r((e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},"customProcessor"),Oi=r((e,t,n,s)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},"transformProcessor"),Pi=r((e,t,n,s)=>{const o=n,a=e._zod.def,{minimum:i,maximum:u}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof u=="number"&&(o.maxItems=u),o.type="array",o.items=K(a.element,t,{...s,path:[...s.path,"items"]})},"arrayProcessor"),Ri=r((e,t,n,s)=>{const o=n,a=e._zod.def;o.type="object",o.properties={};const i=a.shape;for(const m in i)o.properties[m]=K(i[m],t,{...s,path:[...s.path,"properties",m]});const u=new Set(Object.keys(i)),f=new Set([...u].filter(m=>{const k=a.shape[m]._zod;return t.io==="input"?k.optin===void 0:k.optout===void 0}));f.size>0&&(o.required=Array.from(f)),a.catchall?._zod.def.type==="never"?o.additionalProperties=!1:a.catchall?a.catchall&&(o.additionalProperties=K(a.catchall,t,{...s,path:[...s.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},"objectProcessor"),Zi=r((e,t,n,s)=>{const o=e._zod.def,a=o.inclusive===!1,i=o.options.map((u,f)=>K(u,t,{...s,path:[...s.path,a?"oneOf":"anyOf",f]}));a?n.oneOf=i:n.anyOf=i},"unionProcessor"),Ni=r((e,t,n,s)=>{const o=e._zod.def,a=K(o.left,t,{...s,path:[...s.path,"allOf",0]}),i=K(o.right,t,{...s,path:[...s.path,"allOf",1]}),u=r(f=>"allOf"in f&&Object.keys(f).length===1,"isSimpleIntersection");n.allOf=[...u(a)?a.allOf:[a],...u(i)?i.allOf:[i]]},"intersectionProcessor"),ji=r((e,t,n,s)=>{const o=n,a=e._zod.def;o.type="object";const i=a.keyType,u=i._zod.bag?.patterns;if(a.mode==="loose"&&u&&u.size>0){const m=K(a.valueType,t,{...s,path:[...s.path,"patternProperties","*"]});o.patternProperties={};for(const k of u)o.patternProperties[k.source]=m}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=K(a.keyType,t,{...s,path:[...s.path,"propertyNames"]})),o.additionalProperties=K(a.valueType,t,{...s,path:[...s.path,"additionalProperties"]});const f=i._zod.values;if(f){const m=[...f].filter(k=>typeof k=="string"||typeof k=="number");m.length>0&&(o.required=m)}},"recordProcessor"),Mi=r((e,t,n,s)=>{const o=e._zod.def,a=K(o.innerType,t,s),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[a,{type:"null"}]},"nullableProcessor"),Di=r((e,t,n,s)=>{const o=e._zod.def;K(o.innerType,t,s);const a=t.seen.get(e);a.ref=o.innerType},"nonoptionalProcessor"),Ci=r((e,t,n,s)=>{const o=e._zod.def;K(o.innerType,t,s);const a=t.seen.get(e);a.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},"defaultProcessor"),Ui=r((e,t,n,s)=>{const o=e._zod.def;K(o.innerType,t,s);const a=t.seen.get(e);a.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},"prefaultProcessor"),Li=r((e,t,n,s)=>{const o=e._zod.def;K(o.innerType,t,s);const a=t.seen.get(e);a.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},"catchProcessor"),Fi=r((e,t,n,s)=>{const o=e._zod.def,a=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?a?o.out:o.in:o.out;K(i,t,s);const u=t.seen.get(e);u.ref=i},"pipeProcessor"),Vi=r((e,t,n,s)=>{const o=e._zod.def;K(o.innerType,t,s);const a=t.seen.get(e);a.ref=o.innerType,n.readOnly=!0},"readonlyProcessor"),qn=r((e,t,n,s)=>{const o=e._zod.def;K(o.innerType,t,s);const a=t.seen.get(e);a.ref=o.innerType},"optionalProcessor"),Bi=r((e,t,n,s)=>{const o=e._zod.innerType;K(o,t,s);const a=t.seen.get(e);a.ref=o},"lazyProcessor"),Ji=y("ZodISODateTime",(e,t)=>{Br.init(e,t),G.init(e,t)});function Gi(e){return Xa(Ji,e)}r(Gi,"datetime");const Wi=y("ZodISODate",(e,t)=>{Jr.init(e,t),G.init(e,t)});function Hi(e){return Qa(Wi,e)}r(Hi,"date");const Ki=y("ZodISOTime",(e,t)=>{Gr.init(e,t),G.init(e,t)});function Yi(e){return qa(Ki,e)}r(Yi,"time");const Xi=y("ZodISODuration",(e,t)=>{Wr.init(e,t),G.init(e,t)});function Qi(e){return ei(Xi,e)}r(Qi,"duration");const re=y("ZodError",r((e,t)=>{wn.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:r(n=>jo(e,n),"value")},flatten:{value:r(n=>No(e,n),"value")},addIssue:{value:r(n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,bt,2)},"value")},addIssues:{value:r(n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,bt,2)},"value")},isEmpty:{get(){return e.issues.length===0}}})},"initializer"),{Parent:Error}),qi=xt(re),ec=$t(re),tc=Qe(re),nc=qe(re),sc=Co(re),oc=Uo(re),rc=Lo(re),ac=Fo(re),ic=Vo(re),cc=Bo(re),uc=Jo(re),lc=Go(re),es=new WeakMap;function Ce(e,t,n){const s=Object.getPrototypeOf(e);let o=es.get(s);if(o||(o=new Set,es.set(s,o)),!o.has(t)){o.add(t);for(const a in n){const i=n[a];Object.defineProperty(s,a,{configurable:!0,enumerable:!1,get(){const u=i.bind(this);return Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:u}),u},set(u){Object.defineProperty(this,a,{configurable:!0,writable:!0,enumerable:!0,value:u})}})}}}r(Ce,"_installLazyMethods");const J=y("ZodType",(e,t)=>(V.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:ot(e,"input"),output:ot(e,"output")}}),e.toJSONSchema=_i(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,s)=>qi(e,n,s,{callee:e.parse}),e.safeParse=(n,s)=>tc(e,n,s),e.parseAsync=async(n,s)=>ec(e,n,s,{callee:e.parseAsync}),e.safeParseAsync=async(n,s)=>nc(e,n,s),e.spa=e.safeParseAsync,e.encode=(n,s)=>sc(e,n,s),e.decode=(n,s)=>oc(e,n,s),e.encodeAsync=async(n,s)=>rc(e,n,s),e.decodeAsync=async(n,s)=>ac(e,n,s),e.safeEncode=(n,s)=>ic(e,n,s),e.safeDecode=(n,s)=>cc(e,n,s),e.safeEncodeAsync=async(n,s)=>uc(e,n,s),e.safeDecodeAsync=async(n,s)=>lc(e,n,s),Ce(e,"ZodType",{check(...n){const s=this.def;return this.clone(ve(s,{checks:[...s.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,s){return ye(this,n,s)},brand(){return this},register(n,s){return n.add(this,s),this},refine(n,s){return this.check(ou(n,s))},superRefine(n,s){return this.check(ru(n,s))},overwrite(n){return this.check(Te(n))},optional(){return us(this)},exactOptional(){return Vc(this)},nullable(){return ls(this)},nullish(){return us(ls(this))},nonoptional(n){return Kc(this,n)},array(){return T(this)},or(n){return W([this,n])},and(n){return Mc(this,n)},transform(n){return ps(this,Lc(n))},default(n){return Gc(this,n)},prefault(n){return Hc(this,n)},catch(n){return Xc(this,n)},pipe(n){return ps(this,n)},readonly(){return eu(this)},describe(n){const s=this.clone();return De.add(s,{description:n}),s},meta(...n){if(n.length===0)return De.get(this);const s=this.clone();return De.add(s,n[0]),s},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return De.get(e)?.description},configurable:!0}),e)),ts=y("_ZodString",(e,t)=>{Et.init(e,t),J.init(e,t),e._zod.processJSONSchema=(s,o,a)=>Ii(e,s,o,a);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Ce(e,"_ZodString",{regex(...s){return this.check(ai(...s))},includes(...s){return this.check(ui(...s))},startsWith(...s){return this.check(li(...s))},endsWith(...s){return this.check(di(...s))},min(...s){return this.check(st(...s))},max(...s){return this.check(Hn(...s))},length(...s){return this.check(Kn(...s))},nonempty(...s){return this.check(st(1,...s))},lowercase(s){return this.check(ii(s))},uppercase(s){return this.check(ci(s))},trim(){return this.check(fi())},normalize(...s){return this.check(pi(...s))},toLowerCase(){return this.check(hi())},toUpperCase(){return this.check(mi())},slugify(){return this.check(gi())}})}),dc=y("ZodString",(e,t)=>{Et.init(e,t),ts.init(e,t),e.email=n=>e.check(Ta(pc,n)),e.url=n=>e.check(Na(fc,n)),e.jwt=n=>e.check(Ya(zc,n)),e.emoji=n=>e.check(ja(hc,n)),e.guid=n=>e.check(Bn(ns,n)),e.uuid=n=>e.check(Oa(rt,n)),e.uuidv4=n=>e.check(Pa(rt,n)),e.uuidv6=n=>e.check(Ra(rt,n)),e.uuidv7=n=>e.check(Za(rt,n)),e.nanoid=n=>e.check(Ma(mc,n)),e.guid=n=>e.check(Bn(ns,n)),e.cuid=n=>e.check(Da(gc,n)),e.cuid2=n=>e.check(Ca(vc,n)),e.ulid=n=>e.check(Ua(yc,n)),e.base64=n=>e.check(Wa(xc,n)),e.base64url=n=>e.check(Ha($c,n)),e.xid=n=>e.check(La(wc,n)),e.ksuid=n=>e.check(Fa(kc,n)),e.ipv4=n=>e.check(Va(bc,n)),e.ipv6=n=>e.check(Ba(_c,n)),e.cidrv4=n=>e.check(Ja(Sc,n)),e.cidrv6=n=>e.check(Ga(Ic,n)),e.e164=n=>e.check(Ka(Ec,n)),e.datetime=n=>e.check(Gi(n)),e.date=n=>e.check(Hi(n)),e.time=n=>e.check(Yi(n)),e.duration=n=>e.check(Qi(n))});function p(e){return Aa(dc,e)}r(p,"string");const G=y("ZodStringFormat",(e,t)=>{B.init(e,t),ts.init(e,t)}),pc=y("ZodEmail",(e,t)=>{Nr.init(e,t),G.init(e,t)}),ns=y("ZodGUID",(e,t)=>{Rr.init(e,t),G.init(e,t)}),rt=y("ZodUUID",(e,t)=>{Zr.init(e,t),G.init(e,t)}),fc=y("ZodURL",(e,t)=>{jr.init(e,t),G.init(e,t)}),hc=y("ZodEmoji",(e,t)=>{Mr.init(e,t),G.init(e,t)}),mc=y("ZodNanoID",(e,t)=>{Dr.init(e,t),G.init(e,t)}),gc=y("ZodCUID",(e,t)=>{Cr.init(e,t),G.init(e,t)}),vc=y("ZodCUID2",(e,t)=>{Ur.init(e,t),G.init(e,t)}),yc=y("ZodULID",(e,t)=>{Lr.init(e,t),G.init(e,t)}),wc=y("ZodXID",(e,t)=>{Fr.init(e,t),G.init(e,t)}),kc=y("ZodKSUID",(e,t)=>{Vr.init(e,t),G.init(e,t)}),bc=y("ZodIPv4",(e,t)=>{Hr.init(e,t),G.init(e,t)}),_c=y("ZodIPv6",(e,t)=>{Kr.init(e,t),G.init(e,t)}),Sc=y("ZodCIDRv4",(e,t)=>{Yr.init(e,t),G.init(e,t)}),Ic=y("ZodCIDRv6",(e,t)=>{Xr.init(e,t),G.init(e,t)}),xc=y("ZodBase64",(e,t)=>{Qr.init(e,t),G.init(e,t)}),$c=y("ZodBase64URL",(e,t)=>{ea.init(e,t),G.init(e,t)}),Ec=y("ZodE164",(e,t)=>{ta.init(e,t),G.init(e,t)}),zc=y("ZodJWT",(e,t)=>{sa.init(e,t),G.init(e,t)}),ss=y("ZodNumber",(e,t)=>{Tn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(s,o,a)=>xi(e,s,o,a),Ce(e,"ZodNumber",{gt(s,o){return this.check(Gn(s,o))},gte(s,o){return this.check(Tt(s,o))},min(s,o){return this.check(Tt(s,o))},lt(s,o){return this.check(Jn(s,o))},lte(s,o){return this.check(At(s,o))},max(s,o){return this.check(At(s,o))},int(s){return this.check(os(s))},safe(s){return this.check(os(s))},positive(s){return this.check(Gn(0,s))},nonnegative(s){return this.check(Tt(0,s))},negative(s){return this.check(Jn(0,s))},nonpositive(s){return this.check(At(0,s))},multipleOf(s,o){return this.check(Wn(s,o))},step(s,o){return this.check(Wn(s,o))},finite(){return this}});const n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function R(e){return ti(ss,e)}r(R,"number");const Ac=y("ZodNumberFormat",(e,t)=>{oa.init(e,t),ss.init(e,t)});function os(e){return ni(Ac,e)}r(os,"int");const Tc=y("ZodBoolean",(e,t)=>{ra.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>$i(e,n,s,o)});function U(e){return si(Tc,e)}r(U,"boolean");const Oc=y("ZodUnknown",(e,t)=>{aa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>{}});function X(){return oi(Oc)}r(X,"unknown");const Pc=y("ZodNever",(e,t)=>{ia.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ei(e,n,s,o)});function Rc(e){return ri(Pc,e)}r(Rc,"never");const Zc=y("ZodArray",(e,t)=>{ca.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Pi(e,n,s,o),e.element=t.element,Ce(e,"ZodArray",{min(n,s){return this.check(st(n,s))},nonempty(n){return this.check(st(1,n))},max(n,s){return this.check(Hn(n,s))},length(n,s){return this.check(Kn(n,s))},unwrap(){return this.element}})});function T(e,t){return vi(Zc,e,t)}r(T,"array");const rs=y("ZodObject",(e,t)=>{la.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ri(e,n,s,o),N(e,"shape",()=>t.shape),Ce(e,"ZodObject",{keyof(){return Dc(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:X()})},loose(){return this.clone({...this._zod.def,catchall:X()})},strict(){return this.clone({...this._zod.def,catchall:Rc()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return Ao(this,n)},safeExtend(n){return To(this,n)},merge(n){return Oo(this,n)},pick(n){return Eo(this,n)},omit(n){return zo(this,n)},partial(...n){return Po(cs,this,n[0])},required(...n){return Ro(ds,this,n[0])}})});function d(e,t){const n={type:"object",shape:e??{},...x(t)};return new rs(n)}r(d,"object");function at(e,t){return new rs({type:"object",shape:e,catchall:X(),...x(t)})}r(at,"looseObject");const as=y("ZodUnion",(e,t)=>{Nn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Zi(e,n,s,o),e.options=t.options});function W(e,t){return new as({type:"union",options:e,...x(t)})}r(W,"union");const Nc=y("ZodDiscriminatedUnion",(e,t)=>{as.init(e,t),da.init(e,t)});function he(e,t,n){return new Nc({type:"union",options:t,discriminator:e,...x(n)})}r(he,"discriminatedUnion");const jc=y("ZodIntersection",(e,t)=>{pa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ni(e,n,s,o)});function Mc(e,t){return new jc({type:"intersection",left:e,right:t})}r(Mc,"intersection");const is=y("ZodRecord",(e,t)=>{fa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>ji(e,n,s,o),e.keyType=t.keyType,e.valueType=t.valueType});function it(e,t,n){return!t||!t._zod?new is({type:"record",keyType:p(),valueType:e,...x(t)}):new is({type:"record",keyType:e,valueType:t,...x(n)})}r(it,"record");const Ot=y("ZodEnum",(e,t)=>{ha.init(e,t),J.init(e,t),e._zod.processJSONSchema=(s,o,a)=>zi(e,s,o,a),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(s,o)=>{const a={};for(const i of s)if(n.has(i))a[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ot({...t,checks:[],...x(o),entries:a})},e.exclude=(s,o)=>{const a={...t.entries};for(const i of s)if(n.has(i))delete a[i];else throw new Error(`Key ${i} not found in enum`);return new Ot({...t,checks:[],...x(o),entries:a})}});function Dc(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(s=>[s,s])):e;return new Ot({type:"enum",entries:n,...x(t)})}r(Dc,"_enum");const Cc=y("ZodLiteral",(e,t)=>{ma.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ai(e,n,s,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function g(e,t){return new Cc({type:"literal",values:Array.isArray(e)?e:[e],...x(t)})}r(g,"literal");const Uc=y("ZodTransform",(e,t)=>{ga.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Oi(e,n,s,o),e._zod.parse=(n,s)=>{if(s.direction==="backward")throw new pn(e.constructor.name);n.addIssue=a=>{if(typeof a=="string")n.issues.push(Me(a,n.value,t));else{const i=a;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(Me(i))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(a=>(n.value=a,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function Lc(e){return new Uc({type:"transform",transform:e})}r(Lc,"transform");const cs=y("ZodOptional",(e,t)=>{Dn.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>qn(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function us(e){return new cs({type:"optional",innerType:e})}r(us,"optional");const Fc=y("ZodExactOptional",(e,t)=>{va.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>qn(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Vc(e){return new Fc({type:"optional",innerType:e})}r(Vc,"exactOptional");const Bc=y("ZodNullable",(e,t)=>{ya.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Mi(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function ls(e){return new Bc({type:"nullable",innerType:e})}r(ls,"nullable");const Jc=y("ZodDefault",(e,t)=>{wa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ci(e,n,s,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Gc(e,t){return new Jc({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():vn(t)}})}r(Gc,"_default");const Wc=y("ZodPrefault",(e,t)=>{ka.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ui(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Hc(e,t){return new Wc({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():vn(t)}})}r(Hc,"prefault");const ds=y("ZodNonOptional",(e,t)=>{ba.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Di(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function Kc(e,t){return new ds({type:"nonoptional",innerType:e,...x(t)})}r(Kc,"nonoptional");const Yc=y("ZodCatch",(e,t)=>{_a.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Li(e,n,s,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Xc(e,t){return new Yc({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}r(Xc,"_catch");const Qc=y("ZodPipe",(e,t)=>{Sa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Fi(e,n,s,o),e.in=t.in,e.out=t.out});function ps(e,t){return new Qc({type:"pipe",in:e,out:t})}r(ps,"pipe");const qc=y("ZodReadonly",(e,t)=>{Ia.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Vi(e,n,s,o),e.unwrap=()=>e._zod.def.innerType});function eu(e){return new qc({type:"readonly",innerType:e})}r(eu,"readonly");const tu=y("ZodLazy",(e,t)=>{xa.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Bi(e,n,s,o),e.unwrap=()=>e._zod.def.getter()});function nu(e){return new tu({type:"lazy",getter:e})}r(nu,"lazy");const fs=y("ZodCustom",(e,t)=>{$a.init(e,t),J.init(e,t),e._zod.processJSONSchema=(n,s,o)=>Ti(e,n,s,o)});function su(e,t){return yi(fs,e??(()=>!0),t)}r(su,"custom");function ou(e,t={}){return wi(fs,e,t)}r(ou,"refine");function ru(e,t){return ki(e,t)}r(ru,"superRefine");const Ue=p(),Pt=he("code",[d({code:g("bad-request"),message:p(),details:d({issues:T(su())})}),d({code:g("cancelled"),message:p(),details:d({})}),d({code:g("session-not-found"),message:p(),details:d({sessionId:p()})}),d({code:g("model-unavailable"),message:p(),details:d({provider:p(),model:p()})}),d({code:g("session-conflict"),message:p(),details:d({sessionId:p(),requestedCwd:p(),existingCwd:p().optional()})}),d({code:g("invalid-time-zone"),message:p(),details:d({value:p()})}),d({code:g("workspace-attach-failed"),message:p(),details:d({sessionId:p(),workspaceId:p()})}),d({code:g("workspace-not-found"),message:p(),details:d({workspaceId:p()})}),d({code:g("workspace-invalid-path"),message:p(),details:d({path:p()})}),d({code:g("workspace-name-conflict"),message:p(),details:d({name:p()})}),d({code:g("workspace-move-invalid"),message:p(),details:d({workspaceId:p(),sessionId:p(),beforeSessionId:p().optional()})}),d({code:g("directory-unreadable"),message:p(),details:d({path:p()})}),d({code:g("directory-exists"),message:p(),details:d({path:p()})}),d({code:g("directory-create-failed"),message:p(),details:d({path:p()})}),d({code:g("directory-picker-unavailable"),message:p(),details:d({capability:p()})}),d({code:g("agent-preset-read-only"),message:p(),details:d({agentPreset:p(),reason:p()})}),d({code:g("agent-preset-locked"),message:p(),details:d({sessionId:p(),agentPreset:p()})}),d({code:g("agent-preset-conflict"),message:p(),details:d({sessionId:p(),requestedPreset:p(),existingPreset:p().optional()})}),d({code:g("agent-preset-not-found"),message:p(),details:d({agentPreset:p(),available:T(p())})}),d({code:g("agent-preset-invalid"),message:p(),details:d({agentPreset:p(),reason:p()})}),d({code:g("agent-busy"),message:p(),details:d({reason:p()})}),d({code:g("attachment-error"),message:p(),details:d({reason:p()})}),d({code:g("queue-item-not-found"),message:p(),details:d({itemId:p()})}),d({code:g("steer-unavailable"),message:p(),details:d({itemId:p()})}),d({code:g("command-error"),message:p(),details:d({})}),d({code:g("unknown-command"),message:p(),details:d({})}),d({code:g("settings-rejected"),message:p(),details:d({ns:p()})}),d({code:g("settings-not-exposed"),message:p(),details:d({ns:p()})}),d({code:g("settings-conflict"),message:p(),details:d({ns:p(),expected:R(),actual:R()})}),d({code:g("credential-rejected"),message:p(),details:d({ref:p()})}),d({code:g("model-discovery-failed"),message:p(),details:d({settingsNs:p(),baseURL:p().optional()})}),d({code:g("title-invalid"),message:p(),details:d({sessionId:p()})}),d({code:g("fork-unavailable"),message:p(),details:d({sessionId:p()})}),d({code:g("subagent-parent-unavailable"),message:p(),details:d({parentSessionId:p()})}),d({code:g("subagent-not-found"),message:p(),details:d({parentSessionId:p(),childSessionId:p()})}),d({code:g("subagent-catalog-diagnostic"),message:p(),details:d({parentSessionId:p(),childSessionId:p(),reason:W([g("corrupt"),g("unsupported"),g("unavailable")])})}),d({code:g("subagent-not-resumable"),message:p(),details:d({childSessionId:p()})}),d({code:g("subagent-unauthorized"),message:p(),details:d({childSessionId:p()})}),d({code:g("subagent-delivery-unavailable"),message:p(),details:d({childSessionId:p()})}),d({code:g("internal"),message:p(),details:d({})})]);function hs(e){return W([d({ok:g(!0),value:e}),d({ok:g(!1),error:Pt})])}r(hs,"rpcResultSchema");const au=d({type:g("client-request"),rpcId:Ue,method:p(),payload:X()}),Rt=d({type:g("server-response"),rpcId:Ue,result:hs(X().optional())}),Zt=d({type:g("server-request"),rpcId:Ue,method:p(),payload:X()});he("type",[au,Rt,Zt,d({type:g("client-response"),rpcId:Ue,result:hs(X().optional())})]);const iu=W([d({accepted:g(!0)}),d({accepted:g(!1),reason:W([g("not-pending"),g("bad-response")])})]);function cu(e,t){let n=0,s=0;for(const o of e){if(n===t)return e.slice(0,s);n++,s+=o.length}return e}r(cu,"truncateUnicodeCodePoints");const A=p().min(1),ms=p().min(1),de=p().min(1),gs=d({type:p(),seq:R().int().nonnegative(),time:R(),data:X(),sourceEventSeqs:T(R()).optional(),surfaceOp:X().optional(),ignorable:g(!0).optional()}),uu=d({sessionId:A,updatedAt:R(),running:U(),blank:U(),parentSessionId:A.optional(),origin:g("subagent").optional(),cwd:p().optional(),agentPreset:p().optional(),projections:nu(()=>Nt).optional()});d({cursor:p().optional()});const lu=d({items:T(uu)});d({query:p().trim().min(1).max(500).refine(e=>!e.includes("\0"),{message:"search query must not contain NUL"})});const du=d({items:T(d({sessionId:A,snippet:p().refine(e=>cu(e,240)===e,{message:"search snippet must contain at most 240 Unicode code points"})})).max(20),hasMore:U()});d({workspaceId:de.optional(),cwd:p().optional(),sessionId:A.optional(),agentPreset:p().optional()}).refine(e=>e.workspaceId===void 0||e.cwd===void 0,{message:"session.create accepts workspaceId or cwd, not both"});const pu=d({sessionId:A,agentPreset:p().optional()});d({sessionId:A,title:p()});const fu=d({title:p().min(1),seq:R().int().nonnegative()});d({sessionId:A,atSeq:R().int().nonnegative().optional()});const hu=d({sessionId:A});d({sessionId:A,beforeSeq:R().int().nonnegative().optional(),maxMessages:R().int().positive().optional()});const vs=d({provider:p().min(1),model:p().min(1),reasoningEffort:p().min(1).optional()}),mu=d({efforts:T(d({id:p().min(1),name:p().min(1),description:p().optional()})).min(1),defaultEffort:p().min(1).optional()}),gu=d({id:p().min(1),name:p().min(1),description:p().optional(),reasoning:mu.optional()}),ys=d({id:p().min(1),name:p().min(1),models:T(gu)}),ws=d({id:p().min(1),name:p().min(1),message:p()}),ks=he("for",[d({for:g("call"),view:at({card:p()})}),d({for:g("result"),view:at({card:p()})})]),bs=d({event:gs,view:ks.optional()}),Nt=d({asOfSeq:R().int().min(-1),values:it(p(),X())});d({blank:U(),lastPromptAt:R().nullable()}),d({maxImageBytes:R().int().positive(),maxImagesPerMessage:R().int().positive(),maxMessageImageBytes:R().int().positive(),maxImagePixels:R().int().positive(),mediaTypes:T(p())});const vu=d({events:T(bs),hasMore:U(),projections:Nt.optional()});d({sessionId:A});const yu=d({current:vs,routable:U(),groups:T(ys),failures:T(ws)});d({sessionId:A,provider:p().min(1),model:p().min(1),reasoningEffort:p().min(1).optional()});const wu=d({selected:vs}),jt=at({type:p()}),_s=W([g("image/png"),g("image/jpeg"),g("image/webp"),g("image/gif")]),ku=he("type",[d({type:g("text"),text:p()}),d({type:g("image"),mediaType:_s,data:p(),name:p().optional()})]);d({sessionId:A,mode:W([g("queue"),g("steer")]),content:T(ku),clientTimeZone:p().optional()});const bu=d({accepted:g(!0),command:d({kind:g("success"),text:p().optional()}).optional()}),Ss=p().min(1),_u=d({attachmentId:Ss,mediaType:_s,bytes:R().int().positive(),width:R().int().positive(),height:R().int().positive(),name:p().optional()});d({sessionId:A,attachmentId:Ss});const Su=d({attachment:_u,data:p()});d({sessionId:A,itemId:ms,action:he("kind",[d({kind:g("edit"),content:T(jt)}),d({kind:g("remove")}),d({kind:g("steer")})])});const Iu=d({accepted:g(!0)});d({sessionId:A});const xu=d({accepted:g(!0)}),Mt=p().min(1);d({sessionId:A,approvalId:Mt,outcome:W([g("allowed-once"),g("rejected")])});const $u=d({id:p().min(1),kind:p().min(1),label:p().min(1),status:W([g("running"),g("stopping"),g("completed"),g("killed"),g("failed")]),detail:p().optional(),startedAt:R().int().nonnegative(),finishedAt:R().int().nonnegative().optional()}),Le=d({workspaceId:de,path:p(),title:p(),sessionIds:T(A),createdAt:p(),updatedAt:p()});d({});const Eu=d({items:T(Le),archivedSessionIds:T(A)});d({path:p()});const zu=d({workspace:Le,created:U()});d({workspaceId:de,title:p()}).refine(e=>e.title.trim()!=="",{message:"workspace.rename requires a non-blank title"});const Au=d({workspace:Le});d({workspaceId:de});const Tu=d({deleted:g(!0)});d({workspaceId:de,beforeWorkspaceId:de.optional()});const Ou=d({workspaceIds:T(de)});d({workspaceId:de,sessionId:A,beforeSessionId:A.optional()});const Pu=d({workspace:Le});d({sessionId:A});const Ru=d({archivedSessionIds:T(A)}),Zu=d({id:p(),question:p(),header:p().optional(),detail:p().optional(),options:T(d({label:p(),description:p().optional()})).optional(),multiSelect:U().optional(),intent:he("kind",[d({kind:g("plan-review"),approve:p()})]).optional()}),Nu=d({id:p().min(1),role:W([g("system"),g("user"),g("assistant")]),content:T(jt),source:at({kind:p()})}),Is=he("type",[d({type:g("session/event"),sessionId:A,event:gs,view:ks.optional()}),d({type:g("session/subscribed"),sessionId:A,lastSeq:R().int()}),d({type:g("approval/requested"),sessionId:A,approvalId:Mt,toolName:p(),callId:p().optional(),reason:p().optional()}),d({type:g("approval/resolved"),sessionId:A,approvalId:Mt,outcome:W([g("allowed-once"),g("rejected"),g("cancelled"),g("unavailable")])}),d({type:g("question/requested"),sessionId:A,questions:T(Zu).min(1)}),d({type:g("question/resolved"),sessionId:A,questionRpcId:Ue,outcome:W([g("answered"),g("cancelled")])}),d({type:g("session/queue"),sessionId:A,items:T(d({id:ms,placement:W([g("queued"),g("steering"),g("context")]),message:Nu}))}),d({type:g("session/jobs"),sessionId:A,jobs:T($u)}),d({type:g("session/projection"),sessionId:A,key:p().min(1),value:X(),seq:R().int().nonnegative()}),d({type:g("stream/error"),error:Pt})]),xs=he("type",[d({type:g("host/session-added"),sessionId:A,blank:U(),parentSessionId:A.optional(),origin:g("subagent").optional(),cwd:p().optional(),agentPreset:p().optional()}),d({type:g("host/session-removed"),sessionId:A}),d({type:g("host/session-status"),sessionId:A,running:U()}),d({type:g("host/agent-error"),sessionId:A,message:p()}),d({type:g("host/workspace-changed"),workspace:Le}),d({type:g("host/workspace-removed"),workspaceId:de}),d({type:g("host/workspace-order-changed"),workspaceIds:T(de)}),d({type:g("host/archived-sessions-changed"),archivedSessionIds:T(A)}),d({type:g("host/remote-event"),event:p().min(1),args:T(X())}),d({type:g("stream/error"),error:Pt})]);d({});const ju=d({version:p(),cwd:p(),provider:p().optional(),model:p().optional(),attachedSessions:R().int().nonnegative(),canOpenPath:U()});d({});const Mu=d({path:p().nullable()}),$s=d({name:p(),path:p(),hidden:U()});d({path:p().optional()});const Du=d({path:p(),home:p(),crumbs:T($s),entries:T($s),truncated:U()});d({path:p(),name:p()}).refine(e=>e.name.trim()!==""&&e.name!=="."&&e.name!==".."&&!/[/\\]/.test(e.name),{message:"host.createDirectory requires a single non-blank path segment name"});const Cu=d({path:p()});d({path:p().min(1)});const Uu=d({opened:g(!0)}),Lu=d({name:p().min(1),description:p(),whenToUse:p().optional(),modelInvocable:U()});d({sessionId:A});const Fu=d({skills:T(Lu)}),Vu=d({id:p().min(1),trust:W([g("system"),g("user")]),isDefault:U(),name:p().optional(),description:p().optional(),broken:p().min(1).optional()});d({});const Bu=d({presets:T(Vu),authorable:U(),hasDocument:U()});d({sessionId:A,agentPreset:p().min(1)});const Ju=d({agentPreset:p()});d({agentPreset:p().min(1)});const Gu=d({agentPreset:p(),trust:W([g("system"),g("user")]),content:p(),name:p().optional(),description:p().optional()});d({from:p().min(1),agentPreset:p().min(1),name:p().optional()});const Wu=d({agentPreset:p()});d({agentPreset:p().min(1)});const Hu=W([d({opened:g(!0)}),d({opened:g(!1),path:p()})]);d({agentPreset:p().min(1)});const Ku=d({}),Oe=d({id:p(),revision:R().int().positive()}),Fe=d({ref:Oe});d({sessionId:p(),objective:p().min(1),maxGoalRounds:R().int().positive().optional()});const Yu=Fe;d({sessionId:p(),ref:Oe,objective:p().min(1).optional(),maxGoalRounds:R().int().positive().optional()}).refine(e=>e.objective!==void 0||e.maxGoalRounds!==void 0,{message:"goal.edit requires objective or maxGoalRounds"});const Xu=Fe;d({sessionId:p(),ref:Oe});const Qu=Fe;d({sessionId:p(),ref:Oe});const qu=Fe;d({sessionId:p(),ref:Oe});const el=Fe;d({sessionId:p(),ref:Oe});const tl=d({cleared:g(!0)}),nl=d({path:T(p()),set:U()}),ct=d({ns:p().min(1),schema:X(),value:X(),base:X().optional(),user:X().optional(),applies:W([g("live"),g("restart")]),secrets:T(nl),revision:R()});d({});const sl=d({writable:U(),hasDocument:U(),namespaces:T(ct)});d({});const ol=d({opened:g(!0)});d({ns:p().min(1),patch:it(p(),X()),expectedRevision:R().optional()});const rl=ct;d({ns:p().min(1),section:it(p(),X()),expectedRevision:R().optional()});const al=he("op",[d({op:g("set"),path:T(p()),value:X()}),d({op:g("unset"),path:T(p())})]);d({ns:p().min(1),ops:T(al),expectedRevision:R().optional()});const il=ct,cl=ct,Dt=p().regex(/^[A-Za-z_][A-Za-z0-9_]*$/),ul=d({configured:U(),source:p().optional(),writable:U()});d({refs:T(Dt).max(64)});const ll=d({credentials:it(p(),ul)});d({ref:Dt,value:p().min(1)});const dl=d({});d({ref:Dt});const pl=d({}),fl=d({provider:p().min(1),displayName:p().min(1),settingsNs:p(),settingsPath:T(p()),active:U(),declared:U().optional()});d({});const hl=d({providers:T(fl)});d({});const ml=d({groups:T(ys),failures:T(ws)}),gl=d({id:p().min(1),name:p().min(1).optional(),contextWindow:R().int().positive().optional(),maxTokens:R().int().positive().optional()});d({settingsNs:p().min(1),provider:p().min(1).optional(),baseURL:p().min(1).optional(),api:p().min(1).optional(),apiKey:p().min(1).optional()});const vl=d({models:T(gl)}),yl=W([d({kind:g("child"),id:A,mode:g("one-shot"),activity:W([g("running"),g("inactive")]),hasChildren:U(),label:p().optional()}),d({kind:g("child"),id:A,mode:g("continuable"),activity:W([g("running"),g("inactive")]),hasChildren:U(),label:p()}),d({kind:g("diagnostic"),id:A,reason:W([g("corrupt"),g("unsupported"),g("unavailable")])})]);d({parentSessionId:A});const wl=d({entries:T(yl),parentAvailable:U()});d({parentSessionId:A,childSessionId:A,mode:W([g("one-shot"),g("continuable")]),beforeSeq:R().int().nonnegative().optional(),maxMessages:R().int().positive().optional()});const kl=d({events:T(bs),hasMore:U(),projections:Nt.optional()});d({parentSessionId:A,childSessionId:A,mode:g("continuable"),content:T(jt),clientTimeZone:p().optional()}),d({parentSessionId:A,childSessionId:A,mode:g("continuable")});const bl=d({accepted:g(!0)}),_l={"session.list":lu,"session.search":du,"session.create":pu,"session.history":vu,"session.models":yu,"session.selectModel":wu,"session.rename":fu,"session.fork":hu,"session.prompt":bu,"session.attachment":Su,"session.updateQueue":Iu,"session.cancel":xu,"subagent.list":wl,"subagent.history":kl,"subagent.prompt":d({messageId:p()}),"subagent.interrupt":bl,"host.describe":ju,"host.pickDirectory":Mu,"host.listDirectory":Du,"host.createDirectory":Cu,"host.openPath":Uu,"workspace.list":Eu,"workspace.create":zu,"workspace.rename":Au,"workspace.delete":Tu,"workspace.insertBefore":Ou,"workspace.insertSessionBefore":Pu,"workspace.archiveSession":Ru,"skill.list":Fu,"agentPreset.list":Bu,"agentPreset.select":Ju,"agentPreset.read":Gu,"agentPreset.copy":Wu,"agentPreset.openDocument":Hu,"agentPreset.remove":Ku,"goal.create":Yu,"goal.edit":Xu,"goal.pause":Qu,"goal.resume":qu,"goal.complete":el,"goal.clear":tl,"settings.describe":sl,"settings.openDocument":ol,"settings.update":rl,"settings.replace":cl,"settings.mutate":il,"credentials.describe":ll,"credentials.set":dl,"credentials.unset":pl,"llm.providers":hl,"llm.models":ml,"llm.discoverModels":vl},Sl=3e4,Il="http://dsh.internal";var Ct=class{static{r(this,"AbstractApiClient")}timeoutMs;envelopeBatch=[];flushScheduled=!1;envelopeListeners=new Set;constructor(e=Sl){this.timeoutMs=e}subscribeEnvelopes(e){return this.envelopeListeners.add(e),()=>{this.envelopeListeners.delete(e)}}onEnvelope(e){this.envelopeListeners.size!==0&&(this.envelopeBatch.push(e),!this.flushScheduled&&(this.flushScheduled=!0,queueMicrotask(()=>{this.flushScheduled=!1;const t=this.envelopeBatch;this.envelopeBatch=[];for(const n of this.envelopeListeners)try{n(t)}catch(s){console.error("[apiproxy] envelope listener threw:",s)}})))}resolveBase(){const e=globalThis.location;return e?.origin!==void 0&&e.origin!=="null"?e.origin:Il}mintRpcId(){return crypto.randomUUID()}async postJson(e,t,n,s="default"){const o=s==="default"?n===void 0?AbortSignal.timeout(this.timeoutMs):AbortSignal.any([AbortSignal.timeout(this.timeoutMs),n]):n,a=await this.doFetch(new URL(e,this.resolveBase()),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(t),...o===void 0?{}:{signal:o}});if(!a.ok)throw new Error(`transport failure for ${e}: HTTP ${a.status}`);return a}async callUnary(e,t,n,s="default"){const o={type:"client-request",rpcId:this.mintRpcId(),method:e,payload:t};this.onEnvelope(o);const a=await this.postJson(`/api/${e}`,o,n,s),i=Rt.parse(await a.json());if(this.onEnvelope(i),i.rpcId!==o.rpcId)throw new Error(`rpcId mismatch for ${e}: sent ${o.rpcId}, got ${i.rpcId}`);if(!i.result.ok)return{rpcId:i.rpcId,result:i.result};const u=_l[e].parse(i.result.value);return{rpcId:i.rpcId,result:{ok:!0,value:u}}}openMux(e,t,n){return this.readSse("/api/events.mux",t,Is,n)}openHost(e,t,n){return this.readSse("/api/events.host",t,xs,n)}async*readSse(e,t,n,s){const o=await this.doFetch(new URL(e,this.resolveBase()),{signal:t});if(!o.ok||o.body===null)throw new Error(`transport failure for ${e}: HTTP ${o.status}`);s?.();const a=o.body.getReader(),i=new TextDecoder;let u="";try{for(;;){const{done:f,value:m}=await a.read();if(f)return;u+=i.decode(m,{stream:!0});let k;for(;(k=u.indexOf(`
|
|
65
65
|
|
|
66
66
|
`))!==-1;){const _=u.slice(0,k);u=u.slice(k+2);const b=_.split(`
|
|
67
67
|
`).filter(D=>D.startsWith("data: ")).map(D=>D.slice(6)).join("");if(b==="")continue;let S,E;try{S=Zt.parse(JSON.parse(b)),E=n.parse(S.payload)}catch(D){console.error(`[apiproxy] dropping malformed SSE frame on ${e}:`,D);continue}this.onEnvelope(S),yield{rpcId:S.rpcId,payload:E}}}}finally{await a.cancel().catch(()=>{})}}sessions={list:r((e,t)=>this.callUnary("session.list",e,t),"list"),search:r((e,t)=>this.callUnary("session.search",e,t),"search"),create:r((e,t)=>this.callUnary("session.create",e,t),"create"),history:r((e,t)=>this.callUnary("session.history",e,t),"history"),models:r((e,t)=>this.callUnary("session.models",e,t),"models"),selectModel:r((e,t)=>this.callUnary("session.selectModel",e,t),"selectModel"),rename:r((e,t)=>this.callUnary("session.rename",e,t),"rename"),fork:r((e,t)=>this.callUnary("session.fork",e,t),"fork"),prompt:r((e,t)=>this.callUnary("session.prompt",e,t),"prompt"),attachment:r((e,t)=>this.callUnary("session.attachment",e,t),"attachment"),updateQueue:r((e,t)=>this.callUnary("session.updateQueue",e,t),"updateQueue"),cancel:r((e,t)=>this.callUnary("session.cancel",e,t),"cancel")};subagents={list:r((e,t)=>this.callUnary("subagent.list",e,t),"list"),history:r((e,t)=>this.callUnary("subagent.history",e,t),"history"),prompt:r((e,t)=>this.callUnary("subagent.prompt",e,t),"prompt"),interrupt:r((e,t)=>this.callUnary("subagent.interrupt",e,t),"interrupt")};host={describe:r((e,t)=>this.callUnary("host.describe",e,t),"describe"),pickDirectory:r((e,t)=>this.callUnary("host.pickDirectory",e,t,"caller-signal-only"),"pickDirectory"),listDirectory:r((e,t)=>this.callUnary("host.listDirectory",e,t),"listDirectory"),createDirectory:r((e,t)=>this.callUnary("host.createDirectory",e,t),"createDirectory"),openPath:r((e,t)=>this.callUnary("host.openPath",e,t),"openPath")};workspace={list:r((e,t)=>this.callUnary("workspace.list",e,t),"list"),create:r((e,t)=>this.callUnary("workspace.create",e,t),"create"),rename:r((e,t)=>this.callUnary("workspace.rename",e,t),"rename"),delete:r((e,t)=>this.callUnary("workspace.delete",e,t),"delete"),insertBefore:r((e,t)=>this.callUnary("workspace.insertBefore",e,t),"insertBefore"),insertSessionBefore:r((e,t)=>this.callUnary("workspace.insertSessionBefore",e,t),"insertSessionBefore"),archiveSession:r((e,t)=>this.callUnary("workspace.archiveSession",e,t),"archiveSession")};skills={list:r((e,t)=>this.callUnary("skill.list",e,t),"list")};agentPresets={list:r((e,t)=>this.callUnary("agentPreset.list",e,t),"list"),select:r((e,t)=>this.callUnary("agentPreset.select",e,t),"select"),read:r((e,t)=>this.callUnary("agentPreset.read",e,t),"read"),copy:r((e,t)=>this.callUnary("agentPreset.copy",e,t),"copy"),openDocument:r((e,t)=>this.callUnary("agentPreset.openDocument",e,t),"openDocument"),remove:r((e,t)=>this.callUnary("agentPreset.remove",e,t),"remove")};goals={create:r((e,t)=>this.callUnary("goal.create",e,t),"create"),edit:r((e,t)=>this.callUnary("goal.edit",e,t),"edit"),pause:r((e,t)=>this.callUnary("goal.pause",e,t),"pause"),resume:r((e,t)=>this.callUnary("goal.resume",e,t),"resume"),complete:r((e,t)=>this.callUnary("goal.complete",e,t),"complete"),clear:r((e,t)=>this.callUnary("goal.clear",e,t),"clear")};settings={describe:r((e,t)=>this.callUnary("settings.describe",e,t),"describe"),openDocument:r((e,t)=>this.callUnary("settings.openDocument",e,t),"openDocument"),update:r((e,t)=>this.callUnary("settings.update",e,t),"update"),replace:r((e,t)=>this.callUnary("settings.replace",e,t),"replace"),mutate:r((e,t)=>this.callUnary("settings.mutate",e,t),"mutate")};credentials={describe:r((e,t)=>this.callUnary("credentials.describe",e,t),"describe"),set:r((e,t)=>this.callUnary("credentials.set",e,t),"set"),unset:r((e,t)=>this.callUnary("credentials.unset",e,t),"unset")};llm={providers:r((e,t)=>this.callUnary("llm.providers",e,t),"providers"),models:r((e,t)=>this.callUnary("llm.models",e,t),"models"),discoverModels:r((e,t)=>this.callUnary("llm.discoverModels",e,t),"discoverModels")};events={mux:r((e,t,n)=>this.openMux(e,t,n),"mux"),host:r((e,t,n)=>this.openHost(e,t,n),"host")};async respond(e,t){this.onEnvelope(e);const n=await this.postJson("/api/respond",e,t);return iu.parse(await n.json())}};function Ut(){const e=globalThis.crypto.getRandomValues(new Uint8Array(16)),t=new DataView(e.buffer,e.byteOffset,e.byteLength);t.setUint8(6,t.getUint8(6)&15|64),t.setUint8(8,t.getUint8(8)&63|128);const n=Array.from(e,s=>s.toString(16).padStart(2,"0")).join("");return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}r(Ut,"randomUuid");function Lt(e){return{rpcId:Ut(),payload:e}}r(Lt,"rpcRequest");function Y(e){return[{type:"text",text:e}]}r(Y,"text");function ie(e,t={kind:"user"}){return cn({content:e,source:t})}r(ie,"userMessage");function me(e,t="fx-1"){return oo({content:e,source:{provider:"fixture",model:t}})}r(me,"assistantMessage");function Ft(e,t,n){return ro({callId:e,content:t,isError:n})}r(Ft,"toolResultMessage");const Es=["# Markdown fixture","","Assistant output renders **strong text**, *emphasis*, and `inline code`.","","- first item"," - nested item","","| Area | State |","| --- | --- |","| history | rendered |","| streaming | stable |","","[DeepSeek](https://www.deepseek.com)","","```ts","const markdown = true","```"].join(`
|
|
@@ -79,13 +79,13 @@ return { listing, demo }`,description:"Read the notes files and summarize"});n({
|
|
|
79
79
|
new-demo.txt`),k(2,"read",{file_path:"notes/demo.txt"},`hello fixture
|
|
80
80
|
`),k(3,"read",{file_path:"notes/missing.txt"},"Error: ENOENT: notes/missing.txt not found",!0),n({type:"tool/result",surfaceOp:"append",data:{turn:65,step:0,message:Ft(f,Y('{"listing":"demo.txt\\nnew-demo.txt","demo":"hello fixture\\n"}'),!1)}}),n({type:"step/end",data:{turn:65,step:0}}),n({type:"turn/end",data:{turn:65,reason:{kind:"completed"}}})}const o=[{content:"梳理需求",status:"completed"},{content:"实现 fixture 样本",status:"in_progress"},{content:"跑后台构建",status:"in_progress"},{content:"浏览器验收",status:"pending"}];s(66,"bash",'{"command":"pnpm run check","cwd":"/tmp/fixture/deep/nested"}',zs),s(67,"grep",'{"pattern":"SEARCH_MAX_LINES","path":"packages/client"}',El),s(68,"glob",'{"pattern":"**/SearchBlock*","path":"packages/client"}',zl),s(69,"read",`{"file_path":${JSON.stringify(Ps)},"offset":${ut}}`,Ol),s(70,"web_search",'{"query":"deepseek harness architecture"}',"Search results for deepseek harness architecture."),s(71,"web_fetch",'{"url":"https://www.deepseek.com/blog/harness-architecture"}',`# Harness architecture
|
|
81
81
|
|
|
82
|
-
Everything is a plugin.`),n({type:"turn/start",data:{turn:72}}),n({type:"user/message",surfaceOp:"append",data:ie(Y("问题 72:请完整列出全部一百条条目。"))}),n({type:"step/start",data:{turn:72,step:0}}),n({type:"assistant/message",surfaceOp:"append",data:{turn:72,step:0,message:me(Y("条目 1:第一条。条目 2:第二条。条目 3:这一条写到一半被"))}}),n({type:"step/end",data:{turn:72,step:0}}),n({type:"turn/end",data:{turn:72,reason:{kind:"max-tokens"}}}),n({type:"turn/start",data:{turn:73}}),n({type:"user/message",surfaceOp:"append",data:ie([{type:"image",attachment:lt},...Y("历史用户图片")])}),n({type:"step/start",data:{turn:73,step:0}}),n({type:"assistant/message",surfaceOp:"append",data:{turn:73,step:0,message:me([...Y("结构化模型图片:"),{type:"image",attachment:lt}],"fx-vision")}}),n({type:"step/end",data:{turn:73,step:0}}),n({type:"turn/end",data:{turn:73,reason:{kind:"completed"}}}),s(74,"todo_write",JSON.stringify({todos:o}),"Updated todo list: 1 pending, 2 in progress, 1 completed.");const a=e.length-4,i=e[a]?.time;return e.splice(a+1,0,{type:"todo/write",time:i+400,data:{todos:o}}),e.forEach((u,f)=>{u.seq=f}),e}r(jl,"buildAlphaLog");const H=r((e,t="")=>typeof e=="string"?e:t,"str");function Ns(e,t){let n;try{n=JSON.parse(t)}catch{return}switch(e){case"fx-bash":case"bash":return{card:"terminal",title:H(n.command),cwd:H(n.cwd,"/tmp/fixture"),description:"fixture 终端样本"};case"fx-write":return{card:"diff",title:`Write ${H(n.path)}`,diffs:[{path:H(n.path),oldText:null,newText:H(n.content)}]};case"read":return{card:"generic",title:`Read ${H(n.file_path)}`,kind:"read",locations:[{path:H(n.file_path)}]};case"edit":return H(n.file_path)==="src/config.ts"?{card:"diff",title:`Edit ${H(n.file_path)}`,diffs:[{path:H(n.file_path),oldText:"const timeout = 30",newText:"const timeout = 60"},{path:H(n.file_path),oldText:"retries: 1",newText:"retries: 3"}]}:{card:"diff",title:`Edit ${H(n.file_path)}`,diffs:[{path:H(n.file_path),oldText:H(n.old_string),newText:H(n.new_string)}]};case"write":return{card:"diff",title:`Write ${H(n.file_path)}`,diffs:[{path:H(n.file_path),oldText:null,newText:H(n.content)}]};case"grep":return{card:"generic",title:`Grep ${H(n.pattern)}`,kind:"search",rawInput:n};case"glob":return{card:"generic",title:`Glob ${H(n.pattern)}`,kind:"search",rawInput:n};case"web_search":return{card:"generic",title:`Search ${H(n.query)}`,kind:"search",rawInput:n};case"web_fetch":return{card:"generic",title:`Fetch ${H(n.url)}`,kind:"fetch",rawInput:n};default:return}}r(Ns,"presentCall");function Ml(e,t,n){const s=Ns(e,t);if(s!==void 0){if(e==="grep")return{card:"search",shape:"matches",files:As,truncated:!0,total:42};if(e==="glob")return{card:"search",shape:"paths",paths:Ts,truncated:!0,total:23};if(e==="read")return{card:"read",path:Ps,offset:ut,lines:Al,totalLines:Tl,lang:"ts",content:Y(n)};if(e==="web_search")return{card:"web",kind:"search",...Pl};if(e==="web_fetch")return{card:"web",kind:"fetch",...Rl};switch(s.card){case"terminal":return{card:"terminal",output:n,...$l[n]??{exitCode:0}};case"diff":return{card:"diff",diffs:s.diffs};case"generic":return{card:"generic",content:Y(n)}}}}r(Ml,"presentResult");function js(e,t){if(e.type==="tool/call"){const n=Ns(e.data.name,e.data.arguments);return n===void 0?void 0:{for:"call",view:n}}if(e.type==="tool/result"){const n=String(e.data.message.source.callId);for(let s=t.length-1;s>=0;s--){const o=t[s];if(o!==void 0&&o.type==="tool/call"&&String(o.data.callId)===n){const a=e.data.message.content[0].content.map(u=>u.type==="text"?u.text:"").join(""),i=Ml(o.data.name,o.data.arguments,a);return i===void 0?void 0:{for:"result",view:i}}}return}}r(js,"viewFor");function Bt(e){let t=!1,n=null;for(const s of e){const o=s;if(o.type==="command/run"&&o.data?.name==="plan"){const a=o.data.args;if(typeof a!="string")continue;n=a.trim()!=="off"}else o.type==="plan/mode"&&(t=o.data?.active===!0,n=null)}return{active:t,pending:n!==null&&n!==t,wanted:n}}r(Bt,"foldPlan");function Ms(e){const t=Bt(e);return{active:t.active,pending:t.pending}}r(Ms,"planViewOf");const Pe={"workspace-write":{sandbox:"workspace-write",approval:"ask",description:"Write inside the workspace and permitted temporary directories; wider retries require approval."},"danger-full-access":{sandbox:"danger-full-access",approval:"never",description:"Full file access without approval prompts."}};function dt(e){let t=null,n="workspace-write",s="ask";for(const u of e){const f=u;f.type==="permission/preset"?t=f.data.preset:f.type==="sandbox/mode"?n=f.data.mode:f.type==="approval/policy"&&(s=f.data.policy)}const o=r(u=>u.sandbox===n&&u.approval===s,"matches");let a="custom";const i=t===null?void 0:Pe[t];if(t!==null&&i!==void 0&&o(i))a=t;else for(const[u,f]of Object.entries(Pe))if(o(f)){a=u;break}return{options:[...Object.entries(Pe).map(([u,f])=>({value:u,name:u,description:f.description})),...a==="custom"?[{value:"custom",name:"Custom",description:"Current sandbox and approval settings do not match a preset."}]:[]],currentValue:a}}r(dt,"permissionSelectOf");function Jt(e){const t=e,n=t.type==="assistant/chunk"&&t.data.chunk?.type==="usage"?t.data.chunk.usage:t.type==="assistant/message"?t.data.usage:void 0;return n===void 0||t.data.turn===void 0||t.data.step===void 0?void 0:{turn:t.data.turn,step:t.data.step,usage:n}}r(Jt,"usageSampleOf");function Ds(e){const t={uncachedInputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0};let n=null;for(const s of e){const o=Jt(s);if(o===void 0)continue;const a={uncachedInputTokens:o.usage.inputTokens,outputTokens:o.usage.outputTokens,cacheReadTokens:o.usage.cacheReadTokens??0,cacheWriteTokens:o.usage.cacheWriteTokens??0},i=n?.turn===o.turn&&n.step===o.step?n.buckets:void 0;t.uncachedInputTokens+=a.uncachedInputTokens-(i?.uncachedInputTokens??0),t.outputTokens+=a.outputTokens-(i?.outputTokens??0),t.cacheReadTokens+=a.cacheReadTokens-(i?.cacheReadTokens??0),t.cacheWriteTokens+=a.cacheWriteTokens-(i?.cacheWriteTokens??0),n={turn:o.turn,step:o.step,buckets:a}}return t}r(Ds,"tokenUsageOf");function Cs(e){const t={turns:0,steps:0,llmMs:0,toolMs:0,ttftMs:0,ttftSteps:0,decodeMs:0,decodeTokens:0};let n=null,s=null;const o=new Map;for(const a of e)switch(a.type){case"step/start":s={turn:a.data.turn,step:a.data.step,startTime:a.time,firstTokenTime:null};break;case"assistant/chunk":s!==null&&s.turn===a.data.turn&&s.step===a.data.step&&s.firstTokenTime===null&&ao(a.data.chunk)&&(s.firstTokenTime=a.time);break;case"assistant/message":if(s===null||s.turn!==a.data.turn||s.step!==a.data.step)break;if(t.llmMs+=Math.max(0,a.time-s.startTime),s.firstTokenTime!==null){t.ttftMs+=Math.max(0,s.firstTokenTime-s.startTime),t.ttftSteps+=1;const i=a.data.usage?.outputTokens;typeof i=="number"&&Number.isFinite(i)&&i>=0&&(t.decodeMs+=Math.max(0,a.time-s.firstTokenTime),t.decodeTokens+=i)}s=null;break;case"tool/call":o.set(a.data.callId,a.time);break;case"tool/result":{const i=a.data.message.source.callId,u=o.get(i);if(u===void 0)break;o.delete(i),t.toolMs+=Math.max(0,a.time-u);break}case"step/end":a.data.turn!==n&&(t.turns+=1,n=a.data.turn),t.steps+=1,s=null;break;case"turn/end":o.clear();break;default:break}return t}r(Cs,"sessionStatsOf");const Gt=4,Ve=4,Us=4;function Ls(e){const t=r(n=>Math.ceil(n.length/Gt),"densityPrice");return e.reduce((n,s)=>s.type==="text"||s.type==="reasoning"?n+t(s.text)+Ve:s.type==="tool-call"?n+t(s.name)+t(s.arguments)+Ve:s.type==="tool-result"?n+Ls(s.content)+Ve:n+t(JSON.stringify(s))+Ve,0)}r(Ls,"estimateFixtureContent");function Fs(e){const t=e.findLast(o=>o.type==="request/header"),n=t===void 0?void 0:t.data.header;let s=0;for(const o of ln(e).nodes){const a=e[o];if(a===void 0)continue;const i=uo(a);i!==null&&(s+=Ls(i.content)+Us)}return{systemTokens:n?.system===void 0?0:Math.ceil(n.system.length/Gt)+Us,toolsTokens:n?.tools===void 0||n.tools.length===0?0:Math.ceil(JSON.stringify(n.tools).length/Gt)+Ve,messageTokens:s}}r(Fs,"contextBreakdownOf");function Vs(e){const t=e.findLast(n=>n.type==="request/context");return t===void 0?void 0:t.data}r(Vs,"lastRequestContext");function Wt(e){let t;for(const s of e){const o=Jt(s);o!==void 0&&(t=o.usage.inputTokens+(o.usage.cacheReadTokens??0)+(o.usage.cacheWriteTokens??0))}const n=Vs(e)?.contextWindow;return{...t===void 0?{}:{pressureTokens:t},...n===void 0?{}:{contextWindow:n}}}r(Wt,"contextPressureOf");function Ht(e){const t={},n=e.findLast(s=>s.type==="session/title");return n!==void 0&&(t.title=n.data.title),t.todos=Hs(e)??null,t.permissions=dt(e),t.plan=Ms(e),t.goal=Re(e),t.tokenUsage=Ds(e),t.contextPressure=Wt(e),t.contextBreakdown=Fs(e),t.sessionStats=Cs(e),t.imageLimits={maxImageBytes:5*1024*1024,maxImagesPerMessage:20,maxMessageImageBytes:100*1024*1024,maxImagePixels:4e7,mediaTypes:["image/png","image/jpeg","image/webp","image/gif"]},t}r(Ht,"projectionValuesOf");function Dl(e,t,n){const s=n.type,o=[];if(Jt(n)!==void 0&&o.push({type:"session/projection",sessionId:e,key:"tokenUsage",value:Ds(t),seq:n.seq},{type:"session/projection",sessionId:e,key:"contextPressure",value:Wt(t),seq:n.seq}),s==="request/context"&&o.push({type:"session/projection",sessionId:e,key:"contextPressure",value:Wt(t),seq:n.seq}),(s==="request/header"||s==="user/message"||s==="assistant/message"||s==="tool/result")&&o.push({type:"session/projection",sessionId:e,key:"contextBreakdown",value:Fs(t),seq:n.seq}),(s==="assistant/message"||s==="tool/result"||s==="step/end")&&o.push({type:"session/projection",sessionId:e,key:"sessionStats",value:Cs(t),seq:n.seq}),o.length>0)return o;if(s==="session/title"){const i=Ht(t);return Object.hasOwn(i,"title")?[{type:"session/projection",sessionId:e,key:"title",value:i.title,seq:n.seq}]:[]}if(s==="goal/change")return[{type:"session/projection",sessionId:e,key:"goal",value:Re(t),seq:n.seq}];if(s==="todo/write"||s==="turn/start")return[{type:"session/projection",sessionId:e,key:"todos",value:Hs(t)??null,seq:n.seq}];if(s==="permission/preset"||s==="sandbox/mode"||s==="approval/policy")return[{type:"session/projection",sessionId:e,key:"permissions",value:dt(t),seq:n.seq}];const a=n;return s==="plan/mode"||s==="command/run"&&a.data.name==="plan"&&typeof a.data.args=="string"?[{type:"session/projection",sessionId:e,key:"plan",value:Ms(t),seq:n.seq}]:[]}r(Dl,"projectionFramesOf");function Bs(e,t,n){const s=t===void 0?e.length:Math.max(0,Math.min(t,e.length));let o=0,a=0;for(let i=s-1;i>=0;i--){const u=e[i];if(u===void 0)break;if((u.type==="user/message"||u.type==="assistant/message")&&a++,u.type==="turn/start"&&a>=n){o=i;break}}return{events:e.slice(o,s).map(i=>{const u=js(i,e);return u===void 0?{event:i}:{event:i,view:u}}),hasMore:o>0}}r(Bs,"pageOf");function Cl(e,t){const n=r(s=>{if(Array.isArray(s))return s.some(n);if(typeof s!="object"||s===null)return!1;const o=s;return o.attachmentId===t?!0:Object.values(o).some(n)},"visit");return e.some(s=>n(s.data))}r(Cl,"logReferencesAttachment");function Js(e){switch(e.type){case"text":return[e.text];case"reasoning":return[];case"tool-call":return[e.name,e.arguments];case"tool-result":return e.content.flatMap(Js);default:return[]}}r(Js,"searchBlockText");function Ul(e){const t=e.type==="user/message"?e.data.content:e.type==="assistant/message"?e.data.message.content:void 0;return t===void 0?"":t.flatMap(Js).map(n=>n.trim()).filter(Boolean).join(`
|
|
83
|
-
`)}r(Ul,"searchEventText");function Gs(e){const t=e.replace(/\s+/gu," ").trim(),n=Array.from(t),s=[];let o,a="";const i=r(u=>{if(o!==void 0){const f=a.normalize("NFD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase();f!==""&&s.push({value:f,start:o,end:u})}o=void 0,a=""},"flush");for(let u=0;u<n.length;u++){const f=n[u],m=f.normalize("NFD").replace(new RegExp("\\p{M}+","gu"),"");if(m===""){o!==void 0&&(a+=f);continue}/^[\p{L}\p{N}\p{Co}]+$/u.test(m)?(o??=u,a+=f):i(u)}return i(n.length),{text:t,tokens:s}}r(Gs,"searchTokenSpans");function Ll(e,t){if(t.length===0||t.length>e.length)return{count:0,start:0,end:0};let n=0,s=0,o=0;for(let a=0;a<=e.length-t.length;a++)t.every((i,u)=>e[a+u]?.value===i)&&(n++,n===1&&(s=e[a]?.start??0,o=e[a+t.length-1]?.end??s));return{count:n,start:s,end:o}}r(Ll,"phraseMatch");function Fl(e,t,n){const s=Array.from(e);if(s.length<=120)return e;const o=Math.min(Math.max(0,t),s.length-1),a=Math.min(s.length,Math.max(o+1,n)),i=Math.floor((o+a)/2);let u=Math.min(s.length-118,Math.max(0,i-Math.floor(
|
|
82
|
+
Everything is a plugin.`),n({type:"turn/start",data:{turn:72}}),n({type:"user/message",surfaceOp:"append",data:ie(Y("问题 72:请完整列出全部一百条条目。"))}),n({type:"step/start",data:{turn:72,step:0}}),n({type:"assistant/message",surfaceOp:"append",data:{turn:72,step:0,message:me(Y("条目 1:第一条。条目 2:第二条。条目 3:这一条写到一半被"))}}),n({type:"step/end",data:{turn:72,step:0}}),n({type:"turn/end",data:{turn:72,reason:{kind:"max-tokens"}}}),n({type:"turn/start",data:{turn:73}}),n({type:"user/message",surfaceOp:"append",data:ie([{type:"image",attachment:lt},...Y("历史用户图片")])}),n({type:"step/start",data:{turn:73,step:0}}),n({type:"assistant/message",surfaceOp:"append",data:{turn:73,step:0,message:me([...Y("结构化模型图片:"),{type:"image",attachment:lt}],"fx-vision")}}),n({type:"step/end",data:{turn:73,step:0}}),n({type:"turn/end",data:{turn:73,reason:{kind:"completed"}}}),s(74,"todo_write",JSON.stringify({todos:o}),"Updated todo list: 1 pending, 2 in progress, 1 completed.");const a=e.length-4,i=e[a]?.time;return e.splice(a+1,0,{type:"todo/write",time:i+400,data:{todos:o}}),e.forEach((u,f)=>{u.seq=f}),e}r(jl,"buildAlphaLog");const H=r((e,t="")=>typeof e=="string"?e:t,"str");function Ns(e,t){let n;try{n=JSON.parse(t)}catch{return}switch(e){case"fx-bash":case"bash":return{card:"terminal",title:H(n.command),cwd:H(n.cwd,"/tmp/fixture"),description:"fixture 终端样本"};case"fx-write":return{card:"diff",title:`Write ${H(n.path)}`,diffs:[{path:H(n.path),oldText:null,newText:H(n.content)}]};case"read":return{card:"generic",title:`Read ${H(n.file_path)}`,kind:"read",locations:[{path:H(n.file_path)}]};case"edit":return H(n.file_path)==="src/config.ts"?{card:"diff",title:`Edit ${H(n.file_path)}`,diffs:[{path:H(n.file_path),oldText:"const timeout = 30",newText:"const timeout = 60"},{path:H(n.file_path),oldText:"retries: 1",newText:"retries: 3"}]}:{card:"diff",title:`Edit ${H(n.file_path)}`,diffs:[{path:H(n.file_path),oldText:H(n.old_string),newText:H(n.new_string)}]};case"write":return{card:"diff",title:`Write ${H(n.file_path)}`,diffs:[{path:H(n.file_path),oldText:null,newText:H(n.content)}]};case"grep":return{card:"generic",title:`Grep ${H(n.pattern)}`,kind:"search",rawInput:n};case"glob":return{card:"generic",title:`Glob ${H(n.pattern)}`,kind:"search",rawInput:n};case"web_search":return{card:"generic",title:`Search ${H(n.query)}`,kind:"search",rawInput:n};case"web_fetch":return{card:"generic",title:`Fetch ${H(n.url)}`,kind:"fetch",rawInput:n};default:return}}r(Ns,"presentCall");function Ml(e,t,n){const s=Ns(e,t);if(s!==void 0){if(e==="grep")return{card:"search",shape:"matches",files:As,truncated:!0,total:42};if(e==="glob")return{card:"search",shape:"paths",paths:Ts,truncated:!0,total:23};if(e==="read")return{card:"read",path:Ps,offset:ut,lines:Al,totalLines:Tl,lang:"ts",content:Y(n)};if(e==="web_search")return{card:"web",kind:"search",...Pl};if(e==="web_fetch")return{card:"web",kind:"fetch",...Rl};switch(s.card){case"terminal":return{card:"terminal",output:n,...$l[n]??{exitCode:0}};case"diff":return{card:"diff",diffs:s.diffs};case"generic":return{card:"generic",content:Y(n)}}}}r(Ml,"presentResult");function js(e,t){if(e.type==="tool/call"){const n=Ns(e.data.name,e.data.arguments);return n===void 0?void 0:{for:"call",view:n}}if(e.type==="tool/result"){const n=String(e.data.message.source.callId);for(let s=t.length-1;s>=0;s--){const o=t[s];if(o!==void 0&&o.type==="tool/call"&&String(o.data.callId)===n){const a=e.data.message.content[0].content.map(u=>u.type==="text"?u.text:"").join(""),i=Ml(o.data.name,o.data.arguments,a);return i===void 0?void 0:{for:"result",view:i}}}return}}r(js,"viewFor");function Bt(e){let t=!1,n=null;for(const s of e){const o=s;if(o.type==="command/run"&&o.data?.name==="plan"){const a=o.data.args;if(typeof a!="string")continue;n=a.trim()!=="off"}else o.type==="plan/mode"&&(t=o.data?.active===!0,n=null)}return{active:t,pending:n!==null&&n!==t,wanted:n}}r(Bt,"foldPlan");function Ms(e){const t=Bt(e);return{active:t.active,pending:t.pending}}r(Ms,"planViewOf");const Pe={"workspace-write":{sandbox:"workspace-write",approval:"ask",description:"Write inside the workspace and permitted temporary directories; wider retries require approval."},"danger-full-access":{sandbox:"danger-full-access",approval:"never",description:"Full file access without approval prompts."}};function dt(e){let t=null,n="workspace-write",s="ask";for(const u of e){const f=u;f.type==="permission/preset"?t=f.data.preset:f.type==="sandbox/mode"?n=f.data.mode:f.type==="approval/policy"&&(s=f.data.policy)}const o=r(u=>u.sandbox===n&&u.approval===s,"matches");let a="custom";const i=t===null?void 0:Pe[t];if(t!==null&&i!==void 0&&o(i))a=t;else for(const[u,f]of Object.entries(Pe))if(o(f)){a=u;break}return{options:[...Object.entries(Pe).map(([u,f])=>({value:u,name:u,description:f.description})),...a==="custom"?[{value:"custom",name:"Custom",description:"Current sandbox and approval settings do not match a preset."}]:[]],currentValue:a}}r(dt,"permissionSelectOf");function Jt(e){const t=e,n=t.type==="assistant/chunk"&&t.data.chunk?.type==="usage"?t.data.chunk.usage:t.type==="assistant/message"?t.data.usage:void 0;return n===void 0||t.data.turn===void 0||t.data.step===void 0?void 0:{turn:t.data.turn,step:t.data.step,usage:n}}r(Jt,"usageSampleOf");function Ds(e){const t={uncachedInputTokens:0,outputTokens:0,cacheReadTokens:0,cacheWriteTokens:0};let n=null;for(const s of e){const o=Jt(s);if(o===void 0)continue;const a={uncachedInputTokens:o.usage.inputTokens,outputTokens:o.usage.outputTokens,cacheReadTokens:o.usage.cacheReadTokens??0,cacheWriteTokens:o.usage.cacheWriteTokens??0},i=n?.turn===o.turn&&n.step===o.step?n.buckets:void 0;t.uncachedInputTokens+=a.uncachedInputTokens-(i?.uncachedInputTokens??0),t.outputTokens+=a.outputTokens-(i?.outputTokens??0),t.cacheReadTokens+=a.cacheReadTokens-(i?.cacheReadTokens??0),t.cacheWriteTokens+=a.cacheWriteTokens-(i?.cacheWriteTokens??0),n={turn:o.turn,step:o.step,buckets:a}}return t}r(Ds,"tokenUsageOf");function Cs(e){const t={turns:0,steps:0,llmMs:0,toolMs:0,ttftMs:0,ttftSteps:0,decodeMs:0,decodeTokens:0};let n=null,s=null;const o=new Map;for(const a of e)switch(a.type){case"step/start":s={turn:a.data.turn,step:a.data.step,startTime:a.time,firstTokenTime:null};break;case"assistant/chunk":s!==null&&s.turn===a.data.turn&&s.step===a.data.step&&s.firstTokenTime===null&&ao(a.data.chunk)&&(s.firstTokenTime=a.time);break;case"assistant/message":if(s===null||s.turn!==a.data.turn||s.step!==a.data.step)break;if(t.llmMs+=Math.max(0,a.time-s.startTime),s.firstTokenTime!==null){t.ttftMs+=Math.max(0,s.firstTokenTime-s.startTime),t.ttftSteps+=1;const i=a.data.usage?.outputTokens;typeof i=="number"&&Number.isFinite(i)&&i>=0&&(t.decodeMs+=Math.max(0,a.time-s.firstTokenTime),t.decodeTokens+=i)}s=null;break;case"tool/call":o.set(a.data.callId,a.time);break;case"tool/result":{const i=a.data.message.source.callId,u=o.get(i);if(u===void 0)break;o.delete(i),t.toolMs+=Math.max(0,a.time-u);break}case"step/end":a.data.turn!==n&&(t.turns+=1,n=a.data.turn),t.steps+=1,s=null;break;case"turn/end":o.clear()}return t}r(Cs,"sessionStatsOf");const Gt=4,Ve=4,Us=4;function Ls(e){const t=r(n=>Math.ceil(n.length/Gt),"densityPrice");return e.reduce((n,s)=>s.type==="text"||s.type==="reasoning"?n+t(s.text)+Ve:s.type==="tool-call"?n+t(s.name)+t(s.arguments)+Ve:s.type==="tool-result"?n+Ls(s.content)+Ve:n+t(JSON.stringify(s))+Ve,0)}r(Ls,"estimateFixtureContent");function Fs(e){const t=e.findLast(o=>o.type==="request/header"),n=t===void 0?void 0:t.data.header;let s=0;for(const o of ln(e).nodes){const a=e[o];if(a===void 0)continue;const i=uo(a);i!==null&&(s+=Ls(i.content)+Us)}return{systemTokens:n?.system===void 0?0:Math.ceil(n.system.length/Gt)+Us,toolsTokens:n?.tools===void 0||n.tools.length===0?0:Math.ceil(JSON.stringify(n.tools).length/Gt)+Ve,messageTokens:s}}r(Fs,"contextBreakdownOf");function Vs(e){const t=e.findLast(n=>n.type==="request/context");return t===void 0?void 0:t.data}r(Vs,"lastRequestContext");function Wt(e){let t;for(const s of e){const o=Jt(s);o!==void 0&&(t=o.usage.inputTokens+(o.usage.cacheReadTokens??0)+(o.usage.cacheWriteTokens??0))}const n=Vs(e)?.contextWindow;return{...t===void 0?{}:{pressureTokens:t},...n===void 0?{}:{contextWindow:n}}}r(Wt,"contextPressureOf");function Ht(e){const t={},n=e.findLast(s=>s.type==="session/title");return n!==void 0&&(t.title=n.data.title),t.todos=Hs(e)??null,t.permissions=dt(e),t.plan=Ms(e),t.goal=Re(e),t.tokenUsage=Ds(e),t.contextPressure=Wt(e),t.contextBreakdown=Fs(e),t.sessionStats=Cs(e),t.imageLimits={maxImageBytes:5242880,maxImagesPerMessage:20,maxMessageImageBytes:104857600,maxImagePixels:4e7,mediaTypes:["image/png","image/jpeg","image/webp","image/gif"]},t}r(Ht,"projectionValuesOf");function Dl(e,t,n){const s=n.type,o=[];if(Jt(n)!==void 0&&o.push({type:"session/projection",sessionId:e,key:"tokenUsage",value:Ds(t),seq:n.seq},{type:"session/projection",sessionId:e,key:"contextPressure",value:Wt(t),seq:n.seq}),s==="request/context"&&o.push({type:"session/projection",sessionId:e,key:"contextPressure",value:Wt(t),seq:n.seq}),(s==="request/header"||s==="user/message"||s==="assistant/message"||s==="tool/result")&&o.push({type:"session/projection",sessionId:e,key:"contextBreakdown",value:Fs(t),seq:n.seq}),(s==="assistant/message"||s==="tool/result"||s==="step/end")&&o.push({type:"session/projection",sessionId:e,key:"sessionStats",value:Cs(t),seq:n.seq}),o.length>0)return o;if(s==="session/title"){const i=Ht(t);return Object.hasOwn(i,"title")?[{type:"session/projection",sessionId:e,key:"title",value:i.title,seq:n.seq}]:[]}if(s==="goal/change")return[{type:"session/projection",sessionId:e,key:"goal",value:Re(t),seq:n.seq}];if(s==="todo/write"||s==="turn/start")return[{type:"session/projection",sessionId:e,key:"todos",value:Hs(t)??null,seq:n.seq}];if(s==="permission/preset"||s==="sandbox/mode"||s==="approval/policy")return[{type:"session/projection",sessionId:e,key:"permissions",value:dt(t),seq:n.seq}];const a=n;return s==="plan/mode"||s==="command/run"&&a.data.name==="plan"&&typeof a.data.args=="string"?[{type:"session/projection",sessionId:e,key:"plan",value:Ms(t),seq:n.seq}]:[]}r(Dl,"projectionFramesOf");function Bs(e,t,n){const s=t===void 0?e.length:Math.max(0,Math.min(t,e.length));let o=0,a=0;for(let i=s-1;i>=0;i--){const u=e[i];if(u===void 0)break;if((u.type==="user/message"||u.type==="assistant/message")&&a++,u.type==="turn/start"&&a>=n){o=i;break}}return{events:e.slice(o,s).map(i=>{const u=js(i,e);return u===void 0?{event:i}:{event:i,view:u}}),hasMore:o>0}}r(Bs,"pageOf");function Cl(e,t){const n=r(s=>{if(Array.isArray(s))return s.some(n);if(typeof s!="object"||s===null)return!1;const o=s;return o.attachmentId===t?!0:Object.values(o).some(n)},"visit");return e.some(s=>n(s.data))}r(Cl,"logReferencesAttachment");function Js(e){switch(e.type){case"text":return[e.text];case"reasoning":return[];case"tool-call":return[e.name,e.arguments];case"tool-result":return e.content.flatMap(Js);default:return[]}}r(Js,"searchBlockText");function Ul(e){const t=e.type==="user/message"?e.data.content:e.type==="assistant/message"?e.data.message.content:void 0;return t===void 0?"":t.flatMap(Js).map(n=>n.trim()).filter(Boolean).join(`
|
|
83
|
+
`)}r(Ul,"searchEventText");function Gs(e){const t=e.replace(/\s+/gu," ").trim(),n=Array.from(t),s=[];let o,a="";const i=r(u=>{if(o!==void 0){const f=a.normalize("NFD").replace(new RegExp("\\p{M}+","gu"),"").toLowerCase();f!==""&&s.push({value:f,start:o,end:u})}o=void 0,a=""},"flush");for(let u=0;u<n.length;u++){const f=n[u],m=f.normalize("NFD").replace(new RegExp("\\p{M}+","gu"),"");if(m===""){o!==void 0&&(a+=f);continue}/^[\p{L}\p{N}\p{Co}]+$/u.test(m)?(o??=u,a+=f):i(u)}return i(n.length),{text:t,tokens:s}}r(Gs,"searchTokenSpans");function Ll(e,t){if(t.length===0||t.length>e.length)return{count:0,start:0,end:0};let n=0,s=0,o=0;for(let a=0;a<=e.length-t.length;a++)t.every((i,u)=>e[a+u]?.value===i)&&(n++,n===1&&(s=e[a]?.start??0,o=e[a+t.length-1]?.end??s));return{count:n,start:s,end:o}}r(Ll,"phraseMatch");function Fl(e,t,n){const s=Array.from(e);if(s.length<=120)return e;const o=Math.min(Math.max(0,t),s.length-1),a=Math.min(s.length,Math.max(o+1,n)),i=Math.floor((o+a)/2);let u=Math.min(s.length-118,Math.max(0,i-Math.floor(59))),f=u+118;return u===0?f=119:f===s.length&&(u=s.length-119),`${u>0?"…":""}${s.slice(u,f).join("")}${f<s.length?"…":""}`}r(Fl,"searchSnippet");function Ws(e,t){return e.matchCount!==t.matchCount?t.matchCount-e.matchCount:e.documentLength!==t.documentLength?e.documentLength-t.documentLength:e.time!==t.time?t.time-e.time:e.sessionId!==t.sessionId?e.sessionId<t.sessionId?-1:1:t.seq-e.seq}r(Ws,"compareSearchCandidates");function Hs(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n!==void 0){if(n.type==="turn/start")return;if(n.type==="todo/write")return n.data.todos}}}r(Hs,"backscanTodos");function Re(e){for(let t=e.length-1;t>=0;t--){const n=e[t];if(n===void 0||n.type!=="goal/change"||n.data===void 0)continue;const s=n.data;return s.operation==="clear"?null:{goal:s.goal,roundsStarted:s.roundsStarted,createdAt:s.createdAt,updatedAt:s.updatedAt}}return null}r(Re,"backscanGoal");var Ks=class{static{r(this,"FxInbox")}inbox=[];wake=null;broken=!1;push(e){this.inbox.push(e),this.wake?.()}breakNow(){this.broken=!0,this.wake?.()}isLive(e){return!e.aborted&&!this.broken}async*drain(e){const t=r(()=>this.wake?.(),"onAbort");e.addEventListener("abort",t);try{for(;this.isLive(e);){for(;this.inbox.length>0;)yield this.inbox.shift();if(!this.isLive(e))break;await new Promise(n=>{this.wake=n}),this.wake=null}}finally{e.removeEventListener("abort",t)}}};function Vl(e){const t=e.empty?[]:[{sessionId:"fx-alpha",updatedAt:Date.now(),running:!0,blank:!1,cwd:"/tmp/fixture"},{sessionId:"fx-beta",updatedAt:Date.now()-6e4,running:!1,blank:!1,parentSessionId:"fx-alpha",cwd:"/tmp/fixture"},{sessionId:"fx-gamma",updatedAt:Date.now()-12e4,running:!1,blank:!1,cwd:"/tmp/fixture"}],n=new Map([["fx-alpha",jl()]]),s=new Map(t.map(c=>[c.sessionId,{provider:"deepseek-official",model:"deepseek-v4-flash"}])),o=new Map([[String(lt.attachmentId),{attachment:lt,data:Nl}]]),a=new Map([["DEEPSEEK_API_KEY",!0]]),i=new Map([["standard",{trust:"system",content:`- id: tool-bash
|
|
84
84
|
name: '@deepseek-ai/dsh-tool-bash'
|
|
85
85
|
`}],["minimal",{trust:"system",content:`- id: tool-web-search
|
|
86
86
|
name: '@deepseek-ai/dsh-tool-web-search'
|
|
87
87
|
`}],["my-agent",{trust:"user",content:`- id: tool-read
|
|
88
88
|
name: '@deepseek-ai/dsh-tool-read'
|
|
89
|
-
`}]]);let u="standard";const f=new Map([["fx-alpha",75]]);let m=1,k=1,_=e.empty?0:1;const b=r(c=>c,"wid"),S=new Date(Date.now()-3e5).toISOString(),E=e.empty?[]:[{workspaceId:b("fx-ws-fixture"),path:"/tmp/fixture",title:"fixture",sessionIds:["fx-alpha","fx-beta","fx-gamma"],createdAt:S,updatedAt:S}];let D=1;const ce=[],Se="/home/fixture",te=new Map([["/",["home"]],["/home",["fixture"]],[Se,["Documents","Downloads",".config"]],[`${Se}/Documents`,["project","deepseek-iOS","deepseek-android","deepseek-platform","deepseek-web","deepseek-harness","deepseek-app","deepseek-landing-blog"]]]),F=r(c=>{const l=te.get(c);if(l!==void 0)return l;const h=c.slice(0,c.lastIndexOf("/"))||"/",v=c.slice(c.lastIndexOf("/")+1);return te.get(h)?.includes(v)===!0?[]:void 0},"childrenOf"),Q=r(c=>{const l=[{name:"/",path:"/",hidden:!1}];let h="";for(const v of c.split("/").filter(Boolean))h+=`/${v}`,l.push({name:v,path:h,hidden:!1});return l},"crumbsOf"),ge=r(()=>`fx-rpc-${k++}`,"mint"),Be=ge(),Je="fx-approval-1";let Kt=!0;const Yt=ge();let Xt=!0;const od=[{id:"harness-profile",header:"偏好",question:"你现在更想招哪类 Agent/Harness 候选人?",options:[{label:"工程落地型 (Recommended)",description:"更看重能直接做 runtime、tool executor、sandbox、trace 和线上问题排查。"},{label:"研究潜力型",description:"更看重 Agent 理解、训练评测思路和长期成长空间。"},{label:"均衡型",description:"同时要求工程能力和 Agent 认知,但可能筛选门槛更高。"}]},{id:"work-mode",header:"方式",question:"你希望候选人优先展示哪种工作方式?",options:[{label:"先做小型原型 (Recommended)",description:"用可运行结果尽快验证关键假设。"},{label:"先写完整设计",description:"先收敛边界、协议和风险,再开始实现。"}]},{id:"signals",header:"信号",question:"哪些面试信号最重要?",detail:"按当前招聘目标选择;跳过则视为不设偏好。",multiSelect:!0,options:[{label:"系统设计"},{label:"代码质量"},{label:"Agent 产品判断"}]}],Qt=new Set,qt=new Set,pt=r(c=>{for(const l of Qt)l.push({rpcId:ge(),payload:c})},"emitMux"),ue=r(c=>{for(const l of qt)l.push({rpcId:ge(),payload:c})},"emitHost");function P(c,l){return Promise.resolve({rpcId:c.rpcId,result:{ok:!0,value:l}})}r(P,"ok");function C(c,l){return Promise.resolve({rpcId:c.rpcId,result:{ok:!1,error:l}})}r(C,"err");const ke=r(c=>t.find(l=>l.sessionId===c),"summaryOf"),en=r(c=>{if(ke(c.payload.sessionId)===void 0)return C(c,{code:"session-not-found",message:`no session ${c.payload.sessionId}`,details:{sessionId:c.payload.sessionId}})},"requireSession"),be=r((c,l)=>{const h=ke(c);h===void 0||h.running===l||(h.running=l,ue({type:"host/session-status",sessionId:c,running:l}))},"setRunning"),q=r(c=>{let l=n.get(c);return l===void 0&&(l=[],n.set(c,l)),l},"logOf"),O=r((c,l)=>{const h=q(c),v={seq:h.length,time:Date.now(),...l};h.push(v);const w=js(v,h);pt(w===void 0?{type:"session/event",sessionId:c,event:v}:{type:"session/event",sessionId:c,event:v,view:w});for(const I of Dl(c,h,v))pt(I)},"append"),ft=r((c,l)=>{const h=q(c);return O(c,{type:"goal/change",data:l}),Re(h)},"appendGoalChange"),tn=r(c=>({ok:!1,error:{code:"internal",message:c,details:{}}}),"goalFailure"),ht=r(c=>ke(c)===void 0?{ok:!1,error:{code:"session-not-found",message:`no session ${c}`,details:{sessionId:c}}}:void 0,"requireGoalSession"),Xs={list(c){const l=ht(c);return l!==void 0?l:{ok:!0,value:[{name:"compact",description:"fixture:压缩当前会话上下文"},{name:"echo",description:"fixture:回显参数",input:{hint:"text to echo"}},{name:"goal",description:"set or view the goal for a long-running task",input:{hint:"<objective>"}},{name:"permission",description:"Switch the permission preset (sandbox mode + approval policy)",input:{hint:"<preset>"}},{name:"plan",description:"Enter or leave plan mode",input:{hint:"[off|message]"}}]}},execute(c,l){const h=ht(c);if(h!==void 0)return h;const v=/^\/(\S+)((?:\s.*)?)$/.exec(l.trim()),w=v?.[1],I=v?.[2]??"";if(w==="permission"){const L=I.trim(),le=`fx-cmd-${q(c).length}`;O(c,{type:"command/run",data:{commandId:le,name:w,args:I,source:{kind:"user"}}});const oe=Pe[L];let ne;return L===""?ne={kind:"success",text:`current preset ${dt(q(c)).currentValue} (available: ${Object.keys(Pe).join(", ")})`}:oe===void 0?ne={kind:"error",text:`unknown preset "${L}" (available: ${Object.keys(Pe).join(", ")})`}:(dt(q(c)).currentValue!==L&&O(c,{type:"permission/preset",data:{preset:L}}),O(c,{type:"sandbox/mode",data:{mode:oe.sandbox}}),O(c,{type:"approval/policy",data:{policy:oe.approval}}),ne={kind:"success",text:`preset ${L}`}),O(c,{type:"command/done",data:{commandId:le,...ne}}),{ok:!0,value:{commandId:le,result:ne}}}if(w==="goal"){const L=`fx-cmd-${q(c).length}`;O(c,{type:"command/run",data:{commandId:L,name:w,args:I,source:{kind:"user"}}});const le=I.trim(),oe=Re(q(c));let ne;le===""?ne=oe===null?"No goal is set. Usage: /goal <objective>":`Current goal: ${oe.goal.objective}`:oe!==null&&oe.goal.phase!=="complete"?ne=`A goal already exists (${oe.goal.objective}). Clear it first.`:ne=`Goal created: ${ft(c,{kind:"goal/change",version:1,operation:"create",goal:{id:`fx-goal-${q(c).length}`,revision:1,objective:le,phase:"active",maxGoalRounds:256},roundsStarted:0,createdAt:Date.now(),updatedAt:Date.now()}).goal.objective}`;const yt={kind:"success",text:ne};return O(c,{type:"command/done",data:{commandId:L,...yt}}),{ok:!0,value:{commandId:L,result:yt}}}const
|
|
89
|
+
`}]]);let u="standard";const f=new Map([["fx-alpha",75]]);let m=1,k=1,_=e.empty?0:1;const b=r(c=>c,"wid"),S=new Date(Date.now()-3e5).toISOString(),E=e.empty?[]:[{workspaceId:b("fx-ws-fixture"),path:"/tmp/fixture",title:"fixture",sessionIds:["fx-alpha","fx-beta","fx-gamma"],createdAt:S,updatedAt:S}];let D=1;const ce=[],Se="/home/fixture",te=new Map([["/",["home"]],["/home",["fixture"]],[Se,["Documents","Downloads",".config"]],[`${Se}/Documents`,["project","deepseek-iOS","deepseek-android","deepseek-platform","deepseek-web","deepseek-harness","deepseek-app","deepseek-landing-blog"]]]),F=r(c=>{const l=te.get(c);if(l!==void 0)return l;const h=c.slice(0,c.lastIndexOf("/"))||"/",v=c.slice(c.lastIndexOf("/")+1);return te.get(h)?.includes(v)===!0?[]:void 0},"childrenOf"),Q=r(c=>{const l=[{name:"/",path:"/",hidden:!1}];let h="";for(const v of c.split("/").filter(Boolean))h+=`/${v}`,l.push({name:v,path:h,hidden:!1});return l},"crumbsOf"),ge=r(()=>`fx-rpc-${k++}`,"mint"),Be=ge(),Je="fx-approval-1";let Kt=!0;const Yt=ge();let Xt=!0;const od=[{id:"harness-profile",header:"偏好",question:"你现在更想招哪类 Agent/Harness 候选人?",options:[{label:"工程落地型 (Recommended)",description:"更看重能直接做 runtime、tool executor、sandbox、trace 和线上问题排查。"},{label:"研究潜力型",description:"更看重 Agent 理解、训练评测思路和长期成长空间。"},{label:"均衡型",description:"同时要求工程能力和 Agent 认知,但可能筛选门槛更高。"}]},{id:"work-mode",header:"方式",question:"你希望候选人优先展示哪种工作方式?",options:[{label:"先做小型原型 (Recommended)",description:"用可运行结果尽快验证关键假设。"},{label:"先写完整设计",description:"先收敛边界、协议和风险,再开始实现。"}]},{id:"signals",header:"信号",question:"哪些面试信号最重要?",detail:"按当前招聘目标选择;跳过则视为不设偏好。",multiSelect:!0,options:[{label:"系统设计"},{label:"代码质量"},{label:"Agent 产品判断"}]}],Qt=new Set,qt=new Set,pt=r(c=>{for(const l of Qt)l.push({rpcId:ge(),payload:c})},"emitMux"),ue=r(c=>{for(const l of qt)l.push({rpcId:ge(),payload:c})},"emitHost");function P(c,l){return Promise.resolve({rpcId:c.rpcId,result:{ok:!0,value:l}})}r(P,"ok");function C(c,l){return Promise.resolve({rpcId:c.rpcId,result:{ok:!1,error:l}})}r(C,"err");const ke=r(c=>t.find(l=>l.sessionId===c),"summaryOf"),en=r(c=>{if(ke(c.payload.sessionId)===void 0)return C(c,{code:"session-not-found",message:`no session ${c.payload.sessionId}`,details:{sessionId:c.payload.sessionId}})},"requireSession"),be=r((c,l)=>{const h=ke(c);h===void 0||h.running===l||(h.running=l,ue({type:"host/session-status",sessionId:c,running:l}))},"setRunning"),q=r(c=>{let l=n.get(c);return l===void 0&&(l=[],n.set(c,l)),l},"logOf"),O=r((c,l)=>{const h=q(c),v={seq:h.length,time:Date.now(),...l};h.push(v);const w=js(v,h);pt(w===void 0?{type:"session/event",sessionId:c,event:v}:{type:"session/event",sessionId:c,event:v,view:w});for(const I of Dl(c,h,v))pt(I)},"append"),ft=r((c,l)=>{const h=q(c);return O(c,{type:"goal/change",data:l}),Re(h)},"appendGoalChange"),tn=r(c=>({ok:!1,error:{code:"internal",message:c,details:{}}}),"goalFailure"),ht=r(c=>ke(c)===void 0?{ok:!1,error:{code:"session-not-found",message:`no session ${c}`,details:{sessionId:c}}}:void 0,"requireGoalSession"),Xs={list(c){const l=ht(c);return l!==void 0?l:{ok:!0,value:[{name:"compact",description:"fixture:压缩当前会话上下文"},{name:"echo",description:"fixture:回显参数",input:{hint:"text to echo"}},{name:"goal",description:"set or view the goal for a long-running task",input:{hint:"<objective>"}},{name:"permission",description:"Switch the permission preset (sandbox mode + approval policy)",input:{hint:"<preset>"}},{name:"plan",description:"Enter or leave plan mode",input:{hint:"[off|message]"}}]}},execute(c,l){const h=ht(c);if(h!==void 0)return h;const v=/^\/(\S+)((?:\s.*)?)$/.exec(l.trim()),w=v?.[1],I=v?.[2]??"";if(w==="permission"){const L=I.trim(),le=`fx-cmd-${q(c).length}`;O(c,{type:"command/run",data:{commandId:le,name:w,args:I,source:{kind:"user"}}});const oe=Pe[L];let ne;return L===""?ne={kind:"success",text:`current preset ${dt(q(c)).currentValue} (available: ${Object.keys(Pe).join(", ")})`}:oe===void 0?ne={kind:"error",text:`unknown preset "${L}" (available: ${Object.keys(Pe).join(", ")})`}:(dt(q(c)).currentValue!==L&&O(c,{type:"permission/preset",data:{preset:L}}),O(c,{type:"sandbox/mode",data:{mode:oe.sandbox}}),O(c,{type:"approval/policy",data:{policy:oe.approval}}),ne={kind:"success",text:`preset ${L}`}),O(c,{type:"command/done",data:{commandId:le,...ne}}),{ok:!0,value:{commandId:le,result:ne}}}if(w==="goal"){const L=`fx-cmd-${q(c).length}`;O(c,{type:"command/run",data:{commandId:L,name:w,args:I,source:{kind:"user"}}});const le=I.trim(),oe=Re(q(c));let ne;le===""?ne=oe===null?"No goal is set. Usage: /goal <objective>":`Current goal: ${oe.goal.objective}`:oe!==null&&oe.goal.phase!=="complete"?ne=`A goal already exists (${oe.goal.objective}). Clear it first.`:ne=`Goal created: ${ft(c,{kind:"goal/change",version:1,operation:"create",goal:{id:`fx-goal-${q(c).length}`,revision:1,objective:le,phase:"active",maxGoalRounds:256},roundsStarted:0,createdAt:Date.now(),updatedAt:Date.now()}).goal.objective}`;const yt={kind:"success",text:ne};return O(c,{type:"command/done",data:{commandId:L,...yt}}),{ok:!0,value:{commandId:L,result:yt}}}const z=ke(c)?.running===!0,M={compact:"fixture:已压缩(假动作)",echo:I.trim(),plan:I.trim()==="off"?z?"Leaving plan mode (applies from the next step).":"Plan mode off.":z?"Entering plan mode (applies from the next step). Use /plan off to leave.":"Plan mode on. Use /plan off to leave."},$=w===void 0?void 0:M[w];if(w===void 0||$===void 0)return{ok:!0,value:void 0};const j=`fx-cmd-${q(c).length}`;if(O(c,{type:"command/run",data:{commandId:j,name:w,args:I,source:{kind:"user"}}}),w==="plan"&&!z){const L=Bt(q(c));L.wanted!==null&&L.wanted!==L.active&&O(c,{type:"plan/mode",data:{active:L.wanted}})}const Z={kind:"success",...$===""?{}:{text:$}};return O(c,{type:"command/done",data:{commandId:j,...Z}}),{ok:!0,value:{commandId:j,result:Z}}}},rd=r(c=>({...c.goal,roundsStarted:c.roundsStarted,createdAt:c.createdAt,updatedAt:c.updatedAt,activation:c.goal.phase==="active"?"armed":"disarmed"}),"goalView"),ae={create(c,l){const h=ht(c);if(h!==void 0)return h;const v=Re(q(c));if(v!==null&&v.goal.phase!=="complete")return tn(`goal "${v.goal.id}" already exists`);const w=Date.now(),I=ft(c,{kind:"goal/change",version:1,operation:"create",goal:{id:`fx-goal-${q(c).length}`,revision:1,objective:l.objective,phase:"active",maxGoalRounds:l.maxGoalRounds??256},roundsStarted:0,createdAt:w,updatedAt:w});return{ok:!0,value:{ref:{id:I.goal.id,revision:I.goal.revision}}}},edit(c,l,h){return mt(c,l,v=>({...v.goal,revision:v.goal.revision+1,...h.objective===void 0?{}:{objective:h.objective},...h.maxGoalRounds===void 0?{}:{maxGoalRounds:h.maxGoalRounds}}))},pause(c,l){return mt(c,l,h=>h.goal.phase==="active"?{...h.goal,revision:h.goal.revision+1,phase:"paused"}:void 0)},resume(c,l){return mt(c,l,h=>h.goal.phase==="paused"||h.goal.phase==="blocked"||h.goal.phase==="active"?{...h.goal,revision:h.goal.revision+1,phase:"active"}:void 0)},complete(c,l){return mt(c,l,h=>h.goal.phase==="complete"?void 0:{...h.goal,revision:h.goal.revision+1,phase:"complete"})},clear(c,l){const h=Qs(c,l);if(!h.ok)return h;const v=h.value,w={id:v.goal.id,revision:v.goal.revision+1};return ft(c,{kind:"goal/change",version:1,operation:"clear",cleared:w,clearedAt:Date.now()}),{ok:!0,value:w}}};function Qs(c,l){const h=ht(c);if(h!==void 0)return h;const v=Re(q(c));return v===null||v.goal.id!==l.id||v.goal.revision!==l.revision?tn("stale or missing goal revision"):{ok:!0,value:v}}r(Qs,"resolveGoal");function mt(c,l,h){const v=Qs(c,l);if(!v.ok)return v;const w=v.value,I=h(w);if(I===void 0)return tn(`invalid goal transition from "${w.goal.phase}"`);const z=ft(c,{kind:"goal/change",version:1,operation:I.phase===w.goal.phase?"edit":I.phase==="paused"?"pause":I.phase==="active"?"resume":"complete",goal:I,roundsStarted:w.roundsStarted,createdAt:w.createdAt,updatedAt:Date.now()});return{ok:!0,value:rd(z)}}r(mt,"mutateGoal");const nn=r((c,l)=>c.ok?{ok:!0,value:l(c.value)}:c,"mapGoalResult"),gt=r(c=>nn(c,l=>({ref:{id:l.id,revision:l.revision}})),"goalRefResult"),Ze=r((c,l)=>Promise.resolve({rpcId:c.rpcId,result:l}),"legacyGoalResponse"),Ge=new Map;let qs=0,sn=!1;const We=new Set,Ne=new Map;let vt=null;globalThis.__fxTiming={setHistoryDelay(c){qs=c},failNextHistory(){sn=!0},appendUser(c,l){O(c,{type:"user/message",surfaceOp:"append",data:ie(Y(l))})},appendTitle(c,l){const h=q(c).filter(v=>v.type==="user/message").map(v=>v.seq);O(c,{type:"session/title",data:{title:l,messageSeqs:h,source:{kind:"provider",provider:"fixture"}}})},startReasoningChunkStorm(c,l,h,v){if(!Number.isSafeInteger(l)||l<1)throw new Error("fixture: reasoning chunk count must be a positive safe integer");if(!Number.isSafeInteger(h)||h<1)throw new Error("fixture: reasoning chunks per interval must be a positive safe integer");if(!Number.isSafeInteger(v)||v<1)throw new Error("fixture: reasoning interval must be a positive safe integer");if(vt?.emitting===!0)throw new Error("fixture: reasoning chunk storm already running");const w=c,I=q(w);let z=f.get(w)??0;for(const L of I){const le=L.data?.turn;typeof le=="number"&&(z=Math.max(z,le+1))}f.set(w,z+1);const M=`REASONING_STRESS_COMPLETE:${String(z)}:${String(l)}`,$={sessionId:c,chunkCount:l,chunksPerInterval:h,intervalMs:v,emitted:0,marker:M,emitting:!0};vt=$,be(w,!0),O(w,{type:"turn/start",data:{turn:z,trigger:{kind:"message",source:{kind:"user"}}}}),O(w,{type:"user/message",surfaceOp:"append",data:ie(Y(`Reasoning chunk stress: ${String(l)} chunks.`))}),O(w,{type:"step/start",data:{turn:z,step:0}}),O(w,{type:"assistant/chunk",data:{turn:z,step:0,chunk:{type:"block-start",index:0,blockType:"reasoning"}}});const j=Date.now(),Z=r(()=>{const L=Math.floor((Date.now()-j)/v)+1,le=Math.max($.emitted+h,L*h),oe=Math.min(le,l);for(let ne=$.emitted;ne<oe;ne++){const yt=ne===l-1?`
|
|
90
90
|
${M}`:ne%64===63?`推理
|
|
91
|
-
`:"推理";O(w,{type:"assistant/chunk",data:{turn:A,step:0,chunk:{type:"reasoning-delta",index:0,text:yt}}})}$.emitted=oe,oe<l?setTimeout(Z,v):$.emitting=!1},"pump");return setTimeout(Z,0),M},reasoningChunkStormState(){return vt===null?null:{...vt}},beginModelRetry(c){const l=c,h=f.get(l)??0;f.set(l,h+1),Ne.set(l,{turn:h,stepStarted:!0}),be(l,!0),O(l,{type:"turn/start",data:{turn:h}}),O(l,{type:"user/message",surfaceOp:"append",data:{content:Y("请重试这个请求"),source:{kind:"user"}}}),O(l,{type:"step/start",data:{turn:h,step:1}}),O(l,{type:"assistant/chunk",data:{turn:h,step:1,chunk:{type:"block-start",index:0,blockType:"text"}}}),O(l,{type:"assistant/chunk",data:{turn:h,step:1,chunk:{type:"text-delta",index:0,text:"应撤回的半截回复"}}})},scheduleModelRetry(c,l=1,h=450){const v=c,w=Ne.get(v);if(w===void 0)throw new Error(`fixture: no model retry scenario for ${c}`);w.stepStarted||(O(v,{type:"assistant/chunk",data:{turn:w.turn,step:1,chunk:{type:"block-start",index:0,blockType:"text"}}}),O(v,{type:"assistant/chunk",data:{turn:w.turn,step:1,chunk:{type:"text-delta",index:0,text:`第 ${String(l)} 次应撤回的回复`}}}),w.stepStarted=!0),O(v,{type:"llm/retry",data:{turn:w.turn,step:1,provider:"fixture",mode:"normal",policyKey:"fixture-normal",retry:l,maxRetries:2,delayMs:h,failure:{code:"TRANSPORT",message:"连接被重置"}}}),w.stepStarted=!1},cancelModelRetryDuringBackoff(c,l=450){const h=c,v=Ne.get(h);if(v===void 0)throw new Error(`fixture: no model retry scenario for ${c}`);O(h,{type:"llm/retry",data:{turn:v.turn,step:1,provider:"fixture",mode:"normal",policyKey:"fixture-normal",retry:1,maxRetries:2,delayMs:l,failure:{code:"TRANSPORT",message:"连接被重置"}}}),O(h,{type:"step/end",data:{turn:v.turn,step:1}}),O(h,{type:"turn/end",data:{turn:v.turn,reason:{kind:"aborted",reason:{kind:"user"}}}}),Ne.delete(h),be(h,!1)},completeModelRetry(c){const l=c,h=Ne.get(l);if(h===void 0)throw new Error(`fixture: no model retry scenario for ${c}`);Ne.delete(l),O(l,{type:"assistant/chunk",data:{turn:h.turn,step:1,chunk:{type:"block-start",index:0,blockType:"text"}}}),O(l,{type:"assistant/message",surfaceOp:"append",data:{turn:h.turn,step:1,message:me(Y("重试后的完整回复"))}}),O(l,{type:"step/end",data:{turn:h.turn,step:1}}),O(l,{type:"turn/end",data:{turn:h.turn,reason:{kind:"completed"}}}),be(l,!1)},appendSilent(c,l){const h=q(c);h.push({type:"user/message",surfaceOp:"append",seq:h.length,time:Date.now(),data:ie(Y(l))})},breakStreams(){for(const c of[...We])c()}};const ad=r((c,l,h)=>{O(c,{type:"step/start",data:{turn:l,step:0}}),O(c,{type:"assistant/chunk",data:{turn:l,step:0,chunk:{type:"block-start",index:0,blockType:"text"}}});const w=h.match(/[\s\S]{1,6}/gu)??[h];let I=0;const A=r($=>{Ge.delete(c);const j=w.slice(0,I).join("");O(c,{type:"assistant/chunk",data:{turn:l,step:0,chunk:{type:"block-end",index:0,block:{type:"text",text:j}}}}),O(c,{type:"assistant/message",surfaceOp:"append",data:{turn:l,step:0,message:me(Y($?`${j}(已中断)`:j)),usage:Zs(l,0)}}),O(c,{type:"step/end",data:{turn:l,step:0}}),O(c,{type:"turn/end",data:{turn:l,reason:{kind:$?"cancelled":"completed"}}}),be(c,!1)},"finish"),M=r(()=>{const $=w[I];if($===void 0){A(!1);return}I++,O(c,{type:"assistant/chunk",data:{turn:l,step:0,chunk:{type:"text-delta",index:0,text:$}}}),Ge.set(c,{timer:setTimeout(M,80),finish:A})},"tick");Ge.set(c,{timer:setTimeout(M,80),finish:A})},"startReply");return{api:{sessions:{list:r(c=>P(c,{items:[...t].sort((l,h)=>h.updatedAt-l.updatedAt)}),"list"),search:r((c,l)=>{if(l.aborted)return C(c,{code:"cancelled",message:"fixture session search was aborted",details:{}});const h=Gs(c.payload.query).tokens.map(w=>w.value),v=t.flatMap(w=>{const I=n.get(w.sessionId)??[],A=new Set(ln(I).nodes),M=I.flatMap($=>{if(!A.has($.seq))return[];const j=Ul($),Z=Gs(j),L=Ll(Z.tokens,h);return L.count===0?[]:[{sessionId:w.sessionId,seq:$.seq,time:$.time,text:Z.text,matchCount:L.count,matchStart:L.start,matchEnd:L.end,documentLength:Array.from(j).length}]}).sort(Ws)[0];return M===void 0?[]:[M]}).sort(Ws);return P(c,{items:v.slice(0,20).map(w=>({sessionId:w.sessionId,snippet:Fl(w.text,w.matchStart,w.matchEnd)})),hasMore:v.length>20})},"search"),create:r(async c=>{const l=c.payload.workspaceId===void 0?void 0:E.find($=>$.workspaceId===c.payload.workspaceId);if(c.payload.workspaceId!==void 0&&l===void 0)return C(c,{code:"workspace-not-found",message:`no workspace ${c.payload.workspaceId}`,details:{workspaceId:c.payload.workspaceId}});const h=l?.path??c.payload.cwd??"/tmp/fixture",v=c.payload.sessionId,w=r($=>{l===void 0||l.sessionIds.includes($)||(l.sessionIds=[$,...l.sessionIds],l.updatedAt=new Date().toISOString(),ue({type:"host/workspace-changed",workspace:{...l}}))},"attachWorkspace"),I=r(($,j)=>C(c,{code:"workspace-attach-failed",message:`fixture rejected Workspace attachment for ${$}`,details:{sessionId:$,workspaceId:j}}),"attachFailure");if(v!==void 0){const $=ke(v);if($!==void 0){if($.cwd!==h)return C(c,{code:"session-conflict",message:`session ${v} already uses ${$.cwd??"no cwd"}`,details:{sessionId:v,requestedCwd:h,...$.cwd===void 0?{}:{existingCwd:$.cwd}}});if(l!==void 0&&!l.sessionIds.includes(v)){if(e.failWorkspaceAttach)return I(v,l.workspaceId);w(v)}return P(c,{sessionId:v})}}const A={sessionId:v??`fx-${m++}`,updatedAt:Date.now(),running:!1,blank:!0,cwd:h};t.push(A),s.set(A.sessionId,{provider:"deepseek-official",model:"deepseek-v4-flash"}),_+=1;const M=r(()=>{ue({type:"host/session-added",sessionId:A.sessionId,blank:!0,cwd:h})},"emitSession");if(l!==void 0&&e.failWorkspaceAttach)return M(),I(A.sessionId,l.workspaceId);if(l!==void 0&&e.createFrameOrder==="workspace-first"?(w(A.sessionId),M()):(M(),l!==void 0&&w(A.sessionId)),e.dropSessionCreateResponse)throw new Error("fixture: dropped session.create response after publication");return P(c,{sessionId:A.sessionId})},"create"),rename:r(c=>{const l=en(c);if(l!==void 0)return l;const{sessionId:h,title:v}=c.payload,w=v.trim().replace(/\s+/g," ");return w.length===0?C(c,{code:"title-invalid",message:"session title must contain visible characters",details:{sessionId:h}}):(O(h,{type:"session/title",data:{title:w,messageSeqs:[],source:{kind:"user"}}}),P(c,{title:w,seq:q(h).at(-1).seq}))},"rename"),fork:r(c=>{const{sessionId:l,atSeq:h}=c.payload,v=ke(l);if(v===void 0)return C(c,{code:"session-not-found",message:`no session ${l}`,details:{sessionId:l}});const w=n.get(l)??[],I=w.at(-1)?.seq??-1,A=(h===void 0?void 0:w.find(Z=>Z.type==="turn/end"&&Z.seq>=h))??(h===void 0||h>I?w.findLast(Z=>Z.type==="turn/end"):void 0);if(A===void 0)return C(c,{code:"fork-unavailable",message:h!==void 0&&h<=I?`session ${l} has not completed the turn containing event ${String(h)}`:`session ${l} has no completed turn`,details:{sessionId:l}});let M=A.seq+1;for(;M<w.length&&w[M]?.type!=="turn/start";)M++;const $={sessionId:`fx-${m++}`,updatedAt:Date.now(),running:!1,blank:!1,parentSessionId:l,...v.cwd===void 0?{}:{cwd:v.cwd}};n.set($.sessionId,w.slice(0,M)),t.push($),ue({type:"host/session-added",sessionId:$.sessionId,blank:!1,parentSessionId:l,...v.cwd===void 0?{}:{cwd:v.cwd}});const j=E.find(Z=>Z.sessionIds.includes(l));return j!==void 0&&(j.sessionIds=[$.sessionId,...j.sessionIds],j.updatedAt=new Date().toISOString(),ue({type:"host/workspace-changed",workspace:{...j}})),P(c,{sessionId:$.sessionId})},"fork"),history:r(async c=>{const l=n.get(c.payload.sessionId)??[],h=Bs(l,c.payload.beforeSeq,c.payload.maxMessages??50),v=c.payload.beforeSeq===void 0?{asOfSeq:l.length-1,values:Ht(l)}:void 0,w=sn;sn=!1;const I=qs;if(I>0&&await new Promise(A=>setTimeout(A,I)),w)throw new Error("fixture: simulated history transport failure");return P(c,{...h,...v===void 0?{}:{projections:v}})},"history"),models:r(c=>P(c,{current:s.get(c.payload.sessionId)??{provider:"deepseek-official",model:"deepseek-v4-flash"},routable:!0,groups:Vt(),failures:[]}),"models"),selectModel:r(c=>{const l={provider:c.payload.provider,model:c.payload.model,...c.payload.reasoningEffort===void 0?{}:{reasoningEffort:c.payload.reasoningEffort}};return s.set(c.payload.sessionId,l),P(c,{selected:l})},"selectModel"),prompt:r(c=>{const{sessionId:l,mode:h,content:v}=c.payload,w=ke(l);if(w===void 0)return C(c,{code:"session-not-found",message:`no session ${l}`,details:{sessionId:l}});if(e.rejectPrompt)return C(c,{code:"agent-busy",message:"fixture: prompt rejected before acceptance",details:{reason:"fixture-prompt-rejection"}});w.updatedAt=Date.now(),w.blank=!1;const I=v.map(Z=>Z.type==="text"?Z.text:"").join(""),A=v.map(Z=>{if(Z.type==="text")return Z;const L={attachmentId:`fixture:${Ut()}`,mediaType:Z.mediaType,bytes:Math.max(1,Math.floor(Z.data.length*3/4)-(Z.data.endsWith("==")?2:Z.data.endsWith("=")?1:0)),width:160,height:90,...Z.name===void 0?{}:{name:Z.name}};return o.set(String(L.attachmentId),{attachment:L,data:Z.data}),{type:"image",attachment:L}});if(h==="steer"&&Ge.has(l))return O(l,{type:"user/message",surfaceOp:"append",data:ie(A)}),P(c,{accepted:!0});const M=f.get(l)??0;f.set(l,M+1),be(l,!0),O(l,{type:"turn/start",data:{turn:M}});const $=Bt(q(l));$.wanted!==null&&$.wanted!==$.active&&O(l,{type:"plan/mode",data:{active:$.wanted}}),O(l,{type:"user/message",surfaceOp:"append",data:ie(A)});const j=s.get(l)??{provider:"deepseek",model:"deepseek-v4-flash"};return Vs(q(l))?.model!==j.model&&O(l,{type:"request/context",data:{provider:j.provider,model:j.model,contextWindow:128e3}}),ad(l,M,I==="render markdown"?Es:I==="report model"?(()=>{const Z=s.get(l);return`当前模型:${Z?.provider??"unknown"}/${Z?.model??"unknown"}`+(Z?.reasoningEffort===void 0?"":` · 推理等级:${Z.reasoningEffort}`)})():`回声:${I}。这是 fixture 的流式回复,用于验证打字机增长与定稿切换。`),P(c,{accepted:!0})},"prompt"),attachment:r(c=>{const l=o.get(String(c.payload.attachmentId));return l===void 0?C(c,{code:"attachment-error",message:"fixture attachment missing",details:{reason:"ATTACHMENT_NOT_FOUND"}}):Cl(n.get(c.payload.sessionId)??[],String(c.payload.attachmentId))?P(c,l):C(c,{code:"attachment-error",message:"fixture attachment is not referenced by this session",details:{reason:"ATTACHMENT_NOT_REFERENCED"}})},"attachment"),updateQueue:r(c=>C(c,{code:"queue-item-not-found",message:"fixture has no pending queue item",details:{itemId:c.payload.itemId}}),"updateQueue"),cancel:r(c=>{const l=Ge.get(c.payload.sessionId);return l!==void 0?(clearTimeout(l.timer),l.finish(!0)):be(c.payload.sessionId,!1),P(c,{accepted:!0})},"cancel")},subagents:{list:r(c=>P(c,{entries:[],parentAvailable:!0}),"list"),history:r(c=>{const l=n.get(c.payload.childSessionId)??[];return Promise.resolve(P(c,Bs(l,c.payload.beforeSeq,c.payload.maxMessages??50)))},"history"),prompt:r(c=>Promise.resolve(P(c,{messageId:`fixture-message-${c.payload.childSessionId}`})),"prompt"),interrupt:r(c=>Promise.resolve(P(c,{accepted:!0})),"interrupt")},host:{describe:r(c=>P(c,{version:"0.0.0-fixture",cwd:"/tmp/fixture",attachedSessions:_,canOpenPath:!0}),"describe"),pickDirectory:r(c=>P(c,{path:`${Se}/Documents/project`}),"pickDirectory"),listDirectory:r(c=>{const l=c.payload.path??Se,h=F(l);return h===void 0?C(c,{code:"directory-unreadable",message:`cannot list ${l}: not in the fixture tree`,details:{path:l}}):P(c,{path:l,home:Se,crumbs:Q(l),entries:[...h].sort((v,w)=>v.localeCompare(w)).map(v=>({name:v,path:l==="/"?`/${v}`:`${l}/${v}`,hidden:v.startsWith(".")})),truncated:!1})},"listDirectory"),createDirectory:r(c=>{const l=c.payload.path,h=F(l);if(h===void 0)return C(c,{code:"directory-create-failed",message:`missing parent ${l}`,details:{path:l}});const v=l==="/"?`/${c.payload.name}`:`${l}/${c.payload.name}`;return h.includes(c.payload.name)?C(c,{code:"directory-exists",message:`${v} already exists`,details:{path:v}}):(te.set(l,[...h,c.payload.name]),te.set(v,[]),P(c,{path:v}))},"createDirectory"),openPath:r(c=>P(c,{opened:!0}),"openPath")},workspace:{list:r(c=>P(c,{items:E.map(l=>({...l})),archivedSessionIds:[...ce]}),"list"),create:r(c=>{const{path:l}=c.payload,h=E.find(I=>I.path===l);if(h!==void 0)return P(c,{workspace:{...h},created:!1});const v=new Date().toISOString(),w={workspaceId:b(`fx-ws-${D++}`),path:l,title:l.split("/").filter(Boolean).at(-1)??l,sessionIds:[],createdAt:v,updatedAt:v};return E.unshift(w),ue({type:"host/workspace-changed",workspace:{...w}}),P(c,{workspace:{...w},created:!0})},"create"),rename:r(c=>{const{workspaceId:l,title:h}=c.payload,v=E.find(I=>I.workspaceId===l);if(v===void 0)return C(c,{code:"workspace-not-found",message:`no workspace ${l}`,details:{workspaceId:l}});const w=h.trim();if(w!==v.title){if(E.some(I=>I.workspaceId!==l&&I.title===w))return C(c,{code:"workspace-name-conflict",message:`workspace name '${w}' is already in use`,details:{name:w}});v.title=w,v.updatedAt=new Date().toISOString(),ue({type:"host/workspace-changed",workspace:{...v}})}return P(c,{workspace:{...v}})},"rename"),delete:r(c=>{const{workspaceId:l}=c.payload,h=E.findIndex(v=>v.workspaceId===l);return h===-1?C(c,{code:"workspace-not-found",message:`no workspace ${l}`,details:{workspaceId:l}}):(E.splice(h,1),ue({type:"host/workspace-removed",workspaceId:l}),P(c,{deleted:!0}))},"delete"),insertBefore:r(c=>{const{workspaceId:l,beforeWorkspaceId:h}=c.payload,v=E.findIndex(A=>A.workspaceId===l),w=h===void 0?E.length:E.findIndex(A=>A.workspaceId===h),I=v===-1?l:w===-1?h:void 0;if(I!==void 0)return C(c,{code:"workspace-not-found",message:`no workspace ${I}`,details:{workspaceId:I}});if(h!==l){const A=E.map(j=>j.workspaceId),[M]=E.splice(v,1);if(M===void 0)throw new Error(`fixture lost workspace ${l}`);const $=h===void 0?E.length:E.findIndex(j=>j.workspaceId===h);E.splice($,0,M),E.some((j,Z)=>j.workspaceId!==A[Z])&&ue({type:"host/workspace-order-changed",workspaceIds:E.map(j=>j.workspaceId)})}return P(c,{workspaceIds:E.map(A=>A.workspaceId)})},"insertBefore"),insertSessionBefore:r(c=>{const{workspaceId:l,sessionId:h,beforeSessionId:v}=c.payload,w=E.find($=>$.workspaceId===l);if(w===void 0)return C(c,{code:"workspace-not-found",message:`no workspace ${l}`,details:{workspaceId:l}});if(!w.sessionIds.includes(h)||v!==void 0&&!w.sessionIds.includes(v))return C(c,{code:"workspace-move-invalid",message:`session or anchor is not accounted by workspace ${l}`,details:{workspaceId:l,sessionId:h,...v===void 0?{}:{beforeSessionId:v}}});const I=w.sessionIds.filter($=>$!==h),A=v===void 0?I.length:I.indexOf(v),M=[...I.slice(0,A),h,...I.slice(A)];return M.every(($,j)=>$===w.sessionIds[j])||(w.sessionIds=M,w.updatedAt=new Date().toISOString(),ue({type:"host/workspace-changed",workspace:{...w}})),P(c,{workspace:{...w}})},"insertSessionBefore"),archiveSession:r(c=>{const l=en(c);if(l!==void 0)return l;const{sessionId:h}=c.payload;return ce.includes(h)||(ce.push(h),ue({type:"host/archived-sessions-changed",archivedSessionIds:[...ce]})),P(c,{archivedSessionIds:[...ce]})},"archiveSession")},agentPresets:{list:r(c=>P(c,{presets:[...i].map(([l,h])=>({id:l,trust:h.trust,isDefault:l===u})),authorable:!0,hasDocument:!0}),"list"),select:r(c=>(u=c.payload.agentPreset,P(c,{agentPreset:c.payload.agentPreset})),"select"),read:r(c=>{const{agentPreset:l}=c.payload,h=i.get(l);return h===void 0?C(c,{code:"agent-preset-not-found",message:`unknown agent preset "${l}"`,details:{agentPreset:l,available:[...i.keys()]}}):P(c,{agentPreset:l,trust:h.trust,content:h.content})},"read"),copy:r(c=>{const{from:l,agentPreset:h}=c.payload,v=i.get(l);return v===void 0?C(c,{code:"agent-preset-not-found",message:`unknown agent preset "${l}"`,details:{agentPreset:l,available:[...i.keys()]}}):i.has(h)?C(c,{code:"agent-preset-invalid",message:`agent preset "${h}" already exists`,details:{agentPreset:h,reason:"already exists"}}):(i.set(h,{trust:"user",content:v.content}),P(c,{agentPreset:h}))},"copy"),openDocument:r(c=>{const{agentPreset:l}=c.payload,h=i.get(l);return h===void 0||h.trust==="system"?C(c,{code:"agent-preset-read-only",message:`agent preset "${l}" ships with the deployment`,details:{agentPreset:l,reason:"it ships with the deployment"}}):P(c,{opened:!0})},"openDocument"),remove:r(c=>{const{agentPreset:l}=c.payload;return i.get(l)?.trust==="system"?C(c,{code:"agent-preset-read-only",message:`agent preset "${l}" ships with the deployment`,details:{agentPreset:l,reason:"it ships with the deployment"}}):(i.delete(l),P(c,{}))},"remove")},skills:{list:r(c=>{const l=en(c);return l!==void 0?l:P(c,{skills:[{name:"fixture-demo",description:"fixture 技能样本",whenToUse:"仅供 UI 目录渲染验收",modelInvocable:!0},{name:"fixture-user-only",description:"fixture 仅用户技能样本",modelInvocable:!1}]})},"list")},goals:{create:r(c=>Ze(c,nn(ae.create(c.payload.sessionId,{objective:c.payload.objective,...c.payload.maxGoalRounds===void 0?{}:{maxGoalRounds:c.payload.maxGoalRounds}}),l=>({ref:{id:l.ref.id,revision:l.ref.revision}}))),"create"),edit:r(c=>Ze(c,gt(ae.edit(c.payload.sessionId,c.payload.ref,{...c.payload.objective===void 0?{}:{objective:c.payload.objective},...c.payload.maxGoalRounds===void 0?{}:{maxGoalRounds:c.payload.maxGoalRounds}}))),"edit"),pause:r(c=>Ze(c,gt(ae.pause(c.payload.sessionId,c.payload.ref))),"pause"),resume:r(c=>Ze(c,gt(ae.resume(c.payload.sessionId,c.payload.ref))),"resume"),complete:r(c=>Ze(c,gt(ae.complete(c.payload.sessionId,c.payload.ref))),"complete"),clear:r(c=>Ze(c,nn(ae.clear(c.payload.sessionId,c.payload.ref),()=>({cleared:!0}))),"clear")},events:{async*mux(c,l){const h=new Ks;Qt.add(h);const v=r(()=>{h.breakNow()},"breakNow");We.add(v);for(const w of t){if(!w.running)continue;const I=n.get(w.sessionId)??[];h.push({rpcId:ge(),payload:{type:"session/subscribed",sessionId:w.sessionId,lastSeq:I.length-1}});const A=Ht(I);for(const M of Object.keys(A))h.push({rpcId:ge(),payload:{type:"session/projection",sessionId:w.sessionId,key:M,value:A[M],seq:I.length-1}})}Kt&&h.push({rpcId:Be,payload:{type:"approval/requested",sessionId:"fx-alpha",approvalId:Je,toolName:"dangerous_tool",reason:"fixture 常驻审批(可答:批准/拒绝后消失)"}}),Xt&&h.push({rpcId:Yt,payload:{type:"question/requested",sessionId:"fx-alpha",questions:od}});try{yield*h.drain(l)}finally{We.delete(v),Qt.delete(h)}},async*host(c,l){const h=new Ks;qt.add(h);const v=r(()=>{h.breakNow()},"breakNow");We.add(v);const w=setInterval(()=>{const I=ke("fx-gamma");I!==void 0&&be(I.sessionId,!I.running)},5e3);try{yield*h.drain(l)}finally{clearInterval(w),We.delete(v),qt.delete(h)}}},settings:{describe:r(c=>P(c,{writable:!0,hasDocument:!0,namespaces:[{ns:"llm-deepseek",schema:{},value:{apiKeyEnv:"DEEPSEEK_API_KEY"},applies:"live",secrets:[{path:["apiKey"],set:!1}],revision:0}]}),"describe"),openDocument:r(c=>P(c,{opened:!0}),"openDocument"),update:r(c=>C(c,{code:"settings-rejected",message:"fixture: the minimal readiness settings descriptor is read-only",details:{ns:c.payload.ns}}),"update"),replace:r(c=>C(c,{code:"settings-rejected",message:"fixture: the minimal readiness settings descriptor is read-only",details:{ns:c.payload.ns}}),"replace"),mutate:r(c=>C(c,{code:"settings-rejected",message:"fixture: no settings namespaces are registered",details:{ns:c.payload.ns}}),"mutate")},credentials:{describe:r(c=>P(c,{credentials:Object.fromEntries(c.payload.refs.map(l=>[l,{configured:a.has(l),...a.has(l)?{source:"file"}:{},writable:!0}]))}),"describe"),set:r(c=>(a.set(c.payload.ref,!0),P(c,{})),"set"),unset:r(c=>(a.delete(c.payload.ref),P(c,{})),"unset")},llm:{providers:r(c=>P(c,{providers:[{provider:"deepseek-official",displayName:"DeepSeek",settingsNs:"llm-deepseek",settingsPath:[],active:!0},{provider:"openai",displayName:"openai",settingsNs:"llm-pi-ai",settingsPath:["providers","openai"],active:!0,declared:!1},{provider:"anthropic",displayName:"anthropic",settingsNs:"llm-pi-ai",settingsPath:["providers","anthropic"],active:!1,declared:!1},{provider:"acme-gateway",displayName:"Acme Gateway",settingsNs:"llm-pi-ai",settingsPath:["providers","acme-gateway"],active:!0,declared:!0}]}),"providers"),models:r(c=>P(c,{groups:Vt(),failures:[]}),"models"),discoverModels:r(c=>P(c,{models:Vt().flatMap(l=>l.models.map(h=>({id:h.id,name:h.name})))}),"discoverModels")},respond(c){if(c.rpcId===Be){if(!Kt)return Promise.resolve({accepted:!1,reason:"not-pending"});if(!c.result.ok)return Promise.resolve({accepted:!1,reason:"bad-response"});const l=c.result.value;return l.approvalId!==Je||l.outcome!=="allowed-once"&&l.outcome!=="rejected"?Promise.resolve({accepted:!1,reason:"bad-response"}):(Kt=!1,pt({type:"approval/resolved",sessionId:"fx-alpha",approvalId:Je,outcome:l.outcome}),Promise.resolve({accepted:!0}))}return!Xt||c.rpcId!==Yt?Promise.resolve({accepted:!1,reason:"not-pending"}):(Xt=!1,pt({type:"question/resolved",sessionId:"fx-alpha",questionRpcId:Yt,outcome:c.result.ok?"answered":"cancelled"}),Promise.resolve({accepted:!0}))},downloads:{sessionLog:r(()=>Promise.resolve(new Response("fixture mode does not serve session export",{status:404})),"sessionLog")}},rpc:{call(c,l,h){if(c!=="/api")return Promise.reject(new Error(`fixture connection RPC channel ${JSON.stringify(c)} is unavailable`));const v=h.args,w=v.agentId;switch(l){case"commands/list":return Promise.resolve(Xs.list(w));case"commands/execute":return Promise.resolve(Xs.execute(w,v.line));case"goals/create":return Promise.resolve(ae.create(w,{objective:v.request?.objective,...v.request?.maxGoalRounds===void 0?{}:{maxGoalRounds:v.request.maxGoalRounds}}));case"goals/edit":return Promise.resolve(ae.edit(w,v.ref,v.request??{}));case"goals/pause":return Promise.resolve(ae.pause(w,v.ref));case"goals/resume":return Promise.resolve(ae.resume(w,v.ref));case"goals/complete":return Promise.resolve(ae.complete(w,v.ref));case"goals/clear":return Promise.resolve(ae.clear(w,v.ref));default:return Promise.reject(new Error(`fixture connection RPC endpoint ${JSON.stringify(l)} is unavailable`))}}}}}r(Vl,"createFixtureWorld");var Bl=class extends Ct{static{r(this,"FixtureApiClient")}api;rpc;constructor(){super();const e=Vl(Jl());this.api=e.api,this.rpc=e.rpc}doFetch(){throw new Error("FixtureApiClient overrides all protocol paths; doFetch must be unreachable")}async callUnary(e,t,n){const s=Lt(t),o={type:"client-request",rpcId:s.rpcId,method:e,payload:t};this.onEnvelope(o);const a=await this.dispatch(e,s,n??new AbortController().signal),i={type:"server-response",rpcId:a.rpcId,result:a.result};return this.onEnvelope(i),a}dispatch(e,t,n){switch(e){case"session.list":return this.api.sessions.list(t);case"session.search":return this.api.sessions.search(t,n);case"session.create":return this.api.sessions.create(t);case"session.history":return this.api.sessions.history(t);case"session.models":return this.api.sessions.models(t);case"session.selectModel":return this.api.sessions.selectModel(t);case"session.rename":return this.api.sessions.rename(t);case"session.fork":return this.api.sessions.fork(t);case"session.prompt":return this.api.sessions.prompt(t);case"session.attachment":return this.api.sessions.attachment(t);case"session.updateQueue":return this.api.sessions.updateQueue(t);case"session.cancel":return this.api.sessions.cancel(t);case"subagent.list":return this.api.subagents.list(t);case"subagent.history":return this.api.subagents.history(t);case"subagent.prompt":return this.api.subagents.prompt(t,n);case"subagent.interrupt":return this.api.subagents.interrupt(t);case"host.describe":return this.api.host.describe(t);case"host.pickDirectory":return this.api.host.pickDirectory(t,new AbortController().signal);case"host.listDirectory":return this.api.host.listDirectory(t,new AbortController().signal);case"host.createDirectory":return this.api.host.createDirectory(t);case"host.openPath":return this.api.host.openPath(t,new AbortController().signal);case"workspace.list":return this.api.workspace.list(t);case"workspace.create":return this.api.workspace.create(t);case"workspace.rename":return this.api.workspace.rename(t);case"workspace.delete":return this.api.workspace.delete(t);case"workspace.insertBefore":return this.api.workspace.insertBefore(t);case"workspace.insertSessionBefore":return this.api.workspace.insertSessionBefore(t);case"workspace.archiveSession":return this.api.workspace.archiveSession(t);case"skill.list":return this.api.skills.list(t);case"agentPreset.list":return this.api.agentPresets.list(t);case"agentPreset.select":return this.api.agentPresets.select(t);case"agentPreset.read":return this.api.agentPresets.read(t);case"agentPreset.copy":return this.api.agentPresets.copy(t);case"agentPreset.openDocument":return this.api.agentPresets.openDocument(t,new AbortController().signal);case"agentPreset.remove":return this.api.agentPresets.remove(t);case"goal.create":return this.api.goals.create(t);case"goal.edit":return this.api.goals.edit(t);case"goal.pause":return this.api.goals.pause(t);case"goal.resume":return this.api.goals.resume(t);case"goal.complete":return this.api.goals.complete(t);case"goal.clear":return this.api.goals.clear(t);case"settings.describe":return this.api.settings.describe(t);case"settings.openDocument":return this.api.settings.openDocument(t,n);case"settings.update":return this.api.settings.update(t);case"settings.replace":return this.api.settings.replace(t);case"settings.mutate":return this.api.settings.mutate(t);case"credentials.describe":return this.api.credentials.describe(t);case"credentials.set":return this.api.credentials.set(t);case"credentials.unset":return this.api.credentials.unset(t);case"llm.providers":return this.api.llm.providers(t);case"llm.models":return this.api.llm.models(t);case"llm.discoverModels":return this.api.llm.discoverModels(t,n)}}openMux(e,t,n){return this.tapStream(this.api.events.mux(Lt(e),t),n)}openHost(e,t,n){return this.tapStream(this.api.events.host(Lt(e),t),n)}async*tapStream(e,t){t?.();for await(const n of e){const s={type:"server-request",rpcId:n.rpcId,method:n.payload.type,payload:n.payload};this.onEnvelope(s),yield n}}async respond(e){return this.onEnvelope(e),this.api.respond(e)}};function Jl(){if(typeof location>"u")return{};const e=new URLSearchParams(location.search);return{empty:e.get("fixture")==="empty",rejectPrompt:e.get("fixturePrompt")==="reject",failWorkspaceAttach:e.get("fixtureAttach")==="fail",dropSessionCreateResponse:e.get("fixtureSessionCreate")==="drop-response",createFrameOrder:e.get("fixtureFrames")==="workspace-first"?"workspace-first":"session-first"}}r(Jl,"fixtureOptionsFromLocation");const Ys="/api",Gl=`${Ys}/events.mux`,Wl=`${Ys}/events.host`;var Hl=class extends Ct{static{r(this,"WebApiClient")}doFetch(e,t){return globalThis.fetch(e,t)}openMux(e,t,n){return this.readWebSocket(Gl,t,Is,n)}openHost(e,t,n){return this.readWebSocket(Wl,t,xs,n)}async*readWebSocket(e,t,n,s){const o=new URL(e,this.resolveBase());o.protocol=o.protocol==="https:"?"wss:":"ws:";const a=new WebSocket(o),i=[];let u;const f=r(S=>{i.push(S),u?.(),u=void 0},"enqueue"),m=r(()=>{s?.()},"handleOpen"),k=r(S=>{let E,D;try{if(typeof S.data!="string")throw new Error("binary WebSocket frame");E=Zt.parse(JSON.parse(S.data)),D=n.parse(E.payload)}catch(ce){console.error(`[client-connection] dropping malformed WebSocket frame on ${e}:`,ce);return}this.onEnvelope(E),f({kind:"frame",envelope:{rpcId:E.rpcId,payload:D}})},"handleMessage"),_=r(()=>{f({kind:"end"})},"handleClose"),b=r(()=>{(a.readyState===WebSocket.CONNECTING||a.readyState===WebSocket.OPEN)&&a.close()},"handleAbort");a.addEventListener("open",m),a.addEventListener("message",k),a.addEventListener("close",_,{once:!0}),t.addEventListener("abort",b,{once:!0}),t.aborted&&b();try{for(;;){for(;i.length>0;){const S=i.shift();if(S.kind==="end")return;yield S.envelope}await new Promise(S=>{u=S})}}finally{t.removeEventListener("abort",b),a.removeEventListener("open",m),a.removeEventListener("message",k),a.removeEventListener("close",_),b()}}};const Kl="http://dsh.internal",Yl=/^\/[A-Za-z0-9._~-]+$/,Xl=/^[A-Za-z0-9_$.-]+$/;function Ql(){return{async call(e,t,n,s){ed(e,t);const o=Ut(),a={type:"client-request",rpcId:o,method:t,payload:n},i=await globalThis.fetch(new URL(`${e}/${t}`,ql()),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a),...s===void 0?{}:{signal:s}});if(!i.ok)throw new Error(`transport failure for ${e}/${t}: HTTP ${i.status}`);const u=Rt.parse(await i.json());if(u.rpcId!==o)throw new Error(`rpcId mismatch for ${t}: sent ${o}, got ${u.rpcId}`);return u.result}}}r(Ql,"createWebConnectionRpc");function ql(){const e=globalThis.location;return e?.origin!==void 0&&e.origin!=="null"?e.origin:Kl}r(ql,"resolveBase");function ed(e,t){const n=t.split("/");if(!Yl.test(e)||n.some(s=>s===""||s==="."||s===".."||!Xl.test(s)))throw new Error(`connection: invalid RPC target ${JSON.stringify(`${e}/${t}`)}`)}r(ed,"assertTarget");function td(e){if(e==="localhost"||e==="[::1]")return!0;const t=e.split(".");return t.length===4&&t[0]==="127"&&t.every(n=>/^\d{1,3}$/.test(n)&&Number(n)<=255)}r(td,"isLoopbackHostname");const nd=[];function sd(e){const t=typeof location>"u"?void 0:location,n=t!==void 0&&new URLSearchParams(t.search).has("fixture")?new Bl:void 0,s=n??new Hl,o=n?.rpc??Ql();let a=!1,i;const u=new Set,f=r(k=>{if(!Object.is(i,k)){i=k;for(const _ of[...u])try{_()}catch(b){console.error("[web-runtime] host-description listener threw:",b)}}},"publishDescription"),m={api:s,isLoopback:t===void 0||td(t.hostname),hostDescription:{getSnapshot:r(()=>i,"getSnapshot"),subscribe:r(k=>(u.add(k),()=>{u.delete(k)}),"subscribe")},rpc:o,start(k,_){if(a)throw new Error("connection: the stream loop is already owned by another consumer");a=!0;const b=new to(s,{...k,onConnected:r(S=>{f(S),Object.is(i,S)&&k.onConnected?.(S)},"onConnected"),onStateChange:r(S=>{S==="reconnecting"&&f(void 0),k.onStateChange?.(S)},"onStateChange")},_??{});return b.start(),{stop:r(()=>{b.stop(),f(void 0)},"stop")}}};e.provide("connection",m)}return r(sd,"apply"),Ie.AbstractApiClient=Ct,Ie.RpcId=wo,Ie.apply=sd,Ie.inject=nd,Ie.transportError=ko,He.exports},"factory")});
|
|
91
|
+
`:"推理";O(w,{type:"assistant/chunk",data:{turn:z,step:0,chunk:{type:"reasoning-delta",index:0,text:yt}}})}$.emitted=oe,oe<l?setTimeout(Z,v):$.emitting=!1},"pump");return setTimeout(Z,0),M},reasoningChunkStormState(){return vt===null?null:{...vt}},beginModelRetry(c){const l=c,h=f.get(l)??0;f.set(l,h+1),Ne.set(l,{turn:h,stepStarted:!0}),be(l,!0),O(l,{type:"turn/start",data:{turn:h}}),O(l,{type:"user/message",surfaceOp:"append",data:{content:Y("请重试这个请求"),source:{kind:"user"}}}),O(l,{type:"step/start",data:{turn:h,step:1}}),O(l,{type:"assistant/chunk",data:{turn:h,step:1,chunk:{type:"block-start",index:0,blockType:"text"}}}),O(l,{type:"assistant/chunk",data:{turn:h,step:1,chunk:{type:"text-delta",index:0,text:"应撤回的半截回复"}}})},scheduleModelRetry(c,l=1,h=450){const v=c,w=Ne.get(v);if(w===void 0)throw new Error(`fixture: no model retry scenario for ${c}`);w.stepStarted||(O(v,{type:"assistant/chunk",data:{turn:w.turn,step:1,chunk:{type:"block-start",index:0,blockType:"text"}}}),O(v,{type:"assistant/chunk",data:{turn:w.turn,step:1,chunk:{type:"text-delta",index:0,text:`第 ${String(l)} 次应撤回的回复`}}}),w.stepStarted=!0),O(v,{type:"llm/retry",data:{turn:w.turn,step:1,provider:"fixture",mode:"normal",policyKey:"fixture-normal",retry:l,maxRetries:2,delayMs:h,failure:{code:"TRANSPORT",message:"连接被重置"}}}),w.stepStarted=!1},cancelModelRetryDuringBackoff(c,l=450){const h=c,v=Ne.get(h);if(v===void 0)throw new Error(`fixture: no model retry scenario for ${c}`);O(h,{type:"llm/retry",data:{turn:v.turn,step:1,provider:"fixture",mode:"normal",policyKey:"fixture-normal",retry:1,maxRetries:2,delayMs:l,failure:{code:"TRANSPORT",message:"连接被重置"}}}),O(h,{type:"step/end",data:{turn:v.turn,step:1}}),O(h,{type:"turn/end",data:{turn:v.turn,reason:{kind:"aborted",reason:{kind:"user"}}}}),Ne.delete(h),be(h,!1)},completeModelRetry(c){const l=c,h=Ne.get(l);if(h===void 0)throw new Error(`fixture: no model retry scenario for ${c}`);Ne.delete(l),O(l,{type:"assistant/chunk",data:{turn:h.turn,step:1,chunk:{type:"block-start",index:0,blockType:"text"}}}),O(l,{type:"assistant/message",surfaceOp:"append",data:{turn:h.turn,step:1,message:me(Y("重试后的完整回复"))}}),O(l,{type:"step/end",data:{turn:h.turn,step:1}}),O(l,{type:"turn/end",data:{turn:h.turn,reason:{kind:"completed"}}}),be(l,!1)},appendSilent(c,l){const h=q(c);h.push({type:"user/message",surfaceOp:"append",seq:h.length,time:Date.now(),data:ie(Y(l))})},breakStreams(){for(const c of[...We])c()}};const ad=r((c,l,h)=>{O(c,{type:"step/start",data:{turn:l,step:0}}),O(c,{type:"assistant/chunk",data:{turn:l,step:0,chunk:{type:"block-start",index:0,blockType:"text"}}});const w=h.match(/[\s\S]{1,6}/gu)??[h];let I=0;const z=r($=>{Ge.delete(c);const j=w.slice(0,I).join("");O(c,{type:"assistant/chunk",data:{turn:l,step:0,chunk:{type:"block-end",index:0,block:{type:"text",text:j}}}}),O(c,{type:"assistant/message",surfaceOp:"append",data:{turn:l,step:0,message:me(Y($?`${j}(已中断)`:j)),usage:Zs(l,0)}}),O(c,{type:"step/end",data:{turn:l,step:0}}),O(c,{type:"turn/end",data:{turn:l,reason:{kind:$?"cancelled":"completed"}}}),be(c,!1)},"finish"),M=r(()=>{const $=w[I];if($===void 0){z(!1);return}I++,O(c,{type:"assistant/chunk",data:{turn:l,step:0,chunk:{type:"text-delta",index:0,text:$}}}),Ge.set(c,{timer:setTimeout(M,80),finish:z})},"tick");Ge.set(c,{timer:setTimeout(M,80),finish:z})},"startReply");return{api:{sessions:{list:r(c=>P(c,{items:[...t].sort((l,h)=>h.updatedAt-l.updatedAt)}),"list"),search:r((c,l)=>{if(l.aborted)return C(c,{code:"cancelled",message:"fixture session search was aborted",details:{}});const h=Gs(c.payload.query).tokens.map(w=>w.value),v=t.flatMap(w=>{const I=n.get(w.sessionId)??[],z=new Set(ln(I).nodes),M=I.flatMap($=>{if(!z.has($.seq))return[];const j=Ul($),Z=Gs(j),L=Ll(Z.tokens,h);return L.count===0?[]:[{sessionId:w.sessionId,seq:$.seq,time:$.time,text:Z.text,matchCount:L.count,matchStart:L.start,matchEnd:L.end,documentLength:Array.from(j).length}]}).sort(Ws)[0];return M===void 0?[]:[M]}).sort(Ws);return P(c,{items:v.slice(0,20).map(w=>({sessionId:w.sessionId,snippet:Fl(w.text,w.matchStart,w.matchEnd)})),hasMore:v.length>20})},"search"),create:r(async c=>{const l=c.payload.workspaceId===void 0?void 0:E.find($=>$.workspaceId===c.payload.workspaceId);if(c.payload.workspaceId!==void 0&&l===void 0)return C(c,{code:"workspace-not-found",message:`no workspace ${c.payload.workspaceId}`,details:{workspaceId:c.payload.workspaceId}});const h=l?.path??c.payload.cwd??"/tmp/fixture",v=c.payload.sessionId,w=r($=>{l===void 0||l.sessionIds.includes($)||(l.sessionIds=[$,...l.sessionIds],l.updatedAt=new Date().toISOString(),ue({type:"host/workspace-changed",workspace:{...l}}))},"attachWorkspace"),I=r(($,j)=>C(c,{code:"workspace-attach-failed",message:`fixture rejected Workspace attachment for ${$}`,details:{sessionId:$,workspaceId:j}}),"attachFailure");if(v!==void 0){const $=ke(v);if($!==void 0){if($.cwd!==h)return C(c,{code:"session-conflict",message:`session ${v} already uses ${$.cwd??"no cwd"}`,details:{sessionId:v,requestedCwd:h,...$.cwd===void 0?{}:{existingCwd:$.cwd}}});if(l!==void 0&&!l.sessionIds.includes(v)){if(e.failWorkspaceAttach)return I(v,l.workspaceId);w(v)}return P(c,{sessionId:v})}}const z={sessionId:v??`fx-${m++}`,updatedAt:Date.now(),running:!1,blank:!0,cwd:h};t.push(z),s.set(z.sessionId,{provider:"deepseek-official",model:"deepseek-v4-flash"}),_+=1;const M=r(()=>{ue({type:"host/session-added",sessionId:z.sessionId,blank:!0,cwd:h})},"emitSession");if(l!==void 0&&e.failWorkspaceAttach)return M(),I(z.sessionId,l.workspaceId);if(l!==void 0&&e.createFrameOrder==="workspace-first"?(w(z.sessionId),M()):(M(),l!==void 0&&w(z.sessionId)),e.dropSessionCreateResponse)throw new Error("fixture: dropped session.create response after publication");return P(c,{sessionId:z.sessionId})},"create"),rename:r(c=>{const l=en(c);if(l!==void 0)return l;const{sessionId:h,title:v}=c.payload,w=v.trim().replace(/\s+/g," ");return w.length===0?C(c,{code:"title-invalid",message:"session title must contain visible characters",details:{sessionId:h}}):(O(h,{type:"session/title",data:{title:w,messageSeqs:[],source:{kind:"user"}}}),P(c,{title:w,seq:q(h).at(-1).seq}))},"rename"),fork:r(c=>{const{sessionId:l,atSeq:h}=c.payload,v=ke(l);if(v===void 0)return C(c,{code:"session-not-found",message:`no session ${l}`,details:{sessionId:l}});const w=n.get(l)??[],I=w.at(-1)?.seq??-1,z=(h===void 0?void 0:w.find(Z=>Z.type==="turn/end"&&Z.seq>=h))??(h===void 0||h>I?w.findLast(Z=>Z.type==="turn/end"):void 0);if(z===void 0)return C(c,{code:"fork-unavailable",message:h!==void 0&&h<=I?`session ${l} has not completed the turn containing event ${String(h)}`:`session ${l} has no completed turn`,details:{sessionId:l}});let M=z.seq+1;for(;M<w.length&&w[M]?.type!=="turn/start";)M++;const $={sessionId:`fx-${m++}`,updatedAt:Date.now(),running:!1,blank:!1,parentSessionId:l,...v.cwd===void 0?{}:{cwd:v.cwd}};n.set($.sessionId,w.slice(0,M)),t.push($),ue({type:"host/session-added",sessionId:$.sessionId,blank:!1,parentSessionId:l,...v.cwd===void 0?{}:{cwd:v.cwd}});const j=E.find(Z=>Z.sessionIds.includes(l));return j!==void 0&&(j.sessionIds=[$.sessionId,...j.sessionIds],j.updatedAt=new Date().toISOString(),ue({type:"host/workspace-changed",workspace:{...j}})),P(c,{sessionId:$.sessionId})},"fork"),history:r(async c=>{const l=n.get(c.payload.sessionId)??[],h=Bs(l,c.payload.beforeSeq,c.payload.maxMessages??50),v=c.payload.beforeSeq===void 0?{asOfSeq:l.length-1,values:Ht(l)}:void 0,w=sn;sn=!1;const I=qs;if(I>0&&await new Promise(z=>setTimeout(z,I)),w)throw new Error("fixture: simulated history transport failure");return P(c,{...h,...v===void 0?{}:{projections:v}})},"history"),models:r(c=>P(c,{current:s.get(c.payload.sessionId)??{provider:"deepseek-official",model:"deepseek-v4-flash"},routable:!0,groups:Vt(),failures:[]}),"models"),selectModel:r(c=>{const l={provider:c.payload.provider,model:c.payload.model,...c.payload.reasoningEffort===void 0?{}:{reasoningEffort:c.payload.reasoningEffort}};return s.set(c.payload.sessionId,l),P(c,{selected:l})},"selectModel"),prompt:r(c=>{const{sessionId:l,mode:h,content:v}=c.payload,w=ke(l);if(w===void 0)return C(c,{code:"session-not-found",message:`no session ${l}`,details:{sessionId:l}});if(e.rejectPrompt)return C(c,{code:"agent-busy",message:"fixture: prompt rejected before acceptance",details:{reason:"fixture-prompt-rejection"}});w.updatedAt=Date.now(),w.blank=!1;const I=v.map(Z=>Z.type==="text"?Z.text:"").join(""),z=v.map(Z=>{if(Z.type==="text")return Z;const L={attachmentId:`fixture:${Ut()}`,mediaType:Z.mediaType,bytes:Math.max(1,Math.floor(Z.data.length*3/4)-(Z.data.endsWith("==")?2:Z.data.endsWith("=")?1:0)),width:160,height:90,...Z.name===void 0?{}:{name:Z.name}};return o.set(String(L.attachmentId),{attachment:L,data:Z.data}),{type:"image",attachment:L}});if(h==="steer"&&Ge.has(l))return O(l,{type:"user/message",surfaceOp:"append",data:ie(z)}),P(c,{accepted:!0});const M=f.get(l)??0;f.set(l,M+1),be(l,!0),O(l,{type:"turn/start",data:{turn:M}});const $=Bt(q(l));$.wanted!==null&&$.wanted!==$.active&&O(l,{type:"plan/mode",data:{active:$.wanted}}),O(l,{type:"user/message",surfaceOp:"append",data:ie(z)});const j=s.get(l)??{provider:"deepseek",model:"deepseek-v4-flash"};return Vs(q(l))?.model!==j.model&&O(l,{type:"request/context",data:{provider:j.provider,model:j.model,contextWindow:128e3}}),ad(l,M,I==="render markdown"?Es:I==="report model"?(()=>{const Z=s.get(l);return`当前模型:${Z?.provider??"unknown"}/${Z?.model??"unknown"}`+(Z?.reasoningEffort===void 0?"":` · 推理等级:${Z.reasoningEffort}`)})():`回声:${I}。这是 fixture 的流式回复,用于验证打字机增长与定稿切换。`),P(c,{accepted:!0})},"prompt"),attachment:r(c=>{const l=o.get(String(c.payload.attachmentId));return l===void 0?C(c,{code:"attachment-error",message:"fixture attachment missing",details:{reason:"ATTACHMENT_NOT_FOUND"}}):Cl(n.get(c.payload.sessionId)??[],String(c.payload.attachmentId))?P(c,l):C(c,{code:"attachment-error",message:"fixture attachment is not referenced by this session",details:{reason:"ATTACHMENT_NOT_REFERENCED"}})},"attachment"),updateQueue:r(c=>C(c,{code:"queue-item-not-found",message:"fixture has no pending queue item",details:{itemId:c.payload.itemId}}),"updateQueue"),cancel:r(c=>{const l=Ge.get(c.payload.sessionId);return l!==void 0?(clearTimeout(l.timer),l.finish(!0)):be(c.payload.sessionId,!1),P(c,{accepted:!0})},"cancel")},subagents:{list:r(c=>P(c,{entries:[],parentAvailable:!0}),"list"),history:r(c=>{const l=n.get(c.payload.childSessionId)??[];return Promise.resolve(P(c,Bs(l,c.payload.beforeSeq,c.payload.maxMessages??50)))},"history"),prompt:r(c=>Promise.resolve(P(c,{messageId:`fixture-message-${c.payload.childSessionId}`})),"prompt"),interrupt:r(c=>Promise.resolve(P(c,{accepted:!0})),"interrupt")},host:{describe:r(c=>P(c,{version:"0.0.0-fixture",cwd:"/tmp/fixture",attachedSessions:_,canOpenPath:!0}),"describe"),pickDirectory:r(c=>P(c,{path:`${Se}/Documents/project`}),"pickDirectory"),listDirectory:r(c=>{const l=c.payload.path??Se,h=F(l);return h===void 0?C(c,{code:"directory-unreadable",message:`cannot list ${l}: not in the fixture tree`,details:{path:l}}):P(c,{path:l,home:Se,crumbs:Q(l),entries:[...h].sort((v,w)=>v.localeCompare(w)).map(v=>({name:v,path:l==="/"?`/${v}`:`${l}/${v}`,hidden:v.startsWith(".")})),truncated:!1})},"listDirectory"),createDirectory:r(c=>{const l=c.payload.path,h=F(l);if(h===void 0)return C(c,{code:"directory-create-failed",message:`missing parent ${l}`,details:{path:l}});const v=l==="/"?`/${c.payload.name}`:`${l}/${c.payload.name}`;return h.includes(c.payload.name)?C(c,{code:"directory-exists",message:`${v} already exists`,details:{path:v}}):(te.set(l,[...h,c.payload.name]),te.set(v,[]),P(c,{path:v}))},"createDirectory"),openPath:r(c=>P(c,{opened:!0}),"openPath")},workspace:{list:r(c=>P(c,{items:E.map(l=>({...l})),archivedSessionIds:[...ce]}),"list"),create:r(c=>{const{path:l}=c.payload,h=E.find(I=>I.path===l);if(h!==void 0)return P(c,{workspace:{...h},created:!1});const v=new Date().toISOString(),w={workspaceId:b(`fx-ws-${D++}`),path:l,title:l.split("/").filter(Boolean).at(-1)??l,sessionIds:[],createdAt:v,updatedAt:v};return E.unshift(w),ue({type:"host/workspace-changed",workspace:{...w}}),P(c,{workspace:{...w},created:!0})},"create"),rename:r(c=>{const{workspaceId:l,title:h}=c.payload,v=E.find(I=>I.workspaceId===l);if(v===void 0)return C(c,{code:"workspace-not-found",message:`no workspace ${l}`,details:{workspaceId:l}});const w=h.trim();if(w!==v.title){if(E.some(I=>I.workspaceId!==l&&I.title===w))return C(c,{code:"workspace-name-conflict",message:`workspace name '${w}' is already in use`,details:{name:w}});v.title=w,v.updatedAt=new Date().toISOString(),ue({type:"host/workspace-changed",workspace:{...v}})}return P(c,{workspace:{...v}})},"rename"),delete:r(c=>{const{workspaceId:l}=c.payload,h=E.findIndex(v=>v.workspaceId===l);return h===-1?C(c,{code:"workspace-not-found",message:`no workspace ${l}`,details:{workspaceId:l}}):(E.splice(h,1),ue({type:"host/workspace-removed",workspaceId:l}),P(c,{deleted:!0}))},"delete"),insertBefore:r(c=>{const{workspaceId:l,beforeWorkspaceId:h}=c.payload,v=E.findIndex(z=>z.workspaceId===l),w=h===void 0?E.length:E.findIndex(z=>z.workspaceId===h),I=v===-1?l:w===-1?h:void 0;if(I!==void 0)return C(c,{code:"workspace-not-found",message:`no workspace ${I}`,details:{workspaceId:I}});if(h!==l){const z=E.map(j=>j.workspaceId),[M]=E.splice(v,1);if(M===void 0)throw new Error(`fixture lost workspace ${l}`);const $=h===void 0?E.length:E.findIndex(j=>j.workspaceId===h);E.splice($,0,M),E.some((j,Z)=>j.workspaceId!==z[Z])&&ue({type:"host/workspace-order-changed",workspaceIds:E.map(j=>j.workspaceId)})}return P(c,{workspaceIds:E.map(z=>z.workspaceId)})},"insertBefore"),insertSessionBefore:r(c=>{const{workspaceId:l,sessionId:h,beforeSessionId:v}=c.payload,w=E.find($=>$.workspaceId===l);if(w===void 0)return C(c,{code:"workspace-not-found",message:`no workspace ${l}`,details:{workspaceId:l}});if(!w.sessionIds.includes(h)||v!==void 0&&!w.sessionIds.includes(v))return C(c,{code:"workspace-move-invalid",message:`session or anchor is not accounted by workspace ${l}`,details:{workspaceId:l,sessionId:h,...v===void 0?{}:{beforeSessionId:v}}});const I=w.sessionIds.filter($=>$!==h),z=v===void 0?I.length:I.indexOf(v),M=[...I.slice(0,z),h,...I.slice(z)];return M.every(($,j)=>$===w.sessionIds[j])||(w.sessionIds=M,w.updatedAt=new Date().toISOString(),ue({type:"host/workspace-changed",workspace:{...w}})),P(c,{workspace:{...w}})},"insertSessionBefore"),archiveSession:r(c=>{const l=en(c);if(l!==void 0)return l;const{sessionId:h}=c.payload;return ce.includes(h)||(ce.push(h),ue({type:"host/archived-sessions-changed",archivedSessionIds:[...ce]})),P(c,{archivedSessionIds:[...ce]})},"archiveSession")},agentPresets:{list:r(c=>P(c,{presets:[...i].map(([l,h])=>({id:l,trust:h.trust,isDefault:l===u})),authorable:!0,hasDocument:!0}),"list"),select:r(c=>(u=c.payload.agentPreset,P(c,{agentPreset:c.payload.agentPreset})),"select"),read:r(c=>{const{agentPreset:l}=c.payload,h=i.get(l);return h===void 0?C(c,{code:"agent-preset-not-found",message:`unknown agent preset "${l}"`,details:{agentPreset:l,available:[...i.keys()]}}):P(c,{agentPreset:l,trust:h.trust,content:h.content})},"read"),copy:r(c=>{const{from:l,agentPreset:h}=c.payload,v=i.get(l);return v===void 0?C(c,{code:"agent-preset-not-found",message:`unknown agent preset "${l}"`,details:{agentPreset:l,available:[...i.keys()]}}):i.has(h)?C(c,{code:"agent-preset-invalid",message:`agent preset "${h}" already exists`,details:{agentPreset:h,reason:"already exists"}}):(i.set(h,{trust:"user",content:v.content}),P(c,{agentPreset:h}))},"copy"),openDocument:r(c=>{const{agentPreset:l}=c.payload,h=i.get(l);return h===void 0||h.trust==="system"?C(c,{code:"agent-preset-read-only",message:`agent preset "${l}" ships with the deployment`,details:{agentPreset:l,reason:"it ships with the deployment"}}):P(c,{opened:!0})},"openDocument"),remove:r(c=>{const{agentPreset:l}=c.payload;return i.get(l)?.trust==="system"?C(c,{code:"agent-preset-read-only",message:`agent preset "${l}" ships with the deployment`,details:{agentPreset:l,reason:"it ships with the deployment"}}):(i.delete(l),P(c,{}))},"remove")},skills:{list:r(c=>{const l=en(c);return l!==void 0?l:P(c,{skills:[{name:"fixture-demo",description:"fixture 技能样本",whenToUse:"仅供 UI 目录渲染验收",modelInvocable:!0},{name:"fixture-user-only",description:"fixture 仅用户技能样本",modelInvocable:!1}]})},"list")},goals:{create:r(c=>Ze(c,nn(ae.create(c.payload.sessionId,{objective:c.payload.objective,...c.payload.maxGoalRounds===void 0?{}:{maxGoalRounds:c.payload.maxGoalRounds}}),l=>({ref:{id:l.ref.id,revision:l.ref.revision}}))),"create"),edit:r(c=>Ze(c,gt(ae.edit(c.payload.sessionId,c.payload.ref,{...c.payload.objective===void 0?{}:{objective:c.payload.objective},...c.payload.maxGoalRounds===void 0?{}:{maxGoalRounds:c.payload.maxGoalRounds}}))),"edit"),pause:r(c=>Ze(c,gt(ae.pause(c.payload.sessionId,c.payload.ref))),"pause"),resume:r(c=>Ze(c,gt(ae.resume(c.payload.sessionId,c.payload.ref))),"resume"),complete:r(c=>Ze(c,gt(ae.complete(c.payload.sessionId,c.payload.ref))),"complete"),clear:r(c=>Ze(c,nn(ae.clear(c.payload.sessionId,c.payload.ref),()=>({cleared:!0}))),"clear")},events:{async*mux(c,l){const h=new Ks;Qt.add(h);const v=r(()=>{h.breakNow()},"breakNow");We.add(v);for(const w of t){if(!w.running)continue;const I=n.get(w.sessionId)??[];h.push({rpcId:ge(),payload:{type:"session/subscribed",sessionId:w.sessionId,lastSeq:I.length-1}});const z=Ht(I);for(const M of Object.keys(z))h.push({rpcId:ge(),payload:{type:"session/projection",sessionId:w.sessionId,key:M,value:z[M],seq:I.length-1}})}Kt&&h.push({rpcId:Be,payload:{type:"approval/requested",sessionId:"fx-alpha",approvalId:Je,toolName:"dangerous_tool",reason:"fixture 常驻审批(可答:批准/拒绝后消失)"}}),Xt&&h.push({rpcId:Yt,payload:{type:"question/requested",sessionId:"fx-alpha",questions:od}});try{yield*h.drain(l)}finally{We.delete(v),Qt.delete(h)}},async*host(c,l){const h=new Ks;qt.add(h);const v=r(()=>{h.breakNow()},"breakNow");We.add(v);const w=setInterval(()=>{const I=ke("fx-gamma");I!==void 0&&be(I.sessionId,!I.running)},5e3);try{yield*h.drain(l)}finally{clearInterval(w),We.delete(v),qt.delete(h)}}},settings:{describe:r(c=>P(c,{writable:!0,hasDocument:!0,namespaces:[{ns:"llm-deepseek",schema:{},value:{apiKeyEnv:"DEEPSEEK_API_KEY"},applies:"live",secrets:[{path:["apiKey"],set:!1}],revision:0}]}),"describe"),openDocument:r(c=>P(c,{opened:!0}),"openDocument"),update:r(c=>C(c,{code:"settings-rejected",message:"fixture: the minimal readiness settings descriptor is read-only",details:{ns:c.payload.ns}}),"update"),replace:r(c=>C(c,{code:"settings-rejected",message:"fixture: the minimal readiness settings descriptor is read-only",details:{ns:c.payload.ns}}),"replace"),mutate:r(c=>C(c,{code:"settings-rejected",message:"fixture: no settings namespaces are registered",details:{ns:c.payload.ns}}),"mutate")},credentials:{describe:r(c=>P(c,{credentials:Object.fromEntries(c.payload.refs.map(l=>[l,{configured:a.has(l),...a.has(l)?{source:"file"}:{},writable:!0}]))}),"describe"),set:r(c=>(a.set(c.payload.ref,!0),P(c,{})),"set"),unset:r(c=>(a.delete(c.payload.ref),P(c,{})),"unset")},llm:{providers:r(c=>P(c,{providers:[{provider:"deepseek-official",displayName:"DeepSeek",settingsNs:"llm-deepseek",settingsPath:[],active:!0},{provider:"openai",displayName:"openai",settingsNs:"llm-pi-ai",settingsPath:["providers","openai"],active:!0,declared:!1},{provider:"anthropic",displayName:"anthropic",settingsNs:"llm-pi-ai",settingsPath:["providers","anthropic"],active:!1,declared:!1},{provider:"acme-gateway",displayName:"Acme Gateway",settingsNs:"llm-pi-ai",settingsPath:["providers","acme-gateway"],active:!0,declared:!0}]}),"providers"),models:r(c=>P(c,{groups:Vt(),failures:[]}),"models"),discoverModels:r(c=>P(c,{models:Vt().flatMap(l=>l.models.map(h=>({id:h.id,name:h.name})))}),"discoverModels")},respond(c){if(c.rpcId===Be){if(!Kt)return Promise.resolve({accepted:!1,reason:"not-pending"});if(!c.result.ok)return Promise.resolve({accepted:!1,reason:"bad-response"});const l=c.result.value;return l.approvalId!==Je||l.outcome!=="allowed-once"&&l.outcome!=="rejected"?Promise.resolve({accepted:!1,reason:"bad-response"}):(Kt=!1,pt({type:"approval/resolved",sessionId:"fx-alpha",approvalId:Je,outcome:l.outcome}),Promise.resolve({accepted:!0}))}return!Xt||c.rpcId!==Yt?Promise.resolve({accepted:!1,reason:"not-pending"}):(Xt=!1,pt({type:"question/resolved",sessionId:"fx-alpha",questionRpcId:Yt,outcome:c.result.ok?"answered":"cancelled"}),Promise.resolve({accepted:!0}))},downloads:{sessionLog:r(()=>Promise.resolve(new Response("fixture mode does not serve session export",{status:404})),"sessionLog")}},rpc:{call(c,l,h){if(c!=="/api")return Promise.reject(new Error(`fixture connection RPC channel ${JSON.stringify(c)} is unavailable`));const v=h.args,w=v.agentId;switch(l){case"commands/list":return Promise.resolve(Xs.list(w));case"commands/execute":return Promise.resolve(Xs.execute(w,v.line));case"goals/create":return Promise.resolve(ae.create(w,{objective:v.request?.objective,...v.request?.maxGoalRounds===void 0?{}:{maxGoalRounds:v.request.maxGoalRounds}}));case"goals/edit":return Promise.resolve(ae.edit(w,v.ref,v.request??{}));case"goals/pause":return Promise.resolve(ae.pause(w,v.ref));case"goals/resume":return Promise.resolve(ae.resume(w,v.ref));case"goals/complete":return Promise.resolve(ae.complete(w,v.ref));case"goals/clear":return Promise.resolve(ae.clear(w,v.ref));default:return Promise.reject(new Error(`fixture connection RPC endpoint ${JSON.stringify(l)} is unavailable`))}}}}}r(Vl,"createFixtureWorld");var Bl=class extends Ct{static{r(this,"FixtureApiClient")}api;rpc;constructor(){super();const e=Vl(Jl());this.api=e.api,this.rpc=e.rpc}doFetch(){throw new Error("FixtureApiClient overrides all protocol paths; doFetch must be unreachable")}async callUnary(e,t,n){const s=Lt(t),o={type:"client-request",rpcId:s.rpcId,method:e,payload:t};this.onEnvelope(o);const a=await this.dispatch(e,s,n??new AbortController().signal),i={type:"server-response",rpcId:a.rpcId,result:a.result};return this.onEnvelope(i),a}dispatch(e,t,n){switch(e){case"session.list":return this.api.sessions.list(t);case"session.search":return this.api.sessions.search(t,n);case"session.create":return this.api.sessions.create(t);case"session.history":return this.api.sessions.history(t);case"session.models":return this.api.sessions.models(t);case"session.selectModel":return this.api.sessions.selectModel(t);case"session.rename":return this.api.sessions.rename(t);case"session.fork":return this.api.sessions.fork(t);case"session.prompt":return this.api.sessions.prompt(t);case"session.attachment":return this.api.sessions.attachment(t);case"session.updateQueue":return this.api.sessions.updateQueue(t);case"session.cancel":return this.api.sessions.cancel(t);case"subagent.list":return this.api.subagents.list(t);case"subagent.history":return this.api.subagents.history(t);case"subagent.prompt":return this.api.subagents.prompt(t,n);case"subagent.interrupt":return this.api.subagents.interrupt(t);case"host.describe":return this.api.host.describe(t);case"host.pickDirectory":return this.api.host.pickDirectory(t,new AbortController().signal);case"host.listDirectory":return this.api.host.listDirectory(t,new AbortController().signal);case"host.createDirectory":return this.api.host.createDirectory(t);case"host.openPath":return this.api.host.openPath(t,new AbortController().signal);case"workspace.list":return this.api.workspace.list(t);case"workspace.create":return this.api.workspace.create(t);case"workspace.rename":return this.api.workspace.rename(t);case"workspace.delete":return this.api.workspace.delete(t);case"workspace.insertBefore":return this.api.workspace.insertBefore(t);case"workspace.insertSessionBefore":return this.api.workspace.insertSessionBefore(t);case"workspace.archiveSession":return this.api.workspace.archiveSession(t);case"skill.list":return this.api.skills.list(t);case"agentPreset.list":return this.api.agentPresets.list(t);case"agentPreset.select":return this.api.agentPresets.select(t);case"agentPreset.read":return this.api.agentPresets.read(t);case"agentPreset.copy":return this.api.agentPresets.copy(t);case"agentPreset.openDocument":return this.api.agentPresets.openDocument(t,new AbortController().signal);case"agentPreset.remove":return this.api.agentPresets.remove(t);case"goal.create":return this.api.goals.create(t);case"goal.edit":return this.api.goals.edit(t);case"goal.pause":return this.api.goals.pause(t);case"goal.resume":return this.api.goals.resume(t);case"goal.complete":return this.api.goals.complete(t);case"goal.clear":return this.api.goals.clear(t);case"settings.describe":return this.api.settings.describe(t);case"settings.openDocument":return this.api.settings.openDocument(t,n);case"settings.update":return this.api.settings.update(t);case"settings.replace":return this.api.settings.replace(t);case"settings.mutate":return this.api.settings.mutate(t);case"credentials.describe":return this.api.credentials.describe(t);case"credentials.set":return this.api.credentials.set(t);case"credentials.unset":return this.api.credentials.unset(t);case"llm.providers":return this.api.llm.providers(t);case"llm.models":return this.api.llm.models(t);case"llm.discoverModels":return this.api.llm.discoverModels(t,n)}}openMux(e,t,n){return this.tapStream(this.api.events.mux(Lt(e),t),n)}openHost(e,t,n){return this.tapStream(this.api.events.host(Lt(e),t),n)}async*tapStream(e,t){t?.();for await(const n of e){const s={type:"server-request",rpcId:n.rpcId,method:n.payload.type,payload:n.payload};this.onEnvelope(s),yield n}}async respond(e){return this.onEnvelope(e),this.api.respond(e)}};function Jl(){if(typeof location>"u")return{};const e=new URLSearchParams(location.search);return{empty:e.get("fixture")==="empty",rejectPrompt:e.get("fixturePrompt")==="reject",failWorkspaceAttach:e.get("fixtureAttach")==="fail",dropSessionCreateResponse:e.get("fixtureSessionCreate")==="drop-response",createFrameOrder:e.get("fixtureFrames")==="workspace-first"?"workspace-first":"session-first"}}r(Jl,"fixtureOptionsFromLocation");const Ys="/api",Gl=`${Ys}/events.mux`,Wl=`${Ys}/events.host`;var Hl=class extends Ct{static{r(this,"WebApiClient")}doFetch(e,t){return globalThis.fetch(e,t)}openMux(e,t,n){return this.readWebSocket(Gl,t,Is,n)}openHost(e,t,n){return this.readWebSocket(Wl,t,xs,n)}async*readWebSocket(e,t,n,s){const o=new URL(e,this.resolveBase());o.protocol=o.protocol==="https:"?"wss:":"ws:";const a=new WebSocket(o),i=[];let u;const f=r(S=>{i.push(S),u?.(),u=void 0},"enqueue"),m=r(()=>{s?.()},"handleOpen"),k=r(S=>{let E,D;try{if(typeof S.data!="string")throw new Error("binary WebSocket frame");E=Zt.parse(JSON.parse(S.data)),D=n.parse(E.payload)}catch(ce){console.error(`[client-connection] dropping malformed WebSocket frame on ${e}:`,ce);return}this.onEnvelope(E),f({kind:"frame",envelope:{rpcId:E.rpcId,payload:D}})},"handleMessage"),_=r(()=>{f({kind:"end"})},"handleClose"),b=r(()=>{(a.readyState===WebSocket.CONNECTING||a.readyState===WebSocket.OPEN)&&a.close()},"handleAbort");a.addEventListener("open",m),a.addEventListener("message",k),a.addEventListener("close",_,{once:!0}),t.addEventListener("abort",b,{once:!0}),t.aborted&&b();try{for(;;){for(;i.length>0;){const S=i.shift();if(S.kind==="end")return;yield S.envelope}await new Promise(S=>{u=S})}}finally{t.removeEventListener("abort",b),a.removeEventListener("open",m),a.removeEventListener("message",k),a.removeEventListener("close",_),b()}}};const Kl="http://dsh.internal",Yl=/^\/[A-Za-z0-9._~-]+$/,Xl=/^[A-Za-z0-9_$.-]+$/;function Ql(){return{async call(e,t,n,s){ed(e,t);const o=Ut(),a={type:"client-request",rpcId:o,method:t,payload:n},i=await globalThis.fetch(new URL(`${e}/${t}`,ql()),{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(a),...s===void 0?{}:{signal:s}});if(!i.ok)throw new Error(`transport failure for ${e}/${t}: HTTP ${i.status}`);const u=Rt.parse(await i.json());if(u.rpcId!==o)throw new Error(`rpcId mismatch for ${t}: sent ${o}, got ${u.rpcId}`);return u.result}}}r(Ql,"createWebConnectionRpc");function ql(){const e=globalThis.location;return e?.origin!==void 0&&e.origin!=="null"?e.origin:Kl}r(ql,"resolveBase");function ed(e,t){const n=t.split("/");if(!Yl.test(e)||n.some(s=>s===""||s==="."||s===".."||!Xl.test(s)))throw new Error(`connection: invalid RPC target ${JSON.stringify(`${e}/${t}`)}`)}r(ed,"assertTarget");function td(e){if(e==="localhost"||e==="[::1]")return!0;const t=e.split(".");return t.length===4&&t[0]==="127"&&t.every(n=>/^\d{1,3}$/.test(n)&&Number(n)<=255)}r(td,"isLoopbackHostname");const nd=[];function sd(e){const t=typeof location>"u"?void 0:location,n=t!==void 0&&new URLSearchParams(t.search).has("fixture")?new Bl:void 0,s=n??new Hl,o=n?.rpc??Ql();let a=!1,i;const u=new Set,f=r(k=>{if(!Object.is(i,k)){i=k;for(const _ of[...u])try{_()}catch(b){console.error("[web-runtime] host-description listener threw:",b)}}},"publishDescription"),m={api:s,isLoopback:t===void 0||td(t.hostname),hostDescription:{getSnapshot:r(()=>i,"getSnapshot"),subscribe:r(k=>(u.add(k),()=>{u.delete(k)}),"subscribe")},rpc:o,start(k,_){if(a)throw new Error("connection: the stream loop is already owned by another consumer");a=!0;const b=new to(s,{...k,onConnected:r(S=>{f(S),Object.is(i,S)&&k.onConnected?.(S)},"onConnected"),onStateChange:r(S=>{S==="reconnecting"&&f(void 0),k.onStateChange?.(S)},"onStateChange")},_??{});return b.start(),{stop:r(()=>{b.stop(),f(void 0)},"stop")}}};e.provide("connection",m)}return r(sd,"apply"),Ie.AbstractApiClient=Ct,Ie.RpcId=wo,Ie.apply=sd,Ie.inject=nd,Ie.transportError=ko,He.exports},"factory")});
|