@lukstei/dsh-client-kanban 0.2.2-rc.5.4 → 0.2.2-rc.5.5

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/client.js CHANGED
@@ -250,6 +250,58 @@ window.__ModuleLoader__.load({
250
250
  "aria-hidden": "true"
251
251
  });
252
252
  }
253
+ // src/types.ts
254
+ /** Session id of a `dsh://sessions/{id}` link, or `undefined` for any other URL. */
255
+ function sessionLinkId(value) {
256
+ const url = URL.parse(value);
257
+ if (url === null || url.protocol !== "dsh:" || url.hostname !== "sessions") return;
258
+ const id = url.pathname.slice(1);
259
+ return id === "" || id.includes("/") ? void 0 : id;
260
+ }
261
+ const kanbanLinkSchema = zod.z.object({
262
+ label: zod.z.string().trim().min(1),
263
+ url: zod.z.string().refine((value) => {
264
+ const url = URL.parse(value);
265
+ return url !== null && (url.protocol === "http:" || url.protocol === "https:" || sessionLinkId(value) !== void 0);
266
+ }, "Expected an absolute HTTP(S) URL or dsh://sessions/{id}"),
267
+ priority: zod.z.number().default(0)
268
+ });
269
+ zod.z.discriminatedUnion("action", [
270
+ zod.z.object({
271
+ action: zod.z.literal("init"),
272
+ createdAt: zod.z.number(),
273
+ prompt: zod.z.string().optional()
274
+ }),
275
+ zod.z.object({
276
+ action: zod.z.literal("done"),
277
+ doneAt: zod.z.number()
278
+ }),
279
+ zod.z.object({
280
+ action: zod.z.literal("reopen"),
281
+ reopenedAt: zod.z.number()
282
+ }),
283
+ zod.z.object({
284
+ action: zod.z.literal("delete"),
285
+ deletedAt: zod.z.number()
286
+ }),
287
+ zod.z.object({
288
+ action: zod.z.literal("hold"),
289
+ heldAt: zod.z.number()
290
+ }),
291
+ zod.z.object({
292
+ action: zod.z.literal("unhold"),
293
+ unheldAt: zod.z.number()
294
+ }),
295
+ zod.z.object({
296
+ action: zod.z.literal("pin"),
297
+ pinnedAt: zod.z.number()
298
+ }),
299
+ zod.z.object({
300
+ action: zod.z.literal("unpin"),
301
+ unpinnedAt: zod.z.number()
302
+ }),
303
+ kanbanLinkSchema.extend({ action: zod.z.literal("add-link") })
304
+ ]);
253
305
  // src/client/SessionLinks.tsx
254
306
  /**
255
307
  * Purpose: Show collected session links in a shared icon-triggered popover.
@@ -258,7 +310,7 @@ window.__ModuleLoader__.load({
258
310
  * - Outputs: An accessible link menu, hidden for an empty collection.
259
311
  * - Throws / Errors: Browser navigation errors propagate.
260
312
  */
