@vellumai/assistant 0.4.50 → 0.4.51

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 (153) hide show
  1. package/docs/architecture/integrations.md +2 -2
  2. package/docs/architecture/keychain-broker.md +6 -6
  3. package/knip.json +32 -0
  4. package/package.json +3 -2
  5. package/src/__tests__/btw-routes.test.ts +61 -5
  6. package/src/__tests__/config-watcher.test.ts +8 -0
  7. package/src/__tests__/credential-security-invariants.test.ts +8 -7
  8. package/src/__tests__/credential-vault-unit.test.ts +19 -18
  9. package/src/__tests__/credential-vault.test.ts +17 -17
  10. package/src/__tests__/credentials-cli.test.ts +257 -82
  11. package/src/__tests__/inbound-invite-redemption.test.ts +36 -7
  12. package/src/__tests__/integration-status.test.ts +31 -30
  13. package/src/__tests__/invite-redemption-service.test.ts +121 -32
  14. package/src/__tests__/invite-routes-http.test.ts +166 -5
  15. package/src/__tests__/list-messages-attachments.test.ts +193 -0
  16. package/src/__tests__/oauth-cli.test.ts +286 -60
  17. package/src/__tests__/oauth-provider-profiles.test.ts +1 -1
  18. package/src/__tests__/oauth-store.test.ts +243 -11
  19. package/src/__tests__/relay-server.test.ts +9 -0
  20. package/src/__tests__/secret-routes-managed-proxy.test.ts +183 -0
  21. package/src/__tests__/secure-keys.test.ts +71 -16
  22. package/src/__tests__/server-history-render.test.ts +2 -2
  23. package/src/__tests__/skills.test.ts +2 -2
  24. package/src/__tests__/slack-channel-config.test.ts +10 -8
  25. package/src/__tests__/twilio-config.test.ts +11 -10
  26. package/src/__tests__/twilio-provider.test.ts +9 -4
  27. package/src/__tests__/voice-invite-redemption.test.ts +58 -9
  28. package/src/calls/call-domain.ts +3 -4
  29. package/src/calls/relay-server.ts +1 -1
  30. package/src/calls/twilio-config.ts +4 -3
  31. package/src/calls/twilio-provider.ts +14 -9
  32. package/src/calls/twilio-rest.ts +10 -7
  33. package/src/cli/commands/config.ts +14 -9
  34. package/src/cli/commands/contacts.ts +3 -0
  35. package/src/cli/commands/credentials.ts +170 -174
  36. package/src/cli/commands/doctor.ts +7 -5
  37. package/src/cli/commands/keys.ts +9 -9
  38. package/src/cli/commands/oauth/apps.ts +40 -11
  39. package/src/cli/commands/oauth/connections.ts +66 -30
  40. package/src/cli/commands/oauth/index.ts +3 -3
  41. package/src/cli/commands/oauth/providers.ts +3 -3
  42. package/src/cli.ts +16 -12
  43. package/src/config/__tests__/feature-flag-registry-bundled.test.ts +39 -0
  44. package/src/config/bundled-skills/contacts/SKILL.md +35 -11
  45. package/src/config/bundled-skills/contacts/tools/google-contacts.ts +1 -1
  46. package/src/config/bundled-skills/gmail/SKILL.md +1 -1
  47. package/src/config/bundled-skills/gmail/TOOLS.json +52 -0
  48. package/src/config/bundled-skills/gmail/tools/gmail-archive.ts +13 -3
  49. package/src/config/bundled-skills/gmail/tools/gmail-attachments.ts +9 -2
  50. package/src/config/bundled-skills/gmail/tools/gmail-draft.ts +5 -1
  51. package/src/config/bundled-skills/gmail/tools/gmail-filters.ts +5 -1
  52. package/src/config/bundled-skills/gmail/tools/gmail-follow-up.ts +5 -1
  53. package/src/config/bundled-skills/gmail/tools/gmail-forward.ts +5 -1
  54. package/src/config/bundled-skills/gmail/tools/gmail-label.ts +9 -2
  55. package/src/config/bundled-skills/gmail/tools/gmail-outreach-scan.ts +5 -1
  56. package/src/config/bundled-skills/gmail/tools/gmail-send-draft.ts +5 -1
  57. package/src/config/bundled-skills/gmail/tools/gmail-sender-digest.ts +5 -1
  58. package/src/config/bundled-skills/gmail/tools/gmail-trash.ts +5 -1
  59. package/src/config/bundled-skills/gmail/tools/gmail-unsubscribe.ts +5 -1
  60. package/src/config/bundled-skills/gmail/tools/gmail-vacation.ts +5 -1
  61. package/src/config/bundled-skills/google-calendar/TOOLS.json +20 -0
  62. package/src/config/bundled-skills/google-calendar/tools/calendar-check-availability.ts +2 -1
  63. package/src/config/bundled-skills/google-calendar/tools/calendar-create-event.ts +2 -1
  64. package/src/config/bundled-skills/google-calendar/tools/calendar-get-event.ts +2 -1
  65. package/src/config/bundled-skills/google-calendar/tools/calendar-list-events.ts +2 -1
  66. package/src/config/bundled-skills/google-calendar/tools/calendar-rsvp.ts +2 -1
  67. package/src/config/bundled-skills/google-calendar/tools/shared.ts +8 -2
  68. package/src/config/bundled-skills/messaging/SKILL.md +1 -1
  69. package/src/config/bundled-skills/messaging/tools/messaging-analyze-style.ts +2 -2
  70. package/src/config/bundled-skills/messaging/tools/messaging-archive-by-sender.ts +2 -2
  71. package/src/config/bundled-skills/messaging/tools/messaging-auth-test.ts +2 -2
  72. package/src/config/bundled-skills/messaging/tools/messaging-list-conversations.ts +2 -2
  73. package/src/config/bundled-skills/messaging/tools/messaging-mark-read.ts +2 -2
  74. package/src/config/bundled-skills/messaging/tools/messaging-read.ts +2 -2
  75. package/src/config/bundled-skills/messaging/tools/messaging-search.ts +2 -2
  76. package/src/config/bundled-skills/messaging/tools/messaging-send.ts +2 -2
  77. package/src/config/bundled-skills/messaging/tools/messaging-sender-digest.ts +2 -2
  78. package/src/config/bundled-skills/messaging/tools/shared.ts +7 -5
  79. package/src/config/bundled-skills/slack/tools/shared.ts +1 -1
  80. package/src/config/bundled-skills/slack/tools/slack-add-reaction.ts +1 -1
  81. package/src/config/bundled-skills/slack/tools/slack-channel-details.ts +1 -1
  82. package/src/config/bundled-skills/slack/tools/slack-delete-message.ts +1 -1
  83. package/src/config/bundled-skills/slack/tools/slack-edit-message.ts +1 -1
  84. package/src/config/bundled-skills/slack/tools/slack-leave-channel.ts +1 -1
  85. package/src/config/bundled-skills/slack/tools/slack-scan-digest.ts +1 -1
  86. package/src/config/loader.ts +6 -42
  87. package/src/contacts/contact-store.ts +39 -2
  88. package/src/contacts/contacts-write.ts +9 -0
  89. package/src/daemon/config-watcher.ts +8 -13
  90. package/src/daemon/handlers/config-ingress.ts +2 -2
  91. package/src/daemon/handlers/config-slack-channel.ts +59 -39
  92. package/src/daemon/handlers/config-telegram.ts +23 -14
  93. package/src/daemon/handlers/session-history.ts +1 -358
  94. package/src/daemon/handlers/shared.ts +3 -17
  95. package/src/daemon/lifecycle.ts +8 -1
  96. package/src/daemon/message-types/sessions.ts +0 -42
  97. package/src/daemon/server.ts +0 -6
  98. package/src/daemon/session-slash.ts +3 -5
  99. package/src/email/providers/index.ts +2 -2
  100. package/src/media/avatar-router.ts +1 -1
  101. package/src/memory/conversation-queries.ts +3 -80
  102. package/src/memory/db-init.ts +4 -0
  103. package/src/memory/invite-store.ts +19 -0
  104. package/src/memory/migrations/149-oauth-tables.ts +1 -1
  105. package/src/memory/migrations/150-oauth-apps-client-secret-path.ts +1 -1
  106. package/src/memory/migrations/157-invite-contact-id.ts +104 -0
  107. package/src/memory/migrations/index.ts +1 -0
  108. package/src/memory/migrations/registry.ts +6 -0
  109. package/src/memory/schema/contacts.ts +1 -0
  110. package/src/messaging/provider.ts +1 -1
  111. package/src/messaging/providers/gmail/adapter.ts +1 -1
  112. package/src/messaging/providers/telegram-bot/adapter.ts +17 -8
  113. package/src/messaging/providers/whatsapp/adapter.ts +13 -9
  114. package/src/messaging/registry.ts +9 -5
  115. package/src/oauth/byo-connection.test.ts +32 -24
  116. package/src/oauth/connect-orchestrator.ts +4 -10
  117. package/src/oauth/connection-resolver.ts +20 -6
  118. package/src/oauth/manual-token-connection.ts +5 -5
  119. package/src/oauth/oauth-store.ts +83 -17
  120. package/src/oauth/platform-connection.test.ts +1 -1
  121. package/src/oauth/provider-behaviors.ts +503 -4
  122. package/src/oauth/seed-providers.ts +208 -8
  123. package/src/oauth/token-persistence.ts +20 -13
  124. package/src/runtime/channel-readiness-service.ts +48 -40
  125. package/src/runtime/http-types.ts +2 -0
  126. package/src/runtime/invite-redemption-service.ts +71 -29
  127. package/src/runtime/invite-service.ts +40 -22
  128. package/src/runtime/middleware/twilio-validation.ts +1 -1
  129. package/src/runtime/routes/btw-routes.ts +10 -5
  130. package/src/runtime/routes/conversation-routes.ts +47 -10
  131. package/src/runtime/routes/integrations/slack/channel.ts +2 -2
  132. package/src/runtime/routes/integrations/telegram.ts +2 -2
  133. package/src/runtime/routes/integrations/twilio.ts +17 -17
  134. package/src/runtime/routes/invite-routes.ts +29 -4
  135. package/src/runtime/routes/secret-routes.ts +17 -0
  136. package/src/runtime/routes/settings-routes.ts +3 -3
  137. package/src/runtime/routes/workspace-routes.ts +7 -3
  138. package/src/runtime/routes/workspace-utils.ts +8 -2
  139. package/src/schedule/integration-status.ts +26 -19
  140. package/src/security/oauth2.ts +6 -7
  141. package/src/security/secure-keys.ts +19 -16
  142. package/src/security/token-manager.ts +13 -6
  143. package/src/services/vercel-deploy.ts +0 -24
  144. package/src/signals/confirm.ts +78 -0
  145. package/src/signals/mcp-reload.ts +18 -0
  146. package/src/tools/credentials/vault.ts +22 -5
  147. package/src/tools/network/script-proxy/session-manager.ts +8 -8
  148. package/src/tools/schedule/create.ts +2 -2
  149. package/src/watcher/provider-types.ts +1 -1
  150. package/src/watcher/providers/github.ts +1 -1
  151. package/src/watcher/providers/gmail.ts +3 -3
  152. package/src/watcher/providers/google-calendar.ts +3 -3
  153. package/src/watcher/providers/linear.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  import { createHmac, timingSafeEqual } from "node:crypto";
