Documentation
¶
Overview ¶
Package wsapi holds Peen's generated WebSocket contract types, decoded and validated from api/asyncapi.yaml.
Index ¶
- Constants
- type AgentRunAnswer
- type AgentRunAnswerData
- type AgentRunAssistantMessage
- type AgentRunAssistantMessageData
- type AgentRunAssistantMessageEvent
- type AgentRunCancelled
- type AgentRunCancelledData
- type AgentRunCompleted
- type AgentRunCompletedData
- type AgentRunDefinition
- type AgentRunFailed
- type AgentRunFailedData
- type AgentRunFailureClassification
- type AgentRunInboxMessage
- type AgentRunMessageDelivered
- type AgentRunMessageDeliveredData
- type AgentRunMessageInjected
- type AgentRunMessageInjectedData
- type AgentRunMessageInjectedEvent
- type AgentRunMessageInjectedType
- type AgentRunMessageQueued
- type AgentRunMessageQueuedData
- type AgentRunMessageUndelivered
- type AgentRunMessageUndeliveredData
- type AgentRunProviderRetry
- type AgentRunProviderRetryData
- type AgentRunQuestion
- type AgentRunQuestionData
- type AgentRunStarted
- type AgentRunStartedData
- type AgentRunStartedEvent
- type AgentRunTerminalEvent
- type AgentRunTerminalState
- type AgentRunTextDelta
- type AgentRunTextDeltaData
- type AgentRunThinkingDelta
- type AgentRunThinkingDeltaData
- type AgentRunToolCall
- type AgentRunToolResult
- type AgentRunToolResultData
- type AgentRunToolUse
- type AgentRunToolUseData
- type ContentBlock
- func (v ContentBlock) AsContentBlockTextStart() (ContentBlockTextStart, error)
- func (v ContentBlock) AsContentBlockThinkingStart() (ContentBlockThinkingStart, error)
- func (v ContentBlock) AsContentBlockToolResultStart() (ContentBlockToolResultStart, error)
- func (v ContentBlock) AsContentBlockToolUseStart() (ContentBlockToolUseStart, error)
- func (v ContentBlock) Discriminator() (string, error)
- func (v *ContentBlock) FromContentBlockTextStart(value ContentBlockTextStart) error
- func (v *ContentBlock) FromContentBlockThinkingStart(value ContentBlockThinkingStart) error
- func (v *ContentBlock) FromContentBlockToolResultStart(value ContentBlockToolResultStart) error
- func (v *ContentBlock) FromContentBlockToolUseStart(value ContentBlockToolUseStart) error
- func (v ContentBlock) MarshalJSON() ([]byte, error)
- func (v *ContentBlock) UnmarshalJSON(data []byte) error
- func (v ContentBlock) Validate() error
- func (v ContentBlock) Value() (any, error)
- type ContentBlockDelta
- type ContentBlockDeltaData
- type ContentBlockStart
- type ContentBlockStartData
- type ContentBlockStop
- type ContentBlockStopData
- type ContentBlockTextStart
- type ContentBlockThinkingStart
- type ContentBlockToolResultStart
- type ContentBlockToolUseStart
- type Delta
- func (v Delta) AsInputJSONDelta() (InputJSONDelta, error)
- func (v Delta) AsJSONPartialDelta() (JSONPartialDelta, error)
- func (v Delta) AsTextDelta() (TextDelta, error)
- func (v Delta) AsThinkingDelta() (ThinkingDelta, error)
- func (v Delta) Discriminator() (string, error)
- func (v *Delta) FromInputJSONDelta(value InputJSONDelta) error
- func (v *Delta) FromJSONPartialDelta(value JSONPartialDelta) error
- func (v *Delta) FromTextDelta(value TextDelta) error
- func (v *Delta) FromThinkingDelta(value ThinkingDelta) error
- func (v Delta) MarshalJSON() ([]byte, error)
- func (v *Delta) UnmarshalJSON(data []byte) error
- func (v Delta) Validate() error
- func (v Delta) Value() (any, error)
- type HarnessWarning
- type HarnessWarningData
- type HarnessWarningItem
- type HarnessWarningKind
- type InputJSONDelta
- type JSONPartialDelta
- type McpPrompt
- type McpPromptArgument
- type McpServerFeature
- type McpServerInfo
- type McpServerSource
- type McpServerState
- type McpServerStatus
- type McpServerTransport
- type McpStatus
- type McpStatusData
- type MessageCompleted
- type MessageCompletedData
- type MessageFailed
- type MessageFailedCode
- type MessageFailedData
- type MessageImage
- type MessageImageMediaType
- type MessageSend
- type MessageSendData
- type MessageSendReasoningEffort
- type MessageSystemPrompt
- type MessageSystemPromptMode
- type Metadata
- type Notice
- type NoticeCreated
- type NoticeDelivery
- type Part
- type PartType
- type ProviderRetry
- type ProviderRetryEvent
- type ProviderRetryReason
- type QuestionAnswered
- type QuestionAnsweredEvent
- type QuestionAsked
- type QuestionAskedEvent
- type ServerEvent
- func (v ServerEvent) AsAgentRunAnswer() (AgentRunAnswer, error)
- func (v ServerEvent) AsAgentRunAssistantMessage() (AgentRunAssistantMessage, error)
- func (v ServerEvent) AsAgentRunCancelled() (AgentRunCancelled, error)
- func (v ServerEvent) AsAgentRunCompleted() (AgentRunCompleted, error)
- func (v ServerEvent) AsAgentRunFailed() (AgentRunFailed, error)
- func (v ServerEvent) AsAgentRunMessageDelivered() (AgentRunMessageDelivered, error)
- func (v ServerEvent) AsAgentRunMessageInjected() (AgentRunMessageInjected, error)
- func (v ServerEvent) AsAgentRunMessageQueued() (AgentRunMessageQueued, error)
- func (v ServerEvent) AsAgentRunMessageUndelivered() (AgentRunMessageUndelivered, error)
- func (v ServerEvent) AsAgentRunProviderRetry() (AgentRunProviderRetry, error)
- func (v ServerEvent) AsAgentRunQuestion() (AgentRunQuestion, error)
- func (v ServerEvent) AsAgentRunStarted() (AgentRunStarted, error)
- func (v ServerEvent) AsAgentRunTextDelta() (AgentRunTextDelta, error)
- func (v ServerEvent) AsAgentRunThinkingDelta() (AgentRunThinkingDelta, error)
- func (v ServerEvent) AsAgentRunToolResult() (AgentRunToolResult, error)
- func (v ServerEvent) AsAgentRunToolUse() (AgentRunToolUse, error)
- func (v ServerEvent) AsContentBlockDelta() (ContentBlockDelta, error)
- func (v ServerEvent) AsContentBlockStart() (ContentBlockStart, error)
- func (v ServerEvent) AsContentBlockStop() (ContentBlockStop, error)
- func (v ServerEvent) AsHarnessWarning() (HarnessWarning, error)
- func (v ServerEvent) AsMcpStatus() (McpStatus, error)
- func (v ServerEvent) AsMessageCompleted() (MessageCompleted, error)
- func (v ServerEvent) AsMessageFailed() (MessageFailed, error)
- func (v ServerEvent) AsNoticeCreated() (NoticeCreated, error)
- func (v ServerEvent) AsProviderRetryEvent() (ProviderRetryEvent, error)
- func (v ServerEvent) AsQuestionAnsweredEvent() (QuestionAnsweredEvent, error)
- func (v ServerEvent) AsQuestionAskedEvent() (QuestionAskedEvent, error)
- func (v ServerEvent) AsSessionEvents() (SessionEvents, error)
- func (v ServerEvent) AsSkillInjected() (SkillInjected, error)
- func (v ServerEvent) AsToolResultEvent() (ToolResultEvent, error)
- func (v ServerEvent) AsToolUseEvent() (ToolUseEvent, error)
- func (v ServerEvent) AsTurnCancelled() (TurnCancelled, error)
- func (v ServerEvent) AsTurnCompleted() (TurnCompleted, error)
- func (v ServerEvent) AsTurnFailed() (TurnFailed, error)
- func (v ServerEvent) AsTurnStarted() (TurnStarted, error)
- func (v ServerEvent) AsUserMessageCreated() (UserMessageCreated, error)
- func (v ServerEvent) AsUserMessageDelivered() (UserMessageDelivered, error)
- func (v ServerEvent) AsUserMessageQueued() (UserMessageQueued, error)
- func (v ServerEvent) Discriminator() (string, error)
- func (v *ServerEvent) FromAgentRunAnswer(value AgentRunAnswer) error
- func (v *ServerEvent) FromAgentRunAssistantMessage(value AgentRunAssistantMessage) error
- func (v *ServerEvent) FromAgentRunCancelled(value AgentRunCancelled) error
- func (v *ServerEvent) FromAgentRunCompleted(value AgentRunCompleted) error
- func (v *ServerEvent) FromAgentRunFailed(value AgentRunFailed) error
- func (v *ServerEvent) FromAgentRunMessageDelivered(value AgentRunMessageDelivered) error
- func (v *ServerEvent) FromAgentRunMessageInjected(value AgentRunMessageInjected) error
- func (v *ServerEvent) FromAgentRunMessageQueued(value AgentRunMessageQueued) error
- func (v *ServerEvent) FromAgentRunMessageUndelivered(value AgentRunMessageUndelivered) error
- func (v *ServerEvent) FromAgentRunProviderRetry(value AgentRunProviderRetry) error
- func (v *ServerEvent) FromAgentRunQuestion(value AgentRunQuestion) error
- func (v *ServerEvent) FromAgentRunStarted(value AgentRunStarted) error
- func (v *ServerEvent) FromAgentRunTextDelta(value AgentRunTextDelta) error
- func (v *ServerEvent) FromAgentRunThinkingDelta(value AgentRunThinkingDelta) error
- func (v *ServerEvent) FromAgentRunToolResult(value AgentRunToolResult) error
- func (v *ServerEvent) FromAgentRunToolUse(value AgentRunToolUse) error
- func (v *ServerEvent) FromContentBlockDelta(value ContentBlockDelta) error
- func (v *ServerEvent) FromContentBlockStart(value ContentBlockStart) error
- func (v *ServerEvent) FromContentBlockStop(value ContentBlockStop) error
- func (v *ServerEvent) FromHarnessWarning(value HarnessWarning) error
- func (v *ServerEvent) FromMcpStatus(value McpStatus) error
- func (v *ServerEvent) FromMessageCompleted(value MessageCompleted) error
- func (v *ServerEvent) FromMessageFailed(value MessageFailed) error
- func (v *ServerEvent) FromNoticeCreated(value NoticeCreated) error
- func (v *ServerEvent) FromProviderRetryEvent(value ProviderRetryEvent) error
- func (v *ServerEvent) FromQuestionAnsweredEvent(value QuestionAnsweredEvent) error
- func (v *ServerEvent) FromQuestionAskedEvent(value QuestionAskedEvent) error
- func (v *ServerEvent) FromSessionEvents(value SessionEvents) error
- func (v *ServerEvent) FromSkillInjected(value SkillInjected) error
- func (v *ServerEvent) FromToolResultEvent(value ToolResultEvent) error
- func (v *ServerEvent) FromToolUseEvent(value ToolUseEvent) error
- func (v *ServerEvent) FromTurnCancelled(value TurnCancelled) error
- func (v *ServerEvent) FromTurnCompleted(value TurnCompleted) error
- func (v *ServerEvent) FromTurnFailed(value TurnFailed) error
- func (v *ServerEvent) FromTurnStarted(value TurnStarted) error
- func (v *ServerEvent) FromUserMessageCreated(value UserMessageCreated) error
- func (v *ServerEvent) FromUserMessageDelivered(value UserMessageDelivered) error
- func (v *ServerEvent) FromUserMessageQueued(value UserMessageQueued) error
- func (v ServerEvent) MarshalJSON() ([]byte, error)
- func (v *ServerEvent) UnmarshalJSON(data []byte) error
- func (v ServerEvent) Validate() error
- func (v ServerEvent) Value() (any, error)
- type SessionEvents
- type SessionEventsData
- type SessionNotice
- type SessionNoticeDelivery
- type SkillInjected
- type SkillInjectedData
- type TextDelta
- type TextPayload
- type ThinkingDelta
- type ToolResult
- type ToolResultEvent
- type ToolUse
- type ToolUseEvent
- type TurnCancelled
- type TurnCancelledData
- type TurnCancelledDataReason
- type TurnCompleted
- type TurnCompletedData
- type TurnFailed
- type TurnFailedData
- type TurnStarted
- type TurnStartedData
- type UserMessage
- type UserMessageCreated
- type UserMessageDelivered
- type UserMessageImage
- type UserMessageQueued
Constants ¶
const ( // Send a message to a session, its running turn, or one of its child agents. // Payload: MessageSend. MessageSocketMessageSend = "socket_messageSend" // A frame the server sends: a sequenced session frame or an acknowledgement. // Payload: ServerEvent. MessageSocketServerEvent = "socket_serverEvent" )
Message names, as the spec gives them.
const (
// A controller on the local machine at its default port. `PEEN_HTTP_LISTEN_ADDRESS` sets the address, `:8080` by default. Replace the host with your deployment's and use `wss://` behind TLS. Offer the `peen.v1` subprotocol, and, when `PEEN_API_TOKEN` is set, authenticate with an `Authorization: Bearer` header or the `peen.bearer.<base64url-token>` subprotocol. An optional `?sessionId=<uuid>` filters the socket's frames to one session; without it the socket receives every session's frames.
ServerPeenURL = "ws://127.0.0.1:8080/ws/v1"
)
Server URLs, with any server variables at their defaults.
const SocketAddressTemplate = "/ws/v1"
SocketAddressTemplate is the address of the Socket channel.
The one WebSocket at `/ws/v1`. Clients send `message.send` frames and receive server frames for every session they watch, or for the one session named by `?sessionId=`.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AgentRunAnswer ¶
type AgentRunAnswer struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.answer`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.answer` frame. `event` is `{answered, callId?}`, with the same `callId` as the question it closes.
Data AgentRunAnswerData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The child's `ask` ended: a message answered it, or it timed out (`answered: false`). Sent after the matching `agent.run.question` and before the `ask` call's `agent.run.tool.result`. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunAnswer) MarshalJSON ¶
func (v AgentRunAnswer) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunAnswer with its const properties filled in.
func (*AgentRunAnswer) UnmarshalJSON ¶
func (v *AgentRunAnswer) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunAnswer strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunAnswer) Validate ¶
func (v AgentRunAnswer) Validate() error
Validate checks the constraints the schema declares for AgentRunAnswer.
type AgentRunAnswerData ¶
type AgentRunAnswerData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// The end of an `ask` call. It is the `data` of a root `question.answered` frame and the `event` of a child's `agent.run.answer` frame. It carries no answer text: the answer is the message that reached the agent.
Event QuestionAnswered `json:"event"`
}
The `data` of an `agent.run.answer` frame. `event` is `{answered, callId?}`, with the same `callId` as the question it closes.
func (*AgentRunAnswerData) UnmarshalJSON ¶
func (v *AgentRunAnswerData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunAnswerData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunAnswerData) Validate ¶
func (v AgentRunAnswerData) Validate() error
Validate checks the constraints the schema declares for AgentRunAnswerData.
type AgentRunAssistantMessage ¶
type AgentRunAssistantMessage struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.assistant.message`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.assistant.message` frame. `event` is an `AgentRunAssistantMessageEvent`.
Data AgentRunAssistantMessageData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
A child's model finished one reply. Sent once per model round, after that round's text and thinking fragments and before the `agent.run.tool.use` frames for the calls it requested. The same reply is stored in the child's transcript. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunAssistantMessage) MarshalJSON ¶
func (v AgentRunAssistantMessage) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunAssistantMessage with its const properties filled in.
func (*AgentRunAssistantMessage) UnmarshalJSON ¶
func (v *AgentRunAssistantMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunAssistantMessage strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunAssistantMessage) Validate ¶
func (v AgentRunAssistantMessage) Validate() error
Validate checks the constraints the schema declares for AgentRunAssistantMessage.
type AgentRunAssistantMessageData ¶
type AgentRunAssistantMessageData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// The `event` of an `agent.run.assistant.message` frame: one complete reply from the child's model for one model round, with its text, reasoning, and requested tool calls.
Event AgentRunAssistantMessageEvent `json:"event"`
}
The `data` of an `agent.run.assistant.message` frame. `event` is an `AgentRunAssistantMessageEvent`.
func (*AgentRunAssistantMessageData) UnmarshalJSON ¶
func (v *AgentRunAssistantMessageData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunAssistantMessageData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunAssistantMessageData) Validate ¶
func (v AgentRunAssistantMessageData) Validate() error
Validate checks the constraints the schema declares for AgentRunAssistantMessageData.
type AgentRunAssistantMessageEvent ¶
type AgentRunAssistantMessageEvent struct {
// Always `assistant`.
Role string `json:"role"`
// The reply's content parts, in order. An empty array when the reply had no text, for example when it only called tools.
Content []Part `json:"content"`
// The tool calls the reply requested, in order. An empty array when it requested none.
ToolCalls []AgentRunToolCall `json:"toolCalls"`
// The reasoning text the model streamed in readable form, the same text as the round's `agent.run.thinking.delta` fragments joined. Absent when there was none.
Reasoning *string `json:"reasoning,omitempty"`
// The provider's own reasoning record for this reply, such as signed or encrypted reasoning blocks, kept as an opaque JSON object so it can be sent back to the same provider on later requests. Its shape belongs to the provider. Absent when the provider returned none.
ProviderReasoning map[string]any `json:"providerReasoning,omitempty"`
// Where the message came from in the model layer. A reply from a model round is `turn`. Absent when unset.
Origin *string `json:"origin,omitempty"`
}
The `event` of an `agent.run.assistant.message` frame: one complete reply from the child's model for one model round, with its text, reasoning, and requested tool calls.
func (*AgentRunAssistantMessageEvent) UnmarshalJSON ¶
func (v *AgentRunAssistantMessageEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunAssistantMessageEvent strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunAssistantMessageEvent) Validate ¶
func (v AgentRunAssistantMessageEvent) Validate() error
Validate checks the constraints the schema declares for AgentRunAssistantMessageEvent.
type AgentRunCancelled ¶
type AgentRunCancelled struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.cancelled`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.cancelled` frame. `event` is an `AgentRunTerminalEvent` with `state` `cancelled`.
Data AgentRunCancelledData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The child run was stopped. Always the run's last frame; any tool call it left running is closed first by an `agent.run.tool.result` with `isError` set. A child of the root conversation also reports through an `agent.failed` notice with `state` `cancelled`. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunCancelled) MarshalJSON ¶
func (v AgentRunCancelled) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunCancelled with its const properties filled in.
func (*AgentRunCancelled) UnmarshalJSON ¶
func (v *AgentRunCancelled) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunCancelled strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunCancelled) Validate ¶
func (v AgentRunCancelled) Validate() error
Validate checks the constraints the schema declares for AgentRunCancelled.
type AgentRunCancelledData ¶
type AgentRunCancelledData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// The `event` of an `agent.run.completed`, `agent.run.failed`, or `agent.run.cancelled` frame: how the child run ended.
Event AgentRunTerminalEvent `json:"event"`
}
The `data` of an `agent.run.cancelled` frame. `event` is an `AgentRunTerminalEvent` with `state` `cancelled`.
func (*AgentRunCancelledData) UnmarshalJSON ¶
func (v *AgentRunCancelledData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunCancelledData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunCancelledData) Validate ¶
func (v AgentRunCancelledData) Validate() error
Validate checks the constraints the schema declares for AgentRunCancelledData.
type AgentRunCompleted ¶
type AgentRunCompleted struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.completed`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.completed` frame. `event` is an `AgentRunTerminalEvent` with `state` `completed`.
Data AgentRunCompletedData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The child run gave its final answer and ended. Always the run's last frame: Peen stores nothing for a run after its terminal frame. A child of the root conversation also reports through an `agent.finished` notice, sent as its own `notice.created` frame. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunCompleted) MarshalJSON ¶
func (v AgentRunCompleted) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunCompleted with its const properties filled in.
func (*AgentRunCompleted) UnmarshalJSON ¶
func (v *AgentRunCompleted) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunCompleted strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunCompleted) Validate ¶
func (v AgentRunCompleted) Validate() error
Validate checks the constraints the schema declares for AgentRunCompleted.
type AgentRunCompletedData ¶
type AgentRunCompletedData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// The `event` of an `agent.run.completed`, `agent.run.failed`, or `agent.run.cancelled` frame: how the child run ended.
Event AgentRunTerminalEvent `json:"event"`
}
The `data` of an `agent.run.completed` frame. `event` is an `AgentRunTerminalEvent` with `state` `completed`.
func (*AgentRunCompletedData) UnmarshalJSON ¶
func (v *AgentRunCompletedData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunCompletedData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunCompletedData) Validate ¶
func (v AgentRunCompletedData) Validate() error
Validate checks the constraints the schema declares for AgentRunCompletedData.
type AgentRunDefinition ¶
type AgentRunDefinition string
Where the child's instructions came from:
- `stored`: the child is an agent from the workspace's agent catalogue, named with `launchAgent`'s `agent`. - `ad-hoc`: the child was defined inline with `launchAgent`'s `agentDefinition`. Its instructions are never written to disk.
const ( AgentRunDefinitionStored AgentRunDefinition = "stored" AgentRunDefinitionAdHoc AgentRunDefinition = "ad-hoc" )
Values of AgentRunDefinition.
func (AgentRunDefinition) Validate ¶
func (v AgentRunDefinition) Validate() error
Validate reports whether v is one of the values the schema lists.
type AgentRunFailed ¶
type AgentRunFailed struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.failed`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.failed` frame. `event` is an `AgentRunTerminalEvent` with `state` `failed`.
Data AgentRunFailedData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The child run stopped on an error. Always the run's last frame. A child of the root conversation also reports through an `agent.failed` notice. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunFailed) MarshalJSON ¶
func (v AgentRunFailed) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunFailed with its const properties filled in.
func (*AgentRunFailed) UnmarshalJSON ¶
func (v *AgentRunFailed) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunFailed strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunFailed) Validate ¶
func (v AgentRunFailed) Validate() error
Validate checks the constraints the schema declares for AgentRunFailed.
type AgentRunFailedData ¶
type AgentRunFailedData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// The `event` of an `agent.run.completed`, `agent.run.failed`, or `agent.run.cancelled` frame: how the child run ended.
Event AgentRunTerminalEvent `json:"event"`
}
The `data` of an `agent.run.failed` frame. `event` is an `AgentRunTerminalEvent` with `state` `failed`.
func (*AgentRunFailedData) UnmarshalJSON ¶
func (v *AgentRunFailedData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunFailedData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunFailedData) Validate ¶
func (v AgentRunFailedData) Validate() error
Validate checks the constraints the schema declares for AgentRunFailedData.
type AgentRunFailureClassification ¶
type AgentRunFailureClassification string
Why the run did not complete. Absent for a completed run.
- `agentRun`: the run failed. - `cancelled`: the run was stopped, including a run that a restart had interrupted before it was cancelled. - `interrupted`: appears only in `agent.run.cancelled` events stored before v0.52.0, for a run that a restart interrupted before it was cancelled. Treat it as `cancelled`. Peen no longer sends it.
const ( AgentRunFailureClassificationAgentRun AgentRunFailureClassification = "agentRun" AgentRunFailureClassificationCancelled AgentRunFailureClassification = "cancelled" AgentRunFailureClassificationInterrupted AgentRunFailureClassification = "interrupted" )
Values of AgentRunFailureClassification.
func (AgentRunFailureClassification) Validate ¶
func (v AgentRunFailureClassification) Validate() error
Validate reports whether v is one of the values the schema lists.
type AgentRunInboxMessage ¶
type AgentRunInboxMessage struct {
// The message as the child reads it. A message from the user or another agent is wrapped in the `<message>` block that names its sender.
Message string `json:"message"`
// Links one message's queued step to its delivered or undelivered step. Absent on events stored before Peen recorded it.
//
// Not enforced by the generated code: format uuid.
AcceptanceID *string `json:"acceptanceId,omitempty"`
}
A message accepted into a child agent's inbox: from the user through `message.send` with `to`, from another agent, or from Peen itself, such as a child's report to its parent, a session notice copied to running children, or the note that resumes a paused child. It is the `event` of `agent.run.message.queued`, `agent.run.message.delivered`, and `agent.run.message.undelivered`.
func (*AgentRunInboxMessage) UnmarshalJSON ¶
func (v *AgentRunInboxMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunInboxMessage strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunInboxMessage) Validate ¶
func (v AgentRunInboxMessage) Validate() error
Validate checks the constraints the schema declares for AgentRunInboxMessage.
type AgentRunMessageDelivered ¶
type AgentRunMessageDelivered struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.message.delivered`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.message.delivered` frame. `event` is `{message, acceptanceId?}`, with the same `acceptanceId` as the message's `agent.run.message.queued` frame.
Data AgentRunMessageDeliveredData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
A queued message reached the child's model. Sent when the model takes the message at the start of a model round, after the message is stored in the child's transcript. Follows the message's `agent.run.message.queued`. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunMessageDelivered) MarshalJSON ¶
func (v AgentRunMessageDelivered) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunMessageDelivered with its const properties filled in.
func (*AgentRunMessageDelivered) UnmarshalJSON ¶
func (v *AgentRunMessageDelivered) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunMessageDelivered strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunMessageDelivered) Validate ¶
func (v AgentRunMessageDelivered) Validate() error
Validate checks the constraints the schema declares for AgentRunMessageDelivered.
type AgentRunMessageDeliveredData ¶
type AgentRunMessageDeliveredData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// A message accepted into a child agent's inbox: from the user through `message.send` with `to`, from another agent, or from Peen itself, such as a child's report to its parent, a session notice copied to running children, or the note that resumes a paused child. It is the `event` of `agent.run.message.queued`, `agent.run.message.delivered`, and `agent.run.message.undelivered`.
Event AgentRunInboxMessage `json:"event"`
}
The `data` of an `agent.run.message.delivered` frame. `event` is `{message, acceptanceId?}`, with the same `acceptanceId` as the message's `agent.run.message.queued` frame.
func (*AgentRunMessageDeliveredData) UnmarshalJSON ¶
func (v *AgentRunMessageDeliveredData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunMessageDeliveredData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunMessageDeliveredData) Validate ¶
func (v AgentRunMessageDeliveredData) Validate() error
Validate checks the constraints the schema declares for AgentRunMessageDeliveredData.
type AgentRunMessageInjected ¶
type AgentRunMessageInjected struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.message.injected`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.message.injected` frame. `event` is an `AgentRunMessageInjectedEvent`.
Data AgentRunMessageInjectedData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
Peen added a message to a child's conversation around one of its tool calls. Sent after that call's `agent.run.tool.result`. The message is stored in the child's transcript. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunMessageInjected) MarshalJSON ¶
func (v AgentRunMessageInjected) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunMessageInjected with its const properties filled in.
func (*AgentRunMessageInjected) UnmarshalJSON ¶
func (v *AgentRunMessageInjected) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunMessageInjected strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunMessageInjected) Validate ¶
func (v AgentRunMessageInjected) Validate() error
Validate checks the constraints the schema declares for AgentRunMessageInjected.
type AgentRunMessageInjectedData ¶
type AgentRunMessageInjectedData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// The `event` of an `agent.run.message.injected` frame: a message Peen added to the child's conversation around one tool call, such as context a tool hook returned.
Event AgentRunMessageInjectedEvent `json:"event"`
}
The `data` of an `agent.run.message.injected` frame. `event` is an `AgentRunMessageInjectedEvent`.
func (*AgentRunMessageInjectedData) UnmarshalJSON ¶
func (v *AgentRunMessageInjectedData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunMessageInjectedData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunMessageInjectedData) Validate ¶
func (v AgentRunMessageInjectedData) Validate() error
Validate checks the constraints the schema declares for AgentRunMessageInjectedData.
type AgentRunMessageInjectedEvent ¶
type AgentRunMessageInjectedEvent struct {
// The role the added message takes in the conversation:
//
// - `user`: the message is added as a user message.
// - `assistant`: the message is added as an assistant message.
Type AgentRunMessageInjectedType `json:"type"`
// The added message's text, exactly as the model receives it.
Content string `json:"content"`
// The point in the tool call at which the message was added: `pre_run`, `on_success`, `on_error`, or `post_run`.
Phase string `json:"phase"`
// The name of the tool whose call the message belongs to.
Tool string `json:"tool"`
// The ID of that tool call, matching `callId` on its `agent.run.tool.use` and `agent.run.tool.result`.
CallID string `json:"callId"`
// The model round of that tool call, counted from 0.
Round int64 `json:"round"`
}
The `event` of an `agent.run.message.injected` frame: a message Peen added to the child's conversation around one tool call, such as context a tool hook returned.
func (*AgentRunMessageInjectedEvent) UnmarshalJSON ¶
func (v *AgentRunMessageInjectedEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunMessageInjectedEvent strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunMessageInjectedEvent) Validate ¶
func (v AgentRunMessageInjectedEvent) Validate() error
Validate checks the constraints the schema declares for AgentRunMessageInjectedEvent.
type AgentRunMessageInjectedType ¶
type AgentRunMessageInjectedType string
The role the added message takes in the conversation:
- `user`: the message is added as a user message. - `assistant`: the message is added as an assistant message.
const ( AgentRunMessageInjectedTypeUser AgentRunMessageInjectedType = "user" AgentRunMessageInjectedTypeAssistant AgentRunMessageInjectedType = "assistant" )
Values of AgentRunMessageInjectedType.
func (AgentRunMessageInjectedType) Validate ¶
func (v AgentRunMessageInjectedType) Validate() error
Validate reports whether v is one of the values the schema lists.
type AgentRunMessageQueued ¶
type AgentRunMessageQueued struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.message.queued`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.message.queued` frame. `event` is `{message, acceptanceId?}`: the message as the child will read it, and the ID that links it to its later delivered or undelivered frame.
Data AgentRunMessageQueuedData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
A message was accepted into a running or paused child's inbox: a `message.send` with `to`, another agent's `sendMessage`, a child's report or question to a parent that is itself a child, a session notice Peen copies to running children, or the resume note Peen queues ahead of a message that resumes a paused child. The child reads it after its current tool call, and `agent.run.message.delivered` or `agent.run.message.undelivered` with the same `acceptanceId` follows. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunMessageQueued) MarshalJSON ¶
func (v AgentRunMessageQueued) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunMessageQueued with its const properties filled in.
func (*AgentRunMessageQueued) UnmarshalJSON ¶
func (v *AgentRunMessageQueued) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunMessageQueued strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunMessageQueued) Validate ¶
func (v AgentRunMessageQueued) Validate() error
Validate checks the constraints the schema declares for AgentRunMessageQueued.
type AgentRunMessageQueuedData ¶
type AgentRunMessageQueuedData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// A message accepted into a child agent's inbox: from the user through `message.send` with `to`, from another agent, or from Peen itself, such as a child's report to its parent, a session notice copied to running children, or the note that resumes a paused child. It is the `event` of `agent.run.message.queued`, `agent.run.message.delivered`, and `agent.run.message.undelivered`.
Event AgentRunInboxMessage `json:"event"`
}
The `data` of an `agent.run.message.queued` frame. `event` is `{message, acceptanceId?}`: the message as the child will read it, and the ID that links it to its later delivered or undelivered frame.
func (*AgentRunMessageQueuedData) UnmarshalJSON ¶
func (v *AgentRunMessageQueuedData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunMessageQueuedData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunMessageQueuedData) Validate ¶
func (v AgentRunMessageQueuedData) Validate() error
Validate checks the constraints the schema declares for AgentRunMessageQueuedData.
type AgentRunMessageUndelivered ¶
type AgentRunMessageUndelivered struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.message.undelivered`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.message.undelivered` frame. `event` is `{message, acceptanceId?}`, with the same `acceptanceId` as the message's `agent.run.message.queued` frame.
Data AgentRunMessageUndeliveredData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The child ended before reading a queued message. Sent once per message still unread when the child ends, whether it completed, failed, or was cancelled, before the run's terminal frame. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunMessageUndelivered) MarshalJSON ¶
func (v AgentRunMessageUndelivered) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunMessageUndelivered with its const properties filled in.
func (*AgentRunMessageUndelivered) UnmarshalJSON ¶
func (v *AgentRunMessageUndelivered) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunMessageUndelivered strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunMessageUndelivered) Validate ¶
func (v AgentRunMessageUndelivered) Validate() error
Validate checks the constraints the schema declares for AgentRunMessageUndelivered.
type AgentRunMessageUndeliveredData ¶
type AgentRunMessageUndeliveredData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// A message accepted into a child agent's inbox: from the user through `message.send` with `to`, from another agent, or from Peen itself, such as a child's report to its parent, a session notice copied to running children, or the note that resumes a paused child. It is the `event` of `agent.run.message.queued`, `agent.run.message.delivered`, and `agent.run.message.undelivered`.
Event AgentRunInboxMessage `json:"event"`
}
The `data` of an `agent.run.message.undelivered` frame. `event` is `{message, acceptanceId?}`, with the same `acceptanceId` as the message's `agent.run.message.queued` frame.
func (*AgentRunMessageUndeliveredData) UnmarshalJSON ¶
func (v *AgentRunMessageUndeliveredData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunMessageUndeliveredData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunMessageUndeliveredData) Validate ¶
func (v AgentRunMessageUndeliveredData) Validate() error
Validate checks the constraints the schema declares for AgentRunMessageUndeliveredData.
type AgentRunProviderRetry ¶
type AgentRunProviderRetry struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.provider.retry`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.provider.retry` frame. `event` is `{attempt, reason, status, delayMs}`: the attempt that failed and how long Peen waits before the next one.
Data AgentRunProviderRetryData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
A child's model request failed with an error worth retrying, and Peen will retry it after `event.delayMs`. Sent before the wait, once per failed attempt that is retried; a final failed attempt that is not retried sends no frame. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunProviderRetry) MarshalJSON ¶
func (v AgentRunProviderRetry) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunProviderRetry with its const properties filled in.
func (*AgentRunProviderRetry) UnmarshalJSON ¶
func (v *AgentRunProviderRetry) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunProviderRetry strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunProviderRetry) Validate ¶
func (v AgentRunProviderRetry) Validate() error
Validate checks the constraints the schema declares for AgentRunProviderRetry.
type AgentRunProviderRetryData ¶
type AgentRunProviderRetryData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// One failed provider request that Peen is about to retry. It is the `data` of a root `provider.retry` frame and the `event` of a child's `agent.run.provider.retry` frame. Peen sends it before it waits, so `delayMs` is the wait still ahead. Only retryable failures (rate limits, server errors, timeouts, and broken connections) produce it; a failure Peen does not retry ends the turn instead.
Event ProviderRetry `json:"event"`
}
The `data` of an `agent.run.provider.retry` frame. `event` is `{attempt, reason, status, delayMs}`: the attempt that failed and how long Peen waits before the next one.
func (*AgentRunProviderRetryData) UnmarshalJSON ¶
func (v *AgentRunProviderRetryData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunProviderRetryData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunProviderRetryData) Validate ¶
func (v AgentRunProviderRetryData) Validate() error
Validate checks the constraints the schema declares for AgentRunProviderRetryData.
type AgentRunQuestion ¶
type AgentRunQuestion struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.question`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.question` frame. `event` is `{question, callId?}`: the question text and the ID of the child's `ask` call.
Data AgentRunQuestionData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The child asked its parent a question with `ask` and now waits for a message. Sent after the `ask` call's `agent.run.tool.use`, when Peen hands the question to the parent. Answer it with a `message.send` whose `to` is the run's ID, or the parent answers with `sendMessage`. The run reports `waiting` until the matching `agent.run.answer`. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunQuestion) MarshalJSON ¶
func (v AgentRunQuestion) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunQuestion with its const properties filled in.
func (*AgentRunQuestion) UnmarshalJSON ¶
func (v *AgentRunQuestion) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunQuestion strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunQuestion) Validate ¶
func (v AgentRunQuestion) Validate() error
Validate checks the constraints the schema declares for AgentRunQuestion.
type AgentRunQuestionData ¶
type AgentRunQuestionData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// A question an agent asked with the `ask` tool, or a question an MCP server asked the user while one of its calls ran. It is the `data` of a root `question.asked` frame and the `event` of a child's `agent.run.question` frame. The agent or server waits until a message reaches it or the question times out. For the root conversation, your next message is the answer. An MCP server's question names the server and quotes its text, lists the fields it asks for, and takes a JSON object, the bare value of a one-field form, `decline`, or `cancel`.
Event QuestionAsked `json:"event"`
}
The `data` of an `agent.run.question` frame. `event` is `{question, callId?}`: the question text and the ID of the child's `ask` call.
func (*AgentRunQuestionData) UnmarshalJSON ¶
func (v *AgentRunQuestionData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunQuestionData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunQuestionData) Validate ¶
func (v AgentRunQuestionData) Validate() error
Validate checks the constraints the schema declares for AgentRunQuestionData.
type AgentRunStarted ¶
type AgentRunStarted struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.started`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.started` frame. `event` is an `AgentRunStartedEvent` describing the new child.
Data AgentRunStartedData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
A child agent run started. Sent once per run, after Peen records the run and its task and before the child's first model request, so it is the first frame of every run. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunStarted) MarshalJSON ¶
func (v AgentRunStarted) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunStarted with its const properties filled in.
func (*AgentRunStarted) UnmarshalJSON ¶
func (v *AgentRunStarted) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunStarted strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunStarted) Validate ¶
func (v AgentRunStarted) Validate() error
Validate checks the constraints the schema declares for AgentRunStarted.
type AgentRunStartedData ¶
type AgentRunStartedData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// The `event` of an `agent.run.started` frame: who the new child is and where it runs. It repeats the identity fields of the frame's `data`.
Event AgentRunStartedEvent `json:"event"`
}
The `data` of an `agent.run.started` frame. `event` is an `AgentRunStartedEvent` describing the new child.
func (*AgentRunStartedData) UnmarshalJSON ¶
func (v *AgentRunStartedData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunStartedData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunStartedData) Validate ¶
func (v AgentRunStartedData) Validate() error
Validate checks the constraints the schema declares for AgentRunStartedData.
type AgentRunStartedEvent ¶
type AgentRunStartedEvent struct {
// The new child agent run's ID.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from, the same as the frame's `data.parentTurnId`.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// The agent's name: the stored agent's name as the agent catalogue lists it, such as `reviewer` or `core:general-purpose`, or the `name` of an inline definition.
Name string `json:"name"`
// Where the child's instructions came from:
//
// - `stored`: the child is an agent from the workspace's agent catalogue, named with `launchAgent`'s `agent`.
// - `ad-hoc`: the child was defined inline with `launchAgent`'s `agentDefinition`. Its instructions are never written to disk.
Definition AgentRunDefinition `json:"definition"`
// How deeply the run is nested. A child of the root conversation has depth 1 and its own children depth 2. `PEEN_MAX_CHILD_AGENT_DEPTH` (5 by default) caps it.
Depth int64 `json:"depth"`
// The model the child runs on, in the `provider/model` form that `GET /api/v1/models` lists as `name`.
Model string `json:"model"`
// The directory the child's tool calls start in.
Workspace string `json:"workspace"`
}
The `event` of an `agent.run.started` frame: who the new child is and where it runs. It repeats the identity fields of the frame's `data`.
func (*AgentRunStartedEvent) UnmarshalJSON ¶
func (v *AgentRunStartedEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunStartedEvent strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunStartedEvent) Validate ¶
func (v AgentRunStartedEvent) Validate() error
Validate checks the constraints the schema declares for AgentRunStartedEvent.
type AgentRunTerminalEvent ¶
type AgentRunTerminalEvent struct {
// The run that ended, the same as the frame's `data.agentRunId`.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// How the run ended. It always matches the frame type.
//
// - `completed`: the child gave its final answer. `GET /api/v1/session/agents/{agentRunId}` returns it as `responseText`.
// - `failed`: the child stopped on an error, such as a provider failure or a round or token limit.
// - `cancelled`: something stopped the child: `stopAgent`, `POST /api/v1/session/agents/{agentRunId}/cancel`, the Stop control, the cancellation of an ancestor run, or the turn deadline.
State AgentRunTerminalState `json:"state"`
// Why the run did not complete. Absent for a completed run.
//
// - `agentRun`: the run failed.
// - `cancelled`: the run was stopped, including a run that a restart had interrupted before it was cancelled.
// - `interrupted`: appears only in `agent.run.cancelled` events stored before v0.52.0, for a run that a restart interrupted before it was cancelled. Treat it as `cancelled`. Peen no longer sends it.
FailureClassification *AgentRunFailureClassification `json:"failureClassification,omitempty"`
// Free text. The error the run ended with, written for people and not a stable contract. Absent for a completed run.
FailureDetail *string `json:"failureDetail,omitempty"`
}
The `event` of an `agent.run.completed`, `agent.run.failed`, or `agent.run.cancelled` frame: how the child run ended.
func (*AgentRunTerminalEvent) UnmarshalJSON ¶
func (v *AgentRunTerminalEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunTerminalEvent strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunTerminalEvent) Validate ¶
func (v AgentRunTerminalEvent) Validate() error
Validate checks the constraints the schema declares for AgentRunTerminalEvent.
type AgentRunTerminalState ¶
type AgentRunTerminalState string
How the run ended. It always matches the frame type.
- `completed`: the child gave its final answer. `GET /api/v1/session/agents/{agentRunId}` returns it as `responseText`. - `failed`: the child stopped on an error, such as a provider failure or a round or token limit. - `cancelled`: something stopped the child: `stopAgent`, `POST /api/v1/session/agents/{agentRunId}/cancel`, the Stop control, the cancellation of an ancestor run, or the turn deadline.
const ( AgentRunTerminalStateCompleted AgentRunTerminalState = "completed" AgentRunTerminalStateFailed AgentRunTerminalState = "failed" AgentRunTerminalStateCancelled AgentRunTerminalState = "cancelled" )
Values of AgentRunTerminalState.
func (AgentRunTerminalState) Validate ¶
func (v AgentRunTerminalState) Validate() error
Validate reports whether v is one of the values the schema lists.
type AgentRunTextDelta ¶
type AgentRunTextDelta struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.text.delta`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.text.delta` frame. `event` is `{text}`, one fragment of the child's reply text.
Data AgentRunTextDeltaData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
One fragment of a child's reply text as the model streams it. Append the fragments of a run in sequence order to show the reply live. Every fragment is stored as its own record. A model round's fragments precede that round's `agent.run.assistant.message`, which holds the assembled reply; use that frame as the final text. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunTextDelta) MarshalJSON ¶
func (v AgentRunTextDelta) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunTextDelta with its const properties filled in.
func (*AgentRunTextDelta) UnmarshalJSON ¶
func (v *AgentRunTextDelta) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunTextDelta strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunTextDelta) Validate ¶
func (v AgentRunTextDelta) Validate() error
Validate checks the constraints the schema declares for AgentRunTextDelta.
type AgentRunTextDeltaData ¶
type AgentRunTextDeltaData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// One streamed fragment of a child agent's reply. It is the `event` of `agent.run.text.delta` and `agent.run.thinking.delta`.
Event TextPayload `json:"event"`
}
The `data` of an `agent.run.text.delta` frame. `event` is `{text}`, one fragment of the child's reply text.
func (*AgentRunTextDeltaData) UnmarshalJSON ¶
func (v *AgentRunTextDeltaData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunTextDeltaData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunTextDeltaData) Validate ¶
func (v AgentRunTextDeltaData) Validate() error
Validate checks the constraints the schema declares for AgentRunTextDeltaData.
type AgentRunThinkingDelta ¶
type AgentRunThinkingDelta struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.thinking.delta`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.thinking.delta` frame. `event` is `{text}`, one fragment of the child's reasoning.
Data AgentRunThinkingDeltaData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
One fragment of a child's reasoning, sent only for models that stream readable reasoning. A model round's fragments precede that round's `agent.run.assistant.message`, whose `reasoning` holds the whole text. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunThinkingDelta) MarshalJSON ¶
func (v AgentRunThinkingDelta) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunThinkingDelta with its const properties filled in.
func (*AgentRunThinkingDelta) UnmarshalJSON ¶
func (v *AgentRunThinkingDelta) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunThinkingDelta strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunThinkingDelta) Validate ¶
func (v AgentRunThinkingDelta) Validate() error
Validate checks the constraints the schema declares for AgentRunThinkingDelta.
type AgentRunThinkingDeltaData ¶
type AgentRunThinkingDeltaData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// One streamed fragment of a child agent's reply. It is the `event` of `agent.run.text.delta` and `agent.run.thinking.delta`.
Event TextPayload `json:"event"`
}
The `data` of an `agent.run.thinking.delta` frame. `event` is `{text}`, one fragment of the child's reasoning.
func (*AgentRunThinkingDeltaData) UnmarshalJSON ¶
func (v *AgentRunThinkingDeltaData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunThinkingDeltaData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunThinkingDeltaData) Validate ¶
func (v AgentRunThinkingDeltaData) Validate() error
Validate checks the constraints the schema declares for AgentRunThinkingDeltaData.
type AgentRunToolCall ¶
type AgentRunToolCall struct {
// The call ID the provider assigned. The run's `agent.run.tool.use` and `agent.run.tool.result` for this call carry it as `callId`.
ID string `json:"id"`
// The name of the tool the model called.
Name string `json:"name"`
// Open. The tool's own arguments, shaped by that tool, exactly as the provider returned them; null when the provider sent none.
Arguments map[string]any `json:"arguments"`
}
One tool call a child's assistant message requested, inside `toolCalls` of an `agent.run.assistant.message` frame.
func (*AgentRunToolCall) UnmarshalJSON ¶
func (v *AgentRunToolCall) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunToolCall strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunToolCall) Validate ¶
func (v AgentRunToolCall) Validate() error
Validate checks the constraints the schema declares for AgentRunToolCall.
type AgentRunToolResult ¶
type AgentRunToolResult struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.tool.result`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.tool.result` frame. `event` is `{callId, name, content, isError}`: the result the child's model receives for one tool call.
Data AgentRunToolResultData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
A child's tool call finished. Sent once for every `agent.run.tool.use`, matched by `event.callId`. When a child is stopped while a call runs, Peen closes that call with `isError` set and the text "The tool call was stopped before it returned a result. Its effect is unknown." before the run's `agent.run.cancelled`. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunToolResult) MarshalJSON ¶
func (v AgentRunToolResult) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunToolResult with its const properties filled in.
func (*AgentRunToolResult) UnmarshalJSON ¶
func (v *AgentRunToolResult) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunToolResult strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunToolResult) Validate ¶
func (v AgentRunToolResult) Validate() error
Validate checks the constraints the schema declares for AgentRunToolResult.
type AgentRunToolResultData ¶
type AgentRunToolResultData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// The outcome of one tool call. It is the `data` of a root `tool.result` frame and the `event` of a child's `agent.run.tool.result` frame. Every `tool.use` gets exactly one result, even when its turn is stopped or fails while the call runs.
Event ToolResult `json:"event"`
}
The `data` of an `agent.run.tool.result` frame. `event` is `{callId, name, content, isError}`: the result the child's model receives for one tool call.
func (*AgentRunToolResultData) UnmarshalJSON ¶
func (v *AgentRunToolResultData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunToolResultData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunToolResultData) Validate ¶
func (v AgentRunToolResultData) Validate() error
Validate checks the constraints the schema declares for AgentRunToolResultData.
type AgentRunToolUse ¶
type AgentRunToolUse struct {
// The ID of the stored child event this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `agent.run.tool.use`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `agent.run.tool.use` frame. `event` is `{callId, name, arguments}`: the tool call the child's model asked for.
Data AgentRunToolUseData `json:"data"`
// When Peen stored the child event, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Group a child run's frames by `data.agentRunId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
A child's tool call is about to run. Sent once per call, after the `agent.run.assistant.message` that requested it and before the call's `agent.run.tool.result`. `event.callId` equals the `id` of the matching entry in that assistant message's `toolCalls`. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data. Its `metadata` carries `sessionId` and `sequence` but never `requestId`.
func (AgentRunToolUse) MarshalJSON ¶
func (v AgentRunToolUse) MarshalJSON() ([]byte, error)
MarshalJSON encodes AgentRunToolUse with its const properties filled in.
func (*AgentRunToolUse) UnmarshalJSON ¶
func (v *AgentRunToolUse) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunToolUse strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunToolUse) Validate ¶
func (v AgentRunToolUse) Validate() error
Validate checks the constraints the schema declares for AgentRunToolUse.
type AgentRunToolUseData ¶
type AgentRunToolUseData struct {
// The child agent run this step belongs to. Group a run's frames by this ID; `GET /api/v1/session/agents/{agentRunId}` returns the run record.
//
// Not enforced by the generated code: format uuid.
AgentRunID string `json:"agentRunId"`
// The root turn the run descends from: the turn in which the root conversation launched this run, or launched its top-level ancestor. Every run in one tree shares it, and a run can keep going after that turn ends.
//
// Not enforced by the generated code: format uuid.
ParentTurnID string `json:"parentTurnId"`
// The agent run that launched this one. Absent when the session's root conversation launched it.
//
// Not enforced by the generated code: format uuid.
ParentAgentRunID *string `json:"parentAgentRunId,omitempty"`
// One tool call the model requested. It is the `data` of a root `tool.use` frame and the `event` of a child's `agent.run.tool.use` frame.
Event ToolUse `json:"event"`
}
The `data` of an `agent.run.tool.use` frame. `event` is `{callId, name, arguments}`: the tool call the child's model asked for.
func (*AgentRunToolUseData) UnmarshalJSON ¶
func (v *AgentRunToolUseData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes AgentRunToolUseData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (AgentRunToolUseData) Validate ¶
func (v AgentRunToolUseData) Validate() error
Validate checks the constraints the schema declares for AgentRunToolUseData.
type ContentBlock ¶
type ContentBlock struct {
// contains filtered or unexported fields
}
The block being opened. `type` selects the shape: `text`, `thinking`, `tool_use`, or `tool_result`. ContentBlock holds one of several shapes. Set it with the From methods and read it with Value or the As methods.
func (ContentBlock) AsContentBlockTextStart ¶
func (v ContentBlock) AsContentBlockTextStart() (ContentBlockTextStart, error)
AsContentBlockTextStart decodes the held value as a ContentBlockTextStart.
func (ContentBlock) AsContentBlockThinkingStart ¶
func (v ContentBlock) AsContentBlockThinkingStart() (ContentBlockThinkingStart, error)
AsContentBlockThinkingStart decodes the held value as a ContentBlockThinkingStart.
func (ContentBlock) AsContentBlockToolResultStart ¶
func (v ContentBlock) AsContentBlockToolResultStart() (ContentBlockToolResultStart, error)
AsContentBlockToolResultStart decodes the held value as a ContentBlockToolResultStart.
func (ContentBlock) AsContentBlockToolUseStart ¶
func (v ContentBlock) AsContentBlockToolUseStart() (ContentBlockToolUseStart, error)
AsContentBlockToolUseStart decodes the held value as a ContentBlockToolUseStart.
func (ContentBlock) Discriminator ¶
func (v ContentBlock) Discriminator() (string, error)
Discriminator returns the "type" property that selects the variant.
func (*ContentBlock) FromContentBlockTextStart ¶
func (v *ContentBlock) FromContentBlockTextStart(value ContentBlockTextStart) error
FromContentBlockTextStart sets the held value to a ContentBlockTextStart.
func (*ContentBlock) FromContentBlockThinkingStart ¶
func (v *ContentBlock) FromContentBlockThinkingStart(value ContentBlockThinkingStart) error
FromContentBlockThinkingStart sets the held value to a ContentBlockThinkingStart.
func (*ContentBlock) FromContentBlockToolResultStart ¶
func (v *ContentBlock) FromContentBlockToolResultStart(value ContentBlockToolResultStart) error
FromContentBlockToolResultStart sets the held value to a ContentBlockToolResultStart.
func (*ContentBlock) FromContentBlockToolUseStart ¶
func (v *ContentBlock) FromContentBlockToolUseStart(value ContentBlockToolUseStart) error
FromContentBlockToolUseStart sets the held value to a ContentBlockToolUseStart.
func (ContentBlock) MarshalJSON ¶
func (v ContentBlock) MarshalJSON() ([]byte, error)
MarshalJSON encodes the held value.
func (*ContentBlock) UnmarshalJSON ¶
func (v *ContentBlock) UnmarshalJSON(data []byte) error
UnmarshalJSON stores data after checking that it is exactly one variant.
func (ContentBlock) Validate ¶
func (v ContentBlock) Validate() error
Validate checks that the held value is a valid variant.
func (ContentBlock) Value ¶
func (v ContentBlock) Value() (any, error)
Value decodes the held value as the variant its discriminator selects.
type ContentBlockDelta ¶
type ContentBlockDelta struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `content_block_delta`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of a `content_block_delta` frame, shaped like the Anthropic Messages stream event of the same name.
Data ContentBlockDeltaData `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
Appends to open content block `data.index`. To render a live reply, fold a turn's deltas in arrival order: append `text_delta` and `thinking_delta` text to their block, and attach each tool block to its call. Peen writes deltas in short batches, so they can arrive in bursts. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (ContentBlockDelta) MarshalJSON ¶
func (v ContentBlockDelta) MarshalJSON() ([]byte, error)
MarshalJSON encodes ContentBlockDelta with its const properties filled in.
func (*ContentBlockDelta) UnmarshalJSON ¶
func (v *ContentBlockDelta) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ContentBlockDelta strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ContentBlockDelta) Validate ¶
func (v ContentBlockDelta) Validate() error
Validate checks the constraints the schema declares for ContentBlockDelta.
type ContentBlockDeltaData ¶
type ContentBlockDeltaData struct {
// Always `content_block_delta`, the same as the frame's `type`.
Type string `json:"type"`
// The index of the open block this delta appends to.
Index int64 `json:"index"`
// The fragment to append. `type` selects the shape: `text_delta`, `thinking_delta`, `input_json_delta`, or `json_partial`.
Delta Delta `json:"delta"`
}
The `data` of a `content_block_delta` frame, shaped like the Anthropic Messages stream event of the same name.
func (ContentBlockDeltaData) MarshalJSON ¶
func (v ContentBlockDeltaData) MarshalJSON() ([]byte, error)
MarshalJSON encodes ContentBlockDeltaData with its const properties filled in.
func (*ContentBlockDeltaData) UnmarshalJSON ¶
func (v *ContentBlockDeltaData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ContentBlockDeltaData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ContentBlockDeltaData) Validate ¶
func (v ContentBlockDeltaData) Validate() error
Validate checks the constraints the schema declares for ContentBlockDeltaData.
type ContentBlockStart ¶
type ContentBlockStart struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `content_block_start`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of a `content_block_start` frame, shaped like the Anthropic Messages stream event of the same name. Field names stay snake_case because Peen does not own this format.
Data ContentBlockStartData `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
Opens content block `data.index` of the model's reply. Peen emits it as the model streams. Text and thinking blocks open on their first fragment; tool blocks open when the call starts and when its result arrives. Deltas for the block follow, and a `content_block_stop` with the same index closes it. When a turn resumes after an interruption, Peen first closes any block the interruption left open. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (ContentBlockStart) MarshalJSON ¶
func (v ContentBlockStart) MarshalJSON() ([]byte, error)
MarshalJSON encodes ContentBlockStart with its const properties filled in.
func (*ContentBlockStart) UnmarshalJSON ¶
func (v *ContentBlockStart) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ContentBlockStart strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ContentBlockStart) Validate ¶
func (v ContentBlockStart) Validate() error
Validate checks the constraints the schema declares for ContentBlockStart.
type ContentBlockStartData ¶
type ContentBlockStartData struct {
// Always `content_block_start`, the same as the frame's `type`.
Type string `json:"type"`
// The block's index within the turn. Indexes start at 0 for each turn and never repeat inside it, so key blocks by `metadata.requestId` and `index`. After a round's thinking and text blocks, the round's tool calls take the next indexes in call order, and their result blocks take the indexes after those, so a result block's index is known before the result arrives.
Index int64 `json:"index"`
// The block being opened. `type` selects the shape: `text`, `thinking`, `tool_use`, or `tool_result`.
ContentBlock ContentBlock `json:"content_block"`
}
The `data` of a `content_block_start` frame, shaped like the Anthropic Messages stream event of the same name. Field names stay snake_case because Peen does not own this format.
func (ContentBlockStartData) MarshalJSON ¶
func (v ContentBlockStartData) MarshalJSON() ([]byte, error)
MarshalJSON encodes ContentBlockStartData with its const properties filled in.
func (*ContentBlockStartData) UnmarshalJSON ¶
func (v *ContentBlockStartData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ContentBlockStartData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ContentBlockStartData) Validate ¶
func (v ContentBlockStartData) Validate() error
Validate checks the constraints the schema declares for ContentBlockStartData.
type ContentBlockStop ¶
type ContentBlockStop struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `content_block_stop`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of a `content_block_stop` frame.
Data ContentBlockStopData `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
Closes content block `data.index`. No more deltas arrive for that index in this turn. When the turn ends, its messages are stored and `GET /api/v1/messages` returns the finished reply. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (ContentBlockStop) MarshalJSON ¶
func (v ContentBlockStop) MarshalJSON() ([]byte, error)
MarshalJSON encodes ContentBlockStop with its const properties filled in.
func (*ContentBlockStop) UnmarshalJSON ¶
func (v *ContentBlockStop) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ContentBlockStop strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ContentBlockStop) Validate ¶
func (v ContentBlockStop) Validate() error
Validate checks the constraints the schema declares for ContentBlockStop.
type ContentBlockStopData ¶
type ContentBlockStopData struct {
// Always `content_block_stop`, the same as the frame's `type`.
Type string `json:"type"`
// The index of the block that closed.
Index int64 `json:"index"`
}
The `data` of a `content_block_stop` frame.
func (ContentBlockStopData) MarshalJSON ¶
func (v ContentBlockStopData) MarshalJSON() ([]byte, error)
MarshalJSON encodes ContentBlockStopData with its const properties filled in.
func (*ContentBlockStopData) UnmarshalJSON ¶
func (v *ContentBlockStopData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ContentBlockStopData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ContentBlockStopData) Validate ¶
func (v ContentBlockStopData) Validate() error
Validate checks the constraints the schema declares for ContentBlockStopData.
type ContentBlockTextStart ¶
type ContentBlockTextStart struct {
// Always `text`.
Type string `json:"type"`
// Peen never sets this at block start.
Text *string `json:"text,omitempty"`
}
Opens a block of the model's reply text, in a `content_block_start` frame. Peen opens a text block only when the model writes text in that round, so it never sends an empty one.
func (ContentBlockTextStart) MarshalJSON ¶
func (v ContentBlockTextStart) MarshalJSON() ([]byte, error)
MarshalJSON encodes ContentBlockTextStart with its const properties filled in.
func (*ContentBlockTextStart) UnmarshalJSON ¶
func (v *ContentBlockTextStart) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ContentBlockTextStart strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ContentBlockTextStart) Validate ¶
func (v ContentBlockTextStart) Validate() error
Validate checks the constraints the schema declares for ContentBlockTextStart.
type ContentBlockThinkingStart ¶
type ContentBlockThinkingStart struct {
// Always `thinking`.
Type string `json:"type"`
// Peen never sets this at block start.
Text *string `json:"text,omitempty"`
}
Opens a block of the model's reasoning, in a `content_block_start` frame. A round's thinking block, when it has one, closes before that round's text block opens.
func (ContentBlockThinkingStart) MarshalJSON ¶
func (v ContentBlockThinkingStart) MarshalJSON() ([]byte, error)
MarshalJSON encodes ContentBlockThinkingStart with its const properties filled in.
func (*ContentBlockThinkingStart) UnmarshalJSON ¶
func (v *ContentBlockThinkingStart) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ContentBlockThinkingStart strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ContentBlockThinkingStart) Validate ¶
func (v ContentBlockThinkingStart) Validate() error
Validate checks the constraints the schema declares for ContentBlockThinkingStart.
type ContentBlockToolResultStart ¶
type ContentBlockToolResultStart struct {
// Always `tool_result`.
Type string `json:"type"`
// The `id` of the `tool_use` block this result answers.
ToolUseID string `json:"tool_use_id"`
// Present only when `true`.
IsError *bool `json:"is_error,omitempty"`
}
Opens the block for one tool call's result, in a `content_block_start` frame. One `json_partial` delta with the whole result text and a `content_block_stop` follow at once. Peen sends the root `tool.result` frame for the same call right before this block.
func (ContentBlockToolResultStart) MarshalJSON ¶
func (v ContentBlockToolResultStart) MarshalJSON() ([]byte, error)
MarshalJSON encodes ContentBlockToolResultStart with its const properties filled in.
func (*ContentBlockToolResultStart) UnmarshalJSON ¶
func (v *ContentBlockToolResultStart) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ContentBlockToolResultStart strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ContentBlockToolResultStart) Validate ¶
func (v ContentBlockToolResultStart) Validate() error
Validate checks the constraints the schema declares for ContentBlockToolResultStart.
type ContentBlockToolUseStart ¶
type ContentBlockToolUseStart struct {
// Always `tool_use`.
Type string `json:"type"`
// The tool call ID, the same as `callId` on the matching `tool.use` and `tool.result` frames. The `tool_result` block that answers this call carries it as `tool_use_id`.
ID string `json:"id"`
// The name of the tool the model called.
Name string `json:"name"`
// Open. Always `{}` at block start.
Input map[string]any `json:"input"`
}
Opens the block for one tool call the model made, in a `content_block_start` frame. One `input_json_delta` with the call's arguments and a `content_block_stop` follow at once. Peen sends the root `tool.use` frame for the same call right before this block.
func (ContentBlockToolUseStart) MarshalJSON ¶
func (v ContentBlockToolUseStart) MarshalJSON() ([]byte, error)
MarshalJSON encodes ContentBlockToolUseStart with its const properties filled in.
func (*ContentBlockToolUseStart) UnmarshalJSON ¶
func (v *ContentBlockToolUseStart) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ContentBlockToolUseStart strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ContentBlockToolUseStart) Validate ¶
func (v ContentBlockToolUseStart) Validate() error
Validate checks the constraints the schema declares for ContentBlockToolUseStart.
type Delta ¶
type Delta struct {
// contains filtered or unexported fields
}
The fragment to append. `type` selects the shape: `text_delta`, `thinking_delta`, `input_json_delta`, or `json_partial`. Delta holds one of several shapes. Set it with the From methods and read it with Value or the As methods.
func (Delta) AsInputJSONDelta ¶
func (v Delta) AsInputJSONDelta() (InputJSONDelta, error)
AsInputJSONDelta decodes the held value as a InputJSONDelta.
func (Delta) AsJSONPartialDelta ¶
func (v Delta) AsJSONPartialDelta() (JSONPartialDelta, error)
AsJSONPartialDelta decodes the held value as a JSONPartialDelta.
func (Delta) AsTextDelta ¶
AsTextDelta decodes the held value as a TextDelta.
func (Delta) AsThinkingDelta ¶
func (v Delta) AsThinkingDelta() (ThinkingDelta, error)
AsThinkingDelta decodes the held value as a ThinkingDelta.
func (Delta) Discriminator ¶
Discriminator returns the "type" property that selects the variant.
func (*Delta) FromInputJSONDelta ¶
func (v *Delta) FromInputJSONDelta(value InputJSONDelta) error
FromInputJSONDelta sets the held value to a InputJSONDelta.
func (*Delta) FromJSONPartialDelta ¶
func (v *Delta) FromJSONPartialDelta(value JSONPartialDelta) error
FromJSONPartialDelta sets the held value to a JSONPartialDelta.
func (*Delta) FromTextDelta ¶
FromTextDelta sets the held value to a TextDelta.
func (*Delta) FromThinkingDelta ¶
func (v *Delta) FromThinkingDelta(value ThinkingDelta) error
FromThinkingDelta sets the held value to a ThinkingDelta.
func (Delta) MarshalJSON ¶
MarshalJSON encodes the held value.
func (*Delta) UnmarshalJSON ¶
UnmarshalJSON stores data after checking that it is exactly one variant.
type HarnessWarning ¶
type HarnessWarning struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `harness.warning`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of a `harness.warning` frame.
Data HarnessWarningData `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
Peen ignored one or more invalid optional harness files and loaded the valid configuration around them. A bad optional file does not stop a turn, but a `:skill-name` reference to a skill Peen ignored still fails the message. Peen emits it at most once per turn, before `mcp.status` and `turn.started`, and only when there is something to report. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (HarnessWarning) MarshalJSON ¶
func (v HarnessWarning) MarshalJSON() ([]byte, error)
MarshalJSON encodes HarnessWarning with its const properties filled in.
func (*HarnessWarning) UnmarshalJSON ¶
func (v *HarnessWarning) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes HarnessWarning strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (HarnessWarning) Validate ¶
func (v HarnessWarning) Validate() error
Validate checks the constraints the schema declares for HarnessWarning.
type HarnessWarningData ¶
type HarnessWarningData struct {
// Every source Peen ignored for this turn, at least one.
Warnings []HarnessWarningItem `json:"warnings"`
}
The `data` of a `harness.warning` frame.
func (*HarnessWarningData) UnmarshalJSON ¶
func (v *HarnessWarningData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes HarnessWarningData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (HarnessWarningData) Validate ¶
func (v HarnessWarningData) Validate() error
Validate checks the constraints the schema declares for HarnessWarningData.
type HarnessWarningItem ¶
type HarnessWarningItem struct {
// What kind of source Peen ignored:
//
// - `instruction`: an `AGENTS.md` instruction file.
// - `rule`: a rule file in `.agents/rules`, or the learned rules directory.
// - `skill`: a skill in `.agents/skills`, or a skill that names a skill that does not exist.
// - `agent`: a named-agent document in `.agents/agents`.
// - `event-handler`: an event handler in `.agents/events`.
// - `hook`: a hook definition in `.agents/hooks.yaml`.
Kind HarnessWarningKind `json:"kind"`
// The path of the file or directory Peen ignored.
Source string `json:"source"`
// Free text naming what is wrong with this source.
Reason string `json:"reason"`
}
One harness source that Peen ignored, or a skill that names a skill that does not exist.
func (*HarnessWarningItem) UnmarshalJSON ¶
func (v *HarnessWarningItem) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes HarnessWarningItem strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (HarnessWarningItem) Validate ¶
func (v HarnessWarningItem) Validate() error
Validate checks the constraints the schema declares for HarnessWarningItem.
type HarnessWarningKind ¶
type HarnessWarningKind string
What kind of source Peen ignored:
- `instruction`: an `AGENTS.md` instruction file. - `rule`: a rule file in `.agents/rules`, or the learned rules directory. - `skill`: a skill in `.agents/skills`, or a skill that names a skill that does not exist. - `agent`: a named-agent document in `.agents/agents`. - `event-handler`: an event handler in `.agents/events`. - `hook`: a hook definition in `.agents/hooks.yaml`.
const ( HarnessWarningKindInstruction HarnessWarningKind = "instruction" HarnessWarningKindRule HarnessWarningKind = "rule" HarnessWarningKindSkill HarnessWarningKind = "skill" HarnessWarningKindAgent HarnessWarningKind = "agent" HarnessWarningKindEventHandler HarnessWarningKind = "event-handler" HarnessWarningKindHook HarnessWarningKind = "hook" )
Values of HarnessWarningKind.
func (HarnessWarningKind) Validate ¶
func (v HarnessWarningKind) Validate() error
Validate reports whether v is one of the values the schema lists.
type InputJSONDelta ¶
type InputJSONDelta struct {
// Always `input_json_delta`.
Type string `json:"type"`
// Free text. The tool call's arguments as the JSON text the provider returned. Peen sends the whole document here, though a client that concatenates every `input_json_delta` of a block gets the same result.
PartialJSON string `json:"partial_json"`
}
The arguments of a tool call, in the `content_block_delta` frame of a `tool_use` block. Peen sends the whole arguments document in one delta, so each `tool_use` block has exactly one.
func (InputJSONDelta) MarshalJSON ¶
func (v InputJSONDelta) MarshalJSON() ([]byte, error)
MarshalJSON encodes InputJSONDelta with its const properties filled in.
func (*InputJSONDelta) UnmarshalJSON ¶
func (v *InputJSONDelta) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes InputJSONDelta strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (InputJSONDelta) Validate ¶
func (v InputJSONDelta) Validate() error
Validate checks the constraints the schema declares for InputJSONDelta.
type JSONPartialDelta ¶
type JSONPartialDelta struct {
// Always `json_partial`.
Type string `json:"type"`
// Free text. The tool's result text, the same as `content` on the matching `tool.result` frame. It is not necessarily JSON.
Text string `json:"text"`
}
The result of a tool call, in the `content_block_delta` frame of a `tool_result` block. Peen sends the whole result in one delta, so each `tool_result` block has exactly one.
func (JSONPartialDelta) MarshalJSON ¶
func (v JSONPartialDelta) MarshalJSON() ([]byte, error)
MarshalJSON encodes JSONPartialDelta with its const properties filled in.
func (*JSONPartialDelta) UnmarshalJSON ¶
func (v *JSONPartialDelta) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes JSONPartialDelta strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (JSONPartialDelta) Validate ¶
func (v JSONPartialDelta) Validate() error
Validate checks the constraints the schema declares for JSONPartialDelta.
type McpPrompt ¶ added in v0.54.0
type McpPrompt struct {
// The prompt name to put after `/mcp:<server>:`.
Name string `json:"name"`
// The prompt's display name, cut to 256 bytes. Absent when it gave none.
Title *string `json:"title,omitempty"`
// What the prompt does, cut to 256 bytes. Absent when it gave none.
Description *string `json:"description,omitempty"`
// The arguments the prompt takes, each passed as `name=value`. Empty when it takes none.
Arguments []McpPromptArgument `json:"arguments"`
}
One prompt an MCP server offers. The server writes every field.
func (*McpPrompt) UnmarshalJSON ¶ added in v0.54.0
UnmarshalJSON decodes McpPrompt strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
type McpPromptArgument ¶ added in v0.54.0
type McpPromptArgument struct {
// The argument name.
Name string `json:"name"`
// What the argument holds, cut to 256 bytes. Absent when the server gave none.
Description *string `json:"description,omitempty"`
// Whether the prompt needs the argument.
Required bool `json:"required"`
}
One argument an MCP prompt takes.
func (*McpPromptArgument) UnmarshalJSON ¶ added in v0.54.0
func (v *McpPromptArgument) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes McpPromptArgument strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (McpPromptArgument) Validate ¶ added in v0.54.0
func (v McpPromptArgument) Validate() error
Validate checks the constraints the schema declares for McpPromptArgument.
type McpServerFeature ¶ added in v0.54.0
type McpServerFeature string
const ( McpServerFeatureTools McpServerFeature = "tools" McpServerFeatureResources McpServerFeature = "resources" McpServerFeatureResourceSubscribe McpServerFeature = "resourceSubscribe" McpServerFeaturePrompts McpServerFeature = "prompts" McpServerFeatureCompletions McpServerFeature = "completions" )
Values of McpServerFeature.
func (McpServerFeature) Validate ¶ added in v0.54.0
func (v McpServerFeature) Validate() error
Validate reports whether v is one of the values the schema lists.
type McpServerInfo ¶ added in v0.54.0
type McpServerInfo struct {
// The server implementation's name.
Name string `json:"name"`
// The server's display name. Absent when it gave none.
Title *string `json:"title,omitempty"`
// The server's version. Absent when it gave none.
Version *string `json:"version,omitempty"`
}
What the server says it is. The server writes every field, each cut to 128 bytes. Absent when the server gave no name.
func (*McpServerInfo) UnmarshalJSON ¶ added in v0.54.0
func (v *McpServerInfo) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes McpServerInfo strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (McpServerInfo) Validate ¶ added in v0.54.0
func (v McpServerInfo) Validate() error
Validate checks the constraints the schema declares for McpServerInfo.
type McpServerSource ¶ added in v0.38.0
type McpServerSource string
The layer whose `.agents/mcp.json` defines the server:
- `config`: `PEEN_CONFIG_DIR/.agents/mcp.json`, the deployment's configuration directory. - `workspace`: the session workspace's `.agents/mcp.json`, read only when `PEEN_WORKSPACE_MCP` is `true`. A workspace server never replaces a configuration directory server of the same name.
const ( McpServerSourceConfig McpServerSource = "config" McpServerSourceWorkspace McpServerSource = "workspace" )
Values of McpServerSource.
func (McpServerSource) Validate ¶ added in v0.38.0
func (v McpServerSource) Validate() error
Validate reports whether v is one of the values the schema lists.
type McpServerState ¶ added in v0.38.0
type McpServerState string
Whether the server started:
- `ready`: the server started and its tools are available to the model. - `failed`: the server, or its whole `mcp.json` file, could not be used. `error` says why.
const ( McpServerStateReady McpServerState = "ready" McpServerStateFailed McpServerState = "failed" )
Values of McpServerState.
func (McpServerState) Validate ¶ added in v0.38.0
func (v McpServerState) Validate() error
Validate reports whether v is one of the values the schema lists.
type McpServerStatus ¶ added in v0.38.0
type McpServerStatus struct {
// The server name from mcp.json. Empty when a whole mcp.json file was refused.
Name string `json:"name"`
// The layer whose `.agents/mcp.json` defines the server:
//
// - `config`: `PEEN_CONFIG_DIR/.agents/mcp.json`, the deployment's configuration directory.
// - `workspace`: the session workspace's `.agents/mcp.json`, read only when `PEEN_WORKSPACE_MCP` is `true`. A workspace server never replaces a configuration directory server of the same name.
Source McpServerSource `json:"source"`
// How Peen reaches the server. Absent when a whole `mcp.json` file was refused.
//
// - `stdio`: a local process Peen starts and talks to over standard input and output.
// - `http`: a remote server reached over Streamable HTTP.
Transport *McpServerTransport `json:"transport,omitempty"`
// Whether the server started:
//
// - `ready`: the server started and its tools are available to the model.
// - `failed`: the server, or its whole `mcp.json` file, could not be used. `error` says why.
State McpServerState `json:"state"`
// The names of the server's tools as the model sees them, `mcp__<server>__<tool>`. Empty when the server failed.
Tools []string `json:"tools"`
// Why the server failed. Absent when `state` is `ready`.
Error *string `json:"error,omitempty"`
// Problems that did not stop the server, such as an allowlisted tool the server does not offer. Absent when there are none.
Warnings []string `json:"warnings,omitempty"`
// The MCP protocol version the connection speaks, such as `2026-07-28`, or `2025-11-25` for a server that predates it. At most 128 bytes. Absent for a failed server.
ProtocolVersion *string `json:"protocolVersion,omitempty"`
// What the server says it is. The server writes every field, each cut to 128 bytes. Absent when the server gave no name.
ServerInfo *McpServerInfo `json:"serverInfo,omitempty"`
// The MCP capabilities the server advertised, whether or not its mcp.json entry turns them off. Absent for a failed server.
//
// - `tools`: tools the agent can call.
// - `resources`: resources and resource templates, which the agent reads with `listMcpResources` and `readMcpResource`.
// - `resourceSubscribe`: change notifications for single resources. Peen does not subscribe.
// - `prompts`: prompts a user invokes with `/mcp:<server>:<prompt>` and the agent reads with `listMcpPrompts` and `getMcpPrompt`.
// - `completions`: argument completion for prompts and resource templates. Peen does not use it.
Features []McpServerFeature `json:"features,omitempty"`
// The size in bytes of the instructions the server sent, after the `PEEN_MCP_MAX_INSTRUCTIONS_BYTES` cut when that limit is above zero. Absent when the server sent none or failed.
InstructionsBytes *int64 `json:"instructionsBytes,omitempty"`
// Whether the server's instructions reach the agent's system prompt. They do when the server sent some, its mcp.json entry does not set `instructions` to false, and `PEEN_MCP_MAX_INSTRUCTIONS_BYTES` is above zero. Absent when false.
InstructionsIncluded *bool `json:"instructionsIncluded,omitempty"`
// Whether the server's instructions were longer than `PEEN_MCP_MAX_INSTRUCTIONS_BYTES` and only their start is kept. Absent when false.
InstructionsCut *bool `json:"instructionsCut,omitempty"`
// The prompts the server offers, which a user invokes with a message that starts with `/mcp:<server>:<prompt>`. At most the first 50 of the server's first page. Absent when the server offers none, its mcp.json entry sets `prompts` to false, or it failed.
Prompts []McpPrompt `json:"prompts,omitempty"`
}
One configured MCP server as Peen found it at the start of a turn.
func (*McpServerStatus) UnmarshalJSON ¶ added in v0.38.0
func (v *McpServerStatus) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes McpServerStatus strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (McpServerStatus) Validate ¶ added in v0.38.0
func (v McpServerStatus) Validate() error
Validate checks the constraints the schema declares for McpServerStatus.
type McpServerTransport ¶ added in v0.38.0
type McpServerTransport string
How Peen reaches the server. Absent when a whole `mcp.json` file was refused.
- `stdio`: a local process Peen starts and talks to over standard input and output. - `http`: a remote server reached over Streamable HTTP.
const ( McpServerTransportStdio McpServerTransport = "stdio" McpServerTransportHTTP McpServerTransport = "http" )
Values of McpServerTransport.
func (McpServerTransport) Validate ¶ added in v0.38.0
func (v McpServerTransport) Validate() error
Validate reports whether v is one of the values the schema lists.
type McpStatus ¶ added in v0.38.0
type McpStatus struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `mcp.status`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of an `mcp.status` frame.
Data McpStatusData `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The session's MCP servers at the start of a turn. Peen emits it on every turn, after any `harness.warning` and before `turn.started`, re-reading the `mcp.json` files first, so a client always sees the current state. A session with no MCP servers configured gets an empty `servers` list. `GET /api/v1/session/mcp` returns the latest one. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (McpStatus) MarshalJSON ¶ added in v0.38.0
MarshalJSON encodes McpStatus with its const properties filled in.
func (*McpStatus) UnmarshalJSON ¶ added in v0.38.0
UnmarshalJSON decodes McpStatus strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
type McpStatusData ¶ added in v0.38.0
type McpStatusData struct {
// Every configured MCP server, in configuration order. Empty when the session has no MCP servers configured.
Servers []McpServerStatus `json:"servers"`
}
The `data` of an `mcp.status` frame.
func (*McpStatusData) UnmarshalJSON ¶ added in v0.38.0
func (v *McpStatusData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes McpStatusData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (McpStatusData) Validate ¶ added in v0.38.0
func (v McpStatusData) Validate() error
Validate checks the constraints the schema declares for McpStatusData.
type MessageCompleted ¶
type MessageCompleted struct {
// A random UUID Peen generates for this acknowledgement. It is not stored and is never replayed.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `message.completed`.
Type string `json:"type"`
// The `data` of a `message.completed` frame.
Data MessageCompletedData `json:"data"`
// When Peen sent the frame, in Unix seconds.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// The `id` of the `message.send` frame this frame answers. Match it against the IDs you sent to find the answer to your own message, since other sockets watching the session receive it too.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The successful end of one `message.send` submission. Peen sends it when the turn the message started completes, or at once when the message was queued into a running turn or sent to a child agent. It closes the submission, not the socket.
It is a live acknowledgement: Peen does not store it, gives it no `metadata.sequence`, and never replays it through `GET /api/v1/session/feed`. It goes to every socket watching the session, not only the sender, so match `triggeredBy` against the frame IDs you sent. `metadata.requestId` is the request ID of the submission, which the stored frames of the turn or queued message also carry. It travels apart from the stored frames, so its order relative to the turn's terminal frame is not guaranteed.
func (MessageCompleted) MarshalJSON ¶
func (v MessageCompleted) MarshalJSON() ([]byte, error)
MarshalJSON encodes MessageCompleted with its const properties filled in.
func (*MessageCompleted) UnmarshalJSON ¶
func (v *MessageCompleted) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes MessageCompleted strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (MessageCompleted) Validate ¶
func (v MessageCompleted) Validate() error
Validate checks the constraints the schema declares for MessageCompleted.
type MessageCompletedData ¶
type MessageCompletedData struct {
// `false` when the message started a turn and that turn completed. `true` when the message joined a running turn's queue or went to a child agent with `to`. `true` acknowledges only the submission: `userMessage.delivered`, or `agent.run.message.delivered` for a child, reports when the model actually received it.
Queued bool `json:"queued"`
}
The `data` of a `message.completed` frame.
func (*MessageCompletedData) UnmarshalJSON ¶
func (v *MessageCompletedData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes MessageCompletedData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (MessageCompletedData) Validate ¶
func (v MessageCompletedData) Validate() error
Validate checks the constraints the schema declares for MessageCompletedData.
type MessageFailed ¶
type MessageFailed struct {
// A random UUID Peen generates for this acknowledgement. It is not stored and is never replayed.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `message.failed`.
Type string `json:"type"`
// The `data` of a `message.failed` frame. Unknown provider, worker, and tool errors never expose their details: they arrive as `INTERNAL_SERVER_ERROR` with a generic message.
Data MessageFailedData `json:"data"`
// When Peen sent the frame, in Unix seconds.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// The `id` of the `message.send` frame this frame answers. Match it against the IDs you sent to find the answer to your own message, since other sockets watching the session receive it too. `null` when the failed frame carried no `id`.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The failed end of one `message.send` submission. A live acknowledgement: Peen does not store it, gives it no `metadata.sequence`, and never replays it through `GET /api/v1/session/feed`.
Who receives it depends on where the message failed. A frame that carried no `id`, or that did not decode at all (not valid JSON, an `id` that is not a UUID string, or a field of the wrong type), gets a `message.failed` on the sending socket only, with a null `triggeredBy` and no `metadata.sessionId`, and the connection stays open. A message Peen could not route to a session gets a `message.failed` on the sending socket only, with no `metadata.sessionId`. A message whose `data` failed to decode also reaches only the sending socket, with `metadata.sessionId` set. Every later failure, such as an unknown session, a refused setting, or a turn that failed, was stopped, or timed out, reaches every socket watching the session, so match `triggeredBy` against the frame IDs you sent. A turn that fails after it started also stores its own `turn.failed` or `turn.cancelled` frame, and this acknowledgement's order relative to that frame is not guaranteed.
func (MessageFailed) MarshalJSON ¶
func (v MessageFailed) MarshalJSON() ([]byte, error)
MarshalJSON encodes MessageFailed with its const properties filled in.
func (*MessageFailed) UnmarshalJSON ¶
func (v *MessageFailed) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes MessageFailed strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (MessageFailed) Validate ¶
func (v MessageFailed) Validate() error
Validate checks the constraints the schema declares for MessageFailed.
type MessageFailedCode ¶
type MessageFailedCode string
Why the submission failed:
- `VALIDATION_FAILED`: the frame or its settings were refused: a frame that is not valid JSON, a missing, null, all-zero, or non-UUID `id`, malformed or unknown fields, an empty or oversized message or system prompt, refused images, an unknown skill, a `system` mismatch, a session ID that is not a canonical UUIDv4, or a queued message that tried to change the running turn's settings. - `INTERNAL_SERVER_ERROR`: Peen failed for a reason it does not disclose. Nothing about the cause is exposed. - `SESSION_NOT_FOUND`: the session `metadata.sessionId` names does not exist. - `TURN_CANCELLED`: the turn the message started was stopped before it completed. - `TURN_TIMEOUT`: the turn's deadline, from `timeoutSeconds` or `PEEN_TURN_TIMEOUT`, expired. - `OUTPUT_SCHEMA_INVALID`: `outputSchema` is over its byte limit, does not compile, or references an external resource. - `USER_MESSAGE_QUEUE_FULL`: the running turn's queue, or the child's inbox, already holds `PEEN_MAX_QUEUED_USER_MESSAGES` messages. - `SESSION_BUSY`: the message carries `outputSchema` or `timeoutSeconds`, which need a new turn, while the session already has one running. - `AGENT_FINISHED`: the child agent named by `to` has already ended. - `AGENT_NOT_FOUND`: the session has no child agent run with the ID `to` names. - `AGENT_PAUSED`: deprecated and no longer sent, because a message to a paused child now resumes it. - `HARNESS_CONFIGURATION_INVALID`: Peen could not start the turn because the workspace agent configuration is invalid. `reason` says what to fix. - `TURN_ROUND_LIMIT`: the turn used all `PEEN_MAX_TOOL_ROUNDS` model rounds. - `TURN_TOKEN_LIMIT`: the turn billed `PEEN_MAX_TURN_TOKENS` tokens.
const ( MessageFailedCodeValidationFailed MessageFailedCode = "VALIDATION_FAILED" MessageFailedCodeInternalServerError MessageFailedCode = "INTERNAL_SERVER_ERROR" MessageFailedCodeSessionNotFound MessageFailedCode = "SESSION_NOT_FOUND" MessageFailedCodeTurnCancelled MessageFailedCode = "TURN_CANCELLED" MessageFailedCodeTurnTimeout MessageFailedCode = "TURN_TIMEOUT" MessageFailedCodeOutputSchemaInvalid MessageFailedCode = "OUTPUT_SCHEMA_INVALID" MessageFailedCodeUserMessageQueueFull MessageFailedCode = "USER_MESSAGE_QUEUE_FULL" MessageFailedCodeSessionBusy MessageFailedCode = "SESSION_BUSY" MessageFailedCodeAgentFinished MessageFailedCode = "AGENT_FINISHED" MessageFailedCodeAgentNotFound MessageFailedCode = "AGENT_NOT_FOUND" MessageFailedCodeAgentPaused MessageFailedCode = "AGENT_PAUSED" MessageFailedCodeHarnessConfigurationInvalid MessageFailedCode = "HARNESS_CONFIGURATION_INVALID" MessageFailedCodeTurnRoundLimit MessageFailedCode = "TURN_ROUND_LIMIT" MessageFailedCodeTurnTokenLimit MessageFailedCode = "TURN_TOKEN_LIMIT" )
Values of MessageFailedCode.
func (MessageFailedCode) Validate ¶
func (v MessageFailedCode) Validate() error
Validate reports whether v is one of the values the schema lists.
type MessageFailedData ¶
type MessageFailedData struct {
// Why the submission failed:
//
// - `VALIDATION_FAILED`: the frame or its settings were refused: a frame that is not valid JSON, a missing, null, all-zero, or non-UUID `id`, malformed or unknown fields, an empty or oversized message or system prompt, refused images, an unknown skill, a `system` mismatch, a session ID that is not a canonical UUIDv4, or a queued message that tried to change the running turn's settings.
// - `INTERNAL_SERVER_ERROR`: Peen failed for a reason it does not disclose. Nothing about the cause is exposed.
// - `SESSION_NOT_FOUND`: the session `metadata.sessionId` names does not exist.
// - `TURN_CANCELLED`: the turn the message started was stopped before it completed.
// - `TURN_TIMEOUT`: the turn's deadline, from `timeoutSeconds` or `PEEN_TURN_TIMEOUT`, expired.
// - `OUTPUT_SCHEMA_INVALID`: `outputSchema` is over its byte limit, does not compile, or references an external resource.
// - `USER_MESSAGE_QUEUE_FULL`: the running turn's queue, or the child's inbox, already holds `PEEN_MAX_QUEUED_USER_MESSAGES` messages.
// - `SESSION_BUSY`: the message carries `outputSchema` or `timeoutSeconds`, which need a new turn, while the session already has one running.
// - `AGENT_FINISHED`: the child agent named by `to` has already ended.
// - `AGENT_NOT_FOUND`: the session has no child agent run with the ID `to` names.
// - `AGENT_PAUSED`: deprecated and no longer sent, because a message to a paused child now resumes it.
// - `HARNESS_CONFIGURATION_INVALID`: Peen could not start the turn because the workspace agent configuration is invalid. `reason` says what to fix.
// - `TURN_ROUND_LIMIT`: the turn used all `PEEN_MAX_TOOL_ROUNDS` model rounds.
// - `TURN_TOKEN_LIMIT`: the turn billed `PEEN_MAX_TURN_TOKENS` tokens.
Code MessageFailedCode `json:"code"`
// A sentence for the sender. For `VALIDATION_FAILED` it is either a specific sentence written for the sender, such as `message.send requires an id` or which image or size limit was refused, or the generic `websocket message rejected`; for `INTERNAL_SERVER_ERROR` it is `websocket message failed`. For `TURN_ROUND_LIMIT` and `TURN_TOKEN_LIMIT` it names the setting that stopped the turn.
Message string `json:"message"`
// Set only alongside `HARNESS_CONFIGURATION_INVALID`. One of seven fixed sentences naming what is wrong with the workspace agent configuration and how to fix it: an invalid skill directory, invalid instructions or rules, an invalid named-agent document, invalid hooks or event handlers, too many or too large configuration files, unreadable configuration files, or a system prompt over `PEEN_MAX_SYSTEM_PROMPT_PERCENT` of the model's context window.
Reason *string `json:"reason,omitempty"`
}
The `data` of a `message.failed` frame. Unknown provider, worker, and tool errors never expose their details: they arrive as `INTERNAL_SERVER_ERROR` with a generic message.
func (*MessageFailedData) UnmarshalJSON ¶
func (v *MessageFailedData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes MessageFailedData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (MessageFailedData) Validate ¶
func (v MessageFailedData) Validate() error
Validate checks the constraints the schema declares for MessageFailedData.
type MessageImage ¶ added in v0.38.0
type MessageImage struct {
// The image format. Peen checks that the decoded bytes are in the format this names and fails the message with `VALIDATION_FAILED` when they are not.
//
// - `image/png`: PNG image.
// - `image/jpeg`: JPEG image.
// - `image/gif`: GIF image.
// - `image/webp`: WebP image.
MediaType MessageImageMediaType `json:"mediaType"`
// The image bytes, base64-encoded with the standard padded alphabet. At most `PEEN_MAX_IMAGE_BYTES` bytes once decoded, 5242880 by default. Data that is not valid base64, or decodes to more than the limit, fails the message with `VALIDATION_FAILED`.
Data string `json:"data"`
}
One image attached to a `message.send`. Peen stores it with the message in the session database and replays it to the model on later turns.
func (*MessageImage) UnmarshalJSON ¶ added in v0.38.0
func (v *MessageImage) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes MessageImage strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (MessageImage) Validate ¶ added in v0.38.0
func (v MessageImage) Validate() error
Validate checks the constraints the schema declares for MessageImage.
type MessageImageMediaType ¶ added in v0.38.0
type MessageImageMediaType string
The image format. Peen checks that the decoded bytes are in the format this names and fails the message with `VALIDATION_FAILED` when they are not.
- `image/png`: PNG image. - `image/jpeg`: JPEG image. - `image/gif`: GIF image. - `image/webp`: WebP image.
const ( MessageImageMediaTypeImagePng MessageImageMediaType = "image/png" MessageImageMediaTypeImageJpeg MessageImageMediaType = "image/jpeg" MessageImageMediaTypeImageGif MessageImageMediaType = "image/gif" MessageImageMediaTypeImageWebp MessageImageMediaType = "image/webp" )
Values of MessageImageMediaType.
func (MessageImageMediaType) Validate ¶ added in v0.38.0
func (v MessageImageMediaType) Validate() error
Validate reports whether v is one of the values the schema lists.
type MessageSend ¶
type MessageSend struct {
// A UUID you generate for this frame; use a fresh UUIDv4 for each message. Peen echoes it as `triggeredBy` on the `message.completed` or `message.failed` that answers this frame, and as `sourceEventId` in the message's `userMessage.*` data. Required: a missing or null `id`, the all-zero UUID, or a value that is not a UUID string fails the frame with `VALIDATION_FAILED` and a null `triggeredBy`.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// Always `message.send`.
Type string `json:"type"`
// The `data` of a `message.send` frame. Decoding is strict: an unknown field (`workspace` included), a missing or empty `message`, or a value outside its allowed range fails the message with `VALIDATION_FAILED`. `to` cannot combine with `model`, `reasoningEffort`, `systemPrompt`, `outputSchema`, `timeoutSeconds`, or `system`, because those settings belong to a root turn and not to a running child's inbox. `systemPrompt`, a `MessageSystemPrompt`, sets this turn's instructions.
Data MessageSendData `json:"data"`
// Not read by the server. Send `0` or the send time in Unix seconds.
Timestamp *int64 `json:"timestamp,omitempty"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata *Metadata `json:"metadata,omitempty"`
// Not read by the server. Send `null`.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The only frame a client sends. Each one submits one user message to the session that `metadata.sessionId` names. Naming the session routes the message but does not authorize it: Peen loads the session before it starts any work, and an unknown session fails with `SESSION_NOT_FOUND`. The first message for an idle session starts a turn. A message that arrives while a turn is running or starting joins that turn's queue, first in, first out, up to `PEEN_MAX_QUEUED_USER_MESSAGES` messages, 16 by default.
Every accepted message is first stored as a `userMessage.created` frame. The submission ends with one `message.completed` or `message.failed`, whose `triggeredBy` is this frame's `id`. A frame without an `id`, with a null `id`, or with the all-zero UUID gets a `message.failed` with `VALIDATION_FAILED` on this socket only, with a null `triggeredBy` and no `metadata.sessionId`, and starts nothing. A malformed `data` gets a `message.failed` on this socket only. A failure after Peen accepted the frame reaches every socket watching the session. Peen ignores a frame of any other `type` and does not reply to it. A frame that is not valid JSON in this shape, whose `id` is not a UUID string, or that has a field of the wrong type gets a `message.failed` with `VALIDATION_FAILED` on this socket only, with a null `triggeredBy` and no `metadata.sessionId`, and starts nothing; the connection stays open.
func (MessageSend) MarshalJSON ¶
func (v MessageSend) MarshalJSON() ([]byte, error)
MarshalJSON encodes MessageSend with its const properties filled in.
func (*MessageSend) UnmarshalJSON ¶
func (v *MessageSend) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes MessageSend strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (MessageSend) Validate ¶
func (v MessageSend) Validate() error
Validate checks the constraints the schema declares for MessageSend.
type MessageSendData ¶
type MessageSendData struct {
// Set it to `true` on a message to the deployment's system session, and leave it out or `false` on every other message. The server fails a mismatch in either direction with `VALIDATION_FAILED`, and `system` cannot combine with `to`.
System *bool `json:"system,omitempty"`
// The text the model receives. It must contain at least one character that is not whitespace. At most `PEEN_MAX_MESSAGE_BYTES` bytes, 262144 by default; the limit is deployment configuration, so the server enforces it, not this schema. Write `:skill-name`, or `:core:name` for a core skill, at the start or after a space to hand that skill to the model. An unknown skill name fails the message with `VALIDATION_FAILED`, and Peen stores nothing.
Message string `json:"message"`
// The model for this turn, as the `name` field of `GET /api/v1/models` (`provider/model`). Without it the turn uses `PEEN_DEFAULT_MODEL`. It applies to this turn only. A message queued into a running turn may repeat the running turn's model but cannot change it.
Model *string `json:"model,omitempty"`
// The reasoning level for this turn's model calls. Without it the model uses its own default. Peen fits the level to the model: a model without reasoning levels gets none, and a level outside its range runs at the nearest level it supports. A queued message may repeat the running turn's level but cannot change it.
//
// - `minimal`: the lowest reasoning level.
// - `low`: a low reasoning level.
// - `medium`: a medium reasoning level.
// - `high`: a high reasoning level.
// - `xhigh`: a level above `high`, for models that offer one.
// - `max`: the highest level the model offers.
ReasoningEffort *MessageSendReasoningEffort `json:"reasoningEffort,omitempty"`
// Instructions for the turn this message starts, in `message.send` `data.systemPrompt`. Both fields are required when it is present. It applies to that turn only and does not carry over to the next message. A message queued into a running turn, or sent with `to`, cannot set it and fails with `VALIDATION_FAILED`.
SystemPrompt *MessageSystemPrompt `json:"systemPrompt,omitempty"`
// A JSON Schema object the turn's final answer must match. After the turn's work, Peen runs a final request without tools, validates the answer, and retries up to `PEEN_OUTPUT_SCHEMA_ATTEMPTS` total attempts, 3 by default. `turn.completed` reports the result in `output` or `outputError`. At most `PEEN_MAX_OUTPUT_SCHEMA_BYTES` bytes, 65536 by default. A schema that is too large, does not compile, or references an external resource fails with `OUTPUT_SCHEMA_INVALID`. Local references inside the schema work. It cannot combine with `to`, and a message that carries it while a turn is running fails with `SESSION_BUSY` instead of joining that turn.
OutputSchema map[string]any `json:"outputSchema,omitempty"`
// A deadline for the whole turn, in seconds. Without it `PEEN_TURN_TIMEOUT` applies, which is `0`, no limit, by default. The deadline is absolute and survives recovery, so downtime counts against it. When it expires, Peen stops the turn and its child agents, stores `turn.cancelled` with `reason` `timeout`, and fails the submission with `TURN_TIMEOUT`. It cannot combine with `to`, and a message that carries it while a turn is running fails with `SESSION_BUSY`.
TimeoutSeconds *int64 `json:"timeoutSeconds,omitempty"`
// The `agentRunId` of a child agent of this session. The message goes to that child's inbox instead of the root conversation, starts no turn, and is answered at once with `message.completed` `{"queued": true}`. The child reads it after its current tool call, and a child that a Stop, crash, or failure paused resumes to read it. Fails with `AGENT_FINISHED` when the child has ended, `AGENT_NOT_FOUND` when the session has no such run, and `USER_MESSAGE_QUEUE_FULL` when the child's inbox already holds `PEEN_MAX_QUEUED_USER_MESSAGES` messages.
//
// Not enforced by the generated code: format uuid.
To *string `json:"to,omitempty"`
// Images the model sees after the message text, at most `PEEN_MAX_IMAGES_PER_MESSAGE`, 4 by default. Only a model that accepts image input can take them: a message whose model does not fails with `VALIDATION_FAILED`, and Peen never drops or converts an image to make a message fit. A message queued into a running turn, or sent with `to`, may carry images too. Once a session's history holds images, its turns can only run on models that accept images.
Images []MessageImage `json:"images,omitempty"`
}
The `data` of a `message.send` frame. Decoding is strict: an unknown field (`workspace` included), a missing or empty `message`, or a value outside its allowed range fails the message with `VALIDATION_FAILED`. `to` cannot combine with `model`, `reasoningEffort`, `systemPrompt`, `outputSchema`, `timeoutSeconds`, or `system`, because those settings belong to a root turn and not to a running child's inbox. `systemPrompt`, a `MessageSystemPrompt`, sets this turn's instructions.
func (MessageSendData) MarshalJSON ¶ added in v0.51.0
func (v MessageSendData) MarshalJSON() ([]byte, error)
MarshalJSON preserves an explicitly supplied empty schema object.
func (*MessageSendData) UnmarshalJSON ¶
func (v *MessageSendData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes MessageSendData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (MessageSendData) Validate ¶
func (v MessageSendData) Validate() error
Validate checks the constraints the schema declares for MessageSendData.
type MessageSendReasoningEffort ¶
type MessageSendReasoningEffort string
The reasoning level for this turn's model calls. Without it the model uses its own default. Peen fits the level to the model: a model without reasoning levels gets none, and a level outside its range runs at the nearest level it supports. A queued message may repeat the running turn's level but cannot change it.
- `minimal`: the lowest reasoning level. - `low`: a low reasoning level. - `medium`: a medium reasoning level. - `high`: a high reasoning level. - `xhigh`: a level above `high`, for models that offer one. - `max`: the highest level the model offers.
const ( MessageSendReasoningEffortMinimal MessageSendReasoningEffort = "minimal" MessageSendReasoningEffortLow MessageSendReasoningEffort = "low" MessageSendReasoningEffortMedium MessageSendReasoningEffort = "medium" MessageSendReasoningEffortHigh MessageSendReasoningEffort = "high" MessageSendReasoningEffortXhigh MessageSendReasoningEffort = "xhigh" MessageSendReasoningEffortMax MessageSendReasoningEffort = "max" )
Values of MessageSendReasoningEffort.
func (MessageSendReasoningEffort) Validate ¶
func (v MessageSendReasoningEffort) Validate() error
Validate reports whether v is one of the values the schema lists.
type MessageSystemPrompt ¶
type MessageSystemPrompt struct {
// The instructions. Must not be empty. At most `PEEN_MAX_SYSTEM_PROMPT_BYTES` bytes, 65536 by default. The limit is deployment configuration, so the server enforces it, not this schema, and fails a longer prompt with `VALIDATION_FAILED`.
Content string `json:"content"`
// How `content` combines with Peen's built-in prompt. Either way, the harness instructions, rules, and environment block still follow it.
//
// - `append`: Peen's built-in system prompt, followed by `content`.
// - `replace`: `content` in place of Peen's built-in system prompt.
Mode MessageSystemPromptMode `json:"mode"`
}
Instructions for the turn this message starts, in `message.send` `data.systemPrompt`. Both fields are required when it is present. It applies to that turn only and does not carry over to the next message. A message queued into a running turn, or sent with `to`, cannot set it and fails with `VALIDATION_FAILED`.
func (*MessageSystemPrompt) UnmarshalJSON ¶
func (v *MessageSystemPrompt) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes MessageSystemPrompt strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (MessageSystemPrompt) Validate ¶
func (v MessageSystemPrompt) Validate() error
Validate checks the constraints the schema declares for MessageSystemPrompt.
type MessageSystemPromptMode ¶
type MessageSystemPromptMode string
How `content` combines with Peen's built-in prompt. Either way, the harness instructions, rules, and environment block still follow it.
- `append`: Peen's built-in system prompt, followed by `content`. - `replace`: `content` in place of Peen's built-in system prompt.
const ( MessageSystemPromptModeAppend MessageSystemPromptMode = "append" MessageSystemPromptModeReplace MessageSystemPromptMode = "replace" )
Values of MessageSystemPromptMode.
func (MessageSystemPromptMode) Validate ¶
func (v MessageSystemPromptMode) Validate() error
Validate reports whether v is one of the values the schema lists.
type Metadata ¶
type Metadata struct {
// The session the frame belongs to, as a canonical lowercase UUIDv4. On `message.send` it routes the message to that session; a value that is not a canonical UUIDv4 string fails the message with `VALIDATION_FAILED`. A client with no session to name, such as an embedded single-workspace runtime, may omit it, and the message then runs against the runtime's own session; a controller has no such session, so it refuses a message without one. Every server frame carries it, except a `message.failed` answering a message Peen could not route or a `message.send` that carried no `id`.
//
// Not enforced by the generated code: format uuid.
SessionID *string `json:"sessionId,omitempty"`
// The ID Peen assigns to one submission. Every frame of a turn carries the turn's request ID, except the `userMessage.*` frames of a message queued into that turn, which carry the queued message's own. `message.completed` and `message.failed` carry the request ID of the submission they answer, so use it to find that submission's stored frames. Absent on `agent.run.*` and `notice.created`. Peen ignores a value sent on `message.send`.
//
// Not enforced by the generated code: format uuid.
RequestID *string `json:"requestId,omitempty"`
// The frame's position in its session's feed. Sequences count up from 1 with no gaps across every stored frame of the session. Present only on stored frames, never on `message.completed` or `message.failed`. To catch up after a reconnect, pass the last sequence you applied as `cursor` to `GET /api/v1/session/feed`. Peen ignores a value sent on `message.send`.
Sequence *int64 `json:"sequence,omitempty"`
}
Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
func (*Metadata) UnmarshalJSON ¶
UnmarshalJSON decodes Metadata strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
type Notice ¶
type Notice struct {
// The notice's ID, the same as on its `notice.created` frame.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The session the notice belongs to.
//
// Not enforced by the generated code: format uuid.
SessionID string `json:"sessionId"`
// The event type, a lowercase dotted name such as `job.exited` or `ci.build.failed`, 1 to 8 parts and up to 128 characters. `job.*`, `agent.*`, and `turn.*` are reserved for events Peen publishes itself.
Type string `json:"type"`
// Who published the notice: `tools.job` for background jobs, `agent.launchAgent` for child agents, `session.turn` for turns that ended without completing, `hooks` for hooks, and `api` for `POST /api/v1/session/notices`.
Source string `json:"source"`
// A one-line headline the model reads first. At most `PEEN_MAX_EVENT_SUMMARY_BYTES` bytes, 4096 by default.
Summary string `json:"summary"`
// Open. A JSON object whose shape depends on `type`, at most `PEEN_MAX_EVENT_DATA_BYTES` bytes encoded, 65536 by default. Absent when the notice has none.
Data map[string]any `json:"data,omitempty"`
// The delivery mode the publisher requested. A handler file for the type can override it.
//
// - `queue`: the notice waits for the next turn start or tool boundary and never starts a turn by itself.
// - `wake`: the notice may start a turn on an idle session when a handler for its type exists and the wake limit allows it; otherwise it is queued.
Delivery NoticeDelivery `json:"delivery"`
// When Peen stored the notice, RFC 3339.
CreatedAt time.Time `json:"createdAt"`
}
One session event as it reached the model, inside a `session.events` frame's `notices`. It is the same notice `GET /api/v1/session/notices` lists and that a `notice.created` frame announced when it was recorded.
func (*Notice) UnmarshalJSON ¶
UnmarshalJSON decodes Notice strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
type NoticeCreated ¶
type NoticeCreated struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `notice.created`. Switch on it to read `data`.
Type string `json:"type"`
// A session notice as Peen recorded it. It is the `data` of a `notice.created` frame, the same shape `GET /api/v1/session/notices` returns. It carries no `sessionId`; the frame's `metadata.sessionId` names the session.
Data SessionNotice `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
Peen recorded a session notice. Every recorded notice produces one when it is stored, whatever its `delivery` mode and whether or not it has reached the model yet. It belongs to no turn and carries no `metadata.requestId`. When the notice later reaches the model, it appears again inside a `session.events` frame. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (NoticeCreated) MarshalJSON ¶
func (v NoticeCreated) MarshalJSON() ([]byte, error)
MarshalJSON encodes NoticeCreated with its const properties filled in.
func (*NoticeCreated) UnmarshalJSON ¶
func (v *NoticeCreated) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes NoticeCreated strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (NoticeCreated) Validate ¶
func (v NoticeCreated) Validate() error
Validate checks the constraints the schema declares for NoticeCreated.
type NoticeDelivery ¶
type NoticeDelivery string
The delivery mode the publisher requested. A handler file for the type can override it.
- `queue`: the notice waits for the next turn start or tool boundary and never starts a turn by itself. - `wake`: the notice may start a turn on an idle session when a handler for its type exists and the wake limit allows it; otherwise it is queued.
const ( NoticeDeliveryQueue NoticeDelivery = "queue" NoticeDeliveryWake NoticeDelivery = "wake" )
Values of NoticeDelivery.
func (NoticeDelivery) Validate ¶
func (v NoticeDelivery) Validate() error
Validate reports whether v is one of the values the schema lists.
type Part ¶
type Part struct {
// Which kind of part this is, and so which other property is set:
//
// - `text`: a run of text, in `text`.
// - `image`: an image, in `image`.
// - `audio`: an audio clip, in `audio`.
// - `file`: a file, in `file`.
Type PartType `json:"type"`
// The text of a `text` part. Absent on other parts.
Text *string `json:"text,omitempty"`
// The media source of an `image` part. Open.
Image map[string]any `json:"image,omitempty"`
// The media source of an `audio` part. Open.
Audio map[string]any `json:"audio,omitempty"`
// The media source of a `file` part. Open.
File map[string]any `json:"file,omitempty"`
}
One part of a child's assistant message content, in order. A child's reply holds only `text` parts; `image`, `audio`, and `file` exist for parity with the model layer's content format and are open objects that Peen does not define as a contract.
func (*Part) UnmarshalJSON ¶
UnmarshalJSON decodes Part strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
type PartType ¶
type PartType string
Which kind of part this is, and so which other property is set:
- `text`: a run of text, in `text`. - `image`: an image, in `image`. - `audio`: an audio clip, in `audio`. - `file`: a file, in `file`.
type ProviderRetry ¶
type ProviderRetry struct {
// The number of the attempt that failed, counting from 1.
Attempt int64 `json:"attempt"`
// Why the attempt failed:
//
// - `""`: the failure was not classified. Peen does not retry such a failure, so a frame rarely carries it.
// - `rate_limited`: the provider refused the request for rate limiting (HTTP 429 or the provider's rate limit code).
// - `server_error`: the provider reported a server-side error or overload.
// - `timeout`: the connection to the provider timed out.
// - `transport`: the connection to the provider failed or broke before the provider answered.
Reason ProviderRetryReason `json:"reason"`
// The HTTP status the failed attempt returned. `0` when the failure carried no HTTP status, such as a broken connection. A provider that reports an error inside a streamed response can leave this at `200`.
Status int64 `json:"status"`
// How long Peen waits before the next attempt, in milliseconds.
DelayMs int64 `json:"delayMs"`
}
One failed provider request that Peen is about to retry. It is the `data` of a root `provider.retry` frame and the `event` of a child's `agent.run.provider.retry` frame. Peen sends it before it waits, so `delayMs` is the wait still ahead. Only retryable failures (rate limits, server errors, timeouts, and broken connections) produce it; a failure Peen does not retry ends the turn instead.
func (*ProviderRetry) UnmarshalJSON ¶
func (v *ProviderRetry) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ProviderRetry strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ProviderRetry) Validate ¶
func (v ProviderRetry) Validate() error
Validate checks the constraints the schema declares for ProviderRetry.
type ProviderRetryEvent ¶
type ProviderRetryEvent struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `provider.retry`. Switch on it to read `data`.
Type string `json:"type"`
// One failed provider request that Peen is about to retry. It is the `data` of a root `provider.retry` frame and the `event` of a child's `agent.run.provider.retry` frame. Peen sends it before it waits, so `delayMs` is the wait still ahead. Only retryable failures (rate limits, server errors, timeouts, and broken connections) produce it; a failure Peen does not retry ends the turn instead.
Data ProviderRetry `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
A provider request of the root conversation failed and Peen will retry it after `data.delayMs`. A turn can emit several, one per failed attempt. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (ProviderRetryEvent) MarshalJSON ¶
func (v ProviderRetryEvent) MarshalJSON() ([]byte, error)
MarshalJSON encodes ProviderRetryEvent with its const properties filled in.
func (*ProviderRetryEvent) UnmarshalJSON ¶
func (v *ProviderRetryEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ProviderRetryEvent strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ProviderRetryEvent) Validate ¶
func (v ProviderRetryEvent) Validate() error
Validate checks the constraints the schema declares for ProviderRetryEvent.
type ProviderRetryReason ¶
type ProviderRetryReason string
Why the attempt failed:
- `""`: the failure was not classified. Peen does not retry such a failure, so a frame rarely carries it. - `rate_limited`: the provider refused the request for rate limiting (HTTP 429 or the provider's rate limit code). - `server_error`: the provider reported a server-side error or overload. - `timeout`: the connection to the provider timed out. - `transport`: the connection to the provider failed or broke before the provider answered.
const ( ProviderRetryReasonEmpty ProviderRetryReason = "" ProviderRetryReasonRateLimited ProviderRetryReason = "rate_limited" ProviderRetryReasonServerError ProviderRetryReason = "server_error" ProviderRetryReasonTimeout ProviderRetryReason = "timeout" ProviderRetryReasonTransport ProviderRetryReason = "transport" )
Values of ProviderRetryReason.
func (ProviderRetryReason) Validate ¶
func (v ProviderRetryReason) Validate() error
Validate reports whether v is one of the values the schema lists.
type QuestionAnswered ¶
type QuestionAnswered struct {
// `true` when a message reached the agent before the ask timed out, `false` when it timed out.
Answered bool `json:"answered"`
// The call ID of the `ask` tool call this ends, matching the `question.asked` or `agent.run.question` frame. Present on every frame Peen sends now; absent only on frames stored before Peen recorded it.
CallID *string `json:"callId,omitempty"`
}
The end of an `ask` call. It is the `data` of a root `question.answered` frame and the `event` of a child's `agent.run.answer` frame. It carries no answer text: the answer is the message that reached the agent.
func (*QuestionAnswered) UnmarshalJSON ¶
func (v *QuestionAnswered) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes QuestionAnswered strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (QuestionAnswered) Validate ¶
func (v QuestionAnswered) Validate() error
Validate checks the constraints the schema declares for QuestionAnswered.
type QuestionAnsweredEvent ¶
type QuestionAnsweredEvent struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `question.answered`. Switch on it to read `data`.
Type string `json:"type"`
// The end of an `ask` call. It is the `data` of a root `question.answered` frame and the `event` of a child's `agent.run.answer` frame. It carries no answer text: the answer is the message that reached the agent.
Data QuestionAnswered `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The root conversation's `ask` ended, because a message reached it or because it timed out. It follows the matching `question.asked`. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (QuestionAnsweredEvent) MarshalJSON ¶
func (v QuestionAnsweredEvent) MarshalJSON() ([]byte, error)
MarshalJSON encodes QuestionAnsweredEvent with its const properties filled in.
func (*QuestionAnsweredEvent) UnmarshalJSON ¶
func (v *QuestionAnsweredEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes QuestionAnsweredEvent strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (QuestionAnsweredEvent) Validate ¶
func (v QuestionAnsweredEvent) Validate() error
Validate checks the constraints the schema declares for QuestionAnsweredEvent.
type QuestionAsked ¶
type QuestionAsked struct {
// The question text. For an MCP server's question, the part between the `---` lines is the server's own text, at most 4096 bytes.
Question string `json:"question"`
// The call ID of the `ask` tool call, or of the MCP tool call the server's question belongs to, matching its `tool.use` and the later answer frame. Absent on frames stored before Peen recorded it, and on an MCP server question that arrives outside the call's own request, from a server on a protocol before 2026-07-28.
CallID *string `json:"callId,omitempty"`
}
A question an agent asked with the `ask` tool, or a question an MCP server asked the user while one of its calls ran. It is the `data` of a root `question.asked` frame and the `event` of a child's `agent.run.question` frame. The agent or server waits until a message reaches it or the question times out. For the root conversation, your next message is the answer. An MCP server's question names the server and quotes its text, lists the fields it asks for, and takes a JSON object, the bare value of a one-field form, `decline`, or `cancel`.
func (*QuestionAsked) UnmarshalJSON ¶
func (v *QuestionAsked) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes QuestionAsked strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (QuestionAsked) Validate ¶
func (v QuestionAsked) Validate() error
Validate checks the constraints the schema declares for QuestionAsked.
type QuestionAskedEvent ¶
type QuestionAskedEvent struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `question.asked`. Switch on it to read `data`.
Type string `json:"type"`
// A question an agent asked with the `ask` tool, or a question an MCP server asked the user while one of its calls ran. It is the `data` of a root `question.asked` frame and the `event` of a child's `agent.run.question` frame. The agent or server waits until a message reaches it or the question times out. For the root conversation, your next message is the answer. An MCP server's question names the server and quotes its text, lists the fields it asks for, and takes a JSON object, the bare value of a one-field form, `decline`, or `cancel`.
Data QuestionAsked `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The root conversation asked you a question with the `ask` tool, or an MCP server asked one while its call ran, and is waiting. Send your answer as the next `message.send`: it joins the running turn's queue and reaches the waiting model, and for an MCP server's question also goes back to the server. A `question.answered` frame follows when the ask ends. A child agent's questions arrive as `agent.run.question` instead. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (QuestionAskedEvent) MarshalJSON ¶
func (v QuestionAskedEvent) MarshalJSON() ([]byte, error)
MarshalJSON encodes QuestionAskedEvent with its const properties filled in.
func (*QuestionAskedEvent) UnmarshalJSON ¶
func (v *QuestionAskedEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes QuestionAskedEvent strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (QuestionAskedEvent) Validate ¶
func (v QuestionAskedEvent) Validate() error
Validate checks the constraints the schema declares for QuestionAskedEvent.
type ServerEvent ¶
type ServerEvent struct {
// contains filtered or unexported fields
}
Any frame the server sends, selected by `type`. `message.completed` and `message.failed` are unsequenced acknowledgements of one client frame. Every other type is a sequenced feed frame with `metadata.sequence`: the model's reply as `content_block_*` blocks, Peen's protocol events for a root turn, `agent.run.*` steps of child agent runs, and `notice.created`. A client should skip a `type` it does not know and still advance its cursor past that frame's sequence. ServerEvent holds one of several shapes. Set it with the From methods and read it with Value or the As methods.
func (ServerEvent) AsAgentRunAnswer ¶
func (v ServerEvent) AsAgentRunAnswer() (AgentRunAnswer, error)
AsAgentRunAnswer decodes the held value as a AgentRunAnswer.
func (ServerEvent) AsAgentRunAssistantMessage ¶
func (v ServerEvent) AsAgentRunAssistantMessage() (AgentRunAssistantMessage, error)
AsAgentRunAssistantMessage decodes the held value as a AgentRunAssistantMessage.
func (ServerEvent) AsAgentRunCancelled ¶
func (v ServerEvent) AsAgentRunCancelled() (AgentRunCancelled, error)
AsAgentRunCancelled decodes the held value as a AgentRunCancelled.
func (ServerEvent) AsAgentRunCompleted ¶
func (v ServerEvent) AsAgentRunCompleted() (AgentRunCompleted, error)
AsAgentRunCompleted decodes the held value as a AgentRunCompleted.
func (ServerEvent) AsAgentRunFailed ¶
func (v ServerEvent) AsAgentRunFailed() (AgentRunFailed, error)
AsAgentRunFailed decodes the held value as a AgentRunFailed.
func (ServerEvent) AsAgentRunMessageDelivered ¶
func (v ServerEvent) AsAgentRunMessageDelivered() (AgentRunMessageDelivered, error)
AsAgentRunMessageDelivered decodes the held value as a AgentRunMessageDelivered.
func (ServerEvent) AsAgentRunMessageInjected ¶
func (v ServerEvent) AsAgentRunMessageInjected() (AgentRunMessageInjected, error)
AsAgentRunMessageInjected decodes the held value as a AgentRunMessageInjected.
func (ServerEvent) AsAgentRunMessageQueued ¶
func (v ServerEvent) AsAgentRunMessageQueued() (AgentRunMessageQueued, error)
AsAgentRunMessageQueued decodes the held value as a AgentRunMessageQueued.
func (ServerEvent) AsAgentRunMessageUndelivered ¶
func (v ServerEvent) AsAgentRunMessageUndelivered() (AgentRunMessageUndelivered, error)
AsAgentRunMessageUndelivered decodes the held value as a AgentRunMessageUndelivered.
func (ServerEvent) AsAgentRunProviderRetry ¶
func (v ServerEvent) AsAgentRunProviderRetry() (AgentRunProviderRetry, error)
AsAgentRunProviderRetry decodes the held value as a AgentRunProviderRetry.
func (ServerEvent) AsAgentRunQuestion ¶
func (v ServerEvent) AsAgentRunQuestion() (AgentRunQuestion, error)
AsAgentRunQuestion decodes the held value as a AgentRunQuestion.
func (ServerEvent) AsAgentRunStarted ¶
func (v ServerEvent) AsAgentRunStarted() (AgentRunStarted, error)
AsAgentRunStarted decodes the held value as a AgentRunStarted.
func (ServerEvent) AsAgentRunTextDelta ¶
func (v ServerEvent) AsAgentRunTextDelta() (AgentRunTextDelta, error)
AsAgentRunTextDelta decodes the held value as a AgentRunTextDelta.
func (ServerEvent) AsAgentRunThinkingDelta ¶
func (v ServerEvent) AsAgentRunThinkingDelta() (AgentRunThinkingDelta, error)
AsAgentRunThinkingDelta decodes the held value as a AgentRunThinkingDelta.
func (ServerEvent) AsAgentRunToolResult ¶
func (v ServerEvent) AsAgentRunToolResult() (AgentRunToolResult, error)
AsAgentRunToolResult decodes the held value as a AgentRunToolResult.
func (ServerEvent) AsAgentRunToolUse ¶
func (v ServerEvent) AsAgentRunToolUse() (AgentRunToolUse, error)
AsAgentRunToolUse decodes the held value as a AgentRunToolUse.
func (ServerEvent) AsContentBlockDelta ¶
func (v ServerEvent) AsContentBlockDelta() (ContentBlockDelta, error)
AsContentBlockDelta decodes the held value as a ContentBlockDelta.
func (ServerEvent) AsContentBlockStart ¶
func (v ServerEvent) AsContentBlockStart() (ContentBlockStart, error)
AsContentBlockStart decodes the held value as a ContentBlockStart.
func (ServerEvent) AsContentBlockStop ¶
func (v ServerEvent) AsContentBlockStop() (ContentBlockStop, error)
AsContentBlockStop decodes the held value as a ContentBlockStop.
func (ServerEvent) AsHarnessWarning ¶
func (v ServerEvent) AsHarnessWarning() (HarnessWarning, error)
AsHarnessWarning decodes the held value as a HarnessWarning.
func (ServerEvent) AsMcpStatus ¶ added in v0.38.0
func (v ServerEvent) AsMcpStatus() (McpStatus, error)
AsMcpStatus decodes the held value as a McpStatus.
func (ServerEvent) AsMessageCompleted ¶
func (v ServerEvent) AsMessageCompleted() (MessageCompleted, error)
AsMessageCompleted decodes the held value as a MessageCompleted.
func (ServerEvent) AsMessageFailed ¶
func (v ServerEvent) AsMessageFailed() (MessageFailed, error)
AsMessageFailed decodes the held value as a MessageFailed.
func (ServerEvent) AsNoticeCreated ¶
func (v ServerEvent) AsNoticeCreated() (NoticeCreated, error)
AsNoticeCreated decodes the held value as a NoticeCreated.
func (ServerEvent) AsProviderRetryEvent ¶
func (v ServerEvent) AsProviderRetryEvent() (ProviderRetryEvent, error)
AsProviderRetryEvent decodes the held value as a ProviderRetryEvent.
func (ServerEvent) AsQuestionAnsweredEvent ¶
func (v ServerEvent) AsQuestionAnsweredEvent() (QuestionAnsweredEvent, error)
AsQuestionAnsweredEvent decodes the held value as a QuestionAnsweredEvent.
func (ServerEvent) AsQuestionAskedEvent ¶
func (v ServerEvent) AsQuestionAskedEvent() (QuestionAskedEvent, error)
AsQuestionAskedEvent decodes the held value as a QuestionAskedEvent.
func (ServerEvent) AsSessionEvents ¶
func (v ServerEvent) AsSessionEvents() (SessionEvents, error)
AsSessionEvents decodes the held value as a SessionEvents.
func (ServerEvent) AsSkillInjected ¶
func (v ServerEvent) AsSkillInjected() (SkillInjected, error)
AsSkillInjected decodes the held value as a SkillInjected.
func (ServerEvent) AsToolResultEvent ¶
func (v ServerEvent) AsToolResultEvent() (ToolResultEvent, error)
AsToolResultEvent decodes the held value as a ToolResultEvent.
func (ServerEvent) AsToolUseEvent ¶
func (v ServerEvent) AsToolUseEvent() (ToolUseEvent, error)
AsToolUseEvent decodes the held value as a ToolUseEvent.
func (ServerEvent) AsTurnCancelled ¶
func (v ServerEvent) AsTurnCancelled() (TurnCancelled, error)
AsTurnCancelled decodes the held value as a TurnCancelled.
func (ServerEvent) AsTurnCompleted ¶
func (v ServerEvent) AsTurnCompleted() (TurnCompleted, error)
AsTurnCompleted decodes the held value as a TurnCompleted.
func (ServerEvent) AsTurnFailed ¶
func (v ServerEvent) AsTurnFailed() (TurnFailed, error)
AsTurnFailed decodes the held value as a TurnFailed.
func (ServerEvent) AsTurnStarted ¶
func (v ServerEvent) AsTurnStarted() (TurnStarted, error)
AsTurnStarted decodes the held value as a TurnStarted.
func (ServerEvent) AsUserMessageCreated ¶
func (v ServerEvent) AsUserMessageCreated() (UserMessageCreated, error)
AsUserMessageCreated decodes the held value as a UserMessageCreated.
func (ServerEvent) AsUserMessageDelivered ¶
func (v ServerEvent) AsUserMessageDelivered() (UserMessageDelivered, error)
AsUserMessageDelivered decodes the held value as a UserMessageDelivered.
func (ServerEvent) AsUserMessageQueued ¶
func (v ServerEvent) AsUserMessageQueued() (UserMessageQueued, error)
AsUserMessageQueued decodes the held value as a UserMessageQueued.
func (ServerEvent) Discriminator ¶
func (v ServerEvent) Discriminator() (string, error)
Discriminator returns the "type" property that selects the variant.
func (*ServerEvent) FromAgentRunAnswer ¶
func (v *ServerEvent) FromAgentRunAnswer(value AgentRunAnswer) error
FromAgentRunAnswer sets the held value to a AgentRunAnswer.
func (*ServerEvent) FromAgentRunAssistantMessage ¶
func (v *ServerEvent) FromAgentRunAssistantMessage(value AgentRunAssistantMessage) error
FromAgentRunAssistantMessage sets the held value to a AgentRunAssistantMessage.
func (*ServerEvent) FromAgentRunCancelled ¶
func (v *ServerEvent) FromAgentRunCancelled(value AgentRunCancelled) error
FromAgentRunCancelled sets the held value to a AgentRunCancelled.
func (*ServerEvent) FromAgentRunCompleted ¶
func (v *ServerEvent) FromAgentRunCompleted(value AgentRunCompleted) error
FromAgentRunCompleted sets the held value to a AgentRunCompleted.
func (*ServerEvent) FromAgentRunFailed ¶
func (v *ServerEvent) FromAgentRunFailed(value AgentRunFailed) error
FromAgentRunFailed sets the held value to a AgentRunFailed.
func (*ServerEvent) FromAgentRunMessageDelivered ¶
func (v *ServerEvent) FromAgentRunMessageDelivered(value AgentRunMessageDelivered) error
FromAgentRunMessageDelivered sets the held value to a AgentRunMessageDelivered.
func (*ServerEvent) FromAgentRunMessageInjected ¶
func (v *ServerEvent) FromAgentRunMessageInjected(value AgentRunMessageInjected) error
FromAgentRunMessageInjected sets the held value to a AgentRunMessageInjected.
func (*ServerEvent) FromAgentRunMessageQueued ¶
func (v *ServerEvent) FromAgentRunMessageQueued(value AgentRunMessageQueued) error
FromAgentRunMessageQueued sets the held value to a AgentRunMessageQueued.
func (*ServerEvent) FromAgentRunMessageUndelivered ¶
func (v *ServerEvent) FromAgentRunMessageUndelivered(value AgentRunMessageUndelivered) error
FromAgentRunMessageUndelivered sets the held value to a AgentRunMessageUndelivered.
func (*ServerEvent) FromAgentRunProviderRetry ¶
func (v *ServerEvent) FromAgentRunProviderRetry(value AgentRunProviderRetry) error
FromAgentRunProviderRetry sets the held value to a AgentRunProviderRetry.
func (*ServerEvent) FromAgentRunQuestion ¶
func (v *ServerEvent) FromAgentRunQuestion(value AgentRunQuestion) error
FromAgentRunQuestion sets the held value to a AgentRunQuestion.
func (*ServerEvent) FromAgentRunStarted ¶
func (v *ServerEvent) FromAgentRunStarted(value AgentRunStarted) error
FromAgentRunStarted sets the held value to a AgentRunStarted.
func (*ServerEvent) FromAgentRunTextDelta ¶
func (v *ServerEvent) FromAgentRunTextDelta(value AgentRunTextDelta) error
FromAgentRunTextDelta sets the held value to a AgentRunTextDelta.
func (*ServerEvent) FromAgentRunThinkingDelta ¶
func (v *ServerEvent) FromAgentRunThinkingDelta(value AgentRunThinkingDelta) error
FromAgentRunThinkingDelta sets the held value to a AgentRunThinkingDelta.
func (*ServerEvent) FromAgentRunToolResult ¶
func (v *ServerEvent) FromAgentRunToolResult(value AgentRunToolResult) error
FromAgentRunToolResult sets the held value to a AgentRunToolResult.
func (*ServerEvent) FromAgentRunToolUse ¶
func (v *ServerEvent) FromAgentRunToolUse(value AgentRunToolUse) error
FromAgentRunToolUse sets the held value to a AgentRunToolUse.
func (*ServerEvent) FromContentBlockDelta ¶
func (v *ServerEvent) FromContentBlockDelta(value ContentBlockDelta) error
FromContentBlockDelta sets the held value to a ContentBlockDelta.
func (*ServerEvent) FromContentBlockStart ¶
func (v *ServerEvent) FromContentBlockStart(value ContentBlockStart) error
FromContentBlockStart sets the held value to a ContentBlockStart.
func (*ServerEvent) FromContentBlockStop ¶
func (v *ServerEvent) FromContentBlockStop(value ContentBlockStop) error
FromContentBlockStop sets the held value to a ContentBlockStop.
func (*ServerEvent) FromHarnessWarning ¶
func (v *ServerEvent) FromHarnessWarning(value HarnessWarning) error
FromHarnessWarning sets the held value to a HarnessWarning.
func (*ServerEvent) FromMcpStatus ¶ added in v0.38.0
func (v *ServerEvent) FromMcpStatus(value McpStatus) error
FromMcpStatus sets the held value to a McpStatus.
func (*ServerEvent) FromMessageCompleted ¶
func (v *ServerEvent) FromMessageCompleted(value MessageCompleted) error
FromMessageCompleted sets the held value to a MessageCompleted.
func (*ServerEvent) FromMessageFailed ¶
func (v *ServerEvent) FromMessageFailed(value MessageFailed) error
FromMessageFailed sets the held value to a MessageFailed.
func (*ServerEvent) FromNoticeCreated ¶
func (v *ServerEvent) FromNoticeCreated(value NoticeCreated) error
FromNoticeCreated sets the held value to a NoticeCreated.
func (*ServerEvent) FromProviderRetryEvent ¶
func (v *ServerEvent) FromProviderRetryEvent(value ProviderRetryEvent) error
FromProviderRetryEvent sets the held value to a ProviderRetryEvent.
func (*ServerEvent) FromQuestionAnsweredEvent ¶
func (v *ServerEvent) FromQuestionAnsweredEvent(value QuestionAnsweredEvent) error
FromQuestionAnsweredEvent sets the held value to a QuestionAnsweredEvent.
func (*ServerEvent) FromQuestionAskedEvent ¶
func (v *ServerEvent) FromQuestionAskedEvent(value QuestionAskedEvent) error
FromQuestionAskedEvent sets the held value to a QuestionAskedEvent.
func (*ServerEvent) FromSessionEvents ¶
func (v *ServerEvent) FromSessionEvents(value SessionEvents) error
FromSessionEvents sets the held value to a SessionEvents.
func (*ServerEvent) FromSkillInjected ¶
func (v *ServerEvent) FromSkillInjected(value SkillInjected) error
FromSkillInjected sets the held value to a SkillInjected.
func (*ServerEvent) FromToolResultEvent ¶
func (v *ServerEvent) FromToolResultEvent(value ToolResultEvent) error
FromToolResultEvent sets the held value to a ToolResultEvent.
func (*ServerEvent) FromToolUseEvent ¶
func (v *ServerEvent) FromToolUseEvent(value ToolUseEvent) error
FromToolUseEvent sets the held value to a ToolUseEvent.
func (*ServerEvent) FromTurnCancelled ¶
func (v *ServerEvent) FromTurnCancelled(value TurnCancelled) error
FromTurnCancelled sets the held value to a TurnCancelled.
func (*ServerEvent) FromTurnCompleted ¶
func (v *ServerEvent) FromTurnCompleted(value TurnCompleted) error
FromTurnCompleted sets the held value to a TurnCompleted.
func (*ServerEvent) FromTurnFailed ¶
func (v *ServerEvent) FromTurnFailed(value TurnFailed) error
FromTurnFailed sets the held value to a TurnFailed.
func (*ServerEvent) FromTurnStarted ¶
func (v *ServerEvent) FromTurnStarted(value TurnStarted) error
FromTurnStarted sets the held value to a TurnStarted.
func (*ServerEvent) FromUserMessageCreated ¶
func (v *ServerEvent) FromUserMessageCreated(value UserMessageCreated) error
FromUserMessageCreated sets the held value to a UserMessageCreated.
func (*ServerEvent) FromUserMessageDelivered ¶
func (v *ServerEvent) FromUserMessageDelivered(value UserMessageDelivered) error
FromUserMessageDelivered sets the held value to a UserMessageDelivered.
func (*ServerEvent) FromUserMessageQueued ¶
func (v *ServerEvent) FromUserMessageQueued(value UserMessageQueued) error
FromUserMessageQueued sets the held value to a UserMessageQueued.
func (ServerEvent) MarshalJSON ¶
func (v ServerEvent) MarshalJSON() ([]byte, error)
MarshalJSON encodes the held value.
func (*ServerEvent) UnmarshalJSON ¶
func (v *ServerEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON stores data after checking that it is exactly one variant.
func (ServerEvent) Validate ¶
func (v ServerEvent) Validate() error
Validate checks that the held value is a valid variant.
func (ServerEvent) Value ¶
func (v ServerEvent) Value() (any, error)
Value decodes the held value as the variant its discriminator selects.
type SessionEvents ¶
type SessionEvents struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `session.events`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of a `session.events` frame.
Data SessionEventsData `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
Pending session notices were handed to the model as one message. Peen delivers them at the start of a turn, before `turn.started`, and at each tool boundary inside a running turn, right after a tool result. A `turn.failed` or `turn.cancelled` notice is listed here too, though the model does not receive it as event data. Only the root conversation receives session events. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (SessionEvents) MarshalJSON ¶
func (v SessionEvents) MarshalJSON() ([]byte, error)
MarshalJSON encodes SessionEvents with its const properties filled in.
func (*SessionEvents) UnmarshalJSON ¶
func (v *SessionEvents) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes SessionEvents strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (SessionEvents) Validate ¶
func (v SessionEvents) Validate() error
Validate checks the constraints the schema declares for SessionEvents.
type SessionEventsData ¶
type SessionEventsData struct {
// The notices delivered in this batch, oldest first. Peen marks them delivered when it sends this frame.
Notices []Notice `json:"notices"`
// Kept for compatibility and always `0`, because Peen delivers every stored notice.
Dropped int64 `json:"dropped"`
}
The `data` of a `session.events` frame.
func (*SessionEventsData) UnmarshalJSON ¶
func (v *SessionEventsData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes SessionEventsData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (SessionEventsData) Validate ¶
func (v SessionEventsData) Validate() error
Validate checks the constraints the schema declares for SessionEventsData.
type SessionNotice ¶
type SessionNotice struct {
// The notice's ID. The same notice later appears with this ID in a `session.events` frame when it reaches the model.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The event type, a lowercase dotted name such as `job.exited` or `ci.build.failed`, 1 to 8 parts and up to 128 characters. `job.*`, `agent.*`, and `turn.*` are reserved for events Peen publishes itself.
Type string `json:"type"`
// Who published the notice: `tools.job` for background jobs, `agent.launchAgent` for child agents, `session.turn` for turns that ended without completing, `hooks` for hooks, and `api` for `POST /api/v1/session/notices`.
Source string `json:"source"`
// A one-line headline the model reads first. At most `PEEN_MAX_EVENT_SUMMARY_BYTES` bytes, 4096 by default.
Summary string `json:"summary"`
// Open. A JSON object whose shape depends on `type`, at most `PEEN_MAX_EVENT_DATA_BYTES` bytes encoded, 65536 by default. Absent when the notice has none.
Data map[string]any `json:"data,omitempty"`
// The delivery mode the publisher requested. A handler file for the type can override it.
//
// - `queue`: the notice waits for the next turn start or tool boundary and never starts a turn by itself.
// - `wake`: the notice may start a turn on an idle session when a handler for its type exists and the wake limit allows it; otherwise it is queued.
Delivery SessionNoticeDelivery `json:"delivery"`
// When Peen stored the notice, RFC 3339.
CreatedAt time.Time `json:"createdAt"`
}
A session notice as Peen recorded it. It is the `data` of a `notice.created` frame, the same shape `GET /api/v1/session/notices` returns. It carries no `sessionId`; the frame's `metadata.sessionId` names the session.
func (*SessionNotice) UnmarshalJSON ¶
func (v *SessionNotice) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes SessionNotice strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (SessionNotice) Validate ¶
func (v SessionNotice) Validate() error
Validate checks the constraints the schema declares for SessionNotice.
type SessionNoticeDelivery ¶
type SessionNoticeDelivery string
The delivery mode the publisher requested. A handler file for the type can override it.
- `queue`: the notice waits for the next turn start or tool boundary and never starts a turn by itself. - `wake`: the notice may start a turn on an idle session when a handler for its type exists and the wake limit allows it; otherwise it is queued.
const ( SessionNoticeDeliveryQueue SessionNoticeDelivery = "queue" SessionNoticeDeliveryWake SessionNoticeDelivery = "wake" )
Values of SessionNoticeDelivery.
func (SessionNoticeDelivery) Validate ¶
func (v SessionNoticeDelivery) Validate() error
Validate reports whether v is one of the values the schema lists.
type SkillInjected ¶
type SkillInjected struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `skill.injected`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of a `skill.injected` frame.
Data SkillInjectedData `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
A skill message reached the model right after the user message that named it with `:name`, or the note that the skill is already loaded did. At the start of a turn it follows `userMessage.created`. For a queued message it follows that message's `userMessage.delivered` and carries the running turn's `metadata.requestId`. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (SkillInjected) MarshalJSON ¶
func (v SkillInjected) MarshalJSON() ([]byte, error)
MarshalJSON encodes SkillInjected with its const properties filled in.
func (*SkillInjected) UnmarshalJSON ¶
func (v *SkillInjected) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes SkillInjected strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (SkillInjected) Validate ¶
func (v SkillInjected) Validate() error
Validate checks the constraints the schema declares for SkillInjected.
type SkillInjectedData ¶
type SkillInjectedData struct {
// The resolved name of the skill, such as `reviewer` or `core:name` for a core skill.
Name string `json:"name"`
// The whole message the model received for the skill: the `<skill>` block with its name, description, directory, and full `SKILL.md`, or the note that the skill is already loaded.
Content string `json:"content"`
}
The `data` of a `skill.injected` frame.
func (*SkillInjectedData) UnmarshalJSON ¶
func (v *SkillInjectedData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes SkillInjectedData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (SkillInjectedData) Validate ¶
func (v SkillInjectedData) Validate() error
Validate checks the constraints the schema declares for SkillInjectedData.
type TextDelta ¶
type TextDelta struct {
// Always `text_delta`.
Type string `json:"type"`
// The fragment, never empty. Append it to the block's earlier fragments.
Text string `json:"text"`
}
A fragment of the model's reply text, in a `content_block_delta` frame for a `text` block.
func (TextDelta) MarshalJSON ¶
MarshalJSON encodes TextDelta with its const properties filled in.
func (*TextDelta) UnmarshalJSON ¶
UnmarshalJSON decodes TextDelta strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
type TextPayload ¶
type TextPayload struct {
// The fragment. Append it to the run's earlier fragments of the same kind, in sequence order.
Text string `json:"text"`
}
One streamed fragment of a child agent's reply. It is the `event` of `agent.run.text.delta` and `agent.run.thinking.delta`.
func (*TextPayload) UnmarshalJSON ¶
func (v *TextPayload) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes TextPayload strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (TextPayload) Validate ¶
func (v TextPayload) Validate() error
Validate checks the constraints the schema declares for TextPayload.
type ThinkingDelta ¶
type ThinkingDelta struct {
// Always `thinking_delta`.
Type string `json:"type"`
// The fragment, never empty. Append it to the block's earlier fragments.
Text string `json:"text"`
}
A fragment of the model's reasoning, in a `content_block_delta` frame for a `thinking` block.
func (ThinkingDelta) MarshalJSON ¶
func (v ThinkingDelta) MarshalJSON() ([]byte, error)
MarshalJSON encodes ThinkingDelta with its const properties filled in.
func (*ThinkingDelta) UnmarshalJSON ¶
func (v *ThinkingDelta) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ThinkingDelta strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ThinkingDelta) Validate ¶
func (v ThinkingDelta) Validate() error
Validate checks the constraints the schema declares for ThinkingDelta.
type ToolResult ¶
type ToolResult struct {
// The call ID of the `tool.use` this result answers.
CallID string `json:"callId"`
// The name of the tool that ran.
Name string `json:"name"`
// The result text as Peen hands it to the model. A call still running when its turn or child run was stopped gets the fixed text "The tool call was stopped before it returned a result. Its effect is unknown." with `isError` set.
Content string `json:"content"`
// `true` when the tool reported an error or the call was stopped before it returned, `false` otherwise.
IsError bool `json:"isError"`
}
The outcome of one tool call. It is the `data` of a root `tool.result` frame and the `event` of a child's `agent.run.tool.result` frame. Every `tool.use` gets exactly one result, even when its turn is stopped or fails while the call runs.
func (*ToolResult) UnmarshalJSON ¶
func (v *ToolResult) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ToolResult strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ToolResult) Validate ¶
func (v ToolResult) Validate() error
Validate checks the constraints the schema declares for ToolResult.
type ToolResultEvent ¶
type ToolResultEvent struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `tool.result`. Switch on it to read `data`.
Type string `json:"type"`
// The outcome of one tool call. It is the `data` of a root `tool.result` frame and the `event` of a child's `agent.run.tool.result` frame. Every `tool.use` gets exactly one result, even when its turn is stopped or fails while the call runs.
Data ToolResult `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
A root tool call finished, or was stopped. Peen stores the call's result before it emits this frame, right before the call's `tool_result` content block. Calls in one round can run in parallel, so results can arrive in a different order from their `tool.use` frames. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (ToolResultEvent) MarshalJSON ¶
func (v ToolResultEvent) MarshalJSON() ([]byte, error)
MarshalJSON encodes ToolResultEvent with its const properties filled in.
func (*ToolResultEvent) UnmarshalJSON ¶
func (v *ToolResultEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ToolResultEvent strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ToolResultEvent) Validate ¶
func (v ToolResultEvent) Validate() error
Validate checks the constraints the schema declares for ToolResultEvent.
type ToolUse ¶
type ToolUse struct {
// The call ID the model assigned. The matching `tool.result`, the `tool_use` content block's `id`, and the `tool_result` block's `tool_use_id` carry the same value.
CallID string `json:"callId"`
// The name of the tool the model called, as the tool catalogue lists it. An MCP tool is named `mcp__<server>__<tool>`.
Name string `json:"name"`
// Open. The tool's own arguments, shaped by that tool, exactly as the provider returned them; null when the provider sent none.
Arguments map[string]any `json:"arguments"`
}
One tool call the model requested. It is the `data` of a root `tool.use` frame and the `event` of a child's `agent.run.tool.use` frame.
func (*ToolUse) UnmarshalJSON ¶
UnmarshalJSON decodes ToolUse strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
type ToolUseEvent ¶
type ToolUseEvent struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `tool.use`. Switch on it to read `data`.
Type string `json:"type"`
// One tool call the model requested. It is the `data` of a root `tool.use` frame and the `event` of a child's `agent.run.tool.use` frame.
Data ToolUse `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The model of the root conversation started a tool call. Peen emits it before the tool runs, right before the call's `tool_use` content block. A matching `tool.result` with the same `callId` always follows. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (ToolUseEvent) MarshalJSON ¶
func (v ToolUseEvent) MarshalJSON() ([]byte, error)
MarshalJSON encodes ToolUseEvent with its const properties filled in.
func (*ToolUseEvent) UnmarshalJSON ¶
func (v *ToolUseEvent) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes ToolUseEvent strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (ToolUseEvent) Validate ¶
func (v ToolUseEvent) Validate() error
Validate checks the constraints the schema declares for ToolUseEvent.
type TurnCancelled ¶
type TurnCancelled struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `turn.cancelled`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of a `turn.cancelled` frame.
Data TurnCancelledData `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The turn was stopped before it finished. It is the turn's last frame. Every tool call still running first gets a `tool.result` with `isError` set, and Peen stores a `turn.cancelled` session notice in the same transaction, so a `notice.created` frame for it follows nearby in the feed. A Stop leaves pending input stored until something explicitly continues the session. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (TurnCancelled) MarshalJSON ¶
func (v TurnCancelled) MarshalJSON() ([]byte, error)
MarshalJSON encodes TurnCancelled with its const properties filled in.
func (*TurnCancelled) UnmarshalJSON ¶
func (v *TurnCancelled) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes TurnCancelled strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (TurnCancelled) Validate ¶
func (v TurnCancelled) Validate() error
Validate checks the constraints the schema declares for TurnCancelled.
type TurnCancelledData ¶
type TurnCancelledData struct {
// Why the turn was stopped:
//
// - `cancelled`: something asked for the turn to stop, such as `POST /api/v1/session/cancel`, the browser Stop control, or shutting the controller down. The submission fails with `TURN_CANCELLED`.
// - `timeout`: the turn's deadline expired, from `timeoutSeconds` or `PEEN_TURN_TIMEOUT`. The submission fails with `TURN_TIMEOUT`.
Reason TurnCancelledDataReason `json:"reason"`
}
The `data` of a `turn.cancelled` frame.
func (*TurnCancelledData) UnmarshalJSON ¶
func (v *TurnCancelledData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes TurnCancelledData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (TurnCancelledData) Validate ¶
func (v TurnCancelledData) Validate() error
Validate checks the constraints the schema declares for TurnCancelledData.
type TurnCancelledDataReason ¶ added in v0.51.0
type TurnCancelledDataReason string
Why the turn was stopped:
- `cancelled`: something asked for the turn to stop, such as `POST /api/v1/session/cancel`, the browser Stop control, or shutting the controller down. The submission fails with `TURN_CANCELLED`. - `timeout`: the turn's deadline expired, from `timeoutSeconds` or `PEEN_TURN_TIMEOUT`. The submission fails with `TURN_TIMEOUT`.
const ( TurnCancelledDataReasonCancelled TurnCancelledDataReason = "cancelled" TurnCancelledDataReasonTimeout TurnCancelledDataReason = "timeout" )
Values of TurnCancelledDataReason.
func (TurnCancelledDataReason) Validate ¶ added in v0.51.0
func (v TurnCancelledDataReason) Validate() error
Validate reports whether v is one of the values the schema lists.
type TurnCompleted ¶
type TurnCompleted struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `turn.completed`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of a `turn.completed` frame. `GET /api/v1/session/turns` returns the same `output` and `outputError` with the stored turn.
Data TurnCompletedData `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The turn finished. It is the turn's last frame. Its messages are stored, and `GET /api/v1/messages` returns them. A message that started the turn then gets `message.completed` with `queued: false`. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (TurnCompleted) MarshalJSON ¶
func (v TurnCompleted) MarshalJSON() ([]byte, error)
MarshalJSON encodes TurnCompleted with its const properties filled in.
func (*TurnCompleted) UnmarshalJSON ¶
func (v *TurnCompleted) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes TurnCompleted strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (TurnCompleted) Validate ¶
func (v TurnCompleted) Validate() error
Validate checks the constraints the schema declares for TurnCompleted.
type TurnCompletedData ¶
type TurnCompletedData struct {
// The validated JSON value of the final answer. Present only when the message carried `outputSchema` and an attempt passed validation.
Output json.RawMessage `json:"output,omitempty"`
// Why no structured output attempt passed validation, or why the attempts stopped, such as reaching the turn token budget. Present only when the message carried `outputSchema` and no attempt passed. The turn still completes.
OutputError *string `json:"outputError,omitempty"`
// The model the turn ran on, as `provider/model`.
Model string `json:"model"`
// The model's final reply text. It can be empty, for example when the reply hit the output token limit while the model was still reasoning.
Text string `json:"text"`
// Why the model stopped its final reply, as the provider reported it, such as `stop`, or `length` when the reply reached the output token limit and was cut off. Absent when the provider reported no reason.
FinishReason *string `json:"finishReason,omitempty"`
}
The `data` of a `turn.completed` frame. `GET /api/v1/session/turns` returns the same `output` and `outputError` with the stored turn.
func (*TurnCompletedData) UnmarshalJSON ¶
func (v *TurnCompletedData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes TurnCompletedData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (TurnCompletedData) Validate ¶
func (v TurnCompletedData) Validate() error
Validate checks the constraints the schema declares for TurnCompletedData.
type TurnFailed ¶
type TurnFailed struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `turn.failed`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of a `turn.failed` frame.
Data TurnFailedData `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The turn ended with an error, or its worker or controller stopped before it ended. It is the turn's last frame. Every tool call still running first gets a `tool.result` with `isError` set, so every `tool.use` has a result. Peen stores a `turn.failed` session notice in the same transaction, so a `notice.created` frame for it follows nearby in the feed. A message that started the turn gets `message.failed`. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (TurnFailed) MarshalJSON ¶
func (v TurnFailed) MarshalJSON() ([]byte, error)
MarshalJSON encodes TurnFailed with its const properties filled in.
func (*TurnFailed) UnmarshalJSON ¶
func (v *TurnFailed) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes TurnFailed strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (TurnFailed) Validate ¶
func (v TurnFailed) Validate() error
Validate checks the constraints the schema declares for TurnFailed.
type TurnFailedData ¶
type TurnFailedData struct {
// Always `agentRun`.
Reason string `json:"reason"`
// The error the turn ended with, without source locations, cut to 2048 bytes. A turn whose worker or controller stopped before it ended reads `the worker or controller stopped mid-turn`. Absent when the turn failed before Peen recorded an error.
Error *string `json:"error,omitempty"`
}
The `data` of a `turn.failed` frame.
func (TurnFailedData) MarshalJSON ¶
func (v TurnFailedData) MarshalJSON() ([]byte, error)
MarshalJSON encodes TurnFailedData with its const properties filled in.
func (*TurnFailedData) UnmarshalJSON ¶
func (v *TurnFailedData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes TurnFailedData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (TurnFailedData) Validate ¶
func (v TurnFailedData) Validate() error
Validate checks the constraints the schema declares for TurnFailedData.
type TurnStarted ¶
type TurnStarted struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `turn.started`. Switch on it to read `data`.
Type string `json:"type"`
// The `data` of a `turn.started` frame. `originEventId` and `originEventType` are present only on a turn that a session event started.
Data TurnStartedData `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
The turn is set up and about to make its first model call. Peen emits it once per turn, after the frames that open the turn and before the first content block.
The frames of one turn arrive in sequence order, and every frame of the turn carries the turn's `metadata.requestId`. A turn's frames arrive in this order:
1. `userMessage.created` 2. one `skill.injected` per forced skill 3. `session.events` when notices were waiting 4. `harness.warning` when Peen ignored harness files 5. `mcp.status` 6. `turn.started` 7. the model rounds, each one made of content blocks, `tool.use` and `tool.result` frames, `provider.retry`, `session.events` delivered at tool boundaries, `question.asked` and `question.answered`, and the `userMessage.*` and `skill.injected` frames of queued messages 8. exactly one terminal frame, `turn.completed`, `turn.failed`, or `turn.cancelled`
`agent.run.*` and `notice.created` frames of the same session interleave in the same feed. The `message.completed` or `message.failed` that answers the submission is sent on a separate, unstored path, so do not rely on where it falls relative to the turn's stored frames.
Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (TurnStarted) MarshalJSON ¶
func (v TurnStarted) MarshalJSON() ([]byte, error)
MarshalJSON encodes TurnStarted with its const properties filled in.
func (*TurnStarted) UnmarshalJSON ¶
func (v *TurnStarted) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes TurnStarted strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (TurnStarted) Validate ¶
func (v TurnStarted) Validate() error
Validate checks the constraints the schema declares for TurnStarted.
type TurnStartedData ¶
type TurnStartedData struct {
// The session the turn runs in.
//
// Not enforced by the generated code: format uuid.
SessionID string `json:"sessionId"`
// The model the turn runs on, as `provider/model`: the message's `model`, or the deployment default.
Model string `json:"model"`
// The session's workspace directory, the canonical path the session was opened with.
Workspace string `json:"workspace"`
// The ID of the session notice whose event handler started this turn. Absent on a turn a message started.
//
// Not enforced by the generated code: format uuid.
OriginEventID *string `json:"originEventId,omitempty"`
// The event type of that notice, such as `ci.build.failed`. Absent on a turn a message started.
OriginEventType *string `json:"originEventType,omitempty"`
}
The `data` of a `turn.started` frame. `originEventId` and `originEventType` are present only on a turn that a session event started.
func (*TurnStartedData) UnmarshalJSON ¶
func (v *TurnStartedData) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes TurnStartedData strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (TurnStartedData) Validate ¶
func (v TurnStartedData) Validate() error
Validate checks the constraints the schema declares for TurnStartedData.
type UserMessage ¶
type UserMessage struct {
// The message text as it was accepted. For a turn a session event started, this is the event handler's instructions.
Message string `json:"message"`
// The `id` of the `message.send` frame that carried the message. Absent when no WebSocket frame carried it, such as a turn a session event started.
//
// Not enforced by the generated code: format uuid.
SourceEventID *string `json:"sourceEventId,omitempty"`
// The images the message carries, without their bytes. Absent when the message has none, and always absent on `userMessage.delivered`.
Images []UserMessageImage `json:"images,omitempty"`
}
A user message Peen accepted. It is the `data` of `userMessage.created`, `userMessage.queued`, and `userMessage.delivered`.
func (*UserMessage) UnmarshalJSON ¶
func (v *UserMessage) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes UserMessage strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (UserMessage) Validate ¶
func (v UserMessage) Validate() error
Validate checks the constraints the schema declares for UserMessage.
type UserMessageCreated ¶
type UserMessageCreated struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `userMessage.created`. Switch on it to read `data`.
Type string `json:"type"`
// A user message Peen accepted. It is the `data` of `userMessage.created`, `userMessage.queued`, and `userMessage.delivered`.
Data UserMessage `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
Peen accepted a user message. Every accepted `message.send` produces one, and so does every other turn start, such as a turn an event handler started. It is the first frame of a turn the message starts. For a message that joins a running turn it arrives among that turn's frames, carrying the queued message's own `metadata.requestId`, and `userMessage.queued` follows it. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (UserMessageCreated) MarshalJSON ¶
func (v UserMessageCreated) MarshalJSON() ([]byte, error)
MarshalJSON encodes UserMessageCreated with its const properties filled in.
func (*UserMessageCreated) UnmarshalJSON ¶
func (v *UserMessageCreated) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes UserMessageCreated strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (UserMessageCreated) Validate ¶
func (v UserMessageCreated) Validate() error
Validate checks the constraints the schema declares for UserMessageCreated.
type UserMessageDelivered ¶
type UserMessageDelivered struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `userMessage.delivered`. Switch on it to read `data`.
Type string `json:"type"`
// A user message Peen accepted. It is the `data` of `userMessage.created`, `userMessage.queued`, and `userMessage.delivered`.
Data UserMessage `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
A queued message reached the model. It carries the queued message's own `metadata.requestId`, so it pairs with that message's `userMessage.queued`. Queued messages are delivered in the order they were sent, one `userMessage.delivered` per message, followed by one `skill.injected` per skill message that came with it. Its `data` has no `images`. A queued message that never got a delivery frame is not necessarily lost: Peen keeps accepted messages until delivery. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (UserMessageDelivered) MarshalJSON ¶
func (v UserMessageDelivered) MarshalJSON() ([]byte, error)
MarshalJSON encodes UserMessageDelivered with its const properties filled in.
func (*UserMessageDelivered) UnmarshalJSON ¶
func (v *UserMessageDelivered) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes UserMessageDelivered strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (UserMessageDelivered) Validate ¶
func (v UserMessageDelivered) Validate() error
Validate checks the constraints the schema declares for UserMessageDelivered.
type UserMessageImage ¶ added in v0.38.0
type UserMessageImage struct {
// The image's media type, as the `message.send` frame gave it: `image/png`, `image/jpeg`, `image/gif`, or `image/webp`.
MediaType string `json:"mediaType"`
// The decoded size of the image in bytes.
SizeBytes int64 `json:"sizeBytes"`
}
One image a user message carries, described without its bytes. It appears in `userMessage.created` and `userMessage.queued`.
func (*UserMessageImage) UnmarshalJSON ¶ added in v0.38.0
func (v *UserMessageImage) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes UserMessageImage strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (UserMessageImage) Validate ¶ added in v0.38.0
func (v UserMessageImage) Validate() error
Validate checks the constraints the schema declares for UserMessageImage.
type UserMessageQueued ¶
type UserMessageQueued struct {
// The ID of the stored record this frame renders. It is the same live and on replay through `GET /api/v1/session/feed`, so you can use it to skip a frame you already applied.
//
// Not enforced by the generated code: format uuid.
ID string `json:"id"`
// The frame type, `userMessage.queued`. Switch on it to read `data`.
Type string `json:"type"`
// A user message Peen accepted. It is the `data` of `userMessage.created`, `userMessage.queued`, and `userMessage.delivered`.
Data UserMessage `json:"data"`
// When Peen stored the record, in Unix seconds. It is the same live and on replay, so it does not tell you which path delivered the frame.
Timestamp int64 `json:"timestamp"`
// Routing and cursor information carried in every frame's `metadata`. On `message.send` only `sessionId` is read. On server frames, which fields are present depends on the frame: see each property.
Metadata Metadata `json:"metadata"`
// Always `null` on a stored frame, because Peen renders it from the stored record the same way live and on replay. Correlate stored frames through `metadata.requestId` instead.
//
// Not enforced by the generated code: format uuid.
TriggeredBy *string `json:"triggeredBy,omitempty"`
}
An accepted message joined the running turn's queue. It follows that message's `userMessage.created` and carries the queued message's own `metadata.requestId`. The message reaches the model when the running turn's current model round ends, after every tool call in that round has finished, and `userMessage.delivered` reports that. Peen stores the frame before it sends it, gives it a `metadata.sequence`, and sends it to every socket that is not filtered and to every socket filtered to its session. `GET /api/v1/session/feed` replays it with the same `id`, `timestamp`, and data.
func (UserMessageQueued) MarshalJSON ¶
func (v UserMessageQueued) MarshalJSON() ([]byte, error)
MarshalJSON encodes UserMessageQueued with its const properties filled in.
func (*UserMessageQueued) UnmarshalJSON ¶
func (v *UserMessageQueued) UnmarshalJSON(data []byte) error
UnmarshalJSON decodes UserMessageQueued strictly. Required properties must be present and the decoded value must pass Validate. Properties the schema does not declare are rejected.
func (UserMessageQueued) Validate ¶
func (v UserMessageQueued) Validate() error
Validate checks the constraints the schema declares for UserMessageQueued.