tycono 0.1.110 → 0.1.111
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
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
import { executionManager, type Execution } from './execution-manager.js';
|
|
15
15
|
import { createSession, getSession, listSessions, addMessage, type Message } from './session-store.js';
|
|
16
16
|
import { buildOrgTree, getSubordinates } from '../engine/org-tree.js';
|
|
17
|
+
import fs from 'node:fs';
|
|
18
|
+
import path from 'node:path';
|
|
17
19
|
import { COMPANY_ROOT } from './file-reader.js';
|
|
18
20
|
import { ActivityStream } from './activity-stream.js';
|
|
19
21
|
import { saveCompletedWave } from './wave-tracker.js';
|
|
@@ -138,9 +140,18 @@ class SupervisorHeartbeat {
|
|
|
138
140
|
if (waveSessions.length > 0) {
|
|
139
141
|
// Restore supervisor state for this wave
|
|
140
142
|
const ceoSession = waveSessions.find(s => s.roleId === 'ceo');
|
|
143
|
+
// Read original directive from wave artifact file (not the new text)
|
|
144
|
+
let originalDirective = '';
|
|
145
|
+
try {
|
|
146
|
+
const waveFile = path.join(COMPANY_ROOT, 'operations', 'waves', `${waveId}.json`);
|
|
147
|
+
if (fs.existsSync(waveFile)) {
|
|
148
|
+
const waveData = JSON.parse(fs.readFileSync(waveFile, 'utf-8'));
|
|
149
|
+
originalDirective = waveData.directive ?? '';
|
|
150
|
+
}
|
|
151
|
+
} catch { /* ignore */ }
|
|
141
152
|
state = {
|
|
142
153
|
waveId,
|
|
143
|
-
directive: text,
|
|
154
|
+
directive: originalDirective || text,
|
|
144
155
|
continuous: false,
|
|
145
156
|
supervisorSessionId: ceoSession?.id ?? null,
|
|
146
157
|
executionId: null,
|
|
@@ -318,10 +329,12 @@ class SupervisorHeartbeat {
|
|
|
318
329
|
try {
|
|
319
330
|
// Find CEO sessions for this wave from session-store
|
|
320
331
|
const allSessions = listSessions();
|
|
332
|
+
console.log(`[WaveHistory] Loading for wave=${waveId}, total sessions=${allSessions.length}`);
|
|
321
333
|
const waveCeoSessions = allSessions
|
|
322
334
|
.filter(s => s.waveId === waveId && s.roleId === 'ceo')
|
|
323
335
|
.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
324
336
|
|
|
337
|
+
console.log(`[WaveHistory] Found ${waveCeoSessions.length} CEO sessions for wave=${waveId}: ${waveCeoSessions.map(s => s.id).join(', ')}`);
|
|
325
338
|
if (waveCeoSessions.length === 0) return '';
|
|
326
339
|
|
|
327
340
|
const exchanges: Array<{ role: 'ceo' | 'supervisor'; text: string }> = [];
|
|
@@ -365,8 +378,11 @@ class SupervisorHeartbeat {
|
|
|
365
378
|
e.role === 'ceo' ? `CEO: "${e.text}"` : `→ ${e.text}`
|
|
366
379
|
).join('\n');
|
|
367
380
|
|
|
368
|
-
|
|
369
|
-
|
|
381
|
+
const result = formatted.length > 500
|
|
382
|
+
? `\n[Previous conversation]\n${formatted.slice(-500)}\n`
|
|
383
|
+
: `\n[Previous conversation]\n${formatted}\n`;
|
|
384
|
+
console.log(`[WaveHistory] Result (${result.length} chars): ${result.slice(0, 200)}`);
|
|
385
|
+
return result;
|
|
370
386
|
} catch {
|
|
371
387
|
return '';
|
|
372
388
|
}
|