MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / getWebhookEmitter

Function getWebhookEmitter

server/src/training-agent/webhooks.ts:350–364  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

348}
349
350export function getWebhookEmitter(): WebhookEmitter {
351 if (emitter) return emitter;
352 const m = ensureMaterial();
353 // Production (`NODE_ENV=production`, i.e. fly.io) refuses webhook delivery
354 // to private/loopback/metadata addresses. Dev and CI need loopback for
355 // conformance storyboards using `http://127.0.0.1:<port>` receivers.
356 const allowPrivateIp = process.env.NODE_ENV !== 'production';
357 emitter = createWebhookEmitter({
358 ...(m.kind === 'kms' ? { signerProvider: m.signerProvider } : { signerKey: m.signerKey }),
359 idempotencyKeyStore: memoryWebhookKeyStore(),
360 userAgent: 'adcp-training-agent/1.0',
361 fetch: createWebhookFetch({ allowPrivateIp }),
362 });
363 return emitter;
364}
365
366/** Reset state — tests only. */
367export function resetWebhookSigning(): void {

Callers 1

Calls 2

ensureMaterialFunction · 0.85
createWebhookFetchFunction · 0.85

Tested by

no test coverage detected