@tencent-ai/agent-sdk 0.3.252 → 0.3.253

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.
Files changed (208) hide show
  1. package/cli/CHANGELOG.md +22 -0
  2. package/cli/dist/codebuddy-headless.js +73 -58
  3. package/cli/dist/codebuddy-lite-wb.mjs +96 -81
  4. package/cli/dist/lazy/{427.68132a34.js → 427.74b982af.js} +4 -4
  5. package/cli/dist/lazy-headless/{834.391fb41e.js → 834.3b674e07.js} +9 -9
  6. package/cli/dist-server/3556.codebuddy.js +1 -1
  7. package/cli/dist-server/6037.codebuddy.js +1 -1
  8. package/cli/dist-server/6784.codebuddy.js +1 -1
  9. package/cli/dist-server/codebuddy.js +45 -30
  10. package/cli/dist-server/types/node/agent/openai-agents-types.d.ts +5 -5
  11. package/cli/dist-server/types/node/mcp/mcp-sdk-values.d.ts +1 -1
  12. package/cli/dist-server/types/node/model/model-provider.d.ts +3 -1
  13. package/cli/dist-server/types/node/tools/a2a-get-task-tool.d.ts +139 -34
  14. package/cli/dist-server/types/node/tools/a2a-poll-retry.d.ts +46 -0
  15. package/cli/package.json +1 -1
  16. package/cli/product.cloudhosted.json +2 -2
  17. package/cli/product.internal.json +2 -2
  18. package/cli/product.ioa.json +2 -2
  19. package/cli/product.json +4 -4
  20. package/cli/product.selfhosted.json +2 -2
  21. package/package.json +1 -1
  22. package/cli/dist-server/types/node/acp/acp-view-rewind-to.d.ts +0 -34
  23. package/cli/dist-server/types/node/acp/acp-web-ui-client.d.ts +0 -22
  24. package/cli/dist-server/types/node/acp/usage-by-category-calculator.d.ts +0 -45
  25. package/cli/dist-server/types/node/acp/usage-by-category-char-weight.d.ts +0 -9
  26. package/cli/dist-server/types/node/acp/usage-by-category-distribute.d.ts +0 -6
  27. package/cli/dist-server/types/node/acp/usage-by-category-tools-split.d.ts +0 -11
  28. package/cli/dist-server/types/node/agent-home/agent-home-envelope-body.d.ts +0 -54
  29. package/cli/dist-server/types/node/agent-home/agent-home-inbox-events.d.ts +0 -14
  30. package/cli/dist-server/types/node/agent-home/agent-home-room-contacts.d.ts +0 -30
  31. package/cli/dist-server/types/node/agent-team/permission-bridge-client.d.ts +0 -32
  32. package/cli/dist-server/types/node/agent-team/permission-bridge-protocol.d.ts +0 -47
  33. package/cli/dist-server/types/node/agent-view/handoff-policy.d.ts +0 -80
  34. package/cli/dist-server/types/node/agent-view/job-respawn-prefs.d.ts +0 -12
  35. package/cli/dist-server/types/node/agent-view/session-handoff.d.ts +0 -161
  36. package/cli/dist-server/types/node/ask/index.d.ts +0 -3
  37. package/cli/dist-server/types/node/bash-sandbox/bash-sandbox-manager.d.ts +0 -125
  38. package/cli/dist-server/types/node/bash-sandbox/legacy-sandbox-shell-service.d.ts +0 -33
  39. package/cli/dist-server/types/node/bash-sandbox/managed-security-policy.d.ts +0 -6
  40. package/cli/dist-server/types/node/bash-sandbox/workbuddy-directory-protection.d.ts +0 -12
  41. package/cli/dist-server/types/node/checkpoint/checkpoint-service.d.ts +0 -70
  42. package/cli/dist-server/types/node/checkpoint/file-changes-controller.d.ts +0 -29
  43. package/cli/dist-server/types/node/checkpoint/file-track-service.d.ts +0 -11
  44. package/cli/dist-server/types/node/checkpoint/file-version-manager.d.ts +0 -10
  45. package/cli/dist-server/types/node/checkpoint/file-version-store.d.ts +0 -9
  46. package/cli/dist-server/types/node/checkpoint/file-version-update-strategies.d.ts +0 -62
  47. package/cli/dist-server/types/node/command/add-dir-command-executor.d.ts +0 -11
  48. package/cli/dist-server/types/node/command/agents-command-executor.d.ts +0 -9
  49. package/cli/dist-server/types/node/command/auto-compact-command-executor.d.ts +0 -20
  50. package/cli/dist-server/types/node/command/background-command-executor.d.ts +0 -29
  51. package/cli/dist-server/types/node/command/btw-command-executor.d.ts +0 -19
  52. package/cli/dist-server/types/node/command/clear-command-executor.d.ts +0 -17
  53. package/cli/dist-server/types/node/command/config-command-executor.d.ts +0 -15
  54. package/cli/dist-server/types/node/command/context-command-executor.d.ts +0 -42
  55. package/cli/dist-server/types/node/command/copy-command-executor.d.ts +0 -10
  56. package/cli/dist-server/types/node/command/cost-command-executor.d.ts +0 -13
  57. package/cli/dist-server/types/node/command/debug-command-executor.d.ts +0 -15
  58. package/cli/dist-server/types/node/command/deep-research-command-executor.d.ts +0 -25
  59. package/cli/dist-server/types/node/command/doctor-command-executor.d.ts +0 -7
  60. package/cli/dist-server/types/node/command/effort-command-executor.d.ts +0 -46
  61. package/cli/dist-server/types/node/command/exit-command-executor.d.ts +0 -14
  62. package/cli/dist-server/types/node/command/export-command-executor.d.ts +0 -7
  63. package/cli/dist-server/types/node/command/feedback-command-executor.d.ts +0 -9
  64. package/cli/dist-server/types/node/command/fork-bg-command-executor.d.ts +0 -30
  65. package/cli/dist-server/types/node/command/fork-command-executor.d.ts +0 -28
  66. package/cli/dist-server/types/node/command/goal-command-executor.d.ts +0 -50
  67. package/cli/dist-server/types/node/command/handoff-message-adapter.d.ts +0 -9
  68. package/cli/dist-server/types/node/command/help-command-executor.d.ts +0 -9
  69. package/cli/dist-server/types/node/command/hooks-command-executor.d.ts +0 -9
  70. package/cli/dist-server/types/node/command/ide-command-executor.d.ts +0 -11
  71. package/cli/dist-server/types/node/command/mcp-command-executor.d.ts +0 -15
  72. package/cli/dist-server/types/node/command/memory-command-executor.d.ts +0 -17
  73. package/cli/dist-server/types/node/command/mode-command-executor.d.ts +0 -11
  74. package/cli/dist-server/types/node/command/model-command-executor.d.ts +0 -11
  75. package/cli/dist-server/types/node/command/model-image-to-image-command-executor.d.ts +0 -17
  76. package/cli/dist-server/types/node/command/model-image-to-video-command-executor.d.ts +0 -17
  77. package/cli/dist-server/types/node/command/model-lite-command-executor.d.ts +0 -17
  78. package/cli/dist-server/types/node/command/model-reasoning-command-executor.d.ts +0 -17
  79. package/cli/dist-server/types/node/command/model-text-to-image-command-executor.d.ts +0 -17
  80. package/cli/dist-server/types/node/command/model-text-to-video-command-executor.d.ts +0 -17
  81. package/cli/dist-server/types/node/command/multitask-command-executor.d.ts +0 -9
  82. package/cli/dist-server/types/node/command/permissions-command-executor.d.ts +0 -9
  83. package/cli/dist-server/types/node/command/plan-command-executor.d.ts +0 -11
  84. package/cli/dist-server/types/node/command/plugin-command-executor.d.ts +0 -25
  85. package/cli/dist-server/types/node/command/plugin-validate-command-executor.d.ts +0 -21
  86. package/cli/dist-server/types/node/command/release-notes-command-executor.d.ts +0 -18
  87. package/cli/dist-server/types/node/command/reload-plugins-command-executor.d.ts +0 -24
  88. package/cli/dist-server/types/node/command/remote-control-command-executor.d.ts +0 -44
  89. package/cli/dist-server/types/node/command/rename-command-executor.d.ts +0 -11
  90. package/cli/dist-server/types/node/command/reset-command-executor.d.ts +0 -9
  91. package/cli/dist-server/types/node/command/resume-command-executor.d.ts +0 -21
  92. package/cli/dist-server/types/node/command/rewind-command-executor.d.ts +0 -10
  93. package/cli/dist-server/types/node/command/sandbox-command-executor.d.ts +0 -20
  94. package/cli/dist-server/types/node/command/save-workflow-command-executor.d.ts +0 -43
  95. package/cli/dist-server/types/node/command/session-reset-notifier.d.ts +0 -23
  96. package/cli/dist-server/types/node/command/skills-command-executor.d.ts +0 -9
  97. package/cli/dist-server/types/node/command/stats-command-executor.d.ts +0 -11
  98. package/cli/dist-server/types/node/command/status-command-executor.d.ts +0 -11
  99. package/cli/dist-server/types/node/command/tasks-command-executor.d.ts +0 -9
  100. package/cli/dist-server/types/node/command/terminal-setup-command-executor.d.ts +0 -7
  101. package/cli/dist-server/types/node/command/theme-command-executor.d.ts +0 -7
  102. package/cli/dist-server/types/node/command/todos-command-executor.d.ts +0 -16
  103. package/cli/dist-server/types/node/command/upgrade-command-executor.d.ts +0 -13
  104. package/cli/dist-server/types/node/command/vim-command-executor.d.ts +0 -11
  105. package/cli/dist-server/types/node/command/workflows-command-executor.d.ts +0 -26
  106. package/cli/dist-server/types/node/feedback/feedback-protocol.d.ts +0 -32
  107. package/cli/dist-server/types/node/feedback/feedback-service.d.ts +0 -19
  108. package/cli/dist-server/types/node/feedback/index.d.ts +0 -2
  109. package/cli/dist-server/types/node/goal/goal-policy.d.ts +0 -55
  110. package/cli/dist-server/types/node/goal/goal-protocol.d.ts +0 -178
  111. package/cli/dist-server/types/node/goal/goal-service.d.ts +0 -201
  112. package/cli/dist-server/types/node/goal/goal-session-start-hook.d.ts +0 -24
  113. package/cli/dist-server/types/node/hooks/parse-frontmatter-hooks.d.ts +0 -42
  114. package/cli/dist-server/types/node/install/index.d.ts +0 -6
  115. package/cli/dist-server/types/node/install/install-controller.d.ts +0 -15
  116. package/cli/dist-server/types/node/install/install-env.d.ts +0 -12
  117. package/cli/dist-server/types/node/install/install-errors.d.ts +0 -46
  118. package/cli/dist-server/types/node/install/install-protocol.d.ts +0 -83
  119. package/cli/dist-server/types/node/install/install-service.d.ts +0 -36
  120. package/cli/dist-server/types/node/install/install-utils.d.ts +0 -7
  121. package/cli/dist-server/types/node/install/releases-service.d.ts +0 -18
  122. package/cli/dist-server/types/node/install/shell-setup.d.ts +0 -36
  123. package/cli/dist-server/types/node/mcp/mcp-cancellation.d.ts +0 -65
  124. package/cli/dist-server/types/node/mcp/mcp-controller.d.ts +0 -56
  125. package/cli/dist-server/types/node/mcp/mcp-model-id-header-helper.d.ts +0 -12
  126. package/cli/dist-server/types/node/mcp/mcp-oauth-callback-html.d.ts +0 -6
  127. package/cli/dist-server/types/node/mcp/mcp-oauth-controller.d.ts +0 -26
  128. package/cli/dist-server/types/node/mcp/mcp-output-storage.d.ts +0 -57
  129. package/cli/dist-server/types/node/mcp/mcp-server-override-impl.d.ts +0 -136
  130. package/cli/dist-server/types/node/mcp/mcp-server-override.d.ts +0 -29
  131. package/cli/dist-server/types/node/mcp/mcp-tool-result-sideband.d.ts +0 -26
  132. package/cli/dist-server/types/node/mcp/mcp-validate-middleware.d.ts +0 -25
  133. package/cli/dist-server/types/node/mcp/models/mcp-server.d.ts +0 -18
  134. package/cli/dist-server/types/node/mcp/node-websocket-transport.d.ts +0 -38
  135. package/cli/dist-server/types/node/mcp/official-mcp-egress-policy.d.ts +0 -17
  136. package/cli/dist-server/types/node/mcp/sdk-mcp-server.d.ts +0 -143
  137. package/cli/dist-server/types/node/mcp/sdk-mcp-transport.d.ts +0 -97
  138. package/cli/dist-server/types/node/message-queue/followup-queue.d.ts +0 -35
  139. package/cli/dist-server/types/node/message-queue/index.d.ts +0 -11
  140. package/cli/dist-server/types/node/plugins/concurrency.d.ts +0 -1
  141. package/cli/dist-server/types/node/plugins/dependency-resolver.d.ts +0 -43
  142. package/cli/dist-server/types/node/plugins/directory-plugin-cache-projection.d.ts +0 -2
  143. package/cli/dist-server/types/node/plugins/guards/index.d.ts +0 -2
  144. package/cli/dist-server/types/node/plugins/guards/weixinpay-integrity-guard.d.ts +0 -15
  145. package/cli/dist-server/types/node/plugins/installers/git-plugin-installer.d.ts +0 -42
  146. package/cli/dist-server/types/node/plugins/installers/git-subdir-plugin-installer.d.ts +0 -19
  147. package/cli/dist-server/types/node/plugins/installers/index.d.ts +0 -4
  148. package/cli/dist-server/types/node/plugins/installers/local-plugin-installer.d.ts +0 -40
  149. package/cli/dist-server/types/node/plugins/installers/npm-plugin-installer.d.ts +0 -23
  150. package/cli/dist-server/types/node/plugins/loaders/agent-loader.d.ts +0 -43
  151. package/cli/dist-server/types/node/plugins/loaders/command-loader.d.ts +0 -37
  152. package/cli/dist-server/types/node/plugins/loaders/hook-loader.d.ts +0 -55
  153. package/cli/dist-server/types/node/plugins/loaders/index.d.ts +0 -8
  154. package/cli/dist-server/types/node/plugins/loaders/lsp-loader.d.ts +0 -47
  155. package/cli/dist-server/types/node/plugins/loaders/mcp-loader.d.ts +0 -75
  156. package/cli/dist-server/types/node/plugins/loaders/output-style-loader.d.ts +0 -49
  157. package/cli/dist-server/types/node/plugins/loaders/plugin-loader-manager.d.ts +0 -49
  158. package/cli/dist-server/types/node/plugins/loaders/skill-loader.d.ts +0 -45
  159. package/cli/dist-server/types/node/plugins/marketplace-name-validator.d.ts +0 -50
  160. package/cli/dist-server/types/node/plugins/marketplace-path-safety.d.ts +0 -86
  161. package/cli/dist-server/types/node/plugins/marketplaces/base-marketplace.d.ts +0 -43
  162. package/cli/dist-server/types/node/plugins/marketplaces/builtin-marketplace-provider.d.ts +0 -22
  163. package/cli/dist-server/types/node/plugins/marketplaces/directory-marketplace.d.ts +0 -19
  164. package/cli/dist-server/types/node/plugins/marketplaces/git-availability-detector.d.ts +0 -62
  165. package/cli/dist-server/types/node/plugins/marketplaces/git-fallback-coordinator.d.ts +0 -42
  166. package/cli/dist-server/types/node/plugins/marketplaces/git-to-zip-url-converter.d.ts +0 -50
  167. package/cli/dist-server/types/node/plugins/marketplaces/github-marketplace.d.ts +0 -41
  168. package/cli/dist-server/types/node/plugins/marketplaces/http-marketplace.d.ts +0 -47
  169. package/cli/dist-server/types/node/plugins/marketplaces/index.d.ts +0 -13
  170. package/cli/dist-server/types/node/plugins/marketplaces/marketplace-config-manager.d.ts +0 -39
  171. package/cli/dist-server/types/node/plugins/marketplaces/marketplace-factory.d.ts +0 -11
  172. package/cli/dist-server/types/node/plugins/marketplaces/marketplace-storage.d.ts +0 -141
  173. package/cli/dist-server/types/node/plugins/marketplaces/marketplace-update-checker.d.ts +0 -38
  174. package/cli/dist-server/types/node/plugins/marketplaces/workspace-project-root.d.ts +0 -14
  175. package/cli/dist-server/types/node/plugins/marketplaces/zip-marketplace.d.ts +0 -134
  176. package/cli/dist-server/types/node/plugins/mcpb-handler.d.ts +0 -29
  177. package/cli/dist-server/types/node/plugins/plugin-controller.d.ts +0 -75
  178. package/cli/dist-server/types/node/plugins/plugin-error-collector.d.ts +0 -17
  179. package/cli/dist-server/types/node/plugins/plugin-install-stats-service.d.ts +0 -20
  180. package/cli/dist-server/types/node/plugins/plugin-manager.d.ts +0 -692
  181. package/cli/dist-server/types/node/plugins/plugin-policy-service.d.ts +0 -53
  182. package/cli/dist-server/types/node/plugins/plugin-validator.d.ts +0 -48
  183. package/cli/dist-server/types/node/plugins/zip-utils.d.ts +0 -93
  184. package/cli/dist-server/types/node/remote-control/clients/liveness-watchdog.d.ts +0 -56
  185. package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-activity.d.ts +0 -23
  186. package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-auth.d.ts +0 -64
  187. package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-client-factory.d.ts +0 -47
  188. package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-client.d.ts +0 -191
  189. package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-inbound.d.ts +0 -7
  190. package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-interaction.d.ts +0 -142
  191. package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-live.d.ts +0 -78
  192. package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-media.d.ts +0 -35
  193. package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-qr-bind.d.ts +0 -49
  194. package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-respond-queue.d.ts +0 -33
  195. package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-types.d.ts +0 -207
  196. package/cli/dist-server/types/node/remote-control/remote-control-protocol.d.ts +0 -288
  197. package/cli/dist-server/types/node/remote-gateway/gateway-protocol.d.ts +0 -502
  198. package/cli/dist-server/types/node/remote-gateway/utils/qrcode-utils.d.ts +0 -16
  199. package/cli/dist-server/types/node/session/session-preview-utils.d.ts +0 -30
  200. package/cli/dist-server/types/node/settings/model-setting-utils.d.ts +0 -2
  201. package/cli/dist-server/types/node/tool-control/tool-control-policy.d.ts +0 -35
  202. package/cli/dist-server/types/node/tools/auto-mode/auto-mode-critique-client.d.ts +0 -51
  203. package/cli/dist-server/types/node/tools/auto-mode/auto-mode-strategy.d.ts +0 -19
  204. package/cli/dist-server/types/node/utils/add-dir-utils.d.ts +0 -20
  205. package/cli/dist-server/types/node/utils/compress-path.source.d.ts +0 -59
  206. package/cli/dist-server/types/node/vim/index.d.ts +0 -2
  207. package/cli/dist-server/types/node/vim/vim-manager.d.ts +0 -12
  208. package/cli/dist-server/types/node/vim/vim-protocol.d.ts +0 -24
