Skip to content
providerkit
GitHub

ChatValue

Defined in: react/src/hooks.ts:29

Everything a view of the conversation draws. A new object only when something in it moved.

canReconnect: boolean;

Defined in: react/src/client.ts:267

The connection is lost and the transport can observe, so reconnect can work.

ChatState.canReconnect


canRetry: boolean;

Defined in: react/src/client.ts:262

retry can send a message whose delivery is unknown now. False while a run is going (unless allowSendWhileRunning), even when steering keeps canSend true: sending it again into a running one could ask for the same work twice. Also false until the host has said where its run stands since the delivery became unknown, because the message may have started a run nobody reported yet. Show Retry on a message only when this is true and messageErrors has it.

ChatState.canRetry


canSend: boolean;

Defined in: react/src/client.ts:255

ChatState.canSend


canStop: boolean;

Defined in: react/src/client.ts:265

A stop can reach the run: the transport has stop, or the client can abort its pending command or reply stream, or keep a message whose copy is still being saved from going out.

ChatState.canStop


connection: ConnectionStatus;

Defined in: react/src/client.ts:244

ChatState.connection


discard: (messageId) => CommandResult;

Defined in: react/src/hooks.ts:34

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.

Parameter Type
messageId string

CommandResult


optional error?: DisplayError;

Defined in: react/src/client.ts:247

What went wrong that is not about one message or one request: the connection, or a stop that did not go through.

ChatState.error


inputs: readonly InputView[];

Defined in: react/src/client.ts:251

User input delivery, never completed assistant output.

ChatState.inputs


messageErrors: Readonly<Record<string, DisplayError>>;

Defined in: react/src/client.ts:254

By message id: why a message this client sent shows as failed. unconfirmed means it may not have arrived, and retry sends it again.

ChatState.messageErrors


messages: readonly DisplayMessage[];

Defined in: react/src/client.ts:241

The host’s messages and this client’s own, in order. A message this client sent shows as sending while its call is out, settled once the host took it, and failed when that is unknown (see messageErrors), until the host’s own copy takes its place.

ChatState.messages


recallInput: (inputId) => Promise<CommandResult>;

Defined in: react/src/hooks.ts:36

Manual recall through a host that can fence the race with input acceptance.

Parameter Type
inputId string

Promise<CommandResult>


reconnect: () => void;

Defined in: react/src/hooks.ts:39

Opens a fresh observation, with a full budget of tries, after the connection was lost.

void


requests: readonly RequestView[];

Defined in: react/src/client.ts:249

Every request that is waiting, in reading order.

ChatState.requests


respond: Respond;

Defined in: react/src/hooks.ts:38


retry: (messageId) => Promise<SendResult>;

Defined in: react/src/hooks.ts:33

Sends a message whose outcome is unknown again, with the same clientId. Nothing else ever sends a message twice.

Parameter Type
messageId string

Promise<SendResult>


run: RunInfo;

Defined in: react/src/client.ts:242

ChatState.run


optional scopeKey?: string;

Defined in: react/src/hooks.ts:31

Local view identity, not sent to the host. Request cards use it to discard another scope’s drafts.


send: (input) => Promise<SendResult>;

Defined in: react/src/hooks.ts:32

Parameter Type
input | string | MessageInput

Promise<SendResult>


startClientTool: (requestId) => Promise<RespondResult>;

Defined in: react/src/hooks.ts:35

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.

Parameter Type
requestId string

Promise<RespondResult>


status: ChatStatus;

Defined in: react/src/client.ts:243

ChatState.status


stop: () => Promise<CommandResult>;

Defined in: react/src/hooks.ts:37

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.

Promise<CommandResult>