openpond-sdk 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +54 -0
  2. package/dist/actions-local.js +15184 -0
  3. package/dist/actions-local.js.map +7 -0
  4. package/dist/actions.js +14615 -0
  5. package/dist/actions.js.map +7 -0
  6. package/dist/index.js +682 -965
  7. package/dist/index.js.map +3 -3
  8. package/dist/project-actions.js +247 -0
  9. package/dist/project-actions.js.map +7 -0
  10. package/dist/types/packages/actions/src/build.d.ts +9 -0
  11. package/dist/types/packages/actions/src/build.d.ts.map +1 -0
  12. package/dist/types/packages/actions/src/catalog.d.ts +4 -0
  13. package/dist/types/packages/actions/src/catalog.d.ts.map +1 -0
  14. package/dist/types/packages/actions/src/configuration.d.ts +20 -0
  15. package/dist/types/packages/actions/src/configuration.d.ts.map +1 -0
  16. package/dist/types/packages/actions/src/define-action.d.ts +4 -0
  17. package/dist/types/packages/actions/src/define-action.d.ts.map +1 -0
  18. package/dist/types/packages/actions/src/discovery.d.ts +9 -0
  19. package/dist/types/packages/actions/src/discovery.d.ts.map +1 -0
  20. package/dist/types/packages/actions/src/hash.d.ts +3 -0
  21. package/dist/types/packages/actions/src/hash.d.ts.map +1 -0
  22. package/dist/types/packages/actions/src/index.d.ts +4 -0
  23. package/dist/types/packages/actions/src/index.d.ts.map +1 -0
  24. package/dist/types/packages/actions/src/local.d.ts +6 -0
  25. package/dist/types/packages/actions/src/local.d.ts.map +1 -0
  26. package/dist/types/packages/actions/src/schema.d.ts +4 -0
  27. package/dist/types/packages/actions/src/schema.d.ts.map +1 -0
  28. package/dist/types/packages/actions/src/setup.d.ts +4 -0
  29. package/dist/types/packages/actions/src/setup.d.ts.map +1 -0
  30. package/dist/types/packages/actions/src/types.d.ts +161 -0
  31. package/dist/types/packages/actions/src/types.d.ts.map +1 -0
  32. package/dist/types/packages/sdk/src/actions-local.d.ts +3 -0
  33. package/dist/types/packages/sdk/src/actions-local.d.ts.map +1 -0
  34. package/dist/types/packages/sdk/src/actions.d.ts +3 -0
  35. package/dist/types/packages/sdk/src/actions.d.ts.map +1 -0
  36. package/dist/types/packages/sdk/src/index.d.ts +10 -6
  37. package/dist/types/packages/sdk/src/index.d.ts.map +1 -1
  38. package/dist/types/packages/sdk/src/project-actions.d.ts +66 -0
  39. package/dist/types/packages/sdk/src/project-actions.d.ts.map +1 -0
  40. package/dist/types/packages/sdk/src/work.d.ts +2 -2
  41. package/dist/types/packages/sdk/src/work.d.ts.map +1 -1
  42. package/package.json +24 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- // ../cloud/src/sandbox/client-handles.ts
1
+ // ../cloud/dist/sandbox/client-handles.js
2
2
  function createSandboxRuntimeNamespace(client) {
3
3
  return {
4
4
  list: (input = {}) => client.listSandboxRuntimes(input),
@@ -61,7 +61,7 @@ function createSandboxAgentNamespace(client) {
61
61
  };
62
62
  }
63
63
 
64
- // ../cloud/src/sandbox/runtime-handle.ts
64
+ // ../cloud/dist/sandbox/runtime-handle.js
65
65
  function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
66
66
  const currentSandbox = async (input = {}, options = {}) => {
67
67
  const runtime = await client.getSandboxRuntime(runtimeId);
@@ -114,7 +114,8 @@ function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
114
114
  }
115
115
  });
116
116
  const current = await client.getSandboxRuntime(runtimeId);