261
- function SessionLinks({ links }) {
313
+ function SessionLinks({ links, onOpenSession }) {
262
314
  const [open, setOpen] = (0, react.useState)(false);
263
315
  return links.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
264
316
  open,
@@ -269,7 +321,9 @@ window.__ModuleLoader__.load({
269
321
  listClassName: "dsh-session-links-menu",
270
322
  onClose: () => setOpen(false),
271
323
  onSelect: (url) => {
272
- window.open(url, "_blank", "noopener,noreferrer");
324
+ const sessionId = sessionLinkId(url);
325
+ if (sessionId === void 0) window.open(url, "_blank", "noopener,noreferrer");
326
+ else onOpenSession(sessionId);
273
327
  setOpen(false);
274
328
  },
275
329
  items: links.map((link) => ({
@@ -374,51 +428,6 @@ window.__ModuleLoader__.load({
374
428
  const separator = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
375
429
  return trimmed.slice(separator + 1);
376
430
  }
377
- // src/types.ts
378
- const kanbanLinkSchema = zod.z.object({
379
- label: zod.z.string().trim().min(1),
380
- url: zod.z.string().refine((value) => {
381
- const url = URL.parse(value);
382
- return url !== null && (url.protocol === "http:" || url.protocol === "https:");
383
- }, "Expected an absolute HTTP(S) URL"),
384
- priority: zod.z.number().default(0)
385
- });
386
- zod.z.discriminatedUnion("action", [
387
- zod.z.object({
388
- action: zod.z.literal("init"),
389
- createdAt: zod.z.number(),
390
- prompt: zod.z.string().optional()
391
- }),
392
- zod.z.object({
393
- action: zod.z.literal("done"),
394
- doneAt: zod.z.number()
395
- }),
396
- zod.z.object({
397
- action: zod.z.literal("reopen"),
398
- reopenedAt: zod.z.number()
399
- }),
400
- zod.z.object({
401
- action: zod.z.literal("delete"),
402
- deletedAt: zod.z.number()
403
- }),
404
- zod.z.object({
405
- action: zod.z.literal("hold"),
406
- heldAt: zod.z.number()
407
- }),
408
- zod.z.object({
409
- action: zod.z.literal("unhold"),
410
- unheldAt: zod.z.number()
411
- }),
412
- zod.z.object({
413
- action: zod.z.literal("pin"),
414
- pinnedAt: zod.z.number()
415
- }),
416
- zod.z.object({
417
- action: zod.z.literal("unpin"),
418
- unpinnedAt: zod.z.number()
419
- }),
420
- kanbanLinkSchema.extend({ action: zod.z.literal("add-link") })
421
- ]);
422
431
  // src/client/store.ts
423
432
  /**
424
433
  * Purpose: Determine whether a session belongs to the Kanban board and has not expired.
@@ -839,22 +848,6 @@ window.__ModuleLoader__.load({
839
848
  if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent("dsh-kanban-workspace-change"));
840
849
  } catch {}
841
850
  }
842
- /**
843
- * Purpose: Intersect partitioned Kanban lanes with host content-search hits.
844
- * Contract:
845
- * - Inputs: PartitionedKanbanSessions snapshot and matching session IDs.
846
- * - Outputs: Matching visible sessions in their existing lane order.
847
- * - Throws / Errors: Never throws.
848
- */
849
- function filterPartitionedSessions(partitioned, matchingIds) {
850
- const matches = (session) => matchingIds.has(session.id);
851
- return {
852
- todo: partitioned.todo.filter(matches),
853
- active: partitioned.active.filter(matches),
854
- review: partitioned.review.filter(matches),
855
- done: partitioned.done.filter(matches)
856
- };
857
- }
858
851
  // src/client/use-kanban.ts
859
852
  /**
860
853
  * Purpose: Subscribe to an ObservableSnapshot reactive store.
@@ -1218,7 +1211,10 @@ window.__ModuleLoader__.load({
1218
1211
  }),
1219
1212
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1220
1213
  className: "dsh-inflight-card-content",
1221
- children: [record !== void 0 && record !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionLinks, { links: record.links }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1214
+ children: [record !== void 0 && record !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionLinks, {
1215
+ links: record.links,
1216
+ onOpenSession: selectSession
1217
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1222
1218
  type: "button",
1223
1219
  className: "dsh-inflight-card-main",
1224
1220
  "aria-current": isFocused ? "true" : void 0,
@@ -1280,6 +1276,82 @@ window.__ModuleLoader__.load({
1280
1276
  })]
1281
1277
  });
1282
1278
  }
1279
+ // src/client/KanbanSearchResults.tsx
1280
+ const LANE_LABELS = {
1281
+ todo: "To Do",
1282
+ active: "Active",
1283
+ review: "Review",
1284
+ done: "Done"
1285
+ };
1286
+ const escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1287
+ /** Wrap every query term occurrence in <mark>; terms are literal, case-insensitive. */
1288
+ function highlight(text, query) {
1289
+ const terms = query.split(/\s+/).filter((term) => term !== "");
1290
+ if (terms.length === 0) return text;
1291
+ const pattern = new RegExp(`(${terms.map(escapeRegExp).join("|")})`, "gi");
1292
+ return text.split(pattern).map((part, index) => index % 2 === 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("mark", { children: part }, index) : part);
1293
+ }
1294
+ /**
1295
+ * Purpose: Replace the board while searching with a ranked list beside a full preview of the focused session.
1296
+ * Contract:
1297
+ * - Inputs: Ranked hits, the raw query for highlighting, the focused hit, the preview body and focus/open callbacks.
1298
+ * - Outputs: One focusable row per hit and a preview pane with an "Open session" action.
1299
+ * - Throws / Errors: Never throws.
1300
+ */
1301
+ function KanbanSearchResults({ hits, query, focusedId, preview, onFocus, onOpen }) {
1302
+ const focused = hits.find((hit) => hit.session.id === focusedId);
1303
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1304
+ className: "dsh-kanban-results-layout",
1305
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
1306
+ className: "dsh-kanban-results",
1307
+ "aria-label": "Search results",
1308
+ children: hits.map(({ session, lane, snippet }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1309
+ type: "button",
1310
+ className: `dsh-kanban-result ${session.id === focusedId ? "is-focused" : ""}`,
1311
+ "aria-current": session.id === focusedId,
1312
+ onClick: () => onFocus(session.id),
1313
+ onDoubleClick: () => onOpen(session.id),
1314
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1315
+ className: "dsh-kanban-result-head",
1316
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1317
+ className: "dsh-kanban-result-title",
1318
+ children: getKanbanSessionTitle(session)
1319
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1320
+ className: "dsh-kanban-result-meta",
1321
+ children: [
1322
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanStatusDot, { state: lane }),
1323
+ LANE_LABELS[lane],
1324
+ " ·",
1325
+ " ",
1326
+ formatRelativeTime(getSessionRecency(session))
1327
+ ]
1328
+ })]
1329
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1330
+ className: "dsh-kanban-result-snippet",
1331
+ children: highlight(snippet, query)
1332
+ })]
1333
+ }) }, session.id))
1334
+ }), focused !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
1335
+ className: "dsh-kanban-preview",
1336
+ "aria-label": "Session preview",
1337
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1338
+ className: "dsh-kanban-preview-head",
1339
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1340
+ className: "dsh-kanban-preview-title",
1341
+ children: getKanbanSessionTitle(focused.session)
1342
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1343
+ type: "button",
1344
+ className: "dsh-kanban-btn-prepare",
1345
+ onClick: () => onOpen(focused.session.id),
1346
+ children: "Open session"
1347
+ })]
1348
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1349
+ className: "dsh-kanban-preview-body",
1350
+ children: preview
1351
+ })]
1352
+ })]
1353
+ });
1354
+ }
1283
1355
  // src/client/KanbanCard.tsx
