@diegoaltoworks/talker 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/adapters/twilio.d.ts +13 -1
  2. package/dist/adapters/twilio.d.ts.map +1 -1
  3. package/dist/adapters/twilio.test.d.ts +7 -0
  4. package/dist/adapters/twilio.test.d.ts.map +1 -0
  5. package/dist/core/logger.d.ts +6 -0
  6. package/dist/core/logger.d.ts.map +1 -1
  7. package/dist/core/logger.test.d.ts +2 -0
  8. package/dist/core/logger.test.d.ts.map +1 -0
  9. package/dist/core/phrases.d.ts +5 -0
  10. package/dist/core/phrases.d.ts.map +1 -1
  11. package/dist/core/processing/prompts.d.ts +1 -1
  12. package/dist/core/processing/prompts.d.ts.map +1 -1
  13. package/dist/db/migrate.d.ts +1 -1
  14. package/dist/db/migrate.d.ts.map +1 -1
  15. package/dist/index.d.ts +8 -4
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +555 -99
  18. package/dist/index.mjs +537 -90
  19. package/dist/middleware/input-sanitize.d.ts +20 -0
  20. package/dist/middleware/input-sanitize.d.ts.map +1 -0
  21. package/dist/middleware/input-sanitize.test.d.ts +2 -0
  22. package/dist/middleware/input-sanitize.test.d.ts.map +1 -0
  23. package/dist/middleware/rate-limit.d.ts +27 -0
  24. package/dist/middleware/rate-limit.d.ts.map +1 -0
  25. package/dist/middleware/rate-limit.test.d.ts +2 -0
  26. package/dist/middleware/rate-limit.test.d.ts.map +1 -0
  27. package/dist/middleware/twilio-signature.d.ts +32 -0
  28. package/dist/middleware/twilio-signature.d.ts.map +1 -0
  29. package/dist/middleware/twilio-signature.test.d.ts +2 -0
  30. package/dist/middleware/twilio-signature.test.d.ts.map +1 -0
  31. package/dist/plugin.d.ts.map +1 -1
  32. package/dist/routes/call/handle-answer.test.d.ts +7 -0
  33. package/dist/routes/call/handle-answer.test.d.ts.map +1 -0
  34. package/dist/routes/call/handle-initial.test.d.ts +7 -0
  35. package/dist/routes/call/handle-initial.test.d.ts.map +1 -0
  36. package/dist/routes/call/handle-nospeech.test.d.ts +7 -0
  37. package/dist/routes/call/handle-nospeech.test.d.ts.map +1 -0
  38. package/dist/routes/call/handle-respond.test.d.ts +7 -0
  39. package/dist/routes/call/handle-respond.test.d.ts.map +1 -0
  40. package/dist/routes/call/handle-status.test.d.ts +7 -0
  41. package/dist/routes/call/handle-status.test.d.ts.map +1 -0
  42. package/dist/routes/call/index.d.ts.map +1 -1
  43. package/dist/routes/call/pending.test.d.ts +7 -0
  44. package/dist/routes/call/pending.test.d.ts.map +1 -0
  45. package/dist/routes/call/processor.d.ts.map +1 -1
  46. package/dist/routes/sms/handle-incoming.test.d.ts +7 -0
  47. package/dist/routes/sms/handle-incoming.test.d.ts.map +1 -0
  48. package/dist/routes/sms/index.d.ts.map +1 -1
  49. package/dist/routes/whatsapp/handle-incoming.d.ts +12 -0
  50. package/dist/routes/whatsapp/handle-incoming.d.ts.map +1 -0
  51. package/dist/routes/whatsapp/handle-incoming.test.d.ts +7 -0
  52. package/dist/routes/whatsapp/handle-incoming.test.d.ts.map +1 -0
  53. package/dist/routes/whatsapp/index.d.ts +14 -0
  54. package/dist/routes/whatsapp/index.d.ts.map +1 -0
  55. package/dist/routes/whatsapp/processor.d.ts +14 -0
  56. package/dist/routes/whatsapp/processor.d.ts.map +1 -0
  57. package/dist/standalone.d.ts.map +1 -1
  58. package/dist/types.d.ts +20 -2
  59. package/dist/types.d.ts.map +1 -1
  60. package/language/de.json +7 -0
  61. package/language/en.json +7 -0
  62. package/language/es.json +7 -0
  63. package/language/fr.json +7 -0
  64. package/language/nl.json +7 -0
  65. package/language/pt.json +7 -0
  66. package/package.json +1 -1
  67. package/prompts/outgoing.md +16 -1
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Input Sanitization Middleware
3
+ *
4
+ * Enforces a maximum length on user-supplied input fields (SpeechResult, Body).
5
+ * Truncates silently rather than rejecting, since Twilio expects a TwiML response.
6
+ */
7
+ import type { Context, Next } from "hono";
8
+ /**
9
+ * Truncate a string to the max length, appending an ellipsis if truncated.
10
+ */
11
+ export declare function truncateInput(input: string, maxLength: number): string;
12
+ /**
13
+ * Hono middleware factory for input sanitization.
14
+ *
15
+ * Intercepts the request body and truncates SpeechResult and Body fields
16
+ * to the configured maximum length. Stores the sanitized values on the
17
+ * context so downstream handlers see the truncated values.
18
+ */
19
+ export declare function inputSanitizeMiddleware(maxInputLength?: number): (c: Context, next: Next) => Promise<void>;
20
+ //# sourceMappingURL=input-sanitize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-sanitize.d.ts","sourceRoot":"","sources":["../../src/middleware/input-sanitize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAK1C;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGtE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,cAAc,CAAC,EAAE,MAAM,IAG/C,GAAG,OAAO,EAAE,MAAM,IAAI,mBA6BrC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=input-sanitize.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-sanitize.test.d.ts","sourceRoot":"","sources":["../../src/middleware/input-sanitize.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Rate Limiting Middleware
3
+ *
4
+ * Sliding-window rate limiter keyed by caller phone number.
5
+ * Prevents abuse by limiting requests per phone number within a time window.
6
+ */
7
+ import type { Context, Next } from "hono";
8
+ /**
9
+ * Check if a phone number has exceeded the rate limit.
10
+ * Returns true if the request should be allowed.
11
+ */
12
+ export declare function checkRateLimit(phoneNumber: string, maxRequests: number, windowMs: number): boolean;
13
+ /**
14
+ * Hono middleware factory for rate limiting.
15
+ *
16
+ * Limits requests per phone number (from body.From).
17
+ * Returns a 429 TwiML response when the limit is exceeded.
18
+ */
19
+ export declare function rateLimitMiddleware(config?: {
20
+ maxRequests?: number;
21
+ windowMs?: number;
22
+ }): (c: Context, next: Next) => Promise<void | (Response & import("hono").TypedResponse<"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<Response>\n <Say>Please try again in a moment.</Say>\n</Response>", 429, "text">)>;
23
+ /**
24
+ * Reset rate limit store (for testing)
25
+ */
26
+ export declare function resetRateLimitStore(): void;
27
+ //# sourceMappingURL=rate-limit.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-limit.d.ts","sourceRoot":"","sources":["../../src/middleware/rate-limit.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AA4B1C;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,OAAO,CAmBT;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,IAMxE,GAAG,OAAO,EAAE,MAAM,IAAI,iMAerC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAM1C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=rate-limit.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rate-limit.test.d.ts","sourceRoot":"","sources":["../../src/middleware/rate-limit.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Twilio Webhook Signature Validation Middleware
3
+ *
4
+ * Validates that incoming requests are genuinely from Twilio by verifying
5
+ * the X-Twilio-Signature header using HMAC-SHA1 per Twilio's spec.
6
+ *
7
+ * @see https://www.twilio.com/docs/usage/security#validating-requests
8
+ */
9
+ import type { Context, Next } from "hono";
10
+ /**
11
+ * Compute the expected Twilio signature for a request.
12
+ *
13
+ * Algorithm (per Twilio docs):
14
+ * 1. Take the full URL of the request
15
+ * 2. Sort POST body params alphabetically by key
16
+ * 3. Append each key-value pair to the URL (no separators)
17
+ * 4. HMAC-SHA1 the result with the auth token, then Base64 encode
18
+ */
19
+ export declare function computeTwilioSignature(authToken: string, url: string, params: Record<string, string>): string;
20
+ /**
21
+ * Validate a Twilio request signature
22
+ */
23
+ export declare function validateTwilioSignature(authToken: string, signature: string, url: string, params: Record<string, string>): boolean;
24
+ /**
25
+ * Hono middleware factory for Twilio signature validation.
26
+ *
27
+ * When authToken is provided, rejects any request without a valid
28
+ * X-Twilio-Signature header. When authToken is not configured,
29
+ * the middleware is a pass-through (allows development/testing without Twilio).
30
+ */
31
+ export declare function twilioSignatureMiddleware(authToken?: string, baseUrl?: string): (c: Context, next: Next) => Promise<void | (Response & import("hono").TypedResponse<"", 403, "text">)>;
32
+ //# sourceMappingURL=twilio-signature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twilio-signature.d.ts","sourceRoot":"","sources":["../../src/middleware/twilio-signature.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG1C;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,MAAM,CAOR;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC7B,OAAO,CAWT;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,IAC9D,GAAG,OAAO,EAAE,MAAM,IAAI,gFAkCrC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=twilio-signature.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"twilio-signature.test.d.ts","sourceRoot":"","sources":["../../src/middleware/twilio-signature.test.ts"],"names":[],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAQjC,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,SAAS,CAAC;AAMhE;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,IAAI,EACT,WAAW,EAAE,kBAAkB,EAC/B,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CA2Cf"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AASjC,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,SAAS,CAAC;AAMhE;;GAEG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,IAAI,EACT,WAAW,EAAE,kBAAkB,EAC/B,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,IAAI,CAAC,CA4Cf"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Answer Handler Tests
3
+ *
4
+ * Tests for POST /call/answer — async acknowledgment resolution.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=handle-answer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-answer.test.d.ts","sourceRoot":"","sources":["../../../src/routes/call/handle-answer.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Initial Call Handler Tests
3
+ *
4
+ * Tests for POST /call — initial greeting and speech gather.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=handle-initial.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-initial.test.d.ts","sourceRoot":"","sources":["../../../src/routes/call/handle-initial.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * No-Speech Handler Tests
3
+ *
4
+ * Tests for POST /call/no-speech — silence detection retry logic.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=handle-nospeech.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-nospeech.test.d.ts","sourceRoot":"","sources":["../../../src/routes/call/handle-nospeech.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Speech Response Handler Tests
3
+ *
4
+ * Tests for POST /call/respond — speech detection handling.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=handle-respond.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-respond.test.d.ts","sourceRoot":"","sources":["../../../src/routes/call/handle-respond.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Call Status Handler Tests
3
+ *
4
+ * Tests for POST /call/status — call state change webhook.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=handle-status.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-status.test.d.ts","sourceRoot":"","sources":["../../../src/routes/call/handle-status.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/call/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAOtD;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,YAAY,8EAU1E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/call/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAOtD;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,YAAY,8EAoB1E"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Pending Queries Tests
3
+ *
4
+ * Tests for the pending query store used by async acknowledgment pattern.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=pending.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pending.test.d.ts","sourceRoot":"","sources":["../../../src/routes/call/pending.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -1 +1 @@
1
- {"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../../../src/routes/call/processor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;GAEG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CA6DjB"}
1
+ {"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../../../src/routes/call/processor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAWH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;GAEG;AACH,wBAAsB,WAAW,CAC/B,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,MAAM,CAAC,CA8DjB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * SMS Handler Tests
3
+ *
4
+ * Tests for the incoming SMS webhook handler and route factory.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=handle-incoming.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-incoming.test.d.ts","sourceRoot":"","sources":["../../../src/routes/sms/handle-incoming.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/sms/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,YAAY,8EAOzE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/sms/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAIzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,YAAY,8EAYzE"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Incoming WhatsApp Handler
3
+ *
4
+ * Handles POST /whatsapp — called by Twilio when a WhatsApp message arrives.
5
+ * Twilio sends the same webhook format as SMS, but with `whatsapp:` prefixed
6
+ * phone numbers in the From/To fields.
7
+ */
8
+ import type { Context } from "hono";
9
+ import type { FlowRegistry } from "../../flows/registry";
10
+ import type { TalkerDependencies } from "../../types";
11
+ export declare function handleIncomingWhatsApp(c: Context, deps: TalkerDependencies, registry: FlowRegistry): Promise<Response>;
12
+ //# sourceMappingURL=handle-incoming.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-incoming.d.ts","sourceRoot":"","sources":["../../../src/routes/whatsapp/handle-incoming.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAOpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD,wBAAsB,sBAAsB,CAC1C,CAAC,EAAE,OAAO,EACV,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,YAAY,GACrB,OAAO,CAAC,QAAQ,CAAC,CA6BnB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * WhatsApp Handler Tests
3
+ *
4
+ * Tests for the incoming WhatsApp webhook handler and route factory.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=handle-incoming.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handle-incoming.test.d.ts","sourceRoot":"","sources":["../../../src/routes/whatsapp/handle-incoming.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * WhatsApp Routes
3
+ *
4
+ * Hono route factory for WhatsApp webhooks.
5
+ * Twilio uses the same TwiML response format for WhatsApp as it does for SMS.
6
+ */
7
+ import { Hono } from "hono";
8
+ import type { FlowRegistry } from "../../flows/registry";
9
+ import type { TalkerDependencies } from "../../types";
10
+ /**
11
+ * Create WhatsApp routes
12
+ */
13
+ export declare function whatsappRoutes(deps: TalkerDependencies, registry: FlowRegistry): Hono<import("hono/types").BlankEnv, import("hono/types").BlankSchema, "/">;
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/whatsapp/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtD;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAE,YAAY,8EAO9E"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * WhatsApp Processor
3
+ *
4
+ * End-to-end processing pipeline for a single WhatsApp interaction.
5
+ * Mirrors the SMS processor but uses the "whatsapp" channel for
6
+ * channel-aware formatting (richer content, longer messages).
7
+ */
8
+ import type { FlowRegistry } from "../../flows/registry";
9
+ import type { TalkerDependencies } from "../../types";
10
+ /**
11
+ * Process a WhatsApp interaction and generate TwiML response
12
+ */
13
+ export declare function processWhatsApp(deps: TalkerDependencies, registry: FlowRegistry, phoneNumber: string, messageBody: string): Promise<string>;
14
+ //# sourceMappingURL=processor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processor.d.ts","sourceRoot":"","sources":["../../../src/routes/whatsapp/processor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD;;GAEG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAuCjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../src/standalone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAQ5B,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,SAAS,CAAC;AAMhE,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,uFA0DpE"}
1
+ {"version":3,"file":"standalone.d.ts","sourceRoot":"","sources":["../src/standalone.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAS5B,OAAO,KAAK,EAAE,YAAY,EAAsB,MAAM,SAAS,CAAC;AAMhE,MAAM,WAAW,gBAAiB,SAAQ,YAAY;IACpD,mDAAmD;IACnD,YAAY,EAAE,MAAM,CAAC;IACrB,iCAAiC;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,uFA2DpE"}
package/dist/types.d.ts CHANGED
@@ -8,7 +8,7 @@ import type { ServerDependencies } from "@diegoaltoworks/chatter";
8
8
  /**
9
9
  * Channel type for telephony interactions
10
10
  */
11
- export type Channel = "call" | "sms";
11
+ export type Channel = "call" | "sms" | "whatsapp";
12
12
  /**
13
13
  * Voice configuration for text-to-speech
14
14
  */
@@ -90,7 +90,7 @@ export interface TalkerConfig {
90
90
  };
91
91
  /** OpenAI API key for the pre/post-processing pipeline. Falls back to chatter's OpenAI client */
92
92
  openaiApiKey?: string;
93
- /** Route prefix for telephony endpoints. Default: "" (mounts at /call and /sms) */
93
+ /** Route prefix for telephony endpoints. Default: "" (mounts at /call, /sms, and /whatsapp) */
94
94
  routePrefix?: string;
95
95
  /** Conversation context TTL in milliseconds. Default: 1800000 (30 minutes) */
96
96
  contextTtlMs?: number;
@@ -98,6 +98,15 @@ export interface TalkerConfig {
98
98
  cleanupIntervalMs?: number;
99
99
  /** Maximum no-speech retries before ending call. Default: 3 */
100
100
  maxNoSpeechRetries?: number;
101
+ /** Rate limiting configuration */
102
+ rateLimit?: {
103
+ /** Max requests per window per phone number. Default: 30 */
104
+ maxRequests?: number;
105
+ /** Window size in milliseconds. Default: 60000 (1 minute) */
106
+ windowMs?: number;
107
+ };
108
+ /** Maximum input length for speech/SMS messages in characters. Default: 1000 */
109
+ maxInputLength?: number;
101
110
  /** Chat function override. By default, talker queries chatter's RAG pipeline directly */
102
111
  chatFn?: (phoneNumber: string, message: string) => Promise<string>;
103
112
  }
@@ -159,6 +168,8 @@ export interface FlowHandlerResult {
159
168
  say: string;
160
169
  /** Optional: different content for SMS */
161
170
  sms?: string;
171
+ /** Optional: different content for WhatsApp */
172
+ whatsapp?: string;
162
173
  }
163
174
  export interface FlowHandlerContext {
164
175
  phoneNumber: string;
@@ -236,5 +247,12 @@ export interface Phrases {
236
247
  processingError: string;
237
248
  genericError: string;
238
249
  };
250
+ whatsapp: {
251
+ greeting: string;
252
+ greetingShort: string;
253
+ callForHelp: string;
254
+ processingError: string;
255
+ genericError: string;
256
+ };
239
257
  }
240
258
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAIlE;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,KAAK,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,iDAAiD;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,yBAAyB;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,wEAAwE;IACxE,GAAG,EAAE,MAAM,CAAC;IACZ,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sEAAsE;IACtE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iEAAiE;IACjE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6CAA6C;IAC7C,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,6CAA6C;IAC7C,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,8EAA8E;IAC9E,6BAA6B,CAAC,EAAE,OAAO,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,0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AAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE;QACR,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,GAAG,EAAE;QACH,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,QAAQ,EAAE;QACR,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;CACH"}
package/language/de.json CHANGED
@@ -23,5 +23,12 @@
23
23
  "callForHelp": "Fuer komplexe Fragen rufen Sie uns direkt an.",
24
24
  "processingError": "Ich habe Schwierigkeiten, das zu verarbeiten. Bitte versuchen Sie es erneut oder rufen Sie uns an.",
25
25
  "genericError": "Entschuldigung, etwas ist schief gelaufen. Bitte versuchen Sie es erneut."
26
+ },
27
+ "whatsapp": {
28
+ "greeting": "Hallo! Ich bin Ihr Assistent. Senden Sie mir eine Nachricht und ich helfe Ihnen gerne!",
29
+ "greetingShort": "Hallo! Wie kann ich helfen?",
30
+ "callForHelp": "Fuer komplexe Fragen rufen Sie uns an oder antworten Sie hier mit mehr Details.",
31
+ "processingError": "Ich habe Schwierigkeiten, das zu verarbeiten. Bitte senden Sie Ihre Nachricht erneut.",
32
+ "genericError": "Entschuldigung, etwas ist schief gelaufen. Bitte versuchen Sie es erneut."
26
33
  }
27
34
  }
