Merge main into chat-close: combine the shared chat room with the server-side close

The item adds chat_close/chat_reopen to the brokered chat protocol and the
operator-session registry's closed state. main replaced the per-session claim
model with shared chat rooms (chat_subscribe, a prompt queue, one broker stream
fanned out to every watcher). This merges the two.

Resolved conflicts:
- internal/protocol/chat.go, internal/protocol/message.go: kept both additions -
  ChatClose/ChatReopen and main's ChatSubscribe/ChatQueued.
- internal/server/chat_sessions.go: kept the closed fields on a listed session;
  dropped the `Busy` assignment, because main no longer marks a session Busy (any
  number of clients may watch and write one).
- internal/server/chat_claims.go: main deleted the claim model, so the file goes;
  close's "is a turn running" check is now `chatHub.turnInFlight` in
  internal/server/chat_room.go, reading the room's `running` flag. That is the
  same question the old claim answered, against main's model.
- internal/server/chat_close.go: calls turnInFlight instead of the removed
  `active`.
- android AppViewModel.kt, ChatFormat.kt, ChatListPane.kt, Message.kt: kept both
  sides - main's search state, queued-prompt handling, `Busy`-free status label
  and row/menu shape, plus the item's close/reopen actions, closed chip and
  section, close confirmation and "Hide on this device" rename.

Also in this merge: main's new convention (AGENTS.md) that an item does not edit
a shared document; the item's stale-document record for this change lives in
docs/notes/chat-close.md, and docs/cli.md, android/README.md and
internal/author/skill/references/operations.md are left to the docs-fold writer.

Checks after resolving: gofmt clean, go build ./... and go vet ./... clean, the
Go module passes, and the app's :app:assembleDebug and :app:testDebugUnitTest
pass (--offline --no-daemon).
This commit is contained in:
2026-10-18 00:19:23 +01:00
75 changed files with 4520 additions and 769 deletions
+12 -2
View File
@@ -27,7 +27,13 @@ func chatSamples() []struct {
{"create", ChatCreateRequest{Title: "demo", Directory: "/work"}},
{"adopt", ChatAdoptRequest{SessionID: "ses_1"}},
{"query", ChatQuery{SessionID: "ses_1", Limit: 50}},
{"prompt", ChatPromptRequest{SessionID: "ses_1", Text: "hello", Model: "m", Agent: "build", Files: []string{"file:///tmp/a.png"}}},
{"prompt", ChatPromptRequest{SessionID: "ses_1", Text: "hello", Model: "m", Agent: "build", Files: []string{"file:///tmp/a.png"}, Client: "Pixel 9 Pro XL"}},
{"prompt_queued_ack", Message{Type: ChatPrompt, ID: "a1", ChatQueued: true}},
{"subscribe", ChatQuery{SessionID: "ses_1"}},
{"event_user", ChatEventFrame{
SessionID: "ses_1", MessageID: "usr_1", Kind: ChatEventUser, Client: "Pixel 10 Pro Fold",
Part: &ChatPart{Type: ChatPartText, ID: "usr", Text: "from the fold"},
}},
{"message", ChatMessage{
ID: "msg_1", SessionID: "ses_1", Role: ChatRoleAssistant, Model: "m", Agent: "build", CreatedAt: 1792112366711,
Parts: []ChatPart{
@@ -66,7 +72,11 @@ func chatSamples() []struct {
Source: &ChatPermissionSource{Type: "tool", MessageID: "msg_1", ID: "call_1"},
Message: "wants to run a command",
}},
{"reply", ChatReplyRequest{SessionID: "ses_1", RequestID: "req_1", Decision: ChatDecisionOnce, Message: "ok"}},
{"permission_resolved", ChatPermissionFrame{
SessionID: "ses_1", RequestID: "per_1", Action: "bash",
Resolved: true, Decision: ChatDecisionOnce, ResolvedBy: "Pixel 9 Pro XL",
}},
{"reply", ChatReplyRequest{SessionID: "ses_1", RequestID: "req_1", Decision: ChatDecisionOnce, Message: "ok", Client: "Pixel 9 Pro XL"}},
}
}