zidane-gui 7.0.14 → 7.0.15

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.
@@ -13670,6 +13670,7 @@ function descriptionFor(entry, token2, scope) {
13670
13670
  ageString(entry.updatedAt),
13671
13671
  `${entry.userMessageCount} msg${entry.userMessageCount === 1 ? "" : "s"}`
13672
13672
  ];
13673
+ if ((entry.artifactCount ?? 0) > 0) bits.push(`${entry.artifactCount} artifact${entry.artifactCount === 1 ? "" : "s"}`);
13673
13674
  const project = projectLabel(entry.projectRoot);
13674
13675
  if (scope === "all" && project) bits.push(project);
13675
13676
  return bits.join(" · ");
@@ -16587,7 +16588,7 @@ function reconcileEvents(prev, next) {
16587
16588
  }
16588
16589
  const pool = /* @__PURE__ */ new Map();
16589
16590
  for (const event of prev) {
16590
- const key2 = eventIdentity(event);
16591
+ const key2 = bucketKey(event);
16591
16592
  const bucket = pool.get(key2);
16592
16593
  if (bucket) {
16593
16594
  bucket.push(event);
@@ -16595,12 +16596,45 @@ function reconcileEvents(prev, next) {
16595
16596
  pool.set(key2, [event]);
16596
16597
  }
16597
16598
  }
16598
- const out = next.map((event) => pool.get(eventIdentity(event))?.shift() ?? event);
16599
+ const out = next.map((event) => {
16600
+ const bucket = pool.get(bucketKey(event));
16601
+ if (!bucket) {
16602
+ return event;
16603
+ }
16604
+ const hit = bucket.findIndex((candidate) => sameEvent(candidate, event));
16605
+ return hit === -1 ? event : bucket.splice(hit, 1)[0];
16606
+ });
16599
16607
  return out.length === prev.length && out.every((event, i) => event === prev[i]) ? prev : out;
16600
16608
  }
