v0.2.99 4d92b3d

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
22type EvUserMessage struct {
23	Message provider.Message
24}
25
26func (EvUserMessage) Type() string { return "user_message" }
27
28type EvAssistantStart struct{}
29
30func (EvAssistantStart) Type() string { return "assistant_start" }
31
32type EvTextDelta struct {
33	Delta string
34}
35
36func (EvTextDelta) Type() string { return "text_delta" }
37
38type EvToolCall struct {
39	ID   string
40	Name string
41	Args json.RawMessage
42}
43
44func (EvToolCall) Type() string { return "tool_call" }
45
46// EvToolUseStart fires the moment the provider announces a new
47// tool_use block during streaming, before any arg JSON has
48// arrived. Gives UIs a hook to pre-render a live "tool is being
49// composed" panel so the user sees the model typing the call in
50// real time. Name is already final at this point; Args is empty.
51type EvToolUseStart struct {
52	ID   string
53	Name string
54}
55
56func (EvToolUseStart) Type() string { return "tool_use_start" }
57
58// EvToolUseArgs fires for each delta fragment of the tool_use
59// block's argument JSON. Concatenating every delta for a given
60// ID produces the full JSON string; during streaming it's likely
61// truncated mid-value. UIs can extract partial string fields
62// (e.g. the `content` arg of `write`) with an escape-aware scan.
63type EvToolUseArgs struct {
64	ID    string
65	Delta string
66}
67
68func (EvToolUseArgs) Type() string { return "tool_use_args" }
69
70// EvToolUseEnd fires when the provider marks the tool_use block
71// complete. At this point the full args JSON is known; a separate
72// EvToolCall follows once the assistant message is assembled,
73// carrying the parsed block that actually runs.
74type EvToolUseEnd struct {
75	ID string
76}
77
78func (EvToolUseEnd) Type() string { return "tool_use_end" }
79
80type EvToolProgress struct {
81	ID   string
82	Text string
83}
84
85func (EvToolProgress) Type() string { return "tool_progress" }
86
87type EvToolResult struct {
88	ID     string
89	Result ToolResult
90}
91
92func (EvToolResult) Type() string { return "tool_result" }
93
94type EvUsage struct {
95	Usage      provider.Usage
96	Cumulative provider.Usage
97}
98
99func (EvUsage) Type() string { return "usage" }
100
101type EvAssistantMessage struct {
102	Message provider.Message
103}
104
105func (EvAssistantMessage) Type() string { return "assistant_message" }
106
107type EvTurnEnd struct {
108	Stop provider.StopReason
109	Err  error
110}
111
112func (EvTurnEnd) Type() string { return "turn_end" }
113
114type EvDone struct{}
115
116func (EvDone) Type() string { return "done" }
117
118type EvError struct {
119	Err error
120}
121
122func (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