@alivault/pico 0.1.6 → 0.2.0

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.
@@ -2,7 +2,7 @@ import { i as __toESM } from "../_runtime.mjs";
2
2
  import { A as Input, C as MenuTrigger, D as MenuPortal, E as MenuPositioner, F as DialogDescription$1, I as DialogClose, K as mergeProps, L as DialogBackdrop, M as DialogRoot, N as DialogPortal$1, O as MenuPopup, P as DialogPopup, R as Button, S as Separator, T as MenuRoot, X as require_react, Y as require_jsx_runtime, _ as AccordionRoot, a as CollapsiblePanel, b as TabsRoot, c as PopoverPopup, d as PopoverTrigger$1, f as PopoverRoot, g as AccordionItem$1, h as AccordionHeader, i as ContextMenuRoot, j as DialogTitle$1, k as MenuItem, l as PopoverPositioner, m as AccordionTrigger$1, n as Toggle, o as CollapsibleTrigger$1, p as AccordionPanel, r as ContextMenuTrigger$1, s as CollapsibleRoot, t as ToggleGroup, u as PopoverPortal, v as TabsList$1, w as MenuSubmenuRoot, x as MenuSubmenuTrigger, y as TabsTab, z as useRender } from "../_libs/@base-ui/react+[...].mjs";
3
3
  import { t as cva } from "../_libs/class-variance-authority+clsx.mjs";
4
4
  import { A as ChevronsUpDown, B as ArrowDown, C as FolderPlus, D as Copy, E as Download, F as Check, I as ArrowUp, L as ArrowUpToLine, M as ChevronUp, N as ChevronRight, O as Command, P as ChevronDown, S as Folder, T as EllipsisVertical, _ as ListEnd, a as Square, b as GitBranch, c as Settings2, d as PanelLeft, f as PanelLeftOpen, g as ListStart, h as OctagonX, j as ChevronsDownUp, l as Search, n as WandSparkles, o as SquarePen, p as PanelLeftClose, r as Upload, s as SquareArrowOutUpRight, t as X, u as PanelRight, w as Ellipsis, x as GitCommitHorizontal, y as ImagePlus, z as ArrowLeft } from "../_libs/lucide-react.mjs";
5
- import { $ as sameContextUsage, B as readStoredAutoScrollEnabled, C as buildItemsFromSync, D as createInitialSessionState, E as createContextId, F as normalizeSessionSelectionKeys, G as readStoredPromptDraft, H as readStoredCollapsedDirectories, I as normalizeStoredDirectoryList, J as readStoredSessionDoneDesktopNotificationsEnabled, K as readStoredRecentDirectories, L as normalizeThemeMode, M as getSessionTitle, P as normalizePromptImage, Q as safeLocalStorageSetItem, R as previewUrlForImage, U as readStoredDraftDirectory, V as readStoredCenterMessages, W as readStoredHideToolBlocks, X as readStoredSidebarDirectories, Y as readStoredSessionDoneSoundEnabled, Z as rememberStoredPromptDraft, _ as Tooltip$1, a as HIDE_TOOL_BLOCKS_STORAGE_KEY, b as TooltipTrigger, c as RECENT_DIRECTORIES_STORAGE_KEY, d as SESSION_DONE_DESKTOP_NOTIFICATIONS_ENABLED_STORAGE_KEY, et as sessionListEntryKey, f as SESSION_DONE_SOUND_ENABLED_STORAGE_KEY, g as TitleTooltip, i as DRAFT_DIRECTORY_STORAGE_KEY, j as flattenTree, l as RIGHT_SIDEBAR_OPEN_STORAGE_KEY, m as Spinner, n as CENTER_MESSAGES_STORAGE_KEY, o as Kbd, p as SIDEBAR_DIRECTORIES_STORAGE_KEY, q as readStoredRightSidebarOpen, r as COLLAPSED_DIRECTORIES_STORAGE_KEY, s as KeyboardShortcutContent, t as AUTO_SCROLL_ENABLED_STORAGE_KEY, tt as thinkingSummaryText, u as Route, v as TooltipContent, w as cn, x as VIEWER_CONTEXT_STORAGE_KEY, z as promptDraftKey } from "./routes-h_J1DAp5.mjs";
5
+ import { $ as readStoredSessionDoneSoundEnabled, A as createContextId, B as normalizeStoredDirectoryList, D as buildItemsFromSync, F as flattenTree, G as readStoredCenterMessages, H as previewUrlForImage, I as getSessionTitle, J as readStoredHideToolBlocks, K as readStoredCollapsedDirectories, O as cn, Q as readStoredSessionDoneDesktopNotificationsEnabled, R as normalizePromptImage, S as TooltipContent, T as VIEWER_CONTEXT_STORAGE_KEY, U as promptDraftKey, V as normalizeThemeMode, W as readStoredAutoScrollEnabled, X as readStoredRecentDirectories, Y as readStoredPromptDraft, Z as readStoredRightSidebarOpen, _ as SIDEBAR_DIRECTORIES_STORAGE_KEY, a as HIDE_TOOL_BLOCKS_STORAGE_KEY, at as sessionListEntryKey, b as TitleTooltip, c as RECENT_DIRECTORIES_STORAGE_KEY, d as RIGHT_SIDEBAR_HISTORY_HEIGHT_STORAGE_KEY, et as readStoredSidebarDirectories, f as RIGHT_SIDEBAR_OPEN_STORAGE_KEY, g as SESSION_DONE_SOUND_ENABLED_STORAGE_KEY, h as SESSION_DONE_DESKTOP_NOTIFICATIONS_ENABLED_STORAGE_KEY, i as DRAFT_DIRECTORY_STORAGE_KEY, it as sameContextUsage, j as createInitialSessionState, l as RIGHT_SIDEBAR_ACTIVE_TAB_STORAGE_KEY, m as Route, n as CENTER_MESSAGES_STORAGE_KEY, nt as safeLocalStorageGetItem, o as Kbd, ot as thinkingSummaryText, p as RIGHT_SIDEBAR_WIDTHS_STORAGE_KEY, q as readStoredDraftDirectory, r as COLLAPSED_DIRECTORIES_STORAGE_KEY, rt as safeLocalStorageSetItem, s as KeyboardShortcutContent, t as AUTO_SCROLL_ENABLED_STORAGE_KEY, tt as rememberStoredPromptDraft, u as RIGHT_SIDEBAR_FILE_TREE_WIDTH_STORAGE_KEY, v as Spinner, w as TooltipTrigger, x as Tooltip$1, z as normalizeSessionSelectionKeys } from "./routes-C7FEKcrl.mjs";
6
6
  import { i as useQuery, n as useIsMutating, o as useQueryClient, r as useIsFetching, t as useMutation } from "../_libs/tanstack__react-query.mjs";
