@vellumai/assistant 0.3.3 → 0.3.5

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 (163) hide show
  1. package/Dockerfile +2 -0
  2. package/README.md +45 -18
  3. package/package.json +1 -1
  4. package/scripts/ipc/generate-swift.ts +13 -0
  5. package/src/__tests__/__snapshots__/ipc-snapshot.test.ts.snap +100 -0
  6. package/src/__tests__/approval-hardcoded-copy-guard.test.ts +41 -0
  7. package/src/__tests__/approval-message-composer.test.ts +253 -0
  8. package/src/__tests__/call-domain.test.ts +12 -2
  9. package/src/__tests__/call-orchestrator.test.ts +391 -1
  10. package/src/__tests__/call-routes-http.test.ts +27 -2
  11. package/src/__tests__/channel-approval-routes.test.ts +397 -135
  12. package/src/__tests__/channel-approvals.test.ts +99 -3
  13. package/src/__tests__/channel-delivery-store.test.ts +30 -4
  14. package/src/__tests__/channel-guardian.test.ts +261 -22
  15. package/src/__tests__/channel-readiness-service.test.ts +257 -0
  16. package/src/__tests__/config-schema.test.ts +2 -1
  17. package/src/__tests__/credential-security-invariants.test.ts +1 -0
  18. package/src/__tests__/daemon-lifecycle.test.ts +636 -0
  19. package/src/__tests__/dictation-mode-detection.test.ts +63 -0
  20. package/src/__tests__/entity-search.test.ts +615 -0
  21. package/src/__tests__/gateway-only-enforcement.test.ts +19 -13
  22. package/src/__tests__/handlers-twilio-config.test.ts +480 -0
  23. package/src/__tests__/ipc-snapshot.test.ts +63 -0
  24. package/src/__tests__/messaging-send-tool.test.ts +65 -0
  25. package/src/__tests__/run-orchestrator-assistant-events.test.ts +4 -0
  26. package/src/__tests__/run-orchestrator.test.ts +22 -0
  27. package/src/__tests__/secret-scanner.test.ts +223 -0
  28. package/src/__tests__/session-runtime-assembly.test.ts +85 -1
  29. package/src/__tests__/shell-parser-property.test.ts +357 -2
  30. package/src/__tests__/sms-messaging-provider.test.ts +125 -0
  31. package/src/__tests__/system-prompt.test.ts +25 -1
  32. package/src/__tests__/tool-executor-lifecycle-events.test.ts +34 -1
  33. package/src/__tests__/twilio-routes.test.ts +39 -3
  34. package/src/__tests__/twitter-cli-error-shaping.test.ts +2 -2
  35. package/src/__tests__/user-reference.test.ts +68 -0
  36. package/src/__tests__/web-search.test.ts +1 -1
  37. package/src/__tests__/work-item-output.test.ts +110 -0
  38. package/src/calls/call-domain.ts +8 -5
  39. package/src/calls/call-orchestrator.ts +85 -22
  40. package/src/calls/twilio-config.ts +17 -11
  41. package/src/calls/twilio-rest.ts +276 -0
  42. package/src/calls/twilio-routes.ts +39 -1
  43. package/src/cli/map.ts +6 -0
  44. package/src/commands/__tests__/cc-command-registry.test.ts +67 -0
  45. package/src/commands/cc-command-registry.ts +14 -1
  46. package/src/config/bundled-skills/claude-code/TOOLS.json +10 -3
  47. package/src/config/bundled-skills/knowledge-graph/SKILL.md +15 -0
  48. package/src/config/bundled-skills/knowledge-graph/TOOLS.json +56 -0
  49. package/src/config/bundled-skills/knowledge-graph/tools/graph-query.ts +185 -0
  50. package/src/config/bundled-skills/media-processing/SKILL.md +199 -0
  51. package/src/config/bundled-skills/media-processing/TOOLS.json +320 -0
  52. package/src/config/bundled-skills/media-processing/services/capability-registry.ts +137 -0
  53. package/src/config/bundled-skills/media-processing/services/event-detection-service.ts +280 -0
  54. package/src/config/bundled-skills/media-processing/services/feedback-aggregation.ts +144 -0
  55. package/src/config/bundled-skills/media-processing/services/feedback-store.ts +136 -0
  56. package/src/config/bundled-skills/media-processing/services/processing-pipeline.ts +261 -0
  57. package/src/config/bundled-skills/media-processing/services/retrieval-service.ts +95 -0
  58. package/src/config/bundled-skills/media-processing/services/timeline-service.ts +267 -0
  59. package/src/config/bundled-skills/media-processing/tools/analyze-keyframes.ts +301 -0
  60. package/src/config/bundled-skills/media-processing/tools/detect-events.ts +110 -0
  61. package/src/config/bundled-skills/media-processing/tools/extract-keyframes.ts +190 -0
  62. package/src/config/bundled-skills/media-processing/tools/generate-clip.ts +195 -0
  63. package/src/config/bundled-skills/media-processing/tools/ingest-media.ts +197 -0
  64. package/src/config/bundled-skills/media-processing/tools/media-diagnostics.ts +166 -0
  65. package/src/config/bundled-skills/media-processing/tools/media-status.ts +75 -0
  66. package/src/config/bundled-skills/media-processing/tools/query-media-events.ts +300 -0
  67. package/src/config/bundled-skills/media-processing/tools/recalibrate.ts +235 -0
  68. package/src/config/bundled-skills/media-processing/tools/select-tracking-profile.ts +142 -0
  69. package/src/config/bundled-skills/media-processing/tools/submit-feedback.ts +150 -0
  70. package/src/config/bundled-skills/messaging/SKILL.md +24 -5
  71. package/src/config/bundled-skills/messaging/tools/messaging-send.ts +5 -1
  72. package/src/config/bundled-skills/phone-calls/SKILL.md +2 -2
  73. package/src/config/bundled-skills/twitter/SKILL.md +19 -3
  74. package/src/config/defaults.ts +2 -1
  75. package/src/config/schema.ts +9 -3
  76. package/src/config/skills.ts +5 -32
  77. package/src/config/system-prompt.ts +40 -0
  78. package/src/config/templates/IDENTITY.md +2 -2
  79. package/src/config/user-reference.ts +29 -0
  80. package/src/config/vellum-skills/catalog.json +58 -0
  81. package/src/config/vellum-skills/google-oauth-setup/SKILL.md +3 -3
  82. package/src/config/vellum-skills/slack-oauth-setup/SKILL.md +3 -3
  83. package/src/config/vellum-skills/sms-setup/SKILL.md +118 -0
  84. package/src/config/vellum-skills/telegram-setup/SKILL.md +6 -1
  85. package/src/config/vellum-skills/twilio-setup/SKILL.md +76 -6
  86. package/src/daemon/auth-manager.ts +103 -0
  87. package/src/daemon/computer-use-session.ts +8 -1
  88. package/src/daemon/config-watcher.ts +253 -0
  89. package/src/daemon/handlers/config.ts +819 -22
  90. package/src/daemon/handlers/dictation.ts +182 -0
  91. package/src/daemon/handlers/identity.ts +14 -23
  92. package/src/daemon/handlers/index.ts +2 -0
  93. package/src/daemon/handlers/sessions.ts +2 -0
  94. package/src/daemon/handlers/shared.ts +3 -0
  95. package/src/daemon/handlers/skills.ts +6 -7
  96. package/src/daemon/handlers/work-items.ts +15 -7
  97. package/src/daemon/ipc-contract-inventory.json +10 -0
  98. package/src/daemon/ipc-contract.ts +114 -4
  99. package/src/daemon/ipc-handler.ts +87 -0
  100. package/src/daemon/lifecycle.ts +18 -4
  101. package/src/daemon/ride-shotgun-handler.ts +11 -1
  102. package/src/daemon/server.ts +111 -504
  103. package/src/daemon/session-agent-loop.ts +10 -15
  104. package/src/daemon/session-runtime-assembly.ts +115 -44
  105. package/src/daemon/session-tool-setup.ts +2 -0
  106. package/src/daemon/session.ts +19 -2
  107. package/src/inbound/public-ingress-urls.ts +3 -3
  108. package/src/memory/channel-guardian-store.ts +2 -1
  109. package/src/memory/db-connection.ts +28 -0
  110. package/src/memory/db-init.ts +1163 -0
  111. package/src/memory/db.ts +2 -2007
  112. package/src/memory/embedding-backend.ts +79 -11
  113. package/src/memory/indexer.ts +2 -0
  114. package/src/memory/job-handlers/media-processing.ts +100 -0
  115. package/src/memory/job-utils.ts +64 -4
  116. package/src/memory/jobs-store.ts +2 -1
  117. package/src/memory/jobs-worker.ts +11 -1
  118. package/src/memory/media-store.ts +759 -0
  119. package/src/memory/recall-cache.ts +107 -0
  120. package/src/memory/retriever.ts +36 -2
  121. package/src/memory/schema-migration.ts +984 -0
  122. package/src/memory/schema.ts +99 -0
  123. package/src/memory/search/entity.ts +208 -25
  124. package/src/memory/search/ranking.ts +6 -1
  125. package/src/memory/search/types.ts +26 -0
  126. package/src/messaging/provider-types.ts +2 -0
  127. package/src/messaging/providers/sms/adapter.ts +204 -0
  128. package/src/messaging/providers/sms/client.ts +93 -0
  129. package/src/messaging/providers/sms/types.ts +7 -0
  130. package/src/permissions/checker.ts +16 -2
  131. package/src/permissions/prompter.ts +14 -3
  132. package/src/permissions/trust-store.ts +7 -0
  133. package/src/runtime/approval-message-composer.ts +143 -0
  134. package/src/runtime/channel-approvals.ts +29 -7
  135. package/src/runtime/channel-guardian-service.ts +44 -18
  136. package/src/runtime/channel-readiness-service.ts +292 -0
  137. package/src/runtime/channel-readiness-types.ts +29 -0
  138. package/src/runtime/gateway-client.ts +2 -1
  139. package/src/runtime/http-server.ts +65 -28
  140. package/src/runtime/http-types.ts +3 -0
  141. package/src/runtime/routes/call-routes.ts +2 -1
  142. package/src/runtime/routes/channel-routes.ts +237 -103
  143. package/src/runtime/routes/run-routes.ts +7 -1
  144. package/src/runtime/run-orchestrator.ts +43 -3
  145. package/src/security/secret-scanner.ts +218 -0
  146. package/src/skills/frontmatter.ts +63 -0
  147. package/src/skills/slash-commands.ts +23 -0
  148. package/src/skills/vellum-catalog-remote.ts +107 -0
  149. package/src/tools/assets/materialize.ts +2 -2
  150. package/src/tools/browser/auto-navigate.ts +132 -24
  151. package/src/tools/browser/browser-manager.ts +67 -61
  152. package/src/tools/calls/call-start.ts +1 -0
  153. package/src/tools/claude-code/claude-code.ts +55 -3
  154. package/src/tools/credentials/vault.ts +1 -1
  155. package/src/tools/execution-target.ts +11 -1
  156. package/src/tools/executor.ts +10 -2
  157. package/src/tools/network/web-search.ts +1 -1
  158. package/src/tools/skills/vellum-catalog.ts +61 -156
  159. package/src/tools/terminal/parser.ts +21 -5
  160. package/src/tools/types.ts +2 -0
  161. package/src/twitter/router.ts +1 -1
  162. package/src/util/platform.ts +43 -1
  163. package/src/util/retry.ts +4 -4