@@ -26,8 +26,8 @@
26
26
  * 未 preload 直接用 `new Agent(...)` 会 fail-loud(TypeError: undefined is not
27
27
  * a constructor)——刻意设计,静默 sync require 回退会让整个 lazy 化归零。
28
28
  */
29
- import type { Agent as AgentTypeCtor, AgentConfiguration, AgentInputItem as OriginalAgentInputItem, AgentOptions, AssistantMessageItem as OriginalAssistantMessageItem, ComputerCallResultItem as OriginalComputerCallResultItem, ComputerUseCallItem as OriginalComputerUseCallItem, FunctionCallItem as OriginalFunctionCallItem, FunctionCallResultItem as OriginalFunctionCallResultItem, FunctionTool as FunctionToolTypeCtor, Handoff as HandoffTypeCtor, handoff as handoffFn, HostedToolCallItem as OriginalHostedToolCallItem, Model as ModelType, ModelProvider as ModelProviderType, NonStreamRunOptions, OpenAIChatCompletionsModel as OpenAIChatCompletionsModelTypeCtor, ReasoningItem as OriginalReasoningItem, ResponseStreamEvent, RunConfig, RunContext as RunContextTypeCtor, RunItem, Runner as RunnerTypeCtor, RunResult as RunResultTypeCtor, RunState as RunStateTypeCtor, RunToolApprovalItem as RunToolApprovalItemTypeCtor, StreamedRunResult as RawStreamedRunResultTypeCtor, StreamRunOptions, SystemMessageItem as OriginalSystemMessageItem, Tool as OpenAIToolType, tool as toolTypeCtor, ToolExecuteArgument, UnknownItem as OriginalUnknownItem, Usage as UsageTypeCtor, UserMessageItem as OriginalUserMessageItem, addTraceProcessor as addTraceProcessorFn, setTraceProcessors as setTraceProcessorsFn } from '@openai/agents';
30
- import type { AgentOutputType, MaxTurnsExceededError as MaxTurnsExceededErrorTypeCtor, ModelBehaviorError as ModelBehaviorErrorTypeCtor, getAllMcpTools as getAllMcpToolsFn } from '@openai/agents-core';
29
+ import type { addTraceProcessor as addTraceProcessorFn, Agent as AgentTypeCtor, AgentConfiguration, AgentInputItem as OriginalAgentInputItem, AgentOptions, AssistantMessageItem as OriginalAssistantMessageItem, ComputerCallResultItem as OriginalComputerCallResultItem, ComputerUseCallItem as OriginalComputerUseCallItem, FunctionCallItem as OriginalFunctionCallItem, FunctionCallResultItem as OriginalFunctionCallResultItem, FunctionTool as FunctionToolTypeCtor, Handoff as HandoffTypeCtor, handoff as handoffFn, HostedToolCallItem as OriginalHostedToolCallItem, Model as ModelType, ModelProvider as ModelProviderType, NonStreamRunOptions, OpenAIChatCompletionsModel as OpenAIChatCompletionsModelTypeCtor, ReasoningItem as OriginalReasoningItem, ResponseStreamEvent, RunConfig, RunContext as RunContextTypeCtor, RunItem, Runner as RunnerTypeCtor, RunResult as RunResultTypeCtor, RunState as RunStateTypeCtor, RunToolApprovalItem as RunToolApprovalItemTypeCtor, setTraceProcessors as setTraceProcessorsFn, StreamedRunResult as RawStreamedRunResultTypeCtor, StreamRunOptions, SystemMessageItem as OriginalSystemMessageItem, Tool as OpenAIToolType, tool as toolTypeCtor, ToolExecuteArgument, UnknownItem as OriginalUnknownItem, Usage as UsageTypeCtor, UserMessageItem as OriginalUserMessageItem } from '@openai/agents';
30
+ import type { AgentOutputType, getAllMcpTools as getAllMcpToolsFn, MaxTurnsExceededError as MaxTurnsExceededErrorTypeCtor, ModelBehaviorError as ModelBehaviorErrorTypeCtor } from '@openai/agents-core';
31
31
  import type { TextOutput, UnknownContext, UserContent } from '@openai/agents-core/types';