package/language/en.json CHANGED
@@ -23,5 +23,12 @@
23
23
  "callForHelp": "For more complex questions, feel free to call back or reach us directly.",
24
24
  "processingError": "I'm having trouble processing that. Please try texting again or call back.",
25
25
  "genericError": "Sorry, something went wrong. Please try again."
26
+ },
27
+ "whatsapp": {
28
+ "greeting": "Hi! I'm your assistant. Send me a message and I'll help you out!",
29
+ "greetingShort": "Hi! How can I help?",
30
+ "callForHelp": "For more complex questions, feel free to call us directly or reply here with more details.",
31
+ "processingError": "I'm having trouble processing that. Please try sending your message again.",
32
+ "genericError": "Sorry, something went wrong. Please try again."
26
33
  }
27
34
  }
package/language/es.json CHANGED
@@ -23,5 +23,12 @@
23
23
  "callForHelp": "Para consultas complejas, llamenos directamente.",
24
24
  "processingError": "Tengo problemas para procesar eso. Por favor intentelo de nuevo o llamenos.",
25
25
  "genericError": "Lo siento, algo salio mal. Por favor intente de nuevo."
26
+ },
27
+ "whatsapp": {
28
+ "greeting": "Hola! Soy su asistente. Envieme un mensaje y le ayudare!",
29
+ "greetingShort": "Hola! Como puedo ayudarle?",
30
+ "callForHelp": "Para consultas complejas, llamenos o responda aqui con mas detalles.",
31
+ "processingError": "Tengo problemas para procesar eso. Por favor envie su mensaje de nuevo.",
32
+ "genericError": "Lo siento, algo salio mal. Por favor intente de nuevo."
26
33
  }