16601
- function eventIdentity(event) {
16602
- const keys2 = Object.keys(event).filter((key2) => key2 !== "receivedAt").sort();
16603
- return JSON.stringify(keys2.map((key2) => [key2, event[key2]]));
16609
+ function bucketKey(event) {
16610
+ const text2 = typeof event.text === "string" ? event.text.length : 0;
16611
+ return `${event.kind}\0${event.turnId ?? ""}\0${event.callId ?? ""}\0${event.childId ?? ""}\0${text2}`;
16612
+ }
16613
+ function sameEvent(a, b2) {
16614
+ if (a === b2) {
16615
+ return true;
16616
+ }
16617
+ const keysA = Object.keys(a).filter((key2) => key2 !== "receivedAt");
16618
+ const keysB = Object.keys(b2).filter((key2) => key2 !== "receivedAt");
16619
+ if (keysA.length !== keysB.length) {
16620
+ return false;
16621
+ }
16622
+ return keysA.every((key2) => key2 in b2 && deepEqual$2(a[key2], b2[key2]));
16623
+ }
16624
+ function deepEqual$2(a, b2) {
16625
+ if (a === b2) {
16626
+ return true;
16627
+ }
16628
+ if (typeof a !== "object" || typeof b2 !== "object" || a === null || b2 === null) {
16629
+ return false;
16630
+ }
16631
+ if (Array.isArray(a) || Array.isArray(b2)) {
16632
+ return Array.isArray(a) && Array.isArray(b2) && a.length === b2.length && a.every((item, i) => deepEqual$2(item, b2[i]));
16633
+ }
16634
+ const objA = a;
16635
+ const objB = b2;
16636
+ const keys2 = Object.keys(objA);
16637
+ return keys2.length === Object.keys(objB).length && keys2.every((key2) => key2 in objB && deepEqual$2(objA[key2], objB[key2]));
16604
16638
  }
16605
16639
  function ownerOf(event) {
16606
16640
  return event.childId ?? PARENT_OWNER;
@@ -17581,205 +17615,6 @@ function ModalShell({
17581
17615
  }
17582
17616
  );
17583
17617
  }
17584
- const SafeModeContext = reactExports.createContext(null);
17585
- const HeadStoreContext = reactExports.createContext(null);
17586
- function createHeadStore() {
17587
- const heads = /* @__PURE__ */ new Map();
17588
- const listeners2 = /* @__PURE__ */ new Map();
17589
- const subscribe2 = (sessionId, listener) => {
17590
- if (!sessionId) {
17591
- return () => void 0;
17592
- }
17593
- let set2 = listeners2.get(sessionId);
17594
- if (!set2) {
17595
- set2 = /* @__PURE__ */ new Set();
17596
- listeners2.set(sessionId, set2);
17597
- }
17598
- set2.add(listener);
17599
- return () => {
17600
- const live = listeners2.get(sessionId);
17601
- if (!live) {
17602
- return;
17603
- }
17604
- live.delete(listener);
17605
- if (live.size === 0) {
17606
- listeners2.delete(sessionId);
17607
- }
17608
- };
17609
- };
17610
- const notify2 = (sessionId) => {
17611
- const set2 = listeners2.get(sessionId);
17612
- if (!set2) {
17613
- return;
17614
- }
17615
- for (const fn2 of set2) {
17616
- fn2();
17617
- }
17618
- };
17619
- const reindex = (queue) => {
17620
- const next = /* @__PURE__ */ new Map();
17621
- for (const entry of queue) {
17622
- if (!next.has(entry.sessionId)) {
17623
- next.set(entry.sessionId, entry);
17624
- }
17625
- }
17626
- const touched = /* @__PURE__ */ new Set();
17627
- for (const [sessionId, head2] of next) {
17628
- if (heads.get(sessionId) !== head2) {
17629
- touched.add(sessionId);
17630
- }
17631
- }
17632
- for (const sessionId of heads.keys()) {
17633
- if (!next.has(sessionId)) {
17634
- touched.add(sessionId);
17635
- }
17636
- }
17637
- heads.clear();
17638
- for (const [sessionId, head2] of next) {
17639
- heads.set(sessionId, head2);
17640
- }
17641
- for (const sessionId of touched) {
17642
- notify2(sessionId);
17643
- }
17644
- };
17645
- return {
17646
- getHead: (sessionId) => sessionId ? heads.get(sessionId) ?? null : null,
17647
- subscribe: subscribe2,
17648
- reindex
17649
- };
17650
- }
17651
- function SafeModeProvider({ children }) {
17652
- const [queue, setQueue] = reactExports.useState([]);
17653
- const localResolversRef = reactExports.useRef(/* @__PURE__ */ new Map());
17654
- const headStoreRef = reactExports.useRef(null);
17655
- if (headStoreRef.current === null) {
17656
- headStoreRef.current = createHeadStore();
17657
- }
17658
- const headStore = headStoreRef.current;
17659
- reactExports.useEffect(() => {
17660
- headStore.reindex(queue);
17661
- }, [queue, headStore]);
17662
- reactExports.useEffect(() => {
17663
- const unsubscribe = window.api.safeMode.onApprovalRequest((req) => {
17664
- setQueue((prev) => prev.some((r2) => r2.id === req.id) ? prev : [...prev, req]);
17665
- });
17666
- const unsubscribeResolved = window.api.safeMode.onApprovalResolved(({ requestId }) => {
17667
- localResolversRef.current.delete(requestId);
17668
- setQueue((prev) => {
17669
- const next = prev.filter((r2) => r2.id !== requestId);
17670
- return next.length === prev.length ? prev : next;
17671
- });
17672
- });
17673
- let cancelled = false;
17674
- const backfill = () => {
17675
- window.api.safeMode.listPending().then((existing) => {
17676
- if (cancelled || !Array.isArray(existing)) {
17677
- return;
17678
- }
17679
- setQueue((prev) => {
17680
- const seen2 = new Set(prev.map((r2) => r2.id));
17681
- const additions = existing.filter((r2) => !seen2.has(r2.id));
17682
- return additions.length === 0 ? prev : [...prev, ...additions];
17683
- });
17684
- }).catch(() => void 0);
17685
- };
17686
- backfill();
17687
- const unsubscribeDaemon = window.api.daemon.onState(({ connected }) => {
17688
- if (connected) {
17689
- backfill();
17690
- }
17691
- });
17692
- return () => {
17693
- cancelled = true;
17694
- unsubscribe();
17695
- unsubscribeResolved();
17696
- unsubscribeDaemon();
17697
- };
17698
- }, []);
17699
- const resolveHead = reactExports.useCallback((decision) => {
17700
- setQueue((prev) => {
17701
- const [head2, ...rest] = prev;
17702
- if (!head2) {
17703
- return prev;
17704
- }
17705
- const localResolver = localResolversRef.current.get(head2.id);
17706
- if (localResolver) {
17707
- localResolversRef.current.delete(head2.id);
17708
- localResolver(decision);
17709
- } else {
17710
- window.api.safeMode.resolve(head2.id, decision).catch(() => void 0);
17711
- }
17712
- return rest;
17713
- });
17714
- }, []);
17715
- const resolveById = reactExports.useCallback((id, decision) => {
17716
- setQueue((prev) => {
17717
- const target = prev.find((r2) => r2.id === id);
17718
- if (!target) {
17719
- return prev;
17720
- }
17721
- const localResolver = localResolversRef.current.get(id);
17722
- if (localResolver) {
17723
- localResolversRef.current.delete(id);
17724
- localResolver(decision);
17725
- } else {
17726
- window.api.safeMode.resolve(id, decision).catch(() => void 0);
17727
- }
17728
- return prev.filter((r2) => r2.id !== id);
17729
- });
17730
- }, []);
17731
- const denyAll = reactExports.useCallback(() => {
17732
- setQueue((prev) => {
17733
- for (const req of prev) {
17734
- const localResolver = localResolversRef.current.get(req.id);
17735
- if (localResolver) {
17736
- localResolversRef.current.delete(req.id);
17737
- localResolver("deny");
17738
- } else {
17739
- window.api.safeMode.resolve(req.id, "deny").catch(() => void 0);
17740
- }
17741
- }
17742
- return [];
17743
- });
17744
- }, []);
17745
- const enqueueLocal = reactExports.useCallback((req, onResolve) => {
17746
- localResolversRef.current.set(req.id, onResolve);
17747
- setQueue((prev) => [...prev, req]);
17748
- }, []);
17749
- const value = reactExports.useMemo(
17750
- () => ({ queue, resolveHead, resolveById, denyAll, enqueueLocal }),
17751
- [queue, resolveHead, resolveById, denyAll, enqueueLocal]
17752
- );
17753
- return /* @__PURE__ */ jsxRuntimeExports.jsx(SafeModeContext.Provider, { value, children: /* @__PURE__ */ jsxRuntimeExports.jsx(HeadStoreContext.Provider, { value: headStore, children }) });
17754
- }
17755
- function useSafeModeQueue() {
17756
- const ctx = reactExports.useContext(SafeModeContext);
17757
- if (!ctx) {
17758
- throw new Error("useSafeModeQueue must be used within SafeModeProvider");
17759
- }
17760
- return ctx.queue;
17761
- }
17762
- function useSafeModeActions() {
17763
- const ctx = reactExports.useContext(SafeModeContext);
17764
- if (!ctx) {
17765
- throw new Error("useSafeModeActions must be used within SafeModeProvider");
17766
- }
17767
- return {
17768
- resolveHead: ctx.resolveHead,
17769
- resolveById: ctx.resolveById,
17770
- denyAll: ctx.denyAll,
17771
- enqueueLocal: ctx.enqueueLocal
17772
- };
17773
- }
17774
- function useSessionApprovalHead(sessionId) {
17775
- const store = reactExports.useContext(HeadStoreContext);
17776
- if (!store) {
17777
- throw new Error("useSessionApprovalHead must be used within SafeModeProvider");
17778
- }
17779
- const subscribe2 = reactExports.useCallback((listener) => store.subscribe(sessionId, listener), [store, sessionId]);
17780
- const getSnapshot2 = reactExports.useCallback(() => store.getHead(sessionId), [store, sessionId]);
17781
- return reactExports.useSyncExternalStore(subscribe2, getSnapshot2, getSnapshot2);
17782
- }
17783
17618
  const SelectTurnContext = reactExports.createContext(null);
17784
17619
  function SelectTurnProvider({ children }) {
17785
17620
  const [state, setState] = reactExports.useState(null);
@@ -17841,6 +17676,12 @@ const KEYBINDING_DEFS = [
17841
17676
  label: "todos",
17842
17677
  description: "open the active run's todo list (the agent's `todowrite` checkpoints)"
17843
17678
  },
17679
+ {
17680
+ action: "openArtifacts",
17681
+ default: "ctrl+shift+a",
17682
+ label: "artifacts",
17683
+ description: "open the session's artifacts (pull requests, branches, commits, files it produced)"
17684
+ },
17844
17685
  {
17845
17686
  action: "openMainSession",
17846
17687
  default: "ctrl+shift+m",
@@ -18397,6 +18238,205 @@ function formatKey(key2) {
18397
18238
  const lower2 = key2.toLowerCase();
18398
18239
  return KeySymbols[lower2] || key2;
18399
18240
  }
18241
+ const SafeModeContext = reactExports.createContext(null);
18242
+ const HeadStoreContext = reactExports.createContext(null);
18243
+ function createHeadStore() {
18244
+ const heads = /* @__PURE__ */ new Map();
18245
+ const listeners2 = /* @__PURE__ */ new Map();
18246
+ const subscribe2 = (sessionId, listener) => {
18247
+ if (!sessionId) {
18248
+ return () => void 0;
18249
+ }
18250
+ let set2 = listeners2.get(sessionId);
18251
+ if (!set2) {
18252
+ set2 = /* @__PURE__ */ new Set();
18253
+ listeners2.set(sessionId, set2);
18254
+ }
18255
+ set2.add(listener);
18256
+ return () => {
18257
+ const live = listeners2.get(sessionId);
18258
+ if (!live) {
18259
+ return;
18260
+ }
18261
+ live.delete(listener);
18262
+ if (live.size === 0) {
18263
+ listeners2.delete(sessionId);
18264
+ }
18265
+ };
18266
+ };
18267
+ const notify2 = (sessionId) => {
18268
+ const set2 = listeners2.get(sessionId);
18269
+ if (!set2) {
18270
+ return;
18271
+ }
18272
+ for (const fn2 of set2) {
18273
+ fn2();
18274
+ }
18275
+ };
18276
+ const reindex = (queue) => {
18277
+ const next = /* @__PURE__ */ new Map();
18278
+ for (const entry of queue) {
18279
+ if (!next.has(entry.sessionId)) {
18280
+ next.set(entry.sessionId, entry);
18281
+ }
18282
+ }
18283
+ const touched = /* @__PURE__ */ new Set();
18284
+ for (const [sessionId, head2] of next) {
18285
+ if (heads.get(sessionId) !== head2) {
18286
+ touched.add(sessionId);
18287
+ }
18288
+ }
18289
+ for (const sessionId of heads.keys()) {
18290
+ if (!next.has(sessionId)) {
18291
+ touched.add(sessionId);
18292
+ }
18293
+ }
18294
+ heads.clear();
18295
+ for (const [sessionId, head2] of next) {
18296
+ heads.set(sessionId, head2);
18297
+ }
18298
+ for (const sessionId of touched) {
18299
+ notify2(sessionId);
18300
+ }
18301
+ };
18302
+ return {
18303
+ getHead: (sessionId) => sessionId ? heads.get(sessionId) ?? null : null,
18304
+ subscribe: subscribe2,
18305
+ reindex
18306
+ };
18307
+ }
18308
+ function SafeModeProvider({ children }) {
18309
+ const [queue, setQueue] = reactExports.useState([]);
18310
+ const localResolversRef = reactExports.useRef(/* @__PURE__ */ new Map());
18311
+ const headStoreRef = reactExports.useRef(null);
18312
+ if (headStoreRef.current === null) {
18313
+ headStoreRef.current = createHeadStore();
18314
+ }
18315
+ const headStore = headStoreRef.current;
18316
+ reactExports.useEffect(() => {
18317
+ headStore.reindex(queue);
18318
+ }, [queue, headStore]);
18319
+ reactExports.useEffect(() => {
18320
+ const unsubscribe = window.api.safeMode.onApprovalRequest((req) => {
18321
+ setQueue((prev) => prev.some((r2) => r2.id === req.id) ? prev : [...prev, req]);
18322
+ });
18323
+ const unsubscribeResolved = window.api.safeMode.onApprovalResolved(({ requestId }) => {
18324
+ localResolversRef.current.delete(requestId);
18325
+ setQueue((prev) => {
18326
+ const next = prev.filter((r2) => r2.id !== requestId);
18327
+ return next.length === prev.length ? prev : next;
18328
+ });
18329
+ });
18330
+ let cancelled = false;
18331
+ const backfill = () => {
18332
+ window.api.safeMode.listPending().then((existing) => {
18333
+ if (cancelled || !Array.isArray(existing)) {
18334
+ return;
18335
+ }
18336
+ setQueue((prev) => {
18337
+ const seen2 = new Set(prev.map((r2) => r2.id));
18338
+ const additions = existing.filter((r2) => !seen2.has(r2.id));
18339
+ return additions.length === 0 ? prev : [...prev, ...additions];
18340
+ });
18341
+ }).catch(() => void 0);
18342
+ };
18343
+ backfill();
18344
+ const unsubscribeDaemon = window.api.daemon.onState(({ connected }) => {
18345
+ if (connected) {
18346
+ backfill();
18347
+ }
18348
+ });
18349
+ return () => {
18350
+ cancelled = true;
18351
+ unsubscribe();
18352
+ unsubscribeResolved();
18353
+ unsubscribeDaemon();
18354
+ };
18355
+ }, []);
18356
+ const resolveHead = reactExports.useCallback((decision) => {
18357
+ setQueue((prev) => {
18358
+ const [head2, ...rest] = prev;
18359
+ if (!head2) {
18360
+ return prev;
18361
+ }
18362
+ const localResolver = localResolversRef.current.get(head2.id);
18363
+ if (localResolver) {
18364
+ localResolversRef.current.delete(head2.id);
18365
+ localResolver(decision);
18366
+ } else {
18367
+ window.api.safeMode.resolve(head2.id, decision).catch(() => void 0);
18368
+ }
18369
+ return rest;
18370
+ });
18371
+ }, []);
18372
+ const resolveById = reactExports.useCallback((id, decision) => {
18373
+ setQueue((prev) => {
18374
+ const target = prev.find((r2) => r2.id === id);
18375
+ if (!target) {
18376
+ return prev;
18377
+ }
18378
+ const localResolver = localResolversRef.current.get(id);
18379
+ if (localResolver) {
18380
+ localResolversRef.current.delete(id);
18381
+ localResolver(decision);
18382
+ } else {
18383
+ window.api.safeMode.resolve(id, decision).catch(() => void 0);
18384
+ }
18385
+ return prev.filter((r2) => r2.id !== id);
18386
+ });
18387
+ }, []);
18388
+ const denyAll = reactExports.useCallback(() => {
18389
+ setQueue((prev) => {
18390
+ for (const req of prev) {
18391
+ const localResolver = localResolversRef.current.get(req.id);
18392
+ if (localResolver) {
18393
+ localResolversRef.current.delete(req.id);
18394
+ localResolver("deny");
18395
+ } else {
18396
+ window.api.safeMode.resolve(req.id, "deny").catch(() => void 0);
18397
+ }
18398
+ }
18399
+ return [];
18400
+ });
18401
+ }, []);
18402
+ const enqueueLocal = reactExports.useCallback((req, onResolve) => {
18403
+ localResolversRef.current.set(req.id, onResolve);
18404
+ setQueue((prev) => [...prev, req]);
18405
+ }, []);
18406
+ const value = reactExports.useMemo(
18407
+ () => ({ queue, resolveHead, resolveById, denyAll, enqueueLocal }),
18408
+ [queue, resolveHead, resolveById, denyAll, enqueueLocal]
18409
+ );
18410
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(SafeModeContext.Provider, { value, children: /* @__PURE__ */ jsxRuntimeExports.jsx(HeadStoreContext.Provider, { value: headStore, children }) });
18411
+ }
18412
+ function useSafeModeQueue() {
18413
+ const ctx = reactExports.useContext(SafeModeContext);
18414
+ if (!ctx) {
18415
+ throw new Error("useSafeModeQueue must be used within SafeModeProvider");
18416
+ }
18417
+ return ctx.queue;
18418
+ }
18419
+ function useSafeModeActions() {
18420
+ const ctx = reactExports.useContext(SafeModeContext);
18421
+ if (!ctx) {
18422
+ throw new Error("useSafeModeActions must be used within SafeModeProvider");
18423
+ }
18424
+ return {
18425
+ resolveHead: ctx.resolveHead,
18426
+ resolveById: ctx.resolveById,
18427
+ denyAll: ctx.denyAll,
18428
+ enqueueLocal: ctx.enqueueLocal
18429
+ };
18430
+ }
18431
+ function useSessionApprovalHead(sessionId) {
18432
+ const store = reactExports.useContext(HeadStoreContext);
18433
+ if (!store) {
18434
+ throw new Error("useSessionApprovalHead must be used within SafeModeProvider");
18435
+ }
18436
+ const subscribe2 = reactExports.useCallback((listener) => store.subscribe(sessionId, listener), [store, sessionId]);
18437
+ const getSnapshot2 = reactExports.useCallback(() => store.getHead(sessionId), [store, sessionId]);
18438
+ return reactExports.useSyncExternalStore(subscribe2, getSnapshot2, getSnapshot2);
18439
+ }
18400
18440
  function ComposerDock({ children }) {
18401
18441
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "zg-composer-dock flex flex-col gap-2", children });
18402
18442
  }
@@ -18408,7 +18448,7 @@ function DockCard({
18408
18448
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
18409
18449
  "div",
18410
18450
  {
18411
- className: `zg-attachment-row rounded-xl border px-3 py-2 ${tone === "attention" ? "border-[color-mix(in_srgb,var(--zg-warn)_35%,var(--zg-border))] bg-[color-mix(in_srgb,var(--zg-warn)_6%,var(--zg-bg-elevated))]" : "border-[var(--zg-border)] bg-[var(--zg-bg-elevated)]"} ${className}`,
18451
+ className: `zg-dock-card rounded-xl border px-3 py-2 ${tone === "attention" ? "border-[color-mix(in_srgb,var(--zg-warn)_35%,var(--zg-border))] bg-[color-mix(in_srgb,var(--zg-warn)_6%,var(--zg-bg-elevated))]" : "border-[var(--zg-border)] bg-[var(--zg-bg-elevated)]"} ${className}`,
18412
18452
  children
18413
18453
  }
18414
18454
  );
@@ -18451,6 +18491,14 @@ function DockIconButton({
18451
18491
  }
18452
18492
  );
18453
18493
  }
18494
+ function useCloseWhenResolved(stillPending) {
18495
+ const modal = useModal();
18496
+ reactExports.useEffect(() => {
18497
+ if (!stillPending) {
18498
+ modal.close();
18499
+ }
18500
+ }, [stillPending, modal]);
18501
+ }
18454
18502
  const BASE_NO_CLAMP = {};
18455
18503
  const DiffLines = reactExports.memo(({ lines, maxHeight }) => {
18456
18504
  const style2 = maxHeight ? { maxHeight: `${maxHeight}px` } : BASE_NO_CLAMP;
@@ -18480,11 +18528,12 @@ const TONE_CLS$1 = {
18480
18528
  primary: "bg-[var(--zg-accent)] hover:bg-[var(--zg-accent-hover)] text-white border-transparent focus-visible:ring-[var(--zg-accent)]",
18481
18529
  secondary: "bg-[var(--zg-bg)] hover:bg-[var(--zg-bg-hover)] text-[var(--zg-text)] border-[var(--zg-border)] focus-visible:ring-[var(--zg-accent)]",
18482
18530
  safelist: "bg-[var(--zg-bg)] hover:bg-[var(--zg-bg-hover)] text-[var(--zg-text)] border-[var(--zg-border)] focus-visible:ring-[var(--zg-accent)]",
18483
- danger: "bg-[#ef4444]/10 hover:bg-[#ef4444] text-[#ef4444] hover:text-white border-[#ef4444]/30 focus-visible:ring-[#ef4444]"
18531
+ danger: "bg-[color-mix(in_srgb,var(--zg-error)_12%,transparent)] hover:bg-[var(--zg-error)] text-[var(--zg-error)] hover:text-white border-[color-mix(in_srgb,var(--zg-error)_30%,transparent)] focus-visible:ring-[var(--zg-error)]"
18484
18532
  };
18485
18533
  function FileEditApprovalModal({ request }) {
18486
18534
  const modal = useModal();
18487
18535
  const { resolveById } = useSafeModeActions();
18536
+ useCloseWhenResolved(useSafeModeQueue().some((r2) => r2.id === request.id));
18488
18537
  const edit = request.edit;
18489
18538
  const preview = request.preview;
18490
18539
  const path2 = edit?.path ?? readPath(request.input);
@@ -18835,7 +18884,7 @@ function SingleHunkPreview({ edit, preview, path: path2, isWriteFile }) {
18835
18884
  "+",
18836
18885
  added
18837
18886
  ] }),
18838
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono tabular-nums text-[#ef4444]", children: [
18887
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono tabular-nums text-[var(--zg-error)]", children: [
18839
18888
  "−",
18840
18889
  removed
18841
18890
  ] })
