zidane-gui 8.2.3 → 8.2.5
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.
- package/out/main/chunks/{history-pager-Bd5PUapJ.js → history-pager-DWgllMof.js} +3 -43
- package/out/main/chunks/session-search-sql-BrNTuwjH.js +196 -0
- package/out/main/chunks/transcript-sql-DbZ-a5wb.js +43 -0
- package/out/main/history-worker.js +2 -1
- package/out/main/index.js +120 -210
- package/out/main/session-search-worker.js +20 -0
- package/out/preload/index.mjs +3 -1
- package/out/renderer/assets/{ghostty-web-DeA_Bbgl.js → ghostty-web-wgkS5jGl.js} +1 -1
- package/out/renderer/assets/{index-D0fPExZY.js → index-CebkAnp4.js} +949 -398
- package/out/renderer/assets/{index-BblJFgWQ.css → index-DqGrzqUj.css} +1 -1
- package/out/renderer/index.html +2 -2
- package/package.json +2 -2
|
@@ -26111,6 +26111,7 @@ function modelDisplayName({ providerKey, modelId, modelName }) {
|
|
|
26111
26111
|
} : { name: name2 };
|
|
26112
26112
|
}
|
|
26113
26113
|
const RUN_RECEIPT_TURN_GLYPH = "↻";
|
|
26114
|
+
const RUN_RECEIPT_SWITCH_GLYPH = "⇄";
|
|
26114
26115
|
function formatTokenCount(tokens) {
|
|
26115
26116
|
if (tokens >= 1e6) return `${(tokens / 1e6).toFixed(1)}M`;
|
|
26116
26117
|
if (tokens >= 1e3) return `${(tokens / 1e3).toFixed(tokens >= 1e4 ? 0 : 1)}k`;
|
|
@@ -26135,6 +26136,10 @@ const nameFromModelId = (modelId, providerKey) => modelDisplayName({
|
|
|
26135
26136
|
}).name;
|
|
26136
26137
|
function formatRunReceiptCells(r2, modelName = nameFromModelId) {
|
|
26137
26138
|
const cells2 = [];
|
|
26139
|
+
if (r2.agent) cells2.push({
|
|
26140
|
+
kind: "agent",
|
|
26141
|
+
text: r2.agentSwitched ? `⇄${r2.agent}` : r2.agent
|
|
26142
|
+
});
|
|
26138
26143
|
if (r2.modelId) {
|
|
26139
26144
|
const name2 = modelName(r2.modelId, r2.providerKey);
|
|
26140
26145
|
cells2.push({
|
|
@@ -26445,6 +26450,7 @@ const DEFAULT_SETTINGS = {
|
|
|
26445
26450
|
hideSubagentOutput: true,
|
|
26446
26451
|
subagentModels: true,
|
|
26447
26452
|
imageGeneration: true,
|
|
26453
|
+
webSearch: true,
|
|
26448
26454
|
imageModel: "",
|
|
26449
26455
|
maxParallelSubagents: 3,
|
|
26450
26456
|
queueMessages: true,
|
|
@@ -27937,6 +27943,12 @@ const SETTINGS_TOGGLES$1 = [
|
|
|
27937
27943
|
label: "Image generation",
|
|
27938
27944
|
description: "Let the agent generate images with your providers' image models. Each image is billed by the provider."
|
|
27939
27945
|
},
|
|
27946
|
+
{
|
|
27947
|
+
category: "agent",
|
|
27948
|
+
key: "webSearch",
|
|
27949
|
+
label: "Web search",
|
|
27950
|
+
description: "Let the agent search the web for docs, errors and recent changes."
|
|
27951
|
+
},
|
|
27940
27952
|
{
|
|
27941
27953
|
category: "agent",
|
|
27942
27954
|
key: "decisions",
|
|
@@ -28028,7 +28040,7 @@ const SETTINGS_TOGGLES$1 = [
|
|
|
28028
28040
|
category: "ui",
|
|
28029
28041
|
key: "showRunReceipt",
|
|
28030
28042
|
label: "Run receipt",
|
|
28031
|
-
description: "Show model, time, cost and tokens after each run."
|
|
28043
|
+
description: "Show agent, model, time, cost and tokens after each run."
|
|
28032
28044
|
},
|
|
28033
28045
|
{
|
|
28034
28046
|
category: "ui",
|
|
@@ -30549,6 +30561,14 @@ const ONBOARDING_FEATURES = [
|
|
|
30549
30561
|
unlocks: "Many tool calls in one step. Long tasks take fewer turns, so runs finish faster and cost less.",
|
|
30550
30562
|
prevents: "A context full of small tool results. Only what the script prints goes back to the model."
|
|
30551
30563
|
},
|
|
30564
|
+
{
|
|
30565
|
+
key: "webSearch",
|
|
30566
|
+
group: "work",
|
|
30567
|
+
surfaces: BOTH,
|
|
30568
|
+
example: "For example, a build fails after a library update. The agent searches the error and reads the release notes.",
|
|
30569
|
+
unlocks: "Answers from the web: current docs, error messages, and changes newer than the model.",
|
|
30570
|
+
prevents: "Off, the agent never reaches a search engine, and works only from your files and what it already knows."
|
|
30571
|
+
},
|
|
30552
30572
|
{
|
|
30553
30573
|
key: "inlineAutocomplete",
|
|
30554
30574
|
group: "work",
|
|
@@ -32964,9 +32984,9 @@ function searchHighlightRanges(text2, query) {
|
|
|
32964
32984
|
const parsed = parseQuery(query.trim());
|
|
32965
32985
|
if (parsed.tokens.length === 0) return [];
|
|
32966
32986
|
const lowerText = lower(text2);
|
|
32967
|
-
const phrase = findTermRanges(lowerText, parsed.phraseLower);
|
|
32987
|
+
const phrase = findTermRanges$1(lowerText, parsed.phraseLower);
|
|
32968
32988
|
if (phrase.length > 0) return mergeRanges$1(phrase, text2.length);
|
|
32969
|
-
const exact = parsed.tokens.flatMap((token2) => findTermRanges(lowerText, token2.lower));
|
|
32989
|
+
const exact = parsed.tokens.flatMap((token2) => findTermRanges$1(lowerText, token2.lower));
|
|
32970
32990
|
if (exact.length > 0) return mergeRanges$1(exact, text2.length);
|
|
32971
32991
|
return mergeRanges$1(parsed.tokens.flatMap((token2) => findFuzzyWordRange(lowerText, token2.lower) ?? []), text2.length);
|
|
32972
32992
|
}
|
|
@@ -33038,7 +33058,7 @@ function tokenize$2(query) {
|
|
|
33038
33058
|
}
|
|
33039
33059
|
return tokens.filter((token2) => token2.text.length > 0);
|
|
33040
33060
|
}
|
|
33041
|
-
function findTermRanges(text2, termLower) {
|
|
33061
|
+
function findTermRanges$1(text2, termLower) {
|
|
33042
33062
|
if (!termLower) return [];
|
|
33043
33063
|
const ranges2 = [];
|
|
33044
33064
|
let from2 = 0;
|
|
@@ -35700,6 +35720,11 @@ const SETTINGS_TOGGLES = withCanonicalGates([
|
|
|
35700
35720
|
label: "Image generation",
|
|
35701
35721
|
description: "Let the agent generate images with your providers' image models. Pick the model in the model picker's Image tab. Each image is billed by the provider."
|
|
35702
35722
|
},
|
|
35723
|
+
{
|
|
35724
|
+
key: "webSearch",
|
|
35725
|
+
label: "Web search",
|
|
35726
|
+
description: "Let the agent search the web for docs, errors and recent changes."
|
|
35727
|
+
},
|
|
35703
35728
|
{
|
|
35704
35729
|
key: "sandbox",
|
|
35705
35730
|
label: "Sandbox shell commands",
|
|
@@ -35733,7 +35758,7 @@ const SETTINGS_TOGGLES = withCanonicalGates([
|
|
|
35733
35758
|
{
|
|
35734
35759
|
key: "showRunReceipt",
|
|
35735
35760
|
label: "Run receipt",
|
|
35736
|
-
description: "Show model, time, cost and tokens after each run."
|
|
35761
|
+
description: "Show agent, model, time, cost and tokens after each run."
|
|
35737
35762
|
},
|
|
35738
35763
|
{
|
|
35739
35764
|
key: "showCacheNotices",
|
|
@@ -37997,6 +38022,8 @@ const DEFAULT_CHAT_LABELS = {
|
|
|
37997
38022
|
runRetrying: (attempt, max2, source) => runRetryingLabel({ attempt, max: max2, source }),
|
|
37998
38023
|
// Run receipt
|
|
37999
38024
|
runReceipt: "Run receipt",
|
|
38025
|
+
receiptAgent: "Agent that ran this turn",
|
|
38026
|
+
receiptAgentSwitched: "Agent that ran this turn, switched from the previous run",
|
|
38000
38027
|
receiptModel: "Model that ran this turn",
|
|
38001
38028
|
receiptModelOthers: (others) => `Model that wrote the last reply. ${others} other model${others === 1 ? "" : "s"} ran earlier turns.`,
|
|
38002
38029
|
receiptDuration: "Run time, tools included",
|
|
@@ -42352,14 +42379,14 @@ const entries$2 = /* @__PURE__ */ new Map();
|
|
|
42352
42379
|
const invalidationListeners = /* @__PURE__ */ new Set();
|
|
42353
42380
|
const watchCounts = /* @__PURE__ */ new Map();
|
|
42354
42381
|
let wired$5 = false;
|
|
42355
|
-
const IDLE$
|
|
42382
|
+
const IDLE$2 = Object.freeze({
|
|
42356
42383
|
data: void 0,
|
|
42357
42384
|
error: void 0,
|
|
42358
42385
|
status: "idle",
|
|
42359
42386
|
stale: false,
|
|
42360
42387
|
refresh: () => Promise.resolve()
|
|
42361
42388
|
});
|
|
42362
|
-
const PENDING = Object.freeze({ ...IDLE$
|
|
42389
|
+
const PENDING = Object.freeze({ ...IDLE$2, status: "loading" });
|
|
42363
42390
|
function serializeIpcResourceKey(key2) {
|
|
42364
42391
|
return typeof key2 === "string" ? key2 : JSON.stringify(key2);
|
|
42365
42392
|
}
|
|
@@ -42523,7 +42550,7 @@ function useIpcResource(spec) {
|
|
|
42523
42550
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42524
42551
|
[id2]
|
|
42525
42552
|
);
|
|
42526
|
-
const read2 = () => id2 ? entries$2.get(id2)?.snapshot ?? PENDING : IDLE$
|
|
42553
|
+
const read2 = () => id2 ? entries$2.get(id2)?.snapshot ?? PENDING : IDLE$2;
|
|
42527
42554
|
return reactExports.useSyncExternalStore(subscribe2, read2, read2);
|
|
42528
42555
|
}
|
|
42529
42556
|
function subscribeIpcResource(spec, onChange) {
|
|
@@ -45554,7 +45581,7 @@ function loadSymbolsFont(url) {
|
|
|
45554
45581
|
return symbolsFont;
|
|
45555
45582
|
}
|
|
45556
45583
|
function loadGhostty$1(symbolsFontUrl2) {
|
|
45557
|
-
ghosttyModule ??= Promise.all([__vitePreload(() => import("./ghostty-web-
|
|
45584
|
+
ghosttyModule ??= Promise.all([__vitePreload(() => import("./ghostty-web-wgkS5jGl.js"), true ? [] : void 0, import.meta.url), loadSymbolsFont(symbolsFontUrl2)]).then(async ([m2]) => {
|
|
45558
45585
|
await m2.init();
|
|
45559
45586
|
drawBoxGlyphs(m2);
|
|
45560
45587
|
return m2;
|
|
@@ -64147,8 +64174,14 @@ function savedPaths(text2) {
|
|
|
64147
64174
|
return m2 ? [m2[1]] : [];
|
|
64148
64175
|
});
|
|
64149
64176
|
}
|
|
64177
|
+
const isImageRequest = (tool) => tool.name === "generate_image" && tool.rawInput?.list !== true;
|
|
64178
|
+
function imageRequestsOf(tool) {
|
|
64179
|
+
if (tool.parentId !== void 0) return [];
|
|
64180
|
+
if (isImageRequest(tool)) return [tool.rawInput ?? {}];
|
|
64181
|
+
return (tool.children ?? []).filter(isImageRequest).map((child) => child.rawInput ?? {});
|
|
64182
|
+
}
|
|
64150
64183
|
function drawsImageGeneration(tool) {
|
|
64151
|
-
return tool.
|
|
64184
|
+
return imageRequestsOf(tool).length > 0;
|
|
64152
64185
|
}
|
|
64153
64186
|
function ImageFrame({
|
|
64154
64187
|
src,
|
|
@@ -64205,14 +64238,17 @@ function ImageGenerationBlock({
|
|
|
64205
64238
|
const lightbox = useLightbox();
|
|
64206
64239
|
const media = useToolMedia(tool, tool.result);
|
|
64207
64240
|
const [failed, setFailed] = reactExports.useState(() => /* @__PURE__ */ new Set());
|
|
64208
|
-
const
|
|
64209
|
-
const
|
|
64210
|
-
|
|
64241
|
+
const requests = imageRequestsOf(tool);
|
|
64242
|
+
const ratios = requests.flatMap(
|
|
64243
|
+
(input) => Array(requestedCount(input.n)).fill(cssRatio(input.aspect_ratio))
|
|
64244
|
+
);
|
|
64245
|
+
const models = new Set(requests.map((input) => typeof input.model === "string" ? input.model : ""));
|
|
64246
|
+
const model = models.size === 1 ? [...models][0] || null : null;
|
|
64211
64247
|
const running2 = tool.ok === null;
|
|
64212
64248
|
if (running2) {
|
|
64213
|
-
const count2 =
|
|
64249
|
+
const count2 = ratios.length;
|
|
64214
64250
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex flex-col gap-1.5", "data-testid": "image-generation", "aria-busy": "true", children: [
|
|
64215
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1.5", children:
|
|
64251
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex flex-wrap gap-1.5", children: ratios.map((ratio, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx(ImageFrame, { src: null, ratio, pending: true, label: "", onFail: () => void 0 }, i2)) }),
|
|
64216
64252
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta zg-shimmer self-start", role: "status", children: count2 > 1 ? labels.generatingImages(count2, model) : labels.generatingImage(model) })
|
|
64217
64253
|
] });
|
|
64218
64254
|
}
|
|
@@ -64230,7 +64266,7 @@ function ImageGenerationBlock({
|
|
|
64230
64266
|
ImageFrame,
|
|
64231
64267
|
{
|
|
64232
64268
|
src: media.url(m2.index),
|
|
64233
|
-
ratio,
|
|
64269
|
+
ratio: ratios[i2] ?? ratios[0] ?? "1 / 1",
|
|
64234
64270
|
pending: false,
|
|
64235
64271
|
label: labels.viewAttachment(paths[i2] ?? labels.generatedImage),
|
|
64236
64272
|
onOpen: (el) => lightbox.open(gallery, i2, el),
|
|
@@ -64433,7 +64469,7 @@ const ToolRow = reactExports.memo(({ tool, mode, showResult, showDiff, lineState
|
|
|
64433
64469
|
!bodyMounted ? null : media ? (
|
|
64434
64470
|
// An image the call read, or a screenshot it took: the media itself, then any text around it.
|
|
64435
64471
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-1.5 flex flex-col gap-1.5", children: [
|
|
64436
|
-
!drawsImageGeneration(tool) && /* @__PURE__ */ jsxRuntimeExports.jsx(ToolMedia, { media: media.media, url: media.url }),
|
|
64472
|
+
(!drawsImageGeneration(tool) || tool.ok === false) && /* @__PURE__ */ jsxRuntimeExports.jsx(ToolMedia, { media: media.media, url: media.url }),
|
|
64437
64473
|
tool.name !== "read_file" && media.rest !== "" && /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: CODE_PANEL, children: media.rest })
|
|
64438
64474
|
] })
|
|
64439
64475
|
) : tool.name === "read_file" ? (
|
|
@@ -65496,6 +65532,7 @@ const TextRow$1 = reactExports.memo(({ text: text2, streaming }) => {
|
|
|
65496
65532
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-sm leading-relaxed text-[var(--zg-text)]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Markdown2, { className: streaming ? "zg-streaming" : void 0, streaming, children: text2 }) });
|
|
65497
65533
|
});
|
|
65498
65534
|
const RUN_RECEIPT_TINT = {
|
|
65535
|
+
agent: "text-zg-text/80",
|
|
65499
65536
|
model: "zg-soft-tint zg-tint-model",
|
|
65500
65537
|
turns: "zg-soft-tint zg-tint-accent",
|
|
65501
65538
|
cost: "zg-soft-tint zg-tint-money",
|
|
@@ -65509,6 +65546,7 @@ const RUN_RECEIPT_SEGMENT_TINT = {
|
|
|
65509
65546
|
};
|
|
65510
65547
|
const RECEIPT_GLYPH_ICON = {
|
|
65511
65548
|
[RUN_RECEIPT_TURN_GLYPH]: "i-ph-arrow-clockwise-bold",
|
|
65549
|
+
[RUN_RECEIPT_SWITCH_GLYPH]: "i-ph-arrows-left-right-bold",
|
|
65512
65550
|
"↑": "i-ph-arrow-up-bold",
|
|
65513
65551
|
"↓": "i-ph-arrow-down-bold"
|
|
65514
65552
|
};
|
|
@@ -65531,6 +65569,8 @@ function ReceiptValue({ text: text2, className }) {
|
|
|
65531
65569
|
}
|
|
65532
65570
|
function receiptTooltip(cell2, receipt, labels) {
|
|
65533
65571
|
switch (cell2.kind) {
|
|
65572
|
+
case "agent":
|
|
65573
|
+
return receipt.agentSwitched ? labels.receiptAgentSwitched : labels.receiptAgent;
|
|
65534
65574
|
case "model":
|
|
65535
65575
|
return receipt.otherModels ? labels.receiptModelOthers(receipt.otherModels) : labels.receiptModel;
|
|
65536
65576
|
case "duration":
|
|
@@ -79098,6 +79138,11 @@ function splitText(text2, providers2) {
|
|
|
79098
79138
|
if (cursor < text2.length) nodes.push({ type: "text", value: text2.slice(cursor) });
|
|
79099
79139
|
return nodes;
|
|
79100
79140
|
}
|
|
79141
|
+
function wholeReference(text2, providers2) {
|
|
79142
|
+
const matches2 = findReferences(text2, providers2, "assistant");
|
|
79143
|
+
const [only] = matches2;
|
|
79144
|
+
return matches2.length === 1 && only && only.start === 0 && only.end === text2.length ? only : null;
|
|
79145
|
+
}
|
|
79101
79146
|
function visit(node2, providers2) {
|
|
79102
79147
|
if (!node2.children) return;
|
|
79103
79148
|
const next = [];
|
|
@@ -79106,9 +79151,20 @@ function visit(node2, providers2) {
|
|
|
79106
79151
|
next.push(...splitText(child.value, providers2));
|
|
79107
79152
|
continue;
|
|
79108
79153
|
}
|
|
79154
|
+
if (child.type === "inlineCode" && typeof child.value === "string") {
|
|
79155
|
+
const whole = wholeReference(child.value, providers2);
|
|
79156
|
+
if (whole) {
|
|
79157
|
+
next.push({
|
|
79158
|
+
type: "link",
|
|
79159
|
+
url: referenceUrl(whole.providerId, whole.key, void 0, whole.placeholder, whole.placeholderIcon?.gui),
|
|
79160
|
+
children: [child]
|
|
79161
|
+
});
|
|
79162
|
+
continue;
|
|
79163
|
+
}
|
|
79164
|
+
}
|
|
79109
79165
|
if (child.type === "link" && typeof child.url === "string" && !child.url.startsWith("zg-ref:")) {
|
|
79110
|
-
const
|
|
79111
|
-
if (whole
|
|
79166
|
+
const whole = wholeReference(child.url, providers2);
|
|
79167
|
+
if (whole) {
|
|
79112
79168
|
next.push({
|
|
79113
79169
|
...child,
|
|
79114
79170
|
url: referenceUrl(whole.providerId, whole.key, child.url, whole.placeholder, whole.placeholderIcon?.gui)
|
|
@@ -79165,7 +79221,7 @@ function ProseReference({ parsed, children }) {
|
|
|
79165
79221
|
...parsed.placeholder ? { placeholder: parsed.placeholder } : {},
|
|
79166
79222
|
...parsed.placeholderIcon ? { placeholderIcon: { gui: parsed.placeholderIcon } } : {},
|
|
79167
79223
|
className: "zg-file-chip zg-badge",
|
|
79168
|
-
fallback: parsed.href ? /* @__PURE__ */ jsxRuntimeExports.jsx(PlainLink, { href: parsed.href, children }) : text2
|
|
79224
|
+
fallback: parsed.href ? /* @__PURE__ */ jsxRuntimeExports.jsx(PlainLink, { href: parsed.href, children }) : children ?? text2
|
|
79169
79225
|
}
|
|
79170
79226
|
);
|
|
79171
79227
|
}
|
|
@@ -80404,34 +80460,106 @@ const Timeline = reactExports.memo(({ events, isStreaming, sessionId }) => {
|
|
|
80404
80460
|
}
|
|
80405
80461
|
) }) }) }) });
|
|
80406
80462
|
});
|
|
80463
|
+
function tokenizeQuery(query) {
|
|
80464
|
+
const tokens = [];
|
|
80465
|
+
let i2 = 0;
|
|
80466
|
+
while (i2 < query.length) {
|
|
80467
|
+
while (i2 < query.length && /\s/u.test(query[i2])) i2 += 1;
|
|
80468
|
+
if (i2 >= query.length) break;
|
|
80469
|
+
if (query[i2] === '"') {
|
|
80470
|
+
i2 += 1;
|
|
80471
|
+
let value = "";
|
|
80472
|
+
while (i2 < query.length && query[i2] !== '"') {
|
|
80473
|
+
value += query[i2];
|
|
80474
|
+
i2 += 1;
|
|
80475
|
+
}
|
|
80476
|
+
if (query[i2] === '"') i2 += 1;
|
|
80477
|
+
if (value.length > 0) tokens.push(value);
|
|
80478
|
+
continue;
|
|
80479
|
+
}
|
|
80480
|
+
const start2 = i2;
|
|
80481
|
+
while (i2 < query.length && !/\s/u.test(query[i2])) i2 += 1;
|
|
80482
|
+
tokens.push(query.slice(start2, i2));
|
|
80483
|
+
}
|
|
80484
|
+
return tokens;
|
|
80485
|
+
}
|
|
80486
|
+
function findTermRanges(text2, terms) {
|
|
80487
|
+
const haystack = text2.toLowerCase();
|
|
80488
|
+
const found2 = [];
|
|
80489
|
+
for (const term of terms) {
|
|
80490
|
+
const needle = term.toLowerCase();
|
|
80491
|
+
if (needle.trim().length === 0) continue;
|
|
80492
|
+
for (let at2 = haystack.indexOf(needle); at2 !== -1; at2 = haystack.indexOf(needle, at2 + needle.length)) {
|
|
80493
|
+
found2.push([at2, at2 + needle.length]);
|
|
80494
|
+
}
|
|
80495
|
+
}
|
|
80496
|
+
found2.sort((a2, b2) => a2[0] - b2[0] || a2[1] - b2[1]);
|
|
80497
|
+
const merged2 = [];
|
|
80498
|
+
for (const range2 of found2) {
|
|
80499
|
+
const last = merged2.at(-1);
|
|
80500
|
+
if (last && range2[0] <= last[1]) last[1] = Math.max(last[1], range2[1]);
|
|
80501
|
+
else merged2.push([range2[0], range2[1]]);
|
|
80502
|
+
}
|
|
80503
|
+
return merged2;
|
|
80504
|
+
}
|
|
80505
|
+
function focusExcerpt(text2, ranges2, lead = 24) {
|
|
80506
|
+
const first2 = ranges2[0];
|
|
80507
|
+
if (!first2 || first2[0] <= lead) return { text: text2, ranges: [...ranges2] };
|
|
80508
|
+
let cut2 = first2[0] - lead;
|
|
80509
|
+
const space2 = text2.indexOf(" ", cut2);
|
|
80510
|
+
if (space2 !== -1 && space2 < first2[0]) cut2 = space2 + 1;
|
|
80511
|
+
const prefix = "… ";
|
|
80512
|
+
const shift2 = prefix.length - cut2;
|
|
80513
|
+
return {
|
|
80514
|
+
text: prefix + text2.slice(cut2),
|
|
80515
|
+
ranges: ranges2.map(([start2, end2]) => [start2 + shift2, end2 + shift2])
|
|
80516
|
+
};
|
|
80517
|
+
}
|
|
80407
80518
|
const MAX_MATCHES = 500;
|
|
80408
80519
|
const RESCAN_MS = 150;
|
|
80409
80520
|
const HIGHLIGHT_ALL = "zg-search";
|
|
80410
80521
|
const HIGHLIGHT_ACTIVE = "zg-search-active";
|
|
80411
80522
|
const highlightsSupported = typeof CSS !== "undefined" && "highlights" in CSS;
|
|
80412
80523
|
let highlightOwner = null;
|
|
80413
|
-
|
|
80524
|
+
const NO_NEEDLE = { key: "", needles: [] };
|
|
80525
|
+
function needleOf(query, terms) {
|
|
80526
|
+
const text2 = query.trim().toLowerCase();
|
|
80527
|
+
if (!text2) return NO_NEEDLE;
|
|
80528
|
+
return terms ? { key: `terms:${text2}`, needles: [...new Set(tokenizeQuery(text2))] } : { key: `phrase:${text2}`, needles: [text2] };
|
|
80529
|
+
}
|
|
80530
|
+
function occurrences(haystack, needles) {
|
|
80531
|
+
const found2 = [];
|
|
80532
|
+
for (const needle of needles) {
|
|
80533
|
+
for (let at2 = haystack.indexOf(needle); at2 !== -1; at2 = haystack.indexOf(needle, at2 + needle.length)) {
|
|
80534
|
+
found2.push([at2, at2 + needle.length]);
|
|
80535
|
+
}
|
|
80536
|
+
}
|
|
80537
|
+
if (needles.length === 1) return found2;
|
|
80538
|
+
found2.sort((a2, b2) => a2[0] - b2[0] || b2[1] - a2[1]);
|
|
80539
|
+
const kept = [];
|
|
80540
|
+
for (const span of found2) if (kept.length === 0 || span[0] >= kept.at(-1)[1]) kept.push(span);
|
|
80541
|
+
return kept;
|
|
80542
|
+
}
|
|
80543
|
+
function collectMatches(root2, needles) {
|
|
80414
80544
|
const ranges2 = [];
|
|
80415
80545
|
const walker = document.createTreeWalker(root2, NodeFilter.SHOW_TEXT);
|
|
80416
80546
|
let node2;
|
|
80417
80547
|
while (node2 = walker.nextNode()) {
|
|
80418
|
-
const
|
|
80419
|
-
|
|
80420
|
-
if (idx === -1) {
|
|
80548
|
+
const spans = occurrences(node2.data.toLowerCase(), needles);
|
|
80549
|
+
if (spans.length === 0) {
|
|
80421
80550
|
continue;
|
|
80422
80551
|
}
|
|
80423
80552
|
if (node2.parentElement?.closest('.zg-collapsible[data-open="false"]')) {
|
|
80424
80553
|
continue;
|
|
80425
80554
|
}
|
|
80426
|
-
|
|
80555
|
+
for (const [start2, end2] of spans) {
|
|
80427
80556
|
const range2 = document.createRange();
|
|
80428
|
-
range2.setStart(node2,
|
|
80429
|
-
range2.setEnd(node2,
|
|
80557
|
+
range2.setStart(node2, start2);
|
|
80558
|
+
range2.setEnd(node2, end2);
|
|
80430
80559
|
ranges2.push(range2);
|
|
80431
80560
|
if (ranges2.length >= MAX_MATCHES) {
|
|
80432
80561
|
return ranges2;
|
|
80433
80562
|
}
|
|
80434
|
-
idx = haystack.indexOf(needle, idx + needle.length);
|
|
80435
80563
|
}
|
|
80436
80564
|
}
|
|
80437
80565
|
return ranges2;
|
|
@@ -80460,8 +80588,8 @@ function releaseHighlights(owner2) {
|
|
|
80460
80588
|
function scrollToRange(range2) {
|
|
80461
80589
|
range2.startContainer.parentElement?.scrollIntoView({ block: "center" });
|
|
80462
80590
|
}
|
|
80463
|
-
function useTranscriptSearch(container, query, revision) {
|
|
80464
|
-
const [needle, setNeedle] = reactExports.useState(
|
|
80591
|
+
function useTranscriptSearch(container, query, revision, { terms = false, revealFirstMatch = false } = {}) {
|
|
80592
|
+
const [needle, setNeedle] = reactExports.useState(NO_NEEDLE);
|
|
80465
80593
|
const [matches2, setMatches] = reactExports.useState({ count: 0, capped: false });
|
|
80466
80594
|
const [activeIndex, setActiveIndex] = reactExports.useState(0);
|
|
80467
80595
|
const rangesRef = reactExports.useRef([]);
|
|
@@ -80470,12 +80598,14 @@ function useTranscriptSearch(container, query, revision) {
|
|
|
80470
80598
|
const ownerRef = reactExports.useRef(null);
|
|
80471
80599
|
ownerRef.current ??= {};
|
|
80472
80600
|
reactExports.useEffect(() => {
|
|
80473
|
-
const
|
|
80601
|
+
const next = needleOf(query, terms);
|
|
80602
|
+
const timer2 = setTimeout(() => setNeedle((current2) => current2.key === next.key ? current2 : next), 150);
|
|
80474
80603
|
return () => clearTimeout(timer2);
|
|
80475
|
-
}, [query]);
|
|
80604
|
+
}, [query, terms]);
|
|
80605
|
+
const revealArmed = reactExports.useRef(revealFirstMatch);
|
|
80476
80606
|
const prevNeedleRef = reactExports.useRef("");
|
|
80477
80607
|
const rowsMounted = useForceMountRows();
|
|
80478
|
-
const searching = needle.
|
|
80608
|
+
const searching = needle.key !== "";
|
|
80479
80609
|
reactExports.useEffect(() => searching ? holdForceMountRows() : void 0, [searching]);
|
|
80480
80610
|
const rescanTimer = reactExports.useRef(null);
|
|
80481
80611
|
reactExports.useEffect(
|
|
@@ -80487,14 +80617,15 @@ function useTranscriptSearch(container, query, revision) {
|
|
|
80487
80617
|
reactExports.useEffect(() => {
|
|
80488
80618
|
const owner2 = ownerRef.current;
|
|
80489
80619
|
const root2 = container.current;
|
|
80490
|
-
if (
|
|
80491
|
-
const needleChanged = prevNeedleRef.current !== needle;
|
|
80492
|
-
prevNeedleRef.current =
|
|
80620
|
+
if (searching && !rowsMounted) return;
|
|
80621
|
+
const needleChanged = prevNeedleRef.current !== needle.key;
|
|
80622
|
+
if (needleChanged && prevNeedleRef.current !== "") revealArmed.current = false;
|
|
80623
|
+
prevNeedleRef.current = needle.key;
|
|
80493
80624
|
if (rescanTimer.current) {
|
|
80494
80625
|
clearTimeout(rescanTimer.current);
|
|
80495
80626
|
rescanTimer.current = null;
|
|
80496
80627
|
}
|
|
80497
|
-
if (!root2 ||
|
|
80628
|
+
if (!root2 || !searching) {
|
|
80498
80629
|
if (rangesRef.current.length === 0 && !needleChanged) return;
|
|
80499
80630
|
rangesRef.current = [];
|
|
80500
80631
|
setMatches((prev) => prev.count === 0 && !prev.capped ? prev : { count: 0, capped: false });
|
|
@@ -80504,7 +80635,8 @@ function useTranscriptSearch(container, query, revision) {
|
|
|
80504
80635
|
}
|
|
80505
80636
|
const scan = () => {
|
|
80506
80637
|
rescanTimer.current = null;
|
|
80507
|
-
const ranges2 = collectMatches(root2, needle);
|
|
80638
|
+
const ranges2 = collectMatches(root2, needle.needles);
|
|
80639
|
+
const jump = needleChanged || revealArmed.current;
|
|
80508
80640
|
const nextIndex = needleChanged ? 0 : Math.min(activeIndexRef.current, Math.max(0, ranges2.length - 1));
|
|
80509
80641
|
rangesRef.current = ranges2;
|
|
80510
80642
|
setMatches(
|
|
@@ -80512,13 +80644,14 @@ function useTranscriptSearch(container, query, revision) {
|
|
|
80512
80644
|
);
|
|
80513
80645
|
setActiveIndex(nextIndex);
|
|
80514
80646
|
setHighlights(owner2, ranges2, nextIndex);
|
|
80515
|
-
if (
|
|
80647
|
+
if (jump && ranges2.length > 0) {
|
|
80648
|
+
revealArmed.current = false;
|
|
80516
80649
|
scrollToRange(ranges2[nextIndex]);
|
|
80517
80650
|
}
|
|
80518
80651
|
};
|
|
80519
80652
|
if (needleChanged) scan();
|
|
80520
80653
|
else rescanTimer.current = setTimeout(scan, RESCAN_MS);
|
|
80521
|
-
}, [needle, revision, container, rowsMounted]);
|
|
80654
|
+
}, [needle, searching, revision, container, rowsMounted]);
|
|
80522
80655
|
reactExports.useEffect(() => {
|
|
80523
80656
|
const owner2 = ownerRef.current;
|
|
80524
80657
|
return () => releaseHighlights(owner2);
|
|
@@ -80533,7 +80666,7 @@ function useTranscriptSearch(container, query, revision) {
|
|
|
80533
80666
|
setHighlights(ownerRef.current, ranges2, next);
|
|
80534
80667
|
scrollToRange(ranges2[next]);
|
|
80535
80668
|
}, []);
|
|
80536
|
-
return { count: matches2.count, capped: matches2.capped, activeIndex, hasNeedle:
|
|
80669
|
+
return { count: matches2.count, capped: matches2.capped, activeIndex, hasNeedle: searching, goTo };
|
|
80537
80670
|
}
|
|
80538
80671
|
function SearchHighlightStyle() {
|
|
80539
80672
|
const accent = reactExports.useMemo(
|
|
@@ -80548,12 +80681,16 @@ function SearchHighlightStyle() {
|
|
|
80548
80681
|
::highlight(${HIGHLIGHT_ACTIVE}) { background-color: color-mix(in srgb, ${accent} 65%, transparent); }
|
|
80549
80682
|
` });
|
|
80550
80683
|
}
|
|
80551
|
-
function TranscriptSearch({ container, sessionId, onClose }) {
|
|
80684
|
+
function TranscriptSearch({ container, sessionId, initialQuery, onClose }) {
|
|
80552
80685
|
const modal = useModal();
|
|
80553
80686
|
const events = useSessionEvents(sessionId);
|
|
80554
80687
|
const inputRef = reactExports.useRef(null);
|
|
80555
|
-
const [query, setQuery] = reactExports.useState("");
|
|
80556
|
-
const
|
|
80688
|
+
const [query, setQuery] = reactExports.useState(initialQuery ?? "");
|
|
80689
|
+
const seeded2 = Boolean(initialQuery) && query === initialQuery;
|
|
80690
|
+
const { count: count2, capped, activeIndex, hasNeedle, goTo } = useTranscriptSearch(container, query, events, {
|
|
80691
|
+
terms: seeded2,
|
|
80692
|
+
revealFirstMatch: seeded2
|
|
80693
|
+
});
|
|
80557
80694
|
reactExports.useEffect(() => {
|
|
80558
80695
|
inputRef.current?.select();
|
|
80559
80696
|
}, []);
|
|
@@ -81803,6 +81940,12 @@ const DEFAULT_ONBOARDING_LABELS = {
|
|
|
81803
81940
|
demoScript: ["const files = await glob('src/**/*.ts')", "for (const file of files) await read(file)"],
|
|
81804
81941
|
demoCalls: "12 calls",
|
|
81805
81942
|
demoStep: "1 step",
|
|
81943
|
+
demoSearchQuery: "vite 6 breaking changes",
|
|
81944
|
+
demoSearchResults: [
|
|
81945
|
+
"vite.dev/guide/migration",
|
|
81946
|
+
"github.com/vitejs/vite/releases",
|
|
81947
|
+
"vite.dev/blog/announcing-vite6"
|
|
81948
|
+
],
|
|
81806
81949
|
demoTyped: "Open src/comp",
|
|
81807
81950
|
demoGhost: "onents/Button.tsx",
|
|
81808
81951
|
demoTab: "Tab",
|
|
@@ -83710,11 +83853,11 @@ function AnswerField({ placeholder, onSubmit }) {
|
|
|
83710
83853
|
/* @__PURE__ */ jsxRuntimeExports.jsx("button", { type: "submit", disabled: !text2.trim(), className: buttonClass({ variant: "secondary", size: "sm" }), children: labels.signInSubmit })
|
|
83711
83854
|
] });
|
|
83712
83855
|
}
|
|
83713
|
-
const IDLE = constant(null);
|
|
83856
|
+
const IDLE$1 = constant(null);
|
|
83714
83857
|
const ended = (state2) => state2?.kind === "done" || state2?.kind === "error";
|
|
83715
83858
|
function useSignIn(onDone) {
|
|
83716
83859
|
const [flow2, setFlow] = reactExports.useState(null);
|
|
83717
|
-
const state2 = useReadable(flow2 ? flow2.state : IDLE);
|
|
83860
|
+
const state2 = useReadable(flow2 ? flow2.state : IDLE$1);
|
|
83718
83861
|
const done = reactExports.useRef(onDone);
|
|
83719
83862
|
reactExports.useEffect(() => {
|
|
83720
83863
|
done.current = onDone;
|
|
@@ -84570,6 +84713,24 @@ function CodemodeDemo({ on }) {
|
|
|
84570
84713
|
] })
|
|
84571
84714
|
] });
|
|
84572
84715
|
}
|
|
84716
|
+
function WebSearchDemo({ on }) {
|
|
84717
|
+
const labels = useOnboardingLabels();
|
|
84718
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(DemoStage, { on, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
84719
|
+
MiniWindow,
|
|
84720
|
+
{
|
|
84721
|
+
className: "w-full max-w-[300px]",
|
|
84722
|
+
bar: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "zg-tray flex items-center gap-1 h-3.5 px-2 rounded-full max-w-[180px] w-full min-w-0", children: [
|
|
84723
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-ph-magnifying-glass text-zg-badge text-[var(--zg-text-muted)] shrink-0" }),
|
|
84724
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-zg-badge", children: labels.demoSearchQuery })
|
|
84725
|
+
] }),
|
|
84726
|
+
bodyClassName: "px-3 pt-1 pb-2.5 gap-1.5",
|
|
84727
|
+
children: labels.demoSearchResults.map((url, i2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "zg-loop zg-demo-arrive flex flex-col gap-1 min-w-0", style: delay(i2 * 300), children: [
|
|
84728
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "truncate text-zg-badge text-[var(--zg-accent)]", children: url }),
|
|
84729
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Line, { width: `${72 - i2 * 12}%` })
|
|
84730
|
+
] }, url))
|
|
84731
|
+
}
|
|
84732
|
+
) });
|
|
84733
|
+
}
|
|
84573
84734
|
function Composer$1({ children }) {
|
|
84574
84735
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-raised border rounded-full flex items-center gap-1.5 h-8 pl-3 pr-1.5 w-full max-w-[320px] min-w-0", children });
|
|
84575
84736
|
}
|
|
@@ -84774,6 +84935,7 @@ function ProjectExtensionsDemo({ on }) {
|
|
|
84774
84935
|
}
|
|
84775
84936
|
const DEMOS = {
|
|
84776
84937
|
codemode: CodemodeDemo,
|
|
84938
|
+
webSearch: WebSearchDemo,
|
|
84777
84939
|
inlineAutocomplete: AutocompleteDemo,
|
|
84778
84940
|
autoTitle: AutoTitleDemo,
|
|
84779
84941
|
spaces: SpacesDemo,
|
|
@@ -106549,6 +106711,214 @@ function prMatches(pr, query) {
|
|
|
106549
106711
|
const bare = q2.replace(/^#/, "");
|
|
106550
106712
|
return bare !== "" && String(pr.number).startsWith(bare) || pr.title.toLowerCase().includes(q2) || pr.branch.toLowerCase().includes(q2) || pr.author.toLowerCase().includes(q2);
|
|
106551
106713
|
}
|
|
106714
|
+
const KIND_LABELS = {
|
|
106715
|
+
local: "Local",
|
|
106716
|
+
worktree: "Worktree",
|
|
106717
|
+
docker: "Docker",
|
|
106718
|
+
e2b: "E2B",
|
|
106719
|
+
daytona: "Daytona"
|
|
106720
|
+
};
|
|
106721
|
+
const KIND_ICONS = {
|
|
106722
|
+
local: "i-ph-laptop",
|
|
106723
|
+
worktree: "i-ph-git-branch",
|
|
106724
|
+
docker: "i-ph-cube",
|
|
106725
|
+
e2b: "i-ph-cloud",
|
|
106726
|
+
daytona: "i-ph-cloud"
|
|
106727
|
+
};
|
|
106728
|
+
const REMOTE_KINDS = /* @__PURE__ */ new Set(["e2b", "daytona"]);
|
|
106729
|
+
function runsInRemoteSandbox(environment) {
|
|
106730
|
+
return environment !== void 0 && REMOTE_KINDS.has(environment.kind);
|
|
106731
|
+
}
|
|
106732
|
+
function deleteSessionPrompt(title, environment) {
|
|
106733
|
+
const base2 = `Delete "${title}"?`;
|
|
106734
|
+
if (environment && runsInRemoteSandbox(environment)) {
|
|
106735
|
+
return `${base2}
|
|
106736
|
+
|
|
106737
|
+
Its ${environmentKindLabel(environment.kind)} sandbox is deleted too. Push anything you want to keep first.`;
|
|
106738
|
+
}
|
|
106739
|
+
return base2;
|
|
106740
|
+
}
|
|
106741
|
+
function environmentKindLabel(kind) {
|
|
106742
|
+
const machine = parseMachineKind(kind);
|
|
106743
|
+
if (machine) return `${KIND_LABELS[machine.base]} @ ${machine.name}`;
|
|
106744
|
+
return KIND_LABELS[kind] ?? kind;
|
|
106745
|
+
}
|
|
106746
|
+
function environmentKindIcon(kind) {
|
|
106747
|
+
return KIND_ICONS[parseMachineKind(kind)?.base ?? kind] ?? "i-ph-cube";
|
|
106748
|
+
}
|
|
106749
|
+
function environmentSummaryText(environment) {
|
|
106750
|
+
const label = environmentKindLabel(environment.kind);
|
|
106751
|
+
const where = environment.branch ? `${label} (${environment.branch})` : label;
|
|
106752
|
+
if (environment.state === "provisioning") {
|
|
106753
|
+
return `${where}. Setting up…`;
|
|
106754
|
+
}
|
|
106755
|
+
if (environment.state === "failed") {
|
|
106756
|
+
return `${where}. Setup failed${environment.error ? `: ${environment.error}` : "."}`;
|
|
106757
|
+
}
|
|
106758
|
+
if (environment.suspended) {
|
|
106759
|
+
return `${where}. Paused while idle, resumes on your next prompt.`;
|
|
106760
|
+
}
|
|
106761
|
+
return where;
|
|
106762
|
+
}
|
|
106763
|
+
function EnvironmentChip({ environment }) {
|
|
106764
|
+
if (!environment) {
|
|
106765
|
+
return null;
|
|
106766
|
+
}
|
|
106767
|
+
const icon = environment.state === "provisioning" ? "i-ph-circle-notch animate-spin text-[var(--zg-text-muted)]" : environment.state === "failed" ? "i-ph-warning-circle text-[var(--zg-danger)]" : `${environmentKindIcon(environment.kind)} ${environment.suspended ? "opacity-45" : ""}`;
|
|
106768
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
106769
|
+
"span",
|
|
106770
|
+
{
|
|
106771
|
+
"data-testid": "row-badge-environment",
|
|
106772
|
+
title: environmentSummaryText(environment),
|
|
106773
|
+
className: "zg-row-badge zg-meta inline-flex items-center gap-1 h-[18px] px-1.5 rounded-[var(--zg-radius-sm)] whitespace-nowrap",
|
|
106774
|
+
children: [
|
|
106775
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${icon} text-[11px]` }),
|
|
106776
|
+
environment.branch || environmentKindLabel(environment.kind)
|
|
106777
|
+
]
|
|
106778
|
+
}
|
|
106779
|
+
);
|
|
106780
|
+
}
|
|
106781
|
+
function useEnvironmentChoices(cwd2, hostId) {
|
|
106782
|
+
const listed = useIpcResource(cwd2 === null ? null : environmentsResource(cwd2, hostId)).data;
|
|
106783
|
+
return reactExports.useMemo(() => listed ? withMachines(listed) : NO_DESCRIPTORS, [listed]);
|
|
106784
|
+
}
|
|
106785
|
+
const NO_DESCRIPTORS = [];
|
|
106786
|
+
function withMachines(descriptors) {
|
|
106787
|
+
return orderByMachine(descriptors).map((descriptor) => {
|
|
106788
|
+
const blocked = machineBlockedReason(descriptor);
|
|
106789
|
+
return blocked && descriptor.available ? { ...descriptor, available: false, reason: blocked } : descriptor;
|
|
106790
|
+
});
|
|
106791
|
+
}
|
|
106792
|
+
const usable = (descriptor) => descriptor.enabled && descriptor.available;
|
|
106793
|
+
function resolveDraftDescriptor(descriptors, draft2) {
|
|
106794
|
+
const picked = draft2 ? descriptors.find((d2) => d2.kind === draft2.kind && usable(d2)) : void 0;
|
|
106795
|
+
return picked ?? descriptors.find((d2) => d2.isDefault && usable(d2)) ?? descriptors.find((d2) => d2.kind === "local");
|
|
106796
|
+
}
|
|
106797
|
+
function resolveDraftEnvironment(descriptors, draft2) {
|
|
106798
|
+
const descriptor = resolveDraftDescriptor(descriptors, draft2);
|
|
106799
|
+
if (!descriptor || descriptor.kind === "local") {
|
|
106800
|
+
return void 0;
|
|
106801
|
+
}
|
|
106802
|
+
const typed = draft2?.kind === descriptor.kind ? draft2.branch.trim() : "";
|
|
106803
|
+
const branch = descriptor.takesBranch ? typed || descriptor.suggestedBranch : void 0;
|
|
106804
|
+
return { kind: descriptor.kind, ...branch ? { branch } : {} };
|
|
106805
|
+
}
|
|
106806
|
+
function EnvironmentPicker({
|
|
106807
|
+
descriptors,
|
|
106808
|
+
draft: draft2,
|
|
106809
|
+
onChange,
|
|
106810
|
+
onOpenSettings
|
|
106811
|
+
}) {
|
|
106812
|
+
const branchRef = reactExports.useRef(null);
|
|
106813
|
+
const offered = descriptors.filter((d2) => d2.enabled);
|
|
106814
|
+
const selected = resolveDraftDescriptor(descriptors, draft2);
|
|
106815
|
+
if (offered.length <= 1 || !selected) {
|
|
106816
|
+
return null;
|
|
106817
|
+
}
|
|
106818
|
+
const typedBranch = draft2?.kind === selected.kind ? draft2.branch : "";
|
|
106819
|
+
const branchLabel = selected.takesBranch ? typedBranch.trim() || selected.suggestedBranch : void 0;
|
|
106820
|
+
const icon = environmentKindIcon(selected.kind);
|
|
106821
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
106822
|
+
Popover,
|
|
106823
|
+
{
|
|
106824
|
+
role: "menu",
|
|
106825
|
+
ariaLabel: "Choose where the session runs",
|
|
106826
|
+
align: "end",
|
|
106827
|
+
width: 300,
|
|
106828
|
+
trigger: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-segment shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
106829
|
+
"button",
|
|
106830
|
+
{
|
|
106831
|
+
...props,
|
|
106832
|
+
type: "button",
|
|
106833
|
+
title: `Runs in: ${selected.label}${branchLabel ? ` (${branchLabel})` : ""}`,
|
|
106834
|
+
className: "zg-segment-item zg-press-subtle inline-flex items-center gap-1.5 h-6 pl-2.5 pr-2 rounded-full text-xs border-0 bg-transparent text-[var(--zg-text-muted)] cursor-pointer whitespace-nowrap",
|
|
106835
|
+
children: [
|
|
106836
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${icon} text-[11px] shrink-0` }),
|
|
106837
|
+
branchLabel ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-pill-label max-w-[min(130px,14cqi)] truncate font-mono", children: branchLabel }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-pill-label shrink-0", children: selected.label }),
|
|
106838
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "zg-pill-label i-ph-caret-up-down text-[10px] shrink-0 opacity-70" })
|
|
106839
|
+
]
|
|
106840
|
+
}
|
|
106841
|
+
) }),
|
|
106842
|
+
children: (close2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Menu$1, { role: "group", children: [
|
|
106843
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MenuSection, { label: "Runs in", children: offered.map((descriptor) => {
|
|
106844
|
+
const active2 = descriptor.kind === selected.kind;
|
|
106845
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
106846
|
+
MenuRow$1,
|
|
106847
|
+
{
|
|
106848
|
+
size: "lg",
|
|
106849
|
+
role: "menuitemradio",
|
|
106850
|
+
checked: active2,
|
|
106851
|
+
disabled: !descriptor.available,
|
|
106852
|
+
hint: descriptor.available ? void 0 : descriptor.reason,
|
|
106853
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: environmentKindIcon(descriptor.kind) }),
|
|
106854
|
+
title: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
106855
|
+
descriptor.label,
|
|
106856
|
+
descriptor.machine && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
106857
|
+
MetaChip,
|
|
106858
|
+
{
|
|
106859
|
+
tone: descriptor.machine.status === "online" ? "success" : "muted",
|
|
106860
|
+
className: "font-normal ml-1.5",
|
|
106861
|
+
children: descriptor.machine.status
|
|
106862
|
+
}
|
|
106863
|
+
),
|
|
106864
|
+
descriptor.isDefault && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta font-normal ml-1.5", children: "default" })
|
|
106865
|
+
] }),
|
|
106866
|
+
description: descriptor.available ? descriptor.description : descriptor.reason,
|
|
106867
|
+
onClick: () => {
|
|
106868
|
+
onChange({ kind: descriptor.kind, branch: active2 ? typedBranch : "" });
|
|
106869
|
+
if (descriptor.takesBranch) {
|
|
106870
|
+
requestAnimationFrame(() => branchRef.current?.focus());
|
|
106871
|
+
} else {
|
|
106872
|
+
close2();
|
|
106873
|
+
}
|
|
106874
|
+
}
|
|
106875
|
+
},
|
|
106876
|
+
descriptor.kind
|
|
106877
|
+
);
|
|
106878
|
+
}) }),
|
|
106879
|
+
selected.takesBranch && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
106880
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MenuSeparator$1, {}),
|
|
106881
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(MenuSection, { label: "Branch", children: [
|
|
106882
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-2 pb-1.5", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
106883
|
+
"input",
|
|
106884
|
+
{
|
|
106885
|
+
ref: branchRef,
|
|
106886
|
+
type: "text",
|
|
106887
|
+
value: typedBranch,
|
|
106888
|
+
onChange: (event) => onChange({ kind: selected.kind, branch: event.target.value }),
|
|
106889
|
+
onKeyDown: (event) => {
|
|
106890
|
+
if (event.key === "Enter") {
|
|
106891
|
+
event.preventDefault();
|
|
106892
|
+
close2();
|
|
106893
|
+
}
|
|
106894
|
+
},
|
|
106895
|
+
placeholder: selected.suggestedBranch ?? "Branch name",
|
|
106896
|
+
"aria-label": "Branch",
|
|
106897
|
+
spellCheck: false,
|
|
106898
|
+
className: "zg-well w-full h-7 px-2 text-xs font-mono placeholder:text-[var(--zg-text-subtle)]"
|
|
106899
|
+
}
|
|
106900
|
+
) }),
|
|
106901
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { className: "!pt-0", children: "Empty uses the suggested name." })
|
|
106902
|
+
] })
|
|
106903
|
+
] }),
|
|
106904
|
+
selected.note && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { icon: "i-ph-info", children: selected.note }),
|
|
106905
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MenuSeparator$1, {}),
|
|
106906
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
106907
|
+
MenuRow$1,
|
|
106908
|
+
{
|
|
106909
|
+
role: "menuitem",
|
|
106910
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-ph-gear-six" }),
|
|
106911
|
+
title: "Environment settings…",
|
|
106912
|
+
onClick: () => {
|
|
106913
|
+
close2();
|
|
106914
|
+
onOpenSettings();
|
|
106915
|
+
}
|
|
106916
|
+
}
|
|
106917
|
+
)
|
|
106918
|
+
] })
|
|
106919
|
+
}
|
|
106920
|
+
);
|
|
106921
|
+
}
|
|
106552
106922
|
const SECTIONS = [
|
|
106553
106923
|
{ id: "review", label: "Waiting on you", cap: 5 },
|
|
106554
106924
|
{ id: "mine", label: "Yours", cap: 5 },
|
|
@@ -106562,6 +106932,10 @@ function readPrList(result) {
|
|
|
106562
106932
|
if (result && !Array.isArray(result)) return { list: [], retryAt: result.rateLimited.retryAt };
|
|
106563
106933
|
return { list: result, retryAt: null };
|
|
106564
106934
|
}
|
|
106935
|
+
function worktreeChat(sessions2, ids, current2) {
|
|
106936
|
+
const wanted = new Set(ids);
|
|
106937
|
+
return sessions2.filter((s2) => wanted.has(s2.id) && s2.id !== current2 && !s2.archived).sort((a2, b2) => b2.updatedAt - a2.updatedAt)[0];
|
|
106938
|
+
}
|
|
106565
106939
|
function clock(ms2) {
|
|
106566
106940
|
const d2 = new Date(ms2);
|
|
106567
106941
|
return `${String(d2.getHours()).padStart(2, "0")}:${String(d2.getMinutes()).padStart(2, "0")}`;
|
|
@@ -106590,12 +106964,27 @@ function BranchMenu({
|
|
|
106590
106964
|
const [expanded, setExpanded] = reactExports.useState(/* @__PURE__ */ new Set());
|
|
106591
106965
|
const [active2, setActive2] = reactExports.useState(0);
|
|
106592
106966
|
const [error, setError] = reactExports.useState(null);
|
|
106967
|
+
const [elsewhere, setElsewhere] = reactExports.useState(null);
|
|
106593
106968
|
const [busy2, setBusy] = reactExports.useState(null);
|
|
106594
106969
|
const [pendingEnter, setPendingEnter] = reactExports.useState(false);
|
|
106595
106970
|
const surfaceRef = reactExports.useRef(null);
|
|
106596
106971
|
const inputRef = reactExports.useRef(null);
|
|
106597
106972
|
const listRef = reactExports.useRef(null);
|
|
106598
106973
|
const scrollToActive = reactExports.useRef(false);
|
|
106974
|
+
const [worktreeBranch, setWorktreeBranch] = reactExports.useState(null);
|
|
106975
|
+
const worktreeOpen = reactExports.useRef(false);
|
|
106976
|
+
worktreeOpen.current = worktreeBranch !== null;
|
|
106977
|
+
const worktreeInputRef = reactExports.useRef(null);
|
|
106978
|
+
const { allSessions } = useSessionsList();
|
|
106979
|
+
const { setActiveSessionId } = useSessionsActions();
|
|
106980
|
+
const session = sessionId ? allSessions.find((s2) => s2.id === sessionId) : void 0;
|
|
106981
|
+
const canMove = session !== void 0 && (session.environment?.kind ?? "local") === "local";
|
|
106982
|
+
const hostKey = sessionId ? parseSessionKey(sessionId).hostId : LOCAL_SESSION_HOST;
|
|
106983
|
+
const choices = useEnvironmentChoices(
|
|
106984
|
+
open && canMove ? cwd2 : null,
|
|
106985
|
+
hostKey === LOCAL_SESSION_HOST ? void 0 : hostKey
|
|
106986
|
+
);
|
|
106987
|
+
const worktree = canMove ? choices.find((d2) => d2.kind === "worktree" && d2.enabled) : void 0;
|
|
106599
106988
|
reactExports.useLayoutEffect(() => {
|
|
106600
106989
|
if (open && listRef.current) listRef.current.scrollTop = 0;
|
|
106601
106990
|
}, [open]);
|
|
@@ -106608,7 +106997,9 @@ function BranchMenu({
|
|
|
106608
106997
|
setExpanded(/* @__PURE__ */ new Set());
|
|
106609
106998
|
setActive2(0);
|
|
106610
106999
|
setError(null);
|
|
107000
|
+
setElsewhere(null);
|
|
106611
107001
|
setPendingEnter(false);
|
|
107002
|
+
setWorktreeBranch(null);
|
|
106612
107003
|
setBranches(branchCache.get(cwd2) ?? null);
|
|
106613
107004
|
setPrs(prCache$1.has(cwd2) ? prCache$1.get(cwd2) : void 0);
|
|
106614
107005
|
let live = true;
|
|
@@ -106639,6 +107030,11 @@ function BranchMenu({
|
|
|
106639
107030
|
if (e2.key !== "Escape") return;
|
|
106640
107031
|
e2.preventDefault();
|
|
106641
107032
|
e2.stopPropagation();
|
|
107033
|
+
if (worktreeOpen.current) {
|
|
107034
|
+
setWorktreeBranch(null);
|
|
107035
|
+
inputRef.current?.focus();
|
|
107036
|
+
return;
|
|
107037
|
+
}
|
|
106642
107038
|
onCloseRef.current();
|
|
106643
107039
|
};
|
|
106644
107040
|
document.addEventListener("pointerdown", onPointer, true);
|
|
@@ -106682,7 +107078,18 @@ function BranchMenu({
|
|
|
106682
107078
|
return { ...sec, all: all2, shown: shown2, hidden: all2.length - shown2.length };
|
|
106683
107079
|
}).filter((sec) => sec.all.length > 0);
|
|
106684
107080
|
}, [prs, branches, search2, searched, q2, expanded]);
|
|
106685
|
-
const
|
|
107081
|
+
const typed = query.trim();
|
|
107082
|
+
const canStartWorktree = worktree?.available === true;
|
|
107083
|
+
const creates = reactExports.useMemo(() => {
|
|
107084
|
+
if (!typed || branches === null || typed === current2) return [];
|
|
107085
|
+
const known = (p2) => !p2.fork && p2.branch === typed;
|
|
107086
|
+
if (branches.some((b2) => b2.name === typed) || (prs ?? []).some(known) || search2?.list?.some(known)) return [];
|
|
107087
|
+
return [
|
|
107088
|
+
{ kind: "create", name: typed, worktree: false },
|
|
107089
|
+
...canStartWorktree ? [{ kind: "create", name: typed, worktree: true }] : []
|
|
107090
|
+
];
|
|
107091
|
+
}, [typed, branches, prs, search2, current2, canStartWorktree]);
|
|
107092
|
+
const entries2 = reactExports.useMemo(() => [...sections.flatMap((sec) => sec.shown), ...creates], [sections, creates]);
|
|
106686
107093
|
const activeIndex = Math.min(active2, Math.max(0, entries2.length - 1));
|
|
106687
107094
|
reactExports.useEffect(() => {
|
|
106688
107095
|
if (!scrollToActive.current) return;
|
|
@@ -106694,18 +107101,52 @@ function BranchMenu({
|
|
|
106694
107101
|
setPendingEnter(false);
|
|
106695
107102
|
if (entries2[activeIndex]) void pick2(entries2[activeIndex]);
|
|
106696
107103
|
}, [pendingEnter, branches, entries2]);
|
|
106697
|
-
const keyOf2 = (e2) => e2.kind === "pr" ? `pr:${e2.pr.number}` : `branch:${e2.row.name}`;
|
|
106698
|
-
const isCurrent = (e2) => current2 !== null && (e2.kind === "branch" ? e2.row.name === current2 : !e2.pr.fork && e2.pr.branch === current2);
|
|
107104
|
+
const keyOf2 = (e2) => e2.kind === "pr" ? `pr:${e2.pr.number}` : e2.kind === "branch" ? `branch:${e2.row.name}` : `create:${e2.worktree}`;
|
|
107105
|
+
const isCurrent = (e2) => current2 !== null && e2.kind !== "create" && (e2.kind === "branch" ? e2.row.name === current2 : !e2.pr.fork && e2.pr.branch === current2);
|
|
106699
107106
|
const pick2 = async (entry) => {
|
|
106700
|
-
if (
|
|
107107
|
+
if (busy2) return onClose();
|
|
107108
|
+
if (entry.kind === "create")
|
|
107109
|
+
return entry.worktree ? startWorktree(entry.name, keyOf2(entry)) : createBranch(entry.name);
|
|
107110
|
+
if (isCurrent(entry)) return onClose();
|
|
106701
107111
|
const target = entry.kind === "branch" ? entry.row.name : entry.pr.local ? entry.pr.branch : { pr: entry.pr.number };
|
|
106702
107112
|
setBusy(keyOf2(entry));
|
|
106703
107113
|
setError(null);
|
|
107114
|
+
setElsewhere(null);
|
|
106704
107115
|
const result = await window.api.workspace.gitSwitch(cwd2, target, sessionId);
|
|
106705
107116
|
setBusy(null);
|
|
107117
|
+
if (result.ok) return onSwitched();
|
|
107118
|
+
const chat = result.worktree ? worktreeChat(allSessions, result.chats ?? [], sessionId) : void 0;
|
|
107119
|
+
if (!chat || !result.worktree) return setError(result.error);
|
|
107120
|
+
setElsewhere({
|
|
107121
|
+
branch: entry.kind === "branch" ? entry.row.name : entry.pr.branch,
|
|
107122
|
+
worktree: result.worktree,
|
|
107123
|
+
chat: chat.id
|
|
107124
|
+
});
|
|
107125
|
+
};
|
|
107126
|
+
const createBranch = async (name2) => {
|
|
107127
|
+
setBusy(keyOf2({ kind: "create", worktree: false }));
|
|
107128
|
+
setError(null);
|
|
107129
|
+
setElsewhere(null);
|
|
107130
|
+
const result = await window.api.workspace.gitCreateBranch(cwd2, name2, sessionId);
|
|
107131
|
+
setBusy(null);
|
|
106706
107132
|
if (result.ok) onSwitched();
|
|
106707
107133
|
else setError(result.error);
|
|
106708
107134
|
};
|
|
107135
|
+
const startWorktree = async (typedBranch, busyKey = "worktree") => {
|
|
107136
|
+
if (!sessionId || !worktree || busy2) return;
|
|
107137
|
+
const branch = typedBranch ?? (worktreeBranch?.trim() || worktree.suggestedBranch);
|
|
107138
|
+
setBusy(busyKey);
|
|
107139
|
+
setElsewhere(null);
|
|
107140
|
+
setError(null);
|
|
107141
|
+
try {
|
|
107142
|
+
await window.api.sessions.moveEnvironment(sessionId, { kind: "worktree", ...branch ? { branch } : {} });
|
|
107143
|
+
onSwitched();
|
|
107144
|
+
} catch (err) {
|
|
107145
|
+
setError(err?.message ?? String(err));
|
|
107146
|
+
} finally {
|
|
107147
|
+
setBusy(null);
|
|
107148
|
+
}
|
|
107149
|
+
};
|
|
106709
107150
|
const pickRef = reactExports.useRef(pick2);
|
|
106710
107151
|
pickRef.current = pick2;
|
|
106711
107152
|
const entriesRef = reactExports.useRef(entries2);
|
|
@@ -106773,6 +107214,26 @@ function BranchMenu({
|
|
|
106773
107214
|
}
|
|
106774
107215
|
) }),
|
|
106775
107216
|
error && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { icon: "i-ph-warning", className: "text-[var(--zg-danger)]", children: error }),
|
|
107217
|
+
elsewhere && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { icon: environmentKindIcon("worktree"), children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-2 min-w-0", children: [
|
|
107218
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "truncate", title: elsewhere.worktree, children: [
|
|
107219
|
+
elsewhere.branch,
|
|
107220
|
+
" is checked out in ",
|
|
107221
|
+
elsewhere.worktree
|
|
107222
|
+
] }),
|
|
107223
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107224
|
+
"button",
|
|
107225
|
+
{
|
|
107226
|
+
type: "button",
|
|
107227
|
+
"data-testid": "git-open-worktree-chat",
|
|
107228
|
+
className: "shrink-0 text-[var(--zg-accent)] hover:underline",
|
|
107229
|
+
onClick: () => {
|
|
107230
|
+
onClose();
|
|
107231
|
+
setActiveSessionId(elsewhere.chat);
|
|
107232
|
+
},
|
|
107233
|
+
children: "Open its chat"
|
|
107234
|
+
}
|
|
107235
|
+
)
|
|
107236
|
+
] }) }),
|
|
106776
107237
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
106777
107238
|
"div",
|
|
106778
107239
|
{
|
|
@@ -106805,7 +107266,7 @@ function BranchMenu({
|
|
|
106805
107266
|
onHover: rowHandlers.hover,
|
|
106806
107267
|
onPick: rowHandlers.pick
|
|
106807
107268
|
};
|
|
106808
|
-
return entry.kind === "pr" ? /* @__PURE__ */ jsxRuntimeExports.jsx(PrRow, { pr: entry.pr, now: now2, ...common }, keyOf2(entry)) : /* @__PURE__ */ jsxRuntimeExports.jsx(BranchRow, { row: entry.row, now: now2, ...common }, keyOf2(entry));
|
|
107269
|
+
return entry.kind === "pr" ? /* @__PURE__ */ jsxRuntimeExports.jsx(PrRow, { pr: entry.pr, now: now2, ...common }, keyOf2(entry)) : entry.kind === "branch" ? /* @__PURE__ */ jsxRuntimeExports.jsx(BranchRow, { row: entry.row, now: now2, ...common }, keyOf2(entry)) : null;
|
|
106809
107270
|
}),
|
|
106810
107271
|
sec.hidden > 0 && /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
106811
107272
|
"button",
|
|
@@ -106830,6 +107291,27 @@ function BranchMenu({
|
|
|
106830
107291
|
},
|
|
106831
107292
|
sec.id
|
|
106832
107293
|
)),
|
|
107294
|
+
creates.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: sections.length > 0 ? "mt-1 pt-1 border-t border-[var(--zg-hairline)]" : "", children: creates.map((entry) => {
|
|
107295
|
+
if (entry.kind !== "create") return null;
|
|
107296
|
+
const i2 = index2++;
|
|
107297
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107298
|
+
CreateRow,
|
|
107299
|
+
{
|
|
107300
|
+
id: `git-switch-${i2}`,
|
|
107301
|
+
index: i2,
|
|
107302
|
+
active: i2 === activeIndex,
|
|
107303
|
+
current: false,
|
|
107304
|
+
busy: busy2 === keyOf2(entry),
|
|
107305
|
+
disabled: busy2 !== null,
|
|
107306
|
+
now: now2,
|
|
107307
|
+
onHover: rowHandlers.hover,
|
|
107308
|
+
onPick: rowHandlers.pick,
|
|
107309
|
+
name: entry.name,
|
|
107310
|
+
worktree: entry.worktree
|
|
107311
|
+
},
|
|
107312
|
+
keyOf2(entry)
|
|
107313
|
+
);
|
|
107314
|
+
}) }),
|
|
106833
107315
|
searching && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { icon: "i-ph-magnifying-glass", children: "Searching open pull requests…" }),
|
|
106834
107316
|
prs === null && !q2 && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { icon: "i-ph-git-pull-request", children: "To see pull requests, install the GitHub CLI (gh) and sign in." }),
|
|
106835
107317
|
rateLimitedUntil !== null && rateLimitedUntil > Date.now() && /* @__PURE__ */ jsxRuntimeExports.jsxs(MenuNote, { icon: "i-ph-warning-circle", children: [
|
|
@@ -106840,7 +107322,59 @@ function BranchMenu({
|
|
|
106840
107322
|
branches === null ? /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { children: "Loading branches…" }) : entries2.length === 0 && !searching && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { children: "No matches" })
|
|
106841
107323
|
]
|
|
106842
107324
|
}
|
|
106843
|
-
)
|
|
107325
|
+
),
|
|
107326
|
+
worktree && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-1 pb-1 border-t border-[var(--zg-hairline)]", "data-testid": "git-worktree-footer", children: worktreeBranch === null ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
107327
|
+
"button",
|
|
107328
|
+
{
|
|
107329
|
+
type: "button",
|
|
107330
|
+
"data-testid": "git-start-worktree",
|
|
107331
|
+
className: "zg-menu-row zg-press-subtle w-full mt-1 text-[12px] disabled:opacity-50",
|
|
107332
|
+
"data-size": "sm",
|
|
107333
|
+
disabled: !worktree.available || busy2 !== null,
|
|
107334
|
+
title: worktree.available ? void 0 : worktree.reason,
|
|
107335
|
+
onClick: () => {
|
|
107336
|
+
setWorktreeBranch(worktree.suggestedBranch ?? "");
|
|
107337
|
+
requestAnimationFrame(() => worktreeInputRef.current?.select());
|
|
107338
|
+
},
|
|
107339
|
+
children: [
|
|
107340
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${environmentKindIcon("worktree")} text-[13px] w-4 shrink-0` }),
|
|
107341
|
+
"Start a worktree…",
|
|
107342
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "ml-auto text-[11px] text-[var(--zg-text-subtle)]", children: "moves this chat" })
|
|
107343
|
+
]
|
|
107344
|
+
}
|
|
107345
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
107346
|
+
"form",
|
|
107347
|
+
{
|
|
107348
|
+
className: "flex items-center gap-1.5 mt-1",
|
|
107349
|
+
onSubmit: (e2) => {
|
|
107350
|
+
e2.preventDefault();
|
|
107351
|
+
void startWorktree();
|
|
107352
|
+
},
|
|
107353
|
+
children: [
|
|
107354
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107355
|
+
"span",
|
|
107356
|
+
{
|
|
107357
|
+
"aria-hidden": true,
|
|
107358
|
+
className: `${environmentKindIcon("worktree")} text-[13px] w-4 shrink-0 ml-2 text-[var(--zg-text-muted)]`
|
|
107359
|
+
}
|
|
107360
|
+
),
|
|
107361
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107362
|
+
"input",
|
|
107363
|
+
{
|
|
107364
|
+
ref: worktreeInputRef,
|
|
107365
|
+
value: worktreeBranch,
|
|
107366
|
+
onChange: (e2) => setWorktreeBranch(e2.target.value),
|
|
107367
|
+
placeholder: worktree.suggestedBranch ?? "branch name",
|
|
107368
|
+
"aria-label": "New worktree branch",
|
|
107369
|
+
"data-testid": "git-worktree-branch",
|
|
107370
|
+
disabled: busy2 !== null,
|
|
107371
|
+
className: "zg-well zg-meta flex-1 min-w-0 h-7 px-2.5 text-[12px] placeholder:text-[var(--zg-text-subtle)]"
|
|
107372
|
+
}
|
|
107373
|
+
),
|
|
107374
|
+
busy2 === "worktree" ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-arc shrink-0 mr-2", "aria-label": "starting worktree" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(IconButton, { size: "xs", icon: "i-ph-arrow-right", label: "Start the worktree", type: "submit" })
|
|
107375
|
+
]
|
|
107376
|
+
}
|
|
107377
|
+
) })
|
|
106844
107378
|
]
|
|
106845
107379
|
}
|
|
106846
107380
|
);
|
|
@@ -107045,6 +107579,35 @@ const BranchRow = reactExports.memo(function BranchRow2({ row: b2, now: now2, ..
|
|
|
107045
107579
|
}
|
|
107046
107580
|
);
|
|
107047
107581
|
});
|
|
107582
|
+
const CreateRow = reactExports.memo(function CreateRow2({
|
|
107583
|
+
name: name2,
|
|
107584
|
+
worktree,
|
|
107585
|
+
now: _now,
|
|
107586
|
+
...row
|
|
107587
|
+
}) {
|
|
107588
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107589
|
+
Row$1,
|
|
107590
|
+
{
|
|
107591
|
+
...row,
|
|
107592
|
+
testId: worktree ? "git-create-worktree" : "git-create-branch",
|
|
107593
|
+
label: worktree ? `Start ${name2} as a worktree` : `Start branch ${name2}`,
|
|
107594
|
+
icon: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
107595
|
+
"span",
|
|
107596
|
+
{
|
|
107597
|
+
"aria-hidden": true,
|
|
107598
|
+
className: `${worktree ? environmentKindIcon("worktree") : "i-ph-plus"} text-[13px] text-[var(--zg-text-muted)]`
|
|
107599
|
+
}
|
|
107600
|
+
),
|
|
107601
|
+
title: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
107602
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0", children: worktree ? "Start as worktree" : "Start branch" }),
|
|
107603
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta truncate text-[var(--zg-text)]", children: name2 })
|
|
107604
|
+
] }),
|
|
107605
|
+
meta: worktree ? /* @__PURE__ */ jsxRuntimeExports.jsx(Chip$1, { kind: "new", icon: "i-ph-arrow-bend-up-right", children: "moves this chat" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Chip$1, { kind: "new", icon: "i-ph-git-branch", children: "from here, changes kept" }),
|
|
107606
|
+
size: null,
|
|
107607
|
+
actions: null
|
|
107608
|
+
}
|
|
107609
|
+
);
|
|
107610
|
+
});
|
|
107048
107611
|
function PrPlaceholder() {
|
|
107049
107612
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { "aria-hidden": true, className: "zg-menu-row", "data-size": "lg", children: [
|
|
107050
107613
|
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0 w-4" }),
|
|
@@ -132031,214 +132594,6 @@ function ComposerNotice({ text: text2, onDismiss, testId }) {
|
|
|
132031
132594
|
}
|
|
132032
132595
|
);
|
|
132033
132596
|
}
|
|
132034
|
-
const KIND_LABELS = {
|
|
132035
|
-
local: "Local",
|
|
132036
|
-
worktree: "Worktree",
|
|
132037
|
-
docker: "Docker",
|
|
132038
|
-
e2b: "E2B",
|
|
132039
|
-
daytona: "Daytona"
|
|
132040
|
-
};
|
|
132041
|
-
const KIND_ICONS = {
|
|
132042
|
-
local: "i-ph-laptop",
|
|
132043
|
-
worktree: "i-ph-git-branch",
|
|
132044
|
-
docker: "i-ph-cube",
|
|
132045
|
-
e2b: "i-ph-cloud",
|
|
132046
|
-
daytona: "i-ph-cloud"
|
|
132047
|
-
};
|
|
132048
|
-
const REMOTE_KINDS = /* @__PURE__ */ new Set(["e2b", "daytona"]);
|
|
132049
|
-
function runsInRemoteSandbox(environment) {
|
|
132050
|
-
return environment !== void 0 && REMOTE_KINDS.has(environment.kind);
|
|
132051
|
-
}
|
|
132052
|
-
function deleteSessionPrompt(title, environment) {
|
|
132053
|
-
const base2 = `Delete "${title}"?`;
|
|
132054
|
-
if (environment && runsInRemoteSandbox(environment)) {
|
|
132055
|
-
return `${base2}
|
|
132056
|
-
|
|
132057
|
-
Its ${environmentKindLabel(environment.kind)} sandbox is deleted too. Push anything you want to keep first.`;
|
|
132058
|
-
}
|
|
132059
|
-
return base2;
|
|
132060
|
-
}
|
|
132061
|
-
function environmentKindLabel(kind) {
|
|
132062
|
-
const machine = parseMachineKind(kind);
|
|
132063
|
-
if (machine) return `${KIND_LABELS[machine.base]} @ ${machine.name}`;
|
|
132064
|
-
return KIND_LABELS[kind] ?? kind;
|
|
132065
|
-
}
|
|
132066
|
-
function environmentKindIcon(kind) {
|
|
132067
|
-
return KIND_ICONS[parseMachineKind(kind)?.base ?? kind] ?? "i-ph-cube";
|
|
132068
|
-
}
|
|
132069
|
-
function environmentSummaryText(environment) {
|
|
132070
|
-
const label = environmentKindLabel(environment.kind);
|
|
132071
|
-
const where = environment.branch ? `${label} (${environment.branch})` : label;
|
|
132072
|
-
if (environment.state === "provisioning") {
|
|
132073
|
-
return `${where}. Setting up…`;
|
|
132074
|
-
}
|
|
132075
|
-
if (environment.state === "failed") {
|
|
132076
|
-
return `${where}. Setup failed${environment.error ? `: ${environment.error}` : "."}`;
|
|
132077
|
-
}
|
|
132078
|
-
if (environment.suspended) {
|
|
132079
|
-
return `${where}. Paused while idle, resumes on your next prompt.`;
|
|
132080
|
-
}
|
|
132081
|
-
return where;
|
|
132082
|
-
}
|
|
132083
|
-
function EnvironmentChip({ environment }) {
|
|
132084
|
-
if (!environment) {
|
|
132085
|
-
return null;
|
|
132086
|
-
}
|
|
132087
|
-
const icon = environment.state === "provisioning" ? "i-ph-circle-notch animate-spin text-[var(--zg-text-muted)]" : environment.state === "failed" ? "i-ph-warning-circle text-[var(--zg-danger)]" : `${environmentKindIcon(environment.kind)} ${environment.suspended ? "opacity-45" : ""}`;
|
|
132088
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
132089
|
-
"span",
|
|
132090
|
-
{
|
|
132091
|
-
"data-testid": "row-badge-environment",
|
|
132092
|
-
title: environmentSummaryText(environment),
|
|
132093
|
-
className: "zg-row-badge zg-meta inline-flex items-center gap-1 h-[18px] px-1.5 rounded-[var(--zg-radius-sm)] whitespace-nowrap",
|
|
132094
|
-
children: [
|
|
132095
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${icon} text-[11px]` }),
|
|
132096
|
-
environment.branch || environmentKindLabel(environment.kind)
|
|
132097
|
-
]
|
|
132098
|
-
}
|
|
132099
|
-
);
|
|
132100
|
-
}
|
|
132101
|
-
function useEnvironmentChoices(cwd2, hostId) {
|
|
132102
|
-
const listed = useIpcResource(cwd2 === null ? null : environmentsResource(cwd2, hostId)).data;
|
|
132103
|
-
return reactExports.useMemo(() => listed ? withMachines(listed) : NO_DESCRIPTORS, [listed]);
|
|
132104
|
-
}
|
|
132105
|
-
const NO_DESCRIPTORS = [];
|
|
132106
|
-
function withMachines(descriptors) {
|
|
132107
|
-
return orderByMachine(descriptors).map((descriptor) => {
|
|
132108
|
-
const blocked = machineBlockedReason(descriptor);
|
|
132109
|
-
return blocked && descriptor.available ? { ...descriptor, available: false, reason: blocked } : descriptor;
|
|
132110
|
-
});
|
|
132111
|
-
}
|
|
132112
|
-
const usable = (descriptor) => descriptor.enabled && descriptor.available;
|
|
132113
|
-
function resolveDraftDescriptor(descriptors, draft2) {
|
|
132114
|
-
const picked = draft2 ? descriptors.find((d2) => d2.kind === draft2.kind && usable(d2)) : void 0;
|
|
132115
|
-
return picked ?? descriptors.find((d2) => d2.isDefault && usable(d2)) ?? descriptors.find((d2) => d2.kind === "local");
|
|
132116
|
-
}
|
|
132117
|
-
function resolveDraftEnvironment(descriptors, draft2) {
|
|
132118
|
-
const descriptor = resolveDraftDescriptor(descriptors, draft2);
|
|
132119
|
-
if (!descriptor || descriptor.kind === "local") {
|
|
132120
|
-
return void 0;
|
|
132121
|
-
}
|
|
132122
|
-
const typed = draft2?.kind === descriptor.kind ? draft2.branch.trim() : "";
|
|
132123
|
-
const branch = descriptor.takesBranch ? typed || descriptor.suggestedBranch : void 0;
|
|
132124
|
-
return { kind: descriptor.kind, ...branch ? { branch } : {} };
|
|
132125
|
-
}
|
|
132126
|
-
function EnvironmentPicker({
|
|
132127
|
-
descriptors,
|
|
132128
|
-
draft: draft2,
|
|
132129
|
-
onChange,
|
|
132130
|
-
onOpenSettings
|
|
132131
|
-
}) {
|
|
132132
|
-
const branchRef = reactExports.useRef(null);
|
|
132133
|
-
const offered = descriptors.filter((d2) => d2.enabled);
|
|
132134
|
-
const selected = resolveDraftDescriptor(descriptors, draft2);
|
|
132135
|
-
if (offered.length <= 1 || !selected) {
|
|
132136
|
-
return null;
|
|
132137
|
-
}
|
|
132138
|
-
const typedBranch = draft2?.kind === selected.kind ? draft2.branch : "";
|
|
132139
|
-
const branchLabel = selected.takesBranch ? typedBranch.trim() || selected.suggestedBranch : void 0;
|
|
132140
|
-
const icon = environmentKindIcon(selected.kind);
|
|
132141
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
132142
|
-
Popover,
|
|
132143
|
-
{
|
|
132144
|
-
role: "menu",
|
|
132145
|
-
ariaLabel: "Choose where the session runs",
|
|
132146
|
-
align: "end",
|
|
132147
|
-
width: 300,
|
|
132148
|
-
trigger: (props) => /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-segment shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
132149
|
-
"button",
|
|
132150
|
-
{
|
|
132151
|
-
...props,
|
|
132152
|
-
type: "button",
|
|
132153
|
-
title: `Runs in: ${selected.label}${branchLabel ? ` (${branchLabel})` : ""}`,
|
|
132154
|
-
className: "zg-segment-item zg-press-subtle inline-flex items-center gap-1.5 h-6 pl-2.5 pr-2 rounded-full text-xs border-0 bg-transparent text-[var(--zg-text-muted)] cursor-pointer whitespace-nowrap",
|
|
132155
|
-
children: [
|
|
132156
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: `${icon} text-[11px] shrink-0` }),
|
|
132157
|
-
branchLabel ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-pill-label max-w-[min(130px,14cqi)] truncate font-mono", children: branchLabel }) : /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-pill-label shrink-0", children: selected.label }),
|
|
132158
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "zg-pill-label i-ph-caret-up-down text-[10px] shrink-0 opacity-70" })
|
|
132159
|
-
]
|
|
132160
|
-
}
|
|
132161
|
-
) }),
|
|
132162
|
-
children: (close2) => /* @__PURE__ */ jsxRuntimeExports.jsxs(Menu$1, { role: "group", children: [
|
|
132163
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(MenuSection, { label: "Runs in", children: offered.map((descriptor) => {
|
|
132164
|
-
const active2 = descriptor.kind === selected.kind;
|
|
132165
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
132166
|
-
MenuRow$1,
|
|
132167
|
-
{
|
|
132168
|
-
size: "lg",
|
|
132169
|
-
role: "menuitemradio",
|
|
132170
|
-
checked: active2,
|
|
132171
|
-
disabled: !descriptor.available,
|
|
132172
|
-
hint: descriptor.available ? void 0 : descriptor.reason,
|
|
132173
|
-
icon: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: environmentKindIcon(descriptor.kind) }),
|
|
132174
|
-
title: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
132175
|
-
descriptor.label,
|
|
132176
|
-
descriptor.machine && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
132177
|
-
MetaChip,
|
|
132178
|
-
{
|
|
132179
|
-
tone: descriptor.machine.status === "online" ? "success" : "muted",
|
|
132180
|
-
className: "font-normal ml-1.5",
|
|
132181
|
-
children: descriptor.machine.status
|
|
132182
|
-
}
|
|
132183
|
-
),
|
|
132184
|
-
descriptor.isDefault && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta font-normal ml-1.5", children: "default" })
|
|
132185
|
-
] }),
|
|
132186
|
-
description: descriptor.available ? descriptor.description : descriptor.reason,
|
|
132187
|
-
onClick: () => {
|
|
132188
|
-
onChange({ kind: descriptor.kind, branch: active2 ? typedBranch : "" });
|
|
132189
|
-
if (descriptor.takesBranch) {
|
|
132190
|
-
requestAnimationFrame(() => branchRef.current?.focus());
|
|
132191
|
-
} else {
|
|
132192
|
-
close2();
|
|
132193
|
-
}
|
|
132194
|
-
}
|
|
132195
|
-
},
|
|
132196
|
-
descriptor.kind
|
|
132197
|
-
);
|
|
132198
|
-
}) }),
|
|
132199
|
-
selected.takesBranch && /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
132200
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(MenuSeparator$1, {}),
|
|
132201
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(MenuSection, { label: "Branch", children: [
|
|
132202
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "px-2 pb-1.5", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
132203
|
-
"input",
|
|
132204
|
-
{
|
|
132205
|
-
ref: branchRef,
|
|
132206
|
-
type: "text",
|
|
132207
|
-
value: typedBranch,
|
|
132208
|
-
onChange: (event) => onChange({ kind: selected.kind, branch: event.target.value }),
|
|
132209
|
-
onKeyDown: (event) => {
|
|
132210
|
-
if (event.key === "Enter") {
|
|
132211
|
-
event.preventDefault();
|
|
132212
|
-
close2();
|
|
132213
|
-
}
|
|
132214
|
-
},
|
|
132215
|
-
placeholder: selected.suggestedBranch ?? "Branch name",
|
|
132216
|
-
"aria-label": "Branch",
|
|
132217
|
-
spellCheck: false,
|
|
132218
|
-
className: "zg-well w-full h-7 px-2 text-xs font-mono placeholder:text-[var(--zg-text-subtle)]"
|
|
132219
|
-
}
|
|
132220
|
-
) }),
|
|
132221
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { className: "!pt-0", children: "Empty uses the suggested name." })
|
|
132222
|
-
] })
|
|
132223
|
-
] }),
|
|
132224
|
-
selected.note && /* @__PURE__ */ jsxRuntimeExports.jsx(MenuNote, { icon: "i-ph-info", children: selected.note }),
|
|
132225
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(MenuSeparator$1, {}),
|
|
132226
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
132227
|
-
MenuRow$1,
|
|
132228
|
-
{
|
|
132229
|
-
role: "menuitem",
|
|
132230
|
-
icon: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "aria-hidden": true, className: "i-ph-gear-six" }),
|
|
132231
|
-
title: "Environment settings…",
|
|
132232
|
-
onClick: () => {
|
|
132233
|
-
close2();
|
|
132234
|
-
onOpenSettings();
|
|
132235
|
-
}
|
|
132236
|
-
}
|
|
132237
|
-
)
|
|
132238
|
-
] })
|
|
132239
|
-
}
|
|
132240
|
-
);
|
|
132241
|
-
}
|
|
132242
132597
|
const online = /* @__PURE__ */ new Set();
|
|
132243
132598
|
let snapshot = /* @__PURE__ */ new Set();
|
|
132244
132599
|
const listeners$9 = /* @__PURE__ */ new Set();
|
|
@@ -134378,6 +134733,7 @@ const ConversationPane = reactExports.memo(function ConversationPane2({
|
|
|
134378
134733
|
session,
|
|
134379
134734
|
lightsInCenter,
|
|
134380
134735
|
searchOpen,
|
|
134736
|
+
searchQuery,
|
|
134381
134737
|
actions
|
|
134382
134738
|
}) {
|
|
134383
134739
|
const sessionId = session?.id ?? null;
|
|
@@ -134433,7 +134789,17 @@ const ConversationPane = reactExports.memo(function ConversationPane2({
|
|
|
134433
134789
|
)
|
|
134434
134790
|
}
|
|
134435
134791
|
),
|
|
134436
|
-
searchOpen && session &&
|
|
134792
|
+
searchOpen && session && // Keyed by the query: a new palette match opens a fresh search, not the old one edited.
|
|
134793
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
134794
|
+
TranscriptSearch,
|
|
134795
|
+
{
|
|
134796
|
+
container: scrollRef,
|
|
134797
|
+
sessionId: session.id,
|
|
134798
|
+
initialQuery: searchQuery,
|
|
134799
|
+
onClose: actions.closeSearch
|
|
134800
|
+
},
|
|
134801
|
+
searchQuery ?? ""
|
|
134802
|
+
),
|
|
134437
134803
|
search2.query !== null && /* @__PURE__ */ jsxRuntimeExports.jsx(SearchHighlightStyle, {})
|
|
134438
134804
|
] }),
|
|
134439
134805
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -168220,7 +168586,7 @@ function ancestorDirs(paths) {
|
|
|
168220
168586
|
return [...dirs];
|
|
168221
168587
|
}
|
|
168222
168588
|
const TREE_WIDTH = { default: 220, min: 160, max: 480 };
|
|
168223
|
-
const SEARCH_DEBOUNCE_MS$
|
|
168589
|
+
const SEARCH_DEBOUNCE_MS$2 = 100;
|
|
168224
168590
|
const MemoFileTree = reactExports.memo(FileTree2);
|
|
168225
168591
|
const TreeColumn = reactExports.memo(function TreeColumn2(p2) {
|
|
168226
168592
|
const onRight = p2.side === "right";
|
|
@@ -168238,7 +168604,7 @@ const TreeColumn = reactExports.memo(function TreeColumn2(p2) {
|
|
|
168238
168604
|
const [query, setQuery] = reactExports.useState("");
|
|
168239
168605
|
const { controlRef, entries: entries2 } = p2;
|
|
168240
168606
|
reactExports.useEffect(() => {
|
|
168241
|
-
const t2 = window.setTimeout(() => controlRef.current?.setSearch(query), SEARCH_DEBOUNCE_MS$
|
|
168607
|
+
const t2 = window.setTimeout(() => controlRef.current?.setSearch(query), SEARCH_DEBOUNCE_MS$2);
|
|
168242
168608
|
return () => window.clearTimeout(t2);
|
|
168243
168609
|
}, [controlRef, query]);
|
|
168244
168610
|
const queryRef = reactExports.useRef(query);
|
|
@@ -170772,6 +171138,7 @@ function Center(props) {
|
|
|
170772
171138
|
session: activeSession,
|
|
170773
171139
|
lightsInCenter,
|
|
170774
171140
|
searchOpen: props.searchOpen,
|
|
171141
|
+
searchQuery: props.searchQuery,
|
|
170775
171142
|
actions
|
|
170776
171143
|
}
|
|
170777
171144
|
),
|
|
@@ -171036,6 +171403,85 @@ function IconPicker({
|
|
|
171036
171403
|
/* @__PURE__ */ jsxRuntimeExports.jsx("input", { ref: fileRef, type: "file", accept: "image/*", className: "hidden", onChange: (e2) => void onFileChange(e2) })
|
|
171037
171404
|
] });
|
|
171038
171405
|
}
|
|
171406
|
+
const INITIAL = {
|
|
171407
|
+
running: "",
|
|
171408
|
+
latest: null,
|
|
171409
|
+
hasUpdate: false,
|
|
171410
|
+
installed: null,
|
|
171411
|
+
restartRequired: false,
|
|
171412
|
+
phase: "idle",
|
|
171413
|
+
progress: null,
|
|
171414
|
+
error: null,
|
|
171415
|
+
checkedAt: null
|
|
171416
|
+
};
|
|
171417
|
+
let state = INITIAL;
|
|
171418
|
+
let wired = false;
|
|
171419
|
+
const listeners$4 = /* @__PURE__ */ new Set();
|
|
171420
|
+
function set(next) {
|
|
171421
|
+
if (!next) {
|
|
171422
|
+
return;
|
|
171423
|
+
}
|
|
171424
|
+
state = next;
|
|
171425
|
+
for (const listener of listeners$4) {
|
|
171426
|
+
listener();
|
|
171427
|
+
}
|
|
171428
|
+
}
|
|
171429
|
+
function wire() {
|
|
171430
|
+
if (wired) {
|
|
171431
|
+
return;
|
|
171432
|
+
}
|
|
171433
|
+
wired = true;
|
|
171434
|
+
window.api.update.onChanged(set);
|
|
171435
|
+
void window.api.update.state().then(set, () => void 0);
|
|
171436
|
+
}
|
|
171437
|
+
function subscribe$4(listener) {
|
|
171438
|
+
wire();
|
|
171439
|
+
listeners$4.add(listener);
|
|
171440
|
+
return () => {
|
|
171441
|
+
listeners$4.delete(listener);
|
|
171442
|
+
};
|
|
171443
|
+
}
|
|
171444
|
+
function getSnapshot() {
|
|
171445
|
+
return state;
|
|
171446
|
+
}
|
|
171447
|
+
function useUpdateState() {
|
|
171448
|
+
return reactExports.useSyncExternalStore(subscribe$4, getSnapshot, getSnapshot);
|
|
171449
|
+
}
|
|
171450
|
+
function useUpdateChecks() {
|
|
171451
|
+
const { settings } = useSettings();
|
|
171452
|
+
const checksOn = settings.checkForUpdates !== false;
|
|
171453
|
+
reactExports.useEffect(() => {
|
|
171454
|
+
if (checksOn) {
|
|
171455
|
+
window.api.update.check().catch(() => void 0);
|
|
171456
|
+
}
|
|
171457
|
+
}, [checksOn]);
|
|
171458
|
+
}
|
|
171459
|
+
function useAppUpdate() {
|
|
171460
|
+
const update2 = useUpdateState();
|
|
171461
|
+
const { settings } = useSettings();
|
|
171462
|
+
const checksOn = settings.checkForUpdates !== false;
|
|
171463
|
+
const version = update2.restartRequired ? update2.installed : update2.latest;
|
|
171464
|
+
const show = update2.phase === "updating" || update2.restartRequired || checksOn && (update2.hasUpdate || update2.phase === "failed");
|
|
171465
|
+
if (!show || !version) {
|
|
171466
|
+
return null;
|
|
171467
|
+
}
|
|
171468
|
+
const kind = update2.phase === "updating" ? "updating" : update2.restartRequired ? "restart" : update2.phase === "failed" ? "failed" : "available";
|
|
171469
|
+
const label = `v${version.replace(/^v/, "")}`;
|
|
171470
|
+
const title = kind === "updating" ? `Updating to Zidane ${label}…${update2.progress ? `
|
|
171471
|
+
${update2.progress}` : ""}` : kind === "restart" ? `Zidane ${label} is installed. Restart to use it.` : kind === "failed" ? `Upgrade to Zidane ${label} failed. Click to retry.
|
|
171472
|
+
${update2.error ?? ""}`.trimEnd() : `Upgrade to Zidane ${label}.`;
|
|
171473
|
+
const run2 = () => {
|
|
171474
|
+
if (kind === "updating") {
|
|
171475
|
+
return;
|
|
171476
|
+
}
|
|
171477
|
+
if (kind === "restart") {
|
|
171478
|
+
window.api.update.restart().catch((err) => console.error("[zidane-gui] update restart failed", err));
|
|
171479
|
+
return;
|
|
171480
|
+
}
|
|
171481
|
+
window.api.update.install().catch((err) => console.error("[zidane-gui] update install failed", err));
|
|
171482
|
+
};
|
|
171483
|
+
return { kind, label, title, run: run2 };
|
|
171484
|
+
}
|
|
171039
171485
|
function orbState(health2, running2, attention2) {
|
|
171040
171486
|
if (health2 === "disconnected") return "down";
|
|
171041
171487
|
if (health2 === "connecting") return "connecting";
|
|
@@ -171561,50 +172007,6 @@ function useProviderUsage() {
|
|
|
171561
172007
|
}
|
|
171562
172008
|
return ctx2;
|
|
171563
172009
|
}
|
|
171564
|
-
const INITIAL = {
|
|
171565
|
-
running: "",
|
|
171566
|
-
latest: null,
|
|
171567
|
-
hasUpdate: false,
|
|
171568
|
-
installed: null,
|
|
171569
|
-
restartRequired: false,
|
|
171570
|
-
phase: "idle",
|
|
171571
|
-
progress: null,
|
|
171572
|
-
error: null,
|
|
171573
|
-
checkedAt: null
|
|
171574
|
-
};
|
|
171575
|
-
let state = INITIAL;
|
|
171576
|
-
let wired = false;
|
|
171577
|
-
const listeners$4 = /* @__PURE__ */ new Set();
|
|
171578
|
-
function set(next) {
|
|
171579
|
-
if (!next) {
|
|
171580
|
-
return;
|
|
171581
|
-
}
|
|
171582
|
-
state = next;
|
|
171583
|
-
for (const listener of listeners$4) {
|
|
171584
|
-
listener();
|
|
171585
|
-
}
|
|
171586
|
-
}
|
|
171587
|
-
function wire() {
|
|
171588
|
-
if (wired) {
|
|
171589
|
-
return;
|
|
171590
|
-
}
|
|
171591
|
-
wired = true;
|
|
171592
|
-
window.api.update.onChanged(set);
|
|
171593
|
-
void window.api.update.state().then(set, () => void 0);
|
|
171594
|
-
}
|
|
171595
|
-
function subscribe$4(listener) {
|
|
171596
|
-
wire();
|
|
171597
|
-
listeners$4.add(listener);
|
|
171598
|
-
return () => {
|
|
171599
|
-
listeners$4.delete(listener);
|
|
171600
|
-
};
|
|
171601
|
-
}
|
|
171602
|
-
function getSnapshot() {
|
|
171603
|
-
return state;
|
|
171604
|
-
}
|
|
171605
|
-
function useUpdateState() {
|
|
171606
|
-
return reactExports.useSyncExternalStore(subscribe$4, getSnapshot, getSnapshot);
|
|
171607
|
-
}
|
|
171608
172010
|
const FRAME_INTERVAL_MS = 50;
|
|
171609
172011
|
const ELLIPSIS_FRAMES = 8;
|
|
171610
172012
|
const CHARSET = "0123456789abcdefABCDEF~!@#$£€%^&*()+=_";
|
|
@@ -171712,6 +172114,8 @@ function ReducedMotionFallback({
|
|
|
171712
172114
|
const FOOTER_TEXT_BUTTON = "zg-segment-item zg-press-soft zg-hit-extend relative inline-flex items-center gap-1.5 h-7 px-2 rounded-[var(--zg-radius-sm)] bg-transparent border-0 cursor-pointer shrink-0 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-[var(--zg-ring)]";
|
|
171713
172115
|
function Footer({ compacting, hasAuth, onOpenAuth, onOpenSettings, compactionProgress, spaces }) {
|
|
171714
172116
|
const { settings } = useSettings();
|
|
172117
|
+
useUpdateChecks();
|
|
172118
|
+
const update2 = useAppUpdate();
|
|
171715
172119
|
return (
|
|
171716
172120
|
/*
|
|
171717
172121
|
* Height invariant: 28px content (h-7 buttons) + 5px top + 4px bottom
|
|
@@ -171733,69 +172137,31 @@ function Footer({ compacting, hasAuth, onOpenAuth, onOpenSettings, compactionPro
|
|
|
171733
172137
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-2 px-2 pt-[5px] pb-1 text-[11px] text-[var(--zg-text-muted)] shrink-0", children: [
|
|
171734
172138
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
171735
172139
|
settings.useDaemon && /* @__PURE__ */ jsxRuntimeExports.jsx(DaemonMenu, {}),
|
|
171736
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(UpdateButton, {}),
|
|
171737
172140
|
hasAuth === false && /* @__PURE__ */ jsxRuntimeExports.jsx(SignInPrompt, { onClick: onOpenAuth }),
|
|
171738
172141
|
settings.showUsageIndicator !== false && /* @__PURE__ */ jsxRuntimeExports.jsx(UsageIndicator, {}),
|
|
171739
172142
|
/* @__PURE__ */ jsxRuntimeExports.jsx(Presence$1, { show: compacting && settings.showThrobber, children: /* @__PURE__ */ jsxRuntimeExports.jsx(CompactingIndicator, { progress: compactionProgress }) })
|
|
171740
172143
|
] }),
|
|
171741
172144
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center min-w-0", children: spaces }),
|
|
171742
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-end min-w-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
172145
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center justify-end min-w-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
172146
|
+
IconButton,
|
|
172147
|
+
{
|
|
172148
|
+
icon: "i-ph-gear-six",
|
|
172149
|
+
label: update2 ? `Settings. ${update2.title.split("\n")[0]}` : "Settings",
|
|
172150
|
+
onClick: onOpenSettings,
|
|
172151
|
+
className: "zg-hit-extend relative",
|
|
172152
|
+
children: update2 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
172153
|
+
"span",
|
|
172154
|
+
{
|
|
172155
|
+
"aria-hidden": true,
|
|
172156
|
+
"data-update-dot": true,
|
|
172157
|
+
className: `pointer-events-none absolute top-1 right-1 w-1.5 h-1.5 rounded-full ${update2.kind === "failed" ? "bg-[var(--zg-warn)]" : "bg-[var(--zg-accent)]"}`
|
|
172158
|
+
}
|
|
172159
|
+
)
|
|
172160
|
+
}
|
|
172161
|
+
) })
|
|
171743
172162
|
] })
|
|
171744
172163
|
);
|
|
171745
172164
|
}
|
|
171746
|
-
function UpdateButton() {
|
|
171747
|
-
const update2 = useUpdateState();
|
|
171748
|
-
const { settings } = useSettings();
|
|
171749
|
-
const checksOn = settings.checkForUpdates !== false;
|
|
171750
|
-
reactExports.useEffect(() => {
|
|
171751
|
-
if (checksOn) {
|
|
171752
|
-
window.api.update.check().catch(() => void 0);
|
|
171753
|
-
}
|
|
171754
|
-
}, [checksOn]);
|
|
171755
|
-
const version = update2.restartRequired ? update2.installed : update2.latest;
|
|
171756
|
-
const show = update2.phase === "updating" || update2.restartRequired || checksOn && (update2.hasUpdate || update2.phase === "failed");
|
|
171757
|
-
if (!show || !version) {
|
|
171758
|
-
return null;
|
|
171759
|
-
}
|
|
171760
|
-
const kind = update2.phase === "updating" ? "updating" : update2.restartRequired ? "restart" : update2.phase === "failed" ? "failed" : "available";
|
|
171761
|
-
const label = `v${version.replace(/^v/, "")}`;
|
|
171762
|
-
const title = kind === "updating" ? `Updating to ${label}…${update2.progress ? `
|
|
171763
|
-
${update2.progress}` : ""}` : kind === "restart" ? `${label} installed. Click to restart` : kind === "failed" ? `Update to ${label} failed. Click to retry
|
|
171764
|
-
${update2.error ?? ""}`.trimEnd() : `${label} available. Click to install`;
|
|
171765
|
-
const tone = kind === "failed" ? "!text-[var(--zg-warn)]" : "!text-[var(--zg-accent)]";
|
|
171766
|
-
const onClick = () => {
|
|
171767
|
-
if (kind === "updating") {
|
|
171768
|
-
return;
|
|
171769
|
-
}
|
|
171770
|
-
if (kind === "restart") {
|
|
171771
|
-
window.api.update.restart().catch((err) => console.error("[zidane-gui] update restart failed", err));
|
|
171772
|
-
return;
|
|
171773
|
-
}
|
|
171774
|
-
window.api.update.install().catch((err) => console.error("[zidane-gui] update install failed", err));
|
|
171775
|
-
};
|
|
171776
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
171777
|
-
"button",
|
|
171778
|
-
{
|
|
171779
|
-
type: "button",
|
|
171780
|
-
onClick,
|
|
171781
|
-
disabled: kind === "updating",
|
|
171782
|
-
"aria-busy": kind === "updating",
|
|
171783
|
-
title,
|
|
171784
|
-
"aria-label": title,
|
|
171785
|
-
className: `${FOOTER_TEXT_BUTTON} disabled:cursor-progress ${tone}`,
|
|
171786
|
-
children: [
|
|
171787
|
-
kind === "updating" ? /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSpinner, { size: "xs", tone: "accent", label: title }) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
171788
|
-
"span",
|
|
171789
|
-
{
|
|
171790
|
-
"aria-hidden": true,
|
|
171791
|
-
className: `text-sm ${kind === "restart" ? "i-ph-arrows-clockwise" : "i-ph-arrow-circle-up-fill"}`
|
|
171792
|
-
}
|
|
171793
|
-
),
|
|
171794
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta !text-current", children: label })
|
|
171795
|
-
]
|
|
171796
|
-
}
|
|
171797
|
-
);
|
|
171798
|
-
}
|
|
171799
172165
|
function UsageIndicator() {
|
|
171800
172166
|
const { sessions: sessions2, activeSessionId } = useSessionsList();
|
|
171801
172167
|
const { settings } = useSettings();
|
|
@@ -177873,7 +178239,7 @@ function SidebarSearchRow({ value, onChange }) {
|
|
|
177873
178239
|
/* @__PURE__ */ jsxRuntimeExports.jsx(SidebarFilterMenu, {})
|
|
177874
178240
|
] });
|
|
177875
178241
|
}
|
|
177876
|
-
const SEARCH_DEBOUNCE_MS = 200;
|
|
178242
|
+
const SEARCH_DEBOUNCE_MS$1 = 200;
|
|
177877
178243
|
function useSessionSearch(sessions2, archiveFilter) {
|
|
177878
178244
|
const [searchQuery, setSearchQuery] = reactExports.useState("");
|
|
177879
178245
|
const [contentHits, setContentHits] = reactExports.useState([]);
|
|
@@ -177889,7 +178255,7 @@ function useSessionSearch(sessions2, archiveFilter) {
|
|
|
177889
178255
|
}
|
|
177890
178256
|
setSearching(true);
|
|
177891
178257
|
const timer2 = setTimeout(() => {
|
|
177892
|
-
void window.api.sessions.search(trimmedQuery, { archive: archiveFilter }).then((res) => {
|
|
178258
|
+
void window.api.sessions.search(trimmedQuery, { archive: archiveFilter }, "sidebar").then((res) => {
|
|
177893
178259
|
if (res.token < searchTokenRef.current) {
|
|
177894
178260
|
return;
|
|
177895
178261
|
}
|
|
@@ -177897,7 +178263,7 @@ function useSessionSearch(sessions2, archiveFilter) {
|
|
|
177897
178263
|
setContentHits(res.results);
|
|
177898
178264
|
setSearching(false);
|
|
177899
178265
|
}).catch(() => setSearching(false));
|
|
177900
|
-
}, SEARCH_DEBOUNCE_MS);
|
|
178266
|
+
}, SEARCH_DEBOUNCE_MS$1);
|
|
177901
178267
|
return () => clearTimeout(timer2);
|
|
177902
178268
|
}, [searchMode, trimmedQuery, archiveFilter]);
|
|
177903
178269
|
const titleMatches = reactExports.useMemo(() => {
|
|
@@ -186618,7 +186984,13 @@ const AGENT = {
|
|
|
186618
186984
|
},
|
|
186619
186985
|
{
|
|
186620
186986
|
title: "Agent tools",
|
|
186621
|
-
rows: [
|
|
186987
|
+
rows: [
|
|
186988
|
+
{ key: "terminalAgent" },
|
|
186989
|
+
{ key: "terminalAgentTasks" },
|
|
186990
|
+
{ key: "browserAgent" },
|
|
186991
|
+
{ key: "webSearch" },
|
|
186992
|
+
{ key: "codemode" }
|
|
186993
|
+
]
|
|
186622
186994
|
}
|
|
186623
186995
|
]
|
|
186624
186996
|
};
|
|
@@ -187663,16 +188035,39 @@ function AppVersion() {
|
|
|
187663
188035
|
if (!version) {
|
|
187664
188036
|
return null;
|
|
187665
188037
|
}
|
|
188038
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "mt-2 flex items-center gap-1 shrink-0", children: [
|
|
188039
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
188040
|
+
MenuRow$1,
|
|
188041
|
+
{
|
|
188042
|
+
size: "sm",
|
|
188043
|
+
onClick: () => {
|
|
188044
|
+
void navigator.clipboard.writeText(version).then(() => setCopied(true));
|
|
188045
|
+
},
|
|
188046
|
+
hint: "Copy version",
|
|
188047
|
+
title: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta", children: copied ? "copied" : `Zidane ${version}` }),
|
|
188048
|
+
className: "flex-1 min-w-0 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-[-2px] focus-visible:outline-[var(--zg-ring)]"
|
|
188049
|
+
}
|
|
188050
|
+
),
|
|
188051
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(UpgradeButton, {})
|
|
188052
|
+
] });
|
|
188053
|
+
}
|
|
188054
|
+
function UpgradeButton() {
|
|
188055
|
+
const update2 = useAppUpdate();
|
|
188056
|
+
if (!update2) {
|
|
188057
|
+
return null;
|
|
188058
|
+
}
|
|
188059
|
+
const updating = update2.kind === "updating";
|
|
188060
|
+
const tone = update2.kind === "failed" ? "!text-[var(--zg-warn)]" : "!text-[var(--zg-accent)]";
|
|
187666
188061
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
187667
|
-
|
|
188062
|
+
IconButton,
|
|
187668
188063
|
{
|
|
187669
188064
|
size: "sm",
|
|
187670
|
-
|
|
187671
|
-
|
|
187672
|
-
|
|
187673
|
-
|
|
187674
|
-
|
|
187675
|
-
className:
|
|
188065
|
+
icon: updating ? /* @__PURE__ */ jsxRuntimeExports.jsx(SegmentSpinner, { size: "xs", tone: "accent", label: update2.title }) : update2.kind === "restart" ? "i-ph-arrows-clockwise" : "i-ph-arrow-circle-up-fill",
|
|
188066
|
+
label: update2.title,
|
|
188067
|
+
onClick: update2.run,
|
|
188068
|
+
disabled: updating,
|
|
188069
|
+
"aria-busy": updating,
|
|
188070
|
+
className: `${tone} disabled:!opacity-100 disabled:cursor-progress`
|
|
187676
188071
|
}
|
|
187677
188072
|
);
|
|
187678
188073
|
}
|
|
@@ -188874,11 +189269,10 @@ function sessionItemId(key2) {
|
|
|
188874
189269
|
function sessionKeyOfItem(itemId) {
|
|
188875
189270
|
return itemId.slice(SESSION_ITEM_PREFIX.length);
|
|
188876
189271
|
}
|
|
188877
|
-
const MAX_SESSIONS = 60;
|
|
188878
189272
|
const PALETTE_SESSIONS_SHOWN = 6;
|
|
188879
189273
|
function orderPaletteSessions(sessions2, activeSessionId, rankOf) {
|
|
188880
189274
|
const ranks = new Map(sessions2.map((s2) => [s2.id, rankOf(s2.id)]));
|
|
188881
|
-
const ordered = [...sessions2].sort((a2, b2) => ranks.get(a2.id) - ranks.get(b2.id) || b2.updatedAt - a2.updatedAt)
|
|
189275
|
+
const ordered = [...sessions2].sort((a2, b2) => ranks.get(a2.id) - ranks.get(b2.id) || b2.updatedAt - a2.updatedAt);
|
|
188882
189276
|
const shown2 = new Set(
|
|
188883
189277
|
ordered.filter((s2) => s2.id !== activeSessionId).slice(0, PALETTE_SESSIONS_SHOWN).map((s2) => s2.id)
|
|
188884
189278
|
);
|
|
@@ -188907,16 +189301,104 @@ function sessionsSource(sessions2, activeSessionId, setActiveSessionId, rankOf)
|
|
|
188907
189301
|
}
|
|
188908
189302
|
};
|
|
188909
189303
|
}
|
|
189304
|
+
const CONVERSATIONS_SOURCE_ID = "builtin:conversations";
|
|
189305
|
+
const CONVERSATION_ITEM_PREFIX = "conversation:";
|
|
189306
|
+
const CONVERSATIONS_GROUP = "In conversations";
|
|
189307
|
+
function conversationItemId(target) {
|
|
189308
|
+
return CONVERSATION_ITEM_PREFIX + JSON.stringify([target.sessionId, target.query]);
|
|
189309
|
+
}
|
|
189310
|
+
function conversationTargetOf(itemId) {
|
|
189311
|
+
if (!itemId.startsWith(CONVERSATION_ITEM_PREFIX)) return null;
|
|
189312
|
+
try {
|
|
189313
|
+
const parsed = JSON.parse(itemId.slice(CONVERSATION_ITEM_PREFIX.length));
|
|
189314
|
+
if (!Array.isArray(parsed) || typeof parsed[0] !== "string" || typeof parsed[1] !== "string") return null;
|
|
189315
|
+
return { sessionId: parsed[0], query: parsed[1] };
|
|
189316
|
+
} catch {
|
|
189317
|
+
return null;
|
|
189318
|
+
}
|
|
189319
|
+
}
|
|
189320
|
+
function conversationItem(hit, session, query) {
|
|
189321
|
+
return {
|
|
189322
|
+
id: conversationItemId({ sessionId: hit.sessionId, query }),
|
|
189323
|
+
title: session.title || hit.title || "Untitled session",
|
|
189324
|
+
description: hit.excerpt,
|
|
189325
|
+
group: CONVERSATIONS_GROUP,
|
|
189326
|
+
keywords: [basename$2(session.cwd)],
|
|
189327
|
+
source: CONVERSATIONS_SOURCE_ID
|
|
189328
|
+
};
|
|
189329
|
+
}
|
|
189330
|
+
function conversationsSource(open) {
|
|
189331
|
+
return {
|
|
189332
|
+
id: CONVERSATIONS_SOURCE_ID,
|
|
189333
|
+
// Query-driven: never in the catalog (see the module doc).
|
|
189334
|
+
items: () => [],
|
|
189335
|
+
run: (itemId) => {
|
|
189336
|
+
const target = conversationTargetOf(itemId);
|
|
189337
|
+
if (target) open(target);
|
|
189338
|
+
}
|
|
189339
|
+
};
|
|
189340
|
+
}
|
|
189341
|
+
const SEARCH_DEBOUNCE_MS = 150;
|
|
189342
|
+
const CONVERSATION_SEARCH_MIN_CHARS = 2;
|
|
189343
|
+
const IDLE = { rows: [], hits: /* @__PURE__ */ new Map(), searching: false };
|
|
189344
|
+
function useConversationSearch(query, enabled, sessions2, archive, listed) {
|
|
189345
|
+
const text2 = query.trim();
|
|
189346
|
+
const active2 = enabled && text2.length >= CONVERSATION_SEARCH_MIN_CHARS;
|
|
189347
|
+
const [answer, setAnswer] = reactExports.useState(null);
|
|
189348
|
+
const latest = reactExports.useRef(0);
|
|
189349
|
+
reactExports.useEffect(() => {
|
|
189350
|
+
const request2 = ++latest.current;
|
|
189351
|
+
if (!active2) {
|
|
189352
|
+
setAnswer(null);
|
|
189353
|
+
return;
|
|
189354
|
+
}
|
|
189355
|
+
const timer2 = setTimeout(() => {
|
|
189356
|
+
window.api.sessions.search(text2, { archive }, "palette").then(
|
|
189357
|
+
(res) => {
|
|
189358
|
+
if (request2 === latest.current) setAnswer({ query: text2, hits: res.results });
|
|
189359
|
+
},
|
|
189360
|
+
() => {
|
|
189361
|
+
if (request2 === latest.current) setAnswer({ query: text2, hits: [] });
|
|
189362
|
+
}
|
|
189363
|
+
);
|
|
189364
|
+
}, SEARCH_DEBOUNCE_MS);
|
|
189365
|
+
return () => clearTimeout(timer2);
|
|
189366
|
+
}, [active2, text2, archive]);
|
|
189367
|
+
return reactExports.useMemo(() => {
|
|
189368
|
+
if (!active2) return IDLE;
|
|
189369
|
+
const searching = answer?.query !== text2;
|
|
189370
|
+
if (!answer) return { ...IDLE, searching };
|
|
189371
|
+
const byId = new Map(sessions2.map((s2) => [s2.id, s2]));
|
|
189372
|
+
const rows2 = [];
|
|
189373
|
+
const hits = /* @__PURE__ */ new Map();
|
|
189374
|
+
for (const hit of answer.hits) {
|
|
189375
|
+
const session = byId.get(hit.sessionId);
|
|
189376
|
+
if (!session || listed.has(hit.sessionId)) continue;
|
|
189377
|
+
const item = conversationItem(hit, session, answer.query);
|
|
189378
|
+
rows2.push({ item, score: 0, titleMatches: [] });
|
|
189379
|
+
hits.set(item.id, hit);
|
|
189380
|
+
}
|
|
189381
|
+
return { rows: rows2, hits, searching };
|
|
189382
|
+
}, [active2, answer, text2, sessions2, listed]);
|
|
189383
|
+
}
|
|
189384
|
+
const ConversationHitsContext = reactExports.createContext(/* @__PURE__ */ new Map());
|
|
189385
|
+
function useConversationHit(itemId) {
|
|
189386
|
+
return reactExports.useContext(ConversationHitsContext).get(itemId);
|
|
189387
|
+
}
|
|
188910
189388
|
const isSession = (item) => item.source === SESSIONS_SOURCE_ID && item.id.startsWith(SESSION_ITEM_PREFIX);
|
|
189389
|
+
const isConversationHit = (item) => item.source === CONVERSATIONS_SOURCE_ID;
|
|
188911
189390
|
const isFile = (item) => item.source === FILES_SOURCE_ID && item.id.startsWith("file:") && item.id !== "file:go";
|
|
188912
189391
|
const paletteKeys = (spec) => /* @__PURE__ */ jsxRuntimeExports.jsx(KeyHint, { spec, size: "sm" });
|
|
188913
189392
|
function paletteVerbOf(row) {
|
|
188914
189393
|
if (isSession(row.item)) return "Switch to session";
|
|
189394
|
+
if (isConversationHit(row.item)) return "Open and find";
|
|
188915
189395
|
if (isFile(row.item)) return "Open file";
|
|
188916
189396
|
return void 0;
|
|
188917
189397
|
}
|
|
188918
189398
|
function renderPaletteRow(props) {
|
|
188919
|
-
|
|
189399
|
+
if (isSession(props.row.item)) return /* @__PURE__ */ jsxRuntimeExports.jsx(SessionPaletteRow, { ...props });
|
|
189400
|
+
if (isConversationHit(props.row.item)) return /* @__PURE__ */ jsxRuntimeExports.jsx(ConversationHitRow, { ...props });
|
|
189401
|
+
return void 0;
|
|
188920
189402
|
}
|
|
188921
189403
|
function renderPaletteIcon(row) {
|
|
188922
189404
|
const { item } = row;
|
|
@@ -188935,8 +189417,8 @@ const SessionPaletteRow = reactExports.memo(function SessionPaletteRow2(props) {
|
|
|
188935
189417
|
const { row, terms } = props;
|
|
188936
189418
|
const id2 = sessionKeyOfItem(row.item.id);
|
|
188937
189419
|
const status = SESSION_STATUS[useSessionDotState(id2)];
|
|
188938
|
-
const {
|
|
188939
|
-
const session =
|
|
189420
|
+
const { allSessions, activeSessionId } = useSessionsList();
|
|
189421
|
+
const session = allSessions.find((s2) => s2.id === id2);
|
|
188940
189422
|
const age = session ? ageString(session.updatedAt).replace(/ ago$/, "") : null;
|
|
188941
189423
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
188942
189424
|
PaletteOption,
|
|
@@ -188953,6 +189435,44 @@ const SessionPaletteRow = reactExports.memo(function SessionPaletteRow2(props) {
|
|
|
188953
189435
|
}
|
|
188954
189436
|
);
|
|
188955
189437
|
});
|
|
189438
|
+
function MarkedText({ text: text2, ranges: ranges2 }) {
|
|
189439
|
+
const out = [];
|
|
189440
|
+
let from2 = 0;
|
|
189441
|
+
for (const [start2, end2] of ranges2) {
|
|
189442
|
+
if (start2 > from2) out.push(text2.slice(from2, start2));
|
|
189443
|
+
out.push(
|
|
189444
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("mark", { className: "zg-palette-match", children: text2.slice(start2, end2) }, start2)
|
|
189445
|
+
);
|
|
189446
|
+
from2 = end2;
|
|
189447
|
+
}
|
|
189448
|
+
if (from2 < text2.length) out.push(text2.slice(from2));
|
|
189449
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: out });
|
|
189450
|
+
}
|
|
189451
|
+
const ConversationHitRow = reactExports.memo(function ConversationHitRow2(props) {
|
|
189452
|
+
const { row } = props;
|
|
189453
|
+
const target = conversationTargetOf(row.item.id);
|
|
189454
|
+
const hit = useConversationHit(row.item.id);
|
|
189455
|
+
const excerpt = row.item.description ?? "";
|
|
189456
|
+
const focused = focusExcerpt(excerpt, findTermRanges(excerpt, tokenizeQuery(target?.query ?? "")));
|
|
189457
|
+
const folder = row.item.keywords?.[0];
|
|
189458
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
189459
|
+
PaletteOption,
|
|
189460
|
+
{
|
|
189461
|
+
...props,
|
|
189462
|
+
icon: target ? /* @__PURE__ */ jsxRuntimeExports.jsx(SessionStatusDot, { sessionId: target.sessionId }) : void 0,
|
|
189463
|
+
title: row.item.title,
|
|
189464
|
+
description: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { "data-testid": "conversation-excerpt", children: /* @__PURE__ */ jsxRuntimeExports.jsx(MarkedText, { text: focused.text, ranges: focused.ranges }) }),
|
|
189465
|
+
trailing: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
189466
|
+
hit && hit.matchCount > 1 && /* @__PURE__ */ jsxRuntimeExports.jsxs(MetaChip, { children: [
|
|
189467
|
+
hit.matchCount,
|
|
189468
|
+
" matches"
|
|
189469
|
+
] }),
|
|
189470
|
+
folder && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "zg-meta max-w-[8rem] truncate", children: folder }),
|
|
189471
|
+
hit && /* @__PURE__ */ jsxRuntimeExports.jsx(MetaChip, { children: ageString(hit.updatedAt).replace(/ ago$/, "") })
|
|
189472
|
+
] })
|
|
189473
|
+
}
|
|
189474
|
+
);
|
|
189475
|
+
});
|
|
188956
189476
|
const NO_RECENTS = [];
|
|
188957
189477
|
function CommandPalette({ context }) {
|
|
188958
189478
|
const palette = usePalette();
|
|
@@ -188995,7 +189515,16 @@ function CommandPalette({ context }) {
|
|
|
188995
189515
|
const nested = stack.length > 0;
|
|
188996
189516
|
const levelRecents = nested ? NO_RECENTS : recents;
|
|
188997
189517
|
const { rows: ranked, settled: settled2 } = useRankedItems(items, query, levelRecents);
|
|
188998
|
-
const
|
|
189518
|
+
const { allSessions, archiveFilter } = useSessionsList();
|
|
189519
|
+
const listed = reactExports.useMemo(
|
|
189520
|
+
() => new Set(ranked.flatMap((r2) => r2.item.source === SESSIONS_SOURCE_ID ? [sessionKeyOfItem(r2.item.id)] : [])),
|
|
189521
|
+
[ranked]
|
|
189522
|
+
);
|
|
189523
|
+
const conversations2 = useConversationSearch(query, !nested, allSessions, archiveFilter, listed);
|
|
189524
|
+
const groups = reactExports.useMemo(() => {
|
|
189525
|
+
const sections = groupPaletteRows(ranked, query, levelRecents);
|
|
189526
|
+
return conversations2.rows.length > 0 ? [...sections, { title: CONVERSATIONS_GROUP, rows: conversations2.rows }] : sections;
|
|
189527
|
+
}, [ranked, query, levelRecents, conversations2.rows]);
|
|
188999
189528
|
const runRow = reactExports.useCallback(
|
|
189000
189529
|
async (row) => {
|
|
189001
189530
|
const item = row.item;
|
|
@@ -189013,7 +189542,8 @@ function CommandPalette({ context }) {
|
|
|
189013
189542
|
return;
|
|
189014
189543
|
}
|
|
189015
189544
|
setRunning(false);
|
|
189016
|
-
|
|
189545
|
+
const target = conversationTargetOf(item.id);
|
|
189546
|
+
if (!nested) markRecent(target ? sessionItemId(target.sessionId) : item.id);
|
|
189017
189547
|
if (!result) {
|
|
189018
189548
|
close2();
|
|
189019
189549
|
return;
|
|
@@ -189051,8 +189581,8 @@ function CommandPalette({ context }) {
|
|
|
189051
189581
|
setQuery("");
|
|
189052
189582
|
setCursor(0);
|
|
189053
189583
|
}, []);
|
|
189054
|
-
const placeholder = level?.placeholder ?? (nested ? void 0 : "Search actions, sessions, files and settings");
|
|
189055
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
189584
|
+
const placeholder = level?.placeholder ?? (nested ? void 0 : "Search actions, sessions, conversations, files and settings");
|
|
189585
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ConversationHitsContext.Provider, { value: conversations2.hits, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
189056
189586
|
PalettePanel,
|
|
189057
189587
|
{
|
|
189058
189588
|
groups,
|
|
@@ -189068,7 +189598,7 @@ function CommandPalette({ context }) {
|
|
|
189068
189598
|
placeholder,
|
|
189069
189599
|
settled: settled2,
|
|
189070
189600
|
loading: root2 === null && !nested,
|
|
189071
|
-
running: running2,
|
|
189601
|
+
running: running2 || conversations2.searching,
|
|
189072
189602
|
notice,
|
|
189073
189603
|
verb: paletteVerbOf,
|
|
189074
189604
|
renderRow: renderPaletteRow,
|
|
@@ -189076,7 +189606,7 @@ function CommandPalette({ context }) {
|
|
|
189076
189606
|
renderKeys: paletteKeys,
|
|
189077
189607
|
inputRef
|
|
189078
189608
|
}
|
|
189079
|
-
);
|
|
189609
|
+
) });
|
|
189080
189610
|
}
|
|
189081
189611
|
const ACTIONS = {
|
|
189082
189612
|
newSession: { title: "New session", group: "Session actions", icon: "i-ph-plus", keywords: ["create", "chat"] },
|
|
@@ -189612,13 +190142,14 @@ function PaletteHost({
|
|
|
189612
190142
|
handlers: handlers2,
|
|
189613
190143
|
busy: busy2,
|
|
189614
190144
|
openSettings,
|
|
189615
|
-
onRunSetup
|
|
190145
|
+
onRunSetup,
|
|
190146
|
+
onFindInConversation
|
|
189616
190147
|
}) {
|
|
189617
190148
|
const palette = usePalette();
|
|
189618
190149
|
const modal = useModal();
|
|
189619
190150
|
const panels = usePanels();
|
|
189620
190151
|
const {
|
|
189621
|
-
|
|
190152
|
+
allSessions,
|
|
189622
190153
|
activeSessionId,
|
|
189623
190154
|
setActiveSessionId,
|
|
189624
190155
|
defaultFolder,
|
|
@@ -189628,7 +190159,7 @@ function PaletteHost({
|
|
|
189628
190159
|
activeSpace,
|
|
189629
190160
|
setActiveSpace
|
|
189630
190161
|
} = useSessions();
|
|
189631
|
-
const active2 = activeSessionId ?
|
|
190162
|
+
const active2 = activeSessionId ? allSessions.find((s2) => s2.id === activeSessionId) : void 0;
|
|
189632
190163
|
const cwd2 = active2?.cwd ?? defaultFolder ?? void 0;
|
|
189633
190164
|
const approvals = useSafeModeQueue();
|
|
189634
190165
|
const interactions = useInteractions().pending;
|
|
@@ -189646,8 +190177,19 @@ function PaletteHost({
|
|
|
189646
190177
|
);
|
|
189647
190178
|
usePaletteSource(
|
|
189648
190179
|
reactExports.useMemo(
|
|
189649
|
-
() => sessionsSource(
|
|
189650
|
-
[
|
|
190180
|
+
() => sessionsSource(allSessions, activeSessionId, setActiveSessionId, rankOf),
|
|
190181
|
+
[allSessions, activeSessionId, setActiveSessionId, rankOf]
|
|
190182
|
+
)
|
|
190183
|
+
);
|
|
190184
|
+
const findInConversationRef = reactExports.useRef(onFindInConversation);
|
|
190185
|
+
findInConversationRef.current = onFindInConversation;
|
|
190186
|
+
usePaletteSource(
|
|
190187
|
+
reactExports.useMemo(
|
|
190188
|
+
() => conversationsSource((target) => {
|
|
190189
|
+
setActiveSessionId(target.sessionId);
|
|
190190
|
+
findInConversationRef.current(target);
|
|
190191
|
+
}),
|
|
190192
|
+
[setActiveSessionId]
|
|
189651
190193
|
)
|
|
189652
190194
|
);
|
|
189653
190195
|
usePaletteSource(reactExports.useMemo(() => actionsSource(handlers2), [handlers2]));
|
|
@@ -190040,7 +190582,7 @@ function App({ appearanceFirstRun: appearanceFirstRun2 = false }) {
|
|
|
190040
190582
|
function AppShell({ appearanceFirstRun: appearanceFirstRun2 }) {
|
|
190041
190583
|
useNativeChromeZoomVar();
|
|
190042
190584
|
const {
|
|
190043
|
-
|
|
190585
|
+
allSessions,
|
|
190044
190586
|
activeSessionId,
|
|
190045
190587
|
setActiveSessionId,
|
|
190046
190588
|
defaultFolder,
|
|
@@ -190065,7 +190607,8 @@ function AppShell({ appearanceFirstRun: appearanceFirstRun2 }) {
|
|
|
190065
190607
|
null
|
|
190066
190608
|
);
|
|
190067
190609
|
const hasAuth = useProviderReady();
|
|
190068
|
-
const [
|
|
190610
|
+
const [transcriptSearch, setTranscriptSearch] = reactExports.useState(null);
|
|
190611
|
+
const transcriptSearchOpen = transcriptSearch !== null && transcriptSearch.sessionId === activeSessionId;
|
|
190069
190612
|
const [windowSidebarCollapsed, setWindowSidebarCollapsed] = usePersistedState(
|
|
190070
190613
|
"zg-sidebar-collapsed",
|
|
190071
190614
|
false,
|
|
@@ -190078,8 +190621,9 @@ function AppShell({ appearanceFirstRun: appearanceFirstRun2 }) {
|
|
|
190078
190621
|
);
|
|
190079
190622
|
const lightsInCenter = sidebarCollapsed;
|
|
190080
190623
|
const activeSession = reactExports.useMemo(
|
|
190081
|
-
|
|
190082
|
-
|
|
190624
|
+
// Every loaded session: the palette can open one the sidebar's filters hide.
|
|
190625
|
+
() => allSessions.find((s2) => s2.id === activeSessionId) ?? null,
|
|
190626
|
+
[allSessions, activeSessionId]
|
|
190083
190627
|
);
|
|
190084
190628
|
const pinnedTitle = standalone ? activeSession?.title : void 0;
|
|
190085
190629
|
reactExports.useEffect(() => {
|
|
@@ -190372,15 +190916,20 @@ function AppShell({ appearanceFirstRun: appearanceFirstRun2 }) {
|
|
|
190372
190916
|
return;
|
|
190373
190917
|
}
|
|
190374
190918
|
e2.preventDefault();
|
|
190375
|
-
|
|
190919
|
+
const sessionId = activeSession.id;
|
|
190920
|
+
setTranscriptSearch((open) => open?.sessionId === sessionId ? open : { sessionId, query: "" });
|
|
190376
190921
|
}
|
|
190377
190922
|
window.addEventListener("keydown", onKey2);
|
|
190378
190923
|
return () => window.removeEventListener("keydown", onKey2);
|
|
190379
190924
|
}, [activeSession, modalIsOpen]);
|
|
190380
190925
|
reactExports.useEffect(() => {
|
|
190381
|
-
|
|
190382
|
-
}, [activeSessionId]);
|
|
190383
|
-
const closeTranscriptSearch = reactExports.useCallback(() =>
|
|
190926
|
+
if (transcriptSearch && transcriptSearch.sessionId !== activeSessionId) setTranscriptSearch(null);
|
|
190927
|
+
}, [activeSessionId, transcriptSearch]);
|
|
190928
|
+
const closeTranscriptSearch = reactExports.useCallback(() => setTranscriptSearch(null), []);
|
|
190929
|
+
const findInConversation = reactExports.useCallback(
|
|
190930
|
+
({ sessionId, query }) => setTranscriptSearch({ sessionId, query }),
|
|
190931
|
+
[]
|
|
190932
|
+
);
|
|
190384
190933
|
const openModelPicker = reactExports.useCallback(() => {
|
|
190385
190934
|
if (!activeSession) {
|
|
190386
190935
|
return;
|
|
@@ -190713,7 +191262,8 @@ function AppShell({ appearanceFirstRun: appearanceFirstRun2 }) {
|
|
|
190713
191262
|
handlers: handlers2,
|
|
190714
191263
|
busy: running2,
|
|
190715
191264
|
openSettings,
|
|
190716
|
-
onRunSetup: () => openOnboarding("rerun")
|
|
191265
|
+
onRunSetup: () => openOnboarding("rerun"),
|
|
191266
|
+
onFindInConversation: findInConversation
|
|
190717
191267
|
}
|
|
190718
191268
|
) }),
|
|
190719
191269
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { region: "Browser", resetKey: regionKey, fallback: null, children: /* @__PURE__ */ jsxRuntimeExports.jsx(BrowserHost, {}) }),
|
|
@@ -190745,6 +191295,7 @@ function AppShell({ appearanceFirstRun: appearanceFirstRun2 }) {
|
|
|
190745
191295
|
onOpenRunningWork: openRunningWorkFor,
|
|
190746
191296
|
lightsInCenter,
|
|
190747
191297
|
searchOpen: transcriptSearchOpen,
|
|
191298
|
+
searchQuery: transcriptSearch?.query,
|
|
190748
191299
|
onCloseSearch: closeTranscriptSearch,
|
|
190749
191300
|
onOpenEnvironmentSettings: openEnvironmentSettings
|
|
190750
191301
|
}
|