zidane-ui 9.5.0 → 9.5.2

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.
Files changed (89) hide show
  1. package/dist/chat/SessionList.d.ts +1 -1
  2. package/dist/chat/SessionList.js +1 -1
  3. package/dist/chat/Transcript.js +6 -2
  4. package/dist/chat/composer/ComposerEditor.js +1 -1
  5. package/dist/chat/composer/DraftPickers.d.ts +8 -2
  6. package/dist/chat/composer/DraftPickers.js +5 -3
  7. package/dist/chat/composer/ScopeToggle.d.ts +5 -2
  8. package/dist/chat/composer/ScopeToggle.js +3 -2
  9. package/dist/chat/composer/ServerScopeToggle.d.ts +5 -2
  10. package/dist/chat/composer/ServerScopeToggle.js +2 -1
  11. package/dist/chat/composer/use-draft-target.d.ts +7 -1
  12. package/dist/chat/composer/use-draft-target.js +19 -10
  13. package/dist/chat/headless/fixtures/demo-transcript-all-kinds.d.ts +6 -0
  14. package/dist/chat/headless/fixtures/demo-transcript-all-kinds.js +90 -2
  15. package/dist/chat/headless/index.d.ts +6 -5
  16. package/dist/chat/headless/index.js +6 -5
  17. package/dist/chat/headless/labels.d.ts +9 -0
  18. package/dist/chat/headless/labels.js +12 -3
  19. package/dist/chat/headless/session-list.d.ts +8 -0
  20. package/dist/chat/headless/session-list.js +7 -0
  21. package/dist/chat/headless/sidebar/inbox.d.ts +21 -5
  22. package/dist/chat/headless/sidebar/inbox.js +30 -12
  23. package/dist/chat/headless/sidebar/index.d.ts +2 -2
  24. package/dist/chat/headless/sidebar/index.js +2 -2
  25. package/dist/chat/headless/sidebar/labels.d.ts +7 -1
  26. package/dist/chat/headless/sidebar/labels.js +1 -1
  27. package/dist/chat/headless/sidebar/rows.d.ts +62 -5
  28. package/dist/chat/headless/sidebar/rows.js +93 -17
  29. package/dist/chat/headless/transcript/derive.d.ts +1 -0
  30. package/dist/chat/headless/transcript/derive.js +3 -1
  31. package/dist/chat/headless/transcript/fold.js +1 -0
  32. package/dist/chat/headless/transcript/index.d.ts +3 -2
  33. package/dist/chat/headless/transcript/index.js +2 -1
  34. package/dist/chat/headless/transcript/rail.js +1 -0
  35. package/dist/chat/headless/transcript/rows.d.ts +26 -2
  36. package/dist/chat/headless/transcript/select-stops.js +1 -0
  37. package/dist/chat/headless/transcript/session-groups.d.ts +36 -0
  38. package/dist/chat/headless/transcript/session-groups.js +94 -0
  39. package/dist/chat/index.d.ts +4 -3
  40. package/dist/chat/index.js +7 -6
  41. package/dist/chat/sidebar/InboxList.d.ts +14 -1
  42. package/dist/chat/sidebar/InboxList.js +33 -13
  43. package/dist/chat/sidebar/SessionSidebar.d.ts +13 -5
  44. package/dist/chat/sidebar/SessionSidebar.js +54 -34
  45. package/dist/chat/sidebar/SidebarGroupHeader.d.ts +7 -2
  46. package/dist/chat/sidebar/SidebarGroupHeader.js +22 -6
  47. package/dist/chat/sidebar/useInboxRows.d.ts +4 -1
  48. package/dist/chat/sidebar/useInboxRows.js +6 -3
  49. package/dist/chat/sidebar/useInboxTriage.d.ts +3 -0
  50. package/dist/chat/sidebar/useInboxTriage.js +3 -2
  51. package/dist/chat/testing/index.d.ts +2 -2
  52. package/dist/chat/testing/index.js +2 -2
  53. package/dist/chat/transcript/BadgeMenu.d.ts +9 -2
  54. package/dist/chat/transcript/BadgeMenu.js +20 -2
  55. package/dist/chat/transcript/SubagentBlock.js +24 -7
  56. package/dist/chat/transcript/TranscriptRail.js +3 -3
  57. package/dist/chat/transcript/TranscriptRow.js +8 -0
  58. package/dist/chat/transcript/frame.d.ts +7 -0
  59. package/dist/chat/transcript/frame.js +51 -5
  60. package/dist/chat/transcript/index.d.ts +4 -3
  61. package/dist/chat/transcript/index.js +3 -2
  62. package/dist/chat/transcript/notices.d.ts +9 -9
  63. package/dist/chat/transcript/notices.js +78 -81
  64. package/dist/chat/transcript/receipt-parts.d.ts +29 -2
  65. package/dist/chat/transcript/receipt-parts.js +40 -7
  66. package/dist/chat/transcript/row-estimate.js +4 -1
  67. package/dist/chat/transcript/run-rows.js +2 -5
  68. package/dist/chat/transcript/script-input.d.ts +1 -1
  69. package/dist/chat/transcript/session-groups.d.ts +21 -0
  70. package/dist/chat/transcript/session-groups.js +154 -0
  71. package/dist/chat/transcript/session-line.d.ts +63 -0
  72. package/dist/chat/transcript/session-line.js +114 -0
  73. package/dist/dist/{index-Bsp5Ku7r.d.ts → index-DPbpsCtl.d.ts} +17 -17
  74. package/dist/dist/index.d.ts +1 -1
  75. package/dist/session/ProjectName.js +1 -1
  76. package/dist/session/SessionHeader.js +1 -1
  77. package/dist/session/headless/labels.d.ts +1 -1
  78. package/dist/session/use-home-projects.d.ts +10 -3
  79. package/dist/session/use-home-projects.js +40 -4
  80. package/dist/settings/headless/mcp-requirement.js +4 -3
  81. package/dist/settings/headless/mcp.d.ts +2 -0
  82. package/dist/settings/headless/mcp.js +3 -2
  83. package/dist/settings/headless/search.d.ts +1 -1
  84. package/dist/settings/index.js +9 -9
  85. package/dist/settings/sections/index.js +1 -1
  86. package/dist/settings/sections/mcp/McpSection.js +3 -5
  87. package/dist/styles.css +43 -0
  88. package/package.json +2 -2
  89. package/src/styles/transcript.css +39 -0
