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:
+60
-10
@@ -27,7 +27,6 @@ import { SERVER_URL_STORAGE_KEY, readServerUrl, readWorkspace, writeServerUrl }
|
||||
import { layoutGraph } from "./graph.js";
|
||||
import { readGraphExpanded } from "./graphPrefs.js";
|
||||
import { readArtifactView } from "./artifactViewPrefs.js";
|
||||
import { readChatStars } from "./chatStars.js";
|
||||
import { readLayoutPrefs, writeLayoutPrefs } from "./layoutPrefs.js";
|
||||
import { DEFAULT_ROUTE, parseRoute, serializeRoute } from "./routes.js";
|
||||
import { EMPTY_PIPELINE_FILTERS, PIPELINE_DETAIL_TABS } from "./pipelines.js";
|
||||
@@ -179,8 +178,8 @@ const state = {
|
||||
pipelineGraphExpanded: readGraphExpanded(),
|
||||
// Gallery or list for run artifacts; a per-operator choice (artifactViewPrefs.js).
|
||||
artifactView: readArtifactView(),
|
||||
// Starred chat sessions (chatStars.js): local, always sorted first.
|
||||
chatStars: readChatStars(),
|
||||
// Starred chat sessions: filled from chat_sessions (server-shared).
|
||||
chatStars: new Set(),
|
||||
// The collapsed rail/list choices (layoutPrefs.js), restored per device.
|
||||
...readLayoutPrefs(),
|
||||
// Whether the CLOSED chats group is expanded (the chevron beside its name).
|
||||
@@ -466,6 +465,7 @@ const railDestinations = h(
|
||||
),
|
||||
);
|
||||
|
||||
const dockTabs = DESTINATIONS.filter((destination) => destination.key !== "settings");
|
||||
const dockDestinations = h(
|
||||
"div",
|
||||
{
|
||||
@@ -474,9 +474,7 @@ const dockDestinations = h(
|
||||
role: "tablist",
|
||||
"aria-label": "Destinations",
|
||||
},
|
||||
...DESTINATIONS.filter((destination) => destination.key !== "settings").map((destination) =>
|
||||
destinationTab(destination, "dock"),
|
||||
),
|
||||
...dockTabs.map((destination) => destinationTab(destination, "dock")),
|
||||
);
|
||||
|
||||
const railSearch = h(
|
||||
@@ -605,7 +603,9 @@ const dock = h(
|
||||
h("div", { class: "dock-status-row" }, dockStatus, dockSettings),
|
||||
// The destinations come first and Search sits on the right; every item takes
|
||||
// an equal share of the bar on a phone.
|
||||
h("div", { class: "dock-row" }, dockDestinations, dockSearch),
|
||||
// One equal share per destination; Search is one more share of the same row,
|
||||
// so the whole bar divides evenly however many destinations exist.
|
||||
h("div", { class: "dock-row", style: `--dock-count: ${dockTabs.length}` }, dockDestinations, dockSearch),
|
||||
);
|
||||
// The attention sheet lives in its own layer so it can overlay any view without
|
||||
// being torn down by a content re-render; renderAttentionSheet rebuilds it.
|
||||
@@ -2431,6 +2431,35 @@ client.addEventListener("state", (event) => {
|
||||
// transcript (C5) folds the frame itself, and the composer's own bookkeeping
|
||||
// clears the queued notice and releases the Stop control. A frame for any other
|
||||
// type is ignored.
|
||||
/**
|
||||
* A question raised by an agent chat is as urgent as a failing run: if the page
|
||||
* is not showing that conversation, raise the browser notification the operator
|
||||
* already enabled for run alerts. Clicking it opens the chat with the question.
|
||||
*/
|
||||
function notifyChatQuestion(frame) {
|
||||
const form = frame?.form;
|
||||
if (!form?.id) return;
|
||||
if (typeof globalThis.Notification !== "function") return;
|
||||
if (globalThis.isSecureContext !== true || globalThis.Notification.permission !== "granted") return;
|
||||
if (state.view === "chat" && state.chatActiveId === frame.session_id) return;
|
||||
const session = state.chatSessions.find((row) => row.id === frame.session_id);
|
||||
const title = String(session?.title ?? "Chat").trim() || "Chat";
|
||||
try {
|
||||
const notification = new Notification(`${title} needs your answer`, {
|
||||
body: String(form.title ?? "The agent asked a question."),
|
||||
tag: `chat-question:${form.id}`,
|
||||
});
|
||||
notification.onclick = () => {
|
||||
window.focus();
|
||||
state.view = "chat";
|
||||
render();
|
||||
openChatSession(frame.session_id);
|
||||
};
|
||||
} catch {
|
||||
// The in-page question card remains available.
|
||||
}
|
||||
}
|
||||
|
||||
client.addEventListener("frame", (event) => {
|
||||
const message = event.detail;
|
||||
if (!message) return;
|
||||
@@ -2465,7 +2494,17 @@ client.addEventListener("frame", (event) => {
|
||||
}
|
||||
if (message.type !== Protocol.CHAT_EVENT) return;
|
||||
const frame = message[ChatKeys.EVENT];
|
||||
if (frame) onChatEvent(frame);
|
||||
if (frame) {
|
||||
if (
|
||||
frame.kind === "form" &&
|
||||
frame.form?.kind === "question" &&
|
||||
frame.form.resolved !== true &&
|
||||
frame.form.cancelled !== true
|
||||
) {
|
||||
notifyChatQuestion(frame);
|
||||
}
|
||||
onChatEvent(frame);
|
||||
}
|
||||
onChatFrame(message);
|
||||
});
|
||||
|
||||
@@ -2560,5 +2599,16 @@ window.addEventListener("resize", () => {
|
||||
}, 120);
|
||||
});
|
||||
|
||||
// A previously configured endpoint re-opens on load (see bootServerUrl).
|
||||
if (bootServerUrl) openConfiguredEndpoint({ surfaceError: false });
|
||||
// A previously configured endpoint re-opens on load (see bootServerUrl). When
|
||||
// nothing is stored, the page's own origin is the supported default proxy: use
|
||||
// it instead of leaving a freshly signed-in device on a "Not configured" screen
|
||||
// and making the operator find the same URL in Settings.
|
||||
if (bootServerUrl) {
|
||||
openConfiguredEndpoint({ surfaceError: false });
|
||||
} else {
|
||||
const sameOrigin = defaultServerUrl();
|
||||
if (validateServerUrl(sameOrigin).valid) {
|
||||
state.url = sameOrigin;
|
||||
openConfiguredEndpoint({ surfaceError: false });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user