@volter/live 0.5.210 → 0.5.212
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/BUNDLED_NOTICES +13 -13
- package/README.md +7 -11
- package/dist/chunk-7SZ3C4CC.js +768 -0
- package/dist/chunk-7SZ3C4CC.js.map +7 -0
- package/dist/chunk-7WKVJGHZ.js +15 -0
- package/dist/chunk-7WKVJGHZ.js.map +7 -0
- package/dist/chunk-SDIWRX5X.js +189 -0
- package/dist/chunk-SDIWRX5X.js.map +7 -0
- package/dist/chunk-USXOIBVX.js +81 -0
- package/dist/chunk-USXOIBVX.js.map +7 -0
- package/dist/chunk-Y5W77HYT.js +123 -0
- package/dist/chunk-Y5W77HYT.js.map +7 -0
- package/dist/chunk-YPAOTPIF.js +202 -0
- package/dist/chunk-YPAOTPIF.js.map +7 -0
- package/dist/client.d.ts +370 -0
- package/dist/client.js +9 -0
- package/dist/client.js.map +7 -0
- package/dist/discovery.d.ts +32 -0
- package/dist/discovery.js +19 -0
- package/dist/discovery.js.map +7 -0
- package/dist/editor-document.d.ts +12 -47
- package/dist/editor.d.ts +34 -181
- package/dist/http-transport.d.ts +6 -0
- package/dist/index.d.ts +1 -5
- package/dist/index.js +76 -1722
- package/dist/index.js.map +4 -4
- package/dist/installed-package.d.ts +6 -0
- package/dist/installed-package.js +7 -0
- package/dist/installed-package.js.map +7 -0
- package/dist/lazy-proxy.d.ts +11 -11
- package/dist/member-hints.d.ts +6 -9
- package/dist/product-create.d.ts +29 -0
- package/dist/product-create.js +13 -0
- package/dist/product-create.js.map +7 -0
- package/dist/product-locator.d.ts +100 -0
- package/dist/product-locator.js +25 -0
- package/dist/product-locator.js.map +7 -0
- package/dist/registry-format.d.ts +44 -0
- package/dist/registry-format.js +21 -0
- package/dist/registry-format.js.map +7 -0
- package/dist/session.d.ts +10 -3
- package/dist/singleton.d.ts +1 -13
- package/dist/volter-manifest.d.ts +55 -0
- package/dist/volter-manifest.js +9 -0
- package/dist/volter-manifest.js.map +7 -0
- package/dist/workbench-locator.d.ts +84 -0
- package/dist/workbench-locator.js +416 -0
- package/dist/workbench-locator.js.map +7 -0
- package/package.json +35 -3
- package/src/client.ts +1052 -0
- package/src/discovery.ts +105 -0
- package/src/editor-document.ts +12 -49
- package/src/editor.ts +45 -212
- package/src/http-transport.ts +19 -0
- package/src/index.ts +3 -7
- package/src/installed-package.ts +15 -0
- package/src/lazy-proxy.ts +11 -11
- package/src/member-hints.ts +8 -12
- package/src/product-create.ts +38 -0
- package/src/product-locator.ts +327 -0
- package/src/registry-format.ts +185 -0
- package/src/session.ts +38 -66
- package/src/singleton.ts +1 -16
- package/src/volter-manifest.ts +97 -0
- package/src/workbench-locator.ts +625 -0
- package/dist/tools.d.ts +0 -23
- package/src/tools.ts +0 -45
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import type { DocumentProbeResult, DocumentProbeStep } from '@volter/sdk/document-probe';
|
|
2
|
+
import type { ActiveDocumentCapture, AssetCompareCapture, AssetCompareOptions, AssetKind, AssetPreviewCapture, AssetPreviewOptions, AssetPreviewShotSetDefinition, AssetPreviewSource, CaptureDimensions, DocumentCameraPose, DocumentLookOutcome, StageFrameCostReading, DocumentTableProjection, EditorChromeCapture, EditorChromeCaptureOptions, EditorState, EditorView, EditorWorkspaceName, HelperVisibility, InspectedFieldWrite, InspectedHierarchy, InspectedInspection, LabeledShotSetCapture, PresentedEditorView, ProjectInfo, RecentProject, ShadingMode, StructureOp, StructureOpOptions, StructureOpResult, TransformMode, TransformSpace, Vec3Value, ViewPreset, ViewportCapture } from '@volter/sdk';
|
|
3
|
+
/**
|
|
4
|
+
* A refused editor command, carrying the relay's own STRUCTURED failure code
|
|
5
|
+
* (`/__editor/command`'s `{ ok: false, error, code }`) alongside the prose, so
|
|
6
|
+
* a caller that reacts to a specific refusal matches the code, never the
|
|
7
|
+
* sentence.
|
|
8
|
+
*/
|
|
9
|
+
export declare class EditorCommandError extends Error {
|
|
10
|
+
readonly code: string | undefined;
|
|
11
|
+
constructor(message: string, code?: string | undefined);
|
|
12
|
+
}
|
|
13
|
+
/** What one undo/redo step reports back — `moved` is false when there was
|
|
14
|
+
* nothing left in that direction, which is an answer, not an error. */
|
|
15
|
+
export interface HistoryStep {
|
|
16
|
+
readonly moved: boolean;
|
|
17
|
+
readonly canUndo: boolean;
|
|
18
|
+
readonly canRedo: boolean;
|
|
19
|
+
readonly undoLabel: string | null;
|
|
20
|
+
readonly redoLabel: string | null;
|
|
21
|
+
}
|
|
22
|
+
/** What `open()` acknowledges: the workspace document the scene-table entry
|
|
23
|
+
* resolved to, and the title its tab now carries — the project's own word for
|
|
24
|
+
* that composition, not a filename. */
|
|
25
|
+
export interface OpenedDocument {
|
|
26
|
+
readonly documentId: string;
|
|
27
|
+
readonly title: string;
|
|
28
|
+
}
|
|
29
|
+
export declare class EditorClient {
|
|
30
|
+
private readonly baseUrl;
|
|
31
|
+
private readonly fetchOverride;
|
|
32
|
+
private readonly transport;
|
|
33
|
+
constructor(opts?: {
|
|
34
|
+
url?: string;
|
|
35
|
+
/** An authenticated transport for the same HTTP routes (e.g. a hosted tab). */
|
|
36
|
+
fetch?: typeof fetch;
|
|
37
|
+
/**
|
|
38
|
+
* An IN-PAGE command channel, for a client that lives inside the editor
|
|
39
|
+
* page itself and has no editor server to reach. Given, every command goes through it instead of
|
|
40
|
+
* `POST /__editor/command`, and answers in the route's own body shape
|
|
41
|
+
* (`{ ok: true, ...data }` / `{ ok: false, error, code? }`).
|
|
42
|
+
*/
|
|
43
|
+
transport?: (body: Record<string, unknown>) => Promise<Record<string, unknown>>;
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* `retryTransport` opts a command into ONE automatic retry after a transport
|
|
47
|
+
* failure (see {@link RETRYABLE_TRANSPORT_CODES}). It is deliberately
|
|
48
|
+
* OPT-IN and off by default: a socket that died after the request was written
|
|
49
|
+
* cannot prove the editor did not already run the command, so a blanket retry
|
|
50
|
+
* would risk playing/stopping/writing twice. Read-only relays — the captures —
|
|
51
|
+
* have no such hazard and turn it on.
|
|
52
|
+
*/
|
|
53
|
+
private command;
|
|
54
|
+
/** Refuse shutdown if a document cannot be saved. Does not stop the server. */
|
|
55
|
+
prepareClose(): Promise<void>;
|
|
56
|
+
select(id: string | null): Promise<void>;
|
|
57
|
+
selectMultiple(ids: string[]): Promise<void>;
|
|
58
|
+
selectAll(): Promise<void>;
|
|
59
|
+
focusEntity(id: string): Promise<void>;
|
|
60
|
+
focusSelection(): Promise<void>;
|
|
61
|
+
/**
|
|
62
|
+
* Frame the EDIT viewport camera on one entity — the strict sibling of
|
|
63
|
+
* {@link focusEntity}. Same framing; an id the scene does not know is a
|
|
64
|
+
* refusal naming the id (`EditorCommandError`, code `ENTITY_NOT_FOUND`)
|
|
65
|
+
* rather than `focusEntity`'s silent no-op, so a caller that frames an
|
|
66
|
+
* entity before capturing it cannot photograph the wrong thing.
|
|
67
|
+
*/
|
|
68
|
+
frameEntity(id: string): Promise<void>;
|
|
69
|
+
viewPreset(preset: ViewPreset): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* LOOK AROUND THE OPEN MODEL, visibly. Swings the active asset
|
|
72
|
+
* document's camera — the one on the human's screen — by `azimuth`/
|
|
73
|
+
* `elevation` radians, animated over `duration` seconds, and resolves when
|
|
74
|
+
* the move ends. A human drag during the move cancels it where it stands
|
|
75
|
+
* (`cancelledBy: 'human'`); the promise still resolves.
|
|
76
|
+
*/
|
|
77
|
+
orbitDocument(options: {
|
|
78
|
+
azimuth?: number;
|
|
79
|
+
elevation?: number;
|
|
80
|
+
duration?: number;
|
|
81
|
+
}): Promise<DocumentLookOutcome>;
|
|
82
|
+
/** What a frame of a 3D document's stage costs, uncapped (`document-frame-cost`). */
|
|
83
|
+
frameCostDocument(options?: {
|
|
84
|
+
readonly frames?: number;
|
|
85
|
+
readonly stage?: string;
|
|
86
|
+
readonly quality?: 'full' | 'navigation';
|
|
87
|
+
}): Promise<StageFrameCostReading>;
|
|
88
|
+
/** A slow full revolution around the open document's subject, at a constant rate. */
|
|
89
|
+
turntableDocument(options?: {
|
|
90
|
+
seconds?: number;
|
|
91
|
+
revolutions?: number;
|
|
92
|
+
}): Promise<DocumentLookOutcome>;
|
|
93
|
+
/**
|
|
94
|
+
* Frame the open document's subject (its selection if it has one). `fit`
|
|
95
|
+
* scales the fitted distance: 1 is the toolbar Frame button's tight fit.
|
|
96
|
+
*/
|
|
97
|
+
frameDocument(fit?: number): Promise<DocumentCameraPose>;
|
|
98
|
+
setCamera(position: Vec3Value, target: Vec3Value, fov?: number): Promise<void>;
|
|
99
|
+
captureViewport(size?: number): Promise<ViewportCapture>;
|
|
100
|
+
/**
|
|
101
|
+
* Capture an isolated, deterministic four-view preview through the editor's
|
|
102
|
+
* native Asset Lab. The SDK delegates rendering to the editor; it never
|
|
103
|
+
* loads, clones, or interprets 3D assets itself.
|
|
104
|
+
*/
|
|
105
|
+
captureAssetPreview(source: AssetPreviewSource, options?: AssetPreviewOptions): Promise<AssetPreviewCapture>;
|
|
106
|
+
/**
|
|
107
|
+
* A caller-defined labeled shot set (`live`'s `assetPreviewShots`): the
|
|
108
|
+
* DEFINITION travels with the command (see `AssetPreviewShotSetDefinition`),
|
|
109
|
+
* and the editor's generic
|
|
110
|
+
* capture engine renders it — see the 3D integration's
|
|
111
|
+
* `captureShotSetAssetPreview`. Throws (via `command`'s `{ok:false}`
|
|
112
|
+
* unwrap) with a clear message naming the missing joint(s) when the asset
|
|
113
|
+
* lacks a bone the definition requires.
|
|
114
|
+
*/
|
|
115
|
+
captureShotSetPreview(source: AssetPreviewSource, definition: AssetPreviewShotSetDefinition, options?: AssetPreviewOptions): Promise<LabeledShotSetCapture>;
|
|
116
|
+
/**
|
|
117
|
+
* Score the asset against a reference GLB (the editor's `screenshot
|
|
118
|
+
* <model.glb> --compare <ref.glb>` command): matched orthographic front + side silhouettes
|
|
119
|
+
* (equal-height bounding-box framing, both yaw-normalized to face the
|
|
120
|
+
* camera), per-view IoU numbers, and overlay evidence images. The
|
|
121
|
+
* reference GLB's raw bytes travel base64 in the command; the editor
|
|
122
|
+
* renders and scores — the SDK never interprets 3D assets itself.
|
|
123
|
+
*/
|
|
124
|
+
captureAssetComparePreview(source: AssetPreviewSource, refGlbBase64: string, options?: AssetCompareOptions): Promise<AssetCompareCapture>;
|
|
125
|
+
/** Focus a static workspace panel by the key the editor's panel registry
|
|
126
|
+
* holds; an unknown key refuses naming the keys it does hold. */
|
|
127
|
+
showPanel(panel: string): Promise<void>;
|
|
128
|
+
/** Show several instances of the running project split-screen — multiplayer
|
|
129
|
+
* authoring. Pass a total `count` (default "Player N" labels) or an array of
|
|
130
|
+
* `names` (its length is the count; index 0 is the primary). Requires a live
|
|
131
|
+
* play session. */
|
|
132
|
+
setInstanceCount(countOrNames: number | string[]): Promise<void>;
|
|
133
|
+
openAsset(path: string, kind: AssetKind): Promise<void>;
|
|
134
|
+
/** SELECT a project asset — the other half of the browser's
|
|
135
|
+
* selection-vs-open contract (single click selects and fills the
|
|
136
|
+
* Inspector; double click opens a document). */
|
|
137
|
+
selectAsset(path: string): Promise<void>;
|
|
138
|
+
closeAsset(key: string): Promise<void>;
|
|
139
|
+
toggleCommandPalette(): Promise<void>;
|
|
140
|
+
toggleConsole(): Promise<void>;
|
|
141
|
+
/** Switch the editor's NAMED WORKSPACE — the task-named layout memory
|
|
142
|
+
* (`design`/`animate`/`look`, or one a package contributes). Resolves once the
|
|
143
|
+
* dock has finished rebuilding, so a following capture photographs the
|
|
144
|
+
* arrangement that was asked for. */
|
|
145
|
+
setWorkspace(workspace: EditorWorkspaceName): Promise<void>;
|
|
146
|
+
/** Choose a STYLE (`volter.style`) — its material, icon set and type, and the colour theme it
|
|
147
|
+
* was drawn with (`classic`/`glass`/`maya`/`substance`, or one a package the project or
|
|
148
|
+
* product composes carries). */
|
|
149
|
+
setStyle(style: string): Promise<void>;
|
|
150
|
+
/** A view's presentation, answered resolved. With a LAYER the person's choice is recorded
|
|
151
|
+
* first. */
|
|
152
|
+
viewportPresentation(documentId: string, layer?: import('@volter/sdk/viewport-presentation').PresentationLayer): Promise<{
|
|
153
|
+
presentation: import('@volter/sdk/viewport-presentation').ViewportPresentation;
|
|
154
|
+
binding: {
|
|
155
|
+
stageKind: string;
|
|
156
|
+
documentLayer: import('@volter/sdk/viewport-presentation').PresentationLayer | null;
|
|
157
|
+
} | null;
|
|
158
|
+
bound: {
|
|
159
|
+
viewId: string;
|
|
160
|
+
stageKind: string;
|
|
161
|
+
}[];
|
|
162
|
+
lastDraw: import('@volter/sdk/viewport-presentation').ViewDrawReport | null;
|
|
163
|
+
presets: string[];
|
|
164
|
+
/** The environment images registered (`./environment-images`), for `lighting.preview.environment.image`. */
|
|
165
|
+
environmentImages: string[];
|
|
166
|
+
}>;
|
|
167
|
+
showBuild(): Promise<void>;
|
|
168
|
+
/** Atomically present a durable editor view and return its shareable URL. */
|
|
169
|
+
present(view: EditorView): Promise<PresentedEditorView>;
|
|
170
|
+
inspect(): Promise<InspectedInspection>;
|
|
171
|
+
/** Run one verb exposed by the active Inspector subject, by its id. */
|
|
172
|
+
runInspectionAction(actionId: string): Promise<InspectedInspection>;
|
|
173
|
+
/**
|
|
174
|
+
* Run ONE command by id — the door to everything the command palette lists.
|
|
175
|
+
*
|
|
176
|
+
* Under the Code-OSS frame this is the workbench's own `ICommandService`, so
|
|
177
|
+
* any command id works: a view's `volter.<view>.<verb>`, an editor action's
|
|
178
|
+
* `volter.action.<id>`, or one of VS Code's own. A call made before the
|
|
179
|
+
* command service lands waits for it.
|
|
180
|
+
*
|
|
181
|
+
* The result is whatever the command answered — a view verb's state, or
|
|
182
|
+
* `null` for a command that returns nothing.
|
|
183
|
+
*/
|
|
184
|
+
runCommand(commandId: string, args?: unknown): Promise<unknown>;
|
|
185
|
+
/**
|
|
186
|
+
* One STRUCTURE op on the authored tree — the hierarchy context menu's own
|
|
187
|
+
* verbs, on the same helpers, for a caller with no pointer to right-click
|
|
188
|
+
* with. `id`/`ids` default to the current selection.
|
|
189
|
+
*/
|
|
190
|
+
structureOp(op: StructureOp, options?: StructureOpOptions): Promise<StructureOpResult>;
|
|
191
|
+
/** "Extract Component…" — the hierarchy row's action, as a command. Answers
|
|
192
|
+
* the action's own sentence, which NAMES the files it created. */
|
|
193
|
+
extractComponent(options?: {
|
|
194
|
+
id?: string;
|
|
195
|
+
name?: string;
|
|
196
|
+
}): Promise<{
|
|
197
|
+
hint: string;
|
|
198
|
+
}>;
|
|
199
|
+
/** "Fork Component…" — extract's twin: one new file, one callsite retargeted. */
|
|
200
|
+
forkComponent(options?: {
|
|
201
|
+
id?: string;
|
|
202
|
+
}): Promise<{
|
|
203
|
+
hint: string;
|
|
204
|
+
}>;
|
|
205
|
+
/**
|
|
206
|
+
* The HIERARCHY PANEL's actual rendered row tree, as data.
|
|
207
|
+
*
|
|
208
|
+
* The panel projects component marks, document promotion, child caps,
|
|
209
|
+
* collapse state, search and selection scope onto the adapter tree.
|
|
210
|
+
*
|
|
211
|
+
* Deliberately NOT `status().entities`, which walks the raw adapter tree and
|
|
212
|
+
* therefore answers a different question: a panel defect is invisible in it.
|
|
213
|
+
*
|
|
214
|
+
* Each row reports the projected child count and whether the panel draws a disclosure control.
|
|
215
|
+
*
|
|
216
|
+
* Rejects, naming the panel, when no hierarchy panel is mounted: an empty
|
|
217
|
+
* tree would be a fabricated answer about a surface nobody is being shown.
|
|
218
|
+
*/
|
|
219
|
+
hierarchy(): Promise<InspectedHierarchy>;
|
|
220
|
+
/** Run the Hierarchy panel's own Expand All action. */
|
|
221
|
+
expandHierarchyAll(): Promise<void>;
|
|
222
|
+
/** Run the Hierarchy panel's own Collapse All action — Expand All's other
|
|
223
|
+
* half, and the only way back to the tree's rest state through the product
|
|
224
|
+
* (see `HierarchyPanelSnapshot.collapseAll`). */
|
|
225
|
+
collapseHierarchyAll(): Promise<void>;
|
|
226
|
+
/**
|
|
227
|
+
* Write one editable path through the active Inspector's own IO.
|
|
228
|
+
*
|
|
229
|
+
* The answer carries `write` as well as the subject, because an ack alone
|
|
230
|
+
* cannot be believed: a write with no persistence route open succeeds and
|
|
231
|
+
* changes no byte, and `write.persisted` is how the caller tells the two
|
|
232
|
+
* apart without diffing the tree (`InspectedWriteDestination` in `types.ts`).
|
|
233
|
+
*/
|
|
234
|
+
setInspectionField(path: string, value: unknown): Promise<InspectedFieldWrite>;
|
|
235
|
+
/**
|
|
236
|
+
* REMOVE one editable path's authored override — the other half of the write
|
|
237
|
+
* door, and the only one that can express byte-ABSENCE.
|
|
238
|
+
*
|
|
239
|
+
* {@link setInspectionField} writes a VALUE, so reverting a property an
|
|
240
|
+
* authoring gesture ADDED puts the default back EXPLICITLY and leaves the
|
|
241
|
+
* source one attribute heavier than it started. This drops the property, so
|
|
242
|
+
* whatever governs it in its absence takes over — the same `io.remove` the
|
|
243
|
+
* Inspector's revert arrow calls, the same persistence pipe, the same awaited
|
|
244
|
+
* `{ destination, persisted }` ack.
|
|
245
|
+
*
|
|
246
|
+
* Rejects with `code: 'REMOVAL_UNAVAILABLE'` when the field does not declare
|
|
247
|
+
* itself removable or the lane implements no removal door. That refusal is a
|
|
248
|
+
* MISSING SEAM, not a failed removal, and it is coded rather than phrased
|
|
249
|
+
* precisely so a caller can grade the two differently.
|
|
250
|
+
*/
|
|
251
|
+
removeInspectionField(path: string): Promise<InspectedFieldWrite>;
|
|
252
|
+
/**
|
|
253
|
+
* OPEN one piece of the adapter's SCENE TABLE by id — a scene, a prefab, or
|
|
254
|
+
* a story state, because the table makes them siblings (they differ only in
|
|
255
|
+
* instance site). The ids are exactly what `getState().adapter.scenes.entries`
|
|
256
|
+
* reports, so the table is both the menu and the address space. It opens
|
|
257
|
+
* the entry's document in Play as in Edit.
|
|
258
|
+
*
|
|
259
|
+
* Rejects with a coded reason rather than prose: `SCENE_NOT_FOUND` (and it
|
|
260
|
+
* names the ids that DO exist), `SCENE_NOT_OPENABLE` carrying the reason an
|
|
261
|
+
* entry owns no document (the adapter's own, when it declared one),
|
|
262
|
+
* `SCENE_TABLE_UNAVAILABLE` before the adapter has loaded, and
|
|
263
|
+
* `SCENE_DOCUMENT_NOT_MOUNTED` when the host has no document for a piece the
|
|
264
|
+
* table says is openable — a host gap, not a table statement.
|
|
265
|
+
*/
|
|
266
|
+
open(id: string): Promise<OpenedDocument>;
|
|
267
|
+
/**
|
|
268
|
+
* Undo / redo one project transaction — the same queue the keyboard shortcut
|
|
269
|
+
* drives. `moved` is false when there was nothing left in that direction.
|
|
270
|
+
*/
|
|
271
|
+
undo(): Promise<HistoryStep>;
|
|
272
|
+
redo(): Promise<HistoryStep>;
|
|
273
|
+
/** Read the editor's actual current durable projection. */
|
|
274
|
+
currentView(): Promise<EditorView>;
|
|
275
|
+
/** Photograph the editor PAGE itself — every panel as the person sees it, at
|
|
276
|
+
* `scale` output pixels per CSS pixel (default `devicePixelRatio`), which is
|
|
277
|
+
* what a 1 px border or a glyph edge is judged through. */
|
|
278
|
+
captureEditorChrome(options?: EditorChromeCaptureOptions): Promise<EditorChromeCapture>;
|
|
279
|
+
/** Capture the active document's render, excluding editor chrome. A number
|
|
280
|
+
* requests a square; `{width, height}` requests that shape, bounded by
|
|
281
|
+
* {@link CaptureDimensions}. With a view, present and capture it in one request
|
|
282
|
+
* so discovery cannot retarget the capture between client calls. */
|
|
283
|
+
captureActiveDocument(size?: CaptureDimensions, view?: EditorView): Promise<ActiveDocumentCapture>;
|
|
284
|
+
/**
|
|
285
|
+
* Read or drive the ACTIVE center document's own DOM — the scoped
|
|
286
|
+
* editor-chrome door, and the read/gesture half of the same subject
|
|
287
|
+
* {@link captureActiveDocument} photographs. NOT play-mode gated, and NOT
|
|
288
|
+
* page automation: a target outside the active document's container is
|
|
289
|
+
* refused by name. Design and scope contract:
|
|
290
|
+
* `packages/sdk/src/editor-document-probe.ts`.
|
|
291
|
+
*/
|
|
292
|
+
documentProbe(step: DocumentProbeStep): Promise<DocumentProbeResult>;
|
|
293
|
+
/**
|
|
294
|
+
* A verb a package contributes: the Code-OSS command `volter.<type>` its page half registers,
|
|
295
|
+
* waited on as long as its declaration says (`contributes.commands`' `volter.timeoutMs`, which
|
|
296
|
+
* the relay reads from the same manifest), so a package's long verb (a modeling chunk, minutes
|
|
297
|
+
* under Wasm) has its budget in one place. A verb no package declares is refused by name
|
|
298
|
+
* before anything is sent.
|
|
299
|
+
*/
|
|
300
|
+
contributedVerb<T extends object = Record<string, unknown>>(type: string, fields?: Record<string, unknown>): Promise<T>;
|
|
301
|
+
/**
|
|
302
|
+
* Run a wire-carried step against the ACTIVE document's published context
|
|
303
|
+
* (`packages/editor-core/src/document-context-registry.ts`) — the REPL door over
|
|
304
|
+
* an open document. `src` is JavaScript source evaluated in the page; references to the caller's
|
|
305
|
+
* closures are unavailable.
|
|
306
|
+
*/
|
|
307
|
+
documentScript<T = unknown>(src: string): Promise<T>;
|
|
308
|
+
setGrid(enabled: boolean): Promise<void>;
|
|
309
|
+
setHelpers(enabled: boolean): Promise<void>;
|
|
310
|
+
setStats(enabled: boolean): Promise<void>;
|
|
311
|
+
setShadingMode(mode: ShadingMode): Promise<void>;
|
|
312
|
+
setHelperType(helperType: keyof HelperVisibility, enabled: boolean): Promise<void>;
|
|
313
|
+
setTransformMode(mode: TransformMode): Promise<void>;
|
|
314
|
+
setTransformSpace(space: TransformSpace): Promise<void>;
|
|
315
|
+
setSnap(enabled: boolean): Promise<void>;
|
|
316
|
+
/** A new project from one of the running product's templates or examples (its `/__editor/templates`), or its default
|
|
317
|
+
* where neither is named. */
|
|
318
|
+
createProject(name: string, location: string, from?: {
|
|
319
|
+
readonly template?: string;
|
|
320
|
+
readonly example?: string;
|
|
321
|
+
}): Promise<ProjectInfo>;
|
|
322
|
+
openProject(path: string): Promise<void>;
|
|
323
|
+
getProject(): Promise<ProjectInfo | null>;
|
|
324
|
+
listRecentProjects(): Promise<RecentProject[]>;
|
|
325
|
+
/**
|
|
326
|
+
* The document table the host resolved — every scene, prefab, page, model,
|
|
327
|
+
* shot, take … the project's finders produced (`getState().adapter.scenes`
|
|
328
|
+
* is the same projection). A command, so it answers wherever the control
|
|
329
|
+
* channel reaches, not only where `/__editor/state` is served.
|
|
330
|
+
*/
|
|
331
|
+
documentTable(): Promise<DocumentTableProjection>;
|
|
332
|
+
reloadPage(): Promise<void>;
|
|
333
|
+
getState(): Promise<EditorState>;
|
|
334
|
+
/**
|
|
335
|
+
* The complete unresolved console set the session is holding right now.
|
|
336
|
+
*
|
|
337
|
+
* The console endpoint returns named conditions; command envelopes carry
|
|
338
|
+
* only their counts. The request has a bounded header deadline.
|
|
339
|
+
*/
|
|
340
|
+
getUnresolvedConsole(opts?: {
|
|
341
|
+
all?: boolean;
|
|
342
|
+
}): Promise<unknown>;
|
|
343
|
+
/** Acknowledge one named console condition. */
|
|
344
|
+
acknowledgeConsole(input: {
|
|
345
|
+
readonly id: string;
|
|
346
|
+
readonly reason: string;
|
|
347
|
+
readonly by: string;
|
|
348
|
+
}): Promise<unknown>;
|
|
349
|
+
/**
|
|
350
|
+
* `fetch` for this client's plain routes, with the ONE thing Node's `fetch`
|
|
351
|
+
* will not do: name why it failed.
|
|
352
|
+
*
|
|
353
|
+
* `readJson` below already owns "the server answered the wrong thing"; this
|
|
354
|
+
* owns "nothing answered at all", naming the real code Node buries on
|
|
355
|
+
* `.cause`. No retry
|
|
356
|
+
* here — these routes create projects, run tools and acknowledge console
|
|
357
|
+
* conditions, so repeating one is the caller's decision. The relayed
|
|
358
|
+
* `command` path above has its own opt-in retry for the read-only captures.
|
|
359
|
+
*/
|
|
360
|
+
private httpFetch;
|
|
361
|
+
/** Require a JSON response from the editor server. */
|
|
362
|
+
private readJson;
|
|
363
|
+
/**
|
|
364
|
+
* Whether an editor browser tab is connected to the server *right now*.
|
|
365
|
+
* Unlike {@link getState}, this reflects live SSE connections, not cached
|
|
366
|
+
* state — use it to check whether commands will actually reach an editor.
|
|
367
|
+
*/
|
|
368
|
+
isConnected(): Promise<boolean>;
|
|
369
|
+
waitForState(predicate: (s: EditorState) => boolean, timeoutMs?: number): Promise<EditorState>;
|
|
370
|
+
}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export { servedProjectAnswer } from './registry-format.js';
|
|
2
|
+
export declare const EDITOR_SESSION_DISCOVERY_TIMEOUT_MS = 2000;
|
|
3
|
+
export declare const EDITOR_PROBE_TIMEOUT_MS = 1500;
|
|
4
|
+
export declare class EditorTimeoutError extends Error {
|
|
5
|
+
constructor(label: string, ms: number);
|
|
6
|
+
}
|
|
7
|
+
export declare function withTimeout<T>(promise: Promise<T>, ms: number, label: string): Promise<T>;
|
|
8
|
+
export interface EditorSessionInfo {
|
|
9
|
+
/** The port this session's dev server is bound to. */
|
|
10
|
+
port: number;
|
|
11
|
+
/** Canonical project root path currently open, or null when none. */
|
|
12
|
+
project: string | null;
|
|
13
|
+
/** Dev-server process id, when known from the local session registry (null for an unregistered server the caller only probed by port). */
|
|
14
|
+
pid: number | null;
|
|
15
|
+
/** Exact explicitly targeted editor origin/base URL, including protocol and host. */
|
|
16
|
+
url?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Why this server cannot DESCRIBE the `project` it is serving — its
|
|
19
|
+
* manifest's own parse/validation failure, naming the failing key. `null`
|
|
20
|
+
* when the project reads fine, and `undefined` from a probe that did not ask
|
|
21
|
+
* See {@link servedProjectAnswer}: a session in
|
|
22
|
+
* this state is still THIS project's session, and callers must report the
|
|
23
|
+
* reason rather than treat it as no session at all.
|
|
24
|
+
*/
|
|
25
|
+
manifestError?: string | null;
|
|
26
|
+
}
|
|
27
|
+
export interface SessionListingTransport {
|
|
28
|
+
listSessions(timeoutMs: number): Promise<EditorSessionInfo[]>;
|
|
29
|
+
}
|
|
30
|
+
export declare class HttpSessionDiscovery implements SessionListingTransport {
|
|
31
|
+
listSessions(timeoutMs: number): Promise<EditorSessionInfo[]>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EDITOR_PROBE_TIMEOUT_MS,
|
|
3
|
+
EDITOR_SESSION_DISCOVERY_TIMEOUT_MS,
|
|
4
|
+
EditorTimeoutError,
|
|
5
|
+
HttpSessionDiscovery,
|
|
6
|
+
withTimeout
|
|
7
|
+
} from "./chunk-USXOIBVX.js";
|
|
8
|
+
import {
|
|
9
|
+
servedProjectAnswer
|
|
10
|
+
} from "./chunk-Y5W77HYT.js";
|
|
11
|
+
export {
|
|
12
|
+
EDITOR_PROBE_TIMEOUT_MS,
|
|
13
|
+
EDITOR_SESSION_DISCOVERY_TIMEOUT_MS,
|
|
14
|
+
EditorTimeoutError,
|
|
15
|
+
HttpSessionDiscovery,
|
|
16
|
+
servedProjectAnswer,
|
|
17
|
+
withTimeout
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=discovery.js.map
|
|
@@ -1,40 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
* editor surface that is not a running game could be neither read nor driven
|
|
9
|
-
* through the product.
|
|
10
|
-
*
|
|
11
|
-
* WHAT IT ADDRESSES is a closed VOCABULARY of named surfaces, passed as
|
|
12
|
-
* `{ scope }` on every verb:
|
|
13
|
-
*
|
|
14
|
-
* `document` (default) the active centre document's whole box
|
|
15
|
-
* `header` / `shelf` that document's toolbar strip / tool rail
|
|
16
|
-
* `rail` the PROPERTIES view — its tabs, sections and fields
|
|
17
|
-
* `outliner` the OUTLINER view — its rows and their controls
|
|
18
|
-
* `content` the CONTENT view — its categories and asset rows
|
|
19
|
-
* `menubar` the APPLICATION MENUS (Edit, View, …) and the menus they open
|
|
20
|
-
*
|
|
21
|
-
* await editor.document.click('[data-testid=app-menu-edit]', { scope: 'menubar' });
|
|
22
|
-
* await editor.document.query('[role=tab]', { scope: 'rail' });
|
|
23
|
-
* await editor.document.click('[data-testid=properties-tab-modifiers]', { scope: 'rail' });
|
|
24
|
-
* await editor.document.click('[data-ingest-name=Cube]', { scope: 'outliner', clicks: 2 });
|
|
25
|
-
* await editor.document.type('Wheel', { scope: 'outliner' });
|
|
26
|
-
*
|
|
27
|
-
* It is not page automation: a selector resolving outside the named surface is
|
|
28
|
-
* refused by a message naming the scope and listing the others. `rail` and
|
|
29
|
-
* `outliner`, and `content` are editor chrome and stay readable while the Game document is
|
|
30
|
-
* active; `editor.hierarchy()` / `editor.inspect()` keep answering what those
|
|
31
|
-
* panels RESOLVED, where this door answers what they DREW.
|
|
32
|
-
*
|
|
33
|
-
* A field on `LiveEditor` rather than methods on it, so the editor's `eval --list` command
|
|
34
|
-
* shows the verbs as one named surface — the same reason `game.input`
|
|
35
|
-
* and `game.events` are instance fields.
|
|
36
|
-
*/
|
|
37
|
-
import type { DocumentProbeResult, DocumentProbeScope, EditorClient } from '@volter/sdk';
|
|
1
|
+
/** Session binding for reading and driving the editor's named surfaces.
|
|
2
|
+
* Each verb accepts a document-probe scope: document, header, shelf, rail,
|
|
3
|
+
* outliner, utility or area. Targets outside that scope are refused. Chrome
|
|
4
|
+
* scopes remain available without an open document. The eval member listing
|
|
5
|
+
* groups these verbs under editor.document. */
|
|
6
|
+
import type { DocumentProbeResult, DocumentProbeScope } from '@volter/sdk';
|
|
7
|
+
import type { EditorClient } from './client.js';
|
|
38
8
|
/** Which named surface a verb runs against; `document` when omitted. */
|
|
39
9
|
export interface DocumentScopeOption {
|
|
40
10
|
scope?: DocumentProbeScope;
|
|
@@ -114,9 +84,7 @@ export declare class LiveEditorDocument {
|
|
|
114
84
|
type(text: string, options?: DocumentTypeOptions): Promise<DocumentProbeResult>;
|
|
115
85
|
/**
|
|
116
86
|
* A real pointer DRAG across one matched element — press at `from`, move,
|
|
117
|
-
* release at `to`.
|
|
118
|
-
* zero-length drag is a click at that fraction, which `click` (always the
|
|
119
|
-
* center) cannot place.
|
|
87
|
+
* release at `to`. A zero-length drag presses and releases at one fraction.
|
|
120
88
|
*
|
|
121
89
|
* `from`, `to` and every point in `via` are `[x, y]` FRACTIONS OF THE
|
|
122
90
|
* MATCHED ELEMENT'S BOX, 0..1 from its top-left — NEVER pixels and never
|
|
@@ -156,13 +124,10 @@ export declare class LiveEditorDocument {
|
|
|
156
124
|
*/
|
|
157
125
|
select(selector: string, value: string, options?: DocumentGestureOptions): Promise<DocumentProbeResult>;
|
|
158
126
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
* `ctx.history`, `session.commit()`). Edit mode, no play. Serialized like
|
|
164
|
-
* `game.page`: the step's own source travels, so inline every value it
|
|
165
|
-
* needs and return plain data.
|
|
127
|
+
* Run `step` in the editor page against the active document's published
|
|
128
|
+
* context, with its document id in `info`. The document owns the context's
|
|
129
|
+
* API. The step's source is serialized, so inline every value it needs and
|
|
130
|
+
* return plain data.
|
|
166
131
|
*/
|
|
167
132
|
run<T = unknown>(step: (ctx: unknown, info: {
|
|
168
133
|
documentId: string;
|