@sema-agent/settings-schema 34.0.0 → 34.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/CHANGELOG.md CHANGED
@@ -8,6 +8,256 @@
8
8
 
9
9
  ## Unreleased
10
10
 
11
+ ## 34.1.0 — 2026-11-25 — minor:凭据平面共享拒答表 `CREDENTIAL_PLANE_REFUSALS`(沙箱 git 拒答表 `SANDBOX_GIT_REFUSALS` 尾插第十一词 `plane_misconfigured`,既有十词的次序与行逐字不变)· 请求面「这只凭据值收不收」的独立判口 `readRequestMcpCredentials`(读器的判法与每一句拒句逐字不变)· 插件设置的三只纯读法 `readEnabledPluginsValue` / `readPluginId` / `PLUGIN_MARKETPLACE_SENTINELS`(新子路径 `./plugin-settings`;名段文法提成同一只常量 `PLUGIN_ID_SEGMENT_REGEX`,行为逐字不变)· web-admin 凭证文件锁的 `unreadable` 臂多可缺的诊断位 `ioKind`(悬空软链答 `unreadable` 是本版有意维持的行为,撤掉「根修后翻成写穿」的许诺)(新导出合计 25 名,见「导出面」;既有导出的判法与读数逐字不变,除「破坏面一览」那张表点名的两处)· 更正:项目登记簿 `archivedAt` 的「归档 / 删除」说明、条目序是契约事实、凭据锁「后续版本设计先行」那半句(见节末「更正与写明」)
12
+
13
+ > 档位(按发版纪律「新键 / 新导出 / 词表加词 = minor」):**minor**,全部加性 —— 新导出(包根 15 名、`./types` 1 名、新子路径 `./plugin-settings` 9 名,见「导出面」)· 新子路径 `./plugin-settings` · 闭集 `SandboxGitRefusalError` / `SANDBOX_GIT_REFUSAL_ERRORS` 尾插一词 `plane_misconfigured` · 一个可缺的可选键 `ioKind`。读器的判法与每一句拒句逐字不变;除闭集尾插的那一词(`SandboxGitCredentialRefusal` 对 `plane_misconfigured` 由拒变收,`SANDBOX_GIT_REFUSALS` / `SANDBOX_GIT_REFUSAL_ERRORS` 各多一行 / 一员)与一个可缺的可选键 `ioKind`(凭据锁 `unreadable` 答多这一键)外,既有输入的读数不变,没有一处校验收紧;名段文法提成常量,同一只正则、同一句拒句、同一路径。**本版没有一件进 major** —— 除上面点名的那两处(`SandboxGitCredentialRefusal` 对新词由拒变收;凭证路径读不成时凭据锁的返回值多 `ioKind`,二者都是发版纪律点名的加性:词表加词 / 可选键)外,会让既有输入读出不同结果的件、删 / 改名既有导出的件,全部排在下一个大版本,不在本版。词表加词对穷举表的消费方是提货成本,不构成 major(发版纪律「新键 / 新导出 / 词表加词 = minor」那一条的留档口径)。
14
+ > 提货面:minor 区间(`^34`)自己就拿得到;本包不验证消费方行为。各消费方的读点见节末「各消费方」。
15
+ > 本版没有新登记的一次性迁移,也没有到期删码的(发布日 2026-11-25;`SS-M11` / `SS-M12` / `SS-M13` / `SS-M14` 的窗都还开着,最早一只 `SS-M11` 的窗到 2026-11-26;窗关之后删码在下一个大版本,不在 minor)。
16
+
17
+ **破坏面一览**(逐件的三问、读数与黑盒判据在各小节;「已存数据」= 已经落盘 / 存下来要续跑的旧形自此读不读得进 —— 本版没有一件让已落盘的内容由读得进变读不进,各小节的「已存数据」栏都是「没有」):本版没有 BREAKING —— 除下面表里点名的两处(新词由拒变收、`unreadable` 答多一个可缺键)外,没有一件让按 34.0.x 写的消费方在运行期读出不同结果,没有一个既有导出被删或被改名。下面这一张表只列**不构成 major、但提货后会让一部分消费方红一次**的两件(按发版纪律「提货成本」逐件点名):
18
+
19
+ | 件 | 什么变了 | 谁会红一次 · 怎么办 |
20
+ |---|---|---|
21
+ | 沙箱 git 拒答表(`SANDBOX_GIT_REFUSALS` / `SANDBOX_GIT_REFUSAL_ERRORS` / `SandboxGitRefusalError`;闭集尾插) | 第十一个词 `plane_misconfigured`(状态 `503`、永久性 `terminal`)尾插;既有十词的次序、状态集与 `permanence` 逐字不变;`SandboxGitCredentialRefusal` 多收这一词的拒体 | 对 `SandboxGitRefusalError` 做穷举 `switch`(以 `never` 收口)的一方编译红一次:补一臂;对它写 `Record<SandboxGitRefusalError, …>` 这类全量映射表的一方同样编译红一次:补一行;对 `SANDBOX_GIT_REFUSAL_ERRORS` / 拒答表的键集按「十个词」逐字比对的钉红一次:改成十一个。没升级的收方对新词的处置见该节「三问」:按本包规则读的收方当畸形应答、按 HTTP 5xx 兜底的收方当暂不可用并退避重试,两种都不取值 —— 所以读方先升、发这个词的一方最后改答 |
22
+ | 凭据锁 `unreadable` 臂(`WebAdminCredentialLockOutcome`) | 多一个可缺键 `ioKind`(只在「解凭证路径」那一步失败时在场;别的 `unreadable` 不带这一键);状态、回调跑不跑、文件副作用与此前逐位同 | 对 `unreadable` 臂的整个结果做深相等的钉(`toEqual` 整对象),在「解凭证路径」失败的那几形上多见一键:按键读,或补这一键;按此前写法实现的 `WebAdminCredentialLockImplementation`(结果里不带这一键)照常合型 |
23
+
24
+ **同版加性,没有人因它红**:请求面凭据值的独立判口 `readRequestMcpCredentials`(包根两个新导出,小节「请求面『这只凭据值收不收』的独立判口」;读器改调它,判法与每一句拒句一字不动)· 插件设置三只纯读法(新子路径 `./plugin-settings` 与包根上同一批对象;名段文法提成常量 `PLUGIN_ID_SEGMENT_REGEX`,`./types` 与包根上是同一只对象,小节「插件设置的三只纯读法」)· 项目登记簿的两句文书(只改类型旁的注释,节末「更正与写明」)。
25
+
26
+ ### 凭据平面共享拒答表 `CREDENTIAL_PLANE_REFUSALS` · 沙箱 git 拒答表尾插 `plane_misconfigured`
27
+
28
+ > 档位(按发版纪律,本块单独算):**minor** —— 新导出三名;闭集尾插一词;既有十词的次序与行逐字不变。
29
+ > 钉:`test/credential-plane-refusals.test.ts`(新);`test/sandbox-git-credential-wire-14.7.0.test.ts` 金样尾插一行。
30
+
31
+ **形**:`CREDENTIAL_PLANE_REFUSALS` 是 `as const` 的字面量表(每行的状态集与 `permanence` 是字面量类型,逐层只读且深冻结);`SANDBOX_GIT_REFUSALS` 既有十行的值与类型不变,多一行 `plane_misconfigured`(状态 `503`、永久性 `"terminal"`,与共享表共用同一行对象)。
32
+
33
+ ```ts
34
+ // CREDENTIAL_PLANE_REFUSALS: `as const` 的字面量表(每行的状态集元组与 `permanence` 均为字面量类型)
35
+ type CredentialPlaneRefusalError =
36
+ | "caller_not_admitted"
37
+ | "incarnation_mismatch"
38
+ | "request_invalid"
39
+ | "principal_not_live"
40
+ | "delegation_required"
41
+ | "vault_disabled"
42
+ | "vault_frozen"
43
+ | "vault_unavailable"
44
+ | "plane_misconfigured";
45
+ const CREDENTIAL_PLANE_REFUSAL_ERRORS: readonly [CredentialPlaneRefusalError, ...CredentialPlaneRefusalError[]];
46
+ type SandboxGitRefusalError =
47
+ | "caller_not_admitted"
48
+ | "scope_mismatch"
49
+ | "incarnation_mismatch"
50
+ | "request_invalid"
51
+ | "principal_not_live"
52
+ | "delegation_required"
53
+ | "vault_disabled"
54
+ | "vault_frozen"
55
+ | "handle_invalid"
56
+ | "vault_unavailable"
57
+ | "plane_misconfigured";
58
+ ```
59
+
60
+ **三问**:
61
+ - **谁需要**:凭据平面的答方要把「配置错」与「暂时不可达」分成两个词;沙箱 git 取值客户端据此不再对配置错做退避重试。
62
+ - **谁受损**:对 `SandboxGitRefusalError` 做穷举 `switch` 的消费方提货时编译红一次(补一臂);对没升级的收方,按本包规则读的收方当畸形应答,按 HTTP 5xx 兜底的收方当暂不可用、退避重试,两种都不取值,升级后才读得到 `terminal`、停止定时重试。
63
+ - **出路 / 补偿**:读方先升、发这个词的一方最后改答;无旋钮。
64
+
65
+ **黑盒判据**:
66
+ - K43:`SANDBOX_GIT_REFUSAL_ERRORS` 前十个词与上一版逐字同序,第十一个是 `plane_misconfigured`。
67
+ - K44:`SandboxGitCredentialRefusal.safeParse({ error: "plane_misconfigured", permanence: "terminal", message: "" })` 成功;`permanence: "transient"` 失败。
68
+ - K45:对共享表里每个词 `SANDBOX_GIT_REFUSALS[w] === CREDENTIAL_PLANE_REFUSALS[w]`。
69
+
70
+ **已存数据**:没有(纯词表)。
71
+
72
+ ### 请求面「这只凭据值收不收」的独立判口 `readRequestMcpCredentials`
73
+
74
+ > 档位(按发版纪律,本块单独算):**minor** —— 新导出两名;读器的判法与每一句拒句逐字不变。
75
+ > 钉:`test/mcp-request-credentials-verdict.test.ts`(新)。
76
+
77
+ **形**:
78
+
79
+ ```ts
80
+ export type RequestMcpCredentialsVerdict =
81
+ | { readonly kind: "absent" }
82
+ | { readonly kind: "taken"; readonly credential: McpRequestCredential }
83
+ | { readonly kind: "refused"; readonly refusal: Extract<McpRequestKeyRefusal, "credentials_not_carried">; readonly reason: string };
84
+
85
+ export function readRequestMcpCredentials(transport: "stdio" | "http", value: unknown): RequestMcpCredentialsVerdict;
86
+ ```
87
+
88
+ **已知的边**:形参 `transport` 的型是闭集 `"stdio" | "http"`,类型内的调用到不了表外词;但运行期传一个表外词(纯 JS 调用方、强制转型)时,判口只判 `=== "stdio"`、其余一律按 http 臂判 —— 对合形的保管库引用答 `taken`,表外词没有被说出来。传输读器只从 stdio / http 两条臂调这只函数,不受影响。下一个大版本改成穷举 `switch`、表外词答 `refused`。本版的钉把现状标成 🚧(`test/mcp-request-credentials-verdict.test.ts` 组 E),那一格在修后翻成 `refused`。
89
+
90
+ **三问**:
91
+ - **谁需要**:只想问「这一个值收不收」、不想为此拼一整条传输的消费方。
92
+ - **谁受损**:无(加导出;读器行为不变)。
93
+ - **出路 / 补偿**:不适用。
94
+
95
+ **黑盒判据**:
96
+ - K46:http + `{ kind: "vault", entry: "e" }` ⇒ `taken`,`credential` 与入参深等但不是同一对象,且冻结。
97
+ - K47:stdio + 同一值 ⇒ `refused`、`refusal === "credentials_not_carried"`,`reason` 与 `readRequestMcpTransport({ kind: "stdio", command: "c", credentials: 同值 })` 的 `issue.reason` 逐字同。
98
+ - K48:`value === undefined` ⇒ `{ kind: "absent" }` 且冻结。
99
+
100
+ **已存数据**:没有。
101
+
102
+ ### 插件设置的三只纯读法:值形 `readEnabledPluginsValue` · id 文法 `readPluginId` · 市场哨兵闭集 `PLUGIN_MARKETPLACE_SENTINELS`(新子路径 `./plugin-settings`;名段文法提成同一只常量 `PLUGIN_ID_SEGMENT_REGEX`)
103
+
104
+ > 档位(按发版纪律,本块单独算):**minor** —— 新导出 + 新子路径;名段文法提成常量,**行为逐字不变**(同一只正则、同一句拒句、同一路径,没有一处校验收紧或放宽)。事实:① 新模块 `src/plugin-settings.ts`:包根与新子路径 `./plugin-settings`(exports 表一条,形同 `./hooks`)上同一批函数对象,运行期导出恰五个 —— `readEnabledPluginsValue` · `ENABLED_PLUGINS_VALUE_KINDS` · `readPluginId` · `PLUGIN_MARKETPLACE_SENTINELS` · `isPluginMarketplaceSentinel`,另有型 `EnabledPluginsValue` · `EnabledPluginsValueKind` · `PluginId` · `PluginMarketplaceSentinel`;② `PluginSource` 的 marketplace 臂与 `PluginSpec.name` 此前各写一遍逐字相同的正则 `/^[a-z0-9][a-z0-9._-]*$/i` 与同一句 `letters/digits/._- , no spaces`,提成一只具名导出 `PLUGIN_ID_SEGMENT_REGEX`(包根与 `./types`),两处与 `readPluginId` ① 形(`<名>@<市场>`)的两半同读它(② 形见「已知的边」),句子提成同处一只不导出的常量;③ 这两件(正则与句子)的定义住在一只**包内私有的零 import 叶**(不是子路径、不进 exports 表、不进包根桶),`./types` 与包根上的 `PLUGIN_ID_SEGMENT_REGEX` 是它的原名转出(同一只对象)—— 所以 `./plugin-settings` 冷载入的静态闭包只有这只叶、读内核与两只零 import 小叶,**不带出 `./types`、不带出 zod**。没有已存数据要迁移,没有新登记的一次性迁移。
105
+ > 钉:`test/plugin-settings.test.ts`(新)· `test/plugin-id-segment-refusals.test.ts`(新;守门:提取名段常量前后,两处对一组坏名的拒句 / 路径 / 条数逐字相同,改前改后同绿)。
106
+
107
+ **病**:共用库、终端的插件创建面要读参照形的 `enabledPlugins` 值与插件 id(`<名>@<市场>`,市场位上有四个哨兵词),契约包里没有任何一只读法 —— `enabledPlugins` / `pluginConfigs` / `extraKnownMarketplaces` 在已发版本的源码里零命中 —— 各宿主只能各写一份,一个事实多个读者各自判。
108
+
109
+ **律(一条)**:三只读法**只读值、不定合并**,名段文法只有一处定义:
110
+ - **`readEnabledPluginsValue(v)`**(`enabledPlugins` 里一个键的值):`true` ⇒ `{ kind: "on" }`;`false` ⇒ `{ kind: "off" }`;字符串数组 ⇒ `{ kind: "versions", constraints }`(`constraints` 是新造的冻结副本,事后改入参不影响答案);其余一切(串 `"true"`、`null`、`undefined`、数、对象、含非串元素的数组、读不出的对象 —— 撤销的 Proxy、访问器下标、稀疏数组)⇒ `{ kind: "unreadable" }`。总(不抛),答案每次新造、深冻;判别词闭集 `ENABLED_PLUGINS_VALUE_KINDS` = `on` / `off` / `versions` / `unreadable`(深冻)。**数组元素不细判**:空数组、空串元素都读成 `versions`,每条串算不算合法的版本约束、空数组算不算启用,是消费方的事 —— 参照的读法在这一层同样只问「是不是字符串数组」(参照的细判未核)。
111
+ - **`readPluginId(v)`**(插件 id,两条文法、**同一只答案形** `{ name, marketplace }`):① `<名>@<市场>` —— **恰一个 `@`**,两半各过名段文法 `PLUGIN_ID_SEGMENT_REGEX`(字母或数字起头,后接字母 / 数字 / `.` / `_` / `-`,不分大小写);② npm 来源 id `@<scope>/<包名>@npm` —— 名 = 整个带 scope 的包名(含开头的 `@` 与 `/`)、市场 = `npm`,包名两段各是**全小写**名段、恰一个 `/`、整串不含 `..`(不带 scope 的 `pkg@npm` 就是 ① 的一例,答案同)。非串 / 两条文法都不过 ⇒ `undefined`(总,不抛;不裁剪、不规范化,`@npm` 区分大小写)。答案新造、深冻。**`<名>@skills-dir` 是合法 id**。
112
+ - **`PLUGIN_MARKETPLACE_SENTINELS`**(深冻闭集,四词,按序):`inline` = 命令行指定目录载入的插件 · `skills-dir` = 技能目录里的插件 · `synced` = 从云端同步来的 · `builtin` = 内置。`isPluginMarketplaceSentinel(v)` 逐字严格相等(区分大小写),非串假。四词来自参照,不加不减。
113
+ - **`PLUGIN_ID_SEGMENT_REGEX`**(`./types` 与包根;定义在包内私有的零 import 叶,原名转出):名段文法的唯一定义;`PluginSpec.name`、`PluginSource` 的 marketplace 臂、`readPluginId` ① 形(`<名>@<市场>`)的两半读的是同一只对象(② 形 npm 来源 id 的包名两段读的是它之上的「全小写名段」判法:同一只正则再加一句「没有大写字母」,见「已知的边」);无 `g` / `y` 标志(同一只对象被共用、被反复 `test`)。
114
+
115
+ **消费方读法(分工,不是新规则)**:中心层 `plugins[].enabled` 是部署层的供给闸,设置层的 `enabledPlugins` 是各设置源每一层各自的开关,**两层怎么组合不在本包本版**(本包不实现、不校验下面这句,也不回答「最终启用与否」)—— 合并读法到货之前,同时读中心 `plugins` 与本机设置文件的宿主**只照中心层答**,不自己拼。托管策略表(`strictKnownMarketplaces` / `blockedMarketplaces`)与它的哨兵臂、`pluginConfigs` / `extraKnownMarketplaces` 的条目形、缺席时的缺省,也不在本版。
116
+
117
+ **已知的边**:① 来源类的市场名(`npm` 及参照里同类的几个:`pip` / `uv` / `cargo` / `github` / `gh`)除上面 npm 来源 id 那一条外,在 `readPluginId` 里就是普通的市场名,不特判、也不在哨兵表里。② 参照自己读 `enabledPlugins` 的键时不因 id 形坏而丢条目,`readPluginId` 比参照读键更严 —— 读不出的 id 怎么处置由宿主定。③ 参照的托管策略表里另有一个同名的 `skills-dir` 策略哨兵(策略来源的种类),不是本表的词,本版不读。④ `readPluginId` 的 ② 形(带 scope 的 npm 来源 id `@<scope>/<包名>@npm`)读出的名(含开头的 `@` 与 `/`)**不是合法的 `PluginSpec.name`**(`PluginSpec.name` 整串过 `PLUGIN_ID_SEGMENT_REGEX`,不收 `@` 与 `/`)—— 中心层的插件条目没有 npm 来源形,这样的 id 只能读出、不能原样写成中心层条目;「这个插件名合不合法」对 ① 形是同一个答案,对 ② 形有两个(读法收、条目名拒),取舍由宿主定。参照读自解出的语料、没有对真实二进制核;「参照读到哪一步」逐只写在各导出的注释里。
118
+
119
+ **形**:
120
+
121
+ ```ts
122
+ const PLUGIN_ID_SEGMENT_REGEX: RegExp; // /^[a-z0-9][a-z0-9._-]*$/i (./types 与包根)
123
+
124
+ // ./plugin-settings 与包根
125
+ const PLUGIN_MARKETPLACE_SENTINELS: readonly ["inline", "skills-dir", "synced", "builtin"];
126
+ type PluginMarketplaceSentinel = "inline" | "skills-dir" | "synced" | "builtin";
127
+ function isPluginMarketplaceSentinel(v: unknown): v is PluginMarketplaceSentinel;
128
+
129
+ interface PluginId { readonly name: string; readonly marketplace: string }
130
+ function readPluginId(v: unknown): PluginId | undefined;
131
+
132
+ const ENABLED_PLUGINS_VALUE_KINDS: readonly ["on", "off", "versions", "unreadable"];
133
+ type EnabledPluginsValueKind = "on" | "off" | "versions" | "unreadable";
134
+ type EnabledPluginsValue =
135
+ | { readonly kind: "on" }
136
+ | { readonly kind: "off" }
137
+ | { readonly kind: "versions"; readonly constraints: readonly string[] }
138
+ | { readonly kind: "unreadable" };
139
+ function readEnabledPluginsValue(v: unknown): EnabledPluginsValue;
140
+ ```
141
+
142
+ **三问**:
143
+ - **谁需要**:共用库、终端的插件创建面 —— 要知道 `enabledPlugins` 一个键的值有哪几种形、插件 id 收不收 `@skills-dir`、市场位上哪几个词是哨兵。
144
+ - **谁受损**:没有人因提货红(新导出、新子路径;名段文法提成常量,同一正则同一句,拒句逐字不变)。本版只给读法,托管策略表那一问延后;宿主若自己拼中心层与设置层,会造出第二个来源 —— 见上面的「消费方读法」。读法不判数组元素:每条约束怎么解释、空数组算不算启用,宿主要自己处置。
145
+ - **出路 / 补偿**:无旋钮(纯读法)。宿主一侧的现行做法:合并读法到货之前只照中心层答;策略哨兵读不出时按拦(共用库现行如此,本包不规定);读不出的值 / id 一律是 `unreadable` / `undefined`,之后怎么处置由宿主定。
146
+
147
+ **已存数据**:没有 —— 三只读法读的是调用方交入的一个值,不读文件、不写任何东西;名段文法提成常量是同一只正则,已落盘的插件名与市场名读得进、读不进的集合一字不变。
148
+
149
+ **黑盒判据**(从公开导出可观察):
150
+ - K49:`readPluginId("foo@skills-dir")` ⇒ `{ name: "foo", marketplace: "skills-dir" }`,`isPluginMarketplaceSentinel("skills-dir") === true`;`readPluginId("@scope/pkg@npm")` ⇒ `{ name: "@scope/pkg", marketplace: "npm" }`;`readPluginId("foo")` / `"foo@"` / `"@m"` / `"a@b@c"` / `"x y@m"` / `"@scope/pkg@official"` / `"@Scope/pkg@npm"` / `7` ⇒ `undefined`;`isPluginMarketplaceSentinel("SKILLS-DIR") === false`;`PLUGIN_MARKETPLACE_SENTINELS` 深等于 `["inline", "skills-dir", "synced", "builtin"]`、深冻结。
151
+ - K50:`readEnabledPluginsValue(true)` ⇒ `{ kind: "on" }`;`(false)` ⇒ `{ kind: "off" }`;`(["^1.2.0", ">=2"])` ⇒ `{ kind: "versions", constraints: ["^1.2.0", ">=2"] }`(冻结副本,不是入参);`("yes")` / `("true")` / `(null)` / `({})` / `([1])` ⇒ `{ kind: "unreadable" }`。
152
+ - K51:`import { readPluginId } from "@sema-agent/settings-schema/plugin-settings"` 与 `import { readPluginId } from "@sema-agent/settings-schema"` 是同一个函数对象(五个运行期导出都如此);`PLUGIN_ID_SEGMENT_REGEX` 在包根与 `@sema-agent/settings-schema/types` 上同一只对象,`PluginSpec` 的坏名与 `PluginSource` 的坏市场名对同一组样本的拒句与改前逐字相同(`letters/digits/._- , no spaces`)。
153
+
154
+ ### web-admin 凭证文件的单写者锁:`unreadable` 臂多可缺的诊断位 `ioKind` · 悬空软链答 `unreadable` 是本版有意维持的行为 · 撤掉「根修后翻成写穿」的许诺
155
+
156
+ > 档位(按发版纪律,本块单独算):**minor** —— 一个可选键;没有任何已有导出被改、删、改名,没有新导出名,线上面(HTTP 键 / 码 / 帧)与凭证信封零变化,状态、回调跑不跑、文件副作用与此前逐位同。按此前写法实现的 `WebAdminCredentialLockImplementation`(结果里不带这一键)照常合型。
157
+ > 钉:`test/web-admin-credential-lock.test.ts`(新一组 `ioKind` 格 + 「已知限制,不翻」四格各加一句断言)· `test/config-document-io-kind-31.1.0.test.ts`(铸点随凭据锁同读挪到 `atomic-write.ts` 的结构钉)。
158
+
159
+ **病**:
160
+ - 经软链放凭据文件、登出(`remove()` 删掉链接指向的真目标)之后再登录,取锁答 `unreadable` —— 失败关闭(不建文件、不写、链接原样),34.0.0 起就是这样,与本包原子写器对悬空链接的拒是同一条律。宿主(终端的登录口)要据「是不是悬空链接」渲出路(删掉悬空链接,或先重建目标),今天只能去解析 `error.message`。
161
+ - 随包文字(原子写器的头注、一致性测试的头注与 `docs/CONFORMANCE.md`、`README.md` 的协议段)与已发的 34.0.0 节,把这一形写成「根修后那一格翻成写穿」「后续版本设计先行」—— 可是本版并不做这件事,文字与行为不符:撤。
162
+
163
+ **律**:悬空软链答 `unreadable`(不建文件、不写)是本版**有意的、维持的**行为,不是待翻的缺陷。本版不解析悬空链接的落点:要做就得改原子写器对悬空链接的拒律(不替链接建它指向的文件),那是另一份设计、按大版本排。出路 = 删掉悬空链接,或先重建目标(凭证路径就是真文件的不受影响)。
164
+
165
+ **形**:
166
+ - `WebAdminCredentialLockOutcome<T>` 的 `unreadable` 臂多一个可缺键 `ioKind?: ConfigDocumentIoKind`(词表是包根既有的 `CONFIG_DOCUMENT_IO_KINDS`:`dangling_symlink` / `read_error`,不加词)。
167
+ - **在场条件**:只在「解凭证路径」那一步失败时在场。值:抛出物是本包悬空链接判官抛的那只错 ⇒ `dangling_symlink`;其余(权限、成环的链接、路径上有一节不是目录 ……)⇒ `read_error`。别的 `unreadable`(锁建不出 / 锁名被不是普通文件的东西占着 / 锁内读不了真目标)**不带这一键**(键不在场,不是 `undefined`)。
168
+ - **铸法只有一只**:既有的类词铸点 `configDocumentIoKindOf`(按对象身份问悬空登记,不读句子),对**原始抛出物**问(包装后的文件系统失败句不在登记里,问它会得 `read_error`)。读 `config.d` 文档的 `io` 拒与凭据锁问同一只铸点;为此铸点随凭据锁同读从 `config-d-file.ts` 挪到 `atomic-write.ts`(它判的就是那个文件里的悬空判官;包内导出,不出任何子路径),悬空错的身份判据(此前也只是包内导出)随之收成该文件私有、只有铸点调它。
169
+ - **协议一致性测试(`./conformance`)不加 `ioKind` 格**:别的实现不带这一键也过;kit 只改头注里关于悬空软链那一句。
170
+ - 型:`Extract<WebAdminCredentialLockOutcome<T>, { status: "unreadable" }>["ioKind"]` 是 `ConfigDocumentIoKind | undefined`;词是闭集。
171
+
172
+ **已知的边**:`ioKind: "dangling_symlink"` 只在**凭证文件本身**是悬空软链时出现。凭证路径的某一级**上层目录**是悬空软链时,对凭证路径的 `lstat` 读不到(ENOENT),解路径那一步按「路径不存在 ⇒ 新建」原样往下走,到建锁那一步才失败 —— 答 `unreadable`(失败关闭,不建文件、不写),但**不带 `ioKind`**(这是「锁建不出」那一类的 `unreadable`,按上面的在场条件本来就不带这一键)。壳据 `ioKind` 渲「删掉悬空链接」这条出路时,这一形渲不出来 —— `error` 的句子只说目录写不进(形如 `cannot write into directory <目录> (ENOENT): …`),不点名悬空链接;要不要给这一形也配诊断位是另一件设计事项,本版不做。〔读码:`src/atomic-write.ts` 里解真目标那一步对 ENOENT 的放行,与凭据锁的几处 `unreadable` 返回点(只有解凭证路径那一处带 `ioKind`);没有对这一形跑过。〕
173
+
174
+ **三问**:
175
+ - **谁需要**:经软链放凭据文件、登出后再登录的终端用户 —— 壳据 `ioKind: "dangling_symlink"` 直接渲出路,不再解析句子。
176
+ - **谁受伤**:维持现状:再登录仍答 `unreadable`;对 `unreadable` 臂的整个结果做深相等的钉(`toEqual` 整对象),在「解凭证路径」失败的那几形上多见一键。
177
+ - **补偿 / 出路**:删掉悬空链接,或先重建目标;直接给真路径的凭据文件不受影响;宿主要分「是不是悬空链接」读 `ioKind`,不读句子。
178
+
179
+ **黑盒判据**:
180
+ - K52:凭证路径是指向不存在文件的软链 ⇒ `tryWebAdminCredentialFileLock(链接, cb)` 答 `{ status: "unreadable", ioKind: "dangling_symlink", error }`(`error.message` 仍是包里的文件系统失败句),`cb` 没跑,链接指向的路径上没有文件、链接原样、旁边不留锁。成环的两条软链(互指)、凭证路径的上一节是普通文件 ⇒ 同样 `unreadable`、`cb` 没跑,`ioKind` 是 `"read_error"`。
181
+ - K53:锁名(`.<凭证文件名>.lock`)被一个目录占着 ⇒ `unreadable`、`cb` 没跑、目录原样,结果上**没有 `ioKind` 这一键**(`"ioKind" in 结果` 为 `false`);凭证文件本身是个目录(锁内读不了真目标)⇒ 同样 `unreadable`、没有这一键。
182
+
183
+ **已存数据**:没有 —— `ioKind` 只在返回值上,不落盘;不需要迁移,本条没有新登记的一次性迁移。
184
+
185
+ ### 更正与写明(随包文字里说得不准的句子,照实改;已发各节本身不改一个字)
186
+
187
+ - **更正 · `ProjectRegistration.archivedAt` 的说明「没有硬删」**(只改类型旁的注释,判档 patch;类型、校验与导出面逐字不变):原写「没有硬删(会话行引用项目)」,不准 —— 登记可以被写口删除。现写明归档与删除是两件事:归档保留登记;删除后会话行上的 `projectId` 可能指向已删除的项目,读方按「不存在」处置。
188
+ - **写明 · `projects` 记录的条目序是契约事实**(`ProjectsConfig` 的注释;同上,只改注释):`projects` 记录的条目序是登记簿的展示序,唯一来源 = 文档条目次序,写者必须保序(`applyProjectPatch` 已保序)。已知分工:今天的内容版本按排序后的键计算,只调换次序不换版本号;内容版本自下一个大版本起看得见条目序。
189
+ - **更正 · 34.0.0 节凭据锁「已知限制」里「后续版本设计先行」那半句**:34.0.0 节「已知限制」里「『解到链接指向的落点再写穿』要另一套解软链的读法 ……,本版不带,后续版本设计先行」说得不准 —— 本版维持失败关闭;根修要改原子写器对悬空链接的拒律(不替链接建它指向的文件),那是另一份设计、按大版本另出。随包文字里同类的句子(原子写器头注、一致性测试头注、`docs/CONFORMANCE.md`、`README.md` 的协议段、`llms-full.txt` 与接入档里的凭据锁段)已改成同一说法;已发的 34.0.0 节不改一个字。34.0.0 节黑盒判据 K38 的可观察行为(登出后再登录 ⇒ `unreadable`、回调不跑、不建文件、链接原样)本版同判,只是结果上多一个可缺的 `ioKind`。
190
+
191
+ ### 各消费方
192
+
193
+ 读点来自设计与各车交接时对各仓当前树的只读核对(只 grep、未跑;本冻结笔没有重读各仓),动作栏只写本版要做的事。
194
+
195
+ | 消费方 | 读点 | 动作 |
196
+ |---|---|---|
197
+ | 服务端 | 沙箱 git 取值客户端 / 续签 / 租约三处读 `SandboxGitRefusalError`(新词恒为 `terminal`、不放值,不在服务端的「可恢复」拒因集合里);没升级的服务端遇到这个词(状态 503)按 5xx 兜底当暂不可用、退避重试;请求面 MCP 条目读器与它的能力位「请求面收哪些凭据引用种类」(读器表 `MCP_REQUEST_CREDENTIAL_KINDS`);项目的展示序读 `projects` 条目序(内容版本今天看不见它,见「更正与写明」)(这几项为推断:读各车交接档与设计,没重读服务端码) | 提货本版;对 `SandboxGitRefusalError` 穷举处补一臂,「可恢复」集合不收新词(读码确认过不需改,只补钉);想问「这只凭据值收不收」时用判口 `readRequestMcpCredentials`,不借整条传输读器探测 |
198
+ | 终端 | 插件创建面读 `enabledPlugins` 一个键的值与插件 id;壳侧登录口读凭据锁的 `unreadable` 答(推断:没重核) | 提货本版;插件设置读法 `readEnabledPluginsValue` / `readPluginId`(合并读法到货之前,同时读中心 `plugins` 与本机设置文件的宿主只照中心层答,不自己拼);登录口据 `ioKind: "dangling_symlink"` 渲出路(删掉悬空链接,或先重建目标),不解析句子 |
199
+ | 共用库(客户端核心) | 发送前判一只 MCP 凭据值收不收,今天借整条传输读器探测(推断:没重核);插件创建面读插件设置 | 提货本版;接判口 `readRequestMcpCredentials` 替掉探测;插件创建面接 `PLUGIN_MARKETPLACE_SENTINELS` / `readPluginId` / `readEnabledPluginsValue`(策略哨兵读不出时按拦是宿主一侧的现行做法,本包不规定) |
200
+ | web-admin | 凭据平面的拒答(它是发拒答词的一方:要把「配置错」与「暂时不可达」分成两个词);共享表 `CREDENTIAL_PLANE_REFUSALS` 里的 `plane_misconfigured` 是为这一件加的词 | 提货本版;**读者先升、发这个词的一方最后改答** —— 等服务端的沙箱 git 取值客户端等读者都升到本版,再把「配置错」改答 `plane_misconfigured`;在那之前不发这个词 |
201
+ | sdk | 契约套件、请求型镜像 | 无必须动作;请求型镜像(`RequestMcpTransport` 的 http 臂 `credentials` 自 34.0.0 起)是否跟进本版判口的型 `RequestMcpCredentialsVerdict`,由它定 |
202
+ | test | 黑盒判据 | 见各小节:K43 – K45(共享拒答表)· K46 – K48(凭据值判口)· K49 – K51(插件设置读法)· K52 – K53(凭据锁 `ioKind`) |
203
+
204
+ ### 导出面
205
+
206
+ - **新增**(合计 1662 → 1687:包根 883 → 898、`./types` 多 1、新子路径 `./plugin-settings` 9;登记表 `docs/API-SURFACE.md`):
207
+ - 包根(十五个):`CREDENTIAL_PLANE_REFUSALS` · `CREDENTIAL_PLANE_REFUSAL_ERRORS` · `readRequestMcpCredentials` · `readEnabledPluginsValue` · `ENABLED_PLUGINS_VALUE_KINDS` · `readPluginId` · `PLUGIN_MARKETPLACE_SENTINELS` · `isPluginMarketplaceSentinel` · `PLUGIN_ID_SEGMENT_REGEX`(值)· `CredentialPlaneRefusalError` · `RequestMcpCredentialsVerdict` · `EnabledPluginsValue` · `EnabledPluginsValueKind` · `PluginId` · `PluginMarketplaceSentinel`(型)。
208
+ - `./types`(一个):`PLUGIN_ID_SEGMENT_REGEX`(值;与包根上是同一只对象)。
209
+ - `./plugin-settings`(九个,新子路径;与包根上是同一批对象):`readEnabledPluginsValue` · `ENABLED_PLUGINS_VALUE_KINDS` · `readPluginId` · `PLUGIN_MARKETPLACE_SENTINELS` · `isPluginMarketplaceSentinel`(值)· `EnabledPluginsValue` · `EnabledPluginsValueKind` · `PluginId` · `PluginMarketplaceSentinel`(型)。
210
+ - **删除 / 改名**:无。
211
+ - **既有导出的型变了**:`SandboxGitRefusalError`(尾插一词 `plane_misconfigured`)与 `SANDBOX_GIT_REFUSAL_ERRORS`(多一员)· `SANDBOX_GIT_REFUSALS`(多一行;既有十行的值与类型逐字不变)· `SandboxGitCredentialRefusal`(`error` 多收这一词)· `WebAdminCredentialLockOutcome`(`unreadable` 臂多可选键 `ioKind`)。其余既有导出的型逐字不变(`PluginSource` / `PluginSpec` 读同一只正则与同一句拒句,型不变)。
212
+ - **既有导出的运行期读数变了**:`SandboxGitCredentialRefusal.safeParse` 对 `error: "plane_misconfigured"`(`permanence: "terminal"`)由拒变收;`SANDBOX_GIT_REFUSALS` 多一行、`SANDBOX_GIT_REFUSAL_ERRORS` 多一员;`tryWebAdminCredentialFileLock` 在「解凭证路径」那一步失败时的 `unreadable` 答多一个可缺键 `ioKind`。别的读数逐字不变 —— `readRequestMcpTransport` 现在调的是导出的判口 `readRequestMcpCredentials`,判法与每一句拒句一字不动。
213
+
214
+ **自 v34.0.0 起运行期代码有改动的公开导出(机器重算;上界 —— 可达 ≠ 一定变,不可达 ⇒ 一定不变;本版新增的导出不入表)**
215
+
216
+ ```text
217
+ DOMAINS [., ./types]
218
+ DOMAIN_SCHEMAS [., ./types]
219
+ FileConfigStore [./node]
220
+ NON_LOCAL_READ_DOMAINS [./conformance]
221
+ PluginSource [., ./types]
222
+ PluginSpec [., ./types]
223
+ PluginsConfig [., ./types]
224
+ SANDBOX_GIT_REFUSALS [.]
225
+ SANDBOX_GIT_REFUSAL_ERRORS [.]
226
+ SandboxGitCredentialRefusal [.]
227
+ buildEffective [., ./config-fns]
228
+ changedWriteFields [., ./config-fns]
229
+ deriveLocalExpectation [./conformance]
230
+ deriveWireExpectation [./conformance]
231
+ domainFilePath [./node]
232
+ emptyEffective [., ./config-fns]
233
+ foreignKeysOf [./conformance]
234
+ isDomainName [., ./types]
235
+ loadLocalConfig [./node]
236
+ loadRemoteExec [./node]
237
+ migrateConfigDirectory [./node]
238
+ migrateConfigDocuments [./node]
239
+ migrateEffectiveSnapshot [./one-time-migrations]
240
+ migrateEnvModelsDecision [./node]
241
+ parseDomain [., ./config-fns]
242
+ parseDomainLoud [., ./config-fns]
243
+ parseDomainSalvaged [., ./config-fns]
244
+ planEnvModelTableWrite [.]
245
+ readBundle [./node]
246
+ readConfigDFileReadingSync [./node]
247
+ readEffectiveWire [., ./config-fns]
248
+ readRequestMcpTransport [.]
249
+ remoteExecPath [./node]
250
+ resolveLegExpectation [./conformance]
251
+ runConformance [./conformance]
252
+ salvageEntries [., ./config-fns]
253
+ tryWebAdminCredentialFileLock [./node]
254
+ validateDomain [./node]
255
+ writeBundle [./node]
256
+ writeDomainFile [./node]
257
+ writeDomainFileIf [./node]
258
+ writeRemoteExec [./node]
259
+ ```
260
+
11
261
  ## 34.0.0 — 2026-11-24 — major:三处编译期破坏 + 一处运行期校验放宽 —— 钩子命令行规划口 `planHookCommandSpawn` 的入参 `entry.plugin` 由 `{ options? }` 变 `{ name; options? }`(`name` 必填)· 拒因型 `HookCommandSpawnRefusal` 的三只选项词(`shell_form_user_config` / `user_config_unset` / `user_config_unresolved`)同形成一臂、多必填的 `pluginName`(三句拒句改字面)· 公共型 `WarningProjection` 逐臂减掉该臂声明的诊断键(类型不再说诊断键在投影里;运行期投影的值一字不变)· 请求面 MCP 条目的 http 传输自此收 `vault` 凭据引用(`readRequestMcpTransport` 对同一份请求由拒变收;新导出读器表 `MCP_REQUEST_CREDENTIAL_KINDS` 与型 `McpRequestCredentialKind` / `McpRequestCredential`;发版纪律点名「校验收紧或放宽」);同批加性:被丢条目与告警 `entry-dropped` / `domain-defaulted` 多可缺的 `unknownKeys` / `truncatedFrom` · 单元表第十一个单元 `semaUiLanguage`、每一行单元多必填的读者位 `reader` 与读自哪些源 `sources`(新导出 `SETTINGS_UNIT_READERS` / `SettingsUnitReader`)· 本地 `.env` 两步读法(`./node`:`readEnvFileLines` / `resolveEnvFileAssignments` / `envFilePath` 与两张词表;`loadEnvFile` 一字不动)· web-admin 凭证文件的单写者锁(包根 `WEB_ADMIN_CREDENTIAL_FILE_LOCK` / `webAdminCredentialLockName`;`./node` `tryWebAdminCredentialFileLock`;`./conformance` `runWebAdminCredentialLockConformance`);同批文案与命令行:`--help` / `-h` 退出 0 · 拒句一批改字(迁移拒收的整份 `why`、坏的记录键、域读拒一行、车道坐标超长)
