soma-core 2.0.1 → 2.1.0
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/README.md +2 -2
- package/bin/eject.cjs +5 -5
- package/bin/soma-runtime.cjs +5 -123
- package/bin/soma.cjs +2 -2
- package/bin/soma.ts +8 -20
- package/core/build/compiler/page-declaration-compiler.ts +5 -6
- package/core/build/lsp/soma-declaration.cjs +0 -6
- package/core/client/container/SomaContainerAdapter.ts +1 -1
- package/core/client/data/region-scope-views.ts +1 -1
- package/core/client/engine/event-engine.ts +1 -6
- package/core/client/engine/soma-bootstrap.ts +5 -13
- package/core/client/host-bridge/soma-bootstrap-from-app.ts +2 -2
- package/core/client/infra/i18n/II18n.ts +5 -6
- package/core/client/infra/i18n/locale-catalog.ts +8 -5
- package/core/client/infra/identity/identity-port.ts +1 -1
- package/core/client/keyboard/index.ts +0 -1
- package/core/client/keyboard/wiring.ts +0 -3
- package/core/client/parser/ui-config-parser.ts +6 -9
- package/core/client/registry/declaration-renderer.ts +1 -1
- package/core/client/runtime/SomaRuntimeServices.ts +1 -1
- package/core/inspect/check-runtime.ts +2 -3
- package/core/server/host/content-security-policy.ts +2 -11
- package/core/server/host/host-assembly-entry.ts +10 -2
- package/core/server/host/host-assembly.ts +28 -10
- package/core/server/host/host-caller.ts +52 -0
- package/core/server/host/host-response-headers.ts +49 -0
- package/core/server/host/locale-yaml.ts +7 -5
- package/core/server/host/published-page-assets.ts +1 -1
- package/core/server/host/resolve-host-request-hook.ts +2 -11
- package/core/server/host/resolve-host-tree-context.ts +7 -41
- package/core/server/host/server-page-assets.ts +0 -22
- package/core/server/host/source-packages.cjs +3 -4
- package/core/server/host/virtual-pages.ts +12 -70
- package/core/server/index.ts +1 -3
- package/core/server/node.ts +0 -1
- package/core/server/page-assets.ts +2 -20
- package/core/server/page-declaration.ts +1 -1
- package/core/server/registry/api-registry-store.ts +5 -25
- package/core/server/registry/asset-store.ts +5 -23
- package/core/server/registry/page-registry-repository.ts +9 -13
- package/core/server/registry/page-registry-store.ts +44 -82
- package/core/server/registry/publish-asset-pin.ts +3 -4
- package/core/server/registry/registry-subjects.ts +6 -6
- package/core/server/registry/rollback-plan.ts +5 -8
- package/core/server/registry/source/version-store.ts +8 -30
- package/core/server/registry/standard-product.ts +1 -1
- package/core/server/runtime-space/bindings.ts +1 -4
- package/core/server/runtime-space/gc.ts +2 -3
- package/core/server/runtime-space/inject.ts +4 -5
- package/core/server/runtime-space/resolve.ts +13 -27
- package/core/server/runtime-space/root.cjs +9 -100
- package/core/server/runtime-space/root.ts +3 -23
- package/core/server/runtime-space/types.ts +0 -11
- package/core/shared/artifact-compatibility.ts +6 -16
- package/core/shared/component-tree-artifact.ts +4 -8
- package/core/shared/core-diagnostic-codes.ts +1 -3
- package/core/shared/pipeline-error-codes-view.ts +1 -2
- package/core/shared/published-page-route.ts +1 -6
- package/core/shared/registry-generated/diagnostic-registry-index.ts +0 -2
- package/core/shared/registry-generated/diagnostic-registry.ts +0 -14
- package/core/shared/source-file-suffix.ts +8 -0
- package/core/shared/types/component-tree-artifact.types.ts +2 -15
- package/core/shared/types/host-assembly.types.ts +31 -2
- package/core/shared/types/locale.types.ts +3 -3
- package/core/shared/types/region-scope.types.ts +1 -1
- package/core/shared/types/ui-config.types.ts +2 -7
- package/core/shared/types/write.types.ts +1 -1
- package/dist/browser/soma-runtime.js +20 -36
- package/dist/cli/soma.js +8 -21
- package/dist/core/index.cjs +20 -38
- package/dist/lsp/component-tree.cjs +7 -14
- package/dist/types/client/container/SomaContainerAdapter.d.ts +1 -1
- package/dist/types/client/engine/event-engine.d.ts +0 -2
- package/dist/types/client/engine/soma-bootstrap.d.ts +2 -3
- package/dist/types/client/host-bridge/soma-bootstrap-from-app.d.ts +2 -2
- package/dist/types/client/infra/i18n/II18n.d.ts +5 -6
- package/dist/types/client/infra/i18n/locale-catalog.d.ts +3 -3
- package/dist/types/client/infra/identity/identity-port.d.ts +1 -1
- package/dist/types/client/keyboard/index.d.ts +1 -1
- package/dist/types/client/keyboard/wiring.d.ts +0 -2
- package/dist/types/client/registry/declaration-renderer.d.ts +1 -1
- package/dist/types/client/runtime/SomaRuntimeServices.d.ts +1 -1
- package/dist/types/server/host/content-security-policy.d.ts +0 -5
- package/dist/types/server/host/host-assembly-entry.d.ts +5 -2
- package/dist/types/server/host/host-assembly.d.ts +9 -4
- package/dist/types/server/host/host-caller.d.ts +10 -0
- package/dist/types/server/host/host-response-headers.d.ts +16 -0
- package/dist/types/server/host/published-page-assets.d.ts +1 -1
- package/dist/types/server/host/resolve-host-request-hook.d.ts +0 -4
- package/dist/types/server/host/resolve-host-tree-context.d.ts +1 -1
- package/dist/types/server/host/server-page-assets.d.ts +0 -2
- package/dist/types/server/host/virtual-pages.d.ts +4 -14
- package/dist/types/server/index.d.ts +1 -2
- package/dist/types/server/node.d.ts +1 -1
- package/dist/types/server/page-assets.d.ts +1 -4
- package/dist/types/server/page-declaration.d.ts +1 -1
- package/dist/types/server/registry/api-registry-store.d.ts +1 -6
- package/dist/types/server/registry/asset-store.d.ts +2 -11
- package/dist/types/server/registry/page-registry-repository.d.ts +4 -4
- package/dist/types/server/registry/page-registry-store.d.ts +22 -30
- package/dist/types/server/registry/registry-subjects.d.ts +2 -2
- package/dist/types/server/registry/rollback-plan.d.ts +0 -3
- package/dist/types/server/registry/source/version-store.d.ts +1 -9
- package/dist/types/server/registry/standard-product.d.ts +1 -1
- package/dist/types/server/runtime-space/resolve.d.ts +0 -3
- package/dist/types/server/runtime-space/root.d.cts +6 -29
- package/dist/types/server/runtime-space/root.d.ts +2 -7
- package/dist/types/server/runtime-space/types.d.ts +0 -9
- package/dist/types/shared/artifact-compatibility.d.ts +1 -3
- package/dist/types/shared/core-diagnostic-codes.d.ts +1 -1
- package/dist/types/shared/published-page-route.d.ts +1 -3
- package/dist/types/shared/registry-generated/diagnostic-registry.d.ts +0 -12
- package/dist/types/shared/types/component-tree-artifact.types.d.ts +2 -15
- package/dist/types/shared/types/host-assembly.types.d.ts +27 -1
- package/dist/types/shared/types/locale.types.d.ts +1 -1
- package/dist/types/shared/types/region-scope.types.d.ts +1 -1
- package/dist/types/shared/types/ui-config.types.d.ts +2 -7
- package/dist/types/shared/types/write.types.d.ts +1 -1
- package/global.d.ts +0 -9
- package/host-next/app/SomaPageClient.tsx +359 -0
- package/host-next/app/[...path]/page.tsx +22 -0
- package/host-next/app/api/[...path]/route.ts +98 -0
- package/host-next/app/api/soma-registry/[...path]/route.ts +79 -0
- package/host-next/app/components/SomaHostPage.tsx +128 -0
- package/host-next/app/components/SomaHydrationShell.tsx +20 -0
- package/host-next/app/components/SomaPageClientBoundary.tsx +13 -0
- package/host-next/app/components/SomaPageForbidden.tsx +19 -0
- package/host-next/app/favicon.ico/route.ts +13 -0
- package/host-next/app/globals.css +177 -0
- package/host-next/app/layout.tsx +27 -0
- package/host-next/app/page-access.ts +47 -0
- package/host-next/app/page.tsx +9 -0
- package/host-next/app/router-bridge.ts +42 -0
- package/host-next/app/soma/[...path]/route.ts +9 -0
- package/host-next/app/soma/_shared/host-prepare.ts +33 -0
- package/host-next/app/soma/_shared/page-http.ts +86 -0
- package/host-next/app/soma/manifest/route.ts +98 -0
- package/host-next/app/soma/page/route.ts +36 -0
- package/host-next/app/soma/route.ts +9 -0
- package/host-next/app/soma-runtime/[...file]/route.ts +21 -0
- package/host-next/app/soma-runtime/_shared/static-file.ts +89 -0
- package/host-next/bin/host-next.cjs +59 -0
- package/host-next/instrumentation.ts +13 -0
- package/host-next/next-env.d.ts +7 -0
- package/host-next/next.config.js +382 -0
- package/host-next/proxy.ts +43 -0
- package/host-next/src/shell-routes.cjs +51 -0
- package/host-next/src/workspace.ts +543 -0
- package/package.json +29 -4
- package/tsconfig.json +2 -1
- package/core/server/host/page-response-mode.cjs +0 -96
- package/core/server/host/page-response-request.ts +0 -33
- package/core/server/host/request-origin.ts +0 -18
- package/core/server/host/soma-request-hook-host.stub.ts +0 -4
- package/core/server/runtime-space/migrate-sources.ts +0 -124
- package/core/shared/source-compat.ts +0 -9
- package/dist/types/server/host/page-response-request.d.ts +0 -8
- package/dist/types/server/host/request-origin.d.ts +0 -1
- package/dist/types/server/host/soma-request-hook-host.stub.d.ts +0 -2
- package/dist/types/server/runtime-space/migrate-sources.d.ts +0 -19
- /package/dist/types/shared/{source-compat.d.ts → source-file-suffix.d.ts} +0 -0
|
@@ -31,5 +31,5 @@ export { DEFAULT_TREE_LIMITS, type ComponentNode, type ComponentTreeTrace, type
|
|
|
31
31
|
export { COMPONENT_TREE_CAPABILITIES, type ComponentRef, type RepeatPlan, type StructurePlan, } from '../shared/types/component-tree-artifact.types';
|
|
32
32
|
export type { SomaStructureSemanticToken } from '../shared/types/component-contract.types';
|
|
33
33
|
export { assertVirtualPagePrefix } from './host/virtual-pages';
|
|
34
|
-
/** Host
|
|
34
|
+
/** Host 虚拟页(预览)的类型:由 `soma.app.ts` 装配的 `virtualPages()` 交出。 */
|
|
35
35
|
export type { SomaVirtualPage, SomaVirtualPageRegistration, SomaVirtualPageResolver, } from './host/virtual-pages';
|
|
@@ -77,14 +77,11 @@ export interface ApiRegistryListResult {
|
|
|
77
77
|
export interface ApiRegistryStoreOptions {
|
|
78
78
|
/** 持久化目录(每接口一个 <name>.json),默认 `<runtime 根>/registry/apis` */
|
|
79
79
|
baseDir?: string;
|
|
80
|
-
/** 旧位置(只读回退):新目录没有该接口文件而旧目录有时读旧文件并报一次 CORE-RUNTIME-LEGACY-DIR;写入永远落新目录 */
|
|
81
|
-
legacyDir?: string;
|
|
82
80
|
/** 时钟注入点,默认 Date.now;测试传确定性时钟 */
|
|
83
81
|
now?: () => number;
|
|
84
82
|
}
|
|
85
83
|
export declare class ApiRegistryStore {
|
|
86
84
|
private readonly baseDir;
|
|
87
|
-
private readonly legacyDir;
|
|
88
85
|
private readonly now;
|
|
89
86
|
/** 读缓存:注册名 → { 记录, 落盘指纹 }。指纹变了就重读(与页面表同口径) */
|
|
90
87
|
private readonly cache;
|
|
@@ -117,9 +114,7 @@ export declare class ApiRegistryStore {
|
|
|
117
114
|
/** 缓存上限:一条记录很小,但仓库可以很大——不留无上限的 Map(2GB 机器纪律) */
|
|
118
115
|
private trimCache;
|
|
119
116
|
private stampOf;
|
|
120
|
-
/** 读路径:新目录有就用新的;否则旧目录有就只读回退(报一次诊断) */
|
|
121
117
|
private fileOf;
|
|
122
|
-
private writeFileOf;
|
|
123
118
|
}
|
|
124
119
|
export declare function assertApiName(name: unknown): string;
|
|
125
120
|
interface NormalizedApiInput {
|
|
@@ -136,7 +131,7 @@ export declare function normalizeApiInput(input: ApiRegisterInput): NormalizedAp
|
|
|
136
131
|
/** 存量记录归一化:补 app/tags 缺省值,名字以文件名为准 */
|
|
137
132
|
export declare function normalizeStoredApiRecord(raw: Record<string, unknown>, name: string): ApiRecord;
|
|
138
133
|
export declare function cloneApiRecord(record: ApiRecord): ApiRecord;
|
|
139
|
-
/** 共享实例:目录由 runtime 根解析(缺省 `<runtime 根>/registry/apis`)
|
|
134
|
+
/** 共享实例:目录由 runtime 根解析(缺省 `<runtime 根>/registry/apis`) */
|
|
140
135
|
export declare function getApiRegistryStore(): ApiRegistryStore;
|
|
141
136
|
/** 替换 / 复位共享实例(测试用;不传参即清空,下次访问按当前环境重建) */
|
|
142
137
|
export declare function resetApiRegistryStore(store?: ApiRegistryStore): void;
|
|
@@ -70,12 +70,7 @@ export declare function assetRelativePath(digest: string): string;
|
|
|
70
70
|
/** 共享文件系统资产库。写用原子落盘(临时文件 + rename),写一半被杀不留半个对象。 */
|
|
71
71
|
export declare class FileRegistryAssetStore implements RegistryAssetStore {
|
|
72
72
|
private readonly baseDir;
|
|
73
|
-
|
|
74
|
-
/** `legacyDir`:旧位置,只读回退(新目录里没有该摘要而旧目录有时读旧文件并报一次 CORE-RUNTIME-LEGACY-DIR);写入永远落新目录 */
|
|
75
|
-
constructor(baseDir: string, options?: {
|
|
76
|
-
readonly legacyDir?: string;
|
|
77
|
-
});
|
|
78
|
-
/** 读用路径:新目录有就用新的;否则旧目录有就回退 */
|
|
73
|
+
constructor(baseDir: string);
|
|
79
74
|
private readablePath;
|
|
80
75
|
directory(): string;
|
|
81
76
|
put(kind: SomaAssetKind, content: string): SomaAssetRef;
|
|
@@ -99,11 +94,7 @@ export declare class InMemoryRegistryAssetStore implements RegistryAssetStore {
|
|
|
99
94
|
/**
|
|
100
95
|
* 缺省资产目录。
|
|
101
96
|
*
|
|
102
|
-
*
|
|
103
|
-
* 再没有就是 `<runtime 根>/registry/assets`。
|
|
104
|
-
* 为什么要跟着页面目录走:宿主把 `SOMA_PAGE_REGISTRY_DIR` 挪到共享卷上,资产若仍落在
|
|
105
|
-
* 进程本地目录,表现是"发布成功、钉子有摘要、另一个实例对账时说字节不在库中"——
|
|
106
|
-
* 而那台机器上确实不在。两份存储必须一起挪,所以缺省就绑在一起。
|
|
97
|
+
* 固定为 `<runtime 根>/registry/assets`;页面与资产同在 runtime 根下,换到共享卷时设 `SOMA_RUNTIME_DIR` 一起挪。
|
|
107
98
|
*
|
|
108
99
|
* **页面走对象存储 CAS 的部署必须显式换库**:那条路径
|
|
109
100
|
* (`ConditionalPageRegistryRepository`)的页面数据在对象存储里,而这里的缺省后端是
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PageRegistryDeclaration, type PageRegistryListOptions, type PageRegistryListResult, type PageRegistryMeta, type PageRegistryPublishOptions, type
|
|
1
|
+
import { type PageRegistryDeclaration, type PageRegistryListOptions, type PageRegistryListResult, type PageRegistryMeta, type PageRegistryPublishOptions, type PageRegistryWriteOptions, type PageVersionRecord } from './page-registry-store';
|
|
2
2
|
import { type PageRegistryStore } from './page-registry-store';
|
|
3
3
|
import type { ConditionalObjectStore } from './conditional-object-store';
|
|
4
4
|
import type { SomaCoreDiagnostic } from '../../shared/core-diagnostic-codes';
|
|
@@ -15,7 +15,7 @@ export interface RollbackResult {
|
|
|
15
15
|
/** API 的唯一仓储门面;全部方法异步,后端可为共享文件系统或对象存储 CAS。 */
|
|
16
16
|
export interface PageRegistryRepository {
|
|
17
17
|
getTreeCompileContext?(name: string, app: string): TreeCompileContext | undefined;
|
|
18
|
-
publish(name: string, declaration: unknown, options?:
|
|
18
|
+
publish(name: string, declaration: unknown, options?: PageRegistryPublishOptions): Promise<PublishResult>;
|
|
19
19
|
get(name: string, version?: number): Promise<PageVersionRecord>;
|
|
20
20
|
list(options?: PageRegistryListOptions): Promise<PageRegistryListResult>;
|
|
21
21
|
rollback(name: string, version: number, options?: PageRegistryWriteOptions): Promise<RollbackResult>;
|
|
@@ -36,7 +36,7 @@ export declare class FilePageRegistryRepository implements PageRegistryRepositor
|
|
|
36
36
|
private readonly injectedPages?;
|
|
37
37
|
constructor(injectedPages?: PageRegistryStore | undefined);
|
|
38
38
|
getTreeCompileContext(name: string, app: string): TreeCompileContext | undefined;
|
|
39
|
-
publish(name: string, declaration: unknown, options?:
|
|
39
|
+
publish(name: string, declaration: unknown, options?: PageRegistryPublishOptions): Promise<PublishResult>;
|
|
40
40
|
get(name: string, version?: number): Promise<PageVersionRecord>;
|
|
41
41
|
list(options?: PageRegistryListOptions): Promise<PageRegistryListResult>;
|
|
42
42
|
rollback(name: string, version: number, options?: PageRegistryWriteOptions): Promise<RollbackResult>;
|
|
@@ -65,7 +65,7 @@ export declare class ConditionalPageRegistryRepository implements PageRegistryRe
|
|
|
65
65
|
treeContextResolver?: (name: string, app: string) => TreeCompileContext | undefined;
|
|
66
66
|
});
|
|
67
67
|
getTreeCompileContext(name: string, app: string): TreeCompileContext | undefined;
|
|
68
|
-
publish(name: string, declaration: unknown, options?:
|
|
68
|
+
publish(name: string, declaration: unknown, options?: PageRegistryPublishOptions): Promise<PublishResult>;
|
|
69
69
|
get(name: string, version?: number): Promise<PageVersionRecord>;
|
|
70
70
|
list(options?: PageRegistryListOptions): Promise<PageRegistryListResult>;
|
|
71
71
|
rollback(name: string, version: number, options?: PageRegistryWriteOptions): Promise<RollbackResult>;
|
|
@@ -147,12 +147,12 @@ export interface PageVersionRecord {
|
|
|
147
147
|
assets?: SomaAssetPin;
|
|
148
148
|
/**
|
|
149
149
|
* 编译身份(KC16):产出这份存档产物的编译器身份,不透明字符串,core 只做相等比较。
|
|
150
|
-
* 读不到身份时为 `''
|
|
150
|
+
* 读不到身份时为 `''`(永不相等,失败方向是「不用缓存」);记录里必须有这个字段。
|
|
151
151
|
*/
|
|
152
152
|
identity: string;
|
|
153
153
|
/**
|
|
154
154
|
* 信封头(KC2 × KC16):存档产物的格式标识、能力声明与本页引用组件摘要,运行兼容判据只读它。
|
|
155
|
-
* `null` =
|
|
155
|
+
* `null` = 该版本没有信封头(如无已编译产物);字段本身必须在记录里。
|
|
156
156
|
*/
|
|
157
157
|
envelope: SomaArtifactEnvelopeHead | null;
|
|
158
158
|
/** 一版本一主题(00e Q-109):回滚重编所需;端口没报主题名则缺席 */
|
|
@@ -165,21 +165,20 @@ export interface PageVersionRecord {
|
|
|
165
165
|
*/
|
|
166
166
|
staged?: true;
|
|
167
167
|
/**
|
|
168
|
-
* 来源(08c origin;页面级稿 §4.5 扩展):`format`
|
|
169
|
-
* 其余是调用方给的不透明标签(core 只存不解读);缺席 = 有声明源。`author` / `label` 取信封 `source` / `version`。
|
|
168
|
+
* 来源(08c origin;页面级稿 §4.5 扩展):`format` 是调用方给的不透明来源格式标签(core 只存不解读);缺席 = 有声明源。`author` / `label` 取信封 `source` / `version`。
|
|
170
169
|
*/
|
|
171
170
|
origin?: PageVersionOrigin;
|
|
172
|
-
/** 地址(D3):版本所在的 runtime
|
|
173
|
-
address
|
|
171
|
+
/** 地址(D3):版本所在的 runtime 空间地址;记录必须带 */
|
|
172
|
+
address: string;
|
|
174
173
|
}
|
|
175
|
-
/** 版本来源:`format`
|
|
174
|
+
/** 版本来源:`format` 是来源格式标签(由调用方给,core 不解读) */
|
|
176
175
|
export interface PageVersionOrigin {
|
|
177
176
|
readonly format: string;
|
|
178
177
|
readonly author?: string;
|
|
179
178
|
readonly label?: string;
|
|
180
179
|
readonly operator?: string;
|
|
181
180
|
}
|
|
182
|
-
/** publish
|
|
181
|
+
/** publish 的可选项 */
|
|
183
182
|
export interface PageRegistryPublishOptions {
|
|
184
183
|
/** 生命周期状态:publish 只接受 published / draft(archived 走 archive()) */
|
|
185
184
|
status?: Extract<PageRegistryStatus, 'published' | 'draft'>;
|
|
@@ -189,7 +188,7 @@ export interface PageRegistryPublishOptions {
|
|
|
189
188
|
operator?: string;
|
|
190
189
|
/** 本次发布所用主题名(Host 告知;端口在身份分量里报告的主题名优先级更低) */
|
|
191
190
|
themeName?: string;
|
|
192
|
-
/** 版本来源(页面级稿 §4.5
|
|
191
|
+
/** 版本来源(页面级稿 §4.5):缺省无 */
|
|
193
192
|
origin?: PageVersionOrigin;
|
|
194
193
|
/** 版本地址(D3):缺省 `/<名>`;非缺省时必须是合法的精确 / 模式地址,且通过地址冲突闸门 */
|
|
195
194
|
address?: string;
|
|
@@ -218,7 +217,7 @@ export interface PageVersionFields {
|
|
|
218
217
|
/** 批量发布批次号(KC19);给了这条记录带 `staged` 标记,批次提交后才对读路径可见 */
|
|
219
218
|
batchId?: string;
|
|
220
219
|
/**
|
|
221
|
-
*
|
|
220
|
+
* 回滚复用:存档产物逐字节搬到新版本,不调编译端口、不重做预编译
|
|
222
221
|
* (新版本的 `compiled` / `identity` / `envelope` 与目标版本相等)。
|
|
223
222
|
*/
|
|
224
223
|
archive?: {
|
|
@@ -307,18 +306,12 @@ export interface PageRegistryStoreOptions {
|
|
|
307
306
|
treeContextResolver?: (name: string, app: string) => TreeCompileContext | undefined;
|
|
308
307
|
/** 持久化目录(每页面一个 <name>.json),默认 `<runtime 根>/registry/pages`(经 `currentRuntimeLayout` 解析) */
|
|
309
308
|
baseDir?: string;
|
|
310
|
-
/**
|
|
311
|
-
* 旧位置(只读回退):新目录里没有该页面文件、旧目录有时读旧文件并报一次 CORE-RUNTIME-LEGACY-DIR;
|
|
312
|
-
* 写入永远落新目录(带上旧文件的全部历史,等于按页迁移)。旧目录自身不被改动。
|
|
313
|
-
*/
|
|
314
|
-
legacyDir?: string;
|
|
315
309
|
/** 时钟注入点,默认 Date.now;测试传确定性时钟 */
|
|
316
310
|
now?: () => number;
|
|
317
311
|
}
|
|
318
312
|
export declare class PageRegistryStore {
|
|
319
313
|
private readonly treeContextResolver;
|
|
320
314
|
private readonly baseDir;
|
|
321
|
-
private readonly legacyDir;
|
|
322
315
|
private readonly now;
|
|
323
316
|
/**
|
|
324
317
|
* 内存缓存:页面名 → { 版本数组, 落盘指纹 }。
|
|
@@ -334,10 +327,10 @@ export declare class PageRegistryStore {
|
|
|
334
327
|
storageDirectory(): string;
|
|
335
328
|
/**
|
|
336
329
|
* 发布一个新版本(版本号自增),返回新版本记录。
|
|
337
|
-
*
|
|
330
|
+
* 第三参是选项对象(status / 元数据 / app / tags / operator)。
|
|
338
331
|
*/
|
|
339
|
-
publish(name: string, declaration: unknown, options?:
|
|
340
|
-
publishWhileLocked(name: string, declaration: unknown, options?:
|
|
332
|
+
publish(name: string, declaration: unknown, options?: PageRegistryPublishOptions): PageVersionRecord;
|
|
333
|
+
publishWhileLocked(name: string, declaration: unknown, options?: PageRegistryPublishOptions): PageVersionRecord;
|
|
341
334
|
/**
|
|
342
335
|
* 批量发布准备段的一页(KC19):完整走单页写管线的全部闸门(声明归一化 / 编译闸门 / 结构闸门 / 版本钉守卫),
|
|
343
336
|
* 但**不写存储、不占版本号**——产出的是 `SomaStagedPage` 的素材(声明、编译产物与待落库的记录字段)。
|
|
@@ -427,9 +420,9 @@ export declare class PageRegistryStore {
|
|
|
427
420
|
private mustFindVersion;
|
|
428
421
|
/** 落盘指纹:mtime + 大小。两者都不变而内容变了的概率可以忽略,且 stat 比读文件便宜一个量级 */
|
|
429
422
|
private stampOf;
|
|
430
|
-
/**
|
|
423
|
+
/** 读一个页面的全部版本:指纹未变才用缓存,否则读盘、核对记录完整性并入缓存 */
|
|
431
424
|
private load;
|
|
432
|
-
/** 读盘 + 解析 +
|
|
425
|
+
/** 读盘 + 解析 + 核对记录完整性。不碰任何缓存,由调用方决定放哪 */
|
|
433
426
|
private parseVersionsFile;
|
|
434
427
|
/**
|
|
435
428
|
* 清单摘要缓存:页面名 → { 摘要, 落盘指纹 }。
|
|
@@ -453,10 +446,7 @@ export declare class PageRegistryStore {
|
|
|
453
446
|
private trimCache;
|
|
454
447
|
/** 写穿:原子落盘(临时文件 + rename)再刷新缓存;写一半被杀不会留下半个 JSON */
|
|
455
448
|
private save;
|
|
456
|
-
/** 读路径:新目录有就用新的;否则旧目录有就只读回退(报一次 CORE-RUNTIME-LEGACY-DIR);都没有返回新目录路径 */
|
|
457
449
|
private fileOf;
|
|
458
|
-
/** 写路径:永远是新目录 */
|
|
459
|
-
private writeFileOf;
|
|
460
450
|
}
|
|
461
451
|
/** 批次号文法:既是路径片段(`batches/<batchId>.json`)又是对象键片段,收紧到安全字符集 */
|
|
462
452
|
export declare const BATCH_ID_PATTERN: RegExp;
|
|
@@ -485,8 +475,8 @@ export declare function planRollbackForTarget(target: PageVersionRecord, treeCon
|
|
|
485
475
|
export declare function createPageVersionRecord(name: string, versions: readonly PageVersionRecord[], fields: PageVersionFields, createdAt: number): PageVersionRecord;
|
|
486
476
|
export declare function assertPageName(name: unknown): string;
|
|
487
477
|
export declare function assertVersionNumber(version: unknown): asserts version is number;
|
|
488
|
-
/** publish
|
|
489
|
-
export declare function normalizePublishOptions(options:
|
|
478
|
+
/** publish 第三参归一化:选项对象逐字段校验 */
|
|
479
|
+
export declare function normalizePublishOptions(options: PageRegistryPublishOptions): PageRegistryPublishOptions;
|
|
490
480
|
/**
|
|
491
481
|
* 声明归一化:HTML + 平铺 `uiYaml` 必填;`eventYaml` / `styleYaml` 是正式侧车,缺省或空串 = 没有该件。
|
|
492
482
|
*
|
|
@@ -505,8 +495,11 @@ export declare function normalizeDeclaration(declaration: unknown, treeContext?:
|
|
|
505
495
|
export declare function isTreeDeclaration(value: unknown): boolean;
|
|
506
496
|
/** 声明总字节数:UTF-8 计,涵盖 declaration 的全部字符串字段 */
|
|
507
497
|
export declare function declarationByteSize(declaration: PageRegistryDeclaration): number;
|
|
508
|
-
/**
|
|
509
|
-
|
|
498
|
+
/**
|
|
499
|
+
* 读盘记录核对:记录必须完整(`identity` / `envelope` / `address` / `app` / `tags` 都在),缺字段或形状不对直接报错,
|
|
500
|
+
* 不在读取时补缺省值;旧页面语法同样必须离线迁移,不在读取时自动转换。
|
|
501
|
+
*/
|
|
502
|
+
export declare function assertStoredRecord(record: Record<string, unknown>): PageVersionRecord;
|
|
510
503
|
/** 对外返回深拷贝,避免调用方改动污染内存缓存 */
|
|
511
504
|
export declare function cloneRecord(record: PageVersionRecord): PageVersionRecord;
|
|
512
505
|
/**
|
|
@@ -516,8 +509,7 @@ export declare function cloneRecord(record: PageVersionRecord): PageVersionRecor
|
|
|
516
509
|
*/
|
|
517
510
|
export declare function assertPublishableRegionScopes(compiledPage: SomaCompiledPageAssets | null | undefined): void;
|
|
518
511
|
/**
|
|
519
|
-
* 共享实例:目录由 runtime 根解析(缺省 `<host>/.soma/runtime/registry/pages
|
|
520
|
-
* 旧环境变量 SOMA_PAGE_REGISTRY_DIR 作别名,优先于新缺省;旧位置有数据时只读回退。
|
|
512
|
+
* 共享实例:目录由 runtime 根解析(缺省 `<host>/.soma/runtime/registry/pages`)。
|
|
521
513
|
*/
|
|
522
514
|
export declare function getPageRegistryStore(): PageRegistryStore;
|
|
523
515
|
/** 替换 / 复位共享实例(测试用;不传参即清空,下次访问按当前环境重建) */
|
|
@@ -7,11 +7,11 @@ export interface RegistrySubject {
|
|
|
7
7
|
/** 可选组织归属;配置格式支持 名字@组织:令牌:作用域。 */
|
|
8
8
|
orgId?: string;
|
|
9
9
|
/** 凭据来源,只用于日志与排障 */
|
|
10
|
-
source: 'token' | '
|
|
10
|
+
source: 'token' | 'single-token' | 'open-door';
|
|
11
11
|
}
|
|
12
12
|
/** 多凭据配置:`名字:令牌:作用域|作用域, 名字:令牌:作用域` */
|
|
13
13
|
export declare const REGISTRY_TOKENS_ENV = "SOMA_REGISTRY_TOKENS";
|
|
14
|
-
/** 单凭据配置
|
|
14
|
+
/** 单凭据配置 */
|
|
15
15
|
export declare const REGISTRY_TOKEN_ENV = "SOMA_REGISTRY_TOKEN";
|
|
16
16
|
/** 演示门 */
|
|
17
17
|
export declare const REGISTRY_OPEN_ENV = "SOMA_REGISTRY_OPEN";
|
|
@@ -13,9 +13,6 @@ export type SomaRollbackPlan = {
|
|
|
13
13
|
readonly source: PageVersionRecord;
|
|
14
14
|
readonly reason: SomaArtifactIncompatibility;
|
|
15
15
|
readonly supplyDiff: SomaAssetReconciliation;
|
|
16
|
-
} | {
|
|
17
|
-
readonly kind: 'legacy-copy';
|
|
18
|
-
readonly source: PageVersionRecord;
|
|
19
16
|
};
|
|
20
17
|
export interface PlanRollbackOptions {
|
|
21
18
|
/** 缺信封头是否判不兼容(G6 守卫收紧后 true);缺省 false = 存量守卫口径 */
|
|
@@ -2,10 +2,8 @@ import type { ConditionalObjectStore } from '../conditional-object-store';
|
|
|
2
2
|
import type { SomaSourceVersion, SomaSourceVersionChange, SomaSourceVersionStore } from './types';
|
|
3
3
|
/** @req F-003.3 R-028 */
|
|
4
4
|
export interface SomaFileSourceVersionStoreOptions {
|
|
5
|
-
/** 持久化目录(每资产一个 `<键>.source.json`);缺省由 runtime
|
|
5
|
+
/** 持久化目录(每资产一个 `<键>.source.json`);缺省由 runtime 根解析(`<root>/registry/sources`,见 `runtime-space/root.cjs`) */
|
|
6
6
|
readonly baseDir?: string;
|
|
7
|
-
/** 旧位置(只读回退):新目录没有该资产文件而旧目录有时读旧文件并报一次 CORE-RUNTIME-LEGACY-DIR;写入永远落新目录 */
|
|
8
|
-
readonly legacyDir?: string;
|
|
9
7
|
}
|
|
10
8
|
/**
|
|
11
9
|
* 共享文件系统上的版本存储(缺省后端)。
|
|
@@ -13,7 +11,6 @@ export interface SomaFileSourceVersionStoreOptions {
|
|
|
13
11
|
*/
|
|
14
12
|
export declare class SomaFileSourceVersionStore implements SomaSourceVersionStore {
|
|
15
13
|
private readonly baseDir;
|
|
16
|
-
private readonly legacyDir;
|
|
17
14
|
/** 资产名 → { 全部版本, 落盘指纹 };指纹变了就重读 */
|
|
18
15
|
private readonly cache;
|
|
19
16
|
constructor(options?: SomaFileSourceVersionStoreOptions);
|
|
@@ -21,12 +18,7 @@ export declare class SomaFileSourceVersionStore implements SomaSourceVersionStor
|
|
|
21
18
|
read(name: string): Promise<readonly SomaSourceVersion[]>;
|
|
22
19
|
names(): Promise<readonly string[]>;
|
|
23
20
|
mutate<T>(name: string, change: SomaSourceVersionChange<T>): Promise<T>;
|
|
24
|
-
/**
|
|
25
|
-
* 读路径:新目录 > 旧目录(告警 CORE-RUNTIME-LEGACY-DIR);只认新后缀 `.source.json`。
|
|
26
|
-
* 找不到时返回新目录的路径(写路径与「不存在」判定共用)。
|
|
27
|
-
*/
|
|
28
21
|
private fileOf;
|
|
29
|
-
private writeFileOf;
|
|
30
22
|
}
|
|
31
23
|
/** @req F-003.3 R-028 */
|
|
32
24
|
export interface SomaConditionalSourceVersionStoreOptions {
|
|
@@ -62,7 +62,7 @@ export interface RegistryStandardProduct {
|
|
|
62
62
|
/** 资产载荷(R-27;旧存档没有) */
|
|
63
63
|
readonly assets?: PageDeclarationAssets;
|
|
64
64
|
}
|
|
65
|
-
/** 版本记录 → 标准产物;旧方言存档(含方言键)与组件树页返回 null
|
|
65
|
+
/** 版本记录 → 标准产物;旧方言存档(含方言键)与组件树页返回 null(调用方走组件树通道或报无标准产物) */
|
|
66
66
|
export declare function standardProductOf(record: {
|
|
67
67
|
readonly name: string;
|
|
68
68
|
readonly version: number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type SomaPageAssetLoadProfile } from '../host/server-page-assets';
|
|
2
1
|
import type { SomaEnvelopeQuerySpec } from '../../shared/types/page-envelope.types';
|
|
3
2
|
import type { TreeCompileContext } from '../../shared/types/component-tree.types';
|
|
4
3
|
import { runtimeStore } from './bindings';
|
|
@@ -6,8 +5,6 @@ import type { SomaRuntimeBinding, SomaRuntimeMatch, SomaRuntimePageResult } from
|
|
|
6
5
|
export interface SomaLoadPageOptions {
|
|
7
6
|
/** 宿主根(缺省 SOMA_HOST_DIR) */
|
|
8
7
|
readonly hostDir?: string;
|
|
9
|
-
/** `headless` 供无头页面对象路由(不下发 html / 样式) */
|
|
10
|
-
readonly profile?: SomaPageAssetLoadProfile;
|
|
11
8
|
readonly watch?: boolean;
|
|
12
9
|
readonly treeContext?: TreeCompileContext;
|
|
13
10
|
}
|
|
@@ -10,8 +10,8 @@ export function currentRuntimeLayout(env?: SomaEnv, cwd?: string): Readonly<{
|
|
|
10
10
|
dirs: Readonly<{
|
|
11
11
|
root: any;
|
|
12
12
|
pages: string;
|
|
13
|
-
sources:
|
|
14
|
-
assets:
|
|
13
|
+
sources: string;
|
|
14
|
+
assets: string;
|
|
15
15
|
apis: string;
|
|
16
16
|
bindings: string;
|
|
17
17
|
artifacts: string;
|
|
@@ -20,20 +20,9 @@ export function currentRuntimeLayout(env?: SomaEnv, cwd?: string): Readonly<{
|
|
|
20
20
|
config: string;
|
|
21
21
|
journal: string;
|
|
22
22
|
}>;
|
|
23
|
-
sources: Readonly<{
|
|
24
|
-
pages: string;
|
|
25
|
-
apis: string;
|
|
26
|
-
}>;
|
|
27
|
-
legacy: Readonly<{}>;
|
|
28
23
|
}>;
|
|
29
24
|
/** @typedef {Readonly<Record<string, string | undefined>>} SomaEnv */
|
|
30
25
|
export const SOMA_RUNTIME_DIR_ENV: "SOMA_RUNTIME_DIR";
|
|
31
|
-
export const SOMA_RUNTIME_LEGACY_ENV: Readonly<{
|
|
32
|
-
pages: "SOMA_PAGE_REGISTRY_DIR";
|
|
33
|
-
sources: "SOMA_BIZ_REGISTRY_DIR";
|
|
34
|
-
assets: "SOMA_REGISTRY_ASSET_DIR";
|
|
35
|
-
apis: "SOMA_API_REGISTRY_DIR";
|
|
36
|
-
}>;
|
|
37
26
|
export const SOMA_RUNTIME_DEFAULT_RELATIVE: string;
|
|
38
27
|
/** 源码目录名:根不能落在这些目录里(防止产物写进作者源码目录) */
|
|
39
28
|
export const SOMA_RUNTIME_FORBIDDEN_SOURCE_DIRS: readonly string[];
|
|
@@ -48,20 +37,17 @@ export function resolveSomaHostDir(env?: SomaEnv, cwd?: string): string;
|
|
|
48
37
|
/** 唯一的根解析函数 */
|
|
49
38
|
/** @param {SomaEnv} [env] */
|
|
50
39
|
export function resolveSomaRuntimeRoot(hostDir: any, env?: SomaEnv): any;
|
|
51
|
-
/**
|
|
52
|
-
* 完整布局:根、各子目录、四个 Registry 目录的来源与旧位置候选。
|
|
53
|
-
* cwd 只用于生成旧位置候选(旧缺省相对 cwd),不参与新位置。
|
|
54
|
-
*/
|
|
40
|
+
/** 完整布局:根与各子目录(四个 Registry 目录固定在 `<root>/registry/<kind>`) */
|
|
55
41
|
/** @param {SomaEnv} [env] */
|
|
56
|
-
export function resolveSomaRuntimeLayout(hostDir: any, env?: SomaEnv
|
|
42
|
+
export function resolveSomaRuntimeLayout(hostDir: any, env?: SomaEnv): Readonly<{
|
|
57
43
|
hostDir: string;
|
|
58
44
|
root: any;
|
|
59
45
|
rootFromEnv: boolean;
|
|
60
46
|
dirs: Readonly<{
|
|
61
47
|
root: any;
|
|
62
48
|
pages: string;
|
|
63
|
-
sources:
|
|
64
|
-
assets:
|
|
49
|
+
sources: string;
|
|
50
|
+
assets: string;
|
|
65
51
|
apis: string;
|
|
66
52
|
bindings: string;
|
|
67
53
|
artifacts: string;
|
|
@@ -70,16 +56,7 @@ export function resolveSomaRuntimeLayout(hostDir: any, env?: SomaEnv, cwd?: stri
|
|
|
70
56
|
config: string;
|
|
71
57
|
journal: string;
|
|
72
58
|
}>;
|
|
73
|
-
sources: Readonly<{
|
|
74
|
-
pages: string;
|
|
75
|
-
apis: string;
|
|
76
|
-
}>;
|
|
77
|
-
legacy: Readonly<{}>;
|
|
78
59
|
}>;
|
|
79
|
-
/** 目录存在且至少有一个条目(忽略锁文件与临时文件) */
|
|
80
|
-
export function dirHasEntries(dir: any): boolean;
|
|
81
|
-
/** 旧位置候选里第一个有数据的目录;没有返回 null。只用于只读回退 */
|
|
82
|
-
export function firstLegacyDirWithData(layout: any, kind: any): any;
|
|
83
60
|
/**
|
|
84
61
|
* 生产模式且没设 SOMA_RUNTIME_DIR 时的告警文案(AD-39 Q8);不需要告警返回 null。
|
|
85
62
|
* 生产判据沿用 host-config-paths 的环境名口径:SOMA_ENV → APP_ENV → NODE_ENV,归一后为 prod。
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SomaRuntimeLayout } from './types';
|
|
2
2
|
type Env = Readonly<Record<string, string | undefined>>;
|
|
3
3
|
/** 根目录越界:CORE-RUNTIME-ROOT-INVALID,调用方应拒绝启动 */
|
|
4
4
|
export declare const SomaRuntimeRootError: new (message: string, details?: Record<string, unknown>) => Error & {
|
|
@@ -8,14 +8,9 @@ export declare const SomaRuntimeRootError: new (message: string, details?: Recor
|
|
|
8
8
|
export declare const resolveSomaHostDir: (env?: Env, cwd?: string) => string;
|
|
9
9
|
/** @testHook 测试直接解析运行根 */
|
|
10
10
|
export declare const resolveSomaRuntimeRoot: (hostDir: string, env?: Env) => string;
|
|
11
|
-
export declare const resolveSomaRuntimeLayout: (hostDir: string, env?: Env
|
|
12
|
-
export declare const firstLegacyDirWithData: (layout: SomaRuntimeLayout, kind: SomaRegistryStoreKind) => string | null;
|
|
11
|
+
export declare const resolveSomaRuntimeLayout: (hostDir: string, env?: Env) => SomaRuntimeLayout;
|
|
13
12
|
/** @testHook 测试读取运行根的生产告警 */
|
|
14
13
|
export declare const runtimeRootProductionWarning: (hostDir: string, env?: Env) => string | null;
|
|
15
14
|
/** 取当前进程的布局(宿主根取 SOMA_HOST_DIR,缺省 cwd) */
|
|
16
15
|
export declare function currentRuntimeLayout(env?: Env, cwd?: string): SomaRuntimeLayout;
|
|
17
|
-
/** 旧目录只读回退时的一次性诊断 CORE-RUNTIME-LEGACY-DIR(每个旧目录每进程一次) */
|
|
18
|
-
export declare function warnRuntimeLegacyDirOnce(kind: SomaRegistryStoreKind, legacyDir: string): void;
|
|
19
|
-
/** 测试复位 */
|
|
20
|
-
export declare function resetRuntimeLegacyWarnings(): void;
|
|
21
16
|
export {};
|
|
@@ -153,19 +153,12 @@ export interface SomaRuntimeDirs {
|
|
|
153
153
|
readonly config: string;
|
|
154
154
|
readonly journal: string;
|
|
155
155
|
}
|
|
156
|
-
/** 某个 Registry 目录的来源:显式旧环境变量别名 / 跟着页面目录走 / runtime 根缺省 */
|
|
157
|
-
export type SomaRuntimeDirSource = 'alias' | 'sibling' | 'root';
|
|
158
|
-
/** Registry 存储类别(旧名 `biz` 已改 `sources`,不再识别) */
|
|
159
|
-
export type SomaRegistryStoreKind = 'pages' | 'sources' | 'assets' | 'apis';
|
|
160
156
|
export interface SomaRuntimeLayout {
|
|
161
157
|
readonly hostDir: string;
|
|
162
158
|
readonly root: string;
|
|
163
159
|
/** `SOMA_RUNTIME_DIR` 是否显式设置 */
|
|
164
160
|
readonly rootFromEnv: boolean;
|
|
165
161
|
readonly dirs: SomaRuntimeDirs;
|
|
166
|
-
readonly sources: Readonly<Record<SomaRegistryStoreKind, SomaRuntimeDirSource>>;
|
|
167
|
-
/** 旧位置候选(只读回退用);来源是 alias / sibling 的类别为空 */
|
|
168
|
-
readonly legacy: Readonly<Record<SomaRegistryStoreKind, readonly string[]>>;
|
|
169
162
|
}
|
|
170
163
|
export interface SomaRuntimeStoreStats {
|
|
171
164
|
readonly capacity: number;
|
|
@@ -190,8 +183,6 @@ export interface SomaRuntimeGcOptions {
|
|
|
190
183
|
readonly dryRun?: boolean;
|
|
191
184
|
/** 年龄不足的文件不删(防止与「刚写产物、还没写绑定」竞态),缺省 5 分钟 */
|
|
192
185
|
readonly minAgeMs?: number;
|
|
193
|
-
/** 额外要扫描的 Registry 版本记录目录(未迁移的旧目录:`layout.legacy.*`);缺席的目录按空处理 */
|
|
194
|
-
readonly extraRegistryDirs?: readonly string[];
|
|
195
186
|
/** 调用方(进程内绑定表)额外声明在用的摘要 */
|
|
196
187
|
readonly referenced?: Iterable<string>;
|
|
197
188
|
readonly now?: () => number;
|
|
@@ -55,13 +55,11 @@ export interface SomaArtifactCompatibilityOptions {
|
|
|
55
55
|
readonly envelopeRequired?: boolean;
|
|
56
56
|
}
|
|
57
57
|
/**
|
|
58
|
-
* 信封头的格式标识是否被当前 core
|
|
58
|
+
* 信封头的格式标识是否被当前 core 接受:只认 `format`,且在闭集内。
|
|
59
59
|
* 供挂载守卫在「格式」这一步直接引用(与 `checkArtifactRuntimeCompatibility` 同一口径)。
|
|
60
60
|
*/
|
|
61
61
|
export declare function isArtifactFormatAccepted(head: {
|
|
62
62
|
readonly format?: unknown;
|
|
63
|
-
readonly schemaVersion?: unknown;
|
|
64
|
-
readonly grammarVersion?: unknown;
|
|
65
63
|
}): boolean;
|
|
66
64
|
/**
|
|
67
65
|
* 两级判据的第二级判定(第一级「只差身份」不在此处:兼容即返回 reuse)。
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentTreeErrorCode } from './component-tree-errors';
|
|
2
2
|
import type { SomaGenerationErrorShape, SomaGenerationLayer } from './types/generation-error.types';
|
|
3
|
-
export declare const SOMA_CORE_DIAGNOSTIC_CODES: readonly ["CORE-PORT-MISSING", "CORE-PORT-CONFLICT", "CORE-PORT-LEGACY-PACK", "CORE-PORT-IDENTITY-DRIFT", "CORE-PORT-RECOMPILE", "CORE-PORT-PURPOSE", "CORE-STYLE-INVALID", "CORE-HOOK-UNCOMPILED", "CORE-SHELL-SLOT", "CORE-CONTRACT-SHAPE", "CORE-CONTRACT-DEFAULTS", "CORE-LINKAGE-DUPLICATE", "CORE-OBSERVE-FAILED", "CORE-OBSERVE-OFF", "CORE-RUNTIME-ERROR", "CORE-RUNTIME-ROOT-INVALID", "CORE-RUNTIME-
|
|
3
|
+
export declare const SOMA_CORE_DIAGNOSTIC_CODES: readonly ["CORE-PORT-MISSING", "CORE-PORT-CONFLICT", "CORE-PORT-LEGACY-PACK", "CORE-PORT-IDENTITY-DRIFT", "CORE-PORT-RECOMPILE", "CORE-PORT-PURPOSE", "CORE-STYLE-INVALID", "CORE-HOOK-UNCOMPILED", "CORE-SHELL-SLOT", "CORE-CONTRACT-SHAPE", "CORE-CONTRACT-DEFAULTS", "CORE-LINKAGE-DUPLICATE", "CORE-OBSERVE-FAILED", "CORE-OBSERVE-OFF", "CORE-RUNTIME-ERROR", "CORE-RUNTIME-ROOT-INVALID", "CORE-RUNTIME-ROOT-UNSET", "CORE-FORMAT-VERSION-UNSUPPORTED", "CORE-FORMAT-VERSION-MISMATCH", "CORE-INJECT-NONSTANDARD-KEY", "CORE-RUNTIME-ADDRESS-INVALID", "CORE-RUNTIME-ADDRESS-RESERVED", "CORE-RUNTIME-ADDRESS-STATIC", "CORE-RUNTIME-ADDRESS-CONFLICT", "CORE-RUNTIME-ADDRESS-OWNED", "CORE-RUNTIME-ADDRESS-MISMATCH", "CORE-RUNTIME-ADDRESS-MISSING", "CORE-RUNTIME-ADDRESS-EXPIRED", "CORE-RUNTIME-GENERATION", "CORE-RUNTIME-PROVENANCE", "CORE-RUNTIME-GRANT", "CORE-RUNTIME-GRANT-INVALID", "CORE-RUNTIME-BATCH", "CORE-RUNTIME-PARAM-INVALID", "CORE-RUNTIME-ACCESS-DENIED", "CORE-NAV-PARENT-MISSING", "CORE-NAV-OVERFLOW", "CORE-NAV-BACK-INVALID", "CORE-RUNTIME-DOMAIN-STATIC-ONLY", "CORE-RUNTIME-MOUNT", "CORE-ADAPTER-EMIT", "CORE-ADAPTER-DEFINE", "CORE-DATA-FORBIDDEN", "CORE-DATA-RELATION", "CORE-DATA-REQUIRE", "CORE-LOCALE-UNKNOWN", "CORE-ENGINE-LOAD", "CORE-ENGINE-ADAPTER", "CORE-STYLE-ENGINE-CANDIDATE", "CORE-STYLE-ENGINE-THEME", "CORE-STYLE-ENGINE-COMPILE", "CORE-BEHAVIOR-MACHINE-UNKNOWN", "CORE-BEHAVIOR-LAYER-DETACHED", "CORE-BEHAVIOR-MACHINE-CONFLICT", "CORE-TABLE-COLUMN", "CORE-TABLE-STATE", "CORE-VIRTUAL-SCROLLER", "CORE-CHART-KIND-UNKNOWN", "CORE-CHART-THEME", "CORE-CHART-OPTION", "CORE-TEMPORAL-PARSE", "CORE-TEMPORAL-NOT-READY", "CORE-TEMPORAL-ZONE", "CORE-DND-SPEC", "CORE-ALGO-DIFF-INPUT", "CORE-ALGO-QR-CAPACITY", "CORE-ASYNC-CHECK-TABLE", "CORE-ASYNC-CHECK-UNREGISTERED", "CORE-TOAST-CONFIG", "CORE-FORMAT-LOCALE", "CORE-FORMAT-TIMEZONE", "CORE-FORMAT-CONFIG", "CORE-BEHAVIOR-DECL", "CORE-A11Y-DECL", "CORE-OVERLAY-DECL", "CORE-KEYBOARD-DECL", "CORE-BEHAVIOR-COLLECTION-MISMATCH", "CORE-BEHAVIOR-MACHINE-MISMATCH", "CORE-KEYBOARD-MISSING", "CORE-KEYBOARD-GRID-COLUMNS", "CORE-KEYBOARD-INEFFECTIVE", "CORE-KEYBOARD-UNWIRED", "CORE-A11Y-CONFIG", "CORE-A11Y-OVERLAY-NO-DISMISS", "CORE-A11Y-ROLE-KEYBOARD-MISMATCH", "CORE-A11Y-ROLE-OVERLAY", "CORE-A11Y-ROLE-LANDMARK-CONFLICT", "CORE-A11Y-LANDMARK-NAME-SOURCE", "CORE-A11Y-LANDMARK-UNNAMED", "CORE-A11Y-LANDMARK-DUPLICATE-NAME", "CORE-LOCALE-PACK-SHAPE", "CORE-LOCALE-PACK-LOCALE", "CORE-LOCALE-PACK-POSITION", "CORE-LOCALE-PACK-VALUE", "CORE-SCOPES-CONFLICT", "CORE-FRAGMENTS-CONFLICT", "CORE-ANCHOR-DUPLICATE", "CORE-REG-INPUT-INVALID", "CORE-REG-NO-COMPILED-ARTIFACT", "CORE-CHECK-BLOCKS", "CORE-CHECK-DIALECT", "CORE-CHECK-DATA", "CORE-CHECK-EVENT", "CORE-CHECK-SCOPES", "CORE-CHECK-COMPILE", "CORE-CHECK-RUNTIME", "CORE-ENVELOPE-KEY", "CORE-ENVELOPE-VALUE", "CORE-ENVELOPE-PARAM", "CORE-ENVELOPE-PARAM-IMPLICIT", "CORE-ENVELOPE-QUERY", "CORE-ENVELOPE-NAV", "CORE-ENVELOPE-SOURCE", "CORE-ENVELOPE-LIFECYCLE", "CORE-ENVELOPE-AUTHOR", "CORE-ENVELOPE-COMPAT", "CORE-USER-REF-MISSING", "CORE-USER-REF-UNKNOWN", "CORE-AUTH-SCOPE", "CORE-WRITE-FEEDBACK-SCOPE", "CORE-WRITE-SHORTCUT-DECL", "CORE-WRITE-SHORTCUT-DUP", "ERR-RUN-001", "ERR-RUN-002", "ERR-RUN-003", "ERR-PUB-001", "ERR-PUB-002", "ERR-PUB-003"];
|
|
4
4
|
export type SomaCoreOwnDiagnosticCode = (typeof SOMA_CORE_DIAGNOSTIC_CODES)[number];
|
|
5
5
|
/** core 码全集:自有码 ∪ `CT-*` 组件树码(`CT-*` 闭集仍定义在 `component-tree-errors.ts`) */
|
|
6
6
|
export type SomaCoreDiagnosticCode = SomaCoreOwnDiagnosticCode | ComponentTreeErrorCode;
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* Registry 发布页的公开 URL 契约。
|
|
3
3
|
*
|
|
4
4
|
* 页面名就是根路径 slug:Registry `myworkspace` 对应 `/myworkspace`。
|
|
5
|
-
* `/pages/<name>` 仅保留为存量链接兼容入口,新发布结果不再生成该前缀。
|
|
6
5
|
*/
|
|
7
6
|
export declare const PUBLISHED_PAGE_SLUG_PATTERN: RegExp;
|
|
8
7
|
/** Next/SOMA 内部入口不能被 Registry 根路径页面占用;闭集唯一常量在 runtime-address.ts。 */
|
|
@@ -15,7 +14,6 @@ export declare function isPublishedPageSlug(value: unknown): value is string;
|
|
|
15
14
|
export declare function normalizePublishedPageSlug(value: unknown): string | null;
|
|
16
15
|
export declare function publishedPagePath(slug: string): string;
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
19
|
-
* 只接受单段路径,子路径仍交给 Host 文件页处理。
|
|
17
|
+
* 根路径是唯一入口。只接受单段路径,子路径仍交给 Host 文件页处理。
|
|
20
18
|
*/
|
|
21
19
|
export declare function publishedPageSlugFromPath(pagePath: string): string | null;
|
|
@@ -494,12 +494,6 @@ export declare const SOMA_PIPELINE_DIAGNOSTIC_REGISTRY: {
|
|
|
494
494
|
readonly stage: "core";
|
|
495
495
|
readonly severity: "error";
|
|
496
496
|
readonly owner: "soma-core/core/shared/core-diagnostic-codes.ts";
|
|
497
|
-
}, {
|
|
498
|
-
readonly code: "CORE-FORMAT-VERSION-IMPLICIT";
|
|
499
|
-
readonly family: "CORE";
|
|
500
|
-
readonly stage: "core";
|
|
501
|
-
readonly severity: "advice";
|
|
502
|
-
readonly owner: "soma-core/core/shared/core-diagnostic-codes.ts";
|
|
503
497
|
}, {
|
|
504
498
|
readonly code: "CORE-FORMAT-VERSION-MISMATCH";
|
|
505
499
|
readonly family: "CORE";
|
|
@@ -1016,12 +1010,6 @@ export declare const SOMA_PIPELINE_DIAGNOSTIC_REGISTRY: {
|
|
|
1016
1010
|
readonly stage: "core";
|
|
1017
1011
|
readonly severity: "error";
|
|
1018
1012
|
readonly owner: "soma-core/core/shared/core-diagnostic-codes.ts";
|
|
1019
|
-
}, {
|
|
1020
|
-
readonly code: "CORE-RUNTIME-LEGACY-DIR";
|
|
1021
|
-
readonly family: "CORE";
|
|
1022
|
-
readonly stage: "core";
|
|
1023
|
-
readonly severity: "warn";
|
|
1024
|
-
readonly owner: "soma-core/core/shared/core-diagnostic-codes.ts";
|
|
1025
1013
|
}, {
|
|
1026
1014
|
readonly code: "CORE-RUNTIME-MOUNT";
|
|
1027
1015
|
readonly family: "CORE";
|
|
@@ -82,19 +82,11 @@ export interface ComponentRef {
|
|
|
82
82
|
structureDigest: string;
|
|
83
83
|
uses: string[];
|
|
84
84
|
}
|
|
85
|
-
/**
|
|
86
|
-
* 目标信封格式标识(语义名,06e §3.2)。存量 `schemaVersion: 1` + `grammarVersion: 1` 视同本格式,迁移期双认到 M31;
|
|
87
|
-
* 新产出方写 `format`。
|
|
88
|
-
*/
|
|
85
|
+
/** 信封格式标识(语义名,06e §3.2);产物只写、只认 `format`。 */
|
|
89
86
|
export declare const SOMA_PAGE_ARTIFACT_FORMATS: readonly ["soma.page-artifact"];
|
|
90
87
|
export type SomaPageArtifactFormat = (typeof SOMA_PAGE_ARTIFACT_FORMATS)[number];
|
|
91
88
|
export interface TreeArtifact {
|
|
92
|
-
|
|
93
|
-
format?: SomaPageArtifactFormat;
|
|
94
|
-
/** 存量名,只作引用,M31 后不再读 */
|
|
95
|
-
schemaVersion?: 1;
|
|
96
|
-
/** 存量名,只作引用,M31 后不再读 */
|
|
97
|
-
grammarVersion?: 1;
|
|
89
|
+
format: SomaPageArtifactFormat;
|
|
98
90
|
compilerVersion: string;
|
|
99
91
|
sourceDigest: string;
|
|
100
92
|
registrySnapshotDigest: string;
|
|
@@ -118,12 +110,7 @@ export interface ComponentTreeRuntimeEnvelope {
|
|
|
118
110
|
*/
|
|
119
111
|
export interface SomaArtifactEnvelopeHead {
|
|
120
112
|
readonly sourceMarkup: SomaPageMarkup;
|
|
121
|
-
/** 目标字段 */
|
|
122
113
|
readonly format?: SomaPageArtifactFormat;
|
|
123
|
-
/** 存量名,只作引用 */
|
|
124
|
-
readonly schemaVersion?: 1;
|
|
125
|
-
/** 存量名,只作引用 */
|
|
126
|
-
readonly grammarVersion?: 1;
|
|
127
114
|
/** 须 ⊆ COMPONENT_TREE_CAPABILITIES 且含 'component-tree:1' */
|
|
128
115
|
readonly capabilities: readonly string[];
|
|
129
116
|
/** { name, packName?, packVersion?, contractDigest, structureDigest, uses } */
|
|
@@ -76,7 +76,7 @@ export interface SomaHostAssembly {
|
|
|
76
76
|
readonly reservedRoutes?: readonly string[];
|
|
77
77
|
/**
|
|
78
78
|
* 登录页(R-24):访问门 401 的响应附 `login.path`,页面客户端跳 `<path>?next=<当前地址>`。
|
|
79
|
-
*
|
|
79
|
+
* 只收站内相对路径;缺省 `/login`。
|
|
80
80
|
*/
|
|
81
81
|
readonly login?: {
|
|
82
82
|
readonly path?: string;
|
|
@@ -92,4 +92,30 @@ export interface SomaHostAssembly {
|
|
|
92
92
|
* 返回前必须已全部落盘;抛错即构建失败。core 不关心页面由谁产生(AD-34)。
|
|
93
93
|
*/
|
|
94
94
|
prewarm?(): void | Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* 服务启动钩子:服务进程启动时执行一次的异步初始化(连接池、配置预检、缓存预热……)。
|
|
97
|
+
* 调用方是宿主壳的 `instrumentation.ts`(Next `register`):仅在 Node 运行时、`soma dev` / `soma start` 的服务进程启动时
|
|
98
|
+
* 加载装配(含服务端面 `server()`)后 await 一次;`soma build` 不调用(build 只调 `prewarm`)。
|
|
99
|
+
* 抛错 = 拒绝启动(`register` 抛错,进程不进入服务状态);同一应用根进程内只执行一次(并发共享同一 Promise)。
|
|
100
|
+
*/
|
|
101
|
+
startup?(): void | Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* 响应头出口:给宿主壳产出的响应统一加头。`proxy.ts` 对每个请求(页面、`/api/*`、静态资源)调用,
|
|
104
|
+
* 页面数据与接口路由再对最终响应调用一次(路由自设的同名头由本出口的值覆盖)。
|
|
105
|
+
* 返回 `undefined` 或空对象 = 不加头;同名头以本出口为准;头名或值非法时当场抛错(该请求 500)。
|
|
106
|
+
* 可同步也可异步(服务端实现可经 `import('./soma.server')` 惰性取);每个请求都会调用,须快速、无副作用。
|
|
107
|
+
*/
|
|
108
|
+
responseHeaders?(context: SomaHostResponseHeadersContext): Readonly<Record<string, string>> | undefined | Promise<Readonly<Record<string, string>> | undefined>;
|
|
109
|
+
}
|
|
110
|
+
/** 响应头出口的调用上下文 */
|
|
111
|
+
export interface SomaHostResponseHeadersContext {
|
|
112
|
+
/** 请求路径(不含查询串) */
|
|
113
|
+
readonly pathname: string;
|
|
114
|
+
/** 请求方法(大写) */
|
|
115
|
+
readonly method: string;
|
|
116
|
+
/**
|
|
117
|
+
* 请求类型:`api`(`/api/*`)、`asset`(`/_next/*`、`/soma-runtime/*`、`/favicon.ico` 与带文件扩展名的路径,含 Host `public/`)、
|
|
118
|
+
* `page`(其余,含 `/soma/*` 页面数据端点)
|
|
119
|
+
*/
|
|
120
|
+
readonly kind: 'page' | 'api' | 'asset';
|
|
95
121
|
}
|