@archildata/ai-sdk-harness 0.0.1 → 0.0.2-next.20261201223110

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/README.md CHANGED
@@ -1,38 +1,60 @@
1
1
  # @archildata/ai-sdk-harness
2
2
 
3
- Archil sandboxes for [AI SDK harness](https://ai-sdk.dev/v7/docs/ai-sdk-harnesses/overview) agents.
3
+ [Archil](https://archil.com) sandboxes for
4
+ [AI SDK harness](https://ai-sdk.dev/v7/docs/ai-sdk-harnesses/overview) agents. Run coding
5
+ agents such as Claude Code and Codex in an Archil sandbox with `HarnessAgent`.
6
+
7
+ Full documentation is at [docs.archil.com](https://docs.archil.com/integrations/ai-sdk-harness).
4
8
 
5
9
  ## Install
6
10
 
7
11
  ```sh
8
- npm install disk @archildata/ai-sdk @archildata/ai-sdk-harness @ai-sdk/harness
12
+ npm install ai disk @ai-sdk/harness @archildata/ai-sdk @archildata/ai-sdk-harness
9
13
  ```
10
14
 
11
- Set `ARCHIL_API_KEY` and `ARCHIL_REGION`, or pass an Archil client as `client`.
15
+ Set `ARCHIL_API_KEY` and `ARCHIL_REGION`, or pass an `Archil` client as `client`.
12
16
 
13
17
  ## Usage
14
18
 
15
19
  ```ts
20
+ import { HarnessAgent } from "@ai-sdk/harness/agent";
21
+ import { createClaudeCode } from "@ai-sdk/harness-claude-code";
16
22
  import { createArchilNetworkSandboxSession } from "@archildata/ai-sdk-harness";
17
23
 
24
+ const agent = new HarnessAgent({ harness: createClaudeCode(), id: "coder" });
25
+
18
26
  const sandboxSession = await createArchilNetworkSandboxSession({
19
27
  ports: [4000],
20
28
  setupCommands: ["corepack enable pnpm"],
21
29
  template: await agent.getSandboxTemplate(),
22
30
  });
23
31
  const session = await agent.createSession({ sandboxSession });
32
+
33
+ const result = await agent.generate({ session, prompt: "Add a README to this project." });
34
+
35
+ await session.destroy();
36
+ await sandboxSession.destroy();
24
37
  ```
25
38
 
26
- Any `sandboxes.create()` setting can be passed, such as `baseImage`, `vcpuCount`, `memSizeMiB`, or `env`. `setupCommands` run once on a fresh sandbox before the harness sets it up; the Claude Code and Codex adapters need `pnpm`, which the default image enables through corepack. Sandboxes get `IS_SANDBOX=1`, which lets Claude Code run as root.
39
+ `createArchilNetworkSandboxSession` takes any `sandboxes.create()` setting, such as
40
+ `baseImage`, `vcpuCount`, `memSizeMiB`, or `env`, plus:
41
+
42
+ - `ports`: ports the harness connects to. Each is reached privately with a port token.
43
+ - `setupCommands`: commands run once on a fresh sandbox before the harness sets it up. The
44
+ Claude Code and Codex adapters install with `pnpm`, which `corepack enable pnpm` provides
45
+ on the default image.
46
+ - `template`: setup prepared once in a sandbox that is then stopped. Each session forks
47
+ from it.
48
+
49
+ Sandboxes get `IS_SANDBOX=1`, which lets Claude Code run as root. Network policy and
50
+ credentials use Archil egress rules, so credentials are added to requests outside the
51
+ sandbox; paid plans can change a sandbox's network policy.
27
52
 
28
- - **Ports** are private. Each endpoint carries a port token that Archil's proxy checks, so nothing is exposed publicly.
29
- - **Network policy and request transformations** use Archil egress rules, so credentials are added to requests outside the sandbox. They are unavailable on free plans, whose network policy cannot be changed.
30
- - **Templates** are prepared once in a sandbox that is then stopped, and each session forks from it.
31
- - **`stop()`** pauses the sandbox and **`destroy()`** deletes it.
32
- - **Resume** finds the sandbox by name, the session's `id`:
53
+ `stop()` pauses the sandbox and `destroy()` deletes it. To reattach to a paused sandbox,
54
+ pass its name, the session's `id`, to `resumeArchilNetworkSandboxSession`:
33
55
 
34
56
  ```ts
35
57
  import { resumeArchilNetworkSandboxSession } from "@archildata/ai-sdk-harness";
36
58
 
37
- const sandbox = await resumeArchilNetworkSandboxSession({ sandboxId, ports: [4000] });
59
+ const sandboxSession = await resumeArchilNetworkSandboxSession({ sandboxId, ports: [4000] });
38
60
  ```
package/dist/index.d.mts CHANGED
@@ -99,8 +99,8 @@ type ArchilNetworkSandboxSessionResumeOptions = HarnessV1SandboxSessionResumeOpt
99
99
  * stopped, and every session forks from it.
100
100
  *
101
101
  * ```ts
102
- * const sandbox = await createArchilNetworkSandboxSession({ ports: [4000] });
103
- * const session = await agent.createSession({ sandbox });
102
+ * const sandboxSession = await createArchilNetworkSandboxSession({ ports: [4000] });
103
+ * const session = await agent.createSession({ sandboxSession });
104
104
  * ```
105
105
  */
106
106
  declare function createArchilNetworkSandboxSession(options?: ArchilNetworkSandboxSessionCreateOptions): Promise<HarnessV1NetworkSandboxSession>;
package/dist/index.mjs CHANGED
@@ -247,8 +247,8 @@ const TEMPLATE_WAIT_MS = 30 * 6e4;
247
247
  * stopped, and every session forks from it.
248
248
  *
249
249
  * ```ts
250
- * const sandbox = await createArchilNetworkSandboxSession({ ports: [4000] });
251
- * const session = await agent.createSession({ sandbox });
250
+ * const sandboxSession = await createArchilNetworkSandboxSession({ ports: [4000] });
251
+ * const session = await agent.createSession({ sandboxSession });
252
252
  * ```
253
253
  */
254
254
  async function createArchilNetworkSandboxSession(options = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archildata/ai-sdk-harness",
3
- "version": "0.0.1",
3
+ "version": "0.0.2-next.20261201223110",
4
4
  "description": "Archil sandboxes for AI SDK harness agents",
5
5
  "keywords": [
6
6
  "archil",
@@ -29,16 +29,16 @@
29
29
  ],
30
30
  "peerDependencies": {
31
31
  "@ai-sdk/harness": "^1.0.196",
32
- "@archildata/ai-sdk": "0.0.30",
32
+ "@archildata/ai-sdk": "0.0.31-next.20261201223110",
33
33
  "ai": "^7.0.184",
34
- "disk": "1.16.0"
34
+ "disk": "1.16.1-next.20261201223110"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@ai-sdk/harness": "^1.0.196",
38
- "@archildata/ai-sdk": "0.0.30",
38
+ "@archildata/ai-sdk": "0.0.31-next.20261201223110",
39
39
  "@types/node": "^20.19.43",
40
40
  "ai": "^7.0.184",
41
- "disk": "1.16.0",
41
+ "disk": "1.16.1-next.20261201223110",
42
42
  "tsdown": "^0.22.3",
43
43
  "typescript": "^6.0.3",
44
44
  "vitest": "^4.1.9"