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
@@ -311,6 +311,7 @@ var require_source_packages = __commonJS({
311
311
  SOMA_SOURCE_PACKAGES_ENV,
312
312
  getSomaHostSourceRoot: getSomaHostSourceRoot4,
313
313
  getSomaHostApiRoot: getSomaHostApiRoot4,
314
+ resolveSafeChildRoot: resolveSafeChildRoot2,
314
315
  clearSomaAssetSourcesCache: clearSomaAssetSourcesCache2,
315
316
  getSomaAssetSources: getSomaAssetSources3,
316
317
  listSomaSourcePackageNames: listSomaSourcePackageNames2,
@@ -441,6 +442,274 @@ var require_root = __commonJS({
441
442
  }
442
443
  });
443
444
 
445
+ // core/server/host/source-aliases.cjs
446
+ var require_source_aliases = __commonJS({
447
+ "core/server/host/source-aliases.cjs"(exports2, module2) {
448
+ "use strict";
449
+ var fs16 = require("node:fs");
450
+ var path18 = require("node:path");
451
+ var nodeModule2 = require("node:module");
452
+ var { getSomaHostApiRoot: getSomaHostApiRoot4, getSomaHostSourceRoot: getSomaHostSourceRoot4, resolveSafeChildRoot: resolveSafeChildRoot2 } = require_source_packages();
453
+ var CODE_INVALID = "CORE-HOST-ALIAS-INVALID";
454
+ var CODE_RESERVED = "CORE-HOST-ALIAS-RESERVED";
455
+ var CODE_SHADOW = "CORE-HOST-ALIAS-SHADOW";
456
+ var CODE_DUPLICATE = "CORE-HOST-ALIAS-DUPLICATE";
457
+ var CODE_TSCONFIG_DRIFT = "CORE-HOST-ALIAS-TSCONFIG-DRIFT";
458
+ var ALIAS_NAME_RE = /^[A-Za-z0-9_][A-Za-z0-9._-]*$/;
459
+ var RESERVED_NAMES = /* @__PURE__ */ new Set(["server-only", "node_modules", "soma"]);
460
+ var BUILTIN_WITH_SUBPATH = new Set(
461
+ nodeModule2.builtinModules.filter((m) => m.includes("/")).map((m) => m.slice(0, m.indexOf("/")))
462
+ );
463
+ var MAX_CACHE = 64;
464
+ var resolveCache = /* @__PURE__ */ new Map();
465
+ var warned = /* @__PURE__ */ new Set();
466
+ function clearSomaSourceRootCache() {
467
+ resolveCache.clear();
468
+ warned.clear();
469
+ }
470
+ function readJson2(filePath) {
471
+ try {
472
+ if (!fs16.existsSync(filePath)) return null;
473
+ return JSON.parse(fs16.readFileSync(filePath, "utf8"));
474
+ } catch {
475
+ return null;
476
+ }
477
+ }
478
+ function readTsconfig(filePath) {
479
+ let raw;
480
+ try {
481
+ raw = fs16.readFileSync(filePath, "utf8");
482
+ } catch {
483
+ return null;
484
+ }
485
+ const stripped = raw.replace(/("(?:\\.|[^"\\])*")|\/\/[^\n]*|\/\*[\s\S]*?\*\//g, (_m, str) => str ?? "").replace(/,(\s*[}\]])/g, "$1");
486
+ try {
487
+ return JSON.parse(stripped);
488
+ } catch {
489
+ return null;
490
+ }
491
+ }
492
+ function reservedReason(name) {
493
+ if (name === "soma" || name.startsWith("soma-")) return "\u4E0E soma \u516C\u5F00\u5305\u540D\u7A7A\u95F4\u51B2\u7A81";
494
+ if (RESERVED_NAMES.has(name)) return "\u662F\u4FDD\u7559\u540D";
495
+ if (BUILTIN_WITH_SUBPATH.has(name)) return `\u4F1A\u52AB\u6301 Node \u5185\u7F6E\u5B50\u8DEF\u5F84\uFF08\u5982 ${name}/...\uFF09`;
496
+ return null;
497
+ }
498
+ function realInside(parent, child) {
499
+ try {
500
+ const p = fs16.realpathSync(parent);
501
+ const c = fs16.realpathSync(child);
502
+ return c === p || c.startsWith(`${p}${path18.sep}`);
503
+ } catch {
504
+ return false;
505
+ }
506
+ }
507
+ function resolveSomaSourceRoots2(hostDir, env = process.env) {
508
+ let normalizedHostDir = path18.resolve(hostDir);
509
+ if (!fs16.existsSync(path18.join(normalizedHostDir, "package.json"))) {
510
+ for (let dir = path18.dirname(normalizedHostDir); ; dir = path18.dirname(dir)) {
511
+ if (fs16.existsSync(path18.join(dir, "package.json"))) {
512
+ normalizedHostDir = dir;
513
+ break;
514
+ }
515
+ if (path18.dirname(dir) === dir) break;
516
+ }
517
+ }
518
+ const packageJsonPath = path18.join(normalizedHostDir, "package.json");
519
+ const stat = fs16.statSync(packageJsonPath, { throwIfNoEntry: false });
520
+ const cacheKey = `${normalizedHostDir}\0${env?.SOMA_API_DIR ?? ""}\0${env?.SOMA_WEB_DIR ?? ""}\0${stat ? `${stat.mtimeMs}:${stat.size}` : "none"}`;
521
+ const cached = resolveCache.get(cacheKey);
522
+ if (cached) return cached;
523
+ const result = compute(normalizedHostDir, env, readJson2(packageJsonPath));
524
+ if (resolveCache.size >= MAX_CACHE) resolveCache.delete(resolveCache.keys().next().value);
525
+ resolveCache.set(cacheKey, result);
526
+ return result;
527
+ }
528
+ function compute(hostDir, env, packageJson) {
529
+ const diagnostics = [];
530
+ const raw = packageJson?.soma?.sourceRoots;
531
+ const empty = { declared: false, entries: [], aliases: {}, diagnostics };
532
+ if (raw === void 0 || raw === null) return empty;
533
+ const invalid2 = (message4) => diagnostics.push({ code: CODE_INVALID, severity: "error", message: `soma.sourceRoots ${message4}` });
534
+ const candidates = [];
535
+ let firstRoot = null;
536
+ const addRoot = (rootDir) => {
537
+ if (firstRoot === null) firstRoot = rootDir;
538
+ let children;
539
+ try {
540
+ children = fs16.readdirSync(rootDir, { withFileTypes: true });
541
+ } catch {
542
+ invalid2(`\u7684\u6E90\u7801\u6839\u4E0D\u53EF\u8BFB\uFF1A${rootDir}`);
543
+ return;
544
+ }
545
+ for (const entry of children.sort((a, b) => a.name.localeCompare(b.name))) {
546
+ const full = path18.join(rootDir, entry.name);
547
+ const isDir = entry.isDirectory() || entry.isSymbolicLink() && fs16.statSync(full, { throwIfNoEntry: false })?.isDirectory();
548
+ if (!isDir || entry.name.startsWith(".") || entry.name === "node_modules" || !ALIAS_NAME_RE.test(entry.name)) continue;
549
+ candidates.push({ name: entry.name, dir: full });
550
+ }
551
+ };
552
+ const safeRoot = (rel) => {
553
+ if (typeof rel !== "string" || !rel.trim() || rel.includes("\0")) {
554
+ invalid2("\u7684\u8DEF\u5F84\u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32");
555
+ return null;
556
+ }
557
+ const resolved = path18.resolve(hostDir, rel.trim());
558
+ const safe = resolveSafeChildRoot2(hostDir, rel);
559
+ if (safe !== resolved || !fs16.existsSync(safe) || !fs16.statSync(safe).isDirectory() || !realInside(hostDir, safe)) {
560
+ invalid2(`\u7684\u8DEF\u5F84 "${rel}" \u5FC5\u987B\u662F\u5BBF\u4E3B\u76EE\u5F55\u5185\u5DF2\u5B58\u5728\u7684\u76EE\u5F55`);
561
+ return null;
562
+ }
563
+ return safe;
564
+ };
565
+ if (raw === "auto") {
566
+ const apiRoot = getSomaHostApiRoot4(hostDir, env);
567
+ addRoot(apiRoot);
568
+ } else if (typeof raw === "string" || Array.isArray(raw)) {
569
+ for (const rel of Array.isArray(raw) ? raw : [raw]) {
570
+ const root = safeRoot(rel);
571
+ if (root) addRoot(root);
572
+ }
573
+ } else if (typeof raw === "object") {
574
+ for (const [name, rel] of Object.entries(raw)) {
575
+ if (!ALIAS_NAME_RE.test(name)) {
576
+ diagnostics.push({ code: CODE_INVALID, severity: "error", name, message: `\u522B\u540D "${name}" \u4E0D\u5408\u6CD5\uFF08\u53EA\u5141\u8BB8\u5B57\u6BCD\u6570\u5B57 _ . -\uFF0C\u4E14\u4E0D\u542B\u659C\u6760\uFF09` });
577
+ continue;
578
+ }
579
+ const dir = safeRoot(rel);
580
+ if (dir) candidates.push({ name, dir });
581
+ }
582
+ } else {
583
+ invalid2('\u5FC5\u987B\u662F "auto"\u3001\u76EE\u5F55\u5B57\u7B26\u4E32\u3001\u5B57\u7B26\u4E32\u6570\u7EC4\u6216\u300C\u522B\u540D \u2192 \u76EE\u5F55\u300D\u5BF9\u8C61');
584
+ return { ...empty, declared: true };
585
+ }
586
+ const entries = [];
587
+ const taken = /* @__PURE__ */ new Map();
588
+ for (const candidate of candidates) {
589
+ const reason = reservedReason(candidate.name);
590
+ if (reason) {
591
+ diagnostics.push({
592
+ code: CODE_RESERVED,
593
+ severity: "error",
594
+ name: candidate.name,
595
+ message: `\u6E90\u7801\u6839\u522B\u540D "${candidate.name}" ${reason}\uFF0C\u8BF7\u628A\u8BE5\u76EE\u5F55\u6539\u540D\u6216\u79FB\u51FA\u6E90\u7801\u6839`
596
+ });
597
+ continue;
598
+ }
599
+ if (taken.has(candidate.name)) {
600
+ diagnostics.push({
601
+ code: CODE_DUPLICATE,
602
+ severity: "warning",
603
+ name: candidate.name,
604
+ message: `\u6E90\u7801\u6839\u522B\u540D "${candidate.name}" \u540C\u65F6\u51FA\u73B0\u5728 ${taken.get(candidate.name)} \u4E0E ${candidate.dir}\uFF0C\u5148\u58F0\u660E\u8005\u751F\u6548`
605
+ });
606
+ continue;
607
+ }
608
+ taken.set(candidate.name, candidate.dir);
609
+ entries.push(candidate);
610
+ }
611
+ for (const { name, dir } of entries) {
612
+ const installed = path18.join(hostDir, "node_modules", name);
613
+ const installedStat = fs16.lstatSync(installed, { throwIfNoEntry: false });
614
+ if (!installedStat) continue;
615
+ let same2 = false;
616
+ try {
617
+ same2 = fs16.realpathSync(installed) === fs16.realpathSync(dir);
618
+ } catch {
619
+ same2 = false;
620
+ }
621
+ if (!same2) {
622
+ diagnostics.push({
623
+ code: CODE_SHADOW,
624
+ severity: "warning",
625
+ name,
626
+ message: `\u6E90\u7801\u6839\u522B\u540D "${name}" \u906E\u853D\u4E86\u5DF2\u5B89\u88C5\u7684\u5305 node_modules/${name}\uFF1A\u5BBF\u4E3B\u4EE3\u7801\u91CC\u7684 "${name}/..." \u4E00\u5F8B\u89E3\u6790\u5230 ${dir}\uFF08\u58F0\u660E\u7684\u522B\u540D\u4F18\u5148\u4E8E\u5DF2\u88C5\u5305\uFF09`
627
+ });
628
+ }
629
+ }
630
+ if (firstRoot !== null) {
631
+ const tsconfig = readTsconfig(path18.join(hostDir, "tsconfig.json"));
632
+ const baseUrl = tsconfig?.compilerOptions?.baseUrl;
633
+ if (typeof baseUrl === "string" && path18.resolve(hostDir, baseUrl) !== path18.resolve(firstRoot)) {
634
+ diagnostics.push({
635
+ code: CODE_TSCONFIG_DRIFT,
636
+ severity: "warning",
637
+ message: `tsconfig.json \u7684 baseUrl\uFF08${baseUrl}\uFF09\u4E0E soma.sourceRoots \u7684\u6E90\u7801\u6839\uFF08${path18.relative(hostDir, firstRoot) || "."}\uFF09\u4E0D\u4E00\u81F4\uFF1A\u7F16\u8F91\u5668\u4E0E\u8FD0\u884C\u671F\u4F1A\u89E3\u6790\u5230\u4E0D\u540C\u76EE\u5F55`
638
+ });
639
+ }
640
+ }
641
+ const aliases = {};
642
+ for (const { name, dir } of entries) aliases[name] = dir;
643
+ return { declared: true, entries, aliases, diagnostics };
644
+ }
645
+ function formatDiagnostic(d) {
646
+ return `[soma-core][${d.code}] ${d.message}`;
647
+ }
648
+ function getSomaSourceRootAliases3(hostDir, env = process.env) {
649
+ const resolved = resolveSomaSourceRoots2(hostDir, env);
650
+ const errors = resolved.diagnostics.filter((d) => d.severity === "error");
651
+ if (errors.length > 0) {
652
+ const error = new Error(errors.map(formatDiagnostic).join("\n"));
653
+ error.code = errors[0].code;
654
+ error.diagnostics = errors;
655
+ throw error;
656
+ }
657
+ for (const d of resolved.diagnostics) {
658
+ const key = `${path18.resolve(hostDir)}\0${d.code}\0${d.name ?? ""}\0${d.message}`;
659
+ if (warned.has(key)) continue;
660
+ warned.add(key);
661
+ console.warn(`[soma-core][\u5F15\u64CE] ${d.code} ${d.message}`);
662
+ }
663
+ return { ...resolved.aliases };
664
+ }
665
+ function matchSomaSourceRoot(aliases, specifier) {
666
+ if (typeof specifier !== "string") return null;
667
+ const slash = specifier.indexOf("/");
668
+ if (slash <= 0) return null;
669
+ const name = specifier.slice(0, slash);
670
+ const dir = Object.prototype.hasOwnProperty.call(aliases, name) ? aliases[name] : void 0;
671
+ if (dir === void 0) return null;
672
+ return { name, dir, subpath: specifier.slice(slash + 1) };
673
+ }
674
+ function somaSourceRootFilter(aliases) {
675
+ const names = Object.keys(aliases);
676
+ if (names.length === 0) return null;
677
+ return new RegExp(`^(?:${names.map((n) => n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|")})/`);
678
+ }
679
+ function somaViteAliases2(hostDir, env = process.env) {
680
+ return Object.entries(getSomaSourceRootAliases3(hostDir, env)).map(([name, dir]) => ({
681
+ find: new RegExp(`^${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}/`),
682
+ replacement: `${dir.split(path18.sep).join("/")}/`
683
+ }));
684
+ }
685
+ var HOST_BOOTSTRAP_SPECIFIER = "@soma-host/bootstrap/soma-bootstrap";
686
+ var HOST_BOOTSTRAP_CANDIDATES = ["soma-bootstrap.ts", "soma-bootstrap.js", "soma-bootstrap.mjs"];
687
+ function somaViteHostAliases2(hostDir, env = process.env) {
688
+ const sourceRoot = getSomaHostSourceRoot4(path18.resolve(hostDir), env);
689
+ const found = HOST_BOOTSTRAP_CANDIDATES.map((name) => path18.join(sourceRoot, "bootstrap", name)).find((file) => fs16.existsSync(file));
690
+ const target = found ?? path18.join(__dirname, "empty-host-bootstrap.mjs");
691
+ return [
692
+ ...somaViteAliases2(hostDir, env),
693
+ { find: new RegExp(`^${HOST_BOOTSTRAP_SPECIFIER}$`), replacement: target.split(path18.sep).join("/") }
694
+ ];
695
+ }
696
+ module2.exports = {
697
+ somaViteHostAliases: somaViteHostAliases2,
698
+ CODE_INVALID,
699
+ CODE_RESERVED,
700
+ CODE_SHADOW,
701
+ CODE_DUPLICATE,
702
+ CODE_TSCONFIG_DRIFT,
703
+ clearSomaSourceRootCache,
704
+ resolveSomaSourceRoots: resolveSomaSourceRoots2,
705
+ getSomaSourceRootAliases: getSomaSourceRootAliases3,
706
+ matchSomaSourceRoot,
707
+ somaSourceRootFilter,
708
+ somaViteAliases: somaViteAliases2
709
+ };
710
+ }
711
+ });
712
+
444
713
  // host-native/src/native-server.ts
445
714
  var native_server_exports = {};
446
715
  __export(native_server_exports, {
@@ -1933,6 +2202,17 @@ var SOMA_CORE_DIAGNOSTIC_CODES = [
1933
2202
  // 时间:ready() 前调同步方法
1934
2203
  "CORE-TEMPORAL-ZONE",
1935
2204
  // 时间:时区标识非法
2205
+ // 宿主源码别名(产生点 core/server/host/source-aliases.cjs,CJS 不能 import 本表,码字面量两处各一份,由本表对账测试与注册表一致)
2206
+ "CORE-HOST-ALIAS-INVALID",
2207
+ // 别名声明形状不对 / 路径越界或不存在 / 别名名字非法(error)
2208
+ "CORE-HOST-ALIAS-RESERVED",
2209
+ // 别名占了保留名(soma / soma-*、server-only、node_modules、带子路径的 Node 内置)(error)
2210
+ "CORE-HOST-ALIAS-SHADOW",
2211
+ // 宿主 node_modules/<别名> 已存在且不是指向别名目录的软链(warning,别名仍生效)
2212
+ "CORE-HOST-ALIAS-DUPLICATE",
2213
+ // 多个源码根里同名别名,先声明者胜(warning)
2214
+ "CORE-HOST-ALIAS-TSCONFIG-DRIFT",
2215
+ // tsconfig.json 的 baseUrl 与第一个源码根不一致(warning)
1936
2216
  "CORE-DND-SPEC",
1937
2217
  // 拖放:getData 返回非对象 / 同元素重复登记
1938
2218
  "CORE-ALGO-DIFF-INPUT",
@@ -2213,6 +2493,11 @@ var SOMA_PIPELINE_LIMITS = {
2213
2493
  "file": "core/server/registry/registry-file-lock.ts",
2214
2494
  "symbol": "SOMA_PIPELINE_LIMITS"
2215
2495
  },
2496
+ {
2497
+ "module": "soma-core",
2498
+ "file": "core/server/api/paged-list.ts",
2499
+ "symbol": "SOMA_PIPELINE_LIMITS"
2500
+ },
2216
2501
  {
2217
2502
  "module": "soma-core",
2218
2503
  "file": "core/server/registry/registry-write-pipeline.ts",
@@ -2228,6 +2513,11 @@ var SOMA_PIPELINE_LIMITS = {
2228
2513
  "file": "core/server/registry/source/version-store.ts",
2229
2514
  "symbol": "SOMA_PIPELINE_LIMITS"
2230
2515
  },
2516
+ {
2517
+ "module": "soma-core",
2518
+ "file": "core/server/runtime-space/inject.ts",
2519
+ "symbol": "SOMA_PIPELINE_LIMITS"
2520
+ },
2231
2521
  {
2232
2522
  "module": "soma-ui",
2233
2523
  "file": "src/compiler/bdl/registry/archive.ts",
@@ -2576,7 +2866,8 @@ var SOMA_PIPELINE_LIMITS = {
2576
2866
  "watchFailLimit": 2,
2577
2867
  "serverFileMaxEntries": 512,
2578
2868
  "serverFileMaxBytes": 33554432,
2579
- "serverDirMaxEntries": 256
2869
+ "serverDirMaxEntries": 256,
2870
+ "sourceRootAliasCapacity": 64
2580
2871
  },
2581
2872
  "runtimeCache": {
2582
2873
  "basis": "runtime \u7A7A\u95F4 L1 \u5185\u5B58 LRU \u7684\u6761\u76EE\u5BB9\u91CF\uFF08\u7F16\u8BD1\u7ED3\u679C\u4E0E\u6807\u51C6\u683C\u5F0F\u4EA7\u7269\u5404\u4E00\u6761\u76EE\uFF09\u4E0E\u9759\u6001\u9875\u5730\u5740\u6E05\u5355\u7684\u5F00\u53D1\u6001\u590D\u6838\u95F4\u9694\uFF1B\u5BB9\u91CF\u4E0D\u5C0F\u4E8E\u53D1\u5E03\u9875\u4EA7\u7269\u7F13\u5B58\u5BB9\u91CF\uFF08cache.publishedArtifactCapacity\uFF09\uFF0C\u56E0\u4E3A L1 \u8981\u5BB9\u5F97\u4E0B\u5DF2\u53D1\u5E03\u9875\u52A0\u4E0A\u8FD0\u884C\u671F\u6309 URL \u6CE8\u5165\u7684\u9875\uFF1B\u590D\u6838\u95F4\u9694\u8BA9\u65B0\u589E\u9759\u6001\u9875\u6700\u8FDF\u8FD9\u4E2A\u6BEB\u79D2\u6570\u540E\u8FDB\u5165\u5199\u5165\u671F\u51B2\u7A81\u5224\u5B9A\uFF08\u751F\u4EA7\u6001\u4E0D\u8FC7\u671F\uFF09\u3002\u8FC1\u5165\u524D\u662F soma-core store.ts \u7684 SOMA_RUNTIME_CACHE_ENTRIES_DEFAULT \u4E0E static-source.ts \u7684 DEV_TTL_MS",
@@ -2594,6 +2885,10 @@ var SOMA_PIPELINE_LIMITS = {
2594
2885
  "maxWaitMs": 5e3,
2595
2886
  "waitSliceMs": 15
2596
2887
  },
2888
+ "pagedList": {
2889
+ "pageSizeDefault": 10,
2890
+ "pageSizeMax": 500
2891
+ },
2597
2892
  "writeRate": {
2598
2893
  "limit": 120,
2599
2894
  "windowMs": 6e4
@@ -2604,7 +2899,8 @@ var SOMA_PIPELINE_LIMITS = {
2604
2899
  "defaultDebounceMs": 300
2605
2900
  },
2606
2901
  "inject": {
2607
- "pageMaxBytes": 4194304
2902
+ "pageMaxBytes": 4194304,
2903
+ "batchFailureMessageMaxChars": 2e3
2608
2904
  },
2609
2905
  "execution": {
2610
2906
  "maxNodes": 128,
@@ -3812,14 +4108,16 @@ function inspectSourceRequire(raw, paramNames) {
3812
4108
  }
3813
4109
  const issues = [];
3814
4110
  const seen = /* @__PURE__ */ new Set();
3815
- raw.forEach((name, index) => {
3816
- const at = `require[${index}]`;
4111
+ const checkName = (name, at, inGroup) => {
3817
4112
  if (typeof name !== "string" || name.trim() === "") {
3818
4113
  issues.push({ path: at, message: `require \u91CC\u7684\u53C2\u6570\u540D\u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${show(name)}` });
3819
4114
  return;
3820
4115
  }
3821
4116
  if (seen.has(name)) {
3822
- issues.push({ path: at, message: `require \u91CC\u6709\u91CD\u590D\u7684\u53C2\u6570\u540D "${name}"` });
4117
+ issues.push({
4118
+ path: at,
4119
+ message: inGroup ? `require \u91CC\u6709\u91CD\u590D\u7684\u53C2\u6570\u540D "${name}"\uFF08\u540C\u540D\u4E0D\u80FD\u5728\u5355\u9879\u4E0E\u5206\u7EC4\u91CC\u3001\u6216\u4E24\u4E2A\u5206\u7EC4\u91CC\u91CD\u590D\u51FA\u73B0\uFF09` : `require \u91CC\u6709\u91CD\u590D\u7684\u53C2\u6570\u540D "${name}"`
4120
+ });
3823
4121
  return;
3824
4122
  }
3825
4123
  seen.add(name);
@@ -3829,6 +4127,28 @@ function inspectSourceRequire(raw, paramNames) {
3829
4127
  message: `require \u91CC\u7684 "${name}" \u6CA1\u6709\u51FA\u73B0\u5728\u540C\u4E00\u6765\u6E90\u7684 params \u91CC\uFF08params \u6709: ${paramNames.join(" / ") || "\u65E0"}\uFF09`
3830
4128
  });
3831
4129
  }
4130
+ };
4131
+ raw.forEach((entry, index) => {
4132
+ const at = `require[${index}]`;
4133
+ if (!Array.isArray(entry)) {
4134
+ checkName(entry, at, false);
4135
+ return;
4136
+ }
4137
+ if (entry.length < 2) {
4138
+ issues.push({
4139
+ path: at,
4140
+ message: `require \u91CC\u7684\u300C\u81F3\u5C11\u4E00\u4E2A\u300D\u5206\u7EC4\u81F3\u5C11\u8981 2 \u4E2A\u53C2\u6570\u540D\uFF08\u5355\u4E2A\u53C2\u6570\u76F4\u63A5\u5199\u540D\u5B57\uFF09\uFF0C\u5F53\u524D\u503C: ${show(entry)}`
4141
+ });
4142
+ return;
4143
+ }
4144
+ entry.forEach((member, memberIndex) => {
4145
+ const memberAt = `${at}[${memberIndex}]`;
4146
+ if (Array.isArray(member)) {
4147
+ issues.push({ path: memberAt, message: `require \u7684\u5206\u7EC4\u53EA\u8BB8\u4E00\u5C42\uFF0C\u4E0D\u80FD\u518D\u5D4C\u5957\u6570\u7EC4\uFF0C\u5F53\u524D\u503C: ${show(member)}` });
4148
+ return;
4149
+ }
4150
+ checkName(member, memberAt, true);
4151
+ });
3832
4152
  });
3833
4153
  return issues;
3834
4154
  }
@@ -4136,7 +4456,7 @@ function parseSource(raw, path18, objectNames, selfName, deps) {
4136
4456
  SOMA_FROM_REQUIRE_CODE
4137
4457
  );
4138
4458
  }
4139
- source2.require = [...requireRaw];
4459
+ source2.require = requireRaw.map((entry) => Array.isArray(entry) ? [...entry] : entry);
4140
4460
  }
4141
4461
  return source2;
4142
4462
  }
@@ -4560,11 +4880,12 @@ function parseDataConfig(raw) {
4560
4880
  var NOTIFY_LEVELS = ["success", "info", "warning", "error", "alert", "announce"];
4561
4881
  var NOTIFY_POLITENESS = ["polite", "assertive"];
4562
4882
  var SOMA_CONFIRM_LEVELS = ["plain", "typed", "consent"];
4883
+ var SOMA_CONFIRM_TONES = ["default", "danger"];
4563
4884
 
4564
4885
  // core/client/parser/confirm-spec.ts
4565
4886
  var SOMA_CONFIRM_REJECTED_PREFIX = "soma-confirm:";
4566
4887
  var SOMA_CONFIRM_TEXT_MAX = 1e3;
4567
- var SPEC_KEYS = ["level", "text", "phrase", "impact"];
4888
+ var SPEC_KEYS = ["level", "text", "phrase", "impact", "tone"];
4568
4889
  function boundedText(value2, key) {
4569
4890
  if (typeof value2 !== "string" || value2.trim() === "") return `confirm.${key} \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(value2)}`;
4570
4891
  if (value2.length > SOMA_CONFIRM_TEXT_MAX) return `confirm.${key} \u8FC7\u957F\uFF08\u4E0A\u9650 ${SOMA_CONFIRM_TEXT_MAX} \u5B57\u7B26\uFF09`;
@@ -4572,7 +4893,7 @@ function boundedText(value2, key) {
4572
4893
  }
4573
4894
  function checkConfirmSpec(raw) {
4574
4895
  if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
4575
- return { ok: false, error: `confirm \u7ED3\u6784\u5FC5\u987B\u662F { level, text, phrase?, impact? } \u5BF9\u8C61\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(raw)}` };
4896
+ return { ok: false, error: `confirm \u7ED3\u6784\u5FC5\u987B\u662F { level, text, phrase?, impact?, tone? } \u5BF9\u8C61\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(raw)}` };
4576
4897
  }
4577
4898
  const record3 = raw;
4578
4899
  const extra = Object.keys(record3).find((key) => !SPEC_KEYS.includes(key));
@@ -4583,6 +4904,9 @@ function checkConfirmSpec(raw) {
4583
4904
  if (typeof level !== "string" || !SOMA_CONFIRM_LEVELS.includes(level)) {
4584
4905
  return { ok: false, error: `confirm.level \u5FC5\u987B\u662F ${SOMA_CONFIRM_LEVELS.join(" / ")} \u4E4B\u4E00\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(level)}` };
4585
4906
  }
4907
+ if (record3.tone !== void 0 && (typeof record3.tone !== "string" || !SOMA_CONFIRM_TONES.includes(record3.tone))) {
4908
+ return { ok: false, error: `confirm.tone \u5FC5\u987B\u662F ${SOMA_CONFIRM_TONES.join(" / ")} \u4E4B\u4E00\uFF08\u4E0D\u5199 = default\uFF09\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(record3.tone)}` };
4909
+ }
4586
4910
  const textProblem = boundedText(record3.text, "text");
4587
4911
  if (textProblem !== null) return { ok: false, error: textProblem };
4588
4912
  for (const key of ["phrase", "impact"]) {
@@ -4610,7 +4934,8 @@ function checkConfirmSpec(raw) {
4610
4934
  level: lv,
4611
4935
  text,
4612
4936
  ...lv === "typed" ? { phrase: record3.phrase.trim() } : {},
4613
- ...lv !== "plain" && record3.impact !== void 0 ? { impact: record3.impact.trim() } : {}
4937
+ ...lv !== "plain" && record3.impact !== void 0 ? { impact: record3.impact.trim() } : {},
4938
+ ...record3.tone === "danger" ? { tone: "danger" } : {}
4614
4939
  }
4615
4940
  };
4616
4941
  }
@@ -4831,7 +5156,7 @@ function splitOptionalSegments(parts) {
4831
5156
  const segment = parseConfirmSegment(message4);
4832
5157
  if ("error" in segment) throw new SomaEventParseError(segment.error, parts.join(" | "));
4833
5158
  confirm = segment.spec.text;
4834
- confirmSpec = segment.spec.level === "plain" ? void 0 : segment.spec;
5159
+ confirmSpec = segment.spec.level === "plain" && segment.spec.tone === void 0 ? void 0 : segment.spec;
4835
5160
  continue;
4836
5161
  }
4837
5162
  if (index > 0 && part.startsWith(PERMISSION_PREFIX)) {
@@ -5753,6 +6078,10 @@ var getSomaAssetSources2 = impl2.getSomaAssetSources;
5753
6078
  var collectPageEntries2 = impl2.collectPageEntries;
5754
6079
  var collectIncludes2 = impl2.collectIncludes;
5755
6080
 
6081
+ // core/server/host/source-aliases.ts
6082
+ var impl3 = __toESM(require_source_aliases());
6083
+ var getSomaSourceRootAliases2 = impl3.getSomaSourceRootAliases;
6084
+
5756
6085
  // core/server/host/host-assembly.ts
5757
6086
  var import_meta = {};
5758
6087
  var CREATE_REQUIRE_KEY = "createRequire";
@@ -5934,6 +6263,8 @@ function loadAppSync(appRoot) {
5934
6263
  moduleCache: false,
5935
6264
  requireCache: false,
5936
6265
  alias: {
6266
+ // 源码根别名(soma.sourceRoots):与服务加载器同一实现;固定别名在后,不可被覆盖
6267
+ ...getSomaSourceRootAliases2(key),
5937
6268
  "@soma-host": hostRoot,
5938
6269
  "@core": coreDir,
5939
6270
  ...serverOnlyEmpty !== void 0 ? { "server-only": serverOnlyEmpty } : {}
@@ -6299,6 +6630,7 @@ var ServerFileCache = class _ServerFileCache {
6299
6630
  const resolvedRoot = (0, import_path.resolve)(rootDir);
6300
6631
  if (this.isWatching(resolvedRoot) || this.unwatchableRoots.has(resolvedRoot)) return;
6301
6632
  try {
6633
+ (0, import_fs.statSync)(resolvedRoot);
6302
6634
  const watcher = (0, import_fs.watch)(resolvedRoot, { recursive: true }, (_event, filename) => {
6303
6635
  this.watchFailures.delete(resolvedRoot);
6304
6636
  if (!filename) return;
@@ -13302,6 +13634,8 @@ function getJitiLoader(hostDir, apiRoot, webRoot, reload = false) {
13302
13634
  moduleCache: !reload,
13303
13635
  requireCache: !reload,
13304
13636
  alias: {
13637
+ // 源码根别名(soma.sourceRoots):jiti 只匹配带斜杠的整段前缀,不劫持裸名;固定别名在后,不可被覆盖
13638
+ ...getSomaSourceRootAliases2(normalizedHostDir),
13305
13639
  "@core": getCoreDir(),
13306
13640
  "@soma-host": normalizedWebRoot,
13307
13641
  "@soma-api": normalizedApiRoot,
@@ -5016,6 +5016,17 @@ var SOMA_CORE_DIAGNOSTIC_CODES = [
5016
5016
  // 时间:ready() 前调同步方法
5017
5017
  "CORE-TEMPORAL-ZONE",
5018
5018
  // 时间:时区标识非法
5019
+ // 宿主源码别名(产生点 core/server/host/source-aliases.cjs,CJS 不能 import 本表,码字面量两处各一份,由本表对账测试与注册表一致)
5020
+ "CORE-HOST-ALIAS-INVALID",
5021
+ // 别名声明形状不对 / 路径越界或不存在 / 别名名字非法(error)
5022
+ "CORE-HOST-ALIAS-RESERVED",
5023
+ // 别名占了保留名(soma / soma-*、server-only、node_modules、带子路径的 Node 内置)(error)
5024
+ "CORE-HOST-ALIAS-SHADOW",
5025
+ // 宿主 node_modules/<别名> 已存在且不是指向别名目录的软链(warning,别名仍生效)
5026
+ "CORE-HOST-ALIAS-DUPLICATE",
5027
+ // 多个源码根里同名别名,先声明者胜(warning)
5028
+ "CORE-HOST-ALIAS-TSCONFIG-DRIFT",
5029
+ // tsconfig.json 的 baseUrl 与第一个源码根不一致(warning)
5019
5030
  "CORE-DND-SPEC",
5020
5031
  // 拖放:getData 返回非对象 / 同元素重复登记
5021
5032
  "CORE-ALGO-DIFF-INPUT",
@@ -5296,6 +5307,11 @@ var SOMA_PIPELINE_LIMITS = {
5296
5307
  "file": "core/server/registry/registry-file-lock.ts",
5297
5308
  "symbol": "SOMA_PIPELINE_LIMITS"
5298
5309
  },
5310
+ {
5311
+ "module": "soma-core",
5312
+ "file": "core/server/api/paged-list.ts",
5313
+ "symbol": "SOMA_PIPELINE_LIMITS"
5314
+ },
5299
5315
  {
5300
5316
  "module": "soma-core",
5301
5317
  "file": "core/server/registry/registry-write-pipeline.ts",
@@ -5311,6 +5327,11 @@ var SOMA_PIPELINE_LIMITS = {
5311
5327
  "file": "core/server/registry/source/version-store.ts",
5312
5328
  "symbol": "SOMA_PIPELINE_LIMITS"
5313
5329
  },
5330
+ {
5331
+ "module": "soma-core",
5332
+ "file": "core/server/runtime-space/inject.ts",
5333
+ "symbol": "SOMA_PIPELINE_LIMITS"
5334
+ },
5314
5335
  {
5315
5336
  "module": "soma-ui",
5316
5337
  "file": "src/compiler/bdl/registry/archive.ts",
@@ -5659,7 +5680,8 @@ var SOMA_PIPELINE_LIMITS = {
5659
5680
  "watchFailLimit": 2,
5660
5681
  "serverFileMaxEntries": 512,
5661
5682
  "serverFileMaxBytes": 33554432,
5662
- "serverDirMaxEntries": 256
5683
+ "serverDirMaxEntries": 256,
5684
+ "sourceRootAliasCapacity": 64
5663
5685
  },
5664
5686
  "runtimeCache": {
5665
5687
  "basis": "runtime \u7A7A\u95F4 L1 \u5185\u5B58 LRU \u7684\u6761\u76EE\u5BB9\u91CF\uFF08\u7F16\u8BD1\u7ED3\u679C\u4E0E\u6807\u51C6\u683C\u5F0F\u4EA7\u7269\u5404\u4E00\u6761\u76EE\uFF09\u4E0E\u9759\u6001\u9875\u5730\u5740\u6E05\u5355\u7684\u5F00\u53D1\u6001\u590D\u6838\u95F4\u9694\uFF1B\u5BB9\u91CF\u4E0D\u5C0F\u4E8E\u53D1\u5E03\u9875\u4EA7\u7269\u7F13\u5B58\u5BB9\u91CF\uFF08cache.publishedArtifactCapacity\uFF09\uFF0C\u56E0\u4E3A L1 \u8981\u5BB9\u5F97\u4E0B\u5DF2\u53D1\u5E03\u9875\u52A0\u4E0A\u8FD0\u884C\u671F\u6309 URL \u6CE8\u5165\u7684\u9875\uFF1B\u590D\u6838\u95F4\u9694\u8BA9\u65B0\u589E\u9759\u6001\u9875\u6700\u8FDF\u8FD9\u4E2A\u6BEB\u79D2\u6570\u540E\u8FDB\u5165\u5199\u5165\u671F\u51B2\u7A81\u5224\u5B9A\uFF08\u751F\u4EA7\u6001\u4E0D\u8FC7\u671F\uFF09\u3002\u8FC1\u5165\u524D\u662F soma-core store.ts \u7684 SOMA_RUNTIME_CACHE_ENTRIES_DEFAULT \u4E0E static-source.ts \u7684 DEV_TTL_MS",
@@ -5677,6 +5699,10 @@ var SOMA_PIPELINE_LIMITS = {
5677
5699
  "maxWaitMs": 5e3,
5678
5700
  "waitSliceMs": 15
5679
5701
  },
5702
+ "pagedList": {
5703
+ "pageSizeDefault": 10,
5704
+ "pageSizeMax": 500
5705
+ },
5680
5706
  "writeRate": {
5681
5707
  "limit": 120,
5682
5708
  "windowMs": 6e4
@@ -5687,7 +5713,8 @@ var SOMA_PIPELINE_LIMITS = {
5687
5713
  "defaultDebounceMs": 300
5688
5714
  },
5689
5715
  "inject": {
5690
- "pageMaxBytes": 4194304
5716
+ "pageMaxBytes": 4194304,
5717
+ "batchFailureMessageMaxChars": 2e3
5691
5718
  },
5692
5719
  "execution": {
5693
5720
  "maxNodes": 128,
@@ -6746,14 +6773,16 @@ function inspectSourceRequire(raw, paramNames) {
6746
6773
  }
6747
6774
  const issues = [];
6748
6775
  const seen = /* @__PURE__ */ new Set();
6749
- raw.forEach((name, index) => {
6750
- const at = `require[${index}]`;
6776
+ const checkName = (name, at, inGroup) => {
6751
6777
  if (typeof name !== "string" || name.trim() === "") {
6752
6778
  issues.push({ path: at, message: `require \u91CC\u7684\u53C2\u6570\u540D\u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${show(name)}` });
6753
6779
  return;
6754
6780
  }
6755
6781
  if (seen.has(name)) {
6756
- issues.push({ path: at, message: `require \u91CC\u6709\u91CD\u590D\u7684\u53C2\u6570\u540D "${name}"` });
6782
+ issues.push({
6783
+ path: at,
6784
+ message: inGroup ? `require \u91CC\u6709\u91CD\u590D\u7684\u53C2\u6570\u540D "${name}"\uFF08\u540C\u540D\u4E0D\u80FD\u5728\u5355\u9879\u4E0E\u5206\u7EC4\u91CC\u3001\u6216\u4E24\u4E2A\u5206\u7EC4\u91CC\u91CD\u590D\u51FA\u73B0\uFF09` : `require \u91CC\u6709\u91CD\u590D\u7684\u53C2\u6570\u540D "${name}"`
6785
+ });
6757
6786
  return;
6758
6787
  }
6759
6788
  seen.add(name);
@@ -6763,6 +6792,28 @@ function inspectSourceRequire(raw, paramNames) {
6763
6792
  message: `require \u91CC\u7684 "${name}" \u6CA1\u6709\u51FA\u73B0\u5728\u540C\u4E00\u6765\u6E90\u7684 params \u91CC\uFF08params \u6709: ${paramNames.join(" / ") || "\u65E0"}\uFF09`
6764
6793
  });
6765
6794
  }
6795
+ };
6796
+ raw.forEach((entry, index) => {
6797
+ const at = `require[${index}]`;
6798
+ if (!Array.isArray(entry)) {
6799
+ checkName(entry, at, false);
6800
+ return;
6801
+ }
6802
+ if (entry.length < 2) {
6803
+ issues.push({
6804
+ path: at,
6805
+ message: `require \u91CC\u7684\u300C\u81F3\u5C11\u4E00\u4E2A\u300D\u5206\u7EC4\u81F3\u5C11\u8981 2 \u4E2A\u53C2\u6570\u540D\uFF08\u5355\u4E2A\u53C2\u6570\u76F4\u63A5\u5199\u540D\u5B57\uFF09\uFF0C\u5F53\u524D\u503C: ${show(entry)}`
6806
+ });
6807
+ return;
6808
+ }
6809
+ entry.forEach((member, memberIndex) => {
6810
+ const memberAt = `${at}[${memberIndex}]`;
6811
+ if (Array.isArray(member)) {
6812
+ issues.push({ path: memberAt, message: `require \u7684\u5206\u7EC4\u53EA\u8BB8\u4E00\u5C42\uFF0C\u4E0D\u80FD\u518D\u5D4C\u5957\u6570\u7EC4\uFF0C\u5F53\u524D\u503C: ${show(member)}` });
6813
+ return;
6814
+ }
6815
+ checkName(member, memberAt, true);
6816
+ });
6766
6817
  });
6767
6818
  return issues;
6768
6819
  }
@@ -8199,7 +8250,7 @@ function parseSource(raw, path, objectNames, selfName, deps) {
8199
8250
  SOMA_FROM_REQUIRE_CODE
8200
8251
  );
8201
8252
  }
8202
- source.require = [...requireRaw];
8253
+ source.require = requireRaw.map((entry) => Array.isArray(entry) ? [...entry] : entry);
8203
8254
  }
8204
8255
  return source;
8205
8256
  }
@@ -8623,11 +8674,12 @@ function parseDataConfig(raw) {
8623
8674
  var NOTIFY_LEVELS = ["success", "info", "warning", "error", "alert", "announce"];
8624
8675
  var NOTIFY_POLITENESS = ["polite", "assertive"];
8625
8676
  var SOMA_CONFIRM_LEVELS = ["plain", "typed", "consent"];
8677
+ var SOMA_CONFIRM_TONES = ["default", "danger"];
8626
8678
 
8627
8679
  // core/client/parser/confirm-spec.ts
8628
8680
  var SOMA_CONFIRM_REJECTED_PREFIX = "soma-confirm:";
8629
8681
  var SOMA_CONFIRM_TEXT_MAX = 1e3;
8630
- var SPEC_KEYS = ["level", "text", "phrase", "impact"];
8682
+ var SPEC_KEYS = ["level", "text", "phrase", "impact", "tone"];
8631
8683
  function boundedText(value2, key) {
8632
8684
  if (typeof value2 !== "string" || value2.trim() === "") return `confirm.${key} \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(value2)}`;
8633
8685
  if (value2.length > SOMA_CONFIRM_TEXT_MAX) return `confirm.${key} \u8FC7\u957F\uFF08\u4E0A\u9650 ${SOMA_CONFIRM_TEXT_MAX} \u5B57\u7B26\uFF09`;
@@ -8635,7 +8687,7 @@ function boundedText(value2, key) {
8635
8687
  }
8636
8688
  function checkConfirmSpec(raw) {
8637
8689
  if (raw === null || typeof raw !== "object" || Array.isArray(raw)) {
8638
- return { ok: false, error: `confirm \u7ED3\u6784\u5FC5\u987B\u662F { level, text, phrase?, impact? } \u5BF9\u8C61\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(raw)}` };
8690
+ return { ok: false, error: `confirm \u7ED3\u6784\u5FC5\u987B\u662F { level, text, phrase?, impact?, tone? } \u5BF9\u8C61\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(raw)}` };
8639
8691
  }
8640
8692
  const record = raw;
8641
8693
  const extra = Object.keys(record).find((key) => !SPEC_KEYS.includes(key));
@@ -8646,6 +8698,9 @@ function checkConfirmSpec(raw) {
8646
8698
  if (typeof level !== "string" || !SOMA_CONFIRM_LEVELS.includes(level)) {
8647
8699
  return { ok: false, error: `confirm.level \u5FC5\u987B\u662F ${SOMA_CONFIRM_LEVELS.join(" / ")} \u4E4B\u4E00\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(level)}` };
8648
8700
  }
8701
+ if (record.tone !== void 0 && (typeof record.tone !== "string" || !SOMA_CONFIRM_TONES.includes(record.tone))) {
8702
+ return { ok: false, error: `confirm.tone \u5FC5\u987B\u662F ${SOMA_CONFIRM_TONES.join(" / ")} \u4E4B\u4E00\uFF08\u4E0D\u5199 = default\uFF09\uFF0C\u5F53\u524D\u503C: ${JSON.stringify(record.tone)}` };
8703
+ }
8649
8704
  const textProblem = boundedText(record.text, "text");
8650
8705
  if (textProblem !== null) return { ok: false, error: textProblem };
8651
8706
  for (const key of ["phrase", "impact"]) {
@@ -8673,7 +8728,8 @@ function checkConfirmSpec(raw) {
8673
8728
  level: lv,
8674
8729
  text,
8675
8730
  ...lv === "typed" ? { phrase: record.phrase.trim() } : {},
8676
- ...lv !== "plain" && record.impact !== void 0 ? { impact: record.impact.trim() } : {}
8731
+ ...lv !== "plain" && record.impact !== void 0 ? { impact: record.impact.trim() } : {},
8732
+ ...record.tone === "danger" ? { tone: "danger" } : {}
8677
8733
  }
8678
8734
  };
8679
8735
  }
@@ -8894,7 +8950,7 @@ function splitOptionalSegments(parts) {
8894
8950
  const segment = parseConfirmSegment(message);
8895
8951
  if ("error" in segment) throw new SomaEventParseError(segment.error, parts.join(" | "));
8896
8952
  confirm = segment.spec.text;
8897
- confirmSpec = segment.spec.level === "plain" ? void 0 : segment.spec;
8953
+ confirmSpec = segment.spec.level === "plain" && segment.spec.tone === void 0 ? void 0 : segment.spec;
8898
8954
  continue;
8899
8955
  }
8900
8956
  if (index > 0 && part.startsWith(PERMISSION_PREFIX)) {