tycono 0.1.108 → 0.1.109

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.108",
3
+ "version": "0.1.109",
4
4
  "description": "Build an AI company. Watch them work.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -129,8 +129,35 @@ class SupervisorHeartbeat {
129
129
  * Dispatch Protocol Principle 2: tick이 유일한 동기화 지점.
130
130
  */
131
131
  addDirective(waveId: string, text: string): PendingDirective | null {
132
- const state = this.supervisors.get(waveId);
133
- if (!state) return null;
132
+ let state = this.supervisors.get(waveId);
133
+
134
+ // If wave not in memory (e.g., server restarted), restore from disk
135
+ if (!state) {
136
+ // Check if this wave existed before (has sessions in session-store)
137
+ const waveSessions = listSessions().filter(s => s.waveId === waveId);
138
+ if (waveSessions.length > 0) {
139
+ // Restore supervisor state for this wave
140
+ const ceoSession = waveSessions.find(s => s.roleId === 'ceo');
141
+ state = {
142
+ waveId,
143
+ directive: text,
144
+ continuous: false,
145
+ supervisorSessionId: ceoSession?.id ?? null,
146
+ executionId: null,
147
+ status: 'stopped',
148
+ crashCount: 0,
149
+ maxCrashRetries: 10,
150
+ restartTimer: null,
151
+ pendingDirectives: [],
152
+ pendingQuestions: [],
153
+ createdAt: ceoSession?.createdAt ?? new Date().toISOString(),
154
+ };
155
+ this.supervisors.set(waveId, state);
156
+ console.log(`[Supervisor] Restored wave ${waveId} from disk (${waveSessions.length} sessions)`);
157
+ } else {
158
+ return null;
159
+ }
160
+ }
134
161
 
135
162
  const directive: PendingDirective = {
136
163
  id: `dir-${Date.now()}`,