zidane-gui 7.0.15 → 7.0.17

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.
@@ -12478,6 +12478,22 @@ function requireClient() {
12478
12478
  }
12479
12479
  var clientExports = requireClient();
12480
12480
  const ReactDOM$1 = /* @__PURE__ */ getDefaultExportFromCjs(clientExports);
12481
+ function formatSessionCostLabel(usd) {
12482
+ return usd > 0 ? `$${usd.toFixed(3)}` : null;
12483
+ }
12484
+ function composeLiveCost(fetched, accrued, progress) {
12485
+ const live = progress?.estCostUsd ?? 0;
12486
+ const total = (fetched?.totalCost ?? 0) + accrued + live;
12487
+ if (total <= 0) {
12488
+ return null;
12489
+ }
12490
+ return {
12491
+ totalCost: total,
12492
+ runCount: fetched?.runCount ?? 0,
12493
+ label: formatSessionCostLabel(total),
12494
+ estimated: live > 0
12495
+ };
12496
+ }
12481
12497
  function utf8ByteLength(text2) {
12482
12498
  let bytes = 0;
12483
12499
  for (let i = 0; i < text2.length; i++) {
@@ -14589,6 +14605,13 @@ function retryLabel(info) {
14589
14605
  const suffix = info.source === "parent" ? "" : ` · ${info.source}`;
14590
14606
  return `retrying ${info.attempt}/${info.max}${suffix}`;
14591
14607
  }
14608
+ function streamingLabel(progress, opts = {}) {
14609
+ if (!progress || progress.outputTokens <= 0) return "";
14610
+ const count2 = `↓${progress.estimated ? "~" : ""}${fmtTokens(progress.outputTokens)}`;
14611
+ if (opts.rate === false || progress.elapsedMs < 2e3) return count2;
14612
+ const perSecond = Math.round(progress.outputTokens / (progress.elapsedMs / 1e3));
14613
+ return perSecond > 0 ? `${count2} · ${perSecond} tok/s` : count2;
14614
+ }
14592
14615
  function compactingLabel(estTokens, startedAt, now = Date.now()) {
14593
14616
  const base2 = "Compacting...";
14594
14617
  const elapsedMs = typeof startedAt === "number" ? now - startedAt : 0;
@@ -15383,6 +15406,12 @@ const DEFAULT_SETTINGS = {
15383
15406
  * default this off to keep the transcript calm.
15384
15407
  */
15385
15408
  showThrobber: false,
15409
+ /**
15410
+ * Session artifacts — what a session produced (PRs, branches, commits,
15411
+ * recorded files). Canonical default on; off hides the rail, header chip
15412
+ * and `#pr` completion and stops detection + the `record_artifact` tool.
15413
+ */
15414
+ artifacts: true,
15386
15415
  /**
15387
15416
  * Toggle the active-todos summary above the chatbox (5.4). The
15388
15417
  * `BUILD_AGENT` preset wires `todowrite` / `todoread` so the model writes
@@ -15533,6 +15562,11 @@ const SETTINGS_TOGGLES = [
15533
15562
  description: `discover MCP servers, skills + instructions from .ruler/ (project) and ~/.config/ruler (user) — read-only, zidane's own configs win collisions; stdio servers additionally need "Import configurations from other agents" (they execute local commands)`
15534
15563
  },
15535
15564
  { key: "showThrobber", label: "Throbber", description: "animated indicator while the agent is working" },
15565
+ {
15566
+ key: "artifacts",
15567
+ label: "Artifacts",
15568
+ description: "track what a session produces — pull requests, branches, commits, recorded files — in the artifacts rail (⌃⇧A), the header chip and #pr completion; off = nothing is detected, recorded or shown"
15569
+ },
15536
15570
  {
15537
15571
  key: "showTodoIndicator",
15538
15572
  label: "Todo indicator",
@@ -15773,6 +15807,42 @@ function useSettings() {
15773
15807
  }
15774
15808
  return ctx;
15775
15809
  }
15810
+ function readPersisted(key2, parse2) {
15811
+ try {
15812
+ const raw2 = localStorage.getItem(key2);
15813
+ return raw2 === null ? void 0 : parse2(raw2);
15814
+ } catch {
15815
+ return void 0;
15816
+ }
15817
+ }
15818
+ function writePersisted(key2, value) {
15819
+ try {
15820
+ if (value === null || value === void 0) {
15821
+ localStorage.removeItem(key2);
15822
+ } else {
15823
+ localStorage.setItem(key2, value);
15824
+ }
15825
+ } catch {
15826
+ }
15827
+ }
15828
+ function usePersistedState(key2, fallback, parse2, serialize2 = (v2) => v2 === null || v2 === void 0 ? null : String(v2)) {
15829
+ const [value, setValue] = reactExports.useState(() => readPersisted(key2, parse2) ?? fallback);
15830
+ const set2 = reactExports.useCallback(
15831
+ (next) => {
15832
+ setValue((prev) => {
15833
+ const resolved = typeof next === "function" ? next(prev) : next;
15834
+ writePersisted(key2, serialize2(resolved));
15835
+ return resolved;
15836
+ });
15837
+ },
15838
+ [key2, serialize2]
15839
+ );
15840
+ return [value, set2];
15841
+ }
15842
+ function oneOf(members) {
15843
+ return (raw2) => members.includes(raw2) ? raw2 : void 0;
15844
+ }
15845
+ const parseBoolean = (raw2) => raw2 === "true" ? true : raw2 === "false" ? false : void 0;
15776
15846
  const SMOOTH_BASE_CPS = 200;
15777
15847
  const SMOOTH_BURST_CPS = 600;
15778
15848
  const SMOOTH_BURST_THRESHOLD = 100;
@@ -16971,20 +17041,31 @@ function SessionsProvider({ children }) {
16971
17041
  const rawSessionsRef = reactExports.useRef(rawSessions);
16972
17042
  rawSessionsRef.current = rawSessions;
16973
17043
  const [activeSessionId, setActiveSessionIdState] = reactExports.useState(null);
16974
- const [archiveFilter, setArchiveFilterState] = reactExports.useState("active");
16975
- const [projectFilter, setProjectFilterState] = reactExports.useState(null);
16976
- const [activityFilter, setActivityFilterState] = reactExports.useState("all");
16977
- const [groupBy, setGroupByState] = reactExports.useState(() => {
16978
- try {
16979
- const stored = localStorage.getItem("zg-sidebar-group-by");
16980
- if (stored === "none" || stored === "date" || stored === "state" || stored === "project") {
16981
- return stored;
16982
- }
16983
- } catch {
16984
- }
16985
- return "project";
16986
- });
16987
- const [sortBy, setSortByState] = reactExports.useState("recency");
17044
+ const [archiveFilter, setArchiveFilterState] = usePersistedState(
17045
+ "zg-sidebar-archive-filter",
17046
+ "active",
17047
+ oneOf(["active", "archived", "all"])
17048
+ );
17049
+ const [projectFilter, setProjectFilterState] = usePersistedState(
17050
+ "zg-sidebar-project-filter",
17051
+ null,
17052
+ (raw2) => raw2.length > 0 ? raw2 : void 0
17053
+ );
17054
+ const [activityFilter, setActivityFilterState] = usePersistedState(
17055
+ "zg-sidebar-activity-filter",
17056
+ "all",
17057
+ oneOf(["all", "1d", "3d", "7d", "30d"])
17058
+ );
17059
+ const [groupBy, setGroupByState] = usePersistedState(
17060
+ "zg-sidebar-group-by",
17061
+ "project",
17062
+ oneOf(["none", "date", "state", "project"])
17063
+ );
17064
+ const [sortBy, setSortByState] = usePersistedState(
17065
+ "zg-sidebar-sort-by",
17066
+ "recency",
17067
+ oneOf(["recency", "createdTime", "alphabetical"])
17068
+ );
16988
17069
  const [defaultFolder, setDefaultFolderState] = reactExports.useState(null);
16989
17070
  const [defaultAgentId, setDefaultAgentIdState] = reactExports.useState("build");
16990
17071
  const [defaultProviderKey, setDefaultProviderKeyState] = reactExports.useState(null);
@@ -16995,9 +17076,6 @@ function SessionsProvider({ children }) {
16995
17076
  if (cancelled || !s2) {
16996
17077
  return;
16997
17078
  }
16998
- if (typeof s2.lastAgent === "string" && s2.lastAgent.length > 0) {
16999
- setDefaultAgentIdState(s2.lastAgent);
17000
- }
17001
17079
  const lastProvider = typeof s2.lastProvider === "string" ? s2.lastProvider : null;
17002
17080
  const lastModel = lastProvider && s2.lastModelByProvider && typeof s2.lastModelByProvider === "object" ? s2.lastModelByProvider[lastProvider] ?? null : null;
17003
17081
  if (lastProvider && lastModel) {
@@ -17011,7 +17089,6 @@ function SessionsProvider({ children }) {
17011
17089
  }, []);
17012
17090
  const setDefaultAgentId = reactExports.useCallback((id) => {
17013
17091
  setDefaultAgentIdState(id);
17014
- void window.api.state.set({ lastAgent: id });
17015
17092
  }, []);
17016
17093
  const setDefaultModel = reactExports.useCallback((providerKey, modelId) => {
17017
17094
  setDefaultProviderKeyState(providerKey);
@@ -17308,10 +17385,6 @@ function SessionsProvider({ children }) {
17308
17385
  }, []);
17309
17386
  const setGroupBy = reactExports.useCallback((next) => {
17310
17387
  setGroupByState(next);
17311
- try {
17312
- localStorage.setItem("zg-sidebar-group-by", next);
17313
- } catch {
17314
- }
17315
17388
  }, []);
17316
17389
  const setSortBy = reactExports.useCallback((next) => {
17317
17390
  setSortByState(next);
@@ -72710,6 +72783,55 @@ function createMentionRenderer(activeRef, kind, options) {
72710
72783
  }
72711
72784
  };
72712
72785
  }
72786
+ const SWAP_OUT_MS = 140;
72787
+ function Presence$1({ show, children, className = "", display = "inline" }) {
72788
+ const [mounted, setMounted] = reactExports.useState(show);
72789
+ const timer = reactExports.useRef(null);
72790
+ reactExports.useEffect(() => {
72791
+ if (show) {
72792
+ if (timer.current) clearTimeout(timer.current);
72793
+ timer.current = null;
72794
+ setMounted(true);
72795
+ return;
72796
+ }
72797
+ if (!mounted) return;
72798
+ timer.current = setTimeout(() => {
72799
+ timer.current = null;
72800
+ setMounted(false);
72801
+ }, SWAP_OUT_MS);
72802
+ return () => {
72803
+ if (timer.current) clearTimeout(timer.current);
72804
+ };
72805
+ }, [show, mounted]);
72806
+ if (!mounted) return null;
72807
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
72808
+ "span",
72809
+ {
72810
+ className: `zg-presence ${display === "block" ? "block" : "inline-flex items-center"} ${className}`,
72811
+ "data-state": show ? "enter" : "exit",
72812
+ children
72813
+ }
72814
+ );
72815
+ }
72816
+ function Crossfade({ activeKey, children, className = "" }) {
72817
+ const [previous2, setPrevious] = reactExports.useState(null);
72818
+ const lastRef = reactExports.useRef({ key: activeKey, node: children });
72819
+ reactExports.useEffect(() => {
72820
+ const last = lastRef.current;
72821
+ if (last.key === activeKey) {
72822
+ lastRef.current = { key: activeKey, node: children };
72823
+ return;
72824
+ }
72825
+ setPrevious(last);
72826
+ lastRef.current = { key: activeKey, node: children };
72827
+ const timer = setTimeout(() => setPrevious(null), SWAP_OUT_MS);
72828
+ return () => clearTimeout(timer);
72829
+ }, [activeKey, children]);
72830
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: `zg-crossfade ${className}`, children: [
72831
+ previous2 && previous2.key !== activeKey && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-crossfade-item", "data-state": "exit", "aria-hidden": true, children: previous2.node }, `out-${String(previous2.key)}`),
72832
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-crossfade-item", "data-state": "enter", children }, `in-${String(activeKey)}`)
72833
+ ] });
72834
+ }
72713
72835
  function filterModelCatalog(catalog, query) {
72714
72836
  const q2 = query.trim().toLowerCase();
72715
72837
  if (q2.length === 0) {
@@ -73662,16 +73784,18 @@ function ChatboxStatusPills({
73662
73784
  activeSession,
73663
73785
  contextStatus,
73664
73786
  costStatus,
73787
+ streaming = null,
73665
73788
  runningWorkCount = 0,
73666
73789
  onOpenRunningWork
73667
73790
  }) {
73668
73791
  if (!activeSession) {
73669
73792
  return null;
73670
73793
  }
73671
- if (!contextStatus && !costStatus?.label && runningWorkCount === 0) {
73794
+ if (!contextStatus && !costStatus?.label && runningWorkCount === 0 && !streaming) {
73672
73795
  return null;
73673
73796
  }
73674
73797
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "zg-chatbox-status flex items-center gap-2 min-w-0", children: [
73798
+ /* @__PURE__ */ jsxRuntimeExports.jsx(StreamingChip, { progress: streaming, cost: costStatus }),
73675
73799
  runningWorkCount > 0 && onOpenRunningWork && /* @__PURE__ */ jsxRuntimeExports.jsxs(
73676
73800
  "button",
73677
73801
  {
@@ -73688,6 +73812,74 @@ function ChatboxStatusPills({
73688
73812
  contextStatus && /* @__PURE__ */ jsxRuntimeExports.jsx(ContextOrb, { status: contextStatus, cost: costStatus, sessionId: activeSession.id })
73689
73813
  ] });
73690
73814
  }
73815
+ function useTweenedCount(target) {
73816
+ const [shown, setShown] = reactExports.useState(target);
73817
+ const shownRef = reactExports.useRef(target);
73818
+ const frame = reactExports.useRef(null);
73819
+ reactExports.useEffect(() => {
73820
+ const reduce = typeof matchMedia === "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
73821
+ if (reduce || target < shownRef.current) {
73822
+ shownRef.current = target;
73823
+ setShown(target);
73824
+ return;
73825
+ }
73826
+ const from2 = shownRef.current;
73827
+ const delta = target - from2;
73828
+ if (delta === 0) {
73829
+ return;
73830
+ }
73831
+ const started = performance.now();
73832
+ const DURATION_MS = 300;
73833
+ const step = (now) => {
73834
+ const t = Math.min(1, (now - started) / DURATION_MS);
73835
+ const eased = 1 - (1 - t) * (1 - t);
73836
+ const value = Math.round(from2 + delta * eased);
73837
+ shownRef.current = value;
73838
+ setShown(value);
73839
+ if (t < 1) {
73840
+ frame.current = requestAnimationFrame(step);
73841
+ } else {
73842
+ frame.current = null;
73843
+ }
73844
+ };
73845
+ if (frame.current !== null) {
73846
+ cancelAnimationFrame(frame.current);
73847
+ }
73848
+ frame.current = requestAnimationFrame(step);
73849
+ return () => {
73850
+ if (frame.current !== null) {
73851
+ cancelAnimationFrame(frame.current);
73852
+ frame.current = null;
73853
+ }
73854
+ };
73855
+ }, [target]);
73856
+ return shown;
73857
+ }
73858
+ function StreamingChip({ progress, cost }) {
73859
+ const lastProgress = reactExports.useRef(null);
73860
+ if (progress !== null) {
73861
+ lastProgress.current = progress;
73862
+ }
73863
+ const shown = progress ?? lastProgress.current;
73864
+ const tweened = useTweenedCount(shown?.outputTokens ?? 0);
73865
+ const show = progress !== null && progress.outputTokens > 0;
73866
+ const label = shown ? streamingLabel({ ...shown, outputTokens: tweened }) : "";
73867
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Presence$1, { show, className: "shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
73868
+ "span",
73869
+ {
73870
+ className: "inline-flex items-center gap-1.5 h-6 px-2 rounded-full bg-[var(--zg-bg-hover)] border border-[var(--zg-border)] text-[11px] tabular-nums text-[var(--zg-text-muted)] whitespace-nowrap",
73871
+ title: shown?.estimated ? "Tokens estimated from streamed text; settles at turn end" : "Tokens counted by the provider",
73872
+ "aria-live": "off",
73873
+ children: [
73874
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[var(--zg-accent)]", children: label }),
73875
+ cost?.label && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { style: { color: cost.estimated ? "var(--zg-text-muted)" : "var(--zg-money)" }, children: [
73876
+ cost.estimated ? "~" : "",
73877
+ cost.label
73878
+ ] })
73879
+ ]
73880
+ }
73881
+ ) });
73882
+ }
73691
73883
  function Popover({
73692
73884
  trigger,
73693
73885
  render: render2,
@@ -73982,7 +74174,8 @@ function ContextOrb({
73982
74174
  /* @__PURE__ */ jsxRuntimeExports.jsx(ContextBreakdownSection, { sessionId, fallbackPct: pct, fallbackColor: color2 }),
73983
74175
  cost?.label && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between text-[11px]", children: [
73984
74176
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[var(--zg-text-muted)]", children: "Session cost" }),
73985
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "tabular-nums", style: { color: "var(--zg-money)" }, children: [
74177
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "tabular-nums", style: { color: cost.estimated ? "var(--zg-text-muted)" : "var(--zg-money)" }, children: [
74178
+ cost.estimated ? "~" : "",
73986
74179
  cost.label,
73987
74180
  cost.runCount !== null && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-[var(--zg-text-muted)]", children: [
73988
74181
  " ",
@@ -74425,6 +74618,50 @@ function QueueEditArea({ value, onChange, onCommit, onCancel }) {
74425
74618
  }
74426
74619
  );
74427
74620
  }
74621
+ const ArtifactsContext = reactExports.createContext(null);
74622
+ function ArtifactsProvider({ children }) {
74623
+ const [byId, setById] = reactExports.useState(() => /* @__PURE__ */ new Map());
74624
+ const pending = reactExports.useRef(/* @__PURE__ */ new Set());
74625
+ const fetch = reactExports.useCallback(async (sessionId) => {
74626
+ const groups = await window.api.artifacts.list({ sessionId });
74627
+ setById((prev) => {
74628
+ const next = new Map(prev);
74629
+ next.set(sessionId, groups);
74630
+ return next;
74631
+ });
74632
+ }, []);
74633
+ reactExports.useEffect(() => {
74634
+ return window.api.chat.onStreamSignal((signal) => {
74635
+ if (signal.kind !== "artifact:recorded" && signal.kind !== "artifact:changed") return;
74636
+ const { sessionId } = signal;
74637
+ if (pending.current.has(sessionId)) return;
74638
+ pending.current.add(sessionId);
74639
+ queueMicrotask(() => {
74640
+ pending.current.delete(sessionId);
74641
+ void fetch(sessionId).catch(() => void 0);
74642
+ });
74643
+ });
74644
+ }, [fetch]);
74645
+ const groupsFor = reactExports.useCallback(
74646
+ (sessionId) => sessionId ? byId.get(sessionId) ?? null : null,
74647
+ [byId]
74648
+ );
74649
+ const value = reactExports.useMemo(() => ({ groupsFor, fetch }), [groupsFor, fetch]);
74650
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ArtifactsContext.Provider, { value, children });
74651
+ }
74652
+ function useArtifactsFor(sessionId) {
74653
+ const ctx = reactExports.useContext(ArtifactsContext);
74654
+ if (!ctx) throw new Error("useArtifactsFor must be used within ArtifactsProvider");
74655
+ return ctx.groupsFor(sessionId);
74656
+ }
74657
+ function useArtifactsFetcher() {
74658
+ const ctx = reactExports.useContext(ArtifactsContext);
74659
+ if (!ctx) throw new Error("useArtifactsFetcher must be used within ArtifactsProvider");
74660
+ return ctx.fetch;
74661
+ }
74662
+ function countArtifacts(groups) {
74663
+ return groups ? groups.reduce((n, g) => n + g.rows.length, 0) : 0;
74664
+ }
74428
74665
  const EXIT_MS = 120;
74429
74666
  function RowActionsMenu({ open, anchorRef, position: position2, onClose, items }) {
74430
74667
  const [rendered, setRendered] = reactExports.useState(open);
@@ -74564,8 +74801,75 @@ function RowActionsMenu({ open, anchorRef, position: position2, onClose, items }
74564
74801
  document.body
74565
74802
  );
74566
74803
  }
74567
- function SessionHeader({ session, onOpenDetails, lightsInCenter = false }) {
74804
+ const SEGMENTS = 5;
74805
+ const STEP_MS = 80;
74806
+ const DIMENSIONS = {
74807
+ xs: { w: 2, h: 6, gap: 1.5 },
74808
+ sm: { w: 2.5, h: 8, gap: 2 },
74809
+ md: { w: 3, h: 10, gap: 2 }
74810
+ };
74811
+ const TONE = {
74812
+ inherit: void 0,
74813
+ accent: "var(--zg-accent)",
74814
+ warn: "var(--zg-warn)",
74815
+ muted: "var(--zg-text-muted)"
74816
+ };
74817
+ function SegmentSpinner({ size: size2 = "sm", tone = "inherit", label = "Working", className = "" }) {
74818
+ const d2 = DIMENSIONS[size2];
74819
+ const color2 = TONE[tone];
74820
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
74821
+ "span",
74822
+ {
74823
+ role: "status",
74824
+ "aria-label": label,
74825
+ title: label,
74826
+ className: `zg-seg inline-flex items-center shrink-0 align-middle ${className}`,
74827
+ style: { gap: d2.gap, ...color2 ? { color: color2 } : {} },
74828
+ children: Array.from({ length: SEGMENTS }, (_2, i) => /* @__PURE__ */ jsxRuntimeExports.jsx(
74829
+ "span",
74830
+ {
74831
+ "aria-hidden": true,
74832
+ className: "inline-block rounded-[1px] bg-current",
74833
+ style: { width: d2.w, height: d2.h, animationDelay: `${i * STEP_MS}ms` }
74834
+ },
74835
+ i
74836
+ ))
74837
+ }
74838
+ );
74839
+ }
74840
+ function Tooltip$1({ label, side = "bottom", align = "center", children, className = "" }) {
74841
+ const y2 = side === "bottom" ? "top-full mt-1.5" : "bottom-full mb-1.5";
74842
+ const x2 = align === "end" ? "right-0" : "left-1/2 -translate-x-1/2";
74843
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: `zg-tooltip-host relative inline-flex ${className}`, children: [
74844
+ children,
74845
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
74846
+ "span",
74847
+ {
74848
+ role: "tooltip",
74849
+ "aria-hidden": true,
74850
+ className: `zg-tooltip pointer-events-none absolute z-30 whitespace-nowrap ${y2} ${x2} px-2 py-1 rounded-md text-[11px] leading-4 text-[var(--zg-text)] bg-[var(--zg-bg-elevated)] border border-[var(--zg-border)] shadow-[0_4px_12px_-4px_rgba(0,0,0,0.5)]`,
74851
+ children: label
74852
+ }
74853
+ )
74854
+ ] });
74855
+ }
74856
+ function SessionHeader({
74857
+ session,
74858
+ onOpenDetails,
74859
+ lightsInCenter = false,
74860
+ artifactsOpen = false,
74861
+ onToggleArtifacts
74862
+ }) {
74568
74863
  const { setDefaultFolder, refresh: refreshSessions } = useSessions();
74864
+ const artifactCount = countArtifacts(useArtifactsFor(session.id));
74865
+ const fetchArtifacts = useArtifactsFetcher();
74866
+ const artifactsShown = onToggleArtifacts !== void 0;
74867
+ reactExports.useEffect(() => {
74868
+ if (!artifactsShown) {
74869
+ return;
74870
+ }
74871
+ void fetchArtifacts(session.id).catch(() => void 0);
74872
+ }, [artifactsShown, fetchArtifacts, session.id]);
74569
74873
  const folderless = !session.cwd;
74570
74874
  const folderName = folderless ? "Chat" : basename$2(session.cwd);
74571
74875
  const [menuOpen, setMenuOpen] = reactExports.useState(false);
@@ -74584,6 +74888,13 @@ function SessionHeader({ session, onOpenDetails, lightsInCenter = false }) {
74584
74888
  };
74585
74889
  const menuItems = reactExports.useMemo(
74586
74890
  () => [
74891
+ ...onToggleArtifacts ? [
74892
+ {
74893
+ id: "artifacts",
74894
+ label: artifactsOpen ? "Hide artifacts" : "Show artifacts",
74895
+ onSelect: onToggleArtifacts
74896
+ }
74897
+ ] : [],
74587
74898
  {
74588
74899
  id: "compact",
74589
74900
  label: compacting ? "Compacting…" : "Compact conversation",
@@ -74592,7 +74903,7 @@ function SessionHeader({ session, onOpenDetails, lightsInCenter = false }) {
74592
74903
  }
74593
74904
  ],
74594
74905
  // eslint-disable-next-line react-hooks/exhaustive-deps -- compactNow reads only stable refs + session.id
74595
- [compacting, session.id]
74906
+ [compacting, session.id, artifactsOpen, onToggleArtifacts]
74596
74907
  );
74597
74908
  const pickFolder = async () => {
74598
74909
  const picked = await window.api.folder.pick();
@@ -74692,6 +75003,38 @@ function SessionHeader({ session, onOpenDetails, lightsInCenter = false }) {
74692
75003
  }
74693
75004
  ),
74694
75005
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-1" }),
75006
+ onToggleArtifacts && /* @__PURE__ */ jsxRuntimeExports.jsx(
75007
+ Tooltip$1,
75008
+ {
75009
+ align: "end",
75010
+ label: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "inline-flex items-center gap-1.5", children: [
75011
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Artifacts" }),
75012
+ artifactCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "tabular-nums px-1 rounded bg-[var(--zg-bg-hover)] text-[var(--zg-text-muted)]", children: artifactCount }),
75013
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[var(--zg-text-muted)]", children: "⌃⇧A" })
75014
+ ] }),
75015
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
75016
+ "button",
75017
+ {
75018
+ type: "button",
75019
+ onClick: onToggleArtifacts,
75020
+ "aria-pressed": artifactsOpen,
75021
+ "aria-label": `Artifacts${artifactCount > 0 ? `, ${artifactCount}` : ""}`,
75022
+ className: `zg-press-soft relative inline-flex items-center justify-center w-7 h-7 shrink-0 rounded-md border-0 cursor-pointer transition-colors duration-150 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--zg-accent)] ${artifactsOpen ? "bg-[var(--zg-bg-hover)] text-[var(--zg-text)]" : "bg-transparent text-[var(--zg-text-muted)] hover:bg-[var(--zg-bg-hover)] hover:text-[var(--zg-text)]"}`,
75023
+ children: [
75024
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-heroicons-cube text-[14px]" }),
75025
+ artifactCount > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
75026
+ "span",
75027
+ {
75028
+ "aria-hidden": true,
75029
+ className: "absolute -top-0.5 -right-0.5 min-w-[14px] h-[14px] px-[3px] rounded-full bg-[var(--zg-accent)] text-[var(--zg-bg)] text-[9px] leading-[14px] font-medium tabular-nums text-center",
75030
+ children: artifactCount > 99 ? "99+" : artifactCount
75031
+ }
75032
+ )
75033
+ ]
75034
+ }
75035
+ )
75036
+ }
75037
+ ),
74695
75038
  /* @__PURE__ */ jsxRuntimeExports.jsx(
74696
75039
  "button",
74697
75040
  {
@@ -74703,13 +75046,7 @@ function SessionHeader({ session, onOpenDetails, lightsInCenter = false }) {
74703
75046
  "aria-expanded": menuOpen,
74704
75047
  onClick: () => setMenuOpen((open) => !open),
74705
75048
  className: "zg-press-soft zg-hit-extend relative inline-flex items-center justify-center w-7 h-7 shrink-0 rounded-md bg-transparent hover:bg-[var(--zg-bg-hover)] text-[var(--zg-text-muted)] hover:text-[var(--zg-text)] border-0 cursor-pointer p-0 transition-colors duration-150 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--zg-accent)]",
74706
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
74707
- "span",
74708
- {
74709
- className: compacting ? "i-heroicons-arrow-path text-sm animate-spin" : "i-heroicons-ellipsis-horizontal text-sm",
74710
- "aria-hidden": true
74711
- }
74712
- )
75049
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Crossfade, { activeKey: compacting ? "compacting" : "menu", children: compacting ? /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSpinner, { size: "xs", tone: "warn", label: "Compacting" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "i-heroicons-ellipsis-horizontal text-sm", "aria-hidden": true }) })
74713
75050
  }
