@fastgpt-sdk/sandbox-adapter 0.0.40-beta.1 → 0.0.40-beta.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.
@@ -37,6 +37,7 @@ export declare class SealosDevboxAdapter extends BaseSandboxAdapter {
37
37
  private buildCreateRequest;
38
38
  private removeUndefined;
39
39
  private assertMutationSuccess;
40
+ private isNotFoundResponse;
40
41
  getInfo(): Promise<SandboxInfo | null>;
41
42
  ensureRunning(): Promise<void>;
42
43
  create(): Promise<void>;
package/dist/index.cjs CHANGED
@@ -45825,6 +45825,9 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
45825
45825
  }
45826
45826
  throw new Error(res.message || `Devbox ${action} failed with code ${res.code}`);
45827
45827
  }
45828
+ isNotFoundResponse(res) {
45829
+ return res.code === 404 || String(res.message ?? "").toLowerCase().includes("not found");
45830
+ }
45828
45831
  async getInfo() {
45829
45832
  try {
45830
45833
  const res = await this.api.info(this._id);
@@ -45899,6 +45902,10 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
45899
45902
  try {
45900
45903
  this._status = { state: "Stopping" };
45901
45904
  const res = await this.api.stop(this._id);
45905
+ if (this.isNotFoundResponse(res)) {
45906
+ this._status = { state: "Stopped" };
45907
+ return;
45908
+ }
45902
45909
  this.assertMutationSuccess(res, "stop");
45903
45910
  this._status = { state: "Stopped" };
45904
45911
  } catch (error) {
package/dist/index.js CHANGED
@@ -45809,6 +45809,9 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
45809
45809
  }
45810
45810
  throw new Error(res.message || `Devbox ${action} failed with code ${res.code}`);
45811
45811
  }
45812
+ isNotFoundResponse(res) {
45813
+ return res.code === 404 || String(res.message ?? "").toLowerCase().includes("not found");
45814
+ }
45812
45815
  async getInfo() {
45813
45816
  try {
45814
45817
  const res = await this.api.info(this._id);
@@ -45883,6 +45886,10 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
45883
45886
  try {
45884
45887
  this._status = { state: "Stopping" };
45885
45888
  const res = await this.api.stop(this._id);
45889
+ if (this.isNotFoundResponse(res)) {
45890
+ this._status = { state: "Stopped" };
45891
+ return;
45892
+ }
45886
45893
  this.assertMutationSuccess(res, "stop");
45887
45894
  this._status = { state: "Stopped" };
45888
45895
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastgpt-sdk/sandbox-adapter",
3
- "version": "0.0.40-beta.1",
3
+ "version": "0.0.40-beta.2",
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",