soma-core 1.3.2 → 1.3.4

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 (281) hide show
  1. package/README.md +43 -0
  2. package/app/SomaPageClient.tsx +22 -68
  3. package/app/[...path]/page.tsx +7 -6
  4. package/app/api/[...path]/route.ts +3 -3
  5. package/app/api/soma-registry/[...path]/route.ts +67 -0
  6. package/app/components/SomaHostPage.tsx +3 -8
  7. package/app/components/SomaPageClientBoundary.tsx +13 -0
  8. package/app/layout.tsx +6 -1
  9. package/app/page.tsx +3 -3
  10. package/app/soma/manifest/route.ts +1 -0
  11. package/app/soma/page-object/route.ts +1 -1
  12. package/bin/soma-lsp.cjs +1 -4
  13. package/core/build/compiler/full-manifest-builder.ts +19 -23
  14. package/core/build/compiler/html-include-expander.ts +56 -0
  15. package/core/build/compiler/page-assets.ts +26 -0
  16. package/core/build/compiler/page-declaration-compiler.ts +85 -0
  17. package/core/build/compiler/rollup-plugin-soma.ts +4 -13
  18. package/core/build/compiler/route-builder.ts +0 -2
  19. package/core/build/compiler/rspack-plugin-soma.js +1 -10
  20. package/core/build/compiler/soma-manifest-webpack-plugin.js +54 -9
  21. package/core/build/compiler/soma-precompile.js +3581 -2387
  22. package/core/build/compiler/soma-precompile.ts +44 -2
  23. package/core/build/compiler/soma-rspack-yaml-loader.js +5 -8
  24. package/core/build/compiler/soma-webpack-loader.js +6 -15
  25. package/core/build/compiler/vite-plugin-soma.ts +9 -21
  26. package/core/build/component/pack-from-dir.ts +58 -0
  27. package/core/build/component/package-loader.ts +281 -0
  28. package/core/build/eject/apply-eject.ts +133 -0
  29. package/core/build/eject/plan-eject.ts +133 -0
  30. package/core/build/lsp/cross-file-diagnostics.cjs +82 -113
  31. package/core/build/lsp/extra-completion.cjs +14 -8
  32. package/core/build/lsp/lsp-navigation.cjs +50 -43
  33. package/core/build/lsp/soma-declaration.cjs +85 -0
  34. package/core/build/lsp/ui-yaml-completion.cjs +98 -104
  35. package/core/build/v2/block-compile.ts +200 -0
  36. package/core/build/v2/block-loader.ts +33 -0
  37. package/core/build/v2/html-index.ts +120 -0
  38. package/core/build/v2/migrate-v1.ts +370 -0
  39. package/core/build/v2/soma-file-loader.ts +216 -0
  40. package/core/client/adaptive/flush-scheduler.ts +96 -0
  41. package/core/client/adaptive/hysteresis.ts +56 -0
  42. package/core/client/adaptive/index.ts +23 -0
  43. package/core/client/adaptive/observer-pool.ts +90 -0
  44. package/core/client/base/SomaPageRootBase.ts +50 -0
  45. package/core/client/compiler/adaptive-compile.ts +136 -0
  46. package/core/client/compiler/manifest-compiler.ts +155 -27
  47. package/core/client/component/ai-catalog.ts +277 -0
  48. package/core/client/component/component-definition.types.ts +65 -0
  49. package/core/client/component/component-expander.ts +119 -0
  50. package/core/client/component/component-manager.ts +933 -0
  51. package/core/client/component/component-pack.ts +445 -0
  52. package/core/client/component/component-registry.ts +71 -0
  53. package/core/client/component/contract-compat.ts +132 -0
  54. package/core/client/component/example-v2.ts +132 -0
  55. package/core/client/component/pack-styles.ts +94 -0
  56. package/core/client/component/scoped-adapter.ts +85 -0
  57. package/core/client/component/verify-pack.ts +247 -0
  58. package/core/client/container/MiniProgramContainerAdapter.ts +15 -1
  59. package/core/client/container/ReactNativeContainerAdapter.ts +15 -1
  60. package/core/client/container/SomaContainerAdapter.ts +186 -180
  61. package/core/client/data/data-object-resolver.ts +417 -0
  62. package/core/client/diagnostics/SomaDiagnostics.ts +187 -186
  63. package/core/client/diagnostics/boot-timings.ts +152 -0
  64. package/core/client/engine/asset-resolver.ts +12 -2
  65. package/core/client/engine/dom-renderer.ts +249 -24
  66. package/core/client/engine/emit-event.ts +21 -0
  67. package/core/client/engine/event-engine.ts +34 -4
  68. package/core/client/engine/on-change-engine.ts +1 -1
  69. package/core/client/engine/property-watcher.ts +1 -1
  70. package/core/client/engine/reactive-proxy.ts +11 -10
  71. package/core/client/engine/render-engine.ts +39 -4
  72. package/core/client/engine/runtime-builder.ts +23 -0
  73. package/core/client/engine/soma-bootstrap.ts +380 -7
  74. package/core/client/engine/style-binder.ts +47 -1
  75. package/core/client/observability/error-reporter.ts +173 -0
  76. package/core/client/parser/adaptive-parser.ts +264 -0
  77. package/core/client/parser/data-config-parser.ts +396 -0
  78. package/core/client/parser/pipeline-parser.ts +15 -3
  79. package/core/client/parser/style-config-parser.ts +65 -2
  80. package/core/client/parser/ui-config-parser.ts +52 -3
  81. package/core/client/parser/v2/namespace.ts +182 -0
  82. package/core/client/parser/v2/page-parser.ts +359 -0
  83. package/core/client/parser/v2/use-parser.ts +412 -0
  84. package/core/client/parser/value-lang.ts +340 -0
  85. package/core/client/pipes/pipe-registry.ts +249 -0
  86. package/core/client/quality/SomaQualityRegistry.ts +3 -0
  87. package/core/client/registry/declaration-renderer.ts +161 -0
  88. package/core/client/registry/index.ts +28 -0
  89. package/core/client/registry/page-lifecycle.ts +171 -0
  90. package/core/client/registry/remote-page.ts +139 -0
  91. package/core/client/runtime/SomaRuntimeServices.ts +24 -0
  92. package/core/client/security/attribute-presence.ts +70 -0
  93. package/core/client/security/html-sanitizer.ts +113 -0
  94. package/core/client/security/url-guard.ts +0 -0
  95. package/core/client/theme/harmony.ts +307 -0
  96. package/core/client/theme/scene-tokens.ts +134 -0
  97. package/core/client/theme/theme-axes.ts +228 -0
  98. package/core/client/theme/theme-engine.ts +1196 -0
  99. package/core/client/theme/tone-solver.ts +118 -0
  100. package/core/client/typography/typography-base.ts +34 -0
  101. package/core/client/validation/contract-validator.ts +48 -5
  102. package/core/index.ts +262 -2
  103. package/core/server/api/IService.ts +18 -6
  104. package/core/server/api/load-host-service.ts +3 -3
  105. package/core/server/host/content-security-policy.ts +190 -0
  106. package/core/server/host/csp-nonce-metadata.ts +75 -0
  107. package/core/server/host/resolve-host-request-hook.ts +5 -0
  108. package/core/server/host/server-page-assets.ts +34 -7
  109. package/core/server/host/soma-page-compile.ts +33 -0
  110. package/core/server/index.ts +45 -1
  111. package/core/server/infra/cache/ServerFileCache.ts +1 -1
  112. package/core/server/mock/node/cli.mjs +2 -2
  113. package/core/server/registry/api-registry-store.ts +518 -0
  114. package/core/server/registry/conditional-object-store.ts +29 -0
  115. package/core/server/registry/declaration-precompiler.ts +99 -0
  116. package/core/server/registry/in-memory-conditional-object-store.ts +43 -0
  117. package/core/server/registry/index.ts +142 -0
  118. package/core/server/registry/page-registry-repository.ts +373 -0
  119. package/core/server/registry/page-registry-store.ts +932 -0
  120. package/core/server/registry/registry-error.ts +17 -0
  121. package/core/server/registry/registry-file-lock.ts +173 -0
  122. package/core/server/registry/registry-response.ts +71 -0
  123. package/core/server/registry/registry-subjects.ts +194 -0
  124. package/core/server/registry/registry-write-pipeline.ts +240 -0
  125. package/core/server/registry/request-body-limit.ts +99 -0
  126. package/core/server/registry/services/apis/Get.ts +25 -0
  127. package/core/server/registry/services/apis/List.ts +41 -0
  128. package/core/server/registry/services/apis/Register.ts +39 -0
  129. package/core/server/registry/services/apis/Unregister.ts +24 -0
  130. package/core/server/registry/services/index.ts +40 -0
  131. package/core/server/registry/services/pages/Get.ts +96 -0
  132. package/core/server/registry/services/pages/List.ts +53 -0
  133. package/core/server/registry/services/pages/Register.ts +49 -0
  134. package/core/server/registry/services/pages/Rollback.ts +36 -0
  135. package/core/server/registry/services/pages/Unregister.ts +23 -0
  136. package/core/server/registry/services/service-utils.ts +21 -0
  137. package/core/server/registry/validation/compile-gate.ts +54 -0
  138. package/core/server/registry/validation/component-existence.ts +55 -0
  139. package/core/server/registry/validation/credential-ban.ts +86 -0
  140. package/core/server/registry/validation/cross-check.ts +67 -0
  141. package/core/server/registry/validation/declaration-safety-scan.ts +102 -0
  142. package/core/shared/types/adaptive.types.ts +109 -0
  143. package/core/shared/types/component-contract.types.ts +120 -0
  144. package/core/shared/types/data-config.types.ts +105 -0
  145. package/core/shared/types/domain.types.ts +6 -0
  146. package/core/shared/types/engine.types.ts +41 -35
  147. package/core/shared/types/manifest.types.ts +55 -32
  148. package/core/shared/types/scope-manifest.types.ts +96 -0
  149. package/core/shared/types/style-config.types.ts +9 -0
  150. package/core/shared/types/ui-config.types.ts +118 -98
  151. package/dist/cli/soma.js +20 -5
  152. package/dist/core/index.cjs +7811 -1380
  153. package/dist/types/build/compiler/full-manifest-builder.d.ts +6 -2
  154. package/dist/types/build/compiler/html-include-expander.d.ts +19 -0
  155. package/dist/types/build/compiler/page-assets.d.ts +3 -0
  156. package/dist/types/build/compiler/page-declaration-compiler.d.ts +33 -0
  157. package/dist/types/build/compiler/rollup-plugin-soma.d.ts +0 -2
  158. package/dist/types/build/compiler/route-builder.d.ts +0 -1
  159. package/dist/types/build/compiler/soma-precompile.d.ts +17 -0
  160. package/dist/types/build/compiler/vite-plugin-soma.d.ts +2 -7
  161. package/dist/types/build/component/pack-from-dir.d.ts +17 -0
  162. package/dist/types/build/component/package-loader.d.ts +40 -0
  163. package/dist/types/build/eject/apply-eject.d.ts +22 -0
  164. package/dist/types/build/eject/plan-eject.d.ts +32 -0
  165. package/dist/types/build/v2/block-compile.d.ts +28 -0
  166. package/dist/types/build/v2/block-loader.d.ts +9 -0
  167. package/dist/types/build/v2/html-index.d.ts +37 -0
  168. package/dist/types/build/v2/migrate-v1.d.ts +32 -0
  169. package/dist/types/build/v2/soma-file-loader.d.ts +45 -0
  170. package/dist/types/client/adaptive/flush-scheduler.d.ts +13 -0
  171. package/dist/types/client/adaptive/hysteresis.d.ts +16 -0
  172. package/dist/types/client/adaptive/index.d.ts +5 -0
  173. package/dist/types/client/adaptive/observer-pool.d.ts +15 -0
  174. package/dist/types/client/base/SomaPageRootBase.d.ts +33 -0
  175. package/dist/types/client/compiler/adaptive-compile.d.ts +26 -0
  176. package/dist/types/client/compiler/manifest-compiler.d.ts +13 -2
  177. package/dist/types/client/component/ai-catalog.d.ts +73 -0
  178. package/dist/types/client/component/component-definition.types.d.ts +54 -0
  179. package/dist/types/client/component/component-expander.d.ts +25 -0
  180. package/dist/types/client/component/component-manager.d.ts +160 -0
  181. package/dist/types/client/component/component-pack.d.ts +110 -0
  182. package/dist/types/client/component/component-registry.d.ts +12 -0
  183. package/dist/types/client/component/contract-compat.d.ts +16 -0
  184. package/dist/types/client/component/example-v2.d.ts +9 -0
  185. package/dist/types/client/component/pack-styles.d.ts +22 -0
  186. package/dist/types/client/component/scoped-adapter.d.ts +18 -0
  187. package/dist/types/client/component/verify-pack.d.ts +14 -0
  188. package/dist/types/client/data/data-object-resolver.d.ts +71 -0
  189. package/dist/types/client/diagnostics/SomaDiagnostics.d.ts +2 -1
  190. package/dist/types/client/diagnostics/boot-timings.d.ts +30 -0
  191. package/dist/types/client/engine/asset-resolver.d.ts +7 -1
  192. package/dist/types/client/engine/dom-renderer.d.ts +51 -1
  193. package/dist/types/client/engine/emit-event.d.ts +6 -0
  194. package/dist/types/client/engine/event-engine.d.ts +6 -0
  195. package/dist/types/client/engine/render-engine.d.ts +25 -1
  196. package/dist/types/client/engine/runtime-builder.d.ts +7 -0
  197. package/dist/types/client/engine/soma-bootstrap.d.ts +118 -0
  198. package/dist/types/client/observability/error-reporter.d.ts +51 -0
  199. package/dist/types/client/parser/adaptive-parser.d.ts +28 -0
  200. package/dist/types/client/parser/data-config-parser.d.ts +34 -0
  201. package/dist/types/client/parser/pipeline-parser.d.ts +2 -0
  202. package/dist/types/client/parser/style-config-parser.d.ts +5 -3
  203. package/dist/types/client/parser/ui-config-parser.d.ts +22 -1
  204. package/dist/types/client/parser/v2/namespace.d.ts +52 -0
  205. package/dist/types/client/parser/v2/page-parser.d.ts +21 -0
  206. package/dist/types/client/parser/v2/use-parser.d.ts +72 -0
  207. package/dist/types/client/parser/value-lang.d.ts +63 -0
  208. package/dist/types/client/pipes/pipe-registry.d.ts +38 -0
  209. package/dist/types/client/registry/declaration-renderer.d.ts +50 -0
  210. package/dist/types/client/registry/index.d.ts +10 -0
  211. package/dist/types/client/registry/page-lifecycle.d.ts +61 -0
  212. package/dist/types/client/registry/remote-page.d.ts +52 -0
  213. package/dist/types/client/runtime/SomaRuntimeServices.d.ts +16 -0
  214. package/dist/types/client/security/attribute-presence.d.ts +7 -0
  215. package/dist/types/client/security/html-sanitizer.d.ts +37 -0
  216. package/dist/types/client/security/url-guard.d.ts +11 -0
  217. package/dist/types/client/theme/harmony.d.ts +77 -0
  218. package/dist/types/client/theme/scene-tokens.d.ts +25 -0
  219. package/dist/types/client/theme/theme-axes.d.ts +81 -0
  220. package/dist/types/client/theme/theme-engine.d.ts +77 -0
  221. package/dist/types/client/theme/tone-solver.d.ts +47 -0
  222. package/dist/types/client/typography/typography-base.d.ts +15 -0
  223. package/dist/types/client/validation/contract-validator.d.ts +2 -0
  224. package/dist/types/index.d.ts +47 -2
  225. package/dist/types/server/api/IService.d.ts +18 -6
  226. package/dist/types/server/host/content-security-policy.d.ts +53 -0
  227. package/dist/types/server/host/csp-nonce-metadata.d.ts +32 -0
  228. package/dist/types/server/host/resolve-host-request-hook.d.ts +5 -0
  229. package/dist/types/server/host/server-page-assets.d.ts +2 -0
  230. package/dist/types/server/host/soma-page-compile.d.ts +7 -0
  231. package/dist/types/server/index.d.ts +6 -1
  232. package/dist/types/server/registry/api-registry-store.d.ts +141 -0
  233. package/dist/types/server/registry/conditional-object-store.d.ts +27 -0
  234. package/dist/types/server/registry/declaration-precompiler.d.ts +30 -0
  235. package/dist/types/server/registry/in-memory-conditional-object-store.d.ts +8 -0
  236. package/dist/types/server/registry/index.d.ts +29 -0
  237. package/dist/types/server/registry/page-registry-repository.d.ts +58 -0
  238. package/dist/types/server/registry/page-registry-store.d.ts +259 -0
  239. package/dist/types/server/registry/registry-error.d.ts +12 -0
  240. package/dist/types/server/registry/registry-file-lock.d.ts +20 -0
  241. package/dist/types/server/registry/registry-response.d.ts +18 -0
  242. package/dist/types/server/registry/registry-subjects.d.ts +59 -0
  243. package/dist/types/server/registry/registry-write-pipeline.d.ts +48 -0
  244. package/dist/types/server/registry/request-body-limit.d.ts +31 -0
  245. package/dist/types/server/registry/services/apis/Get.d.ts +10 -0
  246. package/dist/types/server/registry/services/apis/List.d.ts +10 -0
  247. package/dist/types/server/registry/services/apis/Register.d.ts +13 -0
  248. package/dist/types/server/registry/services/apis/Unregister.d.ts +12 -0
  249. package/dist/types/server/registry/services/index.d.ts +3 -0
  250. package/dist/types/server/registry/services/pages/Get.d.ts +10 -0
  251. package/dist/types/server/registry/services/pages/List.d.ts +13 -0
  252. package/dist/types/server/registry/services/pages/Register.d.ts +11 -0
  253. package/dist/types/server/registry/services/pages/Rollback.d.ts +9 -0
  254. package/dist/types/server/registry/services/pages/Unregister.d.ts +9 -0
  255. package/dist/types/server/registry/services/service-utils.d.ts +10 -0
  256. package/dist/types/server/registry/validation/compile-gate.d.ts +12 -0
  257. package/dist/types/server/registry/validation/component-existence.d.ts +14 -0
  258. package/dist/types/server/registry/validation/credential-ban.d.ts +15 -0
  259. package/dist/types/server/registry/validation/cross-check.d.ts +16 -0
  260. package/dist/types/server/registry/validation/declaration-safety-scan.d.ts +15 -0
  261. package/dist/types/shared/types/adaptive.types.d.ts +88 -0
  262. package/dist/types/shared/types/component-contract.types.d.ts +78 -0
  263. package/dist/types/shared/types/data-config.types.d.ts +81 -0
  264. package/dist/types/shared/types/domain.types.d.ts +6 -0
  265. package/dist/types/shared/types/engine.types.d.ts +6 -0
  266. package/dist/types/shared/types/manifest.types.d.ts +23 -0
  267. package/dist/types/shared/types/scope-manifest.types.d.ts +82 -0
  268. package/dist/types/shared/types/style-config.types.d.ts +8 -0
  269. package/dist/types/shared/types/ui-config.types.d.ts +20 -0
  270. package/editor/vscode/package.json +1 -24
  271. package/global.d.ts +5 -11
  272. package/next.config.js +85 -28
  273. package/package.json +33 -11
  274. package/proxy.ts +62 -0
  275. package/tailwind.config.ts +0 -1
  276. package/core/build/lsp/event-yaml-completion.cjs +0 -106
  277. package/core/client/engine/theme-variables.ts +0 -37
  278. package/dist/tsconfig.types.tsbuildinfo +0 -1
  279. package/dist/types/client/engine/theme-variables.d.ts +0 -3
  280. package/editor/vscode/syntaxes/soma-event-yaml.tmLanguage.json +0 -30
  281. package/middleware.ts +0 -33
