soma-core 2.2.6 → 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 (59) hide show
  1. package/core/build/compiler/soma-precompile.js +66 -10
  2. package/core/client/container/IContainerAdapter.ts +4 -0
  3. package/core/client/container/SomaContainerAdapter.ts +43 -2
  4. package/core/client/data/data-object-resolver.ts +7 -3
  5. package/core/client/engine/event-engine.ts +28 -3
  6. package/core/client/engine/soma-bootstrap.ts +2 -1
  7. package/core/client/infra/notify/DefaultNotifyService.ts +2 -2
  8. package/core/client/parser/confirm-spec.ts +99 -6
  9. package/core/client/parser/data-config-parser.ts +1 -1
  10. package/core/client/parser/pipeline-parser.ts +2 -1
  11. package/core/client/render-ports/hide-transition.ts +9 -0
  12. package/core/client/render-ports/index.ts +4 -0
  13. package/core/client/render-ports/notify-renderer.ts +2 -1
  14. package/core/index.ts +16 -4
  15. package/core/server/api/load-host-service.ts +3 -0
  16. package/core/server/api/paged-list.ts +259 -0
  17. package/core/server/host/empty-host-bootstrap.mjs +3 -0
  18. package/core/server/host/host-assembly.ts +3 -0
  19. package/core/server/host/source-aliases.cjs +345 -0
  20. package/core/server/host/source-aliases.ts +32 -0
  21. package/core/server/host/source-packages.cjs +1 -0
  22. package/core/server/infra/cache/ServerFileCache.ts +4 -1
  23. package/core/server/node.ts +10 -0
  24. package/core/server/runtime-space/inject.ts +4 -1
  25. package/core/shared/core-diagnostic-codes.ts +6 -0
  26. package/core/shared/data-declaration-checks.ts +29 -3
  27. package/core/shared/registry-generated/diagnostic-registry-index.ts +5 -0
  28. package/core/shared/registry-generated/diagnostic-registry.ts +35 -0
  29. package/core/shared/registry-generated/limits.ts +18 -2
  30. package/core/shared/registry-generated/std-grammar.ts +1 -1
  31. package/core/shared/types/data-config.types.ts +3 -1
  32. package/core/shared/types/event.types.ts +9 -0
  33. package/dist/browser/soma-runtime.js +169 -19
  34. package/dist/core/index.cjs +190 -19
  35. package/dist/host-native/aot-builder.cjs +284 -0
  36. package/dist/host-native/native-server.cjs +344 -10
  37. package/dist/lsp/component-tree.cjs +66 -10
  38. package/dist/types/client/container/IContainerAdapter.d.ts +3 -0
  39. package/dist/types/client/container/SomaContainerAdapter.d.ts +5 -0
  40. package/dist/types/client/data/data-object-resolver.d.ts +2 -0
  41. package/dist/types/client/parser/confirm-spec.d.ts +27 -3
  42. package/dist/types/client/render-ports/hide-transition.d.ts +9 -0
  43. package/dist/types/client/render-ports/index.d.ts +4 -0
  44. package/dist/types/client/render-ports/notify-renderer.d.ts +2 -1
  45. package/dist/types/index.d.ts +4 -4
  46. package/dist/types/server/api/paged-list.d.ts +101 -0
  47. package/dist/types/server/host/source-aliases.d.cts +53 -0
  48. package/dist/types/server/host/source-aliases.d.ts +30 -0
  49. package/dist/types/server/host/source-packages.d.cts +2 -0
  50. package/dist/types/server/node.d.ts +1 -0
  51. package/dist/types/shared/core-diagnostic-codes.d.ts +1 -1
  52. package/dist/types/shared/registry-generated/diagnostic-registry.d.ts +30 -0
  53. package/dist/types/shared/registry-generated/limits.d.ts +14 -0
  54. package/dist/types/shared/registry-generated/std-grammar.d.ts +1 -1
  55. package/dist/types/shared/types/data-config.types.d.ts +3 -1
  56. package/dist/types/shared/types/event.types.d.ts +8 -0
  57. package/host-native/src/aot-builder.ts +23 -0
  58. package/host-native/styles/globals.css +30 -28
  59. package/package.json +13 -2
