computesdk 2.5.0 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -89,6 +89,19 @@ interface RunCommandOptions {
89
89
  timeout?: number;
90
90
  background?: boolean;
91
91
  }
92
+ /**
93
+ * Snapshot information
94
+ */
95
+ interface Snapshot {
96
+ /** Unique identifier for the snapshot */
97
+ id: string;
98
+ /** Provider hosting the snapshot */
99
+ provider: string;
100
+ /** When the snapshot was created */
101
+ createdAt: Date;
102
+ /** Additional provider-specific metadata */
103
+ metadata?: Record<string, any>;
104
+ }
92
105
  /**
93
106
  * Filesystem operations interface
94
107
  */
@@ -3833,13 +3846,14 @@ declare const PROVIDER_AUTH: {
3833
3846
  readonly daytona: readonly [readonly ["DAYTONA_API_KEY"]];
3834
3847
  readonly vercel: readonly [readonly ["VERCEL_OIDC_TOKEN"], readonly ["VERCEL_TOKEN", "VERCEL_TEAM_ID", "VERCEL_PROJECT_ID"]];
3835
3848
  readonly runloop: readonly [readonly ["RUNLOOP_API_KEY"]];
3836
- readonly cloudflare: readonly [readonly ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]];
3849
+ readonly cloudflare: readonly [readonly ["CLOUDFLARE_SANDBOX_URL", "CLOUDFLARE_SANDBOX_SECRET"], readonly ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]];
3837
3850
  readonly codesandbox: readonly [readonly ["CSB_API_KEY"]];
3838
3851
  readonly blaxel: readonly [readonly ["BL_API_KEY", "BL_WORKSPACE"]];
3839
3852
  readonly namespace: readonly [readonly ["NSC_TOKEN"], readonly ["NSC_TOKEN_FILE"]];
3840
3853
  readonly hopx: readonly [readonly ["HOPX_API_KEY"]];
3841
3854
  readonly beam: readonly [readonly ["BEAM_TOKEN", "BEAM_WORKSPACE_ID"]];
3842
3855
  readonly sprites: readonly [readonly ["SPRITES_TOKEN"]];
3856
+ readonly freestyle: readonly [readonly ["FREESTYLE_API_KEY"]];
3843
3857
  readonly 'just-bash': readonly [readonly []];
3844
3858
  };
3845
3859
  /**
@@ -3976,6 +3990,9 @@ interface ExplicitComputeConfig {
3976
3990
  sprites?: {
3977
3991
  apiKey?: string;
3978
3992
  };
3993
+ freestyle?: {
3994
+ apiKey?: string;
3995
+ };
3979
3996
  'just-bash'?: {};
3980
3997
  }
3981
3998
  /**
@@ -4101,6 +4118,36 @@ declare class ComputeManager {
4101
4118
  */
4102
4119
  extendTimeout: (sandboxId: string, options?: ExtendTimeoutOptions) => Promise<void>;
4103
4120
  };
4121
+ snapshot: {
4122
+ /**
4123
+ * Create a snapshot from a running sandbox
4124
+ *
4125
+ * @param sandboxId ID of the sandbox to snapshot
4126
+ * @param options Snapshot options (name, metadata)
4127
+ */
4128
+ create: (sandboxId: string, options?: {
4129
+ name?: string;
4130
+ metadata?: Record<string, any>;
4131
+ }) => Promise<{
4132
+ id: string;
4133
+ provider: string;
4134
+ createdAt: Date;
4135
+ metadata?: Record<string, any>;
4136
+ }>;
4137
+ /**
4138
+ * List all snapshots
4139
+ */
4140
+ list: () => Promise<Array<{
4141
+ id: string;
4142
+ provider: string;
4143
+ createdAt: Date;
4144
+ metadata?: Record<string, any>;
4145
+ }>>;
4146
+ /**
4147
+ * Delete a snapshot
4148
+ */
4149
+ delete: (snapshotId: string) => Promise<void>;
4150
+ };
4104
4151
  }