117
- if (current.status === "waiting_for_user") return current;
117
+ if (current.status === "waiting_for_user")
118
+ return current;
118
119
  return client.updateSandboxRuntimeStatus(runtimeId, {
119
120
  status: "waiting_for_user",
120
121
  expectedVersion: current.version,
@@ -181,16 +182,10 @@ function createSandboxRuntimeHandle(client, runtimeId, initial = null) {
181
182
  move: async (input) => client.moveFile((await resume()).id, input)
182
183
  },
183
184
  commands: {
184
- run: async (command) => client.exec(
185
- (await resume()).id,
186
- typeof command === "string" ? { command } : command
187
- )
185
+ run: async (command) => client.exec((await resume()).id, typeof command === "string" ? { command } : command)
188
186
  },
189
187
  ports: {
190
- expose: async (port) => client.openPort(
191
- (await resume()).id,
192
- typeof port === "number" ? { port } : port
193
- )
188
+ expose: async (port) => client.openPort((await resume()).id, typeof port === "number" ? { port } : port)
194
189
  },
195
190
  promote: (input, options = {}) => client.promoteSandboxRuntime(runtimeId, input, options),
196
191
  preserveSource: (input = {}, options = {}) => client.preserveSandboxRuntimeSource(runtimeId, input, options),
@@ -214,7 +209,7 @@ function runtimeKeepaliveUntilIso(input) {
214
209
  return new Date(Date.now() + seconds * 1e3).toISOString();
215
210
  }
216
211
 
217
- // ../cloud/src/sandbox/smoke.ts
212
+ // ../cloud/dist/sandbox/smoke.js
218
213
  async function runSandboxSmoke(client, options = {}) {
219
214
  const runId = `openpond-code-smoke-${Date.now()}`;
220
215
  const expectedExec = `openpond-code-exec-ok:${runId}`;
@@ -226,37 +221,29 @@ async function runSandboxSmoke(client, options = {}) {
226
221
  let deleted = false;
227
222
  let forkDeleted = false;
228
223
  try {
229
- const sandbox = await waitForCreateReady(
230
- client,
231
- await client.create(
232
- {
233
- repo: options.repo ?? "https://github.com/octocat/Hello-World",
234
- resources: {
235
- cpu: options.cpu ?? 1,
236
- memoryGb: options.memoryGb ?? 1,
237
- diskGb: options.diskGb ?? 8
238
- },
239
- budget: { maxUsd: options.budgetUsd ?? "0.05" },
240
- quotas: {
241
- maxSpendUsd: options.budgetUsd ?? "0.05",
242
- maxDurationSeconds: 600,
243
- idleTimeoutSeconds: 600,
244
- maxOpenPorts: 2
245
- },
246
- metadata: {
247
- runId,
248
- source: "openpond-code-sandbox-smoke"
249
- }
250
- },
251
- { async: true }
252
- )
253
- );
224
+ const sandbox = await waitForCreateReady(client, await client.create({
225
+ repo: options.repo ?? "https://github.com/octocat/Hello-World",
226
+ resources: {
227
+ cpu: options.cpu ?? 1,
228
+ memoryGb: options.memoryGb ?? 1,
229
+ diskGb: options.diskGb ?? 8
230
+ },
231
+ budget: { maxUsd: options.budgetUsd ?? "0.05" },
232
+ quotas: {
233
+ maxSpendUsd: options.budgetUsd ?? "0.05",
234
+ maxDurationSeconds: 600,
235
+ idleTimeoutSeconds: 600,
236
+ maxOpenPorts: 2
237
+ },
238
+ metadata: {
239
+ runId,
240
+ source: "openpond-code-sandbox-smoke"
241
+ }
242
+ }, { async: true }));
254
243
  sandboxId = sandbox.id;
255
244
  const expectedMppMode = options.expectedMppMode;
256
245
  if (expectedMppMode && sandbox.reservation.mpp?.mode !== expectedMppMode) {
257
- throw new Error(
258
- `expected ${expectedMppMode} reservation, got ${sandbox.reservation.mpp?.mode ?? "none"}`
259
- );
246
+ throw new Error(`expected ${expectedMppMode} reservation, got ${sandbox.reservation.mpp?.mode ?? "none"}`);
260
247
  }
261
248
  if (!expectedMppMode && !sandbox.reservation.mpp?.mode) {
262
249
  throw new Error("expected sandbox reservation MPP metadata");
@@ -279,15 +266,8 @@ async function runSandboxSmoke(client, options = {}) {
279
266
  if (!exec.command.output.includes(expectedExec)) {
280
267
  throw new Error("expected exec marker");
281
268
  }
282
- await client.uploadFile(
283
- sandbox.id,
284
- "openpond-code-smoke.txt",
285
- expectedFile
286
- );
287
- const downloaded = await client.downloadFile(
288
- sandbox.id,
289
- "openpond-code-smoke.txt"
290
- );
269
+ await client.uploadFile(sandbox.id, "openpond-code-smoke.txt", expectedFile);
270
+ const downloaded = await client.downloadFile(sandbox.id, "openpond-code-smoke.txt");
291
271
  if (downloaded !== expectedFile) {
292
272
  throw new Error("expected file roundtrip marker");
293
273
  }
@@ -323,11 +303,7 @@ async function runSandboxSmoke(client, options = {}) {
323
303
  }
324
304
  }
325
305
  });
326
- const snapshot = snapshotResponse.snapshot ?? (await waitForSnapshotReady(
327
- client,
328
- sandbox.id,
329
- snapshotResponse.snapshotJob?.snapshotId
330
- )).snapshot;
306
+ const snapshot = snapshotResponse.snapshot ?? (await waitForSnapshotReady(client, sandbox.id, snapshotResponse.snapshotJob?.snapshotId)).snapshot;
331
307
  snapshotId = snapshot.id;
332
308
  if (snapshot.state !== "ready") {
333
309
  throw new Error(`expected ready snapshot, got ${snapshot.state}`);
@@ -337,29 +313,20 @@ async function runSandboxSmoke(client, options = {}) {
337
313
  if (!snapshotId) {
338
314
  throw new Error("expected snapshot id before fork");
339
315
  }
340
- const forked = await waitForCreateReady(
341
- client,
342
- (await client.forkSnapshot(
343
- snapshotId,
344
- {
345
- budget: { maxUsd: options.budgetUsd ?? "0.05" },
346
- metadata: {
347
- source: "openpond-code-sandbox-smoke-fork",
348
- templateSnapshotId: snapshotId
349
- }
350
- },
351
- { async: true }
352
- )).sandbox
353
- );
316
+ const forked = await waitForCreateReady(client, (await client.forkSnapshot(snapshotId, {
317
+ budget: { maxUsd: options.budgetUsd ?? "0.05" },
318
+ metadata: {
319
+ source: "openpond-code-sandbox-smoke-fork",
320
+ templateSnapshotId: snapshotId
321
+ }
322
+ }, { async: true })).sandbox);
354
323
  forkSandboxId = forked.id;
355
324
  const forkExec = await client.exec(forked.id, {
356
325
  command: "cat openpond-code-smoke.txt",
357
326
  timeoutSeconds: 120
358
327
  });
359
328
  if (forkExec.command.status !== "succeeded") {
360
- throw new Error(
361
- `expected fork command success, got ${forkExec.command.status}`
362
- );
329
+ throw new Error(`expected fork command success, got ${forkExec.command.status}`);
363
330
  }
364
331
  if (!forkExec.command.output.includes(expectedFile)) {
365
332
  throw new Error("expected fork snapshot marker");
@@ -385,10 +352,7 @@ async function runSandboxSmoke(client, options = {}) {
385
352
  throw new Error("expected preview marker");
386
353
  }
387
354
  }
388
- const { sandbox: readback, receipts } = await stopSandboxForSmoke(
389
- client,
390
- sandbox.id
391
- );
355
+ const { sandbox: readback, receipts } = await stopSandboxForSmoke(client, sandbox.id);
392
356
  if (!options.keep) {
393
357
  await deleteSandboxForSmoke(client, sandbox.id);
394
358
  deleted = true;
@@ -421,12 +385,7 @@ async function stopSandboxForSmoke(client, sandboxId) {
421
385
  } catch {
422
386
  await client.stop(sandboxId, { async: true });
423
387
  }
424
- const sandbox = await waitForSandboxState(
425
- client,
426
- sandboxId,
427
- /* @__PURE__ */ new Set(["stopped", "deleted"]),
428
- "stop"
429
- );
388
+ const sandbox = await waitForSandboxState(client, sandboxId, /* @__PURE__ */ new Set(["stopped", "deleted"]), "stop");
430
389
  const receipts = await waitForReceipts(client, sandboxId);
431
390
  if (receipts.length === 0) {
432
391
  throw new Error("expected receipt readback");
@@ -443,12 +402,7 @@ async function deleteSandboxForSmoke(client, sandboxId) {
443
402
  } catch {
444
403
  await client.delete(sandboxId, { async: true });
445
404
  }
446
- return waitForSandboxState(
447
- client,
448
- sandboxId,
449
- /* @__PURE__ */ new Set(["deleted"]),
450
- "delete"
451
- );
405
+ return waitForSandboxState(client, sandboxId, /* @__PURE__ */ new Set(["deleted"]), "delete");
452
406
  }
453
407
  async function cleanupSandboxBestEffort(client, sandboxId) {
454
408
  try {
@@ -472,11 +426,7 @@ async function waitForSandboxState(client, sandboxId, targetStates, operation) {
472
426
  await sleep(pollMs);
473
427
  latest = await client.get(sandboxId);
474
428
  }
475
- throw new Error(
476
- `sandbox ${operation} did not reach ${[...targetStates].join(
477
- "/"
478
- )} before timeout: ${sandboxId} (${latest.state})`
479
- );
429
+ throw new Error(`sandbox ${operation} did not reach ${[...targetStates].join("/")} before timeout: ${sandboxId} (${latest.state})`);
480
430
  }
481
431
  async function waitForReceipts(client, sandboxId) {
482
432
  const timeoutMs = 2 * 6e4;
@@ -497,10 +447,8 @@ async function waitForCreateReady(client, sandbox) {
497
447
  return sandbox;
498
448
  }
499
449
  if (sandbox.state === "error") {
500
- throw new Error(
501
- `sandbox create failed: ${sandbox.id}
502
- ${sandbox.logs.join("\n")}`
503
- );
450
+ throw new Error(`sandbox create failed: ${sandbox.id}
451
+ ${sandbox.logs.join("\n")}`);
504
452
  }
505
453
  const timeoutMs = 12 * 6e4;
506
454
  const pollMs = 3e3;
@@ -513,15 +461,11 @@ ${sandbox.logs.join("\n")}`
513
461
  return latest;
514
462
  }
515
463
  if (latest.state === "error") {
516
- throw new Error(
517
- `sandbox create failed: ${latest.id}
518
- ${latest.logs.join("\n")}`
519
- );
464
+ throw new Error(`sandbox create failed: ${latest.id}
465
+ ${latest.logs.join("\n")}`);
520
466
  }
521
467
  }
522
- throw new Error(
523
- `sandbox create did not reach running state before timeout: ${latest.id} (${latest.state})`
524
- );
468
+ throw new Error(`sandbox create did not reach running state before timeout: ${latest.id} (${latest.state})`);
525
469
  }
526
470
  async function waitForSnapshotReady(client, sandboxId, snapshotId) {
527
471
  if (!snapshotId) {
@@ -536,34 +480,31 @@ async function waitForSnapshotReady(client, sandboxId, snapshotId) {
536
480
  if (snapshot?.state === "ready") {
537
481
  return { sandbox: latest, snapshot };
538
482
  }
539
- const job = latest.snapshotJobs?.find(
540
- (item) => item.snapshotId === snapshotId
541
- );
483
+ const job = latest.snapshotJobs?.find((item) => item.snapshotId === snapshotId);
542
484
  if (job?.status === "failed") {
543
485
  throw new Error(`snapshot job failed: ${job.error ?? snapshotId}`);
544
486
  }
545
487
  await sleep(pollMs);
546
488
  latest = await client.get(sandboxId);
547
489
  }
548
- throw new Error(
549
- `snapshot did not reach ready state before timeout: ${snapshotId}`
550
- );
490
+ throw new Error(`snapshot did not reach ready state before timeout: ${snapshotId}`);
551
491
  }
552
492
  function sleep(ms) {
553
493
  return new Promise((resolve) => setTimeout(resolve, ms));
554
494
  }
555
495
 
556
- // ../cloud/src/sandbox/async-request-options.ts
496
+ // ../cloud/dist/sandbox/async-request-options.js
557
497
  function asyncRequestHeaders(options = {}) {
558
498
  return options.async || options.respondAsync ? { Prefer: "respond-async" } : void 0;
559
499
  }
560
500
 
561
- // ../cloud/src/api/vercel-protection.ts
501
+ // ../cloud/dist/api/vercel-protection.js
562
502
  var VERCEL_PROTECTION_BYPASS_HEADER = "x-vercel-protection-bypass";
563
503
  function withVercelProtectionBypass(requestUrl, inputHeaders, env = typeof process === "undefined" ? {} : process.env) {
564
504
  const headers = new Headers(inputHeaders);
565
505
  const secret = env.VERCEL_AUTOMATION_BYPASS_SECRET?.trim();
566
- if (!secret || !isOpenPondStagingUrl(requestUrl)) return headers;
506
+ if (!secret || !isOpenPondStagingUrl(requestUrl))
507
+ return headers;
567
508
  headers.set(VERCEL_PROTECTION_BYPASS_HEADER, secret);
568
509
  return headers;
569
510
  }
@@ -576,33 +517,36 @@ function isOpenPondStagingUrl(requestUrl) {
576
517
  }
577
518
  }
578
519
 
579
- // ../cloud/src/api/core.ts
520
+ // ../cloud/dist/api/core.js
580
521
  var DEFAULT_API_TIMEOUT_MS = 3e4;
581
522
  var DEFAULT_API_RESPONSE_BYTES = 8 * 1024 * 1024;
582
523
  var LONG_STREAM_API_OPTIONS = { timeoutMs: 15 * 60 * 1e3, maxResponseBytes: 64 * 1024 * 1024 };
583
524
  var ApiTimeoutError = class extends Error {
525
+ timeoutMs;
526
+ requestUrl;
527
+ code = "OPENPOND_API_TIMEOUT";
584
528
  constructor(timeoutMs, requestUrl) {
585
529
  super(`API request timed out after ${timeoutMs}ms: ${requestUrl}`);
586
530
  this.timeoutMs = timeoutMs;
587
531
  this.requestUrl = requestUrl;
588
532
  this.name = "ApiTimeoutError";
589
533
  }
590
- timeoutMs;
591
- requestUrl;
592
- code = "OPENPOND_API_TIMEOUT";
593
534
  };
594
535
  var ApiResponseTooLargeError = class extends Error {
536
+ maximumBytes;
537
+ requestUrl;
538
+ code = "OPENPOND_API_RESPONSE_TOO_LARGE";
595
539
  constructor(maximumBytes, requestUrl) {
596
540
  super(`API response exceeded ${maximumBytes} bytes: ${requestUrl}`);
597
541
  this.maximumBytes = maximumBytes;
598
542
  this.requestUrl = requestUrl;
599
543
  this.name = "ApiResponseTooLargeError";
600
544
  }
601
- maximumBytes;
602
- requestUrl;
603
- code = "OPENPOND_API_RESPONSE_TOO_LARGE";
604
545
  };
605
546
  var OpenPondApiError = class extends Error {
547
+ status;
548
+ apiMessage;
549
+ code;
606
550
  constructor(status, errorCode, label, apiMessage = null) {
607
551
  const detail = apiMessage || errorCode;
608
552
  super(`${label} failed: ${status}${detail ? ` ${detail}` : ""}`);
@@ -611,9 +555,6 @@ var OpenPondApiError = class extends Error {
611
555
  this.name = "OpenPondApiError";
612
556
  this.code = errorCode || "OPENPOND_API_ERROR";
613
557
  }
614
- status;
615
- apiMessage;
616
- code;
617
558
  };
618
559
  async function apiFetch(baseUrl, token, requestPath, options = {}) {
619
560
  const { timeoutMs = DEFAULT_API_TIMEOUT_MS, maxResponseBytes = DEFAULT_API_RESPONSE_BYTES, ...init } = options;
@@ -624,7 +565,8 @@ async function apiFetch(baseUrl, token, requestPath, options = {}) {
624
565
  const trimmedToken = token?.trim() || "";
625
566
  const tokenIsApiKey = trimmedToken.startsWith("opk_");
626
567
  const effectiveApiKey = apiKey || (tokenIsApiKey ? trimmedToken : null);
627
- if (effectiveApiKey && !headers.has("openpond-api-key")) headers.set("openpond-api-key", effectiveApiKey);
568
+ if (effectiveApiKey && !headers.has("openpond-api-key"))
569
+ headers.set("openpond-api-key", effectiveApiKey);
628
570
  if (token) {
629
571
  headers.set("Authorization", tokenIsApiKey ? `ApiKey ${trimmedToken}` : `Bearer ${token}`);
630
572
  } else if (apiKey && !headers.has("Authorization")) {
@@ -636,7 +578,8 @@ async function apiFetch(baseUrl, token, requestPath, options = {}) {
636
578
  timer?.unref?.();
637
579
  const signal = composedSignal(init.signal, timeoutController.signal, timeoutMs);
638
580
  const cleanup = () => {
639
- if (timer) clearTimeout(timer);
581
+ if (timer)
582
+ clearTimeout(timer);
640
583
  };
641
584
  try {
642
585
  const response = await fetch(requestUrl, { ...init, headers, signal });
@@ -649,7 +592,8 @@ async function apiFetch(baseUrl, token, requestPath, options = {}) {
649
592
  });
650
593
  } catch (error) {
651
594
  cleanup();
652
- if (timeoutController.signal.aborted) throw timeoutError;
595
+ if (timeoutController.signal.aborted)
596
+ throw timeoutError;
653
597
  throw error;
654
598
  }
655
599
  }
@@ -659,7 +603,8 @@ async function readApiJson(response, label) {
659
603
  const text = await response.text();
660
604
  payload = text ? JSON.parse(text) : {};
661
605
  } catch (error) {
662
- if (error instanceof ApiTimeoutError || error instanceof ApiResponseTooLargeError) throw error;
606
+ if (error instanceof ApiTimeoutError || error instanceof ApiResponseTooLargeError)
607
+ throw error;
663
608
  payload = {};
664
609
  }
665
610
  if (!response.ok) {
@@ -716,23 +661,19 @@ function boundedResponse(response, input) {
716
661
  });
717
662
  }
718
663
  function composedSignal(callerSignal, timeoutSignal, timeoutMs) {
719
- if (timeoutMs <= 0) return callerSignal ?? void 0;
664
+ if (timeoutMs <= 0)
665
+ return callerSignal ?? void 0;
720
666
  return callerSignal ? AbortSignal.any([callerSignal, timeoutSignal]) : timeoutSignal;
721
667
  }
722
668
 
723
- // ../cloud/src/urls.ts
669
+ // ../cloud/dist/urls.js
724
670
  var DEFAULT_OPENPOND_WEB_BASE_URL = "https://openpond.ai";
725
671
  var DEFAULT_OPENPOND_API_BASE_URL = "https://api.openpond.ai";
726
672
  var DEFAULT_OPENPOND_OPCHAT_API_BASE_URL = "https://api.openpond.ai/opchat/v1";
727
673
 
728
- // ../cloud/src/sandbox/stream.ts
674
+ // ../cloud/dist/sandbox/stream.js
729
675
  async function streamSandboxEventOutput(params) {
730
- const response = await apiFetch(
731
- params.sandboxApiUrl,
732
- params.apiKey,
733
- params.path,
734
- { timeoutMs: 0, maxResponseBytes: 0 }
735
- );
676
+ const response = await apiFetch(params.sandboxApiUrl, params.apiKey, params.path, { timeoutMs: 0, maxResponseBytes: 0 });
736
677
  if (!response.body) {
737
678
  return;
738
679
  }
@@ -742,14 +683,16 @@ async function streamSandboxEventOutput(params) {
742
683
  try {
743
684
  while (true) {
744
685
  const { done, value } = await reader.read();
745
- if (done) break;
686
+ if (done)
687
+ break;
746
688
  buffered += decoder.decode(value, { stream: true });
747
689
  let separatorIndex = buffered.indexOf("\n\n");
748
690
  while (separatorIndex !== -1) {
749
691
  const event = buffered.slice(0, separatorIndex);
750
692
  buffered = buffered.slice(separatorIndex + 2);
751
693
  const output = parseProcessOutputEvent(event);
752
- if (output) process.stdout.write(output);
694
+ if (output)
695
+ process.stdout.write(output);
753
696
  separatorIndex = buffered.indexOf("\n\n");
754
697
  }
755
698
  }
@@ -782,7 +725,7 @@ function parseProcessOutputEvent(event) {
782
725
  }
783
726
  }
784
727
 
785
- // ../cloud/src/sandbox/url.ts
728
+ // ../cloud/dist/sandbox/url.js
786
729
  function normalizeSandboxApiUrl(baseUrlOrApiUrl) {
787
730
  const trimmed = baseUrlOrApiUrl.trim().replace(/\/$/, "");
788
731
  if (!trimmed) {
@@ -812,19 +755,17 @@ function apiRootUrlFromSandboxApiUrl(sandboxApiUrl) {
812
755
  return sandboxApiUrl.slice(0, -suffix.length);
813
756
  }
814
757
  function isOpenPondHostedApiHost(hostname) {
815
- return hostname === "api.openpond.ai" || hostname.startsWith("api") && hostname.endsWith(".openpond.ai");
758
+ return hostname === "api.openpond.ai" || hostname === "staging-api.openpond.ai" || hostname.startsWith("api") && hostname.endsWith(".openpond.ai");
816
759
  }
817
760
 
818
- // ../cloud/src/sandbox/sandbox-instance-client.ts
761
+ // ../cloud/dist/sandbox/sandbox-instance-client.js
819
762
  var OpenPondSandboxInstanceClient = class {
820
763
  apiKey;
821
764
  apiRootUrl;
822
765
  sandboxApiUrl;
823
766
  constructor(options) {
824
767
  this.apiKey = options.apiKey;
825
- this.sandboxApiUrl = normalizeSandboxApiUrl(
826
- options.sandboxApiUrl ?? options.baseUrl ?? DEFAULT_OPENPOND_API_BASE_URL
827
- );
768
+ this.sandboxApiUrl = normalizeSandboxApiUrl(options.sandboxApiUrl ?? options.baseUrl ?? DEFAULT_OPENPOND_API_BASE_URL);
828
769
  this.apiRootUrl = apiRootUrlFromSandboxApiUrl(this.sandboxApiUrl);
829
770
  }
830
771
  create(input, options = {}) {
@@ -835,52 +776,33 @@ var OpenPondSandboxInstanceClient = class {
835
776
  }).then((payload) => payload.sandbox);
836
777
  }
837
778
  get(sandboxId) {
838
- return this.request(
839
- `/${encodeURIComponent(sandboxId)}`
840
- ).then((payload) => payload.sandbox);
779
+ return this.request(`/${encodeURIComponent(sandboxId)}`).then((payload) => payload.sandbox);
841
780
  }
842
781
  exec(sandboxId, input) {
843
- return this.request(
844
- `/${encodeURIComponent(sandboxId)}/exec`,
845
- {
846
- method: "POST",
847
- body: JSON.stringify(input)
848
- }
849
- );
782
+ return this.request(`/${encodeURIComponent(sandboxId)}/exec`, {
783
+ method: "POST",
784
+ body: JSON.stringify(input)
785
+ });
850
786
  }
851
787
  startProcess(sandboxId, input) {
852
- return this.request(
853
- `/${encodeURIComponent(sandboxId)}/processes`,
854
- {
855
- method: "POST",
856
- body: JSON.stringify(input)
857
- }
858
- );
788
+ return this.request(`/${encodeURIComponent(sandboxId)}/processes`, {
789
+ method: "POST",
790
+ body: JSON.stringify(input)
791
+ });
859
792
  }
860
793
  listProcesses(sandboxId) {
861
- return this.request(
862
- `/${encodeURIComponent(sandboxId)}/processes`
863
- );
794
+ return this.request(`/${encodeURIComponent(sandboxId)}/processes`);
864
795
  }
865
796
  getProcess(sandboxId, processId, input = {}) {
866
797
  const query = new URLSearchParams();
867
798
  if (input.since !== void 0)
868
799
  query.set("since", String(Math.max(0, input.since)));
869
- return this.request(
870
- `/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(
871
- processId
872
- )}${query.size > 0 ? `?${query.toString()}` : ""}`
873
- );
800
+ return this.request(`/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(processId)}${query.size > 0 ? `?${query.toString()}` : ""}`);
874
801
  }
875
802
  stopProcess(sandboxId, processId) {
876
- return this.request(
877
- `/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(
878
- processId
879
- )}`,
880
- {
881
- method: "DELETE"
882
- }
883
- );
803
+ return this.request(`/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(processId)}`, {
804
+ method: "DELETE"
805
+ });
884
806
  }
885
807
  async streamProcessOutput(sandboxId, processId, input = {}) {
886
808
  const query = new URLSearchParams();
@@ -889,51 +811,34 @@ var OpenPondSandboxInstanceClient = class {
889
811
  await streamSandboxEventOutput({
890
812
  sandboxApiUrl: this.sandboxApiUrl,
891
813
  apiKey: this.apiKey,
892
- path: `/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(
893
- processId
894
- )}/stream${query.size > 0 ? `?${query.toString()}` : ""}`
814
+ path: `/${encodeURIComponent(sandboxId)}/processes/${encodeURIComponent(processId)}/stream${query.size > 0 ? `?${query.toString()}` : ""}`
895
815
  });
896
816
  }
897
817
  startPty(sandboxId, input = {}) {
898
- return this.request(
899
- `/${encodeURIComponent(sandboxId)}/pty`,
900
- {
901
- method: "POST",
902
- body: JSON.stringify(input)
903
- }
904
- );
818
+ return this.request(`/${encodeURIComponent(sandboxId)}/pty`, {
819
+ method: "POST",
820
+ body: JSON.stringify(input)
821
+ });
905
822
  }
906
823
  listPtys(sandboxId) {
907
- return this.request(
908
- `/${encodeURIComponent(sandboxId)}/pty`
909
- );
824
+ return this.request(`/${encodeURIComponent(sandboxId)}/pty`);
910
825
  }
911
826
  getPty(sandboxId, ptyId, input = {}) {
912
827
  const query = new URLSearchParams();
913
828
  if (input.since !== void 0)
914
829
  query.set("since", String(Math.max(0, input.since)));
915
- return this.request(
916
- `/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}${query.size > 0 ? `?${query.toString()}` : ""}`
917
- );
830
+ return this.request(`/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}${query.size > 0 ? `?${query.toString()}` : ""}`);
918
831
  }
919
832
  writePtyInput(sandboxId, ptyId, input) {
920
- return this.request(
921
- `/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(
922
- ptyId
923
- )}/input`,
924
- {
925
- method: "POST",
926
- body: JSON.stringify(normalizePtyInput(input))
927
- }
928
- );
833
+ return this.request(`/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}/input`, {
834
+ method: "POST",
835
+ body: JSON.stringify(normalizePtyInput(input))
836
+ });
929
837
  }
930
838
  stopPty(sandboxId, ptyId) {
931
- return this.request(
932
- `/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}`,
933
- {
934
- method: "DELETE"
935
- }
936
- );
839
+ return this.request(`/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}`, {
840
+ method: "DELETE"
841
+ });
937
842
  }
938
843
  async streamPtyOutput(sandboxId, ptyId, input = {}) {
939
844
  const query = new URLSearchParams();
@@ -942,29 +847,20 @@ var OpenPondSandboxInstanceClient = class {
942
847
  await streamSandboxEventOutput({
943
848
  sandboxApiUrl: this.sandboxApiUrl,
944
849
  apiKey: this.apiKey,
945
- path: `/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(
946
- ptyId
947
- )}/stream${query.size > 0 ? `?${query.toString()}` : ""}`
850
+ path: `/${encodeURIComponent(sandboxId)}/pty/${encodeURIComponent(ptyId)}/stream${query.size > 0 ? `?${query.toString()}` : ""}`
948
851
  });
949
852
  }
950
853
  uploadFile(sandboxId, path, contents) {
951
- return this.uploadFileBase64(
952
- sandboxId,
953
- path,
954
- Buffer.from(contents, "utf-8").toString("base64")
955
- );
854
+ return this.uploadFileBase64(sandboxId, path, Buffer.from(contents, "utf-8").toString("base64"));
956
855
  }
957
856
  uploadFileBase64(sandboxId, path, contentsBase64) {
958
- return this.request(
959
- `/${encodeURIComponent(sandboxId)}/files`,
960
- {
961
- method: "POST",
962
- body: JSON.stringify({
963
- path,
964
- contentsBase64
965
- })
966
- }
967
- );
857
+ return this.request(`/${encodeURIComponent(sandboxId)}/files`, {
858
+ method: "POST",
859
+ body: JSON.stringify({
860
+ path,
861
+ contentsBase64
862
+ })
863
+ });
968
864
  }
969
865
  async downloadFile(sandboxId, path) {
970
866
  const payload = await this.downloadFileResponse(sandboxId, path);
@@ -979,49 +875,38 @@ var OpenPondSandboxInstanceClient = class {
979
875
  if (normalized.maxBytes !== void 0) {
980
876
  query.set("maxBytes", String(normalized.maxBytes));
981
877
  }
982
- return this.request(
983
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`
984
- );
878
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`);
985
879
  }
986
880
  listFiles(sandboxId, input = {}) {
987
881
  const query = new URLSearchParams({ list: "1" });
988
- if (input.path) query.set("path", input.path);
882
+ if (input.path)
883
+ query.set("path", input.path);
989
884
  if (input.recursive !== void 0)
990
885
  query.set("recursive", String(input.recursive));
991
886
  if (input.maxEntries !== void 0)
992
887
  query.set("maxEntries", String(input.maxEntries));
993
- return this.request(
994
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`
995
- );
888
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`);
996
889
  }
997
890
  deleteFile(sandboxId, path, input = {}) {
998
891
  const query = new URLSearchParams({ path });
999
892
  if (input.recursive !== void 0)
1000
893
  query.set("recursive", String(input.recursive));
1001
- return this.request(
1002
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`,
1003
- {
1004
- method: "DELETE"
1005
- }
1006
- );
894
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`, {
895
+ method: "DELETE"
896
+ });
1007
897
  }
1008
898
  statFile(sandboxId, path) {
1009
899
  const query = new URLSearchParams({ stat: "1", path });
1010
- return this.request(
1011
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`
1012
- );
900
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`);
1013
901
  }
1014
902
  mkdir(sandboxId, input) {
1015
903
  const normalized = typeof input === "string" ? { path: input } : input;
1016
904
  const query = new URLSearchParams({ path: normalized.path });
1017
905
  if (normalized.recursive !== void 0)
1018
906
  query.set("recursive", String(normalized.recursive));
1019
- return this.request(
1020
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`,
1021
- {
1022
- method: "PUT"
1023
- }
1024
- );
907
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`, {
908
+ method: "PUT"
909
+ });
1025
910
  }
1026
911
  moveFile(sandboxId, input) {
1027
912
  const query = new URLSearchParams({
@@ -1030,243 +915,165 @@ var OpenPondSandboxInstanceClient = class {
1030
915
  });
1031
916
  if (input.overwrite !== void 0)
1032
917
  query.set("overwrite", String(input.overwrite));
1033
- return this.request(
1034
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`,
1035
- {
1036
- method: "PATCH"
1037
- }
1038
- );
918
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`, {
919
+ method: "PATCH"
920
+ });
1039
921
  }
1040
922
  searchFiles(sandboxId, input) {
1041
923
  const query = new URLSearchParams({
1042
924
  search: "1",
1043
925
  query: input.query
1044
926
  });
1045
- if (input.path) query.set("path", input.path);
927
+ if (input.path)
928
+ query.set("path", input.path);
1046
929
  if (input.maxResults !== void 0)
1047
930
  query.set("maxResults", String(input.maxResults));
1048
- return this.request(
1049
- `/${encodeURIComponent(sandboxId)}/files?${query.toString()}`
1050
- );
931
+ return this.request(`/${encodeURIComponent(sandboxId)}/files?${query.toString()}`);
1051
932
  }
1052
933
  openPort(sandboxId, input) {
1053
- return this.request(
1054
- `/${encodeURIComponent(sandboxId)}/ports`,
1055
- {
1056
- method: "POST",
1057
- body: JSON.stringify(input)
1058
- }
1059
- );
934
+ return this.request(`/${encodeURIComponent(sandboxId)}/ports`, {
935
+ method: "POST",
936
+ body: JSON.stringify(input)
937
+ });
1060
938
  }
1061
939
  createSnapshot(sandboxId, input) {
1062
- return this.request(
1063
- `/${encodeURIComponent(sandboxId)}/snapshots`,
1064
- {
1065
- method: "POST",
1066
- body: JSON.stringify(input)
1067
- }
1068
- );
940
+ return this.request(`/${encodeURIComponent(sandboxId)}/snapshots`, {
941
+ method: "POST",
942
+ body: JSON.stringify(input)
943
+ });
1069
944
  }
1070
945
  updateSnapshot(sandboxId, snapshotId, input) {
1071
- return this.request(
1072
- `/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(
1073
- snapshotId
1074
- )}`,
1075
- {
1076
- method: "PATCH",
1077
- body: JSON.stringify(input)
1078
- }
1079
- );
946
+ return this.request(`/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(snapshotId)}`, {
947
+ method: "PATCH",
948
+ body: JSON.stringify(input)
949
+ });
1080
950
  }
1081
951
  validateSnapshot(sandboxId, snapshotId, input = {}) {
1082
- return this.request(
1083
- `/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(
1084
- snapshotId
1085
- )}/validate`,
1086
- {
1087
- method: "POST",
1088
- body: JSON.stringify(input)
1089
- }
1090
- );
952
+ return this.request(`/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(snapshotId)}/validate`, {
953
+ method: "POST",
954
+ body: JSON.stringify(input)
955
+ });
1091
956
  }
1092
957
  publishSnapshot(sandboxId, snapshotId) {
1093
- return this.request(
1094
- `/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(
1095
- snapshotId
1096
- )}/publish`,
1097
- {
1098
- method: "POST"
1099
- }
1100
- );
958
+ return this.request(`/${encodeURIComponent(sandboxId)}/snapshots/${encodeURIComponent(snapshotId)}/publish`, {
959
+ method: "POST"
960
+ });
1101
961
  }
1102
962
  fork(sandboxId, input = {}) {
1103
- return this.request(
1104
- `/${encodeURIComponent(sandboxId)}/fork`,
1105
- {
1106
- method: "POST",
1107
- body: JSON.stringify(input)
1108
- }
1109
- );
963
+ return this.request(`/${encodeURIComponent(sandboxId)}/fork`, {
964
+ method: "POST",
965
+ body: JSON.stringify(input)
966
+ });
1110
967
  }
1111
968
  stop(sandboxId, options = {}) {
1112
969
  const query = new URLSearchParams();
1113
970
  if (options.failOnUnpreservedChanges) {
1114
971
  query.set("failOnUnpreservedChanges", "true");
1115
972
  }
1116
- return this.request(
1117
- `/${encodeURIComponent(sandboxId)}/stop${query.size > 0 ? `?${query.toString()}` : ""}`,
1118
- {
1119
- method: "POST",
1120
- headers: asyncRequestHeaders(options)
1121
- }
1122
- );
973
+ return this.request(`/${encodeURIComponent(sandboxId)}/stop${query.size > 0 ? `?${query.toString()}` : ""}`, {
974
+ method: "POST",
975
+ headers: asyncRequestHeaders(options)
976
+ });
1123
977
  }
1124
978
  start(sandboxId, options = {}) {
1125
- return this.request(
1126
- `/${encodeURIComponent(sandboxId)}/start`,
1127
- {
1128
- method: "POST",
1129
- headers: asyncRequestHeaders(options)
1130
- }
1131
- );
979
+ return this.request(`/${encodeURIComponent(sandboxId)}/start`, {
980
+ method: "POST",
981
+ headers: asyncRequestHeaders(options)
982
+ });
1132
983
  }
1133
984
  restore(sandboxId) {
1134
- return this.request(
1135
- `/${encodeURIComponent(sandboxId)}/restore`,
1136
- {
1137
- method: "POST"
1138
- }
1139
- );
985
+ return this.request(`/${encodeURIComponent(sandboxId)}/restore`, {
986
+ method: "POST"
987
+ });
1140
988
  }
1141
989
  delete(sandboxId, options = {}) {
1142
990
  const query = new URLSearchParams();
1143
991
  if (options.failOnUnpreservedChanges) {
1144
992
  query.set("failOnUnpreservedChanges", "true");
1145
993
  }
1146
- return this.request(
1147
- `/${encodeURIComponent(sandboxId)}${query.size > 0 ? `?${query.toString()}` : ""}`,
1148
- {
1149
- method: "DELETE",
1150
- headers: asyncRequestHeaders(options)
1151
- }
1152
- ).then((payload) => payload.sandbox);
994
+ return this.request(`/${encodeURIComponent(sandboxId)}${query.size > 0 ? `?${query.toString()}` : ""}`, {
995
+ method: "DELETE",
996
+ headers: asyncRequestHeaders(options)
997
+ }).then((payload) => payload.sandbox);
1153
998
  }
1154
999
  receipts(sandboxId) {
1155
- return this.request(
1156
- `/${encodeURIComponent(sandboxId)}/receipts`
1157
- ).then((payload) => payload.receipts);
1000
+ return this.request(`/${encodeURIComponent(sandboxId)}/receipts`).then((payload) => payload.receipts);
1158
1001
  }
1159
1002
  logs(sandboxId) {
1160
- return this.request(
1161
- `/${encodeURIComponent(sandboxId)}/logs`
1162
- ).then((payload) => payload.logs);
1003
+ return this.request(`/${encodeURIComponent(sandboxId)}/logs`).then((payload) => payload.logs);
1163
1004
  }
1164
1005
  gitStatus(sandboxId) {
1165
- return this.request(
1166
- `/${encodeURIComponent(sandboxId)}/git/status`
1167
- );
1006
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/status`);
1168
1007
  }
