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

Function buildEventContext

packages/ai-event-client/src/devtools-middleware.ts:187–211  ·  view source on GitHub ↗
(ctx: DevtoolsMiddlewareContext)

Source from the content-addressed store, hash-verified

185}
186
187function buildEventContext(ctx: DevtoolsMiddlewareContext) {
188 return {
189 requestId: ctx.requestId,
190 streamId: ctx.streamId,
191 runId: ctx.runId,
192 threadId: ctx.threadId,
193 provider: ctx.provider,
194 model: ctx.model,
195 clientId: ctx.conversationId,
196 source: ctx.source,
197 // Devtools wire payload is plain strings; per-prompt metadata is
198 // irrelevant for observation and would require devtools-UI changes to
199 // render. Project metadata away here so the wire shape is unchanged.
200 systemPrompts:
201 ctx.systemPrompts.length > 0
202 ? ctx.systemPrompts.map((p) => (typeof p === 'string' ? p : p.content))
203 : undefined,
204 toolNames: ctx.toolNames,
205 options: ctx.options,
206 modelOptions: ctx.modelOptions,
207 messageCount: ctx.messageCount,
208 hasTools: ctx.hasTools,
209 streaming: ctx.streaming,
210 }
211}
212
213/**
214 * Extract text content from a ModelMessage content field.

Callers 5

onStartFunction · 0.85
onIterationFunction · 0.85
onChunkFunction · 0.85
onToolPhaseCompleteFunction · 0.85
onFinishFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected