MCPcopy Create free account
hub / github.com/TanStack/ai / takeRunlessRunId

Method takeRunlessRunId

packages/ai-client/src/client-persistor.ts:293–304  ·  view source on GitHub ↗

* Consume the current runless run id (if any), forgetting it. Used when an * ignored, runId-less RUN_ERROR drains the run the client is still tracking.

()

Source from the content-addressed store, hash-verified

291 * ignored, runId-less RUN_ERROR drains the run the client is still tracking.
292 */
293 takeRunlessRunId(): string | null {
294 const runId = this.currentRunlessRunId
295 if (!runId) return null
296 this.ignoredActiveRunIds.delete(runId)
297 this.clearedRunIds.delete(runId)
298 // Advance to another still-ignored run (mirroring `onRunSettled`) so that
299 // when two cleared runs drain concurrently, draining one via a runId-less
300 // RUN_ERROR doesn't stop suppressing the other's runless content.
301 this.currentRunlessRunId =
302 this.ignoredActiveRunIds.values().next().value ?? null
303 return runId
304 }
305
306 private markIgnoredChunkIds(chunk: StreamChunk): void {
307 const messageId = getChunkMessageId(chunk)

Callers 2

Calls 2

valuesMethod · 0.80
deleteMethod · 0.65

Tested by

no test coverage detected