1169
1008
  gitDiff(sandboxId, input = {}) {
1170
- return this.request(
1171
- `/${encodeURIComponent(sandboxId)}/git/diff`,
1172
- {
1173
- method: "POST",
1174
- body: JSON.stringify(input)
1175
- }
1176
- );
1009
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/diff`, {
1010
+ method: "POST",
1011
+ body: JSON.stringify(input)
1012
+ });
1177
1013
  }
1178
1014
  gitExportPatch(sandboxId, input = {}) {
1179
- return this.request(
1180
- `/${encodeURIComponent(sandboxId)}/git/export-patch`,
1181
- {
1182
- method: "POST",
1183
- body: JSON.stringify(input)
1184
- }
1185
- );
1015
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/export-patch`, {
1016
+ method: "POST",
1017
+ body: JSON.stringify(input)
1018
+ });
1186
1019
  }
1187
1020
  gitBranch(sandboxId, input) {
1188
- return this.request(
1189
- `/${encodeURIComponent(sandboxId)}/git/branch`,
1190
- {
1191
- method: "POST",
1192
- body: JSON.stringify(input)
1193
- }
1194
- );
1021
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/branch`, {
1022
+ method: "POST",
1023
+ body: JSON.stringify(input)
1024
+ });
1195
1025
  }
1196
1026
  gitCommit(sandboxId, input) {
1197
- return this.request(
1198
- `/${encodeURIComponent(sandboxId)}/git/commit`,
1199
- {
1200
- method: "POST",
1201
- body: JSON.stringify(input)
1202
- }
1203
- );
1027
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/commit`, {
1028
+ method: "POST",
1029
+ body: JSON.stringify(input)
1030
+ });
1204
1031
  }
