zidane-gui 8.2.3 → 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,
@@ -27937,6 +27943,12 @@ const SETTINGS_TOGGLES$1 = [
27937
27943
  label: "Image generation",
27938
27944
  description: "Let the agent generate images with your providers' image models. Each image is billed by the provider."
27939
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
+ },
27940
27952
  {
27941
27953
  category: "agent",
27942
27954
  key: "decisions",
@@ -28028,7 +28040,7 @@ const SETTINGS_TOGGLES$1 = [
28028
28040
  category: "ui",
28029
28041
  key: "showRunReceipt",
28030
28042
  label: "Run receipt",
28031
- description: "Show model, time, cost and tokens after each run."
28043
+ description: "Show agent, model, time, cost and tokens after each run."
28032
28044
  },
28033
28045
  {
28034
28046
  category: "ui",
@@ -30549,6 +30561,14 @@ const ONBOARDING_FEATURES = [
30549
30561
  unlocks: "Many tool calls in one step. Long tasks take fewer turns, so runs finish faster and cost less.",
30550
30562
  prevents: "A context full of small tool results. Only what the script prints goes back to the model."
30551
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
+ },
30552
30572
  {
30553
30573
  key: "inlineAutocomplete",
30554
30574
  group: "work",
@@ -35700,6 +35720,11 @@ const SETTINGS_TOGGLES = withCanonicalGates([
35700
35720
  label: "Image generation",
35701
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."
35702
35722
  },
35723
+ {
35724
+ key: "webSearch",
35725
+ label: "Web search",
35726
+ description: "Let the agent search the web for docs, errors and recent changes."
35727
+ },
35703
35728
  {
35704
35729
  key: "sandbox",
35705
35730
  label: "Sandbox shell commands",
@@ -35733,7 +35758,7 @@ const SETTINGS_TOGGLES = withCanonicalGates([
35733
35758
  {
35734
35759
  key: "showRunReceipt",
35735
35760
  label: "Run receipt",
35736
- description: "Show model, time, cost and tokens after each run."
35761
+ description: "Show agent, model, time, cost and tokens after each run."
35737
35762
  },
35738
35763
  {
35739
35764
  key: "showCacheNotices",
@@ -37997,6 +38022,8 @@ const DEFAULT_CHAT_LABELS = {
37997
38022
  runRetrying: (attempt, max2, source) => runRetryingLabel({ attempt, max: max2, source }),
37998
38023
  // Run receipt
37999
38024
  runReceipt: "Run receipt",
38025
+ receiptAgent: "Agent that ran this turn",
38026
+ receiptAgentSwitched: "Agent that ran this turn, switched from the previous run",
38000
38027
  receiptModel: "Model that ran this turn",
38001
38028
  receiptModelOthers: (others) => `Model that wrote the last reply. ${others} other model${others === 1 ? "" : "s"} ran earlier turns.`,
38002
38029
  receiptDuration: "Run time, tools included",
@@ -45554,7 +45581,7 @@ function loadSymbolsFont(url) {
45554
45581
  return symbolsFont;
45555
45582
  }
45556
45583
  function loadGhostty$1(symbolsFontUrl2) {
45557
- ghosttyModule ??= Promise.all([__vitePreload(() => import("./ghostty-web-DeA_Bbgl.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]) => {
45558
45585
  await m2.init();
45559
45586
  drawBoxGlyphs(m2);
45560
45587
  return m2;
@@ -64147,8 +64174,14 @@ function savedPaths(text2) {
64147
64174
  return m2 ? [m2[1]] : [];
64148
64175
  });
64149
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
+ }
64150
64183
  function drawsImageGeneration(tool) {
64151
- return tool.name === "generate_image" && tool.rawInput?.list !== true;
64184
+ return imageRequestsOf(tool).length > 0;
64152
64185
  }
64153
64186
  function ImageFrame({
64154
64187
  src,
@@ -64205,14 +64238,17 @@ function ImageGenerationBlock({
64205
64238
  const lightbox = useLightbox();
64206
64239
  const media = useToolMedia(tool, tool.result);
64207
64240
  const [failed, setFailed] = reactExports.useState(() => /* @__PURE__ */ new Set());
64208
- const input = tool.rawInput ?? {};
64209
- const ratio = cssRatio(input.aspect_ratio);
64210
- 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;
64211
64247
  const running2 = tool.ok === null;
64212
64248
  if (running2) {
64213
- const count2 = requestedCount(input.n);
64249
+ const count2 = ratios.length;
64214
64250
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex flex-col gap-1.5", "data-testid": "image-generation", "aria-busy": "true", children: [
64215
- /* @__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)) }),
64216
64252
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta zg-shimmer self-start", role: "status", children: count2 > 1 ? labels.generatingImages(count2, model) : labels.generatingImage(model) })
64217
64253
  ] });
64218
64254
  }
@@ -64230,7 +64266,7 @@ function ImageGenerationBlock({
64230
64266
  ImageFrame,
64231
64267
  {
64232
64268
  src: media.url(m2.index),
64233
- ratio,
64269
+ ratio: ratios[i2] ?? ratios[0] ?? "1 / 1",
64234
64270
  pending: false,
64235
64271
  label: labels.viewAttachment(paths[i2] ?? labels.generatedImage),
64236
64272
  onOpen: (el) => lightbox.open(gallery, i2, el),
@@ -64433,7 +64469,7 @@ const ToolRow = reactExports.memo(({ tool, mode, showResult, showDiff, lineState
64433
64469
  !bodyMounted ? null : media ? (
64434
64470
  // An image the call read, or a screenshot it took: the media itself, then any text around it.
64435
64471
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex flex-col gap-1.5", children: [
64436
- !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 }),
64437
64473
  tool.name !== "read_file" && media.rest !== "" && /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: CODE_PANEL, children: media.rest })
64438
64474
  ] })
64439
64475
  ) : tool.name === "read_file" ? (
@@ -65496,6 +65532,7 @@ const TextRow$1 = reactExports.memo(({ text: text2, streaming }) => {
65496
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 }) });
65497
65533
  });
65498
65534
  const RUN_RECEIPT_TINT = {
65535
+ agent: "text-zg-text/80",
65499
65536
  model: "zg-soft-tint zg-tint-model",
65500
65537
  turns: "zg-soft-tint zg-tint-accent",
65501
65538
  cost: "zg-soft-tint zg-tint-money",
@@ -65509,6 +65546,7 @@ const RUN_RECEIPT_SEGMENT_TINT = {
65509
65546
  };
65510
65547
  const RECEIPT_GLYPH_ICON = {
65511
65548
  [RUN_RECEIPT_TURN_GLYPH]: "i-ph-arrow-clockwise-bold",
65549
+ [RUN_RECEIPT_SWITCH_GLYPH]: "i-ph-arrows-left-right-bold",
65512
65550
  "↑": "i-ph-arrow-up-bold",
65513
65551
  "↓": "i-ph-arrow-down-bold"
65514
65552
  };
@@ -65531,6 +65569,8 @@ function ReceiptValue({ text: text2, className }) {
65531
65569
  }
65532
65570
  function receiptTooltip(cell2, receipt, labels) {
65533
65571
  switch (cell2.kind) {
65572
+ case "agent":
65573
+ return receipt.agentSwitched ? labels.receiptAgentSwitched : labels.receiptAgent;
65534
65574
  case "model":
65535
65575
  return receipt.otherModels ? labels.receiptModelOthers(receipt.otherModels) : labels.receiptModel;
65536
65576
  case "duration":
@@ -79098,6 +79138,11 @@ function splitText(text2, providers2) {
79098
79138
  if (cursor < text2.length) nodes.push({ type: "text", value: text2.slice(cursor) });
79099
79139
  return nodes;
79100
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
+ }
79101
79146
  function visit(node2, providers2) {
79102
79147
  if (!node2.children) return;
79103
79148
  const next = [];
@@ -79106,9 +79151,20 @@ function visit(node2, providers2) {
79106
79151
  next.push(...splitText(child.value, providers2));
79107
79152
  continue;
79108
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
+ }
79109
79165
  if (child.type === "link" && typeof child.url === "string" && !child.url.startsWith("zg-ref:")) {
79110
- const [whole] = findReferences(child.url, providers2, "assistant");
79111
- if (whole && whole.start === 0 && whole.end === child.url.length) {
79166
+ const whole = wholeReference(child.url, providers2);
79167
+ if (whole) {
79112
79168
  next.push({
79113
79169
  ...child,
79114
79170
  url: referenceUrl(whole.providerId, whole.key, child.url, whole.placeholder, whole.placeholderIcon?.gui)
@@ -79165,7 +79221,7 @@ function ProseReference({ parsed, children }) {
79165
79221
  ...parsed.placeholder ? { placeholder: parsed.placeholder } : {},
79166
79222
  ...parsed.placeholderIcon ? { placeholderIcon: { gui: parsed.placeholderIcon } } : {},
79167
79223
  className: "zg-file-chip zg-badge",
79168
- 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
79169
79225
  }
79170
79226
  );
79171
79227
  }
@@ -81803,6 +81859,12 @@ const DEFAULT_ONBOARDING_LABELS = {
81803
81859
  demoScript: ["const files = await glob('src/**/*.ts')", "for (const file of files) await read(file)"],
81804
81860
  demoCalls: "12 calls",
81805
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
+ ],
81806
81868
  demoTyped: "Open src/comp",
81807
81869
  demoGhost: "onents/Button.tsx",
81808
81870
  demoTab: "Tab",
@@ -84570,6 +84632,24 @@ function CodemodeDemo({ on }) {
84570
84632
  ] })
84571
84633
  ] });
84572
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
+ }
84573
84653
  function Composer$1({ children }) {
84574
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 });
84575
84655
  }
@@ -84774,6 +84854,7 @@ function ProjectExtensionsDemo({ on }) {
84774
84854
  }
84775
84855
  const DEMOS = {
84776
84856
  codemode: CodemodeDemo,
84857
+ webSearch: WebSearchDemo,
84777
84858
  inlineAutocomplete: AutocompleteDemo,
84778
84859
  autoTitle: AutoTitleDemo,
84779
84860
  spaces: SpacesDemo,
@@ -106549,6 +106630,214 @@ function prMatches(pr, query) {
106549
106630
  const bare = q2.replace(/^#/, "");
106550
106631
  return bare !== "" && String(pr.number).startsWith(bare) || pr.title.toLowerCase().includes(q2) || pr.branch.toLowerCase().includes(q2) || pr.author.toLowerCase().includes(q2);
106551
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
+ }
106552
106841
  const SECTIONS = [
106553
106842
  { id: "review", label: "Waiting on you", cap: 5 },
106554
106843
  { id: "mine", label: "Yours", cap: 5 },
@@ -106596,6 +106885,19 @@ function BranchMenu({
106596
106885
  const inputRef = reactExports.useRef(null);
106597
106886
  const listRef = reactExports.useRef(null);
106598
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;
106599
106901
  reactExports.useLayoutEffect(() => {
106600
106902
  if (open && listRef.current) listRef.current.scrollTop = 0;
106601
106903
  }, [open]);
@@ -106609,6 +106911,7 @@ function BranchMenu({
106609
106911
  setActive2(0);
106610
106912
  setError(null);
106611
106913
  setPendingEnter(false);
106914
+ setWorktreeBranch(null);
106612
106915
  setBranches(branchCache.get(cwd2) ?? null);
106613
106916
  setPrs(prCache$1.has(cwd2) ? prCache$1.get(cwd2) : void 0);
106614
106917
  let live = true;
@@ -106639,6 +106942,11 @@ function BranchMenu({
106639
106942
  if (e2.key !== "Escape") return;
106640
106943
  e2.preventDefault();
106641
106944
  e2.stopPropagation();
106945
+ if (worktreeOpen.current) {
106946
+ setWorktreeBranch(null);
106947
+ inputRef.current?.focus();
106948
+ return;
106949
+ }
106642
106950
  onCloseRef.current();
106643
106951
  };
106644
106952
  document.addEventListener("pointerdown", onPointer, true);
@@ -106706,6 +107014,20 @@ function BranchMenu({
106706
107014
  if (result.ok) onSwitched();
106707
107015
  else setError(result.error);
106708
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
+ };
106709
107031
  const pickRef = reactExports.useRef(pick2);
106710
107032
  pickRef.current = pick2;
106711
107033
  const entriesRef = reactExports.useRef(entries2);
@@ -106840,7 +107162,59 @@ function BranchMenu({
106840
107162
  branches === null ? /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { children: "Loading branches…" }) : entries2.length === 0 && !searching && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { children: "No matches" })
106841
107163
  ]
106842
107164
  }
106843
- )
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
+ ) })
106844
107218
  ]
106845
107219
  }
106846
107220
  );
@@ -132031,214 +132405,6 @@ function ComposerNotice({ text: text2, onDismiss, testId }) {
132031
132405
  }
132032
132406
  );
132033
132407
  }
132034
- const KIND_LABELS = {
132035
- local: "Local",
132036
- worktree: "Worktree",
132037
- docker: "Docker",
132038
- e2b: "E2B",
132039
- daytona: "Daytona"
132040
- };
132041
- const KIND_ICONS = {
132042
- local: "i-ph-laptop",
132043
- worktree: "i-ph-git-branch",
132044
- docker: "i-ph-cube",
132045
- e2b: "i-ph-cloud",
132046
- daytona: "i-ph-cloud"
132047
- };
132048
- const REMOTE_KINDS = /* @__PURE__ */ new Set(["e2b", "daytona"]);
132049
- function runsInRemoteSandbox(environment) {
132050
- return environment !== void 0 && REMOTE_KINDS.has(environment.kind);
132051
- }
132052
- function deleteSessionPrompt(title, environment) {
132053
- const base2 = `Delete "${title}"?`;
132054
- if (environment && runsInRemoteSandbox(environment)) {
132055
- return `${base2}
132056
-
132057
- Its ${environmentKindLabel(environment.kind)} sandbox is deleted too. Push anything you want to keep first.`;
132058
- }
132059
- return base2;
132060
- }
132061
- function environmentKindLabel(kind) {
132062
- const machine = parseMachineKind(kind);
132063
- if (machine) return `${KIND_LABELS[machine.base]} @ ${machine.name}`;
132064
- return KIND_LABELS[kind] ?? kind;
132065
- }
132066
- function environmentKindIcon(kind) {
132067
- return KIND_ICONS[parseMachineKind(kind)?.base ?? kind] ?? "i-ph-cube";
132068
- }
132069
- function environmentSummaryText(environment) {
132070
- const label = environmentKindLabel(environment.kind);
132071
- const where = environment.branch ? `${label} (${environment.branch})` : label;
132072
- if (environment.state === "provisioning") {
132073
- return `${where}. Setting up…`;
132074
- }
132075
- if (environment.state === "failed") {
132076
- return `${where}. Setup failed${environment.error ? `: ${environment.error}` : "."}`;
132077
- }
132078
- if (environment.suspended) {
132079
- return `${where}. Paused while idle, resumes on your next prompt.`;
132080
- }
132081
- return where;
132082
- }
132083
- function EnvironmentChip({ environment }) {
132084
- if (!environment) {
132085
- return null;
132086
- }
132087
- 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" : ""}`;
132088
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
132089
- "span",
132090
- {
132091
- "data-testid": "row-badge-environment",
132092
- title: environmentSummaryText(environment),
132093
- className: "zg-row-badge zg-meta inline-flex items-center gap-1 h-[18px] px-1.5 rounded-[var(--zg-radius-sm)] whitespace-nowrap",
132094
- children: [
132095
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${icon} text-[11px]` }),
132096
- environment.branch || environmentKindLabel(environment.kind)
132097
- ]
132098
- }
132099
- );
132100
- }
132101
- function useEnvironmentChoices(cwd2, hostId) {
132102
- const listed = useIpcResource(cwd2 === null ? null : environmentsResource(cwd2, hostId)).data;
132103
- return reactExports.useMemo(() => listed ? withMachines(listed) : NO_DESCRIPTORS, [listed]);
132104
- }
132105
- const NO_DESCRIPTORS = [];
132106
- function withMachines(descriptors) {
132107
- return orderByMachine(descriptors).map((descriptor) => {
132108
- const blocked = machineBlockedReason(descriptor);
132109
- return blocked && descriptor.available ? { ...descriptor, available: false, reason: blocked } : descriptor;
132110
- });
132111
- }
132112
- const usable = (descriptor) => descriptor.enabled && descriptor.available;
132113
- function resolveDraftDescriptor(descriptors, draft2) {
132114
- const picked = draft2 ? descriptors.find((d2) => d2.kind === draft2.kind && usable(d2)) : void 0;
132115
- return picked ?? descriptors.find((d2) => d2.isDefault && usable(d2)) ?? descriptors.find((d2) => d2.kind === "local");
132116
- }
132117
- function resolveDraftEnvironment(descriptors, draft2) {
132118
- const descriptor = resolveDraftDescriptor(descriptors, draft2);
132119
- if (!descriptor || descriptor.kind === "local") {
132120
- return void 0;
132121
- }
132122
- const typed = draft2?.kind === descriptor.kind ? draft2.branch.trim() : "";
132123
- const branch = descriptor.takesBranch ? typed || descriptor.suggestedBranch : void 0;
132124
- return { kind: descriptor.kind, ...branch ? { branch } : {} };
132125
- }
132126
- function EnvironmentPicker({
132127
- descriptors,
132128
- draft: draft2,
132129
- onChange,
132130
- onOpenSettings
132131
- }) {
132132
- const branchRef = reactExports.useRef(null);
132133
- const offered = descriptors.filter((d2) => d2.enabled);
132134
- const selected = resolveDraftDescriptor(descriptors, draft2);
132135
- if (offered.length <= 1 || !selected) {
132136
- return null;
132137
- }
132138
- const typedBranch = draft2?.kind === selected.kind ? draft2.branch : "";
132139
- const branchLabel = selected.takesBranch ? typedBranch.trim() || selected.suggestedBranch : void 0;
132140
- const icon = environmentKindIcon(selected.kind);
132141
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
132142
- Popover,
132143
- {
132144
- role: "menu",
132145
- ariaLabel: "Choose where the session runs",
132146
- align: "end",
132147
- width: 300,
132148
- trigger: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-segment shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
132149
- "button",
132150
- {
132151
- ...props,
132152
- type: "button",
132153
- title: `Runs in: ${selected.label}${branchLabel ? ` (${branchLabel})` : ""}`,
132154
- 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",
132155
- children: [
132156
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${icon} text-[11px] shrink-0` }),
132157
- 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 }),
132158
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "zg-pill-label i-ph-caret-up-down text-[10px] shrink-0 opacity-70" })
132159
- ]
132160
- }
132161
- ) }),
132162
- children: (close2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Menu$1, { role: "group", children: [
132163
- /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSection, { label: "Runs in", children: offered.map((descriptor) => {
132164
- const active2 = descriptor.kind === selected.kind;
132165
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
132166
- MenuRow$1,
132167
- {
132168
- size: "lg",
132169
- role: "menuitemradio",
132170
- checked: active2,
132171
- disabled: !descriptor.available,
132172
- hint: descriptor.available ? void 0 : descriptor.reason,
132173
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: environmentKindIcon(descriptor.kind) }),
132174
- title: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
132175
- descriptor.label,
132176
- descriptor.machine && /* @__PURE__ */ jsxRuntimeExports.jsx(
132177
- MetaChip,
132178
- {
132179
- tone: descriptor.machine.status === "online" ? "success" : "muted",
132180
- className: "font-normal ml-1.5",
132181
- children: descriptor.machine.status
132182
- }
132183
- ),
132184
- descriptor.isDefault && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta font-normal ml-1.5", children: "default" })
132185
- ] }),
132186
- description: descriptor.available ? descriptor.description : descriptor.reason,
132187
- onClick: () => {
132188
- onChange({ kind: descriptor.kind, branch: active2 ? typedBranch : "" });
132189
- if (descriptor.takesBranch) {
132190
- requestAnimationFrame(() => branchRef.current?.focus());
132191
- } else {
132192
- close2();
132193
- }
132194
- }
132195
- },
132196
- descriptor.kind
132197
- );
132198
- }) }),
132199
- selected.takesBranch && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
132200
- /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSeparator$1, {}),
132201
- /* @__PURE__ */ jsxRuntimeExports.jsxs(MenuSection, { label: "Branch", children: [
132202
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-2 pb-1.5", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
132203
- "input",
132204
- {
132205
- ref: branchRef,
132206
- type: "text",
132207
- value: typedBranch,
132208
- onChange: (event) => onChange({ kind: selected.kind, branch: event.target.value }),
132209
- onKeyDown: (event) => {
132210
- if (event.key === "Enter") {
132211
- event.preventDefault();
132212
- close2();
132213
- }
132214
- },
132215
- placeholder: selected.suggestedBranch ?? "Branch name",
132216
- "aria-label": "Branch",
132217
- spellCheck: false,
132218
- className: "zg-well w-full h-7 px-2 text-xs font-mono placeholder:text-[var(--zg-text-subtle)]"
132219
- }
132220
- ) }),
132221
- /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { className: "!pt-0", children: "Empty uses the suggested name." })
132222
- ] })
132223
- ] }),
132224
- selected.note && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { icon: "i-ph-info", children: selected.note }),
132225
- /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSeparator$1, {}),
132226
- /* @__PURE__ */ jsxRuntimeExports.jsx(
132227
- MenuRow$1,
132228
- {
132229
- role: "menuitem",
132230
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-ph-gear-six" }),
132231
- title: "Environment settings…",
132232
- onClick: () => {
132233
- close2();
132234
- onOpenSettings();
132235
- }
132236
- }
132237
- )
132238
- ] })
132239
- }
132240
- );
132241
- }
132242
132408
  const online = /* @__PURE__ */ new Set();
