tycono 0.3.4 → 0.3.5
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 +1 -1
- package/src/tui/app.tsx +15 -3
package/package.json
CHANGED
package/src/tui/app.tsx
CHANGED
|
@@ -361,27 +361,39 @@ export const App: React.FC = () => {
|
|
|
361
361
|
const sse = useSSE(focusedWaveId);
|
|
362
362
|
|
|
363
363
|
// Load wave history into SSE events (for Panel Mode Stream tab)
|
|
364
|
+
const historyLoadingRef = useRef<string | null>(null);
|
|
364
365
|
const loadWaveHistoryEvents = useCallback(async (waveId: string) => {
|
|
366
|
+
// Guard: skip if already loading this wave or another load in progress
|
|
367
|
+
if (historyLoadingRef.current === waveId) return;
|
|
368
|
+
historyLoadingRef.current = waveId;
|
|
369
|
+
|
|
365
370
|
try {
|
|
366
371
|
const sessions = api.sessions.filter(s => s.waveId === waveId && s.roleId === 'ceo');
|
|
367
372
|
const allEvents: import('./api').SSEEvent[] = [];
|
|
368
373
|
|
|
369
374
|
for (const ses of sessions.slice(-2)) {
|
|
375
|
+
// Abort if wave changed during loading
|
|
376
|
+
if (historyLoadingRef.current !== waveId) return;
|
|
370
377
|
try {
|
|
371
378
|
const resp = await import('./api').then(m => m.fetchJson<{ events: any[] }>(`/api/jobs/${ses.id}/history`));
|
|
372
379
|
const events = resp?.events ?? [];
|
|
373
380
|
for (const e of events) {
|
|
374
|
-
if (['text', 'tool:start', '
|
|
381
|
+
if (['text', 'tool:start', 'msg:start', 'msg:done', 'msg:error', 'dispatch:start', 'thinking'].includes(e.type)) {
|
|
375
382
|
allEvents.push(e as import('./api').SSEEvent);
|
|
376
383
|
}
|
|
377
384
|
}
|
|
378
385
|
} catch { /* skip */ }
|
|
379
386
|
}
|
|
380
387
|
|
|
381
|
-
if
|
|
388
|
+
// Only apply if still on this wave
|
|
389
|
+
if (historyLoadingRef.current === waveId && allEvents.length > 0) {
|
|
382
390
|
sse.loadHistory(allEvents);
|
|
383
391
|
}
|
|
384
|
-
} catch { /* ignore */ }
|
|
392
|
+
} catch { /* ignore */ } finally {
|
|
393
|
+
if (historyLoadingRef.current === waveId) {
|
|
394
|
+
historyLoadingRef.current = null;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
385
397
|
}, [api.sessions, sse]);
|
|
386
398
|
|
|
387
399
|
// Build org tree — flatRoleIds follows visual top-to-bottom order
|