Documentation
¶
Overview ¶
Package event defines the session event log model.
Index ¶
- type AssistantDeltaPayload
- type AssistantMessagePayload
- type ContextCompactedPayload
- type ErrorPayload
- type Event
- type JurisdictionWarningPayload
- type MCPServerInfo
- type McpServerDownPayload
- type PermissionRequestedPayload
- type PermissionResolvedPayload
- type RedactionAppliedPayload
- type SessionStartedPayload
- type Sink
- type ToolCallRequestedPayload
- type ToolResultPayload
- type TurnCompletedPayload
- type Type
- type UserMessagePayload
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AssistantDeltaPayload ¶
type AssistantDeltaPayload struct {
Text string `json:"text"`
}
AssistantDeltaPayload carries a streamed fragment of an assistant reply.
type AssistantMessagePayload ¶
type AssistantMessagePayload struct {
Text string `json:"text"`
ToolCalls []llm.ToolCall `json:"tool_calls,omitempty"`
Incomplete bool `json:"incomplete"`
}
AssistantMessagePayload carries a complete assistant reply.
type ContextCompactedPayload ¶
type ContextCompactedPayload struct {
Summary string `json:"summary"`
Replaced int `json:"replaced"`
TokensBefore int `json:"tokens_before"`
TokensAfter int `json:"tokens_after"`
}
ContextCompactedPayload records a context compaction: the first Replaced conversation messages (the system prompt excluded) were replaced by one user message carrying Summary. Token counts are estimates.
type ErrorPayload ¶
ErrorPayload reports a failure.
type Event ¶
type Event struct {
ID string `json:"id"` // "<session>-<seq>"
Session string `json:"session"`
Seq uint64 `json:"seq"`
TS time.Time `json:"ts"`
Type Type `json:"type"`
Payload json.RawMessage `json:"payload"`
}
Event is one entry of a session log.
type JurisdictionWarningPayload ¶
type JurisdictionWarningPayload struct {
Provider llm.ProviderInfo `json:"provider"`
}
JurisdictionWarningPayload warns that a provider lies outside the preferred jurisdiction.
type MCPServerInfo ¶
type MCPServerInfo struct {
ID string `json:"id"`
Jurisdiction llm.Jurisdiction `json:"jurisdiction"`
Country string `json:"country,omitempty"`
}
MCPServerInfo describes an active MCP server (values from the configuration).
type McpServerDownPayload ¶
McpServerDownPayload reports an MCP server that is unreachable (at start or during a call). Error is user-facing text.
type PermissionRequestedPayload ¶
type PermissionRequestedPayload struct {
PermissionID string `json:"permission_id"`
Kind string `json:"kind"`
Tool string `json:"tool"`
Paths []string `json:"paths,omitempty"`
Command string `json:"command"`
Provider *llm.ProviderInfo `json:"provider,omitempty"`
}
PermissionRequestedPayload asks for approval of a tool or jurisdiction action. Kind is "tool" or "jurisdiction".
type PermissionResolvedPayload ¶
type PermissionResolvedPayload struct {
PermissionID string `json:"permission_id"`
Allowed bool `json:"allowed"`
Remember bool `json:"remember"`
}
PermissionResolvedPayload records the answer to a permission request.
type RedactionAppliedPayload ¶
RedactionAppliedPayload counts secrets redacted before sending.
type SessionStartedPayload ¶
type SessionStartedPayload struct {
Provider llm.ProviderInfo `json:"provider"`
ProjectRoot string `json:"project_root"`
// Resumed is true when the session was rebuilt from its persisted events.
Resumed bool `json:"resumed,omitempty"`
// Instructions lists the project instruction files loaded (e.g. AGENTS.md).
Instructions []string `json:"instructions,omitempty"`
// MCP lists the MCP servers active for the session (omitted when none).
MCP []MCPServerInfo `json:"mcp,omitempty"`
}
SessionStartedPayload opens a session.
type ToolCallRequestedPayload ¶
type ToolCallRequestedPayload struct {
CallID string `json:"call_id"`
Tool string `json:"tool"`
Args json.RawMessage `json:"args"`
}
ToolCallRequestedPayload records a tool call requested by the model.
type ToolResultPayload ¶
type ToolResultPayload struct {
CallID string `json:"call_id"`
Tool string `json:"tool"`
Content string `json:"content"`
IsError bool `json:"is_error"`
Path string `json:"path"`
HashBefore string `json:"hash_before"`
HashAfter string `json:"hash_after"`
Denied string `json:"denied,omitempty"`
}
ToolResultPayload records the outcome of a tool run. Denied is "policy" when the permission engine or a policy guard refused the call, "user" when the user refused a permission request, and empty otherwise.
type TurnCompletedPayload ¶
type TurnCompletedPayload struct {
Iterations int `json:"iterations"`
Reason string `json:"reason"`
}
TurnCompletedPayload ends a turn. Reason is "done", "max_iterations", "incomplete", "blocked", "cancelled" or "context_too_large".
type Type ¶
type Type string
Type names the kind of an event. Its value is the constant name.
const ( SessionStarted Type = "SessionStarted" UserMessage Type = "UserMessage" ContextCompacted Type = "ContextCompacted" JurisdictionWarning Type = "JurisdictionWarning" RedactionApplied Type = "RedactionApplied" AssistantDelta Type = "AssistantDelta" AssistantMessage Type = "AssistantMessage" ToolCallRequested Type = "ToolCallRequested" PermissionRequested Type = "PermissionRequested" PermissionResolved Type = "PermissionResolved" ToolResult Type = "ToolResult" McpServerDown Type = "McpServerDown" TurnCompleted Type = "TurnCompleted" Error Type = "Error" )
type UserMessagePayload ¶
type UserMessagePayload struct {
// Text is what the model receives.
Text string `json:"text"`
// Typed is what the user actually typed; UIs show it instead of Text when set.
Typed string `json:"typed,omitempty"`
// Skill is the name of the skill that produced Text, if any.
Skill string `json:"skill,omitempty"`
// SkillSHA256 is the hash of the skill file content used, if any.
SkillSHA256 string `json:"skill_sha256,omitempty"`
}
UserMessagePayload carries a user message.