12
262
 
13
263
  > 档位(发版纪律「破坏性变更必 bump major」—— 条文点名「校验收紧或放宽」与「让同一份配置解析出不同结果的改动」,编译期同判):**major**,来由四件 —— 三件**编译期**破坏(消费方 tsc 红即通知)与一件**运行期**校验放宽(同一份请求读出不同结果)。没有一处校验收紧、没有已存数据要迁移。① `planHookCommandSpawn` 入参的结构型多必填 `name`;② `HookCommandSpawnRefusal` 三只选项词的拒因多必填 `pluginName`(`hookCommandSpawnRefusalSentence` 的入参型随之);③ `WarningProjection` 公共型收窄;④ 请求面 MCP 条目 http 传输的 `transport.credentials`:`{ kind: "http", url, credentials: { kind: "vault", entry } }` 此前答 `ok: false`(`credentials_not_carried`),自此答 `ok: true`、读后的传输带 `credentials` —— 这一件按发版纪律字面就是 major,不拆出去另发。四件的「改前 → 改后 → 怎么改」在下面「破坏面一览」第一张表(前三件另见「被丢条目的行说出……」一节的「迁移句」,第四件的三问见「请求面 MCP 条目的 http 传输收 `vault`」一节)。同批其余件各按发版纪律单独判档(新键 / 新导出 / 词表尾插 = minor,文案 = patch),随本版发,不新增档位理由;其中会让消费方红一次的(单元表每行多两键、`SettingsUnitName` 尾插一员、`ui` 行的 seam 展示字串、若干句子改字、`--help` 的退出码)在「破坏面一览」的第二张表逐件点名。
