tycono 0.1.109 → 0.1.110

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.1.109",
3
+ "version": "0.1.110",
4
4
  "description": "Build an AI company. Watch them work.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -324,35 +324,49 @@ class SupervisorHeartbeat {
324
324
 
325
325
  if (waveCeoSessions.length === 0) return '';
326
326
 
327
- const history: string[] = [];
328
- for (const ses of waveCeoSessions) {
327
+ const exchanges: Array<{ role: 'ceo' | 'supervisor'; text: string }> = [];
328
+ for (const ses of waveCeoSessions.slice(-3)) { // Last 3 sessions only
329
329
  if (!ActivityStream.exists(ses.id)) continue;
330
330
  const events = ActivityStream.readAll(ses.id);
331
331
 
332
- // Extract CEO directives (from messages) and supervisor text responses
332
+ let lastSupervisorText = '';
333
333
  for (const e of events) {
334
334
  if (e.type === 'msg:start' && e.data.task) {
335
- // Extract directive from task (remove system prompt noise)
336
335
  const task = String(e.data.task);
337
336
  const directiveMatch = task.match(/\[CEO (?:Supervisor|Question)\]\s*(.*?)(?:\n|$)/);
338
337
  if (directiveMatch) {
339
- history.push(`CEO: "${directiveMatch[1].slice(0, 100)}"`);
338
+ // Flush previous supervisor response
339
+ if (lastSupervisorText) {
340
+ exchanges.push({ role: 'supervisor', text: lastSupervisorText.slice(0, 100) });
341
+ lastSupervisorText = '';
342
+ }
343
+ exchanges.push({ role: 'ceo', text: directiveMatch[1].slice(0, 80) });
340
344
  }
341
345
  }
346
+ // Accumulate text chunks into one response (not one entry per chunk)
342
347
  if (e.type === 'text' && e.roleId === 'ceo') {
343
348
  const text = String(e.data.text ?? '').trim();
344
- if (text && text.length > 10 && !text.startsWith('#') && !text.startsWith('')) {
345
- history.push(`Supervisor: ${text.slice(0, 150)}`);
349
+ if (text && !text.startsWith('#') && !text.startsWith('\u26D4')) {
350
+ lastSupervisorText += text + ' ';
346
351
  }
347
352
  }
353
+ if (e.type === 'msg:done' && lastSupervisorText) {
354
+ exchanges.push({ role: 'supervisor', text: lastSupervisorText.trim().slice(0, 100) });
355
+ lastSupervisorText = '';
356
+ }
348
357
  }
349
358
  }
350
359
 
351
- if (history.length === 0) return '';
360
+ if (exchanges.length === 0) return '';
361
+
362
+ // Keep last 4 exchanges (2 Q&A pairs), cap total at 500 chars
363
+ const recent = exchanges.slice(-4);
364
+ const formatted = recent.map(e =>
365
+ e.role === 'ceo' ? `CEO: "${e.text}"` : `→ ${e.text}`
366
+ ).join('\n');
352
367
 
353
- // Keep last 10 exchanges to fit in context
354
- const recent = history.slice(-10);
355
- return `\n[Previous Conversation in Wave ${waveId}]\n${recent.join('\n')}\n`;
368
+ if (formatted.length > 500) return `\n[Previous conversation]\n${formatted.slice(-500)}\n`;
369
+ return `\n[Previous conversation]\n${formatted}\n`;
356
370
  } catch {
357
371
  return '';
358
372
  }