@@ -18876,7 +18925,7 @@ function readPath(input) {
18876
18925
  }
18877
18926
  const PRIMARY = "zg-press inline-flex items-center h-8 px-3.5 rounded-md text-[13px] font-medium bg-[var(--zg-accent)] hover:bg-[var(--zg-accent-hover)] text-white border-0 cursor-pointer transition-colors duration-150 disabled:opacity-40 disabled:cursor-not-allowed focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--zg-accent)]";
18878
18927
  const SECONDARY = "zg-press inline-flex items-center h-8 px-3.5 rounded-md text-[13px] font-medium bg-[var(--zg-bg-hover)] hover:bg-[var(--zg-bg)] text-[var(--zg-text)] border border-[var(--zg-border)] cursor-pointer transition-colors duration-150 disabled:opacity-40 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--zg-accent)]";
18879
- const DESTRUCTIVE = "zg-press inline-flex items-center h-8 px-3.5 rounded-md text-[13px] font-medium bg-[#ef4444]/10 hover:bg-[#ef4444] text-[#ef4444] hover:text-white border border-[#ef4444]/30 cursor-pointer transition-colors duration-150 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#ef4444]";
18928
+ const DESTRUCTIVE = "zg-press inline-flex items-center h-8 px-3.5 rounded-md text-[13px] font-medium bg-[color-mix(in_srgb,var(--zg-error)_12%,transparent)] hover:bg-[var(--zg-error)] text-[var(--zg-error)] hover:text-white border border-[color-mix(in_srgb,var(--zg-error)_30%,transparent)] cursor-pointer transition-colors duration-150 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--zg-error)]";
18880
18929
  const FILE_EDIT_TOOLS = /* @__PURE__ */ new Set(["edit", "multi_edit", "write_file"]);
