Skip to content

OffloadedBlock

Defined in: src/types/messages.ts:325

Experimental

The text a context-manager strategy left in place of content it offloaded, recording what that content was.

A text block to every reader of agent.messages and to every model provider — type stays 'textBlock', since the content really is text — so only code that cares about the provenance narrows to it with instanceof.

new OffloadedBlock(data): OffloadedBlock;

Defined in: src/types/messages.ts:342

Experimental

ParameterType
dataOffloadedBlockData

OffloadedBlock

TextBlock.constructor

readonly type: "textBlock";

Defined in: src/types/messages.ts:263

Experimental

Discriminator for text content.

TextBlock.type


readonly text: string;

Defined in: src/types/messages.ts:268

Experimental

Plain text content.

OffloadedBlockData.text

TextBlock.text


readonly method: OffloadMethod;

Defined in: src/types/messages.ts:329

Experimental

Offload method that left the placeholder.

OffloadedBlockData.method


readonly ref?: string;

Defined in: src/types/messages.ts:334

Experimental

Stash reference under which the original is retrievable; absent when it was not stashed.

OffloadedBlockData.ref


readonly tokens?: number;

Defined in: src/types/messages.ts:340

Experimental

Size of the content this placeholder stands for, in tokens, including any placeholder it replaced; absent when the token count could not measure it.

OffloadedBlockData.tokens

toJSON(): TextBlockData & {
offloaded: Omit<OffloadedBlockData, "text">;
};

Defined in: src/types/messages.ts:356

Experimental

Serializes the OffloadedBlock to a JSON-compatible object, with its provenance under offloaded. Called automatically by JSON.stringify().

One key holds the provenance so a text block’s own data keeps the rest of the namespace, and so the presence of that key alone decides whether stored data is a placeholder.

TextBlockData & { offloaded: Omit<OffloadedBlockData, "text">; }

TextBlock.toJSON


static fromJSON(data): OffloadedBlock;

Defined in: src/types/messages.ts:373

Experimental

Creates an OffloadedBlock instance from its serialized form.

ParameterTypeDescription
dataTextBlockData & { offloaded: Omit<OffloadedBlockData, "text">; }Serialized placeholder to deserialize

OffloadedBlock

OffloadedBlock instance

TextBlock.fromJSON