@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.
package/dist/index.js CHANGED
@@ -34,8 +34,6 @@ function createState() {
34
34
  currentSandbox: null,
35
35
  sandboxCreatedAt: null,
36
36
  availableProviders: [],
37
- useDirectMode: false,
38
- // Default to gateway mode
39
37
  verbose: false,
40
38
  // Enabled automatically for local provider
41
39
  compute: null
@@ -114,29 +112,16 @@ __export(output_exports, {
114
112
  showInfo: () => showInfo,
115
113
  showWelcome: () => showWelcome
116
114
  });
117
- function showWelcome(availableProviders, currentProvider, useDirectMode, localDaemonRunning = false) {
115
+ function showWelcome(availableProviders, currentProvider) {
118
116
  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")));
119
117
  console.log(c.bold(c.cyan("\u2551 ComputeSDK Workbench \u2551")));
120
118
  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")));
121
119
  console.log(c.dim("Prompt shows connection status: > (disconnected) or provider:sandbox> (connected)\n"));
122
- if (localDaemonRunning) {
123
- console.log(c.green("Local daemon detected - auto-connecting...\n"));
124
- }
125
120
  if (availableProviders.length > 0) {
126
- const backendProviders = availableProviders.filter((p) => p !== "gateway");
127
- console.log(`Providers available: ${backendProviders.join(", ")}`);
121
+ console.log(`Providers available: ${availableProviders.join(", ")}`);
128
122
  if (currentProvider) {
129
- if (currentProvider === "local") {
130
- console.log(`Current provider: ${c.green("local")} (local daemon)
131
- `);
132
- } else if (useDirectMode) {
133
- console.log(`Current provider: ${c.green(currentProvider)} (direct mode)
123
+ console.log(`Current provider: ${c.green(currentProvider)}
134
124
  `);
135
- } else {
136
- const backendProvider = currentProvider === "gateway" ? backendProviders[0] || "auto" : currentProvider;
137
- console.log(`Current provider: ${c.green(backendProvider)} (via gateway)
138
- `);
139
- }
140
125
  } else {
141
126
  console.log(`
142
127
  ${c.dim('Tip: Use "provider <name>" to select a provider')}
@@ -162,8 +147,6 @@ function showInfo(state) {
162
147
  console.log(` Sandbox ID: ${c.cyan(state.currentSandbox.sandboxId)}`);
163
148
  }
164
149
  console.log(` Provider: ${c.green(state.currentProvider || "unknown")}`);
165
- const modeLabel = state.useDirectMode ? "direct \u{1F517}" : "gateway \u{1F310}";
166
- console.log(` Mode: ${c.blue(modeLabel)}`);
167
150
  console.log(` Created: ${state.sandboxCreatedAt?.toLocaleString() || "unknown"}`);
168
151
  console.log(` Uptime: ${formatUptime(state)}`);
169
152
  console.log("");
@@ -187,33 +170,14 @@ function showHelp() {
187
170
  ${c.bold("ComputeSDK Workbench Commands")}
188
171
 
189
172
  ${c.bold("Provider Management:")}
190
- ${c.cyan("provider <name>")} Switch to provider via gateway (default)
173
+ ${c.cyan("provider <name>")} Switch to provider
191
174
  ${c.dim("Example: provider e2b")}
192
- ${c.cyan("provider direct <name>")} Connect directly to provider
193
- ${c.dim("Example: provider direct e2b")}
194
175
  ${c.cyan("providers")} List all providers with status
195
- ${c.cyan("mode <gateway|direct>")} Toggle default mode for next sandbox
196
-
197
- ${c.bold("Provider Modes:")}
198
- ${c.bold("Gateway (default)")}: Routes through ComputeSDK API, zero-config
199
- \u2022 Requires: COMPUTESDK_API_KEY + provider credentials
200
- \u2022 Usage: ${c.cyan("provider e2b")}
201
-
202
- ${c.bold("Direct")}: Connects directly to provider, requires packages
203
- \u2022 Requires: Provider package installed + credentials
204
- \u2022 Usage: ${c.cyan("provider direct e2b")}
205
176
 
206
177
  ${c.bold("Sandbox Management:")}
207
178
  ${c.cyan("restart")} Restart current sandbox
208
179
  ${c.cyan("destroy")} Destroy current sandbox
209
180
  ${c.cyan("info")} Show sandbox info (provider, uptime)
210
- ${c.cyan("connect <url> [token]")} Connect to sandbox via URL
211
-
212
- ${c.bold("Local Daemon:")}
213
- ${c.cyan("provider local")} Connect to local daemon's main sandbox
214
- ${c.cyan("provider local list")} List local sandboxes
215
- ${c.cyan("provider local <subdomain>")} Connect to specific local sandbox
216
- ${c.dim("Example: provider local separate-snail-qkktux")}
217
181
 
218
182
  ${c.bold("Environment:")}
219
183
  ${c.cyan("env")} Show environment/credentials status
@@ -248,53 +212,14 @@ ${c.bold("Running Commands:")}
248
212
  ${c.cyan('filesystem.exists("/path")')}
249
213
  ${c.cyan('filesystem.remove("/file")')}
250
214
 
251
- ${c.dim("Named Sandboxes (gateway mode only):")}
252
- ${c.cyan("create()")} ${c.dim("// Create & switch to new sandbox")}
253
- ${c.cyan('create({ namespace: "h" })')} ${c.dim("// Create with namespace & switch")}
254
- ${c.cyan('findOrCreate({ name: "my-app" })')} ${c.dim("// Find or create & switch")}
255
- ${c.cyan('find({ name: "my-app" })')} ${c.dim("// Find existing & switch")}
256
-
257
- ${c.dim("Note: Prompts before switching if you already have an active sandbox")}
258
-
259
- ${c.dim("Child Sandboxes (gateway mode only):")}
260
- ${c.cyan("child.create()")} ${c.dim("// Create child sandbox")}
261
- ${c.cyan("child.list()")} ${c.dim("// List all children")}
262
- ${c.cyan('child.retrieve("sandbox-id")')} ${c.dim("// Get child info")}
263
- ${c.cyan('child.destroy("sandbox-id")')} ${c.dim("// Delete child")}
264
-
265
215
  ${c.dim("Sandbox Methods:")}
266
216
  ${c.cyan("getUrl({ port: 3000 })")} ${c.dim("// Get public URL")}
267
- ${c.cyan(`runCode("console.log('hi')", "node")`)}
217
+ ${c.cyan('runCommand("echo hi")')} ${c.dim("// Execute command")}
268
218
  ${c.cyan("sandboxInfo()")} ${c.dim("// Get sandbox details")}
269
219
  ${c.cyan("ready()")} ${c.dim("// Get readiness status")}
270
220
  ${c.cyan("getInstance()")} ${c.dim("// Get native instance")}
271
-
272
- ${c.dim("Terminal (PTY & Exec):")}
273
- ${c.cyan("terminal.create({ pty: true })")} ${c.dim("// Create PTY terminal")}
274
- ${c.cyan("terminal.create({ pty: false })")} ${c.dim("// Create exec terminal")}
275
- ${c.cyan("terminal.list()")} ${c.dim("// List all terminals")}
276
- ${c.cyan("terminal.retrieve(id)")} ${c.dim("// Get terminal by ID")}
277
- ${c.cyan("terminal.destroy(id)")} ${c.dim("// Close terminal by ID")}
278
-
279
- ${c.dim("PTY Terminal:")}
280
- ${c.cyan("term = terminal.create({ pty: true })")}
281
- ${c.cyan('term.on("output", (data) => console.log(data))')}
282
- ${c.cyan('term.write("echo hello\\n")')}
283
- ${c.cyan("term.destroy()")}
284
-
285
- ${c.dim("Exec Terminal:")}
286
- ${c.cyan("exec = terminal.create({ pty: false })")}
287
- ${c.cyan('cmd = exec.command.run("ls -la")')}
288
- ${c.cyan("cmd.stdout")} ${c.dim("// view output")}
289
-
221
+
290
222
  ${c.dim('Note: No need to use "await" - promises are auto-awaited!')}
291
-
292
- ${c.dim("Compute CLI:")}
293
- ${c.cyan("compute.isSetup()")} ${c.dim("// Check if daemon is running")}
294
- ${c.cyan("compute.setup()")} ${c.dim("// Install + start daemon")}
295
- ${c.cyan("compute.install()")} ${c.dim("// Install compute CLI")}
296
- ${c.cyan("compute.start()")} ${c.dim("// Start daemon")}
297
- ${c.cyan("compute.health()")} ${c.dim("// Check daemon health")}
298
223
 
299
224
  ${c.bold("Shell Commands:")}
300
225
  Use ${c.cyan("$")} prefix to run any shell command directly:
@@ -489,14 +414,11 @@ function showEnv() {
489
414
  console.log(c.dim("Tip: Set credentials in your .env file"));
490
415
  console.log("");
491
416
  }
492
- function autoDetectProvider(forceGatewayMode = false) {
417
+ function autoDetectProvider() {
493
418
  const explicit = process.env.COMPUTESDK_PROVIDER?.toLowerCase();
494
419
  if (explicit && isValidProvider(explicit) && isProviderReady(explicit)) {
495
420
  return explicit;
496
421
  }
497
- if (forceGatewayMode) {
498
- return isProviderReady("gateway") ? "gateway" : null;
499
- }
500
422
  for (const provider of PROVIDER_NAMES) {
501
423
  if (isProviderReady(provider)) {
502
424
  return provider;
@@ -533,8 +455,6 @@ Available: ${PROVIDER_NAMES.join(", ")}`;
533
455
  async function loadProvider(providerName) {
534
456
  try {
535
457
  switch (providerName) {
536
- case "gateway":
537
- return await import("computesdk");
538
458
  case "e2b":
539
459
  return await import("@computesdk/e2b");
540
460
  case "railway":
@@ -561,6 +481,8 @@ async function loadProvider(providerName) {
561
481
  return await import("@computesdk/namespace");
562
482
  case "hopx":
563
483
  return await import("@computesdk/hopx");
484
+ case "declaw":
485
+ return await import("@computesdk/declaw");
564
486
  case "sprites":
565
487
  return await import("@computesdk/sprites");
566
488
  case "agentuity":
@@ -575,20 +497,12 @@ async function loadProvider(providerName) {
575
497
  throw new Error(`Unknown provider: ${providerName}`);
576
498
  }
577
499
  } catch (error) {
578
- if (providerName === "gateway") {
579
- throw new Error(`Failed to load gateway provider from computesdk package.`);
580
- }
581
500
  throw new Error(
582
501
  `Failed to load provider ${providerName}. Make sure to install it: npm install @computesdk/${providerName}`
583
502
  );
584
503
  }
585
504
  }
586
505
  function getProviderConfig(providerName) {
587
- if (providerName === "gateway") {
588
- const config = {};
589
- if (process.env.COMPUTESDK_API_KEY) config.apiKey = process.env.COMPUTESDK_API_KEY;
590
- return config;
591
- }
592
506
  return getProviderConfigFromEnv(providerName);
593
507
  }
594
508
  var SHARED_PROVIDER_NAMES, SHARED_PROVIDER_AUTH, PROVIDER_ENV_MAP, PROVIDER_NAMES, PROVIDER_AUTH;
@@ -611,6 +525,7 @@ var init_providers = __esm({
611
525
  "blaxel",
612
526
  "namespace",
613
527
  "hopx",
528
+ "declaw",
614
529
  "sprites",
615
530
  "agentuity",
616
531
  "freestyle",
@@ -637,6 +552,7 @@ var init_providers = __esm({
637
552
  blaxel: [["BL_API_KEY", "BL_WORKSPACE"]],
638
553
  namespace: [["NSC_TOKEN"], ["NSC_TOKEN_FILE"]],
639
554
  hopx: [["HOPX_API_KEY"]],
555
+ declaw: [["DECLAW_API_KEY"]],
640
556
  sprites: [["SPRITES_TOKEN"]],
641
557
  agentuity: [["AGENTUITY_SDK_KEY"]],
642
558
  freestyle: [["FREESTYLE_API_KEY"]],
@@ -668,20 +584,15 @@ var init_providers = __esm({
668
584
  blaxel: { apiKey: "BL_API_KEY", workspace: "BL_WORKSPACE" },
669
585
  namespace: { token: "NSC_TOKEN", tokenFile: "NSC_TOKEN_FILE" },
670
586
  hopx: { apiKey: "HOPX_API_KEY" },
587
+ declaw: { apiKey: "DECLAW_API_KEY" },
671
588
  sprites: { token: "SPRITES_TOKEN" },
672
589
  agentuity: { sdkKey: "AGENTUITY_SDK_KEY" },
673
590
  freestyle: { apiKey: "FREESTYLE_API_KEY" },
674
591
  "secure-exec": {},
675
592
  upstash: { apiKey: "UPSTASH_BOX_API_KEY" }
676
593
  };
677
- PROVIDER_NAMES = [
678
- "gateway",
679
- ...SHARED_PROVIDER_NAMES
680
- ];
681
- PROVIDER_AUTH = {
682
- gateway: [["COMPUTESDK_API_KEY"]],
683
- ...SHARED_PROVIDER_AUTH
684
- };
594
+ PROVIDER_NAMES = SHARED_PROVIDER_NAMES;
595
+ PROVIDER_AUTH = SHARED_PROVIDER_AUTH;
685
596
  }
686
597
  });
687
598
 
@@ -690,24 +601,17 @@ var commands_exports = {};
690
601
  __export(commands_exports, {
691
602
  cleanupOnExit: () => cleanupOnExit,
692
603
  confirmSandboxSwitch: () => confirmSandboxSwitch,
693
- connectToLocal: () => connectToLocal,
694
- connectToSandbox: () => connectToSandbox,
695
604
  createSandbox: () => createSandbox,
696
605
  defineProviderCommand: () => defineProviderCommand,
697
606
  destroySandbox: () => destroySandbox,
698
607
  ensureSandbox: () => ensureSandbox,
699
608
  getComputeInstance: () => getComputeInstance,
700
- isLocalDaemonRunning: () => isLocalDaemonRunning,
701
- listLocalSandboxes: () => listLocalSandboxes,
702
609
  restartSandbox: () => restartSandbox,
703
610
  runCommand: () => runCommand,
704
- showMode: () => showMode,
705
611
  showVerbose: () => showVerbose,
706
612
  switchProvider: () => switchProvider,
707
- toggleMode: () => toggleMode,
708
613
  toggleVerbose: () => toggleVerbose
709
614
  });
710
- import { createCompute } from "@computesdk/provider";
711
615
  import { escapeArgs } from "@computesdk/cmd";
712
616
  async function confirm(question, defaultYes = false, _state) {
713
617
  const promptSuffix = defaultYes ? "(Y/n)" : "(y/N)";
@@ -772,12 +676,10 @@ async function getComputeInstance(state) {
772
676
  if (state.compute) {
773
677
  return state.compute;
774
678
  }
775
- const providerName = state.currentProvider || autoDetectProvider(false);
776
- const useDirect = state.useDirectMode;
679
+ const providerName = state.currentProvider || autoDetectProvider();
777
680
  if (!providerName) {
778
681
  throw new Error("No provider configured.");
779
682
  }
780
- let compute2;
781
683
  const exportName = providerName.replace(/-([a-z])/g, (_, c2) => c2.toUpperCase());
782
684
  const providerModule = await loadProvider(providerName);
783
685
  const providerFactory = providerModule[exportName] ?? providerModule[providerName];
@@ -786,46 +688,25 @@ async function getComputeInstance(state) {
786
688
  }
787
689
  const config = getProviderConfig(providerName);
788
690
  const providerInstance = providerFactory(config);
789
- if (useDirect) {
790
- compute2 = createCompute({
791
- defaultProvider: providerInstance
792
- });
793
- } else {
794
- const { compute: directCompute } = await import("computesdk");
795
- compute2 = directCompute({
796
- provider: providerInstance
797
- });
798
- }
691
+ const { compute: directCompute } = await import("computesdk");
692
+ const compute2 = directCompute({
693
+ provider: providerInstance
694
+ });
799
695
  state.compute = compute2;
800
696
  return compute2;
801
697
  }
802
698
  async function createSandbox(state) {
803
- const providerName = state.currentProvider || autoDetectProvider(false);
804
- const useDirect = state.useDirectMode;
699
+ const providerName = state.currentProvider || autoDetectProvider();
805
700
  if (!providerName) {
806
701
  logError('No provider configured. Run "env" to see setup instructions.');
807
702
  throw new Error("No provider available");
808
703
  }
809
- let modeLabel;
810
- let actualProviderName;
811
- if (useDirect) {
812
- modeLabel = `${providerName} (direct)`;
813
- actualProviderName = providerName;
814
- if (!isProviderReady(providerName)) {
815
- logError(`Provider ${providerName} is not fully configured for direct mode.`);
816
- console.log(getProviderSetupHelp(providerName));
817
- throw new Error("Provider not ready");
818
- }
819
- } else {
820
- modeLabel = `${providerName} (via gateway)`;
821
- actualProviderName = "gateway";
822
- if (!isProviderReady("gateway")) {
823
- logError("Gateway mode requires COMPUTESDK_API_KEY");
824
- console.log(getProviderSetupHelp("gateway"));
825
- throw new Error("Gateway not ready");
826
- }
704
+ if (!isProviderReady(providerName)) {
705
+ logError(`Provider ${providerName} is not fully configured.`);
706
+ console.log(getProviderSetupHelp(providerName));
707
+ throw new Error("Provider not ready");
827
708
  }
828
- const spinner = new Spinner(`Creating sandbox with ${modeLabel}...`).start();
709
+ const spinner = new Spinner(`Creating sandbox with ${providerName}...`).start();
829
710
  const startTime = Date.now();
830
711
  try {
831
712
  const compute2 = await getComputeInstance(state);
@@ -925,122 +806,48 @@ function isStaleConnectionError(error) {
925
806
  ];
926
807
  return stalePhrases.some((phrase) => message.includes(phrase));
927
808
  }
928
- async function switchProvider(state, mode, providerName) {
929
- if (mode === "local") {
930
- if (providerName === "list") {
931
- await listLocalSandboxes();
932
- return;
933
- }
934
- await connectToLocal(state, providerName);
809
+ async function switchProvider(state, name) {
810
+ if (!isValidProvider(name)) {
811
+ logError(`Unknown provider: ${name}`);
812
+ console.log(`Available providers: ${PROVIDER_NAMES.join(", ")}`);
935
813
  return;
936
814
  }
937
- let useDirect = false;
938
- let actualProvider = mode;
939
- if (mode === "direct") {
940
- if (!providerName) {
941
- logError("Usage: provider direct <name>");
942
- console.log("Example: provider direct e2b");
943
- return;
944
- }
945
- useDirect = true;
946
- actualProvider = providerName;
947
- } else if (mode === "gateway") {
948
- if (!providerName) {
949
- logError("Usage: provider gateway <name>");
950
- console.log("Example: provider gateway e2b");
951
- return;
952
- }
953
- useDirect = false;
954
- actualProvider = providerName;
955
- }
956
- if (actualProvider === "gateway") {
957
- actualProvider = autoDetectProvider(false) || "e2b";
958
- }
959
- if (!isValidProvider(actualProvider)) {
960
- logError(`Unknown provider: ${actualProvider}`);
961
- console.log(`Available providers: ${PROVIDER_NAMES.filter((p) => p !== "gateway").join(", ")}, local`);
962
- return;
963
- }
964
- if (!useDirect && !isProviderReady("gateway")) {
965
- logError("Gateway mode requires COMPUTESDK_API_KEY");
966
- console.log(getProviderSetupHelp("gateway"));
967
- return;
968
- }
969
- if (useDirect && !isProviderReady(actualProvider)) {
970
- logError(`Provider ${actualProvider} is not fully configured for direct mode.`);
971
- console.log(getProviderSetupHelp(actualProvider));
815
+ if (!isProviderReady(name)) {
816
+ logError(`Provider ${name} is not fully configured.`);
817
+ console.log(getProviderSetupHelp(name));
972
818
  return;
973
819
  }
974
820
  if (hasSandbox(state)) {
975
821
  const shouldDestroy = await confirm("Destroy current sandbox?", false, state);
976
822
  if (shouldDestroy) {
977
823
  await destroySandbox(state);
978
- state.currentProvider = actualProvider;
979
- state.useDirectMode = useDirect;
824
+ state.currentProvider = name;
980
825
  state.compute = null;
981
- const modeStr = useDirect ? `${actualProvider} (direct)` : `${actualProvider} (via gateway)`;
982
- logSuccess(`Switched to ${modeStr}`);
826
+ logSuccess(`Switched to ${name}`);
983
827
  } else {
984
828
  logWarning("Keeping current sandbox. Provider remains unchanged.");
985
829
  }
986
830
  } else {
987
- state.currentProvider = actualProvider;
988
- state.useDirectMode = useDirect;
831
+ state.currentProvider = name;
989
832
  state.compute = null;
990
- const modeStr = useDirect ? `${actualProvider} (direct)` : `${actualProvider} (via gateway)`;
991
- logSuccess(`Switched to ${modeStr}`);
833
+ logSuccess(`Switched to ${name}`);
992
834
  }
993
835
  }
994
836
  function defineProviderCommand(state) {
995
- return async function provider(mode, providerName) {
996
- if (!mode) {
837
+ return async function provider(name) {
838
+ if (!name) {
997
839
  if (state.currentProvider) {
998
- const modeStr = state.useDirectMode ? "direct" : state.currentProvider === "local" ? "local daemon" : "via gateway";
999
840
  console.log(`
1000
- Current provider: ${c.green(state.currentProvider)} (${modeStr})
841
+ Current provider: ${c.green(state.currentProvider)}
1001
842
  `);
1002
843
  } else {
1003
844
  console.log(c.yellow("\nNo provider selected\n"));
1004
845
  }
1005
846
  return;
1006
847
  }
1007
- await switchProvider(state, mode, providerName);
848
+ await switchProvider(state, name);
1008
849
  };
1009
850
  }
1010
- async function toggleMode(state, mode) {
1011
- const newMode = mode || (state.useDirectMode ? "gateway" : "direct");
1012
- if (newMode === "direct") {
1013
- state.useDirectMode = true;
1014
- logSuccess("Switched to direct mode \u{1F517}");
1015
- console.log(c.dim("Next sandbox will use direct provider packages\n"));
1016
- if (hasSandbox(state) && !state.useDirectMode) {
1017
- console.log(c.yellow("Current sandbox is in gateway mode."));
1018
- console.log(c.dim('Run "restart" to switch to direct mode\n'));
1019
- }
1020
- } else {
1021
- state.useDirectMode = false;
1022
- logSuccess("Switched to gateway mode \u{1F310}");
1023
- console.log(c.dim("Next sandbox will use gateway (requires COMPUTESDK_API_KEY)\n"));
1024
- if (hasSandbox(state) && state.useDirectMode) {
1025
- console.log(c.yellow("Current sandbox is in direct mode."));
1026
- console.log(c.dim('Run "restart" to switch to gateway mode\n'));
1027
- }
1028
- }
1029
- }
1030
- function showMode(state) {
1031
- const mode = state.useDirectMode ? "direct" : "gateway";
1032
- const icon = mode === "gateway" ? "\u{1F310}" : "\u{1F517}";
1033
- console.log(`
1034
- Current mode: ${c.green(mode)} ${icon}`);
1035
- if (mode === "gateway") {
1036
- console.log(c.dim("Routes through ComputeSDK API (requires COMPUTESDK_API_KEY)"));
1037
- } else {
1038
- console.log(c.dim("Direct connection to providers (requires provider packages)"));
1039
- }
1040
- console.log(`
1041
- Switch with: ${c.cyan("provider e2b")} (gateway) or ${c.cyan("provider direct e2b")} (direct)
1042
- `);
1043
- }
1044
851
  function toggleVerbose(state) {
1045
852
  state.verbose = !state.verbose;
1046
853
  if (state.verbose) {
@@ -1067,182 +874,6 @@ Verbose mode: ${status}`);
1067
874
  Toggle with: ${c.cyan("verbose")}
1068
875
  `);
1069
876
  }
1070
- async function connectToSandbox(state, sandboxUrl, token) {
1071
- if (!sandboxUrl) {
1072
- logError("Usage: connect <sandbox_url> [token]");
1073
- console.log("Example: connect https://sandbox-123.localhost:8080");
1074
- console.log("Example: connect https://sandbox-123.localhost:8080 your_access_token");
1075
- return;
1076
- }
1077
- const cleanUrl = sandboxUrl.replace(/\/$/, "");
1078
- if (hasSandbox(state)) {
1079
- const shouldDisconnect = await confirm("Disconnect from current sandbox?", false, state);
1080
- if (!shouldDisconnect) {
1081
- logWarning("Keeping current sandbox. Connection cancelled.");
1082
- return;
1083
- }
1084
- clearSandbox(state);
1085
- }
1086
- const spinner = new Spinner(`Connecting to ${cleanUrl}...`).start();
1087
- const startTime = Date.now();
1088
- try {
1089
- const { Sandbox } = await import("computesdk");
1090
- let WebSocket;
1091
- try {
1092
- const wsModule = await import("ws");
1093
- WebSocket = wsModule.default;
1094
- } catch {
1095
- logError('Failed to import "ws" module. Please install it: pnpm add ws');
1096
- throw new Error('Missing "ws" dependency');
1097
- }
1098
- const sandbox = new Sandbox({
1099
- sandboxUrl: cleanUrl,
1100
- sandboxId: "",
1101
- // Will be populated when we get info
1102
- provider: "connected",
1103
- // Mark as directly connected
1104
- token,
1105
- // Optional access token
1106
- WebSocket
1107
- });
1108
- const info = await sandbox.getInfo();
1109
- const duration = Date.now() - startTime;
1110
- setSandbox(state, sandbox, "connected");
1111
- spinner.succeed(`Connected to sandbox ${c.dim(`(${formatDuration(duration)})`)}`);
1112
- console.log(c.dim(`Provider: ${info.provider || "unknown"}`));
1113
- console.log(c.dim(`Sandbox ID: ${info.id || "unknown"}`));
1114
- } catch (error) {
1115
- const duration = Date.now() - startTime;
1116
- spinner.fail(`Failed to connect ${c.dim(`(${formatDuration(duration)})`)}`);
1117
- if (error instanceof Error) {
1118
- logError(`Error: ${error.message}`);
1119
- if (error.stack) {
1120
- console.log(c.dim(error.stack));
1121
- }
1122
- }
1123
- throw error;
1124
- }
1125
- }
1126
- async function readLocalConfig() {
1127
- const os2 = await import("os");
1128
- const fs = await import("fs/promises");
1129
- const path3 = await import("path");
1130
- const configPath = path3.join(os2.homedir(), ".compute", "config.json");
1131
- try {
1132
- const content = await fs.readFile(configPath, "utf-8");
1133
- return JSON.parse(content);
1134
- } catch {
1135
- return null;
1136
- }
1137
- }
1138
- async function isLocalDaemonRunning() {
1139
- const os2 = await import("os");
1140
- const fs = await import("fs/promises");
1141
- const path3 = await import("path");
1142
- const pidPath = path3.join(os2.homedir(), ".compute", "compute.pid");
1143
- try {
1144
- const pidContent = await fs.readFile(pidPath, "utf-8");
1145
- const pid = parseInt(pidContent.trim(), 10);
1146
- process.kill(pid, 0);
1147
- return true;
1148
- } catch {
1149
- return false;
1150
- }
1151
- }
1152
- async function listLocalSandboxes() {
1153
- const config = await readLocalConfig();
1154
- if (!config) {
1155
- logError("No local daemon config found at ~/.compute/config.json");
1156
- console.log(c.dim('Run "compute start" to start the local daemon'));
1157
- return;
1158
- }
1159
- const isRunning = await isLocalDaemonRunning();
1160
- console.log("");
1161
- console.log(c.bold("Local Daemon Status:"), isRunning ? c.green("Running") : c.red("Stopped"));
1162
- console.log("");
1163
- if (!config.sandboxes || config.sandboxes.length === 0) {
1164
- console.log(c.dim("No sandboxes found"));
1165
- return;
1166
- }
1167
- console.log(c.bold("Sandboxes:"));
1168
- for (const sandbox of config.sandboxes) {
1169
- const isMain = sandbox.subdomain === config.main_subdomain;
1170
- const mainLabel = isMain ? c.green(" (main)") : "";
1171
- console.log(` ${c.cyan(sandbox.subdomain)}${mainLabel}`);
1172
- console.log(c.dim(` https://${sandbox.subdomain}.sandbox.computesdk.com`));
1173
- }
1174
- console.log("");
1175
- console.log(c.dim(`Connect with: local ${config.main_subdomain}`));
1176
- console.log("");
1177
- }
1178
- async function connectToLocal(state, subdomain) {
1179
- const config = await readLocalConfig();
1180
- if (!config) {
1181
- logError("No local daemon config found at ~/.compute/config.json");
1182
- console.log(c.dim('Run "compute start" to start the local daemon'));
1183
- return;
1184
- }
1185
- const isRunning = await isLocalDaemonRunning();
1186
- if (!isRunning) {
1187
- logError("Local daemon is not running");
1188
- console.log(c.dim('Run "compute start" to start the local daemon'));
1189
- return;
1190
- }
1191
- const targetSubdomain = subdomain || config.main_subdomain;
1192
- const sandbox = config.sandboxes.find((s) => s.subdomain === targetSubdomain);
1193
- if (!sandbox) {
1194
- logError(`Sandbox "${targetSubdomain}" not found`);
1195
- console.log(c.dim('Run "local list" to see available sandboxes'));
1196
- return;
1197
- }
1198
- const sandboxUrl = `https://${targetSubdomain}.sandbox.computesdk.com`;
1199
- const token = config.access_token;
1200
- if (hasSandbox(state)) {
1201
- const shouldDisconnect = await confirm("Disconnect from current sandbox?", false, state);
1202
- if (!shouldDisconnect) {
1203
- logWarning("Keeping current sandbox. Connection cancelled.");
1204
- return;
1205
- }
1206
- clearSandbox(state);
1207
- }
1208
- const spinner = new Spinner(`Connecting to local sandbox ${targetSubdomain}...`).start();
1209
- const startTime = Date.now();
1210
- try {
1211
- const { Sandbox } = await import("computesdk");
1212
- let WebSocket;
1213
- try {
1214
- const wsModule = await import("ws");
1215
- WebSocket = wsModule.default;
1216
- } catch {
1217
- spinner.fail('Failed to import "ws" module');
1218
- logError("Please install ws: pnpm add ws");
1219
- throw new Error('Missing "ws" dependency');
1220
- }
1221
- const sandboxInstance = new Sandbox({
1222
- sandboxUrl,
1223
- sandboxId: targetSubdomain,
1224
- provider: "local",
1225
- token,
1226
- WebSocket
1227
- });
1228
- const info = await sandboxInstance.getInfo();
1229
- const duration = Date.now() - startTime;
1230
- setSandbox(state, sandboxInstance, "local");
1231
- state.verbose = true;
1232
- process.env.COMPUTESDK_DEBUG = "1";
1233
- spinner.succeed(`Connected to local sandbox ${c.dim(`(${formatDuration(duration)})`)}`);
1234
- console.log(c.dim(`Sandbox: ${targetSubdomain}`));
1235
- console.log(c.dim(`URL: ${sandboxUrl}`));
1236
- console.log(c.dim(`Verbose mode: enabled (for debugging)`));
1237
- } catch (error) {
1238
- const duration = Date.now() - startTime;
1239
- spinner.fail(`Failed to connect ${c.dim(`(${formatDuration(duration)})`)}`);
1240
- if (error instanceof Error) {
1241
- logError(`Error: ${error.message}`);
1242
- }
1243
- throw error;
1244
- }
1245
- }
1246
877
  async function cleanupOnExit(state, replServer) {
1247
878
  if (!hasSandbox(state)) {
1248
879
  return;
@@ -1251,10 +882,6 @@ async function cleanupOnExit(state, replServer) {
1251
882
  replServer.pause();
1252
883
  }
1253
884
  console.log("");
1254
- if (state.currentProvider === "connected") {
1255
- logWarning("Disconnecting from external sandbox (not destroying).");
1256
- return;
1257
- }
1258
885
  const shouldDestroy = await confirm("Destroy active sandbox?", false, state);
1259
886
  if (shouldDestroy) {
1260
887
  await destroySandbox(state);
@@ -1293,6 +920,18 @@ function isCommand(value) {
1293
920
  // src/cli/repl.ts
1294
921
  import * as path2 from "path";
1295
922
  import * as os from "os";
923
+ function getSandboxMetadata(sandbox) {
924
+ const instance = sandbox.getInstance?.();
925
+ if (typeof instance !== "object" || instance === null || !("config" in instance)) {
926
+ return {};
927
+ }
928
+ const config = instance.config;
929
+ if (typeof config !== "object" || config === null || !("metadata" in config)) {
930
+ return {};
931
+ }
932
+ const metadata = config.metadata;
933
+ return typeof metadata === "object" && metadata !== null ? metadata : {};
934
+ }
1296
935
  function createREPL(state) {
1297
936
  const replServer = repl.start({
1298
937
  prompt: "> ",
@@ -1390,22 +1029,12 @@ function injectCmdContext(replServer) {
1390
1029
  function injectWorkbenchCommands(replServer, state) {
1391
1030
  replServer.context.provider = defineProviderCommand(state);
1392
1031
  replServer.context.providers = () => showProviders();
1393
- replServer.context.mode = async (modeName) => {
1394
- if (!modeName) {
1395
- showMode(state);
1396
- } else {
1397
- await toggleMode(state, modeName);
1398
- }
1399
- };
1400
1032
  replServer.context.restart = async () => {
1401
1033
  await restartSandbox(state);
1402
1034
  };
1403
1035
  replServer.context.destroy = async () => {
1404
1036
  await destroySandbox(state);
1405
1037
  };
1406
- replServer.context.connect = async (url, token) => {
1407
- await connectToSandbox(state, url, token);
1408
- };
1409
1038
  replServer.context.info = () => showInfo(state);
1410
1039
  replServer.context.verbose = () => {
1411
1040
  toggleVerbose(state);
@@ -1442,13 +1071,6 @@ function injectWorkbenchCommands(replServer, state) {
1442
1071
  }
1443
1072
  return sandboxReady.ready();
1444
1073
  };
1445
- replServer.context.runCode = async (code, runtime) => {
1446
- const sandbox = state.currentSandbox;
1447
- if (!sandbox) {
1448
- throw new Error("No active sandbox. Run a command to auto-create one.");
1449
- }
1450
- return sandbox.runCode(code, runtime);
1451
- };
1452
1074
  replServer.context.runCommand = async (command, options) => {
1453
1075
  const sandbox = state.currentSandbox;
1454
1076
  if (!sandbox) {
@@ -1467,7 +1089,7 @@ function injectWorkbenchCommands(replServer, state) {
1467
1089
  return {
1468
1090
  sandboxId: sandbox2.sandboxId,
1469
1091
  provider: sandbox2.provider,
1470
- metadata: sandbox2.getInstance?.()?.config?.metadata || {}
1092
+ metadata: getSandboxMetadata(sandbox2)
1471
1093
  };
1472
1094
  }
1473
1095
  const compute2 = await getComputeInstance2(state);
@@ -1477,70 +1099,7 @@ function injectWorkbenchCommands(replServer, state) {
1477
1099
  return {
1478
1100
  sandboxId: sandbox.sandboxId,
1479
1101
  provider: sandbox.provider,
1480
- metadata: sandbox.getInstance?.()?.config?.metadata || {}
1481
- };
1482
- };
1483
- replServer.context.findOrCreate = async (options) => {
1484
- if (state.useDirectMode) {
1485
- throw new Error('Named sandboxes (findOrCreate) are only available in gateway mode. Use "mode gateway" to switch.');
1486
- }
1487
- const { getComputeInstance: getComputeInstance2, confirmSandboxSwitch: confirmSandboxSwitch2 } = await Promise.resolve().then(() => (init_commands(), commands_exports));
1488
- const { setSandbox: setSandbox2 } = await Promise.resolve().then(() => (init_state(), state_exports));
1489
- const { logSuccess: logSuccess2 } = await Promise.resolve().then(() => (init_output(), output_exports));
1490
- const shouldSwitch = await confirmSandboxSwitch2(state);
1491
- if (!shouldSwitch) {
1492
- const compute3 = await getComputeInstance2(state);
1493
- const sandbox2 = await compute3.sandbox.findOrCreate(options);
1494
- return {
1495
- sandboxId: sandbox2.sandboxId,
1496
- provider: sandbox2.provider,
1497
- name: options.name,
1498
- namespace: options.namespace || "default",
1499
- metadata: sandbox2.getInstance().config.metadata || {}
1500
- };
1501
- }
1502
- const compute2 = await getComputeInstance2(state);
1503
- const sandbox = await compute2.sandbox.findOrCreate(options);
1504
- setSandbox2(state, sandbox, sandbox.provider);
1505
- logSuccess2(`Switched to sandbox ${sandbox.sandboxId}`);
1506
- return {
1507
- sandboxId: sandbox.sandboxId,
1508
- provider: sandbox.provider,
1509
- name: options.name,
1510
- namespace: options.namespace || "default",
1511
- metadata: sandbox.getInstance().config.metadata || {}
1512
- };
1513
- };
1514
- replServer.context.find = async (options) => {
1515
- if (state.useDirectMode) {
1516
- throw new Error('Named sandboxes (find) are only available in gateway mode. Use "mode gateway" to switch.');
1517
- }
1518
- const { getComputeInstance: getComputeInstance2, confirmSandboxSwitch: confirmSandboxSwitch2 } = await Promise.resolve().then(() => (init_commands(), commands_exports));
1519
- const { setSandbox: setSandbox2 } = await Promise.resolve().then(() => (init_state(), state_exports));
1520
- const { logSuccess: logSuccess2 } = await Promise.resolve().then(() => (init_output(), output_exports));
1521
- const compute2 = await getComputeInstance2(state);
1522
- const sandbox = await compute2.sandbox.find(options);
1523
- if (!sandbox) {
1524
- return null;
1525
- }
1526
- const shouldSwitch = await confirmSandboxSwitch2(state);
1527
- if (!shouldSwitch) {
1528
- return {
1529
- sandboxId: sandbox.sandboxId,
1530
- provider: sandbox.provider,
1531
- name: options.name,
1532
- namespace: options.namespace || "default",
1533
- metadata: sandbox.getInstance().config.metadata || {}
1534
- };
1535
- }
1536
- setSandbox2(state, sandbox, sandbox.provider);
1537
- logSuccess2(`Switched to sandbox ${sandbox.sandboxId}`);
1538
- return {
1539
- sandboxId: sandbox.sandboxId,
1540
- provider: sandbox.provider,
1541
- name: options.name,
1542
- namespace: options.namespace || "default",
1543
- metadata: sandbox.getInstance().config.metadata || {}
1102
+ metadata: getSandboxMetadata(sandbox)
1544
1103
  };
1545
1104
  };
1546
1105
  replServer.context.filesystem = {
@@ -1599,160 +1158,6 @@ function injectWorkbenchCommands(replServer, state) {
1599
1158
  };
1600
1159
  }
1601
1160
  };
1602
- replServer.context.child = {
1603
- get create() {
1604
- return async () => {
1605
- if (state.useDirectMode) {
1606
- throw new Error('Child sandboxes are only available in gateway mode. Use "mode gateway" to switch.');
1607
- }
1608
- const sandbox = state.currentSandbox;
1609
- if (!sandbox) {
1610
- throw new Error("No active sandbox. Run a command to auto-create one.");
1611
- }
1612
- const instance = sandbox.getInstance();
1613
- return instance.child.create();
1614
- };
1615
- },
1616
- get list() {
1617
- return async () => {
1618
- if (state.useDirectMode) {
1619
- throw new Error('Child sandboxes are only available in gateway mode. Use "mode gateway" to switch.');
1620
- }
1621
- const sandbox = state.currentSandbox;
1622
- if (!sandbox) {
1623
- throw new Error("No active sandbox. Run a command to auto-create one.");
1624
- }
1625
- const instance = sandbox.getInstance();
1626
- return instance.child.list();
1627
- };
1628
- },
1629
- get retrieve() {
1630
- return async (subdomain) => {
1631
- if (state.useDirectMode) {
1632
- throw new Error('Child sandboxes are only available in gateway mode. Use "mode gateway" to switch.');
1633
- }
1634
- const sandbox = state.currentSandbox;
1635
- if (!sandbox) {
1636
- throw new Error("No active sandbox. Run a command to auto-create one.");
1637
- }
1638
- const instance = sandbox.getInstance();
1639
- return instance.child.retrieve(subdomain);
1640
- };
1641
- },
1642
- get destroy() {
1643
- return async (subdomain, options) => {
1644
- if (state.useDirectMode) {
1645
- throw new Error('Child sandboxes are only available in gateway mode. Use "mode gateway" to switch.');
1646
- }
1647
- const sandbox = state.currentSandbox;
1648
- if (!sandbox) {
1649
- throw new Error("No active sandbox. Run a command to auto-create one.");
1650
- }
1651
- const instance = sandbox.getInstance();
1652
- return instance.child.destroy(subdomain, options);
1653
- };
1654
- }
1655
- };
1656
- replServer.context.server = {
1657
- get start() {
1658
- return async (options) => {
1659
- const sandbox = state.currentSandbox;
1660
- if (!sandbox) {
1661
- throw new Error("No active sandbox. Run a command to auto-create one.");
1662
- }
1663
- return sandbox.server.start(options);
1664
- };
1665
- },
1666
- get list() {
1667
- return async () => {
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.list();
1673
- };
1674
- },
1675
- get retrieve() {
1676
- return async (slug) => {
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.retrieve(slug);
1682
- };
1683
- },
1684
- get stop() {
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.stop(slug);
1691
- };
1692
- },
1693
- get restart() {
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.restart(slug);
1700
- };
1701
- }
1702
- };
1703
- replServer.context.terminal = {
1704
- get create() {
1705
- return async (options) => {
1706
- const sandbox = state.currentSandbox;
1707
- if (!sandbox) {
1708
- throw new Error("No active sandbox. Run a command to auto-create one.");
1709
- }
1710
- const term = await sandbox.terminal.create(options);
1711
- if (state.verbose) {
1712
- if (term._ws) {
1713
- term._ws.config.debug = true;
1714
- }
1715
- term.on("output", (data) => {
1716
- console.log("[terminal:output]", JSON.stringify(data));
1717
- });
1718
- term.on("error", (error) => {
1719
- console.log("[terminal:error]", error);
1720
- });
1721
- term.on("destroyed", () => {
1722
- console.log("[terminal:destroyed]");
1723
- });
1724
- }
1725
- return term;
1726
- };
1727
- },
1728
- get list() {
1729
- return async () => {
1730
- const sandbox = state.currentSandbox;
1731
- if (!sandbox) {
1732
- throw new Error("No active sandbox. Run a command to auto-create one.");
1733
- }
1734
- return sandbox.terminal.list();
1735
- };
1736
- },
1737
- get retrieve() {
1738
- return async (id) => {
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.retrieve(id);
1744
- };
1745
- },
1746
- get destroy() {
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.destroy(id);
1753
- };
1754
- }
1755
- };
1756
1161
  replServer.context.getInstance = () => {
1757
1162
  const sandbox = state.currentSandbox;
1758
1163
  if (!sandbox) {
@@ -1763,36 +1168,13 @@ function injectWorkbenchCommands(replServer, state) {
1763
1168
  }
1764
1169
  function setupSmartEvaluator(replServer, state) {
1765
1170
  const originalEval = replServer.eval;
1766
- const workbenchCommands = /* @__PURE__ */ new Set(["help", "providers", "info", "env", "restart", "destroy", "mode", "verbose", "sandboxInfo", "connect"]);
1171
+ const workbenchCommands = /* @__PURE__ */ new Set(["help", "providers", "info", "env", "restart", "destroy", "verbose", "sandboxInfo"]);
1767
1172
  replServer.eval = function(cmd2, context, filename, callback) {
1768
1173
  const trimmedCmd = cmd2.trim();
1769
- const providerLocalMatch = trimmedCmd.match(/^provider\s+local(?:\s+(\S+))?$/);
1770
- if (providerLocalMatch) {
1771
- const arg = providerLocalMatch[1];
1772
- const providerCmd = arg ? `await provider('local', '${arg}')` : `await provider('local')`;
1773
- originalEval.call(this, providerCmd, context, filename, callback);
1774
- return;
1775
- }
1776
- const providerMatch = trimmedCmd.match(/^provider(?:\s+(direct|gateway))?\s+([\w-]+)$/);
1174
+ const providerMatch = trimmedCmd.match(/^provider\s+([\w-]+)$/);
1777
1175
  if (providerMatch) {
1778
- const mode = providerMatch[1] || null;
1779
- const providerName = providerMatch[2];
1780
- const providerCmd = mode ? `await provider('${mode}', '${providerName}')` : `await provider('${providerName}')`;
1781
- originalEval.call(this, providerCmd, context, filename, callback);
1782
- return;
1783
- }
1784
- const providerOnlyMatch = trimmedCmd.match(/^provider\s+(direct|gateway)$/);
1785
- if (providerOnlyMatch) {
1786
- const mode = providerOnlyMatch[1];
1787
- const providerCmd = `await provider('${mode}')`;
1788
- originalEval.call(this, providerCmd, context, filename, callback);
1789
- return;
1790
- }
1791
- const modeMatch = trimmedCmd.match(/^mode\s+(gateway|direct)$/);
1792
- if (modeMatch) {
1793
- const modeName = modeMatch[1];
1794
- const modeCmd = `await mode('${modeName}')`;
1795
- originalEval.call(this, modeCmd, context, filename, callback);
1176
+ const providerName = providerMatch[1];
1177
+ originalEval.call(this, `await provider('${providerName}')`, context, filename, callback);
1796
1178
  return;
1797
1179
  }
1798
1180
  const dollarMatch = trimmedCmd.match(/^\$(.+)$/);
@@ -1845,14 +1227,10 @@ function setupSmartEvaluator(replServer, state) {
1845
1227
  function setupAutocomplete(replServer, state) {
1846
1228
  const originalCompleter = replServer.completer;
1847
1229
  const workbenchCommands = {
1848
- "provider": [...PROVIDER_NAMES, "local"],
1849
- // Include 'local' as a provider option
1850
- "mode": ["gateway", "direct"],
1230
+ "provider": [...PROVIDER_NAMES],
1851
1231
  "providers": [],
1852
1232
  "restart": [],
1853
1233
  "destroy": [],
1854
- "connect": [],
1855
- // Connect takes a URL argument
1856
1234
  "info": [],
1857
1235
  "env": [],
1858
1236
  "help": [],
@@ -1861,7 +1239,6 @@ function setupAutocomplete(replServer, state) {
1861
1239
  ".exit": [],
1862
1240
  // Sandbox methods
1863
1241
  "getUrl": [],
1864
- "runCode": [],
1865
1242
  "sandboxInfo": [],
1866
1243
  "getInstance": []
1867
1244
  // Filesystem is an object, so it gets dot notation autocomplete automatically
@@ -1951,39 +1328,10 @@ init_providers();
1951
1328
  init_commands();
1952
1329
  async function startWorkbench() {
1953
1330
  const state = createState();
1954
- const localDaemonRunning = await isLocalDaemonRunning();
1955
1331
  state.availableProviders = getAvailableProviders();
1956
- if (localDaemonRunning) {
1957
- state.availableProviders.push("local");
1958
- }
1959
- const detectedProvider = autoDetectProvider();
1960
- if (localDaemonRunning) {
1961
- state.currentProvider = "local";
1962
- state.useDirectMode = false;
1963
- state.verbose = true;
1964
- process.env.COMPUTESDK_DEBUG = "1";
1965
- } else {
1966
- const hasGateway = state.availableProviders.includes("gateway");
1967
- const backendProviders = state.availableProviders.filter((p) => p !== "gateway" && p !== "local");
1968
- if (hasGateway && backendProviders.length > 0) {
1969
- state.currentProvider = backendProviders[0] || "e2b";
1970
- state.useDirectMode = false;
1971
- } else if (backendProviders.length > 0) {
1972
- state.currentProvider = backendProviders[0];
1973
- state.useDirectMode = true;
1974
- } else {
1975
- state.currentProvider = detectedProvider;
1976
- state.useDirectMode = false;
1977
- }
1978
- }
1979
- showWelcome(state.availableProviders, state.currentProvider, state.useDirectMode, localDaemonRunning);
1332
+ state.currentProvider = state.availableProviders[0] ?? null;
1333
+ showWelcome(state.availableProviders, state.currentProvider);
1980
1334
  const replServer = createREPL(state);
1981
- if (localDaemonRunning) {
1982
- try {
1983
- await connectToLocal(state);
1984
- } catch {
1985
- }
1986
- }
1987
1335
  replServer.on("exit", async () => {
1988
1336
  await cleanupOnExit(state, replServer);
1989
1337
  process.exit(0);