@lukstei/dsh-client-kanban 0.2.2-rc.5.3 → 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,61 +428,17 @@ 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.
425
434
  * Contract:
426
- * - Inputs: KanbanRecord or null/undefined, optional session summary with blank status, and reference timestamp (defaults to Date.now()).
435
+ * - Inputs: KanbanRecord or null/undefined, optional session summary with blank status and origin, and reference timestamp (defaults to Date.now()).
427
436
  * - Outputs: True if session is initialized, not expired in Done (> 7 days), and not an unstarted empty session.
428
437
  * - Throws / Errors: Never throws.
429
438
  */
430
439
  function isSessionVisibleInKanban(record, session, now = Date.now()) {
431
440
  if (!record) return false;
441
+ if (session?.origin === "subagent") return false;
432
442
  if (record.doneAt !== void 0 && record.pinnedAt === void 0 && now - record.doneAt > 6048e5) return false;
433
443
  if (session !== void 0 && session.blank && !record.prompt && record.heldAt === void 0 && record.reviewAt === void 0 && record.doneAt === void 0) return false;
434
444
  return true;
@@ -838,22 +848,6 @@ window.__ModuleLoader__.load({
838
848
  if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent("dsh-kanban-workspace-change"));
839
849
  } catch {}
840
850
  }
841
- /**
842
- * Purpose: Intersect partitioned Kanban lanes with host content-search hits.
843
- * Contract:
844
- * - Inputs: PartitionedKanbanSessions snapshot and matching session IDs.
845
- * - Outputs: Matching visible sessions in their existing lane order.
846
- * - Throws / Errors: Never throws.
847
- */
848
- function filterPartitionedSessions(partitioned, matchingIds) {
849
- const matches = (session) => matchingIds.has(session.id);
850
- return {
851
- todo: partitioned.todo.filter(matches),
852
- active: partitioned.active.filter(matches),
853
- review: partitioned.review.filter(matches),
854
- done: partitioned.done.filter(matches)
855
- };
856
- }
857
851
  // src/client/use-kanban.ts
858
852
  /**
859
853
  * Purpose: Subscribe to an ObservableSnapshot reactive store.
@@ -1217,7 +1211,10 @@ window.__ModuleLoader__.load({
1217
1211
  }),
1218
1212
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1219
1213
  className: "dsh-inflight-card-content",
1220
- 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", {
1221
1218
  type: "button",
1222
1219
  className: "dsh-inflight-card-main",
1223
1220
  "aria-current": isFocused ? "true" : void 0,
@@ -1279,6 +1276,82 @@ window.__ModuleLoader__.load({
1279
1276
  })]
1280
1277
  });
1281
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
+ }
1282
1355
  // src/client/KanbanCard.tsx
1283
1356
  /**
1284
1357
  * Purpose: Render a draggable Kanban card displaying session status, title/prompt, and runtime badge.
@@ -1349,7 +1422,10 @@ window.__ModuleLoader__.load({
1349
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", {
1350
1423
  className: "dsh-kanban-badge-hold",
1351
1424
  children: "On hold"
1352
- })] }) }), 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
+ })]
1353
1429
  }),
1354
1430
  onTransition !== void 0 && lane !== "active" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1355
1431
  className: "dsh-kanban-card-mobile-actions",
@@ -1522,7 +1598,7 @@ window.__ModuleLoader__.load({
1522
1598
  * - Outputs: Rendered JSX element for the Kanban board view.
1523
1599
  * - Throws / Errors: Never throws.
1524
1600
  */
1525
- 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 }) {
1526
1602
  const [userWorkspaceId, setUserWorkspaceId] = (0, react.useState)(() => getStoredKanbanWorkspace());
1527
1603
  const [isStarting, setIsStarting] = (0, react.useState)(false);
1528
1604
  const [isPreparingTask, setIsPreparingTask] = (0, react.useState)(false);
@@ -1653,21 +1729,55 @@ window.__ModuleLoader__.load({
1653
1729
  effectiveWorkspaceId
1654
1730
  ]);
1655
1731
  const searchResult = searchState.status === "settled" && searchState.query === query && searchState.workspaceId === effectiveWorkspaceId && searchState.scope === searchScope ? searchState.result : void 0;
1656
- const displayedPartitioned = (0, react.useMemo)(() => {
1657
- if (query === "") return partitioned;
1658
- const matchingIds = new Set(searchResult !== void 0 && searchResult.ok ? searchResult.value.items.map((item) => item.sessionId) : []);
1659
- return filterPartitionedSessions(partitioned, matchingIds);
1660
- }, [
1661
- partitioned,
1662
- query,
1663
- searchResult
1664
- ]);
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
+ };
1665
1775
  let searchMessage = "";