1205
1032
  gitPull(sandboxId, input = {}) {
1206
- return this.request(
1207
- `/${encodeURIComponent(sandboxId)}/git/pull`,
1208
- {
1209
- method: "POST",
1210
- body: JSON.stringify(input)
1211
- }
1212
- );
1033
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/pull`, {
1034
+ method: "POST",
1035
+ body: JSON.stringify(input)
1036
+ });
1213
1037
  }
1214
1038
  gitPush(sandboxId, input = {}) {
1215
- return this.request(
1216
- `/${encodeURIComponent(sandboxId)}/git/push`,
1217
- {
1218
- method: "POST",
1219
- body: JSON.stringify(input)
1220
- }
1221
- );
1039
+ return this.request(`/${encodeURIComponent(sandboxId)}/git/push`, {
1040
+ method: "POST",
1041
+ body: JSON.stringify(input)
1042
+ });
1222
1043
  }
1223
1044
  billing(sandboxId) {
1224
- return this.request(
1225
- `/${encodeURIComponent(sandboxId)}/billing`
1226
- );
1045
+ return this.request(`/${encodeURIComponent(sandboxId)}/billing`);
1227
1046
  }
1228
1047
  pricing() {
1229
1048
  return this.request("/pricing");
1230
1049
  }
1231
1050
  costs(input = {}) {
1232
1051
  const query = new URLSearchParams();
1233
- if (input.teamId) query.set("teamId", input.teamId);
1234
- if (input.projectId) query.set("projectId", input.projectId);
1235
- if (input.agentId) query.set("agentId", input.agentId);
1236
- return this.request(
1237
- `/costs${query.size > 0 ? `?${query.toString()}` : ""}`
1238
- );
1052
+ if (input.teamId)
1053
+ query.set("teamId", input.teamId);
1054
+ if (input.projectId)
1055
+ query.set("projectId", input.projectId);
1056
+ if (input.agentId)
1057
+ query.set("agentId", input.agentId);
1058
+ return this.request(`/costs${query.size > 0 ? `?${query.toString()}` : ""}`);
1239
1059
  }
1240
1060
  integrationLeases(sandboxId) {
1241
- return this.request(
1242
- `/${encodeURIComponent(sandboxId)}/integrations`
1243
- );
1061
+ return this.request(`/${encodeURIComponent(sandboxId)}/integrations`);
1244
1062
  }
1245
1063
  attachIntegrationConnection(sandboxId, input) {
1246
- return this.request(
1247
- `/${encodeURIComponent(sandboxId)}/integrations`,
1248
- {
1249
- method: "POST",
1250
- body: JSON.stringify(input)
1251
- }
1252
- );
1064
+ return this.request(`/${encodeURIComponent(sandboxId)}/integrations`, {
1065
+ method: "POST",
1066
+ body: JSON.stringify(input)
1067
+ });
1253
1068
  }
1254
1069
  removeIntegrationLease(sandboxId, leaseId) {
1255
- return this.request(
1256
- `/${encodeURIComponent(sandboxId)}/integrations`,
1257
- {
1258
- method: "DELETE",
1259
- body: JSON.stringify({ leaseId })
1260
- }
1261
- );
1070
+ return this.request(`/${encodeURIComponent(sandboxId)}/integrations`, {
1071
+ method: "DELETE",
1072
+ body: JSON.stringify({ leaseId })
1073
+ });
1262
1074
  }
1263
1075
  async request(path, init = {}) {
1264
- const response = await apiFetch(
1265
- this.sandboxApiUrl,
1266
- this.apiKey,
1267
- path,
1268
- init
1269
- );
1076
+ const response = await apiFetch(this.sandboxApiUrl, this.apiKey, path, init);
1270
1077
  return readApiJson(response, "Sandbox request");
1271
1078
  }
1272
1079
  async requestApiRoot(path, init = {}) {
@@ -1275,7 +1082,7 @@ var OpenPondSandboxInstanceClient = class {
1275
1082
  }
1276
1083
  };
1277
1084
 
1278
- // ../cloud/src/sandbox/client.ts
1085
+ // ../cloud/dist/sandbox/client.js
1279
1086
  var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1280
1087
  runtimes = createSandboxRuntimeNamespace(this);
1281
1088
  sandboxes = createSandboxNamespace(this);
@@ -1284,26 +1091,25 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1284
1091
  agents = createSandboxAgentNamespace(this);
1285
1092
  list(input = {}) {
1286
1093
  const query = new URLSearchParams();
1287
- if (input.teamId) query.set("teamId", input.teamId);
1288
- if (input.projectId) query.set("projectId", input.projectId);
1289
- if (input.agentId) query.set("agentId", input.agentId);
1290
- return this.request(
1291
- query.size > 0 ? `?${query.toString()}` : ""
1292
- ).then((payload) => payload.sandboxes);
1094
+ if (input.teamId)
1095
+ query.set("teamId", input.teamId);
1096
+ if (input.projectId)
1097
+ query.set("projectId", input.projectId);
1098
+ if (input.agentId)
1099
+ query.set("agentId", input.agentId);
1100
+ return this.request(query.size > 0 ? `?${query.toString()}` : "").then((payload) => payload.sandboxes);
1293
1101
  }
1294
1102
  listSecrets(input = {}) {
1295
1103
  const query = new URLSearchParams();
1296
- if (input.teamId) query.set("teamId", input.teamId);
1297
- return this.requestApiRoot(
1298
- `/sandbox-secrets${query.size > 0 ? `?${query.toString()}` : ""}`
1299
- ).then((payload) => payload.secrets);
1104
+ if (input.teamId)
1105
+ query.set("teamId", input.teamId);
1106
+ return this.requestApiRoot(`/sandbox-secrets${query.size > 0 ? `?${query.toString()}` : ""}`).then((payload) => payload.secrets);
1300
1107
  }
1301
1108
  getSecret(secretId, input = {}) {
1302
1109
  const query = new URLSearchParams();
1303
- if (input.teamId) query.set("teamId", input.teamId);
1304
- return this.requestApiRoot(
1305
- `/sandbox-secrets/${encodeURIComponent(secretId)}${query.size > 0 ? `?${query.toString()}` : ""}`
1306
- ).then((payload) => payload.secret);
1110
+ if (input.teamId)
1111
+ query.set("teamId", input.teamId);
1112
+ return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}${query.size > 0 ? `?${query.toString()}` : ""}`).then((payload) => payload.secret);
1307
1113
  }
1308
1114
  createSecret(input) {
1309
1115
  return this.requestApiRoot("/sandbox-secrets", {
@@ -1313,74 +1119,73 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1313
1119
  }
1314
1120
  rotateSecret(secretId, input) {
1315
1121
  const query = new URLSearchParams();
1316
- if (input.teamId) query.set("teamId", input.teamId);
1122
+ if (input.teamId)
1123
+ query.set("teamId", input.teamId);
1317
1124
  const { teamId: _teamId, ...body } = input;
1318
- return this.requestApiRoot(
1319
- `/sandbox-secrets/${encodeURIComponent(secretId)}/rotate${query.size > 0 ? `?${query.toString()}` : ""}`,
1320
- {
1321
- method: "POST",
1322
- body: JSON.stringify(body)
1323
- }
1324
- ).then((payload) => payload.secret);
1125
+ return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}/rotate${query.size > 0 ? `?${query.toString()}` : ""}`, {
1126
+ method: "POST",
1127
+ body: JSON.stringify(body)
1128
+ }).then((payload) => payload.secret);
1325
1129
  }
1326
1130
  attachSecret(secretId, input) {
1327
1131
  const query = new URLSearchParams();
1328
- if (input.teamId) query.set("teamId", input.teamId);
1132
+ if (input.teamId)
1133
+ query.set("teamId", input.teamId);
1329
1134
  const { teamId: _teamId, ...body } = input;
1330
- return this.requestApiRoot(
1331
- `/sandbox-secrets/${encodeURIComponent(secretId)}/attach${query.size > 0 ? `?${query.toString()}` : ""}`,
1332
- {
1333
- method: "POST",
1334
- body: JSON.stringify(body)
1335
- }
1336
- ).then((payload) => payload.secret);
1135
+ return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}/attach${query.size > 0 ? `?${query.toString()}` : ""}`, {
1136
+ method: "POST",
1137
+ body: JSON.stringify(body)
1138
+ }).then((payload) => payload.secret);
1337
1139
  }
1338
1140
  revokeSecret(secretId, input = {}) {
1339
1141
  const query = new URLSearchParams();
1340
- if (input.teamId) query.set("teamId", input.teamId);
1341
- return this.requestApiRoot(
1342
- `/sandbox-secrets/${encodeURIComponent(secretId)}/revoke${query.size > 0 ? `?${query.toString()}` : ""}`,
1343
- { method: "POST" }
1344
- ).then((payload) => payload.secret);
1142
+ if (input.teamId)
1143
+ query.set("teamId", input.teamId);
1144
+ return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}/revoke${query.size > 0 ? `?${query.toString()}` : ""}`, { method: "POST" }).then((payload) => payload.secret);
1345
1145
  }
1346
1146
  deleteSecret(secretId, input = {}) {
1347
1147
  const query = new URLSearchParams();
1348
- if (input.teamId) query.set("teamId", input.teamId);
1349
- return this.requestApiRoot(
1350
- `/sandbox-secrets/${encodeURIComponent(secretId)}${query.size > 0 ? `?${query.toString()}` : ""}`,
1351
- { method: "DELETE" }
1352
- ).then((payload) => payload.secret);
1148
+ if (input.teamId)
1149
+ query.set("teamId", input.teamId);
1150
+ return this.requestApiRoot(`/sandbox-secrets/${encodeURIComponent(secretId)}${query.size > 0 ? `?${query.toString()}` : ""}`, { method: "DELETE" }).then((payload) => payload.secret);
1353
1151
  }
1354
1152
  snapshotCatalog(input = {}) {
1355
1153
  const query = new URLSearchParams();
1356
- if (input.teamId) query.set("teamId", input.teamId);
1357
- if (input.projectId) query.set("projectId", input.projectId);
1358
- if (input.agentId) query.set("agentId", input.agentId);
1359
- if (input.q) query.set("q", input.q);
1360
- if (input.kind) query.set("kind", input.kind);
1361
- if (input.replayState) query.set("replayState", input.replayState);
1362
- if (input.visibility) query.set("visibility", input.visibility);
1363
- if (input.tag) query.set("tag", input.tag);
1364
- if (input.useCase) query.set("useCase", input.useCase);
1365
- if (input.limit) query.set("limit", String(input.limit));
1366
- return this.request(
1367
- `/catalog/snapshots${query.size > 0 ? `?${query.toString()}` : ""}`
1368
- );
1154
+ if (input.teamId)
1155
+ query.set("teamId", input.teamId);
1156
+ if (input.projectId)
1157
+ query.set("projectId", input.projectId);
1158
+ if (input.agentId)
1159
+ query.set("agentId", input.agentId);
1160
+ if (input.q)
1161
+ query.set("q", input.q);
1162
+ if (input.kind)
1163
+ query.set("kind", input.kind);
1164
+ if (input.replayState)
1165
+ query.set("replayState", input.replayState);
1166
+ if (input.visibility)
1167
+ query.set("visibility", input.visibility);
1168
+ if (input.tag)
1169
+ query.set("tag", input.tag);
1170
+ if (input.useCase)
1171
+ query.set("useCase", input.useCase);
1172
+ if (input.limit)
1173
+ query.set("limit", String(input.limit));
1174
+ return this.request(`/catalog/snapshots${query.size > 0 ? `?${query.toString()}` : ""}`);
1369
1175
  }
1370
1176
  listSandboxRuntimes(input = {}) {
1371
1177
  const query = new URLSearchParams();
1372
- if (input.teamId) query.set("teamId", input.teamId);
1373
- if (input.projectId) query.set("projectId", input.projectId);
1374
- if (input.agentId) query.set("agentId", input.agentId);
1375
- return this.requestApiRoot(
1376
- `/runtimes${query.size > 0 ? `?${query.toString()}` : ""}`
1377
- ).then((payload) => payload.runtimes);
1178
+ if (input.teamId)
1179
+ query.set("teamId", input.teamId);
1180
+ if (input.projectId)
1181
+ query.set("projectId", input.projectId);
1182
+ if (input.agentId)
1183
+ query.set("agentId", input.agentId);
1184
+ return this.requestApiRoot(`/runtimes${query.size > 0 ? `?${query.toString()}` : ""}`).then((payload) => payload.runtimes);
1378
1185
  }
1379
1186
  listProjects(input) {
1380
1187
  const query = new URLSearchParams({ teamId: input.teamId });
1381
- return this.requestApiRoot(
1382
- `/projects?${query.toString()}`
1383
- ).then((payload) => payload.projects);
1188
+ return this.requestApiRoot(`/projects?${query.toString()}`).then((payload) => payload.projects);
1384
1189
  }
1385
1190
  upsertProject(input) {
1386
1191
  return this.requestApiRoot("/projects", {
@@ -1390,16 +1195,11 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1390
1195
  }
1391
1196
  getHostedProfile(input) {
1392
1197
  const query = new URLSearchParams({ teamId: input.teamId });
1393
- return this.requestApiRoot(
1394
- `/profile?${query.toString()}`
1395
- ).then((payload) => payload.profile);
1198
+ return this.requestApiRoot(`/profile?${query.toString()}`).then((payload) => payload.profile);
1396
1199
  }
1397
1200
  ensureHostedProfile(input) {
1398
1201
  const query = new URLSearchParams({ teamId: input.teamId });
1399
- return this.requestApiRoot(
1400
- `/profile/ensure?${query.toString()}`,
1401
- { method: "POST" }
1402
- ).then((payload) => {
1202
+ return this.requestApiRoot(`/profile/ensure?${query.toString()}`, { method: "POST" }).then((payload) => {
1403
1203
  if (!payload.profile) {
1404
1204
  throw new Error("hosted_profile_missing");
1405
1205
  }
@@ -1409,13 +1209,10 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1409
1209
  pushHostedProfile(input) {
1410
1210
  const query = new URLSearchParams({ teamId: input.teamId });
1411
1211
  const { teamId: _teamId, ...body } = input;
1412
- return this.requestApiRoot(
1413
- `/profile/push?${query.toString()}`,
1414
- {
1415
- method: "POST",
1416
- body: JSON.stringify(body)
1417
- }
1418
- );
1212
+ return this.requestApiRoot(`/profile/push?${query.toString()}`, {
1213
+ method: "POST",
1214
+ body: JSON.stringify(body)
1215
+ });
1419
1216
  }
1420
1217
  async upsertProjectGitRemote(input) {
1421
1218
  const project = await this.upsertProject(input);
@@ -1423,58 +1220,39 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1423
1220
  }
1424
1221
  getProject(projectId, input) {
1425
1222
  const query = new URLSearchParams({ teamId: input.teamId });
1426
- return this.requestApiRoot(
1427
- `/projects/${encodeURIComponent(projectId)}?${query.toString()}`
1428
- ).then((payload) => payload.project);
1223
+ return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}?${query.toString()}`).then((payload) => payload.project);
1429
1224
  }
