UNPKG

@tanstack/ai-sandbox

Version:

Provider-agnostic sandbox layer for TanStack AI — run harness adapters inside isolated sandboxes (defineSandbox, defineWorkspace, withSandbox) with a uniform SandboxHandle, workspace bootstrap, policy, and resumable lifecycle.

22 lines (21 loc) 1.09 kB
import { StreamChunk } from '@tanstack/ai'; export interface BridgeEventChannel { /** Pass as the bridge's `emitCustomEvent`; buffers a CUSTOM chunk for the stream. */ emitCustomEvent: (eventName: string, value: Record<string, unknown>) => void; /** Live CUSTOM-chunk stream; ends after {@link close} once drained. */ stream: AsyncIterable<StreamChunk>; /** Stop the stream (call when the run's main output is done). */ close: () => void; } /** Create a channel whose emitted events become CUSTOM {@link StreamChunk}s. */ export declare function createBridgeEventChannel(meta: { model: string; threadId?: string; runId?: string; }): BridgeEventChannel; /** * Merge a `side` chunk stream into a `base` chunk stream, yielding from whichever * settles first. Terminates when `base` ends (the run is over), then releases the * side iterator — so a never-ending channel (until closed) doesn't hang the merge. */ export declare function mergeChunkStreams(base: AsyncIterable<StreamChunk>, side: AsyncIterable<StreamChunk>): AsyncIterable<StreamChunk>;