@computesdk/orble 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -50,12 +50,22 @@ prefer.
50
50
  - `templateId` or `snapshotId`: an Orble snapshot to start the box from, one of yours or Orble's
51
51
  (`orble snapshots` lists them). The box is at least the snapshot's size.
52
52
  - `name`: the box's name.
53
+ - `keepAwake`: `true` turns off idle suspension, for a box that serves apps or runs work on its own.
53
54
 
54
55
  Commands and file operations run as `root`, from `/root`, by default. Set `user: 'agent'` (or `ORBLE_USER=agent`) to
55
56
  run them as the box's own user, from `/home/agent`, where SSH logins and agents work; a command's own `user` option,
56
57
  `'root'` or `'agent'`, overrides it. A command may run for up to 10 minutes; each output stream comes back as its last
57
58
  64 KiB. `readFile` and `writeFile` stream the whole file in one request, up to 4 GiB.
58
59
 
60
+ `getUrl({ port })` shares the port as an Orble token port and returns its address with `?orble_preview_token=<token>`,
61
+ so the URL opens for whoever holds it in a browser: Orble trades the query token for a cookie with a redirect. HTTP
62
+ clients without a cookie jar should send the token as an `X-Orble-Preview-Token` header to the bare address instead,
63
+ and a token port can't be returned as a `ws`/`wss` URL. `getUrl({ port, public: true })` opens it to anyone. Both need
64
+ an account that has added credit, and an account can share at most 20 ports this way.
65
+
66
+ `getUrl({ port, newToken: true })` gives a token port a new token and returns its new URL. URLs and cookies from the old
67
+ token stop working at once; WebSocket connections already open stay up. It throws if the port isn't shared by token.
68
+
59
69
  ## Snapshots and pause
60
70
 
61
71
  ```typescript
package/dist/index.js CHANGED
@@ -136,6 +136,7 @@ function createBody(options = {}) {
136
136
  const from = options.snapshotId ?? options.templateId;
137
137
  if (from) body.from = from;
138
138
  if (options.name) body.name = options.name;
139
+ if (options.keepAwake === true) body.keep_awake = true;
139
140
  return body;
140
141
  }
141
142
  function wrapCommand(command, options) {
@@ -236,13 +237,27 @@ var orble = (0, import_provider.defineProvider)({
236
237
  metadata: { state: current.state, hostname: current.hostname, vcpus: current.vcpus, memMiB: current.mem_mib, diskGiB: current.disk_gib }
237
238
  };
238
239
  },
239
- // Shares the port at its own https address: private (Orble sign-in) by default, public with `public: true`.
240
+ replacesUrlTokens: true,
241
+ // Shares the port at its own https address: public with `public: true`, otherwise a token port whose URL
242
+ // carries the token, so it opens for whoever holds the URL. `newToken: true` replaces an existing token port's
243
+ // token, so URLs handed out before stop working; it doesn't share a port that isn't shared by token yet.
240
244
  getUrl: async (sandbox, options) => {
241
- const data = await request(sandbox, "PUT", boxPath(sandbox.id, `/ports/${options.port}`), {
242
- access: options.public ? "public" : "private"
243
- });
244
- if (!data?.url) throw new Error(`Orble box ${sandbox.id} not found`);
245
- return options.protocol === "ws" || options.protocol === "wss" ? data.url.replace(/^https/, "wss") : data.url;
245
+ const ws = options.protocol === "ws" || options.protocol === "wss";
246
+ if (ws && !options.public) throw new Error(`Orble token ports can't be opened as WebSocket URLs; pass public: true or open the https URL in a browser`);
247
+ if (options.newToken && options.public) throw new Error(`A public Orble port has no token to replace`);
248
+ const port = boxPath(sandbox.id, `/ports/${options.port}`);
249
+ const data = options.newToken ? await request(sandbox, "POST", `${port}/token`, {}) : await request(sandbox, "PUT", port, { access: options.public ? "public" : "token" });
250
+ if (!data?.url) {
251
+ throw new Error(options.newToken ? `Orble box ${sandbox.id} has no token port ${options.port}` : `Orble box ${sandbox.id} not found`);
252
+ }
253
+ let url = data.url;
254
+ if (!options.public) {
255
+ if (!data.token) throw new Error(`Orble returned no token for port ${options.port} of box ${sandbox.id}`);
256
+ const signed = new URL(url);
257
+ signed.searchParams.set("orble_preview_token", data.token);
258
+ url = signed.toString();
259
+ }
260
+ return ws ? url.replace(/^https/, "wss") : url;
246
261
  },
247
262
  // Suspend keeps the box's memory and running programs; resume (or any command) wakes it where it was.
