@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.
@@ -1,89 +1,19 @@
1
1
  // Browser interaction types.
2
2
 
3
- export interface BrowserFrame {
4
- type: 'browser_frame';
5
- sessionId: string;
6
- surfaceId: string;
7
- frame: string; // base64 JPEG
8
- metadata?: { offsetTop: number; pageScaleFactor: number; scrollOffsetX: number; scrollOffsetY: number; timestamp: number };
9
- }
10
-
11
3
  export interface BrowserCDPRequest {
12
- type: 'browser_cdp_request';
4
+ type: "browser_cdp_request";
13
5
  sessionId: string;
14
6
  }
15
7
 
16
8
  export interface BrowserCDPResponse {
17
- type: 'browser_cdp_response';
9
+ type: "browser_cdp_response";
18
10
  sessionId: string;
19
11
  success: boolean;
20
12
  declined?: boolean;
21
13
  }
22
14
 
23
- export interface BrowserUserClick {
24
- type: 'browser_user_click';
25
- sessionId: string;
26
- surfaceId: string;
27
- x: number;
28
- y: number;
29
- button?: 'left' | 'right';
30
- doubleClick?: boolean;
31
- }
32
-
33
- export interface BrowserUserScroll {
34
- type: 'browser_user_scroll';
35
- sessionId: string;
36
- surfaceId: string;
37
- deltaX: number;
38
- deltaY: number;
39
- x: number;
40
- y: number;
41
- }
42
-
43
- export interface BrowserUserKeypress {
44
- type: 'browser_user_keypress';
45
- sessionId: string;
46
- surfaceId: string;
47
- key: string;
48
- modifiers?: string[];
49
- }
50
-
51
- export interface BrowserInteractiveMode {
52
- type: 'browser_interactive_mode';
53
- sessionId: string;
54
- surfaceId: string;
55
- enabled: boolean;
56
- }
57
-
58
- export interface BrowserInteractiveModeChanged {
59
- type: 'browser_interactive_mode_changed';
60
- sessionId: string;
61
- surfaceId: string;
62
- enabled: boolean;
63
- reason?: string;
64
- message?: string;
65
- }
66
-
67
- export interface BrowserHandoffRequest {
68
- type: 'browser_handoff_request';
69
- sessionId: string;
70
- surfaceId: string;
71
- reason: 'auth' | 'checkout' | 'captcha' | 'custom';
72
- message: string;
73
- bringToFront?: boolean;
74
- }
75
-
76
15
  // --- Domain-level union aliases (consumed by the barrel file) ---
77
16
 
78
- export type _BrowserClientMessages =
79
- | BrowserCDPResponse
80
- | BrowserUserClick
81
- | BrowserUserScroll
82
- | BrowserUserKeypress
83
- | BrowserInteractiveMode;
17
+ export type _BrowserClientMessages = BrowserCDPResponse;
84
18
 
85
- export type _BrowserServerMessages =
86
- | BrowserFrame
87
- | BrowserCDPRequest
88
- | BrowserInteractiveModeChanged
89
- | BrowserHandoffRequest;
19
+ export type _BrowserServerMessages = BrowserCDPRequest;
@@ -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,