flavor-code 1.3.13 → 1.3.15

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.
@@ -24993,9 +24993,28 @@ async function createProductionRuntime(options) {
24993
24993
  const recovered = options.resumeSession === void 0 ? void 0 : await sessionStore.load(options.resumeSession === true ? void 0 : options.resumeSession);
24994
24994
  let timelineState = recovered === void 0 ? createTranscriptState() : restoreTranscriptState(recovered.timeline.state);
24995
24995
  const restoredTranscript = restoreTranscriptState(timelineState);
24996
+ const pendingTimelineStreams = [];
24997
+ const flushTimelineStreams = () => {
24998
+ for (const pending2 of pendingTimelineStreams.splice(0)) {
24999
+ timelineState = transcriptReducer(timelineState, {
25000
+ type: "session",
25001
+ event: { type: pending2.type, text: pending2.chunks.join("") }
25002
+ });
25003
+ }
25004
+ };
25005
+ const recordTimelineEvent = (event) => {
25006
+ if (event.type === "text" || event.type === "thinking") {
25007
+ const last = pendingTimelineStreams.at(-1);
25008
+ if (last?.type === event.type) last.chunks.push(event.text);
25009
+ else pendingTimelineStreams.push({ type: event.type, chunks: [event.text] });
25010
+ return;
25011
+ }
25012
+ flushTimelineStreams();
25013
+ timelineState = transcriptReducer(timelineState, { type: "session", event });
25014
+ };
24996
25015
  let ideSessionId;
24997
25016
  const emitOutput = (event) => {
24998
- timelineState = transcriptReducer(timelineState, { type: "session", event });
25017
+ recordTimelineEvent(event);
24999
25018
  options.output(event);
25000
25019
  if (ideSessionId !== void 0) ide.publishEvent(ideSessionId, event);
25001
25020
  };
@@ -25412,27 +25431,30 @@ async function createProductionRuntime(options) {
25412
25431
  };
25413
25432
  }
25414
25433
  let persistTail = Promise.resolve();
25415
- const sessionDocument = () => ({
25416
- version: SESSION_VERSION,
25417
- sessionId,
25418
- createdAt,
25419
- updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
25420
- workspace: { path: workspace },
25421
- conversation: storedConversation(harness.main.context.snapshot()),
25422
- tasks: {
25423
- ...taskPlan === void 0 ? {} : { plan: taskPlan },
25424
- ...taskGraph === void 0 ? {} : { graph: taskGraph },
25425
- states: { ...taskStates },
25426
- results: { ...taskResults }
25427
- },
25428
- // Persist the resolved decision, not the harness snapshot: after logout the
25429
- // harness may still hold the old login model, and resuming from that stale
25430
- // value is what made the welcome card show a previous service.
25431
- models: { main: mainModel, subagent: childModel },
25432
- permissionMode: harness.permissionMode,
25433
- memory: memoryLifecycle,
25434
- timeline: { version: 1, state: timelineState }
25435
- });
25434
+ const sessionDocument = () => {
25435
+ flushTimelineStreams();
25436
+ return {
25437
+ version: SESSION_VERSION,
25438
+ sessionId,
25439
+ createdAt,
25440
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString(),
25441
+ workspace: { path: workspace },
25442
+ conversation: storedConversation(harness.main.context.snapshot()),
25443
+ tasks: {
25444
+ ...taskPlan === void 0 ? {} : { plan: taskPlan },
25445
+ ...taskGraph === void 0 ? {} : { graph: taskGraph },
25446
+ states: { ...taskStates },
25447
+ results: { ...taskResults }
25448
+ },
25449
+ // Persist the resolved decision, not the harness snapshot: after logout the
25450
+ // harness may still hold the old login model, and resuming from that stale
25451
+ // value is what made the welcome card show a previous service.
25452
+ models: { main: mainModel, subagent: childModel },
25453
+ permissionMode: harness.permissionMode,
25454
+ memory: memoryLifecycle,
25455
+ timeline: { version: 1, state: timelineState }
25456
+ };
25457
+ };
25436
25458
  let persistFailed = false;
25437
25459
  const persist = () => {
25438
25460
  persistTail = persistTail.catch(() => void 0).then(