feat(automation): add isolated job delivery mode

This commit is contained in:
William Valentin
2026-02-15 19:23:15 -08:00
parent 0470647ee7
commit 421942f66d
13 changed files with 183 additions and 11 deletions
+19
View File
@@ -114,6 +114,25 @@ describe('WebhookHandler', () => {
expect(messages[0].text).toBe('hello world');
});
it('handleRequest uses isolated sender IDs when delivery mode is isolated_job', async () => {
const webhooks = [makeWebhook()];
handler = new WebhookHandler(webhooks, mockChannelRegistry as any, 'isolated_job');
const messages: InboundMessage[] = [];
handler.onMessage((msg: InboundMessage) => messages.push(msg));
await handler.connect();
const req = mockRequest('hello world');
const res = mockResponse();
const result = await handler.handleRequest('test-hook', req, res);
expect(result).toBe(true);
expect(messages).toHaveLength(1);
expect(messages[0].senderId).toMatch(/^test-hook:run-/);
expect(messages[0].metadata?.replyPeerId).toBe('test-hook');
expect(messages[0].metadata?.deliveryMode).toBe('isolated_job');
});
it('returns false for unknown webhook', async () => {
handler = new WebhookHandler([], mockChannelRegistry as any);
await handler.connect();