@evandu/super-pi 0.1.306 → 0.1.307
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.super-pi-check-inputs.json +2 -2
- package/dist/client/.super-pi-client-sources.json +9 -9
- package/dist/client/assets/{CodeMirrorEditor-DqBXbLSc.js → CodeMirrorEditor-DhXTt2Tg.js} +1 -1
- package/dist/client/assets/{GitDiffEditor-D23ota_m.js → GitDiffEditor-DcY9Id-K.js} +1 -1
- package/dist/client/assets/index-CuTvXjCb.css +1 -0
- package/dist/client/assets/{index-Dp3ag8Vw.js → index-DLDXS61p.js} +59 -58
- package/dist/client/index.html +2 -2
- package/dist/server/managed-servers.d.ts +2 -0
- package/dist/server/managed-servers.js +20 -3
- package/dist/server/terminal.js +6 -6
- package/dist/shared/terminal-protocol.d.ts +2 -0
- package/dist/shared/terminal-protocol.js +1 -0
- package/package.json +1 -1
- package/dist/client/assets/index-Dx4q_-Im.css +0 -1
package/dist/client/index.html
CHANGED
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
<link rel="alternate icon" href="/favicon.ico" />
|
|
9
9
|
<link rel="apple-touch-icon" href="/favicon.svg" />
|
|
10
10
|
<title>Super Pi</title>
|
|
11
|
-
<script type="module" crossorigin src="/assets/index-
|
|
11
|
+
<script type="module" crossorigin src="/assets/index-DLDXS61p.js"></script>
|
|
12
12
|
<link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
|
|
13
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
13
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CuTvXjCb.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="root"></div>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { createHash, randomBytes, randomUUID, timingSafeEqual } from "node:crypto";
|
|
1
|
+
import { createHash, randomBytes, randomInt, randomUUID, timingSafeEqual } from "node:crypto";
|
|
2
|
+
import { once } from "node:events";
|
|
2
3
|
import { createServer } from "node:http";
|
|
3
4
|
import { connect as connectLocal } from "node:net";
|
|
4
5
|
import { mkdir, readFile, rename, writeFile, rm } from "node:fs/promises";
|
|
@@ -131,12 +132,28 @@ export class ManagedServers {
|
|
|
131
132
|
}
|
|
132
133
|
void this.gateway.handle(request, response);
|
|
133
134
|
});
|
|
134
|
-
|
|
135
|
-
this.gatewayPort = this.gatewayServer.address().port;
|
|
135
|
+
this.gatewayPort = await this.listenGateway(this.gatewayServer);
|
|
136
136
|
this.timer = setInterval(() => { void this.maintain(); }, 10_000);
|
|
137
137
|
this.timer.unref();
|
|
138
138
|
void this.maintain();
|
|
139
139
|
}
|
|
140
|
+
// The relay uses Fetch, which can reject an OS-assigned port before opening a socket.
|
|
141
|
+
gatewayPortCandidate() { return randomInt(20000, 60000); }
|
|
142
|
+
async listenGateway(server) {
|
|
143
|
+
for (let attempt = 1;; attempt++) {
|
|
144
|
+
const port = this.gatewayPortCandidate();
|
|
145
|
+
try {
|
|
146
|
+
server.listen(port, "127.0.0.1");
|
|
147
|
+
await once(server, "listening");
|
|
148
|
+
return port;
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
const { code } = error;
|
|
152
|
+
if (attempt >= 16 || (code !== "EADDRINUSE" && code !== "EACCES"))
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
140
157
|
list() { return [...this.records.values()].map(entry => structuredClone({ ...entry.profile, canRestart: Boolean(entry.installation), verification: this.verifications.get(entry.profile.id)?.challenge })); }
|
|
141
158
|
async probeService(input) {
|
|
142
159
|
const stored = input.id ? this.entry(input.id) : undefined;
|
package/dist/server/terminal.js
CHANGED
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
import { createRequire } from "node:module";
|
|
50
50
|
import { randomUUID } from "node:crypto";
|
|
51
51
|
import { existsSync, accessSync, constants } from "node:fs";
|
|
52
|
-
import { delimiter, join } from "node:path";
|
|
53
|
-
import { MAX_TERMINAL_SLOTS } from "../shared/terminal-protocol.js";
|
|
52
|
+
import { basename, delimiter, join } from "node:path";
|
|
53
|
+
import { MAX_TERMINAL_SLOTS, MIN_TERMINAL_ROWS } from "../shared/terminal-protocol.js";
|
|
54
54
|
import { resolveFileCwd } from "./session-cwd.js";
|
|
55
55
|
let ptyModule;
|
|
56
56
|
let ptyLoadFailure;
|
|
@@ -218,7 +218,6 @@ export function terminalShellCandidates(env = process.env) {
|
|
|
218
218
|
export const MAX_SESSIONS = 256;
|
|
219
219
|
/** Below the client panel's own minimum, and small enough that a `ls` cannot stall the socket. */
|
|
220
220
|
const MIN_COLS = 20;
|
|
221
|
-
const MIN_ROWS = 5;
|
|
222
221
|
const MAX_COLS = 500;
|
|
223
222
|
const MAX_ROWS = 200;
|
|
224
223
|
/**
|
|
@@ -348,7 +347,7 @@ export class TerminalService {
|
|
|
348
347
|
return;
|
|
349
348
|
}
|
|
350
349
|
const cols = clamp(command.cols, MIN_COLS, MAX_COLS, session.slot.cols);
|
|
351
|
-
const rows = clamp(command.rows,
|
|
350
|
+
const rows = clamp(command.rows, MIN_TERMINAL_ROWS, MAX_ROWS, session.slot.rows);
|
|
352
351
|
if (cols === session.slot.cols && rows === session.slot.rows)
|
|
353
352
|
return;
|
|
354
353
|
try {
|
|
@@ -436,13 +435,14 @@ export class TerminalService {
|
|
|
436
435
|
const used = new Set([...group.sessions.values()].map(session => session.slot.title));
|
|
437
436
|
while (used.has(String(title)))
|
|
438
437
|
title += 1;
|
|
438
|
+
const shell = defaultShell(process.env, this.configuredShell());
|
|
439
439
|
const slot = {
|
|
440
440
|
id: previous?.slot.id ?? randomUUID(),
|
|
441
441
|
title: previous?.slot.title ?? String(title),
|
|
442
|
+
shellName: basename(shell.file).replace(/\.exe$/i, ""),
|
|
442
443
|
cols: clamp(size.cols, MIN_COLS, MAX_COLS, 80),
|
|
443
|
-
rows: clamp(size.rows,
|
|
444
|
+
rows: clamp(size.rows, MIN_TERMINAL_ROWS, MAX_ROWS, 24),
|
|
444
445
|
};
|
|
445
|
-
const shell = defaultShell(process.env, this.configuredShell());
|
|
446
446
|
const child = loadPty().spawn(shell.file, shell.args, {
|
|
447
447
|
name: "xterm-256color", cols: slot.cols, rows: slot.rows, cwd: directory,
|
|
448
448
|
env: { ...process.env, TERM: "xterm-256color" },
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const MAX_TERMINAL_SLOTS = 5;
|
|
2
|
+
export declare const MIN_TERMINAL_ROWS = 1;
|
|
2
3
|
export interface TerminalScope {
|
|
3
4
|
workspaceId: string;
|
|
4
5
|
conversationId?: string;
|
|
@@ -10,6 +11,7 @@ interface TerminalSize {
|
|
|
10
11
|
export interface TerminalSlot extends Required<TerminalSize> {
|
|
11
12
|
id: string;
|
|
12
13
|
title: string;
|
|
14
|
+
shellName?: string;
|
|
13
15
|
exitCode?: number;
|
|
14
16
|
reason?: string;
|
|
15
17
|
}
|