@tencent-ai/agent-sdk 0.3.99 → 0.3.101
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/cli/CHANGELOG.md +50 -0
- package/cli/dist/codebuddy-headless.js +140 -131
- package/cli/dist/web-ui/assets/index-CIqmZV3y.js +440 -0
- package/cli/dist/web-ui/assets/index-Dt1puyHn.css +32 -0
- package/cli/dist/web-ui/docs/cn/cli/acp.md +152 -0
- package/cli/dist/web-ui/docs/cn/cli/agent-teams.md +327 -0
- package/cli/dist/web-ui/docs/cn/cli/bash-sandboxing.md +290 -0
- package/cli/dist/web-ui/docs/cn/cli/best-practices.md +554 -0
- package/cli/dist/web-ui/docs/cn/cli/channels-reference.md +293 -0
- package/cli/dist/web-ui/docs/cn/cli/channels.md +215 -0
- package/cli/dist/web-ui/docs/cn/cli/checkpointing.md +51 -0
- package/cli/dist/web-ui/docs/cn/cli/cli-reference.md +187 -0
- package/cli/dist/web-ui/docs/cn/cli/common-workflows.md +1013 -0
- package/cli/dist/web-ui/docs/cn/cli/costs.md +174 -0
- package/cli/dist/web-ui/docs/cn/cli/devcontainer.md +553 -0
- package/cli/dist/web-ui/docs/cn/cli/env-vars.md +326 -0
- package/cli/dist/web-ui/docs/cn/cli/gitlab-ci-cd.md +357 -0
- package/cli/dist/web-ui/docs/cn/cli/headless.md +258 -0
- package/cli/dist/web-ui/docs/cn/cli/hooks-guide.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/hooks.md +805 -0
- package/cli/dist/web-ui/docs/cn/cli/iam.md +530 -0
- package/cli/dist/web-ui/docs/cn/cli/ide-integrations.md +92 -0
- package/cli/dist/web-ui/docs/cn/cli/installation.md +291 -0
- package/cli/dist/web-ui/docs/cn/cli/interactive-mode.md +233 -0
- package/cli/dist/web-ui/docs/cn/cli/mcp.md +739 -0
- package/cli/dist/web-ui/docs/cn/cli/memory.md +436 -0
- package/cli/dist/web-ui/docs/cn/cli/models.md +356 -0
- package/cli/dist/web-ui/docs/cn/cli/overview.md +100 -0
- package/cli/dist/web-ui/docs/cn/cli/plugin-marketplaces.md +533 -0
- package/cli/dist/web-ui/docs/cn/cli/plugins-reference.md +774 -0
- package/cli/dist/web-ui/docs/cn/cli/plugins.md +689 -0
- package/cli/dist/web-ui/docs/cn/cli/quickstart.md +249 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/README.md +200 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.10.0.md +23 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.10.1.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.11.0.md +24 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.12.0.md +21 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.13.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.14.0.md +22 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.14.1.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.15.0.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.15.1.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.16.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.17.0.md +29 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.18.0.md +17 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.19.0.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.19.1.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.19.2.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.20.0.md +23 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.20.1.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.21.0.md +13 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.22.0.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.23.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.23.2.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.23.3.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.23.4.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.23.5.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.24.0.md +17 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.25.0.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.25.1.md +21 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.26.0.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.27.0.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.27.1.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.27.2.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.27.3.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.28.0.md +26 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.28.1.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.29.0.md +35 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.3.1.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.30.0.md +19 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.30.1.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.31.0.md +51 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.31.1.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.31.2.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.32.0.md +19 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.33.0.md +28 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.33.1.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.36.3.md +17 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.0.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.1.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.10.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.11.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.12.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.13.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.14.md +24 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.15.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.16.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.17.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.18.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.19.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.2.md +28 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.20.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.3.md +22 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.4.md +19 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.5.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.6.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.7.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.8.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.37.9.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.38.0.md +22 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.38.1.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.38.2.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.39.0.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.4.0.md +19 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.40.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.40.1.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.0.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.1.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.2.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.3.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.4.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.5.md +10 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.6.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.7.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.41.8.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.42.0.md +39 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.42.1.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.42.3.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.43.0.md +27 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.43.1.md +27 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.44.0.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.44.1.md +22 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.45.0.md +34 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.45.1.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.46.0.md +12 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.47.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.48.0.md +32 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.48.1.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.0.md +26 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.1.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.2.md +39 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.3.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.5.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.6.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.49.7.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.5.0.md +24 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.0.md +25 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.1.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.2.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.3.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.4.md +17 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.5.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.6.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.50.7.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.51.0.md +24 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.51.1.md +17 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.51.2.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.0.md +30 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.1.md +28 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.2.md +12 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.3.md +13 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.4.md +27 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.5.md +21 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.52.6.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.53.0.md +29 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.54.0.md +26 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.55.0.md +21 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.55.1.md +13 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.56.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.56.1.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.57.0.md +32 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.57.1.md +10 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.58.0.md +34 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.59.0.md +28 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.6.0.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.6.1.md +10 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.60.0.md +20 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.61.0.md +29 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.61.1.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.61.2.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.61.3.md +13 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.62.0.md +21 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.62.1.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.63.0.md +19 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.63.1.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.63.2.md +7 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.63.3.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.63.4.md +8 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.63.5.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.64.0.md +37 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.64.1.md +6 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.64.2.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.65.0.md +19 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.65.1.md +11 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.66.0.md +15 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.66.1.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.66.2.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.67.0.md +33 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.68.0.md +28 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.7.0.md +16 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.0.md +18 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.1.md +17 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.2.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.3.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.4.md +9 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.5.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.8.6.md +14 -0
- package/cli/dist/web-ui/docs/cn/cli/release-notes/v2.9.0.md +5 -0
- package/cli/dist/web-ui/docs/cn/cli/remote-control.md +247 -0
- package/cli/dist/web-ui/docs/cn/cli/sandboxing.md +316 -0
- package/cli/dist/web-ui/docs/cn/cli/scheduled-tasks.md +161 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-custom-tools.md +1195 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-demos.md +347 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-hooks.md +803 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-mcp.md +643 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-permissions.md +501 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-python.md +783 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-sessions.md +332 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk-typescript.md +759 -0
- package/cli/dist/web-ui/docs/cn/cli/sdk.md +1105 -0
- package/cli/dist/web-ui/docs/cn/cli/security.md +387 -0
- package/cli/dist/web-ui/docs/cn/cli/settings.md +602 -0
- package/cli/dist/web-ui/docs/cn/cli/skills.md +448 -0
- package/cli/dist/web-ui/docs/cn/cli/slash-commands.md +397 -0
- package/cli/dist/web-ui/docs/cn/cli/statusline.md +525 -0
- package/cli/dist/web-ui/docs/cn/cli/sub-agents.md +634 -0
- package/cli/dist/web-ui/docs/cn/cli/terminal-config.md +77 -0
- package/cli/dist/web-ui/docs/cn/cli/tools-reference.md +99 -0
- package/cli/dist/web-ui/docs/cn/cli/troubleshooting.md +190 -0
- package/cli/dist/web-ui/docs/cn/cli/web-ui.md +164 -0
- package/cli/dist/web-ui/docs/cn/cli/wecom-bot-setup.md +274 -0
- package/cli/dist/web-ui/docs/cn/cli/worktree.md +660 -0
- package/cli/dist/web-ui/docs/en/cli/acp.md +126 -0
- package/cli/dist/web-ui/docs/en/cli/agent-teams.md +327 -0
- package/cli/dist/web-ui/docs/en/cli/bash-sandboxing.md +290 -0
- package/cli/dist/web-ui/docs/en/cli/best-practices.md +554 -0
- package/cli/dist/web-ui/docs/en/cli/channels-reference.md +293 -0
- package/cli/dist/web-ui/docs/en/cli/channels.md +215 -0
- package/cli/dist/web-ui/docs/en/cli/checkpointing.md +53 -0
- package/cli/dist/web-ui/docs/en/cli/cli-reference.md +187 -0
- package/cli/dist/web-ui/docs/en/cli/common-workflows.md +1013 -0
- package/cli/dist/web-ui/docs/en/cli/costs.md +174 -0
- package/cli/dist/web-ui/docs/en/cli/devcontainer.md +553 -0
- package/cli/dist/web-ui/docs/en/cli/env-vars.md +326 -0
- package/cli/dist/web-ui/docs/en/cli/gitlab-ci-cd.md +357 -0
- package/cli/dist/web-ui/docs/en/cli/headless.md +258 -0
- package/cli/dist/web-ui/docs/en/cli/hooks-guide.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/hooks.md +801 -0
- package/cli/dist/web-ui/docs/en/cli/iam.md +530 -0
- package/cli/dist/web-ui/docs/en/cli/ide-integrations.md +92 -0
- package/cli/dist/web-ui/docs/en/cli/installation.md +266 -0
- package/cli/dist/web-ui/docs/en/cli/interactive-mode.md +233 -0
- package/cli/dist/web-ui/docs/en/cli/mcp.md +739 -0
- package/cli/dist/web-ui/docs/en/cli/memory.md +436 -0
- package/cli/dist/web-ui/docs/en/cli/models.md +355 -0
- package/cli/dist/web-ui/docs/en/cli/overview.md +100 -0
- package/cli/dist/web-ui/docs/en/cli/plugin-marketplaces.md +534 -0
- package/cli/dist/web-ui/docs/en/cli/plugins-reference.md +774 -0
- package/cli/dist/web-ui/docs/en/cli/plugins.md +688 -0
- package/cli/dist/web-ui/docs/en/cli/quickstart.md +249 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/README.md +194 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.10.0.md +23 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.10.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.11.0.md +24 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.12.0.md +21 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.13.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.14.0.md +22 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.14.1.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.15.0.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.15.1.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.16.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.17.0.md +29 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.18.0.md +17 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.19.0.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.19.1.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.19.2.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.20.0.md +23 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.20.1.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.21.0.md +13 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.22.0.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.23.0.md +41 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.23.2.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.23.3.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.23.4.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.23.5.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.24.0.md +17 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.25.0.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.25.1.md +21 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.26.0.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.27.0.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.27.1.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.27.2.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.27.3.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.28.0.md +26 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.28.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.29.0.md +35 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.3.1.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.30.0.md +19 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.30.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.31.0.md +51 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.31.1.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.31.2.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.32.0.md +19 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.33.0.md +28 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.33.1.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.34.0.md +27 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.34.1.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.35.0.md +22 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.36.0.md +23 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.36.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.36.2.md +22 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.36.3.md +17 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.0.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.1.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.10.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.11.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.12.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.13.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.14.md +24 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.15.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.16.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.17.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.18.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.19.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.2.md +28 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.20.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.3.md +22 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.4.md +19 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.5.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.6.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.7.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.8.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.37.9.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.38.0.md +22 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.38.1.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.38.2.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.39.0.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.4.0.md +19 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.40.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.40.1.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.0.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.1.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.2.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.3.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.4.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.5.md +10 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.6.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.7.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.41.8.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.42.0.md +39 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.42.1.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.42.3.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.43.0.md +27 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.43.1.md +27 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.44.0.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.44.1.md +22 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.45.0.md +34 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.45.1.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.46.0.md +12 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.47.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.48.0.md +32 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.48.1.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.0.md +26 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.1.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.2.md +39 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.3.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.5.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.6.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.49.7.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.5.0.md +24 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.0.md +25 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.1.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.2.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.3.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.4.md +17 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.5.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.6.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.50.7.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.51.0.md +24 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.51.1.md +17 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.51.2.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.0.md +30 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.1.md +28 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.2.md +12 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.3.md +13 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.4.md +27 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.5.md +21 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.52.6.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.53.0.md +29 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.54.0.md +26 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.55.0.md +21 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.55.1.md +13 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.56.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.56.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.57.0.md +32 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.57.1.md +10 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.58.0.md +34 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.59.0.md +28 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.6.0.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.6.1.md +10 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.60.0.md +20 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.61.0.md +29 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.61.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.61.2.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.61.3.md +13 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.62.0.md +21 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.62.1.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.63.0.md +19 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.63.1.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.63.2.md +7 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.63.3.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.63.4.md +8 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.63.5.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.64.0.md +37 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.64.1.md +6 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.64.2.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.65.0.md +19 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.65.1.md +11 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.66.0.md +15 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.66.1.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.66.2.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.67.0.md +33 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.68.0.md +28 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.7.0.md +16 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.0.md +18 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.1.md +17 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.2.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.3.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.4.md +9 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.5.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.8.6.md +14 -0
- package/cli/dist/web-ui/docs/en/cli/release-notes/v2.9.0.md +5 -0
- package/cli/dist/web-ui/docs/en/cli/remote-control.md +247 -0
- package/cli/dist/web-ui/docs/en/cli/sandboxing.md +316 -0
- package/cli/dist/web-ui/docs/en/cli/scheduled-tasks.md +160 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-custom-tools.md +1131 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-demos.md +347 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-hooks.md +813 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-mcp.md +645 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-permissions.md +461 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-python.md +783 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-sessions.md +340 -0
- package/cli/dist/web-ui/docs/en/cli/sdk-typescript.md +759 -0
- package/cli/dist/web-ui/docs/en/cli/sdk.md +1103 -0
- package/cli/dist/web-ui/docs/en/cli/security.md +387 -0
- package/cli/dist/web-ui/docs/en/cli/settings.md +602 -0
- package/cli/dist/web-ui/docs/en/cli/skills.md +448 -0
- package/cli/dist/web-ui/docs/en/cli/slash-commands.md +397 -0
- package/cli/dist/web-ui/docs/en/cli/statusline.md +525 -0
- package/cli/dist/web-ui/docs/en/cli/sub-agents.md +621 -0
- package/cli/dist/web-ui/docs/en/cli/terminal-config.md +77 -0
- package/cli/dist/web-ui/docs/en/cli/tools-reference.md +99 -0
- package/cli/dist/web-ui/docs/en/cli/troubleshooting.md +190 -0
- package/cli/dist/web-ui/docs/en/cli/web-ui.md +164 -0
- package/cli/dist/web-ui/docs/en/cli/wecom-bot-setup.md +274 -0
- package/cli/dist/web-ui/docs/en/cli/worktree.md +660 -0
- package/cli/dist/web-ui/docs/search-index-en.json +1 -0
- package/cli/dist/web-ui/docs/search-index-zh.json +1 -0
- package/cli/dist/web-ui/docs/sidebar-en.json +1 -0
- package/cli/dist/web-ui/docs/sidebar-zh.json +1 -0
- package/cli/dist/web-ui/index.html +2 -2
- package/cli/package.json +1 -1
- package/cli/product.cloudhosted.json +2 -2
- package/cli/product.internal.json +2 -2
- package/cli/product.ioa.json +2 -2
- package/cli/product.json +4 -3
- package/cli/product.selfhosted.json +2 -2
- package/lib/query.d.ts.map +1 -1
- package/lib/query.js +5 -1
- package/lib/query.js.map +1 -1
- package/lib/transport/index.d.ts +1 -1
- package/lib/transport/index.d.ts.map +1 -1
- package/lib/transport/process-transport.d.ts +1 -1
- package/lib/transport/process-transport.d.ts.map +1 -1
- package/lib/transport/process-transport.js +5 -1
- package/lib/transport/process-transport.js.map +1 -1
- package/lib/types.d.ts +3 -0
- package/lib/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/cli/dist/web-ui/assets/index-BPT-qRRx.js +0 -411
- package/cli/dist/web-ui/assets/index-f_ibHSHw.css +0 -32
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
# SDK 权限控制
|
|
2
|
+
|
|
3
|
+
> **版本要求**:本文档针对 CodeBuddy Agent SDK v0.1.0 及以上版本。
|
|
4
|
+
|
|
5
|
+
本文档介绍如何在 SDK 中实现权限控制,包括权限模式、canUseTool 回调和工具白名单/黑名单。
|
|
6
|
+
|
|
7
|
+
## 概述
|
|
8
|
+
|
|
9
|
+
CodeBuddy Agent SDK 提供多种权限控制机制:
|
|
10
|
+
|
|
11
|
+
| 机制 | 说明 | 适用场景 |
|
|
12
|
+
|------|------|---------|
|
|
13
|
+
| **权限模式** | 全局控制权限行为 | 快速设置整体策略 |
|
|
14
|
+
| **canUseTool 回调** | 运行时动态审批 | 交互式权限确认 |
|
|
15
|
+
| **工具白名单/黑名单** | 声明式工具过滤 | 静态策略配置 |
|
|
16
|
+
|
|
17
|
+
## 权限模式
|
|
18
|
+
|
|
19
|
+
通过 `permissionMode`(TypeScript)或 `permission_mode`(Python)设置全局权限行为。
|
|
20
|
+
|
|
21
|
+
### 可用模式
|
|
22
|
+
|
|
23
|
+
| 模式 | 说明 |
|
|
24
|
+
|------|------|
|
|
25
|
+
| `default` | 默认模式,所有工具操作需要确认 |
|
|
26
|
+
| `acceptEdits` | 自动批准文件编辑,其他操作仍需确认 |
|
|
27
|
+
| `plan` | 规划模式,仅允许只读工具 |
|
|
28
|
+
| `bypassPermissions` | 跳过所有权限检查(谨慎使用) |
|
|
29
|
+
|
|
30
|
+
### 初始配置
|
|
31
|
+
|
|
32
|
+
::: code-group
|
|
33
|
+
|
|
34
|
+
```typescript [TypeScript]
|
|
35
|
+
import { query } from '@tencent-ai/agent-sdk';
|
|
36
|
+
|
|
37
|
+
const q = query({
|
|
38
|
+
prompt: '帮我重构这段代码',
|
|
39
|
+
options: {
|
|
40
|
+
model: 'deepseek-v3.1',
|
|
41
|
+
permissionMode: 'acceptEdits' // 自动批准编辑
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
for await (const message of q) {
|
|
46
|
+
console.log(message);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```python [Python]
|
|
51
|
+
import asyncio
|
|
52
|
+
from codebuddy_agent_sdk import query, CodeBuddyAgentOptions
|
|
53
|
+
|
|
54
|
+
async def main():
|
|
55
|
+
options = CodeBuddyAgentOptions(
|
|
56
|
+
model="deepseek-v3.1",
|
|
57
|
+
permission_mode="acceptEdits" # 自动批准编辑
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
async for message in query(prompt="帮我重构这段代码", options=options):
|
|
61
|
+
print(message)
|
|
62
|
+
|
|
63
|
+
asyncio.run(main())
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
:::
|
|
67
|
+
|
|
68
|
+
### 动态修改权限模式
|
|
69
|
+
|
|
70
|
+
使用 Session/Client API 可以在运行时动态修改权限模式:
|
|
71
|
+
|
|
72
|
+
::: code-group
|
|
73
|
+
|
|
74
|
+
```typescript [TypeScript]
|
|
75
|
+
import { unstable_v2_createSession } from '@tencent-ai/agent-sdk';
|
|
76
|
+
|
|
77
|
+
const session = unstable_v2_createSession({
|
|
78
|
+
model: 'deepseek-v3.1'
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// 发送第一条消息
|
|
82
|
+
await session.send('分析这个项目');
|
|
83
|
+
for await (const msg of session.stream()) {
|
|
84
|
+
console.log(msg);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// 动态切换到 acceptEdits 模式加速开发
|
|
88
|
+
// 注意:这是 unstable API
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```python [Python]
|
|
92
|
+
from codebuddy_agent_sdk import CodeBuddySDKClient, CodeBuddyAgentOptions
|
|
93
|
+
|
|
94
|
+
async def main():
|
|
95
|
+
options = CodeBuddyAgentOptions(model="deepseek-v3.1")
|
|
96
|
+
|
|
97
|
+
async with CodeBuddySDKClient(options=options) as client:
|
|
98
|
+
await client.query("分析这个项目")
|
|
99
|
+
async for msg in client.receive_response():
|
|
100
|
+
print(msg)
|
|
101
|
+
|
|
102
|
+
# 动态切换权限模式
|
|
103
|
+
await client.set_permission_mode("acceptEdits")
|
|
104
|
+
|
|
105
|
+
await client.query("现在帮我修改代码")
|
|
106
|
+
async for msg in client.receive_response():
|
|
107
|
+
print(msg)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
:::
|
|
111
|
+
|
|
112
|
+
## canUseTool 回调
|
|
113
|
+
|
|
114
|
+
`canUseTool` 回调在工具需要权限确认时触发,允许你实现自定义的权限逻辑。
|
|
115
|
+
|
|
116
|
+
### 回调签名
|
|
117
|
+
|
|
118
|
+
::: code-group
|
|
119
|
+
|
|
120
|
+
```typescript [TypeScript]
|
|
121
|
+
type CanUseTool = (
|
|
122
|
+
toolName: string,
|
|
123
|
+
input: Record<string, unknown>,
|
|
124
|
+
options: CanUseToolOptions
|
|
125
|
+
) => Promise<PermissionResult>;
|
|
126
|
+
|
|
127
|
+
type CanUseToolOptions = {
|
|
128
|
+
signal: AbortSignal;
|
|
129
|
+
toolUseID: string;
|
|
130
|
+
agentID?: string;
|
|
131
|
+
suggestions?: PermissionUpdate[];
|
|
132
|
+
blockedPath?: string;
|
|
133
|
+
decisionReason?: string;
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
type PermissionResult =
|
|
137
|
+
| { behavior: 'allow'; updatedInput: Record<string, unknown> }
|
|
138
|
+
| { behavior: 'deny'; message: string; interrupt?: boolean };
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
```python [Python]
|
|
142
|
+
CanUseTool = Callable[
|
|
143
|
+
[str, dict[str, Any], CanUseToolOptions],
|
|
144
|
+
Awaitable[PermissionResult],
|
|
145
|
+
]
|
|
146
|
+
|
|
147
|
+
@dataclass
|
|
148
|
+
class CanUseToolOptions:
|
|
149
|
+
tool_use_id: str
|
|
150
|
+
signal: Any | None = None
|
|
151
|
+
agent_id: str | None = None
|
|
152
|
+
suggestions: list[dict[str, Any]] | None = None
|
|
153
|
+
blocked_path: str | None = None
|
|
154
|
+
decision_reason: str | None = None
|
|
155
|
+
|
|
156
|
+
PermissionResult = PermissionResultAllow | PermissionResultDeny
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
:::
|
|
160
|
+
|
|
161
|
+
### 完整示例:交互式审批
|
|
162
|
+
|
|
163
|
+
::: code-group
|
|
164
|
+
|
|
165
|
+
```typescript [TypeScript]
|
|
166
|
+
import { query } from '@tencent-ai/agent-sdk';
|
|
167
|
+
|
|
168
|
+
const q = query({
|
|
169
|
+
prompt: '帮我分析这个代码库',
|
|
170
|
+
options: {
|
|
171
|
+
model: 'deepseek-v3.1',
|
|
172
|
+
canUseTool: async (toolName, input, options) => {
|
|
173
|
+
console.log(`\n🔧 工具请求: ${toolName}`);
|
|
174
|
+
console.log(` 参数:`, JSON.stringify(input, null,2));
|
|
175
|
+
|
|
176
|
+
// 只读工具自动允许
|
|
177
|
+
const readOnlyTools = ['Read', 'Glob', 'Grep'];
|
|
178
|
+
if (readOnlyTools.includes(toolName)) {
|
|
179
|
+
return { behavior: 'allow', updatedInput: input };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// 危险命令拒绝
|
|
183
|
+
if (toolName === 'Bash') {
|
|
184
|
+
const command = input.command as string;
|
|
185
|
+
if (command.includes('rm -rf') || command.includes('sudo')) {
|
|
186
|
+
return {
|
|
187
|
+
behavior: 'deny',
|
|
188
|
+
message: '危险命令被拒绝',
|
|
189
|
+
interrupt: true // 中断整个会话
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// 其他情况:模拟用户确认
|
|
195
|
+
const approved = await promptUser(`允许执行 ${toolName}?`);
|
|
196
|
+
|
|
197
|
+
if (approved) {
|
|
198
|
+
return { behavior: 'allow', updatedInput: input };
|
|
199
|
+
} else {
|
|
200
|
+
return { behavior: 'deny', message: '用户拒绝' };
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
for await (const message of q) {
|
|
207
|
+
console.log(message);
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
```python [Python]
|
|
212
|
+
from codebuddy_agent_sdk import (
|
|
213
|
+
query, CodeBuddyAgentOptions,
|
|
214
|
+
CanUseToolOptions, PermissionResultAllow, PermissionResultDeny
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
async def can_use_tool(
|
|
218
|
+
tool_name: str,
|
|
219
|
+
input_data: dict,
|
|
220
|
+
options: CanUseToolOptions
|
|
221
|
+
):
|
|
222
|
+
print(f"\n🔧 工具请求: {tool_name}")
|
|
223
|
+
print(f" 参数: {input_data}")
|
|
224
|
+
|
|
225
|
+
# 只读工具自动允许
|
|
226
|
+
read_only_tools = ["Read", "Glob", "Grep"]
|
|
227
|
+
if tool_name in read_only_tools:
|
|
228
|
+
return PermissionResultAllow(updated_input=input_data)
|
|
229
|
+
|
|
230
|
+
# 危险命令拒绝
|
|
231
|
+
if tool_name == "Bash":
|
|
232
|
+
command = input_data.get("command", "")
|
|
233
|
+
if "rm -rf" in command or "sudo" in command:
|
|
234
|
+
return PermissionResultDeny(
|
|
235
|
+
message="危险命令被拒绝",
|
|
236
|
+
interrupt=True # 中断整个会话
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
# 其他情况:模拟用户确认
|
|
240
|
+
answer = input(f"允许执行 {tool_name}? (y/n): ")
|
|
241
|
+
|
|
242
|
+
if answer.lower() == 'y':
|
|
243
|
+
return PermissionResultAllow(updated_input=input_data)
|
|
244
|
+
else:
|
|
245
|
+
return PermissionResultDeny(message="用户拒绝")
|
|
246
|
+
|
|
247
|
+
async def main():
|
|
248
|
+
options = CodeBuddyAgentOptions(
|
|
249
|
+
model="deepseek-v3.1",
|
|
250
|
+
can_use_tool=can_use_tool
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
async for message in query(prompt="帮我分析这个代码库", options=options):
|
|
254
|
+
print(message)
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
:::
|
|
258
|
+
|
|
259
|
+
### 修改工具输入
|
|
260
|
+
|
|
261
|
+
可以在 `canUseTool` 中修改工具的输入参数:
|
|
262
|
+
|
|
263
|
+
::: code-group
|
|
264
|
+
|
|
265
|
+
```typescript [TypeScript]
|
|
266
|
+
canUseTool: async (toolName, input) => {
|
|
267
|
+
if (toolName === 'Bash') {
|
|
268
|
+
// 在命令前添加安全检查
|
|
269
|
+
return {
|
|
270
|
+
behavior: 'allow',
|
|
271
|
+
updatedInput: {
|
|
272
|
+
...input,
|
|
273
|
+
command: `set -e; ${input.command}`
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
return { behavior: 'allow', updatedInput: input };
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
```python [Python]
|
|
282
|
+
async def can_use_tool(tool_name, input_data, options):
|
|
283
|
+
if tool_name == "Bash":
|
|
284
|
+
# 在命令前添加安全检查
|
|
285
|
+
return PermissionResultAllow(
|
|
286
|
+
updated_input={
|
|
287
|
+
**input_data,
|
|
288
|
+
"command": f"set -e; {input_data.get('command', '')}"
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
return PermissionResultAllow(updated_input=input_data)
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
:::
|
|
295
|
+
|
|
296
|
+
## 处理 AskUserQuestion
|
|
297
|
+
|
|
298
|
+
当 AI 需要向用户提问时,会调用 `AskUserQuestion` 工具。你需要在 `canUseTool` 中处理这个工具。
|
|
299
|
+
|
|
300
|
+
### 输入结构
|
|
301
|
+
|
|
302
|
+
```typescript
|
|
303
|
+
{
|
|
304
|
+
questions: [
|
|
305
|
+
{
|
|
306
|
+
question: "使用哪个数据库?",
|
|
307
|
+
header: "数据库",
|
|
308
|
+
options: [
|
|
309
|
+
{ label: "PostgreSQL", description: "关系型数据库" },
|
|
310
|
+
{ label: "MongoDB", description: "文档数据库" }
|
|
311
|
+
],
|
|
312
|
+
multiSelect: false
|
|
313
|
+
}
|
|
314
|
+
]
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### 返回答案
|
|
319
|
+
|
|
320
|
+
::: code-group
|
|
321
|
+
|
|
322
|
+
```typescript [TypeScript]
|
|
323
|
+
canUseTool: async (toolName, input) => {
|
|
324
|
+
if (toolName === 'AskUserQuestion') {
|
|
325
|
+
const questions = input.questions as any[];
|
|
326
|
+
const answers: Record<string, string> = {};
|
|
327
|
+
|
|
328
|
+
for (const q of questions) {
|
|
329
|
+
console.log(`问题: ${q.question}`);
|
|
330
|
+
for (let i = 0; i < q.options.length; i++) {
|
|
331
|
+
console.log(` ${i + 1}. ${q.options[i].label}`);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
// 获取用户输入
|
|
335
|
+
const choice = await getUserChoice();
|
|
336
|
+
answers[q.question] = q.options[choice].label;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
return {
|
|
340
|
+
behavior: 'allow',
|
|
341
|
+
updatedInput: { ...input, answers }
|
|
342
|
+
};
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return { behavior: 'allow', updatedInput: input };
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
```python [Python]
|
|
350
|
+
async def can_use_tool(tool_name, input_data, options):
|
|
351
|
+
if tool_name == "AskUserQuestion":
|
|
352
|
+
questions = input_data.get("questions", [])
|
|
353
|
+
answers = {}
|
|
354
|
+
|
|
355
|
+
for q in questions:
|
|
356
|
+
print(f"问题: {q['question']}")
|
|
357
|
+
for i, opt in enumerate(q["options"]):
|
|
358
|
+
print(f" {i + 1}. {opt['label']}")
|
|
359
|
+
|
|
360
|
+
# 获取用户输入
|
|
361
|
+
choice = int(input("选择 (1/2/...): ")) - 1
|
|
362
|
+
answers[q["question"]] = q["options"][choice]["label"]
|
|
363
|
+
|
|
364
|
+
return PermissionResultAllow(
|
|
365
|
+
updated_input={**input_data, "answers": answers}
|
|
366
|
+
)
|
|
367
|
+
|
|
368
|
+
return PermissionResultAllow(updated_input=input_data)
|
|
369
|
+
```
|
|
370
|
+
|
|
371
|
+
:::
|
|
372
|
+
|
|
373
|
+
## 工具白名单/黑名单
|
|
374
|
+
|
|
375
|
+
SDK 提供多种工具过滤机制:
|
|
376
|
+
|
|
377
|
+
| 选项 | 说明 | 优先级 |
|
|
378
|
+
|------|------|--------|
|
|
379
|
+
| `tools` | 内置工具白名单,从根本上限制可用工具集 | 最高 |
|
|
380
|
+
| `allowedTools` | 允许使用的工具(支持模式匹配) | 中 |
|
|
381
|
+
| `disallowedTools` | 禁止使用的工具(支持模式匹配) | 中 |
|
|
382
|
+
|
|
383
|
+
### tools:内置工具白名单
|
|
384
|
+
|
|
385
|
+
使用 `tools` 选项从根本上限制 CodeBuddy 可使用的内置工具集:
|
|
386
|
+
|
|
387
|
+
::: code-group
|
|
388
|
+
|
|
389
|
+
```typescript [TypeScript]
|
|
390
|
+
const q = query({
|
|
391
|
+
prompt: '分析项目结构',
|
|
392
|
+
options: {
|
|
393
|
+
model: 'deepseek-v3.1',
|
|
394
|
+
// 只允许这些内置工具
|
|
395
|
+
tools: ['Read', 'Glob', 'Grep']
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
// 禁用所有内置工具(仅使用 MCP 工具)
|
|
400
|
+
const q2 = query({
|
|
401
|
+
prompt: '使用 MCP 工具完成任务',
|
|
402
|
+
options: {
|
|
403
|
+
tools: [] // 空数组禁用所有内置工具
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
```python [Python]
|
|
409
|
+
options = CodeBuddyAgentOptions(
|
|
410
|
+
model="deepseek-v3.1",
|
|
411
|
+
# 只允许这些内置工具
|
|
412
|
+
tools=["Read", "Glob", "Grep"]
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
# 禁用所有内置工具(仅使用 MCP 工具)
|
|
416
|
+
options2 = CodeBuddyAgentOptions(
|
|
417
|
+
model="deepseek-v3.1",
|
|
418
|
+
tools=[] # 空数组禁用所有内置工具
|
|
419
|
+
)
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
:::
|
|
423
|
+
|
|
424
|
+
### allowedTools/disallowedTools:工具过滤
|
|
425
|
+
|
|
426
|
+
使用 `allowedTools` 和 `disallowedTools` 进行更细粒度的工具过滤,支持模式匹配:
|
|
427
|
+
|
|
428
|
+
::: code-group
|
|
429
|
+
|
|
430
|
+
```typescript [TypeScript]
|
|
431
|
+
const q = query({
|
|
432
|
+
prompt: '分析项目结构',
|
|
433
|
+
options: {
|
|
434
|
+
model: 'deepseek-v3.1',
|
|
435
|
+
// 只允许这些工具
|
|
436
|
+
allowedTools: ['Read', 'Glob', 'Grep'],
|
|
437
|
+
// 或者禁止这些工具
|
|
438
|
+
disallowedTools: ['Bash', 'Write', 'Edit']
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
```python [Python]
|
|
444
|
+
options = CodeBuddyAgentOptions(
|
|
445
|
+
model="deepseek-v3.1",
|
|
446
|
+
# 只允许这些工具
|
|
447
|
+
allowed_tools=["Read", "Glob", "Grep"],
|
|
448
|
+
# 或者禁止这些工具
|
|
449
|
+
disallowed_tools=["Bash", "Write", "Edit"]
|
|
450
|
+
)
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
:::
|
|
454
|
+
|
|
455
|
+
### 常用工具名称
|
|
456
|
+
|
|
457
|
+
| 工具名 | 功能 |
|
|
458
|
+
|--------|------|
|
|
459
|
+
| `Read` | 读取文件 |
|
|
460
|
+
| `Write` | 写入文件 |
|
|
461
|
+
| `Edit` | 编辑文件 |
|
|
462
|
+
| `Glob` | 文件模式匹配 |
|
|
463
|
+
| `Grep` | 内容搜索 |
|
|
464
|
+
| `Bash` | 执行 Shell 命令 |
|
|
465
|
+
| `Task` | 子 Agent 任务 |
|
|
466
|
+
| `WebFetch` | 获取网页内容 |
|
|
467
|
+
| `WebSearch` | 网络搜索 |
|
|
468
|
+
| `ToolSearch` | 搜索延迟加载的工具 |
|
|
469
|
+
|
|
470
|
+
## 最佳实践
|
|
471
|
+
|
|
472
|
+
1. **默认使用 `default` 模式**:提供最完整的权限控制
|
|
473
|
+
|
|
474
|
+
2. **只读任务使用 `plan` 模式**:
|
|
475
|
+
```typescript
|
|
476
|
+
permissionMode: 'plan' // 只允许 Read、Glob、Grep
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
3. **结合白名单精确控制**:
|
|
480
|
+
```typescript
|
|
481
|
+
allowedTools: ['Read', 'Glob', 'Grep'],
|
|
482
|
+
permissionMode: 'bypassPermissions' // 允许的工具自动执行
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
4. **危险命令使用 `interrupt`**:
|
|
486
|
+
```typescript
|
|
487
|
+
return {
|
|
488
|
+
behavior: 'deny',
|
|
489
|
+
message: '危险操作',
|
|
490
|
+
interrupt: true // 立即中断,不让 AI 继续尝试
|
|
491
|
+
};
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
5. **生产环境避免 `bypassPermissions`**:该模式会跳过所有权限检查
|
|
495
|
+
|
|
496
|
+
## 相关文档
|
|
497
|
+
|
|
498
|
+
- [SDK 概览](sdk.md) - 快速入门和使用示例
|
|
499
|
+
- [SDK Hook 系统](sdk-hooks.md) - 更细粒度的工具控制
|
|
500
|
+
- [TypeScript SDK 参考](sdk-typescript.md) - 完整 API 参考
|
|
501
|
+
- [Python SDK 参考](sdk-python.md) - 完整 API 参考
|