7
7
  import { t as useHotkeys } from "../_libs/tanstack__react-hotkeys.mjs";
8
8
  import { a as matchesKeyboardEvent, i as batch, o as formatForDisplay, r as createStore } from "../_libs/@tanstack/hotkeys+[...].mjs";
@@ -19,7 +19,7 @@ import { t as remarkGfm } from "../_libs/remark-gfm.mjs";
19
19
  import { a as getBuiltInSpriteSheet, i as getBuiltInFileIconColor, n as FileTree, r as createFileTreeIconResolver, t as useFileTree } from "../_libs/@pierre/trees+[...].mjs";
20
20
  import { a as closestCenter, d as useSensors, f as CSS$1, i as PointerSensor, n as DragOverlay, t as DndContext, u as useSensor } from "../_libs/@dnd-kit/core+[...].mjs";
21
21
  import { a as verticalListSortingStrategy, i as useSortable, n as arrayMove, r as horizontalListSortingStrategy, t as SortableContext } from "../_libs/dnd-kit__sortable.mjs";
22
- //#region node_modules/.nitro/vite/services/ssr/assets/routes-Cmw5XPYv.js
22
+ //#region node_modules/.nitro/vite/services/ssr/assets/routes-D0o-mw7d.js
23
23
  var import_react = /* @__PURE__ */ __toESM(require_react());
24
24
  var import_jsx_runtime = require_jsx_runtime();
25
25
  var SIDEBAR_RESIZE_START_THRESHOLD_PX = 4;
@@ -7334,7 +7334,7 @@ var CodeBlockCopyButton = import_react.memo(function CodeBlockCopyButton({ code
7334
7334
  children: [copyState === "copied" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Check, { "data-icon": "inline-start" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Copy, { "data-icon": "inline-start" }), copyState === "copied" ? "Copied" : copyState === "error" ? "Retry" : "Copy"]
7335
7335
  });
7336
7336
  });
