tycono 0.3.2 → 0.3.3

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.3",
4
4
  "description": "Build an AI company. Watch them work.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/tui/app.tsx CHANGED
@@ -258,6 +258,30 @@ export const App: React.FC = () => {
258
258
  });
259
259
  }, []);
260
260
 
261
+ // Load wave history into SSE events (for Panel Mode Stream tab)
262
+ const loadWaveHistoryEvents = useCallback(async (waveId: string) => {
263
+ try {
264
+ const sessions = api.sessions.filter(s => s.waveId === waveId && s.roleId === 'ceo');
265
+ const allEvents: import('./api').SSEEvent[] = [];
266
+
267
+ for (const ses of sessions.slice(-2)) {
268
+ try {
269
+ const resp = await import('./api').then(m => m.fetchJson<{ events: any[] }>(`/api/jobs/${ses.id}/history`));
270
+ const events = resp?.events ?? [];
271
+ for (const e of events) {
272
+ if (['text', 'tool:start', 'tool:result', 'msg:start', 'msg:done', 'msg:error', 'dispatch:start', 'thinking'].includes(e.type)) {
273
+ allEvents.push(e as import('./api').SSEEvent);
274
+ }
275
+ }
276
+ } catch { /* skip */ }
277
+ }
278
+
279
+ if (allEvents.length > 0) {
280
+ sse.loadHistory(allEvents);
281
+ }
282
+ } catch { /* ignore */ }
283
+ }, [api.sessions, sse]);
284
+
261
285
  // Load previous conversation from wave's activity stream into system messages
262
286
  const loadPreviousConversation = useCallback(async (waveId: string) => {
263
287
  try {
@@ -338,6 +362,7 @@ export const App: React.FC = () => {
338
362
  // Load previous conversation into stream (like claude --resume)
339
363
  if (lastWave) {
340
364
  loadPreviousConversation(lastWave.waveId);
365
+ loadWaveHistoryEvents(lastWave.waveId);
341
366
  }
342
367
  } else if (api.loaded) {
343
368
  // No active waves, no past waves — fresh start
@@ -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
  }