turn.proto
Generated from proto/blitz/v1/turn.proto by proto-gen-md-diagrams.
| Import | Description |
|---|---|
| google/protobuf/duration.proto | |
| google/protobuf/struct.proto |
| Name | Value | Description |
|---|---|---|
| go_package | github.com/retail-cortex/blitz/proto/blitz/v1 |
classDiagram
direction LR
%% Mermaid Diagram for package: blitz.v1
%% A turn: one prompt to the agent and everything that happens until it answers. Mirrors pkg/api's Turn, Event and TurnResult. Turn is one prompt for the agent.
class Turn {
+ string text
+ string prompt
+ bool plan
+ string read_only
+ bool aside
+ bool accepted
+ List~string~ image_ids
+ int32 max_turns
+ List~string~ fetch_grants
+ double max_cost_usd
+ google.protobuf.Duration timeout
+ bool command
+ List~ContextBlock~ context
}
Turn --> `ContextBlock`
%% ContextBlock is content the user added to a turn from elsewhere.
class ContextBlock {
+ string kind
+ string url
+ string title
+ string html
+ string text
}
%% TurnEvent is something that happened during a turn. Events arrive in order; the last one is always `finished`.
class TurnEvent {
+ string author
+ Oneof~Accepted~ accepted [oneof: kind]
+ Oneof~Text~ text [oneof: kind]
+ Oneof~ToolCall~ tool_call [oneof: kind]
+ Oneof~ToolResult~ tool_result [oneof: kind]
+ Oneof~ApprovalRequest~ approval_request [oneof: kind]
+ Oneof~Question~ question [oneof: kind]
+ Oneof~TurnFinished~ finished [oneof: kind]
+ Oneof~Tasks~ tasks [oneof: kind]
+ Oneof~Notice~ notice [oneof: kind]
+ Oneof~FlowStep~ flow_step [oneof: kind]
}
TurnEvent --> `Accepted`
TurnEvent --> `Text`
TurnEvent --> `ToolCall`
TurnEvent --> `ToolResult`
TurnEvent --> `ApprovalRequest`
TurnEvent --> `Question`
TurnEvent --> `TurnFinished`
TurnEvent --> `Tasks`
TurnEvent --> `Notice`
TurnEvent --> `FlowStep`
%% A workflow's step starting, or how it ended.
class FlowStep {
+ string workflow
+ string id
+ string title
+ string type
+ int32 index
+ int32 count
+ string status
+ string output
+ string error
+ string run
}
%% A message from Blitz itself about a turn.
class Notice {
+ string text
+ bool error
+ bool transient
}
%% Tasks is the agent's task list (the todo tool).
class Tasks {
+ List~Task~ items
}
Tasks --> `Task`
%% One item of the agent's task list (the todo tool): its text and state.
class Task {
+ string content
+ string status
}
%% Accepted marks the prompt as recorded and about to be sent.
class Accepted {
}
%% Text is model output. With streaming, partial chunks arrive first and a final event then repeats them in full (repeat); without streaming only final text arrives. To show text once, show partial chunks and final text that isn't a repeat.
class Text {
+ string text
+ bool partial
+ bool repeat
+ bool thought
}
%% ToolCall is the agent calling a tool.
class ToolCall {
+ string id
+ string name
+ google.protobuf.Struct args
+ bool partial
}
%% ToolResult is what a tool returned.
class ToolResult {
+ string id
+ string name
+ google.protobuf.Struct result
}
%% ApprovalRequest asks permission for one action.
class ApprovalRequest {
+ string request_id
+ string tool
+ ActionKind kind
+ string detail
+ string diff
+ string scope_label
+ string agent
+ string task_id
}
ApprovalRequest --> `ActionKind`
%% Question is the agent asking the user something.
class Question {
+ string request_id
+ string question
+ List~string~ options
+ string agent
+ string task_id
+ bool multi_select
}
%% Usage is the token usage and estimated cost of a session.
class Usage {
+ int32 calls
+ int64 input
+ int64 cached
+ int64 cache_write
+ int64 output
+ int64 last_prompt
+ double cost_usd
+ bool priced
+ int32 search_queries
+ double search_cost_usd
}
%% TurnFinished ends a turn's events.
class TurnFinished {
+ string output
+ Usage before
+ Usage after
+ List~string~ leftover
+ ErrorInfo error
}
TurnFinished --> `Usage`
TurnFinished --> `Usage`
TurnFinished --> `ErrorInfo`
%% ErrorInfo is a machine-readable error, also attached to failed calls as a Connect error detail. Clients word and localise it from reason and metadata; message is an English fallback.
class ErrorInfo {
+ string reason
+ Map~string, string~ metadata
+ string message
}
%% ActionKind is the kind of action an approval covers.
class ActionKind{
<<enumeration>>
ACTION_KIND_UNSPECIFIED
ACTION_KIND_COMMAND
ACTION_KIND_WRITE
ACTION_KIND_DELETE
ACTION_KIND_NETWORK
ACTION_KIND_MCP
}
%% Decision answers an ApprovalRequest.
class Decision{
<<enumeration>>
DECISION_UNSPECIFIED
DECISION_DENY
DECISION_ONCE
DECISION_SESSION
DECISION_ALWAYS
}
FQN: blitz.v1.ActionKind
ActionKind is the kind of action an approval covers.
| Name | Ordinal | Description |
|---|---|---|
| ACTION_KIND_UNSPECIFIED | 0 | |
| ACTION_KIND_COMMAND | 1 | A shell command or a forged tool. |
| ACTION_KIND_WRITE | 2 | Creating or editing a file. |
| ACTION_KIND_DELETE | 3 | |
| ACTION_KIND_NETWORK | 4 | An outbound web request. |
| ACTION_KIND_MCP | 5 | A tool served by an MCP server. |
FQN: blitz.v1.Decision
Decision answers an ApprovalRequest.
| Name | Ordinal | Description |
|---|---|---|
| DECISION_UNSPECIFIED | 0 | |
| DECISION_DENY | 1 | |
| DECISION_ONCE | 2 | Allow this one action. |
| DECISION_SESSION | 3 | Allow actions with the same scope until the service restarts. |
| DECISION_ALWAYS | 4 | Allow actions with the same scope, saved. |
classDiagram
direction LR
%% ActionKind is the kind of action an approval covers.
class ActionKind{
<<enumeration>>
ACTION_KIND_UNSPECIFIED
ACTION_KIND_COMMAND
ACTION_KIND_WRITE
ACTION_KIND_DELETE
ACTION_KIND_NETWORK
ACTION_KIND_MCP
}
classDiagram
direction LR
%% Decision answers an ApprovalRequest.
class Decision{
<<enumeration>>
DECISION_UNSPECIFIED
DECISION_DENY
DECISION_ONCE
DECISION_SESSION
DECISION_ALWAYS
}
classDiagram
direction LR
%% A turn: one prompt to the agent and everything that happens until it answers. Mirrors pkg/api's Turn, Event and TurnResult. Turn is one prompt for the agent.
class Turn {
+ string text
+ string prompt
+ bool plan
+ string read_only
+ bool aside
+ bool accepted
+ List~string~ image_ids
+ int32 max_turns
+ List~string~ fetch_grants
+ double max_cost_usd
+ google.protobuf.Duration timeout
+ bool command
+ List~ContextBlock~ context
}
Turn --> `ContextBlock`
classDiagram
direction LR
%% ContextBlock is content the user added to a turn from elsewhere.
class ContextBlock {
+ string kind
+ string url
+ string title
+ string html
+ string text
}
classDiagram
direction LR
%% TurnEvent is something that happened during a turn. Events arrive in order; the last one is always `finished`.
class TurnEvent {
+ string author
+ Oneof~Accepted~ accepted [oneof: kind]
+ Oneof~Text~ text [oneof: kind]
+ Oneof~ToolCall~ tool_call [oneof: kind]
+ Oneof~ToolResult~ tool_result [oneof: kind]
+ Oneof~ApprovalRequest~ approval_request [oneof: kind]
+ Oneof~Question~ question [oneof: kind]
+ Oneof~TurnFinished~ finished [oneof: kind]
+ Oneof~Tasks~ tasks [oneof: kind]
+ Oneof~Notice~ notice [oneof: kind]
+ Oneof~FlowStep~ flow_step [oneof: kind]
}
TurnEvent --> `Accepted`
TurnEvent --> `Text`
TurnEvent --> `ToolCall`
TurnEvent --> `ToolResult`
TurnEvent --> `ApprovalRequest`
TurnEvent --> `Question`
TurnEvent --> `TurnFinished`
TurnEvent --> `Tasks`
TurnEvent --> `Notice`
TurnEvent --> `FlowStep`
classDiagram
direction LR
%% A workflow's step starting, or how it ended.
class FlowStep {
+ string workflow
+ string id
+ string title
+ string type
+ int32 index
+ int32 count
+ string status
+ string output
+ string error
+ string run
}
classDiagram
direction LR
%% A message from Blitz itself about a turn.
class Notice {
+ string text
+ bool error
+ bool transient
}
classDiagram
direction LR
%% Tasks is the agent's task list (the todo tool).
class Tasks {
+ List~Task~ items
}
Tasks --> `Task`
classDiagram
direction LR
%% One item of the agent's task list (the todo tool): its text and state.
class Task {
+ string content
+ string status
}
classDiagram
direction LR
%% Accepted marks the prompt as recorded and about to be sent.
class Accepted {
}
classDiagram
direction LR
%% Text is model output. With streaming, partial chunks arrive first and a final event then repeats them in full (repeat); without streaming only final text arrives. To show text once, show partial chunks and final text that isn't a repeat.
class Text {
+ string text
+ bool partial
+ bool repeat
+ bool thought
}
classDiagram
direction LR
%% ToolCall is the agent calling a tool.
class ToolCall {
+ string id
+ string name
+ google.protobuf.Struct args
+ bool partial
}
classDiagram
direction LR
%% ToolResult is what a tool returned.
class ToolResult {
+ string id
+ string name
+ google.protobuf.Struct result
}
classDiagram
direction LR
%% ApprovalRequest asks permission for one action.
class ApprovalRequest {
+ string request_id
+ string tool
+ ActionKind kind
+ string detail
+ string diff
+ string scope_label
+ string agent
+ string task_id
}
ApprovalRequest --> `ActionKind`
classDiagram
direction LR
%% Question is the agent asking the user something.
class Question {
+ string request_id
+ string question
+ List~string~ options
+ string agent
+ string task_id
+ bool multi_select
}
classDiagram
direction LR
%% Usage is the token usage and estimated cost of a session.
class Usage {
+ int32 calls
+ int64 input
+ int64 cached
+ int64 cache_write
+ int64 output
+ int64 last_prompt
+ double cost_usd
+ bool priced
+ int32 search_queries
+ double search_cost_usd
}
classDiagram
direction LR
%% TurnFinished ends a turn's events.
class TurnFinished {
+ string output
+ Usage before
+ Usage after
+ List~string~ leftover
+ ErrorInfo error
}
TurnFinished --> `Usage`
TurnFinished --> `Usage`
TurnFinished --> `ErrorInfo`
classDiagram
direction LR
%% ErrorInfo is a machine-readable error, also attached to failed calls as a Connect error detail. Clients word and localise it from reason and metadata; message is an English fallback.
class ErrorInfo {
+ string reason
+ Map~string, string~ metadata
+ string message
}
FQN: blitz.v1.Turn
A turn: one prompt to the agent and everything that happens until it answers. Mirrors pkg/api's Turn, Event and TurnResult. Turn is one prompt for the agent.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| text | 1 | string | What the user typed. prompt_submit hooks see it and the transcript records it. | |
| prompt | 2 | string | Sent to the agent instead of text, if set (e.g. search results); the transcript still records text. | |
| plan | 3 | bool | text is a goal to plan for: tools that change anything are refused, and the transcript records “/plan <text>”. | |
| read_only | 4 | string | Names a mode that refuses the same tools as plan mode (“search”). | |
| aside | 5 | bool | A side question, answered in a throwaway copy of the session and recorded nowhere. | |
| accepted | 6 | bool | text already passed prompt_submit hooks and was recorded (a steer message that arrived after the agent’s last tool call). | |
| image_ids | 7 | string | Repeated | Images to send with the prompt, by ID (from LoadImage or AddImage). |
| max_turns | 8 | int32 | Limits the model calls in the turn (0: unlimited). | |
| fetch_grants | 9 | string | Repeated | URLs the agent may fetch in this turn without asking (the pages a web search handed it). |
| max_cost_usd | 10 | double | Stops the turn once it has cost more than this, in USD (0: unlimited; only enforced when the model has a price). The turn fails with reason COST_LIMIT. | |
| timeout | 11 | google.protobuf.Duration | Stops the turn after this long (unset: unlimited). The turn fails with reason TIME_LIMIT. | |
| command | 12 | bool | text is a custom slash command ("/name args"): it is expanded into the command’s prompt, agent, model, tools and plan mode; the transcript records text. An unknown command fails with UNKNOWN_COMMAND. | |
| context | 13 | ContextBlock | Repeated | What the user added from outside the workspace (the desktop app’s web preview: a page, a selection, its console’s errors), given to the agent as content to read, never as instructions; the transcript notes each block’s title and URL. |
FQN: blitz.v1.ContextBlock
ContextBlock is content the user added to a turn from elsewhere.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| kind | 1 | string | What it is: “web_page”, “web_selection” or “console”. | |
| url | 2 | string | Where it came from. | |
| title | 3 | string | The page’s title. | |
| html | 4 | string | The content as HTML (a page, a selection), made into text by the service; at most 2 MB. | |
| text | 5 | string | The content as text (the console’s errors), used when html is empty. |
FQN: blitz.v1.TurnEvent
TurnEvent is something that happened during a turn. Events arrive in order; the last one is always `finished`.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| author | 1 | string | The agent that produced the event (a sub-agent’s name when one is working); empty for events from Blitz itself. | |
| accepted | 2 | Accepted | Oneof (kind) | The prompt passed prompt_submit hooks and was recorded; from here on the client may send steer messages. |
| text | 3 | Text | Oneof (kind) | |
| tool_call | 4 | ToolCall | Oneof (kind) | |
| tool_result | 5 | ToolResult | Oneof (kind) | |
| approval_request | 6 | ApprovalRequest | Oneof (kind) | The agent wants to do something that needs permission. Answer with Approve; until then the agent waits. |
| question | 7 | Question | Oneof (kind) | The agent asks the user a question. Answer with Answer. |
| finished | 8 | TurnFinished | Oneof (kind) | |
| tasks | 9 | Tasks | Oneof (kind) | The agent’s task list, whole, each time it changes. |
| notice | 10 | Notice | Oneof (kind) | Something the user should know about the turn that isn’t the agent’s output, such as a message that couldn’t be saved. |
| flow_step | 11 | FlowStep | Oneof (kind) | A workflow’s step starting or ending (spec_workflows_043). |
FQN: blitz.v1.FlowStep
A workflow's step starting, or how it ended.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| workflow | 1 | string | ||
| id | 2 | string | ||
| title | 3 | string | ||
| type | 4 | string | agent, refine, summarize, accumulate, browser, script, read_file or save_file. | |
| index | 5 | int32 | Step index of count, from 1. | |
| count | 6 | int32 | ||
| status | 7 | string | running, done or failed. | |
| output | 8 | string | What it produced, ended (the start of it). | |
| error | 9 | string | ||
| run | 10 | string | The run’s ID (its receipt’s: GetWorkflowRun). |
FQN: blitz.v1.Notice
A message from Blitz itself about a turn.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| text | 1 | string | ||
| error | 2 | bool | Something went wrong (shown as an error), else information. | |
| transient | 3 | bool | A passing status (the model’s connection dropped and is being retried), shown briefly (the desktop’s snackbar) rather than kept in the chat. |
FQN: blitz.v1.Tasks
Tasks is the agent's task list (the todo tool).
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| items | 1 | Task | Repeated |
FQN: blitz.v1.Task
One item of the agent's task list (the todo tool): its text and state.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| content | 1 | string | ||
| status | 2 | string | pending, in_progress or done. |
FQN: blitz.v1.Accepted
Accepted marks the prompt as recorded and about to be sent.
| Field | Ordinal | Type | Label | Description |
|---|
FQN: blitz.v1.Text
Text is model output. With streaming, partial chunks arrive first and a final event then repeats them in full (repeat); without streaming only final text arrives. To show text once, show partial chunks and final text that isn't a repeat.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| text | 1 | string | ||
| partial | 2 | bool | ||
| repeat | 3 | bool | Final text whose partial chunks were already delivered. | |
| thought | 4 | bool | The model’s reasoning rather than its answer. |
FQN: blitz.v1.ToolCall
ToolCall is the agent calling a tool.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| id | 1 | string | Matches the ToolResult. | |
| name | 2 | string | ||
| args | 3 | google.protobuf.Struct | ||
| partial | 4 | bool | Arrived in a streamed chunk; the final event repeats it. |
FQN: blitz.v1.ToolResult
ToolResult is what a tool returned.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| id | 1 | string | ||
| name | 2 | string | ||
| result | 3 | google.protobuf.Struct |
FQN: blitz.v1.ApprovalRequest
ApprovalRequest asks permission for one action.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| request_id | 1 | string | Identifies the request for Approve. | |
| tool | 2 | string | ||
| kind | 3 | ActionKind | ||
| detail | 4 | string | What will happen: the command, the path, the URL. | |
| diff | 5 | string | For writes, the change as a unified diff. | |
| scope_label | 6 | string | What “for this session” and “always” would cover, for people (“this exact command in this workspace”). | |
| agent | 7 | string | Who asks, when it’s a background task: its agent and ID (empty for the turn’s own agent). | |
| task_id | 8 | string |
FQN: blitz.v1.Question
Question is the agent asking the user something.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| request_id | 1 | string | Identifies the question for Answer. | |
| question | 2 | string | ||
| options | 3 | string | Repeated | Suggested answers; the user may also answer freely. |
| agent | 4 | string | Who asks, when it’s a background task: its agent and ID. | |
| task_id | 5 | string | ||
| multi_select | 6 | bool | Several options may be chosen: the answer is them, one per line. |
FQN: blitz.v1.Usage
Usage is the token usage and estimated cost of a session.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| calls | 1 | int32 | ||
| input | 2 | int64 | Prompt tokens, including cached ones. | |
| cached | 3 | int64 | ||
| cache_write | 4 | int64 | Prompt tokens written to the cache (part of input). | |
| output | 5 | int64 | Output and thinking tokens. | |
| last_prompt | 6 | int64 | The latest prompt’s size: the current context size. | |
| cost_usd | 7 | double | ||
| priced | 8 | bool | False if any call’s model has no known price, so cost_usd is short. | |
| search_queries | 9 | int32 | Web search queries a provider billed (Google’s grounding), and their estimated price: not part of cost_usd. | |
| search_cost_usd | 10 | double |
FQN: blitz.v1.TurnFinished
TurnFinished ends a turn's events.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| output | 1 | string | The model’s final answer text (partial and thought text excluded). | |
| before | 2 | Usage | The session’s usage before and after the turn. | |
| after | 3 | Usage | ||
| leftover | 4 | string | Repeated | Steer messages sent after the agent’s last tool call, so never read. Send them as the next turn (with accepted set), or drop them if the turn was interrupted. |
| error | 5 | ErrorInfo | Why the turn failed, if it did; output holds what it produced first. A prompt refused by a hook fails with reason “PROMPT_BLOCKED”. |
FQN: blitz.v1.ErrorInfo
ErrorInfo is a machine-readable error, also attached to failed calls as a Connect error detail. Clients word and localise it from reason and metadata; message is an English fallback.
| Field | Ordinal | Type | Label | Description |
|---|---|---|---|---|
| reason | 1 | string | e.g. “UNKNOWN_AGENT”, “NO_ACTIVE_SESSION”, “PROMPT_BLOCKED”. | |
| metadata | 2 | string, string | Map | Values for the reason, e.g. {“name”: “reviewer”}. |
| message | 3 | string |