@vellumai/vellum-gateway 0.4.41 → 0.4.43

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 (98) hide show
  1. package/.env.example +5 -14
  2. package/AGENTS.md +2 -3
  3. package/ARCHITECTURE.md +110 -119
  4. package/README.md +74 -87
  5. package/package.json +2 -2
  6. package/src/__tests__/browser-relay-websocket.test.ts +35 -23
  7. package/src/__tests__/{guardian-control-plane-proxy.test.ts → channel-verification-session-proxy.test.ts} +49 -80
  8. package/src/__tests__/config-file-cache.test.ts +435 -0
  9. package/src/__tests__/config.test.ts +1 -36
  10. package/src/__tests__/contacts-control-plane-proxy.test.ts +0 -23
  11. package/src/__tests__/contacts-control-plane-route-match.test.ts +3 -20
  12. package/src/__tests__/credential-cache.test.ts +488 -0
  13. package/src/__tests__/feature-flags-route.test.ts +5 -5
  14. package/src/__tests__/load-guards.test.ts +21 -25
  15. package/src/__tests__/oauth-callback.test.ts +0 -23
  16. package/src/__tests__/resolve-assistant.test.ts +0 -23
  17. package/src/__tests__/route-schema-guard.test.ts +10 -10
  18. package/src/__tests__/runtime-client.test.ts +0 -23
  19. package/src/__tests__/runtime-health-proxy.test.ts +0 -23
  20. package/src/__tests__/runtime-proxy-auth.test.ts +0 -23
  21. package/src/__tests__/runtime-proxy.test.ts +0 -23
  22. package/src/__tests__/schema.test.ts +4 -5
  23. package/src/__tests__/slack-config.test.ts +12 -78
  24. package/src/__tests__/slack-control-plane-proxy.test.ts +0 -23
  25. package/src/__tests__/slack-deliver-ratelimit.test.ts +66 -31
  26. package/src/__tests__/slack-deliver.test.ts +250 -58
  27. package/src/__tests__/slack-display-name.test.ts +28 -31
  28. package/src/__tests__/slack-normalize.test.ts +0 -23
  29. package/src/__tests__/slack-reaction-normalize.test.ts +0 -23
  30. package/src/__tests__/telegram-api-redaction.test.ts +50 -73
  31. package/src/__tests__/telegram-control-plane-proxy.test.ts +0 -23
  32. package/src/__tests__/telegram-deliver-auth.test.ts +74 -35
  33. package/src/__tests__/telegram-send-attachments.test.ts +33 -33
  34. package/src/__tests__/telegram-webhook-handler.test.ts +28 -37
  35. package/src/__tests__/telegram-webhook-manager.test.ts +54 -64
  36. package/src/__tests__/twilio-relay-websocket.test.ts +19 -56
  37. package/src/__tests__/twilio-webhooks.test.ts +374 -59
  38. package/src/__tests__/whatsapp-download.test.ts +103 -52
  39. package/src/__tests__/whatsapp-webhook.test.ts +172 -0
  40. package/src/auth/subject.ts +9 -0
  41. package/src/auth/types.ts +1 -1
  42. package/src/channels/inbound-event.ts +1 -3
  43. package/src/channels/transport-hints.ts +0 -19
  44. package/src/channels/types.ts +2 -4
  45. package/src/config-file-cache.ts +146 -0
  46. package/src/config.ts +1 -331
  47. package/src/credential-cache.ts +120 -0
  48. package/src/credential-watcher.ts +2 -2
  49. package/src/dedup-cache.ts +1 -1
  50. package/src/feature-flag-registry.json +0 -16
  51. package/src/http/middleware/deliver-auth.ts +4 -6
  52. package/src/http/middleware/rate-limit.ts +1 -6
  53. package/src/http/routes/browser-relay-websocket.ts +13 -3
  54. package/src/http/routes/{guardian-control-plane-proxy.ts → channel-verification-session-proxy.ts} +25 -39
  55. package/src/http/routes/contacts-control-plane-proxy.ts +0 -11
  56. package/src/http/routes/contacts-control-plane-route-match.ts +1 -13
  57. package/src/http/routes/slack-deliver.ts +42 -16
  58. package/src/http/routes/telegram-deliver.test.ts +30 -51
  59. package/src/http/routes/telegram-deliver.ts +63 -10
  60. package/src/http/routes/telegram-webhook.test.ts +84 -103
  61. package/src/http/routes/telegram-webhook.ts +108 -34
  62. package/src/http/routes/twilio-connect-action-webhook.ts +9 -3
  63. package/src/http/routes/twilio-control-plane-proxy.ts +0 -42
  64. package/src/http/routes/twilio-relay-websocket.ts +22 -11
  65. package/src/http/routes/twilio-status-webhook.ts +9 -3
  66. package/src/http/routes/twilio-voice-webhook.test.ts +45 -36
  67. package/src/http/routes/twilio-voice-webhook.ts +12 -6
  68. package/src/http/routes/whatsapp-deliver.test.ts +30 -74
  69. package/src/http/routes/whatsapp-deliver.ts +25 -16
  70. package/src/http/routes/whatsapp-webhook.test.ts +113 -46
  71. package/src/http/routes/whatsapp-webhook.ts +110 -37
  72. package/src/index.ts +218 -192
  73. package/src/routing/resolve-assistant.ts +6 -2
  74. package/src/schema.ts +66 -458
  75. package/src/slack/normalize.ts +9 -6
  76. package/src/slack/socket-mode.ts +3 -0
  77. package/src/telegram/api.ts +58 -29
  78. package/src/telegram/download.ts +22 -7
  79. package/src/telegram/send.test.ts +38 -26
  80. package/src/telegram/send.ts +68 -9
  81. package/src/telegram/webhook-manager.ts +46 -11
  82. package/src/twilio/validate-webhook.ts +225 -43
  83. package/src/types.ts +0 -1
  84. package/src/whatsapp/api.ts +170 -124
  85. package/src/whatsapp/download.ts +4 -2
  86. package/src/whatsapp/send.ts +13 -9
  87. package/workspace/config.json +8 -0
  88. package/docs/sms-twilio-parity-checklist.md +0 -49
  89. package/src/__tests__/sms-ingress-guard.test.ts +0 -283
  90. package/src/__tests__/telegram-reconcile-route.test.ts +0 -314
  91. package/src/config-file-mappings.ts +0 -107
  92. package/src/credential-mappings.ts +0 -102
  93. package/src/http/routes/sms-deliver.test.ts +0 -510
  94. package/src/http/routes/sms-deliver.ts +0 -195
  95. package/src/http/routes/telegram-reconcile.ts +0 -88
  96. package/src/http/routes/twilio-sms-webhook.test.ts +0 -817
  97. package/src/http/routes/twilio-sms-webhook.ts +0 -255
  98. package/src/twilio/send-sms.ts +0 -61