@@ -15,12 +15,12 @@ import { INBOX_EARLIER_AFTER_MS } from "../headless/sidebar/inbox.js";
15
15
  import "../headless/sidebar/project-icons.js";
16
16
  import { isPinnedProjectMain, isUnlistedProjectMain } from "../headless/sidebar/project-main.js";
17
17
  import { AGENT_GROUPING, claimChildSessions, clearedViewFilters, createDecorator, viewFiltersOn } from "../headless/sidebar/query.js";
18
- import { buildHostSidebarRows, buildQuerySidebarRows, groupsByFolder, itemRows, nestSidebarRows, partitionMainSession } from "../headless/sidebar/rows.js";
19
- import { SessionGroupHeader, ShowMoreRow } from "../SessionGroupHeader.js";
18
+ import { buildHostSidebarRows, buildQuerySidebarRows, groupsByFolder, itemRows, nestSidebarRows, partitionMainSession, projectIdOfGroup, sidebarProjectIndex } from "../headless/sidebar/rows.js";
19
+ import { ShowMoreRow } from "../SessionGroupHeader.js";
20
20
  import { SessionHostHeader } from "../SessionHostHeader.js";
21
21
  import { InboxList } from "./InboxList.js";
22
22
  import { MainSessionRow } from "./MainSessionRow.js";
23
- import { ProjectIconButton, ProjectIconGlyph, useProjectIcons } from "./ProjectIcon.js";
23
+ import { useProjectIcons } from "./ProjectIcon.js";
24
24
  import { useEnvironmentCommands } from "./session-menu.js";
25
25
  import { holdFocusIn } from "./sidebar-focus-hold.js";
26
26
  import { SidebarEmpty } from "./SidebarEmpty.js";
@@ -44,7 +44,6 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
44
44
  import { AnimatePresence, LazyMotion, domAnimation, m, useIsPresent } from "motion/react";
45
45
  import { sortRows } from "zidane/chat/pure";
46
46
  // src/chat/sidebar/SessionSidebar.tsx
47
- const noop = () => void 0;
48
47
  /** Whether a home project's name is not its folder's: only then does it replace the folder's name. */
49
48
  const renamedHome = (project) => project !== void 0 && project.name !== basename(project.home);
50
49
  /** The list's top and bottom fades (rows dissolve into the search row and the footer, never cut). */
@@ -111,8 +110,9 @@ const SpaceList = forwardRef((props, ref) => {
111
110
  });
112
111
  SpaceList.displayName = "SpaceList";
113
112
  /**
114
- * The New session row: the same grid as a session row (an 18px glyph column, `text-sm`), raised while no
115
- * session is open, its ⌘N hint fading in on hover or focus.
113
+ * The New row (a new chat with no project, `labels.newSession`; its tooltip says New session and the keys): the same
114
+ * grid as a session row (an 18px glyph column, `text-sm`), raised while no session is open, its ⌘N hint fading in on
115
+ * hover or focus.
116
116
  *
117
117
  * @param props - What it starts, whether it is the current selection, `className` and `style`.
118
118
  */
@@ -210,7 +210,26 @@ function SessionSidebar(props) {
210
210
  }, []);
211
211
  const { icons: projectIcons, setIcon: setWindowIcon } = useProjectIcons();
212
212
  const homeByPath = useMemo(() => new Map((homeProjects ?? []).flatMap((project) => (project.folders ?? [project.home]).map((folder) => [folder, project]))), [homeProjects]);
213
+ /** The projects with no folder the list shows (only with their home to open), by id. */
214
+ const shownRecords = useMemo(() => onOpenProjectRecord ? folderlessProjects ?? [] : [], [onOpenProjectRecord, folderlessProjects]);
215
+ const recordById = useMemo(() => new Map(shownRecords.map((project) => [project.id, project])), [shownRecords]);
216
+ /** This host's projects, as a view grouped by folder groups its sessions: by the project each is filed in first. */
217
+ const projectIndex = useMemo(() => {
218
+ const groups = [...(homeProjects ?? []).map((p) => ({
219
+ id: p.id,
220
+ name: p.name,
221
+ home: p.home,
222
+ ...p.sessions ? { sessions: p.sessions } : {}
223
+ })), ...shownRecords.map((p) => ({
224
+ id: p.id,
225
+ name: p.name,
226
+ ...p.sessions ? { sessions: p.sessions } : {}
227
+ }))];
228
+ return groups.length > 0 ? sidebarProjectIndex(groups) : void 0;
229
+ }, [homeProjects, shownRecords]);
213
230
  const setProjectIcon = useCallback((fullPath, icon) => {
231
+ const recordId = projectIdOfGroup(fullPath);
232
+ if (recordId !== null) return onSetProjectIcon?.(recordId, icon);
214
233
  setWindowIcon(fullPath, icon);
215
234
  const project = homeByPath.get(fullPath);
216
235
  if (project) onSetProjectIcon?.(project.id, icon);
@@ -267,6 +286,7 @@ function SessionSidebar(props) {
267
286
  keepId: activeSessionId,
268
287
  showMoreExpanded,
269
288
  pinnedProjects,
289
+ ...projectIndex ? { projects: projectIndex } : {},
270
290
  ...order ? { compare: (a, b) => (order.get(a.id) ?? 0) - (order.get(b.id) ?? 0) } : {}
271
291
  })];
