@evandu/super-pi 0.1.151 → 0.1.153
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/client/.super-pi-client-sources.json +6 -4
- package/dist/client/assets/{CodeMirrorEditor-BhTJvXpU.js → CodeMirrorEditor-DmRMgD_e.js} +2 -2
- package/dist/client/assets/{dist-BOqRI6sA.js → dist-1ehoscoU.js} +1 -1
- package/dist/client/assets/{dist-BFAjSsad.js → dist-BAy39a02.js} +1 -1
- package/dist/client/assets/{dist-80xX2Yd8.js → dist-BIMTBXpD.js} +1 -1
- package/dist/client/assets/{dist-TwlTH8F1.js → dist-BPU0RZX2.js} +1 -1
- package/dist/client/assets/{dist-49TFFUQg.js → dist-BQvKL2T4.js} +1 -1
- package/dist/client/assets/{dist-B0gI-KRY.js → dist-BTfxEdeF.js} +1 -1
- package/dist/client/assets/{dist-Dq7hLZoB.js → dist-BWxApOy6.js} +1 -1
- package/dist/client/assets/{dist-DDdxjRBp.js → dist-BaagZpIV.js} +1 -1
- package/dist/client/assets/{dist-Bz1OET8s.js → dist-BjZSq94T.js} +1 -1
- package/dist/client/assets/{dist-DJdFGvR0.js → dist-BzOPeLJM.js} +1 -1
- package/dist/client/assets/{dist-0vbzT0fs.js → dist-C5OCcu2D.js} +1 -1
- package/dist/client/assets/{dist-CMiCGuFr.js → dist-CMNmeOX_.js} +1 -1
- package/dist/client/assets/{dist-CzCFepaD.js → dist-Cl_nos6D.js} +1 -1
- package/dist/client/assets/{dist-aOpTOMHI.js → dist-DE8_FyRQ.js} +1 -1
- package/dist/client/assets/{dist-BuDFattZ.js → dist-DM15RCDF.js} +1 -1
- package/dist/client/assets/{dist-BstoGC94.js → dist-DpK_uu3H.js} +1 -1
- package/dist/client/assets/{dist-SMKcq1ns.js → dist-QCoWWp1z.js} +1 -1
- package/dist/client/assets/{dist-CkatEAPx.js → dist-SHt_aVda.js} +1 -1
- package/dist/client/assets/{dist-B3Dy7iF_.js → dist-YiNVn-GQ.js} +1 -1
- package/dist/client/assets/{dist-B5nvkwVU.js → dist-h0HvU8ex.js} +1 -1
- package/dist/client/assets/{dist-Cwuref9o.js → dist-mY7dpaip.js} +1 -1
- package/dist/client/assets/{dist-Ce7WvAkm.js → dist-tpn03yX2.js} +1 -1
- package/dist/client/assets/{index-Csr3-JTY.js → index-Ce896Hh9.js} +16 -16
- package/dist/client/assets/index-DCLaWQin.css +1 -0
- package/dist/client/index.html +2 -2
- package/dist/server/terminal.d.ts +29 -4
- package/dist/server/terminal.js +38 -5
- package/package.json +6 -3
- package/dist/.super-pi-check-inputs.json +0 -4
- package/dist/client/assets/index-BMpqviwU.css +0 -1
- package/dist/server/feishu-config.d.ts +0 -68
- package/dist/server/feishu-config.js +0 -84
- package/dist/server/feishu.d.ts +0 -187
- package/dist/server/feishu.js +0 -695
package/dist/server/terminal.js
CHANGED
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
* nothing else; this file resolves the id against the store and spawns in that workspace's path.
|
|
30
30
|
* A browser that asked for `C:\` or `/etc` gets its own workspace's directory instead, because
|
|
31
31
|
* there is no code path on which a client-supplied path reaches `spawn`.
|
|
32
|
-
* 4. BOUNDED SESSIONS. `MAX_SESSIONS` shells,
|
|
33
|
-
*
|
|
32
|
+
* 4. BOUNDED SESSIONS. `MAX_SESSIONS` live shells, capped so a loop of reconnects cannot accumulate
|
|
33
|
+
* processes.
|
|
34
34
|
*
|
|
35
35
|
* What is NOT here is a per-command allowlist. A terminal that refuses `rm` or `curl` is not a terminal,
|
|
36
36
|
* and pretending otherwise would be worse than the honest version: with (1) and (2) the operator has
|
|
@@ -190,8 +190,33 @@ export function terminalShellCandidates(env = process.env) {
|
|
|
190
190
|
// ---------------------------------------------------------------------------------------------
|
|
191
191
|
// Bounds
|
|
192
192
|
// ---------------------------------------------------------------------------------------------
|
|
193
|
-
/**
|
|
194
|
-
|
|
193
|
+
/**
|
|
194
|
+
* THE CEILING ON LIVE SHELLS.
|
|
195
|
+
*
|
|
196
|
+
* WHAT THIS COUNTS. Only the browser's terminal panel: `terminal.open` is the ONE place a shell is
|
|
197
|
+
* spawned, and it is a command the browser sends over its own WebSocket. An agent session, a
|
|
198
|
+
* sub-agent run, and the `exec` tool do NOT consume this budget - the exec tool spawns its own
|
|
199
|
+
* short-lived `shell -c` process through a different service.
|
|
200
|
+
*
|
|
201
|
+
* WHY THE COUNT ACCUMULATES. The client opens up to five terminals per session (`MAX_SLOTS` in
|
|
202
|
+
* TerminalPanel), and a shell is deliberately KEPT ALIVE across a session switch: the panel unmounts
|
|
203
|
+
* without closing it, so the work in that shell survives the switch. Every session in the tree is a
|
|
204
|
+
* conversation with its own panel - including a CHILD session the user can click into - and each of
|
|
205
|
+
* them can hold five shells, and all of them land in this one map. A tree multiplies: eight parents
|
|
206
|
+
* with four children each are forty sessions, and forty sessions at four terminals is a hundred and
|
|
207
|
+
* sixty shells.
|
|
208
|
+
*
|
|
209
|
+
* WHY 256. Every shell in this map was opened by the user on purpose, and what runs inside it is the
|
|
210
|
+
* user's own business - so this constant is NOT a memory governor and does not pretend to be one. Its
|
|
211
|
+
* whole job is to be generous enough never to stand in the way of real work, and loud enough that a
|
|
212
|
+
* client looping on `terminal.open` is stopped with a message instead of quietly filling the machine.
|
|
213
|
+
* (For the record, the platform's own overhead per shell is the shell: an idle Windows PowerShell is
|
|
214
|
+
* ~90MB and an idle bash ~8MB, so the cost of "many terminals" is the cost of the shells themselves.)
|
|
215
|
+
* Reconnect storms do not need this constant to be low: the socket-close cleanup already kills a
|
|
216
|
+
* connection's shells, and the 30-second heartbeat reaps the half-open connections that would
|
|
217
|
+
* otherwise leave them behind.
|
|
218
|
+
*/
|
|
219
|
+
export const MAX_SESSIONS = 256;
|
|
195
220
|
/** Below the client panel's own minimum, and small enough that a `ls` cannot stall the socket. */
|
|
196
221
|
const MIN_COLS = 20;
|
|
197
222
|
const MIN_ROWS = 5;
|
|
@@ -296,7 +321,15 @@ export class TerminalService {
|
|
|
296
321
|
if (this.sessions.has(command.sessionId))
|
|
297
322
|
return;
|
|
298
323
|
if (this.sessions.size >= MAX_SESSIONS) {
|
|
299
|
-
|
|
324
|
+
// The count is in the message because the shells eating the budget are usually the BACKGROUND
|
|
325
|
+
// ones of other sessions - a parent session's children included, each of which has its own
|
|
326
|
+
// panel with its own terminals. The user sees three terminals in this panel and a refusal,
|
|
327
|
+
// and has no way to guess that the sessions they left open still hold shells.
|
|
328
|
+
send({
|
|
329
|
+
type: "terminal.error",
|
|
330
|
+
sessionId: command.sessionId,
|
|
331
|
+
message: `终端会话已达上限(服务器最多 ${MAX_SESSIONS} 个,当前已有 ${this.sessions.size} 个在运行)。切换会话后仍在后台运行的终端也计入其中(包括 session 树里的子会话),请到对应的会话里关闭一个再试。`,
|
|
332
|
+
});
|
|
300
333
|
return;
|
|
301
334
|
}
|
|
302
335
|
// The workspace id is the ONLY thing the browser supplies, and it is resolved here. A client that
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@evandu/super-pi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.153",
|
|
4
4
|
"description": "Web control plane and companion for Pi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
"node": ">=22.19.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
|
-
"prepack": "
|
|
33
|
-
"prepublishOnly": "
|
|
32
|
+
"prepack": "node scripts/clean-build.mjs",
|
|
33
|
+
"prepublishOnly": "node scripts/clean-build.mjs && cross-env SUPER_PI_REQUIRE_REAL_PI=1 node scripts/extension-load.test.mjs",
|
|
34
34
|
"dev": "concurrently --kill-others-on-fail \"npm:dev:server\" \"npm:dev:client\"",
|
|
35
35
|
"dev:client": "vite --host 0.0.0.0",
|
|
36
36
|
"dev:server": "cross-env SUPER_PI_PORT=3081 tsx watch src/server/index.ts",
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"scripts/pi-session.test.mjs",
|
|
54
54
|
"scripts/length-continuation.test.mjs",
|
|
55
55
|
"scripts/pi-session-isolation.test.mjs",
|
|
56
|
+
"scripts/build-state.test.mjs",
|
|
56
57
|
"scripts/installed-layout.test.mjs",
|
|
57
58
|
"scripts/pi-model-switch.test.mjs",
|
|
58
59
|
"scripts/pi-thinking-levels.test.mjs",
|
|
@@ -173,6 +174,7 @@
|
|
|
173
174
|
"scripts/tool-runner.test.mjs",
|
|
174
175
|
"scripts/tool-runtime-api.test.mjs",
|
|
175
176
|
"scripts/tool-sharing.test.mjs",
|
|
177
|
+
"scripts/tool-shortcuts.test.mjs",
|
|
176
178
|
"scripts/tool-env.test.mjs",
|
|
177
179
|
"scripts/tool-llm.test.mjs",
|
|
178
180
|
"scripts/extension-load.test.mjs",
|
|
@@ -276,6 +278,7 @@
|
|
|
276
278
|
"scripts/narrow-layout.test.mjs",
|
|
277
279
|
"scripts/scrollbar-style.test.mjs",
|
|
278
280
|
"scripts/stream-tail-browser.test.mjs",
|
|
281
|
+
"scripts/scroll-restore-browser.test.mjs",
|
|
279
282
|
"scripts/theme-contrast.test.mjs",
|
|
280
283
|
"scripts/theme-switch-state.test.mjs",
|
|
281
284
|
"scripts/settings-window-structure.test.mjs",
|