@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,237 +0,0 @@
|
|
|
1
|
-
import { Workspace } from '@genie/runtime';
|
|
2
|
-
import type { RunContext } from '@openai/agents';
|
|
3
|
-
import { z } from 'zod';
|
|
4
|
-
import { type FunctionCallItem, type ToolExecuteArgument } from '../../vendor/cbc-shared/node/index.js';
|
|
5
|
-
import { AskService } from '../ask';
|
|
6
|
-
import { SdkHooksManager } from '../control-signal/control-signal-protocol';
|
|
7
|
-
import { Session } from '../../vendor/cbc-core/node/index.js';
|
|
8
|
-
import { BaseTool } from './base-tool';
|
|
9
|
-
import { Tool, ToolCallArgumentRenderer, ToolResult } from './tool-protocol';
|
|
10
|
-
import { ToolNames } from '../../vendor/cbc-shared/node/index.js';
|
|
11
|
-
/**
|
|
12
|
-
* Normalize AskUserQuestion input to handle common model mistakes:
|
|
13
|
-
* - Using "answers" field instead of "options"
|
|
14
|
-
* - Passing plain string arrays instead of {label, description} objects
|
|
15
|
-
* - Missing "header" field
|
|
16
|
-
*
|
|
17
|
-
* Call this before passing input to UI layers or tool execution.
|
|
18
|
-
*/
|
|
19
|
-
export declare function normalizeAskUserQuestionInput(input: Record<string, any>): Record<string, any>;
|
|
20
|
-
declare const AskUserQuestionParameters: z.ZodEffects<z.ZodObject<{
|
|
21
|
-
questions: z.ZodArray<z.ZodObject<{
|
|
22
|
-
question: z.ZodString;
|
|
23
|
-
header: z.ZodString;
|
|
24
|
-
options: z.ZodArray<z.ZodObject<{
|
|
25
|
-
label: z.ZodString;
|
|
26
|
-
description: z.ZodString;
|
|
27
|
-
}, "strip", z.ZodTypeAny, {
|
|
28
|
-
label: string;
|
|
29
|
-
description: string;
|
|
30
|
-
}, {
|
|
31
|
-
label: string;
|
|
32
|
-
description: string;
|
|
33
|
-
}>, "many">;
|
|
34
|
-
multiSelect: z.ZodDefault<z.ZodBoolean>;
|
|
35
|
-
}, "strip", z.ZodTypeAny, {
|
|
36
|
-
question: string;
|
|
37
|
-
header: string;
|
|
38
|
-
options: {
|
|
39
|
-
label: string;
|
|
40
|
-
description: string;
|
|
41
|
-
}[];
|
|
42
|
-
multiSelect: boolean;
|
|
43
|
-
}, {
|
|
44
|
-
question: string;
|
|
45
|
-
header: string;
|
|
46
|
-
options: {
|
|
47
|
-
label: string;
|
|
48
|
-
description: string;
|
|
49
|
-
}[];
|
|
50
|
-
multiSelect?: boolean | undefined;
|
|
51
|
-
}>, "many">;
|
|
52
|
-
answers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
53
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
54
|
-
source: z.ZodOptional<z.ZodString>;
|
|
55
|
-
}, "strip", z.ZodTypeAny, {
|
|
56
|
-
source?: string | undefined;
|
|
57
|
-
}, {
|
|
58
|
-
source?: string | undefined;
|
|
59
|
-
}>>;
|
|
60
|
-
}, "strip", z.ZodTypeAny, {
|
|
61
|
-
questions: {
|
|
62
|
-
question: string;
|
|
63
|
-
header: string;
|
|
64
|
-
options: {
|
|
65
|
-
label: string;
|
|
66
|
-
description: string;
|
|
67
|
-
}[];
|
|
68
|
-
multiSelect: boolean;
|
|
69
|
-
}[];
|
|
70
|
-
answers?: Record<string, string> | undefined;
|
|
71
|
-
metadata?: {
|
|
72
|
-
source?: string | undefined;
|
|
73
|
-
} | undefined;
|
|
74
|
-
}, {
|
|
75
|
-
questions: {
|
|
76
|
-
question: string;
|
|
77
|
-
header: string;
|
|
78
|
-
options: {
|
|
79
|
-
label: string;
|
|
80
|
-
description: string;
|
|
81
|
-
}[];
|
|
82
|
-
multiSelect?: boolean | undefined;
|
|
83
|
-
}[];
|
|
84
|
-
answers?: Record<string, string> | undefined;
|
|
85
|
-
metadata?: {
|
|
86
|
-
source?: string | undefined;
|
|
87
|
-
} | undefined;
|
|
88
|
-
}>, {
|
|
89
|
-
questions: {
|
|
90
|
-
question: string;
|
|
91
|
-
header: string;
|
|
92
|
-
options: {
|
|
93
|
-
label: string;
|
|
94
|
-
description: string;
|
|
95
|
-
}[];
|
|
96
|
-
multiSelect: boolean;
|
|
97
|
-
}[];
|
|
98
|
-
answers?: Record<string, string> | undefined;
|
|
99
|
-
metadata?: {
|
|
100
|
-
source?: string | undefined;
|
|
101
|
-
} | undefined;
|
|
102
|
-
}, {
|
|
103
|
-
questions: {
|
|
104
|
-
question: string;
|
|
105
|
-
header: string;
|
|
106
|
-
options: {
|
|
107
|
-
label: string;
|
|
108
|
-
description: string;
|
|
109
|
-
}[];
|
|
110
|
-
multiSelect?: boolean | undefined;
|
|
111
|
-
}[];
|
|
112
|
-
answers?: Record<string, string> | undefined;
|
|
113
|
-
metadata?: {
|
|
114
|
-
source?: string | undefined;
|
|
115
|
-
} | undefined;
|
|
116
|
-
}>;
|
|
117
|
-
export declare class AskUserQuestionTool extends BaseTool implements Tool {
|
|
118
|
-
protected readonly workspace: Workspace;
|
|
119
|
-
protected readonly askService: AskService;
|
|
120
|
-
protected readonly sdkHooksManager: SdkHooksManager;
|
|
121
|
-
name: ToolNames;
|
|
122
|
-
description: string;
|
|
123
|
-
parameters: z.ZodEffects<z.ZodObject<{
|
|
124
|
-
questions: z.ZodArray<z.ZodObject<{
|
|
125
|
-
question: z.ZodString;
|
|
126
|
-
header: z.ZodString;
|
|
127
|
-
options: z.ZodArray<z.ZodObject<{
|
|
128
|
-
label: z.ZodString;
|
|
129
|
-
description: z.ZodString;
|
|
130
|
-
}, "strip", z.ZodTypeAny, {
|
|
131
|
-
label: string;
|
|
132
|
-
description: string;
|
|
133
|
-
}, {
|
|
134
|
-
label: string;
|
|
135
|
-
description: string;
|
|
136
|
-
}>, "many">;
|
|
137
|
-
multiSelect: z.ZodDefault<z.ZodBoolean>;
|
|
138
|
-
}, "strip", z.ZodTypeAny, {
|
|
139
|
-
question: string;
|
|
140
|
-
header: string;
|
|
141
|
-
options: {
|
|
142
|
-
label: string;
|
|
143
|
-
description: string;
|
|
144
|
-
}[];
|
|
145
|
-
multiSelect: boolean;
|
|
146
|
-
}, {
|
|
147
|
-
question: string;
|
|
148
|
-
header: string;
|
|
149
|
-
options: {
|
|
150
|
-
label: string;
|
|
151
|
-
description: string;
|
|
152
|
-
}[];
|
|
153
|
-
multiSelect?: boolean | undefined;
|
|
154
|
-
}>, "many">;
|
|
155
|
-
answers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
156
|
-
metadata: z.ZodOptional<z.ZodObject<{
|
|
157
|
-
source: z.ZodOptional<z.ZodString>;
|
|
158
|
-
}, "strip", z.ZodTypeAny, {
|
|
159
|
-
source?: string | undefined;
|
|
160
|
-
}, {
|
|
161
|
-
source?: string | undefined;
|
|
162
|
-
}>>;
|
|
163
|
-
}, "strip", z.ZodTypeAny, {
|
|
164
|
-
questions: {
|
|
165
|
-
question: string;
|
|
166
|
-
header: string;
|
|
167
|
-
options: {
|
|
168
|
-
label: string;
|
|
169
|
-
description: string;
|
|
170
|
-
}[];
|
|
171
|
-
multiSelect: boolean;
|
|
172
|
-
}[];
|
|
173
|
-
answers?: Record<string, string> | undefined;
|
|
174
|
-
metadata?: {
|
|
175
|
-
source?: string | undefined;
|
|
176
|
-
} | undefined;
|
|
177
|
-
}, {
|
|
178
|
-
questions: {
|
|
179
|
-
question: string;
|
|
180
|
-
header: string;
|
|
181
|
-
options: {
|
|
182
|
-
label: string;
|
|
183
|
-
description: string;
|
|
184
|
-
}[];
|
|
185
|
-
multiSelect?: boolean | undefined;
|
|
186
|
-
}[];
|
|
187
|
-
answers?: Record<string, string> | undefined;
|
|
188
|
-
metadata?: {
|
|
189
|
-
source?: string | undefined;
|
|
190
|
-
} | undefined;
|
|
191
|
-
}>, {
|
|
192
|
-
questions: {
|
|
193
|
-
question: string;
|
|
194
|
-
header: string;
|
|
195
|
-
options: {
|
|
196
|
-
label: string;
|
|
197
|
-
description: string;
|
|
198
|
-
}[];
|
|
199
|
-
multiSelect: boolean;
|
|
200
|
-
}[];
|
|
201
|
-
answers?: Record<string, string> | undefined;
|
|
202
|
-
metadata?: {
|
|
203
|
-
source?: string | undefined;
|
|
204
|
-
} | undefined;
|
|
205
|
-
}, {
|
|
206
|
-
questions: {
|
|
207
|
-
question: string;
|
|
208
|
-
header: string;
|
|
209
|
-
options: {
|
|
210
|
-
label: string;
|
|
211
|
-
description: string;
|
|
212
|
-
}[];
|
|
213
|
-
multiSelect?: boolean | undefined;
|
|
214
|
-
}[];
|
|
215
|
-
answers?: Record<string, string> | undefined;
|
|
216
|
-
metadata?: {
|
|
217
|
-
source?: string | undefined;
|
|
218
|
-
} | undefined;
|
|
219
|
-
}>;
|
|
220
|
-
argumentRenderer: ToolCallArgumentRenderer;
|
|
221
|
-
isEnabled: (args: {
|
|
222
|
-
runContext: RunContext<Session>;
|
|
223
|
-
}) => boolean;
|
|
224
|
-
needsApproval: (_runContext: RunContext<Session>, input: ToolExecuteArgument<any>, _callId?: string) => Promise<boolean>;
|
|
225
|
-
execute(input: z.infer<typeof AskUserQuestionParameters>, context?: RunContext<Session>, details?: {
|
|
226
|
-
toolCall: FunctionCallItem;
|
|
227
|
-
}): Promise<ToolResult>;
|
|
228
|
-
/**
|
|
229
|
-
* 把 execute 捕获的异常映射到结构化错误码:
|
|
230
|
-
* - ToolExecutionError:保留其码(missing toolCallId=19201 / no answers=19202)
|
|
231
|
-
* - acquireAnswers 超时('timed out')→ ToolTimeoutError(90003)
|
|
232
|
-
* - 中断/abort('Aborted')→ ToolCancelledError(90004)
|
|
233
|
-
* - 其余(rejectAsk 的 'User declined')→ AskFollowupUserDeclinedError(19204)
|
|
234
|
-
*/
|
|
235
|
-
private resolveAskErrorCode;
|
|
236
|
-
}
|
|
237
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export declare const ASK_USER_QUESTION_SHAPE_HINT = "Expected shape: {\"questions\": [{\"question\": \"...\", \"header\": \"...\", \"options\": [{\"label\": \"...\", \"description\": \"...\"}, {\"label\": \"...\", \"description\": \"...\"}]}]}.";
|
|
2
|
-
/**
|
|
3
|
-
* Copy-paste payload for REPL / Code Mode. Catalog schema collapses `questions`
|
|
4
|
-
* to `object`; without this the model returns a placeholder string instead of
|
|
5
|
-
* calling the sandbox global.
|
|
6
|
-
*/
|
|
7
|
-
export declare const ASK_USER_QUESTION_CALL_EXAMPLE = "AskUserQuestion({ questions: [{ question: \"Which approach?\", header: \"Approach\", options: [{ label: \"Explore first\", description: \"Read the code\" }, { label: \"Try it\", description: \"Run the CLI\" }] }] })";
|
|
8
|
-
/**
|
|
9
|
-
* Validate AskUserQuestion params before normalization / UI rendering.
|
|
10
|
-
*
|
|
11
|
-
* Enforces only required fields, types, >= 1 non-empty option label, and
|
|
12
|
-
* unique question texts / option labels (both are answer-map keys). Count /
|
|
13
|
-
* length limits (minItems >= 2, maxItems, maxLength) are NOT enforced — per
|
|
14
|
-
* issue #63973 they aren't runtime constraints, so blocking rejects valid
|
|
15
|
-
* calls (e.g. a single-option question).
|
|
16
|
-
*
|
|
17
|
-
* Multiple issues are aggregated (Read-tool error format) so the model can fix
|
|
18
|
-
* everything in one round-trip.
|
|
19
|
-
*
|
|
20
|
-
* @returns the error message, or `undefined` when params are valid.
|
|
21
|
-
*/
|
|
22
|
-
export declare function validateAskUserQuestionParams(input: any): string | undefined;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { PromptManager } from '@genie/prompts';
|
|
2
|
-
import { AutoModeSettings } from '../../settings';
|
|
3
|
-
import { AutoModeRules } from './auto-mode-protocol';
|
|
4
|
-
import { AutoModeSystemPromptBuilder } from './auto-mode-system-prompt-builder';
|
|
5
|
-
export declare const AutoModeCritiqueClient: unique symbol;
|
|
6
|
-
/** True if any section has a custom entry beyond the `$defaults` token (Claude `is6`). */
|
|
7
|
-
export declare function hasCustomRules(raw: AutoModeSettings | undefined): boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Runs the auto mode rule critique (read-only).
|
|
10
|
-
*
|
|
11
|
-
* Implementation: spawns a standard `codebuddy -p` (print/headless) subprocess.
|
|
12
|
-
* This reuses the project's canonical "cold-start, run once, exit" path — the
|
|
13
|
-
* child waits for its own runtime to be fully ready, so the critique command
|
|
14
|
-
* never races agent registration during startup (which a direct in-process
|
|
15
|
-
* `runOneTime` would, since this runs from a short-lived dispatch strategy).
|
|
16
|
-
*
|
|
17
|
-
* Prompt / context assembly is aligned with Claude Code 2.1.179 `MIT`/`rs6`:
|
|
18
|
-
* - system prompt = the "expert reviewer" critique instructions template
|
|
19
|
-
* - the user message embeds the FULL classifier system prompt plus the user's
|
|
20
|
-
* custom rules, each section annotated as replacing or extending the defaults
|
|
21
|
-
* - only the user's CUSTOM rules are reviewed (the strategy gates on
|
|
22
|
-
* `hasCustomRules` before calling this)
|
|
23
|
-
*
|
|
24
|
-
* Does not participate in permission decisions.
|
|
25
|
-
*/
|
|
26
|
-
export declare class AutoModeCritiqueClientImpl {
|
|
27
|
-
protected readonly systemPromptBuilder: AutoModeSystemPromptBuilder;
|
|
28
|
-
protected readonly promptManager: PromptManager;
|
|
29
|
-
/**
|
|
30
|
-
* @param resolved effective rules after `$defaults` expansion — used to render
|
|
31
|
-
* the classifier system prompt the critique reviews against.
|
|
32
|
-
* @param raw merged-but-unexpanded custom rules (`$defaults` preserved) —
|
|
33
|
-
* used to show only the user's own entries with replace/extend
|
|
34
|
-
* annotations.
|
|
35
|
-
*/
|
|
36
|
-
critique(resolved: AutoModeRules, raw: AutoModeSettings): Promise<string>;
|
|
37
|
-
/** Load the critique "expert reviewer" system prompt template text. */
|
|
38
|
-
private loadCritiqueSystemPrompt;
|
|
39
|
-
/**
|
|
40
|
-
* Spawn `codebuddy -p --model lite --system-prompt <critique> -` with the
|
|
41
|
-
* critique user message on stdin, and return the printed text.
|
|
42
|
-
*/
|
|
43
|
-
private runPrintSubprocess;
|
|
44
|
-
protected buildCritiqueInput(resolved: AutoModeRules, raw: AutoModeSettings): Promise<string>;
|
|
45
|
-
/**
|
|
46
|
-
* Format one section's custom rules, noting whether they extend (contain
|
|
47
|
-
* `$defaults`) or replace the built-in defaults. Mirrors Claude `rs6`.
|
|
48
|
-
* Returns '' when the section has no custom entries.
|
|
49
|
-
*/
|
|
50
|
-
private formatSection;
|
|
51
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { RunContext, ToolExecuteArgument } from '../../../vendor/cbc-shared/node/index.js';
|
|
2
|
-
import { Session } from '../../../vendor/cbc-core/node/index.js';
|
|
3
|
-
import { PermissionMode } from '../../../vendor/cbc-shared/node/index.js';
|
|
4
|
-
import { SettingsManager } from '../../settings';
|
|
5
|
-
import { BaseTool } from '../base-tool';
|
|
6
|
-
import { ToolArg } from '../../../vendor/cbc-shared/node/index.js';
|
|
7
|
-
import { ToolPermissionStrategy } from '../tool-protocol';
|
|
8
|
-
/**
|
|
9
|
-
* Auto permission strategy — deterministic fast paths only.
|
|
10
|
-
*
|
|
11
|
-
* 1. acceptEdits fast path: anything acceptEdits would auto-allow, auto allows too.
|
|
12
|
-
* 2. safe tool allowlist: read-only / metadata built-ins auto-allow.
|
|
13
|
-
* 3. everything else returns `ask` → the service's unified outlet routes it into
|
|
14
|
-
* the classifier (AutoModePermissionService). The classifier call deliberately
|
|
15
|
-
* lives outside the strategy so the permission chain stays synchronous/testable.
|
|
16
|
-
*/
|
|
17
|
-
export declare class ToolPermissionAutoStrategy implements ToolPermissionStrategy {
|
|
18
|
-
mode: PermissionMode;
|
|
19
|
-
protected readonly settingsManager: SettingsManager;
|
|
20
|
-
needApproval(tool: BaseTool, runContext: RunContext<Session>, input: ToolExecuteArgument<any>, checkArgs: ToolArg[], callId?: string): Promise<boolean>;
|
|
21
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export * from './auto-mode-protocol';
|
|
2
|
-
export * from './permission-mode-policy';
|
|
3
|
-
export * from './auto-mode-timeout';
|
|
4
|
-
export * from './auto-mode-defaults';
|
|
5
|
-
export * from './auto-mode-allow-filter';
|
|
6
|
-
export * from './auto-mode-denial-tracker';
|
|
7
|
-
export * from './auto-mode-settings';
|
|
8
|
-
export * from './auto-mode-project-instructions';
|
|
9
|
-
export * from './auto-mode-system-prompt-builder';
|
|
10
|
-
export * from './auto-mode-transcript';
|
|
11
|
-
export * from './auto-mode-transcript-limit';
|
|
12
|
-
export * from './auto-mode-classifier-client';
|
|
13
|
-
export * from './auto-mode-critique-client';
|
|
14
|
-
export * from './auto-mode-permission-service';
|
|
15
|
-
export * from './auto-mode-strategy';
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 后台任务文件 fd 模式下,给一个 task 分配一对 stdout/stderr 文件 + fd。
|
|
3
|
-
*
|
|
4
|
-
* 抽离成独立 module 而不是 BashTool 的 private 方法,是为了:
|
|
5
|
-
* - **可测试性**:单测里可以注入 fake `dirProvider`、监控 fd 是否泄漏,不用 mock 整个 IoC
|
|
6
|
-
* - **跨平台关注点集中**:Windows 上 numeric flags 经 libuv 可能 EINVAL(已用字符串 'w' 兜底),
|
|
7
|
-
* O_NOFOLLOW 在 Windows 不存在(用 `?? 0` 兜底),mode 0o700 在 NTFS 是 no-op……
|
|
8
|
-
* 所有这些 footgun 集中在这里
|
|
9
|
-
*/
|
|
10
|
-
/** 单个 task 的 stdout/stderr 文件 + 父侧 fd(spawn 完调用方应立即关 fd)。 */
|
|
11
|
-
export interface BackgroundOutputFiles {
|
|
12
|
-
stdoutPath: string;
|
|
13
|
-
stderrPath: string;
|
|
14
|
-
/** 父侧 fd,调用方负责在 spawn 之后立刻 close(child 已 dup 自己的副本)。 */
|
|
15
|
-
stdoutFd: number;
|
|
16
|
-
stderrFd: number;
|
|
17
|
-
}
|
|
18
|
-
export interface PrepareBackgroundOutputFilesOptions {
|
|
19
|
-
/** task id,作为文件名前缀(`{taskId}.stdout.log` / `{taskId}.stderr.log`)。 */
|
|
20
|
-
taskId: string;
|
|
21
|
-
/**
|
|
22
|
-
* 输出目录提供者。生产代码传 `() => PathUtils.getSessionBgTasksDir(sessionId)`,
|
|
23
|
-
* 测试代码可传一个 mkdtemp 出来的临时目录。
|
|
24
|
-
*/
|
|
25
|
-
dirProvider: () => string;
|
|
26
|
-
/**
|
|
27
|
-
* 是否在 Windows 平台。默认 `process.platform === 'win32'`;
|
|
28
|
-
* 测试可显式传值绕开真实平台判断,从而在 macOS 上验证 Windows 分支的 flags 选择。
|
|
29
|
-
*/
|
|
30
|
-
isWindows?: boolean;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* 创建文件并返回 fd。**spawn 完成后调用方必须立即关 fd**,否则父进程持有写端
|
|
34
|
-
* 会让"子进程退出 → 文件 EOF"的语义出问题(虽然在文件 fd 模式下 EOF 不重要,
|
|
35
|
-
* 但 fd 泄漏永远是个风险)。
|
|
36
|
-
*
|
|
37
|
-
* 失败时抛错;调用方应捕获并回退到 pipe 模式。
|
|
38
|
-
*/
|
|
39
|
-
export declare function prepareBackgroundOutputFiles(options: PrepareBackgroundOutputFilesOptions): Promise<BackgroundOutputFiles>;
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import type { TruncateBuffer } from '../shell';
|
|
2
|
-
/**
|
|
3
|
-
* 把后台任务的 stdout/stderr 落盘文件按增量同步到内存 TruncateBuffer。
|
|
4
|
-
*
|
|
5
|
-
* 后台任务路径下,子进程的 stdout/stderr 直接写文件 fd(不通过父进程 pipe),
|
|
6
|
-
* 这样孙进程(nohup/守护脚本等)即使继承 fd 也不会卡父进程的 EOF。但 codebuddy
|
|
7
|
-
* 现有的 UI(bash-output-section.tsx)和 TaskOutput 工具都消费 BackgroundTask
|
|
8
|
-
* 上的 TruncateBuffer,所以需要这个 poller 把文件增量回填到 buffer,保持契约不变。
|
|
9
|
-
*
|
|
10
|
-
* 实现要点:
|
|
11
|
-
* - 500ms 一次 stat + 增量 read,offset 单调递增
|
|
12
|
-
* - 单次 tick 最多读 1MB,超过则下次 tick 继续追,不阻塞
|
|
13
|
-
* - {@link drain} 在子进程退出后调用一次,把最后的尾巴读完
|
|
14
|
-
* - {@link stop} 仅停定时器,不删文件(清理由 tool-manager 在 session 结束时统一做)
|
|
15
|
-
*/
|
|
16
|
-
export interface BackgroundOutputTailPollerOptions {
|
|
17
|
-
/** 每次 stat + read 间隔,默认 500ms。 */
|
|
18
|
-
intervalMs?: number;
|
|
19
|
-
/** 单次 tick 读取上限,默认 1MB。文件超大时分多次 tick 追上来。 */
|
|
20
|
-
readChunkLimit?: number;
|
|
21
|
-
/** poller 内部 stat/read 失败的日志钩子(可选)。 */
|
|
22
|
-
onError?: (where: 'stat' | 'read', error: unknown) => void;
|
|
23
|
-
/**
|
|
24
|
-
* 每次成功读到新增内容时的回调(增量文本,与 `buffer.push` 同一份数据)。
|
|
25
|
-
*
|
|
26
|
-
* 仅用于需要"增量触发响应"的场景(如 MonitorTool 的反应式推送,issue #74426);
|
|
27
|
-
* BashTool/PowerShellTool 的常规后台任务不传,行为不变——buffer 仍是唯一契约。
|
|
28
|
-
*/
|
|
29
|
-
onChunk?: (chunk: string) => void;
|
|
30
|
-
/**
|
|
31
|
-
* 同 {@link onChunk},但交出的是**未经解码的原始字节**。
|
|
32
|
-
*
|
|
33
|
-
* 为什么必须单独开一条回调而不复用 `onChunk`:`onChunk` 拿到的是本 tick 按 utf-8
|
|
34
|
-
* 解码后的字符串,而读取边界落在任意字节位置,跨 tick 的多字节字符会被切坏成
|
|
35
|
-
* U+FFFD(见 tickOnce 里的说明)。把那个字符串再编码回字节,等于把损坏**固化**下来,
|
|
36
|
-
* 接收端无论怎么保留解析状态都救不回来。
|
|
37
|
-
*
|
|
38
|
-
* ACP v2 的 `terminal_output_chunk` 要求 base64 的是原始字节流,正是为了容纳
|
|
39
|
-
* 「分片切断 UTF-8 码点」这种情况——由客户端的终端模拟器跨 chunk 保留解析状态去还原。
|
|
40
|
-
* 所以推送链路必须消费本回调,不能走 `onChunk`。
|
|
41
|
-
*
|
|
42
|
-
* 传入的 Buffer 是本次读取缓冲区的 subarray(零拷贝视图),**回调必须同步消费完**:
|
|
43
|
-
* 本方法返回后 poller 不再持有它,但调用方若要跨 tick 留存必须自己复制。
|
|
44
|
-
*/
|
|
45
|
-
onChunkBytes?: (chunk: Buffer) => void;
|
|
46
|
-
}
|
|
47
|
-
export interface BackgroundOutputTailPoller {
|
|
48
|
-
/** 立即触发一次同步(用于子进程退出后的最终 drain)。 */
|
|
49
|
-
drain(): Promise<void>;
|
|
50
|
-
/** 停止定时器;幂等,重复调用安全。 */
|
|
51
|
-
stop(): void;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* 启动一个文件 tail poller,把 `filePath` 的新内容追加到 `buffer`。
|
|
55
|
-
*
|
|
56
|
-
* @param filePath 要追踪的文件路径(可能尚未创建,poller 会容忍 ENOENT)
|
|
57
|
-
* @param buffer 接收增量数据的 buffer
|
|
58
|
-
* @param options 可选配置
|
|
59
|
-
*/
|
|
60
|
-
export declare function startBackgroundOutputTailPoller(filePath: string, buffer: TruncateBuffer, options?: BackgroundOutputTailPollerOptions): BackgroundOutputTailPoller;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import type { RunContext } from '@openai/agents';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { Session } from '../../vendor/cbc-core/node/index.js';
|
|
4
|
-
import { BaseTool } from './base-tool';
|
|
5
|
-
import { Tool } from './tool-protocol';
|
|
6
|
-
import { ToolNames } from '../../vendor/cbc-shared/node/index.js';
|
|
7
|
-
declare const BashOutputParameters: z.ZodObject<{
|
|
8
|
-
shell_id: z.ZodString;
|
|
9
|
-
filter: z.ZodOptional<z.ZodString>;
|
|
10
|
-
}, "strip", z.ZodTypeAny, {
|
|
11
|
-
shell_id: string;
|
|
12
|
-
filter?: string | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
shell_id: string;
|
|
15
|
-
filter?: string | undefined;
|
|
16
|
-
}>;
|
|
17
|
-
export declare class BashOutputTool extends BaseTool implements Tool {
|
|
18
|
-
name: ToolNames;
|
|
19
|
-
aliases: string[];
|
|
20
|
-
needsApproval: boolean;
|
|
21
|
-
parameters: z.ZodObject<{
|
|
22
|
-
shell_id: z.ZodString;
|
|
23
|
-
filter: z.ZodOptional<z.ZodString>;
|
|
24
|
-
}, "strip", z.ZodTypeAny, {
|
|
25
|
-
shell_id: string;
|
|
26
|
-
filter?: string | undefined;
|
|
27
|
-
}, {
|
|
28
|
-
shell_id: string;
|
|
29
|
-
filter?: string | undefined;
|
|
30
|
-
}>;
|
|
31
|
-
execute(input: z.infer<typeof BashOutputParameters>, context: RunContext<Session>): Promise<any>;
|
|
32
|
-
private formatDuration;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Logger } from '@celljs/core';
|
|
2
|
-
import { Session } from '../../vendor/cbc-core/node/index.js';
|
|
3
|
-
import { FunctionCallItem } from '../../vendor/cbc-shared/node/index.js';
|
|
4
|
-
import type { RunContext } from '@openai/agents';
|
|
5
|
-
import { type SandboxApprovalRequest, type SandboxApprovalRequester } from '../permission';
|
|
6
|
-
/**
|
|
7
|
-
* Session-related context required to surface a sandbox approval request.
|
|
8
|
-
*
|
|
9
|
-
* This mirrors `BashToolSessionInfo` in `bash-tool.ts`; we accept the minimal
|
|
10
|
-
* subset (`runContext` + `details.toolCall`) that the requester actually needs,
|
|
11
|
-
* so the tool side keeps the wider type for its other call paths.
|
|
12
|
-
*/
|
|
13
|
-
export interface SandboxApprovalRequesterContext {
|
|
14
|
-
runContext: RunContext<Session>;
|
|
15
|
-
details?: {
|
|
16
|
-
toolCall: FunctionCallItem;
|
|
17
|
-
};
|
|
18
|
-
/** Tool name shown by the shared sandbox approval UI. Defaults to Bash. */
|
|
19
|
-
toolName?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Build a SandboxApprovalRequester that surfaces SandboxOrchestrator approval
|
|
23
|
-
* prompts through the standard InterruptionService flow.
|
|
24
|
-
*
|
|
25
|
-
* Behavior (unchanged from the original inline implementation in BashTool):
|
|
26
|
-
*
|
|
27
|
-
* 1. Unrestricted sessions (`fullAccess`, or bypass + `CODEBUDDY_IS_SANDBOX`)
|
|
28
|
-
* auto-allow every sandbox approval, including HIGH/CRITICAL and
|
|
29
|
-
* sandbox policy-classified / 安全中心 ask-list requests. `disableBypassPermissionsMode`
|
|
30
|
-
* still blocks the CLI bypass path.
|
|
31
|
-
* 2. sandbox policy-classified requests skip the legacy `CommandUtils.checkCommandSafety`
|
|
32
|
-
* auto-approval and always surface the UI — sandbox policy is more precise.
|
|
33
|
-
* 3. In Bypass permission mode, non-HIGH/CRITICAL commands are auto-approved
|
|
34
|
-
* without surfacing the UI (mirrors tool-permission-service Phase 5).
|
|
35
|
-
* 4. Otherwise we synthesise a `RunToolApprovalItem` carrying a `_sandboxResolve`
|
|
36
|
-
* callback in `providerData`, push it through InterruptionService (or fall
|
|
37
|
-
* back to direct `interruptionSubject.next`), and resolve when the user picks.
|
|
38
|
-
*
|
|
39
|
-
* The InterruptionService is resolved **once** at the top of each request: it's
|
|
40
|
-
* a singleton DI service whose identity does not change during a sandbox
|
|
41
|
-
* approval, so per-branch lookups would just be noise. If DI is unavailable we
|
|
42
|
-
* degrade to direct-push fallback for every branch in this request.
|
|
43
|
-
*/
|
|
44
|
-
export declare function createSandboxApprovalRequester(logger: Logger, sessionInfo?: SandboxApprovalRequesterContext, abortSignal?: AbortSignal): SandboxApprovalRequester;
|
|
45
|
-
export declare function buildSandboxApprovalItem(request: SandboxApprovalRequest, toolCall: FunctionCallItem, settle: (choice: 'allow_once' | 'allow_session' | 'deny') => void, toolName: string, options?: {
|
|
46
|
-
displayCommand?: string;
|
|
47
|
-
describeSensitiveCommand?: boolean;
|
|
48
|
-
}): any;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Windows-specific security checker for the Bash tool.
|
|
3
|
-
*
|
|
4
|
-
* On Windows, the Bash tool runs inside Git Bash (MSYS2) which can invoke
|
|
5
|
-
* any Windows executable directly. This creates a cross-tool bypass:
|
|
6
|
-
* commands that would be BLOCKed by checkPowerShellSecurity() if sent
|
|
7
|
-
* through the PowerShell tool execute unimpeded through the Bash tool.
|
|
8
|
-
*
|
|
9
|
-
* This module applies a focused set of BLOCK rules that detect the
|
|
10
|
-
* PowerShell / cmd / LOLBin invocation patterns described in issue #42605.
|
|
11
|
-
*
|
|
12
|
-
* Design principles:
|
|
13
|
-
* - Only active on Windows (process.platform === 'win32')
|
|
14
|
-
* - Does NOT duplicate all of checkPowerShellSecurity (different syntax)
|
|
15
|
-
* - Targets the "cross-chain" escape: Bash → Windows executable
|
|
16
|
-
* - Read-only subcommands (reg query, sc query, schtasks /Query) are
|
|
17
|
-
* not blocked — only write/create/execute actions
|
|
18
|
-
* - wsl.exe 已移至 SystemToolPolicy 统一管控(见 sandbox-orchestrator.ts)
|
|
19
|
-
* - Normal Unix commands (ls, git, grep, etc.) are unaffected
|
|
20
|
-
*/
|
|
21
|
-
export type SecurityBehavior = 'allow' | 'ask' | 'block';
|
|
22
|
-
export interface SecurityCheckResult {
|
|
23
|
-
/** Whether the command is safe to run */
|
|
24
|
-
behavior: SecurityBehavior;
|
|
25
|
-
/** Human-readable reason for the decision */
|
|
26
|
-
reason?: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Check whether a command submitted to the Bash tool on Windows invokes
|
|
30
|
-
* dangerous Windows executables that would bypass PowerShell security.
|
|
31
|
-
*
|
|
32
|
-
* On non-Windows platforms, always returns `{ behavior: 'allow' }`.
|
|
33
|
-
*/
|
|
34
|
-
export declare function checkBashSecurityWindows(command: string): SecurityCheckResult;
|