agentkernel 0.19.0 → 0.20.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 +1 -1
- package/dist/browser.d.cts +67 -0
- package/dist/browser.d.ts +67 -0
- package/dist/client.d.cts +169 -0
- package/dist/client.d.ts +169 -0
- package/dist/config.d.cts +7 -0
- package/dist/config.d.ts +7 -0
- package/dist/errors.d.cts +34 -0
- package/dist/errors.d.ts +34 -0
- package/dist/index.cjs +338 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -520
- package/dist/index.d.ts +5 -520
- package/dist/index.js +337 -1
- package/dist/index.js.map +1 -1
- package/dist/sandbox.d.cts +39 -0
- package/dist/sandbox.d.ts +39 -0
- package/dist/sse.d.cts +8 -0
- package/dist/sse.d.ts +8 -0
- package/dist/types.d.cts +213 -0
- package/dist/types.d.ts +213 -0
- package/package.json +11 -9
package/dist/index.d.ts
CHANGED
|
@@ -1,520 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type StreamEventType = "started" | "progress" | "output" | "done" | "error";
|
|
7
|
-
/** Configuration options for the AgentKernel client. */
|
|
8
|
-
interface AgentKernelOptions {
|
|
9
|
-
/** Base URL of the agentkernel HTTP API. Default: AGENTKERNEL_BASE_URL or http://localhost:18888 */
|
|
10
|
-
baseUrl?: string;
|
|
11
|
-
/** API key for Bearer authentication. Default: AGENTKERNEL_API_KEY env var */
|
|
12
|
-
apiKey?: string;
|
|
13
|
-
/** Request timeout in milliseconds. Default: 30000 */
|
|
14
|
-
timeout?: number;
|
|
15
|
-
}
|
|
16
|
-
/** Options for the run command. */
|
|
17
|
-
interface RunOptions {
|
|
18
|
-
/** Docker image to use (auto-detected if not specified). */
|
|
19
|
-
image?: string;
|
|
20
|
-
/** Security profile. Default: moderate */
|
|
21
|
-
profile?: SecurityProfile;
|
|
22
|
-
/** Use container pool for faster execution. Default: true */
|
|
23
|
-
fast?: boolean;
|
|
24
|
-
}
|
|
25
|
-
/** Options for creating a sandbox. */
|
|
26
|
-
interface CreateSandboxOptions {
|
|
27
|
-
/** Docker image to use. Default: alpine:3.20 */
|
|
28
|
-
image?: string;
|
|
29
|
-
vcpus?: number;
|
|
30
|
-
memory_mb?: number;
|
|
31
|
-
profile?: SecurityProfile;
|
|
32
|
-
/** Git repository URL to clone into the sandbox. */
|
|
33
|
-
source_url?: string;
|
|
34
|
-
/** Git ref to checkout after cloning. */
|
|
35
|
-
source_ref?: string;
|
|
36
|
-
/** Volume mounts (slug:/path or slug:/path:ro). Create volumes via CLI first. */
|
|
37
|
-
volumes?: string[];
|
|
38
|
-
/**
|
|
39
|
-
* Secret bindings for proxy-based injection (Gondolin pattern).
|
|
40
|
-
* Secrets are injected as HTTP headers by the host proxy — they never enter the VM.
|
|
41
|
-
* Formats: "KEY=value:host", "KEY:host", "KEY:host:header"
|
|
42
|
-
*/
|
|
43
|
-
secrets?: string[];
|
|
44
|
-
/**
|
|
45
|
-
* Secret keys to inject as files at /run/agentkernel/secrets/KEY.
|
|
46
|
-
* Values are resolved from the secret vault.
|
|
47
|
-
*/
|
|
48
|
-
secret_files?: string[];
|
|
49
|
-
}
|
|
50
|
-
/** Options for executing a command in a sandbox. */
|
|
51
|
-
interface ExecOptions {
|
|
52
|
-
/** Environment variables (KEY=VALUE). */
|
|
53
|
-
env?: string[];
|
|
54
|
-
/** Working directory inside the container. */
|
|
55
|
-
workdir?: string;
|
|
56
|
-
/** Run as root. */
|
|
57
|
-
sudo?: boolean;
|
|
58
|
-
}
|
|
59
|
-
/** Output from a command execution. */
|
|
60
|
-
interface RunOutput {
|
|
61
|
-
output: string;
|
|
62
|
-
}
|
|
63
|
-
/** Information about a sandbox. */
|
|
64
|
-
interface SandboxInfo {
|
|
65
|
-
name: string;
|
|
66
|
-
uuid?: string;
|
|
67
|
-
status: SandboxStatus;
|
|
68
|
-
backend: string;
|
|
69
|
-
image?: string;
|
|
70
|
-
vcpus?: number;
|
|
71
|
-
memory_mb?: number;
|
|
72
|
-
created_at?: string;
|
|
73
|
-
}
|
|
74
|
-
/** SSE stream event. */
|
|
75
|
-
interface StreamEvent {
|
|
76
|
-
type: StreamEventType;
|
|
77
|
-
data: Record<string, unknown>;
|
|
78
|
-
}
|
|
79
|
-
/** Options for writing a file. */
|
|
80
|
-
interface FileWriteOptions {
|
|
81
|
-
/** Content encoding: "utf8" (default) or "base64". */
|
|
82
|
-
encoding?: "utf8" | "base64";
|
|
83
|
-
}
|
|
84
|
-
/** Response from reading a file. */
|
|
85
|
-
interface FileReadResponse {
|
|
86
|
-
content: string;
|
|
87
|
-
encoding: "utf8" | "base64";
|
|
88
|
-
size: number;
|
|
89
|
-
}
|
|
90
|
-
/** A command for batch execution. */
|
|
91
|
-
interface BatchCommand {
|
|
92
|
-
command: string[];
|
|
93
|
-
}
|
|
94
|
-
/** Result of a single batch command. */
|
|
95
|
-
interface BatchResult {
|
|
96
|
-
output: string | null;
|
|
97
|
-
error: string | null;
|
|
98
|
-
}
|
|
99
|
-
/** Response from batch execution. */
|
|
100
|
-
interface BatchRunResponse {
|
|
101
|
-
results: BatchResult[];
|
|
102
|
-
}
|
|
103
|
-
/** Result of a batch file write. */
|
|
104
|
-
interface BatchFileWriteResponse {
|
|
105
|
-
written: number;
|
|
106
|
-
}
|
|
107
|
-
/** Opaque orchestration payload/response body. */
|
|
108
|
-
type Orchestration = Record<string, unknown>;
|
|
109
|
-
type OrchestrationDefinition = Record<string, unknown>;
|
|
110
|
-
/** Opaque object payload/response body. */
|
|
111
|
-
type DurableObject = Record<string, unknown>;
|
|
112
|
-
/** Opaque schedule payload/response body. */
|
|
113
|
-
type Schedule = Record<string, unknown>;
|
|
114
|
-
/** Opaque durable store payload/response body. */
|
|
115
|
-
type DurableStore = Record<string, unknown>;
|
|
116
|
-
type CreateStoreRequest = Record<string, unknown>;
|
|
117
|
-
type DurableStoreQueryResponse = Record<string, unknown>;
|
|
118
|
-
type DurableStoreExecuteResponse = Record<string, unknown>;
|
|
119
|
-
type DurableStoreCommandResponse = Record<string, unknown>;
|
|
120
|
-
/** Status of a detached command. */
|
|
121
|
-
type DetachedStatus = "running" | "completed" | "failed";
|
|
122
|
-
/** A detached (background) command running in a sandbox. */
|
|
123
|
-
interface DetachedCommand {
|
|
124
|
-
id: string;
|
|
125
|
-
sandbox: string;
|
|
126
|
-
command: string[];
|
|
127
|
-
pid: number;
|
|
128
|
-
status: DetachedStatus;
|
|
129
|
-
exit_code: number | null;
|
|
130
|
-
started_at: string;
|
|
131
|
-
}
|
|
132
|
-
/** Response from detached command logs. */
|
|
133
|
-
interface DetachedLogsResponse {
|
|
134
|
-
stdout?: string;
|
|
135
|
-
stderr?: string;
|
|
136
|
-
}
|
|
137
|
-
/** Opaque payload used when creating orchestrations. */
|
|
138
|
-
type CreateOrchestrationRequest = Record<string, unknown>;
|
|
139
|
-
/** Opaque payload used when creating objects. */
|
|
140
|
-
type CreateObjectRequest = Record<string, unknown>;
|
|
141
|
-
/** Opaque payload used when creating schedules. */
|
|
142
|
-
type CreateScheduleRequest = Record<string, unknown>;
|
|
143
|
-
/** API response wrapper. */
|
|
144
|
-
interface ApiResponse<T> {
|
|
145
|
-
success: boolean;
|
|
146
|
-
data?: T;
|
|
147
|
-
error?: string;
|
|
148
|
-
}
|
|
149
|
-
/** Response from extending a sandbox's TTL. */
|
|
150
|
-
interface ExtendTtlResponse {
|
|
151
|
-
expires_at?: string;
|
|
152
|
-
}
|
|
153
|
-
/** Options for extending TTL. */
|
|
154
|
-
interface ExtendTtlOptions {
|
|
155
|
-
/** Duration string like "1h", "30m", "2d". */
|
|
156
|
-
by: string;
|
|
157
|
-
}
|
|
158
|
-
/** Metadata for a sandbox snapshot. */
|
|
159
|
-
interface SnapshotMeta {
|
|
160
|
-
name: string;
|
|
161
|
-
sandbox: string;
|
|
162
|
-
image_tag: string;
|
|
163
|
-
backend: string;
|
|
164
|
-
base_image?: string;
|
|
165
|
-
vcpus?: number;
|
|
166
|
-
memory_mb?: number;
|
|
167
|
-
created_at: string;
|
|
168
|
-
}
|
|
169
|
-
/** Options for taking a snapshot. */
|
|
170
|
-
interface TakeSnapshotOptions {
|
|
171
|
-
/** Name of the sandbox to snapshot. */
|
|
172
|
-
sandbox: string;
|
|
173
|
-
/** Optional snapshot name (auto-generated if not provided). */
|
|
174
|
-
name?: string;
|
|
175
|
-
}
|
|
176
|
-
/** A link extracted from a web page. */
|
|
177
|
-
interface PageLink {
|
|
178
|
-
text: string;
|
|
179
|
-
href: string;
|
|
180
|
-
}
|
|
181
|
-
/** Result of navigating to a web page. */
|
|
182
|
-
interface PageResult {
|
|
183
|
-
/** Page title. */
|
|
184
|
-
title: string;
|
|
185
|
-
/** Final URL after redirects. */
|
|
186
|
-
url: string;
|
|
187
|
-
/** Page body text (truncated to ~8KB). */
|
|
188
|
-
text: string;
|
|
189
|
-
/** First 50 links on the page. */
|
|
190
|
-
links: PageLink[];
|
|
191
|
-
}
|
|
192
|
-
/** ARIA accessibility tree snapshot of a web page (v2). */
|
|
193
|
-
interface AriaSnapshot {
|
|
194
|
-
/** ARIA tree as YAML. */
|
|
195
|
-
snapshot: string;
|
|
196
|
-
/** Current page URL. */
|
|
197
|
-
url: string;
|
|
198
|
-
/** Page title. */
|
|
199
|
-
title: string;
|
|
200
|
-
/** Available ref IDs (e.g. ["e1", "e2", ...]). */
|
|
201
|
-
refs: string[];
|
|
202
|
-
}
|
|
203
|
-
/** A browser interaction event for debugging and context recovery. */
|
|
204
|
-
interface BrowserEvent {
|
|
205
|
-
/** Monotonic sequence number. */
|
|
206
|
-
seq: number;
|
|
207
|
-
/** Event type (e.g. "page.navigated", "page.clicked"). */
|
|
208
|
-
type: string;
|
|
209
|
-
/** Page name. */
|
|
210
|
-
page: string;
|
|
211
|
-
/** ISO 8601 timestamp. */
|
|
212
|
-
ts: string;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Browser session for orchestrating headless browsers in sandboxes.
|
|
217
|
-
*
|
|
218
|
-
* Each method generates a self-contained Python/Playwright script,
|
|
219
|
-
* runs it inside the sandbox, and parses the JSON result.
|
|
220
|
-
*/
|
|
221
|
-
|
|
222
|
-
type RunInSandboxFn = (name: string, command: string[]) => Promise<RunOutput>;
|
|
223
|
-
type RemoveSandboxFn = (name: string) => Promise<void>;
|
|
224
|
-
/** Command to install Playwright + Chromium inside the sandbox. */
|
|
225
|
-
declare const BROWSER_SETUP_CMD: string[];
|
|
226
|
-
/**
|
|
227
|
-
* A sandboxed headless browser controlled from outside.
|
|
228
|
-
*
|
|
229
|
-
* The browser (Chromium via Playwright) runs inside an agentkernel sandbox.
|
|
230
|
-
* You call high-level methods; the SDK generates and runs scripts internally.
|
|
231
|
-
*
|
|
232
|
-
* @example
|
|
233
|
-
* ```ts
|
|
234
|
-
* await using browser = await client.browser("my-browser");
|
|
235
|
-
* const page = await browser.goto("https://example.com");
|
|
236
|
-
* console.log(page.title, page.links);
|
|
237
|
-
* ```
|
|
238
|
-
*/
|
|
239
|
-
declare class BrowserSession implements AsyncDisposable {
|
|
240
|
-
readonly name: string;
|
|
241
|
-
private _removed;
|
|
242
|
-
private _lastUrl;
|
|
243
|
-
private readonly _run;
|
|
244
|
-
private readonly _remove;
|
|
245
|
-
/** @internal */
|
|
246
|
-
constructor(name: string, runFn: RunInSandboxFn, removeFn: RemoveSandboxFn);
|
|
247
|
-
/** Navigate to a URL and return page data (title, text, links). */
|
|
248
|
-
goto(url: string): Promise<PageResult>;
|
|
249
|
-
/** Take a PNG screenshot. Returns a base64-encoded string. */
|
|
250
|
-
screenshot(url?: string): Promise<string>;
|
|
251
|
-
/** Run a JavaScript expression on a page and return the result. */
|
|
252
|
-
evaluate(expression: string, url?: string): Promise<unknown>;
|
|
253
|
-
/** Navigate to a URL and return an ARIA snapshot. */
|
|
254
|
-
open(url: string, page?: string): Promise<AriaSnapshot>;
|
|
255
|
-
/** Get the current ARIA snapshot without navigating. */
|
|
256
|
-
snapshot(page?: string): Promise<AriaSnapshot>;
|
|
257
|
-
/** Click an element by ref ID or CSS selector. Returns new snapshot. */
|
|
258
|
-
click(opts: {
|
|
259
|
-
ref?: string;
|
|
260
|
-
selector?: string;
|
|
261
|
-
page?: string;
|
|
262
|
-
}): Promise<AriaSnapshot>;
|
|
263
|
-
/** Fill an input by ref ID or CSS selector. Returns new snapshot. */
|
|
264
|
-
fill(value: string, opts: {
|
|
265
|
-
ref?: string;
|
|
266
|
-
selector?: string;
|
|
267
|
-
page?: string;
|
|
268
|
-
}): Promise<AriaSnapshot>;
|
|
269
|
-
/** Close a named page. */
|
|
270
|
-
closePage(page?: string): Promise<void>;
|
|
271
|
-
/** List active page names. */
|
|
272
|
-
listPages(): Promise<string[]>;
|
|
273
|
-
private _serverStarted;
|
|
274
|
-
private _ensureServer;
|
|
275
|
-
private _browserRequest;
|
|
276
|
-
/** Remove the sandbox. Idempotent. */
|
|
277
|
-
remove(): Promise<void>;
|
|
278
|
-
/** Auto-cleanup for `await using`. */
|
|
279
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
type ExecFn = (name: string, command: string[], opts?: ExecOptions) => Promise<RunOutput>;
|
|
283
|
-
type RemoveFn = (name: string) => Promise<void>;
|
|
284
|
-
type GetFn = (name: string) => Promise<SandboxInfo>;
|
|
285
|
-
type WriteFilesFn = (name: string, files: Record<string, string>) => Promise<BatchFileWriteResponse>;
|
|
286
|
-
/**
|
|
287
|
-
* A sandbox session that auto-removes the sandbox on dispose.
|
|
288
|
-
*
|
|
289
|
-
* Supports both explicit cleanup via remove() and automatic cleanup via
|
|
290
|
-
* Symbol.asyncDispose (TS 5.2+ `await using`).
|
|
291
|
-
*
|
|
292
|
-
* @example
|
|
293
|
-
* ```ts
|
|
294
|
-
* await using sb = await client.sandbox("test");
|
|
295
|
-
* await sb.exec(["echo", "hello"]);
|
|
296
|
-
* // sandbox auto-removed when scope exits
|
|
297
|
-
* ```
|
|
298
|
-
*/
|
|
299
|
-
declare class SandboxSession implements AsyncDisposable {
|
|
300
|
-
readonly name: string;
|
|
301
|
-
private _removed;
|
|
302
|
-
private readonly _execInSandbox;
|
|
303
|
-
private readonly _removeSandbox;
|
|
304
|
-
private readonly _getSandbox;
|
|
305
|
-
private readonly _writeFiles;
|
|
306
|
-
/** @internal */
|
|
307
|
-
constructor(name: string, execInSandbox: ExecFn, removeSandbox: RemoveFn, getSandbox: GetFn, writeFiles: WriteFilesFn);
|
|
308
|
-
/** Run a command in this sandbox. */
|
|
309
|
-
run(command: string[], opts?: ExecOptions): Promise<RunOutput>;
|
|
310
|
-
/** Get sandbox info. */
|
|
311
|
-
info(): Promise<SandboxInfo>;
|
|
312
|
-
/** Write multiple files in one request. */
|
|
313
|
-
writeFiles(files: Record<string, string>): Promise<BatchFileWriteResponse>;
|
|
314
|
-
/** Remove the sandbox. Idempotent. */
|
|
315
|
-
remove(): Promise<void>;
|
|
316
|
-
/** Auto-cleanup for `await using`. */
|
|
317
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
/**
|
|
321
|
-
* Client for the agentkernel HTTP API.
|
|
322
|
-
*
|
|
323
|
-
* @example
|
|
324
|
-
* ```ts
|
|
325
|
-
* const client = new AgentKernel();
|
|
326
|
-
* const result = await client.run(["echo", "hello"]);
|
|
327
|
-
* console.log(result.output); // "hello\n"
|
|
328
|
-
* ```
|
|
329
|
-
*/
|
|
330
|
-
declare class AgentKernel {
|
|
331
|
-
private readonly baseUrl;
|
|
332
|
-
private readonly apiKey;
|
|
333
|
-
private readonly timeout;
|
|
334
|
-
constructor(opts?: AgentKernelOptions);
|
|
335
|
-
/** Health check. Returns "ok" if the server is running. */
|
|
336
|
-
health(): Promise<string>;
|
|
337
|
-
/** Run a command in a temporary sandbox. */
|
|
338
|
-
run(command: string[], opts?: RunOptions): Promise<RunOutput>;
|
|
339
|
-
/**
|
|
340
|
-
* Run a command with SSE streaming output.
|
|
341
|
-
*
|
|
342
|
-
* @example
|
|
343
|
-
* ```ts
|
|
344
|
-
* for await (const event of client.runStream(["python3", "script.py"])) {
|
|
345
|
-
* if (event.type === "output") process.stdout.write(String(event.data.data));
|
|
346
|
-
* }
|
|
347
|
-
* ```
|
|
348
|
-
*/
|
|
349
|
-
runStream(command: string[], opts?: RunOptions): AsyncGenerator<StreamEvent>;
|
|
350
|
-
/** List all sandboxes. */
|
|
351
|
-
listSandboxes(): Promise<SandboxInfo[]>;
|
|
352
|
-
/** Create a new sandbox. */
|
|
353
|
-
createSandbox(name: string, opts?: CreateSandboxOptions): Promise<SandboxInfo>;
|
|
354
|
-
/** Get info about a sandbox. */
|
|
355
|
-
getSandbox(name: string): Promise<SandboxInfo>;
|
|
356
|
-
/** Get info about a sandbox by UUID. */
|
|
357
|
-
getSandboxByUuid(uuid: string): Promise<SandboxInfo>;
|
|
358
|
-
/** Remove a sandbox. */
|
|
359
|
-
removeSandbox(name: string): Promise<void>;
|
|
360
|
-
/** Run a command in an existing sandbox. */
|
|
361
|
-
execInSandbox(name: string, command: string[], opts?: ExecOptions): Promise<RunOutput>;
|
|
362
|
-
/** Read a file from a sandbox. */
|
|
363
|
-
readFile(name: string, path: string): Promise<FileReadResponse>;
|
|
364
|
-
/** Write a file to a sandbox. */
|
|
365
|
-
writeFile(name: string, path: string, content: string, opts?: FileWriteOptions): Promise<string>;
|
|
366
|
-
/** Delete a file from a sandbox. */
|
|
367
|
-
deleteFile(name: string, path: string): Promise<string>;
|
|
368
|
-
/** Get audit log entries for a sandbox. */
|
|
369
|
-
getSandboxLogs(name: string): Promise<Record<string, unknown>[]>;
|
|
370
|
-
/** Write multiple files to a sandbox in one request. */
|
|
371
|
-
writeFiles(name: string, files: Record<string, string>): Promise<BatchFileWriteResponse>;
|
|
372
|
-
/** Run multiple commands in parallel. */
|
|
373
|
-
batchRun(commands: BatchCommand[]): Promise<BatchRunResponse>;
|
|
374
|
-
/** Start a detached (background) command in a sandbox. */
|
|
375
|
-
execDetached(name: string, command: string[], opts?: ExecOptions): Promise<DetachedCommand>;
|
|
376
|
-
/** Get the status of a detached command. */
|
|
377
|
-
detachedStatus(name: string, cmdId: string): Promise<DetachedCommand>;
|
|
378
|
-
/** Get logs from a detached command. */
|
|
379
|
-
detachedLogs(name: string, cmdId: string, stream?: "stdout" | "stderr"): Promise<DetachedLogsResponse>;
|
|
380
|
-
/** Kill a detached command. */
|
|
381
|
-
detachedKill(name: string, cmdId: string): Promise<string>;
|
|
382
|
-
/** List detached commands in a sandbox. */
|
|
383
|
-
detachedList(name: string): Promise<DetachedCommand[]>;
|
|
384
|
-
/** List all orchestrations. */
|
|
385
|
-
listOrchestrations(): Promise<Orchestration[]>;
|
|
386
|
-
/** Create a new orchestration. */
|
|
387
|
-
createOrchestration(payload: CreateOrchestrationRequest): Promise<Orchestration>;
|
|
388
|
-
/** Get info about an orchestration by identifier. */
|
|
389
|
-
getOrchestration(id: string): Promise<Orchestration>;
|
|
390
|
-
/** Raise an external event for an orchestration. */
|
|
391
|
-
signalOrchestration(id: string, payload: Record<string, unknown>): Promise<Orchestration>;
|
|
392
|
-
/** Terminate an orchestration. */
|
|
393
|
-
terminateOrchestration(id: string, payload?: Record<string, unknown>): Promise<Orchestration>;
|
|
394
|
-
/** List orchestration definitions. */
|
|
395
|
-
listOrchestrationDefinitions(): Promise<OrchestrationDefinition[]>;
|
|
396
|
-
/** Register or update an orchestration definition. */
|
|
397
|
-
upsertOrchestrationDefinition(payload: OrchestrationDefinition): Promise<OrchestrationDefinition>;
|
|
398
|
-
/** Get an orchestration definition by name. */
|
|
399
|
-
getOrchestrationDefinition(name: string): Promise<OrchestrationDefinition>;
|
|
400
|
-
/** Delete an orchestration definition by name. */
|
|
401
|
-
deleteOrchestrationDefinition(name: string): Promise<string>;
|
|
402
|
-
/** List all objects. */
|
|
403
|
-
listObjects(): Promise<DurableObject[]>;
|
|
404
|
-
/** Create a new object. */
|
|
405
|
-
createObject(payload: CreateObjectRequest): Promise<DurableObject>;
|
|
406
|
-
/** Get an object by identifier. */
|
|
407
|
-
getObject(id: string): Promise<DurableObject>;
|
|
408
|
-
/** Call a method on a durable object (auto-creates/wakes if needed). */
|
|
409
|
-
callObject(className: string, objectId: string, method: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
410
|
-
/** Delete a durable object by identifier. */
|
|
411
|
-
deleteObject(id: string): Promise<string>;
|
|
412
|
-
/** Partially update a durable object (storage and/or status). */
|
|
413
|
-
patchObject(id: string, payload: {
|
|
414
|
-
storage?: unknown;
|
|
415
|
-
status?: string;
|
|
416
|
-
}): Promise<DurableObject>;
|
|
417
|
-
/** List all schedules. */
|
|
418
|
-
listSchedules(): Promise<Schedule[]>;
|
|
419
|
-
/** Create a new schedule. */
|
|
420
|
-
createSchedule(payload: CreateScheduleRequest): Promise<Schedule>;
|
|
421
|
-
/** Get a schedule by identifier. */
|
|
422
|
-
getSchedule(id: string): Promise<Schedule>;
|
|
423
|
-
/** Delete a schedule by identifier. */
|
|
424
|
-
deleteSchedule(id: string): Promise<string>;
|
|
425
|
-
/** List all durable stores. */
|
|
426
|
-
listStores(): Promise<DurableStore[]>;
|
|
427
|
-
/** Create a durable store. */
|
|
428
|
-
createStore(payload: CreateStoreRequest): Promise<DurableStore>;
|
|
429
|
-
/** Get a durable store by identifier. */
|
|
430
|
-
getStore(id: string): Promise<DurableStore>;
|
|
431
|
-
/** Delete a durable store by identifier. */
|
|
432
|
-
deleteStore(id: string): Promise<string>;
|
|
433
|
-
/** Execute a read query against a durable store. */
|
|
434
|
-
queryStore(id: string, payload: Record<string, unknown>): Promise<DurableStoreQueryResponse>;
|
|
435
|
-
/** Execute a write statement against a durable store. */
|
|
436
|
-
executeStore(id: string, payload: Record<string, unknown>): Promise<DurableStoreExecuteResponse>;
|
|
437
|
-
/** Execute a command against a durable store (Redis-style engines). */
|
|
438
|
-
commandStore(id: string, payload: Record<string, unknown>): Promise<DurableStoreCommandResponse>;
|
|
439
|
-
/**
|
|
440
|
-
* Create a sandbox session with automatic cleanup.
|
|
441
|
-
*
|
|
442
|
-
* The returned SandboxSession implements AsyncDisposable,
|
|
443
|
-
* so it works with `await using` (TS 5.2+):
|
|
444
|
-
*
|
|
445
|
-
* @example
|
|
446
|
-
* ```ts
|
|
447
|
-
* await using sb = await client.sandbox("test", { image: "python:3.12-alpine" });
|
|
448
|
-
* await sb.run(["pip", "install", "numpy"]);
|
|
449
|
-
* // sandbox auto-removed when scope exits
|
|
450
|
-
* ```
|
|
451
|
-
*/
|
|
452
|
-
sandbox(name: string, opts?: CreateSandboxOptions): Promise<SandboxSession>;
|
|
453
|
-
/**
|
|
454
|
-
* Create a sandboxed browser session with automatic cleanup.
|
|
455
|
-
*
|
|
456
|
-
* Creates a sandbox with Chromium pre-installed via Playwright.
|
|
457
|
-
* Use `goto()`, `screenshot()`, and `evaluate()` to interact with web pages.
|
|
458
|
-
*
|
|
459
|
-
* @example
|
|
460
|
-
* ```ts
|
|
461
|
-
* await using browser = await client.browser("my-browser");
|
|
462
|
-
* const page = await browser.goto("https://example.com");
|
|
463
|
-
* console.log(page.title, page.links);
|
|
464
|
-
* // sandbox auto-removed when scope exits
|
|
465
|
-
* ```
|
|
466
|
-
*/
|
|
467
|
-
browser(name: string, opts?: {
|
|
468
|
-
memory_mb?: number;
|
|
469
|
-
}): Promise<BrowserSession>;
|
|
470
|
-
/** Extend a sandbox's TTL. Returns the new expiry time. */
|
|
471
|
-
extendTtl(name: string, opts: ExtendTtlOptions): Promise<ExtendTtlResponse>;
|
|
472
|
-
/** List all snapshots. */
|
|
473
|
-
listSnapshots(): Promise<SnapshotMeta[]>;
|
|
474
|
-
/** Take a snapshot of a sandbox. */
|
|
475
|
-
takeSnapshot(opts: TakeSnapshotOptions): Promise<SnapshotMeta>;
|
|
476
|
-
/** Get info about a snapshot. */
|
|
477
|
-
getSnapshot(name: string): Promise<SnapshotMeta>;
|
|
478
|
-
/** Delete a snapshot. */
|
|
479
|
-
deleteSnapshot(name: string): Promise<void>;
|
|
480
|
-
/** Restore a sandbox from a snapshot. */
|
|
481
|
-
restoreSnapshot(name: string): Promise<SandboxInfo>;
|
|
482
|
-
private headers;
|
|
483
|
-
private fetch;
|
|
484
|
-
private request;
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
/** Base error for all agentkernel SDK errors. */
|
|
488
|
-
declare class AgentKernelError extends Error {
|
|
489
|
-
constructor(message: string);
|
|
490
|
-
}
|
|
491
|
-
/** 401 Unauthorized. */
|
|
492
|
-
declare class AuthError extends AgentKernelError {
|
|
493
|
-
readonly status = 401;
|
|
494
|
-
constructor(message?: string);
|
|
495
|
-
}
|
|
496
|
-
/** 404 Not Found. */
|
|
497
|
-
declare class NotFoundError extends AgentKernelError {
|
|
498
|
-
readonly status = 404;
|
|
499
|
-
constructor(message?: string);
|
|
500
|
-
}
|
|
501
|
-
/** 400 Bad Request. */
|
|
502
|
-
declare class ValidationError extends AgentKernelError {
|
|
503
|
-
readonly status = 400;
|
|
504
|
-
constructor(message?: string);
|
|
505
|
-
}
|
|
506
|
-
/** 500 Internal Server Error. */
|
|
507
|
-
declare class ServerError extends AgentKernelError {
|
|
508
|
-
readonly status = 500;
|
|
509
|
-
constructor(message?: string);
|
|
510
|
-
}
|
|
511
|
-
/** Network / connection error. */
|
|
512
|
-
declare class NetworkError extends AgentKernelError {
|
|
513
|
-
constructor(message?: string);
|
|
514
|
-
}
|
|
515
|
-
/** SSE streaming error. */
|
|
516
|
-
declare class StreamError extends AgentKernelError {
|
|
517
|
-
constructor(message?: string);
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
export { AgentKernel, AgentKernelError, type AgentKernelOptions, type ApiResponse, type AriaSnapshot, AuthError, BROWSER_SETUP_CMD, type BatchFileWriteResponse, type BrowserEvent, BrowserSession, type CreateObjectRequest, type CreateOrchestrationRequest, type CreateSandboxOptions, type CreateScheduleRequest, type CreateStoreRequest, type DetachedCommand, type DetachedLogsResponse, type DetachedStatus, type DurableObject, type DurableStore, type DurableStoreCommandResponse, type DurableStoreExecuteResponse, type DurableStoreQueryResponse, type ExecOptions, type ExtendTtlOptions, type ExtendTtlResponse, NetworkError, NotFoundError, type Orchestration, type OrchestrationDefinition, type PageLink, type PageResult, type RunOptions, type RunOutput, type SandboxInfo, SandboxSession, type SandboxStatus, type Schedule, type SecurityProfile, ServerError, type SnapshotMeta, StreamError, type StreamEvent, type StreamEventType, type TakeSnapshotOptions, ValidationError };
|
|
1
|
+
export { AgentKernel } from "./client.js";
|
|
2
|
+
export { BrowserSession, BROWSER_SETUP_CMD } from "./browser.js";
|
|
3
|
+
export { SandboxSession } from "./sandbox.js";
|
|
4
|
+
export { AgentKernelError, AuthError, NotFoundError, ValidationError, ServerError, NetworkError, StreamError, } from "./errors.js";
|
|
5
|
+
export type { AgentKernelOptions, AriaSnapshot, BatchFileWriteResponse, BrowserEvent, CreateSandboxOptions, CreateObjectRequest, CreateOrchestrationRequest, CreateScheduleRequest, CreateStoreRequest, DetachedCommand, DetachedLogsResponse, DetachedStatus, ExecOptions, ExtendTtlOptions, ExtendTtlResponse, DurableObject, DurableStore, DurableStoreCommandResponse, DurableStoreExecuteResponse, DurableStoreQueryResponse, PageLink, PageResult, RunOptions, RunOutput, Orchestration, OrchestrationDefinition, SandboxInfo, SnapshotMeta, StreamEvent, StreamEventType, SecurityProfile, SandboxStatus, Schedule, TakeSnapshotOptions, ApiResponse, } from "./types.js";
|