@qqbrowser/qbot-dsh 0.0.15 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/agent-presets/code/agent.cordis.yml +2 -2
- package/config/agent-presets/standard/agent.cordis.yml +2 -2
- package/cordis.patch.yml +50 -0
- package/lib/args-w1okyL78.js +9 -0
- package/lib/bin.js +2 -2
- package/lib/client.js +1 -0
- package/lib/content-review-CqDoh3wY.js +1 -0
- package/lib/content-review.js +1 -0
- package/lib/dump-config-CIL0Goqj.js +1 -0
- package/lib/gateway-port-CSFbDyoZ.js +1 -0
- package/lib/index.js +1 -0
- package/lib/llm-gateway-openai.js +17 -0
- package/lib/native-protocol-DdrIh89-.js +2 -0
- package/lib/{plugin-DNAeLZbb.js → plugin-viWCLnSr.js} +1 -1
- package/lib/profile-boot-CxJUSdnu.js +1 -0
- package/lib/profile-boot-DCgBQ4qO.js +8 -0
- package/lib/qb-auth-C2ofR1zn.js +4 -0
- package/lib/qb-auth.js +1 -0
- package/lib/web-search-dsh.js +1 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-cjs/index.js +7 -2
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +3 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +3 -0
- package/node_modules/@aws-sdk/credential-provider-http/node_modules/@smithy/node-http-handler/package.json +1 -1
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-cjs/index.js +7 -2
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/get-transformed-headers.js +3 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/dist-es/node-http-handler.js +3 -0
- package/node_modules/@aws-sdk/nested-clients/node_modules/@smithy/node-http-handler/package.json +1 -1
- package/node_modules/@deepseek-ai/cordis-plugin-hmr/package.json +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/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/lib/index.js +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 +6 -37
- package/node_modules/@deepseek-ai/dsh-base/package.json +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 +1 -1
- package/node_modules/@deepseek-ai/dsh-client-connection/package.json +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 +4 -4
- 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 +8 -8
- 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 +3 -3
- 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 +22 -22
- package/node_modules/@deepseek-ai/dsh-client-ui-primitives/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-settings/lib/client.js +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/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 +2 -2
- 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/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-cmdline/lib/index.js +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/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/lib/typert.host.js +5 -2
- 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/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-compaction-tool-result-pruner/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-cordis-client-runner/lib/client.js +4 -4
- package/node_modules/@deepseek-ai/dsh-cordis-client-runner/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-cordis-host-runner/lib/typert.host.js +10 -4
- 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/lib/index.js +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/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/lib/typert.host.js +5 -2
- 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/lib/index.js +4 -4
- package/node_modules/@deepseek-ai/dsh-headless/lib/startup.js +3 -3
- 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-host-apiproxy/lib/index.js +7 -7
- package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/types/api/rpc.schema.js +1 -1
- package/node_modules/@deepseek-ai/dsh-host-apiproxy/lib/types/api-proxy.js +1 -1
- 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/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/lib/index.js +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/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-llm/lib/types/assembler.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-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 +3 -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/package.json +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/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-pwsh-sandbox/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/package.json +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/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/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-session-persistence/package.json +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/lib/index.js +2 -2
- 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/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/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/package.json +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/lib/index.js +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/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-spill/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-spill-local/package.json +1 -1
- 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/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-storage-json/package.json +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/lib/index.js +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 +1 -1
- package/node_modules/@deepseek-ai/dsh-terminal-bash/package.json +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/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/lib/index.js +7 -10
- 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/lib/index.js +9 -30
- package/node_modules/@deepseek-ai/dsh-tool-cordis/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-fs/lib/index.js +8 -8
- package/node_modules/@deepseek-ai/dsh-tool-fs/package.json +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/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/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tool-subagent/lib/index.js +2 -2
- 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/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-tools/lib/index.js +15 -15
- package/node_modules/@deepseek-ai/dsh-tools/lib/types/code-mode.js +8 -8
- package/node_modules/@deepseek-ai/dsh-tools/lib/types/py-types.js +3 -3
- package/node_modules/@deepseek-ai/dsh-tools/lib/types/ts-types.js +4 -4
- 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/cordis.patch.yml +0 -1
- package/node_modules/@deepseek-ai/dsh-web-app/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-web-app/lib/startup.js +4 -5
- package/node_modules/@deepseek-ai/dsh-web-app/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/assets/{index-BQQQ5Qt-.js → index-fPGOmJjK.js} +25 -25
- package/node_modules/@deepseek-ai/dsh-web-frontend/dist/index.html +1 -1
- package/node_modules/@deepseek-ai/dsh-web-frontend/package.json +1 -1
- package/node_modules/@deepseek-ai/dsh-web-search-deepseek/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/worker.cjs +9 -8
- package/node_modules/@deepseek-ai/dsh-workflow-worker-thread/package.json +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/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +5 -5
- package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +4 -4
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +5 -5
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +6 -6
- package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/openrouter-images.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +2 -2
- package/node_modules/@earendil-works/pi-ai/dist/api/simple-options.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/openrouter.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/qwen-token-plan.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +5 -5
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@koromix/koffi-darwin-arm64/darwin_arm64/koffi.node +0 -0
- package/node_modules/@koromix/koffi-darwin-arm64/package.json +1 -1
- package/node_modules/@koromix/koffi-darwin-x64/darwin_x64/koffi.node +0 -0
- package/node_modules/@koromix/koffi-darwin-x64/package.json +1 -1
- package/node_modules/@koromix/koffi-win32-x64/package.json +1 -1
- package/node_modules/@koromix/koffi-win32-x64/win32_x64/koffi.node +0 -0
- package/node_modules/@smithy/core/dist-cjs/index.js +3 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/cbor/index.js +126 -39
- package/node_modules/@smithy/core/dist-cjs/submodules/client/index.js +14 -3
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.browser.js +3 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/endpoints/index.js +3 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.browser.js +10 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/event-streams/index.js +10 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/protocols/index.js +16 -2
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.browser.js +4 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/retry/index.js +4 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.browser.js +4 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.js +4 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/serde/index.native.js +4 -1
- package/node_modules/@smithy/core/dist-cjs/submodules/transport/index.js +7 -0
- package/node_modules/@smithy/core/dist-es/legacy-root-exports/util-identity-and-auth/DefaultIdentityProviderConfig.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor-decode.js +29 -13
- package/node_modules/@smithy/core/dist-es/submodules/cbor/cbor-encode.js +12 -4
- package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeDeserializer.js +9 -0
- package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v1/CborShapeSerializer.js +7 -0
- package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeDeserializer2.js +44 -15
- package/node_modules/@smithy/core/dist-es/submodules/cbor/codec-v2/CborShapeSerializer2.js +22 -4
- package/node_modules/@smithy/core/dist-es/submodules/cbor/parseCborBody.js +5 -0
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/extensions/checksum.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/get-value-from-text-node.js +4 -1
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/object-mapping.js +6 -1
- package/node_modules/@smithy/core/dist-es/submodules/client/smithy-client/serde-json.js +4 -1
- package/node_modules/@smithy/core/dist-es/submodules/endpoints/util-endpoints/resolveEndpoint.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/EventStreamSerde.js +7 -0
- package/node_modules/@smithy/core/dist-es/submodules/event-streams/eventstream-codec/HeaderMarshaller.js +4 -1
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpBindingProtocol.js +9 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/HttpProtocol.js +5 -0
- package/node_modules/@smithy/core/dist-es/submodules/protocols/RpcProtocol.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/retry/middleware-retry/parseRetryAfterHeader.js +4 -1
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.browser.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/index.native.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/serde/parse-utils.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/transport/hasOwn.js +3 -0
- package/node_modules/@smithy/core/dist-es/submodules/transport/index.js +1 -0
- package/node_modules/@smithy/core/dist-es/submodules/transport/toEndpointV1.js +3 -0
- package/node_modules/@smithy/core/package.json +1 -1
- package/node_modules/@smithy/signature-v4/dist-cjs/index.js +19 -7
- package/node_modules/@smithy/signature-v4/dist-es/HeaderFormatter.js +4 -1
- package/node_modules/@smithy/signature-v4/dist-es/getCanonicalQuery.js +4 -1
- package/node_modules/@smithy/signature-v4/dist-es/getPayloadHash.js +4 -1
- package/node_modules/@smithy/signature-v4/dist-es/headerUtil.js +10 -3
- package/node_modules/@smithy/signature-v4/dist-es/moveHeadersToQuery.js +4 -1
- package/node_modules/@smithy/signature-v4/dist-es/prepareRequest.js +4 -1
- package/node_modules/@smithy/signature-v4/package.json +1 -1
- package/node_modules/@tanstack/react-virtual/package.json +1 -1
- package/node_modules/@tanstack/virtual-core/dist/cjs/index.cjs +7 -1
- package/node_modules/@tanstack/virtual-core/dist/cjs/utils.cjs +14 -4
- package/node_modules/@tanstack/virtual-core/dist/esm/index.js +1 -1
- package/node_modules/@tanstack/virtual-core/dist/esm/utils.js +2 -2
- package/node_modules/@tanstack/virtual-core/package.json +1 -1
- package/node_modules/hono/dist/cjs/client/utils.js +1 -1
- package/node_modules/hono/dist/cjs/context.js +4 -0
- package/node_modules/hono/dist/cjs/middleware/cors/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/csrf/index.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/etag/digest.js +1 -1
- package/node_modules/hono/dist/cjs/middleware/etag/index.js +2 -2
- package/node_modules/hono/dist/cjs/middleware/pretty-json/index.js +3 -1
- package/node_modules/hono/dist/cjs/router/linear-router/router.js +7 -2
- package/node_modules/hono/dist/cjs/router/pattern-router/router.js +3 -9
- package/node_modules/hono/dist/cjs/router/trie-router/node.js +43 -67
- package/node_modules/hono/dist/cjs/router/trie-router/router.js +3 -11
- package/node_modules/hono/dist/cjs/utils/ipaddr.js +5 -3
- package/node_modules/hono/dist/client/utils.js +1 -1
- package/node_modules/hono/dist/middleware/cors/index.js +1 -1
- package/node_modules/hono/dist/middleware/csrf/index.js +1 -1
- package/node_modules/hono/dist/middleware/etag/digest.js +1 -1
- package/node_modules/hono/dist/middleware/etag/index.js +1 -1
- package/node_modules/hono/dist/middleware/pretty-json/index.js +1 -1
- package/node_modules/hono/dist/router/linear-router/router.js +1 -1
- package/node_modules/hono/dist/router/pattern-router/router.js +1 -1
- package/node_modules/hono/dist/router/trie-router/node.js +1 -1
- package/node_modules/hono/dist/router/trie-router/router.js +1 -1
- package/node_modules/hono/dist/utils/ipaddr.js +1 -1
- package/node_modules/hono/package.json +1 -1
- package/node_modules/koffi/package.json +1 -1
- package/node_modules/koffi/src/koffi/index.cjs +1 -1
- package/node_modules/koffi/src/koffi/index.js +1 -1
- package/node_modules/koffi/src/koffi/indirect.cjs +1 -1
- package/node_modules/koffi/src/koffi/indirect.js +1 -1
- package/node_modules/negotiator/lib/accept.js +54 -0
- package/node_modules/negotiator/lib/charset.js +10 -34
- package/node_modules/negotiator/lib/encoding.js +9 -30
- package/node_modules/negotiator/lib/language.js +15 -36
- package/node_modules/negotiator/lib/mediaType.js +16 -134
- package/node_modules/negotiator/node_modules/content-type/LICENSE +22 -0
- package/node_modules/negotiator/node_modules/content-type/dist/index.js +176 -0
- package/node_modules/negotiator/node_modules/content-type/package.json +1 -0
- package/node_modules/negotiator/package.json +1 -1
- package/node_modules/node-pty/lib/conpty_console_list_agent.js +11 -2
- package/node_modules/node-pty/lib/index.js +6 -6
- package/node_modules/node-pty/lib/shared/conout.js +2 -3
- package/node_modules/node-pty/lib/terminal.js +2 -2
- package/node_modules/node-pty/lib/unixTerminal.js +11 -6
- package/node_modules/node-pty/lib/utils.js +6 -7
- package/node_modules/node-pty/lib/windowsConoutConnection.js +24 -18
- package/node_modules/node-pty/lib/windowsPtyAgent.js +125 -101
- package/node_modules/node-pty/lib/windowsTerminal.js +14 -4
- package/node_modules/node-pty/lib/worker/conoutSocketWorker.js +3 -3
- package/node_modules/node-pty/package.json +1 -1
- package/node_modules/node-pty/prebuilds/darwin-arm64/pty.node +0 -0
- package/node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper +0 -0
- package/node_modules/node-pty/prebuilds/darwin-x64/pty.node +0 -0
- package/node_modules/node-pty/prebuilds/darwin-x64/spawn-helper +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty/OpenConsole.exe +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty/conpty.dll +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty.node +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/conpty_console_list.node +0 -0
- package/node_modules/node-pty/scripts/post-install.js +1 -5
- package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-arm64/OpenConsole.exe +0 -0
- package/node_modules/node-pty/third_party/conpty/{1.23.251008001 → 1.25.260303002}/win10-arm64/conpty.dll +0 -0
- package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-x64/OpenConsole.exe +0 -0
- package/node_modules/node-pty/third_party/conpty/1.25.260303002/win10-x64/conpty.dll +0 -0
- package/node_modules/typebox/build/compile/validator.mjs +1 -1
- package/node_modules/typebox/build/format/_idna.mjs +1 -1
- package/node_modules/typebox/build/format/_puny.mjs +1 -1
- package/node_modules/typebox/build/format/uuid.mjs +1 -1
- package/node_modules/typebox/build/guard/emit.mjs +1 -1
- package/node_modules/typebox/build/guard/guard.mjs +1 -1
- package/node_modules/typebox/build/guard/string.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/_guard.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/boolean.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/index.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/schema.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/types/_guard.mjs +1 -0
- package/node_modules/typebox/build/schema/types/index.mjs +1 -1
- package/node_modules/typebox/build/schema/types/schema.mjs +1 -1
- package/node_modules/typebox/build/system/locale/ar_001.mjs +1 -1
- package/node_modules/typebox/build/system/locale/bn_BD.mjs +1 -1
- package/node_modules/typebox/build/system/locale/cs_CZ.mjs +1 -1
- package/node_modules/typebox/build/system/locale/de_DE.mjs +1 -1
- package/node_modules/typebox/build/system/locale/el_GR.mjs +1 -1
- package/node_modules/typebox/build/system/locale/en_US.mjs +1 -1
- package/node_modules/typebox/build/system/locale/es_419.mjs +1 -1
- package/node_modules/typebox/build/system/locale/es_AR.mjs +1 -1
- package/node_modules/typebox/build/system/locale/es_ES.mjs +1 -1
- package/node_modules/typebox/build/system/locale/es_MX.mjs +1 -1
- package/node_modules/typebox/build/system/locale/fa_IR.mjs +1 -1
- package/node_modules/typebox/build/system/locale/fil_PH.mjs +1 -1
- package/node_modules/typebox/build/system/locale/fr_CA.mjs +1 -1
- package/node_modules/typebox/build/system/locale/fr_FR.mjs +1 -1
- package/node_modules/typebox/build/system/locale/ha_NG.mjs +1 -1
- package/node_modules/typebox/build/system/locale/hi_IN.mjs +1 -1
- package/node_modules/typebox/build/system/locale/hu_HU.mjs +1 -1
- package/node_modules/typebox/build/system/locale/id_ID.mjs +1 -1
- package/node_modules/typebox/build/system/locale/it_IT.mjs +1 -1
- package/node_modules/typebox/build/system/locale/ja_JP.mjs +1 -1
- package/node_modules/typebox/build/system/locale/ko_KR.mjs +1 -1
- package/node_modules/typebox/build/system/locale/ms_MY.mjs +1 -1
- package/node_modules/typebox/build/system/locale/nl_NL.mjs +1 -1
- package/node_modules/typebox/build/system/locale/pl_PL.mjs +1 -1
- package/node_modules/typebox/build/system/locale/pt_BR.mjs +1 -1
- package/node_modules/typebox/build/system/locale/pt_PT.mjs +1 -1
- package/node_modules/typebox/build/system/locale/ro_RO.mjs +1 -1
- package/node_modules/typebox/build/system/locale/ru_RU.mjs +1 -1
- package/node_modules/typebox/build/system/locale/sv_SE.mjs +1 -1
- package/node_modules/typebox/build/system/locale/sw_TZ.mjs +1 -1
- package/node_modules/typebox/build/system/locale/th_TH.mjs +1 -1
- package/node_modules/typebox/build/system/locale/tr_TR.mjs +1 -1
- package/node_modules/typebox/build/system/locale/uk_UA.mjs +1 -1
- package/node_modules/typebox/build/system/locale/ur_PK.mjs +1 -1
- package/node_modules/typebox/build/system/locale/vi_VN.mjs +1 -1
- package/node_modules/typebox/build/system/locale/yo_NG.mjs +1 -1
- package/node_modules/typebox/build/system/locale/zh_Hans.mjs +1 -1
- package/node_modules/typebox/build/system/locale/zh_Hant.mjs +1 -1
- package/node_modules/typebox/build/system/memory/clone.mjs +1 -1
- package/node_modules/typebox/build/system/settings/settings.mjs +1 -1
- package/node_modules/typebox/build/type/action/_optional.mjs +1 -0
- package/node_modules/typebox/build/type/action/_readonly.mjs +1 -0
- package/node_modules/typebox/build/type/action/awaited.mjs +1 -0
- package/node_modules/typebox/build/type/action/conditional.mjs +1 -1
- package/node_modules/typebox/build/type/action/index.mjs +1 -1
- package/node_modules/typebox/build/type/action/mapped.mjs +1 -1
- package/node_modules/typebox/build/type/action/module.mjs +1 -1
- package/node_modules/typebox/build/type/action/options.mjs +1 -0
- package/node_modules/typebox/build/type/engine/awaited/instantiate.mjs +1 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +1 -1
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +1 -1
- package/node_modules/typebox/build/type/engine/call/resolve_arguments.mjs +1 -1
- package/node_modules/typebox/build/type/engine/constructor_parameters/instantiate.mjs +1 -1
- package/node_modules/typebox/build/type/engine/cyclic/candidates.mjs +1 -1
- package/node_modules/typebox/build/type/engine/cyclic/check.mjs +1 -1
- package/node_modules/typebox/build/type/engine/cyclic/dependencies.mjs +1 -1
- package/node_modules/typebox/build/type/engine/cyclic/extends.mjs +1 -1
- package/node_modules/typebox/build/type/engine/cyclic/instantiate.mjs +1 -1
- package/node_modules/typebox/build/type/engine/enum/enum_to_union.mjs +1 -0
- package/node_modules/typebox/build/type/engine/enum/index.mjs +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +1 -1
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +1 -1
- package/node_modules/typebox/build/type/engine/index.mjs +1 -1
- package/node_modules/typebox/build/type/engine/indexable/from_enum.mjs +1 -1
- package/node_modules/typebox/build/type/engine/indexable/from_template_literal.mjs +1 -1
- package/node_modules/typebox/build/type/engine/indexable/from_type.mjs +1 -1
- package/node_modules/typebox/build/type/engine/indexed/instantiate.mjs +1 -1
- package/node_modules/typebox/build/type/engine/instantiate.mjs +1 -1
- package/node_modules/typebox/build/type/engine/intrinsics/from_template_literal.mjs +1 -1
- package/node_modules/typebox/build/type/engine/keyof/instantiate.mjs +1 -1
- package/node_modules/typebox/build/type/engine/mapped/mapped_operation.mjs +1 -1
- package/node_modules/typebox/build/type/engine/mapped/mapped_variants.mjs +1 -1
- package/node_modules/typebox/build/type/engine/module/instantiate.mjs +1 -1
- package/node_modules/typebox/build/type/engine/object/from_type.mjs +1 -1
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +1 -1
- package/node_modules/typebox/build/type/engine/options/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/options/instantiate.mjs +1 -0
- package/node_modules/typebox/build/type/engine/parameters/instantiate.mjs +1 -1
- package/node_modules/typebox/build/type/engine/partial/from_intersect.mjs +1 -1
- package/node_modules/typebox/build/type/engine/partial/from_object.mjs +1 -1
- package/node_modules/typebox/build/type/engine/partial/from_type.mjs +1 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_array.mjs +1 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_intersect.mjs +1 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_object.mjs +1 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_tuple.mjs +1 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_type.mjs +1 -1
- package/node_modules/typebox/build/type/engine/record/from_key_enum.mjs +1 -1
- package/node_modules/typebox/build/type/engine/record/from_key_template_literal.mjs +1 -1
- package/node_modules/typebox/build/type/engine/ref/instantiate.mjs +1 -1
- package/node_modules/typebox/build/type/engine/required/from_intersect.mjs +1 -1
- package/node_modules/typebox/build/type/engine/required/from_object.mjs +1 -1
- package/node_modules/typebox/build/type/engine/required/from_type.mjs +1 -1
- package/node_modules/typebox/build/type/engine/template_literal/decode.mjs +1 -1
- package/node_modules/typebox/build/type/engine/template_literal/encode.mjs +1 -1
- package/node_modules/typebox/build/type/engine/template_literal/is_finite.mjs +1 -1
- package/node_modules/typebox/build/type/engine/this/expand_this.mjs +1 -1
- package/node_modules/typebox/build/type/extends/async_iterator.mjs +1 -0
- package/node_modules/typebox/build/type/extends/enum.mjs +1 -1
- package/node_modules/typebox/build/type/extends/extends_left.mjs +1 -1
- package/node_modules/typebox/build/type/extends/extends_right.mjs +1 -1
- package/node_modules/typebox/build/type/extends/inference.mjs +1 -1
- package/node_modules/typebox/build/type/extends/iterator.mjs +1 -0
- package/node_modules/typebox/build/type/extends/object.mjs +1 -1
- package/node_modules/typebox/build/type/extends/parameters.mjs +1 -1
- package/node_modules/typebox/build/type/extends/promise.mjs +1 -0
- package/node_modules/typebox/build/type/extends/template_literal.mjs +1 -1
- package/node_modules/typebox/build/type/extends/tuple.mjs +1 -1
- package/node_modules/typebox/build/type/extends/union.mjs +1 -1
- package/node_modules/typebox/build/type/script/mapping.mjs +1 -1
- package/node_modules/typebox/build/type/script/parser.mjs +6 -6
- package/node_modules/typebox/build/type/script/script.mjs +1 -1
- package/node_modules/typebox/build/type/script/token/internal/guard.mjs +1 -1
- package/node_modules/typebox/build/type/script/token/until.mjs +1 -1
- package/node_modules/typebox/build/type/types/_immutable.mjs +1 -1
- package/node_modules/typebox/build/type/types/_optional.mjs +1 -1
- package/node_modules/typebox/build/type/types/_readonly.mjs +1 -1
- package/node_modules/typebox/build/type/types/_refine.mjs +1 -1
- package/node_modules/typebox/build/type/types/async_iterator.mjs +1 -0
- package/node_modules/typebox/build/type/types/base.mjs +1 -0
- package/node_modules/typebox/build/type/types/call.mjs +1 -1
- package/node_modules/typebox/build/type/types/deferred.mjs +1 -1
- package/node_modules/typebox/build/type/types/enum.mjs +1 -1
- package/node_modules/typebox/build/type/types/index.mjs +1 -1
- package/node_modules/typebox/build/type/types/iterator.mjs +1 -0
- package/node_modules/typebox/build/type/types/number.mjs +1 -1
- package/node_modules/typebox/build/type/types/promise.mjs +1 -0
- package/node_modules/typebox/build/type/types/record.mjs +1 -1
- package/node_modules/typebox/build/typebox.mjs +1 -1
- package/node_modules/typebox/build/value/clean/clean.mjs +1 -1
- package/node_modules/typebox/build/value/clean/from_base.mjs +1 -0
- package/node_modules/typebox/build/value/clean/from_intersect.mjs +1 -1
- package/node_modules/typebox/build/value/clean/from_type.mjs +1 -1
- package/node_modules/typebox/build/value/clean/from_union.mjs +1 -1
- package/node_modules/typebox/build/value/clone/clone.mjs +1 -1
- package/node_modules/typebox/build/value/codec/decode.mjs +1 -1
- package/node_modules/typebox/build/value/codec/encode.mjs +1 -1
- package/node_modules/typebox/build/value/codec/from_array.mjs +1 -1
- package/node_modules/typebox/build/value/codec/from_object.mjs +1 -1
- package/node_modules/typebox/build/value/codec/from_record.mjs +1 -1
- package/node_modules/typebox/build/value/codec/from_tuple.mjs +1 -1
- package/node_modules/typebox/build/value/codec/from_union.mjs +1 -1
- package/node_modules/typebox/build/value/convert/from_base.mjs +1 -0
- package/node_modules/typebox/build/value/convert/from_enum.mjs +1 -1
- package/node_modules/typebox/build/value/convert/from_template_literal.mjs +1 -1
- package/node_modules/typebox/build/value/convert/from_type.mjs +1 -1
- package/node_modules/typebox/build/value/create/from_async_iterator.mjs +1 -0
- package/node_modules/typebox/build/value/create/from_base.mjs +1 -0
- package/node_modules/typebox/build/value/create/from_enum.mjs +1 -1
- package/node_modules/typebox/build/value/create/from_iterator.mjs +1 -0
- package/node_modules/typebox/build/value/create/from_promise.mjs +1 -0
- package/node_modules/typebox/build/value/create/from_type.mjs +1 -1
- package/node_modules/typebox/build/value/default/from_base.mjs +1 -0
- package/node_modules/typebox/build/value/default/from_object.mjs +1 -1
- package/node_modules/typebox/build/value/default/from_type.mjs +1 -1
- package/node_modules/typebox/build/value/index.mjs +1 -1
- package/node_modules/typebox/build/value/mutate/error.mjs +1 -0
- package/node_modules/typebox/build/value/mutate/from_array.mjs +1 -0
- package/node_modules/typebox/build/value/mutate/from_object.mjs +1 -0
- package/node_modules/typebox/build/value/mutate/from_unknown.mjs +1 -0
- package/node_modules/typebox/build/value/mutate/from_value.mjs +1 -0
- package/node_modules/typebox/build/value/mutate/index.mjs +1 -0
- package/node_modules/typebox/build/value/mutate/mutate.mjs +1 -0
- package/node_modules/typebox/build/value/repair/from_base.mjs +1 -0
- package/node_modules/typebox/build/value/repair/from_enum.mjs +1 -1
- package/node_modules/typebox/build/value/repair/from_type.mjs +1 -1
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +1 -1
- package/node_modules/typebox/build/value/value.mjs +1 -1
- package/node_modules/typebox/package.json +1 -1
- package/package.json +1 -1
- package/lib/args-DcHS9iff.js +0 -9
- package/lib/dump-config-xQTUTTDD.js +0 -1
- package/lib/profile-boot-BkordgJK.js +0 -1
- package/lib/profile-boot-DDo03lXi.js +0 -8
- package/node_modules/@deepseek-ai/dsh-content-review/LICENSE +0 -21
- package/node_modules/@deepseek-ai/dsh-content-review/lib/index.js +0 -1
- package/node_modules/@deepseek-ai/dsh-content-review/lib/invariant.js +0 -1
- package/node_modules/@deepseek-ai/dsh-content-review/package.json +0 -1
- package/node_modules/@deepseek-ai/dsh-home-quarantine-macos/LICENSE +0 -21
- package/node_modules/@deepseek-ai/dsh-home-quarantine-macos/lib/index.js +0 -1
- package/node_modules/@deepseek-ai/dsh-home-quarantine-macos/lib/invariant.js +0 -1
- package/node_modules/@deepseek-ai/dsh-home-quarantine-macos/package.json +0 -1
- package/node_modules/@deepseek-ai/dsh-llm-gateway-openai/LICENSE +0 -21
- package/node_modules/@deepseek-ai/dsh-llm-gateway-openai/lib/index.js +0 -17
- package/node_modules/@deepseek-ai/dsh-llm-gateway-openai/lib/invariant.js +0 -1
- package/node_modules/@deepseek-ai/dsh-llm-gateway-openai/package.json +0 -1
- package/node_modules/@deepseek-ai/dsh-qb-auth/LICENSE +0 -21
- package/node_modules/@deepseek-ai/dsh-qb-auth/lib/index.js +0 -4
- package/node_modules/@deepseek-ai/dsh-qb-auth/lib/invariant.js +0 -1
- package/node_modules/@deepseek-ai/dsh-qb-auth/package.json +0 -1
- package/node_modules/@deepseek-ai/dsh-web-search-dsh/LICENSE +0 -21
- package/node_modules/@deepseek-ai/dsh-web-search-dsh/lib/index.js +0 -1
- package/node_modules/@deepseek-ai/dsh-web-search-dsh/lib/invariant.js +0 -1
- package/node_modules/@deepseek-ai/dsh-web-search-dsh/package.json +0 -1
- package/node_modules/@napi-rs/xattr/LICENSE +0 -21
- package/node_modules/@napi-rs/xattr/index.js +0 -567
- package/node_modules/@napi-rs/xattr/package.json +0 -1
- package/node_modules/@napi-rs/xattr-darwin-arm64/package.json +0 -1
- package/node_modules/@napi-rs/xattr-darwin-arm64/xattr.darwin-arm64.node +0 -0
- package/node_modules/@napi-rs/xattr-darwin-x64/package.json +0 -1
- package/node_modules/@napi-rs/xattr-darwin-x64/xattr.darwin-x64.node +0 -0
- package/node_modules/@parcel/watcher/LICENSE +0 -21
- package/node_modules/@parcel/watcher/index.js +0 -44
- package/node_modules/@parcel/watcher/index.js.flow +0 -45
- package/node_modules/@parcel/watcher/package.json +0 -1
- package/node_modules/@parcel/watcher/scripts/build-from-source.js +0 -16
- package/node_modules/@parcel/watcher/wrapper.js +0 -88
- package/node_modules/@parcel/watcher-darwin-arm64/LICENSE +0 -21
- package/node_modules/@parcel/watcher-darwin-arm64/package.json +0 -1
- package/node_modules/@parcel/watcher-darwin-arm64/watcher.node +0 -0
- package/node_modules/@parcel/watcher-darwin-x64/LICENSE +0 -21
- package/node_modules/@parcel/watcher-darwin-x64/package.json +0 -1
- package/node_modules/@parcel/watcher-darwin-x64/watcher.node +0 -0
- package/node_modules/@parcel/watcher-win32-x64/LICENSE +0 -21
- package/node_modules/@parcel/watcher-win32-x64/package.json +0 -1
- package/node_modules/@parcel/watcher-win32-x64/watcher.node +0 -0
- package/node_modules/is-extglob/LICENSE +0 -21
- package/node_modules/is-extglob/index.js +0 -20
- package/node_modules/is-extglob/package.json +0 -1
- package/node_modules/is-glob/LICENSE +0 -21
- package/node_modules/is-glob/index.js +0 -150
- package/node_modules/is-glob/package.json +0 -1
- package/node_modules/node-pty/deps/winpty/.drone.yml +0 -15
- package/node_modules/node-pty/deps/winpty/LICENSE +0 -21
- package/node_modules/node-pty/deps/winpty/configure +0 -167
- package/node_modules/node-pty/deps/winpty/misc/ConinMode.ps1 +0 -116
- package/node_modules/node-pty/deps/winpty/misc/IdentifyConsoleWindow.ps1 +0 -51
- package/node_modules/node-pty/deps/winpty/misc/build32.sh +0 -9
- package/node_modules/node-pty/deps/winpty/misc/build64.sh +0 -9
- package/node_modules/node-pty/deps/winpty/misc/color-test.sh +0 -212
- package/node_modules/node-pty/deps/winpty/ship/build-pty4j-libpty.bat +0 -36
- package/node_modules/node-pty/deps/winpty/src/shared/GetCommitHash.bat +0 -13
- package/node_modules/node-pty/deps/winpty/src/shared/UpdateGenVersion.bat +0 -20
- package/node_modules/node-pty/deps/winpty/vcbuild.bat +0 -83
- package/node_modules/node-pty/lib/eventEmitter2.test.js +0 -30
- package/node_modules/node-pty/lib/terminal.test.js +0 -139
- package/node_modules/node-pty/lib/testUtils.test.js +0 -28
- package/node_modules/node-pty/lib/unixTerminal.test.js +0 -351
- package/node_modules/node-pty/lib/windowsPtyAgent.test.js +0 -90
- package/node_modules/node-pty/lib/windowsTerminal.test.js +0 -219
- package/node_modules/node-pty/prebuilds/win32-x64/pty.node +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/winpty-agent.exe +0 -0
- package/node_modules/node-pty/prebuilds/win32-x64/winpty.dll +0 -0
- package/node_modules/node-pty/scripts/gen-compile-commands.js +0 -8
- package/node_modules/node-pty/scripts/increment-version.js +0 -54
- package/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-arm64/OpenConsole.exe +0 -0
- package/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/OpenConsole.exe +0 -0
- package/node_modules/node-pty/third_party/conpty/1.23.251008001/win10-x64/conpty.dll +0 -0
- package/node_modules/typebox/build/type/action/_add_immutable.mjs +0 -1
- package/node_modules/typebox/build/type/action/_add_optional.mjs +0 -1
- package/node_modules/typebox/build/type/action/_add_readonly.mjs +0 -1
- package/node_modules/typebox/build/type/action/_remove_immutable.mjs +0 -1
- package/node_modules/typebox/build/type/action/_remove_optional.mjs +0 -1
- package/node_modules/typebox/build/type/action/_remove_readonly.mjs +0 -1
- package/node_modules/typebox/build/type/action/with.mjs +0 -1
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +0 -1
- package/node_modules/typebox/build/type/engine/immutable/instantiate_remove.mjs +0 -1
- package/node_modules/typebox/build/type/engine/indexable/from_dependent.mjs +0 -1
- package/node_modules/typebox/build/type/engine/object/from_dependent.mjs +0 -1
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +0 -1
- package/node_modules/typebox/build/type/engine/optional/instantiate_remove.mjs +0 -1
- package/node_modules/typebox/build/type/engine/partial/from_dependent.mjs +0 -1
- package/node_modules/typebox/build/type/engine/priority/index.mjs +0 -1
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +0 -1
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +0 -1
- package/node_modules/typebox/build/type/engine/readonly/instantiate_remove.mjs +0 -1
- package/node_modules/typebox/build/type/engine/readonly_object/from_dependent.mjs +0 -1
- package/node_modules/typebox/build/type/engine/required/from_dependent.mjs +0 -1
- package/node_modules/typebox/build/type/engine/with/instantiate.mjs +0 -1
- package/node_modules/typebox/build/type/extends/dependent.mjs +0 -1
- package/node_modules/typebox/build/type/extends/record.mjs +0 -1
- package/node_modules/typebox/build/type/types/dependent.mjs +0 -1
- /package/node_modules/@deepseek-ai/dsh-sandbox-windows-acl/lib/{types-D2_FQYSK.js → types-DE3U0cmQ.js} +0 -0
- /package/node_modules/typebox/build/type/engine/{with → awaited}/index.mjs +0 -0
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var yt=Object.defineProperty;var c=(e,t)=>yt(e,"name",{value:t,configurable:!0});import{Service as gt}from"@deepseek-ai/cordis";import ae from"@deepseek-ai/schemastery";import{AnonymousEntries as Te,NamedEntries as bt,ScopedLayers as wt,scopeOf as Ne,scopeTarget as F}from"@deepseek-ai/dsh-scope";import{CallId as vt,HarnessError as q,assertNever as z,deepFreeze as G}from"@deepseek-ai/dsh-llm";import{isJsonValue as Re,snapshotJsonValue as N}from"@deepseek-ai/dsh-session";var Q=class extends q{static{c(this,"JsonSchemaError")}violations;constructor(e){super(`unsupported JSON schema: ${e.join("; ")}`,"UNSUPPORTED_SCHEMA"),this.name="JsonSchemaError",this.violations=e}};const Ot=new Set(["type","oneOf","properties","required","additionalProperties","items","enum","const"]),kt=new Set(["description","title","default","examples"]),ce=["object","array","string","number","integer","boolean","null"];function Ae(e,t){const n=Object.getOwnPropertyDescriptor(e,"constructor")?.value;if(typeof n!="function")return!1;try{return n.name===t&&n.prototype===e&&Function.prototype.toString.call(n)===`function ${t}() { [native code] }`}catch{return!1}}c(Ae,"hasIntrinsicConstructor");function Ie(e){return Object.getPrototypeOf(e)===null&&Ae(e,"Object")}c(Ie,"isIntrinsicObjectPrototype");function Pe(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;try{const t=Object.getPrototypeOf(e);return t===null||typeof t=="object"&&Ie(t)}catch{return!1}}c(Pe,"isPlainJsonRecord");function $t(e){const t=Object.getPrototypeOf(e);if(!Array.isArray(t)||!Ae(t,"Array"))return!1;const n=Object.getPrototypeOf(t);return typeof n=="object"&&n!==null&&Ie(n)}c($t,"hasPlainArrayPrototype");function St(e){try{return Reflect.ownKeys(e).every(t=>typeof t=="string"&&Object.prototype.propertyIsEnumerable.call(e,t))}catch{return!1}}c(St,"hasOnlyEnumerableStringKeys");function _(e){return Pe(e)&&St(e)}c(_,"isJsonSchemaRecord");function L(e){if(!Array.isArray(e))return!1;try{if(!$t(e)||Reflect.ownKeys(e).length!==e.length+1)return!1;for(let t=0;t<e.length;t++)if(!Object.hasOwn(e,t))return!1;return!0}catch{return!1}}c(L,"isPlainJsonArray");function Z(e){return typeof e=="number"&&Number.isFinite(e)&&!Object.is(e,-0)}c(Z,"isJsonNumber");function De(e,t){switch(e){case"string":return typeof t=="string";case"number":return Z(t);case"integer":return Z(t)&&Number.isInteger(t);case"boolean":return typeof t=="boolean";case"null":return t===null;default:return z(e,"JsonSchemaType")}}c(De,"scalarMatches");const _e=["properties","required","additionalProperties","items","enum","const"];function Et(e,t,n,r){const i=Object.hasOwn(e,"required"),s=i?e.required:void 0;if(i)if(!L(s)||s.some(a=>typeof a!="string"))r.push(`${t}.required must be an array of strings`);else{const a=_(n)?n:{};for(const o of s)Object.hasOwn(a,o)||r.push(`${t}.required names "${o}" which is not in properties`)}Object.hasOwn(e,"additionalProperties")&&typeof e.additionalProperties!="boolean"&&r.push(`${t}.additionalProperties must be a boolean`)}c(Et,"checkObjectSchemaTail");function qe(e,t,n,r){const i=[{kind:"enter",node:e,path:t}];for(let s=i.pop();s!==void 0;s=i.pop()){if(s.kind==="leave"){r.delete(s.node);continue}if(s.kind==="one-of-tail"){for(const p of _e)Object.hasOwn(s.node,p)&&n.push(`${s.path}.${p} is not supported beside oneOf`);continue}if(s.kind==="object-tail"){Et(s.node,s.path,s.properties,n);continue}const{node:a,path:o}=s;if(!_(a)){n.push(`${o} must be a schema object`);continue}if(r.has(a)){n.push(`${o} is circular`);continue}r.add(a),i.push({kind:"leave",node:a});for(const p of Object.keys(a))if(!Ot.has(p)){if(kt.has(p)){try{Re(a[p])||n.push(`${o}.${p} annotation must be lossless JSON data`)}catch{n.push(`${o}.${p} annotation must be lossless JSON data`)}continue}n.push(`${o}.${p} is not a supported keyword (subset: type/oneOf/properties/required/additionalProperties/items/enum/const + annotations)`)}Object.hasOwn(a,"description")&&typeof a.description!="string"&&n.push(`${o}.description must be a string`),Object.hasOwn(a,"title")&&typeof a.title!="string"&&n.push(`${o}.title must be a string`);const l=Object.hasOwn(a,"type"),u=Object.hasOwn(a,"oneOf");if(l&&u){n.push(`${o} cannot declare both type and oneOf`);continue}if(!l&&!u){for(const p of _e)Object.hasOwn(a,p)&&n.push(`${o}.${p} requires type or oneOf`);continue}if(u){const p=a.oneOf;if(i.push({kind:"one-of-tail",node:a,path:o}),!L(p)||p.length<2)n.push(`${o}.oneOf must be an array of at least two schemas`);else for(let h=p.length-1;h>=0;h--)i.push({kind:"enter",node:p[h],path:`${o}.oneOf[${h}]`});continue}const d=a.type;if(typeof d!="string"||!ce.includes(d)){n.push(Array.isArray(d)?`${o}.type must be a single type string (type arrays are not supported)`:`${o}.type must be one of ${ce.join("/")}`);continue}const f=d;for(const[p,h]of Object.entries({properties:["object"],required:["object"],additionalProperties:["object"],items:["array"],enum:["string","number","integer","boolean","null"],const:["string","number","integer","boolean","null"]}))Object.hasOwn(a,p)&&!h.includes(f)&&n.push(`${o}.${p} is not supported on type "${f}"`);switch(f){case"object":{const p=Object.hasOwn(a,"properties")?a.properties:void 0;if(i.push({kind:"object-tail",node:a,path:o,properties:p}),Object.hasOwn(a,"properties"))if(!_(p))n.push(`${o}.properties must be an object of schemas`);else{const h=Object.entries(p);for(let y=h.length-1;y>=0;y--){const m=h[y];m!==void 0&&i.push({kind:"enter",node:m[1],path:`${o}.properties.${m[0]}`})}}break}case"array":Object.hasOwn(a,"items")&&i.push({kind:"enter",node:a.items,path:`${o}.items`});break;case"string":case"number":case"integer":case"boolean":case"null":{const p=Object.hasOwn(a,"enum"),h=p?a.enum:void 0,y=L(h)&&h.length>0&&h.every(C=>De(f,C));p&&!y&&n.push(`${o}.enum must be a non-empty array of ${f} values`);const m=Object.hasOwn(a,"const"),b=m?a.const:void 0,I=De(f,b);m&&(I?y&&!h.includes(b)&&n.push(`${o}.const must be one of ${o}.enum when both are declared`):n.push(`${o}.const must be a ${f} value`));break}default:z(f,"JsonSchemaType")}}}c(qe,"checkSchemaNode");function J(e){const t=[];if(qe(e,"schema",t,new Set),t.length>0)throw new Q(t)}c(J,"assertSupportedJsonSchema");function Ct(e){const t=[];if(qe(e,"schema",t,new Set),t.length===0&&(!_(e)||!Object.hasOwn(e,"type")||e.type!=="object")&&t.push('schema.type must be "object" (structured output is object-rooted)'),t.length>0)throw new Q(t)}c(Ct,"assertObjectJsonSchema");function le(e){try{return Re(e)}catch{return!1}}c(le,"safelyIsJsonValue");function v(e){return e===""?"arguments":e}c(v,"diagnosticPath");function de(e,t){return e===""?t:`${e}.${t}`}c(de,"propertyPath");function ue(e){return[`"${v(e)}" must be a lossless JSON value`]}c(ue,"losslessValueViolation");function Je(e,t){for(const n of t)e.push(n)}c(Je,"appendViolations");function Me(e,t,n){return{node:e,value:t,path:n,catches:!1,phase:"start",children:[],childIndex:0,violations:[],tailViolations:[],matches:0}}c(Me,"valueFrame");function V(e,t,n){const r=Object.hasOwn(e,"enum")?e.enum:void 0;return r!==void 0&&!r.includes(t)?[`"${v(n)}" must be one of ${JSON.stringify(r)}`]:Object.hasOwn(e,"const")&&t!==e.const?[`"${v(n)}" must be ${JSON.stringify(e.const)}`]:[]}c(V,"checkScalarValue");function jt(e,t,n){const r=[Me(e,t,n)];let i;const s=c(o=>{const l=r.at(-1);if(l===void 0){i=o;return}l.kind==="oneOf"?o.length===0&&l.matches++:Je(l.violations,o)},"receive"),a=c(o=>{r.pop(),s(o)},"finish");for(;r.length>0;){const o=r.at(-1);if(o===void 0)break;try{if(o.phase==="children"){if(o.childIndex<o.children.length){const d=o.children[o.childIndex];if(d===void 0)throw new Error("missing schema-value child frame");o.childIndex++,r.push(Me(d.node,d.value,d.path));continue}if(o.kind==="oneOf"){a(o.matches===1?[]:[`"${v(o.path)}" must match exactly one oneOf branch (matched ${o.matches})`]);continue}Je(o.violations,o.tailViolations),o.violations.length>0?a(o.violations):o.kind==="object"?a(le(o.value)?[]:[`"${v(o.path)}" must be a lossless JSON object`]):a(le(o.value)?[]:[`"${v(o.path)}" must be a dense lossless JSON array`]);continue}const l=Object.hasOwn(o.node,"type")?o.node.type:void 0;o.catches=!(l!==void 0&&!ce.includes(l));const u=Object.hasOwn(o.node,"oneOf")?o.node.oneOf:void 0;if(u!==void 0){o.kind="oneOf",o.children=Array.from(u,d=>({node:d,value:o.value,path:o.path})),o.childIndex=0,o.matches=0,o.phase="children";continue}if(l===void 0){a(le(o.value)?[]:ue(o.path));continue}switch(l){case"object":{if(!Pe(o.value)){a([`"${v(o.path)}" must be an object`]);break}const d=Object.hasOwn(o.node,"properties")?o.node.properties??{}:{},f=[],p=Object.hasOwn(o.node,"required")?o.node.required??[]:[];for(const m of p)(!Object.hasOwn(o.value,m)||o.value[m]===void 0)&&f.push(`missing required property "${de(o.path,m)}"`);const h=[];for(const[m,b]of Object.entries(d))!Object.hasOwn(o.value,m)||o.value[m]===void 0||h.push({node:b,value:o.value[m],path:de(o.path,m)});const y=[];if(Object.hasOwn(o.node,"additionalProperties")&&o.node.additionalProperties===!1)for(const m of Object.keys(o.value))Object.hasOwn(d,m)||y.push(`"${de(o.path,m)}" is not a declared property (additionalProperties: false)`);o.kind="object",o.children=h,o.childIndex=0,o.violations=f,o.tailViolations=y,o.phase="children";break}case"array":{if(!Array.isArray(o.value)){a([`"${v(o.path)}" must be an array`]);break}const d=Object.hasOwn(o.node,"items")?o.node.items:void 0,f=d===void 0?[]:o.value.flatMap((p,h)=>[{node:d,value:p,path:`${o.path}[${h}]`}]);o.kind="array",o.children=f,o.childIndex=0,o.violations=[],o.phase="children";break}case"string":a(typeof o.value=="string"?V(o.node,o.value,o.path):[`"${v(o.path)}" must be a string`]);break;case"number":a(typeof o.value!="number"?[`"${v(o.path)}" must be a number`]:Z(o.value)?V(o.node,o.value,o.path):[`"${v(o.path)}" must be a finite JSON number`]);break;case"integer":a(!Z(o.value)||!Number.isInteger(o.value)?[`"${v(o.path)}" must be an integer`]:V(o.node,o.value,o.path));break;case"boolean":a(typeof o.value=="boolean"?V(o.node,o.value,o.path):[`"${v(o.path)}" must be a boolean`]);break;case"null":a(o.value===null?V(o.node,o.value,o.path):[`"${v(o.path)}" must be null`]);break;default:a(z(l,"JsonSchemaType"))}}catch(l){let u=r.pop();for(;u!==void 0&&!u.catches;)u=r.pop();if(u===void 0)throw l;s(ue(u.path))}}return i??ue(n)}c(jt,"checkValue");function ee(e,t,n="value"){return jt(e,t,n)}c(ee,"validateJsonSchemaValue");const xt=["description","title","default","examples"];function O(e){throw new Q([e])}c(O,"authorError");function K(e,t){Object.hasOwn(e,"description")&&(t.description=e.description),Object.hasOwn(e,"title")&&(t.title=e.title),Object.hasOwn(e,"default")&&(t.default=e.default),Object.hasOwn(e,"examples")&&(t.examples=e.examples)}c(K,"copyAnnotations");function U(e,t,n){for(const r of Object.keys(e))n.includes(r)||O(`${t}.${r} is not supported by the value schema DSL`)}c(U,"assertAuthorKeys");function Tt(e,t){switch(e.kind){case"root":e.holder.value=t;break;case"property":Object.defineProperty(e.target,e.key,{value:t,enumerable:!0,configurable:!0,writable:!0});break;case"item":e.target.items=t;break;case"one-of":e.target[e.index]=t}}c(Tt,"assignCompiledNode");function Nt(e,t){e.kind==="root"?e.holder.value=t:e.target.properties=t.properties}c(Nt,"assignCompiledPropertyMap");function Fe(e){const t=new Set,n=[e];for(let r=n.pop();r!==void 0;r=n.pop()){if(r.kind==="leave"){t.delete(r.input);continue}if(r.kind==="property-map-tail"){r.required.length>0&&(r.compiled.required=r.required,r.destination.kind==="object"&&(r.destination.target.required=r.required));continue}if(r.kind==="property"){_(r.property)||O(`${r.path} must be a value schema object`),Object.hasOwn(r.property,"required")&&r.property.required!==!0&&O(`${r.path}.required must be true when present`),Object.hasOwn(r.property,"required")&&r.property.required===!0&&r.required.push(r.key),n.push({kind:"value",input:r.property,path:r.path,allowRequired:!0,destination:{kind:"property",target:r.properties,key:r.key}});continue}if(r.kind==="property-map"){_(r.input)||O(`${r.path} must be an object of value schemas`),t.has(r.input)&&O(`${r.path} is circular`),t.add(r.input);const u={properties:{}},d=[];Nt(r.destination,u),n.push({kind:"leave",input:r.input}),n.push({kind:"property-map-tail",compiled:u,required:d,destination:r.destination});const f=Object.entries(r.input);for(let p=f.length-1;p>=0;p--){const h=f[p];h!==void 0&&n.push({kind:"property",property:h[1],path:`${r.path}.${h[0]}`,key:h[0],properties:u.properties,required:d})}continue}const{input:i,path:s}=r;_(i)||O(`${s} must be a value schema object`),t.has(i)&&O(`${s} is circular`),t.add(i);const a=[...xt,...r.allowRequired?["required"]:[]],o={};if(Tt(r.destination,o),n.push({kind:"leave",input:i}),Object.hasOwn(i,"oneOf")){U(i,s,[...a,"oneOf","type"]),Object.hasOwn(i,"type")&&O(`${s} cannot declare both type and oneOf`),L(i.oneOf)||O(`${s}.oneOf must be an array of at least two value schemas`);const u=[];o.oneOf=u,K(i,o);for(let d=i.oneOf.length-1;d>=0;d--)n.push({kind:"value",input:i.oneOf[d],path:`${s}.oneOf[${d}]`,allowRequired:!1,destination:{kind:"one-of",target:u,index:d}});continue}const l=Object.hasOwn(i,"type")?i.type:void 0;switch(l){case"json":U(i,s,[...a,"type"]),K(i,o);break;case"object":U(i,s,[...a,"type","properties","additionalProperties"]),(!Object.hasOwn(i,"additionalProperties")||typeof i.additionalProperties!="boolean")&&O(`${s}.additionalProperties must be explicitly true or false`),o.type="object",K(i,o),o.additionalProperties=i.additionalProperties,Object.hasOwn(i,"properties")&&n.push({kind:"property-map",input:i.properties,path:`${s}.properties`,destination:{kind:"object",target:o}});break;case"array":U(i,s,[...a,"type","items"]),o.type="array",K(i,o),Object.hasOwn(i,"items")&&n.push({kind:"value",input:i.items,path:`${s}.items`,allowRequired:!1,destination:{kind:"item",target:o}});break;case"string":case"number":case"integer":case"boolean":case"null":U(i,s,[...a,"type","enum","const"]),o.type=l,K(i,o),Object.hasOwn(i,"enum")&&(L(i.enum)||O(`${s}.enum must be a non-empty array of scalar values`),o.enum=Array.from(i.enum,u=>u)),Object.hasOwn(i,"const")&&(o.const=i.const);break;default:O(`${s}.type must be string/number/integer/boolean/null/array/object/json, or use oneOf`)}}}c(Fe,"runSchemaCompiler");function Rt(e,t){const n={};return Fe({kind:"property-map",input:e,path:t,destination:{kind:"root",holder:n}}),n.value??O(`${t} did not compile`)}c(Rt,"compilePropertyMap");function At(e,t){const n={};return Fe({kind:"value",input:e,path:t,allowRequired:!1,destination:{kind:"root",holder:n}}),n.value??O(`${t} did not compile`)}c(At,"compileValueSchema");function ze(e){const t=At(e,"schema");return J(t),t}c(ze,"valueSchemaSpecToJsonSchema");function te(e){const t=Rt(e,"parameters"),n={type:"object",properties:t.properties,...t.required===void 0?{}:{required:t.required}};return J(n),n}c(te,"parameterSchemaSpecToJsonSchema");var Le=class extends q{static{c(this,"ToolArgsError")}violations;constructor(e){super(`invalid arguments: ${e.join("; ")}`,"INVALID_ARGS"),this.name="ToolArgsError",this.violations=e}};function It(e,t){return ee(te(e),t,"")}c(It,"validateArgs");function pe(e){const t=e.execute,n=e.finalizeContent,r=e.output.render,i=e.output.presentationMeta,s=e.presentCall,a=e.presentResult,o=e.isConcurrencySafe;if(e.timeoutMs!==void 0&&(!Number.isFinite(e.timeoutMs)||e.timeoutMs<=0))throw new Error(`defineTool(${e.name}): timeoutMs must be a positive finite number`);const l=te(e.parameters),u=ze(e.output.schema),d=c(p=>ee(l,p,""),"validate"),f={name:e.name,description:e.description,parameters:l,output:{schema:u,render(p,h){return r(p,h)},...i!==void 0?{presentationMeta(p,h){return i(p,h)}}:{}},...e.timeoutMs!==void 0?{timeoutMs:e.timeoutMs}:{},async execute(p,h){const y=d(p);if(y.length>0)throw new Le(y);return t(p,h)}};return n&&(f.finalizeContent=(p,h)=>n(p,h)),s&&(f.presentCall=p=>{if(!(d(p).length>0))return s(p)}),a&&(f.presentResult=(p,h)=>{if(!(d(p).length>0))return a(p,h)}),o&&(f.isConcurrencySafe=p=>d(p).length>0?!1:o(p)),f}c(pe,"defineTool");const k="run_code",ne={description:"Execute a TypeScript program against the available tools. Takes two required arguments: `code`, the BODY of an async function (erasable syntax only; top-level `await` and `return` work), and `description`, a short summary of what the program does. Call tools as `await tools.name(args)` per the declarations in the system prompt. Only what you print or return comes back — curate it.",codeDescription:"The program: the body of an async TypeScript function."},he={typescript:ne,python:{description:"Execute a Python program against the available tools. Takes two required arguments: `code`, the BODY of an async function (top-level `await` and `return` work), and `description`, a short summary of what the program does. Call tools as `await tools.name(args)` per the declarations in the system prompt. Answer with `print(...)` and/or `return <value>` — only that comes back, so curate it.",codeDescription:"The program: the body of an async Python function."}},Ve='Clear, concise description of what this program does in active voice, 5-10 words (shown in the UI). Examples: "Count TODO markers across packages"; "Read failing test and its fixture"; "Rename config key in every cordis.yml".';function Ke(e){const t=e();if(t===void 0)return ne;const n=he[t.language];if(!Object.hasOwn(he,t.language)||n===void 0){const r=Object.keys(he).map(i=>JSON.stringify(i)).join(", ");throw new Error(`dsh-tools: no run_code schema flavor registered for runtime language ${JSON.stringify(t.language)} (known: ${r})`)}return n}c(Ke,"resolveFlavor");var Ue=class extends q{static{c(this,"CodeRunFailedError")}constructor(e){super(e,"CODE_RUN_FAILED"),this.name="CodeRunFailedError"}};function Pt(e){let t;try{t=N(e)}catch(r){throw new Error(`tool arguments must be lossless JSON: ${r instanceof Error?r.message:String(r)}`)}if(t===void 0)throw new Error("tool arguments must be lossless JSON (call the tool with an arguments object, e.g. `{}`)");const n=N(t);if(n===void 0)throw new Error("tool arguments could not be detached for durable logging");return{dispatched:t,logged:n}}c(Pt,"jsonNormalizeArgs");const oe=" ",Dt=10;function _t(e){const t=[],n=[{kind:"value",value:e,depth:0,compact:!1}];for(let r=n.pop();r!==void 0;r=n.pop()){if(r.kind==="text"){t.push(r.text);continue}const i=r.value;if(i===null||typeof i=="boolean"||typeof i=="number"){t.push(String(i));continue}if(typeof i=="string"){t.push(JSON.stringify(i));continue}const s=r.compact||(r.depth+1)*2>Dt,a=r.depth+1;if(Array.isArray(i)){if(t.push("["),i.length===0){t.push("]");continue}n.push({kind:"text",text:s?"]":`
|
|
2
|
-
${oe.repeat(r.depth)}]`});for(let l=i.length-1;l>=0;l--){const
|
|
1
|
+
var yt=Object.defineProperty;var c=(e,t)=>yt(e,"name",{value:t,configurable:!0});import{Service as gt}from"@deepseek-ai/cordis";import ae from"@deepseek-ai/schemastery";import{AnonymousEntries as Te,NamedEntries as bt,ScopedLayers as wt,scopeOf as Ne,scopeTarget as F}from"@deepseek-ai/dsh-scope";import{CallId as vt,HarnessError as q,assertNever as z,createUserMessage as Ot,deepFreeze as G}from"@deepseek-ai/dsh-llm";import{isJsonValue as Re,snapshotJsonValue as N}from"@deepseek-ai/dsh-session";var Q=class extends q{static{c(this,"JsonSchemaError")}violations;constructor(e){super(`unsupported JSON schema: ${e.join("; ")}`,"UNSUPPORTED_SCHEMA"),this.name="JsonSchemaError",this.violations=e}};const kt=new Set(["type","oneOf","properties","required","additionalProperties","items","enum","const"]),$t=new Set(["description","title","default","examples"]),ce=["object","array","string","number","integer","boolean","null"];function Ae(e,t){const n=Object.getOwnPropertyDescriptor(e,"constructor")?.value;if(typeof n!="function")return!1;try{return n.name===t&&n.prototype===e&&Function.prototype.toString.call(n)===`function ${t}() { [native code] }`}catch{return!1}}c(Ae,"hasIntrinsicConstructor");function Ie(e){return Object.getPrototypeOf(e)===null&&Ae(e,"Object")}c(Ie,"isIntrinsicObjectPrototype");function Pe(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;try{const t=Object.getPrototypeOf(e);return t===null||typeof t=="object"&&Ie(t)}catch{return!1}}c(Pe,"isPlainJsonRecord");function St(e){const t=Object.getPrototypeOf(e);if(!Array.isArray(t)||!Ae(t,"Array"))return!1;const n=Object.getPrototypeOf(t);return typeof n=="object"&&n!==null&&Ie(n)}c(St,"hasPlainArrayPrototype");function Et(e){try{return Reflect.ownKeys(e).every(t=>typeof t=="string"&&Object.prototype.propertyIsEnumerable.call(e,t))}catch{return!1}}c(Et,"hasOnlyEnumerableStringKeys");function _(e){return Pe(e)&&Et(e)}c(_,"isJsonSchemaRecord");function L(e){if(!Array.isArray(e))return!1;try{if(!St(e)||Reflect.ownKeys(e).length!==e.length+1)return!1;for(let t=0;t<e.length;t++)if(!Object.hasOwn(e,t))return!1;return!0}catch{return!1}}c(L,"isPlainJsonArray");function Z(e){return typeof e=="number"&&Number.isFinite(e)&&!Object.is(e,-0)}c(Z,"isJsonNumber");function De(e,t){switch(e){case"string":return typeof t=="string";case"number":return Z(t);case"integer":return Z(t)&&Number.isInteger(t);case"boolean":return typeof t=="boolean";case"null":return t===null;default:return z(e,"JsonSchemaType")}}c(De,"scalarMatches");const _e=["properties","required","additionalProperties","items","enum","const"];function Ct(e,t,n,r){const i=Object.hasOwn(e,"required"),s=i?e.required:void 0;if(i)if(!L(s)||s.some(a=>typeof a!="string"))r.push(`${t}.required must be an array of strings`);else{const a=_(n)?n:{};for(const o of s)Object.hasOwn(a,o)||r.push(`${t}.required names "${o}" which is not in properties`)}Object.hasOwn(e,"additionalProperties")&&typeof e.additionalProperties!="boolean"&&r.push(`${t}.additionalProperties must be a boolean`)}c(Ct,"checkObjectSchemaTail");function qe(e,t,n,r){const i=[{kind:"enter",node:e,path:t}];for(let s=i.pop();s!==void 0;s=i.pop()){if(s.kind==="leave"){r.delete(s.node);continue}if(s.kind==="one-of-tail"){for(const p of _e)Object.hasOwn(s.node,p)&&n.push(`${s.path}.${p} is not supported beside oneOf`);continue}if(s.kind==="object-tail"){Ct(s.node,s.path,s.properties,n);continue}const{node:a,path:o}=s;if(!_(a)){n.push(`${o} must be a schema object`);continue}if(r.has(a)){n.push(`${o} is circular`);continue}r.add(a),i.push({kind:"leave",node:a});for(const p of Object.keys(a))if(!kt.has(p)){if($t.has(p)){try{Re(a[p])||n.push(`${o}.${p} annotation must be lossless JSON data`)}catch{n.push(`${o}.${p} annotation must be lossless JSON data`)}continue}n.push(`${o}.${p} is not a supported keyword (subset: type/oneOf/properties/required/additionalProperties/items/enum/const + annotations)`)}Object.hasOwn(a,"description")&&typeof a.description!="string"&&n.push(`${o}.description must be a string`),Object.hasOwn(a,"title")&&typeof a.title!="string"&&n.push(`${o}.title must be a string`);const l=Object.hasOwn(a,"type"),d=Object.hasOwn(a,"oneOf");if(l&&d){n.push(`${o} cannot declare both type and oneOf`);continue}if(!l&&!d){for(const p of _e)Object.hasOwn(a,p)&&n.push(`${o}.${p} requires type or oneOf`);continue}if(d){const p=a.oneOf;if(i.push({kind:"one-of-tail",node:a,path:o}),!L(p)||p.length<2)n.push(`${o}.oneOf must be an array of at least two schemas`);else for(let h=p.length-1;h>=0;h--)i.push({kind:"enter",node:p[h],path:`${o}.oneOf[${h}]`});continue}const u=a.type;if(typeof u!="string"||!ce.includes(u)){n.push(Array.isArray(u)?`${o}.type must be a single type string (type arrays are not supported)`:`${o}.type must be one of ${ce.join("/")}`);continue}const f=u;for(const[p,h]of Object.entries({properties:["object"],required:["object"],additionalProperties:["object"],items:["array"],enum:["string","number","integer","boolean","null"],const:["string","number","integer","boolean","null"]}))Object.hasOwn(a,p)&&!h.includes(f)&&n.push(`${o}.${p} is not supported on type "${f}"`);switch(f){case"object":{const p=Object.hasOwn(a,"properties")?a.properties:void 0;if(i.push({kind:"object-tail",node:a,path:o,properties:p}),Object.hasOwn(a,"properties"))if(!_(p))n.push(`${o}.properties must be an object of schemas`);else{const h=Object.entries(p);for(let y=h.length-1;y>=0;y--){const m=h[y];m!==void 0&&i.push({kind:"enter",node:m[1],path:`${o}.properties.${m[0]}`})}}break}case"array":Object.hasOwn(a,"items")&&i.push({kind:"enter",node:a.items,path:`${o}.items`});break;case"string":case"number":case"integer":case"boolean":case"null":{const p=Object.hasOwn(a,"enum"),h=p?a.enum:void 0,y=L(h)&&h.length>0&&h.every(j=>De(f,j));p&&!y&&n.push(`${o}.enum must be a non-empty array of ${f} values`);const m=Object.hasOwn(a,"const"),b=m?a.const:void 0,I=De(f,b);m&&(I?y&&!h.includes(b)&&n.push(`${o}.const must be one of ${o}.enum when both are declared`):n.push(`${o}.const must be a ${f} value`));break}default:z(f,"JsonSchemaType")}}}c(qe,"checkSchemaNode");function J(e){const t=[];if(qe(e,"schema",t,new Set),t.length>0)throw new Q(t)}c(J,"assertSupportedJsonSchema");function jt(e){const t=[];if(qe(e,"schema",t,new Set),t.length===0&&(!_(e)||!Object.hasOwn(e,"type")||e.type!=="object")&&t.push('schema.type must be "object" (structured output is object-rooted)'),t.length>0)throw new Q(t)}c(jt,"assertObjectJsonSchema");function le(e){try{return Re(e)}catch{return!1}}c(le,"safelyIsJsonValue");function v(e){return e===""?"arguments":e}c(v,"diagnosticPath");function ue(e,t){return e===""?t:`${e}.${t}`}c(ue,"propertyPath");function de(e){return[`"${v(e)}" must be a lossless JSON value`]}c(de,"losslessValueViolation");function Je(e,t){for(const n of t)e.push(n)}c(Je,"appendViolations");function Me(e,t,n){return{node:e,value:t,path:n,catches:!1,phase:"start",children:[],childIndex:0,violations:[],tailViolations:[],matches:0}}c(Me,"valueFrame");function V(e,t,n){const r=Object.hasOwn(e,"enum")?e.enum:void 0;return r!==void 0&&!r.includes(t)?[`"${v(n)}" must be one of ${JSON.stringify(r)}`]:Object.hasOwn(e,"const")&&t!==e.const?[`"${v(n)}" must be ${JSON.stringify(e.const)}`]:[]}c(V,"checkScalarValue");function xt(e,t,n){const r=[Me(e,t,n)];let i;const s=c(o=>{const l=r.at(-1);if(l===void 0){i=o;return}l.kind==="oneOf"?o.length===0&&l.matches++:Je(l.violations,o)},"receive"),a=c(o=>{r.pop(),s(o)},"finish");for(;r.length>0;){const o=r.at(-1);if(o===void 0)break;try{if(o.phase==="children"){if(o.childIndex<o.children.length){const u=o.children[o.childIndex];if(u===void 0)throw new Error("missing schema-value child frame");o.childIndex++,r.push(Me(u.node,u.value,u.path));continue}if(o.kind==="oneOf"){a(o.matches===1?[]:[`"${v(o.path)}" must match exactly one oneOf branch (matched ${o.matches})`]);continue}Je(o.violations,o.tailViolations),o.violations.length>0?a(o.violations):o.kind==="object"?a(le(o.value)?[]:[`"${v(o.path)}" must be a lossless JSON object`]):a(le(o.value)?[]:[`"${v(o.path)}" must be a dense lossless JSON array`]);continue}const l=Object.hasOwn(o.node,"type")?o.node.type:void 0;o.catches=!(l!==void 0&&!ce.includes(l));const d=Object.hasOwn(o.node,"oneOf")?o.node.oneOf:void 0;if(d!==void 0){o.kind="oneOf",o.children=Array.from(d,u=>({node:u,value:o.value,path:o.path})),o.childIndex=0,o.matches=0,o.phase="children";continue}if(l===void 0){a(le(o.value)?[]:de(o.path));continue}switch(l){case"object":{if(!Pe(o.value)){a([`"${v(o.path)}" must be an object`]);break}const u=Object.hasOwn(o.node,"properties")?o.node.properties??{}:{},f=[],p=Object.hasOwn(o.node,"required")?o.node.required??[]:[];for(const m of p)(!Object.hasOwn(o.value,m)||o.value[m]===void 0)&&f.push(`missing required property "${ue(o.path,m)}"`);const h=[];for(const[m,b]of Object.entries(u))!Object.hasOwn(o.value,m)||o.value[m]===void 0||h.push({node:b,value:o.value[m],path:ue(o.path,m)});const y=[];if(Object.hasOwn(o.node,"additionalProperties")&&o.node.additionalProperties===!1)for(const m of Object.keys(o.value))Object.hasOwn(u,m)||y.push(`"${ue(o.path,m)}" is not a declared property (additionalProperties: false)`);o.kind="object",o.children=h,o.childIndex=0,o.violations=f,o.tailViolations=y,o.phase="children";break}case"array":{if(!Array.isArray(o.value)){a([`"${v(o.path)}" must be an array`]);break}const u=Object.hasOwn(o.node,"items")?o.node.items:void 0,f=u===void 0?[]:o.value.flatMap((p,h)=>[{node:u,value:p,path:`${o.path}[${h}]`}]);o.kind="array",o.children=f,o.childIndex=0,o.violations=[],o.phase="children";break}case"string":a(typeof o.value=="string"?V(o.node,o.value,o.path):[`"${v(o.path)}" must be a string`]);break;case"number":a(typeof o.value!="number"?[`"${v(o.path)}" must be a number`]:Z(o.value)?V(o.node,o.value,o.path):[`"${v(o.path)}" must be a finite JSON number`]);break;case"integer":a(!Z(o.value)||!Number.isInteger(o.value)?[`"${v(o.path)}" must be an integer`]:V(o.node,o.value,o.path));break;case"boolean":a(typeof o.value=="boolean"?V(o.node,o.value,o.path):[`"${v(o.path)}" must be a boolean`]);break;case"null":a(o.value===null?V(o.node,o.value,o.path):[`"${v(o.path)}" must be null`]);break;default:a(z(l,"JsonSchemaType"))}}catch(l){let d=r.pop();for(;d!==void 0&&!d.catches;)d=r.pop();if(d===void 0)throw l;s(de(d.path))}}return i??de(n)}c(xt,"checkValue");function ee(e,t,n="value"){return xt(e,t,n)}c(ee,"validateJsonSchemaValue");const Tt=["description","title","default","examples"];function O(e){throw new Q([e])}c(O,"authorError");function K(e,t){Object.hasOwn(e,"description")&&(t.description=e.description),Object.hasOwn(e,"title")&&(t.title=e.title),Object.hasOwn(e,"default")&&(t.default=e.default),Object.hasOwn(e,"examples")&&(t.examples=e.examples)}c(K,"copyAnnotations");function U(e,t,n){for(const r of Object.keys(e))n.includes(r)||O(`${t}.${r} is not supported by the value schema DSL`)}c(U,"assertAuthorKeys");function Nt(e,t){switch(e.kind){case"root":e.holder.value=t;break;case"property":Object.defineProperty(e.target,e.key,{value:t,enumerable:!0,configurable:!0,writable:!0});break;case"item":e.target.items=t;break;case"one-of":e.target[e.index]=t}}c(Nt,"assignCompiledNode");function Rt(e,t){e.kind==="root"?e.holder.value=t:e.target.properties=t.properties}c(Rt,"assignCompiledPropertyMap");function Fe(e){const t=new Set,n=[e];for(let r=n.pop();r!==void 0;r=n.pop()){if(r.kind==="leave"){t.delete(r.input);continue}if(r.kind==="property-map-tail"){r.required.length>0&&(r.compiled.required=r.required,r.destination.kind==="object"&&(r.destination.target.required=r.required));continue}if(r.kind==="property"){_(r.property)||O(`${r.path} must be a value schema object`),Object.hasOwn(r.property,"required")&&r.property.required!==!0&&O(`${r.path}.required must be true when present`),Object.hasOwn(r.property,"required")&&r.property.required===!0&&r.required.push(r.key),n.push({kind:"value",input:r.property,path:r.path,allowRequired:!0,destination:{kind:"property",target:r.properties,key:r.key}});continue}if(r.kind==="property-map"){_(r.input)||O(`${r.path} must be an object of value schemas`),t.has(r.input)&&O(`${r.path} is circular`),t.add(r.input);const d={properties:{}},u=[];Rt(r.destination,d),n.push({kind:"leave",input:r.input}),n.push({kind:"property-map-tail",compiled:d,required:u,destination:r.destination});const f=Object.entries(r.input);for(let p=f.length-1;p>=0;p--){const h=f[p];h!==void 0&&n.push({kind:"property",property:h[1],path:`${r.path}.${h[0]}`,key:h[0],properties:d.properties,required:u})}continue}const{input:i,path:s}=r;_(i)||O(`${s} must be a value schema object`),t.has(i)&&O(`${s} is circular`),t.add(i);const a=[...Tt,...r.allowRequired?["required"]:[]],o={};if(Nt(r.destination,o),n.push({kind:"leave",input:i}),Object.hasOwn(i,"oneOf")){U(i,s,[...a,"oneOf","type"]),Object.hasOwn(i,"type")&&O(`${s} cannot declare both type and oneOf`),L(i.oneOf)||O(`${s}.oneOf must be an array of at least two value schemas`);const d=[];o.oneOf=d,K(i,o);for(let u=i.oneOf.length-1;u>=0;u--)n.push({kind:"value",input:i.oneOf[u],path:`${s}.oneOf[${u}]`,allowRequired:!1,destination:{kind:"one-of",target:d,index:u}});continue}const l=Object.hasOwn(i,"type")?i.type:void 0;switch(l){case"json":U(i,s,[...a,"type"]),K(i,o);break;case"object":U(i,s,[...a,"type","properties","additionalProperties"]),(!Object.hasOwn(i,"additionalProperties")||typeof i.additionalProperties!="boolean")&&O(`${s}.additionalProperties must be explicitly true or false`),o.type="object",K(i,o),o.additionalProperties=i.additionalProperties,Object.hasOwn(i,"properties")&&n.push({kind:"property-map",input:i.properties,path:`${s}.properties`,destination:{kind:"object",target:o}});break;case"array":U(i,s,[...a,"type","items"]),o.type="array",K(i,o),Object.hasOwn(i,"items")&&n.push({kind:"value",input:i.items,path:`${s}.items`,allowRequired:!1,destination:{kind:"item",target:o}});break;case"string":case"number":case"integer":case"boolean":case"null":U(i,s,[...a,"type","enum","const"]),o.type=l,K(i,o),Object.hasOwn(i,"enum")&&(L(i.enum)||O(`${s}.enum must be a non-empty array of scalar values`),o.enum=Array.from(i.enum,d=>d)),Object.hasOwn(i,"const")&&(o.const=i.const);break;default:O(`${s}.type must be string/number/integer/boolean/null/array/object/json, or use oneOf`)}}}c(Fe,"runSchemaCompiler");function At(e,t){const n={};return Fe({kind:"property-map",input:e,path:t,destination:{kind:"root",holder:n}}),n.value??O(`${t} did not compile`)}c(At,"compilePropertyMap");function It(e,t){const n={};return Fe({kind:"value",input:e,path:t,allowRequired:!1,destination:{kind:"root",holder:n}}),n.value??O(`${t} did not compile`)}c(It,"compileValueSchema");function ze(e){const t=It(e,"schema");return J(t),t}c(ze,"valueSchemaSpecToJsonSchema");function te(e){const t=At(e,"parameters"),n={type:"object",properties:t.properties,...t.required===void 0?{}:{required:t.required}};return J(n),n}c(te,"parameterSchemaSpecToJsonSchema");var Le=class extends q{static{c(this,"ToolArgsError")}violations;constructor(e){super(`invalid arguments: ${e.join("; ")}`,"INVALID_ARGS"),this.name="ToolArgsError",this.violations=e}};function Pt(e,t){return ee(te(e),t,"")}c(Pt,"validateArgs");function pe(e){const t=e.execute,n=e.finalizeContent,r=e.output.render,i=e.output.presentationMeta,s=e.presentCall,a=e.presentResult,o=e.isConcurrencySafe;if(e.timeoutMs!==void 0&&(!Number.isFinite(e.timeoutMs)||e.timeoutMs<=0))throw new Error(`defineTool(${e.name}): timeoutMs must be a positive finite number`);const l=te(e.parameters),d=ze(e.output.schema),u=c(p=>ee(l,p,""),"validate"),f={name:e.name,description:e.description,parameters:l,output:{schema:d,render(p,h){return r(p,h)},...i!==void 0?{presentationMeta(p,h){return i(p,h)}}:{}},...e.timeoutMs!==void 0?{timeoutMs:e.timeoutMs}:{},async execute(p,h){const y=u(p);if(y.length>0)throw new Le(y);return t(p,h)}};return n&&(f.finalizeContent=(p,h)=>n(p,h)),s&&(f.presentCall=p=>{if(!(u(p).length>0))return s(p)}),a&&(f.presentResult=(p,h)=>{if(!(u(p).length>0))return a(p,h)}),o&&(f.isConcurrencySafe=p=>u(p).length>0?!1:o(p)),f}c(pe,"defineTool");const k="run_code",ne={description:"Execute a TypeScript program against the available tools. Takes two required arguments: `code`, the BODY of an async function (erasable syntax only; top-level `await` and `return` work), and `description`, a short summary of what the program does. Call tools as `await tools.name(args)` per the declarations in the system prompt. Only what you print or return is program output — curate it. Image-bearing subtool results are attached after the run.",codeDescription:"The program: the body of an async TypeScript function."},he={typescript:ne,python:{description:"Execute a Python program against the available tools. Takes two required arguments: `code`, the BODY of an async function (top-level `await` and `return` work), and `description`, a short summary of what the program does. Call tools as `await tools.name(args)` per the declarations in the system prompt. Use `print(...)` and/or `return <value>` for program output — curate it. Image-bearing subtool results are attached after the run.",codeDescription:"The program: the body of an async Python function."}},Ve='Clear, concise description of what this program does in active voice, 5-10 words (shown in the UI). Examples: "Count TODO markers across packages"; "Read failing test and its fixture"; "Rename config key in every cordis.yml".';function Ke(e){const t=e();if(t===void 0)return ne;const n=he[t.language];if(!Object.hasOwn(he,t.language)||n===void 0){const r=Object.keys(he).map(i=>JSON.stringify(i)).join(", ");throw new Error(`dsh-tools: no run_code schema flavor registered for runtime language ${JSON.stringify(t.language)} (known: ${r})`)}return n}c(Ke,"resolveFlavor");var Ue=class extends q{static{c(this,"CodeRunFailedError")}constructor(e){super(e,"CODE_RUN_FAILED"),this.name="CodeRunFailedError"}};function Dt(e){let t;try{t=N(e)}catch(r){throw new Error(`tool arguments must be lossless JSON: ${r instanceof Error?r.message:String(r)}`)}if(t===void 0)throw new Error("tool arguments must be lossless JSON (call the tool with an arguments object, e.g. `{}`)");const n=N(t);if(n===void 0)throw new Error("tool arguments could not be detached for durable logging");return{dispatched:t,logged:n}}c(Dt,"jsonNormalizeArgs");const oe=" ",_t=10;function qt(e){const t=[],n=[{kind:"value",value:e,depth:0,compact:!1}];for(let r=n.pop();r!==void 0;r=n.pop()){if(r.kind==="text"){t.push(r.text);continue}const i=r.value;if(i===null||typeof i=="boolean"||typeof i=="number"){t.push(String(i));continue}if(typeof i=="string"){t.push(JSON.stringify(i));continue}const s=r.compact||(r.depth+1)*2>_t,a=r.depth+1;if(Array.isArray(i)){if(t.push("["),i.length===0){t.push("]");continue}n.push({kind:"text",text:s?"]":`
|
|
2
|
+
${oe.repeat(r.depth)}]`});for(let l=i.length-1;l>=0;l--){const d=i[l];if(d===void 0)throw new Error("cannot render a sparse JSON array");n.push({kind:"value",value:d,depth:a,compact:s}),n.push({kind:"text",text:s?l===0?"":",":`${l===0?`
|
|
3
3
|
`:`,
|
|
4
4
|
`}${oe.repeat(a)}`})}continue}const o=Object.keys(i);if(t.push("{"),o.length===0){t.push("}");continue}n.push({kind:"text",text:s?"}":`
|
|
5
|
-
${oe.repeat(r.depth)}}`});for(let l=o.length-1;l>=0;l--){const
|
|
5
|
+
${oe.repeat(r.depth)}}`});for(let l=o.length-1;l>=0;l--){const d=o[l];if(d===void 0)throw new Error("cannot render a missing JSON object key");const u=i[d];if(u===void 0)throw new Error("cannot render an undefined JSON object property");n.push({kind:"value",value:u,depth:a,compact:s}),n.push({kind:"text",text:s?`${l===0?"":","}${JSON.stringify(d)}:`:`${l===0?`
|
|
6
6
|
`:`,
|
|
7
|
-
`}${oe.repeat(a)}${JSON.stringify(
|
|
8
|
-
`),
|
|
9
|
-
`):"(run_code completed with no output)"}]},"render")},async execute(o,l){if(o.description.trim().length===0)throw new Error("invalid description: expected a non-empty string");const
|
|
7
|
+
`}${oe.repeat(a)}${JSON.stringify(d)}: `})}}return t.join("")}c(qt,"renderJsonValue");function Jt(e){return typeof e=="string"?e:qt(e)}c(Jt,"renderValue");function Mt(e,t){const{requireRuntime:n,peekRuntime:r,maxParallel:i,shapeDispatchLog:s}=t,a=pe({name:k,description:ne.description,parameters:{code:{type:"string",required:!0,description:ne.codeDescription},description:{type:"string",required:!0,description:Ve}},output:{schema:{type:"object",additionalProperties:!1,properties:{logs:{type:"array",required:!0,items:{type:"string"}},result:{type:"json"}}},render:c((o,l)=>{const d=l.result===void 0?"":Jt(l.result),u=[l.logs.join(`
|
|
8
|
+
`),d].filter(f=>f.length>0);return[{type:"text",text:u.length>0?u.join(`
|
|
9
|
+
`):"(run_code completed with no output)"}]},"render")},async execute(o,l){if(o.description.trim().length===0)throw new Error("invalid description: expected a non-empty string");const d=n(),u=new AbortController,f=c(()=>{u.abort(l.signal.reason)},"onOuterAbort");l.signal.addEventListener("abort",f,{once:!0});let p=0;const h=[],y=new Set,m=new Set,b=[];let I=!1,j=!1,se=Promise.resolve(),H;const $e=c(()=>{const g=H;H=void 0,g?.()},"wakeup"),Se=c(()=>(j||(j=!0,se=(async()=>{try{for(;;){const g=new Promise(P=>{H=P}),x=b[0];if(x!==void 0&&x.settled){b.shift(),await x.commit(),x.mode==="exclusive"&&(I=!1);continue}const $=h[0];if($!==void 0){if(u.signal.aborted){h.shift(),$.abandon();continue}const P=$.classify();if(!I&&(P==="exclusive"?y.size===0:y.size<i)){P==="exclusive"&&(I=!0),$.mode=P,h.shift(),b.push($),await $.start();const D=$.flight.finally(()=>{y.delete(D),$e()});y.add(D);continue}}if(h.length===0&&b.length===0&&y.size===0)return;await g}}finally{j=!1,H=void 0}})()),se),"drive"),ut=c(async()=>{for(await Se();m.size>0;)await Promise.allSettled([...m])},"drainDispatches"),Ee=c(()=>u.signal.aborted,"runOver"),dt=c(g=>async x=>{if(Ee())throw new Error(`run_code run is over (${String(u.signal.reason)}); ${g} not dispatched`);const $=Dt(x),P=++p,D=vt(`${String(l.callId)}:code:${P}`),je={callId:D,rootCallId:l.rootCallId,name:g,arguments:$.dispatched,...l.agent?{agent:l.agent}:{},parent:l.token,signal:u.signal},X=e[Oe],ie=await new Promise((pt,ht)=>{let T;const ft=c(w=>{pt(w.isError?{isError:!0,message:w.error.message}:{isError:!1,value:w.value});const E=l.agent;if(E===void 0)return;const xe=(async()=>{const mt=await s({exec:l,agent:E,subCallId:D,name:g,isError:w.isError,content:w.content});E.session.append("tool/code-dispatch",{rootCallId:l.rootCallId,parentCallId:l.callId,subCallId:D,name:g,arguments:$.logged,isError:w.isError,content:mt})})().finally(()=>{m.delete(xe)});m.add(xe)},"settle");h.push({flight:Promise.resolve(),settled:!1,classify:c(()=>e.executionMode(je).kind,"classify"),abandon:c(()=>{ht(new Error(`run_code run is over (${String(u.signal.reason)}); ${g} tool call abandoned`))},"abandon"),async start(){l.agent?.session.append("tool/code-dispatch-start",{rootCallId:l.rootCallId,parentCallId:l.callId,subCallId:D,name:g,arguments:$.logged});const w=await X.prepare(je);if(w.kind==="dispatch"){this.flight=X.dispatch(w.exec).then(E=>{T={kind:E.kind,exec:w.exec,result:E.result},this.settled=!0});return}T={kind:w.kind,exec:w.exec,result:w.result},this.settled=!0},async commit(){if(T===void 0)return;const w=T.kind==="post-result"?await X.finalize(T.exec,T.result):X.finish(T.exec,T.result);!w.isError&&w.content.some(E=>E.type==="image")&&l.deferContext(Ot({content:w.content,source:{kind:"plugin",plugin:"tools-code-mode"}}));for(const E of w.additionalContexts??[])l.deferContext(E);for(w.concludesTurn&&l.concludeTurn(),ft(w);m.size>i;)await Promise.race(m)}}),$e(),Se()});if(Ee())throw new Error(`run_code run is over (${String(u.signal.reason)}); ${g} result discarded`);if(ie.isError)throw new Error(ie.message);return ie.value},"binding"),Ce=Object.create(null);for(const g of e.schemas(l.agent))g.name!=="run_code"&&Object.defineProperty(Ce,g.name,{enumerable:!0,value:dt(g.name)});try{let g;try{g=await d.run({program:o.code,bindings:[{global:"tools",functions:Ce,errorClass:{name:"ToolCallError",memberNameProperty:"toolName"}}],signal:u.signal})}finally{u.abort("run_code settled"),await ut()}if(g.error){const x=g.logs.length>0?`
|
|
10
10
|
Captured output:
|
|
11
11
|
${g.logs.join(`
|
|
12
|
-
`)}`:"";throw new Ue(`code run failed (${g.error.kind}): ${g.error.message}${
|
|
12
|
+
`)}`:"";throw new Ue(`code run failed (${g.error.kind}): ${g.error.message}${x}`)}return{logs:g.logs,...g.value!==void 0?{result:g.value}:{}}}finally{l.signal.removeEventListener("abort",f)}},presentCall:c(o=>({card:"generic",title:o.description,kind:"execute",rawInput:o.code}),"presentCall")});return Object.defineProperty(a,"description",{enumerable:!0,get:c(()=>Ke(r).description,"get")}),Object.defineProperty(a,"parameters",{enumerable:!0,get:c(()=>te({code:{type:"string",required:!0,description:Ke(r).codeDescription},description:{type:"string",required:!0,description:Ve}}),"get")}),a}c(Mt,"createRunCodeTool");const Ft=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function fe(e){return Ft.test(e)?e:JSON.stringify(e)}c(fe,"renderKey");function B(e){return" ".repeat(e)}c(B,"pad$1");function Be(e,t){if(typeof e!="string"||e.length===0)return[];const n=e.replace(/\s+/g," ").trim();return[`${B(t)}/** ${n.replaceAll("*/",String.raw`*\/`)} */`]}c(Be,"docLines$1");function We(e){return JSON.stringify(e)}c(We,"renderScalar");function zt(e,t){const n=t==="integer"?"number":t;return Object.hasOwn(e,"const")?We(e.const):Object.hasOwn(e,"enum")?e.enum.map(We).join(" | "):n}c(zt,"renderConstrainedScalar$1");function me(e){return{parts:e,containsUnionOrIntersection:e.some(t=>typeof t=="string"?t.includes("|")||t.includes("&"):t.containsUnionOrIntersection)}}c(me,"typeDocumentFrom");function C(...e){return me(e)}c(C,"typeDocument");function Lt(e){const t=[],n=[e];for(let r=n.pop();r!==void 0;r=n.pop()){if(typeof r=="string"){t.push(r);continue}for(let i=r.parts.length-1;i>=0;i--){const s=r.parts[i];s!==void 0&&n.push(s)}}return t.join("")}c(Lt,"flattenTypeDocument");function Ye(e,t){return{node:e,indent:t,phase:"start",children:[],childIndex:0,childDocuments:[],entries:[]}}c(Ye,"schemaRenderFrame");function Vt(e,t){const n=[Ye(e,t)];let r;const i=c(s=>{n.pop();const a=n.at(-1);a===void 0?r=s:a.childDocuments.push(s)},"finish");for(;n.length>0;){const s=n.at(-1);if(s===void 0)break;if(s.phase==="children"){if(s.childIndex<s.children.length){const u=s.children[s.childIndex];if(u===void 0)throw new Error("missing schema render child");s.childIndex++,n.push(Ye(u.node,u.indent));continue}if(s.kind==="oneOf"){const u=[];for(let f=0;f<s.childDocuments.length;f++){f>0&&u.push(" | ");const p=s.childDocuments[f];p!==void 0&&u.push(p)}i(me(u));continue}if(s.kind==="array"){const u=s.childDocuments[0];if(u===void 0)throw new Error("missing array item type");i(u.containsUnionOrIntersection?C("(",u,")[]"):C(u,"[]"));continue}const o=new Set(s.node.required),l=["{"];for(let u=0;u<s.entries.length;u++){const f=s.entries[u],p=s.childDocuments[u];if(f===void 0||p===void 0)throw new Error("missing object property type");const[h,y]=f;for(const m of Be(y.description,s.indent+1))l.push(`
|
|
13
13
|
`,m);l.push(`
|
|
14
14
|
`,`${B(s.indent+1)}${fe(h)}${o.has(h)?"":"?"}: `,p,";")}l.push(`
|
|
15
|
-
`,`${B(s.indent)}}`);const
|
|
15
|
+
`,`${B(s.indent)}}`);const d=me(l);i(s.node.additionalProperties===!1?d:C(d," & Record<string, JsonValue>"));continue}const a=s.node;if(a.oneOf!==void 0){s.kind="oneOf",s.children=Array.from(a.oneOf,o=>({node:o,indent:s.indent})),s.childIndex=0,s.childDocuments=[],s.phase="children";continue}if(a.type===void 0){i(C("JsonValue"));continue}switch(a.type){case"string":case"number":case"integer":case"boolean":case"null":i(C(zt(a,a.type)));break;case"array":a.items===void 0?i(C("JsonValue[]")):(s.kind="array",s.children=[{node:a.items,indent:s.indent}],s.childIndex=0,s.childDocuments=[],s.phase="children");break;case"object":{const o=a.additionalProperties!==!1,l=Object.entries(a.properties??{});l.length===0?i(C(o?"Record<string, JsonValue>":"Record<string, never>")):(s.kind="object",s.entries=l,s.children=l.map(([,d])=>({node:d,indent:s.indent+1})),s.childIndex=0,s.childDocuments=[],s.phase="children");break}default:i(C("unknown"))}}return r??C("unknown")}c(Vt,"renderSupportedSchema");function ye(e,t=0){try{return J(e),Lt(Vt(e,t))}catch{return"unknown"}}c(ye,"jsonSchemaToTs");const Kt='## Writing code for run_code\n\n`run_code` takes two required arguments: `code` — the body of an async TypeScript function (erasable syntax only — no `enum` or namespaces; type annotations are advisory, the code runs type-stripped) — and `description`, a short summary of what the program does. Inside the program:\n\n- Call tools as `await tools.name(args)` — quoted access for exotic names: `tools["my-tool"](args)`. Every call resolves to the tool\'s typed canonical JSON value. Tool arguments must be lossless JSON.\n- A FAILED tool call rejects with `ToolCallError`, whose `toolName` identifies the failed tool and whose `message` is human-readable — `try/catch` it to handle and continue.\n- Independent read-only calls MAY overlap under `Promise.all` (safe calls run concurrently; mutating calls run alone, in submission order). Sequence dependent work with `await`.\n- Emit results with `return` and/or `console.log(...)`. Only what you print or return is program output. A successful tool result containing an image is attached after the run so you can inspect it on the next step; every other intermediate result stays out of the conversation, so extract just what you need.\n\nThe available tools:';function He(e){const t=[...e].sort((s,a)=>s.name<a.name?-1:s.name>a.name?1:0),n=[],r=[];for(const s of t)n.push(...Be(s.description,1)),n.push(`${B(1)}${fe(s.name)}: ${ye(s.parameters,1)};`),r.push(`${B(1)}${fe(s.name)}: ${ye(s.output,1)};`);const i=[`interface ToolArgsMap {${n.length>0?`
|
|
16
16
|
${n.join(`
|
|
17
17
|
`)}
|
|
18
18
|
`:""}}`,`interface ToolOutputMap {${r.length>0?`
|
|
@@ -22,15 +22,15 @@ ${r.join(`
|
|
|
22
22
|
`),["declare const tools: {"," [K in ToolName]: (args: ToolArgsMap[K]) => Promise<ToolOutputMap[K]>;","}"].join(`
|
|
23
23
|
`)].join(`
|
|
24
24
|
|
|
25
|
-
`);return`${
|
|
25
|
+
`);return`${Kt}
|
|
26
26
|
|
|
27
27
|
\`\`\`ts
|
|
28
28
|
type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue }
|
|
29
29
|
|
|
30
30
|
${i}
|
|
31
|
-
\`\`\``}c(He,"renderToolsSdk");const
|
|
32
|
-
`)),a(
|
|
33
|
-
`),a=
|
|
31
|
+
\`\`\``}c(He,"renderToolsSdk");const Ut=new RegExp("^[\\p{XID_Start}_]\\p{XID_Continue}*$","u");function Xe(e){return Ut.test(e)&&e.normalize("NFKC")===e}c(Xe,"isBareIdentifier");const Ge=new Set(["False","None","True","and","as","assert","async","await","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","__debug__"]),Bt=["Any","Literal","NotRequired","Protocol","TypedDict"];function S(e){return" ".repeat(e)}c(S,"pad");const Wt=/[\u0000-\u0008\u000e-\u001f\u007f-\u009f]/g,Yt=/[\ud800-\udfff]/gu;function ge(e){const t=e.description;if(typeof t!="string")return;const n=t.replace(/\s+/g," ").replace(Wt,r=>`\\x${r.charCodeAt(0).toString(16).padStart(2,"0")}`).replace(Yt,r=>`\\u${r.charCodeAt(0).toString(16).padStart(4,"0")}`).trim();return n.length===0?void 0:n}c(ge,"describe");function Ht(e,t){const n=ge({description:e});if(n===void 0)return[];const r=n.replaceAll("\\","\\\\").replaceAll('"','\\"');return[`${S(t)}"""${r}"""`]}c(Ht,"docLines");function be(e){const t=e.split(/[^\p{XID_Continue}]+|_+/u).filter(n=>n.length>0).map(n=>`${n.charAt(0).toUpperCase()}${n.slice(1)}`).join("").normalize("NFKC");return(new RegExp("^\\p{XID_Start}","u").test(t)?t:`Tool${t}`).normalize("NFKC")}c(be,"camelCase");const Qe=120,Xt=180;function Ze(e){if(e.length<=Qe)return e;const t=e.slice(0,Qe);return/[\uD800-\uDBFF]$/.test(t)?t.slice(0,-1):t}c(Ze,"capClassNameBase");function Gt(e,t){const n=Ze(e);let r=n;if(t.usedClassNames.has(r)){let i=t.nextClassCounter.get(n)??2;for(;t.usedClassNames.has(`${n}${i}`);)i++;r=`${n}${i}`,t.nextClassCounter.set(n,i+1)}return t.usedClassNames.add(r),r}c(Gt,"allocateClassName");function et(e,t){return Ze(`${e}${t}`.normalize("NFKC"))}c(et,"childClassName");function tt(e){return e===!0?"True":e===!1?"False":typeof e=="string"?JSON.stringify(e):typeof e=="number"&&Number.isInteger(e)&&!Number.isSafeInteger(e)?BigInt(e).toString():String(e)}c(tt,"pyScalar");function re(e,t,n){return e.const!==void 0?(n.typing.add("Literal"),`Literal[${tt(e.const)}]`):e.enum!==void 0?(n.typing.add("Literal"),`Literal[${e.enum.map(tt).join(", ")}]`):t}c(re,"renderConstrainedScalar");function we(e,t,n){const r=c((i,s,a)=>({schema:i,className:s,phase:"start",listDepth:a,children:[],childIndex:0,childTypes:[],entries:[]}),"newFrame");try{J(e);const i=[r(e,t,0)];let s;const a=c(o=>{i.pop();const l=i.at(-1);l===void 0?s=o:l.childTypes.push(o)},"finish");for(;i.length>0;){const o=i.at(-1);if(o===void 0)break;if(o.phase==="children"){if(o.childIndex<o.children.length){const h=o.children[o.childIndex];if(h===void 0)throw new Error("missing python render child");o.childIndex++,i.push(r(h.schema,h.className,h.listDepth));continue}if(o.kind==="oneOf"){let h="";for(const[y,m]of o.childTypes.entries())h=y===0?m:`${h} | ${m}`;a(h);continue}if(o.kind==="array"){a(`list[${o.childTypes[0]??"Any"}]`);continue}const d=o.node,u=o.allocated;if(d===void 0||u===void 0)throw new Error("missing typeddict frame state");const f=new Set(d.required),p=[`class ${u}(TypedDict):`];for(let h=0;h<o.entries.length;h++){const y=o.entries[h],m=o.childTypes[h];if(y===void 0||m===void 0)throw new Error("missing typeddict field type");const[b,I]=y,j=ge(I);j!==void 0&&p.push(`${S(1)}# ${j}`),f.has(b)?p.push(`${S(1)}${b}: ${m}`):(n.typing.add("NotRequired"),p.push(`${S(1)}${b}: NotRequired[${m}]`))}d.additionalProperties!==!1&&p.push(`${S(1)}# Additional keys beyond those declared are allowed.`),p.length===1&&p.push(`${S(1)}pass`),n.classes.push(p.join(`
|
|
32
|
+
`)),a(u);continue}o.phase="children";const l=o.schema;if(l.oneOf!==void 0){o.kind="oneOf",o.children=l.oneOf.map((d,u)=>({schema:d,className:et(o.className,`${u+1}`),listDepth:o.listDepth}));continue}if(l.type===void 0){n.typing.add("Any"),a("Any");continue}switch(l.type){case"string":a(re(l,"str",n));break;case"number":a(re(l,"float",n));break;case"integer":a(re(l,"int",n));break;case"boolean":a(re(l,"bool",n));break;case"null":a("None");break;case"array":if(l.items===void 0){n.typing.add("Any"),a("list[Any]");break}if(o.listDepth>=Xt){n.typing.add("Any"),a("Any");break}o.kind="array",o.children=[{schema:l.items,className:o.className,listDepth:o.listDepth+1}];break;case"object":{const d=Object.entries(l.properties??{});if(t===""||!d.every(([u])=>Xe(u)&&!Ge.has(u)&&!(u.startsWith("__")&&!u.endsWith("__")))){n.typing.add("Any"),a("dict[str, Any]");break}if(d.length===0&&l.additionalProperties!==!1){n.typing.add("Any"),a("dict[str, Any]");break}o.kind="typeddict",o.node=l,o.allocated=Gt(o.className,n),n.typing.add("TypedDict"),o.entries=d,o.children=d.map(([u,f])=>({schema:f,className:et(o.allocated??"",be(u)),listDepth:1}));break}default:n.typing.add("Any"),a("Any")}}return s??"Any"}catch{return n.typing.add("Any"),"Any"}}c(we,"renderType");function Qt(e){return we(e,"",{classes:[],usedClassNames:new Set,nextClassCounter:new Map,typing:new Set})}c(Qt,"jsonSchemaToPy");const Zt='## Writing code for run_code\n\n`run_code` takes two required arguments: `code` — the body of an async Python function (top-level `await` and `return` both work) — and `description`, a short summary of what the program does. At run time exactly two of the names declared below are bound: `tools` and `ToolCallError`. Everything else is a STATIC STUB describing argument and return types — in particular the `TypedDict` classes do NOT exist at run time, so build arguments as plain `dict`/`list` JSON values: `await tools.name({"field": 1})`, never `FooArgs(field=1)`, which raises `NameError`. Inside the program:\n\n- Call tools as `await tools.name(args)` — subscript access for exotic, reserved, or underscore-leading names: `await tools["my-tool"](args)`. Every call resolves to the tool\'s typed canonical JSON value (each method\'s return type below). Tool arguments must be lossless JSON.\n- A FAILED tool call raises `ToolCallError`, whose `toolName` identifies the failed tool and whose message is human-readable — wrap in `try/except` to handle and continue.\n- Independent read-only calls MAY overlap under `asyncio.gather` (safe calls run concurrently; mutating calls run alone, in submission order). Sequence dependent work with `await`.\n- Emit the run\'s answer with `print(...)` and/or a top-level `return <value>`; the returned value must be lossless JSON. Only what you print and return is program output. A successful tool result containing an image is attached after the run so you can inspect it on the next step; every other intermediate result stays out of the conversation, so extract just what you need.\n\nThe available tools:';function nt(e){const t=[...e].sort((d,u)=>d.name<u.name?-1:d.name>u.name?1:0),n={classes:[],usedClassNames:new Set,nextClassCounter:new Map,typing:new Set(["Protocol"])},r=[];let i=0;for(const d of t){const u=we(d.parameters,`${be(d.name)}Args`,n),f=we(d.output,`${be(d.name)}Output`,n);if(Xe(d.name)&&!Ge.has(d.name)&&!d.name.startsWith("_")){const p=Ht(d.description,2);r.push(p.length>0?`${S(1)}async def ${d.name}(self, args: ${u}) -> ${f}:`:`${S(1)}async def ${d.name}(self, args: ${u}) -> ${f}: ...`),r.push(...p),i+=1}else{r.push(`${S(1)}# tools[${JSON.stringify(d.name)}](args: ${u}) -> ${f}`);const p=ge(d);p!==void 0&&r.push(`${S(1)}# ${p}`)}}const s=(i>0?r:[`${S(1)}pass`,...r]).join(`
|
|
33
|
+
`),a=Bt.filter(d=>n.typing.has(d)),o=n.classes.length>0?`${n.classes.join(`
|
|
34
34
|
|
|
35
35
|
`)}
|
|
36
36
|
|
|
@@ -42,9 +42,9 @@ class ToolCallError(Exception):
|
|
|
42
42
|
${o}class Tools(Protocol):
|
|
43
43
|
${s}
|
|
44
44
|
|
|
45
|
-
tools: Tools`;return`${
|
|
45
|
+
tools: Tools`;return`${Zt}
|
|
46
46
|
|
|
47
47
|
\`\`\`python
|
|
48
48
|
${l}
|
|
49
|
-
\`\`\``}c(nt,"renderToolsSdkPy");const
|
|
50
|
-
`);return t.length>0?t:"tool result blocked by post-execute policy"}c(rn,"failureMessageFromContent");function it(e){const t=N(e);if(t===void 0)throw new TypeError("tool result must be losslessly JSON-serializable");return G(t)}c(it,"materializePresentation");function sn(e){try{return e instanceof q?{name:e.name,code:e.code}:void 0}catch{return}}c(sn,"errorInfo");var an=class{static{c(this,"ToolLayer")}tools;restrictions=new Te;guards=new Te;mode;constructor(e){this.tools=new bt(t=>new Error(e===void 0?`tool "${t}" is already registered (for a per-agent variant, register through that agent's \`agent.ctx\` instead)`:`tool "${t}" is already registered in this scope`))}isEmpty(){return this.tools.isEmpty()&&this.restrictions.isEmpty()&&this.guards.isEmpty()&&this.mode===void 0}admits(e){for(const t of this.restrictions.values())if(t.allow!==void 0&&!t.allow.has(e)||t.deny!==void 0&&t.deny.has(e))return!1;return!0}guardReason(e){for(const t of this.guards.values()){const n=t(e);if(n!==void 0)return n}}};function cn(e){const t=e??10;if(!Number.isInteger(t)||t<1)throw new Error("maxParallelSubCalls must be a positive integer");return t}c(cn,"resolveMaxParallelSubCalls");var at=class extends gt{static{c(this,"ToolRuntime")}static inject=["systemPrompt"];static Config=ae.object({mode:ae.union(["native","code","both"]).default("native"),maxParallelSubCalls:ae.natural().min(1).default(10)});[Oe]={prepare:c(e=>this.prepareScheduledExecution(e),"prepare"),dispatch:c(e=>this.dispatchScheduledExecution(e),"dispatch"),finalize:c((e,t)=>this.finalizeScheduledExecution(e,t),"finalize"),finish:c((e,t)=>this.finishScheduledExecution(e,t),"finish")};deferredContexts=new WeakMap;concludingExecutions=new WeakSet;cancellationStates=new WeakMap;contentFinalizers=new WeakMap;layers=new wt(e=>new an(e),()=>{this.ctx.emit("tools/change")});defaultMode;maxParallelSubCalls;codeTransport;constructor(e,t={}){super(e,"tools"),this.defaultMode=t.mode??"native",this.maxParallelSubCalls=cn(t.maxParallelSubCalls),e.systemPrompt.tools(n=>this.wireSchemas(n.scope)),this.defaultMode!=="native"&&(e.systemPrompt.section(this.collapseSection()),e.systemPrompt.section(this.sdkSection()))}collapseSection(){return{name:"tools:code-only",order:tn,text:c(e=>this.modeFor(e.scope)==="code"?nn:"","text")}}sdkSection(){return{name:"tools:sdk",order:150,text:c(e=>{const t=this.modeFor(e.scope);if(t==="native")return"";const n=this.requireCodeRuntime(t),r=ve[n.language];if(r===void 0)throw new Error(`dsh-tools: no SDK renderer for ${n.language}`);return r(this.sdkSchemas(e.scope))},"text")}}modeFor(e){const t=this.layers.chainLayers(e);for(let n=t.length-1;n>=0;n-=1){const r=t[n]?.mode;if(r!==void 0)return r}return this.defaultMode}requireCodeTransport(){return this.codeTransport??=Jt(this,{requireRuntime:c(()=>this.requireCodeRuntime(this.defaultMode),"requireRuntime"),peekRuntime:c(()=>this.ctx.get("codeRuntime"),"peekRuntime"),maxParallel:this.maxParallelSubCalls,shapeDispatchLog:c(e=>this.shapeDispatchLog(e),"shapeDispatchLog")}),this.codeTransport}presentAs(e){const t=this.ctx;if(Ne(t)===void 0)throw new Error("tools.presentAs() requires a scoped context (agent.ctx): a context-global presentation is the `mode` config field on the tools row");return t.effect(function*(){yield this.layers.effect(t,n=>{if(n.mode!==void 0)throw new Error(`tools.presentAs("${e}") conflicts with "${n.mode}" already declared for this scope; one composition selects one presentation`);return n.mode=e,()=>{n.mode=void 0}},{label:"tools.presentAs()"}),e!=="native"&&(yield t.systemPrompt.section(this.collapseSection()),yield t.systemPrompt.section(this.sdkSection()))}.bind(this),"tools.presentAs()")}wireSchemas(e){const t=this.view(e),n=this.modeFor(e);if(n==="native")return{schemas:[...t.visible.values()].map(i=>this.schemaOf(i,!1)),knownNames:[...t.knownNames]};this.requireCodeRuntime(n);const r=[...t.visible.values()].map(i=>this.schemaOf(i,!1));return n==="code"?{schemas:r.filter(i=>i.name===k),knownNames:[k]}:{schemas:r,knownNames:[...t.knownNames,k]}}requireCodeRuntime(e){const t=this.ctx.get("codeRuntime");if(!t)throw new Error(`dsh-tools: mode "${e}" requires a code runtime — load a ctx.codeRuntime implementation (e.g. @deepseek-ai/dsh-code-runtime-worker-thread) or set tools mode to "native"`);if(!Object.hasOwn(ve,t.language)){const n=Object.keys(ve).map(r=>JSON.stringify(r)).join(", ");throw new Error(`dsh-tools: no SDK renderer registered for runtime language ${JSON.stringify(t.language)} (known: ${n})`)}return t}register(e){const t=e.name,n=e.output;if(n===void 0||typeof n!="object"||typeof n.render!="function"||n.presentationMeta!==void 0&&typeof n.presentationMeta!="function")throw new TypeError(`tool "${t}" must declare output { schema, render, presentationMeta? }`);J(n.schema);const r=e.timeoutMs;if(r!==void 0&&(!Number.isFinite(r)||r<=0))throw new TypeError(`tool "${t}" timeoutMs must be a positive finite number`);if(t==="run_code")throw new Error(`tool name "${k}" is reserved for the Code Mode presentation transport and cannot be registered or shadowed`);return this.layers.effect(this.ctx,i=>i.tools.insert(t,e),{label:"tools.register()"})}restrict(e){const t=Ne(this.ctx);if(t===void 0)throw new Error("tools.restrict() requires a scoped context (agent.ctx): a context-global restriction would mask every agent — deny the tool for the intended agent instead");const n=e.allow,r=e.deny;if(n===void 0&&r===void 0)throw new Error("tools.restrict({}) is a no-op: pass `allow` and/or `deny` (an empty filter is almost always a materialized-empty-config bug)");const i={...n!==void 0?{allow:new Set(n)}:{},...r!==void 0?{deny:new Set(r)}:{}};if([...n??[],...r??[]].includes("run_code"))throw new Error(`tools.restrict() cannot name reserved Code Mode presentation transport "${k}"; restrict end-capability tools instead`);const s=this.view(t).restrictableNames,a=[...n??[],...r??[]].filter(o=>!s.has(o));if(a.length>0)throw new Error(`tools.restrict() names unknown global tool${a.length>1?"s":""} ${a.map(o=>`"${o}"`).join(", ")}; known global tools: ${[...s].sort().join(", ")||"(none)"}`);return this.layers.effect(this.ctx,o=>o.restrictions.append(i),{label:"tools.restrict()"})}guard(e){return this.layers.effect(this.ctx,t=>t.guards.append(e),{label:"tools.guard()",notify:!1})}guardReason(e){const t=this.layers.global.guardReason(e);if(t!==void 0)return t;if(e.agent!==void 0)for(const n of this.layers.chainLayers(e.agent)){const r=n.guardReason(e);if(r!==void 0)return r}}view(e){const t=this.layers.chainLayers(e),n=this.layers.peek(e),r=new Map(this.layers.global.tools.entries());for(const o of t)if(o!==n)for(const[l,u]of o.tools.entries())r.set(l,u);const i=new Map,s=new Set,a=new Set;for(const[o,l]of r)s.add(o),a.add(o),t.every(u=>u.admits(o))&&i.set(o,l);if(n!==void 0)for(const[o,l]of n.tools.entries())s.add(o),i.set(o,l);return this.modeFor(e)!=="native"&&i.set(k,this.requireCodeTransport()),{visible:i,knownNames:s,restrictableNames:a}}get(e,t){return this.view(t).visible.get(e)}resolveExecution(e,t,n){const r=this.get(e,t);if(r!==void 0&&!this.collapses(e,t,n))return r}schemas(e){return[...this.view(e).visible.values()].map(t=>this.schemaOf(t,!0))}sdkSchemas(e){return[...this.view(e).visible.values()].filter(t=>t.name!==k).map(t=>{const n=N(t.output.schema);if(n===void 0)throw new Error(`tool "${t.name}" output schema must be lossless JSON before SDK projection`);return{...this.schemaOf(t,!0),output:n}})}schemaOf(e,t){const{name:n,description:r,parameters:i}=e,s=t?N(i):i;if(s===void 0)throw new Error(`tool "${n}" parameters must be lossless JSON before schema projection`);return{name:n,description:r,parameters:s}}executionMode(e){const t=this.resolveExecution(e.name,e.agent,e.parent!==void 0);if(!t?.isConcurrencySafe)return{kind:"exclusive"};try{return t.isConcurrencySafe(e.arguments)===!0?{kind:"parallel"}:{kind:"exclusive"}}catch{return{kind:"exclusive"}}}async shapeDispatchLog(e){try{return await this.ctx.waterfall(F(this,e.agent),"tools/code-dispatch-log",e,()=>Promise.resolve(e.content))}catch(t){return this.ctx.logger.warn(`tools: code-dispatch-log listener failed for ${e.name}: ${Y(t)}; logging the original settled content`),e.content}}collapses(e,t,n){return!n&&this.modeFor(t)==="code"&&e!=="run_code"}async execute(e){return this.prepareExecution(e,t=>this.completeScheduledExecution(t))}async completeScheduledExecution(e){switch(e.kind){case"dispatch":{const t=await this.dispatchScheduledExecution(e.exec);return t.kind==="post-result"?await this.finalizeScheduledExecution(e.exec,t.result):this.finishScheduledExecution(e.exec,t.result)}case"post-result":return await this.finalizeScheduledExecution(e.exec,e.result);case"final-result":return this.finishScheduledExecution(e.exec,e.result);default:return z(e,"scheduled tool preparation")}}createExecution(e){const t=[],n=ln(),r=e.callId,i=e.rootCallId??r,s=e.name,a=e.agent,o=e.parent,l=e.signal,u=this.get(s,a),d=u!==void 0&&this.collapses(s,a,o!==void 0),f=this.concludingExecutions,p={token:n,callId:r,rootCallId:i,name:s,signal:l,...a!==void 0?{agent:a}:{},...o!==void 0?{parent:o}:{},deferContext(m){t.push(m)},concludeTurn(){f.add(this)}},h=u?.finalizeContent?.bind(u),y=c(()=>d&&!l.aborted?void 0:h,"finalizerFor");try{const m=N(e.arguments);if(m===void 0)throw new TypeError("tool execution arguments must be losslessly JSON-serializable");const b={...p,arguments:G(m)};return this.deferredContexts.set(b,t),this.contentFinalizers.set(b,y()),this.cancellationStates.set(b,{callerSignal:l,bodyInvoked:!1}),d?l.aborted?{kind:"final-result",exec:b,result:M()}:{kind:"final-result",exec:b,result:A(new W(s,`only \`${k}\` is callable directly — call \`${s}\` from inside a \`${k}\` program instead`))}:{kind:"ready",exec:b}}catch(m){const b={...p,arguments:void 0};return this.contentFinalizers.set(b,y()),{kind:"final-result",exec:b,result:A(m)}}}async prepareScheduledExecution(e){return this.prepareExecution(e,t=>t)}async prepareExecution(e,t){const n=this.createExecution(e);if(n.kind!=="ready")return t(n);const r=n.exec;if(this.callerCancelled(r))return t({kind:"final-result",exec:r,result:M()});try{const i=F(this,r.agent),s=await this.ctx.waterfall(i,"tools/pre-execute",r,()=>Promise.resolve({kind:"allow"})),a=s.kind==="ask"?await this.serviceAsk(r,s):{decision:s,approvalCancelled:!1},{decision:o}=a;if(this.callerCancelled(r)&&a.approvalCancelled)return await t({kind:"post-result",exec:r,result:M()});const l=o.kind==="allow"?this.guardReason(r):o.reason;return l!==void 0?await t({kind:"post-result",exec:r,result:this.materializeFinalResult({content:[{type:"text",text:`Error: ${l}`}],isError:!0,error:{message:l}})}):this.callerCancelled(r)?await t({kind:"post-result",exec:r,result:M()}):await t({kind:"dispatch",exec:r})}catch(i){return t({kind:"final-result",exec:r,result:A(i)})}}callerCancelled(e){const t=this.cancellationStates.get(e);if(t===void 0)throw new Error("tool registry scheduler invariant violated: missing cancellation state");return t.callerSignal.aborted}cancellationResult(e,t){const n=this.cancellationStates.get(e);if(n===void 0)throw new Error("tool registry scheduler invariant violated: missing cancellation state");return n.bodyInvoked?lt(t):M(t)}async dispatchToolBody(e){const t=this.cancellationStates.get(e);if(t===void 0)throw new Error("tool registry scheduler invariant violated: missing cancellation state");const n=e.signal,r=dn(t.callerSignal,n),i=r.signal;if(ct(i))return r.dispose(),M();e.signal=i;try{const s=this.resolveExecution(e.name,e.agent,e.parent!==void 0);if(!s)throw new W(e.name);t.bodyInvoked=!0;const a=await s.execute(e.arguments,e),o=this.createSuccessResult(e,s,a);return ct(i)?lt(o):o}catch(s){return A(s)}finally{r.dispose(),e.signal=n}}async dispatchScheduledExecution(e){try{const t=e,n=F(this,e.agent),r=await this.ctx.waterfall(n,"tools/execute",t,()=>this.dispatchToolBody(t)),i=this.normalizeDispatchResult(e,r),s=this.deferredContexts.get(e);if(s===void 0)throw new Error("tool registry scheduler invariant violated: unprepared execution");const a=s.length===0?i:this.markCanonical(e,{...i,additionalContexts:[...s,...i.additionalContexts??[]]});return{kind:"post-result",result:this.callerCancelled(e)&&!a.isError?this.cancellationResult(e,a):a}}catch(t){return{kind:"final-result",result:A(t)}}}async finalizeScheduledExecution(e,t){try{const n=await this.postExecute(e,t);return this.finishScheduledExecution(e,this.callerCancelled(e)&&!n.isError?this.cancellationResult(e,n):n)}catch(n){return this.finishScheduledExecution(e,A(n))}}finishScheduledExecution(e,t){let n;try{n=this.materializeFinalResult(t)}catch(i){n=this.materializeFinalResult(A(i))}let r;try{r=this.materializeFinalResult(this.applyFinalContent(e,n))}catch(i){r=this.materializeFinalResult(A(i))}return this.notifyResult(e,r),r}applyFinalContent(e,t){const n=this.contentFinalizers.get(e);if(n===void 0)return t;const r=n(e,t);return r===void 0?t:{...t,content:r}}notifyResult(e,t){Object.freeze(e);const{name:n,callId:r}=e,i=c(a=>{this.ctx.logger.warn(`tool "${n}" (${r}): tools/result observer failed: ${Y(a)}`)},"reportFailure"),s=this.ctx.events.dispatch("emit",[F(this,e.agent),"tools/result",e,t]);for(const a of s)try{const o=a(e,t);Promise.resolve(o).catch(i)}catch(o){i(o)}}async serviceAsk(e,t){const n=this.ctx.get("approval");if(n===void 0)return{decision:{kind:"deny",reason:t.reason??`tool "${e.name}" requires approval (not yet supported)`},approvalCancelled:!1};if(e.agent===void 0)return{decision:{kind:"deny",reason:`tool "${e.name}" requires approval, but the call has no agent to route it through`},approvalCancelled:!1};const r=await n.request({agent:e.agent,toolName:e.name,callId:e.callId,...t.reason!==void 0?{reason:t.reason}:{},signal:e.signal});switch(r){case"allowed-once":return{decision:{kind:"allow"},approvalCancelled:!1};case"rejected":return{decision:{kind:"deny",reason:`the user rejected tool "${e.name}"`},approvalCancelled:!1};case"cancelled":return{decision:{kind:"deny",reason:`approval for tool "${e.name}" was cancelled`},approvalCancelled:!0};case"unavailable":return{decision:{kind:"deny",reason:`tool "${e.name}" requires approval, but no approval channel is available`},approvalCancelled:!1};default:return z(r,"ApprovalOutcome")}}async postExecute(e,t){const n=await this.ctx.waterfall(F(this,e.agent),"tools/post-execute",e,t,()=>Promise.resolve({kind:"accept"})),r=n.additionalContexts??[];if(n.kind==="block"){const s=rn(n.feedback);return this.markCanonical(e,{content:n.feedback,isError:!0,error:{message:s},...r.length>0?{additionalContexts:r}:{}})}if(Object.hasOwn(n,"content")&&Object.hasOwn(n,"value"))throw new TypeError("tools/post-execute accept decision cannot replace both value and content");const i=[...t.additionalContexts??[],...r];if(Object.hasOwn(n,"value")){if(t.isError)throw new TypeError("tools/post-execute cannot replace the value of a failed result");const s=this.resolveExecution(e.name,e.agent,e.parent!==void 0);if(s===void 0)throw new W(e.name);const a=this.createSuccessResult(e,s,n.value);return this.markCanonical(e,{...a,...i.length>0?{additionalContexts:i}:{}})}return this.markCanonical(e,{...t,...n.content!==void 0?{content:n.content}:{},...i.length>0?{additionalContexts:i}:{}})}canonicalResults=new WeakMap;markCanonical(e,t){return this.canonicalResults.set(t,e.token),t}createSuccessResult(e,t,n){const r=on(t.name,n),i=ee(t.output.schema,r,"value");if(i.length>0)throw new R(t.name,i);const s=G(r);let a;try{a=t.output.render(e.arguments,s)}catch(d){throw ke(t.name,"render",d)}const o=st(t.name,"render",a);let l;if(e.parent===void 0&&t.output.presentationMeta!==void 0){let d;try{d=t.output.presentationMeta(e.arguments,s)}catch(f){throw ke(t.name,"presentationMeta",f)}l=st(t.name,"presentationMeta",d)}const u=this.concludingExecutions.has(e);return this.markCanonical(e,this.materializeFinalResult({isError:!1,value:s,content:o,...l!==void 0?{meta:l}:{},...u?{concludesTurn:!0}:{}}))}normalizeDispatchResult(e,t){if(this.canonicalResults.get(t)===e.token)return t;if(t.isError)return this.markCanonical(e,{isError:!0,error:t.error,content:t.content,...t.meta!==void 0?{meta:t.meta}:{},...t.additionalContexts!==void 0?{additionalContexts:t.additionalContexts}:{}});const n=this.resolveExecution(e.name,e.agent,e.parent!==void 0);if(n===void 0)throw new W(e.name);const r=this.createSuccessResult(e,n,t.value);return this.markCanonical(e,{...r,...t.additionalContexts!==void 0?{additionalContexts:t.additionalContexts}:{}})}materializeFinalResult(e){const t={content:e.content,...e.meta!==void 0?{meta:e.meta}:{},...e.additionalContexts!==void 0?{additionalContexts:e.additionalContexts}:{}};if(e.isError)return it({isError:!0,error:e.error,...t});const n=it({isError:!1,...t,...e.concludesTurn===!0?{concludesTurn:!0}:{}});return G({...n,value:e.value})}};function ln(){return Symbol("dsh.tool.execution")}c(ln,"createExecutionToken");function A(e){const t=sn(e),n=Y(e);return{content:[{type:"text",text:`Error: ${n}`}],isError:!0,error:{message:n,...t?{info:t}:{}}}}c(A,"toolErrorResult");function ct(e){return e.aborted}c(ct,"isAborted");function dn(e,t){if(e===t)return{signal:e,dispose(){}};const n=new AbortController;let r=!1;const i=c(()=>{r&&(r=!1,e.removeEventListener("abort",a),t.removeEventListener("abort",o))},"dispose"),s=c(l=>{const u=l.reason;n.abort(u),i()},"abortFrom"),a=c(()=>{s(e)},"abortFromCaller"),o=c(()=>{s(t)},"abortFromWrapper");return t.aborted?o():e.aborted?a():(r=!0,e.addEventListener("abort",a,{once:!0}),t.addEventListener("abort",o,{once:!0})),{signal:n.signal,dispose:i}}c(dn,"fuseToolSignals");function lt(e){const t=e?.additionalContexts??[];return{content:[{type:"text",text:"Error: tool call aborted"}],isError:!0,error:{message:"tool call aborted",info:{name:"AbortError",code:ot}},...t.length>0?{additionalContexts:t}:{}}}c(lt,"toolAbortedResult");function M(e){const t=e?.additionalContexts??[];return{content:[{type:"text",text:"Error: tool call aborted before dispatch"}],isError:!0,error:{message:"tool call aborted before dispatch",info:{name:"AbortError",code:rt}},...t.length>0?{additionalContexts:t}:{}}}c(M,"toolAbortedBeforeDispatchResult");export{Ue as CodeRunFailedError,Q as JsonSchemaError,k as RUN_CODE_NAME,ot as TOOL_ABORTED,rt as TOOL_ABORTED_BEFORE_DISPATCH,Oe as TOOL_RUNTIME_SCHEDULER,Le as ToolArgsError,W as ToolNotFoundError,R as ToolOutputError,at as ToolRuntime,at as default,Ct as assertObjectJsonSchema,J as assertSupportedJsonSchema,en as defineContentToolFixture,pe as defineTool,Gt as jsonSchemaToPy,ye as jsonSchemaToTs,te as parameterSchemaSpecToJsonSchema,He as renderToolsSdk,nt as renderToolsSdkPy,It as validateArgs,ee as validateJsonSchemaValue,ze as valueSchemaSpecToJsonSchema};
|
|
49
|
+
\`\`\``}c(nt,"renderToolsSdkPy");const en={type:"array",items:{type:"json"}};function tn(e){const t=e.execute;return pe({...e,output:{schema:en,render:c((n,r)=>r,"render")},async execute(n,r){return await t(n,r)}})}c(tn,"defineContentToolFixture");const nn=99,on=`\`${k}\` is the only tool you can call directly — a tool call naming any other tool fails. Reach every tool the SDK declares below from inside the program.`,ve={typescript:He,python:nt},Oe=Symbol("@deepseek-ai/dsh-tools.scheduler"),ot="ABORTED",rt="ABORTED_BEFORE_DISPATCH";var W=class extends q{static{c(this,"ToolNotFoundError")}constructor(e,t){super(t===void 0?`unknown tool "${e}"`:`unknown tool "${e}": ${t}`,"UNKNOWN_TOOL"),this.name="ToolNotFoundError"}},R=class extends q{static{c(this,"ToolOutputError")}violations;constructor(e,t){super(`tool "${e}" returned invalid output: ${t.join("; ")}`,"INVALID_TOOL_OUTPUT"),this.name="ToolOutputError",this.violations=t}};function ke(e,t,n){return new R(e,[`output.${t} failed: ${Y(n)}`])}c(ke,"projectionError");function st(e,t,n){try{const r=N(n);if(r===void 0)throw new R(e,[`output.${t} returned non-lossless JSON`]);return r}catch(r){throw r instanceof R?r:ke(e,t,r)}}c(st,"snapshotProjection");function rn(e,t){try{const n=N(t);if(n===void 0)throw new R(e,["value is not lossless JSON"]);return n}catch(n){throw n instanceof R?n:new R(e,[`value snapshot failed: ${Y(n)}`])}}c(rn,"snapshotToolValue");function Y(e){try{return e instanceof Error||typeof e=="object"&&e!==null&&"message"in e&&typeof e.message=="string"?e.message:String(e)}catch{return"<unprintable thrown value>"}}c(Y,"errorMessage");function sn(e){const t=e.map(n=>n.type==="text"?n.text:`[${n.type} content]`).join(`
|
|
50
|
+
`);return t.length>0?t:"tool result blocked by post-execute policy"}c(sn,"failureMessageFromContent");function it(e){const t=N(e);if(t===void 0)throw new TypeError("tool result must be losslessly JSON-serializable");return G(t)}c(it,"materializePresentation");function an(e){try{return e instanceof q?{name:e.name,code:e.code}:void 0}catch{return}}c(an,"errorInfo");var cn=class{static{c(this,"ToolLayer")}tools;restrictions=new Te;guards=new Te;mode;constructor(e){this.tools=new bt(t=>new Error(e===void 0?`tool "${t}" is already registered (for a per-agent variant, register through that agent's \`agent.ctx\` instead)`:`tool "${t}" is already registered in this scope`))}isEmpty(){return this.tools.isEmpty()&&this.restrictions.isEmpty()&&this.guards.isEmpty()&&this.mode===void 0}admits(e){for(const t of this.restrictions.values())if(t.allow!==void 0&&!t.allow.has(e)||t.deny!==void 0&&t.deny.has(e))return!1;return!0}guardReason(e){for(const t of this.guards.values()){const n=t(e);if(n!==void 0)return n}}};function ln(e){const t=e??10;if(!Number.isInteger(t)||t<1)throw new Error("maxParallelSubCalls must be a positive integer");return t}c(ln,"resolveMaxParallelSubCalls");var at=class extends gt{static{c(this,"ToolRuntime")}static inject=["systemPrompt"];static Config=ae.object({mode:ae.union(["native","code","both"]).default("native"),maxParallelSubCalls:ae.natural().min(1).default(10)});[Oe]={prepare:c(e=>this.prepareScheduledExecution(e),"prepare"),dispatch:c(e=>this.dispatchScheduledExecution(e),"dispatch"),finalize:c((e,t)=>this.finalizeScheduledExecution(e,t),"finalize"),finish:c((e,t)=>this.finishScheduledExecution(e,t),"finish")};deferredContexts=new WeakMap;concludingExecutions=new WeakSet;cancellationStates=new WeakMap;contentFinalizers=new WeakMap;layers=new wt(e=>new cn(e),()=>{this.ctx.emit("tools/change")});defaultMode;maxParallelSubCalls;codeTransport;constructor(e,t={}){super(e,"tools"),this.defaultMode=t.mode??"native",this.maxParallelSubCalls=ln(t.maxParallelSubCalls),e.systemPrompt.tools(n=>this.wireSchemas(n.scope)),this.defaultMode!=="native"&&(e.systemPrompt.section(this.collapseSection()),e.systemPrompt.section(this.sdkSection()))}collapseSection(){return{name:"tools:code-only",order:nn,text:c(e=>this.modeFor(e.scope)==="code"?on:"","text")}}sdkSection(){return{name:"tools:sdk",order:150,text:c(e=>{const t=this.modeFor(e.scope);if(t==="native")return"";const n=this.requireCodeRuntime(t),r=ve[n.language];if(r===void 0)throw new Error(`dsh-tools: no SDK renderer for ${n.language}`);return r(this.sdkSchemas(e.scope))},"text")}}modeFor(e){const t=this.layers.chainLayers(e);for(let n=t.length-1;n>=0;n-=1){const r=t[n]?.mode;if(r!==void 0)return r}return this.defaultMode}requireCodeTransport(){return this.codeTransport??=Mt(this,{requireRuntime:c(()=>this.requireCodeRuntime(this.defaultMode),"requireRuntime"),peekRuntime:c(()=>this.ctx.get("codeRuntime"),"peekRuntime"),maxParallel:this.maxParallelSubCalls,shapeDispatchLog:c(e=>this.shapeDispatchLog(e),"shapeDispatchLog")}),this.codeTransport}presentAs(e){const t=this.ctx;if(Ne(t)===void 0)throw new Error("tools.presentAs() requires a scoped context (agent.ctx): a context-global presentation is the `mode` config field on the tools row");return t.effect(function*(){yield this.layers.effect(t,n=>{if(n.mode!==void 0)throw new Error(`tools.presentAs("${e}") conflicts with "${n.mode}" already declared for this scope; one composition selects one presentation`);return n.mode=e,()=>{n.mode=void 0}},{label:"tools.presentAs()"}),e!=="native"&&(yield t.systemPrompt.section(this.collapseSection()),yield t.systemPrompt.section(this.sdkSection()))}.bind(this),"tools.presentAs()")}wireSchemas(e){const t=this.view(e),n=this.modeFor(e);if(n==="native")return{schemas:[...t.visible.values()].map(i=>this.schemaOf(i,!1)),knownNames:[...t.knownNames]};this.requireCodeRuntime(n);const r=[...t.visible.values()].map(i=>this.schemaOf(i,!1));return n==="code"?{schemas:r.filter(i=>i.name===k),knownNames:[k]}:{schemas:r,knownNames:[...t.knownNames,k]}}requireCodeRuntime(e){const t=this.ctx.get("codeRuntime");if(!t)throw new Error(`dsh-tools: mode "${e}" requires a code runtime — load a ctx.codeRuntime implementation (e.g. @deepseek-ai/dsh-code-runtime-worker-thread) or set tools mode to "native"`);if(!Object.hasOwn(ve,t.language)){const n=Object.keys(ve).map(r=>JSON.stringify(r)).join(", ");throw new Error(`dsh-tools: no SDK renderer registered for runtime language ${JSON.stringify(t.language)} (known: ${n})`)}return t}register(e){const t=e.name,n=e.output;if(n===void 0||typeof n!="object"||typeof n.render!="function"||n.presentationMeta!==void 0&&typeof n.presentationMeta!="function")throw new TypeError(`tool "${t}" must declare output { schema, render, presentationMeta? }`);J(n.schema);const r=e.timeoutMs;if(r!==void 0&&(!Number.isFinite(r)||r<=0))throw new TypeError(`tool "${t}" timeoutMs must be a positive finite number`);if(t==="run_code")throw new Error(`tool name "${k}" is reserved for the Code Mode presentation transport and cannot be registered or shadowed`);return this.layers.effect(this.ctx,i=>i.tools.insert(t,e),{label:"tools.register()"})}restrict(e){const t=Ne(this.ctx);if(t===void 0)throw new Error("tools.restrict() requires a scoped context (agent.ctx): a context-global restriction would mask every agent — deny the tool for the intended agent instead");const n=e.allow,r=e.deny;if(n===void 0&&r===void 0)throw new Error("tools.restrict({}) is a no-op: pass `allow` and/or `deny` (an empty filter is almost always a materialized-empty-config bug)");const i={...n!==void 0?{allow:new Set(n)}:{},...r!==void 0?{deny:new Set(r)}:{}};if([...n??[],...r??[]].includes("run_code"))throw new Error(`tools.restrict() cannot name reserved Code Mode presentation transport "${k}"; restrict end-capability tools instead`);const s=this.view(t).restrictableNames,a=[...n??[],...r??[]].filter(o=>!s.has(o));if(a.length>0)throw new Error(`tools.restrict() names unknown global tool${a.length>1?"s":""} ${a.map(o=>`"${o}"`).join(", ")}; known global tools: ${[...s].sort().join(", ")||"(none)"}`);return this.layers.effect(this.ctx,o=>o.restrictions.append(i),{label:"tools.restrict()"})}guard(e){return this.layers.effect(this.ctx,t=>t.guards.append(e),{label:"tools.guard()",notify:!1})}guardReason(e){const t=this.layers.global.guardReason(e);if(t!==void 0)return t;if(e.agent!==void 0)for(const n of this.layers.chainLayers(e.agent)){const r=n.guardReason(e);if(r!==void 0)return r}}view(e){const t=this.layers.chainLayers(e),n=this.layers.peek(e),r=new Map(this.layers.global.tools.entries());for(const o of t)if(o!==n)for(const[l,d]of o.tools.entries())r.set(l,d);const i=new Map,s=new Set,a=new Set;for(const[o,l]of r)s.add(o),a.add(o),t.every(d=>d.admits(o))&&i.set(o,l);if(n!==void 0)for(const[o,l]of n.tools.entries())s.add(o),i.set(o,l);return this.modeFor(e)!=="native"&&i.set(k,this.requireCodeTransport()),{visible:i,knownNames:s,restrictableNames:a}}get(e,t){return this.view(t).visible.get(e)}resolveExecution(e,t,n){const r=this.get(e,t);if(r!==void 0&&!this.collapses(e,t,n))return r}schemas(e){return[...this.view(e).visible.values()].map(t=>this.schemaOf(t,!0))}sdkSchemas(e){return[...this.view(e).visible.values()].filter(t=>t.name!==k).map(t=>{const n=N(t.output.schema);if(n===void 0)throw new Error(`tool "${t.name}" output schema must be lossless JSON before SDK projection`);return{...this.schemaOf(t,!0),output:n}})}schemaOf(e,t){const{name:n,description:r,parameters:i}=e,s=t?N(i):i;if(s===void 0)throw new Error(`tool "${n}" parameters must be lossless JSON before schema projection`);return{name:n,description:r,parameters:s}}executionMode(e){const t=this.resolveExecution(e.name,e.agent,e.parent!==void 0);if(!t?.isConcurrencySafe)return{kind:"exclusive"};try{return t.isConcurrencySafe(e.arguments)===!0?{kind:"parallel"}:{kind:"exclusive"}}catch{return{kind:"exclusive"}}}async shapeDispatchLog(e){try{return await this.ctx.waterfall(F(this,e.agent),"tools/code-dispatch-log",e,()=>Promise.resolve(e.content))}catch(t){return this.ctx.logger.warn(`tools: code-dispatch-log listener failed for ${e.name}: ${Y(t)}; logging the original settled content`),e.content}}collapses(e,t,n){return!n&&this.modeFor(t)==="code"&&e!=="run_code"}async execute(e){return this.prepareExecution(e,t=>this.completeScheduledExecution(t))}async completeScheduledExecution(e){switch(e.kind){case"dispatch":{const t=await this.dispatchScheduledExecution(e.exec);return t.kind==="post-result"?await this.finalizeScheduledExecution(e.exec,t.result):this.finishScheduledExecution(e.exec,t.result)}case"post-result":return await this.finalizeScheduledExecution(e.exec,e.result);case"final-result":return this.finishScheduledExecution(e.exec,e.result);default:return z(e,"scheduled tool preparation")}}createExecution(e){const t=[],n=un(),r=e.callId,i=e.rootCallId??r,s=e.name,a=e.agent,o=e.parent,l=e.signal,d=this.get(s,a),u=d!==void 0&&this.collapses(s,a,o!==void 0),f=this.concludingExecutions,p={token:n,callId:r,rootCallId:i,name:s,signal:l,...a!==void 0?{agent:a}:{},...o!==void 0?{parent:o}:{},deferContext(m){t.push(m)},concludeTurn(){f.add(this)}},h=d?.finalizeContent?.bind(d),y=c(()=>u&&!l.aborted?void 0:h,"finalizerFor");try{const m=N(e.arguments);if(m===void 0)throw new TypeError("tool execution arguments must be losslessly JSON-serializable");const b={...p,arguments:G(m)};return this.deferredContexts.set(b,t),this.contentFinalizers.set(b,y()),this.cancellationStates.set(b,{callerSignal:l,bodyInvoked:!1}),u?l.aborted?{kind:"final-result",exec:b,result:M()}:{kind:"final-result",exec:b,result:A(new W(s,`only \`${k}\` is callable directly — call \`${s}\` from inside a \`${k}\` program instead`))}:{kind:"ready",exec:b}}catch(m){const b={...p,arguments:void 0};return this.contentFinalizers.set(b,y()),{kind:"final-result",exec:b,result:A(m)}}}async prepareScheduledExecution(e){return this.prepareExecution(e,t=>t)}async prepareExecution(e,t){const n=this.createExecution(e);if(n.kind!=="ready")return t(n);const r=n.exec;if(this.callerCancelled(r))return t({kind:"final-result",exec:r,result:M()});try{const i=F(this,r.agent),s=await this.ctx.waterfall(i,"tools/pre-execute",r,()=>Promise.resolve({kind:"allow"})),a=s.kind==="ask"?await this.serviceAsk(r,s):{decision:s,approvalCancelled:!1},{decision:o}=a;if(this.callerCancelled(r)&&a.approvalCancelled)return await t({kind:"post-result",exec:r,result:M()});const l=o.kind==="allow"?this.guardReason(r):o.reason;return l!==void 0?await t({kind:"post-result",exec:r,result:this.materializeFinalResult({content:[{type:"text",text:`Error: ${l}`}],isError:!0,error:{message:l}})}):this.callerCancelled(r)?await t({kind:"post-result",exec:r,result:M()}):await t({kind:"dispatch",exec:r})}catch(i){return t({kind:"final-result",exec:r,result:A(i)})}}callerCancelled(e){const t=this.cancellationStates.get(e);if(t===void 0)throw new Error("tool registry scheduler invariant violated: missing cancellation state");return t.callerSignal.aborted}cancellationResult(e,t){const n=this.cancellationStates.get(e);if(n===void 0)throw new Error("tool registry scheduler invariant violated: missing cancellation state");return n.bodyInvoked?lt(t):M(t)}async dispatchToolBody(e){const t=this.cancellationStates.get(e);if(t===void 0)throw new Error("tool registry scheduler invariant violated: missing cancellation state");const n=e.signal,r=dn(t.callerSignal,n),i=r.signal;if(ct(i))return r.dispose(),M();e.signal=i;try{const s=this.resolveExecution(e.name,e.agent,e.parent!==void 0);if(!s)throw new W(e.name);t.bodyInvoked=!0;const a=await s.execute(e.arguments,e),o=this.createSuccessResult(e,s,a);return ct(i)?lt(o):o}catch(s){return A(s)}finally{r.dispose(),e.signal=n}}async dispatchScheduledExecution(e){try{const t=e,n=F(this,e.agent),r=await this.ctx.waterfall(n,"tools/execute",t,()=>this.dispatchToolBody(t)),i=this.normalizeDispatchResult(e,r),s=this.deferredContexts.get(e);if(s===void 0)throw new Error("tool registry scheduler invariant violated: unprepared execution");const a=s.length===0?i:this.markCanonical(e,{...i,additionalContexts:[...s,...i.additionalContexts??[]]});return{kind:"post-result",result:this.callerCancelled(e)&&!a.isError?this.cancellationResult(e,a):a}}catch(t){return{kind:"final-result",result:A(t)}}}async finalizeScheduledExecution(e,t){try{const n=await this.postExecute(e,t);return this.finishScheduledExecution(e,this.callerCancelled(e)&&!n.isError?this.cancellationResult(e,n):n)}catch(n){return this.finishScheduledExecution(e,A(n))}}finishScheduledExecution(e,t){let n;try{n=this.materializeFinalResult(t)}catch(i){n=this.materializeFinalResult(A(i))}let r;try{r=this.materializeFinalResult(this.applyFinalContent(e,n))}catch(i){r=this.materializeFinalResult(A(i))}return this.notifyResult(e,r),r}applyFinalContent(e,t){const n=this.contentFinalizers.get(e);if(n===void 0)return t;const r=n(e,t);return r===void 0?t:{...t,content:r}}notifyResult(e,t){Object.freeze(e);const{name:n,callId:r}=e,i=c(a=>{this.ctx.logger.warn(`tool "${n}" (${r}): tools/result observer failed: ${Y(a)}`)},"reportFailure"),s=this.ctx.events.dispatch("emit",[F(this,e.agent),"tools/result",e,t]);for(const a of s)try{const o=a(e,t);Promise.resolve(o).catch(i)}catch(o){i(o)}}async serviceAsk(e,t){const n=this.ctx.get("approval");if(n===void 0)return{decision:{kind:"deny",reason:t.reason??`tool "${e.name}" requires approval (not yet supported)`},approvalCancelled:!1};if(e.agent===void 0)return{decision:{kind:"deny",reason:`tool "${e.name}" requires approval, but the call has no agent to route it through`},approvalCancelled:!1};const r=await n.request({agent:e.agent,toolName:e.name,callId:e.callId,...t.reason!==void 0?{reason:t.reason}:{},signal:e.signal});switch(r){case"allowed-once":return{decision:{kind:"allow"},approvalCancelled:!1};case"rejected":return{decision:{kind:"deny",reason:`the user rejected tool "${e.name}"`},approvalCancelled:!1};case"cancelled":return{decision:{kind:"deny",reason:`approval for tool "${e.name}" was cancelled`},approvalCancelled:!0};case"unavailable":return{decision:{kind:"deny",reason:`tool "${e.name}" requires approval, but no approval channel is available`},approvalCancelled:!1};default:return z(r,"ApprovalOutcome")}}async postExecute(e,t){const n=await this.ctx.waterfall(F(this,e.agent),"tools/post-execute",e,t,()=>Promise.resolve({kind:"accept"})),r=n.additionalContexts??[];if(n.kind==="block"){const s=sn(n.feedback);return this.markCanonical(e,{content:n.feedback,isError:!0,error:{message:s},...r.length>0?{additionalContexts:r}:{}})}if(Object.hasOwn(n,"content")&&Object.hasOwn(n,"value"))throw new TypeError("tools/post-execute accept decision cannot replace both value and content");const i=[...t.additionalContexts??[],...r];if(Object.hasOwn(n,"value")){if(t.isError)throw new TypeError("tools/post-execute cannot replace the value of a failed result");const s=this.resolveExecution(e.name,e.agent,e.parent!==void 0);if(s===void 0)throw new W(e.name);const a=this.createSuccessResult(e,s,n.value);return this.markCanonical(e,{...a,...i.length>0?{additionalContexts:i}:{}})}return this.markCanonical(e,{...t,...n.content!==void 0?{content:n.content}:{},...i.length>0?{additionalContexts:i}:{}})}canonicalResults=new WeakMap;markCanonical(e,t){return this.canonicalResults.set(t,e.token),t}createSuccessResult(e,t,n){const r=rn(t.name,n),i=ee(t.output.schema,r,"value");if(i.length>0)throw new R(t.name,i);const s=G(r);let a;try{a=t.output.render(e.arguments,s)}catch(u){throw ke(t.name,"render",u)}const o=st(t.name,"render",a);let l;if(e.parent===void 0&&t.output.presentationMeta!==void 0){let u;try{u=t.output.presentationMeta(e.arguments,s)}catch(f){throw ke(t.name,"presentationMeta",f)}l=st(t.name,"presentationMeta",u)}const d=this.concludingExecutions.has(e);return this.markCanonical(e,this.materializeFinalResult({isError:!1,value:s,content:o,...l!==void 0?{meta:l}:{},...d?{concludesTurn:!0}:{}}))}normalizeDispatchResult(e,t){if(this.canonicalResults.get(t)===e.token)return t;if(t.isError)return this.markCanonical(e,{isError:!0,error:t.error,content:t.content,...t.meta!==void 0?{meta:t.meta}:{},...t.additionalContexts!==void 0?{additionalContexts:t.additionalContexts}:{}});const n=this.resolveExecution(e.name,e.agent,e.parent!==void 0);if(n===void 0)throw new W(e.name);const r=this.createSuccessResult(e,n,t.value);return this.markCanonical(e,{...r,...t.additionalContexts!==void 0?{additionalContexts:t.additionalContexts}:{}})}materializeFinalResult(e){const t={content:e.content,...e.meta!==void 0?{meta:e.meta}:{},...e.additionalContexts!==void 0?{additionalContexts:e.additionalContexts}:{}};if(e.isError)return it({isError:!0,error:e.error,...t});const n=it({isError:!1,...t,...e.concludesTurn===!0?{concludesTurn:!0}:{}});return G({...n,value:e.value})}};function un(){return Symbol("dsh.tool.execution")}c(un,"createExecutionToken");function A(e){const t=an(e),n=Y(e);return{content:[{type:"text",text:`Error: ${n}`}],isError:!0,error:{message:n,...t?{info:t}:{}}}}c(A,"toolErrorResult");function ct(e){return e.aborted}c(ct,"isAborted");function dn(e,t){if(e===t)return{signal:e,dispose(){}};const n=new AbortController;let r=!1;const i=c(()=>{r&&(r=!1,e.removeEventListener("abort",a),t.removeEventListener("abort",o))},"dispose"),s=c(l=>{const d=l.reason;n.abort(d),i()},"abortFrom"),a=c(()=>{s(e)},"abortFromCaller"),o=c(()=>{s(t)},"abortFromWrapper");return t.aborted?o():e.aborted?a():(r=!0,e.addEventListener("abort",a,{once:!0}),t.addEventListener("abort",o,{once:!0})),{signal:n.signal,dispose:i}}c(dn,"fuseToolSignals");function lt(e){const t=e?.additionalContexts??[];return{content:[{type:"text",text:"Error: tool call aborted"}],isError:!0,error:{message:"tool call aborted",info:{name:"AbortError",code:ot}},...t.length>0?{additionalContexts:t}:{}}}c(lt,"toolAbortedResult");function M(e){const t=e?.additionalContexts??[];return{content:[{type:"text",text:"Error: tool call aborted before dispatch"}],isError:!0,error:{message:"tool call aborted before dispatch",info:{name:"AbortError",code:rt}},...t.length>0?{additionalContexts:t}:{}}}c(M,"toolAbortedBeforeDispatchResult");export{Ue as CodeRunFailedError,Q as JsonSchemaError,k as RUN_CODE_NAME,ot as TOOL_ABORTED,rt as TOOL_ABORTED_BEFORE_DISPATCH,Oe as TOOL_RUNTIME_SCHEDULER,Le as ToolArgsError,W as ToolNotFoundError,R as ToolOutputError,at as ToolRuntime,at as default,jt as assertObjectJsonSchema,J as assertSupportedJsonSchema,tn as defineContentToolFixture,pe as defineTool,Qt as jsonSchemaToPy,ye as jsonSchemaToTs,te as parameterSchemaSpecToJsonSchema,He as renderToolsSdk,nt as renderToolsSdkPy,Pt as validateArgs,ee as validateJsonSchemaValue,ze as valueSchemaSpecToJsonSchema};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var W=Object.defineProperty;var
|
|
2
|
-
${C.repeat(
|
|
1
|
+
var W=Object.defineProperty;var o=(a,n)=>W(a,"name",{value:n,configurable:!0});import{CallId as X,createUserMessage as G,HarnessError as Z}from"@deepseek-ai/dsh-llm";import{snapshotJsonValue as q}from"@deepseek-ai/dsh-session";import{defineTool as ee,parameterSchemaSpecToJsonSchema as te}from"./schema.js";import{TOOL_RUNTIME_SCHEDULER as ne}from"./index.js";export const RUN_CODE_NAME="run_code",SDK_SECTION_ORDER=150;const x={description:"Execute a TypeScript program against the available tools. Takes two required arguments: `code`, the BODY of an async function (erasable syntax only; top-level `await` and `return` work), and `description`, a short summary of what the program does. Call tools as `await tools.name(args)` per the declarations in the system prompt. Only what you print or return is program output — curate it. Image-bearing subtool results are attached after the run.",codeDescription:"The program: the body of an async TypeScript function."},re={description:"Execute a Python program against the available tools. Takes two required arguments: `code`, the BODY of an async function (top-level `await` and `return` work), and `description`, a short summary of what the program does. Call tools as `await tools.name(args)` per the declarations in the system prompt. Use `print(...)` and/or `return <value>` for program output — curate it. Image-bearing subtool results are attached after the run.",codeDescription:"The program: the body of an async Python function."},P={typescript:x,python:re},z='Clear, concise description of what this program does in active voice, 5-10 words (shown in the UI). Examples: "Count TODO markers across packages"; "Read failing test and its fixture"; "Rename config key in every cordis.yml".';function F(a){const n=a();if(n===void 0)return x;const l=P[n.language];if(!Object.hasOwn(P,n.language)||l===void 0){const s=Object.keys(P).map(i=>JSON.stringify(i)).join(", ");throw new Error(`dsh-tools: no run_code schema flavor registered for runtime language ${JSON.stringify(n.language)} (known: ${s})`)}return l}o(F,"resolveFlavor");export class CodeRunFailedError extends Z{static{o(this,"CodeRunFailedError")}constructor(n){super(n,"CODE_RUN_FAILED"),this.name="CodeRunFailedError"}}function oe(a){let n;try{n=q(a)}catch(s){throw new Error(`tool arguments must be lossless JSON: ${s instanceof Error?s.message:String(s)}`)}if(n===void 0)throw new Error("tool arguments must be lossless JSON (call the tool with an arguments object, e.g. `{}`)");const l=q(n);if(l===void 0)throw new Error("tool arguments could not be detached for durable logging");return{dispatched:n,logged:l}}o(oe,"jsonNormalizeArgs");const C=" ",se=10;function ie(a){const n=[],l=[{kind:"value",value:a,depth:0,compact:!1}];for(let s=l.pop();s!==void 0;s=l.pop()){if(s.kind==="text"){n.push(s.text);continue}const i=s.value;if(i===null||typeof i=="boolean"||typeof i=="number"){n.push(String(i));continue}if(typeof i=="string"){n.push(JSON.stringify(i));continue}const g=s.compact||(s.depth+1)*C.length>se,h=s.depth+1;if(Array.isArray(i)){if(n.push("["),i.length===0){n.push("]");continue}l.push({kind:"text",text:g?"]":`
|
|
2
|
+
${C.repeat(s.depth)}]`});for(let e=i.length-1;e>=0;e--){const c=i[e];if(c===void 0)throw new Error("cannot render a sparse JSON array");l.push({kind:"value",value:c,depth:h,compact:g}),l.push({kind:"text",text:g?e===0?"":",":`${e===0?`
|
|
3
3
|
`:`,
|
|
4
|
-
`}${C.repeat(
|
|
5
|
-
${C.repeat(
|
|
4
|
+
`}${C.repeat(h)}`})}continue}const p=Object.keys(i);if(n.push("{"),p.length===0){n.push("}");continue}l.push({kind:"text",text:g?"}":`
|
|
5
|
+
${C.repeat(s.depth)}}`});for(let e=p.length-1;e>=0;e--){const c=p[e];if(c===void 0)throw new Error("cannot render a missing JSON object key");const d=i[c];if(d===void 0)throw new Error("cannot render an undefined JSON object property");l.push({kind:"value",value:d,depth:h,compact:g}),l.push({kind:"text",text:g?`${e===0?"":","}${JSON.stringify(c)}:`:`${e===0?`
|
|
6
6
|
`:`,
|
|
7
|
-
`}${C.repeat(
|
|
8
|
-
`),
|
|
9
|
-
`):"(run_code completed with no output)"}]},"render")},async execute(p,e){if(p.description.trim().length===0)throw new Error("invalid description: expected a non-empty string");const
|
|
7
|
+
`}${C.repeat(h)}${JSON.stringify(c)}: `})}}return n.join("")}o(ie,"renderJsonValue");function ae(a){return typeof a=="string"?a:ie(a)}o(ae,"renderValue");export function createRunCodeTool(a,n){const{requireRuntime:l,peekRuntime:s,maxParallel:i,shapeDispatchLog:g}=n,h=ee({name:RUN_CODE_NAME,description:x.description,parameters:{code:{type:"string",required:!0,description:x.codeDescription},description:{type:"string",required:!0,description:z}},output:{schema:{type:"object",additionalProperties:!1,properties:{logs:{type:"array",required:!0,items:{type:"string"}},result:{type:"json"}}},render:o((p,e)=>{const c=e.result===void 0?"":ae(e.result),d=[e.logs.join(`
|
|
8
|
+
`),c].filter(S=>S.length>0);return[{type:"text",text:d.length>0?d.join(`
|
|
9
|
+
`):"(run_code completed with no output)"}]},"render")},async execute(p,e){if(p.description.trim().length===0)throw new Error("invalid description: expected a non-empty string");const c=l(),d=new AbortController,S=o(()=>{d.abort(e.signal.reason)},"onOuterAbort");e.signal.addEventListener("abort",S,{once:!0});let M=0;const b=[],k=new Set,E=new Set,N=[];let R=!1,T=!1,$=Promise.resolve(),I;const j=o(()=>{const t=I;I=void 0,t?.()},"wakeup"),A=o(()=>(T||(T=!0,$=(async()=>{try{for(;;){const t=new Promise(w=>{I=w}),m=N[0];if(m!==void 0&&m.settled){N.shift(),await m.commit(),m.mode==="exclusive"&&(R=!1);continue}const u=b[0];if(u!==void 0){if(d.signal.aborted){b.shift(),u.abandon();continue}const w=u.classify();if(!R&&(w==="exclusive"?k.size===0:k.size<i)){w==="exclusive"&&(R=!0),u.mode=w,b.shift(),N.push(u),await u.start();const v=u.flight.finally(()=>{k.delete(v),j()});k.add(v);continue}}if(b.length===0&&N.length===0&&k.size===0)return;await t}}finally{T=!1,I=void 0}})()),$),"drive"),V=o(async()=>{for(await A();E.size>0;)await Promise.allSettled([...E])},"drainDispatches"),J=o(()=>d.signal.aborted,"runOver"),H=o(t=>async m=>{if(J())throw new Error(`run_code run is over (${String(d.signal.reason)}); ${t} not dispatched`);const u=oe(m),w=++M,O=X(`${String(e.callId)}:code:${w}`),v={callId:O,rootCallId:e.rootCallId,name:t,arguments:u.dispatched,...e.agent?{agent:e.agent}:{},parent:e.token,signal:d.signal},_=a[ne],D=await new Promise((Y,B)=>{let y;const Q=o(r=>{Y(r.isError?{isError:!0,message:r.error.message}:{isError:!1,value:r.value});const f=e.agent;if(f===void 0)return;const U=(async()=>{const K=await g({exec:e,agent:f,subCallId:O,name:t,isError:r.isError,content:r.content});f.session.append("tool/code-dispatch",{rootCallId:e.rootCallId,parentCallId:e.callId,subCallId:O,name:t,arguments:u.logged,isError:r.isError,content:K})})().finally(()=>{E.delete(U)});E.add(U)},"settle");b.push({flight:Promise.resolve(),settled:!1,classify:o(()=>a.executionMode(v).kind,"classify"),abandon:o(()=>{B(new Error(`run_code run is over (${String(d.signal.reason)}); ${t} tool call abandoned`))},"abandon"),async start(){e.agent?.session.append("tool/code-dispatch-start",{rootCallId:e.rootCallId,parentCallId:e.callId,subCallId:O,name:t,arguments:u.logged});const r=await _.prepare(v);if(r.kind==="dispatch"){this.flight=_.dispatch(r.exec).then(f=>{y={kind:f.kind,exec:r.exec,result:f.result},this.settled=!0});return}y={kind:r.kind,exec:r.exec,result:r.result},this.settled=!0},async commit(){if(y===void 0)return;const r=y.kind==="post-result"?await _.finalize(y.exec,y.result):_.finish(y.exec,y.result);!r.isError&&r.content.some(f=>f.type==="image")&&e.deferContext(G({content:r.content,source:{kind:"plugin",plugin:"tools-code-mode"}}));for(const f of r.additionalContexts??[])e.deferContext(f);for(r.concludesTurn&&e.concludeTurn(),Q(r);E.size>i;)await Promise.race(E)}}),j(),A()});if(J())throw new Error(`run_code run is over (${String(d.signal.reason)}); ${t} result discarded`);if(D.isError)throw new Error(D.message);return D.value},"binding"),L=Object.create(null);for(const t of a.schemas(e.agent))t.name!==RUN_CODE_NAME&&Object.defineProperty(L,t.name,{enumerable:!0,value:H(t.name)});try{let t;try{t=await c.run({program:p.code,bindings:[{global:"tools",functions:L,errorClass:{name:"ToolCallError",memberNameProperty:"toolName"}}],signal:d.signal})}finally{d.abort("run_code settled"),await V()}if(t.error){const m=t.logs.length>0?`
|
|
10
10
|
Captured output:
|
|
11
11
|
${t.logs.join(`
|
|
12
|
-
`)}`:"";throw new CodeRunFailedError(`code run failed (${t.error.kind}): ${t.error.message}${
|
|
12
|
+
`)}`:"";throw new CodeRunFailedError(`code run failed (${t.error.kind}): ${t.error.message}${m}`)}return{logs:t.logs,...t.value!==void 0?{result:t.value}:{}}}finally{e.signal.removeEventListener("abort",S)}},presentCall:o(p=>({card:"generic",title:p.description,kind:"execute",rawInput:p.code}),"presentCall")});return Object.defineProperty(h,"description",{enumerable:!0,get:o(()=>F(s).description,"get")}),Object.defineProperty(h,"parameters",{enumerable:!0,get:o(()=>te({code:{type:"string",required:!0,description:F(s).codeDescription},description:{type:"string",required:!0,description:z}}),"get")}),h}o(createRunCodeTool,"createRunCodeTool");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var x=Object.defineProperty;var
|
|
2
|
-
`)),o(u);continue}t.phase="children";const a=t.schema;if(a.oneOf!==void 0){t.kind="oneOf",t.children=a.oneOf.map((f,u)=>({schema:f,className:
|
|
1
|
+
var x=Object.defineProperty;var c=(e,s)=>x(e,"name",{value:s,configurable:!0});import{assertSupportedJsonSchema as O}from"./json-schema.js";const L=new RegExp("^[\\p{XID_Start}_]\\p{XID_Continue}*$","u");function T(e){return L.test(e)&&e.normalize("NFKC")===e}c(T,"isBareIdentifier");const C=new Set(["False","None","True","and","as","assert","async","await","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","__debug__"]),F=["Any","Literal","NotRequired","Protocol","TypedDict"];function h(e){return" ".repeat(e)}c(h,"pad");const R=/[\u0000-\u0008\u000e-\u001f\u007f-\u009f]/g,j=/[\ud800-\udfff]/gu;function w(e){const s=e.description;if(typeof s!="string")return;const n=s.replace(/\s+/g," ").replace(R,i=>`\\x${i.charCodeAt(0).toString(16).padStart(2,"0")}`).replace(j,i=>`\\u${i.charCodeAt(0).toString(16).padStart(4,"0")}`).trim();return n.length===0?void 0:n}c(w,"describe");function P(e,s){const n=w({description:e});if(n===void 0)return[];const i=n.replaceAll("\\","\\\\").replaceAll('"','\\"');return[`${h(s)}"""${i}"""`]}c(P,"docLines");function S(e){const s=e.split(/[^\p{XID_Continue}]+|_+/u).filter(n=>n.length>0).map(n=>`${n.charAt(0).toUpperCase()}${n.slice(1)}`).join("").normalize("NFKC");return(new RegExp("^\\p{XID_Start}","u").test(s)?s:`Tool${s}`).normalize("NFKC")}c(S,"camelCase");const I=120,v=180;function _(e){if(e.length<=I)return e;const s=e.slice(0,I);return/[\uD800-\uDBFF]$/.test(s)?s.slice(0,-1):s}c(_,"capClassNameBase");function B(e,s){const n=_(e);let i=n;if(s.usedClassNames.has(i)){let d=s.nextClassCounter.get(n)??2;for(;s.usedClassNames.has(`${n}${d}`);)d++;i=`${n}${d}`,s.nextClassCounter.set(n,d+1)}return s.usedClassNames.add(i),i}c(B,"allocateClassName");function k(e,s){return _(`${e}${s}`.normalize("NFKC"))}c(k,"childClassName");function D(e){return e===!0?"True":e===!1?"False":typeof e=="string"?JSON.stringify(e):typeof e=="number"&&Number.isInteger(e)&&!Number.isSafeInteger(e)?BigInt(e).toString():String(e)}c(D,"pyScalar");function $(e,s,n){return e.const!==void 0?(n.typing.add("Literal"),`Literal[${D(e.const)}]`):e.enum!==void 0?(n.typing.add("Literal"),`Literal[${e.enum.map(D).join(", ")}]`):s}c($,"renderConstrainedScalar");function b(e,s,n){const i=c((d,g,o)=>({schema:d,className:g,phase:"start",listDepth:o,children:[],childIndex:0,childTypes:[],entries:[]}),"newFrame");try{O(e);const d=[i(e,s,0)];let g;const o=c(t=>{d.pop();const a=d.at(-1);a===void 0?g=t:a.childTypes.push(t)},"finish");for(;d.length>0;){const t=d.at(-1);if(t===void 0)break;if(t.phase==="children"){if(t.childIndex<t.children.length){const l=t.children[t.childIndex];if(l===void 0)throw new Error("missing python render child");t.childIndex++,d.push(i(l.schema,l.className,l.listDepth));continue}if(t.kind==="oneOf"){let l="";for(const[y,m]of t.childTypes.entries())l=y===0?m:`${l} | ${m}`;o(l);continue}if(t.kind==="array"){o(`list[${t.childTypes[0]??"Any"}]`);continue}const f=t.node,u=t.allocated;if(f===void 0||u===void 0)throw new Error("missing typeddict frame state");const r=new Set(f.required),p=[`class ${u}(TypedDict):`];for(let l=0;l<t.entries.length;l++){const y=t.entries[l],m=t.childTypes[l];if(y===void 0||m===void 0)throw new Error("missing typeddict field type");const[N,E]=y,A=w(E);A!==void 0&&p.push(`${h(1)}# ${A}`),r.has(N)?p.push(`${h(1)}${N}: ${m}`):(n.typing.add("NotRequired"),p.push(`${h(1)}${N}: NotRequired[${m}]`))}f.additionalProperties!==!1&&p.push(`${h(1)}# Additional keys beyond those declared are allowed.`),p.length===1&&p.push(`${h(1)}pass`),n.classes.push(p.join(`
|
|
2
|
+
`)),o(u);continue}t.phase="children";const a=t.schema;if(a.oneOf!==void 0){t.kind="oneOf",t.children=a.oneOf.map((f,u)=>({schema:f,className:k(t.className,`${u+1}`),listDepth:t.listDepth}));continue}if(a.type===void 0){n.typing.add("Any"),o("Any");continue}switch(a.type){case"string":o($(a,"str",n));break;case"number":o($(a,"float",n));break;case"integer":o($(a,"int",n));break;case"boolean":o($(a,"bool",n));break;case"null":o("None");break;case"array":{if(a.items===void 0){n.typing.add("Any"),o("list[Any]");break}if(t.listDepth>=v){n.typing.add("Any"),o("Any");break}t.kind="array",t.children=[{schema:a.items,className:t.className,listDepth:t.listDepth+1}];break}case"object":{const f=Object.entries(a.properties??{});if(s===""||!f.every(([u])=>T(u)&&!C.has(u)&&!(u.startsWith("__")&&!u.endsWith("__")))){n.typing.add("Any"),o("dict[str, Any]");break}if(f.length===0&&a.additionalProperties!==!1){n.typing.add("Any"),o("dict[str, Any]");break}t.kind="typeddict",t.node=a,t.allocated=B(t.className,n),n.typing.add("TypedDict"),t.entries=f,t.children=f.map(([u,r])=>({schema:r,className:k(t.allocated??"",S(u)),listDepth:1}));break}default:n.typing.add("Any"),o("Any")}}return g??"Any"}catch{return n.typing.add("Any"),"Any"}}c(b,"renderType");export function jsonSchemaToPy(e){return b(e,"",{classes:[],usedClassNames:new Set,nextClassCounter:new Map,typing:new Set})}c(jsonSchemaToPy,"jsonSchemaToPy");const q='## Writing code for run_code\n\n`run_code` takes two required arguments: `code` — the body of an async Python function (top-level `await` and `return` both work) — and `description`, a short summary of what the program does. At run time exactly two of the names declared below are bound: `tools` and `ToolCallError`. Everything else is a STATIC STUB describing argument and return types — in particular the `TypedDict` classes do NOT exist at run time, so build arguments as plain `dict`/`list` JSON values: `await tools.name({"field": 1})`, never `FooArgs(field=1)`, which raises `NameError`. Inside the program:\n\n- Call tools as `await tools.name(args)` — subscript access for exotic, reserved, or underscore-leading names: `await tools["my-tool"](args)`. Every call resolves to the tool\'s typed canonical JSON value (each method\'s return type below). Tool arguments must be lossless JSON.\n- A FAILED tool call raises `ToolCallError`, whose `toolName` identifies the failed tool and whose message is human-readable — wrap in `try/except` to handle and continue.\n- Independent read-only calls MAY overlap under `asyncio.gather` (safe calls run concurrently; mutating calls run alone, in submission order). Sequence dependent work with `await`.\n- Emit the run\'s answer with `print(...)` and/or a top-level `return <value>`; the returned value must be lossless JSON. Only what you print and return is program output. A successful tool result containing an image is attached after the run so you can inspect it on the next step; every other intermediate result stays out of the conversation, so extract just what you need.\n\nThe available tools:';export function renderToolsSdkPy(e){const s=[...e].sort((r,p)=>r.name<p.name?-1:r.name>p.name?1:0),n={classes:[],usedClassNames:new Set,nextClassCounter:new Map,typing:new Set(["Protocol"])},i=[];let d=0;for(const r of s){const p=b(r.parameters,`${S(r.name)}Args`,n),l=b(r.output,`${S(r.name)}Output`,n);if(T(r.name)&&!C.has(r.name)&&!r.name.startsWith("_")){const y=P(r.description,2);i.push(y.length>0?`${h(1)}async def ${r.name}(self, args: ${p}) -> ${l}:`:`${h(1)}async def ${r.name}(self, args: ${p}) -> ${l}: ...`),i.push(...y),d+=1}else{i.push(`${h(1)}# tools[${JSON.stringify(r.name)}](args: ${p}) -> ${l}`);const y=w(r);y!==void 0&&i.push(`${h(1)}# ${y}`)}}const o=(d>0?i:[`${h(1)}pass`,...i]).join(`
|
|
3
3
|
`),t=F.filter(r=>n.typing.has(r)),a=n.classes.length>0?`${n.classes.join(`
|
|
4
4
|
|
|
5
5
|
`)}
|
|
@@ -16,4 +16,4 @@ tools: Tools`;return`${q}
|
|
|
16
16
|
|
|
17
17
|
\`\`\`python
|
|
18
18
|
${u}
|
|
19
|
-
\`\`\``}
|
|
19
|
+
\`\`\``}c(renderToolsSdkPy,"renderToolsSdkPy");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var S=Object.defineProperty;var c=(n,t)=>S(n,"name",{value:t,configurable:!0});import{assertSupportedJsonSchema as j}from"./json-schema.js";const I=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function y(n){return I.test(n)?n:JSON.stringify(n)}c(y,"renderKey");function m(n){return" ".repeat(n)}c(m,"pad");function b(n,t){if(typeof n!="string"||n.length===0)return[];const o=n.replace(/\s+/g," ").trim();return[`${m(t)}/** ${o.replaceAll("*/",String.raw`*\/`)} */`]}c(b,"docLines");function $(n){return JSON.stringify(n)}c($,"renderScalar");function x(n,t){const o=t==="integer"?"number":t;return Object.hasOwn(n,"const")?$(n.const):Object.hasOwn(n,"enum")?n.enum.map($).join(" | "):o}c(x,"renderConstrainedScalar");function g(n){return{parts:n,containsUnionOrIntersection:n.some(t=>typeof t=="string"?t.includes("|")||t.includes("&"):t.containsUnionOrIntersection)}}c(g,"typeDocumentFrom");function d(...n){return g(n)}c(d,"typeDocument");function D(n){const t=[],o=[n];for(let l=o.pop();l!==void 0;l=o.pop()){if(typeof l=="string"){t.push(l);continue}for(let a=l.parts.length-1;a>=0;a--){const e=l.parts[a];e!==void 0&&o.push(e)}}return t.join("")}c(D,"flattenTypeDocument");function
|
|
2
|
-
`,
|
|
1
|
+
var S=Object.defineProperty;var c=(n,t)=>S(n,"name",{value:t,configurable:!0});import{assertSupportedJsonSchema as j}from"./json-schema.js";const I=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function y(n){return I.test(n)?n:JSON.stringify(n)}c(y,"renderKey");function m(n){return" ".repeat(n)}c(m,"pad");function b(n,t){if(typeof n!="string"||n.length===0)return[];const o=n.replace(/\s+/g," ").trim();return[`${m(t)}/** ${o.replaceAll("*/",String.raw`*\/`)} */`]}c(b,"docLines");function $(n){return JSON.stringify(n)}c($,"renderScalar");function x(n,t){const o=t==="integer"?"number":t;return Object.hasOwn(n,"const")?$(n.const):Object.hasOwn(n,"enum")?n.enum.map($).join(" | "):o}c(x,"renderConstrainedScalar");function g(n){return{parts:n,containsUnionOrIntersection:n.some(t=>typeof t=="string"?t.includes("|")||t.includes("&"):t.containsUnionOrIntersection)}}c(g,"typeDocumentFrom");function d(...n){return g(n)}c(d,"typeDocument");function D(n){const t=[],o=[n];for(let l=o.pop();l!==void 0;l=o.pop()){if(typeof l=="string"){t.push(l);continue}for(let a=l.parts.length-1;a>=0;a--){const e=l.parts[a];e!==void 0&&o.push(e)}}return t.join("")}c(D,"flattenTypeDocument");function O(n,t){return{node:n,indent:t,phase:"start",children:[],childIndex:0,childDocuments:[],entries:[]}}c(O,"schemaRenderFrame");function E(n,t){const o=[O(n,t)];let l;const a=c(e=>{o.pop();const i=o.at(-1);i===void 0?l=e:i.childDocuments.push(e)},"finish");for(;o.length>0;){const e=o.at(-1);if(e===void 0)break;if(e.phase==="children"){if(e.childIndex<e.children.length){const s=e.children[e.childIndex];if(s===void 0)throw new Error("missing schema render child");e.childIndex++,o.push(O(s.node,s.indent));continue}if(e.kind==="oneOf"){const s=[];for(let h=0;h<e.childDocuments.length;h++){h>0&&s.push(" | ");const f=e.childDocuments[h];f!==void 0&&s.push(f)}a(g(s));continue}if(e.kind==="array"){const s=e.childDocuments[0];if(s===void 0)throw new Error("missing array item type");a(s.containsUnionOrIntersection?d("(",s,")[]"):d(s,"[]"));continue}const p=new Set(e.node.required),r=["{"];for(let s=0;s<e.entries.length;s++){const h=e.entries[s],f=e.childDocuments[s];if(h===void 0||f===void 0)throw new Error("missing object property type");const[w,T]=h;for(const k of b(T.description,e.indent+1))r.push(`
|
|
2
|
+
`,k);r.push(`
|
|
3
3
|
`,`${m(e.indent+1)}${y(w)}${p.has(w)?"":"?"}: `,f,";")}r.push(`
|
|
4
|
-
`,`${m(e.indent)}}`);const u=g(r);a(e.node.additionalProperties===!1?u:d(u," & Record<string, JsonValue>"));continue}const i=e.node;if(i.oneOf!==void 0){e.kind="oneOf",e.children=Array.from(i.oneOf,p=>({node:p,indent:e.indent})),e.childIndex=0,e.childDocuments=[],e.phase="children";continue}if(i.type===void 0){a(d("JsonValue"));continue}switch(i.type){case"string":case"number":case"integer":case"boolean":case"null":a(d(x(i,i.type)));break;case"array":i.items===void 0?a(d("JsonValue[]")):(e.kind="array",e.children=[{node:i.items,indent:e.indent}],e.childIndex=0,e.childDocuments=[],e.phase="children");break;case"object":{const p=i.additionalProperties!==!1,r=Object.entries(i.properties??{});r.length===0?a(d(p?"Record<string, JsonValue>":"Record<string, never>")):(e.kind="object",e.entries=r,e.children=r.map(([,u])=>({node:u,indent:e.indent+1})),e.childIndex=0,e.childDocuments=[],e.phase="children");break}default:a(d("unknown"))}}return l??d("unknown")}c(
|
|
4
|
+
`,`${m(e.indent)}}`);const u=g(r);a(e.node.additionalProperties===!1?u:d(u," & Record<string, JsonValue>"));continue}const i=e.node;if(i.oneOf!==void 0){e.kind="oneOf",e.children=Array.from(i.oneOf,p=>({node:p,indent:e.indent})),e.childIndex=0,e.childDocuments=[],e.phase="children";continue}if(i.type===void 0){a(d("JsonValue"));continue}switch(i.type){case"string":case"number":case"integer":case"boolean":case"null":a(d(x(i,i.type)));break;case"array":i.items===void 0?a(d("JsonValue[]")):(e.kind="array",e.children=[{node:i.items,indent:e.indent}],e.childIndex=0,e.childDocuments=[],e.phase="children");break;case"object":{const p=i.additionalProperties!==!1,r=Object.entries(i.properties??{});r.length===0?a(d(p?"Record<string, JsonValue>":"Record<string, never>")):(e.kind="object",e.entries=r,e.children=r.map(([,u])=>({node:u,indent:e.indent+1})),e.childIndex=0,e.childDocuments=[],e.phase="children");break}default:a(d("unknown"))}}return l??d("unknown")}c(E,"renderSupportedSchema");export function jsonSchemaToTs(n,t=0){try{return j(n),D(E(n,t))}catch{return"unknown"}}c(jsonSchemaToTs,"jsonSchemaToTs");const J='## Writing code for run_code\n\n`run_code` takes two required arguments: `code` — the body of an async TypeScript function (erasable syntax only — no `enum` or namespaces; type annotations are advisory, the code runs type-stripped) — and `description`, a short summary of what the program does. Inside the program:\n\n- Call tools as `await tools.name(args)` — quoted access for exotic names: `tools["my-tool"](args)`. Every call resolves to the tool\'s typed canonical JSON value. Tool arguments must be lossless JSON.\n- A FAILED tool call rejects with `ToolCallError`, whose `toolName` identifies the failed tool and whose `message` is human-readable — `try/catch` it to handle and continue.\n- Independent read-only calls MAY overlap under `Promise.all` (safe calls run concurrently; mutating calls run alone, in submission order). Sequence dependent work with `await`.\n- Emit results with `return` and/or `console.log(...)`. Only what you print or return is program output. A successful tool result containing an image is attached after the run so you can inspect it on the next step; every other intermediate result stays out of the conversation, so extract just what you need.\n\nThe available tools:';export function renderToolsSdk(n){const t=[...n].sort((r,u)=>r.name<u.name?-1:r.name>u.name?1:0),o=[],l=[];for(const r of t)o.push(...b(r.description,1)),o.push(`${m(1)}${y(r.name)}: ${jsonSchemaToTs(r.parameters,1)};`),l.push(`${m(1)}${y(r.name)}: ${jsonSchemaToTs(r.output,1)};`);const a=`interface ToolArgsMap {${o.length>0?`
|
|
5
5
|
${o.join(`
|
|
6
6
|
`)}
|
|
7
7
|
`:""}}`,e=`interface ToolOutputMap {${l.length>0?`
|
|
@@ -11,7 +11,7 @@ ${l.join(`
|
|
|
11
11
|
`),["declare const tools: {"," [K in ToolName]: (args: ToolArgsMap[K]) => Promise<ToolOutputMap[K]>;","}"].join(`
|
|
12
12
|
`)].join(`
|
|
13
13
|
|
|
14
|
-
`);return`${
|
|
14
|
+
`);return`${J}
|
|
15
15
|
|
|
16
16
|
\`\`\`ts
|
|
17
17
|
type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@deepseek-ai/dsh-tools","version":"0.0.
|
|
1
|
+
{"name":"@deepseek-ai/dsh-tools","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./presentation":{"types":"./lib/types/presentation.d.ts","default":"./lib/types/presentation.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0-rc.7","@deepseek-ai/dsh-code-runtime":"^0.1.0-rc.7","@deepseek-ai/dsh-scope":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-user-approval":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@deepseek-ai/dsh-typert-loader","version":"0.0.
|
|
1
|
+
{"name":"@deepseek-ai/dsh-typert-loader","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/cordis-plugin-loader":"^1.0.2","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1","@deepseek-ai/dsh-typert-registry":"^0.1.0-rc.7"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@deepseek-ai/dsh-typert-protocol","version":"0.0.
|
|
1
|
+
{"name":"@deepseek-ai/dsh-typert-protocol","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@deepseek-ai/dsh-typert-registry","version":"0.0.
|
|
1
|
+
{"name":"@deepseek-ai/dsh-typert-registry","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./client":{"types":"./lib/types/client/index.d.ts","default":"./lib/client.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"dsh":{"client":{"inject":[],"platform":"web","immediately":true}},"license":"MIT","dependencies":{"zod":"^4.4.3","@deepseek-ai/dsh-typert-protocol":"^0.1.0-rc.7"},"peerDependencies":{"@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@deepseek-ai/dsh-user-approval","version":"0.0.
|
|
1
|
+
{"name":"@deepseek-ai/dsh-user-approval","version":"0.1.0-rc.7","publishConfig":{"access":"public"},"type":"module","main":"lib/index.js","exports":{".":{"types":"./lib/types/index.d.ts","default":"./lib/index.js"},"./invariant":{"types":"./lib/types/invariant.d.ts","default":"./lib/invariant.js"},"./types":{"types":"./lib/types/types.d.ts","default":"./lib/types/types.js"},"./src/*":"./src/*","./package.json":"./package.json"},"license":"MIT","peerDependencies":{"@deepseek-ai/dsh-agent":"^0.1.0-rc.7","@deepseek-ai/dsh-brand":"^0.1.0-rc.7","@deepseek-ai/dsh-invariants":"^0.1.0-rc.7","@deepseek-ai/dsh-llm":"^0.1.0-rc.7","@deepseek-ai/dsh-scope":"^0.1.0-rc.7","@deepseek-ai/dsh-session":"^0.1.0-rc.7","@deepseek-ai/dsh-system-prompt":"^0.1.0-rc.7","@deepseek-ai/cordis":"^4.0.1"},"dependencies":{"@deepseek-ai/schemastery":"^3.18.1"}}
|