1666
1776
  if (query !== "") {
1667
1777
  if (searchResult === void 0) searchMessage = "Searching session contents…";
1668
1778
  else if (!searchResult.ok) searchMessage = `Search failed: ${searchResult.error.message}`;
1669
1779
  else if (searchResult.value.hasMore) searchMessage = `Search limited to ${searchResultLimit} sessions in this workspace. Narrow your query.`;
1670
- 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.";
1671
1781
  }
1672
1782
  const handleDropSession = async (sessionId, targetLane) => {
1673
1783
  setActiveDragSourceLane(void 0);
@@ -1776,6 +1886,7 @@ window.__ModuleLoader__.load({
1776
1886
  placeholder: "Search sessions...",
1777
1887
  value: searchQuery,
1778
1888
  onChange: (e) => setSearchQuery(e.target.value),
1889
+ onKeyDown: handleSearchKeyDown,
1779
1890
  "aria-label": "Search sessions"
1780
1891
  })
1781
1892
  })
@@ -1786,63 +1897,73 @@ window.__ModuleLoader__.load({
1786
1897
  role: "status",
1787
1898
  children: searchMessage
1788
1899
  }),
1789
- /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1900
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1790
1901
  className: "dsh-kanban-scroll",
1791
1902
  "aria-busy": query !== "" && searchResult === void 0,
1792
- children: [
1793
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSection, {
1794
- lane: "todo",
1795
- title: "To Do",
1796
- sessions: displayedPartitioned.todo,
1797
- selectedSessionId: currentSessionId,
1798
- isPreparing: isPreparingTask,
1799
- activeDragSourceLane,
1800
- getAlert: board.getAlert,
1801
- onSelect: selectSession,
1802
- onDropSession: handleDropSession,
1803
- onDragStart: handleDragStart,
1804
- onDragEnd: handleDragEnd,
1805
- onSubmitPrepare: handlePrepareTask,
1806
- onCancelPrepare: () => setIsPreparingTask(false)
1807
- }),
1808
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSection, {
1809
- lane: "active",
1810
- title: "Active",
1811
- sessions: displayedPartitioned.active,
1812
- selectedSessionId: currentSessionId,
1813
- activeDragSourceLane,
1814
- getAlert: board.getAlert,
1815
- onSelect: selectSession,
1816
- onDropSession: handleDropSession,
1817
- onDragStart: handleDragStart,
1818
- onDragEnd: handleDragEnd
1819
- }),
1820
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSection, {
1821
- lane: "review",
1822
- title: "Review",
1823
- sessions: displayedPartitioned.review,
1824
- selectedSessionId: currentSessionId,
1825
- activeDragSourceLane,
1826
- getAlert: board.getAlert,
1827
- onSelect: selectSession,
1828
- onDropSession: handleDropSession,
1829
- onDragStart: handleDragStart,
1830
- onDragEnd: handleDragEnd
1831
- }),
1832
- /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanSection, {
1833
- lane: "done",
1834
- title: "Done",
1835
- sessions: displayedPartitioned.done,
1836
- selectedSessionId: currentSessionId,
1837
- activeDragSourceLane,
1838
- getAlert: board.getAlert,
1839
- onSelect: selectSession,
1840
- onDropSession: handleDropSession,
1841
- onDragStart: handleDragStart,
1842
- onDragEnd: handleDragEnd,
1843
- onTogglePin: handleTogglePin
1844
- })
1845
- ]
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
+ })
1846
1967
  }),
1847
1968
  activeDragSourceLane !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1848
1969
  className: `dsh-kanban-recycle-bin ${isRecycleOver ? "is-drag-over" : ""}`,
@@ -1864,6 +1985,39 @@ window.__ModuleLoader__.load({
1864
1985
  ]
1865
1986
  });
1866
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
+ }
1867
2021
  // src/client/KanbanPaneStatus.tsx
1868
2022
  /**
1869
2023
  * Purpose: Render the sidebar's Kanban lane and alert indicator in a split pane.
@@ -1890,6 +2044,26 @@ window.__ModuleLoader__.load({
1890
2044
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanStatusDot, { state: alert === void 0 ? lane : "alert" })
1891
2045
  });
1892
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
+ }
1893
2067
  // src/client/KanbanTransitionDropdown.tsx
1894
2068
  function formatLaneLabel(lane, record) {
1895
2069
  if (lane === "active") return "In Progress";
@@ -1970,7 +2144,7 @@ window.__ModuleLoader__.load({
1970
2144
  * - Outputs: Rendered JSX element with an accessible trigger button and transition popover menu.
1971
2145
  * - Throws / Errors: Never throws; transition command failures are handled by callers.
1972
2146
  */
