@declaw/sdk 1.1.6 → 1.1.8

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.d.cts CHANGED
@@ -1149,6 +1149,27 @@ declare class Sandbox {
1149
1149
  queued?: boolean;
1150
1150
  error?: string;
1151
1151
  }>>;
1152
+ /**
1153
+ * Kill a sandbox by id without first connecting. Sends a single
1154
+ * `DELETE /sandboxes/:id?async=true` and skips the metadata fetch
1155
+ * `Sandbox.connect(id).kill()` would otherwise pay. Useful for bulk
1156
+ * cleanup paths that only have the id.
1157
+ *
1158
+ * @param sandboxId - the sandbox to kill.
1159
+ * @param opts.wait - if true, block until the server finishes the
1160
+ * per-VM teardown. Default is false: server returns 202 once the
1161
+ * kill is queued.
1162
+ * @param opts.requestTimeout - per-request timeout in milliseconds.
1163
+ * @param opts.config - override the default ConnectionConfig.
1164
+ * @returns true if the kill was accepted (default) or completed
1165
+ * (wait=true); false if the server reported the sandbox was
1166
+ * already dead.
1167
+ */
1168
+ static kill(sandboxId: string, opts?: {
1169
+ wait?: boolean;
1170
+ requestTimeout?: number;
1171
+ config?: ConnectionConfig;
1172
+ }): Promise<boolean>;
1152
1173
  /**
1153
1174
  * Check if this sandbox is currently running.
1154
1175
  *
package/dist/index.d.ts CHANGED
@@ -1149,6 +1149,27 @@ declare class Sandbox {
1149
1149
  queued?: boolean;
1150
1150
  error?: string;
1151
1151
  }>>;
1152
+ /**
1153
+ * Kill a sandbox by id without first connecting. Sends a single
1154
+ * `DELETE /sandboxes/:id?async=true` and skips the metadata fetch
1155
+ * `Sandbox.connect(id).kill()` would otherwise pay. Useful for bulk
1156
+ * cleanup paths that only have the id.
1157
+ *
1158
+ * @param sandboxId - the sandbox to kill.
1159
+ * @param opts.wait - if true, block until the server finishes the
1160
+ * per-VM teardown. Default is false: server returns 202 once the
1161
+ * kill is queued.
1162
+ * @param opts.requestTimeout - per-request timeout in milliseconds.
1163
+ * @param opts.config - override the default ConnectionConfig.
1164
+ * @returns true if the kill was accepted (default) or completed
1165
+ * (wait=true); false if the server reported the sandbox was
1166
+ * already dead.
1167
+ */
1168
+ static kill(sandboxId: string, opts?: {
1169
+ wait?: boolean;
1170
+ requestTimeout?: number;
1171
+ config?: ConnectionConfig;
1172
+ }): Promise<boolean>;
1152
1173
  /**
1153
1174
  * Check if this sandbox is currently running.
1154
1175
  *
package/dist/index.js CHANGED
@@ -2056,6 +2056,33 @@ var Sandbox = class _Sandbox {
2056
2056
  });
2057
2057
  return data.results ?? {};
2058
2058
  }
2059
+ /**
2060
+ * Kill a sandbox by id without first connecting. Sends a single
2061
+ * `DELETE /sandboxes/:id?async=true` and skips the metadata fetch
2062
+ * `Sandbox.connect(id).kill()` would otherwise pay. Useful for bulk
2063
+ * cleanup paths that only have the id.
2064
+ *
2065
+ * @param sandboxId - the sandbox to kill.
2066
+ * @param opts.wait - if true, block until the server finishes the
2067
+ * per-VM teardown. Default is false: server returns 202 once the
2068
+ * kill is queued.
2069
+ * @param opts.requestTimeout - per-request timeout in milliseconds.
2070
+ * @param opts.config - override the default ConnectionConfig.
2071
+ * @returns true if the kill was accepted (default) or completed
2072
+ * (wait=true); false if the server reported the sandbox was
2073
+ * already dead.
2074
+ */
2075
+ static async kill(sandboxId, opts) {
2076
+ const config = opts?.config ?? new ConnectionConfig();
2077
+ const client = getSharedClient(config);
2078
+ const wait = opts?.wait === true;
2079
+ const path = wait ? `/sandboxes/${sandboxId}` : `/sandboxes/${sandboxId}?async=true`;
2080
+ const data = await client.delete(path, {
2081
+ timeout: opts?.requestTimeout
2082
+ });
2083
+ if (!wait) return data.queued ?? true;
2084
+ return data.killed ?? false;
2085
+ }
2059
2086
  /**
2060
2087
  * Check if this sandbox is currently running.
2061
2088
  *