@fastgpt-sdk/sandbox-adapter 0.0.38-beta.0 → 0.0.38-beta.1

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.
@@ -32,7 +32,7 @@ export declare abstract class BaseSandboxAdapter implements ISandbox {
32
32
  abstract create(): Promise<void>;
33
33
  abstract start(): Promise<void>;
34
34
  abstract stop(): Promise<void>;
35
- abstract delete(): Promise<void>;
35
+ abstract delete(sandboxId?: SandboxId): Promise<void>;
36
36
  abstract getInfo(): Promise<SandboxInfo | null>;
37
37
  waitUntilReady(timeoutMs?: number): Promise<void>;
38
38
  waitUntilDeleted(timeoutMs?: number): Promise<void>;
@@ -24,7 +24,7 @@ export declare class E2BAdapter extends BaseSandboxAdapter {
24
24
  create(): Promise<void>;
25
25
  start(): Promise<void>;
26
26
  stop(): Promise<void>;
27
- delete(): Promise<void>;
27
+ delete(sandboxId?: SandboxId): Promise<void>;
28
28
  getInfo(): Promise<SandboxInfo | null>;
29
29
  execute(command: string, options?: ExecuteOptions): Promise<ExecuteResult>;
30
30
  readFiles(paths: string[]): Promise<FileReadResult[]>;
@@ -80,7 +80,7 @@ export declare class OpenSandboxAdapter extends BaseSandboxAdapter {
80
80
  private resume;
81
81
  start(): Promise<void>;
82
82
  stop(): Promise<void>;
83
- delete(): Promise<void>;
83
+ delete(sandboxId?: SandboxId): Promise<void>;
84
84
  /**
85
85
  * Release client-side resources owned by this Sandbox instance.
86
86
  * Does NOT stop or delete the container - the sandbox keeps running.
@@ -41,7 +41,7 @@ export declare class SealosDevboxAdapter extends BaseSandboxAdapter {
41
41
  create(): Promise<void>;
42
42
  stop(): Promise<void>;
43
43
  start(): Promise<void>;
44
- delete(): Promise<void>;
44
+ delete(sandboxId?: SandboxId): Promise<void>;
45
45
  execute(command: string, options?: ExecuteOptions): Promise<ExecuteResult>;
46
46
  getEndpoint(selector: SandboxEndpointSelector): Promise<Endpoint>;
47
47
  getProxyTarget(service?: SandboxProxyService): Promise<SandboxProxyTarget>;
package/dist/index.cjs CHANGED
@@ -45897,10 +45897,12 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
45897
45897
  throw new CommandExecutionError("Failed to resume sandbox", "resume", error instanceof Error ? error : undefined);
45898
45898
  }
45899
45899
  }
45900
- async delete() {
45900
+ async delete(sandboxId) {
45901
45901
  try {
45902
+ const targetId = sandboxId ?? this._id;
45902
45903
  this._status = { state: "Deleting" };
45903
- await this.api.delete(this._id);
45904
+ await this.api.delete(targetId);
45905
+ this._id = targetId;
45904
45906
  await this.waitUntilDeleted();
45905
45907
  this._status = { state: "UnExist" };
45906
45908
  } catch (error) {
@@ -48501,9 +48503,13 @@ class OpenSandboxAdapter extends BaseSandboxAdapter {
48501
48503
  throw new CommandExecutionError("Failed to stop sandbox", "stop", error instanceof Error ? error : undefined);
48502
48504
  }
48503
48505
  }
48504
- async delete() {
48506
+ async delete(sandboxId) {
48505
48507
  try {
48506
48508
  this._status = { state: "Deleting" };
48509
+ if (sandboxId && (!this._sandbox || sandboxId !== this._id)) {
48510
+ await this.connect(sandboxId);
48511
+ this._status = { state: "Deleting" };
48512
+ }
48507
48513
  await this.sandbox.kill();
48508
48514
  this.sandbox = undefined;
48509
48515
  this._status = { state: "UnExist" };
@@ -48872,7 +48878,11 @@ class E2BAdapter extends BaseSandboxAdapter {
48872
48878
  throw new CommandExecutionError("Failed to pause E2B sandbox", "stop", error instanceof Error ? error : undefined);
48873
48879
  }
48874
48880
  }
48875
- async delete() {
48881
+ async delete(sandboxId) {
48882
+ if (sandboxId) {
48883
+ this._id = sandboxId;
48884
+ this.sandbox = null;
48885
+ }
48876
48886
  const sandbox = await this.ensureSandbox();
48877
48887
  try {
48878
48888
  this._status = { state: "Deleting" };
package/dist/index.js CHANGED
@@ -45881,10 +45881,12 @@ class SealosDevboxAdapter extends BaseSandboxAdapter {
45881
45881
  throw new CommandExecutionError("Failed to resume sandbox", "resume", error instanceof Error ? error : undefined);
45882
45882
  }
45883
45883
  }
45884
- async delete() {
45884
+ async delete(sandboxId) {
45885
45885
  try {
45886
+ const targetId = sandboxId ?? this._id;
45886
45887
  this._status = { state: "Deleting" };
45887
- await this.api.delete(this._id);
45888
+ await this.api.delete(targetId);
45889
+ this._id = targetId;
45888
45890
  await this.waitUntilDeleted();
45889
45891
  this._status = { state: "UnExist" };
45890
45892
  } catch (error) {
@@ -48485,9 +48487,13 @@ class OpenSandboxAdapter extends BaseSandboxAdapter {
48485
48487
  throw new CommandExecutionError("Failed to stop sandbox", "stop", error instanceof Error ? error : undefined);
48486
48488
  }
48487
48489
  }
48488
- async delete() {
48490
+ async delete(sandboxId) {
48489
48491
  try {
48490
48492
  this._status = { state: "Deleting" };
48493
+ if (sandboxId && (!this._sandbox || sandboxId !== this._id)) {
48494
+ await this.connect(sandboxId);
48495
+ this._status = { state: "Deleting" };
48496
+ }
48491
48497
  await this.sandbox.kill();
48492
48498
  this.sandbox = undefined;
48493
48499
  this._status = { state: "UnExist" };
@@ -48856,7 +48862,11 @@ class E2BAdapter extends BaseSandboxAdapter {
48856
48862
  throw new CommandExecutionError("Failed to pause E2B sandbox", "stop", error instanceof Error ? error : undefined);
48857
48863
  }
48858
48864
  }
48859
- async delete() {
48865
+ async delete(sandboxId) {
48866
+ if (sandboxId) {
48867
+ this._id = sandboxId;
48868
+ this.sandbox = null;
48869
+ }
48860
48870
  const sandbox = await this.ensureSandbox();
48861
48871
  try {
48862
48872
  this._status = { state: "Deleting" };
@@ -27,8 +27,12 @@ export interface ISandboxLifecycle {
27
27
  stop(): Promise<void>;
28
28
  /**
29
29
  * Delete the sandbox permanently.
30
+ *
31
+ * When `sandboxId` is provided, implementations should delete that provider
32
+ * sandbox directly without requiring callers to first bind the adapter via
33
+ * `connect()`.
30
34
  */
31
- delete(): Promise<void>;
35
+ delete(sandboxId?: SandboxId): Promise<void>;
32
36
  /**
33
37
  * Get detailed information about the sandbox.
34
38
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fastgpt-sdk/sandbox-adapter",
3
- "version": "0.0.38-beta.0",
3
+ "version": "0.0.38-beta.1",
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",