@celestoai/sdk 0.1.0 → 0.1.2

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/dist/index.cjs ADDED
@@ -0,0 +1,559 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var src_exports = {};
22
+ __export(src_exports, {
23
+ Celesto: () => Celesto,
24
+ CelestoApiError: () => CelestoApiError,
25
+ CelestoError: () => CelestoError,
26
+ CelestoNetworkError: () => CelestoNetworkError,
27
+ ComputersClient: () => ComputersClient,
28
+ GatekeeperClient: () => GatekeeperClient
29
+ });
30
+ module.exports = __toCommonJS(src_exports);
31
+
32
+ // src/core/config.ts
33
+ var DEFAULT_BASE_URL = "https://api.celesto.ai";
34
+ var buildRequestContext = (config) => ({
35
+ fetch: config.fetch ?? fetch,
36
+ baseUrl: config.baseUrl ?? DEFAULT_BASE_URL,
37
+ token: config.token ?? config.apiKey,
38
+ organizationId: config.organizationId,
39
+ userAgent: config.userAgent,
40
+ timeoutMs: config.timeoutMs,
41
+ headers: config.headers
42
+ });
43
+
44
+ // src/core/errors.ts
45
+ var CelestoError = class extends Error {
46
+ constructor(message) {
47
+ super(message);
48
+ this.name = "CelestoError";
49
+ }
50
+ };
51
+ var CelestoApiError = class extends CelestoError {
52
+ constructor(message, status, data, requestId) {
53
+ super(message);
54
+ this.name = "CelestoApiError";
55
+ this.status = status;
56
+ this.data = data;
57
+ this.requestId = requestId;
58
+ }
59
+ };
60
+ var CelestoNetworkError = class extends CelestoError {
61
+ constructor(message, cause) {
62
+ super(message);
63
+ this.name = "CelestoNetworkError";
64
+ this.cause = cause;
65
+ }
66
+ };
67
+
68
+ // src/core/http.ts
69
+ var joinUrl = (baseUrl, path) => {
70
+ const trimmedBase = baseUrl.endsWith("/") ? baseUrl.slice(0, -1) : baseUrl;
71
+ const normalizedPath = path.startsWith("/") ? path : `/${path}`;
72
+ return `${trimmedBase}${normalizedPath}`;
73
+ };
74
+ var buildQuery = (query) => {
75
+ if (!query) {
76
+ return "";
77
+ }
78
+ const params = new URLSearchParams();
79
+ for (const [key, value] of Object.entries(query)) {
80
+ if (value === void 0 || value === null) {
81
+ continue;
82
+ }
83
+ if (Array.isArray(value)) {
84
+ for (const item of value) {
85
+ params.append(key, String(item));
86
+ }
87
+ continue;
88
+ }
89
+ params.set(key, String(value));
90
+ }
91
+ const serialized = params.toString();
92
+ return serialized ? `?${serialized}` : "";
93
+ };
94
+ var parseResponseBody = async (response) => {
95
+ if (response.status === 204) {
96
+ return void 0;
97
+ }
98
+ const contentType = response.headers.get("content-type") ?? "";
99
+ if (contentType.includes("application/json")) {
100
+ return response.json();
101
+ }
102
+ return response.text();
103
+ };
104
+ var extractErrorMessage = (data, status) => {
105
+ if (data && typeof data === "object") {
106
+ const record = data;
107
+ if (typeof record.detail === "string") {
108
+ return record.detail;
109
+ }
110
+ if (typeof record.message === "string") {
111
+ return record.message;
112
+ }
113
+ if (typeof record.error === "string") {
114
+ return record.error;
115
+ }
116
+ }
117
+ return `Request failed with status ${status}`;
118
+ };
119
+ var request = async (ctx, options) => {
120
+ const url = `${joinUrl(ctx.baseUrl, options.path)}${buildQuery(options.query)}`;
121
+ const headers = {
122
+ ...ctx.headers ?? {},
123
+ ...options.headers ?? {}
124
+ };
125
+ if (ctx.token) {
126
+ headers.Authorization = `Bearer ${ctx.token}`;
127
+ }
128
+ if (ctx.organizationId) {
129
+ headers["X-Current-Organization"] = ctx.organizationId;
130
+ }
131
+ if (ctx.userAgent && !headers["User-Agent"]) {
132
+ headers["User-Agent"] = ctx.userAgent;
133
+ }
134
+ const init = {
135
+ method: options.method,
136
+ headers,
137
+ body: void 0,
138
+ signal: options.signal
139
+ };
140
+ if (options.body !== void 0) {
141
+ headers["Content-Type"] = headers["Content-Type"] ?? "application/json";
142
+ init.body = headers["Content-Type"].includes("application/json") ? JSON.stringify(options.body) : options.body;
143
+ }
144
+ let timeoutId;
145
+ let controller;
146
+ if (!options.signal && ctx.timeoutMs && ctx.timeoutMs > 0) {
147
+ controller = new AbortController();
148
+ timeoutId = setTimeout(() => controller?.abort(), ctx.timeoutMs);
149
+ init.signal = controller.signal;
150
+ }
151
+ try {
152
+ const response = await ctx.fetch(url, init);
153
+ const data = await parseResponseBody(response);
154
+ if (!response.ok) {
155
+ const message = extractErrorMessage(data, response.status);
156
+ throw new CelestoApiError(message, response.status, data, response.headers.get("x-request-id") ?? void 0);
157
+ }
158
+ return data;
159
+ } catch (err) {
160
+ if (err instanceof CelestoApiError) {
161
+ throw err;
162
+ }
163
+ const error = err instanceof Error ? err : new Error(String(err));
164
+ throw new CelestoNetworkError(error.message, error);
165
+ } finally {
166
+ if (timeoutId) {
167
+ clearTimeout(timeoutId);
168
+ }
169
+ }
170
+ };
171
+
172
+ // src/computers/client.ts
173
+ var toConnection = (payload) => {
174
+ if (!payload) {
175
+ return void 0;
176
+ }
177
+ const out = {};
178
+ if (payload.ssh != null) {
179
+ out.ssh = payload.ssh;
180
+ }
181
+ if (payload.access_url != null) {
182
+ out.accessUrl = payload.access_url;
183
+ }
184
+ return out;
185
+ };
186
+ var toComputerInfo = (payload) => ({
187
+ id: payload.id,
188
+ name: payload.name,
189
+ status: payload.status,
190
+ vcpus: payload.vcpus,
191
+ ramMb: payload.ram_mb,
192
+ diskSizeMb: payload.disk_size_mb,
193
+ image: payload.image,
194
+ templateId: payload.template_id,
195
+ templateVersion: payload.template_version ?? null,
196
+ connection: toConnection(payload.connection),
197
+ lastError: payload.last_error ?? null,
198
+ createdAt: payload.created_at,
199
+ stoppedAt: payload.stopped_at ?? null
200
+ });
201
+ var toExecResponse = (payload) => ({
202
+ exitCode: payload.exit_code,
203
+ stdout: payload.stdout,
204
+ stderr: payload.stderr
205
+ });
206
+ var toSandboxTemplateInfo = (payload) => ({
207
+ id: payload.id,
208
+ displayName: payload.display_name,
209
+ description: payload.description,
210
+ defaultVcpus: payload.default_vcpus,
211
+ defaultRamMb: payload.default_ram_mb,
212
+ defaultDiskSizeMb: payload.default_disk_size_mb,
213
+ version: payload.version ?? null,
214
+ experimental: payload.experimental
215
+ });
216
+ var buildCreateComputerBody = (params) => {
217
+ if (params.cpus !== void 0 && params.vcpus !== void 0 && params.cpus !== params.vcpus) {
218
+ throw new Error("cpus and vcpus must have the same value when both are provided.");
219
+ }
220
+ if (params.memory !== void 0 && params.ramMb !== void 0 && params.memory !== params.ramMb) {
221
+ throw new Error("memory and ramMb must have the same value when both are provided.");
222
+ }
223
+ const body = {};
224
+ const vcpus = params.vcpus ?? params.cpus;
225
+ const ramMb = params.ramMb ?? params.memory;
226
+ if (vcpus !== void 0) {
227
+ body.vcpus = vcpus;
228
+ }
229
+ if (ramMb !== void 0) {
230
+ body.ram_mb = ramMb;
231
+ }
232
+ if (params.diskSizeMb !== void 0) {
233
+ body.disk_size_mb = params.diskSizeMb;
234
+ }
235
+ if (params.image !== void 0) {
236
+ body.image = params.image;
237
+ }
238
+ if (params.templateId !== void 0) {
239
+ body.template_id = params.templateId;
240
+ }
241
+ if (params.templateVersion !== void 0) {
242
+ body.template_version = params.templateVersion;
243
+ }
244
+ return body;
245
+ };
246
+ var computersPath = (path) => `/v1/computers${path}`;
247
+ var pickOverrides = (options) => ({
248
+ headers: options?.headers,
249
+ signal: options?.signal
250
+ });
251
+ var ComputersClient = class {
252
+ constructor(config) {
253
+ this.config = config;
254
+ }
255
+ async create(params = {}, options) {
256
+ const ctx = buildRequestContext(this.config);
257
+ const data = await request(ctx, {
258
+ method: "POST",
259
+ path: computersPath(""),
260
+ body: buildCreateComputerBody(params),
261
+ ...pickOverrides(options)
262
+ });
263
+ return toComputerInfo(data);
264
+ }
265
+ async listTemplates(options) {
266
+ const ctx = buildRequestContext(this.config);
267
+ const data = await request(ctx, {
268
+ method: "GET",
269
+ path: computersPath("/templates"),
270
+ ...pickOverrides(options)
271
+ });
272
+ return data.map(toSandboxTemplateInfo);
273
+ }
274
+ async list(options) {
275
+ const ctx = buildRequestContext(this.config);
276
+ const data = await request(ctx, {
277
+ method: "GET",
278
+ path: computersPath(""),
279
+ ...pickOverrides(options)
280
+ });
281
+ return {
282
+ computers: data.computers.map(toComputerInfo),
283
+ count: data.count
284
+ };
285
+ }
286
+ async get(computerId, options) {
287
+ const ctx = buildRequestContext(this.config);
288
+ const data = await request(ctx, {
289
+ method: "GET",
290
+ path: computersPath(`/${encodeURIComponent(computerId)}`),
291
+ ...pickOverrides(options)
292
+ });
293
+ return toComputerInfo(data);
294
+ }
295
+ async exec(computerId, command, params = {}, options) {
296
+ const ctx = buildRequestContext(this.config);
297
+ const data = await request(ctx, {
298
+ method: "POST",
299
+ path: computersPath(`/${encodeURIComponent(computerId)}/exec`),
300
+ body: {
301
+ command,
302
+ timeout: params.timeout ?? 30
303
+ },
304
+ ...pickOverrides(options)
305
+ });
306
+ return toExecResponse(data);
307
+ }
308
+ async stop(computerId, options) {
309
+ const ctx = buildRequestContext(this.config);
310
+ const data = await request(ctx, {
311
+ method: "POST",
312
+ path: computersPath(`/${encodeURIComponent(computerId)}/stop`),
313
+ ...pickOverrides(options)
314
+ });
315
+ return toComputerInfo(data);
316
+ }
317
+ async start(computerId, options) {
318
+ const ctx = buildRequestContext(this.config);
319
+ const data = await request(ctx, {
320
+ method: "POST",
321
+ path: computersPath(`/${encodeURIComponent(computerId)}/start`),
322
+ ...pickOverrides(options)
323
+ });
324
+ return toComputerInfo(data);
325
+ }
326
+ async delete(computerId, options) {
327
+ const ctx = buildRequestContext(this.config);
328
+ const data = await request(ctx, {
329
+ method: "DELETE",
330
+ path: computersPath(`/${encodeURIComponent(computerId)}`),
331
+ ...pickOverrides(options)
332
+ });
333
+ return toComputerInfo(data);
334
+ }
335
+ /**
336
+ * Get connection info for opening a WebSocket terminal session.
337
+ *
338
+ * Accepts either a computer ID (e.g. `cmp_xxx`) or a human-readable name.
339
+ * The name is resolved to the canonical ID via a GET call — the backend's
340
+ * WebSocket endpoint does not resolve names on its own.
341
+ *
342
+ * Returns the URL, headers, and first message needed to open the connection
343
+ * with any WebSocket library of your choice.
344
+ *
345
+ * @example
346
+ * ```ts
347
+ * const conn = await celesto.computers.getTerminalConnection("my-computer");
348
+ * const ws = new WebSocket(conn.url, { headers: conn.headers });
349
+ * ws.on("open", () => ws.send(conn.firstMessage));
350
+ * ws.on("message", (data) => process.stdout.write(data));
351
+ * ```
352
+ */
353
+ async getTerminalConnection(computerIdOrName) {
354
+ const info = await this.get(computerIdOrName);
355
+ const ctx = buildRequestContext(this.config);
356
+ if (!ctx.token) {
357
+ throw new Error("A token is required for terminal connections");
358
+ }
359
+ const wsBase = ctx.baseUrl.replace(/^https:/i, "wss:").replace(/^http:/i, "ws:");
360
+ const url = `${wsBase}/v1/computers/${encodeURIComponent(info.id)}/terminal`;
361
+ const headers = {
362
+ Authorization: `Bearer ${ctx.token}`
363
+ };
364
+ if (ctx.organizationId) {
365
+ headers["X-Current-Organization"] = ctx.organizationId;
366
+ }
367
+ return {
368
+ url,
369
+ headers,
370
+ firstMessage: JSON.stringify({ token: ctx.token })
371
+ };
372
+ }
373
+ };
374
+
375
+ // src/gatekeeper/client.ts
376
+ var toConnectRequest = (payload) => ({
377
+ subject: payload.subject,
378
+ provider: payload.provider ?? "google_drive",
379
+ project_name: payload.projectName,
380
+ redirect_uri: payload.redirectUri
381
+ });
382
+ var toConnectResponse = (payload) => ({
383
+ status: payload.status,
384
+ oauthUrl: payload.oauth_url ?? void 0,
385
+ connectionId: payload.connection_id ?? void 0
386
+ });
387
+ var toConnection2 = (payload) => ({
388
+ id: payload.id,
389
+ subject: payload.subject,
390
+ provider: payload.provider,
391
+ projectId: payload.project_id,
392
+ accountEmail: payload.account_email ?? null,
393
+ scopes: payload.scopes ?? [],
394
+ status: payload.status,
395
+ createdAt: payload.created_at,
396
+ updatedAt: payload.updated_at,
397
+ lastUsedAt: payload.last_used_at ?? null,
398
+ accessRules: payload.access_rules ? {
399
+ version: payload.access_rules.version ?? "1",
400
+ allowedFolders: payload.access_rules.allowed_folders ?? [],
401
+ allowedFiles: payload.access_rules.allowed_files ?? [],
402
+ unrestricted: false
403
+ } : null
404
+ });
405
+ var toAccessRules = (payload) => ({
406
+ version: payload.version,
407
+ allowedFolders: payload.allowed_folders ?? [],
408
+ allowedFiles: payload.allowed_files ?? [],
409
+ unrestricted: payload.unrestricted
410
+ });
411
+ var toDriveFile = (payload) => ({
412
+ id: payload.id,
413
+ name: payload.name ?? null,
414
+ mimeType: payload.mime_type ?? null,
415
+ size: payload.size ?? null,
416
+ modifiedTime: payload.modified_time ?? null,
417
+ createdTime: payload.created_time ?? null,
418
+ webViewLink: payload.web_view_link ?? null,
419
+ iconLink: payload.icon_link ?? null,
420
+ thumbnailLink: payload.thumbnail_link ?? null,
421
+ parents: payload.parents ?? null,
422
+ driveId: payload.drive_id ?? null,
423
+ shared: payload.shared ?? null,
424
+ ownedByMe: payload.owned_by_me ?? null
425
+ });
426
+ var gatekeeperPath = (path) => `/v1/gatekeeper${path}`;
427
+ var pickOverrides2 = (options) => ({
428
+ headers: options?.headers,
429
+ signal: options?.signal
430
+ });
431
+ var GatekeeperClient = class {
432
+ constructor(config) {
433
+ this.config = config;
434
+ }
435
+ async connect(payload, options) {
436
+ const ctx = buildRequestContext(this.config);
437
+ const data = await request(ctx, {
438
+ method: "POST",
439
+ path: gatekeeperPath("/connect"),
440
+ body: toConnectRequest(payload),
441
+ ...pickOverrides2(options)
442
+ });
443
+ return toConnectResponse(data);
444
+ }
445
+ async listConnections(params, options) {
446
+ const ctx = buildRequestContext(this.config);
447
+ const data = await request(ctx, {
448
+ method: "GET",
449
+ path: gatekeeperPath("/connections"),
450
+ query: {
451
+ project_name: params.projectName,
452
+ status_filter: params.statusFilter
453
+ },
454
+ ...pickOverrides2(options)
455
+ });
456
+ return {
457
+ total: data.total,
458
+ data: data.data.map(toConnection2)
459
+ };
460
+ }
461
+ async getConnection(connectionId, options) {
462
+ const ctx = buildRequestContext(this.config);
463
+ const data = await request(ctx, {
464
+ method: "GET",
465
+ path: gatekeeperPath(`/connections/${connectionId}`),
466
+ ...pickOverrides2(options)
467
+ });
468
+ return toConnection2(data);
469
+ }
470
+ async revokeConnection(params, options) {
471
+ const ctx = buildRequestContext(this.config);
472
+ return request(ctx, {
473
+ method: "DELETE",
474
+ path: gatekeeperPath("/connections"),
475
+ query: {
476
+ subject: params.subject,
477
+ project_name: params.projectName,
478
+ provider: params.provider
479
+ },
480
+ ...pickOverrides2(options)
481
+ });
482
+ }
483
+ async listDriveFiles(params, options) {
484
+ const ctx = buildRequestContext(this.config);
485
+ const data = await request(ctx, {
486
+ method: "GET",
487
+ path: gatekeeperPath("/connectors/drive/files"),
488
+ query: {
489
+ project_name: params.projectName,
490
+ subject: params.subject,
491
+ page_size: params.pageSize,
492
+ page_token: params.pageToken,
493
+ folder_id: params.folderId,
494
+ query: params.query,
495
+ include_folders: params.includeFolders,
496
+ order_by: params.orderBy
497
+ },
498
+ ...pickOverrides2(options)
499
+ });
500
+ return {
501
+ files: data.files.map(toDriveFile),
502
+ nextPageToken: data.next_page_token ?? null
503
+ };
504
+ }
505
+ async getAccessRules(connectionId, options) {
506
+ const ctx = buildRequestContext(this.config);
507
+ const data = await request(ctx, {
508
+ method: "GET",
509
+ path: gatekeeperPath(`/connections/${connectionId}/access-rules`),
510
+ ...pickOverrides2(options)
511
+ });
512
+ return toAccessRules(data);
513
+ }
514
+ async updateAccessRules(params, options) {
515
+ const ctx = buildRequestContext(this.config);
516
+ const data = await request(ctx, {
517
+ method: "PUT",
518
+ path: gatekeeperPath("/connections/access-rules"),
519
+ query: {
520
+ subject: params.subject,
521
+ project_name: params.projectName,
522
+ provider: params.provider
523
+ },
524
+ body: {
525
+ allowed_folders: params.accessRules.allowedFolders ?? [],
526
+ allowed_files: params.accessRules.allowedFiles ?? []
527
+ },
528
+ ...pickOverrides2(options)
529
+ });
530
+ return toAccessRules(data);
531
+ }
532
+ async clearAccessRules(connectionId, options) {
533
+ const ctx = buildRequestContext(this.config);
534
+ const data = await request(ctx, {
535
+ method: "DELETE",
536
+ path: gatekeeperPath(`/connections/${connectionId}/access-rules`),
537
+ ...pickOverrides2(options)
538
+ });
539
+ return toAccessRules(data);
540
+ }
541
+ };
542
+
543
+ // src/index.ts
544
+ var Celesto = class {
545
+ constructor(config) {
546
+ this.gatekeeper = new GatekeeperClient(config);
547
+ this.computers = new ComputersClient(config);
548
+ }
549
+ };
550
+ // Annotate the CommonJS export names for ESM import in node:
551
+ 0 && (module.exports = {
552
+ Celesto,
553
+ CelestoApiError,
554
+ CelestoError,
555
+ CelestoNetworkError,
556
+ ComputersClient,
557
+ GatekeeperClient
558
+ });
559
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/core/config.ts","../src/core/errors.ts","../src/core/http.ts","../src/computers/client.ts","../src/gatekeeper/client.ts"],"sourcesContent":["import { ComputersClient } from \"./computers\";\nimport { GatekeeperClient } from \"./gatekeeper\";\nimport type { ClientConfig } from \"./core/config\";\n\nexport { GatekeeperClient } from \"./gatekeeper\";\nexport type {\n GatekeeperAccessRules,\n GatekeeperAccessRulesParams,\n GatekeeperAccessRulesUpdate,\n GatekeeperConnectRequest,\n GatekeeperConnectResponse,\n GatekeeperConnection,\n GatekeeperDriveFile,\n GatekeeperDriveListParams,\n GatekeeperDriveListResponse,\n GatekeeperListConnectionsParams,\n GatekeeperListConnectionsResponse,\n GatekeeperRevokeParams,\n GatekeeperRevokeResponse,\n} from \"./gatekeeper\";\nexport { ComputersClient } from \"./computers\";\nexport type {\n ComputerConnectionInfo,\n ComputerExecResponse,\n ComputerInfo,\n ComputerListResponse,\n ComputerStatus,\n CreateComputerParams,\n ExecParams,\n SandboxTemplateInfo,\n TerminalConnectionInfo,\n} from \"./computers\";\nexport type { ClientConfig, RequestOverrides } from \"./core/config\";\nexport { CelestoError, CelestoApiError, CelestoNetworkError } from \"./core/errors\";\n\nexport class Celesto {\n readonly gatekeeper: GatekeeperClient;\n readonly computers: ComputersClient;\n\n constructor(config: ClientConfig) {\n this.gatekeeper = new GatekeeperClient(config);\n this.computers = new ComputersClient(config);\n }\n}\n","export type FetchLike = typeof fetch;\n\nexport interface ClientConfig {\n /** Base API URL, e.g. https://api.celesto.ai */\n baseUrl?: string;\n /** Bearer token (API key or JWT). */\n token?: string;\n /** Alias for token. */\n apiKey?: string;\n /** Organization ID to send as X-Current-Organization. */\n organizationId?: string;\n /** Optional user agent for server-side requests. */\n userAgent?: string;\n /** Default request timeout in milliseconds. */\n timeoutMs?: number;\n /** Override fetch implementation (useful for testing). */\n fetch?: FetchLike;\n /** Default headers to include in every request. */\n headers?: Record<string, string>;\n}\n\nexport interface RequestOptions {\n method: \"GET\" | \"POST\" | \"PUT\" | \"PATCH\" | \"DELETE\";\n path: string;\n query?: Record<string, string | number | boolean | undefined | null | (string | number | boolean)[]>;\n body?: unknown;\n headers?: Record<string, string>;\n signal?: AbortSignal;\n}\n\nexport interface RequestOverrides {\n headers?: Record<string, string>;\n signal?: AbortSignal;\n}\n\nexport interface RequestContext {\n fetch: FetchLike;\n baseUrl: string;\n token?: string;\n organizationId?: string;\n userAgent?: string;\n timeoutMs?: number;\n headers?: Record<string, string>;\n}\n\nexport const DEFAULT_BASE_URL = \"https://api.celesto.ai\";\n\nexport const buildRequestContext = (config: ClientConfig): RequestContext => ({\n fetch: config.fetch ?? fetch,\n baseUrl: config.baseUrl ?? DEFAULT_BASE_URL,\n token: config.token ?? config.apiKey,\n organizationId: config.organizationId,\n userAgent: config.userAgent,\n timeoutMs: config.timeoutMs,\n headers: config.headers,\n});\n","/** Base error for all Celesto SDK errors. */\nexport class CelestoError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"CelestoError\";\n }\n}\n\n/** Thrown when an API request returns a non-2xx HTTP status. */\nexport class CelestoApiError extends CelestoError {\n readonly status: number;\n readonly data: unknown;\n readonly requestId?: string;\n\n constructor(message: string, status: number, data: unknown, requestId?: string) {\n super(message);\n this.name = \"CelestoApiError\";\n this.status = status;\n this.data = data;\n this.requestId = requestId;\n }\n}\n\n/** Thrown when fetch() itself fails — DNS, network, timeout, abort. */\nexport class CelestoNetworkError extends CelestoError {\n readonly cause?: Error;\n\n constructor(message: string, cause?: Error) {\n super(message);\n this.name = \"CelestoNetworkError\";\n this.cause = cause;\n }\n}\n","import { CelestoApiError, CelestoNetworkError } from \"./errors\";\nimport { RequestContext, RequestOptions } from \"./config\";\n\nconst joinUrl = (baseUrl: string, path: string): string => {\n const trimmedBase = baseUrl.endsWith(\"/\") ? baseUrl.slice(0, -1) : baseUrl;\n const normalizedPath = path.startsWith(\"/\") ? path : `/${path}`;\n return `${trimmedBase}${normalizedPath}`;\n};\n\nconst buildQuery = (\n query?: RequestOptions[\"query\"],\n): string => {\n if (!query) {\n return \"\";\n }\n\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(query)) {\n if (value === undefined || value === null) {\n continue;\n }\n if (Array.isArray(value)) {\n for (const item of value) {\n params.append(key, String(item));\n }\n continue;\n }\n params.set(key, String(value));\n }\n\n const serialized = params.toString();\n return serialized ? `?${serialized}` : \"\";\n};\n\nconst parseResponseBody = async (response: Response): Promise<unknown> => {\n if (response.status === 204) {\n return undefined;\n }\n\n const contentType = response.headers.get(\"content-type\") ?? \"\";\n if (contentType.includes(\"application/json\")) {\n return response.json();\n }\n\n return response.text();\n};\n\nconst extractErrorMessage = (data: unknown, status: number): string => {\n if (data && typeof data === \"object\") {\n const record = data as Record<string, unknown>;\n if (typeof record.detail === \"string\") {\n return record.detail;\n }\n if (typeof record.message === \"string\") {\n return record.message;\n }\n if (typeof record.error === \"string\") {\n return record.error;\n }\n }\n return `Request failed with status ${status}`;\n};\n\nexport const request = async <T>(ctx: RequestContext, options: RequestOptions): Promise<T> => {\n const url = `${joinUrl(ctx.baseUrl, options.path)}${buildQuery(options.query)}`;\n\n const headers: Record<string, string> = {\n ...(ctx.headers ?? {}),\n ...(options.headers ?? {}),\n };\n\n if (ctx.token) {\n headers.Authorization = `Bearer ${ctx.token}`;\n }\n\n if (ctx.organizationId) {\n headers[\"X-Current-Organization\"] = ctx.organizationId;\n }\n\n if (ctx.userAgent && !headers[\"User-Agent\"]) {\n headers[\"User-Agent\"] = ctx.userAgent;\n }\n\n const init: RequestInit = {\n method: options.method,\n headers,\n body: undefined,\n signal: options.signal,\n };\n\n if (options.body !== undefined) {\n headers[\"Content-Type\"] = headers[\"Content-Type\"] ?? \"application/json\";\n init.body = headers[\"Content-Type\"].includes(\"application/json\")\n ? JSON.stringify(options.body)\n : (options.body as BodyInit);\n }\n\n let timeoutId: ReturnType<typeof setTimeout> | undefined;\n let controller: AbortController | undefined;\n\n if (!options.signal && ctx.timeoutMs && ctx.timeoutMs > 0) {\n controller = new AbortController();\n timeoutId = setTimeout(() => controller?.abort(), ctx.timeoutMs);\n init.signal = controller.signal;\n }\n\n try {\n const response = await ctx.fetch(url, init);\n const data = await parseResponseBody(response);\n\n if (!response.ok) {\n const message = extractErrorMessage(data, response.status);\n throw new CelestoApiError(message, response.status, data, response.headers.get(\"x-request-id\") ?? undefined);\n }\n\n return data as T;\n } catch (err) {\n if (err instanceof CelestoApiError) {\n throw err;\n }\n const error = err instanceof Error ? err : new Error(String(err));\n throw new CelestoNetworkError(error.message, error);\n } finally {\n if (timeoutId) {\n clearTimeout(timeoutId);\n }\n }\n};\n","import { buildRequestContext, ClientConfig, RequestOverrides } from \"../core/config\";\nimport { request } from \"../core/http\";\nimport {\n ComputerConnectionInfo,\n ComputerExecResponse,\n ComputerInfo,\n ComputerListResponse,\n ComputerStatus,\n CreateComputerParams,\n ExecParams,\n SandboxTemplateInfo,\n TerminalConnectionInfo,\n} from \"./types\";\n\ninterface ComputerConnectionInfoWire {\n ssh?: string | null;\n access_url?: string | null;\n}\n\ninterface ComputerInfoWire {\n id: string;\n name: string;\n status: ComputerStatus;\n vcpus: number;\n ram_mb: number;\n disk_size_mb: number;\n image: string;\n template_id: string;\n template_version?: string | null;\n connection?: ComputerConnectionInfoWire | null;\n last_error?: string | null;\n created_at: string;\n stopped_at?: string | null;\n}\n\ninterface ComputerListResponseWire {\n computers: ComputerInfoWire[];\n count: number;\n}\n\ninterface ComputerExecResponseWire {\n exit_code: number;\n stdout: string;\n stderr: string;\n}\n\ninterface SandboxTemplateInfoWire {\n id: string;\n display_name: string;\n description: string;\n default_vcpus: number;\n default_ram_mb: number;\n default_disk_size_mb: number;\n version?: string | null;\n experimental: boolean;\n}\n\nconst toConnection = (\n payload: ComputerConnectionInfoWire | null | undefined,\n): ComputerConnectionInfo | undefined => {\n if (!payload) {\n return undefined;\n }\n const out: ComputerConnectionInfo = {};\n if (payload.ssh != null) {\n out.ssh = payload.ssh;\n }\n if (payload.access_url != null) {\n out.accessUrl = payload.access_url;\n }\n return out;\n};\n\nconst toComputerInfo = (payload: ComputerInfoWire): ComputerInfo => ({\n id: payload.id,\n name: payload.name,\n status: payload.status,\n vcpus: payload.vcpus,\n ramMb: payload.ram_mb,\n diskSizeMb: payload.disk_size_mb,\n image: payload.image,\n templateId: payload.template_id,\n templateVersion: payload.template_version ?? null,\n connection: toConnection(payload.connection),\n lastError: payload.last_error ?? null,\n createdAt: payload.created_at,\n stoppedAt: payload.stopped_at ?? null,\n});\n\nconst toExecResponse = (payload: ComputerExecResponseWire): ComputerExecResponse => ({\n exitCode: payload.exit_code,\n stdout: payload.stdout,\n stderr: payload.stderr,\n});\n\nconst toSandboxTemplateInfo = (payload: SandboxTemplateInfoWire): SandboxTemplateInfo => ({\n id: payload.id,\n displayName: payload.display_name,\n description: payload.description,\n defaultVcpus: payload.default_vcpus,\n defaultRamMb: payload.default_ram_mb,\n defaultDiskSizeMb: payload.default_disk_size_mb,\n version: payload.version ?? null,\n experimental: payload.experimental,\n});\n\nconst buildCreateComputerBody = (params: CreateComputerParams): Record<string, unknown> => {\n if (params.cpus !== undefined && params.vcpus !== undefined && params.cpus !== params.vcpus) {\n throw new Error(\"cpus and vcpus must have the same value when both are provided.\");\n }\n if (params.memory !== undefined && params.ramMb !== undefined && params.memory !== params.ramMb) {\n throw new Error(\"memory and ramMb must have the same value when both are provided.\");\n }\n\n const body: Record<string, unknown> = {};\n const vcpus = params.vcpus ?? params.cpus;\n const ramMb = params.ramMb ?? params.memory;\n if (vcpus !== undefined) {\n body.vcpus = vcpus;\n }\n if (ramMb !== undefined) {\n body.ram_mb = ramMb;\n }\n if (params.diskSizeMb !== undefined) {\n body.disk_size_mb = params.diskSizeMb;\n }\n if (params.image !== undefined) {\n body.image = params.image;\n }\n if (params.templateId !== undefined) {\n body.template_id = params.templateId;\n }\n if (params.templateVersion !== undefined) {\n body.template_version = params.templateVersion;\n }\n return body;\n};\n\nconst computersPath = (path: string): string => `/v1/computers${path}`;\n\nconst pickOverrides = (options?: RequestOverrides): RequestOverrides => ({\n headers: options?.headers,\n signal: options?.signal,\n});\n\n/**\n * Client for managing sandboxed computers (AI sandboxes).\n *\n * Provides create/list/get/exec/stop/start/delete over HTTP, plus\n * `getTerminalConnection()` which returns the URL and headers needed\n * to open a WebSocket terminal with any WS library of your choice.\n *\n * @example\n * ```ts\n * const celesto = new Celesto({ token: process.env.CELESTO_API_KEY });\n * const computer = await celesto.computers.create({ templateId: \"coding-agent\" });\n * const result = await celesto.computers.exec(computer.id, \"uname -a\");\n * console.log(result.stdout);\n * await celesto.computers.delete(computer.id);\n * ```\n */\nexport class ComputersClient {\n private readonly config: ClientConfig;\n\n constructor(config: ClientConfig) {\n this.config = config;\n }\n\n async create(params: CreateComputerParams = {}, options?: RequestOverrides): Promise<ComputerInfo> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerInfoWire>(ctx, {\n method: \"POST\",\n path: computersPath(\"\"),\n body: buildCreateComputerBody(params),\n ...pickOverrides(options),\n });\n return toComputerInfo(data);\n }\n\n async listTemplates(options?: RequestOverrides): Promise<SandboxTemplateInfo[]> {\n const ctx = buildRequestContext(this.config);\n const data = await request<SandboxTemplateInfoWire[]>(ctx, {\n method: \"GET\",\n path: computersPath(\"/templates\"),\n ...pickOverrides(options),\n });\n return data.map(toSandboxTemplateInfo);\n }\n\n async list(options?: RequestOverrides): Promise<ComputerListResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerListResponseWire>(ctx, {\n method: \"GET\",\n path: computersPath(\"\"),\n ...pickOverrides(options),\n });\n return {\n computers: data.computers.map(toComputerInfo),\n count: data.count,\n };\n }\n\n async get(computerId: string, options?: RequestOverrides): Promise<ComputerInfo> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerInfoWire>(ctx, {\n method: \"GET\",\n path: computersPath(`/${encodeURIComponent(computerId)}`),\n ...pickOverrides(options),\n });\n return toComputerInfo(data);\n }\n\n async exec(\n computerId: string,\n command: string,\n params: ExecParams = {},\n options?: RequestOverrides,\n ): Promise<ComputerExecResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerExecResponseWire>(ctx, {\n method: \"POST\",\n path: computersPath(`/${encodeURIComponent(computerId)}/exec`),\n body: {\n command,\n timeout: params.timeout ?? 30,\n },\n ...pickOverrides(options),\n });\n return toExecResponse(data);\n }\n\n async stop(computerId: string, options?: RequestOverrides): Promise<ComputerInfo> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerInfoWire>(ctx, {\n method: \"POST\",\n path: computersPath(`/${encodeURIComponent(computerId)}/stop`),\n ...pickOverrides(options),\n });\n return toComputerInfo(data);\n }\n\n async start(computerId: string, options?: RequestOverrides): Promise<ComputerInfo> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerInfoWire>(ctx, {\n method: \"POST\",\n path: computersPath(`/${encodeURIComponent(computerId)}/start`),\n ...pickOverrides(options),\n });\n return toComputerInfo(data);\n }\n\n async delete(computerId: string, options?: RequestOverrides): Promise<ComputerInfo> {\n const ctx = buildRequestContext(this.config);\n const data = await request<ComputerInfoWire>(ctx, {\n method: \"DELETE\",\n path: computersPath(`/${encodeURIComponent(computerId)}`),\n ...pickOverrides(options),\n });\n return toComputerInfo(data);\n }\n\n /**\n * Get connection info for opening a WebSocket terminal session.\n *\n * Accepts either a computer ID (e.g. `cmp_xxx`) or a human-readable name.\n * The name is resolved to the canonical ID via a GET call — the backend's\n * WebSocket endpoint does not resolve names on its own.\n *\n * Returns the URL, headers, and first message needed to open the connection\n * with any WebSocket library of your choice.\n *\n * @example\n * ```ts\n * const conn = await celesto.computers.getTerminalConnection(\"my-computer\");\n * const ws = new WebSocket(conn.url, { headers: conn.headers });\n * ws.on(\"open\", () => ws.send(conn.firstMessage));\n * ws.on(\"message\", (data) => process.stdout.write(data));\n * ```\n */\n async getTerminalConnection(computerIdOrName: string): Promise<TerminalConnectionInfo> {\n const info = await this.get(computerIdOrName);\n const ctx = buildRequestContext(this.config);\n\n if (!ctx.token) {\n throw new Error(\"A token is required for terminal connections\");\n }\n\n const wsBase = ctx.baseUrl.replace(/^https:/i, \"wss:\").replace(/^http:/i, \"ws:\");\n const url = `${wsBase}/v1/computers/${encodeURIComponent(info.id)}/terminal`;\n\n const headers: Record<string, string> = {\n Authorization: `Bearer ${ctx.token}`,\n };\n if (ctx.organizationId) {\n headers[\"X-Current-Organization\"] = ctx.organizationId;\n }\n\n return {\n url,\n headers,\n firstMessage: JSON.stringify({ token: ctx.token }),\n };\n }\n}\n","import { buildRequestContext, ClientConfig, RequestOverrides } from \"../core/config\";\nimport { request } from \"../core/http\";\nimport {\n GatekeeperAccessRules,\n GatekeeperAccessRulesParams,\n GatekeeperConnectRequest,\n GatekeeperConnectResponse,\n GatekeeperConnection,\n GatekeeperDriveFile,\n GatekeeperDriveListParams,\n GatekeeperDriveListResponse,\n GatekeeperListConnectionsParams,\n GatekeeperListConnectionsResponse,\n GatekeeperRevokeParams,\n GatekeeperRevokeResponse,\n} from \"./types\";\n\ninterface GatekeeperConnectRequestWire {\n subject: string;\n provider: string;\n project_name: string;\n redirect_uri?: string;\n}\n\ninterface GatekeeperConnectResponseWire {\n status: string;\n oauth_url?: string | null;\n connection_id?: string | null;\n}\n\ninterface GatekeeperConnectionWire {\n id: string;\n subject: string;\n provider: string;\n project_id: string;\n account_email?: string | null;\n scopes?: string[];\n status: string;\n created_at: string;\n updated_at: string;\n last_used_at?: string | null;\n access_rules?: {\n allowed_folders?: string[];\n allowed_files?: string[];\n version?: string;\n } | null;\n}\n\ninterface GatekeeperListConnectionsResponseWire {\n data: GatekeeperConnectionWire[];\n total: number;\n}\n\ninterface GatekeeperDriveFileWire {\n id: string;\n name?: string | null;\n mime_type?: string | null;\n size?: number | null;\n modified_time?: string | null;\n created_time?: string | null;\n web_view_link?: string | null;\n icon_link?: string | null;\n thumbnail_link?: string | null;\n parents?: string[] | null;\n drive_id?: string | null;\n shared?: boolean | null;\n owned_by_me?: boolean | null;\n}\n\ninterface GatekeeperDriveListResponseWire {\n files: GatekeeperDriveFileWire[];\n next_page_token?: string | null;\n}\n\ninterface GatekeeperAccessRulesResponseWire {\n version: string;\n allowed_folders: string[];\n allowed_files: string[];\n unrestricted: boolean;\n}\n\nconst toConnectRequest = (payload: GatekeeperConnectRequest): GatekeeperConnectRequestWire => ({\n subject: payload.subject,\n provider: payload.provider ?? \"google_drive\",\n project_name: payload.projectName,\n redirect_uri: payload.redirectUri,\n});\n\nconst toConnectResponse = (payload: GatekeeperConnectResponseWire): GatekeeperConnectResponse => ({\n status: payload.status,\n oauthUrl: payload.oauth_url ?? undefined,\n connectionId: payload.connection_id ?? undefined,\n});\n\nconst toConnection = (payload: GatekeeperConnectionWire): GatekeeperConnection => ({\n id: payload.id,\n subject: payload.subject,\n provider: payload.provider,\n projectId: payload.project_id,\n accountEmail: payload.account_email ?? null,\n scopes: payload.scopes ?? [],\n status: payload.status,\n createdAt: payload.created_at,\n updatedAt: payload.updated_at,\n lastUsedAt: payload.last_used_at ?? null,\n accessRules: payload.access_rules\n ? {\n version: payload.access_rules.version ?? \"1\",\n allowedFolders: payload.access_rules.allowed_folders ?? [],\n allowedFiles: payload.access_rules.allowed_files ?? [],\n unrestricted: false,\n }\n : null,\n});\n\nconst toAccessRules = (payload: GatekeeperAccessRulesResponseWire): GatekeeperAccessRules => ({\n version: payload.version,\n allowedFolders: payload.allowed_folders ?? [],\n allowedFiles: payload.allowed_files ?? [],\n unrestricted: payload.unrestricted,\n});\n\nconst toDriveFile = (payload: GatekeeperDriveFileWire): GatekeeperDriveFile => ({\n id: payload.id,\n name: payload.name ?? null,\n mimeType: payload.mime_type ?? null,\n size: payload.size ?? null,\n modifiedTime: payload.modified_time ?? null,\n createdTime: payload.created_time ?? null,\n webViewLink: payload.web_view_link ?? null,\n iconLink: payload.icon_link ?? null,\n thumbnailLink: payload.thumbnail_link ?? null,\n parents: payload.parents ?? null,\n driveId: payload.drive_id ?? null,\n shared: payload.shared ?? null,\n ownedByMe: payload.owned_by_me ?? null,\n});\n\nconst gatekeeperPath = (path: string): string => `/v1/gatekeeper${path}`;\n\nconst pickOverrides = (options?: RequestOverrides): RequestOverrides => ({\n headers: options?.headers,\n signal: options?.signal,\n});\n\nexport class GatekeeperClient {\n private readonly config: ClientConfig;\n\n constructor(config: ClientConfig) {\n this.config = config;\n }\n\n async connect(payload: GatekeeperConnectRequest, options?: RequestOverrides): Promise<GatekeeperConnectResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperConnectResponseWire>(ctx, {\n method: \"POST\",\n path: gatekeeperPath(\"/connect\"),\n body: toConnectRequest(payload),\n ...pickOverrides(options),\n });\n return toConnectResponse(data);\n }\n\n async listConnections(params: GatekeeperListConnectionsParams, options?: RequestOverrides): Promise<GatekeeperListConnectionsResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperListConnectionsResponseWire>(ctx, {\n method: \"GET\",\n path: gatekeeperPath(\"/connections\"),\n query: {\n project_name: params.projectName,\n status_filter: params.statusFilter,\n },\n ...pickOverrides(options),\n });\n\n return {\n total: data.total,\n data: data.data.map(toConnection),\n };\n }\n\n async getConnection(connectionId: string, options?: RequestOverrides): Promise<GatekeeperConnection> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperConnectionWire>(ctx, {\n method: \"GET\",\n path: gatekeeperPath(`/connections/${connectionId}`),\n ...pickOverrides(options),\n });\n return toConnection(data);\n }\n\n async revokeConnection(params: GatekeeperRevokeParams, options?: RequestOverrides): Promise<GatekeeperRevokeResponse> {\n const ctx = buildRequestContext(this.config);\n return request<GatekeeperRevokeResponse>(ctx, {\n method: \"DELETE\",\n path: gatekeeperPath(\"/connections\"),\n query: {\n subject: params.subject,\n project_name: params.projectName,\n provider: params.provider,\n },\n ...pickOverrides(options),\n });\n }\n\n async listDriveFiles(params: GatekeeperDriveListParams, options?: RequestOverrides): Promise<GatekeeperDriveListResponse> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperDriveListResponseWire>(ctx, {\n method: \"GET\",\n path: gatekeeperPath(\"/connectors/drive/files\"),\n query: {\n project_name: params.projectName,\n subject: params.subject,\n page_size: params.pageSize,\n page_token: params.pageToken,\n folder_id: params.folderId,\n query: params.query,\n include_folders: params.includeFolders,\n order_by: params.orderBy,\n },\n ...pickOverrides(options),\n });\n\n return {\n files: data.files.map(toDriveFile),\n nextPageToken: data.next_page_token ?? null,\n };\n }\n\n async getAccessRules(connectionId: string, options?: RequestOverrides): Promise<GatekeeperAccessRules> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperAccessRulesResponseWire>(ctx, {\n method: \"GET\",\n path: gatekeeperPath(`/connections/${connectionId}/access-rules`),\n ...pickOverrides(options),\n });\n return toAccessRules(data);\n }\n\n async updateAccessRules(params: GatekeeperAccessRulesParams, options?: RequestOverrides): Promise<GatekeeperAccessRules> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperAccessRulesResponseWire>(ctx, {\n method: \"PUT\",\n path: gatekeeperPath(\"/connections/access-rules\"),\n query: {\n subject: params.subject,\n project_name: params.projectName,\n provider: params.provider,\n },\n body: {\n allowed_folders: params.accessRules.allowedFolders ?? [],\n allowed_files: params.accessRules.allowedFiles ?? [],\n },\n ...pickOverrides(options),\n });\n return toAccessRules(data);\n }\n\n async clearAccessRules(connectionId: string, options?: RequestOverrides): Promise<GatekeeperAccessRules> {\n const ctx = buildRequestContext(this.config);\n const data = await request<GatekeeperAccessRulesResponseWire>(ctx, {\n method: \"DELETE\",\n path: gatekeeperPath(`/connections/${connectionId}/access-rules`),\n ...pickOverrides(options),\n });\n return toAccessRules(data);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AC6CO,IAAM,mBAAmB;AAEzB,IAAM,sBAAsB,CAAC,YAA0C;AAAA,EAC5E,OAAO,OAAO,SAAS;AAAA,EACvB,SAAS,OAAO,WAAW;AAAA,EAC3B,OAAO,OAAO,SAAS,OAAO;AAAA,EAC9B,gBAAgB,OAAO;AAAA,EACvB,WAAW,OAAO;AAAA,EAClB,WAAW,OAAO;AAAA,EAClB,SAAS,OAAO;AAClB;;;ACtDO,IAAM,eAAN,cAA2B,MAAM;AAAA,EACtC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAGO,IAAM,kBAAN,cAA8B,aAAa;AAAA,EAKhD,YAAY,SAAiB,QAAgB,MAAe,WAAoB;AAC9E,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,S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G,UAAM,MAAM,oBAAoB,KAAK,MAAM;AAC3C,UAAM,OAAO,MAAM,QAA2C,KAAK;AAAA,MACjE,QAAQ;AAAA,MACR,MAAM,eAAe,gBAAgB,YAAY,eAAe;AAAA,MAChE,GAAGA,eAAc,OAAO;AAAA,IAC1B,CAAC;AACD,WAAO,cAAc,IAAI;AAAA,EAC3B;AACF;;;ALxOO,IAAM,UAAN,MAAc;AAAA,EAInB,YAAY,QAAsB;AAChC,SAAK,aAAa,IAAI,iBAAiB,MAAM;AAC7C,SAAK,YAAY,IAAI,gBAAgB,MAAM;AAAA,EAC7C;AACF;","names":["toConnection","pickOverrides"]}
@@ -0,0 +1,31 @@
1
+ import { ComputersClient } from './computers/index.cjs';
2
+ export { ComputerConnectionInfo, ComputerExecResponse, ComputerInfo, ComputerListResponse, ComputerStatus, CreateComputerParams, ExecParams, SandboxTemplateInfo, TerminalConnectionInfo } from './computers/index.cjs';
3
+ import { GatekeeperClient } from './gatekeeper/index.cjs';
4
+ export { GatekeeperAccessRules, GatekeeperAccessRulesParams, GatekeeperAccessRulesUpdate, GatekeeperConnectRequest, GatekeeperConnectResponse, GatekeeperConnection, GatekeeperDriveFile, GatekeeperDriveListParams, GatekeeperDriveListResponse, GatekeeperListConnectionsParams, GatekeeperListConnectionsResponse, GatekeeperRevokeParams, GatekeeperRevokeResponse } from './gatekeeper/index.cjs';
5
+ import { C as ClientConfig } from './config-BTTpuv_b.cjs';
6
+ export { R as RequestOverrides } from './config-BTTpuv_b.cjs';
7
+
8
+ /** Base error for all Celesto SDK errors. */
9
+ declare class CelestoError extends Error {
10
+ constructor(message: string);
11
+ }
12
+ /** Thrown when an API request returns a non-2xx HTTP status. */
13
+ declare class CelestoApiError extends CelestoError {
14
+ readonly status: number;
15
+ readonly data: unknown;
16
+ readonly requestId?: string;
17
+ constructor(message: string, status: number, data: unknown, requestId?: string);
18
+ }
19
+ /** Thrown when fetch() itself fails — DNS, network, timeout, abort. */
20
+ declare class CelestoNetworkError extends CelestoError {
21
+ readonly cause?: Error;
22
+ constructor(message: string, cause?: Error);
23
+ }
24
+
25
+ declare class Celesto {
26
+ readonly gatekeeper: GatekeeperClient;
27
+ readonly computers: ComputersClient;
28
+ constructor(config: ClientConfig);
29
+ }
30
+
31
+ export { Celesto, CelestoApiError, CelestoError, CelestoNetworkError, ClientConfig, ComputersClient, GatekeeperClient };