@computesdk/workbench 22.0.0 → 24.0.0

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.
@@ -39,8 +39,6 @@ function createState() {
39
39
  currentSandbox: null,
40
40
  sandboxCreatedAt: null,
41
41
  availableProviders: [],
42
- useDirectMode: false,
43
- // Default to gateway mode
44
42
  verbose: false,
45
43
  // Enabled automatically for local provider
46
44
  compute: null
@@ -119,29 +117,16 @@ __export(output_exports, {
119
117
  showInfo: () => showInfo,
120
118
  showWelcome: () => showWelcome
121
119
  });
122
- function showWelcome(availableProviders, currentProvider, useDirectMode, localDaemonRunning = false) {
120
+ function showWelcome(availableProviders, currentProvider) {
123
121
  console.log(c.bold(c.cyan("\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557")));
124
122
  console.log(c.bold(c.cyan("\u2551 ComputeSDK Workbench \u2551")));
125
123
  console.log(c.bold(c.cyan("\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D\n")));
126
124
  console.log(c.dim("Prompt shows connection status: > (disconnected) or provider:sandbox> (connected)\n"));
127
- if (localDaemonRunning) {
128
- console.log(c.green("Local daemon detected - auto-connecting...\n"));
129
- }
130
125
  if (availableProviders.length > 0) {
131
- const backendProviders = availableProviders.filter((p) => p !== "gateway");
132
- console.log(`Providers available: ${backendProviders.join(", ")}`);
126
+ console.log(`Providers available: ${availableProviders.join(", ")}`);
133
127
  if (currentProvider) {
134
- if (currentProvider === "local") {
135
- console.log(`Current provider: ${c.green("local")} (local daemon)
136
- `);
137
- } else if (useDirectMode) {
138
- console.log(`Current provider: ${c.green(currentProvider)} (direct mode)
128
+ console.log(`Current provider: ${c.green(currentProvider)}
139
129
  `);
140
- } else {
141
- const backendProvider = currentProvider === "gateway" ? backendProviders[0] || "auto" : currentProvider;
142
- console.log(`Current provider: ${c.green(backendProvider)} (via gateway)
143
- `);
144
- }
145
130
  } else {
146
131
  console.log(`
147
132
  ${c.dim('Tip: Use "provider <name>" to select a provider')}
@@ -167,8 +152,6 @@ function showInfo(state) {
167
152
  console.log(` Sandbox ID: ${c.cyan(state.currentSandbox.sandboxId)}`);
168
153
  }
169
154
  console.log(` Provider: ${c.green(state.currentProvider || "unknown")}`);
170
- const modeLabel = state.useDirectMode ? "direct \u{1F517}" : "gateway \u{1F310}";
171
- console.log(` Mode: ${c.blue(modeLabel)}`);
172
155
  console.log(` Created: ${state.sandboxCreatedAt?.toLocaleString() || "unknown"}`);
173
156
  console.log(` Uptime: ${formatUptime(state)}`);
174
157
  console.log("");
@@ -192,33 +175,14 @@ function showHelp() {
192
175
  ${c.bold("ComputeSDK Workbench Commands")}
193
176
 
194
177
  ${c.bold("Provider Management:")}
195
- ${c.cyan("provider <name>")} Switch to provider via gateway (default)
178
+ ${c.cyan("provider <name>")} Switch to provider
196
179
  ${c.dim("Example: provider e2b")}
197
- ${c.cyan("provider direct <name>")} Connect directly to provider
198
- ${c.dim("Example: provider direct e2b")}
199
180
  ${c.cyan("providers")} List all providers with status
200
- ${c.cyan("mode <gateway|direct>")} Toggle default mode for next sandbox
201
-
202
- ${c.bold("Provider Modes:")}
203
- ${c.bold("Gateway (default)")}: Routes through ComputeSDK API, zero-config
204
- \u2022 Requires: COMPUTESDK_API_KEY + provider credentials
205
- \u2022 Usage: ${c.cyan("provider e2b")}
206
-
207
- ${c.bold("Direct")}: Connects directly to provider, requires packages
208
- \u2022 Requires: Provider package installed + credentials
209
- \u2022 Usage: ${c.cyan("provider direct e2b")}
210
181
 
211
182
  ${c.bold("Sandbox Management:")}
212
183
  ${c.cyan("restart")} Restart current sandbox
213
184
  ${c.cyan("destroy")} Destroy current sandbox
214
185
  ${c.cyan("info")} Show sandbox info (provider, uptime)
215
- ${c.cyan("connect <url> [token]")} Connect to sandbox via URL
216
-
217
- ${c.bold("Local Daemon:")}
218
- ${c.cyan("provider local")} Connect to local daemon's main sandbox
219
- ${c.cyan("provider local list")} List local sandboxes
220
- ${c.cyan("provider local <subdomain>")} Connect to specific local sandbox
221
- ${c.dim("Example: provider local separate-snail-qkktux")}
222
186
 
223
187
  ${c.bold("Environment:")}
224
188
  ${c.cyan("env")} Show environment/credentials status
@@ -253,53 +217,14 @@ ${c.bold("Running Commands:")}
253
217
  ${c.cyan('filesystem.exists("/path")')}
254
218
  ${c.cyan('filesystem.remove("/file")')}
255
219
 
256
- ${c.dim("Named Sandboxes (gateway mode only):")}
257
- ${c.cyan("create()")} ${c.dim("// Create & switch to new sandbox")}
258
- ${c.cyan('create({ namespace: "h" })')} ${c.dim("// Create with namespace & switch")}
259
- ${c.cyan('findOrCreate({ name: "my-app" })')} ${c.dim("// Find or create & switch")}
260
- ${c.cyan('find({ name: "my-app" })')} ${c.dim("// Find existing & switch")}
261
-
262
- ${c.dim("Note: Prompts before switching if you already have an active sandbox")}
263
-
264
- ${c.dim("Child Sandboxes (gateway mode only):")}
265
- ${c.cyan("child.create()")} ${c.dim("// Create child sandbox")}
266
- ${c.cyan("child.list()")} ${c.dim("// List all children")}
267
- ${c.cyan('child.retrieve("sandbox-id")')} ${c.dim("// Get child info")}
268
- ${c.cyan('child.destroy("sandbox-id")')} ${c.dim("// Delete child")}
269
-
270
220
  ${c.dim("Sandbox Methods:")}
271
221
  ${c.cyan("getUrl({ port: 3000 })")} ${c.dim("// Get public URL")}
272
- ${c.cyan(`runCode("console.log('hi')", "node")`)}
222
+ ${c.cyan('runCommand("echo hi")')} ${c.dim("// Execute command")}
273
223
  ${c.cyan("sandboxInfo()")} ${c.dim("// Get sandbox details")}
274
224
  ${c.cyan("ready()")} ${c.dim("// Get readiness status")}
275
225
  ${c.cyan("getInstance()")} ${c.dim("// Get native instance")}
276
-
277
- ${c.dim("Terminal (PTY & Exec):")}
278
- ${c.cyan("terminal.create({ pty: true })")} ${c.dim("// Create PTY terminal")}
279
- ${c.cyan("terminal.create({ pty: false })")} ${c.dim("// Create exec terminal")}
280
- ${c.cyan("terminal.list()")} ${c.dim("// List all terminals")}
281
- ${c.cyan("terminal.retrieve(id)")} ${c.dim("// Get terminal by ID")}
282
- ${c.cyan("terminal.destroy(id)")} ${c.dim("// Close terminal by ID")}
283
-
284
- ${c.dim("PTY Terminal:")}
285
- ${c.cyan("term = terminal.create({ pty: true })")}
286
- ${c.cyan('term.on("output", (data) => console.log(data))')}
287
- ${c.cyan('term.write("echo hello\\n")')}
288
- ${c.cyan("term.destroy()")}
289
-
290
- ${c.dim("Exec Terminal:")}
291
- ${c.cyan("exec = terminal.create({ pty: false })")}
292
- ${c.cyan('cmd = exec.command.run("ls -la")')}
293
- ${c.cyan("cmd.stdout")} ${c.dim("// view output")}
294
-
226
+
295
227
  ${c.dim('Note: No need to use "await" - promises are auto-awaited!')}
296
-
297
- ${c.dim("Compute CLI:")}
298
- ${c.cyan("compute.isSetup()")} ${c.dim("// Check if daemon is running")}
299
- ${c.cyan("compute.setup()")} ${c.dim("// Install + start daemon")}
300
- ${c.cyan("compute.install()")} ${c.dim("// Install compute CLI")}
301
- ${c.cyan("compute.start()")} ${c.dim("// Start daemon")}
302
- ${c.cyan("compute.health()")} ${c.dim("// Check daemon health")}
303
228
 
304
229
  ${c.bold("Shell Commands:")}
305
230
  Use ${c.cyan("$")} prefix to run any shell command directly:
@@ -494,14 +419,11 @@ function showEnv() {
494
419
  console.log(c.dim("Tip: Set credentials in your .env file"));
495
420
  console.log("");
496
421
  }
497
- function autoDetectProvider(forceGatewayMode = false) {
422
+ function autoDetectProvider() {
498
423
  const explicit = process.env.COMPUTESDK_PROVIDER?.toLowerCase();
499
424
  if (explicit && isValidProvider(explicit) && isProviderReady(explicit)) {
500
425
  return explicit;
501
426
  }
502
- if (forceGatewayMode) {
503
- return isProviderReady("gateway") ? "gateway" : null;
504
- }
505
427
  for (const provider of PROVIDER_NAMES) {
506
428
  if (isProviderReady(provider)) {
507
429
  return provider;
@@ -538,8 +460,6 @@ Available: ${PROVIDER_NAMES.join(", ")}`;
538
460
  async function loadProvider(providerName) {
539
461
  try {
540
462
  switch (providerName) {
541
- case "gateway":
542
- return await import("computesdk");
543
463
  case "e2b":
544
464
  return await import("@computesdk/e2b");
545
465
  case "railway":
@@ -566,6 +486,8 @@ async function loadProvider(providerName) {
566
486
  return await import("@computesdk/namespace");
567
487
  case "hopx":
568
488
  return await import("@computesdk/hopx");
489
+ case "declaw":
490
+ return await import("@computesdk/declaw");
569
491
  case "sprites":
570
492
  return await import("@computesdk/sprites");
571
493
  case "agentuity":
@@ -580,20 +502,12 @@ async function loadProvider(providerName) {
580
502
  throw new Error(`Unknown provider: ${providerName}`);
581
503
  }
582
504
  } catch (error) {
583
- if (providerName === "gateway") {
584
- throw new Error(`Failed to load gateway provider from computesdk package.`);
585
- }
586
505
  throw new Error(
587
506
  `Failed to load provider ${providerName}. Make sure to install it: npm install @computesdk/${providerName}`
588
507
  );
589
508
  }
590
509
  }
591
510
  function getProviderConfig(providerName) {
592
- if (providerName === "gateway") {
593
- const config2 = {};
594
- if (process.env.COMPUTESDK_API_KEY) config2.apiKey = process.env.COMPUTESDK_API_KEY;
595
- return config2;
596
- }
597
511
  return getProviderConfigFromEnv(providerName);
598
512
  }
599
513
  var SHARED_PROVIDER_NAMES, SHARED_PROVIDER_AUTH, PROVIDER_ENV_MAP, PROVIDER_NAMES, PROVIDER_AUTH;
@@ -616,6 +530,7 @@ var init_providers = __esm({
616
530
  "blaxel",
617
531
  "namespace",
618
532
  "hopx",
533
+ "declaw",
619
534
  "sprites",
620
535
  "agentuity",
621
536
  "freestyle",
@@ -642,6 +557,7 @@ var init_providers = __esm({
642
557
  blaxel: [["BL_API_KEY", "BL_WORKSPACE"]],
643
558
  namespace: [["NSC_TOKEN"], ["NSC_TOKEN_FILE"]],
644
559
  hopx: [["HOPX_API_KEY"]],
560
+ declaw: [["DECLAW_API_KEY"]],
645
561
  sprites: [["SPRITES_TOKEN"]],
646
562
  agentuity: [["AGENTUITY_SDK_KEY"]],
647
563
  freestyle: [["FREESTYLE_API_KEY"]],
@@ -673,20 +589,15 @@ var init_providers = __esm({
673
589
  blaxel: { apiKey: "BL_API_KEY", workspace: "BL_WORKSPACE" },
674
590
  namespace: { token: "NSC_TOKEN", tokenFile: "NSC_TOKEN_FILE" },
675
591
  hopx: { apiKey: "HOPX_API_KEY" },
592
+ declaw: { apiKey: "DECLAW_API_KEY" },
676
593
  sprites: { token: "SPRITES_TOKEN" },
677
594
  agentuity: { sdkKey: "AGENTUITY_SDK_KEY" },
678
595
  freestyle: { apiKey: "FREESTYLE_API_KEY" },
679
596
  "secure-exec": {},
680
597
  upstash: { apiKey: "UPSTASH_BOX_API_KEY" }
681
598
  };
682
- PROVIDER_NAMES = [
683
- "gateway",
684
- ...SHARED_PROVIDER_NAMES
685
- ];
686
- PROVIDER_AUTH = {
687
- gateway: [["COMPUTESDK_API_KEY"]],
688
- ...SHARED_PROVIDER_AUTH
689
- };
599
+ PROVIDER_NAMES = SHARED_PROVIDER_NAMES;
600
+ PROVIDER_AUTH = SHARED_PROVIDER_AUTH;
690
601
  }
691
602
  });
692
603
 
@@ -695,24 +606,17 @@ var commands_exports = {};
695
606
  __export(commands_exports, {
696
607
  cleanupOnExit: () => cleanupOnExit,
697
608
  confirmSandboxSwitch: () => confirmSandboxSwitch,
698
- connectToLocal: () => connectToLocal,
699
- connectToSandbox: () => connectToSandbox,
700
609
  createSandbox: () => createSandbox,
701
610
  defineProviderCommand: () => defineProviderCommand,
702
611
  destroySandbox: () => destroySandbox,
703
612
  ensureSandbox: () => ensureSandbox,
704
613
  getComputeInstance: () => getComputeInstance,
705
- isLocalDaemonRunning: () => isLocalDaemonRunning,
706
- listLocalSandboxes: () => listLocalSandboxes,
707
614
  restartSandbox: () => restartSandbox,
708
615
  runCommand: () => runCommand,
709
- showMode: () => showMode,
710
616
  showVerbose: () => showVerbose,
711
617
  switchProvider: () => switchProvider,
712
- toggleMode: () => toggleMode,
713
618
  toggleVerbose: () => toggleVerbose
714
619
  });
715
- import { createCompute } from "@computesdk/provider";
716
620
  import { escapeArgs } from "@computesdk/cmd";
717
621
  async function confirm(question, defaultYes = false, _state) {
718
622
  const promptSuffix = defaultYes ? "(Y/n)" : "(y/N)";
@@ -777,12 +681,10 @@ async function getComputeInstance(state) {
777
681
  if (state.compute) {
778
682
  return state.compute;
779
683
  }
780
- const providerName = state.currentProvider || autoDetectProvider(false);
781
- const useDirect = state.useDirectMode;
684
+ const providerName = state.currentProvider || autoDetectProvider();
782
685
  if (!providerName) {
783
686
  throw new Error("No provider configured.");
784
687
  }
785
- let compute2;
786
688
  const exportName = providerName.replace(/-([a-z])/g, (_, c2) => c2.toUpperCase());
787
689
  const providerModule = await loadProvider(providerName);
788
690
  const providerFactory = providerModule[exportName] ?? providerModule[providerName];
@@ -791,46 +693,25 @@ async function getComputeInstance(state) {
791
693
  }
792
694
  const config2 = getProviderConfig(providerName);
793
695
  const providerInstance = providerFactory(config2);
794
- if (useDirect) {
795
- compute2 = createCompute({
796
- defaultProvider: providerInstance
797
- });
798
- } else {
799
- const { compute: directCompute } = await import("computesdk");
800
- compute2 = directCompute({
801
- provider: providerInstance
802
- });
803
- }
696
+ const { compute: directCompute } = await import("computesdk");
697
+ const compute2 = directCompute({
698
+ provider: providerInstance
699
+ });
804
700
  state.compute = compute2;
805
701
  return compute2;
806
702
  }
807
703
  async function createSandbox(state) {
808
- const providerName = state.currentProvider || autoDetectProvider(false);
809
- const useDirect = state.useDirectMode;
704
+ const providerName = state.currentProvider || autoDetectProvider();
810
705
  if (!providerName) {
811
706
  logError('No provider configured. Run "env" to see setup instructions.');
812
707
  throw new Error("No provider available");
813
708
  }
814
- let modeLabel;
815
- let actualProviderName;
816
- if (useDirect) {
817
- modeLabel = `${providerName} (direct)`;
818
- actualProviderName = providerName;
819
- if (!isProviderReady(providerName)) {
820
- logError(`Provider ${providerName} is not fully configured for direct mode.`);
821
- console.log(getProviderSetupHelp(providerName));
822
- throw new Error("Provider not ready");
823
- }
824
- } else {
825
- modeLabel = `${providerName} (via gateway)`;
826
- actualProviderName = "gateway";
827
- if (!isProviderReady("gateway")) {
828
- logError("Gateway mode requires COMPUTESDK_API_KEY");
829
- console.log(getProviderSetupHelp("gateway"));
830
- throw new Error("Gateway not ready");
831
- }
709
+ if (!isProviderReady(providerName)) {
710
+ logError(`Provider ${providerName} is not fully configured.`);
711
+ console.log(getProviderSetupHelp(providerName));
712
+ throw new Error("Provider not ready");
832
713
  }
833
- const spinner = new Spinner(`Creating sandbox with ${modeLabel}...`).start();
714
+ const spinner = new Spinner(`Creating sandbox with ${providerName}...`).start();
834
715
  const startTime = Date.now();
835
716
  try {
836
717
  const compute2 = await getComputeInstance(state);
@@ -930,122 +811,48 @@ function isStaleConnectionError(error) {
930
811
  ];
931
812
  return stalePhrases.some((phrase) => message.includes(phrase));
932
813
  }
933
- async function switchProvider(state, mode, providerName) {
934
- if (mode === "local") {
935
- if (providerName === "list") {
936
- await listLocalSandboxes();
937
- return;
938
- }
939
- await connectToLocal(state, providerName);
814
+ async function switchProvider(state, name) {
815
+ if (!isValidProvider(name)) {
816
+ logError(`Unknown provider: ${name}`);
817
+ console.log(`Available providers: ${PROVIDER_NAMES.join(", ")}`);
940
818
  return;
941
819
  }
942
- let useDirect = false;
943
- let actualProvider = mode;
944
- if (mode === "direct") {
945
- if (!providerName) {
946
- logError("Usage: provider direct <name>");
947
- console.log("Example: provider direct e2b");
948
- return;
949
- }
950
- useDirect = true;
951
- actualProvider = providerName;
952
- } else if (mode === "gateway") {
953
- if (!providerName) {
954
- logError("Usage: provider gateway <name>");
955
- console.log("Example: provider gateway e2b");
956
- return;
957
- }
958
- useDirect = false;
959
- actualProvider = providerName;
960
- }
961
- if (actualProvider === "gateway") {
962
- actualProvider = autoDetectProvider(false) || "e2b";
963
- }
964
- if (!isValidProvider(actualProvider)) {
965
- logError(`Unknown provider: ${actualProvider}`);
966
- console.log(`Available providers: ${PROVIDER_NAMES.filter((p) => p !== "gateway").join(", ")}, local`);
967
- return;
968
- }
969
- if (!useDirect && !isProviderReady("gateway")) {
970
- logError("Gateway mode requires COMPUTESDK_API_KEY");
971
- console.log(getProviderSetupHelp("gateway"));
972
- return;
973
- }
974
- if (useDirect && !isProviderReady(actualProvider)) {
975
- logError(`Provider ${actualProvider} is not fully configured for direct mode.`);
976
- console.log(getProviderSetupHelp(actualProvider));
820
+ if (!isProviderReady(name)) {
821
+ logError(`Provider ${name} is not fully configured.`);
822
+ console.log(getProviderSetupHelp(name));
977
823
  return;
978
824
  }
979
825
  if (hasSandbox(state)) {
980
826
  const shouldDestroy = await confirm("Destroy current sandbox?", false, state);
981
827
  if (shouldDestroy) {
982
828
  await destroySandbox(state);
983
- state.currentProvider = actualProvider;
984
- state.useDirectMode = useDirect;
829
+ state.currentProvider = name;
985
830
  state.compute = null;
986
- const modeStr = useDirect ? `${actualProvider} (direct)` : `${actualProvider} (via gateway)`;
987
- logSuccess(`Switched to ${modeStr}`);
831
+ logSuccess(`Switched to ${name}`);
988
832
  } else {
989
833
  logWarning("Keeping current sandbox. Provider remains unchanged.");
990
834
  }
991
835
  } else {
992
- state.currentProvider = actualProvider;
993
- state.useDirectMode = useDirect;
836
+ state.currentProvider = name;
994
837
  state.compute = null;
995
- const modeStr = useDirect ? `${actualProvider} (direct)` : `${actualProvider} (via gateway)`;
996
- logSuccess(`Switched to ${modeStr}`);
838
+ logSuccess(`Switched to ${name}`);
997
839
  }
998
840
  }
999
841
  function defineProviderCommand(state) {
1000
- return async function provider(mode, providerName) {
1001
- if (!mode) {
842
+ return async function provider(name) {
843
+ if (!name) {
1002
844
  if (state.currentProvider) {
1003
- const modeStr = state.useDirectMode ? "direct" : state.currentProvider === "local" ? "local daemon" : "via gateway";
1004
845
  console.log(`
1005
- Current provider: ${c.green(state.currentProvider)} (${modeStr})
846
+ Current provider: ${c.green(state.currentProvider)}
1006
847
  `);
1007
848
  } else {
1008
849
  console.log(c.yellow("\nNo provider selected\n"));
1009
850
  }
1010
851
  return;
1011
852
  }
1012
- await switchProvider(state, mode, providerName);
853
+ await switchProvider(state, name);
1013
854
  };
1014
855
  }
1015
- async function toggleMode(state, mode) {
1016
- const newMode = mode || (state.useDirectMode ? "gateway" : "direct");
1017
- if (newMode === "direct") {
1018
- state.useDirectMode = true;
1019
- logSuccess("Switched to direct mode \u{1F517}");
1020
- console.log(c.dim("Next sandbox will use direct provider packages\n"));
1021
- if (hasSandbox(state) && !state.useDirectMode) {
1022
- console.log(c.yellow("Current sandbox is in gateway mode."));
1023
- console.log(c.dim('Run "restart" to switch to direct mode\n'));
1024
- }
1025
- } else {
1026
- state.useDirectMode = false;
1027
- logSuccess("Switched to gateway mode \u{1F310}");
1028
- console.log(c.dim("Next sandbox will use gateway (requires COMPUTESDK_API_KEY)\n"));
1029
- if (hasSandbox(state) && state.useDirectMode) {
1030
- console.log(c.yellow("Current sandbox is in direct mode."));
1031
- console.log(c.dim('Run "restart" to switch to gateway mode\n'));
1032
- }
1033
- }
1034
- }
1035
- function showMode(state) {
1036
- const mode = state.useDirectMode ? "direct" : "gateway";
1037
- const icon = mode === "gateway" ? "\u{1F310}" : "\u{1F517}";
1038
- console.log(`
1039
- Current mode: ${c.green(mode)} ${icon}`);
1040
- if (mode === "gateway") {
1041
- console.log(c.dim("Routes through ComputeSDK API (requires COMPUTESDK_API_KEY)"));
1042
- } else {
1043
- console.log(c.dim("Direct connection to providers (requires provider packages)"));
1044
- }
1045
- console.log(`
1046
- Switch with: ${c.cyan("provider e2b")} (gateway) or ${c.cyan("provider direct e2b")} (direct)
1047
- `);
1048
- }
1049
856
  function toggleVerbose(state) {
1050
857
  state.verbose = !state.verbose;
1051
858
  if (state.verbose) {
@@ -1072,182 +879,6 @@ Verbose mode: ${status}`);
1072
879
  Toggle with: ${c.cyan("verbose")}
1073
880
  `);
1074
881
  }
1075
- async function connectToSandbox(state, sandboxUrl, token) {
1076
- if (!sandboxUrl) {
1077
- logError("Usage: connect <sandbox_url> [token]");
1078
- console.log("Example: connect https://sandbox-123.localhost:8080");
1079
- console.log("Example: connect https://sandbox-123.localhost:8080 your_access_token");
1080
- return;
1081
- }
1082
- const cleanUrl = sandboxUrl.replace(/\/$/, "");
1083
- if (hasSandbox(state)) {
1084
- const shouldDisconnect = await confirm("Disconnect from current sandbox?", false, state);
1085
- if (!shouldDisconnect) {
1086
- logWarning("Keeping current sandbox. Connection cancelled.");
1087
- return;
1088
- }
1089
- clearSandbox(state);
1090
- }
1091
- const spinner = new Spinner(`Connecting to ${cleanUrl}...`).start();
1092
- const startTime = Date.now();
1093
- try {
1094
- const { Sandbox } = await import("computesdk");
1095
- let WebSocket;
1096
- try {
1097
- const wsModule = await import("ws");
1098
- WebSocket = wsModule.default;
1099
- } catch {
1100
- logError('Failed to import "ws" module. Please install it: pnpm add ws');
1101
- throw new Error('Missing "ws" dependency');
1102
- }
1103
- const sandbox = new Sandbox({
1104
- sandboxUrl: cleanUrl,
1105
- sandboxId: "",
1106
- // Will be populated when we get info
1107
- provider: "connected",
1108
- // Mark as directly connected
1109
- token,
1110
- // Optional access token
1111
- WebSocket
1112
- });
1113
- const info = await sandbox.getInfo();
1114
- const duration = Date.now() - startTime;
1115
- setSandbox(state, sandbox, "connected");
1116
- spinner.succeed(`Connected to sandbox ${c.dim(`(${formatDuration(duration)})`)}`);
1117
- console.log(c.dim(`Provider: ${info.provider || "unknown"}`));
1118
- console.log(c.dim(`Sandbox ID: ${info.id || "unknown"}`));
1119
- } catch (error) {
1120
- const duration = Date.now() - startTime;
1121
- spinner.fail(`Failed to connect ${c.dim(`(${formatDuration(duration)})`)}`);
1122
- if (error instanceof Error) {
1123
- logError(`Error: ${error.message}`);
1124
- if (error.stack) {
1125
- console.log(c.dim(error.stack));
1126
- }
1127
- }
1128
- throw error;
1129
- }
1130
- }
1131
- async function readLocalConfig() {
1132
- const os2 = await import("os");
1133
- const fs2 = await import("fs/promises");
1134
- const path4 = await import("path");
1135
- const configPath = path4.join(os2.homedir(), ".compute", "config.json");
1136
- try {
1137
- const content = await fs2.readFile(configPath, "utf-8");
1138
- return JSON.parse(content);
1139
- } catch {
1140
- return null;
1141
- }
1142
- }
1143
- async function isLocalDaemonRunning() {
1144
- const os2 = await import("os");
1145
- const fs2 = await import("fs/promises");
1146
- const path4 = await import("path");
1147
- const pidPath = path4.join(os2.homedir(), ".compute", "compute.pid");
1148
- try {
1149
- const pidContent = await fs2.readFile(pidPath, "utf-8");
1150
- const pid = parseInt(pidContent.trim(), 10);
1151
- process.kill(pid, 0);
1152
- return true;
1153
- } catch {
1154
- return false;
1155
- }
1156
- }
1157
- async function listLocalSandboxes() {
1158
- const config2 = await readLocalConfig();
1159
- if (!config2) {
1160
- logError("No local daemon config found at ~/.compute/config.json");
1161
- console.log(c.dim('Run "compute start" to start the local daemon'));
1162
- return;
1163
- }
1164
- const isRunning = await isLocalDaemonRunning();
1165
- console.log("");
1166
- console.log(c.bold("Local Daemon Status:"), isRunning ? c.green("Running") : c.red("Stopped"));
1167
- console.log("");
1168
- if (!config2.sandboxes || config2.sandboxes.length === 0) {
1169
- console.log(c.dim("No sandboxes found"));
1170
- return;
1171
- }
1172
- console.log(c.bold("Sandboxes:"));
1173
- for (const sandbox of config2.sandboxes) {
1174
- const isMain = sandbox.subdomain === config2.main_subdomain;
1175
- const mainLabel = isMain ? c.green(" (main)") : "";
1176
- console.log(` ${c.cyan(sandbox.subdomain)}${mainLabel}`);
1177
- console.log(c.dim(` https://${sandbox.subdomain}.sandbox.computesdk.com`));
1178
- }
1179
- console.log("");
1180
- console.log(c.dim(`Connect with: local ${config2.main_subdomain}`));
1181
- console.log("");
1182
- }
1183
- async function connectToLocal(state, subdomain) {
1184
- const config2 = await readLocalConfig();
1185
- if (!config2) {
1186
- logError("No local daemon config found at ~/.compute/config.json");
1187
- console.log(c.dim('Run "compute start" to start the local daemon'));
1188
- return;
1189
- }
1190
- const isRunning = await isLocalDaemonRunning();
1191
- if (!isRunning) {
1192
- logError("Local daemon is not running");
1193
- console.log(c.dim('Run "compute start" to start the local daemon'));
1194
- return;
1195
- }
1196
- const targetSubdomain = subdomain || config2.main_subdomain;
1197
- const sandbox = config2.sandboxes.find((s) => s.subdomain === targetSubdomain);
1198
- if (!sandbox) {
1199
- logError(`Sandbox "${targetSubdomain}" not found`);
1200
- console.log(c.dim('Run "local list" to see available sandboxes'));
1201
- return;
1202
- }
1203
- const sandboxUrl = `https://${targetSubdomain}.sandbox.computesdk.com`;
1204
- const token = config2.access_token;
1205
- if (hasSandbox(state)) {
1206
- const shouldDisconnect = await confirm("Disconnect from current sandbox?", false, state);
1207
- if (!shouldDisconnect) {
1208
- logWarning("Keeping current sandbox. Connection cancelled.");
1209
- return;
1210
- }
1211
- clearSandbox(state);
1212
- }
1213
- const spinner = new Spinner(`Connecting to local sandbox ${targetSubdomain}...`).start();
1214
- const startTime = Date.now();
1215
- try {
1216
- const { Sandbox } = await import("computesdk");
1217
- let WebSocket;
1218
- try {
1219
- const wsModule = await import("ws");
1220
- WebSocket = wsModule.default;
1221
- } catch {
1222
- spinner.fail('Failed to import "ws" module');
1223
- logError("Please install ws: pnpm add ws");
1224
- throw new Error('Missing "ws" dependency');
1225
- }
1226
- const sandboxInstance = new Sandbox({
1227
- sandboxUrl,
1228
- sandboxId: targetSubdomain,
1229
- provider: "local",
1230
- token,
1231
- WebSocket
1232
- });
1233
- const info = await sandboxInstance.getInfo();
1234
- const duration = Date.now() - startTime;
1235
- setSandbox(state, sandboxInstance, "local");
1236
- state.verbose = true;
1237
- process.env.COMPUTESDK_DEBUG = "1";
1238
- spinner.succeed(`Connected to local sandbox ${c.dim(`(${formatDuration(duration)})`)}`);
1239
- console.log(c.dim(`Sandbox: ${targetSubdomain}`));
1240
- console.log(c.dim(`URL: ${sandboxUrl}`));
1241
- console.log(c.dim(`Verbose mode: enabled (for debugging)`));
1242
- } catch (error) {
1243
- const duration = Date.now() - startTime;
1244
- spinner.fail(`Failed to connect ${c.dim(`(${formatDuration(duration)})`)}`);
1245
- if (error instanceof Error) {
1246
- logError(`Error: ${error.message}`);
1247
- }
1248
- throw error;
1249
- }
1250
- }
1251
882
  async function cleanupOnExit(state, replServer) {
1252
883
  if (!hasSandbox(state)) {
1253
884
  return;
@@ -1256,10 +887,6 @@ async function cleanupOnExit(state, replServer) {
1256
887
  replServer.pause();
1257
888
  }
1258
889
  console.log("");
1259
- if (state.currentProvider === "connected") {
1260
- logWarning("Disconnecting from external sandbox (not destroying).");
1261
- return;
1262
- }
1263
890
  const shouldDestroy = await confirm("Destroy active sandbox?", false, state);
1264
891
  if (shouldDestroy) {
1265
892
  await destroySandbox(state);
@@ -1302,6 +929,18 @@ function isCommand(value) {
1302
929
  // src/cli/repl.ts
1303
930
  import * as path2 from "path";
1304
931
  import * as os from "os";
932
+ function getSandboxMetadata(sandbox) {
933
+ const instance = sandbox.getInstance?.();
934
+ if (typeof instance !== "object" || instance === null || !("config" in instance)) {
935
+ return {};
936
+ }
937
+ const config2 = instance.config;
938
+ if (typeof config2 !== "object" || config2 === null || !("metadata" in config2)) {
939
+ return {};
940
+ }
941
+ const metadata = config2.metadata;
942
+ return typeof metadata === "object" && metadata !== null ? metadata : {};
943
+ }
1305
944
  function createREPL(state) {
1306
945
  const replServer = repl.start({
1307
946
  prompt: "> ",
@@ -1399,22 +1038,12 @@ function injectCmdContext(replServer) {
1399
1038
  function injectWorkbenchCommands(replServer, state) {
1400
1039
  replServer.context.provider = defineProviderCommand(state);
1401
1040
  replServer.context.providers = () => showProviders();
1402
- replServer.context.mode = async (modeName) => {
1403
- if (!modeName) {
1404
- showMode(state);
1405
- } else {
1406
- await toggleMode(state, modeName);
1407
- }
1408
- };
1409
1041
  replServer.context.restart = async () => {
1410
1042
  await restartSandbox(state);
1411
1043
  };
1412
1044
  replServer.context.destroy = async () => {
1413
1045
  await destroySandbox(state);
1414
1046
  };
1415
- replServer.context.connect = async (url, token) => {
1416
- await connectToSandbox(state, url, token);
1417
- };
1418
1047
  replServer.context.info = () => showInfo(state);
1419
1048
  replServer.context.verbose = () => {
1420
1049
  toggleVerbose(state);
@@ -1451,13 +1080,6 @@ function injectWorkbenchCommands(replServer, state) {
1451
1080
  }
1452
1081
  return sandboxReady.ready();
1453
1082
  };
1454
- replServer.context.runCode = async (code, runtime) => {
1455
- const sandbox = state.currentSandbox;
1456
- if (!sandbox) {
1457
- throw new Error("No active sandbox. Run a command to auto-create one.");
1458
- }
1459
- return sandbox.runCode(code, runtime);
1460
- };
1461
1083
  replServer.context.runCommand = async (command, options) => {
1462
1084
  const sandbox = state.currentSandbox;
1463
1085
  if (!sandbox) {
@@ -1476,7 +1098,7 @@ function injectWorkbenchCommands(replServer, state) {
1476
1098
  return {
1477
1099
  sandboxId: sandbox2.sandboxId,
1478
1100
  provider: sandbox2.provider,
1479
- metadata: sandbox2.getInstance?.()?.config?.metadata || {}
1101
+ metadata: getSandboxMetadata(sandbox2)
1480
1102
  };
1481
1103
  }
1482
1104
  const compute2 = await getComputeInstance2(state);
@@ -1486,70 +1108,7 @@ function injectWorkbenchCommands(replServer, state) {
1486
1108
  return {
1487
1109
  sandboxId: sandbox.sandboxId,
1488
1110
  provider: sandbox.provider,
1489
- metadata: sandbox.getInstance?.()?.config?.metadata || {}
1490
- };
1491
- };
1492
- replServer.context.findOrCreate = async (options) => {
1493
- if (state.useDirectMode) {
1494
- throw new Error('Named sandboxes (findOrCreate) are only available in gateway mode. Use "mode gateway" to switch.');
1495
- }
1496
- const { getComputeInstance: getComputeInstance2, confirmSandboxSwitch: confirmSandboxSwitch2 } = await Promise.resolve().then(() => (init_commands(), commands_exports));
1497
- const { setSandbox: setSandbox2 } = await Promise.resolve().then(() => (init_state(), state_exports));
1498
- const { logSuccess: logSuccess2 } = await Promise.resolve().then(() => (init_output(), output_exports));
1499
- const shouldSwitch = await confirmSandboxSwitch2(state);
1500
- if (!shouldSwitch) {
1501
- const compute3 = await getComputeInstance2(state);
1502
- const sandbox2 = await compute3.sandbox.findOrCreate(options);
1503
- return {
1504
- sandboxId: sandbox2.sandboxId,
1505
- provider: sandbox2.provider,
1506
- name: options.name,
1507
- namespace: options.namespace || "default",
1508
- metadata: sandbox2.getInstance().config.metadata || {}
1509
- };
1510
- }
1511
- const compute2 = await getComputeInstance2(state);
1512
- const sandbox = await compute2.sandbox.findOrCreate(options);
1513
- setSandbox2(state, sandbox, sandbox.provider);
1514
- logSuccess2(`Switched to sandbox ${sandbox.sandboxId}`);
1515
- return {
1516
- sandboxId: sandbox.sandboxId,
1517
- provider: sandbox.provider,
1518
- name: options.name,
1519
- namespace: options.namespace || "default",
1520
- metadata: sandbox.getInstance().config.metadata || {}
1521
- };
1522
- };
1523
- replServer.context.find = async (options) => {
1524
- if (state.useDirectMode) {
1525
- throw new Error('Named sandboxes (find) are only available in gateway mode. Use "mode gateway" to switch.');
1526
- }
1527
- const { getComputeInstance: getComputeInstance2, confirmSandboxSwitch: confirmSandboxSwitch2 } = await Promise.resolve().then(() => (init_commands(), commands_exports));
1528
- const { setSandbox: setSandbox2 } = await Promise.resolve().then(() => (init_state(), state_exports));
1529
- const { logSuccess: logSuccess2 } = await Promise.resolve().then(() => (init_output(), output_exports));
1530
- const compute2 = await getComputeInstance2(state);
1531
- const sandbox = await compute2.sandbox.find(options);
1532
- if (!sandbox) {
1533
- return null;
1534
- }
1535
- const shouldSwitch = await confirmSandboxSwitch2(state);
1536
- if (!shouldSwitch) {
1537
- return {
1538
- sandboxId: sandbox.sandboxId,
1539
- provider: sandbox.provider,
1540
- name: options.name,
1541
- namespace: options.namespace || "default",
1542
- metadata: sandbox.getInstance().config.metadata || {}
1543
- };
1544
- }
1545
- setSandbox2(state, sandbox, sandbox.provider);
1546
- logSuccess2(`Switched to sandbox ${sandbox.sandboxId}`);
1547
- return {
1548
- sandboxId: sandbox.sandboxId,
1549
- provider: sandbox.provider,
1550
- name: options.name,
1551
- namespace: options.namespace || "default",
1552
- metadata: sandbox.getInstance().config.metadata || {}
1111
+ metadata: getSandboxMetadata(sandbox)
1553
1112
  };
1554
1113
  };
1555
1114
  replServer.context.filesystem = {
@@ -1608,160 +1167,6 @@ function injectWorkbenchCommands(replServer, state) {
1608
1167
  };
1609
1168
  }
1610
1169
  };
1611
- replServer.context.child = {
1612
- get create() {
1613
- return async () => {
1614
- if (state.useDirectMode) {
1615
- throw new Error('Child sandboxes are only available in gateway mode. Use "mode gateway" to switch.');
1616
- }
1617
- const sandbox = state.currentSandbox;
1618
- if (!sandbox) {
1619
- throw new Error("No active sandbox. Run a command to auto-create one.");
1620
- }
1621
- const instance = sandbox.getInstance();
1622
- return instance.child.create();
1623
- };
1624
- },
1625
- get list() {
1626
- return async () => {
1627
- if (state.useDirectMode) {
1628
- throw new Error('Child sandboxes are only available in gateway mode. Use "mode gateway" to switch.');
1629
- }
1630
- const sandbox = state.currentSandbox;
1631
- if (!sandbox) {
1632
- throw new Error("No active sandbox. Run a command to auto-create one.");
1633
- }
1634
- const instance = sandbox.getInstance();
1635
- return instance.child.list();
1636
- };
1637
- },
1638
- get retrieve() {
1639
- return async (subdomain) => {
1640
- if (state.useDirectMode) {
1641
- throw new Error('Child sandboxes are only available in gateway mode. Use "mode gateway" to switch.');
1642
- }
1643
- const sandbox = state.currentSandbox;
1644
- if (!sandbox) {
1645
- throw new Error("No active sandbox. Run a command to auto-create one.");
1646
- }
1647
- const instance = sandbox.getInstance();
1648
- return instance.child.retrieve(subdomain);
1649
- };
1650
- },
1651
- get destroy() {
1652
- return async (subdomain, options) => {
1653
- if (state.useDirectMode) {
1654
- throw new Error('Child sandboxes are only available in gateway mode. Use "mode gateway" to switch.');
1655
- }
1656
- const sandbox = state.currentSandbox;
1657
- if (!sandbox) {
1658
- throw new Error("No active sandbox. Run a command to auto-create one.");
1659
- }
1660
- const instance = sandbox.getInstance();
1661
- return instance.child.destroy(subdomain, options);
1662
- };
1663
- }
1664
- };
1665
- replServer.context.server = {
1666
- get start() {
1667
- return async (options) => {
1668
- const sandbox = state.currentSandbox;
1669
- if (!sandbox) {
1670
- throw new Error("No active sandbox. Run a command to auto-create one.");
1671
- }
1672
- return sandbox.server.start(options);
1673
- };
1674
- },
1675
- get list() {
1676
- return async () => {
1677
- const sandbox = state.currentSandbox;
1678
- if (!sandbox) {
1679
- throw new Error("No active sandbox. Run a command to auto-create one.");
1680
- }
1681
- return sandbox.server.list();
1682
- };
1683
- },
1684
- get retrieve() {
1685
- return async (slug) => {
1686
- const sandbox = state.currentSandbox;
1687
- if (!sandbox) {
1688
- throw new Error("No active sandbox. Run a command to auto-create one.");
1689
- }
1690
- return sandbox.server.retrieve(slug);
1691
- };
1692
- },
1693
- get stop() {
1694
- return async (slug) => {
1695
- const sandbox = state.currentSandbox;
1696
- if (!sandbox) {
1697
- throw new Error("No active sandbox. Run a command to auto-create one.");
1698
- }
1699
- return sandbox.server.stop(slug);
1700
- };
1701
- },
1702
- get restart() {
1703
- return async (slug) => {
1704
- const sandbox = state.currentSandbox;
1705
- if (!sandbox) {
1706
- throw new Error("No active sandbox. Run a command to auto-create one.");
1707
- }
1708
- return sandbox.server.restart(slug);
1709
- };
1710
- }
1711
- };
1712
- replServer.context.terminal = {
1713
- get create() {
1714
- return async (options) => {
1715
- const sandbox = state.currentSandbox;
1716
- if (!sandbox) {
1717
- throw new Error("No active sandbox. Run a command to auto-create one.");
1718
- }
1719
- const term = await sandbox.terminal.create(options);
1720
- if (state.verbose) {
1721
- if (term._ws) {
1722
- term._ws.config.debug = true;
1723
- }
1724
- term.on("output", (data) => {
1725
- console.log("[terminal:output]", JSON.stringify(data));
1726
- });
1727
- term.on("error", (error) => {
1728
- console.log("[terminal:error]", error);
1729
- });
1730
- term.on("destroyed", () => {
1731
- console.log("[terminal:destroyed]");
1732
- });
1733
- }
1734
- return term;
1735
- };
1736
- },
1737
- get list() {
1738
- return async () => {
1739
- const sandbox = state.currentSandbox;
1740
- if (!sandbox) {
1741
- throw new Error("No active sandbox. Run a command to auto-create one.");
1742
- }
1743
- return sandbox.terminal.list();
1744
- };
1745
- },
1746
- get retrieve() {
1747
- return async (id) => {
1748
- const sandbox = state.currentSandbox;
1749
- if (!sandbox) {
1750
- throw new Error("No active sandbox. Run a command to auto-create one.");
1751
- }
1752
- return sandbox.terminal.retrieve(id);
1753
- };
1754
- },
1755
- get destroy() {
1756
- return async (id) => {
1757
- const sandbox = state.currentSandbox;
1758
- if (!sandbox) {
1759
- throw new Error("No active sandbox. Run a command to auto-create one.");
1760
- }
1761
- return sandbox.terminal.destroy(id);
1762
- };
1763
- }
1764
- };
1765
1170
  replServer.context.getInstance = () => {
1766
1171
  const sandbox = state.currentSandbox;
1767
1172
  if (!sandbox) {
@@ -1772,36 +1177,13 @@ function injectWorkbenchCommands(replServer, state) {
1772
1177
  }
1773
1178
  function setupSmartEvaluator(replServer, state) {
1774
1179
  const originalEval = replServer.eval;
1775
- const workbenchCommands = /* @__PURE__ */ new Set(["help", "providers", "info", "env", "restart", "destroy", "mode", "verbose", "sandboxInfo", "connect"]);
1180
+ const workbenchCommands = /* @__PURE__ */ new Set(["help", "providers", "info", "env", "restart", "destroy", "verbose", "sandboxInfo"]);
1776
1181
  replServer.eval = function(cmd2, context, filename, callback) {
1777
1182
  const trimmedCmd = cmd2.trim();
1778
- const providerLocalMatch = trimmedCmd.match(/^provider\s+local(?:\s+(\S+))?$/);
1779
- if (providerLocalMatch) {
1780
- const arg = providerLocalMatch[1];
1781
- const providerCmd = arg ? `await provider('local', '${arg}')` : `await provider('local')`;
1782
- originalEval.call(this, providerCmd, context, filename, callback);
1783
- return;
1784
- }
1785
- const providerMatch = trimmedCmd.match(/^provider(?:\s+(direct|gateway))?\s+([\w-]+)$/);
1183
+ const providerMatch = trimmedCmd.match(/^provider\s+([\w-]+)$/);
1786
1184
  if (providerMatch) {
1787
- const mode = providerMatch[1] || null;
1788
- const providerName = providerMatch[2];
1789
- const providerCmd = mode ? `await provider('${mode}', '${providerName}')` : `await provider('${providerName}')`;
1790
- originalEval.call(this, providerCmd, context, filename, callback);
1791
- return;
1792
- }
1793
- const providerOnlyMatch = trimmedCmd.match(/^provider\s+(direct|gateway)$/);
1794
- if (providerOnlyMatch) {
1795
- const mode = providerOnlyMatch[1];
1796
- const providerCmd = `await provider('${mode}')`;
1797
- originalEval.call(this, providerCmd, context, filename, callback);
1798
- return;
1799
- }
1800
- const modeMatch = trimmedCmd.match(/^mode\s+(gateway|direct)$/);
1801
- if (modeMatch) {
1802
- const modeName = modeMatch[1];
1803
- const modeCmd = `await mode('${modeName}')`;
1804
- originalEval.call(this, modeCmd, context, filename, callback);
1185
+ const providerName = providerMatch[1];
1186
+ originalEval.call(this, `await provider('${providerName}')`, context, filename, callback);
1805
1187
  return;
1806
1188
  }
1807
1189
  const dollarMatch = trimmedCmd.match(/^\$(.+)$/);
@@ -1854,14 +1236,10 @@ function setupSmartEvaluator(replServer, state) {
1854
1236
  function setupAutocomplete(replServer, state) {
1855
1237
  const originalCompleter = replServer.completer;
1856
1238
  const workbenchCommands = {
1857
- "provider": [...PROVIDER_NAMES, "local"],
1858
- // Include 'local' as a provider option
1859
- "mode": ["gateway", "direct"],
1239
+ "provider": [...PROVIDER_NAMES],
1860
1240
  "providers": [],
1861
1241
  "restart": [],
1862
1242
  "destroy": [],
1863
- "connect": [],
1864
- // Connect takes a URL argument
1865
1243
  "info": [],
1866
1244
  "env": [],
1867
1245
  "help": [],
@@ -1870,7 +1248,6 @@ function setupAutocomplete(replServer, state) {
1870
1248
  ".exit": [],
1871
1249
  // Sandbox methods
1872
1250
  "getUrl": [],
1873
- "runCode": [],
1874
1251
  "sandboxInfo": [],
1875
1252
  "getInstance": []
1876
1253
  // Filesystem is an object, so it gets dot notation autocomplete automatically
@@ -1960,39 +1337,10 @@ init_providers();
1960
1337
  init_commands();
1961
1338
  async function startWorkbench() {
1962
1339
  const state = createState();
1963
- const localDaemonRunning = await isLocalDaemonRunning();
1964
1340
  state.availableProviders = getAvailableProviders();
1965
- if (localDaemonRunning) {
1966
- state.availableProviders.push("local");
1967
- }
1968
- const detectedProvider = autoDetectProvider();
1969
- if (localDaemonRunning) {
1970
- state.currentProvider = "local";
1971
- state.useDirectMode = false;
1972
- state.verbose = true;
1973
- process.env.COMPUTESDK_DEBUG = "1";
1974
- } else {
1975
- const hasGateway = state.availableProviders.includes("gateway");
1976
- const backendProviders = state.availableProviders.filter((p) => p !== "gateway" && p !== "local");
1977
- if (hasGateway && backendProviders.length > 0) {
1978
- state.currentProvider = backendProviders[0] || "e2b";
1979
- state.useDirectMode = false;
1980
- } else if (backendProviders.length > 0) {
1981
- state.currentProvider = backendProviders[0];
1982
- state.useDirectMode = true;
1983
- } else {
1984
- state.currentProvider = detectedProvider;
1985
- state.useDirectMode = false;
1986
- }
1987
- }
1988
- showWelcome(state.availableProviders, state.currentProvider, state.useDirectMode, localDaemonRunning);
1341
+ state.currentProvider = state.availableProviders[0] ?? null;
1342
+ showWelcome(state.availableProviders, state.currentProvider);
1989
1343
  const replServer = createREPL(state);
1990
- if (localDaemonRunning) {
1991
- try {
1992
- await connectToLocal(state);
1993
- } catch {
1994
- }
1995
- }
1996
1344
  replServer.on("exit", async () => {
1997
1345
  await cleanupOnExit(state, replServer);
1998
1346
  process.exit(0);