tycono 0.3.2 → 0.3.4

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.3.2",
3
+ "version": "0.3.4",
4
4
  "description": "Build an AI company. Watch them work.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/tui/app.tsx CHANGED
@@ -338,6 +338,7 @@ export const App: React.FC = () => {
338
338
  // Load previous conversation into stream (like claude --resume)
339
339
  if (lastWave) {
340
340
  loadPreviousConversation(lastWave.waveId);
341
+ loadWaveHistoryEvents(lastWave.waveId);
341
342
  }
342
343
  } else if (api.loaded) {
343
344
  // No active waves, no past waves — fresh start
@@ -359,6 +360,30 @@ export const App: React.FC = () => {
359
360
  // SSE subscription to focused wave
360
361
  const sse = useSSE(focusedWaveId);
361
362
 
363
+ // Load wave history into SSE events (for Panel Mode Stream tab)
364
+ const loadWaveHistoryEvents = useCallback(async (waveId: string) => {
365
+ try {
366
+ const sessions = api.sessions.filter(s => s.waveId === waveId && s.roleId === 'ceo');
367
+ const allEvents: import('./api').SSEEvent[] = [];
368
+
369
+ for (const ses of sessions.slice(-2)) {
370
+ try {
371
+ const resp = await import('./api').then(m => m.fetchJson<{ events: any[] }>(`/api/jobs/${ses.id}/history`));
372
+ const events = resp?.events ?? [];
373
+ for (const e of events) {
374
+ if (['text', 'tool:start', 'tool:result', 'msg:start', 'msg:done', 'msg:error', 'dispatch:start', 'thinking'].includes(e.type)) {
375
+ allEvents.push(e as import('./api').SSEEvent);
376
+ }
377
+ }
378
+ } catch { /* skip */ }
379
+ }
380
+
381
+ if (allEvents.length > 0) {
382
+ sse.loadHistory(allEvents);
383
+ }
384
+ } catch { /* ignore */ }
385
+ }, [api.sessions, sse]);
386
+
362
387
  // Build org tree — flatRoleIds follows visual top-to-bottom order
363
388
  const roles = api.company?.roles ?? [];
364
389
  const statuses = api.execStatus?.statuses ?? {};
@@ -402,8 +427,9 @@ export const App: React.FC = () => {
402
427
  onFocusWave: (waveId) => {
403
428
  setFocusedWaveId(waveId);
404
429
  sse.clearEvents();
405
- setSystemMessages([]); // Clear old messages
430
+ setSystemMessages([]);
406
431
  loadPreviousConversation(waveId);
432
+ loadWaveHistoryEvents(waveId);
407
433
  },
408
434
  onQuit: () => exit(),
409
435
  onShowPanel: () => setMode('panel'),
@@ -651,6 +677,7 @@ export const App: React.FC = () => {
651
677
  sse.clearEvents();
652
678
  setSystemMessages([]);
653
679
  loadPreviousConversation(newWaveId);
680
+ loadWaveHistoryEvents(newWaveId);
654
681
  }}
655
682
  />
656
683
  </Box>
@@ -45,6 +45,7 @@ export interface SSEState {
45
45
  events: SSEEvent[];
46
46
  streamStatus: 'idle' | 'streaming' | 'done' | 'error';
47
47
  clearEvents(): void;
48
+ loadHistory(events: SSEEvent[]): void;
48
49
  }
49
50
 
50
51
  export function useSSE(waveId: string | null): SSEState {
@@ -78,6 +79,10 @@ export function useSSE(waveId: string | null): SSEState {
78
79
  maxSeqRef.current = 0;
79
80
  }, []);
80
81
 
82
+ const loadHistory = useCallback((historyEvents: SSEEvent[]) => {
83
+ setEvents(historyEvents.slice(-MAX_EVENTS));
84
+ }, []);
85
+
81
86
  useEffect(() => {
82
87
  if (waveIdRef.current !== waveId) {
83
88
  connRef.current?.close();
@@ -171,5 +176,5 @@ export function useSSE(waveId: string | null): SSEState {
171
176
  };
172
177
  }, [waveId, flushBatch]);
173
178
 
174
- return { events, streamStatus, clearEvents };
179
+ return { events, streamStatus, clearEvents, loadHistory };
175
180
  }