@anthropic-ai/claude-agent-sdk 0.3.307 → 0.3.309
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/bridge.d.ts +12 -4
- package/bridge.mjs +73 -73
- package/browser-sdk.js +32 -32
- package/{core-3qt252mw.mjs → core-1qw7dszx.mjs} +1 -1
- package/core-cz9sh4ze.mjs +40 -0
- package/core-nmrdrt5c.mjs +52 -0
- package/{core-magja67b.mjs → core-nxm5bcfb.mjs} +2 -2
- package/core.mjs +8 -8
- package/extractFromBunfs.js +169 -40
- package/manifest.json +21 -23
- package/manifest.zst.json +25 -27
- package/package.json +14 -14
- package/sdk.d.ts +24 -1
- package/sdk.mjs +56 -56
- package/core-dk3ky68t.mjs +0 -52
- package/core-s632fyaa.mjs +0 -40
package/extractFromBunfs.js
CHANGED
|
@@ -6,13 +6,18 @@
|
|
|
6
6
|
// export — keep it standalone and Node-importable (no Bun globals, no
|
|
7
7
|
// local-relative imports).
|
|
8
8
|
|
|
9
|
-
import { createHash } from 'crypto'
|
|
9
|
+
import { createHash, randomBytes } from 'crypto'
|
|
10
10
|
import {
|
|
11
11
|
chmodSync,
|
|
12
|
-
|
|
12
|
+
closeSync,
|
|
13
|
+
constants as fsConstants,
|
|
14
|
+
fchmodSync,
|
|
15
|
+
fstatSync,
|
|
13
16
|
lstatSync,
|
|
14
17
|
mkdirSync,
|
|
18
|
+
openSync,
|
|
15
19
|
readFileSync,
|
|
20
|
+
readSync,
|
|
16
21
|
renameSync,
|
|
17
22
|
unlinkSync,
|
|
18
23
|
writeFileSync,
|
|
@@ -34,28 +39,30 @@ function tmpdir() {
|
|
|
34
39
|
return osTmpdir()
|
|
35
40
|
}
|
|
36
41
|
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
//
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
//
|
|
43
|
-
// (sha256 of a public npm binary) under shared `/tmp`, and
|
|
44
|
-
// `mkdirSync({recursive:true})` is a silent no-op on a pre-existing dir without
|
|
45
|
-
// enforcing owner or mode. Without this check an attacker-owned directory would
|
|
46
|
-
// be used as-is, letting them swap the binary the SDK later spawns.
|
|
42
|
+
// Per-user extraction root: `{tmpdir()}/claude-agent-sdk-{uid}` on Unix,
|
|
43
|
+
// `{tmpdir()}/claude-agent-sdk` on Windows (where %TEMP% is already per-user).
|
|
44
|
+
// Deliberately NOT Claude Code's own temp root `{tmpdir()}/claude-{uid}`: that
|
|
45
|
+
// is the writable $TMPDIR Claude Code gives the commands it runs inside the
|
|
46
|
+
// Bash-tool sandbox, while the SDK application spawns the extracted CLI with
|
|
47
|
+
// no sandbox, so it lives where the sandbox's default write roots do not reach.
|
|
47
48
|
function safeTempBase() {
|
|
48
49
|
const dir = join(
|
|
49
50
|
tmpdir(),
|
|
50
51
|
process.platform === 'win32'
|
|
51
|
-
? 'claude'
|
|
52
|
-
: `claude-${process.getuid?.() ?? 0}`,
|
|
52
|
+
? 'claude-agent-sdk'
|
|
53
|
+
: `claude-agent-sdk-${process.getuid?.() ?? 0}`,
|
|
53
54
|
)
|
|
54
|
-
//
|
|
55
|
-
//
|
|
55
|
+
// Create it 0700 and refuse anything but a directory this user owns: its
|
|
56
|
+
// name is predictable, and recursive mkdir silently accepts one that another
|
|
57
|
+
// local user pre-created in a shared /tmp. A same-user writer that reaches
|
|
58
|
+
// the temp dir can race this check; the byte comparison in extractFromBunfs()
|
|
59
|
+
// only stops it planting a file for a later start, not replacing one mid-run.
|
|
60
|
+
// Gated on getuid rather than process.platform, which tests mock.
|
|
56
61
|
if (typeof process.getuid === 'function') {
|
|
57
62
|
mkdirSync(dir, { recursive: true, mode: 0o700 })
|
|
58
63
|
const uid = process.getuid()
|
|
64
|
+
// An older, path-based copy of src/utils/tempfile.ts#verifyTempDirOwnership,
|
|
65
|
+
// which now checks and tightens the directory through one fd.
|
|
59
66
|
const st = lstatSync(dir)
|
|
60
67
|
if (!st.isDirectory()) {
|
|
61
68
|
throw new Error(
|
|
@@ -83,9 +90,86 @@ function safeTempBase() {
|
|
|
83
90
|
return dir
|
|
84
91
|
}
|
|
85
92
|
|
|
93
|
+
// Copy of src/utils/noFileIdentity.ts#hasNoFileIdentity (this file ships
|
|
94
|
+
// standalone and cannot import it): a stat file id that names no object.
|
|
95
|
+
function isNoFileId(ino) {
|
|
96
|
+
return (
|
|
97
|
+
ino === 0n ||
|
|
98
|
+
ino === -1n ||
|
|
99
|
+
ino === 0xffff_ffff_ffff_ffffn ||
|
|
100
|
+
ino === 1n << 64n
|
|
101
|
+
)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// True when `file` is a regular file (not a symlink, no second hard link)
|
|
105
|
+
// whose bytes equal `content`. A symlink or a second link would let the bytes
|
|
106
|
+
// change later through a path outside this directory.
|
|
107
|
+
function isExtractedCopy(file, content) {
|
|
108
|
+
let fd
|
|
109
|
+
let inoAtPath
|
|
110
|
+
try {
|
|
111
|
+
if (typeof process.getuid === 'function') {
|
|
112
|
+
// Judge the opened file itself: O_NOFOLLOW refuses a symlink at the path
|
|
113
|
+
// and O_NONBLOCK keeps a planted FIFO from hanging the open. Gated on
|
|
114
|
+
// getuid because Bun on Windows defines these flags with unusable values.
|
|
115
|
+
fd = openSync(
|
|
116
|
+
file,
|
|
117
|
+
fsConstants.O_RDONLY | fsConstants.O_NOFOLLOW | fsConstants.O_NONBLOCK,
|
|
118
|
+
)
|
|
119
|
+
} else {
|
|
120
|
+
const atPath = lstatSync(file, { bigint: true })
|
|
121
|
+
if (!atPath.isFile()) {
|
|
122
|
+
return false
|
|
123
|
+
}
|
|
124
|
+
inoAtPath = atPath.ino
|
|
125
|
+
fd = openSync(file, 'r')
|
|
126
|
+
}
|
|
127
|
+
const st = fstatSync(fd, { bigint: true })
|
|
128
|
+
if (
|
|
129
|
+
!st.isFile() ||
|
|
130
|
+
Number(st.nlink) !== 1 ||
|
|
131
|
+
Number(st.size) !== content.length
|
|
132
|
+
) {
|
|
133
|
+
return false
|
|
134
|
+
}
|
|
135
|
+
// Windows has no usable O_NOFOLLOW, so that open may have followed
|
|
136
|
+
// something swapped in after the lstat: treat it as not our copy unless the
|
|
137
|
+
// fd is the same file, by file id alone as in
|
|
138
|
+
// src/utils/noFileIdentity.ts#openedAnotherFile; an id of 0 or all-ones
|
|
139
|
+
// proves nothing.
|
|
140
|
+
if (
|
|
141
|
+
inoAtPath !== undefined &&
|
|
142
|
+
!isNoFileId(inoAtPath) &&
|
|
143
|
+
!isNoFileId(st.ino) &&
|
|
144
|
+
st.ino !== inoAtPath
|
|
145
|
+
) {
|
|
146
|
+
return false
|
|
147
|
+
}
|
|
148
|
+
const chunk = Buffer.allocUnsafe(1 << 20)
|
|
149
|
+
let offset = 0
|
|
150
|
+
while (offset < content.length) {
|
|
151
|
+
const n = readSync(fd, chunk, 0, chunk.length, offset)
|
|
152
|
+
if (
|
|
153
|
+
n <= 0 ||
|
|
154
|
+
!chunk.subarray(0, n).equals(content.subarray(offset, offset + n))
|
|
155
|
+
) {
|
|
156
|
+
return false
|
|
157
|
+
}
|
|
158
|
+
offset += n
|
|
159
|
+
}
|
|
160
|
+
return true
|
|
161
|
+
} catch {
|
|
162
|
+
return false
|
|
163
|
+
} finally {
|
|
164
|
+
if (fd !== undefined) {
|
|
165
|
+
closeSync(fd)
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
86
170
|
/**
|
|
87
|
-
* If `embeddedPath` is inside Bun's $bunfs
|
|
88
|
-
*
|
|
171
|
+
* If `embeddedPath` is inside Bun's $bunfs, extract it to a per-user directory
|
|
172
|
+
* under the temp dir (CLAUDE_CODE_TMPDIR if set); otherwise return it as is.
|
|
89
173
|
*
|
|
90
174
|
* Uses a content hash for the directory name so that:
|
|
91
175
|
* - Same binary version reuses the same extracted file (no accumulation)
|
|
@@ -112,39 +196,84 @@ export function extractFromBunfs(embeddedPath) {
|
|
|
112
196
|
const fileName = basename(embeddedPath)
|
|
113
197
|
const tmpPath = join(tmpDir, fileName)
|
|
114
198
|
mkdirSync(tmpDir, { recursive: true, mode: 0o700 })
|
|
115
|
-
//
|
|
116
|
-
//
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
199
|
+
// Recursive mkdir accepts an existing symlink to a directory; refuse it, or
|
|
200
|
+
// every path below would resolve wherever the link points.
|
|
201
|
+
if (!lstatSync(tmpDir).isDirectory()) {
|
|
202
|
+
throw new Error(
|
|
203
|
+
'The claude-agent-sdk-<hash> folder under the temp directory is a symlink or not a directory, possibly planted; delete it and restart',
|
|
204
|
+
)
|
|
205
|
+
}
|
|
206
|
+
// Reuse an earlier extraction only after re-reading it: a plain file with
|
|
207
|
+
// exactly these bytes. The owner-only root sits outside the Bash-tool
|
|
208
|
+
// sandbox's default write roots, but a widened write grant can still reach
|
|
209
|
+
// it; anything else found at the path is replaced below, or extraction
|
|
210
|
+
// fails. On Windows reuse also avoids renaming over the running,
|
|
211
|
+
// memory-mapped .exe, which fails.
|
|
212
|
+
if (isExtractedCopy(tmpPath, content)) {
|
|
123
213
|
return tmpPath
|
|
124
214
|
}
|
|
125
215
|
// Write to a temp file and atomically rename to avoid truncation races —
|
|
126
216
|
// concurrent readers always see either the old complete file or the new one.
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
217
|
+
// Unguessable name, exclusive create: a name planted in advance (say a
|
|
218
|
+
// symlink to a file elsewhere) is never written through or renamed into
|
|
219
|
+
// place.
|
|
220
|
+
const tmpFile = join(
|
|
221
|
+
tmpDir,
|
|
222
|
+
`${fileName}.tmp.${process.pid}.${randomBytes(8).toString('hex')}`,
|
|
223
|
+
)
|
|
224
|
+
const fd = openSync(tmpFile, 'wx', 0o700)
|
|
225
|
+
let renamed = false
|
|
130
226
|
try {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
227
|
+
try {
|
|
228
|
+
writeFileSync(fd, content)
|
|
229
|
+
// Through the fd, so a name swapped for a symlink mid-write cannot
|
|
230
|
+
// redirect the mode change to another file.
|
|
231
|
+
fchmodSync(fd, 0o755)
|
|
232
|
+
} finally {
|
|
233
|
+
closeSync(fd)
|
|
234
|
+
}
|
|
235
|
+
try {
|
|
236
|
+
renameSync(tmpFile, tmpPath)
|
|
237
|
+
} catch (e) {
|
|
238
|
+
// Bun on Windows refuses to rename onto an existing file (EEXIST, or
|
|
239
|
+
// EPERM/EBUSY while another process has that .exe mapped or a scanner
|
|
240
|
+
// briefly holds our new file). An identical copy already there (a
|
|
241
|
+
// concurrent first extraction won the race) is as good as ours;
|
|
242
|
+
// anything else is removed and the rename retried once.
|
|
243
|
+
if (e.code !== 'EEXIST' && e.code !== 'EPERM' && e.code !== 'EBUSY') {
|
|
244
|
+
throw e
|
|
245
|
+
}
|
|
246
|
+
if (isExtractedCopy(tmpPath, content)) {
|
|
247
|
+
return tmpPath
|
|
248
|
+
}
|
|
249
|
+
try {
|
|
250
|
+
unlinkSync(tmpPath)
|
|
251
|
+
} catch (unlinkError) {
|
|
252
|
+
if (unlinkError.code !== 'ENOENT') {
|
|
253
|
+
throw unlinkError
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
try {
|
|
257
|
+
renameSync(tmpFile, tmpPath)
|
|
258
|
+
} catch {
|
|
259
|
+
// A concurrent start may have put its own copy in place first.
|
|
260
|
+
if (isExtractedCopy(tmpPath, content)) {
|
|
261
|
+
return tmpPath
|
|
262
|
+
}
|
|
263
|
+
throw e
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
renamed = true
|
|
267
|
+
return tmpPath
|
|
268
|
+
} finally {
|
|
269
|
+
if (!renamed) {
|
|
138
270
|
try {
|
|
139
271
|
unlinkSync(tmpFile)
|
|
140
272
|
} catch {
|
|
141
|
-
// best-effort cleanup of our
|
|
273
|
+
// best-effort cleanup of our unused temp file
|
|
142
274
|
}
|
|
143
|
-
return tmpPath
|
|
144
275
|
}
|
|
145
|
-
throw e
|
|
146
276
|
}
|
|
147
|
-
return tmpPath
|
|
148
277
|
} catch (err) {
|
|
149
278
|
// oxlint-disable-next-line no-console -- intentional user-facing warning in standalone SDK helper
|
|
150
279
|
console.warn(
|
package/manifest.json
CHANGED
|
@@ -1,55 +1,52 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.
|
|
2
|
+
"version": "2.1.309",
|
|
3
3
|
"manifestSignatureEnforcement": "flag",
|
|
4
|
-
"commit": "
|
|
5
|
-
"buildDate": "2026-10-
|
|
4
|
+
"commit": "1ce7e4ff2da8d4b0f5c15b291e4a9b54716970c2",
|
|
5
|
+
"buildDate": "2026-10-22T19:32:59Z",
|
|
6
6
|
"platforms": {
|
|
7
7
|
"darwin-arm64": {
|
|
8
8
|
"binary": "claude",
|
|
9
|
-
"checksum": "
|
|
10
|
-
"size":
|
|
9
|
+
"checksum": "5eadc0009cdcdbc0d06e58110d7b2baf88ced6088b1c33a60a21217fe410619c",
|
|
10
|
+
"size": 275923296
|
|
11
11
|
},
|
|
12
12
|
"darwin-x64": {
|
|
13
13
|
"binary": "claude",
|
|
14
|
-
"checksum": "
|
|
15
|
-
"size":
|
|
14
|
+
"checksum": "200e0d775ae55c040db3bb8db8de3e22efcddbd7e0abff5ab50dd10f6853425d",
|
|
15
|
+
"size": 287157296
|
|
16
16
|
},
|
|
17
17
|
"linux-arm64": {
|
|
18
18
|
"binary": "claude",
|
|
19
|
-
"checksum": "
|
|
20
|
-
"size":
|
|
19
|
+
"checksum": "9796dd26899337f687739a0b39a7353b639f062a3436a7b941fcf19a1b757a9b",
|
|
20
|
+
"size": 293331128
|
|
21
21
|
},
|
|
22
22
|
"linux-x64": {
|
|
23
23
|
"binary": "claude",
|
|
24
|
-
"checksum": "
|
|
25
|
-
"size":
|
|
24
|
+
"checksum": "4d704a8aecbe038affa3000f498ae17c1b4f753add8facb8764120affc99b658",
|
|
25
|
+
"size": 293469552
|
|
26
26
|
},
|
|
27
27
|
"linux-arm64-musl": {
|
|
28
28
|
"binary": "claude",
|
|
29
|
-
"checksum": "
|
|
30
|
-
"size":
|
|
29
|
+
"checksum": "028ad6b4c0ed304a116eb1efa6f1d752630f6691aa70004a79406026a023b332",
|
|
30
|
+
"size": 285493120
|
|
31
31
|
},
|
|
32
32
|
"linux-x64-musl": {
|
|
33
33
|
"binary": "claude",
|
|
34
|
-
"checksum": "
|
|
35
|
-
"size":
|
|
34
|
+
"checksum": "0e35f4f665be93de03b383e22294e0e15860ae6f17e34be4851dfe7af732ceae",
|
|
35
|
+
"size": 287137936
|
|
36
36
|
},
|
|
37
37
|
"win32-x64": {
|
|
38
38
|
"binary": "claude.exe",
|
|
39
|
-
"checksum": "
|
|
40
|
-
"size":
|
|
39
|
+
"checksum": "5441781f2b6bbd07354b4a74560ee88c68c9bf05d6db3c7e24c452c91673dc53",
|
|
40
|
+
"size": 298624160
|
|
41
41
|
},
|
|
42
42
|
"win32-arm64": {
|
|
43
43
|
"binary": "claude.exe",
|
|
44
|
-
"checksum": "
|
|
45
|
-
"size":
|
|
44
|
+
"checksum": "063f45f61dca573b76e378f06728dc4e8f1b8600905dbd19be6d210f8c882501",
|
|
45
|
+
"size": 282697888
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
"sdkCompat": {
|
|
49
49
|
"testedWrapperVersions": [
|
|
50
|
-
"0.3.273",
|
|
51
|
-
"0.3.274",
|
|
52
|
-
"0.3.275",
|
|
53
50
|
"0.3.276",
|
|
54
51
|
"0.3.277",
|
|
55
52
|
"0.3.278",
|
|
@@ -76,7 +73,8 @@
|
|
|
76
73
|
"0.3.302",
|
|
77
74
|
"0.3.303",
|
|
78
75
|
"0.3.304",
|
|
79
|
-
"0.3.305"
|
|
76
|
+
"0.3.305",
|
|
77
|
+
"0.3.306"
|
|
80
78
|
],
|
|
81
79
|
"harnessSchema": 1
|
|
82
80
|
}
|
package/manifest.zst.json
CHANGED
|
@@ -1,63 +1,60 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "2.1.
|
|
2
|
+
"version": "2.1.309",
|
|
3
3
|
"manifestSignatureEnforcement": "flag",
|
|
4
|
-
"commit": "
|
|
5
|
-
"buildDate": "2026-10-
|
|
4
|
+
"commit": "1ce7e4ff2da8d4b0f5c15b291e4a9b54716970c2",
|
|
5
|
+
"buildDate": "2026-10-22T19:34:30Z",
|
|
6
6
|
"platforms": {
|
|
7
7
|
"darwin-arm64": {
|
|
8
8
|
"binary": "claude.zst",
|
|
9
|
-
"checksum": "
|
|
10
|
-
"size":
|
|
9
|
+
"checksum": "614eb35bb650dee9cfa4a7821a60d5eab75fbcabe2c1b8aa408d2e93f06c1370",
|
|
10
|
+
"size": 93159896,
|
|
11
11
|
"bundle": {
|
|
12
|
-
"checksum": "
|
|
13
|
-
"size":
|
|
12
|
+
"checksum": "5af865b9901c3f7512d85aa78571966834c943e3143f1b82ef4d33ed89b7f0ba",
|
|
13
|
+
"size": 93151388
|
|
14
14
|
}
|
|
15
15
|
},
|
|
16
16
|
"darwin-x64": {
|
|
17
17
|
"binary": "claude.zst",
|
|
18
|
-
"checksum": "
|
|
19
|
-
"size":
|
|
18
|
+
"checksum": "7426a8b80fe213e90b8e58682a54668aa7efe838939c9b2cab8d6089ab13befb",
|
|
19
|
+
"size": 98568120,
|
|
20
20
|
"bundle": {
|
|
21
|
-
"checksum": "
|
|
22
|
-
"size":
|
|
21
|
+
"checksum": "300ae7409767b5bf31c77b466987278ee4493cfc82099ef4ad89841f7bfc71d4",
|
|
22
|
+
"size": 98585917
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"linux-arm64": {
|
|
26
26
|
"binary": "claude.zst",
|
|
27
|
-
"checksum": "
|
|
28
|
-
"size":
|
|
27
|
+
"checksum": "a2f75e390c4afc3c610db69e7ff2587327f135f161cad5f088c2d0de6e5a9441",
|
|
28
|
+
"size": 102438847
|
|
29
29
|
},
|
|
30
30
|
"linux-x64": {
|
|
31
31
|
"binary": "claude.zst",
|
|
32
|
-
"checksum": "
|
|
33
|
-
"size":
|
|
32
|
+
"checksum": "e52289b95def16148c8d0a48b1ccc0d357429e73473a9a20ac0638fb7460a59b",
|
|
33
|
+
"size": 103411745
|
|
34
34
|
},
|
|
35
35
|
"linux-arm64-musl": {
|
|
36
36
|
"binary": "claude.zst",
|
|
37
|
-
"checksum": "
|
|
38
|
-
"size":
|
|
37
|
+
"checksum": "0a94b79920b85f8284d09d73ac8536434e37576924b7c4c6a38fce7d378417c7",
|
|
38
|
+
"size": 100788523
|
|
39
39
|
},
|
|
40
40
|
"linux-x64-musl": {
|
|
41
41
|
"binary": "claude.zst",
|
|
42
|
-
"checksum": "
|
|
43
|
-
"size":
|
|
42
|
+
"checksum": "16c3f12d7c34922ca04a991244ec10645f6fbd4da809eb79f5f86bc8e660f1f1",
|
|
43
|
+
"size": 101827875
|
|
44
44
|
},
|
|
45
45
|
"win32-x64": {
|
|
46
46
|
"binary": "claude.exe.zst",
|
|
47
|
-
"checksum": "
|
|
48
|
-
"size":
|
|
47
|
+
"checksum": "9078b9c1d466965d3faee8d13128f03d79b61794fb2130255ca1f5eab84e602c",
|
|
48
|
+
"size": 106715810
|
|
49
49
|
},
|
|
50
50
|
"win32-arm64": {
|
|
51
51
|
"binary": "claude.exe.zst",
|
|
52
|
-
"checksum": "
|
|
53
|
-
"size":
|
|
52
|
+
"checksum": "1bfeb992f9659ef84307012c5da5735cdf05da6a81ced1bea60dbddae67ecdad",
|
|
53
|
+
"size": 101912543
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
56
|
"sdkCompat": {
|
|
57
57
|
"testedWrapperVersions": [
|
|
58
|
-
"0.3.273",
|
|
59
|
-
"0.3.274",
|
|
60
|
-
"0.3.275",
|
|
61
58
|
"0.3.276",
|
|
62
59
|
"0.3.277",
|
|
63
60
|
"0.3.278",
|
|
@@ -84,7 +81,8 @@
|
|
|
84
81
|
"0.3.302",
|
|
85
82
|
"0.3.303",
|
|
86
83
|
"0.3.304",
|
|
87
|
-
"0.3.305"
|
|
84
|
+
"0.3.305",
|
|
85
|
+
"0.3.306"
|
|
88
86
|
],
|
|
89
87
|
"harnessSchema": 1
|
|
90
88
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anthropic-ai/claude-agent-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.309",
|
|
4
4
|
"main": "sdk.mjs",
|
|
5
5
|
"types": "sdk.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -61,14 +61,14 @@
|
|
|
61
61
|
"zod": "^4.0.0"
|
|
62
62
|
},
|
|
63
63
|
"optionalDependencies": {
|
|
64
|
-
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.
|
|
65
|
-
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.
|
|
66
|
-
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.
|
|
67
|
-
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.
|
|
68
|
-
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.
|
|
69
|
-
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.
|
|
70
|
-
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.
|
|
71
|
-
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.
|
|
64
|
+
"@anthropic-ai/claude-agent-sdk-linux-x64": "0.3.309",
|
|
65
|
+
"@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.309",
|
|
66
|
+
"@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.309",
|
|
67
|
+
"@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.309",
|
|
68
|
+
"@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.309",
|
|
69
|
+
"@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.309",
|
|
70
|
+
"@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.309",
|
|
71
|
+
"@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.309"
|
|
72
72
|
},
|
|
73
73
|
"files": [
|
|
74
74
|
"sdk.mjs",
|
|
@@ -85,10 +85,10 @@
|
|
|
85
85
|
"extractFromBunfs.d.ts",
|
|
86
86
|
"manifest.json",
|
|
87
87
|
"manifest.zst.json",
|
|
88
|
-
"core-
|
|
89
|
-
"core-
|
|
90
|
-
"core-
|
|
91
|
-
"core-
|
|
88
|
+
"core-1qw7dszx.mjs",
|
|
89
|
+
"core-cz9sh4ze.mjs",
|
|
90
|
+
"core-nmrdrt5c.mjs",
|
|
91
|
+
"core-nxm5bcfb.mjs"
|
|
92
92
|
],
|
|
93
|
-
"claudeCodeVersion": "2.1.
|
|
93
|
+
"claudeCodeVersion": "2.1.309"
|
|
94
94
|
}
|
package/sdk.d.ts
CHANGED
|
@@ -1287,6 +1287,9 @@ export declare type McpServerStatus = {
|
|
|
1287
1287
|
* Server configuration (includes URL for HTTP/SSE servers)
|
|
1288
1288
|
*/
|
|
1289
1289
|
config?: McpServerStatusConfig;
|
|
1290
|
+
|
|
1291
|
+
|
|
1292
|
+
|
|
1290
1293
|
/**
|
|
1291
1294
|
* Configuration scope (e.g., project, user, local, claudeai, managed)
|
|
1292
1295
|
*/
|
|
@@ -2275,6 +2278,18 @@ export declare type Options = {
|
|
|
2275
2278
|
* tier present, these apply as the sole policy tier (still filtered
|
|
2276
2279
|
* restrictive-only — non-allowlisted keys are dropped regardless).
|
|
2277
2280
|
*
|
|
2281
|
+
* Two hook keys are filtered by value rather than kept as written:
|
|
2282
|
+
* `disableAllHooks: true` binds as `allowManagedHooksOnly: true`, so the
|
|
2283
|
+
* machine administrator's own hooks keep running where the embedder's tier
|
|
2284
|
+
* cannot stop them — and because an enterprise configuration often yields
|
|
2285
|
+
* a boolean as text, any value but `false` and `"false"` binds it the same
|
|
2286
|
+
* way — and `allowedHttpHookUrls` / `httpHookAllowedEnvVars`
|
|
2287
|
+
* bind only as the empty list (admit nothing) — a non-empty one is dropped,
|
|
2288
|
+
* because these lists union across settings sources and would widen an
|
|
2289
|
+
* admin's. For the same reason an empty list binds only where no other
|
|
2290
|
+
* source sets one; pair it with `allowManagedHooksOnly` to stop a project's
|
|
2291
|
+
* HTTP hooks outright.
|
|
2292
|
+
*
|
|
2278
2293
|
* Intended for embedding applications (e.g. desktop apps) that derive
|
|
2279
2294
|
* lockdown settings from their own enterprise configuration and need to
|
|
2280
2295
|
* enforce them on the spawned subprocess without writing root-owned files.
|
|
@@ -3207,6 +3222,7 @@ export declare interface Query extends AsyncGenerator<SDKMessage, void> {
|
|
|
3207
3222
|
|
|
3208
3223
|
|
|
3209
3224
|
|
|
3225
|
+
|
|
3210
3226
|
/**
|
|
3211
3227
|
* Reconnect an MCP server by name.
|
|
3212
3228
|
* Throws on failure.
|
|
@@ -4791,6 +4807,7 @@ export declare type SDKControlInitializeResponse = {
|
|
|
4791
4807
|
|
|
4792
4808
|
|
|
4793
4809
|
|
|
4810
|
+
|
|
4794
4811
|
};
|
|
4795
4812
|
|
|
4796
4813
|
/**
|
|
@@ -4974,6 +4991,10 @@ declare type SDKControlMcpSetServersRequest = {
|
|
|
4974
4991
|
*/
|
|
4975
4992
|
declare type SDKControlMcpStatusRequest = {
|
|
4976
4993
|
subtype: 'mcp_status';
|
|
4994
|
+
/**
|
|
4995
|
+
* When true and the CLI writes to the session through CCR (a cloud session's worker, or a Remote Control worker), the success reply is published only to the clients attached at that moment, as a control_response marked live_only: true on the session's unsequenced event stream, and is not stored with the session's events; on a cloud session's worker its rows embed each server's configuration (URLs, headers, OAuth settings). Set it only if your client reads control_response frames from that stream; a reply sent while its stream is down is lost and the request must be sent again, and a reply over the live size limit comes back as a live error instead. Error replies other than that size-limit error, and every reply from hosts that do not send live replies (stdio hosts, and CLIs older than this field), are ordinary stored replies, so a client that sets it must accept either.
|
|
4996
|
+
*/
|
|
4997
|
+
liveReply?: boolean;
|
|
4977
4998
|
};
|
|
4978
4999
|
|
|
4979
5000
|
/**
|
|
@@ -5036,7 +5057,7 @@ declare type SDKControlPermissionRequest = {
|
|
|
5036
5057
|
|
|
5037
5058
|
description?: string;
|
|
5038
5059
|
/**
|
|
5039
|
-
* True when one-tap Approve/Deny must not be offered: the tool's approval card IS the user-interaction surface (Tool.requiresUserInteraction(): the user responds on the card itself), OR the pending ask is localDisplayOnly (its consent disclosure cannot ride this wire and only the local dialog renders it), OR the auto-mode classifier blocked the call and it was handed to a person (decision_reason_type 'classifier' on a person-only ask), which no stored grant or automatic approval may answer, OR the SDK host worded the ask (title and description are its consent copy, which a push cannot carry whole). In each case the user has to open the session to answer.
|
|
5060
|
+
* True when one-tap Approve/Deny must not be offered: the tool's approval card IS the user-interaction surface (Tool.requiresUserInteraction(): the user responds on the card itself), OR the pending ask is localDisplayOnly (its consent disclosure cannot ride this wire and only the local dialog renders it), OR the auto-mode classifier blocked the call and it was handed to a person (decision_reason_type 'classifier' on a person-only ask), which no stored grant or automatic approval may answer, OR the MCP server's name spells a claude.ai connector's key and the server came from neither claude.ai nor whoever launched the session, so a grant keyed on the tool name must not answer it, OR the SDK host worded the ask (title and description are its consent copy, which a push cannot carry whole). In each case the user has to open the session to answer.
|
|
5040
5061
|
*/
|
|
5041
5062
|
requires_user_interaction?: boolean;
|
|
5042
5063
|
|
|
@@ -5929,6 +5950,7 @@ export declare type SDKResultError = {
|
|
|
5929
5950
|
modelUsage: Record<string, ModelUsage>;
|
|
5930
5951
|
|
|
5931
5952
|
|
|
5953
|
+
|
|
5932
5954
|
permission_denials: SDKPermissionDenial[];
|
|
5933
5955
|
/**
|
|
5934
5956
|
* User-initiated sends still waiting in the command queue when this result was produced. Greater than 0 means at least one more user turn (and result) follows without further input, barring cancellation; 0 means none is pending, or the session is ending (end_session or a shutdown latched mid-turn discards the backlog). Queued sends may coalesce into fewer turns, so this counts pending sends, not remaining results. System-generated queue entries are not counted. Absent on fatal startup results and on surfaces without a command queue.
|
|
@@ -6045,6 +6067,7 @@ export declare type SDKResultSuccess = {
|
|
|
6045
6067
|
modelUsage: Record<string, ModelUsage>;
|
|
6046
6068
|
|
|
6047
6069
|
|
|
6070
|
+
|
|
6048
6071
|
permission_denials: SDKPermissionDenial[];
|
|
6049
6072
|
/**
|
|
6050
6073
|
* User-initiated sends still waiting in the command queue when this result was produced. Greater than 0 means at least one more user turn (and result) follows without further input, barring cancellation; 0 means none is pending, or the session is ending (end_session or a shutdown latched mid-turn discards the backlog). Queued sends may coalesce into fewer turns, so this counts pending sends, not remaining results. System-generated queue entries are not counted. Absent on fatal startup results and on surfaces without a command queue.
|