vellum 0.2.7 → 0.2.8

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 (42) hide show
  1. package/bun.lock +2 -2
  2. package/package.json +2 -2
  3. package/src/__tests__/asset-materialize-tool.test.ts +2 -2
  4. package/src/__tests__/checker.test.ts +104 -0
  5. package/src/__tests__/gateway-only-enforcement.test.ts +458 -0
  6. package/src/__tests__/ipc-snapshot.test.ts +11 -0
  7. package/src/__tests__/oauth-callback-registry.test.ts +85 -0
  8. package/src/__tests__/oauth2-gateway-transport.test.ts +298 -0
  9. package/src/__tests__/provider-commit-message-generator.test.ts +51 -12
  10. package/src/__tests__/public-ingress-urls.test.ts +206 -0
  11. package/src/__tests__/tool-executor.test.ts +88 -0
  12. package/src/__tests__/turn-commit.test.ts +64 -0
  13. package/src/calls/twilio-config.ts +17 -1
  14. package/src/calls/twilio-routes.ts +10 -2
  15. package/src/calls/twilio-webhook-urls.ts +18 -21
  16. package/src/config/defaults.ts +4 -0
  17. package/src/config/schema.ts +30 -2
  18. package/src/config/system-prompt.ts +1 -1
  19. package/src/config/types.ts +1 -0
  20. package/src/daemon/computer-use-session.ts +2 -1
  21. package/src/daemon/handlers/config.ts +51 -2
  22. package/src/daemon/handlers/sessions.ts +2 -2
  23. package/src/daemon/handlers/work-items.ts +1 -1
  24. package/src/daemon/ipc-contract-inventory.json +4 -0
  25. package/src/daemon/ipc-contract.ts +16 -1
  26. package/src/daemon/session-tool-setup.ts +7 -0
  27. package/src/inbound/public-ingress-urls.ts +106 -0
  28. package/src/memory/attachments-store.ts +0 -1
  29. package/src/memory/channel-delivery-store.ts +0 -1
  30. package/src/memory/conversation-key-store.ts +0 -1
  31. package/src/memory/db.ts +346 -149
  32. package/src/memory/runs-store.ts +0 -3
  33. package/src/memory/schema.ts +0 -4
  34. package/src/runtime/http-server.ts +84 -2
  35. package/src/security/oauth-callback-registry.ts +56 -0
  36. package/src/security/oauth2.ts +174 -58
  37. package/src/swarm/backend-claude-code.ts +1 -1
  38. package/src/tools/assets/search.ts +1 -36
  39. package/src/tools/claude-code/claude-code.ts +3 -3
  40. package/src/tools/tasks/work-item-list.ts +16 -2
  41. package/src/workspace/provider-commit-message-generator.ts +39 -23
  42. package/src/workspace/turn-commit.ts +6 -2
@@ -0,0 +1,106 @@
1
+ /**
2
+ * Centralized URL builders for all public-facing ingress endpoints.
3
+ *
4
+ * Resolves the canonical public base URL via a fallback chain:
5
+ * ingress.publicBaseUrl → calls.webhookBaseUrl → env TWILIO_WEBHOOK_BASE_URL
6
+ *
7
+ * Supersedes the per-domain URL helpers in calls/twilio-webhook-urls.ts.
8
+ */
9
+
10
+ import { getLogger } from '../util/logger.js';
11
+
12
+ const log = getLogger('public-ingress-urls');
13
+
14
+ export interface IngressConfig {
15
+ ingress?: { publicBaseUrl?: string };
16
+ calls?: { webhookBaseUrl?: string };
17
+ }
18
+
19
+ /**
20
+ * Trim whitespace and strip trailing slashes from a URL string.
21
+ */
22
+ function normalizeUrl(url: string): string {
23
+ return url.trim().replace(/\/+$/, '');
24
+ }
25
+
26
+ /**
27
+ * Resolve the canonical public base URL with a three-level fallback chain:
28
+ * 1. ingress.publicBaseUrl (preferred)
29
+ * 2. calls.webhookBaseUrl (backward compat)
30
+ * 3. TWILIO_WEBHOOK_BASE_URL env var (legacy, deprecated)
31
+ *
32
+ * Throws if no source provides a non-empty value.
33
+ */
34
+ export function getPublicBaseUrl(config: IngressConfig): string {
35
+ const ingressValue = config.ingress?.publicBaseUrl;
36
+ if (ingressValue) {
37
+ const normalized = normalizeUrl(ingressValue);
38
+ if (normalized) return normalized;
39
+ }
40
+
41
+ const callsValue = config.calls?.webhookBaseUrl;
42
+ if (callsValue) {
43
+ const normalized = normalizeUrl(callsValue);
44
+ if (normalized) {
45
+ log.warn(
46
+ 'Using calls.webhookBaseUrl as public base URL — set ingress.publicBaseUrl instead.',
47
+ );
48
+ return normalized;
49
+ }
50
+ }
51
+
52
+ const envValue = process.env.TWILIO_WEBHOOK_BASE_URL;
53
+ if (envValue) {
54
+ log.warn(
55
+ 'TWILIO_WEBHOOK_BASE_URL env var is deprecated — set ingress.publicBaseUrl in config instead.',
56
+ );
57
+ const normalized = normalizeUrl(envValue);
58
+ if (normalized) return normalized;
59
+ }
60
+
61
+ throw new Error(
62
+ 'No public base URL configured. Set ingress.publicBaseUrl in config, calls.webhookBaseUrl, or TWILIO_WEBHOOK_BASE_URL env var.',
63
+ );
64
+ }
65
+
66
+ /**
67
+ * Build the Twilio voice webhook URL for a given call session.
68
+ */
69
+ export function getTwilioVoiceWebhookUrl(config: IngressConfig, callSessionId: string): string {
70
+ const base = getPublicBaseUrl(config);
71
+ return `${base}/webhooks/twilio/voice?callSessionId=${callSessionId}`;
72
+ }
73
+
74
+ /**
75
+ * Build the Twilio status callback URL.
76
+ */
77
+ export function getTwilioStatusCallbackUrl(config: IngressConfig): string {
78
+ const base = getPublicBaseUrl(config);
79
+ return `${base}/webhooks/twilio/status`;
80
+ }
81
+
82
+ /**
83
+ * Build the Twilio connect-action callback URL.
84
+ */
85
+ export function getTwilioConnectActionUrl(config: IngressConfig): string {
86
+ const base = getPublicBaseUrl(config);
87
+ return `${base}/webhooks/twilio/connect-action`;
88
+ }
89
+
90
+ /**
91
+ * Build the Twilio ConversationRelay WebSocket URL.
92
+ * Converts http:// → ws:// and https:// → wss://.
93
+ */
94
+ export function getTwilioRelayUrl(config: IngressConfig): string {
95
+ const base = getPublicBaseUrl(config);
96
+ const wsBase = base.replace(/^http(s?)/, 'ws$1');
97
+ return `${wsBase}/webhooks/twilio/relay`;
98
+ }
99
+
100
+ /**
101
+ * Build the OAuth callback URL.
102
+ */
103
+ export function getOAuthCallbackUrl(config: IngressConfig): string {
104
+ const base = getPublicBaseUrl(config);
105
+ return `${base}/webhooks/oauth/callback`;
106
+ }
@@ -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,