132243
132409
  let snapshot = /* @__PURE__ */ new Set();
132244
132410
  const listeners$9 = /* @__PURE__ */ new Set();
@@ -171036,6 +171202,85 @@ function IconPicker({
171036
171202
  /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ref: fileRef, type: "file", accept: "image/*", className: "hidden", onChange: (e2) => void onFileChange(e2) })
171037
171203
  ] });
171038
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
+ }
171039
171284
  function orbState(health2, running2, attention2) {
171040
171285
  if (health2 === "disconnected") return "down";
171041
171286
  if (health2 === "connecting") return "connecting";
@@ -171561,50 +171806,6 @@ function useProviderUsage() {
171561
171806
  }
171562
171807
  return ctx2;
171563
171808
  }
171564
- const INITIAL = {
171565
- running: "",
171566
- latest: null,
171567
- hasUpdate: false,
171568
- installed: null,
171569
- restartRequired: false,
171570
- phase: "idle",
171571
- progress: null,
171572
- error: null,
171573
- checkedAt: null
171574
- };
171575
- let state = INITIAL;
171576
- let wired = false;
171577
- const listeners$4 = /* @__PURE__ */ new Set();
171578
- function set(next) {
171579
- if (!next) {
171580
- return;
171581
- }
171582
- state = next;
171583
- for (const listener of listeners$4) {
171584
- listener();
171585
- }
171586
- }
171587
- function wire() {
171588
- if (wired) {
171589
- return;
171590
- }
171591
- wired = true;
171592
- window.api.update.onChanged(set);
171593
- void window.api.update.state().then(set, () => void 0);
171594
- }
171595
- function subscribe$4(listener) {
171596
- wire();
171597
- listeners$4.add(listener);
171598
- return () => {
171599
- listeners$4.delete(listener);
171600
- };
171601
- }
171602
- function getSnapshot() {
171603
- return state;
171604
- }
171605
- function useUpdateState() {
171606
- return reactExports.useSyncExternalStore(subscribe$4, getSnapshot, getSnapshot);
171607
- }
171608
171809
  const FRAME_INTERVAL_MS = 50;