1284
1356
  /**
1285
1357
  * Purpose: Render a draggable Kanban card displaying session status, title/prompt, and runtime badge.
@@ -1350,7 +1422,10 @@ window.__ModuleLoader__.load({
1350
1422
  }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: formatRelativeTime(getSessionRecency(session)) }), lane === "todo" && !session.blank && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1351
1423
  className: "dsh-kanban-badge-hold",
1352
1424
  children: "On hold"
1353
- })] }) }), record !== void 0 && record !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionLinks, { links: record.links })]
1425
+ })] }) }), record !== void 0 && record !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionLinks, {
1426
+ links: record.links,
1427
+ onOpenSession: onSelect
1428
+ })]
1354
1429
  }),
1355
1430
  onTransition !== void 0 && lane !== "active" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1356
1431
  className: "dsh-kanban-card-mobile-actions",
@@ -1523,7 +1598,7 @@ window.__ModuleLoader__.load({
1523
1598
  * - Outputs: Rendered JSX element for the Kanban board view.
1524
1599
  * - Throws / Errors: Never throws.
1525
1600
  */
1526
- function KanbanPane({ sessionsList, workspacesList, sessionStatus, searchSessions, searchResultLimit, currentSessionId, refreshProjections, startTask, prepareTask, startPreparedTask, selectSession, markDone, reopen, deleteSession, holdSession, unholdSession, pinSession, unpinSession }) {
1601
+ function KanbanPane({ sessionsList, workspacesList, sessionStatus, searchSessions, searchResultLimit, renderPreview, currentSessionId, refreshProjections, startTask, prepareTask, startPreparedTask, selectSession, markDone, reopen, deleteSession, holdSession, unholdSession, pinSession, unpinSession }) {
1527
1602
  const [userWorkspaceId, setUserWorkspaceId] = (0, react.useState)(() => getStoredKanbanWorkspace());
1528
1603
  const [isStarting, setIsStarting] = (0, react.useState)(false);
1529
1604
  const [isPreparingTask, setIsPreparingTask] = (0, react.useState)(false);
@@ -1654,21 +1729,55 @@ window.__ModuleLoader__.load({
1654
1729
  effectiveWorkspaceId
1655
1730
  ]);
1656
1731
  const searchResult = searchState.status === "settled" && searchState.query === query && searchState.workspaceId === effectiveWorkspaceId && searchState.scope === searchScope ? searchState.result : void 0;
1657
- const displayedPartitioned = (0, react.useMemo)(() => {
1658
- if (query === "") return partitioned;
1659
- const matchingIds = new Set(searchResult !== void 0 && searchResult.ok ? searchResult.value.items.map((item) => item.sessionId) : []);
1660
- return filterPartitionedSessions(partitioned, matchingIds);
1661
- }, [
1662
- partitioned,
1663
- query,
1664
- searchResult
1665
- ]);
1732
+ const searchHits = (0, react.useMemo)(() => {
1733
+ if (searchResult === void 0 || !searchResult.ok) return [];
1734
+ const byId = new Map([
1735
+ "todo",
1736
+ "active",
1737
+ "review",
1738
+ "done"
1739
+ ].flatMap((lane) => partitioned[lane].map((session) => [session.id, {
1740
+ session,
1741
+ lane
1742
+ }])));
1743
+ return searchResult.value.items.flatMap((item) => {
1744
+ const entry = byId.get(item.sessionId);
1745
+ return entry === void 0 ? [] : [{
1746
+ ...entry,
1747
+ snippet: item.snippet
1748
+ }];
1749
+ });
1750
+ }, [searchResult, partitioned]);
1751
+ const [focusedId, setFocusedId] = (0, react.useState)();
1752
+ const focusedHitId = (searchHits.find((hit) => hit.session.id === focusedId) ?? searchHits[0])?.session.id;
1753
+ const [previewId, setPreviewId] = (0, react.useState)();
1754
+ (0, react.useEffect)(() => {
1755
+ const timer = setTimeout(() => setPreviewId(focusedHitId), 150);
1756
+ return () => clearTimeout(timer);
1757
+ }, [focusedHitId]);
1758
+ const handleSearchKeyDown = (event) => {
1759
+ if (query === "") return;
1760
+ if (event.key === "Escape") {
1761
+ setSearchQuery("");
1762
+ return;
1763
+ }
1764
+ if (event.key === "Enter" && focusedHitId !== void 0) {
1765
+ selectSession(focusedHitId);
1766
+ return;
1767
+ }
1768
+ const step = event.key === "ArrowDown" ? 1 : event.key === "ArrowUp" ? -1 : 0;
1769
+ if (step === 0 || searchHits.length === 0) return;
1770
+ event.preventDefault();
1771
+ const index = searchHits.findIndex((hit) => hit.session.id === focusedHitId);
1772
+ const next = Math.min(Math.max(index + step, 0), searchHits.length - 1);
1773
+ setFocusedId(searchHits[next].session.id);
1774
+ };
1666
1775
  let searchMessage = "";
1667
1776
  if (query !== "") {
1668
1777
  if (searchResult === void 0) searchMessage = "Searching session contents…";
1669
1778
  else if (!searchResult.ok) searchMessage = `Search failed: ${searchResult.error.message}`;
1670
1779
  else if (searchResult.value.hasMore) searchMessage = `Search limited to ${searchResultLimit} sessions in this workspace. Narrow your query.`;
1671
- else if (Object.values(displayedPartitioned).every((sessions) => sessions.length === 0)) searchMessage = "No matching sessions in this workspace.";
1780
+ else if (searchHits.length === 0) searchMessage = "No matching sessions in this workspace.";
1672
1781
  }
1673
1782
  const handleDropSession = async (sessionId, targetLane) => {
1674
1783
  setActiveDragSourceLane(void 0);
@@ -1777,6 +1886,7 @@ window.__ModuleLoader__.load({
1777
1886
  placeholder: "Search sessions...",
1778
1887
  value: searchQuery,
1779
1888
  onChange: (e) => setSearchQuery(e.target.value),
1889
+ onKeyDown: handleSearchKeyDown,
1780
1890
  "aria-label": "Search sessions"
1781
1891
  })
1782
1892
  })
@@ -1787,63 +1897,73 @@ window.__ModuleLoader__.load({
1787
1897
  role: "status",
1788
1898
  children: searchMessage
1789
1899
  }),
1790
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1900
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1791
1901
  className: "dsh-kanban-scroll",
1792
1902
  "aria-busy": query !== "" && searchResult === void 0,
1793
- children: [
1794
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSection, {
1795
- lane: "todo",
1796
- title: "To Do",
1797
- sessions: displayedPartitioned.todo,
1798
- selectedSessionId: currentSessionId,
1799
- isPreparing: isPreparingTask,
1800
- activeDragSourceLane,
1801
- getAlert: board.getAlert,
1802
- onSelect: selectSession,
1803
- onDropSession: handleDropSession,
1804
- onDragStart: handleDragStart,
1805
- onDragEnd: handleDragEnd,
1806
- onSubmitPrepare: handlePrepareTask,
1807
- onCancelPrepare: () => setIsPreparingTask(false)
1808
- }),
1809
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSection, {
1810
- lane: "active",
1811
- title: "Active",
1812
- sessions: displayedPartitioned.active,
1813
- selectedSessionId: currentSessionId,
1814
- activeDragSourceLane,
1815
- getAlert: board.getAlert,
1816
- onSelect: selectSession,
1817
- onDropSession: handleDropSession,
1818
- onDragStart: handleDragStart,
1819
- onDragEnd: handleDragEnd
1820
- }),
1821
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSection, {
1822
- lane: "review",
1823
- title: "Review",
1824
- sessions: displayedPartitioned.review,
1825
- selectedSessionId: currentSessionId,
1826
- activeDragSourceLane,
1827
- getAlert: board.getAlert,
1828
- onSelect: selectSession,
1829
- onDropSession: handleDropSession,
1830
- onDragStart: handleDragStart,
1831
- onDragEnd: handleDragEnd
1832
- }),
1833
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSection, {
1834
- lane: "done",
1835
- title: "Done",
1836
- sessions: displayedPartitioned.done,
1837
- selectedSessionId: currentSessionId,
1838
- activeDragSourceLane,
1839
- getAlert: board.getAlert,
1840
- onSelect: selectSession,
1841
- onDropSession: handleDropSession,
1842
- onDragStart: handleDragStart,
1843
- onDragEnd: handleDragEnd,
1844
- onTogglePin: handleTogglePin
1845
- })
1846
- ]
1903
+ children: query !== "" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSearchResults, {
1904
+ hits: searchHits,
1905
+ query,
1906
+ focusedId: focusedHitId,
1907
+ preview: previewId !== void 0 && previewId === focusedHitId ? renderPreview(previewId) : null,
1908
+ onFocus: setFocusedId,
1909
+ onOpen: selectSession
1910
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1911
+ className: "dsh-kanban-board",
1912
+ children: [
1913
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSection, {
1914
+ lane: "todo",
1915
+ title: "To Do",
1916
+ sessions: partitioned.todo,
1917
+ selectedSessionId: currentSessionId,
1918
+ isPreparing: isPreparingTask,
1919
+ activeDragSourceLane,
1920
+ getAlert: board.getAlert,
1921
+ onSelect: selectSession,
1922
+ onDropSession: handleDropSession,
1923
+ onDragStart: handleDragStart,
1924
+ onDragEnd: handleDragEnd,
1925
+ onSubmitPrepare: handlePrepareTask,
1926
+ onCancelPrepare: () => setIsPreparingTask(false)
1927
+ }),
1928
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSection, {
1929
+ lane: "active",
1930
+ title: "Active",
1931
+ sessions: partitioned.active,
1932
+ selectedSessionId: currentSessionId,
1933
+ activeDragSourceLane,
1934
+ getAlert: board.getAlert,
1935
+ onSelect: selectSession,
1936
+ onDropSession: handleDropSession,
1937
+ onDragStart: handleDragStart,
1938
+ onDragEnd: handleDragEnd
1939
+ }),
1940
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSection, {
1941
+ lane: "review",
1942
+ title: "Review",
1943
+ sessions: partitioned.review,
1944
+ selectedSessionId: currentSessionId,
1945
+ activeDragSourceLane,
1946
+ getAlert: board.getAlert,
1947
+ onSelect: selectSession,
1948
+ onDropSession: handleDropSession,
1949
+ onDragStart: handleDragStart,
1950
+ onDragEnd: handleDragEnd
1951
+ }),
1952
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSection, {
1953
+ lane: "done",
1954
+ title: "Done",
1955
+ sessions: partitioned.done,
1956
+ selectedSessionId: currentSessionId,
1957
+ activeDragSourceLane,
1958
+ getAlert: board.getAlert,
1959
+ onSelect: selectSession,
1960
+ onDropSession: handleDropSession,
1961
+ onDragStart: handleDragStart,
1962
+ onDragEnd: handleDragEnd,
1963
+ onTogglePin: handleTogglePin
1964
+ })
1965
+ ]
1966
+ })
1847
1967
  }),