package/.env.example CHANGED
@@ -4,9 +4,6 @@ TELEGRAM_BOT_TOKEN=
4
4
  # Required: Secret token for verifying Telegram webhook requests
5
5
  TELEGRAM_WEBHOOK_SECRET=
6
6
 
7
- # Optional: Override Telegram API base URL (default: https://api.telegram.org)
8
- # TELEGRAM_API_BASE_URL=https://api.telegram.org
9
-
10
7
  # Required: Base URL of the assistant runtime HTTP server
11
8
  ASSISTANT_RUNTIME_BASE_URL=http://localhost:7821
12
9
 
@@ -43,9 +40,6 @@ ASSISTANT_RUNTIME_BASE_URL=http://localhost:7821
43
40
  # Optional: Initial backoff between retries in milliseconds (default: 500)
44
41
  # GATEWAY_RUNTIME_INITIAL_BACKOFF_MS=500
45
42
 
46
- # Optional: Timeout for Telegram API/download calls in milliseconds (default: 15000)
47
- # GATEWAY_TELEGRAM_TIMEOUT_MS=15000
48
-
49
43
  # Optional: Max inbound webhook payload size in bytes (default: 1048576 = 1 MB)
50
44
  # GATEWAY_MAX_WEBHOOK_PAYLOAD_BYTES=1048576
51
45
 
@@ -57,20 +51,17 @@ ASSISTANT_RUNTIME_BASE_URL=http://localhost:7821
57
51
 
58
52
  # Optional: Canonical public base URL where the gateway is reachable externally.
59
53
  # Used by the assistant runtime to construct webhook and OAuth callback URLs.
60
- # Required for Twilio SMS webhook signature validation when behind a tunnel.
54
+ # Required for Twilio webhook signature validation when behind a tunnel.
61
55
  # Set this to your tunnel's public URL during local development.
62
56
  # INGRESS_PUBLIC_BASE_URL=https://your-public-domain.com
63
57
 
64
- # --- SMS (Twilio) ---
58
+ # --- Twilio ---
65
59
 
66
- # Optional: Twilio Account SID for outbound SMS via the Messages API
60
+ # Optional: Twilio Account SID for voice calls via the API
67
61
  # TWILIO_ACCOUNT_SID=
