@sema-agent/settings-schema 25.0.0 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +359 -0
- package/README.md +46 -31
- package/conformance/VERSION +1 -1
- package/conformance/cases/c27-hosts-array-1025/meta.json +1 -1
- package/conformance/cases/c48-s935-model-headers-transported/expected.json +18 -68
- package/conformance/cases/c48-s935-model-headers-transported/meta.json +1 -1
- package/conformance/cases/c67-s784-retired-field-loud/meta.json +1 -1
- package/conformance/cases/c77-prompts-center-artifact-carried/expected.json +5 -5
- package/conformance/cases/c77-prompts-center-artifact-carried/input.json +2 -2
- package/conformance/cases/c79-prompts-bad-worker-artifact-not-salvaged/expected.json +1 -1
- package/conformance/cases/c79-prompts-bad-worker-artifact-not-salvaged/input.json +3 -3
- package/conformance/cases/c80-prompts-wire-v2-verbatim/expected.json +1 -1
- package/conformance/cases/c80-prompts-wire-v2-verbatim/input.json +1 -1
- package/conformance/cases/c82-prompts-v1-catalog-refused/expected.json +1 -1
- package/conformance/cases/c82-prompts-v1-catalog-refused/input.json +1 -1
- package/conformance/cases/c83-prompts-bad-overlay-not-salvaged/expected.json +1 -1
- package/conformance/cases/c83-prompts-bad-overlay-not-salvaged/input.json +1 -1
- package/conformance/cases/c88-projects-content-attestation-carried/expected.json +185 -0
- package/conformance/cases/c88-projects-content-attestation-carried/input.json +59 -0
- package/conformance/cases/c88-projects-content-attestation-carried/meta.json +6 -0
- package/conformance/cases/c89-projects-content-attestation-malformed/expected.json +104 -0
- package/conformance/cases/c89-projects-content-attestation-malformed/input.json +38 -0
- package/conformance/cases/c89-projects-content-attestation-malformed/meta.json +6 -0
- package/dist/cli.d.ts +7 -7
- package/dist/cli.js +11 -19
- package/dist/config-dir-io.js +3 -14
- package/dist/config-dir-migration.d.ts +1 -4
- package/dist/config-dir-migration.js +16 -22
- package/dist/config-document-refusal.d.ts +2 -3
- package/dist/config-fns.d.ts +3 -4
- package/dist/config-fns.js +9 -7
- package/dist/conformance/run.js +89 -29
- package/dist/conformance/types.d.ts +65 -39
- package/dist/execution-lane-index.d.ts +8 -19
- package/dist/execution-lane-index.js +6 -27
- package/dist/file-store.js +2 -3
- package/dist/fleet.d.ts +10 -47
- package/dist/fleet.js +13 -40
- package/dist/fs-failure.d.ts +5 -10
- package/dist/fs-failure.js +4 -8
- package/dist/hooks.d.ts +8 -6
- package/dist/hooks.js +7 -4
- package/dist/migration-receipt.d.ts +12 -14
- package/dist/migration-receipt.js +5 -7
- package/dist/node.js +1 -1
- package/dist/one-time-migrations.d.ts +9 -24
- package/dist/one-time-migrations.js +30 -796
- package/dist/remote-exec.js +2 -3
- package/dist/retired-envs.js +2 -0
- package/dist/retired-form.d.ts +12 -11
- package/dist/retired-form.js +12 -8
- package/dist/sandbox-git.d.ts +1 -1
- package/dist/sandbox-git.js +3 -3
- package/dist/scheduler-lifetime.d.ts +1 -1
- package/dist/scheduler-lifetime.js +1 -1
- package/dist/scheduler-store.d.ts +4 -29
- package/dist/scheduler-store.js +21 -14
- package/dist/types.d.ts +18 -21
- package/dist/types.js +81 -112
- package/dist/web-admin-credential.d.ts +2 -2
- package/dist/web-admin-credential.js +4 -4
- package/dist/worker-row-verdict.d.ts +1 -1
- package/dist/worker-row-verdict.js +1 -1
- package/dist/workers-rows.d.ts +2 -2
- package/dist/workers-rows.js +2 -2
- package/dist/zod-unwrap.d.ts +1 -1
- package/dist/zod-unwrap.js +1 -1
- package/docs/API-SURFACE.md +4 -11
- package/docs/CONFORMANCE.md +25 -13
- package/docs/CONSUMER-INTEGRATION.md +78 -24
- package/llms-full.txt +25 -24
- package/llms.txt +19 -13
- package/package.json +1 -1
- package/dist/runtime-lift-targets.d.ts +0 -7
- package/dist/runtime-lift-targets.js +0 -7
- package/dist/scheduler-store-migration.d.ts +0 -14
- package/dist/scheduler-store-migration.js +0 -14
package/dist/conformance/run.js
CHANGED
|
@@ -154,10 +154,25 @@ function splitMetadata(effective) {
|
|
|
154
154
|
*/
|
|
155
155
|
const underPointerPrefix = (patchPath, prefix) => patchPath === prefix || patchPath.startsWith(`${prefix}/`);
|
|
156
156
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
157
|
+
* **方向律**(26.0.0):一行姿态只盖「消费方给得少」—— 结局形是「金样受理、消费方拒」,坐标形是「消费方没有金样那一处的值」(`remove`)。
|
|
158
|
+
* 债盖任一方向。一只判官,两只匹配器都问它:形不合法的姿态(方向反了 —— 违例已单记)谁都不命中,fail-closed。
|
|
159
159
|
*/
|
|
160
|
-
function
|
|
160
|
+
function kindCovers(e, shape) {
|
|
161
|
+
const kind = e.kind; // 宽读:适配器可能来自 JSON / `as`
|
|
162
|
+
switch (kind) {
|
|
163
|
+
case "debt":
|
|
164
|
+
return true;
|
|
165
|
+
case "posture":
|
|
166
|
+
return "op" in shape ? shape.op === "remove" : shape.expected === "effective" && shape.actual === "rejected";
|
|
167
|
+
default:
|
|
168
|
+
return false; // 类不在闭集(违例已单记):谁都不命中
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* 一条 effective diff 落在账本哪一条上 —— 命中返回条目下标,没命中 `undefined`。
|
|
173
|
+
* 四道判据缺一不可:腿相同 ∧(`cases` 缺席或含该 case)∧ 坐标在 `pathPrefix` 那棵子树里 ∧ 这一类盖得住这条差的方向({@link kindCovers})。
|
|
174
|
+
*/
|
|
175
|
+
function ledgerIndexFor(ledger, caseId, leg, patch) {
|
|
161
176
|
for (let i = 0; i < ledger.length; i++) {
|
|
162
177
|
const e = ledger[i];
|
|
163
178
|
if (e.outcome !== undefined)
|
|
@@ -166,7 +181,9 @@ function ledgerIndexFor(ledger, caseId, leg, patchPath) {
|
|
|
166
181
|
continue;
|
|
167
182
|
if (e.cases !== undefined && !e.cases.includes(caseId))
|
|
168
183
|
continue;
|
|
169
|
-
if (!underPointerPrefix(
|
|
184
|
+
if (!underPointerPrefix(patch.path, e.pathPrefix))
|
|
185
|
+
continue;
|
|
186
|
+
if (!kindCovers(e, patch))
|
|
170
187
|
continue;
|
|
171
188
|
return i;
|
|
172
189
|
}
|
|
@@ -174,22 +191,27 @@ function ledgerIndexFor(ledger, caseId, leg, patchPath) {
|
|
|
174
191
|
}
|
|
175
192
|
/**
|
|
176
193
|
* 一条**结局形**分歧落在账本哪一条上。四道判据全等,一道都不放宽:腿 ∧ case 在点名名单里 ∧
|
|
177
|
-
* 金样期望的结局 ∧
|
|
194
|
+
* 金样期望的结局 ∧ 消费方实际的结局 —— 再加这一类盖得住这个方向({@link kindCovers})。没命中 `undefined`。
|
|
178
195
|
*/
|
|
179
196
|
function ledgerIndexForOutcome(ledger, caseId, leg, shape) {
|
|
180
197
|
for (let i = 0; i < ledger.length; i++) {
|
|
181
|
-
const
|
|
198
|
+
const e = ledger[i];
|
|
199
|
+
const o = e.outcome;
|
|
182
200
|
if (o === undefined)
|
|
183
201
|
continue;
|
|
184
|
-
// 形不合法的登记(`cases`
|
|
202
|
+
// 形不合法的登记(`cases` 缺席/空、姿态方向反了 —— 违例已单记)绝不因此**扩大**覆盖:它谁都不命中,fail-closed。
|
|
185
203
|
if (o.leg !== leg || !isJsonArray(o.cases) || !o.cases.includes(caseId))
|
|
186
204
|
continue;
|
|
187
205
|
if (o.expected !== shape.expected || o.actual !== shape.actual)
|
|
188
206
|
continue;
|
|
207
|
+
if (!kindCovers(e, shape))
|
|
208
|
+
continue;
|
|
189
209
|
return i;
|
|
190
210
|
}
|
|
191
211
|
return undefined;
|
|
192
212
|
}
|
|
213
|
+
/** 一行账本的类读成人话(报告 detail 用)。 */
|
|
214
|
+
const kindWord = (e) => (e.kind === "posture" ? "姿态" : "债");
|
|
193
215
|
/** 结局形不一致的一格:附上**结构化**的 `diff.outcome`,命中账本就记 `diff-ledgered`。 */
|
|
194
216
|
function outcomeVerdict(base, detail, shape, ledger, hits) {
|
|
195
217
|
const diff = { effective: [], warnings: { missing: [], extra: [] }, metadata: [], outcome: shape };
|
|
@@ -197,7 +219,7 @@ function outcomeVerdict(base, detail, shape, ledger, hits) {
|
|
|
197
219
|
if (i === undefined)
|
|
198
220
|
return { ...base, status: "diff", detail, diff };
|
|
199
221
|
hits[i] += 1;
|
|
200
|
-
return { ...base, status: "diff-ledgered", detail: `${detail} — 落在适配器的已知分歧账本里(
|
|
222
|
+
return { ...base, status: "diff-ledgered", detail: `${detail} — 落在适配器的已知分歧账本里(结局形,${kindWord(ledger[i])})`, diff, ledgerRefs: [ledger[i].ref] };
|
|
201
223
|
}
|
|
202
224
|
/** 一条腿交回的**每一处文本**里的语料秘密:读出 ⇒ 告警面(`findSecretLeaks`,同一只判据);拒绝 ⇒ 诊断句。 */
|
|
203
225
|
function legLeaks(actual, secrets) {
|
|
@@ -276,11 +298,12 @@ function judge(c, leg, expected, actual, normalizer, ledger, hits) {
|
|
|
276
298
|
// 一格里只要有一条坐标没登记,整格仍是 `diff`(账本是白名单,不是整格豁免)。
|
|
277
299
|
const ledgerable = effectivePatch.length > 0 && warningDiff.missing.length === 0 && warningDiff.extra.length === 0 && metadataPatch.length === 0;
|
|
278
300
|
if (ledgerable) {
|
|
279
|
-
const idx = effectivePatch.map((p) => ledgerIndexFor(ledger, c.id, leg, p
|
|
301
|
+
const idx = effectivePatch.map((p) => ledgerIndexFor(ledger, c.id, leg, p));
|
|
280
302
|
if (idx.every((i) => i !== undefined)) {
|
|
281
303
|
for (const i of idx)
|
|
282
304
|
hits[i] += 1;
|
|
283
|
-
|
|
305
|
+
const words = [...new Set(idx.map((i) => kindWord(ledger[i])))].join(" / ");
|
|
306
|
+
return { ...base, status: "diff-ledgered", detail: `${detail} — 全部落在适配器的已知分歧账本里(${words})`, diff, ledgerRefs: idx.map((i) => ledger[i].ref) };
|
|
284
307
|
}
|
|
285
308
|
}
|
|
286
309
|
return { ...base, status: "diff", detail, diff };
|
|
@@ -386,31 +409,51 @@ async function releaseViolations(adapter, opts, corpus, kit) {
|
|
|
386
409
|
}
|
|
387
410
|
}
|
|
388
411
|
// 账本条目的**形**:一条大包大揽的 `pathPrefix`(`/` 或空串)不是账本,是一个 `ok=true` 开关;
|
|
389
|
-
// 没有票号形 `ref`
|
|
390
|
-
// 类型上已经挡住(
|
|
391
|
-
// 字段先读进宽类型的局部,否则 TS
|
|
412
|
+
// 没有票号形 `ref` 的一条登记没法被人查;债另要 `window` / `flipWhen`(到期靠它们才立得住),姿态不许带它们(两类互斥)。
|
|
413
|
+
// 类型上已经挡住(类是闭集、债的窗必填、姿态的结局方向只有一对),但适配器可能来自 JSON / `as` —— 门不靠类型自证,运行期照判;
|
|
414
|
+
// 字段先读进宽类型的局部,否则 TS 把「不在闭集」那一支收成 `never`,连报错文案都取不出字段。
|
|
392
415
|
const ledger = adapter.knownDivergences ?? [];
|
|
393
416
|
const nowMs = opts.nowMs;
|
|
394
417
|
const today = typeof nowMs === "number" && Number.isFinite(nowMs) ? new Date(nowMs).toISOString().slice(0, 10) : undefined;
|
|
395
|
-
|
|
396
|
-
|
|
418
|
+
// 钟是判窗用的:只有债有窗。账本里没有债(空,或只有姿态)⇒ 不需要钟。
|
|
419
|
+
if (ledger.some((e) => e.kind !== "posture") && today === undefined)
|
|
420
|
+
v.push("release mode needs `nowMs` to judge the ledger windows — 库码不读环境时钟,钟由调用方传(账本里没有债时不需要)");
|
|
397
421
|
for (const e of ledger) {
|
|
398
422
|
const ref = e.ref;
|
|
399
423
|
const kind = e.kind;
|
|
400
424
|
const window = e.window;
|
|
425
|
+
const flipWhen = e.flipWhen;
|
|
401
426
|
const name = typeof ref === "string" ? ref : String(ref);
|
|
402
427
|
if (typeof ref !== "string" || !LEDGER_REF_RULE.test(ref))
|
|
403
428
|
v.push(`known divergence \`ref\` ${JSON.stringify(ref)} is not a ticket id (\`ABC-12\` / \`ABC-12②\` / \`XY-7.3\` form) — 查不到出处的一条登记等于没登记`);
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
429
|
+
switch (kind) {
|
|
430
|
+
case "debt":
|
|
431
|
+
if (window === undefined)
|
|
432
|
+
v.push(`known divergence \`${name}\` has no \`window\` — 说不出最晚活到哪天的债永远不会被还`);
|
|
433
|
+
else if (!isCalendarDate(window))
|
|
434
|
+
v.push(`known divergence \`${name}\`: \`window\` ${JSON.stringify(window)} is not a calendar date (YYYY-MM-DD, UTC)`);
|
|
435
|
+
else if (today !== undefined && today > window)
|
|
436
|
+
v.push(`known divergence \`${name}\` is past its window ${window} (today ${today}) — pay the debt, or move the window in the ticket with a reason`);
|
|
437
|
+
if (typeof flipWhen !== "string" || flipWhen.trim().length === 0)
|
|
438
|
+
v.push(`known divergence \`${name}\` has an empty \`flipWhen\` — 说不出什么时候删,它就永远不会被删`);
|
|
439
|
+
break;
|
|
440
|
+
case "posture": {
|
|
441
|
+
// 两类互斥(与腿表态的两臂互斥同律):姿态不到期、没有翻转条件 —— 带着它们的一行要么是没改完的债,要么是把债写成了姿态。
|
|
442
|
+
if (window !== undefined)
|
|
443
|
+
v.push(`known divergence \`${name}\` is a posture yet carries a \`window\` — 姿态不到期;会还的差异是债(\`kind: "debt"\`)`);
|
|
444
|
+
if (flipWhen !== undefined)
|
|
445
|
+
v.push(`known divergence \`${name}\` is a posture yet carries a \`flipWhen\` — 姿态没有翻转条件;会还的差异是债(\`kind: "debt"\`)`);
|
|
446
|
+
const o = e.outcome;
|
|
447
|
+
if (o !== undefined) {
|
|
448
|
+
const shape = o;
|
|
449
|
+
if (shape.expected !== "effective" || shape.actual !== "rejected")
|
|
450
|
+
v.push(`known divergence \`${name}\` is a posture on outcome ${String(shape.expected)} → ${String(shape.actual)} — a posture covers only the consumer refusing what the golden accepts (effective → rejected); accepting what the golden refuses, or refusing differently, is a debt`);
|
|
451
|
+
}
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
default:
|
|
455
|
+
v.push(`known divergence \`${name}\` has kind \`${String(kind)}\` — the ledger takes debt | posture (a debt has a ticket and a window; a posture has a ticket and covers only the consumer giving less)`);
|
|
456
|
+
}
|
|
414
457
|
if (e.outcome === undefined) {
|
|
415
458
|
if (!e.pathPrefix.startsWith("/") || e.pathPrefix.length < 2)
|
|
416
459
|
v.push(`known divergence \`${name}\` has a blanket \`pathPrefix\` (\`${e.pathPrefix}\`) — 账本要逐坐标点名,整片豁免不是账本`);
|
|
@@ -487,6 +530,20 @@ function notRunDetail(s) {
|
|
|
487
530
|
}
|
|
488
531
|
}
|
|
489
532
|
}
|
|
533
|
+
/** 报告行的「类」一半:按闭集穷举(加一类而不在这里表态 ⇒ `never` 赋值编译红)。从 JSON / `as` 来的不在闭集的类在这里照抄
|
|
534
|
+
* (违例已在 release 门单记;historical 模式不判形),不抛。 */
|
|
535
|
+
function termOf(e, where) {
|
|
536
|
+
switch (e.kind) {
|
|
537
|
+
case "debt":
|
|
538
|
+
return { ...where, kind: "debt", window: e.window, flipWhen: e.flipWhen };
|
|
539
|
+
case "posture":
|
|
540
|
+
return { ...where, kind: "posture" };
|
|
541
|
+
default: {
|
|
542
|
+
const unhandled = e;
|
|
543
|
+
return { ...where, kind: unhandled.kind };
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
490
547
|
/**
|
|
491
548
|
* 跑一遍门。
|
|
492
549
|
*
|
|
@@ -539,9 +596,12 @@ export async function runConformance(adapter, opts) {
|
|
|
539
596
|
const summary = { pass: 0, diff: 0, "diff-ledgered": 0, "expected-rejected": 0, "harness-error": 0, skipped: 0 };
|
|
540
597
|
for (const r of results)
|
|
541
598
|
summary[r.status] += 1;
|
|
542
|
-
const ledgerRows = ledger.map((e, i) =>
|
|
543
|
-
|
|
544
|
-
|
|
599
|
+
const ledgerRows = ledger.map((e, i) => {
|
|
600
|
+
const where = e.outcome === undefined
|
|
601
|
+
? { ref: e.ref, leg: e.leg, pathPrefix: e.pathPrefix, ...(e.cases === undefined ? {} : { cases: e.cases }), hits: hits[i] }
|
|
602
|
+
: { ref: e.ref, leg: e.outcome.leg, outcome: { expected: e.outcome.expected, actual: e.outcome.actual }, cases: e.outcome.cases, hits: hits[i] };
|
|
603
|
+
return termOf(e, where);
|
|
604
|
+
});
|
|
545
605
|
if (opts.mode === "release") {
|
|
546
606
|
// **实现的腿必须跑**:实现了却在整套语料上一格真读数都没有,那份实现是空的。
|
|
547
607
|
for (const leg of LEG_NAMES) {
|
|
@@ -554,7 +614,7 @@ export async function runConformance(adapter, opts) {
|
|
|
554
614
|
// **棘轮只降不升**:账本里一条从未命中的登记,自己就是违例 —— 债还了就得把账本删掉。
|
|
555
615
|
for (const row of ledgerRows) {
|
|
556
616
|
if (row.hits === 0)
|
|
557
|
-
violations.push(`stale ledger entry \`${row.ref}\` (leg \`${row.leg}\`, ${row.outcome === undefined ? `pathPrefix \`${row.pathPrefix}\`` : `outcome ${row.outcome.expected}→${row.outcome.actual}`}) never matched a diff — 差异没了就把这一条删掉(${row.flipWhen})`);
|
|
617
|
+
violations.push(`stale ledger entry \`${row.ref}\` (${row.kind}, leg \`${row.leg}\`, ${row.outcome === undefined ? `pathPrefix \`${row.pathPrefix}\`` : `outcome ${row.outcome.expected}→${row.outcome.actual}`}) never matched a diff — 差异没了就把这一条删掉(${row.kind === "debt" ? row.flipWhen : "姿态不再产生差异"})`);
|
|
558
618
|
}
|
|
559
619
|
}
|
|
560
620
|
const uniqueViolations = [...new Set(violations)];
|
|
@@ -145,20 +145,42 @@ export interface LegDeclined {
|
|
|
145
145
|
* release 门在运行期按同一条律判(适配器可能来自 JS / `as`):带 `declined` 又带 `entry` 或 `run` = 形不对。 */
|
|
146
146
|
export type LegStance = ConformanceLeg | LegDeclined;
|
|
147
147
|
/**
|
|
148
|
-
*
|
|
149
|
-
*
|
|
148
|
+
* 消费方对金样的一条**已知差异**的登记位。一行 = **坐标**(哪一处差:坐标形 {@link PathDivergence} / 结局形 {@link OutcomeDivergence})
|
|
149
|
+
* × **类**(为什么差、会不会还):
|
|
150
|
+
* · `debt`(债)= **会还的差异**:带票号形 `ref`、`window`(最晚活到哪天,release 模式过窗即违例)与 `flipWhen`(什么时候删);
|
|
151
|
+
* · `posture`(姿态,26.0.0)= **不打算还的姿态**:消费方有意比金样**给得少** —— 结局形只许「金样受理、消费方拒」(`effective → rejected`),
|
|
152
|
+
* 坐标形只盖「消费方没有金样那一处的值」(effective diff 的 `remove`)。不挂窗、没有 `flipWhen`;`ref` 与债同一条票号律,指向消费方的
|
|
153
|
+
* 裁定 / 票。方向律是它与 11.0.0 删掉的 `declared`(不到期的成文豁免)之间的界:消费方给得**多**或给得**不同**永远是债,姿态盖不住。
|
|
150
154
|
*
|
|
151
155
|
* 成案:消费方对金样的合法差异今天只能写在测试注里,而散文不是判据 —— 谁也说不清「这条差异还在不在」。
|
|
152
156
|
* 登记之后它变成机器可核的一行:命中即 `diff-ledgered`(不阻塞),**从未命中即违例**(`stale ledger entry`)。
|
|
153
|
-
*
|
|
157
|
+
* 这条反向律是本形的重点,两类同律:与本仓 silent-degradation 棘轮同律,只降不升 —— 债还了 / 姿态不再产生差异就得把那一行删掉,
|
|
154
158
|
* 否则它自己会把门顶红。
|
|
155
159
|
*
|
|
156
|
-
* **只收 effective 的差**:告警与元数据差永不可入账(见 {@link ConformanceStatus} 的 `diff-ledgered`)
|
|
160
|
+
* **只收 effective 的差**:告警与元数据差永不可入账(见 {@link ConformanceStatus} 的 `diff-ledgered`),两类同律。
|
|
157
161
|
* **逐坐标**白名单而不是整格豁免:同一格里多一条没登记的坐标,整格仍然是 `diff`。
|
|
158
162
|
*/
|
|
159
163
|
export type KnownDivergence = PathDivergence | OutcomeDivergence;
|
|
160
|
-
/**
|
|
161
|
-
|
|
164
|
+
/** 债的那一半:会还 —— 票号、窗、翻转条件三者都在。 */
|
|
165
|
+
interface DebtTerm {
|
|
166
|
+
kind: "debt";
|
|
167
|
+
/** 台账票号({@link LEDGER_REF_RULE}:`ABC-12` / `ABC-12②` / `XY-7.3` 这一形,不是一段散文)—— 报告按它分组,人照它去查出处。 */
|
|
168
|
+
ref: string;
|
|
169
|
+
/** 这笔债最晚活到哪天:`YYYY-MM-DD`(UTC 日历日,当天仍在窗内)。release 模式的钟({@link ConformanceOptions.nowMs})晚于它 ⇒ 违例。 */
|
|
170
|
+
window: string;
|
|
171
|
+
/** 什么时候该把这一条删掉(债还了)。人读,非空。 */
|
|
172
|
+
flipWhen: string;
|
|
173
|
+
}
|
|
174
|
+
/** 姿态的那一半:不还 —— 只有票号(消费方的裁定 / 票);窗与翻转条件**不许在场**(从债改挂姿态时 spread 留下的旧字段编译期就红)。 */
|
|
175
|
+
interface PostureTerm {
|
|
176
|
+
kind: "posture";
|
|
177
|
+
/** 消费方的裁定 / 票({@link LEDGER_REF_RULE},与债同一条律)。 */
|
|
178
|
+
ref: string;
|
|
179
|
+
window?: never;
|
|
180
|
+
flipWhen?: never;
|
|
181
|
+
}
|
|
182
|
+
/** 坐标形的坐标:effective 的某一片值与金样不同。判别位 = 有 `pathPrefix`、没有 `outcome`。 */
|
|
183
|
+
interface PathCoordinate {
|
|
162
184
|
/** 这条登记管哪条腿。 */
|
|
163
185
|
leg: LegName;
|
|
164
186
|
/** 只管这几个 case;缺席 = 这条腿上的所有 case。 */
|
|
@@ -166,43 +188,40 @@ export interface PathDivergence {
|
|
|
166
188
|
/** effective diff 的 **JSON Pointer 段前缀**:盖住 `pathPrefix` 本身与 `pathPrefix + "/"` 之下的整棵子树,
|
|
167
189
|
* **不**盖名字更长的相邻坐标(登记 `/limits/infraCostRates` 不豁免 `/limits/infraCostRatesInjected`,
|
|
168
190
|
* 登记 `/models/1` 不豁免 `/models/10`)。必须以 `/` 开头并**点名至少一个顶层键** —— `/` 或空串是
|
|
169
|
-
* 一个 `ok=true`
|
|
191
|
+
* 一个 `ok=true` 开关,不是账本。`posture` 行只盖这棵子树里的 `remove`(消费方没有金样那一处的值)。 */
|
|
170
192
|
pathPrefix: string;
|
|
171
|
-
/** 账本只有债。 */
|
|
172
|
-
kind: "debt";
|
|
173
|
-
/** 台账票号({@link LEDGER_REF_RULE}:`ABC-12` / `ABC-12②` / `XY-7.3` 这一形,不是一段散文)—— 报告按它分组,人照它去查出处。 */
|
|
174
|
-
ref: string;
|
|
175
|
-
/** 这笔债最晚活到哪天:`YYYY-MM-DD`(UTC 日历日,当天仍在窗内)。release 模式的钟({@link ConformanceOptions.nowMs})晚于它 ⇒ 违例。 */
|
|
176
|
-
window: string;
|
|
177
|
-
/** 什么时候该把这一条删掉(债还了)。人读,非空。 */
|
|
178
|
-
flipWhen: string;
|
|
179
193
|
outcome?: never;
|
|
180
194
|
}
|
|
195
|
+
/** 一条**坐标形**登记(债或姿态)。 */
|
|
196
|
+
export type PathDivergence = PathCoordinate & (DebtTerm | PostureTerm);
|
|
197
|
+
/** 结局形登记的那对结局。 */
|
|
198
|
+
interface OutcomeShape<E extends "rejected" | "effective", A extends "rejected" | "effective"> {
|
|
199
|
+
leg: LegName;
|
|
200
|
+
/** **必填且非空**:结局形登记只管点名的这几个 case。 */
|
|
201
|
+
cases: readonly string[];
|
|
202
|
+
/** 金样说这条腿该是什么结局。 */
|
|
203
|
+
expected: E;
|
|
204
|
+
/** 消费方实际给出的结局。 */
|
|
205
|
+
actual: A;
|
|
206
|
+
}
|
|
181
207
|
/**
|
|
182
208
|
* 一条**结局形**登记:契约期望这条腿**拒绝**,而消费方读出了 effective(降级 + 诊断),或反过来。
|
|
183
209
|
*
|
|
184
210
|
* 成案(接线实跑):这类差根本没有 effective patch —— 比对停在「结局形就不一样」那一步,坐标形账本
|
|
185
211
|
* 按 `pathPrefix` 够不着它,于是消费方 `ok` 恒 false,而它恰恰是门最该点名、也最该逼着修的一类。
|
|
186
212
|
*
|
|
187
|
-
* 硬约束:**`cases` 必填且非空** ——
|
|
213
|
+
* 硬约束:**`cases` 必填且非空** —— 结局形分歧不许按前缀大包一整条腿的拒绝面。债可以是任一对结局;**姿态只有一对**:
|
|
214
|
+
* `expected: "effective"`、`actual: "rejected"`(消费方拒金样受理的 —— 给得少);反方向(受理金样拒的)与「两边都拒、层 / 码不同」只能是债。
|
|
188
215
|
*/
|
|
189
|
-
export
|
|
190
|
-
|
|
191
|
-
outcome: {
|
|
192
|
-
leg: LegName;
|
|
193
|
-
/** **必填且非空**:结局形登记只管点名的这几个 case。 */
|
|
194
|
-
cases: readonly string[];
|
|
195
|
-
/** 金样说这条腿该是什么结局。 */
|
|
196
|
-
expected: "rejected" | "effective";
|
|
197
|
-
/** 消费方实际给出的结局。 */
|
|
198
|
-
actual: "rejected" | "effective";
|
|
199
|
-
};
|
|
200
|
-
ref: string;
|
|
201
|
-
window: string;
|
|
202
|
-
flipWhen: string;
|
|
216
|
+
export type OutcomeDivergence = ({
|
|
217
|
+
outcome: OutcomeShape<"rejected" | "effective", "rejected" | "effective">;
|
|
203
218
|
leg?: never;
|
|
204
219
|
pathPrefix?: never;
|
|
205
|
-
}
|
|
220
|
+
} & DebtTerm) | ({
|
|
221
|
+
outcome: OutcomeShape<"effective", "rejected">;
|
|
222
|
+
leg?: never;
|
|
223
|
+
pathPrefix?: never;
|
|
224
|
+
} & PostureTerm);
|
|
206
225
|
/** 账本 `ref` 的形 —— 一个台账票号:大写字母起头、`-` 分段、带数字,可带一个小数段与至多两个字符的尾缀(`ABC-12`、`ABC-12②`、
|
|
207
226
|
* `AB-C3`、`XY-7.3`),没有空白。一段散文(「一个设计稿的章节号 — …」)不是票号:查不到、也到不了期。 */
|
|
208
227
|
export declare const LEDGER_REF_RULE: RegExp;
|
|
@@ -291,13 +310,12 @@ export interface ConformanceResult {
|
|
|
291
310
|
/** `status === "diff-ledgered"` 时在场:盖住这一格的账本条目 `ref`(逐坐标,按 diff 顺序)。 */
|
|
292
311
|
ledgerRefs?: readonly string[];
|
|
293
312
|
}
|
|
294
|
-
/** 报告里的一行账本:登记内容 + 它这一跑**命中了几条 diff**。`hits === 0` ⇒ 陈腐(release
|
|
295
|
-
|
|
313
|
+
/** 报告里的一行账本:登记内容 + 它这一跑**命中了几条 diff**。`hits === 0` ⇒ 陈腐(release 模式违例,两类同律)。
|
|
314
|
+
* 按 `kind` 收窄:`debt` 行带 `window` / `flipWhen`,`posture` 行没有。 */
|
|
315
|
+
export type LedgerRow = {
|
|
296
316
|
ref: string;
|
|
297
|
-
kind: KnownDivergence["kind"];
|
|
298
|
-
window: string;
|
|
299
317
|
leg: LegName;
|
|
300
|
-
/** 坐标形登记的段前缀(见 {@link PathDivergence
|
|
318
|
+
/** 坐标形登记的段前缀(见 {@link PathDivergence});**结局形**登记没有这一项。 */
|
|
301
319
|
pathPrefix?: string;
|
|
302
320
|
/** 结局形登记盯的那对结局;**坐标形**登记没有这一项。 */
|
|
303
321
|
outcome?: {
|
|
@@ -305,9 +323,16 @@ export interface LedgerRow {
|
|
|
305
323
|
actual: "rejected" | "effective";
|
|
306
324
|
};
|
|
307
325
|
cases?: readonly string[];
|
|
308
|
-
flipWhen: string;
|
|
309
326
|
hits: number;
|
|
310
|
-
}
|
|
327
|
+
} & ({
|
|
328
|
+
kind: "debt";
|
|
329
|
+
window: string;
|
|
330
|
+
flipWhen: string;
|
|
331
|
+
} | {
|
|
332
|
+
kind: "posture";
|
|
333
|
+
window?: never;
|
|
334
|
+
flipWhen?: never;
|
|
335
|
+
});
|
|
311
336
|
/** 一次跑的报告。 */
|
|
312
337
|
export interface ConformanceReport {
|
|
313
338
|
mode: ConformanceMode;
|
|
@@ -348,6 +373,7 @@ export interface ConformanceOptions {
|
|
|
348
373
|
corpusDir?: string;
|
|
349
374
|
/** historical 模式的归一器。release 模式传了即违例(归一器只用来看旧版,不用来放宽今天的门)。 */
|
|
350
375
|
normalizer?: ConformanceNormalizer;
|
|
351
|
-
/** 判账本窗的钟(epoch ms)。库码不读环境时钟:release
|
|
376
|
+
/** 判账本窗的钟(epoch ms)。库码不读环境时钟:release 模式下账本里有债(`kind: "debt"`,只有债有窗)⇒ 必须传,否则违例;账本为空或只有姿态不需要。 */
|
|
352
377
|
nowMs?: number;
|
|
353
378
|
}
|
|
379
|
+
export {};
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 车道表({@link EXECUTION_LANES})的两只**派生索引** +
|
|
3
|
-
*
|
|
4
|
-
* 本模块是包内私有的:不进 `package.json` 的 `exports`(与 `secret-scan.ts` 同一姿势),主桶也不取它的任何名字 —— 索引、键集、谓词是本包的实现细节,消费方只拿表本身。
|
|
2
|
+
* 车道表({@link EXECUTION_LANES})的两只**派生索引** + 「迁移能搬哪些逃生口键」的**一张**表,供 `types.ts`(写闸)与 `one-time-migrations.ts`(一次性迁移 SS-M12)同读。
|
|
3
|
+
* 本模块是包内私有的:不进 `package.json` 的 `exports`(与 `secret-scan.ts` 同一姿势),主桶也不取它的任何名字 —— 索引、表、谓词是本包的实现细节,消费方只拿车道表本身。
|
|
5
4
|
* (必需坐标算不算「缺」的唯一判官 `isBlankCoordinate` 不在这里:它住在零依赖的叶模块 `./execution-lanes`,包根与 `./execution-lanes` 子路径是同一只。)
|
|
6
5
|
* 索引只从表派生,不另存任何词:表改了,这里跟着变。
|
|
7
6
|
*
|
|
8
7
|
* ## 迁移指路(7.0.1;11.0.0 起指路句住 `retired-form.ts`;16.0.0 起指路点名**哪一条**迁移)
|
|
9
|
-
* 拒因要不要带迁移指路只有一条规则:**这个键「旧形 ⇒
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* (`test/migration-signpost-11.0.0.test.ts` 用真跑迁移的读数逐个保留名对拍)。
|
|
13
|
-
* 哪一条:车道表登记 7.0.0 之后才进表的车道键({@link LATE_LANE_ENV_KEYS})在 7.0.0 起的存量行里可以**合法地**写在 `env` / `secretEnv` 逃生口里
|
|
14
|
-
* (那时它还不是保留名),它的旧形归登记它那一版的迁移;其余键的旧形只可能出自 6.x 行,归 SS-M4。
|
|
8
|
+
* 拒因要不要带迁移指路只有一条规则:**这个键「旧形 ⇒ 一条还在的迁移能搬」就带,别的保留名不带**;带的话点名搬它的那一条。
|
|
9
|
+
* 「能搬」= {@link LATE_LANE_ENV_KEYS} 这一张表(写闸与迁移读同一张,不是第二张手抄的表)。26.0.0 起 6.x 行的车道 / 店键不再有迁移搬(SS-M4 到期删),
|
|
10
|
+
* 它们的保留名拒句只点名唯一写位。
|
|
15
11
|
*/
|
|
16
12
|
import { type ExecutionLane, type ExecutionLaneRow } from "./execution-lanes.js";
|
|
17
13
|
import type { OneTimeMigrationId } from "./migration-receipt.js";
|
|
@@ -28,20 +24,13 @@ export interface LaneEnvOwner {
|
|
|
28
24
|
export declare const LANE_ENV_OWNER: ReadonlyMap<string, LaneEnvOwner>;
|
|
29
25
|
/** 一个车道 env 名在 WorkerSpec 里的**唯一写位**(保留键的拒因指路用它)。 */
|
|
30
26
|
export declare function laneEnvSeat(name: string, owner: LaneEnvOwner): string;
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
/** 渲染器以前不渲、运维只能写在 env 逃生口里的店键(7.0.0 起归 `runtime.store`;迁移搬进 `store`)。 */
|
|
34
|
-
export declare const STORE_ENV_KEYS: readonly ["DB_BACKEND", "MEMORY_ENGINE", "MEMORY_ENGINE_BACKEND"];
|
|
35
|
-
/** 一个名字是不是车道块的键:车道词两键,或车道表里的任一车道 env 名。 */
|
|
36
|
-
export declare function isLaneEnvKey(name: string): boolean;
|
|
37
|
-
/** 搬一个逃生口里的保留名的那一条一次性迁移,与它改写的存量形是哪一版之前存下的(指路句 `migrationSignpost(migration, before)` 的两个参数)。 */
|
|
27
|
+
/** 搬一个逃生口里的保留名的那一条一次性迁移,与它改写的存量形是哪一版之前存下的(指路句 `migrationSignpost(migration, before)` 的两个参数),
|
|
28
|
+
* 以及它在**哪种行上**搬这个键(`onRow`,拒句里原样说出 —— 指路只对迁移真会动的那种行成立;别的行上同一个键只有手写出路)。 */
|
|
38
29
|
export interface EnvKeyMigration {
|
|
39
30
|
readonly migration: OneTimeMigrationId;
|
|
40
31
|
readonly before: string;
|
|
32
|
+
readonly onRow: string;
|
|
41
33
|
}
|
|
42
34
|
/** 7.0.0 之后才登记进车道表、而登记之前引擎就已在读的车道 env 名 → 改写它的迁移(只增不减;每有一个,在这里写一行)。16.0.0:`DEVICE_RELAY_URL`(device 行的必需坐标;
|
|
43
35
|
* 此前 device 臂就读它而表漏登记,7.0.0–15.x 的写闸把它当普通 env 收下)→ SS-M12。登记之前没有任何已发引擎读过的新键(17.1.0 `DEVICE_TRUSTED_PROXY_CIDRS`)没有存量旧形可搬,不进本表。 */
|
|
44
36
|
export declare const LATE_LANE_ENV_KEYS: ReadonlyMap<string, EnvKeyMigration>;
|
|
45
|
-
/** 一个 env 名在逃生口里 ⇒ 哪一条迁移搬它(见文件头「迁移指路」):晚登记的车道键 ⇒ 登记它那一版的迁移;别的车道块键与店键 ⇒ SS-M4;其余 ⇒ `undefined`(没有迁移搬它)。
|
|
46
|
-
* 写闸拒因带不带指路、指哪一条只看它。 */
|
|
47
|
-
export declare function envKeyMigration(name: string): EnvKeyMigration | undefined;
|
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 车道表({@link EXECUTION_LANES})的两只**派生索引** +
|
|
3
|
-
*
|
|
4
|
-
* 本模块是包内私有的:不进 `package.json` 的 `exports`(与 `secret-scan.ts` 同一姿势),主桶也不取它的任何名字 —— 索引、键集、谓词是本包的实现细节,消费方只拿表本身。
|
|
2
|
+
* 车道表({@link EXECUTION_LANES})的两只**派生索引** + 「迁移能搬哪些逃生口键」的**一张**表,供 `types.ts`(写闸)与 `one-time-migrations.ts`(一次性迁移 SS-M12)同读。
|
|
3
|
+
* 本模块是包内私有的:不进 `package.json` 的 `exports`(与 `secret-scan.ts` 同一姿势),主桶也不取它的任何名字 —— 索引、表、谓词是本包的实现细节,消费方只拿车道表本身。
|
|
5
4
|
* (必需坐标算不算「缺」的唯一判官 `isBlankCoordinate` 不在这里:它住在零依赖的叶模块 `./execution-lanes`,包根与 `./execution-lanes` 子路径是同一只。)
|
|
6
5
|
* 索引只从表派生,不另存任何词:表改了,这里跟着变。
|
|
7
6
|
*
|
|
8
7
|
* ## 迁移指路(7.0.1;11.0.0 起指路句住 `retired-form.ts`;16.0.0 起指路点名**哪一条**迁移)
|
|
9
|
-
* 拒因要不要带迁移指路只有一条规则:**这个键「旧形 ⇒
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* (`test/migration-signpost-11.0.0.test.ts` 用真跑迁移的读数逐个保留名对拍)。
|
|
13
|
-
* 哪一条:车道表登记 7.0.0 之后才进表的车道键({@link LATE_LANE_ENV_KEYS})在 7.0.0 起的存量行里可以**合法地**写在 `env` / `secretEnv` 逃生口里
|
|
14
|
-
* (那时它还不是保留名),它的旧形归登记它那一版的迁移;其余键的旧形只可能出自 6.x 行,归 SS-M4。
|
|
8
|
+
* 拒因要不要带迁移指路只有一条规则:**这个键「旧形 ⇒ 一条还在的迁移能搬」就带,别的保留名不带**;带的话点名搬它的那一条。
|
|
9
|
+
* 「能搬」= {@link LATE_LANE_ENV_KEYS} 这一张表(写闸与迁移读同一张,不是第二张手抄的表)。26.0.0 起 6.x 行的车道 / 店键不再有迁移搬(SS-M4 到期删),
|
|
10
|
+
* 它们的保留名拒句只点名唯一写位。
|
|
15
11
|
*/
|
|
16
12
|
import { EXECUTION_LANES } from "./execution-lanes.js";
|
|
17
13
|
/** 一条车道的表行。词表与表行由 `execution-lanes.ts` 的 `satisfies Record<ExecutionLane, …>` 一一对应 ——
|
|
@@ -31,18 +27,9 @@ export const LANE_ENV_OWNER = new Map(EXECUTION_LANES.flatMap((r) => {
|
|
|
31
27
|
export function laneEnvSeat(name, owner) {
|
|
32
28
|
return `runtime.execution.${owner.secret ? "secretRefs" : "coords"}.${name}`;
|
|
33
29
|
}
|
|
34
|
-
/** 车道块的两个特殊键(不在车道表里,但归车道块:迁移把 `REMOTE_EXEC` 搬成 `runtime.execution.lanes`、`REQUIRE_EXECUTION_LANE` 丢弃)。 */
|
|
35
|
-
export const LANE_WORD_KEYS = ["REMOTE_EXEC", "REQUIRE_EXECUTION_LANE"];
|
|
36
|
-
/** 渲染器以前不渲、运维只能写在 env 逃生口里的店键(7.0.0 起归 `runtime.store`;迁移搬进 `store`)。 */
|
|
37
|
-
export const STORE_ENV_KEYS = ["DB_BACKEND", "MEMORY_ENGINE", "MEMORY_ENGINE_BACKEND"];
|
|
38
|
-
/** 一个名字是不是车道块的键:车道词两键,或车道表里的任一车道 env 名。 */
|
|
39
|
-
export function isLaneEnvKey(name) {
|
|
40
|
-
return LANE_WORD_KEYS.some((k) => k === name) || LANE_ENV_OWNER.has(name);
|
|
41
|
-
}
|
|
42
|
-
const SIX_X_ENV = Object.freeze({ migration: "SS-M4", before: "7.0.0" });
|
|
43
30
|
/** 7.0.0 之后才登记进车道表、而登记之前引擎就已在读的车道 env 名 → 改写它的迁移(只增不减;每有一个,在这里写一行)。16.0.0:`DEVICE_RELAY_URL`(device 行的必需坐标;
|
|
44
31
|
* 此前 device 臂就读它而表漏登记,7.0.0–15.x 的写闸把它当普通 env 收下)→ SS-M12。登记之前没有任何已发引擎读过的新键(17.1.0 `DEVICE_TRUSTED_PROXY_CIDRS`)没有存量旧形可搬,不进本表。 */
|
|
45
|
-
export const LATE_LANE_ENV_KEYS = lateLaneEnvKeys([["DEVICE_RELAY_URL", Object.freeze({ migration: "SS-M12", before: "16.0.0" })]]);
|
|
32
|
+
export const LATE_LANE_ENV_KEYS = lateLaneEnvKeys([["DEVICE_RELAY_URL", Object.freeze({ migration: "SS-M12", before: "16.0.0", onRow: "a row that declares runtime.execution" })]]);
|
|
46
33
|
/** 建 {@link LATE_LANE_ENV_KEYS}:每一行的名字必须在车道表里(载入时验,名字拼错 ⇒ 包载入即抛,不静默成一条永不命中的行)。 */
|
|
47
34
|
function lateLaneEnvKeys(rows) {
|
|
48
35
|
for (const [name] of rows) {
|
|
@@ -51,11 +38,3 @@ function lateLaneEnvKeys(rows) {
|
|
|
51
38
|
}
|
|
52
39
|
return new Map(rows);
|
|
53
40
|
}
|
|
54
|
-
/** 一个 env 名在逃生口里 ⇒ 哪一条迁移搬它(见文件头「迁移指路」):晚登记的车道键 ⇒ 登记它那一版的迁移;别的车道块键与店键 ⇒ SS-M4;其余 ⇒ `undefined`(没有迁移搬它)。
|
|
55
|
-
* 写闸拒因带不带指路、指哪一条只看它。 */
|
|
56
|
-
export function envKeyMigration(name) {
|
|
57
|
-
const late = LATE_LANE_ENV_KEYS.get(name);
|
|
58
|
-
if (late !== undefined)
|
|
59
|
-
return late;
|
|
60
|
-
return isLaneEnvKey(name) || STORE_ENV_KEYS.some((k) => k === name) ? SIX_X_ENV : undefined;
|
|
61
|
-
}
|
package/dist/file-store.js
CHANGED
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
* - Non-portable domains are OMITTED on a single machine and resolve to their schema defaults (`{workers:[]}`
|
|
21
21
|
* etc.) — no stubbing needed. 逐域为什么被排除见 {@link NON_PORTABLE_DOMAIN_REASONS}(禁裸排除)。
|
|
22
22
|
* - A RETIRED domain's file (`config.d/runtime.json`, see `RETIRED_DOMAINS`) is read only for its tombstone: carrying facts ⇒
|
|
23
|
-
* every read entry (`getDomain`, `getEffective` — and so `exportBundle`) throws `RetiredDomainError` (`refuseRetiredDomainFiles`, shared with `readBundle`) (the sentence names the
|
|
24
|
-
* <config.d directory>` rewrites the directory); `{}` carries nothing and is left alone. It is never an "unread file".
|
|
23
|
+
* every read entry (`getDomain`, `getEffective` — and so `exportBundle`) throws `RetiredDomainError` (`refuseRetiredDomainFiles`, shared with `readBundle`) (the sentence names where the facts live today — `governance` and `limits`); `{}` carries nothing and is left alone. It is never an "unread file".
|
|
25
24
|
* - The JSON files only ever carry env-NAMEs (the ENV_NAME boundary holds locally too); `.env` holds values.
|
|
26
25
|
* - `getVersion()` = a stable content hash of all portable files → a u53 number, so a consumer's
|
|
27
26
|
* "skip re-apply if version unchanged" works locally. `getEffective().updatedAt` = the max file mtime,
|
|
@@ -255,7 +254,7 @@ function tombstoneOf(domain, raw) {
|
|
|
255
254
|
}
|
|
256
255
|
catch (e) {
|
|
257
256
|
if (e instanceof RetiredDomainError)
|
|
258
|
-
return { document: e.domain, reason: "retired_domain", error: e.message
|
|
257
|
+
return { document: e.domain, reason: "retired_domain", error: e.message };
|
|
259
258
|
throw e;
|
|
260
259
|
}
|
|
261
260
|
}
|
package/dist/fleet.d.ts
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
*
|
|
12
12
|
* 🔴 Contract discipline (same rules as scheduler-store):
|
|
13
13
|
* - ABSTRACT: types + zod wire shapes + PURE decision functions. ZERO IO, ZERO node:* — browser-safe barrel.
|
|
14
|
-
* - FINAL-STATE: shapes codify what is SHIPPED on the wire (
|
|
15
|
-
*
|
|
14
|
+
* - FINAL-STATE: shapes codify what is SHIPPED on the wire (/health `version` + the engine signal, billable submit
|
|
15
|
+
* 503+Retry-After) — no transitional aliases, breaking changes over shims
|
|
16
16
|
* (产品拍板: no temporary compatibility design; the target is long-term stability).
|
|
17
17
|
* - EXTENSIBLE: enums + optional fields externalize decisions (add an LB strategy = add an enum value,
|
|
18
18
|
* the skeleton does not move).
|
|
@@ -273,15 +273,13 @@ export type EngineDraining = z.infer<typeof EngineDraining>;
|
|
|
273
273
|
* {@link judgeRoutability}) read nothing else.
|
|
274
274
|
*
|
|
275
275
|
* One fact, one place on a body: the engine's STATE is this object; the row's IDENTITY (`instanceId`, `worker`, `address`,
|
|
276
|
-
* `version`, `heartbeatMs`) is the body's top level and is not repeated here.
|
|
277
|
-
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
276
|
+
* `version`, `heartbeatMs`) is the body's top level and is not repeated here. Neither body types a key of this object's names at
|
|
277
|
+
* its top level (26.0.0 removed the pre-11 flat dialect — `ready`, the boolean `draining` + `drainingSince`, `restart`,
|
|
278
|
+
* `generation`, `leaseState`, `leaseUntil`): a body that still carries them is read as without them — the heartbeat shape strips
|
|
279
|
+
* them, `/health` passes them through untyped — and no judge reads them.
|
|
280
280
|
*
|
|
281
|
-
* Nested under one key, not flat on the body: the
|
|
282
|
-
*
|
|
283
|
-
* both, and a flat object `draining` would make every reader still on the boolean refuse a draining engine's heartbeat. Nested, an
|
|
284
|
-
* older reader never sees it (the heartbeat shape strips unknown keys; `/health` is an open record) and a newer one reads only it.
|
|
281
|
+
* Nested under one key, not flat on the body: the state is one object the engine mints once, so it travels whole and a reader
|
|
282
|
+
* takes all of it or none of it (see "Reading" below) — never a mix of a body's top-level keys and the signal.
|
|
285
283
|
*
|
|
286
284
|
* - `ready` — always said (never "absent while ready"): the engine can take new work right now.
|
|
287
285
|
* - `draining` — present ⇔ draining ({@link EngineDraining}).
|
|
@@ -339,13 +337,10 @@ export declare function readEngineSignal(body: unknown): EngineSignal | undefine
|
|
|
339
337
|
/** The `/health` self-description every orchestrator reads. Liveness and readiness are deliberately SPLIT: `status` stays ok while
|
|
340
338
|
* draining (the process is alive); readiness is {@link judgeReadiness} over the engine signal the body carries under
|
|
341
339
|
* {@link ENGINE_SIGNAL_KEY}. Unknown fields pass through — health is a self-description, not a closed record: `modelRefusals`
|
|
342
|
-
* rides it untyped and is read with {@link readModelRefusals};
|
|
343
|
-
* `restart`, `generation`, `leaseState`, `leaseUntil`) ride it untyped too and are read by nothing. */
|
|
340
|
+
* rides it untyped and is read with {@link readModelRefusals}; any other key rides it untyped too and is read by nothing. */
|
|
344
341
|
export declare const InstanceHealth: z.ZodObject<{
|
|
345
342
|
instanceId: z.ZodString;
|
|
346
343
|
version: z.ZodString;
|
|
347
|
-
draining: z.ZodOptional<z.ZodBoolean>;
|
|
348
|
-
drainingSince: z.ZodOptional<z.ZodNumber>;
|
|
349
344
|
engineSignal: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
350
345
|
ready: z.ZodBoolean;
|
|
351
346
|
draining: z.ZodOptional<z.ZodObject<{
|
|
@@ -413,27 +408,11 @@ export declare const InstanceAnnouncement: z.ZodObject<{
|
|
|
413
408
|
worker: z.ZodString;
|
|
414
409
|
address: z.ZodString;
|
|
415
410
|
version: z.ZodString;
|
|
416
|
-
ready: z.ZodBoolean;
|
|
417
|
-
draining: z.ZodDefault<z.ZodBoolean>;
|
|
418
411
|
heartbeatMs: z.ZodDefault<z.ZodNumber>;
|
|
419
|
-
restart: z.ZodOptional<z.ZodObject<{
|
|
420
|
-
reasons: z.ZodArray<z.ZodString>;
|
|
421
|
-
version: z.ZodNumber;
|
|
422
|
-
since: z.ZodNumber;
|
|
423
|
-
withheld: z.ZodOptional<z.ZodBoolean>;
|
|
424
|
-
}, z.core.$strip>>;
|
|
425
412
|
modelRefusals: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
426
413
|
entries: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
427
414
|
plane: z.ZodOptional<z.ZodString>;
|
|
428
415
|
}, z.core.$strip>>>;
|
|
429
|
-
generation: z.ZodCatch<z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>>;
|
|
430
|
-
leaseState: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
|
|
431
|
-
none: "none";
|
|
432
|
-
granted: "granted";
|
|
433
|
-
expired: "expired";
|
|
434
|
-
denied: "denied";
|
|
435
|
-
}>>>;
|
|
436
|
-
leaseUntil: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
|
|
437
416
|
engineSignal: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
438
417
|
ready: z.ZodBoolean;
|
|
439
418
|
draining: z.ZodOptional<z.ZodObject<{
|
|
@@ -478,27 +457,11 @@ export declare const InstanceRegistration: z.ZodObject<{
|
|
|
478
457
|
worker: z.ZodString;
|
|
479
458
|
address: z.ZodString;
|
|
480
459
|
version: z.ZodString;
|
|
481
|
-
ready: z.ZodBoolean;
|
|
482
|
-
draining: z.ZodDefault<z.ZodBoolean>;
|
|
483
460
|
heartbeatMs: z.ZodDefault<z.ZodNumber>;
|
|
484
|
-
restart: z.ZodOptional<z.ZodObject<{
|
|
485
|
-
reasons: z.ZodArray<z.ZodString>;
|
|
486
|
-
version: z.ZodNumber;
|
|
487
|
-
since: z.ZodNumber;
|
|
488
|
-
withheld: z.ZodOptional<z.ZodBoolean>;
|
|
489
|
-
}, z.core.$strip>>;
|
|
490
461
|
modelRefusals: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
491
462
|
entries: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
492
463
|
plane: z.ZodOptional<z.ZodString>;
|
|
493
464
|
}, z.core.$strip>>>;
|
|
494
|
-
generation: z.ZodCatch<z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>>;
|
|
495
|
-
leaseState: z.ZodCatch<z.ZodOptional<z.ZodEnum<{
|
|
496
|
-
none: "none";
|
|
497
|
-
granted: "granted";
|
|
498
|
-
expired: "expired";
|
|
499
|
-
denied: "denied";
|
|
500
|
-
}>>>;
|
|
501
|
-
leaseUntil: z.ZodCatch<z.ZodOptional<z.ZodNumber>>;
|
|
502
465
|
engineSignal: z.ZodCatch<z.ZodOptional<z.ZodObject<{
|
|
503
466
|
ready: z.ZodBoolean;
|
|
504
467
|
draining: z.ZodOptional<z.ZodObject<{
|
|
@@ -532,7 +495,7 @@ export type InstanceRegistration = z.infer<typeof InstanceRegistration>;
|
|
|
532
495
|
export declare function isInstanceStale(r: Pick<InstanceRegistration, "lastSeenMs" | "heartbeatMs">, nowMs: number): boolean;
|
|
533
496
|
/** Health fusion — the ONE judge of "may dispatch route to this stored instance": a signal is present ∧ the row is not stale ∧
|
|
534
497
|
* the observer does not veto ∧ the engine's own readiness ({@link judgeReadiness} over the row's {@link EngineSignal}). Two sources
|
|
535
|
-
* merge as an AND — EITHER source's "not ready" removes the instance (fail-closed).
|
|
498
|
+
* merge as an AND — EITHER source's "not ready" removes the instance (fail-closed). */
|
|
536
499
|
export declare function judgeRoutability(r: InstanceRegistration, nowMs: number): RoutingVerdict;
|
|
537
500
|
/** {@link judgeRoutability} as a boolean (the same judge, no second reading). */
|
|
538
501
|
export declare function isRoutable(r: InstanceRegistration, nowMs: number): boolean;
|