4105
4152
  /**
4106
4153
  * Callable compute interface - dual nature as both singleton and factory
@@ -4190,12 +4237,12 @@ declare function autoConfigureCompute(): GatewayConfig | null;
4190
4237
  /**
4191
4238
  * Default gateway URL for sandbox lifecycle operations
4192
4239
  */
4193
- declare const GATEWAY_URL = "https://gateway.computesdk.com";
4240
+ declare const TRIBUTARY_URL = "https://tributary.edge.computesdk.com";
4194
4241
  /**
4195
4242
  * Provider detection priority order
4196
4243
  * When multiple provider credentials are detected, use the first one in this list
4197
4244
  */
4198
- declare const PROVIDER_PRIORITY: readonly ["e2b", "railway", "render", "daytona", "modal", "runloop", "vercel", "cloudflare", "codesandbox", "blaxel", "namespace", "hopx", "beam", "sprites"];
4245
+ declare const PROVIDER_PRIORITY: readonly ["e2b", "railway", "render", "daytona", "modal", "runloop", "vercel", "cloudflare", "codesandbox", "blaxel", "namespace", "hopx", "beam", "sprites", "freestyle"];
4199
4246
  /**
4200
4247
  * Required environment variables for each provider
4201
4248
  * @deprecated Use PROVIDER_AUTH from provider-config instead
@@ -4215,7 +4262,8 @@ declare const PROVIDER_ENV_VARS: {
4215
4262
  readonly hopx: readonly ["HOPX_API_KEY"];
4216
4263
  readonly beam: readonly ["BEAM_TOKEN", "BEAM_WORKSPACE_ID"];
4217
4264
  readonly sprites: readonly ["SPRITES_TOKEN"];
4265
+ readonly freestyle: readonly ["FREESTYLE_API_KEY"];
4218
4266
  readonly 'just-bash': readonly [];
4219
4267
  };
4220
4268
 
4221
- export { type CallableCompute, type CodeResult$1 as CodeResult, CommandExitError, type CommandResult$1 as CommandResult, type CreateSandboxOptions$1 as CreateSandboxOptions, type ExplicitComputeConfig, type FileEntry, FileWatcher, GATEWAY_URL, Sandbox as GatewaySandbox, MessageType, PROVIDER_AUTH, PROVIDER_DASHBOARD_URLS, PROVIDER_ENV_MAP, PROVIDER_ENV_VARS, PROVIDER_HEADERS, PROVIDER_NAMES, PROVIDER_PRIORITY, type ProviderName, type ProviderSandboxInfo, type RunCommandOptions, type Runtime, Sandbox, type SandboxFileSystem, type SandboxInfo$1 as SandboxInfo, type Sandbox$1 as SandboxInterface, type SandboxStatus, type SetupOverlayConfig, type SetupPayload, SignalService, TerminalInstance, type WebSocketConstructor, autoConfigureCompute, buildProviderHeaders, buildSetupPayload, compute, decodeBinaryMessage, detectProvider, encodeBinaryMessage, encodeSetupPayload, getMissingEnvVars, getProviderConfigFromEnv, getProviderHeaders, isCommandExitError, isGatewayModeEnabled, isProviderAuthComplete, isValidProvider };
4269
+ export { type CallableCompute, type CodeResult$1 as CodeResult, CommandExitError, type CommandResult$1 as CommandResult, type CreateSandboxOptions$1 as CreateSandboxOptions, type ExplicitComputeConfig, type FileEntry, FileWatcher, Sandbox as GatewaySandbox, MessageType, PROVIDER_AUTH, PROVIDER_DASHBOARD_URLS, PROVIDER_ENV_MAP, PROVIDER_ENV_VARS, PROVIDER_HEADERS, PROVIDER_NAMES, PROVIDER_PRIORITY, type ProviderName, type ProviderSandboxInfo, type RunCommandOptions, type Runtime, Sandbox, type SandboxFileSystem, type SandboxInfo$1 as SandboxInfo, type Sandbox$1 as SandboxInterface, type SandboxStatus, type SetupOverlayConfig, type SetupPayload, SignalService, type Snapshot, TRIBUTARY_URL, TerminalInstance, type WebSocketConstructor, autoConfigureCompute, buildProviderHeaders, buildSetupPayload, compute, decodeBinaryMessage, detectProvider, encodeBinaryMessage, encodeSetupPayload, getMissingEnvVars, getProviderConfigFromEnv, getProviderHeaders, isCommandExitError, isGatewayModeEnabled, isProviderAuthComplete, isValidProvider };
package/dist/index.d.ts CHANGED
@@ -89,6 +89,19 @@ interface RunCommandOptions {
89
89
  timeout?: number;
90
90
  background?: boolean;
91
91
  }
92
+ /**
93
+ * Snapshot information
94
+ */
95
+ interface Snapshot {
96
+ /** Unique identifier for the snapshot */
97
+ id: string;
98
+ /** Provider hosting the snapshot */
99
+ provider: string;
100
+ /** When the snapshot was created */
101
+ createdAt: Date;
102
+ /** Additional provider-specific metadata */
103
+ metadata?: Record<string, any>;
104
+ }
92
105
  /**
93
106
  * Filesystem operations interface
94
107
  */
