web: shared chat stars, pipeline mini graphs and agent questions

- Persist chat stars in the operator-session registry (chat_star) so every
  browser/device shows the same Starred group; migrate old local stars once.
- Add a compact pipeline graph shape to list responses and draw a lightweight
  list miniature; replace the cryptic id/version line with the stage count.
- Surface OpenCode form questions as a chat card (chat_answer), replay a
  pending form to late subscribers, and notify for background questions.
- Make the mobile dock's Search cell equal to every destination, keep the
  tab row visible with 100svh, and let Source use the full pane height.
- Let a fresh sign-in auto-connect to its own origin; use a Lax session cookie
  with Expires so Remember me survives app/link launches.
- Keep shipped starters and the skill agnostic: no repository paths, project
  areas or personal device commands; add Diagnose/Fix and Research starters.
- Refresh the installed skill and document the new browser conventions.
This commit is contained in:
2026-10-20 03:11:37 +01:00
parent caae8a8038
commit 526c19fc21
46 changed files with 1547 additions and 611 deletions
+67 -1
View File
@@ -40,6 +40,10 @@ const (
// only records the finished state, it never detaches a client.
ChatClose = "chat_close"
ChatReopen = "chat_reopen"
// ChatStar records the operator's star on the server, so every browser and
// device shows the same starred group. It takes a ChatQuery with SessionID
// and Starred, and echoes the updated session like close/reopen.
ChatStar = "chat_star"
// ChatSubscribe attaches a connection to one session's shared live stream so
// it receives every frame any client's turn produces (its own and the other
// devices'), not only the frames of a turn it prompted itself. Any number of
@@ -61,6 +65,13 @@ const (
// ChatEvent and ChatPermission are the server-pushed frames; they are the
// only types the server sends without a matching request.
ChatEvent = "chat_event"
// ChatEventForm carries an OpenCode form (the agent's question tool uses a
// form with kind=question). It is a ChatEvent kind, not a separate request:
// the same frame stream that carries text and tools carries the question.
ChatEventForm = "form"
// ChatAnswer is the client's answer to a ChatEventForm. Answers is keyed by
// field key and mirrors OpenCode's form.reply answer object.
ChatAnswer = "chat_answer"
// ChatPermission carries one pending OpenCode approval request the phone
// answers with chat_reply.
ChatPermission = "chat_permission"
@@ -165,6 +176,11 @@ type ChatSession struct {
// Additive/omitempty so older peers ignore them.
Closed bool `json:"closed,omitempty"`
ClosedAt int64 `json:"closed_at,omitempty"`
// Starred is the operator's shared star, stored in the operator-session
// registry so every client sees the same Starred group. StarredAt is the
// epoch-millisecond time it was set, 0 while unstarred.
Starred bool `json:"starred,omitempty"`
StarredAt int64 `json:"starred_at,omitempty"`
}
// ChatCloseResult reports the outcome of a chat_close: the session id, the
@@ -210,7 +226,9 @@ type ChatAdoptRequest struct {
// returned history (server default when zero).
type ChatQuery struct {
SessionID string `json:"session_id"`
Limit int `json:"limit,omitempty"`
// Starred is set by chat_star; nil means the command did not name a state.
Starred *bool `json:"starred,omitempty"`
Limit int `json:"limit,omitempty"`
// Cursor is the opaque continuation returned by OpenCode's descending
// message listing. It is deliberately not interpreted by the broker.
Cursor string `json:"cursor,omitempty"`
@@ -346,6 +364,9 @@ type ChatEventFrame struct {
// 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"`
// Form is the payload of a ChatEventForm frame: the agent's pending question
// (or another OpenCode form), and the resolved/cancelled terminal state.
Form *ChatForm `json:"form,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"`
@@ -374,6 +395,51 @@ type ChatUsage struct {
// 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.
// ChatForm is the agent's structured question/form. OpenCode emits these as
// form.created / form.replied / form.cancelled; the question tool uses
// Kind=="question". A client answers with ChatAnswerRequest. Answers is kept as
// JSON values because a field may be a string, a list (multiselect), a number or
// a boolean.
type ChatForm struct {
ID string `json:"id"`
SessionID string `json:"session_id,omitempty"`
Title string `json:"title,omitempty"`
Kind string `json:"kind,omitempty"`
Fields []ChatFormField `json:"fields,omitempty"`
Resolved bool `json:"resolved,omitempty"`
Cancelled bool `json:"cancelled,omitempty"`
Answers map[string]any `json:"answers,omitempty"`
}
// ChatFormField is one question/input in a form. Type is OpenCode's field type
// (string, multiselect, number, integer, boolean, external); Options is present
// when the question offers choices.
type ChatFormField struct {
Key string `json:"key"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Type string `json:"type,omitempty"`
Options []ChatFormOption `json:"options,omitempty"`
Custom bool `json:"custom,omitempty"`
Required bool `json:"required,omitempty"`
}
// ChatFormOption is one selectable choice in a ChatFormField.
type ChatFormOption struct {
Value string `json:"value"`
Label string `json:"label"`
Description string `json:"description,omitempty"`
}
// ChatAnswerRequest is the chat_answer body: the form id and a field-keyed
// answer object. It is deliberately separate from ChatQuery because its payload
// is structured answers, not a session-scoped read.
type ChatAnswerRequest struct {
SessionID string `json:"session_id"`
FormID string `json:"form_id"`
Answers map[string]any `json:"answers"`
}
type ChatShell struct {
ID string `json:"id"`
Status string `json:"status,omitempty"`
+7
View File
@@ -100,6 +100,10 @@ type PipelineSummary struct {
Stages int `json:"stages"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
// Shape is the current version's parsed graph, included so a list can draw
// a miniature without one detail request per row. Detail responses keep the
// full Graph field; this one is deliberately optional and additive.
Shape *Graph `json:"shape,omitempty"`
}
// Message is the JSON envelope shared by the server and client. It also brokers
@@ -179,6 +183,9 @@ type Message struct {
// requests themselves ride on ChatQuery (the session id), matching
// chat_messages/chat_interrupt.
ChatClose *ChatCloseResult `json:"chat_close,omitempty"`
// ChatAnswer is the chat_answer body; the form update arrives through the
// normal chat_event stream.
ChatAnswer *ChatAnswerRequest `json:"chat_answer,omitempty"`
// ChatSubscribe attaches this connection to one session's shared stream; the
// body names the session like ChatQuery. A chat_prompt response sets
// ChatQueued when the prompt had to wait for an in-flight turn and was