@linkdesk/contracts 0.1.18 → 0.1.20

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 (2) hide show
  1. package/linkdesk.d.ts +43 -0
  2. package/package.json +1 -1
package/linkdesk.d.ts CHANGED
@@ -942,6 +942,38 @@ export interface PluginEntryInfo {
942
942
  /** 目录是否含 index.bundle.js(bundle 格式事实) */
943
943
  bundle: boolean;
944
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
+ }
945
977
  /**
946
978
  * Phase 4 核心类型定义。
947
979
  * 插件元数据、标签页扩展字段、视图注册表条目。
@@ -1174,6 +1206,13 @@ export interface PluginInstallRequestOpts {
1174
1206
  displayName?: string;
1175
1207
  /** job 出身——行 = 一次用户动作(user,缺省);插件拖来的依赖(dependency)藏在那一行里 */
1176
1208
  origin?: "user" | "dependency";
1209
+ /**
1210
+ * E6#73o:依赖解析目录——传入后,本插件 `requires` 里**缺失**的依赖由壳在**同一安装 job 内**
1211
+ * 自动先装(内联递归、不占第二个槽——依赖解析复用 updateCheck 打本目录取最新直链)。
1212
+ * 不传 = 行为与现状一致(缺依赖 parked)。解析半径 = 本目录(壳不内置任何目录 URL)。
1213
+ * 设计定案:docs/02-Electron架构/E6_插件生态与发布/03-插件市场/20-依赖链自动安装设计定案.md。
1214
+ */
1215
+ catalogUrl?: string;
1177
1216
  }
1178
1217
  /** E5.7#81:安装结果——success:false 时 error 为中文失败原因(校验 / 版本冲突 / 复制失败)。
1179
1218
  * 安装进度事件:events.on("plugin:installProgress", ({ stage, pluginId, message }) => ...)
@@ -1236,6 +1275,10 @@ export interface PluginsAPI {
1236
1275
  /** E6#7(1.2-4):resolvePath 的兄弟(discovery 族)——返回 { root, entry, bundle }(bundle 入口恒 index.bundle.js)。
1237
1276
  * 可选——保 state.ts 守卫与两 preload 面(壳/池)编译不裂;调用方先判存在再调用。 */
1238
1277
  resolveEntry?(id: string): Promise<PluginEntryInfo>;
1278
+ /** E6#117:兼容读数(只读)——「这份插件跟当前版本搭不搭」由壳单点算出(状态算法
1279
+ * `src/core/compat/compatibility.ts`;用户面五词与读数的对应表住该文件头注)。
1280
+ * 可选——同 resolveEntry 先例(保 mock 与既有实现面编译不裂;调用方先判存在)。 */
1281
+ getCompatibility?(req: PluginCompatibilityRequest): Promise<PluginCompatibilityReading>;
1239
1282
  listDirs?(): Promise<string[]>;
1240
1283
  /** E6#9a:全量发现——[{ pluginId, entry, manifest }](替代 import.meta.glob;打包插件不在源码树,主进程读盘唯一真源) */
1241
1284
  listAll?(): Promise<PluginDiscoveryEntry[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@linkdesk/contracts",
3
- "version": "0.1.18",
3
+ "version": "0.1.20",
4
4
  "description": "LinkDesk 插件契约类型——window.linkdesk.* 全量类型定义(E5.8 契约生成产物)。第三方插件作者唯一合法类型消费路径。",
5
5
  "type": "module",
6
6
  "types": "./linkdesk.d.ts",