74714
75051
  ),
74715
75052
  /* @__PURE__ */ jsxRuntimeExports.jsx(RowActionsMenu, { open: menuOpen, anchorRef: menuTriggerRef, onClose: () => setMenuOpen(false), items: menuItems })
@@ -74763,7 +75100,7 @@ const TODO_STATUS_GLYPHS = {
74763
75100
  cancelled: "☒"
74764
75101
  };
74765
75102
  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";
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";
75103
+ 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";
74767
75104
  function TodosModal({ sessionId }) {
74768
75105
  const snap = useTodosFor(sessionId);
74769
75106
  const { close: close2 } = useModal();
@@ -74840,7 +75177,7 @@ function TodosModal({ sessionId }) {
74840
75177
  "button",
74841
75178
  {
74842
75179
  type: "button",
74843
- className: `${GHOST_BTN$2} text-[var(--zg-error)]`,
75180
+ className: `${GHOST_BTN$1} text-[var(--zg-error)]`,
74844
75181
  onClick: () => {
74845
75182
  commit(clearTodos());
74846
75183
  setConfirmClear(false);
@@ -74848,12 +75185,12 @@ function TodosModal({ sessionId }) {
74848
75185
  children: "Yes"
74849
75186
  }
74850
75187
  ),
74851
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN$2, onClick: () => setConfirmClear(false), children: "Cancel" })
75188
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN$1, onClick: () => setConfirmClear(false), children: "Cancel" })
74852
75189
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
74853
75190
  "button",
