@vellumai/assistant 0.4.37 → 0.4.41

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 (169) hide show
  1. package/ARCHITECTURE.md +3 -3
  2. package/README.md +13 -13
  3. package/bun.lock +80 -24
  4. package/docs/architecture/integrations.md +126 -128
  5. package/docs/runbook-trusted-contacts.md +1 -1
  6. package/docs/trusted-contact-access.md +12 -12
  7. package/package.json +3 -1
  8. package/src/__tests__/__snapshots__/ipc-snapshot.test.ts.snap +0 -14
  9. package/src/__tests__/app-bundler.test.ts +209 -0
  10. package/src/__tests__/app-compiler.test.ts +279 -0
  11. package/src/__tests__/app-executors.test.ts +293 -483
  12. package/src/__tests__/app-migration.test.ts +148 -0
  13. package/src/__tests__/app-routes-csp.test.ts +202 -0
  14. package/src/__tests__/avatar-e2e.test.ts +452 -0
  15. package/src/__tests__/avatar-generator.test.ts +193 -0
  16. package/src/__tests__/avatar-router.test.ts +186 -0
  17. package/src/__tests__/browser-download-timeout.test.ts +28 -0
  18. package/src/__tests__/bundled-skill-retrieval-guard.test.ts +9 -9
  19. package/src/__tests__/call-domain.test.ts +3 -7
  20. package/src/__tests__/credential-security-e2e.test.ts +19 -12
  21. package/src/__tests__/credentials-cli.test.ts +30 -4
  22. package/src/__tests__/guardian-verify-setup-skill-regression.test.ts +1 -1
  23. package/src/__tests__/handlers-slack-config.test.ts +0 -72
  24. package/src/__tests__/handlers-telegram-config.test.ts +19 -12
  25. package/src/__tests__/handlers-twitter-config.test.ts +105 -48
  26. package/src/__tests__/inbound-invite-redemption.test.ts +4 -4
  27. package/src/__tests__/integration-status.test.ts +15 -5
  28. package/src/__tests__/integrations-cli.test.ts +1 -1
  29. package/src/__tests__/invite-redemption-service.test.ts +62 -7
  30. package/src/__tests__/ipc-snapshot.test.ts +0 -8
  31. package/src/__tests__/managed-avatar-client.test.ts +280 -0
  32. package/src/__tests__/mcp-cli.test.ts +3 -3
  33. package/src/__tests__/oauth-cli.test.ts +203 -0
  34. package/src/__tests__/relay-server.test.ts +3 -3
  35. package/src/__tests__/secret-onetime-send.test.ts +19 -12
  36. package/src/__tests__/secure-keys.test.ts +78 -0
  37. package/src/__tests__/session-messaging-secret-redirect.test.ts +3 -0
  38. package/src/__tests__/slack-channel-config.test.ts +23 -16
  39. package/src/__tests__/slack-share-routes.test.ts +263 -0
  40. package/src/__tests__/sms-messaging-provider.test.ts +3 -1
  41. package/src/__tests__/trusted-contact-lifecycle-notifications.test.ts +7 -7
  42. package/src/__tests__/trusted-contact-multichannel.test.ts +3 -3
  43. package/src/__tests__/trusted-contact-verification.test.ts +10 -10
  44. package/src/__tests__/twilio-config.test.ts +15 -36
  45. package/src/__tests__/twilio-provider.test.ts +4 -0
  46. package/src/__tests__/twitter-auth-handler.test.ts +27 -14
  47. package/src/__tests__/twitter-cli-error-shaping.test.ts +1 -1
  48. package/src/__tests__/twitter-cli-routing.test.ts +38 -53
  49. package/src/__tests__/twitter-oauth-client.test.ts +18 -47
  50. package/src/__tests__/voice-invite-redemption.test.ts +27 -3
  51. package/src/amazon/cart.ts +1 -1
  52. package/src/amazon/client.ts +89 -7
  53. package/src/approvals/guardian-request-resolvers.ts +2 -2
  54. package/src/bundler/app-bundler.ts +77 -32
  55. package/src/bundler/app-compiler.ts +195 -0
  56. package/src/bundler/manifest.ts +1 -1
  57. package/src/bundler/package-resolver.ts +185 -0
  58. package/src/calls/call-domain.ts +4 -14
  59. package/src/calls/relay-server.ts +2 -2
  60. package/src/calls/twilio-config.ts +5 -24
  61. package/src/calls/twilio-rest.ts +19 -5
  62. package/src/cli/amazon.ts +74 -249
  63. package/src/cli/audit.ts +2 -2
  64. package/src/cli/autonomy.ts +9 -9
  65. package/src/cli/channels.ts +5 -5
  66. package/src/cli/completions.ts +27 -27
  67. package/src/cli/config.ts +14 -14
  68. package/src/cli/contacts.ts +27 -27
  69. package/src/cli/credentials.ts +28 -28
  70. package/src/cli/dev.ts +2 -2
  71. package/src/cli/doctor.ts +2 -2
  72. package/src/cli/email.ts +82 -82
  73. package/src/cli/influencer.ts +13 -13
  74. package/src/cli/integrations.ts +19 -144
  75. package/src/cli/keys.ts +10 -10
  76. package/src/cli/map.ts +4 -4
  77. package/src/cli/mcp.ts +17 -17
  78. package/src/cli/memory.ts +18 -18
  79. package/src/cli/notifications.ts +13 -13
  80. package/src/cli/oauth.ts +77 -0
  81. package/src/cli/program.ts +2 -0
  82. package/src/cli/sequence.ts +27 -27
  83. package/src/cli/sessions.ts +12 -12
  84. package/src/cli/trust.ts +8 -8
  85. package/src/cli/twitter.ts +124 -70
  86. package/src/config/bundled-skills/_shared/CLI_RETRIEVAL_PATTERN.md +1 -1
  87. package/src/config/bundled-skills/agentmail/SKILL.md +34 -34
  88. package/src/config/bundled-skills/amazon/SKILL.md +54 -54
  89. package/src/config/bundled-skills/app-builder/SKILL.md +137 -3
  90. package/src/config/bundled-skills/app-builder/tools/app-create.ts +10 -4
  91. package/src/config/bundled-skills/configure-settings/SKILL.md +18 -18
  92. package/src/config/bundled-skills/contacts/SKILL.md +12 -12
  93. package/src/config/bundled-skills/doordash/lib/client.ts +7 -9
  94. package/src/config/bundled-skills/email-setup/SKILL.md +4 -4
  95. package/src/config/bundled-skills/frontend-design/icon.svg +16 -0
  96. package/src/config/bundled-skills/google-oauth-setup/SKILL.md +143 -162
  97. package/src/config/bundled-skills/guardian-verify-setup/SKILL.md +4 -4
  98. package/src/config/bundled-skills/influencer/SKILL.md +13 -13
  99. package/src/config/bundled-skills/mcp-setup/SKILL.md +11 -11
  100. package/src/config/bundled-skills/phone-calls/SKILL.md +48 -54
  101. package/src/config/bundled-skills/public-ingress/SKILL.md +6 -6
  102. package/src/config/bundled-skills/slack-app-setup/SKILL.md +1 -1
  103. package/src/config/bundled-skills/sms-setup/SKILL.md +3 -3
  104. package/src/config/bundled-skills/telegram-setup/SKILL.md +2 -2
  105. package/src/config/bundled-skills/twilio-setup/SKILL.md +136 -225
  106. package/src/config/bundled-skills/twitter/SKILL.md +68 -44
  107. package/src/config/bundled-skills/voice-setup/SKILL.md +2 -2
  108. package/src/config/core-schema.ts +26 -0
  109. package/src/config/env.ts +4 -0
  110. package/src/config/feature-flag-registry.json +9 -1
  111. package/src/config/schema.ts +8 -0
  112. package/src/config/system-prompt.ts +6 -3
  113. package/src/config/templates/BOOTSTRAP.md +7 -5
  114. package/src/contacts/contacts-write.ts +5 -1
  115. package/src/daemon/handlers/apps.ts +31 -4
  116. package/src/daemon/handlers/config-ingress.ts +3 -3
  117. package/src/daemon/handlers/config-integrations.ts +120 -49
  118. package/src/daemon/handlers/config-slack-channel.ts +26 -7
  119. package/src/daemon/handlers/config-slack.ts +1 -54
  120. package/src/daemon/handlers/config-telegram.ts +28 -10
  121. package/src/daemon/handlers/config.ts +1 -4
  122. package/src/daemon/handlers/twitter-auth.ts +11 -4
  123. package/src/daemon/ipc-contract/apps.ts +0 -13
  124. package/src/daemon/ipc-contract-inventory.json +0 -2
  125. package/src/daemon/lifecycle.ts +8 -1
  126. package/src/daemon/session-messaging.ts +2 -2
  127. package/src/daemon/tool-side-effects.ts +30 -0
  128. package/src/email/providers/agentmail.ts +1 -1
  129. package/src/email/providers/index.ts +1 -1
  130. package/src/email/service.ts +1 -1
  131. package/src/gallery/default-gallery.ts +538 -0
  132. package/src/gallery/gallery-manifest.ts +5 -1
  133. package/src/influencer/client.ts +8 -6
  134. package/src/mcp/client.ts +1 -1
  135. package/src/media/avatar-router.ts +99 -0
  136. package/src/media/avatar-types.ts +60 -0
  137. package/src/media/managed-avatar-client.ts +189 -0
  138. package/src/memory/app-migration.ts +114 -0
  139. package/src/memory/app-store.ts +11 -0
  140. package/src/memory/qdrant-client.ts +1 -1
  141. package/src/messaging/providers/slack/client.ts +12 -2
  142. package/src/messaging/providers/sms/adapter.ts +6 -10
  143. package/src/migrations/data-layout.ts +8 -1
  144. package/src/oauth/token-persistence.ts +9 -6
  145. package/src/runtime/assistant-scope.ts +5 -0
  146. package/src/runtime/auth/route-policy.ts +4 -0
  147. package/src/runtime/channel-readiness-service.ts +9 -4
  148. package/src/runtime/gateway-internal-client.ts +11 -3
  149. package/src/runtime/http-server.ts +2 -0
  150. package/src/runtime/invite-redemption-service.ts +23 -13
  151. package/src/runtime/middleware/twilio-validation.ts +2 -2
  152. package/src/runtime/routes/app-routes.ts +131 -3
  153. package/src/runtime/routes/inbound-stages/verification-intercept.ts +3 -3
  154. package/src/runtime/routes/integration-routes.ts +2 -2
  155. package/src/runtime/routes/slack-share-routes.ts +235 -0
  156. package/src/runtime/routes/twilio-routes.ts +47 -34
  157. package/src/schedule/integration-status.ts +2 -3
  158. package/src/security/token-manager.ts +11 -3
  159. package/src/tools/apps/executors.ts +116 -8
  160. package/src/tools/browser/browser-manager.ts +30 -2
  161. package/src/tools/browser/chrome-cdp.ts +31 -3
  162. package/src/tools/credentials/vault.ts +9 -7
  163. package/src/tools/executor.ts +4 -0
  164. package/src/tools/system/avatar-generator.ts +55 -34
  165. package/src/twitter/client.ts +1 -1
  166. package/src/twitter/oauth-client.ts +31 -43
  167. package/src/twitter/router.ts +25 -23
  168. package/src/util/platform.ts +5 -0
  169. package/src/slack/slack-webhook.ts +0 -66
