@sema-agent/settings-schema 13.0.1 → 14.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 (136) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/README.md +19 -1
  3. package/conformance/VERSION +1 -1
  4. package/conformance/baseline.json +1 -3
  5. package/conformance/cases/c01-entry-salvage-then-typo/expected.json +1 -3
  6. package/conformance/cases/c02-hosts-clamp-stacked/expected.json +1 -3
  7. package/conformance/cases/c03-literal-dotted-top-key/expected.json +1 -3
  8. package/conformance/cases/c04-all-bad-collection-not-salvaged/expected.json +1 -3
  9. package/conformance/cases/c07-hooks-is-not-a-config-domain/expected.json +1 -3
  10. package/conformance/cases/c08-limits-unknown-carried-64/expected.json +1 -3
  11. package/conformance/cases/c09-limits-unknown-carried-65/expected.json +1 -3
  12. package/conformance/cases/c10-record-key-secret-redacted-twice/expected.json +1 -3
  13. package/conformance/cases/c11-unicode-unknown-keys/expected.json +1 -3
  14. package/conformance/cases/c12-prototype-name-top-keys/expected.json +1 -3
  15. package/conformance/cases/c13-models-field-null/expected.json +1 -3
  16. package/conformance/cases/c14-models-field-empty-array/expected.json +1 -3
  17. package/conformance/cases/c15-models-field-number/expected.json +1 -3
  18. package/conformance/cases/c16-deep-nesting-205/expected.json +1 -3
  19. package/conformance/cases/c17-empty-domain-file/expected.json +1 -3
  20. package/conformance/cases/c18-wire-envelope-not-an-object/expected.json +1 -3
  21. package/conformance/cases/c19-wire-envelope-no-version/expected.json +1 -3
  22. package/conformance/cases/c21-governance-empty-object-wins/expected.json +1 -3
  23. package/conformance/cases/c23-mixed-validity-models/expected.json +1 -3
  24. package/conformance/cases/c24-valid-entries-with-unknown-keys/expected.json +1 -3
  25. package/conformance/cases/c25-published-roundtrip-zero-warnings/expected.json +1 -3
  26. package/conformance/cases/c26-hosts-array-1024/expected.json +1 -3
  27. package/conformance/cases/c27-hosts-array-1025/expected.json +1 -3
  28. package/conformance/cases/c28-large-document-over-1mb/expected.json +1 -3
  29. package/conformance/cases/c29-salvage-then-domain-refine-fails/expected.json +1 -3
  30. package/conformance/cases/c30-version-triple-a-first/expected.json +1 -3
  31. package/conformance/cases/c31-version-triple-b-changed/expected.json +1 -3
  32. package/conformance/cases/c32-version-triple-a-restored/expected.json +1 -3
  33. package/conformance/cases/c33-limits-nested-carried-key/expected.json +1 -3
  34. package/conformance/cases/c34-skills-content-vs-manifest/expected.json +1 -3
  35. package/conformance/cases/c35-portable-domain-file-is-null/expected.json +1 -3
  36. package/conformance/cases/c36-skills-entry-without-content/expected.json +1 -3
  37. package/conformance/cases/c37-skills-field-null/expected.json +1 -3
  38. package/conformance/cases/c38-remote-exec-is-a-non-domain-file/expected.json +1 -3
  39. package/conformance/cases/c39-hidden-file-in-config-d/expected.json +1 -3
  40. package/conformance/cases/c40-s712-identity-only-what-reads-out/expected.json +1 -3
  41. package/conformance/cases/c41-s792-encoded-pem-identity/expected.json +1 -3
  42. package/conformance/cases/c42-s792-unknown-key-secret-redacted/expected.json +1 -3
  43. package/conformance/cases/c43-s792-form-and-deep-encoded-pem/expected.json +1 -3
  44. package/conformance/cases/c44-s792-utf8-escape-glued-token/expected.json +1 -3
  45. package/conformance/cases/c45-s792-identity-bounds-and-decode-depth/expected.json +1 -3
  46. package/conformance/cases/c46-s811-host-name-url-userinfo-withheld/expected.json +1 -3
  47. package/conformance/cases/c47-s811-roles-key-url-userinfo-withheld/expected.json +1 -3
  48. package/conformance/cases/c48-s935-model-headers-transported/expected.json +1 -3
  49. package/conformance/cases/c49-s935-model-headers-secret-entry-dropped/expected.json +1 -3
  50. package/conformance/cases/c50-s784-lane-host-legal/expected.json +1 -3
  51. package/conformance/cases/c51-s784-lane-e2b-legal/expected.json +1 -3
  52. package/conformance/cases/c52-s784-lane-k8s-legal/expected.json +1 -3
  53. package/conformance/cases/c53-s784-lane-ssh-legal/expected.json +1 -3
  54. package/conformance/cases/c54-s784-lane-adb-legal/expected.json +1 -3
  55. package/conformance/cases/c55-s784-lane-local-docker-legal/expected.json +1 -3
  56. package/conformance/cases/c56-s784-lane-device-legal/expected.json +1 -3
  57. package/conformance/cases/c57-s784-g1-enabled-no-lane/expected.json +1 -3
  58. package/conformance/cases/c58-s784-g2-multitenant-host/expected.json +1 -3
  59. package/conformance/cases/c59-s784-g3-k8s-missing-image/expected.json +1 -3
  60. package/conformance/cases/c60-s784-g3-e2b-missing-key/expected.json +1 -3
  61. package/conformance/cases/c61-s784-g3-other-lane-key/expected.json +1 -3
  62. package/conformance/cases/c62-s784-g7a-session-tidb/expected.json +1 -3
  63. package/conformance/cases/c63-s784-host-two-replicas/expected.json +1 -3
  64. package/conformance/cases/c64-s784-multitenant-local-store/expected.json +1 -3
  65. package/conformance/cases/c65-s784-pg-without-db/expected.json +1 -3
  66. package/conformance/cases/c66-s784-memory-backend-mismatch/expected.json +1 -3
  67. package/conformance/cases/c67-s784-retired-field-loud/expected.json +1 -3
  68. package/conformance/cases/c68-s784-device-local-store/expected.json +1 -3
  69. package/conformance/cases/c69-deep-encoded-token-past-every-reading/expected.json +1 -3
  70. package/conformance/cases/c70-rewritten-token-in-front-of-encoded-pem-header/expected.json +1 -3
  71. package/conformance/cases/c71-one-scanner-write-reads-display-forms/expected.json +1 -3
  72. package/conformance/cases/c72-dangling-reference-write-seat-refuses/expected.json +1 -3
  73. package/conformance/cases/c73-projects-extended-registration-reads/expected.json +1 -3
  74. package/conformance/cases/c74-projects-over-bound-refused/expected.json +1 -3
  75. package/conformance/cases/c75-projects-patch-remote-uniqueness/expected.json +1 -3
  76. package/conformance/cases/c76-projects-entry-salvage-nested/expected.json +1 -3
  77. package/conformance/cases/c77-prompts-center-artifact-carried/expected.json +252 -0
  78. package/conformance/cases/c77-prompts-center-artifact-carried/input.json +93 -0
  79. package/conformance/cases/c77-prompts-center-artifact-carried/meta.json +5 -0
  80. package/conformance/cases/c78-prompts-empty-bindings-refused/expected.json +82 -0
  81. package/conformance/cases/c78-prompts-empty-bindings-refused/input.json +11 -0
  82. package/conformance/cases/c78-prompts-empty-bindings-refused/meta.json +5 -0
  83. package/conformance/cases/c79-prompts-bad-worker-artifact-not-salvaged/expected.json +82 -0
  84. package/conformance/cases/c79-prompts-bad-worker-artifact-not-salvaged/input.json +129 -0
  85. package/conformance/cases/c79-prompts-bad-worker-artifact-not-salvaged/meta.json +5 -0
  86. package/conformance/cases/c80-prompts-wire-v2-verbatim/expected.json +195 -0
  87. package/conformance/cases/c80-prompts-wire-v2-verbatim/input.json +65 -0
  88. package/conformance/cases/c80-prompts-wire-v2-verbatim/meta.json +5 -0
  89. package/conformance/cases/c81-prompts-declaration-bindings-refused/expected.json +82 -0
  90. package/conformance/cases/c81-prompts-declaration-bindings-refused/input.json +23 -0
  91. package/conformance/cases/c81-prompts-declaration-bindings-refused/meta.json +5 -0
  92. package/conformance/cases/c82-prompts-v1-catalog-refused/expected.json +82 -0
  93. package/conformance/cases/c82-prompts-v1-catalog-refused/input.json +35 -0
  94. package/conformance/cases/c82-prompts-v1-catalog-refused/meta.json +5 -0
  95. package/conformance/cases/c83-prompts-bad-overlay-not-salvaged/expected.json +82 -0
  96. package/conformance/cases/c83-prompts-bad-overlay-not-salvaged/input.json +56 -0
  97. package/conformance/cases/c83-prompts-bad-overlay-not-salvaged/meta.json +5 -0
  98. package/conformance/cases/cc01-mcp-toolfaces-non-object/expected.json +1 -3
  99. package/conformance/cases/cc02-mcp-source-key-is-transported/expected.json +1 -3
  100. package/conformance/cases/cc03-model-compat-unknown-subkey/expected.json +1 -3
  101. package/conformance/cases/cli01-model-name-nfc-vs-nfd/expected.json +1 -3
  102. package/conformance/cases/cli02-control-and-zero-width-chars/expected.json +1 -3
  103. package/conformance/cases/cli03-credential-pasted-into-unknown-key/expected.json +1 -3
  104. package/conformance/cases/cli04-env-value-with-newline/expected.json +1 -3
  105. package/conformance/cases/cli05-long-and-prefix-colliding-names/expected.json +1 -3
  106. package/conformance/cases/t01-absent-domain-key-not-null/expected.json +1 -3
  107. package/conformance/cases/t03-prototype-name-key-not-swallowed/expected.json +1 -3
  108. package/conformance/cases/t04-secret-literal-never-in-warning-value/expected.json +1 -3
  109. package/conformance/cases/z01-every-domain-empty-object/expected.json +2 -6
  110. package/conformance/cases/z02-every-domain-unknown-key/expected.json +2 -6
  111. package/dist/config-fns.d.ts +7 -3
  112. package/dist/config-fns.js +19 -16
  113. package/dist/conformance/derive.js +2 -2
  114. package/dist/index.d.ts +1 -0
  115. package/dist/index.js +1 -0
  116. package/dist/mcp-request-entry.d.ts +118 -0
  117. package/dist/mcp-request-entry.js +266 -0
  118. package/dist/migration-receipt.d.ts +1 -1
  119. package/dist/migration-receipt.js +1 -1
  120. package/dist/node.d.ts +0 -1
  121. package/dist/node.js +0 -1
  122. package/dist/one-time-migrations.d.ts +1 -1
  123. package/dist/one-time-migrations.js +39 -0
  124. package/dist/safety-merge-spec.d.ts +6 -6
  125. package/dist/types.d.ts +438 -355
  126. package/dist/types.js +161 -136
  127. package/dist/url-shape.d.ts +8 -0
  128. package/dist/url-shape.js +10 -0
  129. package/docs/API-SURFACE.md +41 -27
  130. package/docs/CONFORMANCE.md +1 -1
  131. package/docs/CONSUMER-INTEGRATION.md +3 -2
  132. package/llms-full.txt +14 -11
  133. package/llms.txt +8 -2
  134. package/package.json +2 -2
  135. package/dist/prompts-digest.d.ts +0 -16
  136. package/dist/prompts-digest.js +0 -49
