zidane-gui 8.2.2 → 8.2.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.
@@ -26111,6 +26111,7 @@ function modelDisplayName({ providerKey, modelId, modelName }) {
26111
26111
  } : { name: name2 };
26112
26112
  }
26113
26113
  const RUN_RECEIPT_TURN_GLYPH = "↻";
26114
+ const RUN_RECEIPT_SWITCH_GLYPH = "⇄";
26114
26115
  function formatTokenCount(tokens) {
26115
26116
  if (tokens >= 1e6) return `${(tokens / 1e6).toFixed(1)}M`;
26116
26117
  if (tokens >= 1e3) return `${(tokens / 1e3).toFixed(tokens >= 1e4 ? 0 : 1)}k`;
@@ -26135,6 +26136,10 @@ const nameFromModelId = (modelId, providerKey) => modelDisplayName({
26135
26136
  }).name;
26136
26137
  function formatRunReceiptCells(r2, modelName = nameFromModelId) {
26137
26138
  const cells2 = [];
26139
+ if (r2.agent) cells2.push({
26140
+ kind: "agent",
26141
+ text: r2.agentSwitched ? `⇄${r2.agent}` : r2.agent
26142
+ });
26138
26143
  if (r2.modelId) {
26139
26144
  const name2 = modelName(r2.modelId, r2.providerKey);
26140
26145
  cells2.push({
@@ -26445,6 +26450,7 @@ const DEFAULT_SETTINGS = {
26445
26450
  hideSubagentOutput: true,
26446
26451
  subagentModels: true,
26447
26452
  imageGeneration: true,
26453
+ webSearch: true,
26448
26454
  imageModel: "",
26449
26455
  maxParallelSubagents: 3,
26450
26456
  queueMessages: true,
@@ -27665,7 +27671,12 @@ const SETTINGS_KEYWORDS = {
27665
27671
  "gutter",
27666
27672
  "timeline"
27667
27673
  ],
27668
- showCacheNotices: ["prompt cache", "cache hit"],
27674
+ showCacheNotices: [
27675
+ "prompt cache",
27676
+ "cache hit",
27677
+ "reasoning dropped",
27678
+ "thinking dropped"
27679
+ ],
27669
27680
  showThinking: ["reasoning", "thoughts"],
27670
27681
  thinkingAutoExpand: [
27671
27682
  "reasoning",
@@ -27932,6 +27943,12 @@ const SETTINGS_TOGGLES$1 = [
27932
27943
  label: "Image generation",
27933
27944
  description: "Let the agent generate images with your providers' image models. Each image is billed by the provider."
27934
27945
  },
27946
+ {
27947
+ category: "agent",
27948
+ key: "webSearch",
27949
+ label: "Web search",
27950
+ description: "Let the agent search the web for docs, errors and recent changes."
27951
+ },
27935
27952
  {
27936
27953
  category: "agent",
27937
27954
  key: "decisions",
@@ -28023,13 +28040,13 @@ const SETTINGS_TOGGLES$1 = [
28023
28040
  category: "ui",
28024
28041
  key: "showRunReceipt",
28025
28042
  label: "Run receipt",
28026
- description: "Show model, time, cost and tokens after each run."
28043
+ description: "Show agent, model, time, cost and tokens after each run."
28027
28044
  },
28028
28045
  {
28029
28046
  category: "ui",
28030
28047
  key: "showCacheNotices",
28031
28048
  label: "Cache notices",
28032
- description: "Add a row to the chat when the prompt cache expires or resets."
28049
+ description: "Add a row to the chat when the prompt cache expires or resets, or the provider drops earlier reasoning."
28033
28050
  },
28034
28051
  {
28035
28052
  category: "ui",
@@ -30544,6 +30561,14 @@ const ONBOARDING_FEATURES = [
30544
30561
  unlocks: "Many tool calls in one step. Long tasks take fewer turns, so runs finish faster and cost less.",
30545
30562
  prevents: "A context full of small tool results. Only what the script prints goes back to the model."
30546
30563
  },
30564
+ {
30565
+ key: "webSearch",
30566
+ group: "work",
30567
+ surfaces: BOTH,
30568
+ example: "For example, a build fails after a library update. The agent searches the error and reads the release notes.",
30569
+ unlocks: "Answers from the web: current docs, error messages, and changes newer than the model.",
30570
+ prevents: "Off, the agent never reaches a search engine, and works only from your files and what it already knows."
30571
+ },
30547
30572
  {
30548
30573
  key: "inlineAutocomplete",
30549
30574
  group: "work",
@@ -33148,7 +33173,9 @@ function retagUserPromptEventsFromRefs(events, refs) {
33148
33173
  }
33149
33174
  return changed2 ? next : events;
33150
33175
  }
33151
- const CACHE_NOTICE_LABEL = "cache";
33176
+ function isCacheNotice(notice) {
33177
+ return notice?.label === "cache" || notice?.label === "reasoning";
33178
+ }
33152
33179
  function isVisible(event, settings) {
33153
33180
  if (event.parentToolCallId !== void 0 && !event.runsNestedAgent && !settings.codemodeShowCalls) return false;
33154
33181
  if (settings.hideSubagentOutput) {
@@ -33166,7 +33193,7 @@ function isVisible(event, settings) {
33166
33193
  case "run-summary":
33167
33194
  return settings.showRunReceipt;
33168
33195
  case "info":
33169
- return settings.showCacheNotices || event.notice?.label !== "cache";
33196
+ return settings.showCacheNotices || !isCacheNotice(event.notice);
33170
33197
  case "spawn-queued":
33171
33198
  return settings.transcriptDensity === "compact";
33172
33199
  default:
@@ -35693,6 +35720,11 @@ const SETTINGS_TOGGLES = withCanonicalGates([
35693
35720
  label: "Image generation",
35694
35721
  description: "Let the agent generate images with your providers' image models. Pick the model in the model picker's Image tab. Each image is billed by the provider."
35695
35722
  },
35723
+ {
35724
+ key: "webSearch",
35725
+ label: "Web search",
35726
+ description: "Let the agent search the web for docs, errors and recent changes."
35727
+ },
35696
35728
  {
35697
35729
  key: "sandbox",
35698
35730
  label: "Sandbox shell commands",
@@ -35726,12 +35758,12 @@ const SETTINGS_TOGGLES = withCanonicalGates([
35726
35758
  {
35727
35759
  key: "showRunReceipt",
35728
35760
  label: "Run receipt",
35729
- description: "Show model, time, cost and tokens after each run."
35761
+ description: "Show agent, model, time, cost and tokens after each run."
35730
35762
  },
35731
35763
  {
35732
35764
  key: "showCacheNotices",
35733
35765
  label: "Cache notices",
35734
- description: "Add a row to the chat when the prompt cache expires or resets."
35766
+ description: "Add a row to the chat when the prompt cache expires or resets, or the provider drops earlier reasoning."
35735
35767
  },
35736
35768
  {
35737
35769
  key: "queueMessages",
@@ -37990,6 +38022,8 @@ const DEFAULT_CHAT_LABELS = {
37990
38022
  runRetrying: (attempt, max2, source) => runRetryingLabel({ attempt, max: max2, source }),
37991
38023
  // Run receipt
37992
38024
  runReceipt: "Run receipt",
38025
+ receiptAgent: "Agent that ran this turn",
38026
+ receiptAgentSwitched: "Agent that ran this turn, switched from the previous run",
37993
38027
  receiptModel: "Model that ran this turn",
37994
38028
  receiptModelOthers: (others) => `Model that wrote the last reply. ${others} other model${others === 1 ? "" : "s"} ran earlier turns.`,
37995
38029
  receiptDuration: "Run time, tools included",
@@ -45547,7 +45581,7 @@ function loadSymbolsFont(url) {
45547
45581
  return symbolsFont;
45548
45582
  }
45549
45583
  function loadGhostty$1(symbolsFontUrl2) {
45550
- ghosttyModule ??= Promise.all([__vitePreload(() => import("./ghostty-web-6lAA0ofW.js"), true ? [] : void 0, import.meta.url), loadSymbolsFont(symbolsFontUrl2)]).then(async ([m2]) => {
45584
+ ghosttyModule ??= Promise.all([__vitePreload(() => import("./ghostty-web-BTRdAlae.js"), true ? [] : void 0, import.meta.url), loadSymbolsFont(symbolsFontUrl2)]).then(async ([m2]) => {
45551
45585
  await m2.init();
45552
45586
  drawBoxGlyphs(m2);
45553
45587
  return m2;
@@ -64140,8 +64174,14 @@ function savedPaths(text2) {
64140
64174
  return m2 ? [m2[1]] : [];
64141
64175
  });
64142
64176
  }
64177
+ const isImageRequest = (tool) => tool.name === "generate_image" && tool.rawInput?.list !== true;
64178
+ function imageRequestsOf(tool) {
64179
+ if (tool.parentId !== void 0) return [];
64180
+ if (isImageRequest(tool)) return [tool.rawInput ?? {}];
64181
+ return (tool.children ?? []).filter(isImageRequest).map((child) => child.rawInput ?? {});
64182
+ }
64143
64183
  function drawsImageGeneration(tool) {
64144
- return tool.name === "generate_image" && tool.rawInput?.list !== true;
64184
+ return imageRequestsOf(tool).length > 0;
64145
64185
  }
64146
64186
  function ImageFrame({
64147
64187
  src,
@@ -64198,14 +64238,17 @@ function ImageGenerationBlock({
64198
64238
  const lightbox = useLightbox();
64199
64239
  const media = useToolMedia(tool, tool.result);
64200
64240
  const [failed, setFailed] = reactExports.useState(() => /* @__PURE__ */ new Set());
64201
- const input = tool.rawInput ?? {};
64202
- const ratio = cssRatio(input.aspect_ratio);
64203
- const model = typeof input.model === "string" && input.model ? input.model : null;
64241
+ const requests = imageRequestsOf(tool);
64242
+ const ratios = requests.flatMap(
64243
+ (input) => Array(requestedCount(input.n)).fill(cssRatio(input.aspect_ratio))
64244
+ );
64245
+ const models = new Set(requests.map((input) => typeof input.model === "string" ? input.model : ""));
64246
+ const model = models.size === 1 ? [...models][0] || null : null;
64204
64247
  const running2 = tool.ok === null;
64205
64248
  if (running2) {
64206
- const count2 = requestedCount(input.n);
64249
+ const count2 = ratios.length;
64207
64250
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex flex-col gap-1.5", "data-testid": "image-generation", "aria-busy": "true", children: [
64208
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1.5", children: Array.from({ length: count2 }, (_2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(ImageFrame, { src: null, ratio, pending: true, label: "", onFail: () => void 0 }, i2)) }),
64251
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1.5", children: ratios.map((ratio, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(ImageFrame, { src: null, ratio, pending: true, label: "", onFail: () => void 0 }, i2)) }),
64209
64252
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta zg-shimmer self-start", role: "status", children: count2 > 1 ? labels.generatingImages(count2, model) : labels.generatingImage(model) })
64210
64253
  ] });
64211
64254
  }
@@ -64223,7 +64266,7 @@ function ImageGenerationBlock({
64223
64266
  ImageFrame,
64224
64267
  {
64225
64268
  src: media.url(m2.index),
64226
- ratio,
64269
+ ratio: ratios[i2] ?? ratios[0] ?? "1 / 1",
64227
64270
  pending: false,
64228
64271
  label: labels.viewAttachment(paths[i2] ?? labels.generatedImage),
64229
64272
  onOpen: (el) => lightbox.open(gallery, i2, el),
@@ -64426,7 +64469,7 @@ const ToolRow = reactExports.memo(({ tool, mode, showResult, showDiff, lineState
64426
64469
  !bodyMounted ? null : media ? (
64427
64470
  // An image the call read, or a screenshot it took: the media itself, then any text around it.
64428
64471
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex flex-col gap-1.5", children: [
64429
- !drawsImageGeneration(tool) && /* @__PURE__ */ jsxRuntimeExports.jsx(ToolMedia, { media: media.media, url: media.url }),
64472
+ (!drawsImageGeneration(tool) || tool.ok === false) && /* @__PURE__ */ jsxRuntimeExports.jsx(ToolMedia, { media: media.media, url: media.url }),
64430
64473
  tool.name !== "read_file" && media.rest !== "" && /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: CODE_PANEL, children: media.rest })
64431
64474
  ] })
64432
64475
  ) : tool.name === "read_file" ? (
@@ -64780,15 +64823,23 @@ const CommandNoteRow = reactExports.memo(({ text: text2 }) => {
64780
64823
  const InfoRow = reactExports.memo(({ text: text2 }) => {
64781
64824
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-[var(--zg-text-muted)] whitespace-pre-wrap", children: text2 });
64782
64825
  });
64826
+ const NOTICE_STYLE = {
64827
+ error: { tone: "text-zg-danger", icon: "i-ph-x-circle" },
64828
+ warn: { tone: "text-zg-warn", icon: "i-ph-warning" },
64829
+ info: { tone: "text-[var(--zg-text-muted)]", icon: "i-ph-info" }
64830
+ };
64783
64831
  const NoticeRow = reactExports.memo(({ notice, text: text2 }) => {
64784
- const tone = notice.severity === "error" ? "text-zg-danger" : notice.severity === "warn" ? "text-zg-warn" : "text-[var(--zg-text-muted)]";
64832
+ const { tone, icon } = NOTICE_STYLE[notice.severity] ?? NOTICE_STYLE.info;
64785
64833
  const [head2, ...details] = text2.split("\n").filter((line) => line.trim() !== "");
64786
64834
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-start gap-1 text-xs", title: notice.label, children: [
64787
- /* @__PURE__ */ jsxRuntimeExports.jsx(
64835
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
64788
64836
  "span",
64789
64837
  {
64790
- className: `inline-flex items-baseline gap-1.5 px-2 py-px rounded-full shadow-[inset_0_0_0_1px_var(--zg-hairline)] font-mono ${tone}`,
64791
- children: head2
64838
+ className: `inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full shadow-[inset_0_0_0_1px_var(--zg-hairline)] font-medium ${tone}`,
64839
+ children: [
64840
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${icon} shrink-0` }),
64841
+ head2
64842
+ ]
64792
64843
  }
64793
64844
  ),
64794
64845
  details.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "min-w-0 flex flex-col gap-0.5 pl-1.5 text-[var(--zg-text-muted)]", children: details.map((line, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: line }, i2)) })
@@ -65481,6 +65532,7 @@ const TextRow$1 = reactExports.memo(({ text: text2, streaming }) => {
65481
65532
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm leading-relaxed text-[var(--zg-text)]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Markdown2, { className: streaming ? "zg-streaming" : void 0, streaming, children: text2 }) });
65482
65533
  });
65483
65534
  const RUN_RECEIPT_TINT = {
65535
+ agent: "text-zg-text/80",
65484
65536
  model: "zg-soft-tint zg-tint-model",
65485
65537
  turns: "zg-soft-tint zg-tint-accent",
65486
65538
  cost: "zg-soft-tint zg-tint-money",
@@ -65494,6 +65546,7 @@ const RUN_RECEIPT_SEGMENT_TINT = {
65494
65546
  };
65495
65547
  const RECEIPT_GLYPH_ICON = {
65496
65548
  [RUN_RECEIPT_TURN_GLYPH]: "i-ph-arrow-clockwise-bold",
65549
+ [RUN_RECEIPT_SWITCH_GLYPH]: "i-ph-arrows-left-right-bold",
65497
65550
  "↑": "i-ph-arrow-up-bold",
65498
65551
  "↓": "i-ph-arrow-down-bold"
65499
65552
  };
@@ -65516,6 +65569,8 @@ function ReceiptValue({ text: text2, className }) {
65516
65569
  }
65517
65570
  function receiptTooltip(cell2, receipt, labels) {
65518
65571
  switch (cell2.kind) {
65572
+ case "agent":
65573
+ return receipt.agentSwitched ? labels.receiptAgentSwitched : labels.receiptAgent;
65519
65574
  case "model":
65520
65575
  return receipt.otherModels ? labels.receiptModelOthers(receipt.otherModels) : labels.receiptModel;
65521
65576
  case "duration":
@@ -65867,7 +65922,7 @@ const asStream = (events) => events;
65867
65922
  function useTranscriptRows(events, streaming, { showCacheNotices, codemodeShowCalls, showEditDiffs, groupToolCalls, showRunReceipt, compact }) {
65868
65923
  const shownEvents = reactExports.useMemo(() => {
65869
65924
  const shown2 = showCacheNotices && codemodeShowCalls ? events : events.filter(
65870
- (event) => (showCacheNotices || event.notice?.label !== CACHE_NOTICE_LABEL) && nestedCallVisible(event, codemodeShowCalls)
65925
+ (event) => (showCacheNotices || !isCacheNotice(event.notice)) && nestedCallVisible(event, codemodeShowCalls)
65871
65926
  );
65872
65927
  return gatherCommandNotes(asStream(shown2));
65873
65928
  }, [events, showCacheNotices, codemodeShowCalls]);
@@ -79083,6 +79138,11 @@ function splitText(text2, providers2) {
79083
79138
  if (cursor < text2.length) nodes.push({ type: "text", value: text2.slice(cursor) });
79084
79139
  return nodes;
79085
79140
  }
79141
+ function wholeReference(text2, providers2) {
79142
+ const matches2 = findReferences(text2, providers2, "assistant");
79143
+ const [only] = matches2;
79144
+ return matches2.length === 1 && only && only.start === 0 && only.end === text2.length ? only : null;
79145
+ }
79086
79146
  function visit(node2, providers2) {
79087
79147
  if (!node2.children) return;
79088
79148
  const next = [];
@@ -79091,9 +79151,20 @@ function visit(node2, providers2) {
79091
79151
  next.push(...splitText(child.value, providers2));
79092
79152
  continue;
79093
79153
  }
79154
+ if (child.type === "inlineCode" && typeof child.value === "string") {
79155
+ const whole = wholeReference(child.value, providers2);
79156
+ if (whole) {
79157
+ next.push({
79158
+ type: "link",
79159
+ url: referenceUrl(whole.providerId, whole.key, void 0, whole.placeholder, whole.placeholderIcon?.gui),
79160
+ children: [child]
79161
+ });
79162
+ continue;
79163
+ }
79164
+ }
79094
79165
  if (child.type === "link" && typeof child.url === "string" && !child.url.startsWith("zg-ref:")) {
79095
- const [whole] = findReferences(child.url, providers2, "assistant");
79096
- if (whole && whole.start === 0 && whole.end === child.url.length) {
79166
+ const whole = wholeReference(child.url, providers2);
79167
+ if (whole) {
79097
79168
  next.push({
79098
79169
  ...child,
79099
79170
  url: referenceUrl(whole.providerId, whole.key, child.url, whole.placeholder, whole.placeholderIcon?.gui)
@@ -79150,7 +79221,7 @@ function ProseReference({ parsed, children }) {
79150
79221
  ...parsed.placeholder ? { placeholder: parsed.placeholder } : {},
79151
79222
  ...parsed.placeholderIcon ? { placeholderIcon: { gui: parsed.placeholderIcon } } : {},
79152
79223
  className: "zg-file-chip zg-badge",
79153
- fallback: parsed.href ? /* @__PURE__ */ jsxRuntimeExports.jsx(PlainLink, { href: parsed.href, children }) : text2
79224
+ fallback: parsed.href ? /* @__PURE__ */ jsxRuntimeExports.jsx(PlainLink, { href: parsed.href, children }) : children ?? text2
79154
79225
  }
79155
79226
  );
79156
79227
  }
@@ -81788,6 +81859,12 @@ const DEFAULT_ONBOARDING_LABELS = {
81788
81859
  demoScript: ["const files = await glob('src/**/*.ts')", "for (const file of files) await read(file)"],
81789
81860
  demoCalls: "12 calls",
81790
81861
  demoStep: "1 step",
81862
+ demoSearchQuery: "vite 6 breaking changes",
81863
+ demoSearchResults: [
81864
+ "vite.dev/guide/migration",
81865
+ "github.com/vitejs/vite/releases",
81866
+ "vite.dev/blog/announcing-vite6"
81867
+ ],
81791
81868
  demoTyped: "Open src/comp",
81792
81869
  demoGhost: "onents/Button.tsx",
81793
81870
  demoTab: "Tab",
@@ -84555,6 +84632,24 @@ function CodemodeDemo({ on }) {
84555
84632
  ] })
84556
84633
  ] });
84557
84634
  }
84635
+ function WebSearchDemo({ on }) {
84636
+ const labels = useOnboardingLabels();
84637
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(DemoStage, { on, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
84638
+ MiniWindow,
84639
+ {
84640
+ className: "w-full max-w-[300px]",
84641
+ bar: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "zg-tray flex items-center gap-1 h-3.5 px-2 rounded-full max-w-[180px] w-full min-w-0", children: [
84642
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-ph-magnifying-glass text-zg-badge text-[var(--zg-text-muted)] shrink-0" }),
84643
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-zg-badge", children: labels.demoSearchQuery })
84644
+ ] }),
84645
+ bodyClassName: "px-3 pt-1 pb-2.5 gap-1.5",
84646
+ children: labels.demoSearchResults.map((url, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "zg-loop zg-demo-arrive flex flex-col gap-1 min-w-0", style: delay(i2 * 300), children: [
84647
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-zg-badge text-[var(--zg-accent)]", children: url }),
84648
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Line, { width: `${72 - i2 * 12}%` })
84649
+ ] }, url))
84650
+ }
84651
+ ) });
84652
+ }
84558
84653
  function Composer$1({ children }) {
84559
84654
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-raised border rounded-full flex items-center gap-1.5 h-8 pl-3 pr-1.5 w-full max-w-[320px] min-w-0", children });
84560
84655
  }
@@ -84759,6 +84854,7 @@ function ProjectExtensionsDemo({ on }) {
84759
84854
  }
84760
84855
  const DEMOS = {
84761
84856
  codemode: CodemodeDemo,
84857
+ webSearch: WebSearchDemo,
84762
84858
  inlineAutocomplete: AutocompleteDemo,
84763
84859
  autoTitle: AutoTitleDemo,
84764
84860
  spaces: SpacesDemo,
@@ -106534,6 +106630,214 @@ function prMatches(pr, query) {
106534
106630
  const bare = q2.replace(/^#/, "");
106535
106631
  return bare !== "" && String(pr.number).startsWith(bare) || pr.title.toLowerCase().includes(q2) || pr.branch.toLowerCase().includes(q2) || pr.author.toLowerCase().includes(q2);
106536
106632
  }
106633
+ const KIND_LABELS = {
106634
+ local: "Local",
106635
+ worktree: "Worktree",
106636
+ docker: "Docker",
106637
+ e2b: "E2B",
106638
+ daytona: "Daytona"
106639
+ };
106640
+ const KIND_ICONS = {
106641
+ local: "i-ph-laptop",
106642
+ worktree: "i-ph-git-branch",
106643
+ docker: "i-ph-cube",
106644
+ e2b: "i-ph-cloud",
106645
+ daytona: "i-ph-cloud"
106646
+ };
106647
+ const REMOTE_KINDS = /* @__PURE__ */ new Set(["e2b", "daytona"]);
106648
+ function runsInRemoteSandbox(environment) {
106649
+ return environment !== void 0 && REMOTE_KINDS.has(environment.kind);
106650
+ }
106651
+ function deleteSessionPrompt(title, environment) {
106652
+ const base2 = `Delete "${title}"?`;
106653
+ if (environment && runsInRemoteSandbox(environment)) {
106654
+ return `${base2}
106655
+
106656
+ Its ${environmentKindLabel(environment.kind)} sandbox is deleted too. Push anything you want to keep first.`;
106657
+ }
106658
+ return base2;
106659
+ }
106660
+ function environmentKindLabel(kind) {
106661
+ const machine = parseMachineKind(kind);
106662
+ if (machine) return `${KIND_LABELS[machine.base]} @ ${machine.name}`;
106663
+ return KIND_LABELS[kind] ?? kind;
106664
+ }
106665
+ function environmentKindIcon(kind) {
106666
+ return KIND_ICONS[parseMachineKind(kind)?.base ?? kind] ?? "i-ph-cube";
106667
+ }
106668
+ function environmentSummaryText(environment) {
106669
+ const label = environmentKindLabel(environment.kind);
106670
+ const where = environment.branch ? `${label} (${environment.branch})` : label;
106671
+ if (environment.state === "provisioning") {
106672
+ return `${where}. Setting up…`;
106673
+ }
106674
+ if (environment.state === "failed") {
106675
+ return `${where}. Setup failed${environment.error ? `: ${environment.error}` : "."}`;
106676
+ }
106677
+ if (environment.suspended) {
106678
+ return `${where}. Paused while idle, resumes on your next prompt.`;
106679
+ }
106680
+ return where;
106681
+ }
106682
+ function EnvironmentChip({ environment }) {
106683
+ if (!environment) {
106684
+ return null;
106685
+ }
106686
+ const icon = environment.state === "provisioning" ? "i-ph-circle-notch animate-spin text-[var(--zg-text-muted)]" : environment.state === "failed" ? "i-ph-warning-circle text-[var(--zg-danger)]" : `${environmentKindIcon(environment.kind)} ${environment.suspended ? "opacity-45" : ""}`;
106687
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
106688
+ "span",
106689
+ {
106690
+ "data-testid": "row-badge-environment",
106691
+ title: environmentSummaryText(environment),
106692
+ className: "zg-row-badge zg-meta inline-flex items-center gap-1 h-[18px] px-1.5 rounded-[var(--zg-radius-sm)] whitespace-nowrap",
106693
+ children: [
106694
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${icon} text-[11px]` }),
106695
+ environment.branch || environmentKindLabel(environment.kind)
106696
+ ]
106697
+ }
106698
+ );
106699
+ }
106700
+ function useEnvironmentChoices(cwd2, hostId) {
106701
+ const listed = useIpcResource(cwd2 === null ? null : environmentsResource(cwd2, hostId)).data;
106702
+ return reactExports.useMemo(() => listed ? withMachines(listed) : NO_DESCRIPTORS, [listed]);
106703
+ }
106704
+ const NO_DESCRIPTORS = [];
106705
+ function withMachines(descriptors) {
106706
+ return orderByMachine(descriptors).map((descriptor) => {
106707
+ const blocked = machineBlockedReason(descriptor);
106708
+ return blocked && descriptor.available ? { ...descriptor, available: false, reason: blocked } : descriptor;
106709
+ });
106710
+ }
106711
+ const usable = (descriptor) => descriptor.enabled && descriptor.available;
106712
+ function resolveDraftDescriptor(descriptors, draft2) {
106713
+ const picked = draft2 ? descriptors.find((d2) => d2.kind === draft2.kind && usable(d2)) : void 0;
106714
+ return picked ?? descriptors.find((d2) => d2.isDefault && usable(d2)) ?? descriptors.find((d2) => d2.kind === "local");
106715
+ }
106716
+ function resolveDraftEnvironment(descriptors, draft2) {
106717
+ const descriptor = resolveDraftDescriptor(descriptors, draft2);
106718
+ if (!descriptor || descriptor.kind === "local") {
106719
+ return void 0;
106720
+ }
106721
+ const typed = draft2?.kind === descriptor.kind ? draft2.branch.trim() : "";
106722
+ const branch = descriptor.takesBranch ? typed || descriptor.suggestedBranch : void 0;
106723
+ return { kind: descriptor.kind, ...branch ? { branch } : {} };
106724
+ }
106725
+ function EnvironmentPicker({
106726
+ descriptors,
106727
+ draft: draft2,
106728
+ onChange,
106729
+ onOpenSettings
106730
+ }) {
106731
+ const branchRef = reactExports.useRef(null);
106732
+ const offered = descriptors.filter((d2) => d2.enabled);
106733
+ const selected = resolveDraftDescriptor(descriptors, draft2);
106734
+ if (offered.length <= 1 || !selected) {
106735
+ return null;
106736
+ }
106737
+ const typedBranch = draft2?.kind === selected.kind ? draft2.branch : "";
106738
+ const branchLabel = selected.takesBranch ? typedBranch.trim() || selected.suggestedBranch : void 0;
106739
+ const icon = environmentKindIcon(selected.kind);
106740
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
106741
+ Popover,
106742
+ {
106743
+ role: "menu",
106744
+ ariaLabel: "Choose where the session runs",
106745
+ align: "end",
106746
+ width: 300,
106747
+ trigger: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-segment shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
106748
+ "button",
106749
+ {
106750
+ ...props,
106751
+ type: "button",
106752
+ title: `Runs in: ${selected.label}${branchLabel ? ` (${branchLabel})` : ""}`,
106753
+ className: "zg-segment-item zg-press-subtle inline-flex items-center gap-1.5 h-6 pl-2.5 pr-2 rounded-full text-xs border-0 bg-transparent text-[var(--zg-text-muted)] cursor-pointer whitespace-nowrap",
106754
+ children: [
106755
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${icon} text-[11px] shrink-0` }),
106756
+ branchLabel ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-pill-label max-w-[min(130px,14cqi)] truncate font-mono", children: branchLabel }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-pill-label shrink-0", children: selected.label }),
106757
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "zg-pill-label i-ph-caret-up-down text-[10px] shrink-0 opacity-70" })
106758
+ ]
106759
+ }
106760
+ ) }),
106761
+ children: (close2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Menu$1, { role: "group", children: [
106762
+ /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSection, { label: "Runs in", children: offered.map((descriptor) => {
106763
+ const active2 = descriptor.kind === selected.kind;
106764
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
106765
+ MenuRow$1,
106766
+ {
106767
+ size: "lg",
106768
+ role: "menuitemradio",
106769
+ checked: active2,
106770
+ disabled: !descriptor.available,
106771
+ hint: descriptor.available ? void 0 : descriptor.reason,
106772
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: environmentKindIcon(descriptor.kind) }),
106773
+ title: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
106774
+ descriptor.label,
106775
+ descriptor.machine && /* @__PURE__ */ jsxRuntimeExports.jsx(
106776
+ MetaChip,
106777
+ {
106778
+ tone: descriptor.machine.status === "online" ? "success" : "muted",
106779
+ className: "font-normal ml-1.5",
106780
+ children: descriptor.machine.status
106781
+ }
106782
+ ),
106783
+ descriptor.isDefault && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta font-normal ml-1.5", children: "default" })
106784
+ ] }),
106785
+ description: descriptor.available ? descriptor.description : descriptor.reason,
106786
+ onClick: () => {
106787
+ onChange({ kind: descriptor.kind, branch: active2 ? typedBranch : "" });
106788
+ if (descriptor.takesBranch) {
106789
+ requestAnimationFrame(() => branchRef.current?.focus());
106790
+ } else {
106791
+ close2();
106792
+ }
106793
+ }
106794
+ },
106795
+ descriptor.kind
106796
+ );
106797
+ }) }),
106798
+ selected.takesBranch && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
106799
+ /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSeparator$1, {}),
106800
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(MenuSection, { label: "Branch", children: [
106801
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-2 pb-1.5", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
106802
+ "input",
106803
+ {
106804
+ ref: branchRef,
106805
+ type: "text",
106806
+ value: typedBranch,
106807
+ onChange: (event) => onChange({ kind: selected.kind, branch: event.target.value }),
106808
+ onKeyDown: (event) => {
106809
+ if (event.key === "Enter") {
106810
+ event.preventDefault();
106811
+ close2();
106812
+ }
106813
+ },
106814
+ placeholder: selected.suggestedBranch ?? "Branch name",
106815
+ "aria-label": "Branch",
106816
+ spellCheck: false,
106817
+ className: "zg-well w-full h-7 px-2 text-xs font-mono placeholder:text-[var(--zg-text-subtle)]"
106818
+ }
106819
+ ) }),
106820
+ /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { className: "!pt-0", children: "Empty uses the suggested name." })
106821
+ ] })
106822
+ ] }),
106823
+ selected.note && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { icon: "i-ph-info", children: selected.note }),
106824
+ /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSeparator$1, {}),
106825
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
106826
+ MenuRow$1,
106827
+ {
106828
+ role: "menuitem",
106829
+ icon: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-ph-gear-six" }),
106830
+ title: "Environment settings…",
106831
+ onClick: () => {
106832
+ close2();
106833
+ onOpenSettings();
106834
+ }
106835
+ }
106836
+ )
106837
+ ] })
106838
+ }
106839
+ );
106840
+ }
106537
106841
  const SECTIONS = [
106538
106842
  { id: "review", label: "Waiting on you", cap: 5 },
106539
106843
  { id: "mine", label: "Yours", cap: 5 },
@@ -106581,6 +106885,19 @@ function BranchMenu({
106581
106885
  const inputRef = reactExports.useRef(null);
106582
106886
  const listRef = reactExports.useRef(null);
106583
106887
  const scrollToActive = reactExports.useRef(false);
106888
+ const [worktreeBranch, setWorktreeBranch] = reactExports.useState(null);
106889
+ const worktreeOpen = reactExports.useRef(false);
106890
+ worktreeOpen.current = worktreeBranch !== null;
106891
+ const worktreeInputRef = reactExports.useRef(null);
106892
+ const { allSessions } = useSessionsList();
106893
+ const session = sessionId ? allSessions.find((s2) => s2.id === sessionId) : void 0;
106894
+ const canMove = session !== void 0 && (session.environment?.kind ?? "local") === "local";
106895
+ const hostKey = sessionId ? parseSessionKey(sessionId).hostId : LOCAL_SESSION_HOST;
106896
+ const choices = useEnvironmentChoices(
106897
+ open && canMove ? cwd2 : null,
106898
+ hostKey === LOCAL_SESSION_HOST ? void 0 : hostKey
106899
+ );
106900
+ const worktree = canMove ? choices.find((d2) => d2.kind === "worktree" && d2.enabled) : void 0;
106584
106901
  reactExports.useLayoutEffect(() => {
106585
106902
  if (open && listRef.current) listRef.current.scrollTop = 0;
106586
106903
  }, [open]);
@@ -106594,6 +106911,7 @@ function BranchMenu({
106594
106911
  setActive2(0);
106595
106912
  setError(null);
106596
106913
  setPendingEnter(false);
106914
+ setWorktreeBranch(null);
106597
106915
  setBranches(branchCache.get(cwd2) ?? null);
106598
106916
  setPrs(prCache$1.has(cwd2) ? prCache$1.get(cwd2) : void 0);
106599
106917
  let live = true;
@@ -106624,6 +106942,11 @@ function BranchMenu({
106624
106942
  if (e2.key !== "Escape") return;
106625
106943
  e2.preventDefault();
106626
106944
  e2.stopPropagation();
106945
+ if (worktreeOpen.current) {
106946
+ setWorktreeBranch(null);
106947
+ inputRef.current?.focus();
106948
+ return;
106949
+ }
106627
106950
  onCloseRef.current();
106628
106951
  };
106629
106952
  document.addEventListener("pointerdown", onPointer, true);
@@ -106691,6 +107014,20 @@ function BranchMenu({
106691
107014
  if (result.ok) onSwitched();
106692
107015
  else setError(result.error);
106693
107016
  };
107017
+ const startWorktree = async () => {
107018
+ if (!sessionId || !worktree || busy2) return;
107019
+ const branch = worktreeBranch?.trim() || worktree.suggestedBranch;
107020
+ setBusy("worktree");
107021
+ setError(null);
107022
+ try {
107023
+ await window.api.sessions.moveEnvironment(sessionId, { kind: "worktree", ...branch ? { branch } : {} });
107024
+ onSwitched();
107025
+ } catch (err) {
107026
+ setError(err?.message ?? String(err));
107027
+ } finally {
107028
+ setBusy(null);
107029
+ }
107030
+ };
106694
107031
  const pickRef = reactExports.useRef(pick2);
106695
107032
  pickRef.current = pick2;
106696
107033
  const entriesRef = reactExports.useRef(entries2);
@@ -106825,7 +107162,59 @@ function BranchMenu({
106825
107162
  branches === null ? /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { children: "Loading branches…" }) : entries2.length === 0 && !searching && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { children: "No matches" })
106826
107163
  ]
106827
107164
  }
106828
- )
107165
+ ),
107166
+ worktree && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-1 pb-1 border-t border-[var(--zg-hairline)]", "data-testid": "git-worktree-footer", children: worktreeBranch === null ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
107167
+ "button",
107168
+ {
107169
+ type: "button",
107170
+ "data-testid": "git-start-worktree",
107171
+ className: "zg-menu-row zg-press-subtle w-full mt-1 text-[12px] disabled:opacity-50",
107172
+ "data-size": "sm",
107173
+ disabled: !worktree.available || busy2 !== null,
107174
+ title: worktree.available ? void 0 : worktree.reason,
107175
+ onClick: () => {
107176
+ setWorktreeBranch(worktree.suggestedBranch ?? "");
107177
+ requestAnimationFrame(() => worktreeInputRef.current?.select());
107178
+ },
107179
+ children: [
107180
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${environmentKindIcon("worktree")} text-[13px] w-4 shrink-0` }),
107181
+ "Start a worktree…",
107182
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-auto text-[11px] text-[var(--zg-text-subtle)]", children: "moves this chat" })
107183
+ ]
107184
+ }
107185
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
107186
+ "form",
107187
+ {
107188
+ className: "flex items-center gap-1.5 mt-1",
107189
+ onSubmit: (e2) => {
107190
+ e2.preventDefault();
107191
+ void startWorktree();
107192
+ },
107193
+ children: [
107194
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
107195
+ "span",
107196
+ {
107197
+ "aria-hidden": true,
107198
+ className: `${environmentKindIcon("worktree")} text-[13px] w-4 shrink-0 ml-2 text-[var(--zg-text-muted)]`
107199
+ }
107200
+ ),
107201
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
107202
+ "input",
107203
+ {
107204
+ ref: worktreeInputRef,
107205
+ value: worktreeBranch,
107206
+ onChange: (e2) => setWorktreeBranch(e2.target.value),
107207
+ placeholder: worktree.suggestedBranch ?? "branch name",
107208
+ "aria-label": "New worktree branch",
107209
+ "data-testid": "git-worktree-branch",
107210
+ disabled: busy2 !== null,
107211
+ className: "zg-well zg-meta flex-1 min-w-0 h-7 px-2.5 text-[12px] placeholder:text-[var(--zg-text-subtle)]"
107212
+ }
107213
+ ),
107214
+ busy2 === "worktree" ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-arc shrink-0 mr-2", "aria-label": "starting worktree" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { size: "xs", icon: "i-ph-arrow-right", label: "Start the worktree", type: "submit" })
107215
+ ]
107216
+ }
107217
+ ) })
106829
107218
  ]
106830
107219
  }
106831
107220
  );
@@ -132016,214 +132405,6 @@ function ComposerNotice({ text: text2, onDismiss, testId }) {
132016
132405
  }
132017
132406
  );
132018
132407
  }
132019
- const KIND_LABELS = {
132020
- local: "Local",
132021
- worktree: "Worktree",
132022
- docker: "Docker",
132023
- e2b: "E2B",
132024
- daytona: "Daytona"
132025
- };
132026
- const KIND_ICONS = {
132027
- local: "i-ph-laptop",
132028
- worktree: "i-ph-git-branch",
132029
- docker: "i-ph-cube",
132030
- e2b: "i-ph-cloud",
132031
- daytona: "i-ph-cloud"
132032
- };
132033
- const REMOTE_KINDS = /* @__PURE__ */ new Set(["e2b", "daytona"]);
132034
- function runsInRemoteSandbox(environment) {
132035
- return environment !== void 0 && REMOTE_KINDS.has(environment.kind);
132036
- }
132037
- function deleteSessionPrompt(title, environment) {
132038
- const base2 = `Delete "${title}"?`;
132039
- if (environment && runsInRemoteSandbox(environment)) {
132040
- return `${base2}
132041
-
132042
- Its ${environmentKindLabel(environment.kind)} sandbox is deleted too. Push anything you want to keep first.`;
132043
- }
132044
- return base2;
132045
- }
132046
- function environmentKindLabel(kind) {
132047
- const machine = parseMachineKind(kind);
132048
- if (machine) return `${KIND_LABELS[machine.base]} @ ${machine.name}`;
132049
- return KIND_LABELS[kind] ?? kind;
132050
- }
132051
- function environmentKindIcon(kind) {
132052
- return KIND_ICONS[parseMachineKind(kind)?.base ?? kind] ?? "i-ph-cube";
132053
- }
132054
- function environmentSummaryText(environment) {
132055
- const label = environmentKindLabel(environment.kind);
132056
- const where = environment.branch ? `${label} (${environment.branch})` : label;
132057
- if (environment.state === "provisioning") {
132058
- return `${where}. Setting up…`;
132059
- }
132060
- if (environment.state === "failed") {
132061
- return `${where}. Setup failed${environment.error ? `: ${environment.error}` : "."}`;
132062
- }
132063
- if (environment.suspended) {
132064
- return `${where}. Paused while idle, resumes on your next prompt.`;
132065
- }
132066
- return where;
132067
- }
132068
- function EnvironmentChip({ environment }) {
132069
- if (!environment) {
132070
- return null;
132071
- }
132072
- const icon = environment.state === "provisioning" ? "i-ph-circle-notch animate-spin text-[var(--zg-text-muted)]" : environment.state === "failed" ? "i-ph-warning-circle text-[var(--zg-danger)]" : `${environmentKindIcon(environment.kind)} ${environment.suspended ? "opacity-45" : ""}`;
132073
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
132074
- "span",
132075
- {
132076
- "data-testid": "row-badge-environment",
132077
- title: environmentSummaryText(environment),
132078
- className: "zg-row-badge zg-meta inline-flex items-center gap-1 h-[18px] px-1.5 rounded-[var(--zg-radius-sm)] whitespace-nowrap",
132079
- children: [
132080
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${icon} text-[11px]` }),
132081
- environment.branch || environmentKindLabel(environment.kind)
132082
- ]
132083
- }
132084
- );
132085
- }
132086
- function useEnvironmentChoices(cwd2, hostId) {
132087
- const listed = useIpcResource(cwd2 === null ? null : environmentsResource(cwd2, hostId)).data;
132088
- return reactExports.useMemo(() => listed ? withMachines(listed) : NO_DESCRIPTORS, [listed]);
132089
- }
132090
- const NO_DESCRIPTORS = [];
132091
- function withMachines(descriptors) {
132092
- return orderByMachine(descriptors).map((descriptor) => {
132093
- const blocked = machineBlockedReason(descriptor);
132094
- return blocked && descriptor.available ? { ...descriptor, available: false, reason: blocked } : descriptor;
132095
- });
132096
- }
132097
- const usable = (descriptor) => descriptor.enabled && descriptor.available;
132098
- function resolveDraftDescriptor(descriptors, draft2) {
132099
- const picked = draft2 ? descriptors.find((d2) => d2.kind === draft2.kind && usable(d2)) : void 0;
132100
- return picked ?? descriptors.find((d2) => d2.isDefault && usable(d2)) ?? descriptors.find((d2) => d2.kind === "local");
132101
- }
132102
- function resolveDraftEnvironment(descriptors, draft2) {
132103
- const descriptor = resolveDraftDescriptor(descriptors, draft2);
132104
- if (!descriptor || descriptor.kind === "local") {
132105
- return void 0;
132106
- }
132107
- const typed = draft2?.kind === descriptor.kind ? draft2.branch.trim() : "";
132108
- const branch = descriptor.takesBranch ? typed || descriptor.suggestedBranch : void 0;
132109
- return { kind: descriptor.kind, ...branch ? { branch } : {} };
132110
- }
132111
- function EnvironmentPicker({
132112
- descriptors,
132113
- draft: draft2,
132114
- onChange,
132115
- onOpenSettings
132116
- }) {
132117
- const branchRef = reactExports.useRef(null);
132118
- const offered = descriptors.filter((d2) => d2.enabled);
132119
- const selected = resolveDraftDescriptor(descriptors, draft2);
132120
- if (offered.length <= 1 || !selected) {
132121
- return null;
132122
- }
132123
- const typedBranch = draft2?.kind === selected.kind ? draft2.branch : "";
132124
- const branchLabel = selected.takesBranch ? typedBranch.trim() || selected.suggestedBranch : void 0;
132125
- const icon = environmentKindIcon(selected.kind);
132126
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
132127
- Popover,
132128
- {
132129
- role: "menu",
132130
- ariaLabel: "Choose where the session runs",
132131
- align: "end",
132132
- width: 300,
132133
- trigger: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-segment shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
132134
- "button",
132135
- {
132136
- ...props,
132137
- type: "button",
132138
- title: `Runs in: ${selected.label}${branchLabel ? ` (${branchLabel})` : ""}`,
132139
- className: "zg-segment-item zg-press-subtle inline-flex items-center gap-1.5 h-6 pl-2.5 pr-2 rounded-full text-xs border-0 bg-transparent text-[var(--zg-text-muted)] cursor-pointer whitespace-nowrap",
132140
- children: [
132141
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${icon} text-[11px] shrink-0` }),
132142
- branchLabel ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-pill-label max-w-[min(130px,14cqi)] truncate font-mono", children: branchLabel }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-pill-label shrink-0", children: selected.label }),
132143
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "zg-pill-label i-ph-caret-up-down text-[10px] shrink-0 opacity-70" })
132144
- ]
132145
- }
132146
- ) }),
132147
- children: (close2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Menu$1, { role: "group", children: [
132148
- /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSection, { label: "Runs in", children: offered.map((descriptor) => {
132149
- const active2 = descriptor.kind === selected.kind;
132150
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
132151
- MenuRow$1,
132152
- {
132153
- size: "lg",
132154
- role: "menuitemradio",
132155
- checked: active2,
132156
- disabled: !descriptor.available,
132157
- hint: descriptor.available ? void 0 : descriptor.reason,
132158
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: environmentKindIcon(descriptor.kind) }),
132159
- title: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
132160
- descriptor.label,
132161
- descriptor.machine && /* @__PURE__ */ jsxRuntimeExports.jsx(
132162
- MetaChip,
132163
- {
132164
- tone: descriptor.machine.status === "online" ? "success" : "muted",
132165
- className: "font-normal ml-1.5",
132166
- children: descriptor.machine.status
132167
- }
132168
- ),
132169
- descriptor.isDefault && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta font-normal ml-1.5", children: "default" })
132170
- ] }),
132171
- description: descriptor.available ? descriptor.description : descriptor.reason,
132172
- onClick: () => {
132173
- onChange({ kind: descriptor.kind, branch: active2 ? typedBranch : "" });
132174
- if (descriptor.takesBranch) {
132175
- requestAnimationFrame(() => branchRef.current?.focus());
132176
- } else {
132177
- close2();
132178
- }
132179
- }
132180
- },
132181
- descriptor.kind
132182
- );
132183
- }) }),
132184
- selected.takesBranch && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
132185
- /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSeparator$1, {}),
132186
- /* @__PURE__ */ jsxRuntimeExports.jsxs(MenuSection, { label: "Branch", children: [
132187
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-2 pb-1.5", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
132188
- "input",
132189
- {
132190
- ref: branchRef,
132191
- type: "text",
132192
- value: typedBranch,
132193
- onChange: (event) => onChange({ kind: selected.kind, branch: event.target.value }),
132194
- onKeyDown: (event) => {
132195
- if (event.key === "Enter") {
132196
- event.preventDefault();
132197
- close2();
132198
- }
132199
- },
132200
- placeholder: selected.suggestedBranch ?? "Branch name",
132201
- "aria-label": "Branch",
132202
- spellCheck: false,
132203
- className: "zg-well w-full h-7 px-2 text-xs font-mono placeholder:text-[var(--zg-text-subtle)]"
132204
- }
132205
- ) }),
132206
- /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { className: "!pt-0", children: "Empty uses the suggested name." })
132207
- ] })
132208
- ] }),
132209
- selected.note && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { icon: "i-ph-info", children: selected.note }),
132210
- /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSeparator$1, {}),
132211
- /* @__PURE__ */ jsxRuntimeExports.jsx(
132212
- MenuRow$1,
132213
- {
132214
- role: "menuitem",
132215
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-ph-gear-six" }),
132216
- title: "Environment settings…",
132217
- onClick: () => {
132218
- close2();
132219
- onOpenSettings();
132220
- }
132221
- }
132222
- )
132223
- ] })
132224
- }
132225
- );
132226
- }
132227
132408
  const online = /* @__PURE__ */ new Set();