@@ -123,7 +123,6 @@ export type CallerIdentityResult =
123
123
  export async function resolveCallerIdentity(
124
124
  config: AssistantConfig,
125
125
  requestedMode?: "assistant_number" | "user_number",
126
- assistantId?: string,
127
126
  ): Promise<CallerIdentityResult> {
128
127
  const identityConfig = config.calls.callerIdentity;
129
128
  let mode: "assistant_number" | "user_number";
@@ -161,7 +160,7 @@ export async function resolveCallerIdentity(
161
160
  }
162
161
 
163
162
  if (mode === "assistant_number") {
164
- const twilioConfig = getTwilioConfig(assistantId);
163
+ const twilioConfig = getTwilioConfig();
165
164
  log.info(
166
165
  { mode, source, fromNumber: twilioConfig.phoneNumber },
167
166
  "Resolved caller identity",
@@ -395,7 +394,6 @@ export async function startCall(
395
394
  const identityResult = await resolveCallerIdentity(
396
395
  ingressConfig,
397
396
  callerIdentityMode,
398
- assistantId,
399
397
  );
400
398
  if (!identityResult.ok) {
401
399
  return { ok: false, error: identityResult.error, status: 400 };
@@ -883,12 +881,8 @@ export type StartGuardianVerificationCallResult =
883
881
  export async function startGuardianVerificationCall(
884
882
  input: StartGuardianVerificationCallInput,
885
883
  ): Promise<StartGuardianVerificationCallResult> {
886
- const {
887
- phoneNumber,
888
- guardianVerificationSessionId,
889
- assistantId = DAEMON_INTERNAL_ASSISTANT_ID,
890
- originConversationId,
891
- } = input;
884
+ const { phoneNumber, guardianVerificationSessionId, originConversationId } =
885
+ input;
892
886
 
893
887
  if (!phoneNumber || !E164_REGEX.test(phoneNumber)) {
894
888
  return {
@@ -905,11 +899,7 @@ export async function startGuardianVerificationCall(
905
899
  const provider = new TwilioConversationRelayProvider();
906
900
 
907
901
  // Resolve the assistant's Twilio number as the caller ID
908
- const identityResult = await resolveCallerIdentity(
909
- config,
910
- undefined,
911
- assistantId,
912
- );
902
+ const identityResult = await resolveCallerIdentity(config);
913
903
  if (!identityResult.ok) {
914
904
  return { ok: false, error: identityResult.error, status: 400 };
915
905
  }
@@ -19,7 +19,7 @@ import {
19
19
  createGuardianBinding,
20
20
  revokeGuardianBinding,
21
21
  touchContactInteraction,
22
- upsertMember,
22
+ upsertContactChannel,
23
23
  } from "../contacts/contacts-write.js";
24
24
  import { getAssistantName } from "../daemon/identity-helpers.js";
25
25
  import { getCanonicalGuardianRequest } from "../memory/canonical-guardian-store.js";
@@ -785,7 +785,7 @@ export class RelayConnection {
785
785
 
786
786
  if (!params.skipMemberActivation) {
787
787
  try {
788
- upsertMember({
788
+ upsertContactChannel({
789
789
  sourceChannel: "voice",
790
790
  externalUserId: fromNumber,
791
791
  externalChatId: fromNumber,
@@ -1,4 +1,3 @@
1
- import { getTwilioPhoneNumberEnv } from "../config/env.js";
2
1
  import { loadConfig } from "../config/loader.js";
3
2
  import {
4
3
  getPublicBaseUrl,
@@ -18,29 +17,11 @@ export interface TwilioConfig {
18
17
  wssBaseUrl: string;
19
18
  }
20
19
 
21
- function resolveTwilioPhoneNumber(
22
- config: ReturnType<typeof loadConfig>,
23
- assistantId?: string,
24
- ): string {
25
- if (assistantId) {
26
- const scoped = (
27
- config.sms?.assistantPhoneNumbers as Record<string, string> | undefined
28
- )?.[assistantId];
29
- if (scoped) return scoped;
30
- }
31
- return (
32
- getTwilioPhoneNumberEnv() ||
33
- config.sms?.phoneNumber ||
34
- getSecureKey("credential:twilio:phone_number") ||
35
- ""
36
- );
37
- }
38
-
39
- export function getTwilioConfig(assistantId?: string): TwilioConfig {
40
- const accountSid = getSecureKey("credential:twilio:account_sid");
41
- const authToken = getSecureKey("credential:twilio:auth_token");
20
+ export function getTwilioConfig(): TwilioConfig {
42
21
  const config = loadConfig();
43
- const phoneNumber = resolveTwilioPhoneNumber(config, assistantId);
22
+ const accountSid = config.twilio?.accountSid || "";
23
+ const authToken = getSecureKey("credential:twilio:auth_token");
24
+ const phoneNumber = config.twilio?.phoneNumber || "";
44
25
  const webhookBaseUrl = getPublicBaseUrl(config);
45
26
 
46
27
  let wssBaseUrl: string;
@@ -52,7 +33,7 @@ export function getTwilioConfig(assistantId?: string): TwilioConfig {
52
33
 
53
34
  if (!accountSid || !authToken) {
54
35
  throw new ConfigError(
55
- "Twilio credentials not configured. Set credential:twilio:account_sid and credential:twilio:auth_token via the credential_store tool.",
36
+ "Twilio credentials not configured. Set twilio.accountSid via config and twilio:auth_token via the credential_store tool.",
56
37
  );
57
38
  }
58
39
  if (!phoneNumber) {
@@ -6,6 +6,7 @@
6
6
  * config handler. Uses fetch() directly — no twilio npm package.
7
7
  */
8
8
 
9
+ import { loadConfig } from "../config/loader.js";
9
10
  import { getSecureKey } from "../security/secure-keys.js";
10
11
  import { ConfigError, ProviderError } from "../util/errors.js";
11
12
 
@@ -14,13 +15,27 @@ export interface TwilioCredentials {
14
15
  authToken: string;
15
16
  }
16
17
 
17
- /** Resolve Twilio credentials from the secure key store. Throws if not configured. */
18
+ /**
19
+ * Resolve the Twilio Account SID from config.
20
+ * Returns undefined if not found.
21
+ */
22
+ function resolveAccountSid(): string | undefined {
23
+ try {
24
+ const config = loadConfig();
25
+ if (config.twilio?.accountSid) return config.twilio.accountSid;
26
+ } catch {
27
+ // Config may not be available during early startup
28
+ }
29
+ return undefined;
30
+ }
31
+
32
+ /** Resolve Twilio credentials from config and secure key store. Throws if not configured. */
18
33
  export function getTwilioCredentials(): TwilioCredentials {
19
- const accountSid = getSecureKey("credential:twilio:account_sid");
34
+ const accountSid = resolveAccountSid();
20
35
  const authToken = getSecureKey("credential:twilio:auth_token");
21
36
  if (!accountSid || !authToken) {
22
37
  throw new ConfigError(
23
- "Twilio credentials not configured. Set credential:twilio:account_sid and credential:twilio:auth_token via the credential_store tool.",
38
+ "Twilio credentials not configured. Set twilio.accountSid via config and credential:twilio:auth_token via the credential_store tool.",
24
39
  );
25
40
  }
26
41
  return { accountSid, authToken };
@@ -29,8 +44,7 @@ export function getTwilioCredentials(): TwilioCredentials {
29
44
  /** Check whether Twilio credentials are present (non-throwing). */
30
45
  export function hasTwilioCredentials(): boolean {
31
46
  return (
32
- !!getSecureKey("credential:twilio:account_sid") &&
33
- !!getSecureKey("credential:twilio:auth_token")
47
+ !!resolveAccountSid() && !!getSecureKey("credential:twilio:auth_token")
34
48
  );
35
49
  }
36
50