Expand description
Messages stored in sessions and sent to providers.
Mirrors packages/ai/src/types.ts and packages/coding-agent/src/core/messages.ts
in pi v1.0.0. Fields are declared in the order pi’s providers and agent loop
build them; see the crate docs for why existing files are not re-serialized from
these types.
Structs§
- Assistant
Message - A model response. Providers append
responseIdand the fields after it once the response arrives, so they followtimestamp. - Bash
Execution Message - Output of a user
!command. - Branch
Summary Message - Compaction
Summary Message - Cost
- Cost in US dollars.
- Custom
Message - Deferred
Handle - Handle to a response the provider finishes later.
- Image
Content - Nested
Tool Call - Nested
Tool Calls - Bounded record of the tool calls a tool made, for example from a codemode script.
- System
Message - System prompt state at one point in the transcript. The first system message is the prompt; later ones patch it.
- Text
Content - Thinking
Content - Tool
Call - Tool
Declaration - A tool as declared to the model.
- Tool
Reference - A tool referenced by name.
- Tool
Result Message - Result of one tool call.
nestedCallsis attached after the result is built, so it followstimestamp. - Usage
- Token usage and cost of one request.
- User
Message
Enums§
- Content
- Message content: plain text or a list of blocks.
- Content
Block - A content block, tagged by
type. Which kinds a role allows follows pi’s types: assistants use text, thinking and tool calls; users and tool results use text and images. - Message
- A message in a session or agent context, tagged by
role. - Nested
Tool Call Status - Stop
Reason - Thinking
Level - pi thinking level, from
offtomax, ordered by effort.
Functions§
- blocks_
text - The text blocks of
blocksjoined byseparator.