74854
75191
  {
74855
75192
  type: "button",
74856
- className: GHOST_BTN$2,
75193
+ className: GHOST_BTN$1,
74857
75194
  disabled: base2.length === 0,
74858
75195
  onClick: () => setConfirmClear(true),
74859
75196
  title: "Remove every todo from the live list",
@@ -74951,7 +75288,7 @@ function TodosModal({ sessionId }) {
74951
75288
  className: INPUT_CLS
74952
75289
  }
74953
75290
  ),
74954
- /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN$2, disabled: adding.trim().length === 0, onClick: submitAdd, children: "Add" })
75291
+ /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN$1, disabled: adding.trim().length === 0, onClick: submitAdd, children: "Add" })
74955
75292
  ] })
74956
75293
  ] })
74957
75294
  }
@@ -75550,6 +75887,161 @@ function StackedChart({
75550
75887
  }
75551
75888
  );
75552
75889
  }
75890
+ const ARTIFACTS_PANEL_WIDTH = 288;
75891
+ const ICON_BTN = "zg-press inline-flex items-center justify-center w-6 h-6 rounded-md border-0 bg-transparent cursor-pointer text-[var(--zg-text-muted)] hover:text-[var(--zg-text)] hover:bg-[var(--zg-bg-hover)] transition-colors duration-150 p-0";
75892
+ function ArtifactsPanel({ sessionId }) {
75893
+ const cached = useArtifactsFor(sessionId);
75894
+ const fetchSession = useArtifactsFetcher();
75895
+ const [error, setError] = reactExports.useState(null);
75896
+ reactExports.useEffect(() => {
75897
+ void fetchSession(sessionId).catch((err) => setError(err.message));
75898
+ }, [fetchSession, sessionId]);
75899
+ const groups = cached;
75900
+ const total = countArtifacts(groups);
75901
+ const refreshed = reactExports.useRef(/* @__PURE__ */ new Set());
75902
+ const refresh = reactExports.useCallback((row) => {
75903
+ if (refreshed.current.has(row.artifact.id)) return;
75904
+ refreshed.current.add(row.artifact.id);
75905
+ void window.api.artifacts.refresh(row.artifact).catch(() => void 0);
75906
+ }, []);
75907
+ const remove = reactExports.useCallback((row) => {
75908
+ setError(null);
75909
+ void window.api.artifacts.delete(row.artifact.sessionId, row.artifact.id).then((ok2) => {
75910
+ if (!ok2) setError("This session store does not support artifacts.");
75911
+ }).catch((err) => setError(err.message));
75912
+ }, []);
75913
+ const summary = reactExports.useMemo(() => {
75914
+ if (groups === null) return "";
75915
+ return groups.map((g) => `${g.rows.length} ${plural(g.label, g.rows.length)}`).join(" · ");
75916
+ }, [groups]);
75917
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
75918
+ "aside",
75919
+ {
75920
+ "aria-label": "Artifacts",
75921
+ className: "relative shrink-0 h-full flex flex-col",
75922
+ style: { width: ARTIFACTS_PANEL_WIDTH },
75923
+ children: [
75924
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-h-0 overflow-y-auto px-3 pt-3 pb-3", children: [
75925
+ error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-[var(--zg-warn)] mb-2", role: "alert", children: error }),
75926
+ groups === null ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-[var(--zg-text-muted)] py-6 text-center", children: "Loading…" }) : total === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(EmptyState, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-col gap-4", children: groups.map((group) => /* @__PURE__ */ jsxRuntimeExports.jsxs("section", { className: "flex flex-col", children: [
75927
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "m-0 mb-1 text-[10px] uppercase tracking-[0.08em] text-[var(--zg-text-muted)] select-none", children: group.rows.length === 1 ? group.label : `${group.label}s` }),
75928
+ /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { className: "m-0 p-0 list-none flex flex-col", children: group.rows.map((row) => /* @__PURE__ */ jsxRuntimeExports.jsx(
75929
+ ArtifactRow,
75930
+ {
75931
+ row,
75932
+ onFocus: () => refresh(row),
75933
+ onRemove: () => remove(row)
75934
+ },
75935
+ row.artifact.id
75936
+ )) })
75937
+ ] }, group.kind)) })
75938
+ ] }),
75939
+ summary && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "shrink-0 px-3 py-2 text-[11px] text-[var(--zg-text-muted)] truncate", title: summary, children: summary })
75940
+ ]
75941
+ }
75942
+ );
75943
+ }
75944
+ function ArtifactRow({ row, onFocus, onRemove }) {
75945
+ const { artifact, row: view } = row;
75946
+ const href = view.href;
75947
+ const isUrl2 = href !== void 0 && /^https?:\/\//.test(href);
75948
+ const subtitle = view.subtitle && view.subtitle !== view.title ? view.subtitle : void 0;
75949
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
75950
+ "li",
75951
+ {
75952
+ className: "group relative flex items-start gap-2 -mx-2 px-2 py-1.5 rounded-md hover:bg-[var(--zg-bg-hover)] transition-colors duration-150",
75953
+ onMouseEnter: onFocus,
75954
+ onFocus,
75955
+ children: [
75956
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
75957
+ "span",
75958
+ {
75959
+ "aria-hidden": true,
75960
+ className: "mt-[7px] w-1 h-1 rounded-full shrink-0",
75961
+ style: { background: statusColor(view.status) }
75962
+ }
75963
+ ),
75964
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0 flex flex-col", children: [
75965
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1.5 min-w-0", children: [
75966
+ isUrl2 ? (
75967
+ // `target="_blank"` routes through main's window-open handler → `shell.openExternal`.
75968
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
75969
+ "a",
75970
+ {
75971
+ href,
75972
+ target: "_blank",
75973
+ rel: "noreferrer",
75974
+ className: "truncate text-[13px] text-[var(--zg-text)] no-underline hover:underline",
75975
+ title: href,
75976
+ children: view.title
75977
+ }
75978
+ )
75979
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-[13px] text-[var(--zg-text)]", title: href ?? artifact.uri, children: view.title }),
75980
+ view.status && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 text-[10px] leading-4 px-1.5 rounded-full bg-[var(--zg-bg-elevated)] text-[var(--zg-text-muted)]", children: view.status })
75981
+ ] }),
75982
+ subtitle && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "truncate text-[11px] text-[var(--zg-text-muted)] font-mono", title: subtitle, children: subtitle })
75983
+ ] }),
75984
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute right-1 top-1 hidden group-hover:flex group-focus-within:flex items-center gap-0.5 rounded-md bg-[var(--zg-bg-hover)]", children: [
75985
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
75986
+ "button",
75987
+ {
75988
+ type: "button",
75989
+ "aria-label": "Copy locator",
75990
+ title: "Copy",
75991
+ onClick: () => void navigator.clipboard.writeText(href ?? artifact.uri),
75992
+ className: ICON_BTN,
75993
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-heroicons-clipboard text-[12px]" })
75994
+ }
75995
+ ),
75996
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
75997
+ "button",
75998
+ {
75999
+ type: "button",
76000
+ "aria-label": "Remove artifact",
76001
+ title: "Remove from this session",
76002
+ onClick: onRemove,
76003
+ className: `${ICON_BTN} hover:!text-[var(--zg-danger)]`,
76004
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-heroicons-x-mark text-[12px]" })
76005
+ }
76006
+ )
76007
+ ] })
76008
+ ]
76009
+ }
76010
+ );
76011
+ }
76012
+ function EmptyState() {
76013
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col items-center gap-2 py-10 px-4 text-center", children: [
76014
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
76015
+ "span",
76016
+ {
76017
+ "aria-hidden": true,
76018
+ className: "w-8 h-8 rounded-lg border border-dashed border-[var(--zg-border)] flex items-center justify-center text-[var(--zg-text-muted)]",
76019
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "i-heroicons-cube-transparent text-[16px]" })
76020
+ }
76021
+ ),
76022
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-[var(--zg-text)]", children: "Nothing yet" }),
76023
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-[11px] leading-relaxed text-[var(--zg-text-muted)]", children: "Pull requests, branches and commits land here as the agent produces them; files only when recorded on purpose." })
76024
+ ] });
76025
+ }
76026
+ function statusColor(status) {
76027
+ switch (status) {
76028
+ case "merged":
76029
+ return "var(--zg-success)";
76030
+ case "closed":
76031
+ return "var(--zg-danger)";
76032
+ case "draft":
76033
+ return "var(--zg-text-muted)";
76034
+ case "open":
76035
+ return "var(--zg-accent)";
76036
+ default:
76037
+ return "var(--zg-border)";
76038
+ }
76039
+ }
76040
+ function plural(label, count2) {
76041
+ const lower2 = label.toLowerCase();
76042
+ if (count2 === 1) return lower2;
76043
+ return /(?:s|x|ch|sh)$/.test(lower2) ? `${lower2}es` : `${lower2}s`;
76044
+ }
75553
76045
  function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
