tycono 0.1.104 → 0.1.106

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tycono",
3
- "version": "0.1.104",
3
+ "version": "0.1.106",
4
4
  "description": "Build an AI company. Watch them work.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -60,14 +60,22 @@ export function createApp() {
60
60
 
61
61
  // Debug: memory stats for leak detection
62
62
  app.get('/api/debug/memory', (_req, res) => {
63
- const { executionManager } = require('./services/execution-manager.js');
64
- const { listSessions } = require('./services/session-store.js');
65
63
  const mem = process.memoryUsage();
66
- res.json({
67
- heap: { used: Math.round(mem.heapUsed / 1024 / 1024), total: Math.round(mem.heapTotal / 1024 / 1024) },
68
- rss: Math.round(mem.rss / 1024 / 1024),
69
- execManager: executionManager.getMemoryStats(),
70
- sessions: listSessions().length,
64
+ // Import dynamically to avoid circular deps
65
+ import('./services/execution-manager.js').then(({ executionManager }) => {
66
+ import('./services/session-store.js').then(({ listSessions }) => {
67
+ res.json({
68
+ heap: { used: Math.round(mem.heapUsed / 1024 / 1024), total: Math.round(mem.heapTotal / 1024 / 1024) },
69
+ rss: Math.round(mem.rss / 1024 / 1024),
70
+ execManager: executionManager.getMemoryStats(),
71
+ sessions: listSessions().length,
72
+ });
73
+ });
74
+ }).catch(() => {
75
+ res.json({
76
+ heap: { used: Math.round(mem.heapUsed / 1024 / 1024), total: Math.round(mem.heapTotal / 1024 / 1024) },
77
+ rss: Math.round(mem.rss / 1024 / 1024),
78
+ });
71
79
  });
72
80
  });
73
81
 
@@ -299,18 +299,21 @@ export const CommandMode: React.FC<CommandModeProps> = ({
299
299
  }
300
300
 
301
301
  // Merge user inputs + system messages + event lines (cap total)
302
- const allLines = [...userInputs, ...systemMessages, ...eventLines].slice(-100);
302
+ const allLines = [...userInputs, ...systemMessages, ...eventLines].slice(-60);
303
303
 
304
- // Split into committed (scrollback) and live (re-rendered)
305
- const newCommitted = allLines.slice(committedRef.current);
306
- if (newCommitted.length > 6) {
307
- const toCommit = newCommitted.slice(0, -6);
308
- committedRef.current += toCommit.length;
304
+ // Reset committedRef if it exceeds allLines (prevents unbounded growth)
305
+ if (committedRef.current > allLines.length) {
306
+ committedRef.current = Math.max(0, allLines.length - 6);
309
307
  }
310
308
 
311
- // Cap committed to prevent Static from holding too many items
312
- const rawCommitted = allLines.slice(0, committedRef.current);
313
- const committedLines = rawCommitted.length > 50 ? rawCommitted.slice(-50) : rawCommitted;
309
+ // Commit older lines to Static scrollback, keep last 6 as live
310
+ const newCount = allLines.length - committedRef.current;
311
+ if (newCount > 6) {
312
+ committedRef.current = allLines.length - 6;
313
+ }
314
+
315
+ // Only send last 20 committed items to Static (prevent Ink memory growth)
316
+ const committedLines = allLines.slice(Math.max(0, committedRef.current - 20), committedRef.current);
314
317
  const liveLines = allLines.slice(committedRef.current);
315
318
 
316
319
  // Quick bar navigation
@@ -118,7 +118,10 @@ export function useSSE(waveId: string | null): SSEState {
118
118
  reconnectAttemptRef.current = 0;
119
119
 
120
120
  // Add to batch buffer (don't trigger React re-render yet)
121
- batchRef.current.push(trimEvent(event));
121
+ // Cap batch to prevent unbounded growth if flush is delayed
122
+ if (batchRef.current.length < 50) {
123
+ batchRef.current.push(trimEvent(event));
124
+ }
122
125
 
123
126
  // Schedule flush if not already scheduled
124
127
  if (!batchTimerRef.current) {