@pixelbyte-software/pixcode 1.53.13 → 1.53.14

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/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-CZReJ0_S.js"></script>
38
+ <script type="module" crossorigin src="/assets/index-CV_x2mrI.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">
@@ -1106,6 +1106,7 @@ function appendPtySessionBuffer(session, data) {
1106
1106
  value = value.slice(-PTY_SESSION_BUFFER_MAX_BYTES);
1107
1107
  valueBytes = Buffer.byteLength(value, 'utf8');
1108
1108
  }
1109
+ session.totalOutputBytes = (session.totalOutputBytes || 0) + valueBytes;
1109
1110
  session.buffer.push(value);
1110
1111
  session.bufferBytes = (session.bufferBytes || 0) + valueBytes;
1111
1112
  while (session.buffer.length > 0 && session.bufferBytes > PTY_SESSION_BUFFER_MAX_BYTES) {
@@ -1115,6 +1116,27 @@ function appendPtySessionBuffer(session, data) {
1115
1116
  if (session.bufferBytes < 0)
1116
1117
  session.bufferBytes = 0;
1117
1118
  }
1119
+ function readPtySessionBufferedOutput(session, { maxChars = 12000, sinceCursor = null } = {}) {
1120
+ const rawBuffer = (session?.buffer || []).join('');
1121
+ const bufferBytes = session?.bufferBytes || Buffer.byteLength(rawBuffer, 'utf8');
1122
+ const outputCursor = session?.totalOutputBytes || bufferBytes;
1123
+ const bufferStartCursor = Math.max(0, outputCursor - bufferBytes);
1124
+ let rawOutput = rawBuffer;
1125
+ if (Number.isFinite(sinceCursor)) {
1126
+ const skipBytes = Math.max(0, sinceCursor - bufferStartCursor);
1127
+ if (skipBytes > 0) {
1128
+ rawOutput = Buffer.from(rawBuffer, 'utf8').slice(skipBytes).toString('utf8');
1129
+ }
1130
+ }
1131
+ if (rawOutput.length > maxChars) {
1132
+ rawOutput = rawOutput.slice(-maxChars);
1133
+ }
1134
+ return {
1135
+ rawOutput,
1136
+ outputCursor,
1137
+ bufferStartCursor,
1138
+ };
1139
+ }
1118
1140
  function normalizeTerminalStartupInput(input) {
1119
1141
  return `\x15${String(input || '').replace(/(?:\r\n|\r|\n)+$/u, '')}\r`;
1120
1142
  }
@@ -1439,6 +1461,8 @@ app.get('/api/shell/sessions/provider-output', authenticateToken, requireProject
1439
1461
  const tabId = readPtyTarget(req.query.tabId);
1440
1462
  const sessionId = readPtyTarget(req.query.sessionId);
1441
1463
  const maxChars = Math.min(20000, Math.max(1000, Number.parseInt(String(req.query.maxChars || '12000'), 10) || 12000));
1464
+ const sinceCursorRaw = Number.parseInt(String(req.query.sinceCursor ?? ''), 10);
1465
+ const sinceCursor = Number.isFinite(sinceCursorRaw) ? Math.max(0, sinceCursorRaw) : null;
1442
1466
  if (!SHELL_CLI_PROVIDERS.has(provider)) {
1443
1467
  return res.status(400).json({ error: 'Unsupported provider' });
1444
1468
  }
@@ -1452,6 +1476,8 @@ app.get('/api/shell/sessions/provider-output', authenticateToken, requireProject
1452
1476
  tabId,
1453
1477
  sessionId,
1454
1478
  output: '',
1479
+ outputCursor: 0,
1480
+ bufferStartCursor: 0,
1455
1481
  message: 'Multiple provider terminal sessions match this target. Pick a specific tab.',
1456
1482
  });
1457
1483
  }
@@ -1462,13 +1488,16 @@ app.get('/api/shell/sessions/provider-output', authenticateToken, requireProject
1462
1488
  tabId,
1463
1489
  sessionId,
1464
1490
  output: '',
1491
+ outputCursor: 0,
1492
+ bufferStartCursor: 0,
1465
1493
  message: 'No active provider terminal session found for this project.',
1466
1494
  });
1467
1495
  }
1468
1496
  const matchedSession = match.session;
1469
- const rawOutput = matchedSession.buffer.join('').slice(-maxChars);
1497
+ const { rawOutput, outputCursor, bufferStartCursor, } = readPtySessionBufferedOutput(matchedSession, { maxChars, sinceCursor });
1470
1498
  const output = stripAnsiSequences(rawOutput);
1471
- const terminalState = resolveProviderTerminalState(matchedSession, provider, output);
1499
+ const fullOutput = readSessionOutputForState(matchedSession);
1500
+ const terminalState = resolveProviderTerminalState(matchedSession, provider, fullOutput);
1472
1501
  res.json({
1473
1502
  active: true,
1474
1503
  provider,
@@ -1479,6 +1508,9 @@ app.get('/api/shell/sessions/provider-output', authenticateToken, requireProject
1479
1508
  matchStatus: match.status,
1480
1509
  ...terminalState,
1481
1510
  output,
1511
+ outputCursor,
1512
+ bufferStartCursor,
1513
+ sinceCursor,
1482
1514
  });
1483
1515
  });
1484
1516
  app.post('/api/shell/sessions/provider-input', authenticateToken, requireProjectPathAccess('useShell'), (req, res) => {
@@ -1526,6 +1558,7 @@ app.post('/api/shell/sessions/provider-input', authenticateToken, requireProject
1526
1558
  }
1527
1559
  const matchedSession = match.session;
1528
1560
  const data = submit ? normalizeTerminalStartupInput(input) : input;
1561
+ const outputCursorBefore = matchedSession.totalOutputBytes || matchedSession.bufferBytes || 0;
1529
1562
  try {
1530
1563
  writeTerminalInputChunks(matchedSession.pty, data);
1531
1564
  matchedSession.updatedAt = Date.now();
@@ -1539,6 +1572,8 @@ app.post('/api/shell/sessions/provider-input', authenticateToken, requireProject
1539
1572
  submitted: submit,
1540
1573
  bytes: Buffer.byteLength(data),
1541
1574
  matchStatus: match.status,
1575
+ outputCursorBefore,
1576
+ outputCursorAfter: matchedSession.totalOutputBytes || matchedSession.bufferBytes || 0,
1542
1577
  });
1543
1578
  }
1544
1579
  catch (error) {
@@ -3834,6 +3869,7 @@ function handleShellConnection(ws, request) {
3834
3869
  ws: ws,
3835
3870
  buffer: [],
3836
3871
  bufferBytes: 0,
3872
+ totalOutputBytes: 0,
3837
3873
  droppedOutputBytes: 0,
3838
3874
  timeoutId: null,
3839
3875
  userId: ownerUserId,