(
state: MakaPiTranscriptState,
update: ShellRunUpdate,
options?: {
/**
* Whether a running → settled flip appends a transcript-tail notice.
* Default true for live updates. Hydration catch-up (`listShellRunUpdates`)
* passes false: replaying durable state is not a live event, and the notice
* is never persisted, so announcing catch-up would re-announce on every
* session attach.
*/
announceSettle?: boolean;
},
)
| 260 | } |
| 261 | |
| 262 | export function applyShellRunViewUpdateToTranscript( |
| 263 | state: MakaPiTranscriptState, |
| 264 | update: ShellRunUpdate, |
| 265 | options?: { |
| 266 | /** |
| 267 | * Whether a running → settled flip appends a transcript-tail notice. |
| 268 | * Default true for live updates. Hydration catch-up (`listShellRunUpdates`) |
| 269 | * passes false: replaying durable state is not a live event, and the notice |
| 270 | * is never persisted, so announcing catch-up would re-announce on every |
| 271 | * session attach. |
| 272 | */ |
| 273 | announceSettle?: boolean; |
| 274 | }, |
| 275 | ): boolean { |
| 276 | const tool = findToolEntry(state, update.sourceToolCallId); |
| 277 | const wasLive = isLiveShellRunCard(tool); |
| 278 | const applied = applyShellRunUpdateToTranscript(state, update.sourceToolCallId, update.result); |
| 279 | if (tool && wasLive && isSettledShellRunCard(tool) && options?.announceSettle !== false) { |
| 280 | pushShellRunSettledNotice(state, tool); |
| 281 | } |
| 282 | if ( |
| 283 | !tool || |
| 284 | tool.toolName !== 'Bash' || |
| 285 | tool.result?.kind !== 'shell_run' || |
| 286 | tool.result.ref !== update.result.ref || |
| 287 | !isActiveShellRunStatus(tool.result.status) |
| 288 | ) |
| 289 | return applied; |
| 290 | const status = |
| 291 | update.ownership.kind === 'local' |
| 292 | ? 'running' |
| 293 | : update.ownership.kind === 'source_owned' |
| 294 | ? 'detached' |
| 295 | : 'unavailable'; |
| 296 | if (tool.status === status) return applied; |
| 297 | tool.status = status; |
| 298 | return true; |
| 299 | } |
| 300 | |
| 301 | export function applyShellRunUpdateToTranscript( |
| 302 | state: MakaPiTranscriptState, |
no test coverage detected