@vellumai/assistant 0.4.22 → 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.
@@ -2,14 +2,27 @@
2
2
 
3
3
  // === Surface type definitions ===
4
4
 
5
- export type SurfaceType = 'card' | 'form' | 'list' | 'table' | 'confirmation' | 'dynamic_page' | 'file_upload' | 'browser_view' | 'document_preview';
6
-
7
- export const INTERACTIVE_SURFACE_TYPES: SurfaceType[] = ['form', 'confirmation', 'dynamic_page', 'file_upload'];
5
+ export type SurfaceType =
6
+ | "card"
7
+ | "form"
8
+ | "list"
9
+ | "table"
10
+ | "confirmation"
11
+ | "dynamic_page"
12
+ | "file_upload"
13
+ | "document_preview";
14
+
15
+ export const INTERACTIVE_SURFACE_TYPES: SurfaceType[] = [
16
+ "form",
17
+ "confirmation",
18
+ "dynamic_page",
19
+ "file_upload",
20
+ ];
8
21
 
9
22
  export interface SurfaceAction {
10
23
  id: string;
11
24
  label: string;
12
- style?: 'primary' | 'secondary' | 'destructive';
25
+ style?: "primary" | "secondary" | "destructive";
13
26
  }
14
27
 
15
28
  export interface CardSurfaceData {
@@ -25,7 +38,7 @@ export interface CardSurfaceData {
25
38
 
26
39
  export interface FormField {
27
40
  id: string;
28
- type: 'text' | 'textarea' | 'select' | 'toggle' | 'number' | 'password';
41
+ type: "text" | "textarea" | "select" | "toggle" | "number" | "password";
29
42
  label: string;
30
43
  placeholder?: string;
31
44
  required?: boolean;
@@ -58,7 +71,7 @@ export interface ListItem {
58
71
 
59
72
  export interface ListSurfaceData {
60
73
  items: ListItem[];
61
- selectionMode: 'single' | 'multiple' | 'none';
74
+ selectionMode: "single" | "multiple" | "none";
62
75
  }
63
76
 
64
77
  export interface ConfirmationSurfaceData {
@@ -76,8 +89,8 @@ export interface DynamicPagePreview {
76
89
  description?: string;
77
90
  icon?: string;
78
91
  metrics?: Array<{ label: string; value: string }>;
79
- context?: 'app_create' | 'general';
80
- previewImage?: string; // base64 PNG
92
+ context?: "app_create" | "general";
93
+ previewImage?: string; // base64 PNG
81
94
  }
82
95
 
83
96
  export interface DynamicPageSurfaceData {
@@ -106,8 +119,8 @@ export interface TableColumn {
106
119
 
107
120
  export interface TableCellValue {
108
121
  text: string;
109
- icon?: string; // SF Symbol name
110
- iconColor?: string; // semantic token: "success" | "warning" | "error" | "muted"
122
+ icon?: string; // SF Symbol name
123
+ iconColor?: string; // semantic token: "success" | "warning" | "error" | "muted"
111
124
  }
112
125
 
113
126
  export interface TableRow {
@@ -120,32 +133,30 @@ export interface TableRow {
120
133
  export interface TableSurfaceData {
121
134
  columns: TableColumn[];
122
135
  rows: TableRow[];
123
- selectionMode?: 'none' | 'single' | 'multiple';
136
+ selectionMode?: "none" | "single" | "multiple";
124
137
  caption?: string;
125
138
  }
126
139
 
127
- export interface BrowserViewSurfaceData {
128
- sessionId: string;
129
- currentUrl: string;
130
- status: 'navigating' | 'idle' | 'interacting';
131
- frame?: string; // base64 JPEG
132
- actionText?: string; // "Clicking 'Submit' button"
133
- highlights?: Array<{ x: number; y: number; w: number; h: number; label: string }>;
134
- pages?: Array<{ id: string; title: string; url: string; active: boolean }>;
135
- }
136
-
137
140
  export interface DocumentPreviewSurfaceData {
138
141
  title: string;
139
- surfaceId: string; // the doc's real surfaceId, for focusing the panel
142
+ surfaceId: string; // the doc's real surfaceId, for focusing the panel
140
143
  subtitle?: string;
141
144
  }
142
145
 
143
- export type SurfaceData = CardSurfaceData | FormSurfaceData | ListSurfaceData | TableSurfaceData | ConfirmationSurfaceData | DynamicPageSurfaceData | FileUploadSurfaceData | BrowserViewSurfaceData | DocumentPreviewSurfaceData;
146
+ export type SurfaceData =
147
+ | CardSurfaceData
148
+ | FormSurfaceData
149
+ | ListSurfaceData
150
+ | TableSurfaceData
151
+ | ConfirmationSurfaceData
152
+ | DynamicPageSurfaceData
153
+ | FileUploadSurfaceData
154
+ | DocumentPreviewSurfaceData;
144
155
 
145
156
  // === Client → Server ===
146
157
 
147
158
  export interface UiSurfaceAction {
148
- type: 'ui_surface_action';
159
+ type: "ui_surface_action";
149
160
  sessionId: string;
150
161
  surfaceId: string;
151
162
  actionId: string;
@@ -153,7 +164,7 @@ export interface UiSurfaceAction {
153
164
  }
154
165
 
155
166
  export interface UiSurfaceUndoRequest {
156
- type: 'ui_surface_undo';
167
+ type: "ui_surface_undo";
157
168
  sessionId: string;
158
169
  surfaceId: string;
159
170
  }
@@ -162,58 +173,53 @@ export interface UiSurfaceUndoRequest {
162
173
 
163
174
  /** Common fields shared by all UiSurfaceShow variants. */
164
175
  interface UiSurfaceShowBase {
165
- type: 'ui_surface_show';
176
+ type: "ui_surface_show";
166
177
  sessionId: string;
167
178
  surfaceId: string;
168
179
  title?: string;
169
180
  actions?: SurfaceAction[];
170
- display?: 'inline' | 'panel';
181
+ display?: "inline" | "panel";
171
182
  /** The message ID that this surface belongs to (for history loading). */
172
183
  messageId?: string;
173
184
  }
174
185
 
175
186
  export interface UiSurfaceShowCard extends UiSurfaceShowBase {
176
- surfaceType: 'card';
187
+ surfaceType: "card";
177
188
  data: CardSurfaceData;
178
189
  }
179
190
 
180
191
  export interface UiSurfaceShowForm extends UiSurfaceShowBase {
181
- surfaceType: 'form';
192
+ surfaceType: "form";
182
193
  data: FormSurfaceData;
183
194
  }
184
195
 
185
196
  export interface UiSurfaceShowList extends UiSurfaceShowBase {
186
- surfaceType: 'list';
197
+ surfaceType: "list";
187
198
  data: ListSurfaceData;
188
199
  }
189
200
 
190
201
  export interface UiSurfaceShowConfirmation extends UiSurfaceShowBase {
191
- surfaceType: 'confirmation';
202
+ surfaceType: "confirmation";
192
203
  data: ConfirmationSurfaceData;
193
204
  }
194
205
 
195
206
  export interface UiSurfaceShowDynamicPage extends UiSurfaceShowBase {
196
- surfaceType: 'dynamic_page';
207
+ surfaceType: "dynamic_page";
197
208
  data: DynamicPageSurfaceData;
198
209
  }
199
210
 
200
211
  export interface UiSurfaceShowTable extends UiSurfaceShowBase {
201
- surfaceType: 'table';
212
+ surfaceType: "table";
202
213
  data: TableSurfaceData;
203
214
  }
204
215
 
205
216
  export interface UiSurfaceShowFileUpload extends UiSurfaceShowBase {
206
- surfaceType: 'file_upload';
217
+ surfaceType: "file_upload";
207
218
  data: FileUploadSurfaceData;
208
219
  }
209
220
 
210
- export interface UiSurfaceShowBrowserView extends UiSurfaceShowBase {
211
- surfaceType: 'browser_view';
212
- data: BrowserViewSurfaceData;
213
- }
214
-
215
221
  export interface UiSurfaceShowDocumentPreview extends UiSurfaceShowBase {
216
- surfaceType: 'document_preview';
222
+ surfaceType: "document_preview";
217
223
  data: DocumentPreviewSurfaceData;
218
224
  }
219
225
 
@@ -225,24 +231,23 @@ export type UiSurfaceShow =
225
231
  | UiSurfaceShowConfirmation
226
232
  | UiSurfaceShowDynamicPage
227
233
  | UiSurfaceShowFileUpload
228
- | UiSurfaceShowBrowserView
229
234
  | UiSurfaceShowDocumentPreview;
230
235
 
231
236
  export interface UiSurfaceUpdate {
232
- type: 'ui_surface_update';
237
+ type: "ui_surface_update";
233
238
  sessionId: string;
234
239
  surfaceId: string;
235
240
  data: Partial<SurfaceData>;
236
241
  }
237
242
 
238
243
  export interface UiSurfaceDismiss {
239
- type: 'ui_surface_dismiss';
244
+ type: "ui_surface_dismiss";
240
245
  sessionId: string;
241
246
  surfaceId: string;
242
247
  }
243
248
 
244
249
  export interface UiSurfaceComplete {
245
- type: 'ui_surface_complete';
250
+ type: "ui_surface_complete";
246
251
  sessionId: string;
247
252
  surfaceId: string;
248
253
  summary: string;
@@ -250,7 +255,7 @@ export interface UiSurfaceComplete {
250
255
  }
251
256
 
252
257
  export interface UiSurfaceUndoResult {
253
- type: 'ui_surface_undo_result';
258
+ type: "ui_surface_undo_result";
254
259
  sessionId: string;
255
260
  surfaceId: string;
256
261
  success: boolean;
@@ -260,9 +265,7 @@ export interface UiSurfaceUndoResult {
260
265
 
261
266
  // --- Domain-level union aliases (consumed by the barrel file) ---
262
267
 
263
- export type _SurfacesClientMessages =
264
- | UiSurfaceAction
265
- | UiSurfaceUndoRequest;
268
+ export type _SurfacesClientMessages = UiSurfaceAction | UiSurfaceUndoRequest;
266
269
 
267
270
  export type _SurfacesServerMessages =
268
271
  | UiSurfaceShow
@@ -63,10 +63,6 @@
63
63
  "assistant_inbox_escalation",
64
64
  "auth",
65
65
  "browser_cdp_response",
66
- "browser_interactive_mode",
67
- "browser_user_click",
68
- "browser_user_keypress",
69
- "browser_user_scroll",
70
66
  "bundle_app",
71
67
  "cancel",
72
68
  "confirmation_response",
@@ -211,9 +207,6 @@
211
207
  "auth_result",
212
208
  "avatar_updated",
213
209
  "browser_cdp_request",
214
- "browser_frame",
215
- "browser_handoff_request",
216
- "browser_interactive_mode_changed",
217
210
  "bundle_app_response",
218
211
  "client_settings_update",
219
212
  "confirmation_request",
@@ -65,6 +65,7 @@ import {
65
65
  stripInjectedContext,
66
66
  } from './session-runtime-assembly.js';
67
67
  import type { SkillProjectionCache } from './session-skill-tools.js';
68
+ import { resolveGuardianTrustClass } from './session-tool-setup.js';
68
69
  import { recordUsage } from './session-usage.js';
69
70
  import type { TraceEmitter } from './trace-emitter.js';
70
71
 
@@ -319,7 +320,7 @@ export async function runAgentLoopImpl(
319
320
  conflictGate: ctx.conflictGate,
320
321
  scopeId: ctx.memoryPolicy.scopeId,
321
322
  includeDefaultFallback: ctx.memoryPolicy.includeDefaultFallback,
322
- guardianTrustClass: ctx.guardianContext?.trustClass ?? 'guardian',
323
+ guardianTrustClass: resolveGuardianTrustClass(ctx.guardianContext),
323
324
  isInteractive: options?.isInteractive ?? (!ctx.hasNoClient && !ctx.headlessLock),
324
325
  },
325
326
  content,
@@ -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
  }