@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/CHANGELOG.md CHANGED
@@ -5,6 +5,20 @@ All notable changes to the Declaw TypeScript / JavaScript SDK are documented in
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.1.8]
9
+
10
+ ### Documentation
11
+
12
+ - README clarifies `files.write` path semantics: `path` is the literal
13
+ absolute path inside the sandbox — no remapping, no bridge directory,
14
+ no prefix.
15
+
16
+ ## [1.1.7]
17
+
18
+ ### Added
19
+
20
+ - `Sandbox.kill(id)` static — kill by id in one HTTP call.
21
+
8
22
  ## [1.1.6]
9
23
 
10
24
  ### Added
package/README.md CHANGED
@@ -159,7 +159,8 @@ const sandbox = await Sandbox.create({ template, apiKey, timeout, network, secur
159
159
  const result = await sandbox.commands.run('ls -la');
160
160
  const stream = sandbox.commands.stream('python script.py');
161
161
 
162
- // Files
162
+ // Files — `path` is the literal absolute path inside the sandbox.
163
+ // Files appear at exactly that path — no remapping, no bridge directory.
163
164
  await sandbox.files.write(path, content);
164
165
  const data = await sandbox.files.read(path);
165
166
  const entries = await sandbox.files.list('/');
package/dist/index.cjs CHANGED
@@ -2173,6 +2173,33 @@ var Sandbox = class _Sandbox {
2173
2173
  });
2174
2174
  return data.results ?? {};
2175
2175
  }
2176
+ /**
2177
+ * Kill a sandbox by id without first connecting. Sends a single
2178
+ * `DELETE /sandboxes/:id?async=true` and skips the metadata fetch
2179
+ * `Sandbox.connect(id).kill()` would otherwise pay. Useful for bulk
2180
+ * cleanup paths that only have the id.
2181
+ *
2182
+ * @param sandboxId - the sandbox to kill.
2183
+ * @param opts.wait - if true, block until the server finishes the
2184
+ * per-VM teardown. Default is false: server returns 202 once the
2185
+ * kill is queued.
2186
+ * @param opts.requestTimeout - per-request timeout in milliseconds.
2187
+ * @param opts.config - override the default ConnectionConfig.
2188
+ * @returns true if the kill was accepted (default) or completed
2189
+ * (wait=true); false if the server reported the sandbox was
2190
+ * already dead.
2191
+ */
2192
+ static async kill(sandboxId, opts) {
2193
+ const config = opts?.config ?? new ConnectionConfig();
2194
+ const client = getSharedClient(config);
2195
+ const wait = opts?.wait === true;
2196
+ const path = wait ? `/sandboxes/${sandboxId}` : `/sandboxes/${sandboxId}?async=true`;
2197
+ const data = await client.delete(path, {
2198
+ timeout: opts?.requestTimeout
2199
+ });
2200
+ if (!wait) return data.queued ?? true;
2201
+ return data.killed ?? false;
2202
+ }
2176
2203
  /**
2177
2204
  * Check if this sandbox is currently running.
2178
2205
  *