@volter/supercode-teams 0.3.102 → 0.3.103

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.
@@ -2,7 +2,7 @@
2
2
  // Supercode hosts neither the agent nor its run loop; it can attach to native
3
3
  // question requests while the stock TUI remains the session's UI.
4
4
  import { spawn } from 'node:child_process';
5
- import { readFileSync, writeFileSync, renameSync, mkdtempSync, existsSync, rmSync } from 'node:fs';
5
+ import { readFileSync, writeFileSync, renameSync, mkdtempSync, existsSync, rmSync, appendFileSync } from 'node:fs';
6
6
  import { tmpdir } from 'node:os';
7
7
  import { join } from 'node:path';
8
8
 
@@ -42,7 +42,23 @@ for (let index = 0; index < seed.arguments.length; index += 1) {
42
42
  }
43
43
  }
44
44
  if(writableRoots.length)config.push('-c',`sandbox_workspace_write.writable_roots=${JSON.stringify(writableRoots)}`);
45
- const server = spawn(seed.program, [...config, 'app-server', '--listen', endpoint], { stdio: ['ignore', 'ignore', 'inherit'] });
45
+ // The app-server's stderr is never the pane's: the pane is the TUI's screen, and a record the server writes there lands
46
+ // on the TUI's composer row, which the mail wake then reads as a person's draft and never types over (yuerans,
47
+ // 2026-10-06: `ERROR codex_models_manager::manager: failed to refresh available models` held every wake of the box
48
+ // maintainer off for three hours). It is kept beside the pane's binding instead, at most LOG_BYTES of it.
49
+ const LOG_BYTES = 8 * 1024 * 1024;
50
+ const serverLog = `${path.replace(/\.json$/, '')}.app-server.log`;
51
+ let logged = 0;
52
+ const server = spawn(seed.program, [...config, 'app-server', '--listen', endpoint], { stdio: ['ignore', 'ignore', 'pipe'] });
53
+ server.stderr.on('data', (chunk) => {
54
+ if (logged >= LOG_BYTES) return;
55
+ const kept = chunk.subarray(0, LOG_BYTES - logged);
56
+ logged += kept.length;
57
+ try {
58
+ appendFileSync(serverLog, kept, { mode: 0o600 });
59
+ if (logged >= LOG_BYTES) appendFileSync(serverLog, `\nsupercode: the app-server's stderr past ${LOG_BYTES} bytes is not kept\n`);
60
+ } catch { /* its log is best kept; the pane never gets it */ }
61
+ });
46
62
  let tui;
47
63
  let ended = false;
48
64
  let serverError;
@@ -67,7 +83,10 @@ try {
67
83
  tui = spawn(seed.program, args, { stdio: 'inherit' });
68
84
  process.exitCode = await new Promise((resolve, reject) => { tui.once('exit', (code) => resolve(code ?? 1)); tui.once('error', reject); });
69
85
  } catch (error) {
70
- process.stderr.write(`supercode: ${error.message}\n`);
86
+ // a server that failed says why in its log, which the pane shows only now, as the pane's own failure
87
+ let why = '';
88
+ try { why = readFileSync(serverLog, 'utf8').slice(-2000).trim(); } catch { /* it wrote nothing */ }
89
+ process.stderr.write(`supercode: ${error.message}\n${why ? `its app-server's stderr (${serverLog}):\n${why}\n` : ''}`);
71
90
  process.exitCode = 1;
72
91
  } finally {
73
92
  clearInterval(guard);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter/supercode-teams",
3
- "version": "0.3.102",
3
+ "version": "0.3.103",
4
4
  "type": "module",
5
5
  "description": "A machine daemon serving this machine's doors, and a local or remote Teams server for shared session discovery, OpenTelemetry ingestion and access to enrolled machines.",
6
6
  "license": "MIT",