MCPcopy
hub / github.com/TanStack/ai / open

Method open

packages/ai-sandbox/src/run-log.ts:134–148  ·  view source on GitHub ↗
(input: { runId: string; threadId?: string })

Source from the content-addressed store, hash-verified

132 // (rather than throwing synchronously from a Promise-typed method — a
133 // `.catch()` footgun) without an `await`-less async body.
134 open(input: { runId: string; threadId?: string }): Promise<RunRecord> {
135 const existing = this.runs.get(input.runId)
136 if (existing) return Promise.resolve({ ...existing.record })
137 const now = this.now()
138 const record: RunRecord = {
139 runId: input.runId,
140 ...(input.threadId !== undefined ? { threadId: input.threadId } : {}),
141 status: 'running',
142 lastSeq: -1,
143 createdAt: now,
144 updatedAt: now,
145 }
146 this.runs.set(input.runId, { record, chunks: [], waiters: new Set() })
147 return Promise.resolve({ ...record })
148 }
149
150 append(runId: string, chunk: StreamChunk): Promise<number> {
151 const state = this.runs.get(runId)

Callers 3

pipeToRunLogFunction · 0.45
run-log.test.tsFile · 0.45
McpAppsPageFunction · 0.45

Calls 4

nowMethod · 0.95
resolveMethod · 0.80
getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected