@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,154 +0,0 @@
|
|
|
1
|
-
import { type Session } from '../../vendor/cbc-core/node/index.js';
|
|
2
|
-
import { FunctionCallItem, ToolNames } from '../../vendor/cbc-shared/node/index.js';
|
|
3
|
-
import { type ICwdService, type IWorktreeChangeDetector, type IWorktreeService } from '@genie/cbc-worktree';
|
|
4
|
-
import { EventService, Logger } from '@genie/telemetry';
|
|
5
|
-
import type { RunContext } from '@openai/agents';
|
|
6
|
-
import { z } from 'zod';
|
|
7
|
-
import { ConsoleManager } from '../console';
|
|
8
|
-
import { BaseTool } from './base-tool';
|
|
9
|
-
import { Tool, ToolCallArgumentRenderer, ToolResult } from './tool-protocol';
|
|
10
|
-
export declare class AgentTool extends BaseTool implements Tool {
|
|
11
|
-
protected readonly logger: Logger;
|
|
12
|
-
protected readonly consoleManager: ConsoleManager;
|
|
13
|
-
protected readonly eventService: EventService;
|
|
14
|
-
protected readonly cwdService: ICwdService;
|
|
15
|
-
protected readonly worktreeService: IWorktreeService;
|
|
16
|
-
protected readonly worktreeChangeDetector: IWorktreeChangeDetector;
|
|
17
|
-
private teamSpawnChain;
|
|
18
|
-
name: ToolNames;
|
|
19
|
-
readonly promptCacheStability: 'volatile';
|
|
20
|
-
/**
|
|
21
|
-
* Tool schema is a **method** (not a static object) so ToolManager.get()
|
|
22
|
-
* re-evaluates it per invocation and reflects the current process env.
|
|
23
|
-
* This is how we hide `run_in_background` from the model when
|
|
24
|
-
* `CODEBUDDY_CODE_DISABLE_BACKGROUND_TASKS` is truthy (issue #63114 — in
|
|
25
|
-
* request-response SDK / print-mode consumers, background agent results
|
|
26
|
-
* cannot flow back into the lead's final answer, so the host disables the
|
|
27
|
-
* whole capability instead of shipping half a feature).
|
|
28
|
-
*
|
|
29
|
-
* The runtime guard in `execute()` still ignores `run_in_background=true`
|
|
30
|
-
* from stale/cached tool calls that bypass this schema.
|
|
31
|
-
*/
|
|
32
|
-
parameters(): z.ZodTypeAny;
|
|
33
|
-
private buildParametersSchema;
|
|
34
|
-
argumentRenderer: ToolCallArgumentRenderer;
|
|
35
|
-
needsApproval: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Auto mode classifier projection: `(${subagent_type}, mode=${mode}): ${prompt}`
|
|
38
|
-
* (Claude alignment, decision D1). The sub-agent prompt is projected so a
|
|
39
|
-
* delegated dangerous action is visible to the classifier (delegation-bypass
|
|
40
|
-
* defense). NOTE: CodeBuddy's Agent tool has `needsApproval = false`, so the
|
|
41
|
-
* current action never reaches the classifier directly — this projection is
|
|
42
|
-
* consumed when an Agent call appears in the history transcript.
|
|
43
|
-
*/
|
|
44
|
-
toAutoClassifierInput(input: unknown): string;
|
|
45
|
-
execute(input: any, context?: RunContext<Session>, details?: {
|
|
46
|
-
toolCall: FunctionCallItem;
|
|
47
|
-
}): Promise<ToolResult>;
|
|
48
|
-
/**
|
|
49
|
-
* 将 Agent 工具执行异常映射到 19920 段细分错误码。
|
|
50
|
-
*/
|
|
51
|
-
private classifyAgentError;
|
|
52
|
-
/**
|
|
53
|
-
* Generate an auto-name for a background agent: "{agentType}-{seq}"
|
|
54
|
-
* e.g. "explore-1", "explore-2", "plan-1"
|
|
55
|
-
*/
|
|
56
|
-
private generateBackgroundAgentName;
|
|
57
|
-
/**
|
|
58
|
-
* Resolve a member name that is unique within `teamName` (checked against
|
|
59
|
-
* the in-memory TeamMemberRegistry). If `desired` already exists, append a
|
|
60
|
-
* short random hex suffix and retry — aligns with TeamCreate's "rename on
|
|
61
|
-
* conflict" idempotency strategy and prevents a leftover/stale teammate
|
|
62
|
-
* (e.g. a `critic` from a finished team) from blocking new background
|
|
63
|
-
* agent spawns with misleading "already active" errors.
|
|
64
|
-
*/
|
|
65
|
-
private resolveUniqueMemberName;
|
|
66
|
-
/**
|
|
67
|
-
* Ensure the lead is in a team before spawning a named/background member.
|
|
68
|
-
* Named Agent() from Code Mode must not require a prior TeamCreate.
|
|
69
|
-
*/
|
|
70
|
-
private ensureTeamForSpawn;
|
|
71
|
-
/**
|
|
72
|
-
* Spawn a background agent as a team member in an auto-created team.
|
|
73
|
-
*
|
|
74
|
-
* This replaces the old "implicit team" approach. Instead of ad-hoc
|
|
75
|
-
* TeamMember + setAgentTask() + ensureInboxPolling(), we:
|
|
76
|
-
* 1. Auto-create a team via TeamManager (if not already in one)
|
|
77
|
-
* 2. Spawn the agent using TeamMember.spawn() for full lifecycle support
|
|
78
|
-
* 3. Register with TeamManager for persistence to config.json
|
|
79
|
-
*/
|
|
80
|
-
private spawnBackgroundAgent;
|
|
81
|
-
/**
|
|
82
|
-
* Spawn a teammate in the current active team.
|
|
83
|
-
* Teammates always run in detached + background mode.
|
|
84
|
-
* If the lead is not in a team yet, auto-create one (same as background Agent).
|
|
85
|
-
*/
|
|
86
|
-
private spawnTeammate;
|
|
87
|
-
/**
|
|
88
|
-
* Cleanup agent worktree after task completion.
|
|
89
|
-
* - No changes: auto-delete worktree, return removal message
|
|
90
|
-
* - Has changes: preserve worktree, return info message
|
|
91
|
-
*
|
|
92
|
-
* Message format aligned with Claude Code:
|
|
93
|
-
* - No changes: "Worktree removed (no changes)"
|
|
94
|
-
* - Has changes: "Worktree preserved at ${path} on branch: ${branch}"
|
|
95
|
-
*/
|
|
96
|
-
private cleanupAgentWorktree;
|
|
97
|
-
/**
|
|
98
|
-
* Spawn a Fork subagent that inherits the parent agent's full context.
|
|
99
|
-
* Reuses spawnBackgroundAgent() with agentType='fork', which is recognized
|
|
100
|
-
* by AgentTask.setupPhase() to inherit the default agent definition.
|
|
101
|
-
*/
|
|
102
|
-
private spawnForkAgent;
|
|
103
|
-
/**
|
|
104
|
-
* Execute a Fork subagent synchronously (blocking).
|
|
105
|
-
* Same as standard sync sub-agent but uses AgentNames.FORK so that
|
|
106
|
-
* AgentTask.setupPhase() inherits the default agent definition and
|
|
107
|
-
* setupSubAgentSession() injects parent conversation history.
|
|
108
|
-
*/
|
|
109
|
-
private executeSyncForkAgent;
|
|
110
|
-
/**
|
|
111
|
-
* Build the fork child's prompt by prepending behavioral rules.
|
|
112
|
-
* The <fork-boilerplate> tag serves dual purpose:
|
|
113
|
-
* 1. Behavioral instructions for the fork child
|
|
114
|
-
* 2. Marker for isInForkChild() recursive fork prevention
|
|
115
|
-
*/
|
|
116
|
-
private buildForkChildPrompt;
|
|
117
|
-
/**
|
|
118
|
-
* Check if the current execution context is inside a Fork child.
|
|
119
|
-
* Two-layer defense:
|
|
120
|
-
* 1. Session meta: check if agentName === 'fork'
|
|
121
|
-
* 2. Message scan: check for <fork-boilerplate> tag in session history
|
|
122
|
-
*/
|
|
123
|
-
private isInForkChild;
|
|
124
|
-
private getAgentManager;
|
|
125
|
-
/**
|
|
126
|
-
* Enforces `CODEBUDDY_DISABLE_BUILTIN_SUBAGENTS` (issue #99451) for a
|
|
127
|
-
* built-in-disableable `subagent_type`. Throws unless a custom OR plugin
|
|
128
|
-
* agent overrides it (matching tool-manager.ts's exposure-layer check —
|
|
129
|
-
* see that file's `CUSTOM_AGENT_TAG || PLUGIN_AGENT_TAG` filter).
|
|
130
|
-
*
|
|
131
|
-
* Deliberately reads tags via `AgentManager.getAgentConfig()` rather than
|
|
132
|
-
* `CustomAgentManager.get()`: the latter's `loadCustomAgents()` filters
|
|
133
|
-
* out anything tagged `PLUGIN_AGENT_TAG`, so a plugin-provided override
|
|
134
|
-
* would be misreported as absent here — a "shown in the tool catalog but
|
|
135
|
-
* blocked at runtime" bug that existed in the original CustomAgentManager
|
|
136
|
-
* -based check.
|
|
137
|
-
*/
|
|
138
|
-
private assertBuiltinSubagentOverrideAllowed;
|
|
139
|
-
/**
|
|
140
|
-
* 上报插件 subagent 能力调用埋点。
|
|
141
|
-
* Agent 的 tags 格式为 [CLI_AGENT_TAG, CUSTOM_AGENT_TAG, PLUGIN_TAG, source],
|
|
142
|
-
* 其中 source 形如 "pluginName@marketplaceName"。
|
|
143
|
-
* 仅在 WorkBuddy Desktop 宿主下上报。
|
|
144
|
-
*/
|
|
145
|
-
private reportPluginAgentCall;
|
|
146
|
-
/**
|
|
147
|
-
* Build the optional `subAgent` slice on the returned ToolResult — present
|
|
148
|
-
* when AgentTask recorded a sessionId and a `lastId` boundary (i.e. the run
|
|
149
|
-
* produced at least one history item to replay). afterId may be undefined
|
|
150
|
-
* (window starts at the subagent history beginning). Spread
|
|
151
|
-
* `...AgentTool.subAgentMetaOf(executionResult)` at the call site.
|
|
152
|
-
*/
|
|
153
|
-
private static subAgentMetaOf;
|
|
154
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { AuthenticationManager } from '@genie/authentication';
|
|
2
|
-
import { AbTestService, ProductManager } from '@genie/product';
|
|
3
|
-
/** 国际集群 endpoint 主机名片段。命中任一即判定为暂不支持 Artifact 分享链路的国际环境。 */
|
|
4
|
-
export declare const INTERNATIONAL_ENDPOINT_HOSTS: string[];
|
|
5
|
-
/**
|
|
6
|
-
* Artifact / ArtifactControl 共享的开关判定(issue #81031)。
|
|
7
|
-
*
|
|
8
|
-
* 判定顺序(先命中先生效):
|
|
9
|
-
* 1. 国际 endpoint → 直接关闭(国际网关缺少 spaceengine 接口,任何开关都无法覆盖);
|
|
10
|
-
* 2. 环境变量:CODEBUDDY_ARTIFACT_ENABLED(新规范名)优先,未设置时回落
|
|
11
|
-
* CODEBUDDY_SHARE_LINK_ENABLED(旧名,兼容已部署环境)。空串/空白视为未设置——
|
|
12
|
-
* 宿主模板化 env 很容易注入空值,若按「已设置」处理会遮蔽旧变量并静默关闭工具;
|
|
13
|
-
* 3. 云端 productFeatures:优先走调用方注入的 AbTestService(Artifact 权威优先、
|
|
14
|
-
* ShareLink 兼容兜底;任一 alias 显式 false 触发 kill-switch);两者均缺失时
|
|
15
|
-
* 本地默认按 true 处理,保留既有"缺省开"的行为。
|
|
16
|
-
* 4. AbTestService 未注入(老bundle / 未装配 CellJS 容器的单测)→ fallback 到
|
|
17
|
-
* productManager.waitConfiguration(),语义与迁移前完全等价。
|
|
18
|
-
*
|
|
19
|
-
* **不用 `ContainerUtil.get(AbTestService)`懒获取的原因**:CellJS 惰性实例化,
|
|
20
|
-
* 首次 get 才触发 @PostConstruct → warm-up。如果只有 isArtifactToolEnabled 消费它,
|
|
21
|
-
* 那么在无登录/短路径场景下工具从未被 evaluate → AbTestService 从未实例化 → snapshot
|
|
22
|
-
* 从不落盘。改由消费方类(ArtifactTool / ArtifactControlTool)通过 @Autowired 声明依赖,
|
|
23
|
-
* CellJS 装配这些工具时会顺带装配 AbTestService,warm-up 提前发生。
|
|
24
|
-
*/
|
|
25
|
-
export declare function isArtifactToolEnabled(productManager: ProductManager, abTestService?: AbTestService): Promise<boolean>;
|
|
26
|
-
/**
|
|
27
|
-
* 知识空间上传业务错误码:文件大小超限(ErrFileTooLarge)。
|
|
28
|
-
* 与 `@genie/agent-provider` 的 `KNOWLEDGE_UPLOAD_FILE_TOO_LARGE_CODE` 保持一致
|
|
29
|
-
* (这里本地声明而非跨包 value import,避免 CLI 打包引入 agent-provider 运行时依赖)。
|
|
30
|
-
*/
|
|
31
|
-
export declare const KNOWLEDGE_UPLOAD_FILE_TOO_LARGE_CODE = 56040;
|
|
32
|
-
/**
|
|
33
|
-
* 知识空间上传业务错误码:标题命中内容审核(Code_ERR_NODE_BLOCKED)。
|
|
34
|
-
* 与 `@genie/agent-provider` 的 `KNOWLEDGE_UPLOAD_MODERATION_BLOCKED_CODE` 保持一致。
|
|
35
|
-
*/
|
|
36
|
-
export declare const KNOWLEDGE_UPLOAD_MODERATION_BLOCKED_CODE = 619610;
|
|
37
|
-
/**
|
|
38
|
-
* 按文件扩展名判定上传 COS 时的 `Content-Type`。
|
|
39
|
-
*
|
|
40
|
-
* 后端 `importLocalFileAsync` 按扩展名分流(见 workbuddy-server `share/facade.ts` 的
|
|
41
|
-
* 「html/md 走 cosKey,其他类型走 confirmKey」注释),`.md` 与 `.html` 同为一等公民并由
|
|
42
|
-
* **服务端**渲染为样式化页面 —— 因此客户端不做任何预渲染,只需给出正确的 contentType。
|
|
43
|
-
*
|
|
44
|
-
* 未识别的扩展名保持 `application/octet-stream`(既有行为,不收窄)。
|
|
45
|
-
*/
|
|
46
|
-
export declare function resolveShareContentType(filePath: string): string;
|
|
47
|
-
/** endpoint 主机名命中国际集群清单时返回 true。 */
|
|
48
|
-
export declare function isInternationalEndpoint(endpoint: string): boolean;
|
|
49
|
-
/** 复用 CBC 自身会话的 access token 构造鉴权头(bearer + X-* 上下文)。未登录返回 null。 */
|
|
50
|
-
export declare function buildShareAuthHeaders(authManager: AuthenticationManager): Record<string, string> | null;
|
|
51
|
-
/**
|
|
52
|
-
* 从 Artifact 工具返回的分享链接中解析出 nodeId(即取消发布接口所需的 fileId)。
|
|
53
|
-
*
|
|
54
|
-
* 链接格式稳定为 `.../p/{nodeId}`(见 spaceengine urlgen.PublishURL),因此取 pathname
|
|
55
|
-
* 的最后一段即可。传入的已经是裸 nodeId(不含斜杠、不含协议)时原样返回。
|
|
56
|
-
*
|
|
57
|
-
* 无法解析时返回 null。
|
|
58
|
-
*/
|
|
59
|
-
export declare function extractNodeIdFromShareLink(input: string): string | null;
|
|
60
|
-
/**
|
|
61
|
-
* 分享链接的节点类型:
|
|
62
|
-
* - `page`:HTML 页面节点(`https://workbuddy.link/p/{nodeId}`),取消公开走 page/unpublish;
|
|
63
|
-
* - `doc`:Markdown 文档节点(`https://www.workbuddy.cn/space/d/{nodeId}`),取消公开走
|
|
64
|
-
* set-permission(invalid)(doc 节点没有 page/unpublish,调之报 "page meta not found");
|
|
65
|
-
* - `unknown`:只给了裸 nodeId(无路径可判型),由调用方先试 page 再回退 doc。
|
|
66
|
-
*/
|
|
67
|
-
export type ShareLinkKind = 'page' | 'doc' | 'unknown';
|
|
68
|
-
/**
|
|
69
|
-
* 按链接路径形态判定节点类型,并解析出 nodeId。
|
|
70
|
-
*
|
|
71
|
-
* 判据只看路径段(`/p/` vs `/space/d/`),不依赖 host——host 可能随环境变化
|
|
72
|
-
* (workbuddy.link / workbuddy.cn / copilot.tencent.com 等),但路径形态稳定。
|
|
73
|
-
* 裸 nodeId(无斜杠)无法判型,返回 `unknown` 交由调用方按 page→doc 顺序试探。
|
|
74
|
-
*
|
|
75
|
-
* nodeId 复用 extractNodeIdFromShareLink,避免重复解析逻辑。
|
|
76
|
-
*/
|
|
77
|
-
export declare function classifyShareLink(input: string): {
|
|
78
|
-
nodeId: string | null;
|
|
79
|
-
kind: ShareLinkKind;
|
|
80
|
-
};
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { AuthenticationManager } from '@genie/authentication';
|
|
2
|
-
import { Session } from '../../vendor/cbc-core/node/index.js';
|
|
3
|
-
import { Agent, ToolNames } from '../../vendor/cbc-shared/node/index.js';
|
|
4
|
-
import { AbTestService, ProductManager } from '@genie/product';
|
|
5
|
-
import { Logger } from '@genie/telemetry';
|
|
6
|
-
import type { RunContext } from '@openai/agents';
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
import { BaseTool } from './base-tool';
|
|
9
|
-
import { Tool, ToolCallArgumentRenderer, ToolResult } from './tool-protocol';
|
|
10
|
-
/**
|
|
11
|
-
* ArtifactControl 工具参数:对一个已发布的 artifact 执行控制动作。
|
|
12
|
-
*
|
|
13
|
-
* 当前**唯一**支持的动作是「取消发布」(unpublish):把此前用 Artifact 工具发布的
|
|
14
|
-
* HTML 页面 / Markdown 文档的公开链接设为私密(撤销公开访问)。
|
|
15
|
-
*
|
|
16
|
-
* 二选一(至少一个):
|
|
17
|
-
* - shareLink:Artifact 返回的完整链接(形如 .../p/{nodeId}),工具会自行解析出 nodeId。
|
|
18
|
-
* - nodeId:链接末段的裸标识(等价于后端取消发布接口所需的 fileId)。
|
|
19
|
-
*/
|
|
20
|
-
declare const ArtifactControlParameters: z.ZodObject<{
|
|
21
|
-
shareLink: z.ZodOptional<z.ZodString>;
|
|
22
|
-
nodeId: z.ZodOptional<z.ZodString>;
|
|
23
|
-
}, "strip", z.ZodTypeAny, {
|
|
24
|
-
shareLink?: string | undefined;
|
|
25
|
-
nodeId?: string | undefined;
|
|
26
|
-
}, {
|
|
27
|
-
shareLink?: string | undefined;
|
|
28
|
-
nodeId?: string | undefined;
|
|
29
|
-
}>;
|
|
30
|
-
/**
|
|
31
|
-
* ArtifactControl 工具 —— 已发布 artifact 的控制入口(issue #81031 更名自 ShareLinkUnpublish)。
|
|
32
|
-
*
|
|
33
|
-
* 当前**唯一**能力:取消发布(unpublish)——把一个 Artifact 工具发布的
|
|
34
|
-
* HTML 页面 / Markdown 文档的公开分享链接设为私密(互联网不可访问,并尽量移除协作人)。
|
|
35
|
-
* 尚不支持列表 / 删除 / 权限调整等其他动作;命名仅为后续以可选参数扩展预留空间。
|
|
36
|
-
*
|
|
37
|
-
* 与 ArtifactTool 对称:同样仅面向国内 / iOA / 内部 endpoint,复用 CBC 自身会话的
|
|
38
|
-
* access token。按链接形态路由(见 classifyShareLink / revoke):
|
|
39
|
-
* - html 页面节点(/p/)→ `POST /space/api/view/page/unpublish`(body `{ fileId }`);
|
|
40
|
-
* - markdown 文档节点(/space/d/)→ `POST /space/api/permission/set-permission`
|
|
41
|
-
* 设为 `{ role: 'invalid' }`(doc 节点没有 page/unpublish,硬调会报 "page meta not found");
|
|
42
|
-
* - 裸 nodeId(无法判型)→ 先试 page/unpublish,任意失败回退 set-permission(invalid)。
|
|
43
|
-
*
|
|
44
|
-
* 用户可以直接把 Artifact 返回的链接贴回来撤销,无需记忆内部标识,也无需依赖会话状态——
|
|
45
|
-
* nodeId 稳定内嵌在链接中(见 spaceengine urlgen.PublishURL)。
|
|
46
|
-
*/
|
|
47
|
-
export declare class ArtifactControlTool extends BaseTool implements Tool {
|
|
48
|
-
protected readonly authManager: AuthenticationManager;
|
|
49
|
-
protected readonly productManager: ProductManager;
|
|
50
|
-
protected readonly abTestService?: AbTestService;
|
|
51
|
-
protected readonly logger: Logger;
|
|
52
|
-
name: ToolNames;
|
|
53
|
-
aliases: string[];
|
|
54
|
-
description: string;
|
|
55
|
-
parameters: z.ZodObject<{
|
|
56
|
-
shareLink: z.ZodOptional<z.ZodString>;
|
|
57
|
-
nodeId: z.ZodOptional<z.ZodString>;
|
|
58
|
-
}, "strip", z.ZodTypeAny, {
|
|
59
|
-
shareLink?: string | undefined;
|
|
60
|
-
nodeId?: string | undefined;
|
|
61
|
-
}, {
|
|
62
|
-
shareLink?: string | undefined;
|
|
63
|
-
nodeId?: string | undefined;
|
|
64
|
-
}>;
|
|
65
|
-
strict: boolean;
|
|
66
|
-
argumentRenderer: ToolCallArgumentRenderer;
|
|
67
|
-
isEnabled: (_args: {
|
|
68
|
-
runContext: RunContext<Session>;
|
|
69
|
-
agent: Agent;
|
|
70
|
-
}) => Promise<boolean>;
|
|
71
|
-
execute(input: z.infer<typeof ArtifactControlParameters>, _context: RunContext<Session>): Promise<ToolResult>;
|
|
72
|
-
/**
|
|
73
|
-
* 按节点类型取消公开访问,返回成功走的是哪条路径(page / permission)。
|
|
74
|
-
*
|
|
75
|
-
* - `page`:仅 page/unpublish。
|
|
76
|
-
* - `doc`:仅 makeDocPrivate(关闭公开档位 + 移除所有人类协作人)。
|
|
77
|
-
* - `unknown`:先 page/unpublish,**任意**失败即回退 makeDocPrivate
|
|
78
|
-
* (不按错误串匹配——串匹配脆弱,且 CLI markdown 分享大多本就是 doc 节点)。
|
|
79
|
-
* 两者都失败时返回权限接口的失败详情(更可能是真实路径),并注明 page 也已尝试。
|
|
80
|
-
*/
|
|
81
|
-
private revoke;
|
|
82
|
-
/** page/unpublish(html 页面节点):body `{ fileId }`,code===0 成功。 */
|
|
83
|
-
private unpublishPage;
|
|
84
|
-
/**
|
|
85
|
-
* 把 markdown doc 节点设为**完全私密**:关闭公开档位 + 移除所有人类协作人。
|
|
86
|
-
*
|
|
87
|
-
* 仅关公开档位(public.role=invalid)只堵住「互联网公开」这道门;此前通过邀请/协作
|
|
88
|
-
* 加入的成员仍能访问。真正的「设为私密」必须连协作人一起撤掉,因此本方法:
|
|
89
|
-
* 1. 先查当前协作人:POST /space/api/permission/collaborators `{ recordId }`
|
|
90
|
-
* → `{ collaborators: [{ uid, role, type }] }`(type='public' 是公开档位占位条目、
|
|
91
|
-
* role='owner' 是所有者,二者都要跳过)。查失败不致命——仍继续关公开档位,
|
|
92
|
-
* 只是附警告说明协作人可能未清干净。
|
|
93
|
-
* 2. 一次原子调用 POST /space/api/permission/set-permission
|
|
94
|
-
* `{ recordId, public:{role:'invalid'}, members:[{uid, role:'invalid'}...] }`
|
|
95
|
-
* (后端 role='invalid' → permission.None,即移除成员;见 spaceengine
|
|
96
|
-
* set_permission.go / protocol.go)。code===0 成功。
|
|
97
|
-
*
|
|
98
|
-
* 这是 ArtifactTool 上传时 set-permission(reader) 的逆操作,但覆盖面更全(含协作人)。
|
|
99
|
-
* agent override 条目(响应里的 agents)不在此处理:CLI 分享链路不会产生它们。
|
|
100
|
-
*/
|
|
101
|
-
private makeDocPrivate;
|
|
102
|
-
}
|
|
103
|
-
export {};
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { AuthenticationManager } from '@genie/authentication';
|
|
2
|
-
import { Session } from '../../vendor/cbc-core/node/index.js';
|
|
3
|
-
import { Agent, ToolNames } from '../../vendor/cbc-shared/node/index.js';
|
|
4
|
-
import { AbTestService, ProductManager } from '@genie/product';
|
|
5
|
-
import { Logger } from '@genie/telemetry';
|
|
6
|
-
import type { RunContext } from '@openai/agents';
|
|
7
|
-
import { z } from 'zod';
|
|
8
|
-
import { BaseTool } from './base-tool';
|
|
9
|
-
import { Tool, ToolResult } from './tool-protocol';
|
|
10
|
-
/**
|
|
11
|
-
* Artifact 工具参数:上传本地单个 HTML / Markdown 文件,发布为可分享的公网链接。
|
|
12
|
-
*
|
|
13
|
-
* `existingShareLink` 为空时新建节点;给定既有链接 / nodeId 时覆盖同一节点,
|
|
14
|
-
* 因而 republish 到同一个 URL(语义与「不给标识就是新建」一致)。
|
|
15
|
-
*/
|
|
16
|
-
declare const ArtifactParameters: z.ZodObject<{
|
|
17
|
-
filePath: z.ZodString;
|
|
18
|
-
existingShareLink: z.ZodOptional<z.ZodString>;
|
|
19
|
-
}, "strip", z.ZodTypeAny, {
|
|
20
|
-
filePath: string;
|
|
21
|
-
existingShareLink?: string | undefined;
|
|
22
|
-
}, {
|
|
23
|
-
filePath: string;
|
|
24
|
-
existingShareLink?: string | undefined;
|
|
25
|
-
}>;
|
|
26
|
-
/**
|
|
27
|
-
* Artifact 工具 —— 把本地 HTML / Markdown 发布为可渲染的公网分享链接(issue #81031 更名自 ShareLink)。
|
|
28
|
-
*
|
|
29
|
-
* 当前仅面向国内 / iOA / 内部 endpoint 开启,走【知识空间上传】
|
|
30
|
-
* (/space/api/view/import/*,与 WorkBuddy uploadToKnowledge 对齐)。国际 endpoint 暂不提供:
|
|
31
|
-
* 国际网关缺少 spaceengine 接口,暂不作为 CLI 分享链路。
|
|
32
|
-
*
|
|
33
|
-
* Markdown 由**服务端**渲染成样式化页面(后端按扩展名分流,`.md` 与 `.html` 同为一等公民),
|
|
34
|
-
* 客户端不做任何预渲染,只负责给出正确的 Content-Type。
|
|
35
|
-
*
|
|
36
|
-
* 全程仅用 CBC 自身会话的 access token(authManager.buildAuthHeaders)+
|
|
37
|
-
* productManager.getEndpoint(),无需额外 env / token。
|
|
38
|
-
*
|
|
39
|
-
* 开关见 artifact-common.isArtifactToolEnabled(env 新旧名 → 云端 feature 新旧 key → 缺省开)。
|
|
40
|
-
*/
|
|
41
|
-
export declare class ArtifactTool extends BaseTool implements Tool {
|
|
42
|
-
protected readonly authManager: AuthenticationManager;
|
|
43
|
-
protected readonly productManager: ProductManager;
|
|
44
|
-
protected readonly abTestService?: AbTestService;
|
|
45
|
-
protected readonly logger: Logger;
|
|
46
|
-
name: ToolNames;
|
|
47
|
-
aliases: string[];
|
|
48
|
-
description: string;
|
|
49
|
-
parameters: z.ZodObject<{
|
|
50
|
-
filePath: z.ZodString;
|
|
51
|
-
existingShareLink: z.ZodOptional<z.ZodString>;
|
|
52
|
-
}, "strip", z.ZodTypeAny, {
|
|
53
|
-
filePath: string;
|
|
54
|
-
existingShareLink?: string | undefined;
|
|
55
|
-
}, {
|
|
56
|
-
filePath: string;
|
|
57
|
-
existingShareLink?: string | undefined;
|
|
58
|
-
}>;
|
|
59
|
-
isEnabled: (_args: {
|
|
60
|
-
runContext: RunContext<Session>;
|
|
61
|
-
agent: Agent;
|
|
62
|
-
}) => Promise<boolean>;
|
|
63
|
-
execute(input: z.infer<typeof ArtifactParameters>, _context: RunContext<Session>): Promise<ToolResult>;
|
|
64
|
-
/**
|
|
65
|
-
* 把上传失败转成用户可读结果。
|
|
66
|
-
*
|
|
67
|
-
* 后端已把「文件过大 / 内容审核未通过」明确成业务错误码(见 WorkBuddy `share/facade.ts`
|
|
68
|
-
* 对 56040 / 619610 的 errorCode 回传),这里按同一口径给出精准文案,其余保留通用文案 +
|
|
69
|
-
* 诊断片段,确保任何失败都不会静默。
|
|
70
|
-
*
|
|
71
|
-
* 失败详情由调用方(uploadToKnowledge)以返回值传入,不落在实例字段——工具是单例,
|
|
72
|
-
* 若两次 execute() 并发(Agents SDK 一轮内并行跑多个工具调用),实例字段会被彼此覆盖,
|
|
73
|
-
* 导致一次调用报出另一次调用的错误码/诊断文案。
|
|
74
|
-
*/
|
|
75
|
-
private buildFailureResult;
|
|
76
|
-
/**
|
|
77
|
-
* 知识空间上传路径(国内 / iOA,严格复刻 WorkBuddy share/facade.ts uploadToKnowledge):
|
|
78
|
-
* 1. POST /space/api/view/import/uploadCredential → 预签名 URL + cosKey + STS 头
|
|
79
|
-
* 2. PUT 到 COS(带 STS 头)
|
|
80
|
-
* 3. POST /space/api/view/import/importLocalFileAsync → taskId
|
|
81
|
-
* 4. 轮询 /space/api/view/import/queryImportFileProgress → publishUrl
|
|
82
|
-
*
|
|
83
|
-
* 成功返回 `{ shareLink, nodeId }`,失败返回 `{ failure }`(诊断文案 + 可选的精准错误码)。
|
|
84
|
-
* 失败详情作为返回值而非实例字段传递,避免并发 execute() 调用互相覆盖对方的诊断状态。
|
|
85
|
-
*
|
|
86
|
-
* `nodeBlockId` 非空时后端覆盖该既有节点(见 workbuddy-server `share/contract.ts`
|
|
87
|
-
* 的 KnowledgeUploadParams.nodeBlockId),从而 republish 到同一链接。
|
|
88
|
-
*/
|
|
89
|
-
private uploadToKnowledge;
|
|
90
|
-
/**
|
|
91
|
-
* 把节点设为「互联网公开可读」(对齐 WorkBuddy `setPublicPermission` 的 public_read→reader)。
|
|
92
|
-
*
|
|
93
|
-
* 后端契约 POST /space/api/permission/set-permission:
|
|
94
|
-
* body `{ recordId: <nodeId>, public: { role: "reader" } }`,成功判据 code === 0
|
|
95
|
-
* (见 workbuddy-server `share/facade.ts` setPublicPermission)。
|
|
96
|
-
*
|
|
97
|
-
* markdown 导入的 doc 节点默认私有,必须补这一步分享链接才对外可读。
|
|
98
|
-
* 失败不视为致命错误:返回 `{ ok: false, detail }`,由调用方降级为「链接已生成但可能仍私有」的警告。
|
|
99
|
-
*/
|
|
100
|
-
private setPublicRead;
|
|
101
|
-
/**
|
|
102
|
-
* 轮询异步导入进度(与 WorkBuddy pollImportProgress 对齐)。
|
|
103
|
-
* 最长等待 60s,done 时返回结果,failed/超时返回 `{ failure }`。
|
|
104
|
-
*/
|
|
105
|
-
private pollImportProgress;
|
|
106
|
-
/** 归一化本地路径(兼容 file:// 与 Windows 盘符)。 */
|
|
107
|
-
private normalizeLocalPath;
|
|
108
|
-
}
|
|
109
|
-
export {};
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import type { RunContext } from '@openai/agents';
|
|
2
|
-
import { z } from 'zod';
|
|
3
|
-
import { type FunctionCallItem } from '../../vendor/cbc-shared/node/index.js';
|
|
4
|
-
import { SdkHooksManager } from '../control-signal/control-signal-protocol';
|
|
5
|
-
import { ElicitationService } from '../elicitation/elicitation-service';
|
|
6
|
-
import { Session } from '../../vendor/cbc-core/node/index.js';
|
|
7
|
-
import { BaseTool } from './base-tool';
|
|
8
|
-
import { Tool, ToolCallArgumentRenderer, ToolResult } from './tool-protocol';
|
|
9
|
-
import { ToolNames } from '../../vendor/cbc-shared/node/index.js';
|
|
10
|
-
/**
|
|
11
|
-
* 是否启用本 tool 的 env 开关。
|
|
12
|
-
* - 缺省 / 空串 / '0' / 'false' 视为关闭;
|
|
13
|
-
* - 其他任意非空值视为开启(与 CBC 其它 `CODEBUDDY_ENABLE_*` 家族保持一致)。
|
|
14
|
-
* 读取放在运行时方法内、每次调用时 live 读,遵循 packages/agent-cli/CODEBUDDY.md
|
|
15
|
-
* 的 prewarm env 契约(禁止模块顶层 / 构造函数固化 per-session env)。
|
|
16
|
-
*/
|
|
17
|
-
export declare const ASK_STRUCTURED_INPUT_ENV_FLAG = "CODEBUDDY_ENABLE_ASK_USER_FOR_STRUCTURED_INPUT";
|
|
18
|
-
export declare function isAskUserForStructuredInputEnvEnabled(): boolean;
|
|
19
|
-
declare const AskUserForStructuredInputParameters: z.ZodObject<{
|
|
20
|
-
message: z.ZodString;
|
|
21
|
-
requestedSchema: z.ZodObject<{
|
|
22
|
-
type: z.ZodLiteral<"object">;
|
|
23
|
-
properties: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
24
|
-
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
25
|
-
additionalProperties: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
27
|
-
type: z.ZodLiteral<"object">;
|
|
28
|
-
properties: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
29
|
-
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
30
|
-
additionalProperties: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
32
|
-
type: z.ZodLiteral<"object">;
|
|
33
|
-
properties: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
34
|
-
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
35
|
-
additionalProperties: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
37
|
-
}, "strip", z.ZodTypeAny, {
|
|
38
|
-
message: string;
|
|
39
|
-
requestedSchema: {
|
|
40
|
-
type: "object";
|
|
41
|
-
properties: Record<string, Record<string, unknown>>;
|
|
42
|
-
required?: string[] | undefined;
|
|
43
|
-
additionalProperties?: boolean | undefined;
|
|
44
|
-
} & {
|
|
45
|
-
[k: string]: unknown;
|
|
46
|
-
};
|
|
47
|
-
}, {
|
|
48
|
-
message: string;
|
|
49
|
-
requestedSchema: {
|
|
50
|
-
type: "object";
|
|
51
|
-
properties: Record<string, Record<string, unknown>>;
|
|
52
|
-
required?: string[] | undefined;
|
|
53
|
-
additionalProperties?: boolean | undefined;
|
|
54
|
-
} & {
|
|
55
|
-
[k: string]: unknown;
|
|
56
|
-
};
|
|
57
|
-
}>;
|
|
58
|
-
export type AskUserForStructuredInputInput = z.infer<typeof AskUserForStructuredInputParameters>;
|
|
59
|
-
export declare class AskUserForStructuredInputTool extends BaseTool implements Tool {
|
|
60
|
-
protected readonly elicitationService: ElicitationService;
|
|
61
|
-
protected readonly sdkHooksManager: SdkHooksManager;
|
|
62
|
-
name: ToolNames;
|
|
63
|
-
/**
|
|
64
|
-
* Description 保持精简 + 泛化,只讲"是什么、什么时候用",不绑定业务场景。
|
|
65
|
-
* 具体场景的用法(例如 MCP 授权征询)通过 `--append-system-prompt` 追加,
|
|
66
|
-
* 详见 `packages/agent-cli/prompts/examples/mcp-auth-elicitation.md`。
|
|
67
|
-
*/
|
|
68
|
-
description: string;
|
|
69
|
-
parameters: z.ZodObject<{
|
|
70
|
-
message: z.ZodString;
|
|
71
|
-
requestedSchema: z.ZodObject<{
|
|
72
|
-
type: z.ZodLiteral<"object">;
|
|
73
|
-
properties: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
74
|
-
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
75
|
-
additionalProperties: z.ZodOptional<z.ZodBoolean>;
|
|
76
|
-
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
77
|
-
type: z.ZodLiteral<"object">;
|
|
78
|
-
properties: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
79
|
-
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
80
|
-
additionalProperties: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
-
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
82
|
-
type: z.ZodLiteral<"object">;
|
|
83
|
-
properties: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
84
|
-
required: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
85
|
-
additionalProperties: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
-
}, z.ZodTypeAny, "passthrough">>;
|
|
87
|
-
}, "strip", z.ZodTypeAny, {
|
|
88
|
-
message: string;
|
|
89
|
-
requestedSchema: {
|
|
90
|
-
type: "object";
|
|
91
|
-
properties: Record<string, Record<string, unknown>>;
|
|
92
|
-
required?: string[] | undefined;
|
|
93
|
-
additionalProperties?: boolean | undefined;
|
|
94
|
-
} & {
|
|
95
|
-
[k: string]: unknown;
|
|
96
|
-
};
|
|
97
|
-
}, {
|
|
98
|
-
message: string;
|
|
99
|
-
requestedSchema: {
|
|
100
|
-
type: "object";
|
|
101
|
-
properties: Record<string, Record<string, unknown>>;
|
|
102
|
-
required?: string[] | undefined;
|
|
103
|
-
additionalProperties?: boolean | undefined;
|
|
104
|
-
} & {
|
|
105
|
-
[k: string]: unknown;
|
|
106
|
-
};
|
|
107
|
-
}>;
|
|
108
|
-
/**
|
|
109
|
-
* Tool 本身就是"征询用户答复",弹 UI 的语义已经内建在 elicitation/create
|
|
110
|
-
* 上;再走一层 session/request_permission 只会让用户点两次(先"允许"、
|
|
111
|
-
* 再填表单)。与 AskUserQuestion 同款处理:不走审批门。
|
|
112
|
-
*/
|
|
113
|
-
needsApproval: boolean;
|
|
114
|
-
argumentRenderer: ToolCallArgumentRenderer;
|
|
115
|
-
/**
|
|
116
|
-
* 门控:env + capability + 可用通道。任一未满足即从模型可见工具列表中移除。
|
|
117
|
-
* 与 AskUserQuestion 保持相同的写法风格,便于日后维护。
|
|
118
|
-
*/
|
|
119
|
-
isEnabled: (args: {
|
|
120
|
-
runContext: RunContext<Session>;
|
|
121
|
-
}) => boolean;
|
|
122
|
-
execute(input: AskUserForStructuredInputInput, context?: RunContext<Session>, details?: {
|
|
123
|
-
toolCall: FunctionCallItem;
|
|
124
|
-
}): Promise<ToolResult>;
|
|
125
|
-
private errorResult;
|
|
126
|
-
}
|
|
127
|
-
export {};
|