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:
@@ -822,3 +822,41 @@ func TestChatV1ConnectionDrivesThroughCall(t *testing.T) {
|
||||
t.Fatalf("messages = %+v", page.Messages)
|
||||
}
|
||||
}
|
||||
|
||||
// TestNormalizeChatEventForm proves the question tool's form lifecycle is
|
||||
// surfaced: form.created carries the field structure and is remembered for the
|
||||
// session, while the terminal events (which carry only an id) resolve the same
|
||||
// form for that session and are ignored for another.
|
||||
func TestNormalizeChatEventForm(t *testing.T) {
|
||||
state := &ChatStreamState{}
|
||||
created := []byte(`{"type":"form.created","data":{"form":{"id":"form_1","sessionID":"ses_1","title":"Choose a colour","metadata":{"kind":"question"},"fields":[{"key":"colour","title":"Which colour?","description":"Pick one","type":"string","required":true,"options":[{"value":"red","label":"Red","description":"Warm"},{"value":"blue","label":"Blue"}]}]}}}`)
|
||||
frame, ok, err := NormalizeChatEvent(created, "ses_1", state)
|
||||
if err != nil || !ok {
|
||||
t.Fatalf("form.created: ok=%v err=%v", ok, err)
|
||||
}
|
||||
if frame.Kind != protocol.ChatEventForm || frame.Form == nil {
|
||||
t.Fatalf("form.created frame = %+v", frame)
|
||||
}
|
||||
if frame.Form.ID != "form_1" || frame.Form.Kind != "question" || len(frame.Form.Fields) != 1 {
|
||||
t.Fatalf("form.created form = %+v", frame.Form)
|
||||
}
|
||||
field := frame.Form.Fields[0]
|
||||
if field.Key != "colour" || field.Title != "Which colour?" || !field.Required || len(field.Options) != 2 {
|
||||
t.Fatalf("form.created field = %+v", field)
|
||||
}
|
||||
if field.Options[0].Value != "red" || field.Options[0].Label != "Red" || field.Options[0].Description != "Warm" {
|
||||
t.Fatalf("form option = %+v", field.Options[0])
|
||||
}
|
||||
|
||||
// Another session's terminal event is not this session's form.
|
||||
if _, ok, err := NormalizeChatEvent([]byte(`{"type":"form.replied","data":{"id":"form_1"}}`), "ses_2", state); err != nil || ok {
|
||||
t.Fatalf("foreign form.replied: ok=%v err=%v", ok, err)
|
||||
}
|
||||
resolved, ok, err := NormalizeChatEvent([]byte(`{"type":"form.replied","data":{"id":"form_1"}}`), "ses_1", state)
|
||||
if err != nil || !ok || resolved.Form == nil || !resolved.Form.Resolved || resolved.Form.ID != "form_1" {
|
||||
t.Fatalf("form.replied frame = %+v ok=%v err=%v", resolved, ok, err)
|
||||
}
|
||||
if _, ok, err := NormalizeChatEvent([]byte(`{"type":"form.cancelled","data":{"id":"form_1"}}`), "ses_1", state); err != nil || ok {
|
||||
t.Fatalf("duplicate/unknown form.cancelled: ok=%v err=%v", ok, err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user