132228
132409
  let snapshot = /* @__PURE__ */ new Set();
132229
132410
  const listeners$9 = /* @__PURE__ */ new Set();
@@ -171021,6 +171202,85 @@ function IconPicker({
171021
171202
  /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ref: fileRef, type: "file", accept: "image/*", className: "hidden", onChange: (e2) => void onFileChange(e2) })
171022
171203
  ] });
171023
171204
  }
171205
+ const INITIAL = {
171206
+ running: "",
171207
+ latest: null,
171208
+ hasUpdate: false,
171209
+ installed: null,
171210
+ restartRequired: false,
171211
+ phase: "idle",
171212
+ progress: null,
171213
+ error: null,
171214
+ checkedAt: null
171215
+ };
171216
+ let state = INITIAL;
171217
+ let wired = false;
171218
+ const listeners$4 = /* @__PURE__ */ new Set();
171219
+ function set(next) {
171220
+ if (!next) {
171221
+ return;
171222
+ }
171223
+ state = next;
171224
+ for (const listener of listeners$4) {
171225
+ listener();
171226
+ }
171227
+ }
171228
+ function wire() {
171229
+ if (wired) {
171230
+ return;
171231
+ }
171232
+ wired = true;
171233
+ window.api.update.onChanged(set);
171234
+ void window.api.update.state().then(set, () => void 0);
171235
+ }
171236
+ function subscribe$4(listener) {
171237
+ wire();
171238
+ listeners$4.add(listener);
171239
+ return () => {
171240
+ listeners$4.delete(listener);
171241
+ };
171242
+ }
171243
+ function getSnapshot() {
171244
+ return state;
171245
+ }
171246
+ function useUpdateState() {
171247
+ return reactExports.useSyncExternalStore(subscribe$4, getSnapshot, getSnapshot);
171248
+ }
171249
+ function useUpdateChecks() {
171250
+ const { settings } = useSettings();
171251
+ const checksOn = settings.checkForUpdates !== false;
171252
+ reactExports.useEffect(() => {
171253
+ if (checksOn) {
171254
+ window.api.update.check().catch(() => void 0);
171255
+ }
171256
+ }, [checksOn]);
171257
+ }
171258
+ function useAppUpdate() {
171259
+ const update2 = useUpdateState();
171260
+ const { settings } = useSettings();
171261
+ const checksOn = settings.checkForUpdates !== false;
171262
+ const version = update2.restartRequired ? update2.installed : update2.latest;
171263
+ const show = update2.phase === "updating" || update2.restartRequired || checksOn && (update2.hasUpdate || update2.phase === "failed");
171264
+ if (!show || !version) {
171265
+ return null;
171266
+ }
171267
+ const kind = update2.phase === "updating" ? "updating" : update2.restartRequired ? "restart" : update2.phase === "failed" ? "failed" : "available";
171268
+ const label = `v${version.replace(/^v/, "")}`;
171269
+ const title = kind === "updating" ? `Updating to Zidane ${label}…${update2.progress ? `
171270
+ ${update2.progress}` : ""}` : kind === "restart" ? `Zidane ${label} is installed. Restart to use it.` : kind === "failed" ? `Upgrade to Zidane ${label} failed. Click to retry.
171271
+ ${update2.error ?? ""}`.trimEnd() : `Upgrade to Zidane ${label}.`;
171272
+ const run2 = () => {
171273
+ if (kind === "updating") {
171274
+ return;
171275
+ }
171276
+ if (kind === "restart") {
171277
+ window.api.update.restart().catch((err) => console.error("[zidane-gui] update restart failed", err));
171278
+ return;
171279
+ }
171280
+ window.api.update.install().catch((err) => console.error("[zidane-gui] update install failed", err));
171281
+ };
171282
+ return { kind, label, title, run: run2 };
171283
+ }
171024
171284
  function orbState(health2, running2, attention2) {
171025
171285
  if (health2 === "disconnected") return "down";
171026
171286
  if (health2 === "connecting") return "connecting";
@@ -171546,50 +171806,6 @@ function useProviderUsage() {
171546
171806
  }
171547
171807
  return ctx2;
171548
171808
  }
