@pixelbyte-software/pixcode 1.50.5 → 1.50.7

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-BSxc8Vid.js"></script>
38
+ <script type="module" crossorigin src="/assets/index-CR4j4iu_.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">
@@ -289,22 +289,24 @@ function detectProviderTerminalState(provider, output) {
289
289
  terminalStateReason: 'process_exit',
290
290
  };
291
291
  }
292
- const lastBusy = Math.max(getLastRegexMatchIndex(cleanOutput, /(?:^|\n)\s*[•*]\s*(?:Working|Running|Thinking)\b/giu), getLastRegexMatchIndex(cleanOutput, /\bWorking\s*\([^)]*esc to interrupt[^)]*\)/giu), getLastRegexMatchIndex(cleanOutput, /\bmsg=interrupt\b/giu));
292
+ const lastWeakBusy = getLastRegexMatchIndex(cleanOutput, /(?:^|\n)\s*[•*]\s*(?:Working|Running|Thinking)\b/giu);
293
+ const lastStrongBusy = Math.max(getLastRegexMatchIndex(cleanOutput, /\bWorking\s*\([^)]*esc to interrupt[^)]*\)/giu), getLastRegexMatchIndex(cleanOutput, /\bmsg=interrupt\b/giu));
294
+ const lastBusy = Math.max(lastWeakBusy, lastStrongBusy);
293
295
  if (provider === 'codex') {
294
296
  const lastPrompt = Math.max(getLastRegexMatchIndex(cleanOutput, /(?:^|\n)\s*›(?:\s|$)/gu), getLastRegexMatchIndex(cleanOutput, /(?:^|\n)\s*❯(?:\s|$)/gu));
295
- if (lastBusy >= 0) {
296
- const isBusy = lastPrompt <= lastBusy;
297
+ if (lastPrompt >= 0) {
298
+ const isBusy = lastStrongBusy > lastPrompt;
297
299
  return {
298
300
  terminalState: isBusy ? 'busy' : 'idle',
299
301
  isBusy,
300
- terminalStateReason: isBusy ? 'codex_busy_marker_after_prompt' : 'codex_prompt_after_busy_marker',
302
+ terminalStateReason: isBusy ? 'codex_strong_busy_marker_after_prompt' : 'codex_prompt_after_busy_marker',
301
303
  };
302
304
  }
303
- if (lastPrompt >= 0 && /(?:Initialized|Baseline check passed|I did not modify files|Use \/skills)/iu.test(cleanOutput)) {
305
+ if (lastBusy >= 0) {
304
306
  return {
305
- terminalState: 'idle',
306
- isBusy: false,
307
- terminalStateReason: 'codex_idle_prompt',
307
+ terminalState: 'busy',
308
+ isBusy: true,
309
+ terminalStateReason: 'codex_busy_marker_without_prompt',
308
310
  };
309
311
  }
310
312
  }
@@ -357,6 +359,26 @@ function appendPtySessionBuffer(session, data) {
357
359
  session.buffer.push(data);
358
360
  }
359
361
  }
362
+ function normalizeTerminalStartupInput(input) {
363
+ return `${String(input || '').replace(/(?:\r\n|\r|\n)+$/u, '')}\r`;
364
+ }
365
+ function writeTerminalStartupInput(session, startupInput, reason, delayMs = 500) {
366
+ if (!session?.pty || !startupInput)
367
+ return;
368
+ const submittedInput = normalizeTerminalStartupInput(startupInput);
369
+ setTimeout(() => {
370
+ try {
371
+ if (session.pty && session.lifecycleState === 'running') {
372
+ session.pty.write(submittedInput);
373
+ session.updatedAt = Date.now();
374
+ console.log(`⌨️ Submitted startup input to visible PTY (${reason})`);
375
+ }
376
+ }
377
+ catch (error) {
378
+ console.warn('Failed to submit startup input to visible PTY:', error?.message || error);
379
+ }
380
+ }, delayMs);
381
+ }
360
382
  function normalizeShellPermissionMode(value) {
361
383
  return typeof value === 'string' ? value.trim() : '';
362
384
  }
@@ -2181,6 +2203,9 @@ function handleShellConnection(ws, request) {
2181
2203
  const startupInput = typeof data.startupInput === 'string' && data.startupInput.trim()
2182
2204
  ? data.startupInput.trim()
2183
2205
  : null;
2206
+ const startupInputDelivery = data.startupInputDelivery === 'terminal' ? 'terminal' : 'command';
2207
+ const commandStartupInput = startupInputDelivery === 'command' ? startupInput : null;
2208
+ const terminalStartupInput = startupInputDelivery === 'terminal' ? startupInput : null;
2184
2209
  const hermesLaunchId = Number.isFinite(Number(data.hermesLaunchId)) && Number(data.hermesLaunchId) > 0
2185
2210
  ? Number(data.hermesLaunchId)
2186
2211
  : null;
@@ -2261,6 +2286,9 @@ function handleShellConnection(ws, request) {
2261
2286
  });
2262
2287
  }
2263
2288
  existingSession.ws = ws;
2289
+ if (terminalStartupInput && !isPlainShell) {
2290
+ writeTerminalStartupInput(existingSession, terminalStartupInput, 'reused provider session', 350);
2291
+ }
2264
2292
  return;
2265
2293
  }
2266
2294
  }
@@ -2338,8 +2366,8 @@ function handleShellConnection(ws, request) {
2338
2366
  shellCommand = `${command} resume "${sessionId}" || ${command}`;
2339
2367
  }
2340
2368
  }
2341
- else if (startupInput) {
2342
- shellCommand = `${command} ${quoteShellArgForPlatform(startupInput)}`;
2369
+ else if (commandStartupInput) {
2370
+ shellCommand = `${command} ${quoteShellArgForPlatform(commandStartupInput)}`;
2343
2371
  }
2344
2372
  else {
2345
2373
  shellCommand = command;
@@ -2475,6 +2503,10 @@ function handleShellConnection(ws, request) {
2475
2503
  keepAliveUntilExit: false,
2476
2504
  updatedAt: Date.now(),
2477
2505
  });
2506
+ const createdSession = ptySessionsMap.get(ptySessionKey);
2507
+ if (terminalStartupInput && !isPlainShell) {
2508
+ writeTerminalStartupInput(createdSession, terminalStartupInput, 'new provider session', 4500);
2509
+ }
2478
2510
  // Handle data output
2479
2511
  shellProcess.onData((data) => {
2480
2512
  const session = ptySessionsMap.get(ptySessionKey);
@@ -2522,6 +2554,10 @@ function handleShellConnection(ws, request) {
2522
2554
  shellProcess.onExit((exitCode) => {
2523
2555
  console.log('🔚 Shell process exited with code:', exitCode.exitCode, 'signal:', exitCode.signal);
2524
2556
  const session = ptySessionsMap.get(ptySessionKey);
2557
+ if (session?.pty && session.pty !== shellProcess) {
2558
+ console.log('↩️ Ignoring stale PTY exit for replacement session:', ptySessionKey);
2559
+ return;
2560
+ }
2525
2561
  const exitMessage = `\r\n\x1b[33mProcess exited with code ${exitCode.exitCode}${exitCode.signal ? ` (${exitCode.signal})` : ''}\x1b[0m\r\n`;
2526
2562
  if (session) {
2527
2563
  session.lifecycleState = exitCode.exitCode === 0 && !exitCode.signal ? 'completed' : 'failed';