zidane-gui 8.2.1 → 8.2.3

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.
@@ -14380,7 +14380,7 @@ const SECONDARY$1 = "zg-raised border text-[var(--zg-text-muted)] hover:text-[va
14380
14380
  const PRIMARY$1 = "font-medium border-0 bg-transparent before:bg-[var(--zg-accent-soft)] text-[var(--zg-accent-hover)] hover:before:bg-[var(--zg-accent-soft-strong)]";
14381
14381
  const SOLID = "zg-fill font-medium border-0";
14382
14382
  const DANGER = "border-0 bg-transparent text-zg-danger hover:before:bg-zg-danger/10";
14383
- const DANGER_CONFIRM = "font-medium border-0 bg-transparent before:bg-zg-danger/15 text-zg-danger hover:before:bg-zg-danger/25";
14383
+ const DANGER_SOLID = "zg-fill zg-fill-danger font-medium border-0";
14384
14384
  const GHOST = "border-0 bg-transparent text-[var(--zg-text-muted)] hover:before:bg-[var(--zg-row-hover)] hover:text-[var(--zg-text)]";
14385
14385
  const VARIANTS = {
14386
14386
  secondary: SECONDARY$1,
@@ -14388,7 +14388,7 @@ const VARIANTS = {
14388
14388
  solid: SOLID,
14389
14389
  ghost: GHOST,
14390
14390
  danger: DANGER,
14391
- "danger-strong": DANGER_CONFIRM
14391
+ "danger-solid": DANGER_SOLID
14392
14392
  };
14393
14393
  function buttonClass({
14394
14394
  variant = "secondary",
@@ -14400,11 +14400,11 @@ function buttonClass({
14400
14400
  const BTN_SECONDARY = `${BTN_BASE} ${SIZE_ROW} ${SECONDARY$1}`;
14401
14401
  const BTN_PRIMARY$1 = `${BTN_BASE} ${SIZE_ROW} ${PRIMARY$1}`;
14402
14402
  const BTN_DANGER$1 = `${BTN_BASE} ${SIZE_ROW} ${DANGER}`;
14403
- const BTN_DANGER_CONFIRM = `${BTN_BASE} ${SIZE_ROW} ${DANGER_CONFIRM}`;
14403
+ const BTN_DANGER_CONFIRM = `${BTN_BASE} ${SIZE_ROW} ${DANGER_SOLID}`;
14404
14404
  const BTN_LG_SECONDARY = `${BTN_BASE} ${SIZE_LG} ${SECONDARY$1}`;
14405
14405
  const BTN_LG_PRIMARY = `${BTN_BASE} ${SIZE_LG} ${PRIMARY$1}`;
14406
14406
  const BTN_LG_SOLID = `${BTN_BASE} ${SIZE_LG} ${SOLID}`;
14407
- const BTN_LG_DANGER = `${BTN_BASE} ${SIZE_LG} ${DANGER_CONFIRM}`;
14407
+ const BTN_LG_DANGER = `${BTN_BASE} ${SIZE_LG} ${DANGER_SOLID}`;
14408
14408
  const CONFIRM_TITLE_ID = "zg-confirm-title";
14409
14409
  function ConfirmDialog({
14410
14410
  title,
@@ -14450,7 +14450,7 @@ function ConfirmDialog({
14450
14450
  ref: confirmRef,
14451
14451
  type: "button",
14452
14452
  onClick: onConfirm,
14453
- className: buttonClass({ variant: destructive ? "danger-strong" : "solid" }),
14453
+ className: buttonClass({ variant: destructive ? "danger-solid" : "solid" }),
14454
14454
  children: confirmLabel ?? labels.confirm
14455
14455
  }
14456
14456
  )
@@ -25025,10 +25025,14 @@ function ErrorFallback({
25025
25025
  function ErrorDetails({ error, componentStack }) {
25026
25026
  error instanceof Error ? error.stack : void 0;
25027
25027
  const stack = "";
25028
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 min-w-0", children: [
25029
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "m-0 break-words select-text", children: errorMessage$1(error) }),
25030
- stack
25031
- ] });
25028
+ return (
25029
+ // `overflow-wrap: anywhere`, not `break-words`: it also lowers the min-content width, which is what
25030
+ // sizes this block inside EmptyState's centred column; long stack URLs would otherwise overflow a narrow region.
25031
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 w-full min-w-0 [overflow-wrap:anywhere]", children: [
25032
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "m-0 select-text", children: errorMessage$1(error) }),
25033
+ stack
25034
+ ] })
25035
+ );
25032
25036
  }
25033
25037
  const MODAL_TITLE_ID = "zg-modal-title";
25034
25038
  const ModalContext = reactExports.createContext(null);
