tycono 0.1.94-beta.3 → 0.1.94-beta.4

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.94-beta.3",
3
+ "version": "0.1.94-beta.4",
4
4
  "description": "Build an AI company. Watch them work.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -272,6 +272,8 @@ export function deleteEmpty(): { deleted: number; ids: string[] } {
272
272
  const ids: string[] = [];
273
273
  for (const [id, session] of cache) {
274
274
  if (session.messages.length === 0) {
275
+ // BUG-008 fix: never delete wave sessions — they are managed by supervisor lifecycle
276
+ if (session.waveId) continue;
275
277
  ids.push(id);
276
278
  }
277
279
  }
@@ -268,6 +268,26 @@ ${cLevelList}
268
268
  - G-04: If you dispatch the same role 3+ times with no progress, intervene: "specify what's wrong concretely."
269
269
  - G-05: abort = graceful amend ("wrap up and stop"). Not a hard kill.
270
270
  - G-06: If two sessions show no events for 3+ minutes, suspect deadlock → re-sequence their work.
271
+ - G-07: **Cross-team relay is YOUR job.** When a C-Level completes, immediately amend the other active C-Levels with a summary of the completed work. Example: CBO finishes game design → amend CTO: "CBO delivered game design docs. Key decisions: [summary]. Review and align your implementation."
272
+ - G-08: Don't just watch passively. On every tick, ask: "Does any active C-Level need information from a completed C-Level?" If yes, amend with the relevant context.
273
+
274
+ ## Cross-Team Relay Protocol (CRITICAL)
275
+ ⛔ C-Levels do NOT talk to each other directly. YOU are the relay.
276
+
277
+ When C-Level A completes while C-Level B is still active:
278
+ 1. Review A's deliverables (read their committed files or final report)
279
+ 2. Summarize the key decisions, artifacts, and constraints from A's work
280
+ 3. amend B: "C-Level A completed. Here are their deliverables relevant to your work: [summary]. Review and incorporate."
281
+ 4. On next tick, verify B acknowledged and reflected A's input
282
+
283
+ When C-Level A produces intermediate results that B needs:
284
+ 1. amend B with the relevant intermediate output
285
+ 2. You don't need to wait for A to finish — relay as results become available
286
+
287
+ Examples:
288
+ - CBO finishes game design → amend CTO: "CBO delivered: world-building doc, 15 monster specs, quest design, UI guidelines. Ensure implementation matches these specs."
289
+ - CTO's engineer creates API schema → amend CBO: "CTO's team defined the data schema. Here's the structure: [summary]. Adjust business docs if needed."
290
+ - Designer finishes UI guide → relay to CTO team: "Designer's UI guide is ready at [path]. Frontend implementation should follow these specs."
271
291
 
272
292
  ## CEO Directive Channel
273
293
  If new CEO directives arrive mid-execution, they will appear in your supervision watch digest
@@ -278,7 +298,7 @@ ${recoveryContext}
278
298
  1. Analyze the directive and decide which C-Level roles to dispatch (not necessarily all)
279
299
  2. Dispatch them with clear tasks
280
300
  3. Enter supervision watch loop
281
- 4. Monitor, relay opinions, course-correct, until all done
301
+ 4. Monitor, **actively relay results between teams**, course-correct, until all done
282
302
  5. Compile results and report`;
283
303
 
284
304
  // Create supervisor session
@@ -232,15 +232,46 @@ export function saveCompletedWave(waveId: string, directive: string): { ok: bool
232
232
  : waveId;
233
233
  const jsonPath = existing ?? path.join(wavesDir, `${baseName}.json`);
234
234
 
235
+ // BUG-009 fix: calculate actual duration from activity stream timestamps
235
236
  const now = new Date();
237
+ let startedAt = now;
238
+ let endedAt = now;
239
+ for (const role of rolesData) {
240
+ if (role.events.length > 0) {
241
+ const firstTs = new Date(role.events[0].ts);
242
+ const lastTs = new Date(role.events[role.events.length - 1].ts);
243
+ if (firstTs < startedAt) startedAt = firstTs;
244
+ if (lastTs > endedAt) endedAt = lastTs;
245
+ }
246
+ for (const child of role.childSessions) {
247
+ if (child.events.length > 0) {
248
+ const firstTs = new Date(child.events[0].ts);
249
+ const lastTs = new Date(child.events[child.events.length - 1].ts);
250
+ if (firstTs < startedAt) startedAt = firstTs;
251
+ if (lastTs > endedAt) endedAt = lastTs;
252
+ }
253
+ }
254
+ }
255
+ const duration = Math.round((endedAt.getTime() - startedAt.getTime()) / 1000);
256
+
257
+ // Collect ALL session IDs including child sessions
258
+ const allSessionIds = [...sessionIds];
259
+ for (const role of rolesData) {
260
+ for (const child of role.childSessions) {
261
+ if (!allSessionIds.includes(child.sessionId)) {
262
+ allSessionIds.push(child.sessionId);
263
+ }
264
+ }
265
+ }
266
+
236
267
  const waveJson = {
237
268
  id: baseName,
238
269
  directive,
239
- startedAt: now.toISOString(),
240
- duration: 0,
270
+ startedAt: startedAt.toISOString(),
271
+ duration,
241
272
  roles: rolesData,
242
273
  waveId,
243
- sessionIds,
274
+ sessionIds: allSessionIds,
244
275
  };
245
276
  fs.writeFileSync(jsonPath, JSON.stringify(waveJson, null, 2), 'utf-8');
246
277