171609
171810
  const ELLIPSIS_FRAMES = 8;
171610
171811
  const CHARSET = "0123456789abcdefABCDEF~!@#$£€%^&*()+=_";
@@ -171712,6 +171913,8 @@ function ReducedMotionFallback({
171712
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)]";
171713
171914
  function Footer({ compacting, hasAuth, onOpenAuth, onOpenSettings, compactionProgress, spaces }) {
171714
171915
  const { settings } = useSettings();
171916
+ useUpdateChecks();
171917
+ const update2 = useAppUpdate();
171715
171918
  return (
171716
171919
  /*
171717
171920
  * Height invariant: 28px content (h-7 buttons) + 5px top + 4px bottom
@@ -171733,69 +171936,31 @@ function Footer({ compacting, hasAuth, onOpenAuth, onOpenSettings, compactionPro
171733
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: [
171734
171937
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
171735
171938
  settings.useDaemon && /* @__PURE__ */ jsxRuntimeExports.jsx(DaemonMenu, {}),
171736
- /* @__PURE__ */ jsxRuntimeExports.jsx(UpdateButton, {}),
171737
171939
  hasAuth === false && /* @__PURE__ */ jsxRuntimeExports.jsx(SignInPrompt, { onClick: onOpenAuth }),
171738
171940
  settings.showUsageIndicator !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(UsageIndicator, {}),
171739
171941
  /* @__PURE__ */ jsxRuntimeExports.jsx(Presence$1, { show: compacting && settings.showThrobber, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CompactingIndicator, { progress: compactionProgress }) })
171740
171942
  ] }),
