@pixelbyte-software/pixcode 1.54.9 → 1.54.10

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-Bm6uAqKU.js"></script>
38
+ <script type="module" crossorigin src="/assets/index-DWOW_Jn0.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">
@@ -4633,10 +4633,19 @@ app.get('/api/projects/:projectName/sessions/:sessionId/token-usage', authentica
4633
4633
  throw error; // Re-throw other errors to be caught by outer try-catch
4634
4634
  }
4635
4635
  const fileStream = fs.createReadStream(jsonlPath, { encoding: 'utf8' });
4636
+ // Clean up the file stream on error to avoid fd leaks
4637
+ const destroyStream = () => {
4638
+ try {
4639
+ fileStream.destroy();
4640
+ }
4641
+ catch { /* noop */ }
4642
+ };
4643
+ fileStream.on('error', destroyStream);
4636
4644
  const rl = readline.createInterface({
4637
4645
  input: fileStream,
4638
4646
  crlfDelay: Infinity,
4639
4647
  });
4648
+ rl.on('error', destroyStream);
4640
4649
  const parsedContextWindow = parseInt(process.env.CONTEXT_WINDOW, 10);
4641
4650
  const contextWindow = Number.isFinite(parsedContextWindow) ? parsedContextWindow : 160000;
4642
4651
  let inputTokens = 0;
@@ -5096,6 +5105,10 @@ process.on('unhandledRejection', (reason, promise) => {
5096
5105
  securityLog('unhandled_rejection', {
5097
5106
  reason: reason instanceof Error ? reason.name : String(reason).slice(0, 200),
5098
5107
  });
5108
+ // Give the security log time to flush, then exit.
5109
+ // In Node 15+, unhandled rejections crash the process anyway, but this
5110
+ // ensures a clean exit that the daemon manager (systemd/pm2) can detect.
5111
+ setTimeout(() => process.exit(1), 100);
5099
5112
  });
5100
5113
  process.on('uncaughtException', (error) => {
5101
5114
  console.error('[FATAL] Uncaught exception:', error?.message || error);