(
status: MothershipStreamV1CompletionStatus,
options?: { message?: string; code: string; reason?: string }
)
| 345 | } |
| 346 | |
| 347 | const emitTerminalIfMissing = ( |
| 348 | status: MothershipStreamV1CompletionStatus, |
| 349 | options?: { message?: string; code: string; reason?: string } |
| 350 | ) => { |
| 351 | if (controllerClosed || sawTerminalEvent) { |
| 352 | return |
| 353 | } |
| 354 | for (const envelope of buildResumeTerminalEnvelopes({ |
| 355 | streamId, |
| 356 | afterCursor: cursor, |
| 357 | status, |
| 358 | message: options?.message, |
| 359 | code: options?.code ?? 'resume_terminal', |
| 360 | reason: options?.reason, |
| 361 | requestId: currentRequestId, |
| 362 | })) { |
| 363 | if (!enqueueEvent(envelope)) { |
| 364 | break |
| 365 | } |
| 366 | cursor = envelope.stream.cursor ?? String(envelope.seq) |
| 367 | if (envelope.type === MothershipStreamV1EventType.complete) { |
| 368 | sawTerminalEvent = true |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | try { |
| 374 | enqueueComment('accepted') |
no test coverage detected