75554
76046
  return function handleEvent(event) {
75555
76047
  originalEventHandler?.(event);
@@ -79954,7 +80446,14 @@ ${task}` : ""}`,
79954
80446
  }
79955
80447
  ) }),
79956
80448
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-2 min-w-0 flex-1", children: [
79957
- status === "open" && streaming ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "i-heroicons-arrow-path animate-spin text-[10px] shrink-0", "aria-label": "running" }) : status === "failed" ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "i-heroicons-x-mark text-[11px] shrink-0 text-[#ef4444]", "aria-label": "failed" }) : status === "done" ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "i-heroicons-check text-[11px] shrink-0 text-[#22c55e]", "aria-label": "done" }) : null,
80449
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
80450
+ Crossfade,
80451
+ {
80452
+ activeKey: status === "open" && streaming ? "running" : status === "failed" ? "failed" : status === "done" ? "done" : "none",
80453
+ className: "shrink-0",
80454
+ children: status === "open" && streaming ? /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSpinner, { size: "xs", label: "running" }) : status === "failed" ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "i-heroicons-x-mark text-[11px] shrink-0 text-[#ef4444]", "aria-label": "failed" }) : status === "done" ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "i-heroicons-check text-[11px] shrink-0 text-[#22c55e]", "aria-label": "done" }) : null
80455
+ }
80456
+ ),
79958
80457
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-xs min-w-0 truncate", children: [
79959
80458
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-[var(--zg-text)]", children: "Agent" }),
79960
80459
  task && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
