@coder/ai-sdk-sandbox 0.4.0 → 0.4.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.
- package/README.md +22 -20
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,12 +11,13 @@ you pass it as the `sandbox` to a `HarnessAgent` exactly like
|
|
|
11
11
|
`@ai-sdk/sandbox-vercel`.
|
|
12
12
|
|
|
13
13
|
> **Status:** experimental. This provider tracks the stable AI SDK v7 harness
|
|
14
|
-
> packages (`@ai-sdk/harness
|
|
14
|
+
> packages (see the `@ai-sdk/harness` peer range in
|
|
15
|
+
> [`package.json`](./package.json)).
|
|
15
16
|
|
|
16
17
|
## Install
|
|
17
18
|
|
|
18
19
|
```bash
|
|
19
|
-
|
|
20
|
+
pnpm add @coder/ai-sdk-sandbox @ai-sdk/harness @ai-sdk/harness-claude-code @ai-sdk/provider-utils
|
|
20
21
|
```
|
|
21
22
|
|
|
22
23
|
Choose one host transport:
|
|
@@ -38,7 +39,7 @@ import { createClaudeCode } from "@ai-sdk/harness-claude-code";
|
|
|
38
39
|
import { createCoderWorkspace } from "@coder/ai-sdk-sandbox";
|
|
39
40
|
|
|
40
41
|
const agent = new HarnessAgent({
|
|
41
|
-
harness: createClaudeCode({ thinking: "adaptive" }),
|
|
42
|
+
harness: createClaudeCode({ thinking: { type: "adaptive" } }),
|
|
42
43
|
sandbox: createCoderWorkspace({ workspace: "my-dev-workspace" }),
|
|
43
44
|
instructions: "You are a careful coding assistant.",
|
|
44
45
|
});
|
|
@@ -92,7 +93,7 @@ the session ends. Add a `create` block:
|
|
|
92
93
|
|
|
93
94
|
```ts
|
|
94
95
|
const agent = new HarnessAgent({
|
|
95
|
-
harness: createClaudeCode({ thinking: "adaptive" }),
|
|
96
|
+
harness: createClaudeCode({ thinking: { type: "adaptive" } }),
|
|
96
97
|
sandbox: createCoderWorkspace({
|
|
97
98
|
create: {
|
|
98
99
|
template: "docker", // required: the template to create from
|
|
@@ -201,7 +202,7 @@ For an interactive chat in your terminal instead of one-shot `generate()` calls,
|
|
|
201
202
|
wrap the same agent with the AI SDK terminal UI ([`@ai-sdk/tui`](https://ai-sdk.dev/v7/docs/ai-sdk-harnesses/terminal-ui)):
|
|
202
203
|
|
|
203
204
|
```bash
|
|
204
|
-
|
|
205
|
+
pnpm add @ai-sdk/tui
|
|
205
206
|
```
|
|
206
207
|
|
|
207
208
|
The TUI drives a session-less agent, so adapt the `HarnessAgent` (whose
|
|
@@ -215,7 +216,7 @@ import { runAgentTUI, type AgentTUIAgent } from "@ai-sdk/tui";
|
|
|
215
216
|
import { createCoderWorkspace } from "@coder/ai-sdk-sandbox";
|
|
216
217
|
|
|
217
218
|
const agent = new HarnessAgent({
|
|
218
|
-
harness: createClaudeCode({ thinking: "adaptive" }),
|
|
219
|
+
harness: createClaudeCode({ thinking: { type: "adaptive" } }),
|
|
219
220
|
sandbox: createCoderWorkspace({ workspace: "my-dev-ws" }),
|
|
220
221
|
// or, to create a fresh workspace per session from a template:
|
|
221
222
|
// sandbox: createCoderWorkspace({ create: { template: 'claude-code-test' } }),
|
|
@@ -389,27 +390,28 @@ and a full Claude Code turn with tool use (`scripts/e2e-claude.ts`).
|
|
|
389
390
|
## Development
|
|
390
391
|
|
|
391
392
|
```bash
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
393
|
+
# From this package's directory (packages/sandbox):
|
|
394
|
+
pnpm install
|
|
395
|
+
pnpm typecheck # tsc against the real harness types
|
|
396
|
+
pnpm test # vitest: unit + local integration (fake `coder` + `ssh`)
|
|
397
|
+
pnpm build # tsup → dist/ (ESM + d.ts)
|
|
396
398
|
|
|
397
|
-
# Formatting & linting (
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
399
|
+
# Formatting & linting are root-level scripts (`-w` runs them from anywhere in the repo):
|
|
400
|
+
pnpm -w format # oxfmt (apply formatting)
|
|
401
|
+
pnpm -w lint # oxlint (report lint issues)
|
|
402
|
+
pnpm -w check # format check + lint + typecheck (CI gate)
|
|
401
403
|
|
|
402
404
|
# End-to-end against a real workspace (needs the coder CLI + a running workspace):
|
|
403
|
-
|
|
405
|
+
pnpm verify:real my-ws
|
|
404
406
|
|
|
405
|
-
# The same contract through Coderd directly. The CLI is used only to
|
|
406
|
-
#
|
|
407
|
+
# The same contract through Coderd directly. The CLI is used only to mint a
|
|
408
|
+
# token for this shell; CoderNativeTransport never invokes it:
|
|
407
409
|
CODER_URL=https://coder.example.com \
|
|
408
|
-
CODER_SESSION_TOKEN="$(coder
|
|
409
|
-
|
|
410
|
+
CODER_SESSION_TOKEN="$(coder tokens create --name ai-sdk-sandbox)" \
|
|
411
|
+
pnpm verify:native my-ws
|
|
410
412
|
|
|
411
413
|
# End-to-end of create mode (creates a throwaway workspace, then deletes it):
|
|
412
|
-
|
|
414
|
+
pnpm verify:create docker
|
|
413
415
|
```
|
|
414
416
|
|
|
415
417
|
The local integration tests exercise the real transport (argument building,
|