soma-core 2.2.5 → 2.2.7

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 (283) hide show
  1. package/README.md +5 -6
  2. package/bin/soma.cjs +2 -2
  3. package/core/build/compiler/flat-page.ts +16 -0
  4. package/core/build/compiler/full-manifest-builder.ts +0 -3
  5. package/core/build/compiler/page-assets.ts +0 -1
  6. package/core/build/compiler/page-closure.ts +245 -0
  7. package/core/build/compiler/page-declaration-compiler.ts +2 -5
  8. package/core/build/compiler/soma-precompile.js +1972 -3312
  9. package/core/build/compiler/soma-precompile.ts +4 -7
  10. package/core/build/component-tree/artifact-codec.ts +4 -8
  11. package/core/build/lsp/soma-declaration.cjs +1 -1
  12. package/core/build/lsp/std-completion.generated.json +3 -3
  13. package/core/client/a11y/a11y-config.ts +2 -1
  14. package/core/client/a11y/dom-id.ts +1 -1
  15. package/core/client/base/SomaHttpClient.ts +11 -3
  16. package/core/client/base/SomaPageRootBase.ts +6 -0
  17. package/core/client/base/defineSomaView.ts +178 -0
  18. package/core/client/base/index.ts +13 -0
  19. package/core/client/base/view-context.ts +328 -0
  20. package/core/client/behavior/adapter-collection.ts +2 -2
  21. package/core/client/compiler/manifest-compiler.ts +5 -36
  22. package/core/client/component/component-definition.types.ts +2 -1
  23. package/core/client/component/component-manager.ts +110 -20
  24. package/core/client/component/structure-adapter.ts +3 -7
  25. package/core/client/container/IContainerAdapter.ts +4 -0
  26. package/core/client/container/SomaContainerAdapter.ts +52 -3
  27. package/core/client/data/data-object-resolver.ts +523 -184
  28. package/core/client/data/data-write-actions.ts +79 -15
  29. package/core/client/data/format-config.ts +3 -1
  30. package/core/client/data/region-scope-port.ts +11 -0
  31. package/core/client/engine/asset-resolver.ts +2 -5
  32. package/core/client/engine/dom-renderer.ts +7 -40
  33. package/core/client/engine/event-engine.ts +29 -108
  34. package/core/client/engine/property-watcher.ts +1 -1
  35. package/core/client/engine/reactive-proxy.ts +78 -17
  36. package/core/client/engine/runtime-builder.ts +0 -14
  37. package/core/client/engine/scope-resolver.ts +18 -0
  38. package/core/client/engine/soma-bootstrap.ts +387 -99
  39. package/core/client/engine/style-binder.ts +49 -106
  40. package/core/client/engine/timer-engine.ts +11 -1
  41. package/core/client/host-bridge/load-host-domain-class.ts +2 -1
  42. package/core/client/infra/http/SomaHttpService.ts +15 -4
  43. package/core/client/infra/i18n/pack-locales.ts +2 -2
  44. package/core/client/infra/notify/DefaultNotifyService.ts +2 -2
  45. package/core/client/mount/domain-rule.ts +7 -3
  46. package/core/client/mount/mount-page.ts +38 -5
  47. package/core/client/mount/types.ts +2 -0
  48. package/core/client/parser/confirm-spec.ts +100 -7
  49. package/core/client/parser/data-config-parser.ts +28 -211
  50. package/core/client/parser/pipeline-parser.ts +16 -60
  51. package/core/client/parser/style-config-parser.ts +101 -95
  52. package/core/client/parser/timer-parser.ts +21 -0
  53. package/core/client/parser/ui-config-parser.ts +64 -12
  54. package/core/client/registry/declaration-renderer.ts +1 -1
  55. package/core/client/render-ports/hide-transition.ts +9 -0
  56. package/core/client/render-ports/index.ts +4 -0
  57. package/core/client/render-ports/notify-renderer.ts +2 -1
  58. package/core/client/runtime/SomaRuntimeServices.ts +2 -1
  59. package/core/client/runtime/SomaSnapshotStore.ts +5 -0
  60. package/core/client/security/url-guard.ts +71 -11
  61. package/core/client/validation/async-check-registry.ts +2 -1
  62. package/core/client/validation/contract-validator.ts +2 -6
  63. package/core/client/validation/field-rules.ts +3 -13
  64. package/core/client/validation/object-rules.ts +2 -10
  65. package/core/index.ts +17 -39
  66. package/core/inspect/check-product.ts +5 -5
  67. package/core/inspect/runtime.ts +2 -1
  68. package/core/server/api/dispatch-service-api.ts +35 -36
  69. package/core/server/api/load-host-service.ts +8 -4
  70. package/core/server/api/paged-list.ts +259 -0
  71. package/core/server/compile-port.ts +1 -1
  72. package/core/server/host/app-config-composer.ts +2 -1
  73. package/core/server/host/empty-host-bootstrap.mjs +3 -0
  74. package/core/server/host/host-assembly-entry.ts +1 -0
  75. package/core/server/host/host-assembly.ts +50 -3
  76. package/core/server/host/host-caller.ts +2 -1
  77. package/core/server/host/host-dir.ts +9 -0
  78. package/core/server/host/host-response-headers.ts +2 -1
  79. package/core/server/host/invoke-host-request-hook.ts +28 -4
  80. package/core/server/host/published-page-assets.ts +2 -1
  81. package/core/server/host/resolve-host-request-hook.ts +25 -7
  82. package/core/server/host/server-page-assets.ts +4 -4
  83. package/core/server/host/source-aliases.cjs +345 -0
  84. package/core/server/host/source-aliases.ts +32 -0
  85. package/core/server/host/source-packages.cjs +1 -0
  86. package/core/server/host/virtual-pages.ts +3 -2
  87. package/core/server/infra/cache/ServerFileCache.ts +83 -10
  88. package/core/server/node.ts +10 -0
  89. package/core/server/registry/api-registry-store.ts +3 -1
  90. package/core/server/registry/declaration-precompiler.ts +0 -2
  91. package/core/server/registry/page-registry-repository.ts +2 -1
  92. package/core/server/registry/page-registry-store.ts +2 -1
  93. package/core/server/registry/registry-error.ts +6 -1
  94. package/core/server/registry/registry-file-lock.ts +296 -23
  95. package/core/server/registry/request-body-limit.ts +3 -2
  96. package/core/server/registry/validation/declaration-safety-scan.ts +151 -27
  97. package/core/server/runtime-space/access-gate.ts +21 -7
  98. package/core/server/runtime-space/bindings.ts +3 -6
  99. package/core/server/runtime-space/dynamic-pages.ts +181 -49
  100. package/core/server/runtime-space/errors.ts +3 -0
  101. package/core/server/runtime-space/inject.ts +78 -16
  102. package/core/server/runtime-space/page-grants.ts +7 -1
  103. package/core/server/runtime-space/resolve.ts +66 -19
  104. package/core/server/runtime-space/store.ts +32 -3
  105. package/core/server/runtime-space/submit-steps.ts +2 -1
  106. package/core/server/runtime-space/types.ts +3 -1
  107. package/core/shared/component-tree-errors.ts +2 -1
  108. package/core/shared/contract-a11y.ts +1 -1
  109. package/core/shared/contract-sections.ts +2 -2
  110. package/core/shared/core-diagnostic-codes.ts +14 -0
  111. package/core/shared/data-declaration-checks.ts +29 -3
  112. package/core/shared/declaration-keys.ts +1 -1
  113. package/core/shared/engines/engine-error.ts +2 -1
  114. package/core/shared/generation-error.ts +2 -1
  115. package/core/shared/page-envelope.ts +1 -1
  116. package/core/shared/pure-binding.ts +88 -0
  117. package/core/shared/registry-generated/diagnostic-registry-index.ts +21 -19
  118. package/core/shared/registry-generated/diagnostic-registry.ts +170 -177
  119. package/core/shared/registry-generated/limits.ts +65 -13
  120. package/core/shared/registry-generated/std-grammar-completion.ts +0 -4
  121. package/core/shared/registry-generated/std-grammar-views.ts +40 -10
  122. package/core/shared/registry-generated/std-grammar.ts +43 -21
  123. package/core/shared/soma-error.ts +36 -0
  124. package/core/shared/types/compile-port.types.ts +1 -1
  125. package/core/shared/types/data-config.types.ts +20 -18
  126. package/core/shared/types/engine.types.ts +0 -3
  127. package/core/shared/types/event.types.ts +10 -11
  128. package/core/shared/types/generation-error.types.ts +5 -1
  129. package/core/shared/types/host-assembly.types.ts +7 -1
  130. package/core/shared/types/manifest.types.ts +0 -3
  131. package/core/shared/types/region-scope.types.ts +5 -1
  132. package/core/shared/types/scope-manifest.types.ts +0 -2
  133. package/core/shared/types/style-config.types.ts +21 -21
  134. package/core/shared/types/ui-config.types.ts +4 -5
  135. package/core/shared/types/watcher.types.ts +1 -1
  136. package/dist/browser/runtime-bundle.manifest.json +11 -13
  137. package/dist/browser/soma-runtime.js +2733 -2712
  138. package/dist/core/index.cjs +5665 -5534
  139. package/dist/host-native/aot-builder.cjs +330 -1
  140. package/dist/host-native/native-server.cjs +5434 -4726
  141. package/dist/lsp/component-tree.cjs +5868 -7040
  142. package/dist/types/build/compiler/full-manifest-builder.d.ts +0 -2
  143. package/dist/types/build/compiler/page-closure.d.ts +21 -0
  144. package/dist/types/build/compiler/page-declaration-compiler.d.ts +2 -4
  145. package/dist/types/build/compiler/soma-precompile.d.ts +1 -3
  146. package/dist/types/build/component-tree/artifact-codec.d.ts +0 -2
  147. package/dist/types/client/a11y/a11y-config.d.ts +2 -1
  148. package/dist/types/client/base/SomaHttpClient.d.ts +1 -1
  149. package/dist/types/client/base/SomaPageRootBase.d.ts +5 -0
  150. package/dist/types/client/base/defineSomaView.d.ts +46 -0
  151. package/dist/types/client/base/index.d.ts +2 -0
  152. package/dist/types/client/base/view-context.d.ts +136 -0
  153. package/dist/types/client/behavior/adapter-collection.d.ts +1 -1
  154. package/dist/types/client/compiler/manifest-compiler.d.ts +0 -3
  155. package/dist/types/client/component/component-definition.types.d.ts +2 -1
  156. package/dist/types/client/component/component-manager.d.ts +29 -0
  157. package/dist/types/client/container/IContainerAdapter.d.ts +3 -0
  158. package/dist/types/client/container/SomaContainerAdapter.d.ts +5 -0
  159. package/dist/types/client/data/data-object-resolver.d.ts +93 -31
  160. package/dist/types/client/data/format-config.d.ts +2 -1
  161. package/dist/types/client/engine/dom-renderer.d.ts +1 -2
  162. package/dist/types/client/engine/event-engine.d.ts +0 -7
  163. package/dist/types/client/engine/reactive-proxy.d.ts +11 -4
  164. package/dist/types/client/engine/runtime-builder.d.ts +0 -4
  165. package/dist/types/client/engine/soma-bootstrap.d.ts +44 -6
  166. package/dist/types/client/engine/style-binder.d.ts +8 -4
  167. package/dist/types/client/host-bridge/load-host-domain-class.d.ts +2 -1
  168. package/dist/types/client/mount/domain-rule.d.ts +2 -0
  169. package/dist/types/client/mount/mount-page.d.ts +2 -1
  170. package/dist/types/client/mount/types.d.ts +2 -0
  171. package/dist/types/client/parser/confirm-spec.d.ts +27 -3
  172. package/dist/types/client/parser/data-config-parser.d.ts +6 -5
  173. package/dist/types/client/parser/style-config-parser.d.ts +7 -3
  174. package/dist/types/client/parser/timer-parser.d.ts +5 -0
  175. package/dist/types/client/parser/ui-config-parser.d.ts +6 -2
  176. package/dist/types/client/render-ports/hide-transition.d.ts +9 -0
  177. package/dist/types/client/render-ports/index.d.ts +4 -0
  178. package/dist/types/client/render-ports/notify-renderer.d.ts +2 -1
  179. package/dist/types/client/runtime/SomaSnapshotStore.d.ts +2 -0
  180. package/dist/types/client/security/url-guard.d.ts +14 -0
  181. package/dist/types/client/validation/async-check-registry.d.ts +2 -1
  182. package/dist/types/client/validation/object-rules.d.ts +0 -5
  183. package/dist/types/index.d.ts +6 -11
  184. package/dist/types/inspect/runtime.d.ts +2 -1
  185. package/dist/types/server/api/dispatch-service-api.d.ts +5 -0
  186. package/dist/types/server/api/load-host-service.d.ts +1 -1
  187. package/dist/types/server/api/paged-list.d.ts +101 -0
  188. package/dist/types/server/compile-port.d.ts +1 -1
  189. package/dist/types/server/host/host-assembly-entry.d.ts +1 -1
  190. package/dist/types/server/host/host-assembly.d.ts +2 -0
  191. package/dist/types/server/host/host-dir.d.ts +2 -0
  192. package/dist/types/server/host/invoke-host-request-hook.d.ts +10 -3
  193. package/dist/types/server/host/published-page-assets.d.ts +2 -1
  194. package/dist/types/server/host/resolve-host-request-hook.d.ts +18 -5
  195. package/dist/types/server/host/server-page-assets.d.ts +2 -1
  196. package/dist/types/server/host/source-aliases.d.cts +53 -0
  197. package/dist/types/server/host/source-aliases.d.ts +30 -0
  198. package/dist/types/server/host/source-packages.d.cts +2 -0
  199. package/dist/types/server/infra/cache/ServerFileCache.d.ts +8 -0
  200. package/dist/types/server/node.d.ts +1 -0
  201. package/dist/types/server/registry/declaration-precompiler.d.ts +0 -1
  202. package/dist/types/server/registry/registry-error.d.ts +5 -1
  203. package/dist/types/server/registry/registry-file-lock.d.ts +30 -0
  204. package/dist/types/server/registry/request-body-limit.d.ts +3 -2
  205. package/dist/types/server/registry/validation/declaration-safety-scan.d.ts +3 -0
  206. package/dist/types/server/runtime-space/access-gate.d.ts +7 -0
  207. package/dist/types/server/runtime-space/bindings.d.ts +3 -2
  208. package/dist/types/server/runtime-space/dynamic-pages.d.ts +6 -1
  209. package/dist/types/server/runtime-space/errors.d.ts +1 -1
  210. package/dist/types/server/runtime-space/resolve.d.ts +2 -0
  211. package/dist/types/server/runtime-space/store.d.ts +8 -1
  212. package/dist/types/server/runtime-space/submit-steps.d.ts +2 -1
  213. package/dist/types/server/runtime-space/types.d.ts +3 -1
  214. package/dist/types/shared/component-tree-errors.d.ts +2 -1
  215. package/dist/types/shared/core-diagnostic-codes.d.ts +1 -1
  216. package/dist/types/shared/declaration-keys.d.ts +1 -1
  217. package/dist/types/shared/engines/engine-error.d.ts +2 -1
  218. package/dist/types/shared/generation-error.d.ts +2 -1
  219. package/dist/types/shared/pure-binding.d.ts +48 -0
  220. package/dist/types/shared/registry-generated/diagnostic-registry.d.ts +149 -158
  221. package/dist/types/shared/registry-generated/limits.d.ts +54 -10
  222. package/dist/types/shared/registry-generated/std-grammar-completion.d.ts +0 -30
  223. package/dist/types/shared/registry-generated/std-grammar-views.d.ts +97 -23
  224. package/dist/types/shared/registry-generated/std-grammar.d.ts +110 -242
  225. package/dist/types/shared/soma-error.d.ts +15 -0
  226. package/dist/types/shared/types/data-config.types.d.ts +17 -17
  227. package/dist/types/shared/types/engine.types.d.ts +0 -3
  228. package/dist/types/shared/types/event.types.d.ts +9 -7
  229. package/dist/types/shared/types/generation-error.types.d.ts +1 -1
  230. package/dist/types/shared/types/host-assembly.types.d.ts +2 -0
  231. package/dist/types/shared/types/manifest.types.d.ts +0 -3
  232. package/dist/types/shared/types/region-scope.types.d.ts +4 -1
  233. package/dist/types/shared/types/scope-manifest.types.d.ts +0 -2
  234. package/dist/types/shared/types/style-config.types.d.ts +17 -19
  235. package/dist/types/shared/types/ui-config.types.d.ts +4 -5
  236. package/host-native/bin/host-native.cjs +22 -1
  237. package/host-native/client/browser-entry.ts +21 -172
  238. package/host-native/src/aot-builder.ts +75 -0
  239. package/host-native/src/host-prepare.ts +39 -5
  240. package/host-native/src/manifest-http.ts +2 -3
  241. package/host-native/src/native-server.ts +812 -174
  242. package/host-native/src/page-http.ts +3 -3
  243. package/host-native/src/public-packages.cjs +0 -1
  244. package/host-native/src/registry-handler.ts +12 -5
  245. package/host-native/src/static-file.ts +203 -53
  246. package/host-native/styles/globals.css +30 -28
  247. package/package.json +14 -2
  248. package/core/client/engine/step-runner.ts +0 -212
  249. package/core/client/engine/trigger-engine.ts +0 -55
  250. package/core/client/format/zoned.ts +0 -10
  251. package/core/client/parser/step-parser.ts +0 -359
  252. package/core/client/parser/trigger-parser.ts +0 -90
  253. package/core/client/parser/value-lang.ts +0 -340
  254. package/core/client/time/instant.ts +0 -2
  255. package/core/shared/calc/coerce.ts +0 -2
  256. package/core/shared/calc/errors.ts +0 -40
  257. package/core/shared/calc/evaluator.ts +0 -113
  258. package/core/shared/calc/index.ts +0 -11
  259. package/core/shared/calc/lexer.ts +0 -189
  260. package/core/shared/calc/parser.ts +0 -193
  261. package/core/shared/calc/typer.ts +0 -171
  262. package/core/shared/date-parts.ts +0 -2
  263. package/core/shared/show-when.ts +0 -77
  264. package/core/shared/types/step.types.ts +0 -91
  265. package/core/shared/types/trigger.types.ts +0 -14
  266. package/dist/types/client/engine/step-runner.d.ts +0 -42
  267. package/dist/types/client/engine/trigger-engine.d.ts +0 -16
  268. package/dist/types/client/format/zoned.d.ts +0 -1
  269. package/dist/types/client/parser/step-parser.d.ts +0 -23
  270. package/dist/types/client/parser/trigger-parser.d.ts +0 -13
  271. package/dist/types/client/parser/value-lang.d.ts +0 -63
  272. package/dist/types/client/time/instant.d.ts +0 -1
  273. package/dist/types/shared/calc/coerce.d.ts +0 -1
  274. package/dist/types/shared/calc/errors.d.ts +0 -14
  275. package/dist/types/shared/calc/evaluator.d.ts +0 -2
  276. package/dist/types/shared/calc/index.d.ts +0 -6
  277. package/dist/types/shared/calc/lexer.d.ts +0 -19
  278. package/dist/types/shared/calc/parser.d.ts +0 -43
  279. package/dist/types/shared/calc/typer.d.ts +0 -11
  280. package/dist/types/shared/date-parts.d.ts +0 -1
  281. package/dist/types/shared/show-when.d.ts +0 -21
  282. package/dist/types/shared/types/step.types.d.ts +0 -76
  283. package/dist/types/shared/types/trigger.types.d.ts +0 -12
