ChatClient
Defined in: react/src/client.ts:319
Properties
Section titled “Properties”respond
Section titled “respond”respond: Respond;Defined in: react/src/client.ts:345
Answers a request. It shows as submitting until the host changes the request or the run.
Methods
Section titled “Methods”attach()
Section titled “attach()”attach(): () => void;Defined in: react/src/client.ts:332
Starts observing, and returns the function that stops. Commands work without it, but only an attached client opens observations and reattaches them.
Calls nest: the client observes while anyone is attached. Detaching closes the observation and nothing else. A stream that is the reply to a command stays open to its end, because for many hosts closing it stops the run, and only Stop may stop a run.
Returns
Section titled “Returns”() => void
discard()
Section titled “discard()”discard(messageId): CommandResult;Defined in: react/src/client.ts:340
Takes a message whose outcome is unknown out of the conversation, and out of pendingSend
storage, without sending it again: for a message the person gives up on. If it did arrive,
the host’s copy still shows once the host sends it.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
messageId |
string |
Returns
Section titled “Returns”getState()
Section titled “getState()”getState(): ChatState;Defined in: react/src/client.ts:321
The current state. The same object until something in it changed.
Returns
Section titled “Returns”recallInput()
Section titled “recallInput()”recallInput(inputId): Promise<CommandResult>;Defined in: react/src/client.ts:350
Manual recall through a host that can fence the race with input acceptance.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
inputId |
string |
Returns
Section titled “Returns”Promise<CommandResult>
reconnect()
Section titled “reconnect()”reconnect(): void;Defined in: react/src/client.ts:352
Opens a fresh observation, with a full budget of tries, after the connection was lost.
Returns
Section titled “Returns”void
retry()
Section titled “retry()”retry(messageId): Promise<SendResult>;Defined in: react/src/client.ts:336
Sends a message whose outcome is unknown again, with the same clientId. Nothing else ever
sends a message twice.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
messageId |
string |
Returns
Section titled “Returns”Promise<SendResult>
send()
Section titled “send()”send(input): Promise<SendResult>;Defined in: react/src/client.ts:333
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
input |
| string | MessageInput |
Returns
Section titled “Returns”Promise<SendResult>
setOptions()
Section titled “setOptions()”setOptions(options): void;Defined in: react/src/client.ts:355
A new transport or changed settings, for what comes next. initialMessages is read once,
when the client is made.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
options |
ChatClientOptions |
Returns
Section titled “Returns”void
startClientTool()
Section titled “startClientTool()”startClientTool(requestId): Promise<RespondResult>;Defined in: react/src/client.ts:348
Explicit user action only. Never wire this to an effect or a replay listener. After a result delivery failure, this resubmits the saved result, never reruns the handler.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
requestId |
string |
Returns
Section titled “Returns”Promise<RespondResult>
stop()
Section titled “stop()”stop(): Promise<CommandResult>;Defined in: react/src/client.ts:343
Asks the host to stop the run, then waits for it to say so, with the observation still
open. Without transport.stop, closes the stream the run lives in and marks it stopped here.
Returns
Section titled “Returns”Promise<CommandResult>
subscribe()
Section titled “subscribe()”subscribe(listener): () => void;Defined in: react/src/client.ts:323
Called after the state changed. What the host streams is batched to one call per frame.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
listener |
() => void |
Returns
Section titled “Returns”() => void