(
d: TranscriptDraft,
id: string,
renderClass: Extract<
AgentActivityRenderClass,
"status" | "permission" | "error"
>,
title: string,
text: string,
timestamp: string,
ctx: TranscriptItemContext,
acpSource?: string,
)
| 443 | // appending. Used for coalescing fields (e.g. usage_update) where only the |
| 444 | // latest value is meaningful — repeated updates must not accumulate. |
| 445 | function 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 | |
| 488 | function upsertPlan( |
| 489 | d: TranscriptDraft, |
no test coverage detected