@vellumai/assistant 0.5.11 → 0.5.13

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 (209) hide show
  1. package/Dockerfile +42 -9
  2. package/docs/architecture/integrations.md +34 -32
  3. package/node_modules/@vellumai/ces-contracts/src/__tests__/grants.test.ts +7 -7
  4. package/node_modules/@vellumai/ces-contracts/src/handles.ts +5 -4
  5. package/node_modules/@vellumai/ces-contracts/src/index.ts +7 -0
  6. package/node_modules/@vellumai/ces-contracts/src/rpc.ts +5 -0
  7. package/node_modules/@vellumai/credential-storage/src/index.ts +1 -1
  8. package/openapi.yaml +87 -9
  9. package/package.json +1 -1
  10. package/src/__tests__/catalog-cache.test.ts +164 -0
  11. package/src/__tests__/catalog-search.test.ts +61 -0
  12. package/src/__tests__/cli-command-risk-guard.test.ts +181 -6
  13. package/src/__tests__/conversation-delete-schedule-cleanup.test.ts +396 -0
  14. package/src/__tests__/conversation-error.test.ts +3 -2
  15. package/src/__tests__/credential-security-invariants.test.ts +9 -15
  16. package/src/__tests__/credential-vault-unit.test.ts +32 -34
  17. package/src/__tests__/credential-vault.test.ts +25 -33
  18. package/src/__tests__/credentials-cli.test.ts +3 -3
  19. package/src/__tests__/daemon-credential-client.test.ts +2 -2
  20. package/src/__tests__/first-greeting.test.ts +7 -0
  21. package/src/__tests__/host-bash-proxy.test.ts +79 -0
  22. package/src/__tests__/host-cu-proxy.test.ts +90 -0
  23. package/src/__tests__/host-file-proxy.test.ts +89 -0
  24. package/src/__tests__/integration-status.test.ts +5 -5
  25. package/src/__tests__/list-messages-attachments.test.ts +171 -0
  26. package/src/__tests__/mcp-abort-signal.test.ts +205 -0
  27. package/src/__tests__/messaging-send-tool.test.ts +5 -5
  28. package/src/__tests__/navigate-settings-tab.test.ts +6 -2
  29. package/src/__tests__/notification-telegram-adapter.test.ts +125 -0
  30. package/src/__tests__/oauth-cli.test.ts +126 -119
  31. package/src/__tests__/oauth-provider-profiles.test.ts +55 -20
  32. package/src/__tests__/oauth-scope-policy.test.ts +4 -6
  33. package/src/__tests__/onboarding-template-contract.test.ts +2 -2
  34. package/src/__tests__/platform.test.ts +3 -168
  35. package/src/__tests__/secret-routes-managed-proxy.test.ts +78 -0
  36. package/src/__tests__/secure-keys-managed-failover.test.ts +73 -0
  37. package/src/__tests__/skill-feature-flags.test.ts +8 -0
  38. package/src/__tests__/skill-secret-handling-guard.test.ts +212 -0
  39. package/src/__tests__/skills-uninstall.test.ts +2 -2
  40. package/src/__tests__/slack-messaging-token-resolution.test.ts +22 -24
  41. package/src/__tests__/slack-share-routes.test.ts +5 -5
  42. package/src/__tests__/system-prompt.test.ts +39 -0
  43. package/src/__tests__/token-estimator-accuracy.benchmark.test.ts +1 -1
  44. package/src/__tests__/workspace-migration-backfill-installation-id.test.ts +5 -4
  45. package/src/cli/AGENTS.md +47 -7
  46. package/src/cli/commands/browser-relay.ts +2 -17
  47. package/src/cli/commands/contacts.ts +6 -4
  48. package/src/cli/commands/conversations.ts +13 -1
  49. package/src/cli/commands/credential-execution.ts +16 -1
  50. package/src/cli/commands/credentials.ts +2 -8
  51. package/src/cli/commands/oauth/__tests__/connect.test.ts +29 -108
  52. package/src/cli/commands/oauth/__tests__/disconnect.test.ts +13 -87
  53. package/src/cli/commands/oauth/__tests__/mode.test.ts +22 -69
  54. package/src/cli/commands/oauth/__tests__/ping.test.ts +20 -79
  55. package/src/cli/commands/oauth/__tests__/providers-delete.test.ts +574 -0
  56. package/src/cli/commands/oauth/__tests__/providers-update.test.ts +416 -0
  57. package/src/cli/commands/oauth/__tests__/status.test.ts +12 -40
  58. package/src/cli/commands/oauth/__tests__/token.test.ts +3 -50
  59. package/src/cli/commands/oauth/apps.ts +63 -44
  60. package/src/cli/commands/oauth/connect.ts +187 -155
  61. package/src/cli/commands/oauth/disconnect.ts +27 -75
  62. package/src/cli/commands/oauth/index.ts +36 -46
  63. package/src/cli/commands/oauth/mode.ts +22 -34
  64. package/src/cli/commands/oauth/ping.ts +19 -45
  65. package/src/cli/commands/oauth/providers.ts +569 -62
  66. package/src/cli/commands/oauth/request.ts +36 -48
  67. package/src/cli/commands/oauth/shared.ts +1 -19
  68. package/src/cli/commands/oauth/status.ts +14 -25
  69. package/src/cli/commands/oauth/token.ts +25 -34
  70. package/src/cli/commands/platform/__tests__/connect.test.ts +224 -0
  71. package/src/cli/commands/platform/__tests__/disconnect.test.ts +237 -0
  72. package/src/cli/commands/platform/__tests__/status.test.ts +246 -0
  73. package/src/cli/commands/platform/connect.ts +104 -0
  74. package/src/cli/commands/platform/disconnect.ts +118 -0
  75. package/src/cli/commands/{platform.ts → platform/index.ts} +108 -38
  76. package/src/cli/commands/sequence.ts +5 -4
  77. package/src/cli/commands/shotgun.ts +16 -0
  78. package/src/cli/commands/skills.ts +173 -41
  79. package/src/cli/commands/usage.ts +5 -11
  80. package/src/cli/lib/daemon-credential-client.ts +22 -38
  81. package/src/cli/program.ts +1 -1
  82. package/src/config/assistant-feature-flags.ts +3 -7
  83. package/src/config/bundled-skills/contacts/tools/google-contacts.ts +1 -1
  84. package/src/config/bundled-skills/conversations/SKILL.md +20 -0
  85. package/src/config/bundled-skills/conversations/TOOLS.json +23 -0
  86. package/src/config/bundled-skills/conversations/tools/rename-conversation.ts +66 -0
  87. package/src/config/bundled-skills/gmail/SKILL.md +13 -13
  88. package/src/config/bundled-skills/gmail/tools/gmail-archive.ts +3 -3
  89. package/src/config/bundled-skills/gmail/tools/gmail-attachments.ts +2 -2
  90. package/src/config/bundled-skills/gmail/tools/gmail-draft.ts +1 -1
  91. package/src/config/bundled-skills/gmail/tools/gmail-filters.ts +1 -1
  92. package/src/config/bundled-skills/gmail/tools/gmail-follow-up.ts +1 -1
  93. package/src/config/bundled-skills/gmail/tools/gmail-forward.ts +1 -1
  94. package/src/config/bundled-skills/gmail/tools/gmail-label.ts +2 -2
  95. package/src/config/bundled-skills/gmail/tools/gmail-outreach-scan.ts +1 -1
  96. package/src/config/bundled-skills/gmail/tools/gmail-send-draft.ts +1 -1
  97. package/src/config/bundled-skills/gmail/tools/gmail-sender-digest.ts +1 -1
  98. package/src/config/bundled-skills/gmail/tools/gmail-trash.ts +1 -1
  99. package/src/config/bundled-skills/gmail/tools/gmail-unsubscribe.ts +1 -1
  100. package/src/config/bundled-skills/gmail/tools/gmail-vacation.ts +1 -1
  101. package/src/config/bundled-skills/google-calendar/SKILL.md +10 -4
  102. package/src/config/bundled-skills/google-calendar/tools/shared.ts +1 -1
  103. package/src/config/bundled-skills/messaging/SKILL.md +7 -7
  104. package/src/config/bundled-skills/messaging/tools/messaging-send.ts +5 -2
  105. package/src/config/bundled-skills/messaging/tools/shared.ts +5 -6
  106. package/src/config/bundled-skills/settings/TOOLS.json +5 -3
  107. package/src/config/bundled-skills/settings/tools/navigate-settings-tab.ts +4 -2
  108. package/src/config/bundled-tool-registry.ts +5 -0
  109. package/src/config/feature-flag-registry.json +2 -2
  110. package/src/credential-execution/client.ts +15 -3
  111. package/src/daemon/conversation-agent-loop.ts +2 -0
  112. package/src/daemon/conversation-error.ts +36 -6
  113. package/src/daemon/conversation-messaging.ts +9 -0
  114. package/src/daemon/conversation-runtime-assembly.ts +33 -0
  115. package/src/daemon/conversation-surfaces.ts +120 -14
  116. package/src/daemon/conversation.ts +5 -0
  117. package/src/daemon/first-greeting.ts +6 -1
  118. package/src/daemon/handlers/skills.ts +148 -3
  119. package/src/daemon/host-bash-proxy.ts +16 -0
  120. package/src/daemon/host-cu-proxy.ts +16 -0
  121. package/src/daemon/host-file-proxy.ts +16 -0
  122. package/src/daemon/lifecycle.ts +56 -5
  123. package/src/daemon/message-types/conversations.ts +1 -0
  124. package/src/daemon/message-types/guardian-actions.ts +2 -0
  125. package/src/daemon/message-types/host-bash.ts +6 -1
  126. package/src/daemon/message-types/host-cu.ts +6 -1
  127. package/src/daemon/message-types/host-file.ts +6 -1
  128. package/src/daemon/message-types/integrations.ts +0 -1
  129. package/src/daemon/server.ts +29 -2
  130. package/src/hooks/cli.ts +74 -0
  131. package/src/inbound/platform-callback-registration.ts +7 -12
  132. package/src/index.ts +0 -12
  133. package/src/mcp/client.ts +6 -1
  134. package/src/mcp/manager.ts +2 -1
  135. package/src/memory/conversation-crud.ts +92 -3
  136. package/src/memory/conversation-key-store.ts +26 -0
  137. package/src/memory/conversation-queries.ts +6 -6
  138. package/src/memory/db-init.ts +16 -0
  139. package/src/memory/journal-memory.ts +8 -2
  140. package/src/memory/migrations/196-messages-conversation-created-at-index.ts +9 -0
  141. package/src/memory/migrations/196-strip-integration-prefix-from-provider-keys.ts +186 -0
  142. package/src/memory/migrations/197-oauth-providers-behavior-columns.ts +29 -0
  143. package/src/memory/migrations/198-drop-setup-skill-id-column.ts +11 -0
  144. package/src/memory/migrations/index.ts +4 -0
  145. package/src/memory/migrations/registry.ts +8 -0
  146. package/src/memory/schema/oauth.ts +11 -0
  147. package/src/messaging/provider.ts +13 -12
  148. package/src/messaging/providers/gmail/adapter.ts +44 -35
  149. package/src/messaging/providers/slack/adapter.ts +63 -33
  150. package/src/messaging/providers/telegram-bot/adapter.ts +6 -8
  151. package/src/messaging/providers/whatsapp/adapter.ts +6 -8
  152. package/src/notifications/adapters/telegram.ts +78 -2
  153. package/src/oauth/__tests__/identity-verifier.test.ts +464 -0
  154. package/src/oauth/byo-connection.test.ts +22 -24
  155. package/src/oauth/connect-orchestrator.ts +37 -76
  156. package/src/oauth/connect-types.ts +7 -65
  157. package/src/oauth/connection-resolver.test.ts +13 -13
  158. package/src/oauth/connection-resolver.ts +3 -4
  159. package/src/oauth/identity-verifier.ts +177 -0
  160. package/src/oauth/oauth-store.ts +228 -3
  161. package/src/oauth/platform-connection.test.ts +56 -6
  162. package/src/oauth/platform-connection.ts +8 -1
  163. package/src/oauth/seed-providers.ts +247 -34
  164. package/src/permissions/checker.ts +127 -1
  165. package/src/prompts/journal-context.ts +4 -1
  166. package/src/prompts/system-prompt.ts +54 -9
  167. package/src/prompts/templates/BOOTSTRAP.md +16 -5
  168. package/src/providers/anthropic/client.ts +2 -33
  169. package/src/runtime/guardian-action-service.ts +7 -2
  170. package/src/runtime/http-server.ts +12 -18
  171. package/src/runtime/http-types.ts +8 -1
  172. package/src/runtime/migrations/rebind-secrets-screen.ts +2 -2
  173. package/src/runtime/routes/conversation-management-routes.ts +31 -0
  174. package/src/runtime/routes/conversation-routes.ts +79 -4
  175. package/src/runtime/routes/guardian-action-routes.ts +15 -2
  176. package/src/runtime/routes/inbound-stages/acl-enforcement.ts +21 -8
  177. package/src/runtime/routes/integrations/slack/share.ts +1 -1
  178. package/src/runtime/routes/oauth-apps.ts +2 -1
  179. package/src/runtime/routes/secret-routes.ts +45 -15
  180. package/src/runtime/routes/settings-routes.ts +12 -19
  181. package/src/runtime/routes/skills-routes.ts +45 -4
  182. package/src/schedule/integration-status.ts +2 -2
  183. package/src/security/ces-rpc-credential-backend.ts +19 -16
  184. package/src/security/oauth-completion-page.ts +153 -0
  185. package/src/security/oauth2.ts +3 -17
  186. package/src/security/secure-keys.ts +207 -7
  187. package/src/security/token-manager.ts +3 -6
  188. package/src/signals/bash.ts +6 -1
  189. package/src/skills/catalog-cache.ts +44 -0
  190. package/src/skills/catalog-search.ts +18 -0
  191. package/src/tools/browser/browser-manager.ts +2 -2
  192. package/src/tools/credentials/post-connect-hooks.ts +1 -1
  193. package/src/tools/credentials/vault.ts +34 -45
  194. package/src/tools/host-terminal/host-shell.ts +16 -3
  195. package/src/tools/mcp/mcp-tool-factory.ts +2 -1
  196. package/src/tools/skills/sandbox-runner.ts +16 -3
  197. package/src/tools/terminal/shell.ts +16 -3
  198. package/src/util/logger.ts +11 -1
  199. package/src/util/platform.ts +1 -91
  200. package/src/util/sentry-log-stream.ts +51 -0
  201. package/src/watcher/providers/github.ts +2 -2
  202. package/src/watcher/providers/gmail.ts +1 -1
  203. package/src/watcher/providers/google-calendar.ts +1 -1
  204. package/src/watcher/providers/linear.ts +2 -2
  205. package/src/workspace/migrations/011-backfill-installation-id.ts +5 -3
  206. package/src/workspace/migrations/020-rename-oauth-skill-dirs.ts +119 -0
  207. package/src/workspace/migrations/registry.ts +2 -0
  208. package/src/cli/commands/oauth/connections.ts +0 -255
  209. package/src/oauth/provider-behaviors.ts +0 -634