@@ -0,0 +1,86 @@
1
+ // 凭据禁令(纯函数,零依赖):注册表登记的内容里不许出现凭据。
2
+ //
3
+ // 为什么必须有:API 注册表登记的是"接口长什么样",不是"怎么调它"。一旦允许把
4
+ // Authorization 头、密钥、Cookie 写进登记内容,平台就成了凭据的存放处——
5
+ // 而这些内容会随清单接口发给任何有读权限的调用方,也会被注入生成上下文喂给模型。
6
+ // 鉴权永远是宿主运行时的事(与 soma-voice「凭据由宿主持有」同源纪律)。
7
+ //
8
+ // 规则刻意保守但**不含裸 token**:业务里 `token_count`、`token_price` 是正常字段,
9
+ // 把它一起误伤会逼着人绕过闸门。命中的是明确的凭据词形,且拒绝时点名违规项,
10
+ // 万一误伤也能一眼看出该改什么。
11
+
12
+ /** 明确的凭据词形(小写匹配;`bearer ` 带空格避免误伤 bearer-token-price 之类命名) */
13
+ const CREDENTIAL_TERMS = [
14
+ 'authorization',
15
+ 'bearer ',
16
+ 'api-key',
17
+ 'apikey',
18
+ 'api_key',
19
+ 'access_token',
20
+ 'refresh_token',
21
+ 'secret',
22
+ 'password',
23
+ 'passwd',
24
+ 'credential',
25
+ 'private_key',
26
+ 'privatekey',
27
+ 'x-auth',
28
+ 'set-cookie',
29
+ ] as const;
30
+
31
+ /** cookie 单独判:字段名叫 cookie 才算,描述里提一句"不需要 cookie"不该被拒 */
32
+ const COOKIE_KEY = /^cookie$/i;
33
+
34
+ export interface CredentialScannable {
35
+ /** 接口路径(查询串里塞 token 是最常见的泄漏形态) */
36
+ path?: string;
37
+ /** 描述文本 */
38
+ description?: string;
39
+ /** 字段字典:键与 name 都要扫 */
40
+ fields?: Record<string, { name?: string } | undefined>;
41
+ }
42
+
43
+ function hits(text: string): string[] {
44
+ const lower = text.toLowerCase();
45
+ return CREDENTIAL_TERMS.filter((term) => lower.includes(term));
46
+ }
47
+
48
+ /**
49
+ * 扫描登记内容的凭据面,返回中文问题清单(空数组 = 通过)。
50
+ * 清单同时喂两处:注册闸门用它拒绝落库,排障时用它告诉人该改哪一项。
51
+ */
52
+ export function scanCredentialLeak(target: CredentialScannable): string[] {
53
+ const issues: string[] = [];
54
+
55
+ if (target.path) {
56
+ const found = hits(target.path);
57
+ if (found.length > 0) {
58
+ issues.push(
59
+ `[凭据] path 含凭据词 ${found.join('、')}——接口路径不许携带密钥或令牌,`
60
+ + '鉴权由宿主运行时在请求头里加,不进注册表',
61
+ );
62
+ }
63
+ }
64
+
65
+ if (target.description) {
66
+ const found = hits(target.description);
67
+ if (found.length > 0) {
68
+ issues.push(
69
+ `[凭据] description 含凭据词 ${found.join('、')}——注册表只描述接口形状,不存放调用凭据`,
70
+ );
71
+ }
72
+ }
73
+
74
+ for (const [key, value] of Object.entries(target.fields ?? {})) {
75
+ const found = [...hits(key), ...(value?.name ? hits(value.name) : [])];
76
+ if (COOKIE_KEY.test(key)) found.push('cookie');
77
+ if (found.length > 0) {
78
+ issues.push(
79
+ `[凭据] 字段 ${key} 命中凭据词 ${[...new Set(found)].join('、')}——`
80
+ + '凭据不是业务字段,不该出现在字段字典里',
81
+ );
82
+ }
83
+ }
84
+
85
+ return issues;
86
+ }
@@ -0,0 +1,67 @@
1
+ // 两表交叉校验:页面声明绑定的数据接口必须已在 API 注册表登记。
2
+ //
3
+ // 这是 API 注册表的意义所在——**注册过的接口表就是页面取数的白名单**。
4
+ // 页面声明里 `data.<对象>.from[].api` 指向的每一条路径都要能在表里找到,
5
+ // 找不到就拒绝落库。于是"AI 生成的页面能调哪些接口"由注册表这份数据决定,
6
+ // 而不是靠模型自觉:安全边界由校验闸门数学保证。
7
+ //
8
+ // 两个刻意的设计:
9
+ // 1. **消费统一编译产物,不用正则**:声明只编译一次,再从 SomaDataConfig 收集路径。
10
+ // 2. **匹配键是路径不是注册名**:页面声明里写的就是路径,注册名只是人和清单用的标识。
11
+ // 查询串与 hash 在比较前剥掉——`/api/orders?page=1` 与 `/api/orders` 是同一个接口。
12
+
13
+ import type { SomaDataConfig } from '../../../shared/types/data-config.types';
14
+ import { getApiRegistryStore } from '../api-registry-store';
15
+
16
+ /** 已注册路径的来源;测试与特殊宿主可替换(默认读共享 API 注册表) */
17
+ export type RegisteredPathsResolver = () => ReadonlySet<string>;
18
+
19
+ let resolver: RegisteredPathsResolver | null = null;
20
+
21
+ /** 替换判据来源(测试用;传 null 复位为共享注册表) */
22
+ export function setRegisteredPathsResolver(next: RegisteredPathsResolver | null): void {
23
+ resolver = next;
24
+ }
25
+
26
+ function registeredPaths(): ReadonlySet<string> {
27
+ if (resolver) return resolver();
28
+ return getApiRegistryStore().registeredPaths();
29
+ }
30
+
31
+ /** 取数路径归一化:剥掉查询串与 hash,只留路径本体 */
32
+ export function normalizeApiPath(raw: string): string {
33
+ return raw.split('#')[0].split('?')[0].trim();
34
+ }
35
+
36
+ /**
37
+ * 收集统一声明编译产物里引用到的全部接口路径(已归一化,去重、有序)。
38
+ */
39
+ export function collectDeclaredApiPaths(config: SomaDataConfig | undefined): string[] {
40
+ if (!config) return [];
41
+ const paths = new Set<string>();
42
+ for (const object of Object.values(config.objects ?? {})) {
43
+ for (const source of object.from ?? []) {
44
+ if (typeof source.api === 'string' && source.api.trim() !== '') {
45
+ paths.add(normalizeApiPath(source.api));
46
+ }
47
+ }
48
+ }
49
+ return [...paths].sort();
50
+ }
51
+
52
+ /**
53
+ * 交叉校验,返回中文问题清单(空数组 = 通过)。
54
+ * 与安全扫描同款约定:命中即拒,清单点名到具体路径与数据对象,便于自修复。
55
+ */
56
+ export function crossCheckDeclaredApis(config: SomaDataConfig | undefined): string[] {
57
+ const declared = collectDeclaredApiPaths(config);
58
+ if (declared.length === 0) return [];
59
+
60
+ const registered = registeredPaths();
61
+ const missing = declared.filter((path) => !registered.has(path));
62
+ if (missing.length === 0) return [];
63
+ return [
64
+ `[取数] 页面绑定了未注册的接口 ${missing.join('、')}——`
65
+ + 'API 注册表是页面取数的白名单:先注册接口(POST /api/soma-registry/apis/register)再发布页面',
66
+ ];
67
+ }
@@ -0,0 +1,102 @@
1
+ // 页面声明的注入面静态扫描(B6 安全域,纯函数、零依赖)。
2
+ //
3
+ // 为什么需要它:声明仓库里的四件套不是可信资产——html 由模型生成、可被提示词注入
4
+ // 影响,发布后由 `SomaContainerAdapter.mount()` 整串写进 `innerHTML`。这里有个
5
+ // 常被误解的事实:innerHTML 插入的 `<script>` 确实**不会**执行,但
6
+ // `<img src=x onerror=…>` 的事件属性**会**立刻执行——所以「引擎不 eval、DSL 无脚本」
7
+ // 这条守线,会被一段带 on* 属性的 html 从数据侧整个绕过。
8
+ //
9
+ // 运行期虽有两道网(属性写入闸拦伪协议与 on* 绑定、@html 走净化收口),但它们守的是
10
+ // **绑定写入**这条路;mount 的静态骨架不经过它们。故在写入声明仓库这个唯一入口做静态
11
+ // 扫描:坏声明根本不允许落库,而不是指望渲染端每次都拦得住。
12
+ //
13
+ // 扫描同时是 CSP 的事实依据:正因为落库的声明里不可能有内联脚本与外链标签,
14
+ // Host 才敢把 `script-src` 收到 `'self'`(见 doc/soma 细节与生产化强化.md §4.2)。
15
+ //
16
+ // 规则刻意保守(宁可误伤也不放过):命中即拒绝,不做「清洗后放行」——
17
+ // 自动清洗会让人以为声明是自己写的那份,出问题时对不上账。
18
+
19
+ /** 声明的可扫描面(与 PageRegistryDeclaration / PageDeclarations 同构的子集) */
20
+ export interface ScannableDeclaration {
21
+ html: string;
22
+ uiYaml?: string;
23
+ eventYaml?: string;
24
+ styleYaml?: string;
25
+ dataYaml?: string;
26
+ }
27
+
28
+ /** html 里一律不许出现的标签:脚本、外链、框架与文档级指令 */
29
+ const FORBIDDEN_TAGS = ['script', 'iframe', 'object', 'embed', 'base', 'link', 'meta', 'frame', 'frameset'];
30
+
31
+ /** 会被浏览器当 URL 加载的属性(与 soma-core url-guard 的名单同源) */
32
+ const URL_ATTRS = ['href', 'src', 'srcset', 'action', 'formaction', 'poster', 'data', 'xlink:href', 'ping', 'background'];
33
+
34
+ /** 危险伪协议:`data:` 只封 text/html(图片 data URI 是合法且常见的用法) */
35
+ const DANGEROUS_SCHEME = String.raw`(?:javascript|vbscript)\s*:|data\s*:\s*text/html`;
36
+
37
+ /** 内联事件处理器属性:要求 `on` 前是空白或标签起始,避免误伤 data-on-xxx 这类命名 */
38
+ const INLINE_HANDLER_RE = /(?:^|\s)on[a-z]+\s*=/i;
39
+
40
+ /** URL 属性上的伪协议(属性值可带引号,也可裸写) */
41
+ const URL_SCHEME_RE = new RegExp(
42
+ String.raw`(?:${URL_ATTRS.map((attr) => attr.replace(':', '\\:')).join('|')})\s*=\s*["']?\s*(?:${DANGEROUS_SCHEME})`,
43
+ 'i',
44
+ );
45
+
46
+ /** YAML 值位上的伪协议:`href: "javascript:…"` / `- javascript:…` 都算 */
47
+ const YAML_SCHEME_RE = new RegExp(String.raw`[:\-]\s*["']?\s*(?:${DANGEROUS_SCHEME})`, 'i');
48
+
49
+ function findForbiddenTags(html: string): string[] {
50
+ return FORBIDDEN_TAGS.filter((tag) => new RegExp(String.raw`<\s*/?\s*${tag}\b`, 'i').test(html));
51
+ }
52
+
53
+ /**
54
+ * 扫描声明的注入面,返回中文问题清单(空数组 = 通过)。
55
+ *
56
+ * 清单同时喂两处:发布管线用它拒绝落库,生成链闸门用它回喂模型自修复——
57
+ * 一把尺子量两处,规则不会各写一份而漂移。
58
+ */
59
+ export function scanDeclarationSafety(declaration: ScannableDeclaration): string[] {
60
+ const issues: string[] = [];
61
+ const html = declaration.html ?? '';
62
+
63
+ const forbidden = findForbiddenTags(html);
64
+ if (forbidden.length > 0) {
65
+ issues.push(
66
+ `[安全] html 含禁用标签 ${forbidden.map((tag) => `<${tag}>`).join('、')}`
67
+ + '——声明态页面不许自带脚本与外链资源;样式状态与事件必须写进 canonical _ui.yaml,受信任能力封装为 Host 组件',
68
+ );
69
+ }
70
+
71
+ if (INLINE_HANDLER_RE.test(html)) {
72
+ issues.push(
73
+ '[安全] html 含内联事件属性(on*=…)'
74
+ + '——innerHTML 挂载时这类属性会立刻执行,事件一律写入 canonical _ui.yaml 的四动词 Pipeline',
75
+ );
76
+ }
77
+
78
+ if (/\bsrcdoc\s*=/i.test(html)) {
79
+ issues.push('[安全] html 含 srcdoc 属性——等价于内联一整份文档,不允许出现在页面声明里');
80
+ }
81
+
82
+ if (URL_SCHEME_RE.test(html)) {
83
+ issues.push('[安全] html 的链接/资源属性含伪协议(javascript: / vbscript: / data:text/html)');
84
+ }
85
+
86
+ const yamlFaces: Array<[string, string | undefined]> = [
87
+ ['ui.yaml', declaration.uiYaml],
88
+ ['event.yaml', declaration.eventYaml],
89
+ ['style.yaml', declaration.styleYaml],
90
+ ['data.yaml', declaration.dataYaml],
91
+ ];
92
+ for (const [label, source] of yamlFaces) {
93
+ if (source && YAML_SCHEME_RE.test(source)) {
94
+ issues.push(
95
+ `[安全] ${label} 的字面量含伪协议(javascript: / vbscript: / data:text/html)`
96
+ + '——@href/@src 绑定的默认值同样会被写进 DOM',
97
+ );
98
+ }
99
+ }
100
+
101
+ return issues;
102
+ }
@@ -0,0 +1,109 @@
1
+ // core/shared/types/adaptive.types.ts — 降级阶梯声明类型与词汇注册契约(F-07 / F-09)
2
+ //
3
+ // 边界(arch/契约与边界.md C4 C5 与禁止边 2):
4
+ // 语法归语言(core),级语义词汇归组件(soma-ui)。
5
+ // 本文件只定义"形状",不定义任何级的含义——core 不内置、也不 import 任何级语义;
6
+ // 词汇一律由宿主 bootstrap 注入。这是"core 对几何档位零认知"不变量在类型层的落点。
7
+
8
+ /**
9
+ * 版式画像:唯一封闭取值集。
10
+ * 只标注页面的信息形态,不携带任何几何档位(档位语义在 soma-ui)。
11
+ */
12
+ export const SOMA_ADAPTIVE_PROFILES = ['dashboard', 'form', 'list', 'console'] as const;
13
+
14
+ export type SomaAdaptiveProfile = (typeof SOMA_ADAPTIVE_PROFILES)[number];
15
+
16
+ /**
17
+ * 阶梯级数上限。
18
+ * 取 5 不是性能阈值:超过五级说明页面本身过载,正确做法是拆页而不是加级。
19
+ */
20
+ export const SOMA_ADAPTIVE_MAX_LADDER = 5;
21
+
22
+ /**
23
+ * 阶梯的一级。
24
+ * YAML 上是单键对象 `{ 槽名: 级值 }`,解析后拍平为二元组——
25
+ * 单键对象在类型层无法表达"恰好一个键",拍平后级序才是可枚举、可快照的。
26
+ */
27
+ export interface SomaAdaptiveLevel {
28
+ /** 槽名,同时是展开目标锚点的 data-soma-id */
29
+ slot: string;
30
+ /** 级值;必须落在注册词汇表内,core 不解释其含义 */
31
+ value: string;
32
+ }
33
+
34
+ /**
35
+ * `_ui.yaml` 顶层保留键 `adaptive` 的解析结果。
36
+ * 整个键可选:未声明时编译产物与迁移前字节级一致(零破坏保证的类型锚点)。
37
+ */
38
+ export interface SomaAdaptiveConfig {
39
+ profile: SomaAdaptiveProfile;
40
+ /** 声明即全量覆盖默认阶梯,不深合并——深合并会让"实际生效的阶梯"失去单一可读处 */
41
+ ladder?: SomaAdaptiveLevel[];
42
+ /** 记名豁免槽:不参与降级 */
43
+ pin?: string[];
44
+ }
45
+
46
+ /**
47
+ * 级的展开方式。
48
+ * breakpoint:纯 CSS 作用域类,L1 自足,不经运行时解算;
49
+ * measure:需要测量,展开为执行器配置交 soma-ui 接线层消费。
50
+ */
51
+ export type SomaAdaptiveLevelKind = 'breakpoint' | 'measure';
52
+
53
+ export interface SomaAdaptiveLevelDefinition {
54
+ kind: SomaAdaptiveLevelKind;
55
+ /**
56
+ * 断点型级的触发档值,由词汇提供方声明,core 只透传不解释。
57
+ *
58
+ * 测量型级没有静态触发点,通常省略此字段;若宿主需要为调试/审计标注
59
+ * 一个业务触发标签,也只能作为不透明字符串携带,不能让 core 据此做布局决策。
60
+ */
61
+ trigger?: string;
62
+ /**
63
+ * 展开目标:断点型是预置作用域类名,测量型是执行器名。
64
+ * core 只做透传,不解释其内容(解释即等于把组件行为搬进引擎)。
65
+ */
66
+ target: string;
67
+ }
68
+
69
+ /**
70
+ * 阶梯词汇表:槽名 → 级值 → 定义。
71
+ * 由 `bootstrap` 与组件注册同点注入(`adaptiveVocabulary: createSomaUiAdaptiveVocabulary()`)。
72
+ * core 侧恒为空:未注册而页面声明 ladder 时按 ERR-02 快速失败。
73
+ */
74
+ export type SomaAdaptiveVocabulary = Readonly<
75
+ Record<string, Readonly<Record<string, SomaAdaptiveLevelDefinition>>>
76
+ >;
77
+
78
+ // ─── 编译产物(F-10 / C6) ───────────────────────────────────────────────────
79
+
80
+ /** 断点型级的展开产物:目标锚点挂一个预置作用域类 */
81
+ export interface SomaAdaptiveScopeClass {
82
+ /** 目标锚点 data-soma-id(等于槽名) */
83
+ slot: string;
84
+ className: string;
85
+ /** 原始断点档值;core 只透传,供宿主闸门/调试工具观察,不参与运行期决策。 */
86
+ trigger?: string;
87
+ }
88
+
89
+ /** 测量型级的展开产物:交 soma-ui 接线层消费的执行器配置 */
90
+ export interface SomaAdaptiveExecutorConfig {
91
+ /** 目标锚点 data-soma-id(等于槽名) */
92
+ slot: string;
93
+ /** 原始级值,用于 ui 侧回溯声明 */
94
+ value: string;
95
+ /** 执行器名,由词汇表给出;core 不认识它做什么 */
96
+ executor: string;
97
+ }
98
+
99
+ /**
100
+ * 阶梯编译产物:确定性映射(同输入同输出,可快照)。
101
+ * 运行期不再做任何展开判断——这是"运行期零决策"的兑现处。
102
+ */
103
+ export interface SomaCompiledAdaptive {
104
+ profile: SomaAdaptiveProfile;
105
+ scopeClasses: SomaAdaptiveScopeClass[];
106
+ executors: SomaAdaptiveExecutorConfig[];
107
+ /** 记名豁免槽的原样透传(ui 侧仲裁链据此跳过) */
108
+ pinned: string[];
109
+ }
@@ -0,0 +1,120 @@
1
+ // 组件契约类型 — 组件体系(模块 7)
2
+ // 契约是组件的唯一事实源,规范见 soma-ui/doc/soma 组件契约.md。
3
+ // 本文件为 P0 可执行子集:props / emits / slots;
4
+ // variants / states / tokens 随 P1 契约编译器落地时补充。
5
+
6
+ // solution:业务组件层(atom/composite 之上)——把一类业务场景整套打包,一个声明落一个完整业务功能
7
+ export type SomaComponentLayer = 'atom' | 'composite' | 'solution' | 'template';
8
+
9
+ /**
10
+ * 组件的主几何族。
11
+ *
12
+ * 这是生成链与组件目录之间的结构契约:页面生成器只根据族义务决定包裹方式,
13
+ * 不读取组件实现细节。字段保持可选以兼容尚未迁移的外部组件契约;目录编译器会
14
+ * 为缺省值生成一次性迁移归族结果,待组件逐步补齐后即可删掉该兼容路径。
15
+ */
16
+ export type SomaGeometryFamily =
17
+ | 'control'
18
+ | 'surface'
19
+ | 'message'
20
+ | 'data'
21
+ | 'overlay'
22
+ | 'layout'
23
+ | 'display';
24
+
25
+ export type SomaContractPropType =
26
+ | 'number'
27
+ | 'string'
28
+ | 'boolean'
29
+ | 'enum'
30
+ | 'object'
31
+ | 'array';
32
+
33
+ export interface SomaContractProp {
34
+ type: SomaContractPropType;
35
+ required?: boolean;
36
+ /** 非 required 的 prop 必须有默认值(契约规则 C4:零 props 可渲染) */
37
+ default?: unknown;
38
+ desc?: string;
39
+ /** type === 'enum' 时的取值集合 */
40
+ values?: (string | number)[];
41
+ /** 绑定模式:oneway(默认)| model(双向,一个组件最多一个) */
42
+ mode?: 'oneway' | 'model';
43
+ }
44
+
45
+ /**
46
+ * 找出契约默认值中第二层及更深的引用型值。
47
+ *
48
+ * 运行时只隔离默认值的最外层数组/普通对象,避免擅自克隆 Date、类实例等带语义的值。
49
+ * 因而默认值允许 `[]`、`{}` 与一层标量字段,却不能再嵌套数组/对象;否则实例仍会
50
+ * 共享内部引用,组件控制器或 model 写入会跨实例、跨页面污染状态且不会报错。
51
+ *
52
+ * 返回相对 default 的首个违规路径;`null` 表示最外层浅拷贝已足够隔离。
53
+ */
54
+ export function findNestedMutableContractDefault(value: unknown): string | null {
55
+ if (value === null || typeof value !== 'object') {
56
+ return null;
57
+ }
58
+
59
+ const entries = Array.isArray(value)
60
+ ? value.map((item, index) => [`[${index}]`, item] as const)
61
+ : Object.entries(value as Record<string, unknown>);
62
+ for (const [segment, child] of entries) {
63
+ if (child !== null && typeof child === 'object') {
64
+ return segment;
65
+ }
66
+ }
67
+ return null;
68
+ }
69
+
70
+ export interface SomaContractEmitPayloadField {
71
+ type: SomaContractPropType;
72
+ desc?: string;
73
+ }
74
+
75
+ export interface SomaContractEmit {
76
+ payload?: Record<string, SomaContractEmitPayloadField>;
77
+ desc?: string;
78
+ }
79
+
80
+ export interface SomaContractSlot {
81
+ desc?: string;
82
+ required?: boolean;
83
+ }
84
+
85
+ /**
86
+ * AI 目录段(契约规范第 11 章):AI 生成页面前查表选组件的依据。
87
+ * when_to_use / example 为目录质量线;when_not_to_use 用于同族组件消歧。
88
+ */
89
+ export interface SomaContractAiSection {
90
+ when_to_use: string;
91
+ when_not_to_use?: string;
92
+ /** 三行真实用法:html / ui / event 各一行 */
93
+ example: string;
94
+ anti_patterns?: string[];
95
+ }
96
+
97
+ export interface SomaComponentContract {
98
+ /** 契约名,PascalCase,注册域内唯一 */
99
+ name: string;
100
+ layer: SomaComponentLayer;
101
+ /** semver;破坏性变更必须升 major(契约规则 C8) */
102
+ version: string;
103
+ description: string;
104
+ /** 主几何族;旧契约缺省时由目录编译器按组件层与名称推导迁移值。 */
105
+ geometry?: SomaGeometryFamily;
106
+ props?: Record<string, SomaContractProp>;
107
+ emits?: Record<string, SomaContractEmit>;
108
+ slots?: Record<string, SomaContractSlot>;
109
+ ai?: SomaContractAiSection;
110
+ /**
111
+ * 声明式覆盖:本组件有意替换该包里的同名组件(值为被覆盖组件的来源包名,如 'soma-ui')。
112
+ *
113
+ * 为什么写在契约上而不是宿主 bootstrap 里:覆盖意图与组件同处、随组件评审、
114
+ * 宿主零维护。合成时 `composeComponentPacks` 收集本字段构建覆盖表,并强制过
115
+ * 契约兼容闸门(props 超集 + emit 全保留),保证"优化存量组件、页面零改动"。
116
+ *
117
+ * 未声明的跨包撞名一律抛错——写出来的覆盖是设计决定,猜出来的覆盖是事故。
118
+ */
119
+ overrides?: string;
120
+ }
@@ -0,0 +1,105 @@
1
+ // core/shared/types/data-config.types.ts — 数据对象层(*_data.yaml)类型定义
2
+ // 对应《soma 数据对象层》第 2/3 节:数据对象声明 + 字段字典。
3
+ // 数据对象是业务抽象出的命名数据(如 order),来源是一个或多个后端接口;
4
+ // 组件与页面只认对象与字段,不认接口协议。
5
+
6
+ /** 字段类型枚举(决定 soma-ui 双态映射走哪个渲染组件) */
7
+ export type SomaDataFieldType =
8
+ | 'text'
9
+ | 'int'
10
+ | 'float'
11
+ | 'money'
12
+ | 'bool'
13
+ | 'enum'
14
+ | 'date'
15
+ | 'datetime'
16
+ | 'image'
17
+ | 'url'
18
+ | 'richtext';
19
+
20
+ /** 字段权限:r 只读 / w 可写(决定双态映射走 show 还是 edit 形态) */
21
+ export type SomaDataFieldPermission = 'r' | 'w';
22
+
23
+ /** 枚举字段候选项(type: enum 专用) */
24
+ export interface SomaDataFieldOption {
25
+ /** 枚举值 */
26
+ key: string;
27
+ /** 展示文案(缺省用 key) */
28
+ label?: string;
29
+ }
30
+
31
+ /**
32
+ * 字段校验规则:required / max_len / min_len / pattern / min / max 六种之一,
33
+ * 每条规则必须携带校验失败时的提示文案 message。
34
+ */
35
+ export interface SomaDataFieldRule {
36
+ /** 必填 */
37
+ required?: boolean;
38
+ /** 最大长度(字符串) */
39
+ max_len?: number;
40
+ /** 最小长度(字符串) */
41
+ min_len?: number;
42
+ /** 正则表达式(字符串形式) */
43
+ pattern?: string;
44
+ /** 最小值(数字) */
45
+ min?: number;
46
+ /** 最大值(数字) */
47
+ max?: number;
48
+ /** 校验失败提示文案 */
49
+ message: string;
50
+ }
51
+
52
+ /** 字段字典条目(驱动 UI 的元数据,全部可选;字典缺失时由 shape-infer 推断兜底) */
53
+ export interface SomaDataFieldConfig {
54
+ /** 业务名称(如「订单号」),速记列 label 的第一优先来源 */
55
+ name?: string;
56
+ /** 字段类型(缺省按 text 处理) */
57
+ type?: SomaDataFieldType;
58
+ /** 字段权限(缺省按只读处理) */
59
+ permission?: SomaDataFieldPermission;
60
+ /** 校验规则集 */
61
+ rules?: SomaDataFieldRule[];
62
+ /** 枚举候选项 */
63
+ options?: SomaDataFieldOption[];
64
+ }
65
+
66
+ /**
67
+ * 单个取数来源:一个后端接口 + 参数 + 聚合位置。
68
+ * params 值支持三源 `$` 引用:$query.*(URL 参数)、$page.*(Domain 字段)、
69
+ * $<数据对象>.*(依赖编排,决定对象间取数顺序)。
70
+ */
71
+ export interface SomaDataSourceConfig {
72
+ /** 后端接口路径(后端接口是唯一数据边界) */
73
+ api: string;
74
+ /** 取数参数:字面量或 `$` 引用(支持嵌套对象/数组) */
75
+ params?: Record<string, unknown>;
76
+ /** 结果聚合到对象子键(如 order.trace);缺省浅合并进对象根 */
77
+ into?: string;
78
+ }
79
+
80
+ /** 数据对象声明(*_data.yaml 中 data.<对象名> 的解析产物) */
81
+ export interface SomaDataObjectConfig {
82
+ /** 对象名(页面内唯一,即 data 下的键名) */
83
+ name: string;
84
+ /** 取数来源列表(mock 预览对象可为空数组) */
85
+ from: SomaDataSourceConfig[];
86
+ /**
87
+ * 派生字段:值为 "源字段路径 | 管道链"(复用 pipe-registry)。
88
+ * 解析期已归一化为标准管道语法(`date: 'x'` → `date('x')`)。
89
+ */
90
+ transform?: Record<string, string>;
91
+ /** 字段字典(字段名 → 字典条目) */
92
+ fields?: Record<string, SomaDataFieldConfig>;
93
+ /** mock 样本:SOMA_MOCK_ENABLED / 接口失败兜底 / 无接口预览 */
94
+ mock?: unknown;
95
+ /** 解析期提取:params 引用到的其他数据对象名(DAG 拓扑排序输入,不含自引用) */
96
+ deps: string[];
97
+ }
98
+
99
+ /** *_data.yaml 整体解析产物(对象名 → 声明) */
100
+ export interface SomaDataConfig {
101
+ objects: Record<string, SomaDataObjectConfig>;
102
+ }
103
+
104
+ /** 字段字典集合(对象名 → 字段名 → 字典条目),解析器产物 dicts 的形状 */
105
+ export type SomaDataDicts = Record<string, Record<string, SomaDataFieldConfig>>;
@@ -12,6 +12,12 @@ export interface SomaPageRoot {
12
12
  _config?: unknown;
13
13
  /** 运行时基础设施(引擎在 mount 时注入) */
14
14
  _services?: import('../../client/runtime/SomaRuntimeServices').SomaRuntimeServices;
15
+ /** 数据对象层解析产物挂载点(*_data.yaml 可选件;引擎解析完成后注入) */
16
+ data?: Record<string, unknown>;
17
+ /** 数据对象重取钩子(引擎在存在 *_data.yaml 声明时注入) */
18
+ _reloadData?: () => Promise<void>;
19
+ /** 重新执行数据对象取数(无声明时为空操作) */
20
+ reloadData?(): Promise<void>;
15
21
  /** 页面初始化(引擎在渲染完成后调用) */
16
22
  onMount?(): void | Promise<void>;
17
23
  /** 页面销毁前(引擎在卸载时调用) */