32
32
  import { FileHistorySnapshotItem, ResendForkNoticeItem } from './custom-input-item-types';
33
33
  export * from './custom-input-item-types';
@@ -58,16 +58,16 @@ export declare let tool: typeof toolTypeCtor;
58
58
  export declare let Handoff: typeof HandoffTypeCtor;
59
59
  export declare let handoff: typeof handoffFn;
60
60
  export declare let OpenAIChatCompletionsModel: typeof OpenAIChatCompletionsModelTypeCtor;
61
- export declare let addTraceProcessor: typeof addTraceProcessorFn;
62
- export declare let setTraceProcessors: typeof setTraceProcessorsFn;
63
61
  export declare let getAllMcpTools: typeof getAllMcpToolsFn;
64
62
  export declare let MaxTurnsExceededError: typeof MaxTurnsExceededErrorTypeCtor;
65
63
  export declare let ModelBehaviorError: typeof ModelBehaviorErrorTypeCtor;
64
+ export declare function addTraceProcessor(processor: Parameters<typeof addTraceProcessorFn>[0]): void;
65
+ export declare function setTraceProcessors(processors: Parameters<typeof setTraceProcessorsFn>[0]): void;
66
66
  /**
67
67
  * 拉起 `@openai/agents` + `@openai/agents-core` lazy chunk 并 assign runtime 值。
68
68
  * 幂等;并发 caller 复用同一次加载 promise。
69
69
  */