@@ -3833,13 +3846,14 @@ declare const PROVIDER_AUTH: {
3833
3846
  readonly daytona: readonly [readonly ["DAYTONA_API_KEY"]];
3834
3847
  readonly vercel: readonly [readonly ["VERCEL_OIDC_TOKEN"], readonly ["VERCEL_TOKEN", "VERCEL_TEAM_ID", "VERCEL_PROJECT_ID"]];
3835
3848
  readonly runloop: readonly [readonly ["RUNLOOP_API_KEY"]];
3836
- readonly cloudflare: readonly [readonly ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]];
3849
+ readonly cloudflare: readonly [readonly ["CLOUDFLARE_SANDBOX_URL", "CLOUDFLARE_SANDBOX_SECRET"], readonly ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]];
3837
3850
  readonly codesandbox: readonly [readonly ["CSB_API_KEY"]];
3838
3851
  readonly blaxel: readonly [readonly ["BL_API_KEY", "BL_WORKSPACE"]];
3839
3852
  readonly namespace: readonly [readonly ["NSC_TOKEN"], readonly ["NSC_TOKEN_FILE"]];
3840
3853
  readonly hopx: readonly [readonly ["HOPX_API_KEY"]];
3841
3854
  readonly beam: readonly [readonly ["BEAM_TOKEN", "BEAM_WORKSPACE_ID"]];
3842
3855
  readonly sprites: readonly [readonly ["SPRITES_TOKEN"]];
3856
+ readonly freestyle: readonly [readonly ["FREESTYLE_API_KEY"]];
3843
3857
  readonly 'just-bash': readonly [readonly []];
3844
3858
  };
3845
3859
  /**
@@ -3976,6 +3990,9 @@ interface ExplicitComputeConfig {
3976
3990
  sprites?: {
3977
3991
  apiKey?: string;
3978
3992
  };
3993
+ freestyle?: {
3994
+ apiKey?: string;
3995
+ };
3979
3996
  'just-bash'?: {};
3980
3997
  }
3981
3998
  /**
@@ -4101,6 +4118,36 @@ declare class ComputeManager {
4101
4118
  */
4102
4119
  extendTimeout: (sandboxId: string, options?: ExtendTimeoutOptions) => Promise<void>;
4103
4120
  };
4121
+ snapshot: {
4122
+ /**
4123
+ * Create a snapshot from a running sandbox
4124
+ *
4125
+ * @param sandboxId ID of the sandbox to snapshot
4126
+ * @param options Snapshot options (name, metadata)
4127
+ */
4128
+ create: (sandboxId: string, options?: {
4129
+ name?: string;
4130
+ metadata?: Record<string, any>;
4131
+ }) => Promise<{
4132
+ id: string;
4133
+ provider: string;
4134
+ createdAt: Date;
4135
+ metadata?: Record<string, any>;
4136
+ }>;
4137
+ /**
4138
+ * List all snapshots
4139
+ */
4140
+ list: () => Promise<Array<{
4141
+ id: string;
4142
+ provider: string;
4143
+ createdAt: Date;
4144
+ metadata?: Record<string, any>;
4145
+ }>>;
4146
+ /**
4147
+ * Delete a snapshot
4148
+ */
4149
+ delete: (snapshotId: string) => Promise<void>;
4150
+ };
4104
4151
  }
