vellum 0.2.7 → 0.2.9

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 (76) hide show
  1. package/bun.lock +4 -4
  2. package/package.json +4 -3
  3. package/src/__tests__/asset-materialize-tool.test.ts +2 -2
  4. package/src/__tests__/checker.test.ts +104 -0
  5. package/src/__tests__/config-schema.test.ts +0 -6
  6. package/src/__tests__/forbidden-legacy-symbols.test.ts +69 -0
  7. package/src/__tests__/gateway-only-enforcement.test.ts +538 -0
  8. package/src/__tests__/ingress-url-consistency.test.ts +214 -0
  9. package/src/__tests__/ipc-snapshot.test.ts +17 -5
  10. package/src/__tests__/oauth-callback-registry.test.ts +85 -0
  11. package/src/__tests__/oauth2-gateway-transport.test.ts +304 -0
  12. package/src/__tests__/provider-commit-message-generator.test.ts +51 -12
  13. package/src/__tests__/public-ingress-urls.test.ts +222 -0
  14. package/src/__tests__/runtime-events-sse-parity.test.ts +343 -0
  15. package/src/__tests__/runtime-events-sse.test.ts +162 -0
  16. package/src/__tests__/tool-executor.test.ts +88 -0
  17. package/src/__tests__/turn-commit.test.ts +64 -0
  18. package/src/__tests__/twilio-provider.test.ts +1 -1
  19. package/src/__tests__/twilio-routes.test.ts +4 -4
  20. package/src/__tests__/twitter-auth-handler.test.ts +87 -2
  21. package/src/calls/call-domain.ts +8 -6
  22. package/src/calls/twilio-config.ts +18 -3
  23. package/src/calls/twilio-routes.ts +10 -2
  24. package/src/config/bundled-skills/tasks/TOOLS.json +25 -0
  25. package/src/config/bundled-skills/tasks/tools/task-queue-run.ts +9 -0
  26. package/src/config/bundled-skills/transcribe/SKILL.md +25 -0
  27. package/src/config/bundled-skills/transcribe/TOOLS.json +32 -0
  28. package/src/config/bundled-skills/transcribe/tools/transcribe-media.ts +370 -0
  29. package/src/config/defaults.ts +4 -1
  30. package/src/config/schema.ts +30 -6
  31. package/src/config/system-prompt.ts +1 -1
  32. package/src/config/types.ts +1 -0
  33. package/src/config/vellum-skills/google-oauth-setup/SKILL.md +5 -4
  34. package/src/config/vellum-skills/slack-oauth-setup/SKILL.md +4 -2
  35. package/src/config/vellum-skills/telegram-setup/SKILL.md +3 -3
  36. package/src/daemon/computer-use-session.ts +2 -1
  37. package/src/daemon/handlers/config.ts +49 -17
  38. package/src/daemon/handlers/sessions.ts +2 -2
  39. package/src/daemon/handlers/shared.ts +1 -0
  40. package/src/daemon/handlers/subagents.ts +85 -2
  41. package/src/daemon/handlers/twitter-auth.ts +31 -2
  42. package/src/daemon/handlers/work-items.ts +1 -1
  43. package/src/daemon/ipc-contract-inventory.json +8 -4
  44. package/src/daemon/ipc-contract.ts +34 -15
  45. package/src/daemon/lifecycle.ts +9 -4
  46. package/src/daemon/server.ts +7 -0
  47. package/src/daemon/session-tool-setup.ts +8 -1
  48. package/src/inbound/public-ingress-urls.ts +112 -0
  49. package/src/memory/attachments-store.ts +0 -1
  50. package/src/memory/channel-delivery-store.ts +0 -1
  51. package/src/memory/conversation-key-store.ts +0 -1
  52. package/src/memory/db.ts +472 -148
  53. package/src/memory/llm-usage-store.ts +0 -1
  54. package/src/memory/runs-store.ts +51 -6
  55. package/src/memory/schema.ts +2 -6
  56. package/src/runtime/gateway-client.ts +7 -1
  57. package/src/runtime/http-server.ts +174 -7
  58. package/src/runtime/routes/channel-routes.ts +7 -2
  59. package/src/runtime/routes/events-routes.ts +79 -0
  60. package/src/runtime/routes/run-routes.ts +43 -0
  61. package/src/runtime/run-orchestrator.ts +64 -7
  62. package/src/security/oauth-callback-registry.ts +66 -0
  63. package/src/security/oauth2.ts +208 -58
  64. package/src/subagent/manager.ts +3 -1
  65. package/src/swarm/backend-claude-code.ts +1 -1
  66. package/src/tools/assets/search.ts +1 -36
  67. package/src/tools/claude-code/claude-code.ts +3 -3
  68. package/src/tools/tasks/work-item-list.ts +16 -2
  69. package/src/tools/tasks/work-item-run.ts +78 -0
  70. package/src/util/platform.ts +1 -1
  71. package/src/work-items/work-item-runner.ts +171 -0
  72. package/src/workspace/provider-commit-message-generator.ts +39 -23
  73. package/src/workspace/turn-commit.ts +6 -2
  74. package/src/__tests__/handlers-twilio-config.test.ts +0 -221
  75. package/src/calls/__tests__/twilio-webhook-urls.test.ts +0 -162
  76. package/src/calls/twilio-webhook-urls.ts +0 -50
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Centralized URL builders for all public-facing ingress endpoints.
3
+ *
4
+ * ## Source-of-truth precedence
5
+ *
6
+ * The canonical public base URL is resolved through a two-level chain:
7
+ *
8
+ * 1. **User Settings** (`config.ingress.publicBaseUrl`) — set via the
9
+ * Settings UI or `config set ingress.publicBaseUrl`. This is the
10
+ * primary source of truth. When the assistant spawns or restarts
11
+ * the gateway, this value is forwarded as the `INGRESS_PUBLIC_BASE_URL`
12
+ * environment variable so both processes agree on the same URL.
13
+ *
14
+ * 2. **Environment variable** (`INGRESS_PUBLIC_BASE_URL`) — serves as a
15
+ * fallback for operational use (e.g. direct gateway-only deployments
16
+ * without the assistant, or CI overrides). When the assistant is
17
+ * managing the gateway, the env var is set automatically from (1).
18
+ *
19
+ * This chain ensures that:
20
+ * - The assistant's outbound callback URLs (Twilio webhooks, OAuth
21
+ * redirect URIs, etc.) match the gateway's inbound signature
22
+ * reconstruction URL.
23
+ * - Changing the URL in Settings propagates to the gateway on restart,
24
+ * eliminating Twilio signature mismatch risk.
25
+ *
26
+ * All public-facing ingress URL construction is centralized here.
27
+ */
28
+
29
+ export interface IngressConfig {
30
+ ingress?: { publicBaseUrl?: string };
31
+ }
32
+
33
+ /**
34
+ * Trim whitespace and strip trailing slashes from a URL string.
35
+ */
36
+ function normalizeUrl(url: string): string {
37
+ return url.trim().replace(/\/+$/, '');
38
+ }
39
+
40
+ /**
41
+ * Resolve the canonical public base URL using the precedence chain
42
+ * documented at the top of this module.
43
+ *
44
+ * Throws if no source provides a non-empty value.
45
+ */
46
+ export function getPublicBaseUrl(config: IngressConfig): string {
47
+ const ingressValue = config.ingress?.publicBaseUrl;
48
+ if (ingressValue) {
49
+ const normalized = normalizeUrl(ingressValue);
50
+ if (normalized) return normalized;
51
+ }
52
+
53
+ const ingressEnvValue = process.env.INGRESS_PUBLIC_BASE_URL;
54
+ if (ingressEnvValue) {
55
+ const normalized = normalizeUrl(ingressEnvValue);
56
+ if (normalized) return normalized;
57
+ }
58
+
59
+ throw new Error(
60
+ 'No public base URL configured. Set ingress.publicBaseUrl in config or INGRESS_PUBLIC_BASE_URL env var.',
61
+ );
62
+ }
63
+
64
+ /**
65
+ * Build the Twilio voice webhook URL for a given call session.
66
+ */
67
+ export function getTwilioVoiceWebhookUrl(config: IngressConfig, callSessionId: string): string {
68
+ const base = getPublicBaseUrl(config);
69
+ return `${base}/webhooks/twilio/voice?callSessionId=${callSessionId}`;
70
+ }
71
+
72
+ /**
73
+ * Build the Twilio status callback URL.
74
+ */
75
+ export function getTwilioStatusCallbackUrl(config: IngressConfig): string {
76
+ const base = getPublicBaseUrl(config);
77
+ return `${base}/webhooks/twilio/status`;
78
+ }
79
+
80
+ /**
81
+ * Build the Twilio connect-action callback URL.
82
+ */
83
+ export function getTwilioConnectActionUrl(config: IngressConfig): string {
84
+ const base = getPublicBaseUrl(config);
85
+ return `${base}/webhooks/twilio/connect-action`;
86
+ }
87
+
88
+ /**
89
+ * Build the Twilio ConversationRelay WebSocket URL.
90
+ * Converts http:// → ws:// and https:// → wss://.
91
+ */
92
+ export function getTwilioRelayUrl(config: IngressConfig): string {
93
+ const base = getPublicBaseUrl(config);
94
+ const wsBase = base.replace(/^http(s?)/, 'ws$1');
95
+ return `${wsBase}/webhooks/twilio/relay`;
96
+ }
97
+
98
+ /**
99
+ * Build the OAuth callback URL.
100
+ */
101
+ export function getOAuthCallbackUrl(config: IngressConfig): string {
102
+ const base = getPublicBaseUrl(config);
103
+ return `${base}/webhooks/oauth/callback`;
104
+ }
105
+
106
+ /**
107
+ * Build the Telegram webhook URL.
108
+ */
109
+ export function getTelegramWebhookUrl(config: IngressConfig): string {
110
+ const base = getPublicBaseUrl(config);
111
+ return `${base}/webhooks/telegram`;
112
+ }
@@ -197,7 +197,6 @@ export function uploadAttachment(
197
197
 
198
198
  const record = {
199
199
  id: uuid(),
200
- assistantId: 'self',
201
200
  originalFilename: filename,
202
201
  mimeType,
203
202
  sizeBytes,
@@ -82,7 +82,6 @@ export function recordInbound(
82
82
  tx.insert(channelInboundEvents)
83
83
  .values({
84
84
  id: eventId,
85
- assistantId: 'self',
86
85
  sourceChannel,
87
86
  externalChatId,
88
87
  externalMessageId,
@@ -96,7 +96,6 @@ export function getOrCreateConversation(
96
96
  tx.insert(conversationKeys)
97
97
  .values({
98
98
  id: uuid(),
99
- assistantId: 'self',
100
99
  conversationKey,
101
100
  conversationId,
102
101
  createdAt: now,