MCPcopy Create free account
hub / github.com/block/buzz / replaceLifecycleItem

Function replaceLifecycleItem

desktop/src/features/agents/ui/agentSessionTranscript.ts:445–486  ·  view source on GitHub ↗
(
  d: TranscriptDraft,
  id: string,
  renderClass: Extract<
    AgentActivityRenderClass,
    "status" | "permission" | "error"
  >,
  title: string,
  text: string,
  timestamp: string,
  ctx: TranscriptItemContext,
  acpSource?: string,
)

Source from the content-addressed store, hash-verified

443// appending. Used for coalescing fields (e.g. usage_update) where only the
444// latest value is meaningful — repeated updates must not accumulate.
445function replaceLifecycleItem(
446 d: TranscriptDraft,
447 id: string,
448 renderClass: Extract<
449 AgentActivityRenderClass,
450 "status" | "permission" | "error"
451 >,
452 title: string,
453 text: string,
454 timestamp: string,
455 ctx: TranscriptItemContext,
456 acpSource?: string,
457) {
458 const existing = d.itemsById.get(id);
459 if (existing?.type === "lifecycle") {
460 replaceItem(d, id, {
461 ...existing,
462 renderClass,
463 title,
464 text,
465 channelId: ctx.channelId,
466 turnId: ctx.turnId ?? existing.turnId,
467 sessionId: ctx.sessionId ?? existing.sessionId,
468 acpSource: acpSource ?? existing.acpSource,
469 });
470 return;
471 }
472
473 sealOpenMessages(d);
474 pushItem(d, {
475 id,
476 type: "lifecycle",
477 renderClass,
478 title,
479 text,
480 timestamp,
481 channelId: ctx.channelId,
482 turnId: ctx.turnId,
483 sessionId: ctx.sessionId,
484 acpSource,
485 });
486}
487
488function upsertPlan(
489 d: TranscriptDraft,

Callers 1

processTranscriptEventFunction · 0.85

Calls 4

replaceItemFunction · 0.85
sealOpenMessagesFunction · 0.85
pushItemFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected