Merge main into session-html-only: combine the html-only session export with chat-tool-group and chat-activity

This commit is contained in:
2026-10-18 10:06:54 +01:00
18 changed files with 1471 additions and 158 deletions
+31
View File
@@ -80,6 +80,17 @@ const (
ChatEventStep = "step"
ChatEventUsage = "usage"
ChatEventUser = "user"
// ChatEventShell reports the lifecycle of one shell the agent started. It
// carries no ChatPart and no message id: a shell can outlive the tool call
// that started it, so it is a frame of its own rather than a tool part.
ChatEventShell = "shell"
)
// ChatShell.Status values, mirroring the OpenCode shell events. A running shell
// is one whose command has started and not yet exited; exited is final.
const (
ChatShellRunning = "running"
ChatShellExited = "exited"
)
// ChatStep.Status values, mirroring the OpenCode session.step events.
@@ -292,6 +303,10 @@ type ChatEventFrame struct {
Part *ChatPart `json:"part,omitempty"`
Step *ChatStep `json:"step,omitempty"`
Usage *ChatUsage `json:"usage,omitempty"`
// Shell is the payload of a ChatEventShell frame: the shell's id, its
// status, the command it is running and (once it has exited) its exit code.
// It is nil on every other kind.
Shell *ChatShell `json:"shell,omitempty"`
// Client is the sending device's label on a user frame (ChatEventUser), so a
// transcript can say who sent the message. It is empty on assistant frames.
Client string `json:"client,omitempty"`
@@ -310,6 +325,22 @@ type ChatUsage struct {
Cost float64 `json:"cost,omitempty"`
}
// ChatShell is the state of one shell command the agent started, carried by a
// ChatEventShell frame. ID is the OpenCode shell id and is stable across its
// created and exited events, so a client keys a running process by it. Status is
// ChatShellRunning or ChatShellExited; Command is the command line the shell was
// given (present on the created event); Exit is the process exit code and is
// present only once the shell has exited — it is a pointer so an exit of 0 is
// distinguishable from "not exited yet". No credential, environment or output is
// carried: the command line is the only text, and only so the operator can name
// what is running.
type ChatShell struct {
ID string `json:"id"`
Status string `json:"status,omitempty"`
Command string `json:"command,omitempty"`
Exit *int `json:"exit,omitempty"`
}
// ChatPermissionFrame is the server-pushed chat_permission payload: one pending
// OpenCode permission request the phone must approve or reject. It is a distinct
// Message field (like ChatEvent) rather than a ChatEvent.Kind, so it does not