soma-core 2.2.7 → 2.2.9
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.
- package/core/build/compiler/full-manifest-builder.ts +1 -1
- package/core/build/compiler/host-config-sync.cjs +1 -1
- package/core/build/compiler/soma-manifest-webpack-plugin.js +2 -6
- package/core/build/compiler/soma-precompile.js +80 -4
- package/core/client/a11y/announcer.ts +2 -16
- package/core/client/base/SomaPageRootBase.ts +2 -2
- package/core/client/base/defineSomaView.ts +11 -2
- package/core/client/base/runtime-services.types.ts +57 -0
- package/core/client/data/data-object-resolver.ts +36 -5
- package/core/client/data/role-gate.ts +2 -8
- package/core/client/engine/event-engine.ts +1 -0
- package/core/client/engines/chart/adapter-echarts.ts +75 -2
- package/core/client/engines/chart/index.ts +18 -0
- package/core/client/engines/chart/port.ts +13 -0
- package/core/client/engines/diff/adapter-jsdiff.ts +27 -8
- package/core/client/engines/diff/index.ts +81 -6
- package/core/client/engines/diff/items.ts +212 -0
- package/core/client/engines/diff/port.ts +140 -3
- package/core/client/engines/diff/prose.ts +443 -0
- package/core/client/engines/engine-adapters.ts +6 -0
- package/core/client/engines/highlight/adapter-lezer.ts +109 -0
- package/core/client/engines/highlight/index.ts +135 -0
- package/core/client/engines/highlight/port.ts +92 -0
- package/core/client/engines/markdown/adapter-markdown-it.ts +65 -0
- package/core/client/engines/markdown/blocks.ts +335 -0
- package/core/client/engines/markdown/index.ts +51 -0
- package/core/client/engines/markdown/port.ts +94 -0
- package/core/client/engines/markdown/vendor-modules.d.ts +6 -0
- package/core/client/engines/structured/adapter-js-yaml.ts +33 -0
- package/core/client/engines/structured/index.ts +139 -0
- package/core/client/engines/structured/port.ts +59 -0
- package/core/client/infra/http/SomaHttpService.ts +2 -4
- package/core/client/infra/notify/DefaultNotifyService.ts +2 -3
- package/core/client/infra/permission/SomaPermission.ts +1 -1
- package/core/client/render-ports/notify-renderer.ts +2 -46
- package/core/client/runtime/SomaRuntimeServices.ts +16 -45
- package/core/server/host/app-config-composer.ts +6 -52
- package/core/server/host/host-config-paths.cjs +2 -100
- package/core/server/host/precompiled-manifest.ts +69 -0
- package/core/server/infra/host-config-paths.cjs +100 -0
- package/core/server/page-assets.ts +2 -70
- package/core/server/runtime-space/bindings.ts +76 -1
- package/core/server/runtime-space/digest.ts +6 -0
- package/core/server/runtime-space/index.ts +1 -1
- package/core/server/runtime-space/prewarm.ts +8 -8
- package/core/server/runtime-space/store.ts +23 -7
- package/core/server/runtime-space/types.ts +3 -2
- package/core/shared/app-config-merge.ts +59 -0
- package/core/shared/registry-generated/limits.ts +80 -4
- package/core/shared/types/announcer.types.ts +18 -0
- package/core/shared/types/notify.types.ts +26 -0
- package/core/shared/types/role-gate.types.ts +11 -0
- package/dist/browser/runtime-bundle.manifest.json +50 -7
- package/dist/browser/soma-runtime.js +120022 -103991
- package/dist/core/index.cjs +113888 -97846
- package/dist/host-native/aot-builder.cjs +277 -189
- package/dist/host-native/native-server.cjs +245 -84
- package/dist/lsp/component-tree.cjs +80 -4
- package/dist/types/build/compiler/full-manifest-builder.d.ts +1 -1
- package/dist/types/client/a11y/announcer.d.ts +2 -14
- package/dist/types/client/base/SomaPageRootBase.d.ts +2 -2
- package/dist/types/client/base/runtime-services.types.d.ts +50 -0
- package/dist/types/client/data/role-gate.d.ts +2 -8
- package/dist/types/client/engines/chart/index.d.ts +1 -1
- package/dist/types/client/engines/chart/port.d.ts +15 -0
- package/dist/types/client/engines/diff/index.d.ts +1 -1
- package/dist/types/client/engines/diff/items.d.ts +24 -0
- package/dist/types/client/engines/diff/port.d.ts +124 -2
- package/dist/types/client/engines/diff/prose.d.ts +80 -0
- package/dist/types/client/engines/engine-adapters.d.ts +6 -0
- package/dist/types/client/engines/highlight/adapter-lezer.d.ts +6 -0
- package/dist/types/client/engines/highlight/index.d.ts +15 -0
- package/dist/types/client/engines/highlight/port.d.ts +64 -0
- package/dist/types/client/engines/markdown/adapter-markdown-it.d.ts +6 -0
- package/dist/types/client/engines/markdown/blocks.d.ts +29 -0
- package/dist/types/client/engines/markdown/index.d.ts +9 -0
- package/dist/types/client/engines/markdown/port.d.ts +166 -0
- package/dist/types/client/engines/structured/adapter-js-yaml.d.ts +6 -0
- package/dist/types/client/engines/structured/index.d.ts +29 -0
- package/dist/types/client/engines/structured/port.d.ts +45 -0
- package/dist/types/client/infra/http/SomaHttpService.d.ts +1 -1
- package/dist/types/client/infra/notify/DefaultNotifyService.d.ts +2 -3
- package/dist/types/client/infra/permission/SomaPermission.d.ts +1 -1
- package/dist/types/client/render-ports/notify-renderer.d.ts +1 -56
- package/dist/types/client/runtime/SomaRuntimeServices.d.ts +9 -44
- package/dist/types/server/host/app-config-composer.d.ts +2 -3
- package/dist/types/server/host/host-config-paths.d.cts +2 -7
- package/dist/types/server/host/precompiled-manifest.d.ts +5 -0
- package/dist/types/server/infra/host-config-paths.d.cts +7 -0
- package/dist/types/server/page-assets.d.ts +2 -5
- package/dist/types/server/runtime-space/bindings.d.ts +9 -0
- package/dist/types/server/runtime-space/digest.d.ts +5 -0
- package/dist/types/server/runtime-space/index.d.ts +1 -1
- package/dist/types/server/runtime-space/prewarm.d.ts +2 -2
- package/dist/types/server/runtime-space/store.d.ts +4 -0
- package/dist/types/server/runtime-space/types.d.ts +3 -2
- package/dist/types/shared/app-config-merge.d.ts +3 -0
- package/dist/types/shared/registry-generated/limits.d.ts +78 -4
- package/dist/types/shared/types/announcer.types.d.ts +14 -0
- package/dist/types/shared/types/notify.types.d.ts +36 -0
- package/dist/types/shared/types/role-gate.types.d.ts +8 -0
- package/host-native/src/aot-builder.ts +12 -5
- package/host-native/src/dev-chunk-gc.ts +104 -0
- package/host-native/src/host-prepare.ts +19 -2
- package/host-native/src/manifest-http.ts +1 -1
- package/host-native/src/native-server.ts +16 -0
- package/host-native/src/page-http.ts +2 -67
- package/host-native/src/page-payload-cache.ts +68 -0
- package/package.json +16 -2
|
@@ -10,7 +10,7 @@ import fs from 'node:fs';
|
|
|
10
10
|
import path from 'node:path';
|
|
11
11
|
import { writeFileAtomic } from '../registry/registry-file-lock';
|
|
12
12
|
import { SOMA_PIPELINE_LIMITS } from '../../shared/registry-generated/limits';
|
|
13
|
-
import { bindingFileName, computeStandardPageDigest, isRuntimeDigest } from './digest';
|
|
13
|
+
import { bindingFileName, computeStandardPageDigest, isRuntimeDigest, SOMA_RUNTIME_STORE_FORMAT } from './digest';
|
|
14
14
|
import type {
|
|
15
15
|
SomaPersistedBinding,
|
|
16
16
|
SomaPrewarmIndex,
|
|
@@ -143,6 +143,18 @@ export class SomaRuntimeStore {
|
|
|
143
143
|
return page;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
+
/** 删除产物文件(升级丢弃旧产物后清理用;调用方保证没有别的绑定引用它);返回是否真删了文件 */
|
|
147
|
+
removeArtifact(digest: string): boolean {
|
|
148
|
+
if (!isRuntimeDigest(digest)) return false;
|
|
149
|
+
this.pages.delete(digest);
|
|
150
|
+
try {
|
|
151
|
+
fs.unlinkSync(artifactFilePath(this.dirs.artifacts, digest));
|
|
152
|
+
return true;
|
|
153
|
+
} catch {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
146
158
|
hasArtifact(digest: string): boolean {
|
|
147
159
|
return isRuntimeDigest(digest) && fs.existsSync(artifactFilePath(this.dirs.artifacts, digest));
|
|
148
160
|
}
|
|
@@ -194,7 +206,7 @@ export class SomaRuntimeStore {
|
|
|
194
206
|
|
|
195
207
|
writeBinding(binding: SomaRuntimeBinding): void {
|
|
196
208
|
fs.mkdirSync(this.dirs.bindings, { recursive: true });
|
|
197
|
-
const record: SomaPersistedBinding = { schemaVersion:
|
|
209
|
+
const record: SomaPersistedBinding = { schemaVersion: SOMA_RUNTIME_STORE_FORMAT, binding };
|
|
198
210
|
writeFileAtomic(this.bindingFile(binding.address), `${JSON.stringify(record, null, 2)}\n`);
|
|
199
211
|
}
|
|
200
212
|
|
|
@@ -203,7 +215,7 @@ export class SomaRuntimeStore {
|
|
|
203
215
|
try {
|
|
204
216
|
const stat = fs.statSync(file);
|
|
205
217
|
const record = JSON.parse(fs.readFileSync(file, 'utf8')) as SomaPersistedBinding;
|
|
206
|
-
if (record.schemaVersion !==
|
|
218
|
+
if (record.schemaVersion !== SOMA_RUNTIME_STORE_FORMAT || !record.binding) return null;
|
|
207
219
|
return { binding: record.binding, mtimeMs: stat.mtimeMs };
|
|
208
220
|
} catch {
|
|
209
221
|
return null;
|
|
@@ -228,6 +240,9 @@ export class SomaRuntimeStore {
|
|
|
228
240
|
}
|
|
229
241
|
}
|
|
230
242
|
|
|
243
|
+
/** 本进程读绑定时因落盘格式版本不符而丢弃的旧绑定个数(启动汇总日志用) */
|
|
244
|
+
legacyDiscarded = 0;
|
|
245
|
+
|
|
231
246
|
/** 严格删除:文件本来就不在返回 false(视为成功);其他失败(权限 / IO)原样抛出,不吞 */
|
|
232
247
|
removeBindingStrict(address: string): boolean {
|
|
233
248
|
try {
|
|
@@ -254,7 +269,8 @@ export class SomaRuntimeStore {
|
|
|
254
269
|
const file = path.join(this.dirs.bindings, name);
|
|
255
270
|
const stat = fs.statSync(file);
|
|
256
271
|
const record = JSON.parse(fs.readFileSync(file, 'utf8')) as SomaPersistedBinding;
|
|
257
|
-
if (record.schemaVersion ===
|
|
272
|
+
if (record.schemaVersion === SOMA_RUNTIME_STORE_FORMAT && record.binding) out.push({ binding: record.binding, mtimeMs: stat.mtimeMs });
|
|
273
|
+
else { fs.unlinkSync(file); this.legacyDiscarded += 1; } // 旧格式绑定:丢弃(产物由 GC 回收),由方言所有者重新编译注入
|
|
258
274
|
} catch {
|
|
259
275
|
/* 损坏的绑定文件不拖垮启动 */
|
|
260
276
|
}
|
|
@@ -267,16 +283,16 @@ export class SomaRuntimeStore {
|
|
|
267
283
|
readPrewarmIndex(): SomaPrewarmIndex {
|
|
268
284
|
try {
|
|
269
285
|
const parsed = JSON.parse(fs.readFileSync(path.join(this.dirs.prewarm, 'index.json'), 'utf8')) as SomaPrewarmIndex;
|
|
270
|
-
if (parsed.schemaVersion ===
|
|
286
|
+
if (parsed.schemaVersion === SOMA_RUNTIME_STORE_FORMAT && parsed.entries && typeof parsed.entries === 'object') return parsed;
|
|
271
287
|
} catch {
|
|
272
288
|
/* 缺失或损坏:当作空 */
|
|
273
289
|
}
|
|
274
|
-
return { schemaVersion:
|
|
290
|
+
return { schemaVersion: SOMA_RUNTIME_STORE_FORMAT, entries: {} };
|
|
275
291
|
}
|
|
276
292
|
|
|
277
293
|
writePrewarmIndex(entries: Readonly<Record<string, string>>): void {
|
|
278
294
|
fs.mkdirSync(this.dirs.prewarm, { recursive: true });
|
|
279
|
-
const index: SomaPrewarmIndex = { schemaVersion:
|
|
295
|
+
const index: SomaPrewarmIndex = { schemaVersion: SOMA_RUNTIME_STORE_FORMAT, entries };
|
|
280
296
|
writeFileAtomic(path.join(this.dirs.prewarm, 'index.json'), `${JSON.stringify(index, null, 2)}\n`);
|
|
281
297
|
}
|
|
282
298
|
}
|
|
@@ -214,13 +214,14 @@ export interface SomaRuntimeStoreStats {
|
|
|
214
214
|
|
|
215
215
|
/** 一条落盘的绑定记录(`<root>/bindings/<键>.json`) */
|
|
216
216
|
export interface SomaPersistedBinding {
|
|
217
|
-
|
|
217
|
+
/** core 落盘格式版本(`SOMA_RUNTIME_STORE_FORMAT`);读回不符即丢弃 */
|
|
218
|
+
readonly schemaVersion: number;
|
|
218
219
|
readonly binding: SomaRuntimeBinding;
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
/** 预热索引 `<root>/prewarm/index.json` */
|
|
222
223
|
export interface SomaPrewarmIndex {
|
|
223
|
-
readonly schemaVersion:
|
|
224
|
+
readonly schemaVersion: number;
|
|
224
225
|
/** 地址 → 内容摘要 */
|
|
225
226
|
readonly entries: Readonly<Record<string, string>>;
|
|
226
227
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// 应用配置 YAML 解析与源包/宿主配置深合并(CORE-L02:纯函数下沉至 shared 层,
|
|
2
|
+
// 供构建期 full-manifest-builder 与服务端 host/app-config-composer 共用)。
|
|
3
|
+
import yaml from 'js-yaml';
|
|
4
|
+
|
|
5
|
+
type AppConfigRecord = Record<string, unknown>;
|
|
6
|
+
|
|
7
|
+
const UNSAFE_KEYS = new Set(['__proto__', 'prototype', 'constructor']);
|
|
8
|
+
|
|
9
|
+
function isRecord(value: unknown): value is AppConfigRecord {
|
|
10
|
+
return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function cloneValue(value: unknown): unknown {
|
|
14
|
+
if (Array.isArray(value)) {
|
|
15
|
+
return value.map((item) => cloneValue(item));
|
|
16
|
+
}
|
|
17
|
+
if (!isRecord(value)) {
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
const result: AppConfigRecord = {};
|
|
21
|
+
for (const [key, child] of Object.entries(value)) {
|
|
22
|
+
if (!UNSAFE_KEYS.has(key)) {
|
|
23
|
+
result[key] = cloneValue(child);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function mergeRecords(defaults: AppConfigRecord, host: AppConfigRecord): AppConfigRecord {
|
|
30
|
+
const result = cloneValue(defaults) as AppConfigRecord;
|
|
31
|
+
for (const [key, hostValue] of Object.entries(host)) {
|
|
32
|
+
if (UNSAFE_KEYS.has(key)) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
const defaultValue = result[key];
|
|
36
|
+
result[key] = isRecord(defaultValue) && isRecord(hostValue)
|
|
37
|
+
? mergeRecords(defaultValue, hostValue)
|
|
38
|
+
: cloneValue(hostValue);
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function parseAppConfigYaml(source: string): unknown {
|
|
44
|
+
return source.trim() ? yaml.load(source) ?? {} : {};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Source packages provide defaults; the Host remains the final App-config owner. */
|
|
48
|
+
export function mergeSourcePackageAppConfig(
|
|
49
|
+
sourcePackageConfig: unknown,
|
|
50
|
+
hostConfig: unknown,
|
|
51
|
+
): unknown {
|
|
52
|
+
if (isRecord(sourcePackageConfig) && isRecord(hostConfig)) {
|
|
53
|
+
return mergeRecords(sourcePackageConfig, hostConfig);
|
|
54
|
+
}
|
|
55
|
+
if (hostConfig !== undefined && hostConfig !== null) {
|
|
56
|
+
return cloneValue(hostConfig);
|
|
57
|
+
}
|
|
58
|
+
return cloneValue(sourcePackageConfig ?? {});
|
|
59
|
+
}
|
|
@@ -105,6 +105,16 @@ export const SOMA_PIPELINE_LIMITS = {
|
|
|
105
105
|
"file": "core/server/registry/api-registry-store.ts",
|
|
106
106
|
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
107
107
|
},
|
|
108
|
+
{
|
|
109
|
+
"module": "soma-core",
|
|
110
|
+
"file": "core/client/engines/diff/index.ts",
|
|
111
|
+
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"module": "soma-core",
|
|
115
|
+
"file": "core/client/engines/highlight/index.ts",
|
|
116
|
+
"symbol": "SOMA_PIPELINE_LIMITS"
|
|
117
|
+
},
|
|
108
118
|
{
|
|
109
119
|
"module": "soma-core",
|
|
110
120
|
"file": "core/server/registry/page-registry-store.ts",
|
|
@@ -407,17 +417,17 @@ export const SOMA_PIPELINE_LIMITS = {
|
|
|
407
417
|
},
|
|
408
418
|
{
|
|
409
419
|
"module": "soma-ai",
|
|
410
|
-
"file": "src/
|
|
420
|
+
"file": "src/server/common/RateLimitBackend.ts",
|
|
411
421
|
"symbol": "SOMA_PIPELINE_LIMITS_AI"
|
|
412
422
|
},
|
|
413
423
|
{
|
|
414
424
|
"module": "soma-ai",
|
|
415
|
-
"file": "src/
|
|
425
|
+
"file": "src/server/common/RequestBodyLimit.ts",
|
|
416
426
|
"symbol": "SOMA_PIPELINE_LIMITS_AI"
|
|
417
427
|
},
|
|
418
428
|
{
|
|
419
429
|
"module": "soma-ai",
|
|
420
|
-
"file": "src/
|
|
430
|
+
"file": "src/server/services/ai-assistant/Chat.ts",
|
|
421
431
|
"symbol": "SOMA_PIPELINE_LIMITS_AI"
|
|
422
432
|
},
|
|
423
433
|
{
|
|
@@ -432,7 +442,7 @@ export const SOMA_PIPELINE_LIMITS = {
|
|
|
432
442
|
},
|
|
433
443
|
{
|
|
434
444
|
"module": "soma-ai",
|
|
435
|
-
"file": "src/
|
|
445
|
+
"file": "src/domain/ai-shared/TrustedRequestContext.ts",
|
|
436
446
|
"symbol": "SOMA_PIPELINE_LIMITS_AI_RUNTIME"
|
|
437
447
|
},
|
|
438
448
|
{
|
|
@@ -605,5 +615,71 @@ export const SOMA_PIPELINE_LIMITS = {
|
|
|
605
615
|
"tokensBytes": 40960,
|
|
606
616
|
"componentBytesPerPage": 163840,
|
|
607
617
|
"overrideBlockBytes": 8192
|
|
618
|
+
},
|
|
619
|
+
"contentEngines": {
|
|
620
|
+
"diff": {
|
|
621
|
+
"basis": {
|
|
622
|
+
"maxChars": "单个差异计算两侧合计字数上限;超限不计算、整段替换(参考文本差异组件笔记 C.5「单个差异组件总量 200 000 字」,实测 4:万字级逐字比较需超时与退化)",
|
|
623
|
+
"maxCharsPerCompare": "单次词级比较(一对句子 / 一次 diff 调用)两侧合计字数上限(笔记 C.2 BaseOpts maxChars 20 000)",
|
|
624
|
+
"timeoutMs": "一次 diffProse / diffItems 的总时限(毫秒),同 VisualEditor timeout 1000(笔记 C.2)",
|
|
625
|
+
"maxItems": "条目列表单侧条目数上限;超限不逐条比较(笔记 C.5「条目 2 000 个」)",
|
|
626
|
+
"moveDetectMaxChanged": "变化条目(增 + 删)超过此数不做移动检测(笔记 C.2,wikidiff2 增删合计 > 100 不检测的放宽版,经验值)",
|
|
627
|
+
"pairAt": "句 / 段配对阈值:字符多重集 Dice ≥ 此值视为改写(VisualEditor diffThreshold 0.5;实测 3 的改写句为 0.84–0.89)",
|
|
628
|
+
"rewriteBelow": "整体相似度低于此值整段替换(等效 VE keep < 0.5 × diff;实测 2 的 C3 整句重写约 0.16)",
|
|
629
|
+
"absorbOrphan": "孤字吸收:夹在两处改动间、长度 ≤ 此值(字)的非标点相同片段并入改动(实测 2 的 C5「期」)",
|
|
630
|
+
"absorbOrphanMax": "调用方可调的孤字吸收上限(字),防止把整句吸成改动",
|
|
631
|
+
"titleAt": "无 key 条目按标题配对的相似度阈值(笔记 C.2 ItemOpts.match.titleAt 0.6)",
|
|
632
|
+
"bodyAt": "无 key 条目按正文配对的相似度阈值(笔记 C.2 ItemOpts.match.bodyAt 0.5)",
|
|
633
|
+
"maxAlignTokens": "序列对齐的不同键数上限(每个键映射为一个 BMP 私用区字符,U+E000–U+F8FF 共 6400 个)",
|
|
634
|
+
"maxPairMatrix": "一段删增区间内句 / 段配对的候选矩阵上限(删数 × 增数),超出不配对、按删 + 增呈现;经验值,证据弱",
|
|
635
|
+
"maxPairCandidates": "无 key 条目按相似度配对的候选矩阵上限(剩余旧条目 × 剩余新条目);经验值,证据弱"
|
|
636
|
+
},
|
|
637
|
+
"maxChars": 200000,
|
|
638
|
+
"maxCharsPerCompare": 20000,
|
|
639
|
+
"timeoutMs": 1000,
|
|
640
|
+
"maxItems": 2000,
|
|
641
|
+
"moveDetectMaxChanged": 500,
|
|
642
|
+
"pairAt": 0.5,
|
|
643
|
+
"rewriteBelow": 0.4,
|
|
644
|
+
"absorbOrphan": 1,
|
|
645
|
+
"absorbOrphanMax": 4,
|
|
646
|
+
"titleAt": 0.6,
|
|
647
|
+
"bodyAt": 0.5,
|
|
648
|
+
"maxAlignTokens": 6400,
|
|
649
|
+
"maxPairMatrix": 2500,
|
|
650
|
+
"maxPairCandidates": 250000
|
|
651
|
+
},
|
|
652
|
+
"highlight": {
|
|
653
|
+
"basis": {
|
|
654
|
+
"maxLines": "高亮的最多行数;超出部分按纯文本(参考文本差异组件笔记 C.2 端口 2 maxLines 5 000)",
|
|
655
|
+
"maxLineLength": "单行超过此字符数整行按纯文本(笔记 C.2 maxLineLength 2 000,压缩后的单行 JS / JSON 常见)",
|
|
656
|
+
"timeoutMs": "一次解析的时限(毫秒);Lezer 按 advance() 分步解析,超时整段按纯文本(经验值,与差异端口同取 1 000)",
|
|
657
|
+
"maxChars": "整段超过此字符数不解析、按纯文本(经验值,证据弱:约 1 MB 文本)",
|
|
658
|
+
"jsonSniffMaxChars": "语言推断「整体能 JSON.parse」只对不超过此字符数的样本做(避免对大文本反复解析;经验值)"
|
|
659
|
+
},
|
|
660
|
+
"maxLines": 5000,
|
|
661
|
+
"maxLineLength": 2000,
|
|
662
|
+
"timeoutMs": 1000,
|
|
663
|
+
"maxChars": 1000000,
|
|
664
|
+
"jsonSniffMaxChars": 200000
|
|
665
|
+
},
|
|
666
|
+
"structured": {
|
|
667
|
+
"basis": {
|
|
668
|
+
"maxChars": "JSON / YAML 原文超过此字符数不解析、按原文显示(与代码高亮端口 maxChars 同取约 1 MB;经验值,证据弱)",
|
|
669
|
+
"maxNodes": "解析后值的节点总数上限(对象 / 数组 / 叶子各计 1);YAML 别名展开超限即按 too-many-nodes 降级,防「十亿笑声」式别名炸弹(经验值:20 万节点约为 1 MB 紧凑 JSON 的量级)"
|
|
670
|
+
},
|
|
671
|
+
"maxChars": 1000000,
|
|
672
|
+
"maxNodes": 200000
|
|
673
|
+
},
|
|
674
|
+
"markdown": {
|
|
675
|
+
"basis": {
|
|
676
|
+
"maxChars": "Markdown 原文超过此字符数不解析、按纯文本显示(参考文本差异组件笔记 C.2 端口 1 limits.maxChars 200 000)",
|
|
677
|
+
"maxBlocks": "块数上限,超出截断并标 truncated(笔记 C.2 maxBlocks 5 000)",
|
|
678
|
+
"summaryChars": "meta.summary 取去标记全文的前 N 字(笔记 C.2「前 80 字」)"
|
|
679
|
+
},
|
|
680
|
+
"maxChars": 200000,
|
|
681
|
+
"maxBlocks": 5000,
|
|
682
|
+
"summaryChars": 80
|
|
683
|
+
}
|
|
608
684
|
}
|
|
609
685
|
} as const;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// 读屏统一播报通道类型契约(CORE-L01:形状类型下沉至 shared/types,原 client/a11y/announcer.ts 原样重导出)。
|
|
2
|
+
|
|
3
|
+
export type AnnouncePoliteness = 'polite' | 'assertive';
|
|
4
|
+
|
|
5
|
+
export interface AnnounceOptions {
|
|
6
|
+
readonly politeness?: AnnouncePoliteness;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface Announcer {
|
|
10
|
+
/** 追加一条播报;空消息忽略;politeness 缺省 polite,未知值抛 TypeError */
|
|
11
|
+
announce(message: string, options?: AnnounceOptions): void;
|
|
12
|
+
/** 两个常驻宿主 */
|
|
13
|
+
hosts(): Readonly<Record<AnnouncePoliteness, HTMLElement>>;
|
|
14
|
+
/** 立即移除全部待清理节点 */
|
|
15
|
+
clear(): void;
|
|
16
|
+
/** 清空、取消计时并移除宿主;之后 announce 忽略 */
|
|
17
|
+
dispose(): void;
|
|
18
|
+
}
|
|
@@ -43,3 +43,29 @@ export interface INotifyService {
|
|
|
43
43
|
/** 读屏播报(S7 · `NOTIFY | announce`);可选,缺省实现见 DefaultNotifyService */
|
|
44
44
|
announce?(message: string, politeness?: 'polite' | 'assertive'): void;
|
|
45
45
|
}
|
|
46
|
+
|
|
47
|
+
/** 交给渲染器的一条通知;`duration` 只透传调用方给的值,未给则不带字段,由渲染器决定停留 */
|
|
48
|
+
export interface NotifyEntry {
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly level: NotifyLevel;
|
|
51
|
+
readonly message: string;
|
|
52
|
+
readonly title?: string;
|
|
53
|
+
readonly duration?: number;
|
|
54
|
+
/** 呈现载体偏好;未给则渲染器按级别与动作自定 */
|
|
55
|
+
readonly carrier?: NotifyCarrier;
|
|
56
|
+
/** 附带动作;未给则无 */
|
|
57
|
+
readonly action?: NotifyAction;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* 通知渲染端口(UI 体系注入,经 `SomaBootstrap` 选项 `renderPorts.notify`)。
|
|
62
|
+
* core 不带可见实现:停留、动效、位置、模态呈现全在渲染器里。
|
|
63
|
+
*/
|
|
64
|
+
export interface NotifyRenderer {
|
|
65
|
+
show(entry: NotifyEntry): { dismiss(): void };
|
|
66
|
+
confirm(req: { message: string; title?: string; spec?: SomaConfirmSpec }): Promise<boolean>;
|
|
67
|
+
alert(req: { message: string; title?: string }): Promise<void>;
|
|
68
|
+
confirmChoice?(spec: SomaChoiceConfirmSpec): Promise<SomaChoiceConfirmOutcome>;
|
|
69
|
+
announce?(req: { message: string; politeness: 'polite' | 'assertive' }): void;
|
|
70
|
+
dispose(): void;
|
|
71
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// 角色门类型契约(CORE-L01:形状类型下沉至 shared/types,原 client/data/role-gate.ts 原样重导出)。
|
|
2
|
+
|
|
3
|
+
/** Host 提供的角色集来源(`SomaBootstrapOptions.auth`) */
|
|
4
|
+
export interface SomaAuthOption {
|
|
5
|
+
getRoles(): readonly string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface SomaRoleGate {
|
|
9
|
+
/** 当前角色集与 `required` 有交集才为真 */
|
|
10
|
+
hasAnyRole(required: readonly string[]): boolean;
|
|
11
|
+
}
|
|
@@ -52,6 +52,19 @@
|
|
|
52
52
|
"../node_modules/@floating-ui/dom/dist/floating-ui.dom.mjs",
|
|
53
53
|
"../node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.mjs",
|
|
54
54
|
"../node_modules/@floating-ui/utils/dist/floating-ui.utils.mjs",
|
|
55
|
+
"../node_modules/@lezer/common/dist/index.js",
|
|
56
|
+
"../node_modules/@lezer/css/dist/index.js",
|
|
57
|
+
"../node_modules/@lezer/go/dist/index.js",
|
|
58
|
+
"../node_modules/@lezer/highlight/dist/index.js",
|
|
59
|
+
"../node_modules/@lezer/html/dist/index.js",
|
|
60
|
+
"../node_modules/@lezer/java/dist/index.js",
|
|
61
|
+
"../node_modules/@lezer/javascript/dist/index.js",
|
|
62
|
+
"../node_modules/@lezer/json/dist/index.js",
|
|
63
|
+
"../node_modules/@lezer/lr/dist/index.js",
|
|
64
|
+
"../node_modules/@lezer/markdown/dist/index.js",
|
|
65
|
+
"../node_modules/@lezer/python/dist/index.js",
|
|
66
|
+
"../node_modules/@lezer/xml/dist/index.js",
|
|
67
|
+
"../node_modules/@lezer/yaml/dist/index.js",
|
|
55
68
|
"../node_modules/@tanstack/table-core/build/lib/index.mjs",
|
|
56
69
|
"../node_modules/@tanstack/virtual-core/dist/esm/index.js",
|
|
57
70
|
"../node_modules/@tanstack/virtual-core/dist/esm/ios-gesture.js",
|
|
@@ -602,12 +615,37 @@
|
|
|
602
615
|
"../node_modules/echarts/lib/visual/visualSolution.js",
|
|
603
616
|
"../node_modules/echarts/node_modules/tslib/tslib.es6.js",
|
|
604
617
|
"../node_modules/echarts/renderers.js",
|
|
618
|
+
"../node_modules/get-east-asian-width/index.js",
|
|
619
|
+
"../node_modules/get-east-asian-width/lookup-data.js",
|
|
620
|
+
"../node_modules/get-east-asian-width/lookup.js",
|
|
621
|
+
"../node_modules/get-east-asian-width/utilities.js",
|
|
605
622
|
"../node_modules/js-yaml/dist/js-yaml.mjs",
|
|
623
|
+
"../node_modules/linkify-it/build/index.mjs",
|
|
624
|
+
"../node_modules/markdown-it-cjk-friendly/dist/index.js",
|
|
625
|
+
"../node_modules/markdown-it-footnote/index.mjs",
|
|
626
|
+
"../node_modules/markdown-it/dist/markdown-it.mjs",
|
|
627
|
+
"../node_modules/markdown-it/node_modules/entities/dist/decode-codepoint.js",
|
|
628
|
+
"../node_modules/markdown-it/node_modules/entities/dist/decode.js",
|
|
629
|
+
"../node_modules/markdown-it/node_modules/entities/dist/encode.js",
|
|
630
|
+
"../node_modules/markdown-it/node_modules/entities/dist/escape.js",
|
|
631
|
+
"../node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-html.js",
|
|
632
|
+
"../node_modules/markdown-it/node_modules/entities/dist/generated/decode-data-xml.js",
|
|
633
|
+
"../node_modules/markdown-it/node_modules/entities/dist/generated/encode-html.js",
|
|
634
|
+
"../node_modules/markdown-it/node_modules/entities/dist/index.js",
|
|
635
|
+
"../node_modules/markdown-it/node_modules/entities/dist/internal/bin-trie-flags.js",
|
|
636
|
+
"../node_modules/markdown-it/node_modules/entities/dist/internal/decode-shared.js",
|
|
637
|
+
"../node_modules/mdurl/index.mjs",
|
|
638
|
+
"../node_modules/mdurl/lib/decode.mjs",
|
|
639
|
+
"../node_modules/mdurl/lib/encode.mjs",
|
|
640
|
+
"../node_modules/mdurl/lib/format.mjs",
|
|
641
|
+
"../node_modules/mdurl/lib/parse.mjs",
|
|
642
|
+
"../node_modules/punycode.js/punycode.es6.js",
|
|
606
643
|
"../node_modules/qrcode-generator/dist/qrcode.mjs",
|
|
607
644
|
"../node_modules/raf-schd/dist/raf-schd.esm.js",
|
|
608
645
|
"../node_modules/temporal-polyfill/chunks/classApi.js",
|
|
609
646
|
"../node_modules/temporal-polyfill/chunks/internal.js",
|
|
610
647
|
"../node_modules/temporal-polyfill/index.js",
|
|
648
|
+
"../node_modules/uc.micro/build/index.mjs",
|
|
611
649
|
"../node_modules/zrender/lib/Element.js",
|
|
612
650
|
"../node_modules/zrender/lib/Handler.js",
|
|
613
651
|
"../node_modules/zrender/lib/Storage.js",
|
|
@@ -736,23 +774,16 @@
|
|
|
736
774
|
"core/client/a11y/announcer.ts",
|
|
737
775
|
"core/client/a11y/motion-hook.ts",
|
|
738
776
|
"core/client/a11y/motion.ts",
|
|
739
|
-
"core/client/base/SomaApi.ts",
|
|
740
|
-
"core/client/base/SomaDict.ts",
|
|
741
|
-
"core/client/base/SomaEntity.ts",
|
|
742
777
|
"core/client/base/SomaHttpClient.ts",
|
|
743
778
|
"core/client/base/SomaLocaleOnlyPageRoot.ts",
|
|
744
779
|
"core/client/base/SomaPageRootBase.ts",
|
|
745
|
-
"core/client/base/SomaValidator.ts",
|
|
746
780
|
"core/client/base/decorators/Event.ts",
|
|
747
781
|
"core/client/base/decorators/Locale.ts",
|
|
748
782
|
"core/client/base/decorators/Page.ts",
|
|
749
783
|
"core/client/base/decorators/Show.ts",
|
|
750
784
|
"core/client/base/decorators/ShowList.ts",
|
|
751
785
|
"core/client/base/decorators/index.ts",
|
|
752
|
-
"core/client/base/defineSomaView.ts",
|
|
753
|
-
"core/client/base/index.ts",
|
|
754
786
|
"core/client/base/runAsync.ts",
|
|
755
|
-
"core/client/base/view-context.ts",
|
|
756
787
|
"core/client/behavior/adapter-popper.ts",
|
|
757
788
|
"core/client/behavior/port.ts",
|
|
758
789
|
"core/client/behavior/positioner.ts",
|
|
@@ -811,14 +842,26 @@
|
|
|
811
842
|
"core/client/engines/chart/port.ts",
|
|
812
843
|
"core/client/engines/diff/adapter-jsdiff.ts",
|
|
813
844
|
"core/client/engines/diff/index.ts",
|
|
845
|
+
"core/client/engines/diff/items.ts",
|
|
814
846
|
"core/client/engines/diff/port.ts",
|
|
847
|
+
"core/client/engines/diff/prose.ts",
|
|
815
848
|
"core/client/engines/dnd/adapter-pragmatic.ts",
|
|
816
849
|
"core/client/engines/dnd/index.ts",
|
|
817
850
|
"core/client/engines/dnd/port.ts",
|
|
851
|
+
"core/client/engines/highlight/adapter-lezer.ts",
|
|
852
|
+
"core/client/engines/highlight/index.ts",
|
|
853
|
+
"core/client/engines/highlight/port.ts",
|
|
818
854
|
"core/client/engines/load.ts",
|
|
855
|
+
"core/client/engines/markdown/adapter-markdown-it.ts",
|
|
856
|
+
"core/client/engines/markdown/blocks.ts",
|
|
857
|
+
"core/client/engines/markdown/index.ts",
|
|
858
|
+
"core/client/engines/markdown/port.ts",
|
|
819
859
|
"core/client/engines/qrcode/adapter-qrcode-generator.ts",
|
|
820
860
|
"core/client/engines/qrcode/index.ts",
|
|
821
861
|
"core/client/engines/qrcode/port.ts",
|
|
862
|
+
"core/client/engines/structured/adapter-js-yaml.ts",
|
|
863
|
+
"core/client/engines/structured/index.ts",
|
|
864
|
+
"core/client/engines/structured/port.ts",
|
|
822
865
|
"core/client/engines/table/adapter-tanstack.ts",
|
|
823
866
|
"core/client/engines/table/index.ts",
|
|
824
867
|
"core/client/engines/table/port.ts",
|