@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,203 +0,0 @@
|
|
|
1
|
-
import { Agent } from '@genie/product';
|
|
2
|
-
import { Session, SessionManager } from '../../vendor/cbc-core/node/index.js';
|
|
3
|
-
import { AgentManager } from '../../vendor/cbc-core/node/index.js';
|
|
4
|
-
export { isSessionBlank } from './main-agent-session';
|
|
5
|
-
/**
|
|
6
|
-
* 主 Agent 选择的 ACP 处理(设计 v0.6 §3.5/§3.6/§3.7)。
|
|
7
|
-
*
|
|
8
|
-
* 独立文件承载业务逻辑,acp-agent.ts 的 extMethod dispatch 只做接线:
|
|
9
|
-
* - `_codebuddy.ai/getAgents`:agents 目录(内置/自定义/插件,过滤内部编排 agent,
|
|
10
|
-
* 默认 agent 单独放行,broken 逐条隔离)+ currentAgentName + sessionBlank;
|
|
11
|
-
* - `session/set_agent`:校验链(会话类型 → opt-in/gate → agent 存在 → 仅空白会话)
|
|
12
|
-
* → 写 session.meta[mainAgent 键] + 同步 session.agentName + 显式 save()
|
|
13
|
-
* → 会话级模型联动(不落全局 settings)→ configChangeEvent。
|
|
14
|
-
*/
|
|
15
|
-
/** 目录条目(ACP 响应面,source 复用 AgentDisplaySource 真值) */
|
|
16
|
-
export interface MainAgentDirectoryEntry {
|
|
17
|
-
name: string;
|
|
18
|
-
displayName: string;
|
|
19
|
-
description?: string;
|
|
20
|
-
source: 'user' | 'project' | 'managed' | 'plugin' | 'cli-arg' | 'built-in';
|
|
21
|
-
custom: boolean;
|
|
22
|
-
/** 仅 agent 显式声明 model 时返回;未声明省略(避免误导"每 agent 有独立模型") */
|
|
23
|
-
modelId?: string;
|
|
24
|
-
/** 未声明 model → 继承全局(shouldInheritDefaultAgentSelection 语义) */
|
|
25
|
-
modelInherited?: boolean;
|
|
26
|
-
/** 解析失败原因(broken 语义:逐条隔离,不整体失败) */
|
|
27
|
-
broken?: string;
|
|
28
|
-
}
|
|
29
|
-
/** getAgents 响应 */
|
|
30
|
-
export interface GetAgentsResult {
|
|
31
|
-
defaultAgentName: string;
|
|
32
|
-
currentAgentName?: string;
|
|
33
|
-
sessionBlank?: boolean;
|
|
34
|
-
agents: MainAgentDirectoryEntry[];
|
|
35
|
-
}
|
|
36
|
-
/** set_agent 响应(模型目录为权威刷新源) */
|
|
37
|
-
export interface SetAgentResult {
|
|
38
|
-
agentName: string;
|
|
39
|
-
models: unknown[];
|
|
40
|
-
currentModelId: string;
|
|
41
|
-
sessionBlank: boolean;
|
|
42
|
-
}
|
|
43
|
-
/** handler 依赖面(由 acp-agent 注入,避免反向依赖) */
|
|
44
|
-
export interface MainAgentAcpDeps {
|
|
45
|
-
agentManager: AgentManager;
|
|
46
|
-
sessionManager: SessionManager;
|
|
47
|
-
/** 进程级 gate 同步布尔(MainAgentGateProvider.isEnabled()) */
|
|
48
|
-
gateEnabled(): boolean;
|
|
49
|
-
/** 连接维度 opt-in(clientCapabilities._meta['codebuddy.ai'].mainAgentSupport) */
|
|
50
|
-
optIn(): boolean;
|
|
51
|
-
/** 当前 ACP 连接 ID;用于校验目标 session 是否属于本连接。 */
|
|
52
|
-
connectionId?: string;
|
|
53
|
-
logger?: {
|
|
54
|
-
warn?: (msg: string, ...args: any[]) => void;
|
|
55
|
-
info?: (msg: string, ...args: any[]) => void;
|
|
56
|
-
};
|
|
57
|
-
/** 模型目录快照(set_agent 响应权威刷新源;由 acp-agent 提供现有 getModelsInfo 结果) */
|
|
58
|
-
resolveModels(session: Session): Promise<{
|
|
59
|
-
models: unknown[];
|
|
60
|
-
currentModelId: string;
|
|
61
|
-
}>;
|
|
62
|
-
/** thinking 联动(后端评审 P1-5):模型实际变化后清理会话级思考覆盖(对齐 set_model) */
|
|
63
|
-
reconcileThinking(session: Session): Promise<void>;
|
|
64
|
-
/** 触发 config 广播(configChangeEvent + acp-view 重算 configOptions) */
|
|
65
|
-
notifyConfigChanged(sessionId: string, configId: string, value: string): void;
|
|
66
|
-
/** settings 配置的默认主 agent(codebuddy.mainAgent.default,设置页"设默认") */
|
|
67
|
-
getConfiguredDefaultName(): Promise<string | undefined>;
|
|
68
|
-
/** 上次 chip 选择(codebuddy.mainAgent.lastUsed);不是「设为默认」 */
|
|
69
|
-
getLastUsedName?(): Promise<string | undefined>;
|
|
70
|
-
/** 用户显式选主 agent 后写入 lastUsed(不碰 default) */
|
|
71
|
-
persistLastUsedName?(name: string): Promise<void> | void;
|
|
72
|
-
/**
|
|
73
|
-
* ACP / Web UI locale for shipped-mode overlay.
|
|
74
|
-
* Omit / undefined → English. Only zh* / 中文 / chinese use Chinese.
|
|
75
|
-
* TUI must return undefined (`/language` is model reply language, not UI locale).
|
|
76
|
-
* Custom agents (including shipped-id homonyms like ptc.md) are not overlaid.
|
|
77
|
-
*/
|
|
78
|
-
getLanguage?(): Promise<string | undefined>;
|
|
79
|
-
}
|
|
80
|
-
/** gate/opt-in 未满足时的统一拒绝错误(由 acp-agent 映射为 methodNotFound) */
|
|
81
|
-
export declare class MainAgentNotEnabledError extends Error {
|
|
82
|
-
constructor();
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* 当前连接是否可以读取/改写该会话的 standing 主 agent。
|
|
86
|
-
*
|
|
87
|
-
* WorkBuddy(hostKind=unopted)一律不可见:Web `loadSession` / `renderConnection`
|
|
88
|
-
* 会把 `meta.acpConnectionId` 改绑到自己,但不能因此放开 picker / set_agent。
|
|
89
|
-
*
|
|
90
|
-
* TUI native / 已 opt-in 的 Web 会话:磁盘上常残留上一次 Web 的
|
|
91
|
-
* `acpConnectionId`(`renderConnection` 只改内存、未必 save)。新连接续接
|
|
92
|
-
* 同一会话时必须放行,否则 `getAgents` 会被映射成 methodNotFound。
|
|
93
|
-
*
|
|
94
|
-
* 未盖章且 owner 对不上:无 gate 时 fail-closed;owner 仍是 live/remembered
|
|
95
|
-
* unopted → 拒绝;owner 已不在连接表(getHostKind 回落 native)→ 视为过期
|
|
96
|
-
* TUI/Web id,放行。WorkBuddy 遗留只认 rememberedUnopted / 已盖 hostKind,
|
|
97
|
-
* 不会因为同进程有过 sidecar 就把所有未知 id 判成 unopted。
|
|
98
|
-
*/
|
|
99
|
-
export declare function isSessionVisibleToMainAgentRpc(session: Session | undefined, connectionId: string | undefined): boolean;
|
|
100
|
-
/**
|
|
101
|
-
* 校验目标 session 是否属于当前 ACP 连接。
|
|
102
|
-
*
|
|
103
|
-
* 请求级 handler(getAgents/set_agent)不能只按“调用方连接”的 gate 放行,否则
|
|
104
|
-
* opted-in 的 Web UI 连接可以读取/改写同进程 unopted WorkBuddy 会话的 standing
|
|
105
|
-
* 主 agent。ACP 创建的 session 都有 meta.acpConnectionId;缺失时视为兼容旧会话,
|
|
106
|
-
* 不额外拦截(避免 Web UI 对早期无 connectionId 的自身会话报 method not found)。
|
|
107
|
-
*/
|
|
108
|
-
export declare function assertSessionOwnedByConnection(session: Session, deps: MainAgentAcpDeps): void;
|
|
109
|
-
/**
|
|
110
|
-
* set_agent / getAgents 优先用内存常驻实例(Web 续接 TUI 后 owner 已改绑),
|
|
111
|
-
* 磁盘 `get()` 每次反序列化,可能仍是上一次 Web 的 acpConnectionId。
|
|
112
|
-
*/
|
|
113
|
-
export declare function resolveRuntimeSession(sessionId: string, disk: Session, deps: MainAgentAcpDeps): Session;
|
|
114
|
-
/**
|
|
115
|
-
* 生效的默认主 agent 名(设计 v0.6 §3.6,设置页"设默认"接入展示面)。
|
|
116
|
-
*
|
|
117
|
-
* gate/opt-in 关闭 → 产品默认(零影响);开启时 settings codebuddy.mainAgent.default
|
|
118
|
-
* 存在且 agentManager.get() 命中 → 用配置值;否则产品默认。展示(getAgents/
|
|
119
|
-
* configOptions/newSession/loadSession 的 defaultAgentName)与 run 解析链
|
|
120
|
-
* (resolveMainAgentForSession Step 2.5)同源,杜绝"默认值展示/执行分叉"。
|
|
121
|
-
*/
|
|
122
|
-
export declare function resolveEffectiveDefaultAgentName(deps: MainAgentAcpDeps): Promise<string>;
|
|
123
|
-
/**
|
|
124
|
-
* 构建 agents 目录(设计 v0.6 §3.6)。
|
|
125
|
-
*
|
|
126
|
-
* - 单一来源 agentManager.getAll()(agentMap 已含内置 + 自定义 + 插件);
|
|
127
|
-
* - 展示字段(description/tags/declaredModel)必须读 product config
|
|
128
|
-
* (agentManager.getAgentConfig)——getAll 返回的是 OpenAI 运行时 Agent 实例,
|
|
129
|
-
* 不携带这些产品配置字段(否则内置全错归 built-in、菜单无描述);
|
|
130
|
-
* - 过滤内部编排 agent(isHiddenAgent(includeInternal=false) 语义),
|
|
131
|
-
* **默认 agent 单独放行**(DEFAULT_AGENT_TAG 会被 hidden,需保证"切回默认"有候选);
|
|
132
|
-
* - source 复用 classifyAgentSource 真值('built-in' 带连字符);
|
|
133
|
-
* - modelId 只读显式声明(config.declaredModel),不调 getModel(避免 N 次阻塞解析);
|
|
134
|
-
* - 单 agent 解析失败记 broken,不整体失败。
|
|
135
|
-
*/
|
|
136
|
-
export declare function buildAgentDirectory(agentManager: AgentManager, options: {
|
|
137
|
-
defaultAgentName: string;
|
|
138
|
-
language?: string;
|
|
139
|
-
}): Promise<MainAgentDirectoryEntry[]>;
|
|
140
|
-
/**
|
|
141
|
-
* 展示/目录用的轻量主 agent 名。选名走 `pickMainAgentName`(与 run 同一条链),
|
|
142
|
-
* 只是存在性用 configNames,避免 chip 去等 `agentManager.get()` / MCP rebuild。
|
|
143
|
-
*/
|
|
144
|
-
export declare function resolveDisplayMainAgentName(session: Session | undefined, deps: MainAgentAcpDeps, configNames: Set<string>, defaultAgentName: string): Promise<string>;
|
|
145
|
-
/**
|
|
146
|
-
* `_codebuddy.ai/getAgents` 处理。
|
|
147
|
-
*/
|
|
148
|
-
export declare function handleGetAgents(params: {
|
|
149
|
-
sessionId?: string;
|
|
150
|
-
}, deps: MainAgentAcpDeps): Promise<GetAgentsResult>;
|
|
151
|
-
/**
|
|
152
|
-
* Chip / getAgents / set_agent / 新会话盖章只认四套 shipped + 带
|
|
153
|
-
* `mainAgent: true`(加载后 `main-agent-preset`)的自定义 agent。
|
|
154
|
-
* 普通自定义 .md / Explore / Plan 等子代理不能当站立主 Agent。
|
|
155
|
-
*/
|
|
156
|
-
export declare function isUserSettableMainAgent(agent: Agent, defaultAgentName: string): boolean;
|
|
157
|
-
/**
|
|
158
|
-
* 空白会话上应用 `--agent` / session/new `_meta` 指定的主 agent。
|
|
159
|
-
* 只用于**新建**空白会话:任意 user-settable 名(不限于 shipped standing)。
|
|
160
|
-
* 已有站立键或已有历史的会话不盖,除非 `overwriteExisting`(显式 `_meta`)。
|
|
161
|
-
* TUI native 在 `stampLastUsedOnNativeSession` 里先走这里盖进程 `--agent`
|
|
162
|
-
* (含 `mainAgent: true` 自定义),再盖 lastUsed。
|
|
163
|
-
* 存在性只读 `getAllConfigs()`(configReady),不 `get()`,以免 session/new
|
|
164
|
-
* 卡在 rebuild / MCP。
|
|
165
|
-
*/
|
|
166
|
-
export declare function applyUserSettableMainAgentIfBlank(session: Session, agentName: string | undefined, deps: MainAgentAcpDeps, options?: {
|
|
167
|
-
overwriteExisting?: boolean;
|
|
168
|
-
}): Promise<boolean>;
|
|
169
|
-
/**
|
|
170
|
-
* 应用主 agent 到会话(写持久键 + 镜像 + 落盘 + 模型联动)。
|
|
171
|
-
*
|
|
172
|
-
* set_agent 与 session/new `_meta['codebuddy.ai/agent']` 共用同一应用路径
|
|
173
|
-
* (终审 P1 对齐):写 session.meta[MAIN_AGENT_META_KEY] + 同步 agentName +
|
|
174
|
-
* 显式 save + 会话级模型联动(声明模型时二次 save + reconcileThinking)。
|
|
175
|
-
*/
|
|
176
|
-
export declare function applyMainAgentToSession(session: Session, agent: Agent, deps: MainAgentAcpDeps): Promise<void>;
|
|
177
|
-
/**
|
|
178
|
-
* 新**空白**会话在未显式选 agent 时,把 settings 默认或 lastUsed 盖成站立键。
|
|
179
|
-
* WorkBuddy:isEnabled() 为 false(未 opt-in)→ 不盖章。
|
|
180
|
-
* 已有 mainKey(请求带了 `_meta['codebuddy.ai/agent']`)→ 不覆盖。
|
|
181
|
-
* 已有历史 → 不盖(禁止把 lastUsed 写进 resume 会话)。
|
|
182
|
-
* 「设为默认」优先于 lastUsed。
|
|
183
|
-
* 存在性只读 `getAllConfigs()`(configReady),不得等待 runtime agent / MCP settle。
|
|
184
|
-
*/
|
|
185
|
-
export declare function maybeStampConfiguredDefaultOnNewSession(session: Session, deps: MainAgentAcpDeps): Promise<void>;
|
|
186
|
-
/**
|
|
187
|
-
* `session/set_agent` 处理(校验链 + 应用,设计 v0.6 §3.5/§3.7)。
|
|
188
|
-
*
|
|
189
|
-
* 校验顺序:会话类型(subagent/团队/后台拒绝)→ opt-in/gate → agent 存在
|
|
190
|
-
* → 仅空白会话可换(agent_switch_locked 语义由错误码承载)。
|
|
191
|
-
*
|
|
192
|
-
* 应用:
|
|
193
|
-
* 1. 写 session.meta[MAIN_AGENT_META_KEY] + 同步 session.agentName(镜像一致,@agent 语义配套)
|
|
194
|
-
* + 显式 sessionManager.save(session)(.meta.json 落盘,P0-2);
|
|
195
|
-
* 2. 模型联动(纯会话级):无显式覆盖且 agent 显式声明 model → 写
|
|
196
|
-
* requestOptions/options.model + setOverrideModel(**不调 cliSettingsProvider.set**);
|
|
197
|
-
* 3. configChangeEvent(configId='agent')触发 getConfigOptions 重算;
|
|
198
|
-
* 4. 响应带 models/currentModelId/sessionBlank(权威刷新源)。
|
|
199
|
-
*/
|
|
200
|
-
export declare function handleSetAgent(params: {
|
|
201
|
-
sessionId: string;
|
|
202
|
-
agentName: string;
|
|
203
|
-
}, deps: MainAgentAcpDeps): Promise<SetAgentResult>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 主 Agent 四种模式的唯一政策面。
|
|
3
|
-
*
|
|
4
|
-
* 优先级:环境变量 > settings.json `codebuddy.mainAgent` > 内置默认。
|
|
5
|
-
* 所有入口(Web / TUI / `codebuddy config` / `--settings` / ACP)只读这里。
|
|
6
|
-
*/
|
|
7
|
-
export declare const ENV_MAIN_AGENT_ENABLED = "CODEBUDDY_MAIN_AGENT_ENABLED";
|
|
8
|
-
export declare const ENV_MAIN_AGENT_ALLOW_UNOPTED = "CODEBUDDY_MAIN_AGENT_ALLOW_UNOPTED";
|
|
9
|
-
/** ACP 未声明 mainAgentSupport 的宿主(WorkBuddy Desktop / sidecar / 其它 IDE)。 */
|
|
10
|
-
export type MainAgentHostKind = 'native' | 'opted-in' | 'unopted';
|
|
11
|
-
export interface MainAgentPolicy {
|
|
12
|
-
/** 总闸。关:无 picker、无 standing 解析。缺省开。 */
|
|
13
|
-
readonly enabled: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* 未 opt-in 的 ACP 宿主是否也走 standing 解析。
|
|
16
|
-
* 缺省关:WorkBuddy 始终产品默认 cli。将来要开,只翻这一键。
|
|
17
|
-
*/
|
|
18
|
-
readonly allowUnopted: boolean;
|
|
19
|
-
/** 能力生效时,新会话的默认主 agent 名。 */
|
|
20
|
-
readonly defaultName?: string;
|
|
21
|
-
/**
|
|
22
|
-
* 上次 chip / 新建智能体选择。不是「设为默认」。
|
|
23
|
-
* 仅当 `default` 未配置时,空白新会话才回落到这里。
|
|
24
|
-
*/
|
|
25
|
-
readonly lastUsedName?: string;
|
|
26
|
-
}
|
|
27
|
-
export declare const DEFAULT_MAIN_AGENT_POLICY: MainAgentPolicy;
|
|
28
|
-
export declare function parseEnvFlag(raw: string | undefined): boolean | undefined;
|
|
29
|
-
export declare function trimOptionalName(value: unknown): string | undefined;
|
|
30
|
-
export declare function resolveMainAgentPolicy(settings: unknown, env?: NodeJS.Dict<string>): MainAgentPolicy;
|
|
31
|
-
/** standing 解析(mainKey / settings default)是否对当前宿主生效。 */
|
|
32
|
-
export declare function isStandingMainAgentActive(policy: MainAgentPolicy, hostKind: MainAgentHostKind): boolean;
|
|
33
|
-
export declare function hostKindFromClientOptIn(optedIn: boolean): MainAgentHostKind;
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { AgentRunInterceptor, AgentRunInterceptorPriority, AgentRunRequest, SessionRunStateMachine } from '../../vendor/cbc-core/node/index.js';
|
|
2
|
-
import { Logger } from '@genie/telemetry';
|
|
3
|
-
import { MemoryRelevanceService } from '../memory';
|
|
4
|
-
import { SettingsManager } from '../settings';
|
|
5
|
-
export declare class MemoryContextInterceptor implements AgentRunInterceptor {
|
|
6
|
-
priority: AgentRunInterceptorPriority;
|
|
7
|
-
protected readonly settingsManager: SettingsManager;
|
|
8
|
-
protected readonly logger: Logger;
|
|
9
|
-
protected readonly memoryRelevanceService?: MemoryRelevanceService;
|
|
10
|
-
protected readonly stateMachine: SessionRunStateMachine;
|
|
11
|
-
intercept(request: AgentRunRequest): Promise<void>;
|
|
12
|
-
/**
|
|
13
|
-
* 检查 Auto Memory 功能是否启用
|
|
14
|
-
*/
|
|
15
|
-
private isAutoMemoryEnabled;
|
|
16
|
-
/**
|
|
17
|
-
* 检查团队记忆是否启用
|
|
18
|
-
*/
|
|
19
|
-
private isTeamMemoryEnabled;
|
|
20
|
-
/**
|
|
21
|
-
* 获取团队用户 ID
|
|
22
|
-
*/
|
|
23
|
-
private getTeamUserId;
|
|
24
|
-
/**
|
|
25
|
-
* 检查 Typed Memory 是否启用(默认启用,与 Claude Code 对齐)
|
|
26
|
-
*/
|
|
27
|
-
private isTypedMemoryEnabled;
|
|
28
|
-
/**
|
|
29
|
-
* 判断是否应注入 Memory 上下文
|
|
30
|
-
*
|
|
31
|
-
* 不再仅依赖 session.options.continue 标记(/resume 等场景下可能未设置),
|
|
32
|
-
* 而是增加 fallback:检查第一条 user message 是否已包含 memory system-reminder。
|
|
33
|
-
* 确保 resume 后第一条 user message 的 content 结构与原始会话一致(prompt cache 一致性)。
|
|
34
|
-
*/
|
|
35
|
-
private shouldInjectMemoryContext;
|
|
36
|
-
/**
|
|
37
|
-
* 解析这次 run 的记忆落点。
|
|
38
|
-
*
|
|
39
|
-
* 同事(Agent Home colleague job)走私有分区 + 共享只读层(见
|
|
40
|
-
* agent-home-colleague-memory:上游 shard per assistant 的单写者纪律)。
|
|
41
|
-
* 不是同事时逐字节等同原实现——主 Agent / TUI / WorkBuddy 行为不变。
|
|
42
|
-
*/
|
|
43
|
-
private resolveMemoryScope;
|
|
44
|
-
/**
|
|
45
|
-
* 生成 Auto Memory 上下文提示
|
|
46
|
-
*/
|
|
47
|
-
private generateMemoryPrompt;
|
|
48
|
-
/**
|
|
49
|
-
* Typed Memory Prompt — 使用 buildMemoryPrompt() 与 Claude Code 对齐
|
|
50
|
-
*
|
|
51
|
-
* 包含:4 类型定义、What NOT to save(含显式保存门控)、
|
|
52
|
-
* When to access(含漂移警告)、Before recommending from memory
|
|
53
|
-
*/
|
|
54
|
-
private generateTypedMemoryPrompt;
|
|
55
|
-
/**
|
|
56
|
-
* Legacy Memory Prompt — 通用记忆格式(Typed Memory 关闭时使用)
|
|
57
|
-
*
|
|
58
|
-
* 保留独立实现,确保 typedMemory=false 时行为和改动前完全一致:
|
|
59
|
-
* - 无 4 类型系统
|
|
60
|
-
* - 无 YAML frontmatter 要求
|
|
61
|
-
* - 简化的 "What to save" / "What NOT to save" 指导
|
|
62
|
-
*/
|
|
63
|
-
private generateLegacyMemoryPrompt;
|
|
64
|
-
/**
|
|
65
|
-
* 注入相关记忆到当前请求
|
|
66
|
-
*
|
|
67
|
-
* ESC 取消支持:Memory Relevance Selection 会调用 memorySelector agent
|
|
68
|
-
* (AgentService.runOneTime),需要让用户在该阶段也能用 ESC 中断。
|
|
69
|
-
* 对齐 InsightsDataAgentRunInterceptor 的做法:
|
|
70
|
-
* 1. 通过 SessionRunStateMachine 推进到 AGENT_RUNNING,让 LoadingBox
|
|
71
|
-
* 的 ESC 逻辑立即生效(pending 态下 ESC 只会延后 abort)
|
|
72
|
-
* 2. 将主 run 的 abortSignal 透传给 selectRelevantMemories
|
|
73
|
-
* 3. abort 时通过 stateMachine.forceIdle 统一回到 IDLE
|
|
74
|
-
*/
|
|
75
|
-
private injectRelevantMemories;
|
|
76
|
-
/**
|
|
77
|
-
* 获取相关记忆内容(异步文件读取)
|
|
78
|
-
*/
|
|
79
|
-
private getRelevantMemoriesContent;
|
|
80
|
-
/**
|
|
81
|
-
* 从输入中提取最后一条用户消息的原始文本(去除 system-reminder 注入内容)
|
|
82
|
-
*/
|
|
83
|
-
private extractLastUserQuery;
|
|
84
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ProductManager } from '@genie/product';
|
|
2
|
-
import { AgentRunInterceptor, AgentRunRequest } from '../../vendor/cbc-core/node/index.js';
|
|
3
|
-
import { CommandManager } from '../command';
|
|
4
|
-
export declare class StreamJsonInitInterceptor implements AgentRunInterceptor {
|
|
5
|
-
priority: number;
|
|
6
|
-
protected readonly productManager: ProductManager;
|
|
7
|
-
protected readonly commandManager: CommandManager;
|
|
8
|
-
intercept(request: AgentRunRequest): Promise<void>;
|
|
9
|
-
}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import type { Session } from '../../vendor/cbc-core/node/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* Subagent spawn limits — 对齐 Claude Code 的 subagent 约束(机制差异见下文)。
|
|
4
|
-
*
|
|
5
|
-
* 与 Claude Code 的关系(已对 CC 源码核对):CC 的基线做法是「子代理拿不到 Agent
|
|
6
|
-
* 工具」——非 ant 用户的子代理工具集里直接移除 Agent,因此根本无法再 spawn(等效 0
|
|
7
|
-
* 层嵌套),并没有一个可配置的 depth 计数器。genie 在此之上加了两道自有闸(防御纵深,
|
|
8
|
-
* 精神对齐 CC「子代理不该无限繁殖」,而非逐字复刻 CC 的机制):
|
|
9
|
-
* - **Nesting depth**: 子代理到第 5 层不能再 spawn(固定,不可配置)。
|
|
10
|
-
* - **Per-session budget**: 每次 CLI 进程运行内最多 N 次 spawn,默认 200,可用
|
|
11
|
-
* CODEBUDDY_CODE_MAX_SUBAGENTS_PER_SESSION 上调(正整数,不能关)。计数存活于内存
|
|
12
|
-
* (`session.meta.subagentSpawnBudget`)。注意:该计数**不跨进程持久化**——meta.json
|
|
13
|
-
* 仅在会话创建时落盘(彼时 count=0),consumeSpawn 的增量不回写,故跨进程
|
|
14
|
-
* resume 会从 0 重新计数,`/clear` 新建 session 也重置。因此这道闸拦的是
|
|
15
|
-
* 「单次运行内失控刷 subagent」,而非会话整个生命周期的累计上限。
|
|
16
|
-
*
|
|
17
|
-
* Both counters live on `session.meta`:
|
|
18
|
-
* - `subagentDepth`: number of subagent levels below the main conversation
|
|
19
|
-
* (main session = 0). Stamped onto each sub-session at spawn.
|
|
20
|
-
* - `subagentSpawnBudget`: a `{ count }` object owned by the root session and
|
|
21
|
-
* SHARED by reference with every descendant sub-session, so nested spawns
|
|
22
|
-
* consume the same budget no matter which level initiates them.
|
|
23
|
-
*
|
|
24
|
-
* Scope note: propagation covers in-process subagents (AgentTask sync +
|
|
25
|
-
* in-process background/team members). Subprocess teammates (tmux/detached
|
|
26
|
-
* backends) run in their own OS process with a fresh session and are not
|
|
27
|
-
* chained into the parent budget.
|
|
28
|
-
*/
|
|
29
|
-
/** Fixed maximum nesting depth (levels below the main conversation). */
|
|
30
|
-
export declare const MAX_SUBAGENT_DEPTH = 5;
|
|
31
|
-
/** Default per-session subagent spawn budget. */
|
|
32
|
-
export declare const DEFAULT_MAX_SUBAGENTS_PER_SESSION = 200;
|
|
33
|
-
/** Env override for the per-session budget (positive integer, no upper bound). */
|
|
34
|
-
export declare const ENV_MAX_SUBAGENTS_PER_SESSION = "CODEBUDDY_CODE_MAX_SUBAGENTS_PER_SESSION";
|
|
35
|
-
export interface SubagentSpawnBudget {
|
|
36
|
-
count: number;
|
|
37
|
-
}
|
|
38
|
-
/** Depth of the given session below the main conversation (main = 0). */
|
|
39
|
-
export declare function getSubagentDepth(session: Pick<Session, 'meta'>): number;
|
|
40
|
-
/** Depth to stamp on a sub-session spawned FROM the given session. */
|
|
41
|
-
export declare function nextSubagentDepth(spawningSession: Pick<Session, 'meta'>): number;
|
|
42
|
-
/** Effective per-session budget: env override (positive int) or the default. */
|
|
43
|
-
export declare function getMaxSubagentsPerSession(): number;
|
|
44
|
-
/**
|
|
45
|
-
* The session's spawn budget object. Created lazily on the root session;
|
|
46
|
-
* sub-sessions receive the same object by reference at spawn time, so this
|
|
47
|
-
* returns the shared root budget for any session in the tree.
|
|
48
|
-
*/
|
|
49
|
-
export declare function getOrCreateSpawnBudget(session: Pick<Session, 'meta'>): SubagentSpawnBudget;
|
|
50
|
-
export type SpawnCheckResult = {
|
|
51
|
-
ok: true;
|
|
52
|
-
} | {
|
|
53
|
-
ok: false;
|
|
54
|
-
kind: 'depth' | 'budget';
|
|
55
|
-
reason: string;
|
|
56
|
-
};
|
|
57
|
-
/**
|
|
58
|
-
* Gate a spawn attempt from `spawningSession`: enforce the depth cap and the
|
|
59
|
-
* shared per-session budget WITHOUT consuming budget. Call once per Agent-tool
|
|
60
|
-
* dispatch, before any spawn path runs, so over-limit spawns are rejected
|
|
61
|
-
* early; pair with `consumeSpawn` after a spawn has actually succeeded, so
|
|
62
|
-
* failed attempts (invalid type, no active team, internal spawn failure) and
|
|
63
|
-
* resume calls never burn budget.
|
|
64
|
-
*/
|
|
65
|
-
export declare function checkSpawnAllowed(spawningSession: Pick<Session, 'meta'>): SpawnCheckResult;
|
|
66
|
-
/**
|
|
67
|
-
* Consume one unit of the shared session budget. Call only after a spawn has
|
|
68
|
-
* actually been created — never on resume calls or on failed spawn attempts.
|
|
69
|
-
*/
|
|
70
|
-
export declare function consumeSpawn(spawningSession: Pick<Session, 'meta'>): void;
|
|
71
|
-
/**
|
|
72
|
-
* Refund one unit after a spawn that never produced a result (sync / quick fail).
|
|
73
|
-
* Never decrements below 0.
|
|
74
|
-
*/
|
|
75
|
-
export declare function refundSpawn(spawningSession: Pick<Session, 'meta'>): void;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { PromptManager } from '@genie/prompts';
|
|
2
|
-
import { Logger } from '@genie/telemetry';
|
|
3
|
-
import { AgentRunInterceptor, AgentRunInterceptorPriority, AgentRunRequest } from '../../vendor/cbc-core/node/index.js';
|
|
4
|
-
/**
|
|
5
|
-
* TeamContextInterceptor injects the team communication prompt into sessions.
|
|
6
|
-
*
|
|
7
|
-
* Two modes:
|
|
8
|
-
* 1. Teammate sessions (session.meta.teamContext) — injects `team-sys-prompt` template
|
|
9
|
-
* 2. Main agent sessions in a team (formal or auto) — injects a team-lead prompt
|
|
10
|
-
* listing current teammates and how to communicate with them via SendMessage
|
|
11
|
-
*
|
|
12
|
-
* Priority 1175: runs after SystemReminderContext (1200) and before MemoryContext (1150),
|
|
13
|
-
* so the team prompt is injected alongside other system reminders.
|
|
14
|
-
*/
|
|
15
|
-
export declare class TeamContextInterceptor implements AgentRunInterceptor {
|
|
16
|
-
priority: AgentRunInterceptorPriority;
|
|
17
|
-
protected readonly promptManager: PromptManager;
|
|
18
|
-
protected readonly logger: Logger;
|
|
19
|
-
intercept(request: AgentRunRequest): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Inject team-sys-prompt template for teammate sessions.
|
|
22
|
-
*/
|
|
23
|
-
private injectTeammatePrompt;
|
|
24
|
-
/**
|
|
25
|
-
* Inject a prompt for the main agent (team-lead) when in a team (formal or auto).
|
|
26
|
-
* Uses the `team-lead-prompt` template which includes teammate listing,
|
|
27
|
-
* communication rules, worker prompt writing guides, and task workflow.
|
|
28
|
-
*/
|
|
29
|
-
private injectTeamLeadPrompt;
|
|
30
|
-
/**
|
|
31
|
-
* Decide whether to (re-)inject the team system reminder this turn.
|
|
32
|
-
*
|
|
33
|
-
* Returns true when any of the following holds:
|
|
34
|
-
* - First user message in the session
|
|
35
|
-
* - Resumed session (history not yet replayed)
|
|
36
|
-
* - The marker text is missing from history (e.g. context was compacted)
|
|
37
|
-
* - The current roster differs from the last roster we injected
|
|
38
|
-
* (so newly-spawned teammates show up without waiting for compaction)
|
|
39
|
-
*/
|
|
40
|
-
private shouldInjectTeamPrompt;
|
|
41
|
-
private recordInjectedRoster;
|
|
42
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { AgentInputItem } from '../../vendor/cbc-shared/node/index.js';
|
|
2
|
-
/**
|
|
3
|
-
* A narrowly-scoped capability carried by one real user turn.
|
|
4
|
-
*
|
|
5
|
-
* This is deliberately a run property, not Session state. A Session can have a
|
|
6
|
-
* cancelled/stale run finishing while a newer user prompt is already queued;
|
|
7
|
-
* putting the capability on Session would let the old run (or an internal team
|
|
8
|
-
* inbox drain) revive a teammate soft-paused by cancellation of its lead turn.
|
|
9
|
-
*/
|
|
10
|
-
export type TeamResumeIntent = 'human';
|
|
11
|
-
/** Mark a trusted user message as a real human team-resume turn. */
|
|
12
|
-
export declare function markHumanTeamResumeIntent(input: AgentInputItem[]): void;
|
|
13
|
-
export declare function hasHumanTeamResumeIntent(input: AgentInputItem[]): boolean;
|
|
14
|
-
/**
|
|
15
|
-
* Consume and strip human-turn markers after queue merge/drain.
|
|
16
|
-
*
|
|
17
|
-
* Stripping happens at priority 1775, before History (1400), so this internal
|
|
18
|
-
* capability can never be replayed from persisted conversation history.
|
|
19
|
-
*/
|
|
20
|
-
export declare function consumeHumanTeamResumeIntent(input: AgentInputItem[]): TeamResumeIntent | undefined;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Logger } from '@genie/telemetry';
|
|
2
|
-
import type { TeammateFailureInfo } from '../agent-team/team-member';
|
|
3
|
-
import { AgentRunInterceptor, AgentRunInterceptorPriority, AgentRunRequest } from '../../vendor/cbc-core/node/index.js';
|
|
4
|
-
/**
|
|
5
|
-
* Window within which a recorded teammate failure is still surfaced to the
|
|
6
|
-
* team-lead's system prompt. Older failures are ignored so stale errors do
|
|
7
|
-
* not keep re-polluting future turns.
|
|
8
|
-
*
|
|
9
|
-
* Kept in sync with `docs/workbuddy/fix/task-status-sync/issue-5-teammate-auth-failure.md` §4.3.
|
|
10
|
-
*/
|
|
11
|
-
export declare const TEAMMATE_FAILURE_TTL_MS: number;
|
|
12
|
-
/**
|
|
13
|
-
* Lightweight shape used by `formatTeammateFailuresBlock` — exported for
|
|
14
|
-
* unit tests that exercise the formatting logic without going through
|
|
15
|
-
* CellJS DI + TeamMemberRegistry.
|
|
16
|
-
*/
|
|
17
|
-
export interface TeammateFailureEntry {
|
|
18
|
-
name: string;
|
|
19
|
-
lastFailure?: TeammateFailureInfo;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Pure formatter: given a list of team members (each carrying an optional
|
|
23
|
-
* `lastFailure`) and a `now` timestamp, return the markdown body of the
|
|
24
|
-
* `<teammate-failures>` block, or undefined when there is nothing to report.
|
|
25
|
-
*
|
|
26
|
-
* Filters by TTL so stale failures older than {@link TEAMMATE_FAILURE_TTL_MS}
|
|
27
|
-
* are dropped.
|
|
28
|
-
*
|
|
29
|
-
* This function is the single source of truth for the block's contents so
|
|
30
|
-
* behavior can be verified by unit tests independent of CellJS.
|
|
31
|
-
*/
|
|
32
|
-
export declare function formatTeammateFailuresBlock(members: ReadonlyArray<TeammateFailureEntry>, now?: number): string | undefined;
|
|
33
|
-
/**
|
|
34
|
-
* Issue 5 · `TeammateFailureInterceptor`
|
|
35
|
-
*
|
|
36
|
-
* When the team-lead starts a new turn, inspect the TeamMemberRegistry for
|
|
37
|
-
* any teammates whose most recent AgentTask failed (non-silentAbort). For
|
|
38
|
-
* each such teammate within the TTL window, emit a `<teammate-failures>`
|
|
39
|
-
* `<system-reminder>` block so the main agent knows NOT to fabricate a
|
|
40
|
-
* success report and instead surfaces the failure to the user.
|
|
41
|
-
*
|
|
42
|
-
* Non-teammate / non-team-lead sessions are left untouched — `intercept`
|
|
43
|
-
* returns early.
|
|
44
|
-
*
|
|
45
|
-
* Design notes:
|
|
46
|
-
* - Runs at priority 1160 (between TeamContext=1175 and MemoryContext=1150)
|
|
47
|
-
* so the failure notice follows the team-lead instructions but precedes
|
|
48
|
-
* memory recall, reflecting its higher importance.
|
|
49
|
-
* - Reads failures from `TeamMember.lastFailure` which is populated by
|
|
50
|
-
* `AgentTask.execute()`'s failed branch (see agent-task.ts
|
|
51
|
-
* `recordTeammateFailure`). Error strings are already sanitized at write
|
|
52
|
-
* time (credentials / URL query stripped, <=500 chars).
|
|
53
|
-
* - Deduplicates within a prompt by checking for `TEAMMATE_FAILURES_MARKER`
|
|
54
|
-
* in the last user message — mirrors the pattern used by
|
|
55
|
-
* `TeamContextInterceptor.shouldInjectTeamPrompt`.
|
|
56
|
-
*/
|
|
57
|
-
export declare class TeammateFailureInterceptor implements AgentRunInterceptor {
|
|
58
|
-
priority: AgentRunInterceptorPriority;
|
|
59
|
-
protected readonly logger: Logger;
|
|
60
|
-
intercept(request: AgentRunRequest): Promise<void>;
|
|
61
|
-
/**
|
|
62
|
-
* Check whether the input already contains a `<teammate-failures>` block
|
|
63
|
-
* from a prior interceptor pass (e.g. resumed prompt). Deduplication
|
|
64
|
-
* mirrors `TeamContextInterceptor.shouldInjectTeamPrompt`.
|
|
65
|
-
*/
|
|
66
|
-
private hasExistingFailureMarker;
|
|
67
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 同事来信走 JobInboxConsumer → agentService.run,不经过 ACP prompt。
|
|
3
|
-
* attachInboxTurnToAcp 把 1:1 卡片推给已打开的对话;这一轮真的在跑模型时再接上流。
|
|
4
|
-
* 不下令回不回。
|
|
5
|
-
*/
|
|
6
|
-
import { type Session } from '../../vendor/cbc-core/node/index.js';
|
|
7
|
-
import { isAgentHomeChannelEnvelope, isAgentHomeColleagueEnvelope, looksLikeAgentHomeEnvelope } from '../../vendor/cbc-core/node/index.js';
|
|
8
|
-
export { isAgentHomeChannelEnvelope, isAgentHomeColleagueEnvelope, looksLikeAgentHomeEnvelope, };
|
|
9
|
-
export declare function attachInboxTurnToAcp(session: Session, text: string, options?: {
|
|
10
|
-
stream?: boolean;
|
|
11
|
-
}): void;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 自治建同事:域逻辑(校验 + 配额 + provenance + 审计)。
|
|
3
|
-
* 工具与 HTTP 共用同一份规则,不在两层各写一遍。
|
|
4
|
-
*
|
|
5
|
-
* 落盘必须进 withAgentHomeDirectoryLock;审计在锁内追加。
|
|
6
|
-
*/
|
|
7
|
-
import { type AgentHomeProfile } from './agent-home-directory';
|
|
8
|
-
import type { AgentHomeCreateErrorCode } from './agent-home-errors';
|
|
9
|
-
export interface CreateColleagueInput {
|
|
10
|
-
homeDir: string;
|
|
11
|
-
/** 发起者 agentId;undefined = 用户经 HTTP 建人。 */
|
|
12
|
-
creatorAgentId?: string;
|
|
13
|
-
name: string;
|
|
14
|
-
title?: string;
|
|
15
|
-
description?: string;
|
|
16
|
-
engine?: string;
|
|
17
|
-
/** 固定跑哪个模型;缺省跟随产品默认。 */
|
|
18
|
-
model?: string;
|
|
19
|
-
/** 固定权限模式;必须是 CLI 认的值(见 isCliProcessPermissionMode)。 */
|
|
20
|
-
permissionMode?: string;
|
|
21
|
-
homeCwd?: string;
|
|
22
|
-
now?: number;
|
|
23
|
-
}
|
|
24
|
-
export type CreateColleagueResult = {
|
|
25
|
-
ok: true;
|
|
26
|
-
agent: AgentHomeProfile;
|
|
27
|
-
} | {
|
|
28
|
-
ok: false;
|
|
29
|
-
error: AgentHomeCreateErrorCode;
|
|
30
|
-
};
|
|
31
|
-
export declare function createAgentHomeColleague(input: CreateColleagueInput): Promise<CreateColleagueResult>;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 审计落点:建人/建频道/任务转换/唤醒投递都往 `agent-home/audit.jsonl` 追一行。
|
|
3
|
-
* 审计失败不影响主流程;1MB 轮转 .old(读回要连 .old 一起读,见 readAgentHomeAudit)。
|
|
4
|
-
*/
|
|
5
|
-
export type AgentHomeAuditType = 'colleague_created' | 'channel_created'
|
|
6
|
-
/** 同一批人的频道已存在,复用了它。 */
|
|
7
|
-
| 'channel_reused' | 'channel_member_added' | 'wake_delivered'
|
|
8
|
-
/** 同一棒太久没回,又催了一次(对齐上游 ack 重投)。 */
|
|
9
|
-
| 'wake_nudged' | 'wake_skipped'
|
|
10
|
-
/** 自动链被互叫护栏挡下(同轮去重 / 窗口限速):消息照留,只是不叫人。 */
|
|
11
|
-
| 'wake_throttled'
|
|
12
|
-
/** 任务完成 / 批次完成直接回报主 Agent:写了一封进主邮箱。 */
|
|
13
|
-
| 'main_mail_enqueued'
|
|
14
|
-
/** 目录(预览/未读)写失败:jsonl 已落,但侧栏可能落后,留痕便于排查。 */
|
|
15
|
-
| 'directory_write_failed'
|
|
16
|
-
/** 任务板写失败:什么都没改(写在投影之前),换领域错误码 BOARD_WRITE_FAILED 返回。 */
|
|
17
|
-
| 'board_write_failed'
|
|
18
|
-
/** 事件行投影写失败:板已更新、时间线少这一行,不留痕就无从排查。 */
|
|
19
|
-
| 'transcript_write_failed'
|
|
20
|
-
/** 主 Agent 邮箱里有认不出来的信:已隔离(不删),留痕说明为什么没投。 */
|
|
21
|
-
| 'main_mail_quarantined'
|
|
22
|
-
/** 投给主会话成功(信已进历史 + 跑起一轮):留痕带信龄与目标会话,排查"投给谁"用。 */
|
|
23
|
-
| 'main_mail_delivered'
|
|
24
|
-
/**
|
|
25
|
-
* 暂时不投(信留在盘上,不删不丢):全新会话没开口 / 该投给别的活跃会话 / 旧信等用户在。
|
|
26
|
-
* fields.reason = hold-targeted-session | hold-no-user-turn | hold-other-session | hold-stale。
|
|
27
|
-
*/
|
|
28
|
-
| 'main_mail_held'
|
|
29
|
-
/** 旧格式(无 message_id)的信已在历史里:只跳过不删(判等会回落到正文,删了可能永久丢信)。 */
|
|
30
|
-
| 'main_mail_skipped_legacy';
|
|
31
|
-
export interface AgentHomeAuditEvent {
|
|
32
|
-
type: AgentHomeAuditType;
|
|
33
|
-
at: number;
|
|
34
|
-
/** 发起者 agentId;用户操作 = 'user'。 */
|
|
35
|
-
actorAgentId?: string;
|
|
36
|
-
channelId?: string;
|
|
37
|
-
taskId?: string;
|
|
38
|
-
/** 事件主体(被建的人 / 被唤醒的人)。 */
|
|
39
|
-
targetAgentId?: string;
|
|
40
|
-
fields?: Record<string, unknown>;
|
|
41
|
-
}
|
|
42
|
-
export declare function agentHomeAuditPath(homeDir: string): string;
|
|
43
|
-
export declare function appendAgentHomeAudit(homeDir: string, event: Omit<AgentHomeAuditEvent, 'at'> & {
|
|
44
|
-
at?: number;
|
|
45
|
-
}): Promise<void>;
|
|
46
|
-
/**
|
|
47
|
-
* 免锁读审计(配额判据 / 排查)。坏行跳过。
|
|
48
|
-
*
|
|
49
|
-
* 轮转后事件会分在两个文件里(上一段在 `.old`),只读主文件会让"最近一小时建了几次"
|
|
50
|
-
* 这类窗口判据在轮转那一刻凭空少一段。按时间顺序读:先 .old 再主文件。
|
|
51
|
-
*
|
|
52
|
-
* 当前生产代码没有调用方:留着给排查 / 未来的导出入口用(审计行写了没人读等于没写)。
|
|
53
|
-
*/
|
|
54
|
-
export declare function readAgentHomeAudit(homeDir: string): Promise<AgentHomeAuditEvent[]>;
|