@chatpanel/events 0.84.0 → 0.84.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/team-run.js +10 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chatpanel/events",
3
- "version": "0.84.0",
3
+ "version": "0.84.1",
4
4
  "description": "The canonical ChatPanel event-log and capability contracts \u2014 typed durable facts, clock-free deterministic linearization, schema upcasting, and the invariants the replay harness asserts. Pure, dependency-free ESM shared by the ChatPanel extension, gateway and bridge.",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/team-run.js CHANGED
@@ -269,17 +269,25 @@ export async function runTeam({
269
269
  say('task.model', { taskId: task.id, role: role.id, model: m.model, attempt });
270
270
  attempts.push({ model: m.model, at: now(), continued: !!note });
271
271
  const sent = messagesFor({ transcript }, { prompt, note });
272
+ // The record grows AS THE ATTEMPT GOES: a host that reports each wire message the
273
+ // moment it exists (a tool call, its result) puts it on the record then, so a
274
+ // process that dies mid-attempt leaves the work so far behind it, not nothing.
275
+ let live = sent;
276
+ if (sent.length > transcript.length) recordSteps(transcript, sent);
277
+ const onStep = (message) => { if (message && message.role) { live = [...live, message]; say('task.step', { taskId: task.id, role: role.id, steps: [clipTranscriptOne(message)] }); } };
272
278
  const res = await callModel({
273
279
  runId: id, taskId: task.id, role: role.id, model: m.model, mode: m.mode || role.mode,
274
280
  system: role.prompt, prompt, messages: sent, tools, signal: taskAc.signal,
275
281
  onDelta: (delta, full) => say('task.delta', { taskId: task.id, role: role.id, delta, text: full }),
282
+ onStep,
276
283
  });
277
284
  usage = res?.usage || null;
278
285
  if (usage) budget.charge(usage);
279
286
  // Whatever the attempt did is the task's now — on the record, before any verdict.
280
- const before = transcript;
287
+ // What the host already reported step by step is not reported again.
281
288
  transcript = mergeTranscript(sent, res);
282
- recordSteps(before, transcript);
289
+ if (transcript.length < live.length) transcript = live;
290
+ recordSteps(live, transcript);
283
291
  lastModel = m.model;
284
292
  attempts[attempts.length - 1].status = res?.ok ? (String(res?.text || '').trim() ? 'ok' : 'empty') : 'error';
285
293
  if (askedAndWaiting) { status = 'waiting'; waitingOnPerson = true; break; }