1430
1225
  syncProject(projectId, input) {
1431
1226
  const query = new URLSearchParams({ teamId: input.teamId });
1432
- return this.requestApiRoot(
1433
- `/projects/${encodeURIComponent(projectId)}/sync?${query.toString()}`,
1434
- { method: "POST" }
1435
- ).then((payload) => payload.project);
1227
+ return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}/sync?${query.toString()}`, { method: "POST" }).then((payload) => payload.project);
1436
1228
  }
1437
1229
  ensureProjectGitRemote(projectId, input) {
1438
1230
  const query = new URLSearchParams({ teamId: input.teamId });
1439
- return this.requestApiRoot(
1440
- `/projects/${encodeURIComponent(projectId)}/git?${query.toString()}`,
1441
- { method: "POST" }
1442
- );
1231
+ return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}/git?${query.toString()}`, { method: "POST" });
1443
1232
  }
1444
1233
  uploadProjectSource(projectId, input) {
1445
1234
  const query = new URLSearchParams({ teamId: input.teamId });
1446
1235
  const { teamId: _teamId, ...body } = input;
1447
- return this.requestApiRoot(
1448
- `/projects/${encodeURIComponent(projectId)}/source?${query.toString()}`,
1449
- {
1450
- method: "POST",
1451
- body: JSON.stringify(body)
1452
- }
1453
- ).then((payload) => payload.project);
1236
+ return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}/source?${query.toString()}`, {
1237
+ method: "POST",
1238
+ body: JSON.stringify(body)
1239
+ }).then((payload) => payload.project);
1454
1240
  }
1455
1241
  updateProject(projectId, input) {
1456
1242
  const query = new URLSearchParams({ teamId: input.teamId });
1457
1243
  const { teamId: _teamId, ...body } = input;
1458
- return this.requestApiRoot(
1459
- `/projects/${encodeURIComponent(projectId)}?${query.toString()}`,
1460
- {
1461
- method: "PATCH",
1462
- body: JSON.stringify(body)
1463
- }
1464
- ).then((payload) => payload.project);
1244
+ return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}?${query.toString()}`, {
1245
+ method: "PATCH",
1246
+ body: JSON.stringify(body)
1247
+ }).then((payload) => payload.project);
1465
1248
  }
1466
1249
  archiveProject(projectId, input) {
1467
1250
  const query = new URLSearchParams({ teamId: input.teamId });
1468
- return this.requestApiRoot(
1469
- `/projects/${encodeURIComponent(projectId)}?${query.toString()}`,
1470
- { method: "DELETE" }
1471
- ).then((payload) => payload.project);
1251
+ return this.requestApiRoot(`/projects/${encodeURIComponent(projectId)}?${query.toString()}`, { method: "DELETE" }).then((payload) => payload.project);
1472
1252
  }
1473
1253
  listAgents(input) {
1474
1254
  const query = new URLSearchParams({ teamId: input.teamId });
1475
- return this.requestApiRoot(
1476
- `/agents?${query.toString()}`
1477
- ).then((payload) => payload.agents);
1255
+ return this.requestApiRoot(`/agents?${query.toString()}`).then((payload) => payload.agents);
1478
1256
  }
1479
1257
  upsertAgent(input) {
1480
1258
  return this.requestApiRoot("/agents", {
@@ -1484,115 +1262,76 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1484
1262
  }
1485
1263
  getAgent(agentId, input) {
1486
1264
  const query = new URLSearchParams({ teamId: input.teamId });
1487
- return this.requestApiRoot(
1488
- `/agents/${encodeURIComponent(agentId)}?${query.toString()}`
1489
- ).then((payload) => payload.agent);
1265
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}?${query.toString()}`).then((payload) => payload.agent);
1490
1266
  }
1491
1267
  archiveAgent(agentId, input) {
1492
1268
  const query = new URLSearchParams({ teamId: input.teamId });
1493
- return this.requestApiRoot(
1494
- `/agents/${encodeURIComponent(agentId)}?${query.toString()}`,
1495
- { method: "DELETE" }
1496
- ).then((payload) => payload.agent);
1269
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}?${query.toString()}`, { method: "DELETE" }).then((payload) => payload.agent);
1497
1270
  }
1498
1271
  updateAgent(agentId, input) {
1499
1272
  const query = new URLSearchParams({ teamId: input.teamId });
1500
1273
  const { teamId: _teamId, ...body } = input;
1501
- return this.requestApiRoot(
1502
- `/agents/${encodeURIComponent(agentId)}?${query.toString()}`,
1503
- {
1504
- method: "PATCH",
1505
- body: JSON.stringify(body)
1506
- }
1507
- ).then((payload) => payload.agent);
1274
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}?${query.toString()}`, {
1275
+ method: "PATCH",
1276
+ body: JSON.stringify(body)
1277
+ }).then((payload) => payload.agent);
1508
1278
  }
1509
1279
  runAgent(agentId, input) {
1510
- return this.requestApiRoot(
1511
- `/agents/${encodeURIComponent(agentId)}/run`,
1512
- {
1513
- method: "POST",
1514
- headers: {
1515
- Prefer: "respond-async"
1516
- },
1517
- body: JSON.stringify(input)
1518
- }
1519
- );
1280
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/run`, {
1281
+ method: "POST",
1282
+ headers: {
1283
+ Prefer: "respond-async"
1284
+ },
1285
+ body: JSON.stringify(input)
1286
+ });
1520
1287
  }
1521
1288
  getAgentSourceDeployPlan(agentId, input) {
1522
1289
  const query = new URLSearchParams({ teamId: input.teamId });
1523
- return this.requestApiRoot(
1524
- `/agents/${encodeURIComponent(
1525
- agentId
1526
- )}/source/deploy-plan?${query.toString()}`
1527
- ).then((payload) => payload.deployPlan);
1290
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/deploy-plan?${query.toString()}`).then((payload) => payload.deployPlan);
1528
1291
  }
1529
1292
  listAgentManifestSnapshots(agentId, input) {
1530
1293
  const query = new URLSearchParams({ teamId: input.teamId });
1531
- if (input.limit !== void 0) query.set("limit", String(input.limit));
1532
- return this.requestApiRoot(
1533
- `/agents/${encodeURIComponent(
1534
- agentId
1535
- )}/source/manifest-snapshots?${query.toString()}`
1536
- ).then((payload) => payload.manifestSnapshots);
1294
+ if (input.limit !== void 0)
1295
+ query.set("limit", String(input.limit));
1296
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/manifest-snapshots?${query.toString()}`).then((payload) => payload.manifestSnapshots);
1537
1297
  }
1538
1298
  requestAgentSourceChecks(agentId, input) {
1539
1299
  const query = new URLSearchParams({ teamId: input.teamId });
1540
1300
  const { teamId: _teamId, ...body } = input;
1541
- return this.requestApiRoot(
1542
- `/agents/${encodeURIComponent(
1543
- agentId
1544
- )}/source/checks?${query.toString()}`,
1545
- {
1546
- method: "POST",
1547
- body: JSON.stringify(body)
1548
- }
1549
- );
1301
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/checks?${query.toString()}`, {
1302
+ method: "POST",
1303
+ body: JSON.stringify(body)
1304
+ });
1550
1305
  }
1551
1306
  publishAgentSource(agentId, input) {
1552
1307
  const query = new URLSearchParams({ teamId: input.teamId });
1553
1308
  const { teamId: _teamId, ...body } = input;
1554
- return this.requestApiRoot(
1555
- `/agents/${encodeURIComponent(
1556
- agentId
1557
- )}/source/publish?${query.toString()}`,
1558
- {
1559
- method: "POST",
1560
- body: JSON.stringify(body)
1561
- }
1562
- );
1309
+ return this.requestApiRoot(`/agents/${encodeURIComponent(agentId)}/source/publish?${query.toString()}`, {
1310
+ method: "POST",
1311
+ body: JSON.stringify(body)
1312
+ });
1563
1313
  }
1564
1314
  getMicrosoftTeamsBotOverview(input) {
1565
1315
  const query = new URLSearchParams({ teamId: input.teamId });
1566
- return this.requestApiRoot(
1567
- `/teams/bot/overview?${query.toString()}`
1568
- );
1316
+ return this.requestApiRoot(`/teams/bot/overview?${query.toString()}`);
1569
1317
  }
1570
1318
  bindMicrosoftTeamsBotConversation(input) {
1571
- return this.requestApiRoot(
1572
- "/teams/bot/bindings",
1573
- {
1574
- method: "POST",
1575
- body: JSON.stringify(input)
1576
- }
1577
- );
1319
+ return this.requestApiRoot("/teams/bot/bindings", {
1320
+ method: "POST",
1321
+ body: JSON.stringify(input)
1322
+ });
1578
1323
  }
1579
1324
  rebindMicrosoftTeamsBotConversation(bindingId, input) {
1580
- return this.requestApiRoot(
1581
- `/teams/bot/bindings/${encodeURIComponent(bindingId)}`,
1582
- {
1583
- method: "PATCH",
1584
- body: JSON.stringify(input)
1585
- }
1586
- );
1325
+ return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(bindingId)}`, {
1326
+ method: "PATCH",
1327
+ body: JSON.stringify(input)
1328
+ });
1587
1329
  }
1588
1330
  unlinkMicrosoftTeamsBotConversation(input) {
1589
- return this.requestApiRoot(
1590
- `/teams/bot/bindings/${encodeURIComponent(input.bindingId)}`,
1591
- {
1592
- method: "DELETE",
1593
- body: JSON.stringify({ teamId: input.teamId })
1594
- }
1595
- );
1331
+ return this.requestApiRoot(`/teams/bot/bindings/${encodeURIComponent(input.bindingId)}`, {
1332
+ method: "DELETE",
1333
+ body: JSON.stringify({ teamId: input.teamId })
1334
+ });
1596
1335
  }
1597
1336
  sendMicrosoftTeamsBotDiagnostic(input) {
1598
1337
  return this.requestApiRoot("/teams/bot/diagnostics", {
@@ -1601,13 +1340,10 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1601
1340
  });
1602
1341
  }
1603
1342
  sendMicrosoftTeamsBotDiagnosticRun(input) {
1604
- return this.requestApiRoot(
1605
- "/teams/bot/diagnostics/run",
1606
- {
1607
- method: "POST",
1608
- body: JSON.stringify(input)
1609
- }
1610
- );
1343
+ return this.requestApiRoot("/teams/bot/diagnostics/run", {
1344
+ method: "POST",
1345
+ body: JSON.stringify(input)
1346
+ });
1611
1347
  }
1612
1348
  createSandboxRuntime(input) {
1613
1349
  return this.requestApiRoot("/runtimes", {
@@ -1619,121 +1355,115 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1619
1355
  return createSandboxRuntimeHandle(this, runtimeId, initial);
1620
1356
  }
1621
1357
  getSandboxRuntime(runtimeId) {
1622
- return this.requestApiRoot(
1623
- `/runtimes/${encodeURIComponent(runtimeId)}`
1624
- ).then((payload) => payload.runtime);
1358
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}`).then((payload) => payload.runtime);
1625
1359
  }
1626
1360
  createSandboxRuntimeSandbox(runtimeId, input = {}, options = {}) {
1627
- return this.requestApiRoot(
1628
- `/runtimes/${encodeURIComponent(runtimeId)}/sandbox`,
1629
- {
1630
- method: "POST",
1631
- headers: asyncRequestHeaders(options),
1632
- body: JSON.stringify(input)
1633
- }
1634
- );
1361
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/sandbox`, {
1362
+ method: "POST",
1363
+ headers: asyncRequestHeaders(options),
1364
+ body: JSON.stringify(input)
1365
+ });
1635
1366
  }
1636
1367
  updateSandboxRuntimeStatus(runtimeId, input) {
1637
- return this.requestApiRoot(
1638
- `/runtimes/${encodeURIComponent(runtimeId)}/status`,
1639
- {
1640
- method: "PATCH",
1641
- body: JSON.stringify(input)
1642
- }
1643
- ).then((payload) => payload.runtime);
1368
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/status`, {
1369
+ method: "PATCH",
1370
+ body: JSON.stringify(input)
1371
+ }).then((payload) => payload.runtime);
1644
1372
  }
1645
1373
  listSandboxRuntimeEvents(runtimeId) {
1646
- return this.requestApiRoot(
1647
- `/runtimes/${encodeURIComponent(runtimeId)}/events`
1648
- );
1374
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/events`);
1649
1375
  }
