@copilotkit/runtime
Version:
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
1 lines • 1.73 kB
Source Map (JSON)
{"version":3,"file":"debug-event-bus.cjs","names":[],"sources":["../../../../src/v2/runtime/core/debug-event-bus.ts"],"sourcesContent":["import { BaseEvent } from \"@ag-ui/client\";\nimport { DebugEventEnvelope } from \"@copilotkit/shared\";\n\nexport type DebugEventListener = (envelope: DebugEventEnvelope) => void;\n\nexport class DebugEventBus {\n private listeners = new Set<DebugEventListener>();\n\n subscribe(listener: DebugEventListener): () => void {\n this.listeners.add(listener);\n return () => {\n this.listeners.delete(listener);\n };\n }\n\n broadcast(\n event: BaseEvent,\n metadata: { agentId: string; threadId: string; runId: string },\n ): void {\n if (this.listeners.size === 0) return;\n\n const envelope: DebugEventEnvelope = {\n timestamp: Date.now(),\n agentId: metadata.agentId,\n threadId: metadata.threadId,\n runId: metadata.runId,\n event,\n };\n\n for (const listener of this.listeners) {\n try {\n listener(envelope);\n } catch (err) {\n console.warn(\n \"[DebugEventBus] Listener error suppressed:\",\n err instanceof Error ? err.message : err,\n );\n }\n }\n }\n\n get listenerCount(): number {\n return this.listeners.size;\n }\n}\n"],"mappings":";;;AAKA,IAAa,gBAAb,MAA2B;;mCACL,IAAI,KAAyB;;CAEjD,UAAU,UAA0C;AAClD,OAAK,UAAU,IAAI,SAAS;AAC5B,eAAa;AACX,QAAK,UAAU,OAAO,SAAS;;;CAInC,UACE,OACA,UACM;AACN,MAAI,KAAK,UAAU,SAAS,EAAG;EAE/B,MAAM,WAA+B;GACnC,WAAW,KAAK,KAAK;GACrB,SAAS,SAAS;GAClB,UAAU,SAAS;GACnB,OAAO,SAAS;GAChB;GACD;AAED,OAAK,MAAM,YAAY,KAAK,UAC1B,KAAI;AACF,YAAS,SAAS;WACX,KAAK;AACZ,WAAQ,KACN,8CACA,eAAe,QAAQ,IAAI,UAAU,IACtC;;;CAKP,IAAI,gBAAwB;AAC1B,SAAO,KAAK,UAAU"}