package/llms-full.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  <!--
2
2
  llms-full.txt — 自包含全文 · 消费方(使用者)视角 · @sema-agent/settings-schema
3
- 重写日期: 2026-10-16 | 包版本: 13.0.1
3
+ 重写日期: 2026-10-18 | 包版本: 14.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 等常驻门钉住)。无证据推断显式标【推断】。
@@ -64,7 +64,8 @@ registry:公网 npmjs,无需私有 registry 配置。
64
64
  - `EffectiveConfig`:全 16 域,skills 带全文 content 内联,rosters/entitlement 不清空。本地
65
65
  `loadLocalConfig().effective` 就是它。(src/types.ts: `EffectiveConfig`)
66
66
  - `EffectiveWire = Omit<EffectiveConfig,"skills"|"prompts"> & { skills: SkillsManifest; prompts?: unknown }`:
67
- skills 的 content 换成 contentHash(manifest);wire 整形时 rosters/entitlement 被清空(隐私/收窄)。这是
67
+ skills 的 content 换成 contentHash(manifest);wire 整形时 rosters/entitlement 被清空(隐私/收窄);`prompts` 在 wire 上是
68
+ `EffectivePromptsWire`(`{schemaVersion: 2, artifact}`,中心为拉取方选出的那一份、盖上发布出处),读腿按在场性原样承运、由消费方判。这是
68
69
  远程 worker 真正收到的。(src/types.ts: `EffectiveWire`;src/resolve-roster.ts)