171549
- const INITIAL = {
171550
- running: "",
171551
- latest: null,
171552
- hasUpdate: false,
171553
- installed: null,
171554
- restartRequired: false,
171555
- phase: "idle",
171556
- progress: null,
171557
- error: null,
171558
- checkedAt: null
171559
- };
171560
- let state = INITIAL;
171561
- let wired = false;
171562
- const listeners$4 = /* @__PURE__ */ new Set();
171563
- function set(next) {
171564
- if (!next) {
171565
- return;
171566
- }
171567
- state = next;
171568
- for (const listener of listeners$4) {
171569
- listener();
171570
- }
171571
- }
171572
- function wire() {
171573
- if (wired) {
171574
- return;
171575
- }
171576
- wired = true;
171577
- window.api.update.onChanged(set);
171578
- void window.api.update.state().then(set, () => void 0);
171579
- }
171580
- function subscribe$4(listener) {
171581
- wire();
171582
- listeners$4.add(listener);
171583
- return () => {
171584
- listeners$4.delete(listener);
171585
- };
171586
- }
171587
- function getSnapshot() {
171588
- return state;
171589
- }
171590
- function useUpdateState() {
171591
- return reactExports.useSyncExternalStore(subscribe$4, getSnapshot, getSnapshot);
171592
- }
171593
171809
  const FRAME_INTERVAL_MS = 50;
