soma-core 2.0.1 → 2.1.1

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 (161) hide show
  1. package/README.md +2 -2
  2. package/bin/eject.cjs +5 -5
  3. package/bin/soma-runtime.cjs +5 -123
  4. package/bin/soma.cjs +2 -2
  5. package/bin/soma.ts +8 -20
  6. package/core/build/compiler/page-declaration-compiler.ts +5 -6
  7. package/core/build/lsp/soma-declaration.cjs +0 -6
  8. package/core/client/container/SomaContainerAdapter.ts +1 -1
  9. package/core/client/data/region-scope-views.ts +1 -1
  10. package/core/client/engine/event-engine.ts +1 -6
  11. package/core/client/engine/soma-bootstrap.ts +5 -13
  12. package/core/client/host-bridge/soma-bootstrap-from-app.ts +2 -2
  13. package/core/client/infra/i18n/II18n.ts +5 -6
  14. package/core/client/infra/i18n/locale-catalog.ts +8 -5
  15. package/core/client/infra/identity/identity-port.ts +1 -1
  16. package/core/client/keyboard/index.ts +0 -1
  17. package/core/client/keyboard/wiring.ts +0 -3
  18. package/core/client/parser/ui-config-parser.ts +6 -9
  19. package/core/client/registry/declaration-renderer.ts +1 -1
  20. package/core/client/runtime/SomaRuntimeServices.ts +1 -1
  21. package/core/inspect/check-runtime.ts +2 -3
  22. package/core/server/host/content-security-policy.ts +2 -11
  23. package/core/server/host/host-assembly-entry.ts +10 -2
  24. package/core/server/host/host-assembly.ts +28 -10
  25. package/core/server/host/host-caller.ts +52 -0
  26. package/core/server/host/host-response-headers.ts +49 -0
  27. package/core/server/host/locale-yaml.ts +7 -5
  28. package/core/server/host/published-page-assets.ts +1 -1
  29. package/core/server/host/resolve-host-request-hook.ts +2 -11
  30. package/core/server/host/resolve-host-tree-context.ts +7 -41
  31. package/core/server/host/server-page-assets.ts +0 -22
  32. package/core/server/host/source-packages.cjs +3 -4
  33. package/core/server/host/virtual-pages.ts +12 -70
  34. package/core/server/index.ts +1 -3
  35. package/core/server/node.ts +0 -1
  36. package/core/server/page-assets.ts +2 -20
  37. package/core/server/page-declaration.ts +1 -1
  38. package/core/server/registry/api-registry-store.ts +5 -25
  39. package/core/server/registry/asset-store.ts +5 -23
  40. package/core/server/registry/page-registry-repository.ts +9 -13
  41. package/core/server/registry/page-registry-store.ts +44 -82
  42. package/core/server/registry/publish-asset-pin.ts +3 -4
  43. package/core/server/registry/registry-subjects.ts +6 -6
  44. package/core/server/registry/rollback-plan.ts +5 -8
  45. package/core/server/registry/source/version-store.ts +8 -30
  46. package/core/server/registry/standard-product.ts +1 -1
  47. package/core/server/runtime-space/bindings.ts +1 -4
  48. package/core/server/runtime-space/gc.ts +2 -3
  49. package/core/server/runtime-space/inject.ts +4 -5
  50. package/core/server/runtime-space/resolve.ts +13 -27
  51. package/core/server/runtime-space/root.cjs +9 -100
  52. package/core/server/runtime-space/root.ts +3 -23
  53. package/core/server/runtime-space/types.ts +0 -11
  54. package/core/shared/artifact-compatibility.ts +6 -16
  55. package/core/shared/component-tree-artifact.ts +4 -8
  56. package/core/shared/core-diagnostic-codes.ts +1 -3
  57. package/core/shared/pipeline-error-codes-view.ts +1 -2
  58. package/core/shared/published-page-route.ts +1 -6
  59. package/core/shared/registry-generated/diagnostic-registry-index.ts +0 -2
  60. package/core/shared/registry-generated/diagnostic-registry.ts +0 -14
  61. package/core/shared/source-file-suffix.ts +8 -0
  62. package/core/shared/types/component-tree-artifact.types.ts +2 -15
  63. package/core/shared/types/host-assembly.types.ts +31 -2
  64. package/core/shared/types/locale.types.ts +3 -3
  65. package/core/shared/types/region-scope.types.ts +1 -1
  66. package/core/shared/types/ui-config.types.ts +2 -7
  67. package/core/shared/types/write.types.ts +1 -1
  68. package/dist/browser/soma-runtime.js +20 -36
  69. package/dist/cli/soma.js +8 -21
  70. package/dist/core/index.cjs +20 -38
  71. package/dist/lsp/component-tree.cjs +7 -14
  72. package/dist/types/client/container/SomaContainerAdapter.d.ts +1 -1
  73. package/dist/types/client/engine/event-engine.d.ts +0 -2
  74. package/dist/types/client/engine/soma-bootstrap.d.ts +2 -3
  75. package/dist/types/client/host-bridge/soma-bootstrap-from-app.d.ts +2 -2
  76. package/dist/types/client/infra/i18n/II18n.d.ts +5 -6
  77. package/dist/types/client/infra/i18n/locale-catalog.d.ts +3 -3
  78. package/dist/types/client/infra/identity/identity-port.d.ts +1 -1
  79. package/dist/types/client/keyboard/index.d.ts +1 -1
  80. package/dist/types/client/keyboard/wiring.d.ts +0 -2
  81. package/dist/types/client/registry/declaration-renderer.d.ts +1 -1
  82. package/dist/types/client/runtime/SomaRuntimeServices.d.ts +1 -1
  83. package/dist/types/server/host/content-security-policy.d.ts +0 -5
  84. package/dist/types/server/host/host-assembly-entry.d.ts +5 -2
  85. package/dist/types/server/host/host-assembly.d.ts +9 -4
  86. package/dist/types/server/host/host-caller.d.ts +10 -0
  87. package/dist/types/server/host/host-response-headers.d.ts +16 -0
  88. package/dist/types/server/host/published-page-assets.d.ts +1 -1
  89. package/dist/types/server/host/resolve-host-request-hook.d.ts +0 -4
  90. package/dist/types/server/host/resolve-host-tree-context.d.ts +1 -1
  91. package/dist/types/server/host/server-page-assets.d.ts +0 -2
  92. package/dist/types/server/host/virtual-pages.d.ts +4 -14
  93. package/dist/types/server/index.d.ts +1 -2
  94. package/dist/types/server/node.d.ts +1 -1
  95. package/dist/types/server/page-assets.d.ts +1 -4
  96. package/dist/types/server/page-declaration.d.ts +1 -1
  97. package/dist/types/server/registry/api-registry-store.d.ts +1 -6
  98. package/dist/types/server/registry/asset-store.d.ts +2 -11
  99. package/dist/types/server/registry/page-registry-repository.d.ts +4 -4
  100. package/dist/types/server/registry/page-registry-store.d.ts +22 -30
  101. package/dist/types/server/registry/registry-subjects.d.ts +2 -2
  102. package/dist/types/server/registry/rollback-plan.d.ts +0 -3
  103. package/dist/types/server/registry/source/version-store.d.ts +1 -9
  104. package/dist/types/server/registry/standard-product.d.ts +1 -1
  105. package/dist/types/server/runtime-space/resolve.d.ts +0 -3
  106. package/dist/types/server/runtime-space/root.d.cts +6 -29
  107. package/dist/types/server/runtime-space/root.d.ts +2 -7
  108. package/dist/types/server/runtime-space/types.d.ts +0 -9
  109. package/dist/types/shared/artifact-compatibility.d.ts +1 -3
  110. package/dist/types/shared/core-diagnostic-codes.d.ts +1 -1
  111. package/dist/types/shared/published-page-route.d.ts +1 -3
  112. package/dist/types/shared/registry-generated/diagnostic-registry.d.ts +0 -12
  113. package/dist/types/shared/types/component-tree-artifact.types.d.ts +2 -15
  114. package/dist/types/shared/types/host-assembly.types.d.ts +27 -1
  115. package/dist/types/shared/types/locale.types.d.ts +1 -1
  116. package/dist/types/shared/types/region-scope.types.d.ts +1 -1
  117. package/dist/types/shared/types/ui-config.types.d.ts +2 -7
  118. package/dist/types/shared/types/write.types.d.ts +1 -1
  119. package/global.d.ts +0 -9
  120. package/host-next/app/SomaPageClient.tsx +359 -0
  121. package/host-next/app/[...path]/page.tsx +22 -0
  122. package/host-next/app/api/[...path]/route.ts +98 -0
  123. package/host-next/app/api/soma-registry/[...path]/route.ts +79 -0
  124. package/host-next/app/components/SomaHostPage.tsx +128 -0
  125. package/host-next/app/components/SomaHydrationShell.tsx +20 -0
  126. package/host-next/app/components/SomaPageClientBoundary.tsx +13 -0
  127. package/host-next/app/components/SomaPageForbidden.tsx +19 -0
  128. package/host-next/app/favicon.ico/route.ts +13 -0
  129. package/host-next/app/globals.css +177 -0
  130. package/host-next/app/layout.tsx +27 -0
  131. package/host-next/app/page-access.ts +47 -0
  132. package/host-next/app/page.tsx +9 -0
  133. package/host-next/app/router-bridge.ts +42 -0
  134. package/host-next/app/soma/[...path]/route.ts +9 -0
  135. package/host-next/app/soma/_shared/host-prepare.ts +33 -0
  136. package/host-next/app/soma/_shared/page-http.ts +86 -0
  137. package/host-next/app/soma/manifest/route.ts +98 -0
  138. package/host-next/app/soma/page/route.ts +36 -0
  139. package/host-next/app/soma/route.ts +9 -0
  140. package/host-next/app/soma-runtime/[...file]/route.ts +21 -0
  141. package/host-next/app/soma-runtime/_shared/static-file.ts +89 -0
  142. package/host-next/bin/host-next.cjs +59 -0
  143. package/host-next/instrumentation.ts +13 -0
  144. package/host-next/next-env.d.ts +7 -0
  145. package/host-next/next.config.js +382 -0
  146. package/host-next/proxy.ts +43 -0
  147. package/host-next/src/shell-routes.cjs +51 -0
  148. package/host-next/src/workspace.ts +543 -0
  149. package/package.json +66 -41
  150. package/tsconfig.json +2 -1
  151. package/core/server/host/page-response-mode.cjs +0 -96
  152. package/core/server/host/page-response-request.ts +0 -33
  153. package/core/server/host/request-origin.ts +0 -18
  154. package/core/server/host/soma-request-hook-host.stub.ts +0 -4
  155. package/core/server/runtime-space/migrate-sources.ts +0 -124
  156. package/core/shared/source-compat.ts +0 -9
  157. package/dist/types/server/host/page-response-request.d.ts +0 -8
  158. package/dist/types/server/host/request-origin.d.ts +0 -1
  159. package/dist/types/server/host/soma-request-hook-host.stub.d.ts +0 -2
  160. package/dist/types/server/runtime-space/migrate-sources.d.ts +0 -19
  161. /package/dist/types/shared/{source-compat.d.ts → source-file-suffix.d.ts} +0 -0
