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.
- package/bun.lock +2 -2
- package/package.json +2 -2
- package/src/__tests__/asset-materialize-tool.test.ts +2 -2
- package/src/__tests__/checker.test.ts +104 -0
- package/src/__tests__/gateway-only-enforcement.test.ts +458 -0
- package/src/__tests__/ipc-snapshot.test.ts +11 -0
- package/src/__tests__/oauth-callback-registry.test.ts +85 -0
- package/src/__tests__/oauth2-gateway-transport.test.ts +298 -0
- package/src/__tests__/provider-commit-message-generator.test.ts +51 -12
- package/src/__tests__/public-ingress-urls.test.ts +206 -0
- package/src/__tests__/tool-executor.test.ts +88 -0
- package/src/__tests__/turn-commit.test.ts +64 -0
- package/src/calls/twilio-config.ts +17 -1
- package/src/calls/twilio-routes.ts +10 -2
- package/src/calls/twilio-webhook-urls.ts +18 -21
- package/src/config/defaults.ts +4 -0
- package/src/config/schema.ts +30 -2
- package/src/config/system-prompt.ts +1 -1
- package/src/config/types.ts +1 -0
- package/src/daemon/computer-use-session.ts +2 -1
- package/src/daemon/handlers/config.ts +51 -2
- package/src/daemon/handlers/sessions.ts +2 -2
- package/src/daemon/handlers/work-items.ts +1 -1
- package/src/daemon/ipc-contract-inventory.json +4 -0
- package/src/daemon/ipc-contract.ts +16 -1
- package/src/daemon/session-tool-setup.ts +7 -0
- package/src/inbound/public-ingress-urls.ts +106 -0
- package/src/memory/attachments-store.ts +0 -1
- package/src/memory/channel-delivery-store.ts +0 -1
- package/src/memory/conversation-key-store.ts +0 -1
- package/src/memory/db.ts +346 -149
- package/src/memory/runs-store.ts +0 -3
- package/src/memory/schema.ts +0 -4
- package/src/runtime/http-server.ts +84 -2
- package/src/security/oauth-callback-registry.ts +56 -0
- package/src/security/oauth2.ts +174 -58
- package/src/swarm/backend-claude-code.ts +1 -1
- package/src/tools/assets/search.ts +1 -36
- package/src/tools/claude-code/claude-code.ts +3 -3
- package/src/tools/tasks/work-item-list.ts +16 -2
- package/src/workspace/provider-commit-message-generator.ts +39 -23
- 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
|
+
}
|