1650
1376
  emitSandboxRuntimeEvent(runtimeId, input) {
1651
- return this.requestApiRoot(
1652
- `/runtimes/${encodeURIComponent(runtimeId)}/events`,
1653
- {
1654
- method: "POST",
1655
- body: JSON.stringify(input)
1656
- }
1657
- );
1377
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/events`, {
1378
+ method: "POST",
1379
+ body: JSON.stringify(input)
1380
+ });
1658
1381
  }
1659
1382
  checkpointSandboxRuntime(runtimeId, input) {
1660
- return this.requestApiRoot(
1661
- `/runtimes/${encodeURIComponent(runtimeId)}/checkpoints`,
1662
- {
1663
- method: "POST",
1664
- body: JSON.stringify(input)
1665
- }
1666
- ).then((payload) => payload.runtime);
1383
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/checkpoints`, {
1384
+ method: "POST",
1385
+ body: JSON.stringify(input)
1386
+ }).then((payload) => payload.runtime);
1667
1387
  }
1668
1388
  promoteSandboxRuntime(runtimeId, input, options = {}) {
1669
1389
  const query = new URLSearchParams();
1670
- if (options.teamId) query.set("teamId", options.teamId);
1671
- return this.requestApiRoot(
1672
- `/runtimes/${encodeURIComponent(runtimeId)}/promote${query.size > 0 ? `?${query.toString()}` : ""}`,
1673
- {
1674
- method: "POST",
1675
- body: JSON.stringify(input)
1676
- }
1677
- );
1390
+ if (options.teamId)
1391
+ query.set("teamId", options.teamId);
1392
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/promote${query.size > 0 ? `?${query.toString()}` : ""}`, {
1393
+ method: "POST",
1394
+ body: JSON.stringify(input)
1395
+ });
1678
1396
  }
1679
1397
  preserveSandboxRuntimeSource(runtimeId, input = {}, options = {}) {
1680
1398
  const query = new URLSearchParams();
1681
- if (options.teamId) query.set("teamId", options.teamId);
1682
- return this.requestApiRoot(
1683
- `/runtimes/${encodeURIComponent(runtimeId)}/preserve-source${query.size > 0 ? `?${query.toString()}` : ""}`,
1684
- {
1685
- method: "POST",
1686
- body: JSON.stringify(input)
1687
- }
1688
- );
1399
+ if (options.teamId)
1400
+ query.set("teamId", options.teamId);
1401
+ return this.requestApiRoot(`/runtimes/${encodeURIComponent(runtimeId)}/preserve-source${query.size > 0 ? `?${query.toString()}` : ""}`, {
1402
+ method: "POST",
1403
+ body: JSON.stringify(input)
1404
+ });
1689
1405
  }
1690
1406
  forkSnapshot(snapshotId, input = {}, options = {}) {
1691
1407
  const query = new URLSearchParams();
1692
- if (input.teamId) query.set("teamId", input.teamId);
1693
- if (input.projectId) query.set("projectId", input.projectId);
1694
- if (options.async) query.set("async", "1");
1408
+ if (input.teamId)
1409
+ query.set("teamId", input.teamId);
1410
+ if (input.projectId)
1411
+ query.set("projectId", input.projectId);
1412
+ if (options.async)
1413
+ query.set("async", "1");
1695
1414
  const { teamId: _teamId, projectId: _projectId, ...body } = input;
1696
- return this.request(
1697
- `/catalog/snapshots/${encodeURIComponent(snapshotId)}/fork${query.size > 0 ? `?${query.toString()}` : ""}`,
1698
- {
1699
- method: "POST",
1700
- headers: options.async ? { Prefer: "respond-async" } : void 0,
1701
- body: JSON.stringify({
1702
- ...body,
1703
- snapshotId
1704
- })
1705
- }
1706
- );
1415
+ return this.request(`/catalog/snapshots/${encodeURIComponent(snapshotId)}/fork${query.size > 0 ? `?${query.toString()}` : ""}`, {
1416
+ method: "POST",
1417
+ headers: options.async ? { Prefer: "respond-async" } : void 0,
1418
+ body: JSON.stringify({
1419
+ ...body,
1420
+ snapshotId
1421
+ })
1422
+ });
1707
1423
  }
1708
1424
  templates(input = {}) {
1709
1425
  const query = new URLSearchParams();
1710
- if (input.teamId) query.set("teamId", input.teamId);
1711
- if (input.projectId) query.set("projectId", input.projectId);
1712
- if (input.q) query.set("q", input.q);
1713
- if (input.name) query.set("name", input.name);
1714
- if (input.version) query.set("version", input.version);
1715
- if (input.visibility) query.set("visibility", input.visibility);
1716
- if (input.tag) query.set("tag", input.tag);
1717
- if (input.useCase) query.set("useCase", input.useCase);
1718
- if (input.limit) query.set("limit", String(input.limit));
1719
- return this.request(
1720
- `/templates${query.size > 0 ? `?${query.toString()}` : ""}`
1721
- );
1426
+ if (input.teamId)
1427
+ query.set("teamId", input.teamId);
1428
+ if (input.projectId)
1429
+ query.set("projectId", input.projectId);
1430
+ if (input.q)
1431
+ query.set("q", input.q);
1432
+ if (input.name)
1433
+ query.set("name", input.name);
1434
+ if (input.version)
1435
+ query.set("version", input.version);
1436
+ if (input.visibility)
1437
+ query.set("visibility", input.visibility);
1438
+ if (input.tag)
1439
+ query.set("tag", input.tag);
1440
+ if (input.useCase)
1441
+ query.set("useCase", input.useCase);
1442
+ if (input.limit)
1443
+ query.set("limit", String(input.limit));
1444
+ return this.request(`/templates${query.size > 0 ? `?${query.toString()}` : ""}`);
1722
1445
  }
1723
1446
  publishedSnapshots(input = {}) {
1724
1447
  const query = new URLSearchParams();
1725
- if (input.teamId) query.set("teamId", input.teamId);
1726
- if (input.projectId) query.set("projectId", input.projectId);
1727
- if (input.q) query.set("q", input.q);
1728
- if (input.name) query.set("name", input.name);
1729
- if (input.version) query.set("version", input.version);
1730
- if (input.visibility) query.set("visibility", input.visibility);
1731
- if (input.tag) query.set("tag", input.tag);
1732
- if (input.useCase) query.set("useCase", input.useCase);
1733
- if (input.limit) query.set("limit", String(input.limit));
1734
- return this.request(
1735
- `/published-snapshots${query.size > 0 ? `?${query.toString()}` : ""}`
1736
- ).then((payload) => {
1448
+ if (input.teamId)
1449
+ query.set("teamId", input.teamId);
1450
+ if (input.projectId)
1451
+ query.set("projectId", input.projectId);
1452
+ if (input.q)
1453
+ query.set("q", input.q);
1454
+ if (input.name)
1455
+ query.set("name", input.name);
1456
+ if (input.version)
1457
+ query.set("version", input.version);
1458
+ if (input.visibility)
1459
+ query.set("visibility", input.visibility);
1460
+ if (input.tag)
1461
+ query.set("tag", input.tag);
1462
+ if (input.useCase)
1463
+ query.set("useCase", input.useCase);
1464
+ if (input.limit)
1465
+ query.set("limit", String(input.limit));
1466
+ return this.request(`/published-snapshots${query.size > 0 ? `?${query.toString()}` : ""}`).then((payload) => {
1737
1467
  const publishedSnapshots = payload.publishedSnapshots ?? payload.templates;
1738
1468
  return {
1739
1469
  ...payload,
@@ -1744,29 +1474,27 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1744
1474
  }
1745
1475
  launchTemplate(input) {
1746
1476
  const query = new URLSearchParams();
1747
- if (input.teamId) query.set("teamId", input.teamId);
1748
- if (input.projectId) query.set("projectId", input.projectId);
1477
+ if (input.teamId)
1478
+ query.set("teamId", input.teamId);
1479
+ if (input.projectId)
1480
+ query.set("projectId", input.projectId);
1749
1481
  const { teamId: _teamId, projectId: _projectId, ...body } = input;
1750
- return this.request(
1751
- `/templates/launch${query.size > 0 ? `?${query.toString()}` : ""}`,
1752
- {
1753
- method: "POST",
1754
- body: JSON.stringify(body)
1755
- }
1756
- );
1482
+ return this.request(`/templates/launch${query.size > 0 ? `?${query.toString()}` : ""}`, {
1483
+ method: "POST",
1484
+ body: JSON.stringify(body)
1485
+ });
1757
1486
  }
1758
1487
  runPublishedSnapshot(input) {
1759
1488
  const query = new URLSearchParams();
1760
- if (input.teamId) query.set("teamId", input.teamId);
1761
- if (input.projectId) query.set("projectId", input.projectId);
1489
+ if (input.teamId)
1490
+ query.set("teamId", input.teamId);
1491
+ if (input.projectId)
1492
+ query.set("projectId", input.projectId);
1762
1493
  const { teamId: _teamId, projectId: _projectId, ...body } = input;
1763
- return this.request(
1764
- `/published-snapshots/launch${query.size > 0 ? `?${query.toString()}` : ""}`,
1765
- {
1766
- method: "POST",
1767
- body: JSON.stringify(body)
1768
- }
1769
- ).then((payload) => {
1494
+ return this.request(`/published-snapshots/launch${query.size > 0 ? `?${query.toString()}` : ""}`, {
1495
+ method: "POST",
1496
+ body: JSON.stringify(body)
1497
+ }).then((payload) => {
1770
1498
  const publishedSnapshot = payload.publishedSnapshot ?? payload.template;
1771
1499
  return {
1772
1500
  ...payload,
@@ -1777,134 +1505,94 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1777
1505
  }
1778
1506
  listSchedules(input = {}) {
1779
1507
  const query = new URLSearchParams();
1780
- if (input.teamId) query.set("teamId", input.teamId);
1781
- if (input.projectId) query.set("projectId", input.projectId);
1508
+ if (input.teamId)
1509
+ query.set("teamId", input.teamId);
1510
+ if (input.projectId)
1511
+ query.set("projectId", input.projectId);
1782
1512
  if (input.sourceSandboxId)
1783
1513
  query.set("sourceSandboxId", input.sourceSandboxId);
1784
- return this.request(
1785
- `/schedules${query.size > 0 ? `?${query.toString()}` : ""}`
1786
- );
1514
+ return this.request(`/schedules${query.size > 0 ? `?${query.toString()}` : ""}`);
1787
1515
  }
1788
1516
  createSchedule(input) {
1789
1517
  const query = new URLSearchParams();
1790
- if (input.projectId) query.set("projectId", input.projectId);
1518
+ if (input.projectId)
1519
+ query.set("projectId", input.projectId);
1791
1520
  const { projectId: _projectId, ...body } = input;
1792
- return this.request(
1793
- `/schedules${query.size > 0 ? `?${query.toString()}` : ""}`,
1794
- {
1795
- method: "POST",
1796
- body: JSON.stringify(body)
1797
- }
1798
- );
1521
+ return this.request(`/schedules${query.size > 0 ? `?${query.toString()}` : ""}`, {
1522
+ method: "POST",
1523
+ body: JSON.stringify(body)
1524
+ });
1799
1525
  }
1800
1526
  getSchedule(scheduleId) {
1801
- return this.request(
1802
- `/schedules/${encodeURIComponent(scheduleId)}`
1803
- );
1527
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}`);
1804
1528
  }
1805
1529
  updateSchedule(scheduleId, input) {
1806
- return this.request(
1807
- `/schedules/${encodeURIComponent(scheduleId)}`,
1808
- {
1809
- method: "PATCH",
1810
- body: JSON.stringify(input)
1811
- }
1812
- );
1530
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}`, {
1531
+ method: "PATCH",
1532
+ body: JSON.stringify(input)
1533
+ });
1813
1534
  }
1814
1535
  deleteSchedule(scheduleId) {
1815
- return this.request(
1816
- `/schedules/${encodeURIComponent(scheduleId)}`,
1817
- {
1818
- method: "DELETE"
1819
- }
1820
- );
1536
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}`, {
1537
+ method: "DELETE"
1538
+ });
1821
1539
  }
1822
1540
  listScheduleRuns(scheduleId, input = {}) {
1823
1541
  const query = new URLSearchParams();
1824
- if (input.limit !== void 0) query.set("limit", String(input.limit));
1825
- return this.request(
1826
- `/schedules/${encodeURIComponent(scheduleId)}/runs${query.size > 0 ? `?${query.toString()}` : ""}`
1827
- );
1542
+ if (input.limit !== void 0)
1543
+ query.set("limit", String(input.limit));
1544
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}/runs${query.size > 0 ? `?${query.toString()}` : ""}`);
1828
1545
  }
1829
1546
  runScheduleNow(scheduleId, input = {}) {
1830
- return this.request(
1831
- `/schedules/${encodeURIComponent(scheduleId)}/run`,
1832
- {
1833
- method: "POST",
1834
- body: JSON.stringify(input)
1835
- }
1836
- );
1547
+ return this.request(`/schedules/${encodeURIComponent(scheduleId)}/run`, {
1548
+ method: "POST",
1549
+ body: JSON.stringify(input)
1550
+ });
1837
1551
  }
1838
1552
  listTemplateBuilds(input) {
1839
1553
  const query = new URLSearchParams({ teamId: input.teamId });
1840
- return this.requestApiRoot(
1841
- `/sandbox-template-builds?${query.toString()}`
1842
- ).then((payload) => payload.builds);
1554
+ return this.requestApiRoot(`/sandbox-template-builds?${query.toString()}`).then((payload) => payload.builds);
1843
1555
  }
1844
1556
  createTemplateBuild(input) {
1845
- return this.requestApiRoot(
1846
- "/sandbox-template-builds",
1847
- {
1848
- method: "POST",
1849
- body: JSON.stringify(input)
1850
- }
1851
- ).then((payload) => payload.build);
1557
+ return this.requestApiRoot("/sandbox-template-builds", {
1558
+ method: "POST",
1559
+ body: JSON.stringify(input)
1560
+ }).then((payload) => payload.build);
1852
1561
  }
1853
1562
  getTemplateBuild(buildId) {
1854
- return this.requestApiRoot(
1855
- `/sandbox-template-builds/${encodeURIComponent(buildId)}`
1856
- ).then((payload) => payload.build);
1563
+ return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(buildId)}`).then((payload) => payload.build);
1857
1564
  }
