@pixelbyte-software/pixcode 1.53.7 → 1.53.8
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/assets/{index-DM-KfWAm.js → index-BTj30VBN.js} +1 -1
- package/dist/index.html +1 -1
- package/dist-server/server/index.js +38 -7
- package/dist-server/server/index.js.map +1 -1
- package/dist-server/server/services/telegram/control-center.js +27 -3
- package/dist-server/server/services/telegram/control-center.js.map +1 -1
- package/dist-server/server/services/telegram/translations.js +2 -0
- package/dist-server/server/services/telegram/translations.js.map +1 -1
- package/package.json +1 -1
- package/server/index.js +39 -5
- package/server/services/telegram/control-center.js +26 -3
- package/server/services/telegram/translations.js +2 -0
package/dist/index.html
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
|
|
36
36
|
<!-- Prevent zoom on iOS -->
|
|
37
37
|
<meta name="format-detection" content="telephone=no" />
|
|
38
|
-
<script type="module" crossorigin src="/assets/index-
|
|
38
|
+
<script type="module" crossorigin src="/assets/index-BTj30VBN.js"></script>
|
|
39
39
|
<link rel="modulepreload" crossorigin href="/assets/vendor-react-DB6V5Fl1.js">
|
|
40
40
|
<link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-CIYNS698.js">
|
|
41
41
|
<link rel="modulepreload" crossorigin href="/assets/vendor-xterm-C7tpxJl7.js">
|
|
@@ -909,6 +909,9 @@ const ptySessionsMap = new Map();
|
|
|
909
909
|
const PTY_SESSION_TIMEOUT = 30 * 60 * 1000;
|
|
910
910
|
const COMPLETED_PTY_SESSION_TTL = 5 * 60 * 1000;
|
|
911
911
|
const SHELL_URL_PARSE_BUFFER_LIMIT = 32768;
|
|
912
|
+
const SHELL_OUTPUT_FLUSH_MAX_CHARS = 128 * 1024;
|
|
913
|
+
const SHELL_WS_BACKPRESSURE_LIMIT = 8 * 1024 * 1024;
|
|
914
|
+
const PTY_SESSION_BUFFER_MAX_BYTES = Number.parseInt(process.env.PIXCODE_PTY_BUFFER_MAX_BYTES || '', 10) || (2 * 1024 * 1024);
|
|
912
915
|
const SHELL_CLI_PROVIDERS = new Set(['claude', 'codex', 'cursor', 'gemini', 'qwen', 'opencode']);
|
|
913
916
|
import { stripAnsiSequences, normalizeDetectedUrl, extractUrlsFromText, shouldAutoOpenUrlFromOutput } from './utils/url-detection.js';
|
|
914
917
|
function terminatePtySession(sessionKey, session, reason) {
|
|
@@ -1030,13 +1033,22 @@ function resolveProviderTerminalState(session, provider, output) {
|
|
|
1030
1033
|
function appendPtySessionBuffer(session, data) {
|
|
1031
1034
|
if (!session)
|
|
1032
1035
|
return;
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1036
|
+
let value = String(data || '');
|
|
1037
|
+
if (!value)
|
|
1038
|
+
return;
|
|
1039
|
+
let valueBytes = Buffer.byteLength(value, 'utf8');
|
|
1040
|
+
if (valueBytes > PTY_SESSION_BUFFER_MAX_BYTES) {
|
|
1041
|
+
value = value.slice(-PTY_SESSION_BUFFER_MAX_BYTES);
|
|
1042
|
+
valueBytes = Buffer.byteLength(value, 'utf8');
|
|
1043
|
+
}
|
|
1044
|
+
session.buffer.push(value);
|
|
1045
|
+
session.bufferBytes = (session.bufferBytes || 0) + valueBytes;
|
|
1046
|
+
while (session.buffer.length > 0 && session.bufferBytes > PTY_SESSION_BUFFER_MAX_BYTES) {
|
|
1047
|
+
const removed = session.buffer.shift();
|
|
1048
|
+
session.bufferBytes -= Buffer.byteLength(String(removed || ''), 'utf8');
|
|
1049
|
+
}
|
|
1050
|
+
if (session.bufferBytes < 0)
|
|
1051
|
+
session.bufferBytes = 0;
|
|
1040
1052
|
}
|
|
1041
1053
|
function normalizeTerminalStartupInput(input) {
|
|
1042
1054
|
return `\x15${String(input || '').replace(/(?:\r\n|\r|\n)+$/u, '')}\r`;
|
|
@@ -3150,7 +3162,16 @@ function handleShellConnection(ws, request) {
|
|
|
3150
3162
|
session.updatedAt = Date.now();
|
|
3151
3163
|
appendPtySessionBuffer(session, rawData);
|
|
3152
3164
|
if (session.ws && session.ws.readyState === WebSocket.OPEN) {
|
|
3165
|
+
if (session.ws.bufferedAmount > SHELL_WS_BACKPRESSURE_LIMIT) {
|
|
3166
|
+
session.droppedOutputBytes = (session.droppedOutputBytes || 0) + Buffer.byteLength(rawData, 'utf8');
|
|
3167
|
+
return;
|
|
3168
|
+
}
|
|
3169
|
+
const droppedOutputBytes = session.droppedOutputBytes || 0;
|
|
3170
|
+
session.droppedOutputBytes = 0;
|
|
3153
3171
|
let outputData = rawData;
|
|
3172
|
+
if (droppedOutputBytes > 0) {
|
|
3173
|
+
outputData = `\r\n\x1b[33m[Pixcode] ${droppedOutputBytes} bytes of terminal output were skipped because the browser connection was backpressured.\x1b[0m\r\n${outputData}`;
|
|
3174
|
+
}
|
|
3154
3175
|
const cleanChunk = stripAnsiSequences(rawData);
|
|
3155
3176
|
urlDetectionBuffer = `${urlDetectionBuffer}${cleanChunk}`.slice(-SHELL_URL_PARSE_BUFFER_LIMIT);
|
|
3156
3177
|
outputData = outputData.replace(/OPEN_URL:\s*(https?:\/\/[^\s\x1b\x07]+)/g, '[INFO] Opening in browser: $1');
|
|
@@ -3491,6 +3512,8 @@ function handleShellConnection(ws, request) {
|
|
|
3491
3512
|
pty: shellProcess,
|
|
3492
3513
|
ws: ws,
|
|
3493
3514
|
buffer: [],
|
|
3515
|
+
bufferBytes: 0,
|
|
3516
|
+
droppedOutputBytes: 0,
|
|
3494
3517
|
timeoutId: null,
|
|
3495
3518
|
userId: ownerUserId,
|
|
3496
3519
|
projectPath,
|
|
@@ -3516,6 +3539,14 @@ function handleShellConnection(ws, request) {
|
|
|
3516
3539
|
// keystroke-sized chunk.
|
|
3517
3540
|
shellProcess.onData((data) => {
|
|
3518
3541
|
outputBuffer += data;
|
|
3542
|
+
if (outputBuffer.length >= SHELL_OUTPUT_FLUSH_MAX_CHARS) {
|
|
3543
|
+
if (outputFlushTimer) {
|
|
3544
|
+
clearTimeout(outputFlushTimer);
|
|
3545
|
+
outputFlushTimer = null;
|
|
3546
|
+
}
|
|
3547
|
+
flushOutputBuffer();
|
|
3548
|
+
return;
|
|
3549
|
+
}
|
|
3519
3550
|
if (!outputFlushTimer) {
|
|
3520
3551
|
outputFlushTimer = setTimeout(flushOutputBuffer, 8);
|
|
3521
3552
|
}
|