@tencent-ai/agent-sdk 0.3.263-dev.90f0e98.202609190050 → 0.3.263
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/dist/codebuddy-headless.js +1 -1
- package/cli/dist/codebuddy-lite-wb.mjs +1 -1
- package/cli/dist-server/codebuddy.js +1 -1
- package/cli/dist-server/types/node/references/index.d.ts +2 -0
- package/cli/dist-server/types/node/settings/settings-controller.d.ts +23 -0
- package/cli/dist-server/types/node/settings/settings-validate-middleware.d.ts +9 -0
- package/cli/dist-server/types/node/utils/compress-path.source.d.ts +59 -0
- package/cli/package.json +2 -3
- 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 +2 -2
- package/cli/product.selfhosted.json +2 -2
- package/package.json +2 -3
- package/cli/dist-server/types/node/a2a/a2a-artifact-download-service.d.ts +0 -51
- package/cli/dist-server/types/node/a2a/a2a-context-store.d.ts +0 -100
- package/cli/dist-server/types/node/a2a/a2a-remote-cancel.d.ts +0 -111
- package/cli/dist-server/types/node/acp/usage-by-category-calculator.d.ts +0 -45
- package/cli/dist-server/types/node/acp/usage-by-category-char-weight.d.ts +0 -9
- package/cli/dist-server/types/node/acp/usage-by-category-distribute.d.ts +0 -6
- package/cli/dist-server/types/node/acp/usage-by-category-tools-split.d.ts +0 -11
- package/cli/dist-server/types/node/agent/agent-config-cli-fields.d.ts +0 -57
- package/cli/dist-server/types/node/agent/agent-controller.d.ts +0 -127
- package/cli/dist-server/types/node/agent/agent-display.d.ts +0 -77
- package/cli/dist-server/types/node/agent/agent-runtime-adapter.d.ts +0 -69
- package/cli/dist-server/types/node/agent/custom-agent-identity.d.ts +0 -54
- package/cli/dist-server/types/node/agent/custom-agent-manager.d.ts +0 -43
- package/cli/dist-server/types/node/agent/custom-agent-path-registry.d.ts +0 -19
- package/cli/dist-server/types/node/agent/insights-data-agent-run-interceptor.d.ts +0 -67
- package/cli/dist-server/types/node/agent/interceptor-name-registry.d.ts +0 -4
- package/cli/dist-server/types/node/agent/interceptors/channel-event-interceptor.d.ts +0 -44
- package/cli/dist-server/types/node/agent/interceptors/command-interceptors.d.ts +0 -71
- package/cli/dist-server/types/node/agent/interceptors/deep-research-pending-interceptor.d.ts +0 -30
- package/cli/dist-server/types/node/agent/interceptors/env-interceptor.d.ts +0 -7
- package/cli/dist-server/types/node/agent/interceptors/file-interceptors.d.ts +0 -38
- package/cli/dist-server/types/node/agent/interceptors/image-interceptors.d.ts +0 -47
- package/cli/dist-server/types/node/agent/interceptors/index.d.ts +0 -15
- package/cli/dist-server/types/node/agent/interceptors/initial-prompt-interceptor.d.ts +0 -29
- package/cli/dist-server/types/node/agent/interceptors/model-interceptors.d.ts +0 -43
- package/cli/dist-server/types/node/agent/interceptors/sandbox-interceptor.d.ts +0 -68
- package/cli/dist-server/types/node/agent/interceptors/sensitive-user-input-interceptor.d.ts +0 -7
- package/cli/dist-server/types/node/agent/interceptors/system-reminder-interceptor.d.ts +0 -76
- package/cli/dist-server/types/node/agent/interceptors/team-resume-intent-interceptor.d.ts +0 -31
- package/cli/dist-server/types/node/agent/interceptors/telemetry-interceptors.d.ts +0 -43
- package/cli/dist-server/types/node/agent/interceptors/ultracode-effort-reminder-interceptor.d.ts +0 -21
- package/cli/dist-server/types/node/agent/interceptors/ultracode-keyword-interceptor.d.ts +0 -34
- package/cli/dist-server/types/node/agent/main-agent-acp-handler.d.ts +0 -203
- package/cli/dist-server/types/node/agent/main-agent-policy.d.ts +0 -33
- package/cli/dist-server/types/node/agent/memory-context-interceptor.d.ts +0 -84
- package/cli/dist-server/types/node/agent/stream-json-init-interceptor.d.ts +0 -9
- package/cli/dist-server/types/node/agent/subagent-limits.d.ts +0 -75
- package/cli/dist-server/types/node/agent/team-context-interceptor.d.ts +0 -42
- package/cli/dist-server/types/node/agent/team-resume-intent.d.ts +0 -20
- package/cli/dist-server/types/node/agent/teammate-failure-interceptor.d.ts +0 -67
- package/cli/dist-server/types/node/agent-home/agent-home-acp-forward.d.ts +0 -11
- package/cli/dist-server/types/node/agent-home/agent-home-agent-create.d.ts +0 -31
- package/cli/dist-server/types/node/agent-home/agent-home-audit.d.ts +0 -54
- package/cli/dist-server/types/node/agent-home/agent-home-channel-context.d.ts +0 -44
- package/cli/dist-server/types/node/agent-home/agent-home-channel-create.d.ts +0 -73
- package/cli/dist-server/types/node/agent-home/agent-home-channel-events.d.ts +0 -8
- package/cli/dist-server/types/node/agent-home/agent-home-channel-lookup.d.ts +0 -30
- package/cli/dist-server/types/node/agent-home/agent-home-channel-speech.d.ts +0 -72
- package/cli/dist-server/types/node/agent-home/agent-home-channel-task-events.d.ts +0 -45
- package/cli/dist-server/types/node/agent-home/agent-home-channel-task-order.d.ts +0 -25
- package/cli/dist-server/types/node/agent-home/agent-home-channel-tasks.d.ts +0 -156
- package/cli/dist-server/types/node/agent-home/agent-home-channel-wake-guard.d.ts +0 -35
- package/cli/dist-server/types/node/agent-home/agent-home-channel-wake.d.ts +0 -102
- package/cli/dist-server/types/node/agent-home/agent-home-colleague-job.d.ts +0 -37
- package/cli/dist-server/types/node/agent-home/agent-home-colleague-memory.d.ts +0 -52
- package/cli/dist-server/types/node/agent-home/agent-home-deliver.d.ts +0 -76
- package/cli/dist-server/types/node/agent-home/agent-home-directory-lock.d.ts +0 -22
- package/cli/dist-server/types/node/agent-home/agent-home-errors.d.ts +0 -17
- package/cli/dist-server/types/node/agent-home/agent-home-inbox.d.ts +0 -101
- package/cli/dist-server/types/node/agent-home/agent-home-main-session.d.ts +0 -33
- package/cli/dist-server/types/node/agent-home/agent-home-recipients.d.ts +0 -38
- package/cli/dist-server/types/node/agent-home/agent-home-room-context-interceptor.d.ts +0 -30
- package/cli/dist-server/types/node/agent-home/agent-home-runtime-arm-state.d.ts +0 -14
- package/cli/dist-server/types/node/agent-home/agent-home-runtime.d.ts +0 -87
- package/cli/dist-server/types/node/agent-home/agent-home-settings.d.ts +0 -39
- package/cli/dist-server/types/node/agent-home/agent-home-tool-gate.d.ts +0 -53
- package/cli/dist-server/types/node/agent-home/channel-wake-service.d.ts +0 -69
- package/cli/dist-server/types/node/agent-task/categorize-failure.d.ts +0 -65
- package/cli/dist-server/types/node/agent-team/shutdown-coordinator.d.ts +0 -98
- package/cli/dist-server/types/node/agent-team/team-runtime-adopter.d.ts +0 -13
- package/cli/dist-server/types/node/agent-team/team-runtime-manifest.d.ts +0 -66
- package/cli/dist-server/types/node/agent-team/team-runtime-status.d.ts +0 -34
- package/cli/dist-server/types/node/agent-view/agent-view-actions.d.ts +0 -205
- package/cli/dist-server/types/node/agent-view/job-reclaim-gate.d.ts +0 -13
- package/cli/dist-server/types/node/ask/index.d.ts +0 -3
- package/cli/dist-server/types/node/bash-sandbox/index.d.ts +0 -4
- package/cli/dist-server/types/node/code-ratio/cli-git-commit-watcher.d.ts +0 -159
- package/cli/dist-server/types/node/code-ratio/cli-svn-commit-watcher.d.ts +0 -111
- package/cli/dist-server/types/node/code-ratio/code-ratio-reporting-service.d.ts +0 -90
- package/cli/dist-server/types/node/code-ratio/fs-file-reader.d.ts +0 -26
- package/cli/dist-server/types/node/code-ratio/index.d.ts +0 -5
- package/cli/dist-server/types/node/code-ratio/repo-discovery.d.ts +0 -32
- package/cli/dist-server/types/node/code-ratio/vcs-repo-resolver.d.ts +0 -51
- package/cli/dist-server/types/node/control-signal/stdout-writer.d.ts +0 -99
- package/cli/dist-server/types/node/elicitation/elicitation-service.d.ts +0 -100
- package/cli/dist-server/types/node/hooks/admin-trusted.d.ts +0 -41
- package/cli/dist-server/types/node/http/api-galileo-metrics.d.ts +0 -19
- package/cli/dist-server/types/node/http/classify-network-error.d.ts +0 -21
- package/cli/dist-server/types/node/http/custom-header-http-interceptor.d.ts +0 -14
- package/cli/dist-server/types/node/http/fetch-proxy.d.ts +0 -22
- package/cli/dist-server/types/node/http/http-proxy-interceptor.d.ts +0 -74
- package/cli/dist-server/types/node/http/index.d.ts +0 -6
- package/cli/dist-server/types/node/http/workbuddy-config-dir.d.ts +0 -17
- package/cli/dist-server/types/node/lsp/index.d.ts +0 -6
- package/cli/dist-server/types/node/lsp/lsp-client.d.ts +0 -104
- package/cli/dist-server/types/node/lsp/lsp-exit-registry.d.ts +0 -16
- package/cli/dist-server/types/node/lsp/lsp-manager.d.ts +0 -91
- package/cli/dist-server/types/node/lsp/lsp-protocol.d.ts +0 -245
- package/cli/dist-server/types/node/model/effort-capabilities.d.ts +0 -64
- package/cli/dist-server/types/node/model/passthrough-header-policy.d.ts +0 -25
- package/cli/dist-server/types/node/multitask/completion-bus.d.ts +0 -36
- package/cli/dist-server/types/node/multitask/coordinator-acp-bridge.d.ts +0 -41
- package/cli/dist-server/types/node/multitask/coordinator-interceptor.d.ts +0 -7
- package/cli/dist-server/types/node/multitask/coordinator-tool-policy.d.ts +0 -18
- package/cli/dist-server/types/node/multitask/delegation-planner.d.ts +0 -6
- package/cli/dist-server/types/node/multitask/entry-guard.d.ts +0 -12
- package/cli/dist-server/types/node/multitask/host-api.d.ts +0 -63
- package/cli/dist-server/types/node/multitask/inspect-self-tool.d.ts +0 -18
- package/cli/dist-server/types/node/multitask/multitask-log.d.ts +0 -2
- package/cli/dist-server/types/node/multitask/multitask-metrics.d.ts +0 -2
- package/cli/dist-server/types/node/multitask/planner-runtime.d.ts +0 -7
- package/cli/dist-server/types/node/multitask/sandbox-reveal.d.ts +0 -35
- package/cli/dist-server/types/node/multitask/self-model.d.ts +0 -7
- package/cli/dist-server/types/node/multitask/slash-entry.d.ts +0 -14
- package/cli/dist-server/types/node/multitask/spawn-detached.d.ts +0 -9
- package/cli/dist-server/types/node/multitask/subagent-alias.d.ts +0 -5
- package/cli/dist-server/types/node/multitask/surface-reminder.d.ts +0 -5
- package/cli/dist-server/types/node/multitask/types.d.ts +0 -123
- package/cli/dist-server/types/node/multitask/wakeup-gate.d.ts +0 -21
- package/cli/dist-server/types/node/navigation/index.d.ts +0 -2
- package/cli/dist-server/types/node/runtime/add-dir-middleware.d.ts +0 -13
- package/cli/dist-server/types/node/runtime/external-uri-opener.d.ts +0 -8
- package/cli/dist-server/types/node/runtime/file-local-storage.d.ts +0 -17
- package/cli/dist-server/types/node/runtime/workspace-folder-manager.d.ts +0 -45
- package/cli/dist-server/types/node/runtime/workspace.d.ts +0 -5
- package/cli/dist-server/types/node/sandbox-cli/network-block-records.d.ts +0 -18
- package/cli/dist-server/types/node/shortcut/shortcut-protocol.d.ts +0 -41
- package/cli/dist-server/types/node/stats/index.d.ts +0 -5
- package/cli/dist-server/types/node/tools/a2a-cancel-task-tool.d.ts +0 -55
- package/cli/dist-server/types/node/tools/a2a-get-agent-card-tool.d.ts +0 -59
- package/cli/dist-server/types/node/tools/a2a-get-task-tool.d.ts +0 -316
- package/cli/dist-server/types/node/tools/a2a-poll-retry.d.ts +0 -46
- package/cli/dist-server/types/node/tools/a2a-send-message-tool.d.ts +0 -138
- package/cli/dist-server/types/node/tools/a2a-tool-guards.d.ts +0 -48
- package/cli/dist-server/types/node/tools/agent-tool.d.ts +0 -154
- package/cli/dist-server/types/node/tools/artifact-common.d.ts +0 -80
- package/cli/dist-server/types/node/tools/artifact-control-tool.d.ts +0 -103
- package/cli/dist-server/types/node/tools/artifact-tool.d.ts +0 -109
- package/cli/dist-server/types/node/tools/ask-user-for-structured-input-tool.d.ts +0 -127
- package/cli/dist-server/types/node/tools/ask-user-question-tool.d.ts +0 -237
- package/cli/dist-server/types/node/tools/ask-user-question-validation.d.ts +0 -22
- package/cli/dist-server/types/node/tools/auto-mode/auto-mode-critique-client.d.ts +0 -51
- package/cli/dist-server/types/node/tools/auto-mode/auto-mode-strategy.d.ts +0 -21
- package/cli/dist-server/types/node/tools/auto-mode/index.d.ts +0 -15
- package/cli/dist-server/types/node/tools/background-output-files.d.ts +0 -39
- package/cli/dist-server/types/node/tools/background-output-tail-poller.d.ts +0 -60
- package/cli/dist-server/types/node/tools/bash-output-tool.d.ts +0 -34
- package/cli/dist-server/types/node/tools/bash-sandbox-approval-requester.d.ts +0 -48
- package/cli/dist-server/types/node/tools/bash-security-windows.d.ts +0 -34
- package/cli/dist-server/types/node/tools/bash-tool.d.ts +0 -204
- package/cli/dist-server/types/node/tools/channel-tasks-tool.d.ts +0 -174
- package/cli/dist-server/types/node/tools/computer-use-capabilities.d.ts +0 -23
- package/cli/dist-server/types/node/tools/computer-use-executor.d.ts +0 -130
- package/cli/dist-server/types/node/tools/computer-use-tool.d.ts +0 -86
- package/cli/dist-server/types/node/tools/create-channel-tool.d.ts +0 -82
- package/cli/dist-server/types/node/tools/create-colleague-tool.d.ts +0 -64
- package/cli/dist-server/types/node/tools/create-mode-write-guard.d.ts +0 -3
- package/cli/dist-server/types/node/tools/cron-create-tool.d.ts +0 -41
- package/cli/dist-server/types/node/tools/cron-delete-tool.d.ts +0 -28
- package/cli/dist-server/types/node/tools/cron-list-tool.d.ts +0 -27
- package/cli/dist-server/types/node/tools/defer-execute-tool.d.ts +0 -260
- package/cli/dist-server/types/node/tools/delegate-tool.d.ts +0 -71
- package/cli/dist-server/types/node/tools/edit-tool.d.ts +0 -78
- package/cli/dist-server/types/node/tools/enter-planmode-tool.d.ts +0 -29
- package/cli/dist-server/types/node/tools/enter-worktree-tool.d.ts +0 -59
- package/cli/dist-server/types/node/tools/exit-planmode-tool.d.ts +0 -86
- package/cli/dist-server/types/node/tools/file-action-report-utils.d.ts +0 -35
- package/cli/dist-server/types/node/tools/glob-tool.d.ts +0 -102
- package/cli/dist-server/types/node/tools/grep-tool.d.ts +0 -141
- package/cli/dist-server/types/node/tools/image-edit-tool.d.ts +0 -94
- package/cli/dist-server/types/node/tools/image-gen-tool.d.ts +0 -107
- package/cli/dist-server/types/node/tools/kill-shell-tool.d.ts +0 -27
- package/cli/dist-server/types/node/tools/leave-worktree-tool.d.ts +0 -54
- package/cli/dist-server/types/node/tools/list-colleagues-tool.d.ts +0 -35
- package/cli/dist-server/types/node/tools/list-mcp-resources-tool.d.ts +0 -58
- package/cli/dist-server/types/node/tools/lsp-tool.d.ts +0 -68
- package/cli/dist-server/types/node/tools/main-agent-meta-tools.d.ts +0 -107
- package/cli/dist-server/types/node/tools/malicious-block-guidance.d.ts +0 -11
- package/cli/dist-server/types/node/tools/memory-tool.d.ts +0 -33
- package/cli/dist-server/types/node/tools/message-colleague-tool.d.ts +0 -79
- package/cli/dist-server/types/node/tools/monitor-tool.d.ts +0 -216
- package/cli/dist-server/types/node/tools/monitor-ws-network-policy.d.ts +0 -64
- package/cli/dist-server/types/node/tools/monitor-ws-source.d.ts +0 -72
- package/cli/dist-server/types/node/tools/multi-edit-tool.d.ts +0 -104
- package/cli/dist-server/types/node/tools/notebook-edit-tool.d.ts +0 -75
- package/cli/dist-server/types/node/tools/notebook-read-tool.d.ts +0 -55
- package/cli/dist-server/types/node/tools/notebook-write-tool.d.ts +0 -7
- package/cli/dist-server/types/node/tools/powershell-clm-types.d.ts +0 -30
- package/cli/dist-server/types/node/tools/powershell-command-semantics.d.ts +0 -23
- package/cli/dist-server/types/node/tools/powershell-dangerous-cmdlets.d.ts +0 -72
- package/cli/dist-server/types/node/tools/powershell-destructive-warning.d.ts +0 -12
- package/cli/dist-server/types/node/tools/powershell-detection.d.ts +0 -51
- package/cli/dist-server/types/node/tools/powershell-git-safety.d.ts +0 -60
- package/cli/dist-server/types/node/tools/powershell-pty-utils.d.ts +0 -13
- package/cli/dist-server/types/node/tools/powershell-security.d.ts +0 -93
- package/cli/dist-server/types/node/tools/powershell-tool.d.ts +0 -174
- package/cli/dist-server/types/node/tools/product-interaction-tools.d.ts +0 -23
- package/cli/dist-server/types/node/tools/push-notification-tool.d.ts +0 -55
- package/cli/dist-server/types/node/tools/read-mcp-resource-tool.d.ts +0 -71
- package/cli/dist-server/types/node/tools/read-state-guard.d.ts +0 -22
- package/cli/dist-server/types/node/tools/read-tool.d.ts +0 -71
- package/cli/dist-server/types/node/tools/repl/index.d.ts +0 -10
- package/cli/dist-server/types/node/tools/repl/repl-bridge-broker.d.ts +0 -109
- package/cli/dist-server/types/node/tools/repl/repl-bridge-host.d.ts +0 -29
- package/cli/dist-server/types/node/tools/repl/repl-catalog-protocol.d.ts +0 -136
- package/cli/dist-server/types/node/tools/repl/repl-catalog-render.d.ts +0 -56
- package/cli/dist-server/types/node/tools/repl/repl-catalog-source.d.ts +0 -117
- package/cli/dist-server/types/node/tools/repl/repl-import-rewrite.d.ts +0 -17
- package/cli/dist-server/types/node/tools/repl/repl-nested-interaction.d.ts +0 -32
- package/cli/dist-server/types/node/tools/repl/repl-sandbox-result.d.ts +0 -111
- package/cli/dist-server/types/node/tools/repl/repl-tool.d.ts +0 -128
- package/cli/dist-server/types/node/tools/repl/repl-worker-manager.d.ts +0 -95
- package/cli/dist-server/types/node/tools/repl/repl-worker-source.d.ts +0 -16
- package/cli/dist-server/types/node/tools/repl/repl-worker-source.generated.d.ts +0 -2
- package/cli/dist-server/types/node/tools/report-findings-tool.d.ts +0 -97
- package/cli/dist-server/types/node/tools/running-background-tasks.d.ts +0 -26
- package/cli/dist-server/types/node/tools/sandbox-approval-helpers.d.ts +0 -19
- package/cli/dist-server/types/node/tools/sandbox-intercept-message.d.ts +0 -22
- package/cli/dist-server/types/node/tools/sandbox-network-intercept-message.d.ts +0 -25
- package/cli/dist-server/types/node/tools/sandbox-permission-file-tool.d.ts +0 -14
- package/cli/dist-server/types/node/tools/sandbox-program-blacklist-message.d.ts +0 -9
- package/cli/dist-server/types/node/tools/send-message-tool.d.ts +0 -116
- package/cli/dist-server/types/node/tools/send-user-message-attachments.d.ts +0 -22
- package/cli/dist-server/types/node/tools/send-user-message-tool.d.ts +0 -60
- package/cli/dist-server/types/node/tools/shell-stream-pusher.d.ts +0 -25
- package/cli/dist-server/types/node/tools/skill-manage-tool.d.ts +0 -77
- package/cli/dist-server/types/node/tools/skill-tool.d.ts +0 -129
- package/cli/dist-server/types/node/tools/slash-command-tool.d.ts +0 -45
- package/cli/dist-server/types/node/tools/speak-in-channel-tool.d.ts +0 -178
- package/cli/dist-server/types/node/tools/structured-output-tool.d.ts +0 -43
- package/cli/dist-server/types/node/tools/task-create-tool.d.ts +0 -72
- package/cli/dist-server/types/node/tools/task-get-tool.d.ts +0 -31
- package/cli/dist-server/types/node/tools/task-list-tool.d.ts +0 -21
- package/cli/dist-server/types/node/tools/task-output-tool.d.ts +0 -127
- package/cli/dist-server/types/node/tools/task-stop-tool.d.ts +0 -61
- package/cli/dist-server/types/node/tools/task-update-tool.d.ts +0 -79
- package/cli/dist-server/types/node/tools/team-delete-tool.d.ts +0 -38
- package/cli/dist-server/types/node/tools/todo-write-tool.d.ts +0 -117
- package/cli/dist-server/types/node/tools/tool-permission-strategy.d.ts +0 -83
- package/cli/dist-server/types/node/tools/tool-search-tool.d.ts +0 -113
- package/cli/dist-server/types/node/tools/video-gen-tool.d.ts +0 -82
- package/cli/dist-server/types/node/tools/wait-for-mcp-servers-tool.d.ts +0 -79
- package/cli/dist-server/types/node/tools/web-fetch-tool.d.ts +0 -164
- package/cli/dist-server/types/node/tools/web-search-tool.d.ts +0 -79
- package/cli/dist-server/types/node/tools/webfetch-resource-kind.d.ts +0 -25
- package/cli/dist-server/types/node/tools/wechat-reply-tool.d.ts +0 -43
- package/cli/dist-server/types/node/tools/wecom-reply-tool.d.ts +0 -65
- package/cli/dist-server/types/node/tools/workflow-tool.d.ts +0 -100
- package/cli/dist-server/types/node/tools/write-tool.d.ts +0 -74
- package/cli/dist-server/types/node/utils/stdio-persistence.d.ts +0 -39
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { Logger } from '@celljs/core';
|
|
2
|
-
import { Session } from '../../vendor/cbc-core/node/index.js';
|
|
3
|
-
import { FunctionCallItem, ToolArg, ToolNames } from '../../vendor/cbc-shared/node/index.js';
|
|
4
|
-
import type { RunContext, ToolExecuteArgument } from '@openai/agents';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
import { type AcpTerminalPublisher } from '../acp/acp-protocol';
|
|
7
|
-
import { BackgroundTaskNotifier } from '../agent-task/agent-task-protocol';
|
|
8
|
-
import { BashSandboxManager } from '../bash-sandbox';
|
|
9
|
-
import { ToolResultBlobService } from '../blob-store/tool-result-blob-service';
|
|
10
|
-
import { EndpointProvider } from '../loopback/server-protocol';
|
|
11
|
-
import { type SandboxOrchestrator as ISandboxOrchestrator, type SandboxPermissionGateway as ISandboxPermissionGateway } from '../permission';
|
|
12
|
-
import { PluginManager } from '@genie/cbc-plugins';
|
|
13
|
-
import { SettingsManager } from '../settings';
|
|
14
|
-
import { ShellService } from '../shell';
|
|
15
|
-
import { ShortcutManager } from '../shortcut/shortcut-protocol';
|
|
16
|
-
import { BaseTool } from './base-tool';
|
|
17
|
-
import { type ShellStreamPusherService } from './shell-stream-pusher';
|
|
18
|
-
import { Tool, ToolCallArgumentRenderer, ToolResult } from './tool-protocol';
|
|
19
|
-
declare const BashParameters: z.ZodObject<{
|
|
20
|
-
readonly command: z.ZodString;
|
|
21
|
-
readonly timeout: z.ZodOptional<z.ZodNumber>;
|
|
22
|
-
readonly description: z.ZodOptional<z.ZodString>;
|
|
23
|
-
readonly run_in_background: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
-
readonly dangerouslyDisableSandbox: z.ZodOptional<z.ZodBoolean>;
|
|
25
|
-
}, "strip", z.ZodTypeAny, {
|
|
26
|
-
command: string;
|
|
27
|
-
timeout?: number | undefined;
|
|
28
|
-
description?: string | undefined;
|
|
29
|
-
run_in_background?: boolean | undefined;
|
|
30
|
-
dangerouslyDisableSandbox?: boolean | undefined;
|
|
31
|
-
}, {
|
|
32
|
-
command: string;
|
|
33
|
-
timeout?: number | undefined;
|
|
34
|
-
description?: string | undefined;
|
|
35
|
-
run_in_background?: boolean | undefined;
|
|
36
|
-
dangerouslyDisableSandbox?: boolean | undefined;
|
|
37
|
-
}>;
|
|
38
|
-
type BashInput = z.infer<typeof BashParameters>;
|
|
39
|
-
export declare class BashTool extends BaseTool implements Tool {
|
|
40
|
-
protected readonly shellService: ShellService;
|
|
41
|
-
protected readonly sandboxOrchestrator: ISandboxOrchestrator;
|
|
42
|
-
protected readonly sandboxPermissionGateway: ISandboxPermissionGateway;
|
|
43
|
-
protected readonly shortcutManager: ShortcutManager;
|
|
44
|
-
protected readonly logger: Logger;
|
|
45
|
-
protected readonly shellStreamPusher: ShellStreamPusherService;
|
|
46
|
-
protected readonly sandboxManager: BashSandboxManager;
|
|
47
|
-
protected readonly settingsManager: SettingsManager;
|
|
48
|
-
protected readonly pluginManager?: PluginManager;
|
|
49
|
-
protected readonly toolResultBlobService: ToolResultBlobService;
|
|
50
|
-
protected readonly backgroundTaskNotifier: BackgroundTaskNotifier;
|
|
51
|
-
protected readonly endpointProvider: EndpointProvider;
|
|
52
|
-
/**
|
|
53
|
-
* 尝试解析 service proxy 端点 URL。
|
|
54
|
-
* server 模式下立即可得;非 server 模式(TUI/SDK)下 deferred 永不解锁,
|
|
55
|
-
* @returns URL 字符串,解析失败返回 null
|
|
56
|
-
*/
|
|
57
|
-
private resolveServiceProxyUrl;
|
|
58
|
-
/**
|
|
59
|
-
* ACP v2 终端推送器。惰性解析而非 @Autowired:纯 TUI / SDK 运行时不会加载 acp 模块,
|
|
60
|
-
* 此时容器里没有这个绑定,取不到就整体降级为不推送。
|
|
61
|
-
*/
|
|
62
|
-
private terminalPublisherRef?;
|
|
63
|
-
protected get terminalPublisher(): AcpTerminalPublisher | undefined;
|
|
64
|
-
/**
|
|
65
|
-
* 把一段终端输出投给 ACP 客户端。三个 spawn 路径(file-fd poller / pipe onOutput /
|
|
66
|
-
* 前台促升)最终都汇到这里,所以门控与异常吞噬只需要在一处成立。
|
|
67
|
-
*
|
|
68
|
-
* 整段自吞异常:推送是旁路观测,绝不能让它影响命令执行。
|
|
69
|
-
*
|
|
70
|
-
* @param bytes `Buffer` = 来自文件的原始字节(字节保真);`string` = 来自 PTY / pipe
|
|
71
|
-
* 的解码结果(保真度较弱,见各调用点说明)。
|
|
72
|
-
*/
|
|
73
|
-
private publishTerminalOutput;
|
|
74
|
-
/** 促升路径用:任务还没促升时 task 为 undefined,天然不推。 */
|
|
75
|
-
private publishBackgroundOutput;
|
|
76
|
-
name: ToolNames;
|
|
77
|
-
aliases: string[];
|
|
78
|
-
/**
|
|
79
|
-
* Tool schema is a **method** (not a static field) so ToolManager.get()
|
|
80
|
-
* re-evaluates it per invocation against the current process env. When
|
|
81
|
-
* CODEBUDDY_CODE_DISABLE_BACKGROUND_TASKS is truthy the `run_in_background`
|
|
82
|
-
* field is omitted, so the model never sees it (issue #63114 — background
|
|
83
|
-
* shell results cannot flow back in request-response SDK / print-mode
|
|
84
|
-
* consumers, so the host disables the capability outright). The runtime
|
|
85
|
-
* guard in `execute()` still coerces `run_in_background=true` from
|
|
86
|
-
* stale/cached tool calls back to foreground.
|
|
87
|
-
*/
|
|
88
|
-
parameters(): z.ZodTypeAny;
|
|
89
|
-
/**
|
|
90
|
-
* On Windows, BashTool requires Git Bash. If Git Bash is not installed,
|
|
91
|
-
* this tool is disabled and PowerShellTool becomes the sole shell tool.
|
|
92
|
-
*/
|
|
93
|
-
isEnabled: () => boolean;
|
|
94
|
-
argumentRenderer: ToolCallArgumentRenderer;
|
|
95
|
-
resolveNeedPermissionArgs(_runContext: RunContext, input: BashInput, _callId?: string): ToolArg[];
|
|
96
|
-
/** Auto mode classifier projection: the command is the action's risk surface. */
|
|
97
|
-
toAutoClassifierInput(input: unknown): string;
|
|
98
|
-
needsApproval: (runContext: RunContext<Session>, input: ToolExecuteArgument<any>, callId?: string) => Promise<boolean>;
|
|
99
|
-
execute(input: BashInput, context: RunContext<Session>, details?: {
|
|
100
|
-
toolCall: FunctionCallItem;
|
|
101
|
-
}): Promise<ToolResult>;
|
|
102
|
-
private executeForeground;
|
|
103
|
-
private createExecutionContext;
|
|
104
|
-
private createShellPromise;
|
|
105
|
-
private createBackgroundPromise;
|
|
106
|
-
/**
|
|
107
|
-
* shell-service 超时触发时的处理:尝试把命令转为后台任务而不是 kill。
|
|
108
|
-
*
|
|
109
|
-
* 对齐 Claude Code 的 `shellCommand.onTimeout → startBackgrounding` 行为
|
|
110
|
-
* (src/tools/BashTool/BashTool.tsx:967-971)。返回 true 告诉 shell-service "已接管,
|
|
111
|
-
* 不要 SIGTERM",子进程继续跑;返回 false 走原 kill 路径(向后兼容老行为)。
|
|
112
|
-
*
|
|
113
|
-
* 关闭条件:
|
|
114
|
-
* - env CODEBUDDY_BASH_AUTO_BACKGROUND_DISABLED=1 → 全局关闭
|
|
115
|
-
* - print 模式(-p,非 stdio stream-json)→ 禁止(#61140,进程随主 turn 退出无法续跑后台任务)
|
|
116
|
-
* - 命令在 auto-background 黑名单内(如 `sleep`) → 按原路径 kill
|
|
117
|
-
* - execCtx.promoteToBackground 未就绪(理论上不会发生)
|
|
118
|
-
*/
|
|
119
|
-
private tryPromoteToBackgroundOnTimeout;
|
|
120
|
-
private handleBackgroundedResult;
|
|
121
|
-
private buildForegroundResult;
|
|
122
|
-
/**
|
|
123
|
-
* 后台任务输出文件大小看门狗的扫描间隔。
|
|
124
|
-
*/
|
|
125
|
-
private static readonly BG_SIZE_WATCHDOG_INTERVAL_MS;
|
|
126
|
-
/**
|
|
127
|
-
* 后台任务 stdout+stderr 总大小上限,超过则 SIGKILL(防写爆磁盘)。
|
|
128
|
-
* 默认 50MB;可通过 env `CODEBUDDY_BASH_BG_MAX_OUTPUT_BYTES` 调整。
|
|
129
|
-
* 参考 Claude Code `ShellCommand.ts:239-261` 的 size watchdog 机制。
|
|
130
|
-
*/
|
|
131
|
-
private static readonly BG_DEFAULT_MAX_OUTPUT_BYTES;
|
|
132
|
-
private getBgMaxOutputBytes;
|
|
133
|
-
/**
|
|
134
|
-
* 给当前后台任务分配一对 stdout/stderr 落盘文件 + fd,用于直接接收子进程的 stdio。
|
|
135
|
-
*
|
|
136
|
-
* 返回 `null` 表示当前路径不适合走文件 fd(例如要走 sandbox 后端,
|
|
137
|
-
* IPC 协议不消费 fd),调用方应回退到 onOutput pipe 模式。
|
|
138
|
-
*
|
|
139
|
-
* 实际的"建目录 + 开 fd"逻辑抽到 {@link prepareBackgroundOutputFiles}(独立 module)
|
|
140
|
-
* 以便单测;此方法只做"是否走文件 fd"的策略判断。
|
|
141
|
-
*/
|
|
142
|
-
private maybePrepareBackgroundOutputFiles;
|
|
143
|
-
private executeInBackground;
|
|
144
|
-
/** 关 fd 的小工具;忽略已关闭/无效错误。spawn 之后必须立刻调用,不要让父进程持有写端。 */
|
|
145
|
-
private closeFdSafely;
|
|
146
|
-
private createBackgroundTask;
|
|
147
|
-
/**
|
|
148
|
-
* 晋升路径的终端退出通知。任务未晋升(execCtx.currentBackgroundTask 为空)时静默跳过。
|
|
149
|
-
*
|
|
150
|
-
* 任何终止分支都必须调用:`exitStatus` 是客户端判定"已结束"的唯一依据,漏一条就会让
|
|
151
|
-
* 卡片永远停在运行中。
|
|
152
|
-
*/
|
|
153
|
-
private notifyTerminalExit;
|
|
154
|
-
private updateBackgroundTaskStatus;
|
|
155
|
-
/**
|
|
156
|
-
* 收集本次命令声明的产物,并就地打完相关告警。
|
|
157
|
-
*
|
|
158
|
-
* 唯一来源是 `$CODEBUDDY_ARTIFACTS` 带外通道;stdout 不再被解析(原因见
|
|
159
|
-
* produced-artifact.ts 模块头)。
|
|
160
|
-
*
|
|
161
|
-
* 只返回 artifacts。malformed 不上抛是有意的:它唯一的用途就是告警,作者看不到
|
|
162
|
-
* 这个文件,被跳过的行只能靠日志暴露。
|
|
163
|
-
*/
|
|
164
|
-
private collectDeclarations;
|
|
165
|
-
private buildBackgroundResult;
|
|
166
|
-
private startStreamingUpdates;
|
|
167
|
-
private stopStreamingUpdates;
|
|
168
|
-
private createStreamingText;
|
|
169
|
-
private pushStreamingText;
|
|
170
|
-
private cleanup;
|
|
171
|
-
private shouldAutoApproveInSandbox;
|
|
172
|
-
validateRuntimeInput(input: unknown): ToolResult | undefined;
|
|
173
|
-
private validateInput;
|
|
174
|
-
private errorResult;
|
|
175
|
-
/**
|
|
176
|
-
* 把参数校验类的失败原因映射到 8000 段细分错误码:
|
|
177
|
-
* 命令根无法识别(权限/解析域)→ 8014,其余保持 90000。
|
|
178
|
-
*/
|
|
179
|
-
private resolveBashValidationErrorCode;
|
|
180
|
-
/**
|
|
181
|
-
* 根据 shell 执行结果推导结构化错误码。
|
|
182
|
-
* 返回 '0' 表示成功(无错误),非零纯数字为错误码。
|
|
183
|
-
*/
|
|
184
|
-
private resolveBashErrorCode;
|
|
185
|
-
private findCallId;
|
|
186
|
-
private getCommandRoot;
|
|
187
|
-
private isEnvAssignment;
|
|
188
|
-
private generateTaskId;
|
|
189
|
-
private resolveTimeout;
|
|
190
|
-
/**
|
|
191
|
-
* Build a SandboxApprovalRequester that surfaces SandboxOrchestrator
|
|
192
|
-
* approval prompts through the standard InterruptionService flow.
|
|
193
|
-
*
|
|
194
|
-
* The full implementation lives in `bash-sandbox-approval-requester.ts`
|
|
195
|
-
* — this method is a thin shim that injects the tool's logger.
|
|
196
|
-
*/
|
|
197
|
-
private _createApprovalRequester;
|
|
198
|
-
/**
|
|
199
|
-
* Emit a single structured log line summarising the orchestrator outcome,
|
|
200
|
-
* so it is easy to grep for bypass decisions during diagnostics.
|
|
201
|
-
*/
|
|
202
|
-
private _logOrchestratorOutcome;
|
|
203
|
-
}
|
|
204
|
-
export {};
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ChannelTasks —— 频道任务板(黑板 + 单写者认领)。
|
|
3
|
-
*
|
|
4
|
-
* 事件经 applyChannelTaskEvent 落板 + transcript(kind=task),再定向叫醒。
|
|
5
|
-
* 纪律:先 claim 再动手;产出写文件 / 分支,refs 只传引用不贴正文。
|
|
6
|
-
* 只对 Agent Home 自治表面开放(TUI / 通用 ACP / 子代理拿不到)。
|
|
7
|
-
*/
|
|
8
|
-
import type { Session } from '../../vendor/cbc-core/node/index.js';
|
|
9
|
-
import type { RunContext } from '../../vendor/cbc-shared/node/index.js';
|
|
10
|
-
import { Logger } from '@genie/telemetry';
|
|
11
|
-
import { z } from 'zod';
|
|
12
|
-
import { ChannelWakeService } from '../agent-home/channel-wake-service';
|
|
13
|
-
import { SettingsManager } from '../settings/settings-protocol';
|
|
14
|
-
import { BaseTool } from './base-tool';
|
|
15
|
-
import { Tool, ToolCallArgumentRenderer, ToolNames, ToolResult } from './tool-protocol';
|
|
16
|
-
export declare class ChannelTasksTool extends BaseTool implements Tool {
|
|
17
|
-
protected readonly logger: Logger;
|
|
18
|
-
protected readonly wakeService?: ChannelWakeService;
|
|
19
|
-
protected readonly settingsManager?: SettingsManager;
|
|
20
|
-
name: ToolNames;
|
|
21
|
-
description: string;
|
|
22
|
-
needsApproval: boolean;
|
|
23
|
-
shouldShowInToolSearch: () => boolean;
|
|
24
|
-
parameters: z.ZodObject<{
|
|
25
|
-
action: z.ZodEnum<["list", "create", "update", "delete", "claim", "complete", "release", "dispatch", "escalate"]>;
|
|
26
|
-
channel: z.ZodOptional<z.ZodString>;
|
|
27
|
-
taskId: z.ZodOptional<z.ZodString>;
|
|
28
|
-
subject: z.ZodOptional<z.ZodString>;
|
|
29
|
-
detail: z.ZodOptional<z.ZodString>;
|
|
30
|
-
assignAgentId: z.ZodOptional<z.ZodString>;
|
|
31
|
-
refs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
32
|
-
kind: z.ZodEnum<["issue", "file", "pr", "commit", "url"]>;
|
|
33
|
-
value: z.ZodString;
|
|
34
|
-
}, "strip", z.ZodTypeAny, {
|
|
35
|
-
kind: "commit" | "file" | "issue" | "pr" | "url";
|
|
36
|
-
value: string;
|
|
37
|
-
}, {
|
|
38
|
-
kind: "commit" | "file" | "issue" | "pr" | "url";
|
|
39
|
-
value: string;
|
|
40
|
-
}>, "many">>;
|
|
41
|
-
requestId: z.ZodOptional<z.ZodString>;
|
|
42
|
-
assignments: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
43
|
-
subject: z.ZodString;
|
|
44
|
-
detail: z.ZodOptional<z.ZodString>;
|
|
45
|
-
assignAgentId: z.ZodString;
|
|
46
|
-
refs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
47
|
-
kind: z.ZodEnum<["issue", "file", "pr", "commit", "url"]>;
|
|
48
|
-
value: z.ZodString;
|
|
49
|
-
}, "strip", z.ZodTypeAny, {
|
|
50
|
-
kind: "commit" | "file" | "issue" | "pr" | "url";
|
|
51
|
-
value: string;
|
|
52
|
-
}, {
|
|
53
|
-
kind: "commit" | "file" | "issue" | "pr" | "url";
|
|
54
|
-
value: string;
|
|
55
|
-
}>, "many">>;
|
|
56
|
-
}, "strip", z.ZodTypeAny, {
|
|
57
|
-
subject: string;
|
|
58
|
-
detail?: string | undefined;
|
|
59
|
-
assignAgentId: string;
|
|
60
|
-
refs?: {
|
|
61
|
-
kind: "commit" | "file" | "issue" | "pr" | "url";
|
|
62
|
-
value: string;
|
|
63
|
-
}[] | undefined;
|
|
64
|
-
}, {
|
|
65
|
-
subject: string;
|
|
66
|
-
detail?: string | undefined;
|
|
67
|
-
assignAgentId: string;
|
|
68
|
-
refs?: {
|
|
69
|
-
kind: "commit" | "file" | "issue" | "pr" | "url";
|
|
70
|
-
value: string;
|
|
71
|
-
}[] | undefined;
|
|
72
|
-
}>, "many">>;
|
|
73
|
-
escalate: z.ZodOptional<z.ZodObject<{
|
|
74
|
-
mode: z.ZodEnum<["nudge", "release"]>;
|
|
75
|
-
taskIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
76
|
-
maxStaleMs: z.ZodOptional<z.ZodNumber>;
|
|
77
|
-
}, "strip", z.ZodTypeAny, {
|
|
78
|
-
mode: "nudge" | "release";
|
|
79
|
-
taskIds?: string[] | undefined;
|
|
80
|
-
maxStaleMs?: number | undefined;
|
|
81
|
-
}, {
|
|
82
|
-
mode: "nudge" | "release";
|
|
83
|
-
taskIds?: string[] | undefined;
|
|
84
|
-
maxStaleMs?: number | undefined;
|
|
85
|
-
}>>;
|
|
86
|
-
}, "strip", z.ZodTypeAny, {
|
|
87
|
-
action: "claim" | "complete" | "create" | "delete" | "dispatch" | "escalate" | "list" | "release" | "update";
|
|
88
|
-
channel?: string | undefined;
|
|
89
|
-
taskId?: string | undefined;
|
|
90
|
-
subject?: string | undefined;
|
|
91
|
-
detail?: string | undefined;
|
|
92
|
-
assignAgentId?: string | undefined;
|
|
93
|
-
refs?: {
|
|
94
|
-
kind: "commit" | "file" | "issue" | "pr" | "url";
|
|
95
|
-
value: string;
|
|
96
|
-
}[] | undefined;
|
|
97
|
-
requestId?: string | undefined;
|
|
98
|
-
assignments?: {
|
|
99
|
-
subject: string;
|
|
100
|
-
detail?: string | undefined;
|
|
101
|
-
assignAgentId: string;
|
|
102
|
-
refs?: {
|
|
103
|
-
kind: "commit" | "file" | "issue" | "pr" | "url";
|
|
104
|
-
value: string;
|
|
105
|
-
}[] | undefined;
|
|
106
|
-
}[] | undefined;
|
|
107
|
-
escalate?: {
|
|
108
|
-
mode: "nudge" | "release";
|
|
109
|
-
taskIds?: string[] | undefined;
|
|
110
|
-
maxStaleMs?: number | undefined;
|
|
111
|
-
} | undefined;
|
|
112
|
-
}, {
|
|
113
|
-
action: "claim" | "complete" | "create" | "delete" | "dispatch" | "escalate" | "list" | "release" | "update";
|
|
114
|
-
channel?: string | undefined;
|
|
115
|
-
taskId?: string | undefined;
|
|
116
|
-
subject?: string | undefined;
|
|
117
|
-
detail?: string | undefined;
|
|
118
|
-
assignAgentId?: string | undefined;
|
|
119
|
-
refs?: {
|
|
120
|
-
kind: "commit" | "file" | "issue" | "pr" | "url";
|
|
121
|
-
value: string;
|
|
122
|
-
}[] | undefined;
|
|
123
|
-
requestId?: string | undefined;
|
|
124
|
-
assignments?: {
|
|
125
|
-
subject: string;
|
|
126
|
-
detail?: string | undefined;
|
|
127
|
-
assignAgentId: string;
|
|
128
|
-
refs?: {
|
|
129
|
-
kind: "commit" | "file" | "issue" | "pr" | "url";
|
|
130
|
-
value: string;
|
|
131
|
-
}[] | undefined;
|
|
132
|
-
}[] | undefined;
|
|
133
|
-
escalate?: {
|
|
134
|
-
mode: "nudge" | "release";
|
|
135
|
-
taskIds?: string[] | undefined;
|
|
136
|
-
maxStaleMs?: number | undefined;
|
|
137
|
-
} | undefined;
|
|
138
|
-
}>;
|
|
139
|
-
argumentRenderer: ToolCallArgumentRenderer;
|
|
140
|
-
toAutoClassifierInput(_input: unknown): string;
|
|
141
|
-
isEnabled: (args?: {
|
|
142
|
-
runContext?: RunContext<Session>;
|
|
143
|
-
agent?: {
|
|
144
|
-
name?: string;
|
|
145
|
-
};
|
|
146
|
-
}) => Promise<boolean>;
|
|
147
|
-
execute(input: {
|
|
148
|
-
action?: string;
|
|
149
|
-
channel?: string;
|
|
150
|
-
taskId?: string;
|
|
151
|
-
subject?: string;
|
|
152
|
-
detail?: string;
|
|
153
|
-
assignAgentId?: string;
|
|
154
|
-
refs?: {
|
|
155
|
-
kind: 'issue' | 'file' | 'pr' | 'commit' | 'url';
|
|
156
|
-
value: string;
|
|
157
|
-
}[];
|
|
158
|
-
requestId?: string;
|
|
159
|
-
assignments?: {
|
|
160
|
-
subject: string;
|
|
161
|
-
detail?: string;
|
|
162
|
-
assignAgentId: string;
|
|
163
|
-
refs?: {
|
|
164
|
-
kind: 'issue' | 'file' | 'pr' | 'commit' | 'url';
|
|
165
|
-
value: string;
|
|
166
|
-
}[];
|
|
167
|
-
}[];
|
|
168
|
-
escalate?: {
|
|
169
|
-
mode: 'nudge' | 'release';
|
|
170
|
-
taskIds?: string[];
|
|
171
|
-
maxStaleMs?: number;
|
|
172
|
-
};
|
|
173
|
-
}, context?: RunContext<Session>): Promise<ToolResult>;
|
|
174
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* macOS 平台硬过滤。Windows / Linux 下工具完全禁用。
|
|
3
|
-
*/
|
|
4
|
-
export declare function isDarwin(): boolean;
|
|
5
|
-
/**
|
|
6
|
-
* 探测 cliclick 是否可用。cliclick 提供比 AppleScript 更快更准确的鼠标/键盘操作,
|
|
7
|
-
* 但需要用户通过 Homebrew 安装。未安装时 fallback 到 osascript。
|
|
8
|
-
*
|
|
9
|
-
* 检测方式:which cliclick,有输出且返回 0 即可用。结果缓存。
|
|
10
|
-
*/
|
|
11
|
-
export declare function detectCliclick(): Promise<string | null>;
|
|
12
|
-
/**
|
|
13
|
-
* 计算本次 cbc 进程的 computer-use 截图目录,按需创建。
|
|
14
|
-
* 路径:<home>/computer-use/ (home 支持 CODEBUDDY_CONFIG_DIR 重定向)
|
|
15
|
-
*
|
|
16
|
-
* 不按 session/project 分目录 —— computer use 操作本身和当前会话关系紧密,
|
|
17
|
-
* 但截图作为调试/审计产物,统一放一起便于用户清理。
|
|
18
|
-
*/
|
|
19
|
-
export declare function getComputerUseDir(): string;
|
|
20
|
-
/**
|
|
21
|
-
* 仅测试用:重置缓存,便于 spec 里多次断言不同平台分支。
|
|
22
|
-
*/
|
|
23
|
-
export declare function __resetComputerUseCapabilitiesCacheForTest(): void;
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/** 测试钩子:直接读当前 scale,便于断言。 */
|
|
2
|
-
export declare function getScreenshotScaleForTest(): {
|
|
3
|
-
x: number;
|
|
4
|
-
y: number;
|
|
5
|
-
};
|
|
6
|
-
/** 测试钩子:手动重置 scale(spec 用)。 */
|
|
7
|
-
export declare function __resetScreenshotScaleForTest(): void;
|
|
8
|
-
export type ComputerUseAction = 'screenshot' | 'left_click' | 'right_click' | 'middle_click' | 'double_click' | 'triple_click' | 'mouse_move' | 'left_click_drag' | 'type' | 'key' | 'hold_key' | 'scroll' | 'wait' | 'cursor_position';
|
|
9
|
-
export type ScrollDirection = 'up' | 'down' | 'left' | 'right';
|
|
10
|
-
export interface ScreenshotResult {
|
|
11
|
-
action: 'screenshot';
|
|
12
|
-
screenshot_path: string;
|
|
13
|
-
}
|
|
14
|
-
export interface ClickResult {
|
|
15
|
-
action: 'left_click' | 'right_click' | 'middle_click' | 'double_click' | 'triple_click' | 'mouse_move';
|
|
16
|
-
x: number;
|
|
17
|
-
y: number;
|
|
18
|
-
}
|
|
19
|
-
export interface DragResult {
|
|
20
|
-
action: 'left_click_drag';
|
|
21
|
-
start_x: number;
|
|
22
|
-
start_y: number;
|
|
23
|
-
end_x: number;
|
|
24
|
-
end_y: number;
|
|
25
|
-
}
|
|
26
|
-
export interface TypeResult {
|
|
27
|
-
action: 'type';
|
|
28
|
-
text_length: number;
|
|
29
|
-
}
|
|
30
|
-
export interface KeyResult {
|
|
31
|
-
action: 'key';
|
|
32
|
-
text: string;
|
|
33
|
-
}
|
|
34
|
-
export interface HoldKeyResult {
|
|
35
|
-
action: 'hold_key';
|
|
36
|
-
text: string;
|
|
37
|
-
duration: number;
|
|
38
|
-
}
|
|
39
|
-
export interface ScrollResult {
|
|
40
|
-
action: 'scroll';
|
|
41
|
-
x: number;
|
|
42
|
-
y: number;
|
|
43
|
-
scroll_direction: ScrollDirection;
|
|
44
|
-
scroll_amount: number;
|
|
45
|
-
}
|
|
46
|
-
export interface WaitResult {
|
|
47
|
-
action: 'wait';
|
|
48
|
-
duration: number;
|
|
49
|
-
}
|
|
50
|
-
export interface CursorPositionResult {
|
|
51
|
-
action: 'cursor_position';
|
|
52
|
-
x: number;
|
|
53
|
-
y: number;
|
|
54
|
-
}
|
|
55
|
-
export type ComputerUseResult = ScreenshotResult | ClickResult | DragResult | TypeResult | KeyResult | HoldKeyResult | ScrollResult | WaitResult | CursorPositionResult;
|
|
56
|
-
/**
|
|
57
|
-
* 截图实现。通过 `/usr/sbin/screencapture -x -t jpg -T 0 <out>` 调用系统截图工具。
|
|
58
|
-
*
|
|
59
|
-
* 参数:
|
|
60
|
-
* -x: 不播放快门音(避免打扰用户)
|
|
61
|
-
* -t jpg: 输出 jpeg(文件小、加载快,模型推理足够)
|
|
62
|
-
* -T 0: 零延迟截图
|
|
63
|
-
* -D <id>: 可选,指定显示器
|
|
64
|
-
*/
|
|
65
|
-
export declare function takeScreenshot(displayId?: number): Promise<ScreenshotResult>;
|
|
66
|
-
/**
|
|
67
|
-
* 鼠标点击/移动。优先用 cliclick(快速精准),未安装时 fallback 到 AppleScript。
|
|
68
|
-
* AppleScript 的 `click at {x,y}` 在部分 macOS 版本行为不稳定(需要 System Events 焦点),
|
|
69
|
-
* 但作为 fallback 可用。
|
|
70
|
-
*
|
|
71
|
-
* middle_click / triple_click 仅 cliclick 支持;无 cliclick 时抛错。
|
|
72
|
-
*/
|
|
73
|
-
export declare function mouseAction(action: ClickResult['action'], x: number, y: number): Promise<ClickResult>;
|
|
74
|
-
/**
|
|
75
|
-
* 左键拖拽 (Anthropic left_click_drag)。仅 cliclick 支持;需要 3 步:按下→移动→松开。
|
|
76
|
-
*/
|
|
77
|
-
export declare function leftClickDrag(startX: number, startY: number, endX: number, endY: number): Promise<DragResult>;
|
|
78
|
-
/**
|
|
79
|
-
* 文本输入。用 AppleScript `keystroke` 原生支持任意 Unicode 字符(含中日韩)。
|
|
80
|
-
* cliclick 的 t: 对非 ASCII 支持不完整,所以这里统一走 osascript。
|
|
81
|
-
*
|
|
82
|
-
* 多行:AppleScript 双引号字面量不能含裸换行/CR,直接拼进去会 syntax error。
|
|
83
|
-
* 按 \n 拆段,段与段之间发 `keystroke return`(key code 36),匹配"真实按回车换行"语义。
|
|
84
|
-
* `\r` 归一化成 `\n`;`\t` 交给 keystroke 原生(AppleScript 字面量支持 tab 字符)。
|
|
85
|
-
*/
|
|
86
|
-
export declare function typeText(text: string): Promise<TypeResult>;
|
|
87
|
-
/**
|
|
88
|
-
* 按键/快捷键。接受 xdotool 风格字符串如 `cmd+shift+a` 或单个键如 `escape` / `return`。
|
|
89
|
-
*/
|
|
90
|
-
export declare function pressKey(text: string): Promise<KeyResult>;
|
|
91
|
-
/**
|
|
92
|
-
* 按住某键指定秒数(Anthropic hold_key)。
|
|
93
|
-
*
|
|
94
|
-
* macOS 下最稳定的实现是 keystroke + 循环重复(按键自动重复速率由系统控制)。
|
|
95
|
-
* 为了精确控制时长,改用 AppleScript 的 `key down` + delay + `key up` 模式。
|
|
96
|
-
* 仅支持命名键(escape/return/letter 等),不支持组合修饰键(与 Anthropic 保持一致)。
|
|
97
|
-
*/
|
|
98
|
-
export declare function holdKey(text: string, duration: number): Promise<HoldKeyResult>;
|
|
99
|
-
/**
|
|
100
|
-
* 等待指定秒数。纯 setTimeout 包装,用于给 UI 动画留出时间。
|
|
101
|
-
*/
|
|
102
|
-
export declare function wait(duration: number): Promise<WaitResult>;
|
|
103
|
-
/**
|
|
104
|
-
* 滚动。
|
|
105
|
-
*
|
|
106
|
-
* 历史实现用 `cliclick w:dx,dy` 模拟滚轮 —— **这是错的**:
|
|
107
|
-
* cliclick 的 `w:` 命令含义是 "wait <ms>",不是滚轮。它会把 `0,3` 当作非法毫秒
|
|
108
|
-
* 静默吞掉,结果就是滚不动。cliclick 在 5.x 版本之前根本没有滚轮原生命令。
|
|
109
|
-
*
|
|
110
|
-
* 现改用 macOS 自带的 python3 + Quartz 框架调用 CoreGraphics 的
|
|
111
|
-
* `CGEventCreateScrollWheelEvent`,这是 macOS 原生滚轮事件,最贴近真实硬件行为,
|
|
112
|
-
* 且 macOS 默认就装了 python3 与 Quartz(PyObjC),无需额外依赖。
|
|
113
|
-
*
|
|
114
|
-
* 坐标语义:模型给的是截图坐标,先 rescaleToLogical 还原为逻辑像素再用。
|
|
115
|
-
*
|
|
116
|
-
* 滚动方向约定(与 Anthropic computer_20250124 一致):
|
|
117
|
-
* - up : 内容向上 = 滚轮向下推(dy 为负) ← 注意符号
|
|
118
|
-
* - down : 内容向下 = 滚轮向上推(dy 为正)
|
|
119
|
-
* - left/right 同理对水平轴
|
|
120
|
-
*
|
|
121
|
-
* 但 macOS CGEventCreateScrollWheelEvent 的符号约定是:
|
|
122
|
-
* - vertical 正值 = 内容向上(即 "scroll up" 视觉效果)
|
|
123
|
-
* - horizontal 正值 = 内容向左
|
|
124
|
-
* 所以语义直接映射即可,不需要再翻转。
|
|
125
|
-
*/
|
|
126
|
-
export declare function scrollAt(x: number, y: number, scroll_direction: ScrollDirection, scroll_amount: number): Promise<ScrollResult>;
|
|
127
|
-
/**
|
|
128
|
-
* 查询鼠标当前坐标。优先 cliclick p(返回 "x,y"),fallback 到 AppleScript。
|
|
129
|
-
*/
|
|
130
|
-
export declare function getCursorPosition(): Promise<CursorPositionResult>;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { Session } from '../../vendor/cbc-core/node/index.js';
|
|
2
|
-
import { ToolNames } from '../../vendor/cbc-shared/node/index.js';
|
|
3
|
-
import { Logger } from '@genie/telemetry';
|
|
4
|
-
import type { RunContext } from '@openai/agents';
|
|
5
|
-
import { z } from 'zod';
|
|
6
|
-
import { BaseTool } from './base-tool';
|
|
7
|
-
import { Tool, ToolResult } from './tool-protocol';
|
|
8
|
-
declare const ComputerUseParameters: z.ZodObject<{
|
|
9
|
-
action: z.ZodEnum<["screenshot", "left_click", "right_click", "middle_click", "double_click", "triple_click", "mouse_move", "left_click_drag", "type", "key", "hold_key", "scroll", "wait", "cursor_position"]>;
|
|
10
|
-
coordinate: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
11
|
-
start_coordinate: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
12
|
-
text: z.ZodOptional<z.ZodString>;
|
|
13
|
-
scroll_direction: z.ZodOptional<z.ZodEnum<["up", "down", "left", "right"]>>;
|
|
14
|
-
scroll_amount: z.ZodOptional<z.ZodNumber>;
|
|
15
|
-
duration: z.ZodOptional<z.ZodNumber>;
|
|
16
|
-
}, "strip", z.ZodTypeAny, {
|
|
17
|
-
action: "cursor_position" | "double_click" | "hold_key" | "key" | "left_click" | "left_click_drag" | "middle_click" | "mouse_move" | "right_click" | "screenshot" | "scroll" | "triple_click" | "type" | "wait";
|
|
18
|
-
coordinate?: number[] | undefined;
|
|
19
|
-
start_coordinate?: number[] | undefined;
|
|
20
|
-
text?: string | undefined;
|
|
21
|
-
scroll_direction?: "down" | "left" | "right" | "up" | undefined;
|
|
22
|
-
scroll_amount?: number | undefined;
|
|
23
|
-
duration?: number | undefined;
|
|
24
|
-
}, {
|
|
25
|
-
action: "cursor_position" | "double_click" | "hold_key" | "key" | "left_click" | "left_click_drag" | "middle_click" | "mouse_move" | "right_click" | "screenshot" | "scroll" | "triple_click" | "type" | "wait";
|
|
26
|
-
coordinate?: number[] | undefined;
|
|
27
|
-
start_coordinate?: number[] | undefined;
|
|
28
|
-
text?: string | undefined;
|
|
29
|
-
scroll_direction?: "down" | "left" | "right" | "up" | undefined;
|
|
30
|
-
scroll_amount?: number | undefined;
|
|
31
|
-
duration?: number | undefined;
|
|
32
|
-
}>;
|
|
33
|
-
type ComputerUseInput = z.infer<typeof ComputerUseParameters>;
|
|
34
|
-
export declare class ComputerUseTool extends BaseTool implements Tool {
|
|
35
|
-
protected readonly logger: Logger;
|
|
36
|
-
name: ToolNames;
|
|
37
|
-
description: string;
|
|
38
|
-
parameters: z.ZodObject<{
|
|
39
|
-
action: z.ZodEnum<["screenshot", "left_click", "right_click", "middle_click", "double_click", "triple_click", "mouse_move", "left_click_drag", "type", "key", "hold_key", "scroll", "wait", "cursor_position"]>;
|
|
40
|
-
coordinate: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
41
|
-
start_coordinate: z.ZodOptional<z.ZodArray<z.ZodNumber, "many">>;
|
|
42
|
-
text: z.ZodOptional<z.ZodString>;
|
|
43
|
-
scroll_direction: z.ZodOptional<z.ZodEnum<["up", "down", "left", "right"]>>;
|
|
44
|
-
scroll_amount: z.ZodOptional<z.ZodNumber>;
|
|
45
|
-
duration: z.ZodOptional<z.ZodNumber>;
|
|
46
|
-
}, "strip", z.ZodTypeAny, {
|
|
47
|
-
action: "cursor_position" | "double_click" | "hold_key" | "key" | "left_click" | "left_click_drag" | "middle_click" | "mouse_move" | "right_click" | "screenshot" | "scroll" | "triple_click" | "type" | "wait";
|
|
48
|
-
coordinate?: number[] | undefined;
|
|
49
|
-
start_coordinate?: number[] | undefined;
|
|
50
|
-
text?: string | undefined;
|
|
51
|
-
scroll_direction?: "down" | "left" | "right" | "up" | undefined;
|
|
52
|
-
scroll_amount?: number | undefined;
|
|
53
|
-
duration?: number | undefined;
|
|
54
|
-
}, {
|
|
55
|
-
action: "cursor_position" | "double_click" | "hold_key" | "key" | "left_click" | "left_click_drag" | "middle_click" | "mouse_move" | "right_click" | "screenshot" | "scroll" | "triple_click" | "type" | "wait";
|
|
56
|
-
coordinate?: number[] | undefined;
|
|
57
|
-
start_coordinate?: number[] | undefined;
|
|
58
|
-
text?: string | undefined;
|
|
59
|
-
scroll_direction?: "down" | "left" | "right" | "up" | undefined;
|
|
60
|
-
scroll_amount?: number | undefined;
|
|
61
|
-
duration?: number | undefined;
|
|
62
|
-
}>;
|
|
63
|
-
/**
|
|
64
|
-
* 启用条件:必须 macOS 且 env CODEBUDDY_COMPUTER_USE_ENABLED=1/true。
|
|
65
|
-
*/
|
|
66
|
-
private isComputerUseEnabled;
|
|
67
|
-
isEnabled: (_args?: unknown) => Promise<boolean>;
|
|
68
|
-
/**
|
|
69
|
-
* 同步镜像 isEnabled 的 gate,用于 ToolSearch 延迟工具列表可见性过滤。
|
|
70
|
-
* gate 未开时不应出现在 "Available deferred tools" 描述里,避免模型误判此工具可用。
|
|
71
|
-
*/
|
|
72
|
-
shouldShowInToolSearch: () => boolean;
|
|
73
|
-
execute(input: ComputerUseInput, _context?: RunContext<Session>): Promise<ToolResult>;
|
|
74
|
-
/**
|
|
75
|
-
* screenshot 返图:严格照抄 read-tool 形态——读 JPEG base64 → image_url data URI。
|
|
76
|
-
*/
|
|
77
|
-
private formatScreenshot;
|
|
78
|
-
private dispatch;
|
|
79
|
-
/**
|
|
80
|
-
* 非 screenshot action 返 JSON content(string 形态)+ text renderer。
|
|
81
|
-
* rawResponse 保留原始 payload 供 PostToolUse hook 消费。
|
|
82
|
-
*/
|
|
83
|
-
private formatResult;
|
|
84
|
-
private describeAction;
|
|
85
|
-
}
|
|
86
|
-
export {};
|