@douglas-agent/sandbank-boxlite 0.6.1

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,138 @@
1
+ /** Remote mode: connect to a BoxRun REST API */
2
+ export interface BoxLiteRemoteConfig {
3
+ mode?: 'remote';
4
+ /** BoxRun REST API base URL, e.g. 'http://localhost:8090' */
5
+ apiUrl: string;
6
+ /** Multi-tenant prefix (e.g. 'default') */
7
+ prefix?: string;
8
+ /** Bearer token (if already obtained) */
9
+ apiToken?: string;
10
+ /** OAuth2 client ID (for automatic token acquisition) */
11
+ clientId?: string;
12
+ /** OAuth2 client secret (for automatic token acquisition) */
13
+ clientSecret?: string;
14
+ }
15
+ /** Local mode: use boxlite Python SDK directly on this machine */
16
+ export interface BoxLiteLocalConfig {
17
+ mode: 'local';
18
+ /** Path to Python 3.10+ interpreter (default: 'python3') */
19
+ pythonPath?: string;
20
+ /** BoxLite home directory (default: '~/.boxlite') */
21
+ boxliteHome?: string;
22
+ }
23
+ /** BoxLite adapter configuration — remote (BoxRun REST API) or local (Python SDK) */
24
+ export type BoxLiteAdapterConfig = BoxLiteRemoteConfig | BoxLiteLocalConfig;
25
+ export interface BoxLiteClient {
26
+ createBox(params: BoxLiteCreateParams): Promise<BoxLiteBox>;
27
+ getBox(boxId: string): Promise<BoxLiteBox>;
28
+ listBoxes(status?: string, pageSize?: number): Promise<BoxLiteBox[]>;
29
+ deleteBox(boxId: string, force?: boolean): Promise<void>;
30
+ startBox(boxId: string): Promise<void>;
31
+ stopBox(boxId: string): Promise<void>;
32
+ exec(boxId: string, req: BoxLiteExecRequest): Promise<{
33
+ stdout: string;
34
+ stderr: string;
35
+ exitCode: number;
36
+ }>;
37
+ execStream(boxId: string, req: BoxLiteExecRequest): Promise<ReadableStream<Uint8Array>>;
38
+ uploadFiles(boxId: string, path: string, tarData: Uint8Array): Promise<void>;
39
+ downloadFiles(boxId: string, path: string): Promise<ReadableStream<Uint8Array>>;
40
+ createSnapshot(boxId: string, name: string): Promise<BoxLiteSnapshot>;
41
+ restoreSnapshot(boxId: string, name: string): Promise<void>;
42
+ listSnapshots(boxId: string): Promise<BoxLiteSnapshot[]>;
43
+ deleteSnapshot(boxId: string, name: string): Promise<void>;
44
+ cloneBox(boxId: string, name?: string): Promise<BoxLiteBox>;
45
+ exportBox?(boxId: string): Promise<ReadableStream<Uint8Array>>;
46
+ importBox?(data: Uint8Array): Promise<BoxLiteBox>;
47
+ execAsync?(boxId: string, req: BoxLiteExecRequest): Promise<BoxLiteExecution>;
48
+ getExecOutput?(boxId: string, execId: string): Promise<ReadableStream<Uint8Array>>;
49
+ sendExecInput?(boxId: string, execId: string, data: string): Promise<void>;
50
+ signalExec?(boxId: string, execId: string, signal: number): Promise<void>;
51
+ resizeExec?(boxId: string, execId: string, cols: number, rows: number): Promise<void>;
52
+ getMetrics?(): Promise<Record<string, unknown>>;
53
+ getBoxMetrics?(boxId: string): Promise<Record<string, unknown>>;
54
+ getConfig?(): Promise<Record<string, unknown>>;
55
+ /** Dispose of the client (cleanup subprocess, etc.) */
56
+ dispose?(): Promise<void>;
57
+ }
58
+ export interface BoxLiteBox {
59
+ id: string;
60
+ boxlite_id?: string;
61
+ name: string | null;
62
+ status: BoxStatus;
63
+ created_at: string;
64
+ started_at?: string | null;
65
+ stopped_at?: string | null;
66
+ image: string;
67
+ cpu: number;
68
+ memory_mb: number;
69
+ disk_size_gb?: number;
70
+ workdir?: string;
71
+ env?: Record<string, string> | null;
72
+ network?: boolean | BoxLiteNetworkConfig;
73
+ error_code?: string | null;
74
+ error_message?: string | null;
75
+ volumes?: unknown;
76
+ }
77
+ export type BoxStatus = 'configured' | 'running' | 'stopping' | 'stopped' | 'paused' | 'unknown';
78
+ export interface BoxLiteExecRequest {
79
+ cmd: string[];
80
+ env?: Record<string, string>;
81
+ timeout_seconds?: number;
82
+ working_dir?: string;
83
+ tty?: boolean;
84
+ }
85
+ export interface BoxLiteExecution {
86
+ id: string;
87
+ box_id?: string;
88
+ cmd?: string[];
89
+ status: string;
90
+ exit_code: number | null;
91
+ stdout?: string;
92
+ stderr?: string;
93
+ }
94
+ export interface BoxLiteSnapshot {
95
+ id: string;
96
+ box_id: string;
97
+ name: string;
98
+ created_at: number;
99
+ size_bytes: number;
100
+ guest_disk_bytes?: number;
101
+ container_disk_bytes?: number;
102
+ }
103
+ export interface BoxLiteNetworkConfig {
104
+ mode: 'enabled' | 'disabled';
105
+ allow_net?: string[];
106
+ }
107
+ export interface BoxLiteSecretSpec {
108
+ name: string;
109
+ value: string;
110
+ target?: string;
111
+ }
112
+ export interface BoxLiteCreateParams {
113
+ image?: string;
114
+ /** Path to a local OCI layout directory. When set, overrides `image` (no registry pull). */
115
+ rootfs_path?: string;
116
+ name?: string;
117
+ cpu?: number;
118
+ memory_mb?: number;
119
+ disk_size_gb?: number;
120
+ working_dir?: string;
121
+ env?: Record<string, string>;
122
+ auto_remove?: boolean;
123
+ security?: string;
124
+ /** Port mappings [hostPort, guestPort][] for local mode */
125
+ ports?: [number, number][];
126
+ network?: BoxLiteNetworkConfig;
127
+ secrets?: BoxLiteSecretSpec[];
128
+ entrypoint?: string;
129
+ cmd?: string[];
130
+ user?: string;
131
+ labels?: Record<string, string>;
132
+ }
133
+ export interface BoxLiteTokenResponse {
134
+ access_token: string;
135
+ token_type: string;
136
+ expires_in: number;
137
+ }
138
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAA;IACd,2CAA2C;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,M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MAAM,CAAA;IACd,4FAA4F;IAC5F,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;IAC1B,OAAO,CAAC,EAAE,oBAAoB,CAAA;IAC9B,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ // --- Adapter configuration (discriminated union) ---
2
+ export {};
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@douglas-agent/sandbank-boxlite",
3
+ "version": "0.6.1",
4
+ "description": "BoxLite bare-metal sandbox adapter for Sandbank",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "homepage": "https://sandbank.dev",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/Xeonice/sandbank-douglas-agent.git",
11
+ "directory": "packages/boxlite"
12
+ },
13
+ "keywords": [
14
+ "sandbox",
15
+ "ai-agent",
16
+ "boxlite",
17
+ "bare-metal",
18
+ "kvm"
19
+ ],
20
+ "exports": {
21
+ ".": {
22
+ "types": "./dist/index.d.ts",
23
+ "import": "./dist/index.js"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "scripts": {
30
+ "build": "tsc",
31
+ "typecheck": "tsc --noEmit",
32
+ "clean": "rm -rf dist"
33
+ },
34
+ "dependencies": {
35
+ "@douglas-agent/sandbank-core": "^0.3.6"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^25.3.0",
39
+ "typescript": "^5.7.3"
40
+ }
41
+ }