1848
1968
  activeDragSourceLane !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1849
1969
  className: `dsh-kanban-recycle-bin ${isRecycleOver ? "is-drag-over" : ""}`,
@@ -1865,6 +1985,39 @@ window.__ModuleLoader__.load({
1865
1985
  ]
1866
1986
  });
1867
1987
  }
1988
+ // src/client/KanbanMain.tsx
1989
+ /**
1990
+ * Purpose: Main-panel entry that gives the board a session-scoped preview renderer.
1991
+ * Contract:
1992
+ * - Inputs: Slot runtime (SessionProvider, renderSlot) and the board's injected face plus `retainSession`.
1993
+ * - Outputs: KanbanPane whose `renderPreview` holds the session open while it is shown.
1994
+ * - Throws / Errors: Never throws.
1995
+ */
1996
+ function KanbanMain({ SessionProvider, renderSlot, retainSession, ...injected }) {
1997
+ const renderPreview = (id) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PreviewHost, {
1998
+ sessionId: id,
1999
+ retainSession,
2000
+ SessionProvider,
2001
+ renderSlot
2002
+ }, id);
2003
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanPane, {
2004
+ ...injected,
2005
+ renderPreview
2006
+ });
2007
+ }
2008
+ function PreviewHost({ sessionId, retainSession, SessionProvider, renderSlot }) {
2009
+ const [reference, setReference] = (0, react.useState)();
2010
+ (0, react.useEffect)(() => {
2011
+ const retained = retainSession(sessionId);
2012
+ setReference(retained);
2013
+ return () => retained.release();
2014
+ }, [retainSession, sessionId]);
2015
+ if (reference === void 0) return null;
2016
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionProvider, {
2017
+ session: reference,
2018
+ children: renderSlot("kanban.preview", {})
2019
+ });
2020
+ }
1868
2021
  // src/client/KanbanPaneStatus.tsx
