Decoded, structured read model of a Program.
A file, image, audio, video or text payload referenced by a message.
Kind of binary or textual payload referenced by a message.
A structured error decoded from a program.
Error details accepted by appendErrorBlock.
One instruction: an opcode plus its payload.
The payload an instruction carries. kind selects the variant.
Role of a message turn.
Instruction range covering one message, from MSG_START to MSG_END.
The numeric value of any Opcode member.
A conversation encoded as instructions plus the buffers they reference.
An attachment together with where it sits in the program.
A decoded message turn.
A single event decoded from a streaming program.
A block of model reasoning attached to a message.
A tool declared to the model by a program.
A tool call emitted by the model.
The result of a tool call, fed back to the model.
Transport details that help interpret a provider error body.
A provider wire format supported by this package.
Role accepted by the text message builders.
Instruction range covering one thinking block.
A tool call decoded into its transport-level fields.
Instruction range covering one tool call.
Instruction range covering one tool definition.
A completed tool call and its result, recorded as one exchange.
Instruction range covering one tool result.
A single rule violation found by validateProgram.
Machine-readable reason a program failed validation.
Which rule set to validate against: a complete program or a stream chunk.
Options accepted by validateProgram.
Outcome of validateProgram.
The instruction set every program is built from.
Appends an assistant message to a program.
Appends an attachment to the end of a program.
Adds an attachment to an existing message.
Appends a structured error to a program.
Appends instructions to the end of a program.
Declares a tool the model may call.
Appends a tool call and its result as one exchange.
Appends a user message to a program.
Deep-copies one instruction, including any JSON payload it carries.
Deep-copies a program, including its instructions and buffers.
Creates a program holding a single text message.
Creates an empty program targeting a model.
Creates a program.
Creates a program holding a single assistant tool call.
Creates a program holding a single tool result turn.
Decodes an attachment stored in a program buffer.
Decodes a program from its protobuf wire form.
Renders the error carried by a program in a provider's error format.
Renders a program as a provider request body.
Renders a program as a provider response body.
Renders a chunk program in a provider's streaming format.
Encodes a program to its protobuf wire form.
Decodes every attachment carried by a program.
Concatenates the visible text of every message in a program.
Reads the text of a single message.
Reads model reasoning text.
Decodes every tool call emitted by a program.
Decodes every error block carried by a program.
Locates every message in a program.
Lists the positions of every instruction using an opcode.
Locates every thinking block in a program.
Locates every tool call emitted in a program.
Locates every tool definition declared by a program.
Locates every tool result carried by a program.
Maps an attachment kind to the opcode that carries it.
Reads why the model stopped generating.
Reads the first error carried by a program.
Reads the role of the last message in a program.
Reads the model a program targets.
Renders an opcode as its symbolic name, for logs and error messages.
Reads the provider usage payload attached to a response.
Reports whether a program carries an opcode.
Inserts instructions after a position.
Inserts instructions before a position.
Reports whether an opcode carries an attachment reference.
Reports whether a program asked for a streamed response.
Parses a provider error body into a program carrying an error block.
Parses a provider request body into a program.
Parses a provider response body into a program.
Parses one streamed provider chunk into a program.
Puts a system message in front of a program's conversation.
Removes instructions by position.
Removes an inclusive range of instructions.
Replaces an inclusive range of instructions.
Replaces a single instruction.
Sets the model a program targets, replacing any existing selection.
Turns streaming on or off for a program.
Checks a program against the instruction-set rules.
Provider-agnostic representation of an LLM conversation.
A Program is a list of instructions plus the buffers they reference. Requests, responses and streaming chunks from every supported provider parse into the same shape, so routing, editing and re-emitting are ordinary data transformations rather than per-provider special cases.
Exports follow one naming scheme:
create*builds a new programparse*/emit*convert between a provider wire format and a programencode*/decode*convert between a program and its protobuf formget*reads a single value,find*locates spans,extract*pulls out textis*/has*are predicatesappend*,prepend*,insert*,remove*,replace*,set*return an edited copy, never mutating the inputdeltanamespaceThis package deliberately stops at the protocol: executors, tool loops and HTTP routing belong to
@neutrome/lilsdk.Example