1858
1565
  getTemplateBuildLogs(buildId) {
1859
- return this.requestApiRoot(
1860
- `/sandbox-template-builds/${encodeURIComponent(buildId)}/logs`
1861
- );
1566
+ return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(buildId)}/logs`);
1862
1567
  }
1863
1568
  cancelTemplateBuild(buildId) {
1864
- return this.requestApiRoot(
1865
- `/sandbox-template-builds/${encodeURIComponent(buildId)}/cancel`,
1866
- {
1867
- method: "POST"
1868
- }
1869
- ).then((payload) => payload.build);
1569
+ return this.requestApiRoot(`/sandbox-template-builds/${encodeURIComponent(buildId)}/cancel`, {
1570
+ method: "POST"
1571
+ }).then((payload) => payload.build);
1870
1572
  }
1871
1573
  listPublishedSnapshotBuilds(input) {
1872
1574
  const query = new URLSearchParams({ teamId: input.teamId });
1873
- return this.requestApiRoot(
1874
- `/published-snapshot-builds?${query.toString()}`
1875
- ).then((payload) => payload.builds);
1575
+ return this.requestApiRoot(`/published-snapshot-builds?${query.toString()}`).then((payload) => payload.builds);
1876
1576
  }
1877
1577
  createPublishedSnapshotBuild(input) {
1878
- return this.requestApiRoot(
1879
- "/published-snapshot-builds",
1880
- {
1881
- method: "POST",
1882
- body: JSON.stringify(input)
1883
- }
1884
- ).then((payload) => payload.build);
1578
+ return this.requestApiRoot("/published-snapshot-builds", {
1579
+ method: "POST",
1580
+ body: JSON.stringify(input)
1581
+ }).then((payload) => payload.build);
1885
1582
  }
1886
1583
  getPublishedSnapshotBuild(buildId) {
1887
- return this.requestApiRoot(
1888
- `/published-snapshot-builds/${encodeURIComponent(buildId)}`
1889
- ).then((payload) => payload.build);
1584
+ return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(buildId)}`).then((payload) => payload.build);
1890
1585
  }
1891
1586
  getPublishedSnapshotBuildLogs(buildId) {
1892
- return this.requestApiRoot(
1893
- `/published-snapshot-builds/${encodeURIComponent(buildId)}/logs`
1894
- );
1587
+ return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(buildId)}/logs`);
1895
1588
  }
1896
1589
  cancelPublishedSnapshotBuild(buildId) {
1897
- return this.requestApiRoot(
1898
- `/published-snapshot-builds/${encodeURIComponent(buildId)}/cancel`,
1899
- {
1900
- method: "POST"
1901
- }
1902
- ).then((payload) => payload.build);
1590
+ return this.requestApiRoot(`/published-snapshot-builds/${encodeURIComponent(buildId)}/cancel`, {
1591
+ method: "POST"
1592
+ }).then((payload) => payload.build);
1903
1593
  }
1904
1594
  listOrganizations() {
1905
- return this.requestApiRoot(
1906
- "/organizations"
1907
- ).then((payload) => payload.organizations ?? payload.teams ?? []);
1595
+ return this.requestApiRoot("/organizations").then((payload) => payload.organizations ?? payload.teams ?? []);
1908
1596
  }
1909
1597
  createOrganization(input) {
1910
1598
  return this.requestApiRoot("/organizations", {
@@ -1913,136 +1601,112 @@ var OpenPondSandboxClient = class extends OpenPondSandboxInstanceClient {
1913
1601
  }).then((payload) => payload.organization);
1914
1602
  }
1915
1603
  getOrganization(slug) {
1916
- return this.requestApiRoot(
1917
- `/organizations/${encodeURIComponent(slug)}`
1918
- ).then((payload) => payload.organization);
1604
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}`).then((payload) => payload.organization);
1919
1605
  }
1920
1606
  updateOrganization(slug, input) {
1921
- return this.requestApiRoot(
1922
- `/organizations/${encodeURIComponent(slug)}`,
1923
- {
1924
- method: "PATCH",
1925
- body: JSON.stringify(input)
1926
- }
1927
- ).then((payload) => payload.organization);
1607
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}`, {
1608
+ method: "PATCH",
1609
+ body: JSON.stringify(input)
1610
+ }).then((payload) => payload.organization);
1928
1611
  }
1929
1612
  listOrganizationMembers(slug) {
1930
- return this.requestApiRoot(
1931
- `/organizations/${encodeURIComponent(slug)}/members`
1932
- ).then((payload) => payload.members);
1613
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/members`).then((payload) => payload.members);
1933
1614
  }
1934
1615
  upsertOrganizationMember(slug, input) {
1935
- return this.requestApiRoot(
1936
- `/organizations/${encodeURIComponent(slug)}/members`,
1937
- {
1938
- method: "POST",
1939
- body: JSON.stringify(input)
1940
- }
1941
- ).then((payload) => payload.member);
1616
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/members`, {
1617
+ method: "POST",
1618
+ body: JSON.stringify(input)
1619
+ }).then((payload) => payload.member);
1942
1620
  }
1943
1621
  getOrganizationMcpServer(slug) {
1944
- return this.requestApiRoot(
1945
- `/organizations/${encodeURIComponent(slug)}/mcp-server`
1946
- ).then((payload) => payload.mcpServer);
1622
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/mcp-server`).then((payload) => payload.mcpServer);
1947
1623
  }
1948
1624
  generateOrganizationMcpServer(slug, input = {}) {
1949
- return this.requestApiRoot(
1950
- `/organizations/${encodeURIComponent(slug)}/mcp-server`,
1951
- {
1952
- method: "POST",
1953
- body: JSON.stringify(input)
1954
- }
1955
- ).then((payload) => payload.mcpServer);
1625
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/mcp-server`, {
1626
+ method: "POST",
1627
+ body: JSON.stringify(input)
1628
+ }).then((payload) => payload.mcpServer);
1956
1629
  }
1957
1630
  rotateOrganizationMcpServer(slug) {
1958
- return this.requestApiRoot(
1959
- `/organizations/${encodeURIComponent(slug)}/mcp-server/rotate`,
1960
- {
1961
- method: "POST"
1962
- }
1963
- ).then((payload) => payload.mcpServer);
1631
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/mcp-server/rotate`, {
1632
+ method: "POST"
1633
+ }).then((payload) => payload.mcpServer);
1964
1634
  }
1965
1635
  disableOrganizationMcpServer(slug) {
1966
- return this.requestApiRoot(
1967
- `/organizations/${encodeURIComponent(slug)}/mcp-server/disable`,
1968
- {
1969
- method: "POST"
1970
- }
1971
- ).then((payload) => payload.mcpServer);
1636
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/mcp-server/disable`, {
1637
+ method: "POST"
1638
+ }).then((payload) => payload.mcpServer);
1972
1639
  }
1973
1640
  enableOrganizationMcpServer(slug) {
1974
- return this.requestApiRoot(
1975
- `/organizations/${encodeURIComponent(slug)}/mcp-server/enable`,
1976
- {
1977
- method: "POST"
1978
- }
1979
- ).then((payload) => payload.mcpServer);
1641
+ return this.requestApiRoot(`/organizations/${encodeURIComponent(slug)}/mcp-server/enable`, {
1642
+ method: "POST"
1643
+ }).then((payload) => payload.mcpServer);
1980
1644
  }
1981
1645
  startReplay(input) {
1982
1646
  const query = new URLSearchParams();
1983
- if (input.teamId) query.set("teamId", input.teamId);
1984
- if (input.projectId) query.set("projectId", input.projectId);
1647
+ if (input.teamId)
1648
+ query.set("teamId", input.teamId);
1649
+ if (input.projectId)
1650
+ query.set("projectId", input.projectId);
1985
1651
  const { teamId: _teamId, projectId: _projectId, ...body } = input;
1986
- return this.requestApiRoot(
1987
- `/sandbox-replays${query.size > 0 ? `?${query.toString()}` : ""}`,
1988
- {
1989
- method: "POST",
1990
- body: JSON.stringify(body)
1991
- }
1992
- );
1652
+ return this.requestApiRoot(`/sandbox-replays${query.size > 0 ? `?${query.toString()}` : ""}`, {
1653
+ method: "POST",
1654
+ body: JSON.stringify(body)
1655
+ });
1993
1656
  }
1994
1657
  listReplays(input = {}) {
1995
1658
  const query = new URLSearchParams();
1996
- if (input.teamId) query.set("teamId", input.teamId);
1997
- if (input.projectId) query.set("projectId", input.projectId);
1998
- return this.requestApiRoot(
1999
- `/sandbox-replays${query.size > 0 ? `?${query.toString()}` : ""}`
2000
- );
1659
+ if (input.teamId)
1660
+ query.set("teamId", input.teamId);
1661
+ if (input.projectId)
1662
+ query.set("projectId", input.projectId);
1663
+ return this.requestApiRoot(`/sandbox-replays${query.size > 0 ? `?${query.toString()}` : ""}`);
2001
1664
  }
2002
1665
  getReplay(replayId, input = {}) {
2003
1666
  const query = new URLSearchParams();
2004
- if (input.teamId) query.set("teamId", input.teamId);
2005
- if (input.projectId) query.set("projectId", input.projectId);
2006
- return this.requestApiRoot(
2007
- `/sandbox-replays/${encodeURIComponent(replayId)}${query.size > 0 ? `?${query.toString()}` : ""}`
2008
- );
1667
+ if (input.teamId)
1668
+ query.set("teamId", input.teamId);
1669
+ if (input.projectId)
1670
+ query.set("projectId", input.projectId);
1671
+ return this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(replayId)}${query.size > 0 ? `?${query.toString()}` : ""}`);
2009
1672
  }
2010
1673
  getReplayLogs(replayId, input = {}) {
2011
1674
  const query = new URLSearchParams();
2012
- if (input.teamId) query.set("teamId", input.teamId);
2013
- if (input.projectId) query.set("projectId", input.projectId);
2014
- return this.requestApiRoot(
2015
- `/sandbox-replays/${encodeURIComponent(replayId)}/logs${query.size > 0 ? `?${query.toString()}` : ""}`
2016
- );
1675
+ if (input.teamId)
1676
+ query.set("teamId", input.teamId);
1677
+ if (input.projectId)
1678
+ query.set("projectId", input.projectId);
1679
+ return this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(replayId)}/logs${query.size > 0 ? `?${query.toString()}` : ""}`);
2017
1680
  }
2018
1681
  getReplayArtifacts(replayId, input = {}) {
2019
1682
  const query = new URLSearchParams();
2020
- if (input.teamId) query.set("teamId", input.teamId);
2021
- if (input.projectId) query.set("projectId", input.projectId);
2022
- return this.requestApiRoot(
2023
- `/sandbox-replays/${encodeURIComponent(replayId)}/artifacts${query.size > 0 ? `?${query.toString()}` : ""}`
2024
- );
1683
+ if (input.teamId)
1684
+ query.set("teamId", input.teamId);
1685
+ if (input.projectId)
1686
+ query.set("projectId", input.projectId);
1687
+ return this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(replayId)}/artifacts${query.size > 0 ? `?${query.toString()}` : ""}`);
2025
1688
  }
2026
1689
  cancelReplay(replayId, input = {}) {
2027
1690
  const query = new URLSearchParams();
2028
- if (input.teamId) query.set("teamId", input.teamId);
2029
- if (input.projectId) query.set("projectId", input.projectId);
2030
- return this.requestApiRoot(
2031
- `/sandbox-replays/${encodeURIComponent(replayId)}/cancel${query.size > 0 ? `?${query.toString()}` : ""}`,
2032
- {
2033
- method: "POST"
2034
- }
2035
- );
1691
+ if (input.teamId)
1692
+ query.set("teamId", input.teamId);
1693
+ if (input.projectId)
1694
+ query.set("projectId", input.projectId);
1695
+ return this.requestApiRoot(`/sandbox-replays/${encodeURIComponent(replayId)}/cancel${query.size > 0 ? `?${query.toString()}` : ""}`, {
1696
+ method: "POST"
1697
+ });
2036
1698
  }
2037
1699
  integrationConnections(input = {}) {
2038
1700
  const query = new URLSearchParams();
2039
- if (input.teamId) query.set("teamId", input.teamId);
2040
- if (input.projectId) query.set("projectId", input.projectId);
2041
- if (input.agentId) query.set("agentId", input.agentId);
2042
- if (input.status) query.set("status", input.status);
2043
- return this.requestApiRoot(
2044
- `/integrations/connections${query.size > 0 ? `?${query.toString()}` : ""}`
2045
- );
1701
+ if (input.teamId)
1702
+ query.set("teamId", input.teamId);
1703
+ if (input.projectId)
1704
+ query.set("projectId", input.projectId);
1705
+ if (input.agentId)
1706
+ query.set("agentId", input.agentId);
1707
+ if (input.status)
1708
+ query.set("status", input.status);
1709
+ return this.requestApiRoot(`/integrations/connections${query.size > 0 ? `?${query.toString()}` : ""}`);
2046
1710
  }