69
70
  - 转换发生在 `resolveEffectiveForWorker`(纯函数);本地路径不经过它,拿到的是全文 EffectiveConfig。
70
71
 
@@ -134,9 +135,12 @@ registry:公网 npmjs,无需私有 registry 配置。
134
135
  · execution:执行车道策略 —— `sessionMirror`(org 默认镜像目标)+ `publicKeys`(`ExecutionPublicKey`
135
136
  sealed-box 公钥登记,`workerId?` 多 worker 选钥)。
136
137
  · projects:项目身份登记簿(`ProjectRegistration`,`PROJECT_ID_REGEX` 宽读严写;租户身份数据,不便携)。
137
- · prompts:声明轴(`PromptTextDeclaration` + 三维 `PromptBinding` global/worker/scenario,covering 语义)+
138
- catalog 轴(immutable by-digest `PublishedPromptArtifactEnvelope`,`PROMPT_ARTIFACT_LIMITS` 镜像常量);
139
- 下发形 `EffectivePrompts` / `EffectivePromptsWire`。
138
+ · prompts(14.0.0 单轴):只装引擎当期 schema 的中心 artifact。存储 `PromptsConfig = { artifact?, workers? }`(artifact 的身份
139
+ `{payload, artifactDigest}`,`workers.<名>` 整份取代 scope 那份;`bindings` / `catalog` 是墓碑,存量经 SS-M10);下发 `EffectivePromptsWire =
140
+ { schemaVersion: 2, artifact }`;唯一选择读法 `promptArtifactFor(prompts, worker | null)`。v3 结构镜像 `PromptArtifact` / `PublishedPromptArtifact` /
141
+ `PromptArtifactPayload`(schemaVersion 3)/ `PromptOverlay`(无 `scope`)/ `PromptOverlayWhen` / `PromptBindingCondition`(`{anyOf}` 或 `{noneOf}` 恰一表)/
142
+ `PromptArtifactRequires` / `PromptArtifactEvidence`;上界镜像 `PROMPT_ARTIFACT_LIMITS`(引擎七键)、`PROMPT_BINDING_MAX_CHARS` / `PROMPT_BINDING_LIST_MAX`。
143
+ 引擎词表不镜像(语义只有引擎 verify);逐条抢救 none(digest 约束)。
140
144
  · limits:cost/限流族 14 键的热更新发布位;**open-world `.passthrough()`**(未知键原样承运 +
141
145
  `"unknown-keys-carried"` 点名;1.x 论证见源头注,行为钉在 test/limits-domain-0.19.test.ts)。