171594
171810
  const ELLIPSIS_FRAMES = 8;
171595
171811
  const CHARSET = "0123456789abcdefABCDEF~!@#$£€%^&*()+=_";
@@ -171697,6 +171913,8 @@ function ReducedMotionFallback({
171697
171913
  const FOOTER_TEXT_BUTTON = "zg-segment-item zg-press-soft zg-hit-extend relative inline-flex items-center gap-1.5 h-7 px-2 rounded-[var(--zg-radius-sm)] bg-transparent border-0 cursor-pointer shrink-0 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--zg-ring)]";
171698
171914
  function Footer({ compacting, hasAuth, onOpenAuth, onOpenSettings, compactionProgress, spaces }) {
171699
171915
  const { settings } = useSettings();
171916
+ useUpdateChecks();
171917
+ const update2 = useAppUpdate();
171700
171918
  return (
171701
171919
  /*
171702
171920
  * Height invariant: 28px content (h-7 buttons) + 5px top + 4px bottom
@@ -171718,69 +171936,31 @@ function Footer({ compacting, hasAuth, onOpenAuth, onOpenSettings, compactionPro
171718
171936
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-2 px-2 pt-[5px] pb-1 text-[11px] text-[var(--zg-text-muted)] shrink-0", children: [
171719
171937
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
171720
171938
  settings.useDaemon && /* @__PURE__ */ jsxRuntimeExports.jsx(DaemonMenu, {}),
171721
- /* @__PURE__ */ jsxRuntimeExports.jsx(UpdateButton, {}),
171722
171939
  hasAuth === false && /* @__PURE__ */ jsxRuntimeExports.jsx(SignInPrompt, { onClick: onOpenAuth }),
171723
171940
  settings.showUsageIndicator !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(UsageIndicator, {}),
171724
171941
  /* @__PURE__ */ jsxRuntimeExports.jsx(Presence$1, { show: compacting && settings.showThrobber, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CompactingIndicator, { progress: compactionProgress }) })
171725
171942
  ] }),
