Documentation
¶
Overview ¶
Package activity turns a tool execution result into a compact, presentation -ready summary: a short structured Action (for a live-actions feed) and a one-line log string (for a curated codegen log). It exists so a consumer — airlock's build log, a Sol embedder's UI — can show "what the agent did" without echoing the full model-facing output (file contents, edited line bodies, full command output).
It deliberately takes primitives (tool name, input, title, metadata, output, outcome) rather than goai/sol types, so it has no dependency on the event or message packages and can be reused anywhere.
Index ¶
Constants ¶
const ( KindCommand = "command" KindSearch = "search" KindRead = "read" KindWrite = "write" KindEdit = "edit" KindTodo = "todo" KindExit = "exit" KindError = "error" KindDenied = "denied" KindTool = "tool" )
Kinds classify an Action for rendering. Stable strings — consumers may switch on them.
Variables ¶
This section is empty.
Functions ¶
func TodoCounts ¶
TodoCounts returns (completed, total) from a metadata["todos"] list, tolerating both the in-process []TodoItem-as-[]any and the JSON-round-tripped []any of map[string]any.
Types ¶
type Action ¶
type Action struct {
Kind string `json:"kind"`
Label string `json:"label"` // headline, e.g. "Read File: main.go"
Detail string `json:"detail,omitempty"` // secondary, e.g. "120 lines"
ToolCallID string `json:"toolCallId,omitempty"`
ToolName string `json:"toolName,omitempty"`
}
Action is a compact, structured description of one tool call.
func Summarize ¶
func Summarize(toolName string, input json.RawMessage, title string, metadata map[string]any, output, outcome string) Action
Summarize maps a tool result to a structured Action. outcome is "" for a normal result, "error" for a failed one, or "denied" for a refused one (mirroring message.ToolOutcome). title and metadata are the tool's Result.Title / Result.Metadata; output is the model-facing text.