package/README.md CHANGED
@@ -52,6 +52,18 @@ only (`node:crypto`, `node:fs`). The machine gate is `test/runtime-dependencies-
52
52
  > zod 3, nested inside every zod-4 host). The move to zod 4 did not change what any schema accepts or produces —
53
53
  > the conformance corpus reads byte-identically on both — only the wording of validation errors (see CHANGELOG 11.0.0).
54
54
 
55
+ ## 升级指引:34.0.x → 34.1.0(minor,加性:沙箱 git 拒答表尾插第十一词 `plane_misconfigured` 与凭据平面共享拒答表 `CREDENTIAL_PLANE_REFUSALS` · web-admin 凭证文件锁 `unreadable` 臂的可缺诊断位 `ioKind` · 请求面凭据值的独立判口 `readRequestMcpCredentials` · 插件设置三只纯读法 `readEnabledPluginsValue` / `readPluginId` / `PLUGIN_MARKETPLACE_SENTINELS`(新子路径 `./plugin-settings`;名段文法提成常量 `PLUGIN_ID_SEGMENT_REGEX`);文书:项目登记簿两句、凭据锁「根修」那半句)
56
+
57
+ 只加导出、一个闭集尾插词与一个可选键:除新词那一例(`SandboxGitCredentialRefusal` 对 `plane_misconfigured` 由拒变收,两张拒答表各多一行 / 一员)与凭据锁 `unreadable` 答多一个可缺的 `ioKind` 外,既有输入的读数不变、没有校验收紧 —— 不涉及所列例外(第 1、2 条)的消费方代码零动作可升;第 1、2 条会让一部分消费方提货后红一次(对 `SandboxGitRefusalError` 的穷举 `switch` 与 `Record<…>` 全量映射表、对拒答词表按十个词的逐字比对、对 `unreadable` 臂整个结果的深相等)。逐件的读法表、三问、各消费方表与黑盒判据 K43 – K53 见 CHANGELOG 34.1.0 与 `docs/CONSUMER-INTEGRATION.md` §12.5、§56(末尾)、§57,凭据锁那一件在 §8 里 web-admin 凭证文件那一条。
58
+ 1. **沙箱 git 拒答表多第十一个词**(加性,提货成本):`SandboxGitRefusalError` / `SANDBOX_GIT_REFUSAL_ERRORS` 尾插 `plane_misconfigured`(状态 503、`terminal`:凭据平面在答方配置错,运维改配置之前定时重试不会成功),既有十词的次序、状态集与 `permanence` 逐字不变;新导出 `CREDENTIAL_PLANE_REFUSALS`(凭据平面共享拒答表,九词)· `CREDENTIAL_PLANE_REFUSAL_ERRORS` · 型 `CredentialPlaneRefusalError`,`SANDBOX_GIT_REFUSALS` 按声明次序由共享表与本口自有两词派生(共享的九行与共享表是同一批对象)。对 `SandboxGitRefusalError` 做穷举 `switch` 的一方补一臂,对它写 `Record<SandboxGitRefusalError, …>` 这类全量映射表的一方补一行;对拒答词表按「十个词」逐字比对的钉改成十一个。**次序:读方先升、发这个词的一方最后改答** —— 没升级的收方遇到它:按本包规则读的当畸形应答、按 HTTP 5xx 兜底的当暂不可用并退避重试,两种都不取值;升级后才读得到 `terminal`、停止定时重试。
59
+ 2. **凭据锁 `unreadable` 臂多可缺的 `ioKind`**(加性):`tryWebAdminCredentialFileLock` 在「解凭证路径」那一步失败时,`unreadable` 的结果多一个可缺键 `ioKind`(`dangling_symlink` = 悬空软链〔登出删掉真目标之后链接悬空〕,`read_error` = 别的读不出;词表是包根既有的 `CONFIG_DOCUMENT_IO_KINDS`,不加词);别的 `unreadable`(锁建不出 / 锁名被不是普通文件的东西占着 / 锁内读不了真目标)不带这一键(键不在场,不是 `undefined`)。壳据它直接渲出路(删掉悬空链接,或先重建目标),不解析句子;只有**凭证文件本身**是悬空软链时才是 `dangling_symlink` —— 上层目录的软链悬空时,解路径那一步读不到(ENOENT)照「不存在」往下走,到建锁才失败,答 `unreadable` 而不带这一键(`error` 的句子只说目录写不进〔ENOENT〕,不点名悬空链接)。**悬空软链答 `unreadable` 是本版有意维持的行为**:不建文件、不写,与本包原子写器对悬空链接的拒同一条律;34.0.0 的节与几处随包文字曾把这一形写成「根修后翻成写穿」「后续版本设计先行」「本版不带」,说得不准,撤掉了(随包文字里同类的句子 —— 原子写器头注、一致性测试头注、`docs/CONFORMANCE.md`、本档协议段、`llms-full.txt` 与接入档里的凭据锁段 —— 已改成同一说法;34.0.0 节本身不改字,订正写在 CHANGELOG 34.1.0 节末):本版不解析悬空链接的落点,要做就得改原子写器对悬空链接的拒律(不替链接建它指向的文件),那是另一份设计、按大版本排。对 `unreadable` 臂整个结果做深相等的钉,在「解凭证路径」失败的形上多见一键。
60
+ 3. **请求面凭据值的独立判口 `readRequestMcpCredentials`**(加性,包根两个新导出:函数与型 `RequestMcpCredentialsVerdict`):问一个已读出的 `credentials` 值收不收 —— `{ kind: "absent" }` · `{ kind: "taken", credential }`(新造的冻结副本)· `{ kind: "refused", refusal: "credentials_not_carried", reason }`(三臂答案都冻结)。读器 `readRequestMcpTransport` 现在调的就是它,判法与每一句拒句一字未动;只想问「这一个值收不收」、不想为此拼一整条传输的消费方改用它(整条传输还会因 `url` / `headers` 等别的键答 `ok: false`,判口不知道那些)。能力面「请求面收哪些凭据引用种类」的唯一值源仍是 `MCP_REQUEST_CREDENTIAL_KINDS`。**已知的边**:`transport` 形参的型是闭集 `"stdio" | "http"`,类型内的调用到不了表外词;运行期传表外词(纯 JS / 强制转型)会按 http 臂判,对合形保管库引用答 `taken`;下一个大版本改成穷举、表外词拒。
61
+ 4. **插件设置的三只纯读法**(加性,新子路径 `./plugin-settings`,与包根同一批对象):`readEnabledPluginsValue(v)` 读 `enabledPlugins` 里一个键的值(`true` / `false` / 字符串数组 ⇒ `on` / `off` / `versions`,其余 ⇒ `unreadable`;数组元素不细判)· `readPluginId(v)` 拆插件 id(`<名>@<市场>` 恰一个 `@`,两半各过名段文法;npm 来源 id `@<scope>/<包名>@npm`〔读出的名含 `@` 与 `/`,**不是合法的 `PluginSpec.name`**:中心层插件条目没有 npm 来源形,这样的 id 只能读出、不能原样写成中心层条目〕;`<名>@skills-dir` 是合法 id;读不出 ⇒ `undefined`)· `PLUGIN_MARKETPLACE_SENTINELS`(`inline` / `skills-dir` / `synced` / `builtin` 四词,深冻)与 `isPluginMarketplaceSentinel`。三只都只读值、**不定合并**:中心层 `plugins[].enabled` 与设置层 `enabledPlugins` 怎么组合不在本版 —— 合并读法到货之前,同时读中心 `plugins` 与本机设置文件的宿主只照中心层答、不自己拼;托管策略表与它的哨兵臂、`pluginConfigs` / `extraKnownMarketplaces` 的条目形也不在本版。
62
+ 5. **名段文法提成常量 `PLUGIN_ID_SEGMENT_REGEX`**(加性,包根与 `./types`;行为逐字不变):`PluginSpec.name` 与 `PluginSource` 的 marketplace 臂此前各写一遍的名段正则与同一句拒句,现在只有一处定义(包内私有的零 import 叶,`./types` 与包根上是它的原名转出);对同一组坏名,两处的拒句、路径与条数与上一版逐字相同。`./plugin-settings` 冷载入不带出 `./types`、不带出 zod。
63
+ 6. **文书更正**(类型旁的注释与随包文字,不改任何类型、校验与导出面):`ProjectRegistration.archivedAt` 的说明原写「没有硬删」,不准 —— 归档保留登记,删除后会话行上的 `projectId` 可能指向已删除的项目,读方按「不存在」处置;`projects` 记录的条目序是契约事实(登记簿的展示序,唯一来源 = 文档条目次序),写者必须保序,今天的内容版本按排序后的键计算、只调换次序不换版本号;凭据锁「后续版本设计先行」那半句更正见第 2 条。
64
+
65
+ 本版没有新登记的一次性迁移,也没有到期删码的(`SS-M11` 的窗到 2026-11-26)。
66
+
55
67
  ## 升级指引:33.1.x → 34.0.0(BREAKING,编译期三处:`planHookCommandSpawn` 入参 `entry.plugin` 必带 `name` · 钩子命令行三只选项词的拒因多必填 `pluginName`(三句拒句改字面)· 公共型 `WarningProjection` 逐臂减掉诊断键;BREAKING,运行期一处(校验放宽):请求面 MCP 条目的 http 传输收 `vault` 凭据引用;加性:被丢条目与告警 `entry-dropped` / `domain-defaulted` 多可缺的 `unknownKeys` / `truncatedFrom` · 单元表第十一个单元 `semaUiLanguage`、每行必填的读者位 `reader` 与读自哪些源 `sources`、新导出 `SETTINGS_UNIT_READERS` / `SettingsUnitReader` · 本地 `.env` 两步读法 · web-admin 凭证文件的单写者锁;文案与命令行:`--help` / `-h` 退 0、拒句一批改字)
56
68
 
57
69
  没有校验收紧、没有已存数据要迁移 —— 会让按 33.1.x 写的消费方红的是第 1 – 3 条(编译期,tsc 报给你)与第 9 条(运行期:同一份请求读出不同结果),第 4 – 6 条与第 10 – 11 条是加性与提货成本,第 7 – 8 条是命令行与文案;下面任何一条都不碰的消费方零动作可升。逐件的「改前 → 改后」、三问、各消费方表与黑盒判据 K1 – K42 见 CHANGELOG 34.0.0 与 `docs/CONSUMER-INTEGRATION.md` §53 – §56。
@@ -950,14 +962,16 @@ settings 单元读不进的成员**不是缺席**(`loosen` 可丢且要响,`tigh
950
962
  (nothing written) when the lock is no longer this caller's. Loss is sticky: once the handle has answered "not mine" (including "could not tell"),
