tycono 0.2.0 → 0.3.1
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 +42 -1
package/package.json
CHANGED
package/src/tui/app.tsx
CHANGED
|
@@ -258,6 +258,41 @@ export const App: React.FC = () => {
|
|
|
258
258
|
});
|
|
259
259
|
}, []);
|
|
260
260
|
|
|
261
|
+
// Load previous conversation from wave's activity stream into system messages
|
|
262
|
+
const loadPreviousConversation = useCallback(async (waveId: string) => {
|
|
263
|
+
try {
|
|
264
|
+
const sessions = api.sessions.filter(s => s.waveId === waveId && s.roleId === 'ceo');
|
|
265
|
+
if (sessions.length === 0) return;
|
|
266
|
+
|
|
267
|
+
for (const ses of sessions.slice(-2)) { // Last 2 sessions
|
|
268
|
+
try {
|
|
269
|
+
const resp = await import('./api').then(m => m.fetchJson<{ events: any[] }>(`/api/jobs/${ses.id}/history`));
|
|
270
|
+
const events = resp?.events ?? (Array.isArray(resp) ? resp : []);
|
|
271
|
+
if (!events.length) continue;
|
|
272
|
+
|
|
273
|
+
for (const e of events) {
|
|
274
|
+
if (e.type === 'msg:start' && e.data?.task) {
|
|
275
|
+
const task = String(e.data.task);
|
|
276
|
+
const match = task.match(/\[CEO (?:Supervisor|Question)\]\s*(.*?)(?:\n|$)/);
|
|
277
|
+
if (match) {
|
|
278
|
+
addSystemMessage(`> ${match[1].slice(0, 80)}`, 'green');
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (e.type === 'text' && e.roleId === 'ceo') {
|
|
282
|
+
const text = String(e.data?.text ?? '').trim();
|
|
283
|
+
if (text && text.length > 5 && !text.startsWith('#') && !text.startsWith('\u26D4') && !text.startsWith('[')) {
|
|
284
|
+
addSystemMessage(text.slice(0, 200), 'white');
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
} catch { /* skip individual session errors */ }
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
addSystemMessage('\u2500'.repeat(40), 'gray');
|
|
292
|
+
addSystemMessage('(previous conversation loaded)', 'gray');
|
|
293
|
+
} catch { /* ignore */ }
|
|
294
|
+
}, [api.sessions, addSystemMessage]);
|
|
295
|
+
|
|
261
296
|
// Auto-wave: on dashboard entry, create an empty wave or attach to existing
|
|
262
297
|
useEffect(() => {
|
|
263
298
|
if (view !== 'dashboard' || autoWaveCreated.current) return;
|
|
@@ -297,7 +332,13 @@ export const App: React.FC = () => {
|
|
|
297
332
|
pastEntries.sort((a, b) => a.startedAt - b.startedAt);
|
|
298
333
|
setWaves(pastEntries);
|
|
299
334
|
// Focus most recent wave (last in sorted list)
|
|
300
|
-
|
|
335
|
+
const lastWave = pastEntries[pastEntries.length - 1];
|
|
336
|
+
setFocusedWaveId(lastWave?.waveId ?? null);
|
|
337
|
+
|
|
338
|
+
// Load previous conversation into stream (like claude --resume)
|
|
339
|
+
if (lastWave) {
|
|
340
|
+
loadPreviousConversation(lastWave.waveId);
|
|
341
|
+
}
|
|
301
342
|
} else if (api.loaded) {
|
|
302
343
|
// No active waves, no past waves — fresh start
|
|
303
344
|
autoWaveCreated.current = true;
|