1package proto
2
3// Session represents a session in the proto layer.
4//
5// IsBusy is computed on read (it is not persisted with the session) and
6// reflects whether an agent run is currently in flight for this session.
7// It is populated by REST handlers in internal/server/proto.go from the
8// workspace's AgentCoordinator. The Session SSE event path does not set
9// it, since SSE consumers can compute presence from other agent signals.
10//
11// AttachedClients counts the number of clients currently viewing this
12// session — i.e. entries in the workspace's clients map whose
13// currentSessionID equals this session's ID and which have at least one
14// live SSE stream. Hold-only clients (streams == 0) do not contribute.
15// Like IsBusy, it is computed on read by REST handlers.
16type Session struct {
17 ID string `json:"id"`
18 ParentSessionID string `json:"parent_session_id"`
19 Title string `json:"title"`
20 MessageCount int64 `json:"message_count"`
21 PromptTokens int64 `json:"prompt_tokens"`
22 CompletionTokens int64 `json:"completion_tokens"`
23 SummaryMessageID string `json:"summary_message_id"`
24 Cost float64 `json:"cost"`
25 Todos []Todo `json:"todos,omitempty"`
26 CreatedAt int64 `json:"created_at"`
27 UpdatedAt int64 `json:"updated_at"`
28 IsBusy bool `json:"is_busy"`
29 AttachedClients int `json:"attached_clients"`
30}
31
32// Todo represents a single todo entry on a session in the proto layer.
33type Todo struct {
34 Content string `json:"content"`
35 Status string `json:"status"`
36 ActiveForm string `json:"active_form"`
37}