@fastgpt-sdk/sandbox-adapter 0.0.39 → 0.0.40-beta.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.cjs CHANGED
@@ -17393,7 +17393,7 @@ var require_fetch = __commonJS((exports2, module2) => {
17393
17393
  request.cache = "no-store";
17394
17394
  }
17395
17395
  const newConnection = forceNewConnection ? "yes" : "no";
17396
- if (request.mode === "websocket") {} else {}
17396
+ if (request.mode === "websocket") {}
17397
17397
  let requestBody = null;
17398
17398
  if (request.body == null && fetchParams.processRequestEndOfBody) {
17399
17399
  queueMicrotask(() => fetchParams.processRequestEndOfBody());
@@ -45788,8 +45788,12 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
45788
45788
  case "Pending" /* Pending */:
45789
45789
  return "Creating";
45790
45790
  case "Paused" /* Paused */:
45791
+ case "Stopped" /* Stopped */:
45792
+ case "Shutdown" /* Shutdown */:
45791
45793
  return "Stopped";
45792
45794
  case "Pausing" /* Pausing */:
45795
+ case "Stopping" /* Stopping */:
45796
+ case "Shutting" /* Shutting */:
45793
45797
  return "Stopping";
45794
45798
  default:
45795
45799
  return "Error";
@@ -45823,7 +45827,11 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
45823
45827
  if (!res.data)
45824
45828
  return Promise.reject(res.message);
45825
45829
  const data = res.data;
45826
- this._status = { state: this.StatusAdapt(data), message: res.message };
45830
+ this._status = {
45831
+ state: this.StatusAdapt(data),
45832
+ reason: data.state.phase,
45833
+ message: res.message
45834
+ };
45827
45835
  return {
45828
45836
  id: data.name,
45829
45837
  image: parseImageSpec(data.image),
@@ -45855,12 +45863,17 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
45855
45863
  await this.waitUntilDeleted();
45856
45864
  await this.create();
45857
45865
  return;
45866
+ case "Error":
45867
+ throw new ConnectionError(`Sandbox ${sandbox.id} is in error state: ${sandbox.status.reason ?? sandbox.status.message ?? "unknown"}`, this.config.baseUrl);
45858
45868
  default:
45859
- throw new ConnectionError(`Failed to ensure sandbox running`);
45869
+ throw new ConnectionError(`Sandbox state ${status} not supported`, this.config.baseUrl);
45860
45870
  }
45861
45871
  }
45862
45872
  await this.create();
45863
45873
  } catch (error) {
45874
+ if (error instanceof ConnectionError) {
45875
+ throw error;
45876
+ }
45864
45877
  throw new ConnectionError(`Failed to ensure sandbox running`, this.config.baseUrl, error);
45865
45878
  }
45866
45879
  }
package/dist/index.js CHANGED
@@ -17395,7 +17395,7 @@ var require_fetch = __commonJS((exports, module) => {
17395
17395
  request.cache = "no-store";
17396
17396
  }
17397
17397
  const newConnection = forceNewConnection ? "yes" : "no";
17398
- if (request.mode === "websocket") {} else {}
17398
+ if (request.mode === "websocket") {}
17399
17399
  let requestBody = null;
17400
17400
  if (request.body == null && fetchParams.processRequestEndOfBody) {
17401
17401
  queueMicrotask(() => fetchParams.processRequestEndOfBody());
@@ -45772,8 +45772,12 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
45772
45772
  case "Pending" /* Pending */:
45773
45773
  return "Creating";
45774
45774
  case "Paused" /* Paused */:
45775
+ case "Stopped" /* Stopped */:
45776
+ case "Shutdown" /* Shutdown */:
45775
45777
  return "Stopped";
45776
45778
  case "Pausing" /* Pausing */:
45779
+ case "Stopping" /* Stopping */:
45780
+ case "Shutting" /* Shutting */:
45777
45781
  return "Stopping";
45778
45782
  default:
45779
45783
  return "Error";
@@ -45807,7 +45811,11 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
45807
45811
  if (!res.data)
45808
45812
  return Promise.reject(res.message);
45809
45813
  const data = res.data;
45810
- this._status = { state: this.StatusAdapt(data), message: res.message };
45814
+ this._status = {
45815
+ state: this.StatusAdapt(data),
45816
+ reason: data.state.phase,
45817
+ message: res.message
45818
+ };
45811
45819
  return {
45812
45820
  id: data.name,
45813
45821
  image: parseImageSpec(data.image),
@@ -45839,12 +45847,17 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
45839
45847
  await this.waitUntilDeleted();
45840
45848
  await this.create();
45841
45849
  return;
45850
+ case "Error":
45851
+ throw new ConnectionError(`Sandbox ${sandbox.id} is in error state: ${sandbox.status.reason ?? sandbox.status.message ?? "unknown"}`, this.config.baseUrl);
45842
45852
  default:
45843
- throw new ConnectionError(`Failed to ensure sandbox running`);
45853
+ throw new ConnectionError(`Sandbox state ${status} not supported`, this.config.baseUrl);
45844
45854
  }
45845
45855
  }
45846
45856
  await this.create();
45847
45857
  } catch (error) {
45858
+ if (error instanceof ConnectionError) {
45859
+ throw error;
45860
+ }
45848
45861
  throw new ConnectionError(`Failed to ensure sandbox running`, this.config.baseUrl, error);
45849
45862
  }
45850
45863
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastgpt-sdk/sandbox-adapter",
3
- "version": "0.0.39",
3
+ "version": "0.0.40-beta.0",
4
4
  "description": "Unified abstraction layer for cloud sandbox providers with adapter pattern and feature polyfilling",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",