@@ -9,10 +9,33 @@ import {
9
9
  upsertApp,
10
10
  } from "../../../oauth/oauth-store.js";
11
11
  import { credentialKey } from "../../../security/credential-key.js";
12
- import { getCredentialMetadata } from "../../../tools/credentials/metadata-store.js";
13
12
  import { getCliLogger } from "../../logger.js";
14
13
  import { shouldOutputJson, writeOutput } from "../../output.js";
15
14
 
15
+ /**
16
+ * Resolve a credential path input to its full internal format.
17
+ *
18
+ * The primary input format is `service:field` (e.g. `google:client_secret`),
19
+ * which is split on the **last** colon and expanded to `credential/{service}/{field}`.
20
+ *
21
+ * Full internal paths (`credential/…` or `oauth_app/…`) are also accepted
22
+ * and returned as-is for backwards compatibility.
23
+ */
24
+ function resolveCredentialPath(input: string): string {
25
+ if (input.startsWith("credential/") || input.startsWith("oauth_app/")) {
26
+ return input;
27
+ }
28
+
29
+ const lastColon = input.lastIndexOf(":");
30
+ if (lastColon < 1 || lastColon === input.length - 1) {
31
+ return input;
32
+ }
33
+
34
+ const service = input.slice(0, lastColon);
35
+ const field = input.slice(lastColon + 1);
36
+ return credentialKey(service, field);
37
+ }
38
+
16
39
  const log = getCliLogger("cli");