951
963
  it never writes again. The answer is closed: `acquired` / `lost` (the callback ran, but the lock was found taken over or could not be confirmed —
952
964
  a write the handle answered `true` for BEFORE that point did land; whether a write landed is the method's own answer, not the status) / `busy` (`heldForMs` when the age was read and not in the future) / `unreadable` (the lock or
953
- the target could not be created / read; nothing ran, nothing was written — never an unlocked fallback). The callback must be synchronous: an
965
+ the target could not be created / read; nothing ran, nothing was written — never an unlocked fallback; when it is the credential path itself that could not be resolved the
966
+ answer also carries an optional `ioKind` — `dangling_symlink` for a dangling link, `read_error` for anything else — so a shell can show the way out without parsing the sentence; the
967
+ other `unreadable` answers do not carry the key). The callback must be synchronous: an
954
968
  `async` callback is a compile error, and a callback that returns a promise at runtime is refused with a `TypeError` after the lock is released.
955
969
  **Another implementation of this protocol must pass `runWebAdminCredentialLockConformance(implementation)`** (`./conformance`; same signature as
956
970
  `tryWebAdminCredentialFileLock`) — one protocol, one set of checks; two implementations each declaring themselves compliant does not count.
957
971
  Limits, stated: **a credential file reached through a symbolic link is not writable again after a logout deletes the link's target** — the link now dangles
