(...args)
| 174 | // Wrap an emit so a misbehaving subscriber cannot bubble into the host chat |
| 175 | // engine. Instrumentation must never break the host app. |
| 176 | const safeEmit: typeof aiEventClient.emit = (...args) => { |
| 177 | try { |
| 178 | aiEventClient.emit(...args) |
| 179 | } catch (error) { |
| 180 | console.error( |
| 181 | `[ai-devtools] subscriber threw while handling "${String(args[0])}" event`, |
| 182 | error, |
| 183 | ) |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | function buildEventContext(ctx: DevtoolsMiddlewareContext) { |
| 188 | return { |
no test coverage detected