@evandu/super-pi 0.1.263 → 0.1.265
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/README.md +12 -0
- package/bin/completion.js +91 -0
- package/bin/super-pi.js +11 -1
- package/desktop/main.cjs +35 -3
- package/desktop/preload.cjs +1 -0
- package/desktop/update-lifecycle.cjs +8 -0
- package/dist/client/.super-pi-client-sources.json +12 -11
- package/dist/client/assets/{CodeMirrorEditor-EhfQhlNI.js → CodeMirrorEditor-B2cHfrUS.js} +2 -2
- package/dist/client/assets/GitDiffEditor-Bl7XQIDD.js +29 -0
- package/dist/client/assets/dist-3qQVP6l8.js +6 -0
- package/dist/client/assets/{dist-BXAOrsjq.js → dist-BlRuQIg1.js} +1 -1
- package/dist/client/assets/{dist-BRVQKlcp.js → dist-BvjUKkwy.js} +1 -1
- package/dist/client/assets/{dist-QzbOCAU6.js → dist-CQncCwUc.js} +1 -1
- package/dist/client/assets/dist-CZ4PyxQu.js +9 -0
- package/dist/client/assets/dist-CfTFp0AF.js +2 -0
- package/dist/client/assets/dist-CxmJXjJI.js +1 -0
- package/dist/client/assets/{dist-Dvb0SqcK.js → dist-D5u1uPmZ.js} +2 -2
- package/dist/client/assets/dist-D8HpMxmZ.js +1 -0
- package/dist/client/assets/{dist-AW5lyI3I.js → dist-DGBjhKI9.js} +1 -1
- package/dist/client/assets/dist-DRBIy9A1.js +1 -0
- package/dist/client/assets/dist-Dcww9FSw.js +1 -0
- package/dist/client/assets/{dist-moiMRpw_.js → dist-DjI7p99D.js} +1 -1
- package/dist/client/assets/dist-DlPa5gNa.js +7 -0
- package/dist/client/assets/dist-DxPJ1PN-.js +1 -0
- package/dist/client/assets/dist-HXD8sSA4.js +23 -0
- package/dist/client/assets/dist-LbeLCeoq.js +1 -0
- package/dist/client/assets/dist-ONdtnupI.js +1 -0
- package/dist/client/assets/dist-YqmXusLA.js +11 -0
- package/dist/client/assets/dist-ZAR1Tu2c.js +3 -0
- package/dist/client/assets/{dist-Cus6_oaF.js → dist-i79xiXVk.js} +2 -2
- package/dist/client/assets/index-Cl8iehsn.css +1 -0
- package/dist/client/assets/index-DW2nd-Cf.js +350 -0
- package/dist/client/index.html +2 -2
- package/dist/server/application/provider-service.d.ts +1 -0
- package/dist/server/application/provider-service.js +12 -2
- package/dist/server/http-server.js +105 -41
- package/dist/server/managed-http-direct.d.ts +9 -0
- package/dist/server/managed-http-direct.js +100 -0
- package/dist/server/managed-http.js +14 -0
- package/dist/server/managed-servers.d.ts +17 -1
- package/dist/server/managed-servers.js +196 -30
- package/dist/server/pi-session.js +1 -1
- package/dist/server/published-server-update.d.ts +6 -0
- package/dist/server/published-server-update.js +54 -0
- package/dist/server/read-receipts.d.ts +10 -0
- package/dist/server/read-receipts.js +55 -0
- package/dist/server/update-status.d.ts +3 -1
- package/dist/server/update-status.js +5 -3
- package/dist/shared/directory-completion.d.ts +5 -0
- package/dist/shared/directory-completion.js +10 -0
- package/dist/shared/managed-servers.d.ts +15 -0
- package/dist/shared/managed-servers.js +3 -1
- package/dist/shared/read-receipts.d.ts +7 -0
- package/dist/shared/read-receipts.js +3 -0
- package/dist/shared/update-status.d.ts +1 -1
- package/dist/shared/update-status.js +1 -1
- package/package.json +14 -1
- package/scripts/restart-process.mjs +11 -0
- package/scripts/restart-server.mjs +2 -2
- package/dist/client/assets/GitDiffEditor-Fd--uK9q.js +0 -29
- package/dist/client/assets/dist-B3-a6uF0.js +0 -7
- package/dist/client/assets/dist-BGxkyh6e.js +0 -1
- package/dist/client/assets/dist-BJxfd7yb.js +0 -11
- package/dist/client/assets/dist-BV64A9Ji.js +0 -1
- package/dist/client/assets/dist-CKF2Jksy.js +0 -1
- package/dist/client/assets/dist-CX_Hm4GS.js +0 -1
- package/dist/client/assets/dist-Cx00EZKR.js +0 -23
- package/dist/client/assets/dist-D71y2EI1.js +0 -1
- package/dist/client/assets/dist-Dc1MBGAG.js +0 -1
- package/dist/client/assets/dist-Dds-qLxY.js +0 -9
- package/dist/client/assets/dist-DeD9copn.js +0 -1
- package/dist/client/assets/dist-DuvGReu-.js +0 -6
- package/dist/client/assets/dist-J6XWqRpB.js +0 -3
- package/dist/client/assets/dist-scBkrwv-.js +0 -2
- package/dist/client/assets/index-Cs_T0IFR.js +0 -350
- package/dist/client/assets/index-D6ei0DbU.css +0 -1
package/README.md
CHANGED
|
@@ -8,6 +8,18 @@ It provides a rich Web UI featuring multi-workspace management, interactive agen
|
|
|
8
8
|
|
|
9
9
|
## Installation & Usage
|
|
10
10
|
|
|
11
|
+
### Shell completion
|
|
12
|
+
|
|
13
|
+
Run `super_pi completion install` once, then open a new terminal. Bash, Zsh, Fish and
|
|
14
|
+
PowerShell are supported; select explicitly with `super_pi completion install zsh`.
|
|
15
|
+
Use `super_pi completion bash` (or another shell name) to print the registration script
|
|
16
|
+
instead of modifying a profile. Completion covers commands, subcommands and options.
|
|
17
|
+
Both `super_pi` and `super-pi` are registered.
|
|
18
|
+
|
|
19
|
+
The workspace directory picker also filters child directories as you type part of a path.
|
|
20
|
+
Click a result to enter it; Tab completes a single remaining candidate. A partial path is
|
|
21
|
+
never silently submitted as its parent directory.
|
|
22
|
+
|
|
11
23
|
### Desktop and multiple servers
|
|
12
24
|
|
|
13
25
|
The full package includes the desktop app, local SSH manager, and the complete browser UI:
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { readFile, mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, join, basename } from "node:path";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { execFile } from "node:child_process";
|
|
5
|
+
import { promisify } from "node:util";
|
|
6
|
+
|
|
7
|
+
const shells = ["bash", "zsh", "fish", "powershell"];
|
|
8
|
+
const commands = ["desktop", "start", "stop", "restart", "update", "set", "diagnose", "logs", "autostart", "completion", "help"];
|
|
9
|
+
const options = ["--port", "--host", "--browser", "--no-browser"];
|
|
10
|
+
export function completionCandidates(words) {
|
|
11
|
+
if (words.at(-1) === "--cursor-empty") words = [...words.slice(0, -1), ""];
|
|
12
|
+
const current = words.at(-1) ?? "";
|
|
13
|
+
let values = [];
|
|
14
|
+
if (words.length <= 1) values = [...commands, ...options];
|
|
15
|
+
else if (words.length === 2 && words[0] === "set") values = ["port", "host"];
|
|
16
|
+
else if (words.length === 2 && ["autostart", "startup"].includes(words[0])) values = ["enable", "disable", "status"];
|
|
17
|
+
else if (words[0] === "completion") values = words.length === 2 ? [...shells, "install"] : words[1] === "install" && words.length === 3 ? shells : [];
|
|
18
|
+
else if (["--port", "--host", "--url", "port", "host"].includes(words.at(-2))) values = [];
|
|
19
|
+
else if (["start", "stop", "restart", "update"].includes(words[0])) values = options;
|
|
20
|
+
else if (words[0] === "logs") values = ["--follow", "--path", "--clear"];
|
|
21
|
+
else if (["desktop", "app"].includes(words[0])) values = ["--hidden"];
|
|
22
|
+
else if (words[0] === "diagnose") values = ["--url", "--workspace", "--conversation"];
|
|
23
|
+
return values.filter(value => value.startsWith(current));
|
|
24
|
+
}
|
|
25
|
+
export function completionScript(shell) {
|
|
26
|
+
if (!shells.includes(shell)) throw new Error(`Supported shells: ${shells.join(", ")}`);
|
|
27
|
+
if (shell === "bash") return `# Super Pi shell completion
|
|
28
|
+
_super_pi_complete() {
|
|
29
|
+
local IFS=$'\\n'
|
|
30
|
+
COMPREPLY=( $(super_pi __complete "\${COMP_WORDS[@]:1:COMP_CWORD}") )
|
|
31
|
+
}
|
|
32
|
+
complete -F _super_pi_complete super_pi super-pi super-pi-server
|
|
33
|
+
`;
|
|
34
|
+
if (shell === "zsh") return `# Super Pi shell completion
|
|
35
|
+
autoload -Uz compinit
|
|
36
|
+
(( $+functions[compdef] )) || compinit
|
|
37
|
+
_super_pi_complete() {
|
|
38
|
+
local -a candidates
|
|
39
|
+
candidates=("DOLLAR{(@f)$(super_pi __complete "DOLLAR{words[@]:1:$((CURRENT-1))}")}")
|
|
40
|
+
compadd -- "DOLLAR{candidates[@]}"
|
|
41
|
+
}
|
|
42
|
+
compdef _super_pi_complete super_pi super-pi super-pi-server
|
|
43
|
+
`.replaceAll("DOLLAR", "$");
|
|
44
|
+
if (shell === "fish") return `# Super Pi shell completion
|
|
45
|
+
function __super_pi_complete
|
|
46
|
+
set -l tokens (commandline -opc)
|
|
47
|
+
set -e tokens[1]
|
|
48
|
+
set -l current (commandline -ct)
|
|
49
|
+
if test -z "$current"
|
|
50
|
+
super_pi __complete $tokens --cursor-empty
|
|
51
|
+
else
|
|
52
|
+
super_pi __complete $tokens "$current"
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
for command in super_pi super-pi super-pi-server
|
|
56
|
+
complete -c $command -f -a '(__super_pi_complete)'
|
|
57
|
+
end
|
|
58
|
+
`;
|
|
59
|
+
return `# Super Pi shell completion
|
|
60
|
+
Register-ArgumentCompleter -Native -CommandName super_pi, super-pi, super-pi-server -ScriptBlock {
|
|
61
|
+
param($wordToComplete, $commandAst, $cursorPosition)
|
|
62
|
+
$words = @($commandAst.CommandElements | Select-Object -Skip 1 | Where-Object { $_.Extent.StartOffset -lt $cursorPosition } | ForEach-Object { $_.Extent.Text })
|
|
63
|
+
if (-not $wordToComplete) { $words += '--cursor-empty' }
|
|
64
|
+
& super_pi __complete @words | ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) }
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
export async function installCompletion(shell, home = homedir()) {
|
|
69
|
+
completionScript(shell);
|
|
70
|
+
let file;
|
|
71
|
+
if (shell === "powershell") {
|
|
72
|
+
let result;
|
|
73
|
+
for (const binary of ["pwsh", "powershell"]) {
|
|
74
|
+
try { result = await promisify(execFile)(binary, ["-NoProfile", "-Command", "$PROFILE.CurrentUserAllHosts"], { windowsHide: true }); break; } catch { /* Try the installed PowerShell edition. */ }
|
|
75
|
+
}
|
|
76
|
+
file = result?.stdout.trim();
|
|
77
|
+
if (!file) throw new Error("Cannot locate the PowerShell profile.");
|
|
78
|
+
} else file = shell === "fish" ? join(home, ".config", "fish", "conf.d", "super-pi-completion.fish") : join(home, shell === "zsh" ? ".zshrc" : ".bashrc");
|
|
79
|
+
let original = "";
|
|
80
|
+
try { original = await readFile(file, "utf8"); } catch (error) { if (error.code !== "ENOENT") throw error; }
|
|
81
|
+
const start = "# >>> Super Pi completion >>>", end = "# <<< Super Pi completion <<<";
|
|
82
|
+
const block = `${start}\n${completionScript(shell)}${end}`;
|
|
83
|
+
const begin = original.indexOf(start), finish = original.indexOf(end, begin);
|
|
84
|
+
const updated = begin >= 0 && finish >= begin ? `${original.slice(0, begin)}${block}${original.slice(finish + end.length)}` : `${original}${original.endsWith("\n") || !original ? "" : "\n"}${block}\n`;
|
|
85
|
+
if (updated !== original) { await mkdir(dirname(file), { recursive: true }); await writeFile(file, updated, "utf8"); }
|
|
86
|
+
return file;
|
|
87
|
+
}
|
|
88
|
+
export function defaultShell() {
|
|
89
|
+
const shell = basename(process.env.SHELL ?? "").replace(/\.exe$/i, "");
|
|
90
|
+
return shells.includes(shell) ? shell : process.platform === "win32" ? "powershell" : "bash";
|
|
91
|
+
}
|
package/bin/super-pi.js
CHANGED
|
@@ -296,7 +296,17 @@ const implicitStart = raw?.startsWith("-") ?? false;
|
|
|
296
296
|
const command = implicitStart ? "start" : raw?.toLowerCase();
|
|
297
297
|
const args = implicitStart ? [raw, ...rest] : rest;
|
|
298
298
|
try {
|
|
299
|
-
if (command === "
|
|
299
|
+
if (command === "__complete") { console.log((await import("./completion.js")).completionCandidates(args).join("\n")); process.exit(0); }
|
|
300
|
+
if (command === "completion") {
|
|
301
|
+
const { completionScript, installCompletion, defaultShell } = await import("./completion.js");
|
|
302
|
+
if (args[0] === "install") {
|
|
303
|
+
const shell = args[1] ?? defaultShell();
|
|
304
|
+
const file = await installCompletion(shell);
|
|
305
|
+
console.log(`Installed ${shell} completion in ${file}. Open a new terminal to use it.`);
|
|
306
|
+
} else console.log(completionScript(args[0] ?? defaultShell()));
|
|
307
|
+
process.exit(0);
|
|
308
|
+
}
|
|
309
|
+
if (command === "help" || raw === "--help" || raw === "-h") { usage(); console.log(" completion [SHELL] Print shell completion (bash, zsh, fish, powershell)"); console.log(" completion install [SHELL] Install completion without changing other profile settings"); process.exit(0); }
|
|
300
310
|
if (command === "desktop" || command === "app") { if (!existsSync(join(root, "desktop", "launch.cjs"))) throw new Error("纯服务包不包含桌面端,请在自己的电脑安装完整包 @evandu/super-pi"); const launcher = await import(pathToFileURL(join(root, "desktop", "launch.cjs")).href); await launcher.default.launchDesktop(args); process.exit(0); }
|
|
301
311
|
else if (!command) { const value = options(args); await start(value); const url = `http://127.0.0.1:${value.port}`; if (value.browser) openBrowser(url); console.log(value.browser ? `Opened ${url}\n${runningBanner(url)}` : runningBanner(url)); process.exit(0); }
|
|
302
312
|
if (command === "autostart" || command === "startup") { const action = args.shift()?.toLowerCase() ?? "status"; const value = options(args); if (action === "enable") await enable(value); else if (action === "disable") await disable(); else if (action === "status") await status(); else throw new Error("Autostart action must be enable, disable, or status."); process.exit(0); }
|
package/desktop/main.cjs
CHANGED
|
@@ -6,6 +6,8 @@ const { existsSync } = require("node:fs");
|
|
|
6
6
|
const { homedir } = require("node:os");
|
|
7
7
|
const { join, resolve } = require("node:path");
|
|
8
8
|
const { macLaunchAgent } = require("./login-item.cjs");
|
|
9
|
+
const { expectedServiceExit, shouldRestartDesktop } = require("./update-lifecycle.cjs");
|
|
10
|
+
const desktopVersion = require("../package.json").version;
|
|
9
11
|
|
|
10
12
|
const exec = promisify(execFile), root = resolve(__dirname, "..");
|
|
11
13
|
const dataDir = process.env.SUPER_PI_DATA_DIR || join(homedir(), ".super-pi");
|
|
@@ -14,6 +16,32 @@ app.setName("Super Pi");
|
|
|
14
16
|
if (process.platform === "win32") app.setAppUserModelId("com.evandu.super-pi");
|
|
15
17
|
let mainWindow, tray, server, origin, quitting = false, ownsServer = false;
|
|
16
18
|
let frameTheme;
|
|
19
|
+
let relaunching = false, updateMonitor;
|
|
20
|
+
async function diskVersion() { try { return JSON.parse(await readFile(join(root, "package.json"), "utf8")).version; } catch { return undefined; } }
|
|
21
|
+
async function updateOperation() { try { return JSON.parse(await readFile(join(dataDir, "update-status.json"), "utf8")); } catch { return undefined; } }
|
|
22
|
+
async function restartDesktop() {
|
|
23
|
+
if (relaunching) return;
|
|
24
|
+
const node = await nodeBinary();
|
|
25
|
+
relaunching = true;
|
|
26
|
+
const args = process.argv.slice(2).filter(value => value !== "--hidden");
|
|
27
|
+
if (!mainWindow?.isVisible()) args.push("--hidden");
|
|
28
|
+
app.relaunch({ execPath: node, args: [join(root, "desktop/launch.cjs"), ...args] });
|
|
29
|
+
quitting = true; ownsServer = false;
|
|
30
|
+
setImmediate(() => app.quit());
|
|
31
|
+
}
|
|
32
|
+
function monitorUpdates() {
|
|
33
|
+
let checking = false;
|
|
34
|
+
updateMonitor = setInterval(async () => {
|
|
35
|
+
if (checking || quitting || relaunching) return;
|
|
36
|
+
checking = true;
|
|
37
|
+
try {
|
|
38
|
+
const [disk, operation, status] = await Promise.all([diskVersion(), updateOperation(), health(Number(new URL(origin).port))]);
|
|
39
|
+
if (shouldRestartDesktop({ desktopVersion, diskVersion: disk, health: status, operation })) await restartDesktop();
|
|
40
|
+
} catch { /* A running workbench remains available while update status is temporarily unavailable. */ }
|
|
41
|
+
finally { checking = false; }
|
|
42
|
+
}, 1500);
|
|
43
|
+
updateMonitor.unref();
|
|
44
|
+
}
|
|
17
45
|
|
|
18
46
|
async function config() { try { return JSON.parse(await readFile(join(dataDir, "config.json"), "utf8")); } catch { return {}; } }
|
|
19
47
|
async function health(port) { try { const result = await fetch(`http://127.0.0.1:${port}/api/health`, { signal: AbortSignal.timeout(1500) }); return result.ok ? await result.json() : undefined; } catch { return undefined; } }
|
|
@@ -36,8 +64,9 @@ async function startManager() {
|
|
|
36
64
|
delete env.ELECTRON_RUN_AS_NODE;
|
|
37
65
|
server = spawn(node, [join(root, "dist/server/index.js"), `--host=127.0.0.1`, `--port=${port}`], { env, windowsHide: true, stdio: "ignore" });
|
|
38
66
|
ownsServer = true;
|
|
39
|
-
server.once("exit", () => {
|
|
40
|
-
|
|
67
|
+
server.once("exit", async () => {
|
|
68
|
+
ownsServer = false;
|
|
69
|
+
if (!quitting && !expectedServiceExit(await updateOperation())) { void dialog.showMessageBox({ type: "error", title: "Super Pi 本地服务已停止", message: "本地管理服务意外退出", detail: `可通过 super_pi logs 查看日志。远端工具进程不会因窗口关闭而退出。` }); }
|
|
41
70
|
});
|
|
42
71
|
const deadline = Date.now() + 60_000;
|
|
43
72
|
while (Date.now() < deadline) {
|
|
@@ -80,7 +109,8 @@ async function createWindow() {
|
|
|
80
109
|
external(url); return { action: "deny" };
|
|
81
110
|
});
|
|
82
111
|
mainWindow.on("app-command", (_event, command) => { if (["browser-backward", "browser-forward"].includes(command)) { const keyCode = command === "browser-backward" ? "Left" : "Right"; mainWindow.webContents.sendInputEvent({ type: "keyDown", keyCode, modifiers: ["alt"] }); mainWindow.webContents.sendInputEvent({ type: "keyUp", keyCode, modifiers: ["alt"] }); } });
|
|
83
|
-
ipcMain.handle("super-pi-desktop:status", async event => { trusted(event); return { desktop: true, platform: process.platform, autoStart: await autoStartStatus(), origin, ownsServer, frameTheme, backgroundColor: mainWindow.getBackgroundColor() }; });
|
|
112
|
+
ipcMain.handle("super-pi-desktop:status", async event => { trusted(event); const disk = await diskVersion(); return { desktop: true, desktopVersion, diskVersion: disk, needsDesktopRestart: Boolean(disk && disk !== desktopVersion), platform: process.platform, autoStart: await autoStartStatus(), origin, ownsServer, frameTheme, backgroundColor: mainWindow.getBackgroundColor() }; });
|
|
113
|
+
ipcMain.handle("super-pi-desktop:restart", async event => { trusted(event); await restartDesktop(); return { restarting: true }; });
|
|
84
114
|
ipcMain.handle("super-pi-desktop:theme", (event, value) => {
|
|
85
115
|
trusted(event);
|
|
86
116
|
if (!value || !/^#[a-f0-9]{6}$/i.test(value.background) || !/^#[a-f0-9]{6}$/i.test(value.foreground) || typeof value.dark !== "boolean") throw new Error("窗口主题参数无效");
|
|
@@ -99,12 +129,14 @@ async function createWindow() {
|
|
|
99
129
|
tray = new Tray(trayImage); tray.setToolTip("Super Pi · 本地管理服务运行中"); tray.setContextMenu(trayMenu); tray.on("double-click", show); tray.on("click", show);
|
|
100
130
|
Menu.setApplicationMenu(Menu.buildFromTemplate([{ label: "Super Pi", submenu: [{ label: "在浏览器打开", click: () => external(origin) }, { label: "隐藏到托盘", click: () => mainWindow.hide() }, { type: "separator" }, { role: "quit", label: "退出 Super Pi" }] }, { role: "editMenu", label: "编辑" }, { role: "viewMenu", label: "视图" }, { role: "windowMenu", label: "窗口" }]));
|
|
101
131
|
await mainWindow.loadURL(origin);
|
|
132
|
+
monitorUpdates();
|
|
102
133
|
if (!process.argv.includes("--hidden")) show();
|
|
103
134
|
}
|
|
104
135
|
if (!app.requestSingleInstanceLock()) app.quit();
|
|
105
136
|
else {
|
|
106
137
|
app.on("second-instance", show); app.on("activate", show); app.on("window-all-closed", () => {});
|
|
107
138
|
app.on("before-quit", event => {
|
|
139
|
+
clearInterval(updateMonitor);
|
|
108
140
|
if (quitting) return;
|
|
109
141
|
quitting = true;
|
|
110
142
|
if (ownsServer && server) {
|
package/desktop/preload.cjs
CHANGED
|
@@ -5,6 +5,7 @@ if (process.isMainFrame) {
|
|
|
5
5
|
setAutoStart: enabled => ipcRenderer.invoke("super-pi-desktop:autostart", Boolean(enabled)),
|
|
6
6
|
openBrowser: () => ipcRenderer.invoke("super-pi-desktop:browser"),
|
|
7
7
|
minimize: () => ipcRenderer.invoke("super-pi-desktop:minimize"),
|
|
8
|
+
restart: () => ipcRenderer.invoke("super-pi-desktop:restart"),
|
|
8
9
|
}));
|
|
9
10
|
window.addEventListener("DOMContentLoaded", () => {
|
|
10
11
|
const root = document.documentElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
function expectedServiceExit(operation, now = Date.now()) {
|
|
2
|
+
return operation && ["waiting", "installing", "restarting"].includes(operation.phase) && now - Date.parse(operation.changedAt) < 30 * 60_000;
|
|
3
|
+
}
|
|
4
|
+
function shouldRestartDesktop({ desktopVersion, diskVersion, health, operation }) {
|
|
5
|
+
return Boolean(diskVersion && diskVersion !== desktopVersion && health?.runningVersion === diskVersion
|
|
6
|
+
&& ["restarting", "completed"].includes(operation?.phase) && operation.targetVersion === diskVersion);
|
|
7
|
+
}
|
|
8
|
+
module.exports = { expectedServiceExit, shouldRestartDesktop };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"hash": "
|
|
2
|
+
"hash": "13f147ba45d29e592dcb856bf8feb9233f9558ac893053c3bd04e24edef608e5",
|
|
3
3
|
"files": {
|
|
4
|
-
"src/client/App.tsx": "
|
|
4
|
+
"src/client/App.tsx": "1461c194a7919f75faa8411c72fa272dbfc4f7aa45a86e4459ac4910c75cca91",
|
|
5
5
|
"src/client/CacheWarmingSettings.tsx": "cce26c4547634b76c08c681a4b9605f884d8502f554f12ff8c30cbd2fd0bd9c0",
|
|
6
6
|
"src/client/CodeMirrorEditor.tsx": "10e4444d606b731a117417b052401f27b5d14ba8d12ff518e31ee188bf66e512",
|
|
7
|
-
"src/client/DesktopPanel.tsx": "
|
|
7
|
+
"src/client/DesktopPanel.tsx": "16a3342193aa45d78b2041a711824fdbfe19cf81cbbcfd16b6eee008f075a379",
|
|
8
8
|
"src/client/ErrorBoundary.tsx": "d16376f9f6c7cc1fab8590c65a66438127642f7d6bb8023cec53d8a6cc9f3964",
|
|
9
9
|
"src/client/FeishuPanel.tsx": "3b3257da36bf863e004a33a4c1d721db364b4449fb23f0805cb74b973a2ed2da",
|
|
10
10
|
"src/client/FileMentionMenu.tsx": "d400e7afb31008eda49d4b531eceda65a926b877177d0cffd9a8056b55161c3e",
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"src/client/FilesPanel.tsx": "08d5f5e6907659aa83fec71e5fa7bce59cd999f3e513cbaa9f8b5365654dba6b",
|
|
13
13
|
"src/client/GitDiffEditor.tsx": "192f71ddba603f0254cfa54bb40bb8be3a42d83f4a98634011f7de0d81974ba0",
|
|
14
14
|
"src/client/GitPanel.tsx": "72cf7eb1df5a0b1d63eca6ca981850fc24cb8277689ac4414b9ecc88065ed09f",
|
|
15
|
-
"src/client/GroupChatPane.tsx": "
|
|
15
|
+
"src/client/GroupChatPane.tsx": "89b9f305c57976167856137566833ac74a153084e702dadea8ecfa2357f1cdda",
|
|
16
16
|
"src/client/GroupExecutionPane.tsx": "6b1f479ef8c20b5a8cb98022253647d8f7b8d582d6e822f9ddec0bc3bd3ec299",
|
|
17
17
|
"src/client/GroupModelSelect.tsx": "e6795c8d06093cc4bf4bba6a2220bdd6036279f85c61eb4188f66336d97b628d",
|
|
18
18
|
"src/client/HelpWindow.tsx": "dd4767f4cdced2fcdb50769eb5417ef8de722f43bbd594c9854f49fe61d15d97",
|
|
19
19
|
"src/client/KnowledgeFilePicker.tsx": "82bdd65e8a624276abd5a7530ef47f86a5f9b7649b464080638055991f6278cf",
|
|
20
20
|
"src/client/KnowledgePanel.tsx": "1e64ee6f9d29456ab9470424def8269cc9b3935e3b8ba674739ce5a6cb7db56d",
|
|
21
|
-
"src/client/ManagedServersPanel.tsx": "
|
|
21
|
+
"src/client/ManagedServersPanel.tsx": "6dadd576713b36e22185abb334693048f5ab86d06c14086b2a74ff746655564b",
|
|
22
22
|
"src/client/MarkdownSyntaxSettings.tsx": "9124d02956a4d70e2607fc584b226f8a82764b613015958fe117159d0cbf78e1",
|
|
23
23
|
"src/client/MarkdownView.tsx": "c52e63bddd2275573731166375275caf80f3327a3b4a2aff07d14aecfda00b8e",
|
|
24
24
|
"src/client/MathView.tsx": "f322a430b93594dd625b4c699994574f81d9bac72fa49b904505ca6e9e3dcb93",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"src/client/ServerConnectionsPanel.tsx": "38cbcfc6556981f5f0370ecc1643ed79a9c95adda164e3a9d9ea4be6f2c2e41d",
|
|
32
32
|
"src/client/SidebarSection.tsx": "579c014caeddd94d21911d7b9eca4ceef930ca13c2baeb7bf5ffba59c2bb0b75",
|
|
33
33
|
"src/client/SlashCommandMenu.tsx": "8b2319da03b55827865fb9b6646f7a820aa26cc460cceeed9fb7edb20ad9ebb7",
|
|
34
|
-
"src/client/SoftwareUpdate.tsx": "
|
|
34
|
+
"src/client/SoftwareUpdate.tsx": "54a6bd4c53a7e648367836d19163741b0fc9e80f779df359f83c2234edf9e743",
|
|
35
35
|
"src/client/SshVerificationForm.tsx": "8d7968822203e2404742f9fb6dde24656c97541628999e1d8cd34c8652c1c23e",
|
|
36
36
|
"src/client/Tabs.tsx": "a6a853b0752f5a96f451de502669fbb7ad4b5c141cb3f6a9cd3b9746797b5649",
|
|
37
37
|
"src/client/TavilyPanel.css": "22d4fb4a1bc95b2e0a96c49b9650a56f1a6cf7cfc3c6bc68564417d2c268e193",
|
|
@@ -64,16 +64,17 @@
|
|
|
64
64
|
"src/client/native-tools.css": "71bbb365a91105be0925acce27f1e1ea5e0c3369aa5137060d2bc426682e113d",
|
|
65
65
|
"src/client/pending-operations.ts": "8a5f9e9711c0f875c8ed194196c218162de5270298dad4091351d41294c859d7",
|
|
66
66
|
"src/client/project-evidence.ts": "3bc5ea85f6b20a19a36cfdd4a958d83dd53b21f3d8f20fae1914a575dfbad3c4",
|
|
67
|
-
"src/client/reader-recovery.ts": "
|
|
68
|
-
"src/client/server-connections.ts": "
|
|
67
|
+
"src/client/reader-recovery.ts": "c4b934d7344f4ba623f755651cf1b7b877faa2952e1307d0e2bbdfa718d3d5ad",
|
|
68
|
+
"src/client/server-connections.ts": "ac81be6f1d75f86ecfbc1baf773634beb8dce6bf03819f7f67ee48c9c530f455",
|
|
69
69
|
"src/client/server-scope.ts": "8edad8ebe6f35179584c3d2627304f394dd40e6dd83881d7edaf386ff46243cc",
|
|
70
70
|
"src/client/session-tree.ts": "08a14c6611fdd9a72001eb1672060479e7660de5a5d221c7e80036209fd26546",
|
|
71
|
+
"src/client/shared-read-receipts.ts": "3554e6f85c20d2c2228cca02579b1e5bc2c1c9a3fff7caa4421055d564a04e9b",
|
|
71
72
|
"src/client/slash-commands.ts": "4a2cef1eb9517628eadfdc38bca7e3663e4d48090d8b87a8a79de4bfd586e112",
|
|
72
|
-
"src/client/software-update.css": "
|
|
73
|
+
"src/client/software-update.css": "2df7c45ba0491b8c110481065d07f18992b157ef7124f7bdb2fead8cd33793e4",
|
|
73
74
|
"src/client/styles.css": "47099ff0f5c233836ae279e33f2c6973411428c9709ea1171f8492cd55269cc4",
|
|
74
75
|
"src/client/system-notifications.ts": "36dccbda2d831812d34af7217778a7a3596b184dfc2b39e0d5a0207a1a7eebd0",
|
|
75
76
|
"src/client/terminal-emulator.ts": "ffcc4f5fbddaf25cebcc9e03dbe5d7d0ad2c21586f5d169e57c04c82e2308b3b",
|
|
76
|
-
"src/client/theme.tsx": "
|
|
77
|
+
"src/client/theme.tsx": "27712c5043d241369105bb12522c76ae75ed2d28d1f9f6105a46e09ac5c40cf1",
|
|
77
78
|
"src/client/tool-launcher.ts": "9699c9498c905e395bbe89e0e367721ab253b5ec1e318a8093ce6a88c2ff5c29",
|
|
78
79
|
"src/client/tool-sharing.ts": "011212825dbbffe18c8f15aca721c02938ab6273fb5607b072a1e7b8b1853640",
|
|
79
80
|
"src/client/tool-shortcuts.ts": "4422d29ba770af6acef18e66c6be05a9bc021f7323c7ca28bbe7668f26d4adb8",
|
|
@@ -83,5 +84,5 @@
|
|
|
83
84
|
"src/client/workbench-navigation.ts": "3b229752a8ce4a45eba7aeff040eb33001413190141f1e9b8e5f38246a1761e2",
|
|
84
85
|
"src/client/workbench-search-panel.css": "6978c03db4f17411e9064242b0ff786a520ee8cf58fe8a9d0ea42872ba3737f0"
|
|
85
86
|
},
|
|
86
|
-
"recordedAt": "2026-11-
|
|
87
|
+
"recordedAt": "2026-11-20T08:26:24.587Z"
|
|
87
88
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{c as t,l as n,n as r,r as i,t as a}from"./index-Cs_T0IFR.js";var o=e(n(),1);async function s(e,t){let[{StreamLanguage:n},r]=await Promise.all([i(()=>import(`./dist-J6XWqRpB.js`).then(e=>e.d),__vite__mapDeps([0,1,2,3,4])),e()]),a=r[t]??r.default??r;return n.define(a)}var c={cpp:()=>i(()=>import(`./dist-Dc1MBGAG.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,1,0,2,3,6])),cc:()=>i(()=>import(`./dist-Dc1MBGAG.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,1,0,2,3,6])),cxx:()=>i(()=>import(`./dist-Dc1MBGAG.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,1,0,2,3,6])),hpp:()=>i(()=>import(`./dist-Dc1MBGAG.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,1,0,2,3,6])),hh:()=>i(()=>import(`./dist-Dc1MBGAG.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,1,0,2,3,6])),hxx:()=>i(()=>import(`./dist-Dc1MBGAG.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,1,0,2,3,6])),c:()=>i(()=>import(`./dist-Dc1MBGAG.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,1,0,2,3,6])),h:()=>i(()=>import(`./dist-Dc1MBGAG.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,1,0,2,3,6])),cu:()=>i(()=>import(`./dist-Dc1MBGAG.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,1,0,2,3,6])),cuh:()=>i(()=>import(`./dist-Dc1MBGAG.js`).then(e=>e.cpp()),__vite__mapDeps([5,4,1,0,2,3,6])),js:()=>i(()=>import(`./dist-Cx00EZKR.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,2,3,4,0,6,8])),jsx:()=>i(()=>import(`./dist-Cx00EZKR.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([7,1,2,3,4,0,6,8])),mjs:()=>i(()=>import(`./dist-Cx00EZKR.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,2,3,4,0,6,8])),cjs:()=>i(()=>import(`./dist-Cx00EZKR.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,2,3,4,0,6,8])),ts:()=>i(()=>import(`./dist-Cx00EZKR.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,2,3,4,0,6,8])),tsx:()=>i(()=>import(`./dist-Cx00EZKR.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0,jsx:!0})),__vite__mapDeps([7,1,2,3,4,0,6,8])),mts:()=>i(()=>import(`./dist-Cx00EZKR.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,2,3,4,0,6,8])),cts:()=>i(()=>import(`./dist-Cx00EZKR.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,2,3,4,0,6,8])),py:()=>i(()=>import(`./dist-Dds-qLxY.js`).then(e=>e.python()),__vite__mapDeps([9,4,1,0,2,3,6,8])),pyi:()=>i(()=>import(`./dist-Dds-qLxY.js`).then(e=>e.python()),__vite__mapDeps([9,4,1,0,2,3,6,8])),java:()=>i(()=>import(`./dist-AW5lyI3I.js`).then(e=>e.java()),__vite__mapDeps([10,4,1,0,2,3,6])),php:()=>i(()=>import(`./dist-BGxkyh6e.js`).then(e=>e.php()),__vite__mapDeps([11,4,1,0,2,3,6,12,13,7,8])),sql:()=>i(()=>import(`./dist-Dvb0SqcK.js`).then(e=>e.sql()),__vite__mapDeps([14,4,1,0,2,3,6,8])),yaml:()=>i(()=>import(`./dist-D71y2EI1.js`).then(e=>e.yaml()),__vite__mapDeps([15,4,1,0,2,3,6])),yml:()=>i(()=>import(`./dist-D71y2EI1.js`).then(e=>e.yaml()),__vite__mapDeps([15,4,1,0,2,3,6])),xml:()=>i(()=>import(`./dist-DeD9copn.js`).then(e=>e.xml()),__vite__mapDeps([16,2,1,3,4,0,6])),json:()=>i(()=>import(`./dist-QzbOCAU6.js`).then(e=>e.json()),__vite__mapDeps([17,4,1,0,2,3,6])),jsonc:()=>i(()=>import(`./dist-QzbOCAU6.js`).then(e=>e.json()),__vite__mapDeps([17,4,1,0,2,3,6])),json5:()=>i(()=>import(`./dist-QzbOCAU6.js`).then(e=>e.json()),__vite__mapDeps([17,4,1,0,2,3,6])),html:()=>i(()=>import(`./dist-CKF2Jksy.js`).then(e=>e.html()),__vite__mapDeps([12,2,1,3,4,0,6,13,7,8])),htm:()=>i(()=>import(`./dist-CKF2Jksy.js`).then(e=>e.html()),__vite__mapDeps([12,2,1,3,4,0,6,13,7,8])),vue:()=>i(()=>import(`./dist-CKF2Jksy.js`).then(e=>e.html()),__vite__mapDeps([12,2,1,3,4,0,6,13,7,8])),svelte:()=>i(()=>import(`./dist-CKF2Jksy.js`).then(e=>e.html()),__vite__mapDeps([12,2,1,3,4,0,6,13,7,8])),css:()=>i(()=>import(`./dist-BV64A9Ji.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([13,1,4,0,2,3,6])),md:()=>i(()=>import(`./dist-DuvGReu-.js`).then(e=>e.markdown()),__vite__mapDeps([18,2,1,3,4,0,8,12,6,13,7])),markdown:()=>i(()=>import(`./dist-DuvGReu-.js`).then(e=>e.markdown()),__vite__mapDeps([18,2,1,3,4,0,8,12,6,13,7])),mdx:()=>i(()=>import(`./dist-DuvGReu-.js`).then(e=>e.markdown()),__vite__mapDeps([18,2,1,3,4,0,8,12,6,13,7])),rs:()=>i(()=>import(`./dist-BRVQKlcp.js`).then(e=>e.rust()),__vite__mapDeps([19,4,1,0,2,3,6])),go:()=>i(()=>import(`./dist-BJxfd7yb.js`).then(e=>e.go()),__vite__mapDeps([20,4,1,0,2,3,6,8])),sh:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>s(()=>i(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>s(()=>i(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>s(()=>i(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>s(()=>i(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>s(()=>i(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>s(()=>i(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>s(()=>i(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>s(()=>i(()=>import(`./diff-ChtP43wD.js`),[]),`diff`)},l={cpp:`C++`,cc:`C++`,cxx:`C++`,hpp:`C++`,hh:`C++`,hxx:`C++`,cu:`CUDA C++`,cuh:`CUDA C++`,c:`C`,h:`C/C++ Header`,js:`JavaScript`,jsx:`JSX`,mjs:`JavaScript`,cjs:`JavaScript`,ts:`TypeScript`,tsx:`TSX`,mts:`TypeScript`,cts:`TypeScript`,py:`Python`,pyi:`Python Stub`,java:`Java`,php:`PHP`,sql:`SQL`,yaml:`YAML`,yml:`YAML`,xml:`XML`,json:`JSON`,jsonc:`JSON with Comments`,json5:`JSON5`,css:`CSS`,md:`Markdown`,markdown:`Markdown`,mdx:`MDX`,rs:`Rust`,go:`Go`,html:`HTML`,htm:`HTML`,vue:`Vue`,svelte:`Svelte`,sh:`Shell`,bash:`Bash`,zsh:`Zsh`,fish:`Fish`,ps1:`PowerShell`,psm1:`PowerShell`,rb:`Ruby`,swift:`Swift`,toml:`TOML`,ini:`INI`,cfg:`Config`,conf:`Config`,properties:`Properties`,dockerfile:`Dockerfile`,diff:`Diff`,patch:`Patch`};function u(e){return c[e.toLowerCase()]}function d(e){return l[e.toLowerCase()]}var f=t(),p=262144,m=131072;function h(e){return e.split(`.`).pop()?.toLowerCase()??``}function g(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function _(e,t){return e.HighlightStyle.define([{tag:t.tags.keyword,color:g(`--cm-keyword`)},{tag:t.tags.string,color:g(`--cm-string`)},{tag:t.tags.number,color:g(`--cm-number`)},{tag:t.tags.comment,color:g(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:g(`--cm-function`)},{tag:t.tags.typeName,color:g(`--cm-type`)},{tag:t.tags.className,color:g(`--cm-type`)},{tag:t.tags.propertyName,color:g(`--cm-property`)},{tag:t.tags.operator,color:g(`--cm-operator`)},{tag:t.tags.variableName,color:g(`--cm-variable`)}])}function v({path:e,value:t,onChange:n,jumpToLine:s,onSave:c,workspaceId:l,blame:g,onPosition:v,readOnly:y=!1}){let b=(0,o.useRef)(null),x=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(null),T=(0,o.useRef)(null),E=(0,o.useRef)(null),D=(0,o.useRef)(null),O=(0,o.useRef)(n),k=(0,o.useRef)(c);O.current=n,k.current=c;let[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(!1),[P,F]=(0,o.useState)(`0,0`),[I,L]=(0,o.useState)(0);(0,o.useEffect)(()=>{let n=!1,a,o,s,c,l;return(async()=>{try{let d=h(e),f=u(d),[m,g,v,A,M,P,I,R]=await Promise.all([i(()=>import(`./dist-D978o95T.js`).then(e=>e.S),__vite__mapDeps([2,1])),i(()=>import(`./dist-B3-a6uF0.js`).then(e=>e.s),__vite__mapDeps([3,1,2])),i(()=>import(`./dist-CX_Hm4GS.js`),__vite__mapDeps([21,2,1,3,4,0])),i(()=>import(`./dist-scBkrwv-.js`),__vite__mapDeps([22,2,1,3])),i(()=>import(`./dist-J6XWqRpB.js`).then(e=>e.d),__vite__mapDeps([0,1,2,3,4])),i(()=>import(`./dist-Cus6_oaF.js`).then(e=>e.n),__vite__mapDeps([4,1])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),r().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null))]);if(n||!b.current)return;c=M,l=P,C.current=m.Annotation.define(),w.current=m.Transaction.addToHistory;let z=t.length<=p&&I!==null;o=new m.Compartment;let B=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),v.history(),g.keymap.of([v.indentWithTab,...v.defaultKeymap,...v.historyKeymap,...A.searchKeymap,{key:`Mod-s`,run:()=>(k.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(C.current&&e.transactions.some(e=>e.annotation(C.current)===!0))&&O.current(e.state.doc.toString()),e.selectionSet&&F(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(y&&B.push(m.EditorState.readOnly.of(!0),g.EditorView.editable.of(!1)),R&&!y&&(s=new m.Compartment,B.splice(1,0,s.of([])),B.push(R.base)),I)try{B.push(I)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),z=!1}if(z&&o&&c&&l)try{B.push(o.of(c.syntaxHighlighting(_(c,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),z=!1}if(a=new g.EditorView({state:m.EditorState.create({doc:t,extensions:B}),parent:b.current}),n){a.destroy();return}x.current=a,j(z),N(!0),T.current=R,E.current=s??null,D.current=null,L(e=>e+1);let V=new MutationObserver(()=>{let e=x.current;if(e&&z&&o&&c&&l)try{e.dispatch({effects:o.reconfigure(c.syntaxHighlighting(_(c,l)))})}catch{}});S.current=V,V.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),n||N(!0)}})(),()=>{n=!0,S.current?.disconnect(),S.current=null,a?.destroy(),x.current=null,N(!1),b.current&&(b.current.textContent=``)}},[e,y]),(0,o.useEffect)(()=>{let e=x.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:C.current?C.current.of(!0):void 0})},[t]),(0,o.useEffect)(()=>{let e=x.current;if(!e||!s)return;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines)),n=Math.min(t.to,t.from+(s.column??1)-1);e.dispatch({selection:{anchor:t.to,head:n},scrollIntoView:!0}),e.focus()},[s,M]);let R=!!(g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l);(0,o.useEffect)(()=>{let t=x.current,n=T.current,r=E.current;if(!t||!n||!r)return;let i=g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l?g.response:null,o=i?a(i):null;D.current!==o&&(D.current=o,t.dispatch({effects:[n.setBlame.of(o),r.reconfigure(o?n.gutter:[])]}))},[g?.state,g?.response,g?.path,g?.workspaceId,e,l,I]);let z=x.current?.state.doc.toString()??t,B=z.length<=m?z:z.slice(0,m),V=h(e),H=d(V),U=x.current?.state,W=U?.selection.main.head,G=W===void 0?void 0:U?.doc.lineAt(W),K=G?.number,q=W!==void 0&&G?W-G.from+1:void 0;return(0,o.useEffect)(()=>{M&&K!==void 0&&q!==void 0&&v?.({line:K,column:q,language:A&&H||`纯文本`,highlight:A?V:`plain`})},[M,K,q,A,H,V,v]),(0,o.useEffect)(()=>()=>v?.(),[v]),(0,f.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":B,"data-file-content-truncated":z.length>m?`1`:`0`,"data-file-selection":P,"data-file-editor-ready":M?`1`:`0`,"data-file-blame-gutter":R?`1`:void 0,onMouseDown:()=>x.current?.focus(),children:[(0,f.jsx)(`div`,{className:`file-cm`,ref:b,"aria-label":`${y?`查看`:`编辑`} ${e}`}),(!M||!v)&&(0,f.jsxs)(`div`,{className:`file-editor-status`,children:[!M&&(0,f.jsx)(`span`,{"data-file-editor-loading":`1`,children:`正在加载编辑器…`}),M&&W!==void 0&&G&&(0,f.jsxs)(`span`,{children:[`第 `,G.number,` 行,第 `,W-G.from+1,` 列`]}),M&&!A&&(0,f.jsx)(`span`,{"data-file-highlight-status":`plain`,children:`纯文本`}),M&&A&&H&&(0,f.jsx)(`span`,{"data-file-highlight-status":V,children:H})]})]})}export{v as CodeMirrorEditor,u as t,_ as themeHighlightStyle};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-ZAR1Tu2c.js","assets/rolldown-runtime-XKyaHtl9.js","assets/dist-i79xiXVk.js","assets/dist-D978o95T.js","assets/dist-DlPa5gNa.js","assets/dist-DRBIy9A1.js","assets/dist-BlRuQIg1.js","assets/dist-HXD8sSA4.js","assets/dist-DjI7p99D.js","assets/dist-CZ4PyxQu.js","assets/dist-DGBjhKI9.js","assets/dist-LbeLCeoq.js","assets/dist-D8HpMxmZ.js","assets/dist-Dcww9FSw.js","assets/dist-D5u1uPmZ.js","assets/dist-CxmJXjJI.js","assets/dist-ONdtnupI.js","assets/dist-CQncCwUc.js","assets/dist-3qQVP6l8.js","assets/dist-BvjUKkwy.js","assets/dist-YqmXusLA.js","assets/dist-DxPJ1PN-.js","assets/dist-CfTFp0AF.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{c as t,l as n,n as r,r as i,t as a}from"./index-DW2nd-Cf.js";var o=e(n(),1);async function s(e,t){let[{StreamLanguage:n},r]=await Promise.all([i(()=>import(`./dist-ZAR1Tu2c.js`).then(e=>e.d),__vite__mapDeps([0,1,2,3,4])),e()]),a=r[t]??r.default??r;return n.define(a)}var c={cpp:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),cc:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),cxx:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),hpp:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),hh:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),hxx:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),c:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),h:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),cu:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),cuh:()=>i(()=>import(`./dist-DRBIy9A1.js`).then(e=>e.cpp()),__vite__mapDeps([5,6,2,1,0,3,4])),js:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,6,2,0,3,4,8])),jsx:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({jsx:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),mjs:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,6,2,0,3,4,8])),cjs:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([7,1,6,2,0,3,4,8])),ts:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),tsx:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0,jsx:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),mts:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),cts:()=>i(()=>import(`./dist-HXD8sSA4.js`).then(e=>e.t).then(e=>e.javascript({typescript:!0})),__vite__mapDeps([7,1,6,2,0,3,4,8])),py:()=>i(()=>import(`./dist-CZ4PyxQu.js`).then(e=>e.python()),__vite__mapDeps([9,6,2,1,0,3,4,8])),pyi:()=>i(()=>import(`./dist-CZ4PyxQu.js`).then(e=>e.python()),__vite__mapDeps([9,6,2,1,0,3,4,8])),java:()=>i(()=>import(`./dist-DGBjhKI9.js`).then(e=>e.java()),__vite__mapDeps([10,6,2,1,0,3,4])),php:()=>i(()=>import(`./dist-LbeLCeoq.js`).then(e=>e.php()),__vite__mapDeps([11,6,2,1,12,13,0,3,4,7,8])),sql:()=>i(()=>import(`./dist-D5u1uPmZ.js`).then(e=>e.sql()),__vite__mapDeps([14,0,1,2,3,4,6,8])),yaml:()=>i(()=>import(`./dist-CxmJXjJI.js`).then(e=>e.yaml()),__vite__mapDeps([15,6,2,1,0,3,4])),yml:()=>i(()=>import(`./dist-CxmJXjJI.js`).then(e=>e.yaml()),__vite__mapDeps([15,6,2,1,0,3,4])),xml:()=>i(()=>import(`./dist-ONdtnupI.js`).then(e=>e.xml()),__vite__mapDeps([16,6,2,1,0,3,4])),json:()=>i(()=>import(`./dist-CQncCwUc.js`).then(e=>e.json()),__vite__mapDeps([17,6,2,1,0,3,4])),jsonc:()=>i(()=>import(`./dist-CQncCwUc.js`).then(e=>e.json()),__vite__mapDeps([17,6,2,1,0,3,4])),json5:()=>i(()=>import(`./dist-CQncCwUc.js`).then(e=>e.json()),__vite__mapDeps([17,6,2,1,0,3,4])),html:()=>i(()=>import(`./dist-D8HpMxmZ.js`).then(e=>e.html()),__vite__mapDeps([12,6,2,1,13,0,3,4,7,8])),htm:()=>i(()=>import(`./dist-D8HpMxmZ.js`).then(e=>e.html()),__vite__mapDeps([12,6,2,1,13,0,3,4,7,8])),vue:()=>i(()=>import(`./dist-D8HpMxmZ.js`).then(e=>e.html()),__vite__mapDeps([12,6,2,1,13,0,3,4,7,8])),svelte:()=>i(()=>import(`./dist-D8HpMxmZ.js`).then(e=>e.html()),__vite__mapDeps([12,6,2,1,13,0,3,4,7,8])),css:()=>i(()=>import(`./dist-Dcww9FSw.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([13,1,6,2,0,3,4])),md:()=>i(()=>import(`./dist-3qQVP6l8.js`).then(e=>e.markdown()),__vite__mapDeps([18,3,1,4,0,2,8,12,6,13,7])),markdown:()=>i(()=>import(`./dist-3qQVP6l8.js`).then(e=>e.markdown()),__vite__mapDeps([18,3,1,4,0,2,8,12,6,13,7])),mdx:()=>i(()=>import(`./dist-3qQVP6l8.js`).then(e=>e.markdown()),__vite__mapDeps([18,3,1,4,0,2,8,12,6,13,7])),rs:()=>i(()=>import(`./dist-BvjUKkwy.js`).then(e=>e.rust()),__vite__mapDeps([19,6,2,1,0,3,4])),go:()=>i(()=>import(`./dist-YqmXusLA.js`).then(e=>e.go()),__vite__mapDeps([20,6,2,1,0,3,4,8])),sh:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),bash:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),zsh:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),fish:()=>s(()=>i(()=>import(`./shell-DwuoZtxw.js`),[]),`shell`),ps1:()=>s(()=>i(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),psm1:()=>s(()=>i(()=>import(`./powershell-D8WpQPaX.js`),[]),`powershell`),rb:()=>s(()=>i(()=>import(`./ruby-ChfNwlCY.js`),[]),`ruby`),swift:()=>s(()=>i(()=>import(`./swift-DKB6_1j6.js`),[]),`swift`),toml:()=>s(()=>i(()=>import(`./toml-BPTmHmyx.js`),[]),`toml`),ini:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),cfg:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),conf:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),properties:()=>s(()=>i(()=>import(`./properties-C357ku5U.js`),[]),`properties`),dockerfile:()=>s(()=>i(()=>import(`./dockerfile-BDePf5PZ.js`),[]),`dockerfile`),diff:()=>s(()=>i(()=>import(`./diff-ChtP43wD.js`),[]),`diff`),patch:()=>s(()=>i(()=>import(`./diff-ChtP43wD.js`),[]),`diff`)},l={cpp:`C++`,cc:`C++`,cxx:`C++`,hpp:`C++`,hh:`C++`,hxx:`C++`,cu:`CUDA C++`,cuh:`CUDA C++`,c:`C`,h:`C/C++ Header`,js:`JavaScript`,jsx:`JSX`,mjs:`JavaScript`,cjs:`JavaScript`,ts:`TypeScript`,tsx:`TSX`,mts:`TypeScript`,cts:`TypeScript`,py:`Python`,pyi:`Python Stub`,java:`Java`,php:`PHP`,sql:`SQL`,yaml:`YAML`,yml:`YAML`,xml:`XML`,json:`JSON`,jsonc:`JSON with Comments`,json5:`JSON5`,css:`CSS`,md:`Markdown`,markdown:`Markdown`,mdx:`MDX`,rs:`Rust`,go:`Go`,html:`HTML`,htm:`HTML`,vue:`Vue`,svelte:`Svelte`,sh:`Shell`,bash:`Bash`,zsh:`Zsh`,fish:`Fish`,ps1:`PowerShell`,psm1:`PowerShell`,rb:`Ruby`,swift:`Swift`,toml:`TOML`,ini:`INI`,cfg:`Config`,conf:`Config`,properties:`Properties`,dockerfile:`Dockerfile`,diff:`Diff`,patch:`Patch`};function u(e){return c[e.toLowerCase()]}function d(e){return l[e.toLowerCase()]}var f=t(),p=262144,m=131072;function h(e){return e.split(`.`).pop()?.toLowerCase()??``}function g(e){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()}function _(e,t){return e.HighlightStyle.define([{tag:t.tags.keyword,color:g(`--cm-keyword`)},{tag:t.tags.string,color:g(`--cm-string`)},{tag:t.tags.number,color:g(`--cm-number`)},{tag:t.tags.comment,color:g(`--cm-comment`),fontStyle:`italic`},{tag:t.tags.function(t.tags.variableName),color:g(`--cm-function`)},{tag:t.tags.typeName,color:g(`--cm-type`)},{tag:t.tags.className,color:g(`--cm-type`)},{tag:t.tags.propertyName,color:g(`--cm-property`)},{tag:t.tags.operator,color:g(`--cm-operator`)},{tag:t.tags.variableName,color:g(`--cm-variable`)}])}function v({path:e,value:t,onChange:n,jumpToLine:s,onSave:c,workspaceId:l,blame:g,onPosition:v,readOnly:y=!1}){let b=(0,o.useRef)(null),x=(0,o.useRef)(null),S=(0,o.useRef)(null),C=(0,o.useRef)(null),w=(0,o.useRef)(null),T=(0,o.useRef)(null),E=(0,o.useRef)(null),D=(0,o.useRef)(null),O=(0,o.useRef)(n),k=(0,o.useRef)(c);O.current=n,k.current=c;let[A,j]=(0,o.useState)(!1),[M,N]=(0,o.useState)(!1),[P,F]=(0,o.useState)(`0,0`),[I,L]=(0,o.useState)(0);(0,o.useEffect)(()=>{let n=!1,a,o,s,c,l;return(async()=>{try{let d=h(e),f=u(d),[m,g,v,A,M,P,I,R]=await Promise.all([i(()=>import(`./dist-D978o95T.js`).then(e=>e.S),__vite__mapDeps([3,1])),i(()=>import(`./dist-DlPa5gNa.js`).then(e=>e.s),__vite__mapDeps([4,1,3])),i(()=>import(`./dist-DxPJ1PN-.js`),__vite__mapDeps([21,3,1,4,0,2])),i(()=>import(`./dist-CfTFp0AF.js`),__vite__mapDeps([22,4,1,3])),i(()=>import(`./dist-ZAR1Tu2c.js`).then(e=>e.d),__vite__mapDeps([0,1,2,3,4])),i(()=>import(`./dist-i79xiXVk.js`).then(e=>e.n),__vite__mapDeps([2,1])),f?f().catch(e=>(console.warn(`[CodeMirror] Failed to load language for .${d}:`,e),null)):Promise.resolve(null),r().catch(e=>(console.warn(`[CodeMirror] Failed to build the blame extension:`,e),null))]);if(n||!b.current)return;c=M,l=P,C.current=m.Annotation.define(),w.current=m.Transaction.addToHistory;let z=t.length<=p&&I!==null;o=new m.Compartment;let B=[g.lineNumbers(),g.highlightActiveLine(),g.drawSelection(),v.history(),g.keymap.of([v.indentWithTab,...v.defaultKeymap,...v.historyKeymap,...A.searchKeymap,{key:`Mod-s`,run:()=>(k.current(),!0)}]),g.EditorView.updateListener.of(e=>{e.docChanged&&!(C.current&&e.transactions.some(e=>e.annotation(C.current)===!0))&&O.current(e.state.doc.toString()),e.selectionSet&&F(`${e.state.selection.main.from},${e.state.selection.main.to}`)}),g.EditorView.domEventHandlers({mousedown:(e,t)=>(t.focus(),!1)})];if(y&&B.push(m.EditorState.readOnly.of(!0),g.EditorView.editable.of(!1)),R&&!y&&(s=new m.Compartment,B.splice(1,0,s.of([])),B.push(R.base)),I)try{B.push(I)}catch(e){console.warn(`[CodeMirror] Failed to apply language extension for .${d}:`,e),z=!1}if(z&&o&&c&&l)try{B.push(o.of(c.syntaxHighlighting(_(c,l))))}catch(e){console.warn(`[CodeMirror] Failed to attach syntaxHighlighting for .${d}:`,e),z=!1}if(a=new g.EditorView({state:m.EditorState.create({doc:t,extensions:B}),parent:b.current}),n){a.destroy();return}x.current=a,j(z),N(!0),T.current=R,E.current=s??null,D.current=null,L(e=>e+1);let V=new MutationObserver(()=>{let e=x.current;if(e&&z&&o&&c&&l)try{e.dispatch({effects:o.reconfigure(c.syntaxHighlighting(_(c,l)))})}catch{}});S.current=V,V.observe(document.documentElement,{attributes:!0,attributeFilter:[`data-theme`]})}catch(e){console.error(`[CodeMirror] Fatal editor initialization error:`,e),n||N(!0)}})(),()=>{n=!0,S.current?.disconnect(),S.current=null,a?.destroy(),x.current=null,N(!1),b.current&&(b.current.textContent=``)}},[e,y]),(0,o.useEffect)(()=>{let e=x.current;if(!e)return;let n=e.state.doc.toString();n!==t&&e.dispatch({changes:{from:0,to:n.length,insert:t},annotations:C.current?C.current.of(!0):void 0})},[t]),(0,o.useEffect)(()=>{let e=x.current;if(!e||!s)return;let t=e.state.doc.line(Math.min(Math.max(1,s.line),e.state.doc.lines)),n=Math.min(t.to,t.from+(s.column??1)-1);e.dispatch({selection:{anchor:t.to,head:n},scrollIntoView:!0}),e.focus()},[s,M]);let R=!!(g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l);(0,o.useEffect)(()=>{let t=x.current,n=T.current,r=E.current;if(!t||!n||!r)return;let i=g&&g.state===`ready`&&g.response&&g.path===e&&g.workspaceId===l?g.response:null,o=i?a(i):null;D.current!==o&&(D.current=o,t.dispatch({effects:[n.setBlame.of(o),r.reconfigure(o?n.gutter:[])]}))},[g?.state,g?.response,g?.path,g?.workspaceId,e,l,I]);let z=x.current?.state.doc.toString()??t,B=z.length<=m?z:z.slice(0,m),V=h(e),H=d(V),U=x.current?.state,W=U?.selection.main.head,G=W===void 0?void 0:U?.doc.lineAt(W),K=G?.number,q=W!==void 0&&G?W-G.from+1:void 0;return(0,o.useEffect)(()=>{M&&K!==void 0&&q!==void 0&&v?.({line:K,column:q,language:A&&H||`纯文本`,highlight:A?V:`plain`})},[M,K,q,A,H,V,v]),(0,o.useEffect)(()=>()=>v?.(),[v]),(0,f.jsxs)(`div`,{className:`file-cm-wrap`,"data-file-text":e,"data-file-content":B,"data-file-content-truncated":z.length>m?`1`:`0`,"data-file-selection":P,"data-file-editor-ready":M?`1`:`0`,"data-file-blame-gutter":R?`1`:void 0,onMouseDown:()=>x.current?.focus(),children:[(0,f.jsx)(`div`,{className:`file-cm`,ref:b,"aria-label":`${y?`查看`:`编辑`} ${e}`}),(!M||!v)&&(0,f.jsxs)(`div`,{className:`file-editor-status`,children:[!M&&(0,f.jsx)(`span`,{"data-file-editor-loading":`1`,children:`正在加载编辑器…`}),M&&W!==void 0&&G&&(0,f.jsxs)(`span`,{children:[`第 `,G.number,` 行,第 `,W-G.from+1,` 列`]}),M&&!A&&(0,f.jsx)(`span`,{"data-file-highlight-status":`plain`,children:`纯文本`}),M&&A&&H&&(0,f.jsx)(`span`,{"data-file-highlight-status":V,children:H})]})]})}export{v as CodeMirrorEditor,u as t,_ as themeHighlightStyle};
|