@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
@@ -1,142 +0,0 @@
1
- /**
2
- * WeCom template-card adapter for interactive tools.
3
- *
4
- * Tools (permission adapter / AskUserQuestion / prompt suggestion) stay unchanged.
5
- * This module converts their prompts into vote_interaction cards so options stay
6
- * a vertical list. WeCom lays button_interaction actions in one row and squeezes
7
- * the labels; vote_interaction does not.
8
- *
9
- * Send card: https://developer.work.weixin.qq.com/document/path/101032
10
- * Update card: https://developer.work.weixin.qq.com/document/path/94888
11
- * Click event: event.template_card_event.{task_id,event_key,selected_items}
12
- */
13
- /** vote_interaction 没有 sub_title_text,命令参数只能放 main_title.desc。 */
14
- export declare const WECOM_VOTE_DESC_MAX = 160;
15
- /** Official vote_interaction option_list cap. */
16
- export declare const WECOM_ASK_OPTION_MAX = 20;
17
- export declare const WECOM_CARD_TYPE_BUTTON = "button_interaction";
18
- export declare const WECOM_CARD_TYPE_VOTE = "vote_interaction";
19
- export declare const WECOM_INTERACTION_QUESTION_KEY = "choice";
20
- export declare const WECOM_INTERACTION_KEY: {
21
- readonly ALLOW: 'allow';
22
- readonly DENY: 'deny';
23
- readonly ALLOW_ALWAYS: 'allow_always';
24
- readonly EXIT_PLAN: 'deny_and_exit_plan';
25
- readonly SUGGEST_YES: 'suggest_yes';
26
- readonly SUGGEST_NO: 'suggest_no';
27
- readonly SUBMIT: 'submit';
28
- readonly ASK_SUBMIT: 'ask_submit';
29
- };
30
- export type WecomInteractionKey = (typeof WECOM_INTERACTION_KEY)[keyof typeof WECOM_INTERACTION_KEY];
31
- export interface WecomTemplateCardButton {
32
- text: string;
33
- style: 1 | 2 | 3 | 4;
34
- key: string;
35
- }
36
- export interface WecomButtonCard {
37
- card_type: typeof WECOM_CARD_TYPE_BUTTON;
38
- main_title: {
39
- title: string;
40
- desc?: string;
41
- };
42
- sub_title_text?: string;
43
- button_list: WecomTemplateCardButton[];
44
- task_id: string;
45
- replace_text?: string;
46
- }
47
- export interface WecomVoteOption {
48
- id: string;
49
- text: string;
50
- is_checked?: boolean;
51
- }
52
- export interface WecomVoteCard {
53
- card_type: typeof WECOM_CARD_TYPE_VOTE;
54
- main_title: {
55
- title: string;
56
- desc?: string;
57
- };
58
- sub_title_text?: string;
59
- checkbox: {
60
- question_key: string;
61
- option_list: WecomVoteOption[];
62
- mode: 0 | 1;
63
- disable?: boolean;
64
- };
65
- submit_button: {
66
- text: string;
67
- key: string;
68
- };
69
- task_id: string;
70
- replace_text?: string;
71
- }
72
- export type WecomTemplateCard = WecomVoteCard | WecomButtonCard;
73
- export interface WecomCardClick {
74
- taskId: string;
75
- eventKey: string;
76
- reqId: string;
77
- chatid?: string;
78
- chattype?: string;
79
- userid?: string;
80
- selectedOptionIds?: string[];
81
- }
82
- export declare function isWecomVoteCard(card: WecomTemplateCard): card is WecomVoteCard;
83
- export declare function isWecomSubmitKey(key: string): boolean;
84
- export declare function sanitizeWecomTaskId(raw: string): string;
85
- export declare function clipWecomCardText(text: string, max: number): string;
86
- export declare function askOptionKey(index: number): string;
87
- export declare function parseAskOptionKey(key: string): number | undefined;
88
- export declare function interactionOptionText(option: {
89
- label: string;
90
- description?: string;
91
- }): string;
92
- export declare function parseSelectedOptionIds(source: unknown): string[];
93
- export declare function clickActionKeys(click: WecomCardClick): string[];
94
- export declare function buildVoteInteractionCard(input: {
95
- taskId: string;
96
- title: string;
97
- desc?: string;
98
- questionKey?: string;
99
- multiSelect?: boolean;
100
- options: Array<{
101
- id: string;
102
- text: string;
103
- checked?: boolean;
104
- }>;
105
- submitKey?: string;
106
- submitText?: string;
107
- disable?: boolean;
108
- replaceText?: string;
109
- }): WecomVoteCard;
110
- export declare function buildPermissionCard(input: {
111
- taskId: string;
112
- body: string;
113
- exitPlan: boolean;
114
- toolName?: string;
115
- }): WecomVoteCard;
116
- export declare function formatAskSelectedAnswer(options: Array<{
117
- label: string;
118
- }>, selected: number[]): string;
119
- export declare function buildAskQuestionCard(input: {
120
- taskId: string;
121
- question: string;
122
- header?: string;
123
- options: Array<{
124
- label: string;
125
- description?: string;
126
- }>;
127
- index: number;
128
- total: number;
129
- multiSelect?: boolean;
130
- selected?: number[];
131
- }): WecomVoteCard;
132
- export declare function buildSuggestionCard(input: {
133
- taskId: string;
134
- suggestion: string;
135
- }): WecomVoteCard;
136
- export declare function buildResolvedCard(input: {
137
- taskId: string;
138
- title: string;
139
- desc?: string;
140
- }): WecomVoteCard;
141
- export declare function parseTemplateCardClick(payload: unknown, reqId: string): WecomCardClick | undefined;
142
- export declare function permissionBehaviorFromKey(key: string, exitPlan: boolean): 'allow' | 'allow_always' | 'deny' | 'deny_and_exit_plan' | undefined;
@@ -1,78 +0,0 @@
1
- /**
2
- * One aibot_msg_callback → many stream.id bubbles on the same req_id.
3
- * Streams assistant text only. Tool and sub-agent activity stay off WeCom.
4
- */
5
- interface Bindable {
6
- subscribe: (listener: (event: unknown) => void) => {
7
- unsubscribe: () => void;
8
- };
9
- }
10
- export interface WecomStreamTransport {
11
- open(reqId: string, streamId: string): Promise<void>;
12
- push(reqId: string, streamId: string, content: string, finish: boolean): Promise<void>;
13
- }
14
- export declare function isRealWecomAssistantText(text: string | undefined | null): boolean;
15
- export declare function wecomCanonicalTextDelta(event: unknown): string;
16
- /**
17
- * WeCom mobile treats a later frame as "old + suffix" and appends the suffix
18
- * as a new line. Intermediate frames start with an alternating blank-looking
19
- * mark so the next full replace is not a prefix of the last displayed snapshot.
20
- * finish=true must keep that same marked snapshot — a clean body is treated as
21
- * a shorter replace and the bubble loses the rest of the text.
22
- */
23
- export declare function wecomStreamWireContent(text: string, finish: boolean, generation?: number): string;
24
- export declare class WecomBotLive {
25
- readonly reqId: string;
26
- readonly streamId: string;
27
- private readonly transport;
28
- private readonly minIntervalMs;
29
- private acc;
30
- private overflow;
31
- private bound;
32
- private closed;
33
- private finished;
34
- private sealed;
35
- private needBreak;
36
- private flip;
37
- private lastPushAt;
38
- private lastPushed;
39
- private lastWire;
40
- private timer;
41
- private segmentTimer;
42
- private sub?;
43
- private currentStreamId;
44
- private segmentChain;
45
- private rotating;
46
- constructor(reqId: string, streamId: string, transport: WecomStreamTransport, minIntervalMs?: number);
47
- /** Wait for in-flight bubble commits. Tests use this after a segment break. */
48
- whenIdle(): Promise<void>;
49
- get text(): string;
50
- get hasText(): boolean;
51
- get isSealed(): boolean;
52
- /** First frame. Must be invoked before any inbound await, then awaited before bind. */
53
- open(): Promise<void>;
54
- bind(subject: Bindable, _input?: Bindable, _phase?: Bindable): void;
55
- /** Stop receiving tokens. Allows a later bind after a superseded run. */
56
- detach(): void;
57
- /** Final unbind. Remaining model frames are dropped so the next live does not see them. */
58
- close(): void;
59
- ingest(event: unknown): void;
60
- /**
61
- * Close the current stream bubble so a template card can appear below it.
62
- * Later assistant tokens are buffered and sent as a new message.
63
- */
64
- sealForInteraction(placeholder?: string): Promise<void>;
65
- takeOverflow(): string;
66
- finish(): Promise<boolean>;
67
- private schedulePush;
68
- private flush;
69
- private emitFrame;
70
- private runSerial;
71
- private scheduleSegmentCommit;
72
- private commitCurrentSegment;
73
- private clearSegmentTimer;
74
- private commitArticleIfNeeded;
75
- private commitBubble;
76
- private ingestOverflow;
77
- }
78
- export {};
@@ -1,35 +0,0 @@
1
- /**
2
- * WeCom AI Bot Media Handler
3
- *
4
- * Handles media download for WeCom AI Bot WebSocket messages.
5
- *
6
- * WeCom AI Bot message media fields:
7
- * - image: { url: string; aeskey: string }
8
- * - voice: { url: string; aeskey: string }
9
- * - file: { url: string; aeskey: string; filename: string }
10
- *
11
- * Download flow: validate URL (SSRF allowlist) → fetch → detect/decrypt → save to temp file
12
- *
13
- * Decryption algorithm aligned with @wecom/aibot-node-sdk `decryptFile`:
14
- * - Algorithm: AES-256-CBC
15
- * - Key: Base64-decoded aeskey (32 bytes)
16
- * - IV: first 16 bytes of the decoded key
17
- * - Padding: PKCS#7 with 32-byte block size (manual removal)
18
- */
19
- /**
20
- * Download a WeCom AI Bot media file to a local temp file.
21
- *
22
- * Strategy:
23
- * 1. Validate URL against SSRF allowlist (https + WeCom domains)
24
- * 2. Fetch the raw data from the URL
25
- * 3. If the raw data is already a valid image (magic bytes), save it directly
26
- * 4. Otherwise, attempt AES-256-CBC decryption with aeskey
27
- * 5. Auto-correct file extension based on detected format
28
- * 6. Fallback: save raw data as-is (when no aeskey or decryption produces empty result)
29
- *
30
- * @param url - Media download URL from the message callback
31
- * @param aeskey - AES key for decryption (base64 encoded, 32 bytes when decoded)
32
- * @param extension - File extension including dot (e.g. '.jpg', '.silk')
33
- * @returns Path to the saved local file
34
- */
35
- export declare function downloadWecomBotMedia(url: string, aeskey: string | undefined, extension: string): Promise<string>;
@@ -1,49 +0,0 @@
1
- /**
2
- * WeCom AI Bot QR bind — same pairing page as @wecom/wecom-openclaw-cli.
3
- *
4
- * 不依赖那个 CLI 包:它的 scanQRCodeForBotInfo 会在超时后 process.exit。
5
- * 出码 / 轮询协议与 dist/utils/qrcode.js 一致。
6
- *
7
- * 1. GET /ai/qc/generate?source=wecom-cli&plat= → { scode, auth_url }
8
- * 2. 把 auth_url 画成二维码,企业微信扫开后一键建机器人
9
- * 3. GET /ai/qc/query_result?scode= → success 时回传 botid / secret
10
- */
11
- import type { QRAuthStatus } from '../../remote-control-protocol';
12
- import type { WecomBotCredentials } from './wecom-bot-auth';
13
- export declare const WECOM_QR_BIND_ORIGIN = "https://work.weixin.qq.com";
14
- /** 企微给 OpenClaw CLI 开的配对来源;换 source 会出不了码。 */
15
- export declare const WECOM_QR_BIND_SOURCE = "wecom-cli";
16
- export declare const WECOM_QR_BIND_POLL_INTERVAL_MS = 3000;
17
- export declare const WECOM_QR_BIND_TIMEOUT_MS: number;
18
- export interface WecomQrBindSession {
19
- scode: string;
20
- authUrl: string;
21
- }
22
- export interface WecomQrBindHttp {
23
- (url: string): Promise<unknown>;
24
- }
25
- export interface WecomQrBindDeps {
26
- fetchJson?: WecomQrBindHttp;
27
- renderQr?: (url: string) => Promise<string>;
28
- sleep?: (ms: number) => Promise<void>;
29
- now?: () => number;
30
- platform?: NodeJS.Platform;
31
- }
32
- export interface PerformWecomQrBindOptions extends WecomQrBindDeps {
33
- onStatus: (status: QRAuthStatus) => void;
34
- resolveManual?: () => WecomBotCredentials | undefined;
35
- signal?: AbortSignal;
36
- timeoutMs?: number;
37
- pollIntervalMs?: number;
38
- /** generate 失败时展示的兜底文案(手填说明),不画码。 */
39
- manualFallbackMessage?: string;
40
- }
41
- export declare function wecomQrBindPlatCode(platform?: NodeJS.Platform): number;
42
- export declare function wecomQrGenerateUrl(platform?: NodeJS.Platform): string;
43
- export declare function wecomQrQueryUrl(scode: string): string;
44
- export declare function wecomQrPageUrl(scode: string): string;
45
- export declare function parseWecomQrGeneratePayload(payload: unknown): WecomQrBindSession;
46
- export declare function parseWecomQrQueryPayload(payload: unknown): WecomBotCredentials | 'pending';
47
- export declare function requestWecomQrBindSession(deps?: WecomQrBindDeps): Promise<WecomQrBindSession>;
48
- export declare function queryWecomQrBindResult(scode: string, deps?: WecomQrBindDeps): Promise<WecomBotCredentials | 'pending'>;
49
- export declare function performWecomQrBind(options: PerformWecomQrBindOptions): Promise<WecomBotCredentials | undefined>;
@@ -1,33 +0,0 @@
1
- /**
2
- * Serial aibot_respond_msg per callback req_id.
3
- *
4
- * Official SDK: send one frame, wait for errcode, then send the next.
5
- * Same stream.id coalesces to the latest full replace. finish=true seals that
6
- * stream.id only — a new stream.id on the same req_id is a new chat bubble.
7
- */
8
- import { type WecomBotWsFrame, type WecomBotWsResponse } from './wecom-bot-types';
9
- export interface WecomRespondJob {
10
- reqId: string;
11
- streamId: string;
12
- content: string;
13
- finish: boolean;
14
- }
15
- export declare class WecomRespondQueue {
16
- private readonly send;
17
- private readonly timeoutMs;
18
- private readonly logger?;
19
- private seq;
20
- private readonly inFlight;
21
- private readonly queues;
22
- /** Late ack after timeout must not complete the next in-flight frame. */
23
- private readonly staleAck;
24
- /** finish=true seals one stream.id, not the whole req_id. */
25
- private readonly sealed;
26
- constructor(send: (frame: WecomBotWsFrame) => void, timeoutMs?: number, logger?: {
27
- warn(msg: string): void;
28
- } | undefined);
29
- enqueue(job: WecomRespondJob): Promise<void>;
30
- handleAck(reqId: string, response: WecomBotWsResponse): boolean;
31
- dispose(): void;
32
- private pump;
33
- }
@@ -1,207 +0,0 @@
1
- /**
2
- * WeChat Work AI Bot WebSocket API Types
3
- *
4
- * Type definitions for the enterprise WeChat AI Bot WebSocket long connection API.
5
- * Reference: https://developer.work.weixin.qq.com/document/path/101463
6
- */
7
- /** Generic WebSocket frame structure */
8
- export interface WecomBotWsFrame {
9
- cmd: string;
10
- headers: {
11
- req_id: string;
12
- [key: string]: string;
13
- };
14
- body: unknown;
15
- }
16
- /** Subscribe request (cmd: 'aibot_subscribe') */
17
- export interface WecomBotSubscribeFrame extends WecomBotWsFrame {
18
- cmd: 'aibot_subscribe';
19
- body: {
20
- bot_id: string;
21
- secret: string;
22
- };
23
- }
24
- /** Message callback (cmd: 'aibot_msg_callback') */
25
- export interface WecomBotMsgCallback extends WecomBotWsFrame {
26
- cmd: 'aibot_msg_callback';
27
- body: {
28
- msgid: string;
29
- aibotid: string;
30
- chatid: string;
31
- chattype: 'group' | 'single';
32
- from: {
33
- userid: string;
34
- };
35
- msgtype: 'text' | 'image' | 'mixed' | 'voice' | 'file';
36
- text?: {
37
- content: string;
38
- };
39
- image?: {
40
- url: string;
41
- aeskey: string;
42
- };
43
- /**
44
- * mixed 消息结构(实测,2026-04-28 诊断日志确认):
45
- * {
46
- * msg_item: [
47
- * { msgtype: 'image', image: { url, aeskey } },
48
- * { msgtype: 'text', text: { content: '...' } },
49
- * // 还可能是 voice/file
50
- * ]
51
- * }
52
- * 注意:此前错写为 `items: [{type, content}]`,实际字段名是 `msg_item`,
53
- * 子项字段是 `msgtype`,内容嵌套在 `sub[msgtype]` 下(和顶层 body 同结构)。
54
- */
55
- mixed?: {
56
- msg_item: Array<{
57
- msgtype: 'text';
58
- text: {
59
- content: string;
60
- };
61
- } | {
62
- msgtype: 'image';
63
- image: {
64
- url: string;
65
- aeskey: string;
66
- };
67
- } | {
68
- msgtype: 'voice';
69
- voice: {
70
- url: string;
71
- aeskey: string;
72
- };
73
- } | {
74
- msgtype: 'file';
75
- file: {
76
- url: string;
77
- aeskey: string;
78
- filename: string;
79
- };
80
- }>;
81
- };
82
- voice?: {
83
- url: string;
84
- aeskey: string;
85
- };
86
- file?: {
87
- url: string;
88
- aeskey: string;
89
- filename: string;
90
- };
91
- };
92
- }
93
- /** Event callback (cmd: 'aibot_event_callback') */
94
- export interface WecomBotEventCallback extends WecomBotWsFrame {
95
- cmd: 'aibot_event_callback';
96
- body: {
97
- msgid: string;
98
- create_time: number;
99
- aibotid: string;
100
- from: {
101
- userid: string;
102
- };
103
- chatid?: string;
104
- chattype?: 'group' | 'single';
105
- msgtype: 'event';
106
- event: {
107
- eventtype: 'enter_chat' | 'template_card_event' | 'feedback_event' | 'disconnected_event';
108
- event_key?: string;
109
- task_id?: string;
110
- template_card_event?: {
111
- card_type?: string;
112
- event_key?: string;
113
- task_id?: string;
114
- };
115
- [key: string]: unknown;
116
- };
117
- };
118
- }
119
- /** Stream reply frame (cmd: 'aibot_respond_msg') */
120
- export interface WecomBotRespondMsgFrame extends WecomBotWsFrame {
121
- cmd: 'aibot_respond_msg';
122
- body: {
123
- msgtype: 'stream';
124
- stream: {
125
- id: string;
126
- finish: boolean;
127
- content: string;
128
- };
129
- };
130
- }
131
- /** Welcome message frame (cmd: 'aibot_respond_welcome_msg') */
132
- export interface WecomBotWelcomeMsgFrame extends WecomBotWsFrame {
133
- cmd: 'aibot_respond_welcome_msg';
134
- body: {
135
- msgtype: 'text';
136
- text: {
137
- content: string;
138
- };
139
- };
140
- }
141
- /** Proactive push frame (cmd: 'aibot_send_msg') */
142
- export interface WecomBotSendMsgFrame extends WecomBotWsFrame {
143
- cmd: 'aibot_send_msg';
144
- body: {
145
- chatid: string;
146
- chat_type: number;
147
- msgtype: 'markdown' | 'template_card';
148
- markdown?: {
149
- content: string;
150
- };
151
- template_card?: Record<string, unknown>;
152
- };
153
- }
154
- /** Update a template card after a click (cmd: 'aibot_respond_update_msg') */
155
- export interface WecomBotUpdateMsgFrame extends WecomBotWsFrame {
156
- cmd: 'aibot_respond_update_msg';
157
- body: {
158
- response_type: 'update_template_card';
159
- /** 94888 更新按钮为不可点击状态 */
160
- button?: {
161
- replace_name: string;
162
- };
163
- template_card: Record<string, unknown>;
164
- };
165
- }
166
- /** Heartbeat frame (cmd: 'ping') */
167
- export interface WecomBotPingFrame extends WecomBotWsFrame {
168
- cmd: 'ping';
169
- body: Record<string, never>;
170
- }
171
- /** Generic WebSocket response (for subscribe/ping/send acks) */
172
- export interface WecomBotWsResponse {
173
- headers: {
174
- req_id: string;
175
- };
176
- errcode: number;
177
- errmsg: string;
178
- }
179
- export declare const WECOM_BOT_WS_URL = "wss://openws.work.weixin.qq.com";
180
- export declare const DEFAULT_HEARTBEAT_INTERVAL_MS = 30000;
181
- export declare const DEFAULT_MAX_RECONNECT_DELAY_MS = 60000;
182
- export declare const DEFAULT_DEDUP_WINDOW_SIZE = 1000;
183
- export declare const STREAM_TIMEOUT_MS: number;
184
- /** Official thinking animation: empty `<think>` tags render as three bouncing dots. */
185
- export declare const WECOM_STREAM_THINK = "<think></think>";
186
- /** Same req_id must wait for errcode; 400ms keeps the bubble from sticking on the first frame. */
187
- export declare const STREAM_REPLY_ACK_TIMEOUT_MS = 400;
188
- /**
189
- * Alternating leading marks on intermediate frames. WeCom strips ZW / trailing
190
- * cursors then treats a later frame as "old + suffix" and inserts a newline.
191
- * Changing the first character makes consecutive full-text frames fail that check.
192
- * Block cursors (▌/▍) survived the strip but stayed visible after finish; use
193
- * two blank-looking spaces that CJK fonts have and WeCom does not treat as ZW.
194
- */
195
- export declare const WECOM_STREAM_MARK_A = "\u3000";
196
- export declare const WECOM_STREAM_MARK_B = "\u00A0";
197
- export declare const WECOM_STREAM_MARK_RE: RegExp;
198
- /** Intermediate stream frames are coalesced; finish still flushes immediately. */
199
- export declare const WECOM_STREAM_PUSH_INTERVAL_MS = 80;
200
- /**
201
- * Wait after response_done so late tokens of the same response still join this
202
- * bubble. A later model response is hundreds of ms away; trailing deltas are not.
203
- */
204
- export declare const WECOM_SEGMENT_GRACE_MS = 160;
205
- export declare const ENV_KEY_WECOM_BOT_ID = "CODEBUDDY_WECOM_BOT_ID";
206
- export declare const ENV_KEY_WECOM_BOT_SECRET = "CODEBUDDY_WECOM_BOT_SECRET";
207
- export declare const ENV_KEY_WECOM_BOT_WS_URL = "CODEBUDDY_WECOM_BOT_WS_URL";