Skip to main content

RunStreamState

@retinue/monorepo


@retinue/monorepo / backend/src / RunStreamState

Type Alias: RunStreamState

RunStreamState = object

Defined in: backend/src/core/events.ts:266

The deterministic projection of a run's event stream: the assistant message parts plus the accounting/interaction state a client needs to render. It is a pure fold over RunEvents, so the server (worker checkpoint) and any client rebuild identical state from the same events — the single source of truth that makes reconnect produce no missing or duplicated parts.

Properties​

connectionRequest?​

readonly optional connectionRequest?: object

Defined in: backend/src/core/events.ts:284

Present while the run is waiting for somebody to connect a provider — task #264.

On the stream state rather than as a message part, because it is not a thing the model said: it is the platform telling a client this run is stopped and here is the way to unstick it. Cleared by connection.completed, so a client that reconnects mid-consent still sees the button and one that reconnects after it does not.

expiresAt​

readonly expiresAt: string

loginUrl​

readonly loginUrl: string

provider​

readonly provider: string

scopes​

readonly scopes: readonly string[]

toolName?​

readonly optional toolName?: string


error?​

readonly optional error?: PlatformError

Defined in: backend/src/core/events.ts:275


lastEventType?​

readonly optional lastEventType?: RunEventType

Defined in: backend/src/core/events.ts:272


parts​

readonly parts: readonly MessagePart[]

Defined in: backend/src/core/events.ts:267


pendingToolCalls​

readonly pendingToolCalls: readonly StreamPendingToolCall[]

Defined in: backend/src/core/events.ts:268


retry?​

readonly optional retry?: object

Defined in: backend/src/core/events.ts:274

Present between retry attempts, cleared as soon as the run makes progress again.

attempt​

readonly attempt: number

maxAttempts​

readonly maxAttempts: number

nextAttemptAt​

readonly nextAttemptAt: string


sequence​

readonly sequence: number

Defined in: backend/src/core/events.ts:271

Highest sequence folded in. Use as the reconnect cursor.


terminal​

readonly terminal: boolean

Defined in: backend/src/core/events.ts:291


usage​

readonly usage: object

Defined in: backend/src/core/events.ts:269

costMinorUnits​

readonly costMinorUnits: number

inputTokens​

readonly inputTokens: number

outputTokens​

readonly outputTokens: number