7337
- var CodeBlock = import_react.memo(function CodeBlock({ code, language, streaming = false }) {
7337
+ var CodeBlock = import_react.memo(function CodeBlock({ className, code, language, onPreScroll, preClassName, preRef, streaming = false }) {
7338
7338
  const [highlighted, setHighlighted] = import_react.useState(null);
7339
7339
  import_react.useEffect(() => {
7340
7340
  let cancelled = false;
@@ -7368,7 +7368,7 @@ var CodeBlock = import_react.memo(function CodeBlock({ code, language, streaming
7368
7368
  dangerouslySetInnerHTML: highlightedMarkup
7369
7369
  }) : null;
7370
7370
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7371
- className: "not-prose overflow-hidden rounded-xl border bg-muted/40",
7371
+ className: cn("not-prose overflow-hidden rounded-xl border bg-muted/40", className),
7372
7372
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
7373
7373
  className: "flex items-center justify-between gap-3 border-b bg-background/80 px-3 py-2 text-xs text-muted-foreground",
7374
7374
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -7376,7 +7376,9 @@ var CodeBlock = import_react.memo(function CodeBlock({ code, language, streaming
7376
7376
  children: displayedLanguage || "code"
7377
7377
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeBlockCopyButton, { code })]
7378
7378
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
7379
- className: "overflow-x-auto bg-transparent px-4 py-3 text-[13px] leading-6 text-foreground",
7379
+ ref: preRef,
7380
+ onScroll: onPreScroll,
7381
+ className: cn("overflow-x-auto bg-transparent px-4 py-3 text-[13px] leading-6 text-foreground", preClassName),
7380
7382
  children: highlightedContent || /* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: code })
7381
7383
  })]
7382
7384
  });
@@ -7471,12 +7473,12 @@ function toolCommandPreview(block) {
7471
7473
  if (block.type !== "tool") return "";
7472
7474
  if (typeof block.args === "string" && block.args.trim()) return block.args.trim();
7473
7475
  const args = normalizeToolArgs(block.args);
7474
- return getToolArgText(args, "description") || getToolArgText(args, "command") || getToolArgText(args, "path") || getToolArgText(args, "filePath");
7476
+ return getToolArgText(args, "description") || getToolArgText(args, "command") || getToolArgText(args, "path") || getToolArgText(args, "filePath") || getToolArgText(args, "file_path");
7475
7477
  }
7476
7478
  function toolReadLocation(block) {
7477
7479
  if (block.type !== "tool") return "";
7478
7480
  const args = normalizeToolArgs(block.args);
7479
- const filePath = getToolArgText(args, "path") || getToolArgText(args, "filePath");
7481
+ const filePath = getToolArgText(args, "path") || getToolArgText(args, "filePath") || getToolArgText(args, "file_path");
7480
7482
  const offset = args?.offset;
7481
7483
  const limit = args?.limit;
7482
7484
  if (typeof offset === "number" && typeof limit === "number" && limit > 0) return `${filePath}:${offset}-${offset + limit - 1}`;
@@ -7487,9 +7489,33 @@ function toolReadLocation(block) {
7487
7489
  function collapseToolPreview(text) {
7488
7490
  return text.replace(/\s+/g, " ").trim();
7489
7491
  }
7492
+ function countTextDisplayLines(text) {
7493
+ if (!text) return 0;
7494
+ return text.split("\n").length;
7495
+ }
7496
+ function formatCountLabel(count, singular, plural = `${singular}s`) {
7497
+ return `${count} ${count === 1 ? singular : plural}`;
7498
+ }
7499
+ function getWriteToolPayload(block) {
7500
+ if (block.type !== "tool" || block.name !== "write") return void 0;
7501
+ const args = normalizeToolArgs(block.args);
7502
+ if (!args) return void 0;
7503
+ const path = getToolArgText(args, "path") || getToolArgText(args, "filePath") || getToolArgText(args, "file_path");
7504
+ const content = args.content;
7505
+ return {
7506
+ content: typeof content === "string" ? content : void 0,
7507
+ path
7508
+ };
7509
+ }
7510
+ function writeToolSummary(block) {
7511
+ const payload = getWriteToolPayload(block);
7512
+ if (!payload?.path) return "";
7513
+ if (payload.content === void 0) return payload.path;
7514
+ return `${payload.path} · ${formatCountLabel(countTextDisplayLines(payload.content), "line")}`;
7515
+ }
7490
7516
  function toolSummary(block) {
7491
7517
  if (block.type !== "tool") return "";
7492
- const preview = block.name === "read" ? toolReadLocation(block) : toolCommandPreview(block);
7518
+ const preview = block.name === "read" ? toolReadLocation(block) : block.name === "write" ? writeToolSummary(block) : toolCommandPreview(block);
7493
7519
  if (preview) return collapseToolPreview(preview);
7494
7520
  if (block.running) return "Running";
7495
7521
  if (block.isError) return "Failed";
@@ -8458,6 +8484,82 @@ var ToolBlockSection = import_react.memo(function ToolBlockSection({ isError = f
8458
8484
  function editToolOutputWithoutSuccessMessage(output) {
8459
8485
  return output.split("\n").filter((line) => !/^Successfully replaced \d+ block\(s\) in .+\.$/.test(line)).join("\n").trimEnd();
8460
8486
  }
8487
+ function writeToolOutputWithoutSuccessMessage(output) {
8488
+ return output.split("\n").filter((line) => !/^Successfully wrote \d+ bytes to .+$/.test(line)).join("\n").trimEnd();
8489
+ }
8490
+ var CODE_LANGUAGE_BY_EXTENSION$1 = {
8491
+ bash: "bash",
8492
+ c: "c",
8493
+ cc: "c",
8494
+ cjs: "javascript",
8495
+ cpp: "c",
8496
+ css: "css",
8497
+ cxx: "c",
8498
+ go: "go",
8499
+ h: "c",
8500
+ htm: "html",
8501
+ html: "html",
8502
+ java: "java",
8503
+ js: "javascript",
8504
+ json: "json",
8505
+ jsonc: "jsonc",
8506
+ jsx: "jsx",
8507
+ mjs: "javascript",
8508
+ md: "markdown",
8509
+ mdx: "mdx",
8510
+ py: "python",
8511
+ rs: "rust",
8512
+ sh: "bash",
8513
+ ts: "typescript",
8514
+ tsx: "tsx",
8515
+ txt: "plaintext",
8516
+ xml: "xml",
8517
+ yaml: "yaml",
8518
+ yml: "yaml",
8519
+ zsh: "bash"
8520
+ };
8521
+ var CODE_LANGUAGE_BY_FILENAME = {
8522
+ dockerfile: "dockerfile",
8523
+ makefile: "makefile"
8524
+ };
8525
+ function codeLanguageFromPath$1(filePath) {
8526
+ const fileName = filePath.replace(/\\/g, "/").split("/").pop()?.toLowerCase();
8527
+ if (!fileName) return void 0;
8528
+ const filenameLanguage = CODE_LANGUAGE_BY_FILENAME[fileName];
8529
+ if (filenameLanguage) return filenameLanguage;
8530
+ if (fileName.endsWith(".d.ts")) return "typescript";
8531
+ const extension = fileName.includes(".") ? fileName.split(".").pop() : "";
8532
+ return extension ? CODE_LANGUAGE_BY_EXTENSION$1[extension] : void 0;
8533
+ }
8534
+ function WriteToolOutput({ block }) {
8535
+ const payload = getWriteToolPayload(block);
8536
+ const content = payload?.content;
8537
+ const extraOutput = writeToolOutputWithoutSuccessMessage(block.output.trimEnd());
8538
+ const autoScroll = useRunningToolAutoScroll({
8539
+ contentKey: content || "",
8540
+ enabled: block.running && content !== void 0
8541
+ });
8542
+ if (block.isError) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlainToolOutput, {
8543
+ isError: true,
8544
+ text: extraOutput || block.output.trimEnd() || "Write failed."
8545
+ });
8546
+ if (!payload || content === void 0) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlainToolOutput, { text: toolOutputText(block) || "No content available." });
8547
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8548
+ className: "space-y-3",
8549
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CodeBlock, {
8550
+ className: "flex max-h-96 flex-col rounded-lg",
8551
+ code: content,
8552
+ language: payload.path ? codeLanguageFromPath$1(payload.path) : void 0,
8553
+ onPreScroll: autoScroll.onScroll,
8554
+ preClassName: "min-h-0 overflow-auto",
8555
+ preRef: autoScroll.ref,
8556
+ streaming: block.running
8557
+ }), extraOutput ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlainToolOutput, {
8558
+ isError: block.isError,
8559
+ text: extraOutput
8560
+ }) : null]
8561
+ });
8562
+ }
8461
8563
  function EditToolOutput({ block }) {
8462
8564
  const patch = toolPatchText(block);
8463
8565
  const legacyDiff = toolLegacyDiffText(block);
@@ -8490,16 +8592,18 @@ function ToolBlockCardBody({ block }) {
8490
8592
  enabled: block.name === "bash" && block.running
8491
8593
  });
8492
8594
  const isSuccessfulEditTool = block.name === "edit" && !block.running && !block.isError;
8595
+ const isSelfContainedWriteTool = block.name === "write" && !block.isError && getWriteToolPayload(block)?.content !== void 0;
8596
+ const hasSelfContainedToolOutput = isSuccessfulEditTool || isSelfContainedWriteTool;
8493
8597
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8494
8598
  className: "border-t pt-3",
8495
8599
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
8496
8600
  ref: block.name === "bash" ? autoScroll.ref : void 0,
8497
8601
  onScroll: block.name === "bash" ? autoScroll.onScroll : void 0,
8498
- className: cn("max-h-96 overflow-auto rounded-lg border bg-background/80", !isSuccessfulEditTool && "p-3"),
8602
+ className: cn(isSelfContainedWriteTool ? "overflow-hidden rounded-lg" : "max-h-96 overflow-auto", hasSelfContainedToolOutput ? "rounded-lg" : "rounded-lg border bg-background/80 p-3"),
8499
8603
  children: block.name === "bash" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", {
8500
8604
  className: cn("overflow-x-auto font-mono text-xs leading-5 break-words whitespace-pre-wrap", block.isError && "text-destructive"),
8501
8605
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AnsiText, { text: shellBodyText })
8502
- }) : block.name === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditToolOutput, { block }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8606
+ }) : block.name === "write" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WriteToolOutput, { block }) : block.name === "edit" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EditToolOutput, { block }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
8503
8607
  className: "space-y-4",
8504
8608
  children: [callText ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ToolBlockSection, {
8505
8609
  label: "Call",
@@ -11518,16 +11622,13 @@ function ProjectFilesWorkspace({ viewerContextId, cwd, active, activeFilePath, o
11518
11622
  },
11519
11623
  children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronsDownUp, { className: "size-4" })
11520
11624
  })
11521
- }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TitleTooltip, {
11522
- title: "Open file",
11523
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$1, {
11524
- type: "button",
11525
- variant: "outline",
11526
- onClick: () => {
11527
- setOpenFileDialogOpen(true);
11528
- },
11529
- children: "Open File"
11530
- })
11625
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$1, {
11626
+ type: "button",
11627
+ variant: "outline",
11628
+ onClick: () => {
11629
+ setOpenFileDialogOpen(true);
11630
+ },
11631
+ children: "Open File"
11531
11632
  })]
11532
11633
  })]
11533
11634
  }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -11863,7 +11964,15 @@ function RightSidebarTabStrip({ activeFilePath, activeTab, filePreviewPath = "",
11863
11964
  }
11864
11965
  function clampProjectFileTreeWidth(width) {
11865
11966
  if (!Number.isFinite(width)) return PROJECT_FILE_TREE_DEFAULT_WIDTH;
11866
- return Math.min(PROJECT_FILE_TREE_MAX_WIDTH, Math.max(PROJECT_FILE_TREE_MIN_WIDTH, width));
11967
+ return Math.round(Math.min(PROJECT_FILE_TREE_MAX_WIDTH, Math.max(PROJECT_FILE_TREE_MIN_WIDTH, width)));
11968
+ }
11969
+ function readStoredProjectFileTreeWidth() {
11970
+ const storedWidth = safeLocalStorageGetItem(RIGHT_SIDEBAR_FILE_TREE_WIDTH_STORAGE_KEY);
11971
+ if (storedWidth == null) return PROJECT_FILE_TREE_DEFAULT_WIDTH;
11972
+ return clampProjectFileTreeWidth(Number(storedWidth));
11973
+ }
11974
+ function storeProjectFileTreeWidth(width) {
11975
+ safeLocalStorageSetItem(RIGHT_SIDEBAR_FILE_TREE_WIDTH_STORAGE_KEY, String(clampProjectFileTreeWidth(width)));
11867
11976
  }
11868
11977
  function FileTreeResizeHandle({ onResize, width }) {
11869
11978
  const resizeTo = (nextWidth) => {
@@ -11909,7 +12018,15 @@ function FileTreeResizeHandle({ onResize, width }) {
11909
12018
  });
11910
12019
  }
11911
12020
  function ProjectFileTreePane({ viewerContextId, cwd, active, activeFilePath, onOpenFile, previewMode }) {
11912
- const [fileTreeWidth, setFileTreeWidth] = import_react.useState(PROJECT_FILE_TREE_DEFAULT_WIDTH);
12021
+ const [fileTreeWidth, setFileTreeWidthState] = import_react.useState(PROJECT_FILE_TREE_DEFAULT_WIDTH);
12022
+ import_react.useEffect(() => {
12023
+ setFileTreeWidthState(readStoredProjectFileTreeWidth());
12024
+ }, []);
12025
+ const setFileTreeWidth = (nextWidth) => {
12026
+ const width = clampProjectFileTreeWidth(nextWidth);
12027
+ setFileTreeWidthState(width);
12028
+ storeProjectFileTreeWidth(width);
12029
+ };
11913
12030
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
11914
12031
  className: "relative min-h-0 shrink-0 overflow-visible border-r border-border/70",
11915
12032
  style: {
@@ -11979,6 +12096,21 @@ function FilePathBreadcrumb({ fileTreeCollapsed = false, onFileTreeCollapsedChan
11979
12096
  });
11980
12097
  }
11981
12098
  var GIT_HISTORY_PANEL_MIN_HEIGHT = 160;
12099
+ var GIT_HISTORY_PANEL_MAX_STORED_HEIGHT = 1600;
12100
+ function clampStoredGitHistoryPanelHeight(height) {
12101
+ if (!Number.isFinite(height)) return void 0;
12102
+ return Math.round(Math.min(GIT_HISTORY_PANEL_MAX_STORED_HEIGHT, Math.max(GIT_HISTORY_PANEL_MIN_HEIGHT, height)));
12103
+ }
12104
+ function readStoredGitHistoryPanelHeight() {
12105
+ const storedHeight = safeLocalStorageGetItem(RIGHT_SIDEBAR_HISTORY_HEIGHT_STORAGE_KEY);
12106
+ if (storedHeight == null) return void 0;
12107
+ return clampStoredGitHistoryPanelHeight(Number(storedHeight));
12108
+ }
12109
+ function storeGitHistoryPanelHeight(height) {
12110
+ const nextHeight = clampStoredGitHistoryPanelHeight(height);
12111
+ if (typeof nextHeight !== "number") return;
12112
+ safeLocalStorageSetItem(RIGHT_SIDEBAR_HISTORY_HEIGHT_STORAGE_KEY, String(nextHeight));
12113
+ }
11982
12114
  function reviewFileValue(file) {
11983
12115
  return `${file.status}:${file.previousPath || ""}:${file.path}`;
11984
12116
  }
@@ -11993,7 +12125,7 @@ function FileReviewContent({ viewerContextId, cwd, active, onOpenFile }) {
11993
12125
  const isMobile = useIsMobile();
11994
12126
  const [diffStyle, setDiffStyle] = import_react.useState("unified");
11995
12127
  const [historyOpen, setHistoryOpen] = import_react.useState(true);
11996
- const [historyPanelHeight, setHistoryPanelHeight] = import_react.useState(void 0);
12128
+ const [historyPanelHeight, setHistoryPanelHeight] = import_react.useState(() => readStoredGitHistoryPanelHeight());
11997
12129
  const [defaultHistoryPanelHeight, setDefaultHistoryPanelHeight] = import_react.useState(void 0);
11998
12130
  const [verticalResizeCursor, setVerticalResizeCursor] = import_react.useState("row-resize");
11999
12131
  const [openFiles, setOpenFiles] = import_react.useState([]);
@@ -12024,7 +12156,7 @@ function FileReviewContent({ viewerContextId, cwd, active, onOpenFile }) {
12024
12156
  if (previousNormalizedCwdRef.current === normalizedCwd) return;
12025
12157
  previousNormalizedCwdRef.current = normalizedCwd;
12026
12158
  setHistoryOpen(true);
12027
- setHistoryPanelHeight(void 0);
12159
+ setHistoryPanelHeight(readStoredGitHistoryPanelHeight());
12028
12160
  setDefaultHistoryPanelHeight(void 0);
12029
12161
  setOpenFiles([]);
12030
12162
  setStickyReviewFileValue("");
@@ -12075,13 +12207,16 @@ function FileReviewContent({ viewerContextId, cwd, active, onOpenFile }) {
12075
12207
  const previousUserSelect = document.body.style.userSelect;
12076
12208
  const cursor = getSidebarVerticalResizeCursor();
12077
12209
  const cleanupGlobalResizeCursor = installGlobalResizeCursor(cursor);
12210
+ let latestHeight = Math.min(maxHeight, Math.max(minHeight, startHeight));
12078
12211
  document.body.style.cursor = cursor;
12079
12212
  document.body.style.userSelect = "none";
12080
12213
  const handlePointerMove = (moveEvent) => {
12081
12214
  const nextHeight = startHeight - (moveEvent.clientY - startY);
12082
- setHistoryPanelHeight(Math.min(maxHeight, Math.max(minHeight, nextHeight)));
12215
+ latestHeight = Math.min(maxHeight, Math.max(minHeight, nextHeight));
12216
+ setHistoryPanelHeight(latestHeight);
12083
12217
  };
12084
12218
  const handlePointerUp = () => {
12219
+ storeGitHistoryPanelHeight(latestHeight);
12085
12220
  cleanupGlobalResizeCursor();
12086
12221
  document.body.style.cursor = previousCursor;
12087
12222
  document.body.style.userSelect = previousUserSelect;
@@ -13720,6 +13855,14 @@ function DirectoryPathLabel({ path }) {
13720
13855
  });
13721
13856
  }
13722
13857
  var EMPTY_DIRECTORY_SESSION_KEYS = [];
13858
+ function isMacPlatform() {
13859
+ if (typeof window === "undefined") return false;
13860
+ const platform = window.navigator.platform || window.navigator.userAgent;
13861
+ return /mac|iphone|ipad|ipod/i.test(platform);
13862
+ }
13863
+ function isSidebarMultiSelectModifier(event) {
13864
+ return isMacPlatform() ? event.metaKey : event.ctrlKey;
13865
+ }
13723
13866
  function formatSidebarSessionTime(value, now = Date.now()) {
13724
13867
  if (!value) return "";
13725
13868
  const timestamp = new Date(value).getTime();
@@ -13941,7 +14084,7 @@ function SidebarSessionItem({ entryKey, directorySessionsStore, activeSessionSto
13941
14084
  className: cn("relative h-auto min-w-0 items-start gap-2 py-2 pr-2 pl-8", (isActive || isSelected) && "bg-sidebar-accent text-sidebar-accent-foreground"),
13942
14085
  onClick: (event) => {
13943
14086
  onSessionClick?.(entry, {
13944
- ctrlKey: event.ctrlKey,
14087
+ multiSelectKey: isSidebarMultiSelectModifier(event),
13945
14088
  shiftKey: event.shiftKey
13946
14089
  });
13947
14090
  if (isMobile) setOpenMobile(false);
@@ -14808,6 +14951,15 @@ function createLocalPendingId() {
14808
14951
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") return `optimistic:${crypto.randomUUID()}`;
14809
14952
  return `optimistic:${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
14810
14953
  }
14954
+ function buildCurrentSessionRequestUrl(path, { contextId, sessionState, fallbackSessionId }) {
14955
+ const sessionKey = sessionState.sessionKey && !sessionState.sessionKey.startsWith("optimistic:") ? sessionState.sessionKey : void 0;
14956
+ const shouldUseSessionKey = Boolean(sessionKey && (sessionState.draft || !sessionState.sessionId));
14957
+ return buildRequestUrl(path, {
14958
+ contextId,
14959
+ sessionId: shouldUseSessionKey ? void 0 : sessionState.sessionId ?? fallbackSessionId,
14960
+ searchParams: shouldUseSessionKey ? { sessionKey } : void 0
14961
+ });
14962
+ }
14811
14963
  function isPendingPromptNotFoundError(error) {
14812
14964
  return error instanceof Error && error.message.toLowerCase().includes("pending prompt not found");
14813
14965
  }
@@ -15063,9 +15215,10 @@ function useAppShellPromptMutations({ viewerContextId, activeSessionId, defaultN
15063
15215
  ]);
15064
15216
  const promptMutation = useMutation({ mutationFn: async ({ message, images, streamingBehavior, pendingId, thinkingLevel }) => {
15065
15217
  if (!viewerContextId) throw new Error("Viewer context unavailable");
15066
- return await fetchJson(buildRequestUrl("/api/prompt", {
15218
+ return await fetchJson(buildCurrentSessionRequestUrl("/api/prompt", {
15067
15219
  contextId: viewerContextId,
15068
- sessionId: activeSessionId
15220
+ sessionState: sessionStateRef.current,
15221
+ fallbackSessionId: activeSessionId
15069
15222
  }), {
15070
15223
  method: "POST",
15071
15224
  headers: { "content-type": "application/json" },
@@ -15257,9 +15410,10 @@ function useAppShellPromptMutations({ viewerContextId, activeSessionId, defaultN
15257
15410
  ]);
15258
15411
  const abortSessionMutation = useMutation({ mutationFn: async () => {
15259
15412
  if (!viewerContextId) throw new Error("Viewer context unavailable");
15260
- return await fetchJson(buildRequestUrl("/api/abort", {
15413
+ return await fetchJson(buildCurrentSessionRequestUrl("/api/abort", {
15261
15414
  contextId: viewerContextId,
15262
- sessionId: activeSessionId
15415
+ sessionState: sessionStateRef.current,
15416
+ fallbackSessionId: activeSessionId
15263
15417
  }), { method: "POST" });
15264
15418
  } });
15265
15419
  const abortSession = import_react.useCallback(async () => {
@@ -15272,9 +15426,10 @@ function useAppShellPromptMutations({ viewerContextId, activeSessionId, defaultN
15272
15426
  }, [abortSessionMutation, viewerContextId]);
15273
15427
  const editPendingMessagesMutation = useMutation({ mutationFn: async (nextPendingMessages) => {
15274
15428
  if (!viewerContextId) throw new Error("Viewer context unavailable");
15275
- return await fetchJson(buildRequestUrl("/api/pending-messages/reorder", {
15429
+ return await fetchJson(buildCurrentSessionRequestUrl("/api/pending-messages/reorder", {
15276
15430
  contextId: viewerContextId,
15277
- sessionId: activeSessionId
15431
+ sessionState: sessionStateRef.current,
15432
+ fallbackSessionId: activeSessionId
15278
15433
  }), {
15279
15434
  method: "POST",
15280
15435
  headers: { "content-type": "application/json" },
@@ -15312,9 +15467,10 @@ function useAppShellPromptMutations({ viewerContextId, activeSessionId, defaultN
15312
15467
  ]);
15313
15468
  const removePendingMessageMutation = useMutation({ mutationFn: async (pendingId) => {
15314
15469
  if (!viewerContextId) throw new Error("Viewer context unavailable");
15315
- return await fetchJson(buildRequestUrl("/api/pending-message/remove", {
15470
+ return await fetchJson(buildCurrentSessionRequestUrl("/api/pending-message/remove", {
15316
15471
  contextId: viewerContextId,
15317
- sessionId: activeSessionId
15472
+ sessionState: sessionStateRef.current,
15473
+ fallbackSessionId: activeSessionId
15318
15474
  }), {
15319
15475
  method: "POST",
15320
15476
  headers: { "content-type": "application/json" },
@@ -17510,7 +17666,7 @@ var AppShellGitPanelController = import_react.memo(function AppShellGitPanelCont
17510
17666
  setStoreField(rightSidebarStore, "fileActivePath", path);
17511
17667
  },
17512
17668
  onActiveTabChange: (tab) => {
17513
- setStoreField(rightSidebarStore, "activeTab", tab);
17669
+ setRightSidebarActiveTab(rightSidebarStore, tab);
17514
17670
  },
17515
17671
  onCloseAllFiles,
17516
17672
  onCloseFile,
@@ -18179,7 +18335,7 @@ function AppShellDesktopGitPanel({ active, onCloseAllFiles, onCloseFile, onClose
18179
18335
  setStoreField(rightSidebarStore, "fileActivePath", path);
18180
18336
  },
18181
18337
  onActiveTabChange: (tab) => {
18182
- setStoreField(rightSidebarStore, "activeTab", tab);
18338
+ setRightSidebarActiveTab(rightSidebarStore, tab);
18183
18339
  },
18184
18340
  onCloseAllFiles,
18185
18341
  onCloseFile,
@@ -18198,6 +18354,41 @@ var DESKTOP_DEFAULT_FILE_VIEW_WIDTH = 520;
18198
18354
  var DESKTOP_DEFAULT_GIT_PANEL_WIDTH = 320;
18199
18355
  var DESKTOP_MIN_SESSION_WIDTH = 320;
18200
18356
  var DESKTOP_MIN_SIDE_PANEL_WIDTH = 260;
18357
+ var DESKTOP_MAX_STORED_SIDE_PANEL_WIDTH = 1600;
18358
+ function defaultDesktopSidePanelWidths() {
18359
+ return {
18360
+ fileViewWidth: DESKTOP_DEFAULT_FILE_VIEW_WIDTH,
18361
+ gitPanelWidth: DESKTOP_DEFAULT_GIT_PANEL_WIDTH
18362
+ };
18363
+ }
18364
+ function clampStoredDesktopPanelWidth(value, fallback) {
18365
+ const width = typeof value === "number" ? value : Number(value);
18366
+ if (!Number.isFinite(width)) return fallback;
18367
+ return Math.round(Math.min(DESKTOP_MAX_STORED_SIDE_PANEL_WIDTH, Math.max(DESKTOP_MIN_SIDE_PANEL_WIDTH, width)));
18368
+ }
18369
+ function normalizeDesktopSidePanelWidths(value) {
18370
+ if (!value || typeof value !== "object") return defaultDesktopSidePanelWidths();
18371
+ const widths = value;
18372
+ return {
18373
+ fileViewWidth: clampStoredDesktopPanelWidth(widths.fileViewWidth, DESKTOP_DEFAULT_FILE_VIEW_WIDTH),
18374
+ gitPanelWidth: clampStoredDesktopPanelWidth(widths.gitPanelWidth, DESKTOP_DEFAULT_GIT_PANEL_WIDTH)
18375
+ };
18376
+ }
18377
+ function readStoredDesktopSidePanelWidths() {
18378
+ try {
18379
+ const raw = safeLocalStorageGetItem(RIGHT_SIDEBAR_WIDTHS_STORAGE_KEY);
18380
+ if (!raw) return defaultDesktopSidePanelWidths();
18381
+ return normalizeDesktopSidePanelWidths(JSON.parse(raw));
18382
+ } catch {
18383
+ return defaultDesktopSidePanelWidths();
18384
+ }
18385
+ }
18386
+ function storeDesktopSidePanelWidths(widths) {
18387
+ safeLocalStorageSetItem(RIGHT_SIDEBAR_WIDTHS_STORAGE_KEY, JSON.stringify(normalizeDesktopSidePanelWidths(widths)));
18388
+ }
18389
+ function sameDesktopSidePanelWidths(left, right) {
18390
+ return left.fileViewWidth === right.fileViewWidth && left.gitPanelWidth === right.gitPanelWidth;
18391
+ }
18201
18392
  function clampDesktopPanelSize(value, min, max) {
18202
18393
  if (!Number.isFinite(value)) return min;
18203
18394
  if (max <= min) return Math.max(0, max);
@@ -18328,10 +18519,40 @@ function AppShellTabsController({ actionsRef, appUiStore, awaitingFirstTurn, com
18328
18519
  const desktopSideWorkspaceOpen = desktopFileViewOpen || desktopGitPanelOpen;
18329
18520
  const desktopLayoutRef = import_react.useRef(null);
18330
18521
  const [desktopLayoutWidth, setDesktopLayoutWidth] = import_react.useState(0);
18331
- const [desktopFileViewWidth, setDesktopFileViewWidth] = import_react.useState(DESKTOP_DEFAULT_FILE_VIEW_WIDTH);
18332
- const [desktopGitPanelWidth, setDesktopGitPanelWidth] = import_react.useState(DESKTOP_DEFAULT_GIT_PANEL_WIDTH);
18522
+ const [desktopSidePanelWidths, setDesktopSidePanelWidthsState] = import_react.useState(() => defaultDesktopSidePanelWidths());
18523
+ const desktopSidePanelWidthsLoadedRef = import_react.useRef(false);
18524
+ const desktopSidePanelWidthsRef = import_react.useRef(desktopSidePanelWidths);
18525
+ desktopSidePanelWidthsRef.current = desktopSidePanelWidths;
18526
+ const desktopFileViewWidth = desktopSidePanelWidths.fileViewWidth;
18527
+ const desktopGitPanelWidth = desktopSidePanelWidths.gitPanelWidth;
18528
+ const setDesktopSidePanelWidths = (action) => {
18529
+ const current = desktopSidePanelWidthsRef.current;
18530
+ const next = normalizeDesktopSidePanelWidths(applyStoreAction(current, action));
18531
+ if (sameDesktopSidePanelWidths(current, next)) return;
18532
+ desktopSidePanelWidthsRef.current = next;
18533
+ setDesktopSidePanelWidthsState(next);
18534
+ if (desktopSidePanelWidthsLoadedRef.current) storeDesktopSidePanelWidths(next);
18535
+ };
18536
+ const setDesktopFileViewWidth = (action) => {
18537
+ setDesktopSidePanelWidths((current) => ({
18538
+ ...current,
18539
+ fileViewWidth: clampStoredDesktopPanelWidth(applyStoreAction(current.fileViewWidth, action), DESKTOP_DEFAULT_FILE_VIEW_WIDTH)
18540
+ }));
18541
+ };
18542
+ const setDesktopGitPanelWidth = (action) => {
18543
+ setDesktopSidePanelWidths((current) => ({
18544
+ ...current,
18545
+ gitPanelWidth: clampStoredDesktopPanelWidth(applyStoreAction(current.gitPanelWidth, action), DESKTOP_DEFAULT_GIT_PANEL_WIDTH)
18546
+ }));
18547
+ };
18333
18548
  const [desktopGitPanelMounted, setDesktopGitPanelMounted] = import_react.useState(desktopGitPanelOpen);
18334
18549
  const [desktopPanelResizing, setDesktopPanelResizing] = import_react.useState(false);
18550
+ import_react.useEffect(() => {
18551
+ const storedWidths = readStoredDesktopSidePanelWidths();
18552
+ desktopSidePanelWidthsLoadedRef.current = true;
18553
+ desktopSidePanelWidthsRef.current = storedWidths;
18554
+ setDesktopSidePanelWidthsState((current) => sameDesktopSidePanelWidths(current, storedWidths) ? current : storedWidths);
18555
+ }, []);
18335
18556
  const sessionPane = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
18336
18557
  className: "flex h-full min-h-0 min-w-0 flex-1 flex-col overflow-hidden",
18337
18558
  children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -18747,9 +18968,22 @@ function createInitialAppShellComposerSnapshot(viewerContextId) {
18747
18968
  viewerContextId
18748
18969
  };
18749
18970
  }
18971
+ function normalizeRightSidebarActiveTab(value) {
18972
+ return value === "files" || value === "review" ? value : "review";
18973
+ }
18974
+ function readStoredRightSidebarActiveTab() {
18975
+ return normalizeRightSidebarActiveTab(safeLocalStorageGetItem(RIGHT_SIDEBAR_ACTIVE_TAB_STORAGE_KEY));
18976
+ }
18977
+ function storeRightSidebarActiveTab(tab) {
18978
+ safeLocalStorageSetItem(RIGHT_SIDEBAR_ACTIVE_TAB_STORAGE_KEY, tab);
18979
+ }
18980
+ function setRightSidebarActiveTab(store, tab) {
18981
+ setStoreField(store, "activeTab", tab);
18982
+ storeRightSidebarActiveTab(tab);
18983
+ }
18750
18984
  function createInitialRightSidebarState() {
18751
18985
  return {
18752
- activeTab: "review",
18986
+ activeTab: readStoredRightSidebarActiveTab(),
18753
18987
  fileActivePath: "",
18754
18988
  filePreviewPath: "",
18755
18989
  fileTabs: [],
@@ -18773,6 +19007,7 @@ function resetRightSidebarFiles(store) {
18773
19007
  }
18774
19008
  function openRightSidebarFile(store, path, options) {
18775
19009
  if (!path) return;
19010
+ storeRightSidebarActiveTab("files");
18776
19011
  setStoreState(store, (state) => {
18777
19012
  const shouldPin = Boolean(options?.pin) || state.fileTabs.includes(path) || state.fileActivePath === path;
18778
19013
  const fileTabs = shouldPin ? state.fileTabs.includes(path) ? state.fileTabs : [...state.fileTabs, path] : state.fileTabs;
@@ -19313,7 +19548,7 @@ var AppShellSessionWorkspace = import_react.forwardRef(function AppShellSessionW
19313
19548
  const toggleReviewPane = () => {
19314
19549
  const activeTab = rightSidebarStore.state.activeTab;
19315
19550
  if (isMobile) {
19316
- setStoreField(rightSidebarStore, "activeTab", "review");
19551
+ setRightSidebarActiveTab(rightSidebarStore, "review");
19317
19552
  setCurrentTab((tab) => tab === "git" && activeTab === "review" ? "session" : "git");
19318
19553
  return;
19319
19554
  }
@@ -19322,7 +19557,7 @@ var AppShellSessionWorkspace = import_react.forwardRef(function AppShellSessionW
19322
19557
  return;
19323
19558
  }
19324
19559
  batch(() => {
19325
- setStoreField(rightSidebarStore, "activeTab", "review");
19560
+ setRightSidebarActiveTab(rightSidebarStore, "review");
19326
19561
  setGitPanelOpen(true);
19327
19562
  });
19328
19563
  };
@@ -21576,7 +21811,7 @@ function AppShellSidebarController({ viewerContextId, sidebarStore, sessionWorks
21576
21811
  selectSidebarSessionRange(key);
21577
21812
  return;
21578
21813
  }
21579
- if (modifiers.ctrlKey) {
21814
+ if (modifiers.multiSelectKey) {
21580
21815
  setSidebarSelection(selectedSidebarSessionKeys.includes(key) ? selectedSidebarSessionKeys.filter((currentKey) => currentKey !== key) : [...selectedSidebarSessionKeys, key], key);
21581
21816
  return;
21582
21817
  }
@@ -3813,7 +3813,7 @@ var defaultSerovalPlugins = [
3813
3813
  * the dev styles URL for route-scoped CSS collection.
3814
3814
  */
3815
3815
  async function getStartManifest(matchedRoutes) {
3816
- const { tsrStartManifest } = await import("../_tanstack-start-manifest_v-hzhfVHZ4.mjs");
3816
+ const { tsrStartManifest } = await import("../_tanstack-start-manifest_v-Bgeq0HT6.mjs");
3817
3817
  const startManifest = tsrStartManifest();
3818
3818
  const rootRoute = startManifest.routes[rootRouteId] = startManifest.routes["__root__"] || {};
3819
3819
  rootRoute.assets = rootRoute.assets || [];
@@ -4799,7 +4799,7 @@ var baseManifestPromise;
4799
4799
  var cachedFinalManifestPromise;
4800
4800
  async function loadEntries() {
4801
4801
  const [routerEntry, startEntry, pluginAdapters] = await Promise.all([
4802
- import("./router-TRfB0YMJ.mjs"),
4802
+ import("./router-BDJ6CDfq.mjs"),
4803
4803
  import("./start-Captdpmb.mjs"),
4804
4804
  import("../__23tanstack-start-plugin-adapters-y_fshQDY.mjs")
4805
4805
  ]);
@@ -1,4 +1,4 @@
1
- //#region node_modules/.nitro/vite/services/ssr/assets/_tanstack-start-manifest_v-hzhfVHZ4.js
1
+ //#region node_modules/.nitro/vite/services/ssr/assets/_tanstack-start-manifest_v-Bgeq0HT6.js
2
2
  var tsrStartManifest = () => ({
3
3
  routes: {
4
4
  __root__: {
@@ -50,16 +50,16 @@ var tsrStartManifest = () => ({
50
50
  "/api/ui/$id"
51
51
  ],
52
52
  assets: void 0,
53
- preloads: ["/assets/index-Cea7QwXW.js", "/assets/rolldown-runtime-S-ySWqyJ.js"]
53
+ preloads: ["/assets/index-BTAh2ZbA.js", "/assets/rolldown-runtime-S-ySWqyJ.js"]
54
54
  },
55
55
  "/": {
56
56
  filePath: "/home/runner/work/pico/pico/src/routes/index.tsx",
57
57
  children: void 0,
58
58
  assets: void 0,
59
- preloads: ["/assets/routes-Bb61eCk_.js"]
59
+ preloads: ["/assets/routes-rD8LJ5B7.js"]
60
60
  }
61
61
  },
62
- clientEntry: "/assets/index-Cea7QwXW.js"
62
+ clientEntry: "/assets/index-BTAh2ZbA.js"
63
63
  });
64
64
  //#endregion
65
65
  export { tsrStartManifest };