@vellumai/assistant 0.3.8 → 0.3.9

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 (64) hide show
  1. package/package.json +1 -1
  2. package/src/__tests__/__snapshots__/ipc-snapshot.test.ts.snap +20 -0
  3. package/src/__tests__/approval-routes-http.test.ts +704 -0
  4. package/src/__tests__/call-controller.test.ts +835 -0
  5. package/src/__tests__/call-state.test.ts +24 -24
  6. package/src/__tests__/ipc-snapshot.test.ts +14 -0
  7. package/src/__tests__/relay-server.test.ts +9 -9
  8. package/src/__tests__/run-orchestrator.test.ts +399 -3
  9. package/src/__tests__/runtime-runs.test.ts +12 -4
  10. package/src/__tests__/session-init.benchmark.test.ts +3 -3
  11. package/src/__tests__/voice-session-bridge.test.ts +869 -0
  12. package/src/calls/{call-orchestrator.ts → call-controller.ts} +156 -257
  13. package/src/calls/call-domain.ts +21 -21
  14. package/src/calls/call-state.ts +12 -12
  15. package/src/calls/guardian-dispatch.ts +43 -3
  16. package/src/calls/relay-server.ts +34 -39
  17. package/src/calls/twilio-routes.ts +3 -3
  18. package/src/calls/voice-session-bridge.ts +244 -0
  19. package/src/config/defaults.ts +5 -0
  20. package/src/config/notifications-schema.ts +15 -0
  21. package/src/config/schema.ts +13 -0
  22. package/src/config/types.ts +1 -0
  23. package/src/daemon/ipc-contract/notifications.ts +9 -0
  24. package/src/daemon/ipc-contract-inventory.json +2 -0
  25. package/src/daemon/ipc-contract.ts +4 -1
  26. package/src/daemon/lifecycle.ts +84 -1
  27. package/src/daemon/session-agent-loop.ts +4 -0
  28. package/src/daemon/session-process.ts +51 -0
  29. package/src/daemon/session-runtime-assembly.ts +32 -0
  30. package/src/daemon/session.ts +5 -0
  31. package/src/memory/db-init.ts +80 -0
  32. package/src/memory/guardian-action-store.ts +2 -2
  33. package/src/memory/migrations/019-notification-tables-schema-migration.ts +70 -0
  34. package/src/memory/migrations/index.ts +1 -0
  35. package/src/memory/migrations/registry.ts +5 -0
  36. package/src/memory/schema-migration.ts +1 -0
  37. package/src/memory/schema.ts +59 -0
  38. package/src/notifications/README.md +134 -0
  39. package/src/notifications/adapters/macos.ts +55 -0
  40. package/src/notifications/adapters/telegram.ts +65 -0
  41. package/src/notifications/broadcaster.ts +175 -0
  42. package/src/notifications/copy-composer.ts +118 -0
  43. package/src/notifications/decision-engine.ts +391 -0
  44. package/src/notifications/decisions-store.ts +158 -0
  45. package/src/notifications/deliveries-store.ts +130 -0
  46. package/src/notifications/destination-resolver.ts +54 -0
  47. package/src/notifications/deterministic-checks.ts +187 -0
  48. package/src/notifications/emit-signal.ts +191 -0
  49. package/src/notifications/events-store.ts +145 -0
  50. package/src/notifications/preference-extractor.ts +223 -0
  51. package/src/notifications/preference-summary.ts +110 -0
  52. package/src/notifications/preferences-store.ts +142 -0
  53. package/src/notifications/runtime-dispatch.ts +100 -0
  54. package/src/notifications/signal.ts +24 -0
  55. package/src/notifications/types.ts +75 -0
  56. package/src/runtime/http-server.ts +10 -0
  57. package/src/runtime/pending-interactions.ts +73 -0
  58. package/src/runtime/routes/approval-routes.ts +179 -0
  59. package/src/runtime/routes/channel-inbound-routes.ts +39 -4
  60. package/src/runtime/routes/conversation-routes.ts +31 -1
  61. package/src/runtime/routes/run-routes.ts +1 -1
  62. package/src/runtime/run-orchestrator.ts +157 -2
  63. package/src/tools/browser/browser-manager.ts +1 -1
  64. package/src/__tests__/call-orchestrator.test.ts +0 -1496