@@ -58,7 +58,6 @@ export {
58
58
  resolveSomaPageSource,
59
59
  SomaPageAssetError,
60
60
  type SomaServerPageAssets,
61
- type SomaPageAssetLoadProfile,
62
61
  } from './host/server-page-assets';
63
62
  // 宿主资源定位面(《core 公开面补齐表》§2.2):explain / testkit 静态出口按宿主目录找页面源,Host 路由取虚拟页资产
64
63
  export {
@@ -66,6 +65,5 @@ export {
66
65
  getSomaHostSourceRoot,
67
66
  type SomaAssetSource,
68
67
  } from './host/source-packages';
69
- export { loadVirtualPageAssets } from './host/virtual-pages';
70
- // runtime 空间(RT2 / E2):动态注入与地址绑定、按地址取页。独立子路径 soma-core/server/runtime 并入乙批,过渡期挂在这里。
68
+ // runtime 空间(RT2 / E2):动态注入与地址绑定、按地址取页。
71
69
  export * from './runtime-space';
@@ -33,7 +33,6 @@ export {
33
33
  loadSomaServerPageAssets,
34
34
  resolveSomaPageSource,
35
35
  SomaPageAssetError,
36
- type SomaPageAssetLoadProfile,
37
36
  type SomaServerPageAssets,
38
37
  } from './host/server-page-assets';
39
38
  export { loadPageMarkupConfig, renderColorSchemeMeta } from './host/page-markup-config';
@@ -11,8 +11,6 @@ export { compileSomaPageAssets } from './host/soma-page-compile';
11
11
  export { compilePublishedPageArtifact } from './host/published-page-artifact-cache';
12
12
 
13
13
  // 预编译产物载入依赖服务端runtime空间,归本入口,不由构建层反向依赖server。
14
- import fs from 'node:fs';
15
- import path from 'node:path';
16
14
  import type { SomaPrecompiledManifest, SomaPrecompiledPage } from '../build/compiler/full-manifest-builder';
17
15
  import { readPrewarmCompiled } from './runtime-space/prewarm';
18
16
  import { resolveSomaRuntimeLayout } from './runtime-space/root';
@@ -58,28 +56,12 @@ function loadFromPrewarm(hostDir: string, env: Readonly<Record<string, string |
58
56
  }
59
57
  }
