MCPcopy Index your code
hub / github.com/simstudioai/sim / handleAborted

Function handleAborted

apps/sim/lib/copilot/request/lifecycle/finalize.ts:75–105  ·  view source on GitHub ↗
(
  result: OrchestratorResult,
  publisher: StreamWriter,
  runId: string,
  requestId: string
)

Source from the content-addressed store, hash-verified

73}
74
75async function handleAborted(
76 result: OrchestratorResult,
77 publisher: StreamWriter,
78 runId: string,
79 requestId: string
80): Promise<void> {
81 const partialContentLen = result.content?.length ?? 0
82 const toolCallCount = result.toolCalls?.length ?? 0
83 const blockCount = result.contentBlocks?.length ?? 0
84 logger.info(`[${requestId}] Stream aborted by explicit stop`, {
85 partialContentLen,
86 toolCallCount,
87 blockCount,
88 })
89 if (!publisher.sawComplete) {
90 const partialContent = result.content || undefined
91 await publisher.publish({
92 type: MothershipStreamV1EventType.complete,
93 payload: {
94 status: MothershipStreamV1CompletionStatus.cancelled,
95 ...(partialContent ? { partialContent } : {}),
96 ...(partialContentLen ? { partialContentLen } : {}),
97 ...(toolCallCount ? { toolCallCount } : {}),
98 },
99 })
100 }
101 await publisher.flush()
102 await loggedRunStatusUpdate(runId, MothershipStreamV1CompletionStatus.cancelled, requestId, {
103 completedAt: new Date(),
104 })
105}
106
107async function handleError(
108 result: OrchestratorResult,

Callers 1

finalizeStreamFunction · 0.85

Calls 4

loggedRunStatusUpdateFunction · 0.85
infoMethod · 0.80
publishMethod · 0.65
flushMethod · 0.45

Tested by

no test coverage detected