@@ -0,0 +1,87 @@
1
+ /**
2
+ * IPC wire-level helpers: socket writing, broadcast, and assistant-event
3
+ * hub publishing. Extracted from DaemonServer to separate transport
4
+ * concerns from session management and business logic.
5
+ */
6
+ import * as net from 'node:net';
7
+ import { serialize, type ServerMessage } from './ipc-protocol.js';
8
+ import { assistantEventHub } from '../runtime/assistant-event-hub.js';
9
+ import { buildAssistantEvent } from '../runtime/assistant-event.js';
10
+ import { getLogger } from '../util/logger.js';
11
+
12
+ const log = getLogger('ipc-handler');
13
+
14
+ /**
15
+ * Manages IPC message delivery: writing to individual sockets,
16
+ * broadcasting to all authenticated sockets, and publishing events
17
+ * to the assistant-events hub in order.
18
+ */
19
+ export class IpcSender {
20
+ private _hubChain: Promise<void> = Promise.resolve();
21
+
22
+ /** Write to a single socket without publishing to the event hub. */
23
+ writeToSocket(socket: net.Socket, msg: ServerMessage): void {
24
+ if (!socket.destroyed && socket.writable) {
25
+ socket.write(serialize(msg));
26
+ }
27
+ }
28
+
29
+ /**
30
+ * Send a message to a single socket and publish to the event hub.
31
+ * `sessionId` is resolved from the message itself or the socket binding.
32
+ */
33
+ send(
34
+ socket: net.Socket,
35
+ msg: ServerMessage,
36
+ socketToSession: Map<net.Socket, string>,
37
+ assistantId: string,
38
+ ): void {
39
+ this.writeToSocket(socket, msg);
40
+ const sessionId = extractSessionId(msg) ?? socketToSession.get(socket);
41
+ this.publishAssistantEvent(msg, sessionId, assistantId);
42
+ }
43
+
44
+ /**
45
+ * Broadcast a message to all authenticated sockets, then publish
46
+ * a single event to the hub.
47
+ */
48
+ broadcast(
49
+ authenticatedSockets: Set<net.Socket>,
50
+ msg: ServerMessage,
51
+ socketToSession: Map<net.Socket, string>,
52
+ assistantId: string,
53
+ excludeSocket?: net.Socket,
54
+ ): void {
55
+ for (const socket of authenticatedSockets) {
56
+ if (socket === excludeSocket) continue;
57
+ this.writeToSocket(socket, msg);
58
+ }
59
+ const sessionId = extractSessionId(msg)
60
+ ?? (excludeSocket ? socketToSession.get(excludeSocket) : undefined);
61
+ this.publishAssistantEvent(msg, sessionId, assistantId);
62
+ }
63
+
64
+ /**
65
+ * Publish `msg` as an `AssistantEvent` to the process-level hub.
66
+ * Publications are serialized via a promise chain so subscribers
67
+ * always observe events in send order.
68
+ */
69
+ private publishAssistantEvent(msg: ServerMessage, sessionId?: string, assistantId?: string): void {
70
+ const id = assistantId ?? 'default';
71
+ const event = buildAssistantEvent(id, msg, sessionId);
72
+ this._hubChain = this._hubChain
73
+ .then(() => assistantEventHub.publish(event))
74
+ .catch((err: unknown) => {
75
+ log.warn({ err }, 'assistant-events hub subscriber threw during IPC send');
76
+ });
77
+ }
78
+ }
79
+
80
+ /** Extract sessionId from a ServerMessage if present. */
81
+ function extractSessionId(msg: ServerMessage): string | undefined {
82
+ const record = msg as unknown as Record<string, unknown>;
83
+ if ('sessionId' in msg && typeof record.sessionId === 'string') {
84
+ return record.sessionId as string;
85
+ }
86
+ return undefined;
87
+ }
@@ -42,6 +42,7 @@ import { registerMessagingProvider } from '../messaging/registry.js';
42
42
  import { slackProvider as slackMessagingProvider } from '../messaging/providers/slack/adapter.js';