60
58
 
61
- /** 旧来源:HOST `.soma/manifest.json`(只读,保留一个周期;不再有写入方) */
62
- function loadFromLegacyFile(hostDir: string): SomaPrecompiledManifest | null {
63
- const manifestPath = path.join(hostDir, '.soma', 'manifest.json');
64
- if (!fs.existsSync(manifestPath)) return null;
65
- try {
66
- return validatePages(JSON.parse(fs.readFileSync(manifestPath, 'utf8')) as SomaPrecompiledManifest);
67
- } catch {
68
- return null;
69
- }
70
- }
71
-
72
- /**
73
- * 读构建期预编译清单:先读 runtime 空间的预热,没有再读旧 `.soma/manifest.json`。
74
- * 预热对得上账但页面校验不过时返回 null,不退回旧文件拼半新半旧;旧文件已无写入方,只在升级后的第一个周期兜底。
75
- */
59
+ /** 读构建期预编译清单:只读 runtime 空间的预热;没有预热或页面校验不过都返回 null。 */
76
60
  export function loadPrecompiledManifest(
77
61
  hostDir: string,
78
62
  env: Readonly<Record<string, string | undefined>> = process.env,
79
63
  ): SomaPrecompiledManifest | null {
80
- const prewarmed = loadFromPrewarm(hostDir, env);
81
- if (prewarmed !== undefined) return prewarmed;
82
- return loadFromLegacyFile(hostDir);
64
+ return loadFromPrewarm(hostDir, env) ?? null;
83
65
  }
84
66
 
85
67
  /** Find precompiled page by route (supports /items → items/index short path) */
@@ -93,7 +93,7 @@ export type { SomaStructureSemanticToken } from '../shared/types/component-contr
93
93
 
94
94
  export { assertVirtualPagePrefix } from './host/virtual-pages';
95
95
 