272
292
  }, [
@@ -278,6 +298,7 @@ function SessionSidebar(props) {
278
298
  collapsedGroups,
279
299
  showMoreExpanded,
280
300
  pinnedProjects,
301
+ projectIndex,
281
302
  agentNames,
282
303
  labels,
283
304
  activeSessionId
@@ -312,7 +333,8 @@ function SessionSidebar(props) {
312
333
  activeId: activeSessionId,
313
334
  rowLimit,
314
335
  projectIcons,
315
- onToggle: noteToggle
336
+ onToggle: noteToggle,
337
+ ...projectIndex ? { projectGroups: projectIndex } : {}
316
338
  });
317
339
  const hostById = useMemo(() => new Map(hosts.map((h) => [h.id, h])), [hosts]);
318
340
  /** This machine's project folders with a listed conversation not archived yet. */
@@ -612,6 +634,7 @@ function SessionSidebar(props) {
612
634
  enabled: inbox,
613
635
  rows: inboxRows,
614
636
  groupBy: inboxGroupBy,
637
+ ...projectIndex ? { projects: projectIndex } : {},
615
638
  listRef,
616
639
  flip: flip.controller,
617
640
  ...onSetInboxState ? { onSetInboxState } : {},
@@ -631,7 +654,11 @@ function SessionSidebar(props) {
631
654
  setMenuForId(null);
632
655
  }, [activeSessionId]);
633
656
  if (collapsed && renamingId !== null) setRenamingId(null);
634
- const onNewSessionIn = useCallback((fullPath) => newSessionIn(fullPath), [newSessionIn]);
657
+ const onNewSessionIn = useCallback((fullPath) => {
658
+ const recordId = projectIdOfGroup(fullPath);
659
+ if (recordId === null) newSessionIn(fullPath);
660
+ else onOpenProjectRecord?.(recordId);
661
+ }, [newSessionIn, onOpenProjectRecord]);
635
662
  const handleNewSession = useCallback(() => {
636
663
  commitImmediate(null);
637
664
  onNewSession();
@@ -660,9 +687,13 @@ function SessionSidebar(props) {
660
687
  }) : /* @__PURE__ */ jsx(SidebarGroupHeader, {
661
688
  row: header,
662
689
  groupBy: listGroupBy,
663
- icon: header.fullPath ? homeOf(header)?.icon ?? projectIcons[header.fullPath] : void 0,
690
+ icon: header.projectId !== void 0 ? recordById.get(header.projectId)?.icon : header.fullPath ? homeOf(header)?.icon ?? projectIcons[header.fullPath] : void 0,
664
691
  ...renamedHome(homeOf(header)) ? { projectName: homeOf(header).name } : {},
665
- ...homeOf(header)?.iconLocked ? {} : { onAssignIcon: setProjectIcon },
692
+ ...header.projectId !== void 0 ? onSetProjectIcon && !recordById.get(header.projectId)?.iconLocked ? { onAssignIcon: setProjectIcon } : {} : homeOf(header)?.iconLocked ? {} : { onAssignIcon: setProjectIcon },
693
+ ...header.projectId !== void 0 && onOpenProjectRecord ? {
694
+ onOpenProjectRecord,
695
+ open: activeSessionId == null && openProjectId === header.projectId
696
+ } : {},
666
697
  onToggle: toggleGroup,
667
698
  onNewSessionIn,
668
699
  spaces: onMoveProjectToSpace ? rowDetails.spaces : null,
@@ -674,7 +705,7 @@ function SessionSidebar(props) {
674
705
  onArchiveProject,
675
706
  onDeleteProject,
676
707
  ...header.hostId && hostById.get(header.hostId) ? { server: hostById.get(header.hostId) } : {},
677
- ...onOpenProject ? {
708
+ ...onOpenProject && header.projectId === void 0 ? {
678
709
  onOpenProject,
679
710
  open: activeSessionId == null && openProject != null && openProject.path === header.fullPath && openProject.hostId === header.hostId
680
711
  } : {},
@@ -896,7 +927,17 @@ function SessionSidebar(props) {
896
927
  ...onOpenProject ? {
897
928
  onOpenProject,
898
929
  openProject: openProject ?? null
899
- } : {}
930
+ } : {},
931
+ ...onOpenChats ? {
932
+ onOpenChats,
933
+ chatsOpen: activeSessionId == null && chatsOpen
934
+ } : {},
935
+ projectRecords: recordById,
936
+ ...onOpenProjectRecord ? {
937
+ onOpenProjectRecord,
938
+ openProjectId: activeSessionId == null ? openProjectId : null
939
+ } : {},
940
+ ...onSetProjectIcon ? { onSetProjectIcon } : {}
900
941
  }), emptyBlock]
901
942
  })
902
943
  }), inboxDock.length > 0 && /* @__PURE__ */ jsx("li", {
@@ -914,28 +955,7 @@ function SessionSidebar(props) {
914
955
  onShowMore: showMoreShelf
915
956
  })
916
957
  })
917
- })] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [sections.map((node) => renderNode(node)), onOpenProjectRecord && grouping.kind === "builtin" && groupsByFolder(listGroupBy) && folderlessProjects?.map((project) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx("ul", {
918
- className: "list-none m-0 p-0",
919
- children: /* @__PURE__ */ jsx(SessionGroupHeader, {
920
- id: `p-${project.id}`,
921
- label: project.name,
922
- collapsed: false,
923
- collapsible: false,
924
- icon: onSetProjectIcon && !project.iconLocked ? /* @__PURE__ */ jsx(ProjectIconButton, {
925
- fullPath: project.id,
926
- label: project.name,
927
- ...project.icon ? { icon: project.icon } : {},
928
- isGitRepo: false,
929
- onAssign: onSetProjectIcon
930
- }) : /* @__PURE__ */ jsx(ProjectIconGlyph, {
931
- ...project.icon ? { icon: project.icon } : {},
932
- isGitRepo: false
933
- }),
934
- onToggle: noop,
935
- onOpen: () => onOpenProjectRecord(project.id),
936
- active: activeSessionId == null && openProjectId === project.id
937
- })
938
- }) }, `p-${project.id}`))] }), !inbox && emptyBlock]
958
+ })] }) : /* @__PURE__ */ jsx(Fragment$1, { children: sections.map((node) => renderNode(node)) }), !inbox && emptyBlock]
939
959
  })
940
960
  }, listKey)
941
961
  })
@@ -13,7 +13,10 @@
13
13
  * header of the home on show is `open`. With `onOpenChats`, the Chats name
14
14
  * starts a new chat with no folder the same way, and is `open` while it shows.
