@alibaba-group/opensandbox 0.1.0-dev1

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.
Files changed (92) hide show
  1. package/README.md +212 -0
  2. package/dist/adapters/commandsAdapter.d.ts +22 -0
  3. package/dist/adapters/commandsAdapter.d.ts.map +1 -0
  4. package/dist/adapters/commandsAdapter.js +76 -0
  5. package/dist/adapters/filesystemAdapter.d.ts +52 -0
  6. package/dist/adapters/filesystemAdapter.d.ts.map +1 -0
  7. package/dist/adapters/filesystemAdapter.js +398 -0
  8. package/dist/adapters/healthAdapter.d.ts +8 -0
  9. package/dist/adapters/healthAdapter.d.ts.map +1 -0
  10. package/dist/adapters/healthAdapter.js +25 -0
  11. package/dist/adapters/metricsAdapter.d.ts +9 -0
  12. package/dist/adapters/metricsAdapter.d.ts.map +1 -0
  13. package/dist/adapters/metricsAdapter.js +43 -0
  14. package/dist/adapters/openapiError.d.ts +5 -0
  15. package/dist/adapters/openapiError.d.ts.map +1 -0
  16. package/dist/adapters/openapiError.js +33 -0
  17. package/dist/adapters/sandboxesAdapter.d.ts +18 -0
  18. package/dist/adapters/sandboxesAdapter.d.ts.map +1 -0
  19. package/dist/adapters/sandboxesAdapter.js +146 -0
  20. package/dist/adapters/sse.d.ts +9 -0
  21. package/dist/adapters/sse.d.ts.map +1 -0
  22. package/dist/adapters/sse.js +84 -0
  23. package/dist/api/execd.d.ts +1555 -0
  24. package/dist/api/execd.d.ts.map +1 -0
  25. package/dist/api/execd.js +14 -0
  26. package/dist/api/lifecycle.d.ts +787 -0
  27. package/dist/api/lifecycle.d.ts.map +1 -0
  28. package/dist/api/lifecycle.js +14 -0
  29. package/dist/config/connection.d.ts +58 -0
  30. package/dist/config/connection.d.ts.map +1 -0
  31. package/dist/config/connection.js +171 -0
  32. package/dist/core/constants.d.ts +9 -0
  33. package/dist/core/constants.d.ts.map +1 -0
  34. package/dist/core/constants.js +24 -0
  35. package/dist/core/exceptions.d.ts +74 -0
  36. package/dist/core/exceptions.d.ts.map +1 -0
  37. package/dist/core/exceptions.js +103 -0
  38. package/dist/factory/adapterFactory.d.ts +33 -0
  39. package/dist/factory/adapterFactory.d.ts.map +1 -0
  40. package/dist/factory/adapterFactory.js +14 -0
  41. package/dist/factory/defaultAdapterFactory.d.ts +7 -0
  42. package/dist/factory/defaultAdapterFactory.d.ts.map +1 -0
  43. package/dist/factory/defaultAdapterFactory.js +61 -0
  44. package/dist/index.d.ts +22 -0
  45. package/dist/index.d.ts.map +1 -0
  46. package/dist/index.js +20 -0
  47. package/dist/internal.d.ts +22 -0
  48. package/dist/internal.d.ts.map +1 -0
  49. package/dist/internal.js +30 -0
  50. package/dist/manager.d.ts +40 -0
  51. package/dist/manager.d.ts.map +1 -0
  52. package/dist/manager.js +71 -0
  53. package/dist/models/execd.d.ts +54 -0
  54. package/dist/models/execd.d.ts.map +1 -0
  55. package/dist/models/execd.js +14 -0
  56. package/dist/models/execution.d.ts +52 -0
  57. package/dist/models/execution.d.ts.map +1 -0
  58. package/dist/models/execution.js +14 -0
  59. package/dist/models/executionEventDispatcher.d.ts +15 -0
  60. package/dist/models/executionEventDispatcher.d.ts.map +1 -0
  61. package/dist/models/executionEventDispatcher.js +95 -0
  62. package/dist/models/filesystem.d.ts +77 -0
  63. package/dist/models/filesystem.d.ts.map +1 -0
  64. package/dist/models/filesystem.js +14 -0
  65. package/dist/models/sandboxes.d.ts +105 -0
  66. package/dist/models/sandboxes.d.ts.map +1 -0
  67. package/dist/models/sandboxes.js +15 -0
  68. package/dist/openapi/execdClient.d.ts +25 -0
  69. package/dist/openapi/execdClient.d.ts.map +1 -0
  70. package/dist/openapi/execdClient.js +21 -0
  71. package/dist/openapi/lifecycleClient.d.ts +28 -0
  72. package/dist/openapi/lifecycleClient.d.ts.map +1 -0
  73. package/dist/openapi/lifecycleClient.js +35 -0
  74. package/dist/sandbox.d.ts +132 -0
  75. package/dist/sandbox.d.ts.map +1 -0
  76. package/dist/sandbox.js +250 -0
  77. package/dist/services/execdCommands.d.ts +19 -0
  78. package/dist/services/execdCommands.d.ts.map +1 -0
  79. package/dist/services/execdCommands.js +14 -0
  80. package/dist/services/execdHealth.d.ts +4 -0
  81. package/dist/services/execdHealth.d.ts.map +1 -0
  82. package/dist/services/execdHealth.js +14 -0
  83. package/dist/services/execdMetrics.d.ts +5 -0
  84. package/dist/services/execdMetrics.d.ts.map +1 -0
  85. package/dist/services/execdMetrics.js +14 -0
  86. package/dist/services/filesystem.d.ts +30 -0
  87. package/dist/services/filesystem.d.ts.map +1 -0
  88. package/dist/services/filesystem.js +14 -0
  89. package/dist/services/sandboxes.d.ts +12 -0
  90. package/dist/services/sandboxes.d.ts.map +1 -0
  91. package/dist/services/sandboxes.js +14 -0
  92. package/package.json +52 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/api/lifecycle.ts"],"names":[],"mappings":"AAcA;;;GAGG;AAEH,MAAM,WAAW,KAAK;IAClB,YAAY,EAAE;QACV,UAAU,EAAE;YACR,KAAK,CAAC,EAAE,KAAK,CAAC;YACd,MAAM,CAAC,EAAE,KAAK,CAAC;YACf,IAAI,CAAC,EAAE,KAAK,CAAC;YACb,MAAM,CAAC,EAAE,KAAK,CAAC;SAClB,CAAC;QACF;;;;WAIG;QACH,GAAG,EAAE;YACD,UAAU,EAAE;gBACR,KAAK,CAAC,EAAE;oBACJ;;;uBAGG;oBACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;oBACjB;;;uBAGG;oBACH,QAAQ,CAAC,EAAE,MAAM,CAAC;oBAClB,8CAA8C;oBAC9C,IAAI,CAAC,EAAE,MAAM,CAAC;oBACd,4CAA4C;oBAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;iBACrB,CAAC;gBACF,MAAM,CAAC,EAAE,KAAK,CAAC;gBACf,IAAI,CAAC,EAAE,KAAK,CAAC;gBACb,MAAM,CAAC,EAAE,KAAK,CAAC;aAClB,CAAC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CAAC,CAAC;aAC9D,CAAC;SACL,CAAC;QACF,uDAAuD;QACvD,mBAAmB,EAAE;YACjB,OAAO,EAAE;gBACL,cAAc,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,YAAY,CAAC,CAAC;gBACpD,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;aAC3B,CAAC;YACF,OAAO,EAAE;gBACL,kBAAkB,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC,eAAe,CAAC,CAAC;aAC9D,CAAC;SACL,CAAC;KACL,CAAC;IACF,UAAU,EAAE;QACR,6CAA6C;QAC7C,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,aAAa,EAAE,KAAK,CAAC;IACrB,OAAO,EAAE;QACL,yDAAyD;QACzD,UAAU,EAAE,MAAM,CAAC;QACnB,gEAAgE;QAChE,QAAQ,EAAE,MAAM,CAAC;QACjB,8DAA8D;QAC9D,UAAU,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,SAAS,EAAE,KAAK,CAAC;CACpB;AACD,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC1C,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ // Copyright 2026 Alibaba Group Holding Ltd..
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ export {};
@@ -0,0 +1,58 @@
1
+ export type ConnectionProtocol = "http" | "https";
2
+ /**
3
+ * Options for {@link ConnectionConfig}.
4
+ *
5
+ * Most users only need `domain`, `protocol`, and `apiKey`.
6
+ */
7
+ export interface ConnectionConfigOptions {
8
+ /**
9
+ * API server domain (host[:port]) without scheme.
10
+ * Examples:
11
+ * - "localhost:8080"
12
+ * - "api.opensandbox.io"
13
+ *
14
+ * You may also pass a full URL (e.g. "http://localhost:8080" or "https://api.example.com").
15
+ * If the URL includes a path, it will be preserved and `/v1` will be appended automatically.
16
+ */
17
+ domain?: string;
18
+ protocol?: ConnectionProtocol;
19
+ apiKey?: string;
20
+ headers?: Record<string, string>;
21
+ /**
22
+ * Request timeout applied to all SDK HTTP calls (best-effort; wraps fetch).
23
+ * Defaults to 30 seconds.
24
+ */
25
+ requestTimeoutSeconds?: number;
26
+ /**
27
+ * Enable basic debug logging for HTTP requests (best-effort).
28
+ */
29
+ debug?: boolean;
30
+ }
31
+ export declare class ConnectionConfig {
32
+ readonly protocol: ConnectionProtocol;
33
+ readonly domain: string;
34
+ readonly apiKey?: string;
35
+ readonly headers: Record<string, string>;
36
+ readonly fetch: typeof fetch;
37
+ /**
38
+ * Fetch function intended for long-lived streaming requests (SSE).
39
+ *
40
+ * This is separate from {@link fetch} so callers can supply a different implementation
41
+ * (e.g. Node undici with bodyTimeout disabled) and so the SDK can apply distinct
42
+ * timeout semantics for streaming vs normal HTTP calls.
43
+ */
44
+ readonly sseFetch: typeof fetch;
45
+ readonly requestTimeoutSeconds: number;
46
+ readonly debug: boolean;
47
+ readonly userAgent: string;
48
+ /**
49
+ * Create a connection configuration.
50
+ *
51
+ * Environment variables (optional):
52
+ * - `OPEN_SANDBOX_DOMAIN` (default: `localhost:8080`)
53
+ * - `OPEN_SANDBOX_API_KEY`
54
+ */
55
+ constructor(opts?: ConnectionConfigOptions);
56
+ getBaseUrl(): string;
57
+ }
58
+ //# sourceMappingURL=connection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../../src/config/connection.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEjC;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAkGD,qBAAa,gBAAgB;IAC3B,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC;IAC7B;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,KAAK,CAAC;IAChC,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;IACvC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAA8B;IAExD;;;;;;OAMG;gBACS,IAAI,GAAE,uBAA4B;IAmD9C,UAAU,IAAI,MAAM;CAOrB"}
@@ -0,0 +1,171 @@
1
+ // Copyright 2026 Alibaba Group Holding Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ function isNodeRuntime() {
15
+ const p = globalThis?.process;
16
+ return !!(p?.versions?.node);
17
+ }
18
+ function redactHeaders(headers) {
19
+ const out = { ...headers };
20
+ for (const k of Object.keys(out)) {
21
+ if (k.toLowerCase() === "open-sandbox-api-key")
22
+ out[k] = "***";
23
+ }
24
+ return out;
25
+ }
26
+ function readEnv(name) {
27
+ const env = globalThis?.process?.env;
28
+ const v = env?.[name];
29
+ return typeof v === "string" && v.length ? v : undefined;
30
+ }
31
+ function stripTrailingSlashes(s) {
32
+ return s.replace(/\/+$/, "");
33
+ }
34
+ function stripV1Suffix(s) {
35
+ const trimmed = stripTrailingSlashes(s);
36
+ return trimmed.endsWith("/v1") ? trimmed.slice(0, -3) : trimmed;
37
+ }
38
+ function normalizeDomainBase(input) {
39
+ // Accept a full URL and preserve its path prefix (if any).
40
+ if (input.startsWith("http://") || input.startsWith("https://")) {
41
+ const u = new URL(input);
42
+ const proto = u.protocol === "https:" ? "https" : "http";
43
+ // Keep origin + pathname, drop query/hash.
44
+ const base = `${u.origin}${u.pathname}`;
45
+ return { protocol: proto, domainBase: stripV1Suffix(base) };
46
+ }
47
+ // No scheme: treat as "host[:port]" or "host[:port]/prefix" and normalize trailing "/v1" or "/".
48
+ return { domainBase: stripV1Suffix(input) };
49
+ }
50
+ function createTimedFetch(opts) {
51
+ const baseFetch = opts.baseFetch;
52
+ const timeoutSeconds = opts.timeoutSeconds;
53
+ const debug = opts.debug;
54
+ const defaultHeaders = opts.defaultHeaders ?? {};
55
+ const label = opts.label;
56
+ return async (input, init) => {
57
+ const method = init?.method ?? "GET";
58
+ const url = typeof input === "string" ? input : input?.toString?.() ?? String(input);
59
+ const ac = new AbortController();
60
+ const timeoutMs = Math.floor(timeoutSeconds * 1000);
61
+ const t = Number.isFinite(timeoutMs) && timeoutMs > 0
62
+ ? setTimeout(() => ac.abort(new Error(`[${label}] Request timed out (timeoutSeconds=${timeoutSeconds})`)), timeoutMs)
63
+ : undefined;
64
+ const onAbort = () => ac.abort(init?.signal?.reason ?? new Error("Aborted"));
65
+ if (init?.signal) {
66
+ if (init.signal.aborted)
67
+ onAbort();
68
+ else
69
+ init.signal.addEventListener("abort", onAbort, { once: true });
70
+ }
71
+ const mergedInit = {
72
+ ...init,
73
+ signal: ac.signal,
74
+ };
75
+ if (debug) {
76
+ const mergedHeaders = { ...defaultHeaders, ...(init?.headers ?? {}) };
77
+ // eslint-disable-next-line no-console
78
+ console.log(`[opensandbox:${label}] ->`, method, url, redactHeaders(mergedHeaders));
79
+ }
80
+ try {
81
+ const res = await baseFetch(input, mergedInit);
82
+ if (debug) {
83
+ // eslint-disable-next-line no-console
84
+ console.log(`[opensandbox:${label}] <-`, method, url, res.status);
85
+ }
86
+ return res;
87
+ }
88
+ finally {
89
+ if (t)
90
+ clearTimeout(t);
91
+ if (init?.signal)
92
+ init.signal.removeEventListener("abort", onAbort);
93
+ }
94
+ };
95
+ }
96
+ export class ConnectionConfig {
97
+ protocol;
98
+ domain;
99
+ apiKey;
100
+ headers;
101
+ fetch;
102
+ /**
103
+ * Fetch function intended for long-lived streaming requests (SSE).
104
+ *
105
+ * This is separate from {@link fetch} so callers can supply a different implementation
106
+ * (e.g. Node undici with bodyTimeout disabled) and so the SDK can apply distinct
107
+ * timeout semantics for streaming vs normal HTTP calls.
108
+ */
109
+ sseFetch;
110
+ requestTimeoutSeconds;
111
+ debug;
112
+ userAgent = "OpenSandbox-JS-SDK/0.1.0";
113
+ /**
114
+ * Create a connection configuration.
115
+ *
116
+ * Environment variables (optional):
117
+ * - `OPEN_SANDBOX_DOMAIN` (default: `localhost:8080`)
118
+ * - `OPEN_SANDBOX_API_KEY`
119
+ */
120
+ constructor(opts = {}) {
121
+ const envDomain = readEnv("OPEN_SANDBOX_DOMAIN");
122
+ const envApiKey = readEnv("OPEN_SANDBOX_API_KEY");
123
+ const rawDomain = opts.domain ?? envDomain ?? "localhost:8080";
124
+ const normalized = normalizeDomainBase(rawDomain);
125
+ // If the domain includes a scheme, it overrides `protocol`.
126
+ this.protocol = normalized.protocol ?? opts.protocol ?? "http";
127
+ this.domain = normalized.domainBase;
128
+ this.apiKey = opts.apiKey ?? envApiKey;
129
+ this.requestTimeoutSeconds = typeof opts.requestTimeoutSeconds === "number"
130
+ ? opts.requestTimeoutSeconds
131
+ : 30;
132
+ this.debug = !!opts.debug;
133
+ const headers = { ...(opts.headers ?? {}) };
134
+ // Attach API key via header unless the user already provided one.
135
+ if (this.apiKey && !headers["OPEN-SANDBOX-API-KEY"]) {
136
+ headers["OPEN-SANDBOX-API-KEY"] = this.apiKey;
137
+ }
138
+ // Best-effort user-agent (Node only).
139
+ if (isNodeRuntime() && this.userAgent && !headers["user-agent"] && !headers["User-Agent"]) {
140
+ headers["user-agent"] = this.userAgent;
141
+ }
142
+ this.headers = headers;
143
+ // Node SDK: do not expose custom fetch in ConnectionConfigOptions.
144
+ // Use the runtime's global fetch (Node >= 20).
145
+ const baseFetch = fetch;
146
+ const baseSseFetch = fetch;
147
+ // Normal HTTP calls: apply requestTimeoutSeconds.
148
+ this.fetch = createTimedFetch({
149
+ baseFetch,
150
+ timeoutSeconds: this.requestTimeoutSeconds,
151
+ debug: this.debug,
152
+ defaultHeaders: this.headers,
153
+ label: "http",
154
+ });
155
+ // Streaming calls (SSE): do not apply SDK-side timeouts; do not proactively disconnect.
156
+ this.sseFetch = createTimedFetch({
157
+ baseFetch: baseSseFetch,
158
+ timeoutSeconds: 0,
159
+ debug: this.debug,
160
+ defaultHeaders: this.headers,
161
+ label: "sse",
162
+ });
163
+ }
164
+ getBaseUrl() {
165
+ // If `domain` already contains a scheme, treat it as a full base URL prefix.
166
+ if (this.domain.startsWith("http://") || this.domain.startsWith("https://")) {
167
+ return `${stripV1Suffix(this.domain)}/v1`;
168
+ }
169
+ return `${this.protocol}://${stripV1Suffix(this.domain)}/v1`;
170
+ }
171
+ }
@@ -0,0 +1,9 @@
1
+ export declare const DEFAULT_EXECD_PORT = 44772;
2
+ export declare const DEFAULT_ENTRYPOINT: string[];
3
+ export declare const DEFAULT_RESOURCE_LIMITS: Record<string, string>;
4
+ export declare const DEFAULT_TIMEOUT_SECONDS = 600;
5
+ export declare const DEFAULT_READY_TIMEOUT_SECONDS = 30;
6
+ export declare const DEFAULT_HEALTH_CHECK_POLLING_INTERVAL_MILLIS = 200;
7
+ export declare const DEFAULT_REQUEST_TIMEOUT_SECONDS = 30;
8
+ export declare const DEFAULT_USER_AGENT = "OpenSandbox-JS-SDK/0.1.0";
9
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/core/constants.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AAExC,eAAO,MAAM,kBAAkB,EAAE,MAAM,EAAgC,CAAC;AAExE,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG1D,CAAC;AAEF,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAChD,eAAO,MAAM,4CAA4C,MAAM,CAAC;AAEhE,eAAO,MAAM,+BAA+B,KAAK,CAAC;AAClD,eAAO,MAAM,kBAAkB,6BAA6B,CAAC"}
@@ -0,0 +1,24 @@
1
+ // Copyright 2026 Alibaba Group Holding Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ export const DEFAULT_EXECD_PORT = 44772;
15
+ export const DEFAULT_ENTRYPOINT = ["tail", "-f", "/dev/null"];
16
+ export const DEFAULT_RESOURCE_LIMITS = {
17
+ cpu: "1",
18
+ memory: "2Gi",
19
+ };
20
+ export const DEFAULT_TIMEOUT_SECONDS = 600;
21
+ export const DEFAULT_READY_TIMEOUT_SECONDS = 30;
22
+ export const DEFAULT_HEALTH_CHECK_POLLING_INTERVAL_MILLIS = 200;
23
+ export const DEFAULT_REQUEST_TIMEOUT_SECONDS = 30;
24
+ export const DEFAULT_USER_AGENT = "OpenSandbox-JS-SDK/0.1.0";
@@ -0,0 +1,74 @@
1
+ export type SandboxErrorCode = "INTERNAL_UNKNOWN_ERROR" | "READY_TIMEOUT" | "UNHEALTHY" | "INVALID_ARGUMENT" | "UNEXPECTED_RESPONSE" | (string & {});
2
+ /**
3
+ * Structured error payload carried by {@link SandboxException}.
4
+ *
5
+ * - `code`: stable programmatic identifier
6
+ * - `message`: optional human-readable message
7
+ */
8
+ export declare class SandboxError {
9
+ readonly code: SandboxErrorCode;
10
+ readonly message?: string | undefined;
11
+ static readonly INTERNAL_UNKNOWN_ERROR: SandboxErrorCode;
12
+ static readonly READY_TIMEOUT: SandboxErrorCode;
13
+ static readonly UNHEALTHY: SandboxErrorCode;
14
+ static readonly INVALID_ARGUMENT: SandboxErrorCode;
15
+ static readonly UNEXPECTED_RESPONSE: SandboxErrorCode;
16
+ constructor(code: SandboxErrorCode, message?: string | undefined);
17
+ }
18
+ interface SandboxExceptionOpts {
19
+ message?: string;
20
+ cause?: unknown;
21
+ error?: SandboxError;
22
+ }
23
+ /**
24
+ * Base exception class for all SDK errors.
25
+ *
26
+ * All errors thrown by this SDK are subclasses of {@link SandboxException}.
27
+ */
28
+ export declare class SandboxException extends Error {
29
+ readonly name: string;
30
+ readonly error: SandboxError;
31
+ readonly cause?: unknown;
32
+ constructor(opts?: SandboxExceptionOpts);
33
+ }
34
+ export declare class SandboxApiException extends SandboxException {
35
+ readonly name: string;
36
+ readonly statusCode?: number;
37
+ readonly requestId?: string;
38
+ readonly rawBody?: unknown;
39
+ constructor(opts: SandboxExceptionOpts & {
40
+ statusCode?: number;
41
+ requestId?: string;
42
+ rawBody?: unknown;
43
+ });
44
+ }
45
+ export declare class SandboxInternalException extends SandboxException {
46
+ readonly name: string;
47
+ constructor(opts: {
48
+ message?: string;
49
+ cause?: unknown;
50
+ });
51
+ }
52
+ export declare class SandboxUnhealthyException extends SandboxException {
53
+ readonly name: string;
54
+ constructor(opts: {
55
+ message?: string;
56
+ cause?: unknown;
57
+ });
58
+ }
59
+ export declare class SandboxReadyTimeoutException extends SandboxException {
60
+ readonly name: string;
61
+ constructor(opts: {
62
+ message?: string;
63
+ cause?: unknown;
64
+ });
65
+ }
66
+ export declare class InvalidArgumentException extends SandboxException {
67
+ readonly name: string;
68
+ constructor(opts: {
69
+ message?: string;
70
+ cause?: unknown;
71
+ });
72
+ }
73
+ export {};
74
+ //# sourceMappingURL=exceptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../../src/core/exceptions.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,gBAAgB,GACxB,wBAAwB,GACxB,eAAe,GACf,WAAW,GACX,kBAAkB,GAClB,qBAAqB,GAErB,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAElB;;;;;GAKG;AACH,qBAAa,YAAY;IAQrB,QAAQ,CAAC,IAAI,EAAE,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM;IAR3B,MAAM,CAAC,QAAQ,CAAC,sBAAsB,EAAE,gBAAgB,CAA4B;IACpF,MAAM,CAAC,QAAQ,CAAC,aAAa,EAAE,gBAAgB,CAAmB;IAClE,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAe;IAC1D,MAAM,CAAC,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAsB;IACxE,MAAM,CAAC,QAAQ,CAAC,mBAAmB,EAAE,gBAAgB,CAAyB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,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAkC;gBAE3C,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAOxD;AAED,qBAAa,wBAAyB,SAAQ,gBAAgB;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAA8B;gBAEvC,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAOxD"}
@@ -0,0 +1,103 @@
1
+ // Copyright 2026 Alibaba Group Holding Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ /**
15
+ * Structured error payload carried by {@link SandboxException}.
16
+ *
17
+ * - `code`: stable programmatic identifier
18
+ * - `message`: optional human-readable message
19
+ */
20
+ export class SandboxError {
21
+ code;
22
+ message;
23
+ static INTERNAL_UNKNOWN_ERROR = "INTERNAL_UNKNOWN_ERROR";
24
+ static READY_TIMEOUT = "READY_TIMEOUT";
25
+ static UNHEALTHY = "UNHEALTHY";
26
+ static INVALID_ARGUMENT = "INVALID_ARGUMENT";
27
+ static UNEXPECTED_RESPONSE = "UNEXPECTED_RESPONSE";
28
+ constructor(code, message) {
29
+ this.code = code;
30
+ this.message = message;
31
+ }
32
+ }
33
+ /**
34
+ * Base exception class for all SDK errors.
35
+ *
36
+ * All errors thrown by this SDK are subclasses of {@link SandboxException}.
37
+ */
38
+ export class SandboxException extends Error {
39
+ name = "SandboxException";
40
+ error;
41
+ cause;
42
+ constructor(opts = {}) {
43
+ super(opts.message);
44
+ this.cause = opts.cause;
45
+ this.error = opts.error ?? new SandboxError(SandboxError.INTERNAL_UNKNOWN_ERROR);
46
+ }
47
+ }
48
+ export class SandboxApiException extends SandboxException {
49
+ name = "SandboxApiException";
50
+ statusCode;
51
+ requestId;
52
+ rawBody;
53
+ constructor(opts) {
54
+ super({
55
+ message: opts.message,
56
+ cause: opts.cause,
57
+ error: opts.error ?? new SandboxError(SandboxError.UNEXPECTED_RESPONSE, opts.message),
58
+ });
59
+ this.statusCode = opts.statusCode;
60
+ this.requestId = opts.requestId;
61
+ this.rawBody = opts.rawBody;
62
+ }
63
+ }
64
+ export class SandboxInternalException extends SandboxException {
65
+ name = "SandboxInternalException";
66
+ constructor(opts) {
67
+ super({
68
+ message: opts.message,
69
+ cause: opts.cause,
70
+ error: new SandboxError(SandboxError.INTERNAL_UNKNOWN_ERROR, opts.message),
71
+ });
72
+ }
73
+ }
74
+ export class SandboxUnhealthyException extends SandboxException {
75
+ name = "SandboxUnhealthyException";
76
+ constructor(opts) {
77
+ super({
78
+ message: opts.message,
79
+ cause: opts.cause,
80
+ error: new SandboxError(SandboxError.UNHEALTHY, opts.message),
81
+ });
82
+ }
83
+ }
84
+ export class SandboxReadyTimeoutException extends SandboxException {
85
+ name = "SandboxReadyTimeoutException";
86
+ constructor(opts) {
87
+ super({
88
+ message: opts.message,
89
+ cause: opts.cause,
90
+ error: new SandboxError(SandboxError.READY_TIMEOUT, opts.message),
91
+ });
92
+ }
93
+ }
94
+ export class InvalidArgumentException extends SandboxException {
95
+ name = "InvalidArgumentException";
96
+ constructor(opts) {
97
+ super({
98
+ message: opts.message,
99
+ cause: opts.cause,
100
+ error: new SandboxError(SandboxError.INVALID_ARGUMENT, opts.message),
101
+ });
102
+ }
103
+ }
@@ -0,0 +1,33 @@
1
+ import type { ConnectionConfig } from "../config/connection.js";
2
+ import type { SandboxFiles } from "../services/filesystem.js";
3
+ import type { ExecdCommands } from "../services/execdCommands.js";
4
+ import type { ExecdHealth } from "../services/execdHealth.js";
5
+ import type { ExecdMetrics } from "../services/execdMetrics.js";
6
+ import type { Sandboxes } from "../services/sandboxes.js";
7
+ export interface CreateLifecycleStackOptions {
8
+ connectionConfig: ConnectionConfig;
9
+ lifecycleBaseUrl: string;
10
+ }
11
+ export interface LifecycleStack {
12
+ sandboxes: Sandboxes;
13
+ }
14
+ export interface CreateExecdStackOptions {
15
+ connectionConfig: ConnectionConfig;
16
+ execdBaseUrl: string;
17
+ }
18
+ export interface ExecdStack {
19
+ commands: ExecdCommands;
20
+ files: SandboxFiles;
21
+ health: ExecdHealth;
22
+ metrics: ExecdMetrics;
23
+ }
24
+ /**
25
+ * Factory abstraction to keep `Sandbox` and `SandboxManager` decoupled from concrete adapter implementations.
26
+ *
27
+ * This is primarily useful for advanced integrations (custom transports, dependency injection, testing).
28
+ */
29
+ export interface AdapterFactory {
30
+ createLifecycleStack(opts: CreateLifecycleStackOptions): LifecycleStack;
31
+ createExecdStack(opts: CreateExecdStackOptions): ExecdStack;
32
+ }
33
+ //# sourceMappingURL=adapterFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adapterFactory.d.ts","sourceRoot":"","sources":["../../src/factory/adapterFactory.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,MAAM,WAAW,2BAA2B;IAC1C,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,aAAa,CAAC;IACxB,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,WAAW,CAAC;IACpB,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,oBAAoB,CAAC,IAAI,EAAE,2BAA2B,GAAG,cAAc,CAAC;IACxE,gBAAgB,CAAC,IAAI,EAAE,uBAAuB,GAAG,UAAU,CAAC;CAC7D"}
@@ -0,0 +1,14 @@
1
+ // Copyright 2026 Alibaba Group Holding Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { AdapterFactory, CreateExecdStackOptions, CreateLifecycleStackOptions, ExecdStack, LifecycleStack } from "./adapterFactory.js";
2
+ export declare class DefaultAdapterFactory implements AdapterFactory {
3
+ createLifecycleStack(opts: CreateLifecycleStackOptions): LifecycleStack;
4
+ createExecdStack(opts: CreateExecdStackOptions): ExecdStack;
5
+ }
6
+ export declare function createDefaultAdapterFactory(): AdapterFactory;
7
+ //# sourceMappingURL=defaultAdapterFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultAdapterFactory.d.ts","sourceRoot":"","sources":["../../src/factory/defaultAdapterFactory.ts"],"names":[],"mappings":"AAuBA,OAAO,KAAK,EAAE,cAAc,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE5I,qBAAa,qBAAsB,YAAW,cAAc;IAC1D,oBAAoB,CAAC,IAAI,EAAE,2BAA2B,GAAG,cAAc;IAWvE,gBAAgB,CAAC,IAAI,EAAE,uBAAuB,GAAG,UAAU;CA4B5D;AAED,wBAAgB,2BAA2B,IAAI,cAAc,CAE5D"}
@@ -0,0 +1,61 @@
1
+ // Copyright 2026 Alibaba Group Holding Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ import { createExecdClient } from "../openapi/execdClient.js";
15
+ import { createLifecycleClient } from "../openapi/lifecycleClient.js";
16
+ import { CommandsAdapter } from "../adapters/commandsAdapter.js";
17
+ import { FilesystemAdapter } from "../adapters/filesystemAdapter.js";
18
+ import { HealthAdapter } from "../adapters/healthAdapter.js";
19
+ import { MetricsAdapter } from "../adapters/metricsAdapter.js";
20
+ import { SandboxesAdapter } from "../adapters/sandboxesAdapter.js";
21
+ export class DefaultAdapterFactory {
22
+ createLifecycleStack(opts) {
23
+ const lifecycleClient = createLifecycleClient({
24
+ baseUrl: opts.lifecycleBaseUrl,
25
+ apiKey: opts.connectionConfig.apiKey,
26
+ headers: opts.connectionConfig.headers,
27
+ fetch: opts.connectionConfig.fetch,
28
+ });
29
+ const sandboxes = new SandboxesAdapter(lifecycleClient);
30
+ return { sandboxes };
31
+ }
32
+ createExecdStack(opts) {
33
+ const execdClient = createExecdClient({
34
+ baseUrl: opts.execdBaseUrl,
35
+ headers: opts.connectionConfig.headers,
36
+ fetch: opts.connectionConfig.fetch,
37
+ });
38
+ const health = new HealthAdapter(execdClient);
39
+ const metrics = new MetricsAdapter(execdClient);
40
+ const files = new FilesystemAdapter(execdClient, {
41
+ baseUrl: opts.execdBaseUrl,
42
+ fetch: opts.connectionConfig.fetch,
43
+ headers: opts.connectionConfig.headers,
44
+ });
45
+ const commands = new CommandsAdapter(execdClient, {
46
+ baseUrl: opts.execdBaseUrl,
47
+ // Streaming calls (SSE) use a dedicated fetch, aligned with Kotlin/Python SDKs.
48
+ fetch: opts.connectionConfig.sseFetch,
49
+ headers: opts.connectionConfig.headers,
50
+ });
51
+ return {
52
+ commands,
53
+ files,
54
+ health,
55
+ metrics,
56
+ };
57
+ }
58
+ }
59
+ export function createDefaultAdapterFactory() {
60
+ return new DefaultAdapterFactory();
61
+ }
@@ -0,0 +1,22 @@
1
+ export { InvalidArgumentException, SandboxApiException, SandboxError, SandboxException, SandboxInternalException, SandboxReadyTimeoutException, SandboxUnhealthyException, } from "./core/exceptions.js";
2
+ export type { AdapterFactory } from "./factory/adapterFactory.js";
3
+ export { DefaultAdapterFactory, createDefaultAdapterFactory } from "./factory/defaultAdapterFactory.js";
4
+ export { ConnectionConfig } from "./config/connection.js";
5
+ export type { ConnectionConfigOptions, ConnectionProtocol } from "./config/connection.js";
6
+ export type { CreateSandboxRequest, CreateSandboxResponse, Endpoint, ListSandboxesParams, ListSandboxesResponse, RenewSandboxExpirationRequest, RenewSandboxExpirationResponse, SandboxId, SandboxInfo, } from "./models/sandboxes.js";
7
+ export type { Sandboxes } from "./services/sandboxes.js";
8
+ export { SandboxManager } from "./manager.js";
9
+ export type { SandboxFilter, SandboxManagerOptions } from "./manager.js";
10
+ export type { ExecdHealth } from "./services/execdHealth.js";
11
+ export type { ExecdMetrics } from "./services/execdMetrics.js";
12
+ export type { FileInfo, FileMetadata, Permission, RenameFileItem, ReplaceFileContentItem, SearchFilesResponse, FilesInfoResponse, } from "./models/filesystem.js";
13
+ export type { CommandExecution, RunCommandOpts, RunCommandRequest, ServerStreamEvent, CodeContextRequest, SupportedLanguage, Metrics, SandboxMetrics, PingResponse, } from "./models/execd.js";
14
+ export type { ExecdCommands } from "./services/execdCommands.js";
15
+ export type { Execution, ExecutionComplete, ExecutionError, ExecutionHandlers, ExecutionInit, ExecutionResult, OutputMessage, } from "./models/execution.js";
16
+ export { ExecutionEventDispatcher } from "./models/executionEventDispatcher.js";
17
+ export { DEFAULT_ENTRYPOINT, DEFAULT_EXECD_PORT, DEFAULT_RESOURCE_LIMITS, DEFAULT_TIMEOUT_SECONDS, DEFAULT_READY_TIMEOUT_SECONDS, DEFAULT_HEALTH_CHECK_POLLING_INTERVAL_MILLIS, DEFAULT_REQUEST_TIMEOUT_SECONDS, } from "./core/constants.js";
18
+ export type { SandboxConnectOptions, SandboxCreateOptions, } from "./sandbox.js";
19
+ export { Sandbox } from "./sandbox.js";
20
+ export type { ContentReplaceEntry, MoveEntry, SearchEntry, SetPermissionEntry, WriteEntry, } from "./models/filesystem.js";
21
+ export type { SandboxFiles } from "./services/filesystem.js";
22
+ //# sourceMappingURL=index.d.ts.map