4105
4152
  /**
4106
4153
  * Callable compute interface - dual nature as both singleton and factory
@@ -4190,12 +4237,12 @@ declare function autoConfigureCompute(): GatewayConfig | null;
4190
4237
  /**
4191
4238
  * Default gateway URL for sandbox lifecycle operations
4192
4239
  */
4193
- declare const GATEWAY_URL = "https://gateway.computesdk.com";
4240
+ declare const TRIBUTARY_URL = "https://tributary.edge.computesdk.com";
4194
4241
  /**
4195
4242
  * Provider detection priority order
4196
4243
  * When multiple provider credentials are detected, use the first one in this list
4197
4244
  */
4198
- declare const PROVIDER_PRIORITY: readonly ["e2b", "railway", "render", "daytona", "modal", "runloop", "vercel", "cloudflare", "codesandbox", "blaxel", "namespace", "hopx", "beam", "sprites"];
4245
+ declare const PROVIDER_PRIORITY: readonly ["e2b", "railway", "render", "daytona", "modal", "runloop", "vercel", "cloudflare", "codesandbox", "blaxel", "namespace", "hopx", "beam", "sprites", "freestyle"];
4199
4246
  /**
4200
4247
  * Required environment variables for each provider
4201
4248
  * @deprecated Use PROVIDER_AUTH from provider-config instead
@@ -4215,7 +4262,8 @@ declare const PROVIDER_ENV_VARS: {
4215
4262
  readonly hopx: readonly ["HOPX_API_KEY"];
4216
4263
  readonly beam: readonly ["BEAM_TOKEN", "BEAM_WORKSPACE_ID"];
4217
4264
  readonly sprites: readonly ["SPRITES_TOKEN"];
4265
+ readonly freestyle: readonly ["FREESTYLE_API_KEY"];
4218
4266
  readonly 'just-bash': readonly [];
4219
4267
  };
4220
4268
 
4221
- export { type CallableCompute, type CodeResult$1 as CodeResult, CommandExitError, type CommandResult$1 as CommandResult, type CreateSandboxOptions$1 as CreateSandboxOptions, type ExplicitComputeConfig, type FileEntry, FileWatcher, GATEWAY_URL, Sandbox as GatewaySandbox, MessageType, PROVIDER_AUTH, PROVIDER_DASHBOARD_URLS, PROVIDER_ENV_MAP, PROVIDER_ENV_VARS, PROVIDER_HEADERS, PROVIDER_NAMES, PROVIDER_PRIORITY, type ProviderName, type ProviderSandboxInfo, type RunCommandOptions, type Runtime, Sandbox, type SandboxFileSystem, type SandboxInfo$1 as SandboxInfo, type Sandbox$1 as SandboxInterface, type SandboxStatus, type SetupOverlayConfig, type SetupPayload, SignalService, TerminalInstance, type WebSocketConstructor, autoConfigureCompute, buildProviderHeaders, buildSetupPayload, compute, decodeBinaryMessage, detectProvider, encodeBinaryMessage, encodeSetupPayload, getMissingEnvVars, getProviderConfigFromEnv, getProviderHeaders, isCommandExitError, isGatewayModeEnabled, isProviderAuthComplete, isValidProvider };
4269
+ export { type CallableCompute, type CodeResult$1 as CodeResult, CommandExitError, type CommandResult$1 as CommandResult, type CreateSandboxOptions$1 as CreateSandboxOptions, type ExplicitComputeConfig, type FileEntry, FileWatcher, Sandbox as GatewaySandbox, MessageType, PROVIDER_AUTH, PROVIDER_DASHBOARD_URLS, PROVIDER_ENV_MAP, PROVIDER_ENV_VARS, PROVIDER_HEADERS, PROVIDER_NAMES, PROVIDER_PRIORITY, type ProviderName, type ProviderSandboxInfo, type RunCommandOptions, type Runtime, Sandbox, type SandboxFileSystem, type SandboxInfo$1 as SandboxInfo, type Sandbox$1 as SandboxInterface, type SandboxStatus, type SetupOverlayConfig, type SetupPayload, SignalService, type Snapshot, TRIBUTARY_URL, TerminalInstance, type WebSocketConstructor, autoConfigureCompute, buildProviderHeaders, buildSetupPayload, compute, decodeBinaryMessage, detectProvider, encodeBinaryMessage, encodeSetupPayload, getMissingEnvVars, getProviderConfigFromEnv, getProviderHeaders, isCommandExitError, isGatewayModeEnabled, isProviderAuthComplete, isValidProvider };
package/dist/index.js CHANGED
@@ -22,7 +22,6 @@ var index_exports = {};
22
22
  __export(index_exports, {
23
23
  CommandExitError: () => CommandExitError,
24
24
  FileWatcher: () => FileWatcher,
25
- GATEWAY_URL: () => GATEWAY_URL,
26
25
  GatewaySandbox: () => Sandbox,
27
26
  MessageType: () => MessageType,
28
27
  PROVIDER_AUTH: () => PROVIDER_AUTH,
@@ -34,6 +33,7 @@ __export(index_exports, {
34
33
  PROVIDER_PRIORITY: () => PROVIDER_PRIORITY,
35
34
  Sandbox: () => Sandbox,
36
35
  SignalService: () => SignalService,
36
+ TRIBUTARY_URL: () => TRIBUTARY_URL,
37
37
  TerminalInstance: () => TerminalInstance,
38
38
  autoConfigureCompute: () => autoConfigureCompute,
39
39
  buildProviderHeaders: () => buildProviderHeaders,
@@ -3641,13 +3641,17 @@ var PROVIDER_AUTH = {
3641
3641
  ["VERCEL_TOKEN", "VERCEL_TEAM_ID", "VERCEL_PROJECT_ID"]
3642
3642
  ],
3643
3643
  runloop: [["RUNLOOP_API_KEY"]],
3644
- cloudflare: [["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]],
3644
+ cloudflare: [
3645
+ ["CLOUDFLARE_SANDBOX_URL", "CLOUDFLARE_SANDBOX_SECRET"],
3646
+ ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]
3647
+ ],
3645
3648
  codesandbox: [["CSB_API_KEY"]],
3646
3649
  blaxel: [["BL_API_KEY", "BL_WORKSPACE"]],
3647
3650
  namespace: [["NSC_TOKEN"], ["NSC_TOKEN_FILE"]],
3648
3651
  hopx: [["HOPX_API_KEY"]],
3649
3652
  beam: [["BEAM_TOKEN", "BEAM_WORKSPACE_ID"]],
3650
3653
  sprites: [["SPRITES_TOKEN"]],
3654
+ freestyle: [["FREESTYLE_API_KEY"]],
3651
3655
  "just-bash": [[]]
3652
3656
  };
3653
3657
  var PROVIDER_NAMES = Object.keys(PROVIDER_AUTH);
@@ -3681,6 +3685,8 @@ var PROVIDER_HEADERS = {
3681
3685
  apiKey: "X-Runloop-API-Key"
3682
3686
  },
3683
3687
  cloudflare: {
3688
+ sandboxUrl: "X-Cloudflare-Sandbox-Url",
3689
+ sandboxSecret: "X-Cloudflare-Sandbox-Secret",
3684
3690
  apiToken: "X-Cloudflare-API-Token",
3685
3691
  accountId: "X-Cloudflare-Account-Id"
3686
3692
  },
@@ -3704,6 +3710,9 @@ var PROVIDER_HEADERS = {
3704
3710
  sprites: {
3705
3711
  apiKey: "X-Sprites-Token"
3706
3712
  },
3713
+ freestyle: {
3714
+ apiKey: "X-Freestyle-API-Key"
3715
+ },
3707
3716
  "just-bash": {}
3708
3717
  };
3709
3718
  var PROVIDER_ENV_MAP = {
@@ -3736,6 +3745,8 @@ var PROVIDER_ENV_MAP = {
3736
3745
  RUNLOOP_API_KEY: "apiKey"
3737
3746
  },
3738
3747
  cloudflare: {
3748
+ CLOUDFLARE_SANDBOX_URL: "sandboxUrl",
3749
+ CLOUDFLARE_SANDBOX_SECRET: "sandboxSecret",
3739
3750
  CLOUDFLARE_API_TOKEN: "apiToken",
3740
3751
  CLOUDFLARE_ACCOUNT_ID: "accountId"
3741
3752
  },
@@ -3760,6 +3771,9 @@ var PROVIDER_ENV_MAP = {
3760
3771
  sprites: {
3761
3772
  SPRITES_TOKEN: "apiKey"
3762
3773
  },
3774
+ freestyle: {
3775
+ FREESTYLE_API_KEY: "apiKey"
3776
+ },
3763
3777
  "just-bash": {}
3764
3778
  };
3765
3779
  var PROVIDER_DASHBOARD_URLS = {
@@ -3777,6 +3791,7 @@ var PROVIDER_DASHBOARD_URLS = {
3777
3791
  hopx: "https://hopx.ai/dashboard",
3778
3792
  beam: "https://app.beam.cloud",
3779
3793
  sprites: "https://sprites.dev",
3794
+ freestyle: "https://dash.freestyle.sh",
3780
3795
  "just-bash": "https://github.com/vercel-labs/just-bash"
3781
3796
  };
3782
3797
  function isValidProvider(name) {
@@ -3834,7 +3849,7 @@ function getMissingEnvVars(provider) {
3834
3849
  }
3835
3850
 
3836
3851
  // src/constants.ts
3837
- var GATEWAY_URL = "https://gateway.computesdk.com";
3852
+ var TRIBUTARY_URL = "https://tributary.edge.computesdk.com";
3838
3853
  var PROVIDER_PRIORITY = [
3839
3854
  "e2b",
3840
3855
  "railway",
@@ -3849,7 +3864,8 @@ var PROVIDER_PRIORITY = [
3849
3864
  "namespace",
3850
3865
  "hopx",
3851
3866
  "beam",
3852
- "sprites"
3867
+ "sprites",
3868
+ "freestyle"
3853
3869
  ];
3854
3870
  var PROVIDER_ENV_VARS = {
3855
3871
  e2b: ["E2B_API_KEY"],
@@ -3866,6 +3882,7 @@ var PROVIDER_ENV_VARS = {
3866
3882
  hopx: ["HOPX_API_KEY"],
3867
3883
  beam: ["BEAM_TOKEN", "BEAM_WORKSPACE_ID"],
3868
3884
  sprites: ["SPRITES_TOKEN"],
3885
+ freestyle: ["FREESTYLE_API_KEY"],
3869
3886
  "just-bash": []
3870
3887
  };
3871
3888
 
@@ -4065,7 +4082,7 @@ Or set COMPUTESDK_PROVIDER to specify explicitly:
4065
4082
  Docs: https://computesdk.com/docs/quickstart`
4066
4083
  );
4067
4084
  }
4068
- const gatewayUrl = process.env.COMPUTESDK_GATEWAY_URL || GATEWAY_URL;
4085
+ const gatewayUrl = process.env.COMPUTESDK_TRIBUTARY_URL || TRIBUTARY_URL;
4069
4086
  const computesdkApiKey = process.env.COMPUTESDK_API_KEY;
4070
4087
  const providerHeaders = getProviderHeaders(provider);
4071
4088
  try {
@@ -4075,7 +4092,7 @@ Docs: https://computesdk.com/docs/quickstart`
4075
4092
  `Invalid gateway URL: "${gatewayUrl}"
4076
4093
 
4077
4094
  The URL must be a valid HTTP/HTTPS URL.
4078
- Check your COMPUTESDK_GATEWAY_URL environment variable.`
4095
+ Check your COMPUTESDK_TRIBUTARY_URL environment variable.`
4079
4096
  );
4080
4097
  }
4081
4098
  if (process.env.COMPUTESDK_DEBUG) {
@@ -4171,7 +4188,7 @@ Get your API key at: https://computesdk.com/dashboard`
4171
4188
  const providerHeaders = buildProviderHeaders2(config);
4172
4189
  return {
4173
4190
  apiKey: computesdkApiKey,
4174
- gatewayUrl: config.gatewayUrl || process.env.COMPUTESDK_GATEWAY_URL || GATEWAY_URL,
4191
+ gatewayUrl: config.gatewayUrl || process.env.COMPUTESDK_TRIBUTARY_URL || TRIBUTARY_URL,
4175
4192
  provider: config.provider,
4176
4193
  providerHeaders,
4177
4194
  requestTimeoutMs: config.requestTimeoutMs,
@@ -4221,7 +4238,7 @@ Troubleshooting:
4221
4238
  }
4222
4239
 
4223
4240
  // src/compute.ts
4224
- async function gatewayFetch(url, config, options = {}) {
4241
+ async function tributaryFetch(url, config, options = {}) {
4225
4242
  const timeout = config.requestTimeoutMs ?? 3e4;
4226
4243
  const controller = new AbortController();
4227
4244
  const timeoutId = setTimeout(() => controller.abort(), timeout);
@@ -4268,7 +4285,7 @@ async function waitForSandboxStatus(config, endpoint, body, options = {}) {
4268
4285
  const startTime = Date.now();
4269
4286
  let currentDelay = initialDelayMs;
4270
4287
  while (Date.now() - startTime < maxWaitMs) {
4271
- const result = await gatewayFetch(endpoint, config, {
4288
+ const result = await tributaryFetch(endpoint, config, {
4272
4289
  method: "POST",
4273
4290
  body: JSON.stringify(body)
4274
4291
  });
@@ -4319,7 +4336,7 @@ var ComputeManager = class {
4319
4336
  */