70
- export declare function preloadOpenaiAgentsTypes(): Promise<void>;
70
+ export declare function preloadOpenaiAgentsTypes(): Promise<typeof import('@openai/agents')>;
71
71
  /** 等价 `err instanceof MaxTurnsExceededError`;无需 preload 即可用。 */
72
72
  export declare function isMaxTurnsExceededError(err: unknown): boolean;
73
73
  /** 等价 `err instanceof ModelBehaviorError`;无需 preload 即可用。 */
@@ -22,7 +22,7 @@
22
22
  * `mcp-server-override.connect`,都在 activate 之后 MCP config resolve 完成时才走。
23
23
  * 在 `McpReadyService.doInit`(activate coordinator 触发点)里 preload 一次即可。
24
24
  */
25
- import type { OAuthClientProvider, OAuthDiscoveryState, auth as authFn, discoverAuthorizationServerMetadata as discoverAuthorizationServerMetadataFn, discoverOAuthProtectedResourceMetadata as discoverOAuthProtectedResourceMetadataFn, discoverOAuthServerInfo as discoverOAuthServerInfoFn, exchangeAuthorization as exchangeAuthorizationFn, extractResourceMetadataUrl as extractResourceMetadataUrlFn } from '@modelcontextprotocol/sdk/client/auth.js';
25
+ import type { auth as authFn, discoverAuthorizationServerMetadata as discoverAuthorizationServerMetadataFn, discoverOAuthProtectedResourceMetadata as discoverOAuthProtectedResourceMetadataFn, discoverOAuthServerInfo as discoverOAuthServerInfoFn, exchangeAuthorization as exchangeAuthorizationFn, extractResourceMetadataUrl as extractResourceMetadataUrlFn, OAuthClientProvider, OAuthDiscoveryState } from '@modelcontextprotocol/sdk/client/auth.js';
26
26
  import type { Client as ClientTypeCtor } from '@modelcontextprotocol/sdk/client/index.js';
27
27
  import type { SSEClientTransport as SSEClientTransportTypeCtor, SSEClientTransportOptions } from '@modelcontextprotocol/sdk/client/sse.js';
28
28
  import type { StdioClientTransport as StdioClientTransportTypeCtor, StdioServerParameters } from '@modelcontextprotocol/sdk/client/stdio.js';
@@ -1,7 +1,7 @@
1
1
  import { RestOperations } from '@celljs/http';
2
2
  import { AuthenticationManager } from '@genie/authentication';
3
3
  import { ClientInfoProvider, LanguageModel, ProductManager } from '@genie/product';
4
- import { Logger } from '@genie/telemetry';
4
+ import { Logger, TraceService } from '@genie/telemetry';
5
5
  import { OpenAI } from 'openai';
6
6
  import { AgentManager } from '../agent';
7
7
  import { GalileoTimingHook } from '../galileo';