27
34
  }
package/language/fr.json CHANGED
@@ -23,5 +23,12 @@
23
23
  "callForHelp": "Pour des questions complexes, appelez-nous directement.",
24
24
  "processingError": "J'ai du mal a traiter cela. Veuillez reessayer ou nous appeler.",
25
25
  "genericError": "Desole, quelque chose s'est mal passe. Veuillez reessayer."
26
+ },
27
+ "whatsapp": {
28
+ "greeting": "Bonjour! Je suis votre assistant. Envoyez-moi un message et je vous aiderai!",
29
+ "greetingShort": "Bonjour! Comment puis-je vous aider?",
30
+ "callForHelp": "Pour des questions complexes, appelez-nous ou repondez ici avec plus de details.",
31
+ "processingError": "J'ai du mal a traiter cela. Veuillez renvoyer votre message.",
32
+ "genericError": "Desole, quelque chose s'est mal passe. Veuillez reessayer."
26
33
  }
27
34
  }
package/language/nl.json CHANGED
@@ -23,5 +23,12 @@
23
23
  "callForHelp": "Voor complexe vragen, bel ons direct.",
24
24
  "processingError": "Ik heb moeite om dat te verwerken. Probeer het opnieuw of bel ons.",
25
25
  "genericError": "Sorry, er ging iets mis. Probeer het opnieuw."