@@ -242,6 +242,7 @@ module.exports = {
242
242
  SOMA_SOURCE_PACKAGES_ENV,
243
243
  getSomaHostSourceRoot,
244
244
  getSomaHostApiRoot,
245
+ resolveSafeChildRoot,
245
246
  clearSomaAssetSourcesCache,
246
247
  getSomaAssetSources,
247
248
  listSomaSourcePackageNames,
@@ -1,4 +1,4 @@
1
- import { readFileSync, readdirSync, watch, type FSWatcher } from 'fs';
1
+ import { readFileSync, readdirSync, statSync, watch, type FSWatcher } from 'fs';
2
2
  import { resolve, extname, normalize, sep } from 'path';
3
3
  import { SOMA_PIPELINE_LIMITS } from '../../../shared/registry-generated/limits';
4
4
 
@@ -223,6 +223,9 @@ export class ServerFileCache {
223
223
  if (this.isWatching(resolvedRoot) || this.unwatchableRoots.has(resolvedRoot)) return;
224
224
 
225
225
  try {
226
+ // Node 24 / Linux 的递归监听对不存在的目录不再同步抛 ENOENT(静默成功却永不投递事件),
227
+ // 缓存会因此长期服务旧内容;先显式探测,使「根不存在」与旧行为一样走失败登记 + 绕过缓存。
228
+ statSync(resolvedRoot);
226
229
  const watcher = watch(resolvedRoot, { recursive: true }, (_event, filename) => {
227
230
  // 监听投递过变更回调,证明它在工作:此前的失败计数作废
228
231
  this.watchFailures.delete(resolvedRoot);
@@ -30,6 +30,16 @@ export {
30
30
  type SomaSourcePageEntry,
31
31
  } from "./host/source-packages";
32
32
 
33
+ // 源码根别名(`package.json#soma.sourceRoots`,单实现 source-aliases.cjs)
34
+ export {
35
+ getSomaSourceRootAliases,
36
+ resolveSomaSourceRoots,
37
+ somaViteAliases,
38
+ somaViteHostAliases,
39
+ type SomaSourceRootDiagnostic,
40
+ type SomaSourceRootResolution,
41
+ } from "./host/source-aliases";
42
+
33
43
  // 页面资产与页面标记配置
34
44
  export {
35
45
  loadSomaServerPageAssets,
@@ -15,6 +15,7 @@ import { looksLikeBlockDeclaration } from '../../shared/declaration-keys';
15
15
  import { domainStaticOnlyHint } from '../../client/mount/domain-rule';
16
16
  import { parseAddress, validateAddressText } from '../../shared/runtime-address';
17
17
  import { SOMA_PAGE_FORMAT_VERSION } from '../../shared/page-envelope';
18
+ import { SOMA_PIPELINE_LIMITS } from '../../shared/registry-generated/limits';
18
19
  import { bindingStorageKey, computeStandardPageDigest } from './digest';
19
20
  import { evictArtifactsOfUrl } from './artifact-evict';
20
21
  import { assertNavCapacity } from './nav-catalog';
@@ -390,8 +391,10 @@ export function injectMany(entries: readonly SomaInjectManyEntry[], options: Som
390
391
  });
391
392
  if (failures.length > 0 && atomic) {
392
393
  restoreSpace(snapshot);
394
+ const maxChars = SOMA_PIPELINE_LIMITS.inject.batchFailureMessageMaxChars;
393
395
  throw runtimeError('CORE-RUNTIME-BATCH', `批量注入 ${entries.length} 页`,
394
- `${failures.length} 条失败,整批未生效:${failures.map((item) => `#${item.index} ${item.address} ${item.code}`).join(';')}`,
396
+ // 每条失败带上原因摘要(截断),否则只见错误码、无从定位是哪个键 / 哪条绑定越界
397
+ `${failures.length} 条失败,整批未生效:${failures.map((item) => `#${item.index} ${item.address} ${item.code}(${item.message.length > maxChars ? `${item.message.slice(0, maxChars)}…` : item.message})`).join(';')}`,
395
398
  '逐条修复后整批重试', { failures });
396
399
  }
397
400
  const attempted: string[] = [];
@@ -95,6 +95,12 @@ export const SOMA_CORE_DIAGNOSTIC_CODES = [
95
95
  'CORE-TEMPORAL-PARSE', // 时间:文本解析失败
96
96
  'CORE-TEMPORAL-NOT-READY', // 时间:ready() 前调同步方法
97
97
  'CORE-TEMPORAL-ZONE', // 时间:时区标识非法
98
+ // 宿主源码别名(产生点 core/server/host/source-aliases.cjs,CJS 不能 import 本表,码字面量两处各一份,由本表对账测试与注册表一致)
99
+ 'CORE-HOST-ALIAS-INVALID', // 别名声明形状不对 / 路径越界或不存在 / 别名名字非法(error)
100
+ 'CORE-HOST-ALIAS-RESERVED', // 别名占了保留名(soma / soma-*、server-only、node_modules、带子路径的 Node 内置)(error)
101
+ 'CORE-HOST-ALIAS-SHADOW', // 宿主 node_modules/<别名> 已存在且不是指向别名目录的软链(warning,别名仍生效)
102
+ 'CORE-HOST-ALIAS-DUPLICATE', // 多个源码根里同名别名,先声明者胜(warning)
103
+ 'CORE-HOST-ALIAS-TSCONFIG-DRIFT', // tsconfig.json 的 baseUrl 与第一个源码根不一致(warning)
98
104
  'CORE-DND-SPEC', // 拖放:getData 返回非对象 / 同元素重复登记
99
105
  'CORE-ALGO-DIFF-INPUT', // 算法:diff 输入超限
100
106
  'CORE-ALGO-QR-CAPACITY', // 算法:二维码内容超容量
@@ -184,14 +184,18 @@ export function inspectSourceRequire(raw: unknown, paramNames: readonly string[]
184
184
  }
185
185
  const issues: SomaObjectIssue[] = [];
186
186
  const seen = new Set<string>();
187
- raw.forEach((name, index) => {
188
- const at = `require[${index}]`;
187
+ const checkName = (name: unknown, at: string, inGroup: boolean): void => {
189
188
  if (typeof name !== 'string' || name.trim() === '') {
190
189
  issues.push({ path: at, message: `require 里的参数名必须是非空字符串,当前值: ${show(name)}` });
191
190
  return;
192
191
  }
193
192
  if (seen.has(name)) {
194
- issues.push({ path: at, message: `require 里有重复的参数名 "${name}"` });
193
+ issues.push({
194
+ path: at,
195
+ message: inGroup
196
+ ? `require 里有重复的参数名 "${name}"(同名不能在单项与分组里、或两个分组里重复出现)`
197
+ : `require 里有重复的参数名 "${name}"`,
198
+ });
195
199
  return;
196
200
  }
197
201
  seen.add(name);
@@ -201,6 +205,28 @@ export function inspectSourceRequire(raw: unknown, paramNames: readonly string[]
201
205
  message: `require 里的 "${name}" 没有出现在同一来源的 params 里(params 有: ${paramNames.join(' / ') || '无'})`,
202
206
  });
203
207
  }
208
+ };
209
+ raw.forEach((entry, index) => {
210
+ const at = `require[${index}]`;
211
+ if (!Array.isArray(entry)) {
212
+ checkName(entry, at, false);
213
+ return;
214
+ }
215
+ if (entry.length < 2) {
216
+ issues.push({
217
+ path: at,
218
+ message: `require 里的「至少一个」分组至少要 2 个参数名(单个参数直接写名字),当前值: ${show(entry)}`,
219
+ });
220
+ return;
221
+ }
222
+ entry.forEach((member, memberIndex) => {
223
+ const memberAt = `${at}[${memberIndex}]`;
224
+ if (Array.isArray(member)) {
225
+ issues.push({ path: memberAt, message: `require 的分组只许一层,不能再嵌套数组,当前值: ${show(member)}` });
226
+ return;
227
+ }
228
+ checkName(member, memberAt, true);
229
+ });
204
230
  });
205
231
  return issues;
206
232
  }
@@ -65,6 +65,11 @@ export const SOMA_DIAGNOSTIC_CODE_INDEX: readonly (readonly [code: string, famil
65
65
  ['CORE-DATA-FORBIDDEN', 'CORE', 'core', 'warn'],
66
66
  ['CORE-DATA-REQUIRE', 'CORE', 'core', 'error'],
67
67
  ['CORE-DATA-RELATION', 'CORE', 'core', 'warn'],
68
+ ['CORE-HOST-ALIAS-INVALID', 'CORE', 'core', 'error'],
69
+ ['CORE-HOST-ALIAS-RESERVED', 'CORE', 'core', 'error'],
70
+ ['CORE-HOST-ALIAS-SHADOW', 'CORE', 'core', 'warn'],
71
+ ['CORE-HOST-ALIAS-DUPLICATE', 'CORE', 'core', 'warn'],
72
+ ['CORE-HOST-ALIAS-TSCONFIG-DRIFT', 'CORE', 'core', 'warn'],
68
73
  ['CORE-DND-SPEC', 'CORE', 'core', 'error'],
69
74
  ['CORE-DRAFT-DEFAULT-INVALID', 'CORE', 'core', 'warn'],
70
75
  ['CORE-ENGINE-ADAPTER', 'CORE', 'core', 'error'],
@@ -518,6 +518,41 @@ export const SOMA_PIPELINE_DIAGNOSTIC_REGISTRY = {
518
518
  "severity": "warn",
519
519
  "owner": "soma-core/core/shared/core-diagnostic-codes.ts"
520
520
  },
521
+ {
522
+ "code": "CORE-HOST-ALIAS-INVALID",
523
+ "family": "CORE",
524
+ "stage": "core",
525
+ "severity": "error",
526
+ "owner": "soma-core/core/server/host/source-aliases.cjs"
527
+ },
528
+ {
529
+ "code": "CORE-HOST-ALIAS-RESERVED",
530
+ "family": "CORE",
531
+ "stage": "core",
532
+ "severity": "error",
533
+ "owner": "soma-core/core/server/host/source-aliases.cjs"
534
+ },
535
+ {
536
+ "code": "CORE-HOST-ALIAS-SHADOW",
537
+ "family": "CORE",
538
+ "stage": "core",
539
+ "severity": "warn",
540
+ "owner": "soma-core/core/server/host/source-aliases.cjs"
541
+ },
542
+ {
543
+ "code": "CORE-HOST-ALIAS-DUPLICATE",
544
+ "family": "CORE",
545
+ "stage": "core",
546
+ "severity": "warn",
547
+ "owner": "soma-core/core/server/host/source-aliases.cjs"
548
+ },
549
+ {
550
+ "code": "CORE-HOST-ALIAS-TSCONFIG-DRIFT",
551
+ "family": "CORE",
552
+ "stage": "core",
553
+ "severity": "warn",
554
+ "owner": "soma-core/core/server/host/source-aliases.cjs"
555
+ },
521
556
  {
522
557
  "code": "CORE-DND-SPEC",
523
558
  "family": "CORE",
@@ -130,6 +130,11 @@ export const SOMA_PIPELINE_LIMITS = {
130
130
  "file": "core/server/registry/registry-file-lock.ts",
131
131
  "symbol": "SOMA_PIPELINE_LIMITS"
132
132
  },
133
+ {
134
+ "module": "soma-core",
135
+ "file": "core/server/api/paged-list.ts",
136
+ "symbol": "SOMA_PIPELINE_LIMITS"
137
+ },
133
138
  {
134
139
  "module": "soma-core",
135
140
  "file": "core/server/registry/registry-write-pipeline.ts",
@@ -145,6 +150,11 @@ export const SOMA_PIPELINE_LIMITS = {
145
150
  "file": "core/server/registry/source/version-store.ts",
146
151
  "symbol": "SOMA_PIPELINE_LIMITS"
147
152
  },
153
+ {
154
+ "module": "soma-core",
155
+ "file": "core/server/runtime-space/inject.ts",
156
+ "symbol": "SOMA_PIPELINE_LIMITS"
157
+ },
148
158
  {
149
159
  "module": "soma-ui",
150
160
  "file": "src/compiler/bdl/registry/archive.ts",
@@ -493,7 +503,8 @@ export const SOMA_PIPELINE_LIMITS = {
493
503
  "watchFailLimit": 2,
494
504
  "serverFileMaxEntries": 512,
495
505
  "serverFileMaxBytes": 33554432,
496
- "serverDirMaxEntries": 256
506
+ "serverDirMaxEntries": 256,
507
+ "sourceRootAliasCapacity": 64
497
508
  },
498
509
  "runtimeCache": {
499
510
  "basis": "runtime 空间 L1 内存 LRU 的条目容量(编译结果与标准格式产物各一条目)与静态页地址清单的开发态复核间隔;容量不小于发布页产物缓存容量(cache.publishedArtifactCapacity),因为 L1 要容得下已发布页加上运行期按 URL 注入的页;复核间隔让新增静态页最迟这个毫秒数后进入写入期冲突判定(生产态不过期)。迁入前是 soma-core store.ts 的 SOMA_RUNTIME_CACHE_ENTRIES_DEFAULT 与 static-source.ts 的 DEV_TTL_MS",
@@ -511,6 +522,10 @@ export const SOMA_PIPELINE_LIMITS = {
511
522
  "maxWaitMs": 5000,
512
523
  "waitSliceMs": 15
513
524
  },
525
+ "pagedList": {
526
+ "pageSizeDefault": 10,
527
+ "pageSizeMax": 500
528
+ },
514
529
  "writeRate": {
515
530
  "limit": 120,
516
531
  "windowMs": 60000
@@ -521,7 +536,8 @@ export const SOMA_PIPELINE_LIMITS = {
521
536
  "defaultDebounceMs": 300
522
537
  },
523
538
  "inject": {
524
- "pageMaxBytes": 4194304
539
+ "pageMaxBytes": 4194304,
540
+ "batchFailureMessageMaxChars": 2000
525
541
  },
526
542
  "execution": {
527
543
  "maxNodes": 128,
@@ -60,7 +60,7 @@ export const SOMA_PIPELINE_STD_GRAMMAR = {
60
60
  { "id": "predicate-rule-ops", "domain": "predicate-ops", "values": ["eq", "ne", "gt", "gte", "lt", "lte", "contains", "starts_with", "ends_with", "matches", "empty", "not_empty", "between", "in", "not_in", "in_last", "in_next"], "note": "规则编辑表达得了的算子(AD-83):单值、无值、区间(between,值是两端 [lo, hi])、多值(in / not_in,值是列表);业界规则构建器都有区间与多值。in_last / in_next 的值是单个 { n, unit } 窗口(O17 需求,只对 dated 族字段出现)" }
61
61
  ],
62
62
  "keys": [
63
- { "id": "object.from", "context": "object", "key": "from", "order": 1, "origin": "base", "surface": ["standard"], "value": { "kind": "list", "of": "shape" }, "default": null, "sample": { "value": [{ "api": "/api/orders" }], "with": { "mock": { "items": [{ "no": "A1" }] } } }, "carry": { "transform": "ObjectFrom" }, "prop": "from", "authScan": [{ "path": ["api"], "each": true, "bareString": true, "rank": 1 }], "carriesTo": [{ "path": [{ "stage": "core-config", "prop": "SomaDataObjectConfig.from" }], "terminal": { "kind": "consumed", "readers": ["soma-core/core/client/data/"] } }, { "path": [{ "stage": "core-config", "prop": "SomaDataObjectConfig.from" }, { "stage": "facts", "prop": "SomaObjectFacts.hasSource" }], "terminal": { "kind": "consumed", "readers": ["soma-ui/src/compiler/need/families/", "soma-ui/src/compiler/need/verb-resolver.ts"] } }], "effect": { "changes": ["fact"] }, "docSummary": "集合读取", "violations": [{ "kind": "api-unregistered", "code": "ERR-BIZ-002" }], "status": "implemented", "note": "from[] 项键:api / params / into / require。require 是必填参数名数组(非空、无重复、都必须出现在同一项 params 里,违者 CORE-DATA-REQUIRE):任一必填参数解析后为 null / undefined / 空串时跳过这次请求,该来源不并入对象(写了 into 的子键落空数组),对象读状态为 idle(数据端口 getObjectStatus),不是错误;每次解析 / 重取重新判定。写入型对象:没有 from 但声明了 write 的 create / update / delete 至少一个端点是合法的(建单表单、登录、导入、联动目标):取数跳过、落空对象 {}、读状态 idle,data.submit 照常,write.reload 点名它时跳过重取;既无 from 也无写端点报「缺少 from 取数来源」(判定 data-config-parser.ts parseObject,测试 data-config-parser.test.ts 含负样本)" },
63
+ { "id": "object.from", "context": "object", "key": "from", "order": 1, "origin": "base", "surface": ["standard"], "value": { "kind": "list", "of": "shape" }, "default": null, "sample": { "value": [{ "api": "/api/orders" }], "with": { "mock": { "items": [{ "no": "A1" }] } } }, "carry": { "transform": "ObjectFrom" }, "prop": "from", "authScan": [{ "path": ["api"], "each": true, "bareString": true, "rank": 1 }], "carriesTo": [{ "path": [{ "stage": "core-config", "prop": "SomaDataObjectConfig.from" }], "terminal": { "kind": "consumed", "readers": ["soma-core/core/client/data/"] } }, { "path": [{ "stage": "core-config", "prop": "SomaDataObjectConfig.from" }, { "stage": "facts", "prop": "SomaObjectFacts.hasSource" }], "terminal": { "kind": "consumed", "readers": ["soma-ui/src/compiler/need/families/", "soma-ui/src/compiler/need/verb-resolver.ts"] } }], "effect": { "changes": ["fact"] }, "docSummary": "集合读取", "violations": [{ "kind": "api-unregistered", "code": "ERR-BIZ-002" }], "status": "implemented", "note": "from[] 项键:api / params / into / require。require 是必填参数名数组(非空、无重复、都必须出现在同一项 params 里,违者 CORE-DATA-REQUIRE);元素也可以是「至少一个」分组:2 个及以上不同参数名的数组,如 [[changeId, deliverableId]],可与单名混写,只此一层、不嵌套、同名不得跨单项与分组或两个分组重复:任一必填单名解析后为 null / undefined / 空串、或任一分组的成员全部为空时跳过这次请求,该来源不并入对象(写了 into 的子键落空数组),对象读状态为 idle(数据端口 getObjectStatus),不是错误;每次解析 / 重取重新判定。写入型对象:没有 from 但声明了 write 的 create / update / delete 至少一个端点是合法的(建单表单、登录、导入、联动目标):取数跳过、落空对象 {}、读状态 idle,data.submit 照常,write.reload 点名它时跳过重取;既无 from 也无写端点报「缺少 from 取数来源」(判定 data-config-parser.ts parseObject,测试 data-config-parser.test.ts 含负样本)" },
64
64
  { "id": "poll.every", "context": "poll", "key": "every", "order": 1, "surface": ["standard"], "value": { "kind": "int", "min": 2, "max": 300, "unit": "秒" }, "default": null, "sample": { "value": 5 }, "status": "implemented", "carriesTo": [{ "path": [{ "stage": "core-config", "prop": "SomaObjectPoll.every" }], "terminal": { "kind": "consumed", "readers": ["soma-ui/src/compiler/driver/data-facts.ts"] } }], "effect": { "changes": ["artifact"] }, "docSummary": "轮询间隔(2..300 的整数秒)" },
65
65
  { "id": "poll.while.field", "context": "poll.while", "key": "field", "order": 1, "surface": ["standard"], "value": { "kind": "string" }, "default": null, "sample": { "value": "status" }, "status": "implemented", "carriesTo": [{ "path": [{ "stage": "core-config", "carrier": "SomaObjectPoll.while", "name": "field" }], "terminal": { "kind": "consumed", "readers": ["soma-ui/src/compiler/driver/data-facts.ts", "soma-ui/src/data-kit/poll.ts"] } }], "effect": { "changes": ["artifact"] }, "docSummary": "看哪个字段(roles.status 字段或枚举字段)" },
66
66
  { "id": "write.create", "context": "write", "key": "create", "order": 1, "surface": ["standard"], "value": { "kind": "shape", "shape": "write-endpoint" }, "default": null, "sample": { "value": { "api": "/api/o", "method": "post" } }, "status": "implemented", "carriesTo": [{ "path": [{ "stage": "core-config", "prop": "SomaDataWriteConfig.create" }], "terminal": { "kind": "consumed", "readers": ["soma-core/core/client/data/", "soma-ui/src/compiler/compose/families/"] } }], "effect": { "changes": ["artifact", "runtime"] }, "docSummary": "写通道", "lsp": { "detail": "新建端点 { api, method: POST | PUT | PATCH }" } },
@@ -111,8 +111,10 @@ export interface SomaDataSourceConfig {
111
111
  * 必填参数名(都必须出现在同一项的 `params` 里):任一必填参数解析后为 null / undefined / 空串时跳过本次请求,
112
112
  * 该来源不并入对象(写了 `into` 的子键落空数组),对象标 `idle`(数据端口 `getObjectStatus`);不是错误。
113
113
  * 每次解析 / 重取都重新判定,参数补齐后的下一次重取就会发请求。
114
+ * 元素也可以是「至少一个」分组:2 个及以上不同参数名的数组(如 `[[changeId, deliverableId]]`),
115
+ * 组内全部为空才跳过;单名字符串与分组可混写。只此一层,不嵌套、不取反、不表达「恰好一个」。
114
116
  */
115
- require?: string[];
117
+ require?: Array<string | string[]>;
116
118
  /** 响应信封失败判定:HTTP 成功但响应体命中此闭集谓词即按取数失败(字段是响应体顶层键,深取用 `path`) */
117
119
  failWhen?: SomaFieldPredicate;
118
120
  /** 命中 failWhen 时,业务错误信息在响应体里的点路径 */
@@ -65,6 +65,10 @@ export interface NotifyDeclaration {
65
65
  export const SOMA_CONFIRM_LEVELS = ['plain', 'typed', 'consent'] as const;
66
66
  export type SomaConfirmLevel = (typeof SOMA_CONFIRM_LEVELS)[number];
67
67
 
68
+ /** 确认语气闭集:default 常规 / danger 破坏性(删除等)。中性词,不规定样子;缺省 = default */
69
+ export const SOMA_CONFIRM_TONES = ['default', 'danger'] as const;
70
+ export type SomaConfirmTone = (typeof SOMA_CONFIRM_TONES)[number];
71
+
68
72
  /** 确认规格:`confirm:` 段的标准结构 */
69
73
  export interface SomaConfirmSpec {
70
74
  readonly level: SomaConfirmLevel;
@@ -74,6 +78,11 @@ export interface SomaConfirmSpec {
74
78
  readonly phrase?: string;
75
79
  /** 关联项影响说明;consent 级必写,typed 级可选 */
76
80
  readonly impact?: string;
81
+ /**
82
+ * 语气:只有 `danger` 会出现(`default` / 不写 = 常规,解析时归一为不带本字段)。
83
+ * 渲染端口据它决定确认钮的警示呈现与初始焦点(破坏性确认的初始焦点应在「取消」);typed / consent 的放行规则不受它影响。
84
+ */
85
+ readonly tone?: Exclude<SomaConfirmTone, 'default'>;
77
86
  }
78
87
 
79
88
  /**