@vellumai/assistant 0.4.15 → 0.4.17
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/Dockerfile +6 -6
- package/README.md +1 -2
- package/package.json +1 -1
- package/src/__tests__/approval-routes-http.test.ts +383 -254
- package/src/__tests__/call-controller.test.ts +1074 -751
- package/src/__tests__/call-routes-http.test.ts +329 -279
- package/src/__tests__/channel-approval-routes.test.ts +2 -13
- package/src/__tests__/channel-approvals.test.ts +227 -182
- package/src/__tests__/channel-guardian.test.ts +1 -0
- package/src/__tests__/conversation-attention-telegram.test.ts +157 -114
- package/src/__tests__/conversation-routes-guardian-reply.test.ts +164 -104
- package/src/__tests__/conversation-routes.test.ts +71 -41
- package/src/__tests__/daemon-server-session-init.test.ts +258 -191
- package/src/__tests__/deterministic-verification-control-plane.test.ts +183 -134
- package/src/__tests__/extract-email.test.ts +42 -0
- package/src/__tests__/gateway-only-enforcement.test.ts +467 -368
- package/src/__tests__/gateway-only-guard.test.ts +54 -55
- package/src/__tests__/gmail-integration.test.ts +48 -46
- package/src/__tests__/guardian-action-followup-executor.test.ts +215 -150
- package/src/__tests__/guardian-outbound-http.test.ts +334 -208
- package/src/__tests__/guardian-routing-invariants.test.ts +680 -613
- package/src/__tests__/guardian-routing-state.test.ts +257 -209
- package/src/__tests__/guardian-verification-voice-binding.test.ts +47 -40
- package/src/__tests__/handle-user-message-secret-resume.test.ts +44 -21
- package/src/__tests__/handlers-user-message-approval-consumption.test.ts +269 -195
- package/src/__tests__/inbound-invite-redemption.test.ts +194 -151
- package/src/__tests__/ingress-reconcile.test.ts +184 -142
- package/src/__tests__/non-member-access-request.test.ts +291 -247
- package/src/__tests__/notification-telegram-adapter.test.ts +60 -46
- package/src/__tests__/pairing-concurrent.test.ts +78 -0
- package/src/__tests__/recording-intent-handler.test.ts +422 -291
- package/src/__tests__/runtime-attachment-metadata.test.ts +107 -69
- package/src/__tests__/runtime-events-sse.test.ts +67 -50
- package/src/__tests__/send-endpoint-busy.test.ts +314 -232
- package/src/__tests__/session-approval-overrides.test.ts +93 -91
- package/src/__tests__/sms-messaging-provider.test.ts +74 -47
- package/src/__tests__/trusted-contact-approval-notifier.test.ts +339 -274
- package/src/__tests__/trusted-contact-inline-approval-integration.test.ts +484 -372
- package/src/__tests__/trusted-contact-lifecycle-notifications.test.ts +261 -239
- package/src/__tests__/trusted-contact-multichannel.test.ts +179 -140
- package/src/__tests__/twilio-config.test.ts +49 -41
- package/src/__tests__/twilio-routes-elevenlabs.test.ts +189 -162
- package/src/__tests__/twilio-routes.test.ts +389 -280
- package/src/calls/call-controller.ts +1 -1
- package/src/calls/guardian-action-sweep.ts +6 -6
- package/src/calls/twilio-routes.ts +2 -4
- package/src/config/bundled-skills/chatgpt-import/tools/chatgpt-import.ts +29 -4
- package/src/config/bundled-skills/messaging/SKILL.md +5 -4
- package/src/config/bundled-skills/messaging/tools/messaging-reply.ts +69 -4
- package/src/config/env.ts +39 -29
- package/src/daemon/handlers/config-inbox.ts +5 -5
- package/src/daemon/handlers/skills.ts +18 -10
- package/src/daemon/ipc-contract/messages.ts +1 -0
- package/src/daemon/ipc-contract/surfaces.ts +7 -1
- package/src/daemon/pairing-store.ts +15 -2
- package/src/daemon/session-agent-loop-handlers.ts +5 -0
- package/src/daemon/session-agent-loop.ts +1 -1
- package/src/daemon/session-process.ts +1 -1
- package/src/daemon/session-slash.ts +4 -4
- package/src/daemon/session-surfaces.ts +42 -2
- package/src/runtime/auth/token-service.ts +95 -45
- package/src/runtime/channel-retry-sweep.ts +2 -2
- package/src/runtime/http-server.ts +8 -7
- package/src/runtime/http-types.ts +1 -1
- package/src/runtime/routes/conversation-routes.ts +1 -1
- package/src/runtime/routes/guardian-bootstrap-routes.ts +3 -2
- package/src/runtime/routes/guardian-expiry-sweep.ts +5 -5
- package/src/runtime/routes/pairing-routes.ts +4 -1
- package/src/sequence/reply-matcher.ts +14 -4
- package/src/skills/frontmatter.ts +9 -6
- package/src/tools/ui-surface/definitions.ts +3 -1
- package/src/util/platform.ts +0 -12
- package/docs/architecture/http-token-refresh.md +0 -274
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { beforeEach,describe, expect, mock, test } from
|
|
1
|
+
import { beforeEach, describe, expect, mock, test } from "bun:test";
|
|
2
2
|
|
|
3
3
|
// ── Mocks (must come before source imports) ──────────────────────────
|
|
4
4
|
|
|
@@ -7,93 +7,101 @@ let mockPhoneNumberEnv: string | undefined;
|
|
|
7
7
|
let mockWssBaseUrl: string | undefined;
|
|
8
8
|
let mockLoadConfigResult: Record<string, unknown> = {};
|
|
9
9
|
|
|
10
|
-
mock.module(
|
|
11
|
-
getLogger: () =>
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
mock.module("../util/logger.js", () => ({
|
|
11
|
+
getLogger: () =>
|
|
12
|
+
new Proxy({} as Record<string, unknown>, {
|
|
13
|
+
get: () => () => {},
|
|
14
|
+
}),
|
|
14
15
|
}));
|
|
15
16
|
|
|
16
|
-
mock.module(
|
|
17
|
+
mock.module("../security/secure-keys.js", () => ({
|
|
17
18
|
getSecureKey: (key: string) => mockSecureKeys[key] ?? null,
|
|
18
19
|
}));
|
|
19
20
|
|
|
20
|
-
mock.module(
|
|
21
|
+
mock.module("../config/env.js", () => ({
|
|
22
|
+
isHttpAuthDisabled: () => true,
|
|
21
23
|
getTwilioPhoneNumberEnv: () => mockPhoneNumberEnv,
|
|
22
24
|
getTwilioWssBaseUrl: () => mockWssBaseUrl,
|
|
23
25
|
}));
|
|
24
26
|
|
|
25
|
-
mock.module(
|
|
27
|
+
mock.module("../config/loader.js", () => ({
|
|
26
28
|
loadConfig: () => mockLoadConfigResult,
|
|
27
29
|
}));
|
|
28
30
|
|
|
29
|
-
mock.module(
|
|
30
|
-
getPublicBaseUrl: () =>
|
|
31
|
-
getTwilioRelayUrl: () =>
|
|
31
|
+
mock.module("../inbound/public-ingress-urls.js", () => ({
|
|
32
|
+
getPublicBaseUrl: () => "https://test.example.com",
|
|
33
|
+
getTwilioRelayUrl: () => "wss://test.example.com/twilio/relay",
|
|
32
34
|
}));
|
|
33
35
|
|
|
34
|
-
import { getTwilioConfig } from
|
|
36
|
+
import { getTwilioConfig } from "../calls/twilio-config.js";
|
|
35
37
|
|
|
36
|
-
describe(
|
|
38
|
+
describe("twilio-config", () => {
|
|
37
39
|
beforeEach(() => {
|
|
38
40
|
mockSecureKeys = {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
"credential:twilio:account_sid": "AC_test_sid",
|
|
42
|
+
"credential:twilio:auth_token": "test_auth_token",
|
|
41
43
|
};
|
|
42
44
|
mockPhoneNumberEnv = undefined;
|
|
43
45
|
mockWssBaseUrl = undefined;
|
|
44
46
|
mockLoadConfigResult = {
|
|
45
|
-
sms: { phoneNumber:
|
|
47
|
+
sms: { phoneNumber: "+15551234567" },
|
|
46
48
|
};
|
|
47
49
|
});
|
|
48
50
|
|
|
49
|
-
test(
|
|
51
|
+
test("returns config when credentials and phone number are set", () => {
|
|
50
52
|
const config = getTwilioConfig();
|
|
51
|
-
expect(config.accountSid).toBe(
|
|
52
|
-
expect(config.authToken).toBe(
|
|
53
|
-
expect(config.phoneNumber).toBe(
|
|
54
|
-
expect(config.webhookBaseUrl).toBe(
|
|
55
|
-
expect(config.wssBaseUrl).toBe(
|
|
53
|
+
expect(config.accountSid).toBe("AC_test_sid");
|
|
54
|
+
expect(config.authToken).toBe("test_auth_token");
|
|
55
|
+
expect(config.phoneNumber).toBe("+15551234567");
|
|
56
|
+
expect(config.webhookBaseUrl).toBe("https://test.example.com");
|
|
57
|
+
expect(config.wssBaseUrl).toBe("wss://test.example.com/twilio/relay");
|
|
56
58
|
});
|
|
57
59
|
|
|
58
|
-
test(
|
|
59
|
-
mockSecureKeys[
|
|
60
|
-
expect(() => getTwilioConfig()).toThrow(
|
|
60
|
+
test("throws ConfigError when account SID is missing", () => {
|
|
61
|
+
mockSecureKeys["credential:twilio:account_sid"] = null;
|
|
62
|
+
expect(() => getTwilioConfig()).toThrow(
|
|
63
|
+
/Twilio credentials not configured/,
|
|
64
|
+
);
|
|
61
65
|
});
|
|
62
66
|
|
|
63
|
-
test(
|
|
64
|
-
mockSecureKeys[
|
|
65
|
-
expect(() => getTwilioConfig()).toThrow(
|
|
67
|
+
test("throws ConfigError when auth token is missing", () => {
|
|
68
|
+
mockSecureKeys["credential:twilio:auth_token"] = null;
|
|
69
|
+
expect(() => getTwilioConfig()).toThrow(
|
|
70
|
+
/Twilio credentials not configured/,
|
|
71
|
+
);
|
|
66
72
|
});
|
|
67
73
|
|
|
68
|
-
test(
|
|
74
|
+
test("throws ConfigError when phone number is missing", () => {
|
|
69
75
|
mockLoadConfigResult = { sms: {} };
|
|
70
76
|
mockPhoneNumberEnv = undefined;
|
|
71
|
-
mockSecureKeys[
|
|
72
|
-
expect(() => getTwilioConfig()).toThrow(
|
|
77
|
+
mockSecureKeys["credential:twilio:phone_number"] = null;
|
|
78
|
+
expect(() => getTwilioConfig()).toThrow(
|
|
79
|
+
/Twilio phone number not configured/,
|
|
80
|
+
);
|
|
73
81
|
});
|
|
74
82
|
|
|
75
|
-
test(
|
|
76
|
-
mockPhoneNumberEnv =
|
|
83
|
+
test("prefers TWILIO_PHONE_NUMBER env var over config phone number", () => {
|
|
84
|
+
mockPhoneNumberEnv = "+15559999999";
|
|
77
85
|
const config = getTwilioConfig();
|
|
78
|
-
expect(config.phoneNumber).toBe(
|
|
86
|
+
expect(config.phoneNumber).toBe("+15559999999");
|
|
79
87
|
});
|
|
80
88
|
|
|
81
|
-
test(
|
|
89
|
+
test("falls back to secure key for phone number", () => {
|
|
82
90
|
mockLoadConfigResult = { sms: {} };
|
|
83
91
|
mockPhoneNumberEnv = undefined;
|
|
84
|
-
mockSecureKeys[
|
|
92
|
+
mockSecureKeys["credential:twilio:phone_number"] = "+15558888888";
|
|
85
93
|
const config = getTwilioConfig();
|
|
86
|
-
expect(config.phoneNumber).toBe(
|
|
94
|
+
expect(config.phoneNumber).toBe("+15558888888");
|
|
87
95
|
});
|
|
88
96
|
|
|
89
|
-
test(
|
|
97
|
+
test("returns global phone number when assistantPhoneNumbers mapping exists", () => {
|
|
90
98
|
mockLoadConfigResult = {
|
|
91
99
|
sms: {
|
|
92
|
-
phoneNumber:
|
|
93
|
-
assistantPhoneNumbers: {
|
|
100
|
+
phoneNumber: "+15551234567",
|
|
101
|
+
assistantPhoneNumbers: { "ast-1": "+15557777777" },
|
|
94
102
|
},
|
|
95
103
|
};
|
|
96
104
|
const config = getTwilioConfig();
|
|
97
|
-
expect(config.phoneNumber).toBe(
|
|
105
|
+
expect(config.phoneNumber).toBe("+15551234567");
|
|
98
106
|
});
|
|
99
107
|
});
|