@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.
- package/cli/CHANGELOG.md +22 -0
- package/cli/dist/codebuddy-headless.js +73 -58
- package/cli/dist/codebuddy-lite-wb.mjs +96 -81
- package/cli/dist/lazy/{427.68132a34.js → 427.74b982af.js} +4 -4
- package/cli/dist/lazy-headless/{834.391fb41e.js → 834.3b674e07.js} +9 -9
- package/cli/dist-server/3556.codebuddy.js +1 -1
- package/cli/dist-server/6037.codebuddy.js +1 -1
- package/cli/dist-server/6784.codebuddy.js +1 -1
- package/cli/dist-server/codebuddy.js +45 -30
- package/cli/dist-server/types/node/agent/openai-agents-types.d.ts +5 -5
- package/cli/dist-server/types/node/mcp/mcp-sdk-values.d.ts +1 -1
- package/cli/dist-server/types/node/model/model-provider.d.ts +3 -1
- package/cli/dist-server/types/node/tools/a2a-get-task-tool.d.ts +139 -34
- package/cli/dist-server/types/node/tools/a2a-poll-retry.d.ts +46 -0
- package/cli/package.json +1 -1
- package/cli/product.cloudhosted.json +2 -2
- package/cli/product.internal.json +2 -2
- package/cli/product.ioa.json +2 -2
- package/cli/product.json +4 -4
- package/cli/product.selfhosted.json +2 -2
- package/package.json +1 -1
- package/cli/dist-server/types/node/acp/acp-view-rewind-to.d.ts +0 -34
- package/cli/dist-server/types/node/acp/acp-web-ui-client.d.ts +0 -22
- package/cli/dist-server/types/node/acp/usage-by-category-calculator.d.ts +0 -45
- package/cli/dist-server/types/node/acp/usage-by-category-char-weight.d.ts +0 -9
- package/cli/dist-server/types/node/acp/usage-by-category-distribute.d.ts +0 -6
- package/cli/dist-server/types/node/acp/usage-by-category-tools-split.d.ts +0 -11
- package/cli/dist-server/types/node/agent-home/agent-home-envelope-body.d.ts +0 -54
- package/cli/dist-server/types/node/agent-home/agent-home-inbox-events.d.ts +0 -14
- package/cli/dist-server/types/node/agent-home/agent-home-room-contacts.d.ts +0 -30
- package/cli/dist-server/types/node/agent-team/permission-bridge-client.d.ts +0 -32
- package/cli/dist-server/types/node/agent-team/permission-bridge-protocol.d.ts +0 -47
- package/cli/dist-server/types/node/agent-view/handoff-policy.d.ts +0 -80
- package/cli/dist-server/types/node/agent-view/job-respawn-prefs.d.ts +0 -12
- package/cli/dist-server/types/node/agent-view/session-handoff.d.ts +0 -161
- package/cli/dist-server/types/node/ask/index.d.ts +0 -3
- package/cli/dist-server/types/node/bash-sandbox/bash-sandbox-manager.d.ts +0 -125
- package/cli/dist-server/types/node/bash-sandbox/legacy-sandbox-shell-service.d.ts +0 -33
- package/cli/dist-server/types/node/bash-sandbox/managed-security-policy.d.ts +0 -6
- package/cli/dist-server/types/node/bash-sandbox/workbuddy-directory-protection.d.ts +0 -12
- package/cli/dist-server/types/node/checkpoint/checkpoint-service.d.ts +0 -70
- package/cli/dist-server/types/node/checkpoint/file-changes-controller.d.ts +0 -29
- package/cli/dist-server/types/node/checkpoint/file-track-service.d.ts +0 -11
- package/cli/dist-server/types/node/checkpoint/file-version-manager.d.ts +0 -10
- package/cli/dist-server/types/node/checkpoint/file-version-store.d.ts +0 -9
- package/cli/dist-server/types/node/checkpoint/file-version-update-strategies.d.ts +0 -62
- package/cli/dist-server/types/node/command/add-dir-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/agents-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/auto-compact-command-executor.d.ts +0 -20
- package/cli/dist-server/types/node/command/background-command-executor.d.ts +0 -29
- package/cli/dist-server/types/node/command/btw-command-executor.d.ts +0 -19
- package/cli/dist-server/types/node/command/clear-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/config-command-executor.d.ts +0 -15
- package/cli/dist-server/types/node/command/context-command-executor.d.ts +0 -42
- package/cli/dist-server/types/node/command/copy-command-executor.d.ts +0 -10
- package/cli/dist-server/types/node/command/cost-command-executor.d.ts +0 -13
- package/cli/dist-server/types/node/command/debug-command-executor.d.ts +0 -15
- package/cli/dist-server/types/node/command/deep-research-command-executor.d.ts +0 -25
- package/cli/dist-server/types/node/command/doctor-command-executor.d.ts +0 -7
- package/cli/dist-server/types/node/command/effort-command-executor.d.ts +0 -46
- package/cli/dist-server/types/node/command/exit-command-executor.d.ts +0 -14
- package/cli/dist-server/types/node/command/export-command-executor.d.ts +0 -7
- package/cli/dist-server/types/node/command/feedback-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/fork-bg-command-executor.d.ts +0 -30
- package/cli/dist-server/types/node/command/fork-command-executor.d.ts +0 -28
- package/cli/dist-server/types/node/command/goal-command-executor.d.ts +0 -50
- package/cli/dist-server/types/node/command/handoff-message-adapter.d.ts +0 -9
- package/cli/dist-server/types/node/command/help-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/hooks-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/ide-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/mcp-command-executor.d.ts +0 -15
- package/cli/dist-server/types/node/command/memory-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/mode-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/model-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/model-image-to-image-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-image-to-video-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-lite-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-reasoning-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-text-to-image-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/model-text-to-video-command-executor.d.ts +0 -17
- package/cli/dist-server/types/node/command/multitask-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/permissions-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/plan-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/plugin-command-executor.d.ts +0 -25
- package/cli/dist-server/types/node/command/plugin-validate-command-executor.d.ts +0 -21
- package/cli/dist-server/types/node/command/release-notes-command-executor.d.ts +0 -18
- package/cli/dist-server/types/node/command/reload-plugins-command-executor.d.ts +0 -24
- package/cli/dist-server/types/node/command/remote-control-command-executor.d.ts +0 -44
- package/cli/dist-server/types/node/command/rename-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/reset-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/resume-command-executor.d.ts +0 -21
- package/cli/dist-server/types/node/command/rewind-command-executor.d.ts +0 -10
- package/cli/dist-server/types/node/command/sandbox-command-executor.d.ts +0 -20
- package/cli/dist-server/types/node/command/save-workflow-command-executor.d.ts +0 -43
- package/cli/dist-server/types/node/command/session-reset-notifier.d.ts +0 -23
- package/cli/dist-server/types/node/command/skills-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/stats-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/status-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/tasks-command-executor.d.ts +0 -9
- package/cli/dist-server/types/node/command/terminal-setup-command-executor.d.ts +0 -7
- package/cli/dist-server/types/node/command/theme-command-executor.d.ts +0 -7
- package/cli/dist-server/types/node/command/todos-command-executor.d.ts +0 -16
- package/cli/dist-server/types/node/command/upgrade-command-executor.d.ts +0 -13
- package/cli/dist-server/types/node/command/vim-command-executor.d.ts +0 -11
- package/cli/dist-server/types/node/command/workflows-command-executor.d.ts +0 -26
- package/cli/dist-server/types/node/feedback/feedback-protocol.d.ts +0 -32
- package/cli/dist-server/types/node/feedback/feedback-service.d.ts +0 -19
- package/cli/dist-server/types/node/feedback/index.d.ts +0 -2
- package/cli/dist-server/types/node/goal/goal-policy.d.ts +0 -55
- package/cli/dist-server/types/node/goal/goal-protocol.d.ts +0 -178
- package/cli/dist-server/types/node/goal/goal-service.d.ts +0 -201
- package/cli/dist-server/types/node/goal/goal-session-start-hook.d.ts +0 -24
- package/cli/dist-server/types/node/hooks/parse-frontmatter-hooks.d.ts +0 -42
- package/cli/dist-server/types/node/install/index.d.ts +0 -6
- package/cli/dist-server/types/node/install/install-controller.d.ts +0 -15
- package/cli/dist-server/types/node/install/install-env.d.ts +0 -12
- package/cli/dist-server/types/node/install/install-errors.d.ts +0 -46
- package/cli/dist-server/types/node/install/install-protocol.d.ts +0 -83
- package/cli/dist-server/types/node/install/install-service.d.ts +0 -36
- package/cli/dist-server/types/node/install/install-utils.d.ts +0 -7
- package/cli/dist-server/types/node/install/releases-service.d.ts +0 -18
- package/cli/dist-server/types/node/install/shell-setup.d.ts +0 -36
- package/cli/dist-server/types/node/mcp/mcp-cancellation.d.ts +0 -65
- package/cli/dist-server/types/node/mcp/mcp-controller.d.ts +0 -56
- package/cli/dist-server/types/node/mcp/mcp-model-id-header-helper.d.ts +0 -12
- package/cli/dist-server/types/node/mcp/mcp-oauth-callback-html.d.ts +0 -6
- package/cli/dist-server/types/node/mcp/mcp-oauth-controller.d.ts +0 -26
- package/cli/dist-server/types/node/mcp/mcp-output-storage.d.ts +0 -57
- package/cli/dist-server/types/node/mcp/mcp-server-override-impl.d.ts +0 -136
- package/cli/dist-server/types/node/mcp/mcp-server-override.d.ts +0 -29
- package/cli/dist-server/types/node/mcp/mcp-tool-result-sideband.d.ts +0 -26
- package/cli/dist-server/types/node/mcp/mcp-validate-middleware.d.ts +0 -25
- package/cli/dist-server/types/node/mcp/models/mcp-server.d.ts +0 -18
- package/cli/dist-server/types/node/mcp/node-websocket-transport.d.ts +0 -38
- package/cli/dist-server/types/node/mcp/official-mcp-egress-policy.d.ts +0 -17
- package/cli/dist-server/types/node/mcp/sdk-mcp-server.d.ts +0 -143
- package/cli/dist-server/types/node/mcp/sdk-mcp-transport.d.ts +0 -97
- package/cli/dist-server/types/node/message-queue/followup-queue.d.ts +0 -35
- package/cli/dist-server/types/node/message-queue/index.d.ts +0 -11
- package/cli/dist-server/types/node/plugins/concurrency.d.ts +0 -1
- package/cli/dist-server/types/node/plugins/dependency-resolver.d.ts +0 -43
- package/cli/dist-server/types/node/plugins/directory-plugin-cache-projection.d.ts +0 -2
- package/cli/dist-server/types/node/plugins/guards/index.d.ts +0 -2
- package/cli/dist-server/types/node/plugins/guards/weixinpay-integrity-guard.d.ts +0 -15
- package/cli/dist-server/types/node/plugins/installers/git-plugin-installer.d.ts +0 -42
- package/cli/dist-server/types/node/plugins/installers/git-subdir-plugin-installer.d.ts +0 -19
- package/cli/dist-server/types/node/plugins/installers/index.d.ts +0 -4
- package/cli/dist-server/types/node/plugins/installers/local-plugin-installer.d.ts +0 -40
- package/cli/dist-server/types/node/plugins/installers/npm-plugin-installer.d.ts +0 -23
- package/cli/dist-server/types/node/plugins/loaders/agent-loader.d.ts +0 -43
- package/cli/dist-server/types/node/plugins/loaders/command-loader.d.ts +0 -37
- package/cli/dist-server/types/node/plugins/loaders/hook-loader.d.ts +0 -55
- package/cli/dist-server/types/node/plugins/loaders/index.d.ts +0 -8
- package/cli/dist-server/types/node/plugins/loaders/lsp-loader.d.ts +0 -47
- package/cli/dist-server/types/node/plugins/loaders/mcp-loader.d.ts +0 -75
- package/cli/dist-server/types/node/plugins/loaders/output-style-loader.d.ts +0 -49
- package/cli/dist-server/types/node/plugins/loaders/plugin-loader-manager.d.ts +0 -49
- package/cli/dist-server/types/node/plugins/loaders/skill-loader.d.ts +0 -45
- package/cli/dist-server/types/node/plugins/marketplace-name-validator.d.ts +0 -50
- package/cli/dist-server/types/node/plugins/marketplace-path-safety.d.ts +0 -86
- package/cli/dist-server/types/node/plugins/marketplaces/base-marketplace.d.ts +0 -43
- package/cli/dist-server/types/node/plugins/marketplaces/builtin-marketplace-provider.d.ts +0 -22
- package/cli/dist-server/types/node/plugins/marketplaces/directory-marketplace.d.ts +0 -19
- package/cli/dist-server/types/node/plugins/marketplaces/git-availability-detector.d.ts +0 -62
- package/cli/dist-server/types/node/plugins/marketplaces/git-fallback-coordinator.d.ts +0 -42
- package/cli/dist-server/types/node/plugins/marketplaces/git-to-zip-url-converter.d.ts +0 -50
- package/cli/dist-server/types/node/plugins/marketplaces/github-marketplace.d.ts +0 -41
- package/cli/dist-server/types/node/plugins/marketplaces/http-marketplace.d.ts +0 -47
- package/cli/dist-server/types/node/plugins/marketplaces/index.d.ts +0 -13
- package/cli/dist-server/types/node/plugins/marketplaces/marketplace-config-manager.d.ts +0 -39
- package/cli/dist-server/types/node/plugins/marketplaces/marketplace-factory.d.ts +0 -11
- package/cli/dist-server/types/node/plugins/marketplaces/marketplace-storage.d.ts +0 -141
- package/cli/dist-server/types/node/plugins/marketplaces/marketplace-update-checker.d.ts +0 -38
- package/cli/dist-server/types/node/plugins/marketplaces/workspace-project-root.d.ts +0 -14
- package/cli/dist-server/types/node/plugins/marketplaces/zip-marketplace.d.ts +0 -134
- package/cli/dist-server/types/node/plugins/mcpb-handler.d.ts +0 -29
- package/cli/dist-server/types/node/plugins/plugin-controller.d.ts +0 -75
- package/cli/dist-server/types/node/plugins/plugin-error-collector.d.ts +0 -17
- package/cli/dist-server/types/node/plugins/plugin-install-stats-service.d.ts +0 -20
- package/cli/dist-server/types/node/plugins/plugin-manager.d.ts +0 -692
- package/cli/dist-server/types/node/plugins/plugin-policy-service.d.ts +0 -53
- package/cli/dist-server/types/node/plugins/plugin-validator.d.ts +0 -48
- package/cli/dist-server/types/node/plugins/zip-utils.d.ts +0 -93
- package/cli/dist-server/types/node/remote-control/clients/liveness-watchdog.d.ts +0 -56
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-activity.d.ts +0 -23
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-auth.d.ts +0 -64
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-client-factory.d.ts +0 -47
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-client.d.ts +0 -191
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-inbound.d.ts +0 -7
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-interaction.d.ts +0 -142
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-live.d.ts +0 -78
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-media.d.ts +0 -35
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-qr-bind.d.ts +0 -49
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-respond-queue.d.ts +0 -33
- package/cli/dist-server/types/node/remote-control/clients/wecom-bot/wecom-bot-types.d.ts +0 -207
- package/cli/dist-server/types/node/remote-control/remote-control-protocol.d.ts +0 -288
- package/cli/dist-server/types/node/remote-gateway/gateway-protocol.d.ts +0 -502
- package/cli/dist-server/types/node/remote-gateway/utils/qrcode-utils.d.ts +0 -16
- package/cli/dist-server/types/node/session/session-preview-utils.d.ts +0 -30
- package/cli/dist-server/types/node/settings/model-setting-utils.d.ts +0 -2
- package/cli/dist-server/types/node/tool-control/tool-control-policy.d.ts +0 -35
- package/cli/dist-server/types/node/tools/auto-mode/auto-mode-critique-client.d.ts +0 -51
- package/cli/dist-server/types/node/tools/auto-mode/auto-mode-strategy.d.ts +0 -19
- package/cli/dist-server/types/node/utils/add-dir-utils.d.ts +0 -20
- package/cli/dist-server/types/node/utils/compress-path.source.d.ts +0 -59
- package/cli/dist-server/types/node/vim/index.d.ts +0 -2
- package/cli/dist-server/types/node/vim/vim-manager.d.ts +0 -12
- package/cli/dist-server/types/node/vim/vim-protocol.d.ts +0 -24
|
@@ -1,692 +0,0 @@
|
|
|
1
|
-
import { Emitter } from '@celljs/core';
|
|
2
|
-
import { Logger } from '@genie/telemetry';
|
|
3
|
-
import { CliRuntimeOptions } from '../cli/cli-runtime-options';
|
|
4
|
-
import { ConsoleManager } from '../console/console-protocol';
|
|
5
|
-
import { FileLockService } from '../lock';
|
|
6
|
-
import { McpPluginRegistry } from '../mcp/mcp-plugin-registry';
|
|
7
|
-
import { SettingsManager, SettingsScope } from '../settings';
|
|
8
|
-
import { CliSettingSourcesProvider } from '../settings/cli-setting-sources-provider';
|
|
9
|
-
import { PluginTelemetryService, StartupProfiler } from '../telemetry';
|
|
10
|
-
import { type ProcessIdentity } from '../utils/process-identity';
|
|
11
|
-
import { PluginLoaderManager } from './loaders';
|
|
12
|
-
import { GitFallbackCoordinator } from './marketplaces/git-fallback-coordinator';
|
|
13
|
-
import { PluginOptionsStorage } from './plugin-options-storage';
|
|
14
|
-
import { type PluginPolicyService } from './plugin-policy-service';
|
|
15
|
-
import { type ActivePluginRefreshOptions, type ActivePluginRuntimeEntry, BuiltInMarketplaceProvider, Marketplace, MarketplaceAddOptions, MarketplaceConfigManager, MarketplaceSelectionOptions, MarketplaceStorage, MarketplaceUpdateChecker, MarketplaceUpdateOptions, PluginComponents, PluginDependencyRepairResult, PluginErrorCollector, PluginInfo, PluginInstaller, PluginInstallOptions, PluginLoadGuard, PluginManager, PluginPruneOptions, PluginRepairOptions, PluginUninstallOptions } from './plugin-protocol';
|
|
16
|
-
/**
|
|
17
|
-
* 插件管理器实现
|
|
18
|
-
* 负责插件的安装、卸载、启用、禁用等核心功能
|
|
19
|
-
* 同时负责管理插件市场,支持多种Provider(本地/Git/HTTP)
|
|
20
|
-
*/
|
|
21
|
-
export declare class PluginManagerImpl implements PluginManager {
|
|
22
|
-
protected readonly logger: Logger;
|
|
23
|
-
protected readonly marketplaceStorage: MarketplaceStorage;
|
|
24
|
-
protected readonly settingsManager: SettingsManager;
|
|
25
|
-
protected readonly cliSettingSourcesProvider: CliSettingSourcesProvider;
|
|
26
|
-
protected readonly cliRuntimeOptions?: CliRuntimeOptions;
|
|
27
|
-
protected readonly fileLockService: FileLockService;
|
|
28
|
-
protected readonly pluginLoaderManager: PluginLoaderManager;
|
|
29
|
-
protected readonly pluginOptionsStorage?: PluginOptionsStorage;
|
|
30
|
-
protected readonly installers: PluginInstaller[];
|
|
31
|
-
protected readonly marketplaceConfigManager: MarketplaceConfigManager;
|
|
32
|
-
protected readonly builtInMarketplaceProvider: BuiltInMarketplaceProvider;
|
|
33
|
-
protected readonly errorCollector: PluginErrorCollector;
|
|
34
|
-
protected readonly consoleManager: ConsoleManager;
|
|
35
|
-
protected readonly startupProfiler: StartupProfiler;
|
|
36
|
-
protected readonly pluginTelemetryService: PluginTelemetryService;
|
|
37
|
-
protected readonly pluginPolicyService: PluginPolicyService;
|
|
38
|
-
protected readonly gitFallbackCoordinator: GitFallbackCoordinator;
|
|
39
|
-
protected readonly marketplaceUpdateChecker: MarketplaceUpdateChecker;
|
|
40
|
-
protected readonly pluginLoadGuard?: PluginLoadGuard;
|
|
41
|
-
protected readonly mcpPluginRegistry?: McpPluginRegistry;
|
|
42
|
-
protected readonly onDidChangeEmitter: Emitter<void>;
|
|
43
|
-
readonly onDidChange: import("@celljs/core").Event<void>;
|
|
44
|
-
/** Runtime-visible plugin set. Management mutations never rewrite it. */
|
|
45
|
-
private activePlugins;
|
|
46
|
-
/** 已安装插件缓存 */
|
|
47
|
-
private installedPluginsCache?;
|
|
48
|
-
/** 已安装插件加载中的 Promise(用于去重并发加载) */
|
|
49
|
-
private installedPluginsLoading?;
|
|
50
|
-
/** installed_plugins.json 缓存,避免每个插件 hydrate 都重复读磁盘 */
|
|
51
|
-
private installedPluginsRegistryCache?;
|
|
52
|
-
/** installed_plugins.json 加载中的 Promise(用于去重并发读取) */
|
|
53
|
-
private installedPluginsRegistryLoading?;
|
|
54
|
-
/** installed_plugins.json 的进程内写队列。 */
|
|
55
|
-
private installedPluginsRegistryWriteLock;
|
|
56
|
-
/** 缓存的市场列表 */
|
|
57
|
-
private marketplaceCache?;
|
|
58
|
-
/** 当前 marketplace registry 投影的进程内 single-flight。 */
|
|
59
|
-
private marketplaceLoading?;
|
|
60
|
-
/** 独立于插件缓存代际,阻止失效前启动的 marketplace 读取成为 last writer。 */
|
|
61
|
-
private marketplaceGeneration;
|
|
62
|
-
/** 同一 marketplace 的并发更新共享一次远端同步,并扇出进度事件。 */
|
|
63
|
-
private marketplaceUpdates;
|
|
64
|
-
/** 市场插件列表缓存 */
|
|
65
|
-
private marketplacePluginsCache;
|
|
66
|
-
/**
|
|
67
|
-
* #74359 跨进程一致性:cache 写入时记录磁盘 marketplace.json 的 mtimeMs,下次 HIT 前
|
|
68
|
-
* 比对,磁盘更新说明别的 sidecar host 已刷 manifest,本 host cache 作废。
|
|
69
|
-
*/
|
|
70
|
-
private marketplacePluginsCacheMtime;
|
|
71
|
-
/** 市场插件列表加载中的 Promise(用于去重并发扫描) */
|
|
72
|
-
private marketplacePluginsLoading;
|
|
73
|
-
/** Per-marketplace generation prevents an invalidated scan from repopulating the cache. */
|
|
74
|
-
private marketplacePluginsGeneration;
|
|
75
|
-
/** 插件组件缓存 */
|
|
76
|
-
private pluginComponentsCache;
|
|
77
|
-
/** 插件组件加载中的 Promise(用于去重并发加载) */
|
|
78
|
-
private pluginComponentsLoading;
|
|
79
|
-
/** enabledPlugins 缓存 */
|
|
80
|
-
private enabledPluginsCache?;
|
|
81
|
-
/**
|
|
82
|
-
* `--settings` 插件依赖只在当前进程生效。它们不能写入用户配置,
|
|
83
|
-
* 但必须参与后续 reload,否则根插件会因依赖未出现在 enabledPlugins 中而被降级。
|
|
84
|
-
*/
|
|
85
|
-
private sessionEnabledPluginOverrides;
|
|
86
|
-
/** inline 插件缓存(独立于 marketplace 缓存,运行期间不清除,仅 /reload-plugins 清除) */
|
|
87
|
-
private inlinePluginsCache?;
|
|
88
|
-
/** 缓存代际,用于丢弃 clearAllCaches 前启动的旧加载结果 */
|
|
89
|
-
private cacheGeneration;
|
|
90
|
-
/** 首个运行时消费者触发的惰性初始化 Promise。 */
|
|
91
|
-
private initPromise?;
|
|
92
|
-
/** 当前 Agent CLI 进程的后台 Plugin 管理 single-flight。 */
|
|
93
|
-
private backgroundPluginManagementPromise?;
|
|
94
|
-
/**
|
|
95
|
-
* Strict desired-state materialization shared by explicit host readiness
|
|
96
|
-
* and the first phase of background management. Only in-flight work is
|
|
97
|
-
* shared: each later call rechecks disk so external cache deletion heals.
|
|
98
|
-
*/
|
|
99
|
-
private configuredPluginReconcilePromise?;
|
|
100
|
-
private configuredPluginReconcileGeneration;
|
|
101
|
-
/** 管理态监听器只注册一次,--no-plugin-management 运行时不注册。 */
|
|
102
|
-
private pluginManagementListenersRegistered;
|
|
103
|
-
/** `whenReady()` 的共享 Promise,避免并发调用各自包装出不同句柄。 */
|
|
104
|
-
private readyPromise?;
|
|
105
|
-
/** doInit 完成后才允许外部 marketplace 操作触发依赖修复。 */
|
|
106
|
-
private initializationComplete;
|
|
107
|
-
/** 待重试的合并插件策略(市场未就绪时暂存) */
|
|
108
|
-
private pendingManagedPolicies;
|
|
109
|
-
/** 上次 apply 期间是否有新的请求到达 */
|
|
110
|
-
private pendingApplyRequest;
|
|
111
|
-
/** 当前管控策略应用;并发触发者共享并等待同一轮(含 pending 补跑)。 */
|
|
112
|
-
private managedPoliciesApplyPromise?;
|
|
113
|
-
/** Pending 策略最大存活时间(30 分钟) */
|
|
114
|
-
private static readonly PENDING_MAX_AGE_MS;
|
|
115
|
-
/** Pending 策略最大重试次数 */
|
|
116
|
-
private static readonly PENDING_MAX_RETRY;
|
|
117
|
-
/**
|
|
118
|
-
* 是否正在响应 ProductManager 配置变更并重跑 installBuiltInMarketplaces,防重入。
|
|
119
|
-
* 场景:嵌入式进程启动时拿到的是默认 Product 配置(可能只有部分 builtin),
|
|
120
|
-
* 之后宿主推送完整的 Product 配置
|
|
121
|
-
* (例如 `cb_teams_marketplace`)。如果不在配置变更时再跑一次安装,新增的 builtin
|
|
122
|
-
* 永远不会被 first-install,后续 update 路径会一直拿到
|
|
123
|
-
* `Marketplace ${name} does not exist` 报 HTTP 500。
|
|
124
|
-
*/
|
|
125
|
-
private isReinstallingBuiltInMarketplaces;
|
|
126
|
-
/** 上一轮 reinstall 期间是否又有新的 ProductManager.onDidChange 到达。 */
|
|
127
|
-
private pendingReinstallRequest;
|
|
128
|
-
/** 当前 Product 触发的 builtin marketplace 刷新,供启动屏障等待。 */
|
|
129
|
-
private builtInMarketplaceRefreshPromise;
|
|
130
|
-
/** Markers owned by this manager; lazily initialized for decorator-free unit fixtures. */
|
|
131
|
-
private ownedPluginCacheMarkers?;
|
|
132
|
-
/** Loaded-cache marker sweeping is best-effort and single-flight within this process. */
|
|
133
|
-
private pluginCacheInUseSweepPromise?;
|
|
134
|
-
protected init(): void;
|
|
135
|
-
protected disposePluginCacheMarkers(): Promise<void>;
|
|
136
|
-
/**
|
|
137
|
-
* Initialize exactly once, after runtime argv and settings providers have
|
|
138
|
-
* settled. PostConstruct intentionally does not read session configuration.
|
|
139
|
-
*/
|
|
140
|
-
private ensureInitialized;
|
|
141
|
-
protected doInit(): Promise<void>;
|
|
142
|
-
private isPluginManagementDisabled;
|
|
143
|
-
private assertPluginManagementAllowed;
|
|
144
|
-
private registerPluginManagementListeners;
|
|
145
|
-
private invalidateConfiguredPluginReconcile;
|
|
146
|
-
/**
|
|
147
|
-
* Materialize the complete Product/persisted-settings desired state.
|
|
148
|
-
* Concurrent callers, including startup background management, share one
|
|
149
|
-
* strict pass. If settings change while it is running, the same owner loops
|
|
150
|
-
* once more rather than allowing two management passes to cross.
|
|
151
|
-
*/
|
|
152
|
-
reconcileConfiguredPlugins(): Promise<void>;
|
|
153
|
-
/** Start one management pass after the initial cache projection commits. */
|
|
154
|
-
startBackgroundPluginManagement(): Promise<void>;
|
|
155
|
-
private resolveRealPathStrictlyInside;
|
|
156
|
-
private migrateLegacyEnabledPluginCaches;
|
|
157
|
-
private isUnknownInstalledPluginRecord;
|
|
158
|
-
private migrateUnknownPluginCaches;
|
|
159
|
-
private migrateUnknownPluginCacheAndRecord;
|
|
160
|
-
private ensurePluginCacheForMigration;
|
|
161
|
-
private migrateUnknownInstalledPluginRecord;
|
|
162
|
-
/** Complete management-only work after the first cache projection. */
|
|
163
|
-
private prepareStartupPluginManagement;
|
|
164
|
-
private runPluginManagementStage;
|
|
165
|
-
/** Reconcile desired state after the first cache-first snapshot is live. */
|
|
166
|
-
private installMarketplacesFromSettingsAsync;
|
|
167
|
-
/**
|
|
168
|
-
* 订阅 ProductManager 配置变化,捕获 server 推送的 builtInMarketplaces 增量。
|
|
169
|
-
*
|
|
170
|
-
* 设计要点:
|
|
171
|
-
* - 直接复用 `installBuiltInMarketplaces`,它本身幂等(已安装的会被 filter 掉),
|
|
172
|
-
* 只会真正 add 新增的 builtin。
|
|
173
|
-
* - 用 `isReinstallingBuiltInMarketplaces` 防重入;触发期间再来事件标记
|
|
174
|
-
* `pendingReinstallRequest`,结束后再跑一次,避免错过末次配置。
|
|
175
|
-
* - 安装完成后 fire 一次 `onDidChangeEmitter`,让嵌入式消费方能在 builtin
|
|
176
|
-
* 集合变化后刷新。
|
|
177
|
-
*/
|
|
178
|
-
private subscribeToProductBuiltInMarketplacesChange;
|
|
179
|
-
/**
|
|
180
|
-
* 响应一次 ProductManager.onDidChange,按需补跑 installBuiltInMarketplaces。
|
|
181
|
-
* 自带防重入:跑的时候来的事件不会真的并发跑,而是合并成 1 次后续重跑。
|
|
182
|
-
*
|
|
183
|
-
* 重要:仅在 `installBuiltInMarketplaces` 真的改了 marketplace 存储(新增或删孤儿)时
|
|
184
|
-
* 才 fire `onDidChangeEmitter`。否则 `PluginsProductProvider` 会在 1s 防抖后回调
|
|
185
|
-
* `productManager.sync()`,再次触发本方法,形成无限循环(每秒打一次
|
|
186
|
-
* `/config/models` 等接口)。
|
|
187
|
-
*/
|
|
188
|
-
private handleBuiltInMarketplacesConfigChange;
|
|
189
|
-
/**
|
|
190
|
-
* 加载市场配置
|
|
191
|
-
*/
|
|
192
|
-
private loadMarketplaces;
|
|
193
|
-
private doLoadMarketplaces;
|
|
194
|
-
/**
|
|
195
|
-
* 获取市场自动更新的刷新窗口(毫秒)
|
|
196
|
-
* 默认 24 小时;可通过环境变量 CODEBUDDY_MARKETPLACE_AUTO_UPDATE_INTERVAL_MS 覆盖,
|
|
197
|
-
* 便于测试/调试场景下缩短检测间隔(如设为 1 小时)
|
|
198
|
-
*/
|
|
199
|
-
private getMarketplaceAutoUpdateIntervalMs;
|
|
200
|
-
/**
|
|
201
|
-
* 检查市场是否需要自动更新
|
|
202
|
-
* @param marketplace 市场信息
|
|
203
|
-
* @returns true 如果需要自动更新
|
|
204
|
-
*/
|
|
205
|
-
private shouldAutoUpdate;
|
|
206
|
-
/**
|
|
207
|
-
* 自动更新所有启用自动更新的市场
|
|
208
|
-
* 该方法会异步执行,不阻塞主流程
|
|
209
|
-
*/
|
|
210
|
-
private autoUpdateMarketplaces;
|
|
211
|
-
/**
|
|
212
|
-
* 添加市场
|
|
213
|
-
*/
|
|
214
|
-
addMarketplace(source: string, options?: MarketplaceAddOptions): Promise<Marketplace>;
|
|
215
|
-
/**
|
|
216
|
-
* 删除市场
|
|
217
|
-
*/
|
|
218
|
-
removeMarketplace(name: string, options?: MarketplaceSelectionOptions): Promise<void>;
|
|
219
|
-
private removeMarketplaceLocked;
|
|
220
|
-
/**
|
|
221
|
-
* 更新市场
|
|
222
|
-
*/
|
|
223
|
-
updateMarketplace(name: string, options?: MarketplaceUpdateOptions): Promise<Marketplace>;
|
|
224
|
-
private doUpdateMarketplace;
|
|
225
|
-
private doUpdateMarketplaceLocked;
|
|
226
|
-
/**
|
|
227
|
-
* 列出所有市场
|
|
228
|
-
*/
|
|
229
|
-
listMarketplace(): Promise<Marketplace[]>;
|
|
230
|
-
/**
|
|
231
|
-
* 获取市场信息
|
|
232
|
-
*/
|
|
233
|
-
getMarketplace(name: string): Promise<Marketplace | undefined>;
|
|
234
|
-
getMarketplaceByStorageName(name: string): Promise<Marketplace | undefined>;
|
|
235
|
-
/**
|
|
236
|
-
* 设置市场自动更新状态
|
|
237
|
-
*/
|
|
238
|
-
setMarketplaceAutoUpdate(name: string, autoUpdate: boolean): Promise<void>;
|
|
239
|
-
/**
|
|
240
|
-
* 从市场获取插件列表
|
|
241
|
-
*/
|
|
242
|
-
getPlugins(marketplaceName: string): Promise<PluginInfo[]>;
|
|
243
|
-
private getMarketplacePluginsCacheKey;
|
|
244
|
-
private clearMarketplacePluginCaches;
|
|
245
|
-
/**
|
|
246
|
-
* #74359 stat 磁盘上的 marketplace.json 拿到 mtimeMs,用于跨进程 stale check。
|
|
247
|
-
* 找不到 manifest / stat 失败时返回 0——上层会把它当作"没有可信 mtime"跳过 stale 判定。
|
|
248
|
-
*/
|
|
249
|
-
private getMarketplaceManifestMtimeMs;
|
|
250
|
-
/**
|
|
251
|
-
* 判断 marketplace 在 update 前是否需要先做"市场级远端同步"。
|
|
252
|
-
*
|
|
253
|
-
* 整体式 marketplace(git/github/zip/url)下所有插件都来自同一远端,必须在
|
|
254
|
-
* marketplace 这一层 fetch / 重新下载,per-plugin 的 installer.update 退化
|
|
255
|
-
* 为路径有效性兜底。directory 类型市场的 source of truth 在用户硬盘上,不需要
|
|
256
|
-
* 也不应该触发远端同步。
|
|
257
|
-
*/
|
|
258
|
-
private marketplaceNeedsRemoteSync;
|
|
259
|
-
private clonePluginInfo;
|
|
260
|
-
private clonePluginInfos;
|
|
261
|
-
private listMarketplacePlugins;
|
|
262
|
-
private getPluginId;
|
|
263
|
-
protected getHomePluginsDir(): string;
|
|
264
|
-
private getInstalledPluginsRegistryPath;
|
|
265
|
-
private getInstalledPluginsRegistryLockName;
|
|
266
|
-
private getMarketplaceMutationLockName;
|
|
267
|
-
private getMarketplaceSourceMutationLockName;
|
|
268
|
-
private isSameMarketplaceMutationIdentity;
|
|
269
|
-
private normalizePluginMarketplace;
|
|
270
|
-
private withCommittedMarketplaceRead;
|
|
271
|
-
private selectCurrentCommittedMarketplace;
|
|
272
|
-
private withMarketplaceMutationLock;
|
|
273
|
-
private withMarketplaceSourceMutationLock;
|
|
274
|
-
private acquireMarketplaceSourceMutationLock;
|
|
275
|
-
private getPluginCacheMutationLockName;
|
|
276
|
-
private withPluginCacheMutationLocks;
|
|
277
|
-
private createEmptyInstalledPluginsRegistry;
|
|
278
|
-
private normalizeInstalledPluginsRegistry;
|
|
279
|
-
private addNormalizedInstalledPluginRecord;
|
|
280
|
-
private readInstalledPluginsRegistry;
|
|
281
|
-
private loadInstalledPluginsRegistryFromDisk;
|
|
282
|
-
private migrateLegacyInstalledPluginsRegistry;
|
|
283
|
-
private writeInstalledPluginsRegistry;
|
|
284
|
-
private renameInstalledPluginsRegistry;
|
|
285
|
-
private mutateInstalledPluginsRegistry;
|
|
286
|
-
private cloneInstalledPluginsRegistry;
|
|
287
|
-
private sanitizeCacheSegment;
|
|
288
|
-
private getPluginCachePath;
|
|
289
|
-
private getPluginCacheRoot;
|
|
290
|
-
private assertPathInside;
|
|
291
|
-
private findPluginManifestPath;
|
|
292
|
-
private readPluginManifest;
|
|
293
|
-
private getGitPluginCacheVersion;
|
|
294
|
-
private resolvePluginCacheIdentity;
|
|
295
|
-
private resolveGitCommitSha;
|
|
296
|
-
private materializePluginCache;
|
|
297
|
-
private replacePluginCacheAtomically;
|
|
298
|
-
private pathEntryExists;
|
|
299
|
-
private isValidMaterializedPluginCache;
|
|
300
|
-
private isPathInside;
|
|
301
|
-
private safeRealpath;
|
|
302
|
-
private copyPluginToCache;
|
|
303
|
-
private recordInstalledPlugin;
|
|
304
|
-
private getProjectPathForScope;
|
|
305
|
-
private toInstalledPluginScope;
|
|
306
|
-
private installedRecordMatchesScope;
|
|
307
|
-
private removeInstalledPluginRecordsForScope;
|
|
308
|
-
private removeInstalledPluginRecordsForMarketplace;
|
|
309
|
-
private getInstalledPluginIdsForMarketplace;
|
|
310
|
-
private removeEnabledPluginEntriesForInstalledRecords;
|
|
311
|
-
private collectPluginMcpServerNames;
|
|
312
|
-
private collectInstalledRecordMcpServerNames;
|
|
313
|
-
private invalidatePluginMcpOAuthCredentials;
|
|
314
|
-
private cleanupFinalPluginState;
|
|
315
|
-
private markPluginCacheOrphaned;
|
|
316
|
-
private isVersionedPluginCachePath;
|
|
317
|
-
private getOwnedPluginCacheMarkers;
|
|
318
|
-
private getRuntimePlatform;
|
|
319
|
-
private getCurrentProcessIdentity;
|
|
320
|
-
/**
|
|
321
|
-
* Version cache roots are real directories in the plugin cache ABI. A
|
|
322
|
-
* symlinked cache leaf (or an ancestor escaping the cache root) is refused
|
|
323
|
-
* so marker writes can never land in an arbitrary symlink target.
|
|
324
|
-
*/
|
|
325
|
-
private resolvePluginCacheMarkerDir;
|
|
326
|
-
private recordPluginCacheInUse;
|
|
327
|
-
private releasePluginCacheInUse;
|
|
328
|
-
/** Shares the exact implementation used by process.on('exit'). */
|
|
329
|
-
private releasePluginCacheInUseSync;
|
|
330
|
-
private markPluginCachesInUse;
|
|
331
|
-
private isProcessAlive;
|
|
332
|
-
private queryProcessStartIdentity;
|
|
333
|
-
private lookupProcessInstance;
|
|
334
|
-
private getProcessMarkerState;
|
|
335
|
-
private createPluginInUseSweepStats;
|
|
336
|
-
private removeStalePluginCacheMarker;
|
|
337
|
-
private sweepPluginCacheMarkers;
|
|
338
|
-
private getPluginInUseSweepStampPath;
|
|
339
|
-
private isPluginInUseSweepDue;
|
|
340
|
-
private updatePluginInUseSweepStamp;
|
|
341
|
-
private sweepPluginCachesInUse;
|
|
342
|
-
private schedulePluginCacheInUseSweep;
|
|
343
|
-
private isPluginCacheInUse;
|
|
344
|
-
private listChildDirectories;
|
|
345
|
-
private removeDirectoryIfEmpty;
|
|
346
|
-
private cleanupOrphanedPluginCache;
|
|
347
|
-
private cleanupPluginCache;
|
|
348
|
-
private versionSatisfiesRange;
|
|
349
|
-
private chooseHighestVersion;
|
|
350
|
-
private findCachedPluginByDirectory;
|
|
351
|
-
private getInstalledRecordVersion;
|
|
352
|
-
private resolveInstalledPluginCache;
|
|
353
|
-
private normalizePluginDependencies;
|
|
354
|
-
private throwDependencyResolutionError;
|
|
355
|
-
private recordDependencyResolutionError;
|
|
356
|
-
private getRootMarketplaceCrossDependencyAllowlist;
|
|
357
|
-
private getNormalizedSemver;
|
|
358
|
-
private getEffectivePluginVersion;
|
|
359
|
-
private assertDependencyVersion;
|
|
360
|
-
private combineVersionRanges;
|
|
361
|
-
private collectExistingDependencyConstraints;
|
|
362
|
-
private resolveRequestedPluginRefs;
|
|
363
|
-
private isGitBackedMarketplace;
|
|
364
|
-
private runGit;
|
|
365
|
-
private listMarketplacePluginTags;
|
|
366
|
-
private checkoutMarketplaceRef;
|
|
367
|
-
private readMarketplacePluginFromLocation;
|
|
368
|
-
private isGitPluginSource;
|
|
369
|
-
private getPluginGitUrl;
|
|
370
|
-
private listRemotePluginTags;
|
|
371
|
-
private selectHighestMatchingTag;
|
|
372
|
-
private resolveGitTaggedDependencyPlugin;
|
|
373
|
-
private throwNoMatchingDependencyTag;
|
|
374
|
-
private resolveDependencyPlugin;
|
|
375
|
-
private resolveDependencyClosure;
|
|
376
|
-
private materializePluginRefs;
|
|
377
|
-
private installDependencyClosure;
|
|
378
|
-
private hasMaterializedPluginCache;
|
|
379
|
-
private enableDependenciesForPlugins;
|
|
380
|
-
private collectKnownDependencyIds;
|
|
381
|
-
private getDeclaredDependencyIds;
|
|
382
|
-
private findOrphanedAutoDependencies;
|
|
383
|
-
private findEnabledDependents;
|
|
384
|
-
private assertNoEnabledDependents;
|
|
385
|
-
private getInstalledPluginsForWorkspaceState;
|
|
386
|
-
/**
|
|
387
|
-
* 加载已安装插件
|
|
388
|
-
*/
|
|
389
|
-
private loadInstalledPlugins;
|
|
390
|
-
private applyDependencyRuntimeGuards;
|
|
391
|
-
/**
|
|
392
|
-
* 安装插件
|
|
393
|
-
*/
|
|
394
|
-
installPlugins(pluginNames: string[], marketplaceName: string, options?: PluginInstallOptions): Promise<void>;
|
|
395
|
-
/**
|
|
396
|
-
* 使用installer安装插件
|
|
397
|
-
*/
|
|
398
|
-
private installPluginWithInstaller;
|
|
399
|
-
private installPluginWithInstallerLocked;
|
|
400
|
-
private resolveUpToDatePluginCache;
|
|
401
|
-
/**
|
|
402
|
-
* 更新插件
|
|
403
|
-
*/
|
|
404
|
-
private refreshInstalledPluginsAfterMarketplaceUpdate;
|
|
405
|
-
private getInstalledPluginNamesForMarketplaceFromRegistry;
|
|
406
|
-
updatePlugins(pluginNames: string[], marketplaceName: string, options?: PluginInstallOptions): Promise<void>;
|
|
407
|
-
/**
|
|
408
|
-
* 卸载插件
|
|
409
|
-
*/
|
|
410
|
-
uninstallPlugins(pluginNames: string[], marketplaceName: string, options?: PluginUninstallOptions): Promise<void>;
|
|
411
|
-
prunePlugins(options?: PluginPruneOptions): Promise<string[]>;
|
|
412
|
-
/**
|
|
413
|
-
* 启用插件
|
|
414
|
-
*/
|
|
415
|
-
enablePlugins(pluginNames: string[], marketplaceName: string, options?: {
|
|
416
|
-
bypassPolicyCheck?: boolean;
|
|
417
|
-
persist?: boolean;
|
|
418
|
-
scope?: SettingsScope;
|
|
419
|
-
workspacePath?: string;
|
|
420
|
-
}): Promise<void>;
|
|
421
|
-
/**
|
|
422
|
-
* 禁用插件
|
|
423
|
-
*/
|
|
424
|
-
disablePlugins(pluginNames: string[], marketplaceName: string, options?: {
|
|
425
|
-
persist?: boolean;
|
|
426
|
-
scope?: SettingsScope;
|
|
427
|
-
workspacePath?: string;
|
|
428
|
-
}): Promise<void>;
|
|
429
|
-
/**
|
|
430
|
-
* 原子切换插件:在同一事务中 disable 旧插件 + enable 新插件,只触发一次 onDidChange。
|
|
431
|
-
* 用于plugin切换场景,避免 disable 和 enable 分别触发两次 rebuild cycle。
|
|
432
|
-
*/
|
|
433
|
-
switchPlugins(disableNames: string[], enableNames: string[], marketplaceName: string, options?: {
|
|
434
|
-
persist?: boolean;
|
|
435
|
-
}): Promise<void>;
|
|
436
|
-
/**
|
|
437
|
-
* 获取已安装插件列表
|
|
438
|
-
*/
|
|
439
|
-
getInstalledPlugins(): Promise<PluginInfo[]>;
|
|
440
|
-
/**
|
|
441
|
-
* Build a request-local view straight from installed_plugins.json.
|
|
442
|
-
* Unlike getInstalledPlugins(), this deliberately bypasses the shared
|
|
443
|
-
* installedPluginsCache so an ALS settings overlay cannot leak between
|
|
444
|
-
* concurrent compatibility-verification requests. It performs no install,
|
|
445
|
-
* enable/disable, runtime activation, marker publication, or cache write.
|
|
446
|
-
*/
|
|
447
|
-
inspectCommittedPluginsForCurrentSettings(): Promise<PluginInfo[]>;
|
|
448
|
-
/**
|
|
449
|
-
* 从本地目录加载插件信息(--plugin-dir)
|
|
450
|
-
*
|
|
451
|
-
* inline 插件树读面走 data-fs seam(只读,无副作用):server 注入 fs 时
|
|
452
|
-
* 从注入卷读取;bin 无注入时为本地直通,行为不变。
|
|
453
|
-
*/
|
|
454
|
-
private loadLocalPluginInfo;
|
|
455
|
-
private hydratePluginInfo;
|
|
456
|
-
/**
|
|
457
|
-
* 获取插件信息
|
|
458
|
-
*/
|
|
459
|
-
getPlugin(pluginName: string, marketplaceName: string): Promise<PluginInfo | undefined>;
|
|
460
|
-
/**
|
|
461
|
-
* 获取插件扩展组件列表
|
|
462
|
-
*/
|
|
463
|
-
getPluginComponents(pluginName: string, marketplaceName: string): Promise<PluginComponents | undefined>;
|
|
464
|
-
getActivePlugins(): Promise<readonly ActivePluginRuntimeEntry[]>;
|
|
465
|
-
refreshActivePlugins(options?: ActivePluginRefreshOptions): Promise<readonly ActivePluginRuntimeEntry[]>;
|
|
466
|
-
private doLoadPluginComponents;
|
|
467
|
-
/** Lazily publish the current immutable Plugin cache projection. */
|
|
468
|
-
whenReady(): Promise<void>;
|
|
469
|
-
/**
|
|
470
|
-
* 清理所有缓存
|
|
471
|
-
*/
|
|
472
|
-
private invalidateMarketplaceCache;
|
|
473
|
-
private clearAllCaches;
|
|
474
|
-
/**
|
|
475
|
-
* 使用已更新状态的 PluginInfo 同步内存缓存。
|
|
476
|
-
*
|
|
477
|
-
* 非持久化场景不能重新读取 settings.json,否则会把尚未落盘的旧 status 读回来。
|
|
478
|
-
*/
|
|
479
|
-
private syncInstalledPluginsCache;
|
|
480
|
-
/**
|
|
481
|
-
* 清除插件缓存(用于热更新)
|
|
482
|
-
* 公开接口,供外部调用
|
|
483
|
-
*/
|
|
484
|
-
clearCache(): void;
|
|
485
|
-
/**
|
|
486
|
-
* 获取所有 inline 插件(带独立缓存)。
|
|
487
|
-
* 不依赖惰性初始化,不调用 getInstalledPlugins,因此不会死锁。
|
|
488
|
-
*/
|
|
489
|
-
private getInlinePlugins;
|
|
490
|
-
/**
|
|
491
|
-
* 从插件目录补全 PluginInfo 上的展示字段(commands/skills/hooks 等)。
|
|
492
|
-
* 这些字段仅用于 REST API 展示,实际功能加载走 PluginLoaderManager。
|
|
493
|
-
* 补全策略:plugin.json manifest > 目录扫描,仅在字段为空时填充。
|
|
494
|
-
*/
|
|
495
|
-
private enrichPluginInfo;
|
|
496
|
-
/**
|
|
497
|
-
* 将 source 插件的展示字段合并到 target(仅补全 target 中为空的字段)
|
|
498
|
-
*/
|
|
499
|
-
private mergePluginFields;
|
|
500
|
-
private mergePluginDependencies;
|
|
501
|
-
private getDependencyDeclarationKey;
|
|
502
|
-
/**
|
|
503
|
-
* inline 插件找不到时的容错处理:仅更新 settings,清缓存,触发事件
|
|
504
|
-
*/
|
|
505
|
-
private handleUnresolvableInlinePlugin;
|
|
506
|
-
/**
|
|
507
|
-
* 获取所有启用插件的 bin/ 目录路径(用于注入 Bash PATH)
|
|
508
|
-
* 仅返回实际存在的 bin/ 目录
|
|
509
|
-
*/
|
|
510
|
-
getPluginBinPaths(): Promise<string[]>;
|
|
511
|
-
/**
|
|
512
|
-
* 获取插件用户配置选项值
|
|
513
|
-
*/
|
|
514
|
-
getPluginOptions(pluginName: string, marketplaceName: string): Promise<Record<string, string | boolean | number>>;
|
|
515
|
-
/**
|
|
516
|
-
* 保存插件用户配置选项值
|
|
517
|
-
*/
|
|
518
|
-
savePluginOptions(pluginName: string, marketplaceName: string, values: Record<string, string | boolean | number>): Promise<void>;
|
|
519
|
-
/**
|
|
520
|
-
* 清理特定插件的组件缓存
|
|
521
|
-
* @param pluginName 插件名称
|
|
522
|
-
* @param marketplaceName 市场名称
|
|
523
|
-
*/
|
|
524
|
-
private clearPluginComponentsCache;
|
|
525
|
-
/**
|
|
526
|
-
* 按 source 精确查重:用户输入的 source 与已安装任意一条 marketplace 的
|
|
527
|
-
* `source.url` / `source.path` / `source.repo` 匹配到就返回该条。
|
|
528
|
-
*
|
|
529
|
-
* 用于 addMarketplace 的快速去重,避免:
|
|
530
|
-
* - 同一 GitHub 仓库被重复 clone 并在 known_marketplaces.json 里落成两条
|
|
531
|
-
* - 内置 marketplace 的 source 被用户再次添加时冒出一条撞名记录
|
|
532
|
-
*
|
|
533
|
-
* 参照 packages/agent-craft/src/common/plugin/plugin-manager.ts:3101-3146 的做法。
|
|
534
|
-
*/
|
|
535
|
-
private findMarketplaceBySource;
|
|
536
|
-
/**
|
|
537
|
-
* 从 installLocation 下读取 marketplace.json,返回其 name 字段。
|
|
538
|
-
* 用于 addMarketplace install() 之后的"manifest.name 撞名"额外查重,
|
|
539
|
-
* 读失败或 manifest 无 name 时返回 undefined,由调用方容错。
|
|
540
|
-
*/
|
|
541
|
-
private readMarketplaceManifestName;
|
|
542
|
-
/**
|
|
543
|
-
* Upgrade a pre-manifestName registry row from its already-published
|
|
544
|
-
* marketplace source. This is metadata repair only: it never downloads,
|
|
545
|
-
* swaps, or removes source bytes.
|
|
546
|
-
*
|
|
547
|
-
* The caller must hold the source lock followed by the stable alias lock.
|
|
548
|
-
* A fresh registry read and exact source/location CAS prevent an old load
|
|
549
|
-
* from overwriting a concurrent source replacement.
|
|
550
|
-
*/
|
|
551
|
-
private repairMarketplaceManifestIdentityLocked;
|
|
552
|
-
private repairMarketplaceManifestIdentity;
|
|
553
|
-
/**
|
|
554
|
-
* 解析源字符串为MarketplaceSource对象
|
|
555
|
-
*/
|
|
556
|
-
private parseSource;
|
|
557
|
-
private getEnabledPlugins;
|
|
558
|
-
private getSettingsScopePriority;
|
|
559
|
-
private assertDependencyCanBeEnabledAtScope;
|
|
560
|
-
private setSessionEnabledPlugins;
|
|
561
|
-
/**
|
|
562
|
-
* 生成市场名称
|
|
563
|
-
*/
|
|
564
|
-
private generateMarketplaceName;
|
|
565
|
-
private createMarketplaceStagingName;
|
|
566
|
-
private createMarketplaceTransactionSibling;
|
|
567
|
-
private createMarketplacePublicationJournalPath;
|
|
568
|
-
private createMarketplaceLastGoodMarkerName;
|
|
569
|
-
private toMarketplaceRegistryIdentity;
|
|
570
|
-
private ensureMarketplacePublicationGeneration;
|
|
571
|
-
private writeMarketplacePublicationJournal;
|
|
572
|
-
private removeMarketplacePublicationJournal;
|
|
573
|
-
/**
|
|
574
|
-
* Publish a fully prepared remote marketplace snapshot at its durable
|
|
575
|
-
* `marketplaces/<storageName>` path. The caller owns the marketplace-name
|
|
576
|
-
* lock and commits the registry row before calling `commit()`.
|
|
577
|
-
*/
|
|
578
|
-
private publishMarketplaceSourceSnapshot;
|
|
579
|
-
/**
|
|
580
|
-
* One-time repair for registry rows written by the source-* regression.
|
|
581
|
-
* Copy first so the registered old path remains readable until the stable
|
|
582
|
-
* path and registry row have both committed.
|
|
583
|
-
*/
|
|
584
|
-
private migrateLegacyMarketplaceSourceLocationLocked;
|
|
585
|
-
private migrateLegacyMarketplaceSourceLocation;
|
|
586
|
-
private parseMarketplacePublicationJournalName;
|
|
587
|
-
private parseMarketplacePublicationJournalTempName;
|
|
588
|
-
private hasMarketplacePublicationJournal;
|
|
589
|
-
private getMarketplacePublicationJournalRecoverySource;
|
|
590
|
-
private isMarketplaceRegistryIdentity;
|
|
591
|
-
private marketplaceMatchesRegistryIdentity;
|
|
592
|
-
private readMarketplacePublicationJournal;
|
|
593
|
-
private isMarketplaceIdentityMaterializedAt;
|
|
594
|
-
private recoverMarketplacePublicationJournalLocked;
|
|
595
|
-
/**
|
|
596
|
-
* Recover the narrow crash window after the live source was moved to its
|
|
597
|
-
* transaction backup but before staging was promoted. The registry still
|
|
598
|
-
* names the stable path, so a unique complete backup is the authoritative
|
|
599
|
-
* last-good snapshot. Source/name locks make this idempotent and prevent a
|
|
600
|
-
* cooperating updater from being mistaken for a crashed one.
|
|
601
|
-
*/
|
|
602
|
-
private recoverInterruptedMarketplaceSourceSwapLocked;
|
|
603
|
-
private recoverInterruptedMarketplaceSourceSwaps;
|
|
604
|
-
private migrateLegacyMarketplaceSourceLocations;
|
|
605
|
-
private parseMarketplaceTransientArtifact;
|
|
606
|
-
private normalizeTransientCreatedAt;
|
|
607
|
-
private isMarketplaceTransientOwnerGone;
|
|
608
|
-
protected isMarketplaceTransientProcessAlive(pid: number): boolean;
|
|
609
|
-
protected queryMarketplaceTransientProcessIdentity(pid: number): Promise<ProcessIdentity | undefined>;
|
|
610
|
-
private cleanupMarketplaceTransientArtifacts;
|
|
611
|
-
private assertMarketplaceNameAllowed;
|
|
612
|
-
private removeManagedMarketplaceInstall;
|
|
613
|
-
private updateEnabledPlugins;
|
|
614
|
-
/**
|
|
615
|
-
* 安装内置市场
|
|
616
|
-
*
|
|
617
|
-
* @returns 本次调用是否真的修改了 marketplace 存储(新增了 builtin 或删除了孤儿)。
|
|
618
|
-
* 调用方据此决定是否要向下游 fire `onDidChangeEmitter`,避免在 no-op 情况下
|
|
619
|
-
* 形成 `ProductManager.sync` ↔ `PluginManager.onDidChange` 的死循环。
|
|
620
|
-
* 默认调用的 no-op/降级路径返回 false;后台管理可要求把失败向上汇报,
|
|
621
|
-
* 同时继续完成其他幂等阶段并重投影已成功的结果。
|
|
622
|
-
*/
|
|
623
|
-
installBuiltInMarketplaces(options?: {
|
|
624
|
-
marketplaceNames?: readonly string[];
|
|
625
|
-
throwOnFailure?: boolean;
|
|
626
|
-
/** Caller will refresh installed plugins after composing more marketplace changes. */
|
|
627
|
-
skipInstalledPluginRefresh?: boolean;
|
|
628
|
-
}): Promise<boolean>;
|
|
629
|
-
/**
|
|
630
|
-
* 从 settings 中安装配置的市场
|
|
631
|
-
*/
|
|
632
|
-
installMarketplacesFromSettings(options?: {
|
|
633
|
-
marketplaceNames?: readonly string[];
|
|
634
|
-
throwOnFailure?: boolean;
|
|
635
|
-
/** Caller will refresh installed plugins after composing more marketplace changes. */
|
|
636
|
-
skipInstalledPluginRefresh?: boolean;
|
|
637
|
-
}): Promise<void>;
|
|
638
|
-
/**
|
|
639
|
-
* 根据 MarketplaceSource 构造源字符串
|
|
640
|
-
*/
|
|
641
|
-
private buildSourceString;
|
|
642
|
-
/**
|
|
643
|
-
* Materialize product-declared plugins through the same marketplace →
|
|
644
|
-
* versioned cache → installed registry workflow as an explicit install.
|
|
645
|
-
* `autoEnable:false` means preinstall only; first-run defaults never
|
|
646
|
-
* overwrite an existing true/false setting.
|
|
647
|
-
*/
|
|
648
|
-
private installBuiltInMarketPlugins;
|
|
649
|
-
private isCurrentDeclaredDirectoryPluginProjection;
|
|
650
|
-
private getBuiltInMarketPluginDeclarations;
|
|
651
|
-
private toSettingsScope;
|
|
652
|
-
/**
|
|
653
|
-
* 检查是否启用第三方市场自动更新
|
|
654
|
-
* 优先级:settings env > process.env > 产品配置
|
|
655
|
-
* @returns 是否启用
|
|
656
|
-
*/
|
|
657
|
-
private shouldAutoUpdateThirdPartyMarketplaces;
|
|
658
|
-
/**
|
|
659
|
-
* 检查并安装所有 enabledPlugins 中未安装的插件
|
|
660
|
-
*/
|
|
661
|
-
repairEnabledPlugins(options?: PluginRepairOptions): Promise<void>;
|
|
662
|
-
repairMissingPluginDependencies(): Promise<PluginDependencyRepairResult>;
|
|
663
|
-
private repairEnabledPluginDependencies;
|
|
664
|
-
private installMissingEnabledPlugins;
|
|
665
|
-
/**
|
|
666
|
-
* 应用管控策略(防重入 + 排队执行)
|
|
667
|
-
* T1 触发点调用。如果已在执行中,标记 pendingApplyRequest,
|
|
668
|
-
* 当前执行完成后会立刻补执行(do-while),避免 T2/T3/T4 被丢弃。
|
|
669
|
-
*/
|
|
670
|
-
private applyManagedPolicies;
|
|
671
|
-
/**
|
|
672
|
-
* 实际执行管控策略:逐条 apply,市场未就绪的加入 pending 队列
|
|
673
|
-
*/
|
|
674
|
-
private doApplyManagedPolicies;
|
|
675
|
-
/**
|
|
676
|
-
* 执行单条合并插件策略
|
|
677
|
-
* 合并策略通过 autoEnable + canRemove/canSwitchoff/canEdit 控制插件行为:
|
|
678
|
-
* - 未安装时:自动安装(autoEnable 控制是否同时启用)
|
|
679
|
-
* - 已安装但未启用时:如果 autoEnable !== false,则自动启用
|
|
680
|
-
* @returns 是否产生了变更
|
|
681
|
-
*/
|
|
682
|
-
private applySinglePolicy;
|
|
683
|
-
/**
|
|
684
|
-
* 重试 pending 队列中的管控策略
|
|
685
|
-
* 由 T2/T3/T4 触发点调用
|
|
686
|
-
*/
|
|
687
|
-
private retryPendingManagedPolicies;
|
|
688
|
-
/**
|
|
689
|
-
* 判断错误是否可重试(市场未就绪)
|
|
690
|
-
*/
|
|
691
|
-
private isRetryableError;
|
|
692
|
-
}
|