2047
1711
  mcpServerConfig() {
2048
1712
  return {
@@ -2062,11 +1726,12 @@ function createOpenPondSandboxClient(options) {
2062
1726
  return new OpenPondSandboxClient(options);
2063
1727
  }
2064
1728
 
2065
- // ../cloud/src/hosted-chat.ts
1729
+ // ../cloud/dist/hosted-chat.js
2066
1730
  import { randomUUID } from "node:crypto";
2067
1731
  function normalizeApiBaseUrl(value) {
2068
1732
  const trimmed = normalizeOptionalOpChatApiBaseUrl(value);
2069
- if (!trimmed) throw new Error("apiBaseUrl is required");
1733
+ if (!trimmed)
1734
+ throw new Error("apiBaseUrl is required");
2070
1735
  return trimmed;
2071
1736
  }
2072
1737
  function trimTrailingSlashes(value) {
@@ -2074,10 +1739,13 @@ function trimTrailingSlashes(value) {
2074
1739
  }
2075
1740
  function normalizeOptionalOpChatApiBaseUrl(value) {
2076
1741
  let trimmed = trimTrailingSlashes(value?.trim() ?? "");
2077
- if (!trimmed) return null;
1742
+ if (!trimmed)
1743
+ return null;
2078
1744
  trimmed = trimmed.replace(/\/chat\/completions$/i, "").replace(/\/models(?:\/[^/]+)?$/i, "");
2079
- if (trimmed.endsWith("/opchat/v1")) return trimmed;
2080
- if (trimmed.endsWith("/opchat")) return `${trimmed}/v1`;
1745
+ if (trimmed.endsWith("/opchat/v1"))
1746
+ return trimmed;
1747
+ if (trimmed.endsWith("/opchat"))
1748
+ return `${trimmed}/v1`;
2081
1749
  if (trimmed.endsWith("/v1")) {
2082
1750
  trimmed = trimmed.slice(0, -"/v1".length);
2083
1751
  }
@@ -2086,15 +1754,18 @@ function normalizeOptionalOpChatApiBaseUrl(value) {
2086
1754
  function resolveOpChatApiBaseUrl(options = {}) {
2087
1755
  const runtimeEnv = options.env ?? (typeof process !== "undefined" ? process.env : {});
2088
1756
  const explicit = normalizeOptionalOpChatApiBaseUrl(options.opChatApiBaseUrl) ?? normalizeOptionalOpChatApiBaseUrl(runtimeEnv.OPENPOND_OPCHAT_API_URL);
2089
- if (explicit) return explicit;
1757
+ if (explicit)
1758
+ return explicit;
2090
1759
  const migrationInput = normalizeOptionalOpChatApiBaseUrl(options.chatApiBaseUrl) ?? normalizeOptionalOpChatApiBaseUrl(runtimeEnv.OPENPOND_CHAT_API_URL) ?? normalizeOptionalOpChatApiBaseUrl(runtimeEnv.OPENPOND_GATEWAY_URL);
2091
- if (migrationInput) return migrationInput;
1760
+ if (migrationInput)
1761
+ return migrationInput;
2092
1762
  const apiBase = normalizeOptionalOpChatApiBaseUrl(options.apiBaseUrl) ?? normalizeOptionalOpChatApiBaseUrl(runtimeEnv.OPENPOND_API_URL);
2093
1763
  return apiBase ?? DEFAULT_OPENPOND_OPCHAT_API_BASE_URL;
2094
1764
  }
2095
1765
  function requireToken(value) {
2096
1766
  const trimmed = value.trim();
2097
- if (!trimmed) throw new Error("OpenPond API key is required");
1767
+ if (!trimmed)
1768
+ throw new Error("OpenPond API key is required");
2098
1769
  return trimmed;
2099
1770
  }
2100
1771
  function hostedHeaders(requestUrl, token, accept, requestId) {
@@ -2108,7 +1779,8 @@ function hostedHeaders(requestUrl, token, accept, requestId) {
2108
1779
  }
2109
1780
  async function readError(response) {
2110
1781
  const text = await response.text().catch(() => "");
2111
- if (!text) return response.statusText || `HTTP ${response.status}`;
1782
+ if (!text)
1783
+ return response.statusText || `HTTP ${response.status}`;
2112
1784
  try {
2113
1785
  const payload = JSON.parse(text);
2114
1786
  const error = typeof payload.error === "string" ? payload.error : payload.error && typeof payload.error === "object" && !Array.isArray(payload.error) ? payload.error : null;
@@ -2153,31 +1825,20 @@ async function listOpChatModels(options) {
2153
1825
  signal: options.signal
2154
1826
  });
2155
1827
  if (!response.ok) {
2156
- throw new Error(
2157
- `Hosted model list failed: ${response.status} ${await readError(
2158
- response
2159
- )}`
2160
- );
1828
+ throw new Error(`Hosted model list failed: ${response.status} ${await readError(response)}`);
2161
1829
  }
2162
1830
  return await response.json();
2163
1831
  }
2164
1832
  async function getOpChatModel(options) {
2165
1833
  const apiBaseUrl = normalizeApiBaseUrl(options.apiBaseUrl);
2166
1834
  const requestUrl = `${apiBaseUrl}/models/${encodeURIComponent(options.model)}`;
2167
- const response = await fetch(
2168
- requestUrl,
2169
- {
2170
- method: "GET",
2171
- headers: hostedHeaders(requestUrl, options.token, "application/json"),
2172
- signal: options.signal
2173
- }
2174
- );
1835
+ const response = await fetch(requestUrl, {
1836
+ method: "GET",
1837
+ headers: hostedHeaders(requestUrl, options.token, "application/json"),
1838
+ signal: options.signal
1839
+ });
2175
1840
  if (!response.ok) {
2176
- throw new Error(
2177
- `Hosted model lookup failed: ${response.status} ${await readError(
2178
- response
2179
- )}`
2180
- );
1841
+ throw new Error(`Hosted model lookup failed: ${response.status} ${await readError(response)}`);
2181
1842
  }
2182
1843
  return await response.json();
2183
1844
  }
@@ -2190,31 +1851,20 @@ async function listOpChatProviders(options) {
2190
1851
  signal: options.signal
2191
1852
  });
2192
1853
  if (!response.ok) {
2193
- throw new Error(
2194
- `Hosted provider list failed: ${response.status} ${await readError(
2195
- response
2196
- )}`
2197
- );
1854
+ throw new Error(`Hosted provider list failed: ${response.status} ${await readError(response)}`);
2198
1855
  }
2199
1856
  return await response.json();
2200
1857
  }
2201
1858
  async function getOpChatProvider(options) {
2202
1859
  const apiBaseUrl = normalizeApiBaseUrl(options.apiBaseUrl);
2203
1860
  const requestUrl = `${apiBaseUrl}/providers/${encodeURIComponent(options.provider)}`;
2204
- const response = await fetch(
2205
- requestUrl,
2206
- {
2207
- method: "GET",
2208
- headers: hostedHeaders(requestUrl, options.token, "application/json"),
2209
- signal: options.signal
2210
- }
2211
- );
1861
+ const response = await fetch(requestUrl, {
1862
+ method: "GET",
1863
+ headers: hostedHeaders(requestUrl, options.token, "application/json"),
1864
+ signal: options.signal
1865
+ });
2212
1866
  if (!response.ok) {
2213
- throw new Error(
2214
- `Hosted provider lookup failed: ${response.status} ${await readError(
2215
- response
2216
- )}`
2217
- );
1867
+ throw new Error(`Hosted provider lookup failed: ${response.status} ${await readError(response)}`);
2218
1868
  }
2219
1869
  return await response.json();
2220
1870
  }
@@ -2223,19 +1873,12 @@ async function sendHostedChatTurn(options) {
2223
1873
  const requestUrl = `${apiBaseUrl}/chat/completions`;
2224
1874
  const response = await fetch(requestUrl, {
2225
1875
  method: "POST",
2226
- headers: hostedHeaders(
2227
- requestUrl,
2228
- options.token,
2229
- "application/json",
2230
- options.requestId
2231
- ),
1876
+ headers: hostedHeaders(requestUrl, options.token, "application/json", options.requestId),
2232
1877
  body: JSON.stringify(buildHostedChatBody(options, false)),
2233
1878
  signal: options.signal
2234
1879
  });
2235
1880
  if (!response.ok) {
2236
- throw new Error(
2237
- `Hosted chat failed: ${response.status} ${await readError(response)}`
2238
- );
1881
+ throw new Error(`Hosted chat failed: ${response.status} ${await readError(response)}`);
2239
1882
  }
2240
1883
  return await response.json();
2241
1884
  }
@@ -2246,18 +1889,23 @@ async function* parseOpenAISSE(stream, signal) {
2246
1889
  const readAbortError = () => signal?.reason instanceof Error ? signal.reason : new Error("hosted_chat_aborted");
2247
1890
  try {
2248
1891
  while (true) {
2249
- if (signal?.aborted) throw readAbortError();
1892
+ if (signal?.aborted)
1893
+ throw readAbortError();
2250
1894
  const result = await reader.read();
2251
- if (result.done) break;
1895
+ if (result.done)
1896
+ break;
2252
1897
  buffer += decoder.decode(result.value, { stream: true });
2253
1898
  const lines = buffer.split("\n");
2254
1899
  buffer = lines.pop() || "";
2255
1900
  for (const line of lines) {
2256
1901
  const trimmed = line.trim();
2257
- if (!trimmed.startsWith("data:")) continue;
1902
+ if (!trimmed.startsWith("data:"))
1903
+ continue;
2258
1904
  const data = trimmed.slice(5).trim();
2259
- if (!data) continue;
2260
- if (data === "[DONE]") return;
1905
+ if (!data)
1906
+ continue;
1907
+ if (data === "[DONE]")
1908
+ return;
2261
1909
  yield JSON.parse(data);
2262
1910
  }
2263
1911
  }
@@ -2273,21 +1921,12 @@ async function* streamHostedChatTurn(options) {
2273
1921
  const requestUrl = `${apiBaseUrl}/chat/completions`;
2274
1922
  const response = await fetch(requestUrl, {
2275
1923
  method: "POST",
2276
- headers: hostedHeaders(
2277
- requestUrl,
2278
- options.token,
2279
- "text/event-stream",
2280
- options.requestId
2281
- ),
1924
+ headers: hostedHeaders(requestUrl, options.token, "text/event-stream", options.requestId),
2282
1925
  body: JSON.stringify(buildHostedChatBody(options, true)),
2283
1926
  signal: options.signal
2284
1927
  });
2285
1928
  if (!response.ok || !response.body) {
2286
- throw new Error(
2287
- `Hosted chat stream failed: ${response.status} ${await readError(
2288
- response
2289
- )}`
2290
- );
1929
+ throw new Error(`Hosted chat stream failed: ${response.status} ${await readError(response)}`);
2291
1930
  }
2292
1931
  for await (const raw of parseOpenAISSE(response.body, options.signal)) {
2293
1932
  const chunk = raw;
@@ -2298,7 +1937,8 @@ async function* streamHostedChatTurn(options) {
2298
1937
  yield { type: "usage", usage: chunk.usage, raw };
2299
1938
  }
2300
1939
  const choice = chunk.choices?.[0];
2301
- if (!choice) continue;
1940
+ if (!choice)
1941
+ continue;
2302
1942
  const content = choice.delta?.content;
2303
1943
  if (content) {
2304
1944
  yield { type: "text_delta", text: content, raw };
@@ -2836,7 +2476,81 @@ function sleep2(milliseconds, signal) {
2836
2476
  });
2837
2477
  }
2838
2478
 
2839
- // ../cloud/src/sandbox/types/runtime-profiles.ts
2479
+ // src/project-actions.ts
2480
+ import { promises as fs } from "node:fs";
2481
+ var OpenPondProjectActionsClient = class {
2482
+ #apiKey;
2483
+ #apiBaseUrl;
2484
+ constructor(input) {
2485
+ this.#apiKey = input.apiKey;
2486
+ this.#apiBaseUrl = input.apiBaseUrl.replace(/\/+$/, "");
2487
+ }
2488
+ async list(input) {
2489
+ const response = await apiFetch(
2490
+ this.#apiBaseUrl,
2491
+ this.#apiKey,
2492
+ projectActionPath(input.projectId, "releases", input.teamId)
2493
+ );
2494
+ return (await readApiJson(response, "List Project Action releases")).releases;
2495
+ }
2496
+ async catalog(input) {
2497
+ const response = await apiFetch(
2498
+ this.#apiBaseUrl,
2499
+ this.#apiKey,
2500
+ projectActionPath(input.projectId, "catalog", input.teamId)
2501
+ );
2502
+ return (await readApiJson(response, "Get Project Action catalog")).catalog;
2503
+ }
2504
+ async publish(input) {
2505
+ const [bundle, runner] = await Promise.all([
2506
+ fs.readFile(input.build.bundlePath),
2507
+ fs.readFile(input.build.runnerPath)
2508
+ ]);
2509
+ const response = await apiFetch(
2510
+ this.#apiBaseUrl,
2511
+ this.#apiKey,
2512
+ projectActionPath(input.projectId, "releases", input.teamId),
2513
+ {
2514
+ method: "POST",
2515
+ body: JSON.stringify({
2516
+ sourceRef: input.sourceRef,
2517
+ sourceCommitSha: input.sourceCommitSha,
2518
+ bundleBase64: bundle.toString("base64"),
2519
+ runnerBase64: runner.toString("base64"),
2520
+ registry: input.build.registry,
2521
+ manifest: input.build.manifest,
2522
+ metadata: input.metadata
2523
+ })
2524
+ }
2525
+ );
2526
+ return (await readApiJson(response, "Publish Project Actions")).release;
2527
+ }
2528
+ async run(input) {
2529
+ const response = await apiFetch(
2530
+ this.#apiBaseUrl,
2531
+ this.#apiKey,
2532
+ projectActionPath(input.projectId, `actions/${encodeURIComponent(input.actionId)}`, input.teamId),
2533
+ {
2534
+ method: "POST",
2535
+ body: JSON.stringify({
2536
+ input: input.value ?? {},
2537
+ releaseId: input.releaseId,
2538
+ idempotencyKey: input.idempotencyKey,
2539
+ callerType: input.callerType ?? "sdk",
2540
+ callerId: input.callerId
2541
+ }),
2542
+ signal: input.signal,
2543
+ timeoutMs: 15 * 60 * 1e3
2544
+ }
2545
+ );
2546
+ return (await readApiJson(response, "Run Project Action")).invocation;
2547
+ }
2548
+ };
2549
+ function projectActionPath(projectId, suffix, teamId) {
2550
+ return `/v1/project-actions/${encodeURIComponent(projectId)}/${suffix}?teamId=${encodeURIComponent(teamId)}`;
2551
+ }
2552
+
2553
+ // ../cloud/dist/sandbox/types/runtime-profiles.js
2840
2554
  var SANDBOX_RUNTIME_PROFILE_IDS = [
2841
2555
  "openpond-generic-v1",
2842
2556
  "openpond-work-v1",
@@ -2848,6 +2562,7 @@ var SANDBOX_RUNTIME_PROFILE_IDS = [
2848
2562
  var OpenPondClient = class {
2849
2563
  sandboxes;
2850
2564
  work;
2565
+ actions;
2851
2566
  constructor(options) {
2852
2567
  const apiKey = options.apiKey.trim();
2853
2568
  if (!apiKey) throw new Error("OpenPond API key is required");
@@ -2863,6 +2578,7 @@ var OpenPondClient = class {
2863
2578
  chatApiBaseUrl: options.chatApiUrl?.trim() || resolveOpChatApiBaseUrl({ apiBaseUrl, env: {} }),
2864
2579
  sandboxes: this.sandboxes
2865
2580
  });
2581
+ this.actions = new OpenPondProjectActionsClient({ apiKey, apiBaseUrl });
2866
2582
  }
2867
2583
  };
2868
2584
  function createOpenPondClient(options) {
@@ -2871,6 +2587,7 @@ function createOpenPondClient(options) {
2871
2587
  export {
2872
2588
  OpenPondApiError,
2873
2589
  OpenPondClient,
2590
+ OpenPondProjectActionsClient,
2874
2591
  OpenPondSandboxClient,
2875
2592
  OpenPondWorkClient,
2876
2593
  SANDBOX_RUNTIME_PROFILE_IDS,