/** * `invoke` - start a session for a registered agent. * * Dispatches to a registered agent (the `agentId` you passed to {@link serve}), * hands it a room (auto-created if you don't pass one) plus any SIP / per-call * config, and returns the new session's ids. The serving worker picks up the * session and connects to the room. * * Per-session config is grouped into small factory-built objects you can import * from `@zrt/js-sdk`: {@link Room}, {@link Sip}. * * This is a one-shot client call - run it from anywhere (a script, a CLI, a web * handler). */ import type { RecordingConfigOptions } from './config.js'; /** Per-call room configuration for {@link invoke}. Build with the {@link Room} factory. */ export type Room = { /** Existing room to join. When omitted, a room is auto-created. */ roomId?: string | null; /** ZRT auth token. Falls back to `ZRT_AUTH_TOKEN` / `ZRT_API_KEY` + `ZRT_SECRET_KEY`. */ authToken?: string | null; /** Display name for the agent participant. Defaults to the `agentId`. */ agentName?: string | null; /** Whether to return a playground URL in the result. Defaults to `true`. */ playground?: boolean; /** Enable video/vision input. Defaults to `false`. */ vision?: boolean; /** Enable session recording. Defaults to `false`. */ recording?: boolean; /** Enable background audio. Defaults to `false`. */ backgroundAudio?: boolean; /** Enable the audio listener. Defaults to `false`. */ audioListenerEnabled?: boolean; /** End the session automatically on completion. Defaults to `true`. */ autoEndSession?: boolean; /** Maximum session length in seconds; truncated to an integer. Defaults to `15`; pass `null` to omit. */ sessionTimeoutSeconds?: number | null; /** Seconds to wait with no participant before ending; truncated to an integer. Defaults to `90`; pass `null` to omit. */ noParticipantTimeoutSeconds?: number | null; /** Fixed participant id for the agent. Defaults to assigned automatically. */ agentParticipantId?: string | null; /** Base URL of the signaling service. Defaults to the standard endpoint. */ signalingBaseUrl?: string | null; /** Forward session logs to the dashboard. Defaults to `true`. */ sendLogsToDashboard?: boolean; /** Minimum dashboard log level (`DEBUG`/`INFO`/`WARNING`/`ERROR`/`CRITICAL`). Defaults to `'INFO'`. */ dashboardLogLevel?: string; }; /** Per-call SIP/telephony configuration for {@link invoke}. Build with the {@link Sip} factory. */ export type Sip = { /** Destination phone number / SIP URI. */ callTo?: string | null; /** Caller phone number / SIP URI. */ callFrom?: string | null; /** Call direction, e.g. `'inbound'` or `'outbound'`. */ callType?: string | null; /** Caller-supplied unique call identifier. */ callId?: string | null; /** Webhook URL to notify about call events. */ webhookUrl?: string | null; /** Extra key/value metadata merged into the call's dispatch metadata. */ extra?: Record; }; /** Create a {@link Room} config for {@link invoke}. */ export declare function Room(init?: Room): Room; /** Create a {@link Sip} config for {@link invoke}. */ export declare function Sip(init?: Sip): Sip; /** Options for {@link invoke}. */ export type InvokeOptions = { /** Room configuration. Defaults to an empty {@link Room} (auto-created room). */ room?: Room; /** SIP/telephony configuration for the call. See {@link Sip}. */ sip?: Sip; /** Label selector used to route to a specific worker. */ labels?: Record; /** Arbitrary metadata passed to the agent for this session. */ metadata?: Record; /** * Per-session recording overrides, attached as `recording_override` on the * dispatch. Providing it also turns on room recording (as if `room.recording` * were `true`), and `enabled` defaults to `true` when unset. See {@link RecordingConfigOptions}. */ recordingConfig?: RecordingConfigOptions; /** Caller-supplied session id; one is generated when omitted. */ sessionId?: string; /** Zero Runtime endpoint to dispatch to. Defaults to `ZRT_RUNTIME_ADDRESS` or `us1.rt.zeroruntime.ai:443`. */ runtimeAddress?: string; /** Dispatch timeout in seconds. Defaults to `30`. */ timeoutSeconds?: number; }; /** Result of a successful {@link invoke} dispatch. */ export type InvokeResult = { /** Id of the started session. */ sessionId: string; /** Id of the worker that accepted the session. */ workerId: string; /** Id of the room the session joined. */ roomId: string; /** Playground URL for observing the session; present when `room.playground` is enabled and auth is available. */ playgroundUrl?: string; }; /** * Start a session for a registered agent. * * Dispatches to the agent registered under `agentId` (the id you passed to * {@link serve}), gives it a room (auto-created when none is supplied) plus any * SIP and per-call config, and returns the new session's ids. * * @param agentId - The id the target agent registered with via {@link serve}. * @param options - Room, SIP, routing, and timeout settings. See {@link InvokeOptions}. * @returns The started session's ids and an optional playground URL. * @throws If `agentId` is missing, no room/auth is available to create a room, * or the dispatch is rejected or times out. */ export declare function invoke(agentId: string, options?: InvokeOptions): Promise;