Merge branch 'main' into retry-from-failed-stage

This commit is contained in:
2026-10-18 20:38:06 +01:00
15 changed files with 782 additions and 11 deletions
+28 -2
View File
@@ -54,6 +54,10 @@ const (
// load the choices without first listing sessions and chat_sessions stays a
// pure, fail-closed operator-session list.
ChatDirectories = "chat_directories"
// ChatShells lists current, verified shells belonging to one operator chat
// session. ChatShellOutput reads a bounded page from one such shell.
ChatShells = "chat_shells"
ChatShellOutput = "chat_shell_output"
// ChatEvent and ChatPermission are the server-pushed frames; they are the
// only types the server sends without a matching request.
ChatEvent = "chat_event"
@@ -89,8 +93,10 @@ const (
// 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"
ChatShellRunning = "running"
ChatShellExited = "exited"
ChatShellOutputLimit = 64 << 10
ChatShellOutputMaxCursor = int64(1 << 62)
)
// ChatStep.Status values, mirroring the OpenCode session.step events.
@@ -360,6 +366,26 @@ type ChatShell struct {
Exit *int `json:"exit,omitempty"`
}
// ChatShellOutputQuery names one selected shell and a bounded absolute-byte
// output page. Cursor is decimal so it can be passed directly to OpenCode.
type ChatShellOutputQuery struct {
SessionID string `json:"session_id"`
ShellID string `json:"shell_id"`
Cursor int64 `json:"cursor,omitempty"`
Limit int `json:"limit,omitempty"`
}
// ChatShellOutputPage is a bounded, lazy output read. Unavailable is explicit when
// an exited shell is no longer directly verifiable upstream.
type ChatShellOutputPage struct {
Shell ChatShell `json:"shell"`
Output string `json:"output,omitempty"`
Cursor int64 `json:"cursor,omitempty"`
Size int64 `json:"size,omitempty"`
Truncated bool `json:"truncated,omitempty"`
Unavailable bool `json:"unavailable,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
+4 -1
View File
@@ -195,7 +195,10 @@ type Message struct {
// chat_directories response (home first, then recent operator-session
// directories, deduplicated and bounded). Additive/omitempty so older peers
// ignore it.
ChatDirectories []string `json:"chat_directories,omitempty"`
ChatDirectories []string `json:"chat_directories,omitempty"`
ChatShellOutputQuery *ChatShellOutputQuery `json:"chat_shell_output_query,omitempty"`
ChatShells []ChatShell `json:"chat_shells,omitempty"`
ChatShellOutput *ChatShellOutputPage `json:"chat_shell_output,omitempty"`
// RunEvent is the server-pushed run state delta (see runevents.go) and
// RunIDs the optional subscribe scope, so a client asks for the runs it
// displays. Both are optional so older peers ignore them.