@linkdesk/contracts 0.1.17 → 0.1.19
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/linkdesk.d.ts +43 -0
- package/package.json +1 -1
package/linkdesk.d.ts
CHANGED
|
@@ -92,12 +92,19 @@ export interface CommandsAPI {
|
|
|
92
92
|
* plugin.json contributes.commands 未声明的命令经 meta 注册后同样可见/可执行。
|
|
93
93
|
* 真相源分工:壳 CommandRegistry = 显示真相源(title/category/when 唯一权威),
|
|
94
94
|
* 池 = 执行真相源(handler 唯一权威,永不跨进程)——meta 只同步显示面。
|
|
95
|
+
* 🔴 **E6#111b:`meta.pluginId` = 注册方显式申报的真身份**(可选,只做加法)。
|
|
96
|
+
* 命令归属解析优先级 = ① plugin.json 声明面 → ② 本字段 → ③ 名字第一段推定。
|
|
97
|
+
* 声明过的命令**不必填**(① 已权威);只有「声明里没有、名字又不带自己前缀」的命令需要它,
|
|
98
|
+
* 否则该命令会被算到名字第一段那个属主头上(借他人前缀 ⇒ 归属错、且异归属顶替拦不住)。
|
|
99
|
+
* 照 `notifications.source` 先例(`ui.ts:26-32`):池是单进程共享 realm,
|
|
100
|
+
* 所有插件共用同一个 `window.linkdesk` ⇒ **无从自动注入,只能作者显式报**。
|
|
95
101
|
*/
|
|
96
102
|
registerCommand(commandId: string,
|
|
97
103
|
handler: (...args: any[]) => Promise<unknown> | unknown, meta?: {
|
|
98
104
|
title?: string;
|
|
99
105
|
category?: string;
|
|
100
106
|
when?: string;
|
|
107
|
+
pluginId?: string;
|
|
101
108
|
}): void;
|
|
102
109
|
/** 注销插件的池内命令(约定:命令 ID 格式为 "pluginId.commandName")——随视图 unmount 调用 */
|
|
103
110
|
unregisterCommands(pluginId: string): void;
|
|
@@ -935,6 +942,38 @@ export interface PluginEntryInfo {
|
|
|
935
942
|
/** 目录是否含 index.bundle.js(bundle 格式事实) */
|
|
936
943
|
bundle: boolean;
|
|
937
944
|
}
|
|
945
|
+
/** 兼容读数请求(E6#117)——plugins.getCompatibility 入参:插件身份 + 目录侧事实(未装插件由
|
|
946
|
+
* 调用方从 catalog 条目供给;已装插件以磁盘 manifest 为生效值,主进程覆盖) */
|
|
947
|
+
export interface PluginCompatibilityRequest {
|
|
948
|
+
pluginId: string;
|
|
949
|
+
/** 插件要求的最低壳版本(catalog 条目携带;未装插件的唯一来源) */
|
|
950
|
+
minAppVersion?: string | null;
|
|
951
|
+
/** 插件最后发版日(catalog `publishedAt`,ISO) */
|
|
952
|
+
publishedAt?: string | null;
|
|
953
|
+
}
|
|
954
|
+
/** 兼容读数(E6#117)——状态算法单点在壳 `src/core/compat/compatibility.ts`;本面只给机器态,
|
|
955
|
+
* ⛔ 不携带任何用户可见句子(用户面文案归市场插件 i18n,用户面词表见 00 号档 §〇d) */
|
|
956
|
+
export interface PluginCompatibilityReading {
|
|
957
|
+
pluginId: string;
|
|
958
|
+
/** 五态(与用户面五词固定对应,对应表住在 compatibility.ts 头注) */
|
|
959
|
+
state: "current" | "compatible" | "drifted" | "incompatible" | "unknown";
|
|
960
|
+
/** 悬空读数;null = 拿不到(未装 / 目录读不了)——缺数据 ≠ 有问题 */
|
|
961
|
+
dangling: {
|
|
962
|
+
count: number;
|
|
963
|
+
names: string[];
|
|
964
|
+
} | null;
|
|
965
|
+
/** 生效的最低壳版本(已装 = 磁盘 manifest;未装 = 调用方供给);没有 ⇒ null */
|
|
966
|
+
minAppVersion: string | null;
|
|
967
|
+
shellVersion: string;
|
|
968
|
+
/** minAppVersion 缺失/非法 ⇒ null(没得比);false ⇒ state = "incompatible" */
|
|
969
|
+
minAppSatisfied: boolean | null;
|
|
970
|
+
/** 插件最后发版日(YYYY-MM-DD);catalog 拿不到 ⇒ null */
|
|
971
|
+
lastUpdate: string | null;
|
|
972
|
+
/** 当前壳构建日(YYYY-MM-DD);dev 占位 ⇒ null */
|
|
973
|
+
shellBuiltAt: string | null;
|
|
974
|
+
/** 哪些输入缺失(诊断面;state = "unknown" 时非空) */
|
|
975
|
+
unknown: string[];
|
|
976
|
+
}
|
|
938
977
|
/**
|
|
939
978
|
* Phase 4 核心类型定义。
|
|
940
979
|
* 插件元数据、标签页扩展字段、视图注册表条目。
|
|
@@ -1229,6 +1268,10 @@ export interface PluginsAPI {
|
|
|
1229
1268
|
/** E6#7(1.2-4):resolvePath 的兄弟(discovery 族)——返回 { root, entry, bundle }(bundle 入口恒 index.bundle.js)。
|
|
1230
1269
|
* 可选——保 state.ts 守卫与两 preload 面(壳/池)编译不裂;调用方先判存在再调用。 */
|
|
1231
1270
|
resolveEntry?(id: string): Promise<PluginEntryInfo>;
|
|
1271
|
+
/** E6#117:兼容读数(只读)——「这份插件跟当前版本搭不搭」由壳单点算出(状态算法
|
|
1272
|
+
* `src/core/compat/compatibility.ts`;用户面五词与读数的对应表住该文件头注)。
|
|
1273
|
+
* 可选——同 resolveEntry 先例(保 mock 与既有实现面编译不裂;调用方先判存在)。 */
|
|
1274
|
+
getCompatibility?(req: PluginCompatibilityRequest): Promise<PluginCompatibilityReading>;
|
|
1232
1275
|
listDirs?(): Promise<string[]>;
|
|
1233
1276
|
/** E6#9a:全量发现——[{ pluginId, entry, manifest }](替代 import.meta.glob;打包插件不在源码树,主进程读盘唯一真源) */
|
|
1234
1277
|
listAll?(): Promise<PluginDiscoveryEntry[]>;
|