1869
2022
  /**
1870
2023
  * Purpose: Render the sidebar's Kanban lane and alert indicator in a split pane.
@@ -1891,6 +2044,26 @@ window.__ModuleLoader__.load({
1891
2044
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanStatusDot, { state: alert === void 0 ? lane : "alert" })
1892
2045
  });
1893
2046
  }
2047
+ // src/client/KanbanSessionPreview.tsx
2048
+ /**
2049
+ * Purpose: Occupant of `kanban.preview`: the embedded read-only conversation of the scoped session.
2050
+ * Contract:
2051
+ * - Inputs: Session-scoped runtime hooks and the factory renderer.
2052
+ * - Outputs: The same `conversation.content` body split view shows in its overlays.
2053
+ * - Throws / Errors: Never throws.
2054
+ */
2055
+ function KanbanSessionPreview({ sessionId, useSession, useConversation, useSessions, renderFactorySlot }) {
2056
+ const session = useSession((value) => value);
2057
+ const conversation = useConversation((value) => value);
2058
+ const summaryBlank = useSessions((state) => state.byId[sessionId]?.blank);
2059
+ const blank = !(conversation.activeTargets.size > 0 || !session.blank && !session.awaitingFirstTurn || session.running) && !session.promptAttempted;
2060
+ const hero = blank && (session.openState === "open" || summaryBlank === true);
2061
+ return renderFactorySlot("conversation.content", {
2062
+ variant: "embedded",
2063
+ phase: blank && session.openState === "loading" && summaryBlank !== true ? "settling" : hero ? "hero" : "active",
2064
+ hero
2065
+ });
2066
+ }
1894
2067
  // src/client/KanbanTransitionDropdown.tsx
