/* 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; }