15
15
  * With `projectName` (a renamed project's home folder), the header shows the
16
- * project's name, with the folder as its hover hint.
16
+ * project's name, with the folder as its hover hint. A project with no folder
17
+ * (`row.projectId`) has its "+", its pin and a menu of both; its name opens
18
+ * its home (`onOpenProjectRecord`), and with nothing filed in it there is
19
+ * nothing to fold.
17
20
  */
18
21
  import { HostView } from "../headless/hosts.js";
19
22
  import { ProjectIcon } from "../headless/sidebar/project-icons.js";
@@ -71,6 +74,8 @@ export interface SidebarGroupHeaderProps {
71
74
  onOpenProject?: (project: SidebarProjectRef) => void;
72
75
  /** Starts a new chat with no folder from the Chats name. Absent: the name toggles collapse. */
73
76
  onOpenChats?: () => void;
77
+ /** Opens the home of a project with no folder (`row.projectId`) from its name. Absent: the name toggles collapse. */
78
+ onOpenProjectRecord?: (projectId: string) => void;
74
79
  /** This project's home, or for Chats a new chat with no folder, is the one shown. */
75
80
  open?: boolean;
76
81
  /** Extra classes on the header. */
@@ -83,4 +88,4 @@ export interface SidebarGroupHeaderProps {
83
88
  *
84
89
  * @param props - The header row, the view, its icon and the project actions.
85
90
  */
86
- export declare function SidebarGroupHeader({ row, groupBy, icon, projectName, onAssignIcon, onToggle, onNewSessionIn, spaces, spaceId, onMoveProject, pinned, onSetPinned, canArchive, onArchiveProject, onDeleteProject, server, onOpenProject, onOpenChats, open, className, style }: SidebarGroupHeaderProps): import("react").JSX.Element;
91
+ export declare function SidebarGroupHeader({ row, groupBy, icon, projectName, onAssignIcon, onToggle, onNewSessionIn, spaces, spaceId, onMoveProject, pinned, onSetPinned, canArchive, onArchiveProject, onDeleteProject, server, onOpenProject, onOpenChats, onOpenProjectRecord, open, className, style }: SidebarGroupHeaderProps): import("react").JSX.Element;
@@ -16,13 +16,16 @@ import { resolveSessionSpace } from "zidane/chat/pure";
16
16
  *
17
17
  * @param props - The header row, the view, its icon and the project actions.
18
18
  */
19
- function SidebarGroupHeader({ row, groupBy, icon, projectName, onAssignIcon, onToggle, onNewSessionIn, spaces, spaceId, onMoveProject, pinned, onSetPinned, canArchive, onArchiveProject, onDeleteProject, server, onOpenProject, onOpenChats, open = false, className = "", style }) {
19
+ function SidebarGroupHeader({ row, groupBy, icon, projectName, onAssignIcon, onToggle, onNewSessionIn, spaces, spaceId, onMoveProject, pinned, onSetPinned, canArchive, onArchiveProject, onDeleteProject, server, onOpenProject, onOpenChats, onOpenProjectRecord, open = false, className = "", style }) {
20
20
  const labels = useSidebarLabels();
21
21
  const { revealPath, openHostSettings } = useSidebarHost();
22
22
  const label = projectName ?? row.label;
23
23
  const byFolder = groupsByFolder(groupBy);
24
24
  const isProjectFolder = byFolder && !row.chats && !row.favorites;
25
- const path = isProjectFolder ? row.fullPath : void 0;
25
+ /** A project with no folder: its `fullPath` is its group's key, not a folder. */
26
+ const recordId = isProjectFolder ? row.projectId : void 0;
27
+ const path = isProjectFolder && recordId === void 0 ? row.fullPath : void 0;
28
+ const recordKey = recordId !== void 0 ? row.fullPath : void 0;
26
29
  const repo = row.repoKey ? { repoKey: row.repoKey } : {};
27
30
  /** Where the right-click opened the project's menu; `null` while it is closed. */
28
31
  const [menuAt, setMenuAt] = useState(null);
@@ -80,11 +83,20 @@ function SidebarGroupHeader({ row, groupBy, icon, projectName, onAssignIcon, onT
80
83
  ...repo
81
84
  }, label)
82
85
  }
83
- ] : [];
86
+ ] : recordKey ? [{
87
+ id: "new-session",
88
+ label: labels.newSessionIn(label),
89
+ onSelect: () => onNewSessionIn(recordKey)
90
+ }, {
91
+ id: "pin",
92
+ label: pinned ? labels.unpinProject : labels.pinProject,
93
+ onSelect: () => onSetPinned(recordKey, !pinned)
94
+ }] : [];
95
+ const hasMenu = menuItems.length > 0;
84
96
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SessionGroupHeader, {
85
97
  className: `zg-sticky-head${className ? ` ${className}` : ""}`,
86
98
  ...style ? { style } : {},
87
- onContextMenu: path ? (event) => {
99
+ onContextMenu: hasMenu ? (event) => {
88
100
  event.preventDefault();
89
101
  setMenuAt({
90
102
  x: event.clientX,
@@ -95,8 +107,12 @@ function SidebarGroupHeader({ row, groupBy, icon, projectName, onAssignIcon, onT
95
107
  label,
96
108
  ...projectName && row.fullPath ? { hint: row.fullPath } : {},
97
109
  collapsed: row.collapsed,
110
+ ...row.empty ? { collapsible: false } : {},
98
111
  onToggle,
99
- ...onOpenProject && isProjectFolder && row.fullPath ? {
112
+ ...recordId !== void 0 ? onOpenProjectRecord ? {
113
+ onOpen: () => onOpenProjectRecord(recordId),
114
+ active: open
115
+ } : {} : onOpenProject && isProjectFolder && row.fullPath ? {
100
116
  onOpen: () => onOpenProject({
101
117
  path: row.fullPath,
102
118
  ...row.hostId ? { hostId: row.hostId } : {}
@@ -141,7 +157,7 @@ function SidebarGroupHeader({ row, groupBy, icon, projectName, onAssignIcon, onT
141
157
  onSetPinned(row.fullPath, !pinned);
142
158
  }
143
159
  })] }) : void 0
144
- }), path && /* @__PURE__ */ jsx(RowActionsMenu, {
160
+ }), hasMenu && /* @__PURE__ */ jsx(RowActionsMenu, {
145
161
  open: menuAt !== null,
146
162
  position: menuAt,
147
163
  onClose: () => setMenuAt(null),
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import { InboxRow, InboxShelfId } from "../headless/sidebar/inbox.js";
9
9
  import { ProjectIcon } from "../headless/sidebar/project-icons.js";
10
+ import { SidebarProjectIndex } from "../headless/sidebar/rows.js";
10
11
  import { SidebarInboxGroupBy, SidebarListSession } from "../headless/sidebar/types.js";
11
12
  import { RowProject } from "./RowChips.js";
12
13
  /** Options of {@link useInboxRows}. */
@@ -29,13 +30,15 @@ export interface InboxRowsInput<S extends SidebarListSession> {
29
30
  projectIcons: Readonly<Record<string, ProjectIcon>>;
30
31
  /** A shelf or folder was folded or unfolded, by its id (the list's FLIP reads it). */
31
32
  onToggle?: (id: string) => void;
33
+ /** This computer's projects (`sidebarProjectIndex`): grouped by project, a filed session sits in its project's folder. */
34
+ projectGroups?: SidebarProjectIndex;
32
35
  }
33
36
  /**
34
37
  * The inbox's rows and their state. See the module docs.
35
38
  *
36
39
  * @param input - {@link InboxRowsInput}.
37
40
  */
38
- export declare function useInboxRows<S extends SidebarListSession>({ on, sessions, groupBy, earlierAfterMs, needsYou, activeId, rowLimit, projectIcons, onToggle }: InboxRowsInput<S>): {
41
+ export declare function useInboxRows<S extends SidebarListSession>({ on, sessions, groupBy, earlierAfterMs, needsYou, activeId, rowLimit, projectIcons, onToggle, projectGroups }: InboxRowsInput<S>): {
39
42
  collapsedShelves: ReadonlySet<InboxShelfId>;
40
43
  collapsedFolders: ReadonlySet<string>;
41
44
  toggleShelf: (shelf: InboxShelfId) => void;
@@ -54,7 +54,7 @@ function toggled(set, item) {
54
54
  *
55
55
  * @param input - {@link InboxRowsInput}.
56
56
  */
57
- function useInboxRows({ on, sessions, groupBy, earlierAfterMs, needsYou, activeId, rowLimit, projectIcons, onToggle }) {
57
+ function useInboxRows({ on, sessions, groupBy, earlierAfterMs, needsYou, activeId, rowLimit, projectIcons, onToggle, projectGroups }) {
58
58
  const [collapsedShelves, setCollapsedShelves] = usePersistedState(INBOX_SHELVES_KEY, DEFAULT_FOLDED, (raw) => new Set(JSON.parse(raw).filter((s) => INBOX_SHELVES.includes(s))), (value) => JSON.stringify([...value]));
59
59
  const [collapsedFolders, setCollapsedFolders] = useState(NO_FOLDERS);
60
60
  const [shelfShown, setShelfShown] = useState({});
@@ -95,7 +95,8 @@ function useInboxRows({ on, sessions, groupBy, earlierAfterMs, needsYou, activeI
95
95
  activeId,
96
96
  earlierAfterMs,
97
97
  holdRunning,
98
- ...needsYou ? { needsYou } : {}
98
+ ...needsYou ? { needsYou } : {},
99
+ ...projectGroups ? { projects: projectGroups } : {}
99
100
  }) : [], [
100
101
  on,
101
102
  sessions,
@@ -107,7 +108,8 @@ function useInboxRows({ on, sessions, groupBy, earlierAfterMs, needsYou, activeI
107
108
  now,
108
109
  earlierAfterMs,
109
110
  needsYou,
110
- holdRunning
111
+ holdRunning,
112
+ projectGroups
111
113
  ]);
112
114
  const dockStart = inboxDockStart(rows);
113
115
  return {
@@ -129,6 +131,7 @@ function useInboxRows({ on, sessions, groupBy, earlierAfterMs, needsYou, activeI
129
131
  for (const row of rows) {
130
132
  if (row.kind !== "session" || row.folder !== void 0) continue;
131
133
  const path = inboxFolderOf(row.session);
134
+ if (!path) continue;
132
135
  out.set(row.session.id, {
133
136
  label: basename(path) || path,
134
137
  path,
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { FlipList } from "../../motion/flip-list.js";
17
17
  import { InboxRow } from "../headless/sidebar/inbox.js";
18
+ import { SidebarProjectIndex } from "../headless/sidebar/rows.js";
18
19
  import { SidebarInboxGroupBy, SidebarListSession } from "../headless/sidebar/types.js";
19
20
  import { SidebarInboxHandlers } from "./InboxRowActions.js";
20
21
  import { RefObject } from "react";
@@ -27,6 +28,8 @@ export interface UseInboxTriageOptions<S extends SidebarListSession> {
27
28
  rows: readonly InboxRow<S>[];
28
29
  /** How the rows group (`buildInboxRows`): per project, a row pins into its own project's folder. Default flat. */
29
30
  groupBy?: SidebarInboxGroupBy;
31
+ /** This computer's projects (`sidebarProjectIndex`): a filed session's folder is its project's. */
32
+ projects?: SidebarProjectIndex;
30
33
  /** The list element. */
31
34
  listRef: RefObject<HTMLElement | null>;
32
35
  /** The list's FLIP controller: held during a drag, released on drop. */
@@ -25,7 +25,7 @@ const orderKey = (i) => String((i + 1) * ORDER_STEP).padStart(12, "0");
25
25
  * @param options - See {@link UseInboxTriageOptions}.
26
26
  */
27
27
  function useInboxTriage(options) {
28
- const { enabled, rows, groupBy = "none", listRef, flip, onSetInboxState, onSetFavorite, onSetArchived, needsYou = EMPTY } = options;
28
+ const { enabled, rows, groupBy = "none", projects, listRef, flip, onSetInboxState, onSetFavorite, onSetArchived, needsYou = EMPTY } = options;
29
29
  const labels = useSidebarLabels();
30
30
  const notify = useSidebarNotice();
31
31
  const [selected, setSelected] = useState(EMPTY);
@@ -39,6 +39,7 @@ function useInboxTriage(options) {
39
39
  const live = useLatest({
40
40
  rows,
41
41
  groupBy,
42
+ projects,
42
43
  selected,
43
44
  onSetInboxState,
44
45
  onSetFavorite,
@@ -359,7 +360,7 @@ function useInboxTriage(options) {
359
360
  const pointerId = event.pointerId;
360
361
  let dragging = false;
361
362
  let state = null;
362
- const home = live().groupBy === "project" ? inboxFolderIdOf(sessionRow(id).session) : void 0;
363
+ const home = live().groupBy === "project" ? inboxFolderIdOf(sessionRow(id).session, live().projects) : void 0;
363
364
  let scrollFrame = 0;
364
365
  let lastY = startY;
365
366
  /**
@@ -6,9 +6,9 @@
6
6
  import { ChatFixture, FixtureHostOptions, FixtureInteractionStep, FixtureStep, createFixtureHost } from "../headless/fixture-host.js";
7
7
  import { ChatTranscriptFixture } from "../headless/fixture-transcript.js";
8
8
  import { DEMO_TRANSCRIPT } from "../headless/fixtures/demo-transcript.js";
9
- import { DEMO_TRANSCRIPT_ALL_KINDS } from "../headless/fixtures/demo-transcript-all-kinds.js";
9
+ import { DEMO_SESSION_UPDATES, DEMO_TRANSCRIPT_ALL_KINDS } from "../headless/fixtures/demo-transcript-all-kinds.js";
10
10
  import { DEMO_AGENT_PROFILES, DEMO_COMPOSER_MODELS, FixtureComposerChrome, FixtureComposerChromeOptions, FixtureComposerSession, createFixtureComposerChrome } from "./fixture-composer-chrome.js";
11
11
  import { DEMO_COMPOSER_COMMANDS, DEMO_COMPOSER_FILES, FixtureComposerHost, FixtureComposerHostOptions, createFixtureComposerHost } from "./fixture-composer-host.js";
12
12
  import { FixtureSidebarCalls, FixtureSidebarEnvironment, FixtureSidebarHost, FixtureSidebarHostOptions, createFixtureSidebarHost } from "./fixture-sidebar-host.js";
13
13
  import { WORST_CASE_SIDEBAR, WorstCaseSidebar, WorstCaseSidebarSession } from "./worst-case-sidebar.js";
14
- export { ChatFixture, type ChatTranscriptFixture, DEMO_AGENT_PROFILES, DEMO_COMPOSER_COMMANDS, DEMO_COMPOSER_FILES, DEMO_COMPOSER_MODELS, DEMO_TRANSCRIPT, DEMO_TRANSCRIPT_ALL_KINDS, FixtureComposerChrome, FixtureComposerChromeOptions, FixtureComposerHost, FixtureComposerHostOptions, FixtureComposerSession, FixtureHostOptions, FixtureInteractionStep, FixtureSidebarCalls, FixtureSidebarEnvironment, FixtureSidebarHost, FixtureSidebarHostOptions, FixtureStep, WORST_CASE_SIDEBAR, WorstCaseSidebar, WorstCaseSidebarSession, createFixtureComposerChrome, createFixtureComposerHost, createFixtureHost, createFixtureSidebarHost };
14
+ export { ChatFixture, type ChatTranscriptFixture, DEMO_AGENT_PROFILES, DEMO_COMPOSER_COMMANDS, DEMO_COMPOSER_FILES, DEMO_COMPOSER_MODELS, DEMO_SESSION_UPDATES, DEMO_TRANSCRIPT, DEMO_TRANSCRIPT_ALL_KINDS, FixtureComposerChrome, FixtureComposerChromeOptions, FixtureComposerHost, FixtureComposerHostOptions, FixtureComposerSession, FixtureHostOptions, FixtureInteractionStep, FixtureSidebarCalls, FixtureSidebarEnvironment, FixtureSidebarHost, FixtureSidebarHostOptions, FixtureStep, WORST_CASE_SIDEBAR, WorstCaseSidebar, WorstCaseSidebarSession, createFixtureComposerChrome, createFixtureComposerHost, createFixtureHost, createFixtureSidebarHost };
@@ -1,8 +1,8 @@
1
1
  import { createFixtureHost } from "../headless/fixture-host.js";
2
2
  import { DEMO_TRANSCRIPT } from "../headless/fixtures/demo-transcript.js";
3
- import { DEMO_TRANSCRIPT_ALL_KINDS } from "../headless/fixtures/demo-transcript-all-kinds.js";
3
+ import { DEMO_SESSION_UPDATES, DEMO_TRANSCRIPT_ALL_KINDS } from "../headless/fixtures/demo-transcript-all-kinds.js";
4
4
  import { DEMO_AGENT_PROFILES, DEMO_COMPOSER_MODELS, createFixtureComposerChrome } from "./fixture-composer-chrome.js";
5
5
  import { DEMO_COMPOSER_COMMANDS, DEMO_COMPOSER_FILES, createFixtureComposerHost } from "./fixture-composer-host.js";
6
6
  import { createFixtureSidebarHost } from "./fixture-sidebar-host.js";
7
7
  import { WORST_CASE_SIDEBAR } from "./worst-case-sidebar.js";
8
- export { DEMO_AGENT_PROFILES, DEMO_COMPOSER_COMMANDS, DEMO_COMPOSER_FILES, DEMO_COMPOSER_MODELS, DEMO_TRANSCRIPT, DEMO_TRANSCRIPT_ALL_KINDS, WORST_CASE_SIDEBAR, createFixtureComposerChrome, createFixtureComposerHost, createFixtureHost, createFixtureSidebarHost };
8
+ export { DEMO_AGENT_PROFILES, DEMO_COMPOSER_COMMANDS, DEMO_COMPOSER_FILES, DEMO_COMPOSER_MODELS, DEMO_SESSION_UPDATES, DEMO_TRANSCRIPT, DEMO_TRANSCRIPT_ALL_KINDS, WORST_CASE_SIDEBAR, createFixtureComposerChrome, createFixtureComposerHost, createFixtureHost, createFixtureSidebarHost };
@@ -14,8 +14,15 @@
14
14
  import { ChatLabels } from "../headless/labels.js";
15
15
  import { ReactNode } from "react";
16
16
  import { BadgeTarget } from "zidane/chat/pure";
17
- /** Opens the badge menu for a badge at the event's point. */
18
- export type OpenBadgeMenu = (event: React.MouseEvent, target: BadgeTarget, cwd?: string | null) => void;
17
+ /** A row the caller adds to the menu's open group: how it opens what the badge names (a chat, by the transcript's own opener). */
18
+ export interface BadgeMenuOpenAction {
19
+ /** The row's text. */
20
+ label: string;
21
+ /** Opens it. */
22
+ onSelect: () => void;
23
+ }
24
+ /** Opens the badge menu for a badge at the event's point; `open` adds the caller's own open row. */
25
+ export type OpenBadgeMenu = (event: React.MouseEvent, target: BadgeTarget, cwd?: string | null, open?: BadgeMenuOpenAction) => void;
19
26
  /** Where "Add to prompt" and an action's `insert` go: the focused composer. */
20
27
  export interface BadgeMenuComposer {
21
28
  /** A composer has focus now (re-render the provider when it changes). */
@@ -14,6 +14,8 @@ import { builtinBadgeActions, builtinBadgeEffect, mergeBadgeMenu } from "zidane/
14
14
  const BadgeMenuContext = createContext(null);
15
15
  /** The kit's own row next to "Open in browser", shown when the host has a browser pane. */
16
16
  const OPEN_IN_PANE = "open-browser-pane";
17
+ /** The caller's open row (`BadgeMenuOpenAction`). */
18
+ const OPEN_CALLER = "open-caller";
17
19
  const NOTICE_MS = 2400;
18
20
  /** `abs` relative to `cwd` when inside it: the form the composer's `@` mentions use. */
19
21
  function relativeTo(abs, cwd) {
@@ -59,7 +61,7 @@ function BadgeMenuProvider({ composer, system, browser, children }) {
59
61
  const [open, setOpen] = useState(null);
60
62
  const [notice, setNotice] = useState(null);
61
63
  const seq = useRef(0);
62
- const show = useCallback((event, target, cwd) => {
64
+ const show = useCallback((event, target, cwd, openAction) => {
63
65
  event.preventDefault();
64
66
  event.stopPropagation();
65
67
  const n = ++seq.current;
@@ -72,6 +74,7 @@ function BadgeMenuProvider({ composer, system, browser, children }) {
72
74
  y: event.clientY
73
75
  },
74
76
  extra: [],
77
+ open: openAction,
75
78
  seq: n
76
79
  });
77
80
  badges?.actions(scope, target).then((extra) => setOpen((o) => o && o.seq === n ? {
@@ -99,7 +102,18 @@ function BadgeMenuProvider({ composer, system, browser, children }) {
99
102
  shortcut: "B",
100
103
  source: "builtin"
101
104
  }] : []]);
102
- return mergeBadgeMenu([...builtins, ...open.extra]).map((item) => ({
105
+ const caller = open.open ? [{
106
+ id: OPEN_CALLER,
107
+ label: open.open.label,
108
+ group: "open",
109
+ shortcut: "O",
110
+ source: "builtin"
111
+ }] : [];
112
+ return mergeBadgeMenu([
113
+ ...caller,
114
+ ...builtins,
115
+ ...open.extra
116
+ ]).map((item) => ({
103
117
  id: `${item.source}:${item.id}`,
104
118
  label: item.label,
105
119
  ...item.shortcut ? { shortcut: item.shortcut } : {},
@@ -108,6 +122,10 @@ function BadgeMenuProvider({ composer, system, browser, children }) {
108
122
  title: labels.badgeNoComposer
109
123
  } : {},
110
124
  onSelect: () => {
125
+ if (item.source === "builtin" && item.id === OPEN_CALLER) {
126
+ open.open?.onSelect();
127
+ return;
128
+ }
111
129
  if (item.source === "builtin" && item.id === OPEN_IN_PANE) {
112
130
  if (target.href) browser?.openInPane?.(target.href);
113
131
  return;
@@ -2,6 +2,7 @@ import { useStaysMounted } from "../../motion/collapse.js";
2
2
  import { RunEstimateChip, useRunEstimate } from "../RunEstimateChip.js";
3
3
  import { useChatLabels } from "../useChatLabels.js";
4
4
  import { Caret, Dot, FailedMark, lineStateOf, useRowIcons } from "./frame.js";
5
+ import { ModelBadge } from "./receipt-parts.js";
5
6
  import { useRowUiState } from "./row-ui-state.js";
6
7
  import { ToolTiming } from "./tool-parts.js";
7
8
  import { useMemo } from "react";
@@ -23,18 +24,28 @@ function legacySpawnDurationMs(text) {
23
24
  return (Number(m[5]) * 3600 + Number(m[6] ?? 0) * 60) * 1e3;
24
25
  }
25
26
  /**
26
- * Derived header content for a subagent cluster. Task + model come from
27
- * the spawn-start marker, duration / turn count / outcome from the
28
- * spawn-end marker. Without markers among the rows every field is
29
- * undefined and the header falls back to a bare "Agent" label.
27
+ * Derived header content for a subagent cluster. Task comes from the
28
+ * spawn-start marker, duration / turn count / outcome from the spawn-end
29
+ * marker. The model badge reads the end marker once there is one (what
30
+ * the worker's last turn ran with: fast mode only shows once it really
31
+ * ran), the start marker before. Without markers among the rows every
32
+ * field is undefined and the header falls back to a bare "Agent" label.
30
33
  */
31
34
  function subagentHeaderMeta(rows) {
32
35
  const start = rows.find((r) => r.kind === "spawn-start");
33
36
  const end = rows.find((r) => r.kind === "spawn-end");
34
37
  const task = start?.spawn?.task ?? (start ? spawnStartParts(start).task : void 0);
38
+ const modelId = end?.model ?? start?.model;
39
+ const flags = end ? end.spawn : start?.spawn;
40
+ const model = modelId ? {
41
+ id: modelId,
42
+ ...flags?.effort ? { effort: flags.effort } : {},
43
+ ...flags?.fast ? { fast: flags.fast } : {}
44
+ } : void 0;
35
45
  if (!end) return {
36
46
  task,
37
- status: "open"
47
+ status: "open",
48
+ ...model ? { model } : {}
38
49
  };
39
50
  const info = end.spawn?.end;
40
51
  const outcome = info?.status ?? end.text.split(" ")[0];
@@ -42,7 +53,8 @@ function subagentHeaderMeta(rows) {
42
53
  task,
43
54
  status: outcome === "error" || outcome === "aborted" ? "failed" : "done",
44
55
  durationMs: info ? info.durationMs : legacySpawnDurationMs(end.text),
45
- turns: end.spawn?.turns
56
+ turns: end.spawn?.turns,
57
+ ...model ? { model } : {}
46
58
  };
47
59
  }
48
60
  /**
@@ -73,7 +85,7 @@ function SubagentBlock({ childId, sessionId, depth, parentDepth, rows, defaultCo
73
85
  const [userOpen, setUserOpen] = useRowUiState(`worker-block:${childId}`, null);
74
86
  const open = userOpen ?? !defaultCollapsed;
75
87
  const mounted = useStaysMounted(open);
76
- const { task, status, durationMs, turns } = useMemo(() => subagentHeaderMeta(rows), [rows]);
88
+ const { task, status, durationMs, turns, model } = useMemo(() => subagentHeaderMeta(rows), [rows]);
77
89
  const dot = subagentDot(status, streaming);
78
90
  const estimate = useRunEstimate(status === "open" ? sessionId : void 0, childId);
79
91
  const lineState = useRowIcons() ? void 0 : lineStateOf(dot);
@@ -104,6 +116,11 @@ function SubagentBlock({ childId, sessionId, depth, parentDepth, rows, defaultCo
104
116
  className: "min-w-0 truncate",
105
117
  children: previewLine(task, 200)
106
118
  }),
119
+ model && /* @__PURE__ */ jsx(ModelBadge, {
120
+ model: model.id,
121
+ ...model.effort ? { effort: model.effort } : {},
122
+ ...model.fast ? { fast: true } : {}
123
+ }),
107
124
  durationMs !== void 0 && /* @__PURE__ */ jsx(ToolTiming, { durationMs }),
108
125
  estimate && /* @__PURE__ */ jsx(RunEstimateChip, { estimate }),
109
126
  turns !== void 0 && /* @__PURE__ */ jsx("span", {
@@ -6,7 +6,7 @@ import { constant, useReadable } from "../headless/store.js";
6
6
  import { EMPTY_RAIL, computeRailModel, computeRailModelParts, createTranscriptRailStore, dataRowSelector, railWithOutline } from "../headless/transcript/rail.js";
7
7
  import { useChatLabels } from "../useChatLabels.js";
8
8
  import { useModelName } from "./actions.js";
9
- import { RUN_RECEIPT_TINT, ReceiptValue } from "./receipt-parts.js";
9
+ import { RUN_RECEIPT_TINT, ReceiptSegments, ReceiptValue } from "./receipt-parts.js";
10
10
  import { revealRow } from "./row-mount.js";
11
11
  import { SelectCursor } from "./SelectCursor.js";
12
12
  import { createContext, memo, useCallback, useContext, useEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
@@ -575,9 +575,9 @@ function RailCard({ exchange }) {
575
575
  cells.length > 0 && /* @__PURE__ */ jsx("div", {
576
576
  className: "zg-meta flex flex-wrap items-center gap-1 min-w-0 mt-0.5",
577
577
  children: cells.map((cell) => /* @__PURE__ */ jsx("span", {
578
- className: "zg-meta-chip shrink min-w-0 max-w-full overflow-hidden",
578
+ className: "zg-meta-chip shrink min-w-0 max-w-full overflow-hidden gap-1",
579
579
  "data-cell": cell.kind,
580
- children: /* @__PURE__ */ jsx(ReceiptValue, {
580
+ children: cell.segments ? /* @__PURE__ */ jsx(ReceiptSegments, { segments: cell.segments }) : /* @__PURE__ */ jsx(ReceiptValue, {
581
581
  text: cell.text,
582
582
  className: RUN_RECEIPT_TINT[cell.kind]
583
583
  })
@@ -11,6 +11,7 @@ import { PromptOriginLabel } from "./PromptOriginLabel.js";
11
11
  import { TextRow, ThinkingBatchRow, ThinkingRow } from "./prose.js";
12
12
  import { rowEstimatePx } from "./row-estimate.js";
13
13
  import { CompactSummaryRow, RunReceiptInline, RunSummaryRow } from "./run-rows.js";
14
+ import { SessionEventGroupRow } from "./session-groups.js";
14
15
  import { ShellBlockProvider } from "./shell-block.js";
15
16
  import { TaskBatchRow, TaskRow } from "./tasks.js";
16
17
  import { ToolBatchRow } from "./tool-batch.js";
@@ -100,6 +101,13 @@ const TranscriptRow = memo(({ row, showCaret, receipt, resumable, ctx, renderRow
100
101
  row,
101
102
  renderRows: renderRows ?? NO_ROWS
102
103
  });
104
+ if (row.kind === "session-event-group") return /* @__PURE__ */ jsx(SessionEventGroupRow, {
105
+ className,
106
+ style,
107
+ row,
108
+ renderRows: renderRows ?? NO_ROWS,
109
+ onOpenSession: ctx.openSession
110
+ });
103
111
  if (row.kind === "command-detail") return /* @__PURE__ */ jsxs(RowFrame, {
104
112
  className,
105
113
  style,
@@ -1,5 +1,7 @@
1
1
  import { DotVariant } from "../headless/transcript/rows.js";
2
2
  import "../headless/transcript/index.js";
3
+ import { SessionDotState } from "../StatusDot.js";
4
+ import { SessionEventStatus } from "zidane/chat/pure";
3
5
  /** Horizontal distance in pixels from one nesting level of the transcript's glyph column to the next: a 16px glyph slot plus a 12px gap. */
4
6
  export declare const GUTTER_STEP_PX = 28;
5
7
  /**
@@ -63,6 +65,11 @@ export interface RowFrameProps {
63
65
  * @param props - Frame props: the row's `children` and the `enter` animation switch.
64
66
  */
65
67
  export declare function RowFrame({ children, enter, className, style }: RowFrameProps): import("react").JSX.Element;
68
+ /**
69
+ * A worker's report shows its outcome as the sidebar shows a session's
70
+ * state (`StatusDot`): the color is the status, so the row needs no verb.
71
+ */
72
+ export declare const SESSION_EVENT_DOT: Readonly<Record<SessionEventStatus, SessionDotState>>;
66
73
  /** Props for {@link Caret}. */
67
74
  export interface CaretProps {
68
75
  /** The header is expanded. Turns the caret down. */