@sema-agent/settings-schema 34.1.0 → 35.0.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +398 -0
  2. package/README.md +64 -32
  3. package/conformance/VERSION +1 -1
  4. package/conformance/cases/c100-a2a-inside-stale-fingerprint-dropped/expected.json +101 -0
  5. package/conformance/cases/c100-a2a-inside-stale-fingerprint-dropped/input.json +28 -0
  6. package/conformance/cases/c100-a2a-inside-stale-fingerprint-dropped/meta.json +6 -0
  7. package/conformance/cases/c101-a2a-inside-incomplete-dropped/expected.json +113 -0
  8. package/conformance/cases/c101-a2a-inside-incomplete-dropped/input.json +38 -0
  9. package/conformance/cases/c101-a2a-inside-incomplete-dropped/meta.json +6 -0
  10. package/conformance/cases/c102-a2a-inside-incomplete-zero-survivors/expected.json +85 -0
  11. package/conformance/cases/c102-a2a-inside-incomplete-zero-survivors/input.json +34 -0
  12. package/conformance/cases/c102-a2a-inside-incomplete-zero-survivors/meta.json +6 -0
  13. package/conformance/cases/c103-mcp-caller-meta-declared/expected.json +106 -0
  14. package/conformance/cases/c103-mcp-caller-meta-declared/input.json +28 -0
  15. package/conformance/cases/c103-mcp-caller-meta-declared/meta.json +6 -0
  16. package/conformance/cases/c98-a2a-registration-keys-carried/expected.json +163 -0
  17. package/conformance/cases/c98-a2a-registration-keys-carried/input.json +42 -0
  18. package/conformance/cases/c98-a2a-registration-keys-carried/meta.json +6 -0
  19. package/conformance/cases/c99-a2a-preapproval-on-outside-peer-dropped/expected.json +100 -0
  20. package/conformance/cases/c99-a2a-preapproval-on-outside-peer-dropped/input.json +23 -0
  21. package/conformance/cases/c99-a2a-preapproval-on-outside-peer-dropped/meta.json +6 -0
  22. package/dist/a2a-peer-identity.d.ts +116 -0
  23. package/dist/a2a-peer-identity.js +182 -0
  24. package/dist/atomic-write.js +1 -1
  25. package/dist/catalog-manages.js +2 -2
  26. package/dist/config-dir-migration.js +0 -1
  27. package/dist/config-document-refusal.d.ts +1 -1
  28. package/dist/config-fns.d.ts +21 -8
  29. package/dist/config-fns.js +16 -3
  30. package/dist/config-root-documents.d.ts +3 -54
  31. package/dist/config-root-documents.js +24 -21
  32. package/dist/config-root-node.d.ts +2 -96
  33. package/dist/config-root-node.js +15 -163
  34. package/dist/conformance/warnings.js +1 -1
  35. package/dist/env-model-table.d.ts +3 -3
  36. package/dist/env-model-table.js +5 -5
  37. package/dist/index.d.ts +2 -1
  38. package/dist/index.js +2 -1
  39. package/dist/migration-receipt.d.ts +9 -11
  40. package/dist/migration-receipt.js +4 -5
  41. package/dist/node.d.ts +3 -3
  42. package/dist/node.js +3 -3
  43. package/dist/one-time-migrations.d.ts +3 -4
  44. package/dist/one-time-migrations.js +3 -28
  45. package/dist/retired-envs.js +5 -0
  46. package/dist/safety-merge-spec.d.ts +21 -0
  47. package/dist/safety-merge-spec.js +13 -0
  48. package/dist/scheduler-store-node.d.ts +14 -11
  49. package/dist/scheduler-store-node.js +22 -34
  50. package/dist/scheduler-store.d.ts +21 -6
  51. package/dist/scheduler-store.js +100 -19
  52. package/dist/settings-units.d.ts +9 -0
  53. package/dist/settings-units.js +12 -7
  54. package/dist/types.d.ts +44 -2
  55. package/dist/types.js +70 -2
  56. package/docs/API-SURFACE.md +23 -11
  57. package/docs/CC-DIVERGENCE.md +2 -1
  58. package/docs/CONFORMANCE.md +3 -3
  59. package/docs/CONSUMER-INTEGRATION.md +106 -11
  60. package/llms-full.txt +35 -12
  61. package/llms.txt +14 -5
  62. package/package.json +3 -3
@@ -1,6 +1,4 @@
1
- import { type ConfigRootDocument, type EnvModelsDecision, type EnvModelsDecisionWord, type MarkedMigrationId, type MigrationMarker, type RootDocumentUnreadableReason } from "./config-root-documents.js";
2
- import { type EnvModelTableEntry, type EnvSnapshot } from "./env-model-table.js";
3
- import type { MigrationReceipt } from "./migration-receipt.js";
1
+ import { type ConfigRootDocument, type EnvModelsDecision, type EnvModelsDecisionWord } from "./config-root-documents.js";
4
2
  /** 根级文档读写的 I/O 座(注入;真绑定 {@link nodeConfigRootIo})。写的两只按文档名取模式类({@link ROOT_DOCUMENT_CLASS},类的规则见原子写器的模式表)。 */