@@ -93,6 +93,7 @@ export declare class ModelProviderImpl implements ModelProvider {
93
93
  protected readonly clientInfoProvider: ClientInfoProvider;
94
94
  protected readonly agentManager: AgentManager;
95
95
  protected readonly logger: Logger;
96
+ protected readonly traceService?: TraceService;
96
97
  protected readonly defaultInputItemProcessor: DefaultInputItemProcessor;
97
98
  protected readonly functionCallResultAgentInputItemProcessor: FunctionCallResultAgentInputItemProcessor;
98
99
  protected readonly modelErrorAnalyzer: ModelErrorAnalyzer;
@@ -273,6 +274,7 @@ export declare class ModelProviderImpl implements ModelProvider {
273
274
  * AbortSignal 已触发时一律不重试(尊重取消语义)。env 运行时 live 读(prewarm 契约)。
274
275
  */
275
276
  private requestWithConnectionRetry;
277
+ private getModelTracer;
276
278
  /**
277
279
  * MVP 验证:agent-cli 模型请求最终走 OpenAI SDK 的自定义 fetch adapter,
278
280
  * 不一定会被 Galileo SDK 的 global fetch/http instrumentation 捕获。
@@ -19,26 +19,37 @@ declare const A2AGetTaskParameters: z.ZodObject<{
19
19
  task_id: string;
20
20
  }>;
21
21
  export declare const ENV_POLL_INTERVAL_MS = "CODEBUDDY_A2A_POLL_INTERVAL_MS";
22
- export declare const ENV_POLL_BACKOFF_MULTIPLIER = "CODEBUDDY_A2A_POLL_BACKOFF_MULTIPLIER";
23
- export declare const ENV_POLL_MAX_INTERVAL_MS = "CODEBUDDY_A2A_POLL_MAX_INTERVAL_MS";
24
- export declare const ENV_POLL_MAX_ATTEMPTS = "CODEBUDDY_A2A_POLL_MAX_ATTEMPTS";
25
22
  export declare const ENV_POLL_MAX_DURATION_MS = "CODEBUDDY_A2A_POLL_MAX_DURATION_MS";
26
23
  export interface A2APollPolicy {
27
- /** Initial poll interval, ms. Default 2s. */
28
- initialIntervalMs: number;
29
- /** Exponential backoff multiplier applied after each poll. Default 1.5x. */
30
- backoffMultiplier: number;
31
- /** Interval cap the backoff schedule never exceeds. Default 30s. */
32
- maxIntervalMs: number;
33
- /** Hard cap on poll attempts a secondary, independent circuit breaker from `maxDurationMs`. Default 60. */
34
- maxAttempts: number;
35
- /** Overall wall-clock budget for the whole loop, ms. Default 15 minutes. */
24
+ /**
25
+ * Constant gap between polls, ms. Default 500ms.
26
+ *
27
+ * Flat rather than exponentially backed off. Backoff optimizes for the
28
+ * long tail, but the tail is exactly where it hurts: it used to stretch
29
+ * to a 30s gap, so a task finishing at second 31 was reported up to 30
30
+ * seconds late, and the user watching the progress line saw a stall. A
31
+ * remote task the user is actively waiting on is worth one cheap request
32
+ * every half second.
33
+ */
34
+ intervalMs: number;
35
+ /**
36
+ * Wall-clock budget for the whole loop, ms. Default 30 minutes.
37
+ *
38
+ * A HARD cap: when it runs out the remote task is canceled, so this is
39
+ * the longest a single outbound task may run — not merely the longest a
40
+ * single call waits.
41
+ */
36
42
  maxDurationMs: number;
37
43
  }
38
44
  /**
39
45
  * Resolve the effective poll policy, applying any env overrides on top of
40
46
  * `DEFAULT_POLL_POLICY`. Read fresh on every `execute()` call — not cached
41
47
  * — so a test/host can change the env between calls.
48
+ *
49
+ * Only these two knobs are exposed. The retry schedule for a FAILED request
50
+ * (see a2a-poll-retry.ts) is fixed, because the cadence and the budget are
51
+ * the only two a host has a reason to tune and every additional dial is one
52
+ * more way to configure the loop into a request storm.
42
53
  */
43
54
  export declare function resolvePollPolicy(): A2APollPolicy;
44
55
  /** Exported so `A2ASendMessageTool` can classify its own (single, non-looping) result the same way — see that tool's artifact-download integration. */
@@ -54,17 +65,28 @@ export declare function __resetUserStoppedTasksForTest(): void;
54
65
  * Every non-terminal status — including `input-required`/`auth-required` —
55
66
  * is relayed (A.2's live-progress mechanism, reusing the foreground Bash
56
67
  * tool's `session.inputSubject.next({status: 'in_progress', ...})` pattern)
57
- * and polled straight through with exponential backoff (A.3), never treated
58
- * as a stop condition (A.5). Only the 4 true terminal states
59
- * (`completed`/`failed`/`canceled`/`rejected`) or one of the two independent
60
- * circuit breakers (`maxAttempts`/`maxDurationMs`, both env-overridable see
61
- * `resolvePollPolicy()`) stop the loop.
68
+ * and polled straight through at a fixed interval (A.3), never treated as a
69
+ * stop condition (A.5).
70
+ *
71
+ * Three things stop the loop, and only one of them is a plain success:
72
+ *
73
+ * - one of the 4 terminal states (`completed`/`failed`/`canceled`/`rejected`);
74
+ * - the wall-clock budget running out;
75
+ * - `tasks/get` failing in a way that survives the retry schedule.
76
+ *
77
+ * The last two both END the remote task: the loop issues `tasks/cancel` and
78
+ * reports what that cancel actually did. This is a deliberate reversal of the
79
+ * older "give up for now, let the model re-poll" contract, which left a
80
+ * remote task running with nobody watching it whenever the model chose not to
81
+ * call back. The cost is that the budget is now a ceiling on the TASK, not
82
+ * just on the call — a task that needs longer than `maxDurationMs` cannot
83
+ * finish, and the host has to raise the budget for it.
62
84
  *
63
85
  * **One exception, added in issue #107183: approval interrupts.** When a poll
64
86
  * observes a `snapshot.approval` payload (an out-of-band approval the remote
65
87
  * agent is waiting on — see `A2aTaskSnapshot.approval`), relaying opaque
66
- * `(N pending approval)` text and polling on for 15 minutes gives the user no
67
- * way to act. So the loop PAUSES and raises a real ACP `elicitation/create`
88
+ * `(N pending approval)` text and polling on until the budget runs out gives
89
+ * the user no way to act. So the loop PAUSES and raises an ACP `elicitation/create`
68
90
  * card carrying the approval tokens, then resumes or stops per the answer:
69
91
  *
70
92
  * - `accept` — resume polling and do nothing else. The host delivers the
@@ -119,7 +141,39 @@ export declare class A2AGetTaskTool extends BaseTool implements Tool {
119
141
  execute(input: z.infer<typeof A2AGetTaskParameters>, context: RunContext<Session>, details?: {
120
142
  toolCall: FunctionCallItem;
121
143
  }): Promise<ToolResult>;
122
- private pollOnce;
144
+ /**
145
+ * One logical poll: a `tasks/get`, plus up to
146
+ * {@link POLL_RETRY_MAX_ATTEMPTS} retries when the failure looks
147
+ * transient.
148
+ *
149
+ * Retrying at all is the point. Before this, a single hiccup — a 502 from
150
+ * a load balancer mid-deploy, a reset socket — ended a poll the user had
151
+ * been waiting minutes for. What is NOT retried is a 400-409: those say
152
+ * the request itself is wrong (bad task id, no permission), and repeating
153
+ * it five times just delays telling the model something it needs to act
154
+ * on. See `classifyPollFailure` for where that line is drawn and why it
155
+ * is not simply "all of 4xx".
156
+ *
157
+ * Three ways out:
158
+ * - a snapshot, on the first try or a later one;
159
+ * - a THROWN `ToolExecutionError`, for a non-retryable failure or a user
160
+ * abort — the model gets the error, the task is left alone;
161
+ * - `give-up`, when the retries (or the budget) ran out. The caller ends
162
+ * the remote task and reports; this is not an exception because it is a
163
+ * reportable outcome, not a broken call.
164
+ */
165
+ private pollWithRetry;
166
+ private abortedError;
167
+ /**
168
+ * Error text for a failure the model has to act on itself.
169
+ *
170
+ * Leads with the HTTP status because that is what tells a 404 (wrong task
171
+ * id — the model may have one from an earlier turn) apart from a 403
172
+ * (this agent is not allowed here — retrying will never help), and
173
+ * carries the remote's own response body, which is where an agent
174
+ * normally puts the part a human can act on.
175
+ */
176
+ private formatRequestFailure;
123
177
  /**
124
178
  * A.2's live-progress relay — the SAME `session.inputSubject.next({...})`
125
179
  * shape the foreground Bash tool uses for its own streaming updates
@@ -165,24 +219,44 @@ export declare class A2AGetTaskTool extends BaseTool implements Tool {
165
219
  /**
166
220
  * Model-facing result after a user ended a task from an approval card.
167
221
  *
168
- * Three things have to be in here, and the first is the one that is easy
169
- * to get wrong: this tool's own `description` tells the model in
170
- * MUST-level wording to immediately re-poll any non-final result, so the
171
- * text has to say plainly that polling is over. The other two are what
172
- * was refused (the model cannot pick a next step if it only knows "an
173
- * approval was declined") and what we actually did to the remote task.
222
+ * Written as named sections what was shown, what happened, and the
223
+ * host's reason rather than one prose paragraph, because the single
224
+ * line that has to win was getting buried mid-sentence: this tool's own
225
+ * `description` tells the model in MUST-level wording to immediately
226
+ * re-poll any non-final result, so the text has to say plainly that
227
+ * polling is over.
228
+ *
229
+ * Only counter-intuitive instructions are spelled out. Telling the user
230
+ * the action did not happen is what a model does anyway; not re-polling,
231
+ * closing an unconfirmed cancel out with `A2ACancelTask`, and reporting a
232
+ * real terminal state instead of the refusal are the three it would
233
+ * otherwise get wrong.
174
234
  *
175
235
  * When the cancel revealed the task was already terminal — commonly
176
236
  * because the approval was granted through the approving system's own UI
177
237
  * while our card sat open — the REAL state is reported through the
178
238
  * existing `formatTerminalContent()`, so a completed task is never
179
239
  * reported as a refusal.
240
+ *
241
+ * No agent id anywhere: it is the registry's routing key and is not
242
+ * guaranteed to match the card's display name (see `A2aRegisteredAgent`),
243
+ * while `taskId` alone already identifies the task uniquely.
180
244
  */
181
245
  private buildApprovalStopResult;
246
+ /** Blank line between sections, reasons always last — see {@link appendApprovalResponseNotes}. */
247
+ private composeSections;
182
248
  /**
183
- * Add host-supplied reasons to the model result without granting them
184
- * instruction authority. JSON string encoding keeps arbitrary newlines and
185
- * delimiter-looking text inside one explicit data value.
249
+ * Append host-supplied reasons as the LAST section of the result.
250
+ *
251
+ * The JSON encoding is the actual guard, not formatting: it collapses
252
+ * newlines and heading-looking text into a single string literal, so a
253
+ * reason cannot forge a section of its own. Keeping it last means no
254
+ * instruction ever follows client-controlled text.
255
+ *
256
+ * A lone reason needs no action label — the section above it already said
257
+ * what the user did. Several reasons only happen when one call raised more
258
+ * than one card (accepting one approval, then declining another), and
259
+ * there the labels are what keep two opposite answers apart.
186
260
  */
187
261
  private appendApprovalResponseNotes;
188
262
  /**
@@ -201,11 +275,42 @@ export declare class A2AGetTaskTool extends BaseTool implements Tool {
201
275
  */
202
276
  private formatTerminalContent;
203
277
  /**
204
- * Fallback result when a circuit breaker (not a terminal status) stops
205
- * the loop. Per A.5: surfaces the last observed status/clarification —
206
- * useful context even though it wasn't treated as a stop condition, the
207
- * loop stopped because of the budget, not because of an interrupt.
278
+ * The ordinary end of a poll: the task reached a terminal state, so wait
279
+ * out its artifact downloads and hand the model the result.
280
+ *
281
+ * Shared with the stop path below, which lands here whenever a cancel
282
+ * discovers the task had already finished. That sharing is the point —
283
+ * a task that completed WITH attachments in the second before we tried to
284
+ * cancel it must not lose them to a different, artifact-unaware code
285
+ * path.
286
+ *
287
+ * Assumes its snapshot's downloads have already been kicked off; both
288
+ * callers do that, the loop on every tick and the stop path for the
289
+ * snapshot the cancel read back.
290
+ */
291
+ private buildTerminalResult;
292
+ /**
293
+ * End the remote task and tell the model what that actually did.
294
+ *
295
+ * Reached when the loop gives up on a task that never finished — the
296
+ * budget ran out, or `tasks/get` kept failing. Both used to return "still
297
+ * running, call me again", which read fine but left a real task running
298
+ * on the remote agent for as long as it liked whenever the model decided
299
+ * not to call back. Ending it here means the ceiling is enforced rather
300
+ * than merely reported.
301
+ *
302
+ * The cancel is what produces the text, not a guess made before it:
303
+ *
304
+ * - `already-terminal` — the task crossed the finish line while we were
305
+ * canceling it, so there is nothing to narrate. It goes back through
306
+ * the normal terminal path and the model sees an ordinary result,
307
+ * artifacts and all.
308
+ * - `canceled` — say so, and name the state the remote reported rather
309
+ * than assuming CANCELED; nothing in the spec pins `tasks/cancel` to
310
+ * one value.
311
+ * - `unknown` — we could not confirm anything, so the model is told the
312
+ * task may still be running and pointed at `A2ACancelTask`.
208
313
  */
209
- private buildBudgetExceededResult;
314
+ private buildPollStoppedResult;
210
315
  }
211
316
  export {};
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Retry policy for a FAILED `tasks/get` REQUEST — distinct from
3
+ * `A2APollPolicy`, which governs the cadence of SUCCESSFUL polls. A request
4
+ * that never produced a task snapshot is retried on this schedule; a request
5
+ * that did is subject to the poll interval instead.
6
+ *
7
+ * Fixed rather than env-overridable: the poll interval and the overall budget
8
+ * are the two knobs a host has a legitimate reason to tune, and every extra
9
+ * one is a way to misconfigure the loop into a request storm.
10
+ */
11
+ export declare const POLL_RETRY_MAX_ATTEMPTS = 5;
12
+ export declare const POLL_RETRY_BASE_INTERVAL_MS = 1000;
13
+ export declare const POLL_RETRY_BACKOFF_MULTIPLIER = 1.5;
14
+ export interface PollFailureClassification {
15
+ /**
16
+ * The HTTP status behind this failure, when one could be established.
17
+ * Absent for transport failures that never got a response at all (DNS,
18
+ * connection reset, the client's own timeout) — deliberately not defaulted
19
+ * to 500, so the model is never told a status the wire did not carry.
20
+ */
21
+ httpStatus?: number;
22
+ /** Whether the poll loop should retry rather than give up. */
23
+ retryable: boolean;
24
+ /** The SDK's error text, verbatim. */
25
+ message: string;
26
+ /**
27
+ * What the remote actually said: the `Response:` tail of the SDK's HTTP
28
+ * error text, or a JSON-RPC error's structured `data`. Absent when the
29
+ * failure produced no body.
30
+ */
31
+ responseBody?: string;
32
+ }
33
+ /**
34
+ * Decide whether a failed `tasks/get` request is worth retrying, and pull out
35
+ * the detail the model needs either way.
36
+ *
37
+ * Knows nothing about aborts on purpose. A user cancel and the client's own
38
+ * 120s request timeout reach this function as the SAME error text (see
39
+ * `A2aClientService.withAbortAndClient`), so only the caller — which can read
40
+ * `session.abortSignal` — can tell them apart. This classifies the timeout
41
+ * reading of that message (retryable) and leaves the cancel reading to the
42
+ * poll loop.
43
+ */
44
+ export declare function classifyPollFailure(err: unknown): PollFailureClassification;
45
+ /** Wait before the `retryIndex`-th (0-based) retry: 1s, 1.5s, 2.25s, 3.375s, 5.0625s. */
46
+ export declare function pollRetryDelayMs(retryIndex: number): number;
package/cli/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencent-ai/codebuddy-code",
3
- "version": "2.144.0",
3
+ "version": "2.145.0",
4
4
  "description": "Use CodeBuddy, Tencent's AI assistant, right from your terminal. CodeBuddy can understand your codebase, edit files, run terminal commands, and handle entire workflows for you.",
5
5
  "main": "lib/node/index.js",
6
6
  "typings": "lib/node/index.d.ts",
@@ -822,6 +822,6 @@
822
822
  "SelectImage": true,
823
823
  "SkipToolCallSupportCheck": true
824
824
  },
825
- "commit": "8d037fece0be1978272cf60f906f7bd144e32408",
826
- "date": "2026-09-04T14:07:37.499Z"
825
+ "commit": "6582f0c18fc69b31f97ca6fc98673eaf2a0666a1",
826
+ "date": "2026-09-05T05:39:52.463Z"
827
827
  }
