@sema-agent/settings-schema 25.1.0 → 26.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.
Files changed (71) hide show
  1. package/CHANGELOG.md +319 -0
  2. package/README.md +65 -33
  3. package/conformance/VERSION +1 -1
  4. package/conformance/cases/c27-hosts-array-1025/meta.json +1 -1
  5. package/conformance/cases/c48-s935-model-headers-transported/expected.json +18 -68
  6. package/conformance/cases/c48-s935-model-headers-transported/meta.json +1 -1
  7. package/conformance/cases/c67-s784-retired-field-loud/meta.json +1 -1
  8. package/conformance/cases/c77-prompts-center-artifact-carried/expected.json +5 -5
  9. package/conformance/cases/c77-prompts-center-artifact-carried/input.json +2 -2
  10. package/conformance/cases/c79-prompts-bad-worker-artifact-not-salvaged/expected.json +1 -1
  11. package/conformance/cases/c79-prompts-bad-worker-artifact-not-salvaged/input.json +3 -3
  12. package/conformance/cases/c80-prompts-wire-v2-verbatim/expected.json +1 -1
  13. package/conformance/cases/c80-prompts-wire-v2-verbatim/input.json +1 -1
  14. package/conformance/cases/c82-prompts-v1-catalog-refused/expected.json +1 -1
  15. package/conformance/cases/c82-prompts-v1-catalog-refused/input.json +1 -1
  16. package/conformance/cases/c83-prompts-bad-overlay-not-salvaged/expected.json +1 -1
  17. package/conformance/cases/c83-prompts-bad-overlay-not-salvaged/input.json +1 -1
  18. package/dist/cli.d.ts +7 -7
  19. package/dist/cli.js +11 -19
  20. package/dist/config-dir-io.js +3 -14
  21. package/dist/config-dir-migration.d.ts +1 -4
  22. package/dist/config-dir-migration.js +16 -22
  23. package/dist/config-document-refusal.d.ts +2 -3
  24. package/dist/config-fns.d.ts +3 -4
  25. package/dist/config-fns.js +4 -6
  26. package/dist/conformance/run.js +89 -29
  27. package/dist/conformance/types.d.ts +65 -39
  28. package/dist/execution-lane-index.d.ts +8 -19
  29. package/dist/execution-lane-index.js +6 -27
  30. package/dist/file-store.js +2 -3
  31. package/dist/fleet.d.ts +10 -47
  32. package/dist/fleet.js +13 -40
  33. package/dist/fs-failure.d.ts +5 -10
  34. package/dist/fs-failure.js +4 -8
  35. package/dist/hooks.d.ts +41 -6
  36. package/dist/hooks.js +68 -4
  37. package/dist/migration-receipt.d.ts +12 -14
  38. package/dist/migration-receipt.js +5 -7
  39. package/dist/node.js +1 -1
  40. package/dist/one-time-migrations.d.ts +9 -24
  41. package/dist/one-time-migrations.js +30 -796
  42. package/dist/remote-exec.js +2 -3
  43. package/dist/retired-envs.js +2 -0
  44. package/dist/retired-form.d.ts +12 -11
  45. package/dist/retired-form.js +12 -8
  46. package/dist/sandbox-git.d.ts +1 -1
  47. package/dist/sandbox-git.js +3 -3
  48. package/dist/scheduler-lifetime.d.ts +1 -1
  49. package/dist/scheduler-lifetime.js +1 -1
  50. package/dist/scheduler-store.d.ts +4 -29
  51. package/dist/scheduler-store.js +21 -14
  52. package/dist/types.d.ts +13 -19
  53. package/dist/types.js +75 -110
  54. package/dist/web-admin-credential.d.ts +2 -2
  55. package/dist/web-admin-credential.js +4 -4
  56. package/dist/worker-row-verdict.d.ts +1 -1
  57. package/dist/worker-row-verdict.js +1 -1
  58. package/dist/workers-rows.d.ts +2 -2
  59. package/dist/workers-rows.js +2 -2
  60. package/dist/zod-unwrap.d.ts +1 -1
  61. package/dist/zod-unwrap.js +1 -1
  62. package/docs/API-SURFACE.md +11 -12
  63. package/docs/CONFORMANCE.md +25 -13
  64. package/docs/CONSUMER-INTEGRATION.md +54 -27
  65. package/llms-full.txt +24 -22
  66. package/llms.txt +20 -14
  67. package/package.json +1 -1
  68. package/dist/runtime-lift-targets.d.ts +0 -7
  69. package/dist/runtime-lift-targets.js +0 -7
  70. package/dist/scheduler-store-migration.d.ts +0 -14
  71. package/dist/scheduler-store-migration.js +0 -14