5
3
  export interface ConfigRootIo {
6
4
  /** 读一份文件的**字节**(digest 对字节求;解码由本包做);不存在 ⇒ 抛 `code: "ENOENT"` 的错,别的读不出照常抛(带 errno)。 */
@@ -9,8 +7,6 @@ export interface ConfigRootIo {
9
7
  writeDocument(document: ConfigRootDocument, file: string, text: string): Promise<void>;
10
8
  /** 原子地**独占创建**一份根级文档(独占建临时文件、fsync → `link`;新建模式同 {@link writeDocument}):建成 ⇒ `created`;目标名已在(只有 `EEXIST`)⇒ `present`(一字不动);别的失败照常抛。 */
11
9
  createDocument(document: ConfigRootDocument, file: string, text: string): Promise<"created" | "present">;
12
- /** 目录不在就建(仅属主可进,连同缺的上级):建了 ⇒ `created`;已在 ⇒ `present`。 */
13
- ensureDirectory(dir: string): Promise<"created" | "present">;
14
10
  }
15
11
  /** 真文件系统的绑定:读先过本包的符号链接判法(链接 ⇒ 它指向的真文件;悬空 ⇒ 抛,不是缺席),只读常规文件;写走本包唯一的原子写器。 */
16
12
  export declare const nodeConfigRootIo: Readonly<ConfigRootIo>;
@@ -18,16 +14,10 @@ export declare const nodeConfigRootIo: Readonly<ConfigRootIo>;
18
14
  export declare function readEnvModelsDecision(root: string, io?: ConfigRootIo): Promise<EnvModelsDecision>;
19
15
  /** {@link readEnvModelsDecision} 的**同步孪生**(壳在同步具名锁里写模型池,要在锁里读决定):同一个字节读法、同一个缺席律、同一个答案表;读真文件系统(不收注入座 —— 注入座是异步的)。从不抛。 */
20
16
  export declare function readEnvModelsDecisionSync(root: string): EnvModelsDecision;
21
- /**
22
- * 一条一次性迁移的运行记录的**唯一读者**(文件 `<根>/config.migration.<id>.json`):不存在 ⇒ `absent`;`{"migration":<id>}` ⇒ `present`;别的 ⇒ `unreadable`
23
- * (坏 JSON / 坏形 —— id 对不上也算 / 读不出)。「跑过」只问这一份文件在不在、读不读得懂,不读任何聚合文件。读数从不抛;`id` 不是写运行记录的迁移(根级文档名单里没有它的记录)⇒
24
- * `TypeError`,不拿它拼路径。
25
- */
26
- export declare function readMigrationMarker(root: string, id: MarkedMigrationId, io?: ConfigRootIo): Promise<MigrationMarker>;
27
17
  /** {@link writeEnvModelsDecision} 的写法(闭集):`overwrite` = 写者(用户确认之后,整份覆盖);`createIfAbsent` = 不存在才建。 */
28
18
  export type EnvModelsDecisionWrite = "overwrite" | "createIfAbsent";
29
19
  /**
30
- * 写配置根上的 env 模型表决定 —— 决定文件的**唯一写函数**(迁移铸确认也经它的 `createIfAbsent`;运行记录不归它,见文件头)。`overwrite` 恒答 `written`;`createIfAbsent` 在文档已在(`EEXIST`)时答 `present`(一字不动)。
20
+ * 写配置根上的 env 模型表决定 —— 决定文件的**唯一写函数**。`overwrite` 恒答 `written`;`createIfAbsent` 在文档已在(`EEXIST`)时答 `present`(一字不动)。
31
21
  * 决定词 / 写法不在闭集 ⇒ `TypeError`(一字不写)。写失败 ⇒ 抛本包的文件系统失败句(点名路径)。根须已存在。
32
22
  */
33
23
  export declare function writeEnvModelsDecision(root: string, decision: EnvModelsDecisionWord, opts: {
@@ -38,87 +28,3 @@ export declare function writeEnvModelsDecision(root: string, decision: EnvModels
38
28
  export declare function writeEnvModelsDecisionSync(root: string, decision: EnvModelsDecisionWord, opts: {
39
29
  readonly write: EnvModelsDecisionWrite;
40
30
  }): "written" | "present";
41
- /** SS-M11 的结局(闭集,调用方穷举;本函数不出声,告警由调用方按结局发)。 */
42
- export type EnvModelsMigration =
43
- /** 运行记录已在:不跑。 */
44
- {
45
- readonly kind: "already_ran";
46
- }
47
- /** 运行记录读不懂:按已跑处理(读不懂记录就不替人铸确认),一字不写。调用方告警。 */
48
- | {
49
- readonly kind: "marker_unreadable";
50
- readonly reason: RootDocumentUnreadableReason;
51
- }
52
- /** 独占创建运行记录时它已在(`EEXIST`):别的进程已是本根的铸造者 ⇒ 本进程永不铸。 */
53
- | {
54
- readonly kind: "not_minter";
55
- }
56
- /** 运行记录建不成(只读根、根建不出、`ENOSPC`、文件系统不支持硬链接 —— `ENOTSUP` / `EPERM` …):不铸 —— 缺席照旧读作 kept。
57
- * 记录始终建不成 ⇒ 每次起服都重跑、都答这一格(调用方每次告警;手写的决定照常生效,告警不因它停)。`error` 点名记录文件,`wayOut` 是手工恢复句。 */
58
- | {
59
- readonly kind: "marker_write_failed";
60
- readonly errno: string | undefined;
61
- readonly error: string;
62
- readonly wayOut: string;
63
- }
64
- /** 本进程独占创建了运行记录 = 本根唯一的铸造者;`decision` = 选举**之前**读到的决定(铸只按它),`mint` = 铸没铸。 */
65
- | {
66
- readonly kind: "recorded";
67
- readonly createdRoot: boolean;
68
- readonly decision: EnvModelsDecision;
69
- readonly mint: EnvModelsMint;
70
- };
71
- /**
72
- * SS-M11 铸确认的结局(闭集)。**披露**:运行记录先于确认建;进程在两者之间中断,或铸失败、或 models.json 读不出 ⇒ 此后无人再铸、决定缺席读作 kept ——
73
- * 升级前由目录服务的根这时换成 env 模型服务,旧目录不会自动保住;出路是 `wayOut` 那一句(手写决定文件)。
74
- */
75
- export type EnvModelsMint =
76
- /** 铸了 `replaced`:`replacedEnvModels` = 从此被目录顶替的 env 模型(名 + 槽 + 来源键;env 表没声明 ⇒ 空)—— 非空时调用方据此发一行一次性告警,点名它们与出路(删掉 / 写 kept)。 */
77
- {
78
- readonly kind: "minted";
79
- readonly receipt: MigrationReceipt;
80
- readonly replacedEnvModels: readonly EnvModelTableEntry[];
81
- }
82
- /** 独占创建决定时它已在(只有 `EEXIST` 算):期间有人写了决定(用户的 kept / 写者的 replaced)⇒ 一字不动。 */
83
- | {
84
- readonly kind: "exists";
85
- }
86
- /** 决定建不成(`ENOSPC` / `EIO` / `EPERM` / 文件系统不支持硬链接 …):缺席照旧读作 kept,记录在 ⇒ 此后不再尝试。`error` 点名决定文件,`wayOut` 是手工恢复句。 */
87
- | {
88
- readonly kind: "failed";
89
- readonly errno: string | undefined;
90
- readonly error: string;
91
- readonly wayOut: string;
92
- }
93
- /** 不铸:选举前读到的决定已在(replaced / kept / 读不懂 —— 读不懂的不覆盖;它之后被删也不重铸)/ 目录不管模型面(没有 models.json —— 只有 `ENOENT` 算没有 —— 或坏文件)。
94
- * 判序:决定 → 目录。铸不铸不看 env 表:迁移保的是升级前「管模型面的目录整表顶替 env」这个读法,与 env 声没声明无关。 */
95
- | {
96
- readonly kind: "skipped";
97
- readonly why: "decision_present" | "not_managing";
98
- }
99
- /** 不铸,且要运维动手:决定缺席,而 models.json 读不出(`EACCES` / `EIO` / `ESTALE` / 悬空符号链接 / 不是常规文件 …)—— 管不管判不了,不替人铸(fail-closed)。
100
- * 运行记录已在 ⇒ 此后不再尝试:与 `failed` 同一出路(`wayOut`,手写决定文件);`error` 点名 models.json 与读错,`errno` 只在底层错误带码时有
101
- * (悬空链接 / 不是常规文件 ⇒ `undefined`),调用方告警。 */
102
- | {
103
- readonly kind: "models_unreadable";
104
- readonly errno: string | undefined;
105
- readonly error: string;
106
- readonly wayOut: string;
107
- };
108
- /**
109
- * **一次性迁移 SS-M11**(登记见 `ONE_TIME_MIGRATIONS`;起服、第一次读本地配置之前调,只在配置源是本地时):
110
- * 1. 读运行记录:`present` ⇒ `already_ran`;读不懂 ⇒ `marker_unreadable`(按已跑处理)。
111
- * 2. **先读**:决定 D0 = `readEnvModelsDecision`,M0 = `config.d/models.json` 管不管模型面(管 / 不管 / 读不出)。此后的铸只按 D0 / M0 决定,不再读决定 ——
112
- * D0 是 replaced(预置)而它在选举之后被删 ⇒ 不重铸;D0 是 absent 而选举之后有人写了决定 ⇒ 第 5 步的独占创建守住它。
113
- * 3. 根缺席 ⇒ 建(仅属主可进,连同缺的上级,模式恰是 0o700);**不建 `config.d`**。
114
- * 4. **独占创建运行记录** `{"migration":"SS-M11"}`:建成 ⇒ 本进程是本根**唯一的铸造者**;已在(`EEXIST`)⇒ `not_minter`,永不铸;别的失败 ⇒ `marker_write_failed`,不铸。
115
- * 5. 仅铸造者:D0 不是 `absent` ⇒ 不铸(读不懂的也不覆盖);M0 不管 ⇒ 不铸;M0 读不出 ⇒ 不铸(`models_unreadable`,带 errno(若有)与手工恢复句);否则**独占创建** `{"envModels":"replaced"}` —— 结局三词:`minted` / `exists`(只有 `EEXIST`)/
116
- * `failed`(带 errno 与手工恢复句)。铸不铸不看 env;env 只在铸成之后读一次、只读两槽,用来点名被顶替的 env 模型。
117
- * 运行记录在场之后,确认缺席 ≡ kept(读这份决定的一律这么读:服务端的本地配置腿、迁移、写者)。
118
- * 撤销的终局按运行记录的创建者算:只有创建者能写确认;以运行记录在场为前提,创建者写完 / 判定不写 / 失败(结局 `minted` / `exists` / `skipped` / `models_unreadable` / `failed`,调用方各记一行)之后,删掉决定文件就是撤销且是终局(删掉运行记录再起服 ⇒ 迁移重跑,决定缺席即重铸);其它副本读到记录在场 = 已跑、跳过(或得 `EEXIST` 答 `not_minter`),它们的返回不构成终局;创建者当选到结局落定之间的窗口在挂起 / I/O 卡顿下无上界,窗口内唯一安全的撤销是写 `kept`(独占创建护住它;删掉的会被创建者照它先读的 D0 铸回);创建者在写确认之前崩溃 ⇒ 永久 `kept`(fail-closed,披露)。
119
- */
120
- export declare function migrateEnvModelsDecision(input: {
121
- readonly root: string;
122
- readonly env: EnvSnapshot;
123
- readonly io?: ConfigRootIo;
124
- }): Promise<EnvModelsMigration>;
@@ -1,39 +1,34 @@
1
1
  /**
2
- * 配置根两份根级文档的**读写函数**与一次性迁移 SS-M11 的迁移体(Node 专用,经 `./node` 出口;名字、形与闭集答案表在 `./config-root-documents`)。
2
+ * 配置根上决定文档的**读写函数**(Node 专用,经 `./node` 出口;名字、形与闭集答案表在 `./config-root-documents`)。
3
+ * (35.0.0 起这里没有迁移体:一次性迁移 SS-M11 与它的运行记录读者窗关删了,决定缺席 ≡ `kept`。)
3
4
  *
4
5
  * 读写都经一只注入的 I/O 座 {@link ConfigRootIo}(真绑定 {@link nodeConfigRootIo}:读走 `node:fs/promises`,写走本包唯一的原子写器与它的模式表),
5
6
  * 所以单元层能把任意读写失败造出来;调用方不传就是真文件系统。
6
7
  *
7
- * · {@link readEnvModelsDecision} / {@link readMigrationMarker} —— 唯一的读者:不存在(`ENOENT`)⇒ `absent`;别的读错(权限 —— 可信属主的 0000 文件过得了引擎的目录信任判官、
8
- * 读恒 `EACCES`,是**持久**的 —— 不是常规文件、悬空符号链接、瞬时错)⇒ `unreadable io`;字节在 ⇒ 文本读法(`./config-root-documents`;决定的答案带同一次读的 `digest`)。
9
- * 读数从不抛(`readMigrationMarker` 只对不写运行记录的 id 抛 `TypeError` —— 调用方的错,不拿它拼路径)。**引擎在读之前先过它自己的目录信任判官**(属主 / 写位 / 常规文件);
8
+ * · {@link readEnvModelsDecision} —— 唯一的读者:不存在(`ENOENT`)⇒ `absent`;别的读错(权限 —— 可信属主的 0000 文件过得了引擎的目录信任判官、
9
+ * 读恒 `EACCES`,是**持久**的 —— 不是常规文件、悬空符号链接、瞬时错)⇒ `unreadable io`;字节在 ⇒ 文本读法(`./config-root-documents`;答案带同一次读的 `digest`)。
10
+ * 读数从不抛。**引擎在读之前先过它自己的目录信任判官**(属主 / 写位 / 常规文件);
10
11
  * 本函数不判属主。确认文件的字节只在这里被打开。
11
12
  * · {@link readEnvModelsDecisionSync} / {@link writeEnvModelsDecisionSync} —— 决定文档读 / 写的**同步孪生**(壳在同步具名锁里写模型池:先写决定 `replaced`、再写目录,两次写在同一把锁里 —— 要在锁里读、在锁里写):
12
13
  * 同一个字节读法、同一个缺席律、同一份答案表、同一份写计划、同一对同步原子写原语(异步座的写本来就是它们的异步包装);读写真文件系统,不收注入座(注入座是异步的,`ConfigRootIo` 不动)。
13
- * · {@link writeEnvModelsDecision} —— 决定文件的唯一写函数(迁移铸确认也经它):写者(用户确认之后)用 `overwrite`(原子改名覆盖,读不懂的旧文件整份换掉);
14
- * `createIfAbsent` 不存在才建(已在 ⇒ `present`;迁移铸确认用的就是这一种)。运行记录不经它 —— 由迁移独占创建。
14
+ * · {@link writeEnvModelsDecision} —— 决定文件的唯一写函数:写者(用户确认之后)用 `overwrite`(原子改名覆盖,读不懂的旧文件整份换掉);
15
+ * `createIfAbsent` 不存在才建(已在 ⇒ `present`)。
15
16
  * 模式与 `config.d` 域文档同一条规则(原子写器的 `config-document` 类:新建 0o644 经进程 umask、更严的 umask 只会更严;已有的文件沿用它原来的模式)—— 写者不要自己写这份文件:
16
17
  * 自写在 umask 002 下落 0664,引擎的目录信任判官会拒。
17
- * · {@link migrateEnvModelsDecision} —— SS-M11(窗与删法见 `ONE_TIME_MIGRATIONS` 登记表那一行)。**先读后选举**:先读决定与 models.json,再以「不存在才建」写
18
- * 运行记录 `config.migration.SS-M11.json` —— 建成的那个进程是本根唯一的铸造者,且只按它选举之前读到的决定铸;别的进程见记录已在即停、永不铸。
19
- * 撤销的终局按创建者算(见 {@link migrateEnvModelsDecision}):运行记录在场、创建者的结局落定之后,删掉决定文件与写 `kept` 同义、是终局(删掉运行记录再起服会重跑迁移);其它副本的返回不构成终局。
20
18
  */
21
19
  import { readFileSync, statSync } from "node:fs";
22
20
  import { readFile, stat } from "node:fs/promises";
23
21
  import path from "node:path";
24
- import { createFileExclusive, ensureOwnerOnlyDirectory, resolveSymlinkTarget, writeFileAtomic } from "./atomic-write.js";
25
- import { catalogManagesModelPlane } from "./catalog-manages.js";
26
- import { configDDocumentText, configDPath, judgeConfigDText } from "./config-d-file.js";
27
- import { ENV_MODELS_DECISIONS, ENV_MODELS_DOCUMENT, decodeRootBytes, ioDecision, isDecisionWord, isMarkedMigrationId, migrationMarkerDocument, migrationMarkerValue, readEnvModelsDecisionBytes, readMigrationMarkerBytes, } from "./config-root-documents.js";
28
- import { ENV_MODEL_TABLE_KEYS, buildEnvModelBaseline, snapshotEnvModelTable } from "./env-model-table.js";
29
- import { FsFailure, fsFailureMessage } from "./fs-failure.js";
22
+ import { createFileExclusive, resolveSymlinkTarget, writeFileAtomic } from "./atomic-write.js";
23
+ import { configDDocumentText } from "./config-d-file.js";
24
+ import { ENV_MODELS_DECISIONS, ENV_MODELS_DOCUMENT, ioDecision, isDecisionWord, readEnvModelsDecisionBytes, } from "./config-root-documents.js";
25
+ import { FsFailure } from "./fs-failure.js";
30
26
  import { readKey } from "./own-key-read.js";
31
27
  import { jsonShapeOf } from "./plain-json-object.js";
32
28
  import { deepFreeze } from "./deep-freeze.js";
33
- /** 根级文档 → 原子写器的模式类(穷举:加一份根级文档不补这一行 ⇒ 编译红,逼着为它选一类)。两份现有的根级文档都是契约文档(只带固定词,不带秘密值),与 `config.d` 域文档同属 `config-document`。 */
29
+ /** 根级文档 → 原子写器的模式类(穷举:加一份根级文档不补这一行 ⇒ 编译红,逼着为它选一类)。决定文档是契约文档(只带固定词,不带秘密值),与 `config.d` 域文档同属 `config-document`。 */
34
30
  const ROOT_DOCUMENT_CLASS = {
35
31
  [ENV_MODELS_DOCUMENT]: "config-document",
36
- [migrationMarkerDocument("SS-M11")]: "config-document",
37
32
  };
38
33
  /** 「不是常规文件」的拒句(异步读座与同步读口共用一句)。 */
39
34
  const notRegularFile = (file) => new Error(`${file} is not a regular file`);
@@ -52,7 +47,6 @@ export const nodeConfigRootIo = deepFreeze({
52
47
  },
53
48
  writeDocument: async (document, file, text) => writeRootDocumentSync(document, file, text),
54
49
  createDocument: async (document, file, text) => createRootDocumentSync(document, file, text),
55
- ensureDirectory: async (dir) => ensureOwnerOnlyDirectory(dir),
56
50
  });
57
51
  /** {@link nodeConfigRootIo}`.readFile` 的同步孪生(同步读口 {@link readEnvModelsDecisionSync} 用):同一条判法(符号链接 ⇒ 真文件,悬空抛;只读常规文件),只有读字节那一步同步。 */
58
52
  function readRootFileSync(file) {
@@ -62,7 +56,6 @@ function readRootFileSync(file) {
62
56
  return readFileSync(real);
63
57
  }
64
58
  const decisionFile = (root) => path.join(root, `${ENV_MODELS_DOCUMENT}.json`);
65
- const markerFile = (root, id) => path.join(root, `${migrationMarkerDocument(id)}.json`);
66
59
  /** 一个被抛出的东西的 errno:**只认自有的**字符串 `code`(经内核的键读法);读不出(会抛的 `code` getter、已撤销的 Proxy)、只靠继承、不是串 ⇒ `undefined`。从不抛(读者「从不抛」靠它)。 */
67
60
  const errnoOf = (e) => {
68
61
  const shape = jsonShapeOf(e); // 形状只问座位(总、不抛);穷举 switch:座位加一个词这里编译红
@@ -83,10 +76,10 @@ const errnoOf = (e) => {
83
76
  }
84
77
  }
85
78
  };
86
- /** 读字节失败之后怎么答 —— 本文件唯一的缺席律(异步 {@link readRootBytes} 与同步 {@link readRootBytesSync} 共用):不存在(只有 `ENOENT`)⇒ `absent`;别的读不出 ⇒ `io`(带 errno 与捕获的错,调用方要句子时据它铸)。 */
79
+ /** 读字节失败之后怎么答 —— 本文件唯一的缺席律(异步 {@link readRootBytes} 与同步 {@link readRootBytesSync} 共用):不存在(只有 `ENOENT`)⇒ `absent`;别的读不出 ⇒ `io`(带 errno;决定读数只要 errno —— 35.0.0 前还带捕获的错,给 SS-M11 读 models.json 时铸句用,随它删)。 */
87
80
  function rootBytesFailure(e) {
88
81
  const errno = errnoOf(e);
89
- return errno === "ENOENT" ? { kind: "absent" } : { kind: "io", errno, cause: e };
82
+ return errno === "ENOENT" ? { kind: "absent" } : { kind: "io", errno };
90
83
  }
91
84
  /** 经注入座读一份文件的字节(异步);失败的分类是 {@link rootBytesFailure}。 */
92
85
  async function readRootBytes(io, file) {
@@ -129,28 +122,6 @@ export async function readEnvModelsDecision(root, io = nodeConfigRootIo) {
129
122
  export function readEnvModelsDecisionSync(root) {
130
123
  return decisionOfBytes(readRootBytesSync(decisionFile(root)));
131
124
  }
132
- /**
133
- * 一条一次性迁移的运行记录的**唯一读者**(文件 `<根>/config.migration.<id>.json`):不存在 ⇒ `absent`;`{"migration":<id>}` ⇒ `present`;别的 ⇒ `unreadable`
134
- * (坏 JSON / 坏形 —— id 对不上也算 / 读不出)。「跑过」只问这一份文件在不在、读不读得懂,不读任何聚合文件。读数从不抛;`id` 不是写运行记录的迁移(根级文档名单里没有它的记录)⇒
135
- * `TypeError`,不拿它拼路径。
136
- */
137
- export async function readMigrationMarker(root, id, io = nodeConfigRootIo) {
138
- if (!isMarkedMigrationId(id))
139
- throw new TypeError(`readMigrationMarker: ${JSON.stringify(id)} is not a migration that writes a run marker (the root documents list it) — no path is built from it`);
140
- const bytes = await readRootBytes(io, markerFile(root, id));
141
- switch (bytes.kind) {
142
- case "absent":
143
- return { kind: "absent" };
144
- case "io":
145
- return { kind: "unreadable", reason: "io" };
146
- case "bytes":
147
- return readMigrationMarkerBytes(id, bytes.bytes);
148
- default: {
149
- const unhandled = bytes;
150
- throw new Error(`readMigrationMarker: unhandled reading ${JSON.stringify(unhandled)}`);
151
- }
152
- }
153
- }
154
125
  /** 写决定的**计划**(异步 {@link writeEnvModelsDecision} 与同步 {@link writeEnvModelsDecisionSync} 共用,三件事只在这里):决定词与写法都在闭集里(不在 ⇒ `TypeError`,调用方的错,一字不写)· 铸文本 · 写失败 ⇒ 本包的文件系统失败句(点名路径)。
155
126
  * `who` 只用来在 `TypeError` 里点名调用的是哪一只。 */
156
127
  function planDecisionWrite(who, root, decision, opts) {
@@ -175,7 +146,7 @@ function planDecisionWrite(who, root, decision, opts) {
175
146
  return { write, file, text, loud };
176
147
  }
177
148
  /**
178
- * 写配置根上的 env 模型表决定 —— 决定文件的**唯一写函数**(迁移铸确认也经它的 `createIfAbsent`;运行记录不归它,见文件头)。`overwrite` 恒答 `written`;`createIfAbsent` 在文档已在(`EEXIST`)时答 `present`(一字不动)。
149
+ * 写配置根上的 env 模型表决定 —— 决定文件的**唯一写函数**。`overwrite` 恒答 `written`;`createIfAbsent` 在文档已在(`EEXIST`)时答 `present`(一字不动)。
179
150
  * 决定词 / 写法不在闭集 ⇒ `TypeError`(一字不写)。写失败 ⇒ 抛本包的文件系统失败句(点名路径)。根须已存在。
180
151
  */
181
152
  export async function writeEnvModelsDecision(root, decision, opts, io = nodeConfigRootIo) {
@@ -223,122 +194,3 @@ export function writeEnvModelsDecisionSync(root, decision, opts) {
223
194
  }
224
195
  }
225
196
  }
226
- /** 手工恢复句(迁移建不成收据 / 建不成决定时随结局交出;调用方原样放进它那一行告警):点名决定文件与两种写法。 */
227
- const wayOutFor = (root) => `write ${decisionFile(root)} by hand — {"envModels":"replaced"} lets the catalog replace the env models, {"envModels":"kept"} keeps them`;
228
- /** 读 `config.d/models.json` 一次(字节经 {@link readRootBytes} —— 与两份根级文档同一条缺席律;文本过 `config.d` 文档的那一只文本判 —— 与文件仓库同一读法):
229
- * 缺席 / 坏文件 ⇒ 不管;别的读错 ⇒ 读不出(不折成不管)。 */
230
- async function readModelsDocument(io, root) {
231
- const file = configDPath(root, "models");
232
- const read = await readRootBytes(io, file);
233
- let bytes;
234
- switch (read.kind) {
235
- case "absent":
236
- return { kind: "not_managing" };
237
- case "io":
238
- return { kind: "unreadable", errno: read.errno, error: fsFailureMessage({ landing: "read", path: file, of: "file" }, read.cause) };
239
- case "bytes":
240
- bytes = read.bytes;
241
- break;
242
- default: {
243
- const unhandled = read;
244
- throw new Error(`readModelsDocument: unhandled reading ${JSON.stringify(unhandled)}`);
245
- }
246
- }
247
- let doc;
248
- try {
249
- doc = judgeConfigDText("models", decodeRootBytes(bytes), file);
250
- }
251
- catch {
252
- return { kind: "not_managing" }; // a bad file manages nothing; the file store refuses it loudly on its own read
253
- }
254
- return catalogManagesModelPlane(doc) ? { kind: "manages" } : { kind: "not_managing" }; // JSON 解析出来的值恒是纯数据:判官不会抛
255
- }
256
- /**
257
- * **一次性迁移 SS-M11**(登记见 `ONE_TIME_MIGRATIONS`;起服、第一次读本地配置之前调,只在配置源是本地时):
258
- * 1. 读运行记录:`present` ⇒ `already_ran`;读不懂 ⇒ `marker_unreadable`(按已跑处理)。
259
- * 2. **先读**:决定 D0 = `readEnvModelsDecision`,M0 = `config.d/models.json` 管不管模型面(管 / 不管 / 读不出)。此后的铸只按 D0 / M0 决定,不再读决定 ——
260
- * D0 是 replaced(预置)而它在选举之后被删 ⇒ 不重铸;D0 是 absent 而选举之后有人写了决定 ⇒ 第 5 步的独占创建守住它。
261
- * 3. 根缺席 ⇒ 建(仅属主可进,连同缺的上级,模式恰是 0o700);**不建 `config.d`**。
262
- * 4. **独占创建运行记录** `{"migration":"SS-M11"}`:建成 ⇒ 本进程是本根**唯一的铸造者**;已在(`EEXIST`)⇒ `not_minter`,永不铸;别的失败 ⇒ `marker_write_failed`,不铸。
263
- * 5. 仅铸造者:D0 不是 `absent` ⇒ 不铸(读不懂的也不覆盖);M0 不管 ⇒ 不铸;M0 读不出 ⇒ 不铸(`models_unreadable`,带 errno(若有)与手工恢复句);否则**独占创建** `{"envModels":"replaced"}` —— 结局三词:`minted` / `exists`(只有 `EEXIST`)/
264
- * `failed`(带 errno 与手工恢复句)。铸不铸不看 env;env 只在铸成之后读一次、只读两槽,用来点名被顶替的 env 模型。
265
- * 运行记录在场之后,确认缺席 ≡ kept(读这份决定的一律这么读:服务端的本地配置腿、迁移、写者)。
266
- * 撤销的终局按运行记录的创建者算:只有创建者能写确认;以运行记录在场为前提,创建者写完 / 判定不写 / 失败(结局 `minted` / `exists` / `skipped` / `models_unreadable` / `failed`,调用方各记一行)之后,删掉决定文件就是撤销且是终局(删掉运行记录再起服 ⇒ 迁移重跑,决定缺席即重铸);其它副本读到记录在场 = 已跑、跳过(或得 `EEXIST` 答 `not_minter`),它们的返回不构成终局;创建者当选到结局落定之间的窗口在挂起 / I/O 卡顿下无上界,窗口内唯一安全的撤销是写 `kept`(独占创建护住它;删掉的会被创建者照它先读的 D0 铸回);创建者在写确认之前崩溃 ⇒ 永久 `kept`(fail-closed,披露)。
267
- */
268
- export async function migrateEnvModelsDecision(input) {
269
- const { root, env } = input;
270
- const io = input.io ?? nodeConfigRootIo;
271
- const marker = await readMigrationMarker(root, "SS-M11", io);
272
- switch (marker.kind) {
273
- case "present":
274
- return { kind: "already_ran" };
275
- case "unreadable":
276
- return { kind: "marker_unreadable", reason: marker.reason };
277
- case "absent":
278
- break;
279
- default: {
280
- const unhandled = marker;
281
- throw new Error(`migrateEnvModelsDecision: unhandled marker ${JSON.stringify(unhandled)}`);
282
- }
283
- }
284
- const decision = await readEnvModelsDecision(root, io);
285
- const models = await readModelsDocument(io, root);
286
- const file = markerFile(root, "SS-M11");
287
- let createdRoot;
288
- let created;
289
- try {
290
- // 一次操作一条路径串:建的目录是随后要写的那份文件的路径串的 dirname(原子写器的文件头「一次操作一条路径串」)—— 配置根下的文件一向是 `path.join(根, 文件名)`
291
- createdRoot = (await io.ensureDirectory(path.dirname(file))) === "created";
292
- created = await io.createDocument(migrationMarkerDocument("SS-M11"), file, configDDocumentText(migrationMarkerValue("SS-M11")));
293
- }
294
- catch (e) {
295
- return { kind: "marker_write_failed", errno: errnoOf(e), error: fsFailureMessage({ landing: "write", path: file }, e), wayOut: wayOutFor(root) };
296
- }
297
- if (created === "present")
298
- return { kind: "not_minter" };
299
- return { kind: "recorded", createdRoot, decision, mint: await mintDecision(io, root, env, decision, models) };
300
- }
301
- async function mintDecision(io, root, env, decision, models) {
302
- switch (decision.kind) {
303
- case "absent":
304
- break;
305
- case "replaced":
306
- case "kept":
307
- case "unreadable":
308
- return { kind: "skipped", why: "decision_present" };
309
- default: {
310
- const unhandled = decision;
311
- throw new Error(`migrateEnvModelsDecision: unhandled decision ${JSON.stringify(unhandled)}`);
312
- }
313
- }
314
- switch (models.kind) {
315
- case "manages":
316
- break;
317
- case "not_managing":
318
- return { kind: "skipped", why: "not_managing" };
319
- case "unreadable":
320
- return { kind: "models_unreadable", errno: models.errno, error: models.error, wayOut: wayOutFor(root) };
321
- default: {
322
- const unhandled = models;
323
- throw new Error(`migrateEnvModelsDecision: unhandled models reading ${JSON.stringify(unhandled)}`);
324
- }
325
- }
326
- let wrote;
327
- try {
328
- wrote = await writeEnvModelsDecision(root, "replaced", { write: "createIfAbsent" }, io);
329
- }
330
- catch (e) {
331
- // the write function throws only its file-system failure (it names the decision file and carries the errno)
332
- return { kind: "failed", errno: errnoOf(e), error: fsFailureMessage({ landing: "write", path: decisionFile(root) }, e), wayOut: wayOutFor(root) };
333
- }
334
- if (wrote === "present")
335
- return { kind: "exists" };
336
- // env is read only now, once, and only the two slot keys: it names the env models the minted decision replaces (none when no table is declared);
337
- // a run that stops earlier reads no env at all
338
- const slots = snapshotEnvModelTable(env, [ENV_MODEL_TABLE_KEYS.mainId, ENV_MODEL_TABLE_KEYS.cheapId]);
339
- return {
340
- kind: "minted",
341
- receipt: { migration: "SS-M11", document: ENV_MODELS_DOCUMENT, path: ["envModels"], appliedAs: "minted" },
342
- replacedEnvModels: buildEnvModelBaseline(slots).entries,
343
- };
344
- }
@@ -124,7 +124,7 @@ export function findSecretLeaks(warnings, secrets) {
124
124
  const hay = warnings.map((w) => `${stableKey(projectWarning(w))}${JOINER}${stableKey(fieldsBesideError(w))}${JOINER}${errorText(w)}`).join(JOINER);
125
125
  return secrets.filter((s) => s.length > 0 && hay.includes(s));
126
126
  }
127
- /** 一条告警除 `error` 外的**每一只**键(扫描用,不是投影):投影只留比对用的键(每臂声明的诊断键不进投影 —— `domain-defaulted` 的 `path` / `identity` / `reasonCode` / `unknownKeys` / `truncatedFrom`、`entry-dropped` 的 `unknownKeys` / `truncatedFrom`;见 `WarningProjection`),
127
+ /** 一条告警除 `error` 外的**每一只**键(扫描用,不是投影):投影只留比对用的键(每臂声明的诊断键不进投影 —— `domain-defaulted` 的 `path` / `identity` / `reasonCode` / `unknownKeys` / `truncatedFrom` / `registrationProblems`、`entry-dropped` 的 `unknownKeys` / `truncatedFrom` / `registrationProblems`;见 `WarningProjection`),
128
128
  * 扫描却要看告警带出门的一切 —— 每个 kind 同一个读法,新加的键不会因为不在投影里就躲过扫描。 */
129
129
  function fieldsBesideError(w) {
130
130
  return Object.fromEntries(Object.entries(w).filter(([k]) => k !== "error")); // fromEntries(不是逐键赋值):键名不走原型 setter
@@ -29,10 +29,10 @@ export type EnvCheapSlot = {
29
29
  /** cheap 槽铸出来的 id(不铸 ⇒ `undefined`)。 */
30
30
  export declare function mintedCheapId(slot: EnvCheapSlot): string | undefined;
31
31
  /**
32
- * 包内(不进包根):把 env 模型表的键(缺省四把;调用方只要两槽时只拍两把)**读一次**进一份快照(下标读,同「读到即算」)。计划助手与一次性迁移在**要用的那一刻**拍、
33
- * 此后的每个读法都答自同一份 —— 一只 getter 两次读答两个值时,判「env 表已声明」与列 env 模型不会各读到一个(那样结局与回执自相矛盾);用不到的键不读。
32
+ * 包内(不进包根):把 env 模型表的四把键**读一次**进一份快照(下标读,同「读到即算」)。计划助手在**要用的那一刻**拍、
33
+ * 此后的每个读法都答自同一份 —— 一只 getter 两次读答两个值时,判「env 表已声明」与列 env 模型不会各读到一个(那样结局与回执自相矛盾);表外的键不读。
34
34
  */
35
- export declare function snapshotEnvModelTable(env: EnvSnapshot, keys?: readonly EnvModelTableKey[]): EnvSnapshot;
35
+ export declare function snapshotEnvModelTable(env: EnvSnapshot): EnvSnapshot;
36
36
  /** env 两槽的**唯一读口**(见文件头)。`mainId` = `MODEL_ID`(空串 = 没有主槽)。 */
37
37
  export declare function readEnvModelSlots(env: EnvSnapshot): {
38
38
  readonly mainId: string;
@@ -5,7 +5,7 @@
5
5
  * ## 律
6
6
  * · **env 两槽只在这里读一次**({@link readEnvModelSlots}):`MODEL_ID` 缺席或空串 = 没有主槽(纯空白算在场 —— 与引擎的 env 路由读口同尺);
7
7
  * cheap 槽四态({@link EnvCheapSlot})。「env 模型表已声明」({@link envModelTableDeclared})与角色底({@link buildEnvModelBaseline})都由它派生 ——
8
- * 这道闸的执行方(服务端的本地配置腿)与写者的计划助手调同一份(一次性迁移 SS-M11 只用两槽点名被顶替的 env 模型,铸不铸不看它),不各写一份。env 快照按「读到即算」(下标读;原型分层的快照里继承来的键算在场)。
8
+ * 这道闸的执行方(服务端的本地配置腿)与写者的计划助手调同一份,不各写一份。env 快照按「读到即算」(下标读;原型分层的快照里继承来的键算在场)。
9
9
  * 引擎另有「名册占位 ⇒ env 表算空」一格,那是引擎自己的部署事实,不在本包。
10
10
  * · **计划助手判序**({@link planEnvModelTableWrite}):目标腿不读 `config.d`(remote / none)⇒ 照写 → 候选不管模型面 ⇒ 照写 →
11
11
  * env 表未声明 ⇒ 照写、**不写确认** → 配置根的决定是 `replaced` ⇒ 照写 →
@@ -47,12 +47,12 @@ export function mintedCheapId(slot) {
47
47
  }
48
48
  }
49
49
  /**
50
- * 包内(不进包根):把 env 模型表的键(缺省四把;调用方只要两槽时只拍两把)**读一次**进一份快照(下标读,同「读到即算」)。计划助手与一次性迁移在**要用的那一刻**拍、
51
- * 此后的每个读法都答自同一份 —— 一只 getter 两次读答两个值时,判「env 表已声明」与列 env 模型不会各读到一个(那样结局与回执自相矛盾);用不到的键不读。
50
+ * 包内(不进包根):把 env 模型表的四把键**读一次**进一份快照(下标读,同「读到即算」)。计划助手在**要用的那一刻**拍、
51
+ * 此后的每个读法都答自同一份 —— 一只 getter 两次读答两个值时,判「env 表已声明」与列 env 模型不会各读到一个(那样结局与回执自相矛盾);表外的键不读。
52
52
  */
53
- export function snapshotEnvModelTable(env, keys = Object.values(ENV_MODEL_TABLE_KEYS)) {
53
+ export function snapshotEnvModelTable(env) {
54
54
  const snapshot = isolatedObject(); // the package's copy container (no inherited members to read)
55
- for (const key of keys)
55
+ for (const key of Object.values(ENV_MODEL_TABLE_KEYS))
56
56
  Object.defineProperty(snapshot, key, dataDescriptor(env[key]));
57
57
  return snapshot;
58
58
  }
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@
3
3
  * web-admin, the worker service, and the TOC desktop/CLI.
4
4
  */
5
5
  export * from "./types.js";
6
+ export { A2A_PEER_BOUNDARIES, A2A_PEER_ENTRY_PROBLEMS, A2A_PEER_FINGERPRINT_RE, A2aPeerFingerprint, a2aPeerBoundaryOf, a2aPeerFingerprintDigest, mintA2aPeerFingerprint, pairA2aPeers, type A2aPeerBoundary, type A2aPeerEntryProblem, type A2aPeerFields, type A2aPeerIdentitySource, type A2aPeerPairable, type A2aPeerPairing, } from "./a2a-peer-identity.js";
6
7
  export * from "./execution-lanes.js";
7
8
  export * from "./config-document-refusal.js";
8
9
  export * from "./url-shape.js";
@@ -13,7 +14,7 @@ export * from "./url-credential.js";
13
14
  export * from "./default-model.js";
14
15
  export { catalogManagesModelPlane, enabledEntryCount, isExplicitlyDisabledEntry } from "./catalog-manages.js";
15
16
  export { DEFAULT_MODEL_KEY, ENV_MODEL_TABLE_KEYS, buildEnvModelBaseline, envModelTableDeclared, envModelTableWriteRefusal, mintedCheapId, planEnvModelTableWrite, readEnvModelSlots, type EnvCheapSlot, type EnvModelBaseline, type EnvModelTableEntry, type EnvModelTableKey, type EnvModelTableLanding, type EnvModelTableReceipt, type EnvModelTableRoleRow, type EnvModelTableTarget, type EnvModelTableWriteInput, type EnvModelTableWriteIntent, type EnvModelTableWritePlan, type EnvRoleBinding, type EnvSnapshot, } from "./env-model-table.js";
16
- export { CONFIG_ROOT_DOCUMENTS, ENV_MODELS_DECISIONS, ENV_MODELS_DOCUMENT, ROOT_DOCUMENT_UNREADABLE_REASONS, envModelsDecisionTag, type ConfigRootDocument, type EnvModelsDecision, type EnvModelsDecisionWord, type MarkedMigrationId, type MigrationMarker, type RootDocumentUnreadableReason } from "./config-root-documents.js";
17
+ export { CONFIG_ROOT_DOCUMENTS, ENV_MODELS_DECISIONS, ENV_MODELS_DOCUMENT, ROOT_DOCUMENT_UNREADABLE_REASONS, envModelsDecisionTag, type ConfigRootDocument, type EnvModelsDecision, type EnvModelsDecisionWord, type RootDocumentUnreadableReason } from "./config-root-documents.js";
17
18
  export * from "./loopback.js";
18
19
  export * from "./hash.js";
19
20
  export * from "./sha256.js";
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@
3
3
  * web-admin, the worker service, and the TOC desktop/CLI.
4
4
  */
5
5
  export * from "./types.js";
6
+ export { A2A_PEER_BOUNDARIES, A2A_PEER_ENTRY_PROBLEMS, A2A_PEER_FINGERPRINT_RE, A2aPeerFingerprint, a2aPeerBoundaryOf, a2aPeerFingerprintDigest, mintA2aPeerFingerprint, pairA2aPeers, } from "./a2a-peer-identity.js"; // (named: the entry judge, its member table and the issue-word reading stay package-private — A2aPeerSpec is the one place an entry is judged): the a2a peer's identity and registration — boundary words A2A_PEER_BOUNDARIES + their one reading a2aPeerBoundaryOf (absent = outside); the entry-problem closed set A2A_PEER_ENTRY_PROBLEMS (the engine primitives' registration words + fingerprint_stale / id_missing); the identity stamp: its one spelling A2A_PEER_FINGERPRINT_RE / A2aPeerFingerprint, the one digest recompute a2aPeerFingerprintDigest, the one mint mintA2aPeerFingerprint (this package mints, everyone else compares); the one pairing of a stored roster with a submitted one pairA2aPeers (id first, then name among the unpaired); Web Crypto random, no node:crypto — pure/browser-safe
6
7
  export * from "./execution-lanes.js"; // 7.0.0 M-R2: the ONE lane / store vocabulary (EXECUTION_LANE_WORDS / EXECUTION_LANES / STORE_BACKENDS / SESSION_BACKENDS / MEMORY_ENGINE_BACKENDS) + THE lane-coordinate blank judge isBlankCoordinate (empty or whitespace-only = absent; the write gate and every consumer ask this one function; whether a key is set, and whether an optional key may be empty, stays the caller's call; the same function object as on the `./execution-lanes` subpath) — a leaf whose only import is the package-private zero-import freezer, pure/browser-safe
7
8
  export * from "./config-document-refusal.js"; // 15.2.0: the typed refusal of one config.d document (CONFIG_DOCUMENT_REFUSAL_REASONS = empty / invalid_json / not_object / io / too_deep / retired_domain; ConfigDocumentRefusal { document, reason, error }; its file-level arm carries an optional ioKind on io refusals — CONFIG_DOCUMENT_IO_KINDS = dangling_symlink / read_error, 31.1.0) — the reading is `FileConfigStore.read()` in ./node; pure/browser-safe
8
9
  export * from "./url-shape.js"; // 11.0.0: THE URL shape judge (httpUrlFlaws / httpUrlRule / isHierarchicalUrl; 16.0.0 + wsUrlFlaws), pure/browser-safe
@@ -13,7 +14,7 @@ export * from "./url-credential.js"; // 14.5.0: THE "does this URL carry a crede
13
14
  export * from "./default-model.js"; // 11.0.0: THE catalog-default resolver (roles.default → active tier ladder → fallback), pure/browser-safe
14
15
  export { catalogManagesModelPlane, enabledEntryCount, isExplicitlyDisabledEntry } from "./catalog-manages.js"; // THE "does this models document manage the model plane" judge (raw half: at least one entry not explicitly disabled) + the log count it is derived from + THE "is this one entry explicitly disabled" predicate they (and every per-entry consumer) read (the three-state `enabled` reading stays package-private), pure/browser-safe
15
16
  export { DEFAULT_MODEL_KEY, ENV_MODEL_TABLE_KEYS, buildEnvModelBaseline, envModelTableDeclared, envModelTableWriteRefusal, mintedCheapId, planEnvModelTableWrite, readEnvModelSlots, } from "./env-model-table.js"; // the env model table (MODEL_ID / MODEL_CHEAP_ID) read once: readEnvModelSlots / envModelTableDeclared / buildEnvModelBaseline + the writer's plan planEnvModelTableWrite (receipt by id, confirmKey) + envModelTableWriteRefusal, pure/browser-safe (named: the env snapshot helper stays package-private)
16
- export { CONFIG_ROOT_DOCUMENTS, ENV_MODELS_DECISIONS, ENV_MODELS_DOCUMENT, ROOT_DOCUMENT_UNREADABLE_REASONS, envModelsDecisionTag } from "./config-root-documents.js"; // the config-root documents (config.env-models.json + the per-id migration marker config.migration.<id>.json): names + closed answer tables + the one tagged identity of a decision reading (envModelsDecisionTag); the readers / writer are in ./node
17
+ export { CONFIG_ROOT_DOCUMENTS, ENV_MODELS_DECISIONS, ENV_MODELS_DOCUMENT, ROOT_DOCUMENT_UNREADABLE_REASONS, envModelsDecisionTag } from "./config-root-documents.js"; // the config-root document (config.env-models.json): names + closed answer tables + the one tagged identity of a decision reading (envModelsDecisionTag); the readers / writer are in ./node
17
18
  export * from "./loopback.js"; // 11.0.0: the two「本机」predicates (auth relaxation — narrow / connection routing — wide), pure/browser-safe
18
19
  export * from "./hash.js";
19
20
  export * from "./sha256.js";
@@ -1,27 +1,25 @@
1
1
  /**
2
2
  * 一次性迁移的**收据形**与两张闭集(11.0.0)—— 叶子模块(运行期零依赖;除包内私有的零 import 叶 `./deep-freeze` 外只有型导入),由 `./one-time-migrations` 再导出(不进主桶)。
3
- * 单拆出来只为一件事:读迁移 id 闭集的叶子(墓碑句 `./retired-form`、车道表 `./execution-lane-index`、配置根文档 `./config-root-documents`)
3
+ * 单拆出来只为一件事:读迁移 id 闭集的叶子(墓碑句 `./retired-form`、车道表 `./execution-lane-index`)
4
4
  * 不该为一个型把整套迁移体与域 schema 拉进来。(26.0.0 起调度店的读口不再带收据 —— 它的读时改写到期删了。)
5
5
  */
6
- import type { ENV_MODELS_DOCUMENT } from "./config-root-documents.js";
7
6
  import type { DomainName } from "./types.js";
8
7
  /** 本版登记的一次性迁移 id(闭集;每个 id 在 `ONE_TIME_MIGRATIONS` 登记表里恰一行)。收据只许这些 id。 */
9
- export declare const ONE_TIME_MIGRATION_IDS: readonly ["SS-M11", "SS-M12", "SS-M13", "SS-M14"];
8
+ export declare const ONE_TIME_MIGRATION_IDS: readonly ["SS-M12", "SS-M13", "SS-M14"];
10
9
  export type OneTimeMigrationId = (typeof ONE_TIME_MIGRATION_IDS)[number];
11
10
  /**
12
11
  * 一条收据说迁移**对一个坐标做了什么**(闭集,每词一义):
13
12
  * - `moved` — 值搬到新位(`to`),义不变;
14
13
  * - `rewritten` — 同一坐标上的值换成今天的生效读法(例:15.x worker 行的记忆方言词 `tidb` ⇒ `mysql`);
15
14
  * - `dropped-inert` — 删掉;今天的读法本就不让它生效(例:不声明那条车道的行上的车道键、mcp 条目上从没有读者的 `authForm` / `entryKind`);
16
- * - `refused` — 不改:要改就得替运维猜(或旧文档今天本就读不进);原样留着,读侧照旧响亮拒,`reason` 说为什么;
17
- * - `minted` — 在**缺席处**写下一份新事实(一份部署决定),不改任何已有的值 —— 只有 SS-M11 铸(配置根的 `config.env-models.json`:
18
- * 升级前「管模型面的目录整表顶替 env 模型」的读法,写成 `replaced`;不存在才建)。
15
+ * - `refused` — 不改:要改就得替运维猜(或旧文档今天本就读不进);原样留着,读侧照旧响亮拒,`reason` 说为什么。
16
+ * (35.0.0 起没有 `minted`:唯一铸它的 SS-M11 窗关删了。)
19
17
  */
20
- export declare const MIGRATION_APPLIED_AS: readonly ["moved", "rewritten", "dropped-inert", "refused", "minted"];
18
+ export declare const MIGRATION_APPLIED_AS: readonly ["moved", "rewritten", "dropped-inert", "refused"];
21
19
  export type MigrationAppliedAs = (typeof MIGRATION_APPLIED_AS)[number];
22
- /** 收据指向的那份文档:配置域名,或配置根上的 env 模型表决定(`config.env-models`,SS-M11 铸)。
23
- * (26.0.0 起没有一步给 retired 域 `runtime`、`config.d/remote-exec.json` 或调度店出收据 —— 那三只文档的迁移步到期删了。) */
24
- export type MigrationDocument = DomainName | typeof ENV_MODELS_DOCUMENT;
20
+ /** 收据指向的那份文档:配置域名。
21
+ * (26.0.0 起没有一步给 retired 域 `runtime`、`config.d/remote-exec.json` 或调度店出收据 —— 那三只文档的迁移步到期删了;35.0.0 起也没有给配置根上的 `config.env-models` 的 —— SS-M11 删了。) */
22
+ export type MigrationDocument = DomainName;
25
23
  /** 文档里的段坐标(字符串段 = 对象键,数字段 = 数组下标;与告警坐标同一形)。 */
26
24
  export type MigrationPath = readonly (string | number)[];
27
25
  interface ReceiptBase {
@@ -37,7 +35,7 @@ export type MigrationReceipt = (ReceiptBase & {
37
35
  readonly path: MigrationPath;
38
36
  };
39
37
  }) | (ReceiptBase & {
40
- readonly appliedAs: "rewritten" | "dropped-inert" | "minted";
38
+ readonly appliedAs: "rewritten" | "dropped-inert";
41
39
  }) | (ReceiptBase & {
42
40
  readonly appliedAs: "refused";
43
41
  readonly reason: string;
@@ -1,13 +1,12 @@
1
1
  import { deepFreeze } from "./deep-freeze.js";
2
2
  /** 本版登记的一次性迁移 id(闭集;每个 id 在 `ONE_TIME_MIGRATIONS` 登记表里恰一行)。收据只许这些 id。 */
3
- export const ONE_TIME_MIGRATION_IDS = deepFreeze(["SS-M11", "SS-M12", "SS-M13", "SS-M14"]);
3
+ export const ONE_TIME_MIGRATION_IDS = deepFreeze(["SS-M12", "SS-M13", "SS-M14"]);
4
4
  /**
5
5
  * 一条收据说迁移**对一个坐标做了什么**(闭集,每词一义):
6
6
  * - `moved` — 值搬到新位(`to`),义不变;
7
7
  * - `rewritten` — 同一坐标上的值换成今天的生效读法(例:15.x worker 行的记忆方言词 `tidb` ⇒ `mysql`);
8
8
  * - `dropped-inert` — 删掉;今天的读法本就不让它生效(例:不声明那条车道的行上的车道键、mcp 条目上从没有读者的 `authForm` / `entryKind`);
9
- * - `refused` — 不改:要改就得替运维猜(或旧文档今天本就读不进);原样留着,读侧照旧响亮拒,`reason` 说为什么;
10
- * - `minted` — 在**缺席处**写下一份新事实(一份部署决定),不改任何已有的值 —— 只有 SS-M11 铸(配置根的 `config.env-models.json`:
11
- * 升级前「管模型面的目录整表顶替 env 模型」的读法,写成 `replaced`;不存在才建)。
9
+ * - `refused` — 不改:要改就得替运维猜(或旧文档今天本就读不进);原样留着,读侧照旧响亮拒,`reason` 说为什么。
10
+ * (35.0.0 起没有 `minted`:唯一铸它的 SS-M11 窗关删了。)
12
11
  */
13
- export const MIGRATION_APPLIED_AS = deepFreeze(["moved", "rewritten", "dropped-inert", "refused", "minted"]);
12
+ export const MIGRATION_APPLIED_AS = deepFreeze(["moved", "rewritten", "dropped-inert", "refused"]);
package/dist/node.d.ts CHANGED
@@ -14,6 +14,6 @@ export { tryWebAdminCredentialFileLock, type WebAdminCredentialLockHeld, type We
14
14
  export { migrateConfigDirectory, migrateConfigDocuments, // 14.5.0:同一段「迁 → 整域终判」的同步口(入参是已有的存量文档,无 io)—— 目录形调的就是它的内核
15
15
  type ConfigDirectoryDocument, type ConfigDirectoryIo, type ConfigDirectoryMigration, type ConfigDirectoryRefusal, type ConfigDocumentsMigration, type MigrateConfigDirectoryOptions, type MigrateConfigDocumentsOptions, } from "./config-dir-migration.js";
16
16
  export { nodeConfigDirectoryIo } from "./config-dir-io.js";
17
- export { migrateEnvModelsDecision, nodeConfigRootIo, readEnvModelsDecision, readEnvModelsDecisionSync, // 同步孪生:同一个字节读法 / 缺席律 / 答案表(壳在同步具名锁里写模型池要在锁里读决定)
18
- readMigrationMarker, writeEnvModelsDecision, writeEnvModelsDecisionSync, // 同步孪生:同一份写计划 + 同一对同步原子写原语
19
- type ConfigRootIo, type EnvModelsDecisionWrite, type EnvModelsMigration, type EnvModelsMint, } from "./config-root-node.js";
17
+ export { nodeConfigRootIo, readEnvModelsDecision, readEnvModelsDecisionSync, // 同步孪生:同一个字节读法 / 缺席律 / 答案表(壳在同步具名锁里写模型池要在锁里读决定)
18
+ writeEnvModelsDecision, writeEnvModelsDecisionSync, // 同步孪生:同一份写计划 + 同一对同步原子写原语
19
+ type ConfigRootIo, type EnvModelsDecisionWrite, } from "./config-root-node.js";
package/dist/node.js CHANGED
@@ -17,7 +17,7 @@ export { tryWebAdminCredentialFileLock } from "./atomic-write.js";
17
17
  export { migrateConfigDirectory, migrateConfigDocuments, // 14.5.0:同一段「迁 → 整域终判」的同步口(入参是已有的存量文档,无 io)—— 目录形调的就是它的内核
18
18
  } from "./config-dir-migration.js";
19
19
  export { nodeConfigDirectoryIo } from "./config-dir-io.js"; // 上面那只函数的真 I/O 绑定:node:fs + 本包唯一的原子写器(config-document 模式规则)
20
- // 配置根上的决定文档(config.env-models.json)与按 id 的运行记录(config.migration.<id>.json)的两只读者、决定文档的唯一写函数(运行记录由迁移独占创建;决定文档的读写各有同步孪生),与一次性迁移 SS-M11 的迁移体(名字与闭集答案表在包根)。显式列名。
21
- export { migrateEnvModelsDecision, nodeConfigRootIo, readEnvModelsDecision, readEnvModelsDecisionSync, // 同步孪生:同一个字节读法 / 缺席律 / 答案表(壳在同步具名锁里写模型池要在锁里读决定)
22
- readMigrationMarker, writeEnvModelsDecision, writeEnvModelsDecisionSync, // 同步孪生:同一份写计划 + 同一对同步原子写原语
20
+ // 配置根上的决定文档(config.env-models.json)的唯一读者与唯一写函数(读写各有同步孪生;名字与闭集答案表在包根)。显式列名。
21
+ export { nodeConfigRootIo, readEnvModelsDecision, readEnvModelsDecisionSync, // 同步孪生:同一个字节读法 / 缺席律 / 答案表(壳在同步具名锁里写模型池要在锁里读决定)
22
+ writeEnvModelsDecision, writeEnvModelsDecisionSync, // 同步孪生:同一份写计划 + 同一对同步原子写原语
23
23
  } from "./config-root-node.js";
@@ -8,10 +8,9 @@ export interface OneTimeMigrationWindow {
8
8
  readonly id: OneTimeMigrationId;
9
9
  /** 旧形在读侧的待遇(闭集,每词一义;「读写两面遇旧形一律响亮拒,迁移还在时拒句点名迁移 id、窗关删码后止于今天的位」这条律的例外只在这一格里写):
10
10
  * · `refused` — 读写两面拒,拒句点名本行 id(经 `migrationSignpost` 铸;钉:每个 `refused` 行的 id 在 `src/` 至少一处铸点,
11
- * 且非 `refused` 行零铸点);
12
- * · `read-as-default` — 旧形是一份文档的**缺席**(SS-M11:配置根上没有 `config.env-models.json`),读者按它的缺省读(`kept`),不拒、没有拒句可点名 ——
13
- * 缺省读出来的后果由读者自己的响亮臂说(引擎的模型面组拒句点名出路)。 */
14
- readonly oldForm: "refused" | "read-as-default";
11
+ * 且非 `refused` 行零铸点)。
12
+ * (35.0.0 起只剩这一词:`read-as-default` —— 旧形是一份文档的缺席、读者按缺省读 —— 只给 SS-M11 用过,随它删。再登记一条不拒旧形的迁移,先在这里加回一词并写明它的义。) */
13
+ readonly oldForm: "refused";
15
14
  /** 引入这条迁移的版本。 */
16
15
  readonly introducedIn: string;
17
16
  /** 该版本在 npm 上的发布日(UTC 日历日 YYYY-MM-DD)。`null` = 未发布形,由抬 `package.json` 到 `introducedIn` 的发布准备提交回填。 */