@tencent-ai/codebuddy-code 2.67.0 → 2.68.0-next.19b562c.20260330
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/CHANGELOG.md +26 -0
- package/dist/codebuddy-headless.js +58 -58
- package/dist/codebuddy.js +120 -79
- package/dist/web-ui/assets/{index-BPT-qRRx.js → index-Cl0stqCM.js} +145 -116
- package/dist/web-ui/assets/index-Dt1puyHn.css +32 -0
- package/dist/web-ui/docs/cn/cli/acp.md +152 -0
- package/dist/web-ui/docs/cn/cli/agent-teams.md +327 -0
- package/dist/web-ui/docs/cn/cli/bash-sandboxing.md +290 -0
- package/dist/web-ui/docs/cn/cli/best-practices.md +554 -0
- package/dist/web-ui/docs/cn/cli/channels-reference.md +293 -0
- package/dist/web-ui/docs/cn/cli/channels.md +215 -0
- package/dist/web-ui/docs/cn/cli/checkpointing.md +51 -0
- package/dist/web-ui/docs/cn/cli/cli-reference.md +187 -0
- package/dist/web-ui/docs/cn/cli/common-workflows.md +1013 -0
- package/dist/web-ui/docs/cn/cli/costs.md +174 -0
- package/dist/web-ui/docs/cn/cli/devcontainer.md +553 -0
- package/dist/web-ui/docs/cn/cli/env-vars.md +326 -0
- package/dist/web-ui/docs/cn/cli/gitlab-ci-cd.md +357 -0
- package/dist/web-ui/docs/cn/cli/headless.md +258 -0
- package/dist/web-ui/docs/cn/cli/hooks-guide.md +9 -0
- package/dist/web-ui/docs/cn/cli/hooks.md +805 -0
- package/dist/web-ui/docs/cn/cli/iam.md +530 -0
- package/dist/web-ui/docs/cn/cli/ide-integrations.md +92 -0
- package/dist/web-ui/docs/cn/cli/installation.md +291 -0
- package/dist/web-ui/docs/cn/cli/interactive-mode.md +233 -0
- package/dist/web-ui/docs/cn/cli/mcp.md +739 -0
- package/dist/web-ui/docs/cn/cli/memory.md +436 -0
- package/dist/web-ui/docs/cn/cli/models.md +356 -0
- package/dist/web-ui/docs/cn/cli/overview.md +100 -0
- package/dist/web-ui/docs/cn/cli/plugin-marketplaces.md +533 -0
- package/dist/web-ui/docs/cn/cli/plugins-reference.md +774 -0
- package/dist/web-ui/docs/cn/cli/plugins.md +689 -0
- package/dist/web-ui/docs/cn/cli/quickstart.md +249 -0
- package/dist/web-ui/docs/cn/cli/release-notes/README.md +199 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.10.0.md +23 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.10.1.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.11.0.md +24 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.12.0.md +21 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.13.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.14.0.md +22 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.14.1.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.15.0.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.15.1.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.16.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.17.0.md +29 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.18.0.md +17 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.19.0.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.19.1.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.19.2.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.20.0.md +23 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.20.1.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.21.0.md +13 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.22.0.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.23.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.23.2.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.23.3.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.23.4.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.23.5.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.24.0.md +17 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.25.0.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.25.1.md +21 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.26.0.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.27.0.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.27.1.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.27.2.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.27.3.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.28.0.md +26 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.28.1.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.29.0.md +35 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.3.1.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.30.0.md +19 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.30.1.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.31.0.md +51 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.31.1.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.31.2.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.32.0.md +19 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.33.0.md +28 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.33.1.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.36.3.md +17 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.0.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.1.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.10.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.11.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.12.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.13.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.14.md +24 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.15.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.16.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.17.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.18.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.19.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.2.md +28 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.20.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.3.md +22 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.4.md +19 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.5.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.6.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.7.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.8.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.9.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.38.0.md +22 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.38.1.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.38.2.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.39.0.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.4.0.md +19 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.40.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.40.1.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.0.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.1.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.2.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.3.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.4.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.5.md +10 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.6.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.7.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.8.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.42.0.md +39 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.42.1.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.42.3.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.43.0.md +27 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.43.1.md +27 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.44.0.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.44.1.md +22 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.45.0.md +34 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.45.1.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.46.0.md +12 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.47.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.48.0.md +32 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.48.1.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.0.md +26 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.1.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.2.md +39 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.3.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.5.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.6.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.7.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.5.0.md +24 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.0.md +25 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.1.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.2.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.3.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.4.md +17 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.5.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.6.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.7.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.51.0.md +24 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.51.1.md +17 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.51.2.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.0.md +30 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.1.md +28 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.2.md +12 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.3.md +13 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.4.md +27 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.5.md +21 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.6.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.53.0.md +29 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.54.0.md +26 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.55.0.md +21 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.55.1.md +13 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.56.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.56.1.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.57.0.md +32 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.57.1.md +10 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.58.0.md +34 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.59.0.md +28 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.6.0.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.6.1.md +10 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.60.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.61.0.md +29 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.61.1.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.61.2.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.61.3.md +13 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.62.0.md +21 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.62.1.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.63.0.md +19 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.63.1.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.63.2.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.63.3.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.63.4.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.63.5.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.64.0.md +37 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.64.1.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.64.2.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.65.0.md +19 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.65.1.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.66.0.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.66.1.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.66.2.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.67.0.md +33 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.7.0.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.0.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.1.md +17 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.2.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.3.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.4.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.5.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.6.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.9.0.md +5 -0
- package/dist/web-ui/docs/cn/cli/remote-control.md +247 -0
- package/dist/web-ui/docs/cn/cli/sandboxing.md +316 -0
- package/dist/web-ui/docs/cn/cli/scheduled-tasks.md +161 -0
- package/dist/web-ui/docs/cn/cli/sdk-custom-tools.md +1195 -0
- package/dist/web-ui/docs/cn/cli/sdk-demos.md +347 -0
- package/dist/web-ui/docs/cn/cli/sdk-hooks.md +803 -0
- package/dist/web-ui/docs/cn/cli/sdk-mcp.md +643 -0
- package/dist/web-ui/docs/cn/cli/sdk-permissions.md +501 -0
- package/dist/web-ui/docs/cn/cli/sdk-python.md +783 -0
- package/dist/web-ui/docs/cn/cli/sdk-sessions.md +332 -0
- package/dist/web-ui/docs/cn/cli/sdk-typescript.md +759 -0
- package/dist/web-ui/docs/cn/cli/sdk.md +1105 -0
- package/dist/web-ui/docs/cn/cli/security.md +387 -0
- package/dist/web-ui/docs/cn/cli/settings.md +602 -0
- package/dist/web-ui/docs/cn/cli/skills.md +448 -0
- package/dist/web-ui/docs/cn/cli/slash-commands.md +397 -0
- package/dist/web-ui/docs/cn/cli/statusline.md +525 -0
- package/dist/web-ui/docs/cn/cli/sub-agents.md +634 -0
- package/dist/web-ui/docs/cn/cli/terminal-config.md +77 -0
- package/dist/web-ui/docs/cn/cli/tools-reference.md +99 -0
- package/dist/web-ui/docs/cn/cli/troubleshooting.md +190 -0
- package/dist/web-ui/docs/cn/cli/web-ui.md +164 -0
- package/dist/web-ui/docs/cn/cli/wecom-bot-setup.md +274 -0
- package/dist/web-ui/docs/cn/cli/worktree.md +660 -0
- package/dist/web-ui/docs/en/cli/acp.md +126 -0
- package/dist/web-ui/docs/en/cli/agent-teams.md +327 -0
- package/dist/web-ui/docs/en/cli/bash-sandboxing.md +357 -0
- package/dist/web-ui/docs/en/cli/best-practices.md +554 -0
- package/dist/web-ui/docs/en/cli/channels-reference.md +293 -0
- package/dist/web-ui/docs/en/cli/channels.md +215 -0
- package/dist/web-ui/docs/en/cli/checkpointing.md +53 -0
- package/dist/web-ui/docs/en/cli/cli-reference.md +187 -0
- package/dist/web-ui/docs/en/cli/common-workflows.md +1011 -0
- package/dist/web-ui/docs/en/cli/costs.md +174 -0
- package/dist/web-ui/docs/en/cli/devcontainer.md +553 -0
- package/dist/web-ui/docs/en/cli/env-vars.md +326 -0
- package/dist/web-ui/docs/en/cli/gitlab-ci-cd.md +357 -0
- package/dist/web-ui/docs/en/cli/headless.md +258 -0
- package/dist/web-ui/docs/en/cli/hooks-guide.md +9 -0
- package/dist/web-ui/docs/en/cli/hooks.md +801 -0
- package/dist/web-ui/docs/en/cli/iam.md +526 -0
- package/dist/web-ui/docs/en/cli/ide-integrations.md +92 -0
- package/dist/web-ui/docs/en/cli/installation.md +266 -0
- package/dist/web-ui/docs/en/cli/interactive-mode.md +233 -0
- package/dist/web-ui/docs/en/cli/mcp.md +739 -0
- package/dist/web-ui/docs/en/cli/memory.md +436 -0
- package/dist/web-ui/docs/en/cli/models.md +355 -0
- package/dist/web-ui/docs/en/cli/overview.md +100 -0
- package/dist/web-ui/docs/en/cli/plugin-marketplaces.md +534 -0
- package/dist/web-ui/docs/en/cli/plugins-reference.md +774 -0
- package/dist/web-ui/docs/en/cli/plugins.md +688 -0
- package/dist/web-ui/docs/en/cli/quickstart.md +249 -0
- package/dist/web-ui/docs/en/cli/release-notes/README.md +193 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.10.0.md +23 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.10.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.11.0.md +24 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.12.0.md +21 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.13.0.md +20 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.14.0.md +22 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.14.1.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.15.0.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.15.1.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.16.0.md +20 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.17.0.md +29 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.18.0.md +17 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.19.0.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.19.1.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.19.2.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.20.0.md +23 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.20.1.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.21.0.md +13 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.22.0.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.23.0.md +41 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.23.2.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.23.3.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.23.4.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.23.5.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.24.0.md +17 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.25.0.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.25.1.md +21 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.26.0.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.27.0.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.27.1.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.27.2.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.27.3.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.28.0.md +26 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.28.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.29.0.md +35 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.3.1.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.30.0.md +19 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.30.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.31.0.md +51 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.31.1.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.31.2.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.32.0.md +19 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.33.0.md +28 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.33.1.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.34.0.md +27 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.34.1.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.35.0.md +22 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.36.0.md +23 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.36.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.36.2.md +22 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.36.3.md +17 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.0.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.1.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.10.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.11.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.12.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.13.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.14.md +24 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.15.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.16.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.17.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.18.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.19.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.2.md +28 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.20.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.3.md +22 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.4.md +19 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.5.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.6.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.7.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.8.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.9.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.38.0.md +22 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.38.1.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.38.2.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.39.0.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.4.0.md +19 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.40.0.md +20 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.40.1.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.0.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.1.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.2.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.3.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.4.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.5.md +10 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.6.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.7.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.8.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.42.0.md +39 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.42.1.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.42.3.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.43.0.md +27 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.43.1.md +27 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.44.0.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.44.1.md +22 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.45.0.md +34 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.45.1.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.46.0.md +12 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.47.0.md +20 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.48.0.md +32 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.48.1.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.0.md +26 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.1.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.2.md +39 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.3.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.5.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.6.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.7.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.5.0.md +24 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.0.md +25 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.1.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.2.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.3.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.4.md +17 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.5.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.6.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.7.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.51.0.md +24 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.51.1.md +17 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.51.2.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.0.md +30 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.1.md +28 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.2.md +12 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.3.md +13 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.4.md +27 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.5.md +21 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.6.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.53.0.md +29 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.54.0.md +26 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.55.0.md +21 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.55.1.md +13 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.56.0.md +20 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.56.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.57.0.md +32 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.57.1.md +10 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.58.0.md +34 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.59.0.md +28 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.6.0.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.6.1.md +10 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.60.0.md +20 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.61.0.md +29 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.61.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.61.2.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.61.3.md +13 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.62.0.md +21 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.62.1.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.63.0.md +19 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.63.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.63.2.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.63.3.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.63.4.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.63.5.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.64.0.md +37 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.64.1.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.64.2.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.65.0.md +19 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.65.1.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.66.0.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.66.1.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.66.2.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.67.0.md +33 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.7.0.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.0.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.1.md +17 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.2.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.3.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.4.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.5.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.6.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.9.0.md +5 -0
- package/dist/web-ui/docs/en/cli/remote-control.md +247 -0
- package/dist/web-ui/docs/en/cli/sandboxing.md +316 -0
- package/dist/web-ui/docs/en/cli/scheduled-tasks.md +160 -0
- package/dist/web-ui/docs/en/cli/sdk-custom-tools.md +1131 -0
- package/dist/web-ui/docs/en/cli/sdk-demos.md +347 -0
- package/dist/web-ui/docs/en/cli/sdk-hooks.md +813 -0
- package/dist/web-ui/docs/en/cli/sdk-mcp.md +645 -0
- package/dist/web-ui/docs/en/cli/sdk-permissions.md +461 -0
- package/dist/web-ui/docs/en/cli/sdk-python.md +797 -0
- package/dist/web-ui/docs/en/cli/sdk-sessions.md +340 -0
- package/dist/web-ui/docs/en/cli/sdk-typescript.md +770 -0
- package/dist/web-ui/docs/en/cli/sdk.md +1103 -0
- package/dist/web-ui/docs/en/cli/security.md +388 -0
- package/dist/web-ui/docs/en/cli/settings.md +602 -0
- package/dist/web-ui/docs/en/cli/skills.md +448 -0
- package/dist/web-ui/docs/en/cli/slash-commands.md +397 -0
- package/dist/web-ui/docs/en/cli/statusline.md +525 -0
- package/dist/web-ui/docs/en/cli/sub-agents.md +621 -0
- package/dist/web-ui/docs/en/cli/terminal-config.md +77 -0
- package/dist/web-ui/docs/en/cli/tools-reference.md +99 -0
- package/dist/web-ui/docs/en/cli/troubleshooting.md +190 -0
- package/dist/web-ui/docs/en/cli/web-ui.md +164 -0
- package/dist/web-ui/docs/en/cli/wecom-bot-setup.md +274 -0
- package/dist/web-ui/docs/en/cli/worktree.md +660 -0
- package/dist/web-ui/docs/search-index-en.json +1 -0
- package/dist/web-ui/docs/search-index-zh.json +1 -0
- package/dist/web-ui/docs/sidebar-en.json +1 -0
- package/dist/web-ui/docs/sidebar-zh.json +1 -0
- package/dist/web-ui/index.html +2 -2
- package/package.json +3 -2
- package/product.cloudhosted.json +2 -2
- package/product.internal.json +2 -2
- package/product.ioa.json +2 -2
- package/product.json +3 -3
- package/product.selfhosted.json +2 -2
- package/dist/web-ui/assets/index-f_ibHSHw.css +0 -32
|
@@ -0,0 +1,759 @@
|
|
|
1
|
+
# TypeScript SDK 参考
|
|
2
|
+
|
|
3
|
+
> **版本要求**:本文档针对 CodeBuddy Agent SDK v0.1.0 及以上版本。
|
|
4
|
+
|
|
5
|
+
本文档提供 TypeScript SDK 的完整 API 参考。有关快速入门和使用示例,请参阅 [SDK 概览](sdk.md)。
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
| 依赖 | 版本要求 |
|
|
10
|
+
|------|---------|
|
|
11
|
+
| Node.js | >= 18.0.0 |
|
|
12
|
+
| TypeScript | >= 5.0.0(推荐) |
|
|
13
|
+
|
|
14
|
+
**运行时支持**:
|
|
15
|
+
- Node.js(推荐)
|
|
16
|
+
- Bun
|
|
17
|
+
- Deno
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install @tencent-ai/agent-sdk
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
或使用其他包管理器:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
yarn add @tencent-ai/agent-sdk
|
|
29
|
+
pnpm add @tencent-ai/agent-sdk
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### 环境变量
|
|
33
|
+
|
|
34
|
+
| 变量名 | 说明 | 必需 |
|
|
35
|
+
|--------|------|------|
|
|
36
|
+
| `CODEBUDDY_CODE_PATH` | CodeBuddy CLI 可执行文件路径 | 可选 |
|
|
37
|
+
|
|
38
|
+
### 认证配置
|
|
39
|
+
|
|
40
|
+
SDK 支持使用已有登录凭据、API Key 或 OAuth Client Credentials 认证,详见 [SDK 概览 - 认证配置](sdk.md#认证配置)。
|
|
41
|
+
|
|
42
|
+
## Functions
|
|
43
|
+
|
|
44
|
+
### query()
|
|
45
|
+
|
|
46
|
+
主要 API 入口,创建一个查询并返回消息流。
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
function query(params: {
|
|
50
|
+
prompt: string | AsyncIterable<UserMessage>;
|
|
51
|
+
options?: Options;
|
|
52
|
+
}): Query;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**参数**:
|
|
56
|
+
|
|
57
|
+
| 参数 | 类型 | 说明 |
|
|
58
|
+
|------|------|------|
|
|
59
|
+
| `prompt` | `string \| AsyncIterable<UserMessage>` | 查询提示词或用户消息流 |
|
|
60
|
+
| `options` | `Options` | 配置选项(可选) |
|
|
61
|
+
|
|
62
|
+
**返回值**:`Query` - 扩展了 `AsyncGenerator<Message, void>` 的接口
|
|
63
|
+
|
|
64
|
+
### Query 接口
|
|
65
|
+
|
|
66
|
+
```typescript
|
|
67
|
+
interface Query extends AsyncGenerator<Message, void> {
|
|
68
|
+
// 中断当前执行
|
|
69
|
+
interrupt(): Promise<void>;
|
|
70
|
+
|
|
71
|
+
// 动态修改权限模式
|
|
72
|
+
setPermissionMode(mode: PermissionMode): Promise<void>;
|
|
73
|
+
|
|
74
|
+
// 动态修改模型
|
|
75
|
+
setModel(model?: string): Promise<void>;
|
|
76
|
+
|
|
77
|
+
// 设置最大思考 token 数
|
|
78
|
+
setMaxThinkingTokens(tokens: number | null): Promise<void>;
|
|
79
|
+
|
|
80
|
+
// 获取可用权限模式列表
|
|
81
|
+
getAvailableModes(): Promise<ModeInfo[]>;
|
|
82
|
+
|
|
83
|
+
// 获取可用模型列表
|
|
84
|
+
getAvailableModels(): Promise<ModelInfo[]>;
|
|
85
|
+
|
|
86
|
+
// 获取支持的斜杠命令
|
|
87
|
+
supportedCommands(): Promise<SlashCommand[]>;
|
|
88
|
+
|
|
89
|
+
// 获取支持的模型列表
|
|
90
|
+
supportedModels(): Promise<ModelInfo[]>;
|
|
91
|
+
|
|
92
|
+
// 获取 MCP 服务器状态
|
|
93
|
+
mcpServerStatus(): Promise<McpServerStatus[]>;
|
|
94
|
+
|
|
95
|
+
// 获取账户信息
|
|
96
|
+
accountInfo(): Promise<AccountInfo>;
|
|
97
|
+
|
|
98
|
+
// 流式输入用户消息
|
|
99
|
+
streamInput(stream: AsyncIterable<UserMessage>): Promise<void>;
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Constants
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
// 所有支持的 Hook 事件
|
|
107
|
+
const HOOK_EVENTS: readonly [
|
|
108
|
+
'PreToolUse',
|
|
109
|
+
'PostToolUse',
|
|
110
|
+
'PostToolUseFailure',
|
|
111
|
+
'Notification',
|
|
112
|
+
'UserPromptSubmit',
|
|
113
|
+
'SessionStart',
|
|
114
|
+
'SessionEnd',
|
|
115
|
+
'Stop',
|
|
116
|
+
'SubagentStart',
|
|
117
|
+
'SubagentStop',
|
|
118
|
+
'PreCompact',
|
|
119
|
+
'PermissionRequest',
|
|
120
|
+
'WorktreeCreate',
|
|
121
|
+
'WorktreeRemove'
|
|
122
|
+
];
|
|
123
|
+
|
|
124
|
+
// 所有退出原因
|
|
125
|
+
const EXIT_REASONS: readonly [
|
|
126
|
+
'user_cancelled',
|
|
127
|
+
'tool_error',
|
|
128
|
+
'max_turns',
|
|
129
|
+
'max_budget_usd',
|
|
130
|
+
'completed',
|
|
131
|
+
'interrupted',
|
|
132
|
+
'hook_blocked'
|
|
133
|
+
];
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Errors
|
|
137
|
+
|
|
138
|
+
```typescript
|
|
139
|
+
class AbortError extends Error {
|
|
140
|
+
// 当操作被中止时抛出
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Unstable V2 API
|
|
145
|
+
|
|
146
|
+
> **警告**:以下 API 处于实验阶段,接口可能在未来版本中变更。
|
|
147
|
+
|
|
148
|
+
### unstable_v2_createSession()
|
|
149
|
+
|
|
150
|
+
创建新的交互式会话。
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
function unstable_v2_createSession(options: SessionOptions): Session;
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### unstable_v2_resumeSession()
|
|
157
|
+
|
|
158
|
+
恢复现有会话。
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
function unstable_v2_resumeSession(
|
|
162
|
+
sessionId: string,
|
|
163
|
+
options: SessionOptions
|
|
164
|
+
): Session;
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### unstable_v2_prompt()
|
|
168
|
+
|
|
169
|
+
单次查询便捷函数。
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
function unstable_v2_prompt(
|
|
173
|
+
message: string,
|
|
174
|
+
options: SessionOptions
|
|
175
|
+
): Promise<Message[]>;
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### unstable_v2_authenticate()
|
|
179
|
+
|
|
180
|
+
发起交互式登录流程,支持多环境认证(海外版、国内版等)。
|
|
181
|
+
|
|
182
|
+
```typescript
|
|
183
|
+
function unstable_v2_authenticate(options: AuthenticateOptions): Promise<AuthenticateResponse>;
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**参数**:
|
|
187
|
+
|
|
188
|
+
| 字段 | 类型 | 说明 |
|
|
189
|
+
|------|------|------|
|
|
190
|
+
| `onAuthUrl` | `(authState: AuthState) => Promise<void>` | 认证 URL 回调,用于打开浏览器或显示链接 |
|
|
191
|
+
| `environment` | `'external' \| 'internal' \| 'ioa' \| 'cloudhosted'` | 预定义环境(与 endpoint 二选一) |
|
|
192
|
+
| `endpoint` | `string` | 自定义 endpoint URL(用于 selfhosted,与 environment 二选一) |
|
|
193
|
+
| `methodId` | `string` | 认证方法 ID,默认 'external' |
|
|
194
|
+
| `timeout` | `number` | 超时时间(毫秒),默认 300000 |
|
|
195
|
+
| `pathToCodebuddyCode` | `string` | CLI 可执行文件路径(可选) |
|
|
196
|
+
| `env` | `Record<string, string>` | 环境变量(可选) |
|
|
197
|
+
|
|
198
|
+
**返回值**:`Promise<AuthenticateResponse>`
|
|
199
|
+
|
|
200
|
+
- `userinfo` - 用户信息对象,包含 userId、userName、userNickname、token 等字段
|
|
201
|
+
|
|
202
|
+
**示例**:
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
import { unstable_v2_authenticate } from '@tencent-ai/agent-sdk';
|
|
206
|
+
import open from 'open';
|
|
207
|
+
|
|
208
|
+
// 海外版登录
|
|
209
|
+
const result = await unstable_v2_authenticate({
|
|
210
|
+
environment: 'external',
|
|
211
|
+
onAuthUrl: async (authState) => {
|
|
212
|
+
console.log('请登录:', authState.authUrl);
|
|
213
|
+
await open(authState.authUrl);
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
console.log('登录成功:', result.userinfo.userName);
|
|
218
|
+
|
|
219
|
+
// 私有化部署登录
|
|
220
|
+
const result2 = await unstable_v2_authenticate({
|
|
221
|
+
endpoint: 'https://your-company.com',
|
|
222
|
+
onAuthUrl: async (authState) => {
|
|
223
|
+
console.log('请登录:', authState.authUrl);
|
|
224
|
+
await open(authState.authUrl);
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
**行为说明**:
|
|
230
|
+
|
|
231
|
+
- 如果已有有效 token,直接返回用户信息,不会触发登录流程
|
|
232
|
+
- 否则通过 `onAuthUrl` 回调通知用户打开登录链接
|
|
233
|
+
- 登录成功后 token 会被缓存,下次调用自动复用
|
|
234
|
+
|
|
235
|
+
### unstable_v2_logout()
|
|
236
|
+
|
|
237
|
+
登出并清除缓存的认证 token,下次调用 `authenticate()` 将重新登录。
|
|
238
|
+
|
|
239
|
+
```typescript
|
|
240
|
+
function unstable_v2_logout(options?: LogoutOptions): Promise<void>;
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
**参数**:
|
|
244
|
+
|
|
245
|
+
| 字段 | 类型 | 说明 |
|
|
246
|
+
|------|------|------|
|
|
247
|
+
| `environment` | `'external' \| 'internal' \| 'ioa' \| 'cloudhosted'` | 预定义环境(与 endpoint 二选一) |
|
|
248
|
+
| `endpoint` | `string` | 自定义 endpoint URL(与 environment 二选一) |
|
|
249
|
+
| `pathToCodebuddyCode` | `string` | CLI 可执行文件路径(可选) |
|
|
250
|
+
| `env` | `Record<string, string>` | 环境变量(可选) |
|
|
251
|
+
|
|
252
|
+
**示例**:
|
|
253
|
+
|
|
254
|
+
```typescript
|
|
255
|
+
import { unstable_v2_authenticate, unstable_v2_logout } from '@tencent-ai/agent-sdk';
|
|
256
|
+
|
|
257
|
+
// 登录
|
|
258
|
+
const result = await unstable_v2_authenticate({
|
|
259
|
+
environment: 'external',
|
|
260
|
+
onAuthUrl: (authState) => console.log('Login:', authState.authUrl),
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
// 登出
|
|
264
|
+
await unstable_v2_logout({ environment: 'external' });
|
|
265
|
+
|
|
266
|
+
// 以不同用户重新登录
|
|
267
|
+
const newUser = await unstable_v2_authenticate({
|
|
268
|
+
environment: 'external',
|
|
269
|
+
onAuthUrl: (authState) => console.log('Login:', authState.authUrl),
|
|
270
|
+
});
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Session 接口
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
interface Session {
|
|
277
|
+
// 会话 ID(初始化后可用)
|
|
278
|
+
readonly sessionId: string;
|
|
279
|
+
|
|
280
|
+
// 发送消息
|
|
281
|
+
send(message: string | UserMessage): Promise<void>;
|
|
282
|
+
|
|
283
|
+
// 获取响应流
|
|
284
|
+
stream(): AsyncGenerator<Message, void>;
|
|
285
|
+
|
|
286
|
+
// 关闭会话
|
|
287
|
+
close(): void;
|
|
288
|
+
|
|
289
|
+
// 异步释放
|
|
290
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### SessionOptions
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
type SessionOptions = {
|
|
298
|
+
model: string;
|
|
299
|
+
pathToCodebuddyCode?: string;
|
|
300
|
+
executable?: 'node' | 'bun';
|
|
301
|
+
executableArgs?: string[];
|
|
302
|
+
env?: Record<string, string | undefined>;
|
|
303
|
+
canUseTool?: CanUseTool;
|
|
304
|
+
};
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
## Types
|
|
308
|
+
|
|
309
|
+
### Options
|
|
310
|
+
|
|
311
|
+
完整配置选项:
|
|
312
|
+
|
|
313
|
+
| 字段 | 类型 | 说明 |
|
|
314
|
+
|------|------|------|
|
|
315
|
+
| `abortController` | `AbortController` | 用于取消请求 |
|
|
316
|
+
| `executable` | `'bun' \| 'deno' \| 'node'` | 运行时 |
|
|
317
|
+
| `executableArgs` | `string[]` | 运行时参数 |
|
|
318
|
+
| `pathToCodebuddyCode` | `string` | CLI 路径 |
|
|
319
|
+
| `cwd` | `string` | 工作目录 |
|
|
320
|
+
| `additionalDirectories` | `string[]` | 额外的目录 |
|
|
321
|
+
| `env` | `Record<string, string \| undefined>` | 环境变量 |
|
|
322
|
+
| `model` | `string` | 指定模型 |
|
|
323
|
+
| `fallbackModel` | `string` | 备用模型 |
|
|
324
|
+
| `maxThinkingTokens` | `number` | 最大思考 token 数(已废弃,请使用 `thinking`) |
|
|
325
|
+
| `thinking` | `ThinkingConfig` | 思考模式配置:`{ type: 'adaptive' }`、`{ type: 'enabled', budgetTokens: N }` 或 `{ type: 'disabled' }` |
|
|
326
|
+
| `effort` | `'low' \| 'medium' \| 'high' \| 'xhigh'` | 模型推理努力程度 |
|
|
327
|
+
| `allowedTools` | `string[]` | 允许的工具白名单 |
|
|
328
|
+
| `disallowedTools` | `string[]` | 禁止的工具黑名单 |
|
|
329
|
+
| `canUseTool` | `CanUseTool` | 权限回调函数 |
|
|
330
|
+
| `permissionMode` | `PermissionMode` | 权限模式 |
|
|
331
|
+
| `allowDangerouslySkipPermissions` | `boolean` | 允许跳过权限 |
|
|
332
|
+
| `permissionPromptToolName` | `string` | 权限提示工具名 |
|
|
333
|
+
| `continue` | `boolean` | 继续最近的会话 |
|
|
334
|
+
| `resume` | `string` | 要恢复的会话 ID |
|
|
335
|
+
| `resumeSessionAt` | `string` | 恢复到特定消息位置 |
|
|
336
|
+
| `persistSession` | `boolean` | 持久化会话 |
|
|
337
|
+
| `forkSession` | `boolean` | 分叉会话 |
|
|
338
|
+
| `agents` | `Record<string, AgentDefinition>` | 自定义 Agent |
|
|
339
|
+
| `hooks` | `Partial<Record<HookEvent, HookCallbackMatcher[]>>` | Hook 配置 |
|
|
340
|
+
| `outputFormat` | `OutputFormat` | 输出格式 |
|
|
341
|
+
| `systemPrompt` | `string \| { append: string }` | 系统提示词 |
|
|
342
|
+
| `includePartialMessages` | `boolean` | 包含部分消息 |
|
|
343
|
+
| `maxTurns` | `number` | 最大对话轮数 |
|
|
344
|
+
| `mcpServers` | `Record<string, McpServerConfig>` | MCP 服务器配置 |
|
|
345
|
+
| `strictMcpConfig` | `boolean` | 严格 MCP 配置 |
|
|
346
|
+
| `sandbox` | `SandboxSettings` | 沙箱设置 |
|
|
347
|
+
| `settingSources` | `SettingSource[]` | 配置源,控制加载哪些文件系统配置。默认不加载任何配置 |
|
|
348
|
+
|
|
349
|
+
### SettingSource
|
|
350
|
+
|
|
351
|
+
控制 SDK 从哪些文件系统位置加载配置。
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
type SettingSource = 'user' | 'project' | 'local';
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
| 值 | 说明 | 位置 |
|
|
358
|
+
|-----|------|------|
|
|
359
|
+
| `'user'` | 全局用户设置 | `~/.codebuddy/settings.json` |
|
|
360
|
+
| `'project'` | 项目共享设置 | `.codebuddy/settings.json` |
|
|
361
|
+
| `'local'` | 项目本地设置 | `.codebuddy/settings.local.json` |
|
|
362
|
+
|
|
363
|
+
**默认行为**:当 `settingSources` 未指定时,SDK **不加载任何文件系统配置**。这提供了完全干净的运行环境。
|
|
364
|
+
|
|
365
|
+
```typescript
|
|
366
|
+
// 默认:不加载任何配置(干净环境)
|
|
367
|
+
const q = query({ prompt: '...' });
|
|
368
|
+
|
|
369
|
+
// 加载项目配置
|
|
370
|
+
const q = query({
|
|
371
|
+
prompt: '...',
|
|
372
|
+
options: { settingSources: ['project'] }
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
// 加载所有配置(类似 CLI 行为)
|
|
376
|
+
const q = query({
|
|
377
|
+
prompt: '...',
|
|
378
|
+
options: { settingSources: ['user', 'project', 'local'] }
|
|
379
|
+
});
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
### PermissionMode
|
|
383
|
+
|
|
384
|
+
```typescript
|
|
385
|
+
type PermissionMode =
|
|
386
|
+
| 'default' // 默认模式,所有操作需确认
|
|
387
|
+
| 'acceptEdits' // 自动批准文件编辑
|
|
388
|
+
| 'bypassPermissions' // 跳过所有权限检查
|
|
389
|
+
| 'plan' // 规划模式,仅允许读取
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
### PermissionResult
|
|
393
|
+
|
|
394
|
+
```typescript
|
|
395
|
+
type PermissionResult =
|
|
396
|
+
| {
|
|
397
|
+
behavior: 'allow';
|
|
398
|
+
updatedInput: Record<string, unknown>;
|
|
399
|
+
updatedPermissions?: PermissionUpdate[];
|
|
400
|
+
toolUseID?: string;
|
|
401
|
+
}
|
|
402
|
+
| {
|
|
403
|
+
behavior: 'deny';
|
|
404
|
+
message: string;
|
|
405
|
+
interrupt?: boolean;
|
|
406
|
+
toolUseID?: string;
|
|
407
|
+
};
|
|
408
|
+
```
|
|
409
|
+
|
|
410
|
+
### CanUseTool
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
type CanUseTool = (
|
|
414
|
+
toolName: string,
|
|
415
|
+
input: Record<string, unknown>,
|
|
416
|
+
options: CanUseToolOptions
|
|
417
|
+
) => Promise<PermissionResult>;
|
|
418
|
+
|
|
419
|
+
type CanUseToolOptions = {
|
|
420
|
+
signal: AbortSignal;
|
|
421
|
+
suggestions?: PermissionUpdate[];
|
|
422
|
+
blockedPath?: string;
|
|
423
|
+
decisionReason?: string;
|
|
424
|
+
toolUseID: string;
|
|
425
|
+
agentID?: string;
|
|
426
|
+
};
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
### AgentDefinition
|
|
430
|
+
|
|
431
|
+
```typescript
|
|
432
|
+
type AgentDefinition = {
|
|
433
|
+
description: string; // Agent 描述
|
|
434
|
+
prompt: string; // 系统提示词
|
|
435
|
+
tools?: string[]; // 允许的工具
|
|
436
|
+
disallowedTools?: string[]; // 禁止的工具
|
|
437
|
+
model?: string; // 使用的模型
|
|
438
|
+
};
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### ModeInfo
|
|
442
|
+
|
|
443
|
+
```typescript
|
|
444
|
+
interface ModeInfo {
|
|
445
|
+
id: string; // 模式 ID
|
|
446
|
+
name: string; // 显示名称
|
|
447
|
+
description: string; // 模式说明
|
|
448
|
+
}
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### ModelInfo
|
|
452
|
+
|
|
453
|
+
```typescript
|
|
454
|
+
interface ModelInfo {
|
|
455
|
+
modelId: string; // 模型 ID
|
|
456
|
+
name: string; // 显示名称
|
|
457
|
+
description?: string; // 模型说明
|
|
458
|
+
}
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
### McpServerConfig
|
|
462
|
+
|
|
463
|
+
```typescript
|
|
464
|
+
// Stdio 类型
|
|
465
|
+
type McpStdioServerConfig = {
|
|
466
|
+
type?: 'stdio';
|
|
467
|
+
command: string;
|
|
468
|
+
args?: string[];
|
|
469
|
+
env?: Record<string, string>;
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
// SSE 类型
|
|
473
|
+
type McpSSEServerConfig = {
|
|
474
|
+
type: 'sse';
|
|
475
|
+
url: string;
|
|
476
|
+
headers?: Record<string, string>;
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
// HTTP 类型
|
|
480
|
+
type McpHttpServerConfig = {
|
|
481
|
+
type: 'http';
|
|
482
|
+
url: string;
|
|
483
|
+
headers?: Record<string, string>;
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
type McpServerConfig =
|
|
487
|
+
| McpStdioServerConfig
|
|
488
|
+
| McpSSEServerConfig
|
|
489
|
+
| McpHttpServerConfig;
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### HookEvent
|
|
493
|
+
|
|
494
|
+
```typescript
|
|
495
|
+
type HookEvent =
|
|
496
|
+
| 'PreToolUse'
|
|
497
|
+
| 'PostToolUse'
|
|
498
|
+
| 'PostToolUseFailure'
|
|
499
|
+
| 'Notification'
|
|
500
|
+
| 'UserPromptSubmit'
|
|
501
|
+
| 'SessionStart'
|
|
502
|
+
| 'SessionEnd'
|
|
503
|
+
| 'Stop'
|
|
504
|
+
| 'SubagentStart'
|
|
505
|
+
| 'SubagentStop'
|
|
506
|
+
| 'PreCompact'
|
|
507
|
+
| 'PermissionRequest'
|
|
508
|
+
| 'WorktreeCreate'
|
|
509
|
+
| 'WorktreeRemove';
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
### HookCallback
|
|
513
|
+
|
|
514
|
+
```typescript
|
|
515
|
+
type HookCallback = (
|
|
516
|
+
input: HookInput,
|
|
517
|
+
toolUseID: string | undefined,
|
|
518
|
+
options: { signal: AbortSignal }
|
|
519
|
+
) => Promise<HookJSONOutput>;
|
|
520
|
+
|
|
521
|
+
interface HookCallbackMatcher {
|
|
522
|
+
matcher?: string; // 匹配模式(支持正则)
|
|
523
|
+
hooks: HookCallback[]; // 回调函数列表
|
|
524
|
+
timeout?: number; // 超时时间(毫秒)
|
|
525
|
+
}
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
### HookJSONOutput
|
|
529
|
+
|
|
530
|
+
```typescript
|
|
531
|
+
// 同步输出
|
|
532
|
+
type SyncHookJSONOutput = {
|
|
533
|
+
continue?: boolean;
|
|
534
|
+
suppressOutput?: boolean;
|
|
535
|
+
stopReason?: string;
|
|
536
|
+
decision?: 'approve' | 'block';
|
|
537
|
+
systemMessage?: string;
|
|
538
|
+
reason?: string;
|
|
539
|
+
hookSpecificOutput?: Record<string, unknown>;
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
// 异步输出
|
|
543
|
+
type AsyncHookJSONOutput = {
|
|
544
|
+
async: true;
|
|
545
|
+
asyncTimeout?: number;
|
|
546
|
+
};
|
|
547
|
+
|
|
548
|
+
type HookJSONOutput = SyncHookJSONOutput | AsyncHookJSONOutput;
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
## Message Types
|
|
552
|
+
|
|
553
|
+
### Message
|
|
554
|
+
|
|
555
|
+
所有消息类型的联合:
|
|
556
|
+
|
|
557
|
+
```typescript
|
|
558
|
+
type Message =
|
|
559
|
+
| SystemMessage
|
|
560
|
+
| UserMessage
|
|
561
|
+
| AssistantMessage
|
|
562
|
+
| PartialAssistantMessage
|
|
563
|
+
| ResultMessage
|
|
564
|
+
| CompactBoundaryMessage
|
|
565
|
+
| StatusMessage
|
|
566
|
+
| ToolProgressMessage;
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
### SystemMessage
|
|
570
|
+
|
|
571
|
+
```typescript
|
|
572
|
+
type SystemMessage = {
|
|
573
|
+
type: 'system';
|
|
574
|
+
subtype: 'init';
|
|
575
|
+
uuid: string;
|
|
576
|
+
session_id: string;
|
|
577
|
+
apiKeySource?: string;
|
|
578
|
+
cwd?: string;
|
|
579
|
+
tools: string[];
|
|
580
|
+
mcp_servers?: Array<{ name: string; status: string }>;
|
|
581
|
+
model: string;
|
|
582
|
+
permissionMode: PermissionMode;
|
|
583
|
+
slash_commands?: string[];
|
|
584
|
+
codebuddy_code_version?: string;
|
|
585
|
+
skills?: string[];
|
|
586
|
+
plugins?: Array<{ name: string; path: string }>;
|
|
587
|
+
};
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
### UserMessage
|
|
591
|
+
|
|
592
|
+
```typescript
|
|
593
|
+
type UserMessage = {
|
|
594
|
+
type: 'user';
|
|
595
|
+
uuid?: string;
|
|
596
|
+
session_id: string;
|
|
597
|
+
message: {
|
|
598
|
+
role: 'user';
|
|
599
|
+
content: string | ContentBlock[];
|
|
600
|
+
};
|
|
601
|
+
parent_tool_use_id: string | null;
|
|
602
|
+
isSynthetic?: boolean;
|
|
603
|
+
tool_use_result?: unknown;
|
|
604
|
+
};
|
|
605
|
+
```
|
|
606
|
+
|
|
607
|
+
### AssistantMessage
|
|
608
|
+
|
|
609
|
+
```typescript
|
|
610
|
+
type AssistantMessage = {
|
|
611
|
+
type: 'assistant';
|
|
612
|
+
uuid: string;
|
|
613
|
+
session_id: string;
|
|
614
|
+
message: {
|
|
615
|
+
id: string;
|
|
616
|
+
type: 'message';
|
|
617
|
+
role: 'assistant';
|
|
618
|
+
model: string;
|
|
619
|
+
content: ContentBlock[];
|
|
620
|
+
stop_reason: StopReason | null;
|
|
621
|
+
stop_sequence: string | null;
|
|
622
|
+
usage: Usage;
|
|
623
|
+
};
|
|
624
|
+
parent_tool_use_id: string | null;
|
|
625
|
+
error?: string;
|
|
626
|
+
};
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
### ResultMessage
|
|
630
|
+
|
|
631
|
+
```typescript
|
|
632
|
+
type ResultMessage =
|
|
633
|
+
| {
|
|
634
|
+
type: 'result';
|
|
635
|
+
subtype: 'success';
|
|
636
|
+
uuid: string;
|
|
637
|
+
session_id: string;
|
|
638
|
+
duration_ms: number;
|
|
639
|
+
duration_api_ms: number;
|
|
640
|
+
is_error: boolean;
|
|
641
|
+
num_turns: number;
|
|
642
|
+
result: string;
|
|
643
|
+
total_cost_usd: number;
|
|
644
|
+
usage: Usage;
|
|
645
|
+
permission_denials: PermissionDenial[];
|
|
646
|
+
structured_output?: unknown;
|
|
647
|
+
}
|
|
648
|
+
| {
|
|
649
|
+
type: 'result';
|
|
650
|
+
subtype: 'error_during_execution' | 'error_max_turns' | 'error_max_budget_usd';
|
|
651
|
+
uuid: string;
|
|
652
|
+
session_id: string;
|
|
653
|
+
duration_ms: number;
|
|
654
|
+
duration_api_ms: number;
|
|
655
|
+
is_error: boolean;
|
|
656
|
+
num_turns: number;
|
|
657
|
+
total_cost_usd: number;
|
|
658
|
+
usage: Usage;
|
|
659
|
+
permission_denials: PermissionDenial[];
|
|
660
|
+
errors?: string[];
|
|
661
|
+
};
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
### ContentBlock
|
|
665
|
+
|
|
666
|
+
```typescript
|
|
667
|
+
// 文本内容块
|
|
668
|
+
interface TextContentBlock {
|
|
669
|
+
type: 'text';
|
|
670
|
+
text: string;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// 工具调用块
|
|
674
|
+
interface ToolUseContentBlock {
|
|
675
|
+
type: 'tool_use';
|
|
676
|
+
id: string;
|
|
677
|
+
name: string;
|
|
678
|
+
input: Record<string, unknown>;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
// 工具结果块
|
|
682
|
+
interface ToolResultContentBlock {
|
|
683
|
+
type: 'tool_result';
|
|
684
|
+
tool_use_id: string;
|
|
685
|
+
content?: string | ContentBlock[];
|
|
686
|
+
is_error?: boolean;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
type ContentBlock =
|
|
690
|
+
| TextContentBlock
|
|
691
|
+
| ToolUseContentBlock
|
|
692
|
+
| ToolResultContentBlock;
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
### Usage
|
|
696
|
+
|
|
697
|
+
```typescript
|
|
698
|
+
interface Usage {
|
|
699
|
+
input_tokens: number;
|
|
700
|
+
output_tokens: number;
|
|
701
|
+
cache_read_input_tokens?: number | null;
|
|
702
|
+
cache_creation_input_tokens?: number | null;
|
|
703
|
+
}
|
|
704
|
+
```
|
|
705
|
+
|
|
706
|
+
## Input Types
|
|
707
|
+
|
|
708
|
+
### AskUserQuestionInput
|
|
709
|
+
|
|
710
|
+
```typescript
|
|
711
|
+
interface AskUserQuestionInput {
|
|
712
|
+
// 要询问的问题列表(1-4 个问题)
|
|
713
|
+
questions: AskUserQuestionQuestion[];
|
|
714
|
+
// 用户答案(由权限组件收集)
|
|
715
|
+
answers?: Record<string, string>;
|
|
716
|
+
}
|
|
717
|
+
```
|
|
718
|
+
|
|
719
|
+
### AskUserQuestionQuestion
|
|
720
|
+
|
|
721
|
+
```typescript
|
|
722
|
+
interface AskUserQuestionQuestion {
|
|
723
|
+
// 完整问题文本(应以 ? 结尾)
|
|
724
|
+
question: string;
|
|
725
|
+
// 简短标签(最多 12 个字符)
|
|
726
|
+
header: string;
|
|
727
|
+
// 可用选项(2-4 个选项)
|
|
728
|
+
options: AskUserQuestionOption[];
|
|
729
|
+
// 是否允许多选
|
|
730
|
+
multiSelect: boolean;
|
|
731
|
+
}
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
### AskUserQuestionOption
|
|
735
|
+
|
|
736
|
+
```typescript
|
|
737
|
+
interface AskUserQuestionOption {
|
|
738
|
+
// 显示文本(1-5 个单词)
|
|
739
|
+
label: string;
|
|
740
|
+
// 选项说明
|
|
741
|
+
description: string;
|
|
742
|
+
}
|
|
743
|
+
```
|
|
744
|
+
|
|
745
|
+
### ToolInputMap
|
|
746
|
+
|
|
747
|
+
```typescript
|
|
748
|
+
interface ToolInputMap {
|
|
749
|
+
AskUserQuestion: AskUserQuestionInput;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
type KnownToolName = keyof ToolInputMap;
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
## 相关文档
|
|
756
|
+
|
|
757
|
+
- [SDK 概览](sdk.md) - 快速入门和使用示例
|
|
758
|
+
- [Hook 参考指南](hooks.md) - 详细的 Hook 配置说明
|
|
759
|
+
- [MCP 集成](mcp.md) - MCP 服务器配置指南
|