@alibaba-group/opensandbox 0.1.2-dev1 → 0.1.2-dev2

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.
@@ -77,21 +77,8 @@ var InvalidArgumentException = class extends SandboxException {
77
77
  }
78
78
  };
79
79
 
80
- // src/openapi/createClient.ts
81
- import * as openapiFetch from "openapi-fetch";
82
- function resolveCreateClient() {
83
- const mod = openapiFetch;
84
- if (typeof mod.default === "function") {
85
- return mod.default;
86
- }
87
- if (typeof mod.createClient === "function") {
88
- return mod.createClient;
89
- }
90
- throw new TypeError("openapi-fetch createClient export not found");
91
- }
92
- var createClient = resolveCreateClient();
93
-
94
80
  // src/openapi/execdClient.ts
81
+ import createClient from "openapi-fetch";
95
82
  function createExecdClient(opts) {
96
83
  return createClient({
97
84
  baseUrl: opts.baseUrl,
@@ -101,6 +88,7 @@ function createExecdClient(opts) {
101
88
  }
102
89
 
103
90
  // src/openapi/lifecycleClient.ts
91
+ import createClient2 from "openapi-fetch";
104
92
  function readEnvApiKey() {
105
93
  const env = globalThis?.process?.env;
106
94
  const v = env?.OPEN_SANDBOX_API_KEY;
@@ -114,7 +102,7 @@ function createLifecycleClient(opts = {}) {
114
102
  if (apiKey && !headers["OPEN-SANDBOX-API-KEY"]) {
115
103
  headers["OPEN-SANDBOX-API-KEY"] = apiKey;
116
104
  }
117
- return createClient({
105
+ return createClient2({
118
106
  baseUrl: opts.baseUrl ?? "http://localhost:8080/v1",
119
107
  headers,
120
108
  fetch: opts.fetch
@@ -935,4 +923,4 @@ export {
935
923
  MetricsAdapter,
936
924
  SandboxesAdapter
937
925
  };
938
- //# sourceMappingURL=chunk-5AELQBW6.js.map
926
+ //# sourceMappingURL=chunk-NFNOESEY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/exceptions.ts","../src/openapi/execdClient.ts","../src/openapi/lifecycleClient.ts","../src/models/executionEventDispatcher.ts","../src/adapters/openapiError.ts","../src/adapters/sse.ts","../src/adapters/commandsAdapter.ts","../src/adapters/filesystemAdapter.ts","../src/adapters/healthAdapter.ts","../src/adapters/metricsAdapter.ts","../src/adapters/sandboxesAdapter.ts"],"sourcesContent":["// Copyright 2026 Alibaba Group Holding Ltd.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nexport type SandboxErrorCode =\n | \"INTERNAL_UNKNOWN_ERROR\"\n | \"READY_TIMEOUT\"\n | \"UNHEALTHY\"\n | \"INVALID_ARGUMENT\"\n | \"UNEXPECTED_RESPONSE\"\n // Allow server-defined codes as well.\n | (string & {});\n\n/**\n * Structured error payload carried by {@link SandboxException}.\n *\n * - `code`: stable programmatic identifier\n * - `message`: optional human-readable message\n */\nexport class SandboxError {\n static readonly INTERNAL_UNKNOWN_ERROR: SandboxErrorCode = \"INTERNAL_UNKNOWN_ERROR\";\n static readonly READY_TIMEOUT: SandboxErrorCode = \"READY_TIMEOUT\";\n static readonly UNHEALTHY: SandboxErrorCode = \"UNHEALTHY\";\n static readonly INVALID_ARGUMENT: SandboxErrorCode = \"INVALID_ARGUMENT\";\n static readonly UNEXPECTED_RESPONSE: SandboxErrorCode = \"UNEXPECTED_RESPONSE\";\n\n constructor(\n readonly code: SandboxErrorCode,\n readonly message?: string,\n ) {}\n}\n\ninterface SandboxExceptionOpts {\n message?: string;\n cause?: unknown;\n error?: SandboxError;\n}\n\n/**\n * Base exception class for all SDK errors.\n *\n * All errors thrown by this SDK are subclasses of {@link SandboxException}.\n */\nexport class SandboxException extends Error {\n readonly name: string = \"SandboxException\";\n readonly error: SandboxError;\n readonly cause?: unknown;\n\n constructor(opts: SandboxExceptionOpts = {}) {\n super(opts.message);\n this.cause = opts.cause;\n this.error = opts.error ?? new SandboxError(SandboxError.INTERNAL_UNKNOWN_ERROR);\n }\n}\n\nexport class SandboxApiException extends SandboxException {\n readonly name: string = \"SandboxApiException\";\n readonly statusCode?: number;\n readonly requestId?: string;\n readonly rawBody?: unknown;\n\n constructor(opts: SandboxExceptionOpts & {\n statusCode?: number;\n requestId?: string;\n rawBody?: unknown;\n }) {\n super({\n message: opts.message,\n cause: opts.cause,\n error: opts.error ?? new SandboxError(SandboxError.UNEXPECTED_RESPONSE, opts.message),\n });\n this.statusCode = opts.statusCode;\n this.requestId = opts.requestId;\n this.rawBody = opts.rawBody;\n }\n}\n\nexport class SandboxInternalException extends SandboxException {\n readonly name: string = \"SandboxInternalException\";\n\n constructor(opts: { message?: string; cause?: unknown }) {\n super({\n message: opts.message,\n cause: opts.cause,\n error: new SandboxError(SandboxError.INTERNAL_UNKNOWN_ERROR, opts.message),\n });\n }\n}\n\nexport class SandboxUnhealthyException extends SandboxException {\n readonly name: string = \"SandboxUnhealthyException\";\n\n constructor(opts: { message?: string; cause?: unknown }) {\n super({\n message: opts.message,\n cause: opts.cause,\n error: new SandboxError(SandboxError.UNHEALTHY, opts.message),\n });\n }\n}\n\nexport class SandboxReadyTimeoutException extends SandboxException {\n readonly name: string = \"SandboxReadyTimeoutException\";\n\n constructor(opts: { message?: string; cause?: unknown }) {\n super({\n message: opts.message,\n cause: opts.cause,\n error: new SandboxError(SandboxError.READY_TIMEOUT, opts.message),\n });\n }\n}\n\nexport class InvalidArgumentException extends SandboxException {\n readonly name: string = \"InvalidArgumentException\";\n\n constructor(opts: { message?: string; cause?: unknown }) {\n super({\n message: opts.message,\n cause: opts.cause,\n error: new SandboxError(SandboxError.INVALID_ARGUMENT, opts.message),\n });\n }\n}","// Copyright 2026 Alibaba Group Holding Ltd.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport createClient from \"openapi-fetch\";\nimport type { Client } from \"openapi-fetch\";\n\nimport type { paths as ExecdPaths } from \"../api/execd.js\";\n\nexport type ExecdClient = Client<ExecdPaths>;\n\nexport interface CreateExecdClientOptions {\n /**\n * Base URL to the Execd API (no `/v1` prefix).\n * Examples:\n * - `http://localhost:44772`\n * - `http://api.opensandbox.io/sandboxes/<id>/port/44772`\n */\n baseUrl: string;\n /**\n * Extra headers applied to every request.\n */\n headers?: Record<string, string>;\n /**\n * Custom fetch implementation.\n *\n * Useful for proxies, custom TLS, request tracing, retries, or running in environments\n * where a global `fetch` is not available.\n */\n fetch?: typeof fetch;\n}\n\nexport function createExecdClient(opts: CreateExecdClientOptions): ExecdClient {\n return createClient<ExecdPaths>({\n baseUrl: opts.baseUrl,\n headers: opts.headers,\n fetch: opts.fetch,\n });\n}","// Copyright 2026 Alibaba Group Holding Ltd.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport createClient from \"openapi-fetch\";\nimport type { Client } from \"openapi-fetch\";\n\nimport type { paths as LifecyclePaths } from \"../api/lifecycle.js\";\n\nexport type LifecycleClient = Client<LifecyclePaths>;\n\nexport interface CreateLifecycleClientOptions {\n /**\n * Base URL to OpenSandbox Lifecycle API, including the `/v1` prefix.\n * Example: `http://localhost:8080/v1`\n */\n baseUrl?: string;\n /**\n * API key for `OPEN-SANDBOX-API-KEY` header.\n * If omitted, reads from `process.env.OPEN_SANDBOX_API_KEY` when available.\n */\n apiKey?: string;\n /**\n * Extra headers applied to every request.\n */\n headers?: Record<string, string>;\n /**\n * Custom fetch implementation.\n *\n * Useful for proxies, custom TLS, request tracing, retries, or running in environments\n * where a global `fetch` is not available.\n */\n fetch?: typeof fetch;\n}\n\nfunction readEnvApiKey(): string | undefined {\n // Avoid requiring @types/node by not referencing `process` directly.\n // In Node, `globalThis.process.env` exists; in browsers it won't.\n const env = (globalThis as any)?.process?.env;\n const v = env?.OPEN_SANDBOX_API_KEY;\n return typeof v === \"string\" && v.length ? v : undefined;\n}\n\nexport function createLifecycleClient(opts: CreateLifecycleClientOptions = {}): LifecycleClient {\n const apiKey = opts.apiKey ?? readEnvApiKey();\n\n const headers: Record<string, string> = {\n ...(opts.headers ?? {}),\n };\n\n if (apiKey && !headers[\"OPEN-SANDBOX-API-KEY\"]) {\n headers[\"OPEN-SANDBOX-API-KEY\"] = apiKey;\n }\n\n return createClient<LifecyclePaths>({\n baseUrl: opts.baseUrl ?? \"http://localhost:8080/v1\",\n headers,\n fetch: opts.fetch,\n });\n}","// Copyright 2026 Alibaba Group Holding Ltd.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { Execution, ExecutionComplete, ExecutionError, ExecutionHandlers, ExecutionInit, ExecutionResult, OutputMessage } from \"./execution.js\";\nimport type { ServerStreamEvent } from \"./execd.js\";\n\nfunction extractText(results: ServerStreamEvent[\"results\"] | undefined): string | undefined {\n if (!results || typeof results !== \"object\") return undefined;\n const r = results as any;\n const v = r[\"text/plain\"] ?? r.text ?? r.textPlain;\n return v == null ? undefined : String(v);\n}\n\n/**\n * Dispatches streamed execution events to handlers.\n *\n * This mutates the provided `execution` object (appending logs/results and setting fields like\n * `id`, `executionCount`, and `complete`) and invokes optional callbacks in {@link ExecutionHandlers}.\n */\nexport class ExecutionEventDispatcher {\n constructor(\n private readonly execution: Execution,\n private readonly handlers?: ExecutionHandlers,\n ) {}\n\n async dispatch(ev: ServerStreamEvent): Promise<void> {\n await this.handlers?.onEvent?.(ev);\n\n const ts = ev.timestamp ?? Date.now();\n switch (ev.type) {\n case \"init\": {\n const id = ev.text ?? \"\";\n if (id) this.execution.id = id;\n const init: ExecutionInit = { id, timestamp: ts };\n await this.handlers?.onInit?.(init);\n return;\n }\n case \"stdout\": {\n const msg: OutputMessage = { text: ev.text ?? \"\", timestamp: ts, isError: false };\n this.execution.logs.stdout.push(msg);\n await this.handlers?.onStdout?.(msg);\n return;\n }\n case \"stderr\": {\n const msg: OutputMessage = { text: ev.text ?? \"\", timestamp: ts, isError: true };\n this.execution.logs.stderr.push(msg);\n await this.handlers?.onStderr?.(msg);\n return;\n }\n case \"result\": {\n const r: ExecutionResult = { text: extractText(ev.results), timestamp: ts, raw: ev.results as any };\n this.execution.result.push(r);\n await this.handlers?.onResult?.(r);\n return;\n }\n case \"execution_count\": {\n const c = (ev as any).execution_count;\n if (typeof c === \"number\") this.execution.executionCount = c;\n return;\n }\n case \"execution_complete\": {\n const ms = (ev as any).execution_time;\n const complete: ExecutionComplete = { timestamp: ts, executionTimeMs: typeof ms === \"number\" ? ms : 0 };\n this.execution.complete = complete;\n await this.handlers?.onExecutionComplete?.(complete);\n return;\n }\n case \"error\": {\n const e = ev.error as any;\n if (e) {\n const err: ExecutionError = {\n name: String(e.ename ?? e.name ?? \"\"),\n value: String(e.evalue ?? e.value ?? \"\"),\n timestamp: ts,\n traceback: Array.isArray(e.traceback) ? e.traceback.map(String) : [],\n };\n this.execution.error = err;\n await this.handlers?.onError?.(err);\n }\n return;\n }\n default:\n return;\n }\n }\n}","// Copyright 2026 Alibaba Group Holding Ltd.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { SandboxApiException, SandboxError } from \"../core/exceptions.js\";\n\nexport function throwOnOpenApiFetchError(\n result: { error?: unknown; response: Response },\n fallbackMessage: string,\n): void {\n if (!result.error) return;\n\n const requestId = result.response.headers.get(\"x-request-id\") ?? undefined;\n const status = (result.response as any).status ?? 0;\n\n const err = result.error as any;\n const message =\n err?.message ??\n err?.error?.message ??\n fallbackMessage;\n\n const code = err?.code ?? err?.error?.code;\n const msg = err?.message ?? err?.error?.message ?? message;\n\n throw new SandboxApiException({\n message: msg,\n statusCode: status,\n requestId,\n error: code ? new SandboxError(String(code), String(msg ?? \"\")) : new SandboxError(SandboxError.UNEXPECTED_RESPONSE, String(msg ?? \"\")),\n rawBody: result.error,\n });\n}","// Copyright 2026 Alibaba Group Holding Ltd.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { SandboxApiException, SandboxError } from \"../core/exceptions.js\";\n\nfunction tryParseJson(line: string): unknown | undefined {\n try {\n return JSON.parse(line);\n } catch {\n return undefined;\n }\n}\n\n/**\n * Parses an SSE-like stream that may be either:\n * - standard SSE frames (`data: {...}\\n\\n`)\n * - newline-delimited JSON (one JSON object per line)\n */\nexport async function* parseJsonEventStream<T>(\n res: Response,\n opts?: { fallbackErrorMessage?: string },\n): AsyncIterable<T> {\n if (!res.ok) {\n const text = await res.text().catch(() => \"\");\n const parsed = tryParseJson(text);\n const err = parsed && typeof parsed === \"object\" ? (parsed as any) : undefined;\n const requestId = res.headers.get(\"x-request-id\") ?? undefined;\n const message = err?.message ?? opts?.fallbackErrorMessage ?? `Stream request failed (status=${res.status})`;\n const code = err?.code ? String(err.code) : SandboxError.UNEXPECTED_RESPONSE;\n throw new SandboxApiException({\n message,\n statusCode: res.status,\n requestId,\n error: new SandboxError(code, err?.message ? String(err.message) : message),\n rawBody: parsed ?? text,\n });\n }\n\n if (!res.body) {\n return;\n }\n\n const reader = res.body.getReader();\n const decoder = new TextDecoder(\"utf-8\");\n let buf = \"\";\n\n while (true) {\n const { value, done } = await reader.read();\n if (done) break;\n\n buf += decoder.decode(value, { stream: true });\n let idx: number;\n\n while ((idx = buf.indexOf(\"\\n\")) >= 0) {\n const rawLine = buf.slice(0, idx);\n buf = buf.slice(idx + 1);\n\n const line = rawLine.trim();\n if (!line) continue;\n\n // Support standard SSE \"data:\" prefix\n if (line.startsWith(\":\")) continue;\n if (line.startsWith(\"event:\") || line.startsWith(\"id:\") || line.startsWith(\"retry:\")) continue;\n\n const jsonLine = line.startsWith(\"data:\") ? line.slice(\"data:\".length).trim() : line;\n if (!jsonLine) continue;\n\n const parsed = tryParseJson(jsonLine);\n if (!parsed) continue;\n yield parsed as T;\n }\n }\n\n // Flush any buffered UTF-8 bytes from the decoder.\n buf += decoder.decode();\n\n // flush last line if exists\n const last = buf.trim();\n if (last) {\n const jsonLine = last.startsWith(\"data:\") ? last.slice(\"data:\".length).trim() : last;\n const parsed = tryParseJson(jsonLine);\n if (parsed) yield parsed as T;\n }\n}","// Copyright 2026 Alibaba Group Holding Ltd.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ExecdClient } from \"../openapi/execdClient.js\";\nimport { throwOnOpenApiFetchError } from \"./openapiError.js\";\nimport { parseJsonEventStream } from \"./sse.js\";\nimport type { paths as ExecdPaths } from \"../api/execd.js\";\nimport type { CommandExecution, RunCommandOpts, ServerStreamEvent } from \"../models/execd.js\";\nimport type { ExecdCommands } from \"../services/execdCommands.js\";\nimport type { ExecutionHandlers } from \"../models/execution.js\";\nimport { ExecutionEventDispatcher } from \"../models/executionEventDispatcher.js\";\n\nfunction joinUrl(baseUrl: string, pathname: string): string {\n const base = baseUrl.endsWith(\"/\") ? baseUrl.slice(0, -1) : baseUrl;\n const path = pathname.startsWith(\"/\") ? pathname : `/${pathname}`;\n return `${base}${path}`;\n}\n\ntype ApiRunCommandRequest =\n ExecdPaths[\"/command\"][\"post\"][\"requestBody\"][\"content\"][\"application/json\"];\n\nfunction toRunCommandRequest(command: string, opts?: RunCommandOpts): ApiRunCommandRequest {\n return {\n command,\n cwd: opts?.workingDirectory,\n background: !!opts?.background,\n };\n}\n\nexport interface CommandsAdapterOptions {\n /**\n * Must match the baseUrl used by the ExecdClient.\n */\n baseUrl: string;\n fetch?: typeof fetch;\n headers?: Record<string, string>;\n}\n\nexport class CommandsAdapter implements ExecdCommands {\n private readonly fetch: typeof fetch;\n\n constructor(\n private readonly client: ExecdClient,\n private readonly opts: CommandsAdapterOptions,\n ) {\n this.fetch = opts.fetch ?? fetch;\n }\n\n async interrupt(sessionId: string): Promise<void> {\n const { error, response } = await this.client.DELETE(\"/command\", {\n params: { query: { id: sessionId } },\n });\n throwOnOpenApiFetchError({ error, response }, \"Interrupt command failed\");\n }\n\n async *runStream(\n command: string,\n opts?: RunCommandOpts,\n signal?: AbortSignal,\n ): AsyncIterable<ServerStreamEvent> {\n const url = joinUrl(this.opts.baseUrl, \"/command\");\n const body = JSON.stringify(toRunCommandRequest(command, opts));\n\n const res = await this.fetch(url, {\n method: \"POST\",\n headers: {\n \"accept\": \"text/event-stream\",\n \"content-type\": \"application/json\",\n ...(this.opts.headers ?? {}),\n },\n body,\n signal,\n });\n\n for await (const ev of parseJsonEventStream<ServerStreamEvent>(res, { fallbackErrorMessage: \"Run command failed\" })) {\n yield ev;\n }\n }\n\n async run(\n command: string,\n opts?: RunCommandOpts,\n handlers?: ExecutionHandlers,\n signal?: AbortSignal,\n ): Promise<CommandExecution> {\n const execution: CommandExecution = {\n logs: { stdout: [], stderr: [] },\n result: [],\n };\n const dispatcher = new ExecutionEventDispatcher(execution, handlers);\n for await (const ev of this.runStream(command, opts, signal)) {\n // Keep legacy behavior: if server sends \"init\" with empty id, preserve previous id.\n if (ev.type === \"init\" && (ev.text ?? \"\") === \"\" && execution.id) {\n (ev as any).text = execution.id;\n }\n await dispatcher.dispatch(ev as any);\n }\n\n return execution;\n }\n}","// Copyright 2026 Alibaba Group Holding Ltd.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ExecdClient } from \"../openapi/execdClient.js\";\nimport { throwOnOpenApiFetchError } from \"./openapiError.js\";\nimport type { SandboxFiles } from \"../services/filesystem.js\";\nimport type { paths as ExecdPaths } from \"../api/execd.js\";\nimport type {\n ContentReplaceEntry,\n FileInfo,\n FileMetadata,\n FilesInfoResponse,\n MoveEntry,\n Permission,\n RenameFileItem,\n ReplaceFileContentItem,\n SearchEntry,\n SearchFilesResponse,\n SetPermissionEntry,\n WriteEntry,\n} from \"../models/filesystem.js\";\nimport { SandboxApiException, SandboxError } from \"../core/exceptions.js\";\n\nfunction joinUrl(baseUrl: string, pathname: string): string {\n const base = baseUrl.endsWith(\"/\") ? baseUrl.slice(0, -1) : baseUrl;\n const path = pathname.startsWith(\"/\") ? pathname : `/${pathname}`;\n return `${base}${path}`;\n}\n\nfunction toUploadBlob(data: Blob | Uint8Array | ArrayBuffer | string): Blob {\n if (typeof data === \"string\") return new Blob([data]);\n if (data instanceof Blob) return data;\n if (data instanceof ArrayBuffer) return new Blob([data]);\n // Copy into a new Uint8Array backed by ArrayBuffer (not SharedArrayBuffer)\n const copied = Uint8Array.from(data);\n return new Blob([copied.buffer]);\n}\n\nfunction isReadableStream(v: unknown): v is ReadableStream<Uint8Array> {\n return !!v && typeof (v as any).getReader === \"function\";\n}\n\nfunction isAsyncIterable(v: unknown): v is AsyncIterable<Uint8Array> {\n return !!v && typeof (v as any)[Symbol.asyncIterator] === \"function\";\n}\n\nfunction isNodeRuntime(): boolean {\n const p = (globalThis as any)?.process;\n return !!(p?.versions?.node);\n}\n\nasync function collectBytes(\n source: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>\n): Promise<Uint8Array> {\n const chunks: Uint8Array[] = [];\n let total = 0;\n\n if (isReadableStream(source)) {\n const reader = source.getReader();\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n if (value) {\n chunks.push(value);\n total += value.length;\n }\n }\n } finally {\n reader.releaseLock();\n }\n } else {\n for await (const chunk of source) {\n chunks.push(chunk);\n total += chunk.length;\n }\n }\n\n const out = new Uint8Array(total);\n let offset = 0;\n for (const chunk of chunks) {\n out.set(chunk, offset);\n offset += chunk.length;\n }\n return out;\n}\n\nfunction toReadableStream(\n it: AsyncIterable<Uint8Array>\n): ReadableStream<Uint8Array> {\n const RS: any = ReadableStream as any;\n if (typeof RS?.from === \"function\") return RS.from(it);\n const iterator = it[Symbol.asyncIterator]();\n return new ReadableStream<Uint8Array>({\n async pull(controller) {\n const r = await iterator.next();\n if (r.done) {\n controller.close();\n return;\n }\n controller.enqueue(r.value);\n },\n async cancel() {\n await iterator.return?.();\n },\n });\n}\n\nfunction basename(p: string): string {\n const parts = p.split(\"/\").filter(Boolean);\n return parts.length ? parts[parts.length - 1] : \"file\";\n}\n\nfunction encodeUtf8(s: string): Uint8Array {\n return new TextEncoder().encode(s);\n}\n\nasync function* multipartUploadBody(opts: {\n boundary: string;\n metadataJson: string;\n fileName: string;\n fileContentType: string;\n file: ReadableStream<Uint8Array> | AsyncIterable<Uint8Array>;\n}): AsyncIterable<Uint8Array> {\n const b = opts.boundary;\n\n // Part 1: metadata (application/json)\n yield encodeUtf8(`--${b}\\r\\n`);\n yield encodeUtf8(\n `Content-Disposition: form-data; name=\"metadata\"; filename=\"metadata\"\\r\\n`\n );\n yield encodeUtf8(`Content-Type: application/json\\r\\n\\r\\n`);\n yield encodeUtf8(opts.metadataJson);\n yield encodeUtf8(`\\r\\n`);\n\n // Part 2: file\n yield encodeUtf8(`--${b}\\r\\n`);\n yield encodeUtf8(\n `Content-Disposition: form-data; name=\"file\"; filename=\"${opts.fileName}\"\\r\\n`\n );\n yield encodeUtf8(`Content-Type: ${opts.fileContentType}\\r\\n\\r\\n`);\n\n if (isReadableStream(opts.file)) {\n const reader = opts.file.getReader();\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n if (value) yield value;\n }\n } finally {\n reader.releaseLock();\n }\n } else {\n for await (const chunk of opts.file) {\n yield chunk;\n }\n }\n\n yield encodeUtf8(`\\r\\n--${b}--\\r\\n`);\n}\n\nexport interface FilesystemAdapterOptions {\n /**\n * Must match the baseUrl used by the ExecdClient, used for binary endpoints\n * like download/upload where we bypass JSON parsing.\n */\n baseUrl: string;\n fetch?: typeof fetch;\n headers?: Record<string, string>;\n}\n\nfunction toPermission(e: {\n mode?: number;\n owner?: string;\n group?: string;\n}): Permission {\n return {\n mode: e.mode ?? 755,\n owner: e.owner,\n group: e.group,\n } as Permission;\n}\n\n/**\n * Filesystem adapter that exposes user-facing file APIs (`sandbox.files`).\n *\n * This adapter owns all request/response conversions:\n * - Maps friendly method shapes to API payloads\n * - Parses timestamps into `Date`\n * - Implements streaming upload/download helpers\n */\nexport class FilesystemAdapter implements SandboxFiles {\n private readonly fetch: typeof fetch;\n\n private static readonly Api = {\n // This is intentionally derived from OpenAPI schema types so API changes surface quickly.\n SearchFilesOk:\n null as unknown as ExecdPaths[\"/files/search\"][\"get\"][\"responses\"][200][\"content\"][\"application/json\"],\n FilesInfoOk:\n null as unknown as ExecdPaths[\"/files/info\"][\"get\"][\"responses\"][200][\"content\"][\"application/json\"],\n MakeDirsRequest:\n null as unknown as ExecdPaths[\"/directories\"][\"post\"][\"requestBody\"][\"content\"][\"application/json\"],\n SetPermissionsRequest:\n null as unknown as ExecdPaths[\"/files/permissions\"][\"post\"][\"requestBody\"][\"content\"][\"application/json\"],\n MoveFilesRequest:\n null as unknown as ExecdPaths[\"/files/mv\"][\"post\"][\"requestBody\"][\"content\"][\"application/json\"],\n ReplaceContentsRequest:\n null as unknown as ExecdPaths[\"/files/replace\"][\"post\"][\"requestBody\"][\"content\"][\"application/json\"],\n };\n\n constructor(\n private readonly client: ExecdClient,\n private readonly opts: FilesystemAdapterOptions\n ) {\n this.fetch = opts.fetch ?? fetch;\n }\n\n private parseIsoDate(field: string, v: unknown): Date {\n if (typeof v !== \"string\" || !v) {\n throw new Error(`Invalid ${field}: expected ISO string, got ${typeof v}`);\n }\n const d = new Date(v);\n if (Number.isNaN(d.getTime())) {\n throw new Error(`Invalid ${field}: ${v}`);\n }\n return d;\n }\n\n private static readonly _ApiFileInfo =\n null as unknown as (typeof FilesystemAdapter.Api.SearchFilesOk)[number];\n\n private mapApiFileInfo(raw: typeof FilesystemAdapter._ApiFileInfo): FileInfo {\n const { path, size, created_at, modified_at, mode, owner, group, ...rest } =\n raw;\n\n return {\n ...rest,\n path,\n size,\n mode,\n owner,\n group,\n createdAt: created_at\n ? this.parseIsoDate(\"createdAt\", created_at)\n : undefined,\n modifiedAt: modified_at\n ? this.parseIsoDate(\"modifiedAt\", modified_at)\n : undefined,\n };\n }\n\n async getFileInfo(paths: string[]): Promise<Record<string, FileInfo>> {\n const { data, error, response } = await this.client.GET(\"/files/info\", {\n params: { query: { path: paths } },\n });\n throwOnOpenApiFetchError({ error, response }, \"Get file info failed\");\n const raw = data as typeof FilesystemAdapter.Api.FilesInfoOk | undefined;\n if (!raw) return {} as FilesInfoResponse;\n if (typeof raw !== \"object\") {\n throw new Error(\n `Get file info failed: unexpected response shape (got ${typeof raw})`\n );\n }\n const out: Record<string, FileInfo> = {};\n for (const [k, v] of Object.entries(raw as Record<string, unknown>)) {\n if (!v || typeof v !== \"object\") {\n throw new Error(\n `Get file info failed: invalid file info for path=${k}`\n );\n }\n out[k] = this.mapApiFileInfo(v as typeof FilesystemAdapter._ApiFileInfo);\n }\n return out as FilesInfoResponse;\n }\n\n async deleteFiles(paths: string[]): Promise<void> {\n const { error, response } = await this.client.DELETE(\"/files\", {\n params: { query: { path: paths } },\n });\n throwOnOpenApiFetchError({ error, response }, \"Delete files failed\");\n }\n\n async createDirectories(\n entries: Pick<WriteEntry, \"path\" | \"mode\" | \"owner\" | \"group\">[]\n ): Promise<void> {\n const map: Record<string, Permission> = {};\n for (const e of entries) {\n map[e.path] = toPermission(e);\n }\n const body = map as unknown as typeof FilesystemAdapter.Api.MakeDirsRequest;\n const { error, response } = await this.client.POST(\"/directories\", {\n body,\n });\n throwOnOpenApiFetchError({ error, response }, \"Create directories failed\");\n }\n\n async deleteDirectories(paths: string[]): Promise<void> {\n const { error, response } = await this.client.DELETE(\"/directories\", {\n params: { query: { path: paths } },\n });\n throwOnOpenApiFetchError({ error, response }, \"Delete directories failed\");\n }\n\n async setPermissions(entries: SetPermissionEntry[]): Promise<void> {\n const req: Record<string, Permission> = {};\n for (const e of entries) {\n req[e.path] = toPermission(e);\n }\n const body =\n req as unknown as typeof FilesystemAdapter.Api.SetPermissionsRequest;\n const { error, response } = await this.client.POST(\"/files/permissions\", {\n body,\n });\n throwOnOpenApiFetchError({ error, response }, \"Set permissions failed\");\n }\n\n async moveFiles(entries: MoveEntry[]): Promise<void> {\n const req: RenameFileItem[] = entries.map((e) => ({\n src: e.src,\n dest: e.dest,\n }));\n const body =\n req as unknown as typeof FilesystemAdapter.Api.MoveFilesRequest;\n const { error, response } = await this.client.POST(\"/files/mv\", {\n body,\n });\n throwOnOpenApiFetchError({ error, response }, \"Move files failed\");\n }\n\n async replaceContents(entries: ContentReplaceEntry[]): Promise<void> {\n const req: Record<string, ReplaceFileContentItem> = {};\n for (const e of entries) {\n req[e.path] = { old: e.oldContent, new: e.newContent };\n }\n const body =\n req as unknown as typeof FilesystemAdapter.Api.ReplaceContentsRequest;\n const { error, response } = await this.client.POST(\"/files/replace\", {\n body,\n });\n throwOnOpenApiFetchError({ error, response }, \"Replace contents failed\");\n }\n\n async search(entry: SearchEntry): Promise<SearchFilesResponse> {\n const { data, error, response } = await this.client.GET(\"/files/search\", {\n params: { query: { path: entry.path, pattern: entry.pattern } },\n });\n throwOnOpenApiFetchError({ error, response }, \"Search files failed\");\n\n // Make the OpenAPI contract explicit (and fail loudly on unexpected shapes).\n const ok = data as typeof FilesystemAdapter.Api.SearchFilesOk | undefined;\n if (!ok) return [];\n if (!Array.isArray(ok)) {\n throw new Error(\n `Search files failed: unexpected response shape (expected array, got ${typeof ok})`\n );\n }\n return ok.map((x) => this.mapApiFileInfo(x));\n }\n\n private async uploadFile(\n meta: FileMetadata,\n data:\n | Blob\n | Uint8Array\n | ArrayBuffer\n | string\n | AsyncIterable<Uint8Array>\n | ReadableStream<Uint8Array>\n ): Promise<void> {\n const url = joinUrl(this.opts.baseUrl, \"/files/upload\");\n const fileName = basename(meta.path);\n const metadataJson = JSON.stringify(meta);\n\n // Streaming path (large files): build multipart body manually to avoid buffering.\n if (isReadableStream(data) || isAsyncIterable(data)) {\n // Browsers do not allow streaming multipart requests with custom boundaries.\n // Fall back to in-memory uploads when streaming is unavailable.\n if (!isNodeRuntime()) {\n const bytes = await collectBytes(data);\n return await this.uploadFile(meta, bytes);\n }\n const boundary = `opensandbox_${Math.random()\n .toString(16)\n .slice(2)}_${Date.now()}`;\n const bodyIt = multipartUploadBody({\n boundary,\n metadataJson,\n fileName,\n fileContentType: \"application/octet-stream\",\n file: data,\n });\n const stream = toReadableStream(bodyIt);\n\n const res = await this.fetch(url, {\n method: \"POST\",\n headers: {\n \"content-type\": `multipart/form-data; boundary=${boundary}`,\n ...(this.opts.headers ?? {}),\n },\n body: stream as any,\n // Node fetch (undici) requires duplex for streaming request bodies.\n duplex: \"half\" as any,\n } as any);\n\n if (!res.ok) {\n const requestId = res.headers.get(\"x-request-id\") ?? undefined;\n const rawBody = await res.text().catch(() => undefined);\n throw new SandboxApiException({\n message: `Upload failed (status=${res.status})`,\n statusCode: res.status,\n requestId,\n error: new SandboxError(\n SandboxError.UNEXPECTED_RESPONSE,\n \"Upload failed\"\n ),\n rawBody,\n });\n }\n return;\n }\n\n // In-memory path (small files): use FormData.\n const form = new FormData();\n form.append(\n \"metadata\",\n new Blob([metadataJson], { type: \"application/json\" }),\n \"metadata\"\n );\n\n if (typeof data === \"string\") {\n const textBlob = new Blob([data], { type: \"text/plain; charset=utf-8\" });\n form.append(\"file\", textBlob, fileName);\n } else {\n const blob = toUploadBlob(data);\n const fileBlob = blob.type\n ? blob\n : new Blob([blob], { type: \"application/octet-stream\" });\n form.append(\"file\", fileBlob, fileName);\n }\n\n const res = await this.fetch(url, {\n method: \"POST\",\n headers: {\n ...(this.opts.headers ?? {}),\n },\n body: form,\n });\n\n if (!res.ok) {\n const requestId = res.headers.get(\"x-request-id\") ?? undefined;\n const rawBody = await res.text().catch(() => undefined);\n throw new SandboxApiException({\n message: `Upload failed (status=${res.status})`,\n statusCode: res.status,\n requestId,\n error: new SandboxError(\n SandboxError.UNEXPECTED_RESPONSE,\n \"Upload failed\"\n ),\n rawBody,\n });\n }\n }\n\n async readBytes(\n path: string,\n opts?: { range?: string }\n ): Promise<Uint8Array> {\n const url =\n joinUrl(this.opts.baseUrl, \"/files/download\") +\n `?path=${encodeURIComponent(path)}`;\n const res = await this.fetch(url, {\n method: \"GET\",\n headers: {\n ...(this.opts.headers ?? {}),\n ...(opts?.range ? { Range: opts.range } : {}),\n },\n });\n if (!res.ok) {\n const requestId = res.headers.get(\"x-request-id\") ?? undefined;\n const rawBody = await res.text().catch(() => undefined);\n throw new SandboxApiException({\n message: \"Download failed\",\n statusCode: res.status,\n requestId,\n error: new SandboxError(\n SandboxError.UNEXPECTED_RESPONSE,\n \"Download failed\"\n ),\n rawBody,\n });\n }\n const ab = await res.arrayBuffer();\n return new Uint8Array(ab);\n }\n\n readBytesStream(\n path: string,\n opts?: { range?: string }\n ): AsyncIterable<Uint8Array> {\n return this.downloadStream(path, opts);\n }\n\n private async *downloadStream(\n path: string,\n opts?: { range?: string }\n ): AsyncIterable<Uint8Array> {\n const url =\n joinUrl(this.opts.baseUrl, \"/files/download\") +\n `?path=${encodeURIComponent(path)}`;\n const res = await this.fetch(url, {\n method: \"GET\",\n headers: {\n ...(this.opts.headers ?? {}),\n ...(opts?.range ? { Range: opts.range } : {}),\n },\n });\n if (!res.ok) {\n const requestId = res.headers.get(\"x-request-id\") ?? undefined;\n const rawBody = await res.text().catch(() => undefined);\n throw new SandboxApiException({\n message: \"Download stream failed\",\n statusCode: res.status,\n requestId,\n error: new SandboxError(\n SandboxError.UNEXPECTED_RESPONSE,\n \"Download stream failed\"\n ),\n rawBody,\n });\n }\n\n const body = res.body as ReadableStream<Uint8Array> | null;\n if (!body) return;\n const reader = body.getReader();\n while (true) {\n const { done, value } = await reader.read();\n if (done) return;\n if (value) yield value;\n }\n }\n\n async readFile(\n path: string,\n opts?: { encoding?: string; range?: string }\n ): Promise<string> {\n const bytes = await this.readBytes(path, { range: opts?.range });\n const encoding = opts?.encoding ?? \"utf-8\";\n return new TextDecoder(encoding).decode(bytes);\n }\n\n async writeFiles(entries: WriteEntry[]): Promise<void> {\n for (const e of entries) {\n const meta: FileMetadata = {\n path: e.path,\n owner: e.owner,\n group: e.group,\n mode: e.mode,\n };\n await this.uploadFile(meta, e.data ?? \"\");\n }\n }\n}","// Copyright 2026 Alibaba Group Holding Ltd.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ExecdClient } from \"../openapi/execdClient.js\";\nimport { throwOnOpenApiFetchError } from \"./openapiError.js\";\nimport type { ExecdHealth } from \"../services/execdHealth.js\";\n\nexport class HealthAdapter implements ExecdHealth {\n constructor(private readonly client: ExecdClient) {}\n\n async ping(): Promise<boolean> {\n const { error, response } = await this.client.GET(\"/ping\");\n throwOnOpenApiFetchError({ error, response }, \"Execd ping failed\");\n return true;\n }\n}","// Copyright 2026 Alibaba Group Holding Ltd.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { ExecdClient } from \"../openapi/execdClient.js\";\nimport { throwOnOpenApiFetchError } from \"./openapiError.js\";\nimport type { paths as ExecdPaths } from \"../api/execd.js\";\nimport type { SandboxMetrics } from \"../models/execd.js\";\nimport type { ExecdMetrics } from \"../services/execdMetrics.js\";\n\ntype ApiMetricsOk =\n ExecdPaths[\"/metrics\"][\"get\"][\"responses\"][200][\"content\"][\"application/json\"];\n\nfunction normalizeMetrics(m: ApiMetricsOk): SandboxMetrics {\n const cpuCount = m.cpu_count ?? 0;\n const cpuUsedPercentage = m.cpu_used_pct ?? 0;\n const memoryTotalMiB = m.mem_total_mib ?? 0;\n const memoryUsedMiB = m.mem_used_mib ?? 0;\n const timestamp = m.timestamp ?? 0;\n return {\n cpuCount: Number(cpuCount),\n cpuUsedPercentage: Number(cpuUsedPercentage),\n memoryTotalMiB: Number(memoryTotalMiB),\n memoryUsedMiB: Number(memoryUsedMiB),\n timestamp: Number(timestamp),\n };\n}\n\nexport class MetricsAdapter implements ExecdMetrics {\n constructor(private readonly client: ExecdClient) {}\n\n async getMetrics(): Promise<SandboxMetrics> {\n const { data, error, response } = await this.client.GET(\"/metrics\");\n throwOnOpenApiFetchError({ error, response }, \"Get execd metrics failed\");\n const ok = data as ApiMetricsOk | undefined;\n if (!ok || typeof ok !== \"object\") {\n throw new Error(\"Get execd metrics failed: unexpected response shape\");\n }\n return normalizeMetrics(ok);\n }\n}","// Copyright 2026 Alibaba Group Holding Ltd.\n// \n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n// \n// http://www.apache.org/licenses/LICENSE-2.0\n// \n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport type { LifecycleClient } from \"../openapi/lifecycleClient.js\";\nimport { throwOnOpenApiFetchError } from \"./openapiError.js\";\nimport type { paths as LifecyclePaths } from \"../api/lifecycle.js\";\nimport type {\n Sandboxes,\n} from \"../services/sandboxes.js\";\nimport type {\n CreateSandboxRequest,\n CreateSandboxResponse,\n Endpoint,\n ListSandboxesParams,\n ListSandboxesResponse,\n RenewSandboxExpirationRequest,\n RenewSandboxExpirationResponse,\n SandboxId,\n SandboxInfo,\n} from \"../models/sandboxes.js\";\n\ntype ApiCreateSandboxRequest =\n LifecyclePaths[\"/sandboxes\"][\"post\"][\"requestBody\"][\"content\"][\"application/json\"];\ntype ApiCreateSandboxOk =\n LifecyclePaths[\"/sandboxes\"][\"post\"][\"responses\"][202][\"content\"][\"application/json\"];\ntype ApiGetSandboxOk =\n LifecyclePaths[\"/sandboxes/{sandboxId}\"][\"get\"][\"responses\"][200][\"content\"][\"application/json\"];\ntype ApiListSandboxesOk =\n LifecyclePaths[\"/sandboxes\"][\"get\"][\"responses\"][200][\"content\"][\"application/json\"];\ntype ApiRenewSandboxExpirationRequest =\n LifecyclePaths[\"/sandboxes/{sandboxId}/renew-expiration\"][\"post\"][\"requestBody\"][\"content\"][\"application/json\"];\ntype ApiRenewSandboxExpirationOk =\n LifecyclePaths[\"/sandboxes/{sandboxId}/renew-expiration\"][\"post\"][\"responses\"][200][\"content\"][\"application/json\"];\ntype ApiEndpointOk =\n LifecyclePaths[\"/sandboxes/{sandboxId}/endpoints/{port}\"][\"get\"][\"responses\"][200][\"content\"][\"application/json\"];\n\nfunction encodeMetadataFilter(metadata: Record<string, string>): string {\n // The Lifecycle API expects a single `metadata` query parameter whose value is `k=v&k2=v2`.\n // The query serializer will URL-encode the value (e.g. `=` -> %3D and `&` -> %26).\n const parts: string[] = [];\n for (const [k, v] of Object.entries(metadata)) {\n parts.push(`${k}=${v}`);\n }\n return parts.join(\"&\");\n}\n\nexport class SandboxesAdapter implements Sandboxes {\n constructor(private readonly client: LifecycleClient) {}\n\n private parseIsoDate(field: string, v: unknown): Date {\n if (typeof v !== \"string\" || !v) {\n throw new Error(`Invalid ${field}: expected ISO string, got ${typeof v}`);\n }\n const d = new Date(v);\n if (Number.isNaN(d.getTime())) {\n throw new Error(`Invalid ${field}: ${v}`);\n }\n return d;\n }\n\n private mapSandboxInfo(raw: ApiGetSandboxOk): SandboxInfo {\n return {\n ...(raw ?? {}),\n createdAt: this.parseIsoDate(\"createdAt\", raw?.createdAt),\n expiresAt: this.parseIsoDate(\"expiresAt\", raw?.expiresAt),\n } as SandboxInfo;\n }\n\n async createSandbox(req: CreateSandboxRequest): Promise<CreateSandboxResponse> {\n // Make the OpenAPI contract explicit so backend schema changes surface quickly.\n const body: ApiCreateSandboxRequest = req as unknown as ApiCreateSandboxRequest;\n const { data, error, response } = await this.client.POST(\"/sandboxes\", {\n body,\n });\n throwOnOpenApiFetchError({ error, response }, \"Create sandbox failed\");\n const raw = data as ApiCreateSandboxOk | undefined;\n if (!raw || typeof raw !== \"object\") {\n throw new Error(\"Create sandbox failed: unexpected response shape\");\n }\n return {\n ...(raw ?? {}),\n createdAt: this.parseIsoDate(\"createdAt\", raw?.createdAt),\n expiresAt: this.parseIsoDate(\"expiresAt\", raw?.expiresAt),\n } as CreateSandboxResponse;\n }\n\n async getSandbox(sandboxId: SandboxId): Promise<SandboxInfo> {\n const { data, error, response } = await this.client.GET(\"/sandboxes/{sandboxId}\", {\n params: { path: { sandboxId } },\n });\n throwOnOpenApiFetchError({ error, response }, \"Get sandbox failed\");\n const ok = data as ApiGetSandboxOk | undefined;\n if (!ok || typeof ok !== \"object\") {\n throw new Error(\"Get sandbox failed: unexpected response shape\");\n }\n return this.mapSandboxInfo(ok);\n }\n\n async listSandboxes(params: ListSandboxesParams = {}): Promise<ListSandboxesResponse> {\n const query: Record<string, string | number | boolean | undefined | null | (string | number)[]> = {};\n if (params.states?.length) query.state = params.states;\n if (params.metadata && Object.keys(params.metadata).length) {\n query.metadata = encodeMetadataFilter(params.metadata);\n }\n if (params.page != null) query.page = params.page;\n if (params.pageSize != null) query.pageSize = params.pageSize;\n\n const { data, error, response } = await this.client.GET(\"/sandboxes\", {\n params: { query },\n });\n throwOnOpenApiFetchError({ error, response }, \"List sandboxes failed\");\n const raw = data as ApiListSandboxesOk | undefined;\n if (!raw || typeof raw !== \"object\") {\n throw new Error(\"List sandboxes failed: unexpected response shape\");\n }\n const itemsRaw = raw.items;\n if (!Array.isArray(itemsRaw)) throw new Error(\"List sandboxes failed: unexpected items shape\");\n return {\n ...(raw ?? {}),\n items: itemsRaw.map((x) => this.mapSandboxInfo(x)),\n } as ListSandboxesResponse;\n }\n\n async deleteSandbox(sandboxId: SandboxId): Promise<void> {\n const { error, response } = await this.client.DELETE(\"/sandboxes/{sandboxId}\", {\n params: { path: { sandboxId } },\n });\n throwOnOpenApiFetchError({ error, response }, \"Delete sandbox failed\");\n }\n\n async pauseSandbox(sandboxId: SandboxId): Promise<void> {\n const { error, response } = await this.client.POST(\"/sandboxes/{sandboxId}/pause\", {\n params: { path: { sandboxId } },\n });\n throwOnOpenApiFetchError({ error, response }, \"Pause sandbox failed\");\n }\n\n async resumeSandbox(sandboxId: SandboxId): Promise<void> {\n const { error, response } = await this.client.POST(\"/sandboxes/{sandboxId}/resume\", {\n params: { path: { sandboxId } },\n });\n throwOnOpenApiFetchError({ error, response }, \"Resume sandbox failed\");\n }\n\n async renewSandboxExpiration(\n sandboxId: SandboxId,\n req: RenewSandboxExpirationRequest,\n ): Promise<RenewSandboxExpirationResponse> {\n const body: ApiRenewSandboxExpirationRequest = req as unknown as ApiRenewSandboxExpirationRequest;\n const { data, error, response } = await this.client.POST(\"/sandboxes/{sandboxId}/renew-expiration\", {\n params: { path: { sandboxId } },\n body,\n });\n throwOnOpenApiFetchError({ error, response }, \"Renew sandbox expiration failed\");\n const raw = data as ApiRenewSandboxExpirationOk | undefined;\n if (!raw || typeof raw !== \"object\") {\n throw new Error(\"Renew sandbox expiration failed: unexpected response shape\");\n }\n return {\n ...(raw ?? {}),\n expiresAt: raw?.expiresAt ? this.parseIsoDate(\"expiresAt\", raw.expiresAt) : undefined,\n } as RenewSandboxExpirationResponse;\n }\n\n async getSandboxEndpoint(sandboxId: SandboxId, port: number): Promise<Endpoint> {\n const { data, error, response } = await this.client.GET(\"/sandboxes/{sandboxId}/endpoints/{port}\", {\n params: { path: { sandboxId, port } },\n });\n throwOnOpenApiFetchError({ error, response }, \"Get sandbox endpoint failed\");\n const ok = data as ApiEndpointOk | undefined;\n if (!ok || typeof ok !== \"object\") {\n throw new Error(\"Get sandbox endpoint failed: unexpected response shape\");\n }\n return ok as unknown as Endpoint;\n }\n}"],"mappings":";AA6BO,IAAM,eAAN,MAAmB;AAAA,EAOxB,YACW,MACA,SACT;AAFS;AACA;AAAA,EACR;AAAA,EATH,OAAgB,yBAA2C;AAAA,EAC3D,OAAgB,gBAAkC;AAAA,EAClD,OAAgB,YAA8B;AAAA,EAC9C,OAAgB,mBAAqC;AAAA,EACrD,OAAgB,sBAAwC;AAM1D;AAaO,IAAM,mBAAN,cAA+B,MAAM;AAAA,EACjC,OAAe;AAAA,EACf;AAAA,EACA;AAAA,EAET,YAAY,OAA6B,CAAC,GAAG;AAC3C,UAAM,KAAK,OAAO;AAClB,SAAK,QAAQ,KAAK;AAClB,SAAK,QAAQ,KAAK,SAAS,IAAI,aAAa,aAAa,sBAAsB;AAAA,EACjF;AACF;AAEO,IAAM,sBAAN,cAAkC,iBAAiB;AAAA,EAC/C,OAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,MAIT;AACD,UAAM;AAAA,MACJ,SAAS,KAAK;AAAA,MACd,OAAO,KAAK;AAAA,MACZ,OAAO,KAAK,SAAS,IAAI,aAAa,aAAa,qBAAqB,KAAK,OAAO;AAAA,IACtF,CAAC;AACD,SAAK,aAAa,KAAK;AACvB,SAAK,YAAY,KAAK;AACtB,SAAK,UAAU,KAAK;AAAA,EACtB;AACF;AAEO,IAAM,2BAAN,cAAuC,iBAAiB;AAAA,EACpD,OAAe;AAAA,EAExB,YAAY,MAA6C;AACvD,UAAM;AAAA,MACJ,SAAS,KAAK;AAAA,MACd,OAAO,KAAK;AAAA,MACZ,OAAO,IAAI,aAAa,aAAa,wBAAwB,KAAK,OAAO;AAAA,IAC3E,CAAC;AAAA,EACH;AACF;AAEO,IAAM,4BAAN,cAAwC,iBAAiB;AAAA,EACrD,OAAe;AAAA,EAExB,YAAY,MAA6C;AACvD,UAAM;AAAA,MACJ,SAAS,KAAK;AAAA,MACd,OAAO,KAA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MAClF,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE;AAAA,IAChC,CAAC;AACD,6BAAyB,EAAE,OAAO,SAAS,GAAG,uBAAuB;AAAA,EACvE;AAAA,EAEA,MAAM,uBACJ,WACA,KACyC;AACzC,UAAM,OAAyC;AAC/C,UAAM,EAAE,MAAM,OAAO,SAAS,IAAI,MAAM,KAAK,OAAO,KAAK,2CAA2C;AAAA,MAClG,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE;AAAA,MAC9B;AAAA,IACF,CAAC;AACD,6BAAyB,EAAE,OAAO,SAAS,GAAG,iCAAiC;AAC/E,UAAM,MAAM;AACZ,QAAI,CAAC,OAAO,OAAO,QAAQ,UAAU;AACnC,YAAM,IAAI,MAAM,4DAA4D;AAAA,IAC9E;AACA,WAAO;AAAA,MACL,GAAI,OAAO,CAAC;AAAA,MACZ,WAAW,KAAK,YAAY,KAAK,aAAa,aAAa,IAAI,SAAS,IAAI;AAAA,IAC9E;AAAA,EACF;AAAA,EAEA,MAAM,mBAAmB,WAAsB,MAAiC;AAC9E,UAAM,EAAE,MAAM,OAAO,SAAS,IAAI,MAAM,KAAK,OAAO,IAAI,2CAA2C;AAAA,MACjG,QAAQ,EAAE,MAAM,EAAE,WAAW,KAAK,EAAE;AAAA,IACtC,CAAC;AACD,6BAAyB,EAAE,OAAO,SAAS,GAAG,6BAA6B;AAC3E,UAAM,KAAK;AACX,QAAI,CAAC,MAAM,OAAO,OAAO,UAAU;AACjC,YAAM,IAAI,MAAM,wDAAwD;AAAA,IAC1E;AACA,WAAO;AAAA,EACT;AACF;","names":["createClient","joinUrl","res"]}
@@ -132,23 +132,10 @@ var InvalidArgumentException = class extends SandboxException {
132
132
  }
133
133
  };
134
134
 
135
- // src/openapi/createClient.ts
136
- var openapiFetch = __toESM(require("openapi-fetch"), 1);
137
- function resolveCreateClient() {
138
- const mod = openapiFetch;
139
- if (typeof mod.default === "function") {
140
- return mod.default;
141
- }
142
- if (typeof mod.createClient === "function") {
143
- return mod.createClient;
144
- }
145
- throw new TypeError("openapi-fetch createClient export not found");
146
- }
147
- var createClient = resolveCreateClient();
148
-
149
135
  // src/openapi/execdClient.ts
136
+ var import_openapi_fetch = __toESM(require("openapi-fetch"), 1);
150
137
  function createExecdClient(opts) {
151
- return createClient({
138
+ return (0, import_openapi_fetch.default)({
152
139
  baseUrl: opts.baseUrl,
153
140
  headers: opts.headers,
154
141
  fetch: opts.fetch
@@ -156,6 +143,7 @@ function createExecdClient(opts) {
156
143
  }
157
144
 
158
145
  // src/openapi/lifecycleClient.ts
146
+ var import_openapi_fetch2 = __toESM(require("openapi-fetch"), 1);
159
147
  function readEnvApiKey() {
160
148
  const env = globalThis?.process?.env;
161
149
  const v = env?.OPEN_SANDBOX_API_KEY;
@@ -169,7 +157,7 @@ function createLifecycleClient(opts = {}) {
169
157
  if (apiKey && !headers["OPEN-SANDBOX-API-KEY"]) {
170
158
  headers["OPEN-SANDBOX-API-KEY"] = apiKey;
171
159
  }
172
- return createClient({
160
+ return (0, import_openapi_fetch2.default)({
173
161
  baseUrl: opts.baseUrl ?? "http://localhost:8080/v1",
174
162
  headers,
175
163
  fetch: opts.fetch