1973
- function KanbanTransitionDropdown({ sessionId, useSession, useSessions, holdSession, unholdSession, markDone, reopen, startPreparedTask }) {
2147
+ function KanbanTransitionDropdown({ sessionId, useSession, useSessions, holdSession, unholdSession, markDone, reopen, closePane, startPreparedTask }) {
1974
2148
  const [open, setOpen] = (0, react.useState)(false);
1975
2149
  const isRunning = useSession((s) => s.running);
1976
2150
  const isBlank = useSession((s) => s.blank);
@@ -1986,7 +2160,7 @@ window.__ModuleLoader__.load({
1986
2160
  links: []
1987
2161
  }, hasPendingInteraction);
1988
2162
  const laneLabel = formatLaneLabel(lane, record);
1989
- const items = (0, react.useMemo)(() => {
2163
+ const laneItems = (0, react.useMemo)(() => {
1990
2164
  if (lane === "active") return [];
1991
2165
  if (lane === "review") return [{
1992
2166
  id: "done",
@@ -2029,6 +2203,20 @@ window.__ModuleLoader__.load({
2029
2203
  }];
2030
2204
  return [];
2031
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
+ ];
2032
2220
  if (summary?.origin === "subagent") return null;
2033
2221
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
2034
2222
  open: open && !isRunning,
@@ -2043,6 +2231,7 @@ window.__ModuleLoader__.load({
2043
2231
  if (id === "hold") holdSession(sessionId);
2044
2232
  else if (id === "done") markDone(sessionId);
2045
2233
  else if (id === "reopen") reopen(sessionId);
2234
+ else if (id === "close") closePane(sessionId);
2046
2235
  else if (id === "resume") {
2047
2236
  if (isBlank && record?.prompt) startPreparedTask(sessionId, record.prompt);
2048
2237
  else unholdSession(sessionId);
@@ -2378,6 +2567,139 @@ window.__ModuleLoader__.load({
2378
2567
  color: var(--dsw-alias-label-secondary, #64748b);
2379
2568
  }
2380
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
+
2381
2703
  .dsh-kanban-scroll {
2382
2704
  flex: 1;
2383
2705
  overflow-y: auto;
@@ -3808,6 +4130,7 @@ window.__ModuleLoader__.load({
3808
4130
  splitCtx.effect(() => splitCtx.slots.inject("split.subagent.status", () => splitCtx.slots.register({ name: "split.subagent.status" }, KanbanStatusDot)), "kanban: split subagent status");
3809
4131
  }
3810
4132
  });
4133
+ const retainSession = (id) => sessions.retain(id, { source: "kanbanPreview" });
3811
4134
  const createKanbanProps = (activeSessionId, openSession) => ({
3812
4135
  sessionsList: sessions.list,
3813
4136
  workspacesList: workspaces.list,
@@ -3815,6 +4138,7 @@ window.__ModuleLoader__.load({
3815
4138
  currentSessionId: activeSessionId ?? getActiveSessionId(),
3816
4139
  searchSessions,
3817
4140
  searchResultLimit: 20,
4141
+ retainSession,
3818
4142
  selectPanel: (id) => ctx.layout.selectPanel(id),
3819
4143
  refreshProjections: (id) => sessions.refreshProjections(id),
3820
4144
  startTask: async (workspaceId) => {
@@ -3958,9 +4282,14 @@ window.__ModuleLoader__.load({
3958
4282
  return ctx.slots.inject("main", () => ctx.slots.register({
3959
4283
  name: "main",
3960
4284
  key: "kanban",
4285
+ children: { "kanban.preview": {
4286
+ kind: "single",
4287
+ scope: "session"
4288
+ } },
3961
4289
  inject: () => createKanbanProps(void 0, navigation.maximizeSession)
3962
- }, KanbanPane));
4290
+ }, KanbanMain));
3963
4291
  }, "kanban: main view");
4292
+ ctx.effect(() => ctx.slots.inject("main", () => ctx.slots.register({ name: "kanban.preview" }, KanbanSessionPreview)), "kanban: session preview");
3964
4293
  ctx.effect(() => {
3965
4294
  const kanbanActions = createKanbanProps(void 0, navigation.openSession);
3966
4295
  return ctx.slots.inject("conversation.input.left", () => ctx.slots.register({
@@ -3972,6 +4301,7 @@ window.__ModuleLoader__.load({
3972
4301
  unholdSession: kanbanActions.unholdSession,
3973
4302
  markDone: kanbanActions.markDone,
3974
4303
  reopen: kanbanActions.reopen,
4304
+ closePane: navigation.removeSession,
3975
4305
  startPreparedTask: kanbanActions.startPreparedTask
3976
4306
  })
3977
4307
  }, KanbanTransitionDropdown));