tycono 0.3.31 → 0.3.32
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
|
@@ -499,19 +499,28 @@ Examples:
|
|
|
499
499
|
// If no in-memory history, load from disk (restart case)
|
|
500
500
|
const diskHistory = !directiveHistory ? this.loadWaveHistory(state.waveId) : '';
|
|
501
501
|
|
|
502
|
-
//
|
|
503
|
-
//
|
|
502
|
+
// Append conversation exchange to context file (cumulative, not overwrite).
|
|
503
|
+
// Each turn adds: CEO question + AI response → full multi-turn history preserved.
|
|
504
504
|
let contextFilePath = '';
|
|
505
|
+
const contextDir = path.join(COMPANY_ROOT, '.tycono');
|
|
506
|
+
contextFilePath = path.join(contextDir, `conversation-context-${state.waveId}.md`);
|
|
507
|
+
|
|
508
|
+
// Append current question
|
|
509
|
+
try {
|
|
510
|
+
if (!fs.existsSync(contextDir)) fs.mkdirSync(contextDir, { recursive: true });
|
|
511
|
+
fs.appendFileSync(contextFilePath, `\n---\n**CEO**: ${directive}\n`);
|
|
512
|
+
} catch { /* ignore */ }
|
|
513
|
+
|
|
514
|
+
// Append last AI response
|
|
505
515
|
const sessionIdToCheck = state.supervisorSessionId
|
|
506
516
|
|| listSessions().find(s => s.waveId === state.waveId && s.roleId === 'ceo')?.id;
|
|
507
517
|
if (sessionIdToCheck) {
|
|
508
518
|
try {
|
|
509
519
|
const events = ActivityStream.readAll(sessionIdToCheck);
|
|
510
520
|
const textEvents = events.filter(e => e.type === 'text' && e.roleId === 'ceo');
|
|
511
|
-
const
|
|
512
|
-
if (
|
|
513
|
-
|
|
514
|
-
fs.writeFileSync(contextFilePath, `# Previous CEO Response (Wave ${state.waveId})\n\n${fullText}\n`);
|
|
521
|
+
const lastResponse = textEvents.slice(-5).map(e => String(e.data.text ?? '')).join('\n').trim();
|
|
522
|
+
if (lastResponse) {
|
|
523
|
+
fs.appendFileSync(contextFilePath, `**AI**: ${lastResponse}\n`);
|
|
515
524
|
}
|
|
516
525
|
} catch { /* ignore */ }
|
|
517
526
|
}
|