@@ -80278,18 +80777,23 @@ function Dot({ variant }) {
80278
80777
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
80279
80778
  "span",
80280
80779
  {
80281
- className: "relative flex items-center justify-center w-4 h-4 rounded-full border-2 text-white",
80780
+ className: "zg-state-tween relative flex items-center justify-center w-4 h-4 rounded-full border-2 text-white",
80282
80781
  style: { background: cfg.bg, borderColor: cfg.border },
80283
80782
  children: [
80284
- cfg.icon && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `${cfg.icon} text-[10px]` }),
80285
- variant === "tool-running" && /* @__PURE__ */ jsxRuntimeExports.jsx(
80783
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Crossfade, { activeKey: cfg.icon || "none", children: cfg.icon ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `${cfg.icon} text-[10px]` }) : null }),
80784
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Presence$1, { show: variant === "tool-running", className: "absolute -inset-[2px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
80286
80785
  "span",
80287
80786
  {
80288
80787
  "aria-hidden": true,
80289
80788
  className: "absolute inset-0 rounded-full",
80290
- style: { background: "var(--zg-text-muted)", animation: "zg-dot 1.6s ease-in-out infinite" }
80789
+ style: {
80790
+ background: "conic-gradient(from 0deg, var(--zg-accent) 0 30%, transparent 30% 100%)",
80791
+ WebkitMaskImage: "radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px))",
80792
+ maskImage: "radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px))",
80793
+ animation: "zg-orbit 1.1s linear infinite"
80794
+ }
80291
80795
  }
80292
- )
80796
+ ) })
80293
80797
  ]
80294
80798
  }
80295
80799
  )
@@ -80666,7 +81170,7 @@ ${lines.slice(lines.length - USER_BASH_TAIL_LINES).join("\n")}`;
80666
81170
  const badge = (() => {
80667
81171
  if (row.running) {
80668
81172
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "inline-flex items-center gap-1.5 self-center", children: [
80669
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "i-heroicons-arrow-path animate-spin text-[10px] text-[var(--zg-text-muted)]" }),
81173
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSpinner, { size: "xs", tone: "muted" }),
80670
81174
  sessionId && row.callId && /* @__PURE__ */ jsxRuntimeExports.jsx(
80671
81175
  "button",
80672
81176
  {
@@ -80703,7 +81207,7 @@ ${lines.slice(lines.length - USER_BASH_TAIL_LINES).join("\n")}`;
80703
81207
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-baseline gap-2 max-w-full py-0.5", children: [
80704
81208
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[var(--zg-accent-hover)] font-medium select-none", children: "!" }),
80705
81209
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[var(--zg-text)] truncate", children: row.command }),
80706
- badge
81210
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Crossfade, { activeKey: row.running ? "running" : row.errored ? "failed" : row.exit === null ? "none" : "exit", children: badge })
80707
81211
  ] }),
80708
81212
  display !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "mt-1 px-3 py-2 rounded-md bg-[var(--zg-bg-elevated)] border border-[var(--zg-border)] text-[var(--zg-text-muted)] whitespace-pre-wrap font-mono text-xs leading-relaxed", children: display })
80709
81213
  ] });
@@ -80727,7 +81231,7 @@ function ToolTiming({
80727
81231
  return null;
80728
81232
  }
80729
81233
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "inline-flex items-center gap-1 shrink-0 self-center text-[10px] font-mono tabular-nums text-[var(--zg-text-muted)]", children: [
80730
- running && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-heroicons-arrow-path animate-spin text-[10px]" }),
81234
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Presence$1, { show: running, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSpinner, { size: "xs" }) }),
80731
81235
  formatToolMs(ms)
80732
81236
  ] });
80733
81237
  }
