import type { RequestOverrides } from './operations'; import type { SubscriptionOptions } from '../types'; export type LiveIntentOptions = { /** Per-call timeout (ms) for the HTTP request to the realtime worker. */ timeoutMs?: number; /** Extra headers (advanced/testing). */ headers?: Record; /** @internal Per-call auth override used by server WalletClient. */ _overrides?: RequestOverrides; /** * Fire-and-forget over the room socket without awaiting a server ack — lowest * latency, but a rejection (auth/policy deny, room gone) is NOT surfaced. Use * for high-frequency, idempotent input (movement/aim). Default (false): the * intent rides the socket but AWAITS the ack, so a denial throws — important * for join/ready/leave and any intent whose failure the player must know about. */ fireAndForget?: boolean; }; export type LiveStatusOptions = { /** Per-call timeout (ms) for the HTTP request to the realtime worker. */ timeoutMs?: number; /** Extra headers (advanced/testing). */ headers?: Record; /** @internal Per-call auth override used by server WalletClient. */ _overrides?: RequestOverrides; }; export type LiveStopReason = 'idle' | 'lifetime' | 'error' | 'manual' | 'evicted' | string; export type LiveStatus = { available: boolean; started: boolean; module?: string; etag?: string; running?: boolean; tick?: number; lastErr?: string | null; stopReason?: LiveStopReason | null; lastTickAt?: number | null; nextTickAt?: number | null; nextAlarmAt?: number | null; generation?: number; connections?: number; startedAtMs?: number | null; stoppedAtMs?: number | null; reason?: string; }; export declare class LiveIntentError extends Error { statusCode?: number | undefined; details?: any | undefined; constructor(message: string, statusCode?: number | undefined, details?: any | undefined); } /** * Send a player intent to a running live room. Returns `{ ok: true }`. * * await bounded.live.intent('rooms/abc', { type: 'move', dir: 'up' }); * * `roomPath` is the document path of the room (e.g. `rooms/abc`). The worker * derives the room from this path and reads `intent` as the opaque per-tick * input. The caller's address is taken from the attached session token. * * Throws LiveIntentError on 401 (not logged in / bad token), 404 (room has no * live module), 503 (live runtime/module unavailable), or any non-2xx / * transport error / timeout. */ export declare function intent(roomPath: string, intent: unknown, opts?: LiveIntentOptions): Promise<{ ok: true; }>; /** * Fetch the runtime status for a live room. * * const s = await bounded.live.status('rooms/abc'); * console.log(s.running, s.stopReason, s.generation, s.etag); * * This is diagnostic/ops surface. It reports whether the room facet exists, * whether it is currently ticking, why it last stopped, which module etag is * loaded, and the current generation used after terminal restarts. * * Auth: status attaches the caller's session token WHEN ONE EXISTS (mirroring * `intent`), but does NOT require it. The server gates the DETAILED body on the * room's read rule — an authenticated caller who can read the room gets full * telemetry; an anonymous / unauthorized caller gets only the slim liveness * shape `{available, started, module}` (#102). The caller's own `opts.headers` * may never smuggle in Authorization: only the derived session token sets it. */ export declare function status(roomPath: string, opts?: LiveStatusOptions): Promise; export type SubscribeViewOptions = { /** User id whose view to read. Defaults to the logged-in user's @user.id. */ userId?: string; /** Called with the latest per-player view document. */ onData: (view: any) => void; /** Called on subscription error. */ onError?: (error: any) => void; /** * @internal Per-subscription auth overrides (server `WalletClient` path). * Lets a keypair-backed agent player subscribe to its live view under its * own wallet session instead of any global session — the same override seam * `subscribe()` already honors. Without this, a Node agent could send * intents but never SEE its view (the documented agent-as-player pattern). */ _overrides?: SubscriptionOptions['_overrides']; }; /** * Subscribe to YOUR per-player view of a room. Thin sugar over: * * subscribe('/view/', { onData, onError }) * * The view id defaults to the logged-in user's @user.id (from the session token * claims); pass `opts.userId` to override. Returns the unsubscribe function * (a Promise<() => Promise>, same as `subscribe`). * * Server/agent consumers: use `WalletClient.live.subscribeView` (it supplies * the wallet session + view id); browser apps just call this directly. */ export declare function subscribeView(roomPath: string, opts: SubscribeViewOptions): Promise<() => Promise>; /** The `bounded.live` namespace surface. */ export declare const live: { intent: typeof intent; status: typeof status; subscribeView: typeof subscribeView; };