litepaseo 0.6.6 → 0.6.8
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 +17 -0
- package/dist/server/cli.mjs +2 -2
- package/dist/server/{worker-CF-xUWjD.mjs → worker-DiglA6nc.mjs} +102 -8
- package/dist/web/assets/{ChangesPanel-DAhP39yQ.js → ChangesPanel-4b5oKJQU.js} +1 -1
- package/dist/web/assets/ChangesPanel-4b5oKJQU.js.br +0 -0
- package/dist/web/assets/ChangesPanel-4b5oKJQU.js.gz +0 -0
- package/dist/web/assets/{CodeBlockNode-CAxp7DAE.js → CodeBlockNode-VTEENH7Y.js} +1 -1
- package/dist/web/assets/CodeBlockNode-VTEENH7Y.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-VTEENH7Y.js.gz +0 -0
- package/dist/web/assets/{ConversationSearch-DH4VJZV4.js → ConversationSearch-kEo95_J-.js} +1 -1
- package/dist/web/assets/ConversationSearch-kEo95_J-.js.br +0 -0
- package/dist/web/assets/ConversationSearch-kEo95_J-.js.gz +0 -0
- package/dist/web/assets/{FileViewer-CWFL35Uf.js → FileViewer-BFoIh0N2.js} +1 -1
- package/dist/web/assets/FileViewer-BFoIh0N2.js.br +0 -0
- package/dist/web/assets/FileViewer-BFoIh0N2.js.gz +0 -0
- package/dist/web/assets/{FilesPanel-C8dMji8H.js → FilesPanel-16A-pNcV.js} +1 -1
- package/dist/web/assets/FilesPanel-16A-pNcV.js.br +0 -0
- package/dist/web/assets/FilesPanel-16A-pNcV.js.gz +0 -0
- package/dist/web/assets/{HostSettings-qR7aqxfV.js → HostSettings-eeYNx6zt.js} +1 -1
- package/dist/web/assets/HostSettings-eeYNx6zt.js.br +0 -0
- package/dist/web/assets/HostSettings-eeYNx6zt.js.gz +0 -0
- package/dist/web/assets/{MarkdownMessage-ripmJvpU.js → MarkdownMessage-ZXWqw2l0.js} +5 -5
- package/dist/web/assets/MarkdownMessage-ZXWqw2l0.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-ZXWqw2l0.js.gz +0 -0
- package/dist/web/assets/{PreCodeBlock-B_QhJdHj.js → PreCodeBlock-BeygyClF.js} +1 -1
- package/dist/web/assets/{PreCodeBlock.vue_vue_type_style_index_0_lang-xvqDavSu.js → PreCodeBlock.vue_vue_type_style_index_0_lang-CL9tFG8D.js} +1 -1
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-CL9tFG8D.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-CL9tFG8D.js.gz +0 -0
- package/dist/web/assets/{TerminalPanel-DajZUif3.js → TerminalPanel-BfBHmbt7.js} +1 -1
- package/dist/web/assets/TerminalPanel-BfBHmbt7.js.br +0 -0
- package/dist/web/assets/TerminalPanel-BfBHmbt7.js.gz +0 -0
- package/dist/web/assets/{Tooltip--OCMgwms.js → Tooltip-CVGKmlWs.js} +1 -1
- package/dist/web/assets/Tooltip-CVGKmlWs.js.br +0 -0
- package/dist/web/assets/Tooltip-CVGKmlWs.js.gz +0 -0
- package/dist/web/assets/{index-DVB90YUp.js → index-BrayYbIF.js} +5 -5
- package/dist/web/assets/index-BrayYbIF.js.br +0 -0
- package/dist/web/assets/index-BrayYbIF.js.gz +0 -0
- package/dist/web/assets/{index10-DRvJe2BU.js → index10-z76XncR1.js} +1 -1
- package/dist/web/assets/index10-z76XncR1.js.br +0 -0
- package/dist/web/assets/index10-z76XncR1.js.gz +0 -0
- package/dist/web/assets/index3-CGJ_X1Rz.js +1 -0
- package/dist/web/assets/index4-oZqZFLNt.js +1 -0
- package/dist/web/assets/{index5-LBzrxQbJ.js → index5-CQLaQWZD.js} +1 -1
- package/dist/web/assets/index5-CQLaQWZD.js.br +0 -0
- package/dist/web/assets/index5-CQLaQWZD.js.gz +0 -0
- package/dist/web/assets/{index6-DOM0uWNa.js → index6-DJ6M5XkP.js} +1 -1
- package/dist/web/assets/index6-DJ6M5XkP.js.br +0 -0
- package/dist/web/assets/index6-DJ6M5XkP.js.gz +0 -0
- package/dist/web/assets/{index7-fwQIE1XY.js → index7-DtgQft1p.js} +1 -1
- package/dist/web/assets/index7-DtgQft1p.js.br +0 -0
- package/dist/web/assets/{index7-fwQIE1XY.js.gz → index7-DtgQft1p.js.gz} +0 -0
- package/dist/web/assets/{index8-ChPwQ2YZ.js → index8-BGaOfsCu.js} +1 -1
- package/dist/web/assets/index8-BGaOfsCu.js.br +0 -0
- package/dist/web/assets/index8-BGaOfsCu.js.gz +0 -0
- package/dist/web/assets/{index9-B-AJWjQg.js → index9-Db1v1ISG.js} +1 -1
- package/dist/web/assets/index9-Db1v1ISG.js.br +0 -0
- package/dist/web/assets/index9-Db1v1ISG.js.gz +0 -0
- package/dist/web/index.html +1 -1
- 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-DAhP39yQ.js.br +0 -0
- package/dist/web/assets/ChangesPanel-DAhP39yQ.js.gz +0 -0
- package/dist/web/assets/CodeBlockNode-CAxp7DAE.js.br +0 -0
- package/dist/web/assets/CodeBlockNode-CAxp7DAE.js.gz +0 -0
- package/dist/web/assets/ConversationSearch-DH4VJZV4.js.br +0 -0
- package/dist/web/assets/ConversationSearch-DH4VJZV4.js.gz +0 -0
- package/dist/web/assets/FileViewer-CWFL35Uf.js.br +0 -0
- package/dist/web/assets/FileViewer-CWFL35Uf.js.gz +0 -0
- package/dist/web/assets/FilesPanel-C8dMji8H.js.br +0 -0
- package/dist/web/assets/FilesPanel-C8dMji8H.js.gz +0 -0
- package/dist/web/assets/HostSettings-qR7aqxfV.js.br +0 -0
- package/dist/web/assets/HostSettings-qR7aqxfV.js.gz +0 -0
- package/dist/web/assets/MarkdownMessage-ripmJvpU.js.br +0 -0
- package/dist/web/assets/MarkdownMessage-ripmJvpU.js.gz +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-xvqDavSu.js.br +0 -0
- package/dist/web/assets/PreCodeBlock.vue_vue_type_style_index_0_lang-xvqDavSu.js.gz +0 -0
- package/dist/web/assets/TerminalPanel-DajZUif3.js.br +0 -0
- package/dist/web/assets/TerminalPanel-DajZUif3.js.gz +0 -0
- package/dist/web/assets/Tooltip--OCMgwms.js.br +0 -0
- package/dist/web/assets/Tooltip--OCMgwms.js.gz +0 -0
- package/dist/web/assets/index-DVB90YUp.js.br +0 -0
- package/dist/web/assets/index-DVB90YUp.js.gz +0 -0
- package/dist/web/assets/index10-DRvJe2BU.js.br +0 -0
- package/dist/web/assets/index10-DRvJe2BU.js.gz +0 -0
- package/dist/web/assets/index3-CGJ1j41z.js +0 -1
- package/dist/web/assets/index4-BcoNR1EP.js +0 -1
- package/dist/web/assets/index5-LBzrxQbJ.js.br +0 -0
- package/dist/web/assets/index5-LBzrxQbJ.js.gz +0 -0
- package/dist/web/assets/index6-DOM0uWNa.js.br +0 -0
- package/dist/web/assets/index6-DOM0uWNa.js.gz +0 -0
- package/dist/web/assets/index7-fwQIE1XY.js.br +0 -0
- package/dist/web/assets/index8-ChPwQ2YZ.js.br +0 -0
- package/dist/web/assets/index8-ChPwQ2YZ.js.gz +0 -0
- package/dist/web/assets/index9-B-AJWjQg.js.br +0 -0
- package/dist/web/assets/index9-B-AJWjQg.js.gz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.8
|
|
4
|
+
|
|
5
|
+
- Offer a reload when the server runs a different LitePaseo version than the open page, so long-lived tabs and installed apps pick up upgrades.
|
|
6
|
+
- Say what a conversation still loading after 3 seconds is waiting for: the connection to LitePaseo, or the host loading it.
|
|
7
|
+
- Add page age and recent background time to slow-open reports, to identify stale connections after sleep or network changes.
|
|
8
|
+
|
|
9
|
+
## 0.6.7
|
|
10
|
+
|
|
11
|
+
- Send a conversation's first rows as soon as the daemon returns them, instead of after the 500 ms live-update batch.
|
|
12
|
+
- Log slow conversation opens (over 3 seconds) with a per-layer breakdown and no conversation content: `timeline_slow` from the server (daemon subscription, history read, retries) and `timeline_slow_client` from the browser (stream connected, rows arrived, rendering, or left before rows arrived).
|
|
13
|
+
|
|
3
14
|
## 0.6.6
|
|
4
15
|
|
|
5
16
|
- Make the sidebar count under Workspaces/Recent always the number of workspaces listed, matching the host filter chips; it previously showed the number of projects under a Workspaces label. Hovering the count shows both, e.g. "45 workspaces in 23 projects".
|
package/README.md
CHANGED
|
@@ -269,6 +269,23 @@ must not exist. Keep backups private because they include credentials. Use
|
|
|
269
269
|
Upgrade with `npm install --global litepaseo`, then run `litepaseo restart`
|
|
270
270
|
(or `litepaseo service restart` for an OS-managed installation).
|
|
271
271
|
|
|
272
|
+
### Slow conversations
|
|
273
|
+
|
|
274
|
+
A conversation that takes more than 3 seconds to show is logged, without its content.
|
|
275
|
+
`timeline_slow` is the server's side: the daemon subscription (`subscribeMs`), the
|
|
276
|
+
daemon's history read (`fetchMs`; a closed agent is resumed from disk first), and retries
|
|
277
|
+
(`attempts`, `failures`). `timeline_slow_client` is the browser's side: when the stream
|
|
278
|
+
connected (`connectedMs`), when rows arrived (`rowsMs`; `null` if you left first),
|
|
279
|
+
rendering (`renderMs`), and how long the page had just been in the background
|
|
280
|
+
(`backgroundMs`, `visibleForMs`). A late `connectedMs` with no matching `timeline_slow`
|
|
281
|
+
means the request took that long to reach the server, typically a connection the browser
|
|
282
|
+
reused after sleep or a network change. Find them with
|
|
283
|
+
`litepaseo logs -n 2000 | grep timeline_slow`.
|
|
284
|
+
|
|
285
|
+
While a conversation is still loading after 3 seconds, the page says whether it is still
|
|
286
|
+
connecting to LitePaseo or waiting for the host. After an upgrade, open pages offer a
|
|
287
|
+
reload so they run the installed version.
|
|
288
|
+
|
|
272
289
|
## How it fits together
|
|
273
290
|
|
|
274
291
|
```text
|
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.6.
|
|
11
|
+
const VERSION = "0.6.8";
|
|
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-DiglA6nc.mjs");
|
|
1719
1719
|
return runWorker(paths.directory, fileURLToPath(new URL("../web/", import.meta.url)));
|
|
1720
1720
|
}
|
|
1721
1721
|
const command = findCommand(name);
|
|
@@ -607,6 +607,7 @@ const RESET_ROWS = 200;
|
|
|
607
607
|
const MAX_BUFFER = 5e3;
|
|
608
608
|
const FLUSH_MS = 500;
|
|
609
609
|
const RETRY_MS = 2e3;
|
|
610
|
+
const now = () => performance.now();
|
|
610
611
|
/** Same fold the daemon's TimelineProjection applies when a tool call reports again. */
|
|
611
612
|
function mergeToolCallItems(existing, incoming) {
|
|
612
613
|
const a = existing.detail, b = incoming.detail;
|
|
@@ -660,11 +661,17 @@ var TimelineView = class {
|
|
|
660
661
|
subscription = null;
|
|
661
662
|
token = 0;
|
|
662
663
|
loads = 0;
|
|
664
|
+
/** Timings of the load in progress, until the first rows go out. */
|
|
665
|
+
timing = null;
|
|
666
|
+
/** Viewers that joined while the view was loading, waiting for its first rows. */
|
|
667
|
+
joiners = [];
|
|
663
668
|
driver;
|
|
664
669
|
agentId;
|
|
665
|
-
|
|
670
|
+
report;
|
|
671
|
+
constructor(driver, agentId, report) {
|
|
666
672
|
this.driver = driver;
|
|
667
673
|
this.agentId = agentId;
|
|
674
|
+
this.report = report;
|
|
668
675
|
}
|
|
669
676
|
get watcherCount() {
|
|
670
677
|
return this.watchers.size;
|
|
@@ -672,11 +679,27 @@ var TimelineView = class {
|
|
|
672
679
|
start() {
|
|
673
680
|
const token = ++this.token;
|
|
674
681
|
this.state = "loading";
|
|
682
|
+
const attemptAt = now();
|
|
683
|
+
if (this.timing) {
|
|
684
|
+
this.timing.attempts++;
|
|
685
|
+
this.timing.attemptAt = attemptAt;
|
|
686
|
+
} else this.timing = {
|
|
687
|
+
startedAt: attemptAt,
|
|
688
|
+
attemptAt,
|
|
689
|
+
subscribeMs: null,
|
|
690
|
+
fetchMs: null,
|
|
691
|
+
attempts: 1,
|
|
692
|
+
failures: 0
|
|
693
|
+
};
|
|
675
694
|
const subscription = this.driver.subscribeAgentTimeline(this.agentId, (message) => {
|
|
676
695
|
if (token === this.token) this.onMessage(message);
|
|
677
696
|
});
|
|
678
697
|
this.subscription = subscription;
|
|
679
|
-
subscription.ready.then(() =>
|
|
698
|
+
subscription.ready.then(() => {
|
|
699
|
+
if (token !== this.token) return;
|
|
700
|
+
if (this.timing) this.timing.subscribeMs = Math.round(now() - this.timing.attemptAt);
|
|
701
|
+
return this.reload();
|
|
702
|
+
}, () => this.fail(token));
|
|
680
703
|
}
|
|
681
704
|
dispose() {
|
|
682
705
|
this.token++;
|
|
@@ -692,7 +715,7 @@ var TimelineView = class {
|
|
|
692
715
|
if (this.state === "live" || this.state === "catching-up") {
|
|
693
716
|
this.flush();
|
|
694
717
|
watcher([this.resetOp()]);
|
|
695
|
-
}
|
|
718
|
+
} else if (this.watchers.size) this.joiners.push(now());
|
|
696
719
|
this.watchers.add(watcher);
|
|
697
720
|
return () => this.watchers.delete(watcher);
|
|
698
721
|
}
|
|
@@ -786,6 +809,7 @@ var TimelineView = class {
|
|
|
786
809
|
const token = this.token;
|
|
787
810
|
const load = ++this.loads;
|
|
788
811
|
this.state = "loading";
|
|
812
|
+
const fetchAt = now();
|
|
789
813
|
try {
|
|
790
814
|
const page = await this.driver.fetchAgentTimeline(this.agentId, {
|
|
791
815
|
direction: "tail",
|
|
@@ -794,7 +818,9 @@ var TimelineView = class {
|
|
|
794
818
|
wholeTurns: false
|
|
795
819
|
});
|
|
796
820
|
if (token !== this.token || load !== this.loads) return;
|
|
821
|
+
if (this.timing) this.timing.fetchMs = Math.round(now() - fetchAt);
|
|
797
822
|
this.replaceWith(page);
|
|
823
|
+
this.flush();
|
|
798
824
|
this.settle();
|
|
799
825
|
} catch {
|
|
800
826
|
this.fail(token);
|
|
@@ -853,6 +879,7 @@ var TimelineView = class {
|
|
|
853
879
|
fail(token) {
|
|
854
880
|
if (token !== this.token || this.state === "disposed") return;
|
|
855
881
|
this.state = "failed";
|
|
882
|
+
if (this.timing) this.timing.failures++;
|
|
856
883
|
this.broadcast([{
|
|
857
884
|
type: "error",
|
|
858
885
|
message: "Timeline sync interrupted; retrying"
|
|
@@ -963,7 +990,8 @@ var TimelineView = class {
|
|
|
963
990
|
if (this.pendingReset) {
|
|
964
991
|
this.pendingReset = false;
|
|
965
992
|
this.pending.clear();
|
|
966
|
-
|
|
993
|
+
this.broadcast([this.resetOp()]);
|
|
994
|
+
return this.loaded();
|
|
967
995
|
}
|
|
968
996
|
if (!this.pending.size) return;
|
|
969
997
|
const ops = [];
|
|
@@ -998,6 +1026,30 @@ var TimelineView = class {
|
|
|
998
1026
|
} : this.startCursor
|
|
999
1027
|
};
|
|
1000
1028
|
}
|
|
1029
|
+
/** The first rows went out: report how long the view, and anyone who joined it, waited. */
|
|
1030
|
+
loaded() {
|
|
1031
|
+
const timing = this.timing;
|
|
1032
|
+
if (!timing || !this.watchers.size) return;
|
|
1033
|
+
this.timing = null;
|
|
1034
|
+
const done = now();
|
|
1035
|
+
const base = {
|
|
1036
|
+
subscribeMs: timing.subscribeMs,
|
|
1037
|
+
fetchMs: timing.fetchMs,
|
|
1038
|
+
attempts: timing.attempts,
|
|
1039
|
+
failures: timing.failures
|
|
1040
|
+
};
|
|
1041
|
+
this.report?.({
|
|
1042
|
+
...base,
|
|
1043
|
+
totalMs: Math.round(done - timing.startedAt),
|
|
1044
|
+
kind: "view"
|
|
1045
|
+
});
|
|
1046
|
+
for (const joined of this.joiners) this.report?.({
|
|
1047
|
+
...base,
|
|
1048
|
+
totalMs: Math.round(done - joined),
|
|
1049
|
+
kind: "join"
|
|
1050
|
+
});
|
|
1051
|
+
this.joiners = [];
|
|
1052
|
+
}
|
|
1001
1053
|
broadcast(ops) {
|
|
1002
1054
|
for (const watcher of this.watchers) watcher(ops);
|
|
1003
1055
|
}
|
|
@@ -1010,6 +1062,8 @@ var UnknownHostError = class extends Error {
|
|
|
1010
1062
|
};
|
|
1011
1063
|
/** Idle grace before an unwatched timeline releases its daemon subscription. */
|
|
1012
1064
|
const TIMELINE_GRACE_MS = 3e4;
|
|
1065
|
+
/** Conversation opens slower than this are logged with a per-layer breakdown. */
|
|
1066
|
+
const SLOW_TIMELINE_MS = 3e3;
|
|
1013
1067
|
var Hosts = class {
|
|
1014
1068
|
agents = new VersionedCollection();
|
|
1015
1069
|
workspaces = new VersionedCollection();
|
|
@@ -1157,7 +1211,17 @@ var Hosts = class {
|
|
|
1157
1211
|
const key = `${hostId}:${agentId}`;
|
|
1158
1212
|
let entry = this.timelines.get(key);
|
|
1159
1213
|
if (!entry) {
|
|
1160
|
-
const
|
|
1214
|
+
const connection = client.driver.getConnectionState().status;
|
|
1215
|
+
const view = new TimelineView(client.driver, agentId, (report) => {
|
|
1216
|
+
if (report.totalMs < SLOW_TIMELINE_MS) return;
|
|
1217
|
+
console.warn(JSON.stringify({
|
|
1218
|
+
event: "timeline_slow",
|
|
1219
|
+
hostId,
|
|
1220
|
+
agentId,
|
|
1221
|
+
connectionAtStart: connection ?? null,
|
|
1222
|
+
...report
|
|
1223
|
+
}));
|
|
1224
|
+
});
|
|
1161
1225
|
entry = {
|
|
1162
1226
|
view,
|
|
1163
1227
|
hostId
|
|
@@ -3670,7 +3734,8 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
3670
3734
|
const message = {
|
|
3671
3735
|
type: "hosts",
|
|
3672
3736
|
hosts: hostStates(),
|
|
3673
|
-
instanceName: instanceName()
|
|
3737
|
+
instanceName: instanceName(),
|
|
3738
|
+
version: VERSION
|
|
3674
3739
|
};
|
|
3675
3740
|
for (const stream of directoryStreams) stream.send(message);
|
|
3676
3741
|
}, HOST_FLUSH_MS);
|
|
@@ -3716,6 +3781,33 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
3716
3781
|
presence.update(session.id, input.tab, input.seq, input.key);
|
|
3717
3782
|
return c.json({ ok: true });
|
|
3718
3783
|
});
|
|
3784
|
+
/**
|
|
3785
|
+
* A browser's account of a slow conversation open (see timeline_slow for the server's):
|
|
3786
|
+
* together they show whether the time went to the server, the network or the browser.
|
|
3787
|
+
*/
|
|
3788
|
+
app.post("/api/diagnostics/timeline-slow", async (c) => {
|
|
3789
|
+
const ms = z.number().int().nonnegative().max(36e5).nullable();
|
|
3790
|
+
const long = z.number().int().nonnegative().max(7776e6).nullable();
|
|
3791
|
+
const input = z.object({
|
|
3792
|
+
hostId: z.string().min(1).max(200),
|
|
3793
|
+
agentId: z.string().min(1).max(200),
|
|
3794
|
+
totalMs: ms,
|
|
3795
|
+
connectedMs: ms,
|
|
3796
|
+
rowsMs: ms,
|
|
3797
|
+
renderMs: ms,
|
|
3798
|
+
attempts: z.number().int().nonnegative().max(1e3),
|
|
3799
|
+
hidden: z.boolean(),
|
|
3800
|
+
pageAgeMs: long.optional(),
|
|
3801
|
+
backgroundMs: long.optional(),
|
|
3802
|
+
visibleForMs: ms.optional(),
|
|
3803
|
+
version: z.string().max(40).optional()
|
|
3804
|
+
}).strict().parse(await c.req.json());
|
|
3805
|
+
console.warn(JSON.stringify({
|
|
3806
|
+
event: "timeline_slow_client",
|
|
3807
|
+
...input
|
|
3808
|
+
}));
|
|
3809
|
+
return c.json({ ok: true });
|
|
3810
|
+
});
|
|
3719
3811
|
app.get("/api/instance", (c) => c.json({ name: instanceName() }));
|
|
3720
3812
|
app.put("/api/instance", async (c) => {
|
|
3721
3813
|
const input = z.object({ name: z.string().trim().max(64).refine((name) => !/[\u0000-\u001f\u007f]/.test(name), "Use a single-line name") }).strict().safeParse(await c.req.json());
|
|
@@ -3724,7 +3816,8 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
3724
3816
|
const message = {
|
|
3725
3817
|
type: "hosts",
|
|
3726
3818
|
hosts: hostStates(),
|
|
3727
|
-
instanceName: instanceName()
|
|
3819
|
+
instanceName: instanceName(),
|
|
3820
|
+
version: VERSION
|
|
3728
3821
|
};
|
|
3729
3822
|
for (const stream of directoryStreams) stream.send(message);
|
|
3730
3823
|
return c.json({ name: instanceName() });
|
|
@@ -3743,7 +3836,8 @@ function createApp(store, hosts, token, webRoot, options = {}) {
|
|
|
3743
3836
|
send({
|
|
3744
3837
|
type: "hosts",
|
|
3745
3838
|
hosts: hostStates(),
|
|
3746
|
-
instanceName: instanceName()
|
|
3839
|
+
instanceName: instanceName(),
|
|
3840
|
+
version: VERSION
|
|
3747
3841
|
});
|
|
3748
3842
|
send({
|
|
3749
3843
|
type: "project-pins",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as e,G as t,I as n,P as r,S as i,T as a,f as o,g as s,ot as c,rt as l,v as u,y as d,z as f}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{l as p}from"./index-
|
|
1
|
+
import{$ as e,G as t,I as n,P as r,S as i,T as a,f as o,g as s,ot as c,rt as l,v as u,y as d,z as f}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{l as p}from"./index-BrayYbIF.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(a({__name:`ChangesPanel`,props:{hostId:{},cwd:{},api:{type:Function}},setup(a){let p=a,w=e([]),T=e(``),E=e(!1),D=e(!1),O=0,k=e(new Set);r(()=>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 t(()=>[p.hostId,p.cwd],()=>{w.value=[],A()},{immediate:!0}),(e,t)=>(n(),d(`section`,m,[t[0]||=s(`p`,null,`Workspace uncommitted changes · includes changes from all contributors.`,-1),s(`button`,{class:`btn`,disabled:E.value,onClick:A},c(E.value?`Loading…`:`Refresh changes`),9,h),T.value?(n(),d(`p`,g,c(T.value),1)):u(``,!0),D.value?(n(),d(`p`,_,`Diff exceeds the host limit; some changes are omitted.`)):u(``,!0),!E.value&&!T.value&&!w.value.length?(n(),d(`p`,v,`No uncommitted changes.`)):u(``,!0),(n(!0),d(o,null,f(w.value,e=>(n(),d(`details`,{key:e.path,onToggle:t=>t.target.open?k.value.add(e.path):k.value.delete(e.path)},[s(`summary`,null,[i(c(e.oldPath?e.oldPath+` → `:``)+c(e.path)+` `,1),s(`span`,null,`+`+c(e.additions)+` −`+c(e.deletions),1)]),s(`button`,{class:`btn btn-ghost`,onClick:t=>j(e.path)},`Copy path`,8,b),e.status===`binary`?(n(),d(`p`,x,`Binary file changed.`)):e.status===`too_large`?(n(),d(`p`,S,`File diff is too large to display.`)):u(``,!0),k.value.has(e.path)?(n(!0),d(o,{key:2},f(e.hunks,(e,t)=>(n(),d(`pre`,{key:t},[s(`code`,null,[s(`span`,C,`@@ −`+c(e.oldStart)+`,`+c(e.oldCount)+` +`+c(e.newStart)+`,`+c(e.newCount)+` @@
|
|
2
2
|
`,1),(n(!0),d(o,null,f(e.lines,(e,t)=>(n(),d(`span`,{key:t,class:l(e.type)},c(e.type===`add`?`+`:e.type===`remove`?`−`:` `)+c(e.content),3))),128))])]))),128)):u(``,!0)],40,y))),128))]))}}),[[`__scopeId`,`data-v-4de9f4ce`]]);export{w as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{$ as e,B as t,C as n,E as r,G as i,I as a,J as o,M as s,N as c,P as l,T as u,W as d,_ as f,at as p,b as ee,d as m,et as te,g as h,h as g,j as _,k as ne,l as re,m as v,nt as ie,ot as ae,q as oe,rt as se,v as ce,y as le}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{E as ue,G as de,U as fe,W as pe,X as me,Y as he,Z as ge,a as _e,at as ve,b as ye,c as be,d as xe,et as Se,ft as Ce,g as we,it as Te,lt as Ee,n as De,nt as Oe,ot as ke,rt as Ae,ut as je,v as Me,w as Ne,x as Pe}from"./MarkdownMessage-ripmJvpU.js";import{n as Fe,r as Ie,t as Le}from"./PreCodeBlock.vue_vue_type_style_index_0_lang-xvqDavSu.js";import{n as Re,t as y}from"./safeRaf-BDp3SJMs.js";import{i as ze}from"./index-DVB90YUp.js";var b=(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())}),Be=!1,Ve=null,He=null,Ue=null;function We(){return b(this,null,function*(){if(Ue)return Ue;Ue=b(null,null,function*(){if(!He)try{if(He=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 ze(()=>import(`./markstream_markstream-vue-Bj0UewdV.js`),[])),!He)return null}catch{return null}try{return yield function(e){return b(this,null,function*(){if(!Be)return Ve||(Ve=b(null,null,function*(){let t=e?.preloadStreamDiffs;typeof t==`function`&&(yield t()),Be=!0}).finally(()=>{Ve=null}),Ve)})}(He),pe(),He}catch{return null}});try{return yield Ue}finally{Ue=null}})}var Ge=Object.defineProperty,Ke=Object.defineProperties,x=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,Je=(e,t,n)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t)=>{for(var n in t||={})qe.call(t,n)&&Je(e,n,t[n]);if(S)for(var n of S(t))C.call(t,n)&&Je(e,n,t[n]);return e},Ye=(e,t)=>Ke(e,x(t)),T=(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())}),E={class:`html-preview-frame__header`},Xe={class:`html-preview-frame__title`},D={class:`html-preview-frame__label`},O=[`sandbox`,`srcdoc`],Ze=Me(u({__name:`HtmlPreviewFrame`,props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){let t=e,{t:n}=Pe(),r=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>`}),i=g(()=>{return e=t.htmlPreviewSandbox,n=t.htmlPreviewAllowScripts,typeof e==`string`?e:e===void 0&&!0===n?`allow-scripts`:``;var e,n});function o(e){var n;e.key!==`Escape`&&e.key!==`Esc`||(n=t.onClose)==null||n.call(t)}return c(()=>{typeof window<`u`&&window.addEventListener(`keydown`,o)}),l(()=>{typeof window<`u`&&window.removeEventListener(`keydown`,o)}),(e,o)=>(a(),f(v,{to:`body`},[h(`div`,{class:se([`markstream-vue`,{dark:t.isDark}])},[h(`div`,{class:`html-preview-frame__backdrop`,onClick:o[2]||=e=>t.onClose?.call(t)},[h(`div`,{class:`html-preview-frame`,onClick:o[1]||=m(()=>{},[`stop`])},[h(`div`,E,[h(`div`,Xe,[o[3]||=h(`span`,{class:`html-preview-frame__dot`},null,-1),h(`span`,D,ae(t.title||ie(n)(`common.preview`)||`Preview`),1)]),h(`button`,{type:`button`,class:`html-preview-frame__close`,onClick:o[0]||=e=>t.onClose?.call(t)},` × `)]),h(`iframe`,{class:`html-preview-frame__iframe`,sandbox:i.value,referrerpolicy:`no-referrer`,srcdoc:r.value},null,8,O)])])],2)]))}}),[[`__scopeId`,`data-v-24e66176`]]),Qe=[`data-markstream-enhanced`,`data-markstream-enhancement-state`,`data-markstream-code-block-state`,`data-markstream-pending`,`data-markstream-viewport-pending`],$e={class:`code-header-main`},et=[`innerHTML`],tt={class:`code-header-copy`},nt={class:`code-header-title`},rt={key:0,class:`code-header-caption`},it=[`data-markstream-host-hidden`],k=Me(u({__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(u,{emit:m}){let v=u,pe=m,Me=g(()=>v.showLineNumbers??!0!==v.codeBlockOptions?.disableLineNumbers),ze=d(),b=ne(me,null),Be=ne(`markstreamHostScrollManaged`,null),Ve=ne(we,void 0),He=g(()=>be(v,ze)),Ue=r(),Ge=g(()=>{let e=Ue?.vnode.props;return!(!e||!e.onPreviewCode&&!e[`onPreview-code`])}),{t:Ke}=Pe(),x=e(null),S=e(null),qe=e(!1),C=e(Hr(v.node.language,v.node.code,Vr())),Je=g(()=>ge(C.value)),E=g(()=>Je.value===`plaintext`?`text`:Je.value),Xe=g(()=>Je.value===`plaintext`),D=e(!1),O=e(!1),k=e(!1),A=e(!1),j=e(!1),at=e(!1),M=!1,ot=!1,st=null,ct=null,lt=null,ut=0,dt=!1,ft=``,pt=e(null),mt=0,ht=!1,gt=De(),_t=ue(),vt=xe(),yt=te(null),N=e(typeof window>`u`||!vt.value),bt=r()?.vnode.el?.textContent??``,xt=typeof window<`u`&&String(v.node.code??``).length>0&&bt.includes(String(v.node.code)),St=e(!xt);c(()=>{St.value=!0}),typeof window<`u`&&i([()=>S.value,vt],([e,t],n,r)=>{var i;if((i=yt.value)==null||i.destroy(),yt.value=null,!t||N.value)return void(N.value=!0);if(!e)return void(N.value=!1);let a=!0,o=_t?.value.heavyBlockMargin??_t?.value.rootMargin??`0px`,s=gt(e,{rootMargin:o,allowIdle:!1});yt.value=s,N.value=N.value||s.isVisible.value,s.whenVisible.then(()=>{a&&yt.value===s&&(N.value=!0)}).catch(()=>{}),r(()=>{a=!1,s.destroy(),yt.value===s&&(yt.value=null)})},{immediate:!0}),s(()=>{var e;M=!0,function(){let e=ft;b&&e&&(ft=``,b.markSettled(e))}(),(e=yt.value)==null||e.destroy(),yt.value=null});let P=null,Ct=null,wt=()=>{},Tt=()=>{},Et=()=>{},Dt=()=>{},Ot=()=>null,F=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),I=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),kt=()=>{},At=()=>{},jt=()=>{},Mt=null,L=null,Nt=null,Pt=null,Ft=()=>String(v.node.language??`plaintext`),It=()=>T(null,null,function*(){}),Lt=!1,Rt=null,zt=[],Bt=[],R=null,Vt=null,z=g(()=>Ae(v.node)),Ht=e({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=jt();e&&typeof e.catch==`function`&&e.catch(e=>{Kt(e)})}catch(e){Kt(e)}}let Jt=g(()=>{let e=w({},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 Ye(w(w({},n),e),{parseDiffOptions:w(w({},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 Te(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(()=>je({darkTheme:v.darkTheme,isDark:v.isDark,lightTheme:v.lightTheme,theme:v.theme,themes:v.themes})),Qt=g(()=>z.value?`diff`:`single`),$t=e(Qt.value),V=e(!1),H=e(!1),en=e(!1),U=e(!1),tn=e(null),nn=e(0),rn=e(0),an=e(!1),on=null,sn=!1,cn=null,ln=!1,un=g(()=>!!z.value&&Jt.value?.diffStyle===`unified`),dn=g(()=>ke(Jt.value));function fn(e){return!0===Be?.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(S.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=e(!1),W=g(()=>Gt(v.node.code)),bn=g(()=>z.value?!0===v.node.diff?v.node:Ye(w({},v.node),{diff:!0}):W.value===v.node.code?v.node:Ye(w({},v.node),{code:W.value}));function xn(e){let t=e.detectLanguage;typeof t==`function`&&(Ft=t),Vt=e,R=gi();let n=e.createCodeBlockRuntime(R);return!!n&&(P=n.createEditor||P,Ct=n.createDiffEditor||Ct,wt=n.updateCode||wt,Tt=n.updateDiff||Tt,Et=n.finalizeCode||Et,Dt=n.finalizeDiff||Dt,Ot=n.getEditor||Ot,F=n.getEditorView||F,I=n.getDiffEditorView||I,kt=n.cleanupEditor||kt,At=n.safeClean||n.cleanupEditor||At,jt=n.refreshDiffPresentation||jt,It=n.setTheme||It,Mt=n.whenVisualReady||null,at.value=!0,!0)}let G=e(typeof v.codeBlockOptions?.fontSize==`number`?v.codeBlockOptions.fontSize:NaN),K=e(G.value),Sn=e(null),Cn=e(null),wn=e(null),Tn=e(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(()=>Ye(w({},Ce(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=e(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]===`
|
|
1
|
+
import{$ as e,B as t,C as n,E as r,G as i,I as a,J as o,M as s,N as c,P as l,T as u,W as d,_ as f,at as p,b as ee,d as m,et as te,g as h,h as g,j as _,k as ne,l as re,m as v,nt as ie,ot as ae,q as oe,rt as se,v as ce,y as le}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{E as ue,G as de,U as fe,W as pe,X as me,Y as he,Z as ge,a as _e,at as ve,b as ye,c as be,d as xe,et as Se,ft as Ce,g as we,it as Te,lt as Ee,n as De,nt as Oe,ot as ke,rt as Ae,ut as je,v as Me,w as Ne,x as Pe}from"./MarkdownMessage-ZXWqw2l0.js";import{n as Fe,r as Ie,t as Le}from"./PreCodeBlock.vue_vue_type_style_index_0_lang-CL9tFG8D.js";import{n as Re,t as y}from"./safeRaf-BDp3SJMs.js";import{i as ze}from"./index-BrayYbIF.js";var b=(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())}),Be=!1,Ve=null,He=null,Ue=null;function We(){return b(this,null,function*(){if(Ue)return Ue;Ue=b(null,null,function*(){if(!He)try{if(He=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 ze(()=>import(`./markstream_markstream-vue-Bj0UewdV.js`),[])),!He)return null}catch{return null}try{return yield function(e){return b(this,null,function*(){if(!Be)return Ve||(Ve=b(null,null,function*(){let t=e?.preloadStreamDiffs;typeof t==`function`&&(yield t()),Be=!0}).finally(()=>{Ve=null}),Ve)})}(He),pe(),He}catch{return null}});try{return yield Ue}finally{Ue=null}})}var Ge=Object.defineProperty,Ke=Object.defineProperties,x=Object.getOwnPropertyDescriptors,S=Object.getOwnPropertySymbols,qe=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,Je=(e,t,n)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t)=>{for(var n in t||={})qe.call(t,n)&&Je(e,n,t[n]);if(S)for(var n of S(t))C.call(t,n)&&Je(e,n,t[n]);return e},Ye=(e,t)=>Ke(e,x(t)),T=(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())}),E={class:`html-preview-frame__header`},Xe={class:`html-preview-frame__title`},D={class:`html-preview-frame__label`},O=[`sandbox`,`srcdoc`],Ze=Me(u({__name:`HtmlPreviewFrame`,props:{code:{},isDark:{type:Boolean},htmlPreviewAllowScripts:{type:Boolean},htmlPreviewSandbox:{},onClose:{type:Function},title:{}},setup(e){let t=e,{t:n}=Pe(),r=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>`}),i=g(()=>{return e=t.htmlPreviewSandbox,n=t.htmlPreviewAllowScripts,typeof e==`string`?e:e===void 0&&!0===n?`allow-scripts`:``;var e,n});function o(e){var n;e.key!==`Escape`&&e.key!==`Esc`||(n=t.onClose)==null||n.call(t)}return c(()=>{typeof window<`u`&&window.addEventListener(`keydown`,o)}),l(()=>{typeof window<`u`&&window.removeEventListener(`keydown`,o)}),(e,o)=>(a(),f(v,{to:`body`},[h(`div`,{class:se([`markstream-vue`,{dark:t.isDark}])},[h(`div`,{class:`html-preview-frame__backdrop`,onClick:o[2]||=e=>t.onClose?.call(t)},[h(`div`,{class:`html-preview-frame`,onClick:o[1]||=m(()=>{},[`stop`])},[h(`div`,E,[h(`div`,Xe,[o[3]||=h(`span`,{class:`html-preview-frame__dot`},null,-1),h(`span`,D,ae(t.title||ie(n)(`common.preview`)||`Preview`),1)]),h(`button`,{type:`button`,class:`html-preview-frame__close`,onClick:o[0]||=e=>t.onClose?.call(t)},` × `)]),h(`iframe`,{class:`html-preview-frame__iframe`,sandbox:i.value,referrerpolicy:`no-referrer`,srcdoc:r.value},null,8,O)])])],2)]))}}),[[`__scopeId`,`data-v-24e66176`]]),Qe=[`data-markstream-enhanced`,`data-markstream-enhancement-state`,`data-markstream-code-block-state`,`data-markstream-pending`,`data-markstream-viewport-pending`],$e={class:`code-header-main`},et=[`innerHTML`],tt={class:`code-header-copy`},nt={class:`code-header-title`},rt={key:0,class:`code-header-caption`},it=[`data-markstream-host-hidden`],k=Me(u({__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(u,{emit:m}){let v=u,pe=m,Me=g(()=>v.showLineNumbers??!0!==v.codeBlockOptions?.disableLineNumbers),ze=d(),b=ne(me,null),Be=ne(`markstreamHostScrollManaged`,null),Ve=ne(we,void 0),He=g(()=>be(v,ze)),Ue=r(),Ge=g(()=>{let e=Ue?.vnode.props;return!(!e||!e.onPreviewCode&&!e[`onPreview-code`])}),{t:Ke}=Pe(),x=e(null),S=e(null),qe=e(!1),C=e(Hr(v.node.language,v.node.code,Vr())),Je=g(()=>ge(C.value)),E=g(()=>Je.value===`plaintext`?`text`:Je.value),Xe=g(()=>Je.value===`plaintext`),D=e(!1),O=e(!1),k=e(!1),A=e(!1),j=e(!1),at=e(!1),M=!1,ot=!1,st=null,ct=null,lt=null,ut=0,dt=!1,ft=``,pt=e(null),mt=0,ht=!1,gt=De(),_t=ue(),vt=xe(),yt=te(null),N=e(typeof window>`u`||!vt.value),bt=r()?.vnode.el?.textContent??``,xt=typeof window<`u`&&String(v.node.code??``).length>0&&bt.includes(String(v.node.code)),St=e(!xt);c(()=>{St.value=!0}),typeof window<`u`&&i([()=>S.value,vt],([e,t],n,r)=>{var i;if((i=yt.value)==null||i.destroy(),yt.value=null,!t||N.value)return void(N.value=!0);if(!e)return void(N.value=!1);let a=!0,o=_t?.value.heavyBlockMargin??_t?.value.rootMargin??`0px`,s=gt(e,{rootMargin:o,allowIdle:!1});yt.value=s,N.value=N.value||s.isVisible.value,s.whenVisible.then(()=>{a&&yt.value===s&&(N.value=!0)}).catch(()=>{}),r(()=>{a=!1,s.destroy(),yt.value===s&&(yt.value=null)})},{immediate:!0}),s(()=>{var e;M=!0,function(){let e=ft;b&&e&&(ft=``,b.markSettled(e))}(),(e=yt.value)==null||e.destroy(),yt.value=null});let P=null,Ct=null,wt=()=>{},Tt=()=>{},Et=()=>{},Dt=()=>{},Ot=()=>null,F=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),I=()=>({getModel:()=>({getLineCount:()=>1}),getOption:()=>14,updateOptions:()=>{}}),kt=()=>{},At=()=>{},jt=()=>{},Mt=null,L=null,Nt=null,Pt=null,Ft=()=>String(v.node.language??`plaintext`),It=()=>T(null,null,function*(){}),Lt=!1,Rt=null,zt=[],Bt=[],R=null,Vt=null,z=g(()=>Ae(v.node)),Ht=e({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=jt();e&&typeof e.catch==`function`&&e.catch(e=>{Kt(e)})}catch(e){Kt(e)}}let Jt=g(()=>{let e=w({},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 Ye(w(w({},n),e),{parseDiffOptions:w(w({},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 Te(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(()=>je({darkTheme:v.darkTheme,isDark:v.isDark,lightTheme:v.lightTheme,theme:v.theme,themes:v.themes})),Qt=g(()=>z.value?`diff`:`single`),$t=e(Qt.value),V=e(!1),H=e(!1),en=e(!1),U=e(!1),tn=e(null),nn=e(0),rn=e(0),an=e(!1),on=null,sn=!1,cn=null,ln=!1,un=g(()=>!!z.value&&Jt.value?.diffStyle===`unified`),dn=g(()=>ke(Jt.value));function fn(e){return!0===Be?.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(S.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=e(!1),W=g(()=>Gt(v.node.code)),bn=g(()=>z.value?!0===v.node.diff?v.node:Ye(w({},v.node),{diff:!0}):W.value===v.node.code?v.node:Ye(w({},v.node),{code:W.value}));function xn(e){let t=e.detectLanguage;typeof t==`function`&&(Ft=t),Vt=e,R=gi();let n=e.createCodeBlockRuntime(R);return!!n&&(P=n.createEditor||P,Ct=n.createDiffEditor||Ct,wt=n.updateCode||wt,Tt=n.updateDiff||Tt,Et=n.finalizeCode||Et,Dt=n.finalizeDiff||Dt,Ot=n.getEditor||Ot,F=n.getEditorView||F,I=n.getDiffEditorView||I,kt=n.cleanupEditor||kt,At=n.safeClean||n.cleanupEditor||At,jt=n.refreshDiffPresentation||jt,It=n.setTheme||It,Mt=n.whenVisualReady||null,at.value=!0,!0)}let G=e(typeof v.codeBlockOptions?.fontSize==`number`?v.codeBlockOptions.fontSize:NaN),K=e(G.value),Sn=e(null),Cn=e(null),wn=e(null),Tn=e(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(()=>Ye(w({},Ce(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=e(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
2
|
`?n++:t[e]===`\r`&&(n++,t[e+1]===`
|
|
3
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=e(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=w({},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=S.value?.querySelector(`pre.code-pre-fallback`),a=I(),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 T(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 T(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=S.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(),y(()=>{M||y(()=>{M||(function(){let e=S.value?.querySelector(`.code-block-shell-content`),t=S.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)):!(Mt&&!(yield Mt())||(en.value=!0,yield _(),X(!0),H.value=!0,yield _(),Q(),0))})}function Qn(e){if(!z.value)return;let t=x.value,n=S.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=S.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=S.value?.querySelector(`.code-block-shell-content`),n=S.value?.querySelector(`.code-editor-layer`);if(!t||!n)return;let r=typeof e==`number`&&Number.isFinite(e)&&e>0?Math.ceil(e):Number.parseFloat(x.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=x.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)&&j.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&&Re(n),e())};r=globalThis.setTimeout(i,50),n=y(i)})}function nr(){try{let e=x.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=I())?.getModifiedEditor)?.call(e)??I():F(),n=Ot()?.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=x.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=Ot()?.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!!Xe.value||!!e&&($(e)||Mt!=null)}function sr(){z.value?Ht.value=Oe(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?I():null,o=z.value?a:F();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=F())?.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=I())?.getModifiedEditor)?.call(e)??I():F());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=x.value,t=S.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=x.value,t=S.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=I())?.getModifiedEditor)?.call(e)??I():F(),n=Ot()?.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(!Xe.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)}}i(()=>[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=x.value;if(!e)return;let t=e.getBoundingClientRect().height,n=fr();if(n!=null&&n>0){let r=tr(n,!0,{allowBelowEstimatedFloor:!z.value&&j.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;zt.length>0;)try{(t=(e=zt.pop())?.dispose)==null||t.call(e)}catch{}st!=null&&(Re(st),st=null),ct!=null&&(Re(ct),ct=null),lt!=null&&(Re(lt),lt=null),ut=0,dt=!1}function Tr(){for(var e;Bt.length>0;)try{(e=Bt.pop())==null||e()}catch{}}function Y(e=!1){O.value||(D.value?Cr():function(e={}){try{let t=x.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=I(),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(mt>0&&(mt--,pt.value!=null))return void J(t,n,Or(t,pt.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&&j.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(pt.value!=null)return void J(t,n,Or(t,pt.value,i,{preserveScrollableOverflow:Ar(t)}));let te=z.value&&!1!==v.loading?a:Math.max(a,c!=null&&c>0?c:0);if(te>0)return void J(t,n,Or(t,te,i));let h=Hn();if(!(h==null||z.value&&!1!==v.loading&&l))return void J(t,n,Or(t,h,i));let g=Number.parseFloat(t.style.height);!Number.isNaN(g)&&g>0?J(t,n,Or(t,g,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(O.value)return;let t=x.value;if(!t)return;let n=z.value?I():F();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(M||st!=null)return;let t=()=>{M||(Z(),Y(e),X())};st=y(()=>{st=null,t(),ct=y(()=>{ct=null,t()})}),Dr()}function Dr(e=!1){if(!z.value||M||!e&&!1===v.loading||(dt||=e,ut=Math.max(ut,e?18:6),lt!=null))return;let t=()=>{if(lt=null,!z.value||M||ut<=0||!dt&&!1===v.loading)return ut=0,void(dt=!1);ut--,Z(),Y({preferModelDiffHeight:!0,holdCurrentDiffHeight:dt}),X(),ut>0?lt=y(t):dt=!1};lt=y(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 ht||kr(e,pt.value??0)}function jr(e=x.value){return $(e)}function Mr(e=x.value){return $(e)}function Nr(){var e;if($())return!0;let t=((e=F())?.getModel)?.call(e);return typeof t?.getValue==`function`&&t.getValue()===W.value}function $(e=x.value){return!!e?.querySelector(`diffs-container`)}function Pr(){return!1!==v.loading||H.value}function Fr(){let e=I();return typeof e?.getOriginalEditor==`function`||typeof e?.getModifiedEditor==`function`||typeof e?.getLineChanges==`function`}function Ir(){return T(this,null,function*(){if(!z.value)return!0;for(let e=0;e<30;e++){if(M)return!1;if($())return yield _(),yield q(),!M&&$();yield _(),yield q()}return!1})}let Lr=``;function Rr(e,t,n){return T(this,null,function*(){let r=`${e}\0${t}\0${n}`;if(Lr!==r){try{yield Tt(e,t,n),Lr=r;return}catch(e){if(!Kt(e))throw e}if(yield _(),yield q(),!M&&z.value)try{yield Tt(e,t,n),Lr=r}catch(e){if(!Kt(e))throw e}}})}function zr(){return v.codeBlockOptions?.maxHeight??500}let Br=g(()=>v.isShowPreview&&(C.value===`html`||C.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??``)?fe(String(e??``)):`plain`}function Ur(){return Vr()}let Wr=null,Gr=!1,Kr=0;function qr(){Wr=null,Kr++}function Jr(){return T(this,arguments,function*(e=Kr){if(!Gr){Gr=!0;try{for(;Wr&&!M&&!z.value&&e===Kr;){let e=Wr;Wr=null;try{yield Promise.resolve(wt(e.code,e.language)),yield _(),M||z.value||(Y(!1),X())}catch{}}}finally{Gr=!1,!Wr||M||z.value||Jr()}}})}function Yr(e,t){Wr={code:e,language:t},Jr(Kr)}i(()=>[v.node.language,v.node.code,v.node.raw,v.node.loading,v.loading],([e,t,n,r,i])=>{C.value=Hr(e,t,typeof r==`boolean`?r:!0===i)}),i(()=>[v.node.originalCode,v.node.updatedCode,z.value],()=>{y(()=>sr())},{immediate:!0});let Xr=0;i(()=>[v.node.originalCode,v.node.updatedCode,E.value,z.value,v.stream],e=>T(null,[e],function*([,,,e,t]){let n=++Xr;if(!e||Vr()||!1===t&&!k.value)return;if(!1!==t&&P&&!k.value&&x.value)try{yield ci(x.value)}catch{}let r=Nt;if(r&&!A.value){try{yield r}catch{}if(M||!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,E.value),M||!z.value||n!==Xr)return;yield _(),X(!0),Z(),Y(!1===v.loading||{preferModelDiffHeight:!0}),X(!0),Q(!0)}catch{return}if(a){if(M||!z.value)return;qt(),Z(),sr(),Q(),Dr(!0)}D.value&&y(()=>Cr())})),i(()=>v.node.code,e=>T(null,null,function*(){if(Vr()||!1===v.stream||(C.value||=fe(Ft(e)),z.value))return;let t=Nt;if(t&&!A.value){try{yield t}catch{}if(M||z.value)return}if(P&&!k.value&&x.value)try{yield ci(x.value)}catch{}Yr(Gt(v.node.code),E.value),D.value&&y(()=>Cr())}));let Zr=g(()=>{let e=C.value;return e?he[e]||e.charAt(0).toUpperCase()+e.slice(1):he[``]||`Plain Text`}),Qr=g(()=>ve(String(v.node.raw??``),Zr.value,z.value)),$r=g(()=>Qr.value.title),ei=g(()=>Qr.value.caption),ti=g(()=>(de.value,Ie(C.value||``,Ve))),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&&!O.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 T(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)),qe.value=!0,pe(`copy`,e),setTimeout(()=>{qe.value=!1},1e3)}catch(e){console.error(`复制失败:`,e)}})}function ai(){D.value=!D.value;let e=z.value?I():F(),t=x.value;e&&t&&(D.value?(t.style.maxHeight=`none`,t.style.overflow=`visible`,Y(!0)):(t.style.overflow=`auto`,Y(!0)))}function oi(){var e;if(O.value=!O.value,O.value){if(ht=!1,x.value){let t=Math.ceil((e=x.value).getBoundingClientRect?.call(e).height||0);ht=kr(x.value,t)||x.value.style.overflow===`auto`||x.value.style.overflowY===`auto`,t>0&&(pt.value=t)}}else x.value&&pt.value!=null&&(x.value.style.height=`${pt.value}px`),mt=2,_(()=>{O.value||M||(Y(!0),X(!0))})}function si(){if(!Br.value)return;let e=C.value;if(Ge.value){let t=e===`html`?`text/html`:`image/svg+xml`,n=e===`html`?Ke(`artifacts.htmlPreviewTitle`)||`HTML Preview`:Ke(`artifacts.svgPreviewTitle`)||`SVG Preview`;pe(`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(!P||M||!1===v.stream&&!1!==v.loading||(Ci(),wi())||V.value||x.value!==e||Ur())return null;if(L)return L;if(k.value&&j.value)return Promise.resolve();let n=xi(),r=nn.value,i=!1;k.value=!0,function(){let e=He.value;b&&e&&ft!==e&&(ft&&b.markSettled(ft),ft=e,b.markPending(e))}();let a=T(null,null,function*(){try{yield function(e){return T(this,null,function*(){var t;if(!P||M)return;ot=!1;let n=Qt.value;if(ln=!1,U.value=!1,tn.value=null,A.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=j.value||e==null?null:e}(),wr(),Tr(),function(e){e.replaceChildren()}(e),_i(),yield ye(hi()),M)return;let r=T(null,null,function*(){if(n===`diff`){(function(){if(Lt||typeof window>`u`)return;Lt=!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),Rt=()=>{window.removeEventListener(`error`,e,!0),window.removeEventListener(`unhandledrejection`,e,!0),Lt=!1,Rt=null}})(),At();let t=Wt(String(v.node.originalCode??``),String(v.node.updatedCode??``));Ct?yield Ct(e,t.original,t.updated,E.value):yield P(e,v.node.code,E.value)}else yield P(e,W.value,E.value);A.value=!0}).finally(()=>{Nt===r&&(Nt=null)});if(Nt=r,yield function(e){return T(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(M)return;if(n){if(t)throw t;return}if(jr()&&Fr())return;yield _(),yield q()}})}(r),M||Qt.value!==n)return;A.value=!0;let i=v.codeBlockOptions?.fontSize;if(typeof i==`number`&&Number.isFinite(i)&&i>0){let e=n===`diff`?I():F();(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();ot;)if(ot=!1,yield mi(),M)return;D.value||O.value||Y(!1),j.value=!0,$t.value=n,function(){if(wr(),z.value){let e=I(),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&&zt.push(r)}catch{}};try{let t=(e?.onDidUpdateDiff)?.call(e,()=>{Q(),y(()=>sr())});t&&zt.push(t)}catch{}r(t,`onDidContentSizeChange`),r(n,`onDidContentSizeChange`);let i=x.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}),zt.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),zt.push({dispose:()=>e.disconnect()})}return}let e=F();try{let t=(e?.onDidContentSizeChange)?.call(e,()=>Q());t&&zt.push(t)}catch{}try{let t=(e?.onDidLayoutChange)?.call(e,()=>Q());t&&zt.push(t)}catch{}}(),yr(),gr(),Z(),sr(),Q(),yield _();let a=null;Mt&&(a=yield Mt(),a&&(yield _(),yield q()));let o=a??(n===`diff`?yield Ir():yield function(){return T(this,null,function*(){if($())return yield _(),yield q(),$();for(let e=0;e<30;e++){if(M||z.value)return!1;let e=x.value,t=Nr(),n=Mr(e),r=!W.value.trim()||or(e);if(t&&n&&r&&(yield _(),yield q(),!M&&!z.value&&Nr()&&Mr(x.value)&&(!W.value.trim()||or(x.value))))return!0;yield _(),yield q()}return!1})}());M||(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,k.value=!1,j.value=!1,A.value=!1,void(H.value=!1);throw Ti(n),e}}).finally(()=>{L===a&&(L=null),function(){let e=ft;b&&e&&(ft=``,_(()=>{if(!M){let t=S.value?.offsetHeight??0;t>0&&b.reportHeight(e,t)}b.markSettled(e)}))}(),i&&!M&&queueMicrotask(()=>{var e;let t=x.value;t&&!M&&((e=ci(t))==null||e.catch(e=>{j.value=!1,H.value=!1,Ti()}))})});return L=a,a}i(ri,e=>{e||Ne()}),i(()=>K.value,(e,t)=>{var n;let r=z.value?I():F();r&&typeof e==`number`&&Number.isFinite(e)&&e>0&&((n=r.updateOptions)==null||n.call(r,{fontSize:e}),O.value||Y(!0))},{flush:`post`,immediate:!1});let li=0,ui=i(()=>[x.value,z.value,v.stream,v.loading,at.value,N.value,v.node.language,v.node.raw,v.node.code,v.node.loading],e=>T(null,[e],function*([e,t,n,r,i,a]){let o=++li;if(!e||!a||Vr()||sn||!1===n&&!1!==r||!P&&(yield function(){return T(this,null,function*(){if(typeof window>`u`||M||at.value||V.value)return;if(Pt)return Pt;let e=T(null,null,function*(){try{let e=yield We();if(M)return;if(!e)return void(V.value=!0);xn(e)}catch{if(M)return;V.value=!0}}).finally(()=>{Pt===e&&(Pt=null)});return Pt=e,e})}(),o!==li||!1===v.stream&&!1!==v.loading||Ur()||!N.value||!P||V.value||k.value||wi()||M||x.value!==e)||Ur())return;let s=ci(e);if(s){try{yield s}catch{j.value=!1,H.value=!1,Ti()}j.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 Ee({darkTheme:v.darkTheme,isDark:v.isDark,lightTheme:v.lightTheme,theme:v.theme,themes:v.themes})}function mi(){return T(this,arguments,function*(e={}){_i();let t=()=>{z.value&&qt(),y(()=>{yr(),Q()})};if(e.appearanceOnly)return void t();let n=pi();if(n)try{yield ye(hi()),yield It(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=Ye(w({},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:!Me.value,disableFileHeader:!0,workerManager:Jt.value?.workerManager??_e()??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=S.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=Se(e.overflow,r),t}function _i(){let e=gi();if(!R)return R=e,R;for(let t of Object.keys(R))t in e||delete R[t];return Object.assign(R,e),R}i(Qt,(e,t)=>T(null,null,function*(){if(e===t||U.value||sn||(qr(),!P||!x.value)||!k.value||!1===v.stream&&!1!==v.loading||!N.value)return;let n=L;if(n){try{yield n}catch{}if(M||!x.value)return}if($t.value!==e||!k.value||!j.value)try{j.value=!1,H.value=!1,k.value=!1,A.value=!1,wr(),Tr(),At(),yield _(),yield ci(x.value)}catch{j.value=!1,H.value=!1,Ti()}}));let vi=e(0),yi=g(()=>String(vi.value)),bi=!1;function xi(){let e=pi();return JSON.stringify({kind:Qt.value,language:E.value,structural:yi.value,optionsRevision:vi.value,settledContentGeneration:rn.value,theme:di(e)??(e==null?null:`custom`),isDark:v.isDark})}i(()=>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}),i(()=>[v.codeBlockOptions,v.showLineNumbers],()=>{vi.value+=1,!1===v.stream&&!1!==v.loading&&(bi=!0)},{deep:!0}),i(()=>[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,k.value=!1,j.value=!1,A.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 i(Si,()=>T(null,null,function*(){if(sn||!U.value||tn.value===Si.value||!P||!x.value||V.value||M||!N.value||!1===v.stream&&!1!==v.loading||Ur())return;let e=Si.value;sn=!0;try{if(Ci(),U.value)return;yield ci(x.value)}catch{j.value=!1,H.value=!1,Ti()}finally{cn=e,yield _(),sn=!1}})),i(()=>[v.codeBlockOptions,N.value],()=>{var e;if(_i(),!P||!N.value)return;let t=z.value?I():F(),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}),i(()=>[pi(),Xt.value,at.value,k.value,N.value],([e,t],n)=>{if(!at.value||!N.value)return;let r=n!=null&&fi(e,n[0]),i=n!=null&&t!==n[1];j.value?(ot=!1,mi({appearanceOnly:r})):r&&!i||(ot=!0)},{flush:`post`}),i(()=>[yi.value,at.value,N.value],(e,t)=>T(null,[e,t],function*([e,t,n],[r]){if(_i(),!t||!n||!P||!x.value||!k.value||e===r)return;if(!1===v.stream&&!1!==v.loading)return void(bi=!0);bi=!1;let i=L;if(i){try{yield i}catch{}if(M||!x.value)return}try{j.value=!1,H.value=!1,k.value=!1,A.value=!1,wr(),Tr(),At(),Vt&&xn(Vt),yield _(),yield ci(x.value,{allowStaleContentRetry:!1})}catch{j.value=!1,H.value=!1,Ti()}}),{flush:`post`}),i(()=>[v.loading,N.value],([e,t])=>{!1===e&&t&&bi&&(bi=!1,vi.value+=1)},{flush:`post`}),i(()=>[v.loading,N.value],(e,t)=>T(null,[e,t],function*([e,t],n){if(!t)return;let r=n?.[0];if(!1===r&&!1!==e&&z.value&&k.value&&(yield _(),y(()=>{T(null,null,function*(){let e=L;if(e)try{yield e}catch{}!M&&z.value&&!1!==v.loading&&(_i(),qt(),Q())})})),e)return;let i=r!==void 0&&!1!==r;yield _(),y(()=>{T(null,null,function*(){try{if(i&&(yield function(){return T(this,null,function*(){if(!U.value||!P||!x.value||V.value||M||!N.value)return!1;if(cn===Si.value)return!0;sn=!0;try{U.value=!1,tn.value=null,on=null,k.value=!1,j.value=!1,A.value=!1,H.value=!1,wr(),Tr(),At(),Vt&&xn(Vt),yield _();try{yield ci(x.value)}catch{j.value=!1,H.value=!1,Ti()}}finally{yield _(),sn=!1}return!0})}()))return void Y(!1);if(i&&z.value&&k.value&&ln&&x.value)return ln=!1,j.value=!1,H.value=!1,k.value=!1,A.value=!1,wr(),Tr(),At(),yield _(),yield ci(x.value,{allowStaleContentRetry:!1}),void Dr(!0);if(i&&k.value){if(z.value&&x.value){let e=L;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,E.value),M||!z.value)return;yield Promise.resolve(Dt()),qt(),X(!0),Xn(),Z(),sr();let n=yield Ir();M||!n||H.value||(yield Zn()),Q(),Dr(!0)}else qr(),Yr(W.value,E.value),yield new Promise(e=>{let t=()=>{M?e():Gr||Wr?setTimeout(t,16):e()};t()}),M||z.value||(yield Promise.resolve(Et()))}i&&z.value?(Y({preferModelDiffHeight:!0,holdCurrentDiffHeight:!0}),Dr(!0)):Y(!1)}catch{}})})}),{immediate:!0,flush:`post`}),l(()=>{wr(),Tr(),kt(),Rt?.()}),(e,r)=>{var i;return V.value?(a(),f(Le,{key:0,style:p(Gn.value),node:bn.value,loading:v.loading,"show-line-numbers":Me.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:r[0]||=e=>pe(`copy`,e)},ee({_:2},[e.$slots[`header-left`]?{name:`header-left`,fn:oe(()=>[t(e.$slots,`header-left`,{},void 0,!0)]),key:`0`}:void 0,e.$slots[`header-right`]?{name:`header-right`,fn:oe(()=>[t(e.$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`])):(a(),le(`div`,{key:1,ref_key:`container`,ref:S,style:p(ni.value),class:se([`code-block-container rounded-lg border`,[{dark:v.isDark,"is-rendering":v.loading,"is-dark":Zt.value,"is-diff":z.value,"is-plain-text":Xe.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":St.value&&ie(vt)&&!N.value?`true`:void 0},[n(Fe,{"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:u.stream,"is-collapsed":O.value,"is-expanded":D.value,"copy-text":qe.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},ee({"header-left":oe(()=>[t(e.$slots,`header-left`,{},()=>[h(`div`,$e,[h(`span`,{class:`icon-slot h-4 w-4 flex-shrink-0`,innerHTML:ti.value},null,8,et),h(`div`,tt,[h(`div`,nt,ae($r.value),1),ei.value?(a(),le(`div`,rt,ae(ei.value),1)):ce(``,!0)])])],!0)]),loading:oe(()=>[t(e.$slots,`loading`,{loading:u.loading,stream:u.stream},()=>[r[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:oe(()=>{var e;return[o(h(`div`,{class:se([`code-editor-layer`,{"code-editor-layer--collapsed":O.value}])},[h(`div`,{ref_key:`codeEditor`,ref:x,class:se([`code-editor-container`,u.stream?``:`code-height-placeholder`]),"data-markstream-host-hidden":gn.value?`true`:void 0,style:p(Jn.value)},null,14,it),hn.value?(a(),f(Le,{key:0,style:p(Gn.value),node:bn.value,loading:v.loading,"show-line-numbers":Me.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`])):ce(``,!0)],2),[[re,!!u.stream||!u.loading]]),yn.value&&!Ge.value&&Br.value&&C.value===`html`?(a(),f(Ze,{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`])):ce(``,!0)]}),_:2},[e.$slots[`header-right`]?{name:`header-right`,fn:oe(()=>[t(e.$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,Qe))}}}),[[`__scopeId`,`data-v-f293a87c`]]);export{k as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,G as t,I as n,J as r,P as i,T as a,c as o,d as s,f as c,g as l,ot as u,v as d,y as f,z as p}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{l as m}from"./index-
|
|
1
|
+
import{$ as e,G as t,I as n,J as r,P as i,T as a,c as o,d as s,f as c,g as l,ot as u,v as d,y as f,z as p}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{l as m}from"./index-BrayYbIF.js";var h={class:`conversation-search`},g=[`disabled`],_={key:0,role:`alert`},v={key:1},y={key:2},b=[`onClick`],x=[`disabled`],S=m(a({__name:`ConversationSearch`,props:{base:{},api:{type:Function}},emits:[`jump`],setup(a,{emit:m}){let S=a,C=m,w=e(``),T=e(``),E=e(!1),D=e(!1),O=e([]),k=e(null),A=e(``),j=0,M=``;i(()=>j++);function N(){j++,O.value=[],k.value=null,D.value=!1,E.value=!1,T.value=``}t(w,N),t(()=>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,t)=>(n(),f(`section`,h,[t[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:t[1]||=s(e=>P(!1),[`prevent`])},[r(l(`input`,{"onUpdate:modelValue":t[0]||=e=>w.value=e,type:`search`,maxlength:`500`,"aria-label":`Search conversation content`,placeholder:`Search all messages…`},null,512),[[o,w.value]]),l(`button`,{class:`btn`,disabled:E.value||!w.value.trim()},`Search`,8,g)],32),T.value?(n(),f(`p`,_,u(T.value),1)):d(``,!0),D.value&&!O.value.length&&!E.value?(n(),f(`p`,v,`No matching messages.`)):d(``,!0),E.value?(n(),f(`p`,y,`Searching…`)):d(``,!0),(n(!0),f(c,null,p(O.value,e=>(n(),f(`button`,{key:e.seq,class:`btn result`,onClick:t=>C(`jump`,e.seq,A.value)},u(e.role===`assistant`?`Agent reply`:`Your message`)+` · #`+u(e.seq)+u(e.count?` · ${e.count} matches`:``)+` →`,9,b))),128)),k.value===null?d(``,!0):(n(),f(`button`,{key:3,class:`btn`,disabled:E.value,onClick:t[2]||=e=>P(!0)},`More results`,8,x))]))}}),[[`__scopeId`,`data-v-c9855449`]]);export{S as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$ as e,C as t,G as n,H as r,I as i,M as a,S as o,T as s,_ as ee,at as c,f as l,g as u,h as d,j as f,nt as p,ot as m,v as h,y as g}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{a as te,l as _,n as ne,o as re,r as v,s as y,u as b}from"./index-
|
|
1
|
+
import{$ as e,C as t,G as n,H as r,I as i,M as a,S as o,T as s,_ as ee,at as c,f as l,g as u,h as d,j as f,nt as p,ot as m,v as h,y as g}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{a as te,l as _,n as ne,o as re,r as v,s as y,u as b}from"./index-BrayYbIF.js";import{n as x,t as S}from"./highlight-BnTrj1LT.js";var C={class:`file-view`},w={class:`file-bar`},T=[`title`],E={key:0,class:`file-bar-meta`},D=[`title`],ie=[`title`],ae={key:0,class:`timeline-empty`},oe={key:1,class:`file-error`},se=[`src`,`alt`],ce={key:0,class:`file-link-notice`,role:`status`},le={key:2,class:`file-text wrap`},ue={class:`code-wrap`},de={class:`code-gutter`,"aria-hidden":`true`},O=[`innerHTML`],k={key:2,class:`file-text`},A={key:0,class:`file-note`},j={key:5,class:`file-note`},M=_(s({__name:`FileViewer`,props:{hostId:{},cwd:{},path:{},api:{type:Function},session:{},jump:{},view:{},viewKey:{}},emits:[`open`,`reveal`,`view`],setup(s,{emit:_}){let M=s,N=_,P=e(null),F=e(``),I=e(!1),L=e(M.view?.rendered??!0),R=d(()=>`/hosts/${encodeURIComponent(M.hostId)}/fs`),z=d(()=>`cwd=${encodeURIComponent(M.cwd)}&path=${encodeURIComponent(M.path)}`),B=d(()=>/\.(png|jpe?g|webp|gif|bmp|avif)$/i.test(M.path)),V=d(()=>/\.(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&&ne()}catch(e){F.value=e.message}finally{I.value=!1}}n(()=>[M.hostId,M.cwd,M.path],H,{immediate:!0});let U=d(()=>M.path.startsWith(`/`)||M.path.startsWith(`~`)?M.path:`${M.cwd.replace(/\/$/,``)}/${M.path}`),fe=d(()=>{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 y(re(e,{...n,rawBase:`/api${R.value}`}),n)}),W=e(``),G;function K(e){W.value=e,clearTimeout(G),G=setTimeout(()=>W.value=``,4e3)}function pe(e){let t=e.target?.closest?.(`a`),n=te(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=e(null),J=e(M.view?.mark??null),Y=M.view?.jumped??0,X=!1,Z=d(()=>{let e=P.value?.text??``,t=1;for(let n=0;n<e.length;n++)e.charCodeAt(n)===10&&t++;return t});n([()=>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 f();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 f(),q.value&&(q.value.scrollTop=t),requestAnimationFrame(()=>{q.value&&q.value.scrollTop<t&&(q.value.scrollTop=t)}))},{immediate:!0}),a(()=>{M.viewKey&&N(`view`,M.viewKey,{rendered:L.value,scrollTop:q.value?.scrollTop??0,mark:J.value,jumped:Y})});let me=d(()=>`/api${R.value}/raw?${z.value}`),he=d(()=>Array.from({length:Z.value},(e,t)=>t+1).join(`
|
|
2
2
|
`)),Q=d(()=>P.value?.text===void 0?null:S(P.value.text,x(M.path))),ge=e=>e<1024?`${e} B`:e<1048576?`${(e/1024).toFixed(1)} KB`:`${(e/1024/1024).toFixed(1)} MB`,$=e(!1);async function _e(){await navigator.clipboard?.writeText(U.value).catch(()=>{}),$.value=!0,setTimeout(()=>$.value=!1,1200)}return(e,n)=>(i(),g(`div`,C,[u(`div`,w,[t(b,{name:`file`,size:14,class:`file-bar-icon`}),u(`span`,{class:`file-bar-path`,title:s.path},m(s.path),9,T),P.value?(i(),g(`span`,E,m(ge(P.value.size)),1)):h(``,!0),V.value?(i(),g(`button`,{key:1,class:`icon-btn`,title:L.value?`Show source`:`Show rendered`,onClick:n[0]||=e=>L.value=!L.value},[t(b,{name:L.value?`terminal`:`eye`,size:14},null,8,[`name`])],8,D)):h(``,!0),u(`button`,{class:`icon-btn`,title:`Reload`,"aria-label":`Reload file`,onClick:H},[t(b,{name:`refresh`,size:14})]),u(`button`,{class:`icon-btn`,title:$.value?`Copied`:`Copy path`,"aria-label":`Copy path`,onClick:_e},[t(b,{name:$.value?`check`:`copy`,size:14},null,8,[`name`])],8,ie)]),u(`div`,{ref_key:`body`,ref:q,class:`file-body`},[I.value&&!P.value?(i(),g(`div`,ae,[...n[1]||=[u(`span`,{class:`spinner`},null,-1)]])):F.value?(i(),g(`p`,oe,[t(b,{name:`alert`,size:13}),o(m(F.value),1)])):B.value?(i(),g(`img`,{key:2,src:me.value,alt:s.path,class:`file-image`},null,8,se)):V.value&&L.value?(i(),g(`div`,{key:3,class:`file-markdown`,onClick:pe},[W.value?(i(),g(`p`,ce,m(W.value),1)):h(``,!0),p(v)?(i(),ee(r(p(v)),{key:1,content:fe.value,final:!0},null,8,[`content`])):(i(),g(`pre`,le,m(P.value?.text),1))])):P.value?.text===void 0?P.value?(i(),g(`p`,j,m(P.value.mime||P.value.kind)+` · not shown as text`,1)):h(``,!0):(i(),g(l,{key:4},[u(`div`,ue,[J.value?(i(),g(`div`,{key:0,class:`line-mark`,style:c({top:J.value.top+`px`,height:J.value.height+`px`}),"aria-hidden":`true`},null,4)):h(``,!0),u(`pre`,de,m(he.value),1),Q.value===null?(i(),g(`pre`,k,m(P.value.text),1)):(i(),g(`pre`,{key:1,class:`file-text hljs`,innerHTML:Q.value},null,8,O))]),P.value.truncated?(i(),g(`p`,A,`Showing the first 1 MB.`)):h(``,!0)],64))],512)]))}}),[[`__scopeId`,`data-v-b6228f15`]]);export{M as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,C as t,G as n,I as r,S as i,T as a,_ as o,at as s,et as c,f as l,g as u,h as d,j as f,ot as p,rt as m,v as h,y as g,z as _}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{l as v,u as y}from"./index-
|
|
1
|
+
import{$ as e,C as t,G as n,I as r,S as i,T as a,_ as o,at as s,et as c,f as l,g as u,h as d,j as f,ot as p,rt as m,v as h,y as g,z as _}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{l as v,u as y}from"./index-BrayYbIF.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=v(a({__name:`FilesPanel`,props:{hostId:{},cwd:{},api:{type:Function},activePath:{},reveal:{}},emits:[`open`],setup(a,{emit:v}){let k=a,A=v,j=c(new Map),M=e(new Set),N=e(new Set),P=e(``),F=d(()=>`/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}}n(()=>[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=d(()=>{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=e(null),U=e(null);return n(()=>k.activePath,()=>U.value=null),n(()=>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 f();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}),(e,n)=>(r(),g(`div`,b,[u(`div`,x,[u(`span`,{class:`files-root`,title:a.cwd},p(a.cwd.split(`/`).filter(Boolean).pop()||a.cwd),9,S),u(`button`,{class:`icon-btn`,title:`Refresh`,"aria-label":`Refresh files`,onClick:n[0]||=e=>{j.value=new Map,M.value=new Set,R(`.`)}},[t(y,{name:`refresh`,size:14})])]),P.value?(r(),g(`p`,C,[t(y,{name:`alert`,size:13}),i(p(P.value),1)])):h(``,!0),u(`div`,{ref_key:`tree`,ref:H,class:`tree`,role:`tree`},[(r(!0),g(l,null,_(V.value,e=>(r(),g(`button`,{key:e.entry.path,class:m([`tree-row`,{chosen:e.entry.path===a.activePath||e.entry.path===U.value}]),"data-path":e.entry.path,role:`treeitem`,"aria-expanded":e.entry.kind===`directory`?M.value.has(e.entry.path):void 0,style:s({paddingLeft:8+e.depth*14+`px`}),title:e.entry.path,onClick:t=>e.entry.kind===`directory`?B(e.entry):A(`open`,e.entry.path)},[e.entry.kind===`directory`?(r(),o(y,{key:0,name:`chevron`,size:11,class:m([`tree-caret`,{open:M.value.has(e.entry.path)}])},null,8,[`class`])):(r(),g(`span`,T)),t(y,{name:e.entry.kind===`directory`?`folder`:`file`,size:14,class:`tree-icon`},null,8,[`name`]),u(`span`,E,p(e.entry.name),1),N.value.has(e.entry.path)?(r(),g(`span`,D)):h(``,!0)],14,w))),128)),!V.value.length&&N.value.has(`.`)?(r(),g(`div`,O,[...n[1]||=[u(`span`,{class:`spinner`},null,-1)]])):h(``,!0)],512)]))}}),[[`__scopeId`,`data-v-4159b030`]]);export{k as default};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{$ as e,C as t,I as n,J as r,N as i,P as a,S as o,T as s,a as c,c as l,f as u,g as d,h as f,ot as p,rt as ee,s as m,v as h,y as g,z as _}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{l as v,u as te}from"./index-DVB90YUp.js";var ne={class:`page host-settings`},re={class:`page-head`},ie={class:`subtle`},ae={key:0},oe={class:`page-body`},se={class:`hs-actions`},ce=[`disabled`],le=[`disabled`],ue={key:0,class:`subtle`},de={key:0,class:`setting-note is-error`,role:`alert`},fe={key:1,class:`setting-note`,role:`status`},pe=[`disabled`],me={class:`card`},he={key:0,class:`card-row switch-row`},ge={class:`grow`},_e={class:`row-title`},ve={class:`row-sub`},ye=[`onUpdate:modelValue`],be={key:0,class:`card-row switch-row`},xe={key:1,class:`card-row switch-row`},Se={key:2,class:`card-row switch-row`},Ce={class:`card form-card`},we={class:`field`},Te={key:0,class:`field`},Ee={class:`hs-grid`},De={class:`field`},Oe=[`onUpdate:modelValue`],ke={class:`field`},Ae=[`onUpdate:modelValue`],je={class:`field`},y=[`onUpdate:modelValue`,`list`],b={class:`field`},x=[`onUpdate:modelValue`],S={class:`field`},Me=[`onUpdate:modelValue`],Ne={class:`field`},Pe=[`onUpdate:modelValue`],Fe={class:`hs-actions`},Ie=[`disabled`,`onClick`],Le=[`onClick`],Re={class:`card form-card`},ze={class:`field`},Be=[`value`],Ve={class:`card`},He={class:`grow switch-row`},Ue=[`checked`,`onChange`],We=[`onClick`],Ge=[`onClick`],Ke={key:0,class:`hs-grid`},qe={class:`field`},Je=[`onUpdate:modelValue`],Ye={class:`field`},Xe=[`onUpdate:modelValue`],Ze={key:1,class:`field`},Qe=[`value`,`onChange`],$e={class:`switch-row`},et=[`checked`,`onChange`],tt={class:`field`},nt=[`onUpdate:modelValue`],rt={class:`field`},it=[`onUpdate:modelValue`],at={class:`switch-row`},ot=[`onUpdate:modelValue`],st=[`onClick`],ct=[`onClick`],lt={class:`card form-card`},ut={class:`field`},dt={key:2,open:``},ft={class:`hs-output`},pt={class:`hs-grid`},mt={class:`field`},ht=[`onUpdate:modelValue`],gt={class:`field`},_t=[`onUpdate:modelValue`,`list`],vt={class:`field`},yt=[`onUpdate:modelValue`],bt={class:`hs-actions`},xt=[`disabled`,`onClick`],St=[`onClick`],Ct={class:`hs-grid`},wt={class:`field`},Tt=[`onUpdate:modelValue`],Et={class:`field`},Dt=[`onUpdate:modelValue`],Ot={class:`field`},kt=[`value`,`onInput`],At={class:`hs-actions`},jt=[`disabled`,`onClick`],Mt=[`onClick`],Nt={class:`card`},Pt={class:`card-row switch-row`},Ft={key:0,class:`card-row switch-row`},It={class:`row-title`},Lt={class:`subtle`},Rt={key:0,class:`setting-note is-error`},zt={class:`hs-actions`},Bt=[`onClick`],Vt=[`onClick`],Ht=[`onClick`],Ut={key:0,class:`card form-card`},Wt={class:`field`},Gt=[`disabled`],Kt={class:`subtle`},qt={class:`hs-actions`},Jt=[`disabled`],Yt=[`disabled`],Xt={key:5,class:`subtle`},Zt={key:6,class:`subtle`},Qt={key:0},$t={key:1},en={key:8,class:`hs-output`},tn={id:`hs-providers`},nn=[`value`],rn=[`id`],an=[`value`],C=v(s({__name:`HostSettings`,props:{host:{},api:{type:Function}},emits:[`back`],setup(s,{emit:v}){let C=s,on=v,w=`/hosts/${encodeURIComponent(C.host.id)}`,T=e(null),E=e({}),D=e({}),O=e(``),k=e(!1),A=e(null),j,M=!1;a(()=>{M=!0,clearTimeout(j)});let N=e(``),P=e(!1),F=e(``),I=e(``),L=e(``),R=e(null),z=e([]),B=e(``),V=e(``),H=e([]),U=e(``),W=f(()=>JSON.stringify(T.value)!==JSON.stringify(E.value)),sn=[[`idleRuntimeCleanup`,`Release idle agents`,`Release safe, resumable idle runtimes to save memory.`,`idleRuntimeCleanupSetting`],[`resumeOnStartup`,`Resume agents after restart`,`Resume interrupted agents when this daemon starts.`,`resumeOnStartupSetting`],[`autoArchiveAfterMerge`,`Archive merged workspaces`,`Automatically archive workspaces after their changes are merged.`,``],[`enableTerminalAgentHooks`,`Terminal agent hooks`,`Track supported agents launched from terminals.`,``],[`pluginsEnabled`,`Enable host plugins`,`Allow this host to run its configured plugins.`,``]];function G(e){T.value=structuredClone(e.config),E.value=structuredClone(e.config),N.value=e.revision,D.value=e.features,e.desktopManaged!==void 0&&(k.value=e.desktopManaged),e.version&&(O.value=e.version)}async function K(){if(!(W.value&&T.value&&!confirm(`Discard unsaved host settings?`))){P.value=!0,F.value=I.value=``;try{G(await C.api(w+`/settings`)),D.value.skillManagement&&(R.value=await C.api(w+`/skills`)),D.value.plugins&&(z.value=await C.api(w+`/plugins`))}catch(e){F.value=e.message}finally{P.value=!1}}}async function cn(){P.value=!0,F.value=I.value=``;try{let e=Object.fromEntries(Object.entries(T.value).filter(([e,t])=>JSON.stringify(t)!==JSON.stringify(E.value[e])));for(let[t,n]of Object.entries(e.providers??{}))if(E.value.providers?.[t]?.command&&!n.command)throw Error(`Clear command overrides in the host configuration; this form can only replace them.`);for(let t of[`agentProfiles`,`terminalProfiles`])if(e[t]){e[t]=e[t].map(e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>!([`model`,`modeId`,`thinkingOptionId`,`icon`,`color`].includes(e)&&t===``))));let n=e[t].map(e=>e.id);if(new Set(n).size!==n.length||e[t].some(e=>!e.name.trim()||!(e.provider??e.command)?.trim()))throw Error(`Every profile needs a unique ID, name and provider or command.`)}e.metadataGeneration&&(e.metadataGeneration.providers=e.metadataGeneration.providers.map(e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==``)))),G(await C.api(w+`/settings`,`PATCH`,{revision:N.value,patch:e})),I.value=`Saved on this host. Launch settings apply to future agents and terminals.`}catch(e){F.value=e.message}finally{P.value=!1}}function ln(){(!W.value||confirm(`Discard unsaved host settings?`))&&on(`back`)}async function q(e,t){if(t!==`remove`||confirm(`Remove plugin ${e} from this host?`)){P.value=!0,F.value=``;try{await C.api(w+`/plugins`+(e?`/`+encodeURIComponent(e)+`/`+t:``),`POST`,e?{}:{source:B.value}),z.value=await C.api(w+`/plugins`),B.value=``}catch(e){F.value=e.message}finally{P.value=!1}}}async function J(){clearTimeout(j);try{let e=await C.api(w+`/lifecycle`);if(M)return;A.value=e,e?.state===`complete`&&e.version&&(O.value=e.version),e?.state===`running`&&(j=setTimeout(()=>void J(),2e3))}catch{M||(F.value=`Could not check the operation. Reopen this page to check its outcome.`)}}async function Y(e){if(confirm(`${e===`restart`?`Restart`:`Update and restart`} ${C.host.label}? Running agents may be interrupted and this host will disconnect temporarily.`)){P.value=!0,F.value=I.value=``;try{A.value=await C.api(w+`/lifecycle/`+e,`POST`,{}),J()}catch(e){F.value=e.message+`. Check host status before retrying.`}finally{P.value=!1}}}async function un(){P.value=!0,F.value=``;try{V.value=JSON.stringify(await C.api(w+`/status`),null,2)}catch(e){F.value=e.message}finally{P.value=!1}}async function X(){P.value=!0,F.value=I.value=``;try{let e=await C.api(w+`/skills`,`PUT`,{selection:R.value.selection.mode===`all`?{mode:`all`}:R.value.selection});if(e.confirmationRequired){if(!confirm(`Remove these managed skills? `+e.confirmationRequired.removals.join(`, `)))return;e=await C.api(w+`/skills`,`PUT`,{selection:R.value.selection.mode===`all`?{mode:`all`}:R.value.selection,confirmedRemovals:e.confirmationRequired.removals})}R.value=e,I.value=`Skill selection saved on this host.`}catch(e){F.value=e.message}finally{P.value=!1}}function Z(e){let t=T.value;(t[e]??=[]).push(e===`agentProfiles`?{id:crypto.randomUUID(),name:``,provider:H.value[0]?.id??`codex`,notes:``}:{id:crypto.randomUUID(),name:``,command:``,args:[]})}function Q(e,t,n){let r=Number(t),i=r+n;i>=0&&i<e.length&&([e[r],e[i]]=[e[i],e[r]])}async function dn(e){P.value=!0,F.value=``;try{U.value=JSON.stringify(await C.api(w+`/provider-diagnostic/`+encodeURIComponent(e)),null,2)}catch(e){F.value=e.message}finally{P.value=!1}}let $=f(()=>[...new Set([...H.value.map(e=>e.id),...Object.keys(T.value?.providers??{})])]);function fn(e){let t=T.value;return t.providers??={},t.providers[e]??={}}function pn(){let e=L.value.trim();!/^[a-z][a-z0-9-]*$/.test(e)||$.value.includes(e)?F.value=`Choose a unique provider ID using lowercase letters, digits and hyphens.`:(T.value.providers??={},T.value.providers[e]={extends:`codex`,label:e,enabled:!0},L.value=``)}function mn(e,t){let n=T.value;n.providers??={},n.providers[e]={...n.providers[e],enabled:t}}return i(()=>{K(),J(),C.api(w+`/providers`).then(e=>{H.value=e}).catch(()=>{})}),(e,i)=>(n(),g(`section`,ne,[d(`header`,re,[d(`button`,{class:`icon-btn`,"aria-label":`Back to hosts`,onClick:ln},[t(te,{name:`back`,size:18})]),d(`div`,null,[d(`h1`,null,p(s.host.label),1),d(`p`,ie,[i[18]||=o(` Host settings · affects every client connected to this daemon`,-1),O.value?(n(),g(`span`,ae,` · `+p(O.value),1)):h(``,!0)])])]),d(`div`,oe,[d(`div`,se,[d(`button`,{class:`btn btn-outline`,disabled:P.value,onClick:K},`Reload`,8,ce),d(`button`,{class:`btn btn-primary`,disabled:P.value||!T.value||!W.value||A.value?.state===`running`,onClick:cn},p(P.value?`Working…`:`Save changes`),9,le),W.value&&T.value?(n(),g(`span`,ue,`Unsaved changes`)):h(``,!0)]),F.value?(n(),g(`p`,de,p(F.value),1)):h(``,!0),I.value?(n(),g(`p`,fe,p(I.value),1)):h(``,!0),T.value?(n(),g(`fieldset`,{key:2,disabled:P.value||A.value?.state===`running`,class:`hs-fields`},[i[55]||=d(`h2`,{class:`section-label`},`Agents & workspaces`,-1),d(`div`,me,[(n(),g(u,null,_(sn,([e,t,i,a])=>(n(),g(u,{key:e},[(!a||D.value[a])&&(e in T.value||a)?(n(),g(`label`,he,[d(`div`,ge,[d(`div`,_e,p(t),1),d(`div`,ve,p(i),1)]),r(d(`input`,{"onUpdate:modelValue":t=>T.value[e]=t,type:`checkbox`,class:`switch`},null,8,ye),[[c,T.value[e]]])])):h(``,!0)],64))),64)),T.value.mcp?(n(),g(`label`,be,[i[19]||=d(`div`,{class:`grow`},[d(`div`,{class:`row-title`},`Paseo orchestration tools`),d(`div`,{class:`row-sub`},`Inject Paseo tools into agents.`)],-1),r(d(`input`,{"onUpdate:modelValue":i[0]||=e=>T.value.mcp.injectIntoAgents=e,type:`checkbox`,class:`switch`},null,512),[[c,T.value.mcp.injectIntoAgents]])])):h(``,!0),T.value.browserTools?(n(),g(`label`,xe,[i[20]||=d(`div`,{class:`grow`},[d(`div`,{class:`row-title`},`Browser tools`),d(`div`,{class:`row-sub`},` Allow agents to use browser automation supported by this host. `)],-1),r(d(`input`,{"onUpdate:modelValue":i[1]||=e=>T.value.browserTools.enabled=e,type:`checkbox`,class:`switch`},null,512),[[c,T.value.browserTools.enabled]])])):h(``,!0),T.value.usage?(n(),g(`label`,Se,[i[21]||=d(`div`,{class:`grow row-title`},`Collect provider usage`,-1),r(d(`input`,{"onUpdate:modelValue":i[2]||=e=>T.value.usage.enabled=e,type:`checkbox`,class:`switch`},null,512),[[c,T.value.usage.enabled]])])):h(``,!0)]),d(`div`,Ce,[d(`label`,we,[i[22]||=d(`span`,null,`Additional system instructions`,-1),r(d(`textarea`,{"onUpdate:modelValue":i[3]||=e=>T.value.appendSystemPrompt=e,rows:`5`,placeholder:`Instructions appended for agents on this host`},null,512),[[l,T.value.appendSystemPrompt]])]),D.value.resumeOnStartupSetting?(n(),g(`label`,Te,[i[23]||=d(`span`,null,`Restart recovery prompt`,-1),r(d(`textarea`,{"onUpdate:modelValue":i[4]||=e=>T.value.resumePrompt=e,rows:`3`,placeholder:`Prompt used when resuming interrupted work`},null,512),[[l,T.value.resumePrompt]])])):h(``,!0)]),D.value.agentProfiles?(n(),g(u,{key:0},[i[30]||=d(`h2`,{class:`section-label`},`Agent profiles`,-1),i[31]||=d(`p`,{class:`subtle`},`Named launch settings, also available to orchestrating agents.`,-1),(n(!0),g(u,null,_(T.value.agentProfiles??[],(e,t)=>(n(),g(`div`,{key:e.id,class:`card form-card`},[d(`div`,Ee,[d(`label`,De,[i[24]||=d(`span`,null,`Name`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.name=t},null,8,Oe),[[l,e.name]])]),d(`label`,ke,[i[25]||=d(`span`,null,`Provider`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.provider=t,list:`hs-providers`},null,8,Ae),[[l,e.provider]])]),d(`label`,je,[i[26]||=d(`span`,null,`Model (optional)`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.model=t,list:`hs-models-`+e.provider},null,8,y),[[l,e.model]])]),d(`label`,b,[i[27]||=d(`span`,null,`Mode ID (optional)`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.modeId=t},null,8,x),[[l,e.modeId]])]),d(`label`,S,[i[28]||=d(`span`,null,`Thinking level ID (optional)`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.thinkingOptionId=t},null,8,Me),[[l,e.thinkingOptionId]])])]),d(`label`,Ne,[i[29]||=d(`span`,null,`When to use`,-1),r(d(`textarea`,{"onUpdate:modelValue":t=>e.notes=t,rows:`2`},null,8,Pe),[[l,e.notes]])]),d(`div`,Fe,[d(`button`,{class:`btn btn-outline`,disabled:t===0,onClick:e=>Q(T.value.agentProfiles,t,-1)},` Move up`,8,Ie),d(`button`,{class:`btn btn-outline`,onClick:e=>T.value.agentProfiles.splice(t,1)},` Remove profile `,8,Le)])]))),128)),d(`button`,{class:`btn btn-outline`,onClick:i[5]||=e=>Z(`agentProfiles`)},` Add agent profile `)],64)):h(``,!0),R.value?(n(),g(u,{key:1},[i[33]||=d(`h2`,{class:`section-label`},`Paseo skills`,-1),d(`div`,Re,[d(`label`,ze,[d(`span`,null,`Installed skills · `+p(R.value.state),1),r(d(`select`,{"onUpdate:modelValue":i[6]||=e=>R.value.selection.mode=e,onChange:i[7]||=e=>R.value.selection.mode===`custom`&&(R.value.selection.skills??=[...R.value.installed])},[...i[32]||=[d(`option`,{value:`all`},`All Paseo skills`,-1),d(`option`,{value:`custom`},`Choose skills`,-1)]],544),[[m,R.value.selection.mode]])]),R.value.selection.mode===`custom`?(n(!0),g(u,{key:0},_(R.value.available,e=>(n(),g(`label`,{key:e,class:`switch-row`},[d(`span`,null,p(e),1),r(d(`input`,{"onUpdate:modelValue":i[8]||=e=>R.value.selection.skills=e,type:`checkbox`,value:e},null,8,Be),[[c,R.value.selection.skills]])]))),128)):h(``,!0),d(`button`,{class:`btn btn-outline`,onClick:X},`Save skill selection`)])],64)):h(``,!0),i[56]||=d(`h2`,{class:`section-label`},`Providers`,-1),d(`div`,Ve,[(n(!0),g(u,null,_($.value,e=>(n(),g(`div`,{key:e,class:`card-row`},[d(`label`,He,[d(`span`,null,p(H.value.find(t=>t.id===e)?.label??e),1),d(`input`,{type:`checkbox`,class:`switch`,checked:T.value.providers?.[e]?.enabled!==!1,onChange:t=>mn(e,t.target.checked)},null,40,Ue)]),d(`button`,{class:`btn btn-outline`,onClick:t=>dn(e)},`Diagnostic`,8,We)]))),128))]),(n(!0),g(u,null,_($.value,e=>(n(),g(`details`,{key:`edit-`+e,class:`card form-card`},[d(`summary`,{onClick:t=>fn(e)},`Configure `+p(e),9,Ge),T.value.providers?.[e]?(n(),g(u,{key:0},[T.value.providers[e].extends?(n(),g(`div`,Ke,[d(`label`,qe,[i[34]||=d(`span`,null,`Display name`,-1),r(d(`input`,{"onUpdate:modelValue":t=>T.value.providers[e].label=t},null,8,Je),[[l,T.value.providers[e].label]])]),d(`label`,Ye,[i[35]||=d(`span`,null,`Based on`,-1),r(d(`select`,{"onUpdate:modelValue":t=>T.value.providers[e].extends=t},[(n(),g(u,null,_([`claude`,`codex`,`copilot`,`opencode`,`pi`,`omp`,`acp`],e=>d(`option`,{key:e},p(e),1)),64))],8,Xe),[[m,T.value.providers[e].extends]])])])):h(``,!0),T.value.providers[e].extends?(n(),g(`label`,Ze,[i[36]||=d(`span`,null,`Command override (one argument per line)`,-1),d(`textarea`,{value:(T.value.providers[e].command??[]).join(`
|
|
1
|
+
import{$ as e,C as t,I as n,J as r,N as i,P as a,S as o,T as s,a as c,c as l,f as u,g as d,h as f,ot as p,rt as ee,s as m,v as h,y as g,z as _}from"./vue.runtime.esm-bundler-DwGo9CTz.js";import{l as v,u as te}from"./index-BrayYbIF.js";var ne={class:`page host-settings`},re={class:`page-head`},ie={class:`subtle`},ae={key:0},oe={class:`page-body`},se={class:`hs-actions`},ce=[`disabled`],le=[`disabled`],ue={key:0,class:`subtle`},de={key:0,class:`setting-note is-error`,role:`alert`},fe={key:1,class:`setting-note`,role:`status`},pe=[`disabled`],me={class:`card`},he={key:0,class:`card-row switch-row`},ge={class:`grow`},_e={class:`row-title`},ve={class:`row-sub`},ye=[`onUpdate:modelValue`],be={key:0,class:`card-row switch-row`},xe={key:1,class:`card-row switch-row`},Se={key:2,class:`card-row switch-row`},Ce={class:`card form-card`},we={class:`field`},Te={key:0,class:`field`},Ee={class:`hs-grid`},De={class:`field`},Oe=[`onUpdate:modelValue`],ke={class:`field`},Ae=[`onUpdate:modelValue`],je={class:`field`},y=[`onUpdate:modelValue`,`list`],b={class:`field`},x=[`onUpdate:modelValue`],S={class:`field`},Me=[`onUpdate:modelValue`],Ne={class:`field`},Pe=[`onUpdate:modelValue`],Fe={class:`hs-actions`},Ie=[`disabled`,`onClick`],Le=[`onClick`],Re={class:`card form-card`},ze={class:`field`},Be=[`value`],Ve={class:`card`},He={class:`grow switch-row`},Ue=[`checked`,`onChange`],We=[`onClick`],Ge=[`onClick`],Ke={key:0,class:`hs-grid`},qe={class:`field`},Je=[`onUpdate:modelValue`],Ye={class:`field`},Xe=[`onUpdate:modelValue`],Ze={key:1,class:`field`},Qe=[`value`,`onChange`],$e={class:`switch-row`},et=[`checked`,`onChange`],tt={class:`field`},nt=[`onUpdate:modelValue`],rt={class:`field`},it=[`onUpdate:modelValue`],at={class:`switch-row`},ot=[`onUpdate:modelValue`],st=[`onClick`],ct=[`onClick`],lt={class:`card form-card`},ut={class:`field`},dt={key:2,open:``},ft={class:`hs-output`},pt={class:`hs-grid`},mt={class:`field`},ht=[`onUpdate:modelValue`],gt={class:`field`},_t=[`onUpdate:modelValue`,`list`],vt={class:`field`},yt=[`onUpdate:modelValue`],bt={class:`hs-actions`},xt=[`disabled`,`onClick`],St=[`onClick`],Ct={class:`hs-grid`},wt={class:`field`},Tt=[`onUpdate:modelValue`],Et={class:`field`},Dt=[`onUpdate:modelValue`],Ot={class:`field`},kt=[`value`,`onInput`],At={class:`hs-actions`},jt=[`disabled`,`onClick`],Mt=[`onClick`],Nt={class:`card`},Pt={class:`card-row switch-row`},Ft={key:0,class:`card-row switch-row`},It={class:`row-title`},Lt={class:`subtle`},Rt={key:0,class:`setting-note is-error`},zt={class:`hs-actions`},Bt=[`onClick`],Vt=[`onClick`],Ht=[`onClick`],Ut={key:0,class:`card form-card`},Wt={class:`field`},Gt=[`disabled`],Kt={class:`subtle`},qt={class:`hs-actions`},Jt=[`disabled`],Yt=[`disabled`],Xt={key:5,class:`subtle`},Zt={key:6,class:`subtle`},Qt={key:0},$t={key:1},en={key:8,class:`hs-output`},tn={id:`hs-providers`},nn=[`value`],rn=[`id`],an=[`value`],C=v(s({__name:`HostSettings`,props:{host:{},api:{type:Function}},emits:[`back`],setup(s,{emit:v}){let C=s,on=v,w=`/hosts/${encodeURIComponent(C.host.id)}`,T=e(null),E=e({}),D=e({}),O=e(``),k=e(!1),A=e(null),j,M=!1;a(()=>{M=!0,clearTimeout(j)});let N=e(``),P=e(!1),F=e(``),I=e(``),L=e(``),R=e(null),z=e([]),B=e(``),V=e(``),H=e([]),U=e(``),W=f(()=>JSON.stringify(T.value)!==JSON.stringify(E.value)),sn=[[`idleRuntimeCleanup`,`Release idle agents`,`Release safe, resumable idle runtimes to save memory.`,`idleRuntimeCleanupSetting`],[`resumeOnStartup`,`Resume agents after restart`,`Resume interrupted agents when this daemon starts.`,`resumeOnStartupSetting`],[`autoArchiveAfterMerge`,`Archive merged workspaces`,`Automatically archive workspaces after their changes are merged.`,``],[`enableTerminalAgentHooks`,`Terminal agent hooks`,`Track supported agents launched from terminals.`,``],[`pluginsEnabled`,`Enable host plugins`,`Allow this host to run its configured plugins.`,``]];function G(e){T.value=structuredClone(e.config),E.value=structuredClone(e.config),N.value=e.revision,D.value=e.features,e.desktopManaged!==void 0&&(k.value=e.desktopManaged),e.version&&(O.value=e.version)}async function K(){if(!(W.value&&T.value&&!confirm(`Discard unsaved host settings?`))){P.value=!0,F.value=I.value=``;try{G(await C.api(w+`/settings`)),D.value.skillManagement&&(R.value=await C.api(w+`/skills`)),D.value.plugins&&(z.value=await C.api(w+`/plugins`))}catch(e){F.value=e.message}finally{P.value=!1}}}async function cn(){P.value=!0,F.value=I.value=``;try{let e=Object.fromEntries(Object.entries(T.value).filter(([e,t])=>JSON.stringify(t)!==JSON.stringify(E.value[e])));for(let[t,n]of Object.entries(e.providers??{}))if(E.value.providers?.[t]?.command&&!n.command)throw Error(`Clear command overrides in the host configuration; this form can only replace them.`);for(let t of[`agentProfiles`,`terminalProfiles`])if(e[t]){e[t]=e[t].map(e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>!([`model`,`modeId`,`thinkingOptionId`,`icon`,`color`].includes(e)&&t===``))));let n=e[t].map(e=>e.id);if(new Set(n).size!==n.length||e[t].some(e=>!e.name.trim()||!(e.provider??e.command)?.trim()))throw Error(`Every profile needs a unique ID, name and provider or command.`)}e.metadataGeneration&&(e.metadataGeneration.providers=e.metadataGeneration.providers.map(e=>Object.fromEntries(Object.entries(e).filter(([,e])=>e!==``)))),G(await C.api(w+`/settings`,`PATCH`,{revision:N.value,patch:e})),I.value=`Saved on this host. Launch settings apply to future agents and terminals.`}catch(e){F.value=e.message}finally{P.value=!1}}function ln(){(!W.value||confirm(`Discard unsaved host settings?`))&&on(`back`)}async function q(e,t){if(t!==`remove`||confirm(`Remove plugin ${e} from this host?`)){P.value=!0,F.value=``;try{await C.api(w+`/plugins`+(e?`/`+encodeURIComponent(e)+`/`+t:``),`POST`,e?{}:{source:B.value}),z.value=await C.api(w+`/plugins`),B.value=``}catch(e){F.value=e.message}finally{P.value=!1}}}async function J(){clearTimeout(j);try{let e=await C.api(w+`/lifecycle`);if(M)return;A.value=e,e?.state===`complete`&&e.version&&(O.value=e.version),e?.state===`running`&&(j=setTimeout(()=>void J(),2e3))}catch{M||(F.value=`Could not check the operation. Reopen this page to check its outcome.`)}}async function Y(e){if(confirm(`${e===`restart`?`Restart`:`Update and restart`} ${C.host.label}? Running agents may be interrupted and this host will disconnect temporarily.`)){P.value=!0,F.value=I.value=``;try{A.value=await C.api(w+`/lifecycle/`+e,`POST`,{}),J()}catch(e){F.value=e.message+`. Check host status before retrying.`}finally{P.value=!1}}}async function un(){P.value=!0,F.value=``;try{V.value=JSON.stringify(await C.api(w+`/status`),null,2)}catch(e){F.value=e.message}finally{P.value=!1}}async function X(){P.value=!0,F.value=I.value=``;try{let e=await C.api(w+`/skills`,`PUT`,{selection:R.value.selection.mode===`all`?{mode:`all`}:R.value.selection});if(e.confirmationRequired){if(!confirm(`Remove these managed skills? `+e.confirmationRequired.removals.join(`, `)))return;e=await C.api(w+`/skills`,`PUT`,{selection:R.value.selection.mode===`all`?{mode:`all`}:R.value.selection,confirmedRemovals:e.confirmationRequired.removals})}R.value=e,I.value=`Skill selection saved on this host.`}catch(e){F.value=e.message}finally{P.value=!1}}function Z(e){let t=T.value;(t[e]??=[]).push(e===`agentProfiles`?{id:crypto.randomUUID(),name:``,provider:H.value[0]?.id??`codex`,notes:``}:{id:crypto.randomUUID(),name:``,command:``,args:[]})}function Q(e,t,n){let r=Number(t),i=r+n;i>=0&&i<e.length&&([e[r],e[i]]=[e[i],e[r]])}async function dn(e){P.value=!0,F.value=``;try{U.value=JSON.stringify(await C.api(w+`/provider-diagnostic/`+encodeURIComponent(e)),null,2)}catch(e){F.value=e.message}finally{P.value=!1}}let $=f(()=>[...new Set([...H.value.map(e=>e.id),...Object.keys(T.value?.providers??{})])]);function fn(e){let t=T.value;return t.providers??={},t.providers[e]??={}}function pn(){let e=L.value.trim();!/^[a-z][a-z0-9-]*$/.test(e)||$.value.includes(e)?F.value=`Choose a unique provider ID using lowercase letters, digits and hyphens.`:(T.value.providers??={},T.value.providers[e]={extends:`codex`,label:e,enabled:!0},L.value=``)}function mn(e,t){let n=T.value;n.providers??={},n.providers[e]={...n.providers[e],enabled:t}}return i(()=>{K(),J(),C.api(w+`/providers`).then(e=>{H.value=e}).catch(()=>{})}),(e,i)=>(n(),g(`section`,ne,[d(`header`,re,[d(`button`,{class:`icon-btn`,"aria-label":`Back to hosts`,onClick:ln},[t(te,{name:`back`,size:18})]),d(`div`,null,[d(`h1`,null,p(s.host.label),1),d(`p`,ie,[i[18]||=o(` Host settings · affects every client connected to this daemon`,-1),O.value?(n(),g(`span`,ae,` · `+p(O.value),1)):h(``,!0)])])]),d(`div`,oe,[d(`div`,se,[d(`button`,{class:`btn btn-outline`,disabled:P.value,onClick:K},`Reload`,8,ce),d(`button`,{class:`btn btn-primary`,disabled:P.value||!T.value||!W.value||A.value?.state===`running`,onClick:cn},p(P.value?`Working…`:`Save changes`),9,le),W.value&&T.value?(n(),g(`span`,ue,`Unsaved changes`)):h(``,!0)]),F.value?(n(),g(`p`,de,p(F.value),1)):h(``,!0),I.value?(n(),g(`p`,fe,p(I.value),1)):h(``,!0),T.value?(n(),g(`fieldset`,{key:2,disabled:P.value||A.value?.state===`running`,class:`hs-fields`},[i[55]||=d(`h2`,{class:`section-label`},`Agents & workspaces`,-1),d(`div`,me,[(n(),g(u,null,_(sn,([e,t,i,a])=>(n(),g(u,{key:e},[(!a||D.value[a])&&(e in T.value||a)?(n(),g(`label`,he,[d(`div`,ge,[d(`div`,_e,p(t),1),d(`div`,ve,p(i),1)]),r(d(`input`,{"onUpdate:modelValue":t=>T.value[e]=t,type:`checkbox`,class:`switch`},null,8,ye),[[c,T.value[e]]])])):h(``,!0)],64))),64)),T.value.mcp?(n(),g(`label`,be,[i[19]||=d(`div`,{class:`grow`},[d(`div`,{class:`row-title`},`Paseo orchestration tools`),d(`div`,{class:`row-sub`},`Inject Paseo tools into agents.`)],-1),r(d(`input`,{"onUpdate:modelValue":i[0]||=e=>T.value.mcp.injectIntoAgents=e,type:`checkbox`,class:`switch`},null,512),[[c,T.value.mcp.injectIntoAgents]])])):h(``,!0),T.value.browserTools?(n(),g(`label`,xe,[i[20]||=d(`div`,{class:`grow`},[d(`div`,{class:`row-title`},`Browser tools`),d(`div`,{class:`row-sub`},` Allow agents to use browser automation supported by this host. `)],-1),r(d(`input`,{"onUpdate:modelValue":i[1]||=e=>T.value.browserTools.enabled=e,type:`checkbox`,class:`switch`},null,512),[[c,T.value.browserTools.enabled]])])):h(``,!0),T.value.usage?(n(),g(`label`,Se,[i[21]||=d(`div`,{class:`grow row-title`},`Collect provider usage`,-1),r(d(`input`,{"onUpdate:modelValue":i[2]||=e=>T.value.usage.enabled=e,type:`checkbox`,class:`switch`},null,512),[[c,T.value.usage.enabled]])])):h(``,!0)]),d(`div`,Ce,[d(`label`,we,[i[22]||=d(`span`,null,`Additional system instructions`,-1),r(d(`textarea`,{"onUpdate:modelValue":i[3]||=e=>T.value.appendSystemPrompt=e,rows:`5`,placeholder:`Instructions appended for agents on this host`},null,512),[[l,T.value.appendSystemPrompt]])]),D.value.resumeOnStartupSetting?(n(),g(`label`,Te,[i[23]||=d(`span`,null,`Restart recovery prompt`,-1),r(d(`textarea`,{"onUpdate:modelValue":i[4]||=e=>T.value.resumePrompt=e,rows:`3`,placeholder:`Prompt used when resuming interrupted work`},null,512),[[l,T.value.resumePrompt]])])):h(``,!0)]),D.value.agentProfiles?(n(),g(u,{key:0},[i[30]||=d(`h2`,{class:`section-label`},`Agent profiles`,-1),i[31]||=d(`p`,{class:`subtle`},`Named launch settings, also available to orchestrating agents.`,-1),(n(!0),g(u,null,_(T.value.agentProfiles??[],(e,t)=>(n(),g(`div`,{key:e.id,class:`card form-card`},[d(`div`,Ee,[d(`label`,De,[i[24]||=d(`span`,null,`Name`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.name=t},null,8,Oe),[[l,e.name]])]),d(`label`,ke,[i[25]||=d(`span`,null,`Provider`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.provider=t,list:`hs-providers`},null,8,Ae),[[l,e.provider]])]),d(`label`,je,[i[26]||=d(`span`,null,`Model (optional)`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.model=t,list:`hs-models-`+e.provider},null,8,y),[[l,e.model]])]),d(`label`,b,[i[27]||=d(`span`,null,`Mode ID (optional)`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.modeId=t},null,8,x),[[l,e.modeId]])]),d(`label`,S,[i[28]||=d(`span`,null,`Thinking level ID (optional)`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.thinkingOptionId=t},null,8,Me),[[l,e.thinkingOptionId]])])]),d(`label`,Ne,[i[29]||=d(`span`,null,`When to use`,-1),r(d(`textarea`,{"onUpdate:modelValue":t=>e.notes=t,rows:`2`},null,8,Pe),[[l,e.notes]])]),d(`div`,Fe,[d(`button`,{class:`btn btn-outline`,disabled:t===0,onClick:e=>Q(T.value.agentProfiles,t,-1)},` Move up`,8,Ie),d(`button`,{class:`btn btn-outline`,onClick:e=>T.value.agentProfiles.splice(t,1)},` Remove profile `,8,Le)])]))),128)),d(`button`,{class:`btn btn-outline`,onClick:i[5]||=e=>Z(`agentProfiles`)},` Add agent profile `)],64)):h(``,!0),R.value?(n(),g(u,{key:1},[i[33]||=d(`h2`,{class:`section-label`},`Paseo skills`,-1),d(`div`,Re,[d(`label`,ze,[d(`span`,null,`Installed skills · `+p(R.value.state),1),r(d(`select`,{"onUpdate:modelValue":i[6]||=e=>R.value.selection.mode=e,onChange:i[7]||=e=>R.value.selection.mode===`custom`&&(R.value.selection.skills??=[...R.value.installed])},[...i[32]||=[d(`option`,{value:`all`},`All Paseo skills`,-1),d(`option`,{value:`custom`},`Choose skills`,-1)]],544),[[m,R.value.selection.mode]])]),R.value.selection.mode===`custom`?(n(!0),g(u,{key:0},_(R.value.available,e=>(n(),g(`label`,{key:e,class:`switch-row`},[d(`span`,null,p(e),1),r(d(`input`,{"onUpdate:modelValue":i[8]||=e=>R.value.selection.skills=e,type:`checkbox`,value:e},null,8,Be),[[c,R.value.selection.skills]])]))),128)):h(``,!0),d(`button`,{class:`btn btn-outline`,onClick:X},`Save skill selection`)])],64)):h(``,!0),i[56]||=d(`h2`,{class:`section-label`},`Providers`,-1),d(`div`,Ve,[(n(!0),g(u,null,_($.value,e=>(n(),g(`div`,{key:e,class:`card-row`},[d(`label`,He,[d(`span`,null,p(H.value.find(t=>t.id===e)?.label??e),1),d(`input`,{type:`checkbox`,class:`switch`,checked:T.value.providers?.[e]?.enabled!==!1,onChange:t=>mn(e,t.target.checked)},null,40,Ue)]),d(`button`,{class:`btn btn-outline`,onClick:t=>dn(e)},`Diagnostic`,8,We)]))),128))]),(n(!0),g(u,null,_($.value,e=>(n(),g(`details`,{key:`edit-`+e,class:`card form-card`},[d(`summary`,{onClick:t=>fn(e)},`Configure `+p(e),9,Ge),T.value.providers?.[e]?(n(),g(u,{key:0},[T.value.providers[e].extends?(n(),g(`div`,Ke,[d(`label`,qe,[i[34]||=d(`span`,null,`Display name`,-1),r(d(`input`,{"onUpdate:modelValue":t=>T.value.providers[e].label=t},null,8,Je),[[l,T.value.providers[e].label]])]),d(`label`,Ye,[i[35]||=d(`span`,null,`Based on`,-1),r(d(`select`,{"onUpdate:modelValue":t=>T.value.providers[e].extends=t},[(n(),g(u,null,_([`claude`,`codex`,`copilot`,`opencode`,`pi`,`omp`,`acp`],e=>d(`option`,{key:e},p(e),1)),64))],8,Xe),[[m,T.value.providers[e].extends]])])])):h(``,!0),T.value.providers[e].extends?(n(),g(`label`,Ze,[i[36]||=d(`span`,null,`Command override (one argument per line)`,-1),d(`textarea`,{value:(T.value.providers[e].command??[]).join(`
|
|
2
2
|
`),onChange:t=>t.target.value.trim()?T.value.providers[e].command=t.target.value.split(`
|
|
3
3
|
`).filter(Boolean):delete T.value.providers[e].command},null,40,Qe)])):h(``,!0),d(`label`,$e,[i[37]||=d(`span`,null,`Paseo tools for this provider`,-1),d(`input`,{type:`checkbox`,checked:T.value.providers[e].paseoTools?.enabled!==!1,onChange:t=>T.value.providers[e].paseoTools={...T.value.providers[e].paseoTools,enabled:t.target.checked}},null,40,et)]),(n(!0),g(u,null,_(T.value.providers[e].additionalModels??[],(t,a)=>(n(),g(`div`,{key:a,class:`hs-grid`},[d(`label`,tt,[i[38]||=d(`span`,null,`Model ID`,-1),r(d(`input`,{"onUpdate:modelValue":e=>t.id=e},null,8,nt),[[l,t.id]])]),d(`label`,rt,[i[39]||=d(`span`,null,`Model label`,-1),r(d(`input`,{"onUpdate:modelValue":e=>t.label=e},null,8,it),[[l,t.label]])]),d(`label`,at,[i[40]||=d(`span`,null,`Default model`,-1),r(d(`input`,{"onUpdate:modelValue":e=>t.isDefault=e,type:`checkbox`},null,8,ot),[[c,t.isDefault]])]),d(`button`,{class:`btn btn-outline`,onClick:t=>T.value.providers[e].additionalModels.splice(a,1)},` Remove model `,8,st)]))),128)),d(`button`,{class:`btn btn-outline`,onClick:t=>(T.value.providers[e].additionalModels??=[]).push({id:``,label:``})},` Add model `,8,ct)],64)):h(``,!0)]))),128)),d(`div`,lt,[d(`label`,ut,[i[41]||=d(`span`,null,`New custom provider ID`,-1),r(d(`input`,{"onUpdate:modelValue":i[9]||=e=>L.value=e,placeholder:`my-codex`},null,512),[[l,L.value]])]),d(`button`,{class:`btn btn-outline`,onClick:pn},`Add custom provider`)]),U.value?(n(),g(`details`,dt,[i[42]||=d(`summary`,null,`Provider diagnostic`,-1),d(`pre`,ft,p(U.value),1)])):h(``,!0),i[57]||=d(`h2`,{class:`section-label`},`Metadata generation`,-1),i[58]||=d(`p`,{class:`subtle`},` Ordered providers for branch names, commit messages and pull requests. An empty list uses automatic selection. `,-1),(n(!0),g(u,null,_(T.value.metadataGeneration?.providers??[],(e,t)=>(n(),g(`div`,{key:t,class:`card form-card`},[d(`div`,pt,[d(`label`,mt,[i[43]||=d(`span`,null,`Provider`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.provider=t,list:`hs-providers`},null,8,ht),[[l,e.provider]])]),d(`label`,gt,[i[44]||=d(`span`,null,`Model (optional)`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.model=t,list:`hs-models-`+e.provider},null,8,_t),[[l,e.model]])]),d(`label`,vt,[i[45]||=d(`span`,null,`Thinking level ID (optional)`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.thinkingOptionId=t},null,8,yt),[[l,e.thinkingOptionId]])])]),d(`div`,bt,[d(`button`,{class:`btn btn-outline`,disabled:t===0,onClick:e=>Q(T.value.metadataGeneration.providers,t,-1)},` Move up`,8,xt),d(`button`,{class:`btn btn-outline`,onClick:e=>T.value.metadataGeneration.providers.splice(t,1)},` Remove `,8,St)])]))),128)),d(`button`,{class:`btn btn-outline`,onClick:i[10]||=e=>(T.value.metadataGeneration??={providers:[]}).providers.push({provider:H.value[0]?.id??`codex`})},` Add metadata provider `),i[59]||=d(`h2`,{class:`section-label`},`Terminal profiles`,-1),i[60]||=d(`p`,{class:`subtle`},` Commands run on this host when a profile is selected for a new terminal. `,-1),(n(!0),g(u,null,_(T.value.terminalProfiles??[],(e,t)=>(n(),g(`div`,{key:e.id,class:`card form-card`},[d(`div`,Ct,[d(`label`,wt,[i[46]||=d(`span`,null,`Name`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.name=t},null,8,Tt),[[l,e.name]])]),d(`label`,Et,[i[47]||=d(`span`,null,`Command`,-1),r(d(`input`,{"onUpdate:modelValue":t=>e.command=t,placeholder:`/bin/bash`},null,8,Dt),[[l,e.command]])])]),d(`label`,Ot,[i[48]||=d(`span`,null,`Arguments (one per line)`,-1),d(`textarea`,{value:(e.args??[]).join(`
|
|
4
4
|
`),rows:`2`,onInput:t=>e.args=t.target.value.split(`
|