@arker-ai/sdk 0.5.2 → 0.6.3

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.
@@ -0,0 +1,37 @@
1
+ import { U as UniversalSandbox } from './common-C5zJ-LkS.cjs';
2
+ import { A as ArkerComputeProviderConfig } from './arker-provider-DwUib5ZW.cjs';
3
+ import 'computesdk';
4
+ import './index.cjs';
5
+
6
+ interface DaytonaCompatConfig {
7
+ /** Daytona API key used only for native Daytona fallback. */
8
+ apiKey?: string;
9
+ /** Arker provider options. Falls back to ARKER_* environment variables. */
10
+ arker?: ArkerComputeProviderConfig;
11
+ }
12
+ interface ExecuteResponse {
13
+ exitCode: number;
14
+ /** Daytona returns stdout as `result`. */
15
+ result: string;
16
+ stdout: string;
17
+ stderr: string;
18
+ }
19
+ declare class Sandbox {
20
+ #private;
21
+ readonly id: string;
22
+ readonly process: {
23
+ exec: (command: string) => Promise<ExecuteResponse>;
24
+ executeCommand: (command: string) => Promise<ExecuteResponse>;
25
+ };
26
+ constructor(box: UniversalSandbox);
27
+ delete(): Promise<void>;
28
+ }
29
+ declare class Daytona {
30
+ #private;
31
+ constructor(config?: DaytonaCompatConfig);
32
+ create(params?: Record<string, unknown>): Promise<Sandbox>;
33
+ get(sandboxId: string): Promise<Sandbox>;
34
+ delete(sandbox: string | Sandbox): Promise<void>;
35
+ }
36
+
37
+ export { Daytona, type DaytonaCompatConfig, type ExecuteResponse, Sandbox };
@@ -0,0 +1,37 @@
1
+ import { U as UniversalSandbox } from './common-C5zJ-LkS.js';
2
+ import { A as ArkerComputeProviderConfig } from './arker-provider-BNIL8NdM.js';
3
+ import 'computesdk';
4
+ import './index.js';
5
+
6
+ interface DaytonaCompatConfig {
7
+ /** Daytona API key used only for native Daytona fallback. */
8
+ apiKey?: string;
9
+ /** Arker provider options. Falls back to ARKER_* environment variables. */
10
+ arker?: ArkerComputeProviderConfig;
11
+ }
12
+ interface ExecuteResponse {
13
+ exitCode: number;
14
+ /** Daytona returns stdout as `result`. */
15
+ result: string;
16
+ stdout: string;
17
+ stderr: string;
18
+ }
19
+ declare class Sandbox {
20
+ #private;
21
+ readonly id: string;
22
+ readonly process: {
23
+ exec: (command: string) => Promise<ExecuteResponse>;
24
+ executeCommand: (command: string) => Promise<ExecuteResponse>;
25
+ };
26
+ constructor(box: UniversalSandbox);
27
+ delete(): Promise<void>;
28
+ }
29
+ declare class Daytona {
30
+ #private;
31
+ constructor(config?: DaytonaCompatConfig);
32
+ create(params?: Record<string, unknown>): Promise<Sandbox>;
33
+ get(sandboxId: string): Promise<Sandbox>;
34
+ delete(sandbox: string | Sandbox): Promise<void>;
35
+ }
36
+
37
+ export { Daytona, type DaytonaCompatConfig, type ExecuteResponse, Sandbox };
@@ -0,0 +1,65 @@
1
+ import {
2
+ assertSupportedObjectKeys,
3
+ createCompatSdk,
4
+ guardUnsupported
5
+ } from "./chunk-35IEV6BU.js";
6
+ import "./chunk-7BHPVQNG.js";
7
+
8
+ // src/daytona.ts
9
+ import { daytona as createDaytonaProvider } from "@computesdk/daytona";
10
+ var DAYTONA_CONFIG_KEYS = ["apiKey", "arker"];
11
+ var DAYTONA_CREATE_OPTION_KEYS = [];
12
+ var Sandbox = class {
13
+ id;
14
+ #box;
15
+ process;
16
+ constructor(box) {
17
+ this.#box = box;
18
+ this.id = box.sandboxId;
19
+ const run = async (command) => {
20
+ const result = await this.#box.runCommand(command);
21
+ return {
22
+ exitCode: result.exitCode,
23
+ result: result.stdout,
24
+ stdout: result.stdout,
25
+ stderr: result.stderr
26
+ };
27
+ };
28
+ this.process = {
29
+ exec: run,
30
+ executeCommand: run
31
+ };
32
+ }
33
+ async delete() {
34
+ await this.#box.destroy();
35
+ }
36
+ };
37
+ var Daytona = class {
38
+ #sdk;
39
+ constructor(config) {
40
+ assertSupportedObjectKeys(config, DAYTONA_CONFIG_KEYS, "daytona", "new Daytona");
41
+ this.#sdk = createCompatSdk({
42
+ arker: config?.arker,
43
+ fallbackProvider: createDaytonaProvider({ apiKey: config?.apiKey })
44
+ });
45
+ return guardUnsupported(this, "daytona");
46
+ }
47
+ async create(params) {
48
+ assertSupportedObjectKeys(params, DAYTONA_CREATE_OPTION_KEYS, "daytona", "Daytona.create");
49
+ const box = await this.#sdk.sandbox.create({});
50
+ return guardUnsupported(new Sandbox(box), "daytona");
51
+ }
52
+ async get(sandboxId) {
53
+ const box = await this.#sdk.sandbox.getById(sandboxId);
54
+ if (!box) throw new Error(`Sandbox ${sandboxId} not found`);
55
+ return guardUnsupported(new Sandbox(box), "daytona");
56
+ }
57
+ async delete(sandbox) {
58
+ const target = typeof sandbox === "string" ? await this.get(sandbox) : sandbox;
59
+ await target.delete();
60
+ }
61
+ };
62
+ export {
63
+ Daytona,
64
+ Sandbox
65
+ };