@agimon-ai/po-template-desktop 0.0.0-alpha.151 → 0.0.0-alpha.152
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 +291 -99
- package/dist/extensions/web.mjs.map +1 -1
- package/dist/webClient.cjs +289 -97
- package/dist/webClient.cjs.map +1 -1
- package/dist/webClient.mjs +291 -99
- package/dist/webClient.mjs.map +1 -1
- package/package.json +6 -6
package/dist/extensions/web.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
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";
|
|
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";
|
|
@@ -396,6 +396,19 @@ function pruneLayout(layout, sessionIds, tabOpen) {
|
|
|
396
396
|
z: layout.z.filter((id) => windows.some((win) => win.id === id))
|
|
397
397
|
};
|
|
398
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* The layout drawn: the saved one adjusted to what exists now. Windows of deleted sessions and closed tabs go,
|
|
401
|
+
* the route's window is there, and Settings or a page only while routed. A removed session's route lingers until
|
|
402
|
+
* the host navigates away, so its window is not reopened: pruning and reopening it would never settle.
|
|
403
|
+
*/
|
|
404
|
+
function drawnLayout(stored, routeWindow, live) {
|
|
405
|
+
let layout = live === void 0 ? stored : pruneLayout(stored, live.sessionIds, live.tabOpen);
|
|
406
|
+
if (routeWindow?.kind !== "settings") layout = closeWindow(layout, "settings");
|
|
407
|
+
if (routeWindow?.kind !== "page") layout = closeWindow(layout, "page");
|
|
408
|
+
const gone = live !== void 0 && routeWindow?.kind === "session" && !live.sessionIds.has(routeWindow.sessionId);
|
|
409
|
+
if (routeWindow !== void 0 && !gone && findWindow(layout, routeWindow.id) === void 0) layout = openWindow(layout, routeWindow);
|
|
410
|
+
return layout;
|
|
411
|
+
}
|
|
399
412
|
/** The widgets to draw: the person's choice, limited to groups that exist, or all of them. */
|
|
400
413
|
function chosenWidgets(layout, available) {
|
|
401
414
|
return layout.widgets === null ? available : layout.widgets.filter((name) => available.includes(name));
|
|
@@ -915,7 +928,7 @@ function Control({ label, onClick, children }) {
|
|
|
915
928
|
* dropping it on an edge or from the title's menu. The live position stays local while the
|
|
916
929
|
* pointer moves; only the final place goes back to the layout.
|
|
917
930
|
*/
|
|
918
|
-
function DesktopWindow({ title, subtitle, rect, layer, focused, minimized, maximized, stacked, narrow, desktop, headerRegion, testId, onFocus, onClose, onMinimize, onToggleMaximize, onPlace, onResetPlace, onSnapPreview, children }) {
|
|
931
|
+
function DesktopWindow({ title, subtitle, rect, layer, focused, minimized, maximized, stacked, narrow, desktop, headerRegion, testId, onFocus, onClose, onRename, onMinimize, onToggleMaximize, onPlace, onResetPlace, onSnapPreview, children }) {
|
|
919
932
|
const gesture = useRef(null);
|
|
920
933
|
const [live, setLive] = useState(null);
|
|
921
934
|
const fixed = narrow || maximized;
|
|
@@ -998,7 +1011,7 @@ function DesktopWindow({ title, subtitle, rect, layer, focused, minimized, maxim
|
|
|
998
1011
|
/* @__PURE__ */ jsxs("header", {
|
|
999
1012
|
"data-po-region": headerRegion,
|
|
1000
1013
|
onPointerDown: (event) => {
|
|
1001
|
-
if (event.target.closest("button") !== null) return;
|
|
1014
|
+
if (event.target.closest("button, [data-window-control]") !== null) return;
|
|
1002
1015
|
begin(event, {
|
|
1003
1016
|
kind: "move",
|
|
1004
1017
|
x: event.clientX,
|
|
@@ -1011,7 +1024,7 @@ function DesktopWindow({ title, subtitle, rect, layer, focused, minimized, maxim
|
|
|
1011
1024
|
onPointerUp: end,
|
|
1012
1025
|
onPointerCancel: end,
|
|
1013
1026
|
onDoubleClick: (event) => {
|
|
1014
|
-
if (event.target.closest("button") === null && !narrow) onToggleMaximize();
|
|
1027
|
+
if (event.target.closest("button, [data-window-control]") === null && !narrow) onToggleMaximize();
|
|
1015
1028
|
},
|
|
1016
1029
|
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
1030
|
children: [
|
|
@@ -1031,9 +1044,14 @@ function DesktopWindow({ title, subtitle, rect, layer, focused, minimized, maxim
|
|
|
1031
1044
|
}) : null]
|
|
1032
1045
|
})
|
|
1033
1046
|
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
1047
|
+
"data-window-control": true,
|
|
1034
1048
|
align: "center",
|
|
1035
1049
|
className: "min-w-52",
|
|
1036
1050
|
children: [
|
|
1051
|
+
onRename === void 0 ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1052
|
+
onSelect: onRename,
|
|
1053
|
+
children: "Rename"
|
|
1054
|
+
}), /* @__PURE__ */ jsx(DropdownMenuSeparator, {})] }),
|
|
1037
1055
|
narrow ? null : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1038
1056
|
/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
1039
1057
|
onSelect: onToggleMaximize,
|
|
@@ -1189,19 +1207,36 @@ function Clock() {
|
|
|
1189
1207
|
* The floating bar: the Po button that opens the menu, one button per window stack, what waits
|
|
1190
1208
|
* on the person, remote access, the Activity toggle and the clock.
|
|
1191
1209
|
*/
|
|
1192
|
-
function DesktopBar({ menuOpen, menuTrigger, stacks, waiting, remote, faces, face, railShown, homeShown, onHome, onStack, onRemote, onFace }) {
|
|
1210
|
+
function DesktopBar({ menuOpen, menuTrigger, stacks, waiting, menuWaiting = 0, menuRunning = 0, remote, faces, face, railShown, homeShown, onHome, onStack, onRemote, onFace }) {
|
|
1193
1211
|
const shownFace = railShown ? face : null;
|
|
1194
1212
|
return /* @__PURE__ */ jsxs("footer", {
|
|
1195
1213
|
className: `relative mx-3 mb-3 flex h-14 shrink-0 items-center gap-1 rounded-2xl px-2 shadow-lg ${GLASS}`,
|
|
1196
1214
|
children: [
|
|
1197
1215
|
menuTrigger(/* @__PURE__ */ jsxs("button", {
|
|
1198
1216
|
type: "button",
|
|
1199
|
-
"aria-label":
|
|
1217
|
+
"aria-label": `Open the Po menu${menuWaiting > 0 ? `, ${menuWaiting} waiting for you` : ""}${menuRunning > 0 ? `, ${menuRunning} running` : ""}`,
|
|
1200
1218
|
"data-testid": "desktop-po-button",
|
|
1201
1219
|
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
|
-
|
|
1220
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
1221
|
+
className: "relative shrink-0",
|
|
1222
|
+
children: [
|
|
1223
|
+
/* @__PURE__ */ jsx(MascotMark, {
|
|
1224
|
+
size: 28,
|
|
1225
|
+
className: "rounded-lg shadow-sm"
|
|
1226
|
+
}),
|
|
1227
|
+
menuWaiting > 0 ? /* @__PURE__ */ jsx("span", {
|
|
1228
|
+
"aria-hidden": true,
|
|
1229
|
+
"data-testid": "desktop-po-waiting",
|
|
1230
|
+
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",
|
|
1231
|
+
children: menuWaiting > 9 ? "9+" : menuWaiting
|
|
1232
|
+
}) : null,
|
|
1233
|
+
menuRunning > 0 ? /* @__PURE__ */ jsx("span", {
|
|
1234
|
+
"aria-hidden": true,
|
|
1235
|
+
"data-testid": "desktop-po-running",
|
|
1236
|
+
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",
|
|
1237
|
+
children: menuRunning > 9 ? "9+" : menuRunning
|
|
1238
|
+
}) : null
|
|
1239
|
+
]
|
|
1205
1240
|
}), /* @__PURE__ */ jsx("span", {
|
|
1206
1241
|
className: "text-base font-semibold text-po-hi max-sm:hidden",
|
|
1207
1242
|
children: "Po"
|
|
@@ -1348,13 +1383,71 @@ function DesktopBar({ menuOpen, menuTrigger, stacks, waiting, remote, faces, fac
|
|
|
1348
1383
|
});
|
|
1349
1384
|
}
|
|
1350
1385
|
//#endregion
|
|
1386
|
+
//#region src/extensions/(frontend)/template/_lib/sessionTimeline.ts
|
|
1387
|
+
/** A question, a pending approval, or background work blocks on the person. */
|
|
1388
|
+
const needsYou = (session) => session.awaitingInput || (session.waitingCount ?? 0) > 0;
|
|
1389
|
+
/**
|
|
1390
|
+
* The Sessions view, as Advanced draws it: what waits on the person, then the rest, each newest change first;
|
|
1391
|
+
* no time sorts last. Templates never import each other, so this mirrors Advanced's `sessionTimeline`.
|
|
1392
|
+
*/
|
|
1393
|
+
function sessionTimeline(items) {
|
|
1394
|
+
const sorted = [...items].sort((a, b) => (b.session.lastActivityAt ?? 0) - (a.session.lastActivityAt ?? 0));
|
|
1395
|
+
return [{
|
|
1396
|
+
key: "needs",
|
|
1397
|
+
title: "Needs you",
|
|
1398
|
+
data: sorted.filter(({ session }) => needsYou(session))
|
|
1399
|
+
}, {
|
|
1400
|
+
key: "recent",
|
|
1401
|
+
title: "Recent",
|
|
1402
|
+
data: sorted.filter(({ session }) => !needsYou(session))
|
|
1403
|
+
}].filter((section) => section.data.length > 0);
|
|
1404
|
+
}
|
|
1405
|
+
//#endregion
|
|
1351
1406
|
//#region src/extensions/(frontend)/template/_components/DesktopMenu.tsx
|
|
1352
1407
|
/** The rail's status copy is the only running signal a template gets; the menu and the bar share this reading. */
|
|
1353
1408
|
function sessionRunning(session) {
|
|
1354
1409
|
return session.status.startsWith("running") || session.status.startsWith("workflow");
|
|
1355
1410
|
}
|
|
1356
1411
|
const MENU_DIALOG_KEY = "desktop/menu-dialog";
|
|
1357
|
-
|
|
1412
|
+
/** Opens the same rename dialog from a session's window title. */
|
|
1413
|
+
function openSessionRenameDialog(sessionId, name) {
|
|
1414
|
+
dashboardStateFor(MENU_DIALOG_KEY, null).setState(() => ({
|
|
1415
|
+
mode: "rename",
|
|
1416
|
+
sessionId,
|
|
1417
|
+
name
|
|
1418
|
+
}));
|
|
1419
|
+
}
|
|
1420
|
+
/** Advanced's key, so the person's view choice follows them between templates. */
|
|
1421
|
+
const VIEW_KEY = "po.session-view";
|
|
1422
|
+
const VIEWS = [{
|
|
1423
|
+
value: "workspaces",
|
|
1424
|
+
title: "Workspaces",
|
|
1425
|
+
description: "Sessions grouped by workspace",
|
|
1426
|
+
Icon: FolderIcon
|
|
1427
|
+
}, {
|
|
1428
|
+
value: "sessions",
|
|
1429
|
+
title: "Sessions",
|
|
1430
|
+
description: "Needs you first, then latest change",
|
|
1431
|
+
Icon: MessageIcon
|
|
1432
|
+
}];
|
|
1433
|
+
/** The browser keeps the view choice across launches; a blocked storage keeps it for this page. */
|
|
1434
|
+
function storedView() {
|
|
1435
|
+
try {
|
|
1436
|
+
return window.localStorage.getItem(VIEW_KEY) === "sessions" ? "sessions" : "workspaces";
|
|
1437
|
+
} catch {
|
|
1438
|
+
return "workspaces";
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
/** Whether the choice was saved; when storage is blocked, the in-memory choice still holds for this page. */
|
|
1442
|
+
function keepView(view) {
|
|
1443
|
+
try {
|
|
1444
|
+
window.localStorage.setItem(VIEW_KEY, view);
|
|
1445
|
+
return true;
|
|
1446
|
+
} catch {
|
|
1447
|
+
return false;
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
function SessionRow({ session, actions, coordinates, coordinator, workspaceName, onOpen, onDialog, onRole }) {
|
|
1358
1451
|
const failed = session.error !== void 0 || session.status.includes("failed");
|
|
1359
1452
|
const running = sessionRunning(session);
|
|
1360
1453
|
const name = session.name || "Untitled";
|
|
@@ -1401,12 +1494,12 @@ function SessionRow({ session, actions, coordinates, coordinator, onOpen, onDial
|
|
|
1401
1494
|
children: [/* @__PURE__ */ jsx("span", {
|
|
1402
1495
|
className: "truncate text-base font-medium text-po-hi",
|
|
1403
1496
|
children: session.name
|
|
1404
|
-
}), /* @__PURE__ */
|
|
1497
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
1405
1498
|
className: "truncate text-sm text-po-dim",
|
|
1406
|
-
children: session.clock ? /* @__PURE__ */ jsx(LiveDuration, {
|
|
1499
|
+
children: [session.clock ? /* @__PURE__ */ jsx(LiveDuration, {
|
|
1407
1500
|
label: session.clock.label,
|
|
1408
1501
|
since: session.clock.since
|
|
1409
|
-
}) : session.status
|
|
1502
|
+
}) : session.status, workspaceName ? ` · ${workspaceName}` : null]
|
|
1410
1503
|
})]
|
|
1411
1504
|
}),
|
|
1412
1505
|
session.awaitingInput || (session.waitingCount ?? 0) > 0 ? /* @__PURE__ */ jsxs("span", {
|
|
@@ -1767,12 +1860,23 @@ function DesktopMenu({ rail, onHome, onClose }) {
|
|
|
1767
1860
|
const needle = query.trim().toLowerCase();
|
|
1768
1861
|
const workspaces = rail.workspaces.map((workspace) => ({
|
|
1769
1862
|
...workspace,
|
|
1863
|
+
current: workspace.sessions.find((session) => session.coordinator),
|
|
1770
1864
|
sessions: needle === "" ? workspace.sessions : workspace.sessions.filter((session) => session.name.toLowerCase().includes(needle))
|
|
1771
1865
|
})).filter((workspace) => needle === "" || workspace.sessions.length > 0);
|
|
1772
1866
|
const empty = rail.workspaces.length === 0;
|
|
1773
1867
|
const coordinatorHosts = rail.coordinatorHosts ?? [];
|
|
1774
1868
|
const focused = rail.workspaces.flatMap((workspace) => workspace.sessions).find((session) => session.active);
|
|
1775
1869
|
const profile = focused?.profile;
|
|
1870
|
+
const [view, setView] = useDashboardState("rail/session-view", storedView);
|
|
1871
|
+
const currentView = VIEWS.find((entry) => entry.value === view) ?? VIEWS[0];
|
|
1872
|
+
const timeline = view === "sessions" ? sessionTimeline(workspaces.flatMap((workspace) => workspace.sessions.map((session) => ({
|
|
1873
|
+
session: {
|
|
1874
|
+
...session,
|
|
1875
|
+
nested: false
|
|
1876
|
+
},
|
|
1877
|
+
workspace,
|
|
1878
|
+
workspaceName: workspace.kind === "session" ? void 0 : workspace.name
|
|
1879
|
+
})))) : [];
|
|
1776
1880
|
const [, setDialog] = useDashboardState(MENU_DIALOG_KEY, null);
|
|
1777
1881
|
const act = (action) => {
|
|
1778
1882
|
action();
|
|
@@ -1787,6 +1891,16 @@ function DesktopMenu({ rail, onHome, onClose }) {
|
|
|
1787
1891
|
});
|
|
1788
1892
|
});
|
|
1789
1893
|
});
|
|
1894
|
+
const row = (session, workspace, workspaceName) => /* @__PURE__ */ jsx(SessionRow, {
|
|
1895
|
+
session,
|
|
1896
|
+
actions,
|
|
1897
|
+
coordinates: workspace.kind === "session" ? "Home" : workspace.name,
|
|
1898
|
+
coordinator: workspace.current === void 0 || workspace.current.id === session.id ? void 0 : workspace.current.name,
|
|
1899
|
+
workspaceName,
|
|
1900
|
+
onOpen: () => act(() => actions.openSession(session.id)),
|
|
1901
|
+
onDialog: (dialog) => act(() => setDialog(dialog)),
|
|
1902
|
+
onRole: (next) => report("Could not change the role", () => actions.setSessionRole?.(session.id, next))
|
|
1903
|
+
}, session.id);
|
|
1790
1904
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1791
1905
|
/* @__PURE__ */ jsxs("label", {
|
|
1792
1906
|
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 +1921,9 @@ function DesktopMenu({ rail, onHome, onClose }) {
|
|
|
1807
1921
|
"aria-label": "Sessions",
|
|
1808
1922
|
className: "flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto px-2 py-2",
|
|
1809
1923
|
children: [
|
|
1810
|
-
/* @__PURE__ */
|
|
1924
|
+
/* @__PURE__ */ jsx("div", {
|
|
1811
1925
|
className: "flex items-center gap-1 pr-3",
|
|
1812
|
-
children:
|
|
1926
|
+
children: /* @__PURE__ */ jsxs("button", {
|
|
1813
1927
|
type: "button",
|
|
1814
1928
|
"data-testid": "desktop-menu-home",
|
|
1815
1929
|
onClick: () => act(onHome),
|
|
@@ -1821,44 +1935,99 @@ function DesktopMenu({ rail, onHome, onClose }) {
|
|
|
1821
1935
|
className: "size-4"
|
|
1822
1936
|
})
|
|
1823
1937
|
}), "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
|
-
})] })]
|
|
1938
|
+
})
|
|
1856
1939
|
}),
|
|
1857
1940
|
/* @__PURE__ */ jsx("div", {
|
|
1858
1941
|
"data-rail": "desktop",
|
|
1859
1942
|
className: "group/rail -mt-2.5 flex flex-col gap-0.5 pr-3 empty:hidden",
|
|
1860
1943
|
children: pluginContent
|
|
1861
1944
|
}),
|
|
1945
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1946
|
+
className: "flex items-center gap-0.5 pt-1 pr-2 pl-3",
|
|
1947
|
+
children: [
|
|
1948
|
+
/* @__PURE__ */ jsx("h2", {
|
|
1949
|
+
className: "min-w-0 flex-1 truncate text-base font-semibold text-po-hi",
|
|
1950
|
+
children: "Sessions"
|
|
1951
|
+
}),
|
|
1952
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
1953
|
+
asChild: true,
|
|
1954
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
1955
|
+
variant: "ghost",
|
|
1956
|
+
size: "icon",
|
|
1957
|
+
"data-testid": "session-view-menu",
|
|
1958
|
+
title: `View: ${currentView.title}`,
|
|
1959
|
+
"aria-label": `View: ${currentView.title}`,
|
|
1960
|
+
className: "size-6 rounded-full text-po-dim",
|
|
1961
|
+
children: /* @__PURE__ */ jsx(SlidersIcon, { className: "size-3.5" })
|
|
1962
|
+
})
|
|
1963
|
+
}), /* @__PURE__ */ jsx(DropdownMenuContent, {
|
|
1964
|
+
align: "end",
|
|
1965
|
+
"aria-label": "View",
|
|
1966
|
+
children: VIEWS.map(({ value, title, description, Icon }) => /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
1967
|
+
"data-testid": `session-view-${value}`,
|
|
1968
|
+
"aria-checked": view === value,
|
|
1969
|
+
role: "menuitemradio",
|
|
1970
|
+
onSelect: () => {
|
|
1971
|
+
setView(value);
|
|
1972
|
+
keepView(value);
|
|
1973
|
+
},
|
|
1974
|
+
className: `items-start gap-2.5 ${view === value ? "bg-po-tint-green" : ""}`,
|
|
1975
|
+
children: [
|
|
1976
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
1977
|
+
"aria-hidden": true,
|
|
1978
|
+
className: `mt-0.5 size-4 shrink-0 ${view === value ? "text-po-green" : "text-po-dim"}`
|
|
1979
|
+
}),
|
|
1980
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1981
|
+
className: "flex min-w-0 flex-1 flex-col",
|
|
1982
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1983
|
+
className: "text-po-hi",
|
|
1984
|
+
children: title
|
|
1985
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1986
|
+
className: "text-sm text-po-dim",
|
|
1987
|
+
children: description
|
|
1988
|
+
})]
|
|
1989
|
+
}),
|
|
1990
|
+
view === value ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
1991
|
+
"aria-hidden": true,
|
|
1992
|
+
className: "mt-0.5 size-4 shrink-0 text-po-green"
|
|
1993
|
+
}) : null
|
|
1994
|
+
]
|
|
1995
|
+
}, value))
|
|
1996
|
+
})] }),
|
|
1997
|
+
/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
1998
|
+
asChild: true,
|
|
1999
|
+
children: /* @__PURE__ */ jsx(Button, {
|
|
2000
|
+
variant: "ghost",
|
|
2001
|
+
size: "icon",
|
|
2002
|
+
"aria-label": "Create workspace or session",
|
|
2003
|
+
title: "Create workspace or session",
|
|
2004
|
+
"data-testid": "session-create-menu",
|
|
2005
|
+
className: "size-6 rounded-full text-po-dim",
|
|
2006
|
+
children: /* @__PURE__ */ jsx(PlusIcon, { className: "size-3.5" })
|
|
2007
|
+
})
|
|
2008
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
2009
|
+
align: "end",
|
|
2010
|
+
className: "min-w-56",
|
|
2011
|
+
children: [
|
|
2012
|
+
/* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
2013
|
+
"data-testid": "add-workspace-open",
|
|
2014
|
+
onSelect: () => act(actions.openAddWorkspace),
|
|
2015
|
+
children: "Create workspace"
|
|
2016
|
+
}),
|
|
2017
|
+
actions.createGeneralSession ? /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
2018
|
+
"data-testid": "new-session-open",
|
|
2019
|
+
onSelect: () => act(actions.createGeneralSession),
|
|
2020
|
+
children: "Create session"
|
|
2021
|
+
}) : null,
|
|
2022
|
+
actions.addCoordinator ? coordinatorHosts.filter((host) => !host.coordinated).map((host) => /* @__PURE__ */ jsx(DropdownMenuItem, {
|
|
2023
|
+
"data-testid": host.hostId ? `coordinator-create-${host.hostId}` : "coordinator-create",
|
|
2024
|
+
onSelect: () => report("Could not add a coordinator", () => actions.addCoordinator?.(void 0, host.hostId)),
|
|
2025
|
+
children: coordinatorHosts.length > 1 ? `Create coordinator on ${host.label}` : "Create coordinator"
|
|
2026
|
+
}, host.hostId ?? "local")) : null
|
|
2027
|
+
]
|
|
2028
|
+
})] })
|
|
2029
|
+
]
|
|
2030
|
+
}),
|
|
1862
2031
|
empty ? /* @__PURE__ */ jsxs("div", {
|
|
1863
2032
|
className: "flex flex-col items-center gap-3 px-6 py-8 text-center",
|
|
1864
2033
|
children: [
|
|
@@ -1884,39 +2053,38 @@ function DesktopMenu({ rail, onHome, onClose }) {
|
|
|
1884
2053
|
children: "Start a session without a folder"
|
|
1885
2054
|
}) : null
|
|
1886
2055
|
]
|
|
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
|
-
}),
|
|
2056
|
+
}) : view === "sessions" ? timeline.map((section) => /* @__PURE__ */ jsxs("div", {
|
|
2057
|
+
"data-testid": `session-timeline-${section.key}`,
|
|
2058
|
+
className: "flex flex-col",
|
|
2059
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
2060
|
+
className: "pt-1 pr-2 pb-1 pl-3 text-sm font-semibold text-po-dim",
|
|
2061
|
+
children: section.title
|
|
2062
|
+
}), section.data.map(({ session, workspace, workspaceName }) => row(session, workspace, workspaceName))]
|
|
2063
|
+
}, section.key)) : workspaces.map((workspace) => /* @__PURE__ */ jsxs("div", {
|
|
2064
|
+
className: "flex flex-col",
|
|
2065
|
+
children: [
|
|
2066
|
+
workspace.kind === "session" ? null : /* @__PURE__ */ jsx(WorkspaceHeading, {
|
|
2067
|
+
workspace,
|
|
2068
|
+
actions,
|
|
2069
|
+
act,
|
|
2070
|
+
onDialog: (dialog) => act(() => setDialog(dialog)),
|
|
2071
|
+
onAddCoordinator: () => report("Could not add a coordinator", () => actions.addCoordinator?.(workspace.id))
|
|
2072
|
+
}),
|
|
2073
|
+
workspace.kind !== "session" && !workspace.available ? /* @__PURE__ */ jsx("p", {
|
|
2074
|
+
className: "px-3 pb-1 text-sm text-po-red",
|
|
2075
|
+
children: "Workspace unavailable"
|
|
2076
|
+
}) : null,
|
|
2077
|
+
workspace.sessions.map((session) => row(session, workspace)),
|
|
2078
|
+
workspace.sessions.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
2079
|
+
className: "px-3 py-1 text-sm text-po-dim",
|
|
2080
|
+
children: "No sessions yet."
|
|
2081
|
+
}) : null
|
|
2082
|
+
]
|
|
2083
|
+
}, workspace.id)),
|
|
2084
|
+
needle === "" && !empty && view === "sessions" && timeline.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
2085
|
+
className: "px-3 py-1 text-sm text-po-dim",
|
|
2086
|
+
children: "No sessions yet."
|
|
2087
|
+
}) : null,
|
|
1920
2088
|
needle !== "" && workspaces.length === 0 ? /* @__PURE__ */ jsxs("p", {
|
|
1921
2089
|
className: "px-3 py-2 text-sm text-po-dim",
|
|
1922
2090
|
children: [
|
|
@@ -2582,6 +2750,7 @@ const FocusedSession = memo(function FocusedSession({ sessionId, tabId, windowed
|
|
|
2582
2750
|
"..."
|
|
2583
2751
|
]
|
|
2584
2752
|
}),
|
|
2753
|
+
/* @__PURE__ */ jsx(ConversationStrip, { sessionId }),
|
|
2585
2754
|
/* @__PURE__ */ jsxs("div", {
|
|
2586
2755
|
className: "flex min-h-0 flex-1 overflow-hidden",
|
|
2587
2756
|
children: [
|
|
@@ -2615,19 +2784,33 @@ const FocusedSession = memo(function FocusedSession({ sessionId, tabId, windowed
|
|
|
2615
2784
|
});
|
|
2616
2785
|
/** Any other session: a live, read-only transcript. Clicking the window focuses the session. */
|
|
2617
2786
|
const WatchingSession = memo(function WatchingSession({ sessionId }) {
|
|
2618
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2787
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2788
|
+
/* @__PURE__ */ jsx(ConversationStrip, { sessionId }),
|
|
2789
|
+
/* @__PURE__ */ jsx("div", {
|
|
2790
|
+
className: "mx-auto flex min-h-0 w-full max-w-[960px] flex-1 flex-col overflow-hidden px-2 sm:px-4",
|
|
2791
|
+
children: /* @__PURE__ */ jsx(SessionTranscriptView, {
|
|
2792
|
+
sessionId,
|
|
2793
|
+
watch: watchDashboardTranscript,
|
|
2794
|
+
renderTurn: QuietTurn,
|
|
2795
|
+
showThinking: false
|
|
2796
|
+
})
|
|
2797
|
+
}),
|
|
2798
|
+
/* @__PURE__ */ jsx("p", {
|
|
2799
|
+
className: "shrink-0 px-6 pb-4 text-center text-sm text-po-dim",
|
|
2800
|
+
children: "Click to focus and reply"
|
|
2625
2801
|
})
|
|
2626
|
-
})
|
|
2627
|
-
className: "shrink-0 px-6 pb-4 text-center text-sm text-po-dim",
|
|
2628
|
-
children: "Click to focus and reply"
|
|
2629
|
-
})] });
|
|
2802
|
+
] });
|
|
2630
2803
|
});
|
|
2804
|
+
/** A plugin's line about the window's own session, such as the run a workflow step belongs to. */
|
|
2805
|
+
function ConversationStrip({ sessionId }) {
|
|
2806
|
+
return /* @__PURE__ */ jsx("div", {
|
|
2807
|
+
className: "mx-auto w-full max-w-[960px] shrink-0 px-2 pb-2 empty:hidden sm:px-6",
|
|
2808
|
+
children: /* @__PURE__ */ jsx(PluginSurface, {
|
|
2809
|
+
slot: HOST_SLOTS.conversationStrip,
|
|
2810
|
+
sessionId
|
|
2811
|
+
})
|
|
2812
|
+
});
|
|
2813
|
+
}
|
|
2631
2814
|
/** A temporary tab in its own window: the panel it was opened with, and the composer when it keeps one. */
|
|
2632
2815
|
const TabWindowBody = memo(function TabWindowBody({ sessionId, tabId, focused }) {
|
|
2633
2816
|
const slotProps = usePluginSlotProps(sessionId);
|
|
@@ -2799,7 +2982,8 @@ function sentenceCase$1(name) {
|
|
|
2799
2982
|
*/
|
|
2800
2983
|
function Widget({ group, slotProps, editing, expanded, onRemove, onToggle }) {
|
|
2801
2984
|
const detailed = slotFills(activityGroupSlot(group.name)).length > 0;
|
|
2802
|
-
const
|
|
2985
|
+
const collapsible = group.collapsible !== false;
|
|
2986
|
+
const open = detailed && (!collapsible || expanded);
|
|
2803
2987
|
const Glyph = group.icon ?? ActivityIcon;
|
|
2804
2988
|
const label = sentenceCase$1(group.name);
|
|
2805
2989
|
const folded = group.summary || (group.active ? "Working" : detailed ? null : "Idle");
|
|
@@ -2843,7 +3027,7 @@ function Widget({ group, slotProps, editing, expanded, onRemove, onToggle }) {
|
|
|
2843
3027
|
"aria-hidden": true,
|
|
2844
3028
|
className: "size-3.5 shrink-0 text-po-faint group-hover/heading:text-po-dim"
|
|
2845
3029
|
})]
|
|
2846
|
-
}), detailed ? /* @__PURE__ */ jsx("button", {
|
|
3030
|
+
}), detailed && collapsible ? /* @__PURE__ */ jsx("button", {
|
|
2847
3031
|
type: "button",
|
|
2848
3032
|
"aria-expanded": open,
|
|
2849
3033
|
"aria-label": open ? `Fold ${label}` : `Unfold ${label}`,
|
|
@@ -3042,10 +3226,10 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3042
3226
|
const narrow = rootSize.width > 0 && rootSize.width < NARROW;
|
|
3043
3227
|
const routeWindow = routeWindowFor(route.kind, route.sessionId, route.workspaceId);
|
|
3044
3228
|
const sessionIds = useMemo(() => new Set(sessionIdList.split("\n").filter(Boolean)), [sessionIdList]);
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3229
|
+
const layout = drawnLayout(stored, routeWindow, hydrated ? {
|
|
3230
|
+
sessionIds,
|
|
3231
|
+
tabOpen: (sessionId, tabId) => findTransientTab(transient, sessionId, tabId) !== void 0
|
|
3232
|
+
} : void 0);
|
|
3049
3233
|
useEffect(() => {
|
|
3050
3234
|
if (layout !== stored) setStored(layout);
|
|
3051
3235
|
}, [
|
|
@@ -3223,7 +3407,11 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3223
3407
|
if (next.sessionId !== void 0 && next.sessionId !== activeId) rail.actions.openSession(next.sessionId);
|
|
3224
3408
|
} else update((current) => minimizeWindow(current, root));
|
|
3225
3409
|
};
|
|
3226
|
-
const
|
|
3410
|
+
const sessions = rail.workspaces.flatMap((workspace) => workspace.sessions);
|
|
3411
|
+
const countWaiting = (list) => list.reduce((total, session) => total + (session.waitingCount ?? (session.awaitingInput ? 1 : 0)), 0);
|
|
3412
|
+
const waiting = countWaiting(sessions);
|
|
3413
|
+
const barSessionIds = new Set(stacks.map((stack) => stack.members[stack.members.length - 1]?.sessionId));
|
|
3414
|
+
const offBar = sessions.filter((session) => !barSessionIds.has(session.id));
|
|
3227
3415
|
const activityShown = narrow ? narrowActivity : !layout.activityHidden;
|
|
3228
3416
|
const slotProps = usePluginSlotProps(activeId);
|
|
3229
3417
|
const declaredFaces = useDockFaces(activeId).filter((entry) => entry.requiredMinorMode === void 0 || slotProps.activeMinorModes?.includes(entry.requiredMinorMode));
|
|
@@ -3307,6 +3495,7 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3307
3495
|
const isFront = front?.id === win.id;
|
|
3308
3496
|
const { title, subtitle } = titleOf(win);
|
|
3309
3497
|
const root = findWindow(layout, stackRoot(win)) ?? win;
|
|
3498
|
+
const renameId = win.kind === "session" ? win.sessionId : void 0;
|
|
3310
3499
|
return /* @__PURE__ */ jsx(DesktopWindow, {
|
|
3311
3500
|
testId: `desktop-window-${win.id}`,
|
|
3312
3501
|
title,
|
|
@@ -3322,6 +3511,7 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3322
3511
|
headerRegion: win.kind === "session" && win.sessionId === activeId ? "header" : void 0,
|
|
3323
3512
|
onFocus: () => focus(win),
|
|
3324
3513
|
onClose: () => close(win),
|
|
3514
|
+
onRename: renameId === void 0 ? void 0 : () => openSessionRenameDialog(renameId, title),
|
|
3325
3515
|
onMinimize: () => update((current) => minimizeWindow(current, win.id)),
|
|
3326
3516
|
onToggleMaximize: () => update((current) => toggleMaximize(current, win.id)),
|
|
3327
3517
|
onPlace: (rect) => update((current) => placeWindow(current, win.id, rect)),
|
|
@@ -3359,6 +3549,8 @@ function DesktopDashboard({ isSignedInWorkerOrigin = false, accountSettings, hom
|
|
|
3359
3549
|
}),
|
|
3360
3550
|
stacks: barStacks,
|
|
3361
3551
|
waiting,
|
|
3552
|
+
menuWaiting: menuOpen ? 0 : countWaiting(offBar),
|
|
3553
|
+
menuRunning: offBar.filter(sessionRunning).length,
|
|
3362
3554
|
remote: rail.remote.status,
|
|
3363
3555
|
faces: railFaces,
|
|
3364
3556
|
face,
|