171726
171943
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center min-w-0", children: spaces }),
171727
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-end min-w-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { icon: "i-ph-gear-six", label: "Settings", onClick: onOpenSettings, className: "zg-hit-extend relative" }) })
171944
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-end min-w-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
171945
+ IconButton,
171946
+ {
171947
+ icon: "i-ph-gear-six",
171948
+ label: update2 ? `Settings. ${update2.title.split("\n")[0]}` : "Settings",
171949
+ onClick: onOpenSettings,
171950
+ className: "zg-hit-extend relative",
171951
+ children: update2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
171952
+ "span",
171953
+ {
171954
+ "aria-hidden": true,
171955
+ "data-update-dot": true,
171956
+ className: `pointer-events-none absolute top-1 right-1 w-1.5 h-1.5 rounded-full ${update2.kind === "failed" ? "bg-[var(--zg-warn)]" : "bg-[var(--zg-accent)]"}`
171957
+ }
171958
+ )
171959
+ }
171960
+ ) })
171728
171961
  ] })
171729
171962
  );
171730
171963
  }
171731
- function UpdateButton() {
171732
- const update2 = useUpdateState();
171733
- const { settings } = useSettings();
171734
- const checksOn = settings.checkForUpdates !== false;
171735
- reactExports.useEffect(() => {
171736
- if (checksOn) {
171737
- window.api.update.check().catch(() => void 0);
171738
- }
171739
- }, [checksOn]);
171740
- const version = update2.restartRequired ? update2.installed : update2.latest;
171741
- const show = update2.phase === "updating" || update2.restartRequired || checksOn && (update2.hasUpdate || update2.phase === "failed");
171742
- if (!show || !version) {
171743
- return null;
171744
- }
171745
- const kind = update2.phase === "updating" ? "updating" : update2.restartRequired ? "restart" : update2.phase === "failed" ? "failed" : "available";
171746
- const label = `v${version.replace(/^v/, "")}`;
171747
- const title = kind === "updating" ? `Updating to ${label}…${update2.progress ? `
171748
- ${update2.progress}` : ""}` : kind === "restart" ? `${label} installed. Click to restart` : kind === "failed" ? `Update to ${label} failed. Click to retry
171749
- ${update2.error ?? ""}`.trimEnd() : `${label} available. Click to install`;
171750
- const tone = kind === "failed" ? "!text-[var(--zg-warn)]" : "!text-[var(--zg-accent)]";
171751
- const onClick = () => {
171752
- if (kind === "updating") {
171753
- return;
171754
- }
171755
- if (kind === "restart") {
171756
- window.api.update.restart().catch((err) => console.error("[zidane-gui] update restart failed", err));
171757
- return;
171758
- }
171759
- window.api.update.install().catch((err) => console.error("[zidane-gui] update install failed", err));
171760
- };
171761
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
171762
- "button",
171763
- {
171764
- type: "button",
171765
- onClick,
171766
- disabled: kind === "updating",
171767
- "aria-busy": kind === "updating",
171768
- title,
171769
- "aria-label": title,
171770
- className: `${FOOTER_TEXT_BUTTON} disabled:cursor-progress ${tone}`,
171771
- children: [
171772
- kind === "updating" ? /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSpinner, { size: "xs", tone: "accent", label: title }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
171773
- "span",
171774
- {
171775
- "aria-hidden": true,
171776
- className: `text-sm ${kind === "restart" ? "i-ph-arrows-clockwise" : "i-ph-arrow-circle-up-fill"}`
171777
- }
171778
- ),
171779
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta !text-current", children: label })
171780
- ]
171781
- }
171782
- );
171783
- }
171784
171964
  function UsageIndicator() {
171785
171965
  const { sessions: sessions2, activeSessionId } = useSessionsList();
171786
171966
  const { settings } = useSettings();
@@ -186603,7 +186783,13 @@ const AGENT = {
186603
186783
  },
186604
186784
  {
186605
186785
  title: "Agent tools",
186606
- rows: [{ key: "terminalAgent" }, { key: "terminalAgentTasks" }, { key: "browserAgent" }, { key: "codemode" }]
186786
+ rows: [
186787
+ { key: "terminalAgent" },
186788
+ { key: "terminalAgentTasks" },
186789
+ { key: "browserAgent" },
186790
+ { key: "webSearch" },
186791
+ { key: "codemode" }
186792
+ ]
186607
186793
  }
186608
186794
  ]