4320
4337
  create: async (options) => {
4321
4338
  const config = this.getGatewayConfig();
4322
- const result = await gatewayFetch(`${config.gatewayUrl}/v1/sandboxes`, config, {
4339
+ const result = await tributaryFetch(`${config.gatewayUrl}/v1/sandboxes`, config, {
4323
4340
  method: "POST",
4324
4341
  body: JSON.stringify(options || {})
4325
4342
  });
@@ -4341,7 +4358,7 @@ var ComputeManager = class {
4341
4358
  },
4342
4359
  WebSocket: config.WebSocket || globalThis.WebSocket,
4343
4360
  destroyHandler: async () => {
4344
- await gatewayFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}`, config, {
4361
+ await tributaryFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}`, config, {
4345
4362
  method: "DELETE"
4346
4363
  });
4347
4364
  }
@@ -4354,7 +4371,7 @@ var ComputeManager = class {
4354
4371
  */
4355
4372
  getById: async (sandboxId) => {
4356
4373
  const config = this.getGatewayConfig();
4357
- const result = await gatewayFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}`, config);
4374
+ const result = await tributaryFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}`, config);
4358
4375
  if (!result.success || !result.data) {
4359
4376
  return null;
4360
4377
  }
@@ -4367,7 +4384,7 @@ var ComputeManager = class {
4367
4384
  metadata,
4368
4385
  WebSocket: config.WebSocket || globalThis.WebSocket,
4369
4386
  destroyHandler: async () => {
4370
- await gatewayFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}`, config, {
4387
+ await tributaryFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}`, config, {
4371
4388
  method: "DELETE"
4372
4389
  });
4373
4390
  }
