tycono 0.1.96-beta.53 → 0.1.96-beta.54

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/bin/tycono.ts CHANGED
@@ -221,13 +221,18 @@ async function startServerForTui(): Promise<void> {
221
221
  const origStdoutWrite = process.stdout.write.bind(process.stdout);
222
222
  const origLog = (...args: unknown[]) => origStdoutWrite(args.join(' ') + '\n');
223
223
 
224
- // Redirect console methods to log file BEFORE importing server code
225
- // This is the ONLY output suppression NO stdout.write hijacking
226
- // Ink needs full control of stdout.write, any interception breaks rendering
224
+ // Redirect ALL output to log file BEFORE importing server code
225
+ // Ink needs stdout clean server must not write to stdout or stderr
227
226
  console.log = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
228
227
  console.error = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
229
228
  console.warn = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
230
229
  console.info = (...a: unknown[]) => { logStream.write(a.join(' ') + '\n'); };
230
+ // Also redirect stderr.write — some code uses process.stderr directly
231
+ const origStderrWrite = process.stderr.write.bind(process.stderr);
232
+ process.stderr.write = ((chunk: any, ...args: any[]) => {
233
+ logStream.write(typeof chunk === 'string' ? chunk : chunk.toString());
234
+ return true;
235
+ }) as any;
231
236
 
232
237
  const { createHttpServer } = await import('../src/api/src/create-server.js');
233
238
  const server = createHttpServer();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tycono",
3
- "version": "0.1.96-beta.53",
3
+ "version": "0.1.96-beta.54",
4
4
  "description": "Build an AI company. Watch them work.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -227,8 +227,11 @@ export function createExpressApp(): express.Application {
227
227
  }
228
228
 
229
229
  app.use((err: Error, req: express.Request, res: express.Response, _next: express.NextFunction) => {
230
- console.error(`[ERROR] ${req.method} ${req.url} — ${err.message}`);
231
230
  const status = err.name === 'FileNotFoundError' ? 404 : 500;
231
+ // Log errors to stderr (not stdout — Ink needs stdout clean)
232
+ if (status >= 500) {
233
+ process.stderr.write(`[ERROR] ${req.method} ${req.url} — ${err.message}\n`);
234
+ }
232
235
  res.status(status).json({ error: err.message });
233
236
  });
234
237