@@ -1,3 +1,4 @@
1
+ import { SomaError } from '../../shared/soma-error';
1
2
  /**
2
3
  * 注册中心的错误基类。
3
4
  *
@@ -5,8 +6,11 @@
5
6
  * 响应映射器。给两者一个共同基类,映射器就只需要认识**一种**错误——
6
7
  * 否则每加一张表都要去改一次 `pageRegistryErrorResponse`,漏改的表现是
7
8
  * 业务错误原样抛穿成 500(实测:API 表刚接上时 404 变成了未处理异常)。
9
+ *
10
+ * 同时继承 core 统一错误基类 `SomaError`:按 `instanceof SomaError` 统一处理 / 上报的代码能认出它。
11
+ * 数字码 `code`(45xx)原样保留、仍按数字比较;基类的 `code` 类型已放宽为 `string | number`,这里收窄为 `number`。
8
12
  */
9
- export declare class RegistryError extends Error {
13
+ export declare class RegistryError extends SomaError {
10
14
  readonly code: number;
11
15
  constructor(code: number, message: string);
12
16
  }
@@ -1,3 +1,5 @@
1
+ /** 本进程的 PID 命名空间标识(只读;导出供测试构造锁文件) */
2
+ export declare function getPidNamespaceId(): string;
1
3
  /**
2
4
  * 锁后端注入点。
3
5
  * 默认是本文件的 hardlink 实现;注入点只服务共享文件系统上的互斥测试/替换,
@@ -12,10 +14,38 @@ export declare function setRegistryLockBackend(next: RegistryLockBackend | null)
12
14
  * fn 内部必须**重新从磁盘读**——拿锁的意义就是"从现在起看到的是最新状态"。
13
15
  */
14
16
  export declare function withRegistryLock<T>(baseDir: string, name: string, fn: () => T): T;
17
+ /**
18
+ * 提交前令牌校验:`filePath` 受本线程已登记的锁保护时,重读锁文件核对 token。
19
+ * 锁已被接管或消失 → 打警告并抛 `PAGE_WRITE_CONFLICT`;未在任何锁内、或不受保护则什么都不做。
20
+ * 导出供临界区内不经 `writeFileAtomic` 的写入(如删除)在落盘前调用。
21
+ */
22
+ export declare function assertRegistryLockOwned(filePath: string): void;
23
+ /**
24
+ * 统一陈旧判据(@internal,导出仅供测试;`probe` 可注入以打桩进程探测)。
25
+ * a. ageMs ≥ 阈值 → 陈旧;b. 同机 + 命名空间标识非空且相等 + pid 有效 + 进程已不存在(且不是自己)→ 陈旧;c. 其余不陈旧。
26
+ * `selfNamespace` 可注入「本进程命名空间标识」以便测试。
27
+ */
28
+ export declare function isLockStale(content: string, ageMs: number, probe?: (pid: number) => boolean, selfNamespace?: string): boolean;
29
+ /**
30
+ * 经夺取锁串行化的陈旧锁夺取(@internal,导出仅供测试)。
31
+ * 返回 true = 本轮确有进展(夺取锁/主锁已被移除、已释放或已换新),调用方可重试取主锁;
32
+ * false = 没有进展(夺取锁被别人持有且不陈旧,或陈旧夺取锁/主锁删不掉),调用方应睡眠后再试。
33
+ */
34
+ export declare function tryStealStaleLock(lock: string): boolean;
35
+ /**
36
+ * 原子夺取陈旧锁(@internal,导出仅供测试构造交错)。
37
+ * 调用方应已持有夺取锁;此处的核对/还回是纵深防御。
38
+ * 不直接 unlink(stat 与 unlink 之间别人可能已换上新锁,会误删):
39
+ * 先 rename 到本次独有的 `.stale.<token>`(同目录 rename 原子,多个等待者只有一个成功),
40
+ * 再核对被移走的内容就是当初判定陈旧的那一把;不是则用 link 还回原路径(目标已存在即失败,失败就丢弃)。
41
+ * 任何路径都不留下自己产生的 `.stale.*` 文件。返回值:原路径上的锁是否确已被移走(rename 失败且非 ENOENT 为 false)。
42
+ */
43
+ export declare function stealStaleLock(lock: string, observed: string): boolean;
15
44
  /**
16
45
  * 原子落盘:先写同目录临时文件再 rename。
17
46
  * 直接 writeFileSync 覆盖原文件,进程在写一半时被杀会留下**半个 JSON**——
18
47
  * 那份页面的全部历史版本就此读不出来。rename 在同一文件系统上是原子的。
48
+ * 受已登记写锁保护时,rename 之前先做提交前令牌校验(见文件头「提交前令牌校验」):锁已被接管则删临时文件并抛冲突错误。
19
49
  */
20
50
  export declare function writeFileAtomic(filePath: string, content: string): void;
21
51
  /**
@@ -1,5 +1,6 @@
1
- /** 请求体超限:调用方负责映射成自己域里的错误码 */
2
- export declare class RequestBodyTooLargeError extends Error {
1
+ import { SomaError } from '../../shared/soma-error';
2
+ /** 请求体超限:调用方负责映射成自己域里的错误码(本类不带 `code`,保持原语义;统一基类 SomaError 便于统一识别与上报) */
3
+ export declare class RequestBodyTooLargeError extends SomaError {
3
4
  readonly limitBytes: number;
4
5
  /** 已知的实际大小;分块传输在触发时只知道"已经超过 limit",此时给 null */
5
6
  readonly seenBytes: number | null;
@@ -5,6 +5,9 @@ export interface ScannableDeclaration {
5
5
  eventYaml?: string;
6
6
  styleYaml?: string;
7
7
  }
8
+ /** html 里一律不许出现的标签:脚本、外链、框架与文档级指令 */
9
+ export declare const FORBIDDEN_TAGS: readonly ["script", "iframe", "object", "embed", "base", "link", "meta", "frame", "frameset"];
10
+ export declare const FORBIDDEN_TAG_SET: ReadonlySet<string>;
8
11
  /**
9
12
  * 扫描声明的注入面,返回中文问题清单(空数组 = 通过)。
10
13
  *
@@ -29,6 +29,13 @@ export interface SomaAccessPolicy {
29
29
  readonly grants: readonly SomaHostAssemblyPageGrant[];
30
30
  }
31
31
  export declare const SOMA_OPEN_ACCESS_POLICY: SomaAccessPolicy;
32
+ /** 只给测试用 */
33
+ export declare function resetAccessPolicyReport(): void;
34
+ /**
35
+ * 读访问策略。失败即关闭:装配加载抛错、或宿主的 `defaultAccess()` / `pageGrants()` 抛错时,
36
+ * 不降级为开放,抛受控内部错误(`CORE-RUNTIME-GRANT-INVALID`,500,不带原始异常文本);原始消息只进服务端日志。
37
+ * 没有 hostDir、无 soma.app.ts、未配 `defaultAccess` 仍是开放策略(正常分支)。
38
+ */
32
39
  export declare function readAccessPolicy(hostDir: string | undefined): SomaAccessPolicy;
33
40
  /** 一个绑定适用的全部访问规则(缺省策略、授权下限、信封自带),开放的已滤掉 */
34
41
  export declare function accessRulesOf(binding: Pick<SomaRuntimeBinding, 'address' | 'caller'>, envelope: SomaStandardPageEnvelope | null | undefined, policy: SomaAccessPolicy): readonly SomaAccessRule[];
@@ -1,3 +1,4 @@
1
+ import { currentHostDir } from '../host/host-dir';
1
2
  import { addressShapeKey, compareAddressSpecificity } from '../../shared/runtime-address';
2
3
  import { type SomaAccessIdentity, type SomaAccessPolicy } from './access-gate';
3
4
  import { SomaRuntimeStore } from './store';
@@ -53,8 +54,8 @@ export declare function resetRuntimeSpace(): void;
53
54
  /** 当前进程的 runtime 布局(按环境签名记忆,避免每次调用都读盘) */
54
55
  export declare function runtimeLayout(): SomaRuntimeLayout;
55
56
  export declare function runtimeStore(layout?: SomaRuntimeLayout): SomaRuntimeStore;
56
- /** 宿主根(SOMA_HOST_DIR,缺省不设);静态源与外壳路由只在设了宿主根时参与判定 */
57
- export declare function currentHostDir(): string | undefined;
57
+ /** 宿主根单点实现在 host/host-dir(无依赖,避免底层模块反向引入本文件成环) */
58
+ export { currentHostDir };
58
59
  /** 外壳路由 = 宿主壳经 `registerShellRoutes` 登记的 ∪ 宿主装配声明的 `reservedRoutes`(后者只读已装配完的,不触发加载) */
59
60
  export declare function currentReservedRoutes(): readonly string[];
60
61
  /**
@@ -34,7 +34,7 @@ export interface SomaPageInput {
34
34
  /** 方言交给 core 的已编译产物(与注入入口同一形状) */
35
35
  export type SomaCompiledPage = SomaPageInput;
36
36
  export type SomaPageRegisterOptions = Omit<SomaInjectOptions, 'expectGeneration' | 'fixed' | 'version' | 'owner'> & {
37
- /** 来源类型(必填):`soma-ui` / `soma-lite`(原生页由 core 初始化扫描登记,来源类型 `native`) */
37
+ /** 来源类型(必填):`soma-ui` / `soma-kit`(原生页由 core 初始化扫描登记,来源类型 `native`) */
38
38
  readonly owner: string;
39
39
  /** 覆盖产物自带的 version */
40
40
  readonly version?: string;
@@ -49,7 +49,12 @@ export type SomaDslParseResult = {
49
49
  readonly ok: false;
50
50
  readonly diagnostics: readonly {
51
51
  readonly message: string;
52
+ readonly line?: number;
53
+ readonly column?: number;
52
54
  }[];
55
+ /** YAML 语法错误的位置(1 起始);仅底层异常带 mark 时才有 */
56
+ readonly line?: number;
57
+ readonly column?: number;
53
58
  };
54
59
  /**
55
60
  * 运行期把 core DSL 文本解析成对象(无 fs、无端口、无副作用):四件套都是平铺 YAML,按 YAML 读。
@@ -1,6 +1,6 @@
1
1
  import { type SomaCoreDiagnostic, type SomaCoreDiagnosticCode } from '../../shared/core-diagnostic-codes';
2
2
  import { SomaPageAssetError } from '../host/server-page-assets';
3
- export type SomaRuntimeErrorCode = Extract<SomaCoreDiagnosticCode, 'CORE-RUNTIME-ADDRESS-INVALID' | 'CORE-RUNTIME-ADDRESS-RESERVED' | 'CORE-RUNTIME-ADDRESS-STATIC' | 'CORE-RUNTIME-ADDRESS-CONFLICT' | 'CORE-RUNTIME-ADDRESS-OWNED' | 'CORE-RUNTIME-ADDRESS-MISMATCH' | 'CORE-RUNTIME-ADDRESS-MISSING' | 'CORE-RUNTIME-ADDRESS-EXPIRED' | 'CORE-RUNTIME-GENERATION' | 'CORE-RUNTIME-BATCH' | 'CORE-RUNTIME-GRANT' | 'CORE-RUNTIME-GRANT-INVALID' | 'CORE-RUNTIME-PARAM-INVALID' | 'CORE-RUNTIME-ACCESS-DENIED' | 'CORE-NAV-OVERFLOW' | 'CORE-FORMAT-VERSION-UNSUPPORTED' | 'CORE-FORMAT-VERSION-MISMATCH' | 'CORE-INJECT-NONSTANDARD-KEY' | 'CORE-REG-INPUT-INVALID' | 'CORE-REG-NO-COMPILED-ARTIFACT'>;
3
+ export type SomaRuntimeErrorCode = Extract<SomaCoreDiagnosticCode, 'CORE-RUNTIME-ADDRESS-INVALID' | 'CORE-RUNTIME-ADDRESS-RESERVED' | 'CORE-RUNTIME-ADDRESS-STATIC' | 'CORE-RUNTIME-ADDRESS-CONFLICT' | 'CORE-RUNTIME-ADDRESS-OWNED' | 'CORE-RUNTIME-ADDRESS-MISMATCH' | 'CORE-RUNTIME-ADDRESS-MISSING' | 'CORE-RUNTIME-ADDRESS-EXPIRED' | 'CORE-RUNTIME-GENERATION' | 'CORE-RUNTIME-BATCH' | 'CORE-RUNTIME-GRANT' | 'CORE-RUNTIME-GRANT-INVALID' | 'CORE-RUNTIME-PARAM-INVALID' | 'CORE-RUNTIME-ACCESS-DENIED' | 'CORE-NAV-OVERFLOW' | 'CORE-FORMAT-VERSION-UNSUPPORTED' | 'CORE-FORMAT-VERSION-MISMATCH' | 'CORE-INJECT-NONSTANDARD-KEY' | 'CORE-INJECT-PAGE-LOGIC' | 'CORE-INJECT-PAGE-CLOSURE' | 'CORE-REG-INPUT-INVALID' | 'CORE-REG-NO-COMPILED-ARTIFACT'>;
4
4
  /** 批次里一条失败的原因 */
5
5
  export interface SomaRuntimeBatchFailure {
6
6
  readonly index: number;
@@ -28,6 +28,8 @@ export declare function runtimeSpaceStats(): {
28
28
  readonly bindings: number;
29
29
  readonly pages: ReturnType<ReturnType<typeof runtimeStore>['stats']>;
30
30
  };
31
+ /** 编译结果键 = 摘要 + 页面形态 + core 编译版本 + 编译身份(组件供货 / 设计规则 / 主题指纹)+ 绑定地址(产物带 URL 相关标识,同内容异址不得互相命中);读不到身份就不缓存 */
32
+ export declare function compileKey(digest: string, binding?: SomaRuntimeBinding): string | null;
31
33
  /**
32
34
  * 路由唯一调用点:按地址取页。未命中抛 404 `SOMA_PAGE_NOT_FOUND`;冲突 409;参数类型不合 404;整页编译失败抛 `SomaPublishedPageError`。
33
35
  * 抛出的都是带 `code` / `status` 的错误(`SomaPageAssetError` 子类或 `SomaPublishedPageError`),路由按码回受控响应。
@@ -7,11 +7,12 @@ export declare function resolveRuntimeCacheEntries(raw: string | undefined): num
7
7
  /** 简单 LRU:Map 迭代序即最近使用序(命中时删后重插) */
8
8
  export declare class RuntimeLru<V> {
9
9
  private readonly capacity;
10
+ private readonly onEvict?;
10
11
  private readonly map;
11
12
  private hits;
12
13
  private misses;
13
14
  private evictions;
14
- constructor(capacity: number);
15
+ constructor(capacity: number, onEvict?: ((key: string) => void) | undefined);
15
16
  get(key: string): V | undefined;
16
17
  set(key: string, value: V): void;
17
18
  delete(key: string): boolean;
@@ -31,6 +32,8 @@ export declare class SomaRuntimeStore {
31
32
  private readonly pages;
32
33
  /** 摘要 → 它的编译结果键(只记键,不持有产物) */
33
34
  private readonly compiledKeys;
35
+ /** 编译结果键 → 所属摘要(LRU 淘汰时反查,同步清 compiledKeys) */
36
+ private readonly keyDigest;
34
37
  constructor(dirs: Pick<SomaRuntimeDirs, 'artifacts' | 'bindings' | 'prewarm'>, options?: {
35
38
  readonly cacheEntries?: number;
36
39
  });
@@ -44,6 +47,8 @@ export declare class SomaRuntimeStore {
44
47
  hasArtifact(digest: string): boolean;
45
48
  /** 记下某摘要产出的编译结果键,供按 URL 替换 / 撤下时一并作废 */
46
49
  trackCompiled(digest: string, key: string): void;
50
+ /** LRU 淘汰 / 作废一个编译键后,同步从 compiledKeys 摘掉它(Set 空了连摘要条目一起删) */
51
+ private forgetCompiledKey;
47
52
  /** 绑定表装入后丢弃 L1 里的旧摘要(源变化即失效),连同该摘要的编译结果 */
48
53
  evictDigest(digest: string): void;
49
54
  stats(): {
@@ -56,6 +61,8 @@ export declare class SomaRuntimeStore {
56
61
  /** 其他进程改过该绑定文件吗(mtime 比对);文件不在也算变了(被解绑) */
57
62
  bindingChanged(address: string, lastMtimeMs: number | null): boolean;
58
63
  removeBinding(address: string): boolean;
64
+ /** 严格删除:文件本来就不在返回 false(视为成功);其他失败(权限 / IO)原样抛出,不吞 */
65
+ removeBindingStrict(address: string): boolean;
59
66
  /** 读 `bindings/` 下全部绑定(启动装入用);损坏文件跳过 */
60
67
  listBindings(): readonly SomaBindingRead[];
61
68
  readPrewarmIndex(): SomaPrewarmIndex;
@@ -1,8 +1,9 @@
1
+ import { SomaError } from '../../shared/soma-error';
1
2
  import { type ProvenanceCheckOptions } from '../../page-target/provenance';
2
3
  import type { SomaGrantDecision } from './page-grants';
3
4
  import type { SomaPageBindingView, SomaPageRegisterRequest, SomaProvenanceLedger, SomaRuntimeBinding, SomaStandardPage, SomaSubmitAddressKind, SomaSubmitStepIssue, SomaSubmitStepsRuntime } from './types';
4
5
  /** 步骤拒收:三段式 + 位置;message = `situation:problem` */
5
- export declare class SomaSubmitStepError extends Error implements SomaSubmitStepIssue {
6
+ export declare class SomaSubmitStepError extends SomaError implements SomaSubmitStepIssue {
6
7
  readonly code: string;
7
8
  readonly situation: string;
8
9
  readonly problem: string;
@@ -70,7 +70,7 @@ export interface SomaRuntimeBinding {
70
70
  /** D6:不透明来源标记;无则 null */
71
71
  readonly source: SomaRuntimeSource | null;
72
72
  /**
73
- * URL 注册表的来源类型:一个 URL 只挂一个来源类型(`native` / `soma-ui` / `soma-lite`)。
73
+ * URL 注册表的来源类型:一个 URL 只挂一个来源类型(`native` / `soma-ui` / `soma-kit`)。
74
74
  * 同类型再注册 = 覆盖;不同类型 = 冲突(保留先挂的,注册日志记 error);撤下只能同类型。同类型内部的重复由来源自己处理。旧绑定与 Registry 绑定无此字段。
75
75
  */
76
76
  readonly owner?: string;
@@ -99,6 +99,8 @@ export interface SomaInjectOptions {
99
99
  readonly expiresAt?: number;
100
100
  /** D6:不透明来源标记 */
101
101
  readonly source?: SomaRuntimeSource;
102
+ /** 页面 `domain:` 指向的展示对象类由 Host 浏览器侧的 `pageRoots` 类表提供(方言所有者声明):注入期不再提示 CORE-RUNTIME-DOMAIN-STATIC-ONLY */
103
+ readonly domainProvided?: boolean;
102
104
  }
103
105
  /** D6:批量注入的一条 */
104
106
  export interface SomaInjectManyEntry {
@@ -1,3 +1,4 @@
1
+ import { SomaError } from './soma-error';
1
2
  import type { SourceSpan } from './types/component-tree.types';
2
3
  export type ComponentTreeErrorCode = 'CT-SYNTAX-ROOT' | 'CT-SYNTAX-ELEMENT' | 'CT-SYNTAX-CLOSE' | 'CT-SYNTAX-ATTRIBUTE' | 'CT-IDENTITY-ID' | 'CT-IDENTITY-HOST' | 'CT-REGISTRY-CONTEXT' | 'CT-REGISTRY-COMPONENT' | 'CT-POLICY-COMPONENT' | 'CT-SLOT-CONTRACT' | 'CT-STRUCTURE-MOUNT' | 'CT-BINDING-SCOPE' | 'CT-BINDING-DUPLICATE' | 'CT-REPEAT-SOURCE' | 'CT-REPEAT-KEY' | 'CT-LIMIT' | 'CT-LAYOUT-PARENT' | 'CT-ARTIFACT-VERSION' | 'CT-ARTIFACT-CAPABILITY' | 'CT-ARTIFACT-INCOMPLETE' | 'CT-SYNTAX-LEAK' | 'CT-MIGRATION-UNSAFE';
3
4
  export interface ComponentTreeDiagnostic {
@@ -14,7 +15,7 @@ export interface ComponentTreeDiagnostic {
14
15
  fixHint?: string;
15
16
  }
16
17
  /** Stable, serializable diagnostics without retaining the page source or context. */
17
- export declare class SomaComponentTreeError extends Error {
18
+ export declare class SomaComponentTreeError extends SomaError {
18
19
  readonly code: ComponentTreeErrorCode;
19
20
  readonly diagnostic: Readonly<ComponentTreeDiagnostic>;
20
21
  constructor(diagnostic: ComponentTreeDiagnostic);
@@ -1,6 +1,6 @@
1
1
  import type { ComponentTreeErrorCode } from './component-tree-errors';
2
2
  import type { SomaGenerationErrorShape, SomaGenerationLayer } from './types/generation-error.types';
3
- export declare const SOMA_CORE_DIAGNOSTIC_CODES: readonly ["CORE-PORT-MISSING", "CORE-PORT-CONFLICT", "CORE-PORT-LEGACY-PACK", "CORE-PORT-IDENTITY-DRIFT", "CORE-PORT-RECOMPILE", "CORE-PORT-PURPOSE", "CORE-STYLE-INVALID", "CORE-HOOK-UNCOMPILED", "CORE-SHELL-SLOT", "CORE-CONTRACT-SHAPE", "CORE-CONTRACT-DEFAULTS", "CORE-LINKAGE-DUPLICATE", "CORE-OBSERVE-FAILED", "CORE-OBSERVE-OFF", "CORE-RUNTIME-ERROR", "CORE-RUNTIME-ROOT-INVALID", "CORE-RUNTIME-ROOT-UNSET", "CORE-FORMAT-VERSION-UNSUPPORTED", "CORE-FORMAT-VERSION-MISMATCH", "CORE-INJECT-NONSTANDARD-KEY", "CORE-RUNTIME-ADDRESS-INVALID", "CORE-RUNTIME-ADDRESS-RESERVED", "CORE-RUNTIME-ADDRESS-STATIC", "CORE-RUNTIME-ADDRESS-CONFLICT", "CORE-RUNTIME-ADDRESS-OWNED", "CORE-RUNTIME-ADDRESS-MISMATCH", "CORE-RUNTIME-ADDRESS-MISSING", "CORE-RUNTIME-ADDRESS-EXPIRED", "CORE-RUNTIME-GENERATION", "CORE-RUNTIME-PROVENANCE", "CORE-RUNTIME-GRANT", "CORE-RUNTIME-GRANT-INVALID", "CORE-RUNTIME-BATCH", "CORE-RUNTIME-PARAM-INVALID", "CORE-RUNTIME-ACCESS-DENIED", "CORE-NAV-PARENT-MISSING", "CORE-NAV-OVERFLOW", "CORE-NAV-BACK-INVALID", "CORE-RUNTIME-DOMAIN-STATIC-ONLY", "CORE-RUNTIME-MOUNT", "CORE-ADAPTER-EMIT", "CORE-ADAPTER-DEFINE", "CORE-DATA-FORBIDDEN", "CORE-DATA-RELATION", "CORE-DATA-REQUIRE", "CORE-LOCALE-UNKNOWN", "CORE-ENGINE-LOAD", "CORE-ENGINE-ADAPTER", "CORE-STYLE-ENGINE-CANDIDATE", "CORE-STYLE-ENGINE-THEME", "CORE-STYLE-ENGINE-COMPILE", "CORE-BEHAVIOR-MACHINE-UNKNOWN", "CORE-BEHAVIOR-LAYER-DETACHED", "CORE-BEHAVIOR-MACHINE-CONFLICT", "CORE-TABLE-COLUMN", "CORE-TABLE-STATE", "CORE-VIRTUAL-SCROLLER", "CORE-CHART-KIND-UNKNOWN", "CORE-CHART-THEME", "CORE-CHART-OPTION", "CORE-TEMPORAL-PARSE", "CORE-TEMPORAL-NOT-READY", "CORE-TEMPORAL-ZONE", "CORE-DND-SPEC", "CORE-ALGO-DIFF-INPUT", "CORE-ALGO-QR-CAPACITY", "CORE-ASYNC-CHECK-TABLE", "CORE-ASYNC-CHECK-UNREGISTERED", "CORE-TOAST-CONFIG", "CORE-FORMAT-LOCALE", "CORE-FORMAT-TIMEZONE", "CORE-FORMAT-CONFIG", "CORE-BEHAVIOR-DECL", "CORE-A11Y-DECL", "CORE-OVERLAY-DECL", "CORE-KEYBOARD-DECL", "CORE-BEHAVIOR-COLLECTION-MISMATCH", "CORE-BEHAVIOR-MACHINE-MISMATCH", "CORE-KEYBOARD-MISSING", "CORE-KEYBOARD-GRID-COLUMNS", "CORE-KEYBOARD-INEFFECTIVE", "CORE-KEYBOARD-UNWIRED", "CORE-A11Y-CONFIG", "CORE-A11Y-OVERLAY-NO-DISMISS", "CORE-A11Y-ROLE-KEYBOARD-MISMATCH", "CORE-A11Y-ROLE-OVERLAY", "CORE-A11Y-ROLE-LANDMARK-CONFLICT", "CORE-A11Y-LANDMARK-NAME-SOURCE", "CORE-A11Y-LANDMARK-UNNAMED", "CORE-A11Y-LANDMARK-DUPLICATE-NAME", "CORE-LOCALE-PACK-SHAPE", "CORE-LOCALE-PACK-LOCALE", "CORE-LOCALE-PACK-POSITION", "CORE-LOCALE-PACK-VALUE", "CORE-SCOPES-CONFLICT", "CORE-FRAGMENTS-CONFLICT", "CORE-ANCHOR-DUPLICATE", "CORE-REG-INPUT-INVALID", "CORE-REG-NO-COMPILED-ARTIFACT", "CORE-CHECK-BLOCKS", "CORE-CHECK-DIALECT", "CORE-CHECK-DATA", "CORE-CHECK-EVENT", "CORE-CHECK-SCOPES", "CORE-CHECK-COMPILE", "CORE-CHECK-RUNTIME", "CORE-ENVELOPE-KEY", "CORE-ENVELOPE-VALUE", "CORE-ENVELOPE-PARAM", "CORE-ENVELOPE-PARAM-IMPLICIT", "CORE-ENVELOPE-QUERY", "CORE-ENVELOPE-NAV", "CORE-ENVELOPE-SOURCE", "CORE-ENVELOPE-LIFECYCLE", "CORE-ENVELOPE-AUTHOR", "CORE-ENVELOPE-COMPAT", "CORE-USER-REF-MISSING", "CORE-USER-REF-UNKNOWN", "CORE-AUTH-SCOPE", "CORE-WRITE-FEEDBACK-SCOPE", "CORE-WRITE-SHORTCUT-DECL", "CORE-WRITE-SHORTCUT-DUP", "ERR-RUN-001", "ERR-RUN-002", "ERR-RUN-003", "ERR-PUB-001", "ERR-PUB-002", "ERR-PUB-003"];
3
+ export declare const SOMA_CORE_DIAGNOSTIC_CODES: readonly ["CORE-PORT-MISSING", "CORE-PORT-CONFLICT", "CORE-PORT-LEGACY-PACK", "CORE-PORT-IDENTITY-DRIFT", "CORE-PORT-RECOMPILE", "CORE-PORT-PURPOSE", "CORE-STYLE-INVALID", "CORE-HOOK-UNCOMPILED", "CORE-SHELL-SLOT", "CORE-CONTRACT-SHAPE", "CORE-CONTRACT-DEFAULTS", "CORE-LINKAGE-DUPLICATE", "CORE-OBSERVE-FAILED", "CORE-OBSERVE-OFF", "CORE-RUNTIME-ERROR", "CORE-RUNTIME-ROOT-INVALID", "CORE-RUNTIME-ROOT-UNSET", "CORE-FORMAT-VERSION-UNSUPPORTED", "CORE-FORMAT-VERSION-MISMATCH", "CORE-INJECT-NONSTANDARD-KEY", "CORE-INJECT-PAGE-LOGIC", "CORE-INJECT-PAGE-CLOSURE", "CORE-PAGE-NEGATE-FORBIDDEN", "CORE-STYLE-COMPARE-FORBIDDEN", "CORE-PAGE-ROLE-BY-INVALID", "CORE-RUNTIME-ADDRESS-INVALID", "CORE-RUNTIME-ADDRESS-RESERVED", "CORE-RUNTIME-ADDRESS-STATIC", "CORE-RUNTIME-ADDRESS-CONFLICT", "CORE-RUNTIME-ADDRESS-OWNED", "CORE-RUNTIME-ADDRESS-MISMATCH", "CORE-RUNTIME-ADDRESS-MISSING", "CORE-RUNTIME-ADDRESS-EXPIRED", "CORE-RUNTIME-GENERATION", "CORE-RUNTIME-PROVENANCE", "CORE-RUNTIME-GRANT", "CORE-RUNTIME-GRANT-INVALID", "CORE-RUNTIME-BATCH", "CORE-RUNTIME-PARAM-INVALID", "CORE-RUNTIME-ACCESS-DENIED", "CORE-NAV-PARENT-MISSING", "CORE-NAV-OVERFLOW", "CORE-NAV-BACK-INVALID", "CORE-VIEW-DEFINE", "CORE-VIEW-CTX", "CORE-REACTIVE-WRITE", "CORE-RUNTIME-DOMAIN-STATIC-ONLY", "CORE-RUNTIME-MOUNT", "CORE-ADAPTER-EMIT", "CORE-ADAPTER-DEFINE", "CORE-DATA-FORBIDDEN", "CORE-DATA-RELATION", "CORE-DATA-REQUIRE", "CORE-LOCALE-UNKNOWN", "CORE-ENGINE-LOAD", "CORE-ENGINE-ADAPTER", "CORE-STYLE-ENGINE-CANDIDATE", "CORE-STYLE-ENGINE-THEME", "CORE-STYLE-ENGINE-COMPILE", "CORE-BEHAVIOR-MACHINE-UNKNOWN", "CORE-BEHAVIOR-LAYER-DETACHED", "CORE-BEHAVIOR-MACHINE-CONFLICT", "CORE-TABLE-COLUMN", "CORE-TABLE-STATE", "CORE-VIRTUAL-SCROLLER", "CORE-CHART-KIND-UNKNOWN", "CORE-CHART-THEME", "CORE-CHART-OPTION", "CORE-TEMPORAL-PARSE", "CORE-TEMPORAL-NOT-READY", "CORE-TEMPORAL-ZONE", "CORE-HOST-ALIAS-INVALID", "CORE-HOST-ALIAS-RESERVED", "CORE-HOST-ALIAS-SHADOW", "CORE-HOST-ALIAS-DUPLICATE", "CORE-HOST-ALIAS-TSCONFIG-DRIFT", "CORE-DND-SPEC", "CORE-ALGO-DIFF-INPUT", "CORE-ALGO-QR-CAPACITY", "CORE-ASYNC-CHECK-TABLE", "CORE-ASYNC-CHECK-UNREGISTERED", "CORE-TOAST-CONFIG", "CORE-FORMAT-LOCALE", "CORE-FORMAT-TIMEZONE", "CORE-FORMAT-CONFIG", "CORE-BEHAVIOR-DECL", "CORE-A11Y-DECL", "CORE-OVERLAY-DECL", "CORE-KEYBOARD-DECL", "CORE-BEHAVIOR-COLLECTION-MISMATCH", "CORE-BEHAVIOR-MACHINE-MISMATCH", "CORE-KEYBOARD-MISSING", "CORE-KEYBOARD-GRID-COLUMNS", "CORE-KEYBOARD-INEFFECTIVE", "CORE-KEYBOARD-UNWIRED", "CORE-A11Y-CONFIG", "CORE-A11Y-OVERLAY-NO-DISMISS", "CORE-A11Y-ROLE-KEYBOARD-MISMATCH", "CORE-A11Y-ROLE-OVERLAY", "CORE-A11Y-ROLE-LANDMARK-CONFLICT", "CORE-A11Y-LANDMARK-NAME-SOURCE", "CORE-A11Y-LANDMARK-UNNAMED", "CORE-A11Y-LANDMARK-DUPLICATE-NAME", "CORE-LOCALE-PACK-SHAPE", "CORE-LOCALE-PACK-LOCALE", "CORE-LOCALE-PACK-POSITION", "CORE-LOCALE-PACK-VALUE", "CORE-SCOPES-CONFLICT", "CORE-FRAGMENTS-CONFLICT", "CORE-ANCHOR-DUPLICATE", "CORE-REG-INPUT-INVALID", "CORE-REG-NO-COMPILED-ARTIFACT", "CORE-CHECK-BLOCKS", "CORE-CHECK-DIALECT", "CORE-CHECK-DATA", "CORE-CHECK-EVENT", "CORE-CHECK-SCOPES", "CORE-CHECK-COMPILE", "CORE-CHECK-RUNTIME", "CORE-ENVELOPE-KEY", "CORE-ENVELOPE-VALUE", "CORE-ENVELOPE-PARAM", "CORE-ENVELOPE-PARAM-IMPLICIT", "CORE-ENVELOPE-QUERY", "CORE-ENVELOPE-NAV", "CORE-ENVELOPE-SOURCE", "CORE-ENVELOPE-LIFECYCLE", "CORE-ENVELOPE-AUTHOR", "CORE-ENVELOPE-COMPAT", "CORE-USER-REF-MISSING", "CORE-USER-REF-UNKNOWN", "CORE-AUTH-SCOPE", "CORE-WRITE-FEEDBACK-SCOPE", "CORE-WRITE-SHORTCUT-DECL", "CORE-WRITE-SHORTCUT-DUP", "ERR-RUN-001", "ERR-RUN-002", "ERR-RUN-003", "ERR-PUB-001", "ERR-PUB-002", "ERR-PUB-003"];
4
4
  export type SomaCoreOwnDiagnosticCode = (typeof SOMA_CORE_DIAGNOSTIC_CODES)[number];
5
5
  /** core 码全集:自有码 ∪ `CT-*` 组件树码(`CT-*` 闭集仍定义在 `component-tree-errors.ts`) */
6
6
  export type SomaCoreDiagnosticCode = SomaCoreOwnDiagnosticCode | ComponentTreeErrorCode;
@@ -4,6 +4,6 @@ export declare const SOMA_STANDARD_PAGE_KEYS: readonly ["bind", "show", "initPro
4
4
  export declare function nonStandardPageKeys(doc: unknown): string[];
5
5
  /**
6
6
  * 文本是不是旧「块声明」容器(首个非空非注释行是 `{{` 开关行)。
7
- * 块声明已退出 core 原生格式:它由方言(soma-ui / soma-lite)自己编译成四件套后再交给 core。
7
+ * 块声明已退出 core 原生格式:它由方言(soma-ui / soma-kit)自己编译成四件套后再交给 core。
8
8
  */
9
9
  export declare function looksLikeBlockDeclaration(text: string): boolean;
@@ -1,6 +1,7 @@
1
+ import { SomaError } from '../soma-error';
1
2
  import type { SomaCoreOwnDiagnosticCode } from '../core-diagnostic-codes';
2
3
  /** 引擎端口抛出的错误:`code` 是 core 自有码;`engine` 是引擎 id(不带文件路径) */
3
- export declare class SomaEngineError extends Error {
4
+ export declare class SomaEngineError extends SomaError {
4
5
  readonly code: SomaCoreOwnDiagnosticCode;
5
6
  readonly engine: string;
6
7
  constructor(code: SomaCoreOwnDiagnosticCode, engine: string, message: string, options?: {
@@ -1,7 +1,8 @@
1
+ import { SomaError } from './soma-error';
1
2
  import type { SomaGenerationErrorShape, SomaGenerationErrorCode, SomaGenerationLayer, SomaGenerationNearest, SomaGenerationErrorSource } from './types/generation-error.types';
2
3
  /** 三段式文本:`[码] 情况:问题。修法。(路径)`,附最近候选。 */
3
4
  export declare function formatGenerationError(shape: SomaGenerationErrorShape): string;
4
- export declare class SomaGenerationError extends Error implements SomaGenerationErrorShape {
5
+ export declare class SomaGenerationError extends SomaError implements SomaGenerationErrorShape {
5
6
  readonly code: SomaGenerationErrorCode;
6
7
  readonly layer: SomaGenerationLayer;
7
8
  readonly situation: string;
@@ -0,0 +1,48 @@
1
+ interface PureBindingTruth {
2
+ readonly negatedPath: {
3
+ readonly code: string;
4
+ readonly prefix: string;
5
+ readonly pathPattern: string;
6
+ readonly remedy: string;
7
+ };
8
+ readonly styleComparison: {
9
+ readonly code: string;
10
+ readonly keys: readonly string[];
11
+ readonly remedy: string;
12
+ };
13
+ readonly styleTier: {
14
+ readonly keys: readonly string[];
15
+ readonly tierNamePattern: string;
16
+ readonly maxTiers: number;
17
+ };
18
+ readonly roleBy: {
19
+ readonly code: string;
20
+ readonly pathPattern: string;
21
+ readonly remedy: string;
22
+ };
23
+ }
24
+ export declare const SOMA_PURE_BINDING: PureBindingTruth;
25
+ /** 纯绑定违规码(码表在 core-diagnostic-codes.ts) */
26
+ export type SomaPureBindingCode = 'CORE-PAGE-NEGATE-FORBIDDEN' | 'CORE-STYLE-COMPARE-FORBIDDEN' | 'CORE-PAGE-ROLE-BY-INVALID';
27
+ /** 严格位(when / class 值):任何以取反前缀开头的值都是取反写法 */
28
+ export declare function hasNegationPrefix(value: string): boolean;
29
+ /** 宽位(props 值):`!` + 点分路径才算取反;以 `!` 开头的普通文字(如 `!关闭`)不是路径,放行 */
30
+ export declare function isNegatedPathLiteral(value: string): boolean;
31
+ /** 递归找 props 值里的取反路径,返回第一处的相对路径(无则 undefined) */
32
+ export declare function findNegatedPathIn(value: unknown, at?: string): {
33
+ at: string;
34
+ value: string;
35
+ } | undefined;
36
+ export declare function negationMessage(where: string, value: string): string;
37
+ /** role_by 是不是纯路径(行字段的值直接作为模板名) */
38
+ export declare function isPureRolePath(value: unknown): value is string;
39
+ export declare function roleByMessage(value: unknown): string;
40
+ /** 样式绑定的 bind 路径:与 role_by 同形的纯路径(点分标识符,无取反 / 管道 / 运算符) */
41
+ export declare function isPureBindPath(value: unknown): value is string;
42
+ export declare function isTierName(name: string): boolean;
43
+ export declare const SOMA_STYLE_TIER_MAX: number;
44
+ export declare const SOMA_STYLE_COMPARE_KEYS: ReadonlySet<string>;
45
+ export declare const SOMA_STYLE_COMPARE_REMEDY: string;
46
+ export declare const SOMA_STYLE_TIER_KEYS: readonly string[];
47
+ export declare const SOMA_STYLE_TIER_NAME_PATTERN: string;
48
+ export {};