@@ -4388,7 +4405,7 @@ var ComputeManager = class {
4388
4405
  */
4389
4406
  destroy: async (sandboxId) => {
4390
4407
  const config = this.getGatewayConfig();
4391
- await gatewayFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}`, config, {
4408
+ await tributaryFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}`, config, {
4392
4409
  method: "DELETE"
4393
4410
  });
4394
4411
  },
@@ -4423,7 +4440,7 @@ var ComputeManager = class {
4423
4440
  },
4424
4441
  WebSocket: config.WebSocket || globalThis.WebSocket,
4425
4442
  destroyHandler: async () => {
4426
- await gatewayFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}`, config, {
4443
+ await tributaryFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}`, config, {
4427
4444
  method: "DELETE"
4428
4445
  });
4429
4446
  }
@@ -4460,7 +4477,7 @@ var ComputeManager = class {
4460
4477
  },
4461
4478
  WebSocket: config.WebSocket || globalThis.WebSocket,
4462
4479
  destroyHandler: async () => {
4463
- await gatewayFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}`, config, {
4480
+ await tributaryFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}`, config, {
4464
4481
  method: "DELETE"
4465
4482
  });
4466
4483
  }
@@ -4474,12 +4491,57 @@ var ComputeManager = class {
4474
4491
  extendTimeout: async (sandboxId, options) => {
4475
4492
  const config = this.getGatewayConfig();
4476
4493
  const duration = options?.duration ?? 9e5;
4477
- await gatewayFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}/extend`, config, {
4494
+ await tributaryFetch(`${config.gatewayUrl}/v1/sandboxes/${sandboxId}/extend`, config, {
4478
4495
  method: "POST",
4479
4496
  body: JSON.stringify({ duration })
4480
4497
  });
4481
4498
  }
4482
4499
  };
4500
+ this.snapshot = {
4501
+ /**
4502
+ * Create a snapshot from a running sandbox
4503
+ *
4504
+ * @param sandboxId ID of the sandbox to snapshot
4505
+ * @param options Snapshot options (name, metadata)
4506
+ */
4507
+ create: async (sandboxId, options) => {
4508
+ const config = this.getGatewayConfig();
4509
+ const result = await tributaryFetch(`${config.gatewayUrl}/v1/snapshots`, config, {
4510
+ method: "POST",
4511
+ body: JSON.stringify({ sandboxId, ...options })
4512
+ });
4513
+ if (!result.success || !result.data) {
4514
+ throw new Error(`Gateway returned invalid response`);
4515
+ }
4516
+ return {
4517
+ ...result.data,
4518
+ createdAt: new Date(result.data.createdAt)
4519
+ };
4520
+ },
4521
+ /**
4522
+ * List all snapshots
4523
+ */
4524
+ list: async () => {
4525
+ const config = this.getGatewayConfig();
4526
+ const result = await tributaryFetch(`${config.gatewayUrl}/v1/snapshots`, config);
4527
+ if (!result.success || !result.data) {
4528
+ return [];
4529
+ }
4530
+ return result.data.map((s) => ({
4531
+ ...s,
4532
+ createdAt: new Date(s.createdAt)
4533
+ }));
4534
+ },
4535
+ /**
4536
+ * Delete a snapshot
4537
+ */
4538
+ delete: async (snapshotId) => {
4539
+ const config = this.getGatewayConfig();
4540
+ await tributaryFetch(`${config.gatewayUrl}/v1/snapshots/${snapshotId}`, config, {
4541
+ method: "DELETE"
4542
+ });
4543
+ }
4544
+ };
4483
4545
  }
4484
4546
  /**
4485
4547
  * Lazy auto-configure from environment if not explicitly configured
@@ -4561,7 +4623,6 @@ var compute = new Proxy(
4561
4623
  0 && (module.exports = {
4562
4624
  CommandExitError,
4563
4625
  FileWatcher,
4564
- GATEWAY_URL,
4565
4626
  GatewaySandbox,
4566
4627
  MessageType,
4567
4628
  PROVIDER_AUTH,
@@ -4573,6 +4634,7 @@ var compute = new Proxy(
4573
4634
  PROVIDER_PRIORITY,
4574
4635
  Sandbox,
4575
4636
  SignalService,
4637
+ TRIBUTARY_URL,
4576
4638
  TerminalInstance,
4577
4639
  autoConfigureCompute,
4578
4640
  buildProviderHeaders,