zidane-gui 7.0.13 → 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,17 +17676,15 @@ 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
- /*
17847
- * Canonical default is `ctrl+u` — reserved there because `ctrl+i`
17848
- * is the Tab byte (0x09) in terminals and can never reach a TUI
17849
- * keyboard handler as its own chord. Electron has no such constraint,
17850
- * so the GUI takes the `cmd+i` mnemonic ("main") — ⌘ like every other
17851
- * GUI nav chord (`cmd+n`, `cmd+b`), so the sidebar hints read as one
17852
- * family. Declared as a divergence in `parity.test.ts`.
17853
- */
17854
- default: "cmd+i",
17687
+ default: "ctrl+shift+m",
17855
17688
  label: "Jump to main session",
17856
17689
  description: 'jump to (or lazily create) the pinned "Main" orchestration session for the active directory'
17857
17690
  },
@@ -18405,6 +18238,205 @@ function formatKey(key2) {
18405
18238
  const lower2 = key2.toLowerCase();
18406
18239
  return KeySymbols[lower2] || key2;
18407
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
+ }
18408
18440
  function ComposerDock({ children }) {
18409
18441
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "zg-composer-dock flex flex-col gap-2", children });
18410
18442
  }
@@ -18416,7 +18448,7 @@ function DockCard({
18416
18448
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
18417
18449
  "div",
18418
18450
  {
18419
- 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}`,
18420
18452
  children
18421
18453
  }
18422
18454
  );
@@ -18459,6 +18491,14 @@ function DockIconButton({
18459
18491
  }
18460
18492
  );
18461
18493
  }
18494
+ function useCloseWhenResolved(stillPending) {
18495
+ const modal = useModal();
18496
+ reactExports.useEffect(() => {
18497
+ if (!stillPending) {
18498
+ modal.close();
18499
+ }
18500
+ }, [stillPending, modal]);
18501
+ }
18462
18502
  const BASE_NO_CLAMP = {};
18463
18503
  const DiffLines = reactExports.memo(({ lines, maxHeight }) => {
18464
18504
  const style2 = maxHeight ? { maxHeight: `${maxHeight}px` } : BASE_NO_CLAMP;
@@ -18488,11 +18528,12 @@ const TONE_CLS$1 = {
18488
18528
  primary: "bg-[var(--zg-accent)] hover:bg-[var(--zg-accent-hover)] text-white border-transparent focus-visible:ring-[var(--zg-accent)]",
18489
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)]",
18490
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)]",
18491
- 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)]"
18492
18532
  };
18493
18533
  function FileEditApprovalModal({ request }) {
18494
18534
  const modal = useModal();
18495
18535
  const { resolveById } = useSafeModeActions();
18536
+ useCloseWhenResolved(useSafeModeQueue().some((r2) => r2.id === request.id));
18496
18537
  const edit = request.edit;
18497
18538
  const preview = request.preview;
18498
18539
  const path2 = edit?.path ?? readPath(request.input);
@@ -18843,7 +18884,7 @@ function SingleHunkPreview({ edit, preview, path: path2, isWriteFile }) {
18843
18884
  "+",
18844
18885
  added
18845
18886
  ] }),
18846
- /* @__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: [
18847
18888
  "−",
18848
18889
  removed
18849
18890
  ] })
@@ -18884,7 +18925,7 @@ function readPath(input) {
18884
18925
  }
18885
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)]";
18886
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)]";
18887
- 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)]";
18888
18929
  const FILE_EDIT_TOOLS = /* @__PURE__ */ new Set(["edit", "multi_edit", "write_file"]);
18889
18930
  function ApprovalBar({ sessionId }) {
18890
18931
  const head2 = useSessionApprovalHead(sessionId);
@@ -42904,6 +42945,7 @@ function useShikiHtml$1(code, language, enabled) {
42904
42945
  function AskUserModal({ request }) {
42905
42946
  const modal = useModal();
42906
42947
  const interactions = useInteractions();
42948
+ useCloseWhenResolved(interactions.pending.some((p2) => p2.request.id === request.id));
42907
42949
  const payload = request.payload;
42908
42950
  const [answers, setAnswers] = reactExports.useState(() => seedDefaults(payload));
42909
42951
  const [busy, setBusy] = reactExports.useState(false);
@@ -43125,6 +43167,7 @@ const BTN_DANGER$2 = "zg-press h-8 px-3.5 rounded-md text-[13px] font-medium bg-
43125
43167
  function PresentPlanModal({ request }) {
43126
43168
  const modal = useModal();
43127
43169
  const interactions = useInteractions();
43170
+ useCloseWhenResolved(interactions.pending.some((p2) => p2.request.id === request.id));
43128
43171
  const [decision, setDecision] = reactExports.useState(null);
43129
43172
  const [comment2, setComment] = reactExports.useState("");
43130
43173
  const [busy, setBusy] = reactExports.useState(false);
@@ -74720,7 +74763,7 @@ const TODO_STATUS_GLYPHS = {
74720
74763
  cancelled: "☒"
74721
74764
  };
74722
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";
74723
- 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";
74724
74767
  function TodosModal({ sessionId }) {
74725
74768
  const snap = useTodosFor(sessionId);
74726
74769
  const { close: close2 } = useModal();
@@ -74797,7 +74840,7 @@ function TodosModal({ sessionId }) {
74797
74840
  "button",
74798
74841
  {
74799
74842
  type: "button",
74800
- className: `${GHOST_BTN$1} text-[var(--zg-error)]`,
74843
+ className: `${GHOST_BTN$2} text-[var(--zg-error)]`,
74801
74844
  onClick: () => {
74802
74845
  commit(clearTodos());
74803
74846
  setConfirmClear(false);
@@ -74805,12 +74848,12 @@ function TodosModal({ sessionId }) {
74805
74848
  children: "Yes"
74806
74849
  }
74807
74850
  ),
74808
- /* @__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" })
74809
74852
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
74810
74853
  "button",
74811
74854
  {
74812
74855
  type: "button",
74813
- className: GHOST_BTN$1,
74856
+ className: GHOST_BTN$2,
74814
74857
  disabled: base2.length === 0,
74815
74858
  onClick: () => setConfirmClear(true),
74816
74859
  title: "Remove every todo from the live list",
@@ -74908,7 +74951,7 @@ function TodosModal({ sessionId }) {
74908
74951
  className: INPUT_CLS
74909
74952
  }
74910
74953
  ),
74911
- /* @__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" })
74912
74955
  ] })
74913
74956
  ] })
74914
74957
  }
@@ -74943,7 +74986,7 @@ function TodoIndicator({ sessionId }) {
74943
74986
  const total = list2.length;
74944
74987
  const done = snap.tally.completed + snap.tally.cancelled;
74945
74988
  const headline = snap.inProgress ?? list2.find((t) => t.status === "in_progress") ?? list2.find((t) => t.status === "pending") ?? list2[0];
74946
- 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(
74947
74990
  "button",
74948
74991
  {
74949
74992
  type: "button",
@@ -84418,10 +84461,16 @@ function deriveDotState(input) {
84418
84461
  }
84419
84462
  function SessionStatusDotInner({ sessionId, override }) {
84420
84463
  const running = useSessionRunning(sessionId);
84421
- const pending = useSessionApprovalHead(sessionId);
84464
+ const pendingApproval = useSessionApprovalHead(sessionId);
84465
+ const pendingInteraction = useInteractions().headFor(sessionId);
84422
84466
  const notification = useSessionNotification(sessionId);
84423
84467
  const presence = useSessionPresence(sessionId);
84424
- 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
+ });
84425
84474
  const cfg = STYLES[state];
84426
84475
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
84427
84476
  "span",
@@ -86379,7 +86428,7 @@ const MainSessionRow = reactExports.memo(({ sessionId, isActive: isActive2, coll
86379
86428
  type: "button",
86380
86429
  className: "zg-press w-full bg-transparent border-0 cursor-pointer rounded-md p-0 transition-colors duration-150",
86381
86430
  onClick: handleSelect,
86382
- title: "Main (⌘I)",
86431
+ title: "Main (⌃⇧M)",
86383
86432
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
86384
86433
  "span",
86385
86434
  {
@@ -86410,7 +86459,7 @@ const MainSessionRow = reactExports.memo(({ sessionId, isActive: isActive2, coll
86410
86459
  /* @__PURE__ */ jsxRuntimeExports.jsx(
86411
86460
  KeyHint,
86412
86461
  {
86413
- spec: "cmd+i",
86462
+ spec: "ctrl+shift+m",
86414
86463
  className: "shrink-0 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 transition-opacity duration-150"
86415
86464
  }
86416
86465
  )
@@ -87188,7 +87237,8 @@ const SECTIONS = [
87188
87237
  { action: "cycleAgent", label: "Cycle agent (Build / Plan)" },
87189
87238
  { action: "openModelPicker", label: "Switch model" },
87190
87239
  { action: "openEffortPicker", label: "Reasoning effort" },
87191
- { action: "openTodos", label: "Todo list" }
87240
+ { action: "openTodos", label: "Todo list" },
87241
+ { action: "openArtifacts", label: "Artifacts" }
87192
87242
  ]
87193
87243
  },
87194
87244
  {
@@ -90902,6 +90952,43 @@ const PANEL_SEARCH_ENTRIES = [
90902
90952
  { tab: "authentication", label: "Authentication", description: "Sign in to providers — API keys and OAuth." },
90903
90953
  { tab: "logs", label: "Logs", description: "Extension warnings, MCP diagnostics and host debug lines." }
90904
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
+ }
90905
90992
  function SettingsModal({ onClose, cwd: cwd2, actions = [], initialTab = "general", onCreateExtension }) {
90906
90993
  const { settings, toggle, setSetting } = useSettings();
90907
90994
  const [extensionThemes, setExtensionThemes] = reactExports.useState([]);
@@ -91143,38 +91230,41 @@ function SettingsModal({ onClose, cwd: cwd2, actions = [], initialTab = "general
91143
91230
  size: "xxlarge",
91144
91231
  scrollBody: false,
91145
91232
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex gap-4 h-[min(76vh,640px)] max-h-full min-h-0", children: [
91146
- /* @__PURE__ */ jsxRuntimeExports.jsx(
91147
- "nav",
91148
- {
91149
- role: "tablist",
91150
- "aria-orientation": "vertical",
91151
- "aria-label": "Settings sections",
91152
- className: "w-44 shrink-0 space-y-0.5 min-h-0 overflow-y-auto",
91153
- onKeyDown: onRailKeyDown,
91154
- children: TABS.map((tab2) => {
91155
- const active = tab2.id === activeTab;
91156
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
91157
- "button",
91158
- {
91159
- ref: (el) => {
91160
- 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
+ ]
91161
91260
  },
91162
- type: "button",
91163
- role: "tab",
91164
- "aria-selected": active,
91165
- tabIndex: active ? 0 : -1,
91166
- onClick: () => selectTab(tab2.id),
91167
- 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)]"}`,
91168
- children: [
91169
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `${tab2.icon} text-sm shrink-0 ${active ? "text-[var(--zg-accent)]" : ""}` }),
91170
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate", children: tab2.label })
91171
- ]
91172
- },
91173
- tab2.id
91174
- );
91175
- })
91176
- }
91177
- ),
91261
+ tab2.id
91262
+ );
91263
+ })
91264
+ }
91265
+ ),
91266
+ /* @__PURE__ */ jsxRuntimeExports.jsx(AppVersion, {})
91267
+ ] }),
91178
91268
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0 min-h-0 flex flex-col", children: [
91179
91269
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "shrink-0 flex items-center justify-between gap-3 pb-3", children: [
91180
91270
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative w-72 max-w-full", children: [
@@ -91263,6 +91353,215 @@ function nextOption(row, current) {
91263
91353
  const next = row.options[(idx + 1) % row.options.length];
91264
91354
  return next.value;
91265
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
+ }
91266
91565
  const TONE_CLS = {
91267
91566
  ok: "text-[var(--zg-accent)]",
91268
91567
  warn: "text-[#f59e0b]",
@@ -91705,7 +92004,6 @@ function formatElapsed(ms) {
91705
92004
  function AppShell() {
91706
92005
  useNativeChromeZoomVar();
91707
92006
  const { sessions, activeSessionId, setActiveSessionId, defaultFolder, refresh: refreshSessions } = useSessions();
91708
- const queue = useSafeModeQueue();
91709
92007
  const interactions = useInteractions();
91710
92008
  const modal = useModal();
91711
92009
  const modalIsOpenRef = reactExports.useRef(modal.isOpen);
@@ -91840,15 +92138,6 @@ function AppShell() {
91840
92138
  setRunningWork([]);
91841
92139
  };
91842
92140
  }, [activeSessionId]);
91843
- reactExports.useEffect(() => {
91844
- if (activeSessionId) {
91845
- return;
91846
- }
91847
- const pending = queue.find((r2) => r2.sessionId && sessions.some((s2) => s2.id === r2.sessionId));
91848
- if (pending?.sessionId) {
91849
- setActiveSessionId(pending.sessionId);
91850
- }
91851
- }, [activeSessionId, queue, sessions, setActiveSessionId]);
91852
92141
  const autoOpenedInteractionRef = reactExports.useRef(null);
91853
92142
  reactExports.useEffect(() => {
91854
92143
  if (modal.isOpen) {
@@ -91865,15 +92154,6 @@ function AppShell() {
91865
92154
  modal.open(/* @__PURE__ */ jsxRuntimeExports.jsx(AskUserModal, { request: head2.request }, head2.request.id));
91866
92155
  }
91867
92156
  }, [interactions, activeSessionId, modal]);
91868
- reactExports.useEffect(() => {
91869
- if (activeSessionId) {
91870
- return;
91871
- }
91872
- const head2 = interactions.pending.find((p2) => p2.live && sessions.some((s2) => s2.id === p2.sessionId));
91873
- if (head2) {
91874
- setActiveSessionId(head2.sessionId);
91875
- }
91876
- }, [activeSessionId, interactions.pending, sessions, setActiveSessionId]);
91877
92157
  reactExports.useEffect(() => {
91878
92158
  let cancelled = false;
91879
92159
  void window.api.auth.hasAny().then((hasAny) => {
@@ -92148,6 +92428,22 @@ function AppShell() {
92148
92428
  }
92149
92429
  modal.open(/* @__PURE__ */ jsxRuntimeExports.jsx(TodosModal, { sessionId: activeSession.id }));
92150
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]);
92151
92447
  const openUsagePanel = reactExports.useCallback(() => {
92152
92448
  modal.open(/* @__PURE__ */ jsxRuntimeExports.jsx(UsagePanelModal, { activeProviderKey: activeSession?.providerKey ?? null }));
92153
92449
  }, [modal, activeSession]);
@@ -92280,6 +92576,7 @@ function AppShell() {
92280
92576
  ...activeSession ? { openEffortPicker } : {},
92281
92577
  ...activeSession ? { openModelPicker } : {},
92282
92578
  ...activeSession ? { openTodos } : {},
92579
+ ...activeSession ? { openArtifacts } : {},
92283
92580
  openUsagePanel,
92284
92581
  openMainSession,
92285
92582
  newSession: () => setActiveSessionId(null),
@@ -92301,6 +92598,7 @@ function AppShell() {
92301
92598
  openEffortPicker,
92302
92599
  openModelPicker,
92303
92600
  openTodos,
92601
+ openArtifacts,
92304
92602
  openUsagePanel,
92305
92603
  openMainSession,
92306
92604
  setActiveSessionId,
@@ -92491,7 +92789,7 @@ function McpAuthProvider({ children }) {
92491
92789
  return /* @__PURE__ */ jsxRuntimeExports.jsx(McpAuthContext.Provider, { value, children });
92492
92790
  }
92493
92791
  function AppProviders({ children }) {
92494
- 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 }) }) }) }) }) }) }) }) }) }) }) }) }) }) });
92495
92793
  }
92496
92794
  function ThemedShell({ children }) {
92497
92795
  const { settings } = useSettings();