186609
186795
  };
@@ -187648,16 +187834,39 @@ function AppVersion() {
187648
187834
  if (!version) {
187649
187835
  return null;
187650
187836
  }
187837
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex items-center gap-1 shrink-0", children: [
187838
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
187839
+ MenuRow$1,
187840
+ {
187841
+ size: "sm",
187842
+ onClick: () => {
187843
+ void navigator.clipboard.writeText(version).then(() => setCopied(true));
187844
+ },
187845
+ hint: "Copy version",
187846
+ title: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta", children: copied ? "copied" : `Zidane ${version}` }),
187847
+ className: "flex-1 min-w-0 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--zg-ring)]"
187848
+ }
187849
+ ),
187850
+ /* @__PURE__ */ jsxRuntimeExports.jsx(UpgradeButton, {})
187851
+ ] });
187852
+ }
187853
+ function UpgradeButton() {
187854
+ const update2 = useAppUpdate();
187855
+ if (!update2) {
187856
+ return null;
187857
+ }
187858
+ const updating = update2.kind === "updating";
187859
+ const tone = update2.kind === "failed" ? "!text-[var(--zg-warn)]" : "!text-[var(--zg-accent)]";
187651
187860
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
187652
- MenuRow$1,
187861
+ IconButton,
187653
187862
  {
187654
187863
  size: "sm",
187655
- onClick: () => {
187656
- void navigator.clipboard.writeText(version).then(() => setCopied(true));
187657
- },
187658
- hint: "Copy version",
187659
- title: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta", children: copied ? "copied" : `Zidane ${version}` }),
187660
- className: "mt-2 shrink-0 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--zg-ring)]"
187864
+ icon: updating ? /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSpinner, { size: "xs", tone: "accent", label: update2.title }) : update2.kind === "restart" ? "i-ph-arrows-clockwise" : "i-ph-arrow-circle-up-fill",
187865
+ label: update2.title,
187866
+ onClick: update2.run,
187867
+ disabled: updating,
187868
+ "aria-busy": updating,
187869
+ className: `${tone} disabled:!opacity-100 disabled:cursor-progress`
187661
187870
  }
187662
187871
  );
187663
187872
  }