@@ -26440,6 +26444,8 @@ const DEFAULT_SETTINGS = {
26440
26444
  importRulerConfigs: true,
26441
26445
  hideSubagentOutput: true,
26442
26446
  subagentModels: true,
26447
+ imageGeneration: true,
26448
+ imageModel: "",
26443
26449
  maxParallelSubagents: 3,
26444
26450
  queueMessages: true,
26445
26451
  theme: "default",
@@ -27659,7 +27665,12 @@ const SETTINGS_KEYWORDS = {
27659
27665
  "gutter",
27660
27666
  "timeline"
27661
27667
  ],
27662
- showCacheNotices: ["prompt cache", "cache hit"],
27668
+ showCacheNotices: [
27669
+ "prompt cache",
27670
+ "cache hit",
27671
+ "reasoning dropped",
27672
+ "thinking dropped"
27673
+ ],
27663
27674
  showThinking: ["reasoning", "thoughts"],
27664
27675
  thinkingAutoExpand: [
27665
27676
  "reasoning",
@@ -27920,6 +27931,12 @@ const SETTINGS_TOGGLES$1 = [
27920
27931
  label: "Allow subagents to use different models",
27921
27932
  description: "Let the agent hand work to cheaper models."
27922
27933
  },
27934
+ {
27935
+ category: "agent",
27936
+ key: "imageGeneration",
27937
+ label: "Image generation",
27938
+ description: "Let the agent generate images with your providers' image models. Each image is billed by the provider."
27939
+ },
27923
27940
  {
27924
27941
  category: "agent",
27925
27942
  key: "decisions",
@@ -28017,7 +28034,7 @@ const SETTINGS_TOGGLES$1 = [
28017
28034
  category: "ui",
28018
28035
  key: "showCacheNotices",
28019
28036
  label: "Cache notices",
28020
- description: "Add a row to the chat when the prompt cache expires or resets."
28037
+ description: "Add a row to the chat when the prompt cache expires or resets, or the provider drops earlier reasoning."
28021
28038
  },
28022
28039
  {
28023
28040
  category: "ui",
@@ -32277,6 +32294,23 @@ const TOOL_DISPLAY = {
32277
32294
  };
32278
32295
  }
32279
32296
  },
32297
+ generate_image: {
32298
+ displayName: (input) => input?.list === true ? "Image models" : "Generate image",
32299
+ format: (input) => {
32300
+ if (input.list === true) return { target: "list" };
32301
+ const prompt = stringField$1(input, "prompt");
32302
+ if (!prompt) return null;
32303
+ const meta = [
32304
+ stringField$1(input, "model"),
32305
+ stringField$1(input, "aspect_ratio"),
32306
+ typeof input.n === "number" && input.n > 1 ? `${Math.floor(input.n)} images` : void 0
32307
+ ].filter((v2) => typeof v2 === "string" && v2 !== "");
32308
+ return {
32309
+ target: previewLine(prompt, 200),
32310
+ ...meta.length ? { meta } : {}
32311
+ };
32312
+ }
32313
+ },
32280
32314
  codemode: {
32281
32315
  displayName: (input) => {
32282
32316
  return descriptionLabel(input) ?? "Codemode";
@@ -33119,7 +33153,9 @@ function retagUserPromptEventsFromRefs(events, refs) {
33119
33153
  }
33120
33154
  return changed2 ? next : events;
33121
33155
  }
33122
- const CACHE_NOTICE_LABEL = "cache";
33156
+ function isCacheNotice(notice) {
33157
+ return notice?.label === "cache" || notice?.label === "reasoning";
33158
+ }
33123
33159
  function isVisible(event, settings) {
33124
33160
  if (event.parentToolCallId !== void 0 && !event.runsNestedAgent && !settings.codemodeShowCalls) return false;
33125
33161
  if (settings.hideSubagentOutput) {
@@ -33137,7 +33173,7 @@ function isVisible(event, settings) {
33137
33173
  case "run-summary":
33138
33174
  return settings.showRunReceipt;
33139
33175
  case "info":
33140
- return settings.showCacheNotices || event.notice?.label !== "cache";
33176
+ return settings.showCacheNotices || !isCacheNotice(event.notice);
33141
33177
  case "spawn-queued":
33142
33178
  return settings.transcriptDensity === "compact";
33143
33179
  default:
@@ -35659,6 +35695,11 @@ const SETTINGS_TOGGLES = withCanonicalGates([
35659
35695
  label: "Allow subagents to use different models",
35660
35696
  description: "Let the agent hand work to cheaper models."
35661
35697
  },
35698
+ {
35699
+ key: "imageGeneration",
35700
+ label: "Image generation",
35701
+ 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
+ },
35662
35703
  {
35663
35704
  key: "sandbox",
35664
35705
  label: "Sandbox shell commands",
@@ -35697,7 +35738,7 @@ const SETTINGS_TOGGLES = withCanonicalGates([
35697
35738
  {
35698
35739
  key: "showCacheNotices",
35699
35740
  label: "Cache notices",
35700
- description: "Add a row to the chat when the prompt cache expires or resets."
35741
+ description: "Add a row to the chat when the prompt cache expires or resets, or the provider drops earlier reasoning."
35701
35742
  },
35702
35743
  {
35703
35744
  key: "queueMessages",
@@ -37521,7 +37562,7 @@ const PAGES_KEY = "zg:browser:pages:v1";
37521
37562
  const EMULATION_KEY = "zg:browser:emulation:v1";
37522
37563
  const RECENT_KEY = "zg:browser:recent:v1";
37523
37564
  const MAX_REMEMBERED = 50;
37524
- const MAX_RECENT = 8;
37565
+ const MAX_RECENT = 4;
37525
37566
  class BrowserStore {
37526
37567
  pages = /* @__PURE__ */ new Map();
37527
37568
  slots = /* @__PURE__ */ new Map();
@@ -37541,10 +37582,15 @@ class BrowserStore {
37541
37582
  livePages = () => this.pageList;
37542
37583
  page = (sessionId) => sessionId ? this.pages.get(sessionId) ?? null : null;
37543
37584
  slot = (sessionId) => this.slots.get(sessionId) ?? null;
37544
- /** Mount the session's page (if not already), at `url` or where it was last. */
37585
+ /**
37586
+ * Mount the session's page (if not already), at `url` or where it was last.
37587
+ * `cwd` is the session's project: a page opened before the session list
37588
+ * loaded, or a session that moved, takes the project it is in now.
37589
+ */
37545
37590
  open(sessionId, cwd2, url) {
37546
37591
  const existing = this.pages.get(sessionId);
37547
37592
  if (existing) {
37593
+ if (cwd2 && cwd2 !== existing.cwd) this.update(sessionId, { cwd: cwd2 });
37548
37594
  if (url) this.navigate(sessionId, url);
37549
37595
  return;
37550
37596
  }
@@ -37594,7 +37640,9 @@ class BrowserStore {
37594
37640
  this.pages.set(sessionId, next);
37595
37641
  if (patch2.url && patch2.url !== page.url && patch2.url !== "about:blank") {
37596
37642
  remember(sessionId, patch2.url);
37597
- rememberRecent(next.cwd, patch2.url);
37643
+ if (next.cwd) rememberRecent(next.cwd, patch2.url, patch2.title ?? "");
37644
+ } else if (next.cwd && patch2.title && patch2.title !== page.title && next.url) {
37645
+ retitleRecent(next.cwd, next.url, patch2.title);
37598
37646
  }
37599
37647
  if (patch2.colorScheme !== void 0 || patch2.device !== void 0) {
37600
37648
  rememberEmulation(sessionId, { colorScheme: next.colorScheme, device: next.device });
@@ -37612,6 +37660,24 @@ class BrowserStore {
37612
37660
  }
37613
37661
  this.update(sessionId, { initialUrl: url, generation: page.generation + 1 });
37614
37662
  }
37663
+ /** Back to the start page: the page unmounts, and the session opens there next time too. */
37664
+ home(sessionId) {
37665
+ const page = this.pages.get(sessionId);
37666
+ if (!page) return;
37667
+ this.elements.delete(sessionId);
37668
+ forget$2(sessionId);
37669
+ this.update(sessionId, {
37670
+ initialUrl: "",
37671
+ url: "",
37672
+ title: "",
37673
+ loading: false,
37674
+ canGoBack: false,
37675
+ canGoForward: false,
37676
+ error: null,
37677
+ crashed: null,
37678
+ generation: page.generation + 1
37679
+ });
37680
+ }
37615
37681
  /** Remount the page at its current URL (after a crash, or an explicit reload of a dead page). */
37616
37682
  remount(sessionId, crashed = null) {
37617
37683
  const page = this.pages.get(sessionId);
@@ -37653,8 +37719,29 @@ function useLiveBrowserPages() {
37653
37719
  function useBrowserSlot(sessionId) {
37654
37720
  return reactExports.useSyncExternalStore(browserStore.subscribe, () => browserStore.slot(sessionId));
37655
37721
  }
37656
- function recentBrowserUrls(cwd2) {
37657
- return readJson(RECENT_KEY)[cwd2] ?? [];
37722
+ function recentBrowserPages(cwd2) {
37723
+ return readRecent()[cwd2] ?? [];
37724
+ }
37725
+ function removeRecentBrowserPage(cwd2, url) {
37726
+ const all2 = readRecent();
37727
+ const list2 = all2[cwd2];
37728
+ if (!list2?.some((e2) => e2.url === url)) return;
37729
+ all2[cwd2] = list2.filter((e2) => e2.url !== url);
37730
+ writeJson(RECENT_KEY, all2);
37731
+ }
37732
+ function readRecent() {
37733
+ const all2 = readJson(RECENT_KEY);
37734
+ const out = {};
37735
+ for (const [cwd2, list2] of Object.entries(all2)) {
37736
+ if (!Array.isArray(list2)) continue;
37737
+ out[cwd2] = list2.map((e2) => {
37738
+ if (typeof e2 === "string") return { url: e2, title: "", visitedAt: 0 };
37739
+ const entry = e2;
37740
+ if (typeof entry?.url !== "string") return null;
37741
+ return { url: entry.url, title: String(entry.title ?? ""), visitedAt: Number(entry.visitedAt) || 0 };
37742
+ }).filter((e2) => e2 !== null).slice(0, MAX_RECENT);
37743
+ }
37744
+ return out;
37658
37745
  }
37659
37746
  function rememberedUrl(sessionId) {
37660
37747
  return readJson(PAGES_KEY)[sessionId] ?? null;
@@ -37682,9 +37769,26 @@ function remember(sessionId, url) {
37682
37769
  for (const k2 of keys2.slice(0, Math.max(0, keys2.length - MAX_REMEMBERED))) delete all2[k2];
37683
37770
  writeJson(PAGES_KEY, all2);
37684
37771
  }
37685
- function rememberRecent(cwd2, url) {
37686
- const all2 = readJson(RECENT_KEY);
37687
- all2[cwd2] = [url, ...(all2[cwd2] ?? []).filter((u2) => u2 !== url)].slice(0, MAX_RECENT);
37772
+ function forget$2(sessionId) {
37773
+ const all2 = readJson(PAGES_KEY);
37774
+ if (!(sessionId in all2)) return;
37775
+ delete all2[sessionId];
37776
+ writeJson(PAGES_KEY, all2);
37777
+ }
37778
+ function rememberRecent(cwd2, url, title) {
37779
+ const all2 = readRecent();
37780
+ const prev = (all2[cwd2] ?? []).find((e2) => e2.url === url);
37781
+ all2[cwd2] = [
37782
+ { url, title: title || prev?.title || "", visitedAt: Date.now() },
37783
+ ...(all2[cwd2] ?? []).filter((e2) => e2.url !== url)
37784
+ ].slice(0, MAX_RECENT);
37785
+ writeJson(RECENT_KEY, all2);
37786
+ }
37787
+ function retitleRecent(cwd2, url, title) {
37788
+ const all2 = readRecent();
37789
+ const entry = all2[cwd2]?.find((e2) => e2.url === url);
37790
+ if (!entry || entry.title === title) return;
37791
+ entry.title = title;
37688
37792
  writeJson(RECENT_KEY, all2);
37689
37793
  }
37690
37794
  function readJson(key2) {
@@ -37947,6 +38051,11 @@ const DEFAULT_CHAT_LABELS = {
37947
38051
  earlierMessages: (count2) => `${count2} earlier message${count2 === 1 ? "" : "s"}`,
37948
38052
  // Prompt echo
37949
38053
  viewAttachment: (name2) => `View ${name2}`,
38054
+ // Image generation (`generate_image` rows)
38055
+ generatingImage: (model) => model ? `Generating with ${model}…` : "Generating image…",
38056
+ generatingImages: (count2, model) => model ? `Generating ${count2} images with ${model}…` : `Generating ${count2} images…`,
38057
+ generatedImage: "Generated image",
38058
+ openImageFile: (path2) => `Open ${path2}`,
37950
38059
  // Host transcript
37951
38060
  transcriptLoading: "Loading conversation…",
37952
38061
  earlierHistory: "Earlier messages",
@@ -37989,21 +38098,37 @@ const DEFAULT_CHAT_LABELS = {
37989
38098
  agentDraftNote: "Applies to your next chat.",
37990
38099
  switchModel: "Switch model",
37991
38100
  chooseModel: "Choose model",
38101
+ // The model pill's tooltip: the chain, then how to change it
38102
+ modelChain: "Model chain",
38103
+ modelForNextChat: "For your next chat",
38104
+ modelServing: (picked, serving) => `${picked} failed this run, so ${serving} took over. The next run tries ${picked} again.`,
38105
+ modelServingFallback: "The picked model",
38106
+ modelChainNoModel: "No model picked yet",
37992
38107
  searchModels: "Search models",
37993
38108
  searchModelsPlaceholder: "Search models…",
37994
- modelsShowOlder: "Show older models",
37995
- modelsShowOlderHint: "Show older models (⌥O)",
37996
- modelsOlder: "Older",
38109
+ modelsShowLegacy: "Show legacy models",
38110
+ modelsShowLegacyHint: "Show legacy models (⌥L)",
38111
+ modelsLegacy: "Legacy",
37997
38112
  modelsJumpToProvider: "Jump to provider",
37998
38113
  modelsJumpHint: (provider, digit) => digit ? `${provider} (⌘${digit})` : provider,
37999
38114
  modelsLoading: "Loading…",
38000
38115
  modelsLoadFailed: (error) => `Failed to load models: ${error}`,
38001
38116
  modelsNoProviders: "No provider is signed in. Sign in under Settings → Authentication.",
38117
+ modelsNoMatch: (query) => `No model matches "${query}".`,
38002
38118
  modelsTypeAnId: 'Type any model id to use it. Put a provider first to pick one, for example "xai grok-9".',
38003
38119
  modelsInUse: "In use",
38120
+ modelsChatTab: "Chat",
38121
+ modelsImageTab: "Image",
38122
+ modelKinds: "Model kind",
38123
+ imageModelsPill: "Image model",
38124
+ imageModelsNone: "No connected provider generates images. Connect OpenRouter, Google Gemini, xAI, or OpenAI with a platform API key.",
38125
+ imageModelReferences: "reference images",
38126
+ imageModelReferencesHint: "Edits or matches reference images",
38127
+ imageModelTransparency: "transparency",
38128
+ imageModelTransparencyHint: "Can make a transparent background",
38004
38129
  modelsCustomId: "Custom id",
38005
38130
  modelsShownOf: (shown2, total) => `${shown2} of ${total}`,
38006
- modelsOlderHidden: (count2) => `${count2} older hidden`,
38131
+ modelsLegacyHidden: (count2) => `${count2} legacy hidden`,
38007
38132
  modelsSelected: (count2) => `${count2} selected`,
38008
38133
  pickModel: "pick",
38009
38134
  modelPrimary: "primary",
@@ -38016,15 +38141,16 @@ const DEFAULT_CHAT_LABELS = {
38016
38141
  modelRemoveFallback: (n2) => `Remove fallback #${n2}`,
38017
38142
  modelRemoveFromChain: "Remove from chain",
38018
38143
  modelAccountBlocked: (provider) => `Another ${provider} account is in use. Picking this one switches the chain to it.`,
38019
- modelOlder: "older",
38020
- modelOlderHint: "Newer models exist in this family",
38144
+ modelLegacy: "legacy",
38145
+ modelLegacyHint: "Newer models exist in this family",
38146
+ modelUnavailable: "unavailable",
38021
38147
  modelNotInCatalog: "not in catalog",
38022
38148
  modelNotInCatalogHint: "Used as typed. No details are known for this id.",
38023
38149
  modelVia: "via",
38024
38150
  modelViaHint: (modelId, provider) => `${modelId} via ${provider}`,
38025
38151
  modelInUse: "in use",
38026
38152
  modelReasoning: "reasoning",
38027
- modelReasoningHint: "Supports reasoning effort",
38153
+ modelReasoningHint: "Can think before answering",
38028
38154
  contextWindow: "Context window",
38029
38155
  modelOptions: "Model options",
38030
38156
  setModelOptions: "Set model options",
@@ -42439,6 +42565,17 @@ function modelCatalogResource(cwd2, hostId) {
42439
42565
  }
42440
42566
  };
42441
42567
  }
42568
+ function imageModelsResource(cwd2, hostId) {
42569
+ return {
42570
+ key: ["image-models", cwd2 ?? null, hostId ?? null],
42571
+ fetcher: () => window.api.sessions.listImageModels(cwd2 ?? void 0, null),
42572
+ options: {
42573
+ topics: ["models", "extensions", "extensions:built"],
42574
+ scope: { ...cwd2 ? { cwd: cwd2 } : {}, ...hostScope(hostId) },
42575
+ revalidateOnFocus: true
42576
+ }
42577
+ };
42578
+ }
42442
42579
  function decisionModelsResource(cwd2, hostId) {
42443
42580
  return {
42444
42581
  key: ["decision-models", cwd2 ?? null, hostId ?? null],
@@ -44215,7 +44352,8 @@ function Tooltip({
44215
44352
  children,
44216
44353
  className = "",
44217
44354
  portal = false,
44218
- maxWidth
44355
+ maxWidth,
44356
+ disabled = false
44219
44357
  }) {
44220
44358
  const y2 = side === "bottom" ? "top-full mt-1.5" : "bottom-full mb-1.5";
44221
44359
  const x2 = align === "end" ? "right-0" : "left-1/2 -translate-x-1/2";
@@ -44230,7 +44368,7 @@ function Tooltip({
44230
44368
  const timer2 = reactExports.useRef(void 0);
44231
44369
  const pointerInside = reactExports.useRef(false);
44232
44370
  const [pos, setPos] = reactExports.useState(null);
44233
- const open = (hovered || focused) && !suppressed && !dismissed;
44371
+ const open = !disabled && (hovered || focused) && !suppressed && !dismissed;
44234
44372
  const presence = usePresence$1(open, { enter: portal, exitMs: readMenuExitMs });
44235
44373
  const moves = useMotionLevel$1() === "full";
44236
44374
  reactExports.useEffect(() => () => clearTimeout(timer2.current), []);
@@ -45416,7 +45554,7 @@ function loadSymbolsFont(url) {
45416
45554
  return symbolsFont;
45417
45555
  }
45418
45556
  function loadGhostty$1(symbolsFontUrl2) {
45419
- ghosttyModule ??= Promise.all([__vitePreload(() => import("./ghostty-web-BCAZYtuA.js"), true ? [] : void 0, import.meta.url), loadSymbolsFont(symbolsFontUrl2)]).then(async ([m2]) => {
45557
+ ghosttyModule ??= Promise.all([__vitePreload(() => import("./ghostty-web-DeA_Bbgl.js"), true ? [] : void 0, import.meta.url), loadSymbolsFont(symbolsFontUrl2)]).then(async ([m2]) => {
45420
45558
  await m2.init();
45421
45559
  drawBoxGlyphs(m2);
45422
45560
  return m2;
@@ -45457,6 +45595,9 @@ function paletteToCssVars(p2) {
45457
45595
  "--zg-warn-soft": p2.warnSoft,
45458
45596
  "--zg-danger": p2.danger,
45459
45597
  "--zg-danger-soft": p2.dangerSoft,
45598
+ "--zg-danger-fill": p2.dangerFill,
45599
+ "--zg-danger-fill-hover": p2.dangerFillHover,
45600
+ "--zg-danger-fill-fg": p2.dangerFillFg,
45460
45601
  "--zg-info": p2.info,
45461
45602
  "--zg-info-soft": p2.infoSoft,
45462
45603
  "--zg-accent-dot": p2.dots.accent,
@@ -45918,6 +46059,9 @@ function derivePalette(seed) {
45918
46059
  const success = status(seed.success, statusDefaults.success);
45919
46060
  const warn2 = status(seed.warn, statusDefaults.warn);
45920
46061
  const danger2 = status(seed.danger, statusDefaults.danger);
46062
+ const dangerFill = fillForWhite(danger2);
46063
+ const dangerFillHover = withLightness(dangerFill, (toOklch(dangerFill)?.l ?? 0.5) - 0.05);
46064
+ const dangerFillFg = onFillText(dangerFill, bg);
45921
46065
  const info = status(seed.info, statusDefaults.info);
45922
46066
  const codeBg = seed.codeBg ?? step(dark ? 0.02 : -0.018);
45923
46067
  const codeFg = ensureContrast(text2, codeBg, CONTRAST.text);
@@ -45969,6 +46113,9 @@ function derivePalette(seed) {
45969
46113
  warnSoft: withAlpha(warn2, 0.14),
45970
46114
  danger: danger2,
45971
46115
  dangerSoft: withAlpha(danger2, 0.14),
46116
+ dangerFill,
46117
+ dangerFillHover,
46118
+ dangerFillFg,
45972
46119
  info,
45973
46120
  infoSoft: withAlpha(info, 0.14),
45974
46121
  dots,
@@ -63032,6 +63179,7 @@ const TOOL_GLYPH = {
63032
63179
  write_file: "i-ph-file-plus",
63033
63180
  fetch_url: "i-ph-globe",
63034
63181
  web_search: "i-ph-magnifying-glass",
63182
+ generate_image: "i-ph-image",
63035
63183
  spawn: "i-ph-robot",
63036
63184
  tool_search: "i-ph-wrench",
63037
63185
  skills_use: "i-ph-graduation-cap",
@@ -63985,6 +64133,124 @@ function readPath$1(tool) {
63985
64133
  const path2 = tool.rawInput?.path;
63986
64134
  return typeof path2 === "string" ? path2.slice(path2.lastIndexOf("/") + 1) : void 0;
63987
64135
  }
64136
+ function cssRatio(raw2) {
64137
+ if (typeof raw2 !== "string") return "1 / 1";
64138
+ const m2 = /^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?)$/.exec(raw2);
64139
+ return m2 ? `${m2[1]} / ${m2[2]}` : "1 / 1";
64140
+ }
64141
+ function requestedCount(raw2) {
64142
+ return typeof raw2 === "number" && Number.isFinite(raw2) ? Math.min(4, Math.max(1, Math.floor(raw2))) : 1;
64143
+ }
64144
+ function savedPaths(text2) {
64145
+ return text2.split("\n").flatMap((line) => {
64146
+ const m2 = /^Saved: (.+?) \([^)]*\)$/.exec(line.trim());
64147
+ return m2 ? [m2[1]] : [];
64148
+ });
64149
+ }
64150
+ function drawsImageGeneration(tool) {
64151
+ return tool.name === "generate_image" && tool.rawInput?.list !== true;
64152
+ }
64153
+ function ImageFrame({
64154
+ src,
64155
+ ratio,
64156
+ pending: pending2,
64157
+ label,
64158
+ onOpen,
64159
+ onFail
64160
+ }) {
64161
+ const [readySrc, setReadySrc] = reactExports.useState(null);
64162
+ const ready2 = src !== null && readySrc === src;
64163
+ const img = reactExports.useRef(null);
64164
+ reactExports.useEffect(() => {
64165
+ const el = img.current;
64166
+ if (!src || !el) return void 0;
64167
+ let live = true;
64168
+ const show = () => {
64169
+ el.decode().catch(() => void 0).then(() => live && setReadySrc(src));
64170
+ };
64171
+ if (el.complete && el.naturalWidth > 0) show();
64172
+ else el.addEventListener("load", show, { once: true });
64173
+ return () => {
64174
+ live = false;
64175
+ el.removeEventListener("load", show);
64176
+ };
64177
+ }, [src]);
64178
+ const frame2 = /* @__PURE__ */ jsxRuntimeExports.jsx(
64179
+ "span",
64180
+ {
64181
+ className: "zg-image-frame block",
64182
+ style: { aspectRatio: ratio },
64183
+ "data-testid": "image-frame",
64184
+ ...pending2 || src && !ready2 ? { "data-pending": "" } : {},
64185
+ children: src && /* @__PURE__ */ jsxRuntimeExports.jsx("img", { ref: img, src, alt: "", decoding: "async", onError: onFail, ...ready2 ? { "data-ready": "" } : {} })
64186
+ }
64187
+ );
64188
+ if (!src || !onOpen) return frame2;
64189
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
64190
+ "button",
64191
+ {
64192
+ type: "button",
64193
+ "aria-label": label,
64194
+ onClick: (event) => onOpen(event.currentTarget),
64195
+ className: "zg-press-subtle block self-start max-w-full p-0 border-0 bg-transparent cursor-zoom-in rounded-zg-md focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--zg-ring)]",
64196
+ children: frame2
64197
+ }
64198
+ );
64199
+ }
64200
+ function ImageGenerationBlock({
64201
+ tool
64202
+ }) {
64203
+ const labels = useChatLabels();
64204
+ const { openFile } = useTranscriptActions();
64205
+ const lightbox = useLightbox();
64206
+ const media = useToolMedia(tool, tool.result);
64207
+ 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;
64211
+ const running2 = tool.ok === null;
64212
+ if (running2) {
64213
+ const count2 = requestedCount(input.n);
64214
+ 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)) }),
64216
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta zg-shimmer self-start", role: "status", children: count2 > 1 ? labels.generatingImages(count2, model) : labels.generatingImage(model) })
64217
+ ] });
64218
+ }
64219
+ const images = media?.media.filter((m2) => m2.kind === "image" && !failed.has(m2.index)) ?? [];
64220
+ if (tool.ok === false || !media || images.length === 0) return null;
64221
+ const paths = savedPaths(media.rest);
64222
+ const gallery = images.map((m2, i2) => ({
64223
+ key: String(m2.index),
64224
+ name: paths[i2] ?? labels.generatedImage,
64225
+ src: media.url(m2.index)
64226
+ }));
64227
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex flex-col gap-1.5", "data-testid": "image-generation", children: [
64228
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1.5", children: images.map((m2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex flex-col gap-1 min-w-0", children: [
64229
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
64230
+ ImageFrame,
64231
+ {
64232
+ src: media.url(m2.index),
64233
+ ratio,
64234
+ pending: false,
64235
+ label: labels.viewAttachment(paths[i2] ?? labels.generatedImage),
64236
+ onOpen: (el) => lightbox.open(gallery, i2, el),
64237
+ onFail: () => setFailed((prev) => new Set(prev).add(m2.index))
64238
+ }
64239
+ ),
64240
+ paths[i2] && (openFile ? /* @__PURE__ */ jsxRuntimeExports.jsx(
64241
+ "button",
64242
+ {
64243
+ type: "button",
64244
+ title: labels.openImageFile(paths[i2]),
64245
+ onClick: (event) => openFile(paths[i2], event),
64246
+ className: "zg-press-subtle self-start max-w-full truncate p-0 border-0 bg-transparent cursor-pointer font-mono zg-meta text-[var(--zg-accent-hover)]",
64247
+ children: paths[i2]
64248
+ }
64249
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "self-start max-w-full truncate font-mono zg-meta", children: paths[i2] }))
64250
+ ] }, m2.index)) }),
64251
+ lightbox.element
64252
+ ] });
64253
+ }
63988
64254
  function toolRowPropsEqual(prev, next) {
63989
64255
  if (prev.mode !== next.mode || prev.showResult !== next.showResult || prev.showDiff !== next.showDiff || prev.lineState !== next.lineState) {
63990
64256
  return false;
@@ -64137,6 +64403,7 @@ const ToolRow = reactExports.memo(({ tool, mode, showResult, showDiff, lineState
64137
64403
  ]
64138
64404
  }
64139
64405
  ),
64406
+ mode !== "hidden" && drawsImageGeneration(tool) && /* @__PURE__ */ jsxRuntimeExports.jsx(ImageGenerationBlock, { tool }),
64140
64407
  hasDiff && tool.edit && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "zg-collapsible", "data-open": open, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "zg-collapsible-inner", children: bodyMounted && /* @__PURE__ */ jsxRuntimeExports.jsx(EditDiffBlock, { edit: tool.edit }) }) }),
64141
64408
  interaction && ToolBody && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "zg-collapsible", "data-open": open, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "zg-collapsible-inner", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "pt-2 pb-1", children: bodyMounted && /* @__PURE__ */ jsxRuntimeExports.jsx(ToolBody, { tool }) }) }) }),
64142
64409
  showInputPanel && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "zg-collapsible", "data-open": open, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "zg-collapsible-inner", children: bodyMounted && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -64166,7 +64433,7 @@ const ToolRow = reactExports.memo(({ tool, mode, showResult, showDiff, lineState
64166
64433
  !bodyMounted ? null : media ? (
64167
64434
  // An image the call read, or a screenshot it took: the media itself, then any text around it.
64168
64435
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex flex-col gap-1.5", children: [
64169
- /* @__PURE__ */ jsxRuntimeExports.jsx(ToolMedia, { media: media.media, url: media.url }),
64436
+ !drawsImageGeneration(tool) && /* @__PURE__ */ jsxRuntimeExports.jsx(ToolMedia, { media: media.media, url: media.url }),
64170
64437
  tool.name !== "read_file" && media.rest !== "" && /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: CODE_PANEL, children: media.rest })
64171
64438
  ] })
64172
64439
  ) : tool.name === "read_file" ? (
@@ -64520,15 +64787,23 @@ const CommandNoteRow = reactExports.memo(({ text: text2 }) => {
64520
64787
  const InfoRow = reactExports.memo(({ text: text2 }) => {
64521
64788
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-[var(--zg-text-muted)] whitespace-pre-wrap", children: text2 });
64522
64789
  });
64790
+ const NOTICE_STYLE = {
64791
+ error: { tone: "text-zg-danger", icon: "i-ph-x-circle" },
64792
+ warn: { tone: "text-zg-warn", icon: "i-ph-warning" },
64793
+ info: { tone: "text-[var(--zg-text-muted)]", icon: "i-ph-info" }
64794
+ };
64523
64795
  const NoticeRow = reactExports.memo(({ notice, text: text2 }) => {
64524
- const tone = notice.severity === "error" ? "text-zg-danger" : notice.severity === "warn" ? "text-zg-warn" : "text-[var(--zg-text-muted)]";
64796
+ const { tone, icon } = NOTICE_STYLE[notice.severity] ?? NOTICE_STYLE.info;
64525
64797
  const [head2, ...details] = text2.split("\n").filter((line) => line.trim() !== "");
64526
64798
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-start gap-1 text-xs", title: notice.label, children: [
64527
- /* @__PURE__ */ jsxRuntimeExports.jsx(
64799
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
64528
64800
  "span",
64529
64801
  {
64530
- 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}`,
64531
- children: head2
64802
+ 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}`,
64803
+ children: [
64804
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${icon} shrink-0` }),
64805
+ head2
64806
+ ]
64532
64807
  }
64533
64808
  ),
64534
64809
  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)) })
@@ -65607,7 +65882,7 @@ const asStream = (events) => events;
65607
65882
  function useTranscriptRows(events, streaming, { showCacheNotices, codemodeShowCalls, showEditDiffs, groupToolCalls, showRunReceipt, compact }) {
65608
65883
  const shownEvents = reactExports.useMemo(() => {
65609
65884
  const shown2 = showCacheNotices && codemodeShowCalls ? events : events.filter(
65610
- (event) => (showCacheNotices || event.notice?.label !== CACHE_NOTICE_LABEL) && nestedCallVisible(event, codemodeShowCalls)
65885
+ (event) => (showCacheNotices || !isCacheNotice(event.notice)) && nestedCallVisible(event, codemodeShowCalls)
65611
65886
  );
65612
65887
  return gatherCommandNotes(asStream(shown2));
65613
65888
  }, [events, showCacheNotices, codemodeShowCalls]);
@@ -78652,7 +78927,7 @@ const BTN = `${buttonClass({ variant: "secondary" })} !text-[var(--zg-text)] fon
78652
78927
  const BTN_PRIMARY = buttonClass({ variant: "solid" });
78653
78928
  buttonClass({ variant: "ghost" });
78654
78929
  const BTN_GHOST_LEADING = buttonClass({ variant: "ghost", flush: "start" });
78655
- const BTN_DANGER = buttonClass({ variant: "danger-strong" });
78930
+ const BTN_DANGER = buttonClass({ variant: "danger-solid" });
78656
78931
  const INPUT = "zg-well w-full text-zg-ui px-2.5 placeholder:text-[var(--zg-text-subtle)]";
78657
78932
  function CardError({
78658
78933
  error
@@ -80094,6 +80369,7 @@ const Timeline = reactExports.memo(({ events, isStreaming, sessionId }) => {
80094
80369
  const retry = useSessionRetry(sessionId);
80095
80370
  const runStatus = reactExports.useMemo(() => ({ retry }), [retry]);
80096
80371
  const modelName = useModelName();
80372
+ const openTarget = useOpenTarget();
80097
80373
  const actions = reactExports.useMemo(
80098
80374
  () => ({
80099
80375
  sessionId,
@@ -80106,9 +80382,13 @@ const Timeline = reactExports.memo(({ events, isStreaming, sessionId }) => {
80106
80382
  resume: (text2) => pushComposerPrompt(text2, sessionId ? { scopeKey: sessionId } : void 0),
80107
80383
  modelName,
80108
80384
  // Served from this computer's store (`zg-media:`); a server session keeps the stand-ins.
80109
- ...sessionId && serverIdOf(sessionId) === null ? { toolMediaUrl: (callId, index2) => toolMediaUrl(sessionId, callId, index2) } : {}
80385
+ ...sessionId && serverIdOf(sessionId) === null ? { toolMediaUrl: (callId, index2) => toolMediaUrl(sessionId, callId, index2) } : {},
80386
+ // Files the session wrote, on this computer only: a server session's files are on the server.
80387
+ ...sessionId && serverIdOf(sessionId) === null && scopeCwd ? {
80388
+ openFile: (path2, event) => void openTarget.file(`${scopeCwd.replace(/\/+$/, "")}/${path2}`, event)
80389
+ } : {}
80110
80390
  }),
80111
- [sessionId, openSession, modelName]
80391
+ [sessionId, openSession, modelName, openTarget, scopeCwd]
80112
80392
  );
80113
80393
  return /* @__PURE__ */ jsxRuntimeExports.jsx(MarkdownContext.Provider, { value: markdownCtx, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CommandScopeContext.Provider, { value: commandScope, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TranscriptRenderersProvider, { value: GUI_TRANSCRIPT_RENDERERS, children: /* @__PURE__ */ jsxRuntimeExports.jsx(TranscriptActionsProvider, { value: actions, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
80114
80394
  Transcript,
@@ -87070,7 +87350,7 @@ function formatTimeout(ms2) {
87070
87350
  }
87071
87351
  const PRIMARY = buttonClass({ variant: "solid" });
87072
87352
  const SECONDARY = `${buttonClass({ variant: "secondary" })} !text-[var(--zg-text)] font-medium`;
87073
- const DESTRUCTIVE = buttonClass({ variant: "danger-strong" });
87353
+ const DESTRUCTIVE = buttonClass({ variant: "danger-solid" });
87074
87354
  const FILE_EDIT_TOOLS = /* @__PURE__ */ new Set(["edit", "multi_edit", "write_file"]);
87075
87355
  function ApprovalBar({ sessionId }) {
87076
87356
  const head2 = useSessionApprovalHead(sessionId);
@@ -129155,13 +129435,13 @@ function SessionModelOptionsPicker({
129155
129435
  );
129156
129436
  }
129157
129437
  const MODEL_PICKER_STORAGE_KEY = "zg:model-picker:v1";
129158
- const DEFAULT_MODEL_PICKER_PREFS = { version: 1, showOlder: false };
129438
+ const DEFAULT_MODEL_PICKER_PREFS = { version: 1, showLegacy: false };
129159
129439
  function parseModelPickerPrefs(raw2) {
129160
129440
  try {
129161
129441
  const o2 = JSON.parse(raw2);
129162
129442
  if (!o2 || typeof o2 !== "object") return void 0;
129163
- const showOlder = o2.showOlder;
129164
- return { version: 1, showOlder: typeof showOlder === "boolean" ? showOlder : false };
129443
+ const showLegacy = o2.showLegacy;
129444
+ return { version: 1, showLegacy: typeof showLegacy === "boolean" ? showLegacy : false };
129165
129445
  } catch {
129166
129446
  return void 0;
129167
129447
  }
@@ -129175,7 +129455,7 @@ function getModelPickerPrefs() {
129175
129455
  function setModelPickerPrefs(update2) {
129176
129456
  const prev = getModelPickerPrefs();
129177
129457
  const next = { ...prev, ...update2, version: 1 };
129178
- if (next.showOlder === prev.showOlder) return;
129458
+ if (next.showLegacy === prev.showLegacy) return;
129179
129459
  state$2 = next;
129180
129460
  writePersisted(MODEL_PICKER_STORAGE_KEY, JSON.stringify(next));
129181
129461
  for (const l2 of listeners$b) l2();
@@ -129316,7 +129596,7 @@ function modelSearchScore(entry, terms) {
129316
129596
  }
129317
129597
  return score;
129318
129598
  }
129319
- function pickerGroups(catalog2, query, chain, showOlder, current2) {
129599
+ function pickerGroups(catalog2, query, chain, showLegacy, current2) {
129320
129600
  const totals = /* @__PURE__ */ new Map();
129321
129601
  for (const entry of catalog2) totals.set(groupKeyOf(entry), (totals.get(groupKeyOf(entry)) ?? 0) + 1);
129322
129602
  const terms = query.trim().toLowerCase().split(/\s+/).filter(Boolean);
@@ -129363,7 +129643,7 @@ function pickerGroups(catalog2, query, chain, showOlder, current2) {
129363
129643
  }
129364
129644
  for (const entry of catalog2) {
129365
129645
  if (pinned2.has(rowKey(entry))) continue;
129366
- if (!showOlder && !current2.has(lineupKeyOf(entry))) {
129646
+ if (!showLegacy && !current2.has(lineupKeyOf(entry))) {
129367
129647
  groupFor(entry);
129368
129648
  continue;
129369
129649
  }
@@ -129512,8 +129792,8 @@ function ModelChainFooter({
129512
129792
  single,
129513
129793
  multi,
129514
129794
  selected,
129515
- hiddenOlder,
129516
- onShowOlder
129795
+ hiddenLegacy,
129796
+ onShowLegacy
129517
129797
  }) {
129518
129798
  const labels = useChatLabels();
129519
129799
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `zg-meta ${pad} py-2 shrink-0 border-t border-[var(--zg-hairline)] flex items-center gap-3`, children: [
@@ -129525,14 +129805,14 @@ function ModelChainFooter({
129525
129805
  /* @__PURE__ */ jsxRuntimeExports.jsx(FooterKey, { spec: "tab" }),
129526
129806
  labels.modelFallback
129527
129807
  ] }),
129528
- hiddenOlder > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
129808
+ hiddenLegacy > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
129529
129809
  "button",
129530
129810
  {
129531
129811
  type: "button",
129532
- onClick: onShowOlder,
129812
+ onClick: onShowLegacy,
129533
129813
  className: "zg-meta bg-transparent border-0 p-0 cursor-pointer hover:text-[var(--zg-text)] whitespace-nowrap",
129534
- "data-testid": "model-older-hint",
129535
- children: labels.modelsOlderHidden(hiddenOlder)
129814
+ "data-testid": "model-legacy-hint",
129815
+ children: labels.modelsLegacyHidden(hiddenLegacy)
129536
129816
  }
129537
129817
  ),
129538
129818
  /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -129547,17 +129827,19 @@ function ModelChainFooter({
129547
129827
  )
129548
129828
  ] });
129549
129829
  }
129550
- function ModelChainSearch({
129830
+ function ModelChainHeader({
129551
129831
  pad,
129552
129832
  query,
129553
129833
  onQuery,
129554
- showOlder,
129555
- onShowOlderChange,
129834
+ showLegacy,
129835
+ onShowLegacyChange,
129836
+ toolbar,
129837
+ pills,
129556
129838
  inputRef
129557
129839
  }) {
129558
129840
  const labels = useChatLabels();
129559
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${pad} pt-3 pb-2.5 shrink-0 flex items-center gap-2`, children: [
129560
- /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "zg-well flex-1 min-w-0 flex items-center gap-2 h-8 px-2.5", children: [
129841
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${pad} py-3 shrink-0 flex flex-col gap-2`, children: [
129842
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { className: "zg-well w-full min-w-0 flex items-center gap-2 h-8 px-2.5", children: [
129561
129843
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-ph-magnifying-glass text-zg-ui text-[var(--zg-text-muted)] shrink-0" }),
129562
129844
  /* @__PURE__ */ jsxRuntimeExports.jsx(
129563
129845
  "input",
@@ -129573,26 +129855,83 @@ function ModelChainSearch({
129573
129855
  }
129574
129856
  )
129575
129857
  ] }),
129576
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
129577
- "button",
129858
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-7 flex items-center gap-2 min-w-0", children: [
129859
+ toolbar,
129860
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
129861
+ "button",
129862
+ {
129863
+ type: "button",
129864
+ role: "switch",
129865
+ "aria-checked": showLegacy,
129866
+ "aria-label": labels.modelsShowLegacy,
129867
+ title: labels.modelsShowLegacyHint,
129868
+ onClick: () => {
129869
+ onShowLegacyChange(!showLegacy);
129870
+ inputRef.current?.focus({ preventScroll: true });
129871
+ },
129872
+ className: "zg-segment-item zg-press-subtle ml-auto shrink-0 inline-flex items-center gap-1.5 h-7 rounded-zg-md px-2 border-0 bg-transparent cursor-pointer text-zg-meta text-[var(--zg-text-muted)]",
129873
+ children: [
129874
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-ph-clock-counter-clockwise text-zg-ui" }),
129875
+ labels.modelsLegacy,
129876
+ /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSwitch, { on: showLegacy })
129877
+ ]
129878
+ }
129879
+ )
129880
+ ] }),
129881
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-7 flex min-w-0", children: pills })
129882
+ ] });
129883
+ }
129884
+ function ModelProviderChip({
129885
+ entry
129886
+ }) {
129887
+ const color2 = providerColor(entry.providerKey);
129888
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
129889
+ "span",
129890
+ {
129891
+ className: "inline-flex items-center h-[18px] gap-1 rounded-zg-sm px-1.5 text-zg-badge whitespace-nowrap",
129892
+ style: { color: color2, background: providerTint(entry.providerKey) },
129893
+ children: [
129894
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "w-1.5 h-1.5 rounded-full", style: { background: color2 } }),
129895
+ providerAccountLabel(entry)
129896
+ ]
129897
+ }
129898
+ );
129899
+ }
129900
+ function ModelWindow({ entry }) {
129901
+ const labels = useChatLabels();
129902
+ if (entry.offCatalog) {
129903
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta shrink-0", style: { color: "var(--zg-warn)" }, title: labels.modelNotInCatalogHint, children: labels.modelNotInCatalog });
129904
+ }
129905
+ return entry.contextWindow === null ? null : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta shrink-0", title: labels.contextWindow, children: compactWindow(entry.contextWindow) });
129906
+ }
129907
+ function ModelFlag({ icon, label, hint }) {
129908
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { label: hint, side: "top", portal: true, className: "shrink-0 inline-flex", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { role: "img", "aria-label": label, className: `${icon} text-zg-label text-[var(--zg-text-subtle)]` }) });
129909
+ }
129910
+ function ModelReasoning({ entry }) {
129911
+ const labels = useChatLabels();
129912
+ return entry.supportsReasoning ? /* @__PURE__ */ jsxRuntimeExports.jsx(ModelFlag, { icon: "i-ph-brain", label: labels.modelReasoning, hint: labels.modelReasoningHint }) : null;
129913
+ }
129914
+ function ModelMeta({
129915
+ entry,
129916
+ legacy: legacy2 = false,
129917
+ route = false
129918
+ }) {
129919
+ const labels = useChatLabels();
129920
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
129921
+ legacy2 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta shrink-0", title: labels.modelLegacyHint, children: labels.modelLegacy }),
129922
+ entry.details?.map((detail) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta shrink-0", children: detail }, detail)),
129923
+ !(entry.offCatalog && route) && /* @__PURE__ */ jsxRuntimeExports.jsx(ModelWindow, { entry }),
129924
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ModelReasoning, { entry }),
129925
+ entry.references && /* @__PURE__ */ jsxRuntimeExports.jsx(ModelFlag, { icon: "i-ph-images", label: labels.imageModelReferences, hint: labels.imageModelReferencesHint }),
129926
+ entry.transparency && /* @__PURE__ */ jsxRuntimeExports.jsx(
129927
+ ModelFlag,
129578
129928
  {
129579
- type: "button",
129580
- role: "switch",
129581
- "aria-checked": showOlder,
129582
- "aria-label": labels.modelsShowOlder,
129583
- title: labels.modelsShowOlderHint,
129584
- onClick: () => {
129585
- onShowOlderChange(!showOlder);
129586
- inputRef.current?.focus({ preventScroll: true });
129587
- },
129588
- className: "zg-segment-item zg-press-subtle shrink-0 inline-flex items-center gap-1.5 h-8 rounded-zg-md px-2 border-0 bg-transparent cursor-pointer text-zg-meta text-[var(--zg-text-muted)]",
129589
- children: [
129590
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-ph-clock-counter-clockwise text-zg-ui" }),
129591
- labels.modelsOlder,
129592
- /* @__PURE__ */ jsxRuntimeExports.jsx(MenuSwitch, { on: showOlder })
129593
- ]
129929
+ icon: "i-ph-checkerboard",
129930
+ label: labels.imageModelTransparency,
129931
+ hint: labels.imageModelTransparencyHint
129594
129932
  }
129595
- )
129933
+ ),
129934
+ entry.unavailable && /* @__PURE__ */ jsxRuntimeExports.jsx(ModelFlag, { icon: "i-ph-lock-simple", label: labels.modelUnavailable, hint: entry.unavailable })
129596
129935
  ] });
129597
129936
  }
129598
129937
  const ModelChainRow = reactExports.memo(function ModelChainRow2({
@@ -129605,7 +129944,7 @@ const ModelChainRow = reactExports.memo(function ModelChainRow2({
129605
129944
  position: position2,
129606
129945
  numbered,
129607
129946
  blocked = false,
129608
- older,
129947
+ legacy: legacy2,
129609
129948
  showProvider,
129610
129949
  route = false,
129611
129950
  isNew,
@@ -129624,19 +129963,6 @@ const ModelChainRow = reactExports.memo(function ModelChainRow2({
129624
129963
  const color2 = providerColor(entry.providerKey);
129625
129964
  const member = position2 !== null;
129626
129965
  const oneLine = !dense && (route || !sub);
129627
- const meta = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
129628
- older && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta shrink-0", title: labels.modelOlderHint, children: labels.modelOlder }),
129629
- entry.details?.map((detail) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta shrink-0", children: detail }, detail)),
129630
- entry.offCatalog && route ? null : entry.offCatalog ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta shrink-0", style: { color: "var(--zg-warn)" }, title: labels.modelNotInCatalogHint, children: labels.modelNotInCatalog }) : entry.contextWindow !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta shrink-0", title: labels.contextWindow, children: compactWindow(entry.contextWindow) }),
129631
- entry.supportsReasoning && /* @__PURE__ */ jsxRuntimeExports.jsx(
129632
- "span",
129633
- {
129634
- "aria-label": labels.modelReasoning,
129635
- title: labels.modelReasoningHint,
129636
- className: "i-ph-brain shrink-0 text-zg-label text-[var(--zg-text-subtle)]"
129637
- }
129638
- )
129639
- ] });
129640
129966
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { ref: item, className: "group absolute inset-x-0", style: { top: top2, height }, children: [
129641
129967
  /* @__PURE__ */ jsxRuntimeExports.jsxs(
129642
129968
  "button",
@@ -129646,11 +129972,12 @@ const ModelChainRow = reactExports.memo(function ModelChainRow2({
129646
129972
  "data-model": entry.modelId,
129647
129973
  "data-account": entry.account?.id,
129648
129974
  title: blocked ? labels.modelAccountBlocked(entry.providerLabel) : void 0,
129975
+ "aria-disabled": entry.unavailable ? true : void 0,
129649
129976
  "data-size": dense ? "md" : "lg",
129650
129977
  "data-active": isCursor ? "" : void 0,
129651
129978
  onMouseMove: isCursor ? void 0 : () => onHover(idx),
129652
129979
  onClick: (e2) => onPick(idx, e2.shiftKey),
129653
- className: `zg-menu-row zg-press-subtle relative h-full ${oneLine ? "!items-center" : ""} ${older ? "opacity-75" : ""}`,
129980
+ className: `zg-menu-row zg-press-subtle relative h-full ${oneLine ? "!items-center" : ""} ${entry.unavailable ? "opacity-50 cursor-not-allowed" : legacy2 ? "opacity-75" : ""}`,
129654
129981
  children: [
129655
129982
  numbered && /*
129656
129983
  * The place stands in the column of the In use pin above it: the
@@ -129682,18 +130009,8 @@ const ModelChainRow = reactExports.memo(function ModelChainRow2({
129682
130009
  sub && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta truncate", children: sub })
129683
130010
  ] }),
129684
130011
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "shrink-0 flex items-center gap-2", children: [
129685
- showProvider && /* @__PURE__ */ jsxRuntimeExports.jsxs(
129686
- "span",
129687
- {
129688
- className: "inline-flex items-center h-[18px] gap-1 rounded-zg-sm px-1.5 text-zg-badge",
129689
- style: { color: color2, background: providerTint(entry.providerKey) },
129690
- children: [
129691
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "w-1.5 h-1.5 rounded-full", style: { background: color2 } }),
129692
- providerAccountLabel(entry)
129693
- ]
129694
- }
129695
- ),
129696
- meta,
130012
+ showProvider && /* @__PURE__ */ jsxRuntimeExports.jsx(ModelProviderChip, { entry }),
130013
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ModelMeta, { entry, legacy: legacy2, route }),
129697
130014
  member && // The checked style; the remove button takes its place under the cursor.
129698
130015
  /* @__PURE__ */ jsxRuntimeExports.jsx(
129699
130016
  "span",
@@ -129812,7 +130129,7 @@ const ModelChainRows = reactExports.memo(function ModelChainRows2({
129812
130129
  position: position2,
129813
130130
  numbered: multi && group.key === "in-use",
129814
130131
  blocked: position2 === null && !canJoinChain(chain, pickRefOf(entry)),
129815
- older: !entry.offCatalog && !current2.has(lineupKeyOf(entry)),
130132
+ legacy: !entry.offCatalog && !current2.has(lineupKeyOf(entry)),
129816
130133
  showProvider: group.key === "in-use",
129817
130134
  route: group.key === "typed",
129818
130135
  isNew,
@@ -129844,7 +130161,6 @@ const ModelChainRows = reactExports.memo(function ModelChainRows2({
129844
130161
  const ModelProviderPills = reactExports.memo(function ModelProviderPills2({
129845
130162
  groups,
129846
130163
  active: active2,
129847
- pad,
129848
130164
  dense,
129849
130165
  onJump
129850
130166
  }) {
@@ -129875,7 +130191,7 @@ const ModelProviderPills = reactExports.memo(function ModelProviderPills2({
129875
130191
  });
129876
130192
  return () => cancelAnimationFrame(frame2);
129877
130193
  }, [active2, groups.length, dense]);
129878
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${pad} pb-2.5 shrink-0 flex`, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
130194
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 flex min-w-0 max-w-full", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
129879
130195
  "div",
129880
130196
  {
129881
130197
  ref: pillRow,
@@ -129946,16 +130262,23 @@ function ModelChainList({
129946
130262
  catalog: catalog2,
129947
130263
  loadError = null,
129948
130264
  onRetry,
129949
- showOlder,
129950
- onShowOlderChange,
130265
+ showLegacy,
130266
+ onShowLegacyChange,
129951
130267
  onChainChange,
129952
130268
  onQuickPick,
129953
130269
  dense = false,
129954
130270
  single = false,
129955
- className = ""
130271
+ className = "",
130272
+ toolbar,
130273
+ customIds = true,
130274
+ emptyText,
130275
+ query: keptQuery,
130276
+ onQueryChange
129956
130277
  }) {
129957
130278
  const labels = useChatLabels();
129958
- const [query, setQuery] = reactExports.useState("");
130279
+ const [ownQuery, setOwnQuery] = reactExports.useState("");
130280
+ const query = keptQuery ?? ownQuery;
130281
+ const setQuery = onQueryChange ?? setOwnQuery;
129959
130282
  const [cursor, setCursor] = reactExports.useState({ index: 0, by: "key" });
129960
130283
  const [chain, setChain] = reactExports.useState(() => [...initialChain]);
129961
130284
  const [jump, setJump] = reactExports.useState(null);
@@ -129972,8 +130295,8 @@ function ModelChainList({
129972
130295
  const shown2 = reactExports.useMemo(() => resolveChain(chain, catalog2 ?? NO_MODELS), [chain, catalog2]);
129973
130296
  const groups = reactExports.useMemo(() => {
129974
130297
  if (!catalog2) return [];
129975
- const found2 = pickerGroups(catalog2, query, shown2, showOlder, current2);
129976
- if (!query.trim()) return found2;
130298
+ const found2 = pickerGroups(catalog2, query, shown2, showLegacy, current2);
130299
+ if (!query.trim() || !customIds) return found2;
129977
130300
  const typed = offCatalogRows(catalog2, query, currentProviderKey, found2.length > 0);
129978
130301
  if (typed.length === 0) return found2;
129979
130302
  const group = {
@@ -129985,17 +130308,17 @@ function ModelChainList({
129985
130308
  total: typed.length
129986
130309
  };
129987
130310
  return found2.length > 0 ? [...found2, group] : [group];
129988
- }, [catalog2, query, shown2, showOlder, current2, currentProviderKey]);
130311
+ }, [catalog2, query, shown2, showLegacy, current2, currentProviderKey, customIds]);
129989
130312
  const rows2 = reactExports.useMemo(() => groups.flatMap((g2) => g2.rows), [groups]);
129990
130313
  const layout2 = reactExports.useMemo(() => layoutModelList(groups, dense), [groups, dense]);
129991
130314
  const tabs = reactExports.useMemo(
129992
130315
  () => groups.filter((g2) => g2.key === "in-use" || g2.providerKey !== null && g2.key !== "typed"),
129993
130316
  [groups]
129994
130317
  );
129995
- const hiddenOlder = reactExports.useMemo(() => {
129996
- if (!catalog2 || showOlder || query.trim()) return 0;
130318
+ const hiddenLegacy = reactExports.useMemo(() => {
130319
+ if (!catalog2 || showLegacy || query.trim()) return 0;
129997
130320
  return catalog2.filter((e2) => !current2.has(lineupKeyOf(e2)) && positionKeyed(shown2, rowKey(e2), refKey) === null).length;
129998
- }, [catalog2, showOlder, query, current2, shown2]);
130321
+ }, [catalog2, showLegacy, query, current2, shown2]);
129999
130322
  const seen2 = reactExports.useRef(null);
130000
130323
  reactExports.useEffect(() => {
130001
130324
  seen2.current ??= /* @__PURE__ */ new Set();
@@ -130009,6 +130332,7 @@ function ModelChainList({
130009
130332
  live.current = { rows: rows2, chain, catalog: catalog2, single, onQuickPick, layout: layout2 };
130010
130333
  });
130011
130334
  const pick2 = reactExports.useCallback((entry) => {
130335
+ if (entry.unavailable) return;
130012
130336
  const { chain: chain2, catalog: catalog22, single: single2, onQuickPick: onQuickPick2 } = live.current;
130013
130337
  const ref = pickRefOf(entry);
130014
130338
  const shown22 = resolveChain(chain2, catalog22 ?? NO_MODELS);
@@ -130022,6 +130346,7 @@ function ModelChainList({
130022
130346
  pick2(entry);
130023
130347
  return;
130024
130348
  }
130349
+ if (entry.unavailable) return;
130025
130350
  const ref = pickRefOf(entry);
130026
130351
  setChain((prev) => {
130027
130352
  const shown22 = resolveChain(prev, live.current.catalog ?? NO_MODELS);
@@ -130069,9 +130394,9 @@ function ModelChainList({
130069
130394
  });
130070
130395
  reactExports.useLayoutEffect(() => {
130071
130396
  onKey2.current = (e2) => {
130072
- if (e2.altKey && !e2.metaKey && !e2.ctrlKey && e2.code === "KeyO") {
130397
+ if (e2.altKey && !e2.metaKey && !e2.ctrlKey && e2.code === "KeyL") {
130073
130398
  e2.preventDefault();
130074
- onShowOlderChange(!showOlder);
130399
+ onShowLegacyChange(!showLegacy);
130075
130400
  return;
130076
130401
  }
130077
130402
  if ((e2.metaKey || e2.ctrlKey) && !e2.shiftKey && !e2.altKey && /^Digit[1-9]$/.test(e2.code)) {
@@ -130124,27 +130449,41 @@ function ModelChainList({
130124
130449
  return () => document.removeEventListener("keydown", listener);
130125
130450
  }, []);
130126
130451
  const pad = dense ? "px-3" : "px-4";
130452
+ const notice = loadError ? null : catalog2 === null ? labels.modelsLoading : catalog2.length === 0 ? emptyText ?? labels.modelsNoProviders : rows2.length === 0 ? customIds ? labels.modelsTypeAnId : labels.modelsNoMatch(query.trim()) : null;
130127
130453
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `zg-model-picker flex flex-col min-h-0 ${className}`, children: [
130128
130454
  /* @__PURE__ */ jsxRuntimeExports.jsx(
130129
- ModelChainSearch,
130455
+ ModelChainHeader,
130130
130456
  {
130131
130457
  pad,
130132
130458
  query,
130133
130459
  onQuery: setQuery,
130134
- showOlder,
130135
- onShowOlderChange,
130460
+ showLegacy,
130461
+ onShowLegacyChange,
130462
+ toolbar,
130463
+ pills: tabs.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(ModelProviderPills, { groups: tabs, active: spy.active, dense, onJump: jumpTo }) : void 0,
130136
130464
  inputRef
130137
130465
  }
130138
130466
  ),
130139
- tabs.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ModelProviderPills, { groups: tabs, active: spy.active, pad, dense, onJump: jumpTo }),
130140
130467
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 h-px bg-[var(--zg-hairline)]" }),
130141
- catalog2 === null && !loadError && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4 py-6 text-xs text-[var(--zg-text-muted)]", children: labels.modelsLoading }),
130142
- loadError && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "px-4 py-6 text-xs text-zg-danger", children: [
130143
- labels.modelsLoadFailed(loadError),
130144
- onRetry && /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: "ml-2 underline text-[var(--zg-text)]", onClick: onRetry, children: labels.retry })
130145
- ] }),
130146
- catalog2 !== null && rows2.length === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-4 py-6 text-xs text-[var(--zg-text-muted)]", children: catalog2.length === 0 ? labels.modelsNoProviders : labels.modelsTypeAnId }),
130147
- /* @__PURE__ */ jsxRuntimeExports.jsx(
130468
+ loadError || notice ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
130469
+ "div",
130470
+ {
130471
+ role: "status",
130472
+ className: `flex-1 min-h-0 flex flex-col items-center justify-center gap-2 px-6 py-8 text-center text-xs ${loadError ? "text-zg-danger" : "text-[var(--zg-text-muted)]"}`,
130473
+ children: [
130474
+ loadError ? labels.modelsLoadFailed(loadError) : notice,
130475
+ loadError && onRetry && /* @__PURE__ */ jsxRuntimeExports.jsx(
130476
+ "button",
130477
+ {
130478
+ type: "button",
130479
+ className: "underline text-[var(--zg-text)] bg-transparent border-0 cursor-pointer",
130480
+ onClick: onRetry,
130481
+ children: labels.retry
130482
+ }
130483
+ )
130484
+ ]
130485
+ }
130486
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
130148
130487
  ModelChainRows,
130149
130488
  {
130150
130489
  layout: layout2,
@@ -130155,7 +130494,7 @@ function ModelChainList({
130155
130494
  isNew,
130156
130495
  dense,
130157
130496
  single,
130158
- countHidden: !showOlder && !query.trim(),
130497
+ countHidden: !showLegacy && !query.trim(),
130159
130498
  onHover,
130160
130499
  onPick,
130161
130500
  onRemove,
@@ -130170,18 +130509,140 @@ function ModelChainList({
130170
130509
  single,
130171
130510
  multi: chain.length > 1,
130172
130511
  selected: chain.length,
130173
- hiddenOlder,
130174
- onShowOlder: () => onShowOlderChange(true)
130512
+ hiddenLegacy,
130513
+ onShowLegacy: () => onShowLegacyChange(true)
130175
130514
  }
130176
130515
  )
130177
130516
  ] });
130178
130517
  }
130518
+ const imageModelKey = (row) => `${row.providerKey}/${row.modelId}`;
130519
+ function effectiveImageModel(rows2, value) {
130520
+ return rows2.find((r2) => r2.available && imageModelKey(r2) === value) ?? rows2.find((r2) => r2.available && r2.isDefault) ?? rows2.find((r2) => r2.available) ?? null;
130521
+ }
130522
+ function imageCatalogRows(rows2) {
130523
+ return rows2.map((row) => ({
130524
+ providerKey: row.providerKey,
130525
+ providerLabel: row.providerLabel,
130526
+ modelId: row.modelId,
130527
+ modelName: row.modelName,
130528
+ contextWindow: null,
130529
+ supportsReasoning: false,
130530
+ ...row.references ? { references: true } : {},
130531
+ ...row.transparency ? { transparency: true } : {},
130532
+ ...row.available ? {} : { unavailable: row.reason ?? "" }
130533
+ }));
130534
+ }
130535
+ function ImageModelList({
130536
+ rows: rows2,
130537
+ value,
130538
+ loadError = null,
130539
+ onRetry,
130540
+ onPick,
130541
+ showLegacy,
130542
+ onShowLegacyChange,
130543
+ toolbar,
130544
+ query,
130545
+ onQueryChange,
130546
+ dense = true,
130547
+ className = ""
130548
+ }) {
130549
+ const labels = useChatLabels();
130550
+ const catalog2 = reactExports.useMemo(() => rows2 ? imageCatalogRows(rows2) : null, [rows2]);
130551
+ const current2 = rows2 ? effectiveImageModel(rows2, value) : null;
130552
+ const initialChain = reactExports.useMemo(
130553
+ () => current2 ? [{ providerKey: current2.providerKey, modelId: current2.modelId }] : [],
130554
+ [current2]
130555
+ );
130556
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
130557
+ ModelChainList,
130558
+ {
130559
+ single: true,
130560
+ dense,
130561
+ customIds: false,
130562
+ emptyText: labels.imageModelsNone,
130563
+ initialChain,
130564
+ catalog: catalog2,
130565
+ loadError,
130566
+ ...onRetry ? { onRetry } : {},
130567
+ showLegacy,
130568
+ onShowLegacyChange,
130569
+ onChainChange: () => void 0,
130570
+ onQuickPick: ([pick2]) => {
130571
+ if (pick2) onPick(imageModelKey(pick2));
130572
+ },
130573
+ toolbar,
130574
+ ...query !== void 0 ? { query } : {},
130575
+ ...onQueryChange ? { onQueryChange } : {},
130576
+ className
130577
+ },
130578
+ current2 ? imageModelKey(current2) : ""
130579
+ );
130580
+ }
130581
+ function rowOf$2(pick2, catalog2) {
130582
+ if (catalog2) {
130583
+ const key2 = refKey(resolvePick(pick2, catalog2));
130584
+ const hit = catalog2.find((entry) => rowKey(entry) === key2);
130585
+ if (hit) return hit;
130586
+ }
130587
+ return {
130588
+ providerKey: pick2.providerKey,
130589
+ providerLabel: catalog2?.find((entry) => entry.providerKey === pick2.providerKey)?.providerLabel ?? pick2.providerKey,
130590
+ modelId: pick2.modelId,
130591
+ modelName: pick2.modelId,
130592
+ contextWindow: null,
130593
+ supportsReasoning: false
130594
+ };
130595
+ }
130596
+ function ModelChainTooltip({
130597
+ chain,
130598
+ catalog: catalog2,
130599
+ serving = null,
130600
+ forNextChat = false,
130601
+ footer: footer2
130602
+ }) {
130603
+ const labels = useChatLabels();
130604
+ const rows2 = chain.map((pick2) => rowOf$2(pick2, catalog2));
130605
+ const primaryName = rows2[0] ? modelDisplayName(rows2[0]).name : labels.modelServingFallback;
130606
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex flex-col gap-1.5 py-0.5 text-left whitespace-normal", "data-testid": "model-chain-tooltip", children: [
130607
+ serving && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-zg-warn leading-snug", children: labels.modelServing(primaryName, serving) }),
130608
+ forNextChat && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta", children: labels.modelForNextChat }),
130609
+ rows2.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[var(--zg-text-muted)]", children: labels.modelChainNoModel }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
130610
+ "span",
130611
+ {
130612
+ role: "list",
130613
+ "aria-label": labels.modelChain,
130614
+ className: "grid grid-cols-[auto_minmax(0,1fr)_auto_auto_auto] items-center gap-x-2 gap-y-1",
130615
+ children: rows2.map((entry, i2) => {
130616
+ const display = modelDisplayName(entry);
130617
+ const sub = display.vendor ?? (display.name !== entry.modelId ? entry.modelId : null);
130618
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { role: "listitem", className: "contents", "data-model": entry.modelId, children: [
130619
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
130620
+ "span",
130621
+ {
130622
+ className: `text-zg-badge font-semibold tabular-nums text-center ${i2 === 0 ? "text-[var(--zg-accent)]" : "text-[var(--zg-text-muted)]"}`,
130623
+ title: i2 === 0 ? labels.modelPrimaryHint : labels.modelFallbackPosition(i2),
130624
+ children: i2 + 1
130625
+ }
130626
+ ),
130627
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "min-w-0 flex items-baseline gap-2", children: [
130628
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-[var(--zg-text)]", children: display.name }),
130629
+ sub && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta truncate", children: sub })
130630
+ ] }),
130631
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ModelProviderChip, { entry }) }),
130632
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex justify-end", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ModelWindow, { entry }) }),
130633
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex w-3 justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ModelReasoning, { entry }) })
130634
+ ] }, `${rowKey(entry)}:${i2}`);
130635
+ })
130636
+ }
130637
+ ),
130638
+ footer2 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta flex items-center gap-1.5 pt-0.5", children: footer2 })
130639
+ ] });
130640
+ }
130179
130641
  function ModelPickerFrame({
130180
130642
  name: name2,
130181
- account = null,
130182
130643
  fallbacks = 0,
130183
130644
  serving = null,
130184
- title,
130645
+ tooltip,
130185
130646
  ariaLabel,
130186
130647
  width = 440,
130187
130648
  onDismiss,
@@ -130197,38 +130658,53 @@ function ModelPickerFrame({
130197
130658
  width,
130198
130659
  ...onDismiss ? { onDismiss } : {},
130199
130660
  ...onOpenChange ? { onOpenChange } : {},
130200
- trigger: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx(PickerPill, { ...props, title: title ?? verb, children: serving ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium text-zg-warn max-w-[12rem] min-w-0 truncate", children: serving }) : name2 ? (
130201
- // Baseline, not centre: the mono "+N" otherwise rides above the name.
130202
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "inline-flex items-baseline gap-1 min-w-0", children: [
130203
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium max-w-[12rem] min-w-0 truncate", children: name2 }),
130204
- account && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta shrink-0 max-w-[6rem] truncate", "data-testid": "model-account", children: account }),
130205
- fallbacks > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "zg-meta shrink-0", "data-testid": "model-chain-suffix", children: [
130206
- "+",
130207
- fallbacks
130208
- ] })
130209
- ] })
130210
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium min-w-0 truncate", children: labels.chooseModel }) }),
130661
+ trigger: (props, open) => {
130662
+ const pill = (
130663
+ // Named by what it shows; the tooltip describes the chain (`aria-describedby`).
130664
+ /* @__PURE__ */ jsxRuntimeExports.jsx(PickerPill, { ...props, "data-testid": "model-pill", children: serving ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium text-zg-warn max-w-[12rem] min-w-0 truncate", children: serving }) : name2 ? (
130665
+ // Baseline, not centre: the mono "+N" otherwise rides above the name.
130666
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "inline-flex items-baseline gap-1 min-w-0", children: [
130667
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium max-w-[12rem] min-w-0 truncate", children: name2 }),
130668
+ fallbacks > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "zg-meta shrink-0", "data-testid": "model-chain-suffix", children: [
130669
+ "+",
130670
+ fallbacks
130671
+ ] })
130672
+ ] })
130673
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs font-medium min-w-0 truncate", children: labels.chooseModel }) })
130674
+ );
130675
+ return tooltip ? /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, { label: tooltip, side: "top", portal: true, maxWidth: 420, disabled: open, className: "min-w-0 max-w-full", children: pill }) : pill;
130676
+ },
130211
130677
  children
130212
130678
  }
130213
130679
  );
130214
130680
  }
130681
+ const LIST_HEIGHT = "h-[min(60vh,460px)]";
130682
+ const LIST_MAX_HEIGHT = "max-h-[min(60vh,460px)]";
130215
130683
  function ModelChainPopover({
130216
130684
  catalog: catalog2,
130217
130685
  loadError = null,
130218
130686
  onRetry,
130219
130687
  chain,
130220
130688
  onCommit,
130221
- showOlder,
130222
- onShowOlderChange,
130689
+ showLegacy,
130690
+ onShowLegacyChange,
130223
130691
  single = false,
130224
130692
  serving = null,
130225
130693
  name: name2,
130226
- title,
130694
+ forNextChat = false,
130695
+ shortcut,
130227
130696
  ariaLabel,
130228
- onOpenChange
130697
+ onOpenChange,
130698
+ images,
130699
+ kind
130229
130700
  }) {
130701
+ const labels = useChatLabels();
130230
130702
  const draft2 = reactExports.useRef(null);
130703
+ const [tab2, setTab] = reactExports.useState("chat");
130704
+ const [query, setQuery] = reactExports.useState("");
130231
130705
  const primary = chain[0];
130706
+ const switchable = images !== void 0 && kind === void 0;
130707
+ const shown2 = kind === "image" && images ? "image" : switchable ? tab2 : "chat";
130232
130708
  reactExports.useEffect(() => {
130233
130709
  if (!catalog2 || catalog2.length === 0) return void 0;
130234
130710
  const warm = () => void modelLineup(catalog2);
@@ -130239,33 +130715,112 @@ function ModelChainPopover({
130239
130715
  const id2 = setTimeout(warm, 200);
130240
130716
  return () => clearTimeout(id2);
130241
130717
  }, [catalog2]);
130242
- const account = primary?.account ? catalog2?.find((e2) => e2.providerKey === primary.providerKey && e2.account?.id === primary.account)?.account : void 0;
130243
130718
  const commitDraft = async () => {
130244
130719
  const edited = draft2.current;
130245
130720
  draft2.current = null;
130246
130721
  if (!edited?.chain[0] || chainsEqualKeyed(edited.chain, edited.initial, refKey)) return;
130247
130722
  await onCommit(edited.chain);
130248
130723
  };
130724
+ const listHeight = switchable ? LIST_HEIGHT : LIST_MAX_HEIGHT;
130725
+ const toolbar = switchable ? /* @__PURE__ */ jsxRuntimeExports.jsx(
130726
+ Segmented,
130727
+ {
130728
+ size: "sm",
130729
+ ariaLabel: labels.modelKinds,
130730
+ value: tab2,
130731
+ onChange: setTab,
130732
+ options: [
130733
+ { value: "chat", label: labels.modelsChatTab, icon: "i-ph-chat-circle" },
130734
+ { value: "image", label: labels.modelsImageTab, icon: "i-ph-image" }
130735
+ ]
130736
+ }
130737
+ ) : void 0;
130738
+ if (kind === "image" && images) {
130739
+ const current2 = images.rows ? effectiveImageModel(images.rows, images.value) : null;
130740
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
130741
+ ModelPickerFrame,
130742
+ {
130743
+ ariaLabel: ariaLabel ?? labels.imageModelsPill,
130744
+ tooltip: labels.imageModelsPill,
130745
+ onOpenChange: (open) => {
130746
+ if (!open) setQuery("");
130747
+ onOpenChange?.(open);
130748
+ },
130749
+ name: current2?.modelName ?? null,
130750
+ children: (close2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
130751
+ ImageModelList,
130752
+ {
130753
+ rows: images.rows,
130754
+ value: images.value,
130755
+ loadError: images.loadError ?? null,
130756
+ onPick: (key2) => {
130757
+ images.onPick(key2);
130758
+ close2();
130759
+ },
130760
+ showLegacy,
130761
+ onShowLegacyChange,
130762
+ query,
130763
+ onQueryChange: setQuery,
130764
+ className: listHeight
130765
+ }
130766
+ )
130767
+ }
130768
+ );
130769
+ }
130249
130770
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
130250
130771
  ModelPickerFrame,
130251
130772
  {
130252
130773
  ...ariaLabel ? { ariaLabel } : {},
130253
- ...title ? { title } : {},
130254
- ...onOpenChange ? { onOpenChange } : {},
130774
+ tooltip: /* @__PURE__ */ jsxRuntimeExports.jsx(
130775
+ ModelChainTooltip,
130776
+ {
130777
+ chain,
130778
+ catalog: catalog2,
130779
+ serving,
130780
+ forNextChat,
130781
+ footer: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
130782
+ ariaLabel ?? (chain.length > 0 ? labels.switchModel : labels.chooseModel),
130783
+ shortcut
130784
+ ] })
130785
+ }
130786
+ ),
130787
+ onOpenChange: (open) => {
130788
+ if (!open) {
130789
+ setTab("chat");
130790
+ setQuery("");
130791
+ }
130792
+ onOpenChange?.(open);
130793
+ },
130255
130794
  onDismiss: () => void commitDraft(),
130256
130795
  name: name2 !== void 0 ? name2 : primary ? modelNameOf(catalog2, primary.modelId, primary.providerKey) : null,
130257
- account: account?.label ?? null,
130258
130796
  fallbacks: Math.max(0, chain.length - 1),
130259
130797
  serving,
130260
- children: (close2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
130798
+ children: (close2) => images && shown2 === "image" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
130799
+ ImageModelList,
130800
+ {
130801
+ rows: images.rows,
130802
+ value: images.value,
130803
+ loadError: images.loadError ?? null,
130804
+ onPick: (key2) => {
130805
+ images.onPick(key2);
130806
+ close2();
130807
+ },
130808
+ showLegacy,
130809
+ onShowLegacyChange,
130810
+ toolbar,
130811
+ query,
130812
+ onQueryChange: setQuery,
130813
+ className: listHeight
130814
+ }
130815
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
130261
130816
  ModelChainMenu,
130262
130817
  {
130263
130818
  chain,
130264
130819
  catalog: catalog2,
130265
130820
  loadError,
130266
130821
  ...onRetry ? { onRetry } : {},
130267
- showOlder,
130268
- onShowOlderChange,
130822
+ showLegacy,
130823
+ onShowLegacyChange,
130269
130824
  single,
130270
130825
  onDraft: (initial, next) => {
130271
130826
  draft2.current = { initial, chain: next };
@@ -130274,7 +130829,11 @@ function ModelChainPopover({
130274
130829
  draft2.current = null;
130275
130830
  await onCommit(next);
130276
130831
  close2();
130277
- }
130832
+ },
130833
+ toolbar,
130834
+ query,
130835
+ onQueryChange: setQuery,
130836
+ className: listHeight
130278
130837
  }
130279
130838
  )
130280
130839
  }
@@ -130285,11 +130844,15 @@ function ModelChainMenu({
130285
130844
  catalog: catalog2,
130286
130845
  loadError,
130287
130846
  onRetry,
130288
- showOlder,
130289
- onShowOlderChange,
130847
+ showLegacy,
130848
+ onShowLegacyChange,
130290
130849
  single,
130291
130850
  onDraft,
130292
- onQuickPick
130851
+ onQuickPick,
130852
+ toolbar,
130853
+ query,
130854
+ onQueryChange,
130855
+ className
130293
130856
  }) {
130294
130857
  const [initial] = reactExports.useState(() => [...chain]);
130295
130858
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -130301,11 +130864,14 @@ function ModelChainMenu({
130301
130864
  catalog: catalog2,
130302
130865
  loadError,
130303
130866
  ...onRetry ? { onRetry } : {},
130304
- showOlder,
130305
- onShowOlderChange,
130867
+ showLegacy,
130868
+ onShowLegacyChange,
130306
130869
  onChainChange: (next) => onDraft(initial, next),
130307
130870
  onQuickPick: (next) => void onQuickPick(next),
130308
- className: "max-h-[min(60vh,460px)]"
130871
+ className,
130872
+ toolbar,
130873
+ query,
130874
+ onQueryChange
130309
130875
  }
130310
130876
  );
130311
130877
  }
@@ -130322,7 +130888,10 @@ function ModelPicker({
130322
130888
  remember: remember2 = true
130323
130889
  }) {
130324
130890
  const { setDefaultModel, refresh } = useSessionsActions();
130325
- const { showOlder } = useModelPickerPrefs();
130891
+ const { settings, setSetting } = useSettings();
130892
+ const showImages = (activeSession ? activeSession.hostId : hostId) == null && settings.imageGeneration !== false;
130893
+ const imageModels = useIpcResource(showImages ? imageModelsResource(activeSession?.cwd ?? null, null) : null);
130894
+ const { showLegacy } = useModelPickerPrefs();
130326
130895
  const [open, setOpen] = reactExports.useState(false);
130327
130896
  const cacheHint = useCacheHints(activeSession?.id ?? null, open);
130328
130897
  const rows2 = reactExports.useMemo(
@@ -130347,23 +130916,31 @@ function ModelPicker({
130347
130916
  await refresh();
130348
130917
  };
130349
130918
  const nameOf2 = (id2, key2 = providerKey) => modelNameOf(catalog2, id2, key2);
130350
- const pickedAccount = providerKey && account ? catalog2?.find((e2) => e2.providerKey === providerKey && e2.account?.id === account)?.account : void 0;
130351
- const title = fallbackModel ? `${modelId ? nameOf2(modelId) : "The picked model"} failed this run, so ${nameOf2(fallbackModel.model, fallbackModel.provider)} took over. The next run tries the picked model again.` : activeSession ? chainFallbacks.length > 0 && modelId ? `Falls back in order: 1. ${nameOf2(modelId)}${chainFallbacks.map((f2, i2) => `, ${i2 + 2}. ${nameOf2(f2.modelId, f2.providerKey)}`).join("")} (Ctrl+M)` : `${nameOf2(modelId ?? "")} (${modelId})${pickedAccount && providerKey ? ` on ${providerAccountLabel({ providerLabel: catalog2?.find((e2) => e2.providerKey === providerKey)?.providerLabel ?? providerKey, account: pickedAccount })}` : ""}. Switch model (Ctrl+M)` : modelId ? "Model for the next chat" : "Pick a model for the next chat";
130919
+ const chord = activeSession ? getMergedKeybindings().openModelPicker : void 0;
130352
130920
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
130353
130921
  ModelChainPopover,
130354
130922
  {
130355
130923
  ariaLabel: activeSession ? "Switch model" : "Pick default model",
130356
- title,
130924
+ forNextChat: !activeSession,
130925
+ ...chord ? { shortcut: /* @__PURE__ */ jsxRuntimeExports.jsx(KeyHint, { spec: chord, size: "sm" }) } : {},
130357
130926
  name: modelId ? nameOf2(modelId) : null,
130358
130927
  catalog: rows2,
130359
130928
  loadError: catalogError,
130360
130929
  ...onRetryCatalog ? { onRetry: onRetryCatalog } : {},
130361
130930
  chain,
130362
130931
  onCommit: commit,
130363
- showOlder,
130364
- onShowOlderChange: (next) => setModelPickerPrefs({ showOlder: next }),
130932
+ showLegacy,
130933
+ onShowLegacyChange: (next) => setModelPickerPrefs({ showLegacy: next }),
130365
130934
  serving: fallbackModel ? nameOf2(fallbackModel.model, fallbackModel.provider) : null,
130366
- onOpenChange: setOpen
130935
+ onOpenChange: setOpen,
130936
+ ...showImages ? {
130937
+ images: {
130938
+ rows: imageModels.data ?? null,
130939
+ value: settings.imageModel ?? "",
130940
+ loadError: imageModels.error ? String(imageModels.error) : null,
130941
+ onPick: (key2) => setSetting("imageModel", key2)
130942
+ }
130943
+ } : {}
130367
130944
  }
130368
130945
  );
130369
130946
  }
@@ -135906,7 +136483,8 @@ function AddressBar({
135906
136483
  icon,
135907
136484
  placeholder,
135908
136485
  normalize: normalize2,
135909
- onSubmit
136486
+ onSubmit,
136487
+ onSubmitEmpty
135910
136488
  }) {
135911
136489
  const labels = useLabels();
135912
136490
  const [draft2, setDraft] = reactExports.useState(null);
@@ -135953,6 +136531,12 @@ function AddressBar({
135953
136531
  }
135954
136532
  if (e2.key === "Enter") {
135955
136533
  e2.preventDefault();
136534
+ if (onSubmitEmpty && !(draft2 ?? "").trim()) {
136535
+ onSubmitEmpty();
136536
+ setDraft(null);
136537
+ input.current?.blur();
136538
+ return;
136539
+ }
135956
136540
  const next = normalize2(draft2 ?? "");
135957
136541
  if (!next) {
135958
136542
  setInvalid(true);
@@ -136128,7 +136712,8 @@ function BrowserNav({ sessionId, cwd: cwd2 }) {
136128
136712
  icon: siteIcon2,
136129
136713
  placeholder: "Enter a URL or a port (5173)",
136130
136714
  normalize: normalizeBrowserUrl,
136131
- onSubmit: (next) => browserStore.navigate(sessionId, next)
136715
+ onSubmit: (next) => browserStore.navigate(sessionId, next),
136716
+ onSubmitEmpty: () => browserStore.home(sessionId)
136132
136717
  }
136133
136718
  ),
136134
136719
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "zg-segment shrink-0", children: [
@@ -136495,7 +137080,8 @@ function DevToolsDock({ sessionId }) {
136495
137080
  ] });
136496
137081
  }
136497
137082
  function BrowserEmpty({ cwd: cwd2, onOpen }) {
136498
- const recent = recentBrowserUrls(cwd2);
137083
+ const [, setRevision] = reactExports.useState(0);
137084
+ const recent = recentBrowserPages(cwd2);
136499
137085
  const [servers, setServers] = reactExports.useState([]);
136500
137086
  const tabVisible = usePanelVisible();
136501
137087
  reactExports.useEffect(() => {
@@ -136529,6 +137115,18 @@ function BrowserEmpty({ cwd: cwd2, onOpen }) {
136529
137115
  };
136530
137116
  }, [tabVisible]);
136531
137117
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute inset-0 overflow-y-auto px-5 py-8", "data-testid": "browser-empty", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-[420px] mx-auto flex flex-col gap-4", children: [
137118
+ recent.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("section", { className: "grid grid-cols-2 gap-2", "aria-label": "Recent pages", "data-testid": "browser-recent", children: recent.map((entry) => /* @__PURE__ */ jsxRuntimeExports.jsx(
137119
+ RecentCard,
137120
+ {
137121
+ entry,
137122
+ onOpen,
137123
+ onRemove: () => {
137124
+ removeRecentBrowserPage(cwd2, entry.url);
137125
+ setRevision((n2) => n2 + 1);
137126
+ }
137127
+ },
137128
+ entry.url
137129
+ )) }),
136532
137130
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { children: [
136533
137131
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-[13px] font-medium text-[var(--zg-text)]", children: "Open a page" }),
136534
137132
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-1 text-[12px] text-[var(--zg-text-muted)]", children: "Type an address or a port above. The agent can use this browser too." })
@@ -136548,21 +137146,75 @@ function BrowserEmpty({ cwd: cwd2, onOpen }) {
136548
137146
  },
136549
137147
  s2.port
136550
137148
  ))
136551
- ] }),
136552
- recent.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "flex flex-col gap-0.5 -mx-2", children: [
136553
- /* @__PURE__ */ jsxRuntimeExports.jsx(SectionLabel, { className: "px-2 pb-1", children: "Recent" }),
136554
- recent.map((url) => /* @__PURE__ */ jsxRuntimeExports.jsx(
136555
- MenuRow$1,
136556
- {
136557
- onClick: () => onOpen(url),
136558
- icon: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "i-ph-globe-simple text-[13px]", "aria-hidden": true }),
136559
- title: displayUrl(url)
136560
- },
136561
- url
136562
- ))
136563
137149
  ] })
136564
137150
  ] }) });
136565
137151
  }
137152
+ function RecentCard({
137153
+ entry,
137154
+ onOpen,
137155
+ onRemove
137156
+ }) {
137157
+ const icon = useSiteIcon(entry.url);
137158
+ const address = displayUrl(entry.url);
137159
+ const dots = reactExports.useRef(null);
137160
+ const [menu, setMenu] = reactExports.useState(null);
137161
+ const items = [
137162
+ { id: "open-external", label: "Open in browser", onSelect: () => window.open(entry.url, "_blank") },
137163
+ { id: "remove", label: "Remove", group: "remove", destructive: true, onSelect: onRemove }
137164
+ ];
137165
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
137166
+ "div",
137167
+ {
137168
+ className: "group relative min-w-0",
137169
+ onContextMenu: (event) => {
137170
+ event.preventDefault();
137171
+ setMenu({ x: event.clientX, y: event.clientY });
137172
+ },
137173
+ children: [
137174
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
137175
+ "button",
137176
+ {
137177
+ type: "button",
137178
+ onClick: () => onOpen(entry.url),
137179
+ title: entry.url,
137180
+ className: "zg-raised zg-press-soft w-full min-w-0 flex flex-col gap-1 px-2.5 py-2 rounded-[var(--zg-radius-md)] border cursor-pointer text-left hover:before:bg-[var(--zg-row-hover)]",
137181
+ children: [
137182
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1.5 min-w-0 pr-5", children: [
137183
+ icon ? /* @__PURE__ */ jsxRuntimeExports.jsx("img", { src: icon, alt: "", draggable: false, className: "w-3.5 h-3.5 shrink-0 rounded-[3px] object-contain" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-ph-globe-simple w-3.5 h-3.5 shrink-0 text-[var(--zg-text-subtle)]" }),
137184
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-[12px] font-medium text-[var(--zg-text)]", children: entry.title || address })
137185
+ ] }),
137186
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-baseline gap-2 min-w-0 zg-meta", children: [
137187
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate", children: address }),
137188
+ entry.visitedAt > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-auto shrink-0 tabular-nums", title: new Date(entry.visitedAt).toLocaleString(), children: relativeTime(entry.visitedAt, Date.now()) })
137189
+ ] })
137190
+ ]
137191
+ }
137192
+ ),
137193
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
137194
+ IconButton,
137195
+ {
137196
+ ref: dots,
137197
+ icon: "i-ph-dots-three",
137198
+ label: `Actions for ${entry.title || address}`,
137199
+ size: "xs",
137200
+ active: menu === "dots",
137201
+ className: `absolute top-1.5 right-1.5 ${menu === "dots" ? "" : "opacity-0 group-hover:opacity-100 focus-visible:opacity-100"}`,
137202
+ onClick: () => setMenu((m2) => m2 === "dots" ? null : "dots")
137203
+ }
137204
+ ),
137205
+ menu !== null && /* @__PURE__ */ jsxRuntimeExports.jsx(
137206
+ RowActionsMenu,
137207
+ {
137208
+ open: true,
137209
+ ...menu === "dots" ? { anchorRef: dots } : { position: menu },
137210
+ onClose: () => setMenu(null),
137211
+ items
137212
+ }
137213
+ )
137214
+ ]
137215
+ }
137216
+ );
137217
+ }
136566
137218
  function BrowserError({ error, onReload }) {
136567
137219
  const host = hostOf(error.url) || error.url;
136568
137220
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -178364,7 +179016,7 @@ function ModelChainPicker({
178364
179016
  className = "",
178365
179017
  sessionId = null
178366
179018
  }) {
178367
- const { showOlder } = useModelPickerPrefs();
179019
+ const { showLegacy } = useModelPickerPrefs();
178368
179020
  const { catalog: catalog2, error, retry } = useModelCatalog$1(outerCatalog, cwd2, hostId);
178369
179021
  const cacheHint = useCacheHints(sessionId);
178370
179022
  const primary = initialChain[0];
@@ -178386,8 +179038,8 @@ function ModelChainPicker({
178386
179038
  catalog: rows2,
178387
179039
  loadError: error,
178388
179040
  ...retry ? { onRetry: retry } : {},
178389
- showOlder,
178390
- onShowOlderChange: (next) => setModelPickerPrefs({ showOlder: next }),
179041
+ showLegacy,
179042
+ onShowLegacyChange: (next) => setModelPickerPrefs({ showLegacy: next }),
178391
179043
  onChainChange,
178392
179044
  ...onQuickPick ? { onQuickPick } : {},
178393
179045
  dense,
@@ -185935,7 +186587,8 @@ const AGENT = {
185935
186587
  }
185936
186588
  ]
185937
186589
  },
185938
- { key: "subagentModels" }
186590
+ { key: "subagentModels" },
186591
+ { key: "imageGeneration" }
185939
186592
  ]
185940
186593
  },
185941
186594
  {
@@ -188794,13 +189447,13 @@ function settingsSource(openSettings, chat) {
188794
189447
  source: SETTINGS_SOURCE_ID
188795
189448
  },
188796
189449
  {
188797
- id: "setting:models-older",
188798
- title: "Show older models",
189450
+ id: "setting:models-legacy",
189451
+ title: "Show legacy models",
188799
189452
  description: "List every model a provider serves in the model picker",
188800
189453
  group: "Settings",
188801
189454
  icon: { gui: "i-ph-clock-counter-clockwise" },
188802
189455
  kind: "toggle",
188803
- checked: getModelPickerPrefs().showOlder,
189456
+ checked: getModelPickerPrefs().showLegacy,
188804
189457
  keywords: ["model picker", "legacy", "models", "lineup"],
188805
189458
  source: SETTINGS_SOURCE_ID
188806
189459
  },
@@ -188912,8 +189565,8 @@ function settingsSource(openSettings, chat) {
188912
189565
  const a2 = getAppearance();
188913
189566
  const e2 = getEditor();
188914
189567
  switch (itemId) {
188915
- case "setting:models-older":
188916
- setModelPickerPrefs({ showOlder: !getModelPickerPrefs().showOlder });
189568
+ case "setting:models-legacy":
189569
+ setModelPickerPrefs({ showLegacy: !getModelPickerPrefs().showLegacy });
188917
189570
  return;
188918
189571
  case "setting:transcript-compact":
188919
189572
  chat.setTranscriptDensity(chat.transcriptDensity === "compact" ? "full" : "compact");
@@ -190236,7 +190889,7 @@ const GUI_LABELS = {
190236
190889
  rename: "Rename chat",
190237
190890
  previous: "Previous attachment",
190238
190891
  next: "Next attachment",
190239
- modelReasoningHint: "Supports reasoning effort (Ctrl+L)"
190892
+ modelReasoningHint: "Can think before answering (Ctrl+L sets the effort)"
190240
190893
  };
190241
190894
  function AppProviders({ children }) {
190242
190895
  return /* @__PURE__ */ jsxRuntimeExports.jsx(LabelsProvider, { labels: GUI_LABELS, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(HostsProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ProviderUsageProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SafeModeProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(McpAuthProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(DiscoveryProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(StreamProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(PresenceProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(TodosProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ArtifactsProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(MessageQueueProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(PromptHistoryProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTurnProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(InteractionsProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SessionsProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(PanelsProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(PaletteProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(BadgeMenuProvider, { children }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) }) });