@agimon-ai/po-template-desktop 0.0.0-alpha.151 → 0.0.0-alpha.153
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/extensions/web.mjs +509 -209
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/webClient.cjs +505 -205
- package/dist/webClient.cjs.map +1 -1
- package/dist/webClient.mjs +509 -209
- package/dist/webClient.mjs.map +1 -1
- package/package.json +6 -6
package/dist/extensions/web.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineWebPlugin, defineWebTemplate } from "@agimon-ai/po-core/web";
|
|
2
|
-
import { ActivityIcon, AlertIcon, AppWindowIcon, Avatar, AvatarFallback, AvatarImage, Button, Checkbox, ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Dialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, EditIcon, FileIcon, FolderIcon, GearIcon, GlobeIcon, HomeIcon, Input, KebabIcon, LiveDuration, LoaderIcon, MessageIcon, MessageItem, NavTab, OptionRow, PlusIcon, Popover, PopoverContent, PopoverTrigger, PuzzleIcon, SearchIcon, ShieldIcon, ShrinkIcon, SlidersIcon, SparklesIcon, Spinner, TerminalIcon, Textarea, Tooltip, TooltipContent, TooltipTrigger, WorkflowIcon, WrenchIcon } from "@agimon-ai/po-web-components";
|
|
3
|
-
import { DEFAULT_REPOSITORY_SETTINGS_SECTION, DEFAULT_SETTINGS_SECTION, DashboardRendererProvider, HOST_SLOTS, PLUGINS_PAGE_ID, activityGroupSlot, activityWaitingCount, closeTransientTab, discoverWorkspaceAdmission, dockTabFor, findTransientTab, movedSettingsLayer, pluginActivityGroups, refreshWebPluginCompositions, sessionsStore, setDockTab, settingsSection, slotFills, transientTabsStore, uiStore, updateWorkspaceAdmission, useActiveSession, useActiveSessionMeta, useActivityGroups, useDashboardRoute, useDashboardState, useDockFaceBadges, useDockFaces, usePluginSlotProps, useSessionMcp, useTransientTabs, useWebPluginRegistry, watchDashboardTranscript, webTabs, workspaceAdmissionStore } from "@agimon-ai/po-web-dashboard";
|
|
1
|
+
import { defineWebPlugin, defineWebTemplate, railStepRows } from "@agimon-ai/po-core/web";
|
|
2
|
+
import { ActivityIcon, AlertIcon, AppWindowIcon, Avatar, AvatarFallback, AvatarImage, Button, CheckIcon, Checkbox, ChevronDownIcon, ChevronRightIcon, ChevronUpIcon, CloseIcon, Dialog, DialogBody, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger, EditIcon, FileIcon, FolderIcon, GearIcon, GlobeIcon, HomeIcon, Input, KebabIcon, LiveDuration, LoaderIcon, MessageIcon, MessageItem, NavTab, OptionRow, PlusIcon, Popover, PopoverContent, PopoverTrigger, PuzzleIcon, SearchIcon, ShieldIcon, ShrinkIcon, SlidersIcon, SparklesIcon, Spinner, TerminalIcon, Textarea, Tooltip, TooltipContent, TooltipTrigger, WorkflowIcon, WrenchIcon } from "@agimon-ai/po-web-components";
|
|
3
|
+
import { DEFAULT_REPOSITORY_SETTINGS_SECTION, DEFAULT_SETTINGS_SECTION, DashboardRendererProvider, HOST_SLOTS, PLUGINS_PAGE_ID, activityGroupSlot, activityWaitingCount, closeTransientTab, dashboardStateFor, discoverWorkspaceAdmission, dockTabFor, findTransientTab, movedSettingsLayer, pluginActivityGroups, refreshWebPluginCompositions, sessionsStore, setDockTab, settingsSection, slotFills, transientTabsStore, uiStore, updateWorkspaceAdmission, useActiveSession, useActiveSessionMeta, useActivityGroups, useDashboardRoute, useDashboardState, useDockFaceBadges, useDockFaces, usePluginSlotProps, useSessionMcp, useTransientTabs, useWebPluginRegistry, watchDashboardTranscript, webTabs, workspaceAdmissionStore } from "@agimon-ai/po-web-dashboard";
|
|
4
4
|
import { AccountSettings, AppearanceSettings, ClientDevices, CommandPalette, Composer, ContextPanel, ContributedSettings, DialogOverlay, HomePage, ImageSettings, MascotMark, NotificationSettings, PairingApprovalDialog, PluginPage, PluginSurface, PluginsPage, PresetSettings, ProviderSettings, RefusedCard, RemoteAccessDialog, RemoteControlSettings, RepositoryWorkspace, SelectionBar, SessionActivity, SessionMcp, SessionRailDialogs, SessionSettings, SessionTranscriptView, SettingsMenu, SettingsPanelHost, ThreadView, Timeline, ToolCard, WorkspacePage, toolOutputDescriptors, useSessionRail } from "@agimon-ai/po-web-dashboard/views";
|
|
5
5
|
import { Link, useNavigate } from "@tanstack/react-router";
|
|
6
6
|
import { Store, useStore } from "@tanstack/react-store";
|
|
7
|
-
import { Fragment, memo, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
7
|
+
import { Fragment, memo, useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
//#region src/extensions/(frontend)/template/_lib/windowLayout.ts
|
|
10
10
|
const LAYOUT_STORAGE_KEY = "po.web.desktop.v1";
|
|
@@ -47,9 +47,32 @@ const KEEP = 10;
|
|
|
47
47
|
const WIDE = 1600;
|
|
48
48
|
const sessionWindowId = (sessionId) => `session:${sessionId}`;
|
|
49
49
|
const tabWindowId = (sessionId, tabId) => `tab:${sessionId}:${tabId}`;
|
|
50
|
-
/** A
|
|
50
|
+
/** A step's window joins its workflow's stack, a tab window its session's; every other window is its own. */
|
|
51
51
|
function stackRoot(win) {
|
|
52
|
-
return win.kind === "tab" && win.sessionId !== void 0 ? sessionWindowId(win.sessionId) : win.id;
|
|
52
|
+
return win.stackOn ?? (win.kind === "tab" && win.sessionId !== void 0 ? sessionWindowId(win.sessionId) : win.id);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Puts each workflow step's window and its tab windows on the workflow's window while that is open, so they
|
|
56
|
+
* move, minimise and close together. `stepParent` names a step session's workflow session from live data; a
|
|
57
|
+
* window whose workflow window is gone stands alone again. Unchanged input returns the same layout.
|
|
58
|
+
*/
|
|
59
|
+
function restackSteps(layout, stepParent) {
|
|
60
|
+
let changed = false;
|
|
61
|
+
const windows = layout.windows.map((win) => {
|
|
62
|
+
const parent = (win.kind === "session" || win.kind === "tab") && win.sessionId !== void 0 ? stepParent(win.sessionId) : void 0;
|
|
63
|
+
const target = parent !== void 0 && findWindow(layout, sessionWindowId(parent)) !== void 0 ? sessionWindowId(parent) : void 0;
|
|
64
|
+
if (win.stackOn === target) return win;
|
|
65
|
+
changed = true;
|
|
66
|
+
const { stackOn: _stale, ...rest } = win;
|
|
67
|
+
return target === void 0 ? rest : {
|
|
68
|
+
...rest,
|
|
69
|
+
stackOn: target
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
return changed ? {
|
|
73
|
+
...layout,
|
|
74
|
+
windows
|
|
75
|
+
} : layout;
|
|
53
76
|
}
|
|
54
77
|
function findWindow(layout, id) {
|
|
55
78
|
return layout.windows.find((win) => win.id === id);
|
|
@@ -175,7 +198,7 @@ function rectOf(layout, id, widthPx) {
|
|
|
175
198
|
if (root.maximized === true) return FULL;
|
|
176
199
|
if (root.rect !== void 0) return root.rect;
|
|
177
200
|
if (root.kind !== "session" && root.kind !== "tab") return FLOAT[root.kind];
|
|
178
|
-
const sessions = layout.windows.filter((entry) => entry.kind === "session");
|
|
201
|
+
const sessions = layout.windows.filter((entry) => entry.kind === "session" && entry.stackOn === void 0);
|
|
179
202
|
const index = sessions.findIndex((entry) => entry.id === root.id);
|
|
180
203
|
return slots(sessions.length, widthPx)[index] ?? FULL;
|
|
181
204
|
}
|
|
@@ -200,6 +223,30 @@ function focusWindow(layout, id) {
|
|
|
200
223
|
} : entry) : layout.windows
|
|
201
224
|
};
|
|
202
225
|
}
|
|
226
|
+
/**
|
|
227
|
+
* Brings a session's windows above the other sessions' windows in its stack, then the stack to the front:
|
|
228
|
+
* the route naming a workflow, or one of its steps, shows that session rather than whichever sat on top.
|
|
229
|
+
* The session's own tab windows keep their order.
|
|
230
|
+
*/
|
|
231
|
+
function raiseSession(layout, id) {
|
|
232
|
+
const win = findWindow(layout, id);
|
|
233
|
+
if (win === void 0) return layout;
|
|
234
|
+
const root = stackRoot(win);
|
|
235
|
+
const members = layout.z.filter((entry) => {
|
|
236
|
+
const member = findWindow(layout, entry);
|
|
237
|
+
return member !== void 0 && stackRoot(member) === root;
|
|
238
|
+
});
|
|
239
|
+
const own = members.filter((entry) => findWindow(layout, entry)?.sessionId === win.sessionId);
|
|
240
|
+
const order = [
|
|
241
|
+
...layout.z.filter((entry) => !members.includes(entry)),
|
|
242
|
+
...members.filter((e) => !own.includes(e)),
|
|
243
|
+
...own
|
|
244
|
+
];
|
|
245
|
+
return focusWindow(order.some((entry, index) => entry !== layout.z[index]) ? {
|
|
246
|
+
...layout,
|
|
247
|
+
z: order
|
|
248
|
+
} : layout, id);
|
|
249
|
+
}
|
|
203
250
|
/** Opens a window, or brings it forward when it is already open. A new tab window goes on top of its stack. */
|
|
204
251
|
function openWindow(layout, win) {
|
|
205
252
|
if (findWindow(layout, win.id) !== void 0) return focusWindow(layout, win.id);
|
|
@@ -210,11 +257,14 @@ function openWindow(layout, win) {
|
|
|
210
257
|
z: [...layout.z, win.id]
|
|
211
258
|
}, win.id);
|
|
212
259
|
}
|
|
213
|
-
/**
|
|
260
|
+
/**
|
|
261
|
+
* Closing a session window also closes the windows stacked on it and its own tab windows, so closing a
|
|
262
|
+
* workflow's window closes its steps' windows too. Windows only: no session or run stops.
|
|
263
|
+
*/
|
|
214
264
|
function closeWindow(layout, id) {
|
|
215
265
|
const win = findWindow(layout, id);
|
|
216
266
|
if (win === void 0) return layout;
|
|
217
|
-
const gone = new Set(layout.windows.filter((entry) => entry.id === id || win.kind === "session" && stackRoot(entry) === id).map((entry) => entry.id));
|
|
267
|
+
const gone = new Set(layout.windows.filter((entry) => entry.id === id || win.kind === "session" && (stackRoot(entry) === id || entry.kind === "tab" && entry.sessionId === win.sessionId)).map((entry) => entry.id));
|
|
218
268
|
return {
|
|
219
269
|
...layout,
|
|
220
270
|
windows: layout.windows.filter((entry) => !gone.has(entry.id)),
|
|
@@ -396,6 +446,19 @@ function pruneLayout(layout, sessionIds, tabOpen) {
|
|
|
396
446
|
z: layout.z.filter((id) => windows.some((win) => win.id === id))
|
|
397
447
|
};
|
|
398
448
|
}
|
|
449
|
+
/**
|
|
450
|
+
* The layout drawn: the saved one adjusted to what exists now. Windows of deleted sessions and closed tabs go,
|
|
451
|
+
* the route's window is there, and Settings or a page only while routed. A removed session's route lingers until
|
|
452
|
+
* the host navigates away, so its window is not reopened: pruning and reopening it would never settle.
|
|
453
|
+
*/
|
|
454
|
+
function drawnLayout(stored, routeWindow, live) {
|
|
455
|
+
let layout = live === void 0 ? stored : pruneLayout(stored, live.sessionIds, live.tabOpen);
|
|
456
|
+
if (routeWindow?.kind !== "settings") layout = closeWindow(layout, "settings");
|
|
457
|
+
if (routeWindow?.kind !== "page") layout = closeWindow(layout, "page");
|
|
458
|
+
const gone = live !== void 0 && routeWindow?.kind === "session" && !live.sessionIds.has(routeWindow.sessionId);
|
|
459
|
+
if (routeWindow !== void 0 && !gone && findWindow(layout, routeWindow.id) === void 0) layout = openWindow(layout, routeWindow);
|
|
460
|
+
return live?.stepParent === void 0 ? layout : restackSteps(layout, live.stepParent);
|
|
461
|
+
}
|
|
399
462
|
/** The widgets to draw: the person's choice, limited to groups that exist, or all of them. */
|
|
400
463
|
function chosenWidgets(layout, available) {
|
|
401
464
|
return layout.widgets === null ? available : layout.widgets.filter((name) => available.includes(name));
|
|
@@ -915,7 +978,7 @@ function Control({ label, onClick, children }) {
|
|
|
915
978
|
* dropping it on an edge or from the title's menu. The live position stays local while the
|
|
916
979
|
* pointer moves; only the final place goes back to the layout.
|
|
917
980
|
*/
|
|
918
|
-
function DesktopWindow({ title, subtitle, rect, layer, focused, minimized, maximized, stacked, narrow, desktop, headerRegion, testId, onFocus, onClose, onMinimize, onToggleMaximize, onPlace, onResetPlace, onSnapPreview, children }) {
|
|
981
|
+
function DesktopWindow({ title, subtitle, rect, layer, focused, minimized, maximized, stacked, narrow, desktop, headerRegion, testId, onFocus, onClose, onRename, onMinimize, onToggleMaximize, onPlace, onResetPlace, onSnapPreview, children }) {
|
|
919
982
|
const gesture = useRef(null);
|
|
920
983
|
const [live, setLive] = useState(null);
|
|
921
984
|
const fixed = narrow || maximized;
|
|
@@ -998,7 +1061,7 @@ function DesktopWindow({ title, subtitle, rect, layer, focused, minimized, maxim
|
|
|
998
1061
|
/* @__PURE__ */ jsxs("header", {
|
|
999
1062
|
"data-po-region": headerRegion,
|
|
1000
1063
|
onPointerDown: (event) => {
|
|
1001
|
-
if (event.target.closest("button") !== null) return;
|
|
1064
|
+
if (event.target.closest("button, [data-window-control]") !== null) return;
|
|
1002
1065
|
begin(event, {
|
|
1003
1066
|
kind: "move",
|
|
1004
1067
|
x: event.clientX,
|
|
@@ -1011,7 +1074,7 @@ function DesktopWindow({ title, subtitle, rect, layer, focused, minimized, maxim
|
|
|
1011
1074
|
onPointerUp: end,
|
|
1012
1075
|
onPointerCancel: end,
|
|
1013
1076
|
onDoubleClick: (event) => {
|
|
1014
|
-
if (event.target.closest("button") === null && !narrow) onToggleMaximize();
|
|
1077
|
+
if (event.target.closest("button, [data-window-control]") === null && !narrow) onToggleMaximize();
|
|
1015
1078
|
},
|
|
1016
1079
|
className: `grid h-11 shrink-0 grid-cols-[1fr_auto_1fr] items-center px-3 select-none ${fixed ? "" : "cursor-grab touch-none active:cursor-grabbing"}`,
|
|
1017
1080
|
children: [
|
|
@@ -1031,9 +1094,14 @@ function DesktopWindow({ title, subtitle, rect, layer, focused, minimized, maxim
|
|
|
1031
1094
|
}) : null]
|
|
1032
1095
|
})
|
|
1033
1096
|
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
1097
|
+
"data-window-control": true,
|
|
1034
1098
|
align: "center",
|
|
1035
1099
|
className: "min-w-52",
|
|
1036
1100
|
children: [
|
|
1101
|
+
onRename === void 0 ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1102
|
+
onSelect: onRename,
|
|
1103
|
+
children: "Rename"
|
|
1104
|
+
}), /* @__PURE__ */ jsx(DropdownMenuSeparator, {})] }),
|
|
1037
1105
|
narrow ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1038
1106
|
/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1039
1107
|
onSelect: onToggleMaximize,
|
|
@@ -1189,19 +1257,36 @@ function Clock() {
|
|
|
1189
1257
|
* The floating bar: the Po button that opens the menu, one button per window stack, what waits
|
|
1190
1258
|
* on the person, remote access, the Activity toggle and the clock.
|
|
1191
1259
|
*/
|
|
1192
|
-
function DesktopBar({ menuOpen, menuTrigger, stacks, waiting, remote, faces, face, railShown, homeShown, onHome, onStack, onRemote, onFace }) {
|
|
1260
|
+
function DesktopBar({ menuOpen, menuTrigger, stacks, waiting, menuWaiting = 0, menuRunning = 0, remote, faces, face, railShown, homeShown, onHome, onStack, onRemote, onFace }) {
|
|
1193
1261
|
const shownFace = railShown ? face : null;
|
|
1194
1262
|
return /* @__PURE__ */ jsxs("footer", {
|
|
1195
1263
|
className: `relative mx-3 mb-3 flex h-14 shrink-0 items-center gap-1 rounded-2xl px-2 shadow-lg ${GLASS}`,
|
|
1196
1264
|
children: [
|
|
1197
1265
|
menuTrigger(/* @__PURE__ */ jsxs("button", {
|
|
1198
1266
|
type: "button",
|
|
1199
|
-
"aria-label":
|
|
1267
|
+
"aria-label": `Open the Po menu${menuWaiting > 0 ? `, ${menuWaiting} waiting for you` : ""}${menuRunning > 0 ? `, ${menuRunning} running` : ""}`,
|
|
1200
1268
|
"data-testid": "desktop-po-button",
|
|
1201
1269
|
className: `flex h-10 shrink-0 items-center gap-2 rounded-xl pr-3 pl-1.5 focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none ${menuOpen ? "bg-po-panel shadow-sm" : "hover:bg-po-panel/70"}`,
|
|
1202
|
-
children: [/* @__PURE__ */
|
|
1203
|
-
|
|
1204
|
-
|
|
1270
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
1271
|
+
className: "relative shrink-0",
|
|
1272
|
+
children: [
|
|
1273
|
+
/* @__PURE__ */ jsx(MascotMark, {
|
|
1274
|
+
size: 28,
|
|
1275
|
+
className: "rounded-lg shadow-sm"
|
|
1276
|
+
}),
|
|
1277
|
+
menuWaiting > 0 ? /* @__PURE__ */ jsx("span", {
|
|
1278
|
+
"aria-hidden": true,
|
|
1279
|
+
"data-testid": "desktop-po-waiting",
|
|
1280
|
+
className: "absolute -top-1.5 -right-1.5 min-w-4 rounded-full bg-po-magenta px-1 text-center text-2xs leading-4 font-semibold text-po-bg",
|
|
1281
|
+
children: menuWaiting > 9 ? "9+" : menuWaiting
|
|
1282
|
+
}) : null,
|
|
1283
|
+
menuRunning > 0 ? /* @__PURE__ */ jsx("span", {
|
|
1284
|
+
"aria-hidden": true,
|
|
1285
|
+
"data-testid": "desktop-po-running",
|
|
1286
|
+
className: "absolute -right-1.5 -bottom-1.5 min-w-4 rounded-full bg-po-green px-1 text-center text-2xs leading-4 font-semibold text-po-bg",
|
|
1287
|
+
children: menuRunning > 9 ? "9+" : menuRunning
|
|
1288
|
+
}) : null
|
|
1289
|
+
]
|
|
1205
1290
|
}), /* @__PURE__ */ jsx("span", {
|
|
1206
1291
|
className: "text-base font-semibold text-po-hi max-sm:hidden",
|
|
1207
1292
|
children: "Po"
|
|
@@ -1348,13 +1433,84 @@ function DesktopBar({ menuOpen, menuTrigger, stacks, waiting, remote, faces, fac
|
|
|
1348
1433
|
});
|
|
1349
1434
|
}
|
|
1350
1435
|
//#endregion
|
|
1436
|
+
//#region src/extensions/(frontend)/template/_lib/sessionTimeline.ts
|
|
1437
|
+
/** Workflow rows whose steps the person unfolded, in either menu view. */
|
|
1438
|
+
const STEPS_EXPANDED_KEY = "rail/workflow-steps-expanded";
|
|
1439
|
+
/** A question, a pending approval, or background work blocks on the person. */
|
|
1440
|
+
const needsYou = (session) => session.awaitingInput || (session.waitingCount ?? 0) > 0;
|
|
1441
|
+
/**
|
|
1442
|
+
* The Sessions view, as Advanced draws it: what waits on the person, then the rest, each newest change first;
|
|
1443
|
+
* no time sorts last. A workflow step travels with its workflow row, right after it, and a step waiting on the
|
|
1444
|
+
* person moves the whole group into "Needs you". Templates never import each other, so this mirrors Advanced's
|
|
1445
|
+
* `sessionTimeline`.
|
|
1446
|
+
*/
|
|
1447
|
+
function sessionTimeline(items) {
|
|
1448
|
+
const ids = new Set(items.map(({ session }) => session.id));
|
|
1449
|
+
const steps = /* @__PURE__ */ new Map();
|
|
1450
|
+
const heads = [];
|
|
1451
|
+
for (const item of items) {
|
|
1452
|
+
const parent = item.session.parentId;
|
|
1453
|
+
if (item.session.provenance === "workflow" && parent !== void 0 && ids.has(parent)) steps.set(parent, [...steps.get(parent) ?? [], item]);
|
|
1454
|
+
else heads.push(item);
|
|
1455
|
+
}
|
|
1456
|
+
const groups = heads.sort((a, b) => (b.session.lastActivityAt ?? 0) - (a.session.lastActivityAt ?? 0)).map((head) => [head, ...steps.get(head.session.id) ?? []]);
|
|
1457
|
+
const waiting = (group) => group.some(({ session }) => needsYou(session));
|
|
1458
|
+
return [{
|
|
1459
|
+
key: "needs",
|
|
1460
|
+
title: "Needs you",
|
|
1461
|
+
data: groups.filter(waiting).flat()
|
|
1462
|
+
}, {
|
|
1463
|
+
key: "recent",
|
|
1464
|
+
title: "Recent",
|
|
1465
|
+
data: groups.filter((group) => !waiting(group)).flat()
|
|
1466
|
+
}].filter((section) => section.data.length > 0);
|
|
1467
|
+
}
|
|
1468
|
+
//#endregion
|
|
1351
1469
|
//#region src/extensions/(frontend)/template/_components/DesktopMenu.tsx
|
|
1352
1470
|
/** The rail's status copy is the only running signal a template gets; the menu and the bar share this reading. */
|
|
1353
1471
|
function sessionRunning(session) {
|
|
1354
1472
|
return session.status.startsWith("running") || session.status.startsWith("workflow");
|
|
1355
1473
|
}
|
|
1356
1474
|
const MENU_DIALOG_KEY = "desktop/menu-dialog";
|
|
1357
|
-
|
|
1475
|
+
/** Opens the same rename dialog from a session's window title. */
|
|
1476
|
+
function openSessionRenameDialog(sessionId, name) {
|
|
1477
|
+
dashboardStateFor(MENU_DIALOG_KEY, null).setState(() => ({
|
|
1478
|
+
mode: "rename",
|
|
1479
|
+
sessionId,
|
|
1480
|
+
name
|
|
1481
|
+
}));
|
|
1482
|
+
}
|
|
1483
|
+
/** Advanced's key, so the person's view choice follows them between templates. */
|
|
1484
|
+
const VIEW_KEY = "po.session-view";
|
|
1485
|
+
const VIEWS = [{
|
|
1486
|
+
value: "workspaces",
|
|
1487
|
+
title: "Workspaces",
|
|
1488
|
+
description: "Sessions grouped by workspace",
|
|
1489
|
+
Icon: FolderIcon
|
|
1490
|
+
}, {
|
|
1491
|
+
value: "sessions",
|
|
1492
|
+
title: "Sessions",
|
|
1493
|
+
description: "Needs you first, then latest change",
|
|
1494
|
+
Icon: MessageIcon
|
|
1495
|
+
}];
|
|
1496
|
+
/** The browser keeps the view choice across launches; a blocked storage keeps it for this page. */
|
|
1497
|
+
function storedView() {
|
|
1498
|
+
try {
|
|
1499
|
+
return window.localStorage.getItem(VIEW_KEY) === "sessions" ? "sessions" : "workspaces";
|
|
1500
|
+
} catch {
|
|
1501
|
+
return "workspaces";
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
/** Whether the choice was saved; when storage is blocked, the in-memory choice still holds for this page. */
|
|
1505
|
+
function keepView(view) {
|
|
1506
|
+
try {
|
|
1507
|
+
window.localStorage.setItem(VIEW_KEY, view);
|
|
1508
|
+
return true;
|
|
1509
|
+
} catch {
|
|
1510
|
+
return false;
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
function SessionRow({ session, actions, coordinates, coordinator, workspaceName, onOpen, onDialog, onRole, stepsExpanded, onToggleSteps }) {
|
|
1358
1514
|
const failed = session.error !== void 0 || session.status.includes("failed");
|
|
1359
1515
|
const running = sessionRunning(session);
|
|
1360
1516
|
const name = session.name || "Untitled";
|
|
@@ -1376,105 +1532,123 @@ function SessionRow({ session, actions, coordinates, coordinator, onOpen, onDial
|
|
|
1376
1532
|
});
|
|
1377
1533
|
return /* @__PURE__ */ jsxs("div", {
|
|
1378
1534
|
className: "relative",
|
|
1379
|
-
children: [
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1535
|
+
children: [
|
|
1536
|
+
stepsExpanded === void 0 ? null : /* @__PURE__ */ jsx("button", {
|
|
1537
|
+
type: "button",
|
|
1538
|
+
"data-testid": `desktop-menu-steps-${session.id}`,
|
|
1539
|
+
"aria-expanded": stepsExpanded,
|
|
1540
|
+
"aria-label": `${stepsExpanded ? "Hide" : "Show"} steps of ${name}`,
|
|
1541
|
+
onClick: () => onToggleSteps?.(session.id),
|
|
1542
|
+
className: "absolute top-1/2 left-1.5 z-10 grid size-5 -translate-y-1/2 place-items-center rounded-sm text-po-dim hover:text-po-hi focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none",
|
|
1543
|
+
children: stepsExpanded ? /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
1544
|
+
"aria-hidden": true,
|
|
1545
|
+
className: "size-3.5"
|
|
1546
|
+
}) : /* @__PURE__ */ jsx(ChevronRightIcon, {
|
|
1547
|
+
"aria-hidden": true,
|
|
1548
|
+
className: "size-3.5"
|
|
1549
|
+
})
|
|
1550
|
+
}),
|
|
1551
|
+
/* @__PURE__ */ jsxs("button", {
|
|
1552
|
+
type: "button",
|
|
1553
|
+
"data-testid": `desktop-menu-session-${session.id}`,
|
|
1554
|
+
"aria-current": session.active ? "true" : void 0,
|
|
1555
|
+
onClick: onOpen,
|
|
1556
|
+
className: `flex w-full items-center gap-3 rounded-xl py-2 pr-12 pl-3 text-left hover:bg-po-rail focus-visible:ring-2 focus-visible:ring-po-green focus-visible:outline-none ${session.provenance === "workflow" && session.nested ? "pl-14" : session.nested || stepsExpanded !== void 0 ? "pl-8" : ""} ${session.active ? "bg-po-rail/70" : ""}`,
|
|
1557
|
+
children: [
|
|
1558
|
+
/* @__PURE__ */ jsx("span", {
|
|
1559
|
+
className: `grid size-8 shrink-0 place-items-center rounded-lg ${failed ? "bg-po-tint-red text-po-red" : running ? "bg-po-tint-yellow text-po-yellow" : "bg-po-rail text-po-dim"}`,
|
|
1560
|
+
children: failed ? /* @__PURE__ */ jsx(AlertIcon, {
|
|
1561
|
+
"aria-hidden": true,
|
|
1562
|
+
className: "size-4"
|
|
1563
|
+
}) : running ? /* @__PURE__ */ jsx(LoaderIcon, {
|
|
1564
|
+
"aria-hidden": true,
|
|
1565
|
+
className: "size-4 animate-spin"
|
|
1566
|
+
}) : /* @__PURE__ */ jsx(MessageIcon, {
|
|
1567
|
+
"aria-hidden": true,
|
|
1568
|
+
className: "size-4"
|
|
1569
|
+
})
|
|
1570
|
+
}),
|
|
1571
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1572
|
+
className: "flex min-w-0 flex-1 flex-col",
|
|
1573
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1574
|
+
className: "truncate text-base font-medium text-po-hi",
|
|
1575
|
+
children: session.name
|
|
1576
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
1577
|
+
className: "truncate text-sm text-po-dim",
|
|
1578
|
+
children: [session.clock ? /* @__PURE__ */ jsx(LiveDuration, {
|
|
1579
|
+
label: session.clock.label,
|
|
1580
|
+
since: session.clock.since
|
|
1581
|
+
}) : session.status, workspaceName ? ` · ${workspaceName}` : null]
|
|
1582
|
+
})]
|
|
1583
|
+
}),
|
|
1584
|
+
session.awaitingInput || (session.waitingCount ?? 0) > 0 ? /* @__PURE__ */ jsxs("span", {
|
|
1585
|
+
className: "flex shrink-0 items-center",
|
|
1586
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1587
|
+
"aria-hidden": true,
|
|
1588
|
+
className: "size-2 rounded-full bg-po-magenta"
|
|
1589
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1590
|
+
className: "sr-only",
|
|
1591
|
+
children: "Waiting for you"
|
|
1592
|
+
})]
|
|
1593
|
+
}) : null
|
|
1594
|
+
]
|
|
1595
|
+
}),
|
|
1596
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
1597
|
+
asChild: true,
|
|
1598
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
1599
|
+
variant: "ghost",
|
|
1600
|
+
size: "icon-md",
|
|
1601
|
+
"aria-label": `Actions for ${name}`,
|
|
1602
|
+
title: "Session actions",
|
|
1603
|
+
"data-testid": `desktop-menu-session-actions-${session.id}`,
|
|
1604
|
+
className: "absolute top-1/2 right-2 -translate-y-1/2 rounded-full text-po-dim hover:text-po-hi",
|
|
1605
|
+
children: /* @__PURE__ */ jsx(KebabIcon, {
|
|
1395
1606
|
"aria-hidden": true,
|
|
1396
1607
|
className: "size-4"
|
|
1397
1608
|
})
|
|
1398
|
-
}),
|
|
1399
|
-
/* @__PURE__ */ jsxs("span", {
|
|
1400
|
-
className: "flex min-w-0 flex-1 flex-col",
|
|
1401
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
1402
|
-
className: "truncate text-base font-medium text-po-hi",
|
|
1403
|
-
children: session.name
|
|
1404
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1405
|
-
className: "truncate text-sm text-po-dim",
|
|
1406
|
-
children: session.clock ? /* @__PURE__ */ jsx(LiveDuration, {
|
|
1407
|
-
label: session.clock.label,
|
|
1408
|
-
since: session.clock.since
|
|
1409
|
-
}) : session.status
|
|
1410
|
-
})]
|
|
1411
|
-
}),
|
|
1412
|
-
session.awaitingInput || (session.waitingCount ?? 0) > 0 ? /* @__PURE__ */ jsxs("span", {
|
|
1413
|
-
className: "flex shrink-0 items-center",
|
|
1414
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
1415
|
-
"aria-hidden": true,
|
|
1416
|
-
className: "size-2 rounded-full bg-po-magenta"
|
|
1417
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
1418
|
-
className: "sr-only",
|
|
1419
|
-
children: "Waiting for you"
|
|
1420
|
-
})]
|
|
1421
|
-
}) : null
|
|
1422
|
-
]
|
|
1423
|
-
}), /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
1424
|
-
asChild: true,
|
|
1425
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
1426
|
-
variant: "ghost",
|
|
1427
|
-
size: "icon-md",
|
|
1428
|
-
"aria-label": `Actions for ${name}`,
|
|
1429
|
-
title: "Session actions",
|
|
1430
|
-
"data-testid": `desktop-menu-session-actions-${session.id}`,
|
|
1431
|
-
className: "absolute top-1/2 right-2 -translate-y-1/2 rounded-full text-po-dim hover:text-po-hi",
|
|
1432
|
-
children: /* @__PURE__ */ jsx(KebabIcon, {
|
|
1433
|
-
"aria-hidden": true,
|
|
1434
|
-
className: "size-4"
|
|
1435
1609
|
})
|
|
1436
|
-
})
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1610
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
1611
|
+
align: "end",
|
|
1612
|
+
"data-testid": `desktop-menu-session-actions-list-${session.id}`,
|
|
1613
|
+
children: [
|
|
1614
|
+
actions.renderSessionMenuItems(session.id),
|
|
1615
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1616
|
+
"data-testid": `desktop-session-rename-${session.id}`,
|
|
1617
|
+
onSelect: () => onDialog({
|
|
1618
|
+
mode: "rename",
|
|
1619
|
+
sessionId: session.id,
|
|
1620
|
+
name
|
|
1621
|
+
}),
|
|
1622
|
+
children: "Rename"
|
|
1448
1623
|
}),
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
onSelect: () => actions.resumeSession(session.id),
|
|
1454
|
-
children: "Resume"
|
|
1455
|
-
}),
|
|
1456
|
-
actions.openMoveSession && session.move ? /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1457
|
-
disabled: session.restarting || session.move.blocked,
|
|
1458
|
-
onSelect: () => actions.openMoveSession?.(session.id),
|
|
1459
|
-
children: "Move to workspace…"
|
|
1460
|
-
}) : null,
|
|
1461
|
-
/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1462
|
-
disabled: session.restarting || session.restartBlocked === true,
|
|
1463
|
-
onSelect: () => actions.restartSession(session.id),
|
|
1464
|
-
children: "Restart"
|
|
1465
|
-
}),
|
|
1466
|
-
/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1467
|
-
variant: "destructive",
|
|
1468
|
-
"data-testid": `desktop-session-remove-${session.id}`,
|
|
1469
|
-
onSelect: () => onDialog({
|
|
1470
|
-
mode: "remove",
|
|
1471
|
-
sessionId: session.id,
|
|
1472
|
-
name
|
|
1624
|
+
roleItem,
|
|
1625
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1626
|
+
onSelect: () => actions.resumeSession(session.id),
|
|
1627
|
+
children: "Resume"
|
|
1473
1628
|
}),
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1629
|
+
actions.openMoveSession && session.move ? /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1630
|
+
disabled: session.restarting || session.move.blocked,
|
|
1631
|
+
onSelect: () => actions.openMoveSession?.(session.id),
|
|
1632
|
+
children: "Move to workspace…"
|
|
1633
|
+
}) : null,
|
|
1634
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1635
|
+
disabled: session.restarting || session.restartBlocked === true,
|
|
1636
|
+
onSelect: () => actions.restartSession(session.id),
|
|
1637
|
+
children: "Restart"
|
|
1638
|
+
}),
|
|
1639
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1640
|
+
variant: "destructive",
|
|
1641
|
+
"data-testid": `desktop-session-remove-${session.id}`,
|
|
1642
|
+
onSelect: () => onDialog({
|
|
1643
|
+
mode: "remove",
|
|
1644
|
+
sessionId: session.id,
|
|
1645
|
+
name
|
|
1646
|
+
}),
|
|
1647
|
+
children: "Remove"
|
|
1648
|
+
})
|
|
1649
|
+
]
|
|
1650
|
+
})] })
|
|
1651
|
+
]
|
|
1478
1652
|
});
|
|
1479
1653
|
}
|
|
1480
1654
|
/** A workspace's heading: its name opens it, plus starts a session, and the dots hold the rest. */
|
|
@@ -1524,10 +1698,10 @@ function WorkspaceHeading({ workspace, actions, act, onDialog, onAddCoordinator
|
|
|
1524
1698
|
onSelect: () => act(() => actions.resumeInWorkspace(id)),
|
|
1525
1699
|
children: "Resume session"
|
|
1526
1700
|
}),
|
|
1527
|
-
actions.addCoordinator !== void 0
|
|
1701
|
+
actions.addCoordinator !== void 0 ? /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1528
1702
|
disabled: !available,
|
|
1529
1703
|
onSelect: onAddCoordinator,
|
|
1530
|
-
children: "Add
|
|
1704
|
+
children: "Add bot"
|
|
1531
1705
|
}) : null,
|
|
1532
1706
|
/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1533
1707
|
disabled: !available,
|
|
@@ -1765,14 +1939,32 @@ function DesktopMenu({ rail, onHome, onClose }) {
|
|
|
1765
1939
|
const { scrollRef, actions, pluginContent } = rail;
|
|
1766
1940
|
const [query, setQuery] = useState("");
|
|
1767
1941
|
const needle = query.trim().toLowerCase();
|
|
1942
|
+
const [expanded, setExpanded] = useDashboardState(STEPS_EXPANDED_KEY, []);
|
|
1943
|
+
const toggleSteps = useCallback((sessionId) => setExpanded((open) => open.includes(sessionId) ? open.filter((id) => id !== sessionId) : [...open, sessionId]), [setExpanded]);
|
|
1944
|
+
const all = rail.workspaces.flatMap((workspace) => workspace.sessions);
|
|
1945
|
+
const steps = railStepRows(all, new Set(expanded));
|
|
1946
|
+
const folded = new Set(steps.sessions.map((session) => session.id));
|
|
1947
|
+
const matches = new Set(all.filter((session) => session.name.toLowerCase().includes(needle)).map((s) => s.id));
|
|
1948
|
+
const shown = (session) => needle === "" ? folded.has(session.id) : matches.has(session.id) || all.some((step) => step.parentId === session.id && step.provenance === "workflow" && matches.has(step.id));
|
|
1768
1949
|
const workspaces = rail.workspaces.map((workspace) => ({
|
|
1769
1950
|
...workspace,
|
|
1770
|
-
|
|
1951
|
+
current: workspace.sessions.find((session) => session.coordinator),
|
|
1952
|
+
sessions: workspace.sessions.filter(shown)
|
|
1771
1953
|
})).filter((workspace) => needle === "" || workspace.sessions.length > 0);
|
|
1772
1954
|
const empty = rail.workspaces.length === 0;
|
|
1773
1955
|
const coordinatorHosts = rail.coordinatorHosts ?? [];
|
|
1774
|
-
const focused =
|
|
1956
|
+
const focused = all.find((session) => session.active);
|
|
1775
1957
|
const profile = focused?.profile;
|
|
1958
|
+
const [view, setView] = useDashboardState("rail/session-view", storedView);
|
|
1959
|
+
const currentView = VIEWS.find((entry) => entry.value === view) ?? VIEWS[0];
|
|
1960
|
+
const timeline = view === "sessions" ? sessionTimeline(workspaces.flatMap((workspace) => workspace.sessions.map((session) => ({
|
|
1961
|
+
session: {
|
|
1962
|
+
...session,
|
|
1963
|
+
nested: session.provenance === "workflow"
|
|
1964
|
+
},
|
|
1965
|
+
workspace,
|
|
1966
|
+
workspaceName: workspace.kind === "session" ? void 0 : workspace.name
|
|
1967
|
+
})))) : [];
|
|
1776
1968
|
const [, setDialog] = useDashboardState(MENU_DIALOG_KEY, null);
|
|
1777
1969
|
const act = (action) => {
|
|
1778
1970
|
action();
|
|
@@ -1787,6 +1979,20 @@ function DesktopMenu({ rail, onHome, onClose }) {
|
|
|
1787
1979
|
});
|
|
1788
1980
|
});
|
|
1789
1981
|
});
|
|
1982
|
+
const row = (session, workspace, workspaceName) => /* @__PURE__ */ jsx(SessionRow, {
|
|
1983
|
+
session,
|
|
1984
|
+
actions,
|
|
1985
|
+
coordinates: workspace.kind === "session" ? "Home" : workspace.name,
|
|
1986
|
+
coordinator: workspace.current === void 0 || workspace.current.id === session.id ? void 0 : workspace.current.name,
|
|
1987
|
+
workspaceName,
|
|
1988
|
+
onOpen: () => act(() => actions.openSession(session.id)),
|
|
1989
|
+
onDialog: (dialog) => act(() => setDialog(dialog)),
|
|
1990
|
+
onRole: (next) => report("Could not change the role", () => actions.setSessionRole?.(session.id, next)),
|
|
1991
|
+
...steps.withSteps.has(session.id) ? {
|
|
1992
|
+
stepsExpanded: expanded.includes(session.id),
|
|
1993
|
+
onToggleSteps: toggleSteps
|
|
1994
|
+
} : {}
|
|
1995
|
+
}, session.id);
|
|
1790
1996
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1791
1997
|
/* @__PURE__ */ jsxs("label", {
|
|
1792
1998
|
className: "m-4 mb-2 flex items-center gap-2.5 rounded-xl bg-po-panel px-3.5 py-2.5 ring-1 ring-po-border-soft focus-within:ring-po-green",
|
|
@@ -1807,9 +2013,9 @@ function DesktopMenu({ rail, onHome, onClose }) {
|
|
|
1807
2013
|
"aria-label": "Sessions",
|
|
1808
2014
|
className: "flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto px-2 py-2",
|
|
1809
2015
|
children: [
|
|
1810
|
-
/* @__PURE__ */
|
|
2016
|
+
/* @__PURE__ */ jsx("div", {
|
|
1811
2017
|
className: "flex items-center gap-1 pr-3",
|
|
1812
|
-
children:
|
|
2018
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
1813
2019
|
type: "button",
|
|
1814
2020
|
"data-testid": "desktop-menu-home",
|
|
1815
2021
|
onClick: () => act(onHome),
|
|
@@ -1821,44 +2027,99 @@ function DesktopMenu({ rail, onHome, onClose }) {
|
|
|
1821
2027
|
className: "size-4"
|
|
1822
2028
|
})
|
|
1823
2029
|
}), "Home"]
|
|
1824
|
-
})
|
|
1825
|
-
asChild: true,
|
|
1826
|
-
children: /* @__PURE__ */ jsx(Button, {
|
|
1827
|
-
variant: "ghost",
|
|
1828
|
-
size: "icon",
|
|
1829
|
-
"aria-label": "Create workspace or session",
|
|
1830
|
-
title: "Create workspace or session",
|
|
1831
|
-
"data-testid": "session-create-menu",
|
|
1832
|
-
className: "size-6 rounded-full text-po-dim",
|
|
1833
|
-
children: /* @__PURE__ */ jsx(PlusIcon, { className: "size-3.5" })
|
|
1834
|
-
})
|
|
1835
|
-
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
1836
|
-
align: "end",
|
|
1837
|
-
className: "min-w-56",
|
|
1838
|
-
children: [
|
|
1839
|
-
/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1840
|
-
"data-testid": "add-workspace-open",
|
|
1841
|
-
onSelect: () => act(actions.openAddWorkspace),
|
|
1842
|
-
children: "Create workspace"
|
|
1843
|
-
}),
|
|
1844
|
-
actions.createGeneralSession ? /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1845
|
-
"data-testid": "new-session-open",
|
|
1846
|
-
onSelect: () => act(actions.createGeneralSession),
|
|
1847
|
-
children: "Create session"
|
|
1848
|
-
}) : null,
|
|
1849
|
-
actions.addCoordinator ? coordinatorHosts.filter((host) => !host.coordinated).map((host) => /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1850
|
-
"data-testid": host.hostId ? `coordinator-create-${host.hostId}` : "coordinator-create",
|
|
1851
|
-
onSelect: () => report("Could not add a coordinator", () => actions.addCoordinator?.(void 0, host.hostId)),
|
|
1852
|
-
children: coordinatorHosts.length > 1 ? `Create coordinator on ${host.label}` : "Create coordinator"
|
|
1853
|
-
}, host.hostId ?? "local")) : null
|
|
1854
|
-
]
|
|
1855
|
-
})] })]
|
|
2030
|
+
})
|
|
1856
2031
|
}),
|
|
1857
2032
|
/* @__PURE__ */ jsx("div", {
|
|
1858
2033
|
"data-rail": "desktop",
|
|
1859
2034
|
className: "group/rail -mt-2.5 flex flex-col gap-0.5 pr-3 empty:hidden",
|
|
1860
2035
|
children: pluginContent
|
|
1861
2036
|
}),
|
|
2037
|
+
/* @__PURE__ */ jsxs("div", {
|
|
2038
|
+
className: "flex items-center gap-0.5 pt-1 pr-2 pl-3",
|
|
2039
|
+
children: [
|
|
2040
|
+
/* @__PURE__ */ jsx("h2", {
|
|
2041
|
+
className: "min-w-0 flex-1 truncate text-base font-semibold text-po-hi",
|
|
2042
|
+
children: "Sessions"
|
|
2043
|
+
}),
|
|
2044
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
2045
|
+
asChild: true,
|
|
2046
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
2047
|
+
variant: "ghost",
|
|
2048
|
+
size: "icon",
|
|
2049
|
+
"data-testid": "session-view-menu",
|
|
2050
|
+
title: `View: ${currentView.title}`,
|
|
2051
|
+
"aria-label": `View: ${currentView.title}`,
|
|
2052
|
+
className: "size-6 rounded-full text-po-dim",
|
|
2053
|
+
children: /* @__PURE__ */ jsx(SlidersIcon, { className: "size-3.5" })
|
|
2054
|
+
})
|
|
2055
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
2056
|
+
align: "end",
|
|
2057
|
+
"aria-label": "View",
|
|
2058
|
+
children: VIEWS.map(({ value, title, description, Icon }) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
2059
|
+
"data-testid": `session-view-${value}`,
|
|
2060
|
+
"aria-checked": view === value,
|
|
2061
|
+
role: "menuitemradio",
|
|
2062
|
+
onSelect: () => {
|
|
2063
|
+
setView(value);
|
|
2064
|
+
keepView(value);
|
|
2065
|
+
},
|
|
2066
|
+
className: `items-start gap-2.5 ${view === value ? "bg-po-tint-green" : ""}`,
|
|
2067
|
+
children: [
|
|
2068
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
2069
|
+
"aria-hidden": true,
|
|
2070
|
+
className: `mt-0.5 size-4 shrink-0 ${view === value ? "text-po-green" : "text-po-dim"}`
|
|
2071
|
+
}),
|
|
2072
|
+
/* @__PURE__ */ jsxs("span", {
|
|
2073
|
+
className: "flex min-w-0 flex-1 flex-col",
|
|
2074
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2075
|
+
className: "text-po-hi",
|
|
2076
|
+
children: title
|
|
2077
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2078
|
+
className: "text-sm text-po-dim",
|
|
2079
|
+
children: description
|
|
2080
|
+
})]
|
|
2081
|
+
}),
|
|
2082
|
+
view === value ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
2083
|
+
"aria-hidden": true,
|
|
2084
|
+
className: "mt-0.5 size-4 shrink-0 text-po-green"
|
|
2085
|
+
}) : null
|
|
2086
|
+
]
|
|
2087
|
+
}, value))
|
|
2088
|
+
})] }),
|
|
2089
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
2090
|
+
asChild: true,
|
|
2091
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
2092
|
+
variant: "ghost",
|
|
2093
|
+
size: "icon",
|
|
2094
|
+
"aria-label": "Create workspace or session",
|
|
2095
|
+
title: "Create workspace or session",
|
|
2096
|
+
"data-testid": "session-create-menu",
|
|
2097
|
+
className: "size-6 rounded-full text-po-dim",
|
|
2098
|
+
children: /* @__PURE__ */ jsx(PlusIcon, { className: "size-3.5" })
|
|
2099
|
+
})
|
|
2100
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
2101
|
+
align: "end",
|
|
2102
|
+
className: "min-w-56",
|
|
2103
|
+
children: [
|
|
2104
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
2105
|
+
"data-testid": "add-workspace-open",
|
|
2106
|
+
onSelect: () => act(actions.openAddWorkspace),
|
|
2107
|
+
children: "Create workspace"
|
|
2108
|
+
}),
|
|
2109
|
+
actions.createGeneralSession ? /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
2110
|
+
"data-testid": "new-session-open",
|
|
2111
|
+
onSelect: () => act(actions.createGeneralSession),
|
|
2112
|
+
children: "Create session"
|
|
2113
|
+
}) : null,
|
|
2114
|
+
actions.addCoordinator ? coordinatorHosts.map((host) => /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
2115
|
+
"data-testid": host.hostId ? `coordinator-create-${host.hostId}` : "coordinator-create",
|
|
2116
|
+
onSelect: () => report("Could not add a bot", () => actions.addCoordinator?.(void 0, host.hostId)),
|
|
2117
|
+
children: coordinatorHosts.length > 1 ? `Create bot on ${host.label}` : "Create bot"
|
|
2118
|
+
}, host.hostId ?? "local")) : null
|
|
2119
|
+
]
|
|
2120
|
+
})] })
|
|
2121
|
+
]
|
|
2122
|
+
}),
|
|
1862
2123
|
empty ? /* @__PURE__ */ jsxs("div", {
|
|
1863
2124
|
className: "flex flex-col items-center gap-3 px-6 py-8 text-center",
|
|
1864
2125
|
children: [
|
|
@@ -1884,39 +2145,38 @@ function DesktopMenu({ rail, onHome, onClose }) {
|
|
|
1884
2145
|
children: "Start a session without a folder"
|
|
1885
2146
|
}) : null
|
|
1886
2147
|
]
|
|
1887
|
-
}) :
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
className: "
|
|
1892
|
-
children:
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
}),
|
|
2148
|
+
}) : view === "sessions" ? timeline.map((section) => /* @__PURE__ */ jsxs("div", {
|
|
2149
|
+
"data-testid": `session-timeline-${section.key}`,
|
|
2150
|
+
className: "flex flex-col",
|
|
2151
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
2152
|
+
className: "pt-1 pr-2 pb-1 pl-3 text-sm font-semibold text-po-dim",
|
|
2153
|
+
children: section.title
|
|
2154
|
+
}), section.data.map(({ session, workspace, workspaceName }) => row(session, workspace, workspaceName))]
|
|
2155
|
+
}, section.key)) : workspaces.map((workspace) => /* @__PURE__ */ jsxs("div", {
|
|
2156
|
+
className: "flex flex-col",
|
|
2157
|
+
children: [
|
|
2158
|
+
workspace.kind === "session" ? null : /* @__PURE__ */ jsx(WorkspaceHeading, {
|
|
2159
|
+
workspace,
|
|
2160
|
+
actions,
|
|
2161
|
+
act,
|
|
2162
|
+
onDialog: (dialog) => act(() => setDialog(dialog)),
|
|
2163
|
+
onAddCoordinator: () => report("Could not add a bot", () => actions.addCoordinator?.(workspace.id))
|
|
2164
|
+
}),
|
|
2165
|
+
workspace.kind !== "session" && !workspace.available ? /* @__PURE__ */ jsx("p", {
|
|
2166
|
+
className: "px-3 pb-1 text-sm text-po-red",
|
|
2167
|
+
children: "Workspace unavailable"
|
|
2168
|
+
}) : null,
|
|
2169
|
+
workspace.sessions.map((session) => row(session, workspace)),
|
|
2170
|
+
workspace.sessions.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
2171
|
+
className: "px-3 py-1 text-sm text-po-dim",
|
|
2172
|
+
children: "No sessions yet."
|
|
2173
|
+
}) : null
|
|
2174
|
+
]
|
|
2175
|
+
}, workspace.id)),
|
|
2176
|
+
needle === "" && !empty && view === "sessions" && timeline.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
2177
|
+
className: "px-3 py-1 text-sm text-po-dim",
|
|
2178
|
+
children: "No sessions yet."
|
|
2179
|
+
}) : null,
|
|
1920
2180
|
needle !== "" && workspaces.length === 0 ? /* @__PURE__ */ jsxs("p", {
|
|
1921
2181
|
className: "px-3 py-2 text-sm text-po-dim",
|
|
1922
2182
|
children: [
|
|
@@ -2582,6 +2842,7 @@ const FocusedSession = memo(function FocusedSession({ sessionId, tabId, windowed
|
|
|
2582
2842
|
"..."
|
|
2583
2843
|
]
|
|
2584
2844
|
}),
|
|
2845
|
+
/* @__PURE__ */ jsx(ConversationStrip, { sessionId }),
|
|
2585
2846
|
/* @__PURE__ */ jsxs("div", {
|
|
2586
2847
|
className: "flex min-h-0 flex-1 overflow-hidden",
|
|
2587
2848
|
children: [
|
|
@@ -2615,19 +2876,33 @@ const FocusedSession = memo(function FocusedSession({ sessionId, tabId, windowed
|
|
|
2615
2876
|
});
|
|
2616
2877
|
/** Any other session: a live, read-only transcript. Clicking the window focuses the session. */
|
|
2617
2878
|
const WatchingSession = memo(function WatchingSession({ sessionId }) {
|
|
2618
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2879
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2880
|
+
/* @__PURE__ */ jsx(ConversationStrip, { sessionId }),
|
|
2881
|
+
/* @__PURE__ */ jsx("div", {
|
|
2882
|
+
className: "mx-auto flex min-h-0 w-full max-w-[960px] flex-1 flex-col overflow-hidden px-2 sm:px-4",
|
|
2883
|
+
children: /* @__PURE__ */ jsx(SessionTranscriptView, {
|
|
2884
|
+
sessionId,
|
|
2885
|
+
watch: watchDashboardTranscript,
|
|
2886
|
+
renderTurn: QuietTurn,
|
|
2887
|
+
showThinking: false
|
|
2888
|
+
})
|
|
2889
|
+
}),
|
|
2890
|
+
/* @__PURE__ */ jsx("p", {
|
|
2891
|
+
className: "shrink-0 px-6 pb-4 text-center text-sm text-po-dim",
|
|
2892
|
+
children: "Click to focus and reply"
|
|
2625
2893
|
})
|
|
2626
|
-
})
|
|
2627
|
-
className: "shrink-0 px-6 pb-4 text-center text-sm text-po-dim",
|
|
2628
|
-
children: "Click to focus and reply"
|
|
2629
|
-
})] });
|
|
2894
|
+
] });
|
|
2630
2895
|
});
|
|
2896
|
+
/** A plugin's line about the window's own session, such as the run a workflow step belongs to. */
|
|
2897
|
+
function ConversationStrip({ sessionId }) {
|
|
2898
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2899
|
+
className: "mx-auto w-full max-w-[960px] shrink-0 px-2 pb-2 empty:hidden sm:px-6",
|
|
2900
|
+
children: /* @__PURE__ */ jsx(PluginSurface, {
|
|
2901
|
+
slot: HOST_SLOTS.conversationStrip,
|
|
2902
|
+
sessionId
|
|
2903
|
+
})
|
|
2904
|
+
});
|
|
2905
|
+
}
|
|
2631
2906
|
/** A temporary tab in its own window: the panel it was opened with, and the composer when it keeps one. */
|
|
2632
2907
|
const TabWindowBody = memo(function TabWindowBody({ sessionId, tabId, focused }) {
|
|
2633
2908
|
const slotProps = usePluginSlotProps(sessionId);
|
|
@@ -2799,7 +3074,8 @@ function sentenceCase$1(name) {
|
|
|
2799
3074
|
*/
|
|
2800
3075
|
function Widget({ group, slotProps, editing, expanded, onRemove, onToggle }) {
|
|
2801
3076
|
const detailed = slotFills(activityGroupSlot(group.name)).length > 0;
|
|
2802
|
-
const
|
|
3077
|
+
const collapsible = group.collapsible !== false;
|
|
3078
|
+
const open = detailed && (!collapsible || expanded);
|
|
2803
3079
|
const Glyph = group.icon ?? ActivityIcon;
|
|
2804
3080
|
const label = sentenceCase$1(group.name);
|
|
2805
3081
|
const folded = group.summary || (group.active ? "Working" : detailed ? null : "Idle");
|
|
@@ -2843,7 +3119,7 @@ function Widget({ group, slotProps, editing, expanded, onRemove, onToggle }) {
|
|
|
2843
3119
|
"aria-hidden": true,
|
|
2844
3120
|
className: "size-3.5 shrink-0 text-po-faint group-hover/heading:text-po-dim"
|
|
2845
3121
|
})]
|
|
2846
|
-
}), detailed ? /* @__PURE__ */ jsx("button", {
|
|
3122
|
+
}), detailed && collapsible ? /* @__PURE__ */ jsx("button", {
|
|
2847
3123
|
type: "button",
|
|
2848
3124
|
"aria-expanded": open,
|
|
2849
3125
|
"aria-label": open ? `Fold ${label}` : `Unfold ${label}`,
|
|
@@ -3042,10 +3318,13 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3042
3318
|
const narrow = rootSize.width > 0 && rootSize.width < NARROW;
|
|
3043
3319
|
const routeWindow = routeWindowFor(route.kind, route.sessionId, route.workspaceId);
|
|
3044
3320
|
const sessionIds = useMemo(() => new Set(sessionIdList.split("\n").filter(Boolean)), [sessionIdList]);
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3321
|
+
const stepLinks = useStore(sessionsStore, (state) => Object.values(state.byId).flatMap(({ summary }) => summary.sessionProvenance === "workflow" && summary.parentSessionId !== void 0 ? [`${summary.id} ${summary.parentSessionId}`] : []).join("\n"));
|
|
3322
|
+
const stepParents = useMemo(() => new Map(stepLinks.split("\n").filter(Boolean).map((line) => line.split(" "))), [stepLinks]);
|
|
3323
|
+
const layout = drawnLayout(stored, routeWindow, hydrated ? {
|
|
3324
|
+
sessionIds,
|
|
3325
|
+
tabOpen: (sessionId, tabId) => findTransientTab(transient, sessionId, tabId) !== void 0,
|
|
3326
|
+
stepParent: (sessionId) => stepParents.get(sessionId)
|
|
3327
|
+
} : void 0);
|
|
3049
3328
|
useEffect(() => {
|
|
3050
3329
|
if (layout !== stored) setStored(layout);
|
|
3051
3330
|
}, [
|
|
@@ -3053,6 +3332,12 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3053
3332
|
stored,
|
|
3054
3333
|
setStored
|
|
3055
3334
|
]);
|
|
3335
|
+
const sessionFallback = dashboardStateFor("navigation/sessionFallback", void 0);
|
|
3336
|
+
useLayoutEffect(() => {
|
|
3337
|
+
const windows = stored.z.slice().reverse().map((id) => findWindow(stored, id)).filter((win) => win?.kind === "session");
|
|
3338
|
+
sessionFallback.setState(() => windows.sort((a, b) => Number(a.minimized === true) - Number(b.minimized === true)).map((win) => win.sessionId));
|
|
3339
|
+
return () => sessionFallback.setState(() => void 0);
|
|
3340
|
+
}, [stored, sessionFallback]);
|
|
3056
3341
|
useEffect(() => {
|
|
3057
3342
|
try {
|
|
3058
3343
|
window.localStorage.setItem(LAYOUT_STORAGE_KEY, serializeLayout(stored));
|
|
@@ -3065,7 +3350,7 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3065
3350
|
const target = routeWindowFor(kind, routeSessionId, routeWorkspaceId);
|
|
3066
3351
|
if (target === void 0) return;
|
|
3067
3352
|
setStored((previous) => {
|
|
3068
|
-
const next = openWindow(previous, target);
|
|
3353
|
+
const next = raiseSession(openWindow(previous, target), target.id);
|
|
3069
3354
|
const tabWindow = routeSessionId !== void 0 && routeTabId !== void 0 ? tabWindowId(routeSessionId, routeTabId) : void 0;
|
|
3070
3355
|
return tabWindow !== void 0 && findWindow(next, tabWindow) !== void 0 ? focusWindow(next, tabWindow) : next;
|
|
3071
3356
|
});
|
|
@@ -3124,13 +3409,14 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3124
3409
|
}
|
|
3125
3410
|
const workspace = rail.workspaces.find((entry) => entry.sessions.some((session) => session.id === win.sessionId));
|
|
3126
3411
|
const railSession = workspace?.sessions.find((session) => session.id === win.sessionId);
|
|
3412
|
+
const name = railSession?.name || (win.sessionId === void 0 ? "" : sessionsStore.state.byId[win.sessionId]?.summary.name);
|
|
3127
3413
|
if (win.kind === "tab") return {
|
|
3128
3414
|
title: findTransientTab(transient, win.sessionId, win.tabId)?.label ?? "Tab",
|
|
3129
|
-
subtitle:
|
|
3415
|
+
subtitle: name || void 0
|
|
3130
3416
|
};
|
|
3131
3417
|
const where = [workspace?.kind === "session" ? void 0 : workspace?.name, railSession?.git?.branch].filter(Boolean).join(" · ");
|
|
3132
3418
|
return {
|
|
3133
|
-
title:
|
|
3419
|
+
title: name || "Untitled",
|
|
3134
3420
|
subtitle: win.sessionId === activeId ? where || void 0 : "read only"
|
|
3135
3421
|
};
|
|
3136
3422
|
};
|
|
@@ -3169,8 +3455,10 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3169
3455
|
onOpenInWindow: openTabWindow
|
|
3170
3456
|
});
|
|
3171
3457
|
};
|
|
3458
|
+
const railSessionOf = (sessionId) => sessionId === void 0 ? void 0 : rail.workspaces.flatMap((entry) => entry.sessions).find((session) => session.id === sessionId);
|
|
3172
3459
|
const barStacks = stacks.map((stack) => {
|
|
3173
3460
|
const top = stack.members[stack.members.length - 1];
|
|
3461
|
+
const named = findWindow(layout, stack.root) ?? top;
|
|
3174
3462
|
const base = {
|
|
3175
3463
|
root: stack.root,
|
|
3176
3464
|
kind: top.kind,
|
|
@@ -3179,21 +3467,25 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3179
3467
|
};
|
|
3180
3468
|
const minimized = top.minimized === true;
|
|
3181
3469
|
const swap = stack.members.length > 1 ? `${stack.members.length} windows stacked, click again to swap` : void 0;
|
|
3182
|
-
const workspace = rail.workspaces.find((entry) => entry.sessions.some((session) => session.id ===
|
|
3183
|
-
const railSession = workspace?.sessions.find((session) => session.id ===
|
|
3470
|
+
const workspace = rail.workspaces.find((entry) => entry.sessions.some((session) => session.id === named.sessionId));
|
|
3471
|
+
const railSession = workspace?.sessions.find((session) => session.id === named.sessionId);
|
|
3184
3472
|
if (railSession === void 0) return {
|
|
3185
3473
|
...base,
|
|
3186
3474
|
minimized,
|
|
3187
3475
|
label: titleOf(top).title,
|
|
3188
3476
|
details: [swap].filter((line) => line !== void 0)
|
|
3189
3477
|
};
|
|
3478
|
+
const members = [...new Set(stack.members.map((member) => member.sessionId))].flatMap((id) => {
|
|
3479
|
+
const session = railSessionOf(id);
|
|
3480
|
+
return session === void 0 ? [] : [session];
|
|
3481
|
+
});
|
|
3190
3482
|
const where = [workspace?.kind === "session" ? void 0 : workspace?.name, railSession.git ? `${railSession.git.branch}${railSession.git.dirty ? ", changed" : ""}` : void 0].filter(Boolean).join(" · ");
|
|
3191
|
-
const waiting =
|
|
3483
|
+
const waiting = members.reduce((total, session) => total + (session.waitingCount ?? 0), 0);
|
|
3192
3484
|
const details = [
|
|
3193
|
-
top.
|
|
3485
|
+
top.id === named.id ? void 0 : `Showing ${titleOf(top).title}`,
|
|
3194
3486
|
where || void 0,
|
|
3195
3487
|
waiting > 0 ? `${waiting} waiting for you` : void 0,
|
|
3196
|
-
|
|
3488
|
+
top.sessionId === activeId ? void 0 : "Read only, click to focus and reply",
|
|
3197
3489
|
minimized ? "Minimized" : void 0,
|
|
3198
3490
|
swap
|
|
3199
3491
|
];
|
|
@@ -3202,7 +3494,7 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3202
3494
|
minimized,
|
|
3203
3495
|
label: railSession.name || "Untitled",
|
|
3204
3496
|
profile: railSession.profile,
|
|
3205
|
-
running: sessionRunning
|
|
3497
|
+
running: members.some(sessionRunning),
|
|
3206
3498
|
waiting,
|
|
3207
3499
|
status: railSession.status,
|
|
3208
3500
|
clock: railSession.clock,
|
|
@@ -3223,7 +3515,11 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3223
3515
|
if (next.sessionId !== void 0 && next.sessionId !== activeId) rail.actions.openSession(next.sessionId);
|
|
3224
3516
|
} else update((current) => minimizeWindow(current, root));
|
|
3225
3517
|
};
|
|
3226
|
-
const
|
|
3518
|
+
const sessions = rail.workspaces.flatMap((workspace) => workspace.sessions);
|
|
3519
|
+
const countWaiting = (list) => list.reduce((total, session) => total + (session.waitingCount ?? (session.awaitingInput ? 1 : 0)), 0);
|
|
3520
|
+
const waiting = countWaiting(sessions);
|
|
3521
|
+
const barSessionIds = new Set(stacks.flatMap((stack) => stack.members.map((member) => member.sessionId)));
|
|
3522
|
+
const offBar = sessions.filter((session) => !barSessionIds.has(session.id));
|
|
3227
3523
|
const activityShown = narrow ? narrowActivity : !layout.activityHidden;
|
|
3228
3524
|
const slotProps = usePluginSlotProps(activeId);
|
|
3229
3525
|
const declaredFaces = useDockFaces(activeId).filter((entry) => entry.requiredMinorMode === void 0 || slotProps.activeMinorModes?.includes(entry.requiredMinorMode));
|
|
@@ -3307,6 +3603,7 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3307
3603
|
const isFront = front?.id === win.id;
|
|
3308
3604
|
const { title, subtitle } = titleOf(win);
|
|
3309
3605
|
const root = findWindow(layout, stackRoot(win)) ?? win;
|
|
3606
|
+
const renameId = win.kind === "session" ? win.sessionId : void 0;
|
|
3310
3607
|
return /* @__PURE__ */ jsx(DesktopWindow, {
|
|
3311
3608
|
testId: `desktop-window-${win.id}`,
|
|
3312
3609
|
title,
|
|
@@ -3322,6 +3619,7 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3322
3619
|
headerRegion: win.kind === "session" && win.sessionId === activeId ? "header" : void 0,
|
|
3323
3620
|
onFocus: () => focus(win),
|
|
3324
3621
|
onClose: () => close(win),
|
|
3622
|
+
onRename: renameId === void 0 ? void 0 : () => openSessionRenameDialog(renameId, title),
|
|
3325
3623
|
onMinimize: () => update((current) => minimizeWindow(current, win.id)),
|
|
3326
3624
|
onToggleMaximize: () => update((current) => toggleMaximize(current, win.id)),
|
|
3327
3625
|
onPlace: (rect) => update((current) => placeWindow(current, win.id, rect)),
|
|
@@ -3359,6 +3657,8 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3359
3657
|
}),
|
|
3360
3658
|
stacks: barStacks,
|
|
3361
3659
|
waiting,
|
|
3660
|
+
menuWaiting: menuOpen ? 0 : countWaiting(offBar),
|
|
3661
|
+
menuRunning: offBar.filter(sessionRunning).length,
|
|
3362
3662
|
remote: rail.remote.status,
|
|
3363
3663
|
faces: railFaces,
|
|
3364
3664
|
face,
|