43
43
  import { gmailMessagingProvider } from '../messaging/providers/gmail/adapter.js';
44
44
  import { telegramBotMessagingProvider } from '../messaging/providers/telegram-bot/adapter.js';
45
+ import { smsMessagingProvider } from '../messaging/providers/sms/adapter.js';
45
46
  import { browserManager } from '../tools/browser/browser-manager.js';
46
47
  import { RuntimeHttpServer } from '../runtime/http-server.js';
47
48
  import { getHookManager } from '../hooks/manager.js';
@@ -386,6 +387,7 @@ export async function runDaemon(): Promise<void> {
386
387
  registerMessagingProvider(slackMessagingProvider);
387
388
  registerMessagingProvider(gmailMessagingProvider);
388
389
  registerMessagingProvider(telegramBotMessagingProvider);
390
+ registerMessagingProvider(smsMessagingProvider);
389
391
 
390
392
  const scheduler = startScheduler(
391
393
  async (conversationId, message) => {
@@ -429,11 +431,23 @@ export async function runDaemon(): Promise<void> {
429
431
  if (httpPortEnv) {
430
432
  const port = parseInt(httpPortEnv, 10);
431
433
  if (!isNaN(port) && port > 0) {
432
- // Use an explicit env var if provided; otherwise generate a fresh
433
- // random token. Either way, write it to disk so HTTP clients and
434
- // the gateway can authenticate.
435
- const bearerToken = process.env.RUNTIME_PROXY_BEARER_TOKEN || randomBytes(32).toString('hex');
434
+ // Resolve the bearer token in priority order:
435
+ // 1. Explicit env var (e.g. cloud deploys)
436
+ // 2. Existing token file on disk (preserves QR-paired iOS devices across restarts)
437
+ // 3. Fresh random token (first-time startup)
436
438
  const httpTokenPath = getHttpTokenPath();
439
+ let bearerToken = process.env.RUNTIME_PROXY_BEARER_TOKEN;
440
+ if (!bearerToken) {
441
+ try {
442
+ const existing = readFileSync(httpTokenPath, 'utf-8').trim();
443
+ if (existing) bearerToken = existing;
444
+ } catch {
445
+ // File doesn't exist or can't be read — will generate below
446
+ }
447
+ }
448
+ if (!bearerToken) {
449
+ bearerToken = randomBytes(32).toString('hex');
450
+ }
437
451
  writeFileSync(httpTokenPath, bearerToken, { mode: 0o600 });
438
452
  chmodSync(httpTokenPath, 0o600);
439
453
 
@@ -169,7 +169,17 @@ export async function handleRideShotgunStart(
169
169
  clearInterval(checkInterval);
170
170
  }
171
171
  }, 1000);
172
- autoNavigate(navDomain, abortSignal).then(visited => {
172
+ autoNavigate(navDomain, abortSignal, (progress) => {
173
+ // Send progress to connected client
174
+ if (progress.type === 'visiting' && progress.url) {
175
+ const shortUrl = progress.url.replace(/^https?:\/\//, '');
176
+ ctx.send(socket, {
177
+ type: 'ride_shotgun_progress',
178
+ watchId,
179
+ message: `[${progress.pageNumber || '?'}] ${shortUrl}`,
180
+ });
181
+ }
182
+ }).then(visited => {
173
183
  clearInterval(checkInterval);
174
184
  log.info({ watchId, visitedPages: visited.length }, 'Generic auto-navigation finished');
175
185
  if (session.status === 'active') {