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

Function upsertMetadata

desktop/src/features/agents/ui/agentSessionTranscript.ts:557–591  ·  view source on GitHub ↗
(
  d: TranscriptDraft,
  id: string,
  title: string,
  sections: PromptSection[],
  timestamp: string,
  ctx: TranscriptItemContext,
  acpSource?: string,
)

Source from the content-addressed store, hash-verified

555}
556
557function upsertMetadata(
558 d: TranscriptDraft,
559 id: string,
560 title: string,
561 sections: PromptSection[],
562 timestamp: string,
563 ctx: TranscriptItemContext,
564 acpSource?: string,
565) {
566 const existing = d.itemsById.get(id);
567 if (existing?.type === "metadata") {
568 replaceItem(d, id, {
569 ...existing,
570 sections,
571 channelId: ctx.channelId,
572 turnId: ctx.turnId ?? existing.turnId,
573 sessionId: ctx.sessionId ?? existing.sessionId,
574 acpSource: acpSource ?? existing.acpSource,
575 });
576 return;
577 }
578 sealOpenMessages(d);
579 pushItem(d, {
580 id,
581 type: "metadata",
582 renderClass: "raw-rail",
583 title,
584 sections,
585 timestamp,
586 channelId: ctx.channelId,
587 turnId: ctx.turnId,
588 sessionId: ctx.sessionId,
589 acpSource,
590 });
591}
592
593function isTerminalToolStatus(status: ToolStatus) {
594 return status === "completed" || status === "failed";

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