96
- /** Host 虚拟页(预览)装配钩子的类型:`bootstrap/soma-virtual-pages.ts` 导出 `createSomaVirtualPages()`。 */
96
+ /** Host 虚拟页(预览)的类型:由 `soma.app.ts` 装配的 `virtualPages()` 交出。 */
97
97
  export type {
98
98
  SomaVirtualPage,
99
99
  SomaVirtualPageRegistration,
@@ -18,7 +18,7 @@
18
18
 
19
19
  import fs from 'node:fs';
20
20
  import path from 'node:path';
21
- import { currentRuntimeLayout, firstLegacyDirWithData, warnRuntimeLegacyDirOnce } from '../runtime-space/root';
21
+ import { currentRuntimeLayout } from '../runtime-space/root';
22
22
  import type { SomaDataFieldConfig } from '../../shared/types/data-config.types';
23
23
  import { withRegistryLock, writeFileAtomic } from './registry-file-lock';
24
24
  import { RegistryError } from './registry-error';
@@ -115,22 +115,18 @@ export interface ApiRegistryListResult {
115
115
  export interface ApiRegistryStoreOptions {
116
116
  /** 持久化目录(每接口一个 <name>.json),默认 `<runtime 根>/registry/apis` */
117
117
  baseDir?: string;
118
- /** 旧位置(只读回退):新目录没有该接口文件而旧目录有时读旧文件并报一次 CORE-RUNTIME-LEGACY-DIR;写入永远落新目录 */
119
- legacyDir?: string;
120
118
  /** 时钟注入点,默认 Date.now;测试传确定性时钟 */
121
119
  now?: () => number;
122
120
  }
123
121
 
124
122
  export class ApiRegistryStore {
125
123
  private readonly baseDir: string;
126
- private readonly legacyDir: string | null;
127
124
  private readonly now: () => number;
128
125
  /** 读缓存:注册名 → { 记录, 落盘指纹 }。指纹变了就重读(与页面表同口径) */
129
126
  private readonly cache = new Map<string, { record: ApiRecord; stamp: string }>();
130
127
 
131
128
  constructor(options: ApiRegistryStoreOptions = {}) {
132
129
  this.baseDir = path.resolve(options.baseDir ?? currentRuntimeLayout().dirs.apis);
133
- this.legacyDir = options.legacyDir ? path.resolve(options.legacyDir) : null;
134
130
  this.now = options.now ?? Date.now;
135
131
  }
136
132
 
@@ -240,7 +236,7 @@ export class ApiRegistryStore {
240
236
 
241
237
  private names(): string[] {
242
238
  const names = new Set<string>(this.cache.keys());
243
- for (const dir of this.legacyDir === null ? [this.baseDir] : [this.baseDir, this.legacyDir]) {
239
+ for (const dir of [this.baseDir]) {
244
240
  if (!fs.existsSync(dir)) continue;
245
241
  for (const file of fs.readdirSync(dir)) {
246
242
  if (!file.endsWith('.json')) continue;
@@ -278,7 +274,7 @@ export class ApiRegistryStore {
278
274
 
279
275
  private save(name: string, record: ApiRecord): void {
280
276
  fs.mkdirSync(this.baseDir, { recursive: true });
281
- const filePath = this.writeFileOf(name);
277
+ const filePath = this.fileOf(name);
282
278
  writeFileAtomic(filePath, `${JSON.stringify(record, null, 2)}\n`);
283
279
  const stamp = this.stampOf(filePath);
284
280
  if (stamp !== null) {
@@ -306,19 +302,7 @@ export class ApiRegistryStore {
306
302
  }
307
303
  }
308
304
 
309
- /** 读路径:新目录有就用新的;否则旧目录有就只读回退(报一次诊断) */
310
305
  private fileOf(name: string): string {
311
- const current = path.join(this.baseDir, `${name}.json`);
312
- if (this.legacyDir === null || fs.existsSync(current)) return current;
313
- const legacy = path.join(this.legacyDir, `${name}.json`);
314
- if (fs.existsSync(legacy)) {
315
- warnRuntimeLegacyDirOnce('apis', this.legacyDir);
316
- return legacy;
317
- }
318
- return current;
319
- }
320
-
321
- private writeFileOf(name: string): string {
322
306
  return path.join(this.baseDir, `${name}.json`);
323
307
  }
324
308
  }
@@ -509,14 +493,10 @@ function normalizePageParam(value: unknown): number | undefined {
509
493
 
510
494
  let sharedStore: ApiRegistryStore | undefined;
511
495
 
512
- /** 共享实例:目录由 runtime 根解析(缺省 `<runtime 根>/registry/apis`);旧环境变量 SOMA_API_REGISTRY_DIR 作别名;旧位置有数据时只读回退 */
496
+ /** 共享实例:目录由 runtime 根解析(缺省 `<runtime 根>/registry/apis`) */
513
497
  export function getApiRegistryStore(): ApiRegistryStore {
514
498
  if (sharedStore === undefined) {
515
- const layout = currentRuntimeLayout();
516
- sharedStore = new ApiRegistryStore({
517
- baseDir: layout.dirs.apis,
518
- legacyDir: firstLegacyDirWithData(layout, 'apis') ?? undefined,
519
- });
499
+ sharedStore = new ApiRegistryStore({ baseDir: currentRuntimeLayout().dirs.apis });
520
500
  }
521
501
  return sharedStore;
522
502
  }
@@ -32,7 +32,7 @@ import fs from 'node:fs';
32
32
  import path from 'node:path';
33
33
  import { createHash } from 'node:crypto';
34
34
  import { writeFileAtomic } from './registry-file-lock';
35
- import { currentRuntimeLayout, firstLegacyDirWithData, warnRuntimeLegacyDirOnce } from '../runtime-space/root';
35
+ import { currentRuntimeLayout } from '../runtime-space/root';
36
36
  import { SOMA_PIPELINE_LIMITS } from '../../shared/registry-generated/limits';
37
37
 
38
38
  /** 摘要算法。只增不改:换算法要新起前缀,老摘要仍按老前缀能读回来。 */
@@ -160,24 +160,13 @@ export function assetRelativePath(digest: string): string {
160
160
  /** 共享文件系统资产库。写用原子落盘(临时文件 + rename),写一半被杀不留半个对象。 */
161
161
  export class FileRegistryAssetStore implements RegistryAssetStore {
162
162
  private readonly baseDir: string;
163
- private readonly legacyDir: string | null;
164
163
 
165
- /** `legacyDir`:旧位置,只读回退(新目录里没有该摘要而旧目录有时读旧文件并报一次 CORE-RUNTIME-LEGACY-DIR);写入永远落新目录 */
166
- constructor(baseDir: string, options: { readonly legacyDir?: string } = {}) {
164
+ constructor(baseDir: string) {
167
165
  this.baseDir = path.resolve(baseDir);
168
- this.legacyDir = options.legacyDir ? path.resolve(options.legacyDir) : null;
169
166
  }
170
167
 
171
- /** 读用路径:新目录有就用新的;否则旧目录有就回退 */
172
168
  private readablePath(digest: string): string {
173
- const current = path.join(this.baseDir, assetRelativePath(digest));
174
- if (this.legacyDir === null || this.sizeOf(current) !== null) return current;
175
- const legacy = path.join(this.legacyDir, assetRelativePath(digest));
176
- if (this.sizeOf(legacy) !== null) {
177
- warnRuntimeLegacyDirOnce('assets', this.legacyDir);
178
- return legacy;
179
- }
180
- return current;
169
+ return path.join(this.baseDir, assetRelativePath(digest));
181
170
  }
182
171
 
183
172
  directory(): string {
@@ -310,11 +299,7 @@ let sharedStore: RegistryAssetStore | undefined;
310
299
  /**
311
300
  * 缺省资产目录。
312
301
  *
313
- * 取 `SOMA_REGISTRY_ASSET_DIR`;没配就取**页面目录的同级 `assets`**(页面目录显式设置时),
314
- * 再没有就是 `<runtime 根>/registry/assets`。
315
- * 为什么要跟着页面目录走:宿主把 `SOMA_PAGE_REGISTRY_DIR` 挪到共享卷上,资产若仍落在
316
- * 进程本地目录,表现是"发布成功、钉子有摘要、另一个实例对账时说字节不在库中"——
317
- * 而那台机器上确实不在。两份存储必须一起挪,所以缺省就绑在一起。
302
+ * 固定为 `<runtime 根>/registry/assets`;页面与资产同在 runtime 根下,换到共享卷时设 `SOMA_RUNTIME_DIR` 一起挪。
318
303
  *
319
304
  * **页面走对象存储 CAS 的部署必须显式换库**:那条路径
320
305
  * (`ConditionalPageRegistryRepository`)的页面数据在对象存储里,而这里的缺省后端是
@@ -329,10 +314,7 @@ export function defaultRegistryAssetDir(): string {
329
314
  /** 共享资产库(缺省文件后端;目录见 `defaultRegistryAssetDir`) */
330
315
  export function getRegistryAssetStore(): RegistryAssetStore {
331
316
  if (sharedStore === undefined) {
332
- const layout = currentRuntimeLayout();
333
- sharedStore = new FileRegistryAssetStore(layout.dirs.assets, {
334
- legacyDir: firstLegacyDirWithData(layout, 'assets') ?? undefined,
335
- });
317
+ sharedStore = new FileRegistryAssetStore(currentRuntimeLayout().dirs.assets);
336
318
  }
337
319
  return sharedStore;
338
320
  }
@@ -10,7 +10,7 @@ import {
10
10
  normalizeDeclaration,
11
11
  isTreeDeclaration,
12
12
  normalizePublishOptions,
13
- normalizeStoredRecord,
13
+ assertStoredRecord,
14
14
  PageArchiveSourceMovedError,
15
15
  planRollbackForTarget,
16
16
  PageBaseVersionConflictError,
@@ -24,7 +24,6 @@ import {
24
24
  type PageRegistryListResult,
25
25
  type PageRegistryMeta,
26
26
  type PageRegistryPublishOptions,
27
- type PageRegistryStatus,
28
27
  type PageRegistryWriteOptions,
29
28
  type PageVersionRecord,
30
29
  } from './page-registry-store';
@@ -54,8 +53,7 @@ const AGGREGATE_SCHEMA_VERSION = 1;
54
53
  const MAX_ARCHIVE_PIN_ATTEMPTS = SOMA_PIPELINE_LIMITS.retry.archivePinAttempts;
55
54
 
56
55
  /**
57
- * 单页聚合对象。schemaVersion=1 与迁移前同构:旧数据里可能带 gray 字段
58
- * (灰度能力已随 REQ-002 删除),读入时原样忽略,不迁移、不报错。
56
+ * 单页聚合对象。
59
57
  */
60
58
  interface PageAggregate {
61
59
  schemaVersion: 1;
@@ -79,7 +77,7 @@ export interface PageRegistryRepository {
79
77
  publish(
80
78
  name: string,
81
79
  declaration: unknown,
82
- options?: PageRegistryStatus | PageRegistryPublishOptions,
80
+ options?: PageRegistryPublishOptions,
83
81
  ): Promise<PublishResult>;
84
82
  get(name: string, version?: number): Promise<PageVersionRecord>;
85
83
  list(options?: PageRegistryListOptions): Promise<PageRegistryListResult>;
@@ -99,11 +97,10 @@ export interface PageRegistryRepository {
99
97
  * 与静态页 / 表内固定页 / 注入页同址在落库之前拒收(409 `PAGE_WRITE_CONFLICT`,文案带 `CORE-RUNTIME-ADDRESS-*`)。
100
98
  * draft 不对外服务,不判。
101
99
  */
102
- function gatePublishAddress(name: string, options: PageRegistryStatus | PageRegistryPublishOptions): void {
103
- const resolved = typeof options === 'string' ? { status: options } : options;
100
+ function gatePublishAddress(name: string, options: PageRegistryPublishOptions): void {
104
101
  assertRegistryPublishAddress(name, {
105
- ...('address' in resolved && resolved.address !== undefined ? { address: resolved.address } : {}),
106
- ...(resolved.status !== undefined ? { status: resolved.status } : {}),
102
+ ...('address' in options && options.address !== undefined ? { address: options.address } : {}),
103
+ ...(options.status !== undefined ? { status: options.status } : {}),
107
104
  });
108
105
  }
109
106
 
@@ -170,7 +167,7 @@ export class FilePageRegistryRepository implements PageRegistryRepository {
170
167
  async publish(
171
168
  name: string,
172
169
  declaration: unknown,
173
- options: PageRegistryStatus | PageRegistryPublishOptions = {},
170
+ options: PageRegistryPublishOptions = {},
174
171
  ): Promise<PublishResult> {
175
172
  const safeName = assertPageName(name);
176
173
  gatePublishAddress(safeName, options);
@@ -335,7 +332,7 @@ export class ConditionalPageRegistryRepository implements PageRegistryRepository
335
332
  async publish(
336
333
  name: string,
337
334
  declaration: unknown,
338
- options: PageRegistryStatus | PageRegistryPublishOptions = {},
335
+ options: PageRegistryPublishOptions = {},
339
336
  ): Promise<PublishResult> {
340
337
  const safeName = assertPageName(name);
341
338
  const normalizedOptions = normalizePublishOptions(options);
@@ -753,11 +750,10 @@ function parseAggregate(text: string, key: string): PageAggregate {
753
750
  if (raw.schemaVersion !== 1 || typeof raw.name !== 'string' || !Array.isArray(raw.versions)) {
754
751
  throw new Error(`[PageRegistryRepository] 聚合对象结构无效:${key}`);
755
752
  }
756
- // 旧数据可能带 gray 字段(灰度已删),原样丢弃即可,版本数组不受影响
757
753
  return {
758
754
  schemaVersion: 1,
759
755
  name: raw.name,
760
- versions: (raw.versions as Array<Record<string, unknown>>).map(normalizeStoredRecord),
756
+ versions: (raw.versions as Array<Record<string, unknown>>).map(assertStoredRecord),
761
757
  };
762
758
  }
763
759
 
@@ -11,11 +11,10 @@
11
11
  // 缺省 list 消失、缺省 get 404,但全部历史仍可按版本查;rollback 旧版即恢复上架);
12
12
  // - 页面元数据 meta(title/描述/来源需求文本/建议路由)随版本记录存储;
13
13
  // - declaration 只接受 HTML + 一份统一 SOMA DSL;事件、状态样式与数据对象均内嵌;
14
- // - 多应用租户预留:记录带 app(应用命名空间,缺省 'default')与 tags,
15
- // P-C 多应用来时存量数据零迁移;
14
+ // - 多应用租户预留:记录带 app(应用命名空间,缺省 'default')与 tags;
16
15
  // - list 走分页协议 { pages, total },支持 app / 关键词过滤与 limit/offset;
17
16
  // - 审计预留:写操作可带 operator(操作者标识),P-C 审计日志直接取用;
18
- // - 向后兼容:存量 JSON(无 app/tags/meta 的旧记录)读入时自动归一化补缺省值。
17
+ // - 读盘记录必须完整:缺字段直接报错(`assertStoredRecord`),不补缺省值。
19
18
 
20
19
  import { isStandardDeclaration, normalizeDeclarationAssets, normalizeSourceAttachment, type PageDeclarationAssets, type PageSourceAttachment } from './standard-product';
21
20
  import fs from 'node:fs';
@@ -46,11 +45,7 @@ import type { UiConfig } from '../../shared/types/ui-config.types';
46
45
  import { withRegistryLock, writeFileAtomic } from './registry-file-lock';
47
46
  import { RegistryError } from './registry-error';
48
47
  import path from 'node:path';
49
- import {
50
- currentRuntimeLayout,
51
- firstLegacyDirWithData,
52
- warnRuntimeLegacyDirOnce,
53
- } from '../runtime-space/root';
48
+ import { currentRuntimeLayout } from '../runtime-space/root';
54
49
  import { scanDeclarationSafety } from './validation/declaration-safety-scan';
55
50
  import { crossCheckDeclaredApis } from './validation/cross-check';
56
51
  import {
@@ -224,12 +219,12 @@ export interface PageVersionRecord {
224
219
  assets?: SomaAssetPin;
225
220
  /**
226
221
  * 编译身份(KC16):产出这份存档产物的编译器身份,不透明字符串,core 只做相等比较。
227
- * 读不到身份时为 `''`(永不相等,失败方向是「不用缓存」);迁移前的存量记录读入时补 `''`。
222
+ * 读不到身份时为 `''`(永不相等,失败方向是「不用缓存」);记录里必须有这个字段。
228
223
  */
229
224
  identity: string;
230
225
  /**
231
226
  * 信封头(KC2 × KC16):存档产物的格式标识、能力声明与本页引用组件摘要,运行兼容判据只读它。
232
- * `null` = 迁移前 / 缺信封头存档(按 2.16a 迁移口径处理)。
227
+ * `null` = 该版本没有信封头(如无已编译产物);字段本身必须在记录里。
233
228
  */
234
229
  envelope: SomaArtifactEnvelopeHead | null;
235
230
  /** 一版本一主题(00e Q-109):回滚重编所需;端口没报主题名则缺席 */
@@ -242,15 +237,14 @@ export interface PageVersionRecord {
242
237
  */
243
238
  staged?: true;
244
239
  /**
245
- * 来源(08c origin;页面级稿 §4.5 扩展):`format` 是来源格式标签,`legacy` = 无声明源的冻结静态快照,回滚原样复制,
246
- * 其余是调用方给的不透明标签(core 只存不解读);缺席 = 有声明源。`author` / `label` 取信封 `source` / `version`。
240
+ * 来源(08c origin;页面级稿 §4.5 扩展):`format` 是调用方给的不透明来源格式标签(core 只存不解读);缺席 = 有声明源。`author` / `label` 取信封 `source` / `version`。
247
241
  */
248
242
  origin?: PageVersionOrigin;
249
- /** 地址(D3):版本所在的 runtime 空间地址。存量记录无此字段,读入时补 `/<名>` */
250
- address?: string;
243
+ /** 地址(D3):版本所在的 runtime 空间地址;记录必须带 */
244
+ address: string;
251
245
  }
252
246
 
253
- /** 版本来源:`format` 是来源格式标签(`legacy` 是存量冻结快照,冻结规则不变;其余由调用方给,core 不解读) */
247
+ /** 版本来源:`format` 是来源格式标签(由调用方给,core 不解读) */
254
248
  export interface PageVersionOrigin {
255
249
  readonly format: string;
256
250
  readonly author?: string;
@@ -258,7 +252,7 @@ export interface PageVersionOrigin {
258
252
  readonly operator?: string;
259
253
  }
260
254
 
261
- /** publish 的可选项(第三参也兼容旧的裸 status 字符串写法) */
255
+ /** publish 的可选项 */
262
256
  export interface PageRegistryPublishOptions {
263
257
  /** 生命周期状态:publish 只接受 published / draft(archived 走 archive()) */
264
258
  status?: Extract<PageRegistryStatus, 'published' | 'draft'>;
@@ -268,7 +262,7 @@ export interface PageRegistryPublishOptions {
268
262
  operator?: string;
269
263
  /** 本次发布所用主题名(Host 告知;端口在身份分量里报告的主题名优先级更低) */
270
264
  themeName?: string;
271
- /** 版本来源(页面级稿 §4.5):缺省无;legacy 冻结规则不受影响 */
265
+ /** 版本来源(页面级稿 §4.5):缺省无 */
272
266
  origin?: PageVersionOrigin;
273
267
  /** 版本地址(D3):缺省 `/<名>`;非缺省时必须是合法的精确 / 模式地址,且通过地址冲突闸门 */
274
268
  address?: string;
@@ -299,7 +293,7 @@ export interface PageVersionFields {
299
293
  /** 批量发布批次号(KC19);给了这条记录带 `staged` 标记,批次提交后才对读路径可见 */
300
294
  batchId?: string;
301
295
  /**
302
- * 回滚复用 / legacy 原样复制:存档产物逐字节搬到新版本,不调编译端口、不重做预编译
296
+ * 回滚复用:存档产物逐字节搬到新版本,不调编译端口、不重做预编译
303
297
  * (新版本的 `compiled` / `identity` / `envelope` 与目标版本相等)。
304
298
  */
305
299
  archive?: {
@@ -393,11 +387,6 @@ export interface PageRegistryStoreOptions {
393
387
  treeContextResolver?: (name: string, app: string) => TreeCompileContext | undefined;
394
388
  /** 持久化目录(每页面一个 <name>.json),默认 `<runtime 根>/registry/pages`(经 `currentRuntimeLayout` 解析) */
395
389
  baseDir?: string;
396
- /**
397
- * 旧位置(只读回退):新目录里没有该页面文件、旧目录有时读旧文件并报一次 CORE-RUNTIME-LEGACY-DIR;
398
- * 写入永远落新目录(带上旧文件的全部历史,等于按页迁移)。旧目录自身不被改动。
399
- */
400
- legacyDir?: string;
401
390
  /** 时钟注入点,默认 Date.now;测试传确定性时钟 */
402
391
  now?: () => number;
403
392
  }
@@ -405,7 +394,6 @@ export interface PageRegistryStoreOptions {
405
394
  export class PageRegistryStore {
406
395
  private readonly treeContextResolver: NonNullable<PageRegistryStoreOptions['treeContextResolver']>;
407
396
  private readonly baseDir: string;
408
- private readonly legacyDir: string | null;
409
397
  private readonly now: () => number;
410
398
  /**
411
399
  * 内存缓存:页面名 → { 版本数组, 落盘指纹 }。
@@ -418,7 +406,6 @@ export class PageRegistryStore {
418
406
 
419
407
  constructor(options: PageRegistryStoreOptions = {}) {
420
408
  this.baseDir = path.resolve(options.baseDir ?? currentRuntimeLayout().dirs.pages);
421
- this.legacyDir = options.legacyDir ? path.resolve(options.legacyDir) : null;
422
409
  this.now = options.now ?? Date.now;
423
410
  this.treeContextResolver = options.treeContextResolver ?? ((name, app) => (
424
411
  resolveHostTreeCompileContext(process.env.SOMA_HOST_DIR, { pageBase: name, app })
@@ -436,12 +423,12 @@ export class PageRegistryStore {
436
423
 
437
424
  /**
438
425
  * 发布一个新版本(版本号自增),返回新版本记录。
439
- * 第三参兼容两种写法:裸 status 字符串(旧调用姿势)或选项对象(元数据 / app / tags / operator)。
426
+ * 第三参是选项对象(status / 元数据 / app / tags / operator)。
440
427
  */
441
428
  publish(
442
429
  name: string,
443
430
  declaration: unknown,
444
- options: PageRegistryStatus | PageRegistryPublishOptions = {},
431
+ options: PageRegistryPublishOptions = {},
445
432
  ): PageVersionRecord {
446
433
  const safeName = assertPageName(name);
447
434
  return withRegistryLock(this.baseDir, safeName, () =>
@@ -451,7 +438,7 @@ export class PageRegistryStore {
451
438
  publishWhileLocked(
452
439
  name: string,
453
440
  declaration: unknown,
454
- options: PageRegistryStatus | PageRegistryPublishOptions = {},
441
+ options: PageRegistryPublishOptions = {},
455
442
  ): PageVersionRecord {
456
443
  const safeName = assertPageName(name);
457
444
  const normalizedOptions = normalizePublishOptions(options);
@@ -693,7 +680,7 @@ export class PageRegistryStore {
693
680
  */
694
681
  list(options: PageRegistryListOptions = {}): PageRegistryListResult {
695
682
  const names = new Set<string>(this.cache.keys());
696
- for (const dir of this.legacyDir === null ? [this.baseDir] : [this.baseDir, this.legacyDir]) {
683
+ for (const dir of [this.baseDir]) {
697
684
  if (!fs.existsSync(dir)) continue;
698
685
  for (const file of fs.readdirSync(dir)) {
699
686
  if (file.endsWith('.json')) {
@@ -913,7 +900,7 @@ export class PageRegistryStore {
913
900
  }
914
901
  }
915
902
 
916
- /** 读一个页面的全部版本:指纹未变才用缓存,否则读盘、归一化(兼容旧文件)并入缓存 */
903
+ /** 读一个页面的全部版本:指纹未变才用缓存,否则读盘、核对记录完整性并入缓存 */
917
904
  private load(name: string): PageVersionRecord[] {
918
905
  const filePath = this.fileOf(name);
919
906
  const stamp = this.stampOf(filePath);
@@ -932,7 +919,7 @@ export class PageRegistryStore {
932
919
  return versions;
933
920
  }
934
921
 
935
- /** 读盘 + 解析 + 归一化(兼容旧格式)。不碰任何缓存,由调用方决定放哪 */
922
+ /** 读盘 + 解析 + 核对记录完整性。不碰任何缓存,由调用方决定放哪 */
936
923
  private parseVersionsFile(filePath: string): PageVersionRecord[] {
937
924
  const raw = fs.readFileSync(filePath, 'utf8');
938
925
  let parsed: unknown;
@@ -946,9 +933,8 @@ export class PageRegistryStore {
946
933
  if (!Array.isArray(parsed)) {
947
934
  throw new Error(`[PageRegistryStore] 声明文件损坏(应为版本数组):${filePath}`);
948
935
  }
949
- // 向后兼容:旧记录没有 app/tags/meta,读入时补缺省值(app='default'、tags=[])
950
936
  return (parsed as Array<Record<string, unknown>>).map(
951
- (record) => normalizeStoredRecord(record),
937
+ (record) => assertStoredRecord(record),
952
938
  );
953
939
  }
954
940
 
@@ -1029,7 +1015,7 @@ export class PageRegistryStore {
1029
1015
  /** 写穿:原子落盘(临时文件 + rename)再刷新缓存;写一半被杀不会留下半个 JSON */
1030
1016
  private save(name: string, versions: PageVersionRecord[]): void {
1031
1017
  fs.mkdirSync(this.baseDir, { recursive: true });
1032
- const filePath = this.writeFileOf(name);
1018
+ const filePath = this.fileOf(name);
1033
1019
  writeFileAtomic(filePath, `${JSON.stringify(versions, null, 2)}\n`);
1034
1020
  const stamp = this.stampOf(filePath);
1035
1021
  if (stamp !== null) {
@@ -1038,20 +1024,7 @@ export class PageRegistryStore {
1038
1024
  }
1039
1025
  }
1040
1026
 
1041
- /** 读路径:新目录有就用新的;否则旧目录有就只读回退(报一次 CORE-RUNTIME-LEGACY-DIR);都没有返回新目录路径 */
1042
1027
  private fileOf(name: string): string {
1043
- const current = path.join(this.baseDir, `${name}.json`);
1044
- if (this.legacyDir === null || fs.existsSync(current)) return current;
1045
- const legacy = path.join(this.legacyDir, `${name}.json`);
1046
- if (fs.existsSync(legacy)) {
1047
- warnRuntimeLegacyDirOnce('pages', this.legacyDir);
1048
- return legacy;
1049
- }
1050
- return current;
1051
- }
1052
-
1053
- /** 写路径:永远是新目录 */
1054
- private writeFileOf(name: string): string {
1055
1028
  return path.join(this.baseDir, `${name}.json`);
1056
1029
  }
1057
1030
  }
@@ -1131,12 +1104,14 @@ export function createPageVersionRecord(
1131
1104
  ...(fields.operator ? { operator: fields.operator } : {}),
1132
1105
  // 批量发布:先带 staged 标记落库,批次提交对象写入后读路径才放行(AD-CORE-13)
1133
1106
  ...(fields.batchId !== undefined ? { batchId: fields.batchId, staged: true as const } : {}),
1107
+ // D3:版本带地址,缺省 `/<名>`(单段名与 Registry 根路径页同址);未显式给地址的新版本(含回滚 / 下架墓碑)沿用上一版本的地址
1108
+ address: fields.address ?? versions[versions.length - 1]?.address ?? `/${name}`,
1134
1109
  identity: '',
1135
1110
  envelope: null,
1136
1111
  };
1137
1112
  // 发布路径上闸门已经编过这同一份声明(`fields.compiledPage`),直接复用;
1138
1113
  // rollback(重编分支)/ archive 复制的是旧声明,没有闸门那一次,照旧在这里编。
1139
- // 回滚复用 / legacy 原样复制(`fields.archive`):存档产物逐字节搬过来,不编译。
1114
+ // 回滚复用(`fields.archive`):存档产物逐字节搬过来,不编译。
1140
1115
  const reused = fields.archive;
1141
1116
  const compiled = reused !== undefined
1142
1117
  ? reused.compiled
@@ -1174,12 +1149,8 @@ export function createPageVersionRecord(
1174
1149
  : fields.compiledPage?.envelope ?? compiled?.envelope ?? null;
1175
1150
  const themeName = reused !== undefined ? reused.themeName : fields.themeName ?? fields.compiledPage?.themeName;
1176
1151
  const origin = reused !== undefined ? reused.origin : fields.origin;
1177
- // D3:版本带地址,缺省 `/<名>`(单段名与 Registry 根路径页同址)
1178
- // 未显式给地址的新版本(含回滚 / 下架墓碑)沿用上一版本的地址
1179
- const address = fields.address ?? versions[versions.length - 1]?.address ?? `/${name}`;
1180
1152
  return {
1181
1153
  ...record,
1182
- address,
1183
1154
  identity,
1184
1155
  envelope,
1185
1156
  ...(themeName !== undefined ? { themeName } : {}),
@@ -1243,13 +1214,11 @@ function assertNotPreview(source: Readonly<Record<string, unknown>>, subject: st
1243
1214
  }
1244
1215
  }
1245
1216
 
1246
- /** publish 第三参归一化:裸 status 字符串(旧写法)或选项对象,逐字段校验 */
1217
+ /** publish 第三参归一化:选项对象逐字段校验 */
1247
1218
  export function normalizePublishOptions(
1248
- options: PageRegistryStatus | PageRegistryPublishOptions,
1219
+ options: PageRegistryPublishOptions,
1249
1220
  ): PageRegistryPublishOptions {
1250
- const source: Record<string, unknown> = typeof options === 'string'
1251
- ? { status: options }
1252
- : (options as Record<string, unknown> | null) ?? {};
1221
+ const source: Record<string, unknown> = (options as Record<string, unknown> | null) ?? {};
1253
1222
  if (typeof source !== 'object' || Array.isArray(source)) {
1254
1223
  throw new PageRegistryError(
1255
1224
  PageRegistryErrorCodes.PAGE_DECLARATION_INVALID,
@@ -1568,24 +1537,22 @@ function assertDeclarationSize(declaration: PageRegistryDeclaration): void {
1568
1537
  );
1569
1538
  }
1570
1539
 
1571
- /** 存量 JSON 记录归一化:只补元数据;旧页面语法必须离线迁移,不在读取时自动转换。 */
1572
- export function normalizeStoredRecord(record: Record<string, unknown>): PageVersionRecord {
1573
- const normalized = { ...record } as unknown as PageVersionRecord;
1574
- // 迁移前的存量记录没有编译身份 / 信封头:补「读不到」(身份 '',信封头 null),按 2.16a 迁移口径处理
1575
- if (typeof normalized.identity !== 'string') normalized.identity = '';
1576
- if (normalized.envelope === undefined) normalized.envelope = null;
1577
- // D3:存量记录没有 address,地址等于 `/<名>`
1578
- if (typeof normalized.address !== 'string' || normalized.address === '') normalized.address = `/${normalized.name}`;
1579
- if (typeof normalized.app !== 'string' || !PAGE_APP_PATTERN.test(normalized.app)) {
1580
- normalized.app = 'default';
1581
- }
1582
- if (!Array.isArray(normalized.tags)) {
1583
- normalized.tags = [];
1584
- } else {
1585
- normalized.tags = normalized.tags.filter((tag): tag is string => typeof tag === 'string');
1586
- }
1587
- assertStoredDeclarationCanonical(normalized.declaration);
1588
- return normalized;
1540
+ /**
1541
+ * 读盘记录核对:记录必须完整(`identity` / `envelope` / `address` / `app` / `tags` 都在),缺字段或形状不对直接报错,
1542
+ * 不在读取时补缺省值;旧页面语法同样必须离线迁移,不在读取时自动转换。
1543
+ */
1544
+ export function assertStoredRecord(record: Record<string, unknown>): PageVersionRecord {
1545
+ const where = `${String(record.name)} v${String(record.version)}`;
1546
+ const bad = (field: string, expected: string): never => {
1547
+ throw new Error(`[PageRegistryStore] 存档记录 ${where} 的 ${field} 缺失或形状不对(应为${expected});记录必须完整,请重新发布该页或离线修复该记录`);
1548
+ };
1549
+ if (typeof record.identity !== 'string') bad('identity', '字符串');
1550
+ if (record.envelope === undefined || (record.envelope !== null && typeof record.envelope !== 'object')) bad('envelope', '信封头对象或 null');
1551
+ if (typeof record.address !== 'string' || record.address === '') bad('address', '非空地址字符串');
1552
+ if (typeof record.app !== 'string' || !PAGE_APP_PATTERN.test(record.app)) bad('app', '合法应用名');
1553
+ if (!Array.isArray(record.tags) || record.tags.some((tag) => typeof tag !== 'string')) bad('tags', '字符串数组');
1554
+ assertStoredDeclarationCanonical(record.declaration);
1555
+ return record as unknown as PageVersionRecord;
1589
1556
  }
1590
1557
 
1591
1558
  function assertStoredDeclarationCanonical(declaration: unknown): void {
@@ -1630,16 +1597,11 @@ export function assertPublishableRegionScopes(compiledPage: SomaCompiledPageAsse
1630
1597
  let sharedStore: PageRegistryStore | undefined;
1631
1598
 
1632
1599
  /**
1633
- * 共享实例:目录由 runtime 根解析(缺省 `<host>/.soma/runtime/registry/pages`);
1634
- * 旧环境变量 SOMA_PAGE_REGISTRY_DIR 作别名,优先于新缺省;旧位置有数据时只读回退。
1600
+ * 共享实例:目录由 runtime 根解析(缺省 `<host>/.soma/runtime/registry/pages`)。
1635
1601
  */
1636
1602
  export function getPageRegistryStore(): PageRegistryStore {
1637
1603
  if (sharedStore === undefined) {
1638
- const layout = currentRuntimeLayout();
1639
- sharedStore = new PageRegistryStore({
1640
- baseDir: layout.dirs.pages,
1641
- legacyDir: firstLegacyDirWithData(layout, 'pages') ?? undefined,
1642
- });
1604
+ sharedStore = new PageRegistryStore({ baseDir: currentRuntimeLayout().dirs.pages });
1643
1605
  }
1644
1606
  return sharedStore;
1645
1607
  }
@@ -377,7 +377,7 @@ export function assetSupplyDriftNotice(
377
377
  current: SomaAssetPin | undefined,
378
378
  who: string,
379
379
  ): string | null {
380
- // 上一版来自**存量 JSON**(`normalizeStoredRecord` 不校验 `assets`),里面可以是任何东西。
380
+ // 上一版来自**存档 JSON**(`assertStoredRecord` 不校验 `assets`),里面可以是任何东西。
381
381
  // 这里在发布路径上,一次 `.find is not a function` 会把整次发布变成 500——
382
382
  // 一句诊断绝不能成为写路径的新失败面,所以形状不对一律当"没有钉子"。
383
383
  const before = pickComponentCss(previous);
@@ -508,7 +508,7 @@ export function reconcilePinnedAssets(
508
508
  function driftAdvice(recoverable: boolean, lookupFailure: string | null): string {
509
509
  if (lookupFailure !== null) {
510
510
  return `建议:资产库查询失败(${lookupFailure}),判断不了钉住的字节还在不在——`
511
- + '先修资产库的访问(SOMA_REGISTRY_ASSET_DIR 的权限与挂载,或 setRegistryAssetStore 接的自定义后端),'
511
+ + '先修资产库的访问(runtime 根下 registry/assets 的权限与挂载,或 setRegistryAssetStore 接的自定义后端),'
512
512
  + '再重新对账;在此之前不要据此回退组件库。';
513
513
  }
514
514
  if (recoverable) {
@@ -516,8 +516,7 @@ function driftAdvice(recoverable: boolean, lookupFailure: string | null): string
516
516
  + '并作为这一版的样式表下发;或把组件库回退到与该摘要一致的版本。';
517
517
  }
518
518
  return '建议:钉住的字节**已不在资产库**,这次漂移无法按摘要恢复。'
519
- + '先确认资产目录与页面目录是否同卷'
520
- + '(SOMA_REGISTRY_ASSET_DIR / SOMA_PAGE_REGISTRY_DIR),'
519
+ + '先确认 runtime 根(SOMA_RUNTIME_DIR)下的资产目录与页面目录是否同卷,'
521
520
  + '再把组件库回退到与该摘要一致的版本;此后新发布的版本会重新钉住字节。';
522
521
  }
523
522