958
972
  and the next lock attempt answers `unreadable` (fail closed: nothing created, nothing written; the way out is to remove the dangling link or recreate its
959
- target; a credential path that is the real file is not affected); resolving "through" a dangling link needs a second reading of symbolic links that
960
- agrees with the kernel on relative link text, trailing slashes, the hop bound and a change between the check and the open — it is not in this version. The
973
+ target; a credential path that is the real file is not affected); this version does not resolve a dangling link to the place it points at — that
974
+ would mean changing the package's atomic writer, which refuses to create the file a link points at, so it would be a separate design and a major release. The
961
975
  lock name's occupant is judged as seen when the lock is attempted; swapped between the type check and the act it can show up as the kernel's own `code`
962
976
  and sentence (a link put there between the check and the open), as `busy` (a directory or link put there between the first collision and the second
963
977
  exclusive create), or as a link moved aside and deleted like a stale lock (put there under an old lock between its stat and the rename). A holder frozen for longer than `staleMs` (debugger, `SIGSTOP`) is taken over, and the one system call between its last identity
@@ -977,11 +991,12 @@ settings 单元读不进的成员**不是缺席**(`loosen` 可丢且要响,`tigh
977
991
  default, carried verbatim by `readEffectiveWire` (`EffectiveWire.sandboxGit` is `unknown`) and judged by the consumer with `SandboxGitConfig`.
978
992
  (2) The credential port's wire for `kind: "sandbox_git"`: `SandboxGitCredentialRequest` (claim a handle), `CredentialHandleAnswer` /
979
993
  `CredentialResolveRequest` (kind-independent), `SandboxGitCredentialAnswer` with one `SandboxGitOriginAnswer` per origin (discriminated by
980
- `state`; `secret` only on the `active` arm — other arms strip it), `SandboxGitCredentialRefusal` (`{ error, permanence, message }`). Three word tables,
981
- each spelled once: `SANDBOX_GIT_ORIGIN_VERDICTS` (the 11-row per-origin judgment order; `SANDBOX_GIT_ORIGIN_STATES` / `SANDBOX_GIT_ORIGIN_REASONS`
982
- and the answer arms' reason domains derive from it), `SANDBOX_GIT_REFUSALS` (10 refusal words → HTTP statuses + `permanence`;
983
- `SANDBOX_GIT_REFUSAL_ERRORS` derives from it), `SANDBOX_GIT_PERMANENCE` (`terminal` / `transient`). Both sides' reading is in
984
- `docs/CONSUMER-INTEGRATION.md` §12.
994
+ `state`; `secret` only on the `active` arm — other arms strip it), `SandboxGitCredentialRefusal` (`{ error, permanence, message }`). Word tables
995
+ (each word's row — HTTP statuses and `permanence` — is written once): `SANDBOX_GIT_ORIGIN_VERDICTS` (the 11-row per-origin judgment order; `SANDBOX_GIT_ORIGIN_STATES` / `SANDBOX_GIT_ORIGIN_REASONS`
996
+ and the answer arms' reason domains derive from it), `SANDBOX_GIT_REFUSALS` (11 refusal words → HTTP statuses + `permanence`, derived in a
997
+ declared order from the credential plane's shared table `CREDENTIAL_PLANE_REFUSALS` (9 words) and this port's own two words — the previous
998
+ release's ten words keep their order, new words are appended; `SANDBOX_GIT_REFUSAL_ERRORS` derives from it), `SANDBOX_GIT_PERMANENCE`
999
+ (`terminal` / `transient`). Both sides' reading is in `docs/CONSUMER-INTEGRATION.md` §12.
985
1000
  - **User lifecycle events** (29.0.0; `api/lifecycle-events.ts`, main barrel only — no subpath): the wire shapes of "this principal was deleted /
986
1001
  demoted / removed from a space" — the producer (web-admin) emits sequenced events, the consumer (the execution plane) pulls them in pages, dedups by
987
1002
  `seq`, and reconciles principals' standing at start-up and when its cursor stops being valid. Shapes and word tables only, no IO; unknown KEYS are stripped
@@ -1 +1 @@
1
- 34.0.0
1
+ 34.1.0
@@ -8,12 +8,13 @@
8
8
  * 取值口的另两种凭据(`model` / `mcp_static`)的请求与应答形不在本模块;它们落地时与本模块的 `sandbox_git` 形并成按 `kind` 判别的联合,
9
9
  * 本模块的形不动(`kind` 字面量已经在)。
10
10
  *
11
- * ## 三张词表,各一张,每个词只在本文件里拼一次
11
+ * ## 词表:每个词的行(状态集与 `permanence`)只在本文件里写一次
12
12
  * · {@link SANDBOX_GIT_ORIGIN_VERDICTS} —— **逐 origin 判定序表**,11 行,序即判定序(首条命中即答;一个 origin 的结果不影响别的 origin)。
13
13
  * 状态词({@link SANDBOX_GIT_ORIGIN_STATES},六个)与原因词({@link SANDBOX_GIT_ORIGIN_REASONS},十个)由它派生,没有第二张词表;`active` 行没有原因。
14
14
  * 应答行({@link SandboxGitOriginAnswer})每个状态一个臂,臂里 `reason` 的值域 = 表里该状态的行 —— 状态与原因的配对由表定,臂不手写。
15
15
  * 每一行的**条件**(什么事实使它命中)是 web-admin 的判定逻辑,写在 `docs/CONSUMER-INTEGRATION.md` 里,不进运行期表。
16
- * · {@link SANDBOX_GIT_REFUSALS} —— **整次拒答词**(十个)→ HTTP 状态集与 `permanence`;拒体里的 `permanence` 是错误词的函数,必须等于这一行的。
16
+ * · {@link CREDENTIAL_PLANE_REFUSALS} —— 凭据平面共享拒答表(九个词;同一平面的各只口从它派生,每个词的状态集与 `permanence` 只在这里写一次)。
17
+ * · {@link SANDBOX_GIT_REFUSALS} —— 整次拒答词(十一个)→ HTTP 状态集与 `permanence`,由凭据平面共享表 {@link CREDENTIAL_PLANE_REFUSALS}(九个)与本口自有的两个词按声明的次序派生(上一版的十个词原序、新词只在尾部);拒体里的 `permanence` 是错误词的函数,必须等于这一行的。
17
18
  * · {@link SANDBOX_GIT_PERMANENCE} —— `terminal`(不按定时重试)/ `transient`(退避重试)两词,语义在本表定义。
18
19
  *
19
20
  * ## 解析一律剥未知键
@@ -208,18 +209,15 @@ export type SandboxGitCredentialAnswer = z.infer<typeof SandboxGitCredentialAnsw
208
209
  export declare const SANDBOX_GIT_PERMANENCE: readonly ["terminal", "transient"];
209
210
  export type SandboxGitPermanence = (typeof SANDBOX_GIT_PERMANENCE)[number];
210
211
  /**
211
- * 整次拒答词 → 它的 HTTP 状态集(中心答这个词时用其一)与 `permanence`。**一个错误词的 permanence 是固定的**,拒体里再带一份只为让收方不必查表 ——
212
- * 两处不一致就是畸形应答({@link SandboxGitCredentialRefusal} 拒)。收方怎么处置某个词(例如哪些 terminal 可由用户动作恢复)是收方的状态机,不在这里。
212
+ * 凭据平面共享拒答表(九个词):同一凭据平面的各只口都从它派生(`sandbox_git` 凭据取值口如此,同一平面的后续取值口同样如此),
213
+ * 每个词的 HTTP 状态集与 `permanence` 只在这里写一次。
214
+ * `plane_misconfigured` = 凭据平面在答方配置错 —— `terminal`,按定时重试不会成功,必须由运维修正配置。
213
215
  */
214
- export declare const SANDBOX_GIT_REFUSALS: {
216
+ export declare const CREDENTIAL_PLANE_REFUSALS: {
215
217
  readonly caller_not_admitted: {
216
218
  readonly statuses: readonly [401, 403];
217
219
  readonly permanence: "terminal";
218
220
  };
219
- readonly scope_mismatch: {
220
- readonly statuses: readonly [403];
221
- readonly permanence: "terminal";
222
- };
223
221
  readonly incarnation_mismatch: {
224
222
  readonly statuses: readonly [403];
225
223
  readonly permanence: "terminal";
@@ -244,32 +242,114 @@ export declare const SANDBOX_GIT_REFUSALS: {
244
242
  readonly statuses: readonly [503];
245
243
  readonly permanence: "terminal";
246
244
  };
245
+ readonly vault_unavailable: {
246
+ readonly statuses: readonly [503];
247
+ readonly permanence: "transient";
248
+ };
249
+ readonly plane_misconfigured: {
250
+ readonly statuses: readonly [503];
251
+ readonly permanence: "terminal";
252
+ };
253
+ };
254
+ /** 凭据平面共享拒答词(闭集,九个)—— 类型由 {@link CREDENTIAL_PLANE_REFUSALS} 派生。 */
255
+ export type CredentialPlaneRefusalError = keyof typeof CREDENTIAL_PLANE_REFUSALS;
256
+ /** 凭据平面共享拒答词表(运行期;表的键,按表序)。 */
257
+ export declare const CREDENTIAL_PLANE_REFUSAL_ERRORS: readonly [CredentialPlaneRefusalError, ...CredentialPlaneRefusalError[]];
258
+ declare const SANDBOX_GIT_OWN_REFUSALS: {
259
+ readonly scope_mismatch: {
260
+ readonly statuses: readonly [403];
261
+ readonly permanence: "terminal";
262
+ };
247
263
  readonly handle_invalid: {
248
264
  readonly statuses: readonly [401];
249
265
  readonly permanence: "transient";
250
266
  };
251
- readonly vault_unavailable: {
267
+ };
268
+ /** 上一版的十个词保持原序,新词只追加在尾部 —— 调整既有词的次序是破坏性变更。 */
269
+ declare const SANDBOX_GIT_REFUSAL_ORDER: readonly ["caller_not_admitted", "scope_mismatch", "incarnation_mismatch", "request_invalid", "principal_not_live", "delegation_required", "vault_disabled", "vault_frozen", "handle_invalid", "vault_unavailable", "plane_misconfigured"];
270
+ type SandboxGitRefusalWord = (typeof SANDBOX_GIT_REFUSAL_ORDER)[number];
271
+ type SandboxGitRefusalSource = CredentialPlaneRefusalError | keyof typeof SANDBOX_GIT_OWN_REFUSALS;
272
+ /** 编译期核对,只在类型层(不留运行期语句):`T` 必须是 `true`,否则这一行编译即红。 */
273
+ type MustBeTrue<T extends true> = T;
274
+ /**
275
+ * 次序表与两张来源表「恰好」互为全集:来源里每个词都在次序表里(漏一个红)、次序表里每个词都在来源里(写进不存在的词红)、
276
+ * 共享表与自有表没有同名的词(重名红)。下面 `SANDBOX_GIT_REFUSALS` 的类型用到它,所以不成立 ⇒ 编译红。
277
+ */
278
+ type SandboxGitRefusalOrderIsExact = MustBeTrue<[
279
+ Exclude<SandboxGitRefusalSource, SandboxGitRefusalWord>,
280
+ Exclude<SandboxGitRefusalWord, SandboxGitRefusalSource>,
281
+ Extract<CredentialPlaneRefusalError, keyof typeof SANDBOX_GIT_OWN_REFUSALS>
282
+ ] extends [never, never, never] ? true : false>;
283
+ declare const SANDBOX_GIT_REFUSAL_ROWS: {
284
+ scope_mismatch: {
285
+ readonly statuses: readonly [403];
286
+ readonly permanence: "terminal";
287
+ };
288
+ handle_invalid: {
289
+ readonly statuses: readonly [401];
290
+ readonly permanence: "transient";
291
+ };
292
+ caller_not_admitted: {
293
+ readonly statuses: readonly [401, 403];
294
+ readonly permanence: "terminal";
295
+ };
296
+ incarnation_mismatch: {
297
+ readonly statuses: readonly [403];
298
+ readonly permanence: "terminal";
299
+ };
300
+ request_invalid: {
301
+ readonly statuses: readonly [400];
302
+ readonly permanence: "terminal";
303
+ };
304
+ principal_not_live: {
305
+ readonly statuses: readonly [403];
306
+ readonly permanence: "terminal";
307
+ };
308
+ delegation_required: {
309
+ readonly statuses: readonly [403];
310
+ readonly permanence: "terminal";
311
+ };
312
+ vault_disabled: {
313
+ readonly statuses: readonly [503];
314
+ readonly permanence: "terminal";
315
+ };
316
+ vault_frozen: {
317
+ readonly statuses: readonly [503];
318
+ readonly permanence: "terminal";
319
+ };
320
+ vault_unavailable: {
252
321
  readonly statuses: readonly [503];
253
322
  readonly permanence: "transient";
254
323
  };
324
+ plane_misconfigured: {
325
+ readonly statuses: readonly [503];
326
+ readonly permanence: "terminal";
327
+ };
255
328
  };
256
- /** 整次拒答词(闭集,十个)—— 类型由 {@link SANDBOX_GIT_REFUSALS} 派生。 */
329
+ /**
330
+ * 整次拒答词 → 它的 HTTP 状态集(中心答这个词时用其一)与 `permanence`。**一个错误词的 permanence 是固定的**,拒体里再带一份只为让收方不必查表 ——
331
+ * 两处不一致就是畸形应答({@link SandboxGitCredentialRefusal} 拒)。收方怎么处置某个词(例如哪些 terminal 可由用户动作恢复)是收方的状态机,不在这里。
332
+ * 表由 {@link CREDENTIAL_PLANE_REFUSALS} 与本口自有两词按声明的次序派生(复用同一行对象,不抄行)。
333
+ */
334
+ export declare const SANDBOX_GIT_REFUSALS: { readonly [W in SandboxGitRefusalOrderIsExact extends true ? SandboxGitRefusalWord : never]: (typeof SANDBOX_GIT_REFUSAL_ROWS)[W]; };
335
+ /** 整次拒答词(闭集,十一个)—— 类型由 {@link SANDBOX_GIT_REFUSALS} 派生,次序来自声明的次序。 */
257
336
  export type SandboxGitRefusalError = keyof typeof SANDBOX_GIT_REFUSALS;
258
- /** 整次拒答词表(运行期;表的键,按表序)。 */
337
+ /** 整次拒答词表(运行期;表的键,按声明的次序)。 */
259
338
  export declare const SANDBOX_GIT_REFUSAL_ERRORS: readonly [SandboxGitRefusalError, ...SandboxGitRefusalError[]];
260
339
  /** 整次拒答的体:`{ error, permanence, message }`。`message` 是中心的诊断句(收方不据它判,可为空串)。 */
261
340
  export declare const SandboxGitCredentialRefusal: z.ZodObject<{
262
341
  error: z.ZodEnum<{
263
342
  caller_not_admitted: "caller_not_admitted";
264
- scope_mismatch: "scope_mismatch";
265
343
  incarnation_mismatch: "incarnation_mismatch";
266
344
  request_invalid: "request_invalid";
267
345
  principal_not_live: "principal_not_live";
268
346
  delegation_required: "delegation_required";
269
347
  vault_disabled: "vault_disabled";
270
348
  vault_frozen: "vault_frozen";
271
- handle_invalid: "handle_invalid";
272
349
  vault_unavailable: "vault_unavailable";
350
+ plane_misconfigured: "plane_misconfigured";
351
+ scope_mismatch: "scope_mismatch";
352
+ handle_invalid: "handle_invalid";
273
353
  }>;
274
354
  permanence: z.ZodEnum<{
275
355
  terminal: "terminal";
@@ -8,12 +8,13 @@
8
8
  * 取值口的另两种凭据(`model` / `mcp_static`)的请求与应答形不在本模块;它们落地时与本模块的 `sandbox_git` 形并成按 `kind` 判别的联合,
9
9
  * 本模块的形不动(`kind` 字面量已经在)。
10
10
  *
11
- * ## 三张词表,各一张,每个词只在本文件里拼一次
11
+ * ## 词表:每个词的行(状态集与 `permanence`)只在本文件里写一次
12
12
  * · {@link SANDBOX_GIT_ORIGIN_VERDICTS} —— **逐 origin 判定序表**,11 行,序即判定序(首条命中即答;一个 origin 的结果不影响别的 origin)。
13
13
  * 状态词({@link SANDBOX_GIT_ORIGIN_STATES},六个)与原因词({@link SANDBOX_GIT_ORIGIN_REASONS},十个)由它派生,没有第二张词表;`active` 行没有原因。
14
14
  * 应答行({@link SandboxGitOriginAnswer})每个状态一个臂,臂里 `reason` 的值域 = 表里该状态的行 —— 状态与原因的配对由表定,臂不手写。
15
15
  * 每一行的**条件**(什么事实使它命中)是 web-admin 的判定逻辑,写在 `docs/CONSUMER-INTEGRATION.md` 里,不进运行期表。
16
- * · {@link SANDBOX_GIT_REFUSALS} —— **整次拒答词**(十个)→ HTTP 状态集与 `permanence`;拒体里的 `permanence` 是错误词的函数,必须等于这一行的。
16
+ * · {@link CREDENTIAL_PLANE_REFUSALS} —— 凭据平面共享拒答表(九个词;同一平面的各只口从它派生,每个词的状态集与 `permanence` 只在这里写一次)。
17
+ * · {@link SANDBOX_GIT_REFUSALS} —— 整次拒答词(十一个)→ HTTP 状态集与 `permanence`,由凭据平面共享表 {@link CREDENTIAL_PLANE_REFUSALS}(九个)与本口自有的两个词按声明的次序派生(上一版的十个词原序、新词只在尾部);拒体里的 `permanence` 是错误词的函数,必须等于这一行的。
17
18
  * · {@link SANDBOX_GIT_PERMANENCE} —— `terminal`(不按定时重试)/ `transient`(退避重试)两词,语义在本表定义。
18
19
  *
19
20
  * ## 解析一律剥未知键
@@ -121,22 +122,46 @@ export const SandboxGitCredentialAnswer = z.object({
121
122
  /** `permanence` 两词:`terminal` = 不按定时重试;`transient` = 退避重试。 */
122
123
  export const SANDBOX_GIT_PERMANENCE = deepFreeze(["terminal", "transient"]);
123
124
  /**
124
- * 整次拒答词 → 它的 HTTP 状态集(中心答这个词时用其一)与 `permanence`。**一个错误词的 permanence 是固定的**,拒体里再带一份只为让收方不必查表 ——
125
- * 两处不一致就是畸形应答({@link SandboxGitCredentialRefusal} 拒)。收方怎么处置某个词(例如哪些 terminal 可由用户动作恢复)是收方的状态机,不在这里。
125
+ * 凭据平面共享拒答表(九个词):同一凭据平面的各只口都从它派生(`sandbox_git` 凭据取值口如此,同一平面的后续取值口同样如此),
126
+ * 每个词的 HTTP 状态集与 `permanence` 只在这里写一次。
127
+ * `plane_misconfigured` = 凭据平面在答方配置错 —— `terminal`,按定时重试不会成功,必须由运维修正配置。
126
128
  */
127
- export const SANDBOX_GIT_REFUSALS = deepFreeze({
129
+ export const CREDENTIAL_PLANE_REFUSALS = deepFreeze({
128
130
  caller_not_admitted: { statuses: [401, 403], permanence: "terminal" },
129
- scope_mismatch: { statuses: [403], permanence: "terminal" },
130
131
  incarnation_mismatch: { statuses: [403], permanence: "terminal" },
131
132
  request_invalid: { statuses: [400], permanence: "terminal" },
132
133
  principal_not_live: { statuses: [403], permanence: "terminal" },
133
134
  delegation_required: { statuses: [403], permanence: "terminal" },
134
135
  vault_disabled: { statuses: [503], permanence: "terminal" },
135
136
  vault_frozen: { statuses: [503], permanence: "terminal" },
136
- handle_invalid: { statuses: [401], permanence: "transient" },
137
137
  vault_unavailable: { statuses: [503], permanence: "transient" },
138
+ plane_misconfigured: { statuses: [503], permanence: "terminal" },
139
+ });
140
+ /** 凭据平面共享拒答词表(运行期;表的键,按表序)。 */
141
+ export const CREDENTIAL_PLANE_REFUSAL_ERRORS = deepFreeze(Object.keys(CREDENTIAL_PLANE_REFUSALS));
142
+ const SANDBOX_GIT_OWN_REFUSALS = deepFreeze({
143
+ scope_mismatch: { statuses: [403], permanence: "terminal" },
144
+ handle_invalid: { statuses: [401], permanence: "transient" },
138
145
  });
139
- /** 整次拒答词表(运行期;表的键,按表序)。 */
146
+ /** 同一个词写了两遍 ⇒ 模块加载即抛(次序表是公开事实,重复的词会让派生表静默少一行)。原样交回入参(元组类型不丢)。 */
147
+ function wordsListedOnce(words) {
148
+ if (new Set(words).size !== words.length)
149
+ throw new Error("SANDBOX_GIT_REFUSAL_ORDER lists a word twice");
150
+ return words;
151
+ }
152
+ /** 上一版的十个词保持原序,新词只追加在尾部 —— 调整既有词的次序是破坏性变更。 */
153
+ const SANDBOX_GIT_REFUSAL_ORDER = wordsListedOnce([
154
+ "caller_not_admitted", "scope_mismatch", "incarnation_mismatch", "request_invalid", "principal_not_live",
155
+ "delegation_required", "vault_disabled", "vault_frozen", "handle_invalid", "vault_unavailable", "plane_misconfigured",
156
+ ]);
157
+ const SANDBOX_GIT_REFUSAL_ROWS = { ...CREDENTIAL_PLANE_REFUSALS, ...SANDBOX_GIT_OWN_REFUSALS };
158
+ /**
159
+ * 整次拒答词 → 它的 HTTP 状态集(中心答这个词时用其一)与 `permanence`。**一个错误词的 permanence 是固定的**,拒体里再带一份只为让收方不必查表 ——
160
+ * 两处不一致就是畸形应答({@link SandboxGitCredentialRefusal} 拒)。收方怎么处置某个词(例如哪些 terminal 可由用户动作恢复)是收方的状态机,不在这里。
161
+ * 表由 {@link CREDENTIAL_PLANE_REFUSALS} 与本口自有两词按声明的次序派生(复用同一行对象,不抄行)。
162
+ */
163
+ export const SANDBOX_GIT_REFUSALS = deepFreeze(Object.fromEntries(SANDBOX_GIT_REFUSAL_ORDER.map((w) => [w, SANDBOX_GIT_REFUSAL_ROWS[w]])));
164
+ /** 整次拒答词表(运行期;表的键,按声明的次序)。 */
140
165
  export const SANDBOX_GIT_REFUSAL_ERRORS = deepFreeze(Object.keys(SANDBOX_GIT_REFUSALS));
141
166
  /** 整次拒答的体:`{ error, permanence, message }`。`message` 是中心的诊断句(收方不据它判,可为空串)。 */
142
167
  export const SandboxGitCredentialRefusal = z