@lukstei/dsh-client-split-view 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,2418 @@
1
+ window.__ModuleLoader__.load({
2
+ id: "@lukstei/dsh-client-split-view",
3
+ factory: (require) => {
4
+ var module = { exports: {} };
5
+ var exports = module.exports;
6
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
7
+ let _deepseek_ai_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
8
+ let react = require("react");
9
+ let react_jsx_runtime = require("react/jsx-runtime");
10
+ // ../../node_modules/.pnpm/@deepseek-ai+dsh-brand@0.2.2-rc.5_@deepseek-ai+cordis@4.1.0/node_modules/@deepseek-ai/dsh-brand/lib/index.js
11
+ /**
12
+ * Duplicate-install-safe nominal primitive helpers.
13
+ *
14
+ * A brand makes structurally identical strings or numbers non-interchangeable
15
+ * at the type level: a `SessionId` cannot be passed where a `ToolCallId` is
16
+ * expected, and an event sequence cannot be passed as a log offset. Comparison,
17
+ * logging, and serialization retain the underlying primitive behavior.
18
+ *
19
+ * This package owns no concrete domain value and keeps no runtime identity or mutable
20
+ * state, so independently installed copies produce interchangeable values.
21
+ *
22
+ * @module @deepseek-ai/dsh-brand
23
+ */
24
+ /**
25
+ * Apply a compile-time string brand without changing the value.
26
+ * @param value - string admitted by the domain that owns the target brand.
27
+ * @returns the same string with the requested compile-time brand.
28
+ */
29
+ function brandString(value) {
30
+ return value;
31
+ }
32
+ // ../../node_modules/.pnpm/@deepseek-ai+dsh-session@0.2.2-rc.5_@deepseek-ai+cordis@4.1.0_@deepseek-ai+dsh-error@0._93b5b71f35bf79ee6eda07b634b3ef9f/node_modules/@deepseek-ai/dsh-session/lib/types/types.js
33
+ /**
34
+ * Brand a string as a {@link SessionId}.
35
+ * @param id - the raw session id string.
36
+ * @returns the same string with the session-id brand.
37
+ */
38
+ function SessionId(id) {
39
+ return brandString(id);
40
+ }
41
+ // ../../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
42
+ /**
43
+ * The `dsh-resource://file/…` address grammar: how a file is named across the
44
+ * Sidebar and the resource model, built and parsed without touching a
45
+ * filesystem.
46
+ * @module
47
+ */
48
+ /** The scheme and type every file address opens with. */
49
+ const FILE_ADDRESS_PREFIX = "dsh-resource://file/";
50
+ /** Whether a decoded first path segment is a Windows drive (`C:`). */
51
+ function isDriveSegment(segment) {
52
+ return segment !== void 0 && /^[A-Za-z]:$/.test(segment);
53
+ }
54
+ /**
55
+ * Read a file address back into its parts without resolving `.` or `..`.
56
+ * Query and fragment suffixes are ignored; encoded path segments are decoded.
57
+ * @param address - a candidate address.
58
+ * @returns the parts, or `undefined` when the string is not a `dsh-resource://file/` URI in a known scope with a path, or a segment is not validly encoded.
59
+ */
60
+ function parseFileAddress(address) {
61
+ try {
62
+ if (!address.startsWith(FILE_ADDRESS_PREFIX)) return void 0;
63
+ const end = address.search(/[?#]/);
64
+ const [scope, ...rest] = address.slice(20, end === -1 ? void 0 : end).split("/");
65
+ if (scope === "session") {
66
+ const [id, ...segments] = rest;
67
+ if (id === void 0 || id === "" || segments.length === 0) return void 0;
68
+ return {
69
+ scope,
70
+ sessionId: decodeURIComponent(id),
71
+ path: segments.map(decodeURIComponent).join("/")
72
+ };
73
+ }
74
+ if (scope === "absolute") {
75
+ const unc = rest[0] === "" && rest.length > 1;
76
+ const segments = (unc ? rest.slice(1) : rest).map(decodeURIComponent);
77
+ if (segments.length === 0 || segments[0] === "") return void 0;
78
+ if (unc) return {
79
+ scope,
80
+ path: `//${segments.join("/")}`
81
+ };
82
+ return {
83
+ scope,
84
+ path: isDriveSegment(segments[0]) ? segments.join("/") : `/${segments.join("/")}`
85
+ };
86
+ }
87
+ return;
88
+ } catch {
89
+ return;
90
+ }
91
+ }
92
+ /**
93
+ * Read the final non-empty segment of a Workspace path for display.
94
+ * Workspace-label surfaces use this helper instead of deriving another basename.
95
+ * @param path - Workspace directory path using POSIX or Windows separators.
96
+ * @returns the final segment, or an empty string for a separator-only path.
97
+ */
98
+ function workspaceTitleOf(path) {
99
+ const trimmed = path.replace(/[/\\]+$/, "");
100
+ const separator = Math.max(trimmed.lastIndexOf("/"), trimmed.lastIndexOf("\\"));
101
+ return trimmed.slice(separator + 1);
102
+ }
103
+ /**
104
+ * The text one Workspace is labeled with. A Workspace still carrying the
105
+ * automatic first-use title reads as the caller's localized default name; every
106
+ * other title reads verbatim in every language. A title the user typed as
107
+ * exactly {@link DEFAULT_WORKSPACE_DIRECTORY} is labeled as the default too;
108
+ * nothing else depends on the distinction.
109
+ * @param title - stored Workspace title.
110
+ * @param localizedDefault - the default Workspace name in the active language.
111
+ * @returns the title to display.
112
+ */
113
+ function workspaceDisplayTitle(title, localizedDefault) {
114
+ return title === "default-workspace" ? localizedDefault : title;
115
+ }
116
+ // src/client/file-preview.ts
117
+ /**
118
+ * Purpose: Classify a workspace file path for the split pane's inline preview.
119
+ * Contract:
120
+ * - Inputs: one workspace file path in POSIX or Windows spelling.
121
+ * - Outputs: preview kind and displayable image MIME type.
122
+ * - Errors: never throws; unknown extensions classify as plain text.
123
+ */
124
+ const MARKDOWN_EXTENSIONS = /* @__PURE__ */ new Set([
125
+ "md",
126
+ "markdown",
127
+ "mdx"
128
+ ]);
129
+ const IMAGE_MIME_TYPES = {
130
+ png: "image/png",
131
+ jpg: "image/jpeg",
132
+ jpeg: "image/jpeg",
133
+ gif: "image/gif",
134
+ webp: "image/webp",
135
+ avif: "image/avif",
136
+ bmp: "image/bmp",
137
+ svg: "image/svg+xml"
138
+ };
139
+ /**
140
+ * Purpose: Read the lowercased extension from a path's final segment.
141
+ * Contract:
142
+ * - Inputs: one POSIX or Windows path.
143
+ * - Outputs: extension without the dot; empty for dotfiles, bare names, and trailing separators.
144
+ * - Errors: never throws.
145
+ * @internal
146
+ */
147
+ function extensionOf(path) {
148
+ const separator = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
149
+ const name = path.slice(separator + 1);
150
+ const dot = name.lastIndexOf(".");
151
+ return dot <= 0 ? "" : name.slice(dot + 1).toLowerCase();
152
+ }
153
+ /**
154
+ * Purpose: Map one path to a displayable image MIME type.
155
+ * Contract:
156
+ * - Inputs: one POSIX or Windows path.
157
+ * - Outputs: the MIME type for known image extensions, otherwise `undefined`.
158
+ * - Errors: never throws.
159
+ */
160
+ function imageMimeTypeOf(path) {
161
+ return IMAGE_MIME_TYPES[extensionOf(path)];
162
+ }
163
+ /**
164
+ * Purpose: Classify one path into the pane preview strategy.
165
+ * Contract:
166
+ * - Inputs: one POSIX or Windows path.
167
+ * - Outputs: `markdown` for Markdown documents, `image` for displayable images, otherwise `text`.
168
+ * - Errors: never throws.
169
+ */
170
+ function previewKindOf(path) {
171
+ const extension = extensionOf(path);
172
+ if (MARKDOWN_EXTENSIONS.has(extension)) return "markdown";
173
+ if (IMAGE_MIME_TYPES[extension] !== void 0) return "image";
174
+ return "text";
175
+ }
176
+ // src/client/SplitLayout.tsx
177
+ var SplitLayout = class extends react.Component {
178
+ shell = (0, react.createRef)();
179
+ getSnapshotBeforeUpdate(previous) {
180
+ if (previous.sessionIds.length !== this.props.sessionIds.length || previous.sessionIds.every((id, index) => id === this.props.sessionIds[index]) || !this.shell.current) return null;
181
+ return Array.from(this.shell.current.querySelectorAll("[data-conversation-scroll], .dsh-split-file"), (element) => ({
182
+ element,
183
+ top: element.scrollTop
184
+ }));
185
+ }
186
+ componentDidUpdate(_previous, _state, snapshot) {
187
+ if (snapshot === null) return;
188
+ for (const { element, top } of snapshot) element.scrollTop = top;
189
+ }
190
+ render() {
191
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
192
+ ref: this.shell,
193
+ className: "dsh-split-shell",
194
+ children: this.props.children
195
+ });
196
+ }
197
+ };
198
+ // src/client/SplitPaneHeader.tsx
199
+ /** Presentational pane chrome shared by the live session controller and Ladle. */
200
+ function SplitPaneHeader({ focused, status, workspaceTitle, ancestry, displayTitle, children, actions, ...events }) {
201
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("header", {
202
+ ...events,
203
+ className: `dsh-split-pane-header ${focused ? "is-focused" : ""}`,
204
+ children: [
205
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
206
+ className: "dsh-split-pane-status",
207
+ children: status
208
+ }),
209
+ /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
210
+ className: "dsh-split-header-left",
211
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("nav", {
212
+ className: "dsh-split-crumbs",
213
+ "aria-label": "Session hierarchy",
214
+ children: [
215
+ workspaceTitle !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
216
+ className: "dsh-split-crumb-seg is-workspace",
217
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
218
+ className: "dsh-split-crumb is-workspace",
219
+ title: workspaceTitle,
220
+ children: workspaceTitle
221
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
222
+ className: "dsh-split-crumb-sep",
223
+ "aria-hidden": "true",
224
+ children: "/"
225
+ })]
226
+ }),
227
+ ancestry.map((summary, index) => {
228
+ const isLast = index === ancestry.length - 1;
229
+ const crumbTitle = summary.subagent ? `Subagent: ${summary.displayTitle}` : summary.displayTitle;
230
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
231
+ className: "dsh-split-crumb-seg",
232
+ children: [index > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
233
+ className: "dsh-split-crumb-sep",
234
+ children: "/"
235
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
236
+ className: `dsh-split-crumb ${isLast ? "is-current" : "is-parent"} ${summary.subagent ? "is-subagent" : ""}`,
237
+ title: crumbTitle,
238
+ children: crumbTitle
239
+ })]
240
+ }, summary.id);
241
+ }),
242
+ ancestry.length === 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
243
+ className: "dsh-split-crumb is-current",
244
+ title: displayTitle,
245
+ children: displayTitle
246
+ })
247
+ ]
248
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
249
+ className: "dsh-split-header-actions",
250
+ children: actions
251
+ })]
252
+ }),
253
+ children
254
+ ]
255
+ });
256
+ }
257
+ // ../util-review-ui/src/client/quote.ts
258
+ /**
259
+ * Formats a code quote payload ensuring file name, line numbers, and quoted text
260
+ * are consistently present.
261
+ */
262
+ function formatQuoteContent(quote) {
263
+ const header = quote.lines ? `**${quote.path}:${quote.lines}**` : `**${quote.path}**`;
264
+ const normalized = quote.text.replace(/\r?\n$/, "");
265
+ return {
266
+ chipText: `${header}\n${quote.text}`,
267
+ markdownText: `> ${header}\n${normalized.split("\n").map((l) => `> ${l}`).join("\n")}\n\n`
268
+ };
269
+ }
270
+ /**
271
+ * Inserts a formatted quote into the conversation composer or falls back to
272
+ * clipboard copy.
273
+ */
274
+ function quoteToComposer(quote, inputActions) {
275
+ const { chipText, markdownText } = formatQuoteContent(quote);
276
+ let inserted = false;
277
+ if (inputActions) {
278
+ try {
279
+ inserted = Boolean(inputActions.insertQuote(chipText));
280
+ if (inserted) inputActions.persistDraft();
281
+ } catch {
282
+ inserted = false;
283
+ }
284
+ if (!inserted) try {
285
+ const span = inputActions.captureInsertion();
286
+ if (Boolean(inputActions.insertText(markdownText, {
287
+ ...span,
288
+ start: span.end
289
+ }))) {
290
+ inputActions.persistDraft();
291
+ inserted = true;
292
+ }
293
+ } catch {
294
+ inserted = false;
295
+ }
296
+ }
297
+ if (!inserted) (0, _deepseek_ai_dsh_client_ui_primitives.writeClipboard)(markdownText);
298
+ }
299
+ // ../util-review-ui/src/client/useSelectionQuote.ts
300
+ /**
301
+ * Computes 1-based start and end line indices from .line elements intersecting the range.
302
+ * @internal
303
+ */
304
+ function getSelectedLineSpan(container, range) {
305
+ const lineElements = container.querySelectorAll(".line");
306
+ if (lineElements.length === 0) return null;
307
+ let min = -1;
308
+ let max = -1;
309
+ const part = container.ownerDocument.createRange();
310
+ for (let i = 0; i < lineElements.length; i++) {
311
+ const line = lineElements[i];
312
+ if (!range.intersectsNode(line)) {
313
+ if (min !== -1) break;
314
+ continue;
315
+ }
316
+ const isStart = line.contains(range.startContainer);
317
+ const isEnd = line.contains(range.endContainer);
318
+ if (!isStart && !isEnd) {
319
+ if (min === -1) min = i;
320
+ max = i;
321
+ continue;
322
+ }
323
+ part.selectNodeContents(line);
324
+ if (isStart) part.setStart(range.startContainer, range.startOffset);
325
+ if (isEnd) part.setEnd(range.endContainer, range.endOffset);
326
+ if (!part.collapsed && part.toString() !== "") {
327
+ if (min === -1) min = i;
328
+ max = i;
329
+ }
330
+ }
331
+ return min === -1 ? null : {
332
+ min: min + 1,
333
+ max: max + 1
334
+ };
335
+ }
336
+ function useSelectionQuote({ containerRef, enabled }) {
337
+ const [floatingQuote, setFloatingQuote] = (0, react.useState)(null);
338
+ (0, react.useEffect)(() => {
339
+ if (!enabled) {
340
+ setFloatingQuote(null);
341
+ return;
342
+ }
343
+ const update = () => {
344
+ const container = containerRef.current;
345
+ if (!container) {
346
+ setFloatingQuote(null);
347
+ return;
348
+ }
349
+ const sel = window.getSelection();
350
+ if (!sel || sel.isCollapsed || sel.rangeCount === 0) {
351
+ setFloatingQuote(null);
352
+ return;
353
+ }
354
+ const range = sel.getRangeAt(0);
355
+ if (!container.contains(range.commonAncestorContainer)) {
356
+ setFloatingQuote(null);
357
+ return;
358
+ }
359
+ const text = sel.toString().trim();
360
+ if (!text) {
361
+ setFloatingQuote(null);
362
+ return;
363
+ }
364
+ const rect = range.getBoundingClientRect();
365
+ const containerRect = container.getBoundingClientRect();
366
+ let lines;
367
+ const span = getSelectedLineSpan(container, range);
368
+ if (span !== null) lines = span.min === span.max ? String(span.min) : `${span.min}–${span.max}`;
369
+ const top = Math.max(0, rect.top - containerRect.top - 32);
370
+ const left = Math.max(8, Math.min(containerRect.width - 70, rect.left - containerRect.left + rect.width / 2 - 30));
371
+ setFloatingQuote({
372
+ text,
373
+ lines,
374
+ top,
375
+ left
376
+ });
377
+ };
378
+ document.addEventListener("selectionchange", update);
379
+ return () => {
380
+ document.removeEventListener("selectionchange", update);
381
+ setFloatingQuote(null);
382
+ };
383
+ }, [enabled, containerRef]);
384
+ const clearFloatingQuote = () => {
385
+ setFloatingQuote(null);
386
+ window.getSelection()?.removeAllRanges();
387
+ };
388
+ return {
389
+ floatingQuote,
390
+ clearFloatingQuote
391
+ };
392
+ }
393
+ // src/client/split-store.ts
394
+ const SPLIT_VIEW_STORAGE_KEY = "dsh-client-split-view:state:v1";
395
+ const isMobileViewport = () => {
396
+ if (typeof window === "undefined") return false;
397
+ return window.innerWidth < 768;
398
+ };
399
+ function isJsonObject(value) {
400
+ const ancestors = /* @__PURE__ */ new Set();
401
+ const isJson = (entry) => {
402
+ if (entry === null || typeof entry === "string" || typeof entry === "boolean") return true;
403
+ if (typeof entry === "number") return Number.isFinite(entry);
404
+ if (typeof entry !== "object" || ancestors.has(entry)) return false;
405
+ if (!Array.isArray(entry) && Object.getPrototypeOf(entry) !== Object.prototype) return false;
406
+ ancestors.add(entry);
407
+ const valid = Object.values(entry).every(isJson);
408
+ ancestors.delete(entry);
409
+ return valid;
410
+ };
411
+ return typeof value === "object" && value !== null && !Array.isArray(value) && isJson(value);
412
+ }
413
+ var SplitStore = class {
414
+ sessionIds = [];
415
+ focusedSessionId;
416
+ maximizedSessionId;
417
+ hoveredSessionId;
418
+ suspended = false;
419
+ fallbackPanelId = null;
420
+ overlays = /* @__PURE__ */ new Map();
421
+ pointerOrigin;
422
+ references = /* @__PURE__ */ new Map();
423
+ listeners = /* @__PURE__ */ new Set();
424
+ sessionsProvider;
425
+ activeSessionProvider;
426
+ navCallbacks;
427
+ snapshot = {
428
+ sessionIds: [],
429
+ focusedSessionId: void 0,
430
+ maximizedSessionId: void 0,
431
+ hoveredSessionId: void 0,
432
+ suspended: false,
433
+ overlays: /* @__PURE__ */ new Map()
434
+ };
435
+ subscribe = (listener) => {
436
+ this.listeners.add(listener);
437
+ return () => {
438
+ this.listeners.delete(listener);
439
+ };
440
+ };
441
+ getSnapshot = () => {
442
+ return this.snapshot;
443
+ };
444
+ getReference = (id) => {
445
+ return this.references.get(id);
446
+ };
447
+ getOverlay = (id) => {
448
+ return this.overlays.get(id);
449
+ };
450
+ isSuspended = () => {
451
+ return this.suspended;
452
+ };
453
+ isSplitActive = () => {
454
+ return this.sessionIds.length > 0 && !this.suspended;
455
+ };
456
+ persist = () => {
457
+ if (typeof localStorage === "undefined") return;
458
+ try {
459
+ if (this.sessionIds.length >= 1) {
460
+ const overlays = [];
461
+ for (const [hostId, overlay] of this.overlays) if (overlay.kind === "slot") overlays.push({
462
+ hostId,
463
+ ...overlay
464
+ });
465
+ else if (overlay.kind === "file") overlays.push({
466
+ hostId,
467
+ kind: "file",
468
+ file: {
469
+ address: overlay.address,
470
+ ownerSessionId: overlay.ownerSessionId,
471
+ path: overlay.path,
472
+ title: overlay.title
473
+ }
474
+ });
475
+ else if (overlay.kind === "session") overlays.push({
476
+ hostId,
477
+ kind: "session",
478
+ session: {
479
+ target: overlay.target,
480
+ title: overlay.title
481
+ }
482
+ });
483
+ const state = {
484
+ version: 1,
485
+ sessionIds: [...this.sessionIds],
486
+ focusedSessionId: this.focusedSessionId,
487
+ maximizedSessionId: this.maximizedSessionId,
488
+ suspended: this.suspended,
489
+ overlays
490
+ };
491
+ localStorage.setItem(SPLIT_VIEW_STORAGE_KEY, JSON.stringify(state));
492
+ } else if (!this.suspended) localStorage.removeItem(SPLIT_VIEW_STORAGE_KEY);
493
+ } catch {}
494
+ };
495
+ hydrate = (sessions) => {
496
+ if (typeof localStorage === "undefined") return;
497
+ try {
498
+ const raw = localStorage.getItem(SPLIT_VIEW_STORAGE_KEY);
499
+ if (raw === null) return;
500
+ const data = JSON.parse(raw);
501
+ if (data.version !== 1 || !Array.isArray(data.sessionIds)) return;
502
+ const snapshot = sessions.list.getSnapshot();
503
+ if (snapshot.phase !== "ready") return;
504
+ const existingIds = new Set(snapshot.ids);
505
+ const validIds = data.sessionIds.filter((id) => typeof id === "string" && existingIds.has(id));
506
+ if (validIds.length < 1) {
507
+ localStorage.removeItem(SPLIT_VIEW_STORAGE_KEY);
508
+ return;
509
+ }
510
+ for (const ref of this.references.values()) ref.release();
511
+ this.references.clear();
512
+ for (const hostId of [...this.overlays.keys()]) this.releaseOverlay(hostId);
513
+ const focusedId = typeof data.focusedSessionId === "string" && validIds.includes(data.focusedSessionId) ? data.focusedSessionId : validIds[0];
514
+ const isMobile = isMobileViewport();
515
+ const targetIds = isMobile ? [focusedId] : validIds;
516
+ for (const id of targetIds) this.retain(id, sessions);
517
+ this.sessionIds = targetIds;
518
+ this.focusedSessionId = focusedId;
519
+ this.maximizedSessionId = !isMobile && targetIds.length > 1 && typeof data.maximizedSessionId === "string" && targetIds.includes(data.maximizedSessionId) ? data.maximizedSessionId : void 0;
520
+ this.suspended = Boolean(data.suspended);
521
+ if (Array.isArray(data.overlays)) for (const overlay of data.overlays) {
522
+ if (!overlay || typeof overlay.hostId !== "string" || !targetIds.includes(overlay.hostId)) continue;
523
+ const hostId = overlay.hostId;
524
+ if (overlay.kind === "slot") {
525
+ if (typeof overlay.slotName !== "string" || typeof overlay.title !== "string" || !isJsonObject(overlay.props)) continue;
526
+ const { hostId: _hostId, ...state } = overlay;
527
+ this.overlays.set(hostId, state);
528
+ } else if (overlay.kind === "file") this.overlays.set(hostId, {
529
+ kind: "file",
530
+ address: overlay.file.address,
531
+ ownerSessionId: overlay.file.ownerSessionId,
532
+ path: overlay.file.path,
533
+ title: overlay.file.title
534
+ });
535
+ else if (overlay.kind === "session") {
536
+ const target = overlay.session.target;
537
+ const targetId = typeof target === "string" ? target : target.childSessionId;
538
+ if (existingIds.has(targetId)) {
539
+ const reference = sessions.retain(target, { source: "splitView" });
540
+ this.overlays.set(hostId, {
541
+ kind: "session",
542
+ target,
543
+ title: overlay.session.title,
544
+ reference
545
+ });
546
+ }
547
+ }
548
+ }
549
+ this.emit();
550
+ if (!this.suspended && this.navCallbacks !== void 0) this.navCallbacks.selectPanel("split-view");
551
+ } catch (error) {
552
+ console.warn("[split-view] hydrate failed", error);
553
+ }
554
+ };
555
+ publish = () => {
556
+ this.snapshot = {
557
+ sessionIds: [...this.sessionIds],
558
+ focusedSessionId: this.focusedSessionId,
559
+ maximizedSessionId: this.maximizedSessionId,
560
+ hoveredSessionId: this.hoveredSessionId,
561
+ suspended: this.suspended,
562
+ overlays: new Map(this.overlays)
563
+ };
564
+ for (const listener of this.listeners) listener();
565
+ };
566
+ emit = () => {
567
+ this.publish();
568
+ this.persist();
569
+ };
570
+ setCallbacks = (selectPanel, openSession, sessionsProvider, activeSessionProvider) => {
571
+ this.navCallbacks = {
572
+ selectPanel,
573
+ openSession
574
+ };
575
+ this.sessionsProvider = sessionsProvider;
576
+ this.activeSessionProvider = activeSessionProvider;
577
+ };
578
+ /** Remember which pane a pointer interaction originated from. */
579
+ setPointerOrigin = (id) => {
580
+ this.pointerOrigin = id;
581
+ };
582
+ /** Forget the pane origin after a pointer interaction outside every pane. */
583
+ clearPointerOrigin = () => {
584
+ this.pointerOrigin = void 0;
585
+ };
586
+ getPointerOrigin = () => {
587
+ return this.pointerOrigin;
588
+ };
589
+ /**
590
+ * Toggle session into or out of split view.
591
+ */
592
+ toggleSession = (targetId) => {
593
+ if (this.sessionsProvider === void 0) throw new Error("SplitStore: ISessions provider not configured");
594
+ const effectiveSessions = this.sessionsProvider();
595
+ const effectiveActiveId = this.activeSessionProvider !== void 0 ? this.activeSessionProvider() : void 0;
596
+ if (isMobileViewport()) {
597
+ this.openSession(targetId);
598
+ return;
599
+ }
600
+ if (this.sessionIds.includes(targetId)) {
601
+ this.removeSession(targetId);
602
+ return;
603
+ }
604
+ if (this.sessionIds.length === 0) {
605
+ if (effectiveActiveId !== void 0 && effectiveActiveId !== targetId) {
606
+ this.retain(effectiveActiveId, effectiveSessions);
607
+ this.sessionIds.push(effectiveActiveId);
608
+ }
609
+ }
610
+ this.retain(targetId, effectiveSessions);
611
+ this.sessionIds.push(targetId);
612
+ this.focusedSessionId = targetId;
613
+ this.suspended = false;
614
+ this.maximizedSessionId = void 0;
615
+ this.emit();
616
+ if (this.navCallbacks !== void 0) this.navCallbacks.selectPanel("split-view");
617
+ };
618
+ /**
619
+ * Open a single session in the non-native view, or focus it if already in split.
620
+ */
621
+ openSession = (targetId) => {
622
+ if (this.sessionsProvider === void 0) throw new Error("SplitStore: ISessions provider not configured");
623
+ const effectiveSessions = this.sessionsProvider();
624
+ if (isMobileViewport() ? this.sessionIds.length !== 1 || this.sessionIds[0] !== targetId : !this.sessionIds.includes(targetId)) {
625
+ for (const ref of this.references.values()) ref.release();
626
+ this.references.clear();
627
+ for (const hostId of [...this.overlays.keys()]) this.releaseOverlay(hostId);
628
+ this.retain(targetId, effectiveSessions);
629
+ this.sessionIds = [targetId];
630
+ }
631
+ this.focusedSessionId = targetId;
632
+ this.maximizedSessionId = void 0;
633
+ this.suspended = false;
634
+ this.emit();
635
+ if (this.navCallbacks !== void 0) this.navCallbacks.selectPanel("split-view");
636
+ };
637
+ /**
638
+ * Remove a single session from split view (e.g. from pane header close button).
639
+ */
640
+ removeSession = (targetId) => {
641
+ if (!this.sessionIds.includes(targetId)) return;
642
+ this.release(targetId);
643
+ this.closeOverlay(targetId);
644
+ this.sessionIds = this.sessionIds.filter((id) => id !== targetId);
645
+ if (this.hoveredSessionId === targetId) this.hoveredSessionId = void 0;
646
+ if (this.maximizedSessionId === targetId || this.sessionIds.length <= 1) this.maximizedSessionId = void 0;
647
+ if (this.sessionIds.length === 0) {
648
+ this.reset();
649
+ if (this.navCallbacks !== void 0) this.navCallbacks.selectPanel(this.fallbackPanelId);
650
+ return;
651
+ }
652
+ if (this.focusedSessionId === targetId) this.focusedSessionId = this.sessionIds[this.sessionIds.length - 1];
653
+ this.emit();
654
+ };
655
+ /**
656
+ * Show one pane's session in the native Conversation view while keeping the split.
657
+ */
658
+ suspend = (targetId) => {
659
+ if (this.sessionIds.length < 1) return;
660
+ this.suspended = true;
661
+ this.emit();
662
+ if (this.navCallbacks !== void 0) {
663
+ this.navCallbacks.openSession(targetId);
664
+ this.navCallbacks.selectPanel(null);
665
+ }
666
+ };
667
+ /** Return from the native Conversation view to the retained split. */
668
+ resume = () => {
669
+ if (!this.suspended) return;
670
+ this.suspended = false;
671
+ this.emit();
672
+ if (this.navCallbacks !== void 0) this.navCallbacks.selectPanel("split-view");
673
+ };
674
+ /** Layer another Session over one pane, releasing any previous overlay. */
675
+ openSessionOverlay = (hostId, target, title, sessions) => {
676
+ let effectiveSessions = sessions;
677
+ if (effectiveSessions === void 0) {
678
+ if (this.sessionsProvider === void 0) throw new Error("SplitStore: ISessions provider not configured");
679
+ effectiveSessions = this.sessionsProvider();
680
+ }
681
+ this.releaseOverlay(hostId);
682
+ this.overlays.set(hostId, {
683
+ kind: "session",
684
+ target,
685
+ title,
686
+ reference: effectiveSessions.retain(target, { source: "splitView" })
687
+ });
688
+ this.emit();
689
+ };
690
+ setFallbackPanelId = (id) => {
691
+ this.fallbackPanelId = id;
692
+ };
693
+ /** Layer a registered factory over one pane. */
694
+ openSlotOverlay = (hostId, slotName, title, props) => {
695
+ if (!isJsonObject(props)) throw new TypeError("Split overlay props must be a JSON object");
696
+ this.releaseOverlay(hostId);
697
+ const overlay = {
698
+ kind: "slot",
699
+ slotName,
700
+ title,
701
+ props
702
+ };
703
+ this.overlays.set(hostId, overlay);
704
+ this.emit();
705
+ };
706
+ /** Layer one addressed file over one pane. */
707
+ openFileOverlay = (hostId, file) => {
708
+ this.releaseOverlay(hostId);
709
+ this.overlays.set(hostId, {
710
+ kind: "file",
711
+ ...file
712
+ });
713
+ this.emit();
714
+ };
715
+ /** Update resolved full path for a file overlay. */
716
+ updateFileOverlayFullPath = (hostId, address, fullPath) => {
717
+ const current = this.overlays.get(hostId);
718
+ if (current === void 0 || current.kind !== "file" || current.address !== address) return;
719
+ if (current.fullPath !== fullPath) {
720
+ this.overlays.set(hostId, {
721
+ ...current,
722
+ fullPath
723
+ });
724
+ this.emit();
725
+ }
726
+ };
727
+ /** Publish the fully loaded text of a file overlay for the pane's copy action. */
728
+ updateFileOverlayContents = (hostId, address, contents) => {
729
+ const current = this.overlays.get(hostId);
730
+ if (current === void 0 || current.kind !== "file" || current.address !== address || current.contents === contents) return;
731
+ this.overlays.set(hostId, {
732
+ ...current,
733
+ contents
734
+ });
735
+ this.emit();
736
+ };
737
+ closeOverlay = (hostId) => {
738
+ if (!this.overlays.has(hostId)) return;
739
+ this.releaseOverlay(hostId);
740
+ this.emit();
741
+ };
742
+ /**
743
+ * Normal single click: reset split mode and switch back to single view.
744
+ */
745
+ resetToSingle = () => {
746
+ if (this.sessionIds.length > 0 || this.suspended) {
747
+ this.reset();
748
+ if (this.navCallbacks !== void 0) this.navCallbacks.selectPanel(null);
749
+ }
750
+ };
751
+ /**
752
+ * Toggle maximizing one pane to take all space in the split screen.
753
+ */
754
+ toggleMaximize = (targetId) => {
755
+ if (isMobileViewport() || !this.sessionIds.includes(targetId) || this.sessionIds.length <= 1) return;
756
+ this.maximizedSessionId = this.maximizedSessionId === targetId ? void 0 : targetId;
757
+ this.setFocus(targetId);
758
+ this.emit();
759
+ };
760
+ /**
761
+ * Reorder a session tab to the position of targetId.
762
+ */
763
+ reorderSession = (sourceId, targetId) => {
764
+ if (sourceId === targetId) return;
765
+ const sourceIndex = this.sessionIds.indexOf(sourceId);
766
+ const targetIndex = this.sessionIds.indexOf(targetId);
767
+ if (sourceIndex === -1 || targetIndex === -1) return;
768
+ const next = [...this.sessionIds];
769
+ next.splice(sourceIndex, 1);
770
+ next.splice(targetIndex, 0, sourceId);
771
+ this.sessionIds = next;
772
+ this.emit();
773
+ };
774
+ setFocus = (id) => {
775
+ if (this.focusedSessionId !== id && this.sessionIds.includes(id)) {
776
+ this.focusedSessionId = id;
777
+ this.emit();
778
+ }
779
+ };
780
+ /**
781
+ * Highlight one pane because its sidebar row is hovered; never persisted.
782
+ */
783
+ setHoveredSession = (targetId) => {
784
+ const next = targetId !== void 0 && this.sessionIds.includes(targetId) ? targetId : void 0;
785
+ if (this.hoveredSessionId === next) return;
786
+ this.hoveredSessionId = next;
787
+ this.publish();
788
+ };
789
+ retain = (id, sessions) => {
790
+ if (!this.references.has(id)) {
791
+ const ref = sessions.retain(id, { source: "splitView" });
792
+ this.references.set(id, ref);
793
+ }
794
+ };
795
+ release = (id) => {
796
+ const ref = this.references.get(id);
797
+ if (ref !== void 0) {
798
+ ref.release();
799
+ this.references.delete(id);
800
+ }
801
+ };
802
+ releaseOverlay = (hostId) => {
803
+ const overlay = this.overlays.get(hostId);
804
+ this.overlays.delete(hostId);
805
+ if (overlay !== void 0 && overlay.kind === "session") overlay.reference.release();
806
+ };
807
+ /** In-memory teardown releasing references without deleting persisted state. */
808
+ dispose = () => {
809
+ for (const ref of this.references.values()) ref.release();
810
+ this.references.clear();
811
+ for (const hostId of [...this.overlays.keys()]) this.releaseOverlay(hostId);
812
+ this.sessionIds = [];
813
+ this.focusedSessionId = void 0;
814
+ this.maximizedSessionId = void 0;
815
+ this.suspended = false;
816
+ this.pointerOrigin = void 0;
817
+ this.snapshot = {
818
+ sessionIds: [],
819
+ focusedSessionId: void 0,
820
+ maximizedSessionId: void 0,
821
+ hoveredSessionId: void 0,
822
+ suspended: false,
823
+ overlays: /* @__PURE__ */ new Map()
824
+ };
825
+ for (const listener of this.listeners) listener();
826
+ };
827
+ reset = () => {
828
+ this.dispose();
829
+ try {
830
+ if (typeof localStorage !== "undefined") localStorage.removeItem(SPLIT_VIEW_STORAGE_KEY);
831
+ } catch {}
832
+ };
833
+ };
834
+ const splitStore = new SplitStore();
835
+ // src/client/SplitPane.tsx
836
+ /** English chrome for Markdown rendered inside a split pane. */
837
+ const MARKDOWN_LABELS = {
838
+ code: {
839
+ copyLabel: "Copy",
840
+ copiedLabel: "Copied",
841
+ toolbarLabels: {
842
+ codeLabel: "Code",
843
+ wrapLabel: "Wrap",
844
+ unwrapLabel: "Unwrap"
845
+ }
846
+ },
847
+ footnotes: "Footnotes"
848
+ };
849
+ function deriveAncestry(list, id) {
850
+ const chain = [];
851
+ const seen = /* @__PURE__ */ new Set();
852
+ let cursor = id;
853
+ while (cursor !== void 0) {
854
+ if (seen.has(cursor)) break;
855
+ seen.add(cursor);
856
+ const summary = list.byId[cursor];
857
+ if (summary === void 0) break;
858
+ chain.unshift({
859
+ id: summary.id,
860
+ displayTitle: summary.displayTitle || "Untitled Task",
861
+ subagent: summary.origin === "subagent"
862
+ });
863
+ if (summary.origin !== "subagent") break;
864
+ cursor = summary.parentId;
865
+ }
866
+ return chain;
867
+ }
868
+ const isAncestryEqual = (a, b) => a.length === b.length && a.every((item, i) => item.id === b[i].id && item.displayTitle === b[i].displayTitle && item.subagent === b[i].subagent);
869
+ const isSubagentsEqual = (a, b) => a.length === b.length && a.every((item, i) => item.id === b[i].id && item.running === b[i].running && item.displayTitle === b[i].displayTitle);
870
+ function useSplitPhase(sessionId, { useSession, useConversation, useSessions }) {
871
+ const session = useSession((value) => value);
872
+ const shellPhase = useConversation((value) => value).activeTargets.size > 0 || !session.blank && !session.awaitingFirstTurn || session.running ? "active" : session.promptAttempted ? "engaging" : "blank";
873
+ const summaryBlank = useSessions((state) => state.byId[sessionId]?.blank);
874
+ const settling = shellPhase === "blank" && session.openState === "loading" && summaryBlank !== true;
875
+ const hero = shellPhase === "blank" && (session.openState === "open" || summaryBlank === true);
876
+ return {
877
+ phase: settling ? "settling" : hero ? "hero" : "active",
878
+ hero
879
+ };
880
+ }
881
+ /** Copies a file overlay's text; disabled until every page has loaded. */
882
+ function CopyContentsButton({ contents }) {
883
+ const { copied, onCopy } = (0, _deepseek_ai_dsh_client_ui_primitives.useClipboardCopy)(contents ?? "");
884
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
885
+ label: contents === void 0 ? "Loading full file…" : copied ? "Copied!" : "Copy contents",
886
+ portal: true,
887
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
888
+ type: "button",
889
+ className: "dsh-split-overlay-close",
890
+ "aria-label": "Copy contents",
891
+ disabled: contents === void 0,
892
+ onClick: (event) => {
893
+ event.stopPropagation();
894
+ onCopy();
895
+ },
896
+ children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCheckOutlineRegular, { size: 14 }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCopyOutlineRegular, { size: 14 })
897
+ })
898
+ });
899
+ }
900
+ /** Inline Markdown/text/image preview for one addressed file; other formats fall back to the Sidebar. */
901
+ function SplitFileOverlay({ hostSessionId, overlay, readFile, readBytes, openNativeResource, inputActions }) {
902
+ const { path, ownerSessionId } = overlay;
903
+ const kind = previewKindOf(path);
904
+ const [state, setState] = (0, react.useState)({ status: "loading" });
905
+ const [loadingMore, setLoadingMore] = (0, react.useState)(false);
906
+ const controllerRef = (0, react.useRef)(null);
907
+ const objectUrlRef = (0, react.useRef)(void 0);
908
+ const containerRef = (0, react.useRef)(null);
909
+ const { floatingQuote, clearFloatingQuote } = useSelectionQuote({
910
+ containerRef,
911
+ enabled: inputActions !== void 0
912
+ });
913
+ const fullText = (state.status === "markdown" || state.status === "text") && state.nextOffset === void 0 ? state.text : void 0;
914
+ (0, react.useEffect)(() => {
915
+ if (fullText !== void 0) splitStore.updateFileOverlayContents(hostSessionId, overlay.address, fullText);
916
+ }, [
917
+ fullText,
918
+ hostSessionId,
919
+ overlay
920
+ ]);
921
+ const handleQuote = (e) => {
922
+ e.preventDefault();
923
+ if (!floatingQuote || !inputActions) return;
924
+ quoteToComposer({
925
+ text: floatingQuote.text,
926
+ path: overlay.path,
927
+ lines: floatingQuote.lines
928
+ }, inputActions);
929
+ clearFloatingQuote();
930
+ };
931
+ (0, react.useEffect)(() => {
932
+ const controller = new AbortController();
933
+ controllerRef.current = controller;
934
+ setState({ status: "loading" });
935
+ setLoadingMore(false);
936
+ const load = async () => {
937
+ if (kind === "image") {
938
+ const mime = imageMimeTypeOf(path);
939
+ if (mime === void 0) {
940
+ setState({
941
+ status: "failed",
942
+ message: "Unsupported preview"
943
+ });
944
+ return;
945
+ }
946
+ const bytes = await readBytes(ownerSessionId, path, controller.signal);
947
+ if (controller.signal.aborted) return;
948
+ if (!bytes.ok) {
949
+ setState({
950
+ status: "failed",
951
+ message: bytes.error.message
952
+ });
953
+ return;
954
+ }
955
+ if (bytes.value.absolutePath) splitStore.updateFileOverlayFullPath(hostSessionId, overlay.address, bytes.value.absolutePath);
956
+ const objectUrl = URL.createObjectURL(new Blob([bytes.value.data], { type: mime }));
957
+ objectUrlRef.current = objectUrl;
958
+ setState({
959
+ status: "image",
960
+ url: objectUrl
961
+ });
962
+ return;
963
+ }
964
+ const page = await readFile(ownerSessionId, path, 1, controller.signal);
965
+ if (controller.signal.aborted) return;
966
+ if (!page.ok) {
967
+ setState({
968
+ status: "failed",
969
+ message: page.error.message
970
+ });
971
+ return;
972
+ }
973
+ if (page.value.absolutePath) splitStore.updateFileOverlayFullPath(hostSessionId, overlay.address, page.value.absolutePath);
974
+ setState({
975
+ status: kind,
976
+ text: page.value.text,
977
+ nextOffset: page.value.eof || page.value.lines === 0 ? void 0 : page.value.offset + page.value.lines
978
+ });
979
+ };
980
+ load();
981
+ return () => {
982
+ controller.abort();
983
+ if (controllerRef.current === controller) controllerRef.current = null;
984
+ if (objectUrlRef.current !== void 0) {
985
+ URL.revokeObjectURL(objectUrlRef.current);
986
+ objectUrlRef.current = void 0;
987
+ }
988
+ };
989
+ }, [
990
+ kind,
991
+ path,
992
+ ownerSessionId,
993
+ hostSessionId,
994
+ readFile,
995
+ readBytes,
996
+ overlay.address
997
+ ]);
998
+ const loadMore = async () => {
999
+ if (loadingMore) return;
1000
+ if (state.status !== "text" && state.status !== "markdown") return;
1001
+ const nextOffset = state.nextOffset;
1002
+ const controller = controllerRef.current;
1003
+ if (nextOffset === void 0 || controller === null || controller.signal.aborted) return;
1004
+ setLoadingMore(true);
1005
+ const page = await readFile(ownerSessionId, path, nextOffset, controller.signal);
1006
+ if (controller.signal.aborted) return;
1007
+ setLoadingMore(false);
1008
+ if (!page.ok) {
1009
+ setState((previous) => previous.status === "text" || previous.status === "markdown" ? {
1010
+ ...previous,
1011
+ nextOffset: void 0
1012
+ } : previous);
1013
+ return;
1014
+ }
1015
+ setState((previous) => previous.status === "text" || previous.status === "markdown" ? {
1016
+ ...previous,
1017
+ text: `${previous.text}\n${page.value.text}`,
1018
+ nextOffset: page.value.eof || page.value.lines === 0 ? void 0 : page.value.offset + page.value.lines
1019
+ } : previous);
1020
+ };
1021
+ if (state.status === "loading") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
1022
+ className: "dsh-split-file-note",
1023
+ children: "Loading…"
1024
+ });
1025
+ if (state.status === "failed") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1026
+ className: "dsh-split-file-note",
1027
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", { children: state.message }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1028
+ type: "button",
1029
+ className: "dsh-split-btn",
1030
+ onClick: () => openNativeResource(overlay.address),
1031
+ children: "Open in sidebar"
1032
+ })]
1033
+ });
1034
+ if (state.status === "image") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1035
+ className: "dsh-split-file dsh-split-file-media",
1036
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
1037
+ className: "dsh-split-file-image",
1038
+ src: state.url,
1039
+ alt: overlay.title
1040
+ })
1041
+ });
1042
+ const truncated = state.nextOffset !== void 0;
1043
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1044
+ ref: containerRef,
1045
+ className: "dsh-split-file",
1046
+ children: [
1047
+ floatingQuote !== null && inputActions !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1048
+ className: "dsh-split-floating-quote",
1049
+ style: {
1050
+ top: `${floatingQuote.top}px`,
1051
+ left: `${floatingQuote.left}px`
1052
+ },
1053
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1054
+ type: "button",
1055
+ className: "dsh-split-floating-quote-btn",
1056
+ onPointerDown: (e) => {
1057
+ e.preventDefault();
1058
+ },
1059
+ onClick: handleQuote,
1060
+ children: "Quote"
1061
+ })
1062
+ }),
1063
+ state.status === "markdown" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1064
+ className: "dsh-split-file-markdown",
1065
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.MarkdownText, {
1066
+ text: state.text,
1067
+ labels: MARKDOWN_LABELS
1068
+ })
1069
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1070
+ className: "dsh-split-file-code",
1071
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.CodeBlock, {
1072
+ code: state.text,
1073
+ lang: (0, _deepseek_ai_dsh_client_ui_primitives.languageForPath)(path),
1074
+ lineNumbers: true,
1075
+ streaming: truncated,
1076
+ copyLabel: MARKDOWN_LABELS.code.copyLabel,
1077
+ copiedLabel: MARKDOWN_LABELS.code.copiedLabel,
1078
+ toolbarLabels: MARKDOWN_LABELS.code.toolbarLabels
1079
+ })
1080
+ }),
1081
+ truncated && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
1082
+ className: "dsh-split-file-note",
1083
+ children: [
1084
+ loadingMore ? "Loading…" : "Showing the first page only.",
1085
+ " ",
1086
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1087
+ type: "button",
1088
+ className: "dsh-split-btn",
1089
+ disabled: loadingMore,
1090
+ onClick: () => {
1091
+ loadMore();
1092
+ },
1093
+ children: "Load more"
1094
+ }),
1095
+ " ",
1096
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1097
+ type: "button",
1098
+ className: "dsh-split-btn",
1099
+ onClick: () => openNativeResource(overlay.address),
1100
+ children: "Open in sidebar"
1101
+ })
1102
+ ]
1103
+ })
1104
+ ]
1105
+ });
1106
+ }
1107
+ function SplitSessionOverlay({ sessionId, useSession, useConversation, useSessions, renderFactorySlot }) {
1108
+ const { phase, hero } = useSplitPhase(sessionId, {
1109
+ useSession,
1110
+ useConversation,
1111
+ useSessions
1112
+ });
1113
+ return renderFactorySlot("conversation.content", {
1114
+ variant: "embedded",
1115
+ phase,
1116
+ hero
1117
+ });
1118
+ }
1119
+ /** Occupant of `split.overlay`: renders whichever overlay covers the host pane. */
1120
+ function SplitOverlayContent({ hostSessionId, sessionId, useSession, useConversation, useSessions, renderFactorySlot, readFile, readBytes, openNativeResource, inputActions }) {
1121
+ const overlay = (0, react.useSyncExternalStore)(splitStore.subscribe, splitStore.getSnapshot).overlays.get(hostSessionId);
1122
+ if (overlay === void 0) return null;
1123
+ if (overlay.kind === "session") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SplitSessionOverlay, {
1124
+ sessionId,
1125
+ useSession,
1126
+ useConversation,
1127
+ useSessions,
1128
+ renderFactorySlot
1129
+ });
1130
+ if (overlay.kind === "slot") return renderFactorySlot(overlay.slotName, overlay.props);
1131
+ if (overlay.kind === "file") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SplitFileOverlay, {
1132
+ hostSessionId,
1133
+ overlay,
1134
+ readFile,
1135
+ readBytes,
1136
+ openNativeResource,
1137
+ inputActions
1138
+ });
1139
+ return null;
1140
+ }
1141
+ /** @internal */
1142
+ const SplitOverlayHostContext = (0, react.createContext)(null);
1143
+ /** @internal */
1144
+ function SplitOverlayConversationView() {
1145
+ const host = (0, react.useContext)(SplitOverlayHostContext);
1146
+ if (host === null) return null;
1147
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1148
+ className: "dsh-split-overlay-view",
1149
+ children: host.renderSlot("split.overlay", { hostSessionId: host.sessionId })
1150
+ });
1151
+ }
1152
+ const SPLIT_OVERLAY_CONVERSATION_OPTIONS = { slots: { views: SplitOverlayConversationView } };
1153
+ /**
1154
+ * Purpose: Session-scoped occupant for an individual split pane including session header.
1155
+ * Contract:
1156
+ * - Inputs: Standard session props, renderSlot/renderFactorySlot, and SessionProvider.
1157
+ * - Outputs: Embedded conversation content or the pane overlay with its tab row.
1158
+ */
1159
+ function SplitPaneContent({ sessionId, useSession, useInput, useConversation, useSessions, useSessionStatus, useWorkspaces, renderSlot, renderFactorySlot, SessionProvider }) {
1160
+ const overlayHostValue = (0, react.useMemo)(() => ({
1161
+ sessionId,
1162
+ renderSlot
1163
+ }), [sessionId, renderSlot]);
1164
+ const state = (0, react.useSyncExternalStore)(splitStore.subscribe, splitStore.getSnapshot);
1165
+ const overlay = state.overlays.get(sessionId);
1166
+ const isFocused = state.focusedSessionId === sessionId;
1167
+ const isMaximized = state.maximizedSessionId === sessionId;
1168
+ const isHovered = state.hoveredSessionId === sessionId;
1169
+ const [isDragOver, setIsDragOver] = (0, react.useState)(false);
1170
+ const canDrag = state.sessionIds.length > 1 && state.maximizedSessionId === void 0;
1171
+ const inputPhase = useInput((s) => s.phase);
1172
+ const prevPhaseRef = (0, react.useRef)(inputPhase);
1173
+ const pendingCount = useSession((s) => s.pendingSubmissions.length);
1174
+ const isRunning = useSession((s) => s.running);
1175
+ const prevPendingRef = (0, react.useRef)(pendingCount);
1176
+ const prevRunningRef = (0, react.useRef)(isRunning);
1177
+ (0, react.useEffect)(() => {
1178
+ const isSubmitting = (prevPhaseRef.current === "plain" || prevPhaseRef.current === "claimed") && (inputPhase === "sending" || inputPhase === "submitting" || inputPhase === "adjudicating");
1179
+ const pendingIncreased = pendingCount > prevPendingRef.current;
1180
+ const becameRunning = !prevRunningRef.current && isRunning;
1181
+ const isReviewOverlay = overlay !== void 0 && (overlay.kind === "slot" || overlay.kind === "file");
1182
+ if ((isSubmitting || pendingIncreased || becameRunning) && isReviewOverlay) splitStore.closeOverlay(sessionId);
1183
+ prevPhaseRef.current = inputPhase;
1184
+ prevPendingRef.current = pendingCount;
1185
+ prevRunningRef.current = isRunning;
1186
+ }, [
1187
+ inputPhase,
1188
+ pendingCount,
1189
+ isRunning,
1190
+ overlay,
1191
+ sessionId
1192
+ ]);
1193
+ const { phase, hero } = useSplitPhase(sessionId, {
1194
+ useSession,
1195
+ useConversation,
1196
+ useSessions
1197
+ });
1198
+ const statuses = useSessionStatus((s) => s);
1199
+ const isSubagentRunning = (item) => {
1200
+ const status = statuses.get(item.id);
1201
+ return status !== void 0 && status.running !== void 0 ? status.running : item.running;
1202
+ };
1203
+ const ancestry = useSessions((s) => deriveAncestry(s, sessionId), isAncestryEqual);
1204
+ const currentSummary = useSessions((s) => s.byId[sessionId]);
1205
+ const displayTitle = currentSummary?.displayTitle || "Untitled Task";
1206
+ const subagents = useSessions((s) => Object.values(s.byId).filter((item) => Boolean(item && item.origin === "subagent" && item.parentId === sessionId)), isSubagentsEqual);
1207
+ const runningSubagents = subagents.filter(isSubagentRunning);
1208
+ const hasRunningSubagents = runningSubagents.length > 0;
1209
+ const workspace = useWorkspaces((s) => s.items.find((item) => item.sessionIds.includes(ancestry.length === 0 ? sessionId : ancestry[0].id)));
1210
+ const workspaceTitle = workspace === void 0 ? void 0 : workspaceDisplayTitle(workspace.title, "Default workspace");
1211
+ const [subagentMenuOpen, setSubagentMenuOpen] = (0, react.useState)(false);
1212
+ const subagentPillLabel = subagents.length === 1 ? "1 subagent" : hasRunningSubagents ? `${runningSubagents.length}/${subagents.length} subagents` : `${subagents.length} subagents`;
1213
+ const subagentPillTooltip = subagents.length === 1 ? hasRunningSubagents ? `Subagent active: ${subagents[0].displayTitle || "Untitled"}. Click to select.` : `Subagent finished: ${subagents[0].displayTitle || "Untitled"}. Click to select.` : hasRunningSubagents ? `${runningSubagents.length} active of ${subagents.length} subagents. Click to select.` : `${subagents.length} subagents finished. Click to select.`;
1214
+ (0, react.useEffect)(() => {
1215
+ if (overlay === void 0) return;
1216
+ const onKeyDown = (event) => {
1217
+ if (event.key !== "Escape" || event.defaultPrevented) return;
1218
+ if (splitStore.getSnapshot().focusedSessionId !== sessionId) return;
1219
+ splitStore.closeOverlay(sessionId);
1220
+ };
1221
+ document.addEventListener("keydown", onKeyDown);
1222
+ return () => document.removeEventListener("keydown", onKeyDown);
1223
+ }, [overlay, sessionId]);
1224
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1225
+ className: `dsh-split-pane-wrapper ${isDragOver ? "is-drag-over" : ""} ${isHovered ? "is-hovered" : ""} ${currentSummary?.origin === "subagent" || overlay?.kind === "session" ? "is-subagent" : ""}`,
1226
+ onDragOver: (event) => {
1227
+ if (!Array.from(event.dataTransfer.types).includes("application/x-dsh-split-session")) return;
1228
+ event.preventDefault();
1229
+ event.dataTransfer.dropEffect = "move";
1230
+ if (!isDragOver) setIsDragOver(true);
1231
+ },
1232
+ onDragLeave: (event) => {
1233
+ if (event.currentTarget.contains(event.relatedTarget)) return;
1234
+ setIsDragOver(false);
1235
+ },
1236
+ onDrop: (event) => {
1237
+ setIsDragOver(false);
1238
+ event.currentTarget.closest(".dsh-split-shell")?.classList.remove("is-dragging");
1239
+ const sourceId = event.dataTransfer.getData("application/x-dsh-split-session");
1240
+ if (sourceId) {
1241
+ event.preventDefault();
1242
+ splitStore.reorderSession(sourceId, sessionId);
1243
+ }
1244
+ },
1245
+ children: [
1246
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SplitPaneHeader, {
1247
+ focused: isFocused,
1248
+ status: renderSlot("split.pane.status", {}),
1249
+ workspaceTitle,
1250
+ ancestry,
1251
+ displayTitle,
1252
+ draggable: canDrag,
1253
+ onDragStart: (event) => {
1254
+ if (event.defaultPrevented || event.target.closest("button, [role='menu']")) {
1255
+ event.preventDefault();
1256
+ return;
1257
+ }
1258
+ event.currentTarget.closest(".dsh-split-shell")?.classList.add("is-dragging");
1259
+ event.dataTransfer.setData("application/x-dsh-split-session", sessionId);
1260
+ event.dataTransfer.effectAllowed = "move";
1261
+ },
1262
+ onDragEnd: (event) => {
1263
+ setIsDragOver(false);
1264
+ event.currentTarget.closest(".dsh-split-shell")?.classList.remove("is-dragging");
1265
+ },
1266
+ onDoubleClick: (event) => {
1267
+ if (event.defaultPrevented || event.target.closest("button")) return;
1268
+ splitStore.toggleMaximize(sessionId);
1269
+ },
1270
+ actions: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
1271
+ renderSlot("split.pane.header.actions", {}),
1272
+ state.sessionIds.length > 1 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
1273
+ label: isMaximized ? "Restore split layout" : "Maximize pane in split screen",
1274
+ portal: true,
1275
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1276
+ variant: "ghost",
1277
+ size: "sm",
1278
+ className: `dsh-split-icon-btn dsh-split-maximize-btn ${isMaximized ? "is-pressed" : ""}`,
1279
+ "aria-label": isMaximized ? "Restore split layout" : "Maximize pane in split screen",
1280
+ "aria-pressed": isMaximized,
1281
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconFullscreenOutlineRegular, { size: 14 }),
1282
+ onClick: (event) => {
1283
+ event.stopPropagation();
1284
+ splitStore.toggleMaximize(sessionId);
1285
+ }
1286
+ })
1287
+ }),
1288
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
1289
+ label: "Open this session in the native view",
1290
+ portal: true,
1291
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1292
+ variant: "ghost",
1293
+ size: "sm",
1294
+ className: "dsh-split-icon-btn",
1295
+ "aria-label": "Open this session in the native view",
1296
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconRightUpOutlineRegular, { size: 14 }),
1297
+ onClick: (event) => {
1298
+ event.stopPropagation();
1299
+ const targetSessionId = overlay?.kind === "session" ? typeof overlay.target === "string" ? overlay.target : overlay.target.childSessionId : sessionId;
1300
+ splitStore.suspend(targetSessionId);
1301
+ }
1302
+ })
1303
+ }),
1304
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Tooltip, {
1305
+ label: "Close pane",
1306
+ portal: true,
1307
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1308
+ variant: "ghost",
1309
+ size: "sm",
1310
+ className: "dsh-split-icon-btn dsh-split-pane-close",
1311
+ "aria-label": "Close pane",
1312
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 14 }),
1313
+ onClick: (event) => {
1314
+ event.stopPropagation();
1315
+ splitStore.removeSession(sessionId);
1316
+ }
1317
+ })
1318
+ })
1319
+ ] }),
1320
+ children: subagents.length > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Menu, {
1321
+ open: subagentMenuOpen,
1322
+ portal: true,
1323
+ compact: true,
1324
+ align: "start",
1325
+ onClose: () => setSubagentMenuOpen(false),
1326
+ onSelect: (id) => {
1327
+ setSubagentMenuOpen(false);
1328
+ const targetTitle = subagents.find((item) => item.id === id)?.displayTitle || "Untitled Task";
1329
+ splitStore.openSessionOverlay(sessionId, id, `Subagent: ${targetTitle}`);
1330
+ },
1331
+ items: subagents.map((item) => {
1332
+ const running = isSubagentRunning(item);
1333
+ return {
1334
+ id: item.id,
1335
+ icon: renderSlot("split.subagent.status", { state: running ? "active" : "review" }),
1336
+ label: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
1337
+ className: "dsh-split-subagent-menu-item",
1338
+ children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1339
+ className: "dsh-split-subagent-menu-title",
1340
+ title: item.displayTitle,
1341
+ children: item.displayTitle || "Untitled Subagent"
1342
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1343
+ className: "dsh-split-subagent-menu-status",
1344
+ children: running ? "Running" : "Finished"
1345
+ })]
1346
+ })
1347
+ };
1348
+ }),
1349
+ anchor: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1350
+ variant: "ghost",
1351
+ size: "sm",
1352
+ className: `dsh-split-subagent-pill ${subagentMenuOpen ? "is-active" : ""}`,
1353
+ title: subagentPillTooltip,
1354
+ "aria-haspopup": "menu",
1355
+ "aria-expanded": subagentMenuOpen,
1356
+ onClick: (event) => {
1357
+ event.stopPropagation();
1358
+ setSubagentMenuOpen((open) => !open);
1359
+ },
1360
+ children: [
1361
+ renderSlot("split.subagent.status", { state: hasRunningSubagents ? "active" : "review" }),
1362
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1363
+ className: "dsh-split-subagent-text",
1364
+ children: subagentPillLabel
1365
+ }),
1366
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconChevronDownOutlineRegular, { size: 12 })
1367
+ ]
1368
+ })
1369
+ })
1370
+ }),
1371
+ overlay !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1372
+ className: "dsh-split-overlay-tab",
1373
+ children: [
1374
+ overlay.kind === "file" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.PathLabel, {
1375
+ path: overlay.fullPath ?? overlay.path,
1376
+ className: "dsh-split-overlay-tab-path"
1377
+ }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
1378
+ className: "dsh-split-overlay-tab-title",
1379
+ title: overlay.title,
1380
+ children: overlay.title
1381
+ }),
1382
+ overlay.kind === "file" && previewKindOf(overlay.path) !== "image" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyContentsButton, { contents: overlay.contents }),
1383
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
1384
+ type: "button",
1385
+ className: "dsh-split-overlay-close",
1386
+ title: "Close",
1387
+ "aria-label": "Close overlay",
1388
+ onClick: (event) => {
1389
+ event.stopPropagation();
1390
+ splitStore.closeOverlay(sessionId);
1391
+ },
1392
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCloseOutlineRegular, { size: 14 })
1393
+ })
1394
+ ]
1395
+ }),
1396
+ /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1397
+ className: "dsh-split-pane-body",
1398
+ "data-phase": phase,
1399
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SplitOverlayHostContext.Provider, {
1400
+ value: overlayHostValue,
1401
+ children: overlay === void 0 ? renderFactorySlot("conversation.content", {
1402
+ variant: "embedded",
1403
+ phase,
1404
+ hero
1405
+ }) : overlay.kind === "session" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionProvider, {
1406
+ session: overlay.reference,
1407
+ children: renderSlot("split.overlay", { hostSessionId: sessionId })
1408
+ }) : renderFactorySlot("conversation.content", {
1409
+ variant: "embedded",
1410
+ phase,
1411
+ hero
1412
+ }, SPLIT_OVERLAY_CONVERSATION_OPTIONS)
1413
+ })
1414
+ })
1415
+ ]
1416
+ });
1417
+ }
1418
+ /**
1419
+ * Purpose: Root-scoped main panel rendering N equal-width vertical splits.
1420
+ * Contract:
1421
+ * - Inputs: SessionProvider and renderSlot from PropsRenderSlots.
1422
+ * - Outputs: Equal-width flexbox container with focused pane border.
1423
+ */
1424
+ function SplitView({ SessionProvider, renderSlot }) {
1425
+ const { sessionIds, focusedSessionId, maximizedSessionId } = (0, react.useSyncExternalStore)(splitStore.subscribe, splitStore.getSnapshot);
1426
+ (0, react.useEffect)(() => () => {
1427
+ const { maximizedSessionId } = splitStore.getSnapshot();
1428
+ if (maximizedSessionId !== void 0) splitStore.toggleMaximize(maximizedSessionId);
1429
+ }, []);
1430
+ const activeFocusedId = focusedSessionId !== void 0 && sessionIds.includes(focusedSessionId) ? focusedSessionId : sessionIds[0];
1431
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SplitLayout, {
1432
+ sessionIds,
1433
+ children: sessionIds.map((id) => {
1434
+ const ref = splitStore.getReference(id);
1435
+ if (ref === void 0) return null;
1436
+ const isFocused = id === activeFocusedId;
1437
+ const isHidden = maximizedSessionId !== void 0 && maximizedSessionId !== id && sessionIds.includes(maximizedSessionId);
1438
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
1439
+ "data-split-pane": id,
1440
+ className: `dsh-split-col ${isFocused ? "is-focused" : ""}`,
1441
+ style: isHidden ? { display: "none" } : void 0,
1442
+ onPointerDownCapture: () => {
1443
+ splitStore.setFocus(id);
1444
+ splitStore.setPointerOrigin(id);
1445
+ },
1446
+ onFocusCapture: () => {
1447
+ splitStore.setFocus(id);
1448
+ splitStore.setPointerOrigin(id);
1449
+ },
1450
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SessionProvider, {
1451
+ session: ref,
1452
+ children: renderSlot("split.pane", {})
1453
+ })
1454
+ }, id);
1455
+ })
1456
+ });
1457
+ }
1458
+ /** Header utility that returns from a suspended native view to the retained split. */
1459
+ function SplitRestoreHeaderAction(_props) {
1460
+ const { suspended } = (0, react.useSyncExternalStore)(splitStore.subscribe, splitStore.getSnapshot);
1461
+ if (!suspended) return null;
1462
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.Button, {
1463
+ variant: "primary",
1464
+ size: "sm",
1465
+ className: "dsh-split-restore-btn",
1466
+ icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_deepseek_ai_dsh_client_ui_primitives.IconCompareSplitOutlineRegular, { size: 16 }),
1467
+ title: "Back to split view",
1468
+ "aria-label": "Back to split view",
1469
+ onClick: () => splitStore.resume(),
1470
+ children: "Back to split"
1471
+ });
1472
+ }
1473
+ // src/client/styles.ts
1474
+ const SPLIT_VIEW_CSS = `
1475
+ .dsh-split-shell,
1476
+ .dsh-split-shell {
1477
+ display: flex;
1478
+ flex-direction: row;
1479
+ width: 100%;
1480
+ height: 100%;
1481
+ overflow: hidden;
1482
+ background: var(--dsw-alias-bg-base);
1483
+ }
1484
+
1485
+ .dsh-split-col,
1486
+ .dsh-split-col {
1487
+ flex: 1 1 0;
1488
+ min-width: 0;
1489
+ height: 100%;
1490
+ position: relative;
1491
+ display: flex;
1492
+ flex-direction: column;
1493
+ overflow: hidden;
1494
+ }
1495
+
1496
+ .dsh-split-col:not(:last-child)::after,
1497
+ .dsh-split-col:not(:last-child)::after {
1498
+ content: '';
1499
+ position: absolute;
1500
+ inset-block: 0;
1501
+ inset-inline-end: 0;
1502
+ width: 0.5px;
1503
+ background: linear-gradient(to bottom, transparent, var(--dsw-alias-border-l3) 24px);
1504
+ pointer-events: none;
1505
+ }
1506
+
1507
+ .dsh-split-pane-wrapper,
1508
+ .dsh-split-pane-wrapper {
1509
+ display: flex;
1510
+ flex-direction: column;
1511
+ width: 100%;
1512
+ height: 100%;
1513
+ min-width: 0;
1514
+ overflow: hidden;
1515
+ background: var(--dsw-alias-bg-base);
1516
+ }
1517
+
1518
+ /* Subagent panes recolour the composer's send button (info-fill tokens) so it is obvious
1519
+ * you are messaging a subagent, not the main session. */
1520
+ .dsh-split-pane-wrapper.is-subagent {
1521
+ --dsw-alias-button-info-fill: var(--dsw-alias-state-warn-primary);
1522
+ --dsw-alias-button-info-hover: var(--dsw-alias-state-warn-secondary);
1523
+ }
1524
+
1525
+ .dsh-split-pane-header,
1526
+ .dsh-split-pane-header {
1527
+ position: relative;
1528
+ display: flex;
1529
+ align-items: center;
1530
+ justify-content: space-between;
1531
+ gap: 8px;
1532
+ min-height: 40px;
1533
+ height: 40px;
1534
+ padding: 0 12px;
1535
+ padding-inline-start: max(12px, var(--dsh-frame-leading-clearance, 0px));
1536
+ background: transparent;
1537
+ flex-shrink: 0;
1538
+ box-sizing: border-box;
1539
+ user-select: none;
1540
+ }
1541
+
1542
+ [data-sidebar-drawer] .dsh-split-pane-header,
1543
+ [data-sidebar-drawer] .dsh-split-pane-header {
1544
+ height: 50px !important;
1545
+ min-height: 50px !important;
1546
+ padding-inline-start: max(48px, var(--dsh-frame-leading-clearance, 48px)) !important;
1547
+ }
1548
+
1549
+ .dsh-split-pane-header[draggable="true"],
1550
+ .dsh-split-pane-header[draggable="true"] {
1551
+ cursor: grab;
1552
+ }
1553
+
1554
+ .dsh-split-pane-header[draggable="true"]:active,
1555
+ .dsh-split-pane-header[draggable="true"]:active {
1556
+ cursor: grabbing;
1557
+ }
1558
+
1559
+ .dsh-split-pane-wrapper.is-drag-over,
1560
+ .dsh-split-pane-wrapper.is-drag-over {
1561
+ box-shadow: inset 0 0 0 2px var(--dsw-alias-state-business-primary);
1562
+ }
1563
+
1564
+ .dsh-split-shell.is-dragging .dsh-split-pane-body,
1565
+ .dsh-split-shell.is-dragging .dsh-split-pane-body {
1566
+ pointer-events: none;
1567
+ }
1568
+
1569
+ @media (hover: hover) {
1570
+ .dsh-split-header-actions,
1571
+ .dsh-split-header-actions {
1572
+ position: absolute;
1573
+ inset-inline-end: 0;
1574
+ background: var(--dsw-alias-bg-base);
1575
+ box-shadow: -8px 0 8px var(--dsw-alias-bg-base);
1576
+ opacity: 0;
1577
+ pointer-events: none;
1578
+ transition: opacity var(--ds-transition-duration-fast, 0.1s) var(--ds-ease-in-out, ease);
1579
+ }
1580
+
1581
+ .dsh-split-pane-header:is(:hover, :focus-within) .dsh-split-header-actions,
1582
+ .dsh-split-pane-header:is(:hover, :focus-within) .dsh-split-header-actions,
1583
+ .dsh-split-header-actions:has(.is-pressed),
1584
+ .dsh-split-header-actions:has(.is-pressed) {
1585
+ opacity: 1;
1586
+ pointer-events: auto;
1587
+ }
1588
+ }
1589
+
1590
+ @media (prefers-reduced-motion: reduce) {
1591
+ .dsh-split-header-actions,
1592
+ .dsh-split-header-actions {
1593
+ transition: none;
1594
+ }
1595
+ }
1596
+
1597
+ .dsh-split-header-left,
1598
+ .dsh-split-header-left {
1599
+ position: relative;
1600
+ display: flex;
1601
+ align-items: center;
1602
+ gap: 10px;
1603
+ min-height: 28px;
1604
+ min-width: 0;
1605
+ flex: 1;
1606
+ overflow: hidden;
1607
+ font-size: var(--dsh-content-font-size, 14px);
1608
+ line-height: 20px;
1609
+ }
1610
+
1611
+ .dsh-split-pane-status,
1612
+ .dsh-split-pane-status {
1613
+ display: inline-block;
1614
+ width: 6px;
1615
+ flex: none;
1616
+ }
1617
+
1618
+ /* The current crumb's chip overhangs its box by the chip padding; the reserved strip
1619
+ * keeps that bleed inside the clip rect without moving the breadcrumb. */
1620
+ .dsh-split-crumbs,
1621
+ .dsh-split-crumbs {
1622
+ display: flex;
1623
+ flex: 1;
1624
+ align-items: baseline;
1625
+ gap: 8px;
1626
+ min-width: 0;
1627
+ overflow: hidden;
1628
+ padding-inline: 6px;
1629
+ margin-inline: -6px;
1630
+ white-space: nowrap;
1631
+ }
1632
+
1633
+ .dsh-split-crumb-seg,
1634
+ .dsh-split-crumb-seg {
1635
+ display: inline-flex;
1636
+ align-items: baseline;
1637
+ gap: 8px;
1638
+ min-width: 0;
1639
+ flex: 0 1 auto;
1640
+ max-width: max-content;
1641
+ overflow: hidden;
1642
+ }
1643
+
1644
+ .dsh-split-crumb-seg:last-child,
1645
+ .dsh-split-crumb-seg:last-child {
1646
+ flex: 1 1 auto;
1647
+ min-width: 0;
1648
+ max-width: 100%;
1649
+ overflow: visible;
1650
+ }
1651
+
1652
+ .dsh-split-crumb-sep,
1653
+ .dsh-split-crumb-sep {
1654
+ flex: none;
1655
+ color: var(--dsw-alias-label-caption);
1656
+ }
1657
+
1658
+ .dsh-split-crumb,
1659
+ .dsh-split-crumb {
1660
+ display: inline-block;
1661
+ box-sizing: border-box;
1662
+ min-width: 0;
1663
+ max-width: 100%;
1664
+ overflow: hidden;
1665
+ padding: 0;
1666
+ border-radius: var(--dsw-radius-md);
1667
+ text-overflow: ellipsis;
1668
+ white-space: nowrap;
1669
+ color: var(--dsw-alias-label-tertiary);
1670
+ transition: color var(--ds-transition-duration-fast, 0.1s) var(--ds-ease-in-out, ease),
1671
+ background-color var(--ds-transition-duration-fast, 0.1s) var(--ds-ease-in-out, ease);
1672
+ }
1673
+
1674
+ .dsh-split-crumb.is-current,
1675
+ .dsh-split-crumb.is-current {
1676
+ font-weight: 500;
1677
+ color: var(--dsw-alias-label-secondary);
1678
+ /* Compensated so the chip is padded on both sides while the title keeps its place;
1679
+ * the nav reserves the strip the overhang bleeds into. */
1680
+ padding-inline: 6px;
1681
+ margin-inline: -6px;
1682
+ min-width: 0;
1683
+ max-width: 100%;
1684
+ }
1685
+
1686
+ .dsh-split-crumbs > .dsh-split-crumb.is-current,
1687
+ .dsh-split-crumbs > .dsh-split-crumb.is-current {
1688
+ flex: 1 1 auto;
1689
+ min-width: 0;
1690
+ max-width: 100%;
1691
+ }
1692
+
1693
+ .dsh-split-pane-header.is-focused .dsh-split-crumb.is-current,
1694
+ .dsh-split-pane-header.is-focused .dsh-split-crumb.is-current {
1695
+ font-weight: 500;
1696
+ color: var(--dsw-alias-label-primary);
1697
+ }
1698
+
1699
+ /* Block-only compensation: the chip grows vertically on hover, leaving the reserved
1700
+ * horizontal metrics untouched. */
1701
+ .dsh-split-pane-wrapper.is-hovered .dsh-split-crumb.is-current {
1702
+ background: var(--dsw-alias-interactive-bg-hover);
1703
+ color: var(--dsw-alias-label-primary);
1704
+ padding-block: 2px;
1705
+ margin-block: -2px;
1706
+ }
1707
+
1708
+ .dsh-split-subagent-pill,
1709
+ .dsh-split-subagent-pill {
1710
+ display: inline-flex;
1711
+ align-items: center;
1712
+ gap: 6px;
1713
+ max-width: 140px;
1714
+ padding: 0 8px;
1715
+ color: var(--dsw-alias-label-secondary);
1716
+ font-size: 11px;
1717
+ white-space: nowrap;
1718
+ flex-shrink: 0;
1719
+ }
1720
+
1721
+ .dsh-split-subagent-pill:hover,
1722
+ .dsh-split-subagent-pill:hover,
1723
+ .dsh-split-subagent-pill.is-active,
1724
+ .dsh-split-subagent-pill.is-active {
1725
+ background: var(--dsw-alias-interactive-bg-hover);
1726
+ color: var(--dsw-alias-label-primary);
1727
+ }
1728
+
1729
+ .dsh-split-subagent-text,
1730
+ .dsh-split-subagent-text {
1731
+ min-width: 0;
1732
+ max-width: 85px;
1733
+ overflow: hidden;
1734
+ text-overflow: ellipsis;
1735
+ white-space: nowrap;
1736
+ }
1737
+
1738
+ .dsh-split-subagent-menu-item,
1739
+ .dsh-split-subagent-menu-item {
1740
+ display: flex;
1741
+ align-items: center;
1742
+ justify-content: space-between;
1743
+ gap: 12px;
1744
+ width: 100%;
1745
+ min-width: 0;
1746
+ }
1747
+
1748
+ .dsh-split-subagent-menu-title,
1749
+ .dsh-split-subagent-menu-title {
1750
+ overflow: hidden;
1751
+ text-overflow: ellipsis;
1752
+ white-space: nowrap;
1753
+ flex: 1;
1754
+ }
1755
+
1756
+ .dsh-split-subagent-menu-status,
1757
+ .dsh-split-subagent-menu-status {
1758
+ font-size: 11px;
1759
+ color: var(--dsw-alias-label-caption);
1760
+ flex-shrink: 0;
1761
+ }
1762
+
1763
+ .dsh-split-crumb.is-subagent,
1764
+ .dsh-split-crumb.is-subagent {
1765
+ font-size: 12px;
1766
+ line-height: 18px;
1767
+ }
1768
+
1769
+ .dsh-split-pane-body,
1770
+ .dsh-split-pane-body {
1771
+ flex: 1 1 0;
1772
+ min-height: 0;
1773
+ width: 100%;
1774
+ display: flex;
1775
+ flex-direction: column;
1776
+ overflow: hidden;
1777
+ position: relative;
1778
+ }
1779
+
1780
+ .dsh-split-pane-body[data-phase="active"]:has([data-chat-flow])::before,
1781
+ .dsh-split-pane-body[data-phase="active"]:has([data-chat-flow])::before {
1782
+ content: '';
1783
+ position: absolute;
1784
+ inset: 0 0 auto;
1785
+ height: 12px;
1786
+ z-index: 10;
1787
+ background: linear-gradient(to bottom, var(--dsw-alias-bg-base), transparent);
1788
+ pointer-events: none;
1789
+ }
1790
+
1791
+ .dsh-split-header-actions {
1792
+ display: inline-flex;
1793
+ align-items: center;
1794
+ gap: 2px;
1795
+ flex-shrink: 0;
1796
+ height: 28px;
1797
+ }
1798
+
1799
+ .dsh-split-icon-btn,
1800
+ .dsh-split-header-actions button {
1801
+ width: 28px !important;
1802
+ height: 28px !important;
1803
+ min-width: 28px !important;
1804
+ max-width: 28px !important;
1805
+ min-height: 28px !important;
1806
+ max-height: 28px !important;
1807
+ color: var(--dsw-alias-label-secondary);
1808
+ padding: 0 !important;
1809
+ border: 0 !important;
1810
+ border-radius: var(--dsw-radius-xs) !important;
1811
+ flex: none;
1812
+ display: inline-flex;
1813
+ align-items: center;
1814
+ justify-content: center;
1815
+ background: transparent;
1816
+ transition: color var(--ds-transition-duration-fast, 0.1s) var(--ds-ease-in-out, ease),
1817
+ background var(--ds-transition-duration-fast, 0.1s) var(--ds-ease-in-out, ease);
1818
+ }
1819
+
1820
+ .dsh-split-pane-close {
1821
+ margin-inline-start: 4px;
1822
+ }
1823
+
1824
+ .dsh-split-icon-btn svg,
1825
+ .dsh-split-header-actions button svg {
1826
+ width: 14px !important;
1827
+ height: 14px !important;
1828
+ flex: none;
1829
+ }
1830
+
1831
+ @media (hover: hover) {
1832
+ .dsh-split-icon-btn:hover:not(:disabled),
1833
+ .dsh-split-header-actions button:hover:not(:disabled) {
1834
+ background: var(--dsw-alias-interactive-bg-hover) !important;
1835
+ color: var(--dsw-alias-label-primary) !important;
1836
+ }
1837
+ }
1838
+
1839
+ .dsh-split-icon-btn:focus-visible,
1840
+ .dsh-split-header-actions button:focus-visible {
1841
+ outline: var(--dsw-focus-ring-width) solid
1842
+ var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
1843
+ outline-offset: -2px;
1844
+ z-index: 1;
1845
+ }
1846
+
1847
+ .dsh-split-icon-btn.is-pressed {
1848
+ background: var(--dsw-alias-interactive-bg-active) !important;
1849
+ color: var(--dsw-alias-state-business-primary) !important;
1850
+ }
1851
+
1852
+ .dsh-split-popout-btn,
1853
+ .dsh-split-popout-btn {
1854
+ width: 24px;
1855
+ height: 24px;
1856
+ padding: 0;
1857
+ display: inline-flex;
1858
+ align-items: center;
1859
+ justify-content: center;
1860
+ border-radius: var(--dsw-radius-sm);
1861
+ color: var(--dsw-alias-label-secondary);
1862
+ opacity: 0.7;
1863
+ transition: opacity var(--ds-transition-duration-fast, 0.1s) var(--ds-ease-in-out, ease),
1864
+ color var(--ds-transition-duration-fast, 0.1s) var(--ds-ease-in-out, ease),
1865
+ background var(--ds-transition-duration-fast, 0.1s) var(--ds-ease-in-out, ease);
1866
+ flex-shrink: 0;
1867
+ }
1868
+
1869
+ .dsh-split-popout-btn:hover,
1870
+ .dsh-split-popout-btn:hover {
1871
+ opacity: 1;
1872
+ color: var(--dsw-alias-state-business-primary);
1873
+ background: var(--dsw-alias-interactive-bg-hover);
1874
+ }
1875
+
1876
+ .dsh-split-pane-header:not(.is-focused) .dsh-split-popout-btn,
1877
+ .dsh-split-pane-header:not(.is-focused) .dsh-split-popout-btn {
1878
+ opacity: 0.6;
1879
+ }
1880
+
1881
+ .dsh-split-pane-header:not(.is-focused):hover .dsh-split-popout-btn,
1882
+ .dsh-split-pane-header:not(.is-focused):hover .dsh-split-popout-btn {
1883
+ opacity: 0.95;
1884
+ }
1885
+
1886
+ .dsh-split-btn,
1887
+ .dsh-split-btn {
1888
+ display: inline-flex;
1889
+ align-items: center;
1890
+ justify-content: center;
1891
+ gap: 4px;
1892
+ height: 28px;
1893
+ padding: 0 10px;
1894
+ border: 0.5px solid var(--dsw-alias-border-l3);
1895
+ border-radius: var(--dsw-radius-sm);
1896
+ background: transparent;
1897
+ color: var(--dsw-alias-label-secondary);
1898
+ font-size: 12px;
1899
+ font-family: inherit;
1900
+ cursor: pointer;
1901
+ white-space: nowrap;
1902
+ }
1903
+
1904
+ .dsh-split-btn:hover,
1905
+ .dsh-split-btn:hover {
1906
+ background: var(--dsw-alias-interactive-bg-hover);
1907
+ color: var(--dsw-alias-label-primary);
1908
+ }
1909
+
1910
+ .dsh-split-btn:disabled,
1911
+ .dsh-split-btn:disabled {
1912
+ cursor: default;
1913
+ opacity: 0.6;
1914
+ }
1915
+
1916
+ .dsh-split-overlay-tab,
1917
+ .dsh-split-overlay-tab {
1918
+ display: flex;
1919
+ align-items: center;
1920
+ gap: 8px;
1921
+ min-height: 36px;
1922
+ height: 36px;
1923
+ padding: 0 8px 0 12px;
1924
+ border-bottom: 0.5px solid var(--dsw-alias-border-l3);
1925
+ background: var(--dsw-alias-bg-base);
1926
+ flex-shrink: 0;
1927
+ box-sizing: border-box;
1928
+ user-select: none;
1929
+ }
1930
+
1931
+ .dsh-split-overlay-tab-title,
1932
+ .dsh-split-overlay-tab-title {
1933
+ flex: 1;
1934
+ min-width: 0;
1935
+ overflow: hidden;
1936
+ text-overflow: ellipsis;
1937
+ white-space: nowrap;
1938
+ font-size: 13px;
1939
+ color: var(--dsw-alias-label-secondary);
1940
+ }
1941
+
1942
+ .dsh-split-overlay-tab-path,
1943
+ .dsh-split-overlay-tab-path {
1944
+ user-select: text;
1945
+ cursor: text;
1946
+ font-size: 13px;
1947
+ }
1948
+
1949
+ .dsh-split-overlay-close,
1950
+ .dsh-split-overlay-close {
1951
+ display: inline-flex;
1952
+ align-items: center;
1953
+ justify-content: center;
1954
+ width: 24px;
1955
+ height: 24px;
1956
+ padding: 0;
1957
+ border: none;
1958
+ border-radius: var(--dsw-radius-xs);
1959
+ background: transparent;
1960
+ color: var(--dsw-alias-label-tertiary);
1961
+ cursor: pointer;
1962
+ flex-shrink: 0;
1963
+ }
1964
+
1965
+ .dsh-split-overlay-close:hover,
1966
+ .dsh-split-overlay-close:hover {
1967
+ background: var(--dsw-alias-interactive-bg-hover);
1968
+ color: var(--dsw-alias-label-primary);
1969
+ }
1970
+
1971
+ .dsh-split-overlay-close:disabled,
1972
+ .dsh-split-overlay-close:disabled {
1973
+ cursor: default;
1974
+ opacity: 0.4;
1975
+ background: transparent;
1976
+ }
1977
+
1978
+ .dsh-split-overlay-close:focus-visible,
1979
+ .dsh-split-overlay-close:focus-visible {
1980
+ outline: var(--dsw-focus-ring-width) solid
1981
+ var(--dsw-focus-ring-color, var(--dsw-alias-state-business-primary));
1982
+ outline-offset: -2px;
1983
+ }
1984
+
1985
+ .dsh-split-file,
1986
+ .dsh-split-file {
1987
+ position: relative;
1988
+ flex: 1 1 0;
1989
+ min-height: 0;
1990
+ overflow: auto;
1991
+ }
1992
+
1993
+ .dsh-split-floating-quote,
1994
+ .dsh-split-floating-quote {
1995
+ position: absolute;
1996
+ z-index: 25;
1997
+ pointer-events: auto;
1998
+ }
1999
+
2000
+ .dsh-split-floating-quote-btn,
2001
+ .dsh-split-floating-quote-btn {
2002
+ display: inline-flex;
2003
+ align-items: center;
2004
+ justify-content: center;
2005
+ height: 24px;
2006
+ padding: 0 10px;
2007
+ font-size: 11px;
2008
+ font-weight: 500;
2009
+ font-family: var(--dsw-font-family);
2010
+ color: #ffffff;
2011
+ background: var(--dsw-alias-interactive-bg-primary, #3b82f6);
2012
+ border: none;
2013
+ border-radius: 12px;
2014
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
2015
+ cursor: pointer;
2016
+ user-select: none;
2017
+ white-space: nowrap;
2018
+ }
2019
+
2020
+ .dsh-split-floating-quote-btn:hover,
2021
+ .dsh-split-floating-quote-btn:hover {
2022
+ filter: brightness(1.1);
2023
+ }
2024
+
2025
+ .dsh-split-file-text,
2026
+ .dsh-split-file-text {
2027
+ margin: 0;
2028
+ padding: 12px 14px;
2029
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
2030
+ font-size: 12px;
2031
+ line-height: 1.55;
2032
+ white-space: pre-wrap;
2033
+ word-break: break-word;
2034
+ color: var(--dsw-alias-label-primary, #1e293b);
2035
+ }
2036
+
2037
+ .dsh-split-file-code,
2038
+ .dsh-split-file-code {
2039
+ width: 100%;
2040
+ min-width: 0;
2041
+ }
2042
+
2043
+ .dsh-split-file-code .md-code-block,
2044
+ .dsh-split-file-code .md-code-block {
2045
+ margin: 0 !important;
2046
+ --dsl-code-block-border-radius: 0px;
2047
+ --dsl-code-block-background: transparent;
2048
+ }
2049
+
2050
+ .dsh-split-file-markdown,
2051
+ .dsh-split-file-markdown {
2052
+ max-width: 860px;
2053
+ margin: 0 auto;
2054
+ box-sizing: border-box;
2055
+ padding: 12px 16px;
2056
+ font-size: 13px;
2057
+ color: var(--dsw-alias-label-primary, #1e293b);
2058
+ }
2059
+
2060
+ .dsh-split-file-markdown img,
2061
+ .dsh-split-file-markdown img {
2062
+ max-width: 100%;
2063
+ height: auto;
2064
+ }
2065
+
2066
+ .dsh-split-file-media,
2067
+ .dsh-split-file-media {
2068
+ display: flex;
2069
+ align-items: flex-start;
2070
+ justify-content: center;
2071
+ }
2072
+
2073
+ .dsh-split-file-note,
2074
+ .dsh-split-file-note {
2075
+ margin: 0;
2076
+ padding: 12px 14px;
2077
+ font-size: 12px;
2078
+ line-height: 1.5;
2079
+ color: var(--dsw-alias-label-tertiary, #64748b);
2080
+ }
2081
+
2082
+ .dsh-split-file-image,
2083
+ .dsh-split-file-image {
2084
+ display: block;
2085
+ max-width: calc(100% - 28px);
2086
+ max-height: calc(100% - 28px);
2087
+ object-fit: contain;
2088
+ margin: 14px auto;
2089
+ }
2090
+
2091
+ .dsh-split-restore-btn,
2092
+ .dsh-split-restore-btn {
2093
+ display: inline-flex;
2094
+ align-items: center;
2095
+ gap: 6px;
2096
+ background: var(--dsw-alias-state-business-primary, #3964fe) !important;
2097
+ color: #ffffff !important;
2098
+ border: 1px solid transparent !important;
2099
+ font-weight: 500;
2100
+ }
2101
+
2102
+ .dsh-split-restore-btn:hover,
2103
+ .dsh-split-restore-btn:hover {
2104
+ background: var(--dsw-alias-brand-hover, #2b54e8) !important;
2105
+ color: #ffffff !important;
2106
+ }
2107
+
2108
+ @media (max-width: 767px) {
2109
+ [data-sidebar-drawer] [data-global-panel]:has(.dsh-split-shell),
2110
+ [data-sidebar-drawer] [data-global-panel]:has(.dsh-split-shell) {
2111
+ padding-top: 0 !important;
2112
+ }
2113
+
2114
+ .dsh-split-pane-header,
2115
+ .dsh-split-pane-header {
2116
+ height: 50px !important;
2117
+ min-height: 50px !important;
2118
+ padding-inline-start: max(48px, var(--dsh-frame-leading-clearance, 48px)) !important;
2119
+ }
2120
+
2121
+ .dsh-split-crumb-seg:last-child,
2122
+ .dsh-split-crumb-seg:last-child {
2123
+ flex: 1 1 auto !important;
2124
+ min-width: 0 !important;
2125
+ max-width: 100% !important;
2126
+ }
2127
+
2128
+ .dsh-split-crumb.is-current,
2129
+ .dsh-split-crumb.is-current {
2130
+ min-width: 0 !important;
2131
+ max-width: 100% !important;
2132
+ }
2133
+
2134
+ .dsh-split-col:not(.is-focused),
2135
+ .dsh-split-col:not(.is-focused) {
2136
+ display: none !important;
2137
+ }
2138
+
2139
+ .dsh-split-col.is-focused,
2140
+ .dsh-split-col.is-focused {
2141
+ display: flex !important;
2142
+ flex: 1 1 100% !important;
2143
+ width: 100% !important;
2144
+ }
2145
+
2146
+ .dsh-split-col:not(:last-child)::after,
2147
+ .dsh-split-col:not(:last-child)::after {
2148
+ display: none !important;
2149
+ }
2150
+
2151
+ .dsh-split-maximize-btn,
2152
+ .dsh-split-maximize-btn {
2153
+ display: none !important;
2154
+ }
2155
+ }
2156
+
2157
+ .dsh-split-overlay-view,
2158
+ .dsh-split-overlay-view {
2159
+ flex: 1 1 0;
2160
+ min-height: 0;
2161
+ width: 100%;
2162
+ display: flex;
2163
+ flex-direction: column;
2164
+ overflow: hidden;
2165
+ }
2166
+
2167
+ .dsh-split-pane-body:has(.dsh-split-overlay-view) > [data-conversation-content] > [data-conversation-scroll],
2168
+ .dsh-split-pane-body:has(.dsh-split-overlay-view) > [data-conversation-content] > [data-conversation-scroll] {
2169
+ overflow: hidden;
2170
+ display: flex;
2171
+ flex-direction: column;
2172
+ }
2173
+
2174
+ .dsh-split-pane-body:has(.dsh-split-file) .dsh-split-file,
2175
+ .dsh-split-pane-body:has(.dsh-split-file) .dsh-split-file {
2176
+ box-sizing: border-box;
2177
+ padding-bottom: 36px;
2178
+ }
2179
+
2180
+ .dsh-split-pane-body:has(.dsh-split-file) [data-composer-seat],
2181
+ .dsh-split-pane-body:has(.dsh-split-file) [data-composer-seat] {
2182
+ position: relative;
2183
+ flex: none;
2184
+ margin-top: -36px;
2185
+ background: linear-gradient(
2186
+ 180deg,
2187
+ color-mix(in srgb, var(--dsw-alias-bg-base) 0%, transparent) 0px,
2188
+ var(--dsw-alias-bg-base) 28px,
2189
+ var(--dsw-alias-bg-base) 100%
2190
+ );
2191
+ border-top: none;
2192
+ padding: 16px 12px 12px;
2193
+ pointer-events: none;
2194
+ }
2195
+
2196
+ .dsh-split-pane-body:has(.dsh-split-file) [data-composer-seat] > *,
2197
+ .dsh-split-pane-body:has(.dsh-split-file) [data-composer-seat] > * {
2198
+ pointer-events: auto;
2199
+ }
2200
+
2201
+ .dsh-split-pane-body > [data-conversation-content],
2202
+ .dsh-split-pane-body > [data-conversation-content] {
2203
+ flex: 1 1 0;
2204
+ height: 100%;
2205
+ width: 100%;
2206
+ min-height: 0;
2207
+ display: flex;
2208
+ flex-direction: column;
2209
+ overflow: hidden;
2210
+ --dsh-chat-content-width: min(100%, 860px);
2211
+ }
2212
+
2213
+ .dsh-split-pane-body > [data-conversation-content] > [data-conversation-scroll],
2214
+ .dsh-split-pane-body > [data-conversation-content] > [data-conversation-scroll] {
2215
+ flex: 1 1 0;
2216
+ height: 100%;
2217
+ width: 100%;
2218
+ min-height: 0;
2219
+ overflow-x: hidden;
2220
+ }
2221
+
2222
+ .dsh-split-pane-body [data-conversation-scroll] :is([class*="_scroll"], :has(> [data-chat-flow])),
2223
+ .dsh-split-pane-body [data-conversation-scroll] :is([class*="_scroll"], :has(> [data-chat-flow])) {
2224
+ padding: 16px 12px;
2225
+ }
2226
+
2227
+ .dsh-split-pane-body [data-conversation-content] :is([class*="md-table-wide"], .md-table-wide),
2228
+ .dsh-split-pane-body [data-conversation-content] :is([class*="md-table-wide"], .md-table-wide) {
2229
+ width: 100% !important;
2230
+ max-width: 100% !important;
2231
+ margin-left: 0 !important;
2232
+ padding-left: 0 !important;
2233
+ overflow-x: auto !important;
2234
+ padding-bottom: 0 !important;
2235
+ }
2236
+ `;
2237
+ function registerSplitStyles(_ctx, pluginId) {
2238
+ if (typeof document === "undefined") return () => {};
2239
+ const styleEl = document.createElement("style");
2240
+ styleEl.setAttribute("data-plugin", pluginId);
2241
+ styleEl.textContent = SPLIT_VIEW_CSS;
2242
+ document.head.appendChild(styleEl);
2243
+ return () => {
2244
+ styleEl.remove();
2245
+ };
2246
+ }
2247
+ // src/client/index.tsx
2248
+ const name = "dsh-client-split-view";
2249
+ const inject = [
2250
+ "slots",
2251
+ "sessions",
2252
+ "uiWorkspace",
2253
+ "uiSession",
2254
+ "layout",
2255
+ "remote",
2256
+ "sidebarRight",
2257
+ "remote.workspaceFiles"
2258
+ ];
2259
+ function apply(ctx) {
2260
+ const sessions = ctx.sessions;
2261
+ const getActiveSessionId = () => {
2262
+ if (ctx.layout.panelInfo.getSnapshot().activePanelId !== null) return;
2263
+ const list = sessions.list.getSnapshot();
2264
+ return list.ids.find((id) => (list.byId[id]?.retainedBy.mainView ?? 0) > 0);
2265
+ };
2266
+ splitStore.setCallbacks((id) => ctx.layout.selectPanel(id), (id) => ctx.uiWorkspace.openSession(id), () => ctx.sessions, getActiveSessionId);
2267
+ ctx.provide("splitView", splitStore);
2268
+ const cachedOverlayServices = {
2269
+ readFile: (sessionId, path, offset, signal) => ctx.remote.workspaceFiles.read(sessionId, path, { offset }, signal),
2270
+ readBytes: (sessionId, path, signal) => ctx.remote.workspaceFiles.readBytes(sessionId, path, {}, signal),
2271
+ openNativeResource: (address) => {
2272
+ ctx.sidebarRight.openResource(address);
2273
+ }
2274
+ };
2275
+ const overlayServices = () => cachedOverlayServices;
2276
+ ctx.effect(() => {
2277
+ return ctx.slots.inject("main", () => {
2278
+ const unregisterMain = ctx.slots.register({
2279
+ name: "main",
2280
+ key: "split-view",
2281
+ children: { "split.pane": {
2282
+ kind: "single",
2283
+ scope: "session"
2284
+ } }
2285
+ }, SplitView);
2286
+ const unregisterPane = ctx.slots.register({
2287
+ name: "split.pane",
2288
+ children: {
2289
+ "split.overlay": {
2290
+ kind: "single",
2291
+ scope: "session"
2292
+ },
2293
+ "split.pane.status": {
2294
+ kind: "single",
2295
+ scope: "session"
2296
+ },
2297
+ "split.pane.header.actions": {
2298
+ kind: "list",
2299
+ scope: "session"
2300
+ },
2301
+ "split.subagent.status": {
2302
+ kind: "single",
2303
+ scope: "session"
2304
+ }
2305
+ }
2306
+ }, SplitPaneContent);
2307
+ const unregisterOverlay = ctx.slots.register({
2308
+ name: "split.overlay",
2309
+ inject: overlayServices
2310
+ }, SplitOverlayContent);
2311
+ return () => {
2312
+ unregisterOverlay();
2313
+ unregisterPane();
2314
+ unregisterMain();
2315
+ };
2316
+ });
2317
+ }, "split-view: main view");
2318
+ ctx.effect(() => {
2319
+ let hydrated = false;
2320
+ const attemptHydration = () => {
2321
+ if (hydrated) return;
2322
+ if (sessions.list.getSnapshot().phase !== "ready") return;
2323
+ hydrated = true;
2324
+ splitStore.hydrate(ctx.sessions);
2325
+ };
2326
+ attemptHydration();
2327
+ return sessions.list.subscribe(attemptHydration);
2328
+ }, "split-view: hydrate on session readiness");
2329
+ ctx.effect(() => () => {
2330
+ splitStore.dispose();
2331
+ }, "split-view: store lifecycle");
2332
+ ctx.effect(() => registerSplitStyles(ctx, "dsh-client-split-view"), "split-view: styles");
2333
+ ctx.effect(() => {
2334
+ const uiWorkspace = ctx.uiWorkspace;
2335
+ const sidebarRight = ctx.sidebarRight;
2336
+ const originalOpenSession = uiWorkspace.openSession;
2337
+ const originalStartSession = uiWorkspace.startSession;
2338
+ const originalOpenResource = sidebarRight.openResource;
2339
+ const splitHost = () => {
2340
+ if (splitStore.isSuspended()) return void 0;
2341
+ if (ctx.layout.panelInfo.getSnapshot().activePanelId !== "split-view") return;
2342
+ const origin = splitStore.getPointerOrigin();
2343
+ if (origin === void 0) return void 0;
2344
+ return splitStore.getSnapshot().sessionIds.includes(origin) ? origin : void 0;
2345
+ };
2346
+ uiWorkspace.openSession = (target) => {
2347
+ const hostId = splitHost();
2348
+ if (hostId !== void 0) {
2349
+ const targetId = typeof target === "string" ? target : target.childSessionId;
2350
+ const title = sessions.list.getSnapshot().byId[targetId]?.displayTitle || "Untitled Task";
2351
+ splitStore.openSessionOverlay(hostId, target, title, sessions);
2352
+ return;
2353
+ }
2354
+ originalOpenSession.call(uiWorkspace, target);
2355
+ };
2356
+ uiWorkspace.startSession = (workspaceId, options) => {
2357
+ if (ctx.layout.panelInfo.getSnapshot().activePanelId !== "split-view" || splitStore.isSuspended()) {
2358
+ originalStartSession.call(uiWorkspace, workspaceId, options);
2359
+ return;
2360
+ }
2361
+ sessions.create({
2362
+ ...workspaceId ? { workspaceId } : void 0,
2363
+ ...options
2364
+ }).then((newId) => {
2365
+ splitStore.toggleSession(newId);
2366
+ });
2367
+ };
2368
+ sidebarRight.openResource = (address, options) => {
2369
+ const hostId = splitHost();
2370
+ if (hostId !== void 0) {
2371
+ const parsed = parseFileAddress(address);
2372
+ if (parsed !== void 0) {
2373
+ const isAbsolute = parsed.scope === "absolute" || parsed.path.startsWith("/") || /^[A-Za-z]:[\\/]/.test(parsed.path);
2374
+ splitStore.openFileOverlay(hostId, {
2375
+ address,
2376
+ ownerSessionId: parsed.scope === "session" ? SessionId(parsed.sessionId) : hostId,
2377
+ path: parsed.path,
2378
+ title: workspaceTitleOf(parsed.path) || "File",
2379
+ fullPath: isAbsolute ? parsed.path : void 0
2380
+ });
2381
+ return;
2382
+ }
2383
+ }
2384
+ originalOpenResource.call(sidebarRight, address, options);
2385
+ };
2386
+ const forgetOrigin = (event) => {
2387
+ const target = event.target;
2388
+ if (target instanceof Element && (target.closest("[data-split-pane]") !== null || target.closest("[role='menu'], [role='dialog'], [data-radix-popper-content-wrapper]") !== null)) return;
2389
+ splitStore.clearPointerOrigin();
2390
+ };
2391
+ if (typeof document !== "undefined") {
2392
+ document.addEventListener("pointerdown", forgetOrigin, true);
2393
+ document.addEventListener("focusin", forgetOrigin, true);
2394
+ }
2395
+ return () => {
2396
+ uiWorkspace.openSession = originalOpenSession;
2397
+ uiWorkspace.startSession = originalStartSession;
2398
+ sidebarRight.openResource = originalOpenResource;
2399
+ if (typeof document !== "undefined") {
2400
+ document.removeEventListener("pointerdown", forgetOrigin, true);
2401
+ document.removeEventListener("focusin", forgetOrigin, true);
2402
+ }
2403
+ };
2404
+ }, "split-view: navigation");
2405
+ ctx.effect(() => ctx.slots.inject("conversation.session.header.utilities", () => ctx.slots.register({
2406
+ name: "conversation.session.header.utilities",
2407
+ id: "split-view-restore",
2408
+ order: 100
2409
+ }, SplitRestoreHeaderAction)), "split-view: restore control");
2410
+ }
2411
+ exports.SplitStore = SplitStore;
2412
+ exports.apply = apply;
2413
+ exports.inject = inject;
2414
+ exports.name = name;
2415
+ exports.splitStore = splitStore;
2416
+ return module.exports;
2417
+ }
2418
+ });