@@ -81397,11 +81901,14 @@ function Center({
81397
81901
  modelId,
81398
81902
  contextStatus,
81399
81903
  costStatus,
81904
+ streaming = null,
81400
81905
  runningWorkCount = 0,
81401
81906
  onOpenRunningWork,
81402
81907
  lightsInCenter = false,
81403
81908
  searchOpen = false,
81404
- onCloseSearch
81909
+ onCloseSearch,
81910
+ artifactsOpen = false,
81911
+ onToggleArtifacts
81405
81912
  }) {
81406
81913
  const {
81407
81914
  createSession,
@@ -81663,6 +82170,9 @@ function Center({
81663
82170
  ...defaultProviderKey && defaultModelId ? { providerKey: defaultProviderKey, modelId: defaultModelId } : {}
81664
82171
  });
81665
82172
  sessionId = created.id;
82173
+ if (defaultAgentId !== "build") {
82174
+ setDefaultAgentId("build");
82175
+ }
81666
82176
  }
81667
82177
  const bashCommand = text2.trim().startsWith("!") ? text2.trim().slice(1).trim() : "";
81668
82178
  if (bashCommand) {
@@ -81760,7 +82270,16 @@ function Center({
81760
82270
  * the very top + a wider falloff so the band reads as soft.
81761
82271
  */
81762
82272
  /* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "flex-1 min-w-0 flex flex-col h-full bg-[var(--zg-bg)]", children: [
81763
- activeSession ? /* @__PURE__ */ jsxRuntimeExports.jsx(SessionHeader, { session: activeSession, onOpenDetails: onOpenSessionDetails, lightsInCenter }) : (
82273
+ activeSession ? /* @__PURE__ */ jsxRuntimeExports.jsx(
82274
+ SessionHeader,
82275
+ {
82276
+ session: activeSession,
82277
+ onOpenDetails: onOpenSessionDetails,
82278
+ lightsInCenter,
82279
+ artifactsOpen,
82280
+ onToggleArtifacts
82281
+ }
82282
+ ) : (
81764
82283
  /**
81765
82284
  * No session yet — render the header as a pure drag region so the
81766
82285
  * window stays movable from the top edge. The sidebar's "+ New chat"
@@ -81799,103 +82318,109 @@ function Center({
81799
82318
  }
81800
82319
  )
81801
82320
  ),
81802
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex-1 min-h-0", children: [
81803
- /* @__PURE__ */ jsxRuntimeExports.jsx(
81804
- "section",
81805
- {
81806
- ref: scrollRef,
81807
- className: "absolute inset-0 overflow-y-auto p-6",
81808
- style: {
81809
- maskImage: "linear-gradient(to bottom, transparent 0, black 16px, black 100%)",
81810
- WebkitMaskImage: "linear-gradient(to bottom, transparent 0, black 16px, black 100%)"
81811
- },
81812
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mx-auto w-full max-w-[1160px] ${isNewSession ? "h-full" : ""}`, children: isNewSession ? /* @__PURE__ */ jsxRuntimeExports.jsx(WelcomeScreen, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(Timeline, { events, isStreaming: running, sessionId: activeSession?.id ?? null }) })
81813
- }
81814
- ),
81815
- searchOpen && activeSession && onCloseSearch && /* @__PURE__ */ jsxRuntimeExports.jsx(TranscriptSearch, { container: scrollRef, sessionId: activeSession.id, onClose: onCloseSearch }),
81816
- composerSearchQuery !== null && /* @__PURE__ */ jsxRuntimeExports.jsx(SearchHighlightStyle, {})
81817
- ] }),
81818
- /* @__PURE__ */ jsxRuntimeExports.jsx("footer", { className: "zg-chat-footer px-6 pb-3 pt-0 relative", "data-scrolled": scrolledFromTop && !pinned, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mx-auto w-full max-w-[1160px] flex flex-col gap-2", children: activeSession?.archived ? (
81819
- /**
81820
- * Archived sessions are read-only. The chatbox + all of its
81821
- * peripherals (call status, todo indicator, approval bar,
81822
- * queue strip) would imply the session can still be driven —
81823
- * which it can't until the user unarchives. We replace the
81824
- * whole footer cluster with a single banner so the affordance
81825
- * is unambiguous.
81826
- */
81827
- /* @__PURE__ */ jsxRuntimeExports.jsx(
81828
- ArchivedBanner,
81829
- {
81830
- onUnarchive: () => {
81831
- void setArchived(activeSession.id, false);
81832
- }
81833
- }
81834
- )
81835
- ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
81836
- /* @__PURE__ */ jsxRuntimeExports.jsxs(ComposerDock, { children: [
81837
- /* @__PURE__ */ jsxRuntimeExports.jsx(TodoIndicator, { sessionId: activeSession?.id ?? null }),
81838
- /* @__PURE__ */ jsxRuntimeExports.jsx(ApprovalBar, { sessionId: activeSession?.id ?? null }),
81839
- /* @__PURE__ */ jsxRuntimeExports.jsx(InteractionBar, { sessionId: activeSession?.id ?? null }),
81840
- /* @__PURE__ */ jsxRuntimeExports.jsx(QueueStrip, { messages: queuedMessages, onPush: onPushQueued, onDrop: onDropQueued })
81841
- ] }),
81842
- /* @__PURE__ */ jsxRuntimeExports.jsx(
81843
- Chatbox,
81844
- {
81845
- disabled: false,
81846
- folderPath,
81847
- activeSessionId: activeSession?.id ?? null,
81848
- running: running && Boolean(activeSession),
81849
- onStop,
81850
- onSend: handleSend,
81851
- onCycleHistory,
81852
- searchStatus: composerSearchQuery !== null ? composerSearch : null,
81853
- onSearchQueryChange: onComposerSearchQueryChange,
81854
- onSearchNavigate: composerSearch.goTo,
81855
- searchOverlayOpen: searchOpen,
81856
- remoteSearchApply,
81857
- leadingActions: /* @__PURE__ */ jsxRuntimeExports.jsx(
81858
- ChatboxControls,
82321
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-h-0 flex flex-row", children: [
82322
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0 flex flex-col", children: [
82323
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex-1 min-h-0", children: [
82324
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
82325
+ "section",
81859
82326
  {
81860
- activeSession,
81861
- defaultAgentId,
81862
- onDefaultAgentChange: setDefaultAgentId,
81863
- modelId,
81864
- providerKey: activeSession?.providerKey ?? null,
81865
- activeSupportsReasoning: contextStatus?.supportsReasoning ?? false,
81866
- activeModelOptions: contextStatus?.availableOptions ?? [],
81867
- activeEnabledOptions: contextStatus?.modelOptions ?? {}
82327
+ ref: scrollRef,
82328
+ className: "absolute inset-0 overflow-y-auto p-6",
82329
+ style: {
82330
+ maskImage: "linear-gradient(to bottom, transparent 0, black 16px, black 100%)",
82331
+ WebkitMaskImage: "linear-gradient(to bottom, transparent 0, black 16px, black 100%)"
82332
+ },
82333
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `mx-auto w-full max-w-[1160px] ${isNewSession ? "h-full" : ""}`, children: isNewSession ? /* @__PURE__ */ jsxRuntimeExports.jsx(WelcomeScreen, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(Timeline, { events, isStreaming: running, sessionId: activeSession?.id ?? null }) })
81868
82334
  }
81869
82335
  ),
81870
- trailingActions: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
81871
- /* @__PURE__ */ jsxRuntimeExports.jsx(CallStatusPill, { sessionId: activeSession?.id ?? null }),
81872
- /* @__PURE__ */ jsxRuntimeExports.jsx(
81873
- ChatboxStatusPills,
81874
- {
81875
- activeSession,
81876
- contextStatus,
81877
- costStatus,
81878
- runningWorkCount,
81879
- onOpenRunningWork
82336
+ searchOpen && activeSession && onCloseSearch && /* @__PURE__ */ jsxRuntimeExports.jsx(TranscriptSearch, { container: scrollRef, sessionId: activeSession.id, onClose: onCloseSearch }),
82337
+ composerSearchQuery !== null && /* @__PURE__ */ jsxRuntimeExports.jsx(SearchHighlightStyle, {})
82338
+ ] }),
82339
+ /* @__PURE__ */ jsxRuntimeExports.jsx("footer", { className: "zg-chat-footer px-6 pb-3 pt-0 relative", "data-scrolled": scrolledFromTop && !pinned, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mx-auto w-full max-w-[1160px] flex flex-col gap-2", children: activeSession?.archived ? (
82340
+ /**
82341
+ * Archived sessions are read-only. The chatbox + all of its
82342
+ * peripherals (call status, todo indicator, approval bar,
82343
+ * queue strip) would imply the session can still be driven —
82344
+ * which it can't until the user unarchives. We replace the
82345
+ * whole footer cluster with a single banner so the affordance
82346
+ * is unambiguous.
82347
+ */
82348
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
82349
+ ArchivedBanner,
82350
+ {
82351
+ onUnarchive: () => {
82352
+ void setArchived(activeSession.id, false);
81880
82353
  }
81881
- ),
81882
- isNewSession && /* @__PURE__ */ jsxRuntimeExports.jsx(
81883
- ScopeToggle,
81884
- {
81885
- folderPath,
81886
- onJustChat: () => setFolderlessDraft(true),
81887
- onPickFolder: pickFolder,
81888
- recents: recentFolders,
81889
- onPickRecent: (dir) => {
81890
- setFolderlessDraft(false);
81891
- setDefaultFolder(dir);
82354
+ }
82355
+ )
82356
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
82357
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(ComposerDock, { children: [
82358
+ /* @__PURE__ */ jsxRuntimeExports.jsx(TodoIndicator, { sessionId: activeSession?.id ?? null }),
82359
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ApprovalBar, { sessionId: activeSession?.id ?? null }),
82360
+ /* @__PURE__ */ jsxRuntimeExports.jsx(InteractionBar, { sessionId: activeSession?.id ?? null }),
82361
+ /* @__PURE__ */ jsxRuntimeExports.jsx(QueueStrip, { messages: queuedMessages, onPush: onPushQueued, onDrop: onDropQueued })
82362
+ ] }),
82363
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
82364
+ Chatbox,
82365
+ {
82366
+ disabled: false,
82367
+ folderPath,
82368
+ activeSessionId: activeSession?.id ?? null,
82369
+ running: running && Boolean(activeSession),
82370
+ onStop,
82371
+ onSend: handleSend,
82372
+ onCycleHistory,
82373
+ searchStatus: composerSearchQuery !== null ? composerSearch : null,
82374
+ onSearchQueryChange: onComposerSearchQueryChange,
82375
+ onSearchNavigate: composerSearch.goTo,
82376
+ searchOverlayOpen: searchOpen,
82377
+ remoteSearchApply,
82378
+ leadingActions: /* @__PURE__ */ jsxRuntimeExports.jsx(
82379
+ ChatboxControls,
82380
+ {
82381
+ activeSession,
82382
+ defaultAgentId,
82383
+ onDefaultAgentChange: setDefaultAgentId,
82384
+ modelId,
82385
+ providerKey: activeSession?.providerKey ?? null,
82386
+ activeSupportsReasoning: contextStatus?.supportsReasoning ?? false,
82387
+ activeModelOptions: contextStatus?.availableOptions ?? [],
82388
+ activeEnabledOptions: contextStatus?.modelOptions ?? {}
81892
82389
  }
81893
- }
81894
- )
81895
- ] })
81896
- }
81897
- )
81898
- ] }) }) })
82390
+ ),
82391
+ trailingActions: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
82392
+ /* @__PURE__ */ jsxRuntimeExports.jsx(CallStatusPill, { sessionId: activeSession?.id ?? null }),
82393
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
82394
+ ChatboxStatusPills,
82395
+ {
82396
+ activeSession,
82397
+ contextStatus,
82398
+ costStatus,
82399
+ streaming,
82400
+ runningWorkCount,
82401
+ onOpenRunningWork
82402
+ }
82403
+ ),
82404
+ isNewSession && /* @__PURE__ */ jsxRuntimeExports.jsx(
82405
+ ScopeToggle,
82406
+ {
82407
+ folderPath,
82408
+ onJustChat: () => setFolderlessDraft(true),
82409
+ onPickFolder: pickFolder,
82410
+ recents: recentFolders,
82411
+ onPickRecent: (dir) => {
82412
+ setFolderlessDraft(false);
82413
+ setDefaultFolder(dir);
82414
+ }
82415
+ }
82416
+ )
82417
+ ] })
82418
+ }
82419
+ )
82420
+ ] }) }) })
82421
+ ] }),
82422
+ artifactsOpen && activeSession && /* @__PURE__ */ jsxRuntimeExports.jsx(ArtifactsPanel, { sessionId: activeSession.id })
82423
+ ] })
81899
82424
  ] })
81900
82425
  );
81901
82426
  }
@@ -84472,31 +84997,29 @@ function SessionStatusDotInner({ sessionId, override }) {
84472
84997
  presence
84473
84998
  });
84474
84999
  const cfg = STYLES[state];
84475
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
84476
- "span",
84477
- {
84478
- "aria-label": cfg.label,
84479
- title: cfg.label,
84480
- className: "relative shrink-0 inline-block w-2 h-2 rounded-full",
84481
- style: cfg.style,
84482
- children: cfg.ping && /* @__PURE__ */ jsxRuntimeExports.jsx(
84483
- "span",
84484
- {
84485
- "aria-hidden": true,
84486
- className: "absolute inset-0 rounded-full",
84487
- style: { background: "var(--zg-accent)", animation: "zg-dot 1.8s ease-in-out infinite" }
84488
- }
84489
- )
84490
- }
84491
- );
85000
+ const orbit = cfg.ring?.kind === "orbit" ? cfg.ring : null;
85001
+ const ripple = cfg.ring?.kind === "ripple" ? cfg.ring : null;
85002
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { "aria-label": cfg.label, title: cfg.label, className: "relative shrink-0 inline-block w-2 h-2", children: [
85003
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "zg-state-tween absolute inset-0 rounded-full", style: cfg.style, "data-core": true }),
85004
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Presence$1, { show: orbit !== null, className: "absolute -inset-[3px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `absolute rounded-full ${ORBIT.className}`, style: ORBIT.style }) }),
85005
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Presence$1, { show: ripple !== null, className: "absolute inset-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "absolute inset-0 rounded-full", style: RIPPLE.style }) })
85006
+ ] });
84492
85007
  }
85008
+ const ORBIT_MASK = "radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px))";
85009
+ const ORBIT = {
85010
+ className: "inset-0",
85011
+ style: {
85012
+ background: "conic-gradient(from 0deg, var(--zg-accent) 0 32%, transparent 32% 100%)",
85013
+ WebkitMaskImage: ORBIT_MASK,
85014
+ maskImage: ORBIT_MASK,
85015
+ animation: "zg-orbit 1.1s linear infinite"
85016
+ }
85017
+ };
85018
+ const RIPPLE = {
85019
+ style: { background: "var(--zg-warn)", animation: "zg-dot 1.8s ease-in-out infinite" }
85020
+ };
84493
85021
  const SessionStatusDot = reactExports.memo(SessionStatusDotInner);
84494
85022
  const STYLES = {
84495
- /**
84496
- * Hollow outline — no fill — so the dot is visible at rest without
84497
- * competing with the title text for attention. Same dimensions as
84498
- * the active variants so the row layout doesn't shift on state flip.
84499
- */
84500
85023
  idle: {
84501
85024
  label: "Idle",
84502
85025
  style: {
@@ -84505,27 +85028,20 @@ const STYLES = {
84505
85028
  opacity: 0.5
84506
85029
  }
84507
85030
  },
84508
- /**
84509
- * Steady accent dot + a `zg-dot` radar ring pinging out behind it
84510
- * (Timeline's tool-running idiom). The ring is an absolute inset-0
84511
- * child, so it never affects layout; the dot itself doesn't animate.
84512
- */
85031
+ // Core scales down to ~5px (a tweenable transform, not a gradient) so the
85032
+ // orbiting arc has breathing room in the 8px slot.
84513
85033
  running: {
84514
85034
  label: "Running",
84515
- style: { background: "var(--zg-accent)" },
84516
- ping: true
85035
+ style: { background: "var(--zg-accent)", transform: "scale(0.62)" },
85036
+ ring: { kind: "orbit" }
84517
85037
  },
85038
+ // This window's own approval / question: the strongest "needs you" cue,
85039
+ // so it ripples outward instead of just breathing.
84518
85040
  pending: {
84519
85041
  label: "Pending approval",
84520
- style: { background: "var(--zg-warn)" }
85042
+ style: { background: "var(--zg-warn)" },
85043
+ ring: { kind: "ripple" }
84521
85044
  },
84522
- /**
84523
- * Daemon presence: some window (possibly this one) has an approval /
84524
- * interaction waiting. Same amber as `pending` (it's the same "needs
84525
- * you" semantic — TUI ◉) plus a breathing glow — `zg-breathe` cycles
84526
- * the whole element's opacity, so the soft amber halo swells and
84527
- * settles with the dot. Alive while scanning, not alarming.
84528
- */
84529
85045
  attention: {
84530
85046
  label: "Awaiting input",
84531
85047
  style: {
@@ -84534,25 +85050,27 @@ const STYLES = {
84534
85050
  animation: "zg-breathe 1.2s ease-in-out infinite"
84535
85051
  }
84536
85052
  },
84537
- /**
84538
- * Daemon presence: attached elsewhere, nothing in flight — TUI ○.
84539
- * Muted green, static — matches the TUI's attached color semantic
84540
- * without motion, so only in-flight states draw the eye.
84541
- */
84542
85053
  attached: {
84543
85054
  label: "Attached",
84544
85055
  style: {
84545
- background: "var(--zg-success)",
84546
- opacity: 0.65
85056
+ background: "transparent",
85057
+ boxShadow: "inset 0 0 0 1.5px var(--zg-success)",
85058
+ opacity: 0.8
84547
85059
  }
84548
85060
  },
84549
85061
  completed: {
84550
85062
  label: "Completed",
84551
- style: { background: "var(--zg-success)" }
85063
+ style: {
85064
+ background: "var(--zg-success)",
85065
+ animation: "zg-pop 320ms cubic-bezier(0.34, 1.56, 0.64, 1) 1"
85066
+ }
84552
85067
  },
84553
85068
  error: {
84554
85069
  label: "Errored",
84555
- style: { background: "var(--zg-danger)" }
85070
+ style: {
85071
+ background: "var(--zg-danger)",
85072
+ boxShadow: "0 0 5px 1px color-mix(in srgb, var(--zg-danger) 45%, transparent)"
85073
+ }
84556
85074
  }
84557
85075
  };
84558
85076
  const PROJECT_GROUP_CAP = 5;
@@ -85278,7 +85796,7 @@ function Footer({
85278
85796
  settings.useDaemon && /* @__PURE__ */ jsxRuntimeExports.jsx(DaemonHealthDot, {}),
85279
85797
  hasAuth === false && /* @__PURE__ */ jsxRuntimeExports.jsx(SignInPrompt, { onClick: onOpenAuth }),
85280
85798
  settings.showUsageIndicator !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(UsageIndicator, {}),
85281
- compacting && settings.showThrobber && /* @__PURE__ */ jsxRuntimeExports.jsx(CompactingIndicator, { progress: compactionProgress }),
85799
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Presence$1, { show: compacting && settings.showThrobber, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CompactingIndicator, { progress: compactionProgress }) }),
85282
85800
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0" }),
85283
85801
  /* @__PURE__ */ jsxRuntimeExports.jsx(
85284
85802
  "button",
@@ -90525,7 +91043,7 @@ function ExtActionRow({
90525
91043
  statusText && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `text-xs break-words ${statusClass}`, children: statusText })
90526
91044
  ] }),
90527
91045
  /* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", onClick: onRun, disabled: anyBusy, className: `${BTN_SECONDARY} shrink-0`, children: lifecycle?.state === "busy" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1.5", children: [
90528
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "i-heroicons-arrow-path animate-spin text-[12px]" }),
91046
+ /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSpinner, { size: "xs", label: "Running" }),
90529
91047
  "Running"
90530
91048
  ] }) : "Run" })
90531
91049
  ] });
@@ -90900,6 +91418,7 @@ const TAB_SECTIONS = {
90900
91418
  keys: ["toolCallDisplay", "showToolResults", "showEditDiffs", "groupToolCalls", "showFullShellOutput"]
90901
91419
  },
90902
91420
  { title: "Transcript", keys: ["showThinking", "hideSubagentOutput", "showRunReceipt", "showTodoIndicator"] },
91421
+ { title: "Artifacts", keys: ["artifacts"] },
90903
91422
  { title: "Subscription usage", keys: ["subscriptionUsage", "showUsageIndicator"] },
90904
91423
  { title: "Composer", keys: ["attachmentsEnabled", "inlineAutocomplete"] }
90905
91424
  ],
@@ -91353,215 +91872,6 @@ function nextOption(row, current) {
91353
91872
  const next = row.options[(idx + 1) % row.options.length];
91354
91873
  return next.value;
91355
91874
  }
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
- }
91565
91875
  const TONE_CLS = {
91566
91876
  ok: "text-[var(--zg-accent)]",
91567
91877
  warn: "text-[#f59e0b]",
@@ -92013,7 +92323,10 @@ function AppShell() {
92013
92323
  const running = useSessionRunning(activeSessionId);
92014
92324
  const peekEvents = usePeekEvents();
92015
92325
  const [contextStatus, setContextStatus] = reactExports.useState(null);
92016
- const [costStatus, setCostStatus] = reactExports.useState(null);
92326
+ const [fetchedCostStatus, setFetchedCostStatus] = reactExports.useState(null);
92327
+ const [accruedCost, setAccruedCost] = reactExports.useState(0);
92328
+ const [streamProgress, setStreamProgress] = reactExports.useState(null);
92329
+ const runGenerationRef = reactExports.useRef(0);
92017
92330
  const [runningWork, setRunningWork] = reactExports.useState([]);
92018
92331
  const [compacting, setCompacting] = reactExports.useState(false);
92019
92332
  const [compactionProgress, setCompactionProgress] = reactExports.useState(
@@ -92021,19 +92334,11 @@ function AppShell() {
92021
92334
  );
92022
92335
  const [hasAuth, setHasAuth] = reactExports.useState(null);
92023
92336
  const [transcriptSearchOpen, setTranscriptSearchOpen] = reactExports.useState(false);
92024
- const [sidebarCollapsed, setSidebarCollapsed] = reactExports.useState(() => {
92025
- try {
92026
- return localStorage.getItem("zg-sidebar-collapsed") === "true";
92027
- } catch {
92028
- return false;
92029
- }
92030
- });
92031
- reactExports.useEffect(() => {
92032
- try {
92033
- localStorage.setItem("zg-sidebar-collapsed", sidebarCollapsed ? "true" : "false");
92034
- } catch {
92035
- }
92036
- }, [sidebarCollapsed]);
92337
+ const [sidebarCollapsed, setSidebarCollapsed] = usePersistedState(
92338
+ "zg-sidebar-collapsed",
92339
+ false,
92340
+ parseBoolean
92341
+ );
92037
92342
  const toggleSidebar = reactExports.useCallback(() => setSidebarCollapsed((prev) => !prev), []);
92038
92343
  const lightsInCenter = sidebarCollapsed;
92039
92344
  const activeSession = reactExports.useMemo(
@@ -92064,19 +92369,26 @@ function AppShell() {
92064
92369
  };
92065
92370
  }, [activeSessionId, running, activeSession?.modelId, activeSession?.providerKey]);
92066
92371
  reactExports.useEffect(() => {
92067
- setCostStatus(null);
92372
+ setFetchedCostStatus(null);
92373
+ setAccruedCost(0);
92374
+ setStreamProgress(null);
92068
92375
  if (!activeSessionId) {
92069
92376
  return;
92070
92377
  }
92071
92378
  let cancelled = false;
92379
+ const settlesAccrual = !running;
92380
+ const generationAtFetch = runGenerationRef.current;
92072
92381
  const fetchCost = () => {
92073
92382
  window.api.sessions.costStatus(activeSessionId).then((status) => {
92074
92383
  if (!cancelled) {
92075
- setCostStatus(status);
92384
+ setFetchedCostStatus(status);
92385
+ if (settlesAccrual && generationAtFetch === runGenerationRef.current) {
92386
+ setAccruedCost(0);
92387
+ }
92076
92388
  }
92077
92389
  }).catch(() => {
92078
92390
  if (!cancelled) {
92079
- setCostStatus(null);
92391
+ setFetchedCostStatus(null);
92080
92392
  }
92081
92393
  });
92082
92394
  };
@@ -92085,6 +92397,47 @@ function AppShell() {
92085
92397
  cancelled = true;
92086
92398
  };
92087
92399
  }, [activeSessionId, running, activeSession?.modelId, activeSession?.providerKey]);
92400
+ reactExports.useEffect(() => {
92401
+ if (!activeSessionId) {
92402
+ return;
92403
+ }
92404
+ const unsubscribe = window.api.chat.onStreamSignal((signal) => {
92405
+ if (!("sessionId" in signal) || signal.sessionId !== activeSessionId) {
92406
+ return;
92407
+ }
92408
+ if (signal.kind === "stream:progress") {
92409
+ setStreamProgress({
92410
+ turnId: signal.turnId,
92411
+ outputTokens: signal.outputTokens,
92412
+ estimated: signal.estimated,
92413
+ elapsedMs: signal.elapsedMs,
92414
+ ...signal.estCostUsd !== void 0 ? { estCostUsd: signal.estCostUsd } : {}
92415
+ });
92416
+ } else if (signal.kind === "turn:end") {
92417
+ if (signal.childId === void 0) {
92418
+ setStreamProgress(null);
92419
+ }
92420
+ const cost = signal.usage?.cost ?? 0;
92421
+ if (cost > 0) {
92422
+ setAccruedCost((prev) => prev + cost);
92423
+ }
92424
+ } else if (signal.kind === "run:start") {
92425
+ runGenerationRef.current += 1;
92426
+ setAccruedCost(0);
92427
+ } else if (signal.kind === "run:end") {
92428
+ setStreamProgress(null);
92429
+ }
92430
+ });
92431
+ return () => {
92432
+ unsubscribe();
92433
+ setStreamProgress(null);
92434
+ };
92435
+ }, [activeSessionId]);
92436
+ const costStatus = reactExports.useMemo(
92437
+ () => composeLiveCost(fetchedCostStatus, accruedCost, running ? streamProgress : null),
92438
+ [fetchedCostStatus, accruedCost, streamProgress, running]
92439
+ );
92440
+ const streaming = running ? streamProgress : null;
92088
92441
  reactExports.useEffect(() => {
92089
92442
  if (!activeSessionId) {
92090
92443
  setCompacting(false);
@@ -92428,22 +92781,13 @@ function AppShell() {
92428
92781
  }
92429
92782
  modal.open(/* @__PURE__ */ jsxRuntimeExports.jsx(TodosModal, { sessionId: activeSession.id }));
92430
92783
  }, [modal, activeSession]);
92784
+ const [artifactsOpen, setArtifactsOpen] = usePersistedState("zg-artifacts-open", false, parseBoolean);
92431
92785
  const openArtifacts = reactExports.useCallback(() => {
92432
92786
  if (!activeSession) {
92433
92787
  return;
92434
92788
  }
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]);
92789
+ setArtifactsOpen((open) => !open);
92790
+ }, [activeSession]);
92447
92791
  const openUsagePanel = reactExports.useCallback(() => {
92448
92792
  modal.open(/* @__PURE__ */ jsxRuntimeExports.jsx(UsagePanelModal, { activeProviderKey: activeSession?.providerKey ?? null }));
92449
92793
  }, [modal, activeSession]);
@@ -92576,7 +92920,7 @@ function AppShell() {
92576
92920
  ...activeSession ? { openEffortPicker } : {},
92577
92921
  ...activeSession ? { openModelPicker } : {},
92578
92922
  ...activeSession ? { openTodos } : {},
92579
- ...activeSession ? { openArtifacts } : {},
92923
+ ...activeSession && settings.artifacts !== false ? { openArtifacts } : {},
92580
92924
  openUsagePanel,
92581
92925
  openMainSession,
92582
92926
  newSession: () => setActiveSessionId(null),
@@ -92639,11 +92983,14 @@ function AppShell() {
92639
92983
  onOpenEffort: activeSession ? openEffortPicker : void 0,
92640
92984
  contextStatus,
92641
92985
  costStatus,
92986
+ streaming,
92642
92987
  runningWorkCount: runningWork.length,
92643
92988
  onOpenRunningWork: openRunningWork,
92644
92989
  lightsInCenter,
92645
92990
  searchOpen: transcriptSearchOpen,
92646
- onCloseSearch: closeTranscriptSearch
92991
+ onCloseSearch: closeTranscriptSearch,
92992
+ artifactsOpen: settings.artifacts !== false && artifactsOpen,
92993
+ ...settings.artifacts !== false ? { onToggleArtifacts: openArtifacts } : {}
92647
92994
  }
92648
92995
  ),
92649
92996
  sidebarCollapsed && /*