2
2
 
3
3
  import { credentialKey } from "../security/credential-key.js";
4
- import { getSecureKey } from "../security/secure-keys.js";
4
+ import { getSecureKeyAsync } from "../security/secure-keys.js";
5
5
  import { ProviderError } from "../util/errors.js";
6
6
  import { getLogger } from "../util/logger.js";
7
7
  import {
@@ -24,8 +24,11 @@ export class TwilioConversationRelayProvider implements VoiceProvider {
24
24
 
25
25
  // ── Credential helpers ──────────────────────────────────────────────
26
26
 
27
- private getCredentials(): { accountSid: string; authToken: string } {
28
- return getTwilioCredentials();
27
+ private async getCredentials(): Promise<{
28
+ accountSid: string;
29
+ authToken: string;
30
+ }> {
31
+ return await getTwilioCredentials();
29
32
  }
30
33
 
31
34
  private authHeader(accountSid: string, authToken: string): string {
@@ -39,7 +42,7 @@ export class TwilioConversationRelayProvider implements VoiceProvider {
39
42
  // ── VoiceProvider interface ─────────────────────────────────────────
40
43
 
41
44
  async initiateCall(opts: InitiateCallOptions): Promise<{ callSid: string }> {
42
- const { accountSid, authToken } = this.getCredentials();
45
+ const { accountSid, authToken } = await this.getCredentials();
43
46
 
44
47
  const body = new URLSearchParams({
45
48
  From: opts.from,
@@ -104,7 +107,7 @@ export class TwilioConversationRelayProvider implements VoiceProvider {
104
107
  }
105
108
 
106
109
  async endCall(callSid: string): Promise<void> {
107
- const { accountSid, authToken } = this.getCredentials();
110
+ const { accountSid, authToken } = await this.getCredentials();
108
111
 
109
112
  log.info({ callSid }, "Ending Twilio call");
110
113
 
@@ -139,7 +142,7 @@ export class TwilioConversationRelayProvider implements VoiceProvider {
139
142
  }
140
143
 
141
144
  async getCallStatus(callSid: string): Promise<string> {
142
- const { accountSid, authToken } = this.getCredentials();
145
+ const { accountSid, authToken } = await this.getCredentials();
143
146
 
144
147
  const res = await fetch(
145
148
  `${this.baseUrl(accountSid)}/Calls/${callSid}.json`,
@@ -179,7 +182,7 @@ export class TwilioConversationRelayProvider implements VoiceProvider {
179
182
  async checkCallerIdEligibility(
180
183
  phoneNumber: string,
181
184
  ): Promise<{ eligible: boolean; reason?: string }> {
182
- const { accountSid, authToken } = this.getCredentials();
185
+ const { accountSid, authToken } = await this.getCredentials();
183
186
  const encodedNumber = encodeURIComponent(phoneNumber);
184
187
 
185
188
  let incomingOk = false;
@@ -280,8 +283,10 @@ export class TwilioConversationRelayProvider implements VoiceProvider {
280
283
  * Exposed as a static method so callers (e.g. the HTTP server webhook
281
284
  * middleware) can check availability independently.
282
285
  */
283
- static getAuthToken(): string | null {
284
- return getSecureKey(credentialKey("twilio", "auth_token")) || null;
286
+ static async getAuthToken(): Promise<string | null> {
287
+ return (
288
+ (await getSecureKeyAsync(credentialKey("twilio", "auth_token"))) || null
289
+ );
285
290
  }
286
291
 
287
292
  /**
@@ -8,7 +8,7 @@
8
8
 
9
9
  import { loadConfig } from "../config/loader.js";
10
10
  import { credentialKey } from "../security/credential-key.js";
11
- import { getSecureKey } from "../security/secure-keys.js";
11
+ import { getSecureKeyAsync } from "../security/secure-keys.js";
12
12
  import { ConfigError, ProviderError } from "../util/errors.js";
13
13
 
14
14
  export interface TwilioCredentials {
@@ -28,14 +28,17 @@ function resolveAccountSid(): string | undefined {
28
28
  }
29
29
 
30
30
  /** Resolve the Twilio Auth Token from the credential store. */
31
- function resolveAuthToken(): string | undefined {
32
- return getSecureKey(credentialKey("twilio", "auth_token")) || undefined;
31
+ async function resolveAuthToken(): Promise<string | undefined> {
32
+ return (
33
+ (await getSecureKeyAsync(credentialKey("twilio", "auth_token"))) ||
34
+ undefined
35
+ );
33
36
  }
34
37
 
35
38
  /** Resolve Twilio credentials from config (SID) and credential store (token). Throws if not configured. */
36
- export function getTwilioCredentials(): TwilioCredentials {
39
+ export async function getTwilioCredentials(): Promise<TwilioCredentials> {
37
40
  const accountSid = resolveAccountSid();
38
- const authToken = resolveAuthToken();
41
+ const authToken = await resolveAuthToken();
39
42
  if (!accountSid || !authToken) {
40
43
  throw new ConfigError(
41
44
  "Twilio credentials not configured. Set twilio.accountSid via config and store auth token via credential store.",
@@ -45,9 +48,9 @@ export function getTwilioCredentials(): TwilioCredentials {
45
48
  }
46
49
 
47
50
  /** Check whether Twilio credentials are present (non-throwing). */
48
- export function hasTwilioCredentials(): boolean {
51
+ export async function hasTwilioCredentials(): Promise<boolean> {
49
52
  try {
50
- return !!resolveAccountSid() && !!resolveAuthToken();
53
+ return !!resolveAccountSid() && !!(await resolveAuthToken());
51
54
  } catch {
52
55
  return false;
53
56
  }
@@ -39,10 +39,13 @@ export function registerConfigCommand(program: Command): void {
39
39
  "after",
40
40
  `
41
41
  Configuration is stored in config.json in the assistant workspace directory.
42
- Keys support dotted paths for nested values (e.g. calls.enabled, apiKeys.anthropic).
42
+ Keys support dotted paths for nested values (e.g. calls.enabled, twilio.accountSid).
43
43
  Values are auto-parsed as JSON (booleans, numbers, objects) with fallback to
44
44
  plain string if parsing fails.
45
45
 
46
+ API keys are managed separately via secure storage. Use "assistant keys list"
47
+ and "assistant keys set <provider> <key>" to view and manage API keys.
48
+
46
49
  Examples:
47
50
  $ assistant config list
48
51
  $ assistant config get provider
@@ -53,14 +56,14 @@ Examples:
53
56
  config
54
57
  .command("set <key> <value>")
55
58
  .description(
56
- "Set a config value (supports dotted paths like apiKeys.anthropic)",
59
+ "Set a config value (supports dotted paths like calls.enabled)",
57
60
  )
58
61
  .addHelpText(
59
62
  "after",
60
63
  `
61
64
  Arguments:
62
65
  key Dotted path to the config key (e.g. provider, calls.enabled,
63
- apiKeys.anthropic). Intermediate objects are created automatically.
66
+ twilio.accountSid). Intermediate objects are created automatically.
64
67
  value The value to store. Parsed as JSON first (so "true" becomes boolean
65
68
  true, "42" becomes number 42). Falls back to plain string if JSON
66
69
  parsing fails.
@@ -68,10 +71,11 @@ Arguments:
68
71
  After writing the value to config.json, the lockfile is automatically synced
69
72
  to reflect the updated configuration.
70
73
 
74
+ To manage API keys, use "assistant keys set <provider> <key>" instead.
75
+
71
76
  Examples:
72
77
  $ assistant config set provider anthropic
73
- $ assistant config set calls.enabled true
74
- $ assistant config set apiKeys.anthropic sk-ant-abc123`,
78
+ $ assistant config set calls.enabled true`,
75
79
  )
76
80
  .action((key: string, value: string) => {
77
81
  const raw = loadRawConfig();
@@ -100,10 +104,11 @@ Arguments:
100
104
  Prints the value at the given key path. If the key is not set, prints
101
105
  "(not set)". Object values are pretty-printed as indented JSON.
102
106
 
107
+ To view API keys, use "assistant keys list" instead.
108
+
103
109
  Examples:
104
110
  $ assistant config get provider
105
- $ assistant config get calls.enabled
106
- $ assistant config get apiKeys`,
111
+ $ assistant config get calls.enabled`,
107
112
  )
108
113
  .action((key: string) => {
109
114
  const raw = loadRawConfig();
@@ -133,8 +138,8 @@ Dumps the full raw configuration from config.json as pretty-printed JSON.
133
138
  If no configuration has been set, prints "No configuration set".
134
139
 
135
140
  The --search flag filters results by case-insensitive substring match against
136
- flattened dotted key paths. For example, --search api matches apiKeys.anthropic,
137
- apiKeys.openai, and any other key containing "api".
141
+ flattened dotted key paths. For example, --search calls matches calls.enabled,
142
+ calls.recordingEnabled, and any other key containing "calls".
138
143
 
139
144
  Examples:
140
145
  $ assistant config list
@@ -497,6 +497,7 @@ Examples:
497
497
  "--guardian-name <name>",
498
498
  "Guardian name (required for voice invites)",
499
499
  )
500
+ .requiredOption("--contact-id <id>", "Contact ID to bind the invite to")
500
501
  .addHelpText(
501
502
  "after",
502
503
  `
@@ -529,6 +530,7 @@ Examples:
529
530
  expectedExternalUserId?: string;
530
531
  friendName?: string;
531
532
  guardianName?: string;
533
+ contactId: string;
532
534
  },
533
535
  cmd: Command,
534
536
  ) => {
@@ -563,6 +565,7 @@ Examples:
563
565
  expectedExternalUserId: opts.expectedExternalUserId,
564
566
  friendName: opts.friendName,
565
567
  guardianName: opts.guardianName,
568
+ contactId: opts.contactId,
566
569
  });
567
570
  if (result.ok) {
568
571
  writeOutput(cmd, { ok: true, invite: result.data });