@sma1lboy/kobe 0.7.21 → 0.7.22
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/cli/index.js +442 -227
- package/dist/web-ui/assets/{index-DHNbtmKS.js → index-B_AO4Tl6.js} +2 -2
- package/dist/web-ui/assets/{index-Bz2DJrhb.css → index-ClDlEZ7A.css} +1 -1
- package/dist/web-ui/assets/{routes-CObX3u9V.js → routes-BY2-JOW5.js} +3 -3
- package/dist/web-ui/index.html +2 -2
- package/dist/web-ui/pty-server.mjs +8 -3
- package/package.json +1 -1
package/dist/web-ui/index.html
CHANGED
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
<meta charset="UTF-8" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>kobe-web</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
9
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-B_AO4Tl6.js"></script>
|
|
9
|
+
<link rel="stylesheet" crossorigin href="/assets/index-ClDlEZ7A.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
12
|
<div id="app"></div>
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
import { createServer } from "node:http"
|
|
16
16
|
import { spawn } from "node-pty"
|
|
17
17
|
import { WebSocketServer } from "ws"
|
|
18
|
+
import { createScrollback } from "./pty-scrollback.mjs"
|
|
18
19
|
|
|
19
20
|
const PORT = Number.parseInt(process.env.KOBE_PTY_PORT ?? "5175", 10)
|
|
20
21
|
const BRIDGE_PORT = Number.parseInt(process.env.KOBE_BRIDGE_PORT ?? "5174", 10)
|
|
@@ -52,9 +53,13 @@ function spawnTab(tabId, spec, cols, rows) {
|
|
|
52
53
|
cwd: spec.cwd,
|
|
53
54
|
env: ptyEnv(),
|
|
54
55
|
})
|
|
55
|
-
|
|
56
|
+
// Scrollback is a bounded ring of chunks, not a single growing string: the
|
|
57
|
+
// old `(buffer + data).slice(-CAP)` re-flattened ~256KB on EVERY chunk once
|
|
58
|
+
// the cap was reached (quadratic during heavy streaming). `push` is O(chunk);
|
|
59
|
+
// the string is materialized only on (re)attach replay.
|
|
60
|
+
const entry = { pty, scrollback: createScrollback(SCROLLBACK_CAP), sockets: new Set() }
|
|
56
61
|
pty.onData((data) => {
|
|
57
|
-
entry.
|
|
62
|
+
entry.scrollback.push(data)
|
|
58
63
|
for (const ws of entry.sockets) if (ws.readyState === ws.OPEN) ws.send(data)
|
|
59
64
|
})
|
|
60
65
|
pty.onExit(() => {
|
|
@@ -150,7 +155,7 @@ wss.on("connection", (ws, req) => {
|
|
|
150
155
|
|
|
151
156
|
entry.sockets.add(ws)
|
|
152
157
|
// Replay recent output so a (re)attach shows current screen state.
|
|
153
|
-
if (entry.
|
|
158
|
+
if (entry.scrollback.length() > 0 && ws.readyState === ws.OPEN) ws.send(entry.scrollback.replay())
|
|
154
159
|
entry.pty.resize(cols, rows)
|
|
155
160
|
|
|
156
161
|
ws.on("message", (raw) => {
|
package/package.json
CHANGED