18881
18930
  function ApprovalBar({ sessionId }) {
18882
18931
  const head2 = useSessionApprovalHead(sessionId);
@@ -42896,6 +42945,7 @@ function useShikiHtml$1(code, language, enabled) {
42896
42945
  function AskUserModal({ request }) {
42897
42946
  const modal = useModal();
42898
42947
  const interactions = useInteractions();
42948
+ useCloseWhenResolved(interactions.pending.some((p2) => p2.request.id === request.id));
42899
42949
  const payload = request.payload;
42900
42950
  const [answers, setAnswers] = reactExports.useState(() => seedDefaults(payload));
42901
42951
  const [busy, setBusy] = reactExports.useState(false);
@@ -43117,6 +43167,7 @@ const BTN_DANGER$2 = "zg-press h-8 px-3.5 rounded-md text-[13px] font-medium bg-
43117
43167
  function PresentPlanModal({ request }) {
43118
43168
  const modal = useModal();
43119
43169
  const interactions = useInteractions();
43170
+ useCloseWhenResolved(interactions.pending.some((p2) => p2.request.id === request.id));
43120
43171
  const [decision, setDecision] = reactExports.useState(null);
43121
43172
  const [comment2, setComment] = reactExports.useState("");
43122
43173
  const [busy, setBusy] = reactExports.useState(false);
@@ -74712,7 +74763,7 @@ const TODO_STATUS_GLYPHS = {
74712
74763
  cancelled: "☒"
74713
74764
  };
74714
74765
  const INPUT_CLS = "flex-1 min-w-0 font-mono text-sm bg-[var(--zg-bg)] border border-[var(--zg-border)] rounded-md px-3 py-1.5 text-[var(--zg-text)] outline-none focus:border-[var(--zg-accent)] focus:ring-2 focus:ring-[var(--zg-accent)]/20";
74715
- const GHOST_BTN$1 = "zg-press h-7 px-2 rounded-md text-xs text-[var(--zg-text-muted)] hover:text-[var(--zg-text)] hover:bg-[var(--zg-bg-hover)] border-0 bg-transparent cursor-pointer transition-colors duration-150 disabled:opacity-40 disabled:cursor-not-allowed";
74766
+ const GHOST_BTN$2 = "zg-press h-7 px-2 rounded-md text-xs text-[var(--zg-text-muted)] hover:text-[var(--zg-text)] hover:bg-[var(--zg-bg-hover)] border-0 bg-transparent cursor-pointer transition-colors duration-150 disabled:opacity-40 disabled:cursor-not-allowed";
74716
74767
  function TodosModal({ sessionId }) {
74717
74768
  const snap = useTodosFor(sessionId);
74718
74769
  const { close: close2 } = useModal();
@@ -74789,7 +74840,7 @@ function TodosModal({ sessionId }) {
74789
74840
  "button",
74790
74841
  {
74791
74842
  type: "button",
74792
- className: `${GHOST_BTN$1} text-[var(--zg-error)]`,
74843
+ className: `${GHOST_BTN$2} text-[var(--zg-error)]`,
74793
74844
  onClick: () => {
74794
74845
  commit(clearTodos());
74795
74846
  setConfirmClear(false);
@@ -74797,12 +74848,12 @@ function TodosModal({ sessionId }) {
74797
74848
  children: "Yes"
74798
74849
  }
74799
74850
  ),
74800
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN$1, onClick: () => setConfirmClear(false), children: "Cancel" })
74851
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN$2, onClick: () => setConfirmClear(false), children: "Cancel" })
74801
74852
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
74802
74853
  "button",
74803
74854
  {
74804
74855
  type: "button",
74805
- className: GHOST_BTN$1,
74856
+ className: GHOST_BTN$2,
74806
74857
  disabled: base2.length === 0,
74807
74858
  onClick: () => setConfirmClear(true),
74808
74859
  title: "Remove every todo from the live list",
@@ -74900,7 +74951,7 @@ function TodosModal({ sessionId }) {
74900
74951
  className: INPUT_CLS
74901
74952
  }
74902
74953
  ),
74903
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN$1, disabled: adding.trim().length === 0, onClick: submitAdd, children: "Add" })
74954
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN$2, disabled: adding.trim().length === 0, onClick: submitAdd, children: "Add" })
74904
74955
  ] })
