tycono 0.1.96-beta.49 → 0.1.96-beta.50
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 +11 -4
- package/package.json +1 -1
- package/src/tui/hooks/useApi.ts +1 -4
package/bin/tycono.ts
CHANGED
|
@@ -219,13 +219,20 @@ async function startServerForTui(): Promise<void> {
|
|
|
219
219
|
const logFd = fs.openSync(logFile, 'a');
|
|
220
220
|
const logStream = fs.createWriteStream(logFile, { fd: logFd });
|
|
221
221
|
const origStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
222
|
-
// Redirect
|
|
223
|
-
//
|
|
224
|
-
|
|
225
|
-
|
|
222
|
+
// Redirect ALL non-Ink output to log file.
|
|
223
|
+
// Ink uses stdout.write with ANSI sequences. Server uses console.log (which calls stdout.write).
|
|
224
|
+
// We must intercept stdout.write but ALWAYS pass through to real stdout,
|
|
225
|
+
// just also copy non-Ink output to log file.
|
|
226
|
+
// The key insight: DON'T BLOCK anything — just copy server output to log file.
|
|
227
|
+
// Ink can handle interleaved output by re-rendering.
|
|
226
228
|
console.log = (...args: unknown[]) => { logStream.write(args.join(' ') + '\n'); };
|
|
227
229
|
console.error = (...args: unknown[]) => { logStream.write(args.join(' ') + '\n'); };
|
|
228
230
|
console.warn = (...args: unknown[]) => { logStream.write(args.join(' ') + '\n'); };
|
|
231
|
+
// Also intercept direct stderr.write (used by our debug logging)
|
|
232
|
+
process.stderr.write = ((chunk: any, ...args: any[]) => {
|
|
233
|
+
logStream.write(typeof chunk === 'string' ? chunk : chunk.toString());
|
|
234
|
+
return true;
|
|
235
|
+
}) as any;
|
|
229
236
|
const origLog = (...args: unknown[]) => origStdoutWrite(args.join(' ') + '\n');
|
|
230
237
|
|
|
231
238
|
const { createHttpServer } = await import('../src/api/src/create-server.js');
|
package/package.json
CHANGED
package/src/tui/hooks/useApi.ts
CHANGED
|
@@ -90,13 +90,10 @@ export function useApi(): ApiState {
|
|
|
90
90
|
|
|
91
91
|
setError(null);
|
|
92
92
|
setLoaded(true);
|
|
93
|
-
process.stderr.write(`[useApi] loaded=true company=${comp ? 'yes' : 'no'}\n`);
|
|
94
93
|
} catch (err) {
|
|
95
94
|
if (mountedRef.current) {
|
|
96
|
-
|
|
97
|
-
setError(msg);
|
|
95
|
+
setError(err instanceof Error ? err.message : 'API error');
|
|
98
96
|
setLoaded(true);
|
|
99
|
-
process.stderr.write(`[useApi] loaded=true (error: ${msg})\n`);
|
|
100
97
|
}
|
|
101
98
|
}
|
|
102
99
|
}, []);
|