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:
@@ -1133,6 +1133,7 @@ export const EVENT_STEP = "step";
|
||||
export const EVENT_USAGE = "usage";
|
||||
export const EVENT_USER = "user";
|
||||
export const EVENT_SHELL = "shell";
|
||||
export const EVENT_FORM = "form";
|
||||
|
||||
/** ChatStep.Status values. `ended` is the one status that settles a turn. */
|
||||
export const STEP_ENDED = "ended";
|
||||
@@ -1324,6 +1325,9 @@ export function newChatThread(sessionId = "") {
|
||||
// derive from the two (see `approvalCard`).
|
||||
permission: null,
|
||||
permissionAnswer: "",
|
||||
// The agent's pending structured question/form (OpenCode form.created). The
|
||||
// card is derived from this frame; answers are local until submitted.
|
||||
form: null,
|
||||
// The reason a refused `chat_reply` left on the thread's error line, kept
|
||||
// apart from any other error so a later accepted answer clears only this one.
|
||||
permissionError: "",
|
||||
@@ -1487,6 +1491,31 @@ export function threadPhase(thread, nowMillis) {
|
||||
return turnPhase(threadRunningTools(thread.messages));
|
||||
}
|
||||
|
||||
/**
|
||||
* Folds one form frame into a conversation. A new form replaces the previous
|
||||
* one; a resolved/cancelled update clears it; an update for a different id is
|
||||
* ignored rather than reviving a dismissed card. The form is kept as data so the
|
||||
* question card and every other client derive the same state.
|
||||
*/
|
||||
export function applyChatForm(thread, form) {
|
||||
const current = thread ?? newChatThread(str(form?.session_id));
|
||||
const id = str(form?.id);
|
||||
if (id === "") return current;
|
||||
const existing = current.form ?? null;
|
||||
if (form?.cancelled === true) {
|
||||
if (str(existing?.id) !== id) return current;
|
||||
return { ...current, form: null };
|
||||
}
|
||||
if (form?.resolved === true) {
|
||||
if (str(existing?.id) !== id) return current;
|
||||
return { ...current, form: { ...existing, ...form, resolved: true } };
|
||||
}
|
||||
if (str(existing?.id) === id) {
|
||||
return { ...current, form: { ...existing, ...form } };
|
||||
}
|
||||
return { ...current, form };
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies one pushed `chat_event` frame to a conversation and returns the next
|
||||
* thread. Any frame clears `queued` (the turn moved on); `user` echoes another
|
||||
@@ -1515,6 +1544,8 @@ export function applyChatEvent(thread, frame, now = Date.now()) {
|
||||
// that outlives the turn keeps showing after the turn's own indicator is gone.
|
||||
case EVENT_SHELL:
|
||||
return { ...current, shells: mergeShellFrame(current.shells, frame?.shell) };
|
||||
case EVENT_FORM:
|
||||
return applyChatForm(current, frame?.form);
|
||||
// `usage` is recognised but not folded; it still cleared `queued` above.
|
||||
case EVENT_USAGE:
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user