@vellumai/assistant 0.4.21 → 0.4.23

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.
@@ -665,11 +665,13 @@ export async function surfaceProxyResolver(
665
665
  const actions = input.actions as Array<{ id: string; label: string; style?: string }> | undefined;
666
666
  // Interactive surfaces default to awaiting user action.
667
667
  const hasActions = Array.isArray(actions) && actions.length > 0;
668
- const isInteractive = surfaceType === 'list'
668
+ const isInteractive = surfaceType === 'card'
669
669
  ? hasActions
670
- : surfaceType === 'table'
670
+ : surfaceType === 'list'
671
671
  ? hasActions
672
- : INTERACTIVE_SURFACE_TYPES.includes(surfaceType);
672
+ : surfaceType === 'table'
673
+ ? hasActions
674
+ : INTERACTIVE_SURFACE_TYPES.includes(surfaceType);
673
675
  const awaitAction = (input.await_action as boolean) ?? isInteractive;
674
676
 
675
677
  // Only one non-persistent interactive surface at a time. If another
@@ -6,6 +6,7 @@
6
6
  * keeping the constructor body focused on wiring.
7
7
  */
8
8
 
9
+ import { isHttpAuthDisabled } from "../config/env.js";
9
10
  import {
10
11
  generateAllowlistOptions,
11
12
  generateScopeOptions,
@@ -19,30 +20,28 @@ import {
19
20
  } from "../permissions/trust-store.js";
20
21
  import { isAllowDecision } from "../permissions/types.js";
21
22
  import type { Message, ToolDefinition } from "../providers/types.js";
23
+ import type { TrustClass } from "../runtime/actor-trust-resolver.js";
22
24
  import { getEffectiveMode } from "../runtime/session-approval-overrides.js";
25
+ import { coreAppProxyTools } from "../tools/apps/definitions.js";
26
+ import { registerSessionSender } from "../tools/browser/browser-screencast.js";
27
+ import { requestComputerControlTool } from "../tools/computer-use/request-computer-control.js";
23
28
  import type { ToolExecutor } from "../tools/executor.js";
29
+ import type {
30
+ ProxyApprovalCallback,
31
+ ProxyApprovalRequest,
32
+ } from "../tools/network/script-proxy/index.js";
33
+ import { getAllToolDefinitions } from "../tools/registry.js";
24
34
  import type {
25
35
  ToolExecutionResult,
26
36
  ToolLifecycleEventHandler,
27
37
  } from "../tools/types.js";
38
+ import { allUiSurfaceTools } from "../tools/ui-surface/definitions.js";
28
39
  import { getLogger } from "../util/logger.js";
29
40
  import {
30
41
  isDoordashCommand,
31
42
  markDoordashStepInProgress,
32
43
  } from "./doordash-steps.js";
33
44
  import type { ServerMessage, UiSurfaceShow } from "./ipc-protocol.js";
34
- import { runPostExecutionSideEffects } from "./tool-side-effects.js";
35
-
36
- const log = getLogger("session-tool-setup");
37
- import { coreAppProxyTools } from "../tools/apps/definitions.js";
38
- import { registerSessionSender } from "../tools/browser/browser-screencast.js";
39
- import { requestComputerControlTool } from "../tools/computer-use/request-computer-control.js";
40
- import type {
41
- ProxyApprovalCallback,
42
- ProxyApprovalRequest,
43
- } from "../tools/network/script-proxy/index.js";
44
- import { getAllToolDefinitions } from "../tools/registry.js";
45
- import { allUiSurfaceTools } from "../tools/ui-surface/definitions.js";
46
45
  import type { GuardianRuntimeContext } from "./session-runtime-assembly.js";
47
46
  import {
48
47
  projectSkillTools,
@@ -50,6 +49,21 @@ import {
50
49
  } from "./session-skill-tools.js";
51
50
  import type { SurfaceSessionContext } from "./session-surfaces.js";
52
51
  import { surfaceProxyResolver } from "./session-surfaces.js";
52
+ import { runPostExecutionSideEffects } from "./tool-side-effects.js";
53
+
54
+ const log = getLogger("session-tool-setup");
55
+
56
+ /**
57
+ * Resolve the effective guardian trust class for tool execution.
58
+ * When HTTP auth is disabled (dev bypass), always treat the actor as
59
+ * guardian so that control-plane gates don't block local development.
60
+ */
61
+ export function resolveGuardianTrustClass(
62
+ guardianContext: GuardianRuntimeContext | undefined,
63
+ ): TrustClass {
64
+ if (isHttpAuthDisabled()) return "guardian";
65
+ return guardianContext?.trustClass ?? "guardian";
66
+ }
53
67
 
54
68
  // ── Context Interface ────────────────────────────────────────────────
55
69
 
@@ -137,7 +151,7 @@ export function createToolExecutor(
137
151
  assistantId: ctx.assistantId,
138
152
  requestId: ctx.currentRequestId,
139
153
  taskRunId: ctx.taskRunId,
140
- guardianTrustClass: ctx.guardianContext?.trustClass ?? "guardian",
154
+ guardianTrustClass: resolveGuardianTrustClass(ctx.guardianContext),
141
155
  executionChannel: ctx.guardianContext?.sourceChannel,
142
156
  callSessionId: ctx.callSessionId,
143
157
  triggeredBySurfaceAction:
@@ -1,4 +1,4 @@
1
- import type { DrizzleDb } from '../db-connection.js';
1
+ import type { DrizzleDb } from "../db-connection.js";
2
2
 
3
3
  /**
4
4
  * ALTER TABLE ADD COLUMN migrations for core tables.
@@ -6,62 +6,279 @@ import type { DrizzleDb } from '../db-connection.js';
6
6
  */
7
7
  export function addCoreColumns(database: DrizzleDb): void {
8
8
  // message_runs
9
- try { database.run(/*sql*/ `ALTER TABLE message_runs ADD COLUMN pending_secret TEXT`); } catch { /* already exists */ }
9
+ try {
10
+ database.run(
11
+ /*sql*/ `ALTER TABLE message_runs ADD COLUMN pending_secret TEXT`,
12
+ );
13
+ } catch {
14
+ /* already exists */
15
+ }
10
16
 
11
17
  // published_pages
12
- try { database.run(/*sql*/ `ALTER TABLE published_pages ADD COLUMN app_id TEXT`); } catch { /* already exists */ }
13
- try { database.run(/*sql*/ `ALTER TABLE published_pages ADD COLUMN project_slug TEXT`); } catch { /* already exists */ }
18
+ try {
19
+ database.run(/*sql*/ `ALTER TABLE published_pages ADD COLUMN app_id TEXT`);
20
+ } catch {
21
+ /* already exists */
22
+ }
23
+ try {
24
+ database.run(
25
+ /*sql*/ `ALTER TABLE published_pages ADD COLUMN project_slug TEXT`,
26
+ );
27
+ } catch {
28
+ /* already exists */
29
+ }
14
30
 
15
31
  // conversations
16
- try { database.run(/*sql*/ `ALTER TABLE conversations ADD COLUMN total_input_tokens INTEGER NOT NULL DEFAULT 0`); } catch { /* already exists */ }
17
- try { database.run(/*sql*/ `ALTER TABLE conversations ADD COLUMN total_output_tokens INTEGER NOT NULL DEFAULT 0`); } catch { /* already exists */ }
18
- try { database.run(/*sql*/ `ALTER TABLE conversations ADD COLUMN total_estimated_cost REAL NOT NULL DEFAULT 0`); } catch { /* already exists */ }
19
- try { database.run(/*sql*/ `ALTER TABLE conversations ADD COLUMN context_summary TEXT`); } catch { /* already exists */ }
20
- try { database.run(/*sql*/ `ALTER TABLE conversations ADD COLUMN context_compacted_message_count INTEGER NOT NULL DEFAULT 0`); } catch { /* already exists */ }
21
- try { database.run(/*sql*/ `ALTER TABLE conversations ADD COLUMN context_compacted_at INTEGER`); } catch { /* already exists */ }
22
- try { database.run(/*sql*/ `ALTER TABLE conversations ADD COLUMN thread_type TEXT NOT NULL DEFAULT 'standard'`); } catch { /* already exists */ }
23
- try { database.run(/*sql*/ `ALTER TABLE conversations ADD COLUMN source TEXT NOT NULL DEFAULT 'user'`); } catch { /* already exists */ }
24
- try { database.run(/*sql*/ `ALTER TABLE conversations ADD COLUMN memory_scope_id TEXT NOT NULL DEFAULT 'default'`); } catch { /* already exists */ }
25
- try { database.run(/*sql*/ `ALTER TABLE conversations ADD COLUMN origin_channel TEXT`); } catch { /* already exists */ }
26
- try { database.run(/*sql*/ `ALTER TABLE conversations ADD COLUMN is_auto_title INTEGER NOT NULL DEFAULT 1`); } catch { /* already exists */ }
32
+ try {
33
+ database.run(
34
+ /*sql*/ `ALTER TABLE conversations ADD COLUMN total_input_tokens INTEGER NOT NULL DEFAULT 0`,
35
+ );
36
+ } catch {
37
+ /* already exists */
38
+ }
39
+ try {
40
+ database.run(
41
+ /*sql*/ `ALTER TABLE conversations ADD COLUMN total_output_tokens INTEGER NOT NULL DEFAULT 0`,
42
+ );
43
+ } catch {
44
+ /* already exists */
45
+ }
46
+ try {
47
+ database.run(
48
+ /*sql*/ `ALTER TABLE conversations ADD COLUMN total_estimated_cost REAL NOT NULL DEFAULT 0`,
49
+ );
50
+ } catch {
51
+ /* already exists */
52
+ }
53
+ try {
54
+ database.run(
55
+ /*sql*/ `ALTER TABLE conversations ADD COLUMN context_summary TEXT`,
56
+ );
57
+ } catch {
58
+ /* already exists */
59
+ }
60
+ try {
61
+ database.run(
62
+ /*sql*/ `ALTER TABLE conversations ADD COLUMN context_compacted_message_count INTEGER NOT NULL DEFAULT 0`,
63
+ );
64
+ } catch {
65
+ /* already exists */
66
+ }
67
+ try {
68
+ database.run(
69
+ /*sql*/ `ALTER TABLE conversations ADD COLUMN context_compacted_at INTEGER`,
70
+ );
71
+ } catch {
72
+ /* already exists */
73
+ }
74
+ try {
75
+ database.run(
76
+ /*sql*/ `ALTER TABLE conversations ADD COLUMN thread_type TEXT NOT NULL DEFAULT 'standard'`,
77
+ );
78
+ } catch {
79
+ /* already exists */
80
+ }
81
+ try {
82
+ database.run(
83
+ /*sql*/ `ALTER TABLE conversations ADD COLUMN source TEXT NOT NULL DEFAULT 'user'`,
84
+ );
85
+ } catch {
86
+ /* already exists */
87
+ }
88
+ try {
89
+ database.run(
90
+ /*sql*/ `ALTER TABLE conversations ADD COLUMN memory_scope_id TEXT NOT NULL DEFAULT 'default'`,
91
+ );
92
+ } catch {
93
+ /* already exists */
94
+ }
95
+ try {
96
+ database.run(
97
+ /*sql*/ `ALTER TABLE conversations ADD COLUMN origin_channel TEXT`,
98
+ );
99
+ } catch {
100
+ /* already exists */
101
+ }
102
+ try {
103
+ database.run(
104
+ /*sql*/ `ALTER TABLE conversations ADD COLUMN is_auto_title INTEGER NOT NULL DEFAULT 1`,
105
+ );
106
+ } catch {
107
+ /* already exists */
108
+ }
109
+ try {
110
+ database.run(
111
+ /*sql*/ `ALTER TABLE conversations ADD COLUMN schedule_job_id TEXT`,
112
+ );
113
+ } catch {
114
+ /* already exists */
115
+ }
27
116
 
28
117
  // memory_items
29
- try { database.run(/*sql*/ `ALTER TABLE memory_items ADD COLUMN importance REAL`); } catch { /* already exists */ }
30
- try { database.run(/*sql*/ `ALTER TABLE memory_items ADD COLUMN access_count INTEGER NOT NULL DEFAULT 0`); } catch { /* already exists */ }
31
- try { database.run(/*sql*/ `ALTER TABLE memory_items ADD COLUMN valid_from INTEGER`); } catch { /* already exists */ }
32
- try { database.run(/*sql*/ `ALTER TABLE memory_items ADD COLUMN invalid_at INTEGER`); } catch { /* already exists */ }
33
- try { database.run(/*sql*/ `ALTER TABLE memory_items ADD COLUMN verification_state TEXT NOT NULL DEFAULT 'assistant_inferred'`); } catch { /* already exists */ }
34
- try { database.run(/*sql*/ `ALTER TABLE memory_items ADD COLUMN scope_id TEXT NOT NULL DEFAULT 'default'`); } catch { /* already exists */ }
118
+ try {
119
+ database.run(/*sql*/ `ALTER TABLE memory_items ADD COLUMN importance REAL`);
120
+ } catch {
121
+ /* already exists */
122
+ }
123
+ try {
124
+ database.run(
125
+ /*sql*/ `ALTER TABLE memory_items ADD COLUMN access_count INTEGER NOT NULL DEFAULT 0`,
126
+ );
127
+ } catch {
128
+ /* already exists */
129
+ }
130
+ try {
131
+ database.run(
132
+ /*sql*/ `ALTER TABLE memory_items ADD COLUMN valid_from INTEGER`,
133
+ );
134
+ } catch {
135
+ /* already exists */
136
+ }
137
+ try {
138
+ database.run(
139
+ /*sql*/ `ALTER TABLE memory_items ADD COLUMN invalid_at INTEGER`,
140
+ );
141
+ } catch {
142
+ /* already exists */
143
+ }
144
+ try {
145
+ database.run(
146
+ /*sql*/ `ALTER TABLE memory_items ADD COLUMN verification_state TEXT NOT NULL DEFAULT 'assistant_inferred'`,
147
+ );
148
+ } catch {
149
+ /* already exists */
150
+ }
151
+ try {
152
+ database.run(
153
+ /*sql*/ `ALTER TABLE memory_items ADD COLUMN scope_id TEXT NOT NULL DEFAULT 'default'`,
154
+ );
155
+ } catch {
156
+ /* already exists */
157
+ }
35
158
 
36
159
  // memory_summaries
37
- try { database.run(/*sql*/ `ALTER TABLE memory_summaries ADD COLUMN version INTEGER NOT NULL DEFAULT 1`); } catch { /* already exists */ }
38
- try { database.run(/*sql*/ `ALTER TABLE memory_summaries ADD COLUMN scope_id TEXT NOT NULL DEFAULT 'default'`); } catch { /* already exists */ }
160
+ try {
161
+ database.run(
162
+ /*sql*/ `ALTER TABLE memory_summaries ADD COLUMN version INTEGER NOT NULL DEFAULT 1`,
163
+ );
164
+ } catch {
165
+ /* already exists */
166
+ }
167
+ try {
168
+ database.run(
169
+ /*sql*/ `ALTER TABLE memory_summaries ADD COLUMN scope_id TEXT NOT NULL DEFAULT 'default'`,
170
+ );
171
+ } catch {
172
+ /* already exists */
173
+ }
39
174
 
40
175
  // memory_jobs
41
- try { database.run(/*sql*/ `ALTER TABLE memory_jobs ADD COLUMN deferrals INTEGER NOT NULL DEFAULT 0`); } catch { /* already exists */ }
176
+ try {
177
+ database.run(
178
+ /*sql*/ `ALTER TABLE memory_jobs ADD COLUMN deferrals INTEGER NOT NULL DEFAULT 0`,
179
+ );
180
+ } catch {
181
+ /* already exists */
182
+ }
42
183
 
43
184
  // memory_segments
44
- try { database.run(/*sql*/ `ALTER TABLE memory_segments ADD COLUMN scope_id TEXT NOT NULL DEFAULT 'default'`); } catch { /* already exists */ }
45
- try { database.run(/*sql*/ `ALTER TABLE memory_segments ADD COLUMN content_hash TEXT`); } catch { /* already exists */ }
185
+ try {
186
+ database.run(
187
+ /*sql*/ `ALTER TABLE memory_segments ADD COLUMN scope_id TEXT NOT NULL DEFAULT 'default'`,
188
+ );
189
+ } catch {
190
+ /* already exists */
191
+ }
192
+ try {
193
+ database.run(
194
+ /*sql*/ `ALTER TABLE memory_segments ADD COLUMN content_hash TEXT`,
195
+ );
196
+ } catch {
197
+ /* already exists */
198
+ }
46
199
 
47
200
  // channel_inbound_events
48
- try { database.run(/*sql*/ `ALTER TABLE channel_inbound_events ADD COLUMN source_message_id TEXT`); } catch { /* already exists */ }
49
- try { database.run(/*sql*/ `ALTER TABLE channel_inbound_events ADD COLUMN processing_status TEXT NOT NULL DEFAULT 'pending'`); } catch { /* already exists */ }
50
- try { database.run(/*sql*/ `ALTER TABLE channel_inbound_events ADD COLUMN processing_attempts INTEGER NOT NULL DEFAULT 0`); } catch { /* already exists */ }
51
- try { database.run(/*sql*/ `ALTER TABLE channel_inbound_events ADD COLUMN last_processing_error TEXT`); } catch { /* already exists */ }
52
- try { database.run(/*sql*/ `ALTER TABLE channel_inbound_events ADD COLUMN retry_after INTEGER`); } catch { /* already exists */ }
53
- try { database.run(/*sql*/ `ALTER TABLE channel_inbound_events ADD COLUMN raw_payload TEXT`); } catch { /* already exists */ }
201
+ try {
202
+ database.run(
203
+ /*sql*/ `ALTER TABLE channel_inbound_events ADD COLUMN source_message_id TEXT`,
204
+ );
205
+ } catch {
206
+ /* already exists */
207
+ }
208
+ try {
209
+ database.run(
210
+ /*sql*/ `ALTER TABLE channel_inbound_events ADD COLUMN processing_status TEXT NOT NULL DEFAULT 'pending'`,
211
+ );
212
+ } catch {
213
+ /* already exists */
214
+ }
215
+ try {
216
+ database.run(
217
+ /*sql*/ `ALTER TABLE channel_inbound_events ADD COLUMN processing_attempts INTEGER NOT NULL DEFAULT 0`,
218
+ );
219
+ } catch {
220
+ /* already exists */
221
+ }
222
+ try {
223
+ database.run(
224
+ /*sql*/ `ALTER TABLE channel_inbound_events ADD COLUMN last_processing_error TEXT`,
225
+ );
226
+ } catch {
227
+ /* already exists */
228
+ }
229
+ try {
230
+ database.run(
231
+ /*sql*/ `ALTER TABLE channel_inbound_events ADD COLUMN retry_after INTEGER`,
232
+ );
233
+ } catch {
234
+ /* already exists */
235
+ }
236
+ try {
237
+ database.run(
238
+ /*sql*/ `ALTER TABLE channel_inbound_events ADD COLUMN raw_payload TEXT`,
239
+ );
240
+ } catch {
241
+ /* already exists */
242
+ }
54
243
 
55
244
  // attachments
56
- try { database.run(/*sql*/ `ALTER TABLE attachments ADD COLUMN content_hash TEXT`); } catch { /* already exists */ }
57
- try { database.run(/*sql*/ `ALTER TABLE attachments ADD COLUMN thumbnail_base64 TEXT`); } catch { /* already exists */ }
245
+ try {
246
+ database.run(
247
+ /*sql*/ `ALTER TABLE attachments ADD COLUMN content_hash TEXT`,
248
+ );
249
+ } catch {
250
+ /* already exists */
251
+ }
252
+ try {
253
+ database.run(
254
+ /*sql*/ `ALTER TABLE attachments ADD COLUMN thumbnail_base64 TEXT`,
255
+ );
256
+ } catch {
257
+ /* already exists */
258
+ }
58
259
 
59
260
  // cron_jobs
60
- try { database.run(/*sql*/ `ALTER TABLE cron_jobs ADD COLUMN schedule_syntax TEXT NOT NULL DEFAULT 'cron'`); } catch { /* already exists */ }
261
+ try {
262
+ database.run(
263
+ /*sql*/ `ALTER TABLE cron_jobs ADD COLUMN schedule_syntax TEXT NOT NULL DEFAULT 'cron'`,
264
+ );
265
+ } catch {
266
+ /* already exists */
267
+ }
61
268
 
62
269
  // messages
63
- try { database.run(/*sql*/ `ALTER TABLE messages ADD COLUMN metadata TEXT`); } catch { /* already exists */ }
270
+ try {
271
+ database.run(/*sql*/ `ALTER TABLE messages ADD COLUMN metadata TEXT`);
272
+ } catch {
273
+ /* already exists */
274
+ }
64
275
 
65
276
  // memory_embeddings
66
- try { database.run(/*sql*/ `ALTER TABLE memory_embeddings ADD COLUMN content_hash TEXT`); } catch { /* already exists */ }
277
+ try {
278
+ database.run(
279
+ /*sql*/ `ALTER TABLE memory_embeddings ADD COLUMN content_hash TEXT`,
280
+ );
281
+ } catch {
282
+ /* already exists */
283
+ }
67
284
  }