26
+ },
27
+ "whatsapp": {
28
+ "greeting": "Hallo! Ik ben uw assistent. Stuur me een bericht en ik help u graag!",
29
+ "greetingShort": "Hallo! Hoe kan ik helpen?",
30
+ "callForHelp": "Voor complexe vragen, bel ons of stuur hier meer details.",
31
+ "processingError": "Ik heb moeite om dat te verwerken. Probeer uw bericht opnieuw te sturen.",
32
+ "genericError": "Sorry, er ging iets mis. Probeer het opnieuw."
26
33
  }
27
34
  }
package/language/pt.json CHANGED
@@ -23,5 +23,12 @@
23
23
  "callForHelp": "Para questoes complexas, ligue diretamente.",
24
24
  "processingError": "Estou tendo dificuldades para processar isso. Por favor, tente novamente ou nos ligue.",
25
25
  "genericError": "Desculpe, algo deu errado. Por favor, tente novamente."
26
+ },
27
+ "whatsapp": {
28
+ "greeting": "Ola! Sou seu assistente. Envie-me uma mensagem e eu ajudo voce!",
29
+ "greetingShort": "Ola! Como posso ajudar?",
30
+ "callForHelp": "Para questoes complexas, ligue para nos ou responda aqui com mais detalhes.",
31
+ "processingError": "Estou tendo dificuldades para processar isso. Por favor, envie sua mensagem novamente.",
32
+ "genericError": "Desculpe, algo deu errado. Por favor, tente novamente."
26
33
  }
