@world-engines/project-host 0.1.0-alpha.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/LICENSE +46 -0
- package/assets/gui/WELogo-title.svg +11 -0
- package/assets/gui/app.js +1326 -0
- package/assets/gui/index.html +118 -0
- package/assets/gui/local-preview-asset-urls.js +61 -0
- package/assets/gui/local-preview-bridge.js +393 -0
- package/assets/gui/spatial-template-panel.js +233 -0
- package/assets/gui/styles.css +115 -0
- package/assets/gui/terrain-render.js +120 -0
- package/assets/gui/workspace-status.css +17 -0
- package/assets/gui/workspace-status.js +255 -0
- package/assets/gui/world-map-globe.js +187 -0
- package/assets/gui/world-map-worker.js +62 -0
- package/assets/gui/world-map.css +30 -0
- package/assets/gui/world-map.js +2466 -0
- package/dist/account-model-proxy.d.ts +21 -0
- package/dist/account-model-proxy.js +470 -0
- package/dist/authoring-browser-runtime.d.ts +7 -0
- package/dist/authoring-browser-runtime.js +110 -0
- package/dist/authoring-ingestion.d.ts +38 -0
- package/dist/authoring-ingestion.js +410 -0
- package/dist/authoring-model-connection.d.ts +166 -0
- package/dist/authoring-model-connection.js +757 -0
- package/dist/chinese-lexical.d.ts +152 -0
- package/dist/chinese-lexical.js +555 -0
- package/dist/chromium-preview-browser-driver.d.ts +43 -0
- package/dist/chromium-preview-browser-driver.js +575 -0
- package/dist/cli/download.d.ts +12 -0
- package/dist/cli/download.js +50 -0
- package/dist/cli/dump.d.ts +32 -0
- package/dist/cli/dump.js +91 -0
- package/dist/cli/ingest.d.ts +49 -0
- package/dist/cli/ingest.js +225 -0
- package/dist/cli/review.d.ts +10 -0
- package/dist/cli/review.js +44 -0
- package/dist/cli/upload.d.ts +57 -0
- package/dist/cli/upload.js +112 -0
- package/dist/cli-command.d.ts +60 -0
- package/dist/cli-command.js +613 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +182 -0
- package/dist/desktop-authoring-runtime.d.ts +88 -0
- package/dist/desktop-authoring-runtime.js +1602 -0
- package/dist/desktop-sidecar.d.ts +11 -0
- package/dist/desktop-sidecar.js +143 -0
- package/dist/document-dump.d.ts +113 -0
- package/dist/document-dump.js +431 -0
- package/dist/document-graph-extractor.d.ts +125 -0
- package/dist/document-graph-extractor.js +588 -0
- package/dist/document-ingestion-journal.d.ts +68 -0
- package/dist/document-ingestion-journal.js +471 -0
- package/dist/document-ingestion.d.ts +183 -0
- package/dist/document-ingestion.js +976 -0
- package/dist/document-query-path-proof.d.ts +30 -0
- package/dist/document-query-path-proof.js +34 -0
- package/dist/document-query-path-renderer.d.ts +50 -0
- package/dist/document-query-path-renderer.js +75 -0
- package/dist/document-query-proof-paths.d.ts +22 -0
- package/dist/document-query-proof-paths.js +71 -0
- package/dist/document-query.d.ts +97 -0
- package/dist/document-query.js +1106 -0
- package/dist/document-relation-role.d.ts +14 -0
- package/dist/document-relation-role.js +86 -0
- package/dist/document-source.d.ts +107 -0
- package/dist/document-source.js +255 -0
- package/dist/embedding-cache.d.ts +35 -0
- package/dist/embedding-cache.js +317 -0
- package/dist/frozen-review-local-pipeline.d.ts +88 -0
- package/dist/frozen-review-local-pipeline.js +609 -0
- package/dist/frozen-review-source-capture.d.ts +15 -0
- package/dist/frozen-review-source-capture.js +551 -0
- package/dist/frozen-review-wasm-encryptor.d.ts +16 -0
- package/dist/frozen-review-wasm-encryptor.js +72 -0
- package/dist/frozen-review.d.ts +131 -0
- package/dist/frozen-review.js +802 -0
- package/dist/graph-traversal.d.ts +23 -0
- package/dist/graph-traversal.js +100 -0
- package/dist/gui/graph-layout-worker.js +1 -0
- package/dist/gui/graph-layout.wasm +0 -0
- package/dist/gui/graph.css +1 -0
- package/dist/gui/graph.js +76 -0
- package/dist/gui/plane-generation.js +112 -0
- package/dist/gui/plane-generator.js +310 -0
- package/dist/gui/plane-generator_bg.wasm +0 -0
- package/dist/gui/procedural-city.js +595 -0
- package/dist/gui/road-generation.js +129 -0
- package/dist/gui/road-parcels.js +1584 -0
- package/dist/gui/score.css +1 -0
- package/dist/gui/score.js +54 -0
- package/dist/gui/spatial-runtime.js +1231 -0
- package/dist/gui/spatial-templates.js +200 -0
- package/dist/gui/trigger.css +1 -0
- package/dist/gui/trigger.js +142 -0
- package/dist/harness-callback-transport.d.ts +17 -0
- package/dist/harness-callback-transport.js +128 -0
- package/dist/harness-document-ingestion.d.ts +77 -0
- package/dist/harness-document-ingestion.js +343 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.js +43 -0
- package/dist/ingestion-source-reconciliation.d.ts +88 -0
- package/dist/ingestion-source-reconciliation.js +253 -0
- package/dist/ladybug-runtime.d.ts +117 -0
- package/dist/ladybug-runtime.js +886 -0
- package/dist/local-account-embedding.d.ts +34 -0
- package/dist/local-account-embedding.js +294 -0
- package/dist/local-gallery.d.ts +35 -0
- package/dist/local-gallery.js +227 -0
- package/dist/local-gui-auth.d.ts +96 -0
- package/dist/local-gui-auth.js +703 -0
- package/dist/local-gui-contract.d.ts +53 -0
- package/dist/local-gui-contract.js +5 -0
- package/dist/local-gui-image-assets.d.ts +17 -0
- package/dist/local-gui-image-assets.js +96 -0
- package/dist/local-gui-preview-client.d.ts +3 -0
- package/dist/local-gui-preview-client.js +111 -0
- package/dist/local-gui-score.d.ts +72 -0
- package/dist/local-gui-score.js +184 -0
- package/dist/local-gui-server.d.ts +10 -0
- package/dist/local-gui-server.js +987 -0
- package/dist/local-gui-version.d.ts +17 -0
- package/dist/local-gui-version.js +147 -0
- package/dist/local-gui-workspace.d.ts +14 -0
- package/dist/local-gui-workspace.js +171 -0
- package/dist/local-model-settings.d.ts +28 -0
- package/dist/local-model-settings.js +124 -0
- package/dist/local-preview-assets.d.ts +28 -0
- package/dist/local-preview-assets.js +124 -0
- package/dist/local-preview-bound-resources.d.ts +12 -0
- package/dist/local-preview-bound-resources.js +80 -0
- package/dist/local-preview-message-store.d.ts +63 -0
- package/dist/local-preview-message-store.js +214 -0
- package/dist/local-preview-player-read-models.d.ts +47 -0
- package/dist/local-preview-player-read-models.js +90 -0
- package/dist/local-preview-projections.d.ts +61 -0
- package/dist/local-preview-projections.js +117 -0
- package/dist/local-preview-runtime.d.ts +105 -0
- package/dist/local-preview-runtime.js +553 -0
- package/dist/local-preview-session.d.ts +73 -0
- package/dist/local-preview-session.js +395 -0
- package/dist/local-preview-source.d.ts +40 -0
- package/dist/local-preview-source.js +192 -0
- package/dist/local-preview-view-events.d.ts +101 -0
- package/dist/local-preview-view-events.js +179 -0
- package/dist/local-preview-view-state-sqlite.d.ts +24 -0
- package/dist/local-preview-view-state-sqlite.js +263 -0
- package/dist/local-preview-view-state.d.ts +93 -0
- package/dist/local-preview-view-state.js +108 -0
- package/dist/local-preview-vite-config.d.ts +6 -0
- package/dist/local-preview-vite-config.js +122 -0
- package/dist/local-preview-world-effects.d.ts +9 -0
- package/dist/local-preview-world-effects.js +55 -0
- package/dist/local-preview-worldline-store.d.ts +47 -0
- package/dist/local-preview-worldline-store.js +282 -0
- package/dist/local-preview-worldlines.d.ts +95 -0
- package/dist/local-preview-worldlines.js +136 -0
- package/dist/mcp-async-dispatcher.d.ts +3 -0
- package/dist/mcp-async-dispatcher.js +129 -0
- package/dist/mcp-line-queue.d.ts +14 -0
- package/dist/mcp-line-queue.js +184 -0
- package/dist/mcp-pipe-internal.d.ts +6 -0
- package/dist/mcp-pipe-internal.js +151 -0
- package/dist/mcp-pipe-response.d.ts +14 -0
- package/dist/mcp-pipe-response.js +50 -0
- package/dist/mcp-stdio-response.d.ts +12 -0
- package/dist/mcp-stdio-response.js +27 -0
- package/dist/mcp.d.ts +27 -0
- package/dist/mcp.js +194 -0
- package/dist/prepared-embedding-cache.d.ts +38 -0
- package/dist/prepared-embedding-cache.js +238 -0
- package/dist/preview-browser-adapter.d.ts +53 -0
- package/dist/preview-browser-adapter.js +171 -0
- package/dist/preview-runtime.d.ts +67 -0
- package/dist/preview-runtime.js +460 -0
- package/dist/project-auth-transport.d.ts +27 -0
- package/dist/project-auth-transport.js +121 -0
- package/dist/project-auth.d.ts +51 -0
- package/dist/project-auth.js +108 -0
- package/dist/project-git-capture-recovery.d.ts +16 -0
- package/dist/project-git-capture-recovery.js +347 -0
- package/dist/project-git-cli.d.ts +5 -0
- package/dist/project-git-cli.js +40 -0
- package/dist/project-git-scenario-source.d.ts +10 -0
- package/dist/project-git-scenario-source.js +240 -0
- package/dist/project-git-view-source.d.ts +13 -0
- package/dist/project-git-view-source.js +134 -0
- package/dist/project-git.d.ts +97 -0
- package/dist/project-git.js +656 -0
- package/dist/project-host.d.ts +59 -0
- package/dist/project-host.js +471 -0
- package/dist/project-writer-lease.d.ts +18 -0
- package/dist/project-writer-lease.js +430 -0
- package/dist/public-error.d.ts +7 -0
- package/dist/public-error.js +61 -0
- package/dist/retrieval-benchmark.d.ts +46 -0
- package/dist/retrieval-benchmark.js +58 -0
- package/dist/safe-project-path.d.ts +8 -0
- package/dist/safe-project-path.js +93 -0
- package/dist/scenario-writer.d.ts +32 -0
- package/dist/scenario-writer.js +191 -0
- package/dist/transfer/download.d.ts +159 -0
- package/dist/transfer/download.js +598 -0
- package/dist/transfer/transport.d.ts +26 -0
- package/dist/transfer/transport.js +1 -0
- package/dist/transfer/upload.d.ts +162 -0
- package/dist/transfer/upload.js +354 -0
- package/dist/transfer-types.d.ts +95 -0
- package/dist/transfer-types.js +1 -0
- package/dist/transfer.d.ts +18 -0
- package/dist/transfer.js +273 -0
- package/dist/trigger-runtime.d.ts +121 -0
- package/dist/trigger-runtime.js +153 -0
- package/dist/vendor/wasm-core/asset-hashes.json +5 -0
- package/dist/vendor/wasm-core/wasm_core.d.ts +490 -0
- package/dist/vendor/wasm-core/wasm_core.js +1 -0
- package/dist/vendor/wasm-core/wasm_core_bg.wasm +0 -0
- package/dist/view-watcher.d.ts +9 -0
- package/dist/view-watcher.js +34 -0
- package/package.json +110 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { AuthoringBridgeError } from "@world-engines/authoring-bridge";
|
|
2
|
+
import { LOCAL_PREVIEW_CUSTOM_STATE_MAX_BYTES } from "./local-preview-view-state.js";
|
|
3
|
+
const ID = /^[A-Za-z0-9._:-]{1,128}$/u;
|
|
4
|
+
function fail(code, message) { throw new AuthoringBridgeError(code, message); }
|
|
5
|
+
function record(value) { if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
6
|
+
fail("EINVAL", "参数无效"); return value; }
|
|
7
|
+
function exact(value, allowed) { const result = record(value); if (Object.keys(result).some((key) => !allowed.includes(key)))
|
|
8
|
+
fail("EINVAL", "参数包含未知字段"); return result; }
|
|
9
|
+
function empty(value) { exact(value, []); }
|
|
10
|
+
function id(value, field) { if (typeof value !== "string" || !ID.test(value))
|
|
11
|
+
fail("EINVAL", `${field} 无效`); return value; }
|
|
12
|
+
function clone(value) { return value === undefined ? undefined : JSON.parse(JSON.stringify(value)); }
|
|
13
|
+
function capabilityMissing(name) { return fail("E_CAPABILITY_UNAVAILABLE", `本地 Preview 尚无 ${name} 的真实只读来源`); }
|
|
14
|
+
/** 从 LocalPreviewRuntime.readProjectionSnapshot 的窄 Host snapshot 读取已有真值。 */
|
|
15
|
+
export function localPreviewCoreFromRuntimeSnapshot(value) {
|
|
16
|
+
const root = record(value);
|
|
17
|
+
const identity = record(root.capture_identity);
|
|
18
|
+
const gameplay = record(root.gameplay);
|
|
19
|
+
const source = record(root.source_projection);
|
|
20
|
+
if (root.kind !== "worldengine.local-preview-projection/v1" || root.development_preview !== true)
|
|
21
|
+
fail("E_OPERATION_UNCERTAIN", "local Preview runtime projection identity 无效");
|
|
22
|
+
const scriptId = id(identity.project_id, "capture_identity.project_id");
|
|
23
|
+
const scenarioId = id(identity.local_scenario_id, "capture_identity.local_scenario_id");
|
|
24
|
+
const metadataRoot = record(source.metadata);
|
|
25
|
+
const metadata = metadataRoot.metadata === null || metadataRoot.metadata === undefined ? undefined : record(metadataRoot.metadata);
|
|
26
|
+
if (metadata !== undefined && metadata.title !== undefined && typeof metadata.title !== "string")
|
|
27
|
+
fail("E_OPERATION_UNCERTAIN", "local Preview metadata title 无效");
|
|
28
|
+
const title = metadata === undefined || metadata.title === undefined ? "" : metadata.title;
|
|
29
|
+
if (!Array.isArray(gameplay.save_variables) || !record(gameplay.unlocks))
|
|
30
|
+
fail("E_OPERATION_UNCERTAIN", "local Preview gameplay projection 无效");
|
|
31
|
+
const saveVariables = gameplay.save_variables.map((candidate) => { const item = record(candidate); const name = id(item.name, "save variable name"); if (item.scope !== "save" || typeof item.valueType !== "string")
|
|
32
|
+
fail("E_OPERATION_UNCERTAIN", "local Preview save variable 无效"); return Object.freeze({ name, scope: "save", valueType: item.valueType, value: clone(item.value) }); });
|
|
33
|
+
const unlocks = Object.fromEntries(Object.entries(record(gameplay.unlocks)).map(([key, unlocked]) => { if (!/^(node|edge):.+$/u.test(key) || typeof unlocked !== "boolean")
|
|
34
|
+
fail("E_OPERATION_UNCERTAIN", "local Preview unlock projection 无效"); return [key, unlocked]; }));
|
|
35
|
+
return Object.freeze({ scriptId, scenarioId, title, saveVariables: Object.freeze(saveVariables), unlocks: Object.freeze(unlocks) });
|
|
36
|
+
}
|
|
37
|
+
/** SDK 只读 dispatcher。扩展读取面各自接入,缺真值不会阻断已可用的 SAV 读取。 */
|
|
38
|
+
export class LocalPreviewReadOnlyProjection {
|
|
39
|
+
#core;
|
|
40
|
+
#readers;
|
|
41
|
+
constructor(core, readers = {}) {
|
|
42
|
+
if (!ID.test(core.scriptId) || !ID.test(core.scenarioId))
|
|
43
|
+
fail("E_OPERATION_UNCERTAIN", "local Preview core identity 无效");
|
|
44
|
+
if (new Set(core.saveVariables.map((item) => item.name)).size !== core.saveVariables.length || Object.values(core.unlocks).some((entry) => typeof entry !== "boolean"))
|
|
45
|
+
fail("E_OPERATION_UNCERTAIN", "local Preview core gameplay 无效");
|
|
46
|
+
this.#core = core;
|
|
47
|
+
this.#readers = readers;
|
|
48
|
+
}
|
|
49
|
+
capabilities() { return Object.freeze({ customStateMaxBytes: this.#readers.customState === undefined ? 0 : LOCAL_PREVIEW_CUSTOM_STATE_MAX_BYTES, assetMaxBytes: 0, supportsAssets: this.#readers.assets !== undefined, supportsEdit: false, supportsDelete: false }); }
|
|
50
|
+
async handle(method, params) {
|
|
51
|
+
if (method === "scenario.getMeta") {
|
|
52
|
+
empty(params);
|
|
53
|
+
return Object.freeze({ scriptId: this.#core.scriptId, title: this.#core.title, schemaVersion: 3 });
|
|
54
|
+
}
|
|
55
|
+
if (method === "scenario.getVariable") {
|
|
56
|
+
const p = exact(params, ["name", "scope"]);
|
|
57
|
+
const name = id(p.name, "name");
|
|
58
|
+
if (p.scope !== "save")
|
|
59
|
+
fail("EINVAL", "scope 必须是 save");
|
|
60
|
+
const variable = this.#core.saveVariables.find((item) => item.name === name);
|
|
61
|
+
if (variable === undefined)
|
|
62
|
+
fail("ENOTFOUND", "变量不存在");
|
|
63
|
+
return Object.freeze({ ...variable, value: clone(variable.value) });
|
|
64
|
+
}
|
|
65
|
+
if (method === "scenario.getUnlock") {
|
|
66
|
+
const p = exact(params, ["target", "id"]);
|
|
67
|
+
if (p.target !== "node" && p.target !== "edge")
|
|
68
|
+
fail("EINVAL", "target 无效");
|
|
69
|
+
const targetId = id(p.id, "id");
|
|
70
|
+
return Object.freeze({ unlocked: this.#core.unlocks[`${p.target}:${targetId}`] ?? true });
|
|
71
|
+
}
|
|
72
|
+
if (method === "scenario.getProgress") {
|
|
73
|
+
empty(params);
|
|
74
|
+
if (this.#readers.progress === undefined)
|
|
75
|
+
capabilityMissing("SAV progress");
|
|
76
|
+
const progress = await this.#readers.progress();
|
|
77
|
+
if (!Number.isFinite(progress) || progress < 0 || progress > 1)
|
|
78
|
+
fail("E_OPERATION_UNCERTAIN", "local Preview SAV progress 无效");
|
|
79
|
+
return progress;
|
|
80
|
+
}
|
|
81
|
+
if (method === "scenario.getOwnedResources") {
|
|
82
|
+
empty(params);
|
|
83
|
+
if (this.#readers.ownedResources === undefined)
|
|
84
|
+
capabilityMissing("owned resources");
|
|
85
|
+
return (await this.#readers.ownedResources()).map((group) => Object.freeze({ ...group, resources: group.resources.map((resource) => Object.freeze({ ...resource })) }));
|
|
86
|
+
}
|
|
87
|
+
if (method === "state.get" || method === "state.getEntry" || method === "state.keys") {
|
|
88
|
+
const entries = await this.#state();
|
|
89
|
+
if (method === "state.keys") {
|
|
90
|
+
empty(params);
|
|
91
|
+
return entries.map((entry) => entry.key).sort();
|
|
92
|
+
}
|
|
93
|
+
const key = id(exact(params, ["key"]).key, "key");
|
|
94
|
+
const entry = entries.find((candidate) => candidate.key === key);
|
|
95
|
+
return method === "state.get" ? clone(entry?.value) : entry === undefined ? undefined : Object.freeze({ ...entry, value: clone(entry.value), authorizedUserIds: [...entry.authorizedUserIds] });
|
|
96
|
+
}
|
|
97
|
+
if (method === "asset.list" || method === "asset.getUrl") {
|
|
98
|
+
if (this.#readers.assets === undefined)
|
|
99
|
+
capabilityMissing("capture assets");
|
|
100
|
+
if (method === "asset.list") {
|
|
101
|
+
empty(params);
|
|
102
|
+
return await Promise.all((await this.#readers.assets.list()).map(async (asset) => this.#assetRecord(asset)));
|
|
103
|
+
}
|
|
104
|
+
const assetId = id(exact(params, ["id"]).id, "id");
|
|
105
|
+
const asset = (await this.#readers.assets.list()).find((candidate) => candidate.id === assetId);
|
|
106
|
+
if (asset === undefined)
|
|
107
|
+
fail("ENOTFOUND", "capture asset 不存在");
|
|
108
|
+
return await this.#readers.assets.getUrl(asset);
|
|
109
|
+
}
|
|
110
|
+
fail("EPERM", "本地 Preview 未授予该 ChatPlay SDK 能力");
|
|
111
|
+
}
|
|
112
|
+
async #state() { if (this.#readers.customState === undefined)
|
|
113
|
+
capabilityMissing("view custom state"); const entries = await this.#readers.customState(); if (new Set(entries.map((entry) => entry.key)).size !== entries.length)
|
|
114
|
+
fail("E_OPERATION_UNCERTAIN", "custom state key 重复"); return entries; }
|
|
115
|
+
async #assetRecord(asset) { if (!ID.test(asset.id) || asset.source !== "capture" || !Number.isSafeInteger(asset.size) || asset.size < 0 || !Number.isSafeInteger(asset.createdTs) || asset.createdTs < 0 || !/^[a-f0-9]{64}$/u.test(asset.sha256))
|
|
116
|
+
fail("E_OPERATION_UNCERTAIN", "capture asset 无效"); return Object.freeze({ id: asset.id, scriptId: this.#core.scriptId, filename: asset.filename, mime: asset.mime, size: asset.size, createdTs: asset.createdTs, url: await this.#readers.assets.getUrl(asset), sha256: asset.sha256 }); }
|
|
117
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { type TmwSceneStateV1, type TmwPendingSceneClockCrossingV1 } from "@world-engines/tmw";
|
|
2
|
+
import { type LocalPreviewSourceCapture } from "./local-preview-source.js";
|
|
3
|
+
import type { LocalPreviewWorldlineRuntime } from "./local-preview-worldlines.js";
|
|
4
|
+
import { LocalPreviewViewStateSqlitePort } from "./local-preview-view-state-sqlite.js";
|
|
5
|
+
import { LocalPreviewPlayerReadModels } from "./local-preview-player-read-models.js";
|
|
6
|
+
export interface LocalPreviewRuntimeInspection {
|
|
7
|
+
readonly development_preview: true;
|
|
8
|
+
readonly capture_sha256: string;
|
|
9
|
+
readonly project_id: string;
|
|
10
|
+
readonly scenario_id: string;
|
|
11
|
+
readonly compiler_receipt_sha256: string;
|
|
12
|
+
readonly compiled_plan_sha256: string;
|
|
13
|
+
readonly save_path: string;
|
|
14
|
+
readonly event_execution: "local_deterministic";
|
|
15
|
+
}
|
|
16
|
+
export interface LocalPreviewEventInput {
|
|
17
|
+
readonly event_type: string;
|
|
18
|
+
readonly payload: Readonly<Record<string, unknown>>;
|
|
19
|
+
readonly operation_id: string;
|
|
20
|
+
readonly turn_id: string;
|
|
21
|
+
readonly world_time?: number | null;
|
|
22
|
+
}
|
|
23
|
+
export interface LocalPreviewEventReceipt {
|
|
24
|
+
readonly status: "committed" | "already_committed";
|
|
25
|
+
readonly operation_id: string;
|
|
26
|
+
/** 仅 committed 首次返回;幂等重放为空,避免 View 重复广播。 */
|
|
27
|
+
readonly author_view_events: ReadonlyArray<Readonly<{
|
|
28
|
+
eventId: string;
|
|
29
|
+
eventType: string;
|
|
30
|
+
viewVisiblePayload: Readonly<Record<string, null | boolean | number | string>>;
|
|
31
|
+
}>>;
|
|
32
|
+
}
|
|
33
|
+
export interface LocalPreviewWriterPreparation {
|
|
34
|
+
readonly identity: string;
|
|
35
|
+
readonly operation_id: string;
|
|
36
|
+
readonly turn_id: string;
|
|
37
|
+
readonly capture_sha256: string;
|
|
38
|
+
readonly timeline_revision: string;
|
|
39
|
+
readonly ledger_head: string;
|
|
40
|
+
readonly worldline_id: string;
|
|
41
|
+
readonly world_time: number | null;
|
|
42
|
+
readonly scene: TmwSceneStateV1 | null;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 本地开发预览的单实例 Runtime seam。
|
|
46
|
+
* 它只消费 immutable capture,SAV 也只写入 capture-hash 隔离目录;不是正式 Player 保存、head、lease 或发布 authority。
|
|
47
|
+
*/
|
|
48
|
+
export declare class LocalPreviewRuntime {
|
|
49
|
+
#private;
|
|
50
|
+
private constructor();
|
|
51
|
+
static open(input: Readonly<{
|
|
52
|
+
project_root: string;
|
|
53
|
+
capture?: LocalPreviewSourceCapture;
|
|
54
|
+
}>): Promise<LocalPreviewRuntime>;
|
|
55
|
+
inspect(): LocalPreviewRuntimeInspection;
|
|
56
|
+
readScene(): TmwSceneStateV1 | null;
|
|
57
|
+
readVariable(name: string, scope: "save" | "execution"): import("@world-engines/tmw").TmwVariableV1;
|
|
58
|
+
readUnlock(kind: "node" | "edge", id: string): boolean;
|
|
59
|
+
readViewInteractionBinding(): Readonly<Record<string, unknown>>;
|
|
60
|
+
openViewState(viewId: string): Promise<LocalPreviewViewStateSqlitePort>;
|
|
61
|
+
appendAcceptedUserMessage(input: Readonly<{
|
|
62
|
+
operation_id: string;
|
|
63
|
+
turn_id: string;
|
|
64
|
+
message_id: string;
|
|
65
|
+
text: string;
|
|
66
|
+
}>): Promise<Readonly<{
|
|
67
|
+
message: import("./local-preview-message-store.js").LocalPreviewCommittedMessage;
|
|
68
|
+
replayed: boolean;
|
|
69
|
+
}>>;
|
|
70
|
+
readCommittedMessages(): Promise<readonly import("./local-preview-message-store.js").LocalPreviewCommittedMessage[]>;
|
|
71
|
+
/** 仅恢复指定 operation 仍在当前 SAV 中、且可由 source ledger 精确验证的 View 事件;不扫描历史。 */
|
|
72
|
+
readAuthorViewEventsByOperation(operationIdInput: string): LocalPreviewEventReceipt["author_view_events"];
|
|
73
|
+
playerReadModels(): LocalPreviewPlayerReadModels;
|
|
74
|
+
/** Host-only facade; it reuses activation.sqlite and never exposes DatabaseSync to iframe code. */
|
|
75
|
+
worldlineRuntime(): LocalPreviewWorldlineRuntime;
|
|
76
|
+
prepareWriterTurn(input: Readonly<{
|
|
77
|
+
operation_id: string;
|
|
78
|
+
turn_id: string;
|
|
79
|
+
}>): Promise<LocalPreviewWriterPreparation>;
|
|
80
|
+
commitSuccessfulWriterResult(input: Readonly<{
|
|
81
|
+
prepare_identity: string;
|
|
82
|
+
text: string;
|
|
83
|
+
message_id: string;
|
|
84
|
+
ordered_message_ids: readonly string[];
|
|
85
|
+
writer_receipt_digest: string;
|
|
86
|
+
pending_clock_crossings?: readonly TmwPendingSceneClockCrossingV1[];
|
|
87
|
+
}>): Promise<Readonly<{
|
|
88
|
+
status: "committed" | "already_committed";
|
|
89
|
+
message_id: string;
|
|
90
|
+
}>>;
|
|
91
|
+
readCommittedWriterMessage(messageId: string): Readonly<{
|
|
92
|
+
message_id: string;
|
|
93
|
+
text: string;
|
|
94
|
+
}> | null;
|
|
95
|
+
/** Host-only typed input for a separate allowlisted View projector; never expose this object directly through iframe RPC. */
|
|
96
|
+
readProjectionSnapshot(): Readonly<Record<string, unknown>>;
|
|
97
|
+
dispose(): void;
|
|
98
|
+
/** 本地开发 Runtime:无远端 lease/head;同一 operation_id 读取已持久 receipt,不重复执行。 */
|
|
99
|
+
executeEvent(input: LocalPreviewEventInput): Promise<LocalPreviewEventReceipt>;
|
|
100
|
+
/** Host-only:仅消费当前 SAV 已到期的 pending crossing;不创建或推进新的时钟事件。 */
|
|
101
|
+
drainPendingSceneCrossings(input: Readonly<{
|
|
102
|
+
turn_id: string;
|
|
103
|
+
max_events?: number;
|
|
104
|
+
}>): Promise<readonly LocalPreviewEventReceipt[]>;
|
|
105
|
+
}
|