17
40
 
18
41
  /** Format an app row for output, converting timestamps to ISO strings. */
@@ -35,20 +58,22 @@ function formatAppRow(row: {
35
58
  export function registerAppCommands(oauth: Command): void {
36
59
  const apps = oauth
37
60
  .command("apps")
38
- .description("Manage OAuth app registrations (client IDs and secrets)");
61
+ .description("Manage custom OAuth app registrations");
39
62
 
40
63
  apps.addHelpText(
41
64
  "after",
42
65
  `
43
- Apps represent OAuth client registrations — a client_id and optional
66
+ Apps represent custom OAuth client registrations — a client_id and optional
44
67
  client_secret linked to a provider. Each provider can have multiple apps
45
- (e.g. different client IDs for different environments).
68
+ (e.g. different client IDs for different environments). Only needed if using
69
+ a provider with a mode of "your-own" set.
46
70
 
47
71
  Examples:
48
72
  $ assistant oauth apps list
73
+ $ assistant oauth apps list --provider-key google
49
74
  $ assistant oauth apps get --id <uuid>
50
- $ assistant oauth apps get --provider integration:google
51
- $ assistant oauth apps upsert --provider integration:google --client-id abc123
75
+ $ assistant oauth apps get --provider google
76
+ $ assistant oauth apps upsert --provider google --client-id abc123
52
77
  $ assistant oauth apps delete <id>`,
53
78
  );
54
79
 
@@ -59,22 +84,34 @@ Examples:
59
84
  apps
60
85
  .command("list")
61
86
  .description("List all OAuth app registrations")
87
+ .option(
88
+ "--provider-key <key>",
89
+ "Filter by provider key (exact match). Only apps associated with this provider are returned. Run 'assistant oauth providers list' to see available keys.",
90
+ )
62
91
  .addHelpText(
63
92
  "after",
64
93
  `
65
- Returns all registered OAuth apps with their provider key, client ID, and
94
+ Returns registered OAuth apps with their provider key, client ID, and
66
95
  timestamps. Output is an array of app objects.
67
96
 
97
+ When --provider-key is specified, only apps whose providerKey exactly matches
98
+ the given value are returned. Without the flag, all apps are listed.
99
+
68
100
  In JSON mode (--json), returns the array directly. In human mode, logs a
69
101
  summary count and prints the formatted list.
70
102
 
71
103
  Examples:
72
104
  $ assistant oauth apps list
73
- $ assistant oauth apps list --json`,
105
+ $ assistant oauth apps list --provider-key google
106
+ $ assistant oauth apps list --provider-key slack --json`,
74
107
  )
75
- .action((_opts: unknown, cmd: Command) => {
108
+ .action((opts: { providerKey?: string }, cmd: Command) => {
76
109
  try {
77
- const rows = listApps().map(formatAppRow);
110
+ let rows = listApps().map(formatAppRow);
111
+
112
+ if (opts.providerKey) {
113
+ rows = rows.filter((r) => r.providerKey === opts.providerKey);
114
+ }
78
115
 
79
116
  if (!shouldOutputJson(cmd)) {
80
117
  log.info(`Found ${rows.length} app(s)`);
@@ -100,7 +137,7 @@ Examples:
100
137
  .option("--id <id>", "App ID (UUID) from 'assistant oauth apps list'")
101
138
  .option(
102
139
  "--provider <key>",
103
- "Provider key (e.g. integration:google) from 'assistant oauth providers list'",
140
+ "Provider key (e.g. google) from 'assistant oauth providers list'",
104
141
  )
105
142
  .option(
106
143
  "--client-id <id>",
@@ -115,10 +152,10 @@ Three lookup modes are supported:
115
152
  $ assistant oauth apps get --id <uuid>
116
153
 
117
154
  2. By provider + client ID (exact match):
118
- $ assistant oauth apps get --provider integration:google --client-id abc123
155
+ $ assistant oauth apps get --provider google --client-id abc123
119
156
 
120
157
  3. By provider only (returns the most recently created app):
121
- $ assistant oauth apps get --provider integration:google
158
+ $ assistant oauth apps get --provider google
122
159
 
123
160
  At least --id or --provider must be specified.`,
124
161
  )
@@ -178,7 +215,7 @@ At least --id or --provider must be specified.`,
178
215
  .description("Create or return an existing OAuth app registration")
179
216
  .requiredOption(
180
217
  "--provider <key>",
181
- "Provider key (e.g. integration:google) from 'assistant oauth providers list'",
218
+ "Provider key (e.g. google) from 'assistant oauth providers list'",
182
219
  )
183
220
  .requiredOption(
184
221
  "--client-id <id>",
@@ -190,7 +227,7 @@ At least --id or --provider must be specified.`,
190
227
  )
191
228
  .option(
192
229
  "--client-secret-credential-path <path>",
193
- "Path to an existing client secret in the credential store (mutually exclusive with --client-secret)",
230
+ "Credential reference in service:field format (e.g. google:client_secret). Mutually exclusive with --client-secret.",
194
231
  )
195
232
  .addHelpText(
196
233
  "after",
@@ -206,17 +243,14 @@ You can supply the client secret directly via --client-secret, or reference an
206
243
  existing credential in the store via --client-secret-credential-path. These two
207
244
  options are mutually exclusive — providing both is an error.
208
245
 
209
- The --client-secret-credential-path accepts two formats:
210
- 1. Full credential path: "credential/integration:google/client_secret"
211
- 2. Short name (service:field): "integration:google:client_secret"
212
- Resolved via the metadata store by splitting on the last colon.
246
+ The --client-secret-credential-path takes a \`service:field\` reference
247
+ (e.g. \`google:client_secret\`).
213
248
 
214
249
  Examples:
215
- $ assistant oauth apps upsert --provider integration:google --client-id abc123
216
- $ assistant oauth apps upsert --provider integration:slack --client-id def456 --client-secret s3cret
217
- $ assistant oauth apps upsert --provider integration:slack --client-id def456 --client-secret-credential-path "credential/integration:slack/client_secret"
218
- $ assistant oauth apps upsert --provider integration:slack --client-id def456 --client-secret-credential-path "integration:slack:client_secret"
219
- $ assistant oauth apps upsert --provider integration:google --client-id abc123 --json`,
250
+ $ assistant oauth apps upsert --provider google --client-id abc123
251
+ $ assistant oauth apps upsert --provider slack --client-id def456 --client-secret s3cret
252
+ $ assistant oauth apps upsert --provider slack --client-id def456 --client-secret-credential-path "slack:client_secret"
253
+ $ assistant oauth apps upsert --provider google --client-id abc123 --json`,
220
254
  )
221
255
  .action(
222
256
  async (
@@ -239,28 +273,13 @@ Examples:
239
273
  return;
240
274
  }
241
275
 
242
- let resolvedCredentialPath = opts.clientSecretCredentialPath;
243
- if (
244
- resolvedCredentialPath &&
245
- !resolvedCredentialPath.startsWith("credential/")
246
- ) {
247
- // Attempt to interpret as a credential key — split on the LAST colon to get service/field
248
- const lastColon = resolvedCredentialPath.lastIndexOf(":");
249
- if (lastColon > 0) {
250
- const asService = resolvedCredentialPath.slice(0, lastColon);
251
- const asField = resolvedCredentialPath.slice(lastColon + 1);
252
- // If a credential exists in metadata with these coordinates, resolve it
253
- const meta = getCredentialMetadata(asService, asField);
254
- if (meta) {
255
- resolvedCredentialPath = credentialKey(asService, asField);
256
- }
257
- }
258
- }
259
-
276
+ const resolvedPath = opts.clientSecretCredentialPath
277
+ ? resolveCredentialPath(opts.clientSecretCredentialPath)
278
+ : undefined;
260
279
  const clientSecretOpts = opts.clientSecret
261
280
  ? { clientSecretValue: opts.clientSecret }
262
- : resolvedCredentialPath
263
- ? { clientSecretCredentialPath: resolvedCredentialPath }
281
+ : resolvedPath
282
+ ? { clientSecretCredentialPath: resolvedPath }
264
283
  : undefined;
265
284
  const row = await upsertApp(
266
285
  opts.provider,