@computesdk/workbench 3.1.0 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -567,8 +567,8 @@ __export(commands_exports, {
567
567
  cleanupOnExit: () => cleanupOnExit,
568
568
  confirmSandboxSwitch: () => confirmSandboxSwitch,
569
569
  connectToSandbox: () => connectToSandbox,
570
- createProviderCommand: () => createProviderCommand,
571
570
  createSandbox: () => createSandbox,
571
+ defineProviderCommand: () => defineProviderCommand,
572
572
  destroySandbox: () => destroySandbox,
573
573
  ensureSandbox: () => ensureSandbox,
574
574
  getComputeInstance: () => getComputeInstance,
@@ -580,7 +580,7 @@ __export(commands_exports, {
580
580
  toggleMode: () => toggleMode,
581
581
  toggleVerbose: () => toggleVerbose
582
582
  });
583
- import { createCompute } from "computesdk";
583
+ import { createCompute } from "@computesdk/provider";
584
584
  import * as readline from "readline";
585
585
  async function confirm(question, defaultYes = false) {
586
586
  return new Promise((resolve) => {
@@ -634,42 +634,8 @@ async function getComputeInstance(state) {
634
634
  defaultProvider: providerFactory(config2)
635
635
  });
636
636
  } else {
637
- const gatewayModule = await import("computesdk");
638
- const gatewayFactory = gatewayModule.gateway;
639
- const providerConfig = getProviderConfig(providerName);
640
- const providerHeaders = {};
641
- switch (providerName) {
642
- case "e2b":
643
- if (providerConfig.apiKey) providerHeaders["X-E2B-API-Key"] = providerConfig.apiKey;
644
- break;
645
- case "railway":
646
- if (providerConfig.apiKey) providerHeaders["X-Railway-API-Key"] = providerConfig.apiKey;
647
- if (providerConfig.projectId) providerHeaders["X-Railway-Project-ID"] = providerConfig.projectId;
648
- if (providerConfig.environmentId) providerHeaders["X-Railway-Environment-ID"] = providerConfig.environmentId;
649
- break;
650
- case "daytona":
651
- if (providerConfig.apiKey) providerHeaders["X-Daytona-API-Key"] = providerConfig.apiKey;
652
- break;
653
- case "modal":
654
- if (providerConfig.tokenId) providerHeaders["X-Modal-Token-ID"] = providerConfig.tokenId;
655
- if (providerConfig.tokenSecret) providerHeaders["X-Modal-Token-Secret"] = providerConfig.tokenSecret;
656
- break;
657
- case "vercel":
658
- if (providerConfig.token) providerHeaders["X-Vercel-Token"] = providerConfig.token;
659
- if (providerConfig.teamId) providerHeaders["X-Vercel-Team-ID"] = providerConfig.teamId;
660
- if (providerConfig.projectId) providerHeaders["X-Vercel-Project-ID"] = providerConfig.projectId;
661
- break;
662
- }
663
- const config2 = {
664
- apiKey: process.env.COMPUTESDK_API_KEY,
665
- provider: providerName,
666
- // Tell gateway which backend to use
667
- providerHeaders
668
- // Pass provider credentials via headers
669
- };
670
- compute2 = createCompute({
671
- defaultProvider: gatewayFactory(config2)
672
- });
637
+ const { compute: gatewayCompute } = await import("computesdk");
638
+ compute2 = gatewayCompute;
673
639
  }
674
640
  state.compute = compute2;
675
641
  return compute2;
@@ -727,10 +693,6 @@ Install it with: ${c.cyan(`npm install @computesdk/${providerName}`)}
727
693
  }
728
694
  }
729
695
  async function destroySandbox(state) {
730
- if (!hasSandbox(state)) {
731
- logWarning("No active sandbox");
732
- return;
733
- }
734
696
  const spinner = new Spinner("Destroying sandbox...").start();
735
697
  try {
736
698
  const sandbox = getCurrentSandbox(state);
@@ -861,7 +823,7 @@ async function switchProvider(state, mode, providerName) {
861
823
  logSuccess(`Switched to ${modeStr}`);
862
824
  }
863
825
  }
864
- function createProviderCommand(state) {
826
+ function defineProviderCommand(state) {
865
827
  return async function provider(mode, providerName) {
866
828
  if (!mode) {
867
829
  if (state.currentProvider) {
@@ -953,7 +915,7 @@ async function connectToSandbox(state, sandboxUrl, token) {
953
915
  const spinner = new Spinner(`Connecting to ${cleanUrl}...`).start();
954
916
  const startTime = Date.now();
955
917
  try {
956
- const { Sandbox } = await import("@computesdk/client");
918
+ const { Sandbox } = await import("computesdk");
957
919
  let WebSocket;
958
920
  try {
959
921
  const wsModule = await import("ws");
@@ -1140,7 +1102,7 @@ function injectCmdContext(replServer) {
1140
1102
  replServer.context.zsh = cmd.zsh;
1141
1103
  }
1142
1104
  function injectWorkbenchCommands(replServer, state) {
1143
- replServer.context.provider = createProviderCommand(state);
1105
+ replServer.context.provider = defineProviderCommand(state);
1144
1106
  replServer.context.providers = () => showProviders();
1145
1107
  replServer.context.mode = async (modeName) => {
1146
1108
  if (!modeName) {