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

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 ADDED
@@ -0,0 +1,4089 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "@lukstei/dsh-client-kanban",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ require("@deepseek-ai/cordis");
8
+ let zod = require("zod");
9
+ let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
10
+ let react = require("react");
11
+ let react_jsx_runtime = require("react/jsx-runtime");
12
+ // ../../node_modules/.pnpm/@deepseek-ai+dsh-typert-protocol@0.2.2-rc.5_@deepseek-ai+cordis@4.1.0/node_modules/@deepseek-ai/dsh-typert-protocol/lib/index.js
13
+ /** Lazy assembly of generated Remote definitions using caller-supplied Zod; no runtime imports. */
14
+ /**
15
+ * Retain one generated definition per endpoint without constructing parsers or projections.
16
+ * The class instance builds its shared descriptor/method index on first access;
17
+ * input schemas and JSON Schema projections are cached only when requested.
18
+ * @param spec - compiler-produced method facts and Zod factories.
19
+ * @param zod - the generated artifact's Zod runtime for named-input parsers.
20
+ * @returns a lazy, mountable info instance with no registration or transport effects.
21
+ */
22
+ function createTypertRemoteInfo(spec, zod) {
23
+ return new RemoteInfo(spec, zod);
24
+ }
25
+ var RemoteInfo = class {
26
+ spec;
27
+ zod;
28
+ index;
29
+ constructor(spec, zod) {
30
+ this.spec = spec;
31
+ this.zod = zod;
32
+ }
33
+ get package() {
34
+ return this.spec.package;
35
+ }
36
+ get descriptors() {
37
+ return this.resolve().descriptors;
38
+ }
39
+ get methods() {
40
+ return this.resolve().methods;
41
+ }
42
+ resolve() {
43
+ if (this.index !== void 0) return this.index;
44
+ const zod = this.zod;
45
+ const descriptors = [];
46
+ const methods = Object.create(null);
47
+ for (const [endpoint, definition] of Object.entries(this.spec.methods)) {
48
+ const separator = endpoint.indexOf("/");
49
+ const namespace = endpoint.slice(0, separator);
50
+ const method = endpoint.slice(separator + 1);
51
+ const parameters = definition.parameters.map((parameter) => ({
52
+ ...parameter,
53
+ wire: parameter.wire ?? parameter.name
54
+ }));
55
+ const descriptor = {
56
+ ...definition,
57
+ id: `${this.spec.package}#${endpoint}`,
58
+ namespace,
59
+ method,
60
+ parameters,
61
+ result: definition.result.description === void 0 ? definition.result : new ResultValue(definition.result)
62
+ };
63
+ if (definition.invocation.kind === "direct") {
64
+ const inputs = [];
65
+ methods[endpoint] = Object.assign(descriptor, {
66
+ input(options) {
67
+ const strict = options?.strict === true;
68
+ return inputs[strict ? 1 : 0] ??= new NamedInput(parameters, strict, zod);
69
+ },
70
+ invoke(remote, input, signal) {
71
+ const named = input;
72
+ const values = parameters.map((parameter) => named[parameter.wire]);
73
+ if (definition.cancellation !== void 0) values.push(signal);
74
+ const receiver = Reflect.get(remote, namespace);
75
+ return Reflect.get(receiver, method).apply(receiver, values);
76
+ }
77
+ });
78
+ }
79
+ descriptors.push(descriptor);
80
+ }
81
+ return this.index = {
82
+ descriptors,
83
+ methods
84
+ };
85
+ }
86
+ };
87
+ function optional(parameter) {
88
+ return parameter.source === "json" && parameter.acceptsUndefined === true;
89
+ }
90
+ var NamedInput = class {
91
+ parameters;
92
+ strict;
93
+ zod;
94
+ schema;
95
+ projection;
96
+ constructor(parameters, strict, zod) {
97
+ this.parameters = parameters;
98
+ this.strict = strict;
99
+ this.zod = zod;
100
+ }
101
+ codec(parameter) {
102
+ return this.strict ? parameter.strictCodec : parameter.codec;
103
+ }
104
+ create = () => this.schema ??= this.zod.strictObject(Object.fromEntries(this.parameters.map((parameter) => {
105
+ const value = this.codec(parameter).create();
106
+ return [parameter.wire, optional(parameter) ? value.optional() : value.nonoptional()];
107
+ })));
108
+ get jsonSchema() {
109
+ return this.project().jsonSchema;
110
+ }
111
+ get jsonSchemaError() {
112
+ return this.project().jsonSchemaError;
113
+ }
114
+ project() {
115
+ if (this.projection !== void 0) return this.projection;
116
+ const unavailable = this.parameters.find((parameter) => this.codec(parameter).jsonSchema === void 0);
117
+ if (unavailable !== void 0) return this.projection = { jsonSchemaError: this.codec(unavailable).jsonSchemaError ?? `No JSON Schema for parameter ${unavailable.wire}` };
118
+ return this.projection = { jsonSchema: {
119
+ type: "object",
120
+ properties: Object.fromEntries(this.parameters.map((parameter) => [parameter.wire, {
121
+ ...this.codec(parameter).jsonSchema,
122
+ ...parameter.description === void 0 ? {} : { description: parameter.description }
123
+ }])),
124
+ required: this.parameters.filter((parameter) => !optional(parameter)).map((parameter) => parameter.wire),
125
+ additionalProperties: false
126
+ } };
127
+ }
128
+ };
129
+ var ResultValue = class {
130
+ spec;
131
+ projection;
132
+ constructor(spec) {
133
+ this.spec = spec;
134
+ }
135
+ get mode() {
136
+ return this.spec.mode;
137
+ }
138
+ get typeSymbol() {
139
+ return this.spec.typeSymbol;
140
+ }
141
+ get create() {
142
+ return this.spec.create;
143
+ }
144
+ get decode() {
145
+ return this.spec.decode;
146
+ }
147
+ get encode() {
148
+ return this.spec.encode;
149
+ }
150
+ get description() {
151
+ return this.spec.description;
152
+ }
153
+ get jsonSchemaError() {
154
+ return this.spec.jsonSchemaError;
155
+ }
156
+ get jsonSchema() {
157
+ if (this.projection === void 0) {
158
+ const schema = this.spec.jsonSchema;
159
+ this.projection = { value: schema === void 0 ? void 0 : {
160
+ ...schema,
161
+ description: this.spec.description
162
+ } };
163
+ }
164
+ return this.projection.value;
165
+ }
166
+ };
167
+ // src/search.ts
168
+ const sessionIdSchema = zod.z.string().min(1).transform((id) => id);
169
+ const searchRequestSchema = zod.z.strictObject({
170
+ query: zod.z.string().trim().min(1),
171
+ sessionIds: zod.z.array(sessionIdSchema)
172
+ });
173
+ const searchResultSchema = zod.z.strictObject({
174
+ items: zod.z.array(zod.z.strictObject({
175
+ sessionId: sessionIdSchema,
176
+ snippet: zod.z.string()
177
+ })),
178
+ hasMore: zod.z.boolean()
179
+ });
180
+ const requestCodec = {
181
+ mode: "strict",
182
+ typeSymbol: "dsh-client-kanban#searchRequest",
183
+ create: () => searchRequestSchema
184
+ };
185
+ const searchRemote = createTypertRemoteInfo({
186
+ package: "dsh-client-kanban",
187
+ methods: { "kanban/search": {
188
+ service: "kanbanSearch",
189
+ invocation: { kind: "direct" },
190
+ parameters: [{
191
+ name: "request",
192
+ source: "json",
193
+ codec: requestCodec,
194
+ strictCodec: requestCodec
195
+ }],
196
+ cancellation: { parameter: "signal" },
197
+ result: {
198
+ mode: "strict",
199
+ typeSymbol: "dsh-client-kanban#searchResult",
200
+ create: () => searchResultSchema
201
+ }
202
+ } }
203
+ }, zod.z);
204
+ // src/client/KanbanIcon.tsx
205
+ function KanbanIcon({ size = 18, strokeWidth = 1 }) {
206
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
207
+ width: size,
208
+ height: size,
209
+ viewBox: "0 0 24 24",
210
+ fill: "none",
211
+ stroke: "currentColor",
212
+ strokeWidth,
213
+ strokeLinecap: "round",
214
+ strokeLinejoin: "round",
215
+ "aria-hidden": "true",
216
+ children: [
217
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("rect", {
218
+ x: "3",
219
+ y: "3",
220
+ width: "18",
221
+ height: "18",
222
+ rx: "2"
223
+ }),
224
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
225
+ x1: "9",
226
+ y1: "3",
227
+ x2: "9",
228
+ y2: "21"
229
+ }),
230
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("line", {
231
+ x1: "15",
232
+ y1: "3",
233
+ x2: "15",
234
+ y2: "21"
235
+ })
236
+ ]
237
+ });
238
+ }
239
+ // src/client/KanbanStatusDot.tsx
240
+ /**
241
+ * Purpose: Paint the shared six-pixel session status indicator.
242
+ * Contract:
243
+ * - Inputs: A resolved lane or alert state; the caller owns its meaning and label.
244
+ * - Outputs: A decorative dot using the shared status colors and animation.
245
+ * - Throws / Errors: None.
246
+ */
247
+ function KanbanStatusDot({ state }) {
248
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
249
+ className: `dsh-kanban-badge-dot is-${state}`,
250
+ "aria-hidden": "true"
251
+ });
252
+ }
253
+ // src/client/SessionLinks.tsx
254
+ /**
255
+ * Purpose: Show collected session links in a shared icon-triggered popover.
256
+ * Contract:
257
+ * - Inputs: Validated projected links sorted by priority and collection order for ties.
258
+ * - Outputs: An accessible link menu, hidden for an empty collection.
259
+ * - Throws / Errors: Browser navigation errors propagate.
260
+ */
261
+ function SessionLinks({ links }) {
262
+ const [open, setOpen] = (0, react.useState)(false);
263
+ return links.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
264
+ open,
265
+ portal: true,
266
+ compact: true,
267
+ align: "end",
268
+ className: "dsh-session-links",
269
+ listClassName: "dsh-session-links-menu",
270
+ onClose: () => setOpen(false),
271
+ onSelect: (url) => {
272
+ window.open(url, "_blank", "noopener,noreferrer");
273
+ setOpen(false);
274
+ },
275
+ items: links.map((link) => ({
276
+ id: link.url,
277
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
278
+ className: "dsh-session-link",
279
+ children: link.label
280
+ })
281
+ })),
282
+ anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
283
+ type: "button",
284
+ className: "dsh-inflight-btn-action dsh-session-links-trigger",
285
+ "aria-label": `Session links (${links.length})`,
286
+ title: "Session links",
287
+ "aria-haspopup": "menu",
288
+ "aria-expanded": open,
289
+ onClick: (event) => {
290
+ event.stopPropagation();
291
+ setOpen(!open);
292
+ },
293
+ onDragStart: (event) => {
294
+ event.preventDefault();
295
+ event.stopPropagation();
296
+ },
297
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
298
+ width: "14",
299
+ height: "14",
300
+ viewBox: "0 0 24 24",
301
+ fill: "none",
302
+ stroke: "currentColor",
303
+ strokeWidth: "2",
304
+ strokeLinecap: "round",
305
+ strokeLinejoin: "round",
306
+ "aria-hidden": "true",
307
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71" })]
308
+ })
309
+ })
310
+ });
311
+ }
312
+ // src/client/sidebar-mode.ts
313
+ const STORAGE_KEY = "dsh-sidebar-view-mode";
314
+ var SidebarModeStore = class {
315
+ mode;
316
+ listeners = /* @__PURE__ */ new Set();
317
+ constructor() {
318
+ try {
319
+ const stored = typeof localStorage !== "undefined" ? localStorage.getItem(STORAGE_KEY) : null;
320
+ this.mode = stored === "kanban" ? "kanban" : "workspaces";
321
+ } catch {
322
+ this.mode = "workspaces";
323
+ }
324
+ }
325
+ /**
326
+ * Purpose: Read current sidebar view mode snapshot.
327
+ * Contract:
328
+ * - Inputs: None.
329
+ * - Outputs: Current SidebarViewMode ('workspaces' or 'kanban').
330
+ * - Throws / Errors: Never throws.
331
+ */
332
+ getSnapshot = () => {
333
+ return this.mode;
334
+ };
335
+ /**
336
+ * Purpose: Switch sidebar view mode and notify subscribers.
337
+ * Contract:
338
+ * - Inputs: New SidebarViewMode.
339
+ * - Outputs: void.
340
+ * - Throws / Errors: Never throws.
341
+ */
342
+ setMode = (nextMode) => {
343
+ if (this.mode === nextMode) return;
344
+ this.mode = nextMode;
345
+ try {
346
+ if (typeof localStorage !== "undefined") localStorage.setItem(STORAGE_KEY, nextMode);
347
+ } catch {}
348
+ for (const listener of this.listeners) listener();
349
+ };
350
+ /**
351
+ * Purpose: Subscribe to sidebar view mode changes.
352
+ * Contract:
353
+ * - Inputs: Callback listener function.
354
+ * - Outputs: Unsubscribe function.
355
+ * - Throws / Errors: Never throws.
356
+ */
357
+ subscribe = (listener) => {
358
+ this.listeners.add(listener);
359
+ return () => {
360
+ this.listeners.delete(listener);
361
+ };
362
+ };
363
+ };
364
+ const sidebarModeStore = new SidebarModeStore();
365
+ // ../../node_modules/.pnpm/@deepseek-ai+dsh-util-workspace-path@0.2.2-rc.5_@deepseek-ai+cordis@4.1.0/node_modules/@deepseek-ai/dsh-util-workspace-path/lib/index.js
366
+ /**
367
+ * Read the final non-empty segment of a Workspace path for display.
368
+ * Workspace-label surfaces use this helper instead of deriving another basename.
369
+ * @param path - Workspace directory path using POSIX or Windows separators.
370
+ * @returns the final segment, or an empty string for a separator-only path.
371
+ */
372
+ function workspaceTitleOf(path) {
373
+ const trimmed = path.replace(/[/\\]+$/, "");
374
+ const separator = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
375
+ return trimmed.slice(separator + 1);
376
+ }
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
+ // src/client/store.ts
423
+ /**
424
+ * Purpose: Determine whether a session belongs to the Kanban board and has not expired.
425
+ * Contract:
426
+ * - Inputs: KanbanRecord or null/undefined, optional session summary with blank status and origin, and reference timestamp (defaults to Date.now()).
427
+ * - Outputs: True if session is initialized, not expired in Done (> 7 days), and not an unstarted empty session.
428
+ * - Throws / Errors: Never throws.
429
+ */
430
+ function isSessionVisibleInKanban(record, session, now = Date.now()) {
431
+ if (!record) return false;
432
+ if (session?.origin === "subagent") return false;
433
+ if (record.doneAt !== void 0 && record.pinnedAt === void 0 && now - record.doneAt > 6048e5) return false;
434
+ if (session !== void 0 && session.blank && !record.prompt && record.heldAt === void 0 && record.reviewAt === void 0 && record.doneAt === void 0) return false;
435
+ return true;
436
+ }
437
+ /**
438
+ * Purpose: Determine whether a session belongs to a specified workspace by ID or directory path.
439
+ * Contract:
440
+ * - Inputs: Session summary with id and cwd, and workspace with sessionIds and path.
441
+ * - Outputs: True if session id is in workspace or cwd matches workspace path.
442
+ * - Throws / Errors: Never throws.
443
+ */
444
+ function isSessionInWorkspace(session, workspace) {
445
+ return workspace.sessionIds.includes(session.id) || session.cwd !== void 0 && session.cwd === workspace.path;
446
+ }
447
+ /**
448
+ * Purpose: Determine whether a session is relevant to the In-Flight Sidebar without requiring its Kanban projection.
449
+ * Contract:
450
+ * - Inputs: Session ID, summary (running and retainedBy flags), and context containing active ID, split IDs, and session status.
451
+ * - Outputs: True if the session is currently active, running, awaiting user attention, or displayed in split view.
452
+ * - Throws / Errors: Never throws.
453
+ */
454
+ function isSessionRelevantToSidebar(id, summary, context) {
455
+ if (id === context.activeSessionId || (summary?.retainedBy?.mainView ?? 0) > 0) return true;
456
+ if (summary?.running || context.sessionStatus?.get(id)?.running === true || context.activeSubagentParentIds?.has(id) === true) return true;
457
+ if (context.sessionStatus?.get(id)?.pendingInteraction !== void 0) return true;
458
+ if (context.splitSessionIds?.includes(id) === true) return true;
459
+ return false;
460
+ }
461
+ /**
462
+ * Purpose: Determine whether a session is eligible for Kanban projection hydration.
463
+ * Contract:
464
+ * - Inputs: Session summary with running and updatedAt (or undefined), optional timestamp.
465
+ * - Outputs: True if session exists and is either running or updated within ONE_WEEK_MS.
466
+ * - Throws / Errors: Never throws.
467
+ */
468
+ function isSessionEligibleForHydration(summary, now = Date.now()) {
469
+ if (!summary) return false;
470
+ return Boolean(summary.running || now - summary.updatedAt <= 6048e5);
471
+ }
472
+ /**
473
+ * Purpose: Retrieve effective recency for a session, prioritizing Kanban lastActivityAt over session.updatedAt.
474
+ * Contract:
475
+ * - Inputs: SessionSummary or a session subset with updatedAt and optional projectionValues.
476
+ * - Outputs: Highest timestamp representing session activity in milliseconds.
477
+ * - Throws / Errors: Never throws.
478
+ */
479
+ function getSessionRecency(session) {
480
+ const record = session.projectionValues?.kanban;
481
+ return Math.max(session.updatedAt, record?.lastActivityAt ?? 0);
482
+ }
483
+ /**
484
+ * Purpose: Sort workspaces descending by the recency of their most recently updated session.
485
+ * Contract:
486
+ * - Inputs: Readonly array of workspaces and a record of sessions by ID.
487
+ * - Outputs: New array of workspaces sorted descending by session recency, then updatedAt, then title/path.
488
+ * - Throws / Errors: Never throws.
489
+ */
490
+ function sortWorkspacesByRecency(workspaces, sessionsById) {
491
+ const recencyMap = /* @__PURE__ */ new Map();
492
+ for (const [id, session] of Object.entries(sessionsById)) {
493
+ if (!session) continue;
494
+ for (const ws of workspaces) if (isSessionInWorkspace({
495
+ id,
496
+ cwd: session.cwd
497
+ }, ws)) {
498
+ const current = recencyMap.get(ws.workspaceId) ?? 0;
499
+ const sessionRecency = getSessionRecency(session);
500
+ if (sessionRecency > current) recencyMap.set(ws.workspaceId, sessionRecency);
501
+ }
502
+ }
503
+ return [...workspaces].sort((a, b) => {
504
+ const recDiff = (recencyMap.get(b.workspaceId) ?? 0) - (recencyMap.get(a.workspaceId) ?? 0);
505
+ if (recDiff !== 0) return recDiff;
506
+ const fallbackA = a.updatedAt ? Date.parse(a.updatedAt) || 0 : 0;
507
+ const fallbackB = b.updatedAt ? Date.parse(b.updatedAt) || 0 : 0;
508
+ if (fallbackB !== fallbackA) return fallbackB - fallbackA;
509
+ return (a.title || a.path).localeCompare(b.title || b.path);
510
+ });
511
+ }
512
+ /**
513
+ * Purpose: Classify a live session into one of the four Kanban lanes.
514
+ * Contract:
515
+ * - Inputs: Session running/blank status, KanbanRecord, optional boolean indicating pending user interaction, and optional boolean indicating active subagent.
516
+ * - Outputs: "review" if pending interaction, "active" if running or has active subagent, "done" if completed, "review" if explicitly placed there, "todo" if blank or held, otherwise "review".
517
+ * - Throws / Errors: Never throws.
518
+ */
519
+ function classifyKanbanSession(session, record, hasPendingInteraction = false, hasActiveSubagent = false) {
520
+ if (hasPendingInteraction) return "review";
521
+ if (session.running || hasActiveSubagent) return "active";
522
+ if (record.doneAt !== void 0) return "done";
523
+ if (record.reviewAt !== void 0) return "review";
524
+ if (session.blank || record.heldAt !== void 0) return "todo";
525
+ return "review";
526
+ }
527
+ /**
528
+ * Purpose: Determine whether a Kanban session draft should be seeded into localStorage.
529
+ * Contract:
530
+ * - Inputs: Session summary (running and blank flags), KanbanRecord, and optional running flag from sessionStatus.
531
+ * - Outputs: True only if the session is unstarted (blank, not running, not done, and has a prompt).
532
+ * - Throws / Errors: Never throws.
533
+ */
534
+ function shouldSeedKanbanDraft(session, record, isRunning = false) {
535
+ if (!session || !record?.prompt) return false;
536
+ if (record.doneAt !== void 0) return false;
537
+ if (session.running || isRunning) return false;
538
+ return session.blank;
539
+ }
540
+ /**
541
+ * Purpose: Determine whether a session requires immediate user attention (question, permission request, or non-finish stop reason).
542
+ * Contract:
543
+ * - Inputs: Optional SessionStatus for the session, and optional session summary.
544
+ * - Outputs: KanbanSessionAlert ("question" | "permission" | "error") if urgent action is required, or undefined.
545
+ * - Throws / Errors: Never throws.
546
+ */
547
+ function getKanbanSessionAlert(status, _session) {
548
+ if (status && status.pendingInteraction) {
549
+ const interaction = status.pendingInteraction;
550
+ const hasAcpPermissionQuestion = interaction.questions?.some((q) => q.id?.startsWith("acp-permission:"));
551
+ if (interaction.kind === "approval" || interaction.key?.startsWith("acp-permission:") || hasAcpPermissionQuestion) return "permission";
552
+ if (interaction.kind === "question") return "question";
553
+ if (interaction.kind !== "plan-review") return "error";
554
+ }
555
+ }
556
+ /**
557
+ * Purpose: Format a concise user-facing label for a KanbanSessionAlert.
558
+ * Contract:
559
+ * - Inputs: KanbanSessionAlert ("question" | "permission" | "error").
560
+ * - Outputs: Formatted label string ("Question", "Permission", or "Stopped").
561
+ * - Throws / Errors: Never throws.
562
+ */
563
+ function formatKanbanAlertLabel(alert) {
564
+ switch (alert) {
565
+ case "permission": return "Permission";
566
+ case "question": return "Question";
567
+ case "error": return "Stopped";
568
+ }
569
+ }
570
+ /**
571
+ * Purpose: Resolve the display title for a session in Kanban views (sidebar and board cards) matching native DSH fallback behavior.
572
+ * Contract:
573
+ * - Inputs: Session summary (title, blank, displayTitle, cwd) and optional workspace/group title.
574
+ * - Outputs: Explicit session title if set; "New Session" for blank sessions; "Untitled session" if displayTitle matches workspace/cwd fallback or is unset; otherwise displayTitle.
575
+ * - Throws / Errors: Never throws.
576
+ */
577
+ function getKanbanSessionTitle(session, workspaceTitle) {
578
+ if (session.title) return session.title;
579
+ if (session.blank) return "New Session";
580
+ const cwdBase = session.cwd ? workspaceTitleOf(session.cwd) : void 0;
581
+ if (!session.displayTitle || session.displayTitle === "Untitled Task" || session.displayTitle === "Untitled session" || workspaceTitle !== void 0 && session.displayTitle === workspaceTitle || cwdBase !== void 0 && session.displayTitle === cwdBase) return "Untitled session";
582
+ return session.displayTitle;
583
+ }
584
+ /**
585
+ * Purpose: Compare two session summaries by priority: alerts first, then running, then recency.
586
+ * Contract:
587
+ * - Inputs: Two SessionSummary objects a and b, optional alert map or resolver, and optional running map or resolver.
588
+ * - Outputs: Negative if a outranks b, positive if b outranks a, 0 if equal.
589
+ * - Throws / Errors: Never throws.
590
+ */
591
+ function compareKanbanSessionPriority(a, b, alertMap, runningMap) {
592
+ const alertA = alertMap ? alertMap.get(a.id) : void 0;
593
+ const alertB = alertMap ? alertMap.get(b.id) : void 0;
594
+ if (alertA !== void 0 && alertB === void 0) return -1;
595
+ if (alertA === void 0 && alertB !== void 0) return 1;
596
+ const runningA = runningMap ? runningMap.get(a.id) ?? false : a.running;
597
+ const runningB = runningMap ? runningMap.get(b.id) ?? false : b.running;
598
+ if (runningA && !runningB) return -1;
599
+ if (!runningA && runningB) return 1;
600
+ return getSessionRecency(b) - getSessionRecency(a);
601
+ }
602
+ /**
603
+ * Purpose: Determine whether moving a session between two Kanban lanes is permitted.
604
+ * Contract:
605
+ * - Inputs: Source KanbanLane and target KanbanLane.
606
+ * - Outputs: True for distinct stopped lanes and "todo" -> "active"; false for all other moves.
607
+ * - Throws / Errors: Never throws.
608
+ */
609
+ function isKanbanTransitionAllowed(sourceLane, targetLane) {
610
+ return sourceLane !== targetLane && sourceLane !== "active" && (targetLane !== "active" || sourceLane === "todo");
611
+ }
612
+ /**
613
+ * Purpose: Extract the set of parent session IDs that currently have active running subagents.
614
+ * Contract:
615
+ * - Inputs: Record or dictionary of session summaries keyed by session ID.
616
+ * - Outputs: Set of parent SessionIds whose child subagent sessions are running.
617
+ * - Throws / Errors: Never throws.
618
+ */
619
+ function extractActiveSubagentParentIds(sessionsById) {
620
+ const activeSubagentParentIds = /* @__PURE__ */ new Set();
621
+ for (const summary of Object.values(sessionsById)) if (summary?.origin === "subagent" && summary.parentId !== void 0 && summary.running) activeSubagentParentIds.add(summary.parentId);
622
+ return activeSubagentParentIds;
623
+ }
624
+ /**
625
+ * Purpose: Group session summaries by workspace according to workspace memberships and directory matching.
626
+ * Contract:
627
+ * - Inputs: Readonly array of workspaces, readonly array of session summaries, and optional sort comparator.
628
+ * - Outputs: Readonly array of WorkspaceGroup items with sessions sorted by the comparator (or descending by updatedAt), with loose sessions appended last.
629
+ * - Throws / Errors: Never throws.
630
+ */
631
+ function groupSessionsByWorkspace(workspaces, sessions, comparator) {
632
+ const claimed = /* @__PURE__ */ new Set();
633
+ const groups = [];
634
+ const sortFn = comparator ?? ((a, b) => getSessionRecency(b) - getSessionRecency(a));
635
+ for (const ws of workspaces) {
636
+ const wsSessions = [];
637
+ for (const session of sessions) if (isSessionInWorkspace(session, ws)) {
638
+ wsSessions.push(session);
639
+ claimed.add(session.id);
640
+ }
641
+ wsSessions.sort(sortFn);
642
+ groups.push({
643
+ workspaceId: ws.workspaceId,
644
+ title: ws.title || ws.path,
645
+ path: ws.path,
646
+ sessions: wsSessions
647
+ });
648
+ }
649
+ const unclaimed = sessions.filter((s) => !claimed.has(s.id)).sort(sortFn);
650
+ if (unclaimed.length > 0) groups.push({
651
+ workspaceId: "ungrouped",
652
+ title: "Other Sessions",
653
+ sessions: unclaimed
654
+ });
655
+ return groups;
656
+ }
657
+ /**
658
+ * Purpose: Derive complete reactive Kanban board state from session and workspace snapshots.
659
+ * Contract:
660
+ * - Inputs: Session list snapshot, workspaces list, optional session status snapshot, optional timestamp now, and optional split pane session ids.
661
+ * - Outputs: KanbanBoard interface containing active session, sorted workspaces, counts, sidebar groupings, lane classifier, and partitioner.
662
+ * - Throws / Errors: Never throws.
663
+ */
664
+ function deriveKanbanBoard(sessionList, workspaces, sessionStatus, now = Date.now(), splitSessionIds) {
665
+ const sortedWorkspaces = sortWorkspacesByRecency(workspaces, sessionList.byId);
666
+ const activeSessionId = sessionList.ids.find((id) => {
667
+ const s = sessionList.byId[id];
668
+ return s !== void 0 && (s.retainedBy.mainView ?? 0) > 0;
669
+ });
670
+ const activeSubagentParentIds = extractActiveSubagentParentIds(sessionList.byId);
671
+ const isPendingInteraction = (id) => {
672
+ const status = sessionStatus?.get(id);
673
+ return status !== void 0 && status.pendingInteraction !== void 0;
674
+ };
675
+ const visibleSummaries = [];
676
+ const laneBySessionId = /* @__PURE__ */ new Map();
677
+ const alertBySessionId = /* @__PURE__ */ new Map();
678
+ const runningBySessionId = /* @__PURE__ */ new Map();
679
+ for (const id of sessionList.ids) {
680
+ const summary = sessionList.byId[id];
681
+ if (!summary) continue;
682
+ const record = summary.projectionValues?.kanban;
683
+ if (isSessionVisibleInKanban(record, summary, now)) {
684
+ visibleSummaries.push(summary);
685
+ const lane = classifyKanbanSession(summary, record, isPendingInteraction(id), activeSubagentParentIds.has(id));
686
+ laneBySessionId.set(id, lane);
687
+ const status = sessionStatus?.get(id);
688
+ alertBySessionId.set(id, getKanbanSessionAlert(status, summary));
689
+ runningBySessionId.set(id, Boolean(summary.running || status?.running === true || activeSubagentParentIds.has(id)));
690
+ }
691
+ }
692
+ const priorityComparator = (a, b) => compareKanbanSessionPriority(a, b, alertBySessionId, runningBySessionId);
693
+ visibleSummaries.sort(priorityComparator);
694
+ const workspaceCounts = /* @__PURE__ */ new Map();
695
+ for (const ws of workspaces) workspaceCounts.set(ws.workspaceId, {
696
+ running: 0,
697
+ inReview: 0,
698
+ alerts: 0
699
+ });
700
+ let totalRunning = 0;
701
+ let totalInReview = 0;
702
+ let totalRecentInReview = 0;
703
+ let totalAlerts = 0;
704
+ for (const session of visibleSummaries) {
705
+ const lane = laneBySessionId.get(session.id);
706
+ const alert = alertBySessionId.get(session.id);
707
+ if ((lane === "active" || lane === "review") && alert !== void 0) totalAlerts += 1;
708
+ if (lane === "active") totalRunning += 1;
709
+ else if (lane === "review" && alert === void 0) {
710
+ totalInReview += 1;
711
+ if (now - getSessionRecency(session) <= 18e5) totalRecentInReview += 1;
712
+ }
713
+ if (lane === "active" || lane === "review") {
714
+ for (const ws of workspaces) if (isSessionInWorkspace(session, ws)) {
715
+ const counts = workspaceCounts.get(ws.workspaceId);
716
+ if (counts !== void 0) {
717
+ if (alert !== void 0) counts.alerts += 1;
718
+ if (lane === "active") counts.running += 1;
719
+ else if (alert === void 0) counts.inReview += 1;
720
+ }
721
+ }
722
+ }
723
+ }
724
+ const inFlightSessions = visibleSummaries.filter((session) => {
725
+ const lane = laneBySessionId.get(session.id);
726
+ return lane === "active" || lane === "review";
727
+ });
728
+ const inFlightIds = new Set(inFlightSessions.map((session) => session.id));
729
+ const splitOnlySessions = [];
730
+ for (const id of splitSessionIds ?? []) {
731
+ if (inFlightIds.has(id)) continue;
732
+ const summary = sessionList.byId[id];
733
+ if (!summary) continue;
734
+ if (summary.projectionValues?.kanban === void 0) continue;
735
+ splitOnlySessions.push(summary);
736
+ }
737
+ const sidebarSessions = [...inFlightSessions, ...splitOnlySessions];
738
+ const workspaceGroups = groupSessionsByWorkspace(sortedWorkspaces, sidebarSessions, priorityComparator).filter((group) => group.sessions.length > 0);
739
+ const getLane = (sessionId) => {
740
+ const cached = laneBySessionId.get(sessionId);
741
+ if (cached !== void 0) return cached;
742
+ const summary = sessionList.byId[sessionId];
743
+ if (!summary) return "todo";
744
+ const record = summary.projectionValues?.kanban;
745
+ if (!record) {
746
+ if (isPendingInteraction(sessionId)) return "review";
747
+ const status = sessionStatus === void 0 ? void 0 : sessionStatus.get(sessionId);
748
+ return summary.running || status !== void 0 && status.running === true || activeSubagentParentIds.has(sessionId) ? "active" : "todo";
749
+ }
750
+ return classifyKanbanSession(summary, record, isPendingInteraction(sessionId), activeSubagentParentIds.has(sessionId));
751
+ };
752
+ const partition = (workspaceId) => {
753
+ const result = {
754
+ todo: [],
755
+ active: [],
756
+ review: [],
757
+ done: []
758
+ };
759
+ let filtered;
760
+ if (workspaceId === "ungrouped") filtered = visibleSummaries.filter((s) => !sortedWorkspaces.some((ws) => isSessionInWorkspace(s, ws)));
761
+ else if (workspaceId) {
762
+ const targetWs = sortedWorkspaces.find((w) => w.workspaceId === workspaceId);
763
+ filtered = targetWs ? visibleSummaries.filter((s) => isSessionInWorkspace(s, targetWs)) : [];
764
+ } else filtered = visibleSummaries;
765
+ for (const session of filtered) result[laneBySessionId.get(session.id) ?? "todo"].push(session);
766
+ result.done.sort((a, b) => {
767
+ const aRecord = a.projectionValues?.kanban;
768
+ const bRecord = b.projectionValues?.kanban;
769
+ const aPinned = aRecord?.pinnedAt !== void 0;
770
+ if (aPinned !== (bRecord?.pinnedAt !== void 0)) return aPinned ? -1 : 1;
771
+ if (aRecord?.pinnedAt !== void 0 && bRecord?.pinnedAt !== void 0) {
772
+ const pinDiff = bRecord.pinnedAt - aRecord.pinnedAt;
773
+ if (pinDiff !== 0) return pinDiff;
774
+ }
775
+ return getSessionRecency(b) - getSessionRecency(a);
776
+ });
777
+ return result;
778
+ };
779
+ return {
780
+ activeSessionId,
781
+ sortedWorkspaces,
782
+ workspaceCounts,
783
+ totalCounts: {
784
+ running: totalRunning,
785
+ inReview: totalInReview,
786
+ recentInReview: totalRecentInReview,
787
+ alerts: totalAlerts
788
+ },
789
+ sidebarSessions,
790
+ workspaceGroups,
791
+ getLane,
792
+ getAlert: (sessionId) => getKanbanSessionAlert(sessionStatus === void 0 ? void 0 : sessionStatus.get(sessionId), sessionList.byId[sessionId]),
793
+ partition
794
+ };
795
+ }
796
+ /**
797
+ * Purpose: Format a millisecond timestamp as a human-readable relative duration string.
798
+ * Contract:
799
+ * - Inputs: Number timestamp in ms and optional reference timestamp now (defaulting to Date.now()).
800
+ * - Outputs: Short relative time string (e.g. \"just now\", \"5m ago\", \"2h ago\", \"3d ago\").
801
+ * - Throws / Errors: Never throws.
802
+ */
803
+ function formatRelativeTime(timestamp, now = Date.now()) {
804
+ const diffSec = Math.max(0, Math.floor((now - timestamp) / 1e3));
805
+ if (diffSec < 60) return "just now";
806
+ const diffMin = Math.floor(diffSec / 60);
807
+ if (diffMin < 60) return `${diffMin}m ago`;
808
+ const diffHours = Math.floor(diffMin / 60);
809
+ if (diffHours < 24) return `${diffHours}h ago`;
810
+ return `${Math.floor(diffHours / 24)}d ago`;
811
+ }
812
+ const KANBAN_SELECTED_WORKSPACE_KEY = "dsh-kanban-selected-workspace";
813
+ /**
814
+ * Purpose: Retrieve the user's selected workspace ID for Kanban filtering from local storage.
815
+ * Contract:
816
+ * - Inputs: None.
817
+ * - Outputs: Workspace ID string if stored, otherwise null.
818
+ * - Throws / Errors: Never throws.
819
+ */
820
+ function getStoredKanbanWorkspace() {
821
+ if (typeof localStorage === "undefined") return null;
822
+ try {
823
+ return localStorage.getItem(KANBAN_SELECTED_WORKSPACE_KEY);
824
+ } catch {
825
+ return null;
826
+ }
827
+ }
828
+ /**
829
+ * Purpose: Persist the user's selected workspace ID for Kanban filtering and notify active views.
830
+ * Contract:
831
+ * - Inputs: Workspace ID string.
832
+ * - Outputs: void.
833
+ * - Throws / Errors: Never throws.
834
+ */
835
+ function setStoredKanbanWorkspace(workspaceId) {
836
+ if (typeof localStorage === "undefined") return;
837
+ try {
838
+ localStorage.setItem(KANBAN_SELECTED_WORKSPACE_KEY, workspaceId);
839
+ if (typeof window !== "undefined") window.dispatchEvent(new CustomEvent("dsh-kanban-workspace-change"));
840
+ } catch {}
841
+ }
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
+ // src/client/use-kanban.ts
859
+ /**
860
+ * Purpose: Subscribe to an ObservableSnapshot reactive store.
861
+ * Contract:
862
+ * - Inputs: ObservableSnapshot store.
863
+ * - Outputs: Current snapshot value T.
864
+ * - Throws / Errors: Never throws.
865
+ */
866
+ function useStore(store) {
867
+ return (0, react.useSyncExternalStore)((0, react.useCallback)((cb) => store.subscribe(cb), [store]), (0, react.useCallback)(() => store.getSnapshot(), [store]));
868
+ }
869
+ /**
870
+ * Purpose: React hook subscribing to session and workspace stores and providing derived KanbanBoard state.
871
+ * Contract:
872
+ * - Inputs: Observable snapshots for sessionsList, workspacesList, sessionStatus, optional timestamp now, and optional split pane session ids.
873
+ * - Outputs: Derived KanbanBoard model.
874
+ * - Throws / Errors: Never throws.
875
+ */
876
+ function useKanban(sessionsList, workspacesList, sessionStatus, now, splitSessionIds) {
877
+ const sessions = useStore(sessionsList);
878
+ const workspaces = useStore(workspacesList);
879
+ const status = useStore(sessionStatus);
880
+ return (0, react.useMemo)(() => deriveKanbanBoard(sessions, workspaces.items, status, now, splitSessionIds), [
881
+ sessions,
882
+ workspaces.items,
883
+ status,
884
+ now,
885
+ splitSessionIds
886
+ ]);
887
+ }
888
+ // src/client/InFlightSidebar.tsx
889
+ function IconCheck$1({ size = 14 }) {
890
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
891
+ width: size,
892
+ height: size,
893
+ viewBox: "0 0 16 16",
894
+ fill: "none",
895
+ stroke: "currentColor",
896
+ strokeWidth: "1.3",
897
+ strokeLinecap: "round",
898
+ strokeLinejoin: "round",
899
+ "aria-hidden": "true",
900
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2.25 8.5L5.49732 11.7473C5.90519 12.1552 6.57263 12.1344 6.95426 11.7018L13.75 4" })
901
+ });
902
+ }
903
+ function IconPause$1({ size = 14 }) {
904
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
905
+ width: size,
906
+ height: size,
907
+ viewBox: "0 0 16 16",
908
+ fill: "none",
909
+ stroke: "currentColor",
910
+ strokeWidth: "1.3",
911
+ "aria-hidden": "true",
912
+ children: [
913
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5Z" }),
914
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
915
+ d: "M6.5 5.5V10.5",
916
+ strokeLinecap: "round"
917
+ }),
918
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
919
+ d: "M9.5 5.5V10.5",
920
+ strokeLinecap: "round"
921
+ })
922
+ ]
923
+ });
924
+ }
925
+ function laneLabel(lane) {
926
+ switch (lane) {
927
+ case "active": return "In Progress";
928
+ case "review": return "In Review";
929
+ case "todo": return "On Hold";
930
+ case "done": return "Done";
931
+ }
932
+ }
933
+ /**
934
+ * Purpose: Render a dedicated in-flight Kanban preview in the left sidebar grouped by workspace.
935
+ * Contract:
936
+ * - Inputs: InFlightSidebarProps containing sidebar geometry (wide, expandSidebar) and injected Kanban data/actions.
937
+ * - Outputs: Rendered JSX element for the sidebar browsing region.
938
+ * - Throws / Errors: Never throws.
939
+ */
940
+ function InFlightSidebar({ wide, expandSidebar: _expandSidebar, sessionsList, workspacesList, sessionStatus, currentSessionId: _currentSessionId, selectPanel, selectSession, navigation, startTask, markDone, reopen, holdSession }) {
941
+ const [now, setNow] = (0, react.useState)(() => Date.now());
942
+ const splitState = (0, react.useSyncExternalStore)(navigation.subscribe, navigation.getSnapshot);
943
+ (0, react.useEffect)(() => {
944
+ const timer = setInterval(() => {
945
+ setNow(Date.now());
946
+ }, 1e4);
947
+ return () => {
948
+ clearInterval(timer);
949
+ };
950
+ }, []);
951
+ const board = useKanban(sessionsList, workspacesList, sessionStatus, now, splitState.sessionIds);
952
+ const { sidebarSessions, workspaceGroups, activeSessionId } = board;
953
+ const activeCount = board.totalCounts.running;
954
+ const reviewCount = board.totalCounts.inReview;
955
+ const alertCount = board.totalCounts.alerts;
956
+ const totalInFlight = sidebarSessions.length;
957
+ const switchToWorkspaces = () => {
958
+ sidebarModeStore.setMode("workspaces");
959
+ selectPanel(null);
960
+ };
961
+ const handleOpenWorkspaceKanban = (workspaceId) => {
962
+ setStoredKanbanWorkspace(workspaceId);
963
+ selectPanel("kanban");
964
+ };
965
+ const handleSelectSession = (sessionId, e) => {
966
+ if (e.detail > 1) return;
967
+ if (e.metaKey || e.ctrlKey) {
968
+ e.preventDefault();
969
+ navigation.toggleSession(sessionId);
970
+ return;
971
+ }
972
+ selectSession(sessionId);
973
+ };
974
+ const handleDoubleClick = (sessionId, e) => {
975
+ e.stopPropagation();
976
+ if (e.metaKey || e.ctrlKey) return;
977
+ navigation.toggleMaximize(sessionId);
978
+ };
979
+ if (!wide) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("nav", {
980
+ className: "dsh-inflight-sidebar-rail",
981
+ "aria-label": "In-flight sidebar rail",
982
+ children: [
983
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
984
+ type: "button",
985
+ className: "dsh-inflight-rail-switcher-btn is-active",
986
+ onClick: () => {
987
+ selectPanel("kanban");
988
+ },
989
+ title: `Open Kanban (${totalInFlight})`,
990
+ "aria-label": `Open Kanban (${totalInFlight})`,
991
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanIcon, { size: 18 }), (activeCount > 0 || reviewCount > 0 || alertCount > 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
992
+ className: "dsh-inflight-rail-badges",
993
+ children: [
994
+ alertCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
995
+ className: "dsh-kanban-ws-badge dsh-kanban-ws-badge-alert",
996
+ title: `${alertCount} requiring attention`,
997
+ children: alertCount
998
+ }),
999
+ activeCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1000
+ className: "dsh-kanban-ws-badge dsh-kanban-ws-badge-top",
1001
+ title: `${activeCount} in progress`,
1002
+ children: activeCount
1003
+ }),
1004
+ reviewCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1005
+ className: "dsh-kanban-ws-badge dsh-kanban-ws-badge-bottom",
1006
+ title: `${reviewCount} in review`,
1007
+ children: reviewCount
1008
+ })
1009
+ ]
1010
+ })]
1011
+ }),
1012
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: "dsh-inflight-rail-divider" }),
1013
+ sidebarSessions.map((session) => {
1014
+ const lane = board.getLane(session.id);
1015
+ const alert = board.getAlert(session.id);
1016
+ const isSplitActive = splitState.sessionIds.length > 0 && !splitState.suspended;
1017
+ const isInSplit = isSplitActive && splitState.sessionIds.includes(session.id);
1018
+ const isFocused = splitState.sessionIds.length > 1 && !splitState.suspended && session.id === splitState.focusedSessionId;
1019
+ const isCurrent = isSplitActive ? isInSplit : session.id === activeSessionId;
1020
+ const statusLabel = (alert !== void 0 ? formatKanbanAlertLabel(alert) : void 0) ?? laneLabel(lane);
1021
+ const sessionTitle = getKanbanSessionTitle(session);
1022
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1023
+ type: "button",
1024
+ "aria-current": isFocused ? "true" : void 0,
1025
+ className: `dsh-inflight-rail-session-dot ${isCurrent ? "is-current" : ""} ${isFocused ? "is-focused" : ""}`,
1026
+ onClick: (e) => {
1027
+ handleSelectSession(session.id, e);
1028
+ },
1029
+ title: `${sessionTitle} (${statusLabel})`,
1030
+ "aria-label": `${sessionTitle} (${statusLabel})`,
1031
+ children: isSplitActive && splitState.maximizedSessionId === session.id ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFullscreenOutlineRegular, { size: 14 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanStatusDot, { state: alert ? "alert" : lane })
1032
+ }, session.id);
1033
+ })
1034
+ ]
1035
+ });
1036
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1037
+ className: "dsh-inflight-sidebar",
1038
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1039
+ className: "dsh-inflight-sidebar-header",
1040
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1041
+ type: "button",
1042
+ className: "dsh-inflight-header-clickable",
1043
+ onClick: () => selectPanel("kanban"),
1044
+ title: "Open Kanban",
1045
+ children: [
1046
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1047
+ className: "dsh-inflight-header-icon",
1048
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanIcon, { size: 16 })
1049
+ }),
1050
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1051
+ className: "dsh-inflight-sidebar-title",
1052
+ children: "Kanban"
1053
+ }),
1054
+ (activeCount > 0 || reviewCount > 0 || alertCount > 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1055
+ className: "dsh-inflight-badges",
1056
+ children: [
1057
+ alertCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1058
+ className: "dsh-kanban-badge is-alert",
1059
+ title: `${alertCount} requiring attention`,
1060
+ children: alertCount
1061
+ }),
1062
+ activeCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1063
+ className: "dsh-kanban-badge is-active",
1064
+ title: `${activeCount} in progress`,
1065
+ children: activeCount
1066
+ }),
1067
+ reviewCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1068
+ className: "dsh-kanban-badge is-review",
1069
+ title: `${reviewCount} in review`,
1070
+ children: reviewCount
1071
+ })
1072
+ ]
1073
+ })
1074
+ ]
1075
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1076
+ type: "button",
1077
+ className: "dsh-inflight-btn-close",
1078
+ onClick: switchToWorkspaces,
1079
+ title: "Close Kanban",
1080
+ "aria-label": "Close Kanban",
1081
+ children: "✕"
1082
+ })]
1083
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1084
+ className: "dsh-inflight-sidebar-list",
1085
+ children: workspaceGroups.map((group) => {
1086
+ const counts = group.workspaceId === "ungrouped" ? void 0 : board.workspaceCounts.get(group.workspaceId);
1087
+ let wsActiveCount = counts ? counts.running : 0;
1088
+ let wsReviewCount = counts ? counts.inReview : 0;
1089
+ let wsAlertCount = counts ? counts.alerts : 0;
1090
+ if (group.workspaceId === "ungrouped") for (const s of group.sessions) {
1091
+ const lane = board.getLane(s.id);
1092
+ const alert = board.getAlert(s.id);
1093
+ if (alert !== void 0) wsAlertCount += 1;
1094
+ if (lane === "active") wsActiveCount += 1;
1095
+ else if (lane === "review" && alert === void 0) wsReviewCount += 1;
1096
+ }
1097
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1098
+ className: "dsh-inflight-ws-group",
1099
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1100
+ className: "dsh-inflight-ws-header-row",
1101
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1102
+ type: "button",
1103
+ className: "dsh-inflight-ws-header",
1104
+ onClick: () => handleOpenWorkspaceKanban(group.workspaceId),
1105
+ title: `Open ${group.title} in Kanban`,
1106
+ children: [
1107
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1108
+ className: "dsh-inflight-ws-icon",
1109
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
1110
+ width: "14",
1111
+ height: "14",
1112
+ viewBox: "0 0 16 16",
1113
+ fill: "currentColor",
1114
+ "aria-hidden": "true",
1115
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M1.5 3A1.5 1.5 0 0 0 0 4.5v7A1.5 1.5 0 0 0 1.5 13h13a1.5 1.5 0 0 0 1.5-1.5V6a1.5 1.5 0 0 0-1.5-1.5H8.414l-1.707-1.707A1 1 0 0 0 6 2.5H1.5z" })
1116
+ })
1117
+ }),
1118
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1119
+ className: "dsh-inflight-ws-title",
1120
+ children: group.title
1121
+ }),
1122
+ (wsActiveCount > 0 || wsReviewCount > 0 || wsAlertCount > 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1123
+ className: "dsh-inflight-badges",
1124
+ children: [
1125
+ wsAlertCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1126
+ className: "dsh-kanban-badge is-alert",
1127
+ title: `${wsAlertCount} requiring attention`,
1128
+ children: wsAlertCount
1129
+ }),
1130
+ wsActiveCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1131
+ className: "dsh-kanban-badge is-active",
1132
+ title: `${wsActiveCount} in progress`,
1133
+ children: wsActiveCount
1134
+ }),
1135
+ wsReviewCount > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1136
+ className: "dsh-kanban-badge is-review",
1137
+ title: `${wsReviewCount} in review`,
1138
+ children: wsReviewCount
1139
+ })
1140
+ ]
1141
+ })
1142
+ ]
1143
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1144
+ type: "button",
1145
+ className: "dsh-inflight-btn-add-task",
1146
+ onClick: (e) => {
1147
+ e.stopPropagation();
1148
+ startTask(group.workspaceId === "ungrouped" ? void 0 : group.workspaceId);
1149
+ },
1150
+ title: `Add task in ${group.title}`,
1151
+ "aria-label": `Add task in ${group.title}`,
1152
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
1153
+ width: "14",
1154
+ height: "14",
1155
+ viewBox: "0 0 16 16",
1156
+ fill: "none",
1157
+ stroke: "currentColor",
1158
+ strokeWidth: "1.75",
1159
+ strokeLinecap: "round",
1160
+ "aria-hidden": "true",
1161
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 3v10M3 8h10" })
1162
+ })
1163
+ })]
1164
+ }), group.sessions.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1165
+ className: "dsh-inflight-ws-cards",
1166
+ children: group.sessions.map((session) => {
1167
+ const lane = board.getLane(session.id);
1168
+ const alert = board.getAlert(session.id);
1169
+ const isInProgress = lane === "active" || session.running;
1170
+ const isSplitActive = splitState.sessionIds.length > 0 && !splitState.suspended;
1171
+ const isInSplit = isSplitActive && splitState.sessionIds.includes(session.id);
1172
+ const isFocused = splitState.sessionIds.length > 1 && !splitState.suspended && session.id === splitState.focusedSessionId;
1173
+ const isCurrent = isSplitActive ? isInSplit : session.id === activeSessionId;
1174
+ const statusTitle = (alert !== void 0 ? formatKanbanAlertLabel(alert) : void 0) ?? laneLabel(lane);
1175
+ const values = session.projectionValues;
1176
+ const record = values === void 0 ? void 0 : values.kanban;
1177
+ const isMaximized = isSplitActive && splitState.maximizedSessionId === session.id;
1178
+ const canClosePane = isInSplit && !isMaximized;
1179
+ const sessionTitle = getKanbanSessionTitle(session, group.title);
1180
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1181
+ className: `dsh-inflight-card ${isCurrent ? "is-current" : ""} ${isFocused ? "is-focused" : ""} ${alert ? "is-alert" : ""} ${canClosePane ? "has-slot-close" : ""}`,
1182
+ onPointerEnter: () => {
1183
+ if (isInSplit) navigation.setHoveredSession(session.id);
1184
+ },
1185
+ onPointerLeave: () => {
1186
+ navigation.setHoveredSession(void 0);
1187
+ },
1188
+ children: [
1189
+ isMaximized ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1190
+ type: "button",
1191
+ "aria-pressed": "true",
1192
+ className: "dsh-inflight-card-slot dsh-inflight-btn-fullscreen-toggle is-active is-pressed",
1193
+ onClick: (e) => {
1194
+ e.stopPropagation();
1195
+ navigation.toggleMaximize(session.id);
1196
+ },
1197
+ title: "Restore split layout",
1198
+ "aria-label": `Restore split layout for ${sessionTitle}`,
1199
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFullscreenOutlineRegular, { size: 14 })
1200
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1201
+ className: "dsh-inflight-card-slot",
1202
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1203
+ className: "dsh-inflight-card-slot-status",
1204
+ "aria-hidden": "true",
1205
+ title: statusTitle,
1206
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanStatusDot, { state: alert ? "alert" : lane })
1207
+ }), canClosePane && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1208
+ type: "button",
1209
+ className: "dsh-inflight-btn-slot-close",
1210
+ onClick: (e) => {
1211
+ e.stopPropagation();
1212
+ navigation.removeSession(session.id);
1213
+ },
1214
+ title: `Close ${sessionTitle} in split view`,
1215
+ "aria-label": `Close ${sessionTitle} in split view`,
1216
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 14 })
1217
+ })]
1218
+ }),
1219
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1220
+ 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", {
1222
+ type: "button",
1223
+ className: "dsh-inflight-card-main",
1224
+ "aria-current": isFocused ? "true" : void 0,
1225
+ onClick: (e) => handleSelectSession(session.id, e),
1226
+ onDoubleClick: (e) => handleDoubleClick(session.id, e),
1227
+ "aria-label": `${sessionTitle} (${statusTitle})`,
1228
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1229
+ className: "dsh-inflight-card-title",
1230
+ children: sessionTitle
1231
+ })
1232
+ })]
1233
+ }),
1234
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1235
+ className: "dsh-inflight-card-time",
1236
+ children: formatRelativeTime(getSessionRecency(session), now).replace("just now", "now").replace(" ago", "")
1237
+ }),
1238
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1239
+ className: "dsh-inflight-card-actions",
1240
+ children: lane === "done" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1241
+ type: "button",
1242
+ className: "dsh-inflight-btn-action",
1243
+ onClick: (e) => {
1244
+ e.stopPropagation();
1245
+ reopen(session.id);
1246
+ },
1247
+ title: "Reopen task",
1248
+ "aria-label": "Reopen task",
1249
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRefreshOutlineRegular, { size: 14 })
1250
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1251
+ type: "button",
1252
+ className: `dsh-inflight-btn-action is-hold ${isInProgress ? "is-disabled" : ""}`,
1253
+ disabled: isInProgress,
1254
+ onClick: (e) => {
1255
+ e.stopPropagation();
1256
+ if (!isInProgress) holdSession(session.id);
1257
+ },
1258
+ title: isInProgress ? "Session is in progress" : "Put on hold",
1259
+ "aria-label": isInProgress ? "Session is in progress" : "Put on hold",
1260
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconPause$1, { size: 14 })
1261
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1262
+ type: "button",
1263
+ className: `dsh-inflight-btn-action is-done ${isInProgress ? "is-disabled" : ""}`,
1264
+ disabled: isInProgress,
1265
+ onClick: (e) => {
1266
+ e.stopPropagation();
1267
+ if (!isInProgress) markDone(session.id);
1268
+ },
1269
+ title: isInProgress ? "Session is in progress" : "Mark task done",
1270
+ "aria-label": isInProgress ? "Session is in progress" : "Mark task done",
1271
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCheck$1, { size: 14 })
1272
+ })] })
1273
+ })
1274
+ ]
1275
+ }, session.id);
1276
+ })
1277
+ })]
1278
+ }, group.workspaceId);
1279
+ })
1280
+ })]
1281
+ });
1282
+ }
1283
+ // src/client/KanbanCard.tsx
1284
+ /**
1285
+ * Purpose: Render a draggable Kanban card displaying session status, title/prompt, and runtime badge.
1286
+ * Contract:
1287
+ * - Inputs: KanbanCardProps containing session data, lane context, selection flag, prompt preview, and callbacks.
1288
+ * - Outputs: Rendered JSX element representing the card.
1289
+ * - Throws / Errors: Never throws.
1290
+ */
1291
+ function KanbanCard({ session, lane, alert, isSelected, onSelect, onDragStart, onDragEnd, onTransition, onTogglePin }) {
1292
+ const values = session.projectionValues;
1293
+ const record = values === void 0 ? void 0 : values.kanban;
1294
+ const isPinned = lane === "done" && record !== void 0 && record !== null && record.pinnedAt !== void 0;
1295
+ const alertLabel = alert !== void 0 ? formatKanbanAlertLabel(alert) : void 0;
1296
+ const handleDragStart = (e) => {
1297
+ e.dataTransfer.setData("text/plain", session.id);
1298
+ e.dataTransfer.effectAllowed = "move";
1299
+ if (onDragStart) onDragStart(session.id, lane);
1300
+ };
1301
+ const handleDragEnd = () => {
1302
+ if (onDragEnd) setTimeout(() => {
1303
+ onDragEnd();
1304
+ }, 0);
1305
+ };
1306
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1307
+ className: `dsh-kanban-card ${isSelected ? "is-active-session" : ""} ${isPinned ? "is-pinned" : ""} ${alert ? "is-alert" : ""}`,
1308
+ draggable: true,
1309
+ onDragStart: handleDragStart,
1310
+ onDragEnd: handleDragEnd,
1311
+ onClick: () => onSelect(session.id),
1312
+ children: [
1313
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1314
+ className: "dsh-kanban-card-header",
1315
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1316
+ className: "dsh-kanban-card-title",
1317
+ children: getKanbanSessionTitle(session)
1318
+ }), lane === "done" && onTogglePin !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1319
+ type: "button",
1320
+ className: `dsh-kanban-card-pin-btn ${isPinned ? "is-pinned" : ""}`,
1321
+ onClick: (e) => {
1322
+ e.stopPropagation();
1323
+ onTogglePin(session.id);
1324
+ },
1325
+ "aria-pressed": isPinned,
1326
+ title: isPinned ? "Unpin session" : "Pin session to top",
1327
+ "aria-label": isPinned ? "Unpin session" : "Pin session to top",
1328
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
1329
+ width: "12",
1330
+ height: "12",
1331
+ viewBox: "0 0 16 16",
1332
+ fill: isPinned ? "currentColor" : "none",
1333
+ stroke: "currentColor",
1334
+ strokeWidth: "1.5",
1335
+ strokeLinecap: "round",
1336
+ strokeLinejoin: "round",
1337
+ "aria-hidden": "true",
1338
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M9.828.722a.5.5 0 0 1 .354.146l4.95 4.95a.5.5 0 0 1 0 .707c-.48.48-1.072.588-1.503.588-.177 0-.335-.018-.46-.039l-3.134 3.134a5.927 5.927 0 0 1 .16 1.013c.046.702-.032 1.687-.72 2.375a.5.5 0 0 1-.707 0l-2.829-2.828-3.182 3.182c-.195.195-1.219.909-1.414.714-.195-.195.519-1.218.714-1.414l3.182-3.182-2.828-2.829a.5.5 0 0 1 0-.707c.688-.688 1.673-.767 2.375-.72a5.922 5.922 0 0 1 1.013.16l3.134-3.133a2.772 2.772 0 0 1-.04-.461c0-.43.108-1.022.589-1.503a.5.5 0 0 1 .353-.146z" })
1339
+ })
1340
+ })]
1341
+ }),
1342
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1343
+ className: "dsh-kanban-card-footer",
1344
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { children: alert ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1345
+ className: "dsh-kanban-badge-alert-pill",
1346
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanStatusDot, { state: "alert" }), alertLabel]
1347
+ }) : session.running || lane === "active" ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1348
+ className: "dsh-kanban-badge-running",
1349
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanStatusDot, { state: "active" }), "Running..."]
1350
+ }) : /* @__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
+ className: "dsh-kanban-badge-hold",
1352
+ children: "On hold"
1353
+ })] }) }), record !== void 0 && record !== null && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionLinks, { links: record.links })]
1354
+ }),
1355
+ onTransition !== void 0 && lane !== "active" && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1356
+ className: "dsh-kanban-card-mobile-actions",
1357
+ children: [
1358
+ isKanbanTransitionAllowed(lane, "active") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1359
+ type: "button",
1360
+ className: "dsh-kanban-btn-mobile-action is-primary",
1361
+ onClick: (e) => {
1362
+ e.stopPropagation();
1363
+ onTransition(session.id, "active");
1364
+ },
1365
+ children: session.blank ? "Start" : "Resume"
1366
+ }),
1367
+ isKanbanTransitionAllowed(lane, "review") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1368
+ type: "button",
1369
+ className: "dsh-kanban-btn-mobile-action",
1370
+ onClick: (e) => {
1371
+ e.stopPropagation();
1372
+ onTransition(session.id, "review");
1373
+ },
1374
+ children: "Review"
1375
+ }),
1376
+ isKanbanTransitionAllowed(lane, "done") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1377
+ type: "button",
1378
+ className: "dsh-kanban-btn-mobile-action is-primary",
1379
+ onClick: (e) => {
1380
+ e.stopPropagation();
1381
+ onTransition(session.id, "done");
1382
+ },
1383
+ children: "Done"
1384
+ }),
1385
+ isKanbanTransitionAllowed(lane, "todo") && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1386
+ type: "button",
1387
+ className: "dsh-kanban-btn-mobile-action",
1388
+ onClick: (e) => {
1389
+ e.stopPropagation();
1390
+ onTransition(session.id, "todo");
1391
+ },
1392
+ children: "Hold"
1393
+ })
1394
+ ]
1395
+ })
1396
+ ]
1397
+ });
1398
+ }
1399
+ // src/client/KanbanSection.tsx
1400
+ /**
1401
+ * Purpose: Render a droppable Kanban column lane with header count, inline task preparer, and session cards.
1402
+ * Contract:
1403
+ * - Inputs: KanbanSectionProps containing lane identifier, title, sessions list, records map, and event handlers.
1404
+ * - Outputs: Rendered JSX element for the column lane.
1405
+ * - Throws / Errors: Never throws.
1406
+ */
1407
+ function KanbanSection({ lane, title, sessions, selectedSessionId, isPreparing = false, activeDragSourceLane, getAlert, onSelect, onDropSession, onDragStart, onDragEnd, onSubmitPrepare, onCancelPrepare, onTogglePin }) {
1408
+ const [isCollapsed, setIsCollapsed] = (0, react.useState)(false);
1409
+ const [isDragOver, setIsDragOver] = (0, react.useState)(false);
1410
+ const canAcceptDrop = activeDragSourceLane !== void 0 && isKanbanTransitionAllowed(activeDragSourceLane, lane);
1411
+ const [newPrompt, setNewPrompt] = (0, react.useState)("");
1412
+ const handleDragOver = (e) => {
1413
+ if (!canAcceptDrop) return;
1414
+ e.preventDefault();
1415
+ e.dataTransfer.dropEffect = "move";
1416
+ if (!isDragOver) setIsDragOver(true);
1417
+ };
1418
+ const handleDragLeave = () => {
1419
+ setIsDragOver(false);
1420
+ };
1421
+ const handleDrop = (e) => {
1422
+ e.preventDefault();
1423
+ setIsDragOver(false);
1424
+ const rawId = e.dataTransfer.getData("text/plain");
1425
+ if (rawId) onDropSession(rawId, lane);
1426
+ };
1427
+ const handleSave = () => {
1428
+ const trimmedPrompt = newPrompt.trim();
1429
+ if (trimmedPrompt && onSubmitPrepare) {
1430
+ onSubmitPrepare(trimmedPrompt);
1431
+ setNewPrompt("");
1432
+ }
1433
+ };
1434
+ const handleCancel = () => {
1435
+ if (onCancelPrepare) onCancelPrepare();
1436
+ setNewPrompt("");
1437
+ };
1438
+ const isEmpty = sessions.length === 0 && !isPreparing;
1439
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1440
+ className: `dsh-kanban-section ${isDragOver ? "drag-over" : ""} ${isEmpty ? "is-empty" : ""} ${isCollapsed && !isPreparing ? "is-collapsed" : ""}`,
1441
+ onDragOver: handleDragOver,
1442
+ onDragLeave: handleDragLeave,
1443
+ onDrop: handleDrop,
1444
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1445
+ className: "dsh-kanban-section-header",
1446
+ onClick: () => setIsCollapsed((prev) => !prev),
1447
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1448
+ className: "dsh-kanban-section-title-wrap",
1449
+ children: [
1450
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1451
+ className: "dsh-kanban-collapse-icon",
1452
+ children: isCollapsed && !isPreparing ? "▸" : "▾"
1453
+ }),
1454
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: title }),
1455
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1456
+ className: "dsh-kanban-pill",
1457
+ children: sessions.length
1458
+ })
1459
+ ]
1460
+ })
1461
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1462
+ className: "dsh-kanban-lane-body",
1463
+ children: [isPreparing && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1464
+ className: "dsh-kanban-new-card",
1465
+ onClick: (e) => e.stopPropagation(),
1466
+ children: [
1467
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1468
+ className: "dsh-kanban-prepare-label",
1469
+ children: "Prepare Task"
1470
+ }),
1471
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("textarea", {
1472
+ ref: (el) => el?.focus(),
1473
+ className: "dsh-kanban-new-card-textarea",
1474
+ placeholder: "Task instructions / prompt...",
1475
+ rows: 3,
1476
+ value: newPrompt,
1477
+ onChange: (e) => setNewPrompt(e.target.value),
1478
+ onKeyDown: (e) => {
1479
+ if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
1480
+ e.preventDefault();
1481
+ handleSave();
1482
+ } else if (e.key === "Escape") handleCancel();
1483
+ }
1484
+ }),
1485
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1486
+ className: "dsh-kanban-new-card-actions",
1487
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1488
+ type: "button",
1489
+ className: "dsh-kanban-btn-add",
1490
+ onClick: handleSave,
1491
+ disabled: !newPrompt.trim(),
1492
+ children: "Save Task"
1493
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1494
+ type: "button",
1495
+ className: "dsh-kanban-btn-cancel",
1496
+ onClick: handleCancel,
1497
+ children: "Cancel"
1498
+ })]
1499
+ })
1500
+ ]
1501
+ }), sessions.length === 0 && !isPreparing ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1502
+ className: "dsh-kanban-empty",
1503
+ children: "No sessions"
1504
+ }) : sessions.map((session) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanCard, {
1505
+ session,
1506
+ lane,
1507
+ alert: getAlert?.(session.id),
1508
+ isSelected: session.id === selectedSessionId,
1509
+ onSelect,
1510
+ onDragStart,
1511
+ onDragEnd,
1512
+ onTransition: onDropSession,
1513
+ onTogglePin
1514
+ }, session.id))]
1515
+ })]
1516
+ });
1517
+ }
1518
+ // src/client/KanbanPane.tsx
1519
+ /**
1520
+ * Purpose: Render the full interactive Kanban board container with workspace filtering and 4-column lane layout.
1521
+ * Contract:
1522
+ * - Inputs: KanbanPaneProps injected with observable session/workspace stores and operational dispatchers.
1523
+ * - Outputs: Rendered JSX element for the Kanban board view.
1524
+ * - Throws / Errors: Never throws.
1525
+ */
1526
+ function KanbanPane({ sessionsList, workspacesList, sessionStatus, searchSessions, searchResultLimit, currentSessionId, refreshProjections, startTask, prepareTask, startPreparedTask, selectSession, markDone, reopen, deleteSession, holdSession, unholdSession, pinSession, unpinSession }) {
1527
+ const [userWorkspaceId, setUserWorkspaceId] = (0, react.useState)(() => getStoredKanbanWorkspace());
1528
+ const [isStarting, setIsStarting] = (0, react.useState)(false);
1529
+ const [isPreparingTask, setIsPreparingTask] = (0, react.useState)(false);
1530
+ const [isRecycleOver, setIsRecycleOver] = (0, react.useState)(false);
1531
+ const [activeDragSourceLane, setActiveDragSourceLane] = (0, react.useState)();
1532
+ const [searchQuery, setSearchQuery] = (0, react.useState)("");
1533
+ const query = searchQuery.trim();
1534
+ const [searchState, setSearchState] = (0, react.useState)({ status: "pending" });
1535
+ (0, react.useEffect)(() => {
1536
+ if (typeof window === "undefined") return;
1537
+ const handleStorage = () => {
1538
+ setUserWorkspaceId(getStoredKanbanWorkspace());
1539
+ };
1540
+ window.addEventListener("dsh-kanban-workspace-change", handleStorage);
1541
+ window.addEventListener("storage", handleStorage);
1542
+ return () => {
1543
+ window.removeEventListener("dsh-kanban-workspace-change", handleStorage);
1544
+ window.removeEventListener("storage", handleStorage);
1545
+ };
1546
+ }, []);
1547
+ const handleDragStart = (0, react.useCallback)((_id, sourceLane) => {
1548
+ setActiveDragSourceLane(sourceLane);
1549
+ }, []);
1550
+ const handleDragEnd = (0, react.useCallback)(() => {
1551
+ setActiveDragSourceLane(void 0);
1552
+ }, []);
1553
+ const board = useKanban(sessionsList, workspacesList, sessionStatus);
1554
+ const listSnapshot = useStore(sessionsList);
1555
+ const handleSelectWorkspace = (id) => {
1556
+ setUserWorkspaceId(id);
1557
+ setStoredKanbanWorkspace(id);
1558
+ };
1559
+ const isUngroupedSelected = userWorkspaceId === "ungrouped";
1560
+ const selectedWorkspace = (0, react.useMemo)(() => {
1561
+ if (isUngroupedSelected) return null;
1562
+ if (userWorkspaceId !== null && board.sortedWorkspaces.some((w) => w.workspaceId === userWorkspaceId)) return board.sortedWorkspaces.find((w) => w.workspaceId === userWorkspaceId) ?? null;
1563
+ if (currentSessionId) {
1564
+ const match = board.sortedWorkspaces.find((w) => w.sessionIds.includes(currentSessionId));
1565
+ if (match) return match;
1566
+ }
1567
+ return board.sortedWorkspaces[0] ?? null;
1568
+ }, [
1569
+ isUngroupedSelected,
1570
+ userWorkspaceId,
1571
+ currentSessionId,
1572
+ board.sortedWorkspaces
1573
+ ]);
1574
+ const effectiveWorkspaceId = isUngroupedSelected ? "ungrouped" : selectedWorkspace?.workspaceId;
1575
+ const handleStartTask = async () => {
1576
+ if (isStarting) return;
1577
+ setIsStarting(true);
1578
+ try {
1579
+ await startTask(effectiveWorkspaceId);
1580
+ } finally {
1581
+ setIsStarting(false);
1582
+ }
1583
+ };
1584
+ const handlePrepareTask = async (prompt) => {
1585
+ try {
1586
+ await prepareTask(prompt, effectiveWorkspaceId);
1587
+ } finally {
1588
+ setIsPreparingTask(false);
1589
+ }
1590
+ };
1591
+ const requestedHydrationRef = (0, react.useRef)(/* @__PURE__ */ new Set());
1592
+ (0, react.useEffect)(() => {
1593
+ if (!refreshProjections) return;
1594
+ const targetIds = /* @__PURE__ */ new Set();
1595
+ const now = Date.now();
1596
+ if (selectedWorkspace) {
1597
+ for (const id of listSnapshot.ids) if (!requestedHydrationRef.current.has(id)) {
1598
+ const summary = listSnapshot.byId[id];
1599
+ if (summary && isSessionInWorkspace(summary, selectedWorkspace) && isSessionEligibleForHydration(summary, now) && summary.projectionValues?.kanban === void 0) targetIds.add(id);
1600
+ }
1601
+ } else for (const id of listSnapshot.ids) {
1602
+ const summary = listSnapshot.byId[id];
1603
+ if (summary === void 0 || requestedHydrationRef.current.has(id) || !isSessionEligibleForHydration(summary, now)) continue;
1604
+ if (isUngroupedSelected && board.sortedWorkspaces.some((workspace) => isSessionInWorkspace(summary, workspace))) continue;
1605
+ const values = summary.projectionValues;
1606
+ if (values === void 0 || values.kanban === void 0) targetIds.add(id);
1607
+ }
1608
+ for (const id of targetIds) {
1609
+ requestedHydrationRef.current.add(id);
1610
+ refreshProjections(id).catch((err) => {
1611
+ console.warn(`[Kanban] Failed to hydrate projections for ${id}:`, err);
1612
+ });
1613
+ }
1614
+ }, [
1615
+ selectedWorkspace,
1616
+ isUngroupedSelected,
1617
+ board.sortedWorkspaces,
1618
+ listSnapshot,
1619
+ refreshProjections
1620
+ ]);
1621
+ const workspaceCounts = board.workspaceCounts;
1622
+ const sortedWorkspaces = board.sortedWorkspaces;
1623
+ const partitioned = (0, react.useMemo)(() => {
1624
+ return board.partition(effectiveWorkspaceId);
1625
+ }, [board, effectiveWorkspaceId]);
1626
+ const searchScope = JSON.stringify(partitioned.todo.concat(partitioned.active, partitioned.review, partitioned.done).map((session) => session.id).sort());
1627
+ (0, react.useEffect)(() => {
1628
+ setSearchState({ status: "pending" });
1629
+ if (query === "") return;
1630
+ const controller = new AbortController();
1631
+ const timer = setTimeout(() => {
1632
+ const sessionIds = searchRequestSchema.shape.sessionIds.parse(JSON.parse(searchScope));
1633
+ searchSessions({
1634
+ query,
1635
+ sessionIds
1636
+ }, controller.signal).then((result) => {
1637
+ if (!controller.signal.aborted) setSearchState({
1638
+ status: "settled",
1639
+ query,
1640
+ scope: searchScope,
1641
+ workspaceId: effectiveWorkspaceId,
1642
+ result
1643
+ });
1644
+ });
1645
+ }, 250);
1646
+ return () => {
1647
+ clearTimeout(timer);
1648
+ controller.abort();
1649
+ };
1650
+ }, [
1651
+ query,
1652
+ searchSessions,
1653
+ searchScope,
1654
+ effectiveWorkspaceId
1655
+ ]);
1656
+ 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
+ ]);
1666
+ let searchMessage = "";
1667
+ if (query !== "") {
1668
+ if (searchResult === void 0) searchMessage = "Searching session contents…";
1669
+ else if (!searchResult.ok) searchMessage = `Search failed: ${searchResult.error.message}`;
1670
+ 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.";
1672
+ }
1673
+ const handleDropSession = async (sessionId, targetLane) => {
1674
+ setActiveDragSourceLane(void 0);
1675
+ const summary = listSnapshot.byId[sessionId];
1676
+ const record = summary?.projectionValues?.kanban;
1677
+ if (!summary || !record) return;
1678
+ const sourceLane = board.getLane(sessionId);
1679
+ if (!isKanbanTransitionAllowed(sourceLane, targetLane)) return;
1680
+ if (targetLane === "todo") await holdSession(sessionId);
1681
+ else if (targetLane === "review") {
1682
+ if (sourceLane === "done") await reopen(sessionId);
1683
+ else await unholdSession(sessionId);
1684
+ } else if (targetLane === "active") {
1685
+ if (summary.blank) await startPreparedTask(sessionId, record.prompt ?? "");
1686
+ else if (record.heldAt !== void 0) await unholdSession(sessionId);
1687
+ } else if (targetLane === "done") await markDone(sessionId);
1688
+ };
1689
+ const handleTogglePin = (0, react.useCallback)(async (sessionId) => {
1690
+ const record = listSnapshot.byId[sessionId]?.projectionValues?.kanban;
1691
+ if (!record) return;
1692
+ if (record.pinnedAt !== void 0) await unpinSession(sessionId);
1693
+ else await pinSession(sessionId);
1694
+ }, [
1695
+ listSnapshot.byId,
1696
+ pinSession,
1697
+ unpinSession
1698
+ ]);
1699
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1700
+ className: "dsh-kanban-pane",
1701
+ children: [
1702
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1703
+ className: "dsh-kanban-topbar",
1704
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1705
+ className: "dsh-kanban-topbar-left",
1706
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1707
+ className: "dsh-kanban-title",
1708
+ title: "Kanban",
1709
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanIcon, { size: 18 })
1710
+ }), sortedWorkspaces.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1711
+ className: "dsh-kanban-workspace-scroll",
1712
+ children: [sortedWorkspaces.map((ws) => {
1713
+ const label = ws.title || ws.path.split("/").filter(Boolean).pop() || ws.workspaceId;
1714
+ const counts = workspaceCounts.get(ws.workspaceId);
1715
+ const running = counts ? counts.running : 0;
1716
+ const inReview = counts ? counts.inReview : 0;
1717
+ const alerts = counts ? counts.alerts : 0;
1718
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
1719
+ type: "button",
1720
+ onClick: () => handleSelectWorkspace(ws.workspaceId),
1721
+ className: `dsh-kanban-ws-btn ${effectiveWorkspaceId === ws.workspaceId ? "active" : ""}`,
1722
+ title: ws.path,
1723
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: label }), (running > 0 || inReview > 0 || alerts > 0) && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1724
+ className: "dsh-kanban-ws-badges",
1725
+ children: [
1726
+ running > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1727
+ className: "dsh-kanban-ws-badge dsh-kanban-ws-badge-top",
1728
+ title: `${running} running`,
1729
+ children: running
1730
+ }),
1731
+ alerts > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1732
+ className: "dsh-kanban-ws-badge dsh-kanban-ws-badge-alert",
1733
+ title: `${alerts} requiring attention`,
1734
+ children: alerts
1735
+ }),
1736
+ inReview > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1737
+ className: "dsh-kanban-ws-badge dsh-kanban-ws-badge-bottom",
1738
+ title: `${inReview} in review`,
1739
+ children: inReview
1740
+ })
1741
+ ]
1742
+ })]
1743
+ }, ws.workspaceId);
1744
+ }), (isUngroupedSelected || Object.values(listSnapshot.byId).some((s) => s && !sortedWorkspaces.some((w) => isSessionInWorkspace(s, w)))) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1745
+ type: "button",
1746
+ onClick: () => handleSelectWorkspace("ungrouped"),
1747
+ className: `dsh-kanban-ws-btn ${effectiveWorkspaceId === "ungrouped" ? "active" : ""}`,
1748
+ title: "Other Sessions",
1749
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Other Sessions" })
1750
+ })]
1751
+ })]
1752
+ })
1753
+ }),
1754
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1755
+ className: "dsh-kanban-controls",
1756
+ children: [
1757
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1758
+ type: "button",
1759
+ className: "dsh-kanban-btn-start",
1760
+ onClick: handleStartTask,
1761
+ disabled: isStarting,
1762
+ title: "Start task immediately with native prompt input",
1763
+ children: isStarting ? "Starting..." : "+ Start task"
1764
+ }),
1765
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1766
+ type: "button",
1767
+ className: "dsh-kanban-btn-prepare",
1768
+ onClick: () => setIsPreparingTask(true),
1769
+ title: "Prepare task with prompt",
1770
+ children: "Prepare task"
1771
+ }),
1772
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1773
+ className: "dsh-kanban-search-box",
1774
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
1775
+ type: "search",
1776
+ className: "dsh-kanban-search-input",
1777
+ placeholder: "Search sessions...",
1778
+ value: searchQuery,
1779
+ onChange: (e) => setSearchQuery(e.target.value),
1780
+ "aria-label": "Search sessions"
1781
+ })
1782
+ })
1783
+ ]
1784
+ }),
1785
+ searchMessage && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1786
+ className: "dsh-kanban-search-status",
1787
+ role: "status",
1788
+ children: searchMessage
1789
+ }),
1790
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1791
+ className: "dsh-kanban-scroll",
1792
+ "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
+ ]
1847
+ }),
1848
+ activeDragSourceLane !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1849
+ className: `dsh-kanban-recycle-bin ${isRecycleOver ? "is-drag-over" : ""}`,
1850
+ onDragOver: (e) => {
1851
+ e.preventDefault();
1852
+ e.dataTransfer.dropEffect = "move";
1853
+ if (!isRecycleOver) setIsRecycleOver(true);
1854
+ },
1855
+ onDragLeave: () => setIsRecycleOver(false),
1856
+ onDrop: async (e) => {
1857
+ e.preventDefault();
1858
+ setIsRecycleOver(false);
1859
+ setActiveDragSourceLane(void 0);
1860
+ const sessionId = e.dataTransfer.getData("text/plain");
1861
+ if (sessionId && listSnapshot.byId[sessionId]) await deleteSession(sessionId);
1862
+ },
1863
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "🗑️" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Drop here to remove from board" })]
1864
+ })
1865
+ ]
1866
+ });
1867
+ }
1868
+ // src/client/KanbanPaneStatus.tsx
1869
+ /**
1870
+ * Purpose: Render the sidebar's Kanban lane and alert indicator in a split pane.
1871
+ * Contract:
1872
+ * - Inputs: Bound Session identity and the sidebar's reactive stores.
1873
+ * - Outputs: An accessible dot using the sidebar's classification and paint rules.
1874
+ * - Throws / Errors: Missing required stores fail at the call site.
1875
+ */
1876
+ function KanbanPaneStatus({ sessionId, sessionsList, workspacesList, sessionStatus }) {
1877
+ const board = useKanban(sessionsList, workspacesList, sessionStatus);
1878
+ const lane = board.getLane(sessionId);
1879
+ const alert = board.getAlert(sessionId);
1880
+ const label = alert === void 0 ? {
1881
+ todo: "To Do",
1882
+ active: "In Progress",
1883
+ review: "In Review",
1884
+ done: "Done"
1885
+ }[lane] : formatKanbanAlertLabel(alert);
1886
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1887
+ className: "dsh-kanban-pane-status",
1888
+ role: "img",
1889
+ "aria-label": label,
1890
+ title: label,
1891
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanStatusDot, { state: alert === void 0 ? lane : "alert" })
1892
+ });
1893
+ }
1894
+ // src/client/KanbanTransitionDropdown.tsx
1895
+ function formatLaneLabel(lane, record) {
1896
+ if (lane === "active") return "In Progress";
1897
+ if (lane === "review") return "In Review";
1898
+ if (lane === "done") return "Done";
1899
+ if (lane === "todo") return record?.heldAt !== void 0 ? "On Hold" : "Todo";
1900
+ return "Kanban";
1901
+ }
1902
+ function IconCheck({ size = 14 }) {
1903
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
1904
+ width: size,
1905
+ height: size,
1906
+ viewBox: "0 0 16 16",
1907
+ fill: "none",
1908
+ stroke: "currentColor",
1909
+ strokeWidth: "1.3",
1910
+ strokeLinecap: "round",
1911
+ strokeLinejoin: "round",
1912
+ "aria-hidden": "true",
1913
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2.25 8.5L5.49732 11.7473C5.90519 12.1552 6.57263 12.1344 6.95426 11.7018L13.75 4" })
1914
+ });
1915
+ }
1916
+ function IconPause({ size = 14 }) {
1917
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1918
+ width: size,
1919
+ height: size,
1920
+ viewBox: "0 0 16 16",
1921
+ fill: "none",
1922
+ stroke: "currentColor",
1923
+ strokeWidth: "1.3",
1924
+ "aria-hidden": "true",
1925
+ children: [
1926
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C4.41015 1.5 1.5 4.41015 1.5 8C1.5 11.5899 4.41015 14.5 8 14.5Z" }),
1927
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
1928
+ d: "M6.5 5.5V10.5",
1929
+ strokeLinecap: "round"
1930
+ }),
1931
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
1932
+ d: "M9.5 5.5V10.5",
1933
+ strokeLinecap: "round"
1934
+ })
1935
+ ]
1936
+ });
1937
+ }
1938
+ function IconPlay({ size = 14 }) {
1939
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
1940
+ width: size,
1941
+ height: size,
1942
+ viewBox: "0 0 16 16",
1943
+ fill: "none",
1944
+ stroke: "currentColor",
1945
+ strokeWidth: "1.3",
1946
+ "aria-hidden": "true",
1947
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", {
1948
+ d: "M4.5 3.5V12.5L12.5 8L4.5 3.5Z",
1949
+ strokeLinejoin: "round"
1950
+ })
1951
+ });
1952
+ }
1953
+ function IconReopen({ size = 14 }) {
1954
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("svg", {
1955
+ width: size,
1956
+ height: size,
1957
+ viewBox: "0 0 16 16",
1958
+ fill: "none",
1959
+ stroke: "currentColor",
1960
+ strokeWidth: "1.3",
1961
+ strokeLinecap: "round",
1962
+ strokeLinejoin: "round",
1963
+ "aria-hidden": "true",
1964
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2.5 8a5.5 5.5 0 1 0 1.5-3.75L2 6" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M2 2v4h4" })]
1965
+ });
1966
+ }
1967
+ /**
1968
+ * Purpose: Render a dropdown button with the Kanban icon in the prompt input bar for task transitions.
1969
+ * Contract:
1970
+ * - Inputs: Session runtime hooks and injected Kanban transition mutation callbacks.
1971
+ * - Outputs: Rendered JSX element with an accessible trigger button and transition popover menu.
1972
+ * - Throws / Errors: Never throws; transition command failures are handled by callers.
1973
+ */
1974
+ function KanbanTransitionDropdown({ sessionId, useSession, useSessions, holdSession, unholdSession, markDone, reopen, startPreparedTask }) {
1975
+ const [open, setOpen] = (0, react.useState)(false);
1976
+ const isRunning = useSession((s) => s.running);
1977
+ const isBlank = useSession((s) => s.blank);
1978
+ const hasPendingInteraction = useSession((s) => s.pendingSubmissions.length > 0);
1979
+ const summary = useSessions((s) => s.byId[sessionId]);
1980
+ const record = summary?.projectionValues?.kanban;
1981
+ const lane = classifyKanbanSession({
1982
+ running: isRunning,
1983
+ blank: isBlank
1984
+ }, record ?? {
1985
+ sessionId,
1986
+ createdAt: 0,
1987
+ links: []
1988
+ }, hasPendingInteraction);
1989
+ const laneLabel = formatLaneLabel(lane, record);
1990
+ const items = (0, react.useMemo)(() => {
1991
+ if (lane === "active") return [];
1992
+ if (lane === "review") return [{
1993
+ id: "done",
1994
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1995
+ className: "dsh-kanban-transition-item dsh-kanban-transition-item-primary",
1996
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCheck, { size: 14 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Mark task done" })]
1997
+ })
1998
+ }, {
1999
+ id: "hold",
2000
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2001
+ className: "dsh-kanban-transition-item",
2002
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconPause, { size: 14 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Put on hold" })]
2003
+ })
2004
+ }];
2005
+ if (lane === "todo") return [{
2006
+ id: "resume",
2007
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2008
+ className: "dsh-kanban-transition-item",
2009
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconPlay, { size: 14 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: isBlank ? "Start task" : "Resume task" })]
2010
+ })
2011
+ }, {
2012
+ id: "done",
2013
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2014
+ className: "dsh-kanban-transition-item",
2015
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconCheck, { size: 14 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Mark task done" })]
2016
+ })
2017
+ }];
2018
+ if (lane === "done") return [{
2019
+ id: "reopen",
2020
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2021
+ className: "dsh-kanban-transition-item",
2022
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconReopen, { size: 14 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Reopen task" })]
2023
+ })
2024
+ }, {
2025
+ id: "hold",
2026
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
2027
+ className: "dsh-kanban-transition-item",
2028
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconPause, { size: 14 }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: "Put on hold" })]
2029
+ })
2030
+ }];
2031
+ return [];
2032
+ }, [lane, isBlank]);
2033
+ if (summary?.origin === "subagent") return null;
2034
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
2035
+ open: open && !isRunning,
2036
+ portal: true,
2037
+ side: "top",
2038
+ align: "start",
2039
+ className: "dsh-kanban-transition-menu",
2040
+ listClassName: "dsh-kanban-transition-menu-list",
2041
+ onClose: () => setOpen(false),
2042
+ onSelect: (id) => {
2043
+ setOpen(false);
2044
+ if (id === "hold") holdSession(sessionId);
2045
+ else if (id === "done") markDone(sessionId);
2046
+ else if (id === "reopen") reopen(sessionId);
2047
+ else if (id === "resume") {
2048
+ if (isBlank && record?.prompt) startPreparedTask(sessionId, record.prompt);
2049
+ else unholdSession(sessionId);
2050
+ }
2051
+ },
2052
+ items,
2053
+ anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Button, {
2054
+ variant: "ghost",
2055
+ size: "sm",
2056
+ className: `dsh-kanban-input-chip ${open ? "is-pressed" : ""}`,
2057
+ title: isRunning ? "Task is in progress" : `Kanban: ${laneLabel} (click to transition)`,
2058
+ "aria-label": isRunning ? "Task is in progress" : `Kanban: ${laneLabel} (click to transition)`,
2059
+ "aria-haspopup": "menu",
2060
+ "aria-expanded": open,
2061
+ "aria-pressed": open,
2062
+ disabled: isRunning,
2063
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanIcon, {
2064
+ size: 18,
2065
+ strokeWidth: 1
2066
+ }),
2067
+ onClick: (event) => {
2068
+ event.stopPropagation();
2069
+ if (!isRunning) setOpen((prev) => !prev);
2070
+ },
2071
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(KanbanStatusDot, { state: lane }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, {
2072
+ size: 12,
2073
+ className: "dsh-kanban-input-chip-chevron",
2074
+ "aria-hidden": "true"
2075
+ })]
2076
+ })
2077
+ });
2078
+ }
2079
+ // src/client/navigation.ts
2080
+ /**
2081
+ * Purpose: Keep optional navigation scoped to one Kanban activation.
2082
+ * Contract:
2083
+ * - Inputs: Native workspace session navigation.
2084
+ * - Outputs: Observable membership and replaceable navigation actions.
2085
+ * - Throws / Errors: Navigation errors propagate.
2086
+ */
2087
+ function createNavigation(open) {
2088
+ const empty = {
2089
+ sessionIds: [],
2090
+ focusedSessionId: void 0,
2091
+ maximizedSessionId: void 0,
2092
+ suspended: false
2093
+ };
2094
+ const base = {
2095
+ getSnapshot: () => empty,
2096
+ openSession: open,
2097
+ toggleSession: open,
2098
+ removeSession: (_id) => {},
2099
+ startTask: open,
2100
+ toggleMaximize: (_id) => {},
2101
+ setHoveredSession: (_id) => {}
2102
+ };
2103
+ let current = base;
2104
+ const listeners = /* @__PURE__ */ new Set();
2105
+ const notify = () => {
2106
+ for (const listener of listeners) listener();
2107
+ };
2108
+ const toggleSession = (id) => {
2109
+ const { maximizedSessionId } = current.getSnapshot();
2110
+ if (maximizedSessionId !== void 0 && maximizedSessionId !== id) current.toggleMaximize(maximizedSessionId);
2111
+ current.toggleSession(id);
2112
+ };
2113
+ const startTask = (id) => {
2114
+ current.startTask(id);
2115
+ };
2116
+ const focusSession = (id) => {
2117
+ const snapshot = current.getSnapshot();
2118
+ if (snapshot.maximizedSessionId === id && !snapshot.suspended) return;
2119
+ if (snapshot.sessionIds.length > 0 && !snapshot.sessionIds.includes(id)) toggleSession(id);
2120
+ else current.openSession(id);
2121
+ };
2122
+ const maximizeSession = (id) => {
2123
+ focusSession(id);
2124
+ const snapshot = current.getSnapshot();
2125
+ if (snapshot.sessionIds.length > 1 && snapshot.maximizedSessionId !== id) current.toggleMaximize(id);
2126
+ };
2127
+ return {
2128
+ getSnapshot: () => current.getSnapshot(),
2129
+ subscribe: (listener) => {
2130
+ listeners.add(listener);
2131
+ return () => {
2132
+ listeners.delete(listener);
2133
+ };
2134
+ },
2135
+ openSession: (id) => current.openSession(id),
2136
+ focusSession,
2137
+ maximizeSession,
2138
+ toggleSession,
2139
+ removeSession: (id) => current.removeSession(id),
2140
+ setHoveredSession: (id) => current.setHoveredSession(id),
2141
+ startTask,
2142
+ toggleMaximize: (id) => current.toggleMaximize(id),
2143
+ connect: (integration, subscribe) => {
2144
+ current = integration;
2145
+ const off = subscribe(notify);
2146
+ notify();
2147
+ return () => {
2148
+ off();
2149
+ current = base;
2150
+ notify();
2151
+ };
2152
+ }
2153
+ };
2154
+ }
2155
+ // src/client/styles.ts
2156
+ const KANBAN_CSS = `
2157
+ .dsh-kanban-pane {
2158
+ display: flex;
2159
+ flex-direction: column;
2160
+ height: 100%;
2161
+ width: 100%;
2162
+ background: var(--dsw-alias-bg-base);
2163
+ color: var(--dsw-alias-label-primary, #1e293b);
2164
+ overflow: hidden;
2165
+ box-sizing: border-box;
2166
+ }
2167
+
2168
+ .dsh-kanban-topbar {
2169
+ display: flex;
2170
+ align-items: center;
2171
+ justify-content: space-between;
2172
+ gap: 10px;
2173
+ padding: 10px 14px;
2174
+ border-bottom: 0.5px solid var(--dsw-alias-border-l2);
2175
+ background: var(--dsw-alias-bg-base);
2176
+ min-width: 0;
2177
+ }
2178
+
2179
+ .dsh-kanban-topbar-left {
2180
+ display: flex;
2181
+ align-items: center;
2182
+ gap: 10px;
2183
+ flex: 1;
2184
+ min-width: 0;
2185
+ overflow: hidden;
2186
+ }
2187
+
2188
+ .dsh-kanban-title {
2189
+ display: inline-flex;
2190
+ align-items: center;
2191
+ justify-content: center;
2192
+ color: var(--dsw-alias-label-primary, #1e293b);
2193
+ flex-shrink: 0;
2194
+ }
2195
+
2196
+ .dsh-kanban-workspace-scroll {
2197
+ display: flex;
2198
+ align-items: center;
2199
+ gap: 8px;
2200
+ overflow-x: auto;
2201
+ overflow-y: hidden;
2202
+ white-space: nowrap;
2203
+ flex: 1;
2204
+ min-width: 0;
2205
+ scrollbar-width: thin;
2206
+ padding: 6px 2px;
2207
+ }
2208
+
2209
+ .dsh-kanban-workspace-scroll::-webkit-scrollbar {
2210
+ height: 3px;
2211
+ }
2212
+
2213
+ .dsh-kanban-workspace-scroll::-webkit-scrollbar-thumb {
2214
+ background: var(--dsw-alias-border-l1, #cbd5e1);
2215
+ border-radius: 2px;
2216
+ }
2217
+
2218
+ .dsh-kanban-ws-btn {
2219
+ position: relative;
2220
+ flex-shrink: 0;
2221
+ display: inline-flex;
2222
+ align-items: center;
2223
+ gap: 6px;
2224
+ padding: 3px 8px;
2225
+ font-size: 11px;
2226
+ border-radius: 4px;
2227
+ border: 1px solid var(--dsw-alias-border-l1, #e2e8f0);
2228
+ background: var(--dsw-alias-bg-base);
2229
+ color: var(--dsw-alias-label-primary);
2230
+ cursor: pointer;
2231
+ transition: all 0.15s ease;
2232
+ line-height: 1.3;
2233
+ }
2234
+
2235
+ .dsh-kanban-ws-btn:hover {
2236
+ background: var(--dsw-alias-interactive-bg-hover);
2237
+ border-color: var(--dsw-alias-border-l2, #cbd5e1);
2238
+ }
2239
+
2240
+ .dsh-kanban-ws-btn.active {
2241
+ background: var(--dsw-alias-state-business-primary, #2563eb);
2242
+ color: #ffffff;
2243
+ border-color: var(--dsw-alias-state-business-primary, #2563eb);
2244
+ font-weight: 500;
2245
+ }
2246
+
2247
+ .dsh-kanban-ws-badges {
2248
+ position: absolute;
2249
+ top: -3px;
2250
+ bottom: -3px;
2251
+ right: -7px;
2252
+ display: flex;
2253
+ flex-direction: column;
2254
+ justify-content: space-between;
2255
+ gap: 2px;
2256
+ align-items: center;
2257
+ line-height: 1;
2258
+ pointer-events: none;
2259
+ z-index: 1;
2260
+ }
2261
+
2262
+ .dsh-kanban-ws-badge {
2263
+ font-size: 9px;
2264
+ font-weight: 700;
2265
+ border-radius: 9999px;
2266
+ min-width: 12px;
2267
+ height: 12px;
2268
+ display: inline-flex;
2269
+ align-items: center;
2270
+ justify-content: center;
2271
+ padding: 0 3px;
2272
+ color: #ffffff;
2273
+ box-sizing: border-box;
2274
+ box-shadow: 0 0 0 1.5px var(--dsw-alias-bg-module-platform);
2275
+ }
2276
+
2277
+ .dsh-kanban-ws-badge-top {
2278
+ background: var(--dsw-alias-state-success-primary);
2279
+ margin-bottom: auto;
2280
+ }
2281
+
2282
+ .dsh-kanban-ws-badge-bottom {
2283
+ background: var(--dsw-alias-state-warn-primary);
2284
+ margin-top: auto;
2285
+ }
2286
+
2287
+ .dsh-kanban-ws-badge-alert {
2288
+ background: var(--dsw-alias-state-error-primary);
2289
+ }
2290
+
2291
+ .dsh-kanban-controls {
2292
+ display: flex;
2293
+ align-items: center;
2294
+ flex-wrap: wrap;
2295
+ gap: 8px;
2296
+ padding: 8px 14px;
2297
+ border-bottom: 0.5px solid var(--dsw-alias-border-l2);
2298
+ background: var(--dsw-alias-bg-base);
2299
+ }
2300
+
2301
+ .dsh-kanban-btn-start {
2302
+ flex-shrink: 0;
2303
+ display: inline-flex;
2304
+ align-items: center;
2305
+ gap: 6px;
2306
+ background: var(--dsw-alias-state-business-primary, #2563eb);
2307
+ color: #ffffff;
2308
+ border: none;
2309
+ border-radius: 6px;
2310
+ padding: 7px 14px;
2311
+ font-size: 13px;
2312
+ font-weight: 500;
2313
+ cursor: pointer;
2314
+ transition: opacity 0.15s ease;
2315
+ }
2316
+
2317
+ .dsh-kanban-btn-start:hover {
2318
+ opacity: 0.9;
2319
+ }
2320
+
2321
+ .dsh-kanban-btn-start:disabled {
2322
+ opacity: 0.6;
2323
+ cursor: not-allowed;
2324
+ }
2325
+
2326
+ .dsh-kanban-btn-prepare {
2327
+ flex-shrink: 0;
2328
+ display: inline-flex;
2329
+ align-items: center;
2330
+ gap: 6px;
2331
+ background: var(--dsw-alias-bg-base);
2332
+ color: var(--dsw-alias-label-primary, #1e293b);
2333
+ border: 1px solid var(--dsw-alias-border-l1, #cbd5e1);
2334
+ border-radius: 6px;
2335
+ padding: 7px 14px;
2336
+ font-size: 13px;
2337
+ font-weight: 500;
2338
+ cursor: pointer;
2339
+ transition: all 0.15s ease;
2340
+ }
2341
+
2342
+ .dsh-kanban-btn-prepare:hover {
2343
+ background: var(--dsw-alias-interactive-bg-hover);
2344
+ border-color: var(--dsw-alias-border-l2, #94a3b8);
2345
+ }
2346
+
2347
+ .dsh-kanban-search-box {
2348
+ margin-left: auto;
2349
+ display: flex;
2350
+ align-items: center;
2351
+ }
2352
+
2353
+ .dsh-kanban-search-input {
2354
+ background: var(--dsw-alias-bg-base);
2355
+ color: var(--dsw-alias-label-primary, #1e293b);
2356
+ border: 1px solid var(--dsw-alias-border-l1, #cbd5e1);
2357
+ border-radius: 6px;
2358
+ padding: 6px 10px;
2359
+ font-size: 13px;
2360
+ line-height: 18px;
2361
+ outline: none;
2362
+ transition: border-color 0.15s ease;
2363
+ width: 180px;
2364
+ max-width: 100%;
2365
+ box-sizing: border-box;
2366
+ }
2367
+
2368
+ .dsh-kanban-search-input:focus {
2369
+ border-color: var(--dsw-alias-state-business-primary, #2563eb);
2370
+ }
2371
+
2372
+ .dsh-kanban-search-input::placeholder {
2373
+ color: var(--dsw-alias-label-tertiary);
2374
+ }
2375
+
2376
+ .dsh-kanban-search-status {
2377
+ padding: 6px 14px;
2378
+ font-size: 12px;
2379
+ color: var(--dsw-alias-label-secondary, #64748b);
2380
+ }
2381
+
2382
+ .dsh-kanban-scroll {
2383
+ flex: 1;
2384
+ overflow-y: auto;
2385
+ padding: 12px 14px;
2386
+ display: flex;
2387
+ flex-direction: column;
2388
+ gap: 10px;
2389
+ }
2390
+
2391
+ @media (min-width: 768px) {
2392
+ .dsh-kanban-scroll {
2393
+ flex-direction: row;
2394
+ align-items: stretch;
2395
+ gap: 16px;
2396
+ overflow-x: auto;
2397
+ }
2398
+ .dsh-kanban-section {
2399
+ flex: 1;
2400
+ min-width: 220px;
2401
+ display: flex;
2402
+ flex-direction: column;
2403
+ }
2404
+ .dsh-kanban-lane-body {
2405
+ flex: 1;
2406
+ overflow-y: auto;
2407
+ display: flex !important;
2408
+ }
2409
+ .dsh-kanban-collapse-icon {
2410
+ display: none;
2411
+ }
2412
+ .dsh-kanban-section-header {
2413
+ cursor: default;
2414
+ }
2415
+ .dsh-kanban-card-mobile-actions {
2416
+ display: none;
2417
+ }
2418
+ }
2419
+
2420
+ @media (max-width: 767px) {
2421
+ .dsh-kanban-title {
2422
+ display: none;
2423
+ }
2424
+
2425
+ .dsh-kanban-topbar {
2426
+ padding: 6px 10px;
2427
+ gap: 8px;
2428
+ }
2429
+
2430
+ .dsh-kanban-controls {
2431
+ padding: 6px 10px;
2432
+ gap: 6px;
2433
+ }
2434
+
2435
+ .dsh-kanban-btn-start,
2436
+ .dsh-kanban-btn-prepare {
2437
+ padding: 5px 10px;
2438
+ font-size: 12px;
2439
+ }
2440
+
2441
+ .dsh-kanban-search-box {
2442
+ width: 100%;
2443
+ margin-left: 0;
2444
+ }
2445
+
2446
+ .dsh-kanban-search-input {
2447
+ width: 100%;
2448
+ padding: 5px 24px 5px 8px;
2449
+ font-size: 12px;
2450
+ }
2451
+
2452
+ .dsh-kanban-scroll {
2453
+ padding: 8px 10px;
2454
+ gap: 8px;
2455
+ }
2456
+
2457
+ .dsh-kanban-section {
2458
+ flex-shrink: 0;
2459
+ width: 100%;
2460
+ box-sizing: border-box;
2461
+ }
2462
+
2463
+ .dsh-kanban-lane-body {
2464
+ box-sizing: border-box;
2465
+ }
2466
+
2467
+ .dsh-kanban-card {
2468
+ padding: 8px 10px;
2469
+ box-sizing: border-box;
2470
+ width: 100%;
2471
+ }
2472
+
2473
+ .dsh-kanban-card-title {
2474
+ font-size: 13px;
2475
+ }
2476
+
2477
+ .dsh-kanban-section.is-collapsed .dsh-kanban-lane-body {
2478
+ display: none;
2479
+ }
2480
+
2481
+ .dsh-kanban-section.is-empty .dsh-kanban-lane-body {
2482
+ min-height: 0;
2483
+ padding: 4px 8px;
2484
+ }
2485
+
2486
+ .dsh-kanban-section.is-empty .dsh-kanban-empty {
2487
+ padding: 4px 0;
2488
+ font-size: 11px;
2489
+ }
2490
+
2491
+ .dsh-kanban-collapse-icon {
2492
+ display: inline-block;
2493
+ font-size: 10px;
2494
+ width: 12px;
2495
+ color: var(--dsw-alias-label-secondary, #64748b);
2496
+ }
2497
+
2498
+ .dsh-kanban-card-mobile-actions {
2499
+ display: flex;
2500
+ align-items: center;
2501
+ gap: 6px;
2502
+ margin-top: 6px;
2503
+ padding-top: 6px;
2504
+ border-top: 0.5px solid var(--dsw-alias-border-l1, #e2e8f0);
2505
+ }
2506
+
2507
+ .dsh-kanban-btn-mobile-action {
2508
+ display: inline-flex;
2509
+ align-items: center;
2510
+ gap: 4px;
2511
+ padding: 4px 8px;
2512
+ font-size: 11px;
2513
+ font-weight: 500;
2514
+ border-radius: 4px;
2515
+ border: 1px solid var(--dsw-alias-border-l1, #cbd5e1);
2516
+ background: var(--dsw-alias-bg-module-platform);
2517
+ color: var(--dsw-alias-label-primary, #1e293b);
2518
+ cursor: pointer;
2519
+ line-height: 1.2;
2520
+ touch-action: manipulation;
2521
+ }
2522
+
2523
+ .dsh-kanban-btn-mobile-action:hover {
2524
+ background: var(--dsw-alias-interactive-bg-hover);
2525
+ }
2526
+
2527
+ .dsh-kanban-btn-mobile-action.is-primary {
2528
+ background: var(--dsw-alias-state-business-primary, #2563eb);
2529
+ color: #ffffff;
2530
+ border-color: var(--dsw-alias-state-business-primary, #2563eb);
2531
+ }
2532
+
2533
+ .dsh-kanban-btn-mobile-action.is-primary:hover {
2534
+ opacity: 0.9;
2535
+ }
2536
+ }
2537
+
2538
+ .dsh-kanban-section {
2539
+ border: 0.5px solid var(--dsw-alias-border-l2);
2540
+ border-radius: var(--dsw-radius-sm);
2541
+ background: var(--dsw-alias-bg-module-platform);
2542
+ overflow: hidden;
2543
+ transition: border-color var(--ds-transition-duration-fast, 0.1s) var(--ds-ease-in-out, ease);
2544
+ }
2545
+
2546
+ .dsh-kanban-section.drag-over {
2547
+ border-color: var(--dsw-alias-state-business-primary, #2563eb);
2548
+ background: var(--dsw-alias-state-business-tertiary);
2549
+ }
2550
+
2551
+ .dsh-kanban-section-header {
2552
+ display: flex;
2553
+ align-items: center;
2554
+ justify-content: space-between;
2555
+ padding: 8px 12px;
2556
+ cursor: pointer;
2557
+ user-select: none;
2558
+ font-weight: 600;
2559
+ font-size: 12px;
2560
+ text-transform: uppercase;
2561
+ letter-spacing: 0.03em;
2562
+ background: transparent;
2563
+ }
2564
+
2565
+ .dsh-kanban-section-title-wrap {
2566
+ display: flex;
2567
+ align-items: center;
2568
+ gap: 8px;
2569
+ }
2570
+
2571
+ .dsh-kanban-pill {
2572
+ padding: 1px 6px;
2573
+ border-radius: 9999px;
2574
+ font-size: 11px;
2575
+ font-weight: 600;
2576
+ background: var(--dsw-alias-bg-base);
2577
+ color: var(--dsw-alias-label-secondary, #475569);
2578
+ border: 0.5px solid var(--dsw-alias-border-l1, #cbd5e1);
2579
+ }
2580
+
2581
+ .dsh-kanban-lane-body {
2582
+ padding: 8px;
2583
+ display: flex;
2584
+ flex-direction: column;
2585
+ gap: 8px;
2586
+ min-height: 32px;
2587
+ }
2588
+
2589
+ .dsh-kanban-new-card {
2590
+ background: var(--dsw-alias-bg-base);
2591
+ border: 1px solid var(--dsw-alias-state-business-primary, #2563eb);
2592
+ border-radius: 6px;
2593
+ padding: 8px 10px;
2594
+ display: flex;
2595
+ flex-direction: column;
2596
+ gap: 8px;
2597
+ box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
2598
+ }
2599
+
2600
+ .dsh-kanban-prepare-label {
2601
+ font-size: 11px;
2602
+ font-weight: 600;
2603
+ color: var(--dsw-alias-state-business-primary, #2563eb);
2604
+ text-transform: uppercase;
2605
+ letter-spacing: 0.04em;
2606
+ }
2607
+
2608
+ .dsh-kanban-new-card-input {
2609
+ width: 100%;
2610
+ padding: 6px 8px;
2611
+ font-size: 13px;
2612
+ border: 1px solid var(--dsw-alias-border-l1, #cbd5e1);
2613
+ border-radius: 4px;
2614
+ background: var(--dsw-alias-bg-base);
2615
+ color: inherit;
2616
+ box-sizing: border-box;
2617
+ outline: none;
2618
+ }
2619
+
2620
+ .dsh-kanban-new-card-input:focus {
2621
+ border-color: var(--dsw-alias-state-business-primary, #2563eb);
2622
+ }
2623
+
2624
+ .dsh-kanban-new-card-textarea {
2625
+ width: 100%;
2626
+ padding: 6px 8px;
2627
+ font-size: 12px;
2628
+ line-height: 1.4;
2629
+ border: 1px solid var(--dsw-alias-border-l1, #cbd5e1);
2630
+ border-radius: 4px;
2631
+ background: var(--dsw-alias-bg-base);
2632
+ color: inherit;
2633
+ box-sizing: border-box;
2634
+ outline: none;
2635
+ resize: vertical;
2636
+ min-height: 54px;
2637
+ font-family: inherit;
2638
+ }
2639
+
2640
+ .dsh-kanban-new-card-textarea:focus {
2641
+ border-color: var(--dsw-alias-state-business-primary, #2563eb);
2642
+ }
2643
+
2644
+ .dsh-kanban-new-card-actions {
2645
+ display: flex;
2646
+ align-items: center;
2647
+ gap: 6px;
2648
+ }
2649
+
2650
+ .dsh-kanban-btn-add {
2651
+ background: var(--dsw-alias-state-business-primary, #2563eb);
2652
+ color: #ffffff;
2653
+ border: none;
2654
+ border-radius: 4px;
2655
+ padding: 4px 10px;
2656
+ font-size: 11px;
2657
+ font-weight: 500;
2658
+ cursor: pointer;
2659
+ transition: opacity 0.15s ease;
2660
+ }
2661
+
2662
+ .dsh-kanban-btn-add:hover {
2663
+ opacity: 0.9;
2664
+ }
2665
+
2666
+ .dsh-kanban-btn-cancel {
2667
+ background: transparent;
2668
+ color: var(--dsw-alias-label-secondary, #64748b);
2669
+ border: none;
2670
+ border-radius: 4px;
2671
+ padding: 4px 8px;
2672
+ font-size: 11px;
2673
+ cursor: pointer;
2674
+ }
2675
+
2676
+ .dsh-kanban-btn-cancel:hover {
2677
+ color: var(--dsw-alias-label-primary, #1e293b);
2678
+ }
2679
+
2680
+ .dsh-kanban-card {
2681
+ background: var(--dsw-alias-bg-base);
2682
+ border: 1px solid var(--dsw-alias-border-l1, #e2e8f0);
2683
+ border-radius: 6px;
2684
+ padding: 10px 12px;
2685
+ cursor: pointer;
2686
+ transition: transform 0.1s ease, border-color 0.15s ease, box-shadow 0.15s ease;
2687
+ box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
2688
+ }
2689
+
2690
+ .dsh-kanban-card:hover {
2691
+ border-color: var(--dsw-alias-state-business-primary, #2563eb);
2692
+ transform: translateY(-1px);
2693
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
2694
+ }
2695
+
2696
+ .dsh-kanban-card[draggable="true"] {
2697
+ cursor: grab;
2698
+ }
2699
+
2700
+ .dsh-kanban-card[draggable="true"]:active {
2701
+ cursor: grabbing;
2702
+ }
2703
+
2704
+ .dsh-kanban-card.is-active-session {
2705
+ border-left: 3px solid var(--dsw-alias-state-business-primary, #2563eb);
2706
+ }
2707
+
2708
+ .dsh-kanban-card.is-alert {
2709
+ border-left: 3px solid var(--dsw-alias-state-error-primary);
2710
+ }
2711
+
2712
+ .dsh-kanban-card.is-pinned {
2713
+ border-top: 2px solid var(--dsw-alias-state-business-primary, #2563eb);
2714
+ }
2715
+
2716
+ .dsh-kanban-card-header {
2717
+ display: flex;
2718
+ align-items: flex-start;
2719
+ justify-content: space-between;
2720
+ gap: 6px;
2721
+ margin-bottom: 6px;
2722
+ }
2723
+
2724
+ @media (max-width: 767px) {
2725
+ .dsh-kanban-card-header {
2726
+ margin-bottom: 4px;
2727
+ }
2728
+ }
2729
+
2730
+ .dsh-kanban-card-title {
2731
+ flex: 1;
2732
+ min-width: 0;
2733
+ font-size: 14px;
2734
+ font-weight: 500;
2735
+ line-height: 20px;
2736
+ word-break: break-word;
2737
+ user-select: none;
2738
+ }
2739
+
2740
+ .dsh-kanban-card-pin-btn {
2741
+ background: transparent;
2742
+ border: none;
2743
+ padding: 2px 4px;
2744
+ border-radius: 4px;
2745
+ cursor: pointer;
2746
+ color: var(--dsw-alias-label-tertiary, #94a3b8);
2747
+ display: inline-flex;
2748
+ align-items: center;
2749
+ justify-content: center;
2750
+ transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
2751
+ flex-shrink: 0;
2752
+ opacity: 0;
2753
+ pointer-events: none;
2754
+ }
2755
+
2756
+ .dsh-kanban-card:hover .dsh-kanban-card-pin-btn,
2757
+ .dsh-kanban-card-pin-btn:focus-visible,
2758
+ .dsh-kanban-card-pin-btn.is-pinned {
2759
+ opacity: 1;
2760
+ pointer-events: auto;
2761
+ }
2762
+
2763
+ .dsh-kanban-card-pin-btn:focus-visible {
2764
+ outline: 2px solid var(--dsw-alias-state-business-primary, #2563eb);
2765
+ outline-offset: 1px;
2766
+ }
2767
+
2768
+ @media (hover: none), (pointer: coarse) {
2769
+ .dsh-kanban-card-pin-btn {
2770
+ opacity: 1;
2771
+ pointer-events: auto;
2772
+ }
2773
+ }
2774
+
2775
+ .dsh-kanban-card-pin-btn:hover {
2776
+ background: var(--dsw-alias-interactive-bg-hover);
2777
+ color: var(--dsw-alias-state-business-primary, #2563eb);
2778
+ }
2779
+
2780
+ .dsh-kanban-card-pin-btn.is-pinned {
2781
+ color: var(--dsw-alias-state-business-primary, #2563eb);
2782
+ }
2783
+
2784
+ .dsh-kanban-card-footer {
2785
+ display: flex;
2786
+ align-items: center;
2787
+ justify-content: space-between;
2788
+ font-size: 11px;
2789
+ color: var(--dsw-alias-label-secondary, #64748b);
2790
+ margin-top: 4px;
2791
+ gap: 8px;
2792
+ }
2793
+
2794
+ .dsh-session-links { flex: none; }
2795
+
2796
+ .dsh-session-links-trigger:focus-visible {
2797
+ outline: 2px solid currentColor;
2798
+ outline-offset: 2px;
2799
+ }
2800
+
2801
+ .dsh-session-links-menu { max-width: min(320px, calc(100vw - 24px)); }
2802
+
2803
+ .dsh-session-link {
2804
+ white-space: normal;
2805
+ overflow-wrap: anywhere;
2806
+ }
2807
+
2808
+ .dsh-kanban-badge-running {
2809
+ display: inline-flex;
2810
+ align-items: center;
2811
+ gap: 4px;
2812
+ color: var(--dsw-alias-state-success-primary);
2813
+ font-weight: 600;
2814
+ }
2815
+
2816
+ .dsh-kanban-badge-hold {
2817
+ display: inline-flex;
2818
+ align-items: center;
2819
+ font-size: 10px;
2820
+ font-weight: 500;
2821
+ padding: 1px 5px;
2822
+ border-radius: 4px;
2823
+ background: var(--dsw-alias-bg-module-platform);
2824
+ color: var(--dsw-alias-label-secondary, #64748b);
2825
+ border: 1px solid var(--dsw-alias-border-l1, #cbd5e1);
2826
+ margin-left: 6px;
2827
+ }
2828
+
2829
+ .dsh-kanban-pane-status {
2830
+ display: inline-block;
2831
+ position: relative;
2832
+ width: 6px;
2833
+ height: 1cap;
2834
+ }
2835
+
2836
+ .dsh-kanban-pane-status .dsh-kanban-badge-dot {
2837
+ position: absolute;
2838
+ inset: 0;
2839
+ margin: auto;
2840
+ }
2841
+
2842
+ .dsh-kanban-badge-dot {
2843
+ width: 6px;
2844
+ height: 6px;
2845
+ border-radius: 50%;
2846
+ display: inline-block;
2847
+ flex-shrink: 0;
2848
+ transition: background-color 0.1s ease;
2849
+ }
2850
+
2851
+ .dsh-kanban-badge-dot.is-active {
2852
+ background: var(--dsw-alias-state-success-primary);
2853
+ animation: dsh-pulse 1.5s infinite;
2854
+ }
2855
+
2856
+ .dsh-kanban-badge-dot.is-review {
2857
+ background: var(--dsw-alias-state-warn-primary);
2858
+ }
2859
+
2860
+ .dsh-kanban-badge-dot.is-alert {
2861
+ background: var(--dsw-alias-state-error-primary);
2862
+ box-shadow: 0 0 0 2px color-mix(in srgb, var(--dsw-alias-state-error-primary) 20%, transparent);
2863
+ animation: dsh-pulse 1.5s infinite;
2864
+ }
2865
+
2866
+ .dsh-kanban-badge-dot.is-todo {
2867
+ background: var(--dsw-alias-state-idle-primary);
2868
+ }
2869
+
2870
+ .dsh-kanban-badge-dot.is-done {
2871
+ background: var(--dsw-alias-label-tertiary, #94a3b8);
2872
+ }
2873
+
2874
+ @media (prefers-reduced-motion: reduce) {
2875
+ .dsh-kanban-badge-dot:is(.is-active, .is-alert) {
2876
+ animation: none;
2877
+ }
2878
+ }
2879
+
2880
+ .dsh-kanban-badge-alert-pill {
2881
+ display: inline-flex;
2882
+ align-items: center;
2883
+ gap: 4px;
2884
+ font-size: 10px;
2885
+ font-weight: 600;
2886
+ padding: 1px 6px;
2887
+ border-radius: 4px;
2888
+ background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 10%, transparent);
2889
+ color: var(--dsw-alias-state-error-primary);
2890
+ border: 1px solid color-mix(in srgb, var(--dsw-alias-state-error-primary) 30%, transparent);
2891
+ }
2892
+
2893
+ .dsh-kanban-badge-alert-pill .dsh-kanban-badge-dot {
2894
+ background: var(--dsw-alias-state-error-primary);
2895
+ }
2896
+
2897
+ @keyframes dsh-pulse {
2898
+ 0% { opacity: 1; }
2899
+ 50% { opacity: 0.4; }
2900
+ 100% { opacity: 1; }
2901
+ }
2902
+
2903
+ .dsh-kanban-btn-action {
2904
+ background: var(--dsw-alias-bg-module-platform);
2905
+ color: var(--dsw-alias-label-primary, #1e293b);
2906
+ border: 1px solid var(--dsw-alias-border-l1, #cbd5e1);
2907
+ border-radius: 4px;
2908
+ padding: 3px 8px;
2909
+ font-size: 11px;
2910
+ cursor: pointer;
2911
+ transition: all 0.15s ease;
2912
+ }
2913
+
2914
+ .dsh-kanban-btn-action:hover {
2915
+ background: var(--dsw-alias-state-business-primary, #2563eb);
2916
+ color: #ffffff;
2917
+ border-color: var(--dsw-alias-state-business-primary, #2563eb);
2918
+ }
2919
+
2920
+ .dsh-kanban-btn-start-card {
2921
+ color: var(--dsw-alias-state-business-primary, #2563eb);
2922
+ font-weight: 600;
2923
+ }
2924
+
2925
+ .dsh-kanban-empty {
2926
+ font-size: 12px;
2927
+ color: var(--dsw-alias-label-tertiary, #94a3b8);
2928
+ text-align: center;
2929
+ padding: 12px 0;
2930
+ font-style: italic;
2931
+ }
2932
+
2933
+ .dsh-kanban-recycle-bin {
2934
+ margin: 8px 12px;
2935
+ padding: 10px;
2936
+ border: 1.5px dashed var(--dsw-alias-state-error-primary);
2937
+ background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 8%, transparent);
2938
+ color: var(--dsw-alias-state-error-primary);
2939
+ border-radius: 6px;
2940
+ display: flex;
2941
+ align-items: center;
2942
+ justify-content: center;
2943
+ gap: 8px;
2944
+ font-size: 12px;
2945
+ font-weight: 500;
2946
+ transition: all 0.15s ease;
2947
+ user-select: none;
2948
+ }
2949
+
2950
+ .dsh-kanban-recycle-bin.is-drag-over {
2951
+ background: color-mix(in srgb, var(--dsw-alias-state-error-primary) 18%, transparent);
2952
+ border-color: var(--dsw-alias-state-error-primary);
2953
+ transform: scale(1.01);
2954
+ }
2955
+
2956
+ /* Badges across kanban views (consistent blue for in-progress, orange for review) */
2957
+ .dsh-kanban-badge {
2958
+ font-size: 10px;
2959
+ font-weight: 700;
2960
+ border-radius: 9999px;
2961
+ padding: 0 5px;
2962
+ height: 15px;
2963
+ min-width: 15px;
2964
+ display: inline-flex;
2965
+ align-items: center;
2966
+ justify-content: center;
2967
+ line-height: 1;
2968
+ box-sizing: border-box;
2969
+ }
2970
+
2971
+ .dsh-kanban-badge.is-active {
2972
+ background: var(--dsw-alias-state-success-primary);
2973
+ color: #ffffff;
2974
+ }
2975
+
2976
+ .dsh-kanban-badge.is-review {
2977
+ background: var(--dsw-alias-state-warn-primary);
2978
+ color: #ffffff;
2979
+ }
2980
+
2981
+ .dsh-kanban-badge.is-alert {
2982
+ background: var(--dsw-alias-state-error-primary);
2983
+ color: #ffffff;
2984
+ }
2985
+
2986
+ /* --- Left Sidebar In-Flight Kanban Styles (matching native Workspace Browser) --- */
2987
+
2988
+ .dsh-inflight-sidebar {
2989
+ display: flex;
2990
+ flex-direction: column;
2991
+ height: 100%;
2992
+ width: 100%;
2993
+ box-sizing: border-box;
2994
+ font-family: inherit;
2995
+ font-size: 14px;
2996
+ color: var(--dsw-alias-label-primary, #1e293b);
2997
+ padding: 0;
2998
+ }
2999
+
3000
+ .dsh-inflight-sidebar-header {
3001
+ flex: none;
3002
+ display: flex;
3003
+ align-items: center;
3004
+ justify-content: space-between;
3005
+ gap: 4px;
3006
+ min-height: 36px;
3007
+ height: 36px;
3008
+ margin: 0 0 4px;
3009
+ padding: 0 8px 0 0;
3010
+ box-sizing: border-box;
3011
+ width: calc(100% - var(--dsh-sidebar-inline-padding, 8px));
3012
+ color: var(--dsw-alias-label-primary, #1e293b);
3013
+ }
3014
+
3015
+ /* Native .panelRow: 3px paint inset, 9px inline padding, 6px label gap. */
3016
+ .dsh-inflight-header-clickable {
3017
+ display: flex;
3018
+ align-items: center;
3019
+ gap: var(--dsh-sidebar-label-gap, 6px);
3020
+ min-height: 36px;
3021
+ height: 36px;
3022
+ padding: 7px calc(
3023
+ var(--dsh-sidebar-row-padding, 12px) - var(--dsh-sidebar-paint-inset, 3px)
3024
+ );
3025
+ margin: 0;
3026
+ box-sizing: border-box;
3027
+ border: none;
3028
+ border-inline: var(--dsh-sidebar-paint-inset, 3px) solid transparent;
3029
+ border-radius: var(--dsw-radius-md);
3030
+ background: transparent;
3031
+ background-clip: padding-box;
3032
+ color: var(--dsw-alias-label-primary, #1e293b);
3033
+ font: inherit;
3034
+ line-height: 22px;
3035
+ text-align: left;
3036
+ cursor: pointer;
3037
+ flex: 1;
3038
+ min-width: 0;
3039
+ transition: background 0.15s ease;
3040
+ }
3041
+
3042
+ .dsh-inflight-header-clickable:hover {
3043
+ background-color: var(--dsw-alias-interactive-bg-hover);
3044
+ color: var(--dsw-alias-label-primary, #1e293b);
3045
+ }
3046
+
3047
+ .dsh-inflight-header-clickable:hover .dsh-inflight-sidebar-title {
3048
+ color: var(--dsw-alias-label-primary, #1e293b);
3049
+ }
3050
+
3051
+ .dsh-inflight-header-icon {
3052
+ flex: none;
3053
+ width: 16px;
3054
+ height: 16px;
3055
+ display: inline-flex;
3056
+ align-items: center;
3057
+ justify-content: center;
3058
+ color: inherit;
3059
+ }
3060
+
3061
+ .dsh-inflight-sidebar-title {
3062
+ font-size: 14px;
3063
+ line-height: 22px;
3064
+ font-weight: 400;
3065
+ color: var(--dsw-alias-label-primary, #1e293b);
3066
+ overflow: hidden;
3067
+ text-overflow: ellipsis;
3068
+ white-space: nowrap;
3069
+ }
3070
+
3071
+ .dsh-inflight-badges {
3072
+ display: inline-flex;
3073
+ align-items: center;
3074
+ gap: 4px;
3075
+ flex-shrink: 0;
3076
+ }
3077
+
3078
+ .dsh-inflight-btn-close {
3079
+ flex: none;
3080
+ width: 24px;
3081
+ height: 24px;
3082
+ margin: 0;
3083
+ display: inline-flex;
3084
+ align-items: center;
3085
+ justify-content: center;
3086
+ border-radius: var(--dsw-radius-xs);
3087
+ border: none;
3088
+ background: transparent;
3089
+ color: var(--dsw-alias-label-secondary, #64748b);
3090
+ cursor: pointer;
3091
+ padding: 0;
3092
+ box-sizing: border-box;
3093
+ transition: all 0.15s ease;
3094
+ }
3095
+
3096
+ .dsh-inflight-btn-close:hover {
3097
+ background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.05));
3098
+ color: var(--dsw-alias-label-primary, #1e293b);
3099
+ }
3100
+
3101
+ .dsh-inflight-sidebar-list {
3102
+ flex: 1;
3103
+ min-height: 0;
3104
+ overflow-y: auto;
3105
+ overflow-x: hidden;
3106
+ margin-inline-end: 2px;
3107
+ padding: 0 calc(var(--dsh-sidebar-inline-padding, 8px) - 5px - 2px) 16px 0;
3108
+ scrollbar-gutter: stable;
3109
+ display: flex;
3110
+ flex-direction: column;
3111
+ width: calc(100% - 2px);
3112
+ box-sizing: border-box;
3113
+ }
3114
+
3115
+ /* Workspace Group Section */
3116
+ .dsh-inflight-ws-group {
3117
+ position: relative;
3118
+ display: flex;
3119
+ flex-direction: column;
3120
+ width: 100%;
3121
+ box-sizing: border-box;
3122
+ }
3123
+
3124
+ .dsh-inflight-ws-group + .dsh-inflight-ws-group {
3125
+ margin-top: 4px;
3126
+ }
3127
+
3128
+ .dsh-inflight-ws-header-row {
3129
+ display: flex;
3130
+ align-items: center;
3131
+ width: 100%;
3132
+ height: 34px;
3133
+ border-radius: var(--dsw-radius-md);
3134
+ border-inline: var(--dsh-sidebar-paint-inset, 3px) solid transparent;
3135
+ background-clip: padding-box;
3136
+ padding: 0 8px;
3137
+ padding-inline-start: calc(
3138
+ var(--dsh-sidebar-row-padding, 12px) - var(--dsh-sidebar-paint-inset, 3px)
3139
+ );
3140
+ box-sizing: border-box;
3141
+ color: var(--dsw-alias-label-primary, #1e293b);
3142
+ cursor: pointer;
3143
+ user-select: none;
3144
+ }
3145
+
3146
+ .dsh-inflight-ws-header-row:hover {
3147
+ background-color: var(--dsw-alias-interactive-bg-hover);
3148
+ }
3149
+
3150
+ .dsh-inflight-ws-header {
3151
+ flex: 1;
3152
+ min-width: 0;
3153
+ display: flex;
3154
+ align-items: center;
3155
+ gap: 6px;
3156
+ height: 100%;
3157
+ border: none;
3158
+ background: transparent;
3159
+ padding: 0;
3160
+ cursor: pointer;
3161
+ font: inherit;
3162
+ text-align: left;
3163
+ color: inherit;
3164
+ }
3165
+
3166
+ .dsh-inflight-ws-icon {
3167
+ flex: none;
3168
+ width: 16px;
3169
+ height: 20px;
3170
+ display: inline-flex;
3171
+ align-items: center;
3172
+ justify-content: center;
3173
+ color: var(--dsw-alias-label-tertiary, #81858c);
3174
+ }
3175
+
3176
+ .dsh-inflight-ws-title {
3177
+ flex: 0 1 auto;
3178
+ min-width: 0;
3179
+ overflow: hidden;
3180
+ text-overflow: ellipsis;
3181
+ white-space: nowrap;
3182
+ font-size: 14px;
3183
+ line-height: 20px;
3184
+ font-weight: 400;
3185
+ color: var(--dsw-alias-label-primary, #1e293b);
3186
+ }
3187
+
3188
+ .dsh-inflight-btn-add-task {
3189
+ flex: none;
3190
+ display: inline-flex;
3191
+ align-items: center;
3192
+ justify-content: center;
3193
+ width: 20px;
3194
+ height: 20px;
3195
+ min-width: 20px;
3196
+ min-height: 20px;
3197
+ border: none;
3198
+ border-radius: var(--dsw-radius-xs);
3199
+ padding: 0;
3200
+ background: transparent;
3201
+ cursor: pointer;
3202
+ color: var(--dsw-alias-label-tertiary, #81858c);
3203
+ transition: all 0.15s ease;
3204
+ margin-left: auto;
3205
+ }
3206
+
3207
+ .dsh-inflight-btn-add-task:hover {
3208
+ background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.06));
3209
+ color: var(--dsw-alias-label-primary, #1e293b);
3210
+ }
3211
+
3212
+ .dsh-inflight-ws-cards {
3213
+ display: flex;
3214
+ flex-direction: column;
3215
+ width: 100%;
3216
+ box-sizing: border-box;
3217
+ margin-top: 2px;
3218
+ margin-bottom: 4px;
3219
+ }
3220
+
3221
+ .dsh-inflight-ws-cards > * + * {
3222
+ margin-top: 2px;
3223
+ }
3224
+
3225
+ /* In-flight Session Card (styled to match native DSH sessionRow) */
3226
+ .dsh-inflight-card {
3227
+ width: 100%;
3228
+ height: 32px;
3229
+ display: flex;
3230
+ align-items: center;
3231
+ gap: 0;
3232
+ border-radius: var(--dsw-radius-md);
3233
+ border-inline: var(--dsh-sidebar-paint-inset, 3px) solid transparent;
3234
+ background-clip: padding-box;
3235
+ padding: 0 8px;
3236
+ padding-inline-start: calc(
3237
+ var(--dsh-sidebar-row-padding, 12px) - var(--dsh-sidebar-paint-inset, 3px)
3238
+ );
3239
+ cursor: pointer;
3240
+ user-select: none;
3241
+ color: var(--dsw-alias-label-primary, #1e293b);
3242
+ box-sizing: border-box;
3243
+ transition: background 0.1s ease;
3244
+ }
3245
+
3246
+ .dsh-inflight-card:hover {
3247
+ background-color: var(--dsw-alias-interactive-bg-hover);
3248
+ }
3249
+
3250
+ .dsh-inflight-card.is-current {
3251
+ background-color: var(--dsw-alias-interactive-bg-hover);
3252
+ }
3253
+
3254
+ .dsh-inflight-card.is-focused {
3255
+ background-color: var(--dsw-alias-interactive-bg-active);
3256
+ }
3257
+
3258
+ .dsh-inflight-card.is-focused .dsh-inflight-card-title {
3259
+ font-weight: 400;
3260
+ }
3261
+
3262
+ .dsh-inflight-card.is-alert {
3263
+ border-inline-start-color: var(--dsw-alias-state-error-primary);
3264
+ }
3265
+
3266
+ .dsh-inflight-card-content {
3267
+ flex: 1;
3268
+ min-width: 0;
3269
+ display: flex;
3270
+ align-items: center;
3271
+ gap: 2px;
3272
+ height: 100%;
3273
+ margin-inline-start: var(--dsh-sidebar-label-gap, 6px);
3274
+ }
3275
+
3276
+ .dsh-inflight-card-main {
3277
+ flex: 1;
3278
+ min-width: 0;
3279
+ display: flex;
3280
+ align-items: center;
3281
+ gap: 0;
3282
+ height: 100%;
3283
+ border: none;
3284
+ background: transparent;
3285
+ padding: 0;
3286
+ cursor: pointer;
3287
+ font: inherit;
3288
+ color: inherit;
3289
+ text-align: left;
3290
+ }
3291
+
3292
+ .dsh-inflight-card-slot {
3293
+ color: var(--dsw-alias-label-tertiary, #81858c);
3294
+ flex: none;
3295
+ width: 16px;
3296
+ height: 20px;
3297
+ display: inline-flex;
3298
+ align-items: center;
3299
+ justify-content: center;
3300
+ }
3301
+
3302
+ .dsh-inflight-card-slot-status {
3303
+ display: inline-flex;
3304
+ align-items: center;
3305
+ justify-content: center;
3306
+ }
3307
+
3308
+ /* Native row icon buttons keep a 24px hover target on a 16px layout footprint
3309
+ * through compensated margins (ui-workspace Rows.module.css .iconButton). */
3310
+ .dsh-inflight-btn-slot-close {
3311
+ flex: none;
3312
+ display: none;
3313
+ align-items: center;
3314
+ justify-content: center;
3315
+ width: 24px;
3316
+ height: 24px;
3317
+ margin: -4px;
3318
+ padding: 0;
3319
+ border: none;
3320
+ background: transparent;
3321
+ cursor: pointer;
3322
+ color: var(--dsw-alias-label-tertiary, #81858c);
3323
+ border-radius: var(--dsw-radius-xs);
3324
+ transition: color 0.12s ease, background-color 0.12s ease;
3325
+ box-sizing: border-box;
3326
+ }
3327
+
3328
+ .dsh-inflight-card.has-slot-close:hover .dsh-inflight-btn-slot-close,
3329
+ .dsh-inflight-card.has-slot-close:focus-within .dsh-inflight-btn-slot-close {
3330
+ display: inline-flex;
3331
+ }
3332
+
3333
+ .dsh-inflight-card.has-slot-close:hover .dsh-inflight-card-slot-status,
3334
+ .dsh-inflight-card.has-slot-close:focus-within .dsh-inflight-card-slot-status {
3335
+ display: none;
3336
+ }
3337
+
3338
+ .dsh-inflight-btn-slot-close:hover,
3339
+ .dsh-inflight-btn-slot-close:focus-visible {
3340
+ background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.05));
3341
+ color: var(--dsw-alias-label-primary, #1e293b);
3342
+ }
3343
+
3344
+ .dsh-inflight-rail-session-dot svg {
3345
+ color: var(--dsw-alias-label-tertiary, #81858c);
3346
+ }
3347
+
3348
+ .dsh-inflight-btn-fullscreen-toggle {
3349
+ flex: none;
3350
+ width: 24px;
3351
+ height: 24px;
3352
+ margin: -4px;
3353
+ padding: 0;
3354
+ border: none;
3355
+ background: transparent;
3356
+ cursor: pointer;
3357
+ color: var(--dsw-alias-state-business-primary, #3964fe);
3358
+ border-radius: var(--dsw-radius-xs);
3359
+ transition: color 0.12s ease, background-color 0.12s ease;
3360
+ box-sizing: border-box;
3361
+ }
3362
+
3363
+ .dsh-inflight-btn-fullscreen-toggle:hover,
3364
+ .dsh-inflight-btn-fullscreen-toggle:focus-visible {
3365
+ background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.05));
3366
+ }
3367
+
3368
+ .dsh-inflight-btn-fullscreen-toggle:is(.is-active, .is-pressed, [aria-pressed="true"]) {
3369
+ background: var(--dsw-alias-interactive-bg-active, rgba(0, 0, 0, 0.08));
3370
+ color: var(--dsw-alias-state-business-primary, #3964fe);
3371
+ }
3372
+
3373
+ .dsh-inflight-btn-fullscreen-toggle:is(.is-active, .is-pressed, [aria-pressed="true"]):hover,
3374
+ .dsh-inflight-btn-fullscreen-toggle:is(.is-active, .is-pressed, [aria-pressed="true"]):focus-visible {
3375
+ background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.12));
3376
+ }
3377
+
3378
+ .dsh-inflight-card-title {
3379
+ flex: 1;
3380
+ min-width: 0;
3381
+ overflow: hidden;
3382
+ text-overflow: ellipsis;
3383
+ white-space: nowrap;
3384
+ margin-inline-end: var(--dsh-sidebar-label-gap, 6px);
3385
+ font-size: 14px;
3386
+ line-height: 20px;
3387
+ }
3388
+
3389
+ .dsh-inflight-card-time {
3390
+ flex: none;
3391
+ font-size: 10px;
3392
+ line-height: 16px;
3393
+ color: var(--dsw-alias-label-tertiary, #81858c);
3394
+ margin-left: auto;
3395
+ margin-inline-end: -1px;
3396
+ }
3397
+
3398
+ .dsh-inflight-card-actions {
3399
+ flex: none;
3400
+ display: none;
3401
+ align-items: center;
3402
+ gap: 13px;
3403
+ margin-left: auto;
3404
+ }
3405
+
3406
+ .dsh-inflight-card:hover .dsh-inflight-card-actions,
3407
+ .dsh-inflight-card:focus-within .dsh-inflight-card-actions {
3408
+ display: inline-flex;
3409
+ }
3410
+
3411
+ .dsh-inflight-card:hover .dsh-inflight-card-time,
3412
+ .dsh-inflight-card:focus-within .dsh-inflight-card-time {
3413
+ display: none;
3414
+ }
3415
+
3416
+ /* Touch / mobile fallback: when hover is unavailable, show actions on the active task */
3417
+ @media (hover: none), (pointer: coarse) {
3418
+ .dsh-inflight-card.is-current .dsh-inflight-card-actions {
3419
+ display: inline-flex;
3420
+ }
3421
+ .dsh-inflight-card.is-current .dsh-inflight-card-time {
3422
+ display: none;
3423
+ }
3424
+ }
3425
+
3426
+ .dsh-inflight-btn-action {
3427
+ width: 24px;
3428
+ height: 24px;
3429
+ min-width: 24px;
3430
+ min-height: 24px;
3431
+ margin: -4px;
3432
+ padding: 0;
3433
+ display: inline-flex;
3434
+ align-items: center;
3435
+ justify-content: center;
3436
+ border-radius: var(--dsw-radius-xs);
3437
+ border: none;
3438
+ background: transparent;
3439
+ cursor: pointer;
3440
+ color: var(--dsw-alias-label-tertiary, #81858c);
3441
+ transition: all 0.12s ease;
3442
+ box-sizing: border-box;
3443
+ }
3444
+
3445
+ .dsh-inflight-btn-action:disabled,
3446
+ .dsh-inflight-btn-action.is-disabled {
3447
+ opacity: 0.25;
3448
+ cursor: not-allowed;
3449
+ pointer-events: none;
3450
+ }
3451
+
3452
+ .dsh-inflight-btn-action:hover {
3453
+ background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.05));
3454
+ color: var(--dsw-alias-label-primary, #1e293b);
3455
+ }
3456
+
3457
+ .dsh-inflight-btn-action.is-done:hover {
3458
+ background: color-mix(in srgb, var(--dsw-alias-state-success-primary) 14%, transparent);
3459
+ color: var(--dsw-alias-state-success-primary);
3460
+ }
3461
+
3462
+ .dsh-inflight-btn-action.is-hold:hover {
3463
+ background: color-mix(in srgb, var(--dsw-alias-state-warn-primary) 14%, transparent);
3464
+ color: var(--dsw-alias-state-warn-primary);
3465
+ }
3466
+
3467
+ @media (hover: none), (pointer: coarse) {
3468
+ .dsh-inflight-btn-action {
3469
+ width: 26px;
3470
+ height: 26px;
3471
+ min-width: 26px;
3472
+ min-height: 26px;
3473
+ }
3474
+ .dsh-inflight-btn-action:active {
3475
+ transform: scale(0.92);
3476
+ }
3477
+ }
3478
+
3479
+ /* Rail mode */
3480
+ .dsh-inflight-sidebar-rail {
3481
+ display: flex;
3482
+ flex-direction: column;
3483
+ align-items: center;
3484
+ gap: 8px;
3485
+ padding: 10px 0;
3486
+ width: 100%;
3487
+ box-sizing: border-box;
3488
+ }
3489
+
3490
+ .dsh-inflight-rail-switcher-btn {
3491
+ width: 34px;
3492
+ height: 34px;
3493
+ border-radius: var(--dsw-radius-md);
3494
+ border: 1px solid var(--dsw-alias-border-l1, #e2e8f0);
3495
+ background: var(--dsw-alias-bg-module-platform);
3496
+ color: var(--dsw-alias-label-primary, #1e293b);
3497
+ display: flex;
3498
+ align-items: center;
3499
+ justify-content: center;
3500
+ font-size: 13px;
3501
+ cursor: pointer;
3502
+ position: relative;
3503
+ transition: all 0.15s ease;
3504
+ }
3505
+
3506
+ .dsh-inflight-rail-switcher-btn:hover {
3507
+ background: var(--dsw-alias-interactive-bg-hover, #f1f5f9);
3508
+ }
3509
+
3510
+ .dsh-inflight-rail-switcher-btn.is-active {
3511
+ background: var(--dsw-alias-state-business-primary, #2563eb);
3512
+ color: #ffffff;
3513
+ border-color: var(--dsw-alias-state-business-primary, #2563eb);
3514
+ }
3515
+
3516
+ .dsh-inflight-rail-badges {
3517
+ position: absolute;
3518
+ top: -3px;
3519
+ bottom: -3px;
3520
+ right: 0;
3521
+ display: flex;
3522
+ flex-direction: column;
3523
+ justify-content: space-between;
3524
+ align-items: center;
3525
+ line-height: 1;
3526
+ pointer-events: none;
3527
+ z-index: 2;
3528
+ }
3529
+
3530
+ .dsh-inflight-rail-divider {
3531
+ width: 24px;
3532
+ height: 1px;
3533
+ background: var(--dsw-alias-border-l1, #e2e8f0);
3534
+ margin: 2px 0;
3535
+ }
3536
+
3537
+ .dsh-inflight-rail-session-dot {
3538
+ width: 26px;
3539
+ height: 26px;
3540
+ border-radius: 50%;
3541
+ border: 0.5px solid transparent;
3542
+ box-sizing: border-box;
3543
+ background: none;
3544
+ display: flex;
3545
+ align-items: center;
3546
+ justify-content: center;
3547
+ cursor: pointer;
3548
+ transition: all 0.1s ease;
3549
+ }
3550
+
3551
+ .dsh-inflight-rail-session-dot:hover {
3552
+ background: var(--dsw-alias-interactive-bg-hover, #f1f5f9);
3553
+ }
3554
+
3555
+ .dsh-inflight-rail-session-dot.is-current {
3556
+ border-color: var(--dsw-alias-border-l2, #cbd5e1);
3557
+ background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.04));
3558
+ }
3559
+
3560
+ .dsh-inflight-rail-session-dot.is-focused {
3561
+ border-color: var(--dsw-alias-label-secondary);
3562
+ background: var(--dsw-alias-interactive-bg-active);
3563
+ }
3564
+
3565
+ .dsh-kanban-transition-item {
3566
+ display: flex;
3567
+ align-items: center;
3568
+ gap: 8px;
3569
+ font-size: 13px;
3570
+ line-height: 20px;
3571
+ }
3572
+
3573
+ .dsh-kanban-transition-item-primary {
3574
+ color: var(--dsw-alias-state-business-primary, #3964fe);
3575
+ font-weight: 600;
3576
+ }
3577
+
3578
+ .dsh-kanban-transition-item-primary svg {
3579
+ color: var(--dsw-alias-state-business-primary, #3964fe);
3580
+ stroke-width: 1.8;
3581
+ }
3582
+
3583
+ .dsh-kanban-transition-menu [role="menuitem"]:has(.dsh-kanban-transition-item-primary) {
3584
+ background: var(--dsw-alias-interactive-bg-subtle, rgba(57, 100, 254, 0.05));
3585
+ }
3586
+
3587
+ .dsh-kanban-transition-menu [role="menuitem"]:has(.dsh-kanban-transition-item-primary):hover {
3588
+ background: var(--dsw-alias-interactive-bg-hover, rgba(57, 100, 254, 0.1)) !important;
3589
+ }
3590
+
3591
+ .dsh-kanban-input-icon-btn {
3592
+ width: 28px;
3593
+ height: 28px;
3594
+ padding: 0;
3595
+ display: inline-flex;
3596
+ align-items: center;
3597
+ justify-content: center;
3598
+ flex: none;
3599
+ border-radius: var(--dsw-radius-sm, 4px);
3600
+ }
3601
+
3602
+ .dsh-kanban-input-icon-btn:focus-visible {
3603
+ outline: var(--dsw-focus-ring-width, 2px) solid
3604
+ var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
3605
+ outline-offset: -2px;
3606
+ }
3607
+
3608
+ .dsh-kanban-input-icon-btn.is-pressed {
3609
+ background: var(--dsw-alias-interactive-bg-active, rgba(0, 0, 0, 0.08)) !important;
3610
+ color: var(--dsw-alias-state-business-primary) !important;
3611
+ }
3612
+
3613
+ .dsh-kanban-transition-menu {
3614
+ display: inline-flex !important;
3615
+ min-width: 0 !important;
3616
+ flex-shrink: 1 !important;
3617
+ }
3618
+
3619
+ .dsh-kanban-input-chip {
3620
+ height: 28px !important;
3621
+ padding: 0 6px !important;
3622
+ color: var(--dsw-alias-label-secondary, #64748b) !important;
3623
+ font-size: 13px !important;
3624
+ line-height: 20px !important;
3625
+ font-weight: 500 !important;
3626
+ gap: 4px !important;
3627
+ border-radius: var(--dsw-radius-sm, 6px) !important;
3628
+ background: transparent !important;
3629
+ border: none !important;
3630
+ display: inline-flex !important;
3631
+ align-items: center !important;
3632
+ cursor: pointer !important;
3633
+ max-width: 180px;
3634
+ min-width: 0 !important;
3635
+ flex-shrink: 1 !important;
3636
+ transition: background 0.12s ease, color 0.12s ease;
3637
+ }
3638
+
3639
+ .dsh-kanban-input-chip:hover:not(:disabled) {
3640
+ background: var(--dsw-alias-interactive-bg-hover, rgba(0, 0, 0, 0.05)) !important;
3641
+ color: var(--dsw-alias-label-primary, #0f172a) !important;
3642
+ }
3643
+
3644
+ .dsh-kanban-input-chip.is-pressed {
3645
+ background: var(--dsw-alias-interactive-bg-active, rgba(0, 0, 0, 0.08)) !important;
3646
+ color: var(--dsw-alias-label-primary, #0f172a) !important;
3647
+ }
3648
+
3649
+ .dsh-kanban-input-chip:disabled {
3650
+ color: var(--dsw-alias-label-dimmed, #94a3b8) !important;
3651
+ cursor: default !important;
3652
+ opacity: 0.6;
3653
+ }
3654
+
3655
+ .dsh-kanban-input-chip:focus-visible {
3656
+ outline: var(--dsw-focus-ring-width, 2px) solid
3657
+ var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary, #3b82f6));
3658
+ outline-offset: -1px;
3659
+ }
3660
+
3661
+ .dsh-kanban-input-chip-label {
3662
+ min-width: 0;
3663
+ overflow: hidden;
3664
+ text-overflow: ellipsis;
3665
+ white-space: nowrap;
3666
+ }
3667
+
3668
+ .dsh-kanban-input-chip-chevron {
3669
+ flex-shrink: 0;
3670
+ opacity: 0.7;
3671
+ }
3672
+
3673
+ .dsh-kanban-input-chip:hover .dsh-kanban-input-chip-chevron {
3674
+ opacity: 1;
3675
+ }
3676
+
3677
+ `;
3678
+ function registerKanbanStyles(_ctx, pluginId) {
3679
+ if (typeof document === "undefined") return () => {};
3680
+ const styleEl = document.createElement("style");
3681
+ styleEl.setAttribute("data-plugin", pluginId);
3682
+ styleEl.textContent = KANBAN_CSS;
3683
+ document.head.appendChild(styleEl);
3684
+ return () => {
3685
+ styleEl.remove();
3686
+ };
3687
+ }
3688
+ // src/client/index.tsx
3689
+ const inject = [
3690
+ "slots",
3691
+ "uiWorkspace",
3692
+ "sessions",
3693
+ "workspaces",
3694
+ "uiSession",
3695
+ "layout",
3696
+ "remote"
3697
+ ];
3698
+ async function sendKanbanCommand(session, payload) {
3699
+ await session.command(`/kanban ${JSON.stringify(payload)}`);
3700
+ }
3701
+ function clearMatchingSessionDraft(id, prompt) {
3702
+ if (typeof localStorage === "undefined") return;
3703
+ try {
3704
+ const key = `dsh.conversation.${id}`;
3705
+ const existing = localStorage.getItem(key);
3706
+ if (!existing) return;
3707
+ const parsed = JSON.parse(existing);
3708
+ if (parsed.draft === prompt) localStorage.setItem(key, JSON.stringify({
3709
+ ...parsed,
3710
+ draft: ""
3711
+ }));
3712
+ } catch {}
3713
+ }
3714
+ /**
3715
+ * Purpose: Mount scoped search and register Kanban UI views and session actions.
3716
+ * Contract:
3717
+ * - Inputs: Cordis client context providing remote, slots, uiWorkspace, sessions, workspaces, and layout services.
3718
+ * - Outputs: Promise resolving once the scoped Remote and Kanban UI are active.
3719
+ * - Throws / Errors: Fails fast if required services are missing.
3720
+ */
3721
+ async function apply(ctx) {
3722
+ await ctx.remote.$mount(searchRemote);
3723
+ await ctx.plugin({
3724
+ inject: [...inject, "remote.kanban"],
3725
+ apply: applyKanban
3726
+ }).await();
3727
+ }
3728
+ function applyKanban(ctx) {
3729
+ const pluginId = "dsh-client-kanban";
3730
+ ctx.provide("sidebarMode", sidebarModeStore);
3731
+ const sessions = ctx.sessions;
3732
+ const workspaces = ctx.workspaces;
3733
+ const uiSession = ctx.uiSession;
3734
+ const searchSessions = ctx.remote.kanban.search.bind(ctx.remote.kanban);
3735
+ ctx.effect(() => registerKanbanStyles(ctx, pluginId), "kanban: styles");
3736
+ const getActiveSessionId = () => {
3737
+ const listSnapshot = sessions.list.getSnapshot();
3738
+ return listSnapshot.ids.find((id) => (listSnapshot.byId[id]?.retainedBy.mainView ?? 0) > 0);
3739
+ };
3740
+ const navigation = createNavigation((id) => {
3741
+ ctx.uiWorkspace.openSession(id);
3742
+ });
3743
+ ctx.effect(() => {
3744
+ const requested = /* @__PURE__ */ new Set();
3745
+ const hydrateMissing = () => {
3746
+ const snapshot = sessions.list.getSnapshot();
3747
+ const context = {
3748
+ activeSessionId: getActiveSessionId(),
3749
+ splitSessionIds: navigation.getSnapshot().sessionIds,
3750
+ sessionStatus: uiSession.sessionStatus.getSnapshot(),
3751
+ activeSubagentParentIds: extractActiveSubagentParentIds(snapshot.byId)
3752
+ };
3753
+ for (const id of snapshot.ids) {
3754
+ if (requested.has(id)) continue;
3755
+ const summary = snapshot.byId[id];
3756
+ if (!summary || summary.projectionValues?.kanban === void 0) {
3757
+ if (isSessionRelevantToSidebar(id, summary, context)) {
3758
+ requested.add(id);
3759
+ sessions.refreshProjections(id).catch((err) => {
3760
+ console.warn(`[Kanban] Failed to hydrate projections for ${id}:`, err);
3761
+ });
3762
+ }
3763
+ }
3764
+ }
3765
+ };
3766
+ hydrateMissing();
3767
+ const offSessions = sessions.list.subscribe(hydrateMissing);
3768
+ const offStatus = uiSession.sessionStatus.subscribe(hydrateMissing);
3769
+ const offNavigation = navigation.subscribe(hydrateMissing);
3770
+ return () => {
3771
+ offSessions();
3772
+ offStatus();
3773
+ offNavigation();
3774
+ };
3775
+ }, "kanban: hydrate projections");
3776
+ ctx.plugin({
3777
+ inject: ["splitView"],
3778
+ apply(splitCtx) {
3779
+ const split = splitCtx.splitView;
3780
+ splitCtx.effect(() => {
3781
+ split.setFallbackPanelId("kanban");
3782
+ const disconnect = navigation.connect({
3783
+ getSnapshot: split.getSnapshot,
3784
+ openSession: split.openSession,
3785
+ toggleSession: split.toggleSession,
3786
+ removeSession: (id) => {
3787
+ if (split.getSnapshot().sessionIds.includes(id)) split.removeSession(id);
3788
+ },
3789
+ startTask: (id) => {
3790
+ if (splitCtx.layout.panelInfo.getSnapshot().activePanelId === "split-view" && !split.isSuspended() && split.getSnapshot().sessionIds.length > 0) split.toggleSession(id);
3791
+ else split.openSession(id);
3792
+ },
3793
+ toggleMaximize: split.toggleMaximize,
3794
+ setHoveredSession: split.setHoveredSession
3795
+ }, split.subscribe);
3796
+ return () => {
3797
+ disconnect();
3798
+ split.setFallbackPanelId(null);
3799
+ };
3800
+ }, "kanban: split navigation");
3801
+ splitCtx.effect(() => splitCtx.slots.inject("split.pane.status", () => splitCtx.slots.register({
3802
+ name: "split.pane.status",
3803
+ inject: () => ({
3804
+ sessionsList: sessions.list,
3805
+ workspacesList: workspaces.list,
3806
+ sessionStatus: uiSession.sessionStatus
3807
+ })
3808
+ }, KanbanPaneStatus)), "kanban: split pane status");
3809
+ splitCtx.effect(() => splitCtx.slots.inject("split.subagent.status", () => splitCtx.slots.register({ name: "split.subagent.status" }, KanbanStatusDot)), "kanban: split subagent status");
3810
+ }
3811
+ });
3812
+ const createKanbanProps = (activeSessionId, openSession) => ({
3813
+ sessionsList: sessions.list,
3814
+ workspacesList: workspaces.list,
3815
+ sessionStatus: uiSession.sessionStatus,
3816
+ currentSessionId: activeSessionId ?? getActiveSessionId(),
3817
+ searchSessions,
3818
+ searchResultLimit: 20,
3819
+ selectPanel: (id) => ctx.layout.selectPanel(id),
3820
+ refreshProjections: (id) => sessions.refreshProjections(id),
3821
+ startTask: async (workspaceId) => {
3822
+ const newId = await sessions.create(workspaceId ? { workspaceId } : void 0);
3823
+ await sessions.using(newId, { source: "kanban" }, async (reference) => {
3824
+ await sendKanbanCommand(reference.binding.session, {
3825
+ action: "init",
3826
+ createdAt: Date.now()
3827
+ });
3828
+ });
3829
+ navigation.startTask(newId);
3830
+ },
3831
+ prepareTask: async (prompt, workspaceId) => {
3832
+ const trimmedPrompt = prompt.trim();
3833
+ const firstLine = trimmedPrompt.split("\n")[0].trim();
3834
+ const newId = await sessions.create(workspaceId ? { workspaceId } : void 0);
3835
+ await sessions.using(newId, { source: "kanban" }, async (reference) => {
3836
+ if (firstLine) await reference.binding.session.rename(firstLine);
3837
+ await sendKanbanCommand(reference.binding.session, {
3838
+ action: "init",
3839
+ createdAt: Date.now(),
3840
+ ...trimmedPrompt ? { prompt: trimmedPrompt } : {}
3841
+ });
3842
+ });
3843
+ if (typeof localStorage !== "undefined" && trimmedPrompt) try {
3844
+ localStorage.setItem(`dsh.conversation.${newId}`, JSON.stringify({
3845
+ draft: trimmedPrompt,
3846
+ view: null,
3847
+ viewRequest: null
3848
+ }));
3849
+ } catch {}
3850
+ await sessions.refreshProjections(newId);
3851
+ await sessions.refresh();
3852
+ },
3853
+ startPreparedTask: async (id, prompt) => {
3854
+ const trimmed = prompt.trim();
3855
+ if (trimmed) {
3856
+ clearMatchingSessionDraft(id, trimmed);
3857
+ await sessions.using(id, { source: "kanban" }, async (reference) => {
3858
+ await reference.binding.session.prompt([{
3859
+ type: "text",
3860
+ text: trimmed
3861
+ }], "queue");
3862
+ });
3863
+ }
3864
+ },
3865
+ selectSession: (id) => {
3866
+ if (typeof localStorage !== "undefined") try {
3867
+ const summary = sessions.list.getSnapshot().byId[id];
3868
+ const record = summary?.projectionValues?.kanban;
3869
+ const isRunning = Boolean(summary?.running || uiSession.sessionStatus.getSnapshot().get(id)?.running);
3870
+ const key = `dsh.conversation.${id}`;
3871
+ const existing = localStorage.getItem(key);
3872
+ if (shouldSeedKanbanDraft(summary, record, isRunning)) {
3873
+ let shouldSeed = !existing;
3874
+ if (existing) try {
3875
+ if (!JSON.parse(existing).draft) shouldSeed = true;
3876
+ } catch {
3877
+ shouldSeed = true;
3878
+ }
3879
+ if (shouldSeed) localStorage.setItem(key, JSON.stringify({
3880
+ draft: record?.prompt,
3881
+ view: null,
3882
+ viewRequest: null
3883
+ }));
3884
+ } else if (isRunning && record?.prompt) clearMatchingSessionDraft(id, record.prompt);
3885
+ } catch {}
3886
+ openSession(id);
3887
+ },
3888
+ markDone: async (id) => {
3889
+ await sessions.using(id, { source: "kanban" }, async (reference) => {
3890
+ await sendKanbanCommand(reference.binding.session, {
3891
+ action: "done",
3892
+ doneAt: Date.now()
3893
+ });
3894
+ });
3895
+ navigation.removeSession(id);
3896
+ },
3897
+ reopen: async (id) => {
3898
+ await sessions.using(id, { source: "kanban" }, async (reference) => {
3899
+ await sendKanbanCommand(reference.binding.session, {
3900
+ action: "reopen",
3901
+ reopenedAt: Date.now()
3902
+ });
3903
+ });
3904
+ await sessions.refreshProjections(id);
3905
+ await sessions.refresh();
3906
+ },
3907
+ deleteSession: async (id) => {
3908
+ await sessions.using(id, { source: "kanban" }, async (reference) => {
3909
+ await sendKanbanCommand(reference.binding.session, {
3910
+ action: "delete",
3911
+ deletedAt: Date.now()
3912
+ });
3913
+ });
3914
+ navigation.removeSession(id);
3915
+ },
3916
+ holdSession: async (id) => {
3917
+ await sessions.using(id, { source: "kanban" }, async (reference) => {
3918
+ await sendKanbanCommand(reference.binding.session, {
3919
+ action: "hold",
3920
+ heldAt: Date.now()
3921
+ });
3922
+ });
3923
+ await sessions.refreshProjections(id);
3924
+ await sessions.refresh();
3925
+ },
3926
+ unholdSession: async (id) => {
3927
+ await sessions.using(id, { source: "kanban" }, async (reference) => {
3928
+ await sendKanbanCommand(reference.binding.session, {
3929
+ action: "unhold",
3930
+ unheldAt: Date.now()
3931
+ });
3932
+ });
3933
+ await sessions.refreshProjections(id);
3934
+ await sessions.refresh();
3935
+ },
3936
+ pinSession: async (id) => {
3937
+ await sessions.using(id, { source: "kanban" }, async (reference) => {
3938
+ await sendKanbanCommand(reference.binding.session, {
3939
+ action: "pin",
3940
+ pinnedAt: Date.now()
3941
+ });
3942
+ });
3943
+ await sessions.refreshProjections(id);
3944
+ await sessions.refresh();
3945
+ },
3946
+ unpinSession: async (id) => {
3947
+ await sessions.using(id, { source: "kanban" }, async (reference) => {
3948
+ await sendKanbanCommand(reference.binding.session, {
3949
+ action: "unpin",
3950
+ unpinnedAt: Date.now()
3951
+ });
3952
+ });
3953
+ await sessions.refreshProjections(id);
3954
+ await sessions.refresh();
3955
+ },
3956
+ navigation
3957
+ });
3958
+ ctx.effect(() => {
3959
+ return ctx.slots.inject("main", () => ctx.slots.register({
3960
+ name: "main",
3961
+ key: "kanban",
3962
+ inject: () => createKanbanProps(void 0, navigation.maximizeSession)
3963
+ }, KanbanPane));
3964
+ }, "kanban: main view");
3965
+ ctx.effect(() => {
3966
+ const kanbanActions = createKanbanProps(void 0, navigation.openSession);
3967
+ return ctx.slots.inject("conversation.input.left", () => ctx.slots.register({
3968
+ name: "conversation.input.left",
3969
+ id: "kanban.transition-dropdown",
3970
+ order: 90,
3971
+ inject: () => ({
3972
+ holdSession: kanbanActions.holdSession,
3973
+ unholdSession: kanbanActions.unholdSession,
3974
+ markDone: kanbanActions.markDone,
3975
+ reopen: kanbanActions.reopen,
3976
+ startPreparedTask: kanbanActions.startPreparedTask
3977
+ })
3978
+ }, KanbanTransitionDropdown));
3979
+ }, "kanban: input transition dropdown");
3980
+ ctx.effect(() => {
3981
+ let unregisterPanelIcon = null;
3982
+ const syncPanelIcon = () => {
3983
+ if (sidebarModeStore.getSnapshot() !== "kanban") {
3984
+ if (!unregisterPanelIcon) unregisterPanelIcon = ctx.slots.register({
3985
+ name: "sidebar.panellist",
3986
+ id: "kanban",
3987
+ order: 20,
3988
+ label: () => "Kanban"
3989
+ }, KanbanIcon);
3990
+ } else if (unregisterPanelIcon) {
3991
+ unregisterPanelIcon();
3992
+ unregisterPanelIcon = null;
3993
+ }
3994
+ };
3995
+ syncPanelIcon();
3996
+ const unsubscribe = sidebarModeStore.subscribe(syncPanelIcon);
3997
+ return () => {
3998
+ unsubscribe();
3999
+ if (unregisterPanelIcon) {
4000
+ unregisterPanelIcon();
4001
+ unregisterPanelIcon = null;
4002
+ }
4003
+ };
4004
+ }, "kanban: sidebar icon");
4005
+ ctx.effect(() => {
4006
+ const syncPanelSelection = () => {
4007
+ if (ctx.layout.panelInfo.getSnapshot().activePanelId === "kanban") sidebarModeStore.setMode("kanban");
4008
+ };
4009
+ syncPanelSelection();
4010
+ return ctx.layout.panelInfo.subscribe(syncPanelSelection);
4011
+ }, "kanban: sync layout to sidebar mode");
4012
+ ctx.effect(() => {
4013
+ let unregisterSidebar = null;
4014
+ const syncSidebarRegistration = () => {
4015
+ if (sidebarModeStore.getSnapshot() === "kanban") {
4016
+ if (!unregisterSidebar) unregisterSidebar = ctx.slots.register({
4017
+ name: "sidebar.workspaces",
4018
+ priority: -10,
4019
+ inject: () => createKanbanProps(void 0, navigation.focusSession)
4020
+ }, InFlightSidebar);
4021
+ } else if (unregisterSidebar) {
4022
+ unregisterSidebar();
4023
+ unregisterSidebar = null;
4024
+ }
4025
+ };
4026
+ syncSidebarRegistration();
4027
+ const unsubscribe = sidebarModeStore.subscribe(syncSidebarRegistration);
4028
+ return () => {
4029
+ unsubscribe();
4030
+ if (unregisterSidebar) {
4031
+ unregisterSidebar();
4032
+ unregisterSidebar = null;
4033
+ }
4034
+ };
4035
+ }, "kanban: sidebar mode controller");
4036
+ ctx.effect(() => ctx.slots.inject("conversation.chat.commandview", () => ctx.slots.register({
4037
+ name: "conversation.chat.commandview",
4038
+ key: "kanban"
4039
+ }, () => null)), "kanban: commandview");
4040
+ ctx.plugin({
4041
+ inject: ["faviconBadge"],
4042
+ apply(badgeCtx) {
4043
+ badgeCtx.effect(() => {
4044
+ const update = () => {
4045
+ const board = deriveKanbanBoard(sessions.list.getSnapshot(), workspaces.list.getSnapshot().items, uiSession.sessionStatus.getSnapshot());
4046
+ badgeCtx.faviconBadge.setBadge({ reviewCount: board.totalCounts.inReview });
4047
+ };
4048
+ update();
4049
+ const offList = sessions.list.subscribe(update);
4050
+ const offStatus = uiSession.sessionStatus.subscribe(update);
4051
+ const offWorkspaces = workspaces.list.subscribe(update);
4052
+ return () => {
4053
+ offList();
4054
+ offStatus();
4055
+ offWorkspaces();
4056
+ badgeCtx.faviconBadge.setBadge({ reviewCount: 0 });
4057
+ };
4058
+ }, "kanban: favicon review count");
4059
+ }
4060
+ });
4061
+ ctx.plugin({
4062
+ inject: ["appBadge"],
4063
+ apply(badgeCtx) {
4064
+ badgeCtx.effect(() => {
4065
+ const update = () => {
4066
+ const board = deriveKanbanBoard(sessions.list.getSnapshot(), workspaces.list.getSnapshot().items, uiSession.sessionStatus.getSnapshot());
4067
+ badgeCtx.appBadge.setRecentReviewCount(board.totalCounts.recentInReview);
4068
+ };
4069
+ update();
4070
+ const offList = sessions.list.subscribe(update);
4071
+ const offStatus = uiSession.sessionStatus.subscribe(update);
4072
+ const offWorkspaces = workspaces.list.subscribe(update);
4073
+ const timer = setInterval(update, 6e4);
4074
+ return () => {
4075
+ clearInterval(timer);
4076
+ offList();
4077
+ offStatus();
4078
+ offWorkspaces();
4079
+ badgeCtx.appBadge.setRecentReviewCount(0);
4080
+ };
4081
+ }, "kanban: app badge recent review count");
4082
+ }
4083
+ });
4084
+ }
4085
+ exports.apply = apply;
4086
+ exports.inject = inject;
4087
+ return module.exports;
4088
+ }
4089
+ });