@@ -832,6 +832,6 @@
832
832
  }
833
833
  }
834
834
  },
835
- "commit": "8d037fece0be1978272cf60f906f7bd144e32408",
836
- "date": "2026-09-04T14:07:37.420Z"
835
+ "commit": "6582f0c18fc69b31f97ca6fc98673eaf2a0666a1",
836
+ "date": "2026-09-05T05:39:52.458Z"
837
837
  }
@@ -1325,6 +1325,6 @@
1325
1325
  }
1326
1326
  }
1327
1327
  },
1328
- "commit": "8d037fece0be1978272cf60f906f7bd144e32408",
1329
- "date": "2026-09-04T14:07:37.426Z"
1328
+ "commit": "6582f0c18fc69b31f97ca6fc98673eaf2a0666a1",
1329
+ "date": "2026-09-05T05:39:52.459Z"
1330
1330
  }
package/cli/product.json CHANGED
@@ -1245,11 +1245,11 @@
1245
1245
  },
1246
1246
  {
1247
1247
  "name": "tool-a2asendmessage-description",
1248
- "template": "Send a message to one outbound A2A (Agent2Agent) agent authorized for this conversation.\n\nParameters:\n- `agent_name` (required): the target agent's name, exactly as returned by A2AGetAgentCard (the Agent Card `name`), or from an explicit @Agent mention.\n- `message` (required): a concise, self-contained task or question. Do not paste the whole conversation — state the goal and only the context the agent actually needs (the agent has no visibility into this conversation otherwise).\n- `skill_id` (optional): route directly to one declared skill, for @Agent.Skill-style precise dispatch. Only effective when A2AGetAgentCard reported `supports_skill_routing: true` for that agent; otherwise this is ignored.\n- `attachments` (optional): a list of files to attach to the message, each referenced by a fetchable `url` (plus optional `filename` and `media_type`). Each is sent to the agent as a standard A2A file part. The `url` must already be reachable by the remote agent — this tool sends it as-is and does NOT upload, host, or transform the file. Use this when you already have a URL for a file you want the agent to work on; obtain that URL through whatever mechanism your environment provides.\n\nThis call is NOT synchronous: it returns immediately with whatever single reply the agent gave, and does not wait for the task to finish. Check the returned status: only completed/failed/canceled/rejected are final. For ANY other status — working, submitted, input-required, or auth-required — you MUST immediately call A2AGetTask with the returned task_id, in the same turn, before doing anything else with this task. Do not wait, and do not ask the user for permission first.\n\nauth-required and input-required are NOT a signal to stop and hand off to the user by themselves — calling A2AGetTask to check status is just reading state, not performing a login or filling credentials on the user's behalf, so it does not conflict with any policy against automating logins. A2AGetTask polls automatically with backoff, relays the agent's own request (e.g. \"please sign in\", a clarifying question) to the user exactly once, and keeps waiting for the remote task to advance — it will surface the eventual outcome once the user (or the agent) resolves whatever it was waiting on.\n\nBehavior notes:\n- Calling the same `agent_id` (and `skill_id`, if used) again in a later turn continues the same conversation with that agent automatically — you don't need to restate prior context.\n- To message multiple agents in one turn, call this tool once per agent as parallel tool calls — one agent failing does not affect the others.\n- Any files or links the agent produced are returned as part of the result text.\n- Not available inside a sub-agent or team-member session — only the main conversation can call outbound A2A agents.\n"
1248
+ "template": "Send a message to one outbound A2A (Agent2Agent) agent authorized for this conversation.\n\nParameters:\n- `agent_name` (required): the target agent's name, exactly as returned by A2AGetAgentCard (the Agent Card `name`), or from an explicit @Agent mention.\n- `message` (required): a concise, self-contained task or question. Do not paste the whole conversation — state the goal and only the context the agent actually needs (the agent has no visibility into this conversation otherwise).\n- `skill_id` (optional): route directly to one declared skill, for @Agent.Skill-style precise dispatch. Only effective when A2AGetAgentCard reported `supports_skill_routing: true` for that agent; otherwise this is ignored.\n- `attachments` (optional): a list of files to attach to the message, each referenced by a fetchable `url` (plus optional `filename` and `media_type`). Each is sent to the agent as a standard A2A file part. The `url` must already be reachable by the remote agent — this tool sends it as-is and does NOT upload, host, or transform the file. Use this when you already have a URL for a file you want the agent to work on; obtain that URL through whatever mechanism your environment provides.\n\nThis call is NOT synchronous: it returns immediately with whatever single reply the agent gave, and does not wait for the task to finish. Check the returned status: only completed/failed/canceled/rejected are final. For ANY other status — working, submitted, input-required, or auth-required — you MUST immediately call A2AGetTask with the returned task_id, in the same turn, before doing anything else with this task. Do not wait, and do not ask the user for permission first.\n\nauth-required and input-required are NOT a signal to stop and hand off to the user by themselves — calling A2AGetTask to check status is just reading state, not performing a login or filling credentials on the user's behalf, so it does not conflict with any policy against automating logins. A2AGetTask polls automatically, relays the agent's own request (e.g. \"please sign in\", a clarifying question) to the user exactly once, and keeps waiting for the remote task to advance — it will surface the eventual outcome once the user (or the agent) resolves whatever it was waiting on.\n\nBehavior notes:\n- Calling the same `agent_id` (and `skill_id`, if used) again in a later turn continues the same conversation with that agent automatically — you don't need to restate prior context.\n- To message multiple agents in one turn, call this tool once per agent as parallel tool calls — one agent failing does not affect the others.\n- Any files or links the agent produced are returned as part of the result text.\n- Not available inside a sub-agent or team-member session — only the main conversation can call outbound A2A agents.\n"
1249
1249
  },
