litepaseo 0.8.0 → 0.9.0
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/CHANGELOG.md +11 -0
- package/README.md +16 -8
- package/dist/server/cli.mjs +2 -2
- package/dist/server/{worker-CFb51N-2.mjs → worker-CmsAgviJ.mjs} +73 -12
- package/dist/web/assets/ChangesPanel-DdtJswMt.js +2 -0
- package/dist/web/assets/ChangesPanel-DdtJswMt.js.br +0 -0
- package/dist/web/assets/ChangesPanel-DdtJswMt.js.gz +0 -0
- package/dist/web/assets/CodeBlockNode-BOeBLCjf.js +3 -0
- package/dist/web/assets/CodeBlockNode-BOeBLCjf.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-BOeBLCjf.js.gz +0 -0
- package/dist/web/assets/ConversationSearch-BXfGhrtx.js +1 -0
- package/dist/web/assets/ConversationSearch-BXfGhrtx.js.br +0 -0
- package/dist/web/assets/ConversationSearch-BXfGhrtx.js.gz +0 -0
- package/dist/web/assets/FileViewer-C93qu9YH.js +2 -0
- package/dist/web/assets/FileViewer-C93qu9YH.js.br +0 -0
- package/dist/web/assets/FileViewer-C93qu9YH.js.gz +0 -0
- package/dist/web/assets/FilesPanel-DyqtBDO_.js +1 -0
- package/dist/web/assets/FilesPanel-DyqtBDO_.js.br +0 -0
- package/dist/web/assets/FilesPanel-DyqtBDO_.js.gz +0 -0
- package/dist/web/assets/HostSettings-BCsvyF_3.js +5 -0
- package/dist/web/assets/HostSettings-BCsvyF_3.js.br +0 -0
- package/dist/web/assets/HostSettings-BCsvyF_3.js.gz +0 -0
- package/dist/web/assets/MarkdownMessage-CejBvgRc.js +199 -0
- package/dist/web/assets/MarkdownMessage-CejBvgRc.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-CejBvgRc.js.gz +0 -0
- package/dist/web/assets/{PreCodeBlock-BoklyLrw.js → PreCodeBlock-BBTzkaAH.js} +1 -1
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-4BQzC8nU.js +1 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-4BQzC8nU.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-4BQzC8nU.js.gz +0 -0
- package/dist/web/assets/SubagentsPanel-D1bEm5QC.js +1 -0
- package/dist/web/assets/SubagentsPanel-D1bEm5QC.js.br +0 -0
- package/dist/web/assets/SubagentsPanel-D1bEm5QC.js.gz +0 -0
- package/dist/web/assets/TerminalPanel-wazWBZjN.js +3 -0
- package/dist/web/assets/TerminalPanel-wazWBZjN.js.br +0 -0
- package/dist/web/assets/TerminalPanel-wazWBZjN.js.gz +0 -0
- package/dist/web/assets/Tooltip-CrG6tFax.js +1 -0
- package/dist/web/assets/Tooltip-CrG6tFax.js.br +0 -0
- package/dist/web/assets/Tooltip-CrG6tFax.js.gz +0 -0
- package/dist/web/assets/index-Cmpdc3EH.js +35 -0
- package/dist/web/assets/index-Cmpdc3EH.js.br +0 -0
- package/dist/web/assets/index-Cmpdc3EH.js.gz +0 -0
- package/dist/web/assets/index10-C9Xw5wOS.js +6 -0
- package/dist/web/assets/index10-C9Xw5wOS.js.br +0 -0
- package/dist/web/assets/index10-C9Xw5wOS.js.gz +0 -0
- package/dist/web/assets/index3-dduGUVTy.js +1 -0
- package/dist/web/assets/index4-qdeznE4u.js +1 -0
- package/dist/web/assets/index5-Cxc_iCM3.js +1 -0
- package/dist/web/assets/index5-Cxc_iCM3.js.br +0 -0
- package/dist/web/assets/index5-Cxc_iCM3.js.gz +0 -0
- package/dist/web/assets/index6-DsTT-iog.js +1 -0
- package/dist/web/assets/index6-DsTT-iog.js.br +0 -0
- package/dist/web/assets/index6-DsTT-iog.js.gz +0 -0
- package/dist/web/assets/index7-Bgw61c0t.js +2 -0
- package/dist/web/assets/index7-Bgw61c0t.js.br +0 -0
- package/dist/web/assets/index7-Bgw61c0t.js.gz +0 -0
- package/dist/web/assets/index8-DLEM8iM5.js +2 -0
- package/dist/web/assets/index8-DLEM8iM5.js.br +0 -0
- package/dist/web/assets/index8-DLEM8iM5.js.gz +0 -0
- package/dist/web/assets/index9-CUy1AFI-.js +1 -0
- package/dist/web/assets/index9-CUy1AFI-.js.br +0 -0
- package/dist/web/assets/index9-CUy1AFI-.js.gz +0 -0
- package/dist/web/assets/vue.runtime.esm-bundler-4XjPOHMM.js +4 -0
- package/dist/web/assets/vue.runtime.esm-bundler-4XjPOHMM.js.br +0 -0
- package/dist/web/assets/vue.runtime.esm-bundler-4XjPOHMM.js.gz +0 -0
- package/dist/web/index.html +2 -2
- package/dist/web/index.html.br +0 -0
- package/dist/web/index.html.gz +0 -0
- package/package.json +1 -1
- package/dist/web/assets/ChangesPanel-BlSVs9IZ.js +0 -2
- package/dist/web/assets/ChangesPanel-BlSVs9IZ.js.br +0 -0
- package/dist/web/assets/ChangesPanel-BlSVs9IZ.js.gz +0 -0
- package/dist/web/assets/CodeBlockNode-CaXaKazH.js +0 -3
- package/dist/web/assets/CodeBlockNode-CaXaKazH.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-CaXaKazH.js.gz +0 -0
- package/dist/web/assets/ConversationSearch-y9eWywB5.js +0 -1
- package/dist/web/assets/ConversationSearch-y9eWywB5.js.br +0 -0
- package/dist/web/assets/ConversationSearch-y9eWywB5.js.gz +0 -0
- package/dist/web/assets/FileViewer-BqUwuFz5.js +0 -2
- package/dist/web/assets/FileViewer-BqUwuFz5.js.br +0 -0
- package/dist/web/assets/FileViewer-BqUwuFz5.js.gz +0 -0
- package/dist/web/assets/FilesPanel-D1VnWV0v.js +0 -1
- package/dist/web/assets/FilesPanel-D1VnWV0v.js.br +0 -0
- package/dist/web/assets/FilesPanel-D1VnWV0v.js.gz +0 -0
- package/dist/web/assets/HostSettings-CS8WUZFq.js +0 -5
- package/dist/web/assets/HostSettings-CS8WUZFq.js.br +0 -0
- package/dist/web/assets/HostSettings-CS8WUZFq.js.gz +0 -0
- package/dist/web/assets/MarkdownMessage-De-SfrGN.js +0 -199
- package/dist/web/assets/MarkdownMessage-De-SfrGN.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-De-SfrGN.js.gz +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-YIH3qNv0.js +0 -1
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-YIH3qNv0.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-YIH3qNv0.js.gz +0 -0
- package/dist/web/assets/SubagentsPanel-DDNeI4kF.js +0 -1
- package/dist/web/assets/SubagentsPanel-DDNeI4kF.js.br +0 -0
- package/dist/web/assets/SubagentsPanel-DDNeI4kF.js.gz +0 -0
- package/dist/web/assets/TerminalPanel-BNiO8y4X.js +0 -3
- package/dist/web/assets/TerminalPanel-BNiO8y4X.js.br +0 -0
- package/dist/web/assets/TerminalPanel-BNiO8y4X.js.gz +0 -0
- package/dist/web/assets/Tooltip-DW5DjEkp.js +0 -1
- package/dist/web/assets/Tooltip-DW5DjEkp.js.br +0 -0
- package/dist/web/assets/Tooltip-DW5DjEkp.js.gz +0 -0
- package/dist/web/assets/index-Cvb6bO2l.js +0 -35
- package/dist/web/assets/index-Cvb6bO2l.js.br +0 -0
- package/dist/web/assets/index-Cvb6bO2l.js.gz +0 -0
- package/dist/web/assets/index10-HE3YKxWe.js +0 -6
- package/dist/web/assets/index10-HE3YKxWe.js.br +0 -0
- package/dist/web/assets/index10-HE3YKxWe.js.gz +0 -0
- package/dist/web/assets/index3-DGhUvPvG.js +0 -1
- package/dist/web/assets/index4-8S_uvaZW.js +0 -1
- package/dist/web/assets/index5-D_Gw1TcQ.js +0 -1
- package/dist/web/assets/index5-D_Gw1TcQ.js.br +0 -0
- package/dist/web/assets/index5-D_Gw1TcQ.js.gz +0 -0
- package/dist/web/assets/index6-C5JVVCiu.js +0 -1
- package/dist/web/assets/index6-C5JVVCiu.js.br +0 -0
- package/dist/web/assets/index6-C5JVVCiu.js.gz +0 -0
- package/dist/web/assets/index7-DuLrtgHQ.js +0 -2
- package/dist/web/assets/index7-DuLrtgHQ.js.br +0 -0
- package/dist/web/assets/index7-DuLrtgHQ.js.gz +0 -0
- package/dist/web/assets/index8-BIK4cA-n.js +0 -2
- package/dist/web/assets/index8-BIK4cA-n.js.br +0 -0
- package/dist/web/assets/index8-BIK4cA-n.js.gz +0 -0
- package/dist/web/assets/index9-VNQ82Mso.js +0 -1
- package/dist/web/assets/index9-VNQ82Mso.js.br +0 -0
- package/dist/web/assets/index9-VNQ82Mso.js.gz +0 -0
- package/dist/web/assets/vue.runtime.esm-bundler-DwGo9CTz.js +0 -4
- package/dist/web/assets/vue.runtime.esm-bundler-DwGo9CTz.js.br +0 -0
- package/dist/web/assets/vue.runtime.esm-bundler-DwGo9CTz.js.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
- Switch back to a conversation you opened recently and it shows at once, where you left it: the last 5 conversations (3 on phones) stay rendered. Out of view they do nothing: no connection, no timers, no rendering. Coming back, only messages that changed meanwhile render again. In a test switching between real conversations at 4x CPU slowdown (an approximation of a phone), rows were on screen in 162-196 ms instead of 340-384 ms, using less than half the CPU.
|
|
6
|
+
- Coming back to a conversation, or to the tab after it was in the background, downloads only what changed instead of the latest 200 rows again: in the same test, 0.1-0.4 KB instead of 175 KB. The server keeps a conversation ready for 5 minutes after the last viewer leaves (was 30 seconds), so coming back within that time does not reload it from the host.
|
|
7
|
+
- Next-input suggestions stay with their conversation: switching away and back keeps the Tab completion, and a suggestion that arrives after you switched no longer lands in another conversation's composer.
|
|
8
|
+
|
|
9
|
+
## 0.8.1
|
|
10
|
+
|
|
11
|
+
- Fix conversations that sometimes took about 20 seconds to load behind a Cloudflare Tunnel, showing "Waiting for the host to load this conversation". The host had answered at once; the tunnel held the stream's latest bytes until more arrived, which for an idle conversation was the next 20-second heartbeat. Each burst of live updates is now followed by a few bytes of padding, which pushes it through. This applies to every live stream, including the sidebar and queues.
|
|
12
|
+
- A conversation that waits for data the network has not delivered now says so ("Connected, waiting for the network to deliver data") instead of blaming the host: the page counts the stream as connected only once its first bytes arrive, not when the response headers do. Slow-open reports add `firstByteMs`.
|
|
13
|
+
|
|
3
14
|
## 0.8.0
|
|
4
15
|
|
|
5
16
|
- Refresh a host's model lists from its settings: the Paseo daemon caches each provider's models until asked, so a newly released model (such as a new Codex model) stayed hidden in new sessions and profiles. Providers now show how many models they report and when the list was fetched, with "Refresh models" for every provider or one at a time; the result names any new models found.
|
package/README.md
CHANGED
|
@@ -37,12 +37,14 @@ battery runtime has not been measured.
|
|
|
37
37
|
latency, rendering differences, raw data and reproduction steps.
|
|
38
38
|
|
|
39
39
|
The approach is simple: update less often, send only changes, keep rendered history
|
|
40
|
-
bounded, and pause streams while a tab is hidden.
|
|
41
|
-
|
|
40
|
+
bounded, and pause streams while a tab is hidden. Recently opened conversations stay
|
|
41
|
+
rendered but idle, so switching back costs neither a re-render nor a re-download.
|
|
42
|
+
Everything ships in one npm package, with no separate database service to deploy.
|
|
42
43
|
|
|
43
44
|
## What you can do
|
|
44
45
|
|
|
45
46
|
- Manage conversations across multiple Paseo hosts in one place.
|
|
47
|
+
- Switch back and forth between recent conversations instantly: each one comes back as you left it, scrolled to the same place, and fetches only what changed meanwhile.
|
|
46
48
|
- Pin projects from their ⋮ menu to keep important repositories at the top of the Projects sidebar. Pins follow pin order and sync across devices; Unpin restores activity ordering.
|
|
47
49
|
- Create sessions, choose a provider/model, send messages, stop turns, and answer
|
|
48
50
|
permission requests or structured questions.
|
|
@@ -276,15 +278,21 @@ A conversation that takes more than 3 seconds to show is logged, without its con
|
|
|
276
278
|
`timeline_slow` is the server's side: the daemon subscription (`subscribeMs`), the
|
|
277
279
|
daemon's history read (`fetchMs`; a closed agent is resumed from disk first), and retries
|
|
278
280
|
(`attempts`, `failures`). `timeline_slow_client` is the browser's side: when the stream
|
|
279
|
-
connected (`connectedMs`), when
|
|
280
|
-
rendering (`renderMs`), and how long the
|
|
281
|
-
(`backgroundMs`, `visibleForMs`). A late
|
|
282
|
-
means the request took that long to reach
|
|
283
|
-
reused after sleep or a network change.
|
|
281
|
+
connected (`connectedMs`), when its first bytes arrived (`firstByteMs`), when rows
|
|
282
|
+
arrived (`rowsMs`; `null` if you left first), rendering (`renderMs`), and how long the
|
|
283
|
+
page had just been in the background (`backgroundMs`, `visibleForMs`). A late
|
|
284
|
+
`connectedMs` with no matching `timeline_slow` means the request took that long to reach
|
|
285
|
+
the server, typically a connection the browser reused after sleep or a network change. A
|
|
286
|
+
late `firstByteMs` after an early `connectedMs` means something in between, such as a
|
|
287
|
+
proxy or tunnel, held the data. Find them with
|
|
284
288
|
`litepaseo logs -n 2000 | grep timeline_slow`.
|
|
285
289
|
|
|
286
290
|
While a conversation is still loading after 3 seconds, the page says whether it is still
|
|
287
|
-
connecting to LitePaseo
|
|
291
|
+
connecting to LitePaseo, waiting for the network to deliver data, or waiting for the host.
|
|
292
|
+
|
|
293
|
+
Some proxies hold a stream's latest bytes until more arrive. LitePaseo follows each burst
|
|
294
|
+
of live updates with a few bytes of padding, so they get through without waiting for the
|
|
295
|
+
next heartbeat. After an upgrade, open pages offer a
|
|
288
296
|
reload so they run the installed version.
|
|
289
297
|
|
|
290
298
|
## How it fits together
|
package/dist/server/cli.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { DatabaseSync } from "node:sqlite";
|
|
|
8
8
|
import { homedir } from "node:os";
|
|
9
9
|
import { fileURLToPath } from "node:url";
|
|
10
10
|
// src/server/version.ts
|
|
11
|
-
const VERSION = "0.
|
|
11
|
+
const VERSION = "0.9.0";
|
|
12
12
|
// src/server/rotating-log.ts
|
|
13
13
|
/** One writer (the supervisor); bounded active file plus numbered archives. */
|
|
14
14
|
var RotatingLog = class {
|
|
@@ -1715,7 +1715,7 @@ async function run() {
|
|
|
1715
1715
|
if (name === "--help" || name === "-h") return console.log(mainHelp(VERSION, displayDirectory(), out));
|
|
1716
1716
|
if (name === "worker") {
|
|
1717
1717
|
const paths = await dataDirectory();
|
|
1718
|
-
const { runWorker } = await import("./worker-
|
|
1718
|
+
const { runWorker } = await import("./worker-CmsAgviJ.mjs");
|
|
1719
1719
|
return runWorker(paths.directory, fileURLToPath(new URL("../web/", import.meta.url)));
|
|
1720
1720
|
}
|
|
1721
1721
|
const command = findCommand(name);
|
|
@@ -650,6 +650,11 @@ var TimelineView = class {
|
|
|
650
650
|
lastSeq = -1;
|
|
651
651
|
hasOlder = false;
|
|
652
652
|
startCursor = null;
|
|
653
|
+
/**
|
|
654
|
+
* The view knows every row changed after this seq, so a browser holding everything up to it
|
|
655
|
+
* can resume with just those rows. Set by each load; raised when rows are trimmed.
|
|
656
|
+
*/
|
|
657
|
+
resumeFloor = Number.POSITIVE_INFINITY;
|
|
653
658
|
/** True while rows reach back to the first projected row, so unseen identities are new. */
|
|
654
659
|
complete = false;
|
|
655
660
|
state = "loading";
|
|
@@ -718,10 +723,17 @@ var TimelineView = class {
|
|
|
718
723
|
this.subscription = null;
|
|
719
724
|
return released;
|
|
720
725
|
}
|
|
721
|
-
|
|
726
|
+
/**
|
|
727
|
+
* Adds a browser. A live view answers at once: with the rows changed since `since` when the
|
|
728
|
+
* browser holds this conversation up to a point the view can resume from (nothing when none
|
|
729
|
+
* changed), else with a reset. A loading view sends its reset once loaded.
|
|
730
|
+
*/
|
|
731
|
+
watch(watcher, since) {
|
|
722
732
|
if (this.state === "live" || this.state === "catching-up") {
|
|
723
733
|
this.flush();
|
|
724
|
-
|
|
734
|
+
const resumed = since ? this.resumeOps(since) : null;
|
|
735
|
+
if (!resumed) watcher([this.resetOp()]);
|
|
736
|
+
else if (resumed.length) watcher(resumed);
|
|
725
737
|
} else if (this.watchers.size) this.joiners.push(now());
|
|
726
738
|
this.watchers.add(watcher);
|
|
727
739
|
return () => this.watchers.delete(watcher);
|
|
@@ -906,6 +918,7 @@ var TimelineView = class {
|
|
|
906
918
|
this.pending.clear();
|
|
907
919
|
this.epoch = page.epoch;
|
|
908
920
|
this.lastSeq = page.window.maxSeq;
|
|
921
|
+
this.resumeFloor = this.lastSeq;
|
|
909
922
|
this.hasOlder = page.hasOlder;
|
|
910
923
|
this.startCursor = page.startCursor;
|
|
911
924
|
this.complete = !page.hasOlder;
|
|
@@ -962,6 +975,7 @@ var TimelineView = class {
|
|
|
962
975
|
trim() {
|
|
963
976
|
const removed = this.rows.splice(0, this.rows.length - KEEP_ROWS);
|
|
964
977
|
for (const row of removed) {
|
|
978
|
+
this.resumeFloor = Math.max(this.resumeFloor, row.seqEnd);
|
|
965
979
|
this.bySeqStart.delete(row.seqStart);
|
|
966
980
|
this.pending.delete(row.seqStart);
|
|
967
981
|
const identity = timelineItemIdentity(row.item);
|
|
@@ -975,7 +989,7 @@ var TimelineView = class {
|
|
|
975
989
|
};
|
|
976
990
|
}
|
|
977
991
|
mark(seqStart, full, text = "") {
|
|
978
|
-
if (this.pendingReset) return;
|
|
992
|
+
if (this.pendingReset || !this.watchers.size) return;
|
|
979
993
|
const pending = this.pending.get(seqStart);
|
|
980
994
|
if (!pending) this.pending.set(seqStart, {
|
|
981
995
|
full,
|
|
@@ -1019,6 +1033,20 @@ var TimelineView = class {
|
|
|
1019
1033
|
this.pending.clear();
|
|
1020
1034
|
if (ops.length) this.broadcast(ops);
|
|
1021
1035
|
}
|
|
1036
|
+
/**
|
|
1037
|
+
* The rows a returning browser lacks: those from its window on that changed after `since.seq`,
|
|
1038
|
+
* as upserts. Null when the view cannot tell (another epoch, history it no longer holds) or
|
|
1039
|
+
* when so much changed that a reset is the smaller answer.
|
|
1040
|
+
*/
|
|
1041
|
+
resumeOps(since) {
|
|
1042
|
+
if (since.epoch !== this.epoch || since.seq < this.resumeFloor || since.seq > this.lastSeq) return null;
|
|
1043
|
+
const changed = this.rows.filter((row) => row.seqEnd > since.seq && row.seqStart >= since.from);
|
|
1044
|
+
if (changed.length > RESET_ROWS) return null;
|
|
1045
|
+
return changed.map((row) => ({
|
|
1046
|
+
type: "upsert",
|
|
1047
|
+
row: { ...row }
|
|
1048
|
+
}));
|
|
1049
|
+
}
|
|
1022
1050
|
resetOp() {
|
|
1023
1051
|
const start = Math.max(0, this.rows.length - RESET_ROWS);
|
|
1024
1052
|
const rows = this.rows.slice(start).map((row) => ({ ...row }));
|
|
@@ -1030,7 +1058,8 @@ var TimelineView = class {
|
|
|
1030
1058
|
startCursor: start > 0 ? {
|
|
1031
1059
|
epoch: this.epoch,
|
|
1032
1060
|
seq: rows[0].seqStart
|
|
1033
|
-
} : this.startCursor
|
|
1061
|
+
} : this.startCursor,
|
|
1062
|
+
seq: this.lastSeq
|
|
1034
1063
|
};
|
|
1035
1064
|
}
|
|
1036
1065
|
/** The first rows went out: report how long the view, and anyone who joined it, waited. */
|
|
@@ -1358,8 +1387,12 @@ var UnknownHostError = class extends Error {
|
|
|
1358
1387
|
super("Unknown host");
|
|
1359
1388
|
}
|
|
1360
1389
|
};
|
|
1361
|
-
/**
|
|
1362
|
-
|
|
1390
|
+
/**
|
|
1391
|
+
* Idle grace before an unwatched timeline releases its daemon subscription. Browsers keep
|
|
1392
|
+
* recently opened conversations and come back to them; while the view lives, coming back
|
|
1393
|
+
* costs only the rows that changed meanwhile, not a reload from the daemon.
|
|
1394
|
+
*/
|
|
1395
|
+
const TIMELINE_GRACE_MS = 3e5;
|
|
1363
1396
|
/** Conversation opens slower than this are logged with a per-layer breakdown. */
|
|
1364
1397
|
const SLOW_TIMELINE_MS = 3e3;
|
|
1365
1398
|
/** A viewer still without rows after this long has the daemon checked for a silent connection. */
|
|
@@ -1520,9 +1553,10 @@ var Hosts = class {
|
|
|
1520
1553
|
}
|
|
1521
1554
|
/**
|
|
1522
1555
|
* Shares one live timeline per agent across all watching browsers. With `subagentId`, the
|
|
1523
|
-
* conversation of one of the agent's provider subagents.
|
|
1556
|
+
* conversation of one of the agent's provider subagents. With `since`, a browser that holds
|
|
1557
|
+
* the conversation resumes with what changed (see TimelineView.watch).
|
|
1524
1558
|
*/
|
|
1525
|
-
watchTimeline(hostId, agentId, watcher, subagentId) {
|
|
1559
|
+
watchTimeline(hostId, agentId, watcher, subagentId, since) {
|
|
1526
1560
|
const client = this.get(hostId);
|
|
1527
1561
|
const key = subagentId ? `${hostId}:${agentId}:subagent:${subagentId}` : `${hostId}:${agentId}`;
|
|
1528
1562
|
let entry = this.timelines.get(key);
|
|
@@ -1579,7 +1613,8 @@ var Hosts = class {
|
|
|
1579
1613
|
const stop = entry.view.watch((ops) => {
|
|
1580
1614
|
if (waiting && ops.some((op) => op.type === "reset")) finishWait(false);
|
|
1581
1615
|
watcher(ops);
|
|
1582
|
-
});
|
|
1616
|
+
}, since);
|
|
1617
|
+
if (joined.state === "live" || joined.state === "catching-up") finishWait(false);
|
|
1583
1618
|
const current = entry;
|
|
1584
1619
|
return () => {
|
|
1585
1620
|
finishWait(true);
|
|
@@ -2373,25 +2408,44 @@ var ServerSendQueue = class {
|
|
|
2373
2408
|
};
|
|
2374
2409
|
// src/server/sse.ts
|
|
2375
2410
|
const HEARTBEAT_MS = 2e4;
|
|
2411
|
+
/**
|
|
2412
|
+
* Some proxies hold a stream's latest bytes until more arrive: behind a Cloudflare Tunnel, a
|
|
2413
|
+
* conversation's rows reached the browser only with the next heartbeat, 20 s later. So every
|
|
2414
|
+
* burst of writes is followed by a tiny comment, which pushes it through.
|
|
2415
|
+
*/
|
|
2416
|
+
const NUDGE_MS = 50;
|
|
2376
2417
|
/** Server-sent events over a plain fetch response, so the bearer header still authenticates. */
|
|
2377
2418
|
function eventStream(signal, open, valid = () => true) {
|
|
2378
2419
|
const encoder = new TextEncoder();
|
|
2379
2420
|
let cleanup;
|
|
2421
|
+
let nudge;
|
|
2422
|
+
let stopped = false;
|
|
2380
2423
|
const stop = () => {
|
|
2424
|
+
stopped = true;
|
|
2425
|
+
clearTimeout(nudge);
|
|
2381
2426
|
cleanup?.();
|
|
2382
2427
|
cleanup = void 0;
|
|
2383
2428
|
};
|
|
2384
2429
|
const body = new ReadableStream({
|
|
2385
2430
|
start(controller) {
|
|
2386
|
-
const
|
|
2431
|
+
const enqueue = (text) => {
|
|
2432
|
+
if (stopped) return;
|
|
2387
2433
|
try {
|
|
2388
2434
|
controller.enqueue(encoder.encode(text));
|
|
2389
2435
|
} catch {
|
|
2390
2436
|
stop();
|
|
2391
2437
|
}
|
|
2392
2438
|
};
|
|
2439
|
+
const write = (text) => {
|
|
2440
|
+
enqueue(text);
|
|
2441
|
+
if (stopped || nudge) return;
|
|
2442
|
+
nudge = setTimeout(() => {
|
|
2443
|
+
nudge = void 0;
|
|
2444
|
+
enqueue(":\n\n");
|
|
2445
|
+
}, NUDGE_MS);
|
|
2446
|
+
};
|
|
2393
2447
|
const heartbeat = setInterval(() => {
|
|
2394
|
-
if (valid()) return
|
|
2448
|
+
if (valid()) return enqueue(": ping\n\n");
|
|
2395
2449
|
stop();
|
|
2396
2450
|
try {
|
|
2397
2451
|
controller.close();
|
|
@@ -2403,6 +2457,7 @@ function eventStream(signal, open, valid = () => true) {
|
|
|
2403
2457
|
clearInterval(heartbeat);
|
|
2404
2458
|
close();
|
|
2405
2459
|
};
|
|
2460
|
+
if (stopped) stop();
|
|
2406
2461
|
signal.addEventListener("abort", () => {
|
|
2407
2462
|
stop();
|
|
2408
2463
|
try {
|
|
@@ -4405,6 +4460,7 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
4405
4460
|
connectedMs: ms,
|
|
4406
4461
|
rowsMs: ms,
|
|
4407
4462
|
renderMs: ms,
|
|
4463
|
+
firstByteMs: ms.optional(),
|
|
4408
4464
|
attempts: z.number().int().nonnegative().max(1e3),
|
|
4409
4465
|
hidden: z.boolean(),
|
|
4410
4466
|
pageAgeMs: long.optional(),
|
|
@@ -4564,6 +4620,11 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
4564
4620
|
});
|
|
4565
4621
|
app.get("/api/hosts/:host/agents/:agent/timeline/stream", (c) => {
|
|
4566
4622
|
hosts.get(c.req.param("host"));
|
|
4623
|
+
const since = z.object({
|
|
4624
|
+
epoch: z.string().min(1).max(200),
|
|
4625
|
+
seq: z.coerce.number().int().nonnegative(),
|
|
4626
|
+
from: z.coerce.number().int().nonnegative()
|
|
4627
|
+
}).safeParse(c.req.query());
|
|
4567
4628
|
return eventStream(c.req.raw.signal, (send) => {
|
|
4568
4629
|
const stop = hosts.watchTimeline(c.req.param("host"), c.req.param("agent"), (ops) => send({
|
|
4569
4630
|
type: "ops",
|
|
@@ -4580,7 +4641,7 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
4580
4641
|
row: enrich(op.row)
|
|
4581
4642
|
} : op;
|
|
4582
4643
|
})
|
|
4583
|
-
}));
|
|
4644
|
+
}), void 0, since.success ? since.data : void 0);
|
|
4584
4645
|
let sent = "";
|
|
4585
4646
|
let stopSubagents = () => {};
|
|
4586
4647
|
try {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{I as e,R as t,S as n,T as r,V as i,at as a,ct as o,f as s,g as c,q as l,tt as u,v as d,y as f}from"./vue.runtime.esm-bundler-4XjPOHMM.js";import{p}from"./index-Cmpdc3EH.js";var m={class:`changes-panel`},h=[`disabled`],g={key:0,role:`alert`},_={key:1},v={key:2},y=[`onToggle`],b=[`onClick`],x={key:0},S={key:1},C={class:`hunk`},w=p(r({__name:`ChangesPanel`,props:{hostId:{},cwd:{},api:{type:Function}},setup(r){let p=r,w=u([]),T=u(``),E=u(!1),D=u(!1),O=0,k=u(new Set);e(()=>O++);async function A(){let e=++O;E.value=!0,T.value=``,w.value=[],D.value=!1,k.value=new Set;try{let t=await p.api(`/hosts/${encodeURIComponent(p.hostId)}/changes?cwd=${encodeURIComponent(p.cwd)}`);if(e!==O)return;w.value=t.files,D.value=!!t.diffTooLarge}catch(t){e===O&&(T.value=t.message)}finally{e===O&&(E.value=!1)}}async function j(e){try{await navigator.clipboard.writeText(e)}catch{T.value=`Could not copy path.`}}return l(()=>[p.hostId,p.cwd],()=>{w.value=[],A()},{immediate:!0}),(e,r)=>(t(),f(`section`,m,[r[0]||=c(`p`,null,`Workspace uncommitted changes · includes changes from all contributors.`,-1),c(`button`,{class:`btn`,disabled:E.value,onClick:A},o(E.value?`Loading…`:`Refresh changes`),9,h),T.value?(t(),f(`p`,g,o(T.value),1)):d(``,!0),D.value?(t(),f(`p`,_,`Diff exceeds the host limit; some changes are omitted.`)):d(``,!0),!E.value&&!T.value&&!w.value.length?(t(),f(`p`,v,`No uncommitted changes.`)):d(``,!0),(t(!0),f(s,null,i(w.value,e=>(t(),f(`details`,{key:e.path,onToggle:t=>t.target.open?k.value.add(e.path):k.value.delete(e.path)},[c(`summary`,null,[n(o(e.oldPath?e.oldPath+` → `:``)+o(e.path)+` `,1),c(`span`,null,`+`+o(e.additions)+` −`+o(e.deletions),1)]),c(`button`,{class:`btn btn-ghost`,onClick:t=>j(e.path)},`Copy path`,8,b),e.status===`binary`?(t(),f(`p`,x,`Binary file changed.`)):e.status===`too_large`?(t(),f(`p`,S,`File diff is too large to display.`)):d(``,!0),k.value.has(e.path)?(t(!0),f(s,{key:2},i(e.hunks,(e,n)=>(t(),f(`pre`,{key:n},[c(`code`,null,[c(`span`,C,`@@ −`+o(e.oldStart)+`,`+o(e.oldCount)+` +`+o(e.newStart)+`,`+o(e.newCount)+` @@
|
|
2
|
+
`,1),(t(!0),f(s,null,i(e.lines,(e,n)=>(t(),f(`span`,{key:n,class:a(e.type)},o(e.type===`add`?`+`:e.type===`remove`?`−`:` `)+o(e.content),3))),128))])]))),128)):d(``,!0)],40,y))),128))]))}}),[[`__scopeId`,`data-v-4de9f4ce`]]);export{w as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{C as e,E as t,F as n,H as r,I as i,K as a,N as o,R as s,T as c,X as l,Y as u,_ as d,at as f,b as p,ct as ee,d as m,g as h,h as g,it as te,j as _,k as ne,l as re,m as v,nt as ie,q as y,st as ae,tt as b,v as oe,y as se}from"./vue.runtime.esm-bundler-4XjPOHMM.js";import{E as ce,G as le,U as ue,W as de,X as fe,Y as pe,Z as me,a as he,at as ge,b as _e,c as ve,d as ye,et as be,ft as xe,g as Se,it as Ce,lt as we,n as Te,nt as Ee,ot as De,rt as Oe,ut as ke,v as Ae,w as je,x as Me}from"./MarkdownMessage-CejBvgRc.js";import{n as Ne,r as Pe,t as Fe}from"./PreCodeBlock.vue_vue_type_style_index_0_lang-4BQzC8nU.js";import{n as Ie,t as x}from"./safeRaf-BDp3SJMs.js";import{o as Le}from"./index-Cmpdc3EH.js";var S=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),Re=!1,ze=null,Be=null,Ve=null;function He(){return S(this,null,function*(){if(Ve)return Ve;Ve=S(null,null,function*(){if(!Be)try{if(Be=function(e){let t=e,n=typeof t?.createCodeBlockRuntime==`function`||typeof t?.useMonaco==`function`?t:e?.default,r=n?.createCodeBlockRuntime??n?.useMonaco;return typeof r==`function`?{createCodeBlockRuntime:e=>r.call(n,e),detectLanguage:(n?.detectLanguage)?.bind(n),preloadStreamDiffs:(n?.preloadStreamDiffs)?.bind(n)}:null}(yield Le(()=>import(`./markstream_markstream-vue-Bj0UewdV.js`),[])),!Be)return null}catch{return null}try{return yield function(e){return S(this,null,function*(){if(!Re)return ze||(ze=S(null,null,function*(){let t=e?.preloadStreamDiffs;typeof t==`function`&&(yield t()),Re=!0}).finally(()=>{ze=null}),ze)})}(Be),de(),Be}catch{return null}});try{return yield Ve}finally{Ve=null}})}var Ue=Object.defineProperty,We=Object.defineProperties,C=Object.getOwnPropertyDescriptors,w=Object.getOwnPropertySymbols,Ge=Object.prototype.hasOwnProperty,T=Object.prototype.propertyIsEnumerable,Ke=(e,t,n)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,E=(e,t)=>{for(var n in t||={})Ge.call(t,n)&&Ke(e,n,t[n]);if(w)for(var n of w(t))T.call(t,n)&&Ke(e,n,t[n]);return e},qe=(e,t)=>We(e,C(t)),D=(e,t,n)=>new Promise((r,i)=>{var a=e=>{try{s(n.next(e))}catch(e){i(e)}},o=e=>{try{s(n.throw(e))}catch(e){i(e)}},s=e=>e.done?r(e.value):Promise.resolve(e.value).then(a,o);s((n=n.apply(e,t)).next())}),O={class:`html-preview-frame__header`},Je={class:`html-preview-frame__title`},Ye={class:`html-preview-frame__label`},k=[`sandbox`,`srcdoc`],Xe=Ae(c({__name:`HtmlPreviewFrame`,props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){let t=e,{t:r}=Me(),a=g(()=>{let e=t.code||``,n=e.trim().toLowerCase();return n.startsWith(`<!doctype`)||n.startsWith(`<html`)||n.startsWith(`<body`)?e:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${t.isDark?`#020617`:`#ffffff`};\n color: ${t.isDark?`#e5e7eb`:`#020617`};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${e}\n </body>\n</html>`}),o=g(()=>{return e=t.htmlPreviewSandbox,n=t.htmlPreviewAllowScripts,typeof e==`string`?e:e===void 0&&!0===n?`allow-scripts`:``;var e,n});function c(e){var n;e.key!==`Escape`&&e.key!==`Esc`||(n=t.onClose)==null||n.call(t)}return n(()=>{typeof window<`u`&&window.addEventListener(`keydown`,c)}),i(()=>{typeof window<`u`&&window.removeEventListener(`keydown`,c)}),(e,n)=>(s(),d(v,{to:`body`},[h(`div`,{class:f([`markstream-vue`,{dark:t.isDark}])},[h(`div`,{class:`html-preview-frame__backdrop`,onClick:n[2]||=e=>t.onClose?.call(t)},[h(`div`,{class:`html-preview-frame`,onClick:n[1]||=m(()=>{},[`stop`])},[h(`div`,O,[h(`div`,Je,[n[3]||=h(`span`,{class:`html-preview-frame__dot`},null,-1),h(`span`,Ye,ee(t.title||te(r)(`common.preview`)||`Preview`),1)]),h(`button`,{type:`button`,class:`html-preview-frame__close`,onClick:n[0]||=e=>t.onClose?.call(t)},` × `)]),h(`iframe`,{class:`html-preview-frame__iframe`,sandbox:o.value,referrerpolicy:`no-referrer`,srcdoc:a.value},null,8,k)])])],2)]))}}),[[`__scopeId`,`data-v-24e66176`]]),Ze=[`data-markstream-enhanced`,`data-markstream-enhancement-state`,`data-markstream-code-block-state`,`data-markstream-pending`,`data-markstream-viewport-pending`],Qe={class:`code-header-main`},$e=[`innerHTML`],et={class:`code-header-copy`},tt={class:`code-header-title`},nt={key:0,class:`code-header-caption`},rt=[`data-markstream-host-hidden`],A=Ae(c({__name:`CodeBlockNode`,props:{node:{},codeBlockOptions:{},clipboardWriter:{},showLineNumbers:{type:Boolean,default:void 0},isDark:{type:Boolean,default:!1},loading:{type:Boolean,default:!0},stream:{type:Boolean,default:!0},theme:{},darkTheme:{default:void 0},lightTheme:{default:void 0},isShowPreview:{type:Boolean,default:!0},enableFontSizeControl:{type:Boolean,default:!0},minWidth:{default:void 0},maxWidth:{default:void 0},themes:{},showPreviewButton:{type:Boolean,default:!0},showCollapseButton:{type:Boolean,default:!0},showFontSizeButtons:{type:Boolean,default:!0},showTooltips:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},customId:{},showHeader:{type:Boolean,default:!0},showCopyButton:{type:Boolean,default:!0},showExpandButton:{type:Boolean,default:!0},estimatedHeightPx:{},estimatedContentHeightPx:{},estimatedDiffInline:{type:Boolean}},emits:[`previewCode`,`copy`],setup(c,{emit:m}){let v=c,de=m,Ae=g(()=>v.showLineNumbers??!0!==v.codeBlockOptions?.disableLineNumbers),Le=a(),S=ne(fe,null),Re=ne(`markstreamHostScrollManaged`,null),ze=ne(Se,void 0),Be=g(()=>ve(v,Le)),Ve=t(),Ue=g(()=>{let e=Ve?.vnode.props;return!(!e||!e.onPreviewCode&&!e[`onPreview-code`])}),{t:We}=Me(),C=b(null),w=b(null),Ge=b(!1),T=b(Hr(v.node.language,v.node.code,Vr())),Ke=g(()=>me(T.value)),O=g(()=>Ke.value===`plaintext`?`text`:Ke.value),Je=g(()=>Ke.value===`plaintext`),Ye=b(!1),k=b(!1),A=b(!1),j=b(!1),M=b(!1),it=b(!1),N=!1,at=!1,ot=null,st=null,ct=null,lt=0,ut=!1,dt=``,ft=b(null),pt=0,mt=!1,ht=Te(),gt=ce(),_t=ye(),vt=ie(null),P=b(typeof window>`u`||!_t.value),yt=t()?.vnode.el?.textContent??``,bt=typeof window<`u`&&String(v.node.code??``).length>0&&yt.includes(String(v.node.code)),xt=b(!bt);n(()=>{xt.value=!0}),typeof window<`u`&&y([()=>w.value,_t],([e,t],n,r)=>{var i;if((i=vt.value)==null||i.destroy(),vt.value=null,!t||P.value)return void(P.value=!0);if(!e)return void(P.value=!1);let a=!0,o=gt?.value.heavyBlockMargin??gt?.value.rootMargin??`0px`,s=ht(e,{rootMargin:o,allowIdle:!1});vt.value=s,P.value=P.value||s.isVisible.value,s.whenVisible.then(()=>{a&&vt.value===s&&(P.value=!0)}).catch(()=>{}),r(()=>{a=!1,s.destroy(),vt.value===s&&(vt.value=null)})},{immediate:!0}),o(()=>{var e;N=!0,function(){let e=dt;S&&e&&(dt=``,S.markSettled(e))}(),(e=vt.value)==null||e.destroy(),vt.value=null});let F=null,St=null,Ct=()=>{},wt=()=>{},Tt=()=>{},Et=()=>{},Dt=()=>null,I=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),L=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),Ot=()=>{},kt=()=>{},At=()=>{},jt=null,R=null,Mt=null,Nt=null,Pt=()=>String(v.node.language??`plaintext`),Ft=()=>D(null,null,function*(){}),It=!1,Lt=null,Rt=[],zt=[],Bt=null,Vt=null,z=g(()=>Oe(v.node)),Ht=b({removed:0,added:0}),Ut=g(()=>`-${Ht.value.removed} +${Ht.value.added}`);function Wt(e,t){return{original:e,updated:t}}function Gt(e){return String(e??``).replace(/\r\n$|\n$|\r$/,``)}function Kt(e){return String(e?.message??e).includes(`no diff result available`)}function qt(){if(!$())try{let e=At();e&&typeof e.catch==`function`&&e.catch(e=>{Kt(e)})}catch(e){Kt(e)}}let Jt=g(()=>{let e=E({},v.codeBlockOptions||{});for(let t of[`theme`,`themes`,`themeType`,`language`,`languages`,`stream`,`disableFileHeader`,`onThemeChange`,`renderCustomHeader`,`renderHeaderMetadata`,`renderHeaderPrefix`,`maxHeight`,`padding`,`tabSize`])delete e[t];if(!z.value)return e;let t=e.parseDiffOptions&&typeof e.parseDiffOptions==`object`?e.parseDiffOptions:{},n={diffStyle:`split`,expandUnchanged:!1,collapsedContextThreshold:5,hunkSeparators:`line-info`,parseDiffOptions:{context:2}};return qe(E(E({},n),e),{parseDiffOptions:E(E({},n.parseDiffOptions),t)})}),Yt=g(()=>{return(v.theme===void 0?!fi(v.darkTheme,v.lightTheme):(e=v.theme)&&typeof e==`object`&&`light`in e&&`dark`in e)?!!v.isDark:function(e){let t=di(e)??``;return Ce(t,!0===v.isDark)}(pi());var e}),Xt=g(()=>(z.value,Yt.value?`dark`:`light`)),Zt=g(()=>z.value?Xt.value===`dark`:Yt.value),B=g(()=>ke({darkTheme:v.darkTheme,isDark:v.isDark,lightTheme:v.lightTheme,theme:v.theme,themes:v.themes})),Qt=g(()=>z.value?`diff`:`single`),$t=b(Qt.value),V=b(!1),H=b(!1),en=b(!1),U=b(!1),tn=b(null),nn=b(0),rn=b(0),an=b(!1),on=null,sn=!1,cn=null,ln=!1,un=g(()=>!!z.value&&Jt.value?.diffStyle===`unified`),dn=g(()=>De(Jt.value));function fn(e){return!0===Re?.value||!!e&&(!!e.closest(`[data-markstream-virtual-timeline="1"], .markstream-virtual-timeline`)||!!e.closest(`.vue-recycle-scroller, [data-virtualizer], [data-virtual-scroll-root]`))}let pn=g(()=>fn(w.value)),mn=g(()=>!(V.value||!U.value&&H.value)),hn=g(()=>mn.value),gn=g(()=>mn.value&&!en.value),_n=g(()=>!V.value&&!U.value&&mn.value),vn=g(()=>H.value&&!V.value?`ready`:U.value?`fallback`:`pending`),yn=b(!1),W=g(()=>Gt(v.node.code)),bn=g(()=>z.value?!0===v.node.diff?v.node:qe(E({},v.node),{diff:!0}):W.value===v.node.code?v.node:qe(E({},v.node),{code:W.value}));function xn(e){let t=e.detectLanguage;typeof t==`function`&&(Pt=t),Vt=e,Bt=gi();let n=e.createCodeBlockRuntime(Bt);return!!n&&(F=n.createEditor||F,St=n.createDiffEditor||St,Ct=n.updateCode||Ct,wt=n.updateDiff||wt,Tt=n.finalizeCode||Tt,Et=n.finalizeDiff||Et,Dt=n.getEditor||Dt,I=n.getEditorView||I,L=n.getDiffEditorView||L,Ot=n.cleanupEditor||Ot,kt=n.safeClean||n.cleanupEditor||kt,At=n.refreshDiffPresentation||At,Ft=n.setTheme||Ft,jt=n.whenVisualReady||null,it.value=!0,!0)}let G=b(typeof v.codeBlockOptions?.fontSize==`number`?v.codeBlockOptions.fontSize:NaN),K=b(G.value),Sn=b(null),Cn=b(null),wn=b(null),Tn=b(null),En=g(()=>{let e=G.value,t=K.value;return typeof e==`number`&&Number.isFinite(e)&&e>0&&typeof t==`number`&&Number.isFinite(t)&&t>0}),Dn=g(()=>{let e=v.codeBlockOptions?.fontSize;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e;let t=K.value;return typeof t==`number`&&Number.isFinite(t)&&t>0?t:12}),On=g(()=>{let e=v.codeBlockOptions?.lineHeight;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:Dn.value===12?18:Math.max(12,Math.round(1.5*Dn.value))}),kn=g(()=>On.value),An=g(()=>{let e=v.codeBlockOptions?.tabSize;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:4}),jn=g(()=>{let e=v.codeBlockOptions?.padding,t=typeof e==`number`&&Number.isFinite(e)&&e>=0?e:8;return{top:t,bottom:t}}),Mn=g(()=>qe(E({},xe(v.codeBlockOptions)),{fontSize:Dn.value,lineHeight:kn.value,maxHeight:zr(),padding:jn.value.top,paddingBottom:jn.value.bottom,tabSize:An.value})),Nn=g(()=>{let e=v.estimatedContentHeightPx;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null});function Pn(e){if(e==null)return null;let t=Math.ceil(e);return!Number.isFinite(t)||t<=0?null:Math.min(t,Math.ceil(zr()))}function Fn(){return!z.value&&!1!==v.stream&&!1!==v.loading}let In=b(Fn());function Ln(){return Fn()||In.value}let Rn=g(()=>z.value?null:Nn.value==null||Ln()?Math.ceil((e=>{let t=String(e??``);if(!t)return 1;let n=1;for(let e=0;e<t.length;e++)t[e]===`
|
|
2
|
+
`?n++:t[e]===`\r`&&(n++,t[e+1]===`
|
|
3
|
+
`&&e++);return n})(W.value)*kn.value+1):null),zn=g(()=>{if(z.value)return null;let e=Nn.value;return e==null||Ln()?Pn(Rn.value):Pn(e)}),Bn=g(()=>{let e=v.estimatedHeightPx;return typeof e==`number`&&Number.isFinite(e)&&e>0?e:null}),Vn=b(null);function Hn(){let e=Vn.value;return typeof e==`number`&&Number.isFinite(e)&&e>0?Math.round(e):null}let Un=g(()=>Hn()??(!z.value&&an.value?null:mn.value||!H.value?zn.value:null));function Wn(e){let t=e?`hsl(152 42% 60%)`:`var(--diff-added-fg)`,n=e?`hsl(0 58% 58%)`:`var(--diff-removed-fg)`,r=e?`color-mix(in lab, #121212 80%, #4d9375)`:`color-mix(in lab, #ffffff 88%, #1e754f)`,i=e?`color-mix(in lab, #121212 80%, #cb7676)`:`color-mix(in lab, #ffffff 88%, #ab5959)`;return{"--markstream-diff-line-number-bg":`var(--markstream-diff-editor-bg)`,"--markstream-diff-added-fg":t,"--markstream-diff-removed-fg":n,"--markstream-diff-added-line":r,"--markstream-diff-removed-line":i,"--markstream-diff-added-line-fill":r,"--markstream-diff-added-number-fill":e?`color-mix(in lab, #121212 85%, #4d9375)`:`color-mix(in lab, #ffffff 91%, #1e754f)`,"--markstream-diff-removed-line-fill":i,"--markstream-diff-removed-number-fill":e?`color-mix(in lab, #121212 85%, #cb7676)`:`color-mix(in lab, #ffffff 91%, #ab5959)`,"--markstream-diff-added-gutter":`linear-gradient(90deg, ${t} 0 4px, transparent 4px 100%)`,"--markstream-diff-removed-gutter":`linear-gradient(90deg, ${n} 0 4px, transparent 4px 100%)`,"--markstream-diff-added-inline":e?`hsl(152 42% 60% / 0.28)`:`var(--diff-added-inline-bg)`,"--markstream-diff-removed-inline":e?`hsl(0 58% 58% / 0.28)`:`var(--diff-removed-inline-bg)`}}let Gn=g(()=>{let e=Pn(Nn.value),t=Pn(Rn.value),n=Ln(),r=E({},z.value||e==null||n?z.value||t==null?{}:{minHeight:`${t}px`}:{height:`${e}px`,minHeight:`${e}px`});if(r[`--markstream-code-fallback-bg`]=B.value.background,r[`--markstream-code-fallback-fg`]=B.value.foreground,B.value.builtin&&(r[`--markstream-code-theme-bg`]=B.value.background,r[`--markstream-code-theme-fg`]=B.value.foreground,r[`--markstream-code-theme-line-number`]=B.value.lineNumber),r[`--markstream-pre-line-number-top`]=`${jn.value.top}px`,r[`--markstream-pre-line-number-left`]=`0px`,r[`--markstream-pre-line-number-padding-left`]=`2ch`,r[`--markstream-pre-line-number-padding-right`]=`1ch`,r[`--markstream-pre-line-number-separator-width`]=`2px`,z.value){r[`--markstream-pre-diff-line-height`]=`${kn.value}px`,r[`--markstream-pre-diff-pane-bottom-padding`]=(un.value,`0px`);let e=Tn.value;e!=null&&e>0&&(r.height=`${e}px`,r.minHeight=`${e}px`,r.maxHeight=`${e}px`),Object.assign(r,Wn(Zt.value))}return r}),Kn=g(()=>Un.value!=null&&(!H.value||Hn()!=null)),qn=g(()=>{let e=Un.value;if(e==null)return null;if(z.value)return Math.ceil(e);let t=Bn.value,n=Nn.value;if(t==null||n==null)return Math.ceil(e);let r=Math.max(0,Math.ceil(t)-Math.ceil(n));return Math.ceil(e+r)}),Jn=g(()=>{if(z.value&&mn.value)return{};let e=Un.value;return Kn.value&&e!=null?{minHeight:`${e}px`}:{}});function Yn(){Vn.value=null}function Xn(){var e,t,n,r;let i=w.value?.querySelector(`pre.code-pre-fallback`),a=L(),o=i?.scrollTop??0;(t=(e=(a?.getOriginalEditor)?.call(a))?.setScrollTop)==null||t.call(e,o),(r=(n=(a?.getModifiedEditor)?.call(a))?.setScrollTop)==null||r.call(n,o)}function Zn(){return D(this,null,function*(){return z.value?(vr(),er(),X(!0),Xn(),Z(),en.value=!0,yield _(),X(!0),yield q(),X(!0),gr(),er(),!!(yield function(){return D(this,null,function*(){if(!z.value)return!0;for(let e=0;e<4;e++){let e=er();X(!0),Qn(e),$n(e),yield _(),yield q();let t=w.value?.querySelector(`pre.code-pre-fallback`);if(!t)return!1;if(e==null)return jr();let n=t.getBoundingClientRect().height;if(n>0&&Math.abs(n-e)<=2)return!0}return!1})}())&&(H.value=!0,yield _(),er(),X(!0),gr(),Z(),x(()=>{N||x(()=>{N||(function(){let e=w.value?.querySelector(`.code-block-shell-content`),t=w.value?.querySelector(`.code-editor-layer`);e&&t&&(t.style.removeProperty(`height`),t.style.removeProperty(`min-height`),e.style.removeProperty(`height`),e.style.removeProperty(`min-height`))}(),Q(!0))})}),Q(),!0)):!(jt&&!(yield jt())||(en.value=!0,yield _(),X(!0),H.value=!0,yield _(),Q(),0))})}function Qn(e){if(!z.value)return;let t=C.value,n=w.value?.querySelector(`pre.code-pre-fallback`);if(!t||!n)return;let r=e??Number.parseFloat(t.style.height||``);if(!Number.isFinite(r)||r<=0)return;let i=Math.ceil(r),a=`${i}px`;Tn.value=i;let o=w.value;o&&(o.dataset.markstreamDiffHandoffHeight=a),n.dataset.markstreamDiffHandoffHeight=a,n.style.setProperty(`height`,a),n.style.setProperty(`min-height`,a)}function $n(e){if(!z.value)return;let t=w.value?.querySelector(`.code-block-shell-content`),n=w.value?.querySelector(`.code-editor-layer`);if(!t||!n)return;let r=typeof e==`number`&&Number.isFinite(e)&&e>0?Math.ceil(e):Number.parseFloat(C.value?.style.height||``);if(!Number.isFinite(r)||r<=0)return;let i=`${r}px`;n.style.height=i,n.style.minHeight=i,t.style.height=i,t.style.minHeight=i}function er(){let e=C.value;if(e&&jr(e)){Z();let t=mr(e);if(t!=null&&t>0){let n=Math.ceil(t),r=Math.ceil(zr()),i=Math.min(n,r),a=`${i}px`;return e.style.height=a,e.style.minHeight=`0px`,e.style.maxHeight=`${r}px`,e.style.overflow=n>r+1?`auto`:`hidden`,mn.value&&(Tn.value=i,Qn(i)),Dr(),i}return Y({preferModelDiffHeight:!0}),Qn(),Dr(),Number.parseFloat(e.style.height||``)||null}return vr()}function tr(e,t=!1,n={}){let r=Math.ceil(e),i=Hn();if(i==null)return r;let a=!0===n.allowBelowEstimatedFloor;return r>=i||a?((t||a)&&M.value&&Yn(),r):i}function q(){return new Promise(e=>{let t=!1,n=null,r=null,i=()=>{t||(t=!0,r!=null&&globalThis.clearTimeout(r),n!=null&&Ie(n),e())};r=globalThis.setTimeout(i,50),n=x(i)})}function nr(){try{let e=C.value;if(!e)return null;let t=e.querySelector(`.stream-diffs-shell .stream-diffs-surface`)??e.querySelector(`.stream-diffs-shell`);if(t){let e=Math.ceil(t.getBoundingClientRect().height);if(e>0)return e}}catch{}return null}function rr(){var e;try{let t=z.value?((e=L())?.getModifiedEditor)?.call(e)??L():I(),n=Dt()?.EditorOption?.fontInfo;if(t&&n!=null){let e=t.getOption?.call(t,n)?.fontSize;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e}}catch{}try{let e=C.value;if(e){let t=e.querySelector(`.stream-diffs-shell .stream-diffs-surface`)??e.querySelector(`.stream-diffs-shell`);if(t)try{if(typeof window<`u`&&typeof window.getComputedStyle==`function`){let e=window.getComputedStyle(t).fontSize,n=e&&e.match(/^(\d+(?:\.\d+)?)/);if(n)return Number.parseFloat(n[1])}}catch{}}}catch{}return null}function ir(e){try{let t=Dt()?.EditorOption?.lineHeight;if(t!=null){let n=(e?.getOption)?.call(e,t);if(typeof n==`number`&&n>0)return n}}catch{}let t=nr();if(t&&t>0)return t;let n=Number.isFinite(K.value)&&K.value>0?K.value:14;return Math.max(12,Math.round(1.35*n))}function ar(){let e=v.codeBlockOptions?.padding;return typeof e==`number`&&Number.isFinite(e)?2*Math.max(0,e):z.value?24:0}function or(e){return!!Je.value||!!e&&($(e)||jt!=null)}function sr(){z.value?Ht.value=Ee(String(v.node.originalCode??``),String(v.node.updatedCode??``)):Ht.value={removed:0,added:0}}function cr(){if(Number.isFinite(K.value)&&K.value>0&&Number.isFinite(G.value))return K.value;if(typeof v.codeBlockOptions?.fontSize==`number`)return G.value=v.codeBlockOptions.fontSize,K.value=v.codeBlockOptions.fontSize,v.codeBlockOptions.fontSize;let e=rr();return e&&e>0?(G.value=e,K.value=e,e):(G.value=12,K.value=12,12)}function lr(){let e=cr(),t=Math.min(36,e+1);K.value=t}function ur(){let e=cr(),t=Math.max(10,e-1);K.value=t}function dr(){cr(),Number.isFinite(G.value)&&(K.value=G.value)}function fr(){var e,t,n,r,i;try{let a=z.value?L():null,o=z.value?a:I();if(!o)return null;if(a?.getOriginalEditor&&a?.getModifiedEditor){let i=a.getOriginalEditor?.call(a),o=a.getModifiedEditor?.call(a);(e=i?.layout)==null||e.call(i),(t=o?.layout)==null||t.call(o);let s=(i?.getContentHeight)?.call(i)||0,c=(o?.getContentHeight)?.call(o)||0,l=Math.max(s,c);if(l>0)return Math.ceil(l);let u=((n=(i?.getModel)?.call(i))?.getLineCount)?.call(n)||1,d=((r=(o?.getModel)?.call(o))?.getLineCount)?.call(r)||1,f=Math.max(u,d),p=Math.max(ir(i),ir(o)),ee=ar();return Math.ceil(f*p+ee+0)}if(o?.getContentHeight){(i=o?.layout)==null||i.call(o);let e=o.getContentHeight();if(e>0)return z.value||(an.value=!0),Math.ceil(e)}let s=(o?.getModel)?.call(o),c=1;s&&typeof s.getLineCount==`function`&&(c=s.getLineCount());let l=ir(o);return Math.ceil(c*(l+1.5)+0)}catch{return null}}function pr(){var e;if(z.value)return!1;try{let t=((e=I())?.getContentHeight)?.call(e),n=typeof t==`number`&&Number.isFinite(t)&&t>0;return n&&(an.value=!0),n}catch{return!1}}function mr(e){if(typeof window>`u`)return null;try{if(window.getComputedStyle(e).display===`none`)return null;let t=e.querySelector(`diffs-container`);if(t instanceof HTMLElement){let e=t.getBoundingClientRect();if(e.height>0)return Math.ceil(e.height)}let n=e.querySelector(`.stream-diffs-shell`);if(n){let e=n.getBoundingClientRect();if(e.height>0)return Math.ceil(e.height)}return null}catch{return null}}function hr(e){let t=String(e??``).trim(),n=t.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i)?.[1];if(n){let e=n.length===3?n.split(``).map(e=>`${e}${e}`).join(``):n;return .2126*Number.parseInt(e.slice(0,2),16)+.7152*Number.parseInt(e.slice(2,4),16)+.0722*Number.parseInt(e.slice(4,6),16)}let r=t.match(/\d+(?:\.\d+)?/g);if(!r||r.length<3)return null;let[i,a,o]=r.slice(0,3).map(Number);return .2126*i+.7152*a+.0722*o}function gr(){var e;if(_r())return;let t=rr();t&&t>0&&(Sn.value=t,K.value=t,G.value=t);try{let t=ir(z.value?((e=L())?.getModifiedEditor)?.call(e)??L():I());t&&t>0&&(Cn.value=t)}catch{}try{let e=nr();e&&e>0&&(Cn.value=e)}catch{}}function _r(){return z.value&&hn.value}function vr(){if(!mn.value)return null;let e=C.value,t=w.value?.querySelector(`pre.code-pre-fallback`);if(!e||!t)return null;let n=Math.ceil(t.getBoundingClientRect().height),r=z.value?mr(e):null,i=Math.max(n,r!=null&&r>0?Math.ceil(r):0),a=Math.ceil(zr()),o=Math.min(i,a);return!Number.isFinite(o)||o<=0?null:(z.value&&o>n&&(Tn.value=o),e.style.height=`${o}px`,e.style.minHeight=`${o}px`,e.style.maxHeight=`${a}px`,e.style.overflow=i>a+1?`auto`:`hidden`,o)}function yr(){let e=C.value,t=w.value;if(!e||!t)return;let n=e;n.style.setProperty(`--markstream-diff-metadata-bg`,B.value.background),n.style.setProperty(`--markstream-diff-metadata-fg`,B.value.lineNumber),n.style.setProperty(`--diffs-tab-size`,String(An.value)),n.style.setProperty(`--diffs-scrollbar-gutter-override`,`0px`),typeof v.codeBlockOptions?.padding==`number`?n.style.setProperty(`--diffs-gap-block`,`${jn.value.top}px`):n.style.removeProperty(`--diffs-gap-block`);let r=e.querySelector(`.stream-diffs-shell`)||e,i=r,a=r,o=null,s=null,c=null;try{typeof window<`u`&&typeof window.getComputedStyle==`function`&&(o=window.getComputedStyle(r),s=i===r?o:window.getComputedStyle(i),c=a===r?o:window.getComputedStyle(a))}catch{o=null,s=null,c=null}let l=String(o?.getPropertyValue(`--vscode-editor-foreground`)??``).trim(),u=String(o?.getPropertyValue(`--vscode-editor-background`)??``).trim(),d=String(o?.getPropertyValue(`--vscode-editor-selectionBackground`)??o?.getPropertyValue(`--vscode-editor-hoverHighlightBackground`)??``).trim(),f=l||String(c?.color??o?.color??``).trim(),p=u||String(s?.backgroundColor??o?.backgroundColor??``).trim(),ee=function(){var e;try{let t=z.value?((e=L())?.getModifiedEditor)?.call(e)??L():I(),n=Dt()?.EditorOption?.fontInfo;if(t&&n!=null){let e=t.getOption?.call(t,n)?.typicalHalfwidthCharacterWidth;if(typeof e==`number`&&Number.isFinite(e)&&e>0)return e}}catch{}return null}();if(ee!=null&&(wn.value=ee),z.value){let e=(e,r)=>{r?(t.style.setProperty(e,r),n.style.setProperty(e,r)):(t.style.removeProperty(e),n.style.removeProperty(e))};for(let[n,r]of Object.entries(Wn(t.classList.contains(`is-dark`))))e(n,r);f?(t.style.setProperty(`--markstream-diff-editor-fg`,f),n.style.setProperty(`--vscode-editor-foreground`,f)):(t.style.removeProperty(`--markstream-diff-editor-fg`),n.style.removeProperty(`--vscode-editor-foreground`)),p?(t.style.setProperty(`--markstream-diff-editor-bg`,p),t.style.setProperty(`--markstream-diff-panel-bg`,p),t.style.setProperty(`--markstream-diff-panel-bg-soft`,p),t.style.setProperty(`--markstream-diff-panel-bg-strong`,p),n.style.setProperty(`--vscode-editor-background`,p),n.style.backgroundColor=p):(t.style.removeProperty(`--markstream-diff-editor-bg`),t.style.removeProperty(`--markstream-diff-panel-bg`),t.style.removeProperty(`--markstream-diff-panel-bg-soft`),t.style.removeProperty(`--markstream-diff-panel-bg-strong`),n.style.removeProperty(`--vscode-editor-background`),n.style.backgroundColor=``),d?n.style.setProperty(`--vscode-editor-selectionBackground`,d):n.style.removeProperty(`--vscode-editor-selectionBackground`)}else{if(function(e,t,n){if(!Je.value)return!1;let r=hr(e),i=hr(t);return n?r!=null&&r>170||i!=null&&i<110:r!=null&&r<85||i!=null&&i>190}(p,f,t.classList.contains(`is-dark`)))return n.style.removeProperty(`--vscode-editor-foreground`),n.style.removeProperty(`--vscode-editor-background`),void n.style.removeProperty(`--vscode-editor-selectionBackground`);f&&n.style.setProperty(`--vscode-editor-foreground`,f),p&&n.style.setProperty(`--vscode-editor-background`,p),d&&n.style.setProperty(`--vscode-editor-selectionBackground`,d)}}y(()=>[v.stream,v.loading,v.node.loading,z.value],([e,t,n,r])=>{r||!1===e||!1===t||In.value?(r||!1===e)&&In.value&&(In.value=!1):(In.value=!0,Yn())},{immediate:!0});let br=0,xr=0,Sr=/auto|scroll|overlay/i;function J(e,t,n){if(typeof window>`u`||z.value||function(e){return pn.value||fn(e)}(e))return;let r=Math.ceil(n)-Math.ceil(t);if(Math.abs(r)<=1)return;let i=function(e){if(typeof window>`u`)return null;let t=e?.ownerDocument??document,n=t.scrollingElement||t.documentElement||t.body,r=e?.parentElement??null;for(;r&&r!==t.body&&r!==n;){let e=window.getComputedStyle(r),t=(e.overflowY||``).toLowerCase(),n=(e.overflow||``).toLowerCase();if(Sr.test(t)||Sr.test(n))return r;r=r.parentElement}return n}(e);if(!i)return;let a=e.ownerDocument??document,o=i===a.body||i===a.documentElement||i===a.scrollingElement,s=o?0:i.getBoundingClientRect().top;e.getBoundingClientRect().top-s>=0||(o&&typeof window.scrollBy==`function`?window.scrollBy(0,r):i.scrollTop+=r)}function Cr(){try{let e=C.value;if(!e)return;let t=e.getBoundingClientRect().height,n=fr();if(n!=null&&n>0){let r=tr(n,!0,{allowBelowEstimatedFloor:!z.value&&M.value&&pr()}),i=Hn();e.style.minHeight=i==null?`0px`:`${i}px`,e.style.height=`${r}px`,e.style.maxHeight=`none`,e.style.overflow=`visible`,J(e,t,r);return}let r=Hn();r!=null&&(e.style.minHeight=`${r}px`,e.style.height=`${r}px`,e.style.maxHeight=`none`,e.style.overflow=`visible`,J(e,t,r))}catch{}}function wr(){for(var e,t;Rt.length>0;)try{(t=(e=Rt.pop())?.dispose)==null||t.call(e)}catch{}ot!=null&&(Ie(ot),ot=null),st!=null&&(Ie(st),st=null),ct!=null&&(Ie(ct),ct=null),lt=0,ut=!1}function Tr(){for(var e;zt.length>0;)try{(e=zt.pop())==null||e()}catch{}}function Y(e=!1){k.value||(Ye.value?Cr():function(e={}){try{let t=C.value;if(!t)return;let n=t.getBoundingClientRect().height,r=Math.ceil(n||0),i=zr(),a=r,o=Number.parseFloat(t.style.height||``),s=a>0?a:Number.isFinite(o)&&o>0?Math.ceil(o):0,c=z.value?function(){var e,t;if($())return null;try{let n=L(),r=(n?.getOriginalEditor)?.call(n),i=(n?.getModifiedEditor)?.call(n);if(!r||!i)return null;let a=((e=r.getModel?.call(r))?.getLineCount)?.call(e)||1,o=((t=i.getModel?.call(i))?.getLineCount)?.call(t)||1,s=Math.max(a,o),c=Math.max(ir(r),ir(i)),l=ar(),u=Math.max(r.getContentHeight?.call(r)??0,i.getContentHeight?.call(i)??0);return Math.ceil(Math.max(u,s*c+l+0))}catch{return null}}():null,l=z.value&&jr(t);if(pt>0&&(pt--,ft.value!=null))return void J(t,n,Or(t,ft.value,i,{preserveScrollableOverflow:Ar(t)}));if(z.value&&!l&&mn.value){let e=vr();if(e!=null){let r=Or(t,e,i,{allowBelowEstimatedFloor:!0});X(!0),J(t,n,r);return}}let u=z.value&&!0===e.preferModelDiffHeight,d=z.value?mr(t):null,f=!z.value&&M.value&&pr(),p=z.value&&!1!==v.loading&&(d!=null||c!=null&&a>0&&c<a-1),ee=c!=null,m;if(z.value){if(u){let e=c!=null&&!1===v.loading&&s>0&&c<s-1;m=!1===v.loading&&d!=null?c==null?d:Math.max(d,c):e?c:d!=null&&c!=null?Math.max(d,c,!1===v.loading?0:s):Math.max(d??0,c??0,!1===v.loading?0:s)||null}else m=un.value&&d!=null||d!=null?ee?Math.max(d,c):d:z.value&&!1!==v.loading?c!=null&&s>0&&c<s-1?c:s>0?s:null:c}else m=fr();if(z.value&&m!=null&&s>0&&(!1!==v.loading||!0===e.holdCurrentDiffHeight)&&(m=Math.max(m,s)),m!=null&&m>0)return void J(t,n,Or(t,m,i,{clearEstimatedFloor:!0,allowBelowEstimatedFloor:f||p,preserveScrollableOverflow:Ar(t),renderedStreamingDiffHeight:d}));if(ft.value!=null)return void J(t,n,Or(t,ft.value,i,{preserveScrollableOverflow:Ar(t)}));let h=z.value&&!1!==v.loading?a:Math.max(a,c!=null&&c>0?c:0);if(h>0)return void J(t,n,Or(t,h,i));let g=Hn();if(!(g==null||z.value&&!1!==v.loading&&l))return void J(t,n,Or(t,g,i));let te=Number.parseFloat(t.style.height);!Number.isNaN(te)&&te>0?J(t,n,Or(t,te,i)):z.value||J(t,n,Or(t,i,i))}catch{}}(typeof e==`object`?e:{}))}function Er(){br=0,xr=0}function X(e=!1){if(k.value)return;let t=C.value;if(!t)return;let n=z.value?L():I();if(n&&typeof n.layout==`function`)try{let r=t.getBoundingClientRect?.call(t),i=Math.ceil((r?.width??0)||t.clientWidth||0),a=Math.ceil((r?.height??0)||t.clientHeight||Number.parseFloat(t.style.height||``)||0);if(i>0&&a>0){if(!e&&i===br&&a===xr)return;br=i,xr=a,n.layout({width:i,height:a})}else Er(),n.layout()}catch{}}function Z(){Tr()}function Q(e=!1){if(N||ot!=null)return;let t=()=>{N||(Z(),Y(e),X())};ot=x(()=>{ot=null,t(),st=x(()=>{st=null,t()})}),Dr()}function Dr(e=!1){if(!z.value||N||!e&&!1===v.loading||(ut||=e,lt=Math.max(lt,e?18:6),ct!=null))return;let t=()=>{if(ct=null,!z.value||N||lt<=0||!ut&&!1===v.loading)return lt=0,void(ut=!1);lt--,Z(),Y({preferModelDiffHeight:!0,holdCurrentDiffHeight:ut}),X(),lt>0?ct=x(t):ut=!1};ct=x(t)}function Or(e,t,n,r={}){var i;let a=z.value&&!1!==v.loading,o=`renderedStreamingDiffHeight`in r?a&&(i=r.renderedStreamingDiffHeight)!=null?i:null:a?mr(e):null,s=o!=null&&o>t+1?o:t,c=Math.min(s,n),l=!0===r.allowBelowEstimatedFloor,u=tr(c,!0===r.clearEstimatedFloor,{allowBelowEstimatedFloor:l}),d=Hn();e.style.minHeight=d==null||l?`0px`:`${Math.min(d,Math.ceil(n))}px`,e.style.height=`${u}px`,e.style.maxHeight=`${Math.ceil(n)}px`;let f=!0===r.preserveScrollableOverflow||s>n+1||kr(e,u);return e.style.overflow=f?`auto`:`hidden`,u}function kr(e,t=0){let n=Math.ceil(e.getBoundingClientRect?.call(e).height||0),r=Math.max(t,e.clientHeight||0,n);return r>0&&e.scrollHeight>r+1}function Ar(e){return mt||kr(e,ft.value??0)}function jr(e=C.value){return $(e)}function Mr(e=C.value){return $(e)}function Nr(){var e;if($())return!0;let t=((e=I())?.getModel)?.call(e);return typeof t?.getValue==`function`&&t.getValue()===W.value}function $(e=C.value){return!!e?.querySelector(`diffs-container`)}function Pr(){return!1!==v.loading||H.value}function Fr(){let e=L();return typeof e?.getOriginalEditor==`function`||typeof e?.getModifiedEditor==`function`||typeof e?.getLineChanges==`function`}function Ir(){return D(this,null,function*(){if(!z.value)return!0;for(let e=0;e<30;e++){if(N)return!1;if($())return yield _(),yield q(),!N&&$();yield _(),yield q()}return!1})}let Lr=``;function Rr(e,t,n){return D(this,null,function*(){let r=`${e}\0${t}\0${n}`;if(Lr!==r){try{yield wt(e,t,n),Lr=r;return}catch(e){if(!Kt(e))throw e}if(yield _(),yield q(),!N&&z.value)try{yield wt(e,t,n),Lr=r}catch(e){if(!Kt(e))throw e}}})}function zr(){return v.codeBlockOptions?.maxHeight??500}let Br=g(()=>v.isShowPreview&&(T.value===`html`||T.value===`svg`));function Vr(){return typeof v.node.loading==`boolean`?v.node.loading:!0===v.loading}function Hr(e,t,n){return!n||function(){if(!Vr())return!0;let e=String(v.node.raw??``),t=e.split(/\r\n|\n|\r/,1)[0]?.trimStart()??``;return!/^(?:`{3,}|~{3,})/.test(t)||/\r\n|\n|\r/.test(e)}()&&String(t??``)?ue(String(e??``)):`plain`}function Ur(){return Vr()}let Wr=null,Gr=!1,Kr=0;function qr(){Wr=null,Kr++}function Jr(){return D(this,arguments,function*(e=Kr){if(!Gr){Gr=!0;try{for(;Wr&&!N&&!z.value&&e===Kr;){let e=Wr;Wr=null;try{yield Promise.resolve(Ct(e.code,e.language)),yield _(),N||z.value||(Y(!1),X())}catch{}}}finally{Gr=!1,!Wr||N||z.value||Jr()}}})}function Yr(e,t){Wr={code:e,language:t},Jr(Kr)}y(()=>[v.node.language,v.node.code,v.node.raw,v.node.loading,v.loading],([e,t,n,r,i])=>{T.value=Hr(e,t,typeof r==`boolean`?r:!0===i)}),y(()=>[v.node.originalCode,v.node.updatedCode,z.value],()=>{x(()=>sr())},{immediate:!0});let Xr=0;y(()=>[v.node.originalCode,v.node.updatedCode,O.value,z.value,v.stream],e=>D(null,[e],function*([,,,e,t]){let n=++Xr;if(!e||Vr()||!1===t&&!A.value)return;if(!1!==t&&F&&!A.value&&C.value)try{yield ci(C.value)}catch{}let r=Mt;if(r&&!j.value){try{yield r}catch{}if(N||!z.value||n!==Xr)return}if(n!==Xr)return;let i=Wt(String(v.node.originalCode??``),String(v.node.updatedCode??``)),a=!1===v.loading;a&&_i();try{if(yield Rr(i.original,i.updated,O.value),N||!z.value||n!==Xr)return;yield _(),X(!0),Z(),Y(!1===v.loading||{preferModelDiffHeight:!0}),X(!0),Q(!0)}catch{return}if(a){if(N||!z.value)return;qt(),Z(),sr(),Q(),Dr(!0)}Ye.value&&x(()=>Cr())})),y(()=>v.node.code,e=>D(null,null,function*(){if(Vr()||!1===v.stream||(T.value||=ue(Pt(e)),z.value))return;let t=Mt;if(t&&!j.value){try{yield t}catch{}if(N||z.value)return}if(F&&!A.value&&C.value)try{yield ci(C.value)}catch{}Yr(Gt(v.node.code),O.value),Ye.value&&x(()=>Cr())}));let Zr=g(()=>{let e=T.value;return e?pe[e]||e.charAt(0).toUpperCase()+e.slice(1):pe[``]||`Plain Text`}),Qr=g(()=>ge(String(v.node.raw??``),Zr.value,z.value)),$r=g(()=>Qr.value.title),ei=g(()=>Qr.value.caption),ti=g(()=>(le.value,Pe(T.value||``,ze))),ni=g(()=>{let e={};e[`--markstream-code-layout-character-width`]=wn.value==null?`1ch`:`${wn.value}px`,e[`--markstream-code-fallback-bg`]=B.value.background,e[`--markstream-code-fallback-fg`]=B.value.foreground,B.value.builtin&&(e[`--markstream-code-theme-bg`]=B.value.background,e[`--markstream-code-theme-fg`]=B.value.foreground,e[`--markstream-code-theme-line-number`]=B.value.lineNumber),e[`--markstream-diff-added-line-fill`]=B.value.diffAddedLine,e[`--markstream-diff-added-number-fill`]=B.value.diffAddedNumber,e[`--markstream-diff-editor-bg`]=B.value.background,e[`--markstream-diff-removed-line-fill`]=B.value.diffRemovedLine,e[`--markstream-diff-removed-number-fill`]=B.value.diffRemovedNumber,e[`--markstream-diff-shell-bg`]=B.value.background,e[`--markstream-pre-resolved-theme-bg`]=B.value.background,e[`--markstream-pre-resolved-theme-fg`]=B.value.foreground,e[`--markstream-pre-resolved-theme-line-number`]=B.value.lineNumber;let t=e=>{if(e!=null)return typeof e==`number`?`${e}px`:String(e)},n=t(v.minWidth),r=t(v.maxWidth);if(n&&(e.minWidth=n),r&&(e.maxWidth=r),Kn.value&&!z.value&&!k.value){let t=qn.value;t!=null&&(e.minHeight=`${t}px`)}return e.color=`var(--markstream-code-fallback-fg, var(--markstream-code-theme-fg, var(--markstream-pre-resolved-theme-fg)))`,e.backgroundColor=`var(--markstream-code-fallback-bg, var(--markstream-code-theme-bg, var(--markstream-pre-resolved-theme-bg)))`,z.value||(e.borderColor=`var(--markstream-code-border-color, var(--code-border))`),e}),ri=g(()=>!1!==v.showTooltips);function ii(){return D(this,null,function*(){let e=v.node.code;try{v.clipboardWriter?yield v.clipboardWriter(e):typeof navigator<`u`&&navigator.clipboard&&typeof navigator.clipboard.writeText==`function`&&(yield navigator.clipboard.writeText(e)),Ge.value=!0,de(`copy`,e),setTimeout(()=>{Ge.value=!1},1e3)}catch(e){console.error(`复制失败:`,e)}})}function ai(){Ye.value=!Ye.value;let e=z.value?L():I(),t=C.value;e&&t&&(Ye.value?(t.style.maxHeight=`none`,t.style.overflow=`visible`,Y(!0)):(t.style.overflow=`auto`,Y(!0)))}function oi(){var e;if(k.value=!k.value,k.value){if(mt=!1,C.value){let t=Math.ceil((e=C.value).getBoundingClientRect?.call(e).height||0);mt=kr(C.value,t)||C.value.style.overflow===`auto`||C.value.style.overflowY===`auto`,t>0&&(ft.value=t)}}else C.value&&ft.value!=null&&(C.value.style.height=`${ft.value}px`),pt=2,_(()=>{k.value||N||(Y(!0),X(!0))})}function si(){if(!Br.value)return;let e=T.value;if(Ue.value){let t=e===`html`?`text/html`:`image/svg+xml`,n=e===`html`?We(`artifacts.htmlPreviewTitle`)||`HTML Preview`:We(`artifacts.svgPreviewTitle`)||`SVG Preview`;de(`previewCode`,{node:v.node,artifactType:t,artifactTitle:n,id:`temp-${e}-${Date.now()}`})}else e===`html`&&(yn.value=!yn.value)}function ci(e,t={}){if(!F||N||!1===v.stream&&!1!==v.loading||(Ci(),wi())||V.value||C.value!==e||Ur())return null;if(R)return R;if(A.value&&M.value)return Promise.resolve();let n=xi(),r=nn.value,i=!1;A.value=!0,function(){let e=Be.value;S&&e&&dt!==e&&(dt&&S.markSettled(dt),dt=e,S.markPending(e))}();let a=D(null,null,function*(){try{yield function(e){return D(this,null,function*(){var t;if(!F||N)return;at=!1;let n=Qt.value;if(ln=!1,U.value=!1,tn.value=null,j.value=!1,H.value=!1,en.value=!1,Sn.value=null,Cn.value=null,wn.value=null,Tn.value=null,Er(),function(){if(an.value=!1,Ln())return void(Vn.value=null);let e=zn.value;Vn.value=M.value||e==null?null:e}(),wr(),Tr(),function(e){e.replaceChildren()}(e),_i(),yield _e(hi()),N)return;let r=D(null,null,function*(){if(n===`diff`){(function(){if(It||typeof window>`u`)return;It=!0;let e=e=>{Kt(`reason`in e?e.reason:e.error??e.message)&&(e.preventDefault(),e.stopImmediatePropagation())};window.addEventListener(`error`,e,!0),window.addEventListener(`unhandledrejection`,e,!0),Lt=()=>{window.removeEventListener(`error`,e,!0),window.removeEventListener(`unhandledrejection`,e,!0),It=!1,Lt=null}})(),kt();let t=Wt(String(v.node.originalCode??``),String(v.node.updatedCode??``));St?yield St(e,t.original,t.updated,O.value):yield F(e,v.node.code,O.value)}else yield F(e,W.value,O.value);j.value=!0}).finally(()=>{Mt===r&&(Mt=null)});if(Mt=r,yield function(e){return D(this,null,function*(){if(!z.value)return void(yield e);let t,n=!1;for(e.then(()=>{n=!0},e=>{n=!0,t=e});;){if(N)return;if(n){if(t)throw t;return}if(jr()&&Fr())return;yield _(),yield q()}})}(r),N||Qt.value!==n)return;j.value=!0;let i=v.codeBlockOptions?.fontSize;if(typeof i==`number`&&Number.isFinite(i)&&i>0){let e=n===`diff`?L():I();(t=e?.updateOptions)==null||t.call(e,{fontSize:i}),G.value=i,K.value=i}else if(!_r()){let e=rr();e&&e>0?(G.value=e,K.value=e):(G.value=12,K.value=12)}for(gr();at;)if(at=!1,yield mi(),N)return;Ye.value||k.value||Y(!1),M.value=!0,$t.value=n,function(){if(wr(),z.value){let e=L(),t=(e?.getOriginalEditor)?.call(e),n=(e?.getModifiedEditor)?.call(e),r=(e,t)=>{try{let n=e?.[t];if(typeof n!=`function`)return;let r=n.call(e,()=>Q());r&&Rt.push(r)}catch{}};try{let t=(e?.onDidUpdateDiff)?.call(e,()=>{Q(),x(()=>sr())});t&&Rt.push(t)}catch{}r(t,`onDidContentSizeChange`),r(n,`onDidContentSizeChange`);let i=C.value;if(i&&typeof MutationObserver<`u`){let e=`diffs-container,.stream-diffs-shell,.stream-diffs-surface`,t=t=>{let n=t instanceof HTMLElement?t:t.parentElement;return!!(n?.closest)?.call(n,e)},n=t=>{let n=t instanceof HTMLElement?t:t.parentElement;return!!((n?.closest)?.call(n,e)||(n?.querySelector)?.call(n,e))},r=new MutationObserver(e=>{z.value&&Pr()&&e.some(e=>t(e.target)||Array.from(e.addedNodes).some(n)||Array.from(e.removedNodes).some(t))&&(Z(),Y({preferModelDiffHeight:!0}),X(),Dr())});r.observe(i,{attributeFilter:[`class`],attributes:!0,childList:!0,characterData:!0,subtree:!0}),Rt.push({dispose:()=>r.disconnect()})}if(i&&typeof ResizeObserver<`u`){let e=new ResizeObserver(()=>{if(!z.value||(X(),!Pr()))return;let e=mr(i);e!=null&&(Math.ceil(i.getBoundingClientRect().height||0)<=e+1||(Z(),Y({preferModelDiffHeight:!0}),X()))});e.observe(i),Rt.push({dispose:()=>e.disconnect()})}return}let e=I();try{let t=(e?.onDidContentSizeChange)?.call(e,()=>Q());t&&Rt.push(t)}catch{}try{let t=(e?.onDidLayoutChange)?.call(e,()=>Q());t&&Rt.push(t)}catch{}}(),yr(),gr(),Z(),sr(),Q(),yield _();let a=null;jt&&(a=yield jt(),a&&(yield _(),yield q()));let o=a??(n===`diff`?yield Ir():yield function(){return D(this,null,function*(){if($())return yield _(),yield q(),$();for(let e=0;e<30;e++){if(N||z.value)return!1;let e=C.value,t=Nr(),n=Mr(e),r=!W.value.trim()||or(e);if(t&&n&&r&&(yield _(),yield q(),!N&&!z.value&&Nr()&&Mr(C.value)&&(!W.value.trim()||or(C.value))))return!0;yield _(),yield q()}return!1})}());N||(o?(gr(),er(),(yield Zn())||Ti()):Ti())})}(e),on=null}catch(e){let a=xi(),o=r!==nn.value,s=!1!==t.allowStaleContentRetry&&o&&on!==a;if(n!==a||s)return s&&(on=a),i=!0,A.value=!1,M.value=!1,j.value=!1,void(H.value=!1);throw Ti(n),e}}).finally(()=>{R===a&&(R=null),function(){let e=dt;S&&e&&(dt=``,_(()=>{if(!N){let t=w.value?.offsetHeight??0;t>0&&S.reportHeight(e,t)}S.markSettled(e)}))}(),i&&!N&&queueMicrotask(()=>{var e;let t=C.value;t&&!N&&((e=ci(t))==null||e.catch(e=>{M.value=!1,H.value=!1,Ti()}))})});return R=a,a}y(ri,e=>{e||je()}),y(()=>K.value,(e,t)=>{var n;let r=z.value?L():I();r&&typeof e==`number`&&Number.isFinite(e)&&e>0&&((n=r.updateOptions)==null||n.call(r,{fontSize:e}),k.value||Y(!0))},{flush:`post`,immediate:!1});let li=0,ui=y(()=>[C.value,z.value,v.stream,v.loading,it.value,P.value,v.node.language,v.node.raw,v.node.code,v.node.loading],e=>D(null,[e],function*([e,t,n,r,i,a]){let o=++li;if(!e||!a||Vr()||sn||!1===n&&!1!==r||!F&&(yield function(){return D(this,null,function*(){if(typeof window>`u`||N||it.value||V.value)return;if(Nt)return Nt;let e=D(null,null,function*(){try{let e=yield He();if(N)return;if(!e)return void(V.value=!0);xn(e)}catch{if(N)return;V.value=!0}}).finally(()=>{Nt===e&&(Nt=null)});return Nt=e,e})}(),o!==li||!1===v.stream&&!1!==v.loading||Ur()||!P.value||!F||V.value||A.value||wi()||N||C.value!==e)||Ur())return;let s=ci(e);if(s){try{yield s}catch{M.value=!1,H.value=!1,Ti()}M.value&&H.value&&ui()}}));function di(e){return typeof e==`string`?e:null}function fi(e,t){if(e===t)return!0;let n=di(e),r=di(t);return!!n&&n===r}function pi(){return we({darkTheme:v.darkTheme,isDark:v.isDark,lightTheme:v.lightTheme,theme:v.theme,themes:v.themes})}function mi(){return D(this,arguments,function*(e={}){_i();let t=()=>{z.value&&qt(),x(()=>{yr(),Q()})};if(e.appearanceOnly)return void t();let n=pi();if(n)try{yield _e(hi()),yield Ft(n),t()}catch{}else t()})}function hi(){let e=v.themes;return e&&typeof e[0]==`string`&&typeof e[1]==`string`?{dark:e[0],light:e[1]}:pi()}function gi(){let e=Mn.value,t=qe(E({},Jt.value||{}),{wordWrap:e.overflow===`wrap`?`on`:`off`,overflow:e.overflow,themes:v.themes,stream:!1,MAX_HEIGHT:v.codeBlockOptions?.maxHeight??500,fontSize:Dn.value,lineHeight:kn.value,theme:pi(),themeType:v.isDark?`dark`:`light`,disableLineNumbers:!Ae.value,disableFileHeader:!0,workerManager:Jt.value?.workerManager??he()??void 0,onThemeChange(){yr()}}),n=function(){let e=Jt.value?.fontFamily;return typeof e==`string`&&e.trim()?e.trim():z.value?function(){if(typeof window>`u`)return;let e=w.value?.querySelector(`pre.code-pre-fallback`);if(e)return window.getComputedStyle(e).fontFamily.trim()||void 0}():void 0}();n&&(t.fontFamily??=n);let r=typeof t.unsafeCSS==`string`?t.unsafeCSS:``;return t.unsafeCSS=be(e.overflow,r),t}function _i(){let e=gi();if(!Bt)return Bt=e,Bt;for(let t of Object.keys(Bt))t in e||delete Bt[t];return Object.assign(Bt,e),Bt}y(Qt,(e,t)=>D(null,null,function*(){if(e===t||U.value||sn||(qr(),!F||!C.value)||!A.value||!1===v.stream&&!1!==v.loading||!P.value)return;let n=R;if(n){try{yield n}catch{}if(N||!C.value)return}if($t.value!==e||!A.value||!M.value)try{M.value=!1,H.value=!1,A.value=!1,j.value=!1,wr(),Tr(),kt(),yield _(),yield ci(C.value)}catch{M.value=!1,H.value=!1,Ti()}}));let vi=b(0),yi=g(()=>String(vi.value)),bi=!1;function xi(){let e=pi();return JSON.stringify({kind:Qt.value,language:O.value,structural:yi.value,optionsRevision:vi.value,settledContentGeneration:rn.value,theme:di(e)??(e==null?null:`custom`),isDark:v.isDark})}y(()=>v.codeBlockOptions?.fontSize,e=>{let t=typeof e==`number`&&Number.isFinite(e)&&e>0?e:12;G.value=t,K.value=t,Sn.value=null,Cn.value=null,wn.value=null}),y(()=>[v.codeBlockOptions,v.showLineNumbers],()=>{vi.value+=1,!1===v.stream&&!1!==v.loading&&(bi=!0)},{deep:!0}),y(()=>[W.value,v.node.originalCode,v.node.updatedCode],()=>{nn.value+=1,Vr()||(rn.value+=1)});let Si=g(()=>xi());function Ci(){U.value&&tn.value!==Si.value&&(U.value=!1,tn.value=null,on=null,cn=null,A.value=!1,M.value=!1,j.value=!1,H.value=!1,en.value=!1)}function wi(){return Ci(),U.value&&tn.value===Si.value}function Ti(e=Si.value){tn.value=e,U.value=!0,en.value=!1}return y(Si,()=>D(null,null,function*(){if(sn||!U.value||tn.value===Si.value||!F||!C.value||V.value||N||!P.value||!1===v.stream&&!1!==v.loading||Ur())return;let e=Si.value;sn=!0;try{if(Ci(),U.value)return;yield ci(C.value)}catch{M.value=!1,H.value=!1,Ti()}finally{cn=e,yield _(),sn=!1}})),y(()=>[v.codeBlockOptions,P.value],()=>{var e;if(_i(),!F||!P.value)return;let t=z.value?L():I(),n=typeof v.codeBlockOptions?.fontSize==`number`?v.codeBlockOptions.fontSize:Number.isFinite(K.value)?K.value:void 0;typeof n==`number`&&Number.isFinite(n)&&n>0&&((e=t?.updateOptions)==null||e.call(t,{fontSize:n})),Y(!1)},{deep:!0}),y(()=>[pi(),Xt.value,it.value,A.value,P.value],([e,t],n)=>{if(!it.value||!P.value)return;let r=n!=null&&fi(e,n[0]),i=n!=null&&t!==n[1];M.value?(at=!1,mi({appearanceOnly:r})):r&&!i||(at=!0)},{flush:`post`}),y(()=>[yi.value,it.value,P.value],(e,t)=>D(null,[e,t],function*([e,t,n],[r]){if(_i(),!t||!n||!F||!C.value||!A.value||e===r)return;if(!1===v.stream&&!1!==v.loading)return void(bi=!0);bi=!1;let i=R;if(i){try{yield i}catch{}if(N||!C.value)return}try{M.value=!1,H.value=!1,A.value=!1,j.value=!1,wr(),Tr(),kt(),Vt&&xn(Vt),yield _(),yield ci(C.value,{allowStaleContentRetry:!1})}catch{M.value=!1,H.value=!1,Ti()}}),{flush:`post`}),y(()=>[v.loading,P.value],([e,t])=>{!1===e&&t&&bi&&(bi=!1,vi.value+=1)},{flush:`post`}),y(()=>[v.loading,P.value],(e,t)=>D(null,[e,t],function*([e,t],n){if(!t)return;let r=n?.[0];if(!1===r&&!1!==e&&z.value&&A.value&&(yield _(),x(()=>{D(null,null,function*(){let e=R;if(e)try{yield e}catch{}!N&&z.value&&!1!==v.loading&&(_i(),qt(),Q())})})),e)return;let i=r!==void 0&&!1!==r;yield _(),x(()=>{D(null,null,function*(){try{if(i&&(yield function(){return D(this,null,function*(){if(!U.value||!F||!C.value||V.value||N||!P.value)return!1;if(cn===Si.value)return!0;sn=!0;try{U.value=!1,tn.value=null,on=null,A.value=!1,M.value=!1,j.value=!1,H.value=!1,wr(),Tr(),kt(),Vt&&xn(Vt),yield _();try{yield ci(C.value)}catch{M.value=!1,H.value=!1,Ti()}}finally{yield _(),sn=!1}return!0})}()))return void Y(!1);if(i&&z.value&&A.value&&ln&&C.value)return ln=!1,M.value=!1,H.value=!1,A.value=!1,j.value=!1,wr(),Tr(),kt(),yield _(),yield ci(C.value,{allowStaleContentRetry:!1}),void Dr(!0);if(i&&A.value){if(z.value&&C.value){let e=R;if(e)try{yield e}catch{}_i();let t=Wt(String(v.node.originalCode??``),String(v.node.updatedCode??``));if(yield Rr(t.original,t.updated,O.value),N||!z.value)return;yield Promise.resolve(Et()),qt(),X(!0),Xn(),Z(),sr();let n=yield Ir();N||!n||H.value||(yield Zn()),Q(),Dr(!0)}else qr(),Yr(W.value,O.value),yield new Promise(e=>{let t=()=>{N?e():Gr||Wr?setTimeout(t,16):e()};t()}),N||z.value||(yield Promise.resolve(Tt()))}i&&z.value?(Y({preferModelDiffHeight:!0,holdCurrentDiffHeight:!0}),Dr(!0)):Y(!1)}catch{}})})}),{immediate:!0,flush:`post`}),i(()=>{wr(),Tr(),Ot(),Lt?.()}),(t,n)=>{var i;return V.value?(s(),d(Fe,{key:0,style:ae(Gn.value),node:bn.value,loading:v.loading,"show-line-numbers":Ae.value,"diff-inline":un.value,"diff-hide-unchanged-regions":dn.value,"code-block-options":v.codeBlockOptions,"resolved-visual-options":Mn.value,"reserved-height-px":z.value&&(i=Tn.value)!=null?i:void 0,"is-dark":v.isDark,theme:v.theme,"dark-theme":v.darkTheme,"light-theme":v.lightTheme,themes:v.themes,"show-header":v.showHeader,"show-copy-button":v.showCopyButton,"clipboard-writer":v.clipboardWriter,"show-tooltips":v.showTooltips,onCopy:n[0]||=e=>de(`copy`,e)},p({_:2},[t.$slots[`header-left`]?{name:`header-left`,fn:u(()=>[r(t.$slots,`header-left`,{},void 0,!0)]),key:`0`}:void 0,t.$slots[`header-right`]?{name:`header-right`,fn:u(()=>[r(t.$slots,`header-right`,{},void 0,!0)]),key:`1`}:void 0]),1032,[`style`,`node`,`loading`,`show-line-numbers`,`diff-inline`,`diff-hide-unchanged-regions`,`code-block-options`,`resolved-visual-options`,`reserved-height-px`,`is-dark`,`theme`,`dark-theme`,`light-theme`,`themes`,`show-header`,`show-copy-button`,`clipboard-writer`,`show-tooltips`])):(s(),se(`div`,{key:1,ref_key:`container`,ref:w,style:ae(ni.value),class:f([`code-block-container rounded-lg border`,[{dark:v.isDark,"is-rendering":v.loading,"is-dark":Zt.value,"is-diff":z.value,"is-plain-text":Je.value}]]),"data-markstream-code-block":`1`,"data-markstream-enhanced":H.value&&!V.value?`true`:`false`,"data-markstream-enhancement-state":vn.value,"data-markstream-code-block-state":Vr()?`streaming`:`settled`,"data-markstream-pending":_n.value?`true`:void 0,"data-markstream-viewport-pending":xt.value&&te(_t)&&!P.value?`true`:void 0},[e(Ne,{"show-header":v.showHeader,"show-collapse-button":v.showCollapseButton,"show-font-size-buttons":v.showFontSizeButtons,"enable-font-size-control":v.enableFontSizeControl,"show-copy-button":v.showCopyButton,"show-expand-button":v.showExpandButton,"show-preview-button":v.showPreviewButton,"show-tooltips":v.showTooltips,"is-dark":v.isDark,loading:v.loading,stream:c.stream,"is-collapsed":k.value,"is-expanded":Ye.value,"copy-text":Ge.value,"is-previewable":Br.value,"code-font-size":K.value,"code-font-min":10,"code-font-max":36,"default-code-font-size":G.value,"font-baseline-ready":En.value,"diff-stats":z.value?Ht.value:null,"diff-stats-aria-label":Ut.value,onToggleCollapse:oi,onDecreaseFont:ur,onResetFont:dr,onIncreaseFont:lr,onCopy:ii,onToggleExpand:ai,onPreview:si},p({"header-left":u(()=>[r(t.$slots,`header-left`,{},()=>[h(`div`,Qe,[h(`span`,{class:`icon-slot h-4 w-4 flex-shrink-0`,innerHTML:ti.value},null,8,$e),h(`div`,et,[h(`div`,tt,ee($r.value),1),ei.value?(s(),se(`div`,nt,ee(ei.value),1)):oe(``,!0)])])],!0)]),loading:u(()=>[r(t.$slots,`loading`,{loading:c.loading,stream:c.stream},()=>[n[1]||=h(`div`,{class:`loading-skeleton`},[h(`div`,{class:`skeleton-line`}),h(`div`,{class:`skeleton-line`}),h(`div`,{class:`skeleton-line short`})],-1)],!0)]),default:u(()=>{var e;return[l(h(`div`,{class:f([`code-editor-layer`,{"code-editor-layer--collapsed":k.value}])},[h(`div`,{ref_key:`codeEditor`,ref:C,class:f([`code-editor-container`,c.stream?``:`code-height-placeholder`]),"data-markstream-host-hidden":gn.value?`true`:void 0,style:ae(Jn.value)},null,14,rt),hn.value?(s(),d(Fe,{key:0,style:ae(Gn.value),node:bn.value,loading:v.loading,"show-line-numbers":Ae.value,"diff-inline":un.value,"diff-hide-unchanged-regions":dn.value,"code-block-options":v.codeBlockOptions,"resolved-visual-options":Mn.value,"reserved-height-px":z.value&&(e=Tn.value)!=null?e:void 0,"is-dark":v.isDark,theme:v.theme,"dark-theme":v.darkTheme,"light-theme":v.lightTheme,themes:v.themes,"show-toolbar":!1},null,8,[`style`,`node`,`loading`,`show-line-numbers`,`diff-inline`,`diff-hide-unchanged-regions`,`code-block-options`,`resolved-visual-options`,`reserved-height-px`,`is-dark`,`theme`,`dark-theme`,`light-theme`,`themes`])):oe(``,!0)],2),[[re,!!c.stream||!c.loading]]),yn.value&&!Ue.value&&Br.value&&T.value===`html`?(s(),d(Xe,{key:0,code:v.node.code,"html-preview-allow-scripts":v.htmlPreviewAllowScripts,"html-preview-sandbox":v.htmlPreviewSandbox,"is-dark":v.isDark,"on-close":()=>yn.value=!1},null,8,[`code`,`html-preview-allow-scripts`,`html-preview-sandbox`,`is-dark`,`on-close`])):oe(``,!0)]}),_:2},[t.$slots[`header-right`]?{name:`header-right`,fn:u(()=>[r(t.$slots,`header-right`,{},void 0,!0)]),key:`0`}:void 0]),1032,[`show-header`,`show-collapse-button`,`show-font-size-buttons`,`enable-font-size-control`,`show-copy-button`,`show-expand-button`,`show-preview-button`,`show-tooltips`,`is-dark`,`loading`,`stream`,`is-collapsed`,`is-expanded`,`copy-text`,`is-previewable`,`code-font-size`,`default-code-font-size`,`font-baseline-ready`,`diff-stats`,`diff-stats-aria-label`])],14,Ze))}}}),[[`__scopeId`,`data-v-f293a87c`]]);export{A as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{I as e,R as t,T as n,V as r,X as i,c as a,ct as o,d as s,f as c,g as l,q as u,tt as d,v as f,y as p}from"./vue.runtime.esm-bundler-4XjPOHMM.js";import{p as m}from"./index-Cmpdc3EH.js";var h={class:`conversation-search`},g=[`disabled`],_={key:0,role:`alert`},v={key:1},y={key:2},b=[`onClick`],x=[`disabled`],S=m(n({__name:`ConversationSearch`,props:{base:{},api:{type:Function}},emits:[`jump`],setup(n,{emit:m}){let S=n,C=m,w=d(``),T=d(``),E=d(!1),D=d(!1),O=d([]),k=d(null),A=d(``),j=0,M=``;e(()=>j++);function N(){j++,O.value=[],k.value=null,D.value=!1,E.value=!1,T.value=``}u(w,N),u(()=>S.base,()=>{w.value=``,N()});async function P(e=!1){if(E.value||!w.value.trim())return;let t=++j;e||(O.value=[],k.value=null,M=w.value.trim()),E.value=!0,T.value=``;try{let n=await S.api(S.base+`/search?q=`+encodeURIComponent(M)+(e&&k.value!==null?`&cursor=`+k.value:``));if(t!==j)return;if(e&&A.value!==n.epoch)throw Error(`Conversation changed. Search again.`);A.value=n.epoch,O.value=[...new Map((e?[...O.value,...n.locations]:n.locations).map(e=>[e.seq,e])).values()],k.value=n.nextCursor,D.value=!0}catch(e){t===j&&(T.value=e.message)}finally{t===j&&(E.value=!1)}}return(e,n)=>(t(),p(`section`,h,[n[3]||=l(`p`,null,`Search user and agent messages across the full conversation history. Select a result to read it in context.`,-1),l(`form`,{onSubmit:n[1]||=s(e=>P(!1),[`prevent`])},[i(l(`input`,{"onUpdate:modelValue":n[0]||=e=>w.value=e,type:`search`,maxlength:`500`,"aria-label":`Search conversation content`,placeholder:`Search all messages…`},null,512),[[a,w.value]]),l(`button`,{class:`btn`,disabled:E.value||!w.value.trim()},`Search`,8,g)],32),T.value?(t(),p(`p`,_,o(T.value),1)):f(``,!0),D.value&&!O.value.length&&!E.value?(t(),p(`p`,v,`No matching messages.`)):f(``,!0),E.value?(t(),p(`p`,y,`Searching…`)):f(``,!0),(t(!0),p(c,null,r(O.value,e=>(t(),p(`button`,{key:e.seq,class:`btn result`,onClick:t=>C(`jump`,e.seq,A.value)},o(e.role===`assistant`?`Agent reply`:`Your message`)+` · #`+o(e.seq)+o(e.count?` · ${e.count} matches`:``)+` →`,9,b))),128)),k.value===null?f(``,!0):(t(),p(`button`,{key:3,class:`btn`,disabled:E.value,onClick:n[2]||=e=>P(!0)},`More results`,8,x))]))}}),[[`__scopeId`,`data-v-c9855449`]]);export{S as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{C as e,N as t,R as n,S as r,T as i,W as a,_ as o,ct as s,f as ee,g as c,h as l,it as u,j as d,q as f,st as p,tt as m,v as h,y as g}from"./vue.runtime.esm-bundler-4XjPOHMM.js";import{a as _,d as te,i as v,l as y,m as b,p as x,u as S}from"./index-Cmpdc3EH.js";import{n as C,t as ne}from"./highlight-BnTrj1LT.js";var re={class:`file-view`},ie={class:`file-bar`},ae=[`title`],w={key:0,class:`file-bar-meta`},T=[`title`],E=[`title`],D={key:0,class:`timeline-empty`},O={key:1,class:`file-error`},oe=[`src`,`alt`],se={key:0,class:`file-link-notice`,role:`status`},ce={key:2,class:`file-text wrap`},le={class:`code-wrap`},ue={class:`code-gutter`,"aria-hidden":`true`},de=[`innerHTML`],k={key:2,class:`file-text`},A={key:0,class:`file-note`},j={key:5,class:`file-note`},M=x(i({__name:`FileViewer`,props:{hostId:{},cwd:{},path:{},api:{type:Function},session:{},jump:{},view:{},viewKey:{}},emits:[`open`,`reveal`,`view`],setup(i,{emit:x}){let M=i,N=x,P=m(null),F=m(``),I=m(!1),L=m(M.view?.rendered??!0),R=l(()=>`/hosts/${encodeURIComponent(M.hostId)}/fs`),z=l(()=>`cwd=${encodeURIComponent(M.cwd)}&path=${encodeURIComponent(M.path)}`),B=l(()=>/\.(png|jpe?g|webp|gif|bmp|avif)$/i.test(M.path)),V=l(()=>/\.(md|markdown|mdx)$/i.test(M.path)&&P.value?.text!==void 0);async function H(){I.value=!0,F.value=``;try{P.value=await M.api(`${R.value}/read?${z.value}`),V.value&&v()}catch(e){F.value=e.message}finally{I.value=!1}}f(()=>[M.hostId,M.cwd,M.path],H,{immediate:!0});let U=l(()=>M.path.startsWith(`/`)||M.path.startsWith(`~`)?M.path:`${M.cwd.replace(/\/$/,``)}/${M.path}`),fe=l(()=>{let e=P.value?.text??``;if(!M.session)return e;let t=U.value.slice(0,U.value.lastIndexOf(`/`))||`/`,n={session:M.session,cwd:t,workspace:M.cwd};return te(S(e,{...n,rawBase:`/api${R.value}`}),n)}),W=m(``),G;function K(e){W.value=e,clearTimeout(G),G=setTimeout(()=>W.value=``,4e3)}function pe(e){let t=e.target?.closest?.(`a`),n=y(t?.getAttribute(`href`));if(n){if(n.kind===`copy`){e.preventDefault();let t=()=>K(`Can't open this here. Path: ${n.path}`);navigator.clipboard?navigator.clipboard.writeText(n.path).then(()=>K(`Copied path: ${n.path}`),t):t()}else e.ctrlKey||e.metaKey||e.shiftKey||e.altKey||(e.preventDefault(),n.kind===`reveal`?N(`reveal`,n.path):N(`open`,n.path,n))}}let q=m(null),J=m(M.view?.mark??null),Y=M.view?.jumped??0,X=!1,Z=l(()=>{let e=P.value?.text??``,t=1;for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t++;return t});f([()=>M.jump?.seq,()=>P.value],async()=>{if(!P.value)return;let e=M.jump;if(e&&e.seq!==Y&&P.value.text!==void 0){Y=e.seq,X=!0,/\.(md|markdown|mdx)$/i.test(M.path)&&(L.value=!1),await d();let t=q.value?.querySelector(`.code-gutter`);if(!q.value||!t)return;let n=getComputedStyle(t),r=parseFloat(n.lineHeight)||20,i=Math.min(e.line,Z.value),a=Math.min(Math.max(e.end??i,i),Z.value);J.value={top:parseFloat(n.paddingTop)+(i-1)*r,height:(a-i+1)*r},q.value.scrollTop=Math.max(0,J.value.top-q.value.clientHeight/3);return}if(X)return;X=!0;let t=M.view?.scrollTop??0;t&&(await d(),q.value&&(q.value.scrollTop=t),requestAnimationFrame(()=>{q.value&&q.value.scrollTop<t&&(q.value.scrollTop=t)}))},{immediate:!0}),t(()=>{M.viewKey&&N(`view`,M.viewKey,{rendered:L.value,scrollTop:q.value?.scrollTop??0,mark:J.value,jumped:Y})});let me=l(()=>`/api${R.value}/raw?${z.value}`),he=l(()=>Array.from({length:Z.value},(e,t)=>t+1).join(`
|
|
2
|
+
`)),Q=l(()=>P.value?.text===void 0?null:ne(P.value.text,C(M.path))),ge=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`,$=m(!1);async function _e(){await navigator.clipboard?.writeText(U.value).catch(()=>{}),$.value=!0,setTimeout(()=>$.value=!1,1200)}return(t,l)=>(n(),g(`div`,re,[c(`div`,ie,[e(b,{name:`file`,size:14,class:`file-bar-icon`}),c(`span`,{class:`file-bar-path`,title:i.path},s(i.path),9,ae),P.value?(n(),g(`span`,w,s(ge(P.value.size)),1)):h(``,!0),V.value?(n(),g(`button`,{key:1,class:`icon-btn`,title:L.value?`Show source`:`Show rendered`,onClick:l[0]||=e=>L.value=!L.value},[e(b,{name:L.value?`terminal`:`eye`,size:14},null,8,[`name`])],8,T)):h(``,!0),c(`button`,{class:`icon-btn`,title:`Reload`,"aria-label":`Reload file`,onClick:H},[e(b,{name:`refresh`,size:14})]),c(`button`,{class:`icon-btn`,title:$.value?`Copied`:`Copy path`,"aria-label":`Copy path`,onClick:_e},[e(b,{name:$.value?`check`:`copy`,size:14},null,8,[`name`])],8,E)]),c(`div`,{ref_key:`body`,ref:q,class:`file-body`},[I.value&&!P.value?(n(),g(`div`,D,[...l[1]||=[c(`span`,{class:`spinner`},null,-1)]])):F.value?(n(),g(`p`,O,[e(b,{name:`alert`,size:13}),r(s(F.value),1)])):B.value?(n(),g(`img`,{key:2,src:me.value,alt:i.path,class:`file-image`},null,8,oe)):V.value&&L.value?(n(),g(`div`,{key:3,class:`file-markdown`,onClick:pe},[W.value?(n(),g(`p`,se,s(W.value),1)):h(``,!0),u(_)?(n(),o(a(u(_)),{key:1,content:fe.value,final:!0},null,8,[`content`])):(n(),g(`pre`,ce,s(P.value?.text),1))])):P.value?.text===void 0?P.value?(n(),g(`p`,j,s(P.value.mime||P.value.kind)+` · not shown as text`,1)):h(``,!0):(n(),g(ee,{key:4},[c(`div`,le,[J.value?(n(),g(`div`,{key:0,class:`line-mark`,style:p({top:J.value.top+`px`,height:J.value.height+`px`}),"aria-hidden":`true`},null,4)):h(``,!0),c(`pre`,ue,s(he.value),1),Q.value===null?(n(),g(`pre`,k,s(P.value.text),1)):(n(),g(`pre`,{key:1,class:`file-text hljs`,innerHTML:Q.value},null,8,de))]),P.value.truncated?(n(),g(`p`,A,`Showing the first 1 MB.`)):h(``,!0)],64))],512)]))}}),[[`__scopeId`,`data-v-b6228f15`]]);export{M as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,R as t,S as n,T as r,V as i,_ as a,at as o,ct as s,f as c,g as l,h as u,j as d,nt as f,q as p,st as m,tt as h,v as g,y as _}from"./vue.runtime.esm-bundler-4XjPOHMM.js";import{m as v,p as y}from"./index-Cmpdc3EH.js";var b={class:`files`},x={class:`files-head`},S=[`title`],C={key:0,class:`files-error`},w=[`data-path`,`aria-expanded`,`title`,`onClick`],T={key:1,class:`tree-caret`},E={class:`tree-name`},D={key:2,class:`spinner spinner-sm`},O={key:0,class:`files-empty`},k=y(r({__name:`FilesPanel`,props:{hostId:{},cwd:{},api:{type:Function},activePath:{},reveal:{}},emits:[`open`],setup(r,{emit:y}){let k=r,A=y,j=f(new Map),M=h(new Set),N=h(new Set),P=h(``),F=u(()=>`/hosts/${encodeURIComponent(k.hostId)}/fs`),I=e=>`cwd=${encodeURIComponent(k.cwd)}&path=${encodeURIComponent(e)}`,L=new Map;function R(e){let t=L.get(e);if(t)return t;let n=z(e).finally(()=>L.delete(e));return L.set(e,n),n}async function z(e){N.value=new Set(N.value).add(e);try{let t=await k.api(`${F.value}/list?${I(e)}`),n=new Map(j.value);n.set(e,t.entries),j.value=n,P.value=``}catch(e){P.value=e.message}finally{let t=new Set(N.value);t.delete(e),N.value=t}}p(()=>[k.hostId,k.cwd],()=>{j.value=new Map,M.value=new Set,R(`.`)},{immediate:!0});function B(e){let t=new Set(M.value);t.has(e.path)?t.delete(e.path):(t.add(e.path),j.value.has(e.path)||R(e.path)),M.value=t}let V=u(()=>{let e=[],t=(n,r)=>{for(let i of j.value.get(n)??[])e.push({entry:i,depth:r}),i.kind===`directory`&&M.value.has(i.path)&&t(i.path,r+1)};return t(`.`,0),e}),H=h(null),U=h(null);return p(()=>k.activePath,()=>U.value=null),p(()=>k.reveal?.seq,async()=>{let e=k.reveal?.path;if(!e)return;let t=e===`.`?[]:e.split(`/`).filter(Boolean);await R(`.`);for(let e=1;e<=t.length;e++){let n=t.slice(0,e).join(`/`);j.value.has(n)||await R(n),M.value=new Set(M.value).add(n)}U.value=t.join(`/`)||null,await d();let n=Array.from(H.value?.querySelectorAll(`.tree-row`)??[]).find(e=>e.dataset.path===U.value);n?.scrollIntoView({block:`center`}),n?.focus({preventScroll:!0})},{immediate:!0}),(u,d)=>(t(),_(`div`,b,[l(`div`,x,[l(`span`,{class:`files-root`,title:r.cwd},s(r.cwd.split(`/`).filter(Boolean).pop()||r.cwd),9,S),l(`button`,{class:`icon-btn`,title:`Refresh`,"aria-label":`Refresh files`,onClick:d[0]||=e=>{j.value=new Map,M.value=new Set,R(`.`)}},[e(v,{name:`refresh`,size:14})])]),P.value?(t(),_(`p`,C,[e(v,{name:`alert`,size:13}),n(s(P.value),1)])):g(``,!0),l(`div`,{ref_key:`tree`,ref:H,class:`tree`,role:`tree`},[(t(!0),_(c,null,i(V.value,n=>(t(),_(`button`,{key:n.entry.path,class:o([`tree-row`,{chosen:n.entry.path===r.activePath||n.entry.path===U.value}]),"data-path":n.entry.path,role:`treeitem`,"aria-expanded":n.entry.kind===`directory`?M.value.has(n.entry.path):void 0,style:m({paddingLeft:8+n.depth*14+`px`}),title:n.entry.path,onClick:e=>n.entry.kind===`directory`?B(n.entry):A(`open`,n.entry.path)},[n.entry.kind===`directory`?(t(),a(v,{key:0,name:`chevron`,size:11,class:o([`tree-caret`,{open:M.value.has(n.entry.path)}])},null,8,[`class`])):(t(),_(`span`,T)),e(v,{name:n.entry.kind===`directory`?`folder`:`file`,size:14,class:`tree-icon`},null,8,[`name`]),l(`span`,E,s(n.entry.name),1),N.value.has(n.entry.path)?(t(),_(`span`,D)):g(``,!0)],14,w))),128)),!V.value.length&&N.value.has(`.`)?(t(),_(`div`,O,[...d[1]||=[l(`span`,{class:`spinner`},null,-1)]])):g(``,!0)],512)]))}}),[[`__scopeId`,`data-v-4159b030`]]);export{k as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{C as e,F as t,I as n,R as r,S as i,T as a,V as o,X as s,_ as ee,a as c,at as l,c as u,ct as d,d as te,f,g as p,h as m,it as ne,q as re,s as h,tt as g,u as ie,v as _,y as v}from"./vue.runtime.esm-bundler-4XjPOHMM.js";import{m as y,n as ae,p as oe}from"./index-Cmpdc3EH.js";var se=[`claude`,`codex`,`copilot`,`opencode`,`pi`,`omp`,`acp`],ce=/^[a-z][a-z0-9-]*$/,b=[`agentProfiles`,`terminalProfiles`,`metadataGeneration`,`providers`],le=e=>e===void 0?e:JSON.parse(JSON.stringify(e)),x=0,S=()=>`k${++x}`,C=()=>globalThis.crypto?.randomUUID?.()??`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}-${Math.random().toString(36).slice(2,10)}`,w=e=>e.split(`
|
|
2
|
+
`).map(e=>e.trim()).filter(Boolean);function T(e,t){return Object.fromEntries(Object.entries(e).filter(([e])=>!t.includes(e)))}function E(e){return Object.fromEntries(Object.entries(e).filter(([,e])=>e.trim()!==``).map(([e,t])=>[e,t.trim()]))}function ue(e){let t=le(e),n=T(t,b),r={};for(let[e,n]of Object.entries(t.providers??{}))r[e]={...T(n,[`command`,`additionalModels`]),commandText:(n.command??[]).join(`
|
|
3
|
+
`),additionalModels:(n.additionalModels??[]).map(e=>({id:e.id??``,label:e.label??``,isDefault:e.isDefault===!0,rest:T(e,[`id`,`label`,`isDefault`])}))};return{values:n,providers:r,removeProviders:[],agentProfiles:t.agentProfiles?t.agentProfiles.map(e=>({key:S(),id:e.id,name:e.name??``,provider:e.provider??``,model:e.model??``,modeId:e.modeId??``,thinkingOptionId:e.thinkingOptionId??``,notes:e.notes??``,rest:T(e,[`id`,`name`,`provider`,`model`,`modeId`,`thinkingOptionId`,`notes`])})):null,terminalProfiles:t.terminalProfiles?t.terminalProfiles.map(e=>({key:S(),id:e.id,name:e.name??``,command:e.command??``,argsText:(e.args??[]).join(`
|
|
4
|
+
`),rest:T(e,[`id`,`name`,`command`,`args`])})):null,metadataProviders:t.metadataGeneration?(t.metadataGeneration.providers??[]).map(e=>({key:S(),provider:e.provider??``,model:e.model??``,thinkingOptionId:e.thinkingOptionId??``,rest:T(e,[`provider`,`model`,`thinkingOptionId`])})):null}}function D(e){let t=le(e.values),n={};for(let[t,r]of Object.entries(e.providers)){if(e.removeProviders.includes(t))continue;let{commandText:i,additionalModels:a,...o}=r,s={...le(o)};w(i).length&&(s.command=w(i)),a.length&&(s.additionalModels=a.map(e=>({...e.rest,id:e.id.trim(),label:e.label.trim(),...e.isDefault?{isDefault:!0}:{}}))),n[t]=s}return(Object.keys(n).length||Object.keys(e.providers).length)&&(t.providers=n),e.agentProfiles&&(t.agentProfiles=e.agentProfiles.map(e=>({...e.rest,id:e.id,name:e.name.trim(),provider:e.provider.trim(),...E({model:e.model,modeId:e.modeId,thinkingOptionId:e.thinkingOptionId}),...e.notes.trim()?{notes:e.notes.trim()}:{}}))),e.terminalProfiles&&(t.terminalProfiles=e.terminalProfiles.map(e=>({...e.rest,id:e.id,name:e.name.trim(),command:e.command.trim(),...w(e.argsText).length?{args:w(e.argsText)}:{}}))),e.metadataProviders&&(t.metadataGeneration={providers:e.metadataProviders.map(e=>({...e.rest,provider:e.provider.trim(),...E({model:e.model,thinkingOptionId:e.thinkingOptionId})}))}),t}function O(e){return Array.isArray(e)?`[`+e.map(O).join(`,`)+`]`:e&&typeof e==`object`?`{`+Object.entries(e).filter(([,e])=>e!==void 0).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>JSON.stringify(e)+`:`+O(t)).join(`,`)+`}`:JSON.stringify(e)??`null`}var k=(e,t)=>O(e)===O(t),A=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function de(e,t){let n=D(ue(e)),r=D(t),i={};for(let e of new Set([...Object.keys(n),...Object.keys(r)]))e===`providers`||r[e]===void 0||k(n[e],r[e])||(i[e]=A(n[e])&&A(r[e])?Object.fromEntries(Object.entries(r[e]).filter(([t,r])=>!k(n[e][t],r))):r[e]);let a={};for(let[e,t]of Object.entries(r.providers??{})){let r=n.providers?.[e]??{},i=Object.fromEntries(Object.entries(t).filter(([e,t])=>!k(r[e],t)));Object.keys(i).length&&(a[e]=i)}return Object.keys(a).length&&(i.providers=a),t.removeProviders.length&&(i.removeProviders=[...t.removeProviders]),i}function fe(e,t){let n=[];t.agentProfiles?.forEach((e,t)=>{let r=e.name.trim()||`Agent profile ${t+1}`;e.name.trim()||n.push(`${r} needs a name.`),e.provider.trim()||n.push(`${r} needs a provider.`)});let r=(t.agentProfiles??[]).map(e=>e.name.trim().toLowerCase()).filter(Boolean);new Set(r).size!==r.length&&n.push(`Agent profile names must be unique.`),t.terminalProfiles?.forEach((e,t)=>{let r=e.name.trim()||`Terminal profile ${t+1}`;e.name.trim()||n.push(`${r} needs a name.`),e.command.trim()||n.push(`${r} needs a command.`)}),t.metadataProviders?.forEach((e,t)=>{e.provider.trim()||n.push(`Metadata provider ${t+1} needs a provider.`)});for(let[r,i]of Object.entries(t.providers)){if(t.removeProviders.includes(r))continue;i.extends!==void 0&&!i.label?.trim()&&n.push(`${r} needs a display name.`),e.providers?.[r]?.command?.length&&!w(i.commandText).length&&n.push(`${r}: a command override cannot be cleared from here. Edit the host's config file instead.`);let a=i.additionalModels.map(e=>e.id.trim());i.additionalModels.some(e=>!e.id.trim()||!e.label.trim())?n.push(`${r}: every additional model needs an ID and a label.`):new Set(a).size!==a.length&&n.push(`${r}: additional model IDs must be unique.`),i.additionalModels.filter(e=>e.isDefault).length>1&&n.push(`${r}: only one additional model can be the default.`)}return n}function pe(e){return{key:S(),id:C(),name:``,provider:e,model:``,modeId:``,thinkingOptionId:``,notes:``,rest:{}}}function me(){return{key:S(),id:C(),name:``,command:``,argsText:``,rest:{}}}function he(e){return{key:S(),provider:e,model:``,thinkingOptionId:``,rest:{}}}function ge(e,t=Date.now()){if(!e)return`never`;let n=Math.max(0,(t-Date.parse(e))/1e3);if(!Number.isFinite(n))return`unknown`;if(n<60)return`just now`;if(n<3600)return`${Math.floor(n/60)} min ago`;if(n<86400)return`${Math.floor(n/3600)} h ago`;let r=Math.floor(n/86400);return r===1?`1 day ago`:`${r} days ago`}var _e={class:`page-head`},ve={class:`grow`},ye={class:`subtle`},be={key:0},xe=[`disabled`],Se={class:`page-body`},Ce={key:0,class:`subtle hs-loading`},we={key:1,class:`ps-callout is-error`,role:`alert`},Te={class:`hs-nav`,"aria-label":`Host settings sections`},Ee=[`onClick`],De={key:0,class:`ps-callout is-warn`,role:`status`},Oe=[`disabled`],ke={class:`card`},Ae={class:`grow`},je={class:`row-title`},Me={class:`row-sub`},Ne=[`onUpdate:modelValue`,`aria-label`],Pe={key:0,class:`card-row switch-row`},Fe={key:1,class:`card-row switch-row`},Ie={key:2,class:`card-row switch-row`},Le={class:`card form-card`},Re={class:`field`},ze={key:0,class:`field`},Be={class:`hs-head`},Ve=[`disabled`],He={key:0,class:`spinner`},Ue={key:1,class:`setting-note is-error`,role:`alert`},We={class:`card`},Ge={key:0,class:`card-row subtle`},Ke={class:`card-row hs-provider-row`},qe=[`aria-expanded`,`aria-label`,`onClick`],Je={class:`grow`},Ye={class:`row-title`},Xe={key:0,class:`hs-tag`},Ze=[`disabled`,`aria-label`,`title`,`onClick`],Qe={key:0,class:`spinner`},$e=[`onClick`],et=[`checked`,`aria-label`,`onChange`],tt={key:0,class:`hs-provider-body`},nt={key:1,class:`ps-callout is-error`},rt={key:2,class:`field`},it={class:`hs-models`},at=[`title`],ot={key:0,class:`hs-tag`},st={class:`hs-actions`},ct=[`disabled`,`onClick`],lt=[`disabled`,`onClick`],ut=[`onClick`],dt={key:3,class:`hs-output-wrap`},ft={class:`hs-output`},pt=[`onClick`],mt={key:4,class:`hs-grid`},ht={class:`field`},gt=[`onUpdate:modelValue`,`aria-invalid`],_t={class:`field`},vt=[`onUpdate:modelValue`],yt=[`value`],bt={class:`field`},xt=[`onUpdate:modelValue`],St={class:`switch-row hs-inline-switch`},Ct=[`checked`,`aria-label`,`onChange`],wt={class:`field`},Tt=[`onUpdate:modelValue`,`aria-label`,`aria-invalid`],Et=[`onUpdate:modelValue`,`aria-label`,`aria-invalid`],Dt={class:`hs-check`},Ot=[`onUpdate:modelValue`],kt=[`aria-label`,`onClick`],At=[`onClick`],jt={class:`card-row hs-add`},Mt=[`onKeydown`],Nt=[`value`],Pt=[`disabled`],Ft={key:2,class:`setting-note is-error`,role:`alert`},It={class:`hs-head`},Lt={class:`card`},Rt={key:0,class:`card-row subtle`},zt=[`aria-expanded`,`onClick`],Bt={class:`grow`},Vt={class:`row-title`},Ht={class:`row-sub`},Ut={key:0,class:`hs-item-body`},Wt={class:`hs-grid`},Gt={class:`field`},Kt=[`onUpdate:modelValue`,`aria-invalid`],qt={class:`field`},Jt=[`onUpdate:modelValue`,`onChange`],Yt=[`value`],Xt=[`value`],Zt={class:`field`},Qt=[`onUpdate:modelValue`,`onChange`],$t=[`value`],en=[`value`],tn={class:`field`},nn=[`onUpdate:modelValue`],rn=[`value`],an=[`value`],on={class:`field`},sn=[`onUpdate:modelValue`],cn=[`value`],ln=[`value`],un={class:`field`},dn=[`onUpdate:modelValue`],fn={class:`hs-actions`},pn=[`disabled`,`onClick`],mn=[`disabled`,`onClick`],hn=[`onClick`],gn={class:`hs-head`},_n={class:`card`},vn={key:0,class:`card-row subtle`},yn={class:`hs-order`},bn=[`onUpdate:modelValue`,`aria-label`,`onChange`],xn=[`value`],Sn=[`value`],Cn=[`onUpdate:modelValue`,`aria-label`,`onChange`],wn=[`value`],Tn=[`value`],En=[`onUpdate:modelValue`,`aria-label`],Dn=[`value`],On=[`value`],kn={class:`hs-row-actions`},An=[`disabled`,`onClick`],jn=[`onClick`],Mn={class:`hs-head`},Nn={class:`card`},Pn={key:0,class:`card-row subtle`},Fn=[`aria-expanded`,`onClick`],In={class:`grow`},Ln={class:`row-title`},Rn={class:`row-sub hs-mono`},zn={key:0,class:`hs-item-body`},Bn={class:`hs-grid`},Vn={class:`field`},Hn=[`onUpdate:modelValue`,`aria-invalid`],Un={class:`field`},Wn=[`onUpdate:modelValue`,`aria-invalid`],Gn={class:`field`},Kn=[`onUpdate:modelValue`],qn={class:`hs-actions`},Jn=[`disabled`,`onClick`],Yn=[`disabled`,`onClick`],Xn=[`onClick`],Zn={class:`card`},Qn={class:`card-row switch-row`},$n={key:0,class:`card-row switch-row`},er={class:`card form-card`},tr={class:`field`},nr=[`value`,`disabled`],rr={key:0,class:`hs-skill-list`},ir=[`value`,`disabled`],ar={class:`hs-actions`},or=[`disabled`],sr={class:`card`},cr={key:0,class:`card-row subtle`},lr={class:`grow`},ur={class:`row-title`},dr={key:0,class:`row-sub`},fr={key:1,class:`row-sub is-error`},pr={class:`hs-row-actions`},mr=[`disabled`,`onClick`],hr=[`disabled`,`onClick`],gr=[`disabled`,`aria-label`,`onClick`],_r={key:0,class:`spinner`},vr={key:1,class:`card-row hs-add`},yr=[`disabled`],br={class:`card`},xr={class:`card-row hs-daemon`},Sr={class:`grow`},Cr={class:`row-title`},wr={class:`row-sub`},Tr={class:`hs-row-actions`},Er=[`disabled`],Dr=[`disabled`],Or=[`disabled`],kr={key:0},Ar={key:1},jr={key:4,class:`setting-note is-error`,role:`alert`},Mr={key:5,class:`hs-output`},Nr={key:0,class:`hs-savebar`,role:`region`,"aria-label":`Save host settings`},Pr={class:`hs-savebar-inner`},Fr={class:`grow hs-savebar-text`},Ir={key:0,class:`is-error`,role:`alert`},Lr={class:`is-error`},Rr={key:0,class:`subtle`},zr={key:2,class:`is-ok`,role:`status`},Br={key:3},Vr=[`disabled`],Hr=[`disabled`],j=oe(a({__name:`HostSettings`,props:{host:{},api:{type:Function}},emits:[`back`],setup(a,{emit:oe}){let b=a,le=oe,x=`/hosts/${encodeURIComponent(b.host.id)}`,S=e=>e.message||`Request failed`,C=g(null),w=g(null),T=g(``),E=g({}),D=g(``),k=g(!1),A=g(!0),j=g(``),M=g(!1),N=g(``),P=g(!1),F=g(null),Ur=m(()=>C.value&&w.value?de(C.value,w.value):{}),I=m(()=>Object.keys(Ur.value).length>0),L=m(()=>C.value&&w.value?fe(C.value,w.value):[]),Wr=m(()=>F.value?.state===`running`),Gr=m(()=>M.value||Wr.value);re(I,e=>{e&&(P.value=!1)});function Kr(e){C.value=e.config,w.value=ue(e.config),T.value=e.revision,E.value=e.features??{},e.desktopManaged!==void 0&&(k.value=e.desktopManaged),e.version&&(D.value=e.version)}async function qr(e=!0){if(!(e&&I.value&&!confirm(`Discard unsaved host settings?`))){A.value=!0,j.value=N.value=``,P.value=!1;try{Kr(await b.api(x+`/settings`))}catch(e){j.value=S(e);return}finally{A.value=!1}await Promise.all([si(),Fi(),Bi()])}}async function Jr(){if(!(!I.value||L.value.length||Gr.value)){M.value=!0,N.value=``;try{Kr(await b.api(x+`/settings`,`PATCH`,{revision:T.value,patch:Ur.value})),P.value=!0,si()}catch(e){N.value=S(e)}finally{M.value=!1}}}function Yr(){C.value&&(w.value=ue(C.value)),N.value=``}function Xr(){(!I.value||confirm(`Discard unsaved host settings?`))&&le(`back`)}function Zr(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&(e.preventDefault(),Jr())}function Qr(e){I.value&&e.preventDefault()}let $r=[[`idleRuntimeCleanup`,`Release idle agents`,`Free memory held by idle agents that can be resumed later.`,`idleRuntimeCleanupSetting`],[`resumeOnStartup`,`Resume agents after restart`,`Continue interrupted agents when the daemon starts.`,`resumeOnStartupSetting`],[`autoArchiveAfterMerge`,`Archive merged workspaces`,`Archive a workspace once its changes are merged.`,``],[`enableTerminalAgentHooks`,`Terminal agent hooks`,`Track supported agents launched from terminals.`,``],[`pluginsEnabled`,`Host plugins`,`Run the plugins configured on this host.`,`plugins`]],ei=m(()=>{let e=w.value?.values??{};return $r.filter(([t,,,n])=>n?E.value[n]:t in e)}),R=g([]),ti=g(``),ni=g(!1),z=g([]),B=g({}),V=g(null),ri=g({}),H=g([]),U=g({}),ii=g(``),ai=g(`codex`),oi=g(``);async function si(){try{R.value=await b.api(x+`/settings/providers`),ti.value=``}catch(e){ti.value=S(e)}finally{ni.value=!0}}let ci=e=>R.value.find(t=>t.id===e),li=m(()=>{let e=w.value;return e?[...R.value.map(e=>e.id),...Object.keys(e.providers).filter(e=>!ci(e))].map(t=>{let n=ci(t),r=e.providers[t],i=e.removeProviders.includes(t),a=r?.enabled??n?.enabled??!0;return{id:t,reported:n,conf:r,removed:i,enabled:a,custom:r?.extends!==void 0||n?.source===`custom`,saved:!!C.value?.providers?.[t]||!!n,label:r?.label?.trim()||n?.label||t,pendingToggle:n?a!==n.enabled:!1}}):[]});function ui(e){let t=e.reported;if(e.removed)return{text:`Removed when you save`,tone:`warn`};if(!t)return{text:`New · save to load its models`,tone:`warn`};if(e.pendingToggle)return{text:e.enabled?`Enabled when you save`:`Disabled when you save`,tone:`warn`};if(!t.enabled)return{text:`Disabled`,tone:`muted`};if(z.value.includes(e.id)||t.status===`loading`)return{text:`Loading models…`,tone:`running`};if(t.status===`unavailable`)return{text:`Not installed on this host`,tone:`muted`};if(t.status===`error`)return{text:`Could not load models`,tone:`error`};let n=t.models.length;return{text:`${n} model${n===1?``:`s`} · updated ${ge(t.fetchedAt)}`,tone:`ok`}}let di=e=>!!e.reported&&e.reported.enabled&&!e.pendingToggle&&!e.removed;async function fi(e){let t=e??R.value.filter(e=>e.enabled).map(e=>e.id);if(!t.length)return;let n=new Map(R.value.map(e=>[e.id,new Set(e.models.map(e=>e.id))]));z.value=[...z.value,...t],e||(V.value=null);try{let r=await b.api(x+`/settings/providers/refresh`,`POST`,e?{providers:e}:{},15e4);R.value=r,ti.value=``;let i=0,a=0;for(let e of t){let t=r.find(t=>t.id===e);if(!t||!t.enabled)continue;if(t.status===`error`){a++,B.value[e]={text:t.error??`Could not load models`,error:!0};continue}let o=t.models.filter(t=>!n.get(e)?.has(t.id));i+=o.length,B.value[e]={text:o.length?`New: ${o.map(e=>e.label).join(`, `)}`:`Model list is up to date`}}e||(V.value=a?{text:`${a} provider${a===1?``:`s`} could not load models.`,error:!0}:{text:i?`Found ${i} new model${i===1?``:`s`}.`:`Every model list is up to date.`})}catch(t){let n={text:`Refresh failed: `+S(t),error:!0};if(e)for(let t of e)B.value[t]=n;else V.value=n}finally{z.value=z.value.filter(e=>!t.includes(e))}}async function pi(e){H.value=[...H.value,e];try{let t=await b.api(x+`/provider-diagnostic/`+encodeURIComponent(e),`GET`,void 0,6e4);ri.value[e]=t.diagnostic??JSON.stringify(t,null,2)}catch(t){ri.value[e]=`Diagnostic failed: `+S(t)}finally{H.value=H.value.filter(t=>t!==e)}}function mi(e){delete ri.value[e]}function hi(e){return w.value.providers[e]??={commandText:``,additionalModels:[]}}function gi(e){U.value[e]||hi(e),U.value[e]=!U.value[e]}function _i(e,t){let n=hi(e.id);C.value?.providers?.[e.id]?.enabled===void 0&&e.reported&&t===e.reported.enabled?delete n.enabled:n.enabled=t}function vi(e,t){let n=hi(e);n.paseoTools={...n.paseoTools,enabled:t}}function yi(){let e=ii.value.trim();oi.value=``,ce.test(e)?li.value.some(t=>t.id===e)?oi.value=`${e} already exists on this host.`:(w.value.providers[e]={extends:ai.value,label:e,enabled:!0,commandText:``,additionalModels:[]},U.value[e]=!0,ii.value=``):oi.value=`Use lowercase letters, digits and hyphens, starting with a letter.`}function bi(e){let t=w.value;e.saved?confirm(`Remove ${e.label} from this host when you save? Metadata generation stops using it.`)&&(t.removeProviders.push(e.id),t.metadataProviders&&=t.metadataProviders.filter(t=>t.provider!==e.id),U.value[e.id]=!1):delete t.providers[e.id]}function xi(e){let t=w.value;t.removeProviders=t.removeProviders.filter(t=>t!==e),C.value&&(t.metadataProviders=ue(C.value).metadataProviders)}let W=m(()=>li.value.filter(e=>!e.removed&&e.enabled).map(e=>({id:e.id,label:e.label}))),G=e=>ci(e)?.models??[],Si=e=>ci(e)?.modes??[];function K(e,t){let n=G(e);return(n.find(e=>e.id===t)??n.find(e=>e.isDefault)??n[0])?.thinking??[]}let Ci=(e,t)=>e.find(e=>e.id===t)?.label??t;function wi(e){e.model=e.thinkingOptionId=``,e.modeId!==void 0&&(e.modeId=``)}function Ti(e){e.thinkingOptionId&&!K(e.provider,e.model).some(t=>t.id===e.thinkingOptionId)&&(e.thinkingOptionId=``)}let q=g({});function Ei(e,t,n){let r=t+n;r>=0&&r<e.length&&([e[t],e[r]]=[e[r],e[t]])}function Di(){let e=pe(W.value[0]?.id??`codex`);(w.value.agentProfiles??=[]).push(e),q.value[e.key]=!0}function Oi(){let e=me();(w.value.terminalProfiles??=[]).push(e),q.value[e.key]=!0}function ki(){(w.value.metadataProviders??=[]).push(he(W.value[0]?.id??`codex`))}function Ai(e,t,n){let r=e[t]?.name?.trim();(!r||confirm(`Remove ${n} ${r}?`))&&e.splice(t,1)}function ji(e){let t=[Ci(W.value,e.provider)||`No provider`,e.model?Ci(G(e.provider),e.model):`Default model`];return e.thinkingOptionId&&t.push(Ci(K(e.provider,e.model),e.thinkingOptionId)),e.modeId&&t.push(Ci(Si(e.provider),e.modeId)),t.join(` · `)}let J=g(null),Mi=g(``),Y=g(!1),X=g(null),Ni=m(()=>!!J.value&&O(Pi())!==Mi.value);function Pi(){let e=J.value.selection;return e.mode===`all`?{mode:`all`}:{mode:`custom`,skills:[...e.skills??[]].sort()}}async function Fi(){if(E.value.skillManagement)try{J.value=await b.api(x+`/skills`),Mi.value=O(Pi())}catch(e){X.value={text:S(e),error:!0}}}function Ii(e){J.value.selection=e===`custom`?{mode:e,skills:J.value.selection.skills??[...J.value.installed]}:{mode:e}}async function Li(){Y.value=!0,X.value=null;try{let e=await b.api(x+`/skills`,`PUT`,{selection:Pi()});if(e.confirmationRequired){if(!confirm(`Remove these Paseo skills from this host? `+e.confirmationRequired.removals.join(`, `)))return;e=await b.api(x+`/skills`,`PUT`,{selection:Pi(),confirmedRemovals:e.confirmationRequired.removals})}J.value=e,Mi.value=O(Pi()),X.value={text:`Skill selection applied.`}}catch(e){X.value={text:S(e),error:!0}}finally{Y.value=!1}}let Ri=g([]),Z=g(``),Q=g(null),$=g(null),zi=m(()=>!!E.value.pluginManagement);async function Bi(){if(zi.value)try{Ri.value=await b.api(x+`/plugins`)}catch(e){$.value={text:S(e),error:!0}}}async function Vi(e,t){let n=Ri.value.find(t=>t.id===e)?.name??e;if(t!==`remove`||confirm(`Remove plugin ${n} from this host?`)){Q.value=e||`install`,$.value=null;try{await b.api(x+`/plugins`+(e?`/`+encodeURIComponent(e)+`/`+t:``),`POST`,e?{}:{source:Z.value.trim()},12e4),e||(Z.value=``),$.value={text:e?`${n}: ${t===`remove`?`removed`:t+`d`}.`:`Plugin installed.`},Ri.value=await b.api(x+`/plugins`)}catch(e){$.value={text:S(e),error:!0}}finally{Q.value=null}}}let Hi=g(``),Ui=g(!1),Wi=g(``),Gi,Ki=!1;async function qi(){clearTimeout(Gi);try{let e=await b.api(x+`/lifecycle`);if(Ki)return;let t=F.value?.state===`running`;F.value=e,e?.state===`running`?Gi=setTimeout(()=>void qi(),2e3):t&&e?.state===`complete`&&(e.version&&(D.value=e.version),I.value||qr(!1))}catch{Ki||(Wi.value=`Could not check the operation. Reopen this page to see its outcome.`)}}async function Ji(e){if(confirm(`${e===`restart`?`Restart`:`Update and restart`} the daemon on ${b.host.label}? Running agents may be interrupted and the host disconnects briefly.`)){Wi.value=``;try{F.value=await b.api(x+`/lifecycle/`+e,`POST`,{}),qi()}catch(e){Wi.value=S(e)+`. Check the host's status before retrying.`}}}async function Yi(){if(Hi.value)Hi.value=``;else{Ui.value=!0;try{Hi.value=JSON.stringify(await b.api(x+`/status`),null,2)}catch(e){Wi.value=S(e)}finally{Ui.value=!1}}}let Xi=m(()=>[[`general`,`General`,!0],[`providers`,`Providers`,!0],[`profiles`,`Agent profiles`,!!E.value.agentProfiles],[`metadata`,`Metadata`,!!w.value?.metadataProviders],[`terminals`,`Terminals`,!0],[`skills`,`Skills`,!!J.value],[`plugins`,`Plugins`,zi.value],[`relay`,`Relay`,!!w.value?.values.relay&&!!E.value.relayConfig],[`daemon`,`Daemon`,!0]].filter(([,,e])=>e));function Zi(e){document.getElementById(`hs-`+e)?.scrollIntoView({behavior:`smooth`,block:`start`})}return t(()=>{window.addEventListener(`beforeunload`,Qr),qr(!1),qi()}),n(()=>{Ki=!0,clearTimeout(Gi),window.removeEventListener(`beforeunload`,Qr)}),(t,n)=>(r(),v(`section`,{class:`page host-settings`,onKeydown:Zr},[p(`header`,_e,[p(`button`,{class:`icon-btn`,"aria-label":`Back to hosts`,onClick:Xr},[e(y,{name:`back`,size:18})]),p(`div`,ve,[p(`h1`,null,d(a.host.label),1),p(`p`,ye,[n[21]||=i(` Host settings · apply to every client of this daemon`,-1),D.value?(r(),v(`span`,be,` · Paseo `+d(D.value),1)):_(``,!0)])]),p(`button`,{class:`btn btn-outline btn-sm hs-reload`,disabled:A.value||Gr.value,onClick:n[0]||=e=>qr()},[e(y,{name:`refresh`,size:13}),n[22]||=i(`Reload `,-1)],8,xe)]),p(`div`,Se,[A.value&&!w.value?(r(),v(`p`,Ce,[...n[23]||=[p(`span`,{class:`spinner`},null,-1),i(` Reading host settings…`,-1)]])):j.value?(r(),v(`div`,we,[p(`p`,null,[e(y,{name:`alert`,size:14}),i(`Could not read this host's settings: `+d(j.value),1)]),p(`button`,{class:`btn btn-outline`,onClick:n[1]||=e=>qr(!1)},`Try again`)])):_(``,!0),w.value&&!j.value?(r(),v(f,{key:2},[p(`nav`,Te,[(r(!0),v(f,null,o(Xi.value,([e,t])=>(r(),v(`button`,{key:e,type:`button`,class:`hs-chip`,onClick:t=>Zi(e)},d(t),9,Ee))),128))]),Wr.value?(r(),v(`div`,De,[p(`p`,null,[n[24]||=p(`span`,{class:`spinner`},null,-1),i(d(F.value.phase)+`… settings are locked until the daemon is back.`,1)])])):_(``,!0),p(`fieldset`,{disabled:Gr.value,class:`hs-fields`},[n[68]||=p(`h2`,{id:`hs-general`,class:`section-label`},`General`,-1),p(`div`,ke,[(r(!0),v(f,null,o(ei.value,([e,t,n])=>(r(),v(`label`,{key:e,class:`card-row switch-row`},[p(`div`,Ae,[p(`div`,je,d(t),1),p(`div`,Me,d(n),1)]),s(p(`input`,{"onUpdate:modelValue":t=>w.value.values[e]=t,type:`checkbox`,class:`switch`,"aria-label":t},null,8,Ne),[[c,w.value.values[e]]])]))),128)),w.value.values.mcp?(r(),v(`label`,Pe,[n[25]||=p(`div`,{class:`grow`},[p(`div`,{class:`row-title`},`Paseo orchestration tools`),p(`div`,{class:`row-sub`},`Give agents Paseo's tools for starting and managing other agents.`)],-1),s(p(`input`,{"onUpdate:modelValue":n[2]||=e=>w.value.values.mcp.injectIntoAgents=e,type:`checkbox`,class:`switch`,"aria-label":`Paseo orchestration tools`},null,512),[[c,w.value.values.mcp.injectIntoAgents]])])):_(``,!0),w.value.values.browserTools?(r(),v(`label`,Fe,[n[26]||=p(`div`,{class:`grow`},[p(`div`,{class:`row-title`},`Browser tools`),p(`div`,{class:`row-sub`},`Let agents automate a browser on this host.`)],-1),s(p(`input`,{"onUpdate:modelValue":n[3]||=e=>w.value.values.browserTools.enabled=e,type:`checkbox`,class:`switch`,"aria-label":`Browser tools`},null,512),[[c,w.value.values.browserTools.enabled]])])):_(``,!0),w.value.values.usage?(r(),v(`label`,Ie,[n[27]||=p(`div`,{class:`grow`},[p(`div`,{class:`row-title`},`Provider usage`),p(`div`,{class:`row-sub`},`Collect usage limits from providers for the usage panel.`)],-1),s(p(`input`,{"onUpdate:modelValue":n[4]||=e=>w.value.values.usage.enabled=e,type:`checkbox`,class:`switch`,"aria-label":`Provider usage`},null,512),[[c,w.value.values.usage.enabled]])])):_(``,!0)]),p(`div`,Le,[p(`label`,Re,[n[28]||=p(`span`,null,`Additional system instructions`,-1),s(p(`textarea`,{"onUpdate:modelValue":n[5]||=e=>w.value.values.appendSystemPrompt=e,rows:`4`,placeholder:`Appended to every agent's instructions on this host`},null,512),[[u,w.value.values.appendSystemPrompt]])]),E.value.resumeOnStartupSetting?(r(),v(`label`,ze,[n[29]||=p(`span`,null,`Restart recovery prompt`,-1),s(p(`textarea`,{"onUpdate:modelValue":n[6]||=e=>w.value.values.resumePrompt=e,rows:`2`,placeholder:`Sent to agents resumed after a restart`},null,512),[[u,w.value.values.resumePrompt]])])):_(``,!0)]),p(`div`,Be,[n[30]||=p(`h2`,{id:`hs-providers`,class:`section-label`},`Providers`,-1),p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:!!z.value.length||!R.value.some(e=>e.enabled),onClick:n[7]||=e=>fi()},[z.value.length?(r(),v(`span`,He)):(r(),ee(y,{key:1,name:`refresh`,size:13})),i(` `+d(z.value.length?`Refreshing…`:`Refresh models`),1)],8,Ve)]),n[69]||=p(`p`,{class:`subtle hs-hint`},` The daemon caches each provider's model list. Refresh to pick up models released since it last checked. `,-1),V.value?(r(),v(`p`,{key:0,class:l([`setting-note`,{"is-error":V.value.error}]),role:`status`},d(V.value.text),3)):_(``,!0),ti.value?(r(),v(`p`,Ue,`Could not read providers: `+d(ti.value),1)):_(``,!0),p(`div`,We,[ni.value?_(``,!0):(r(),v(`p`,Ge,[...n[31]||=[p(`span`,{class:`spinner`},null,-1),i(` Reading providers…`,-1)]])),(r(!0),v(f,null,o(li.value,t=>(r(),v(`div`,{key:t.id,class:l([`hs-provider`,{"is-open":U.value[t.id],"is-removed":t.removed}])},[p(`div`,Ke,[p(`button`,{type:`button`,class:`hs-provider-main`,"aria-expanded":!!U.value[t.id],"aria-label":(U.value[t.id]?`Collapse `:`Configure `)+t.label,onClick:e=>gi(t.id)},[e(ae,{provider:t.conf?.extends??t.id},null,8,[`provider`]),p(`span`,Je,[p(`span`,Ye,[i(d(t.label),1),t.custom?(r(),v(`span`,Xe,`custom`)):_(``,!0)]),p(`span`,{class:l([`row-sub hs-status`,`is-`+ui(t).tone])},d(ui(t).text),3)]),e(y,{name:`chevron`,size:15,class:`hs-chevron`})],8,qe),di(t)?(r(),v(`button`,{key:0,type:`button`,class:`icon-btn`,disabled:z.value.includes(t.id),"aria-label":`Refresh `+t.label+` models`,title:`Refresh `+t.label+` models`,onClick:e=>fi([t.id])},[z.value.includes(t.id)?(r(),v(`span`,Qe)):(r(),ee(y,{key:1,name:`refresh`,size:15}))],8,Ze)):_(``,!0),t.removed?(r(),v(`button`,{key:1,type:`button`,class:`btn btn-outline btn-sm`,onClick:e=>xi(t.id)},`Undo`,8,$e)):(r(),v(`input`,{key:2,type:`checkbox`,class:`switch`,checked:t.enabled,"aria-label":`Enable `+t.label,onChange:e=>_i(t,e.target.checked)},null,40,et))]),U.value[t.id]&&t.conf&&!t.removed?(r(),v(`div`,tt,[B.value[t.id]?(r(),v(`p`,{key:0,class:l([`setting-note`,{"is-error":B.value[t.id].error}]),role:`status`},d(B.value[t.id].text),3)):_(``,!0),t.reported?.status===`error`&&t.reported.error?(r(),v(`div`,nt,[p(`p`,null,[e(y,{name:`alert`,size:14}),i(d(t.reported.error),1)])])):_(``,!0),t.reported?.models.length?(r(),v(`div`,rt,[n[32]||=p(`span`,null,`Models reported by the host`,-1),p(`ul`,it,[(r(!0),v(f,null,o(t.reported.models,e=>(r(),v(`li`,{key:e.id,title:e.description||e.id},[i(d(e.label),1),e.isDefault?(r(),v(`span`,ot,`default`)):_(``,!0)],8,at))),128))])])):_(``,!0),p(`div`,st,[di(t)?(r(),v(`button`,{key:0,type:`button`,class:`btn btn-outline btn-sm`,disabled:z.value.includes(t.id),onClick:e=>fi([t.id])},[e(y,{name:`refresh`,size:13}),i(d(z.value.includes(t.id)?`Refreshing…`:`Refresh models`),1)],8,ct)):_(``,!0),t.reported?(r(),v(`button`,{key:1,type:`button`,class:`btn btn-outline btn-sm`,disabled:H.value.includes(t.id),onClick:e=>pi(t.id)},d(H.value.includes(t.id)?`Checking…`:`Run diagnostic`),9,lt)):_(``,!0),t.custom&&(!t.saved||E.value.providerRemoval)?(r(),v(`button`,{key:2,type:`button`,class:`btn btn-outline btn-sm hs-danger`,onClick:e=>bi(t)},[e(y,{name:`trash`,size:13}),n[33]||=i(`Remove provider `,-1)],8,ut)):_(``,!0)]),ri.value[t.id]?(r(),v(`div`,dt,[p(`pre`,ft,d(ri.value[t.id]),1),p(`button`,{type:`button`,class:`link-btn`,onClick:e=>mi(t.id)},`Hide diagnostic`,8,pt)])):_(``,!0),t.conf.extends===void 0?_(``,!0):(r(),v(`div`,mt,[p(`label`,ht,[n[34]||=p(`span`,null,`Display name`,-1),s(p(`input`,{"onUpdate:modelValue":e=>t.conf.label=e,"aria-invalid":!t.conf.label?.trim()},null,8,gt),[[u,t.conf.label]])]),p(`label`,_t,[n[35]||=p(`span`,null,`Based on`,-1),s(p(`select`,{"onUpdate:modelValue":e=>t.conf.extends=e,"aria-label":`Based on`},[(r(!0),v(f,null,o(ne(se),e=>(r(),v(`option`,{key:e,value:e},d(e),9,yt))),128))],8,vt),[[h,t.conf.extends]])])])),p(`label`,bt,[n[36]||=p(`span`,null,[i(`Command override `),p(`small`,{class:`subtle`},`· optional, one argument per line`)],-1),s(p(`textarea`,{"onUpdate:modelValue":e=>t.conf.commandText=e,rows:`2`,class:`hs-mono`,spellcheck:`false`,placeholder:`Uses the provider's default command`},null,8,xt),[[u,t.conf.commandText]])]),p(`label`,St,[n[37]||=p(`span`,{class:`grow`},[p(`span`,{class:`row-title`},`Paseo tools`),p(`span`,{class:`row-sub`},`Offer Paseo's orchestration tools to agents of this provider.`)],-1),p(`input`,{type:`checkbox`,class:`switch`,checked:t.conf.paseoTools?.enabled!==!1,"aria-label":`Paseo tools for `+t.label,onChange:e=>vi(t.id,e.target.checked)},null,40,Ct)]),p(`div`,wt,[n[40]||=p(`span`,null,[i(`Additional models `),p(`small`,{class:`subtle`},`· offered even if the provider does not list them`)],-1),(r(!0),v(f,null,o(t.conf.additionalModels,(a,o)=>(r(),v(`div`,{key:o,class:`hs-model-row`},[s(p(`input`,{"onUpdate:modelValue":e=>a.id=e,placeholder:`Model ID`,"aria-label":`Model ID `+(o+1),"aria-invalid":!a.id.trim()},null,8,Tt),[[u,a.id]]),s(p(`input`,{"onUpdate:modelValue":e=>a.label=e,placeholder:`Label`,"aria-label":`Model label `+(o+1),"aria-invalid":!a.label.trim()},null,8,Et),[[u,a.label]]),p(`label`,Dt,[s(p(`input`,{"onUpdate:modelValue":e=>a.isDefault=e,type:`checkbox`},null,8,Ot),[[c,a.isDefault]]),n[38]||=i(`Default`,-1)]),p(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Remove model `+(a.id||o+1),onClick:e=>t.conf.additionalModels.splice(o,1)},[e(y,{name:`close`,size:14})],8,kt)]))),128)),p(`button`,{type:`button`,class:`link-btn`,onClick:e=>t.conf.additionalModels.push({id:``,label:``,isDefault:!1,rest:{}})},[e(y,{name:`plus`,size:13}),n[39]||=i(`Add model `,-1)],8,At)])])):_(``,!0)],2))),128)),p(`div`,jt,[s(p(`input`,{"onUpdate:modelValue":n[8]||=e=>ii.value=e,placeholder:`New custom provider ID, e.g. my-codex`,"aria-label":`New custom provider ID`,onKeydown:ie(te(yi,[`prevent`]),[`enter`])},null,40,Mt),[[u,ii.value]]),s(p(`select`,{"onUpdate:modelValue":n[9]||=e=>ai.value=e,"aria-label":`New provider based on`},[(r(!0),v(f,null,o(ne(se),e=>(r(),v(`option`,{key:e,value:e},`based on `+d(e),9,Nt))),128))],512),[[h,ai.value]]),p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:!ii.value.trim(),onClick:yi},`Add`,8,Pt)])]),oi.value?(r(),v(`p`,Ft,d(oi.value),1)):_(``,!0),E.value.agentProfiles?(r(),v(f,{key:3},[p(`div`,It,[n[42]||=p(`h2`,{id:`hs-profiles`,class:`section-label`},`Agent profiles`,-1),p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,onClick:Di},[e(y,{name:`plus`,size:13}),n[41]||=i(`Add agent profile`,-1)])]),n[53]||=p(`p`,{class:`subtle hs-hint`},`Named launch settings, also offered to orchestrating agents.`,-1),p(`div`,Lt,[w.value.agentProfiles?.length?_(``,!0):(r(),v(`p`,Rt,`No agent profiles yet.`)),(r(!0),v(f,null,o(w.value.agentProfiles??[],(t,a)=>(r(),v(`div`,{key:t.key,class:l([`hs-item`,{"is-open":q.value[t.key]}])},[p(`button`,{type:`button`,class:`card-row hs-item-head`,"aria-expanded":!!q.value[t.key],onClick:e=>q.value[t.key]=!q.value[t.key]},[p(`span`,Bt,[p(`span`,Vt,d(t.name.trim()||`Untitled profile`),1),p(`span`,Ht,d(ji(t)),1)]),e(y,{name:`chevron`,size:15,class:`hs-chevron`})],8,zt),q.value[t.key]?(r(),v(`div`,Ut,[p(`div`,Wt,[p(`label`,Gt,[n[43]||=p(`span`,null,`Name`,-1),s(p(`input`,{"onUpdate:modelValue":e=>t.name=e,"aria-invalid":!t.name.trim(),placeholder:`Review`},null,8,Kt),[[u,t.name]])]),p(`label`,qt,[n[44]||=p(`span`,null,`Provider`,-1),s(p(`select`,{"onUpdate:modelValue":e=>t.provider=e,"aria-label":`Provider`,onChange:e=>wi(t)},[t.provider&&!W.value.some(e=>e.id===t.provider)?(r(),v(`option`,{key:0,value:t.provider},d(t.provider)+` (not enabled)`,9,Yt)):_(``,!0),(r(!0),v(f,null,o(W.value,e=>(r(),v(`option`,{key:e.id,value:e.id},d(e.label),9,Xt))),128))],40,Jt),[[h,t.provider]])]),p(`label`,Zt,[n[46]||=p(`span`,null,`Model`,-1),s(p(`select`,{"onUpdate:modelValue":e=>t.model=e,"aria-label":`Model`,onChange:e=>Ti(t)},[n[45]||=p(`option`,{value:``},`Provider default`,-1),t.model&&!G(t.provider).some(e=>e.id===t.model)?(r(),v(`option`,{key:0,value:t.model},d(t.model)+` (not reported)`,9,$t)):_(``,!0),(r(!0),v(f,null,o(G(t.provider),e=>(r(),v(`option`,{key:e.id,value:e.id},d(e.label),9,en))),128))],40,Qt),[[h,t.model]])]),p(`label`,tn,[n[48]||=p(`span`,null,`Thinking`,-1),s(p(`select`,{"onUpdate:modelValue":e=>t.thinkingOptionId=e,"aria-label":`Thinking`},[n[47]||=p(`option`,{value:``},`Model default`,-1),t.thinkingOptionId&&!K(t.provider,t.model).some(e=>e.id===t.thinkingOptionId)?(r(),v(`option`,{key:0,value:t.thinkingOptionId},d(t.thinkingOptionId)+` (not reported) `,9,rn)):_(``,!0),(r(!0),v(f,null,o(K(t.provider,t.model),e=>(r(),v(`option`,{key:e.id,value:e.id},d(e.label),9,an))),128))],8,nn),[[h,t.thinkingOptionId]])]),p(`label`,on,[n[50]||=p(`span`,null,`Mode`,-1),s(p(`select`,{"onUpdate:modelValue":e=>t.modeId=e,"aria-label":`Mode`},[n[49]||=p(`option`,{value:``},`Provider default`,-1),t.modeId&&!Si(t.provider).some(e=>e.id===t.modeId)?(r(),v(`option`,{key:0,value:t.modeId},d(t.modeId)+` (not reported)`,9,cn)):_(``,!0),(r(!0),v(f,null,o(Si(t.provider),e=>(r(),v(`option`,{key:e.id,value:e.id},d(e.label),9,ln))),128))],8,sn),[[h,t.modeId]])])]),p(`label`,un,[n[51]||=p(`span`,null,`When to use`,-1),s(p(`textarea`,{"onUpdate:modelValue":e=>t.notes=e,rows:`4`,placeholder:`Shown to orchestrating agents choosing a profile`},null,8,dn),[[u,t.notes]])]),p(`div`,fn,[p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:a===0,onClick:e=>Ei(w.value.agentProfiles,a,-1)},`Move up`,8,pn),p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:a===w.value.agentProfiles.length-1,onClick:e=>Ei(w.value.agentProfiles,a,1)},` Move down `,8,mn),p(`button`,{type:`button`,class:`btn btn-outline btn-sm hs-danger`,onClick:e=>Ai(w.value.agentProfiles,a,`agent profile`)},[e(y,{name:`trash`,size:13}),n[52]||=i(`Remove `,-1)],8,hn)])])):_(``,!0)],2))),128))])],64)):_(``,!0),w.value.metadataProviders?(r(),v(f,{key:4},[p(`div`,gn,[n[55]||=p(`h2`,{id:`hs-metadata`,class:`section-label`},`Metadata generation`,-1),p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,onClick:ki},[e(y,{name:`plus`,size:13}),n[54]||=i(`Add provider`,-1)])]),n[58]||=p(`p`,{class:`subtle hs-hint`},`Providers tried in order for branch names, commit messages and pull requests. None: Paseo picks automatically.`,-1),p(`div`,_n,[w.value.metadataProviders.length?_(``,!0):(r(),v(`p`,vn,`Automatic selection.`)),(r(!0),v(f,null,o(w.value.metadataProviders,(t,i)=>(r(),v(`div`,{key:t.key,class:`card-row hs-meta-row`},[p(`span`,yn,d(i+1),1),s(p(`select`,{"onUpdate:modelValue":e=>t.provider=e,"aria-label":`Metadata provider `+(i+1),onChange:e=>wi(t)},[t.provider&&!W.value.some(e=>e.id===t.provider)?(r(),v(`option`,{key:0,value:t.provider},d(t.provider)+` (not enabled)`,9,xn)):_(``,!0),(r(!0),v(f,null,o(W.value,e=>(r(),v(`option`,{key:e.id,value:e.id},d(e.label),9,Sn))),128))],40,bn),[[h,t.provider]]),s(p(`select`,{"onUpdate:modelValue":e=>t.model=e,"aria-label":`Metadata model `+(i+1),onChange:e=>Ti(t)},[n[56]||=p(`option`,{value:``},`Default model`,-1),t.model&&!G(t.provider).some(e=>e.id===t.model)?(r(),v(`option`,{key:0,value:t.model},d(t.model)+` (not reported)`,9,wn)):_(``,!0),(r(!0),v(f,null,o(G(t.provider),e=>(r(),v(`option`,{key:e.id,value:e.id},d(e.label),9,Tn))),128))],40,Cn),[[h,t.model]]),s(p(`select`,{"onUpdate:modelValue":e=>t.thinkingOptionId=e,"aria-label":`Metadata thinking `+(i+1)},[n[57]||=p(`option`,{value:``},`Default thinking`,-1),t.thinkingOptionId&&!K(t.provider,t.model).some(e=>e.id===t.thinkingOptionId)?(r(),v(`option`,{key:0,value:t.thinkingOptionId},d(t.thinkingOptionId),9,Dn)):_(``,!0),(r(!0),v(f,null,o(K(t.provider,t.model),e=>(r(),v(`option`,{key:e.id,value:e.id},d(e.label),9,On))),128))],8,En),[[h,t.thinkingOptionId]]),p(`span`,kn,[p(`button`,{type:`button`,class:`icon-btn hs-up`,disabled:i===0,"aria-label":`Move up`,title:`Move up`,onClick:e=>Ei(w.value.metadataProviders,i,-1)},[e(y,{name:`chevron`,size:14})],8,An),p(`button`,{type:`button`,class:`icon-btn`,"aria-label":`Remove`,title:`Remove`,onClick:e=>w.value.metadataProviders.splice(i,1)},[e(y,{name:`close`,size:14})],8,jn)])]))),128))])],64)):_(``,!0),p(`div`,Mn,[n[60]||=p(`h2`,{id:`hs-terminals`,class:`section-label`},`Terminal profiles`,-1),p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,onClick:Oi},[e(y,{name:`plus`,size:13}),n[59]||=i(`Add terminal profile`,-1)])]),n[70]||=p(`p`,{class:`subtle hs-hint`},`Commands offered when opening a new terminal on this host.`,-1),p(`div`,Nn,[w.value.terminalProfiles?.length?_(``,!0):(r(),v(`p`,Pn,`No terminal profiles yet.`)),(r(!0),v(f,null,o(w.value.terminalProfiles??[],(t,a)=>(r(),v(`div`,{key:t.key,class:l([`hs-item`,{"is-open":q.value[t.key]}])},[p(`button`,{type:`button`,class:`card-row hs-item-head`,"aria-expanded":!!q.value[t.key],onClick:e=>q.value[t.key]=!q.value[t.key]},[p(`span`,In,[p(`span`,Ln,d(t.name.trim()||`Untitled terminal`),1),p(`span`,Rn,d([t.command,...t.argsText.split(`
|
|
5
|
+
`)].filter(e=>e.trim()).join(` `)||`No command`),1)]),e(y,{name:`chevron`,size:15,class:`hs-chevron`})],8,Fn),q.value[t.key]?(r(),v(`div`,zn,[p(`div`,Bn,[p(`label`,Vn,[n[61]||=p(`span`,null,`Name`,-1),s(p(`input`,{"onUpdate:modelValue":e=>t.name=e,"aria-invalid":!t.name.trim(),placeholder:`Shell`},null,8,Hn),[[u,t.name]])]),p(`label`,Un,[n[62]||=p(`span`,null,`Command`,-1),s(p(`input`,{"onUpdate:modelValue":e=>t.command=e,class:`hs-mono`,"aria-invalid":!t.command.trim(),placeholder:`/bin/bash`,spellcheck:`false`},null,8,Wn),[[u,t.command]])])]),p(`label`,Gn,[n[63]||=p(`span`,null,[i(`Arguments `),p(`small`,{class:`subtle`},`· one per line`)],-1),s(p(`textarea`,{"onUpdate:modelValue":e=>t.argsText=e,rows:`2`,class:`hs-mono`,spellcheck:`false`},null,8,Kn),[[u,t.argsText]])]),p(`div`,qn,[p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:a===0,onClick:e=>Ei(w.value.terminalProfiles,a,-1)},`Move up`,8,Jn),p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:a===w.value.terminalProfiles.length-1,onClick:e=>Ei(w.value.terminalProfiles,a,1)},` Move down `,8,Yn),p(`button`,{type:`button`,class:`btn btn-outline btn-sm hs-danger`,onClick:e=>Ai(w.value.terminalProfiles,a,`terminal profile`)},[e(y,{name:`trash`,size:13}),n[64]||=i(`Remove `,-1)],8,Xn)])])):_(``,!0)],2))),128))]),w.value.values.relay&&E.value.relayConfig?(r(),v(f,{key:5},[n[67]||=p(`h2`,{id:`hs-relay`,class:`section-label`},`Relay`,-1),p(`div`,Zn,[p(`label`,Qn,[n[65]||=p(`div`,{class:`grow`},[p(`div`,{class:`row-title`},`Relay connections`),p(`div`,{class:`row-sub`},`Reach this host through Paseo's relay. Turning it off disconnects relay clients.`)],-1),s(p(`input`,{"onUpdate:modelValue":n[10]||=e=>w.value.values.relay.enabled=e,type:`checkbox`,class:`switch`,"aria-label":`Relay connections`},null,512),[[c,w.value.values.relay.enabled]])]),w.value.values.relay.requireProtectedSecurity===void 0?_(``,!0):(r(),v(`label`,$n,[n[66]||=p(`div`,{class:`grow`},[p(`div`,{class:`row-title`},`Require protected relay sessions`),p(`div`,{class:`row-sub`},`Admit only relay sessions with end-to-end endpoint security.`)],-1),s(p(`input`,{"onUpdate:modelValue":n[11]||=e=>w.value.values.relay.requireProtectedSecurity=e,type:`checkbox`,class:`switch`,"aria-label":`Require protected relay sessions`},null,512),[[c,w.value.values.relay.requireProtectedSecurity]])]))])],64)):_(``,!0)],8,Oe),J.value?(r(),v(f,{key:1},[n[72]||=p(`h2`,{id:`hs-skills`,class:`section-label`},`Paseo skills`,-1),n[73]||=p(`p`,{class:`subtle hs-hint`},`Skills Paseo installs for agents on this host. Applied immediately, separately from Save.`,-1),p(`div`,er,[p(`label`,tr,[p(`span`,null,`Installed skills · `+d(J.value.state),1),p(`select`,{value:J.value.selection.mode,disabled:Y.value,onChange:n[12]||=e=>Ii(e.target.value)},[...n[71]||=[p(`option`,{value:`all`},`All Paseo skills`,-1),p(`option`,{value:`custom`},`Only the skills I choose`,-1)]],40,nr)]),J.value.selection.mode===`custom`?(r(),v(`div`,rr,[(r(!0),v(f,null,o(J.value.available,e=>(r(),v(`label`,{key:e,class:`hs-check`},[s(p(`input`,{"onUpdate:modelValue":n[13]||=e=>J.value.selection.skills=e,type:`checkbox`,value:e,disabled:Y.value},null,8,ir),[[c,J.value.selection.skills]]),i(d(e),1)]))),128))])):_(``,!0),p(`div`,ar,[p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:!Ni.value||Y.value,onClick:Li},d(Y.value?`Applying…`:`Apply skill selection`),9,or),X.value?(r(),v(`span`,{key:0,class:l([`setting-note`,{"is-error":X.value.error}]),role:`status`},d(X.value.text),3)):_(``,!0)])])],64)):_(``,!0),zi.value?(r(),v(f,{key:2},[n[74]||=p(`h2`,{id:`hs-plugins`,class:`section-label`},`Host plugins`,-1),n[75]||=p(`p`,{class:`subtle hs-hint`},`Plugin code runs on this host with its user's permissions. Actions apply immediately.`,-1),$.value?(r(),v(`p`,{key:0,class:l([`setting-note`,{"is-error":$.value.error}]),role:`status`},d($.value.text),3)):_(``,!0),p(`div`,sr,[Ri.value.length?_(``,!0):(r(),v(`p`,cr,`No plugins installed.`)),(r(!0),v(f,null,o(Ri.value,e=>(r(),v(`div`,{key:e.id,class:`card-row hs-plugin`},[p(`div`,lr,[p(`div`,ur,[i(d(e.name??e.id)+` `,1),p(`span`,{class:l([`badge`,{"is-error":e.status===`error`||e.error,"is-running":e.status===`running`}])},d(e.status),3)]),e.description?(r(),v(`div`,dr,d(e.description),1)):_(``,!0),e.error?(r(),v(`div`,fr,d(e.error),1)):_(``,!0)]),p(`div`,pr,[p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:!!Q.value,onClick:t=>Vi(e.id,e.enabled?`disable`:`enable`)},d(e.enabled?`Disable`:`Enable`),9,mr),p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:!!Q.value,onClick:t=>Vi(e.id,`reload`)},`Reload`,8,hr),p(`button`,{type:`button`,class:`icon-btn hs-danger`,disabled:!!Q.value,"aria-label":`Remove `+(e.name??e.id),title:`Remove`,onClick:t=>Vi(e.id,`remove`)},[Q.value===e.id?(r(),v(`span`,_r)):(r(),ee(y,{key:1,name:`trash`,size:14}))],8,gr)])]))),128)),E.value.pluginSourceInstallation?(r(),v(`div`,vr,[s(p(`input`,{"onUpdate:modelValue":n[14]||=e=>Z.value=e,placeholder:`npm package, Git URL or host directory`,"aria-label":`Install trusted plugin`,onKeydown:n[15]||=ie(te(e=>Z.value.trim()&&Vi(``,`install`),[`prevent`]),[`enter`])},null,544),[[u,Z.value]]),p(`button`,{type:`button`,class:`btn btn-outline btn-sm`,disabled:!Z.value.trim()||!!Q.value,onClick:n[16]||=e=>Vi(``,`install`)},d(Q.value===`install`?`Installing…`:`Install`),9,yr)])):_(``,!0)])],64)):_(``,!0),n[76]||=p(`h2`,{id:`hs-daemon`,class:`section-label`},`Daemon`,-1),p(`div`,br,[p(`div`,xr,[p(`div`,Sr,[p(`div`,Cr,`Paseo `+d(D.value||`version unknown`),1),p(`div`,wr,[k.value?(r(),v(f,{key:0},[i(`Managed by Paseo Desktop. Update it through Desktop.`)],64)):E.value.daemonSelfUpdate?I.value?(r(),v(f,{key:2},[i(`Save or discard your changes before restarting.`)],64)):(r(),v(f,{key:3},[i(`Restarting interrupts running agents briefly.`)],64)):(r(),v(f,{key:1},[i(`This installation cannot update itself remotely.`)],64))])]),p(`div`,Tr,[E.value.daemonStatusRpc?(r(),v(`button`,{key:0,type:`button`,class:`btn btn-outline btn-sm`,disabled:Ui.value,onClick:Yi},d(Hi.value?`Hide status`:`Status`),9,Er)):_(``,!0),E.value.daemonStatusRpc?(r(),v(`button`,{key:1,type:`button`,class:`btn btn-outline btn-sm`,disabled:I.value||Gr.value,onClick:n[17]||=e=>Ji(`restart`)},` Restart… `,8,Dr)):_(``,!0),E.value.daemonStatusRpc&&E.value.daemonSelfUpdate&&!k.value?(r(),v(`button`,{key:2,type:`button`,class:`btn btn-outline btn-sm`,disabled:I.value||Gr.value,onClick:n[18]||=e=>Ji(`update`)},` Update & restart… `,8,Or)):_(``,!0)])])]),F.value&&!Wr.value?(r(),v(`p`,{key:3,role:`status`,class:l([`setting-note`,{"is-error":F.value.state===`failed`}])},[i(d(F.value.phase),1),F.value.version?(r(),v(`span`,kr,` · `+d(F.value.version),1)):_(``,!0),F.value.error?(r(),v(`span`,Ar,`: `+d(F.value.error),1)):_(``,!0)],2)):_(``,!0),Wi.value?(r(),v(`p`,jr,d(Wi.value),1)):_(``,!0),Hi.value?(r(),v(`pre`,Mr,d(Hi.value),1)):_(``,!0)],64)):_(``,!0)]),w.value&&(I.value||M.value||N.value||P.value)?(r(),v(`div`,Nr,[p(`div`,Pr,[p(`div`,Fr,[N.value?(r(),v(`span`,Ir,[e(y,{name:`alert`,size:14}),i(d(N.value),1)])):L.value.length?(r(),v(f,{key:1},[p(`span`,Lr,[e(y,{name:`alert`,size:14}),i(d(L.value[0]),1)]),L.value.length>1?(r(),v(`span`,Rr,` and `+d(L.value.length-1)+` more`,1)):_(``,!0)],64)):P.value&&!I.value?(r(),v(`span`,zr,[e(y,{name:`check`,size:14}),n[77]||=i(`Saved. New agents and terminals use these settings.`,-1)])):(r(),v(`span`,Br,`Unsaved changes`))]),N.value&&/changed elsewhere|reload/i.test(N.value)?(r(),v(`button`,{key:0,type:`button`,class:`btn btn-ghost btn-sm`,onClick:n[19]||=e=>qr()},`Reload`)):_(``,!0),I.value?(r(),v(f,{key:1},[p(`button`,{type:`button`,class:`btn btn-ghost btn-sm`,disabled:M.value,onClick:Yr},`Discard`,8,Vr),p(`button`,{type:`button`,class:`btn btn-primary btn-sm`,disabled:M.value||!!L.value.length||Wr.value,onClick:Jr},d(M.value?`Saving…`:`Save changes`),9,Hr)],64)):(r(),v(`button`,{key:2,type:`button`,class:`icon-btn`,"aria-label":`Dismiss`,onClick:n[20]||=e=>(P.value=!1,N.value=``)},[e(y,{name:`close`,size:14})]))])])):_(``,!0)],32))}}),[[`__scopeId`,`data-v-387805a8`]]);export{j as default};
|
|
Binary file
|
|
Binary file
|