import type { DocumentProbeResult, DocumentProbeStep } from '@volter/sdk/document-probe'; 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'; /** * A refused editor command, carrying the relay's own STRUCTURED failure code * (`/__editor/command`'s `{ ok: false, error, code }`) alongside the prose, so * a caller that reacts to a specific refusal matches the code, never the * sentence. */ export declare class EditorCommandError extends Error { readonly code: string | undefined; constructor(message: string, code?: string | undefined); } /** What one undo/redo step reports back — `moved` is false when there was * nothing left in that direction, which is an answer, not an error. */ export interface HistoryStep { readonly moved: boolean; readonly canUndo: boolean; readonly canRedo: boolean; readonly undoLabel: string | null; readonly redoLabel: string | null; } /** What `open()` acknowledges: the workspace document the scene-table entry * resolved to, and the title its tab now carries — the project's own word for * that composition, not a filename. */ export interface OpenedDocument { readonly documentId: string; readonly title: string; } export declare class EditorClient { private readonly baseUrl; private readonly fetchOverride; private readonly transport; constructor(opts?: { url?: string; /** An authenticated transport for the same HTTP routes (e.g. a hosted tab). */ fetch?: typeof fetch; /** * An IN-PAGE command channel, for a client that lives inside the editor * page itself and has no editor server to reach. Given, every command goes through it instead of * `POST /__editor/command`, and answers in the route's own body shape * (`{ ok: true, ...data }` / `{ ok: false, error, code? }`). */ transport?: (body: Record) => Promise>; }); /** * `retryTransport` opts a command into ONE automatic retry after a transport * failure (see {@link RETRYABLE_TRANSPORT_CODES}). It is deliberately * OPT-IN and off by default: a socket that died after the request was written * cannot prove the editor did not already run the command, so a blanket retry * would risk playing/stopping/writing twice. Read-only relays — the captures — * have no such hazard and turn it on. */ private command; /** Refuse shutdown if a document cannot be saved. Does not stop the server. */ prepareClose(): Promise; select(id: string | null): Promise; selectMultiple(ids: string[]): Promise; selectAll(): Promise; focusEntity(id: string): Promise; focusSelection(): Promise; /** * Frame the EDIT viewport camera on one entity — the strict sibling of * {@link focusEntity}. Same framing; an id the scene does not know is a * refusal naming the id (`EditorCommandError`, code `ENTITY_NOT_FOUND`) * rather than `focusEntity`'s silent no-op, so a caller that frames an * entity before capturing it cannot photograph the wrong thing. */ frameEntity(id: string): Promise; viewPreset(preset: ViewPreset): Promise; /** * LOOK AROUND THE OPEN MODEL, visibly. Swings the active asset * document's camera — the one on the human's screen — by `azimuth`/ * `elevation` radians, animated over `duration` seconds, and resolves when * the move ends. A human drag during the move cancels it where it stands * (`cancelledBy: 'human'`); the promise still resolves. */ orbitDocument(options: { azimuth?: number; elevation?: number; duration?: number; }): Promise; /** What a frame of a 3D document's stage costs, uncapped (`document-frame-cost`). */ frameCostDocument(options?: { readonly frames?: number; readonly stage?: string; readonly quality?: 'full' | 'navigation'; }): Promise; /** A slow full revolution around the open document's subject, at a constant rate. */ turntableDocument(options?: { seconds?: number; revolutions?: number; }): Promise; /** * Frame the open document's subject (its selection if it has one). `fit` * scales the fitted distance: 1 is the toolbar Frame button's tight fit. */ frameDocument(fit?: number): Promise; setCamera(position: Vec3Value, target: Vec3Value, fov?: number): Promise; captureViewport(size?: number): Promise; /** * Capture an isolated, deterministic four-view preview through the editor's * native Asset Lab. The SDK delegates rendering to the editor; it never * loads, clones, or interprets 3D assets itself. */ captureAssetPreview(source: AssetPreviewSource, options?: AssetPreviewOptions): Promise; /** * A caller-defined labeled shot set (`live`'s `assetPreviewShots`): the * DEFINITION travels with the command (see `AssetPreviewShotSetDefinition`), * and the editor's generic * capture engine renders it — see the 3D integration's * `captureShotSetAssetPreview`. Throws (via `command`'s `{ok:false}` * unwrap) with a clear message naming the missing joint(s) when the asset * lacks a bone the definition requires. */ captureShotSetPreview(source: AssetPreviewSource, definition: AssetPreviewShotSetDefinition, options?: AssetPreviewOptions): Promise; /** * Score the asset against a reference GLB (the editor's `screenshot * --compare ` command): matched orthographic front + side silhouettes * (equal-height bounding-box framing, both yaw-normalized to face the * camera), per-view IoU numbers, and overlay evidence images. The * reference GLB's raw bytes travel base64 in the command; the editor * renders and scores — the SDK never interprets 3D assets itself. */ captureAssetComparePreview(source: AssetPreviewSource, refGlbBase64: string, options?: AssetCompareOptions): Promise; /** Focus a static workspace panel by the key the editor's panel registry * holds; an unknown key refuses naming the keys it does hold. */ showPanel(panel: string): Promise; /** Show several instances of the running project split-screen — multiplayer * authoring. Pass a total `count` (default "Player N" labels) or an array of * `names` (its length is the count; index 0 is the primary). Requires a live * play session. */ setInstanceCount(countOrNames: number | string[]): Promise; openAsset(path: string, kind: AssetKind): Promise; /** SELECT a project asset — the other half of the browser's * selection-vs-open contract (single click selects and fills the * Inspector; double click opens a document). */ selectAsset(path: string): Promise; closeAsset(key: string): Promise; toggleCommandPalette(): Promise; toggleConsole(): Promise; /** Switch the editor's NAMED WORKSPACE — the task-named layout memory * (`design`/`animate`/`look`, or one a package contributes). Answers the workspace now active and whether its dock * had rebuilt within the command's wait (`applied`): when it had, a following capture photographs the arrangement * that was asked for. */ setWorkspace(workspace: EditorWorkspaceName): Promise<{ readonly workspace: EditorWorkspaceName; readonly applied: boolean; }>; /** Choose a STYLE (`volter.style`) — its material, icon set and type, and the colour theme it * was drawn with (`classic`/`glass`/`maya`/`substance`, or one a package the project or * product composes carries). */ setStyle(style: string): Promise; /** A view's presentation, answered resolved. With a LAYER the person's choice is recorded * first. */ viewportPresentation(documentId: string, layer?: import('@volter/sdk/viewport-presentation').PresentationLayer): Promise<{ presentation: import('@volter/sdk/viewport-presentation').ViewportPresentation; binding: { stageKind: string; documentLayer: import('@volter/sdk/viewport-presentation').PresentationLayer | null; } | null; bound: { viewId: string; stageKind: string; }[]; lastDraw: import('@volter/sdk/viewport-presentation').ViewDrawReport | null; presets: string[]; /** The environment images registered (`./environment-images`), for `lighting.preview.environment.image`. */ environmentImages: string[]; }>; showBuild(): Promise; /** Atomically present a durable editor view and return its shareable URL. */ present(view: EditorView): Promise; inspect(): Promise; /** Run one verb exposed by the active Inspector subject, by its id. */ runInspectionAction(actionId: string): Promise; /** * Run ONE command by id — the door to everything the command palette lists. * * Under the Code-OSS frame this is the workbench's own `ICommandService`, so * any command id works: a view's `volter..`, an editor action's * `volter.action.`, or one of VS Code's own. A call made before the * command service lands waits for it. * * The result is whatever the command answered — a view verb's state, or * `null` for a command that returns nothing. */ runCommand(commandId: string, args?: unknown): Promise; /** * One STRUCTURE op on the authored tree — the hierarchy context menu's own * verbs, on the same helpers, for a caller with no pointer to right-click * with. `id`/`ids` default to the current selection. */ structureOp(op: StructureOp, options?: StructureOpOptions): Promise; /** "Extract Component…" — the hierarchy row's action, as a command. Answers * the action's own sentence, which NAMES the files it created. */ extractComponent(options?: { id?: string; name?: string; }): Promise<{ hint: string; }>; /** "Fork Component…" — extract's twin: one new file, one callsite retargeted. */ forkComponent(options?: { id?: string; }): Promise<{ hint: string; }>; /** * The HIERARCHY PANEL's actual rendered row tree, as data. * * The panel projects component marks, document promotion, child caps, * collapse state, search and selection scope onto the adapter tree. * * Deliberately NOT `status().entities`, which walks the raw adapter tree and * therefore answers a different question: a panel defect is invisible in it. * * Each row reports the projected child count and whether the panel draws a disclosure control. * * Rejects, naming the panel, when no hierarchy panel is mounted: an empty * tree would be a fabricated answer about a surface nobody is being shown. */ hierarchy(): Promise; /** Run the Hierarchy panel's own Expand All action. */ expandHierarchyAll(): Promise; /** Run the Hierarchy panel's own Collapse All action — Expand All's other * half, and the only way back to the tree's rest state through the product * (see `HierarchyPanelSnapshot.collapseAll`). */ collapseHierarchyAll(): Promise; /** * Write one editable path through the active Inspector's own IO. * * The answer carries `write` as well as the subject, because an ack alone * cannot be believed: a write with no persistence route open succeeds and * changes no byte, and `write.persisted` is how the caller tells the two * apart without diffing the tree (`InspectedWriteDestination` in `types.ts`). */ setInspectionField(path: string, value: unknown): Promise; /** * REMOVE one editable path's authored override — the other half of the write * door, and the only one that can express byte-ABSENCE. * * {@link setInspectionField} writes a VALUE, so reverting a property an * authoring gesture ADDED puts the default back EXPLICITLY and leaves the * source one attribute heavier than it started. This drops the property, so * whatever governs it in its absence takes over — the same `io.remove` the * Inspector's revert arrow calls, the same persistence pipe, the same awaited * `{ destination, persisted }` ack. * * Rejects with `code: 'REMOVAL_UNAVAILABLE'` when the field does not declare * itself removable or the lane implements no removal door. That refusal is a * MISSING SEAM, not a failed removal, and it is coded rather than phrased * precisely so a caller can grade the two differently. */ removeInspectionField(path: string): Promise; /** * OPEN one piece of the adapter's SCENE TABLE by id — a scene, a prefab, or * a story state, because the table makes them siblings (they differ only in * instance site). The ids are exactly what `getState().adapter.scenes.entries` * reports, so the table is both the menu and the address space. It opens * the entry's document in Play as in Edit. * * Rejects with a coded reason rather than prose: `SCENE_NOT_FOUND` (and it * names the ids that DO exist), `SCENE_NOT_OPENABLE` carrying the reason an * entry owns no document (the adapter's own, when it declared one), * `SCENE_TABLE_UNAVAILABLE` before the adapter has loaded, and * `SCENE_DOCUMENT_NOT_MOUNTED` when the host has no document for a piece the * table says is openable — a host gap, not a table statement. */ open(id: string): Promise; /** * Undo / redo one project transaction — the same queue the keyboard shortcut * drives. `moved` is false when there was nothing left in that direction. */ undo(): Promise; redo(): Promise; /** Read the editor's actual current durable projection. */ currentView(): Promise; /** Photograph the editor PAGE itself — every panel as the person sees it, at * `scale` output pixels per CSS pixel (default `devicePixelRatio`), which is * what a 1 px border or a glyph edge is judged through. */ captureEditorChrome(options?: EditorChromeCaptureOptions): Promise; /** Capture the active document's render, excluding editor chrome. A number * requests a square; `{width, height}` requests that shape, bounded by * {@link CaptureDimensions}. With a view, present and capture it in one request * so discovery cannot retarget the capture between client calls. */ captureActiveDocument(size?: CaptureDimensions, view?: EditorView): Promise; /** * Read or drive the ACTIVE center document's own DOM — the scoped * editor-chrome door, and the read/gesture half of the same subject * {@link captureActiveDocument} photographs. NOT play-mode gated, and NOT * page automation: a target outside the active document's container is * refused by name. Design and scope contract: * `packages/sdk/src/editor-document-probe.ts`. */ documentProbe(step: DocumentProbeStep): Promise; /** * A verb a package contributes: the Code-OSS command `volter.` its page half registers, * waited on as long as its declaration says (`contributes.commands`' `volter.timeoutMs`, which * the relay reads from the same manifest), so a package's long verb (a modeling chunk, minutes * under Wasm) has its budget in one place. A verb no package declares is refused by name * before anything is sent. */ contributedVerb>(type: string, fields?: Record): Promise; /** * Run a wire-carried step against the ACTIVE document's published context * (`packages/editor-core/src/document-context-registry.ts`) — the REPL door over * an open document. `src` is JavaScript source evaluated in the page; references to the caller's * closures are unavailable. */ documentScript(src: string): Promise; setGrid(enabled: boolean): Promise; setHelpers(enabled: boolean): Promise; setStats(enabled: boolean): Promise; setShadingMode(mode: ShadingMode): Promise; setHelperType(helperType: keyof HelperVisibility, enabled: boolean): Promise; setTransformMode(mode: TransformMode): Promise; setTransformSpace(space: TransformSpace): Promise; setSnap(enabled: boolean): Promise; /** A new project from one of the running product's templates or examples (its `/__editor/templates`), or its default * where neither is named. */ createProject(name: string, location: string, from?: { readonly template?: string; readonly example?: string; }): Promise; openProject(path: string): Promise; getProject(): Promise; /** One `/__editor/asset-library/` request, for `editor.assetLibrary` (`asset-library.ts`): a GET's fields as * its query, a POST's as its JSON body. A refusal throws the route's own error. */ assetLibraryRequest(method: 'GET' | 'POST', route: string, fields: object): Promise; listRecentProjects(): Promise; /** * The document table the host resolved — every scene, prefab, page, model, * shot, take … the project's finders produced (`getState().adapter.scenes` * is the same projection). A command, so it answers wherever the control * channel reaches, not only where `/__editor/state` is served. */ documentTable(): Promise; reloadPage(): Promise; getState(): Promise; /** * The complete unresolved console set the session is holding right now. * * The console endpoint returns named conditions; command envelopes carry * only their counts. The request has a bounded header deadline. */ getUnresolvedConsole(opts?: { all?: boolean; }): Promise; /** Acknowledge one named console condition. */ acknowledgeConsole(input: { readonly id: string; readonly reason: string; readonly by: string; }): Promise; /** * `fetch` for this client's plain routes, with the ONE thing Node's `fetch` * will not do: name why it failed. * * `readJson` below already owns "the server answered the wrong thing"; this * owns "nothing answered at all", naming the real code Node buries on * `.cause`. No retry * here — these routes create projects, run tools and acknowledge console * conditions, so repeating one is the caller's decision. The relayed * `command` path above has its own opt-in retry for the read-only captures. */ private httpFetch; /** Require a JSON response from the editor server. */ private readJson; /** * Whether an editor browser tab is connected to the server *right now*. * Unlike {@link getState}, this reflects live SSE connections, not cached * state — use it to check whether commands will actually reach an editor. */ isConnected(): Promise; waitForState(predicate: (s: EditorState) => boolean, timeoutMs?: number): Promise; }