68
62
 
69
- # Optional: Twilio Auth Token for webhook signature validation and outbound SMS
63
+ # Optional: Twilio Auth Token for webhook signature validation
70
64
  # TWILIO_AUTH_TOKEN=
71
65
 
72
- # Optional: Twilio phone number (E.164) used as the From number for outbound SMS
66
+ # Optional: Twilio phone number (E.164) used as the From number for voice calls
73
67
  # TWILIO_PHONE_NUMBER=
74
-
75
- # Optional: Dev-only bypass for bearer auth on /deliver/sms (default: false)
76
- # GATEWAY_SMS_DELIVER_AUTH_BYPASS=false
package/AGENTS.md CHANGED
@@ -19,18 +19,17 @@ All assistant API requests from clients, CLI, skills, and user-facing tooling **
19
19
  **Exception boundary:** The gateway service itself may call the runtime internally. Tests may use direct runtime URLs for isolated unit/integration scenarios. Intentional local daemon-control paths are exempt:
20
20
 
21
21
  - `clients/shared/IPC/DaemonClient.swift`
22
- - `clients/macos/vellum-assistant/App/AppDelegate.swift` (`localHttpEnabled`)
23
22
  - `clients/macos/vellum-assistant/Features/Settings/SettingsConnectTab.swift` (health probe)
24
23
 
25
24
  **Migration rule:** If a needed endpoint is not available at the gateway, add a gateway route/proxy first, then consume it. Do not work around a missing gateway endpoint by hitting the runtime directly.
26
25
 
27
26
  **Ban on hardcoded runtime hosts/ports:** Do not embed `localhost:7821`, `127.0.0.1:7821`, or runtime-port-derived URLs in docs, skills, or user-facing guidance. Always reference gateway URLs instead. A CI guard test (`gateway-only-guard.test.ts`) enforces this — any new direct runtime URL reference in production code or skills will fail CI.
28
27
 
29
- **SKILL.md retrieval contract:** For config/status retrieval in bundled skills, use `bash` + canonical CLI surfaces. Start with `assistant config get` for generic config keys and secure credential surfaces (`credential_store`, `assistant keys`) for secrets. Use domain read commands (for example `assistant integrations ...`, `assistant email status ...`) where those domain surfaces exist. Do not use direct gateway `curl` (or manual `Authorization: Bearer $GATEWAY_AUTH_TOKEN`) for read-only retrieval paths. Do not use keychain lookup commands (`security find-generic-password`, `secret-tool`) in SKILL.md. `host_bash` is not allowed for Vellum CLI retrieval commands unless a documented exception is intentionally allowlisted.
28
+ **SKILL.md retrieval contract:** For config/status retrieval in bundled skills, use `bash` + canonical CLI surfaces. Start with `assistant config get` for generic config keys and secure credential surfaces (`credential_store`, `assistant keys`) for secrets. Do not use direct gateway `curl` for read-only retrieval paths. Do not use keychain lookup commands (`security find-generic-password`, `secret-tool`) in SKILL.md. `host_bash` is not allowed for Vellum CLI retrieval commands unless a documented exception is intentionally allowlisted.
30
29
 
31
30
  **SKILL.md proxied outbound pattern:** For outbound third-party API calls from skills that require stored credentials, default to `bash` with `network_mode: "proxied"` and `credential_ids` instead of manual token/keychain plumbing. This keeps credentials out of chat and enforces credential policies consistently.
32
31
 
33
- **SKILL.md gateway URL pattern:** For gateway control-plane writes/actions that are not exposed through a CLI read command, use `$INTERNAL_GATEWAY_BASE_URL` (injected by `bash` and `host_bash`). `$GATEWAY_BASE_URL` is also injected and resolves to the configured public ingress URL when set (falling back to the internal gateway target). Do not hardcode `localhost`/ports in skill examples, and do not instruct users/agents to manually export either variable from Settings.
32
+ **SKILL.md gateway URL pattern:** For gateway control-plane writes/actions that are not exposed through a CLI read command, use `$INTERNAL_GATEWAY_BASE_URL` (injected by `bash` and `host_bash`). Do not hardcode `localhost`/ports in skill examples, and do not instruct users/agents to manually export the variable from Settings. For public ingress URLs (e.g. OAuth redirect URIs, webhook registration), use `assistant config get ingress.publicBaseUrl` or load the `public-ingress` skill do not inject public URLs as environment variables.
34
33
 
35
34
  ### Channel Identity Vocabulary
36
35