248
263
  pause: async (sandbox) => {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Orble Provider - Factory-based Implementation\n *\n * Linux VMs (\"boxes\") on Orble (https://orble.tech), with root through passwordless sudo and Docker inside. Orble's\n * REST API is a small JSON surface, so this package talks to it with `fetch` and has no SDK dependency.\n *\n * Commands run as the box's user, `agent`, from /home/agent. Files are read and written through the API's files\n * endpoint; mkdir, readdir, exists and remove run as shell commands.\n */\n\nimport { defineProvider, escapeShellArg, InstanceSizeError } from '@computesdk/provider';\n\nimport type {\n CommandResult,\n CreateInstanceOptions,\n CreateSnapshotOptions,\n FileEntry,\n InstanceInfo,\n ListSnapshotsOptions,\n ListTemplatesOptions,\n RunCommandOptions,\n} from '@computesdk/provider';\nimport type { Snapshot } from 'computesdk';\n\nexport interface OrbleConfig {\n /** Orble API key - if not provided, will fallback to ORBLE_API_KEY environment variable */\n apiKey?: string;\n /** API base URL - if not provided, will fallback to ORBLE_API_URL, then https://orble.tech */\n baseUrl?: string;\n /**\n * Who commands and file operations run as: `root` (the default, as on Daytona and Modal; relative paths start at\n * /root) or `agent`, the box's own user (relative paths start at /home/agent, where SSH logins and agents work).\n * Falls back to ORBLE_USER. A command's own `user` option overrides it.\n */\n user?: OrbleUser;\n}\n\nexport type OrbleUser = 'agent' | 'root';\n\n/** A box as Orble's API returns it. */\nexport interface OrbleBoxData {\n name: string;\n hostname: string;\n state: string;\n vcpus: number;\n mem_mib: number;\n disk_gib: number;\n created_at?: string;\n [key: string]: unknown;\n}\n\nexport interface OrbleSandbox {\n id: string;\n data: OrbleBoxData;\n apiKey: string;\n baseUrl: string;\n user?: OrbleUser;\n}\n\n/** A snapshot as Orble's API returns it. `gallery` marks one of Orble's own, which every account can start boxes from. */\nexport interface OrbleSnapshotData {\n name: string;\n alias?: string;\n box?: string;\n state: string;\n vcpus: number;\n mem_mib: number;\n disk_bytes?: number;\n created_at: string;\n gallery?: boolean;\n about?: string;\n}\n\ninterface ExecResponse {\n running?: boolean;\n job?: string;\n exit_code: number;\n stdout?: string;\n stderr?: string;\n}\n\ntype FsRunCommand = (sandbox: OrbleSandbox, command: string, options?: RunCommandOptions) => Promise<CommandResult>;\n\n// Orble's box sizes (vCPU / MiB): micro 1/2048, s 2/4096, m 4/8192, l 8/16384, each with a 64 GiB disk.\n// https://orble.tech/pricing\nconst ORBLE_DISK_MIB = 65536;\n\nexport const ORBLE_SIZES: Readonly<Record<string, { size: 'micro' | 's' | 'm' | 'l'; vcpus: number; memoryMiB: number }>> = Object.freeze({\n xs: { size: 'micro', vcpus: 1, memoryMiB: 2048 }, // memory is a floor, so the 1 vCPU / 2 GiB shape is also an xs\n sm: { size: 'micro', vcpus: 1, memoryMiB: 2048 },\n md: { size: 's', vcpus: 2, memoryMiB: 4096 },\n lg: { size: 'm', vcpus: 4, memoryMiB: 8192 },\n xl: { size: 'l', vcpus: 8, memoryMiB: 16384 },\n});\n\n// Orble stops a command after at most 600 s. Exec answers within about 50 s; a command still running then comes back\n// as a job, which exec() polls until it ends.\nconst EXEC_MAX_TIMEOUT_S = 600;\n\nfunction resolveConfig(config: OrbleConfig) {\n const env = typeof process !== 'undefined' ? process.env : undefined;\n const apiKey = config.apiKey || env?.ORBLE_API_KEY || '';\n if (!apiKey) {\n throw new Error(\n `Missing Orble API key. Provide 'apiKey' in config or set ORBLE_API_KEY environment variable. ` +\n `Create one at https://orble.tech/settings?tab=api`,\n );\n }\n const baseUrl = (config.baseUrl || env?.ORBLE_API_URL || 'https://orble.tech').replace(/\\/+$/, '');\n const user = config.user ?? ((env?.ORBLE_USER || undefined) as OrbleUser | undefined); // empty is unset\n if (user !== undefined && user !== 'agent' && user !== 'root') {\n throw new Error(`Orble user must be 'agent' or 'root', not '${user}'`);\n }\n return { apiKey, baseUrl, ...(user ? { user } : {}) };\n}\n\n/** The user one call runs as: the command's own `user` option, else the provider's. */\nfunction userFor(sandbox: OrbleSandbox, options?: RunCommandOptions): OrbleUser {\n const asked = (options as { user?: string } | undefined)?.user;\n return asked === 'root' || asked === 'agent' ? asked : sandbox.user ?? 'root';\n}\n\n// Calls the API. A 404 (a box that doesn't exist, or isn't the caller's) comes back as null; other errors throw.\nasync function request<T>(\n auth: { apiKey: string; baseUrl: string },\n method: string,\n path: string,\n body?: unknown,\n raw?: Uint8Array,\n): Promise<T | null> {\n const headers: Record<string, string> = { Authorization: `Bearer ${auth.apiKey}`, 'User-Agent': 'computesdk-orble' };\n let payload: BodyInit | undefined;\n if (raw) {\n payload = raw as BodyInit;\n headers['Content-Type'] = 'application/octet-stream';\n } else if (body !== undefined) {\n payload = JSON.stringify(body);\n headers['Content-Type'] = 'application/json';\n }\n const res = await fetch(`${auth.baseUrl}${path}`, { method, headers, body: payload });\n if (res.status === 404) return null;\n const text = await res.text();\n if (!res.ok) {\n let message = text.trim() || res.statusText;\n try {\n message = JSON.parse(text).error || message;\n } catch {}\n throw new Error(`Orble API error (${res.status}) on ${method} ${path}: ${message}`);\n }\n return (text ? JSON.parse(text) : null) as T | null;\n}\n\n/**\n * One raw file transfer: GET .../files?raw=1 for a whole file, or PUT with the raw body. Node's built-in fetch moves\n * these at about 6 MB/s from a workstation where node:https and curl move 40-48 MB/s (2026-11-23, 64 MiB), so in\n * Node this uses node:https; elsewhere it falls back to fetch. Returns the body, or null on 404.\n */\nasync function rawTransfer(sandbox: OrbleSandbox, method: 'GET' | 'PUT', path: string, body?: Buffer): Promise<Buffer | null> {\n const user = (sandbox.user ?? 'root') === 'root' ? '&user=root' : '';\n const url = `${sandbox.baseUrl}${boxPath(sandbox.id, `/files?path=${encodeURIComponent(path)}${method === 'GET' ? '&raw=1' : ''}${user}`)}`;\n const headers: Record<string, string> = { Authorization: `Bearer ${sandbox.apiKey}`, 'User-Agent': 'computesdk-orble' };\n if (body) {\n headers['Content-Type'] = 'application/octet-stream';\n headers['Content-Length'] = String(body.length);\n }\n const fail = (status: number, text: string): never => {\n let message = text.trim() || String(status);\n try {\n message = JSON.parse(text).error || message;\n } catch {}\n throw new Error(`Orble API error (${status}) on ${method} ${path}: ${message}`);\n };\n const https = typeof process !== 'undefined' && process.versions?.node ? await import('node:https').catch(() => null) : null;\n if (https && url.startsWith('https:')) {\n const { status, data } = await new Promise<{ status: number; data: Buffer }>((resolve, reject) => {\n const req = https.request(url, { method, headers }, (res) => {\n const parts: Buffer[] = [];\n res.on('data', (c: Buffer) => parts.push(c));\n res.on('end', () => resolve({ status: res.statusCode ?? 0, data: Buffer.concat(parts) }));\n res.on('error', reject);\n });\n req.on('error', reject);\n req.end(body);\n });\n if (status === 404) return null;\n if (status < 200 || status >= 300) fail(status, data.toString('utf8'));\n return data;\n }\n const res = await fetch(url, { method, headers, body: body as BodyInit | undefined });\n if (res.status === 404) return null;\n if (!res.ok) fail(res.status, await res.text());\n return Buffer.from(await res.arrayBuffer());\n}\n\nfunction toSandbox(auth: { apiKey: string; baseUrl: string; user?: OrbleUser }, data: OrbleBoxData): OrbleSandbox {\n return { id: data.name, data, ...auth };\n}\n\nconst boxPath = (name: string, sub = '') => `/v1/boxes/${encodeURIComponent(name)}${sub}`;\n\n/** Maps ComputeSDK's create options onto the body of POST /v1/boxes. */\nfunction createBody(options: CreateInstanceOptions = {}): Record<string, unknown> {\n const body: Record<string, unknown> = {};\n if (typeof options.size === 'string') body.size = options.size;\n const from = options.snapshotId ?? options.templateId;\n if (from) body.from = from;\n if (options.name) body.name = options.name;\n return body;\n}\n\nfunction wrapCommand(command: string, options?: RunCommandOptions): string {\n return options?.background ? `nohup sh -c \"${escapeShellArg(command)}\" >/dev/null 2>&1 &` : command;\n}\n\n// A leading dash would be read as an option by find, mkdir and rm.\nfunction shellPath(path: string): string {\n return `\"${escapeShellArg(path.startsWith('-') ? `./${path}` : path)}\"`;\n}\n\nasync function exec(sandbox: OrbleSandbox, command: string, options?: RunCommandOptions): Promise<ExecResponse> {\n const body: Record<string, unknown> = { command };\n if (options?.timeout) body.timeout_s = Math.min(EXEC_MAX_TIMEOUT_S, Math.ceil(options.timeout / 1000));\n if (options?.env && Object.keys(options.env).length > 0) body.env = options.env;\n if (options?.cwd) body.cwd = options.cwd;\n if (userFor(sandbox, options) === 'root') body.user = 'root';\n let data = await request<ExecResponse>(sandbox, 'POST', boxPath(sandbox.id, '/exec'), body);\n while (data?.running) data = await request<ExecResponse>(sandbox, 'POST', boxPath(sandbox.id, '/exec'), { job: data.job });\n if (!data) throw new Error(`Orble box ${sandbox.id} not found`);\n return data;\n}\n\n// Orble's states are creating, running, suspended, stopped, error, deleting and deleted. A suspended box wakes on the\n// next command, but it is not running until then.\nexport function infoStatus(state: string): InstanceInfo['status'] {\n if (state === 'running') return 'running';\n if (state === 'error') return 'error';\n return 'stopped';\n}\n\nfunction toSnapshot(data: OrbleSnapshotData): Snapshot {\n return {\n id: data.name,\n provider: 'orble',\n createdAt: new Date(data.created_at),\n metadata: {\n state: data.state,\n box: data.box,\n vcpus: data.vcpus,\n memMiB: data.mem_mib,\n diskBytes: data.disk_bytes,\n ...(data.alias && { alias: data.alias }),\n ...(data.gallery && { gallery: true, about: data.about }),\n },\n };\n}\n\nasync function listSnapshots(config: OrbleConfig): Promise<OrbleSnapshotData[]> {\n return (await request<OrbleSnapshotData[]>(resolveConfig(config), 'GET', '/v1/snapshots')) ?? [];\n}\n\n// Deleting a snapshot that doesn't exist (a 404) leaves nothing to do.\nasync function deleteSnapshot(config: OrbleConfig, name: string): Promise<void> {\n await request(resolveConfig(config), 'DELETE', `/v1/snapshots/${encodeURIComponent(name)}`);\n}\n\nasync function mustSucceed(run: FsRunCommand, sandbox: OrbleSandbox, command: string, what: string): Promise<CommandResult> {\n const result = await run(sandbox, command);\n if (result.exitCode !== 0) throw new Error(`Failed to ${what}: ${result.stderr.trim() || `exit code ${result.exitCode}`}`);\n return result;\n}\n\nexport const orble = defineProvider<OrbleSandbox, OrbleConfig>({\n name: 'orble',\n sizes: (_config, profile, options) => {\n if (options?.size !== undefined) throw new InstanceSizeError('conflict', 'cannot combine sizeClass with the native Orble size field');\n const shape = ORBLE_SIZES[profile.sizeClass];\n if (!shape) {\n return { status: 'unsupported', reason: `Orble has no ${profile.sizeClass} shape; it offers 1/2, 2/4, 4/8 and 8/16 (vCPU / GiB).` };\n }\n return { status: 'supported', nativeOptions: { size: shape.size }, resolved: { vcpus: shape.vcpus, memoryMiB: shape.memoryMiB, diskMiB: ORBLE_DISK_MIB } };\n },\n methods: {\n instances: {\n create: async (config: OrbleConfig, options?: CreateInstanceOptions) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData>(auth, 'POST', '/v1/boxes', createBody(options));\n if (!data) throw new Error('Orble API returned no box on create');\n return { instance: toSandbox(auth, data), instanceId: data.name };\n },\n\n getById: async (config: OrbleConfig, instanceId: string) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData>(auth, 'GET', boxPath(instanceId));\n return data ? { instance: toSandbox(auth, data), instanceId: data.name } : null;\n },\n\n list: async (config: OrbleConfig) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData[]>(auth, 'GET', '/v1/boxes');\n return (data ?? []).map((row) => ({ instance: toSandbox(auth, row), instanceId: row.name }));\n },\n\n destroy: async (config: OrbleConfig, instanceId: string) => {\n const auth = resolveConfig(config);\n await request(auth, 'DELETE', boxPath(instanceId));\n },\n\n runCommand: async (sandbox: OrbleSandbox, command: string, options?: RunCommandOptions): Promise<CommandResult> => {\n const start = Date.now();\n const data = await exec(sandbox, wrapCommand(command, options), options);\n return { stdout: data.stdout ?? '', stderr: data.stderr ?? '', exitCode: data.exit_code, durationMs: Date.now() - start };\n },\n\n getInfo: async (sandbox: OrbleSandbox): Promise<InstanceInfo> => {\n const data = await request<OrbleBoxData>(sandbox, 'GET', boxPath(sandbox.id));\n const current = data ?? { ...sandbox.data, state: 'deleted' };\n return {\n id: sandbox.id,\n provider: 'orble',\n status: infoStatus(current.state),\n createdAt: current.created_at ? new Date(current.created_at) : new Date(),\n timeout: 0,\n metadata: { state: current.state, hostname: current.hostname, vcpus: current.vcpus, memMiB: current.mem_mib, diskGiB: current.disk_gib },\n };\n },\n\n // Shares the port at its own https address: private (Orble sign-in) by default, public with `public: true`.\n getUrl: async (sandbox: OrbleSandbox, options: { port: number; protocol?: string; public?: boolean }): Promise<string> => {\n const data = await request<{ url: string }>(sandbox, 'PUT', boxPath(sandbox.id, `/ports/${options.port}`), {\n access: options.public ? 'public' : 'private',\n });\n if (!data?.url) throw new Error(`Orble box ${sandbox.id} not found`);\n return options.protocol === 'ws' || options.protocol === 'wss' ? data.url.replace(/^https/, 'wss') : data.url;\n },\n\n // Suspend keeps the box's memory and running programs; resume (or any command) wakes it where it was.\n pause: async (sandbox: OrbleSandbox): Promise<void> => {\n if (!(await request<OrbleBoxData>(sandbox, 'POST', boxPath(sandbox.id, '/suspend')))) throw new Error(`Orble box ${sandbox.id} not found`);\n },\n resume: async (sandbox: OrbleSandbox): Promise<OrbleSandbox> => {\n const data = await request<OrbleBoxData>(sandbox, 'POST', boxPath(sandbox.id, '/resume'));\n if (!data) throw new Error(`Orble box ${sandbox.id} not found`);\n return toSandbox(sandbox, data);\n },\n pauseCapabilities: { memory: true },\n\n getInstance: (sandbox: OrbleSandbox): OrbleSandbox => sandbox,\n\n filesystem: {\n // The whole file in one streamed response (raw=1), at any size up to the API's limit.\n readFile: async (sandbox: OrbleSandbox, path: string): Promise<string> => {\n const data = await rawTransfer(sandbox, 'GET', path);\n if (!data) throw new Error(`Failed to read ${path}: not found`);\n return data.toString('utf8');\n },\n // The raw body is streamed to the file, so large files go in one request.\n writeFile: async (sandbox: OrbleSandbox, path: string, content: string): Promise<void> => {\n if (!(await rawTransfer(sandbox, 'PUT', path, Buffer.from(content, 'utf8')))) throw new Error(`Failed to write ${path}: box not found`);\n },\n mkdir: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<void> => {\n await mustSucceed(run, sandbox, `mkdir -p ${shellPath(path)}`, `create ${path}`);\n },\n readdir: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<FileEntry[]> => {\n const result = await mustSucceed(run, sandbox, `find ${shellPath(path)} -mindepth 1 -maxdepth 1 -printf '%y\\\\t%s\\\\t%T@\\\\t%f\\\\n'`, `list ${path}`);\n return result.stdout\n .split('\\n')\n .filter(Boolean)\n .map((line) => {\n const [kind, size, modified, ...name] = line.split('\\t');\n return { name: name.join('\\t'), type: kind === 'd' ? ('directory' as const) : ('file' as const), size: Number(size), modified: new Date(Number(modified) * 1000) };\n });\n },\n exists: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<boolean> => {\n const result = await run(sandbox, `test -e ${shellPath(path)}`);\n return result.exitCode === 0;\n },\n remove: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<void> => {\n await mustSucceed(run, sandbox, `rm -rf ${shellPath(path)}`, `remove ${path}`);\n },\n },\n },\n\n snapshot: {\n // A snapshot keeps the box's disk, memory and running programs. A running box pauses briefly while it is taken,\n // then keeps running. A box started from it at the snapshot's size resumes where the snapshot was taken; at a\n // larger size it boots from the snapshot's disk. The API answers once the snapshot is ready.\n capabilities: { scope: 'rootfs', memory: true, destroysSource: false, source: 'kept', fork: true },\n create: async (config: OrbleConfig, instanceId: string, options?: CreateSnapshotOptions): Promise<Snapshot> => {\n const auth = resolveConfig(config);\n const data = await request<OrbleSnapshotData>(auth, 'POST', boxPath(instanceId, '/snapshot'), options?.name ? { name: options.name } : {});\n if (!data) throw new Error(`Orble box ${instanceId} not found`);\n return toSnapshot(data);\n },\n // The account's own snapshots; Orble's gallery snapshots are listed as templates.\n list: async (config: OrbleConfig, options?: ListSnapshotsOptions): Promise<Snapshot[]> => {\n const box = options?.instanceId ?? options?.sandboxId;\n const rows = (await listSnapshots(config)).filter((s) => !s.gallery && (!box || s.box === box));\n return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);\n },\n delete: deleteSnapshot,\n },\n\n // Orble starts boxes from snapshots, its own (the gallery) or the account's, so templates are snapshots.\n template: {\n create: async (): Promise<Snapshot> => {\n throw new Error('Orble has no template builds; make a template with snapshot.create() from a box you have set up.');\n },\n list: async (config: OrbleConfig, options?: ListTemplatesOptions): Promise<Snapshot[]> => {\n const rows = await listSnapshots(config);\n return rows.sl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G,SAAS,SAAS,KAAK,MAAM,EAAE,IAAI,UAAU;AAAA,MACpE;AAAA,MACA,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;AAED,IAAO,gBAAQ;","names":["res"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Orble Provider - Factory-based Implementation\n *\n * Linux VMs (\"boxes\") on Orble (https://orble.tech), with root through passwordless sudo and Docker inside. Orble's\n * REST API is a small JSON surface, so this package talks to it with `fetch` and has no SDK dependency.\n *\n * Commands run as the box's user, `agent`, from /home/agent. Files are read and written through the API's files\n * endpoint; mkdir, readdir, exists and remove run as shell commands.\n */\n\nimport { defineProvider, escapeShellArg, InstanceSizeError } from '@computesdk/provider';\n\nimport type {\n CommandResult,\n CreateInstanceOptions,\n CreateSnapshotOptions,\n FileEntry,\n InstanceInfo,\n ListSnapshotsOptions,\n ListTemplatesOptions,\n RunCommandOptions,\n} from '@computesdk/provider';\nimport type { Snapshot } from 'computesdk';\n\nexport interface OrbleConfig {\n /** Orble API key - if not provided, will fallback to ORBLE_API_KEY environment variable */\n apiKey?: string;\n /** API base URL - if not provided, will fallback to ORBLE_API_URL, then https://orble.tech */\n baseUrl?: string;\n /**\n * Who commands and file operations run as: `root` (the default, as on Daytona and Modal; relative paths start at\n * /root) or `agent`, the box's own user (relative paths start at /home/agent, where SSH logins and agents work).\n * Falls back to ORBLE_USER. A command's own `user` option overrides it.\n */\n user?: OrbleUser;\n}\n\nexport type OrbleUser = 'agent' | 'root';\n\n/** A box as Orble's API returns it. */\nexport interface OrbleBoxData {\n name: string;\n hostname: string;\n state: string;\n vcpus: number;\n mem_mib: number;\n disk_gib: number;\n created_at?: string;\n [key: string]: unknown;\n}\n\nexport interface OrbleSandbox {\n id: string;\n data: OrbleBoxData;\n apiKey: string;\n baseUrl: string;\n user?: OrbleUser;\n}\n\n/** A snapshot as Orble's API returns it. `gallery` marks one of Orble's own, which every account can start boxes from. */\nexport interface OrbleSnapshotData {\n name: string;\n alias?: string;\n box?: string;\n state: string;\n vcpus: number;\n mem_mib: number;\n disk_bytes?: number;\n created_at: string;\n gallery?: boolean;\n about?: string;\n}\n\ninterface ExecResponse {\n running?: boolean;\n job?: string;\n exit_code: number;\n stdout?: string;\n stderr?: string;\n}\n\ntype FsRunCommand = (sandbox: OrbleSandbox, command: string, options?: RunCommandOptions) => Promise<CommandResult>;\n\n// Orble's box sizes (vCPU / MiB): micro 1/2048, s 2/4096, m 4/8192, l 8/16384, each with a 64 GiB disk.\n// https://orble.tech/pricing\nconst ORBLE_DISK_MIB = 65536;\n\nexport const ORBLE_SIZES: Readonly<Record<string, { size: 'micro' | 's' | 'm' | 'l'; vcpus: number; memoryMiB: number }>> = Object.freeze({\n xs: { size: 'micro', vcpus: 1, memoryMiB: 2048 }, // memory is a floor, so the 1 vCPU / 2 GiB shape is also an xs\n sm: { size: 'micro', vcpus: 1, memoryMiB: 2048 },\n md: { size: 's', vcpus: 2, memoryMiB: 4096 },\n lg: { size: 'm', vcpus: 4, memoryMiB: 8192 },\n xl: { size: 'l', vcpus: 8, memoryMiB: 16384 },\n});\n\n// Orble stops a command after at most 600 s. Exec answers within about 50 s; a command still running then comes back\n// as a job, which exec() polls until it ends.\nconst EXEC_MAX_TIMEOUT_S = 600;\n\nfunction resolveConfig(config: OrbleConfig) {\n const env = typeof process !== 'undefined' ? process.env : undefined;\n const apiKey = config.apiKey || env?.ORBLE_API_KEY || '';\n if (!apiKey) {\n throw new Error(\n `Missing Orble API key. Provide 'apiKey' in config or set ORBLE_API_KEY environment variable. ` +\n `Create one at https://orble.tech/settings?tab=api`,\n );\n }\n const baseUrl = (config.baseUrl || env?.ORBLE_API_URL || 'https://orble.tech').replace(/\\/+$/, '');\n const user = config.user ?? ((env?.ORBLE_USER || undefined) as OrbleUser | undefined); // empty is unset\n if (user !== undefined && user !== 'agent' && user !== 'root') {\n throw new Error(`Orble user must be 'agent' or 'root', not '${user}'`);\n }\n return { apiKey, baseUrl, ...(user ? { user } : {}) };\n}\n\n/** The user one call runs as: the command's own `user` option, else the provider's. */\nfunction userFor(sandbox: OrbleSandbox, options?: RunCommandOptions): OrbleUser {\n const asked = (options as { user?: string } | undefined)?.user;\n return asked === 'root' || asked === 'agent' ? asked : sandbox.user ?? 'root';\n}\n\n// Calls the API. A 404 (a box that doesn't exist, or isn't the caller's) comes back as null; other errors throw.\nasync function request<T>(\n auth: { apiKey: string; baseUrl: string },\n method: string,\n path: string,\n body?: unknown,\n raw?: Uint8Array,\n): Promise<T | null> {\n const headers: Record<string, string> = { Authorization: `Bearer ${auth.apiKey}`, 'User-Agent': 'computesdk-orble' };\n let payload: BodyInit | undefined;\n if (raw) {\n payload = raw as BodyInit;\n headers['Content-Type'] = 'application/octet-stream';\n } else if (body !== undefined) {\n payload = JSON.stringify(body);\n headers['Content-Type'] = 'application/json';\n }\n const res = await fetch(`${auth.baseUrl}${path}`, { method, headers, body: payload });\n if (res.status === 404) return null;\n const text = await res.text();\n if (!res.ok) {\n let message = text.trim() || res.statusText;\n try {\n message = JSON.parse(text).error || message;\n } catch {}\n throw new Error(`Orble API error (${res.status}) on ${method} ${path}: ${message}`);\n }\n return (text ? JSON.parse(text) : null) as T | null;\n}\n\n/**\n * One raw file transfer: GET .../files?raw=1 for a whole file, or PUT with the raw body. Node's built-in fetch moves\n * these at about 6 MB/s from a workstation where node:https and curl move 40-48 MB/s (2026-11-23, 64 MiB), so in\n * Node this uses node:https; elsewhere it falls back to fetch. Returns the body, or null on 404.\n */\nasync function rawTransfer(sandbox: OrbleSandbox, method: 'GET' | 'PUT', path: string, body?: Buffer): Promise<Buffer | null> {\n const user = (sandbox.user ?? 'root') === 'root' ? '&user=root' : '';\n const url = `${sandbox.baseUrl}${boxPath(sandbox.id, `/files?path=${encodeURIComponent(path)}${method === 'GET' ? '&raw=1' : ''}${user}`)}`;\n const headers: Record<string, string> = { Authorization: `Bearer ${sandbox.apiKey}`, 'User-Agent': 'computesdk-orble' };\n if (body) {\n headers['Content-Type'] = 'application/octet-stream';\n headers['Content-Length'] = String(body.length);\n }\n const fail = (status: number, text: string): never => {\n let message = text.trim() || String(status);\n try {\n message = JSON.parse(text).error || message;\n } catch {}\n throw new Error(`Orble API error (${status}) on ${method} ${path}: ${message}`);\n };\n const https = typeof process !== 'undefined' && process.versions?.node ? await import('node:https').catch(() => null) : null;\n if (https && url.startsWith('https:')) {\n const { status, data } = await new Promise<{ status: number; data: Buffer }>((resolve, reject) => {\n const req = https.request(url, { method, headers }, (res) => {\n const parts: Buffer[] = [];\n res.on('data', (c: Buffer) => parts.push(c));\n res.on('end', () => resolve({ status: res.statusCode ?? 0, data: Buffer.concat(parts) }));\n res.on('error', reject);\n });\n req.on('error', reject);\n req.end(body);\n });\n if (status === 404) return null;\n if (status < 200 || status >= 300) fail(status, data.toString('utf8'));\n return data;\n }\n const res = await fetch(url, { method, headers, body: body as BodyInit | undefined });\n if (res.status === 404) return null;\n if (!res.ok) fail(res.status, await res.text());\n return Buffer.from(await res.arrayBuffer());\n}\n\nfunction toSandbox(auth: { apiKey: string; baseUrl: string; user?: OrbleUser }, data: OrbleBoxData): OrbleSandbox {\n return { id: data.name, data, ...auth };\n}\n\nconst boxPath = (name: string, sub = '') => `/v1/boxes/${encodeURIComponent(name)}${sub}`;\n\n/** Maps ComputeSDK's create options onto the body of POST /v1/boxes. */\nfunction createBody(options: CreateInstanceOptions = {}): Record<string, unknown> {\n const body: Record<string, unknown> = {};\n if (typeof options.size === 'string') body.size = options.size;\n const from = options.snapshotId ?? options.templateId;\n if (from) body.from = from;\n if (options.name) body.name = options.name;\n // Orble sets it before create returns, and deletes the box if that fails.\n if (options.keepAwake === true) body.keep_awake = true;\n return body;\n}\n\nfunction wrapCommand(command: string, options?: RunCommandOptions): string {\n return options?.background ? `nohup sh -c \"${escapeShellArg(command)}\" >/dev/null 2>&1 &` : command;\n}\n\n// A leading dash would be read as an option by find, mkdir and rm.\nfunction shellPath(path: string): string {\n return `\"${escapeShellArg(path.startsWith('-') ? `./${path}` : path)}\"`;\n}\n\nasync function exec(sandbox: OrbleSandbox, command: string, options?: RunCommandOptions): Promise<ExecResponse> {\n const body: Record<string, unknown> = { command };\n if (options?.timeout) body.timeout_s = Math.min(EXEC_MAX_TIMEOUT_S, Math.ceil(options.timeout / 1000));\n if (options?.env && Object.keys(options.env).length > 0) body.env = options.env;\n if (options?.cwd) body.cwd = options.cwd;\n if (userFor(sandbox, options) === 'root') body.user = 'root';\n let data = await request<ExecResponse>(sandbox, 'POST', boxPath(sandbox.id, '/exec'), body);\n while (data?.running) data = await request<ExecResponse>(sandbox, 'POST', boxPath(sandbox.id, '/exec'), { job: data.job });\n if (!data) throw new Error(`Orble box ${sandbox.id} not found`);\n return data;\n}\n\n// Orble's states are creating, running, suspended, stopped, error, deleting and deleted. A suspended box wakes on the\n// next command, but it is not running until then.\nexport function infoStatus(state: string): InstanceInfo['status'] {\n if (state === 'running') return 'running';\n if (state === 'error') return 'error';\n return 'stopped';\n}\n\nfunction toSnapshot(data: OrbleSnapshotData): Snapshot {\n return {\n id: data.name,\n provider: 'orble',\n createdAt: new Date(data.created_at),\n metadata: {\n state: data.state,\n box: data.box,\n vcpus: data.vcpus,\n memMiB: data.mem_mib,\n diskBytes: data.disk_bytes,\n ...(data.alias && { alias: data.alias }),\n ...(data.gallery && { gallery: true, about: data.about }),\n },\n };\n}\n\nasync function listSnapshots(config: OrbleConfig): Promise<OrbleSnapshotData[]> {\n return (await request<OrbleSnapshotData[]>(resolveConfig(config), 'GET', '/v1/snapshots')) ?? [];\n}\n\n// Deleting a snapshot that doesn't exist (a 404) leaves nothing to do.\nasync function deleteSnapshot(config: OrbleConfig, name: string): Promise<void> {\n await request(resolveConfig(config), 'DELETE', `/v1/snapshots/${encodeURIComponent(name)}`);\n}\n\nasync function mustSucceed(run: FsRunCommand, sandbox: OrbleSandbox, command: string, what: string): Promise<CommandResult> {\n const result = await run(sandbox, command);\n if (result.exitCode !== 0) throw new Error(`Failed to ${what}: ${result.stderr.trim() || `exit code ${result.exitCode}`}`);\n return result;\n}\n\nexport const orble = defineProvider<OrbleSandbox, OrbleConfig>({\n name: 'orble',\n sizes: (_config, profile, options) => {\n if (options?.size !== undefined) throw new InstanceSizeError('conflict', 'cannot combine sizeClass with the native Orble size field');\n const shape = ORBLE_SIZES[profile.sizeClass];\n if (!shape) {\n return { status: 'unsupported', reason: `Orble has no ${profile.sizeClass} shape; it offers 1/2, 2/4, 4/8 and 8/16 (vCPU / GiB).` };\n }\n return { status: 'supported', nativeOptions: { size: shape.size }, resolved: { vcpus: shape.vcpus, memoryMiB: shape.memoryMiB, diskMiB: ORBLE_DISK_MIB } };\n },\n methods: {\n instances: {\n create: async (config: OrbleConfig, options?: CreateInstanceOptions) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData>(auth, 'POST', '/v1/boxes', createBody(options));\n if (!data) throw new Error('Orble API returned no box on create');\n return { instance: toSandbox(auth, data), instanceId: data.name };\n },\n\n getById: async (config: OrbleConfig, instanceId: string) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData>(auth, 'GET', boxPath(instanceId));\n return data ? { instance: toSandbox(auth, data), instanceId: data.name } : null;\n },\n\n list: async (config: OrbleConfig) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData[]>(auth, 'GET', '/v1/boxes');\n return (data ?? []).map((row) => ({ instance: toSandbox(auth, row), instanceId: row.name }));\n },\n\n destroy: async (config: OrbleConfig, instanceId: string) => {\n const auth = resolveConfig(config);\n await request(auth, 'DELETE', boxPath(instanceId));\n },\n\n runCommand: async (sandbox: OrbleSandbox, command: string, options?: RunCommandOptions): Promise<CommandResult> => {\n const start = Date.now();\n const data = await exec(sandbox, wrapCommand(command, options), options);\n return { stdout: data.stdout ?? '', stderr: data.stderr ?? '', exitCode: data.exit_code, durationMs: Date.now() - start };\n },\n\n getInfo: async (sandbox: OrbleSandbox): Promise<InstanceInfo> => {\n const data = await request<OrbleBoxData>(sandbox, 'GET', boxPath(sandbox.id));\n const current = data ?? { ...sandbox.data, state: 'deleted' };\n return {\n id: sandbox.id,\n provider: 'orble',\n status: infoStatus(current.state),\n createdAt: current.created_at ? new Date(current.created_at) : new Date(),\n timeout: 0,\n metadata: { state: current.state, hostname: current.hostname, vcpus: current.vcpus, memMiB: current.mem_mib, diskGiB: current.disk_gib },\n };\n },\n\n replacesUrlTokens: true,\n\n // Shares the port at its own https address: public with `public: true`, otherwise a token port whose URL\n // carries the token, so it opens for whoever holds the URL. `newToken: true` replaces an existing token port's\n // token, so URLs handed out before stop working; it doesn't share a port that isn't shared by token yet.\n getUrl: async (\n sandbox: OrbleSandbox,\n options: { port: number; protocol?: string; public?: boolean; newToken?: boolean },\n ): Promise<string> => {\n const ws = options.protocol === 'ws' || options.protocol === 'wss';\n // Orble redeems a query token with a redirect, which a WebSocket handshake can't follow.\n if (ws && !options.public) throw new Error(`Orble token ports can't be opened as WebSocket URLs; pass public: true or open the https URL in a browser`);\n if (options.newToken && options.public) throw new Error(`A public Orble port has no token to replace`);\n const port = boxPath(sandbox.id, `/ports/${options.port}`);\n const data = options.newToken\n ? await request<{ url: string; token?: string }>(sandbox, 'POST', `${port}/token`, {})\n : await request<{ url: string; token?: string }>(sandbox, 'PUT', port, { access: options.public ? 'public' : 'token' });\n if (!data?.url) {\n throw new Error(options.newToken ? `Orble box ${sandbox.id} has no token port ${options.port}` : `Orble box ${sandbox.id} not found`);\n }\n let url = data.url;\n if (!options.public) {\n if (!data.token) throw new Error(`Orble returned no token for port ${options.port} of box ${sandbox.id}`);\n const signed = new URL(url);\n signed.searchParams.set('orble_preview_token', data.token);\n url = signed.toString();\n }\n return ws ? url.replace(/^https/, 'wss') : url;\n },\n\n // Suspend keeps the box's memory and running programs; resume (or any command) wakes it where it was.\n pause: async (sandbox: OrbleSandbox): Promise<void> => {\n if (!(await request<OrbleBoxData>(sandbox, 'POST', boxPath(sandbox.id, '/suspend')))) throw new Error(`Orble box ${sandbox.id} not found`);\n },\n resume: async (sandbox: OrbleSandbox): Promise<OrbleSandbox> => {\n const data = await request<OrbleBoxData>(sandbox, 'POST', boxPath(sandbox.id, '/resume'));\n if (!data) throw new Error(`Orble box ${sandbox.id} not found`);\n return toSandbox(sandbox, data);\n },\n pauseCapabilities: { memory: true },\n\n getInstance: (sandbox: OrbleSandbox): OrbleSandbox => sandbox,\n\n filesystem: {\n // The whole file in one streamed response (raw=1), at any size up to the API's limit.\n readFile: async (sandbox: OrbleSandbox, path: string): Promise<string> => {\n const data = await rawTransfer(sandbox, 'GET', path);\n if (!data) throw new Error(`Failed to read ${path}: not found`);\n return data.toString('utf8');\n },\n // The raw body is streamed to the file, so large files go in one request.\n writeFile: async (sandbox: OrbleSandbox, path: string, content: string): Promise<void> => {\n if (!(await rawTransfer(sandbox, 'PUT', path, Buffer.from(content, 'utf8')))) throw new Error(`Failed to write ${path}: box not found`);\n },\n mkdir: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<void> => {\n await mustSucceed(run, sandbox, `mkdir -p ${shellPath(path)}`, `create ${path}`);\n },\n readdir: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<FileEntry[]> => {\n const result = await mustSucceed(run, sandbox, `find ${shellPath(path)} -mindepth 1 -maxdepth 1 -printf '%y\\\\t%s\\\\t%T@\\\\t%f\\\\n'`, `list ${path}`);\n return result.stdout\n .split('\\n')\n .filter(Boolean)\n .map((line) => {\n const [kind, size, modified, ...name] = line.split('\\t');\n return { name: name.join('\\t'), type: kind === 'd' ? ('directory' as const) : ('file' as const), size: Number(size), modified: new Date(Number(modified) * 1000) };\n });\n },\n exists: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<boolean> => {\n const result = await run(sandbox, `test -e ${shellPath(path)}`);\n return result.exitCode === 0;\n },\n remove: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<void> => {\n await mustSucceed(run, sandbox, `rm -rf ${shellPath(path)}`, `remove ${path}`);\n },\n },\n },\n\n snapshot: {\n // A snapshot keeps the box's disk, memory and running programs. A running box pauses briefly while it is taken,\n // then keeps running. A box started from it at the snapshot's size resumes where the snapshot was taken; at a\n // larger size it boots from the snapshot's disk. The API answers once the snapshot is ready.\n capabilities: { scope: 'rootfs', memory: true, destroysSource: false, source: 'kept', fork: true },\n create: async (config: OrbleConfig, instanceId: string, options?: CreateSnapshotOptions): Promise<Snapshot> => {\n const auth = resolveConfig(config);\n const data = await request<OrbleSnapshotData>(auth, 'POST', boxPath(instanceId, '/snapshot'), options?.name ? { name: options.name } : {});\n if (!data) throw new Error(`Orble box ${instanceId} not found`);\n return toSnapshot(data);\n },\n // The account's own snapshots; Orble's gallery snapshots are listed as templates.\n list: async (config: OrbleConfig, options?: ListSnapshotsOptions): Promise<Snapshot[]> => {\n const box = options?.instanceId ?? options?.sandboxId;\n const rows = (await listSnapshots(config)).filter((s) => !s.gallery && (!box || s.box === box));\n return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);\n },\n delete: deleteSnapshot,\n },\n\n // Orble starts boxes from snapshots, its own (the gallery) or the account's, so templates are snapshots.\n template: {\n create: async (): Promise<Snapshot> => {\n throw new Error('Orble has no template builds; make a template with snapshot.create() from a box you have set up.');\n },\n list: async (config: OrbleConfig, options?: ListTemplatesOptions): Promise<Snapshot[]> => {\n const rows = await listSnapshots(config);\n return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);\n },\n delete: deleteSnapshot,\n },\n },\n});\n\nexport default orble;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAUA,sBAAkE;AA2ElE,IAAM,iBAAiB;AAEhB,IAAM,cAA+G,OAAO,OAAO;AAAA,EACxI,IAAI,EAAE,MAAM,SAAS,OAAO,GAAG,WAAW,KAAK;AAAA;AAAA,EAC/C,IAAI,EAAE,MAAM,SAAS,OAAO,GAAG,WAAW,KAAK;AAAA,EAC/C,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW,KAAK;AAAA,EAC3C,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A,IACV;AAAA;AAAA,IAGA,UAAU;AAAA,MACR,QAAQ,YAA+B;AACrC,cAAM,IAAI,MAAM,kGAAkG;AAAA,MACpH;AAAA,MACA,MAAM,OAAO,QAAqB,YAAwD;AACxF,cAAM,OAAO,MAAM,cAAc,MAAM;AACvC,eAAO,KAAK,MAAM,GAAG,SAAS,SAAS,KAAK,MAAM,EAAE,IAAI,UAAU;AAAA,MACpE;AAAA,MACA,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;AAED,IAAO,gBAAQ;","names":["res"]}
package/dist/index.mjs CHANGED
@@ -99,6 +99,7 @@ function createBody(options = {}) {
99
99
  const from = options.snapshotId ?? options.templateId;
100
100
  if (from) body.from = from;
101
101
  if (options.name) body.name = options.name;
102
+ if (options.keepAwake === true) body.keep_awake = true;
102
103
  return body;
103
104
  }
104
105
  function wrapCommand(command, options) {
@@ -199,13 +200,27 @@ var orble = defineProvider({
199
200
  metadata: { state: current.state, hostname: current.hostname, vcpus: current.vcpus, memMiB: current.mem_mib, diskGiB: current.disk_gib }
200
201
  };
201
202
  },
202
- // Shares the port at its own https address: private (Orble sign-in) by default, public with `public: true`.
203
+ replacesUrlTokens: true,
204
+ // Shares the port at its own https address: public with `public: true`, otherwise a token port whose URL
205
+ // carries the token, so it opens for whoever holds the URL. `newToken: true` replaces an existing token port's
206
+ // token, so URLs handed out before stop working; it doesn't share a port that isn't shared by token yet.
203
207
  getUrl: async (sandbox, options) => {
204
- const data = await request(sandbox, "PUT", boxPath(sandbox.id, `/ports/${options.port}`), {
205
- access: options.public ? "public" : "private"
206
- });
207
- if (!data?.url) throw new Error(`Orble box ${sandbox.id} not found`);
208
- return options.protocol === "ws" || options.protocol === "wss" ? data.url.replace(/^https/, "wss") : data.url;
208
+ const ws = options.protocol === "ws" || options.protocol === "wss";
209
+ if (ws && !options.public) throw new Error(`Orble token ports can't be opened as WebSocket URLs; pass public: true or open the https URL in a browser`);
210
+ if (options.newToken && options.public) throw new Error(`A public Orble port has no token to replace`);
211
+ const port = boxPath(sandbox.id, `/ports/${options.port}`);
212
+ const data = options.newToken ? await request(sandbox, "POST", `${port}/token`, {}) : await request(sandbox, "PUT", port, { access: options.public ? "public" : "token" });
213
+ if (!data?.url) {
214
+ throw new Error(options.newToken ? `Orble box ${sandbox.id} has no token port ${options.port}` : `Orble box ${sandbox.id} not found`);
215
+ }
216
+ let url = data.url;
217
+ if (!options.public) {
218
+ if (!data.token) throw new Error(`Orble returned no token for port ${options.port} of box ${sandbox.id}`);
219
+ const signed = new URL(url);
220
+ signed.searchParams.set("orble_preview_token", data.token);
221
+ url = signed.toString();
222
+ }
223
+ return ws ? url.replace(/^https/, "wss") : url;
209
224
  },
210
225
  // Suspend keeps the box's memory and running programs; resume (or any command) wakes it where it was.
211
226
  pause: async (sandbox) => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Orble Provider - Factory-based Implementation\n *\n * Linux VMs (\"boxes\") on Orble (https://orble.tech), with root through passwordless sudo and Docker inside. Orble's\n * REST API is a small JSON surface, so this package talks to it with `fetch` and has no SDK dependency.\n *\n * Commands run as the box's user, `agent`, from /home/agent. Files are read and written through the API's files\n * endpoint; mkdir, readdir, exists and remove run as shell commands.\n */\n\nimport { defineProvider, escapeShellArg, InstanceSizeError } from '@computesdk/provider';\n\nimport type {\n CommandResult,\n CreateInstanceOptions,\n CreateSnapshotOptions,\n FileEntry,\n InstanceInfo,\n ListSnapshotsOptions,\n ListTemplatesOptions,\n RunCommandOptions,\n} from '@computesdk/provider';\nimport type { Snapshot } from 'computesdk';\n\nexport interface OrbleConfig {\n /** Orble API key - if not provided, will fallback to ORBLE_API_KEY environment variable */\n apiKey?: string;\n /** API base URL - if not provided, will fallback to ORBLE_API_URL, then https://orble.tech */\n baseUrl?: string;\n /**\n * Who commands and file operations run as: `root` (the default, as on Daytona and Modal; relative paths start at\n * /root) or `agent`, the box's own user (relative paths start at /home/agent, where SSH logins and agents work).\n * Falls back to ORBLE_USER. A command's own `user` option overrides it.\n */\n user?: OrbleUser;\n}\n\nexport type OrbleUser = 'agent' | 'root';\n\n/** A box as Orble's API returns it. */\nexport interface OrbleBoxData {\n name: string;\n hostname: string;\n state: string;\n vcpus: number;\n mem_mib: number;\n disk_gib: number;\n created_at?: string;\n [key: string]: unknown;\n}\n\nexport interface OrbleSandbox {\n id: string;\n data: OrbleBoxData;\n apiKey: string;\n baseUrl: string;\n user?: OrbleUser;\n}\n\n/** A snapshot as Orble's API returns it. `gallery` marks one of Orble's own, which every account can start boxes from. */\nexport interface OrbleSnapshotData {\n name: string;\n alias?: string;\n box?: string;\n state: string;\n vcpus: number;\n mem_mib: number;\n disk_bytes?: number;\n created_at: string;\n gallery?: boolean;\n about?: string;\n}\n\ninterface ExecResponse {\n running?: boolean;\n job?: string;\n exit_code: number;\n stdout?: string;\n stderr?: string;\n}\n\ntype FsRunCommand = (sandbox: OrbleSandbox, command: string, options?: RunCommandOptions) => Promise<CommandResult>;\n\n// Orble's box sizes (vCPU / MiB): micro 1/2048, s 2/4096, m 4/8192, l 8/16384, each with a 64 GiB disk.\n// https://orble.tech/pricing\nconst ORBLE_DISK_MIB = 65536;\n\nexport const ORBLE_SIZES: Readonly<Record<string, { size: 'micro' | 's' | 'm' | 'l'; vcpus: number; memoryMiB: number }>> = Object.freeze({\n xs: { size: 'micro', vcpus: 1, memoryMiB: 2048 }, // memory is a floor, so the 1 vCPU / 2 GiB shape is also an xs\n sm: { size: 'micro', vcpus: 1, memoryMiB: 2048 },\n md: { size: 's', vcpus: 2, memoryMiB: 4096 },\n lg: { size: 'm', vcpus: 4, memoryMiB: 8192 },\n xl: { size: 'l', vcpus: 8, memoryMiB: 16384 },\n});\n\n// Orble stops a command after at most 600 s. Exec answers within about 50 s; a command still running then comes back\n// as a job, which exec() polls until it ends.\nconst EXEC_MAX_TIMEOUT_S = 600;\n\nfunction resolveConfig(config: OrbleConfig) {\n const env = typeof process !== 'undefined' ? process.env : undefined;\n const apiKey = config.apiKey || env?.ORBLE_API_KEY || '';\n if (!apiKey) {\n throw new Error(\n `Missing Orble API key. Provide 'apiKey' in config or set ORBLE_API_KEY environment variable. ` +\n `Create one at https://orble.tech/settings?tab=api`,\n );\n }\n const baseUrl = (config.baseUrl || env?.ORBLE_API_URL || 'https://orble.tech').replace(/\\/+$/, '');\n const user = config.user ?? ((env?.ORBLE_USER || undefined) as OrbleUser | undefined); // empty is unset\n if (user !== undefined && user !== 'agent' && user !== 'root') {\n throw new Error(`Orble user must be 'agent' or 'root', not '${user}'`);\n }\n return { apiKey, baseUrl, ...(user ? { user } : {}) };\n}\n\n/** The user one call runs as: the command's own `user` option, else the provider's. */\nfunction userFor(sandbox: OrbleSandbox, options?: RunCommandOptions): OrbleUser {\n const asked = (options as { user?: string } | undefined)?.user;\n return asked === 'root' || asked === 'agent' ? asked : sandbox.user ?? 'root';\n}\n\n// Calls the API. A 404 (a box that doesn't exist, or isn't the caller's) comes back as null; other errors throw.\nasync function request<T>(\n auth: { apiKey: string; baseUrl: string },\n method: string,\n path: string,\n body?: unknown,\n raw?: Uint8Array,\n): Promise<T | null> {\n const headers: Record<string, string> = { Authorization: `Bearer ${auth.apiKey}`, 'User-Agent': 'computesdk-orble' };\n let payload: BodyInit | undefined;\n if (raw) {\n payload = raw as BodyInit;\n headers['Content-Type'] = 'application/octet-stream';\n } else if (body !== undefined) {\n payload = JSON.stringify(body);\n headers['Content-Type'] = 'application/json';\n }\n const res = await fetch(`${auth.baseUrl}${path}`, { method, headers, body: payload });\n if (res.status === 404) return null;\n const text = await res.text();\n if (!res.ok) {\n let message = text.trim() || res.statusText;\n try {\n message = JSON.parse(text).error || message;\n } catch {}\n throw new Error(`Orble API error (${res.status}) on ${method} ${path}: ${message}`);\n }\n return (text ? JSON.parse(text) : null) as T | null;\n}\n\n/**\n * One raw file transfer: GET .../files?raw=1 for a whole file, or PUT with the raw body. Node's built-in fetch moves\n * these at about 6 MB/s from a workstation where node:https and curl move 40-48 MB/s (2026-11-23, 64 MiB), so in\n * Node this uses node:https; elsewhere it falls back to fetch. Returns the body, or null on 404.\n */\nasync function rawTransfer(sandbox: OrbleSandbox, method: 'GET' | 'PUT', path: string, body?: Buffer): Promise<Buffer | null> {\n const user = (sandbox.user ?? 'root') === 'root' ? '&user=root' : '';\n const url = `${sandbox.baseUrl}${boxPath(sandbox.id, `/files?path=${encodeURIComponent(path)}${method === 'GET' ? '&raw=1' : ''}${user}`)}`;\n const headers: Record<string, string> = { Authorization: `Bearer ${sandbox.apiKey}`, 'User-Agent': 'computesdk-orble' };\n if (body) {\n headers['Content-Type'] = 'application/octet-stream';\n headers['Content-Length'] = String(body.length);\n }\n const fail = (status: number, text: string): never => {\n let message = text.trim() || String(status);\n try {\n message = JSON.parse(text).error || message;\n } catch {}\n throw new Error(`Orble API error (${status}) on ${method} ${path}: ${message}`);\n };\n const https = typeof process !== 'undefined' && process.versions?.node ? await import('node:https').catch(() => null) : null;\n if (https && url.startsWith('https:')) {\n const { status, data } = await new Promise<{ status: number; data: Buffer }>((resolve, reject) => {\n const req = https.request(url, { method, headers }, (res) => {\n const parts: Buffer[] = [];\n res.on('data', (c: Buffer) => parts.push(c));\n res.on('end', () => resolve({ status: res.statusCode ?? 0, data: Buffer.concat(parts) }));\n res.on('error', reject);\n });\n req.on('error', reject);\n req.end(body);\n });\n if (status === 404) return null;\n if (status < 200 || status >= 300) fail(status, data.toString('utf8'));\n return data;\n }\n const res = await fetch(url, { method, headers, body: body as BodyInit | undefined });\n if (res.status === 404) return null;\n if (!res.ok) fail(res.status, await res.text());\n return Buffer.from(await res.arrayBuffer());\n}\n\nfunction toSandbox(auth: { apiKey: string; baseUrl: string; user?: OrbleUser }, data: OrbleBoxData): OrbleSandbox {\n return { id: data.name, data, ...auth };\n}\n\nconst boxPath = (name: string, sub = '') => `/v1/boxes/${encodeURIComponent(name)}${sub}`;\n\n/** Maps ComputeSDK's create options onto the body of POST /v1/boxes. */\nfunction createBody(options: CreateInstanceOptions = {}): Record<string, unknown> {\n const body: Record<string, unknown> = {};\n if (typeof options.size === 'string') body.size = options.size;\n const from = options.snapshotId ?? options.templateId;\n if (from) body.from = from;\n if (options.name) body.name = options.name;\n return body;\n}\n\nfunction wrapCommand(command: string, options?: RunCommandOptions): string {\n return options?.background ? `nohup sh -c \"${escapeShellArg(command)}\" >/dev/null 2>&1 &` : command;\n}\n\n// A leading dash would be read as an option by find, mkdir and rm.\nfunction shellPath(path: string): string {\n return `\"${escapeShellArg(path.startsWith('-') ? `./${path}` : path)}\"`;\n}\n\nasync function exec(sandbox: OrbleSandbox, command: string, options?: RunCommandOptions): Promise<ExecResponse> {\n const body: Record<string, unknown> = { command };\n if (options?.timeout) body.timeout_s = Math.min(EXEC_MAX_TIMEOUT_S, Math.ceil(options.timeout / 1000));\n if (options?.env && Object.keys(options.env).length > 0) body.env = options.env;\n if (options?.cwd) body.cwd = options.cwd;\n if (userFor(sandbox, options) === 'root') body.user = 'root';\n let data = await request<ExecResponse>(sandbox, 'POST', boxPath(sandbox.id, '/exec'), body);\n while (data?.running) data = await request<ExecResponse>(sandbox, 'POST', boxPath(sandbox.id, '/exec'), { job: data.job });\n if (!data) throw new Error(`Orble box ${sandbox.id} not found`);\n return data;\n}\n\n// Orble's states are creating, running, suspended, stopped, error, deleting and deleted. A suspended box wakes on the\n// next command, but it is not running until then.\nexport function infoStatus(state: string): InstanceInfo['status'] {\n if (state === 'running') return 'running';\n if (state === 'error') return 'error';\n return 'stopped';\n}\n\nfunction toSnapshot(data: OrbleSnapshotData): Snapshot {\n return {\n id: data.name,\n provider: 'orble',\n createdAt: new Date(data.created_at),\n metadata: {\n state: data.state,\n box: data.box,\n vcpus: data.vcpus,\n memMiB: data.mem_mib,\n diskBytes: data.disk_bytes,\n ...(data.alias && { alias: data.alias }),\n ...(data.gallery && { gallery: true, about: data.about }),\n },\n };\n}\n\nasync function listSnapshots(config: OrbleConfig): Promise<OrbleSnapshotData[]> {\n return (await request<OrbleSnapshotData[]>(resolveConfig(config), 'GET', '/v1/snapshots')) ?? [];\n}\n\n// Deleting a snapshot that doesn't exist (a 404) leaves nothing to do.\nasync function deleteSnapshot(config: OrbleConfig, name: string): Promise<void> {\n await request(resolveConfig(config), 'DELETE', `/v1/snapshots/${encodeURIComponent(name)}`);\n}\n\nasync function mustSucceed(run: FsRunCommand, sandbox: OrbleSandbox, command: string, what: string): Promise<CommandResult> {\n const result = await run(sandbox, command);\n if (result.exitCode !== 0) throw new Error(`Failed to ${what}: ${result.stderr.trim() || `exit code ${result.exitCode}`}`);\n return result;\n}\n\nexport const orble = defineProvider<OrbleSandbox, OrbleConfig>({\n name: 'orble',\n sizes: (_config, profile, options) => {\n if (options?.size !== undefined) throw new InstanceSizeError('conflict', 'cannot combine sizeClass with the native Orble size field');\n const shape = ORBLE_SIZES[profile.sizeClass];\n if (!shape) {\n return { status: 'unsupported', reason: `Orble has no ${profile.sizeClass} shape; it offers 1/2, 2/4, 4/8 and 8/16 (vCPU / GiB).` };\n }\n return { status: 'supported', nativeOptions: { size: shape.size }, resolved: { vcpus: shape.vcpus, memoryMiB: shape.memoryMiB, diskMiB: ORBLE_DISK_MIB } };\n },\n methods: {\n instances: {\n create: async (config: OrbleConfig, options?: CreateInstanceOptions) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData>(auth, 'POST', '/v1/boxes', createBody(options));\n if (!data) throw new Error('Orble API returned no box on create');\n return { instance: toSandbox(auth, data), instanceId: data.name };\n },\n\n getById: async (config: OrbleConfig, instanceId: string) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData>(auth, 'GET', boxPath(instanceId));\n return data ? { instance: toSandbox(auth, data), instanceId: data.name } : null;\n },\n\n list: async (config: OrbleConfig) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData[]>(auth, 'GET', '/v1/boxes');\n return (data ?? []).map((row) => ({ instance: toSandbox(auth, row), instanceId: row.name }));\n },\n\n destroy: async (config: OrbleConfig, instanceId: string) => {\n const auth = resolveConfig(config);\n await request(auth, 'DELETE', boxPath(instanceId));\n },\n\n runCommand: async (sandbox: OrbleSandbox, command: string, options?: RunCommandOptions): Promise<CommandResult> => {\n const start = Date.now();\n const data = await exec(sandbox, wrapCommand(command, options), options);\n return { stdout: data.stdout ?? '', stderr: data.stderr ?? '', exitCode: data.exit_code, durationMs: Date.now() - start };\n },\n\n getInfo: async (sandbox: OrbleSandbox): Promise<InstanceInfo> => {\n const data = await request<OrbleBoxData>(sandbox, 'GET', boxPath(sandbox.id));\n const current = data ?? { ...sandbox.data, state: 'deleted' };\n return {\n id: sandbox.id,\n provider: 'orble',\n status: infoStatus(current.state),\n createdAt: current.created_at ? new Date(current.created_at) : new Date(),\n timeout: 0,\n metadata: { state: current.state, hostname: current.hostname, vcpus: current.vcpus, memMiB: current.mem_mib, diskGiB: current.disk_gib },\n };\n },\n\n // Shares the port at its own https address: private (Orble sign-in) by default, public with `public: true`.\n getUrl: async (sandbox: OrbleSandbox, options: { port: number; protocol?: string; public?: boolean }): Promise<string> => {\n const data = await request<{ url: string }>(sandbox, 'PUT', boxPath(sandbox.id, `/ports/${options.port}`), {\n access: options.public ? 'public' : 'private',\n });\n if (!data?.url) throw new Error(`Orble box ${sandbox.id} not found`);\n return options.protocol === 'ws' || options.protocol === 'wss' ? data.url.replace(/^https/, 'wss') : data.url;\n },\n\n // Suspend keeps the box's memory and running programs; resume (or any command) wakes it where it was.\n pause: async (sandbox: OrbleSandbox): Promise<void> => {\n if (!(await request<OrbleBoxData>(sandbox, 'POST', boxPath(sandbox.id, '/suspend')))) throw new Error(`Orble box ${sandbox.id} not found`);\n },\n resume: async (sandbox: OrbleSandbox): Promise<OrbleSandbox> => {\n const data = await request<OrbleBoxData>(sandbox, 'POST', boxPath(sandbox.id, '/resume'));\n if (!data) throw new Error(`Orble box ${sandbox.id} not found`);\n return toSandbox(sandbox, data);\n },\n pauseCapabilities: { memory: true },\n\n getInstance: (sandbox: OrbleSandbox): OrbleSandbox => sandbox,\n\n filesystem: {\n // The whole file in one streamed response (raw=1), at any size up to the API's limit.\n readFile: async (sandbox: OrbleSandbox, path: string): Promise<string> => {\n const data = await rawTransfer(sandbox, 'GET', path);\n if (!data) throw new Error(`Failed to read ${path}: not found`);\n return data.toString('utf8');\n },\n // The raw body is streamed to the file, so large files go in one request.\n writeFile: async (sandbox: OrbleSandbox, path: string, content: string): Promise<void> => {\n if (!(await rawTransfer(sandbox, 'PUT', path, Buffer.from(content, 'utf8')))) throw new Error(`Failed to write ${path}: box not found`);\n },\n mkdir: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<void> => {\n await mustSucceed(run, sandbox, `mkdir -p ${shellPath(path)}`, `create ${path}`);\n },\n readdir: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<FileEntry[]> => {\n const result = await mustSucceed(run, sandbox, `find ${shellPath(path)} -mindepth 1 -maxdepth 1 -printf '%y\\\\t%s\\\\t%T@\\\\t%f\\\\n'`, `list ${path}`);\n return result.stdout\n .split('\\n')\n .filter(Boolean)\n .map((line) => {\n const [kind, size, modified, ...name] = line.split('\\t');\n return { name: name.join('\\t'), type: kind === 'd' ? ('directory' as const) : ('file' as const), size: Number(size), modified: new Date(Number(modified) * 1000) };\n });\n },\n exists: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<boolean> => {\n const result = await run(sandbox, `test -e ${shellPath(path)}`);\n return result.exitCode === 0;\n },\n remove: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<void> => {\n await mustSucceed(run, sandbox, `rm -rf ${shellPath(path)}`, `remove ${path}`);\n },\n },\n },\n\n snapshot: {\n // A snapshot keeps the box's disk, memory and running programs. A running box pauses briefly while it is taken,\n // then keeps running. A box started from it at the snapshot's size resumes where the snapshot was taken; at a\n // larger size it boots from the snapshot's disk. The API answers once the snapshot is ready.\n capabilities: { scope: 'rootfs', memory: true, destroysSource: false, source: 'kept', fork: true },\n create: async (config: OrbleConfig, instanceId: string, options?: CreateSnapshotOptions): Promise<Snapshot> => {\n const auth = resolveConfig(config);\n const data = await request<OrbleSnapshotData>(auth, 'POST', boxPath(instanceId, '/snapshot'), options?.name ? { name: options.name } : {});\n if (!data) throw new Error(`Orble box ${instanceId} not found`);\n return toSnapshot(data);\n },\n // The account's own snapshots; Orble's gallery snapshots are listed as templates.\n list: async (config: OrbleConfig, options?: ListSnapshotsOptions): Promise<Snapshot[]> => {\n const box = options?.instanceId ?? options?.sandboxId;\n const rows = (await listSnapshots(config)).filter((s) => !s.gallery && (!box || s.box === box));\n return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);\n },\n delete: deleteSnapshot,\n },\n\n // Orble starts boxes from snapshots, its own (the gallery) or the account's, so templates are snapshots.\n template: {\n create: async (): Promise<Snapshot> => {\n throw new Error('Orble has no template builds; make a template with snapshot.create() from a box you have set up.');\n },\n list: async (config: OrbleConfig, options?: ListTemplatesOptions): Promise<Snapshot[]> => {\n const rows = await listSnapshots(config);\n return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);\n },\n delete: deleteSnapshot,\n },\n },\n});\n\nexport default orble;\n"],"mappings":";AAUA,SAAS,gBAAgB,gBAAgB,yBAAyB;AA2ElE,IAAM,iBAAiB;AAEhB,IAAM,cAA+G,OAAO,OAAO;AAAA,EACxI,IAAI,EAAE,MAAM,SAAS,OAAO,GAAG,WAAW,KAAK;AAAA;AAAA,EAC/C,IAAI,EAAE,MAAM,SAAS,OAAO,GAAG,WAAW,KAAK;AAAA,EAC/C,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW,KAAK;AAAA,EAC3C,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW,KAAK;AAAA,EAC3C,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW,MAAM;AAC9C,CAAC;AAID,IAAM,qBAAqB;AAE3B,SAAS,cAAc,QAAqB;AAC1C,QAAM,MAAM,OAAO,YAAY,cAAc,QAAQ,MAAM;AAC3D,QAAM,SAAS,OAAO,UAAU,KAAK,iBAAiB;AACtD,MAAI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AA,MACxB;AAAA;AAAA,MAEA,MAAM,OAAO,QAAqB,YAAwD;AACxF,cAAM,MAAM,SAAS,cAAc,SAAS;AAC5C,cAAM,QAAQ,MAAM,cAAc,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,OAAO,EAAE,QAAQ,IAAI;AAC9F,eAAO,KAAK,MAAM,GAAG,SAAS,SAAS,KAAK,MAAM,EAAE,IAAI,UAAU;AAAA,MACpE;AAAA,MACA,QAAQ;AAAA,IACV;AAAA;AAAA,IAGA,UAAU;AAAA,MACR,QAAQ,YAA+B;AACrC,cAAM,IAAI,MAAM,kGAAkG;AAAA,MACpH;AAAA,MACA,MAAM,OAAO,QAAqB,YAAwD;AACxF,cAAM,OAAO,MAAM,cAAc,MAAM;AACvC,eAAO,KAAK,MAAM,GAAG,SAAS,SAAS,KAAK,MAAM,EAAE,IAAI,UAAU;AAAA,MACpE;AAAA,MACA,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;AAED,IAAO,gBAAQ;","names":["res"]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * Orble Provider - Factory-based Implementation\n *\n * Linux VMs (\"boxes\") on Orble (https://orble.tech), with root through passwordless sudo and Docker inside. Orble's\n * REST API is a small JSON surface, so this package talks to it with `fetch` and has no SDK dependency.\n *\n * Commands run as the box's user, `agent`, from /home/agent. Files are read and written through the API's files\n * endpoint; mkdir, readdir, exists and remove run as shell commands.\n */\n\nimport { defineProvider, escapeShellArg, InstanceSizeError } from '@computesdk/provider';\n\nimport type {\n CommandResult,\n CreateInstanceOptions,\n CreateSnapshotOptions,\n FileEntry,\n InstanceInfo,\n ListSnapshotsOptions,\n ListTemplatesOptions,\n RunCommandOptions,\n} from '@computesdk/provider';\nimport type { Snapshot } from 'computesdk';\n\nexport interface OrbleConfig {\n /** Orble API key - if not provided, will fallback to ORBLE_API_KEY environment variable */\n apiKey?: string;\n /** API base URL - if not provided, will fallback to ORBLE_API_URL, then https://orble.tech */\n baseUrl?: string;\n /**\n * Who commands and file operations run as: `root` (the default, as on Daytona and Modal; relative paths start at\n * /root) or `agent`, the box's own user (relative paths start at /home/agent, where SSH logins and agents work).\n * Falls back to ORBLE_USER. A command's own `user` option overrides it.\n */\n user?: OrbleUser;\n}\n\nexport type OrbleUser = 'agent' | 'root';\n\n/** A box as Orble's API returns it. */\nexport interface OrbleBoxData {\n name: string;\n hostname: string;\n state: string;\n vcpus: number;\n mem_mib: number;\n disk_gib: number;\n created_at?: string;\n [key: string]: unknown;\n}\n\nexport interface OrbleSandbox {\n id: string;\n data: OrbleBoxData;\n apiKey: string;\n baseUrl: string;\n user?: OrbleUser;\n}\n\n/** A snapshot as Orble's API returns it. `gallery` marks one of Orble's own, which every account can start boxes from. */\nexport interface OrbleSnapshotData {\n name: string;\n alias?: string;\n box?: string;\n state: string;\n vcpus: number;\n mem_mib: number;\n disk_bytes?: number;\n created_at: string;\n gallery?: boolean;\n about?: string;\n}\n\ninterface ExecResponse {\n running?: boolean;\n job?: string;\n exit_code: number;\n stdout?: string;\n stderr?: string;\n}\n\ntype FsRunCommand = (sandbox: OrbleSandbox, command: string, options?: RunCommandOptions) => Promise<CommandResult>;\n\n// Orble's box sizes (vCPU / MiB): micro 1/2048, s 2/4096, m 4/8192, l 8/16384, each with a 64 GiB disk.\n// https://orble.tech/pricing\nconst ORBLE_DISK_MIB = 65536;\n\nexport const ORBLE_SIZES: Readonly<Record<string, { size: 'micro' | 's' | 'm' | 'l'; vcpus: number; memoryMiB: number }>> = Object.freeze({\n xs: { size: 'micro', vcpus: 1, memoryMiB: 2048 }, // memory is a floor, so the 1 vCPU / 2 GiB shape is also an xs\n sm: { size: 'micro', vcpus: 1, memoryMiB: 2048 },\n md: { size: 's', vcpus: 2, memoryMiB: 4096 },\n lg: { size: 'm', vcpus: 4, memoryMiB: 8192 },\n xl: { size: 'l', vcpus: 8, memoryMiB: 16384 },\n});\n\n// Orble stops a command after at most 600 s. Exec answers within about 50 s; a command still running then comes back\n// as a job, which exec() polls until it ends.\nconst EXEC_MAX_TIMEOUT_S = 600;\n\nfunction resolveConfig(config: OrbleConfig) {\n const env = typeof process !== 'undefined' ? process.env : undefined;\n const apiKey = config.apiKey || env?.ORBLE_API_KEY || '';\n if (!apiKey) {\n throw new Error(\n `Missing Orble API key. Provide 'apiKey' in config or set ORBLE_API_KEY environment variable. ` +\n `Create one at https://orble.tech/settings?tab=api`,\n );\n }\n const baseUrl = (config.baseUrl || env?.ORBLE_API_URL || 'https://orble.tech').replace(/\\/+$/, '');\n const user = config.user ?? ((env?.ORBLE_USER || undefined) as OrbleUser | undefined); // empty is unset\n if (user !== undefined && user !== 'agent' && user !== 'root') {\n throw new Error(`Orble user must be 'agent' or 'root', not '${user}'`);\n }\n return { apiKey, baseUrl, ...(user ? { user } : {}) };\n}\n\n/** The user one call runs as: the command's own `user` option, else the provider's. */\nfunction userFor(sandbox: OrbleSandbox, options?: RunCommandOptions): OrbleUser {\n const asked = (options as { user?: string } | undefined)?.user;\n return asked === 'root' || asked === 'agent' ? asked : sandbox.user ?? 'root';\n}\n\n// Calls the API. A 404 (a box that doesn't exist, or isn't the caller's) comes back as null; other errors throw.\nasync function request<T>(\n auth: { apiKey: string; baseUrl: string },\n method: string,\n path: string,\n body?: unknown,\n raw?: Uint8Array,\n): Promise<T | null> {\n const headers: Record<string, string> = { Authorization: `Bearer ${auth.apiKey}`, 'User-Agent': 'computesdk-orble' };\n let payload: BodyInit | undefined;\n if (raw) {\n payload = raw as BodyInit;\n headers['Content-Type'] = 'application/octet-stream';\n } else if (body !== undefined) {\n payload = JSON.stringify(body);\n headers['Content-Type'] = 'application/json';\n }\n const res = await fetch(`${auth.baseUrl}${path}`, { method, headers, body: payload });\n if (res.status === 404) return null;\n const text = await res.text();\n if (!res.ok) {\n let message = text.trim() || res.statusText;\n try {\n message = JSON.parse(text).error || message;\n } catch {}\n throw new Error(`Orble API error (${res.status}) on ${method} ${path}: ${message}`);\n }\n return (text ? JSON.parse(text) : null) as T | null;\n}\n\n/**\n * One raw file transfer: GET .../files?raw=1 for a whole file, or PUT with the raw body. Node's built-in fetch moves\n * these at about 6 MB/s from a workstation where node:https and curl move 40-48 MB/s (2026-11-23, 64 MiB), so in\n * Node this uses node:https; elsewhere it falls back to fetch. Returns the body, or null on 404.\n */\nasync function rawTransfer(sandbox: OrbleSandbox, method: 'GET' | 'PUT', path: string, body?: Buffer): Promise<Buffer | null> {\n const user = (sandbox.user ?? 'root') === 'root' ? '&user=root' : '';\n const url = `${sandbox.baseUrl}${boxPath(sandbox.id, `/files?path=${encodeURIComponent(path)}${method === 'GET' ? '&raw=1' : ''}${user}`)}`;\n const headers: Record<string, string> = { Authorization: `Bearer ${sandbox.apiKey}`, 'User-Agent': 'computesdk-orble' };\n if (body) {\n headers['Content-Type'] = 'application/octet-stream';\n headers['Content-Length'] = String(body.length);\n }\n const fail = (status: number, text: string): never => {\n let message = text.trim() || String(status);\n try {\n message = JSON.parse(text).error || message;\n } catch {}\n throw new Error(`Orble API error (${status}) on ${method} ${path}: ${message}`);\n };\n const https = typeof process !== 'undefined' && process.versions?.node ? await import('node:https').catch(() => null) : null;\n if (https && url.startsWith('https:')) {\n const { status, data } = await new Promise<{ status: number; data: Buffer }>((resolve, reject) => {\n const req = https.request(url, { method, headers }, (res) => {\n const parts: Buffer[] = [];\n res.on('data', (c: Buffer) => parts.push(c));\n res.on('end', () => resolve({ status: res.statusCode ?? 0, data: Buffer.concat(parts) }));\n res.on('error', reject);\n });\n req.on('error', reject);\n req.end(body);\n });\n if (status === 404) return null;\n if (status < 200 || status >= 300) fail(status, data.toString('utf8'));\n return data;\n }\n const res = await fetch(url, { method, headers, body: body as BodyInit | undefined });\n if (res.status === 404) return null;\n if (!res.ok) fail(res.status, await res.text());\n return Buffer.from(await res.arrayBuffer());\n}\n\nfunction toSandbox(auth: { apiKey: string; baseUrl: string; user?: OrbleUser }, data: OrbleBoxData): OrbleSandbox {\n return { id: data.name, data, ...auth };\n}\n\nconst boxPath = (name: string, sub = '') => `/v1/boxes/${encodeURIComponent(name)}${sub}`;\n\n/** Maps ComputeSDK's create options onto the body of POST /v1/boxes. */\nfunction createBody(options: CreateInstanceOptions = {}): Record<string, unknown> {\n const body: Record<string, unknown> = {};\n if (typeof options.size === 'string') body.size = options.size;\n const from = options.snapshotId ?? options.templateId;\n if (from) body.from = from;\n if (options.name) body.name = options.name;\n // Orble sets it before create returns, and deletes the box if that fails.\n if (options.keepAwake === true) body.keep_awake = true;\n return body;\n}\n\nfunction wrapCommand(command: string, options?: RunCommandOptions): string {\n return options?.background ? `nohup sh -c \"${escapeShellArg(command)}\" >/dev/null 2>&1 &` : command;\n}\n\n// A leading dash would be read as an option by find, mkdir and rm.\nfunction shellPath(path: string): string {\n return `\"${escapeShellArg(path.startsWith('-') ? `./${path}` : path)}\"`;\n}\n\nasync function exec(sandbox: OrbleSandbox, command: string, options?: RunCommandOptions): Promise<ExecResponse> {\n const body: Record<string, unknown> = { command };\n if (options?.timeout) body.timeout_s = Math.min(EXEC_MAX_TIMEOUT_S, Math.ceil(options.timeout / 1000));\n if (options?.env && Object.keys(options.env).length > 0) body.env = options.env;\n if (options?.cwd) body.cwd = options.cwd;\n if (userFor(sandbox, options) === 'root') body.user = 'root';\n let data = await request<ExecResponse>(sandbox, 'POST', boxPath(sandbox.id, '/exec'), body);\n while (data?.running) data = await request<ExecResponse>(sandbox, 'POST', boxPath(sandbox.id, '/exec'), { job: data.job });\n if (!data) throw new Error(`Orble box ${sandbox.id} not found`);\n return data;\n}\n\n// Orble's states are creating, running, suspended, stopped, error, deleting and deleted. A suspended box wakes on the\n// next command, but it is not running until then.\nexport function infoStatus(state: string): InstanceInfo['status'] {\n if (state === 'running') return 'running';\n if (state === 'error') return 'error';\n return 'stopped';\n}\n\nfunction toSnapshot(data: OrbleSnapshotData): Snapshot {\n return {\n id: data.name,\n provider: 'orble',\n createdAt: new Date(data.created_at),\n metadata: {\n state: data.state,\n box: data.box,\n vcpus: data.vcpus,\n memMiB: data.mem_mib,\n diskBytes: data.disk_bytes,\n ...(data.alias && { alias: data.alias }),\n ...(data.gallery && { gallery: true, about: data.about }),\n },\n };\n}\n\nasync function listSnapshots(config: OrbleConfig): Promise<OrbleSnapshotData[]> {\n return (await request<OrbleSnapshotData[]>(resolveConfig(config), 'GET', '/v1/snapshots')) ?? [];\n}\n\n// Deleting a snapshot that doesn't exist (a 404) leaves nothing to do.\nasync function deleteSnapshot(config: OrbleConfig, name: string): Promise<void> {\n await request(resolveConfig(config), 'DELETE', `/v1/snapshots/${encodeURIComponent(name)}`);\n}\n\nasync function mustSucceed(run: FsRunCommand, sandbox: OrbleSandbox, command: string, what: string): Promise<CommandResult> {\n const result = await run(sandbox, command);\n if (result.exitCode !== 0) throw new Error(`Failed to ${what}: ${result.stderr.trim() || `exit code ${result.exitCode}`}`);\n return result;\n}\n\nexport const orble = defineProvider<OrbleSandbox, OrbleConfig>({\n name: 'orble',\n sizes: (_config, profile, options) => {\n if (options?.size !== undefined) throw new InstanceSizeError('conflict', 'cannot combine sizeClass with the native Orble size field');\n const shape = ORBLE_SIZES[profile.sizeClass];\n if (!shape) {\n return { status: 'unsupported', reason: `Orble has no ${profile.sizeClass} shape; it offers 1/2, 2/4, 4/8 and 8/16 (vCPU / GiB).` };\n }\n return { status: 'supported', nativeOptions: { size: shape.size }, resolved: { vcpus: shape.vcpus, memoryMiB: shape.memoryMiB, diskMiB: ORBLE_DISK_MIB } };\n },\n methods: {\n instances: {\n create: async (config: OrbleConfig, options?: CreateInstanceOptions) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData>(auth, 'POST', '/v1/boxes', createBody(options));\n if (!data) throw new Error('Orble API returned no box on create');\n return { instance: toSandbox(auth, data), instanceId: data.name };\n },\n\n getById: async (config: OrbleConfig, instanceId: string) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData>(auth, 'GET', boxPath(instanceId));\n return data ? { instance: toSandbox(auth, data), instanceId: data.name } : null;\n },\n\n list: async (config: OrbleConfig) => {\n const auth = resolveConfig(config);\n const data = await request<OrbleBoxData[]>(auth, 'GET', '/v1/boxes');\n return (data ?? []).map((row) => ({ instance: toSandbox(auth, row), instanceId: row.name }));\n },\n\n destroy: async (config: OrbleConfig, instanceId: string) => {\n const auth = resolveConfig(config);\n await request(auth, 'DELETE', boxPath(instanceId));\n },\n\n runCommand: async (sandbox: OrbleSandbox, command: string, options?: RunCommandOptions): Promise<CommandResult> => {\n const start = Date.now();\n const data = await exec(sandbox, wrapCommand(command, options), options);\n return { stdout: data.stdout ?? '', stderr: data.stderr ?? '', exitCode: data.exit_code, durationMs: Date.now() - start };\n },\n\n getInfo: async (sandbox: OrbleSandbox): Promise<InstanceInfo> => {\n const data = await request<OrbleBoxData>(sandbox, 'GET', boxPath(sandbox.id));\n const current = data ?? { ...sandbox.data, state: 'deleted' };\n return {\n id: sandbox.id,\n provider: 'orble',\n status: infoStatus(current.state),\n createdAt: current.created_at ? new Date(current.created_at) : new Date(),\n timeout: 0,\n metadata: { state: current.state, hostname: current.hostname, vcpus: current.vcpus, memMiB: current.mem_mib, diskGiB: current.disk_gib },\n };\n },\n\n replacesUrlTokens: true,\n\n // Shares the port at its own https address: public with `public: true`, otherwise a token port whose URL\n // carries the token, so it opens for whoever holds the URL. `newToken: true` replaces an existing token port's\n // token, so URLs handed out before stop working; it doesn't share a port that isn't shared by token yet.\n getUrl: async (\n sandbox: OrbleSandbox,\n options: { port: number; protocol?: string; public?: boolean; newToken?: boolean },\n ): Promise<string> => {\n const ws = options.protocol === 'ws' || options.protocol === 'wss';\n // Orble redeems a query token with a redirect, which a WebSocket handshake can't follow.\n if (ws && !options.public) throw new Error(`Orble token ports can't be opened as WebSocket URLs; pass public: true or open the https URL in a browser`);\n if (options.newToken && options.public) throw new Error(`A public Orble port has no token to replace`);\n const port = boxPath(sandbox.id, `/ports/${options.port}`);\n const data = options.newToken\n ? await request<{ url: string; token?: string }>(sandbox, 'POST', `${port}/token`, {})\n : await request<{ url: string; token?: string }>(sandbox, 'PUT', port, { access: options.public ? 'public' : 'token' });\n if (!data?.url) {\n throw new Error(options.newToken ? `Orble box ${sandbox.id} has no token port ${options.port}` : `Orble box ${sandbox.id} not found`);\n }\n let url = data.url;\n if (!options.public) {\n if (!data.token) throw new Error(`Orble returned no token for port ${options.port} of box ${sandbox.id}`);\n const signed = new URL(url);\n signed.searchParams.set('orble_preview_token', data.token);\n url = signed.toString();\n }\n return ws ? url.replace(/^https/, 'wss') : url;\n },\n\n // Suspend keeps the box's memory and running programs; resume (or any command) wakes it where it was.\n pause: async (sandbox: OrbleSandbox): Promise<void> => {\n if (!(await request<OrbleBoxData>(sandbox, 'POST', boxPath(sandbox.id, '/suspend')))) throw new Error(`Orble box ${sandbox.id} not found`);\n },\n resume: async (sandbox: OrbleSandbox): Promise<OrbleSandbox> => {\n const data = await request<OrbleBoxData>(sandbox, 'POST', boxPath(sandbox.id, '/resume'));\n if (!data) throw new Error(`Orble box ${sandbox.id} not found`);\n return toSandbox(sandbox, data);\n },\n pauseCapabilities: { memory: true },\n\n getInstance: (sandbox: OrbleSandbox): OrbleSandbox => sandbox,\n\n filesystem: {\n // The whole file in one streamed response (raw=1), at any size up to the API's limit.\n readFile: async (sandbox: OrbleSandbox, path: string): Promise<string> => {\n const data = await rawTransfer(sandbox, 'GET', path);\n if (!data) throw new Error(`Failed to read ${path}: not found`);\n return data.toString('utf8');\n },\n // The raw body is streamed to the file, so large files go in one request.\n writeFile: async (sandbox: OrbleSandbox, path: string, content: string): Promise<void> => {\n if (!(await rawTransfer(sandbox, 'PUT', path, Buffer.from(content, 'utf8')))) throw new Error(`Failed to write ${path}: box not found`);\n },\n mkdir: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<void> => {\n await mustSucceed(run, sandbox, `mkdir -p ${shellPath(path)}`, `create ${path}`);\n },\n readdir: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<FileEntry[]> => {\n const result = await mustSucceed(run, sandbox, `find ${shellPath(path)} -mindepth 1 -maxdepth 1 -printf '%y\\\\t%s\\\\t%T@\\\\t%f\\\\n'`, `list ${path}`);\n return result.stdout\n .split('\\n')\n .filter(Boolean)\n .map((line) => {\n const [kind, size, modified, ...name] = line.split('\\t');\n return { name: name.join('\\t'), type: kind === 'd' ? ('directory' as const) : ('file' as const), size: Number(size), modified: new Date(Number(modified) * 1000) };\n });\n },\n exists: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<boolean> => {\n const result = await run(sandbox, `test -e ${shellPath(path)}`);\n return result.exitCode === 0;\n },\n remove: async (sandbox: OrbleSandbox, path: string, run: FsRunCommand): Promise<void> => {\n await mustSucceed(run, sandbox, `rm -rf ${shellPath(path)}`, `remove ${path}`);\n },\n },\n },\n\n snapshot: {\n // A snapshot keeps the box's disk, memory and running programs. A running box pauses briefly while it is taken,\n // then keeps running. A box started from it at the snapshot's size resumes where the snapshot was taken; at a\n // larger size it boots from the snapshot's disk. The API answers once the snapshot is ready.\n capabilities: { scope: 'rootfs', memory: true, destroysSource: false, source: 'kept', fork: true },\n create: async (config: OrbleConfig, instanceId: string, options?: CreateSnapshotOptions): Promise<Snapshot> => {\n const auth = resolveConfig(config);\n const data = await request<OrbleSnapshotData>(auth, 'POST', boxPath(instanceId, '/snapshot'), options?.name ? { name: options.name } : {});\n if (!data) throw new Error(`Orble box ${instanceId} not found`);\n return toSnapshot(data);\n },\n // The account's own snapshots; Orble's gallery snapshots are listed as templates.\n list: async (config: OrbleConfig, options?: ListSnapshotsOptions): Promise<Snapshot[]> => {\n const box = options?.instanceId ?? options?.sandboxId;\n const rows = (await listSnapshots(config)).filter((s) => !s.gallery && (!box || s.box === box));\n return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);\n },\n delete: deleteSnapshot,\n },\n\n // Orble starts boxes from snapshots, its own (the gallery) or the account's, so templates are snapshots.\n template: {\n create: async (): Promise<Snapshot> => {\n throw new Error('Orble has no template builds; make a template with snapshot.create() from a box you have set up.');\n },\n list: async (config: OrbleConfig, options?: ListTemplatesOptions): Promise<Snapshot[]> => {\n const rows = await listSnapshots(config);\n return rows.slice(0, options?.limit ?? rows.length).map(toSnapshot);\n },\n delete: deleteSnapshot,\n },\n },\n});\n\nexport default orble;\n"],"mappings":";AAUA,SAAS,gBAAgB,gBAAgB,yBAAyB;AA2ElE,IAAM,iBAAiB;AAEhB,IAAM,cAA+G,OAAO,OAAO;AAAA,EACxI,IAAI,EAAE,MAAM,SAAS,OAAO,GAAG,WAAW,KAAK;AAAA;AAAA,EAC/C,IAAI,EAAE,MAAM,SAAS,OAAO,GAAG,WAAW,KAAK;AAAA,EAC/C,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW,KAAK;AAAA,EAC3C,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW,KAAK;AAAA,EAC3C,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,WAAW,MAAM;AAC9C,CAAC;AAID,IAAM,qBAAqB;AAE3B,SAAS,cAAc,QAAqB;AAC1C,QAAM,MAAM,OAAO,YAAY,cAAc,QAAQ,MAAM;AAC3D,QAAM,SAAS,OAAO,UAAU,KAAK,iBAAiB;AACtD,MAAI,CAAC,QAAQ;AACX,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AACA,QAAM,WAAW,OAAO,WAAW,KAAK,iBAAiB,sBAAsB,QAAQ,QAAQ,EAAE;AACjG,QAAM,OAAO,OAAO,SAAU,KAAK,cAAc;AACjD,MAAI,SAAS,UAAa,SAAS,WAAW,SAAS,QAAQ;AAC7D,UAAM,IAAI,MAAM,8CAA8C,IAAI,GAAG;AAAA,EACvE;AACA,SAAO,EAAE,QAAQ,SAAS,GAAI,OAAO,EAAE,KAAK,IAAI,CAAC,EAAG;AACtD;AAGA,SAAS,QAAQ,SAAuB,SAAwC;AAC9E,QAAM,QAAS,SAA2C;AAC1D,SAAO,UAAU,UAAU,UAAU,UAAU,QAAQ,QAAQ,QAAQ;AACzE;AAGA,eAAe,QACb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,OAAO,EAAE,MAAM,QAAQ,KAAK,IAAI,CAAC,CAAC;AACzI,YAAI,CAAC,KAAM,OAAM,IAAI,MAAM,aAAa,UAAU,YAAY;AAC9D,eAAO,WAAW,IAAI;AAAA,MACxB;AAAA;AAAA,MAEA,MAAM,OAAO,QAAqB,YAAwD;AACxF,cAAM,MAAM,SAAS,cAAc,SAAS;AAC5C,cAAM,QAAQ,MAAM,cAAc,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,OAAO,EAAE,QAAQ,IAAI;AAC9F,eAAO,KAAK,MAAM,GAAG,SAAS,SAAS,KAAK,MAAM,EAAE,IAAI,UAAU;AAAA,MACpE;AAAA,MACA,QAAQ;AAAA,IACV;AAAA;AAAA,IAGA,UAAU;AAAA,MACR,QAAQ,YAA+B;AACrC,cAAM,IAAI,MAAM,kGAAkG;AAAA,MACpH;AAAA,MACA,MAAM,OAAO,QAAqB,YAAwD;AACxF,cAAM,OAAO,MAAM,cAAc,MAAM;AACvC,eAAO,KAAK,MAAM,GAAG,SAAS,SAAS,KAAK,MAAM,EAAE,IAAI,UAAU;AAAA,MACpE;AAAA,MACA,QAAQ;AAAA,IACV;AAAA,EACF;AACF,CAAC;AAED,IAAO,gBAAQ;","names":["res"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@computesdk/orble",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Orble provider for ComputeSDK - Linux VMs with sudo and Docker, memory snapshots, pause/resume, and port URLs",
5
5
  "author": "Orble",
6
6
  "license": "MIT",
@@ -27,8 +27,8 @@
27
27
  "orble"
28
28
  ],
29
29
  "dependencies": {
30
- "@computesdk/provider": "2.1.31",
31
- "computesdk": "4.1.25"
30
+ "@computesdk/provider": "2.1.32",
31
+ "computesdk": "4.1.26"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^20.0.0",