@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,42 +0,0 @@
1
- import { Logger } from '@genie/telemetry';
2
- import { MarketplaceSource } from '../plugin-protocol';
3
- import { GitAvailabilityDetector } from './git-availability-detector';
4
- import { GitToZipUrlConverter } from './git-to-zip-url-converter';
5
- /**
6
- * Facade that decides whether a Git/Github marketplace source should be
7
- * silently rewritten to a Zip source because the local `git` executable is
8
- * not available.
9
- *
10
- * The rewrite is intentionally applied as early as possible in
11
- * {@link PluginManagerImpl.addMarketplace} — before the marketplace info is
12
- * persisted to disk — so that the on-disk state reflects the actual install
13
- * method. This keeps subsequent `updateMarketplace`, autoUpdate and startup
14
- * load paths on the Zip code path without requiring any per-path patches.
15
- *
16
- * See `apps/workbuddy-desktop/docs/refactor/marketplace/09-git-to-zip-fallback-design.md`
17
- * for the full design.
18
- */
19
- export declare class GitFallbackCoordinator {
20
- protected readonly logger: Logger;
21
- protected readonly detector: GitAvailabilityDetector;
22
- protected readonly converter: GitToZipUrlConverter;
23
- /**
24
- * When the input is a Git/Github source and the local git is unavailable,
25
- * return a new Zip source targeting the platform's archive URL. Otherwise
26
- * return the input unchanged.
27
- *
28
- * Warnings are emitted (but no error is thrown) when git is unavailable
29
- * but no conversion is possible; the original source is returned so the
30
- * subsequent Git install can surface its native error message to the user.
31
- *
32
- * @param src Source produced by {@link PluginManagerImpl.parseSource}.
33
- * @param displayName Optional marketplace name used only for logging.
34
- */
35
- maybeFallback(src: MarketplaceSource, displayName?: string): Promise<MarketplaceSource>;
36
- /**
37
- * Extract a usable reference string from a Git/Github source. Prefers
38
- * the most explicit form (`url`) and falls back through `path` and
39
- * `repo` shorthand.
40
- */
41
- private extractUrl;
42
- }
@@ -1,50 +0,0 @@
1
- /**
2
- * A single platform's rule for translating a Git repository URL to a ZIP
3
- * download URL. Rules are matched by hostname and applied in registration
4
- * order (newest first, see {@link GitToZipUrlConverter.registerRule}).
5
- */
6
- export interface GitPlatformRule {
7
- /** Human-readable rule identifier, used in logs and tests. */
8
- readonly name: string;
9
- /** Return true when this rule applies to the given lower-cased hostname. */
10
- match(hostname: string): boolean;
11
- /**
12
- * Build the ZIP download URL.
13
- *
14
- * @param host Host with optional port, as returned by `URL#host`.
15
- * @param pathname Repository pathname with leading `/` and no trailing `/`.
16
- */
17
- convert(host: string, pathname: string): string;
18
- }
19
- /**
20
- * Converts Git-style references (http(s) URLs, SSH URLs, or `owner/repo`
21
- * shorthand) into archive download URLs understood by {@link ZipMarketplace}.
22
- *
23
- * Rule set is intentionally aligned with the reference table in
24
- * `packages/agent-craft/src/common/plugin/plugin-manager.ts` so the two
25
- * implementations stay behaviour-compatible.
26
- *
27
- * The converter does not know whether git is available; that decision is
28
- * made by {@link GitFallbackCoordinator}.
29
- */
30
- export declare class GitToZipUrlConverter {
31
- private readonly rules;
32
- /**
33
- * Register an additional rule. Newer rules take precedence over built-ins
34
- * so callers can override default behaviour for a specific host.
35
- */
36
- registerRule(rule: GitPlatformRule): void;
37
- /**
38
- * Convert a Git reference to a ZIP archive URL.
39
- *
40
- * Accepts:
41
- * - `https://host/owner/repo` / `https://host/owner/repo.git`
42
- * - `git@host:owner/repo(.git)?`
43
- * - `owner/repo` shorthand (assumed to be GitHub)
44
- *
45
- * Returns `undefined` when the host is not recognised or the input is
46
- * not parseable as any of the accepted forms.
47
- */
48
- convert(input: string): string | undefined;
49
- private normaliseToHttpUrl;
50
- }
@@ -1,41 +0,0 @@
1
- import { ProgressCallback } from '../plugin-protocol';
2
- import { DirectoryMarketplace } from './directory-marketplace';
3
- /**
4
- * GitHub类型的市场实现类
5
- */
6
- export declare class GithubMarketplace extends DirectoryMarketplace {
7
- /**
8
- * 安装或更新GitHub仓库到本地
9
- */
10
- install(onProgress?: ProgressCallback): Promise<void>;
11
- /**
12
- * clone 完成后根据 marketplace.json 里的 name rename 目录。
13
- *
14
- * 不复用 HttpMarketplace 的 tempLocation 预建方式:Git marketplace 的 manifest
15
- * 是随 clone 一并下来的,install 开始时读不到 —— 因此只能在 update() 之后回头调整。
16
- *
17
- * rename 失败不抛异常:clone 已成功,稳住旧目录名仍可继续工作,由上层的
18
- * known_marketplaces.json 记录 installLocation 做后续定位。
19
- * 不安全的 manifest.name(路径穿越)忽略,同样保留 slug 目录 (#71947)。
20
- */
21
- private renameToManifestName;
22
- /**
23
- * 读取 installLocation 下的 marketplace.json 获取 name 字段
24
- * 遍历所有支持的 metadata 目录(.codebuddy-plugin / .claude-plugin)
25
- */
26
- private readManifestName;
27
- private readMarketplaceManifest;
28
- update(onProgress?: ProgressCallback): Promise<boolean>;
29
- private readRepoState;
30
- /**
31
- * 克隆Git仓库
32
- * clone 失败时清理残留目录,避免后续 update 误判为已有仓库
33
- */
34
- private cloneRepo;
35
- private swapDirectoryFromStaging;
36
- /**
37
- * 获取Git URL
38
- * 从source中提取Git仓库地址
39
- */
40
- private getGitUrl;
41
- }
@@ -1,47 +0,0 @@
1
- import { ProgressCallback } from '../plugin-protocol';
2
- import { DirectoryMarketplace } from './directory-marketplace';
3
- /**
4
- * HTTP类型的市场实现类
5
- */
6
- export declare class HttpMarketplace extends DirectoryMarketplace {
7
- /** 上次成功命中的远端元数据目录,用于后续插件探测时优先尝试 */
8
- private detectedMetaDir?;
9
- /**
10
- * 安装或更新HTTP市场到本地
11
- * HTTP市场需要下载marketplace.json和所有插件的plugin.json到本地缓存
12
- */
13
- install(onProgress?: ProgressCallback): Promise<void>;
14
- /**
15
- * 更新HTTP市场
16
- * 重新下载marketplace.json和插件信息
17
- */
18
- update(onProgress?: ProgressCallback): Promise<boolean>;
19
- /**
20
- * 获取marketplace.json内容
21
- */
22
- private fetchManifest;
23
- /**
24
- * 下载marketplace.json到本地
25
- */
26
- private downloadManifest;
27
- private downloadPluginManifest;
28
- private fetchJson;
29
- /** Compare complete metadata snapshots so a successful no-op refresh stays idempotent. */
30
- private haveSameSnapshot;
31
- private readSnapshotFiles;
32
- /**
33
- * 根据URL生成临时名称(用于初始下载)
34
- */
35
- private generateNameFromUrl;
36
- /**
37
- * 获取HTTP URL
38
- * 从source中提取HTTP地址,source.url实际指向marketplace.json
39
- */
40
- private getHttpUrl;
41
- /**
42
- * 构建完整URL
43
- */
44
- private buildUrl;
45
- private swapDirectoryFromStaging;
46
- private safeRemove;
47
- }
@@ -1,13 +0,0 @@
1
- export * from './base-marketplace';
2
- export * from './directory-marketplace';
3
- export * from './github-marketplace';
4
- export * from './http-marketplace';
5
- export * from './zip-marketplace';
6
- export * from './marketplace-factory';
7
- export * from './marketplace-storage';
8
- export * from './marketplace-config-manager';
9
- export * from './marketplace-update-checker';
10
- export * from './builtin-marketplace-provider';
11
- export * from './git-availability-detector';
12
- export * from './git-to-zip-url-converter';
13
- export * from './git-fallback-coordinator';
@@ -1,39 +0,0 @@
1
- import { Logger } from '@genie/telemetry';
2
- import { SettingsManager } from '../../settings';
3
- import { CliSettingSourcesProvider } from '../../settings/cli-setting-sources-provider';
4
- import { MarketplaceConfigManager, MarketplaceSource, MarketplaceStorage, MarketplaceToInstall } from '../plugin-protocol';
5
- /**
6
- * 市场配置管理器
7
- * 负责从 settings 中读取 extraKnownMarketplaces 配置,
8
- * 并识别需要安装的市场
9
- */
10
- export declare class MarketplaceConfigManagerImpl implements MarketplaceConfigManager {
11
- protected readonly logger: Logger;
12
- protected readonly settingsManager: SettingsManager;
13
- protected readonly cliSettingSourcesProvider: CliSettingSourcesProvider;
14
- protected readonly marketplaceStorage: MarketplaceStorage;
15
- protected init(): void;
16
- /**
17
- * 获取所有配置的市场(按 user → project → local → CLI 顺序合并,后者覆盖前者)
18
- *
19
- * 各 scope 受 `--setting-sources` 约束(isScopeAllowed:文件系统 scope 需在
20
- * sources 里,CLI 来自 `--settings` 显式注入、恒允许),避免 SDK/隔离环境
21
- * 仍被本机 settings 注入市场。
22
- */
23
- getConfiguredMarketplaces(options?: {
24
- includeSession?: boolean;
25
- }): Promise<Map<string, MarketplaceSource>>;
26
- private getConfiguredMarketplaceDeclarations;
27
- /**
28
- * 获取需要安装的市场列表
29
- */
30
- getMarketplacesToInstall(): Promise<MarketplaceToInstall[]>;
31
- /**
32
- * 合并市场配置到 Map 中
33
- */
34
- private mergeMarketplaceConfig;
35
- /**
36
- * 验证市场源配置的有效性
37
- */
38
- private validateMarketplaceSource;
39
- }
@@ -1,11 +0,0 @@
1
- import { Marketplace, MarketplaceInfo } from '../plugin-protocol';
2
- /**
3
- * Marketplace工厂类
4
- * 根据source类型创建不同的Marketplace实例
5
- */
6
- export declare class MarketplaceFactory {
7
- /**
8
- * 从JSON对象创建对应类型的Marketplace实例
9
- */
10
- static createFromJSON(marketplaceInfo: MarketplaceInfo): Marketplace;
11
- }
@@ -1,141 +0,0 @@
1
- import { Logger } from '@genie/telemetry';
2
- import { FileLockService } from '../../lock';
3
- import { MarketplaceInfo, MarketplaceStorage, PluginErrorCollector } from '../plugin-protocol';
4
- /**
5
- * 市场存储实现
6
- * 负责管理市场配置的持久化
7
- *
8
- * 并发与原子性保证:
9
- * 1. 进程内:`writeLock` Promise 链串行化 read-modify-write,避免同一进程内的 lost-update。
10
- * 2. 跨进程:`FileLockService` 互斥锁,防止多 CLI/Gateway/Desktop 实例同时写同一份 JSON 导致字节级交错。
11
- * 3. 原子写:`tempFile + rename`,即便锁意外失效,读者也只会看到旧版本或新版本,绝不会看到半成品。
12
- * 4. 自愈:读到无法解析的 JSON 时只在同一写锁内复查、备份为 `.broken-<ts>`,
13
- * 再由真实 mutation 重建;只读路径绝不创建/覆盖 registry。
14
- */
15
- export declare class MarketplaceStorageImpl implements MarketplaceStorage {
16
- protected readonly logger: Logger;
17
- protected readonly errorCollector: PluginErrorCollector;
18
- protected readonly fileLockService: FileLockService;
19
- /** 市场配置文件路径 */
20
- private readonly configFilePath;
21
- /** 当前配置目录检查的 single-flight;完成后释放以支持外部删除后的自愈。 */
22
- private configFileInitPromise?;
23
- /** 序列化写操作,防止并发 read-modify-write 丢失更新(进程内) */
24
- private writeLock;
25
- constructor();
26
- protected init(): void;
27
- /**
28
- * 进程内写锁:确保同一进程内的写操作串行执行。
29
- */
30
- private withWriteLock;
31
- /**
32
- * 跨进程文件锁:确保多进程间的写操作互斥。
33
- * 获取失败时必须终止写入。仅进程内锁无法阻止另一个 CLI 基于旧快照
34
- * 覆盖 known_marketplaces.json,原子 rename 只能防半文件,不能防 lost-update。
35
- */
36
- private withFileLock;
37
- /**
38
- * 同时获取进程内锁与跨进程锁。
39
- */
40
- private withLocks;
41
- private sanitizeLockName;
42
- /** Ensure only the parent directory. Readers must never create registry data. */
43
- private ensureConfigFileAsync;
44
- /**
45
- * 实际执行配置文件初始化
46
- */
47
- private doEnsureConfigFile;
48
- /**
49
- * Read the registry without mutating it. A caller that already holds the
50
- * storage write lock may opt into corruption repair; only that path backs
51
- * up the broken snapshot and returns an empty object for the subsequent
52
- * atomic write. Unlocked readers surface a typed error so they cannot race
53
- * a healthy writer with a repair rename.
54
- */
55
- private readAndRepair;
56
- private getPublishingMarketplaceNames;
57
- private sameStringSet;
58
- /**
59
- * Journal/registry seqlock for unlocked readers. The marketplace-name lock
60
- * remains the authoritative boundary for mutable-source copying, but this
61
- * prevents list/browse callers from constructing a Marketplace from the
62
- * obvious stable-swap window.
63
- */
64
- private readConsistentMarketplaceSnapshot;
65
- /**
66
- * Older WorkBuddy builds registered a generated marketplace root inside
67
- * `plugins/cache`. Keep detecting those records for compatibility, but
68
- * never move cache contents into `plugins/marketplaces`.
69
- *
70
- * Claude keeps these trees independent:
71
- * - marketplaces/<marketplace> is the mutable source checkout
72
- * - cache/<marketplace>/<plugin>/<version> is an immutable install snapshot
73
- */
74
- private hasRepairableLegacyMarketplaceCacheReferences;
75
- private getCanonicalMarketplaceLocation;
76
- /**
77
- * Repair only the storage reference when a real canonical marketplace
78
- * source already exists. Cache-only legacy records are intentionally left
79
- * untouched: moving them would turn installed snapshots into a marketplace
80
- * source and destroy the cache/source boundary.
81
- */
82
- private repairLegacyMarketplaceCacheReferences;
83
- private isMarketplaceRoot;
84
- /**
85
- * 原子写:写入临时文件后 rename 到目标路径。
86
- * 同一文件系统内 rename 是原子操作,读者要么看到旧文件要么看到新文件,
87
- * 绝不会看到"被截断后正在写入"的半成品。
88
- */
89
- private atomicWriteJson;
90
- /**
91
- * 生成与 pid/时间戳/随机串绑定的临时文件名,避免多进程冲突。
92
- * 抽成实例方法以便测试替换。
93
- */
94
- protected generateTempPath(): string;
95
- /**
96
- * 底层写入临时文件。抽成实例方法以便测试替换而不污染 `fs-extra` 模块属性。
97
- */
98
- protected writeTempFile(tempPath: string, content: string): Promise<void>;
99
- /**
100
- * 底层原子 rename,带 Windows EPERM/EBUSY/EACCES 重试。抽成实例方法以便测试替换。
101
- *
102
- * 背景:Windows 上 `rename` 覆盖已存在的目标文件需要对目标持有 DELETE 权限。
103
- * 当杀软 / 索引器 / 并发的无锁读取者(getMarketplaces → readAndRepair 读取
104
- * known_marketplaces.json 时不加锁)持有目标文件的句柄且未带 FILE_SHARE_DELETE 时,
105
- * 替换式 rename 会抛 `EPERM: operation not permitted, rename ...`,进而冒泡成
106
- * 删除市场 HTTP 500。这类占用几乎都是瞬时的(占用方几十毫秒内即释放),
107
- * 因此做短退避重试即可扛住,而不改变 temp+rename 的原子写语义。
108
- *
109
- * 注意:刻意不做 copyFile 兜底——copyFile 非原子,会让读取者看到半成品。
110
- * 保持纯 rename
111
- * 重试,既消除该风险,又覆盖现实中绝大多数瞬时 EPERM。重试耗尽仍失败时
112
- * 抛出原始 rename 错误,保留诊断信息。
113
- */
114
- protected renameTempFile(tempPath: string, targetPath: string): Promise<void>;
115
- /**
116
- * 底层 fs.rename。抽成实例方法以便测试注入失败(fs-extra 的导出方法不可 stub)。
117
- */
118
- protected rawRename(tempPath: string, targetPath: string): Promise<void>;
119
- /**
120
- * 底层清理临时文件(best-effort)。抽成实例方法以便测试替换与断言。
121
- */
122
- protected removeTempFile(tempPath: string): Promise<void>;
123
- /**
124
- * 获取所有市场配置
125
- */
126
- getMarketplaces(options?: {
127
- includePublishing?: boolean;
128
- }): Promise<MarketplaceInfo[]>;
129
- /**
130
- * 保存市场配置
131
- */
132
- saveMarketplace(marketplace: MarketplaceInfo): Promise<void>;
133
- /**
134
- * 删除市场配置
135
- */
136
- removeMarketplace(name: string): Promise<void>;
137
- /**
138
- * 检查市场是否已安装
139
- */
140
- isMarketplaceInstalled(name: string): Promise<boolean>;
141
- }
@@ -1,38 +0,0 @@
1
- import { ProductManager } from '@genie/product';
2
- import { Logger } from '@genie/telemetry';
3
- import { MarketplaceNeedsUpdateResult, MarketplaceUpdateChecker } from '../plugin-protocol';
4
- /**
5
- * Default implementation of {@link MarketplaceUpdateChecker}.
6
- *
7
- * Check order (first decisive signal wins):
8
- * 1. mtime throttle — if the version file was touched recently, skip remote calls
9
- * 2. versionUrl (Product metadata) — fetch a small remote version token
10
- * 3. urlVersion (由调用方从 zipUrl 解析得到) — 本地版本号字符串比对,
11
- * 不发起任何 HTTP;所有调度方共用 `parseVersionFromUrl`,避免两层更新
12
- * 判据不一致。
13
- * 4. ETag / Last-Modified (HEAD on the zip URL) — 兜底路径,覆盖用户自定义市场
14
- * 及 url 不带 UUID 段的内置市场。
15
- *
16
- * This service is a Singleton so its throttle map lives across marketplace transient instances.
17
- */
18
- export declare class MarketplaceUpdateCheckerImpl implements MarketplaceUpdateChecker {
19
- protected readonly logger: Logger;
20
- protected readonly productManager: ProductManager;
21
- protected init(): void;
22
- needsUpdate(args: {
23
- marketplaceName: string;
24
- installLocation: string;
25
- zipUrl: string;
26
- versionUrl?: string;
27
- urlVersion?: string;
28
- }): Promise<MarketplaceNeedsUpdateResult>;
29
- commitVersion(marketplaceName: string, installLocation: string, version: string): Promise<void>;
30
- invalidateCache(marketplaceName: string, installLocation: string): Promise<void>;
31
- protected fetchRemoteVersion(versionUrl: string): Promise<string>;
32
- private isRecentlyChecked;
33
- private touchVersionFile;
34
- private readCachedVersion;
35
- private hasZipMetadata;
36
- private classifyHttpCheck;
37
- private getCheckIntervalMs;
38
- }
@@ -1,14 +0,0 @@
1
- export interface WorkspaceProjectIdentity {
2
- kind: 'directory' | 'git';
3
- path: string;
4
- }
5
- /**
6
- * Resolve Claude-compatible project identity for Plugin installation records.
7
- * Git worktrees use their canonical common/main repository root, while a
8
- * directory outside Git keeps its canonical requested path. Missing trailing
9
- * path components are preserved lexically after resolving the nearest existing
10
- * ancestor so historical registry records remain comparable.
11
- */
12
- export declare function resolveWorkspaceProjectIdentity(workspacePath: string, options?: {
13
- preserveNonGitPath?: boolean;
14
- }): Promise<WorkspaceProjectIdentity>;
@@ -1,134 +0,0 @@
1
- import { MarketplaceUpdatePreparation, ProgressCallback } from '../plugin-protocol';
2
- import { DirectoryMarketplace } from './directory-marketplace';
3
- /**
4
- * Marketplace source served as a ZIP / TGZ / TAR.GZ archive.
5
- *
6
- * Install flow:
7
- * 1. Download (or copy for local paths) the archive into an OS temp directory
8
- * 2. Extract into the same OS temp directory
9
- * 3. Read `marketplace.json` to determine the final marketplace name
10
- * 4. Atomically move the temp directory to `~/.codebuddy/plugins/marketplaces/<name>`
11
- * 5. Persist HTTP caching metadata (`.zip-metadata.json`) for future freshness checks
12
- *
13
- * Update flow mirrors install but preserves the existing installation until the
14
- * new extraction succeeds, so a failed update never corrupts a working copy.
15
- */
16
- export declare class ZipMarketplace extends DirectoryMarketplace {
17
- /** ZIP archives are complete snapshots; copying the live tree is wasted IO. */
18
- get updateStagingMode(): 'empty';
19
- install(onProgress?: ProgressCallback): Promise<void>;
20
- checkForUpdate(onProgress?: ProgressCallback): Promise<MarketplaceUpdatePreparation>;
21
- update(onProgress?: ProgressCallback, preparation?: MarketplaceUpdatePreparation): Promise<boolean>;
22
- /**
23
- * 当前 marketplace 是否为内置市场。
24
- * 仅在需要走 url-version 分支时判别,避免动到非内置市场的原有路径。
25
- */
26
- private getBuiltInVersionMetadata;
27
- /**
28
- * 首装成功后记录 Product versionUrl 或 ZIP URL 中的版本。只写入检查器
29
- * 已确认的 token;失败时保留完整安装并让下次后台刷新重试。
30
- */
31
- private seedVersionCache;
32
- /**
33
- * Try `downloadFile(url)`; on HTTP 404, attempt the alternate branch name
34
- * (main ↔ master) exactly once. Throws the original error if no fallback
35
- * applies or the fallback also fails.
36
- */
37
- private downloadWithBranchFallback;
38
- /**
39
- * Look for `marketplace.json` at the extraction root or inside the known
40
- * metadata directories (e.g. `.codebuddy-plugin/`, `.claude-plugin/`).
41
- */
42
- private readManifestFromDir;
43
- /** Same lookup as `readManifestFromDir`, but keeps the path so callers can rewrite it. */
44
- private readManifestEntryFromDir;
45
- /**
46
- * Every manifest copy that exists in the tree, in lookup order.
47
- *
48
- * Archives sometimes ship the manifest twice — at the extraction root and
49
- * inside a metadata directory — so that clients with different conventions
50
- * both find one. Readers disagree about which copy wins: this class checks
51
- * the root first, while `loadManifest` and `isMarketplaceMaterialized` only
52
- * ever look inside the metadata directories. Anything that rewrites a
53
- * manifest must therefore rewrite all of them.
54
- */
55
- private listManifestPaths;
56
- /**
57
- * Accept a freshly extracted archive as this marketplace's next snapshot.
58
- *
59
- * A published archive that declares a local plugin it does not ship is the
60
- * publisher's mistake, not a half-written local extraction: every retry
61
- * downloads the same incomplete bytes, so rejecting it strands the whole
62
- * marketplace — the remaining plugins become uninstallable and the
63
- * registry can never move to the declared source. Drop the unshipped
64
- * entries instead and keep the rest usable.
65
- *
66
- * Every manifest copy in the staged tree is pruned before it is published,
67
- * so the snapshot we install is internally consistent. Otherwise
68
- * `checkForUpdate`, which validates the installed snapshot strictly, would
69
- * rediscover the gap on every pass and re-download the same archive
70
- * forever, and a stale copy would keep `isMarketplaceMaterialized`
71
- * answering "not installed" for a marketplace that is in fact installed.
72
- *
73
- * Two conditions still reject the archive: entries that resolve outside
74
- * the archive or are not directories (integrity violations, #71947), and
75
- * archives missing more than the caps above allow.
76
- */
77
- private adoptDownloadedSnapshot;
78
- /** Drop entries pointing at `missingPaths` from one manifest copy on disk. */
79
- private pruneManifestFile;
80
- /** Whether a manifest entry points at one of the directories the archive omitted. */
81
- private declaresMissingPath;
82
- private assertValidManifest;
83
- /** Narrowing wrapper for callers that also need the manifest's path. */
84
- private assertValidManifestEntry;
85
- /**
86
- * Strict check for an already installed snapshot.
87
- *
88
- * Freshness metadata describes the whole extracted source snapshot, not
89
- * only marketplace.json. A process killed after publishing that manifest
90
- * but before every local plugin directory exists must not make the next
91
- * update return "current" forever. A local gap is always recoverable by
92
- * re-downloading, so nothing here is tolerated — unlike a freshly
93
- * downloaded archive, where `adoptDownloadedSnapshot` decides.
94
- */
95
- private assertCompleteSnapshot;
96
- /**
97
- * Walk the manifest's local plugin entries against the tree on disk.
98
- *
99
- * Absent directories are reported to the caller, which decides whether
100
- * they are tolerable. Entries that escape the archive root or are not
101
- * directories always throw: they are integrity violations rather than
102
- * missing content, and no caller may accept them.
103
- */
104
- private inspectLocalPlugins;
105
- /** Extract the archive URL from the marketplace source config. */
106
- private getZipUrl;
107
- /**
108
- * Derive a stable, filesystem-safe base name from a URL or local path.
109
- * Used as the temp directory prefix until the real name is read from the manifest.
110
- */
111
- private generateNameFromUrl;
112
- private slugify;
113
- private createTempRoot;
114
- private swapDirectoryFromTemp;
115
- private renameDirectory;
116
- /** Remove a path if it exists, silently ignoring any failure. */
117
- private safeRemove;
118
- /**
119
- * Sweep orphan transient artefacts from `marketplacesRoot`.
120
- *
121
- * An artefact is considered orphan when:
122
- * 1. Its name matches `<...>.<13-digit-ts>-<6-char-suffix>(.zip|.tmp)?` —
123
- * i.e. the unique-suffix naming this class uses for downloads/extract dirs.
124
- * 2. The embedded timestamp is older than ORPHAN_ARTIFACT_MIN_AGE_MS, so we
125
- * never touch temp files belonging to a concurrent install/update.
126
- *
127
- * Real marketplace install dirs (e.g. `cb_teams_marketplace`) never carry
128
- * the timestamp+random suffix, so they cannot match the pattern.
129
- *
130
- * Best-effort: any failure here must not affect the caller's install/update
131
- * result, which has already succeeded by the time we run.
132
- */
133
- private cleanupOrphanArtifacts;
134
- }
@@ -1,29 +0,0 @@
1
- import { McpConfig } from '../mcp';
2
- import { McpBundleEntry, McpBundleLoadResult } from './plugin-protocol';
3
- /**
4
- * 判断源字符串是否为 MCPB 文件引用
5
- */
6
- export declare function isMcpbSource(source: string): boolean;
7
- /**
8
- * 加载 MCP Bundle 文件
9
- *
10
- * 流程:
11
- * 1. 检查缓存
12
- * 2. 下载或读取本地文件
13
- * 3. 校验 checksum
14
- * 4. 解压 ZIP
15
- * 5. 解析 manifest.json
16
- * 6. 生成 MCP 服务器配置
17
- * 7. 保存缓存元数据
18
- */
19
- export declare function loadMcpBundle(bundle: McpBundleEntry, pluginPath: string, pluginId: string, onProgress?: (status: string) => void): Promise<McpBundleLoadResult>;
20
- /**
21
- * 批量加载 MCP Bundles
22
- */
23
- export declare function loadMcpBundles(bundles: McpBundleEntry[], pluginPath: string, pluginId: string, onProgress?: (status: string) => void): Promise<{
24
- configs: Record<string, McpConfig>;
25
- errors: Array<{
26
- bundle: McpBundleEntry;
27
- error: Error;
28
- }>;
29
- }>;