@@ -99,8 +99,7 @@ export const RemoteExecSpec = z.discriminatedUnion("provider", [
99
99
  provider: z.literal("k8s"),
100
100
  /** Sandbox container image (service: K8S_SANDBOX_IMAGE). Required so a run is reproducible. */
101
101
  image: execStr,
102
- /** Kube API URL (service: K8S_API_URL); absent → in-cluster service account. NO embedded credentials. A stored fragment is rewritten
103
- * by the one-time migration SS-M7 (this file is one of its documents), so the refusal names it. */
102
+ /** Kube API URL (service: K8S_API_URL); absent → in-cluster service account. NO embedded credentials, no fragment. */
104
103
  apiUrl: NON_SECRET_URL.optional(),
105
104
  /** env-NAME holding the kube bearer token (service: K8S_TOKEN). NEVER the token. */
106
105
  tokenEnv: ENV_NAME.optional(),
@@ -121,7 +120,7 @@ export const RemoteExecSpec = z.discriminatedUnion("provider", [
121
120
  * "all three of endpoint/access/secret required" gate). */
122
121
  s3Snapshot: z
123
122
  .object({
124
- endpoint: NON_SECRET_URL, // S3/MinIO endpoint — creds go in accessKeyEnv/secretKeyEnv, never the URL (a stored fragment: SS-M7, like apiUrl)
123
+ endpoint: NON_SECRET_URL, // S3/MinIO endpoint — creds go in accessKeyEnv/secretKeyEnv, never the URL (no fragment either, like apiUrl)
125
124
  bucket: execStr.optional(),
126
125
  accessKeyEnv: ENV_NAME,
127
126
  secretKeyEnv: ENV_NAME,
@@ -79,6 +79,8 @@ export const RETIRED_ENVS = [
79
79
  ["REQUIRE_EXECUTION_LANE", "REMOTE_EXEC", "replaced", "every deployment names its execution lane; REMOTE_EXEC=none declares one with no execution environment"],
80
80
  // 沙箱车道的 LSP 桥整只删除:e2b / k8s 车道本来就不挂 LSP,这个旋钮没有可 rename 的目标。host 车道的开关是另一个键 LSP_HOST_ENABLED(缺省开,活旋钮,不在本表)。
81
81
  ["LSP_ENABLED", "the sandbox-lane LSP bridge was removed (e2b / k8s lanes mount no LSP); unset it — the host lane's switch is LSP_HOST_ENABLED", "removed"],
82
+ // 呈卡协议的回退开关:审批卡只有一种帧族之后,它「关」那一档(回退发旧族卡)不存在了 —— 没有可关的东西,也没有可 rename 的目标。任何显式值都拒。
83
+ ["STREAM_APPROVAL_ENABLED", "the approval-card fallback switch was retired: approval cards have a single frame family, so its off position (falling back to the legacy card frames) no longer exists and there is nothing left to switch", "removed"],
82
84
  ];
83
85
  // 冻结:拿到导出的人改不了拒启判据(读拒句的与投影 wire 的是同一个数组对象)。
84
86
  for (const row of RETIRED_ENVS)
@@ -1,17 +1,18 @@
1
1
  /**
2
2
  * retired 形的**拒句**与**墓碑**(11.0.0)—— 包内私有(不进主桶)。
3
3
  *
4
- * 一条律:**旧形只有一种去处 —— 登记过窗的一次性迁移改写它(`./one-time-migrations`);读写两面遇旧形都响亮拒,拒句点名迁移 id。**
4
+ * 一条律:**旧形只有一种去处 —— 登记过窗的一次性迁移改写它(`./one-time-migrations`);读写两面遇旧形都响亮拒,拒句点名迁移 id(迁移还在时)或止于今天的位(窗关删码后)。**
5
5
  * 拒句只在这里拼(一个模板),三处用它:retired 域(`RETIRED_DOMAINS`,读者 throw `RetiredDomainError`)、retired 键(域 schema 里的
6
6
  * {@link retiredKey} 墓碑字段,zod issue)、保留名闸里「迁移搬得走」的 env 键({@link migrationSignpost})。
7
7
  *
8
- * 墓碑是**拒**,不是第二种读法:它不把旧形读成任何值,只说「这里有一份没迁的旧形」以及去哪儿迁。迁移族按登记表的窗整族删,
9
- * 墓碑留下 —— 到那时拒句里的迁移 id 由删码那一车改写(登记表那一行的 `removal` 点名了这件事)。
8
+ * 墓碑是**拒**,不是第二种读法:它不把旧形读成任何值,只说「这里有一份旧形」、事实今天住哪,以及(迁移还在时)去哪儿迁。迁移按登记表的窗删,
9
+ * 墓碑留下 —— 删码那一车删掉墓碑的 `migration` 格({@link RetiredForm}),拒句随之止于 `now` 分句:出路是把事实手写到今天的位上。
10
10
  *
11
11
  * **墓碑表**:每个 {@link retiredKey} 铸出的墓碑在铸造时登记一行({@link RetiredKeyRow}:键名、形、整句)。表的读者两个 —— 读面的终判
12
12
  * ({@link retiredKeyOfSentence}:一条 zod issue 的 message 恰是某个墓碑的整句 ⇒ 这是一条墓碑 issue)与测试({@link retiredKeyTable}:从表读名单,不手抄)。
13
13
  */
14
14
  import { z } from "zod";
15
+ import type { OneTimeMigrationId } from "./migration-receipt.js";
15
16
  /** 迁移命令行的唯一拼写:`npx` 全名形 —— 没装本包的运维粘贴即可跑(裸 bin 名在没装本包的机器上是 `command not found`)。参数是一个 `config.d` 目录。
16
17
  * 印出命令的地方只有下面两只:带目录占位的模板 {@link MIGRATE_COMMAND_TEMPLATE}(USAGE、迁移指路句)与带真路径的 {@link migrateCommandFor}(指路到某个具体目录)。 */
17
18
  export declare const MIGRATE_COMMAND: "npx @sema-agent/settings-schema migrate";
@@ -21,15 +22,15 @@ export declare const MIGRATE_COMMAND_TEMPLATE: "npx @sema-agent/settings-schema
21
22
  export declare function migrateCommandFor(configDir: string): string;
22
23
  /** 拒句尾的迁移指路:存量由哪一条一次性迁移改写、两种跑法(子路径的函数 / 目录命令;目录是 `config.d` 目录本身,不是它的上一层)。`before` = 旧形不再合法的那一版。
23
24
  * 刻意短:它挂在 zod issue 句尾,读侧逐条容错时每一条被丢的条目都要过一遍出门脱敏。 */
24
- export declare function migrationSignpost(migration: string, before: string): string;
25
- /** 一个retired 形的整句:`<form> was retired in <版本> — now <今天住哪>; <指路>`。 */
25
+ export declare function migrationSignpost(migration: OneTimeMigrationId, before: string): string;
26
+ /** 一个retired 形的整句:`<form> was retired in <版本> — now <今天住哪>`,迁移还在时再接 `; <指路>`。 */
26
27
  export interface RetiredForm {
27
28
  /** retired的版本。 */
28
29
  readonly retiredIn: string;
29
- /** 事实今天住哪(一句,点名新位)。 */
30
+ /** 事实今天住哪(一句,点名新位)—— 迁移删了之后它就是出路。 */
30
31
  readonly now: string;
31
- /** 改写存量的一次性迁移 id(`./one-time-migrations` 的闭集;到期门核它在登记表里)。 */
32
- readonly migration: string;
32
+ /** 改写存量的一次性迁移 id(`./one-time-migrations` 的闭集;到期门核它在登记表里)。**只在那条迁移还在时写**:迁移到期删了,删码那一车删掉这一格。 */
33
+ readonly migration?: OneTimeMigrationId;
33
34
  }
34
35
  export declare function retiredFormSentence(form: string, t: RetiredForm): string;
35
36
  /** 墓碑表的一行:`key` 是墓碑字段在它所在对象里的点路径(例:`runtime.sessionBackend`),`sentence` 是它的拒句整句(= 那条 zod issue 的 message)。 */
@@ -39,7 +40,7 @@ export interface RetiredKeyRow {
39
40
  readonly sentence: string;
40
41
  }
41
42
  /**
42
- * retired**键**的墓碑字段:放在该键原来所在的对象形里,键缺席 = 合法,键在场(任何值)= 一条 issue(路径就是那个键、句子点名迁移)。
43
+ * retired**键**的墓碑字段:放在该键原来所在的对象形里,键缺席 = 合法,键在场(任何值)= 一条 issue(路径就是那个键、句子点名今天的位,迁移还在时再点名它)。
43
44
  * 输出形里它恒缺席(型上是 `?: undefined`),JSON Schema 上是 `not: {}`(「不许出现」)—— 墓碑写在旧键原来的位置上,schema 自己说明它retired了。
44
45
  */
45
46
  export declare function retiredKey(key: string, t: RetiredForm): z.ZodOptional<z.ZodNever>;
@@ -49,7 +50,7 @@ export declare function retiredKeyTable(): readonly RetiredKeyRow[];
49
50
  export declare function retiredKeyOfSentence(message: string): RetiredKeyRow | undefined;
50
51
  /**
51
52
  * 墓碑在**读面**(终判扣下一行时的拒句)的说法:不点名那个旧字段的名字 —— 它就在盘上那一行里,结构化的坐标(`field`)已经指到它;
52
- * 文字说现行位、迁移是一条出路,以及「迁移拒过这一行」的出路。读面是纯函数、无 I/O,不知道这一行跑没跑过迁移,所以两种情形都要成立:
53
- * 没跑过 ⇒ 跑迁移;跑过且拒了(迁移不写回半成品,原行留在盘上)⇒ 手写现行形、删掉旧字段。
53
+ * 文字说现行位与出路。迁移还在时,出路有两条:读面是纯函数、无 I/O,不知道这一行跑没跑过迁移,所以两种情形都要成立 ——
54
+ * 没跑过 ⇒ 跑迁移;跑过且拒了(迁移不写回半成品,原行留在盘上)⇒ 手写现行形、删掉旧字段。迁移删了之后只剩后一条。
54
55
  */
55
56
  export declare function retiredKeyHeldSentence(t: RetiredForm): string;
@@ -1,12 +1,12 @@
1
1
  /**
2
2
  * retired 形的**拒句**与**墓碑**(11.0.0)—— 包内私有(不进主桶)。
3
3
  *
4
- * 一条律:**旧形只有一种去处 —— 登记过窗的一次性迁移改写它(`./one-time-migrations`);读写两面遇旧形都响亮拒,拒句点名迁移 id。**
4
+ * 一条律:**旧形只有一种去处 —— 登记过窗的一次性迁移改写它(`./one-time-migrations`);读写两面遇旧形都响亮拒,拒句点名迁移 id(迁移还在时)或止于今天的位(窗关删码后)。**
5
5
  * 拒句只在这里拼(一个模板),三处用它:retired 域(`RETIRED_DOMAINS`,读者 throw `RetiredDomainError`)、retired 键(域 schema 里的
6
6
  * {@link retiredKey} 墓碑字段,zod issue)、保留名闸里「迁移搬得走」的 env 键({@link migrationSignpost})。
7
7
  *
8
- * 墓碑是**拒**,不是第二种读法:它不把旧形读成任何值,只说「这里有一份没迁的旧形」以及去哪儿迁。迁移族按登记表的窗整族删,
9
- * 墓碑留下 —— 到那时拒句里的迁移 id 由删码那一车改写(登记表那一行的 `removal` 点名了这件事)。
8
+ * 墓碑是**拒**,不是第二种读法:它不把旧形读成任何值,只说「这里有一份旧形」、事实今天住哪,以及(迁移还在时)去哪儿迁。迁移按登记表的窗删,
9
+ * 墓碑留下 —— 删码那一车删掉墓碑的 `migration` 格({@link RetiredForm}),拒句随之止于 `now` 分句:出路是把事实手写到今天的位上。
10
10
  *
11
11
  * **墓碑表**:每个 {@link retiredKey} 铸出的墓碑在铸造时登记一行({@link RetiredKeyRow}:键名、形、整句)。表的读者两个 —— 读面的终判
12
12
  * ({@link retiredKeyOfSentence}:一条 zod issue 的 message 恰是某个墓碑的整句 ⇒ 这是一条墓碑 issue)与测试({@link retiredKeyTable}:从表读名单,不手抄)。
@@ -28,12 +28,13 @@ export function migrationSignpost(migration, before) {
28
28
  return `data stored before ${before}: run the one-time migration ${migration} (@sema-agent/settings-schema/one-time-migrations, or ${MIGRATE_COMMAND_TEMPLATE})`;
29
29
  }
30
30
  export function retiredFormSentence(form, t) {
31
- return `${form} was retired in ${t.retiredIn} — now ${t.now}; ${migrationSignpost(t.migration, t.retiredIn)}`;
31
+ const head = `${form} was retired in ${t.retiredIn} — now ${t.now}`;
32
+ return t.migration === undefined ? head : `${head}; ${migrationSignpost(t.migration, t.retiredIn)}`;
32
33
  }
33
34
  /** 整句 → 行。同一个键在两处 schema 里以同一个形退役(整句逐字同)只占一行。 */
34
35
  const TOMBSTONES = new Map();
35
36
  /**
36
- * retired**键**的墓碑字段:放在该键原来所在的对象形里,键缺席 = 合法,键在场(任何值)= 一条 issue(路径就是那个键、句子点名迁移)。
37
+ * retired**键**的墓碑字段:放在该键原来所在的对象形里,键缺席 = 合法,键在场(任何值)= 一条 issue(路径就是那个键、句子点名今天的位,迁移还在时再点名它)。
37
38
  * 输出形里它恒缺席(型上是 `?: undefined`),JSON Schema 上是 `not: {}`(「不许出现」)—— 墓碑写在旧键原来的位置上,schema 自己说明它retired了。
38
39
  */
39
40
  export function retiredKey(key, t) {
@@ -51,9 +52,12 @@ export function retiredKeyOfSentence(message) {
51
52
  }
52
53
  /**
53
54
  * 墓碑在**读面**(终判扣下一行时的拒句)的说法:不点名那个旧字段的名字 —— 它就在盘上那一行里,结构化的坐标(`field`)已经指到它;
54
- * 文字说现行位、迁移是一条出路,以及「迁移拒过这一行」的出路。读面是纯函数、无 I/O,不知道这一行跑没跑过迁移,所以两种情形都要成立:
55
- * 没跑过 ⇒ 跑迁移;跑过且拒了(迁移不写回半成品,原行留在盘上)⇒ 手写现行形、删掉旧字段。
55
+ * 文字说现行位与出路。迁移还在时,出路有两条:读面是纯函数、无 I/O,不知道这一行跑没跑过迁移,所以两种情形都要成立 ——
56
+ * 没跑过 ⇒ 跑迁移;跑过且拒了(迁移不写回半成品,原行留在盘上)⇒ 手写现行形、删掉旧字段。迁移删了之后只剩后一条。
56
57
  */
57
58
  export function retiredKeyHeldSentence(t) {
58
- return `a field retired in ${t.retiredIn} is still in the row — now ${t.now}; ${migrationSignpost(t.migration, t.retiredIn)}; if that migration already refused this row, write the current form by hand and delete the old field`;
59
+ const head = `a field retired in ${t.retiredIn} is still in the row — now ${t.now}`;
60
+ if (t.migration === undefined)
61
+ return `${head}; write the current form by hand and delete the old field`;
62
+ return `${head}; ${migrationSignpost(t.migration, t.retiredIn)}; if that migration already refused this row, write the current form by hand and delete the old field`;
59
63
  }
@@ -40,7 +40,7 @@ export type SandboxGitOrigin = z.infer<typeof SandboxGitOrigin>;
40
40
  export declare const SandboxGitOriginList: z.ZodArray<z.ZodString>;
41
41
  export type SandboxGitOriginList = z.infer<typeof SandboxGitOriginList>;
42
42
  /**
43
- * 控制台「连接 Gitea(git)」页的绝对 URL:**https**,且是 {@link NON_SECRET_URL_NO_MIGRATION} 那一类(层级式 URL、无 userinfo、无片段、路径与查询里没有秘密形的值)。
43
+ * 控制台「连接 Gitea(git)」页的绝对 URL:**https**,且是 {@link NON_SECRET_URL} 那一类(层级式 URL、无 userinfo、无片段、路径与查询里没有秘密形的值)。
44
44
  * 它是 wire 输入,不是存量文档里的值,所以走「无迁移指路」那一只。
45
45
  */
46
46
  export declare const SandboxGitConnectUrl: z.ZodString;
@@ -24,7 +24,7 @@
24
24
  */
25
25
  import { z } from "zod";
26
26
  import { buildQuotedIssue } from "./quoted-issue.js";
27
- import { NON_SECRET_URL_NO_MIGRATION } from "./types.js";
27
+ import { NON_SECRET_URL } from "./types.js";
28
28
  import { httpUrlFlaws } from "./url-shape.js";
29
29
  /** 一次最多代理的 origin 数(请求体、应答、有效配置块同一个上界)。 */
30
30
  export const SANDBOX_GIT_MAX_ORIGINS = 16;
@@ -64,10 +64,10 @@ export const SandboxGitOriginList = z
64
64
  ctx.addIssue({ code: "custom", ...buildQuotedIssue `duplicate origin`, path: [i] });
65
65
  });
66
66
  /**
67
- * 控制台「连接 Gitea(git)」页的绝对 URL:**https**,且是 {@link NON_SECRET_URL_NO_MIGRATION} 那一类(层级式 URL、无 userinfo、无片段、路径与查询里没有秘密形的值)。
67
+ * 控制台「连接 Gitea(git)」页的绝对 URL:**https**,且是 {@link NON_SECRET_URL} 那一类(层级式 URL、无 userinfo、无片段、路径与查询里没有秘密形的值)。
68
68
  * 它是 wire 输入,不是存量文档里的值,所以走「无迁移指路」那一只。
69
69
  */
70
- export const SandboxGitConnectUrl = NON_SECRET_URL_NO_MIGRATION.refine((u) => URL.canParse(u) && new URL(u).protocol === "https:", buildQuotedIssue `must be an https URL — the connect page is opened by a person and carries their session`);
70
+ export const SandboxGitConnectUrl = NON_SECRET_URL.refine((u) => URL.canParse(u) && new URL(u).protocol === "https:", buildQuotedIssue `must be an https URL — the connect page is opened by a person and carries their session`);
71
71
  /** 有效配置块里的一个 origin 条目。 */
72
72
  export const SandboxGitOriginEntry = z.object({
73
73
  /** 本部署代理的 origin(规范形)。http 在这里可读(见模块头注)。 */
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * 包内私有(不进主桶):调度记录「是不是会话链上的记录」的**一只**读法 —— `lifetime === "session"`;其余(含缺席)一律是 durable。
3
- * 读口的过期清理(`parseSchedulerStore`)与一次性迁移 SS-M3 的 durable 键重铸读同一只,两处对同一条记录不可能给出两种答案。
3
+ * 读口的过期清理(`parseSchedulerStore`)读它;durable 记录的键是 `principal ?? "default"`(写者的事,读口不重铸 —— 26.0.0 起读时改写到期删了)。
4
4
  */
5
5
  export declare function isSessionLifetime(record: object): boolean;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * 包内私有(不进主桶):调度记录「是不是会话链上的记录」的**一只**读法 —— `lifetime === "session"`;其余(含缺席)一律是 durable。
3
- * 读口的过期清理(`parseSchedulerStore`)与一次性迁移 SS-M3 的 durable 键重铸读同一只,两处对同一条记录不可能给出两种答案。
3
+ * 读口的过期清理(`parseSchedulerStore`)读它;durable 记录的键是 `principal ?? "default"`(写者的事,读口不重铸 —— 26.0.0 起读时改写到期删了)。
4
4
  */
5
5
  export function isSessionLifetime(record) {
6
6
  return record.lifetime === "session";
@@ -1,23 +1,3 @@
1
- /**
2
- * @sema-agent/settings-schema/scheduler-store — the PURE, dep-free CONTRACT for the self-wake scheduler store
3
- * (R7 自唤醒). The shared seam between the WRITER (server-side `SchedulerCapability`, persists the model's
4
- * CronCreate/Sleep intents) and the READER (TOC shell `SchedulerDaemon`, fires due intents). One canonical
5
- * on-disk SHAPE + parse/serialize ⇒ the two independently-built sides never drift on the format.
6
- *
7
- * 🔴 Contract discipline (this is a third-party contract lib, not an impl dump):
8
- * - ABSTRACT: this module is the type + the parse/serialize FORMAT + the `SchedulerStore` interface. It has
9
- * ZERO runtime IO and ZERO deps (no `@sema-agent/*`, no `node:*`) so it lives in the browser-safe barrel.
10
- * The concrete filesystem binding is `@sema-agent/settings-schema/node` (`loadSchedulerStore`/`saveSchedulerStore`).
11
- * - EXTENSIBLE: `parseSchedulerStore` is FORWARD-COMPATIBLE — it validates only the required shape and
12
- * PRESERVES unknown fields, so a newer writer can add fields without an older reader dropping them on
13
- * round-trip. New optional `SchedulerRecord` fields are additive (no breaking change).
14
- * - CONTRACTUAL: `when` is an inlined structural union kept byte-compatible with core `ScheduledIntent['when']`
15
- * but NOT imported — the contract stands alone, independent of the engine.
16
- *
17
- * 🔴 `principal` is pinned by the writer from Runner-held ctx (never the model); persisted opaquely, passed
18
- * through to `runTask` unchanged by the daemon (no privilege escalation).
19
- */
20
- import type { MigrationReceipt } from './migration-receipt.js';
21
1
  /** A scheduled `when` — structurally identical to core `ScheduledIntent['when']`, inlined (contract stands alone). */
22
2
  export type SchedulerWhen = {
23
3
  kind: 'cron';
@@ -65,10 +45,10 @@ export declare const STALE_SESSION_RECORD_MS: number;
65
45
  * - `malformed-record` — 这一条没过 {@link isSchedulerRecord},丢弃;`record` = 原值(未校验,诊断用)。
66
46
  * - `stale-session-record` — 会话链上的记录(`lifetime: "session"` ∧ `sessionId` 在场)而 `nextRunMs` 已过去 ≥ {@link STALE_SESSION_RECORD_MS}:
67
47
  * 它的会话没走到收割(无常驻 daemon 的车道 / 崩溃),再留着就是永驻。丢弃,不另起写 —— 下一个写者落盘。
68
- * **只认显式的 `"session"`**:`lifetime` 缺席读作 durable(与 SS-M3 同一只读法);durable 记录带着来源 sessionId
48
+ * **只认显式的 `"session"`**:`lifetime` 缺席读作 durable;durable 记录带着来源 sessionId
69
49
  * 是合法形,daemon 停机一周后的 cron 照样是用户的任务,不许当孤儿丢。
70
- * - `one-time-migration` — 登记过窗的一次性迁移在读时改写了这一条(今天只有 SS-M3:durable 行按旧会话键存 ⇒ 重铸成
71
- * `principal ?? "default"`);`receipt` 是迁移的收据(`./one-time-migrations` 的同一形)。 */
50
+ * (26.0.0 起没有「读时改写」这一臂:durable 键重铸的一次性迁移到期删了 —— 按旧会话键存的 durable 记录逐字读出,不重铸、不告警。
51
+ * 它与今天的引擎在不担保会话期回收的后端上写下的会话唤醒记录同形〔无 `lifetime`、键是会话链〕,读口分不出两者,所以不拒、不丢。) */
72
52
  export type SchedulerParseWarning = {
73
53
  kind: 'unreadable-file';
74
54
  why: 'not-json' | 'not-an-array';
@@ -82,10 +62,6 @@ export type SchedulerParseWarning = {
82
62
  id: string;
83
63
  sessionId: string;
84
64
  nextRunMs: number;
85
- } | {
86
- kind: 'one-time-migration';
87
- index: number;
88
- receipt: MigrationReceipt;
89
65
  };
90
66
  /** 一次读的结果:留下的记录 + 读时做过的每一件事。没有「静默模式」—— 告警恒随结果返回,调用方决定记到哪。 */
91
67
  export interface SchedulerStoreRead {
@@ -102,8 +78,7 @@ export interface SchedulerReadOptions {
102
78
  * read comes back in `warnings` ({@link SchedulerParseWarning}) — 11.0.0 removed the silent mode (the warning callback
103
79
  * used to be optional, and the default read paths never passed it, so corrupt records vanished without a trace).
104
80
  *
105
- * 读时改写只有一种:登记在一次性迁移表里、窗内存活的 SS-M3(`migrateSchedulerRecords`,lazy-on-read —— 不另起写,由下一个写者
106
- * 落盘;另起一次写只会多一个竞争写者)。窗关后随迁移族一起删。
81
+ * 读时不改写任何一条记录(26.0.0 起;此前的 durable 键重铸是一次性迁移,窗关删了):留下的记录逐字等于读到的那一条。
107
82
  */
108
83
  export declare function parseSchedulerStore(text: string, opts: SchedulerReadOptions): SchedulerStoreRead;
109
84
  /** Serialize the store to its canonical on-disk form (stable, pretty JSON). The WRITE half of the format contract. */
@@ -1,7 +1,25 @@
1
+ /**
2
+ * @sema-agent/settings-schema/scheduler-store — the PURE, dep-free CONTRACT for the self-wake scheduler store
3
+ * (R7 自唤醒). The shared seam between the WRITER (server-side `SchedulerCapability`, persists the model's
4
+ * CronCreate/Sleep intents) and the READER (TOC shell `SchedulerDaemon`, fires due intents). One canonical
5
+ * on-disk SHAPE + parse/serialize ⇒ the two independently-built sides never drift on the format.
6
+ *
7
+ * 🔴 Contract discipline (this is a third-party contract lib, not an impl dump):
8
+ * - ABSTRACT: this module is the type + the parse/serialize FORMAT + the `SchedulerStore` interface. It has
9
+ * ZERO runtime IO and ZERO deps (no `@sema-agent/*`, no `node:*`) so it lives in the browser-safe barrel.
10
+ * The concrete filesystem binding is `@sema-agent/settings-schema/node` (`loadSchedulerStore`/`saveSchedulerStore`).
11
+ * - EXTENSIBLE: `parseSchedulerStore` is FORWARD-COMPATIBLE — it validates only the required shape and
12
+ * PRESERVES unknown fields, so a newer writer can add fields without an older reader dropping them on
13
+ * round-trip. New optional `SchedulerRecord` fields are additive (no breaking change).
14
+ * - CONTRACTUAL: `when` is an inlined structural union kept byte-compatible with core `ScheduledIntent['when']`
15
+ * but NOT imported — the contract stands alone, independent of the engine.
16
+ *
17
+ * 🔴 `principal` is pinned by the writer from Runner-held ctx (never the model); persisted opaquely, passed
18
+ * through to `runTask` unchanged by the daemon (no privilege escalation).
19
+ */
1
20
  import { ownDeclaredValueOf } from './own-key-read.js';
2
21
  import { isJsonArray, isPlainJsonObject } from './plain-json-object.js';
3
22
  import { isSessionLifetime } from './scheduler-lifetime.js';
4
- import { migrateSchedulerRecords } from './scheduler-store-migration.js';
5
23
  /** Structural validation of one record (required fields + a well-formed `when`). Unknown fields are allowed. */
6
24
  export function isSchedulerRecord(v) {
7
25
  if (!isPlainJsonObject(v))
@@ -35,8 +53,7 @@ export const STALE_SESSION_RECORD_MS = 7 * 24 * 60 * 60 * 1000;
35
53
  * read comes back in `warnings` ({@link SchedulerParseWarning}) — 11.0.0 removed the silent mode (the warning callback
36
54
  * used to be optional, and the default read paths never passed it, so corrupt records vanished without a trace).
37
55
  *
38
- * 读时改写只有一种:登记在一次性迁移表里、窗内存活的 SS-M3(`migrateSchedulerRecords`,lazy-on-read —— 不另起写,由下一个写者
39
- * 落盘;另起一次写只会多一个竞争写者)。窗关后随迁移族一起删。
56
+ * 读时不改写任何一条记录(26.0.0 起;此前的 durable 键重铸是一次性迁移,窗关删了):留下的记录逐字等于读到的那一条。
40
57
  */
41
58
  export function parseSchedulerStore(text, opts) {
42
59
  let parsed;
@@ -50,7 +67,6 @@ export function parseSchedulerStore(text, opts) {
50
67
  return { records: [], warnings: [{ kind: 'unreadable-file', why: 'not-an-array' }] };
51
68
  const warnings = [];
52
69
  const kept = [];
53
- const keptFrom = [];
54
70
  parsed.forEach((record, index) => {
55
71
  if (!isSchedulerRecord(record)) {
56
72
  warnings.push({ kind: 'malformed-record', index, record });
@@ -61,17 +77,8 @@ export function parseSchedulerStore(text, opts) {
61
77
  return;
62
78
  }
63
79
  kept.push(record);
64
- keptFrom.push(index);
65
80
  });
66
- const migrated = migrateSchedulerRecords(kept);
67
- for (const receipt of migrated.receipts) {
68
- // 收据的坐标是迁移入参(`kept`)里的下标;换回原数组下标(对照源文件),与其余告警同一套坐标。
69
- const at = receipt.path[0];
70
- const index = typeof at === 'number' ? (keptFrom[at] ?? at) : -1;
71
- warnings.push({ kind: 'one-time-migration', index, receipt: { ...receipt, path: [index, ...receipt.path.slice(1)] } });
72
- }
73
- warnings.sort((a, b) => ('index' in a ? a.index : -1) - ('index' in b ? b.index : -1));
74
- return { records: migrated.records, warnings };
81
+ return { records: kept, warnings };
75
82
  }
76
83
  /** Serialize the store to its canonical on-disk form (stable, pretty JSON). The WRITE half of the format contract. */
77
84
  export function serializeSchedulerStore(records) {
package/dist/types.d.ts CHANGED
@@ -54,23 +54,18 @@ export declare function urlQueryFragmentHasSecret(u: URL): boolean;
54
54
  /** A URL handed to `fetch` that carries no credential: judged by THE URL shape judge ({@link httpUrlFlaws}, `./url-shape`) — a
55
55
  * hierarchical http(s) URL with neither userinfo nor a fragment (an empty `#` included, 11.0.0) — and with no secret-shaped value
56
56
  * in its path or query ({@link urlQueryFragmentHasSecret}). One issue per flaw, its message the judge's rule sentence (no value
57
- * echoed; a fragment's also names its migration, {@link nonSecretUrlIssue}); `params` carries the sentence (`template` / `operands`,
58
- * no operands) and `flaw`, the rule word.
57
+ * echoed — the rule sentence is the way out); `params` carries the sentence (`template` / `operands`, no operands) and `flaw`, the rule word.
59
58
  *
60
59
  * Scope of the secret test: it judges the VALUE's shape (a value that looks like a secret, whatever the parameter is called) — the sibling
61
60
  * name-shaped judge `findUrlCredential` (`./url-credential`) asks the other question (a parameter whose NAME is on the credential-name table,
62
61
  * whatever the value looks like). Neither contains the other: `?key=abc` passes here and is a hit there; `?x=sk-live-…` is the reverse.
63
62
  *
64
- * This is the seat of every URL in a STORED document the one-time migration rewrites: the domain documents (models `baseUrl`, mcp `url`,
65
- * `sessionMirror.engineUrl`, workers `gitApiBaseUrl`) and `config.d/remote-exec.json` (k8s `apiUrl`, `s3Snapshot.endpoint`). A URL
66
- * that is not stored data — the web-admin credential envelope's `issuer`, a wire input — uses {@link NON_SECRET_URL_NO_MIGRATION}.
63
+ * One judge for every such seat, stored or not: the domain documents (models `baseUrl`, mcp `url`, `sessionMirror.engineUrl`, workers
64
+ * `gitApiBaseUrl`), `config.d/remote-exec.json` (k8s `apiUrl`, `s3Snapshot.endpoint`) and wire inputs (the web-admin credential
65
+ * envelope's `issuer`, the sandbox-git connect URL) — 26.0.0 merged the twin that differed only by a migration signpost.
67
66
  *
68
67
  * The value is kept EXACTLY as written: nothing here trims or normalizes it (zod's own `.url()` would hand back a rewritten string). */
69
68
  export declare const NON_SECRET_URL: z.ZodString;
70
- /** {@link NON_SECRET_URL}'s judge for a seat no one-time migration reaches (not stored data): identical rules and rule
71
- * sentences, but a fragment's refusal carries no migration signpost — pointing at a migration that cannot rewrite the value would
72
- * send the operator to a command that does nothing for it. */
73
- export declare const NON_SECRET_URL_NO_MIGRATION: z.ZodString;
74
69
  /** Validate a free-form `extraBody`: returns true = UNSAFE (reject). A GETTER-FREE, descriptor-based, bounded
75
70
  * walk that rejects — WITHOUT ever invoking a getter (a malicious getter could throw a secret-bearing message,
76
71
  * or return different values across the validate vs persist JSON.stringify calls) — anything that isn't plain
@@ -145,8 +140,9 @@ export interface ParseTransparentKey {
145
140
  * 解析透明,按「本包是不是那张形表的属主」判,不再按「怕连坐」判。
146
141
  *
147
142
  * 「解析透明」按**行为**定义(不按 schema 的形名):喂一组有代表性的值全收 = 本包对它的形没有任何主张。
148
- * 所以 `ModelEntry.extraBody` **不在**本表里 —— 它有自己的形门(必须是纯 JSON 对象,要摊进请求体);
149
- * 它开放的只是对象里的键名词表(各家 provider 的请求参数表),那是另一回事,写在它自己的 JSDoc 里。
143
+ * 所以**自由形对象键** `ModelEntry.extraBody` / `ModelEntry.headers`(26.0.0 起;6.4.0–25.x 它登记在本表)**不在**本表里 ——
144
+ * 本包判它们的容器(必须是纯 JSON 对象,同一只 `createFreeFormObjectTransform`);开放的只是对象里的键名词表(各家 provider 的
145
+ * 请求参数 / 头名),那是另一回事,写在各自的 JSDoc 里。
150
146
  *
151
147
  * 门:`test/parse-transparent-keys.test.ts` 从 `DOMAIN_SCHEMAS` **派生**出所有解析透明的叶子,与本表
152
148
  * 双向对拍 —— 多登记一行(键已经不透明了)红,少登记一行(新键静默溜进来)也红;派生遇到不认识的
@@ -228,7 +224,7 @@ export declare const ModelEntry: z.ZodObject<{
228
224
  }, z.core.$strip>>;
229
225
  extraBody: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<Record<string, unknown> | undefined, unknown>>;
230
226
  compat: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<unknown, unknown>>;
231
- headers: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<unknown, unknown>>;
227
+ headers: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<Record<string, unknown> | undefined, unknown>>;
232
228
  quotaWeight: z.ZodDefault<z.ZodNumber>;
233
229
  enabled: z.ZodDefault<z.ZodBoolean>;
234
230
  notes: z.ZodOptional<z.ZodString>;
@@ -350,7 +346,7 @@ export declare const ModelsConfig: z.ZodObject<{
350
346
  }, z.core.$strip>>;
351
347
  extraBody: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<Record<string, unknown> | undefined, unknown>>;
352
348
  compat: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<unknown, unknown>>;
353
- headers: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<unknown, unknown>>;
349
+ headers: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<Record<string, unknown> | undefined, unknown>>;
354
350
  quotaWeight: z.ZodDefault<z.ZodNumber>;
355
351
  enabled: z.ZodDefault<z.ZodBoolean>;
356
352
  notes: z.ZodOptional<z.ZodString>;
@@ -561,14 +557,13 @@ export declare const SystemStatusEntry: z.ZodObject<{
561
557
  updatedAt: z.ZodString;
562
558
  }, z.core.$strip>;
563
559
  export type SystemStatusEntry = z.infer<typeof SystemStatusEntry>;
564
- /** retired 域的**墓碑表**:域名 → retired版本 / 事实今天住哪 / 改写存量的一次性迁移。读存储文档的每个读者同判(`parseDomain` 拒写、`buildEffective`
560
+ /** retired 域的**墓碑表**:域名 → retired版本 / 事实今天住哪(/ 改写存量的一次性迁移,迁移还在时)。读存储文档的每个读者同判(`parseDomain` 拒写、`buildEffective`
565
561
  * 向店要retired 域、`readEffectiveWire` 看 wire、`FileConfigStore` 与 `readBundle` 读 `config.d/<名>.json`):文档**带事实**(在场且不是 `{}`)⇒ 响亮拒
566
- * (`RetiredDomainError`,句子点名迁移 id);缺席或 `{}`(没有可丢的事实)⇒ 不理会。墓碑是拒,不是读法 —— 它不把旧文档读成任何值。 */
562
+ * (`RetiredDomainError`,句子点名今天的位);缺席或 `{}`(没有可丢的事实)⇒ 不理会。墓碑是拒,不是读法 —— 它不把旧文档读成任何值。 */
567
563
  export declare const RETIRED_DOMAINS: {
568
564
  readonly runtime: {
569
565
  readonly retiredIn: "11.0.0";
570
566
  readonly now: "governance (autonomy / commandPolicy / approvalRequire) and limits (rateLimitPerMin / maxTaskCostUsd / maxTaskTokens / maxPrincipalCostUsd / costQuotaWindowSec)";
571
- readonly migration: "SS-M1";
572
567
  };
573
568
  };
574
569
  export type RetiredDomainName = keyof typeof RETIRED_DOMAINS;
@@ -1756,8 +1751,7 @@ export declare const WorkerStatus: z.ZodObject<{
1756
1751
  updatedAt: z.ZodString;
1757
1752
  }, z.core.$strip>;
1758
1753
  export type WorkerStatus = z.infer<typeof WorkerStatus>;
1759
- /** DNS-label bound on a host NAME (0.8.0 tightening; single source — the schema and the one-time migration SS-M2 that
1760
- * rewrites 0.7-era stored data over it both read this constant). */
1754
+ /** DNS-label bound on a host NAME (0.8.0 tightening; one constant — the schema reads it, and so does every message that names it). */
1761
1755
  export declare const HOST_NAME_MAX = 63;
1762
1756
  /** Ceiling on the hosts ARRAY (0.8.0 tightening; same single-source rule as {@link HOST_NAME_MAX}). */
1763
1757
  export declare const HOSTS_ARRAY_MAX = 1024;
@@ -2454,7 +2448,7 @@ export declare const DOMAIN_SCHEMAS: {
2454
2448
  }, z.core.$strip>>;
2455
2449
  extraBody: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<Record<string, unknown> | undefined, unknown>>;
2456
2450
  compat: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<unknown, unknown>>;
2457
- headers: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<unknown, unknown>>;
2451
+ headers: z.ZodPipe<z.ZodOptional<z.ZodUnknown>, z.ZodTransform<Record<string, unknown> | undefined, unknown>>;
2458
2452
  quotaWeight: z.ZodDefault<z.ZodNumber>;
2459
2453
  enabled: z.ZodDefault<z.ZodBoolean>;
2460
2454
  notes: z.ZodOptional<z.ZodString>;