@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,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unwrap human-formatted tool `content` into a value the REPL sandbox can use
|
|
3
|
-
* as data. Direct LLM tool results stay as display text; only this boundary
|
|
4
|
-
* (broker.callTool → worker) should reshape them.
|
|
5
|
-
*
|
|
6
|
-
* The live failure this exists for: models write `const r = await Bash(...)`
|
|
7
|
-
* then read `r.stdout`, get undefined, and burn turns writing a regex parser
|
|
8
|
-
* for `Command:` / `Stdout:` / `Stderr:` blocks (and for Read's ` 1→` prefix).
|
|
9
|
-
*/
|
|
10
|
-
import type { BridgeImage } from './repl-protocol';
|
|
11
|
-
export interface SandboxShellResult {
|
|
12
|
-
stdout: string;
|
|
13
|
-
stderr: string;
|
|
14
|
-
exitCode: number | null;
|
|
15
|
-
signal: string | null;
|
|
16
|
-
}
|
|
17
|
-
/** 骨架目录里写在 `Name(params)` 后面的返回值,不被 SUMMARY_MAX_CHARS 截断。 */
|
|
18
|
-
export declare function sandboxReturnAnnotation(toolName: string): string | undefined;
|
|
19
|
-
export declare function toSandboxToolResult(toolName: string, toolResult: {
|
|
20
|
-
content?: unknown;
|
|
21
|
-
rawResponse?: unknown;
|
|
22
|
-
renderer?: {
|
|
23
|
-
type?: string;
|
|
24
|
-
value?: unknown;
|
|
25
|
-
};
|
|
26
|
-
}): unknown;
|
|
27
|
-
/**
|
|
28
|
-
* Broker → worker 的回包。TaskOutput 在「任务不存在」时仍带 `error`,
|
|
29
|
-
* 但不能因此丢掉 `status`:worker 对非 Agent 错误原样 `{ error }`,
|
|
30
|
-
* 模型会写 `r.status || "done"` 把 unknown 当成完成。
|
|
31
|
-
*/
|
|
32
|
-
export declare function sandboxToolCallReply(toolName: string, toolResult: {
|
|
33
|
-
content?: unknown;
|
|
34
|
-
error?: string;
|
|
35
|
-
rawResponse?: unknown;
|
|
36
|
-
renderer?: {
|
|
37
|
-
type?: string;
|
|
38
|
-
value?: unknown;
|
|
39
|
-
};
|
|
40
|
-
}): {
|
|
41
|
-
result?: unknown;
|
|
42
|
-
error?: string;
|
|
43
|
-
};
|
|
44
|
-
/** Read 图的 content:`[{ type:"image_url", image_url:{ url:"data:image/..." } }]`。 */
|
|
45
|
-
export declare function parseImageToolContent(content: string): unknown | undefined;
|
|
46
|
-
export declare function splitCellImages(value: unknown): {
|
|
47
|
-
result: unknown;
|
|
48
|
-
images: BridgeImage[];
|
|
49
|
-
};
|
|
50
|
-
/**
|
|
51
|
-
* 人读的执行详情文本,供工具结果行的 renderer 展示(可折叠、ctrl+o 展开)。
|
|
52
|
-
*
|
|
53
|
-
* 与 {@link buildReplToolContent} 分工明确:后者产出**模型面**的结构化 JSON
|
|
54
|
-
* (`{ result, stdout, stderr }`,供沙箱/模型索引),这里产出**人面**的纯文本。
|
|
55
|
-
* 优先级:error > 返回值 > stdout,末尾附 stderr。图片一律脱敏/剔除(base64 不进
|
|
56
|
-
* 展示文本,图片走 content 数组的 image_url 单独渲染)。无任何输出时返回空串,
|
|
57
|
-
* 由调用方决定占位(如只显示耗时)。
|
|
58
|
-
*/
|
|
59
|
-
export declare function buildReplDisplayText(out: {
|
|
60
|
-
result?: unknown;
|
|
61
|
-
stdout: string;
|
|
62
|
-
stderr: string;
|
|
63
|
-
error?: string;
|
|
64
|
-
}): string;
|
|
65
|
-
/**
|
|
66
|
-
* 把 REPL 返回值压成文本,供模型面截断判定与落盘复用。
|
|
67
|
-
*
|
|
68
|
-
* - string 原样返回;
|
|
69
|
-
* - 其余(多为结构化 JSON)压成**紧凑**序列化文本——模型面要控制 token,
|
|
70
|
-
* 与 `buildReplDisplayText` 的 pretty JSON(人面)刻意不同。
|
|
71
|
-
* - JSON.stringify 失败(如 cyclic)时退化为 String(result)。
|
|
72
|
-
*
|
|
73
|
-
* 截断只发生在主线程的模型面组装(buildReplToolContent);沙箱内模型代码拿到的
|
|
74
|
-
* 仍是完整返回值,人面展示也走完整 result,互不影响。
|
|
75
|
-
*/
|
|
76
|
-
export declare function replResultToText(result: unknown): string;
|
|
77
|
-
/**
|
|
78
|
-
* REPL 出参。有图则走 read-tool 同款 image_url 数组,避免把 base64 再塞进 result 文本。
|
|
79
|
-
*/
|
|
80
|
-
export declare function buildReplToolContent(out: {
|
|
81
|
-
result?: unknown;
|
|
82
|
-
stdout: string;
|
|
83
|
-
stderr: string;
|
|
84
|
-
error?: string;
|
|
85
|
-
images: BridgeImage[];
|
|
86
|
-
}): string;
|
|
87
|
-
export declare function parseShellFormatted(content: string, rawResponse?: unknown): SandboxShellResult | undefined;
|
|
88
|
-
export declare function stripReadLineNumbers(content: string): string;
|
|
89
|
-
export interface SandboxAgentSpawnResult {
|
|
90
|
-
taskId: string;
|
|
91
|
-
id: string;
|
|
92
|
-
name?: string;
|
|
93
|
-
agentId?: string;
|
|
94
|
-
}
|
|
95
|
-
/** Background Agent() returns labeled text to the LLM; sandbox wants `r.taskId`. */
|
|
96
|
-
export declare function parseAgentSpawn(content: string): SandboxAgentSpawnResult | undefined;
|
|
97
|
-
export interface SandboxTaskOutputResult {
|
|
98
|
-
status: string;
|
|
99
|
-
taskId?: string;
|
|
100
|
-
content: string;
|
|
101
|
-
result?: unknown;
|
|
102
|
-
error?: string;
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* TaskOutput 对人读是 `Status: running` 文本;沙箱要的是 `r.status`。
|
|
106
|
-
* 缺这个字段时模型会写 `r.status || "done"`,把还在跑的 teammate 当成完成。
|
|
107
|
-
*/
|
|
108
|
-
export declare function parseTaskOutput(content: string, renderer?: {
|
|
109
|
-
type?: string;
|
|
110
|
-
value?: unknown;
|
|
111
|
-
}): SandboxTaskOutputResult;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* REPLTool —— 模型面唯一入口:写 JS、import WorkBuddy 桥来编排。
|
|
3
|
-
*
|
|
4
|
-
* 见 docs/repl-code-mode/architecture.md。
|
|
5
|
-
* - 暴露面:1 个工具;能力经 `await import("@wb/...")` 桥,不做直连工具、暂不给 tools.*。
|
|
6
|
-
* - 执行委托 REPLWorkerManager(每 session 常驻 kernel = cell,状态跨调用存活)。
|
|
7
|
-
* - 高权限:能触达桥,needsApproval=true;必须投影 code 给 auto 分类器(否则静默放行)。
|
|
8
|
-
* - feature-gate:CODEBUDDY_REPL_ENABLED。
|
|
9
|
-
*/
|
|
10
|
-
import { Session, type SessionManager as ISessionManager } from '../../../vendor/cbc-core/node/index.js';
|
|
11
|
-
import { type FunctionCallItem, ToolArg, ToolNames } from '../../../vendor/cbc-shared/node/index.js';
|
|
12
|
-
import { Logger } from '@genie/telemetry';
|
|
13
|
-
import type { RunContext } from '@openai/agents';
|
|
14
|
-
import { z } from 'zod';
|
|
15
|
-
import { ToolResultBlobService } from '../../blob-store/tool-result-blob-service';
|
|
16
|
-
import { BaseTool } from '../base-tool';
|
|
17
|
-
import { type ShellStreamPusherService } from '../shell-stream-pusher';
|
|
18
|
-
import { Tool, ToolCallArgumentRenderer, ToolManager, ToolResult } from '../tool-protocol';
|
|
19
|
-
import { ReplCatalogSource } from './repl-catalog-protocol';
|
|
20
|
-
import { REPLWorkerManager } from './repl-protocol';
|
|
21
|
-
/**
|
|
22
|
-
* 入参形状。运行时 schema 由 `parameters()` 动态生成(要把骨架目录拼进 code 描述),
|
|
23
|
-
* 这里只声明 `execute` 的入参类型——两处字段必须保持一致。
|
|
24
|
-
*/
|
|
25
|
-
interface ReplToolInput {
|
|
26
|
-
code: string;
|
|
27
|
-
timeout?: number;
|
|
28
|
-
description?: string;
|
|
29
|
-
}
|
|
30
|
-
export declare class REPLTool extends BaseTool implements Tool {
|
|
31
|
-
protected readonly logger: Logger;
|
|
32
|
-
protected readonly shellStreamPusher: ShellStreamPusherService;
|
|
33
|
-
protected readonly workers: REPLWorkerManager;
|
|
34
|
-
protected readonly catalogSource: ReplCatalogSource;
|
|
35
|
-
protected readonly sessionManager?: ISessionManager;
|
|
36
|
-
protected readonly toolManager?: ToolManager;
|
|
37
|
-
protected readonly toolResultBlobService?: ToolResultBlobService;
|
|
38
|
-
name: ToolNames;
|
|
39
|
-
readonly promptCacheStability: 'volatile';
|
|
40
|
-
description: string;
|
|
41
|
-
/**
|
|
42
|
-
* 动态 schema:把骨架目录注入 `code` 参数描述,让模型写 code 前就知道有哪些工具
|
|
43
|
-
* 及其参数形状(一次写对、不盲写)。ToolManager.get() 在 parameters 是函数时会
|
|
44
|
-
* 调用它并转成 JSON Schema,且把正在构建的 agent 传进来。
|
|
45
|
-
*
|
|
46
|
-
* **异常必须自吞**:ToolManager 对 parameters() 抛错的兜底是把 parameters 置为
|
|
47
|
-
* undefined,那对 REPL 是灾难(没有 code 参数就完全不可用)。所以采集失败一律
|
|
48
|
-
* 降级为"无目录但可用"。
|
|
49
|
-
*/
|
|
50
|
-
parameters: (agentConfig?: {
|
|
51
|
-
name?: string;
|
|
52
|
-
}) => Promise<z.ZodTypeAny>;
|
|
53
|
-
argumentRenderer: ToolCallArgumentRenderer;
|
|
54
|
-
isEnabled: (args?: unknown) => Promise<boolean>;
|
|
55
|
-
/** 必须 override:REPL 能跑桥(含高权限),auto 模式不能静默放行。投影 code 给分类器。 */
|
|
56
|
-
toAutoClassifierInput(input: unknown): string;
|
|
57
|
-
resolveNeedPermissionArgs(_rc: RunContext, input: unknown): ToolArg[];
|
|
58
|
-
execute(input: ReplToolInput, context?: RunContext<Session>, details?: {
|
|
59
|
-
toolCall: FunctionCallItem;
|
|
60
|
-
}): Promise<ToolResult>;
|
|
61
|
-
/**
|
|
62
|
-
* details.toolCall.callId 缺失时(部分非交互路径),从 session.history 倒序反查本次 REPL
|
|
63
|
-
* function_call 的 callId——对齐 bash 的 findCallId。拿到与 UI 侧 function_call_group 一致
|
|
64
|
-
* 的 callId,流式进度帧才能就地并入同一条工具结果,而不是在对话流里堆积孤立行(issue #101579)。
|
|
65
|
-
* 用 code 精确匹配,避免命中同一会话里更早的 REPL 调用。
|
|
66
|
-
*/
|
|
67
|
-
private findReplCallId;
|
|
68
|
-
/**
|
|
69
|
-
* 推一条聚合流式进度到 UI(复用 bash 的 `function_call_result` + `isStreaming` 模式,
|
|
70
|
-
* 不新增 sessionUpdate 类型)。用外层 REPL tool-call 的 callId + 固定 resultId,
|
|
71
|
-
* use-message-groups 据此就地更新同一条 in_progress 结果;运行时长由固定 startedAt
|
|
72
|
-
* 算,单调递增,天然取代内部子工具那种各自从 0 反复重置的孤立条目。
|
|
73
|
-
*/
|
|
74
|
-
private emitStreaming;
|
|
75
|
-
/**
|
|
76
|
-
* 渲染骨架目录。**必须自吞全部异常并返回空串**——见 parameters 的注释。
|
|
77
|
-
*
|
|
78
|
-
* 总闸 `CODEBUDDY_REPL_ENABLED` 关闭时直接短路。`isEnabled` 只把工具从 LLM tools
|
|
79
|
-
* 列表里剔除,管不到这里:`parameters` 是动态函数,ToolManager 构建 agent tools 时
|
|
80
|
-
* **无条件** `await tool.parameters()`(tool-manager.ts:396-404)。不短路的话,总闸
|
|
81
|
-
* 关着也会为一个永不暴露给模型的工具跑一遍全量目录采集。
|
|
82
|
-
*
|
|
83
|
-
* 细闸 `CODEBUDDY_REPL_TOOLS_INJECT_CATALOG=0`(或 `false`)可单独关掉目录注入(工具仍
|
|
84
|
-
* 预加载,只是模型不提前知情,退化为纯渐进披露)。默认开启。
|
|
85
|
-
*
|
|
86
|
-
* 另有 `CODEBUDDY_REPL_TOOLS_INJECT_BUILTIN` 控制**内置工具**是否加载到 REPL
|
|
87
|
-
* (PTC/Minimal 默认开,其余模式默认关;`1`/`0` 强开强关)。控制点在
|
|
88
|
-
* ReplCatalogSource.collect(关闭时 catalog.builtin 为空,骨架目录与 sandbox
|
|
89
|
-
* 注入同时不含内置工具),不在本方法。
|
|
90
|
-
*/
|
|
91
|
-
private renderSkeleton;
|
|
92
|
-
/**
|
|
93
|
-
* Code Mode 对齐标准模式的技能注入:标准模式的 `<available_skills>` 目录长在
|
|
94
|
-
* Skill 工具描述里;Code Mode 模型面只有 REPL、骨架每行摘要只截 80 字符,
|
|
95
|
-
* 目录会整体丢失。这里把 ToolManager 渲染的完整 Skill 描述(同一份字符预算 /
|
|
96
|
-
* skillOverrides 逻辑)附到 code 参数描述末尾,token 成本与标准模式等价。
|
|
97
|
-
*
|
|
98
|
-
* 与 catalog.collect 分开:骨架摘要每行只截 80 字符,技能列表会丢掉。
|
|
99
|
-
* 即使当前会话不是 Code Mode(正在 freeze ptc agent),只要
|
|
100
|
-
* specForReplParameters 认成 PTC/Minimal,也要把完整 Skill 描述打进去。
|
|
101
|
-
*/
|
|
102
|
-
private renderSkillCatalogSection;
|
|
103
|
-
/** ACP 在 ALS 外 getCurrent 会抛;不能让整个 parameters() 失败。 */
|
|
104
|
-
private currentSessionSafe;
|
|
105
|
-
/**
|
|
106
|
-
* ToolManager ↔ REPL 循环依赖时 @Optional 注入会是 undefined。
|
|
107
|
-
* parameters() 在所有组件装配之后才跑,这时再懒取一次。
|
|
108
|
-
*/
|
|
109
|
-
private resolveToolManager;
|
|
110
|
-
/**
|
|
111
|
-
* 完成态工具结果。
|
|
112
|
-
* - `content`:模型面结构化 JSON(`buildReplToolContent`,含 result/stdout/stderr[/images])。
|
|
113
|
-
* 输出超阈值且已落盘时收敛为 `<persisted-output>` 占位符(2KB 预览 + 文件路径),
|
|
114
|
-
* 与 Bash 截断路径对齐——完整内容留在磁盘供 Read,避免跨轮重复发送全量结果。
|
|
115
|
-
* - `renderer.value`:人面展示。**不再显示 "ok"**——改为「耗时置顶 + 执行详情」:
|
|
116
|
-
* 耗时用 `formatTurnDuration`("50s" / "1m 05s",无 "ago")置于首行且始终可见
|
|
117
|
-
* (不被折叠吃掉);执行详情(`buildReplDisplayText`)在下方,超 DEFAULT_DISPLAY_ROWS
|
|
118
|
-
* 自动折叠,`ctrl+o` 展开完整详情——与 bash 的结果行体验一致。
|
|
119
|
-
*/
|
|
120
|
-
private toToolResult;
|
|
121
|
-
/**
|
|
122
|
-
* REPL 输出超阈值且完整内容已落盘时,把模型面 content 换成 `<persisted-output>` 占位符。
|
|
123
|
-
* 与 Bash buildForegroundResult 的 externalizeFromSpillFile 路径对齐;占位失败
|
|
124
|
-
* (service 缺失/异常)时保留截断文本兜底。
|
|
125
|
-
*/
|
|
126
|
-
private externalizeReplOutput;
|
|
127
|
-
}
|
|
128
|
-
export {};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* REPLWorkerManager 实现(checkpoint 2b:常驻 Bun worker,perf/错误隔离)。
|
|
3
|
-
*
|
|
4
|
-
* - 每个 session 一个常驻 worker = kernel,里面一个持久 vm.Context = cell,状态跨多次 run 存活。
|
|
5
|
-
* - worker 只用 builtins(vm);acorn 的 import() 改写在主线程做好再发进去(见 repl-worker-source.ts 注释)。
|
|
6
|
-
* - worker 的 __replImport / facade 通过 MessagePort 回主线程 → broker.resolve / broker.invoke。
|
|
7
|
-
* - lifecycle:cell 超时/取消只结束这次 cell(abort 它在途的 bridge 调用让它 unwind),kernel 和状态都留着;
|
|
8
|
-
* 只有 worker 崩溃/退出,或 hard abort(= reset),才销毁 worker、下次 run 重建。像 Jupyter / node_repl 的 kernel。
|
|
9
|
-
*
|
|
10
|
-
* 见 docs/repl-code-mode/architecture.md。
|
|
11
|
-
*/
|
|
12
|
-
import { Session } from '../../../vendor/cbc-core/node/index.js';
|
|
13
|
-
import { Logger } from '@genie/telemetry';
|
|
14
|
-
import type { RunContext } from '@openai/agents';
|
|
15
|
-
import { ToolResultBlobService } from '../../blob-store/tool-result-blob-service';
|
|
16
|
-
import { ToolSearchService } from '../tool-search-protocol';
|
|
17
|
-
import { ReplCatalogSource } from './repl-catalog-protocol';
|
|
18
|
-
import { CellResult, REPLBridgeBroker, REPLRunOptions, REPLWorkerManager } from './repl-protocol';
|
|
19
|
-
export declare class REPLWorkerManagerImpl implements REPLWorkerManager {
|
|
20
|
-
protected readonly logger: Logger;
|
|
21
|
-
protected readonly broker: REPLBridgeBroker;
|
|
22
|
-
protected readonly catalogSource: ReplCatalogSource;
|
|
23
|
-
protected readonly toolSearchService: ToolSearchService;
|
|
24
|
-
protected readonly toolResultBlobService?: ToolResultBlobService;
|
|
25
|
-
private readonly workers;
|
|
26
|
-
private callSeq;
|
|
27
|
-
run(context: RunContext<Session>, code: string, opts: REPLRunOptions): Promise<CellResult>;
|
|
28
|
-
/** 取消当前 cell:软取消(默认)结束这次 cell、保留 kernel;硬取消(hard=true)销毁 worker,下次 run 重建(= reset)。 */
|
|
29
|
-
abort(session: Session, _callId: string, hard?: boolean): void;
|
|
30
|
-
dispose(session: Session): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* 记一次 bridge 交互的起讫,驱动 idle 超时:发起 inflightBridges++,结算 --并刷新 lastBridgeActivity。
|
|
33
|
-
* 有在途调用(inflightBridges>0)idle 就续期,故 AskUserQuestion 等用户、长任务在途都不会被超时打断。
|
|
34
|
-
* active 用发起时捕获的引用——即便结算时 cell 已被换,写旧 active 也无副作用(其计数已无人读)。
|
|
35
|
-
*/
|
|
36
|
-
private withBridgeActivity;
|
|
37
|
-
private ensureWorker;
|
|
38
|
-
/**
|
|
39
|
-
* 把当前工具集同步进 sandbox。
|
|
40
|
-
*
|
|
41
|
-
* 首次是全量 `init`;之后 epoch 变了才推 `toolsUpdate` 增量。cell 执行中到达的
|
|
42
|
-
* 变更排队到 `done` 之后(见 flushPendingTools)——否则模型 code 跑到一半时
|
|
43
|
-
* `const g = github` 脚下的对象会被换掉。
|
|
44
|
-
*/
|
|
45
|
-
private syncTools;
|
|
46
|
-
/** cell 结束后补推排队的工具变更。 */
|
|
47
|
-
private flushPendingTools;
|
|
48
|
-
/**
|
|
49
|
-
* 推一次进度快照给本次 run 的 onProgress。
|
|
50
|
-
*
|
|
51
|
-
* 带 `callId` 校验:进度定时器/异步消息可能在 cell 已被 abandon(超时/取消)或换成
|
|
52
|
-
* 下一次 run 之后才触发,此时 entry.active 已是别的 cell 或 undefined,不能误推。
|
|
53
|
-
* 回调异常一律吞掉——UI 侧问题绝不能影响 cell 执行。
|
|
54
|
-
*/
|
|
55
|
-
private emitProgress;
|
|
56
|
-
private postCatalog;
|
|
57
|
-
private onMessage;
|
|
58
|
-
/** 发现类 API 分流。只读,不过权限判定(把关的是可见性,见 §4.8)。 */
|
|
59
|
-
private dispatchReplApi;
|
|
60
|
-
/**
|
|
61
|
-
* done 的 async 收尾:只认当前 cell(被 abandon 的旧 cell 之后 unwind 发来的
|
|
62
|
-
* done,callId 不符直接丢,别误清新 cell 的 active)。
|
|
63
|
-
*
|
|
64
|
-
* 在 settle 前把 spill 文件收口(追加 result 文本 + 判定截断),这样上层拿到
|
|
65
|
-
* CellResult.persisted 时文件已完整可读。
|
|
66
|
-
*/
|
|
67
|
-
private handleDone;
|
|
68
|
-
/** 执行期把完整 stdout/stderr 流式落盘(懒创建:无输出的 cell 不产生文件)。 */
|
|
69
|
-
private pushSpill;
|
|
70
|
-
/**
|
|
71
|
-
* 收尾本次 run 的 spill 文件:
|
|
72
|
-
* 1. 把完整 result 文本追加进文件(模型面只剩 head/tail 时,完整内容留给 Read);
|
|
73
|
-
* 2. 关闭文件流;
|
|
74
|
-
* 3. 任一 buffer 截断且落盘成功 → 返回 persisted(上层把模型面收敛为占位符);
|
|
75
|
-
* 未截断 / 落盘失败 → 删除临时文件,不产生垃圾。
|
|
76
|
-
*
|
|
77
|
-
* result 截断判定与 buildReplToolContent 的 truncateReplResult 同口径
|
|
78
|
-
* (replResultToText 文本超 MAX_SHELL_OUTPUT_LENGTH)。
|
|
79
|
-
*/
|
|
80
|
-
private finalizeSpiller;
|
|
81
|
-
private createSpiller;
|
|
82
|
-
/** 中止/失败的 cell 不留落盘文件(内容不完整,Read 也没有意义)。 */
|
|
83
|
-
private cleanupSpiller;
|
|
84
|
-
/** cell 超时/软取消:让这次 cell 以错误结束,并 abort 它在途的 bridge 调用(cell 的 await 会抛错、自行 unwind);
|
|
85
|
-
* worker(= kernel)保留,vm.Context 里的状态不丢——像 Jupyter / node_repl 那样。真卡死(CPU 打满)时靠 hard abort 重建。 */
|
|
86
|
-
private abandonCell;
|
|
87
|
-
/** 给 worker 发 abort 触发 unwind,并起 unwind 宽限;到期仍未 settle 就 terminate 重建。 */
|
|
88
|
-
private armAbandonGrace;
|
|
89
|
-
/** 清 unwind 宽限计时器(收到迟到 done / hard abort / 崩溃时调用;不动 abandonedCallId)。 */
|
|
90
|
-
private clearGrace;
|
|
91
|
-
/** 失败当前运行(崩溃/退出/dispose);active 的 promise 以错误态 settle,并清理 abandon 宽限。 */
|
|
92
|
-
private failActive;
|
|
93
|
-
/** 销毁 worker(崩溃/退出,或 hard abort / reset)并下线;下次 run 重建。 */
|
|
94
|
-
private killWorker;
|
|
95
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* REPL worker source string for `new Worker(src, { eval: true })`.
|
|
3
|
-
*
|
|
4
|
-
* The worker is authored as TypeScript in `./worker/repl-worker.ts` and bundled by
|
|
5
|
-
* `scripts/gen-repl-worker-source.mjs` (vite) into `./repl-worker-source.generated.ts`.
|
|
6
|
-
* This module only re-exports the generated constant so the import path stays stable.
|
|
7
|
-
*
|
|
8
|
-
* Why a string constant rather than a worker file:
|
|
9
|
-
* - agent-cli ships as a Bun single-file executable; there is no worker file to point at.
|
|
10
|
-
* - A string is opaque to rspack, so the worker's own `require` calls are never rewritten.
|
|
11
|
-
* - An inline worker inside the SFE has no node_modules, so the worker uses Node builtins
|
|
12
|
-
* only; acorn's import() rewrite runs on the main thread before the code is sent in.
|
|
13
|
-
*
|
|
14
|
-
* Protocol and sandbox rules are documented at the top of `./worker/repl-worker.ts`.
|
|
15
|
-
*/
|
|
16
|
-
export { REPL_WORKER_SOURCE } from './repl-worker-source.generated';
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { BaseTool } from './base-tool';
|
|
3
|
-
import { Tool, ToolResult } from './tool-protocol';
|
|
4
|
-
import { ToolNames } from '../../vendor/cbc-shared/node/index.js';
|
|
5
|
-
declare const ReportFindingsParameters: z.ZodObject<{
|
|
6
|
-
findings: z.ZodArray<z.ZodObject<{
|
|
7
|
-
file: z.ZodString;
|
|
8
|
-
summary: z.ZodString;
|
|
9
|
-
failureScenario: z.ZodString;
|
|
10
|
-
category: z.ZodOptional<z.ZodString>;
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
file: string;
|
|
13
|
-
summary: string;
|
|
14
|
-
failureScenario: string;
|
|
15
|
-
category?: string | undefined;
|
|
16
|
-
}, {
|
|
17
|
-
file: string;
|
|
18
|
-
summary: string;
|
|
19
|
-
failureScenario: string;
|
|
20
|
-
category?: string | undefined;
|
|
21
|
-
}>, "many">;
|
|
22
|
-
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
findings: {
|
|
24
|
-
file: string;
|
|
25
|
-
summary: string;
|
|
26
|
-
failureScenario: string;
|
|
27
|
-
category?: string | undefined;
|
|
28
|
-
}[];
|
|
29
|
-
}, {
|
|
30
|
-
findings: {
|
|
31
|
-
file: string;
|
|
32
|
-
summary: string;
|
|
33
|
-
failureScenario: string;
|
|
34
|
-
category?: string | undefined;
|
|
35
|
-
}[];
|
|
36
|
-
}>;
|
|
37
|
-
/**
|
|
38
|
-
* ReportFindings 工具(issue #74425)——让代码审查类 Agent(code-reviewer /
|
|
39
|
-
* silent-failure-hunter / type-design-analyzer / comment-analyzer 等)把审查发现的
|
|
40
|
-
* 问题以结构化字段(file / summary / failureScenario / 可选 category)提交,由终端 UI
|
|
41
|
-
* 渲染成专门的列表组件,而不是纯文本堆在对话里。对齐 Claude Code Tools Reference 的
|
|
42
|
-
* ReportFindings 章节。
|
|
43
|
-
*
|
|
44
|
-
* 数据契约本身与终端渲染无关,可被其他宿主(如 WorkBuddy)复用自己的 UI 消费同一份
|
|
45
|
-
* 结构化数据,不需要复用本仓库的 FindingsToolCall 渲染组件。
|
|
46
|
-
*
|
|
47
|
-
* 默认开启:该工具不调用额外模型、不产生额度成本,与 ImageGen/VideoGen 那一档"默认关闭
|
|
48
|
-
* 需 productFeature 开关"的工具不同,而是与 PushNotification 同档——仅用单层环境变量兜底,
|
|
49
|
-
* 可通过 CODEBUDDY_REPORT_FINDINGS_ENABLED=false 关闭。
|
|
50
|
-
*
|
|
51
|
-
* 延迟加载:product.json 顶层 tools[] 给本工具设置了 deferLoading: true——默认不直接
|
|
52
|
-
* 出现在模型工具列表里,需先经 ToolSearch 发现、再通过 DeferExecuteTool 间接调用。
|
|
53
|
-
* 理由:该工具只在"代码审查"这一类特定场景下才会被调用(由生效的审查指令驱动,不是
|
|
54
|
-
* 通用工具),常驻工具列表对绝大多数非审查会话是纯粹的体积浪费,对齐 PushNotification/
|
|
55
|
-
* ImageGen 等同类工具的做法。isEnabled 只有单层 env 开关,不需要 shouldShowInToolSearch
|
|
56
|
-
* (该方法只用于 ComputerUse/TeamCreate 这类存在运行时门控、索引后仍可能不可调用的场景)。
|
|
57
|
-
*/
|
|
58
|
-
export declare class ReportFindingsTool extends BaseTool implements Tool {
|
|
59
|
-
name: ToolNames;
|
|
60
|
-
description: string;
|
|
61
|
-
parameters: z.ZodObject<{
|
|
62
|
-
findings: z.ZodArray<z.ZodObject<{
|
|
63
|
-
file: z.ZodString;
|
|
64
|
-
summary: z.ZodString;
|
|
65
|
-
failureScenario: z.ZodString;
|
|
66
|
-
category: z.ZodOptional<z.ZodString>;
|
|
67
|
-
}, "strip", z.ZodTypeAny, {
|
|
68
|
-
file: string;
|
|
69
|
-
summary: string;
|
|
70
|
-
failureScenario: string;
|
|
71
|
-
category?: string | undefined;
|
|
72
|
-
}, {
|
|
73
|
-
file: string;
|
|
74
|
-
summary: string;
|
|
75
|
-
failureScenario: string;
|
|
76
|
-
category?: string | undefined;
|
|
77
|
-
}>, "many">;
|
|
78
|
-
}, "strip", z.ZodTypeAny, {
|
|
79
|
-
findings: {
|
|
80
|
-
file: string;
|
|
81
|
-
summary: string;
|
|
82
|
-
failureScenario: string;
|
|
83
|
-
category?: string | undefined;
|
|
84
|
-
}[];
|
|
85
|
-
}, {
|
|
86
|
-
findings: {
|
|
87
|
-
file: string;
|
|
88
|
-
summary: string;
|
|
89
|
-
failureScenario: string;
|
|
90
|
-
category?: string | undefined;
|
|
91
|
-
}[];
|
|
92
|
-
}>;
|
|
93
|
-
needsApproval: boolean;
|
|
94
|
-
isEnabled: () => Promise<boolean>;
|
|
95
|
-
execute(input: z.infer<typeof ReportFindingsParameters>): Promise<ToolResult>;
|
|
96
|
-
}
|
|
97
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { AgentTask, AgentTaskManager } from '../agent-task/agent-task-protocol';
|
|
2
|
-
/**
|
|
3
|
-
* 当前可作为 `task_id` 使用的后台任务,格式为 `id (类型: 标题)`。
|
|
4
|
-
*
|
|
5
|
-
* 为什么需要它:`TaskStop` / `TaskOutput` 的 not-found 文案原本让模型「用 /tasks 看看」,
|
|
6
|
-
* 但 `/tasks` 是 TUI 面板路由(键盘进入、渲染给人看),对应的 CommandExecutor.execute()
|
|
7
|
-
* 函数体是空的,不产出任何进入对话的文本 —— 模型既调不到也读不到。拿不到候选就只能猜
|
|
8
|
-
* task_id:线上实测出现过 TaskStop 连续枚举 488 个不同 id 的失控循环(循环检测按
|
|
9
|
-
* name+arguments 完全相同计数,参数每次都变所以拦不住,最后靠 Max turns (500) 才停,
|
|
10
|
-
* 耗掉 725 credits)。把候选直接拼进错误文本是消除猜测动机的关键 —— 与 Claude Code 的
|
|
11
|
-
* `nTa()` 同一思路:错误信号和可用候选在同一次工具结果里给齐。
|
|
12
|
-
*
|
|
13
|
-
* 口径与 `/tasks` 面板(ui/input/panel/tasks/tasks-panel.tsx)保持一致:同样的两个
|
|
14
|
-
* registry、同样只列 running/pending、agent task 同样用 `agentType › description`
|
|
15
|
-
* 三级兜底标题 —— 否则同一个任务在面板和这里显示的名字会不一样。
|
|
16
|
-
*/
|
|
17
|
-
export declare function listRunningBackgroundTasks(agentTaskManager: AgentTaskManager): string[];
|
|
18
|
-
/** agent task 的展示名,与 /tasks 面板及 TaskStop.stopAgentTask 同一套兜底顺序。 */
|
|
19
|
-
export declare function describeAgentTask(task: AgentTask): string;
|
|
20
|
-
/**
|
|
21
|
-
* 目标 task_id 不存在时给模型的完整消息:说明找不到,并列出当前可用的候选。
|
|
22
|
-
*
|
|
23
|
-
* `TaskStop` 与 `TaskOutput` 共用 —— 两者都接受同一个 `task_id`、都在同样的两个
|
|
24
|
-
* registry 里查找,因此候选集合必须一致;分头维护迟早会漂移。
|
|
25
|
-
*/
|
|
26
|
-
export declare function buildNotFoundMessage(taskId: string, agentTaskManager: AgentTaskManager): string;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 沙箱审批请求的共享判定(bash / PowerShell 复用)。
|
|
3
|
-
*
|
|
4
|
-
* 抽离自 `bash-sandbox-approval-requester.ts`,让两个工具的「bypass 模式是否
|
|
5
|
-
* 自动放行」判定单点收口,避免分叉(此前 PowerShell 漏了网络拦截处理)。
|
|
6
|
-
*/
|
|
7
|
-
import type { SandboxApprovalRequest } from '../permission';
|
|
8
|
-
/**
|
|
9
|
-
* 网络拦截记录中是否存在「需要用户决策」的 reason(即使 bypass/fullAccess 模式也不自动放行)。
|
|
10
|
-
*
|
|
11
|
-
* 判定源是 Center `DecisionRecord` 投影出的 reason 枚举,而非 TS 侧
|
|
12
|
-
* `interceptReason` 字符串——Center 已按 HttpIntercept rules 表判定三态并写入
|
|
13
|
-
* reason,TS 据此决定是否必须弹窗。当前仅 `http_intercept_ask`(HTTP 明文拦截
|
|
14
|
-
* 询问态)属于此列;其余 reason(block/黑名单等)由各自 post-exec 路径处理,
|
|
15
|
-
* 不影响 bypass 自动放行判定。
|
|
16
|
-
*
|
|
17
|
-
* pre-exec 模式无 `sandboxResult`,返回 false(不排除 bypass 自动放行)。
|
|
18
|
-
*/
|
|
19
|
-
export declare function needsUserDecisionForNetworkBlock(request: SandboxApprovalRequest): boolean;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ShellResult } from '../shell';
|
|
2
|
-
type SandboxInterceptResult = Pick<ShellResult, 'fileBlockRecords' | 'networkBlockRecords'>;
|
|
3
|
-
/** 组合普通文件/网络拦截与程序黑名单提示,保持各安全域实现相互独立。 */
|
|
4
|
-
export declare function formatSandboxInterceptMessage(result: SandboxInterceptResult): string;
|
|
5
|
-
/** 仅组合必须阻止模型继续重试的程序黑名单与网络安全提示。 */
|
|
6
|
-
export declare function formatBlockingSandboxInterceptMessage(result: SandboxInterceptResult): string;
|
|
7
|
-
/**
|
|
8
|
-
* `ShellResult.denialMessage` 已逐条给出终局拒绝原因时的补充提示。
|
|
9
|
-
*
|
|
10
|
-
* 与 {@link formatBlockingSandboxInterceptMessage} 只差一处:排除普通网络拦截记录。
|
|
11
|
-
* 那些记录已被 denialMessage 涵盖,再经 `formatSandboxNetworkInterceptMessage` 标一遍
|
|
12
|
-
* `Sandbox Intercept Info (non-blocking)` 会与权威口径矛盾。恶意网站库命中与程序
|
|
13
|
-
* 黑名单超出 denialMessage 的表达范围(前者要给白名单指引,后者要阻止换 shell 重试),
|
|
14
|
-
* 必须保留。
|
|
15
|
-
*/
|
|
16
|
-
export declare function formatCriticalSandboxInterceptMessage(result: SandboxInterceptResult): string;
|
|
17
|
-
interface BackgroundOutputBuffer {
|
|
18
|
-
push(chunk: string): void;
|
|
19
|
-
}
|
|
20
|
-
/** 将必须阻止模型重试的沙箱提示写入后台任务输出。 */
|
|
21
|
-
export declare function pushBlockingSandboxInterceptToBackgroundOutput(buffer: BackgroundOutputBuffer, result: SandboxInterceptResult): void;
|
|
22
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { ShellResult } from '../shell';
|
|
2
|
-
/**
|
|
3
|
-
* 把非审批型的沙箱拦截记录转成给模型的结构化提示。
|
|
4
|
-
*
|
|
5
|
-
* 恶意网站不能沿用普通的“non-blocking”文案:模型必须明确知道
|
|
6
|
-
* 访问已被拒绝、不应重试,以及唯一的放行方式是由用户加入安全中心白名单。
|
|
7
|
-
* 其他文件/网络拦截保持原有文案,避免改变现有重试和审批语义。
|
|
8
|
-
*/
|
|
9
|
-
export declare function formatSandboxNetworkInterceptMessage(result: Pick<ShellResult, 'fileBlockRecords' | 'networkBlockRecords'>): string;
|
|
10
|
-
/** 后台任务的 stderr 汇聚缓冲,命令结束后可能已关闭。 */
|
|
11
|
-
interface BackgroundOutputBuffer {
|
|
12
|
-
push(chunk: string): void;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* 把网络拦截提示写进后台任务输出。Bash 与 PowerShell 共用一份。
|
|
16
|
-
*
|
|
17
|
-
* 后台路径不走前台的结果拼装,只翻任务状态;脚本吞掉请求失败并以 0 退出时状态就是
|
|
18
|
-
* completed,模型用 TaskOutput 追结果时会把这次执行当成完全成功,转头继续访问同一个
|
|
19
|
-
* 恶意域名。所以这里必须显式写一条,且只渲染网络记录——文件拦截由各自的
|
|
20
|
-
* sandbox_denied 分支输出,重复渲染会让模型看到两遍。
|
|
21
|
-
*
|
|
22
|
-
* 缓冲关闭属于正常收尾竞态,吞掉即可:写不进提示也不该让任务完成流程失败。
|
|
23
|
-
*/
|
|
24
|
-
export declare function pushNetworkInterceptToBackgroundOutput(buffer: BackgroundOutputBuffer, networkBlockRecords: ShellResult['networkBlockRecords']): void;
|
|
25
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { RunContext, ToolExecuteArgument } from '../../vendor/cbc-shared/node/index.js';
|
|
2
|
-
import type { Session } from '../../vendor/cbc-core/node/index.js';
|
|
3
|
-
import { BaseTool } from './base-tool';
|
|
4
|
-
/**
|
|
5
|
-
* File-writing tools whose permission decision is delegated to the sandbox
|
|
6
|
-
* write-rule guard whenever the sandbox path is active.
|
|
7
|
-
*
|
|
8
|
-
* The legacy permission service remains the fallback when sandbox execution is
|
|
9
|
-
* disabled or unavailable. ToolManager still executes PreToolUse hooks on the
|
|
10
|
-
* cache-miss path before SandboxWriteRuleGuard runs.
|
|
11
|
-
*/
|
|
12
|
-
export declare abstract class SandboxPermissionFileTool extends BaseTool {
|
|
13
|
-
needsApproval: (runContext: RunContext<Session>, input: ToolExecuteArgument<any>, callId?: string) => Promise<boolean>;
|
|
14
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type FileBlockRecord } from '../sandbox-cli/sandbox-cli-protocol';
|
|
2
|
-
export interface ProgramBlacklistRecordPartition {
|
|
3
|
-
blockedProgramRecords: FileBlockRecord[];
|
|
4
|
-
otherFileRecords: FileBlockRecord[];
|
|
5
|
-
}
|
|
6
|
-
/** 把程序黑名单记录从普通文件拦截中分离,避免重复或误导性展示。 */
|
|
7
|
-
export declare function partitionProgramBlacklistRecords(records: FileBlockRecord[] | undefined): ProgramBlacklistRecordPartition;
|
|
8
|
-
/** 将程序黑名单命中转换为模型可理解且不可申请文件授权的明确说明。 */
|
|
9
|
-
export declare function formatProgramBlacklistInterceptMessage(records: FileBlockRecord[] | undefined): string;
|