v0.3.68 a98ca1a

events.go RawHistoryFolder

1package core
2
3import (
4	"encoding/json"
5
6	"github.com/patriceckhart/zot/packages/provider"
7)
8
9// AgentEvent is the superset of events emitted by an Agent run.
10// Consumers discriminate via a type switch. Each concrete type has a
11// Type() method for JSON serialization.
12type AgentEvent interface {
13	Type() string
14}
15
16type EvTurnStart struct {
17	Step int
18}
19
20func (EvTurnStart) Type() string { return "turn_start" }
21
22// EvPromptSubmit observes accepted model input before it is appended or queued.
23// Queued input can subsequently be withdrawn without reaching the model.
24type EvPromptSubmit struct {
25	Text       string
26	Queued     bool
27	ImageCount int
28}
29
30func (EvPromptSubmit) Type() string { return "user_prompt_submit" }
31
32type EvUserMessage struct {
33	Message provider.Message
34}
35
36func (EvUserMessage) Type() string { return "user_message" }
37
38type EvAssistantStart struct{}
39
40func (EvAssistantStart) Type() string { return "assistant_start" }
41
42type EvTextDelta struct {
43	Delta string
44}
45
46func (EvTextDelta) Type() string { return "text_delta" }
47
48type EvToolCall struct {
49	ID   string
50	Name string
51	Args json.RawMessage
52}
53
54func (EvToolCall) Type() string { return "tool_call" }
55
56// EvToolUseStart fires the moment the provider announces a new
57// tool_use block during streaming, before any arg JSON has
58// arrived. Gives UIs a hook to pre-render a live "tool is being
59// composed" panel so the user sees the model typing the call in
60// real time. Name is already final at this point; Args is empty.
61type EvToolUseStart struct {
62	ID   string
63	Name string
64}
65
66func (EvToolUseStart) Type() string { return "tool_use_start" }
67
68// EvToolUseArgs fires for each delta fragment of the tool_use
69// block's argument JSON. Concatenating every delta for a given
70// ID produces the full JSON string; during streaming it's likely
71// truncated mid-value. UIs can extract partial string fields
72// (e.g. the `content` arg of `write`) with an escape-aware scan.
73type EvToolUseArgs struct {
74	ID    string
75	Delta string
76}
77
78func (EvToolUseArgs) Type() string { return "tool_use_args" }
79
80// EvToolUseEnd fires when the provider marks the tool_use block
81// complete. At this point the full args JSON is known; a separate
82// EvToolCall follows once the assistant message is assembled,
83// carrying the parsed block that actually runs.
84type EvToolUseEnd struct {
85	ID string
86}
87
88func (EvToolUseEnd) Type() string { return "tool_use_end" }
89
90type EvToolProgress struct {
91	ID   string
92	Text string
93}
94
95func (EvToolProgress) Type() string { return "tool_progress" }
96
97type EvToolResult struct {
98	ID       string
99	Name     string
100	Args     json.RawMessage // effective arguments, or last proposed arguments if blocked
101	Status   string          // completed, failed, blocked, cancelled, timed_out
102	Executed bool            // whether Tool.Execute was entered
103	Result   ToolResult
104}
105
106func (EvToolResult) Type() string { return "tool_result" }
107
108// EvCompact brackets a compaction attempt, including failed and cancelled attempts.
109// TokenEstimate is a rough text estimate, not provider token usage.
110type EvCompact struct {
111	Phase         string
112	ID            string
113	MessageCount  int
114	TokenEstimate int
115	Status        string
116	Err           error
117}
118
119func (e EvCompact) Type() string { return e.Phase + "_compact" }
120
121type EvUsage struct {
122	Usage      provider.Usage
123	Cumulative provider.Usage
124}
125
126func (EvUsage) Type() string { return "usage" }
127
128type EvAssistantMessage struct {
129	Message provider.Message
130}
131
132func (EvAssistantMessage) Type() string { return "assistant_message" }
133
134type EvTurnEnd struct {
135	Stop provider.StopReason
136	Err  error
137}
138
139func (EvTurnEnd) Type() string { return "turn_end" }
140
141type EvDone struct{}
142
143func (EvDone) Type() string { return "done" }
144
145type EvError struct {
146	Err error
147}
148
149func (EvError) Type() string { return "error" }

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close