@@ -53,6 +53,8 @@ function makeCompletingSession(): Session {
53
53
  setAssistantId: () => {},
54
54
  setGuardianContext: () => {},
55
55
  setCommandIntent: () => {},
56
+ setTurnChannelContext: () => {},
57
+ setVoiceCallControlPrompt: () => {},
56
58
  updateClient: () => {},
57
59
  runAgentLoop: async () => {
58
60
  processing = true;
@@ -76,6 +78,8 @@ function makeHangingSession(): Session {
76
78
  setAssistantId: () => {},
77
79
  setGuardianContext: () => {},
78
80
  setCommandIntent: () => {},
81
+ setTurnChannelContext: () => {},
82
+ setVoiceCallControlPrompt: () => {},
79
83
  updateClient: () => {},
80
84
  runAgentLoop: async () => {
81
85
  processing = true;
@@ -97,6 +101,8 @@ function makeFailingSession(errorMsg: string): Session {
97
101
  setAssistantId: () => {},
98
102
  setGuardianContext: () => {},
99
103
  setCommandIntent: () => {},
104
+ setTurnChannelContext: () => {},
105
+ setVoiceCallControlPrompt: () => {},
100
106
  updateClient: () => {},
101
107
  runAgentLoop: async (_content: string, _messageId: string, onEvent: (msg: ServerMessage) => void) => {
102
108
  onEvent({ type: 'error', message: errorMsg });
@@ -117,6 +123,8 @@ function makeConfirmationSession(toolName: string): Session {
117
123
  setAssistantId: () => {},
118
124
  setGuardianContext: () => {},
119
125
  setCommandIntent: () => {},
126
+ setTurnChannelContext: () => {},
127
+ setVoiceCallControlPrompt: () => {},
120
128
  updateClient: (handler: (msg: ServerMessage) => void) => {
121
129
  clientHandler = handler;
122
130
  },
@@ -163,7 +171,7 @@ describe('runtime runs — swarm lifecycle', () => {
163
171
  deriveDefaultStrictSideEffects: () => false,
164
172
  });
165
173
 
166
- const run = await orchestrator.startRun(conversation.id, 'Build a feature');
174
+ const { run } = await orchestrator.startRun(conversation.id, 'Build a feature');
167
175
  expect(run.status).toBe('running');
168
176
 
169
177
  // Wait for agent loop to complete
@@ -181,7 +189,7 @@ describe('runtime runs — swarm lifecycle', () => {
181
189
  deriveDefaultStrictSideEffects: () => false,
182
190
  });
183
191
 
184
- const run = await orchestrator.startRun(conversation.id, 'Run swarm');
192
+ const { run } = await orchestrator.startRun(conversation.id, 'Run swarm');
185
193
 
186
194
  await new Promise((r) => setTimeout(r, 50));
187
195
 
@@ -198,7 +206,7 @@ describe('runtime runs — swarm lifecycle', () => {
198
206
  deriveDefaultStrictSideEffects: () => false,
199
207
  });
200
208
 
201
- const run = await orchestrator.startRun(conversation.id, 'Delegate a swarm task');
209
+ const { run } = await orchestrator.startRun(conversation.id, 'Delegate a swarm task');
202
210
 
203
211
  // Give agent loop time to emit confirmation_request
204
212
  await new Promise((r) => setTimeout(r, 50));
@@ -216,7 +224,7 @@ describe('runtime runs — swarm lifecycle', () => {
216
224
  deriveDefaultStrictSideEffects: () => false,
217
225
  });
218
226
 
219
- const run = await orchestrator.startRun(conversation.id, 'Run with approval');
227
+ const { run } = await orchestrator.startRun(conversation.id, 'Run with approval');
220
228
  await new Promise((r) => setTimeout(r, 50));
221
229
 
222
230
  // Verify pending state
@@ -194,9 +194,9 @@ mock.module('../calls/call-state.js', () => ({
194
194
  registerCallCompletionNotifier: () => {},
195
195
  unregisterCallCompletionNotifier: () => {},
196
196
  fireCallCompletionNotifier: () => {},
197
- registerCallOrchestrator: () => {},
198
- unregisterCallOrchestrator: () => {},
199
- getCallOrchestrator: () => undefined,
197
+ registerCallController: () => {},
198
+ unregisterCallController: () => {},
199
+ getCallController: () => undefined,
200
200
  }));
201
201
 
202
202
  mock.module('../calls/call-store.js', () => ({