1895
2068
  function formatLaneLabel(lane, record) {
1896
2069
  if (lane === "active") return "In Progress";
@@ -1971,7 +2144,7 @@ window.__ModuleLoader__.load({
1971
2144
  * - Outputs: Rendered JSX element with an accessible trigger button and transition popover menu.
1972
2145
  * - Throws / Errors: Never throws; transition command failures are handled by callers.
1973
2146
  */
1974
- function KanbanTransitionDropdown({ sessionId, useSession, useSessions, holdSession, unholdSession, markDone, reopen, startPreparedTask }) {
2147
+ function KanbanTransitionDropdown({ sessionId, useSession, useSessions, holdSession, unholdSession, markDone, reopen, closePane, startPreparedTask }) {
1975
2148
  const [open, setOpen] = (0, react.useState)(false);
1976
2149
  const isRunning = useSession((s) => s.running);
1977
2150
  const isBlank = useSession((s) => s.blank);
@@ -1987,7 +2160,7 @@ window.__ModuleLoader__.load({
1987
2160
  links: []
1988
2161
  }, hasPendingInteraction);
1989
2162
  const laneLabel = formatLaneLabel(lane, record);
1990
- const items = (0, react.useMemo)(() => {
2163
+ const laneItems = (0, react.useMemo)(() => {
1991
2164
  if (lane === "active") return [];
1992
2165
  if (lane === "review") return [{
1993
2166
  id: "done",
@@ -2030,6 +2203,20 @@ window.__ModuleLoader__.load({
2030
2203
  }];
2031
2204
  return [];
2032
2205
  }, [lane, isBlank]);
2206
+ const items = [
2207
+ ...laneItems,
2208
+ ...laneItems.length > 0 ? [{
2209
+ type: "separator",
2210
+ id: "close-separator"
2211
+ }] : [],
2212
+ {
2213
+ id: "close",
2214
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2215
+ className: "dsh-kanban-transition-item",
2216
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 14 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Close pane" })]
2217
+ })
2218
+ }
2219
+ ];
2033
2220
  if (summary?.origin === "subagent") return null;
2034
2221
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
2035
2222
  open: open && !isRunning,
@@ -2044,6 +2231,7 @@ window.__ModuleLoader__.load({
2044
2231
  if (id === "hold") holdSession(sessionId);
2045
2232
  else if (id === "done") markDone(sessionId);
2046
2233
  else if (id === "reopen") reopen(sessionId);
2234
+ else if (id === "close") closePane(sessionId);
2047
2235
  else if (id === "resume") {
2048
2236
  if (isBlank && record?.prompt) startPreparedTask(sessionId, record.prompt);
2049
2237
  else unholdSession(sessionId);
@@ -2379,6 +2567,139 @@ window.__ModuleLoader__.load({
2379
2567
  color: var(--dsw-alias-label-secondary, #64748b);
2380
2568
  }
2381
2569
 
2570
+ .dsh-kanban-board {
2571
+ display: contents;
2572
+ }
2573
+
2574
+ .dsh-kanban-results-layout {
2575
+ display: grid;
2576
+ grid-template-columns: minmax(260px, 2fr) 3fr;
2577
+ gap: 12px;
2578
+ flex: 1;
2579
+ min-height: 0;
2580
+ }
2581
+
2582
+ .dsh-kanban-results-layout > .dsh-kanban-results {
2583
+ overflow-y: auto;
2584
+ align-content: start;
2585
+ }
2586
+
2587
+ .dsh-kanban-preview {
2588
+ display: flex;
2589
+ flex-direction: column;
2590
+ min-height: 0;
2591
+ border: 1px solid var(--dsw-alias-border-l1, #e2e8f0);
2592
+ border-radius: 6px;
2593
+ background: var(--dsw-alias-bg-base);
2594
+ overflow: hidden;
2595
+ }
2596
+
2597
+ .dsh-kanban-preview-head {
2598
+ display: flex;
2599
+ justify-content: space-between;
2600
+ align-items: center;
2601
+ gap: 12px;
2602
+ padding: 8px 12px;
2603
+ border-bottom: 1px solid var(--dsw-alias-border-l1, #e2e8f0);
2604
+ }
2605
+
2606
+ .dsh-kanban-preview-title {
2607
+ font-size: 13px;
2608
+ font-weight: 500;
2609
+ overflow: hidden;
2610
+ text-overflow: ellipsis;
2611
+ white-space: nowrap;
2612
+ }
2613
+
2614
+ .dsh-kanban-preview-body {
2615
+ flex: 1;
2616
+ min-height: 0;
2617
+ display: flex;
2618
+ flex-direction: column;
2619
+ overflow: hidden;
2620
+ }
2621
+
2622
+ @media (max-width: 767px) {
2623
+ .dsh-kanban-results-layout {
2624
+ grid-template-columns: 1fr;
2625
+ grid-template-rows: minmax(120px, 2fr) 3fr;
2626
+ }
2627
+ }
2628
+
2629
+ .dsh-kanban-results {
2630
+ list-style: none;
2631
+ margin: 0;
2632
+ padding: 0;
2633
+ display: flex;
2634
+ flex-direction: column;
2635
+ gap: 8px;
2636
+ }
2637
+
2638
+ .dsh-kanban-result {
2639
+ display: flex;
2640
+ flex-direction: column;
2641
+ gap: 6px;
2642
+ width: 100%;
2643
+ text-align: left;
2644
+ font: inherit;
2645
+ color: inherit;
2646
+ background: var(--dsw-alias-bg-base);
2647
+ border: 1px solid var(--dsw-alias-border-l1, #e2e8f0);
2648
+ border-radius: 6px;
2649
+ padding: 10px 12px;
2650
+ cursor: pointer;
2651
+ }
2652
+
2653
+ .dsh-kanban-result:hover,
2654
+ .dsh-kanban-result:focus-visible {
2655
+ border-color: var(--dsw-alias-state-business-primary, #2563eb);
2656
+ outline: none;
2657
+ }
2658
+
2659
+ .dsh-kanban-result.is-focused {
2660
+ border-left: 3px solid var(--dsw-alias-state-business-primary, #2563eb);
2661
+ }
2662
+
2663
+ .dsh-kanban-result-head {
2664
+ display: flex;
2665
+ justify-content: space-between;
2666
+ align-items: baseline;
2667
+ gap: 12px;
2668
+ }
2669
+
2670
+ .dsh-kanban-result-title {
2671
+ font-size: 14px;
2672
+ font-weight: 500;
2673
+ word-break: break-word;
2674
+ }
2675
+
2676
+ .dsh-kanban-result-meta {
2677
+ display: inline-flex;
2678
+ align-items: center;
2679
+ gap: 5px;
2680
+ flex-shrink: 0;
2681
+ font-size: 11px;
2682
+ color: var(--dsw-alias-label-secondary, #64748b);
2683
+ }
2684
+
2685
+ .dsh-kanban-result-snippet {
2686
+ font-size: 12px;
2687
+ line-height: 18px;
2688
+ color: var(--dsw-alias-label-secondary, #64748b);
2689
+ white-space: pre-wrap;
2690
+ word-break: break-word;
2691
+ display: -webkit-box;
2692
+ -webkit-line-clamp: 4;
2693
+ -webkit-box-orient: vertical;
2694
+ overflow: hidden;
2695
+ }
2696
+
2697
+ .dsh-kanban-result-snippet mark {
2698
+ background: color-mix(in srgb, var(--dsw-alias-state-business-primary, #2563eb) 25%, transparent);
2699
+ color: var(--dsw-alias-label-primary, #1e293b);
2700
+ border-radius: 2px;
2701
+ }
2702
+
2382
2703
  .dsh-kanban-scroll {
2383
2704
  flex: 1;
2384
2705
  overflow-y: auto;
@@ -3809,6 +4130,7 @@ window.__ModuleLoader__.load({
3809
4130
  splitCtx.effect(() => splitCtx.slots.inject("split.subagent.status", () => splitCtx.slots.register({ name: "split.subagent.status" }, KanbanStatusDot)), "kanban: split subagent status");
3810
4131
  }
3811
4132
  });
4133
+ const retainSession = (id) => sessions.retain(id, { source: "kanbanPreview" });
3812
4134
  const createKanbanProps = (activeSessionId, openSession) => ({
3813
4135
  sessionsList: sessions.list,
3814
4136
  workspacesList: workspaces.list,
@@ -3816,6 +4138,7 @@ window.__ModuleLoader__.load({
3816
4138
  currentSessionId: activeSessionId ?? getActiveSessionId(),
3817
4139
  searchSessions,
3818
4140
  searchResultLimit: 20,
4141
+ retainSession,
3819
4142
  selectPanel: (id) => ctx.layout.selectPanel(id),
3820
4143
  refreshProjections: (id) => sessions.refreshProjections(id),
3821
4144
  startTask: async (workspaceId) => {
@@ -3959,9 +4282,14 @@ window.__ModuleLoader__.load({
3959
4282
  return ctx.slots.inject("main", () => ctx.slots.register({
3960
4283
  name: "main",
3961
4284
  key: "kanban",
4285
+ children: { "kanban.preview": {
4286
+ kind: "single",
4287
+ scope: "session"
4288
+ } },
3962
4289
  inject: () => createKanbanProps(void 0, navigation.maximizeSession)
3963
- }, KanbanPane));
4290
+ }, KanbanMain));
3964
4291
  }, "kanban: main view");
4292
+ ctx.effect(() => ctx.slots.inject("main", () => ctx.slots.register({ name: "kanban.preview" }, KanbanSessionPreview)), "kanban: session preview");
3965
4293
  ctx.effect(() => {
3966
4294
  const kanbanActions = createKanbanProps(void 0, navigation.openSession);
3967
4295
  return ctx.slots.inject("conversation.input.left", () => ctx.slots.register({
@@ -3973,6 +4301,7 @@ window.__ModuleLoader__.load({
3973
4301
  unholdSession: kanbanActions.unholdSession,
3974
4302
  markDone: kanbanActions.markDone,
3975
4303
  reopen: kanbanActions.reopen,
4304
+ closePane: navigation.removeSession,
3976
4305
  startPreparedTask: kanbanActions.startPreparedTask
3977
4306
  })
3978
4307
  }, KanbanTransitionDropdown));