(ctx: DevtoolsMiddlewareContext)
| 185 | } |
| 186 | |
| 187 | function 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. |
no outgoing calls
no test coverage detected