@neuralnomads/codenomad-dev 0.18.0-dev-20260721-d74a8a39 → 0.18.0-dev-20260731-1d4f7786
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/dist/background-processes/manager.js +15 -30
- package/dist/background-processes/manager.test.js +123 -0
- package/dist/config/schema.js +2 -1
- package/dist/config/schema.test.js +13 -0
- package/dist/filesystem/__tests__/search-cache.test.js +19 -7
- package/dist/filesystem/__tests__/search.test.js +53 -0
- package/dist/filesystem/search-cache.js +5 -9
- package/dist/filesystem/search.js +22 -9
- package/dist/server/routes/auth-pages/login.html +3 -3
- package/dist/server/routes/auth.js +1 -1
- package/dist/server/routes/auth.test.js +21 -0
- package/dist/workspaces/instance-client.js +6 -5
- package/dist/workspaces/instance-client.test.js +149 -0
- package/dist/workspaces/instance-events.js +2 -2
- package/dist/workspaces/loopback.js +8 -0
- package/dist/workspaces/manager.js +3 -2
- package/dist/workspaces/process-identity.js +28 -10
- package/dist/workspaces/process-identity.test.js +29 -0
- package/dist/workspaces/runtime.js +1 -1
- package/dist/workspaces/runtime.test.js +8 -0
- package/package.json +1 -1
- package/public/assets/{FilesTab-DRWiHv0M.js → FilesTab-pl_3_Ppx.js} +2 -2
- package/public/assets/{GitChangesTab-Bby-dRmu.js → GitChangesTab-COJ_xDva.js} +2 -2
- package/public/assets/{SplitFilePanel-C1aKE1hq.js → SplitFilePanel-B5nrgBs3.js} +1 -1
- package/public/assets/StatusTab-rXgEwwYW.js +1 -0
- package/public/assets/{align-justify-Ce1uZY4E.js → align-justify-CKDczyVy.js} +1 -1
- package/public/assets/{bundle-full-CWkY9-v4.js → bundle-full-CuWt9dTK.js} +1 -1
- package/public/assets/{diff-viewer-ChdWzmb2.js → diff-viewer-drQ_Yje8.js} +1 -1
- package/public/assets/index-Bt9PdFAD.css +1 -0
- package/public/assets/index-BymyGk2C.js +1 -0
- package/public/assets/index-CEIEYgCg.js +1 -0
- package/public/assets/{index-DOprq6Gt.js → index-CozaqOFM.js} +1 -1
- package/public/assets/index-Cqo6ftJT.js +1 -0
- package/public/assets/index-Cs1fQOLl.js +1 -0
- package/public/assets/{index-DM1cpVNo.js → index-Cs2gBaWC.js} +1 -1
- package/public/assets/index-CwhvpTeE.js +1 -0
- package/public/assets/index-D0xuNxlo.js +2 -0
- package/public/assets/index-D1HW4nyh.js +1 -0
- package/public/assets/index-DBw0YE-2.js +1 -0
- package/public/assets/index-OYNGtp3z.js +1 -0
- package/public/assets/{loading-B8b-5OAQ.js → loading-Cz4dKVP8.js} +1 -1
- package/public/assets/main-BEYytlgD.js +68 -0
- package/public/assets/{markdown-DfOGkX-q.js → markdown-DUHZyBXo.js} +3 -3
- package/public/assets/{monaco-viewer-DM35aobI.js → monaco-viewer-CiFg18Ak.js} +11 -11
- package/public/assets/tool-call-C7FlzFBf.js +59 -0
- package/public/assets/unified-picker-CpU6qugd.js +1 -0
- package/public/assets/{wrap-text-D7C2RpdK.js → wrap-text-CS5K8Uhi.js} +1 -1
- package/public/index.html +4 -4
- package/public/loading.html +4 -4
- package/public/sw.js +1 -1
- package/public/assets/StatusTab-DGAe2jhy.js +0 -1
- package/public/assets/index-60Fu5kUB.js +0 -1
- package/public/assets/index-BhJHlWzk.js +0 -1
- package/public/assets/index-Cce2Hk2L.js +0 -1
- package/public/assets/index-CpB67B7z.js +0 -1
- package/public/assets/index-D3fvGcC7.js +0 -1
- package/public/assets/index-D8WMdSS9.js +0 -2
- package/public/assets/index-D_qqDz2d.js +0 -1
- package/public/assets/index-E0A5Kg-d.js +0 -1
- package/public/assets/index-L7fX3W8k.css +0 -1
- package/public/assets/index-j4B2FQw9.js +0 -1
- package/public/assets/main-B9uXiXu7.js +0 -68
- package/public/assets/tool-call-BpefPuGQ.js +0 -59
- package/public/assets/unified-picker-CXhvV1sd.js +0 -1
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { describe, it } from "node:test";
|
|
3
|
+
import { createInstanceClient } from "./instance-client";
|
|
4
|
+
function makeManager(overrides = {}) {
|
|
5
|
+
return {
|
|
6
|
+
getInstancePort: overrides.getInstancePort ?? (() => undefined),
|
|
7
|
+
getInstanceAuthorizationHeader: overrides.getInstanceAuthorizationHeader ?? (() => undefined),
|
|
8
|
+
get: overrides.get ?? (() => undefined),
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Installs a global `fetch` stub that records every outgoing request and
|
|
13
|
+
* answers a minimal healthy JSON body. Returns the capture buffer and a
|
|
14
|
+
* restore function. The stub tolerates both `fetch(url, init)` and
|
|
15
|
+
* `fetch(Request)` invocation styles so it is independent of the SDK's
|
|
16
|
+
* internal call convention.
|
|
17
|
+
*/
|
|
18
|
+
function installRecordingFetch() {
|
|
19
|
+
const requests = [];
|
|
20
|
+
const original = globalThis.fetch;
|
|
21
|
+
globalThis.fetch = (async (input, init) => {
|
|
22
|
+
if (input instanceof Request) {
|
|
23
|
+
requests.push({ url: input.url, headers: new Headers(init?.headers ?? input.headers) });
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
requests.push({ url: String(input), headers: new Headers(init?.headers) });
|
|
27
|
+
}
|
|
28
|
+
return new Response(JSON.stringify({ healthy: true }), {
|
|
29
|
+
status: 200,
|
|
30
|
+
headers: { "content-type": "application/json" },
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
return { requests, restore: () => { globalThis.fetch = original; } };
|
|
34
|
+
}
|
|
35
|
+
describe("createInstanceClient", () => {
|
|
36
|
+
it("returns null when the instance has no open port", () => {
|
|
37
|
+
const manager = makeManager({ getInstancePort: () => undefined });
|
|
38
|
+
assert.equal(createInstanceClient(manager, "ws-1"), null);
|
|
39
|
+
});
|
|
40
|
+
it("targets the loopback host and port on outgoing requests", async () => {
|
|
41
|
+
const { requests, restore } = installRecordingFetch();
|
|
42
|
+
try {
|
|
43
|
+
const manager = makeManager({ getInstancePort: () => 4321, get: () => ({ path: "/repo" }) });
|
|
44
|
+
const client = createInstanceClient(manager, "ws-1");
|
|
45
|
+
assert.ok(client, "expected a client when the instance has a port");
|
|
46
|
+
await client.global.health();
|
|
47
|
+
const parsed = new URL(requests[0].url);
|
|
48
|
+
assert.equal(parsed.hostname, "127.0.0.1");
|
|
49
|
+
assert.equal(parsed.port, "4321");
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
restore();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
it("attaches the authorization header when one is configured", async () => {
|
|
56
|
+
const { requests, restore } = installRecordingFetch();
|
|
57
|
+
try {
|
|
58
|
+
const manager = makeManager({
|
|
59
|
+
getInstancePort: () => 4321,
|
|
60
|
+
getInstanceAuthorizationHeader: () => "Basic abc",
|
|
61
|
+
get: () => ({ path: "/repo" }),
|
|
62
|
+
});
|
|
63
|
+
const client = createInstanceClient(manager, "ws-1");
|
|
64
|
+
await client.global.health();
|
|
65
|
+
assert.equal(requests[0].headers.get("authorization"), "Basic abc");
|
|
66
|
+
}
|
|
67
|
+
finally {
|
|
68
|
+
restore();
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
it("omits the authorization header when none is configured", async () => {
|
|
72
|
+
const { requests, restore } = installRecordingFetch();
|
|
73
|
+
try {
|
|
74
|
+
const manager = makeManager({ getInstancePort: () => 4321, get: () => ({ path: "/repo" }) });
|
|
75
|
+
const client = createInstanceClient(manager, "ws-1");
|
|
76
|
+
await client.global.health();
|
|
77
|
+
assert.equal(requests[0].headers.get("authorization"), null);
|
|
78
|
+
}
|
|
79
|
+
finally {
|
|
80
|
+
restore();
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
it("scopes requests to the workspace directory", async () => {
|
|
84
|
+
const { requests, restore } = installRecordingFetch();
|
|
85
|
+
try {
|
|
86
|
+
const manager = makeManager({ getInstancePort: () => 4321, get: () => ({ path: "/repo" }) });
|
|
87
|
+
const client = createInstanceClient(manager, "ws-1");
|
|
88
|
+
await client.global.health();
|
|
89
|
+
// GET requests carry directory as a query parameter (see SDK rewrite).
|
|
90
|
+
assert.equal(new URL(requests[0].url).searchParams.get("directory"), "/repo");
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
restore();
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
it("does not scope requests when the workspace has no path", async () => {
|
|
97
|
+
const { requests, restore } = installRecordingFetch();
|
|
98
|
+
try {
|
|
99
|
+
const manager = makeManager({ getInstancePort: () => 4321, get: () => undefined });
|
|
100
|
+
const client = createInstanceClient(manager, "ws-1");
|
|
101
|
+
await client.global.health();
|
|
102
|
+
assert.equal(new URL(requests[0].url).searchParams.get("directory"), null);
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
restore();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
it("honours an explicit directory override over the workspace root", async () => {
|
|
109
|
+
const { requests, restore } = installRecordingFetch();
|
|
110
|
+
try {
|
|
111
|
+
const manager = makeManager({ getInstancePort: () => 4321, get: () => ({ path: "/workspace-root" }) });
|
|
112
|
+
const client = createInstanceClient(manager, "ws-1", {
|
|
113
|
+
directory: "/explicit/session-dir",
|
|
114
|
+
});
|
|
115
|
+
await client.global.health();
|
|
116
|
+
assert.equal(new URL(requests[0].url).searchParams.get("directory"), "/explicit/session-dir");
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
restore();
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
it("applies the loopback timeout and aborts a stuck instance", async () => {
|
|
123
|
+
const original = globalThis.fetch;
|
|
124
|
+
// Never resolves on its own; only settles when the passed signal aborts,
|
|
125
|
+
// mirroring how a real fetch honours an AbortSignal. Without the factory
|
|
126
|
+
// timeout this call would hang forever and time the test out.
|
|
127
|
+
globalThis.fetch = (async (_input, init) => {
|
|
128
|
+
return new Promise((_resolve, reject) => {
|
|
129
|
+
const signal = init?.signal;
|
|
130
|
+
if (!signal)
|
|
131
|
+
return;
|
|
132
|
+
if (signal.aborted)
|
|
133
|
+
reject(signal.reason ?? new Error("aborted"));
|
|
134
|
+
else
|
|
135
|
+
signal.addEventListener("abort", () => reject(signal.reason ?? new Error("aborted")));
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
try {
|
|
139
|
+
const manager = makeManager({ getInstancePort: () => 4321, get: () => ({ path: "/repo" }) });
|
|
140
|
+
const client = createInstanceClient(manager, "ws-1", { timeoutMs: 10 });
|
|
141
|
+
// SDK methods resolve with { error } rather than throwing by default.
|
|
142
|
+
const result = await client.global.health();
|
|
143
|
+
assert.ok(result.error, "expected the stuck-instance call to surface an error");
|
|
144
|
+
}
|
|
145
|
+
finally {
|
|
146
|
+
globalThis.fetch = original;
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { fetch } from "undici";
|
|
2
2
|
import { Agent as UndiciAgent } from "undici";
|
|
3
|
-
|
|
3
|
+
import { LOOPBACK_HOST } from "./loopback";
|
|
4
4
|
const STREAM_AGENT = new UndiciAgent({ bodyTimeout: 0, headersTimeout: 0 });
|
|
5
5
|
const RECONNECT_DELAY_MS = 1000;
|
|
6
6
|
export class InstanceEventBridge {
|
|
@@ -70,7 +70,7 @@ export class InstanceEventBridge {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
async consumeStream(workspaceId, port, signal) {
|
|
73
|
-
const url = `http://${
|
|
73
|
+
const url = `http://${LOOPBACK_HOST}:${port}/global/event`;
|
|
74
74
|
const headers = { Accept: "text/event-stream" };
|
|
75
75
|
const authHeader = this.options.workspaceManager.getInstanceAuthorizationHeader(workspaceId);
|
|
76
76
|
if (authHeader) {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loopback host used for direct in-process communication with a running
|
|
3
|
+
* OpenCode workspace instance (the server and the instance share a machine).
|
|
4
|
+
*
|
|
5
|
+
* Shared by the workspace-instance loopback callers so they agree on the host
|
|
6
|
+
* instead of each hardcoding their own `127.0.0.1` literal.
|
|
7
|
+
*/
|
|
8
|
+
export const LOOPBACK_HOST = "127.0.0.1";
|
|
@@ -11,6 +11,7 @@ import { buildOpencodeConfigContent, getCodeNomadPluginUrl, resolveExistingOpenc
|
|
|
11
11
|
import { OPENCODE_SERVER_BASE_URL_ENV, buildOpencodeBasicAuthHeader, OPENCODE_SERVER_PASSWORD_ENV, OPENCODE_SERVER_USERNAME_ENV, resolveOpencodeServerAuth, } from "./opencode-auth";
|
|
12
12
|
import { resolveWorkspaceIdentity } from "./workspace-identity";
|
|
13
13
|
import { parseWslUncPath } from "./spawn";
|
|
14
|
+
import { LOOPBACK_HOST } from "./loopback";
|
|
14
15
|
const STARTUP_STABILITY_DELAY_MS = 1500;
|
|
15
16
|
const DEFAULT_LAUNCH_TIMEOUT_MS = 30_000;
|
|
16
17
|
const ORDINARY_CREATION_OWNER = "";
|
|
@@ -606,7 +607,7 @@ export class WorkspaceManager {
|
|
|
606
607
|
});
|
|
607
608
|
}
|
|
608
609
|
async probeInstance(workspaceId, port, signal) {
|
|
609
|
-
const url = `http
|
|
610
|
+
const url = `http://${LOOPBACK_HOST}:${port}/global/health`;
|
|
610
611
|
try {
|
|
611
612
|
const headers = {};
|
|
612
613
|
const authHeader = this.opencodeAuth.get(workspaceId)?.authorization;
|
|
@@ -656,7 +657,7 @@ export class WorkspaceManager {
|
|
|
656
657
|
const tryConnect = () => {
|
|
657
658
|
if (settled)
|
|
658
659
|
return;
|
|
659
|
-
const socket = connect({ port, host:
|
|
660
|
+
const socket = connect({ port, host: LOOPBACK_HOST, signal }, () => {
|
|
660
661
|
cleanup();
|
|
661
662
|
socket.end();
|
|
662
663
|
resolve();
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
export const LAUNCH_CLEANUP_TOKEN_ENV = "CODENOMAD_LAUNCH_CLEANUP_TOKEN";
|
|
2
|
+
const SHELL_DOLLAR = "$";
|
|
2
3
|
const LINUX_IDENTITY_FUNCTIONS = String.raw `
|
|
3
|
-
boot
|
|
4
|
+
IFS= read -r boot 2>/dev/null < /proc/sys/kernel/random/boot_id || exit 20
|
|
4
5
|
read_stat() {
|
|
5
|
-
line
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
line=
|
|
7
|
+
while IFS= read -r chunk || test -n "$chunk"; do line=$line$chunk; done 2>/dev/null < "/proc/$1/stat"
|
|
8
|
+
test -n "$line" || return 1
|
|
9
|
+
stat_pid=$1; rest=${SHELL_DOLLAR}{line##*) }; set -- $rest
|
|
10
|
+
test "$#" -ge 20 || return 1
|
|
11
|
+
stat_ppid=$2; stat_group=$3; shift 19; stat_start=$1
|
|
12
|
+
}
|
|
13
|
+
emit_linux() {
|
|
14
|
+
test -n "$1" && printf '%s|' "$1"
|
|
15
|
+
printf '%s|%s|%s|%s|%s|%s\n' "$stat_pid" "$stat_ppid" "$stat_group" "$stat_start" "$boot" "$stat_start"
|
|
8
16
|
}
|
|
9
|
-
emit_linux() { printf '%s|%s|%s|%s|%s|%s|%s\n' "$1" "$stat_pid" "$stat_ppid" "$stat_group" "$stat_start" "$boot" "$stat_start"; }
|
|
10
17
|
`;
|
|
11
18
|
const LINUX_SNAPSHOT_SCRIPT = String.raw `${LINUX_IDENTITY_FUNCTIONS}
|
|
12
19
|
for stat in /proc/[0-9]*/stat; do
|
|
13
|
-
|
|
20
|
+
directory=${SHELL_DOLLAR}{stat%/stat}; pid=${SHELL_DOLLAR}{directory##*/}; read_stat "$pid" && emit_linux ""
|
|
21
|
+
done
|
|
22
|
+
exit 0
|
|
23
|
+
`;
|
|
24
|
+
const LINUX_LAUNCH_GROUP_SNAPSHOT_SCRIPT = String.raw `${LINUX_IDENTITY_FUNCTIONS}
|
|
25
|
+
leader_pid=$1; read_stat "$leader_pid" || exit 22; expected_group=$stat_group; emit_linux ""
|
|
26
|
+
for stat in /proc/[0-9]*/stat; do
|
|
27
|
+
directory=${SHELL_DOLLAR}{stat%/stat}; pid=${SHELL_DOLLAR}{directory##*/}; test "$pid" = "$leader_pid" && continue
|
|
28
|
+
read_stat "$pid" && test "$stat_group" = "$expected_group" && emit_linux ""
|
|
14
29
|
done
|
|
15
30
|
exit 0
|
|
16
31
|
`;
|
|
@@ -20,7 +35,7 @@ shift 5; matched=0; cutoff=; signal_sent=0
|
|
|
20
35
|
if read_stat "$leader_pid" && test "$boot" = "$leader_boot" && test "$stat_start" = "$leader_start" && test "$stat_group" = "$expected_group"; then
|
|
21
36
|
matched=1
|
|
22
37
|
for stat in /proc/[0-9]*/stat; do
|
|
23
|
-
|
|
38
|
+
directory=${SHELL_DOLLAR}{stat%/stat}; candidate=${SHELL_DOLLAR}{directory##*/}; read_stat "$candidate" && test "$stat_group" = "$expected_group" && emit_linux CODENOMAD_TARGET
|
|
24
39
|
done
|
|
25
40
|
if kill "-$requested_signal" -- "-$expected_group" 2>/dev/null; then
|
|
26
41
|
signal_sent=1
|
|
@@ -69,7 +84,7 @@ pass=0
|
|
|
69
84
|
while test "$pass" -lt "$passes"; do
|
|
70
85
|
pass=$((pass + 1))
|
|
71
86
|
for environ in /proc/[0-9]*/environ; do
|
|
72
|
-
pid=$
|
|
87
|
+
directory=${SHELL_DOLLAR}{environ%/environ}; pid=${SHELL_DOLLAR}{directory##*/}
|
|
73
88
|
if matches_token "$pid" && read_stat "$pid"; then
|
|
74
89
|
test -n "$requested_signal" && prefix=CODENOMAD_TARGET || prefix=CODENOMAD_PROCESS
|
|
75
90
|
emit_linux "$prefix"
|
|
@@ -372,8 +387,11 @@ export function descendantsOf(processes, rootPid) {
|
|
|
372
387
|
return descendants;
|
|
373
388
|
}
|
|
374
389
|
export function probePosixProcesses(spawnCommand, timeoutMs, platform = process.platform, filter) {
|
|
375
|
-
if (platform === "linux")
|
|
376
|
-
|
|
390
|
+
if (platform === "linux") {
|
|
391
|
+
const pids = filter?.pids?.filter((pid) => Number.isInteger(pid) && pid > 0).map(String) ?? [];
|
|
392
|
+
const launchGroupProbe = pids.length === 1 && filter?.groupId === Number(pids[0]);
|
|
393
|
+
return querySnapshot(() => runLinuxScript(spawnCommand, launchGroupProbe ? LINUX_LAUNCH_GROUP_SNAPSHOT_SCRIPT : LINUX_SNAPSHOT_SCRIPT, launchGroupProbe ? pids : [], timeoutMs, "codenomad-posix-identity"), (output) => parseDelimitedSnapshot(output, true), { allowEmpty: Boolean(filter) });
|
|
394
|
+
}
|
|
377
395
|
// POSIX has no portable pidfd/start ticks; collect one coherent table instead of probing every PID.
|
|
378
396
|
return querySnapshot(() => spawnCommand("ps", ["-axo", "pid=,ppid=,pgid=,lstart=,comm="], {
|
|
379
397
|
encoding: "utf8", timeout: timeoutMs, env: { ...process.env, LC_ALL: "C", LANG: "C" },
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
+
import { spawn as spawnChild, spawnSync } from "node:child_process";
|
|
3
|
+
import { once } from "node:events";
|
|
4
|
+
import { readFileSync } from "node:fs";
|
|
2
5
|
import { describe, it } from "node:test";
|
|
3
6
|
import { probePosixProcesses, probeWindowsProcesses, probeWslProcesses, sameProcess, signalOwnedPosixProcessGroup, signalPosixProcesses, signalWindowsProcesses, startedNoLaterThan, } from "./process-identity";
|
|
4
7
|
const output = (stdout = "", status = 0, stderr = "") => ({ pid: 1, output: [null, stdout, stderr], stdout, stderr, status, signal: null });
|
|
@@ -16,6 +19,32 @@ describe("process identity probes", () => {
|
|
|
16
19
|
assert.deepEqual([call.command, call.args.includes("codenomad-posix-identity"), call.script.trimEnd().endsWith("exit 0")], ["sh", true, true]);
|
|
17
20
|
assert.deepEqual(probe.ok && probe.processes.get(42), identity());
|
|
18
21
|
});
|
|
22
|
+
it("queries the requested Linux launch group without per-process subprocesses", () => {
|
|
23
|
+
const call = {};
|
|
24
|
+
const probe = probePosixProcesses(spawn("42|1|42|123456|boot-a|123456\n", call), 25, "linux", { pids: [42], groupId: 42 });
|
|
25
|
+
assert.deepEqual(call.args.slice(-1), ["42"]);
|
|
26
|
+
assert.match(call.script, /expected_group=\$stat_group/);
|
|
27
|
+
assert.doesNotMatch(call.script, /\b(?:cat|cut|sed|basename|dirname)\b/);
|
|
28
|
+
assert.deepEqual(probe.ok && probe.processes.get(42), identity());
|
|
29
|
+
});
|
|
30
|
+
it("captures real Linux start ticks and launch-group members within the deadline", { skip: process.platform !== "linux" }, async () => {
|
|
31
|
+
const child = spawnChild("sh", ["-c", "sleep 5"], { stdio: "ignore" });
|
|
32
|
+
await once(child, "spawn");
|
|
33
|
+
try {
|
|
34
|
+
const stat = readFileSync(`/proc/${process.pid}/stat`, "utf8");
|
|
35
|
+
const expectedStart = stat.slice(stat.lastIndexOf(") ") + 2).split(" ")[19];
|
|
36
|
+
const probe = probePosixProcesses(spawnSync, 1_000, "linux", { pids: [process.pid], groupId: process.pid });
|
|
37
|
+
assert.equal(probe.ok && probe.processes.get(process.pid)?.startTime, expectedStart);
|
|
38
|
+
assert.equal(probe.ok && probe.processes.has(child.pid), true);
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
if (child.exitCode === null && child.signalCode === null) {
|
|
42
|
+
const exited = once(child, "exit");
|
|
43
|
+
child.kill();
|
|
44
|
+
await exited;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
19
48
|
it("uses one delimiter-safe process-table query on portable POSIX", () => {
|
|
20
49
|
const call = {};
|
|
21
50
|
const command = "/opt/opencode 'pipe|value'\t\"quoted\" café";
|
|
@@ -146,7 +146,7 @@ export class WorkspaceRuntime {
|
|
|
146
146
|
const launchSnapshot = child.pid
|
|
147
147
|
? this.platform === "win32"
|
|
148
148
|
? probeWindowsProcesses(this.spawnCommand, this.stopCommandTimeoutMs)
|
|
149
|
-
: probePosixProcesses(this.spawnCommand, this.stopCommandTimeoutMs, this.platform,
|
|
149
|
+
: probePosixProcesses(this.spawnCommand, this.stopCommandTimeoutMs, this.platform, { pids: [child.pid], groupId: child.pid })
|
|
150
150
|
: { ok: false, error: "spawned child did not expose a PID" };
|
|
151
151
|
const launchLeader = launchSnapshot.ok && child.pid ? launchSnapshot.processes.get(child.pid) : undefined;
|
|
152
152
|
if (!launchLeader) {
|
|
@@ -80,6 +80,14 @@ async function harness(options = {}) {
|
|
|
80
80
|
return { runtime, child, timers, calls, launch, abort };
|
|
81
81
|
}
|
|
82
82
|
describe("workspace runtime lifecycle contracts", () => {
|
|
83
|
+
it("captures the Linux launch group with one bounded shell command", async () => {
|
|
84
|
+
let launchCall;
|
|
85
|
+
await harness({ spawnSync: ((command, args) => {
|
|
86
|
+
launchCall ??= { command, args: [...args] };
|
|
87
|
+
return result(posix([[4242, 1, 4242, "100"]]));
|
|
88
|
+
}) });
|
|
89
|
+
assert.deepEqual(launchCall?.args.slice(-1), ["4242"]);
|
|
90
|
+
});
|
|
83
91
|
it("cancels before spawn and while waiting for a port without losing retryable cleanup", async () => {
|
|
84
92
|
let spawned = false;
|
|
85
93
|
const runtime = new WorkspaceRuntime(new EventBus(), pino({ level: "silent" }), {
|
package/package.json
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-
|
|
2
|
-
import{a8 as
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-CiFg18Ak.js","assets/git-diff-vendor-CYS3ApzA.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a8 as G,m,t as h,i as s,d as u,a as C,u as J,_ as X,f as Y}from"./monaco-viewer-CiFg18Ak.js";import{d as K,b as P,c as $,n as o,S as g,a as w,z as Z,A as p,F as ee}from"./git-diff-vendor-CYS3ApzA.js";import{S as te}from"./SplitFilePanel-B5nrgBs3.js";import{R as V,Q as le,M as ne,T as re,C as ae,e as ie,U as se}from"./main-BEYytlgD.js";import{W as oe}from"./wrap-text-CS5K8Uhi.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";import"./index-D0xuNxlo.js";var ce=h('<div class="px-2 py-2 border-b border-base"><div class=selector-input-group><div class="flex items-center gap-2 px-3 text-muted"></div><input type=text class=selector-input>'),de=h("<div class=file-list-header><span class=file-list-title></span><span class=file-list-count>"),O=h('<div class="p-3 text-xs text-secondary">'),he=h("<div class=file-list-item><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text>.."),ue=h('<div class="p-3 text-xs text-error">'),ve=h('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class="flex items-center gap-2 shrink-0"><div class=file-list-item-stats><span class="text-[10px] text-secondary"></span></div><button type=button class=git-change-row-action>'),x=h("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),fe=h('<div class="file-viewer-panel flex-1"><div>'),ge=h('<div class="h-full outline-none"tabindex=0>'),we=h("<span>"),be=h("<div class=files-tab-stats><span class=files-tab-stat><span class=files-tab-selected-path><span class=file-path-text>"),Se=h("<button type=button style=margin-inline-start:auto>"),me=h("<button type=button>"),Q=h("<button type=button class=files-header-icon-button>"),$e=h("<span class=text-error>");const ye=p(()=>X(()=>import("./monaco-viewer-CiFg18Ak.js").then(e=>e.at),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoFileViewer})));function _e(e){return e?/\.(md|markdown|mdown|mkdn)$/i.test(e):!1}const De=e=>{const[E,L]=K(""),{isDark:q}=G(),[N,M]=K(!1);let b;P(()=>{e.browserPath(),L("")});const H=$(()=>[...e.browserEntries()||[]].sort((i,d)=>{const l=i.type==="directory"?0:1,t=d.type==="directory"?0:1;return l!==t?l-t:String(i.name||"").localeCompare(String(d.name||""))})),W=$(()=>E().trim().toLowerCase()),k=$(()=>{const n=W(),i=H();return n?i.filter(d=>String(d.name||"").toLowerCase().includes(n)):i}),y=()=>e.browserLoading()&&e.browserEntries()===null,U=()=>W()?e.t("instanceShell.filesShell.search.empty"):e.t("instanceShell.filesShell.listEmpty"),_=$(()=>_e(e.browserSelectedPath())),S=$(()=>_()&&N());P(()=>{_()||M(!1)});const T=()=>{const n=e.browserSelectedContent();n!=null&&e.onSave(n)},j=async(n,i)=>{i==null||i.stopPropagation();const d=await ie(n);se({message:d?e.t("instanceShell.filesShell.toast.copyPathSuccess"):e.t("instanceShell.filesShell.toast.copyPathError"),variant:d?"success":"error"})};P(()=>{S()&&requestAnimationFrame(()=>b==null?void 0:b.focus())});const D=()=>[(()=>{var n=ce(),i=n.firstChild,d=i.firstChild,l=d.nextSibling;return s(d,o(re,{class:"w-4 h-4"})),l.$$input=t=>L(t.currentTarget.value),w(t=>{var a=e.t("instanceShell.filesShell.search.placeholder"),r=e.t("instanceShell.filesShell.search.ariaLabel");return a!==t.e&&u(l,"placeholder",t.e=a),r!==t.t&&u(l,"aria-label",t.t=r),t},{e:void 0,t:void 0}),w(()=>l.value=E()),n})(),(()=>{var n=de(),i=n.firstChild,d=i.nextSibling;return s(i,()=>e.t("instanceShell.filesShell.fileListTitle")),s(d,()=>k().length),n})(),o(g,{get when(){return e.parentPath()},children:n=>(()=>{var i=he(),d=i.firstChild,l=d.firstChild;return i.$$click=()=>e.onLoadEntries(n()),w(()=>u(l,"title",n())),i})()}),o(g,{get when(){return y()},get children(){var n=O();return s(n,()=>e.t("instanceInfo.loading")),n}}),o(g,{get when(){return m(()=>!e.browserError()&&!y())()&&k().length>0},get fallback(){return m(()=>!y())()?m(()=>!!e.browserError())()?(()=>{var n=ue();return s(n,()=>e.browserError()),n})():(()=>{var n=O();return s(n,U),n})():void 0},get children(){return o(ee,{get each(){return k()},children:n=>(()=>{var i=ve(),d=i.firstChild,l=d.firstChild,t=l.firstChild,a=l.nextSibling,r=a.firstChild,c=r.firstChild,f=r.nextSibling;return i.$$click=()=>{if(n.type==="directory"){e.onLoadEntries(n.path);return}e.onRequestOpenFile(n.path)},s(t,()=>n.name),s(c,()=>n.type),f.$$click=v=>void j(n.path,v),s(f,o(ae,{class:"w-3 h-3"})),w(v=>{var F=`file-list-item ${e.browserSelectedPath()===n.path?"file-list-item-active":""}`,z=n.path,R=n.path,I=e.t("instanceShell.filesShell.actions.copyPath"),A=e.t("instanceShell.filesShell.actions.copyPath");return F!==v.e&&C(i,v.e=F),z!==v.t&&u(i,"title",v.t=z),R!==v.a&&u(l,"title",v.a=R),I!==v.o&&u(f,"title",v.o=I),A!==v.i&&u(f,"aria-label",v.i=A),v},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),i})()})}})],B=n=>{!(n.ctrlKey||n.metaKey)||n.key.toLowerCase()!=="s"||e.browserSelectedSaving()||!e.browserSelectedDirty()||(n.preventDefault(),T())};return m(()=>{const n=()=>e.browserSelectedPath()||e.browserPath(),i=()=>y()?e.t("instanceInfo.loading"):e.t("instanceShell.filesShell.viewerEmpty"),d=()=>(()=>{var l=fe(),t=l.firstChild;return s(t,o(g,{get when(){return e.browserSelectedLoading()},get fallback(){return o(g,{get when(){return e.browserSelectedError()},get fallback(){return o(g,{get when(){return m(()=>!!(e.browserSelectedPath()&&e.browserSelectedContent()!==null))()?{path:e.browserSelectedPath(),content:e.browserSelectedContent()}:null},get fallback(){return(()=>{var a=x(),r=a.firstChild;return s(r,i),a})()},children:a=>o(g,{get when(){return S()},get fallback(){return o(Z,{get fallback(){return(()=>{var r=x(),c=r.firstChild;return s(c,()=>e.t("instanceInfo.loading")),r})()},get children(){return o(ye,{get scopeKey(){return e.scopeKey()},get path(){return a().path},get content(){return a().content},get wordWrap(){return e.wordWrapMode()},get onSave(){return e.onSave},get onContentChange(){return e.onContentChange}})}})},get children(){var r=ge();r.$$mousedown=()=>b==null?void 0:b.focus(),r.$$keydown=B;var c=b;return typeof c=="function"?J(c,r):b=r,s(r,o(ne,{get part(){return{type:"text",text:a().content}},get isDark(){return q()},escapeRawHtml:!0})),r}})})},children:a=>(()=>{var r=x(),c=r.firstChild;return s(c,a),r})()})},get children(){var a=x(),r=a.firstChild;return s(r,()=>e.t("instanceInfo.loading")),a}})),w(()=>C(t,S()?"file-viewer-content":"file-viewer-content file-viewer-content--monaco")),l})();return o(te,{get header(){return[(()=>{var l=be(),t=l.firstChild,a=t.firstChild,r=a.firstChild;return s(r,n),s(l,o(g,{get when(){return e.browserLoading()},get children(){var c=we();return s(c,()=>e.t("instanceInfo.loading")),c}}),null),s(l,o(g,{get when(){return e.browserError()},children:c=>(()=>{var f=$e();return s(f,c),f})()}),null),w(()=>u(a,"title",n())),l})(),(()=>{var l=Se();return l.$$click=()=>_()&&M(t=>!t),s(l,(()=>{var t=m(()=>!!S());return()=>t()?e.t("instanceShell.filesShell.showSource"):e.t("instanceShell.filesShell.previewMarkdown")})()),w(t=>{var a=`file-viewer-toolbar-button${S()?" active":""}`,r=!_();return a!==t.e&&C(l,t.e=a),r!==t.t&&(l.disabled=t.t=r),t},{e:void 0,t:void 0}),l})(),(()=>{var l=me();return l.$$click=()=>e.onWordWrapModeChange(e.wordWrapMode()==="on"?"off":"on"),s(l,o(oe,{class:"h-4 w-4"})),w(t=>{var a=`file-viewer-toolbar-icon-button${e.wordWrapMode()==="on"?" active":""}`,r=e.wordWrapMode()==="on"?e.t("instanceShell.filesShell.disableWordWrap"):e.t("instanceShell.filesShell.enableWordWrap"),c=e.wordWrapMode()==="on"?e.t("instanceShell.filesShell.disableWordWrap"):e.t("instanceShell.filesShell.enableWordWrap"),f=S();return a!==t.e&&C(l,t.e=a),r!==t.t&&u(l,"title",t.t=r),c!==t.a&&u(l,"aria-label",t.a=c),f!==t.o&&(l.disabled=t.o=f),t},{e:void 0,t:void 0,a:void 0,o:void 0}),l})(),(()=>{var l=Q();return l.$$click=T,s(l,o(g,{get when(){return e.browserSelectedSaving()},get fallback(){return o(le,{class:"h-4 w-4"})},get children(){return o(V,{class:"h-4 w-4 animate-spin"})}})),w(t=>{var a=e.t("instanceShell.rightPanel.actions.save")||"Save (Ctrl+S)",r=e.t("instanceShell.rightPanel.actions.save")||"Save",c=e.browserSelectedSaving()||!e.browserSelectedDirty();return a!==t.e&&u(l,"title",t.e=a),r!==t.t&&u(l,"aria-label",t.t=r),c!==t.a&&(l.disabled=t.a=c),t},{e:void 0,t:void 0,a:void 0}),l})(),(()=>{var l=Q();return l.$$click=()=>e.onRefresh(),s(l,o(V,{get class(){return`h-4 w-4${e.browserLoading()?" animate-spin":""}`}})),w(t=>{var a=e.t("instanceShell.rightPanel.actions.refresh"),r=e.t("instanceShell.rightPanel.actions.refresh"),c=e.browserLoading();return a!==t.e&&u(l,"title",t.e=a),r!==t.t&&u(l,"aria-label",t.t=r),c!==t.a&&(l.disabled=t.a=c),t},{e:void 0,t:void 0,a:void 0}),l})()]},list:{panel:()=>o(D,{}),overlay:()=>o(D,{})},get viewer(){return d()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.files")}})})};Y(["input","click","keydown","mousedown"]);export{De as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-
|
|
2
|
-
import{t as u,i as n,m as D,d as g,a as q,f as ae,h as ee,_ as re}from"./monaco-viewer-DM35aobI.js";import{n as i,m as ce,a as P,c as b,S as k,F as te,z as oe,A as de}from"./git-diff-vendor-CYS3ApzA.js";import{u as he}from"./index-D8WMdSS9.js";import{I as ge,S as ue,G as fe,H as ve,R as me,J as ne,K as ie,N as be}from"./main-B9uXiXu7.js";import{A as $e}from"./align-justify-Ce1uZY4E.js";import{W as Ce}from"./wrap-text-D7C2RpdK.js";import{S as we}from"./SplitFilePanel-C1aKE1hq.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const _e=[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]],Se=e=>i(ge,ce(e,{name:"UnfoldVertical",iconNode:_e}));var ye=u("<div class=file-viewer-toolbar><button type=button class=file-viewer-toolbar-icon-button></button><button type=button class=file-viewer-toolbar-icon-button></button><button type=button>");const xe=e=>{const{t:S}=he(),L=()=>e.viewMode==="split"?"unified":"split",V=()=>e.contextMode==="collapsed"?"expanded":"collapsed",O=()=>e.wordWrapMode==="on"?"off":"on",w=()=>L()==="split"?S("instanceShell.diff.switchToSplit"):S("instanceShell.diff.switchToUnified"),K=()=>V()==="collapsed"?S("instanceShell.diff.hideUnchanged"):S("instanceShell.diff.showFull"),B=()=>O()==="on"?S("instanceShell.diff.enableWordWrap"):S("instanceShell.diff.disableWordWrap");return(()=>{var U=ye(),T=U.firstChild,E=T.nextSibling,I=E.nextSibling;return T.$$click=()=>e.onViewModeChange(L()),n(T,(()=>{var c=D(()=>L()==="split");return()=>c()?i(ue,{class:"h-4 w-4","aria-hidden":"true"}):i($e,{class:"h-4 w-4","aria-hidden":"true"})})()),E.$$click=()=>e.onContextModeChange(V()),n(E,(()=>{var c=D(()=>V()==="collapsed");return()=>c()?i(fe,{class:"h-4 w-4","aria-hidden":"true"}):i(Se,{class:"h-4 w-4","aria-hidden":"true"})})()),I.$$click=()=>e.onWordWrapModeChange(O()),n(I,i(Ce,{class:"h-4 w-4","aria-hidden":"true"})),P(c=>{var N=w(),o=w(),d=K(),y=K(),x=`file-viewer-toolbar-icon-button${e.wordWrapMode==="on"?" active":""}`,W=B(),G=B();return N!==c.e&&g(T,"aria-label",c.e=N),o!==c.t&&g(T,"title",c.t=o),d!==c.a&&g(E,"aria-label",c.a=d),y!==c.o&&g(E,"title",c.o=y),x!==c.i&&q(I,c.i=x),W!==c.n&&g(I,"aria-label",c.n=W),G!==c.s&&g(I,"title",c.s=G),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),U})()};ae(["click"]);var H=u("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),Me=u('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),ke=u('<div class="p-3 text-xs text-secondary">'),Ie=u('<span class="git-change-row-action-bar git-change-row-action-bar-vertical">'),We=u('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=git-change-list-item-right><div class=file-list-item-stats><span class=file-list-item-additions>+</span><span class=file-list-item-deletions>-</span></div></div></div><div class=git-change-list-item-actions-zone><div class=git-change-list-item-actions><button type=button class=git-change-row-action><span aria-hidden=true><span class="git-change-row-action-bar git-change-row-action-bar-horizontal">'),Le=u("<div class=git-change-section-items>"),Ve=u("<div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title></span></span><span class=git-change-section-count>"),Te=u('<div class=git-change-section-items><div class=git-change-commit-box><div class=git-change-commit-input-wrap><textarea class=git-change-commit-input rows=1></textarea><button type=button class="git-change-commit-button git-change-commit-button-overlay">'),Ee=u("<div class=git-change-sections><div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title-row><span class=git-change-section-title></span></span></span><span class=git-change-section-count>"),Ae=u('<span class="status-indicator session-status-list worktree-indicator git-change-section-badge"><span class=worktree-indicator-label>'),Pe=u("<span class=files-tab-selected-path><span class=file-path-text>"),Re=u('<div class=files-tab-stats style="flex:0 0 auto"><span class="files-tab-stat files-tab-stat-additions"><span class=files-tab-stat-value>+</span></span><span class="files-tab-stat files-tab-stat-deletions"><span class=files-tab-stat-value>-'),ze=u("<button type=button class=files-header-icon-button style=margin-left:auto>"),De=u("<span class=text-error>");const Be=de(()=>re(()=>import("./monaco-viewer-DM35aobI.js").then(e=>e.au),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoDiffViewer}))),je=e=>{const S=b(()=>e.activeSessionId()),L=b(()=>!!(S()&&S()!=="info")),V=b(()=>L()?e.entries():null),O=b(()=>{const o=V();return Array.isArray(o)?[...o].sort((d,y)=>String(d.path||"").localeCompare(String(y.path||""))):[]}),w=b(()=>ve(O())),K=b(()=>w().reduce((o,d)=>(o.additions+=typeof d.additions=="number"?d.additions:0,o.deletions+=typeof d.deletions=="number"?d.deletions:0,o),{additions:0,deletions:0})),B=b(()=>w().filter(o=>o.section==="staged")),U=b(()=>w().filter(o=>o.section==="unstaged")),T=b(()=>B().length>0&&e.commitMessage().trim().length>0&&!e.commitSubmitting()),E=b(()=>{const o=w(),d=e.selectedItemId(),y=e.mostChangedItemId(),x=o.find(W=>W.id===d)||(y?o.find(W=>W.id===y):void 0);return(x==null?void 0:x.entry)??null}),I=b(()=>L()?V()===null?e.t("instanceShell.gitChanges.loading"):w().length===0?e.t("instanceShell.gitChanges.empty"):e.t("instanceShell.filesShell.viewerEmpty"):e.t("instanceShell.gitChanges.noSessionSelected")),c=b(()=>e.selectedError()===e.t("instanceShell.gitChanges.binaryViewer"));return D(()=>{const o=K(),d=E(),y=w(),x=B(),W=U(),G=()=>(()=>{var t=Me(),r=t.firstChild;return n(r,i(k,{get when(){return e.selectedLoading()},get fallback(){return i(k,{get when(){return e.selectedError()},get fallback(){return i(k,{get when(){return D(()=>!!(d&&e.selectedBefore()!==null&&e.selectedAfter()!==null))()?{path:d.path,before:e.selectedBefore(),after:e.selectedAfter()}:null},get fallback(){return(()=>{var a=H(),s=a.firstChild;return n(s,I),a})()},children:a=>i(oe,{get fallback(){return(()=>{var s=H(),l=s.firstChild;return n(l,()=>e.t("instanceInfo.loading")),s})()},get children(){return i(Be,{get scopeKey(){return e.scopeKey()},get path(){return String(a().path||"")},get before(){return String(a().before||"")},get after(){return String(a().after||"")},get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrap(){return e.diffWordWrapMode()},get insertContextLabel(){return e.t("instanceShell.gitChanges.actions.insertContext")},get onRequestInsertContext(){return c()?void 0:s=>{const l=e.selectedItemId();if(!l)return;const f=w().find(v=>v.id===l);f&&e.onInsertContext(f,s)}}})}})})},children:a=>(()=>{var s=H(),l=s.firstChild;return n(l,a),s})()})},get children(){var a=H(),s=a.firstChild;return n(s,()=>e.t("instanceInfo.loading")),a}})),t})(),le=()=>(()=>{var t=ke();return n(t,I),t})(),J=t=>{const r=b(()=>e.selectedBulkItemIds().has(t.id)),a=t.section==="staged"?e.t("instanceShell.gitChanges.actions.unstage"):e.t("instanceShell.gitChanges.actions.stage"),s=()=>{t.section==="staged"?e.onUnstageFile(t):e.onStageFile(t)};return(()=>{var l=We(),f=l.firstChild,v=f.firstChild,R=v.firstChild,$=v.nextSibling,_=$.firstChild,C=_.firstChild;C.firstChild;var M=C.nextSibling;M.firstChild;var F=f.nextSibling,m=F.firstChild,A=m.firstChild,z=A.firstChild;return z.firstChild,l.$$click=h=>e.onRowClick(t,h),l.$$mousedown=h=>{(h.shiftKey||h.ctrlKey||h.metaKey)&&h.preventDefault()},n(R,()=>t.path),n(C,()=>t.additions,null),n(M,()=>t.deletions,null),A.$$click=h=>{h.stopPropagation(),s()},g(A,"title",a),g(A,"aria-label",a),n(z,i(k,{get when(){return t.section!=="staged"},get children(){return Ie()}}),null),P(h=>{var Q=`file-list-item git-change-list-item ${e.selectedItemId()===t.id?"file-list-item-active":""} ${r()?"git-change-list-item-bulk-selected":""}`,X=t.path,Y=t.path,Z=t.path,p=`git-change-row-action-glyph ${t.section==="staged"?"git-change-row-action-glyph-minus":"git-change-row-action-glyph-plus"}`;return Q!==h.e&&q(l,h.e=Q),X!==h.t&&g(l,"title",h.t=X),Y!==h.a&&g(f,"title",h.a=Y),Z!==h.o&&g(v,"title",h.o=Z),p!==h.i&&q(z,h.i=p),h},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),l})()},se=(t,r,a,s)=>(()=>{var l=Ve(),f=l.firstChild,v=f.firstChild,R=v.firstChild,$=R.nextSibling,_=v.nextSibling;return ee(f,"click",s,!0),n(R,a?i(ne,{class:"h-3.5 w-3.5"}):i(ie,{class:"h-3.5 w-3.5"})),n($,t),n(_,()=>r.length),n(l,i(k,{when:a,get children(){var C=Le();return n(C,i(te,{each:r,children:M=>J(M)})),C}}),null),l})(),j=()=>i(k,{get when(){return y.length>0},get fallback(){return le()},get children(){var t=Ee(),r=t.firstChild,a=r.firstChild,s=a.firstChild,l=s.firstChild,f=l.nextSibling,v=f.firstChild,R=s.nextSibling;return ee(a,"click",e.onToggleStagedOpen,!0),n(l,(()=>{var $=D(()=>!!e.stagedOpen());return()=>$()?i(ne,{class:"h-3.5 w-3.5"}):i(ie,{class:"h-3.5 w-3.5"})})()),n(v,()=>e.t("instanceShell.gitChanges.sections.staged")),n(f,i(k,{get when(){return e.branchLabel()},children:$=>(()=>{var _=Ae(),C=_.firstChild;return n(_,i(be,{class:"w-3.5 h-3.5","aria-hidden":"true"}),C),n(C,$),P(()=>g(_,"title",`Branch: ${$()}`)),_})()}),null),n(R,()=>x.length),n(r,i(k,{get when(){return e.stagedOpen()},get children(){var $=Te(),_=$.firstChild,C=_.firstChild,M=C.firstChild,F=M.nextSibling;return M.$$input=m=>e.onCommitMessageInput(m.currentTarget.value),F.$$click=()=>e.onSubmitCommit(),n(F,(()=>{var m=D(()=>!!e.commitSubmitting());return()=>m()?e.t("instanceShell.gitChanges.commit.submitting"):e.t("instanceShell.gitChanges.commit.submit")})()),n($,i(te,{each:x,children:m=>J(m)}),null),P(m=>{var A=e.t("instanceShell.gitChanges.commit.placeholder"),z=!T();return A!==m.e&&g(M,"placeholder",m.e=A),z!==m.t&&(F.disabled=m.t=z),m},{e:void 0,t:void 0}),P(()=>M.value=e.commitMessage()),$}}),null),n(t,()=>se(e.t("instanceShell.gitChanges.sections.unstaged"),W,e.unstagedOpen(),e.onToggleUnstagedOpen),null),t}});return i(we,{get header(){return[(()=>{var t=Pe(),r=t.firstChild;return n(r,()=>(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges")),P(()=>g(t,"title",(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges"))),t})(),(()=>{var t=Re(),r=t.firstChild,a=r.firstChild;a.firstChild;var s=r.nextSibling,l=s.firstChild;return l.firstChild,n(a,()=>o.additions,null),n(l,()=>o.deletions,null),n(t,i(k,{get when(){return e.statusError()},children:f=>(()=>{var v=De();return n(v,f),v})()}),null),t})(),(()=>{var t=ze();return t.$$click=()=>e.onRefresh(),n(t,i(me,{get class(){return`h-4 w-4${e.statusLoading()?" animate-spin":""}`}})),P(r=>{var a=e.t("instanceShell.rightPanel.actions.refresh"),s=e.t("instanceShell.rightPanel.actions.refresh"),l=!L()||e.statusLoading()||V()===null;return a!==r.e&&g(t,"title",r.e=a),s!==r.t&&g(t,"aria-label",r.t=s),l!==r.a&&(t.disabled=r.a=l),r},{e:void 0,t:void 0,a:void 0}),t})(),i(xe,{get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrapMode(){return e.diffWordWrapMode()},get onViewModeChange(){return e.onViewModeChange},get onContextModeChange(){return e.onContextModeChange},get onWordWrapModeChange(){return e.onWordWrapModeChange}})]},list:{panel:j,overlay:j},get viewer(){return G()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.gitChanges")}})})};ae(["mousedown","click","input"]);export{je as default};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/monaco-viewer-CiFg18Ak.js","assets/git-diff-vendor-CYS3ApzA.js","assets/fast-diff-vendor-DgdwVvTQ.js","assets/highlight-vendor-8FKMu9os.js","assets/git-diff-vendor-HAZkIolJ.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as u,i as n,m as D,d as g,a as q,f as ae,h as ee,_ as re}from"./monaco-viewer-CiFg18Ak.js";import{n as i,m as ce,a as P,c as b,S as k,F as te,z as oe,A as de}from"./git-diff-vendor-CYS3ApzA.js";import{u as he}from"./index-D0xuNxlo.js";import{I as ge,S as ue,H as fe,J as ve,R as me,K as ne,N as ie,O as be}from"./main-BEYytlgD.js";import{A as $e}from"./align-justify-CKDczyVy.js";import{W as Ce}from"./wrap-text-CS5K8Uhi.js";import{S as we}from"./SplitFilePanel-B5nrgBs3.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const _e=[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]],Se=e=>i(ge,ce(e,{name:"UnfoldVertical",iconNode:_e}));var ye=u("<div class=file-viewer-toolbar><button type=button class=file-viewer-toolbar-icon-button></button><button type=button class=file-viewer-toolbar-icon-button></button><button type=button>");const xe=e=>{const{t:S}=he(),L=()=>e.viewMode==="split"?"unified":"split",V=()=>e.contextMode==="collapsed"?"expanded":"collapsed",F=()=>e.wordWrapMode==="on"?"off":"on",w=()=>L()==="split"?S("instanceShell.diff.switchToSplit"):S("instanceShell.diff.switchToUnified"),K=()=>V()==="collapsed"?S("instanceShell.diff.hideUnchanged"):S("instanceShell.diff.showFull"),O=()=>F()==="on"?S("instanceShell.diff.enableWordWrap"):S("instanceShell.diff.disableWordWrap");return(()=>{var U=ye(),T=U.firstChild,E=T.nextSibling,I=E.nextSibling;return T.$$click=()=>e.onViewModeChange(L()),n(T,(()=>{var c=D(()=>L()==="split");return()=>c()?i(ue,{class:"h-4 w-4","aria-hidden":"true"}):i($e,{class:"h-4 w-4","aria-hidden":"true"})})()),E.$$click=()=>e.onContextModeChange(V()),n(E,(()=>{var c=D(()=>V()==="collapsed");return()=>c()?i(fe,{class:"h-4 w-4","aria-hidden":"true"}):i(Se,{class:"h-4 w-4","aria-hidden":"true"})})()),I.$$click=()=>e.onWordWrapModeChange(F()),n(I,i(Ce,{class:"h-4 w-4","aria-hidden":"true"})),P(c=>{var N=w(),o=w(),d=K(),y=K(),x=`file-viewer-toolbar-icon-button${e.wordWrapMode==="on"?" active":""}`,W=O(),G=O();return N!==c.e&&g(T,"aria-label",c.e=N),o!==c.t&&g(T,"title",c.t=o),d!==c.a&&g(E,"aria-label",c.a=d),y!==c.o&&g(E,"title",c.o=y),x!==c.i&&q(I,c.i=x),W!==c.n&&g(I,"aria-label",c.n=W),G!==c.s&&g(I,"title",c.s=G),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0}),U})()};ae(["click"]);var H=u("<div class=file-viewer-empty><span class=file-viewer-empty-text>"),Me=u('<div class="file-viewer-panel flex-1"><div class="file-viewer-content file-viewer-content--monaco">'),ke=u('<div class="p-3 text-xs text-secondary">'),Ie=u('<span class="git-change-row-action-bar git-change-row-action-bar-vertical">'),We=u('<div><div class=file-list-item-content><div class=file-list-item-path><span class=file-path-text></span></div><div class=git-change-list-item-right><div class=file-list-item-stats><span class=file-list-item-additions>+</span><span class=file-list-item-deletions>-</span></div></div></div><div class=git-change-list-item-actions-zone><div class=git-change-list-item-actions><button type=button class=git-change-row-action><span aria-hidden=true><span class="git-change-row-action-bar git-change-row-action-bar-horizontal">'),Le=u("<div class=git-change-section-items>"),Ve=u("<div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title></span></span><span class=git-change-section-count>"),Te=u('<div class=git-change-section-items><div class=git-change-commit-box><div class=git-change-commit-input-wrap><textarea class=git-change-commit-input rows=1></textarea><button type=button class="git-change-commit-button git-change-commit-button-overlay">'),Ee=u("<div class=git-change-sections><div class=git-change-section><button type=button class=git-change-section-header><span class=git-change-section-header-main><span class=git-change-section-chevron></span><span class=git-change-section-title-row><span class=git-change-section-title></span></span></span><span class=git-change-section-count>"),Ae=u('<span class="status-indicator session-status-list worktree-indicator git-change-section-badge"><span class=worktree-indicator-label>'),Pe=u("<span class=files-tab-selected-path><span class=file-path-text>"),Re=u('<div class=files-tab-stats style="flex:0 0 auto"><span class="files-tab-stat files-tab-stat-additions"><span class=files-tab-stat-value>+</span></span><span class="files-tab-stat files-tab-stat-deletions"><span class=files-tab-stat-value>-'),ze=u("<button type=button class=files-header-icon-button style=margin-left:auto>"),De=u("<span class=text-error>");const Oe=de(()=>re(()=>import("./monaco-viewer-CiFg18Ak.js").then(e=>e.au),__vite__mapDeps([0,1,2,3,4])).then(e=>({default:e.MonacoDiffViewer}))),je=e=>{const S=b(()=>e.activeSessionId()),L=b(()=>!!(S()&&S()!=="info")),V=b(()=>L()?e.entries():null),F=b(()=>{const o=V();return Array.isArray(o)?[...o].sort((d,y)=>String(d.path||"").localeCompare(String(y.path||""))):[]}),w=b(()=>ve(F())),K=b(()=>w().reduce((o,d)=>(o.additions+=typeof d.additions=="number"?d.additions:0,o.deletions+=typeof d.deletions=="number"?d.deletions:0,o),{additions:0,deletions:0})),O=b(()=>w().filter(o=>o.section==="staged")),U=b(()=>w().filter(o=>o.section==="unstaged")),T=b(()=>O().length>0&&e.commitMessage().trim().length>0&&!e.commitSubmitting()),E=b(()=>{const o=w(),d=e.selectedItemId(),y=e.mostChangedItemId(),x=o.find(W=>W.id===d)||(y?o.find(W=>W.id===y):void 0);return(x==null?void 0:x.entry)??null}),I=b(()=>L()?V()===null?e.t("instanceShell.gitChanges.loading"):w().length===0?e.t("instanceShell.gitChanges.empty"):e.t("instanceShell.filesShell.viewerEmpty"):e.t("instanceShell.gitChanges.noSessionSelected")),c=b(()=>e.selectedError()===e.t("instanceShell.gitChanges.binaryViewer"));return D(()=>{const o=K(),d=E(),y=w(),x=O(),W=U(),G=()=>(()=>{var t=Me(),r=t.firstChild;return n(r,i(k,{get when(){return e.selectedLoading()},get fallback(){return i(k,{get when(){return e.selectedError()},get fallback(){return i(k,{get when(){return D(()=>!!(d&&e.selectedBefore()!==null&&e.selectedAfter()!==null))()?{path:d.path,before:e.selectedBefore(),after:e.selectedAfter()}:null},get fallback(){return(()=>{var a=H(),s=a.firstChild;return n(s,I),a})()},children:a=>i(oe,{get fallback(){return(()=>{var s=H(),l=s.firstChild;return n(l,()=>e.t("instanceInfo.loading")),s})()},get children(){return i(Oe,{get scopeKey(){return e.scopeKey()},get path(){return String(a().path||"")},get before(){return String(a().before||"")},get after(){return String(a().after||"")},get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrap(){return e.diffWordWrapMode()},get insertContextLabel(){return e.t("instanceShell.gitChanges.actions.insertContext")},get onRequestInsertContext(){return c()?void 0:s=>{const l=e.selectedItemId();if(!l)return;const f=w().find(v=>v.id===l);f&&e.onInsertContext(f,s)}}})}})})},children:a=>(()=>{var s=H(),l=s.firstChild;return n(l,a),s})()})},get children(){var a=H(),s=a.firstChild;return n(s,()=>e.t("instanceInfo.loading")),a}})),t})(),le=()=>(()=>{var t=ke();return n(t,I),t})(),J=t=>{const r=b(()=>e.selectedBulkItemIds().has(t.id)),a=t.section==="staged"?e.t("instanceShell.gitChanges.actions.unstage"):e.t("instanceShell.gitChanges.actions.stage"),s=()=>{t.section==="staged"?e.onUnstageFile(t):e.onStageFile(t)};return(()=>{var l=We(),f=l.firstChild,v=f.firstChild,R=v.firstChild,$=v.nextSibling,_=$.firstChild,C=_.firstChild;C.firstChild;var M=C.nextSibling;M.firstChild;var B=f.nextSibling,m=B.firstChild,A=m.firstChild,z=A.firstChild;return z.firstChild,l.$$click=h=>e.onRowClick(t,h),l.$$mousedown=h=>{(h.shiftKey||h.ctrlKey||h.metaKey)&&h.preventDefault()},n(R,()=>t.path),n(C,()=>t.additions,null),n(M,()=>t.deletions,null),A.$$click=h=>{h.stopPropagation(),s()},g(A,"title",a),g(A,"aria-label",a),n(z,i(k,{get when(){return t.section!=="staged"},get children(){return Ie()}}),null),P(h=>{var Q=`file-list-item git-change-list-item ${e.selectedItemId()===t.id?"file-list-item-active":""} ${r()?"git-change-list-item-bulk-selected":""}`,X=t.path,Y=t.path,Z=t.path,p=`git-change-row-action-glyph ${t.section==="staged"?"git-change-row-action-glyph-minus":"git-change-row-action-glyph-plus"}`;return Q!==h.e&&q(l,h.e=Q),X!==h.t&&g(l,"title",h.t=X),Y!==h.a&&g(f,"title",h.a=Y),Z!==h.o&&g(v,"title",h.o=Z),p!==h.i&&q(z,h.i=p),h},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),l})()},se=(t,r,a,s)=>(()=>{var l=Ve(),f=l.firstChild,v=f.firstChild,R=v.firstChild,$=R.nextSibling,_=v.nextSibling;return ee(f,"click",s,!0),n(R,a?i(ne,{class:"h-3.5 w-3.5"}):i(ie,{class:"h-3.5 w-3.5"})),n($,t),n(_,()=>r.length),n(l,i(k,{when:a,get children(){var C=Le();return n(C,i(te,{each:r,children:M=>J(M)})),C}}),null),l})(),j=()=>i(k,{get when(){return y.length>0},get fallback(){return le()},get children(){var t=Ee(),r=t.firstChild,a=r.firstChild,s=a.firstChild,l=s.firstChild,f=l.nextSibling,v=f.firstChild,R=s.nextSibling;return ee(a,"click",e.onToggleStagedOpen,!0),n(l,(()=>{var $=D(()=>!!e.stagedOpen());return()=>$()?i(ne,{class:"h-3.5 w-3.5"}):i(ie,{class:"h-3.5 w-3.5"})})()),n(v,()=>e.t("instanceShell.gitChanges.sections.staged")),n(f,i(k,{get when(){return e.branchLabel()},children:$=>(()=>{var _=Ae(),C=_.firstChild;return n(_,i(be,{class:"w-3.5 h-3.5","aria-hidden":"true"}),C),n(C,$),P(()=>g(_,"title",`Branch: ${$()}`)),_})()}),null),n(R,()=>x.length),n(r,i(k,{get when(){return e.stagedOpen()},get children(){var $=Te(),_=$.firstChild,C=_.firstChild,M=C.firstChild,B=M.nextSibling;return M.$$input=m=>e.onCommitMessageInput(m.currentTarget.value),B.$$click=()=>e.onSubmitCommit(),n(B,(()=>{var m=D(()=>!!e.commitSubmitting());return()=>m()?e.t("instanceShell.gitChanges.commit.submitting"):e.t("instanceShell.gitChanges.commit.submit")})()),n($,i(te,{each:x,children:m=>J(m)}),null),P(m=>{var A=e.t("instanceShell.gitChanges.commit.placeholder"),z=!T();return A!==m.e&&g(M,"placeholder",m.e=A),z!==m.t&&(B.disabled=m.t=z),m},{e:void 0,t:void 0}),P(()=>M.value=e.commitMessage()),$}}),null),n(t,()=>se(e.t("instanceShell.gitChanges.sections.unstaged"),W,e.unstagedOpen(),e.onToggleUnstagedOpen),null),t}});return i(we,{get header(){return[(()=>{var t=Pe(),r=t.firstChild;return n(r,()=>(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges")),P(()=>g(t,"title",(d==null?void 0:d.path)||e.t("instanceShell.rightPanel.tabs.gitChanges"))),t})(),(()=>{var t=Re(),r=t.firstChild,a=r.firstChild;a.firstChild;var s=r.nextSibling,l=s.firstChild;return l.firstChild,n(a,()=>o.additions,null),n(l,()=>o.deletions,null),n(t,i(k,{get when(){return e.statusError()},children:f=>(()=>{var v=De();return n(v,f),v})()}),null),t})(),(()=>{var t=ze();return t.$$click=()=>e.onRefresh(),n(t,i(me,{get class(){return`h-4 w-4${e.statusLoading()?" animate-spin":""}`}})),P(r=>{var a=e.t("instanceShell.rightPanel.actions.refresh"),s=e.t("instanceShell.rightPanel.actions.refresh"),l=!L()||e.statusLoading()||V()===null;return a!==r.e&&g(t,"title",r.e=a),s!==r.t&&g(t,"aria-label",r.t=s),l!==r.a&&(t.disabled=r.a=l),r},{e:void 0,t:void 0,a:void 0}),t})(),i(xe,{get viewMode(){return e.diffViewMode()},get contextMode(){return e.diffContextMode()},get wordWrapMode(){return e.diffWordWrapMode()},get onViewModeChange(){return e.onViewModeChange},get onContextModeChange(){return e.onContextModeChange},get onWordWrapModeChange(){return e.onWordWrapModeChange}})]},list:{panel:j,overlay:j},get viewer(){return G()},get listOpen(){return e.listOpen()},get onToggleList(){return e.onToggleList},get splitWidth(){return e.splitWidth()},get onResizeMouseDown(){return e.onResizeMouseDown},get onResizeTouchStart(){return e.onResizeTouchStart},get isPhoneLayout(){return e.isPhoneLayout()},get overlayAriaLabel(){return e.t("instanceShell.rightPanel.tabs.gitChanges")}})})};ae(["mousedown","click","input"]);export{je as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as d,i as l,d as m,h as s,m as b,g as _,f as w}from"./monaco-viewer-
|
|
1
|
+
import{t as d,i as l,d as m,h as s,m as b,g as _,f as w}from"./monaco-viewer-CiFg18Ak.js";import{a as g,n as r,S as n}from"./git-diff-vendor-CYS3ApzA.js";import{u as S}from"./index-D0xuNxlo.js";var y=d("<div class=file-list-overlay role=dialog><div class=file-list-scroll>");const L=e=>(()=>{var t=y(),a=t.firstChild;return l(a,()=>e.children),g(()=>m(t,"aria-label",e.ariaLabel)),t})();var C=d('<div class=files-split><div class=file-list-panel><div class=file-list-scroll></div></div><div class=file-split-handle role=separator aria-orientation=vertical aria-label="Resize file list">'),x=d("<div class=files-tab-container><div class=files-tab-header><div class=files-tab-header-row><button type=button class=files-toggle-button></button></div></div><div class=files-tab-body>");const z=e=>{const{t}=S();return(()=>{var a=x(),c=a.firstChild,o=c.firstChild,u=o.firstChild,h=c.nextSibling;return s(u,"click",e.onToggleList,!0),l(u,(()=>{var i=b(()=>!!e.listOpen);return()=>i()?t("instanceShell.filesShell.hideFiles"):t("instanceShell.filesShell.showFiles")})()),l(o,()=>e.header,null),l(h,r(n,{get when(){return b(()=>!e.isPhoneLayout)()&&e.listOpen},get fallback(){return e.viewer},get children(){var i=C(),v=i.firstChild,$=v.firstChild,f=v.nextSibling;return l($,()=>e.list.panel()),s(f,"touchstart",e.onResizeTouchStart,!0),s(f,"mousedown",e.onResizeMouseDown,!0),l(i,()=>e.viewer,null),g(O=>_(i,"--files-pane-width",`${e.splitWidth}px`)),i}}),null),l(h,r(n,{get when(){return e.isPhoneLayout},get children(){return r(n,{get when(){return e.listOpen},get children(){return r(L,{get ariaLabel(){return e.overlayAriaLabel},get children(){return e.list.overlay()}})}})}}),null),a})()};w(["click","mousedown","touchstart"]);export{z as S};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{m as le,P as Ye,N as Ze,t as k,i as g,a as _e,g as Ie,d as L,j as Je,u as Qe,f as et}from"./monaco-viewer-CiFg18Ak.js";import{n as r,m as O,q as ce,s as H,d as R,b as q,o as B,c as I,k as de,S as K,l as ue,t as tt,w as Te,a as ge,F as ye}from"./git-diff-vendor-CYS3ApzA.js";import{I as pe,W as De,X as W,Y as Oe,Z as Me,_ as xe,$ as nt,a0 as me,a1 as ae,a2 as he,a3 as Ee,a4 as te,a5 as ne,a6 as ot,a7 as Ce,a8 as st,a9 as rt,aa as j,ab as Se,ac as it,ad as at,ae as lt,af as ct,ag as z,ah as dt,ai as ut,aj as gt,ak as pt,al as ht,am as J,an as ft,ao as ve,ap as mt,aq as vt,ar as bt,as as yt,at as xt,au as Ct,av as St,aw as wt,ax as Pt,ay as kt,K as $t,az as It}from"./main-BEYytlgD.js";import{u as Ue}from"./index-D0xuNxlo.js";import"./fast-diff-vendor-DgdwVvTQ.js";import"./highlight-vendor-8FKMu9os.js";const Tt=[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]],_t=e=>r(pe,O(e,{name:"BellRing",iconNode:Tt})),Dt=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],Ot=e=>r(pe,O(e,{name:"GripVertical",iconNode:Dt})),Mt=[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]],Et=e=>r(pe,O(e,{name:"TerminalSquare",iconNode:Mt})),Ut=[["polygon",{points:"7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2",key:"h1p8hx"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],At=e=>r(pe,O(e,{name:"XOctagon",iconNode:Ut}));var Rt={};Se(Rt,{Arrow:()=>De,Content:()=>Re,Portal:()=>Fe,Root:()=>Ke,Tooltip:()=>ee,Trigger:()=>Le,useTooltipContext:()=>fe});var Ae=de();function fe(){const e=ue(Ae);if(e===void 0)throw new Error("[kobalte]: `useTooltipContext` must be used within a `Tooltip` component");return e}function Re(e){const n=fe(),u=W({id:n.generateId("content")},e),[a,t]=H(u,["ref","style"]);return q(()=>B(n.registerContentId(t.id))),r(K,{get when(){return n.contentPresent()},get children(){return r(Ee.Positioner,{get children(){return r(ot,O({ref(o){var s=te(p=>{n.setContentRef(p)},a.ref);typeof s=="function"&&s(o)},role:"tooltip",disableOutsidePointerEvents:!1,get style(){return Ce({"--kb-tooltip-content-transform-origin":"var(--kb-popper-content-transform-origin)",position:"relative"},a.style)},onFocusOutside:o=>o.preventDefault(),onDismiss:()=>n.hideTooltip(!0)},()=>n.dataset(),t))}})}})}function Fe(e){const n=fe();return r(K,{get when(){return n.contentPresent()},get children(){return r(Ye,e)}})}function Ft(e,n,u){const a=e.split("-")[0],t=n.getBoundingClientRect(),o=u.getBoundingClientRect(),s=[],p=t.left+t.width/2,x=t.top+t.height/2;switch(a){case"top":s.push([t.left,x]),s.push([o.left,o.bottom]),s.push([o.left,o.top]),s.push([o.right,o.top]),s.push([o.right,o.bottom]),s.push([t.right,x]);break;case"right":s.push([p,t.top]),s.push([o.left,o.top]),s.push([o.right,o.top]),s.push([o.right,o.bottom]),s.push([o.left,o.bottom]),s.push([p,t.bottom]);break;case"bottom":s.push([t.left,x]),s.push([o.left,o.top]),s.push([o.left,o.bottom]),s.push([o.right,o.bottom]),s.push([o.right,o.top]),s.push([t.right,x]);break;case"left":s.push([p,t.top]),s.push([o.right,o.top]),s.push([o.left,o.top]),s.push([o.left,o.bottom]),s.push([o.right,o.bottom]),s.push([p,t.bottom]);break}return s}var X={},Kt=0,G=!1,N,Q,Y;function Ke(e){const n=`tooltip-${ce()}`,u=`${++Kt}`,a=W({id:n,openDelay:700,closeDelay:300,skipDelayDuration:300},e),[t,o]=H(a,["id","open","defaultOpen","onOpenChange","disabled","triggerOnFocusOnly","openDelay","closeDelay","skipDelayDuration","ignoreSafeArea","forceMount"]);let s;const[p,x]=R(),[i,c]=R(),[d,C]=R(),[l,f]=R(o.placement),h=Oe({open:()=>t.open,defaultOpen:()=>t.defaultOpen,onOpenChange:y=>{var E;return(E=t.onOpenChange)==null?void 0:E.call(t,y)}}),{present:b}=Me({show:()=>t.forceMount||h.isOpen(),element:()=>d()??null}),v=()=>{X[u]=S},P=()=>{for(const y in X)y!==u&&(X[y](!0),delete X[y])},S=(y=!1)=>{y||t.closeDelay&&t.closeDelay<=0?(window.clearTimeout(s),s=void 0,h.close()):s||(s=window.setTimeout(()=>{s=void 0,h.close()},t.closeDelay)),window.clearTimeout(N),N=void 0,t.skipDelayDuration&&t.skipDelayDuration>=0&&(Y=window.setTimeout(()=>{window.clearTimeout(Y),Y=void 0},t.skipDelayDuration)),G&&(window.clearTimeout(Q),Q=window.setTimeout(()=>{delete X[u],Q=void 0,G=!1},t.closeDelay))},M=()=>{clearTimeout(s),s=void 0,P(),v(),G=!0,h.open(),window.clearTimeout(N),N=void 0,window.clearTimeout(Q),Q=void 0,window.clearTimeout(Y),Y=void 0},U=()=>{P(),v(),!h.isOpen()&&!N&&!G?N=window.setTimeout(()=>{N=void 0,G=!0,M()},t.openDelay):h.isOpen()||M()},m=(y=!1)=>{!y&&t.openDelay&&t.openDelay>0&&!s&&!Y?U():M()},V=()=>{window.clearTimeout(N),N=void 0,G=!1},A=()=>{window.clearTimeout(s),s=void 0},T=y=>me(i(),y)||me(d(),y),_=y=>{const E=i(),F=d();if(!(!E||!F))return Ft(y,E,F)},w=y=>{const E=y.target;if(T(E)){A();return}if(!t.ignoreSafeArea){const F=_(l());if(F&&st(rt(y),F)){A();return}}s||S()};q(()=>{if(!h.isOpen())return;const y=xe();y.addEventListener("pointermove",w,!0),B(()=>{y.removeEventListener("pointermove",w,!0)})}),q(()=>{const y=i();if(!y||!h.isOpen())return;const E=se=>{const Ge=se.target;me(Ge,y)&&S(!0)},F=nt();F.addEventListener("scroll",E,{capture:!0}),B(()=>{F.removeEventListener("scroll",E,{capture:!0})})}),B(()=>{clearTimeout(s),X[u]&&delete X[u]});const D={dataset:I(()=>({"data-expanded":h.isOpen()?"":void 0,"data-closed":h.isOpen()?void 0:""})),isOpen:h.isOpen,isDisabled:()=>t.disabled??!1,triggerOnFocusOnly:()=>t.triggerOnFocusOnly??!1,contentId:p,contentPresent:b,openTooltip:m,hideTooltip:S,cancelOpening:V,generateId:he(()=>a.id),registerContentId:ae(x),isTargetOnTooltip:T,setTriggerRef:c,setContentRef:C};return r(Ae.Provider,{value:D,get children(){return r(Ee,O({anchorRef:i,contentRef:d,onCurrentPlacementChange:f},o))}})}function Le(e){let n;const u=fe(),[a,t]=H(e,["ref","onPointerEnter","onPointerLeave","onPointerDown","onClick","onFocus","onBlur"]);let o=!1,s=!1,p=!1;const x=()=>{o=!1},i=()=>{!u.isOpen()&&(s||p)&&u.openTooltip(p)},c=v=>{u.isOpen()&&!s&&!p&&u.hideTooltip(v)},d=v=>{j(v,a.onPointerEnter),!(v.pointerType==="touch"||u.triggerOnFocusOnly()||u.isDisabled()||v.defaultPrevented)&&(s=!0,i())},C=v=>{j(v,a.onPointerLeave),v.pointerType!=="touch"&&(s=!1,p=!1,u.isOpen()?c():u.cancelOpening())},l=v=>{j(v,a.onPointerDown),o=!0,xe(n).addEventListener("pointerup",x,{once:!0})},f=v=>{j(v,a.onClick),s=!1,p=!1,c(!0)},h=v=>{j(v,a.onFocus),!(u.isDisabled()||v.defaultPrevented||o)&&(p=!0,i())},b=v=>{j(v,a.onBlur);const P=v.relatedTarget;u.isTargetOnTooltip(P)||(s=!1,p=!1,c(!0))};return B(()=>{xe(n).removeEventListener("pointerup",x)}),r(ne,O({as:"button",ref(v){var P=te(S=>{u.setTriggerRef(S),n=S},a.ref);typeof P=="function"&&P(v)},get"aria-describedby"(){return le(()=>!!u.isOpen())()?u.contentId():void 0},onPointerEnter:d,onPointerLeave:C,onPointerDown:l,onClick:f,onFocus:h,onBlur:b},()=>u.dataset(),t))}var ee=Object.assign(Ke,{Arrow:De,Content:Re,Portal:Fe,Trigger:Le}),Lt={};Se(Lt,{Collapsible:()=>Bt,Content:()=>we,Root:()=>Pe,Trigger:()=>ke,useCollapsibleContext:()=>oe});var Be=de();function oe(){const e=ue(Be);if(e===void 0)throw new Error("[kobalte]: `useCollapsibleContext` must be used within a `Collapsible.Root` component");return e}function we(e){const[n,u]=R(),a=oe(),t=W({id:a.generateId("content")},e),[o,s]=H(t,["ref","id","style"]),{present:p}=Me({show:a.shouldMount,element:()=>n()??null}),[x,i]=R(0),[c,d]=R(0);let l=a.isOpen()||p();return tt(()=>{const f=requestAnimationFrame(()=>{l=!1});B(()=>{cancelAnimationFrame(f)})}),q(Te(p,()=>{if(!n())return;n().style.transitionDuration="0s",n().style.animationName="none";const f=n().getBoundingClientRect();i(f.height),d(f.width),l||(n().style.transitionDuration="",n().style.animationName="")})),q(Te(a.isOpen,f=>{!f&&n()&&(n().style.transitionDuration="",n().style.animationName="")},{defer:!0})),q(()=>B(a.registerContentId(o.id))),r(K,{get when(){return p()},get children(){return r(ne,O({as:"div",ref(f){var h=te(u,o.ref);typeof h=="function"&&h(f)},get id(){return o.id},get style(){return Ce({"--kb-collapsible-content-height":x()?`${x()}px`:void 0,"--kb-collapsible-content-width":c()?`${c()}px`:void 0},o.style)}},()=>a.dataset(),s))}})}function Pe(e){const n=`collapsible-${ce()}`,u=W({id:n},e),[a,t]=H(u,["open","defaultOpen","onOpenChange","disabled","forceMount"]),[o,s]=R(),p=Oe({open:()=>a.open,defaultOpen:()=>a.defaultOpen,onOpenChange:c=>{var d;return(d=a.onOpenChange)==null?void 0:d.call(a,c)}}),x=I(()=>({"data-expanded":p.isOpen()?"":void 0,"data-closed":p.isOpen()?void 0:"","data-disabled":a.disabled?"":void 0})),i={dataset:x,isOpen:p.isOpen,disabled:()=>a.disabled??!1,shouldMount:()=>a.forceMount||p.isOpen(),contentId:o,toggle:p.toggle,generateId:he(()=>t.id),registerContentId:ae(s)};return r(Be.Provider,{value:i,get children(){return r(ne,O({as:"div"},x,t))}})}function ke(e){const n=oe(),[u,a]=H(e,["onClick"]);return r(it,O({get"aria-expanded"(){return n.isOpen()},get"aria-controls"(){return le(()=>!!n.isOpen())()?n.contentId():void 0},get disabled(){return n.disabled()},onClick:o=>{j(o,u.onClick),n.toggle()}},()=>n.dataset(),a))}var Bt=Object.assign(Pe,{Content:we,Trigger:ke}),Z={};Se(Z,{Accordion:()=>Ht,Content:()=>je,Header:()=>ze,Item:()=>Ve,Root:()=>We,Trigger:()=>Xe,useAccordionContext:()=>$e});var He=de();function Ne(){const e=ue(He);if(e===void 0)throw new Error("[kobalte]: `useAccordionItemContext` must be used within a `Accordion.Item` component");return e}function je(e){const n=Ne(),u=n.generateId("content"),a=W({id:u},e),[t,o]=H(a,["id","style"]);return q(()=>B(n.registerContentId(t.id))),r(we,O({role:"region",get"aria-labelledby"(){return n.triggerId()},get style(){return Ce({"--kb-accordion-content-height":"var(--kb-collapsible-content-height)","--kb-accordion-content-width":"var(--kb-collapsible-content-width)"},t.style)}},o))}function ze(e){const n=oe();return r(ne,O({as:"h3"},()=>n.dataset(),e))}var qe=de();function $e(){const e=ue(qe);if(e===void 0)throw new Error("[kobalte]: `useAccordionContext` must be used within a `Accordion.Root` component");return e}function Ve(e){const n=$e(),u=`${n.generateId("item")}-${ce()}`,a=W({id:u},e),[t,o]=H(a,["value","disabled"]),[s,p]=R(),[x,i]=R(),c=()=>n.listState().selectionManager(),d=()=>c().isSelected(t.value),C={value:()=>t.value,triggerId:s,contentId:x,generateId:he(()=>o.id),registerTriggerId:ae(p),registerContentId:ae(i)};return r(He.Provider,{value:C,get children(){return r(Pe,O({get open(){return d()},get disabled(){return t.disabled}},o))}})}function We(e){let n;const u=`accordion-${ce()}`,a=W({id:u,multiple:!1,collapsible:!1,shouldFocusWrap:!0},e),[t,o]=H(a,["id","ref","value","defaultValue","onChange","multiple","collapsible","shouldFocusWrap","onKeyDown","onMouseDown","onFocusIn","onFocusOut"]),[s,p]=R([]),{DomCollectionProvider:x}=at({items:s,onItemsChange:p}),i=lt({selectedKeys:()=>t.value,defaultSelectedKeys:()=>t.defaultValue,onSelectionChange:C=>{var l;return(l=t.onChange)==null?void 0:l.call(t,Array.from(C))},disallowEmptySelection:()=>!t.multiple&&!t.collapsible,selectionMode:()=>t.multiple?"multiple":"single",dataSource:s});i.selectionManager().setFocusedKey("item-1");const c=ct({selectionManager:()=>i.selectionManager(),collection:()=>i.collection(),disallowEmptySelection:()=>i.selectionManager().disallowEmptySelection(),shouldFocusWrap:()=>t.shouldFocusWrap,disallowTypeAhead:!0,allowsTabNavigation:!0},()=>n),d={listState:()=>i,generateId:he(()=>t.id)};return r(x,{get children(){return r(qe.Provider,{value:d,get children(){return r(ne,O({as:"div",get id(){return t.id},ref(C){var l=te(f=>n=f,t.ref);typeof l=="function"&&l(C)},get onKeyDown(){return z([t.onKeyDown,c.onKeyDown])},get onMouseDown(){return z([t.onMouseDown,c.onMouseDown])},get onFocusIn(){return z([t.onFocusIn])},get onFocusOut(){return z([t.onFocusOut,c.onFocusOut])}},o))}})}})}function Xe(e){let n;const u=$e(),a=Ne(),t=oe(),o=a.generateId("trigger"),s=W({id:o},e),[p,x]=H(s,["ref","onPointerDown","onPointerUp","onClick","onKeyDown","onMouseDown","onFocus"]);dt({getItem:()=>({ref:()=>n,type:"item",key:a.value(),textValue:"",disabled:t.disabled()})});const i=ut({key:()=>a.value(),selectionManager:()=>u.listState().selectionManager(),disabled:()=>t.disabled(),shouldSelectOnPressUp:!0},()=>n),c=d=>{["Enter"," "].includes(d.key)&&d.preventDefault(),j(d,p.onKeyDown),j(d,i.onKeyDown)};return q(()=>B(a.registerTriggerId(x.id))),r(ke,O({ref(d){var C=te(l=>n=l,p.ref);typeof C=="function"&&C(d)},get"data-key"(){return i.dataKey()},get onPointerDown(){return z([p.onPointerDown,i.onPointerDown])},get onPointerUp(){return z([p.onPointerUp,i.onPointerUp])},get onClick(){return z([p.onClick,i.onClick])},onKeyDown:c,get onMouseDown(){return z([p.onMouseDown,i.onMouseDown])},get onFocus(){return z([p.onFocus,i.onFocus])}},x))}var Ht=Object.assign(We,{Content:je,Header:ze,Item:Ve,Trigger:Xe}),re=k('<div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary">'),Nt=k('<div><div class="flex flex-wrap items-center gap-2 text-xs text-primary"><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary"></span></div><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary"></span></div><div class="inline-flex items-center gap-1 rounded-full border border-base px-2 py-0.5 text-xs text-primary"><span class="uppercase text-[10px] tracking-wide text-muted"></span><span class="font-semibold text-primary">');const jt=e=>{const{t:n}=Ue(),{preferences:u}=Ze(),a=I(()=>u().showUsageMetrics??!0),t=I(()=>gt(e.instanceId,e.sessionId)??{cost:0,contextWindow:0,isSubscriptionModel:!1,inputTokens:0,outputTokens:0,reasoningTokens:0,actualUsageTokens:0,modelOutputLimit:0,contextAvailableTokens:null}),o=I(()=>pt(e.instanceId,e.sessionId)),s=I(()=>o().length>0),p=I(()=>s()?ht(e.instanceId,e.sessionId)??{cost:0,inputTokens:0,outputTokens:0,reasoningTokens:0}:{cost:0,inputTokens:0,outputTokens:0,reasoningTokens:0}),x=I(()=>`$${p().cost.toFixed(2)}`),i=I(()=>p().inputTokens),c=I(()=>p().outputTokens),d=I(()=>p().reasoningTokens),C=I(()=>t().inputTokens??0),l=I(()=>t().outputTokens??0),f=I(()=>{const b=t().isSubscriptionModel?0:t().cost;return b>0?b:0}),h=I(()=>t().isSubscriptionModel?n("contextUsagePanel.included"):`$${f().toFixed(2)}`);return(()=>{var b=Nt(),v=b.firstChild,P=v.firstChild,S=P.firstChild,M=S.nextSibling,U=P.nextSibling,m=U.firstChild,V=m.nextSibling,A=U.nextSibling,T=A.firstChild,_=T.nextSibling;return g(S,()=>n("contextUsagePanel.labels.input")),g(M,()=>J(C())),g(m,()=>n("contextUsagePanel.labels.output")),g(V,()=>J(l())),g(T,()=>n("contextUsagePanel.labels.cost")),g(_,h),g(v,r(K,{get when(){return le(()=>!!s())()&&a()},get children(){return[(()=>{var w=re(),$=w.firstChild,D=$.nextSibling;return g($,()=>n("contextUsagePanel.labels.totalInput")),g(D,()=>J(i())),w})(),(()=>{var w=re(),$=w.firstChild,D=$.nextSibling;return g($,()=>n("contextUsagePanel.labels.totalOutput")),g(D,()=>J(c())),w})(),(()=>{var w=re(),$=w.firstChild,D=$.nextSibling;return g($,()=>n("contextUsagePanel.labels.totalCost")),g(D,x),w})(),(()=>{var w=re(),$=w.firstChild,D=$.nextSibling;return g($,()=>n("contextUsagePanel.labels.totalReasoning")),g(D,()=>J(d())),w})()]}}),null),ge(()=>_e(b,`session-context-panel px-4 py-2 ${e.class??""}`)),b})()};var zt=k('<div><div class="mt-2 truncate text-right text-sm font-semibold text-secondary">'),be=k('<div class="text-xs text-tertiary">'),qt=k("<div class=space-y-2>"),Vt=k('<div class="h-2 overflow-hidden border border-base"style=background-color:var(--surface-base)><div class="h-full transition-[width] duration-300"role=progressbar aria-valuemin=0 aria-valuemax=100>'),Wt=k('<div><div class="mb-1 flex items-baseline justify-between gap-2 text-[11px] text-primary"><span class=font-medium></span><div class="flex min-w-0 items-baseline gap-1.5 text-right"><span class="shrink-0 font-medium">'),Xt=k("<span class=text-tertiary aria-hidden=true>·"),Gt=k('<span class="truncate text-[10px] text-tertiary">');const Yt=6e4,Zt=e=>{const{t:n}=Ue(),u=I(()=>{const l=e.providerId.trim();return l?{providerId:l,modelId:e.modelId.trim()}:null}),[a,t]=R();let o=0;const s=async(l,f,h)=>{const b=++o;h&&t(void 0);try{const v=await Je.fetchProviderUsage(l,f);b===o&&t(v)}catch{b===o&&a()===void 0&&t(null)}};q(()=>{const l=u();if(!l){o+=1,t(void 0);return}s(l.providerId,l.modelId,!0)});const p=setInterval(()=>{const l=u();l&&s(l.providerId,l.modelId,!1)},Yt);B(()=>{o+=1,clearInterval(p)});const x=I(()=>{var l;return Object.entries(((l=a())==null?void 0:l.windows)??{})}),i=l=>{const f={"5h":"fiveHours","7d":"sevenDays","7d-sonnet":"sevenDaysSonnet","7d-opus":"sevenDaysOpus",weekly:"weekly",daily:"daily",monthly:"monthly",credits:"credits",billing_cycle:"billingCycle",session:"session",premium:"premium",chat:"chat",completions:"completions","mcp-tools":"mcpTools"}[l];return f?n(`providerUsage.windows.${f}`):l},c=l=>l.valueLabel?l.valueLabel:l.usedPercent===null?n("providerUsage.unavailableValue"):n("providerUsage.usedPercent",{percent:Math.round(l.usedPercent)}),d=l=>{if(!l)return null;const f=new Date(l);return Number.isFinite(f.getTime())?n("providerUsage.resets",{time:f.toLocaleString([],{dateStyle:"short",timeStyle:"short"})}):null},C=l=>l!==null&&l>=80?"var(--status-error)":l!==null&&l>=50?"var(--status-warning)":"var(--status-success)";return(()=>{var l=zt(),f=l.firstChild;return g(l,r(K,{get when(){return a()!==void 0},get fallback(){return(()=>{var h=be();return g(h,()=>n("providerUsage.loading")),h})()},get children(){return r(K,{get when(){return a()},get fallback(){return(()=>{var h=be();return g(h,()=>n("providerUsage.unavailable")),h})()},children:h=>r(K,{get when(){return le(()=>!!(h().supported&&h().configured&&h().ok))()&&x().length>0},get fallback(){return(()=>{var b=be();return g(b,()=>n(h().supported?h().configured?"providerUsage.unavailable":"providerUsage.notConfigured":"providerUsage.unsupported")),b})()},get children(){var b=qt();return g(b,r(ye,{get each(){return x()},children:([v,P])=>(()=>{var S=Wt(),M=S.firstChild,U=M.firstChild,m=U.nextSibling,V=m.firstChild;return g(U,()=>i(v)),g(V,()=>c(P)),g(m,r(K,{get when(){return d(P.resetAt)},children:A=>[Xt(),(()=>{var T=Gt();return g(T,A),T})()]}),null),g(S,r(K,{get when(){return P.usedPercent!==null},get children(){var A=Vt(),T=A.firstChild;return ge(_=>{var w=`${Math.max(0,Math.min(100,P.usedPercent??0))}%`,$=C(P.usedPercent),D=n("providerUsage.progressLabel",{window:i(v)}),y=Math.round(P.usedPercent??0);return w!==_.e&&Ie(T,"width",_.e=w),$!==_.t&&Ie(T,"background-color",_.t=$),D!==_.a&&L(T,"aria-label",_.a=D),y!==_.o&&L(T,"aria-valuenow",_.o=y),_},{e:void 0,t:void 0,a:void 0,o:void 0}),A}}),null),S})()})),b}})})}}),f),g(f,()=>{var h;return((h=a())==null?void 0:h.providerName)??e.providerId}),l})()};var Jt=k("<span class=section-left><span class=section-label>"),Qt=k("<div>"),ie=k('<div class="right-panel-empty right-panel-empty--left"><span class=text-xs>'),en=k('<div class="flex items-center justify-between gap-2 border border-base bg-surface-secondary px-3 py-2"><p class="min-w-0 text-xs leading-5 text-secondary"></p><div class="-mr-2 shrink-0">'),tn=k('<div class="flex flex-col gap-2">'),nn=k("<span>"),on=k('<div class=status-process-card><div class=status-process-header><span class=status-process-title></span><div class=status-process-meta><span></span><span></span></div></div><div class=status-process-actions><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center"></button><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center"></button><button type=button class="button-tertiary w-full p-1 inline-flex items-center justify-center">'),sn=k('<div class="text-xs text-tertiary">'),rn=k('<div class="border border-base bg-surface-secondary px-3 py-2">'),an=k("<div class=status-tab-container>");const ln=e=>{const n=kt(e.section.id);return(()=>{var u=Qt();return Qe(n,u),g(u,r(Z.Item,{get value(){return e.section.id},class:"right-panel-accordion-item",get children(){return[r(Z.Header,{class:"right-panel-accordion-header-row",get children(){return[r(Z.Trigger,{class:"right-panel-accordion-trigger",get children(){return[(()=>{var a=Jt(),t=a.firstChild;return g(a,r(Ot,{class:"h-3.5 w-3.5 text-tertiary","aria-hidden":"true"}),t),g(t,()=>e.t(e.section.labelKey)),a})(),r($t,{get class(){return`right-panel-accordion-chevron ${e.expanded?"right-panel-accordion-chevron-expanded":""}`}})]}}),r(ee,{openDelay:200,gutter:4,placement:"top",get children(){return[r(ee.Trigger,{as:"button",type:"button",class:"section-info-trigger",get"aria-label"(){return e.t(e.section.tooltipKey)},get children(){return r(It,{class:"section-info-icon"})}}),r(ee.Portal,{get children(){return r(ee.Content,{class:"section-info-tooltip",get children(){return e.t(e.section.tooltipKey)}})}})]}})]}}),r(Z.Content,{class:"right-panel-accordion-content",get children(){return e.section.render()}})]}})),ge(()=>_e(u,`right-panel-section-draggable ${n.isActiveDraggable?"right-panel-section-draggable-active":""}`)),u})()},fn=e=>{const n=i=>e.expandedItems().includes(i),u=()=>{const i=e.activeSession();return i?(()=>{var c=en(),d=c.firstChild,C=d.nextSibling;return g(d,()=>e.t("instanceShell.yoloMode.description")),g(C,r(St,{get checked(){return Ct(e.instanceId,i.id)},color:"warning",size:"small",get inputProps(){return{"aria-label":e.t("instanceShell.yoloMode.title")}},onChange:()=>xt(e.instanceId,i.id)})),c})():(()=>{var c=ie(),d=c.firstChild;return g(d,()=>e.t("instanceShell.yoloMode.noSessionSelected")),c})()},a=()=>{const i=e.activeSessionId();if(!i||i==="info")return(()=>{var d=ie(),C=d.firstChild;return g(C,()=>e.t("instanceShell.plan.noSessionSelected")),d})();const c=e.latestTodoState();return c?r(wt,{state:c,get emptyLabel(){return e.t("instanceShell.plan.empty")},showStatusLabel:!1}):(()=>{var d=ie(),C=d.firstChild;return g(C,()=>e.t("instanceShell.plan.empty")),d})()},t=()=>{const i=e.backgroundProcessList();return i.length===0?(()=>{var c=ie(),d=c.firstChild;return g(d,()=>e.t("instanceShell.backgroundProcesses.empty")),c})():(()=>{var c=tn();return g(c,r(ye,{each:i,children:d=>(()=>{var C=on(),l=C.firstChild,f=l.firstChild,h=f.nextSibling,b=h.firstChild,v=b.nextSibling,P=l.nextSibling,S=P.firstChild,M=S.nextSibling,U=M.nextSibling;return g(f,()=>d.title),g(b,r(_t,{class:"h-3.5 w-3.5"})),g(v,()=>e.t("instanceShell.backgroundProcesses.status",{status:d.status})),g(h,r(K,{get when(){return typeof d.outputSizeBytes=="number"},get children(){var m=nn();return g(m,()=>e.t("instanceShell.backgroundProcesses.output",{sizeKb:Math.round((d.outputSizeBytes??0)/1024)})),m}}),null),S.$$click=()=>e.onOpenBackgroundOutput(d),g(S,r(Et,{class:"h-4 w-4"})),M.$$click=()=>e.onStopBackgroundProcess(d.id),g(M,r(At,{class:"h-4 w-4"})),U.$$click=()=>e.onTerminateBackgroundProcess(d.id),g(U,r(Pt,{class:"h-4 w-4"})),ge(m=>{var V=!!d.notifyEnabled,A=!d.notifyEnabled,T=e.t(d.notifyEnabled?"instanceShell.backgroundProcesses.notify.enabled":"instanceShell.backgroundProcesses.notify.disabled"),_=e.t(d.notifyEnabled?"instanceShell.backgroundProcesses.notify.enabled":"instanceShell.backgroundProcesses.notify.disabled"),w=e.t("instanceShell.backgroundProcesses.actions.output"),$=e.t("instanceShell.backgroundProcesses.actions.output"),D=d.status!=="running",y=e.t("instanceShell.backgroundProcesses.actions.stop"),E=e.t("instanceShell.backgroundProcesses.actions.stop"),F=e.t("instanceShell.backgroundProcesses.actions.terminate"),se=e.t("instanceShell.backgroundProcesses.actions.terminate");return V!==m.e&&b.classList.toggle("text-success",m.e=V),A!==m.t&&b.classList.toggle("text-tertiary",m.t=A),T!==m.a&&L(b,"aria-label",m.a=T),_!==m.o&&L(b,"title",m.o=_),w!==m.i&&L(S,"aria-label",m.i=w),$!==m.n&&L(S,"title",m.n=$),D!==m.s&&(M.disabled=m.s=D),y!==m.h&&L(M,"aria-label",m.h=y),E!==m.r&&L(M,"title",m.r=E),F!==m.d&&L(U,"aria-label",m.d=F),se!==m.l&&L(U,"title",m.l=se),m},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0,r:void 0,d:void 0,l:void 0}),C})()})),c})()},o=()=>{const i=e.activeSession();return i?(()=>{var c=rn();return g(c,r(Zt,{get providerId(){return i.model.providerId},get modelId(){return i.model.modelId}})),c})():(()=>{var c=sn();return g(c,()=>e.t("providerUsage.noSession")),c})()},s=I(()=>ft([...[{id:"yolo-mode",labelKey:"instanceShell.rightPanel.sections.yoloMode",tooltipKey:"instanceShell.rightPanel.sections.yoloMode.tooltip",order:10,render:u},{id:"provider-usage",labelKey:"providerUsage.title",tooltipKey:"providerUsage.tooltip",order:20,render:o},{id:"plan",labelKey:"instanceShell.rightPanel.sections.plan",tooltipKey:"instanceShell.rightPanel.sections.plan.tooltip",order:30,render:a},{id:"background-processes",labelKey:"instanceShell.rightPanel.sections.backgroundProcesses",tooltipKey:"instanceShell.rightPanel.sections.backgroundProcesses.tooltip",order:40,render:t},{id:"mcp",labelKey:"instanceShell.rightPanel.sections.mcp",tooltipKey:"instanceShell.rightPanel.sections.mcp.tooltip",order:50,render:()=>r(ve,{get initialInstance(){return e.instance},sections:["mcp"],showSectionHeadings:!1,class:"space-y-2"})},{id:"lsp",labelKey:"instanceShell.rightPanel.sections.lsp",tooltipKey:"instanceShell.rightPanel.sections.lsp.tooltip",order:60,render:()=>r(ve,{get initialInstance(){return e.instance},sections:["lsp"],showSectionHeadings:!1,class:"space-y-2"})},{id:"plugins",labelKey:"instanceShell.rightPanel.sections.plugins",tooltipKey:"instanceShell.rightPanel.sections.plugins.tooltip",order:70,render:()=>r(ve,{get initialInstance(){return e.instance},sections:["plugins"],showSectionHeadings:!1,class:"space-y-2"})}],...e.extraSections??[]],e.customization().statusSectionOrder,e.customization().hiddenStatusSectionIds)),p=(i,c)=>{if(!i||i===c)return;const d=s().map(b=>b.id),C=d.indexOf(i),l=d.indexOf(c);if(C===-1||l===-1)return;const f=[...d],[h]=f.splice(C,1);f.splice(l,0,h),e.onCustomizationChange(b=>({...b,statusSectionOrder:f}))},x=({draggable:i,droppable:c})=>{c&&p(String(i.id),String(c.id))};return(()=>{var i=an();return g(i,r(K,{get when(){return e.activeSession()},children:c=>r(jt,{get instanceId(){return e.instanceId},get sessionId(){return c().id},class:"status-tab-context-panel"})}),null),g(i,r(Z.Root,{class:"right-panel-accordion",collapsible:!0,multiple:!0,get value(){return e.expandedItems()},get onChange(){return e.onExpandedItemsChange},get children(){return r(mt,{collisionDetector:vt,onDragEnd:x,get children(){return r(bt,{get children(){return r(yt,{get ids(){return s().map(c=>c.id)},get children(){return r(ye,{get each(){return s()},children:c=>r(ln,{section:c,get expanded(){return n(c.id)},get t(){return e.t}})})}})}})}})}}),null),i})()};et(["click"]);export{fn as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{I as n}from"./main-
|
|
1
|
+
import{I as n}from"./main-BEYytlgD.js";import{n as o,m as y}from"./git-diff-vendor-CYS3ApzA.js";const i=[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["line",{x1:"3",x2:"21",y1:"18",y2:"18",key:"kwyyxn"}]],t=e=>o(n,y(e,{name:"AlignJustify",iconNode:i}));export{t as A};
|