@evandu/super-pi 0.1.258 → 0.1.259
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 +40 -0
- package/agents/super-pi-managed-model/index.ts +9 -0
- package/bin/npm-prefix.js +1 -1
- package/bin/super-pi.js +4 -3
- package/desktop/icon.png +0 -0
- package/desktop/launch.cjs +14 -0
- package/desktop/main.cjs +96 -0
- package/desktop/preload.cjs +9 -0
- package/dist/client/.super-pi-client-sources.json +33 -28
- package/dist/client/assets/CodeMirrorEditor-mi9rGUce.js +2 -0
- package/dist/client/assets/{GitDiffEditor-BOtWl74Z.js → GitDiffEditor-FQBfGxOY.js} +3 -3
- package/dist/client/assets/index-Cn7hdrDw.js +350 -0
- package/dist/client/assets/{index-JchFQmlF.css → index-UfzqdECL.css} +1 -1
- package/dist/client/index.html +2 -2
- package/dist/server/browser-access.d.ts +34 -0
- package/dist/server/browser-access.js +89 -0
- package/dist/server/command-handler.d.ts +1 -1
- package/dist/server/command-handler.js +3 -3
- package/dist/server/http-server.js +90 -36
- package/dist/server/index.js +9 -0
- package/dist/server/managed-http-tunnel.d.ts +6 -0
- package/dist/server/managed-http-tunnel.js +85 -0
- package/dist/server/managed-http.d.ts +4 -0
- package/dist/server/managed-http.js +85 -0
- package/dist/server/managed-model-adapter.d.ts +17 -0
- package/dist/server/managed-model-adapter.js +75 -0
- package/dist/server/managed-model-gateway.d.ts +49 -0
- package/dist/server/managed-model-gateway.js +73 -0
- package/dist/server/managed-servers.d.ts +55 -0
- package/dist/server/managed-servers.js +392 -0
- package/dist/server/managed-ssh.d.ts +26 -0
- package/dist/server/managed-ssh.js +73 -0
- package/dist/server/manager-vault.d.ts +11 -0
- package/dist/server/manager-vault.js +67 -0
- package/dist/server/provider-proxy.js +2 -0
- package/dist/server/remote-bootstrap.d.ts +17 -0
- package/dist/server/remote-bootstrap.js +119 -0
- package/dist/server/server-context.d.ts +2 -0
- package/dist/server/terminal.d.ts +2 -2
- package/dist/server/terminal.js +6 -6
- package/dist/server/update.d.ts +1 -0
- package/dist/server/update.js +13 -2
- package/dist/server/ws-server.d.ts +5 -0
- package/dist/server/ws-server.js +29 -4
- package/dist/shared/managed-servers.d.ts +36 -0
- package/dist/shared/managed-servers.js +1 -0
- package/package.json +19 -4
- package/scripts/pack-server.mjs +44 -0
- package/dist/client/assets/CodeMirrorEditor-CyVU-MC_.js +0 -2
- package/dist/client/assets/index-Ba79LA0t.js +0 -349
package/README.md
CHANGED
|
@@ -8,6 +8,46 @@ It provides a rich Web UI featuring multi-workspace management, interactive agen
|
|
|
8
8
|
|
|
9
9
|
## Installation & Usage
|
|
10
10
|
|
|
11
|
+
### Desktop and multiple servers
|
|
12
|
+
|
|
13
|
+
The full package includes the desktop app, local SSH manager, and the complete browser UI:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @evandu/super-pi
|
|
17
|
+
super_pi desktop
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The first desktop launch downloads the Electron runtime if it is not cached. Closing the window
|
|
21
|
+
keeps the app in the system tray. Settings → Desktop and background provides optional startup
|
|
22
|
+
at sign-in. Browser access remains available; both interfaces use the same local service.
|
|
23
|
+
|
|
24
|
+
In Settings → Server connections → SSH managed, name a server and enter its SSH address, port,
|
|
25
|
+
user, authentication, and desired Super Pi service port. Confirm the host fingerprint, then deploy.
|
|
26
|
+
The manager installs the server-only package in that user's home directory, installs a private
|
|
27
|
+
Node.js runtime if needed, and connects through SSH. No extra public service port is required.
|
|
28
|
+
Automatic remote installation currently targets Linux/macOS on x64/arm64.
|
|
29
|
+
|
|
30
|
+
Configure providers and OAuth logins once in the local entry. Managed servers use a model-only
|
|
31
|
+
channel through SSH; upstream API keys and OAuth refresh tokens stay local. The manager must
|
|
32
|
+
remain online for these model calls. SSH connection, deployment, service health, and model-channel
|
|
33
|
+
status are visible separately. Upgrade managed servers by redeploying from this panel.
|
|
34
|
+
|
|
35
|
+
For independently administered servers, the direct-connection tab supports an HTTP(S) address
|
|
36
|
+
and an owner-issued connection key. Direct connections are stored in that browser; SSH profiles
|
|
37
|
+
are stored by the local manager. The sidebar groups resources by server name and provides a server
|
|
38
|
+
filter alongside workspace, repository, and activity filters. Selecting a settings target does not
|
|
39
|
+
change the active conversation or its file/Git/terminal target.
|
|
40
|
+
|
|
41
|
+
Remote machines can also install the service-only package manually:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install -g @evandu/super-pi-server
|
|
45
|
+
super-pi-server start --no-browser
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This package includes the web interface and execution features, without Electron or the SSH
|
|
49
|
+
manager. Existing `super_pi start`, browser access, and Pi-extension usage remain available.
|
|
50
|
+
|
|
11
51
|
### Method 1: Install as a Pi Plugin (Recommended)
|
|
12
52
|
|
|
13
53
|
Super Pi is designed to work seamlessly as an official/community extension for Pi:
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { managedProviderDefinitions, readManagedModelConfig } from "../../dist/server/managed-model-adapter.js";
|
|
3
|
+
|
|
4
|
+
/** Explicitly loaded by managed Pi launchers, including isolated no-tools completions. */
|
|
5
|
+
export default async function managedModels(pi: ExtensionAPI) {
|
|
6
|
+
const config = await readManagedModelConfig();
|
|
7
|
+
if (!config) return;
|
|
8
|
+
for (const definition of await managedProviderDefinitions(config)) pi.registerProvider(definition.provider);
|
|
9
|
+
}
|
package/bin/npm-prefix.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Infer npm's global prefix from this package's installation root, not its node_modules parent. */
|
|
2
2
|
export function npmInstallPrefix(rootDir, platform = process.platform) {
|
|
3
|
-
const match = rootDir.match(/^(.*)[\\/]node_modules[\\/]@evandu[\\/]super-pi[\\/]?$/i);
|
|
3
|
+
const match = rootDir.match(/^(.*)[\\/]node_modules[\\/]@evandu[\\/]super-pi(?:-server)?[\\/]?$/i);
|
|
4
4
|
if (!match) return undefined;
|
|
5
5
|
const parent = match[1];
|
|
6
6
|
// Unix global packages live in <prefix>/lib/node_modules; Windows omits lib.
|
package/bin/super-pi.js
CHANGED
|
@@ -77,7 +77,7 @@ async function running(port) {
|
|
|
77
77
|
}
|
|
78
78
|
async function stop(port) { try { const headers = process.env.SUPER_PI_ACCESS_TOKEN ? { authorization: `Bearer ${process.env.SUPER_PI_ACCESS_TOKEN}` } : {}; const response = await fetch(`http://127.0.0.1:${port}/api/shutdown`, { method: "POST", headers, signal: AbortSignal.timeout(3000) }); return response.ok || response.status === 202; } catch { return false; } }
|
|
79
79
|
function openBrowser(url) { const command = platform === "darwin" ? "open" : platform === "win32" ? "cmd.exe" : "xdg-open"; const args = platform === "darwin" ? [url] : platform === "win32" ? ["/c", "start", "", url] : [url]; spawn(command, args, { detached: true, stdio: "ignore", windowsHide: true }).unref(); }
|
|
80
|
-
function usage() { console.log("Usage: super-pi|super_pi <start|stop|restart|update|set|diagnose|logs|autostart> [options]"); console.log(" set port [PORT] Save the default port (omit the value to show it)"); console.log(" set host [HOST] Save the default host (omit the value to show it)"); console.log(" autostart enable|disable|status Configure startup at sign-in"); console.log(" diagnose Local runtime probe; --url URL for remote transport"); console.log(" logs [N] [--follow] Show the server log (last N lines, default 200)"); console.log(" logs --path Print the log file's path"); console.log(" logs --clear Empty the log file"); console.log(" --port PORT Server port (default: 3080)"); console.log(" --host HOST Server host (default: 0.0.0.0)"); console.log(" --no-browser Do not open a browser"); }
|
|
80
|
+
function usage() { console.log("Usage: super-pi|super_pi <desktop|start|stop|restart|update|set|diagnose|logs|autostart> [options]"); console.log(" set port [PORT] Save the default port (omit the value to show it)"); console.log(" set host [HOST] Save the default host (omit the value to show it)"); console.log(" autostart enable|disable|status Configure startup at sign-in"); console.log(" diagnose Local runtime probe; --url URL for remote transport"); console.log(" logs [N] [--follow] Show the server log (last N lines, default 200)"); console.log(" logs --path Print the log file's path"); console.log(" logs --clear Empty the log file"); console.log(" --port PORT Server port (default: 3080)"); console.log(" --host HOST Server host (default: 0.0.0.0)"); console.log(" --no-browser Do not open a browser"); }
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* WHERE THE SERVER KEEPS ITS LOG FILE.
|
|
@@ -297,7 +297,8 @@ const command = implicitStart ? "start" : raw?.toLowerCase();
|
|
|
297
297
|
const args = implicitStart ? [raw, ...rest] : rest;
|
|
298
298
|
try {
|
|
299
299
|
if (command === "help" || command === "--help" || command === "-h") { usage(); process.exit(0); }
|
|
300
|
-
if (
|
|
300
|
+
if (command === "desktop" || command === "app") { if (!existsSync(join(root, "desktop", "launch.cjs"))) throw new Error("纯服务包不包含桌面端,请在自己的电脑安装完整包 @evandu/super-pi"); await import(pathToFileURL(join(root, "desktop", "launch.cjs")).href); process.exit(process.exitCode ?? 0); }
|
|
301
|
+
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); }
|
|
301
302
|
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); }
|
|
302
303
|
if (command === "diagnose" || command === "diagnose-latency") {
|
|
303
304
|
// Local mode isolates runtime setup; --url probes this computer's route to an existing server.
|
|
@@ -340,7 +341,7 @@ try {
|
|
|
340
341
|
}
|
|
341
342
|
if (command === "set") { process.exit(await runSet(args)); }
|
|
342
343
|
if (!["start", "stop", "restart", "update"].includes(command)) throw new Error(`Unknown command: ${command}`);
|
|
343
|
-
if (command === "update") { const npm = platform === "win32" ? "npm.cmd" : "npm"; const args = prefix ? ["install", "-g", "--prefix", prefix, "--fetch-timeout=900000", "--fetch-retries=8", "--fetch-retry-maxtimeout=120000",
|
|
344
|
+
if (command === "update") { const packageName = JSON.parse(readFileSync(join(root, "package.json"), "utf8")).name === "@evandu/super-pi-server" ? "@evandu/super-pi-server" : "@evandu/super-pi"; const npm = platform === "win32" ? "npm.cmd" : "npm"; const args = prefix ? ["install", "-g", "--prefix", prefix, "--fetch-timeout=900000", "--fetch-retries=8", "--fetch-retry-maxtimeout=120000", packageName] : ["install", "-g", "--fetch-timeout=900000", "--fetch-retries=8", "--fetch-retry-maxtimeout=120000", packageName]; const child = spawn(npm, args, { stdio: "inherit", shell: platform === "win32", env: process.env }); const code = await new Promise((resolve) => child.on("close", resolve)); if (code !== 0) process.exit(code ?? 1); }
|
|
344
345
|
const value = options(args);
|
|
345
346
|
if (command === "stop") { console.log(await running(value.port) ? (await stop(value.port) ? `Shutdown requested on port ${value.port}.` : "Shutdown request failed.") : `Super Pi is not running on port ${value.port}.`); process.exit(0); }
|
|
346
347
|
if ((command === "restart" || command === "update") && await running(value.port)) { await stop(value.port); await new Promise((resolve) => setTimeout(resolve, 600)); }
|
package/desktop/icon.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawn } = require("node:child_process");
|
|
3
|
+
const { join } = require("node:path");
|
|
4
|
+
|
|
5
|
+
try {
|
|
6
|
+
const electron = require("electron");
|
|
7
|
+
const env = { ...process.env }; delete env.ELECTRON_RUN_AS_NODE;
|
|
8
|
+
const child = spawn(electron, [join(__dirname, "main.cjs"), ...process.argv.slice(2)], { detached: true, stdio: "ignore", windowsHide: true, env });
|
|
9
|
+
child.once("error", () => { console.error("无法打开 Super Pi 桌面端,请重新安装完整包 @evandu/super-pi。"); process.exitCode = 1; });
|
|
10
|
+
child.unref();
|
|
11
|
+
} catch {
|
|
12
|
+
console.error("当前安装不包含桌面运行时。请安装完整包:npm install -g @evandu/super-pi");
|
|
13
|
+
process.exitCode = 1;
|
|
14
|
+
}
|
package/desktop/main.cjs
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const { app, BrowserWindow, Tray, Menu, shell, ipcMain, dialog, nativeImage } = require("electron");
|
|
2
|
+
const { spawn, execFile } = require("node:child_process");
|
|
3
|
+
const { promisify } = require("node:util");
|
|
4
|
+
const { readFile, writeFile, mkdir, rm, access } = require("node:fs/promises");
|
|
5
|
+
const { existsSync } = require("node:fs");
|
|
6
|
+
const { homedir } = require("node:os");
|
|
7
|
+
const { join, resolve } = require("node:path");
|
|
8
|
+
|
|
9
|
+
const exec = promisify(execFile), root = resolve(__dirname, "..");
|
|
10
|
+
const dataDir = process.env.SUPER_PI_DATA_DIR || join(homedir(), ".super-pi");
|
|
11
|
+
if (process.env.SUPER_PI_DESKTOP_PROFILE) app.setPath("userData", resolve(process.env.SUPER_PI_DESKTOP_PROFILE));
|
|
12
|
+
app.setName("Super Pi");
|
|
13
|
+
if (process.platform === "win32") app.setAppUserModelId("com.evandu.super-pi");
|
|
14
|
+
let mainWindow, tray, server, origin, quitting = false, ownsServer = false;
|
|
15
|
+
|
|
16
|
+
async function config() { try { return JSON.parse(await readFile(join(dataDir, "config.json"), "utf8")); } catch { return {}; } }
|
|
17
|
+
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; } }
|
|
18
|
+
async function nodeBinary() {
|
|
19
|
+
if (process.env.SUPER_PI_NODE_BINARY) return process.env.SUPER_PI_NODE_BINARY;
|
|
20
|
+
const result = await exec(process.platform === "win32" ? "where.exe" : "which", [process.platform === "win32" ? "node.exe" : "node"], { windowsHide: true });
|
|
21
|
+
const node = result.stdout.trim().split(/\r?\n/)[0];
|
|
22
|
+
if (!node) throw new Error("找不到 Node.js,请安装 Node.js 22.19 或更高版本");
|
|
23
|
+
return node;
|
|
24
|
+
}
|
|
25
|
+
async function startManager() {
|
|
26
|
+
const saved = await config();
|
|
27
|
+
const port = Number(process.env.SUPER_PI_DESKTOP_PORT || saved.port || 3080);
|
|
28
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error("本地服务端口无效");
|
|
29
|
+
origin = `http://127.0.0.1:${port}`;
|
|
30
|
+
const running = await health(port);
|
|
31
|
+
if (running) { if (!running.manager) throw new Error(`本地 ${port} 端口正在运行不支持托管的旧服务,请先更新并重启,或选择其他本地端口`); return; }
|
|
32
|
+
const node = await nodeBinary();
|
|
33
|
+
const env = { ...process.env, SUPER_PI_HOST: "127.0.0.1", SUPER_PI_PORT: String(port), SUPER_PI_DATA_DIR: dataDir };
|
|
34
|
+
delete env.ELECTRON_RUN_AS_NODE;
|
|
35
|
+
server = spawn(node, [join(root, "dist/server/index.js"), `--host=127.0.0.1`, `--port=${port}`], { env, windowsHide: true, stdio: "ignore" });
|
|
36
|
+
ownsServer = true;
|
|
37
|
+
server.once("exit", () => {
|
|
38
|
+
if (!quitting) { ownsServer = false; void dialog.showMessageBox({ type: "error", title: "Super Pi 本地服务已停止", message: "本地管理服务意外退出", detail: `可通过 super_pi logs 查看日志。远端工具进程不会因窗口关闭而退出。` }); }
|
|
39
|
+
});
|
|
40
|
+
const deadline = Date.now() + 60_000;
|
|
41
|
+
while (Date.now() < deadline) {
|
|
42
|
+
if ((await health(port))?.manager) return;
|
|
43
|
+
if (server.exitCode !== null) throw new Error("本地服务启动失败,请运行 super_pi logs 查看原因");
|
|
44
|
+
await new Promise(resolve => setTimeout(resolve, 250));
|
|
45
|
+
}
|
|
46
|
+
throw new Error("本地服务启动超时,请检查服务日志和本地端口");
|
|
47
|
+
}
|
|
48
|
+
function trusted(event) {
|
|
49
|
+
if (!mainWindow || event.sender !== mainWindow.webContents || event.senderFrame !== mainWindow.webContents.mainFrame || !event.senderFrame.url.startsWith(`${origin}/`)) throw new Error("拒绝来自非主界面的桌面调用");
|
|
50
|
+
}
|
|
51
|
+
const startupFile = () => join(process.env.XDG_CONFIG_HOME || join(homedir(), ".config"), "autostart", "super-pi.desktop");
|
|
52
|
+
async function autoStartStatus() { return process.platform === "linux" ? existsSync(startupFile()) : app.getLoginItemSettings({ path: process.execPath, args: [__filename, "--hidden"] }).openAtLogin; }
|
|
53
|
+
async function setAutoStart(enabled) {
|
|
54
|
+
if (process.platform === "linux") {
|
|
55
|
+
if (!enabled) { await rm(startupFile(), { force: true }); return; }
|
|
56
|
+
const quote = value => `"${String(value).replace(/[\\"$`]/g, "\\$&")}"`;
|
|
57
|
+
await mkdir(resolve(startupFile(), ".."), { recursive: true });
|
|
58
|
+
await writeFile(startupFile(), `[Desktop Entry]\nType=Application\nName=Super Pi\nExec=${[process.execPath, __filename, "--hidden"].map(quote).join(" ")}\nIcon=${join(__dirname, "icon.png")}\nX-GNOME-Autostart-enabled=true\n`);
|
|
59
|
+
} else app.setLoginItemSettings({ openAtLogin: enabled, path: process.execPath, args: [__filename, "--hidden"] });
|
|
60
|
+
}
|
|
61
|
+
function show() { if (mainWindow?.isMinimized()) mainWindow.restore(); mainWindow?.show(); mainWindow?.focus(); }
|
|
62
|
+
function external(url) { try { const parsed = new URL(url); if (["http:", "https:", "mailto:"].includes(parsed.protocol) && !parsed.username && !parsed.password) void shell.openExternal(parsed.href); } catch {} }
|
|
63
|
+
async function createWindow() {
|
|
64
|
+
const image = nativeImage.createFromPath(join(__dirname, "icon.png"));
|
|
65
|
+
mainWindow = new BrowserWindow({ title: "Super Pi", width: 1500, height: 980, minWidth: 800, minHeight: 560, show: false, icon: image, webPreferences: { preload: join(__dirname, "preload.cjs"), contextIsolation: true, nodeIntegration: false, sandbox: true, webSecurity: true, backgroundThrottling: false } });
|
|
66
|
+
mainWindow.on("close", event => { if (!quitting) { event.preventDefault(); mainWindow.hide(); } });
|
|
67
|
+
mainWindow.webContents.on("will-navigate", (event, url) => { if (!url.startsWith(`${origin}/`)) { event.preventDefault(); external(url); } });
|
|
68
|
+
mainWindow.webContents.on("will-attach-webview", event => event.preventDefault());
|
|
69
|
+
mainWindow.webContents.setWindowOpenHandler(({ url }) => {
|
|
70
|
+
if (url.startsWith(`blob:${origin}/`)) return { action: "allow", overrideBrowserWindowOptions: { webPreferences: { contextIsolation: true, nodeIntegration: false, sandbox: true, webSecurity: true } } };
|
|
71
|
+
external(url); return { action: "deny" };
|
|
72
|
+
});
|
|
73
|
+
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"] }); } });
|
|
74
|
+
ipcMain.handle("super-pi-desktop:status", async event => { trusted(event); return { desktop: true, platform: process.platform, autoStart: await autoStartStatus(), origin, ownsServer }; });
|
|
75
|
+
ipcMain.handle("super-pi-desktop:autostart", async (event, enabled) => { trusted(event); await setAutoStart(enabled === true); return { autoStart: await autoStartStatus() }; });
|
|
76
|
+
ipcMain.handle("super-pi-desktop:browser", event => { trusted(event); external(origin); });
|
|
77
|
+
ipcMain.handle("super-pi-desktop:minimize", event => { trusted(event); mainWindow.hide(); });
|
|
78
|
+
const trayMenu = Menu.buildFromTemplate([{ label: "打开 Super Pi", click: show }, { label: "在浏览器打开", click: () => external(origin) }, { type: "separator" }, { label: "退出 Super Pi", click: () => app.quit() }]);
|
|
79
|
+
tray = new Tray(image.resize({ width: 24, height: 24 })); tray.setToolTip("Super Pi · 本地管理服务运行中"); tray.setContextMenu(trayMenu); tray.on("double-click", show); tray.on("click", show);
|
|
80
|
+
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: "窗口" }]));
|
|
81
|
+
await mainWindow.loadURL(origin);
|
|
82
|
+
if (!process.argv.includes("--hidden")) show();
|
|
83
|
+
}
|
|
84
|
+
if (!app.requestSingleInstanceLock()) app.quit();
|
|
85
|
+
else {
|
|
86
|
+
app.on("second-instance", show); app.on("activate", show); app.on("window-all-closed", () => {});
|
|
87
|
+
app.on("before-quit", event => {
|
|
88
|
+
if (quitting) return;
|
|
89
|
+
quitting = true;
|
|
90
|
+
if (ownsServer && server) {
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
void fetch(`${origin}/api/shutdown`, { method: "POST", signal: AbortSignal.timeout(5000) }).catch(() => {}).finally(() => { setTimeout(() => { if (server.exitCode === null) server.kill(); app.quit(); }, 1000); });
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
app.whenReady().then(startManager).then(createWindow).catch(error => { dialog.showErrorBox("Super Pi 启动失败", error.message); quitting = true; server?.kill(); app.quit(); });
|
|
96
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const { contextBridge, ipcRenderer } = require("electron");
|
|
2
|
+
if (process.isMainFrame) {
|
|
3
|
+
contextBridge.exposeInMainWorld("superPiDesktop", Object.freeze({
|
|
4
|
+
status: () => ipcRenderer.invoke("super-pi-desktop:status"),
|
|
5
|
+
setAutoStart: enabled => ipcRenderer.invoke("super-pi-desktop:autostart", Boolean(enabled)),
|
|
6
|
+
openBrowser: () => ipcRenderer.invoke("super-pi-desktop:browser"),
|
|
7
|
+
minimize: () => ipcRenderer.invoke("super-pi-desktop:minimize"),
|
|
8
|
+
}));
|
|
9
|
+
}
|
|
@@ -1,55 +1,58 @@
|
|
|
1
1
|
{
|
|
2
|
-
"hash": "
|
|
2
|
+
"hash": "e930f00594109d0258ef6265ff8333344691e274398cdc2d814de61d45d02a67",
|
|
3
3
|
"files": {
|
|
4
|
-
"src/client/App.tsx": "
|
|
5
|
-
"src/client/CacheWarmingSettings.tsx": "
|
|
4
|
+
"src/client/App.tsx": "f3dc490797eddd9dff9d20e6b4599127e136b25830f13e6e21b912b49281b3d3",
|
|
5
|
+
"src/client/CacheWarmingSettings.tsx": "cce26c4547634b76c08c681a4b9605f884d8502f554f12ff8c30cbd2fd0bd9c0",
|
|
6
6
|
"src/client/CodeMirrorEditor.tsx": "10e4444d606b731a117417b052401f27b5d14ba8d12ff518e31ee188bf66e512",
|
|
7
|
+
"src/client/DesktopPanel.tsx": "3f706563e739121e149fbb8b46a28ebadf102cc369ae0fbfc67099c9ec004644",
|
|
7
8
|
"src/client/ErrorBoundary.tsx": "d16376f9f6c7cc1fab8590c65a66438127642f7d6bb8023cec53d8a6cc9f3964",
|
|
8
|
-
"src/client/FeishuPanel.tsx": "
|
|
9
|
-
"src/client/FileMentionMenu.tsx": "
|
|
9
|
+
"src/client/FeishuPanel.tsx": "3b3257da36bf863e004a33a4c1d721db364b4449fb23f0805cb74b973a2ed2da",
|
|
10
|
+
"src/client/FileMentionMenu.tsx": "d400e7afb31008eda49d4b531eceda65a926b877177d0cffd9a8056b55161c3e",
|
|
10
11
|
"src/client/FileWorkbenchChrome.tsx": "0863c988bdc50962e3dab365e918ad6de6aee7cc2d0d4d3cce049fa3529d2b6b",
|
|
11
|
-
"src/client/FilesPanel.tsx": "
|
|
12
|
+
"src/client/FilesPanel.tsx": "2edf2b91f114f0e6aa12239a751f537bceec7f121c531bac558d7b7d1f25c432",
|
|
12
13
|
"src/client/GitDiffEditor.tsx": "192f71ddba603f0254cfa54bb40bb8be3a42d83f4a98634011f7de0d81974ba0",
|
|
13
|
-
"src/client/GitPanel.tsx": "
|
|
14
|
+
"src/client/GitPanel.tsx": "72cf7eb1df5a0b1d63eca6ca981850fc24cb8277689ac4414b9ecc88065ed09f",
|
|
14
15
|
"src/client/GroupChatPane.tsx": "fa8ba7a05bd074c2a29330d34e8ef389b47309a3253787fabfd78551c3edca66",
|
|
15
16
|
"src/client/GroupExecutionPane.tsx": "5cdba8a51b0e5daa097f08979ca4abe0b64b73649e60fdcc83d23e2b588a1ca6",
|
|
16
17
|
"src/client/HelpWindow.tsx": "dd4767f4cdced2fcdb50769eb5417ef8de722f43bbd594c9854f49fe61d15d97",
|
|
17
|
-
"src/client/KnowledgeFilePicker.tsx": "
|
|
18
|
-
"src/client/KnowledgePanel.tsx": "
|
|
18
|
+
"src/client/KnowledgeFilePicker.tsx": "82bdd65e8a624276abd5a7530ef47f86a5f9b7649b464080638055991f6278cf",
|
|
19
|
+
"src/client/KnowledgePanel.tsx": "1e64ee6f9d29456ab9470424def8269cc9b3935e3b8ba674739ce5a6cb7db56d",
|
|
20
|
+
"src/client/ManagedServersPanel.tsx": "24fc762373cf45e7ca48ab821abb784dc2b0909292a670363f6e9227b13bf80b",
|
|
19
21
|
"src/client/MarkdownSyntaxSettings.tsx": "9124d02956a4d70e2607fc584b226f8a82764b613015958fe117159d0cbf78e1",
|
|
20
22
|
"src/client/MarkdownView.tsx": "c52e63bddd2275573731166375275caf80f3327a3b4a2aff07d14aecfda00b8e",
|
|
21
23
|
"src/client/MathView.tsx": "f322a430b93594dd625b4c699994574f81d9bac72fa49b904505ca6e9e3dcb93",
|
|
22
|
-
"src/client/MemoryPanel.tsx": "
|
|
23
|
-
"src/client/MessageMedia.tsx": "
|
|
24
|
-
"src/client/NativeToolsPanel.tsx": "
|
|
25
|
-
"src/client/ProjectControlPanel.tsx": "
|
|
26
|
-
"src/client/ProviderNetworkSettings.tsx": "
|
|
24
|
+
"src/client/MemoryPanel.tsx": "bbb2fe13bbd6e72ae7a67eba4036d6bee9bb7b0509f52e1e6377575a9fe083c0",
|
|
25
|
+
"src/client/MessageMedia.tsx": "4aee39d81ba4f405f6f3cd66e0ca4c89fc9a59145c2c463743a9869d78a2df25",
|
|
26
|
+
"src/client/NativeToolsPanel.tsx": "31e544b6def3cf0b09d86c485846c48cf787c518575b34aaceb930a8a68c96b6",
|
|
27
|
+
"src/client/ProjectControlPanel.tsx": "ddd1ba2249bd070d35ad0e9bd7154b088c8374c579ff9bbcfd3b46c2d144abd7",
|
|
28
|
+
"src/client/ProviderNetworkSettings.tsx": "004ae9f24452754025cc0a33c7f3a53928fbf3f353ee684a2d1c0aff296d133f",
|
|
27
29
|
"src/client/ScheduledTasksPanel.tsx": "ed69d3617b6e4dc1a815cbf1a8d675c7c2010061b9fe2eac216813527c9cd7ab",
|
|
30
|
+
"src/client/ServerConnectionsPanel.tsx": "38cbcfc6556981f5f0370ecc1643ed79a9c95adda164e3a9d9ea4be6f2c2e41d",
|
|
28
31
|
"src/client/SidebarSection.tsx": "579c014caeddd94d21911d7b9eca4ceef930ca13c2baeb7bf5ffba59c2bb0b75",
|
|
29
|
-
"src/client/SlashCommandMenu.tsx": "
|
|
30
|
-
"src/client/SoftwareUpdate.tsx": "
|
|
32
|
+
"src/client/SlashCommandMenu.tsx": "8b2319da03b55827865fb9b6646f7a820aa26cc460cceeed9fb7edb20ad9ebb7",
|
|
33
|
+
"src/client/SoftwareUpdate.tsx": "5ded9a91f0387be96a56228bd02aaf3673821feba28cb74b3493cd1f432f49e1",
|
|
31
34
|
"src/client/Tabs.tsx": "a6a853b0752f5a96f451de502669fbb7ad4b5c141cb3f6a9cd3b9746797b5649",
|
|
32
35
|
"src/client/TavilyPanel.css": "22d4fb4a1bc95b2e0a96c49b9650a56f1a6cf7cfc3c6bc68564417d2c268e193",
|
|
33
|
-
"src/client/TavilyPanel.tsx": "
|
|
36
|
+
"src/client/TavilyPanel.tsx": "c60ffea2bf89811503408f4d32eb9419c65f401275d31c047b2bd36e0df42251",
|
|
34
37
|
"src/client/TeamHandoffCard.tsx": "925284ab81c7845c5cfdcfa1f631e124bb02d7d86b03ede8f3fbabc194c32dca",
|
|
35
|
-
"src/client/TerminalPanel.tsx": "
|
|
38
|
+
"src/client/TerminalPanel.tsx": "a8ba57d6e7b989fc9042a9356c547d02670928bfeec271779f4bd44651f41e92",
|
|
36
39
|
"src/client/ToolGlyph.tsx": "a1100b61f1eee9520e7323385f667898763bfd69068f22de7dd36db2d4096c76",
|
|
37
40
|
"src/client/WorkbenchChrome.tsx": "6328c984b736651024ebade3f390380e53333e6d11bea74ca4593a4176893778",
|
|
38
|
-
"src/client/WorkbenchSearch.tsx": "
|
|
41
|
+
"src/client/WorkbenchSearch.tsx": "7967f393324fd437fa5d56bd2a3d90644189a3e39e2028430d54c3d6ee69ab72",
|
|
39
42
|
"src/client/WorkbenchSplit.tsx": "7afc0e435ad8eae95f95a28563034e3bf09eef070f47bd3366d9b8eff9bc229e",
|
|
40
43
|
"src/client/WorkflowCard.tsx": "8ce5458537a3b02dcbb9bbb4c7afacb07e0f41857ed250aa4cde0cbc8d4bde6c",
|
|
41
44
|
"src/client/WorkspaceBulkSettings.tsx": "859cb5159f1aff91b8e7a7987c569d67df8bbacb3f24c6cc4c47b5ebe17f253c",
|
|
42
|
-
"src/client/WorkspaceExplorerActions.tsx": "
|
|
43
|
-
"src/client/WorkspaceFilePreview.tsx": "
|
|
45
|
+
"src/client/WorkspaceExplorerActions.tsx": "455d1487bfb75e250682a00cbebfe6a73ba37afe209f64ec79f0686664c87bf9",
|
|
46
|
+
"src/client/WorkspaceFilePreview.tsx": "1c9370fa08e0ffc64da08026cbfcf5723da886b70c9b48a8b084d5bf9cea186c",
|
|
44
47
|
"src/client/archive-confirm.ts": "a559c1d251e2e3495519d009c50e3adcaaae5859566290c6b8ffef554ddf268c",
|
|
45
48
|
"src/client/clipboard.ts": "54c7b134515f175acb8befa8e19c55f1c048c3245a7edc2cfc4d233b7593f782",
|
|
46
49
|
"src/client/diff-context-scroll.ts": "11f27a1f56c6ec77bf138119c4d00f798e553852d8de07fe258e4af090adfda1",
|
|
47
|
-
"src/client/editor-blame.ts": "
|
|
50
|
+
"src/client/editor-blame.ts": "d680671b98c64f8ba7f639f660f6b4aab0bf112fc4695c436c9d2a505326b0b0",
|
|
48
51
|
"src/client/editor-languages.ts": "d5319cfd9b9f3b07c2599ba64ec49a9038304d09fa1702302f3b2b97493d0a69",
|
|
49
52
|
"src/client/errors.ts": "2ea215b8676cca8841b93c780563f1f2031320270d4d0865221f6a12b65c6f22",
|
|
50
53
|
"src/client/file-diff.ts": "b1fd62dd0f561c567f249d98364068c947e31758fa9f1644d27250679e0f62a4",
|
|
51
54
|
"src/client/file-icons.tsx": "65e571a5378723511caef0e4bdbecdd4adba9461a46db878d65a948fc99fcb65",
|
|
52
|
-
"src/client/group-chat-client.ts": "
|
|
55
|
+
"src/client/group-chat-client.ts": "23daaa55daa08819cafada4e91650d6b4be34da07f6ce1f57bf98900f56ea140",
|
|
53
56
|
"src/client/group-chat.css": "528f04b8615b3a247bf5b7db30d9a1aee66494eb8d4da3e18c8e4a2fc58fd22f",
|
|
54
57
|
"src/client/main.tsx": "d6325cec79ebc225e4972c33ad9b4266fa1eab5f962fec36ed4c539124a8fcab",
|
|
55
58
|
"src/client/markdown-settings.ts": "33075c9137183ae4874d5a9a764cd2ae5ce9abd27331065880aa53cf6e3f307a",
|
|
@@ -58,14 +61,16 @@
|
|
|
58
61
|
"src/client/pending-operations.ts": "8a5f9e9711c0f875c8ed194196c218162de5270298dad4091351d41294c859d7",
|
|
59
62
|
"src/client/project-evidence.ts": "3bc5ea85f6b20a19a36cfdd4a958d83dd53b21f3d8f20fae1914a575dfbad3c4",
|
|
60
63
|
"src/client/reader-recovery.ts": "20030e65dce38d06bcc65d13cbe451e87dcee9c10cae7cdb7c056e5407f77849",
|
|
64
|
+
"src/client/server-connections.ts": "f2349d679e3e8cac8f5fdb6800b264aeccf57f5df10cfd3fc188613fa2ceb08a",
|
|
65
|
+
"src/client/server-scope.ts": "8edad8ebe6f35179584c3d2627304f394dd40e6dd83881d7edaf386ff46243cc",
|
|
61
66
|
"src/client/session-tree.ts": "08a14c6611fdd9a72001eb1672060479e7660de5a5d221c7e80036209fd26546",
|
|
62
67
|
"src/client/slash-commands.ts": "4a2cef1eb9517628eadfdc38bca7e3663e4d48090d8b87a8a79de4bfd586e112",
|
|
63
68
|
"src/client/software-update.css": "a4ec1565b70008b55618197a8d88db51a79fb932b9a69bfe4318a62774e8020a",
|
|
64
|
-
"src/client/styles.css": "
|
|
65
|
-
"src/client/system-notifications.ts": "
|
|
69
|
+
"src/client/styles.css": "ca6c46a13a75cb37e24ce7a0f4f64ebd28f8d94fb43ffa894a8ab346a0ac81b7",
|
|
70
|
+
"src/client/system-notifications.ts": "36dccbda2d831812d34af7217778a7a3596b184dfc2b39e0d5a0207a1a7eebd0",
|
|
66
71
|
"src/client/terminal-emulator.ts": "ffcc4f5fbddaf25cebcc9e03dbe5d7d0ad2c21586f5d169e57c04c82e2308b3b",
|
|
67
|
-
"src/client/theme.tsx": "
|
|
68
|
-
"src/client/tool-launcher.ts": "
|
|
72
|
+
"src/client/theme.tsx": "45098ed92bd513629f17ac31280bc559b4251dd1c0b4e3f1abdace72e373cafd",
|
|
73
|
+
"src/client/tool-launcher.ts": "9699c9498c905e395bbe89e0e367721ab253b5ec1e318a8093ce6a88c2ff5c29",
|
|
69
74
|
"src/client/tool-sharing.ts": "011212825dbbffe18c8f15aca721c02938ab6273fb5607b072a1e7b8b1853640",
|
|
70
75
|
"src/client/tool-shortcuts.ts": "4422d29ba770af6acef18e66c6be05a9bc021f7323c7ca28bbe7668f26d4adb8",
|
|
71
76
|
"src/client/tools.ts": "58fe41f0edbd490e3fab7f12f258b1dbc2163b653553b03ac61caf1543618e50",
|
|
@@ -73,5 +78,5 @@
|
|
|
73
78
|
"src/client/vite-env.d.ts": "65996936fbb042915f7b74a200fcdde7e410f32a669b1ab9597cfaa4b0faddb5",
|
|
74
79
|
"src/client/workbench-navigation.ts": "3b229752a8ce4a45eba7aeff040eb33001413190141f1e9b8e5f38246a1761e2"
|
|
75
80
|
},
|
|
76
|
-
"recordedAt": "2026-11-
|
|
81
|
+
"recordedAt": "2026-11-20T03:55:01.219Z"
|
|
77
82
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-J6XWqRpB.js","assets/rolldown-runtime-XKyaHtl9.js","assets/dist-D978o95T.js","assets/dist-B3-a6uF0.js","assets/dist-Cus6_oaF.js","assets/dist-Dc1MBGAG.js","assets/dist-BXAOrsjq.js","assets/dist-Cx00EZKR.js","assets/dist-moiMRpw_.js","assets/dist-Dds-qLxY.js","assets/dist-AW5lyI3I.js","assets/dist-BGxkyh6e.js","assets/dist-CKF2Jksy.js","assets/dist-BV64A9Ji.js","assets/dist-Dvb0SqcK.js","assets/dist-D71y2EI1.js","assets/dist-DeD9copn.js","assets/dist-QzbOCAU6.js","assets/dist-DuvGReu-.js","assets/dist-BRVQKlcp.js","assets/dist-BJxfd7yb.js","assets/dist-CX_Hm4GS.js","assets/dist-scBkrwv-.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-Cn7hdrDw.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};
|