171741
171943
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center min-w-0", children: spaces }),
171742
- /* @__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
+ ) })
171743
171961
  ] })
171744
171962
  );
171745
171963
  }
171746
- function UpdateButton() {
171747
- const update2 = useUpdateState();
171748
- const { settings } = useSettings();
171749
- const checksOn = settings.checkForUpdates !== false;
171750
- reactExports.useEffect(() => {
171751
- if (checksOn) {
171752
- window.api.update.check().catch(() => void 0);
171753
- }
171754
- }, [checksOn]);
171755
- const version = update2.restartRequired ? update2.installed : update2.latest;
171756
- const show = update2.phase === "updating" || update2.restartRequired || checksOn && (update2.hasUpdate || update2.phase === "failed");
171757
- if (!show || !version) {
171758
- return null;
171759
- }
171760
- const kind = update2.phase === "updating" ? "updating" : update2.restartRequired ? "restart" : update2.phase === "failed" ? "failed" : "available";
171761
- const label = `v${version.replace(/^v/, "")}`;
171762
- const title = kind === "updating" ? `Updating to ${label}…${update2.progress ? `
171763
- ${update2.progress}` : ""}` : kind === "restart" ? `${label} installed. Click to restart` : kind === "failed" ? `Update to ${label} failed. Click to retry
171764
- ${update2.error ?? ""}`.trimEnd() : `${label} available. Click to install`;
171765
- const tone = kind === "failed" ? "!text-[var(--zg-warn)]" : "!text-[var(--zg-accent)]";
171766
- const onClick = () => {
171767
- if (kind === "updating") {
171768
- return;
171769
- }
171770
- if (kind === "restart") {
171771
- window.api.update.restart().catch((err) => console.error("[zidane-gui] update restart failed", err));
171772
- return;
171773
- }
171774
- window.api.update.install().catch((err) => console.error("[zidane-gui] update install failed", err));
171775
- };
171776
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
171777
- "button",
171778
- {
171779
- type: "button",
171780
- onClick,
171781
- disabled: kind === "updating",
171782
- "aria-busy": kind === "updating",
171783
- title,
171784
- "aria-label": title,
171785
- className: `${FOOTER_TEXT_BUTTON} disabled:cursor-progress ${tone}`,
171786
- children: [
171787
- kind === "updating" ? /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSpinner, { size: "xs", tone: "accent", label: title }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
171788
- "span",
171789
- {
171790
- "aria-hidden": true,
171791
- className: `text-sm ${kind === "restart" ? "i-ph-arrows-clockwise" : "i-ph-arrow-circle-up-fill"}`
171792
- }
171793
- ),
171794
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta !text-current", children: label })
171795
- ]
171796
- }
171797
- );
171798
- }
171799
171964
  function UsageIndicator() {
171800
171965
  const { sessions: sessions2, activeSessionId } = useSessionsList();
171801
171966
  const { settings } = useSettings();
@@ -186618,7 +186783,13 @@ const AGENT = {
186618
186783
  },
186619
186784
  {
186620
186785
  title: "Agent tools",
186621
- 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
+ ]
186622
186793
  }
186623
186794
  ]
186624
186795
  };
@@ -187663,16 +187834,39 @@ function AppVersion() {
187663
187834
  if (!version) {
187664
187835
  return null;
187665
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)]";
187666
187860
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
187667
- MenuRow$1,
187861
+ IconButton,
187668
187862
  {
187669
187863
  size: "sm",
187670
- onClick: () => {
187671
- void navigator.clipboard.writeText(version).then(() => setCopied(true));
187672
- },
187673
- hint: "Copy version",
187674
- title: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta", children: copied ? "copied" : `Zidane ${version}` }),
187675
- 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`
187676
187870
  }
187677
187871
  );
187678
187872
  }