zidane-gui 7.0.16 → 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] =
|
|
16975
|
-
|
|
16976
|
-
|
|
16977
|
-
|
|
16978
|
-
|
|
16979
|
-
|
|
16980
|
-
|
|
16981
|
-
|
|
16982
|
-
|
|
16983
|
-
|
|
16984
|
-
|
|
16985
|
-
|
|
16986
|
-
|
|
16987
|
-
|
|
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);
|
|
@@ -74600,8 +74837,39 @@ function SegmentSpinner({ size: size2 = "sm", tone = "inherit", label = "Working
|
|
|
74600
74837
|
}
|
|
74601
74838
|
);
|
|
74602
74839
|
}
|
|
74603
|
-
function
|
|
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
|
+
}) {
|
|
74604
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]);
|
|
74605
74873
|
const folderless = !session.cwd;
|
|
74606
74874
|
const folderName = folderless ? "Chat" : basename$2(session.cwd);
|
|
74607
74875
|
const [menuOpen, setMenuOpen] = reactExports.useState(false);
|
|
@@ -74620,6 +74888,13 @@ function SessionHeader({ session, onOpenDetails, lightsInCenter = false }) {
|
|
|
74620
74888
|
};
|
|
74621
74889
|
const menuItems = reactExports.useMemo(
|
|
74622
74890
|
() => [
|
|
74891
|
+
...onToggleArtifacts ? [
|
|
74892
|
+
{
|
|
74893
|
+
id: "artifacts",
|
|
74894
|
+
label: artifactsOpen ? "Hide artifacts" : "Show artifacts",
|
|
74895
|
+
onSelect: onToggleArtifacts
|
|
74896
|
+
}
|
|
74897
|
+
] : [],
|
|
74623
74898
|
{
|
|
74624
74899
|
id: "compact",
|
|
74625
74900
|
label: compacting ? "Compacting…" : "Compact conversation",
|
|
@@ -74628,7 +74903,7 @@ function SessionHeader({ session, onOpenDetails, lightsInCenter = false }) {
|
|
|
74628
74903
|
}
|
|
74629
74904
|
],
|
|
74630
74905
|
// eslint-disable-next-line react-hooks/exhaustive-deps -- compactNow reads only stable refs + session.id
|
|
74631
|
-
[compacting, session.id]
|
|
74906
|
+
[compacting, session.id, artifactsOpen, onToggleArtifacts]
|
|
74632
74907
|
);
|
|
74633
74908
|
const pickFolder = async () => {
|
|
74634
74909
|
const picked = await window.api.folder.pick();
|
|
@@ -74728,6 +75003,38 @@ function SessionHeader({ session, onOpenDetails, lightsInCenter = false }) {
|
|
|
74728
75003
|
}
|
|
74729
75004
|
),
|
|
74730
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
|
+
),
|
|
74731
75038
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
74732
75039
|
"button",
|
|
74733
75040
|
{
|
|
@@ -74739,7 +75046,7 @@ function SessionHeader({ session, onOpenDetails, lightsInCenter = false }) {
|
|
|
74739
75046
|
"aria-expanded": menuOpen,
|
|
74740
75047
|
onClick: () => setMenuOpen((open) => !open),
|
|
74741
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)]",
|
|
74742
|
-
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 })
|
|
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 }) })
|
|
74743
75050
|
}
|
|
74744
75051
|
),
|
|
74745
75052
|
/* @__PURE__ */ jsxRuntimeExports.jsx(RowActionsMenu, { open: menuOpen, anchorRef: menuTriggerRef, onClose: () => setMenuOpen(false), items: menuItems })
|
|
@@ -74793,7 +75100,7 @@ const TODO_STATUS_GLYPHS = {
|
|
|
74793
75100
|
cancelled: "☒"
|
|
74794
75101
|
};
|
|
74795
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";
|
|
74796
|
-
const GHOST_BTN$
|
|
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";
|
|
74797
75104
|
function TodosModal({ sessionId }) {
|
|
74798
75105
|
const snap = useTodosFor(sessionId);
|
|
74799
75106
|
const { close: close2 } = useModal();
|
|
@@ -74870,7 +75177,7 @@ function TodosModal({ sessionId }) {
|
|
|
74870
75177
|
"button",
|
|
74871
75178
|
{
|
|
74872
75179
|
type: "button",
|
|
74873
|
-
className: `${GHOST_BTN$
|
|
75180
|
+
className: `${GHOST_BTN$1} text-[var(--zg-error)]`,
|
|
74874
75181
|
onClick: () => {
|
|
74875
75182
|
commit(clearTodos());
|
|
74876
75183
|
setConfirmClear(false);
|
|
@@ -74878,12 +75185,12 @@ function TodosModal({ sessionId }) {
|
|
|
74878
75185
|
children: "Yes"
|
|
74879
75186
|
}
|
|
74880
75187
|
),
|
|
74881
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN$
|
|
75188
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN$1, onClick: () => setConfirmClear(false), children: "Cancel" })
|
|
74882
75189
|
] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
74883
75190
|
"button",
|
|
74884
75191
|
{
|
|
74885
75192
|
type: "button",
|
|
74886
|
-
className: GHOST_BTN$
|
|
75193
|
+
className: GHOST_BTN$1,
|
|
74887
75194
|
disabled: base2.length === 0,
|
|
74888
75195
|
onClick: () => setConfirmClear(true),
|
|
74889
75196
|
title: "Remove every todo from the live list",
|
|
@@ -74981,7 +75288,7 @@ function TodosModal({ sessionId }) {
|
|
|
74981
75288
|
className: INPUT_CLS
|
|
74982
75289
|
}
|
|
74983
75290
|
),
|
|
74984
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN$
|
|
75291
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: GHOST_BTN$1, disabled: adding.trim().length === 0, onClick: submitAdd, children: "Add" })
|
|
74985
75292
|
] })
|
|
74986
75293
|
] })
|
|
74987
75294
|
}
|
|
@@ -75580,6 +75887,161 @@ function StackedChart({
|
|
|
75580
75887
|
}
|
|
75581
75888
|
);
|
|
75582
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
|
+
}
|
|
75583
76045
|
function composeEventHandlers(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) {
|
|
75584
76046
|
return function handleEvent(event) {
|
|
75585
76047
|
originalEventHandler?.(event);
|
|
@@ -79984,7 +80446,14 @@ ${task}` : ""}`,
|
|
|
79984
80446
|
}
|
|
79985
80447
|
) }),
|
|
79986
80448
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-2 min-w-0 flex-1", children: [
|
|
79987
|
-
|
|
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
|
+
),
|
|
79988
80457
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-xs min-w-0 truncate", children: [
|
|
79989
80458
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium text-[var(--zg-text)]", children: "Agent" }),
|
|
79990
80459
|
task && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
|
|
@@ -80308,15 +80777,15 @@ function Dot({ variant }) {
|
|
|
80308
80777
|
children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
80309
80778
|
"span",
|
|
80310
80779
|
{
|
|
80311
|
-
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",
|
|
80312
80781
|
style: { background: cfg.bg, borderColor: cfg.border },
|
|
80313
80782
|
children: [
|
|
80314
|
-
cfg.icon
|
|
80315
|
-
variant === "tool-running"
|
|
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(
|
|
80316
80785
|
"span",
|
|
80317
80786
|
{
|
|
80318
80787
|
"aria-hidden": true,
|
|
80319
|
-
className: "absolute
|
|
80788
|
+
className: "absolute inset-0 rounded-full",
|
|
80320
80789
|
style: {
|
|
80321
80790
|
background: "conic-gradient(from 0deg, var(--zg-accent) 0 30%, transparent 30% 100%)",
|
|
80322
80791
|
WebkitMaskImage: "radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 2px))",
|
|
@@ -80324,7 +80793,7 @@ function Dot({ variant }) {
|
|
|
80324
80793
|
animation: "zg-orbit 1.1s linear infinite"
|
|
80325
80794
|
}
|
|
80326
80795
|
}
|
|
80327
|
-
)
|
|
80796
|
+
) })
|
|
80328
80797
|
]
|
|
80329
80798
|
}
|
|
80330
80799
|
)
|
|
@@ -80738,7 +81207,7 @@ ${lines.slice(lines.length - USER_BASH_TAIL_LINES).join("\n")}`;
|
|
|
80738
81207
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-baseline gap-2 max-w-full py-0.5", children: [
|
|
80739
81208
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[var(--zg-accent-hover)] font-medium select-none", children: "!" }),
|
|
80740
81209
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[var(--zg-text)] truncate", children: row.command }),
|
|
80741
|
-
badge
|
|
81210
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Crossfade, { activeKey: row.running ? "running" : row.errored ? "failed" : row.exit === null ? "none" : "exit", children: badge })
|
|
80742
81211
|
] }),
|
|
80743
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 })
|
|
80744
81213
|
] });
|
|
@@ -80762,7 +81231,7 @@ function ToolTiming({
|
|
|
80762
81231
|
return null;
|
|
80763
81232
|
}
|
|
80764
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: [
|
|
80765
|
-
running
|
|
81234
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Presence$1, { show: running, children: /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSpinner, { size: "xs" }) }),
|
|
80766
81235
|
formatToolMs(ms)
|
|
80767
81236
|
] });
|
|
80768
81237
|
}
|
|
@@ -81432,11 +81901,14 @@ function Center({
|
|
|
81432
81901
|
modelId,
|
|
81433
81902
|
contextStatus,
|
|
81434
81903
|
costStatus,
|
|
81904
|
+
streaming = null,
|
|
81435
81905
|
runningWorkCount = 0,
|
|
81436
81906
|
onOpenRunningWork,
|
|
81437
81907
|
lightsInCenter = false,
|
|
81438
81908
|
searchOpen = false,
|
|
81439
|
-
onCloseSearch
|
|
81909
|
+
onCloseSearch,
|
|
81910
|
+
artifactsOpen = false,
|
|
81911
|
+
onToggleArtifacts
|
|
81440
81912
|
}) {
|
|
81441
81913
|
const {
|
|
81442
81914
|
createSession,
|
|
@@ -81698,6 +82170,9 @@ function Center({
|
|
|
81698
82170
|
...defaultProviderKey && defaultModelId ? { providerKey: defaultProviderKey, modelId: defaultModelId } : {}
|
|
81699
82171
|
});
|
|
81700
82172
|
sessionId = created.id;
|
|
82173
|
+
if (defaultAgentId !== "build") {
|
|
82174
|
+
setDefaultAgentId("build");
|
|
82175
|
+
}
|
|
81701
82176
|
}
|
|
81702
82177
|
const bashCommand = text2.trim().startsWith("!") ? text2.trim().slice(1).trim() : "";
|
|
81703
82178
|
if (bashCommand) {
|
|
@@ -81795,7 +82270,16 @@ function Center({
|
|
|
81795
82270
|
* the very top + a wider falloff so the band reads as soft.
|
|
81796
82271
|
*/
|
|
81797
82272
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("main", { className: "flex-1 min-w-0 flex flex-col h-full bg-[var(--zg-bg)]", children: [
|
|
81798
|
-
activeSession ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
82273
|
+
activeSession ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
82274
|
+
SessionHeader,
|
|
82275
|
+
{
|
|
82276
|
+
session: activeSession,
|
|
82277
|
+
onOpenDetails: onOpenSessionDetails,
|
|
82278
|
+
lightsInCenter,
|
|
82279
|
+
artifactsOpen,
|
|
82280
|
+
onToggleArtifacts
|
|
82281
|
+
}
|
|
82282
|
+
) : (
|
|
81799
82283
|
/**
|
|
81800
82284
|
* No session yet — render the header as a pure drag region so the
|
|
81801
82285
|
* window stays movable from the top edge. The sidebar's "+ New chat"
|
|
@@ -81834,103 +82318,109 @@ function Center({
|
|
|
81834
82318
|
}
|
|
81835
82319
|
)
|
|
81836
82320
|
),
|
|
81837
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "
|
|
81838
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
81839
|
-
"
|
|
81840
|
-
|
|
81841
|
-
|
|
81842
|
-
className: "absolute inset-0 overflow-y-auto p-6",
|
|
81843
|
-
style: {
|
|
81844
|
-
maskImage: "linear-gradient(to bottom, transparent 0, black 16px, black 100%)",
|
|
81845
|
-
WebkitMaskImage: "linear-gradient(to bottom, transparent 0, black 16px, black 100%)"
|
|
81846
|
-
},
|
|
81847
|
-
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 }) })
|
|
81848
|
-
}
|
|
81849
|
-
),
|
|
81850
|
-
searchOpen && activeSession && onCloseSearch && /* @__PURE__ */ jsxRuntimeExports.jsx(TranscriptSearch, { container: scrollRef, sessionId: activeSession.id, onClose: onCloseSearch }),
|
|
81851
|
-
composerSearchQuery !== null && /* @__PURE__ */ jsxRuntimeExports.jsx(SearchHighlightStyle, {})
|
|
81852
|
-
] }),
|
|
81853
|
-
/* @__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 ? (
|
|
81854
|
-
/**
|
|
81855
|
-
* Archived sessions are read-only. The chatbox + all of its
|
|
81856
|
-
* peripherals (call status, todo indicator, approval bar,
|
|
81857
|
-
* queue strip) would imply the session can still be driven —
|
|
81858
|
-
* which it can't until the user unarchives. We replace the
|
|
81859
|
-
* whole footer cluster with a single banner so the affordance
|
|
81860
|
-
* is unambiguous.
|
|
81861
|
-
*/
|
|
81862
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
81863
|
-
ArchivedBanner,
|
|
81864
|
-
{
|
|
81865
|
-
onUnarchive: () => {
|
|
81866
|
-
void setArchived(activeSession.id, false);
|
|
81867
|
-
}
|
|
81868
|
-
}
|
|
81869
|
-
)
|
|
81870
|
-
) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
81871
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(ComposerDock, { children: [
|
|
81872
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TodoIndicator, { sessionId: activeSession?.id ?? null }),
|
|
81873
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(ApprovalBar, { sessionId: activeSession?.id ?? null }),
|
|
81874
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(InteractionBar, { sessionId: activeSession?.id ?? null }),
|
|
81875
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(QueueStrip, { messages: queuedMessages, onPush: onPushQueued, onDrop: onDropQueued })
|
|
81876
|
-
] }),
|
|
81877
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
81878
|
-
Chatbox,
|
|
81879
|
-
{
|
|
81880
|
-
disabled: false,
|
|
81881
|
-
folderPath,
|
|
81882
|
-
activeSessionId: activeSession?.id ?? null,
|
|
81883
|
-
running: running && Boolean(activeSession),
|
|
81884
|
-
onStop,
|
|
81885
|
-
onSend: handleSend,
|
|
81886
|
-
onCycleHistory,
|
|
81887
|
-
searchStatus: composerSearchQuery !== null ? composerSearch : null,
|
|
81888
|
-
onSearchQueryChange: onComposerSearchQueryChange,
|
|
81889
|
-
onSearchNavigate: composerSearch.goTo,
|
|
81890
|
-
searchOverlayOpen: searchOpen,
|
|
81891
|
-
remoteSearchApply,
|
|
81892
|
-
leadingActions: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
81893
|
-
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",
|
|
81894
82326
|
{
|
|
81895
|
-
|
|
81896
|
-
|
|
81897
|
-
|
|
81898
|
-
|
|
81899
|
-
|
|
81900
|
-
|
|
81901
|
-
|
|
81902
|
-
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 }) })
|
|
81903
82334
|
}
|
|
81904
82335
|
),
|
|
81905
|
-
|
|
81906
|
-
|
|
81907
|
-
|
|
81908
|
-
|
|
81909
|
-
|
|
81910
|
-
|
|
81911
|
-
|
|
81912
|
-
|
|
81913
|
-
|
|
81914
|
-
|
|
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);
|
|
81915
82353
|
}
|
|
81916
|
-
|
|
81917
|
-
|
|
81918
|
-
|
|
81919
|
-
|
|
81920
|
-
|
|
81921
|
-
|
|
81922
|
-
|
|
81923
|
-
|
|
81924
|
-
|
|
81925
|
-
|
|
81926
|
-
|
|
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 ?? {}
|
|
81927
82389
|
}
|
|
81928
|
-
|
|
81929
|
-
|
|
81930
|
-
|
|
81931
|
-
|
|
81932
|
-
|
|
81933
|
-
|
|
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
|
+
] })
|
|
81934
82424
|
] })
|
|
81935
82425
|
);
|
|
81936
82426
|
}
|
|
@@ -84507,29 +84997,27 @@ function SessionStatusDotInner({ sessionId, override }) {
|
|
|
84507
84997
|
presence
|
|
84508
84998
|
});
|
|
84509
84999
|
const cfg = STYLES[state];
|
|
84510
|
-
|
|
84511
|
-
|
|
84512
|
-
|
|
84513
|
-
|
|
84514
|
-
|
|
84515
|
-
|
|
84516
|
-
|
|
84517
|
-
children: cfg.ring && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `absolute rounded-full ${cfg.ring.className}`, style: cfg.ring.style })
|
|
84518
|
-
}
|
|
84519
|
-
);
|
|
84520
|
-
}
|
|
84521
|
-
function orbitRing(color2) {
|
|
84522
|
-
const mask = "radial-gradient(farthest-side, transparent calc(100% - 1.5px), #000 calc(100% - 1.5px))";
|
|
84523
|
-
return {
|
|
84524
|
-
className: "-inset-[3px]",
|
|
84525
|
-
style: {
|
|
84526
|
-
background: `conic-gradient(from 0deg, ${color2} 0 32%, transparent 32% 100%)`,
|
|
84527
|
-
WebkitMaskImage: mask,
|
|
84528
|
-
maskImage: mask,
|
|
84529
|
-
animation: "zg-orbit 1.1s linear infinite"
|
|
84530
|
-
}
|
|
84531
|
-
};
|
|
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
|
+
] });
|
|
84532
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
|
+
};
|
|
84533
85021
|
const SessionStatusDot = reactExports.memo(SessionStatusDotInner);
|
|
84534
85022
|
const STYLES = {
|
|
84535
85023
|
idle: {
|
|
@@ -84540,24 +85028,19 @@ const STYLES = {
|
|
|
84540
85028
|
opacity: 0.5
|
|
84541
85029
|
}
|
|
84542
85030
|
},
|
|
84543
|
-
// Core
|
|
84544
|
-
//
|
|
85031
|
+
// Core scales down to ~5px (a tweenable transform, not a gradient) so the
|
|
85032
|
+
// orbiting arc has breathing room in the 8px slot.
|
|
84545
85033
|
running: {
|
|
84546
85034
|
label: "Running",
|
|
84547
|
-
style: {
|
|
84548
|
-
|
|
84549
|
-
},
|
|
84550
|
-
ring: orbitRing("var(--zg-accent)")
|
|
85035
|
+
style: { background: "var(--zg-accent)", transform: "scale(0.62)" },
|
|
85036
|
+
ring: { kind: "orbit" }
|
|
84551
85037
|
},
|
|
84552
85038
|
// This window's own approval / question: the strongest "needs you" cue,
|
|
84553
85039
|
// so it ripples outward instead of just breathing.
|
|
84554
85040
|
pending: {
|
|
84555
85041
|
label: "Pending approval",
|
|
84556
85042
|
style: { background: "var(--zg-warn)" },
|
|
84557
|
-
ring: {
|
|
84558
|
-
className: "inset-0",
|
|
84559
|
-
style: { background: "var(--zg-warn)", animation: "zg-dot 1.8s ease-in-out infinite" }
|
|
84560
|
-
}
|
|
85043
|
+
ring: { kind: "ripple" }
|
|
84561
85044
|
},
|
|
84562
85045
|
attention: {
|
|
84563
85046
|
label: "Awaiting input",
|
|
@@ -85313,7 +85796,7 @@ function Footer({
|
|
|
85313
85796
|
settings.useDaemon && /* @__PURE__ */ jsxRuntimeExports.jsx(DaemonHealthDot, {}),
|
|
85314
85797
|
hasAuth === false && /* @__PURE__ */ jsxRuntimeExports.jsx(SignInPrompt, { onClick: onOpenAuth }),
|
|
85315
85798
|
settings.showUsageIndicator !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(UsageIndicator, {}),
|
|
85316
|
-
compacting && settings.showThrobber
|
|
85799
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Presence$1, { show: compacting && settings.showThrobber, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CompactingIndicator, { progress: compactionProgress }) }),
|
|
85317
85800
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0" }),
|
|
85318
85801
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
85319
85802
|
"button",
|
|
@@ -90935,6 +91418,7 @@ const TAB_SECTIONS = {
|
|
|
90935
91418
|
keys: ["toolCallDisplay", "showToolResults", "showEditDiffs", "groupToolCalls", "showFullShellOutput"]
|
|
90936
91419
|
},
|
|
90937
91420
|
{ title: "Transcript", keys: ["showThinking", "hideSubagentOutput", "showRunReceipt", "showTodoIndicator"] },
|
|
91421
|
+
{ title: "Artifacts", keys: ["artifacts"] },
|
|
90938
91422
|
{ title: "Subscription usage", keys: ["subscriptionUsage", "showUsageIndicator"] },
|
|
90939
91423
|
{ title: "Composer", keys: ["attachmentsEnabled", "inlineAutocomplete"] }
|
|
90940
91424
|
],
|
|
@@ -91388,215 +91872,6 @@ function nextOption(row, current) {
|
|
|
91388
91872
|
const next = row.options[(idx + 1) % row.options.length];
|
|
91389
91873
|
return next.value;
|
|
91390
91874
|
}
|
|
91391
|
-
const ArtifactsContext = reactExports.createContext(null);
|
|
91392
|
-
function ArtifactsProvider({ children }) {
|
|
91393
|
-
const [byId, setById] = reactExports.useState(() => /* @__PURE__ */ new Map());
|
|
91394
|
-
const pending = reactExports.useRef(/* @__PURE__ */ new Set());
|
|
91395
|
-
const fetch = reactExports.useCallback(async (sessionId) => {
|
|
91396
|
-
const groups = await window.api.artifacts.list({ sessionId });
|
|
91397
|
-
setById((prev) => {
|
|
91398
|
-
const next = new Map(prev);
|
|
91399
|
-
next.set(sessionId, groups);
|
|
91400
|
-
return next;
|
|
91401
|
-
});
|
|
91402
|
-
}, []);
|
|
91403
|
-
reactExports.useEffect(() => {
|
|
91404
|
-
return window.api.chat.onStreamSignal((signal) => {
|
|
91405
|
-
if (signal.kind !== "artifact:recorded" && signal.kind !== "artifact:changed") return;
|
|
91406
|
-
const { sessionId } = signal;
|
|
91407
|
-
if (pending.current.has(sessionId)) return;
|
|
91408
|
-
pending.current.add(sessionId);
|
|
91409
|
-
queueMicrotask(() => {
|
|
91410
|
-
pending.current.delete(sessionId);
|
|
91411
|
-
void fetch(sessionId).catch(() => void 0);
|
|
91412
|
-
});
|
|
91413
|
-
});
|
|
91414
|
-
}, [fetch]);
|
|
91415
|
-
const groupsFor = reactExports.useCallback(
|
|
91416
|
-
(sessionId) => sessionId ? byId.get(sessionId) ?? null : null,
|
|
91417
|
-
[byId]
|
|
91418
|
-
);
|
|
91419
|
-
const value = reactExports.useMemo(() => ({ groupsFor, fetch }), [groupsFor, fetch]);
|
|
91420
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(ArtifactsContext.Provider, { value, children });
|
|
91421
|
-
}
|
|
91422
|
-
function useArtifactsFor(sessionId) {
|
|
91423
|
-
const ctx = reactExports.useContext(ArtifactsContext);
|
|
91424
|
-
if (!ctx) throw new Error("useArtifactsFor must be used within ArtifactsProvider");
|
|
91425
|
-
return ctx.groupsFor(sessionId);
|
|
91426
|
-
}
|
|
91427
|
-
function useArtifactsFetcher() {
|
|
91428
|
-
const ctx = reactExports.useContext(ArtifactsContext);
|
|
91429
|
-
if (!ctx) throw new Error("useArtifactsFetcher must be used within ArtifactsProvider");
|
|
91430
|
-
return ctx.fetch;
|
|
91431
|
-
}
|
|
91432
|
-
function countArtifacts(groups) {
|
|
91433
|
-
return groups ? groups.reduce((n, g) => n + g.rows.length, 0) : 0;
|
|
91434
|
-
}
|
|
91435
|
-
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";
|
|
91436
|
-
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)]"}`;
|
|
91437
|
-
function ArtifactsModal({ sessionId, projectRoot, sessionTitle }) {
|
|
91438
|
-
const { close: close2 } = useModal();
|
|
91439
|
-
const cached = useArtifactsFor(sessionId);
|
|
91440
|
-
const fetchSession = useArtifactsFetcher();
|
|
91441
|
-
const [scope, setScope] = reactExports.useState("session");
|
|
91442
|
-
const [project, setProject] = reactExports.useState(null);
|
|
91443
|
-
const [error, setError] = reactExports.useState(null);
|
|
91444
|
-
reactExports.useEffect(() => {
|
|
91445
|
-
void fetchSession(sessionId).catch((err) => setError(err.message));
|
|
91446
|
-
}, [fetchSession, sessionId]);
|
|
91447
|
-
const loadProject = reactExports.useCallback(async () => {
|
|
91448
|
-
if (!projectRoot) return;
|
|
91449
|
-
try {
|
|
91450
|
-
setProject(await window.api.artifacts.list({ projectRoot }));
|
|
91451
|
-
} catch (err) {
|
|
91452
|
-
setError(err.message);
|
|
91453
|
-
}
|
|
91454
|
-
}, [projectRoot]);
|
|
91455
|
-
reactExports.useEffect(() => {
|
|
91456
|
-
if (scope !== "project") return;
|
|
91457
|
-
void loadProject();
|
|
91458
|
-
return window.api.chat.onStreamSignal((signal) => {
|
|
91459
|
-
if (signal.kind === "artifact:recorded" || signal.kind === "artifact:changed") void loadProject();
|
|
91460
|
-
});
|
|
91461
|
-
}, [scope, loadProject]);
|
|
91462
|
-
const groups = scope === "project" ? project : cached;
|
|
91463
|
-
const total = countArtifacts(groups);
|
|
91464
|
-
const refreshed = reactExports.useRef(/* @__PURE__ */ new Set());
|
|
91465
|
-
const refresh = reactExports.useCallback((row) => {
|
|
91466
|
-
if (refreshed.current.has(row.artifact.id)) return;
|
|
91467
|
-
refreshed.current.add(row.artifact.id);
|
|
91468
|
-
void window.api.artifacts.refresh(row.artifact).catch(() => void 0);
|
|
91469
|
-
}, []);
|
|
91470
|
-
const remove = reactExports.useCallback(
|
|
91471
|
-
(row) => {
|
|
91472
|
-
setError(null);
|
|
91473
|
-
void window.api.artifacts.delete(row.artifact.sessionId, row.artifact.id).then((ok2) => {
|
|
91474
|
-
if (!ok2) setError("This session store does not support artifacts.");
|
|
91475
|
-
else if (scope === "project") void loadProject();
|
|
91476
|
-
}).catch((err) => setError(err.message));
|
|
91477
|
-
},
|
|
91478
|
-
[scope, loadProject]
|
|
91479
|
-
);
|
|
91480
|
-
const description = reactExports.useMemo(() => {
|
|
91481
|
-
if (groups === null) return "Loading…";
|
|
91482
|
-
if (total === 0) {
|
|
91483
|
-
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.";
|
|
91484
|
-
}
|
|
91485
|
-
return groups.map((g) => `${g.rows.length} ${plural(g.label, g.rows.length)}`).join(" · ");
|
|
91486
|
-
}, [groups, total, scope, projectRoot]);
|
|
91487
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
91488
|
-
ModalShell,
|
|
91489
|
-
{
|
|
91490
|
-
title: "Artifacts",
|
|
91491
|
-
description,
|
|
91492
|
-
onClose: close2,
|
|
91493
|
-
size: "medium",
|
|
91494
|
-
footer: projectRoot ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-1 w-full", children: [
|
|
91495
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "button", className: TAB_BTN(scope === "session"), onClick: () => setScope("session"), children: "This session" }),
|
|
91496
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
91497
|
-
"button",
|
|
91498
|
-
{
|
|
91499
|
-
type: "button",
|
|
91500
|
-
className: TAB_BTN(scope === "project"),
|
|
91501
|
-
onClick: () => setScope("project"),
|
|
91502
|
-
title: `Every session under ${projectRoot}`,
|
|
91503
|
-
children: "Project"
|
|
91504
|
-
}
|
|
91505
|
-
)
|
|
91506
|
-
] }) : void 0,
|
|
91507
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-3 p-4", children: [
|
|
91508
|
-
error && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-xs text-[var(--zg-warn)] px-1", role: "alert", children: error }),
|
|
91509
|
-
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: [
|
|
91510
|
-
/* @__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` }),
|
|
91511
|
-
/* @__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(
|
|
91512
|
-
ArtifactRow,
|
|
91513
|
-
{
|
|
91514
|
-
row,
|
|
91515
|
-
showSession: scope === "project",
|
|
91516
|
-
sessionTitle,
|
|
91517
|
-
onFocus: () => refresh(row),
|
|
91518
|
-
onRemove: () => remove(row)
|
|
91519
|
-
},
|
|
91520
|
-
row.artifact.id
|
|
91521
|
-
)) })
|
|
91522
|
-
] }, group.kind)) })
|
|
91523
|
-
] })
|
|
91524
|
-
}
|
|
91525
|
-
);
|
|
91526
|
-
}
|
|
91527
|
-
function ArtifactRow({
|
|
91528
|
-
row,
|
|
91529
|
-
showSession,
|
|
91530
|
-
sessionTitle,
|
|
91531
|
-
onFocus,
|
|
91532
|
-
onRemove
|
|
91533
|
-
}) {
|
|
91534
|
-
const { artifact, row: view } = row;
|
|
91535
|
-
const href = view.href;
|
|
91536
|
-
const isUrl2 = href !== void 0 && /^https?:\/\//.test(href);
|
|
91537
|
-
const session = showSession ? sessionTitle?.(artifact.sessionId) ?? artifact.sessionId.slice(0, 8) : void 0;
|
|
91538
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
91539
|
-
"li",
|
|
91540
|
-
{
|
|
91541
|
-
className: "group flex items-start gap-3 px-3 py-2 rounded-md bg-[var(--zg-bg)] border border-[var(--zg-border)]",
|
|
91542
|
-
onMouseEnter: onFocus,
|
|
91543
|
-
onFocus,
|
|
91544
|
-
children: [
|
|
91545
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0 flex flex-col gap-0.5", children: [
|
|
91546
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
91547
|
-
isUrl2 ? (
|
|
91548
|
-
// `target="_blank"` routes through main's window-open handler → `shell.openExternal`.
|
|
91549
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
91550
|
-
"a",
|
|
91551
|
-
{
|
|
91552
|
-
href,
|
|
91553
|
-
target: "_blank",
|
|
91554
|
-
rel: "noreferrer",
|
|
91555
|
-
className: "truncate text-sm text-[var(--zg-text)] hover:text-[var(--zg-accent)] no-underline hover:underline",
|
|
91556
|
-
title: href,
|
|
91557
|
-
children: view.title
|
|
91558
|
-
}
|
|
91559
|
-
)
|
|
91560
|
-
) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-sm text-[var(--zg-text)]", title: href ?? artifact.uri, children: view.title }),
|
|
91561
|
-
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 }),
|
|
91562
|
-
session && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "shrink-0 text-xs text-[var(--zg-text-muted)]", children: [
|
|
91563
|
-
"— ",
|
|
91564
|
-
session
|
|
91565
|
-
] })
|
|
91566
|
-
] }),
|
|
91567
|
-
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 })
|
|
91568
|
-
] }),
|
|
91569
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
91570
|
-
"button",
|
|
91571
|
-
{
|
|
91572
|
-
type: "button",
|
|
91573
|
-
"aria-label": "Copy locator",
|
|
91574
|
-
title: "Copy",
|
|
91575
|
-
onClick: () => void navigator.clipboard.writeText(href ?? artifact.uri),
|
|
91576
|
-
className: `${GHOST_BTN$1} opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,
|
|
91577
|
-
children: "copy"
|
|
91578
|
-
}
|
|
91579
|
-
),
|
|
91580
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
91581
|
-
"button",
|
|
91582
|
-
{
|
|
91583
|
-
type: "button",
|
|
91584
|
-
"aria-label": "Remove artifact",
|
|
91585
|
-
title: "Remove from this session",
|
|
91586
|
-
onClick: onRemove,
|
|
91587
|
-
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",
|
|
91588
|
-
children: "×"
|
|
91589
|
-
}
|
|
91590
|
-
)
|
|
91591
|
-
]
|
|
91592
|
-
}
|
|
91593
|
-
);
|
|
91594
|
-
}
|
|
91595
|
-
function plural(label, count2) {
|
|
91596
|
-
const lower2 = label.toLowerCase();
|
|
91597
|
-
if (count2 === 1) return lower2;
|
|
91598
|
-
return /(?:s|x|ch|sh)$/.test(lower2) ? `${lower2}es` : `${lower2}s`;
|
|
91599
|
-
}
|
|
91600
91875
|
const TONE_CLS = {
|
|
91601
91876
|
ok: "text-[var(--zg-accent)]",
|
|
91602
91877
|
warn: "text-[#f59e0b]",
|
|
@@ -92048,7 +92323,10 @@ function AppShell() {
|
|
|
92048
92323
|
const running = useSessionRunning(activeSessionId);
|
|
92049
92324
|
const peekEvents = usePeekEvents();
|
|
92050
92325
|
const [contextStatus, setContextStatus] = reactExports.useState(null);
|
|
92051
|
-
const [
|
|
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);
|
|
92052
92330
|
const [runningWork, setRunningWork] = reactExports.useState([]);
|
|
92053
92331
|
const [compacting, setCompacting] = reactExports.useState(false);
|
|
92054
92332
|
const [compactionProgress, setCompactionProgress] = reactExports.useState(
|
|
@@ -92056,19 +92334,11 @@ function AppShell() {
|
|
|
92056
92334
|
);
|
|
92057
92335
|
const [hasAuth, setHasAuth] = reactExports.useState(null);
|
|
92058
92336
|
const [transcriptSearchOpen, setTranscriptSearchOpen] = reactExports.useState(false);
|
|
92059
|
-
const [sidebarCollapsed, setSidebarCollapsed] =
|
|
92060
|
-
|
|
92061
|
-
|
|
92062
|
-
|
|
92063
|
-
|
|
92064
|
-
}
|
|
92065
|
-
});
|
|
92066
|
-
reactExports.useEffect(() => {
|
|
92067
|
-
try {
|
|
92068
|
-
localStorage.setItem("zg-sidebar-collapsed", sidebarCollapsed ? "true" : "false");
|
|
92069
|
-
} catch {
|
|
92070
|
-
}
|
|
92071
|
-
}, [sidebarCollapsed]);
|
|
92337
|
+
const [sidebarCollapsed, setSidebarCollapsed] = usePersistedState(
|
|
92338
|
+
"zg-sidebar-collapsed",
|
|
92339
|
+
false,
|
|
92340
|
+
parseBoolean
|
|
92341
|
+
);
|
|
92072
92342
|
const toggleSidebar = reactExports.useCallback(() => setSidebarCollapsed((prev) => !prev), []);
|
|
92073
92343
|
const lightsInCenter = sidebarCollapsed;
|
|
92074
92344
|
const activeSession = reactExports.useMemo(
|
|
@@ -92099,19 +92369,26 @@ function AppShell() {
|
|
|
92099
92369
|
};
|
|
92100
92370
|
}, [activeSessionId, running, activeSession?.modelId, activeSession?.providerKey]);
|
|
92101
92371
|
reactExports.useEffect(() => {
|
|
92102
|
-
|
|
92372
|
+
setFetchedCostStatus(null);
|
|
92373
|
+
setAccruedCost(0);
|
|
92374
|
+
setStreamProgress(null);
|
|
92103
92375
|
if (!activeSessionId) {
|
|
92104
92376
|
return;
|
|
92105
92377
|
}
|
|
92106
92378
|
let cancelled = false;
|
|
92379
|
+
const settlesAccrual = !running;
|
|
92380
|
+
const generationAtFetch = runGenerationRef.current;
|
|
92107
92381
|
const fetchCost = () => {
|
|
92108
92382
|
window.api.sessions.costStatus(activeSessionId).then((status) => {
|
|
92109
92383
|
if (!cancelled) {
|
|
92110
|
-
|
|
92384
|
+
setFetchedCostStatus(status);
|
|
92385
|
+
if (settlesAccrual && generationAtFetch === runGenerationRef.current) {
|
|
92386
|
+
setAccruedCost(0);
|
|
92387
|
+
}
|
|
92111
92388
|
}
|
|
92112
92389
|
}).catch(() => {
|
|
92113
92390
|
if (!cancelled) {
|
|
92114
|
-
|
|
92391
|
+
setFetchedCostStatus(null);
|
|
92115
92392
|
}
|
|
92116
92393
|
});
|
|
92117
92394
|
};
|
|
@@ -92120,6 +92397,47 @@ function AppShell() {
|
|
|
92120
92397
|
cancelled = true;
|
|
92121
92398
|
};
|
|
92122
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;
|
|
92123
92441
|
reactExports.useEffect(() => {
|
|
92124
92442
|
if (!activeSessionId) {
|
|
92125
92443
|
setCompacting(false);
|
|
@@ -92463,22 +92781,13 @@ function AppShell() {
|
|
|
92463
92781
|
}
|
|
92464
92782
|
modal.open(/* @__PURE__ */ jsxRuntimeExports.jsx(TodosModal, { sessionId: activeSession.id }));
|
|
92465
92783
|
}, [modal, activeSession]);
|
|
92784
|
+
const [artifactsOpen, setArtifactsOpen] = usePersistedState("zg-artifacts-open", false, parseBoolean);
|
|
92466
92785
|
const openArtifacts = reactExports.useCallback(() => {
|
|
92467
92786
|
if (!activeSession) {
|
|
92468
92787
|
return;
|
|
92469
92788
|
}
|
|
92470
|
-
|
|
92471
|
-
|
|
92472
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
92473
|
-
ArtifactsModal,
|
|
92474
|
-
{
|
|
92475
|
-
sessionId: activeSession.id,
|
|
92476
|
-
...projectRoot ? { projectRoot } : {},
|
|
92477
|
-
sessionTitle: (id) => sessions.find((s2) => s2.id === id)?.title
|
|
92478
|
-
}
|
|
92479
|
-
)
|
|
92480
|
-
);
|
|
92481
|
-
}, [modal, activeSession, sessions]);
|
|
92789
|
+
setArtifactsOpen((open) => !open);
|
|
92790
|
+
}, [activeSession]);
|
|
92482
92791
|
const openUsagePanel = reactExports.useCallback(() => {
|
|
92483
92792
|
modal.open(/* @__PURE__ */ jsxRuntimeExports.jsx(UsagePanelModal, { activeProviderKey: activeSession?.providerKey ?? null }));
|
|
92484
92793
|
}, [modal, activeSession]);
|
|
@@ -92611,7 +92920,7 @@ function AppShell() {
|
|
|
92611
92920
|
...activeSession ? { openEffortPicker } : {},
|
|
92612
92921
|
...activeSession ? { openModelPicker } : {},
|
|
92613
92922
|
...activeSession ? { openTodos } : {},
|
|
92614
|
-
...activeSession ? { openArtifacts } : {},
|
|
92923
|
+
...activeSession && settings.artifacts !== false ? { openArtifacts } : {},
|
|
92615
92924
|
openUsagePanel,
|
|
92616
92925
|
openMainSession,
|
|
92617
92926
|
newSession: () => setActiveSessionId(null),
|
|
@@ -92674,11 +92983,14 @@ function AppShell() {
|
|
|
92674
92983
|
onOpenEffort: activeSession ? openEffortPicker : void 0,
|
|
92675
92984
|
contextStatus,
|
|
92676
92985
|
costStatus,
|
|
92986
|
+
streaming,
|
|
92677
92987
|
runningWorkCount: runningWork.length,
|
|
92678
92988
|
onOpenRunningWork: openRunningWork,
|
|
92679
92989
|
lightsInCenter,
|
|
92680
92990
|
searchOpen: transcriptSearchOpen,
|
|
92681
|
-
onCloseSearch: closeTranscriptSearch
|
|
92991
|
+
onCloseSearch: closeTranscriptSearch,
|
|
92992
|
+
artifactsOpen: settings.artifacts !== false && artifactsOpen,
|
|
92993
|
+
...settings.artifacts !== false ? { onToggleArtifacts: openArtifacts } : {}
|
|
92682
92994
|
}
|
|
92683
92995
|
),
|
|
92684
92996
|
sidebarCollapsed && /*
|