142
146
  - 边界 schema(可直接复用):`ENV_NAME`(/^[A-Z_][A-Z0-9_]*$/ 且拒 AKIA 形)、`NON_SECRET_URL`(存量文档里的 URL 座位 —— 域文档与 `config.d/remote-exec.json`
@@ -405,8 +409,7 @@ entitlement/execution/limits = `none`;`projects` = `salvage`,整域档位仍 `"t
405
409
  (durable 行 `scope` 被兼容臂重铸,带 `from`/`to`)。行为一字未变 —— 2.0.0 只是把这次重写从静默改成出声。
406
410
  - node 绑定(`./node`):`loadSchedulerStore`/`saveSchedulerStore`/`createFileSchedulerStore`(4.0.0 改名,
407
411
  旧名 `fileSchedulerStore` 已删、零别名)、跨进程原子变更
408
- `mutateSchedulerStore`。(prompts 对账锚 `promptsContentDigest`/`sectionContentHash` 4.0.0 起住在自己的
409
- 模块 `./prompts-digest`,仍从 `./node` 这条 subpath 出门 —— 消费方的 import 一字未改。)
412
+ `mutateSchedulerStore`。
410
413
 
411
414
  --- 4.10 api 契约(主 barrel;细分 `./api/auth` / `./api/auth-bridge` / `./api/scopes`) ---
412
415
  - `api/auth`:RFC 8628 设备流 + 旋转 refresh + logout 的 wire 形(snake_case 刻意保留);
@@ -454,7 +457,7 @@ entitlement/execution/limits = `none`;`projects` = `salvage`,整域档位仍 `"t
454
457
  `retiredEnvRefusal(env)`(纯,读传入的 env;码 `RETIRED_ENV_REFUSAL_CODE` = `config.env_key_retired`;只点名键不回显值);
455
458
  目录 wire 投影 `buildRetiredEnvWire()`。引擎起服 / 壳起本机引擎 / web-admin 渲染 worker env 判同一张表。
456
459
 
457
- --- 4.11 Node-only(`./node`:file-store / file-edit / bundle / local-load / scheduler-store-node / prompts-digest) ---
460
+ --- 4.11 Node-only(`./node`:file-store / file-edit / bundle / local-load / scheduler-store-node / 目录迁移) ---
458
461
  - `loadLocalConfig(root, {onWarning}?)` → `LocalConfig { effective, remoteExec, env, requiredEnv, warnings }`。
459
462
  - `loadRemoteExec(root)`(三态,§8 T3)、`writeRemoteExec`(校验+原子写)、`remoteExecPath`、`loadEnvFile`
460
463
  (`.env` merge over process.env,file 赢,支持 `KEY=file:<path>`)。
@@ -520,8 +523,8 @@ entitlement/execution/limits = `none`;`projects` = `salvage`,整域档位仍 `"t
520
523
  - `./one-time-migrations`(11.0.0,不进主 barrel):一次性迁移族 —— `migrateStoredDocuments(docs, { coverage })` / `migrateEffectiveSnapshot` /
521
524
  `migrateSchedulerRecords`、登记表 `ONE_TIME_MIGRATIONS`(每条的窗、删法、删后由谁接住)、收据形 `MigrationReceipt`(闭集 `appliedAs`)。
522
525
  纯函数,不抬任何版本号;按登记表的窗整族删。(src/one-time-migrations.ts)
523
- - `./node`(Node-only,拉 node:fs):file-store / file-edit / bundle / local-load / scheduler-store-node /
524
- prompts-digest(prompts 下发包的内容摘要,4.0.0 从 scheduler-store-node 搬出、两个 sha256 铸点合成一只)。
526
+ - `./node`(Node-only,拉 node:fs):file-store / file-edit / bundle / local-load / scheduler-store-node / 目录形一次性迁移
527
+ (`migrateConfigDirectory` + `nodeConfigDirectoryIo`)。(prompts 内容摘要 `promptsContentDigest` / `sectionContentHash` 14.0.0 随声明轴删除。)
525
528
  浏览器 bundle 绝不从这里 import。(src/node.ts)
526
529
  - `./conformance`(3.0.0,Node-only):跨仓一致性门 kit —— `runConformance(adapter, {mode})` 让消费方把
527
530
  **自己的生产入口**塞进来跑随包发的金样语料(`conformance/cases/**`),证同一份 settings 在几方读出的
@@ -610,7 +613,7 @@ R4. doctor 面板列缺失 secret:`loadLocalConfig(root).requiredEnv` 渲染 `pr
610
613
  R5. fleet 配置种到本地/反向:`exportBundle`/`writeBundle`/`readBundle`(remote-exec 不进 bundle,用
611
614
  `writeRemoteExec`)。
612
615
  R6. 复用 secret 边界:直接用 `ENV_NAME`/`NON_SECRET_URL`/`containsSecretToken`,别自写正则。
613
- R7. ETag/漂移检测:`stableHash`;skills/prompts 内容寻址:`skillContentHash`/`sha256Hex`。
616
+ R7. ETag/漂移检测:`stableHash`;skills 内容寻址:`skillContentHash`/`sha256Hex`(prompts 的身份是引擎铸的 `artifactDigest`,本包不铸)。
614
617
  R8. 消费端读 wire:`readEffectiveWire(raw, onWarning)`(容错极性是裁定过的语义,别自己 parse 全量域)。
615
618
  R9. settings resolver:类别合并律读 `SAFETY_MERGE_SPEC` + `trustRank`/`isAtLeast`/`memberAdmission`,层准入读 `layerAdmission` +
616
619
  `SETTINGS_SOURCE_CONTRACT`(查口 `settingsSourceContract`),禁自铸 rank/成员/层档表;hooks 坏形读 `classifyHooksConfig`,禁自铸判官。
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  <!--
2
2
  llms.txt — 消费方(使用者)视角索引 · @sema-agent/settings-schema
3
- 重写日期: 2026-10-16 | 包版本: 13.0.1
3
+ 重写日期: 2026-10-18 | 包版本: 14.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 相等、
@@ -109,6 +109,12 @@ llms.txt — 消费方(使用者)视角索引 · @sema-agent/settings-schema
109
109
  (src/http-hook-allowlists.ts)
110
110
  - **MCP 名单判决**(13.0.0):`mcpServerPolicyVerdict(server, layers)` → `McpPolicyBlock{name, list, rule, target, written, sources}` 或 `undefined`;
111
111
  判按展开后目标、回显只按展开前写法(stdio 只给可执行名 + 参数个数);托管层 = 源表档 `managed` 的源(层只带源名)。(src/mcp-server-policy.ts)
112
+ - **请求面 MCP 条目判官**(14.0.0,`src/mcp-request-entry.ts`):`isUsableWireName` / `describeBadWireName`(引擎线上名长界 `TOOL_WIRE_NAME_MAX_CHARS` 的镜像;首尾空白 = 坏名,不 trim 不规范化,内部空白合法)·
113
+ `isContentOriginWord` / `describeBadContentOrigin`(回显剥控制与双向字符、截 64 字、引号形)· `readMcpIdentityHeaders` · `readRequestMcpTransport`(硬坏形 `ok:false` 点名键路径;软坏形读器丢键并记进 `lost`;
114
+ `env` / `headers` 只收纯数据的「名 → 串」记录,`Map` / 类实例 / 自有 `__proto__` 成员不收、交副本,`lost` 条目带 `member` / `fault` 机读位)
115
+ + 值种类描述件 —— 服务端请求腿与壳的发送前预检同读一份(判据与原因句逐字同)。`toolFaces` 声明在本包解析透明,形归引擎摄入侧判,本包不镜像工具面词表。
116
+ - **prompts 域单轴**(14.0.0):只装中心 artifact(存储 `PromptsConfig = { artifact?, workers? }` / 下发 `EffectivePromptsWire = { schemaVersion: 2, artifact }` /
117
+ 唯一选择读法 `promptArtifactFor`);本包镜像 artifact v3 的结构与上界,语义交引擎 verify;13.x 两轴是墓碑,存量经一次性迁移 SS-M10。
112
118
  - **界面语言设置片段**(13.0.0):`UI_LANGUAGE_SETTING`(`semaUiLanguage`,`en` / `zh`,类 `ui`,用户设置)+ `readUiLanguage`(词表外 `ok:false`,不猜)。
113
119
  (src/ui-language.ts)
114
120
  - **fleet 契约**(drain / 实例发现 / 派发策略 / 配额租约 / 用量上报;S-741 重启信号 `RestartSignal` 定义一次,
@@ -170,5 +176,5 @@ llms.txt — 消费方(使用者)视角索引 · @sema-agent/settings-schema
170
176
  - 例子:`examples/toc-e2e.mjs`(可独立复跑的本地消费闭环,`npm run e2e`,须先 build)。
171
177
  - 消费方接入答疑:`docs/CONSUMER-INTEGRATION.md`;auth/scopes 的 OpenAPI 镜像:`docs/openapi-auth.yaml` /
172
178
  `docs/openapi-scopes.yaml`。
173
- - 内容寻址 sha256(skills body 懒拉、prompts 段落对账)、FNV-1a 64 `stableHash`(ETag/漂移检测)。
179
+ - 内容寻址 sha256(skills body 懒拉)、FNV-1a 64 `stableHash`(ETag/漂移检测)。
174
180
  (src/sha256.ts;src/hash.ts;src/skills-manifest.ts)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/settings-schema",
3
- "version": "13.0.1",
3
+ "version": "14.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",
@@ -149,7 +149,7 @@
149
149
  "publish:npm": "npm publish --access public --@sema-agent:registry=https://registry.npmjs.org/ --\"//registry.npmjs.org/:_authToken=${NPM_TOKEN}\""
150
150
  },
151
151
  "devDependencies": {
152
- "@sema-agent/core": "7.47.0",
152
+ "@sema-agent/core": "7.53.0",
153
153
  "@types/node": "^22.10.0",
154
154
  "esbuild": "^0.21.5",
155
155
  "typescript": "^5.7.0",
@@ -1,16 +0,0 @@
1
- /** [1057]① prompts contentDigest:canonical JSON(stableStringify 同姿势:键序稳定+深度护栏)全量 sha256,
2
- * **非盐化**(三方可独立复算)。入参=下发形的 `{sections, scenarioOverrides?}`(packId/contentDigest
3
- * 自身不入 hash)。 */
4
- export declare function promptsContentDigest(payload: {
5
- sections: unknown;
6
- scenarioOverrides?: unknown;
7
- }): {
8
- contentDigest: string;
9
- packId: string;
10
- /** [1062]③ 顺带:逐 section 对 `text` 铸的 contentHash(与 core 1.315 校验语义同刻度=
11
- * sha256(text));元素无 string text 位=undefined。web-admin 物化流程=先把这些写回
12
- * declaration.contentHash,再对含 hash 的终形铸整包 digest(本函数对入参原样铸,两步自洽)。 */
13
- sectionHashes: Array<string | undefined>;
14
- };
15
- /** 逐 section 对账锚(core 1.315 `PromptTextDeclaration.contentHash` 同刻度):sha256(text)。 */
16
- export declare function sectionContentHash(text: string): string;
@@ -1,49 +0,0 @@
1
- /**
2
- * @sema-agent/settings-schema/node — prompts 下发包的**内容摘要**([1057]①/[1062]③)。
3
- *
4
- * 这两只是跨仓**对账锚**:web-admin 铸、server 透传、core 的 manifest 归因**独立复算**,三方算出同一个值才
5
- * 对得上账([1050]② operator 对账位)。所以它们只有一件事要守:**一个刻度**。
6
- *
7
- * 4.0.0 从 `scheduler-store-node.ts` 搬到这里(不 breaking —— 仍挂在 `./node` 这条 subpath 上,消费方的
8
- * import 一个字不用改)。两条理由:①它与调度存储(`scheduled_tasks.json` 的原子读写 + 跨进程变更原语)
9
- * 零关系,住在一起只是历史;②搬家顺手把**两个** sha256 铸点合成一只 —— 此前整包 digest 与逐 section
10
- * contentHash 各自 `createHash('sha256')` 一次、各自拼一次 `sha256:` 前缀,哪天有人只改一处就成了两个刻度,
11
- * 而没有一格会红(门:`test/prompts-digest-4.0.0.test.ts` 逐条看着铸点数与出门前缀数)。
12
- *
13
- * 摘要用本包**纯实现**的 sha256(`./sha256.ts`),不是 `node:crypto` —— 那份实现与
14
- * `createHash("sha256").update(s,"utf8").digest("hex")` 逐字节相同(`test/sha256.test.ts` 逐例压着,
15
- * 本模块的门再压一遍摘要值本身),于是整个包的 sha256 只有**一份实现**。
16
- */
17
- import { stableStringify } from './hash.js';
18
- import { sha256Hex } from './sha256.js';
19
- import { PROMPT_PACK_ID_PREFIX } from './types.js';
20
- /**
21
- * 本模块**唯一**的 sha256 铸点:一段 utf8 文本 → `{ hex, anchor }`。`anchor` = 出门形 `sha256:<hex>`
22
- * (自描述算法,与 skills 的内容地址同形),`hex` 给需要裸 hex 的那一处(packId 取前 12 位)。
23
- * 两个出门形从**同一次**摘要派生 —— 这正是本模块存在的理由。
24
- */
25
- function contentAnchor(text) {
26
- const hex = sha256Hex(text);
27
- return { hex, anchor: `sha256:${hex}` };
28
- }
29
- /** [1057]① prompts contentDigest:canonical JSON(stableStringify 同姿势:键序稳定+深度护栏)全量 sha256,
30
- * **非盐化**(三方可独立复算)。入参=下发形的 `{sections, scenarioOverrides?}`(packId/contentDigest
31
- * 自身不入 hash)。 */
32
- export function promptsContentDigest(payload) {
33
- const canonical = stableStringify({
34
- sections: payload.sections,
35
- ...(payload.scenarioOverrides !== undefined ? { scenarioOverrides: payload.scenarioOverrides } : {}),
36
- });
37
- const { hex, anchor } = contentAnchor(canonical);
38
- const sectionHashes = Array.isArray(payload.sections)
39
- ? payload.sections.map((s) => {
40
- const t = s?.text;
41
- return typeof t === 'string' ? sectionContentHash(t) : undefined;
42
- })
43
- : [];
44
- return { contentDigest: anchor, packId: `${PROMPT_PACK_ID_PREFIX}${hex.slice(0, 12)}`, sectionHashes };
45
- }
46
- /** 逐 section 对账锚(core 1.315 `PromptTextDeclaration.contentHash` 同刻度):sha256(text)。 */
47
- export function sectionContentHash(text) {
48
- return contentAnchor(text).anchor;
49
- }