1250
1250
  {
1251
1251
  "name": "tool-a2agettask-description",
1252
- "template": "Wait for a previously created outbound A2A task to finish, polling automatically.\n\nParameters:\n- `agent_name` (required): the same agent name passed to the original A2ASendMessage call.\n- `task_id` (required): the taskId from a prior A2ASendMessage or A2AGetTask result.\n\nThis call polls the remote task's real, current state with backoff, showing live progress as it goes, up to a bounded time/attempt limit. It returns once the task reaches a final state (completed/failed/canceled/rejected), or a \"still running\" result if the bound is hit first if you get \"still running\", immediately call A2AGetTask again with the same task_id to keep waiting; do not give up after one bounded call.\n\nIf the task is waiting on external input or auth (input-required/auth-required), that request is relayed to the user once and polling continues with backoff the next call/round of polling reflects the task's real state at that later point in time, not a repeat of what you already saw. Checking status this way is just reading state, not performing a login or filling credentials on the user's behalf, so calling this while the task is waiting on the user to complete a login/approval step out of band does not conflict with any policy against automating logins.\n\nNot available inside a sub-agent or team-member session — only the main conversation can query outbound A2A tasks.\n"
1252
+ "template": "Wait for a previously created outbound A2A task to finish, polling automatically.\n\nParameters:\n- `agent_name` (required): the same agent name passed to the original A2ASendMessage call.\n- `task_id` (required): the taskId from a prior A2ASendMessage or A2AGetTask result.\n\nThis call polls the remote task's real, current state at a steady interval, showing live progress as it goes, and returns once the task reaches a final state (completed/failed/canceled/rejected).\n\nThis is the only wait the task gets. If it runs past the time limit, or the remote agent stops answering, the task is canceled and this returns telling you exactly that. Whatever this returns is therefore final: never call A2AGetTask again with the same task_id. If the work is still needed, start it over with A2ASendMessage.\n\nIf the task is waiting on external input or auth (input-required/auth-required), that request is relayed to the user once and polling continues — this call keeps waiting for the task to advance rather than handing back a stale copy of what you already saw. Checking status this way is just reading state, not performing a login or filling credentials on the user's behalf, so calling this while the task is waiting on the user to complete a login/approval step out of band does not conflict with any policy against automating logins.\n\nNot available inside a sub-agent or team-member session — only the main conversation can query outbound A2A tasks.\n"
1253
1253
  },
1254
1254
  {
1255
1255
  "name": "tool-a2acanceltask-description",
@@ -2226,6 +2226,6 @@
2226
2226
  "description": "tool-a2acanceltask-description"
2227
2227
  }
2228
2228
  ],
2229
- "commit": "8d037fece0be1978272cf60f906f7bd144e32408",
2230
- "date": "2026-09-04T14:07:37.503Z"
2229
+ "commit": "6582f0c18fc69b31f97ca6fc98673eaf2a0666a1",
2230
+ "date": "2026-09-05T05:39:52.468Z"
2231
2231
  }