27
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@diegoaltoworks/talker",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "Telephony plugin for Chatter — adds voice call and SMS support via Twilio",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -4,7 +4,7 @@ You are a post-processor for a voice assistant. Your job is to transform knowled
4
4
 
5
5
  ## Channel Type
6
6
 
7
- You will be told the channel: either "call" (phone) or "sms" (text message).
7
+ You will be told the channel: "call" (phone), "sms" (text message), or "whatsapp".
8
8
 
9
9
  **For CALL (phone):**
10
10
  - Response will be SPOKEN aloud by text-to-speech
@@ -19,6 +19,15 @@ You will be told the channel: either "call" (phone) or "sms" (text message).
19
19
  - Maximum 160 characters ideal (1 SMS segment)
20
20
  - No markdown formatting
21
21
 
22
+ **For WHATSAPP:**
23
+ - Response will be READ in a WhatsApp chat
24
+ - Keep numbers as digits
25
+ - Can include full URLs
26
+ - Can use WhatsApp formatting: *bold*, _italic_, ~strikethrough~
27
+ - Longer responses are fine (up to 500 characters)
28
+ - Can use line breaks for readability
29
+ - No markdown headers or lists — use simple text with line breaks
30
+
22
31
  ## Language Requirement
23
32
 
24
33
  **CRITICAL**: You will be told which language to respond in. You MUST translate and respond in that language.
@@ -53,6 +62,12 @@ You will be told the channel: either "call" (phone) or "sms" (text message).
53
62
  - Numbers -> keep as digits
54
63
  - URLs -> keep short URLs
55
64
 
65
+ ### For WHATSAPP:
66
+ - Numbers -> keep as digits
67
+ - URLs -> keep full URLs
68
+ - Use *bold* for emphasis (WhatsApp native formatting)
69
+ - Can use line breaks between logical sections
70
+
56
71
  ## Response Format
57
72
 
58
73
  Return ONLY the transformed text. No JSON, no explanations.