@sema-agent/settings-schema 33.0.0 → 33.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 +111 -0
- package/README.md +33 -3
- package/conformance/VERSION +1 -1
- package/dist/api/wire-scalars.d.ts +3 -2
- package/dist/api/wire-scalars.js +3 -2
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +1 -1
- package/dist/config-dir-migration.d.ts +3 -3
- package/dist/config-dir-migration.js +2 -1
- package/dist/declared-capture.js +1 -1
- package/dist/fleet.d.ts +125 -7
- package/dist/fleet.js +138 -3
- package/dist/read-sentences.d.ts +2 -1
- package/dist/read-sentences.js +2 -1
- package/docs/API-SURFACE.md +23 -3
- package/docs/CONSUMER-INTEGRATION.md +27 -2
- package/llms-full.txt +2 -1
- package/llms.txt +2 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,117 @@
|
|
|
8
8
|
|
|
9
9
|
## Unreleased
|
|
10
10
|
|
|
11
|
+
## 33.1.0 — 2026-11-22 — minor:排空口多一种请求体 ——「凭据点名形」`CredentialDrainRequest`(严格对象 `{ instanceId?, turns?, attachedAtMost? }`,读器 `readCredentialDrainRequest`;`turns` 是两词闭集 `DRAIN_TURNS` = `yield` / `halt`,`attachedAtMost` 是非负安全整数)· 条件不满足那一拒的体 `DrainConditionUnmet`、读器 `readDrainConditionUnmet`、码常量 `DRAIN_CONDITION_UNMET_CODE` · 读「请求体是哪一形」的聚合读器 `readDrainRequestReading`(判别联合 `DrainRequestReading`,形词闭集 `DRAIN_REQUEST_FORMS`;收请求的一侧只用它;两形的键混在一起的体哪一形都不是 ⇒ 读不进)(十个新导出;既有导出的形与读数逐字不变)· 更正:读腿后果句「整域拒 + 逐条丢」那一格改准(文案)与几处文书说得不准的句子(见节末「更正与写明」)
|
|
12
|
+
|
|
13
|
+
> 档位(按发版纪律):**minor** —— 「新键 / 新导出 = minor」:包根与 `./fleet` 各多十个导出(`DRAIN_TURNS` / `DrainTurns` / `CredentialDrainRequest` / `readCredentialDrainRequest` / `DRAIN_CONDITION_UNMET_CODE` / `DrainConditionUnmet` / `readDrainConditionUnmet` / `DRAIN_REQUEST_FORMS` / `DrainRequestReading` / `readDrainRequestReading`,其中三个同名也是型、`DrainRequestReading` 只是型)。
|
|
14
|
+
> 既有输入的读数逐字不变:`DrainRequest` / `DrainReceipt` 的键、必填性与两只既有读器对旧体的答(含剥掉未知键)一字未动,没有导出删除或改名,没有拒 / 收结果变化 —— 按 33.0.0 写的消费方零动作可升。同批的文案一处(命令行 `migrate` 拒句里读腿后果那一截改准;诊断面的文字,读数不变)与文书更正,不新增档位理由。
|
|
15
|
+
> 升级:提本版契约包的部署,引擎也要到 ≥ 7.69.0 —— 本包依赖原语包 `@sema-agent/primitives` `^7.69.0`,引擎精确依赖与自己同号的原语包;引擎早于 7.69.0 时装树里有两份原语包,判是同一段代码、行为相同,但「本包转出的就是原语包那一个对象」这类恒等对引擎那一份不成立(README 升级指引 33.0.x → 33.1.0 第 7 条)。
|
|
16
|
+
> 钉:`test/credential-drain-request-33.1.0.test.ts`(标「加性」的两格改前改后都绿)。
|
|
17
|
+
> 本版没有新登记的一次性迁移,也没有到期删码的(发布日 2026-11-22,`SS-M11` / `SS-M12` / `SS-M13` / `SS-M14` 的窗都还开着)。
|
|
18
|
+
|
|
19
|
+
### 排空口的凭据点名形请求体与它的读器
|
|
20
|
+
|
|
21
|
+
**病**:排空口(`POST /v1/admin/drain`)的线上形住在本包 —— 身份四元形 `DrainRequest`、回执 `DrainReceipt`、两只读器。引擎要再认一种请求体:调用方不报身份四元、只出示本进程的起服凭据来点名(「请这一台排空」),并可对这一发多说两件事 —— 受理时正在跑的轮次怎么让出、附着流数不超过几条才受理。这只体若由引擎自己判形、发请求的一侧又各写各的构造,同一只请求体就有两个读者(一个判形、一个判那两位)= 双源,两边的版本一错位就静默分歧。
|
|
22
|
+
|
|
23
|
+
**律(一条)**:同一只请求体只有一只 schema、一只读器,发的一侧与收的一侧读同一份;凭据点名形与它的两位同在本包、同一版到货(没有「先到一半」的版本)。
|
|
24
|
+
|
|
25
|
+
**形**:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
export const DRAIN_TURNS = ["yield", "halt"] as const; // 深冻结;同名的 zod 枚举 `DrainTurns` 也导出
|
|
29
|
+
export type DrainTurns = "yield" | "halt";
|
|
30
|
+
export const CredentialDrainRequest; // 严格对象(`.strict()`)
|
|
31
|
+
export type CredentialDrainRequest = { instanceId?: string; turns?: "yield" | "halt"; attachedAtMost?: number };
|
|
32
|
+
export function readCredentialDrainRequest(body: unknown): CredentialDrainRequest | undefined;
|
|
33
|
+
|
|
34
|
+
export const DRAIN_CONDITION_UNMET_CODE = "conflict.drain_condition_unmet";
|
|
35
|
+
export const DrainConditionUnmet; // zod 对象 { attached, attachedAtMost }
|
|
36
|
+
export type DrainConditionUnmet = { attached: number; attachedAtMost: number };
|
|
37
|
+
export function readDrainConditionUnmet(body: unknown): DrainConditionUnmet | undefined;
|
|
38
|
+
|
|
39
|
+
export type DrainRequestReading = { form: "identity"; request: DrainRequest } | { form: "credential"; request: CredentialDrainRequest };
|
|
40
|
+
export const DRAIN_REQUEST_FORMS = ["identity", "credential"] as const; // 深冻结;与判别联合的 form 恰等
|
|
41
|
+
export function readDrainRequestReading(body: unknown): DrainRequestReading | undefined;
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **三键各自可缺**:缺席 = 不带这一位;**读器不替缺席的键铸缺省值** —— 空体 `{}` 读成 `{}`(没有 `turns` 键、没有 `attachedAtMost` 键)。缺席的含义由**收请求的一侧**落:缺席 `turns` = `yield`、缺席 `attachedAtMost` = 不设条件;本包不导缺省常量。发请求的一侧不带这一位就是要这个含义。
|
|
45
|
+
- **`instanceId`**:非空串,引擎自己的每进程身份;与身份四元形的 `DrainRequest.instanceId` 是**同一只** schema 对象,不是抄的一份。
|
|
46
|
+
- **`turns`**:`DRAIN_TURNS` 两词闭集(字面量联合 ⇒ 写错词在型上编译期红、读器答读不进;按词穷举的 `switch` 加一个词就红)。词义是引擎的行为(本包只定形,不验证行为):`yield` = 排空一贯的让出 —— 在跑的轮次在下一个干净的回合边界停驻,到期限没完成的由硬停切断;`halt` = `yield` 做的都做,同一步里再请求每一只有轮次面的在跑轮次立即停下(用户在那个窗口按 Esc 的同一刀),期限不动,没落上的与 `yield` 同。引擎只对持有「能对任一条运行按 Esc 的运维权力」的调用方认 `halt`,否则拒、什么都不变。
|
|
47
|
+
- **`attachedAtMost`**:非负安全整数(`0` – `9007199254740991`,包内唯一的那一只非负安全整数形),表示「受理这一发的那一拍,附着流数不超过它才受理」;多于它 ⇒ 引擎拒、什么都没变,拒体是下面的 `DrainConditionUnmet`。它只陈述受理那一拍的读数:之后到的新流与新请求不在它的保证里。
|
|
48
|
+
- **严格**:多一键、未知词、负数、小数、串、超出安全整数的数 ⇒ **整份**读不进(好键陪着坏键也不被单独读出)。半截的身份四元形 —— 例如只有 `actionId`、或 `instanceId` 加 `worker` —— 不会被读成停机请求。
|
|
49
|
+
- **读器的总律**同本包别的 wire 读口(`readDrainRequest` 同一只受护读口):形不符 / 非对象 / 访问器抛 / 读时会抛的代理 ⇒ `undefined`,从不抛;只看自有键(继承来的、被污染的同名键不算在场;不可枚举或访问器的自有键 ⇒ 整份读不进,访问器一次都不调)。空请求体(没有字节)由引擎先折成 `{}` 再交给读器;`null` / `undefined` 在这里不是对象。
|
|
50
|
+
- **回执在这一形下**:形仍是 `DrainReceipt`。下面是引擎一侧的行为,本包只定形、不验证:`deadlineAt` 是引擎自己的排空窗(体里不报期限);引擎已在排空时再来 `halt`,答 `already_draining`(第一次的三格)并切此刻在跑的轮次;硬停已在进行时回执的 `actionId` 是 `hard-stop`,`turns` / `attachedAtMost` 都不读;先判点名、后判条件(点名不符的拒不带附着数),已在排空时条件照判。这一形首发回执的 `actionId` 怎么铸、这一形别的请求在排空中答什么,由引擎定,本包不定。
|
|
51
|
+
- **已知的边:交回的是普通对象**(同本包别的 wire 读器,含 `readDrainRequest` 的可选键 `scope` / `expectedGeneration` / `instanceId` / `term`):读器按自有键读输入、不受 `Object.prototype` 污染影响,但交回的对象继承 `Object.prototype` —— 在原型被污染成同名键的进程里,缺席的 `turns` / `attachedAtMost` / `instanceId` 经属性读(`request.turns`)会读到继承来的值。要把「缺席」当含义用的调用方(`turns` 缺席 = `yield`、`attachedAtMost` 缺席 = 不设条件)按自有键读:`Object.hasOwn(request, "turns")`。给全包读器的输出对象统一加隔离是另一件设计事项,本版不改。
|
|
52
|
+
|
|
53
|
+
### 两种请求形并存:互斥;混形哪一形都不是;读请求体只用一只聚合读器
|
|
54
|
+
|
|
55
|
+
**律**:一只排空口请求体要么是身份形、要么是凭据点名形;**两形的键混在一起的体哪一形都不是**。
|
|
56
|
+
|
|
57
|
+
**读请求体只用 `readDrainRequestReading`**:服务端与下游读排空口的请求体都只用这一只 —— 它答这只体是哪一形、并交回那一形读出的请求(判别联合 `DrainRequestReading`:`{ form: "identity", request: DrainRequest }` 或 `{ form: "credential", request: CredentialDrainRequest }`;两形都读不进、或是混形 ⇒ `undefined`),按 `form` 分支,`switch` 穷举形词闭集 `DRAIN_REQUEST_FORMS`(加一个形就编译红)。**混形**:身份四元读器读得进、而体上自有凭据点名形独有的键(`turns` / `attachedAtMost` —— 凭据点名形的键减去两形共有的 `instanceId`,从两只 schema 的键集派生)⇒ `undefined`,那一键的值合法与否同答;按本规则读请求体的服务端对它应答 400、什么都不变(服务端一侧的行为,本包不验证)。条件位或让出方式不会再在身份形上被静默剥掉:要带这两位,发凭据点名形。「体上自有这一键」按本包读器的描述符律判:自有的数据键、不可枚举的自有键、访问器(一次都不调)、描述符读不出,都算带着;只靠继承(`Object.prototype` 被污染)或缺席不算。它组合两只单形读器与这一只键判、不另写第二份 schema:先 `readDrainRequest`、再 `readCredentialDrainRequest`,交回的 `request` 就是那一只在这一次调用里的答:聚合读器读得进时,答案与对应那一形的单形读器相同;反过来不成立 —— 混形的朴素体聚合读器答 `undefined`,单形的身份读器照读(剥掉两位)。读的过程中会改变自己的代理不在此内(聚合读器先问身份形的那一下可能改了它)。两只单形读器留给已知自己发的是哪一形的一侧(例如发请求的一侧在测试里读回自己的体)。
|
|
58
|
+
|
|
59
|
+
身份四元形 `DrainRequest` 必带 `actionId` / `worker` / `deadlineAt`;凭据点名形把这三键当多余键一概拒。所以对朴素数据的体(JSON 解析出来的就是)**没有一只体能被两只单形读器同时读进**,聚合读器先问哪一只不影响结果。已知的边:互斥只对朴素数据说 —— 对两只单形读器露出不同键集的非 JSON 对象(例:`ownKeys` 陷阱谎报键集的 Proxy:身份四元形的读器按声明键问描述符、不列键,凭据点名形的读器要列全部键)两只单形读器会给出不同的答;聚合读器的混形判按独有键逐只问描述符,问到一只 ⇒ 混形、`undefined`,一只都问不到才按序答身份形;请求体来自 JSON 解析的引擎一侧碰不到它。`turns` / `attachedAtMost` 只属于凭据点名形,**不进身份四元形**:单形的身份读器 `readDrainRequest` 照旧剥掉未知键(33.0.0 的既有读法,一字未动),带着它们的四元形体在它那里读成不带它们的 `DrainRequest`;聚合读器把这样的体读成混形、答 `undefined`。回执两形相同,仍是 `DrainReceipt`,形不变。
|
|
60
|
+
|
|
61
|
+
| 请求体 | `readDrainRequest` | `readCredentialDrainRequest` | `readDrainRequestReading` |
|
|
62
|
+
|---|---|---|---|
|
|
63
|
+
| `{ actionId, worker, deadlineAt }`(含其余可选身份键) | 读得进 | 读不进 | `identity` |
|
|
64
|
+
| `{}` · `{ instanceId }` · `{ turns }` · `{ attachedAtMost }` · 三键齐全 | 读不进 | 读得进(原样) | `credential` |
|
|
65
|
+
| 混形:四元形 + `turns` / `attachedAtMost`(值合法与否同答) | 读得进(两位被剥掉) | 读不进 | `undefined`(哪一形都不是) |
|
|
66
|
+
| 半截四元形(缺 `worker` 或 `deadlineAt` 等) | 读不进 | 读不进 | `undefined` |
|
|
67
|
+
| `instanceId` + `worker` | 读不进 | 读不进 | `undefined` |
|
|
68
|
+
|
|
69
|
+
### 条件不满足的拒体:`DRAIN_CONDITION_UNMET_CODE` · `DrainConditionUnmet` · `readDrainConditionUnmet`
|
|
70
|
+
|
|
71
|
+
`attachedAtMost` 不满足时引擎答 409,机读码是 `DRAIN_CONDITION_UNMET_CODE`(`"conflict.drain_condition_unmet"`,一处拼写:引擎铸拒体用它、调用方分支用它),拒体根上除拒的句子 `error` 与码 `errorCode` 外带两个事实 —— `attached`(引擎判的那一拍附着流数)与 `attachedAtMost`(请求设的界,回显)。读法:**先看拒体的机读码,再调 `readDrainConditionUnmet`**;读器不判码 —— 不带这两个事实的体(同一状态码的别的拒、回执、请求体)读成 `undefined`,拒体根上的 `error` / `errorCode` 等键被剥掉。读器只判两个数的形(非负安全整数),**不判两数的大小关系**:「`attached` 大于 `attachedAtMost`」是引擎答这一拒的条件,不是读器的校验。
|
|
72
|
+
|
|
73
|
+
### 三问
|
|
74
|
+
|
|
75
|
+
- **谁需要**:要请一台引擎排空、又不是舰队成员的一方(本机起引擎的终端与客户端核心),以及读这只请求体的引擎(服务端)。身份四元形要求调用方报引擎的 worker 名,没有 worker 名的引擎(本机起的引擎)没法被它点名,只能靠凭据点名。
|
|
76
|
+
- **谁受损**:两处,都照实写。① 后果句改字(见节末更正第一条):逐字比对命令行 `migrate` 的 `refused[].reason` 整句的脚本或钉红一次;只比结论词与退出码的不受影响。② 发混形体(四元形上带 `turns` / `attachedAtMost`)的一方:读请求体改用聚合读器的服务端按本规则对它应由 200(单形的身份读器剥掉两位、照身份形受理)变 400(服务端一侧的行为,本包不验证)。聚合读器是本版才有的,所以对已发的任何版本的导出都没有行为变化 —— `readDrainRequest` 照旧剥掉这两位、读成身份形;变的是本版起「读请求体只用聚合读器」的那一侧。要用这两位,发凭据点名形。
|
|
77
|
+
- **出路**:没有旋钮 —— 不用这一形、不带这两位就是现状;服务端自己写的请求体判形与码字面,提货本版后删掉、改读这里。
|
|
78
|
+
|
|
79
|
+
### 各消费方
|
|
80
|
+
|
|
81
|
+
| 消费方 | 读点 | 动作 |
|
|
82
|
+
|---|---|---|
|
|
83
|
+
| 服务端(排空口) | 请求体只用 `readDrainRequestReading` 读、按 `form` 分支(不自己串两只单形读器);读不进(含混形)答 400;缺席 `turns` 按 `yield`、缺席 `attachedAtMost` 按不设条件处理;条件不满足的拒用 `DRAIN_CONDITION_UNMET_CODE` 与 `DrainConditionUnmet` 的两键铸体 | 提货本版;自己的请求体判形与码字面删掉、改绑这里 |
|
|
84
|
+
| 终端 · 客户端核心(发请求、读回执、读 409) | 发:构造 `CredentialDrainRequest`(`turns` 取 `DRAIN_TURNS` 的词;不往身份四元形上加这两位 —— 那是混形,按本规则读的服务端应答 400);回执:`readDrainReceipt`;409:拒体机读码 = `DRAIN_CONDITION_UNMET_CODE` 再 `readDrainConditionUnmet` | 新代码;不自己写体形判断 |
|
|
85
|
+
| web-admin | 无读点(排空走身份四元形,不变) | 无 |
|
|
86
|
+
| sdk | 契约套件 | 零代码改动(符合性语料不变) |
|
|
87
|
+
| test | 黑盒判据 | 见下面 K25 – K36 |
|
|
88
|
+
|
|
89
|
+
#### 黑盒判据(从包的导出面可执行,不引用内部实现)
|
|
90
|
+
- **K25**:`readCredentialDrainRequest({})` = `{}`(没有任何键);`{ turns: "halt" }`、`{ attachedAtMost: 0 }`、`{ instanceId: "i-1" }`、三键齐全各读成自身。
|
|
91
|
+
- **K26**:`turns` 取 `"yield"` / `"halt"` 读得进;`"stop"` / `"Halt"` / `""` / `1` / `null` 读不进;`DRAIN_TURNS` = `["yield", "halt"]`,深冻结。
|
|
92
|
+
- **K27**:`attachedAtMost` 取 `0` / `1` / `9007199254740991` 读得进;`-1` / `0.5` / `"1"` / `9007199254740992` / `NaN` / `null` 读不进。
|
|
93
|
+
- **K28**:多一键读不进 —— `{ turns: "halt", reason: "x" }`;身份四元形的任一键(`{ actionId: "a" }` / `{ worker: "w" }` / `{ deadlineAt: 1 }` ……)单独或随 `instanceId` 带上都读不进;JSON 里自有的 `__proto__` 键读不进。
|
|
94
|
+
- **K29**:`{ actionId: "a", worker: "w", deadlineAt: 1 }`:`readDrainRequest` 读得进、`readCredentialDrainRequest` 读不进;`{}` 与 `{ instanceId: "i-1", turns: "halt", attachedAtMost: 1 }` 反过来;没有任何一只 JSON 体两只读器同时读进。
|
|
95
|
+
- **K30**:`{ actionId: "a", worker: "w", deadlineAt: 1, turns: "halt" }`:`readDrainRequest` 读成不带 `turns` 的 `DrainRequest`(`turns` 被剥掉);`readCredentialDrainRequest` 读不进;`readDrainRequestReading` 答 `undefined`(混形)。`turns` 换成 `"stop"` / `null`、或换成 `attachedAtMost: 0` / `-1`,三只读器的答同上。
|
|
96
|
+
- **K31**:`readDrainConditionUnmet({ error: "x", errorCode: DRAIN_CONDITION_UNMET_CODE, attached: 2, attachedAtMost: 0 })` = `{ attached: 2, attachedAtMost: 0 }`(只有这两键);缺一个事实、事实不是非负安全整数 ⇒ `undefined`;`{ attached: 0, attachedAtMost: 0 }` 读得进(读器不判大小关系);`DRAIN_CONDITION_UNMET_CODE` = `"conflict.drain_condition_unmet"`。
|
|
97
|
+
- **K32**:访问器 / 不可枚举的自有键 / 读时会抛的代理 / 非对象 / 类实例 ⇒ 两只新读器都答 `undefined`、不抛;访问器一次都不被调用(读 `readCredentialDrainRequest` 的三键与 `readDrainConditionUnmet` 的两键各一格)。
|
|
98
|
+
- **K33**:`Object.prototype` 上挂可枚举的 `turns` / `attachedAtMost` / `instanceId` 时,`readCredentialDrainRequest({})` 仍读成 `{}`;挂 `attached` 时 `readDrainConditionUnmet({ attachedAtMost: 0 })` 仍是 `undefined`。
|
|
99
|
+
- **K34**(加性):`DrainRequest` 的键恰是 `actionId` / `scope` / `worker` / `expectedGeneration` / `instanceId` / `deadlineAt` / `term`;`DrainReceipt` 的键恰是 `actionId` / `since` / `deadlineAt` / `state`,`DRAIN_RECEIPT_STATES` = `["draining", "already_draining"]`;两只既有读器对旧体的答(最小 / 全键 / 剥未知键 / 缺必填 / 坏值)与 33.0.0 逐例相同。
|
|
100
|
+
- **K35**:包根与 `./fleet` 都拿得到七个新名,且是同一个对象;`CredentialDrainRequest.shape.attachedAtMost` 的内层与 `DrainConditionUnmet.shape.attachedAtMost` 是同一只 schema 对象,`CredentialDrainRequest.shape.instanceId` 就是 `DrainRequest.shape.instanceId`。
|
|
101
|
+
- **K36**:`readDrainRequestReading` 对上面那张表的每一行答表里那一形(读得进的行 `request` 与那一形单形读器的答相等、键集相同;两只都读不进或混形 ⇒ `undefined`);`{ actionId: "a", worker: "w", deadlineAt: 1, turns: "halt" }` 答 `undefined`,`{ actionId: "a", worker: "w", deadlineAt: 1, instanceId: "i-1" }`(两形共有的键)答 `{ form: "identity", … }`;四元形上 `turns` 是访问器(不被调用)或不可枚举的自有键 ⇒ `undefined`,只靠 `Object.prototype` 继承来的 `turns` ⇒ 照答 `identity`;`DRAIN_REQUEST_FORMS` = `["identity", "credential"]`,深冻结;包根与 `./fleet` 拿到同一个读器与同一只闭集;非对象 / 读时会抛的代理 ⇒ `undefined`、不抛。
|
|
102
|
+
|
|
103
|
+
#### 导出面
|
|
104
|
+
- **新增**(包根与 `./fleet`,各十名):`DRAIN_TURNS`(值)· `DrainTurns`(值 + 型)· `CredentialDrainRequest`(值 + 型)· `readCredentialDrainRequest`(值)· `DRAIN_CONDITION_UNMET_CODE`(值)· `DrainConditionUnmet`(值 + 型)· `readDrainConditionUnmet`(值)· `DRAIN_REQUEST_FORMS`(值)· `DrainRequestReading`(型)· `readDrainRequestReading`(值);`docs/API-SURFACE.md` 包根 866 → 876、`./fleet` 85 → 95、合计 1615 → 1635。**删除 / 改名**:无。
|
|
105
|
+
- **类型面**:既有导出的型逐字不变。
|
|
106
|
+
|
|
107
|
+
### 更正与写明(三条更正 33.0.0 节与随包文字里说得不准的句子,照实改;两条写明读法;33.0.0 节本身不改字)
|
|
108
|
+
|
|
109
|
+
- **更正 · 「整域拒 + 逐条丢」的后果句**:读腿对一份读不进的逐条丢弃域文档的处置,33.0.0 的后果句(命令行 `migrate` 对在场文档的拒句 `refused[].reason` 里那一截)说的是 `the reader drops the offending entry, or refuses the whole "<域>" domain when no entry can be dropped`(整域退缺省的域同形,`reads the whole "<域>" domain as its default`)—— 「没有条目可丢时」说窄了:整域那一半发生在**抢救之后剩下的仍读不进**时,没有条目可丢(域级的毛病)、一条都救不活(零幸存者)是其中两种,第三种是坏的那一条丢得掉、幸存的条目彼此相撞(例:`projects.json` 里一条键不是 UUID 的登记丢掉之后,剩下两条登记了同一条 remote,读腿照样整域拒)。本版句子改成 `… when what is left after the drop still does not read`。读数不变(读腿的处置一字未动),变的是 `reason` 里这一截文字:逐字比对整句的读者随改。钉:`test/read-diagnostics-33.0.0.test.ts`(⑧ 更正那一格)。
|
|
110
|
+
- **更正 · 命令行 `migrate` 拒句的两臂**:33.0.0 节「律(一条)」说 `refused[]` 的 `reason` 是判官的原句加读腿会怎么处置它与一条出路、剥掉控制符之后再过脱敏器 —— 说宽了,那是**迁移没碰**的文档那一臂。`judge: "present"`(与 `"changed"`)下**迁移改过、改完仍判不过**的那一份,`reason` 是判官的原句本身(`parseDomain` 的 issue 句子,出门前已过本包的脱敏器):不带后果句与出路,没有折成一行,也没有剥控制符;那一份的出路在整份 `why`(`… do not read as a whole domain (see "refused") — fix them by hand and re-run`)。两臂今天各是这样;那一臂的行为本版不动,只把文书写准(README 33.0.0 升级指引第 3 条、`docs/CONSUMER-INTEGRATION.md` §51、`src/config-dir-migration.ts` 入参 `judge` 的注释)。
|
|
111
|
+
- **更正 · 「命令行判官比读腿宽」的范围**:33.0.0 节「已知的边」① 说文档面判官比读腿宽(条目只因带读侧不认识的键,读腿丢那一条、零幸存者时整域退缺省 / 整域拒,命令行仍答干净)—— 缺一个限定:这只在**逐条丢弃域**(`DOMAIN_ENTRY_SALVAGE` 判 `salvage`)里成立,视图面只在那里拒条目体内被剥的键;不逐条丢的域里视图面与文档面一样剥键受理(带一条未知键告警),两边在这一形上答得一样。`src/cli.ts` 头注、`src/config-dir-migration.ts` 两处注释、README(33.0.0 升级指引第 2 条与命令行一节)、`docs/CONSUMER-INTEGRATION.md` §51「已知的边」补上限定。33.0.0 节开头「已存数据先查」那一段里的同一句(「条目只因带读侧不认识的键,读腿丢那一条,集合里每一条都这样时读腿整域退缺省或整域拒,命令行仍答 0」)同样缺这个限定,按本条读。
|
|
112
|
+
- **写明 · `readDrainConditionUnmet` 不判 `errorCode`**(本版新接口的读法,不是对 33.0.0 的更正):读得出两只数不等于「这是条件不满足那一拒」—— 任何根上带两个非负安全整数 `attached` / `attachedAtMost` 的体它都读得出,`errorCode` 是别的码也一样。调用方先比拒体的 `errorCode` 与码常量 `DRAIN_CONDITION_UNMET_CODE`,相等再用它读两只数(README 33.1.0 升级指引第 3 条、`docs/CONSUMER-INTEGRATION.md` §52、`src/fleet.ts` 读器注释同写)。钉:`test/credential-drain-request-33.1.0.test.ts`(「读器不判码」那一格)。
|
|
113
|
+
- **写明 · 读腿告警 `error` 序列化之后剩什么**(33.0.0 起的现形,本版只补钉与这一句,行为不动):`entry-dropped` 告警的 `error` 是 `ZodError`,自有可枚举键恰是 `name` / `message`(`issues` 与 `stack` 不可枚举)—— 把告警整只 `JSON.stringify` 的读者拿到的 `error` 只有这两键,机读请读 `error.issues`。这是现形,不是承诺:`error` 换了型或 `issues` 改成可枚举时,那一格钉翻面、在那一版写明。钉:`test/read-diagnostics-33.0.0.test.ts`(「`error` 的可枚举键集」那一格)。
|
|
114
|
+
|
|
115
|
+
**自 v33.0.0 起运行期代码有改动的公开导出(机器重算;上界 —— 可达 ≠ 一定变,不可达 ⇒ 一定不变;本版新增的导出不入表)**
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
migrateConfigDirectory [./node]
|
|
119
|
+
migrateConfigDocuments [./node]
|
|
120
|
+
```
|
|
121
|
+
|
|
11
122
|
## 33.0.0 — 2026-11-21 — major:命令行 `migrate` 对「迁移不碰、读腿却读不进」的陈旧形由答 `noop` / 退出 0 改答 `refused` / 退出 1、整目录不写(读侧整文档读不进的目录自此不再报干净;内核 `migrateConfigDirectory` 多一个可选入参 `judge`,缺省 = 此前的行为)· 读腿三句诊断补身份 / 后果 / 出路(加性:`domain-defaulted` 多三个可缺的键 `path` / `identity` / `reasonCode`,命令行与同步口的 `refused[]` 多可缺的 `identity`,新导出 `readEntryIdentityAt`;文案:`entry-dropped` 与 `domain-defaulted` 的 `error.message` 由多行 JSON 文本变一句话,`RetiredDomainError` 的拒句尾说出路)
|
|
12
123
|
|
|
13
124
|
> 档位(发版纪律「破坏性变更必 bump major」—— 条文点名「校验收紧或放宽」与「凡是能让一个按上一版契约写的消费方在运行期变红……的改动」):**major**,来由一件 —— 命令行 `migrate`(与 `migrate --check`)对「读侧整文档读不进、而迁移不碰」的存量,退出码由 0 变 1、结论由 `noop` 变 `refused`,混合目录由「可迁的那份写回」变「整目录一字不写」;按 32.0.0 契约写的升级脚本(教运维升级前跑这条命令、拿退出 0 当「可上线」)在运行期变红,字面命中。「CLI 报告形的契约边界」那一条说的是报告形(`outcome` / `written` / `refused` 三字段在、各自的值种类没变 —— `refused[]` 的元素多一只可缺的 `identity`,那一条按 minor 算的加性;退出码表没动),不触发 major;行为收紧触发的是上面那一条。同批另一件是加性与文案(新键 / 新导出 = minor;`error.message` 的文本是诊断面):`domain-defaulted` 多三个可缺的键、`refused[]` 多可缺的 `identity`、新导出 `readEntryIdentityAt`、两条告警与 `RetiredDomainError` 的句子由多行 JSON 文本变一句话 / 尾多出路 —— 随本版发,不新增档位理由。导出名零删除、零改名,只多一只。
|
package/README.md
CHANGED
|
@@ -52,6 +52,19 @@ 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
|
+
## 升级指引:33.0.x → 33.1.0(minor,加性:排空口的「凭据点名形」请求体 `CredentialDrainRequest` / 读器 `readCredentialDrainRequest` / 两词闭集 `DRAIN_TURNS` · 条件不满足的拒体 `DrainConditionUnmet` / `readDrainConditionUnmet` / 码常量 `DRAIN_CONDITION_UNMET_CODE` · 读「请求体是哪一形」的聚合读器 `readDrainRequestReading` / 判别联合 `DrainRequestReading` / 形词闭集 `DRAIN_REQUEST_FORMS`)
|
|
56
|
+
|
|
57
|
+
只加导出(包根与 `./fleet` 各十名),零校验变化、零读数变化 —— 代码零动作可升(逐字比对 `migrate` 拒句的除外,见第 6 条);部署上引擎的版本见第 7 条。逐件的读法表、三问、各消费方表与黑盒判据见 CHANGELOG 33.1.0 与 `docs/CONSUMER-INTEGRATION.md` §52。
|
|
58
|
+
1. **发请求的一侧**(终端、客户端核心):要请一台没有 worker 名的引擎排空,发凭据点名形 —— 严格对象 `{ instanceId?, turns?, attachedAtMost? }`,三键各自可缺,空体 `{}` 是缺省形。`turns` 取 `DRAIN_TURNS` 的词(`yield` = 排空一贯的让出;`halt` = 再请求每一只在跑的轮次立即停下,期限不动),`attachedAtMost` 取非负安全整数(受理这一拍附着流数不超过它才受理)。不要的位就不带(含义见第 4 条,由收方落);不要把这两位加到身份四元形上 —— 那是混形,哪一形都不是;按本规则读请求体的服务端对它应答 400(服务端一侧的行为,本包不验证)。
|
|
59
|
+
2. **读回执的一侧**:回执形不变,仍是 `DrainReceipt`,`readDrainReceipt` 读。
|
|
60
|
+
3. **读 409 的一侧**:先看拒体的机读码是不是 `DRAIN_CONDITION_UNMET_CODE`,是 ⇒ `readDrainConditionUnmet(body)` 读出 `{ attached, attachedAtMost }`(此刻附着流数与请求设的界);这一拒什么都没改变。读器不判码、也不判两数的大小关系:根上带这两只数的体它都读得出,所以先比 `errorCode === DRAIN_CONDITION_UNMET_CODE`,相等再用它读两只数。
|
|
61
|
+
4. **收请求的一侧**(引擎):服务端与下游读请求体都只用 `readDrainRequestReading(body)` 这一只 —— 它答 `{ form: "identity", request: DrainRequest }` 或 `{ form: "credential", request: CredentialDrainRequest }`,两形都读不进 ⇒ `undefined`;按 `form` 分支、穷举 `DRAIN_REQUEST_FORMS`(加一个形就编译红)。它只组合两只单形读器(不另写 schema),交回的 `request` 就是那一只的答;两只单形读器 `readDrainRequest` / `readCredentialDrainRequest` 留给已知自己发的是哪一形的一侧。两种请求形互斥 —— 身份四元形 `DrainRequest` 必带 `actionId` / `worker` / `deadlineAt`,凭据点名形把它们当多余键拒,所以没有一只 JSON 体被两只单形读器同时读进(只对朴素数据说:对两只单形读器露出不同键集的非 JSON 对象,例如 `ownKeys` 陷阱谎报键集的 Proxy,两只会给出不同的答;聚合读器的混形判按独有键逐只问描述符,问到一只 ⇒ `undefined`,一只都问不到才按序答身份形)。聚合读器读得进时,答案与对应那一形的单形读器相同;反过来不成立(混形的朴素体它答 `undefined`,单形身份读器照读)。`turns` / `attachedAtMost` 不进身份四元形:一只体要么是身份形、要么是凭据点名形,**两形的键混在一起的体哪一形都不是** —— 身份形读得进、而体上自有 `turns` 或 `attachedAtMost`(凭据点名形的键减去两形共有的 `instanceId`)⇒ 聚合读器答 `undefined`(值合法与否同答;访问器、不可枚举的自有键也算带着,只靠继承的不算),收方按读不进处理(服务端应答 400 —— 服务端一侧的行为,本包不验证);单形的 `readDrainRequest` 照旧剥掉未知键,读成不带它们的 `DrainRequest`(33.0.0 的既有读法,不动)。缺席的含义由收方落:缺席 `turns` 按 `yield`、缺席 `attachedAtMost` 按不设条件处理;本包不导缺省常量、读器不补键。回执在凭据点名形下各格的来处是引擎一侧的约定,见 CHANGELOG 33.1.0「回执在这一形下」。
|
|
62
|
+
5. **既有导出**:`DrainRequest` / `DrainReceipt` 的形、两只既有读器对旧体的答逐例不变。
|
|
63
|
+
6. **命令行 `migrate` 拒句里读腿后果那一截改准**(文案,读数不变):逐条丢弃域的整域那一半说成 `… when what is left after the drop still does not read`(此前 `… when no entry can be dropped`,说窄了 —— 坏的那一条丢得掉、幸存的条目彼此相撞时读腿照样整域拒 / 整域退缺省)。逐字比对整句 `refused[].reason` 的脚本或钉随改;只比结论词与退出码的零动作。
|
|
64
|
+
7. **引擎版本**:提本版契约包的部署,引擎也要到 ≥ 7.69.0。原因:本包依赖原语包 `@sema-agent/primitives` `^7.69.0`,引擎精确依赖与自己同号的原语包;引擎 ≥ 7.69.0 时装树里只有一份,引擎更早时有两份。两份的判是同一段代码,行为相同;不成立的是函数对象的恒等 —— 本包转出的原语包函数(例:`isAbsoluteHostPath`)与引擎那一份不是同一个函数对象,所以别对引擎早于 7.69.0 的部署写「同一个函数对象」这类断言(数值常量两份值相等,不受影响)。
|
|
65
|
+
|
|
66
|
+
本版没有新登记的一次性迁移。
|
|
67
|
+
|
|
55
68
|
## 升级指引:32.0.x → 33.0.0(BREAKING:命令行 `migrate` 对「迁移不碰、读腿却读不进」的陈旧形由答 `noop` / 退出 0 改答 `refused` / 退出 1、整目录不写;加性:内核入参 `judge`(缺省 = 此前的行为)· `domain-defaulted` 告警多可缺的 `path` / `identity` / `reasonCode` · `refused[]` 多可缺的 `identity` · 新导出 `readEntryIdentityAt`;文案:`entry-dropped` 与 `domain-defaulted` 的 `error.message` 变一句话、`RetiredDomainError` 的拒句尾说出路)
|
|
56
69
|
|
|
57
70
|
只有一件会让按 32.x 写的消费方在运行期变红:命令行的答法(第 1 – 3 条);别的是加性与文案(第 4 – 6 条)。下面任何一条都不碰的部署零动作可升:不拿 `migrate` 的退出 0 当「可上线」· 存量 `config.d` 里没有读侧读不进的文档(`models.json` 里已退役的 `default` 键、带 `#fragment` 的模型 URL、带事实的 `runtime.json`、重名的目录模型一类)· 不逐字比对两条告警的 `error.message` 或 `RetiredDomainError` 的整句 · 不对告警对象恰等 `{ domain, kind, error }`、也不对 `refused[]` 的整对象做深相等。逐件的读数表、三问、各消费方表与黑盒判据见 CHANGELOG 33.0.0 各小节与 `docs/CONSUMER-INTEGRATION.md` §51。
|
|
@@ -60,9 +73,9 @@ only (`node:crypto`, `node:fs`). The machine gate is `test/runtime-dependencies-
|
|
|
60
73
|
|
|
61
74
|
1. **律**:命令行问的是「这个目录现在干不干净」—— 在场的**每一份**覆盖面内文档过文档面那几只判官(域 `parseDomain`、`remote-exec.json` 的 `parseRemoteExecDocument`、退役域的墓碑判),不过 ⇒ `refused`、退出 1、一字不写;`migrate` 与 `migrate --check` 同判。此前迁移不碰的文档永不被判:陈旧形(`models.json` 里已退役的 `default` 键、带 `#fragment` 的模型 URL、带事实的 `runtime.json`)与别的读侧读不进的文档(例:重名的目录模型)都报 `noop` / 退出 0。
|
|
62
75
|
2. **读数变化**:同一个目录,此前 `noop` / 退出 0,现在 `refused` / 退出 1;同目录里还有可迁的文档时,此前可迁的那份被写回、现在整目录一字不写(`--check` 同判,不是 `pending`);迁移步拒收的坐标与读不进的陈旧文档并在一份 `refused[]` 里。`outcome` / `written` / `refused` 三字段的形与退出码表(0 / 1 / 2 / 3)不变;读得进的目录、只有可迁的文档、退役域的空文件 `{}` 照旧。**已知的边**:判官是文档面那一只(`parseDomain`),它与读腿(视图面)两个方向上答得不一样 ——
|
|
63
|
-
①
|
|
76
|
+
① 比读腿宽(只在逐条丢弃域里 —— 读腿只在那里拒条目体内被剥的键;不逐条丢的域两边都剥键受理、答得一样):条目只因带读侧不认识的键,文档面剥键受理,命令行仍答 `noop`、退出 0;读腿丢那一条,而集合里每一条都这样(零幸存者)时读腿整域退缺省(`models` 读成空目录)或整域拒(`DOMAIN_READ_FALLBACK` 判 `throw` 的域);
|
|
64
77
|
② 比读腿严:逐条丢弃域里一条在 schema 下不过的条目,读腿只丢它、其余照读,命令行整目录 `refused`、退出 1。要两边答同一句,得让命令行改问读腿的判官,那是另一件设计事项。
|
|
65
|
-
3. **动作**:脚本里拿 `migrate` 的退出 0 当「可上线」的,同样的输入升级后得 1 ——
|
|
78
|
+
3. **动作**:脚本里拿 `migrate` 的退出 0 当「可上线」的,同样的输入升级后得 1 —— 这正是要的。按报告里的出路句手改存量(迁移没碰的文档每条拒都带后果与出路句;迁移改过、改完仍判不过的那一份的拒是判官的原句,不带后果与出路,出路在整份 `why`:手改后重跑)(陈旧键删掉并把值写到它今天住的位置;URL 去掉 `#` 及其后;退役域文件把值抄到新位置后删文件;重名的改名),再跑。没有旋钮、没有自动迁移(这些形迁移本来就不改写)。
|
|
66
79
|
4. **内核入参 `judge`**(加性):`migrateConfigDirectory(dir, { documents, io, check?, judge? })`,缺省 `"changed"` = 此前的行为(只判迁移改过的文档),命令行传 `"present"`;`undefined` 与 `null` 按缺省读,写成别的非枚举值抛 `TypeError`。同步口 `migrateConfigDocuments` 不变、没有这个入参。不传的调用方读数不变。
|
|
67
80
|
5. **告警对象与拒收单的新键**(加性):`domain-defaulted` 多可缺的 `path`(触发的坐标)· `identity`(坐标落进的那一条条目是谁;条目本身没坏、只是重名 / 悬空引用把整域拒了,也有)· `reasonCode`(条目本身坏才有);三键不进符合性投影。命令行 / 同步口的 `refused[]` 与型 `ConfigDirectoryRefusal` 多可缺的 `identity`。新导出 `readEntryIdentityAt(doc, path)`(包根与 `./config-fns`;坐标落在数组里的一条条目下才有答案)。动作:对告警对象或 `refused[]` 整对象深相等的钉与夹具红一次,补上这些键(或改成按键读)。
|
|
68
81
|
6. **诊断句变一句话**(文案):`entry-dropped` 与 `domain-defaulted` 的 `error.message` 由多行 JSON 数组文本(或包自己那一句)变一句话(谁 · 为什么 · 后果 · 在这份文档里手改什么);`RetiredDomainError.message`(与 `retiredDomainSentence`、文件层 `retired_domain` 拒的 `error`)尾多出路。`error` 的型(`ZodError` / `TypeError`,仍是 `Error` 的实例、带 `stack`)与 `issues` 不变,机读读它们;句子出门前过本包的脱敏器(剥掉控制符之后再判一次);公开的 `salvageEntries().dropped[].error` 与 `DomainReadRefusedError` 的 `cause` 不变。动作:逐字比对这些 `message`、或 `JSON.parse(error.message)` 的,改读 `error.issues` 与告警上的键。
|
|
@@ -598,7 +611,7 @@ settings 单元读不进的成员**不是缺席**(`loosen` 可丢且要响,`tigh
|
|
|
598
611
|
- **目录形**:`npx @sema-agent/settings-schema migrate <config.d directory> [--check]`(同一只函数;目录当一个 scope;有 refused 一字不写、退出 1;
|
|
599
612
|
`--check` 有改动退出 3)。命令行问的是「这个目录现在干不干净」:在场的**每一份**文档过文档面的整文档判官(`parseDomain` 一类),判不过的文档 —— 迁移不再改写的陈旧形
|
|
600
613
|
(`models.json` 里已退役的 `default` 键、带 `#fragment` 的模型 URL、带事实的 `runtime.json`)与任何别的整文档判不过的文档 —— 也是 refused、退出 1、一字不写:`refused[]` 点名文档与坐标并给出路(手改后重跑)。
|
|
601
|
-
文档面与读腿两个方向上答得不一样(升级指引 33.0.0 第 2 条的已知的边)
|
|
614
|
+
文档面与读腿两个方向上答得不一样(升级指引 33.0.0 第 2 条的已知的边):逐条丢弃域里条目只因带读侧不认识的键,这里答干净而读腿丢那一条(零幸存者时整域退缺省 / 整域拒;不逐条丢的域两边都剥键受理);逐条丢弃域里一条坏条目,读腿只丢它而这里整目录拒。
|
|
602
615
|
参数是 `config.d` 目录**本身**(里面直接放 `<域>.json`):目录里有条目却没有一份域文档 —— 填成了它的上一层、只有
|
|
603
616
|
`remote-exec.json` 之类非域文件 —— 退出 2、stdout 空,stderr 点名这个目录(`<目录>/config.d` 在场就直接点它);目录真空(零条目,或只有以 `.` 开头的条目)是合法态
|
|
604
617
|
(新部署的空 `config.d`),和「有域文档、只是没有要改的」一样是 noop、退出 0。
|
|
@@ -1159,6 +1172,23 @@ settings 单元读不进的成员**不是缺席**(`loosen` 可丢且要响,`tigh
|
|
|
1159
1172
|
(`servingLease?: true` — absent means web-admin has no lease, so the engine neither renews nor is fenced), the drain
|
|
1160
1173
|
endpoint's `DrainRequest` / `DrainReceipt`, one reader per wire shape, and the env name `FLEET_GENERATION_ENV` are defined
|
|
1161
1174
|
here once for the renderer and the engine (an instance's id is minted by the engine per process — it has no env name).
|
|
1175
|
+
**33.1.0** (additive) gives the drain endpoint a second request body, the credential-named form: the caller names the engine by the
|
|
1176
|
+
credential it presents instead of the identity quadruple, and the body says only what is to be said about this call — a STRICT
|
|
1177
|
+
object `CredentialDrainRequest { instanceId?, turns?, attachedAtMost? }` read by `readCredentialDrainRequest` (every key optional,
|
|
1178
|
+
`{}` is the default form, a reader never mints a missing key; `turns` is the two-word closed set `DRAIN_TURNS` = `yield | halt`,
|
|
1179
|
+
`attachedAtMost` a non-negative safe integer — accept only if at most that many streams are attached when the call is judged; one key
|
|
1180
|
+
more, an unknown word or a bad count reads as `undefined`). The two request forms share no plain-data body — `DrainRequest` requires
|
|
1181
|
+
`actionId` / `worker` / `deadlineAt`, which the credential-named form refuses — and `turns` / `attachedAtMost` do not travel in the
|
|
1182
|
+
identity form: a body is one form or the other, and a body that mixes their keys (an identity body carrying `turns` or
|
|
1183
|
+
`attachedAtMost` as its own key, whatever the value) is neither — the request-body reader below answers `undefined`, while the
|
|
1184
|
+
single-form `readDrainRequest` still strips unknown keys. An absent `turns` is `yield` and an absent `attachedAtMost` sets no
|
|
1185
|
+
condition; the receiving side applies that, no default constant is exported. The receipt is the same `DrainReceipt`. A refused condition is the 409 whose
|
|
1186
|
+
machine code is `DRAIN_CONDITION_UNMET_CODE` and whose body carries `DrainConditionUnmet { attached, attachedAtMost }`, read by
|
|
1187
|
+
`readDrainConditionUnmet` (the reader does not judge the code or the order of the two numbers). The server and every downstream
|
|
1188
|
+
reader of the request body use one reader only, `readDrainRequestReading`: it answers which form the body is —
|
|
1189
|
+
`{ form: "identity", request: DrainRequest }` or `{ form: "credential", request: CredentialDrainRequest }` (the closed form words are
|
|
1190
|
+
`DRAIN_REQUEST_FORMS`), `undefined` when neither reads — by composing the two single-form readers, no second schema; the two
|
|
1191
|
+
single-form readers stay for a side that already knows which form it sent.
|
|
1162
1192
|
**8.2.0** (additive) adds the engine's lease vocabulary `LEASE_STATES` (`none | granted | expired | denied`) as
|
|
1163
1193
|
`EngineSignal.leaseState?`, keeps `generation` / `leaseState` / `leaseUntil` on the heartbeat (`InstanceAnnouncement` no longer
|
|
1164
1194
|
strips them; a malformed one drops to absent, the heartbeat still lands), spells web-admin's fleet endpoints once —
|
package/conformance/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
33.
|
|
1
|
+
33.1.0
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `api/wire-scalars` ——
|
|
2
|
+
* `api/wire-scalars` —— 包内私有模块(不在主桶、不在任何子路径):各 wire 模块共用的标量形,一处定义、各处引用。
|
|
3
3
|
*
|
|
4
|
-
* 这几只形此前是 `api/credentials` 的模块私有常量;第二个 wire 模块(`api/lifecycle-events`)要同样的形时,不抄第二份 —— 挪到这里,两处 import
|
|
4
|
+
* 这几只形此前是 `api/credentials` 的模块私有常量;第二个 wire 模块(`api/lifecycle-events`)要同样的形时,不抄第二份 —— 挪到这里,两处 import;
|
|
5
|
+
* fleet 契约(`fleet.ts`,排空口的条件位与条件不满足那一拒的两个事实)也从这里取 {@link SafeCount}。
|
|
5
6
|
* 不导出给消费方:消费方要的是 wire 型(`SandboxGitCredentialAnswer` / `PrincipalLifecycleEvent` …),不是这几只积木。纯、浏览器安全。
|
|
6
7
|
*/
|
|
7
8
|
import { z } from "zod";
|
package/dist/api/wire-scalars.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `api/wire-scalars` ——
|
|
2
|
+
* `api/wire-scalars` —— 包内私有模块(不在主桶、不在任何子路径):各 wire 模块共用的标量形,一处定义、各处引用。
|
|
3
3
|
*
|
|
4
|
-
* 这几只形此前是 `api/credentials` 的模块私有常量;第二个 wire 模块(`api/lifecycle-events`)要同样的形时,不抄第二份 —— 挪到这里,两处 import
|
|
4
|
+
* 这几只形此前是 `api/credentials` 的模块私有常量;第二个 wire 模块(`api/lifecycle-events`)要同样的形时,不抄第二份 —— 挪到这里,两处 import;
|
|
5
|
+
* fleet 契约(`fleet.ts`,排空口的条件位与条件不满足那一拒的两个事实)也从这里取 {@link SafeCount}。
|
|
5
6
|
* 不导出给消费方:消费方要的是 wire 型(`SandboxGitCredentialAnswer` / `PrincipalLifecycleEvent` …),不是这几只积木。纯、浏览器安全。
|
|
6
7
|
*/
|
|
7
8
|
import { z } from "zod";
|
package/dist/cli.d.ts
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* 退出码:0 = 已写回 / 无事可做(目录里的文档都过了文档面的整文档判、只是没有要改的,或目录真空);1 = 有迁不了的坐标(收据 `refused`)**或**在场的某份文档整文档判不过(整域终判,见 `migrateConfigDirectory` 的 `judge: "present"`:
|
|
18
18
|
* 含迁移不碰的陈旧形 —— `models.json` 里 retired 的 `default` 键、带 `#fragment` 的模型 URL、带事实的 `runtime.json` 一类:文档面判官判不过的文档不能报成「无事可做」;
|
|
19
|
-
* 判官是文档面那一只,与读腿两个方向上不同 ——
|
|
19
|
+
* 判官是文档面那一只,与读腿两个方向上不同 —— 比读腿宽(只在逐条丢弃域里:读腿只在那里拒条目体内被剥的键;不逐条丢的域两边都剥键受理、答得一样):条目只因带读侧不认识的键,读腿丢那一条、集合里每一条都这样时整域退缺省 / 整域拒,这里仍答 0;
|
|
20
20
|
* 比读腿严:逐条丢弃域里一条 schema 不过的条目,读腿只丢它,这里整目录拒),**一字不写**;
|
|
21
21
|
* 2 = 用法错,或**环境错**(读目录 / 读文件 / 写盘的 I/O 错:权限、磁盘、悬空符号链接 …;stdout 空、stderr 一行点名路径与 errno,不打栈;句子按落点分句、
|
|
22
22
|
* 一律出自文件系统失败句的唯一铸点 `./fs-failure` —— 例:目录建不出文件 ⇒ 点名目录、目标换不掉 ⇒ 点名文件,句尾是对应出路)——
|
package/dist/cli.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* 退出码:0 = 已写回 / 无事可做(目录里的文档都过了文档面的整文档判、只是没有要改的,或目录真空);1 = 有迁不了的坐标(收据 `refused`)**或**在场的某份文档整文档判不过(整域终判,见 `migrateConfigDirectory` 的 `judge: "present"`:
|
|
18
18
|
* 含迁移不碰的陈旧形 —— `models.json` 里 retired 的 `default` 键、带 `#fragment` 的模型 URL、带事实的 `runtime.json` 一类:文档面判官判不过的文档不能报成「无事可做」;
|
|
19
|
-
* 判官是文档面那一只,与读腿两个方向上不同 ——
|
|
19
|
+
* 判官是文档面那一只,与读腿两个方向上不同 —— 比读腿宽(只在逐条丢弃域里:读腿只在那里拒条目体内被剥的键;不逐条丢的域两边都剥键受理、答得一样):条目只因带读侧不认识的键,读腿丢那一条、集合里每一条都这样时整域退缺省 / 整域拒,这里仍答 0;
|
|
20
20
|
* 比读腿严:逐条丢弃域里一条 schema 不过的条目,读腿只丢它,这里整目录拒),**一字不写**;
|
|
21
21
|
* 2 = 用法错,或**环境错**(读目录 / 读文件 / 写盘的 I/O 错:权限、磁盘、悬空符号链接 …;stdout 空、stderr 一行点名路径与 errno,不打栈;句子按落点分句、
|
|
22
22
|
* 一律出自文件系统失败句的唯一铸点 `./fs-failure` —— 例:目录建不出文件 ⇒ 点名目录、目标换不掉 ⇒ 点名文件,句尾是对应出路)——
|
|
@@ -55,10 +55,10 @@ export interface MigrateConfigDirectoryOptions {
|
|
|
55
55
|
* · `"changed"`(缺省)—— 问「**迁移有没有把它改坏**」:只判迁移改过的文档(要写回的那一份必须读得进);迁移没碰的文档读不读得进是读者的事。引擎起服对本地 `config.d`
|
|
56
56
|
* 的迁移问的是这一问:一份陈旧的文档不该挡住同目录里别的文档的迁移(同一个目录里别的可迁文档照迁,陈旧的那份由读腿按它的墓碑 / 档位处置);
|
|
57
57
|
* · `"present"` —— 问「**这个目录现在干不干净**」:在场的**每一份**覆盖面内文档都判(含 retired 域:带事实的墓碑文档读侧拒,这里同拒),判官是文档面那几只
|
|
58
|
-
* (`parseDomain` / `parseRemoteExecDocument` / 墓碑判 `refuseRetiredDomain`,不另写第二份判形)。不过 ⇒ `refused`、一字不写,`refused[]`
|
|
59
|
-
*
|
|
58
|
+
* (`parseDomain` / `parseRemoteExecDocument` / 墓碑判 `refuseRetiredDomain`,不另写第二份判形)。不过 ⇒ `refused`、一字不写,`refused[]` 点名文档与坐标;迁移没碰的那几份,`reason` 说读腿会怎么处置它与出路;
|
|
59
|
+
* 迁移改过、改完仍判不过的那一份(两个值下都有),`reason` 是判官的原句(`parseDomain` 出门前已脱敏;不带后果与出路、不折行、不剥控制符),出路在整份 `why`(手改后重跑)。命令行 `migrate`(`--check` 与真跑都传它)问的是这一问:运维跑完它不该带着一份文档面判不过的文档上线。
|
|
60
60
|
* 判官是文档面那一只(`parseDomain`),它与读腿(视图面)两个方向上不同,这一问的答案因此不等于「读腿读不读得干净」(已知的边):
|
|
61
|
-
* 比读腿宽
|
|
61
|
+
* 比读腿宽(只在逐条丢弃域里:视图面只在那里拒条目体内被剥的键;不逐条丢的域两面都剥键受理、答得一样)—— 条目只因带读侧不认识的键,文档面剥键受理:视图面丢那一条,集合里每一条都这样(零幸存者)时整域退缺省(`models` 读成空目录)/ 整域拒,这一问仍答「干净」;
|
|
62
62
|
* 比读腿严 —— 逐条丢弃域里一条 schema 不过的条目:视图面只丢它、其余照读,这一问答 `refused`。
|
|
63
63
|
*/
|
|
64
64
|
readonly judge?: "changed" | "present";
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* · `no-documents`—— 覆盖面内一份文档都没找到;带回目录清单 `entries`(调用方自己判这是「填错了目录」还是「真空的新目录」)。一字不写。
|
|
17
17
|
* · `refused` —— 迁移步拒(收据 `refused`:要猜才改得动的形)**或**整域终判不过(名字 / 路由唯一这类跨行规则只有整域判得出):缺省只判要写回的文档;入参 `judge: "present"` 时在场的每一份文档都判
|
|
18
18
|
* (含迁移不碰的陈旧形:带事实的 retired 域文档、已不迁移的旧键与旧值 —— 文档面判官判不过的,这里同拒)。一字不写。判官是文档面那一只,与读腿(视图面)两个方向上不同:
|
|
19
|
-
* 比读腿宽
|
|
19
|
+
* 比读腿宽(只在逐条丢弃域里:视图面只在那里拒条目体内被剥的键;不逐条丢的域两面都剥键受理、答得一样)—— 条目只因带读侧不认识的键:
|
|
20
|
+
* 视图面丢那一条,集合里每一条都这样(零幸存者)时整域退缺省 / 整域拒,文档面剥键受理、这里判得过;
|
|
20
21
|
* 比读腿严 —— 逐条丢弃域里一条 schema 不过的条目:视图面只丢它、其余照读,这里整份拒。
|
|
21
22
|
* · `noop` —— 读到了文档、没有要改的。
|
|
22
23
|
* · `pending` —— `check: true` 且有改动、整域判得过:一字不写。
|
package/dist/declared-capture.js
CHANGED
|
@@ -54,7 +54,7 @@ const shapeOf = (object) => object._zod.def.shape;
|
|
|
54
54
|
const isPlainUnion = (schema) => schema instanceof z.ZodUnion && !(schema instanceof z.ZodDiscriminatedUnion);
|
|
55
55
|
/** 寻常对象从 `Object.prototype` 继承来的成员名(ES 规定的闭集)。声明键叫这些名字时,zod 在调用方的值上 `[[Get]]` 读到继承来的成员,投影把它读成缺席 —— 两边不同答。 */
|
|
56
56
|
const ORDINARY_OBJECT_MEMBERS = new Set(["constructor", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "toLocaleString", "toString", "valueOf", "__proto__", "__defineGetter__", "__defineSetter__", "__lookupGetter__", "__lookupSetter__"]);
|
|
57
|
-
/** 走过白名单门的 schema(按根;fleet
|
|
57
|
+
/** 走过白名单门的 schema(按根;fleet 每次请求都是那几只固定的 schema,不重走)。 */
|
|
58
58
|
const ADMITTED = new WeakSet();
|
|
59
59
|
/** 白名单门(见文件头):整棵 schema 树只含放行的形 ⇒ 记下、交回 `undefined`;否则交回不支持的那一句(见 {@link Refusal})。与 `evaluate` / `snapshotOf` 同一套判据(`isPlainUnion` / `innerOf`)。 */
|
|
60
60
|
function admit(schema) {
|
package/dist/fleet.d.ts
CHANGED
|
@@ -111,8 +111,8 @@ export declare function compareGeneration(a: string, b: string): -1 | 0 | 1;
|
|
|
111
111
|
export declare const LEASE_STATES: readonly ["none", "granted", "expired", "denied"];
|
|
112
112
|
export declare const LeaseState: z.ZodEnum<{
|
|
113
113
|
none: "none";
|
|
114
|
-
granted: "granted";
|
|
115
114
|
expired: "expired";
|
|
115
|
+
granted: "granted";
|
|
116
116
|
denied: "denied";
|
|
117
117
|
}>;
|
|
118
118
|
export type LeaseState = z.infer<typeof LeaseState>;
|
|
@@ -283,7 +283,9 @@ export declare function readModelRefusals(body: unknown): ModelRefusalsSignal |
|
|
|
283
283
|
/**
|
|
284
284
|
* The engine's draining fact — ONE object wherever the engine says "I am draining": inside {@link EngineSignal}`.draining`
|
|
285
285
|
* and as the body of a {@link DrainReceipt}.
|
|
286
|
-
* - `actionId` — the action that put the engine into draining
|
|
286
|
+
* - `actionId` — the action that put the engine into draining: for a request of the identity form ({@link DrainRequest}) its `actionId`, the
|
|
287
|
+
* idempotency key; a request of the credential-named form ({@link CredentialDrainRequest}) carries none, and how the engine mints this one
|
|
288
|
+
* for it is the engine's to define (this package does not).
|
|
287
289
|
* - `since` — epoch ms when draining began; it does not move when the same action repeats.
|
|
288
290
|
* - `deadlineAt` — epoch ms by which the engine stops on its own.
|
|
289
291
|
*/
|
|
@@ -342,8 +344,8 @@ export declare const EngineSignal: z.ZodObject<{
|
|
|
342
344
|
generation: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
|
|
343
345
|
leaseState: z.ZodOptional<z.ZodEnum<{
|
|
344
346
|
none: "none";
|
|
345
|
-
granted: "granted";
|
|
346
347
|
expired: "expired";
|
|
348
|
+
granted: "granted";
|
|
347
349
|
denied: "denied";
|
|
348
350
|
}>>;
|
|
349
351
|
leaseUntil: z.ZodOptional<z.ZodNumber>;
|
|
@@ -385,8 +387,8 @@ export declare const InstanceHealth: z.ZodObject<{
|
|
|
385
387
|
generation: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
|
|
386
388
|
leaseState: z.ZodOptional<z.ZodEnum<{
|
|
387
389
|
none: "none";
|
|
388
|
-
granted: "granted";
|
|
389
390
|
expired: "expired";
|
|
391
|
+
granted: "granted";
|
|
390
392
|
denied: "denied";
|
|
391
393
|
}>>;
|
|
392
394
|
leaseUntil: z.ZodOptional<z.ZodNumber>;
|
|
@@ -457,8 +459,8 @@ export declare const InstanceAnnouncement: z.ZodObject<{
|
|
|
457
459
|
generation: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
|
|
458
460
|
leaseState: z.ZodOptional<z.ZodEnum<{
|
|
459
461
|
none: "none";
|
|
460
|
-
granted: "granted";
|
|
461
462
|
expired: "expired";
|
|
463
|
+
granted: "granted";
|
|
462
464
|
denied: "denied";
|
|
463
465
|
}>>;
|
|
464
466
|
leaseUntil: z.ZodOptional<z.ZodNumber>;
|
|
@@ -506,8 +508,8 @@ export declare const InstanceRegistration: z.ZodObject<{
|
|
|
506
508
|
generation: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
|
|
507
509
|
leaseState: z.ZodOptional<z.ZodEnum<{
|
|
508
510
|
none: "none";
|
|
509
|
-
granted: "granted";
|
|
510
511
|
expired: "expired";
|
|
512
|
+
granted: "granted";
|
|
511
513
|
denied: "denied";
|
|
512
514
|
}>>;
|
|
513
515
|
leaseUntil: z.ZodOptional<z.ZodNumber>;
|
|
@@ -776,7 +778,8 @@ export declare const DrainRequest: z.ZodObject<{
|
|
|
776
778
|
}, z.core.$strip>;
|
|
777
779
|
export type DrainRequest = z.infer<typeof DrainRequest>;
|
|
778
780
|
/** What a drain request leaves the engine in: `draining` — this call put it into draining; `already_draining` — it already was
|
|
779
|
-
* (the same action repeated), and the receipt reports the first call's facts.
|
|
781
|
+
* (for the identity form: the same action repeated), and the receipt reports the first call's facts. For the credential-named form see
|
|
782
|
+
* {@link CredentialDrainRequest}. */
|
|
780
783
|
export declare const DRAIN_RECEIPT_STATES: readonly ["draining", "already_draining"];
|
|
781
784
|
export declare const DrainReceiptState: z.ZodEnum<{
|
|
782
785
|
draining: "draining";
|
|
@@ -799,6 +802,121 @@ export type DrainReceipt = z.infer<typeof DrainReceipt>;
|
|
|
799
802
|
export declare function readDrainRequest(body: unknown): DrainRequest | undefined;
|
|
800
803
|
/** Caller side: the drain endpoint's answer. Shape mismatch / non-object / throwing accessor ⇒ `undefined`, never throws. */
|
|
801
804
|
export declare function readDrainReceipt(body: unknown): DrainReceipt | undefined;
|
|
805
|
+
/**
|
|
806
|
+
* The two words of {@link CredentialDrainRequest}`.turns` — a CLOSED set, owned here (a reader that switches on it exhaustively is told
|
|
807
|
+
* by the compiler when a word is added): how the turns that are running at the moment the engine accepts the drain give way. This package
|
|
808
|
+
* fixes the words; what each word does is engine-side behaviour, described here and not verified by this package.
|
|
809
|
+
* - `yield` — the way a drain always stops them: a running turn parks at its next clean turn boundary, and what has not finished when the
|
|
810
|
+
* deadline passes is cut by the hard stop. An absent `turns` means `yield`.
|
|
811
|
+
* - `halt` — everything `yield` does, and in the same step the engine asks every running turn that has a turn surface to stop now — the
|
|
812
|
+
* cut a user's Esc makes in that window. The deadline does not move; a turn that does not take the cut in time is handled as under
|
|
813
|
+
* `yield`. The engine honours it only for a caller that holds the operator authority to halt any run; otherwise it refuses and changes nothing.
|
|
814
|
+
*/
|
|
815
|
+
export declare const DRAIN_TURNS: readonly ["yield", "halt"];
|
|
816
|
+
export declare const DrainTurns: z.ZodEnum<{
|
|
817
|
+
yield: "yield";
|
|
818
|
+
halt: "halt";
|
|
819
|
+
}>;
|
|
820
|
+
export type DrainTurns = z.infer<typeof DrainTurns>;
|
|
821
|
+
/**
|
|
822
|
+
* The drain endpoint's request in its CREDENTIAL-NAMED form: the sender (the side that sends the request) names the engine by the credential it
|
|
823
|
+
* presents (the one a launcher minted for this process), not by the identity quadruple of {@link DrainRequest} — so the body carries no action
|
|
824
|
+
* id, no worker, no deadline, only what is to be said about THIS call. A STRICT object: one key more, one word off, a negative / fractional /
|
|
825
|
+
* string / oversize count ⇒ the body is not this form (and a half-built {@link DrainRequest} is never read as a stop request). Every key is
|
|
826
|
+
* optional and the empty body `{}` is the whole default form. A reader never mints a key the sender did not write, and this package exports
|
|
827
|
+
* no default constant: the RECEIVING side applies the meaning of an absent key — an absent `turns` is `yield`, an absent `attachedAtMost`
|
|
828
|
+
* sets no condition.
|
|
829
|
+
* - `instanceId` — a non-empty string: the engine's own per-process identity ({@link InstanceHealth}`.instanceId`). When present the engine
|
|
830
|
+
* compares it with its own and refuses on a mismatch. The very schema of {@link DrainRequest}`.instanceId`, not a copy.
|
|
831
|
+
* - `turns` — how the turns running at acceptance give way ({@link DRAIN_TURNS}).
|
|
832
|
+
* - `attachedAtMost` — a non-negative safe integer: accept the drain only if at most this many streams are attached to the engine at the
|
|
833
|
+
* moment it judges the request; more ⇒ a refusal carrying {@link DrainConditionUnmet}, nothing changed. It bounds what was attached at that moment;
|
|
834
|
+
* it is not a promise about the streams and requests that arrive afterwards.
|
|
835
|
+
* The two forms of the endpoint's request share no body that is plain data (what JSON parsing yields): {@link DrainRequest} requires
|
|
836
|
+
* `actionId`, `worker` and `deadlineAt`, which this form refuses as unknown keys. `turns` and `attachedAtMost` belong to this form only —
|
|
837
|
+
* {@link DrainRequest} does not carry them; its single-form reader strips them like any unknown key, and the reader of the endpoint's body
|
|
838
|
+
* ({@link readDrainRequestReading}) reads an identity body that carries either of them as neither form. The answer is the same
|
|
839
|
+
* {@link DrainReceipt} shape for both forms. What the engine puts in it for this form — engine-side behaviour, which this package does not
|
|
840
|
+
* verify: `deadlineAt` is the engine's own drain window (the body names no deadline); a `halt` sent while the engine is already draining is
|
|
841
|
+
* answered `already_draining` with the first call's facts and cuts the turns running at that moment; while the hard stop is under way the
|
|
842
|
+
* receipt's `actionId` is `hard-stop` and neither `turns` nor `attachedAtMost` is read; the naming is judged before the condition (a naming
|
|
843
|
+
* mismatch is refused without the attached count), and the condition is judged even when the engine is already draining. How the engine
|
|
844
|
+
* mints the receipt's `actionId` for this form, and what it answers for other requests of this form sent while it is draining, is the
|
|
845
|
+
* engine's to define; this package does not.
|
|
846
|
+
*/
|
|
847
|
+
export declare const CredentialDrainRequest: z.ZodObject<{
|
|
848
|
+
instanceId: z.ZodOptional<z.ZodString>;
|
|
849
|
+
turns: z.ZodOptional<z.ZodEnum<{
|
|
850
|
+
yield: "yield";
|
|
851
|
+
halt: "halt";
|
|
852
|
+
}>>;
|
|
853
|
+
attachedAtMost: z.ZodOptional<z.ZodNumber>;
|
|
854
|
+
}, z.core.$strict>;
|
|
855
|
+
export type CredentialDrainRequest = z.infer<typeof CredentialDrainRequest>;
|
|
856
|
+
/**
|
|
857
|
+
* Engine side: the request body of the drain endpoint in its credential-named form. Shape mismatch / non-object / throwing accessor ⇒
|
|
858
|
+
* `undefined`, never throws. A body of the identity form ({@link DrainRequest}) reads `undefined` here and a body of this form reads
|
|
859
|
+
* `undefined` for {@link readDrainRequest}: no plain-data body is read by both (an object that shows two different key sets to the two
|
|
860
|
+
* readers — a Proxy whose `ownKeys` trap lies — is outside that promise; a body parsed from JSON never is one). A request with no bytes is
|
|
861
|
+
* the engine's to turn into `{}` before it calls this reader (`undefined` and `null` are not objects here).
|
|
862
|
+
* The result is an ordinary object, like every reader's in this file: the reader looks only at the body's own keys, but an optional key it
|
|
863
|
+
* did not read is absent only as an own key — test for it with `Object.hasOwn`, do not read it through the prototype chain.
|
|
864
|
+
*/
|
|
865
|
+
export declare function readCredentialDrainRequest(body: unknown): CredentialDrainRequest | undefined;
|
|
866
|
+
/**
|
|
867
|
+
* What {@link readDrainRequestReading} makes of a drain request body: which of the endpoint's two forms it is, and the request read in
|
|
868
|
+
* that form — the identity quadruple ({@link DrainRequest}) or the credential-named form ({@link CredentialDrainRequest}). Branch on
|
|
869
|
+
* `form`; each arm's `request` has that form's type.
|
|
870
|
+
*/
|
|
871
|
+
export type DrainRequestReading = {
|
|
872
|
+
form: "identity";
|
|
873
|
+
request: DrainRequest;
|
|
874
|
+
} | {
|
|
875
|
+
form: "credential";
|
|
876
|
+
request: CredentialDrainRequest;
|
|
877
|
+
};
|
|
878
|
+
/** The form words of {@link DrainRequestReading}, in the order the reader tries them. `satisfies` bites a word the union does not have;
|
|
879
|
+
* the converse (a union arm missing from this list) is pinned by a test that compares the two. */
|
|
880
|
+
export declare const DRAIN_REQUEST_FORMS: readonly ["identity", "credential"];
|
|
881
|
+
/**
|
|
882
|
+
* Engine side: THE reader of the drain endpoint's request body — which form it is and the request in that form; neither ⇒ `undefined`.
|
|
883
|
+
* A body is one form or the other: a body that mixes the keys of the two forms is NEITHER — a body the identity reader reads that also
|
|
884
|
+
* carries, as its own key, a key only the credential-named form has (`turns`, `attachedAtMost`: that form's keys minus the shared
|
|
885
|
+
* `instanceId`) reads `undefined` here, whatever that key's value, so a condition or a turn policy sent on the identity form is refused
|
|
886
|
+
* instead of being stripped. It composes the two single-form readers and that one key check (no second schema): {@link readDrainRequest}
|
|
887
|
+
* first, then {@link readCredentialDrainRequest}; the `request` handed back is that reader's answer in this call. When this reader reads a
|
|
888
|
+
* body, its `request` equals the answer of that form's single-form reader; the converse does not hold: a mixed body that is plain data reads
|
|
889
|
+
* `undefined` here while {@link readDrainRequest} reads it (stripping the keys). For plain data the order changes nothing (no such body is
|
|
890
|
+
* read by both single-form readers). An object that shows the two single-form readers different key sets reads as the identity form only
|
|
891
|
+
* when the key check, which asks for each credential-only key's own descriptor, finds none of them; when it finds one the object is a mixed
|
|
892
|
+
* body and reads `undefined`. A proxy that changes itself while it is read may answer differently than when the credential reader is asked
|
|
893
|
+
* alone (the identity probe came first). Never throws. The single-form readers stay for a side that
|
|
894
|
+
* already knows which form it sent; {@link readDrainRequest} still strips the credential-named form's keys as it strips any unknown key.
|
|
895
|
+
*/
|
|
896
|
+
export declare function readDrainRequestReading(body: unknown): DrainRequestReading | undefined;
|
|
897
|
+
/** The machine code of the drain endpoint's refusal "the condition the request set is not met": the HTTP 409 whose body carries {@link DrainConditionUnmet}.
|
|
898
|
+
* One spelling — the engine mints the refusal with it, a caller branches on it. */
|
|
899
|
+
export declare const DRAIN_CONDITION_UNMET_CODE = "conflict.drain_condition_unmet";
|
|
900
|
+
/**
|
|
901
|
+
* The facts a {@link DRAIN_CONDITION_UNMET_CODE} refusal carries at the root of its body, beside the refusal's own `error` sentence and `errorCode`:
|
|
902
|
+
* - `attached` — how many streams were attached when the engine judged the request;
|
|
903
|
+
* - `attachedAtMost` — the bound the request set, echoed.
|
|
904
|
+
* A refused call changed nothing, and the engine answers this only when `attached` is above `attachedAtMost` (engine-side behaviour, not
|
|
905
|
+
* verified by this package); the reader judges the form of the
|
|
906
|
+
* two numbers (non-negative safe integers), not their relation. The refusal's own keys are stripped, so the reader takes the whole body.
|
|
907
|
+
*/
|
|
908
|
+
export declare const DrainConditionUnmet: z.ZodObject<{
|
|
909
|
+
attached: z.ZodNumber;
|
|
910
|
+
attachedAtMost: z.ZodNumber;
|
|
911
|
+
}, z.core.$strip>;
|
|
912
|
+
export type DrainConditionUnmet = z.infer<typeof DrainConditionUnmet>;
|
|
913
|
+
/**
|
|
914
|
+
* Caller side: the facts of a {@link DRAIN_CONDITION_UNMET_CODE} refusal. Compare the refusal's `errorCode` with {@link DRAIN_CONDITION_UNMET_CODE}
|
|
915
|
+
* first and read the two numbers with this only when they are equal: this reader does not judge the code, so any body that carries the two
|
|
916
|
+
* facts reads, whatever refusal it is. A body that does not carry both facts (another refusal of the same status, a receipt, a request) reads `undefined`.
|
|
917
|
+
* Shape mismatch / non-object / throwing accessor ⇒ `undefined`, never throws.
|
|
918
|
+
*/
|
|
919
|
+
export declare function readDrainConditionUnmet(body: unknown): DrainConditionUnmet | undefined;
|
|
802
920
|
export declare const DISPATCH_STRATEGIES: readonly ["round-robin", "least-inflight", "consistent-hash"];
|
|
803
921
|
export type DispatchStrategy = (typeof DISPATCH_STRATEGIES)[number];
|
|
804
922
|
/** Per-worker dispatch policy (web-admin-configured; the gateway is OPTIONAL — D3: TOC/self-maintained TOB go
|
package/dist/fleet.js
CHANGED
|
@@ -26,6 +26,7 @@ import { isPlainJsonObject } from "./plain-json-object.js";
|
|
|
26
26
|
import { buildQuotedIssue } from "./quoted-issue.js";
|
|
27
27
|
import { recordOf } from "./record-seat.js";
|
|
28
28
|
import { deepFreeze } from "./deep-freeze.js";
|
|
29
|
+
import { SafeCount } from "./api/wire-scalars.js";
|
|
29
30
|
// ── Web-admin's fleet endpoints (paths, one spelling) ─────────────────────────────────────────────────────
|
|
30
31
|
/**
|
|
31
32
|
* Web-admin's `/api/fleet/*` endpoints that are addressed from outside web-admin, relative to its origin. ONE spelling: whoever
|
|
@@ -209,7 +210,8 @@ function judgeSignalBody(body, pick, schema) {
|
|
|
209
210
|
* The reader behind every wire-shape read in this file that has no use for a reason: the engine-owned signals on /health
|
|
210
211
|
* ({@link readEngineSignal}, {@link readModelRefusals}) and the request / reply bodies of the
|
|
211
212
|
* fleet endpoints ({@link readServingLeaseRequest}, {@link readServingLeaseResponse}, {@link readDrainRequest},
|
|
212
|
-
* {@link
|
|
213
|
+
* {@link readCredentialDrainRequest}, {@link readDrainReceipt}, {@link readDrainConditionUnmet}; {@link readDrainRequestReading} composes
|
|
214
|
+
* two of them). Shape mismatch, a non-object body, even a throwing accessor ⇒ `undefined` — never throws.
|
|
213
215
|
*/
|
|
214
216
|
function readSignalBody(body, pick, schema) {
|
|
215
217
|
const judged = judgeSignalBody(body, pick, schema);
|
|
@@ -358,7 +360,9 @@ export function readModelRefusals(body) {
|
|
|
358
360
|
/**
|
|
359
361
|
* The engine's draining fact — ONE object wherever the engine says "I am draining": inside {@link EngineSignal}`.draining`
|
|
360
362
|
* and as the body of a {@link DrainReceipt}.
|
|
361
|
-
* - `actionId` — the action that put the engine into draining
|
|
363
|
+
* - `actionId` — the action that put the engine into draining: for a request of the identity form ({@link DrainRequest}) its `actionId`, the
|
|
364
|
+
* idempotency key; a request of the credential-named form ({@link CredentialDrainRequest}) carries none, and how the engine mints this one
|
|
365
|
+
* for it is the engine's to define (this package does not).
|
|
362
366
|
* - `since` — epoch ms when draining began; it does not move when the same action repeats.
|
|
363
367
|
* - `deadlineAt` — epoch ms by which the engine stops on its own.
|
|
364
368
|
*/
|
|
@@ -831,7 +835,8 @@ export const DrainRequest = z.object({
|
|
|
831
835
|
term: z.string().min(1).optional(),
|
|
832
836
|
});
|
|
833
837
|
/** What a drain request leaves the engine in: `draining` — this call put it into draining; `already_draining` — it already was
|
|
834
|
-
* (the same action repeated), and the receipt reports the first call's facts.
|
|
838
|
+
* (for the identity form: the same action repeated), and the receipt reports the first call's facts. For the credential-named form see
|
|
839
|
+
* {@link CredentialDrainRequest}. */
|
|
835
840
|
export const DRAIN_RECEIPT_STATES = deepFreeze(["draining", "already_draining"]);
|
|
836
841
|
export const DrainReceiptState = z.enum(DRAIN_RECEIPT_STATES);
|
|
837
842
|
/** The drain endpoint's answer: the engine's draining fact ({@link EngineDraining} — the same object {@link EngineSignal}
|
|
@@ -845,6 +850,136 @@ export function readDrainRequest(body) {
|
|
|
845
850
|
export function readDrainReceipt(body) {
|
|
846
851
|
return readSignalBody(body, WHOLE_BODY, DrainReceipt);
|
|
847
852
|
}
|
|
853
|
+
/**
|
|
854
|
+
* The two words of {@link CredentialDrainRequest}`.turns` — a CLOSED set, owned here (a reader that switches on it exhaustively is told
|
|
855
|
+
* by the compiler when a word is added): how the turns that are running at the moment the engine accepts the drain give way. This package
|
|
856
|
+
* fixes the words; what each word does is engine-side behaviour, described here and not verified by this package.
|
|
857
|
+
* - `yield` — the way a drain always stops them: a running turn parks at its next clean turn boundary, and what has not finished when the
|
|
858
|
+
* deadline passes is cut by the hard stop. An absent `turns` means `yield`.
|
|
859
|
+
* - `halt` — everything `yield` does, and in the same step the engine asks every running turn that has a turn surface to stop now — the
|
|
860
|
+
* cut a user's Esc makes in that window. The deadline does not move; a turn that does not take the cut in time is handled as under
|
|
861
|
+
* `yield`. The engine honours it only for a caller that holds the operator authority to halt any run; otherwise it refuses and changes nothing.
|
|
862
|
+
*/
|
|
863
|
+
export const DRAIN_TURNS = deepFreeze(["yield", "halt"]);
|
|
864
|
+
export const DrainTurns = z.enum(DRAIN_TURNS);
|
|
865
|
+
/** The member schemas of {@link CredentialDrainRequest} — the one place its keys are written: the schema is built from this very object, and the
|
|
866
|
+
* set of keys only that form has is read off it (a plain object, so reading its keys materializes nothing lazy inside the validator). */
|
|
867
|
+
const CREDENTIAL_DRAIN_SHAPE = {
|
|
868
|
+
instanceId: DrainRequest.shape.instanceId,
|
|
869
|
+
turns: DrainTurns.optional(),
|
|
870
|
+
attachedAtMost: SafeCount.optional(),
|
|
871
|
+
};
|
|
872
|
+
/**
|
|
873
|
+
* The drain endpoint's request in its CREDENTIAL-NAMED form: the sender (the side that sends the request) names the engine by the credential it
|
|
874
|
+
* presents (the one a launcher minted for this process), not by the identity quadruple of {@link DrainRequest} — so the body carries no action
|
|
875
|
+
* id, no worker, no deadline, only what is to be said about THIS call. A STRICT object: one key more, one word off, a negative / fractional /
|
|
876
|
+
* string / oversize count ⇒ the body is not this form (and a half-built {@link DrainRequest} is never read as a stop request). Every key is
|
|
877
|
+
* optional and the empty body `{}` is the whole default form. A reader never mints a key the sender did not write, and this package exports
|
|
878
|
+
* no default constant: the RECEIVING side applies the meaning of an absent key — an absent `turns` is `yield`, an absent `attachedAtMost`
|
|
879
|
+
* sets no condition.
|
|
880
|
+
* - `instanceId` — a non-empty string: the engine's own per-process identity ({@link InstanceHealth}`.instanceId`). When present the engine
|
|
881
|
+
* compares it with its own and refuses on a mismatch. The very schema of {@link DrainRequest}`.instanceId`, not a copy.
|
|
882
|
+
* - `turns` — how the turns running at acceptance give way ({@link DRAIN_TURNS}).
|
|
883
|
+
* - `attachedAtMost` — a non-negative safe integer: accept the drain only if at most this many streams are attached to the engine at the
|
|
884
|
+
* moment it judges the request; more ⇒ a refusal carrying {@link DrainConditionUnmet}, nothing changed. It bounds what was attached at that moment;
|
|
885
|
+
* it is not a promise about the streams and requests that arrive afterwards.
|
|
886
|
+
* The two forms of the endpoint's request share no body that is plain data (what JSON parsing yields): {@link DrainRequest} requires
|
|
887
|
+
* `actionId`, `worker` and `deadlineAt`, which this form refuses as unknown keys. `turns` and `attachedAtMost` belong to this form only —
|
|
888
|
+
* {@link DrainRequest} does not carry them; its single-form reader strips them like any unknown key, and the reader of the endpoint's body
|
|
889
|
+
* ({@link readDrainRequestReading}) reads an identity body that carries either of them as neither form. The answer is the same
|
|
890
|
+
* {@link DrainReceipt} shape for both forms. What the engine puts in it for this form — engine-side behaviour, which this package does not
|
|
891
|
+
* verify: `deadlineAt` is the engine's own drain window (the body names no deadline); a `halt` sent while the engine is already draining is
|
|
892
|
+
* answered `already_draining` with the first call's facts and cuts the turns running at that moment; while the hard stop is under way the
|
|
893
|
+
* receipt's `actionId` is `hard-stop` and neither `turns` nor `attachedAtMost` is read; the naming is judged before the condition (a naming
|
|
894
|
+
* mismatch is refused without the attached count), and the condition is judged even when the engine is already draining. How the engine
|
|
895
|
+
* mints the receipt's `actionId` for this form, and what it answers for other requests of this form sent while it is draining, is the
|
|
896
|
+
* engine's to define; this package does not.
|
|
897
|
+
*/
|
|
898
|
+
export const CredentialDrainRequest = z.object(CREDENTIAL_DRAIN_SHAPE).strict();
|
|
899
|
+
/** The keys only the credential-named form has: its keys minus the ones {@link DrainRequest} also declares (`instanceId` is shared).
|
|
900
|
+
* Derived from the two shapes, never spelled again — a key added to the credential-named form joins this set by construction. */
|
|
901
|
+
const CREDENTIAL_ONLY_DRAIN_KEYS = deepFreeze(Object.keys(CREDENTIAL_DRAIN_SHAPE).filter((key) => !Object.hasOwn(DrainRequest.shape, key)));
|
|
902
|
+
/**
|
|
903
|
+
* Engine side: the request body of the drain endpoint in its credential-named form. Shape mismatch / non-object / throwing accessor ⇒
|
|
904
|
+
* `undefined`, never throws. A body of the identity form ({@link DrainRequest}) reads `undefined` here and a body of this form reads
|
|
905
|
+
* `undefined` for {@link readDrainRequest}: no plain-data body is read by both (an object that shows two different key sets to the two
|
|
906
|
+
* readers — a Proxy whose `ownKeys` trap lies — is outside that promise; a body parsed from JSON never is one). A request with no bytes is
|
|
907
|
+
* the engine's to turn into `{}` before it calls this reader (`undefined` and `null` are not objects here).
|
|
908
|
+
* The result is an ordinary object, like every reader's in this file: the reader looks only at the body's own keys, but an optional key it
|
|
909
|
+
* did not read is absent only as an own key — test for it with `Object.hasOwn`, do not read it through the prototype chain.
|
|
910
|
+
*/
|
|
911
|
+
export function readCredentialDrainRequest(body) {
|
|
912
|
+
return readSignalBody(body, WHOLE_BODY, CredentialDrainRequest);
|
|
913
|
+
}
|
|
914
|
+
/** The form words of {@link DrainRequestReading}, in the order the reader tries them. `satisfies` bites a word the union does not have;
|
|
915
|
+
* the converse (a union arm missing from this list) is pinned by a test that compares the two. */
|
|
916
|
+
export const DRAIN_REQUEST_FORMS = deepFreeze(["identity", "credential"]);
|
|
917
|
+
/**
|
|
918
|
+
* Does `body` carry, as its own key, a key only the credential-named form has ({@link CREDENTIAL_ONLY_DRAIN_KEYS})? Asked by the descriptor law
|
|
919
|
+
* every reader in this file uses: an own key — plain data, or one that cannot be read as plain data (not enumerable, an accessor — never called)
|
|
920
|
+
* — or a descriptor that cannot be inspected counts as carrying it; a key the body only inherits, or does not have, does not. Never throws.
|
|
921
|
+
*/
|
|
922
|
+
function carriesCredentialOnlyDrainKey(body) {
|
|
923
|
+
return CREDENTIAL_ONLY_DRAIN_KEYS.some((key) => {
|
|
924
|
+
const read = readDeclaredKey(body, key);
|
|
925
|
+
switch (read.presence) {
|
|
926
|
+
case "inherited":
|
|
927
|
+
case "absent":
|
|
928
|
+
return false;
|
|
929
|
+
case "own":
|
|
930
|
+
case "hidden":
|
|
931
|
+
case "unreadable":
|
|
932
|
+
return true;
|
|
933
|
+
default: {
|
|
934
|
+
const unhandled = read;
|
|
935
|
+
throw new Error(`carriesCredentialOnlyDrainKey: unhandled presence ${String(unhandled.presence)}`);
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
});
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Engine side: THE reader of the drain endpoint's request body — which form it is and the request in that form; neither ⇒ `undefined`.
|
|
942
|
+
* A body is one form or the other: a body that mixes the keys of the two forms is NEITHER — a body the identity reader reads that also
|
|
943
|
+
* carries, as its own key, a key only the credential-named form has (`turns`, `attachedAtMost`: that form's keys minus the shared
|
|
944
|
+
* `instanceId`) reads `undefined` here, whatever that key's value, so a condition or a turn policy sent on the identity form is refused
|
|
945
|
+
* instead of being stripped. It composes the two single-form readers and that one key check (no second schema): {@link readDrainRequest}
|
|
946
|
+
* first, then {@link readCredentialDrainRequest}; the `request` handed back is that reader's answer in this call. When this reader reads a
|
|
947
|
+
* body, its `request` equals the answer of that form's single-form reader; the converse does not hold: a mixed body that is plain data reads
|
|
948
|
+
* `undefined` here while {@link readDrainRequest} reads it (stripping the keys). For plain data the order changes nothing (no such body is
|
|
949
|
+
* read by both single-form readers). An object that shows the two single-form readers different key sets reads as the identity form only
|
|
950
|
+
* when the key check, which asks for each credential-only key's own descriptor, finds none of them; when it finds one the object is a mixed
|
|
951
|
+
* body and reads `undefined`. A proxy that changes itself while it is read may answer differently than when the credential reader is asked
|
|
952
|
+
* alone (the identity probe came first). Never throws. The single-form readers stay for a side that
|
|
953
|
+
* already knows which form it sent; {@link readDrainRequest} still strips the credential-named form's keys as it strips any unknown key.
|
|
954
|
+
*/
|
|
955
|
+
export function readDrainRequestReading(body) {
|
|
956
|
+
const identity = readDrainRequest(body);
|
|
957
|
+
if (identity !== undefined)
|
|
958
|
+
return carriesCredentialOnlyDrainKey(body) ? undefined : { form: "identity", request: identity };
|
|
959
|
+
const credential = readCredentialDrainRequest(body);
|
|
960
|
+
return credential === undefined ? undefined : { form: "credential", request: credential };
|
|
961
|
+
}
|
|
962
|
+
/** The machine code of the drain endpoint's refusal "the condition the request set is not met": the HTTP 409 whose body carries {@link DrainConditionUnmet}.
|
|
963
|
+
* One spelling — the engine mints the refusal with it, a caller branches on it. */
|
|
964
|
+
export const DRAIN_CONDITION_UNMET_CODE = "conflict.drain_condition_unmet";
|
|
965
|
+
/**
|
|
966
|
+
* The facts a {@link DRAIN_CONDITION_UNMET_CODE} refusal carries at the root of its body, beside the refusal's own `error` sentence and `errorCode`:
|
|
967
|
+
* - `attached` — how many streams were attached when the engine judged the request;
|
|
968
|
+
* - `attachedAtMost` — the bound the request set, echoed.
|
|
969
|
+
* A refused call changed nothing, and the engine answers this only when `attached` is above `attachedAtMost` (engine-side behaviour, not
|
|
970
|
+
* verified by this package); the reader judges the form of the
|
|
971
|
+
* two numbers (non-negative safe integers), not their relation. The refusal's own keys are stripped, so the reader takes the whole body.
|
|
972
|
+
*/
|
|
973
|
+
export const DrainConditionUnmet = z.object({ attached: SafeCount, attachedAtMost: SafeCount });
|
|
974
|
+
/**
|
|
975
|
+
* Caller side: the facts of a {@link DRAIN_CONDITION_UNMET_CODE} refusal. Compare the refusal's `errorCode` with {@link DRAIN_CONDITION_UNMET_CODE}
|
|
976
|
+
* first and read the two numbers with this only when they are equal: this reader does not judge the code, so any body that carries the two
|
|
977
|
+
* facts reads, whatever refusal it is. A body that does not carry both facts (another refusal of the same status, a receipt, a request) reads `undefined`.
|
|
978
|
+
* Shape mismatch / non-object / throwing accessor ⇒ `undefined`, never throws.
|
|
979
|
+
*/
|
|
980
|
+
export function readDrainConditionUnmet(body) {
|
|
981
|
+
return readSignalBody(body, WHOLE_BODY, DrainConditionUnmet);
|
|
982
|
+
}
|
|
848
983
|
// ── Domain 3: dispatch policy (traffic + failover + LB — three domains, one gateway) ──────────────────────
|
|
849
984
|
export const DISPATCH_STRATEGIES = deepFreeze(["round-robin", "least-inflight", "consistent-hash"]);
|
|
850
985
|
/** Per-worker dispatch policy (web-admin-configured; the gateway is OPTIONAL — D3: TOC/self-maintained TOB go
|
package/dist/read-sentences.d.ts
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
*
|
|
11
11
|
* 后果句读两张表的答案(`DOMAIN_READ_FALLBACK` 与 `DOMAIN_ENTRY_SALVAGE`,表在 `./config-fns`,本模块不读表、只收两张表的答案;两张表互不读,句子按两半各自穷举):
|
|
12
12
|
* · 整域读不进时:整域拒(`throw`,读腿抛)/ 整域退缺省(`default`);
|
|
13
|
-
* · 在那之前:逐条丢弃域先丢坏的那一条、其余照读(`salvage`)/ 不逐条丢(`none`)
|
|
13
|
+
* · 在那之前:逐条丢弃域先丢坏的那一条、其余照读(`salvage`)/ 不逐条丢(`none`);逐条丢弃域的「整域读不进」= 抢救之后剩下的仍读不进
|
|
14
|
+
* (不只是没有条目可丢:幸存的条目彼此相撞也是)。
|
|
14
15
|
*/
|
|
15
16
|
/** 一个域在读腿上的两张表的答案(`DOMAIN_READ_FALLBACK[域]` / `DOMAIN_ENTRY_SALVAGE[域]`)。 */
|
|
16
17
|
export interface ReadStanceWords {
|
package/dist/read-sentences.js
CHANGED
|
@@ -74,7 +74,8 @@ export function readConsequenceSentence(domain, stance) {
|
|
|
74
74
|
})();
|
|
75
75
|
switch (stance.salvage) {
|
|
76
76
|
case "salvage":
|
|
77
|
-
|
|
77
|
+
// 整域那一半的条件是「抢救之后剩下的仍读不进」:没有条目可丢(域级的毛病)、一条都救不活(零幸存者),或丢掉坏的之后幸存的条目彼此相撞(重名、同一条 remote)—— 三种同一句
|
|
78
|
+
return `the reader drops the offending entry, or ${whole} when what is left after the drop still does not read`;
|
|
78
79
|
case "none":
|
|
79
80
|
return `the reader ${whole}`;
|
|
80
81
|
default: {
|
package/docs/API-SURFACE.md
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
> 每次全量重算并逐名比对 —— 加 / 删 / 改形一个导出而不重生成本档 ⇒ 红。导出面的每次变动因此以本档的 diff 出现在评审里。
|
|
5
5
|
> 形:`value` = 运行期拿得到的值;`type` = 只在类型层;`value+type` = 同名的值与类型(zod schema 与它推出的类型)。
|
|
6
6
|
|
|
7
|
-
子路径 24 条(资产出口 `./package.json` / `./fleet-paths.json` 不是模块,不列),导出名合计
|
|
7
|
+
子路径 24 条(资产出口 `./package.json` / `./fleet-paths.json` 不是模块,不列),导出名合计 1635 个(同名在多条子路径上各计一次)。
|
|
8
8
|
|
|
9
|
-
## `.`(
|
|
9
|
+
## `.`(876)
|
|
10
10
|
|
|
11
11
|
- `A2aConfig` — value+type
|
|
12
12
|
- `A2aPeerSpec` — value+type
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
- `ConnectorAuthorizeQueryName` — type
|
|
84
84
|
- `ConnectorAuthorizeUrlFlaw` — type
|
|
85
85
|
- `ConnectorId` — value+type
|
|
86
|
+
- `CredentialDrainRequest` — value+type
|
|
86
87
|
- `CredentialHandleAnswer` — value+type
|
|
87
88
|
- `CredentialParamName` — type
|
|
88
89
|
- `CredentialResolveRequest` — value+type
|
|
@@ -124,10 +125,13 @@
|
|
|
124
125
|
- `DOMAIN_SCHEMAS` — value
|
|
125
126
|
- `DOMAIN_WRITE_ROLE` — value
|
|
126
127
|
- `DRAIN_ACTION_ID` — value
|
|
128
|
+
- `DRAIN_CONDITION_UNMET_CODE` — value
|
|
127
129
|
- `DRAIN_GRACE_FLOOR_MS` — value
|
|
128
130
|
- `DRAIN_PHASES` — value
|
|
129
131
|
- `DRAIN_RECEIPT_STATES` — value
|
|
132
|
+
- `DRAIN_REQUEST_FORMS` — value
|
|
130
133
|
- `DRAIN_RETRY_AFTER_SECONDS` — value
|
|
134
|
+
- `DRAIN_TURNS` — value
|
|
131
135
|
- `DROPPED_ENTRY_REASON_CODES` — value
|
|
132
136
|
- `DeviceApproveLookupResponse` — value+type
|
|
133
137
|
- `DeviceApproveRequest` — value+type
|
|
@@ -149,11 +153,14 @@
|
|
|
149
153
|
- `DomainFieldWriteRoles` — type
|
|
150
154
|
- `DomainName` — type
|
|
151
155
|
- `DomainReadRefusedError` — value+type
|
|
156
|
+
- `DrainConditionUnmet` — value+type
|
|
152
157
|
- `DrainPhase` — type
|
|
153
158
|
- `DrainReceipt` — value+type
|
|
154
159
|
- `DrainReceiptState` — value+type
|
|
155
160
|
- `DrainRequest` — value+type
|
|
161
|
+
- `DrainRequestReading` — type
|
|
156
162
|
- `DrainSnapshot` — type
|
|
163
|
+
- `DrainTurns` — value+type
|
|
157
164
|
- `DrainVerdict` — type
|
|
158
165
|
- `DroppedEntry` — type
|
|
159
166
|
- `DroppedEntryIdentity` — type
|
|
@@ -800,12 +807,15 @@
|
|
|
800
807
|
- `projectWarning` — value
|
|
801
808
|
- `promptArtifactFor` — value
|
|
802
809
|
- `readCapabilityReading` — value
|
|
810
|
+
- `readCredentialDrainRequest` — value
|
|
803
811
|
- `readCrossSessionInbound` — value
|
|
804
812
|
- `readDeviceMaxPreAuthPerRemote` — value
|
|
805
813
|
- `readDeviceTrustedProxyCidrs` — value
|
|
806
814
|
- `readDialogExpiry` — value
|
|
815
|
+
- `readDrainConditionUnmet` — value
|
|
807
816
|
- `readDrainReceipt` — value
|
|
808
817
|
- `readDrainRequest` — value
|
|
818
|
+
- `readDrainRequestReading` — value
|
|
809
819
|
- `readEffectiveWire` — value
|
|
810
820
|
- `readEngineSignal` — value
|
|
811
821
|
- `readEntryIdentityAt` — value
|
|
@@ -1502,27 +1512,34 @@
|
|
|
1502
1512
|
- `readHookPluginOptionRef` — value
|
|
1503
1513
|
- `stopAttributionText` — value
|
|
1504
1514
|
|
|
1505
|
-
## `./fleet`(
|
|
1515
|
+
## `./fleet`(95)
|
|
1506
1516
|
|
|
1507
1517
|
- `AggregatedPrincipalUsage` — type
|
|
1508
1518
|
- `CATALOG_REPLACES_ENV_MODELS_CODE` — value
|
|
1509
1519
|
- `CapabilityReading` — type
|
|
1520
|
+
- `CredentialDrainRequest` — value+type
|
|
1510
1521
|
- `DEFAULT_DRAIN_GRACE_MS` — value
|
|
1511
1522
|
- `DEFAULT_HEARTBEAT_MS` — value
|
|
1512
1523
|
- `DISPATCH_STRATEGIES` — value
|
|
1513
1524
|
- `DRAIN_ACTION_ID` — value
|
|
1525
|
+
- `DRAIN_CONDITION_UNMET_CODE` — value
|
|
1514
1526
|
- `DRAIN_GRACE_FLOOR_MS` — value
|
|
1515
1527
|
- `DRAIN_PHASES` — value
|
|
1516
1528
|
- `DRAIN_RECEIPT_STATES` — value
|
|
1529
|
+
- `DRAIN_REQUEST_FORMS` — value
|
|
1517
1530
|
- `DRAIN_RETRY_AFTER_SECONDS` — value
|
|
1531
|
+
- `DRAIN_TURNS` — value
|
|
1518
1532
|
- `DispatchCandidate` — type
|
|
1519
1533
|
- `DispatchPolicy` — value+type
|
|
1520
1534
|
- `DispatchStrategy` — type
|
|
1535
|
+
- `DrainConditionUnmet` — value+type
|
|
1521
1536
|
- `DrainPhase` — type
|
|
1522
1537
|
- `DrainReceipt` — value+type
|
|
1523
1538
|
- `DrainReceiptState` — value+type
|
|
1524
1539
|
- `DrainRequest` — value+type
|
|
1540
|
+
- `DrainRequestReading` — type
|
|
1525
1541
|
- `DrainSnapshot` — type
|
|
1542
|
+
- `DrainTurns` — value+type
|
|
1526
1543
|
- `DrainVerdict` — type
|
|
1527
1544
|
- `ENGINE_SIGNAL_KEY` — value
|
|
1528
1545
|
- `EngineDraining` — value+type
|
|
@@ -1580,8 +1597,11 @@
|
|
|
1580
1597
|
- `leaseRemaining` — value
|
|
1581
1598
|
- `pickInstance` — value
|
|
1582
1599
|
- `readCapabilityReading` — value
|
|
1600
|
+
- `readCredentialDrainRequest` — value
|
|
1601
|
+
- `readDrainConditionUnmet` — value
|
|
1583
1602
|
- `readDrainReceipt` — value
|
|
1584
1603
|
- `readDrainRequest` — value
|
|
1604
|
+
- `readDrainRequestReading` — value
|
|
1585
1605
|
- `readEngineSignal` — value
|
|
1586
1606
|
- `readModelRefusals` — value
|
|
1587
1607
|
- `readServingLeaseRequest` — value
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
> **31.1.0** 的文件层 `io` 拒的类词 `ioKind`(包根闭集 `CONFIG_DOCUMENT_IO_KINDS`:`dangling_symlink` / `read_error`;拒单文件层那一臂与 `./node` 读数 `ConfigDRefused` 的可选键;加性,minor)在 §41。
|
|
33
33
|
> **32.0.0** 的记录座位一条律(包里每一只「名 → 值」记录座位按自有属性名拒保留成员名 `__proto__` / `constructor` / `prototype`,机读词 `member_name_reserved`;major)在 §42;同版的目录条目 `defaultThinking`(词表 `MODEL_THINKING_LEVEL_WORDS`,坏值整条拒)在 §43;跨域读的域读拒 `DomainReadRefusedError { domain, cause }` 在 §44;device 车道两只可选坐标的值判官 `readDeviceMaxPreAuthPerRemote` / `readDeviceTrustedProxyCidrs` 与地址文法 `ipFamilyOf`(写闸判值)在 §45;hooks 一批(http 条目的 `url` 判 URL 语法 · `SubagentStart` / `SubagentStop` 改判引擎属主 · 分类器闭包只经登记名读事实)在 §46;墓碑表加 `SCHEDULER_SESSION_WAKEUP` / `SCHEDULER_SESSION_LIFETIME`(`replaced` → `SCHEDULER_RESIDENT_TRIGGER`)在 §47;权益能力位 `EntitlementRuntimeCaps` 删 `allowAutoMode` / `allowUltracode`(三只座上的墓碑 + 一次性迁移 SS-M14;`EntitlementRuntimeCaps` 只剩型;中心先提、服务端后提)在 §48;目录条目的 `fastMode`(这只模型有快速档的布尔声明位;加性)在 §49;钩子插件选项值「是不是本座收的引用」的单值判口 `readHookPluginOptionRef`(加性导出;分类器改调它,闭包的登记名表由 `readCredentialRef` 换成它 —— 复制分类器的生成器要按新表绑名)在 §50。
|
|
34
34
|
> **33.0.0** 的命令行 `migrate` 对在场文档的整文档判(整文档判不过的目录由答 `noop` / 退出 0 改答 `refused` / 退出 1、整目录不写;内核入参 `judge`,缺省不变;major)与读腿三句诊断补身份 / 后果 / 出路(`domain-defaulted` 多可缺的 `path` / `identity` / `reasonCode`、`refused[]` 多可缺的 `identity`、新导出 `readEntryIdentityAt`、`error.message` 变一句话;加性与文案)同在 §51。
|
|
35
|
+
> **33.1.0** 的排空口凭据点名形请求体(`CredentialDrainRequest` / `readCredentialDrainRequest` / 两词闭集 `DRAIN_TURNS`)、条件不满足的拒体(`DrainConditionUnmet` / `readDrainConditionUnmet` / `DRAIN_CONDITION_UNMET_CODE`)与读「请求体是哪一形」的聚合读器(`readDrainRequestReading` / `DrainRequestReading` / `DRAIN_REQUEST_FORMS`;加性,minor)在 §52。
|
|
35
36
|
|
|
36
37
|
---
|
|
37
38
|
|
|
@@ -1387,10 +1388,10 @@ fleet 成员对中心公告的可达地址(`FLEET_ADVERTISE_ADDRESS`,中心往
|
|
|
1387
1388
|
**律(一条)**:命令行 `migrate`(与 `--check`)问的是「这个目录现在干不干净」—— 在场的**每一份**覆盖面内文档过文档面那几只判官(域 `parseDomain`、`remote-exec.json` 的 `parseRemoteExecDocument`、退役域的墓碑判),判不过(坏值、坏条目、退役域带事实、重名这类整域规则;与读腿的差别见下面「已知的边」)⇒ 结论 `refused`、退出 1、一字不写,`refused[]` 点名文档与坐标并给出路(手改后重跑)。结论词与退出码表(0 / 1 / 2 / 3)不动。内核 `migrateConfigDirectory` 因此多一个可选入参 `judge: "changed" | "present"`:缺省 `"changed"` = 32.0.0 的行为(只判迁移改过的文档),命令行传 `"present"`;同步口 `migrateConfigDocuments` 不变、没有这个入参。
|
|
1388
1389
|
**为什么**:此前迁移不碰的文档永不被判 —— 存量里读腿读不进的陈旧形(已退役的键、带 `#fragment` 的 URL、带事实的退役域文档)与重名之类的整域规则被答成 `noop` / 退出 0,运维以为干净、带着它们上线。
|
|
1389
1390
|
**读法**:
|
|
1390
|
-
- 拿退出码判「可上线」的脚本:同样的输入得 1 就是要的,按 `refused[]`
|
|
1391
|
+
- 拿退出码判「可上线」的脚本:同样的输入得 1 就是要的,按 `refused[]` 的出路句改存量再跑(迁移没碰的文档每条拒都带读腿的后果与出路;迁移改过、改完仍判不过的那一份,`reason` 是判官的原句 —— 已脱敏,不带后果与出路、不折行、不剥控制符 —— 出路在整份 `why`:手改后重跑)。码表:0 = 干净或已写回,1 = 有要手改的,2 = 用法 / 环境错,3 = `--check` 有改动。
|
|
1391
1392
|
- 自己调 `migrateConfigDirectory` 的一方:不传 `judge` ⇒ 读数不变;要复刻命令行那一问的传 `"present"`。
|
|
1392
1393
|
- 读腿三句诊断:`entry-dropped` 与 `domain-defaulted` 的 `error.message` 是一句话、出门前过本包的脱敏器(`error` 的型与 `issues` 不动,仍是 `Error` 的实例、带 `stack`,机读读它们);`domain-defaulted` 多可缺的 `path` / `identity` / `reasonCode`(不进符合性投影);`RetiredDomainError.message` 尾多出路;`refused[]` 与型 `ConfigDirectoryRefusal` 多可缺的 `identity`。要点名一条条目的身份调新导出 `readEntryIdentityAt(doc, path)`(包根与 `./config-fns`),别自己再写读名字的代码。
|
|
1393
|
-
**已知的边**:判官是文档面那一只(`parseDomain`),与读腿(视图面)两个方向上答得不一样 —— ①
|
|
1394
|
+
**已知的边**:判官是文档面那一只(`parseDomain`),与读腿(视图面)两个方向上答得不一样 —— ① 比读腿宽(只在逐条丢弃域里:视图面只在那里拒条目体内被剥的键;不逐条丢的域两面都剥键受理、答得一样):条目只因带读侧不认识的键,文档面剥键受理,命令行答干净、退出 0;读腿丢那一条,集合里每一条都这样(零幸存者)时整域退缺省(`models` 读成空目录)或整域拒;② 比读腿严:逐条丢弃域里一条在 schema 下不过的条目,读腿只丢它、其余照读,命令行整目录拒、退出 1。要两边答同一句,得让命令行改问读腿的判官,是另一件设计事项。
|
|
1394
1395
|
|
|
1395
1396
|
| 消费方 | 读点 | 动作 |
|
|
1396
1397
|
|---|---|---|
|
|
@@ -1401,3 +1402,27 @@ fleet 成员对中心公告的可达地址(`FLEET_ADVERTISE_ADDRESS`,中心往
|
|
|
1401
1402
|
| client-core | 云端配置告警折成提示句时只取 `kind` / `domain`(`entry-dropped` 另取 `path`)〔读 `src`,只 grep〕 | 无 |
|
|
1402
1403
|
| sdk | 契约套件 | 零代码改动(符合性语料不变) |
|
|
1403
1404
|
| test | 黑盒判据 | 见 `CHANGELOG.md` 33.0.0 对应两节的 K1 – K24 |
|
|
1405
|
+
|
|
1406
|
+
## 52. 排空口的凭据点名形请求体 · 条件不满足的拒体(33.1.0 起,加性,minor)—— 服务端、终端、客户端核心、web-admin、sdk、test 各自的读法
|
|
1407
|
+
|
|
1408
|
+
**律(一条)**:排空口(`POST /v1/admin/drain`)的请求体有两种形,**同一只请求体只有一只 schema、一只读器**,发的一侧与收的一侧读同一份。身份四元形 `DrainRequest`(必带 `actionId` / `worker` / `deadlineAt`)不变;凭据点名形 `CredentialDrainRequest` 是严格对象 `{ instanceId?, turns?, attachedAtMost? }`,读器 `readCredentialDrainRequest`。回执两形相同,仍是 `DrainReceipt`(`readDrainReceipt`)。
|
|
1409
|
+
**为什么**:没有 worker 名的引擎(本机起的引擎)没法被身份四元形点名,只能凭出示的起服凭据点名;这只体与它多说的两件事(`turns`:受理时在跑的轮次怎么让出;`attachedAtMost`:受理这一拍附着流数不超过几条才受理)若在发请求的一侧与引擎里各有一份判形,版本一错位就静默分歧 —— 所以同一版一次到货、只在本包定义。
|
|
1410
|
+
**读法**:
|
|
1411
|
+
- **三键各自可缺**:缺席 = 不带这一位。读器**不替缺席的键铸缺省**:`{}` 读成 `{}`。缺席的含义由**收请求的一侧**落:缺席 `turns` 按 `yield`、缺席 `attachedAtMost` 按不设条件处理;本包不导缺省常量。发请求的一侧不要哪一位就不带。
|
|
1412
|
+
- **`turns`**:两词闭集 `DRAIN_TURNS`(`yield` | `halt`,字面量联合:写错词编译期红、读器答 `undefined`)。词义是引擎的行为(本包只定形):`yield` = 排空一贯的让出,在跑的轮次在下一个干净的回合边界停驻,到期限没完成的由硬停切断;`halt` = `yield` 做的都做,同一步里再请求每一只有轮次面的在跑轮次立即停下(用户在那个窗口按 Esc 的同一刀),期限不动;引擎只对持有「能对任一条运行按 Esc 的运维权力」的调用方认 `halt`,否则拒、什么都不变。**问不问用户是发请求一方的义务**,线上没有「用户已同意」这样一位。
|
|
1413
|
+
- **`attachedAtMost`**:非负安全整数;受理这一发的那一拍附着流数不超过它才受理,多于它 ⇒ 409,机读码 `DRAIN_CONDITION_UNMET_CODE`,拒体根上带 `attached`(此刻读数)与 `attachedAtMost`(回显),什么都没改变。它只陈述受理那一拍:之后到的新流与新请求不在保证里。
|
|
1414
|
+
- **严格与整份读不进**:多一键 / 未知词 / 负数 / 小数 / 串 / 超出安全整数的数 ⇒ `readCredentialDrainRequest` 答 `undefined`。半截的身份四元形不会被读成停机请求。读器的总律同本包别的 wire 读口:形不符 / 非对象 / 访问器抛 ⇒ `undefined`、不抛,只看自有键。空请求体(没有字节)由引擎先折成 `{}`。
|
|
1415
|
+
- **读请求体只用一只**:服务端与下游读请求体都只用 `readDrainRequestReading(body)` —— 答 `{ form: "identity", request: DrainRequest }` 或 `{ form: "credential", request: CredentialDrainRequest }`(判别联合 `DrainRequestReading`),两形都读不进 ⇒ `undefined`;按 `form` 分支,`switch` 穷举形词闭集 `DRAIN_REQUEST_FORMS`。它只组合两只单形读器(先身份形、后凭据点名形,不另写 schema),交回的 `request` 就是那一只的答;两只单形读器留给已知自己发的是哪一形的一侧。
|
|
1416
|
+
- **两形互斥**:没有一只 JSON 体被 `readDrainRequest` 与 `readCredentialDrainRequest` 同时读进,聚合读器先问哪一只不影响结果(只对朴素数据说:对两只单形读器露出不同键集的非 JSON 对象 —— 例如 `ownKeys` 陷阱谎报键集的 Proxy —— 两只会给出不同的答;聚合读器的混形判按独有键逐只问描述符,问到一只 ⇒ `undefined`,一只都问不到才按序答身份形)。聚合读器读得进时,答案与对应那一形的单形读器相同;反过来不成立(混形的朴素体它答 `undefined`,单形身份读器照读);`turns` / `attachedAtMost` 不进身份四元形。
|
|
1417
|
+
- **混形哪一形都不是**:一只体要么是身份形、要么是凭据点名形。身份形读得进、而体上自有凭据点名形独有的键(`turns` / `attachedAtMost` —— 凭据点名形的键减去两形共有的 `instanceId`,从两只 schema 的键集派生)⇒ `readDrainRequestReading` 答 `undefined`,那一键的值合法与否同答;按本规则读请求体的服务端按读不进应答 400、什么都不变(服务端一侧的行为,本包不验证)。「体上自有这一键」按本包读器的描述符律:自有数据键、不可枚举的自有键、访问器(一次都不调)、描述符读不出都算带着;只靠继承或缺席不算。单形的 `readDrainRequest` 照旧剥掉未知键(既有读法,不动),带着它们的四元形体在它那里读成不带它们的 `DrainRequest`。
|
|
1418
|
+
- **回执在凭据点名形下**(引擎一侧的行为,本包只定形、不验证):形仍是 `DrainReceipt`;`deadlineAt` 是引擎自己的排空窗;已在排空时再来 `halt`,答 `already_draining`(第一次的三格)并切此刻在跑的轮次;硬停已在进行时 `actionId` 是 `hard-stop`,两位都不读;先判点名、后判条件(点名不符的拒不带附着数),已在排空时条件照判。首发回执的 `actionId` 怎么铸、这一形别的请求在排空中答什么,由引擎定,本包不定。
|
|
1419
|
+
- **读 409**:先看拒体的机读码 = `DRAIN_CONDITION_UNMET_CODE`,再 `readDrainConditionUnmet(body)` 读出 `{ attached, attachedAtMost }`(两个非负安全整数,与请求里的 `attachedAtMost` 是同一只 schema)。读器不判码 —— 根上带这两只数的体它都读得出,所以分支靠先比 `errorCode` 与码常量,不靠「读得出」;不带这两个事实的体读成 `undefined`;也不判两数的大小关系(「`attached` 大于 `attachedAtMost`」是引擎答这一拒的条件)。
|
|
1420
|
+
**已知的边**:读器交回的是普通对象(同本包别的 wire 读器):读器按自有键读输入、不受 `Object.prototype` 污染影响,但交回的对象继承它 —— 要把可选键的「缺席」当含义用(`turns` 缺席 = `yield`、`attachedAtMost` 缺席 = 不设条件),按自有键读,`Object.hasOwn(request, "turns")`,不要靠属性读。本包不验证引擎的行为,上面词义与条件是引擎侧的约定。
|
|
1421
|
+
|
|
1422
|
+
| 消费方 | 读点 | 动作 |
|
|
1423
|
+
|---|---|---|
|
|
1424
|
+
| 服务端(排空口) | 请求体只用 `readDrainRequestReading` 读、按 `form` 分支(不自己串两只单形读器);读不进(含混形)答 400;缺席 `turns` 按 `yield`、缺席 `attachedAtMost` 按不设条件处理;条件不满足的拒用 `DRAIN_CONDITION_UNMET_CODE` 与 `DrainConditionUnmet` 的两键铸体 | 提货本版;自己的请求体判形与码字面删掉、改绑这里;不再有第二份读器 |
|
|
1425
|
+
| 终端 · 客户端核心 | 发:构造 `CredentialDrainRequest`(不往身份四元形上加 `turns` / `attachedAtMost`:那是混形,按本规则读的服务端应答 400);回执:`readDrainReceipt`;409:机读码 = `DRAIN_CONDITION_UNMET_CODE` 再 `readDrainConditionUnmet` | 新代码;不自己写体形判断,`turns` 取 `DRAIN_TURNS` 的词 |
|
|
1426
|
+
| web-admin | 无读点(排空走身份四元形,不变) | 无 |
|
|
1427
|
+
| sdk | 契约套件 | 零代码改动(符合性语料不变) |
|
|
1428
|
+
| test | 黑盒判据 | 见 `CHANGELOG.md` 33.1.0 的 K25 – K36 |
|
package/llms-full.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
llms-full.txt — 自包含全文 · 消费方(使用者)视角 · @sema-agent/settings-schema
|
|
3
|
-
重写日期: 2026-11-
|
|
3
|
+
重写日期: 2026-11-22 | 包版本: 33.1.0
|
|
4
4
|
生成方式: 无生成脚本——按当前树 src/*.ts 导出面 + package.json + README/CHANGELOG 手写事实版。
|
|
5
5
|
证据约定: 每条"它怎么工作"的断言附 (文件: 符号) 坐标,刻意不用行号(行号逐版腐烂;符号名由
|
|
6
6
|
typecheck 与 test/package-surface.test.ts、test/docs-hygiene.test.ts 等常驻门钉住)。无证据推断显式标【推断】。
|
|
@@ -482,6 +482,7 @@ entitlement/execution/limits = `none`;`projects` = `salvage`,整域档位仍 `"t
|
|
|
482
482
|
读器 `readServingLeaseRequest` / `readServingLeaseResponse`;`denied` 只凭正面证据(web-admin 持久化的代际下限之下 ⇒ superseded),对象缺席 ⇒ `unknown`;`readServingLeaseResponse` 按 `verdict` 键判,返回 `ServingLeaseReading`(`denied` 的 reason 不在闭集 / 缺 ⇒ 仍是 denied,reason 读成 `SERVING_LEASE_UNKNOWN_REASON` = `"unknown_reason"`;判别词不在三词 ⇒ undefined);
|
|
483
483
|
web-admin 能力位 `WebAdminCapabilities { servingLease?: true }` + 两态读器 `readCapabilityReading(reply): CapabilityReading`(9.0.0 起取代 `readCenterCapabilities`;吃心跳 2xx 的整只答复体,答 `declared { capabilities }`(`capabilities` 键是自有键且值过 schema;`capabilities` 是自有属性的副本,原型是包的隔离原型)| `unreadable { why: not-an-object | capabilities-absent | invalid-capabilities }`(不是读数:体不是对象 / 键缺席——老 web-admin、`{}`、位平铺——/ 键在场而形坏;沉默不放松围栏,引擎当没有这一拍答复);25.0.0 起没有 `undeclared`;租约客户端只在 `declared` 且 `servingLease === true` 时启用);排空口型 `DrainRequest { actionId, scope?, worker, expectedGeneration?, instanceId?, deadlineAt, term? }`、
|
|
484
484
|
`DrainReceipt = EngineDraining + state ∈ DRAIN_RECEIPT_STATES(draining | already_draining)`,读器 `readDrainRequest` / `readDrainReceipt`;
|
|
485
|
+
33.1.0(additive;`.` 与 `./fleet`)排空口的第二种请求体「凭据点名形」(调用方凭出示的起服凭据点名、不报身份四元,体只说这一发的事):`CredentialDrainRequest` = 严格对象 `{ instanceId?, turns?, attachedAtMost? }`(`.strict()`;三键各自可缺,读器 `readCredentialDrainRequest(body)` **不替缺席的键铸缺省** —— 空体 `{}` 读成 `{}`;缺席的含义由收请求的一侧落 —— 缺席 `turns` 按 `yield`、缺席 `attachedAtMost` 按不设条件,本包不导缺省常量;`instanceId` = 非空串,与 `DrainRequest.instanceId` 同一只 schema;`turns` = 两词闭集 `DRAIN_TURNS`(`yield` | `halt`,深冻结;同名 zod 枚举 `DrainTurns`,字面量联合 ⇒ 写错词编译期红)—— `yield` 是排空一贯的让出、`halt` 再请求每一只在跑的轮次立即停下(用户在那个窗口按 Esc 的同一刀,期限不动;引擎只对持有「能对任一条运行按 Esc 的运维权力」的调用方认它),词义是引擎的行为、本包只定形;`attachedAtMost` = 非负安全整数(包内唯一的非负安全整数形),「受理这一拍附着流数不超过它才受理」,只陈述受理那一拍;多一键 / 未知词 / 负数 / 小数 / 串 / 超出安全整数的数 / 访问器抛 / 不可枚举的自有键 / 非对象 ⇒ 整份 `undefined`,不抛)。与身份四元形互斥:`DrainRequest` 必带 `actionId` / `worker` / `deadlineAt`,凭据点名形把它们当多余键拒 ⇒ 没有一只 JSON 体(朴素数据)被 `readDrainRequest` 与 `readCredentialDrainRequest` 同时读进(对两只读器露出不同键集的非 JSON 对象,例如 `ownKeys` 陷阱谎报键集的 Proxy,不在此内);`turns` / `attachedAtMost` 不进四元形(单形的 `readDrainRequest` 照旧剥未知键,带着它们的四元形体在它那里读成不带它们的 `DrainRequest`;聚合读器把这样的体读成混形、哪一形都不是);回执两形相同,仍是 `DrainReceipt`。**读请求体只用一只**:服务端与下游都只用聚合读器 `readDrainRequestReading(body)`,答判别联合 `DrainRequestReading` = `{ form: "identity", request: DrainRequest }` | `{ form: "credential", request: CredentialDrainRequest }`,两形都读不进 ⇒ `undefined`;**混形**(身份形读得进、而体上自有凭据点名形独有的键 `turns` / `attachedAtMost`,键集 = 凭据点名形的键减去两形共有的 `instanceId`、从两只 schema 派生;值合法与否同答;自有按描述符律判:访问器〔不调〕/ 不可枚举 / 读不出都算带着,只靠继承不算)⇒ `undefined`(按本规则读的服务端应答 400 —— 服务端一侧的行为,本包不验证);形词闭集 `DRAIN_REQUEST_FORMS` = `["identity", "credential"]`(深冻结,与联合的 `form` 恰等;按 `form` 穷举的 `switch` 加一形即编译红);它只组合两只单形读器(先身份形、后凭据点名形,不另写 schema),交回的 `request` 就是那一只的答(读得进时与对应那一形的单形读器同答;反过来不成立:混形的朴素体它答 `undefined`、单形身份读器照读);上面那种谎报键集的 Proxy,混形判按独有键逐只问描述符,问到一只 ⇒ `undefined`,一只都问不到才按序答身份形;两只单形读器留给已知自己发的是哪一形的一侧。条件不满足那一拒(409)的机读码常量 `DRAIN_CONDITION_UNMET_CODE` = `"conflict.drain_condition_unmet"`,拒体根上带两个事实 `DrainConditionUnmet { attached, attachedAtMost }`(两个非负安全整数,与请求里的 `attachedAtMost` 同一只 schema),读器 `readDrainConditionUnmet(body)`:先看机读码再读;不判码、不判两数大小关系、剥掉拒体根上的 `error` / `errorCode`,缺一个事实 ⇒ `undefined`(src/fleet.ts: `CredentialDrainRequest` / `readCredentialDrainRequest` / `DRAIN_TURNS` / `DrainTurns` / `DrainConditionUnmet` / `readDrainConditionUnmet` / `DRAIN_CONDITION_UNMET_CODE` / `DrainRequestReading` / `DRAIN_REQUEST_FORMS` / `readDrainRequestReading`;test/credential-drain-request-33.1.0.test.ts);
|
|
485
486
|
`clampServingLeaseTtlMs(n)`(配置 TTL 唯一夹取点:读不出 ⇒ 缺省,低于地板 ⇒ 地板,无上限;应答的 `ttlMs` 不夹);
|
|
486
487
|
8.2.0(additive):`LEASE_STATES` = `["none", "granted", "expired", "denied"]` + zod `LeaseState`(引擎持有的租约四态闭集;只有 fleet 成员说它);
|
|
487
488
|
`EngineSignal.leaseState?`(`leaseUntil` 在场 ⇔ `granted`);`InstanceAnnouncement` 加 `generation?` / `leaseState?` / `leaseUntil?`(各引 `EngineSignal` 同名键那一只 schema,
|
package/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<!--
|
|
2
2
|
llms.txt — 消费方(使用者)视角索引 · @sema-agent/settings-schema
|
|
3
|
-
重写日期: 2026-11-
|
|
3
|
+
重写日期: 2026-11-22 | 包版本: 33.1.0
|
|
4
4
|
生成方式: 无生成脚本——按当前树的 src/*.ts 导出面 + package.json + README/CHANGELOG 手写事实版;
|
|
5
5
|
每条断言附证据坐标(文件:符号),刻意不用行号(行号随每版腐烂,符号名由 typecheck/test 钉住)。
|
|
6
6
|
刷新触发: package.json 版号变更(test/docs-hygiene.test.ts D 组钉「包版本:」与 package.json 相等、
|
|
@@ -173,6 +173,7 @@ llms.txt — 消费方(使用者)视角索引 · @sema-agent/settings-schema
|
|
|
173
173
|
`isReadyForTraffic` / `isRoutable` 是它们的布尔形;没有信号(旧引擎)= `no-engine-signal`,不可路由;平铺方言(`/health` 的布尔对 + 心跳上与信号同名的平铺键)26.0.0 删,还带它们的体照收、判官不读;
|
|
174
174
|
8.3.0 additive:env 名常量 `FLEET_SCOPE_ENV`(`"FLEET_SCOPE"`,成员所属租户 scope,渲染器写、引擎读;缺席 = 默认 scope `GLOBAL_SCOPE`;进保留 env 名表);
|
|
175
175
|
14.7.0 additive:公告地址 env 名常量 `FLEET_ADVERTISE_ADDRESS_ENV`(`"FLEET_ADVERTISE_ADDRESS"`)+「后面要拼路径的基址」座位的禁用成分集 `PATH_BASE_URL_FORBIDDEN_PARTS`(`userinfo` / `query` / `fragment`)+ 判官 `pathBaseUrlFlaws(url)`(= `httpUrlFlaws` 配这一集;判展开之后的值;`webAdminSessionUrl` 也读它);
|
|
176
|
+
33.1.0 additive:排空口的凭据点名形请求体 `CredentialDrainRequest`(严格对象 `{ instanceId?, turns?, attachedAtMost? }`,三键各自可缺、读器 `readCredentialDrainRequest` 不铸缺省)+ 两词闭集 `DRAIN_TURNS`(`yield` | `halt`;同名 zod 枚举 `DrainTurns`)+ 条件不满足那一拒(409)的体 `DrainConditionUnmet { attached, attachedAtMost }` / 读器 `readDrainConditionUnmet` / 码常量 `DRAIN_CONDITION_UNMET_CODE`;与身份四元形 `DrainRequest` 互斥(四元形必带 `actionId` / `worker` / `deadlineAt`,凭据点名形拒这三键),`turns` / `attachedAtMost` 不进四元形(其读器照旧剥未知键),回执仍是 `DrainReceipt`;读请求体只用聚合读器 `readDrainRequestReading`(判别联合 `DrainRequestReading`:`form` = 形词闭集 `DRAIN_REQUEST_FORMS` 的 `identity` | `credential`,`request` = 那一形读出的请求;只组合两只单形读器;两形的键混在一起的体 —— 身份形上自有 `turns` / `attachedAtMost` —— 哪一形都不是、答 `undefined`(按本规则读的服务端应答 400,服务端一侧的行为、本包不验证);缺席 `turns` 按 `yield`、缺席 `attachedAtMost` 按不设条件,由收方落;两只单形读器留给已知自己发的是哪一形的一侧)(src/fleet.ts: `CredentialDrainRequest` / `readCredentialDrainRequest` / `DRAIN_TURNS` / `DrainConditionUnmet` / `readDrainConditionUnmet` / `readDrainRequestReading` / `DRAIN_REQUEST_FORMS`);
|
|
176
177
|
29.0.0 BREAKING:本地读取域集 `LOCAL_READ_DOMAINS`(`./node`,深冻结;= 便携域集原序 + `projects`;答「`FileConfigStore` / `loadLocalConfig` 读 `config.d/` 里哪些域」,便携域集 `PORTABLE_DOMAINS` 只答「哪些域随 bundle 搬运」,两个问题两只常量)+ 型 `LocalReadDomain` + 带条件的域文件写器 `writeDomainFileIf(root, domain, value, expected)`(`./node`:`expected` = 读到时文件原文的摘要或 `null`,锁文件之下重读、相符才写;结果 `ConditionalWriteResult` 三态 `written` / `stale` / `locked`)+ 内容摘要唯一铸点 `contentDigest(文本 | 字节)`(包根与 `./sha256`;文本按 UTF-8 编码后取摘要)+ `./conformance` 的 `NON_LOCAL_READ_DOMAINS`(T3 改名 `T3-non-local-read-domains`;删 `NON_PORTABLE_DOMAINS`,包内没有读者了)—— 到期删码:一次性迁移 SS-M8(退役角色词,窗 2026-11-11 已关;`ONE_TIME_MIGRATION_IDS` 删 SS-M8,连同本版尾插的 SS-M13 是 SS-M10 / SS-M11 / SS-M12 / SS-M13,存量里还带 `roles.team` / `roles.synthesize` 的文档:写面整域拒、读面丢弃 / 缺省并点名〔告警经 `onWarning` / `read().warnings` 出声〕,迁移与 `migrate` 不再改写)—— 读数变化四处:盘上已有的 `config.d/projects.json` 自此被读(读不进的自此拒)· 内容版本对同一组文件换一次数 · 拒单文档名联合 `ConfigDocumentName` 多 `"projects"`(穷举的读者编译红一次)· 语料本地腿金样随改;便携域集与 bundle 一字不动;同批两件:钩子环境置空原因闭集 `HOOK_ENV_BLANK_REASONS` 加 `unset`(闭集增长,头字节不变)· `FileConfigStore.getVersion()` 与 `read()` 同一个版本(文件层被拒的树由抛变答数);
|
|
177
178
|
28.0.0 BREAKING:包的每个闭集导出(词表数组 / 行表 / 常量表 / Set)在定义处深冻结 —— 对它们的原地写(`push` / `sort` / `length = 0` / 下标或属性赋值 / `delete` / `Set.add` / `Set.delete` / `Set.clear`)由静默成功变抛 `TypeError`(数组方法与集合方法任何模式、赋值与删键在严格模式),读法的答案逐位不变;十五个导出 / 类型的声明收窄成只读(`DOMAINS` → `readonly DomainName[]`,`DELIVER_DENYLIST` / `RESERVED_WORKER_ENV` → `ReadonlySet<string>`,`ROLE_RANK` 等五张表与两只 node IO 对象 → `Readonly<…>`,`ParseTransparentKey` / `DerivationTransform` 的字段、`SAFETY_MERGE_SPEC` 的两张 `order` 元组、`TightenRule` / `MergeCategorySpec` 的字段与数组 → 只读;逐名见 CHANGELOG 28.0.0)—— 不加不删导出名;冻结助手包内私有、不在任何出口;`Set` 的守卫拦的是经它自己的方法发生的写(有意调原型方法仍能绕过);要改闭集的代码先拷贝再改;
|
|
178
179
|
27.2.0 additive:条目拒因码闭集 `MODEL_ENTRY_REFUSAL_CODES` 尾插一只泛词 `config.model_route_refused`(服务端把一条目录条目算作可服务之前交引擎的线路判官做了静态判决〔条目的端点 × 它带不带凭据〕、引擎拒了:这一条不服务,其余照常;判的是引擎,本包与服务端都不判,拒的细节是引擎自己的码;与 `config.model_no_brain`〔没有能服务它的腿〕/ `config.model_entry_invalid`〔条目自己的形不对〕有分界,与组拒码里同词干的 `config.model_route_endpoint_missing` 不同集)—— 不加不删导出名,零校验变化;`readModelRefusals` 对 `entries` 值是新词的那一条由「丢掉」变读出;持穷举表的消费方提货编译红一次;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/settings-schema",
|
|
3
|
-
"version": "33.
|
|
3
|
+
"version": "33.1.0",
|
|
4
4
|
"description": "Sema settings schema — pure config contract (zod domains + effective-config + roster resolution + ref-integrity + remoteExec) shared by sema-web-admin, sema-server, and the TOC desktop/CLI. One source of truth. (Renamed at 1.0.0 from @sema-agent/registry-core — name and docs only, no behavior change; note the range moves 0.19.0 -> 1.0.0, so a dependency must become ^1.0.0. The old names @sema-agent/registry-core <=0.19.0 and @sema-ai/registry-core remain published, frozen, for migration.)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|