@@ -359,6 +359,6 @@
359
359
  "ScheduledTasks": true,
360
360
  "SkipToolCallSupportCheck": true
361
361
  },
362
- "commit": "8d037fece0be1978272cf60f906f7bd144e32408",
363
- "date": "2026-09-04T14:07:37.416Z"
362
+ "commit": "6582f0c18fc69b31f97ca6fc98673eaf2a0666a1",
363
+ "date": "2026-09-05T05:39:52.487Z"
364
364
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tencent-ai/agent-sdk",
3
- "version": "0.3.252",
3
+ "version": "0.3.253",
4
4
  "description": "CodeBuddy Code SDK for JavaScript/TypeScript",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
@@ -1,34 +0,0 @@
1
- /**
2
- * rewindTo — 统一回退操作(Phase 1 核心收敛点)
3
- *
4
- * 将 applyResendFork() 和 CheckpointService.updateHistory() 两处重复的
5
- * "回退历史指针 + 标记 conversationReverted" 逻辑统一到此函数。
6
- *
7
- * 职责分离:
8
- * - rewindTo() → 纯状态变更(lastMessageId + conversationReverted)
9
- * - reason 分支 → 副作用差异(persist notice / historyReloadSubject)
10
- * - 调用方 → 负责解析 fork 点(resolveResendForkPoint / checkpoint.parentId)
11
- *
12
- * @see issue #50495 / docs/plans/2026-06-20-resend-edit-unified-plan.md
13
- */
14
- import type { Session } from '../session/session-protocol';
15
- /** 回退原因,决定 rewindTo 的副作用行为 */
16
- export type RewindReason = 'resend_edit' | 'checkpoint_revert';
17
- export interface RewindOptions {
18
- /** resend_edit 时需要持久化的被编辑消息 ID */
19
- editedUserItemId?: string;
20
- /** 持久化函数(仅 resend_edit 使用)— 通常为 sessionManager.addHistory */
21
- addHistory?: (session: Session, items: any[]) => Promise<void>;
22
- }
23
- /**
24
- * 将会话历史指针回退到指定 fork 点。
25
- *
26
- * 统一行为:
27
- * 1. session.lastMessageId = forkPointId
28
- * 2. session.conversationReverted = true
29
- *
30
- * 按 reason 触发不同副作用:
31
- * - 'resend_edit': 调用 addHistory 持久化 fork 墓碑标记
32
- * - 'checkpoint_revert': 触发 historyReloadSubject 通知前端刷新
33
- */
34
- export declare function rewindTo(session: Session, forkPointId: string | undefined, reason: RewindReason, options?: RewindOptions): Promise<void>;
@@ -1,22 +0,0 @@
1
- /**
2
- * Web UI ACP 握手身份。WorkBuddy / Zed 等 --acp 客户端不带这个名字。
3
- * 刷新快照、busy 工具、/goal drain 只对这个客户端生效,避免改到共用 --acp 语义。
4
- */
5
- export declare const ACP_WEB_UI_CLIENT_NAME = "codebuddy-web-ui";
6
- export declare function isWebUiAcpClientName(name: unknown): boolean;
7
- export declare function isWebUiAcpSession(session: {
8
- options?: object;
9
- }): boolean;
10
- /**
11
- * Keep the in-memory Web-ACP marker aligned with the connection that most
12
- * recently admitted the session.
13
- *
14
- * A same-id session may be reused instead of deserialized again. In that
15
- * case simply doing nothing for non-Web clients leaves a stale `webUiAcp`
16
- * bit behind and lets WorkBuddy enter Web-only goal/follow-up behaviour.
17
- * The marker is transport state, not durable session identity, so an
18
- * unopted ACP client must actively clear it.
19
- */
20
- export declare function syncWebUiAcpSessionFlag<T extends {
21
- options?: object;
22
- }>(session: T, webUiAcp: boolean): void;
@@ -1,45 +0,0 @@
1
- /**
2
- * 上下文消耗 5 类目细拆 · 字符分类 + 反向归一化分配。
3
- * 严格守恒:sum(usageByCategory) === input.totalTokens(即 ACP usage_update.used)。
4
- */
5
- /** 5 类目细拆结果。schema 版本字段 `version` 为后续扩展预留。 */
6
- export interface UsageByCategory {
7
- systemPrompt: number;
8
- conversation: number;
9
- tools: number;
10
- mcp: number;
11
- skills: number;
12
- /** schema 版本:未来扩展加字段时 +1,客户端按 version 兼容。 */
13
- version: 1;
14
- }
15
- /** 单个 tool 定义的最小契约(仅消费 name + description;其它字段透传 JSON.stringify)。 */
16
- export interface ToolLike {
17
- name: string;
18
- description?: string;
19
- /** OpenAI Agent SDK 的 tool 通常带 parameters/schema;calculator 不解析,只 JSON.stringify。 */
20
- input_schema?: unknown;
21
- parameters?: unknown;
22
- }
23
- /** 单条 history item 的结构松约束(结构不规范时 calculator 跳过,不抛错)。 */
24
- export interface HistoryItemLike {
25
- type?: string;
26
- role?: string;
27
- content?: unknown;
28
- callId?: string;
29
- name?: string;
30
- arguments?: unknown;
31
- output?: unknown;
32
- }
33
- export interface UsageByCategoryInput {
34
- /** 当前请求最终发给模型的 system prompt 渲染产物(已 resolve 为字符串)。 */
35
- systemPrompt: string;
36
- /** 当前请求装载的 tool 定义列表(用作字符代理:JSON.stringify 每个 tool)。 */
37
- tools: ReadonlyArray<ToolLike>;
38
- /** session.history(user/assistant 消息 + function_call / function_call_result)。 */
39
- history: ReadonlyArray<HistoryItemLike>;
40
- /** ACP usage_update.used,作为最终归一化的总分母。 */
41
- totalTokens: number;
42
- }
43
- export declare class UsageByCategoryCalculator {
44
- static compute(input: UsageByCategoryInput): UsageByCategory;
45
- }
@@ -1,9 +0,0 @@
1
- /**
2
- * 字符权重 · 上下文消耗 5 类目细拆专用。
3
- * CJK / ASCII 字母空白 / 其它字符分别按 1.2 / 0.25 / 0.7 折算。
4
- */
5
- /**
6
- * 按字符权重把字符串折算成「token 数」估算量(用于 5 类目反向归一化的相对比例)。
7
- * 真实 token 数由 ACP usage_update.used 决定;本函数仅用作类目分配权重。
8
- */
9
- export declare function weighted(text: string): number;
@@ -1,6 +0,0 @@
1
- /**
2
- * 守恒分配函数 —— 把 totalTokens 按 5 类目权重分配到非负整数桶里,sum 严格守恒。
3
- * 算法:floor 分配 + 按余数从大到小补 1。
4
- */
5
- export type UsageByCategoryKey = 'systemPrompt' | 'conversation' | 'tools' | 'mcp' | 'skills';
6
- export declare function distributeWithConservation(estimates: Record<UsageByCategoryKey, number>, totalTokens: number): Record<UsageByCategoryKey, number>;
@@ -1,11 +0,0 @@
1
- /**
2
- * Skills / MCP 切分 · 上下文消耗 5 类目细拆专用。
3
- * Skill 的 `<available_skills>` 归 skills;ToolSearch 的 `mcp__` 行归 mcp。
4
- */
5
- import type { ToolLike } from './usage-by-category-calculator';
6
- export interface ToolsBuckets {
7
- toolsChars: string;
8
- mcpChars: string;
9
- skillsChars: string;
10
- }
11
- export declare function collectToolsBuckets(tools: ReadonlyArray<ToolLike>): ToolsBuckets;