@ai-sdk/harness-claude-code 1.0.167 → 1.0.169
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 +23 -0
- package/README.md +4 -23
- package/dist/bridge/index.mjs +1 -1
- package/dist/bridge/index.mjs.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +31 -203
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- package/src/bridge/create-emit-stream-event.ts +8 -1
- package/src/claude-code-harness.ts +43 -325
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @ai-sdk/harness-claude-code
|
|
2
2
|
|
|
3
|
+
## 1.0.169
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 39aae54: fix(harness): ensure harness adapters always resolve the model used
|
|
8
|
+
- a15b2a9: add onDebug setting to observe bridge connection events
|
|
9
|
+
- Updated dependencies [e64ed82]
|
|
10
|
+
- @ai-sdk/provider-utils@5.0.69
|
|
11
|
+
- @ai-sdk/harness@1.0.165
|
|
12
|
+
|
|
13
|
+
## 1.0.168
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- a9837eb: feat(harness): provide shared utils for bridge-backed adapters to manage web socket connection and bridge handshake
|
|
18
|
+
- e729d58: chore(docs): update `README.md` for consistent format and to avoid duplication
|
|
19
|
+
- Updated dependencies [5475347]
|
|
20
|
+
- Updated dependencies [a9837eb]
|
|
21
|
+
- Updated dependencies [e729d58]
|
|
22
|
+
- @ai-sdk/provider@4.0.34
|
|
23
|
+
- @ai-sdk/harness@1.0.164
|
|
24
|
+
- @ai-sdk/provider-utils@5.0.68
|
|
25
|
+
|
|
3
26
|
## 1.0.167
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
`HarnessV1` adapter backed by [`@anthropic-ai/claude-agent-sdk`](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk), which drives the `claude` CLI. The adapter ships a bridge process that runs inside a sandbox and talks to the host over a WebSocket on a sandbox-proxied loopback port.
|
|
4
4
|
|
|
5
|
+
-> **Note**: This package is experimental.
|
|
6
|
+
|
|
5
7
|
## Setup
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
|
-
npm i @ai-sdk/harness-claude-code @ai-sdk/harness @ai-sdk/sandbox-vercel
|
|
10
|
+
npm i ai @ai-sdk/harness-claude-code @ai-sdk/harness @ai-sdk/sandbox-vercel zod
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
The bridge installs `@anthropic-ai/claude-agent-sdk` and `@anthropic-ai/claude-code` inside the sandbox the first time the session starts.
|
|
12
|
-
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```ts
|
|
@@ -63,23 +63,4 @@ try {
|
|
|
63
63
|
}
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
sandbox lifecycle: ending the harness session does not stop the sandbox.
|
|
68
|
-
|
|
69
|
-
## Runtime configuration
|
|
70
|
-
|
|
71
|
-
Use `env` to add environment variables to the Claude Code process. Configured
|
|
72
|
-
values override variables inherited from the sandbox bridge process.
|
|
73
|
-
|
|
74
|
-
```ts
|
|
75
|
-
const harness = createClaudeCode({
|
|
76
|
-
env: {
|
|
77
|
-
DEPLOYMENT_ENV: 'staging',
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Sub-agent messages and task/background notifications are surfaced as `raw`
|
|
83
|
-
stream parts. `agentProgressSummaries` adds periodic summaries to raw
|
|
84
|
-
`task_progress` messages, while `forwardSubagentText` includes sub-agent text
|
|
85
|
-
and thinking messages in the raw stream.
|
|
66
|
+
See the [Claude Code Harness documentation](https://ai-sdk.dev/providers/ai-sdk-harnesses/claude-code) for more information.
|
package/dist/bridge/index.mjs
CHANGED
|
@@ -730,7 +730,7 @@ function createEmitStreamEvent({ state, emit, emitWarning, emitTerminalError, on
|
|
|
730
730
|
let streamStarted = false;
|
|
731
731
|
return (msg) => {
|
|
732
732
|
const type = msg.type;
|
|
733
|
-
if (!streamStarted) {
|
|
733
|
+
if (!streamStarted && type !== "command_lifecycle") {
|
|
734
734
|
const initModel = type === "system" && msg.subtype === "init" && typeof msg.model === "string" ? msg.model : void 0;
|
|
735
735
|
emit({
|
|
736
736
|
type: "stream-start",
|