StillMade AIDeveloper docs
Browse documentation · SDK 0.1.0

Interface bridge reference

Every member of the StillMade object a Block interface receives, with its signature and where it is available.

Standard and frame views receive the same StillMade object; members marked Frame views exist only there. In and Out are the Block's input and output values (see TypeScript). The view host checks every request itself: a read-only viewer cannot run the Block or save outputs from any view.

Inputs and runs

MemberWhereWhat it does
readonly input: Partial<In>Every viewA copy of the current input values. Read it after onInput first fires.
onInput(callback: (input: Partial<In>) => void): () => voidEvery viewReceives the input when the view starts and each time the host changes it. Returns a function that stops listening. Initialize controls here.
run(values: In): Promise<Out>Every viewChecks the named input values, runs the Block (its recipe, JavaScript, module or hosted operation, after any approval the host asks for) and resolves to the checked outputs. One run at a time, 30 a minute.
useOutput(outputs: Partial<Out>): Promise<Record<string, unknown>>A saved project StepChooses media the view already holds (input media or a desktop recording) as the Block outputs without running. Only complete references the host issued are accepted.
readonly schemaFields: Readonly<Record<string, unknown>>Every viewHelpers that build form fields from the input ports and their schemas, honoring inputs the host locked.

Shared state

MemberWhereWhat it does
getShared(): {state: Record<string, unknown>; outputs: Record<string, unknown>; memory: unknown; canEdit: boolean}Every viewA copy of the view state shared by everyone in the project, the last outputs, the Block memory and whether this person may edit.
onShared(callback: (shared: ReturnType<StillMadeView["getShared"]>) => void): () => voidEvery viewReceives the shared state now and after every change by anyone. Returns a function that stops listening.
updateShared(values: Record<string, unknown>, preconditions?: Record<string, unknown>, options?: Record<string, unknown>): Promise<unknown>Every viewChanges shared fields. Keep each independently edited value in its own field so two people never conflict; a field someone else changed first is refused.
bindShared(key: string, id: string): () => voidEvery viewBinds a form element (by id) to one shared field: it shows other people's edits and saves this person's edits, keeping drafts while they type.
setSharedDefaults(values: Record<string, unknown>): voidEvery viewValues bound controls show until someone saves the field.
`scheduleSharedEdit(key: string, callback: () => unknown \Promise<unknown>): void`Every viewRuns a named shared edit after a short pause (at most 500 ms after the first request), so rapid edits to one field (sliders, drags) become one save.
connectDocument(options: Record<string, unknown>): Readonly<Record<string, unknown>>Every viewConnects a declared JSON content store to shared edits once; returns its status, flush and recovery methods.
indexById(items: Array<{id: string; [key: string]: unknown}>): Map<string, {id: string; [key: string]: unknown}>Every viewIndexes list items by their stable id.
diffDocument(before: Record<string, unknown>, after: Record<string, unknown>): Array<Record<string, unknown>>Every viewThe minimal list of edits between two versions of a document.
applyDocument(document: Record<string, unknown>, patches: Array<Record<string, unknown>>): Record<string, unknown>Every viewApplies edits from diffDocument to a document.

Media

MemberWhereWhat it does
previewImage(value: StillMadeImage): Promise<{url: string; width: number; height: number}>Every viewA display-only PNG copy (at most 512 pixels a side) of an image the view may show. Keep passing the original value to run.
`previewMedia(value: StillMadeVideo \StillMadeAudio): Promise<{kind: "video" \"audio"; url: string}>`Every viewA playable blob: URL for audio or video the view may play. Call releaseMedia when done.
releaseMedia(url: string): voidEvery viewFrees a URL previewMedia returned.
asset(path: string): stringFrame viewsA blob: URL for one of the view's own asset files, for <img>, new FontFace() or <video>.
assetBytes(path: string): ArrayBufferFrame viewsA copy of one of the view's own asset files.

Generated interface

MemberWhereWhat it does
render(targetId: string, tree: Array<Record<string, unknown>>): voidEvery viewRenders a tree of StillMade controls into an element, for standard views that build their interface from data.
`onAction(callback: (event: {action: string; value: unknown; checked: boolean; event: string}) => void \Promise<void>): () => void`Every viewReceives actions from controls render drew.

Connected work

MemberWhereWhat it does
`connectedApp(operation: "tasks" \"preview-task" \"apply-task", args?: Record<string, unknown>): Promise<Record<string, unknown>>`A saved project StepLists, previews and applies tasks of the Block's connected-app contract.
sharedWork(operation: string, args?: Record<string, unknown>): Promise<Record<string, unknown>>A saved project StepReads and contributes to shared work items (reviews, contributions) in the project.
onSharedWorkRefresh(callback: () => void): () => voidA saved project StepCalled when shared work changes elsewhere; read it again.
`previewSharedWorkMedia(contributionId: string): Promise<{url: string; kind: "image" \"video" \"audio"}>`A saved project StepA display copy of media attached to a shared work contribution.
releaseSharedWorkMedia(url: string): voidA saved project StepFrees a URL previewSharedWorkMedia returned.
desktop(operation: string, args?: Record<string, unknown>): Promise<Record<string, unknown>>StillMade DesktopRuns a declared desktop permission (screen or camera capture, clipboard, native tools) after the person grants it.