74905
74956
  ] })
74906
74957
  }
@@ -74935,7 +74986,7 @@ function TodoIndicator({ sessionId }) {
74935
74986
  const total = list2.length;
74936
74987
  const done = snap.tally.completed + snap.tally.cancelled;
74937
74988
  const headline = snap.inProgress ?? list2.find((t) => t.status === "in_progress") ?? list2.find((t) => t.status === "pending") ?? list2[0];
74938
- return /* @__PURE__ */ jsxRuntimeExports.jsx(DockCard, { className: "zg-press-soft cursor-pointer hover:bg-[var(--zg-bg-hover)] transition-colors duration-150", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
74989
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(DockCard, { className: "cursor-pointer hover:bg-[var(--zg-bg-hover)] transition-colors duration-150", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
74939
74990
  "button",
74940
74991
  {
74941
74992
  type: "button",
@@ -84410,10 +84461,16 @@ function deriveDotState(input) {
84410
84461
  }
84411
84462
  function SessionStatusDotInner({ sessionId, override }) {
84412
84463
  const running = useSessionRunning(sessionId);
84413
- const pending = useSessionApprovalHead(sessionId);
84464
+ const pendingApproval = useSessionApprovalHead(sessionId);
84465
+ const pendingInteraction = useInteractions().headFor(sessionId);
84414
84466
  const notification = useSessionNotification(sessionId);
84415
84467
  const presence = useSessionPresence(sessionId);
84416
- const state = override ?? deriveDotState({ pending: Boolean(pending), running, notification, presence });
84468
+ const state = override ?? deriveDotState({
84469
+ pending: Boolean(pendingApproval) || Boolean(pendingInteraction),
84470
+ running,
84471
+ notification,
84472
+ presence
84473
+ });
84417
84474
  const cfg = STYLES[state];
84418
84475
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
84419
84476
  "span",
@@ -87180,7 +87237,8 @@ const SECTIONS = [
87180
87237
  { action: "cycleAgent", label: "Cycle agent (Build / Plan)" },
87181
87238
  { action: "openModelPicker", label: "Switch model" },
87182
87239
  { action: "openEffortPicker", label: "Reasoning effort" },
87183
- { action: "openTodos", label: "Todo list" }
87240
+ { action: "openTodos", label: "Todo list" },
87241
+ { action: "openArtifacts", label: "Artifacts" }
87184
87242
  ]
87185
87243
  },
87186
87244
  {
@@ -90894,6 +90952,43 @@ const PANEL_SEARCH_ENTRIES = [
90894
90952
  { tab: "authentication", label: "Authentication", description: "Sign in to providers — API keys and OAuth." },
90895
90953
  { tab: "logs", label: "Logs", description: "Extension warnings, MCP diagnostics and host debug lines." }
90896
90954
  ];
90955
+ function AppVersion() {
90956
+ const [version, setVersion] = reactExports.useState(null);
90957
+ const [copied, setCopied] = reactExports.useState(false);
90958
+ reactExports.useEffect(() => {
90959
+ let cancelled = false;
90960
+ void window.api.app.version().then((v2) => {
90961
+ if (!cancelled) {
90962
+ setVersion(v2);
90963
+ }
90964
+ });
90965
+ return () => {
90966
+ cancelled = true;
90967
+ };
90968
+ }, []);
90969
+ reactExports.useEffect(() => {
90970
+ if (!copied) {
90971
+ return;
90972
+ }
90973
+ const t = setTimeout(() => setCopied(false), 1200);
90974
+ return () => clearTimeout(t);
90975
+ }, [copied]);
90976
+ if (!version) {
90977
+ return null;
90978
+ }
90979
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
90980
+ "button",
90981
+ {
90982
+ type: "button",
90983
+ onClick: () => {
90984
+ void navigator.clipboard.writeText(version).then(() => setCopied(true));
90985
+ },
90986
+ title: "Copy version",
90987
+ className: "mt-2 shrink-0 h-7 px-2.5 w-full text-left text-[11px] font-mono tabular-nums text-[var(--zg-text-muted)] bg-transparent border-0 rounded-md cursor-pointer hover:bg-[var(--zg-bg-hover)] hover:text-[var(--zg-text)] transition-colors duration-150 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--zg-accent)]",
90988
+ children: copied ? "copied" : `Zidane ${version}`
90989
+ }
90990
+ );
90991
+ }
90897
90992
  function SettingsModal({ onClose, cwd: cwd2, actions = [], initialTab = "general", onCreateExtension }) {
90898
90993
  const { settings, toggle, setSetting } = useSettings();
90899
90994
  const [extensionThemes, setExtensionThemes] = reactExports.useState([]);
@@ -91135,38 +91230,41 @@ function SettingsModal({ onClose, cwd: cwd2, actions = [], initialTab = "general
91135
91230
  size: "xxlarge",
91136
91231
  scrollBody: false,
91137
91232
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 h-[min(76vh,640px)] max-h-full min-h-0", children: [
91138
- /* @__PURE__ */ jsxRuntimeExports.jsx(
91139
- "nav",
91140
- {
91141
- role: "tablist",
91142
- "aria-orientation": "vertical",
91143
- "aria-label": "Settings sections",
91144
- className: "w-44 shrink-0 space-y-0.5 min-h-0 overflow-y-auto",
91145
- onKeyDown: onRailKeyDown,
91146
- children: TABS.map((tab2) => {
91147
- const active = tab2.id === activeTab;
91148
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
91149
- "button",
91150
- {
91151
- ref: (el) => {
91152
- tabRefs.current[tab2.id] = el;
91233
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-44 shrink-0 flex flex-col min-h-0", children: [
91234
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
91235
+ "nav",
91236
+ {
91237
+ role: "tablist",
91238
+ "aria-orientation": "vertical",
91239
+ "aria-label": "Settings sections",
91240
+ className: "flex-1 space-y-0.5 min-h-0 overflow-y-auto",
91241
+ onKeyDown: onRailKeyDown,
91242
+ children: TABS.map((tab2) => {
91243
+ const active = tab2.id === activeTab;
91244
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
91245
+ "button",
91246
+ {
91247
+ ref: (el) => {
91248
+ tabRefs.current[tab2.id] = el;
91249
+ },
91250
+ type: "button",
91251
+ role: "tab",
91252
+ "aria-selected": active,
91253
+ tabIndex: active ? 0 : -1,
91254
+ onClick: () => selectTab(tab2.id),
91255
+ className: `zg-press-subtle flex items-center gap-2.5 w-full h-8 text-left px-2.5 rounded-md border-0 cursor-pointer text-[13px] transition-colors duration-150 ${active ? "bg-[var(--zg-bg-hover)] text-[var(--zg-text)] font-medium" : "bg-transparent text-[var(--zg-text-muted)] hover:bg-[var(--zg-bg-hover)] hover:text-[var(--zg-text)]"}`,
91256
+ children: [
91257
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `${tab2.icon} text-sm shrink-0 ${active ? "text-[var(--zg-accent)]" : ""}` }),
91258
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate", children: tab2.label })
91259
+ ]
91153
91260
  },
91154
- type: "button",
91155
- role: "tab",
91156
- "aria-selected": active,
91157
- tabIndex: active ? 0 : -1,
91158
- onClick: () => selectTab(tab2.id),
91159
- className: `zg-press-subtle flex items-center gap-2.5 w-full h-8 text-left px-2.5 rounded-md border-0 cursor-pointer text-[13px] transition-colors duration-150 ${active ? "bg-[var(--zg-bg-hover)] text-[var(--zg-text)] font-medium" : "bg-transparent text-[var(--zg-text-muted)] hover:bg-[var(--zg-bg-hover)] hover:text-[var(--zg-text)]"}`,
91160
- children: [
91161
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `${tab2.icon} text-sm shrink-0 ${active ? "text-[var(--zg-accent)]" : ""}` }),
91162
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate", children: tab2.label })
91163
- ]
91164
- },
91165
- tab2.id
91166
- );
91167
- })
91168
- }
91169
- ),
91261
+ tab2.id
91262
+ );
91263
+ })
91264
+ }
91265
+ ),
91266
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AppVersion, {})
91267
+ ] }),
91170
91268
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0 min-h-0 flex flex-col", children: [
91171
91269
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "shrink-0 flex items-center justify-between gap-3 pb-3", children: [
91172
91270
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative w-72 max-w-full", children: [
@@ -91255,6 +91353,215 @@ function nextOption(row, current) {
91255
91353
  const next = row.options[(idx + 1) % row.options.length];
91256
91354
  return next.value;
91257
91355
  }
91356
+ const ArtifactsContext = reactExports.createContext(null);
91357
+ function ArtifactsProvider({ children }) {
91358
+ const [byId, setById] = reactExports.useState(() => /* @__PURE__ */ new Map());
91359
+ const pending = reactExports.useRef(/* @__PURE__ */ new Set());
91360
+ const fetch = reactExports.useCallback(async (sessionId) => {
91361
+ const groups = await window.api.artifacts.list({ sessionId });
91362
+ setById((prev) => {
91363
+ const next = new Map(prev);
91364
+ next.set(sessionId, groups);
91365
+ return next;
91366
+ });
91367
+ }, []);
91368
+ reactExports.useEffect(() => {
91369
+ return window.api.chat.onStreamSignal((signal) => {
91370
+ if (signal.kind !== "artifact:recorded" && signal.kind !== "artifact:changed") return;
91371
+ const { sessionId } = signal;
91372
+ if (pending.current.has(sessionId)) return;
91373
+ pending.current.add(sessionId);
91374
+ queueMicrotask(() => {
91375
+ pending.current.delete(sessionId);
91376
+ void fetch(sessionId).catch(() => void 0);
91377
+ });
91378
+ });
91379
+ }, [fetch]);
91380
+ const groupsFor = reactExports.useCallback(
91381
+ (sessionId) => sessionId ? byId.get(sessionId) ?? null : null,
91382
+ [byId]
91383
+ );
91384
+ const value = reactExports.useMemo(() => ({ groupsFor, fetch }), [groupsFor, fetch]);
91385
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ArtifactsContext.Provider, { value, children });
91386
+ }
91387
+ function useArtifactsFor(sessionId) {
91388
+ const ctx = reactExports.useContext(ArtifactsContext);
91389
+ if (!ctx) throw new Error("useArtifactsFor must be used within ArtifactsProvider");
91390
+ return ctx.groupsFor(sessionId);
91391
+ }
91392
+ function useArtifactsFetcher() {
91393
+ const ctx = reactExports.useContext(ArtifactsContext);
91394
+ if (!ctx) throw new Error("useArtifactsFetcher must be used within ArtifactsProvider");
91395
+ return ctx.fetch;
91396
+ }
91397
+ function countArtifacts(groups) {
91398
+ return groups ? groups.reduce((n, g) => n + g.rows.length, 0) : 0;
91399
+ }
91400
+ const GHOST_BTN$1 = "zg-press h-7 px-2 rounded-md text-xs text-[var(--zg-text-muted)] hover:text-[var(--zg-text)] hover:bg-[var(--zg-bg-hover)] border-0 bg-transparent cursor-pointer transition-colors duration-150 disabled:opacity-40 disabled:cursor-not-allowed";
91401
+ const TAB_BTN = (active) => `zg-press h-7 px-2.5 rounded-md text-xs border-0 cursor-pointer transition-colors duration-150 ${active ? "bg-[var(--zg-bg-hover)] text-[var(--zg-text)]" : "bg-transparent text-[var(--zg-text-muted)] hover:text-[var(--zg-text)]"}`;
91402
+ function ArtifactsModal({ sessionId, projectRoot, sessionTitle }) {
91403
+ const { close: close2 } = useModal();
91404
+ const cached = useArtifactsFor(sessionId);
91405
+ const fetchSession = useArtifactsFetcher();
91406
+ const [scope, setScope] = reactExports.useState("session");
91407
+ const [project, setProject] = reactExports.useState(null);
91408
+ const [error, setError] = reactExports.useState(null);
91409
+ reactExports.useEffect(() => {
91410
+ void fetchSession(sessionId).catch((err) => setError(err.message));
91411
+ }, [fetchSession, sessionId]);
91412
+ const loadProject = reactExports.useCallback(async () => {
91413
+ if (!projectRoot) return;
91414
+ try {
91415
+ setProject(await window.api.artifacts.list({ projectRoot }));
91416
+ } catch (err) {
91417
+ setError(err.message);
91418
+ }
91419
+ }, [projectRoot]);
91420
+ reactExports.useEffect(() => {
91421
+ if (scope !== "project") return;
91422
+ void loadProject();
91423
+ return window.api.chat.onStreamSignal((signal) => {
91424
+ if (signal.kind === "artifact:recorded" || signal.kind === "artifact:changed") void loadProject();
91425
+ });
91426
+ }, [scope, loadProject]);
91427
+ const groups = scope === "project" ? project : cached;
91428
+ const total = countArtifacts(groups);
91429
+ const refreshed = reactExports.useRef(/* @__PURE__ */ new Set());
91430
+ const refresh = reactExports.useCallback((row) => {
91431
+ if (refreshed.current.has(row.artifact.id)) return;
91432
+ refreshed.current.add(row.artifact.id);
91433
+ void window.api.artifacts.refresh(row.artifact).catch(() => void 0);
91434
+ }, []);
91435
+ const remove = reactExports.useCallback(
91436
+ (row) => {
91437
+ setError(null);
91438
+ void window.api.artifacts.delete(row.artifact.sessionId, row.artifact.id).then((ok2) => {
91439
+ if (!ok2) setError("This session store does not support artifacts.");
91440
+ else if (scope === "project") void loadProject();
91441
+ }).catch((err) => setError(err.message));
91442
+ },
91443
+ [scope, loadProject]
91444
+ );
91445
+ const description = reactExports.useMemo(() => {
91446
+ if (groups === null) return "Loading…";
91447
+ if (total === 0) {
91448
+ return scope === "project" ? `No artifacts recorded for ${projectRoot} yet.` : "No artifacts yet — pull requests, branches, commits and created files land here as the agent produces them.";
91449
+ }
91450
+ return groups.map((g) => `${g.rows.length} ${plural(g.label, g.rows.length)}`).join(" · ");
91451
+ }, [groups, total, scope, projectRoot]);
91452
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
91453
+ ModalShell,
91454
+ {
91455
+ title: "Artifacts",
91456
+ description,
91457
+ onClose: close2,
91458
+ size: "medium",
91459
+ footer: projectRoot ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 w-full", children: [
91460
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: TAB_BTN(scope === "session"), onClick: () => setScope("session"), children: "This session" }),
91461
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
91462
+ "button",
91463
+ {
91464
+ type: "button",
91465
+ className: TAB_BTN(scope === "project"),
91466
+ onClick: () => setScope("project"),
91467
+ title: `Every session under ${projectRoot}`,
91468
+ children: "Project"
91469
+ }
91470
+ )
91471
+ ] }) : void 0,
91472
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3 p-4", children: [
91473
+ error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-[var(--zg-warn)] px-1", role: "alert", children: error }),
91474
+ groups && total > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-3 overflow-y-auto", children: groups.map((group) => /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "flex flex-col gap-1.5", children: [
91475
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "m-0 text-[11px] uppercase tracking-wide text-[var(--zg-text-muted)] px-1", children: group.rows.length === 1 ? group.label : `${group.label}s` }),
91476
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "flex flex-col gap-1.5 m-0 list-none p-0", children: group.rows.map((row) => /* @__PURE__ */ jsxRuntimeExports.jsx(
91477
+ ArtifactRow,
91478
+ {
91479
+ row,
91480
+ showSession: scope === "project",
91481
+ sessionTitle,
91482
+ onFocus: () => refresh(row),
91483
+ onRemove: () => remove(row)
91484
+ },
91485
+ row.artifact.id
91486
+ )) })
91487
+ ] }, group.kind)) })
91488
+ ] })
91489
+ }
91490
+ );
91491
+ }
91492
+ function ArtifactRow({
91493
+ row,
91494
+ showSession,
91495
+ sessionTitle,
91496
+ onFocus,
91497
+ onRemove
91498
+ }) {
91499
+ const { artifact, row: view } = row;
91500
+ const href = view.href;
91501
+ const isUrl2 = href !== void 0 && /^https?:\/\//.test(href);
91502
+ const session = showSession ? sessionTitle?.(artifact.sessionId) ?? artifact.sessionId.slice(0, 8) : void 0;
91503
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
91504
+ "li",
91505
+ {
91506
+ className: "group flex items-start gap-3 px-3 py-2 rounded-md bg-[var(--zg-bg)] border border-[var(--zg-border)]",
91507
+ onMouseEnter: onFocus,
91508
+ onFocus,
91509
+ children: [
91510
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0 flex flex-col gap-0.5", children: [
91511
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
91512
+ isUrl2 ? (
91513
+ // `target="_blank"` routes through main's window-open handler → `shell.openExternal`.
91514
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
91515
+ "a",
91516
+ {
91517
+ href,
91518
+ target: "_blank",
91519
+ rel: "noreferrer",
91520
+ className: "truncate text-sm text-[var(--zg-text)] hover:text-[var(--zg-accent)] no-underline hover:underline",
91521
+ title: href,
91522
+ children: view.title
91523
+ }
91524
+ )
91525
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-sm text-[var(--zg-text)]", title: href ?? artifact.uri, children: view.title }),
91526
+ view.status && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 text-[10px] uppercase tracking-wide px-1.5 py-0.5 rounded bg-[var(--zg-bg-hover)] text-[var(--zg-text-muted)]", children: view.status }),
91527
+ session && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "shrink-0 text-xs text-[var(--zg-text-muted)]", children: [
91528
+ "— ",
91529
+ session
91530
+ ] })
91531
+ ] }),
91532
+ view.subtitle && view.subtitle !== view.title && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "truncate text-xs text-[var(--zg-text-muted)] font-mono", title: view.subtitle, children: view.subtitle })
91533
+ ] }),
91534
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
91535
+ "button",
91536
+ {
91537
+ type: "button",
91538
+ "aria-label": "Copy locator",
91539
+ title: "Copy",
91540
+ onClick: () => void navigator.clipboard.writeText(href ?? artifact.uri),
91541
+ className: `${GHOST_BTN$1} opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,
91542
+ children: "copy"
91543
+ }
91544
+ ),
91545
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
91546
+ "button",
91547
+ {
91548
+ type: "button",
91549
+ "aria-label": "Remove artifact",
91550
+ title: "Remove from this session",
91551
+ onClick: onRemove,
91552
+ className: "opacity-0 group-hover:opacity-100 focus-visible:opacity-100 text-[var(--zg-text-muted)] hover:text-[var(--zg-error)] bg-transparent border-0 p-0 cursor-pointer text-base leading-6 transition-opacity",
91553
+ children: "×"
91554
+ }
91555
+ )
91556
+ ]
91557
+ }
91558
+ );
91559
+ }
91560
+ function plural(label, count2) {
91561
+ const lower2 = label.toLowerCase();
91562
+ if (count2 === 1) return lower2;
91563
+ return /(?:s|x|ch|sh)$/.test(lower2) ? `${lower2}es` : `${lower2}s`;
91564
+ }
91258
91565
  const TONE_CLS = {
91259
91566
  ok: "text-[var(--zg-accent)]",
91260
91567
  warn: "text-[#f59e0b]",
@@ -91697,7 +92004,6 @@ function formatElapsed(ms) {
91697
92004
  function AppShell() {
91698
92005
  useNativeChromeZoomVar();
91699
92006
  const { sessions, activeSessionId, setActiveSessionId, defaultFolder, refresh: refreshSessions } = useSessions();
91700
- const queue = useSafeModeQueue();
91701
92007
  const interactions = useInteractions();
91702
92008
  const modal = useModal();
91703
92009
  const modalIsOpenRef = reactExports.useRef(modal.isOpen);
@@ -91832,15 +92138,6 @@ function AppShell() {
91832
92138
  setRunningWork([]);
91833
92139
  };
91834
92140
  }, [activeSessionId]);
91835
- reactExports.useEffect(() => {
91836
- if (activeSessionId) {
91837
- return;
91838
- }
91839
- const pending = queue.find((r2) => r2.sessionId && sessions.some((s2) => s2.id === r2.sessionId));
91840
- if (pending?.sessionId) {
91841
- setActiveSessionId(pending.sessionId);
91842
- }
91843
- }, [activeSessionId, queue, sessions, setActiveSessionId]);
91844
92141
  const autoOpenedInteractionRef = reactExports.useRef(null);
91845
92142
  reactExports.useEffect(() => {
91846
92143
  if (modal.isOpen) {
@@ -91857,15 +92154,6 @@ function AppShell() {
91857
92154
  modal.open(/* @__PURE__ */ jsxRuntimeExports.jsx(AskUserModal, { request: head2.request }, head2.request.id));
91858
92155
  }
91859
92156
  }, [interactions, activeSessionId, modal]);
91860
- reactExports.useEffect(() => {
91861
- if (activeSessionId) {
91862
- return;
91863
- }
91864
- const head2 = interactions.pending.find((p2) => p2.live && sessions.some((s2) => s2.id === p2.sessionId));
91865
- if (head2) {
91866
- setActiveSessionId(head2.sessionId);
91867
- }
91868
- }, [activeSessionId, interactions.pending, sessions, setActiveSessionId]);
91869
92157
  reactExports.useEffect(() => {
91870
92158
  let cancelled = false;
91871
92159
  void window.api.auth.hasAny().then((hasAny) => {
@@ -92140,6 +92428,22 @@ function AppShell() {
92140
92428
  }
92141
92429
  modal.open(/* @__PURE__ */ jsxRuntimeExports.jsx(TodosModal, { sessionId: activeSession.id }));
92142
92430
  }, [modal, activeSession]);
92431
+ const openArtifacts = reactExports.useCallback(() => {
92432
+ if (!activeSession) {
92433
+ return;
92434
+ }
92435
+ const projectRoot = activeSession.projectRoot ?? activeSession.cwd;
92436
+ modal.open(
92437
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
92438
+ ArtifactsModal,
92439
+ {
92440
+ sessionId: activeSession.id,
92441
+ ...projectRoot ? { projectRoot } : {},
92442
+ sessionTitle: (id) => sessions.find((s2) => s2.id === id)?.title
92443
+ }
92444
+ )
92445
+ );
92446
+ }, [modal, activeSession, sessions]);
92143
92447
  const openUsagePanel = reactExports.useCallback(() => {
92144
92448
  modal.open(/* @__PURE__ */ jsxRuntimeExports.jsx(UsagePanelModal, { activeProviderKey: activeSession?.providerKey ?? null }));
92145
92449
  }, [modal, activeSession]);
@@ -92272,6 +92576,7 @@ function AppShell() {
92272
92576
  ...activeSession ? { openEffortPicker } : {},
92273
92577
  ...activeSession ? { openModelPicker } : {},
92274
92578
  ...activeSession ? { openTodos } : {},
92579
+ ...activeSession ? { openArtifacts } : {},
92275
92580
  openUsagePanel,
92276
92581
  openMainSession,
92277
92582
  newSession: () => setActiveSessionId(null),
@@ -92293,6 +92598,7 @@ function AppShell() {
92293
92598
  openEffortPicker,
92294
92599
  openModelPicker,
92295
92600
  openTodos,
92601
+ openArtifacts,
92296
92602
  openUsagePanel,
92297
92603
  openMainSession,
92298
92604
  setActiveSessionId,
@@ -92483,7 +92789,7 @@ function McpAuthProvider({ children }) {
92483
92789
  return /* @__PURE__ */ jsxRuntimeExports.jsx(McpAuthContext.Provider, { value, children });
92484
92790
  }
92485
92791
  function AppProviders({ children }) {
92486
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { delayDuration: 300, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsProvider, { 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(MessageQueueProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(PromptHistoryProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SelectTurnProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(InteractionsProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(SessionsProvider, { children }) }) }) }) }) }) }) }) }) }) }) }) }) });
92792
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Provider, { delayDuration: 300, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SettingsProvider, { 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 }) }) }) }) }) }) }) }) }) }) }) }) }) }) });
92487
92793
  }
92488
92794
  function ThemedShell({ children }) {
92489
92795
  const { settings } = useSettings();