instavm 0.15.0 → 0.17.0
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.
- package/README.md +133 -9
- package/dist/InstaVM-DjkmUcaP.d.mts +1393 -0
- package/dist/InstaVM-DjkmUcaP.d.ts +1393 -0
- package/dist/_instavmToolsCore-34H4iqVZ.d.mts +26 -0
- package/dist/_instavmToolsCore-BuaJyxXB.d.ts +26 -0
- package/dist/cli.js +7973 -2227
- package/dist/cli.js.map +1 -1
- package/dist/index.d.mts +12 -919
- package/dist/index.d.ts +12 -919
- package/dist/index.js +1465 -141
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1450 -136
- package/dist/index.mjs.map +1 -1
- package/dist/integrations/azure-openai.d.mts +18 -0
- package/dist/integrations/azure-openai.d.ts +18 -0
- package/dist/integrations/azure-openai.js +332 -0
- package/dist/integrations/azure-openai.js.map +1 -0
- package/dist/integrations/azure-openai.mjs +299 -0
- package/dist/integrations/azure-openai.mjs.map +1 -0
- package/dist/integrations/langchain.d.mts +7 -0
- package/dist/integrations/langchain.d.ts +7 -0
- package/dist/integrations/langchain.js +364 -0
- package/dist/integrations/langchain.js.map +1 -0
- package/dist/integrations/langchain.mjs +327 -0
- package/dist/integrations/langchain.mjs.map +1 -0
- package/dist/integrations/llamaindex.d.mts +11 -0
- package/dist/integrations/llamaindex.d.ts +11 -0
- package/dist/integrations/llamaindex.js +415 -0
- package/dist/integrations/llamaindex.js.map +1 -0
- package/dist/integrations/llamaindex.mjs +378 -0
- package/dist/integrations/llamaindex.mjs.map +1 -0
- package/dist/integrations/ollama.d.mts +35 -0
- package/dist/integrations/ollama.d.ts +35 -0
- package/dist/integrations/ollama.js +421 -0
- package/dist/integrations/ollama.js.map +1 -0
- package/dist/integrations/ollama.mjs +391 -0
- package/dist/integrations/ollama.mjs.map +1 -0
- package/dist/integrations/openai.d.mts +19 -0
- package/dist/integrations/openai.d.ts +19 -0
- package/dist/integrations/openai.js +302 -0
- package/dist/integrations/openai.js.map +1 -0
- package/dist/integrations/openai.mjs +272 -0
- package/dist/integrations/openai.mjs.map +1 -0
- package/package.json +46 -4
- package/dist/integrations/openai/index.d.mts +0 -16
- package/dist/integrations/openai/index.d.ts +0 -16
- package/dist/integrations/openai/index.js +0 -38
- package/dist/integrations/openai/index.js.map +0 -1
- package/dist/integrations/openai/index.mjs +0 -12
- package/dist/integrations/openai/index.mjs.map +0 -1
|
@@ -0,0 +1,1393 @@
|
|
|
1
|
+
import FormData from 'form-data';
|
|
2
|
+
import { EventEmitter } from 'eventemitter3';
|
|
3
|
+
|
|
4
|
+
interface ApiResponse<T = any> {
|
|
5
|
+
success?: boolean;
|
|
6
|
+
data?: T;
|
|
7
|
+
error?: string;
|
|
8
|
+
message?: string;
|
|
9
|
+
}
|
|
10
|
+
interface HttpClientConfig {
|
|
11
|
+
baseURL: string;
|
|
12
|
+
timeout: number;
|
|
13
|
+
maxRetries: number;
|
|
14
|
+
retryDelay: number;
|
|
15
|
+
apiKey: string;
|
|
16
|
+
}
|
|
17
|
+
interface RequestConfig {
|
|
18
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS' | 'HEAD';
|
|
19
|
+
url: string;
|
|
20
|
+
headers?: Record<string, string>;
|
|
21
|
+
data?: any;
|
|
22
|
+
params?: Record<string, any>;
|
|
23
|
+
timeout?: number;
|
|
24
|
+
}
|
|
25
|
+
interface RetryConfig {
|
|
26
|
+
retries: number;
|
|
27
|
+
retryDelay: number;
|
|
28
|
+
retryCondition?: (error: any) => boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* HTTP client with authentication, retry logic, and error handling
|
|
33
|
+
*/
|
|
34
|
+
declare class HTTPClient {
|
|
35
|
+
private client;
|
|
36
|
+
private config;
|
|
37
|
+
get apiKey(): string;
|
|
38
|
+
get baseURL(): string;
|
|
39
|
+
constructor(config: HttpClientConfig);
|
|
40
|
+
private setupInterceptors;
|
|
41
|
+
/**
|
|
42
|
+
* Make an HTTP request with retry logic
|
|
43
|
+
*/
|
|
44
|
+
request<T = any>(requestConfig: RequestConfig): Promise<T>;
|
|
45
|
+
/**
|
|
46
|
+
* POST request with JSON body
|
|
47
|
+
*/
|
|
48
|
+
post<T = any>(url: string, data?: any, headers?: Record<string, string>, timeout?: number): Promise<T>;
|
|
49
|
+
/**
|
|
50
|
+
* POST request for code execution (uses X-API-Key header like Python client)
|
|
51
|
+
*/
|
|
52
|
+
postExecution<T = any>(url: string, data: any, headers?: Record<string, string>, timeout?: number): Promise<T>;
|
|
53
|
+
/**
|
|
54
|
+
* POST request with form data (for file uploads)
|
|
55
|
+
*/
|
|
56
|
+
postFormData<T = any>(url: string, formData: FormData, headers?: Record<string, string>): Promise<T>;
|
|
57
|
+
/**
|
|
58
|
+
* POST request with URL-encoded form data (like Python requests data= parameter)
|
|
59
|
+
*/
|
|
60
|
+
postFormUrlEncoded<T = any>(url: string, data: any, headers?: Record<string, string>): Promise<T>;
|
|
61
|
+
/**
|
|
62
|
+
* GET request
|
|
63
|
+
*/
|
|
64
|
+
get<T = any>(url: string, params?: Record<string, any>, headers?: Record<string, string>): Promise<T>;
|
|
65
|
+
/**
|
|
66
|
+
* DELETE request
|
|
67
|
+
*/
|
|
68
|
+
delete<T = any>(url: string, headers?: Record<string, string>): Promise<T>;
|
|
69
|
+
/**
|
|
70
|
+
* PUT request
|
|
71
|
+
*/
|
|
72
|
+
put<T = any>(url: string, data?: any, headers?: Record<string, string>): Promise<T>;
|
|
73
|
+
/**
|
|
74
|
+
* PATCH request
|
|
75
|
+
*/
|
|
76
|
+
patch<T = any>(url: string, data?: any, headers?: Record<string, string>): Promise<T>;
|
|
77
|
+
/**
|
|
78
|
+
* OPTIONS request
|
|
79
|
+
*/
|
|
80
|
+
options<T = any>(url: string, headers?: Record<string, string>, params?: Record<string, any>): Promise<T>;
|
|
81
|
+
/**
|
|
82
|
+
* POST request that returns raw binary data (for file downloads)
|
|
83
|
+
*/
|
|
84
|
+
postRaw(url: string, data?: any, headers?: Record<string, string>): Promise<ArrayBuffer>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface BrowserSessionOptions {
|
|
88
|
+
viewportWidth?: number;
|
|
89
|
+
viewportHeight?: number;
|
|
90
|
+
userAgent?: string;
|
|
91
|
+
}
|
|
92
|
+
interface BrowserSessionInfo {
|
|
93
|
+
sessionId: string;
|
|
94
|
+
status: 'active' | 'inactive' | 'closed';
|
|
95
|
+
createdAt: string;
|
|
96
|
+
viewportWidth: number;
|
|
97
|
+
viewportHeight: number;
|
|
98
|
+
userAgent?: string;
|
|
99
|
+
}
|
|
100
|
+
interface NavigateOptions {
|
|
101
|
+
waitTimeout?: number;
|
|
102
|
+
waitUntil?: 'load' | 'domcontentloaded' | 'networkidle';
|
|
103
|
+
}
|
|
104
|
+
interface NavigationResult {
|
|
105
|
+
success: boolean;
|
|
106
|
+
url: string;
|
|
107
|
+
title?: string;
|
|
108
|
+
status?: number;
|
|
109
|
+
}
|
|
110
|
+
interface ClickOptions {
|
|
111
|
+
timeout?: number;
|
|
112
|
+
button?: 'left' | 'right' | 'middle';
|
|
113
|
+
clickCount?: number;
|
|
114
|
+
force?: boolean;
|
|
115
|
+
}
|
|
116
|
+
interface TypeOptions {
|
|
117
|
+
timeout?: number;
|
|
118
|
+
delay?: number;
|
|
119
|
+
clear?: boolean;
|
|
120
|
+
}
|
|
121
|
+
interface FillOptions {
|
|
122
|
+
timeout?: number;
|
|
123
|
+
force?: boolean;
|
|
124
|
+
}
|
|
125
|
+
interface ScrollOptions {
|
|
126
|
+
/** Scroll element into view when set */
|
|
127
|
+
selector?: string;
|
|
128
|
+
x?: number;
|
|
129
|
+
y?: number;
|
|
130
|
+
behavior?: 'auto' | 'smooth';
|
|
131
|
+
}
|
|
132
|
+
interface ScreenshotOptions {
|
|
133
|
+
fullPage?: boolean;
|
|
134
|
+
format?: 'png' | 'jpeg';
|
|
135
|
+
quality?: number;
|
|
136
|
+
clip?: {
|
|
137
|
+
x: number;
|
|
138
|
+
y: number;
|
|
139
|
+
width: number;
|
|
140
|
+
height: number;
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
type WaitCondition = {
|
|
144
|
+
type: 'visible';
|
|
145
|
+
selector: string;
|
|
146
|
+
} | {
|
|
147
|
+
type: 'hidden';
|
|
148
|
+
selector: string;
|
|
149
|
+
} | {
|
|
150
|
+
type: 'attached';
|
|
151
|
+
selector: string;
|
|
152
|
+
} | {
|
|
153
|
+
type: 'detached';
|
|
154
|
+
selector: string;
|
|
155
|
+
} | {
|
|
156
|
+
type: 'timeout';
|
|
157
|
+
ms: number;
|
|
158
|
+
};
|
|
159
|
+
interface ExtractedElement {
|
|
160
|
+
text?: string;
|
|
161
|
+
href?: string;
|
|
162
|
+
src?: string;
|
|
163
|
+
class?: string;
|
|
164
|
+
id?: string;
|
|
165
|
+
tagName?: string;
|
|
166
|
+
[attribute: string]: any;
|
|
167
|
+
}
|
|
168
|
+
interface ExtractOptions {
|
|
169
|
+
attributes?: string[];
|
|
170
|
+
maxResults?: number;
|
|
171
|
+
}
|
|
172
|
+
interface ExtractContentOptions {
|
|
173
|
+
/** Cloud mode: browser session id (uses default manager session if omitted). */
|
|
174
|
+
sessionId?: string;
|
|
175
|
+
url?: string;
|
|
176
|
+
includeInteractive?: boolean;
|
|
177
|
+
includeAnchors?: boolean;
|
|
178
|
+
maxAnchors?: number;
|
|
179
|
+
}
|
|
180
|
+
interface InteractiveElement {
|
|
181
|
+
type: 'button' | 'link' | 'input' | 'select' | 'textarea';
|
|
182
|
+
selector: string;
|
|
183
|
+
text?: string;
|
|
184
|
+
label?: string;
|
|
185
|
+
placeholder?: string;
|
|
186
|
+
value?: string;
|
|
187
|
+
}
|
|
188
|
+
interface ContentAnchor {
|
|
189
|
+
text: string;
|
|
190
|
+
selector: string;
|
|
191
|
+
}
|
|
192
|
+
interface ExtractedContent {
|
|
193
|
+
readableContent: {
|
|
194
|
+
content: string;
|
|
195
|
+
title?: string;
|
|
196
|
+
byline?: string;
|
|
197
|
+
excerpt?: string;
|
|
198
|
+
siteName?: string;
|
|
199
|
+
};
|
|
200
|
+
interactiveElements?: InteractiveElement[];
|
|
201
|
+
contentAnchors?: ContentAnchor[];
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Browser session for automation
|
|
206
|
+
*/
|
|
207
|
+
declare class BrowserSession extends EventEmitter {
|
|
208
|
+
readonly sessionId: string;
|
|
209
|
+
private httpClient;
|
|
210
|
+
private _isActive;
|
|
211
|
+
constructor(sessionId: string, httpClient: HTTPClient);
|
|
212
|
+
/**
|
|
213
|
+
* Navigate to a URL
|
|
214
|
+
*/
|
|
215
|
+
navigate(url: string, options?: NavigateOptions): Promise<NavigationResult>;
|
|
216
|
+
/**
|
|
217
|
+
* Click an element
|
|
218
|
+
*/
|
|
219
|
+
click(selector: string, options?: ClickOptions): Promise<void>;
|
|
220
|
+
/**
|
|
221
|
+
* Type text into an element
|
|
222
|
+
*/
|
|
223
|
+
type(selector: string, text: string, options?: TypeOptions): Promise<void>;
|
|
224
|
+
/**
|
|
225
|
+
* Fill a form field
|
|
226
|
+
*/
|
|
227
|
+
fill(selector: string, value: string, options?: FillOptions): Promise<void>;
|
|
228
|
+
/**
|
|
229
|
+
* Scroll the page
|
|
230
|
+
*/
|
|
231
|
+
scroll(options?: ScrollOptions): Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* Take a screenshot
|
|
234
|
+
*/
|
|
235
|
+
screenshot(options?: ScreenshotOptions): Promise<string>;
|
|
236
|
+
/**
|
|
237
|
+
* Extract elements from the page
|
|
238
|
+
*/
|
|
239
|
+
extractElements(selector?: string | null, attributes?: string[], options?: ExtractOptions): Promise<ExtractedElement[]>;
|
|
240
|
+
/**
|
|
241
|
+
* Extract LLM-friendly content from the current page
|
|
242
|
+
*
|
|
243
|
+
* Returns clean article content, interactive elements, and content anchors
|
|
244
|
+
* for intelligent browser automation with LLMs.
|
|
245
|
+
*
|
|
246
|
+
* @param options - Content extraction options
|
|
247
|
+
* @returns Extracted content with readable text, interactive elements, and content anchors
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```typescript
|
|
251
|
+
* const content = await session.extractContent();
|
|
252
|
+
*
|
|
253
|
+
* // LLM reads clean content
|
|
254
|
+
* const article = content.readableContent.content;
|
|
255
|
+
*
|
|
256
|
+
* // LLM finds "Sign Up" in content and uses anchors to get selector
|
|
257
|
+
* const signUpAnchor = content.contentAnchors?.find(
|
|
258
|
+
* anchor => anchor.text.toLowerCase().includes('sign up')
|
|
259
|
+
* );
|
|
260
|
+
* if (signUpAnchor) {
|
|
261
|
+
* await session.click(signUpAnchor.selector);
|
|
262
|
+
* }
|
|
263
|
+
* ```
|
|
264
|
+
*/
|
|
265
|
+
extractContent(options?: ExtractContentOptions): Promise<ExtractedContent>;
|
|
266
|
+
/**
|
|
267
|
+
* Wait for a string condition (parity with Python ``wait_for``).
|
|
268
|
+
*/
|
|
269
|
+
waitFor(condition: string, selector?: string | null, timeout?: number): Promise<Record<string, any>>;
|
|
270
|
+
/**
|
|
271
|
+
* Wait for a condition
|
|
272
|
+
*/
|
|
273
|
+
wait(condition: WaitCondition, timeout?: number): Promise<void>;
|
|
274
|
+
/**
|
|
275
|
+
* Close the browser session
|
|
276
|
+
*/
|
|
277
|
+
close(): Promise<void>;
|
|
278
|
+
/**
|
|
279
|
+
* Check if session is active
|
|
280
|
+
*/
|
|
281
|
+
get isActive(): boolean;
|
|
282
|
+
/**
|
|
283
|
+
* Ensure session is active before operations
|
|
284
|
+
*/
|
|
285
|
+
private ensureActive;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Browser automation manager (parity with Python ``BrowserManager``).
|
|
290
|
+
*/
|
|
291
|
+
declare class BrowserManager {
|
|
292
|
+
private httpClient;
|
|
293
|
+
private activeSessions;
|
|
294
|
+
private local;
|
|
295
|
+
private getClient?;
|
|
296
|
+
private _defaultBrowserSessionId;
|
|
297
|
+
private _defaultSessionPromise;
|
|
298
|
+
constructor(httpClient: HTTPClient, local?: boolean, getClient?: () => InstaVM);
|
|
299
|
+
private ensureDefaultBrowserSessionId;
|
|
300
|
+
/**
|
|
301
|
+
* Create a new browser session
|
|
302
|
+
*/
|
|
303
|
+
createSession(options?: BrowserSessionOptions): Promise<BrowserSession>;
|
|
304
|
+
/**
|
|
305
|
+
* Get information about a specific session
|
|
306
|
+
*/
|
|
307
|
+
getSession(sessionId: string): Promise<BrowserSessionInfo>;
|
|
308
|
+
/**
|
|
309
|
+
* List all browser sessions
|
|
310
|
+
*/
|
|
311
|
+
listSessions(): Promise<BrowserSessionInfo[]>;
|
|
312
|
+
getLocalSession(sessionId: string): BrowserSession | undefined;
|
|
313
|
+
attachSession(sessionId: string): BrowserSession;
|
|
314
|
+
getLocalSessions(): BrowserSession[];
|
|
315
|
+
closeAllSessions(): Promise<void>;
|
|
316
|
+
/**
|
|
317
|
+
* Navigate to a URL (local: no session; cloud: auto default browser session)
|
|
318
|
+
*/
|
|
319
|
+
navigate(url: string, options?: NavigateOptions): Promise<NavigationResult>;
|
|
320
|
+
click(selector: string, sessionId?: string, force?: boolean, timeout?: number): Promise<void>;
|
|
321
|
+
type(selector: string, text: string, sessionId?: string, delay?: number, timeout?: number): Promise<void>;
|
|
322
|
+
fill(selector: string, value: string, sessionId?: string, timeout?: number): Promise<void>;
|
|
323
|
+
scroll(options?: {
|
|
324
|
+
sessionId?: string;
|
|
325
|
+
selector?: string;
|
|
326
|
+
x?: number;
|
|
327
|
+
y?: number;
|
|
328
|
+
}): Promise<void>;
|
|
329
|
+
waitFor(condition: string, selector?: string, sessionId?: string, timeout?: number): Promise<Record<string, any>>;
|
|
330
|
+
extractElements(selector?: string, sessionId?: string, attributes?: string[], options?: ExtractOptions): Promise<ExtractedElement[]>;
|
|
331
|
+
/**
|
|
332
|
+
* Extract LLM-friendly content (local: URL required; cloud: optional session)
|
|
333
|
+
*/
|
|
334
|
+
extractContent(options?: ExtractContentOptions): Promise<ExtractedContent>;
|
|
335
|
+
/**
|
|
336
|
+
* Closes the default browser session if one was created for cloud convenience.
|
|
337
|
+
*/
|
|
338
|
+
close(): Promise<void>;
|
|
339
|
+
dispose(): Promise<void>;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
type JsonMap$4 = Record<string, any>;
|
|
343
|
+
interface VMCreateRequest extends JsonMap$4 {
|
|
344
|
+
session_id?: string | null;
|
|
345
|
+
vm_lifetime_seconds?: number | null;
|
|
346
|
+
memory_mb?: number | null;
|
|
347
|
+
vcpu_count?: number | null;
|
|
348
|
+
metadata?: JsonMap$4 | null;
|
|
349
|
+
egress_policy?: JsonMap$4 | null;
|
|
350
|
+
snapshot_id?: string | null;
|
|
351
|
+
snapshot_on_terminate?: boolean | null;
|
|
352
|
+
snapshot_name?: string | null;
|
|
353
|
+
share?: JsonMap$4 | null;
|
|
354
|
+
custom_domain?: JsonMap$4 | null;
|
|
355
|
+
image_variant?: string | null;
|
|
356
|
+
volumes?: VMVolumeMountRequest[] | null;
|
|
357
|
+
}
|
|
358
|
+
interface VMUpdateRequest extends JsonMap$4 {
|
|
359
|
+
memory_mb?: number | null;
|
|
360
|
+
egress_policy?: JsonMap$4 | null;
|
|
361
|
+
snapshot_on_terminate?: boolean | null;
|
|
362
|
+
snapshot_name?: string | null;
|
|
363
|
+
}
|
|
364
|
+
interface VMCloneRequest extends JsonMap$4 {
|
|
365
|
+
snapshot_name?: string | null;
|
|
366
|
+
}
|
|
367
|
+
interface VMSnapshotRequest extends JsonMap$4 {
|
|
368
|
+
name?: string | null;
|
|
369
|
+
}
|
|
370
|
+
interface SnapshotBuildArgs extends JsonMap$4 {
|
|
371
|
+
extra_apt_packages?: string | null;
|
|
372
|
+
extra_pip_packages?: string | null;
|
|
373
|
+
extra_npm_packages?: string | null;
|
|
374
|
+
git_clone_url?: string | null;
|
|
375
|
+
git_clone_branch?: string | null;
|
|
376
|
+
disk_size_gb?: number | null;
|
|
377
|
+
envs?: Record<string, string> | null;
|
|
378
|
+
post_build_cmd?: string | null;
|
|
379
|
+
}
|
|
380
|
+
interface SnapshotCreateRequest extends JsonMap$4 {
|
|
381
|
+
oci_image: string;
|
|
382
|
+
name?: string | null;
|
|
383
|
+
vcpu_count?: number;
|
|
384
|
+
memory_mb?: number;
|
|
385
|
+
build_args?: SnapshotBuildArgs | null;
|
|
386
|
+
type?: 'user' | 'system';
|
|
387
|
+
}
|
|
388
|
+
interface SnapshotQueryOptions {
|
|
389
|
+
type?: 'user' | 'system';
|
|
390
|
+
}
|
|
391
|
+
interface VolumeCreateRequest extends JsonMap$4 {
|
|
392
|
+
name: string;
|
|
393
|
+
quota_bytes: number;
|
|
394
|
+
}
|
|
395
|
+
interface VolumeUpdateRequest extends JsonMap$4 {
|
|
396
|
+
name?: string | null;
|
|
397
|
+
quota_bytes?: number | null;
|
|
398
|
+
}
|
|
399
|
+
interface VolumeResponse extends JsonMap$4 {
|
|
400
|
+
id: string;
|
|
401
|
+
name: string;
|
|
402
|
+
quota_bytes: number;
|
|
403
|
+
used_bytes: number;
|
|
404
|
+
status: string;
|
|
405
|
+
created_at?: string | null;
|
|
406
|
+
updated_at?: string | null;
|
|
407
|
+
}
|
|
408
|
+
interface VolumeCheckpointCreateRequest extends JsonMap$4 {
|
|
409
|
+
name?: string | null;
|
|
410
|
+
}
|
|
411
|
+
interface VolumeCheckpointResponse extends JsonMap$4 {
|
|
412
|
+
id: string;
|
|
413
|
+
volume_id: string;
|
|
414
|
+
name?: string | null;
|
|
415
|
+
status: string;
|
|
416
|
+
created_at?: string | null;
|
|
417
|
+
}
|
|
418
|
+
interface VolumeFileEntry extends JsonMap$4 {
|
|
419
|
+
path: string;
|
|
420
|
+
filename: string;
|
|
421
|
+
size: number;
|
|
422
|
+
}
|
|
423
|
+
interface VolumeFileDownloadResponse extends JsonMap$4 {
|
|
424
|
+
path: string;
|
|
425
|
+
filename: string;
|
|
426
|
+
size: number;
|
|
427
|
+
content: Buffer;
|
|
428
|
+
}
|
|
429
|
+
interface VolumeFileUploadRequest extends JsonMap$4 {
|
|
430
|
+
path: string;
|
|
431
|
+
overwrite?: boolean;
|
|
432
|
+
filePath?: string;
|
|
433
|
+
fileContent?: Buffer | string;
|
|
434
|
+
filename?: string;
|
|
435
|
+
}
|
|
436
|
+
interface VolumeFileListQuery {
|
|
437
|
+
prefix?: string;
|
|
438
|
+
recursive?: boolean;
|
|
439
|
+
limit?: number;
|
|
440
|
+
}
|
|
441
|
+
interface VMVolumeMountRequest extends JsonMap$4 {
|
|
442
|
+
volume_id: string;
|
|
443
|
+
mount_path: string;
|
|
444
|
+
mode?: string;
|
|
445
|
+
checkpoint_id?: string | null;
|
|
446
|
+
}
|
|
447
|
+
interface VMMountedVolumeResponse extends JsonMap$4 {
|
|
448
|
+
volume_id: string;
|
|
449
|
+
mount_path: string;
|
|
450
|
+
mode: string;
|
|
451
|
+
checkpoint_id?: string | null;
|
|
452
|
+
status: string;
|
|
453
|
+
}
|
|
454
|
+
interface ShareCreateRequest extends JsonMap$4 {
|
|
455
|
+
session_id?: string | null;
|
|
456
|
+
vm_id?: string | null;
|
|
457
|
+
port: number;
|
|
458
|
+
is_public?: boolean;
|
|
459
|
+
}
|
|
460
|
+
interface ShareUpdateRequest extends JsonMap$4 {
|
|
461
|
+
is_public?: boolean | null;
|
|
462
|
+
revoke?: boolean | null;
|
|
463
|
+
}
|
|
464
|
+
interface CustomDomainCreateRequest extends JsonMap$4 {
|
|
465
|
+
domain: string;
|
|
466
|
+
share_id: string;
|
|
467
|
+
dns_provider: string;
|
|
468
|
+
dns_credentials?: Record<string, string> | null;
|
|
469
|
+
}
|
|
470
|
+
interface ComputerUseProxyOptions {
|
|
471
|
+
params?: Record<string, any>;
|
|
472
|
+
body?: any;
|
|
473
|
+
}
|
|
474
|
+
interface APIKeyCreateRequest extends JsonMap$4 {
|
|
475
|
+
description?: string | null;
|
|
476
|
+
expires_at?: string | null;
|
|
477
|
+
}
|
|
478
|
+
interface APIKey extends JsonMap$4 {
|
|
479
|
+
id?: number;
|
|
480
|
+
description?: string | null;
|
|
481
|
+
/** @deprecated Use key_prefix instead */
|
|
482
|
+
prefix?: string;
|
|
483
|
+
key_prefix?: string;
|
|
484
|
+
full_key?: string;
|
|
485
|
+
created_at?: string;
|
|
486
|
+
expires_at?: string | null;
|
|
487
|
+
}
|
|
488
|
+
interface AuditEventQuery {
|
|
489
|
+
event_group?: string;
|
|
490
|
+
event_type?: string;
|
|
491
|
+
status?: string;
|
|
492
|
+
user_id?: number;
|
|
493
|
+
vm_id?: string;
|
|
494
|
+
session_id?: string;
|
|
495
|
+
cursor?: string;
|
|
496
|
+
limit?: number;
|
|
497
|
+
}
|
|
498
|
+
interface WebhookEndpointCreateRequest extends JsonMap$4 {
|
|
499
|
+
url: string;
|
|
500
|
+
description?: string | null;
|
|
501
|
+
event_patterns?: string[] | null;
|
|
502
|
+
timeout_seconds?: number;
|
|
503
|
+
max_retries?: number;
|
|
504
|
+
}
|
|
505
|
+
interface WebhookEndpointUpdateRequest extends JsonMap$4 {
|
|
506
|
+
url?: string | null;
|
|
507
|
+
description?: string | null;
|
|
508
|
+
enabled?: boolean | null;
|
|
509
|
+
event_patterns?: string[] | null;
|
|
510
|
+
timeout_seconds?: number | null;
|
|
511
|
+
max_retries?: number | null;
|
|
512
|
+
}
|
|
513
|
+
interface WebhookDeliveryQuery {
|
|
514
|
+
endpoint_id?: string;
|
|
515
|
+
status?: string;
|
|
516
|
+
event_type?: string;
|
|
517
|
+
cursor?: string;
|
|
518
|
+
limit?: number;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
declare class VMsManager {
|
|
522
|
+
private httpClient;
|
|
523
|
+
private local;
|
|
524
|
+
constructor(httpClient: HTTPClient, local?: boolean);
|
|
525
|
+
private ensureCloud;
|
|
526
|
+
create(payload?: VMCreateRequest, wait?: boolean): Promise<JsonMap$4>;
|
|
527
|
+
list(): Promise<JsonMap$4[]>;
|
|
528
|
+
listAll(): Promise<JsonMap$4[]>;
|
|
529
|
+
/**
|
|
530
|
+
* Calls GET /v1/vms/ (trailing slash), a distinct route from GET /v1/vms.
|
|
531
|
+
*/
|
|
532
|
+
listAllRecords(): Promise<JsonMap$4[]>;
|
|
533
|
+
get(itemId: string | number): Promise<JsonMap$4>;
|
|
534
|
+
update(vmId: string, payload?: VMUpdateRequest): Promise<JsonMap$4>;
|
|
535
|
+
delete(vmId: string): Promise<JsonMap$4>;
|
|
536
|
+
clone(vmId: string, payload?: VMCloneRequest, wait?: boolean): Promise<JsonMap$4>;
|
|
537
|
+
snapshot(vmId: string, payload?: VMSnapshotRequest, wait?: boolean): Promise<JsonMap$4>;
|
|
538
|
+
mountVolume(vmId: string, payload: VMVolumeMountRequest, wait?: boolean): Promise<VMMountedVolumeResponse>;
|
|
539
|
+
listVolumes(vmId: string): Promise<VMMountedVolumeResponse[]>;
|
|
540
|
+
unmountVolume(vmId: string, volumeId: string, mountPath: string, wait?: boolean): Promise<JsonMap$4>;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
declare class SnapshotsManager {
|
|
544
|
+
private httpClient;
|
|
545
|
+
private local;
|
|
546
|
+
constructor(httpClient: HTTPClient, local?: boolean);
|
|
547
|
+
private ensureCloud;
|
|
548
|
+
create(payload: SnapshotCreateRequest): Promise<JsonMap$4>;
|
|
549
|
+
list(options?: SnapshotQueryOptions): Promise<JsonMap$4[]>;
|
|
550
|
+
get(snapshotId: string): Promise<JsonMap$4>;
|
|
551
|
+
delete(snapshotId: string): Promise<JsonMap$4>;
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
declare class SharesManager {
|
|
555
|
+
private httpClient;
|
|
556
|
+
private local;
|
|
557
|
+
private getSessionId;
|
|
558
|
+
constructor(httpClient: HTTPClient, local?: boolean, getSessionId?: () => string | null);
|
|
559
|
+
private ensureCloud;
|
|
560
|
+
create(payload: ShareCreateRequest): Promise<JsonMap$4>;
|
|
561
|
+
update(shareId: string, payload: ShareUpdateRequest): Promise<JsonMap$4>;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
declare class CustomDomainsManager {
|
|
565
|
+
private httpClient;
|
|
566
|
+
private local;
|
|
567
|
+
constructor(httpClient: HTTPClient, local?: boolean);
|
|
568
|
+
private ensureCloud;
|
|
569
|
+
create(payload: CustomDomainCreateRequest): Promise<JsonMap$4>;
|
|
570
|
+
list(): Promise<JsonMap$4[]>;
|
|
571
|
+
health(domainId: number): Promise<JsonMap$4>;
|
|
572
|
+
verify(domainId: number): Promise<JsonMap$4>;
|
|
573
|
+
delete(domainId: number): Promise<JsonMap$4>;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
type ProxyMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
|
|
577
|
+
declare class ComputerUseManager {
|
|
578
|
+
private httpClient;
|
|
579
|
+
private local;
|
|
580
|
+
constructor(httpClient: HTTPClient, local?: boolean);
|
|
581
|
+
private ensureCloud;
|
|
582
|
+
viewerUrl(sessionId: string): Promise<JsonMap$4>;
|
|
583
|
+
proxy(sessionId: string, path: string, method?: ProxyMethod, options?: ComputerUseProxyOptions): Promise<any>;
|
|
584
|
+
get(sessionId: string, path: string, params?: Record<string, any>): Promise<any>;
|
|
585
|
+
post(sessionId: string, path: string, body?: any): Promise<any>;
|
|
586
|
+
put(sessionId: string, path: string, body?: any): Promise<any>;
|
|
587
|
+
patch(sessionId: string, path: string, body?: any): Promise<any>;
|
|
588
|
+
delete(sessionId: string, path: string, params?: Record<string, any>): Promise<any>;
|
|
589
|
+
options(sessionId: string, path: string, params?: Record<string, any>): Promise<any>;
|
|
590
|
+
head(sessionId: string, path: string, params?: Record<string, any>): Promise<any>;
|
|
591
|
+
/**
|
|
592
|
+
* Get the VNC WebSocket URL for a computer-use session.
|
|
593
|
+
* Returns the URL to connect to; the actual connection requires a WebSocket client.
|
|
594
|
+
*/
|
|
595
|
+
vncWebsockify(sessionId: string): Promise<JsonMap$4>;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
declare class APIKeysManager {
|
|
599
|
+
private httpClient;
|
|
600
|
+
private local;
|
|
601
|
+
constructor(httpClient: HTTPClient, local?: boolean);
|
|
602
|
+
private ensureCloud;
|
|
603
|
+
create(payload?: APIKeyCreateRequest): Promise<APIKey>;
|
|
604
|
+
list(): Promise<APIKey[]>;
|
|
605
|
+
get(itemId: number): Promise<APIKey>;
|
|
606
|
+
update(itemId: number, payload: APIKeyCreateRequest): Promise<APIKey>;
|
|
607
|
+
delete(itemId: number): Promise<JsonMap$4>;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
declare class AuditManager {
|
|
611
|
+
private httpClient;
|
|
612
|
+
private local;
|
|
613
|
+
constructor(httpClient: HTTPClient, local?: boolean);
|
|
614
|
+
private ensureCloud;
|
|
615
|
+
catalog(): Promise<JsonMap$4>;
|
|
616
|
+
events(query?: AuditEventQuery): Promise<JsonMap$4>;
|
|
617
|
+
getEvent(eventId: string): Promise<JsonMap$4>;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
declare class WebhooksManager {
|
|
621
|
+
private httpClient;
|
|
622
|
+
private local;
|
|
623
|
+
constructor(httpClient: HTTPClient, local?: boolean);
|
|
624
|
+
private ensureCloud;
|
|
625
|
+
createEndpoint(payload: WebhookEndpointCreateRequest): Promise<JsonMap$4>;
|
|
626
|
+
listEndpoints(): Promise<JsonMap$4[]>;
|
|
627
|
+
getEndpoint(endpointId: string): Promise<JsonMap$4>;
|
|
628
|
+
updateEndpoint(endpointId: string, payload: WebhookEndpointUpdateRequest): Promise<JsonMap$4>;
|
|
629
|
+
deleteEndpoint(endpointId: string): Promise<JsonMap$4>;
|
|
630
|
+
rotateSecret(endpointId: string): Promise<JsonMap$4>;
|
|
631
|
+
sendTestEvent(endpointId: string): Promise<JsonMap$4>;
|
|
632
|
+
verifyEndpoint(endpointId: string): Promise<JsonMap$4>;
|
|
633
|
+
listDeliveries(query?: WebhookDeliveryQuery): Promise<JsonMap$4>;
|
|
634
|
+
replayDelivery(deliveryId: string): Promise<JsonMap$4>;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
declare class VolumesManager {
|
|
638
|
+
private httpClient;
|
|
639
|
+
private local;
|
|
640
|
+
constructor(httpClient: HTTPClient, local?: boolean);
|
|
641
|
+
private ensureCloud;
|
|
642
|
+
create(payload: VolumeCreateRequest): Promise<VolumeResponse>;
|
|
643
|
+
list(refreshUsage?: boolean): Promise<VolumeResponse[]>;
|
|
644
|
+
get(volumeId: string, refreshUsage?: boolean): Promise<VolumeResponse>;
|
|
645
|
+
update(volumeId: string, payload: VolumeUpdateRequest): Promise<VolumeResponse>;
|
|
646
|
+
delete(volumeId: string): Promise<JsonMap$4>;
|
|
647
|
+
createCheckpoint(volumeId: string, payload?: VolumeCheckpointCreateRequest): Promise<VolumeCheckpointResponse>;
|
|
648
|
+
listCheckpoints(volumeId: string): Promise<VolumeCheckpointResponse[]>;
|
|
649
|
+
deleteCheckpoint(volumeId: string, checkpointId: string): Promise<JsonMap$4>;
|
|
650
|
+
uploadFile(volumeId: string, payload: VolumeFileUploadRequest): Promise<VolumeFileEntry>;
|
|
651
|
+
downloadFile(volumeId: string, path: string): Promise<VolumeFileDownloadResponse>;
|
|
652
|
+
listFiles(volumeId: string, options?: VolumeFileListQuery): Promise<VolumeFileEntry[]>;
|
|
653
|
+
deleteFile(volumeId: string, targetPath: string): Promise<JsonMap$4>;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
/** Time-travel tape types. */
|
|
657
|
+
interface TapeStartOptions {
|
|
658
|
+
recordEgressContent?: boolean;
|
|
659
|
+
recordFs?: boolean;
|
|
660
|
+
retentionDays?: number;
|
|
661
|
+
}
|
|
662
|
+
interface TapeListQuery {
|
|
663
|
+
sessionId?: string;
|
|
664
|
+
vmId?: string;
|
|
665
|
+
status?: string;
|
|
666
|
+
limit?: number;
|
|
667
|
+
offset?: number;
|
|
668
|
+
}
|
|
669
|
+
interface TapeEventsQuery {
|
|
670
|
+
afterStep?: number;
|
|
671
|
+
kind?: string;
|
|
672
|
+
limit?: number;
|
|
673
|
+
}
|
|
674
|
+
interface TapeAppendEventOptions {
|
|
675
|
+
payload?: Record<string, any>;
|
|
676
|
+
stepId?: number;
|
|
677
|
+
parentStepId?: number;
|
|
678
|
+
checkpointId?: string;
|
|
679
|
+
}
|
|
680
|
+
interface TapeBranchOptions {
|
|
681
|
+
/** Either "live" (fork as a new live VM) or "replay". */
|
|
682
|
+
mode?: 'live' | 'replay';
|
|
683
|
+
}
|
|
684
|
+
interface TapeRecord {
|
|
685
|
+
id: string;
|
|
686
|
+
session_id?: string;
|
|
687
|
+
vm_id?: string;
|
|
688
|
+
status?: string;
|
|
689
|
+
created_at?: string;
|
|
690
|
+
stopped_at?: string | null;
|
|
691
|
+
retention_days?: number;
|
|
692
|
+
[key: string]: any;
|
|
693
|
+
}
|
|
694
|
+
interface TapeEvent {
|
|
695
|
+
step_id: number;
|
|
696
|
+
kind: string;
|
|
697
|
+
payload?: Record<string, any>;
|
|
698
|
+
ts?: string;
|
|
699
|
+
parent_step_id?: number | null;
|
|
700
|
+
checkpoint_id?: string | null;
|
|
701
|
+
[key: string]: any;
|
|
702
|
+
}
|
|
703
|
+
interface TapeLanesResponse {
|
|
704
|
+
tape_id?: string;
|
|
705
|
+
lanes: Record<string, number>;
|
|
706
|
+
[key: string]: any;
|
|
707
|
+
}
|
|
708
|
+
interface TapeDiffResponse {
|
|
709
|
+
tape_id?: string;
|
|
710
|
+
from?: number;
|
|
711
|
+
to?: number;
|
|
712
|
+
changes?: Array<Record<string, any>>;
|
|
713
|
+
[key: string]: any;
|
|
714
|
+
}
|
|
715
|
+
interface TapeBranchResponse {
|
|
716
|
+
tape_id?: string;
|
|
717
|
+
branch_id?: string;
|
|
718
|
+
vm_id?: string;
|
|
719
|
+
[key: string]: any;
|
|
720
|
+
}
|
|
721
|
+
interface TapeExportBundle {
|
|
722
|
+
tape: TapeRecord;
|
|
723
|
+
events: TapeEvent[];
|
|
724
|
+
[key: string]: any;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
type JsonMap$3 = Record<string, any>;
|
|
728
|
+
declare class TapesManager {
|
|
729
|
+
private httpClient;
|
|
730
|
+
private local;
|
|
731
|
+
constructor(httpClient: HTTPClient, local?: boolean);
|
|
732
|
+
private ensureCloud;
|
|
733
|
+
private authHeaders;
|
|
734
|
+
start(sessionId: string, options?: TapeStartOptions): Promise<TapeRecord>;
|
|
735
|
+
stop(tapeId: string): Promise<TapeRecord>;
|
|
736
|
+
list(query?: TapeListQuery): Promise<TapeRecord[]>;
|
|
737
|
+
get(tapeId: string): Promise<TapeRecord>;
|
|
738
|
+
events(tapeId: string, query?: TapeEventsQuery): Promise<TapeEvent[]>;
|
|
739
|
+
appendEvent(tapeId: string, kind: string, options?: TapeAppendEventOptions): Promise<TapeEvent>;
|
|
740
|
+
lanes(tapeId: string): Promise<TapeLanesResponse>;
|
|
741
|
+
diff(tapeId: string, fromStep: number, toStep: number): Promise<TapeDiffResponse>;
|
|
742
|
+
branch(tapeId: string, atStep: number, options?: TapeBranchOptions): Promise<TapeBranchResponse>;
|
|
743
|
+
delete(tapeId: string): Promise<JsonMap$3>;
|
|
744
|
+
export(tapeId: string): Promise<TapeExportBundle>;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/** Secrets-vault types. */
|
|
748
|
+
interface VaultRecord {
|
|
749
|
+
id: string;
|
|
750
|
+
name: string;
|
|
751
|
+
description?: string | null;
|
|
752
|
+
organization_id?: string;
|
|
753
|
+
created_at?: string;
|
|
754
|
+
[key: string]: any;
|
|
755
|
+
}
|
|
756
|
+
interface VaultCredential {
|
|
757
|
+
id: string;
|
|
758
|
+
name: string;
|
|
759
|
+
credential_type?: string;
|
|
760
|
+
description?: string | null;
|
|
761
|
+
created_at?: string;
|
|
762
|
+
[key: string]: any;
|
|
763
|
+
}
|
|
764
|
+
interface VaultService {
|
|
765
|
+
id: string;
|
|
766
|
+
host: string;
|
|
767
|
+
auth_config: Record<string, any>;
|
|
768
|
+
description?: string | null;
|
|
769
|
+
enabled?: boolean;
|
|
770
|
+
created_at?: string;
|
|
771
|
+
[key: string]: any;
|
|
772
|
+
}
|
|
773
|
+
interface VaultRequestLog {
|
|
774
|
+
id?: string;
|
|
775
|
+
host?: string;
|
|
776
|
+
status?: number | string;
|
|
777
|
+
ts?: string;
|
|
778
|
+
[key: string]: any;
|
|
779
|
+
}
|
|
780
|
+
interface VaultDiscoverResponse {
|
|
781
|
+
vault: VaultRecord;
|
|
782
|
+
credentials?: Array<{
|
|
783
|
+
name: string;
|
|
784
|
+
credential_type?: string;
|
|
785
|
+
}>;
|
|
786
|
+
services?: Array<{
|
|
787
|
+
id?: string;
|
|
788
|
+
host: string;
|
|
789
|
+
}>;
|
|
790
|
+
[key: string]: any;
|
|
791
|
+
}
|
|
792
|
+
interface VaultCatalogTemplate {
|
|
793
|
+
id: string;
|
|
794
|
+
name: string;
|
|
795
|
+
host?: string;
|
|
796
|
+
description?: string;
|
|
797
|
+
auth_config_template?: Record<string, any>;
|
|
798
|
+
[key: string]: any;
|
|
799
|
+
}
|
|
800
|
+
interface AddVaultCredentialOptions {
|
|
801
|
+
description?: string;
|
|
802
|
+
credentialType?: string;
|
|
803
|
+
}
|
|
804
|
+
interface AddVaultServiceOptions {
|
|
805
|
+
description?: string;
|
|
806
|
+
enabled?: boolean;
|
|
807
|
+
}
|
|
808
|
+
interface UpdateVaultOptions {
|
|
809
|
+
name?: string;
|
|
810
|
+
description?: string;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
type JsonMap$2 = Record<string, any>;
|
|
814
|
+
declare class VaultsManager {
|
|
815
|
+
private httpClient;
|
|
816
|
+
private local;
|
|
817
|
+
constructor(httpClient: HTTPClient, local?: boolean);
|
|
818
|
+
private ensureCloud;
|
|
819
|
+
private auth;
|
|
820
|
+
list(): Promise<VaultRecord[]>;
|
|
821
|
+
create(name: string, description?: string): Promise<VaultRecord>;
|
|
822
|
+
get(vaultId: string): Promise<VaultRecord>;
|
|
823
|
+
update(vaultId: string, updates: UpdateVaultOptions): Promise<VaultRecord>;
|
|
824
|
+
delete(vaultId: string): Promise<JsonMap$2>;
|
|
825
|
+
discover(vaultId: string): Promise<VaultDiscoverResponse>;
|
|
826
|
+
listCredentials(vaultId: string): Promise<VaultCredential[]>;
|
|
827
|
+
addCredential(vaultId: string, name: string, value: string, options?: AddVaultCredentialOptions): Promise<VaultCredential>;
|
|
828
|
+
rotateCredential(vaultId: string, credentialId: string, value: string): Promise<VaultCredential>;
|
|
829
|
+
deleteCredential(vaultId: string, credentialId: string): Promise<JsonMap$2>;
|
|
830
|
+
listServices(vaultId: string): Promise<VaultService[]>;
|
|
831
|
+
addService(vaultId: string, host: string, authConfig: Record<string, any>, options?: AddVaultServiceOptions): Promise<VaultService>;
|
|
832
|
+
addServicesFromTemplates(vaultId: string, templateIds: string[]): Promise<JsonMap$2>;
|
|
833
|
+
deleteService(vaultId: string, serviceId: string): Promise<JsonMap$2>;
|
|
834
|
+
getCatalog(): Promise<VaultCatalogTemplate[]>;
|
|
835
|
+
getRequestLogs(vaultId: string, limit?: number): Promise<VaultRequestLog[]>;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
/** PTY (interactive terminal) types. */
|
|
839
|
+
interface PTYCreateOptions {
|
|
840
|
+
cols?: number;
|
|
841
|
+
rows?: number;
|
|
842
|
+
/** Shell program (e.g. "/bin/zsh"). Maps to backend "shell" field. */
|
|
843
|
+
command?: string;
|
|
844
|
+
/** Optional explicit pty session id. */
|
|
845
|
+
ptyId?: string;
|
|
846
|
+
}
|
|
847
|
+
interface PTYRecord {
|
|
848
|
+
session_id?: string;
|
|
849
|
+
id?: string;
|
|
850
|
+
cols?: number;
|
|
851
|
+
rows?: number;
|
|
852
|
+
shell?: string;
|
|
853
|
+
alive?: boolean;
|
|
854
|
+
exit_code?: number | null;
|
|
855
|
+
created_at?: string;
|
|
856
|
+
[key: string]: any;
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
type JsonMap$1 = Record<string, any>;
|
|
860
|
+
declare class PTYManager {
|
|
861
|
+
private httpClient;
|
|
862
|
+
private local;
|
|
863
|
+
private getBaseURL;
|
|
864
|
+
constructor(httpClient: HTTPClient, local: boolean, getBaseURL: () => string);
|
|
865
|
+
private ensureCloud;
|
|
866
|
+
private auth;
|
|
867
|
+
private buildPayload;
|
|
868
|
+
private buildWsUrl;
|
|
869
|
+
create(sessionId: string, options?: PTYCreateOptions): Promise<PTYRecord>;
|
|
870
|
+
list(sessionId: string): Promise<PTYRecord[]>;
|
|
871
|
+
get(sessionId: string, ptyId: string): Promise<PTYRecord>;
|
|
872
|
+
resize(sessionId: string, ptyId: string, cols: number, rows: number): Promise<JsonMap$1>;
|
|
873
|
+
kill(sessionId: string, ptyId: string): Promise<JsonMap$1>;
|
|
874
|
+
wsUrl(sessionId: string, ptyId: string): string;
|
|
875
|
+
createForVm(vmId: string, options?: PTYCreateOptions): Promise<PTYRecord>;
|
|
876
|
+
listForVm(vmId: string): Promise<PTYRecord[]>;
|
|
877
|
+
getForVm(vmId: string, ptyId: string): Promise<PTYRecord>;
|
|
878
|
+
resizeForVm(vmId: string, ptyId: string, cols: number, rows: number): Promise<JsonMap$1>;
|
|
879
|
+
killForVm(vmId: string, ptyId: string): Promise<JsonMap$1>;
|
|
880
|
+
wsUrlForVm(vmId: string, ptyId: string): string;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
/** Computer-use session recording types. */
|
|
884
|
+
interface RecordingRecord {
|
|
885
|
+
id: string;
|
|
886
|
+
session_id?: string;
|
|
887
|
+
status?: 'uploading' | 'ready' | 'failed' | string;
|
|
888
|
+
duration_seconds?: number;
|
|
889
|
+
size_bytes?: number;
|
|
890
|
+
created_at?: string;
|
|
891
|
+
completed_at?: string | null;
|
|
892
|
+
[key: string]: any;
|
|
893
|
+
}
|
|
894
|
+
interface RecordingListQuery {
|
|
895
|
+
sessionId?: string;
|
|
896
|
+
status?: string;
|
|
897
|
+
limit?: number;
|
|
898
|
+
offset?: number;
|
|
899
|
+
}
|
|
900
|
+
interface RecordingDownloadResult {
|
|
901
|
+
recordingId: string;
|
|
902
|
+
path: string;
|
|
903
|
+
bytes: number;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
type JsonMap = Record<string, any>;
|
|
907
|
+
declare class RecordingsManager {
|
|
908
|
+
private httpClient;
|
|
909
|
+
private local;
|
|
910
|
+
private getBaseURL;
|
|
911
|
+
constructor(httpClient: HTTPClient, local: boolean, getBaseURL: () => string);
|
|
912
|
+
private ensureCloud;
|
|
913
|
+
private auth;
|
|
914
|
+
private sdkHeaders;
|
|
915
|
+
list(query?: RecordingListQuery): Promise<RecordingRecord[]>;
|
|
916
|
+
get(recordingId: string): Promise<RecordingRecord>;
|
|
917
|
+
/**
|
|
918
|
+
* Resolve the presigned download URL for a recording without following the
|
|
919
|
+
* 302 redirect. The returned URL is short-lived and pre-authorised.
|
|
920
|
+
*/
|
|
921
|
+
getDownloadUrl(recordingId: string): Promise<string>;
|
|
922
|
+
/**
|
|
923
|
+
* Stream a recording to a local file using the presigned URL. The S3 URL
|
|
924
|
+
* must NOT carry our X-API-Key header — fetch it with a clean axios call.
|
|
925
|
+
*/
|
|
926
|
+
download(recordingId: string, outputPath: string): Promise<RecordingDownloadResult>;
|
|
927
|
+
delete(recordingId: string): Promise<JsonMap>;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/** Credit / billing types. */
|
|
931
|
+
type CreditPeriod = 'current_month' | 'last_30_days' | 'all' | string;
|
|
932
|
+
type CreditTrendsPeriod = '7d' | '30d' | '90d' | string;
|
|
933
|
+
type CreditTrendsGranularity = 'hourly' | 'daily' | 'weekly' | string;
|
|
934
|
+
interface CreditAllocation {
|
|
935
|
+
period?: string;
|
|
936
|
+
total_credits?: number;
|
|
937
|
+
used_credits?: number;
|
|
938
|
+
remaining_credits?: number;
|
|
939
|
+
buckets?: Record<string, any>;
|
|
940
|
+
[key: string]: any;
|
|
941
|
+
}
|
|
942
|
+
interface CreditUsageEntry {
|
|
943
|
+
ts?: string;
|
|
944
|
+
usage_type?: string;
|
|
945
|
+
credits?: number;
|
|
946
|
+
amount_usd?: number;
|
|
947
|
+
resource_id?: string;
|
|
948
|
+
[key: string]: any;
|
|
949
|
+
}
|
|
950
|
+
interface CreditSummary {
|
|
951
|
+
period?: string;
|
|
952
|
+
total_credits?: number;
|
|
953
|
+
total_usd?: number;
|
|
954
|
+
by_type?: Record<string, any>;
|
|
955
|
+
[key: string]: any;
|
|
956
|
+
}
|
|
957
|
+
interface CreditCheckResponse {
|
|
958
|
+
has_credits?: boolean;
|
|
959
|
+
remaining_credits?: number;
|
|
960
|
+
required_credits?: number;
|
|
961
|
+
usage_type?: string;
|
|
962
|
+
[key: string]: any;
|
|
963
|
+
}
|
|
964
|
+
interface CreditRates {
|
|
965
|
+
rates?: Record<string, any>;
|
|
966
|
+
[key: string]: any;
|
|
967
|
+
}
|
|
968
|
+
interface CreditTrendsResponse {
|
|
969
|
+
period?: string;
|
|
970
|
+
granularity?: string;
|
|
971
|
+
series?: Array<Record<string, any>>;
|
|
972
|
+
[key: string]: any;
|
|
973
|
+
}
|
|
974
|
+
interface CreditForecastResponse {
|
|
975
|
+
forecast?: Record<string, any>;
|
|
976
|
+
recommendations?: Array<Record<string, any>>;
|
|
977
|
+
[key: string]: any;
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
declare class CreditsManager {
|
|
981
|
+
private httpClient;
|
|
982
|
+
private local;
|
|
983
|
+
constructor(httpClient: HTTPClient, local?: boolean);
|
|
984
|
+
private ensureCloud;
|
|
985
|
+
private auth;
|
|
986
|
+
allocation(): Promise<CreditAllocation>;
|
|
987
|
+
usage(period?: CreditPeriod, options?: {
|
|
988
|
+
usageType?: string;
|
|
989
|
+
limit?: number;
|
|
990
|
+
}): Promise<CreditUsageEntry[]>;
|
|
991
|
+
summary(period?: CreditPeriod): Promise<CreditSummary>;
|
|
992
|
+
check(usageType: string, requiredCredits: number): Promise<CreditCheckResponse>;
|
|
993
|
+
rates(): Promise<CreditRates>;
|
|
994
|
+
usageTrends(period?: CreditTrendsPeriod, granularity?: CreditTrendsGranularity): Promise<CreditTrendsResponse>;
|
|
995
|
+
usageForecast(): Promise<CreditForecastResponse>;
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Start/stop a tape for a session (parity with Python ``TapeContext``).
|
|
1000
|
+
*
|
|
1001
|
+
* Usage:
|
|
1002
|
+
* ```ts
|
|
1003
|
+
* const ctx = client.tape(sessionId, { recordFs: true });
|
|
1004
|
+
* await ctx.start();
|
|
1005
|
+
* try {
|
|
1006
|
+
* // ...
|
|
1007
|
+
* } finally {
|
|
1008
|
+
* await ctx.stop();
|
|
1009
|
+
* }
|
|
1010
|
+
* ```
|
|
1011
|
+
*/
|
|
1012
|
+
declare class TapeContext {
|
|
1013
|
+
private readonly tapes;
|
|
1014
|
+
private readonly sessionId;
|
|
1015
|
+
private readonly startOpts;
|
|
1016
|
+
info: TapeRecord | null;
|
|
1017
|
+
constructor(tapes: TapesManager, sessionId: string | undefined, startOpts: TapeStartOptions);
|
|
1018
|
+
get id(): string | undefined;
|
|
1019
|
+
start(): Promise<void>;
|
|
1020
|
+
stop(): Promise<void>;
|
|
1021
|
+
[Symbol.asyncDispose](): Promise<void>;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
/**
|
|
1025
|
+
* Record tool-call spans into an active tape (parity with Python ``ToolCallRecorder``).
|
|
1026
|
+
*/
|
|
1027
|
+
declare class ToolCallRecorder {
|
|
1028
|
+
private readonly tapes;
|
|
1029
|
+
private readonly tapeId;
|
|
1030
|
+
constructor(tapes: TapesManager, tapeId: string);
|
|
1031
|
+
event(kind: string, payload?: Record<string, any>, stepId?: number): Promise<TapeEvent>;
|
|
1032
|
+
span(name: string, payload?: Record<string, any>): ToolCallSpan;
|
|
1033
|
+
}
|
|
1034
|
+
declare class ToolCallSpan {
|
|
1035
|
+
private readonly recorder;
|
|
1036
|
+
private readonly name;
|
|
1037
|
+
private readonly startPayload;
|
|
1038
|
+
private endPayload;
|
|
1039
|
+
private stepId;
|
|
1040
|
+
constructor(recorder: ToolCallRecorder, name: string, startPayload: Record<string, any>);
|
|
1041
|
+
attach(payload: Record<string, any>): void;
|
|
1042
|
+
enter(): Promise<void>;
|
|
1043
|
+
exit(err?: unknown): Promise<void>;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
interface ExecuteOptions {
|
|
1047
|
+
language?: 'python' | 'bash';
|
|
1048
|
+
timeout?: number;
|
|
1049
|
+
sessionId?: string;
|
|
1050
|
+
}
|
|
1051
|
+
interface ExecutionResult {
|
|
1052
|
+
stdout: string;
|
|
1053
|
+
stderr: string;
|
|
1054
|
+
success: boolean;
|
|
1055
|
+
executionTime?: number;
|
|
1056
|
+
cpuTime?: number;
|
|
1057
|
+
createdAt?: string;
|
|
1058
|
+
sessionId?: string;
|
|
1059
|
+
error?: string;
|
|
1060
|
+
}
|
|
1061
|
+
interface AsyncExecutionResult {
|
|
1062
|
+
taskId: string;
|
|
1063
|
+
status: 'pending' | 'running' | 'completed' | 'failed';
|
|
1064
|
+
output?: string;
|
|
1065
|
+
success?: boolean;
|
|
1066
|
+
executionTime?: number;
|
|
1067
|
+
sessionId?: string;
|
|
1068
|
+
error?: string;
|
|
1069
|
+
}
|
|
1070
|
+
interface TaskResult {
|
|
1071
|
+
stdout: string;
|
|
1072
|
+
stderr: string;
|
|
1073
|
+
executionTime?: number;
|
|
1074
|
+
cpuTime?: number;
|
|
1075
|
+
createdAt?: string;
|
|
1076
|
+
}
|
|
1077
|
+
interface FileUpload {
|
|
1078
|
+
name: string;
|
|
1079
|
+
content: Buffer | string;
|
|
1080
|
+
path?: string;
|
|
1081
|
+
}
|
|
1082
|
+
interface UploadOptions {
|
|
1083
|
+
sessionId?: string;
|
|
1084
|
+
remotePath?: string;
|
|
1085
|
+
recursive?: boolean;
|
|
1086
|
+
}
|
|
1087
|
+
interface UploadResult {
|
|
1088
|
+
success: boolean;
|
|
1089
|
+
files: string[];
|
|
1090
|
+
message?: string;
|
|
1091
|
+
}
|
|
1092
|
+
interface UsageStats {
|
|
1093
|
+
sessionsUsed: number;
|
|
1094
|
+
executionTime: number;
|
|
1095
|
+
quotaRemaining: number;
|
|
1096
|
+
quotaLimit: number;
|
|
1097
|
+
}
|
|
1098
|
+
interface DownloadOptions {
|
|
1099
|
+
sessionId?: string;
|
|
1100
|
+
}
|
|
1101
|
+
interface DownloadResult {
|
|
1102
|
+
success: boolean;
|
|
1103
|
+
filename: string;
|
|
1104
|
+
content: Buffer;
|
|
1105
|
+
size: number;
|
|
1106
|
+
}
|
|
1107
|
+
|
|
1108
|
+
interface EgressPolicy {
|
|
1109
|
+
allowPackageManagers: boolean;
|
|
1110
|
+
allowHttp: boolean;
|
|
1111
|
+
allowHttps: boolean;
|
|
1112
|
+
allowedDomains: string[];
|
|
1113
|
+
allowedCidrs: string[];
|
|
1114
|
+
}
|
|
1115
|
+
interface EgressPolicyOptions {
|
|
1116
|
+
allowPackageManagers?: boolean;
|
|
1117
|
+
allowHttp?: boolean;
|
|
1118
|
+
allowHttps?: boolean;
|
|
1119
|
+
allowedDomains?: string[];
|
|
1120
|
+
allowedCidrs?: string[];
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
interface SSHKey {
|
|
1124
|
+
id: number;
|
|
1125
|
+
fingerprint: string;
|
|
1126
|
+
keyType: string;
|
|
1127
|
+
comment: string | null;
|
|
1128
|
+
createdAt: string;
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
interface CurrentUserResponse extends Record<string, any> {
|
|
1132
|
+
id: number;
|
|
1133
|
+
name: string;
|
|
1134
|
+
email: string;
|
|
1135
|
+
is_verified: boolean;
|
|
1136
|
+
}
|
|
1137
|
+
interface SessionStatusResponse extends Record<string, any> {
|
|
1138
|
+
session_id: string;
|
|
1139
|
+
exists: boolean;
|
|
1140
|
+
vm_assigned: boolean;
|
|
1141
|
+
vm_status?: string | null;
|
|
1142
|
+
vm_id?: string | null;
|
|
1143
|
+
vm_alive: boolean;
|
|
1144
|
+
uptime_seconds?: number | null;
|
|
1145
|
+
expires_in_seconds?: number | null;
|
|
1146
|
+
created_at?: string | null;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
interface InstaVMOptions {
|
|
1150
|
+
baseURL?: string;
|
|
1151
|
+
/**
|
|
1152
|
+
* Timeout in milliseconds. Used for HTTP request timeout and sent to API as VM lifetime (in seconds).
|
|
1153
|
+
* Default: 300000 (5 minutes)
|
|
1154
|
+
*/
|
|
1155
|
+
timeout?: number;
|
|
1156
|
+
maxRetries?: number;
|
|
1157
|
+
retryDelay?: number;
|
|
1158
|
+
local?: boolean;
|
|
1159
|
+
localURL?: string;
|
|
1160
|
+
/** VM memory in megabytes (optional). Range: 128-8192 MB */
|
|
1161
|
+
memory_mb?: number;
|
|
1162
|
+
/** VM vCPU count (optional). Valid values: 1, 2, 4, 6, 8 */
|
|
1163
|
+
cpu_count?: number;
|
|
1164
|
+
/** Optional user-defined metadata for filtering */
|
|
1165
|
+
metadata?: Record<string, any>;
|
|
1166
|
+
/** Optional environment variables to set in the VM */
|
|
1167
|
+
env?: Record<string, any>;
|
|
1168
|
+
/**
|
|
1169
|
+
* When true (default), start a cloud execution session during construction (mirrors Python).
|
|
1170
|
+
* Set false for management-only CLI commands.
|
|
1171
|
+
*/
|
|
1172
|
+
auto_start_session?: boolean;
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Main InstaVM client class
|
|
1176
|
+
*/
|
|
1177
|
+
declare class InstaVM {
|
|
1178
|
+
private httpClient;
|
|
1179
|
+
private _sessionId;
|
|
1180
|
+
readonly browser: BrowserManager;
|
|
1181
|
+
readonly vms: VMsManager;
|
|
1182
|
+
readonly snapshots: SnapshotsManager;
|
|
1183
|
+
readonly shares: SharesManager;
|
|
1184
|
+
readonly customDomains: CustomDomainsManager;
|
|
1185
|
+
readonly computerUse: ComputerUseManager;
|
|
1186
|
+
readonly apiKeys: APIKeysManager;
|
|
1187
|
+
readonly audit: AuditManager;
|
|
1188
|
+
readonly webhooks: WebhooksManager;
|
|
1189
|
+
readonly volumes: VolumesManager;
|
|
1190
|
+
readonly tapes: TapesManager;
|
|
1191
|
+
readonly vaults: VaultsManager;
|
|
1192
|
+
readonly pty: PTYManager;
|
|
1193
|
+
readonly recordings: RecordingsManager;
|
|
1194
|
+
readonly credits: CreditsManager;
|
|
1195
|
+
readonly local: boolean;
|
|
1196
|
+
private readonly timeout;
|
|
1197
|
+
readonly memory_mb?: number;
|
|
1198
|
+
readonly cpu_count?: number;
|
|
1199
|
+
readonly metadata?: Record<string, any>;
|
|
1200
|
+
readonly env?: Record<string, any>;
|
|
1201
|
+
private _vmUsed;
|
|
1202
|
+
private readonly _autoStartSession;
|
|
1203
|
+
private sessionBootstrap?;
|
|
1204
|
+
constructor(apiKey: string, options?: InstaVMOptions);
|
|
1205
|
+
private awaitSessionBootstrap;
|
|
1206
|
+
/**
|
|
1207
|
+
* Ensure operation is not called in local mode
|
|
1208
|
+
*/
|
|
1209
|
+
private ensureNotLocal;
|
|
1210
|
+
private authHeaders;
|
|
1211
|
+
/**
|
|
1212
|
+
* Execute code synchronously
|
|
1213
|
+
*
|
|
1214
|
+
* @param command - Command to execute
|
|
1215
|
+
* @param options - Execution options
|
|
1216
|
+
* @param options.timeout - Request timeout in milliseconds (used for HTTP request timeout and sent to API in seconds)
|
|
1217
|
+
* @returns Execution result
|
|
1218
|
+
*/
|
|
1219
|
+
execute(command: string, options?: ExecuteOptions): Promise<ExecutionResult>;
|
|
1220
|
+
/**
|
|
1221
|
+
* Execute code asynchronously
|
|
1222
|
+
*/
|
|
1223
|
+
executeAsync(command: string, options?: ExecuteOptions): Promise<AsyncExecutionResult>;
|
|
1224
|
+
/**
|
|
1225
|
+
* Poll for async task result
|
|
1226
|
+
*
|
|
1227
|
+
* @param taskId - The task ID from executeAsync
|
|
1228
|
+
* @param pollInterval - Seconds between polls (default: 1)
|
|
1229
|
+
* @param timeout - Maximum seconds to wait (default: 60)
|
|
1230
|
+
* @returns Task result with stdout, stderr, execution time, etc.
|
|
1231
|
+
* @throws Error if task doesn't complete within timeout
|
|
1232
|
+
*/
|
|
1233
|
+
getTaskResult(taskId: string, pollInterval?: number, timeout?: number): Promise<TaskResult>;
|
|
1234
|
+
/**
|
|
1235
|
+
* Upload files to the execution environment
|
|
1236
|
+
*/
|
|
1237
|
+
upload(files: FileUpload[], options?: UploadOptions): Promise<UploadResult>;
|
|
1238
|
+
/**
|
|
1239
|
+
* Create a new execution session
|
|
1240
|
+
*/
|
|
1241
|
+
createSession(): Promise<string>;
|
|
1242
|
+
/**
|
|
1243
|
+
* Close a session
|
|
1244
|
+
* Note: Sessions auto-expire on the server side. This just clears local state.
|
|
1245
|
+
*/
|
|
1246
|
+
closeSession(sessionId?: string): Promise<void>;
|
|
1247
|
+
/**
|
|
1248
|
+
* Check if current session is still active by checking VM status
|
|
1249
|
+
*
|
|
1250
|
+
* @returns true if session is active, false otherwise
|
|
1251
|
+
*/
|
|
1252
|
+
isSessionActive(sessionId?: string): Promise<boolean>;
|
|
1253
|
+
/**
|
|
1254
|
+
* Get the app URL for a session
|
|
1255
|
+
*
|
|
1256
|
+
* @param sessionId - Session ID (uses current session if not provided)
|
|
1257
|
+
* @param port - Port to expose (1-65535, default: 80)
|
|
1258
|
+
*/
|
|
1259
|
+
getSessionAppUrl(sessionId?: string, port?: number): Promise<Record<string, any>>;
|
|
1260
|
+
/**
|
|
1261
|
+
* List sandbox records with optional filtering
|
|
1262
|
+
*
|
|
1263
|
+
* @param options.metadata - JSON-serializable metadata filters
|
|
1264
|
+
* @param options.limit - Maximum number of results (1-1000, default: 100)
|
|
1265
|
+
*/
|
|
1266
|
+
listSandboxes(options?: {
|
|
1267
|
+
metadata?: Record<string, any>;
|
|
1268
|
+
limit?: number;
|
|
1269
|
+
}): Promise<Record<string, any>[]>;
|
|
1270
|
+
/**
|
|
1271
|
+
* Get usage statistics for a session
|
|
1272
|
+
*/
|
|
1273
|
+
getUsage(sessionId?: string): Promise<UsageStats>;
|
|
1274
|
+
/**
|
|
1275
|
+
* Get the current user profile.
|
|
1276
|
+
*/
|
|
1277
|
+
getCurrentUser(): Promise<CurrentUserResponse>;
|
|
1278
|
+
/**
|
|
1279
|
+
* Get the current status of a session.
|
|
1280
|
+
*/
|
|
1281
|
+
getSessionStatus(sessionId?: string): Promise<SessionStatusResponse>;
|
|
1282
|
+
/**
|
|
1283
|
+
* Get session record details from ``GET /v1/sessions/session/{session_id}`` (Python: ``get_session_info``).
|
|
1284
|
+
*/
|
|
1285
|
+
getSessionInfo(sessionId?: string): Promise<Record<string, any>>;
|
|
1286
|
+
/**
|
|
1287
|
+
* Day-wise usage breakdown from ``GET /v1/users/me/usage-breakdown`` (Python: ``get_usage_breakdown``).
|
|
1288
|
+
*/
|
|
1289
|
+
getUsageBreakdown(options?: {
|
|
1290
|
+
startDate?: string;
|
|
1291
|
+
endDate?: string;
|
|
1292
|
+
days?: number;
|
|
1293
|
+
}): Promise<Record<string, any>>;
|
|
1294
|
+
/**
|
|
1295
|
+
* Time-travel tape context manager (Python: ``tape()`` / ``TapeContext``).
|
|
1296
|
+
*/
|
|
1297
|
+
tape(sessionId?: string | null, options?: TapeStartOptions): TapeContext;
|
|
1298
|
+
/** Build a tool-call recorder for an active tape id (Python: ``ToolCallRecorder``). */
|
|
1299
|
+
toolCallRecorder(tapeId: string): ToolCallRecorder;
|
|
1300
|
+
/**
|
|
1301
|
+
* @deprecated Streaming is not supported by the API; yields a single chunk from ``execute``.
|
|
1302
|
+
*/
|
|
1303
|
+
executeStreaming(command: string, onOutput?: (chunk: string) => void): AsyncGenerator<string, void, undefined>;
|
|
1304
|
+
listVaults(): Promise<VaultRecord[]>;
|
|
1305
|
+
createVault(name: string, description?: string): Promise<VaultRecord>;
|
|
1306
|
+
getVault(vaultId: string): Promise<VaultRecord>;
|
|
1307
|
+
updateVault(vaultId: string, updates: UpdateVaultOptions): Promise<VaultRecord>;
|
|
1308
|
+
deleteVault(vaultId: string): Promise<Record<string, any>>;
|
|
1309
|
+
discoverVault(vaultId: string): Promise<VaultDiscoverResponse>;
|
|
1310
|
+
listVaultCredentials(vaultId: string): Promise<VaultCredential[]>;
|
|
1311
|
+
addVaultCredential(vaultId: string, name: string, value: string, options?: AddVaultCredentialOptions): Promise<VaultCredential>;
|
|
1312
|
+
rotateVaultCredential(vaultId: string, credentialId: string, value: string): Promise<VaultCredential>;
|
|
1313
|
+
deleteVaultCredential(vaultId: string, credentialId: string): Promise<Record<string, any>>;
|
|
1314
|
+
listVaultServices(vaultId: string): Promise<VaultService[]>;
|
|
1315
|
+
addVaultService(vaultId: string, host: string, authConfig: Record<string, any>, options?: AddVaultServiceOptions): Promise<VaultService>;
|
|
1316
|
+
deleteVaultService(vaultId: string, serviceId: string): Promise<Record<string, any>>;
|
|
1317
|
+
addVaultServicesFromTemplates(vaultId: string, templateIds: string[]): Promise<Record<string, any>>;
|
|
1318
|
+
getVaultCatalog(): Promise<VaultCatalogTemplate[]>;
|
|
1319
|
+
getVaultRequestLogs(vaultId: string, limit?: number): Promise<VaultRequestLog[]>;
|
|
1320
|
+
createBrowserSession(viewportWidth?: number, viewportHeight?: number, userAgent?: string): Promise<string>;
|
|
1321
|
+
getBrowserSession(sessionId: string): Promise<Record<string, any>>;
|
|
1322
|
+
closeBrowserSession(sessionId: string): Promise<boolean>;
|
|
1323
|
+
listBrowserSessions(): Promise<Record<string, any>[]>;
|
|
1324
|
+
browserNavigate(url: string, sessionId?: string | null, waitTimeout?: number): Promise<Record<string, any>>;
|
|
1325
|
+
browserClick(selector: string, sessionId: string, force?: boolean, timeout?: number): Promise<Record<string, any>>;
|
|
1326
|
+
browserType(selector: string, text: string, sessionId: string, delay?: number, timeout?: number): Promise<Record<string, any>>;
|
|
1327
|
+
browserFill(selector: string, value: string, sessionId: string, timeout?: number): Promise<Record<string, any>>;
|
|
1328
|
+
browserScroll(sessionId: string, selector?: string | null, x?: number | null, y?: number | null): Promise<Record<string, any>>;
|
|
1329
|
+
browserWait(condition: string, sessionId: string, selector?: string | null, timeout?: number): Promise<Record<string, any>>;
|
|
1330
|
+
browserScreenshot(sessionId: string, fullPage?: boolean, clip?: Record<string, any> | null, format?: string, quality?: number | null): Promise<string>;
|
|
1331
|
+
browserExtractElements(sessionId: string, selector?: string | null, attributes?: string[] | null): Promise<Record<string, any>[]>;
|
|
1332
|
+
browserExtractContent(sessionId?: string | null, url?: string | null, includeInteractive?: boolean, includeAnchors?: boolean, maxAnchors?: number): Promise<Record<string, any>>;
|
|
1333
|
+
/**
|
|
1334
|
+
* Download a file from the remote VM
|
|
1335
|
+
*/
|
|
1336
|
+
download(filename: string, options?: DownloadOptions): Promise<DownloadResult>;
|
|
1337
|
+
/**
|
|
1338
|
+
* Get the current session ID
|
|
1339
|
+
*/
|
|
1340
|
+
get sessionId(): string | null;
|
|
1341
|
+
/**
|
|
1342
|
+
* Kill the VM associated with a session
|
|
1343
|
+
*
|
|
1344
|
+
* @param sessionId - The session UUID whose VM should be killed. If not provided, uses current sessionId
|
|
1345
|
+
* @returns Result containing success message and killed VM ID
|
|
1346
|
+
*/
|
|
1347
|
+
kill(sessionId?: string): Promise<{
|
|
1348
|
+
success: boolean;
|
|
1349
|
+
killed: string;
|
|
1350
|
+
}>;
|
|
1351
|
+
/**
|
|
1352
|
+
* Set egress policy for a session
|
|
1353
|
+
*/
|
|
1354
|
+
setSessionEgress(options?: EgressPolicyOptions, sessionId?: string): Promise<{
|
|
1355
|
+
status: string;
|
|
1356
|
+
sessionId: string;
|
|
1357
|
+
}>;
|
|
1358
|
+
/**
|
|
1359
|
+
* Get egress policy for a session
|
|
1360
|
+
*/
|
|
1361
|
+
getSessionEgress(sessionId?: string): Promise<EgressPolicy>;
|
|
1362
|
+
/**
|
|
1363
|
+
* Set egress policy for a specific VM
|
|
1364
|
+
*/
|
|
1365
|
+
setVmEgress(vmId: string, options?: EgressPolicyOptions): Promise<{
|
|
1366
|
+
status: string;
|
|
1367
|
+
vmId: string;
|
|
1368
|
+
}>;
|
|
1369
|
+
/**
|
|
1370
|
+
* Get egress policy for a specific VM
|
|
1371
|
+
*/
|
|
1372
|
+
getVmEgress(vmId: string): Promise<EgressPolicy>;
|
|
1373
|
+
/**
|
|
1374
|
+
* Add an SSH public key
|
|
1375
|
+
*/
|
|
1376
|
+
addSshKey(publicKey: string): Promise<SSHKey>;
|
|
1377
|
+
/**
|
|
1378
|
+
* List all active SSH keys
|
|
1379
|
+
*/
|
|
1380
|
+
listSshKeys(): Promise<SSHKey[]>;
|
|
1381
|
+
/**
|
|
1382
|
+
* Delete an SSH key by ID
|
|
1383
|
+
*/
|
|
1384
|
+
deleteSshKey(keyId: number): Promise<{
|
|
1385
|
+
status: string;
|
|
1386
|
+
}>;
|
|
1387
|
+
/**
|
|
1388
|
+
* Clean up resources
|
|
1389
|
+
*/
|
|
1390
|
+
dispose(): Promise<void>;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
export { type CurrentUserResponse as $, APIKeysManager as A, BrowserManager as B, CustomDomainsManager as C, type DownloadOptions as D, type ExecuteOptions as E, type FileUpload as F, type ExtractOptions as G, type ExtractContentOptions as H, InstaVM as I, type ExtractedContent as J, type InteractiveElement as K, type ContentAnchor as L, type ApiResponse as M, type NavigateOptions as N, type HttpClientConfig as O, PTYManager as P, type RequestConfig as Q, RecordingsManager as R, SnapshotsManager as S, TapesManager as T, type UploadOptions as U, VMsManager as V, WebhooksManager as W, type RetryConfig as X, type EgressPolicy as Y, type EgressPolicyOptions as Z, type SSHKey as _, type InstaVMOptions as a, type WebhookEndpointUpdateRequest as a$, type SessionStatusResponse as a0, type TapeStartOptions as a1, type TapeListQuery as a2, type TapeEventsQuery as a3, type TapeAppendEventOptions as a4, type TapeBranchOptions as a5, type TapeRecord as a6, type TapeEvent as a7, type TapeLanesResponse as a8, type TapeDiffResponse as a9, type JsonMap$4 as aA, type VMCreateRequest as aB, type VMUpdateRequest as aC, type VMCloneRequest as aD, type VMSnapshotRequest as aE, type SnapshotBuildArgs as aF, type SnapshotCreateRequest as aG, type SnapshotQueryOptions as aH, type VolumeCreateRequest as aI, type VolumeUpdateRequest as aJ, type VolumeResponse as aK, type VolumeCheckpointCreateRequest as aL, type VolumeCheckpointResponse as aM, type VolumeFileEntry as aN, type VolumeFileDownloadResponse as aO, type VolumeFileUploadRequest as aP, type VolumeFileListQuery as aQ, type VMVolumeMountRequest as aR, type VMMountedVolumeResponse as aS, type ShareCreateRequest as aT, type ShareUpdateRequest as aU, type CustomDomainCreateRequest as aV, type ComputerUseProxyOptions as aW, type APIKey as aX, type APIKeyCreateRequest as aY, type AuditEventQuery as aZ, type WebhookEndpointCreateRequest as a_, type TapeBranchResponse as aa, type TapeExportBundle as ab, type VaultRecord as ac, type VaultCredential as ad, type VaultService as ae, type VaultRequestLog as af, type VaultDiscoverResponse as ag, type VaultCatalogTemplate as ah, type AddVaultCredentialOptions as ai, type AddVaultServiceOptions as aj, type UpdateVaultOptions as ak, type PTYCreateOptions as al, type PTYRecord as am, type RecordingListQuery as an, type RecordingRecord as ao, type RecordingDownloadResult as ap, type CreditAllocation as aq, type CreditCheckResponse as ar, type CreditForecastResponse as as, type CreditPeriod as at, type CreditRates as au, type CreditSummary as av, type CreditTrendsGranularity as aw, type CreditTrendsPeriod as ax, type CreditTrendsResponse as ay, type CreditUsageEntry as az, BrowserSession as b, type WebhookDeliveryQuery as b0, SharesManager as c, ComputerUseManager as d, AuditManager as e, VolumesManager as f, VaultsManager as g, CreditsManager as h, TapeContext as i, ToolCallRecorder as j, ToolCallSpan as k, type ExecutionResult as l, type AsyncExecutionResult as m, type UploadResult as n, type UsageStats as o, type DownloadResult as p, type BrowserSessionOptions as q, type BrowserSessionInfo as r, type NavigationResult as s, type ClickOptions as t, type TypeOptions as u, type FillOptions as v, type ScrollOptions as w, type ScreenshotOptions as x, type WaitCondition as y, type ExtractedElement as z };
|