/* tslint:disable */ /* eslint-disable */ /** * The `ReadableStreamType` enum. * * *This API requires the following crate features to be activated: `ReadableStreamType`* */ type ReadableStreamType = "bytes"; /** * Fabric platform client for browsers, Node, and edge runtimes. * * ```js * import init, { FabricClient } from "@fabric-platform/wasm"; * await init(); * const client = new FabricClient("https://api.fabric.example", "sk-..."); * const me = await client.me(); * for await (const evt of client.streamWorkflowRun(runId)) { * console.log(evt); * } * ``` */ export class FabricClient { free(): void; [Symbol.dispose](): void; cancelRun(run_id: string): Promise; createOrg(slug: string, name: string): Promise; /** * Download an artifact's binary content using its signed download URL. */ downloadArtifact(download_url: string): Promise; getRun(run_id: string): Promise; /** * Fetch a run's final output, per-task timeline, and artifacts. * * Returns `{ run_id, status, output, error, nodes, artifacts }`. * `expiresInSecs` controls the TTL (in seconds) of the signed * download URLs in `artifacts`; `null`/`undefined` means use the * server default (1 hour, capped at 1 day). * * Prefer this over `getRun` when you actually want the workflow's * produced output. `getRun` returns the bare run row, which may * not have `output` populated if you call it during the brief * window between the SSE `run.completed` event and the engine's * finalizer catching up. `getRunOutput` always coalesces over * both the canonical and snapshot stores so it's reliable. * * The TTL is a `u32` (not `i64`) so the generated TypeScript type * comes out as `number | null`, not `bigint | null`. The * server-side cap of 86_400 seconds fits comfortably in 32 bits. */ getRunOutput(run_id: string, expires_in_secs?: number | null): Promise; /** * Fetch input/output/task schemas registered for a workflow. * * Returns `{ name, input_schema, output_schema, task_schemas, * warnings }` — same shape as the TypeScript SDK's * `workflows.registry.getSchemas()`. Use this to drive * JSON-schema-powered form rendering on the run-creation UI. * * Workflows that don't declare Pydantic types come back with all * three schema fields set to `null`. */ getWorkflowSchemas(name: string): Promise; health(): Promise; listApiKeys(): Promise; listOrgs(): Promise; listWorkflows(): Promise; me(): Promise; /** * Create a new client authenticated with an API key. */ constructor(base_url: string, api_key: string); /** * Submit a heterogeneous bundle — N different workflows running * in parallel, one subprocess each. * * Pass an array of `{workflow, input}` objects. Each entry runs * its own workflow; the engine aggregates per-entry outputs into * the run's `outputs` array. Use `getRunOutput` to retrieve * per-entry outputs (each tagged with its sub-workflow_name and * kind). For one creative brief that should produce multiple * kinds of artifact (video + carousel + thread), this is the * primitive — `runWorkflowWithVariants` is N copies of one * workflow, this is N different workflows. */ runBundle(bundle: any): Promise; /** * Submit a workflow run. * * Pass `validate = true` to validate the input against the * workflow's registered `input_schema` before enqueuing. Returns * 400 with per-field errors if validation fails. Defaults to * `false` (no validation) for backwards compatibility. */ runWorkflow(workflow_id: string, context: any, validate?: boolean | null): Promise; /** * Submit a workflow, wait for completion, and return the full output * with artifacts that have signed download URLs. */ runWorkflowAndGetOutput(workflow_name: string, input: any, expires_in_secs?: number | null): Promise; /** * Submit a workflow with `variants` parallel executions (1–10). * * When `variants > 1`, the engine runs the workflow N times with * the same input and aggregates outputs into an `outputs` array on * the run. Use `getRunOutput` to retrieve per-variant outputs. */ runWorkflowWithVariants(workflow_id: string, context: any, variants: number): Promise; /** * Set the organization ID used for scoped requests. */ setOrganizationId(org_id: string): void; /** * Subscribe to the global event firehose. * * Hides internal SDK shim node events by default; pass * `includeInternal = true` to opt back in. */ streamEvents(include_internal?: boolean | null): Promise; /** * Stream events for a single job. * * Hides internal SDK shim node events by default; pass * `includeInternal = true` to opt back in. */ streamJob(job_id: string, include_internal?: boolean | null): Promise; /** * Execute a provider and stream partial output. */ streamProviderExecute(body: any): Promise; /** * Stream events for a workflow run as a JS `ReadableStream`. * * Iterate with `for await (const ev of stream) { ... }`. * * Internal SDK shim node events (`_fabric_capture_input`, * `_fabric_finalize_output`) are hidden by default. Pass * `includeInternal = true` to opt back in for debugging. */ streamWorkflowRun(run_id: string, include_internal?: boolean | null): Promise; upsertWorkflow(name: string, body: any): Promise; } export class IntoUnderlyingByteSource { private constructor(); free(): void; [Symbol.dispose](): void; cancel(): void; pull(controller: ReadableByteStreamController): Promise; start(controller: ReadableByteStreamController): void; readonly autoAllocateChunkSize: number; readonly type: ReadableStreamType; } export class IntoUnderlyingSink { private constructor(); free(): void; [Symbol.dispose](): void; abort(reason: any): Promise; close(): Promise; write(chunk: any): Promise; } export class IntoUnderlyingSource { private constructor(); free(): void; [Symbol.dispose](): void; cancel(): void; pull(controller: ReadableStreamDefaultController): Promise; } export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; export interface InitOutput { readonly memory: WebAssembly.Memory; readonly __wbg_fabricclient_free: (a: number, b: number) => void; readonly fabricclient_cancelRun: (a: number, b: number, c: number) => any; readonly fabricclient_createOrg: (a: number, b: number, c: number, d: number, e: number) => any; readonly fabricclient_downloadArtifact: (a: number, b: number, c: number) => any; readonly fabricclient_getRun: (a: number, b: number, c: number) => any; readonly fabricclient_getRunOutput: (a: number, b: number, c: number, d: number) => any; readonly fabricclient_getWorkflowSchemas: (a: number, b: number, c: number) => any; readonly fabricclient_health: (a: number) => any; readonly fabricclient_listApiKeys: (a: number) => any; readonly fabricclient_listOrgs: (a: number) => any; readonly fabricclient_listWorkflows: (a: number) => any; readonly fabricclient_me: (a: number) => any; readonly fabricclient_new: (a: number, b: number, c: number, d: number) => [number, number, number]; readonly fabricclient_runBundle: (a: number, b: any) => any; readonly fabricclient_runWorkflow: (a: number, b: number, c: number, d: any, e: number) => any; readonly fabricclient_runWorkflowAndGetOutput: (a: number, b: number, c: number, d: any, e: number) => any; readonly fabricclient_runWorkflowWithVariants: (a: number, b: number, c: number, d: any, e: number) => any; readonly fabricclient_setOrganizationId: (a: number, b: number, c: number) => void; readonly fabricclient_streamEvents: (a: number, b: number) => any; readonly fabricclient_streamJob: (a: number, b: number, c: number, d: number) => any; readonly fabricclient_streamProviderExecute: (a: number, b: any) => any; readonly fabricclient_streamWorkflowRun: (a: number, b: number, c: number, d: number) => any; readonly fabricclient_upsertWorkflow: (a: number, b: number, c: number, d: any) => any; readonly __wbg_intounderlyingsource_free: (a: number, b: number) => void; readonly intounderlyingsource_cancel: (a: number) => void; readonly intounderlyingsource_pull: (a: number, b: any) => any; readonly __wbg_intounderlyingbytesource_free: (a: number, b: number) => void; readonly intounderlyingbytesource_autoAllocateChunkSize: (a: number) => number; readonly intounderlyingbytesource_cancel: (a: number) => void; readonly intounderlyingbytesource_pull: (a: number, b: any) => any; readonly intounderlyingbytesource_start: (a: number, b: any) => void; readonly intounderlyingbytesource_type: (a: number) => number; readonly __wbg_intounderlyingsink_free: (a: number, b: number) => void; readonly intounderlyingsink_abort: (a: number, b: any) => any; readonly intounderlyingsink_close: (a: number) => any; readonly intounderlyingsink_write: (a: number, b: any) => any; readonly wasm_bindgen__convert__closures_____invoke__hd95d4764e5fe8d53: (a: number, b: number, c: any) => [number, number]; readonly wasm_bindgen__convert__closures_____invoke__h104359cd228cdc67: (a: number, b: number, c: any, d: any) => void; readonly wasm_bindgen__convert__closures_____invoke__hc018ef2b4de61cd3: (a: number, b: number, c: any) => void; readonly wasm_bindgen__convert__closures_____invoke__h413ef2deaa6bb094: (a: number, b: number) => void; readonly wasm_bindgen__convert__closures_____invoke__h6bc23249578087ac: (a: number, b: number) => void; readonly __wbindgen_malloc: (a: number, b: number) => number; readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; readonly __wbindgen_exn_store: (a: number) => void; readonly __externref_table_alloc: () => number; readonly __wbindgen_externrefs: WebAssembly.Table; readonly __wbindgen_destroy_closure: (a: number, b: number) => void; readonly __externref_table_dealloc: (a: number) => void; readonly __wbindgen_start: () => void; } export type SyncInitInput = BufferSource | WebAssembly.Module; /** * Instantiates the given `module`, which can either be bytes or * a precompiled `WebAssembly.Module`. * * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated. * * @returns {InitOutput} */ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput; /** * If `module_or_path` is {RequestInfo} or {URL}, makes a request and * for everything else, calls `WebAssembly.instantiate` directly. * * @param {{ module_or_path: InitInput | Promise }} module_or_path - Passing `InitInput` directly is deprecated. * * @returns {Promise} */ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise } | InitInput | Promise): Promise;