wyrd/tools
esc

    ↑↓ Move ↵ Open t3c results first Search by Pagefind
    Releases

    Client and transport

    Client and transport

    Classes

    T3Client

    Client composition root for HTTP, auth, RPC and server facades.

    HttpRouteClient

    Every HTTP route of the target build by name, with validated input and a decoded answer.

    CommandDispatcher

    Validated orchestration dispatch and bookkeeping ids.

    RpcClient

    Typed RPC calls and streams with scope checks.

    Constants

    httpRoutes

    Every HTTP route of the target build that has an entry, by upstream group and endpoint name.

    Functions

    consoleLogger()

    Create a logger that writes prefixed messages to the Node console.

    export function consoleLogger(prefix = "t3code-client"): Logger;
    

    T3Client

    Client composition root for HTTP, auth, RPC and server facades.

    Kind: global class

    t3Client.openPreviewViewer()

    Attach to a tab that runs in the server’s browser, with a new ticket for the media use. Each viewer is its own socket, and close() of this client does not end it. The server opens the socket once it has attached the viewer. On T3 Code 0.1.9 a viewer opened while a new tab loads its first page can fail to open, and later viewers of that tab wait behind it: open one after preview.list reports the tab’s navStatus as Success, and pass a signal to give up on one that does not open.

    async openPreviewViewer(
        target: PreviewViewerTarget,
        signal?: AbortSignal,
      ): Promise<PreviewViewer>;

    Kind: instance method of T3Client

    t3Client.openSpeechStream()

    Start one live transcription on /ws/voice, with a new ticket for the media use and orchestration:operate. Each stream is its own socket, and close() of this client does not end it.

    async openSpeechStream(
        options: SpeechTranscriptionOptions = DEFAULT_SPEECH_TRANSCRIPTION_OPTIONS,
        signal?: AbortSignal,
      ): Promise<SpeechStream>;

    Kind: instance method of T3Client

    t3Client.connect()

    Optional eager connect; every RPC connects on demand otherwise.

    connect(signal?: AbortSignal): Promise<void>;

    Kind: instance method of T3Client

    t3Client.close()

    Stops reconnecting, fails everything in flight, and closes the socket.

    close(): Promise<void>;

    Kind: instance method of T3Client

    T3Client.create()

    Compose a client with lazy connections and the selected credential store.

    static create(options: T3ClientOptions): T3Client;

    Kind: static method of T3Client

    HttpRouteClient

    Every HTTP route of the target build by name, with validated input and a decoded answer.

    Kind: global class

    httpRouteClient.call()

    Validate the input, check the known scopes, send the request and decode the answer.

    async call<N extends keyof Table & string>(
        name: N,
        ...args: undefined extends HttpRouteInput<Table, N>
          ? [input?: HttpRouteInput<Table, N>, signal?: AbortSignal]
          : [input: HttpRouteInput<Table, N>, signal?: AbortSignal]
      ): Promise<HttpRouteSuccess<Table, N>>;

    Kind: instance method of HttpRouteClient

    httpRouteClient.stream()

    Validate the input, check the known scopes, and read the events of an event stream route. An event that does not decode is a decode-error item, and the stream continues. Ending the iteration or aborting signal closes the request. An abort raises T3InterruptedError, and a lost connection raises T3ConnectionError.

    async *stream<N extends HttpEventStreamRouteName<Table>>(
        name: N,
        ...args: undefined extends HttpRouteInput<Table, N>
          ? [input?: HttpRouteInput<Table, N>, signal?: AbortSignal]
          : [input: HttpRouteInput<Table, N>, signal?: AbortSignal]
      ): AsyncGenerator<StreamItem<HttpRouteSuccess<Table, N>>>;

    Kind: instance method of HttpRouteClient

    CommandDispatcher

    Validated orchestration dispatch and bookkeeping ids.

    Kind: global class

    commandDispatcher.newCommandId()

    Command ids are attempt ids on the server, never idempotency keys: one per dispatch.

    newCommandId(): CommandId;

    Kind: instance method of CommandDispatcher

    commandDispatcher.newMessageId()

    Generate a message id.

    newMessageId(): MessageId;

    Kind: instance method of CommandDispatcher

    commandDispatcher.newThreadId()

    Generate a thread id.

    newThreadId(): ThreadId;

    Kind: instance method of CommandDispatcher

    commandDispatcher.newProjectId()

    Generate a project id.

    newProjectId(): ProjectId;

    Kind: instance method of CommandDispatcher

    commandDispatcher.now()

    Return the current timestamp in ISO format.

    now(): string;

    Kind: instance method of CommandDispatcher

    commandDispatcher.dispatch()

    Validate and dispatch one orchestration command.

    async dispatch(command: OrchestrationV2Command, signal?: AbortSignal): Promise<DispatchResult>;

    Kind: instance method of CommandDispatcher

    RpcClient

    Typed RPC calls and streams with scope checks.

    Kind: global class

    rpcClient.connection

    The underlying RPC connection for lifecycle inspection.

    get connection(): RpcConnection;

    Kind: instance property of RpcClient

    rpcClient.has()

    true when the table has an entry for method.

    has(method: string): method is keyof Table & string;

    Kind: instance method of RpcClient

    rpcClient.call()

    Validate a typed unary payload and decode its result.

    async call<M extends UnaryMethodName<Table>>(
        method: M,
        payload: RpcPayload<Table, M>,
        signal?: AbortSignal,
      ): Promise<RpcSuccess<Table, M>>;

    Kind: instance method of RpcClient

    rpcClient.stream()

    Stream decoded values; malformed items are yielded as decode errors.

    stream<M extends StreamMethodName<Table>>(
        method: M,
        payload: RpcPayload<Table, M>,
        options?: RpcStreamOptions,
      ): AsyncIterable<StreamItem<RpcSuccess<Table, M>>>;

    Kind: instance method of RpcClient

    rpcClient.callRaw()

    Any method by tag, no validation, no decoding.

    callRaw(tag: string, payload: unknown, signal?: AbortSignal): Promise<unknown>;

    Kind: instance method of RpcClient

    rpcClient.streamRaw()

    Stream an unregistered method without schema validation.

    streamRaw(tag: string, payload: unknown, options?: RpcStreamOptions): AsyncIterable<unknown>;

    Kind: instance method of RpcClient

    httpRoutes

    Every HTTP route of the target build that has an entry, by upstream group and endpoint name.

    Kind: global constant

    consoleLogger()

    Create a logger that writes prefixed messages to the Node console.

    export function consoleLogger(prefix = "t3code-client"): Logger;

    Kind: global function