@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.
@@ -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
- existsSync,
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
- // Inlined from src/utils/tempfile.ts#claudeTempDir + verifyTempDirOwnership —
38
- // keep behavior in sync. Per-UID Claude temp directory: `{tmpdir()}/claude-{uid}`
39
- // on Unix, `{tmpdir()}/claude` on Windows (where %TEMP% is already per-user).
40
- //
41
- // Defense-in-depth against a local attacker pre-creating the extraction dir
42
- // before the victim's first run: the content-hash dir name is fully predictable
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
- // Gate on getuid (POSIX-only) rather than process.platform: getuid presence
55
- // reflects the real OS. No-op on Windows where %TEMP% is already per-user.
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 virtual filesystem, extract it to a
88
- * temp directory and return the real path. Otherwise return the path unchanged.
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
- // The directory is content-hash-keyed, so an existing tmpPath is byte-
116
- // identical to what we would write — short-circuit. This is a write
117
- // idempotency check on a content-addressed path, not a read TOCTOU
118
- // (the existence IS the contract). Without it, a second call (or a
119
- // concurrent app instance) on Windows would hit EPERM/EBUSY renaming over
120
- // the memory-mapped running .exe and fall back to the unspawnable $bunfs
121
- // path. It also skips a redundant write+chmod on every call.
122
- if (existsSync(tmpPath)) {
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
- const tmpFile = join(tmpDir, `${fileName}.tmp.${process.pid}`)
128
- writeFileSync(tmpFile, content)
129
- chmodSync(tmpFile, 0o755)
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
- renameSync(tmpFile, tmpPath)
132
- } catch (e) {
133
- if ((e.code === 'EPERM' || e.code === 'EBUSY') && existsSync(tmpPath)) {
134
- // Lost a concurrent first-time-extraction race on Windows: the winner's
135
- // child holds tmpPath memory-mapped, so the loser's rename over it fails.
136
- // The content-hash dir guarantees byte-identity, so the winner's file is
137
- // exactly what we'd have written — use it.
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 orphaned .tmp.{pid} file
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.307",
2
+ "version": "2.1.309",
3
3
  "manifestSignatureEnforcement": "flag",
4
- "commit": "b208bbbc9ae5dc87a1a0a7f964be47e27a0543ab",
5
- "buildDate": "2026-10-21T20:07:02Z",
4
+ "commit": "1ce7e4ff2da8d4b0f5c15b291e4a9b54716970c2",
5
+ "buildDate": "2026-10-22T19:32:59Z",
6
6
  "platforms": {
7
7
  "darwin-arm64": {
8
8
  "binary": "claude",
9
- "checksum": "5b113a7752119470f1da419cb0e608af3361cae25b614216b13022093958fb2a",
10
- "size": 274428784
9
+ "checksum": "5eadc0009cdcdbc0d06e58110d7b2baf88ced6088b1c33a60a21217fe410619c",
10
+ "size": 275923296
11
11
  },
12
12
  "darwin-x64": {
13
13
  "binary": "claude",
14
- "checksum": "f569c691f072acf92d3e11ca46c8de34a267157f3c80f3a3e6b5267478f52dfe",
15
- "size": 285620896
14
+ "checksum": "200e0d775ae55c040db3bb8db8de3e22efcddbd7e0abff5ab50dd10f6853425d",
15
+ "size": 287157296
16
16
  },
17
17
  "linux-arm64": {
18
18
  "binary": "claude",
19
- "checksum": "1c67968ab8410c9644e2f4867167a0dab1a8c6c9de9cc83fe78449e5ae8a3633",
20
- "size": 291889336
19
+ "checksum": "9796dd26899337f687739a0b39a7353b639f062a3436a7b941fcf19a1b757a9b",
20
+ "size": 293331128
21
21
  },
22
22
  "linux-x64": {
23
23
  "binary": "claude",
24
- "checksum": "6021eb72d20d0682b720bdc63acd2a5cd2270895d1f10d9ca2a88cbfa7b9dd0e",
25
- "size": 291974512
24
+ "checksum": "4d704a8aecbe038affa3000f498ae17c1b4f753add8facb8764120affc99b658",
25
+ "size": 293469552
26
26
  },
27
27
  "linux-arm64-musl": {
28
28
  "binary": "claude",
29
- "checksum": "31324c33dca077a5edb54a5eb8dec711d34c18c59966c52311489a6d71649907",
30
- "size": 284050776
29
+ "checksum": "028ad6b4c0ed304a116eb1efa6f1d752630f6691aa70004a79406026a023b332",
30
+ "size": 285493120
31
31
  },
32
32
  "linux-x64-musl": {
33
33
  "binary": "claude",
34
- "checksum": "cb89e2aad16a971a0ee7367cbb1810083b67428598fdb76e8e4b460b7ee7a1bf",
35
- "size": 285630064
34
+ "checksum": "0e35f4f665be93de03b383e22294e0e15860ae6f17e34be4851dfe7af732ceae",
35
+ "size": 287137936
36
36
  },
37
37
  "win32-x64": {
38
38
  "binary": "claude.exe",
39
- "checksum": "9537b37daacedc5a21f0f35e04d4fa6759c0bd969ddf2e56052810f63b27c918",
40
- "size": 297079456
39
+ "checksum": "5441781f2b6bbd07354b4a74560ee88c68c9bf05d6db3c7e24c452c91673dc53",
40
+ "size": 298624160
41
41
  },
42
42
  "win32-arm64": {
43
43
  "binary": "claude.exe",
44
- "checksum": "75293206f795325fbef0ead9d6cfd97e50b19cac9b7af75696d8a9619171e3ea",
45
- "size": 281273504
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.307",
2
+ "version": "2.1.309",
3
3
  "manifestSignatureEnforcement": "flag",
4
- "commit": "b208bbbc9ae5dc87a1a0a7f964be47e27a0543ab",
5
- "buildDate": "2026-10-21T20:08:45Z",
4
+ "commit": "1ce7e4ff2da8d4b0f5c15b291e4a9b54716970c2",
5
+ "buildDate": "2026-10-22T19:34:30Z",
6
6
  "platforms": {
7
7
  "darwin-arm64": {
8
8
  "binary": "claude.zst",
9
- "checksum": "c1db200f9efacada14c923952d0c322dc9c0d40ce04fe4da5dc63c0d709c7b69",
10
- "size": 92716037,
9
+ "checksum": "614eb35bb650dee9cfa4a7821a60d5eab75fbcabe2c1b8aa408d2e93f06c1370",
10
+ "size": 93159896,
11
11
  "bundle": {
12
- "checksum": "5463eea87c4bf480ebf4654aef7caeb4102a86f7ea424975ed206e36f84b808f",
13
- "size": 92724310
12
+ "checksum": "5af865b9901c3f7512d85aa78571966834c943e3143f1b82ef4d33ed89b7f0ba",
13
+ "size": 93151388
14
14
  }
15
15
  },
16
16
  "darwin-x64": {
17
17
  "binary": "claude.zst",
18
- "checksum": "d622c6b8052f392850121db7992fc0536efb41c077503b7c673d611074ba8642",
19
- "size": 98099753,
18
+ "checksum": "7426a8b80fe213e90b8e58682a54668aa7efe838939c9b2cab8d6089ab13befb",
19
+ "size": 98568120,
20
20
  "bundle": {
21
- "checksum": "f0eca963fa93bd1c0188453ca2516739100c4040de6b91847b9833f47814b3bb",
22
- "size": 98107586
21
+ "checksum": "300ae7409767b5bf31c77b466987278ee4493cfc82099ef4ad89841f7bfc71d4",
22
+ "size": 98585917
23
23
  }
24
24
  },
25
25
  "linux-arm64": {
26
26
  "binary": "claude.zst",
27
- "checksum": "4bcc6b9a2461cb5e02f2b8cf6f1b2ca4abeae334d2917bb1f9d1deacc54474aa",
28
- "size": 101995322
27
+ "checksum": "a2f75e390c4afc3c610db69e7ff2587327f135f161cad5f088c2d0de6e5a9441",
28
+ "size": 102438847
29
29
  },
30
30
  "linux-x64": {
31
31
  "binary": "claude.zst",
32
- "checksum": "3dcae6ae2d87b75c22ca2f957c6266dbcbf351beabbbb58fa61f4145a1198075",
33
- "size": 102978767
32
+ "checksum": "e52289b95def16148c8d0a48b1ccc0d357429e73473a9a20ac0638fb7460a59b",
33
+ "size": 103411745
34
34
  },
35
35
  "linux-arm64-musl": {
36
36
  "binary": "claude.zst",
37
- "checksum": "80cfcca501f1ac05436abbd2f35414898992f97afbe9181d9a5d0787f556fd2b",
38
- "size": 100346509
37
+ "checksum": "0a94b79920b85f8284d09d73ac8536434e37576924b7c4c6a38fce7d378417c7",
38
+ "size": 100788523
39
39
  },
40
40
  "linux-x64-musl": {
41
41
  "binary": "claude.zst",
42
- "checksum": "4d36df0a600d68a9e15f6d285e8e6a70322dc9b490db6932488cbbbbb3336433",
43
- "size": 101391955
42
+ "checksum": "16c3f12d7c34922ca04a991244ec10645f6fbd4da809eb79f5f86bc8e660f1f1",
43
+ "size": 101827875
44
44
  },
45
45
  "win32-x64": {
46
46
  "binary": "claude.exe.zst",
47
- "checksum": "7cb3ef7c497dce6ef7de069c5e0bb314c22e9f2947776a31d156b146daccfd3a",
48
- "size": 106263804
47
+ "checksum": "9078b9c1d466965d3faee8d13128f03d79b61794fb2130255ca1f5eab84e602c",
48
+ "size": 106715810
49
49
  },
50
50
  "win32-arm64": {
51
51
  "binary": "claude.exe.zst",
52
- "checksum": "b726b532f5fc94bf76af5ec1663e61fc39dc2278f1db827e55a716c8c43e0aa4",
53
- "size": 101476081
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.307",
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.307",
65
- "@anthropic-ai/claude-agent-sdk-linux-arm64": "0.3.307",
66
- "@anthropic-ai/claude-agent-sdk-linux-x64-musl": "0.3.307",
67
- "@anthropic-ai/claude-agent-sdk-linux-arm64-musl": "0.3.307",
68
- "@anthropic-ai/claude-agent-sdk-darwin-x64": "0.3.307",
69
- "@anthropic-ai/claude-agent-sdk-darwin-arm64": "0.3.307",
70
- "@anthropic-ai/claude-agent-sdk-win32-x64": "0.3.307",
71
- "@anthropic-ai/claude-agent-sdk-win32-arm64": "0.3.307"
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-3qt252mw.mjs",
89
- "core-dk3ky68t.mjs",
90
- "core-magja67b.mjs",
91
- "core-s632fyaa.mjs"
88
+ "core-1qw7dszx.mjs",
89
+ "core-cz9sh4ze.mjs",
90
+ "core-nmrdrt5c.mjs",
91
+ "core-nxm5bcfb.mjs"
92
92
  ],
93
- "claudeCodeVersion": "2.1.307"
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.