dsh-plugin-manager-companion 0.1.0
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/LICENSE +21 -0
- package/README.en.md +144 -0
- package/README.md +142 -0
- package/cordis.patch.yml +9 -0
- package/dist/about.d.ts +77 -0
- package/dist/about.js +179 -0
- package/dist/cli.d.ts +226 -0
- package/dist/cli.js +856 -0
- package/dist/client/AboutPage.d.ts +75 -0
- package/dist/client/ConsolePage.d.ts +79 -0
- package/dist/client/KindsPage.d.ts +21 -0
- package/dist/client/MarketplacePage.d.ts +36 -0
- package/dist/client/OfficialSlots.d.ts +35 -0
- package/dist/client/UpgradeRow.d.ts +108 -0
- package/dist/client/index.d.ts +26 -0
- package/dist/client/locales.d.ts +475 -0
- package/dist/client/pmSelect.d.ts +38 -0
- package/dist/client/shared.d.ts +928 -0
- package/dist/client/upgradeView.d.ts +278 -0
- package/dist/client/wire.d.ts +401 -0
- package/dist/client.js +9194 -0
- package/dist/diagnostics.d.ts +332 -0
- package/dist/diagnostics.js +2631 -0
- package/dist/envManager.d.ts +1047 -0
- package/dist/envManager.js +3214 -0
- package/dist/fix.d.ts +60 -0
- package/dist/fix.js +168 -0
- package/dist/guard.d.ts +133 -0
- package/dist/guard.js +232 -0
- package/dist/index.d.ts +121 -0
- package/dist/index.js +1150 -0
- package/dist/installSession.d.ts +111 -0
- package/dist/installSession.js +150 -0
- package/dist/kinds.d.ts +464 -0
- package/dist/kinds.js +1029 -0
- package/dist/marketView.d.ts +261 -0
- package/dist/marketView.js +406 -0
- package/dist/marketplace.d.ts +248 -0
- package/dist/marketplace.js +500 -0
- package/dist/match.d.ts +67 -0
- package/dist/match.js +203 -0
- package/dist/net.d.ts +108 -0
- package/dist/net.js +163 -0
- package/dist/official.d.ts +145 -0
- package/dist/official.js +205 -0
- package/dist/paths.d.ts +108 -0
- package/dist/paths.js +236 -0
- package/dist/presets.d.ts +299 -0
- package/dist/presets.js +578 -0
- package/dist/qualityGate.d.ts +66 -0
- package/dist/qualityGate.js +247 -0
- package/dist/rank.d.ts +88 -0
- package/dist/rank.js +164 -0
- package/dist/registry.d.ts +295 -0
- package/dist/registry.js +686 -0
- package/dist/rest.d.ts +122 -0
- package/dist/rest.js +219 -0
- package/dist/scan.d.ts +134 -0
- package/dist/scan.js +396 -0
- package/dist/settings.d.ts +447 -0
- package/dist/settings.js +263 -0
- package/dist/tags.d.ts +119 -0
- package/dist/tags.js +166 -0
- package/dist/tools.d.ts +131 -0
- package/dist/tools.js +377 -0
- package/dist/types.d.ts +651 -0
- package/dist/types.js +13 -0
- package/dist/upgrade.d.ts +428 -0
- package/dist/upgrade.js +1100 -0
- package/dist/upgradeView.d.ts +313 -0
- package/dist/upgradeView.js +273 -0
- package/docs/images/readme/01-console-health.png +0 -0
- package/docs/images/readme/02-console-envs.png +0 -0
- package/docs/images/readme/03-marketplace.png +0 -0
- package/docs/images/readme/04-official-plugin-page.png +0 -0
- package/package.json +104 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* dsh-plugin-manager-companion — 插件入口与 op 分派。
|
|
3
|
+
*
|
|
4
|
+
* 归属:A 类·重写(旧仓库入口 2358 行,把服务、路由、job、缓存闭包全塞在一起)。
|
|
5
|
+
* 官方复用:ctx.profileContext / ctx.pluginManager(经 official.ts 探测)/ ctx.settings /
|
|
6
|
+
* ctx.webServer / ctx.tools / ctx.systemPrompt。
|
|
7
|
+
* 前提检查:旧仓库入口自建 27 个 REST op + job 系统 + patch 写入,前提是"官方只有只读清单"。
|
|
8
|
+
* 0.1.6 之后前提消失:**当前环境**的写操作全部交还官方 Remote;本入口只保留官方不覆盖的部分
|
|
9
|
+
* (深度诊断、跨环境管理、市场、技能与预设、质量门编排)。
|
|
10
|
+
*
|
|
11
|
+
* 硬约束:服务名绝不用 pluginManager(官方已占用,同名会让整个 profile 起不来)。
|
|
12
|
+
*/
|
|
13
|
+
import type { Context } from "@deepseek-ai/cordis";
|
|
14
|
+
import type { TrialInstallOptions, TrialInstallResult } from "./envManager.ts";
|
|
15
|
+
import { type OfficialCapabilities } from "./official.ts";
|
|
16
|
+
import { type UpgradeEngineDeps } from "./upgrade.ts";
|
|
17
|
+
import { JobRegistry, type Envelope } from "./rest.ts";
|
|
18
|
+
import { type CompanionConfig, type ConfigHandle } from "./settings.ts";
|
|
19
|
+
import type { GatedInstallResult } from "./types.ts";
|
|
20
|
+
/** 本插件对外的服务名。绝不用 pluginManager —— 那是官方的。 */
|
|
21
|
+
export declare const SERVICE_NAME = "companion";
|
|
22
|
+
/** 插件配置的 schema,供宿主配置界面与校验使用。 */
|
|
23
|
+
export { ConfigSchema } from "./settings.ts";
|
|
24
|
+
/** Loader 行名,等于包名;cordis.patch.yml 必须用同一个 id。 */
|
|
25
|
+
export declare const name = "dsh-plugin-manager-companion";
|
|
26
|
+
/** 装配时必需的服务;官方能力用 get 探测,因此这里只列真正硬需要的。 */
|
|
27
|
+
export declare const inject: string[];
|
|
28
|
+
/** 一次装配持有的运行时状态。 */
|
|
29
|
+
interface CompanionRuntime {
|
|
30
|
+
readonly capabilities: OfficialCapabilities;
|
|
31
|
+
readonly config: ConfigHandle;
|
|
32
|
+
readonly jobs: JobRegistry;
|
|
33
|
+
}
|
|
34
|
+
/** 读取当前装配状态(诊断与 UI 用)。未装配时返回 undefined。 */
|
|
35
|
+
export declare function currentRuntime(): CompanionRuntime | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* 试装执行器(测试注入替身)。
|
|
38
|
+
*
|
|
39
|
+
* 为什么要留这个缝:试装会真起进程(headless 验证)。单测要证明的是"接进来了、策略生效了",
|
|
40
|
+
* 不能靠真的起一个 dsh 来证明——那是真机 e2e 的活。
|
|
41
|
+
*/
|
|
42
|
+
export type TrialRunner = (spec: string, realName: string, options: TrialInstallOptions) => Promise<TrialInstallResult>;
|
|
43
|
+
/** gatedInstall 的可选注入。 */
|
|
44
|
+
export interface GatedInstallOptions {
|
|
45
|
+
/** 试装执行器;省略时用真实的 runTrialInstall(会真装、真起进程)。 */
|
|
46
|
+
readonly trial?: TrialRunner;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* 受质量门保护的安装。
|
|
50
|
+
*
|
|
51
|
+
* 三步走,全部经官方通道,零竞态:
|
|
52
|
+
* 1. inspect(spec) —— 官方读 spec 指向什么(拒绝非法/已装/非 bundle)
|
|
53
|
+
* 2. installBundle(spec, { enabled: false }) —— 官方装但**不激活**
|
|
54
|
+
* 3. 扫描已安装包(我们的质量门)
|
|
55
|
+
* 合格 → setBundleEnabled(name, true) 激活
|
|
56
|
+
* 不合格 → removeBundle(name) 回滚
|
|
57
|
+
*
|
|
58
|
+
* 为什么不需要"安装前钩子":官方提供了 enabled:false 这个开关(官方 UI 自己就用它)。
|
|
59
|
+
* 装上但不激活,等于把包放进隔离区,扫完再决定是否放行——比"先扫后装"更可靠,
|
|
60
|
+
* 因为扫描对象真实存在于目标位置。
|
|
61
|
+
*
|
|
62
|
+
* 试装(第二步,DESIGN §5.2)接在**静态快筛之后、真正放行之前**:一条路径,Web UI /
|
|
63
|
+
* CLI / agent 工具三边同时生效。试装关闭时(默认)本函数的行为与没有它时逐条相同。
|
|
64
|
+
*
|
|
65
|
+
* 两处刻意的实现细节:
|
|
66
|
+
* · 质量门**整体**关闭或包在豁免名单里时,试装不执行——但会在输出里写明"试装未执行",
|
|
67
|
+
* 不让"我打开了开关却什么都没发生"变成一个看不见的洞。
|
|
68
|
+
* · 试装没通过时的处置由设置决定(默认不装),但**无论哪一档**,"无法试装"都不会被写成通过。
|
|
69
|
+
*
|
|
70
|
+
* @param ctx - host 上下文。
|
|
71
|
+
* @param config - 本插件配置。
|
|
72
|
+
* @param spec - 安装 spec(npm 名 / git 地址 / 本地路径 / tarball)。
|
|
73
|
+
* @param environmentName - 目标环境名;undefined 表示当前环境。
|
|
74
|
+
* @param options - 可选注入(试装执行器)。
|
|
75
|
+
* @returns 结果;失败时输出里说明是官方拒绝、质量门拦截、试装未通过还是激活失败。
|
|
76
|
+
*/
|
|
77
|
+
export declare function gatedInstall(ctx: Context, config: CompanionConfig, spec: string, environmentName?: string, options?: GatedInstallOptions): Promise<GatedInstallResult>;
|
|
78
|
+
/** op 分派需要的外部依赖(测试可注入替身)。 */
|
|
79
|
+
export interface OpDependencies {
|
|
80
|
+
readonly ctx: Context;
|
|
81
|
+
readonly config: () => CompanionConfig;
|
|
82
|
+
readonly configUpdate: (patch: Partial<CompanionConfig>) => Promise<CompanionConfig>;
|
|
83
|
+
readonly capabilities: () => OfficialCapabilities;
|
|
84
|
+
readonly jobs: JobRegistry;
|
|
85
|
+
/** 试装执行器;省略时用真实的 runTrialInstall(会真装候选包并起进程)。 */
|
|
86
|
+
readonly trial?: TrialRunner;
|
|
87
|
+
/** 升级引擎依赖(ctx / 官方运行器 / 试装执行器 / 抓取器 的注入缝)。 */
|
|
88
|
+
readonly upgrade?: UpgradeEngineDeps;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* 执行一个 op。
|
|
92
|
+
*
|
|
93
|
+
* 分派表刻意扁平:每个 op 一行到几行,复杂编排下沉到各模块(gatedInstall 是唯一例外,
|
|
94
|
+
* 因为它跨官方 Remote 与我们的质量门,属于入口职责)。
|
|
95
|
+
*
|
|
96
|
+
* @param op - 操作名。
|
|
97
|
+
* @param body - 请求体。
|
|
98
|
+
* @param deps - 依赖。
|
|
99
|
+
* @returns 响应信封。
|
|
100
|
+
*/
|
|
101
|
+
export declare function handleOp(op: string, body: Record<string, unknown>, deps: OpDependencies): Promise<Envelope<unknown>>;
|
|
102
|
+
/**
|
|
103
|
+
* 注册自有 REST 路由。
|
|
104
|
+
*
|
|
105
|
+
* 官方能力(插件启停/安装/卸载/清单)**不在这里**——客户端直连官方 Remote。
|
|
106
|
+
* 这里只暴露官方不覆盖的部分:诊断、环境管理、市场、技能与预设、配置。
|
|
107
|
+
*
|
|
108
|
+
* @param ctx - host 上下文。
|
|
109
|
+
* @param deps - op 分派依赖。
|
|
110
|
+
* @returns 路由 disposer 列表。
|
|
111
|
+
*/
|
|
112
|
+
export declare function registerRoutes(ctx: Context, deps: OpDependencies): (() => void)[];
|
|
113
|
+
/**
|
|
114
|
+
* 插件装配。
|
|
115
|
+
*
|
|
116
|
+
* 只做"必须有"的事:注册配置命名空间、探测官方能力、装 REST 路由与 agent 工具。
|
|
117
|
+
* 各能力模块在各自的调用点被用到,不做无意义的预先初始化(诊断与市场都是按需触发)。
|
|
118
|
+
*
|
|
119
|
+
* @param ctx - host 上下文。
|
|
120
|
+
*/
|
|
121
|
+
export declare function apply(ctx: Context): void;
|