@namzu/sdk 74.0.0 → 75.0.0

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.
Files changed (271) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/dist/bridge/acp/server.d.ts +2 -0
  3. package/dist/bridge/acp/server.d.ts.map +1 -1
  4. package/dist/bridge/acp/server.js +9 -1
  5. package/dist/bridge/acp/server.js.map +1 -1
  6. package/dist/config/runtime.d.ts +3 -3
  7. package/dist/connector/mcp/adapter.d.ts +1 -1
  8. package/dist/connector/mcp/adapter.d.ts.map +1 -1
  9. package/dist/connector/mcp/adapter.js +3 -2
  10. package/dist/connector/mcp/adapter.js.map +1 -1
  11. package/dist/connector/mcp/client.d.ts +4 -25
  12. package/dist/connector/mcp/client.d.ts.map +1 -1
  13. package/dist/connector/mcp/client.js +32 -32
  14. package/dist/connector/mcp/client.js.map +1 -1
  15. package/dist/index.d.ts +1 -0
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +1 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/manager/session/turn-recorder.d.ts +1 -0
  20. package/dist/manager/session/turn-recorder.d.ts.map +1 -1
  21. package/dist/manager/session/turn-recorder.js +31 -7
  22. package/dist/manager/session/turn-recorder.js.map +1 -1
  23. package/dist/pricing/catalogue.generated.d.ts.map +1 -1
  24. package/dist/pricing/catalogue.generated.js +176 -21
  25. package/dist/pricing/catalogue.generated.js.map +1 -1
  26. package/dist/provider/errors.d.ts.map +1 -1
  27. package/dist/provider/errors.js +13 -18
  28. package/dist/provider/errors.js.map +1 -1
  29. package/dist/provider/stream-request-timeout.d.ts +9 -0
  30. package/dist/provider/stream-request-timeout.d.ts.map +1 -0
  31. package/dist/provider/stream-request-timeout.js +34 -0
  32. package/dist/provider/stream-request-timeout.js.map +1 -0
  33. package/dist/public-runtime.d.ts +2 -0
  34. package/dist/public-runtime.d.ts.map +1 -1
  35. package/dist/public-runtime.js +2 -0
  36. package/dist/public-runtime.js.map +1 -1
  37. package/dist/public-tools.d.ts +1 -1
  38. package/dist/public-tools.d.ts.map +1 -1
  39. package/dist/public-tools.js +1 -1
  40. package/dist/public-tools.js.map +1 -1
  41. package/dist/runtime/query/executor.d.ts +3 -0
  42. package/dist/runtime/query/executor.d.ts.map +1 -1
  43. package/dist/runtime/query/executor.js +15 -3
  44. package/dist/runtime/query/executor.js.map +1 -1
  45. package/dist/runtime/query/file-evidence-replay.d.ts +1 -0
  46. package/dist/runtime/query/file-evidence-replay.d.ts.map +1 -1
  47. package/dist/runtime/query/file-evidence-replay.js +64 -21
  48. package/dist/runtime/query/file-evidence-replay.js.map +1 -1
  49. package/dist/runtime/query/file-evidence-seed.d.ts +7 -0
  50. package/dist/runtime/query/file-evidence-seed.d.ts.map +1 -1
  51. package/dist/runtime/query/file-evidence-seed.js +12 -1
  52. package/dist/runtime/query/file-evidence-seed.js.map +1 -1
  53. package/dist/runtime/query/guard.d.ts.map +1 -1
  54. package/dist/runtime/query/guard.js +12 -2
  55. package/dist/runtime/query/guard.js.map +1 -1
  56. package/dist/runtime/query/index.d.ts +2 -0
  57. package/dist/runtime/query/index.d.ts.map +1 -1
  58. package/dist/runtime/query/index.js +6 -2
  59. package/dist/runtime/query/index.js.map +1 -1
  60. package/dist/runtime/query/iteration/index.d.ts +3 -0
  61. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  62. package/dist/runtime/query/iteration/index.js +32 -11
  63. package/dist/runtime/query/iteration/index.js.map +1 -1
  64. package/dist/runtime/query/iteration/phases/advisory.js +2 -2
  65. package/dist/runtime/query/iteration/phases/advisory.js.map +1 -1
  66. package/dist/runtime/query/path-escalation.d.ts.map +1 -1
  67. package/dist/runtime/query/path-escalation.js +4 -3
  68. package/dist/runtime/query/path-escalation.js.map +1 -1
  69. package/dist/runtime/query/prepare-turn.d.ts.map +1 -1
  70. package/dist/runtime/query/prepare-turn.js +1 -1
  71. package/dist/runtime/query/prepare-turn.js.map +1 -1
  72. package/dist/runtime/query/tooling.d.ts +2 -0
  73. package/dist/runtime/query/tooling.d.ts.map +1 -1
  74. package/dist/runtime/query/tooling.js +1 -0
  75. package/dist/runtime/query/tooling.js.map +1 -1
  76. package/dist/sandbox/file-walk-program.js +1 -1
  77. package/dist/sandbox/ignore-matcher.d.ts +2 -0
  78. package/dist/sandbox/ignore-matcher.d.ts.map +1 -1
  79. package/dist/sandbox/ignore-matcher.js +8 -2
  80. package/dist/sandbox/ignore-matcher.js.map +1 -1
  81. package/dist/sandbox/ignore-source.d.ts.map +1 -1
  82. package/dist/sandbox/ignore-source.js +51 -7
  83. package/dist/sandbox/ignore-source.js.map +1 -1
  84. package/dist/sandbox/limit-error.d.ts +7 -0
  85. package/dist/sandbox/limit-error.d.ts.map +1 -0
  86. package/dist/sandbox/limit-error.js +13 -0
  87. package/dist/sandbox/limit-error.js.map +1 -0
  88. package/dist/sandbox/provider/local.d.ts +1 -0
  89. package/dist/sandbox/provider/local.d.ts.map +1 -1
  90. package/dist/sandbox/provider/local.js +95 -31
  91. package/dist/sandbox/provider/local.js.map +1 -1
  92. package/dist/schedules/cron.js +1 -1
  93. package/dist/schedules/cron.js.map +1 -1
  94. package/dist/schedules/describe.js +1 -1
  95. package/dist/schedules/describe.js.map +1 -1
  96. package/dist/schedules/next-fire.d.ts +2 -2
  97. package/dist/schedules/next-fire.d.ts.map +1 -1
  98. package/dist/schedules/next-fire.js +7 -4
  99. package/dist/schedules/next-fire.js.map +1 -1
  100. package/dist/schedules/spec.d.ts.map +1 -1
  101. package/dist/schedules/spec.js +23 -7
  102. package/dist/schedules/spec.js.map +1 -1
  103. package/dist/schedules/types.d.ts +2 -0
  104. package/dist/schedules/types.d.ts.map +1 -1
  105. package/dist/store/budget/ledger.d.ts +15 -1
  106. package/dist/store/budget/ledger.d.ts.map +1 -1
  107. package/dist/store/budget/ledger.js +80 -1
  108. package/dist/store/budget/ledger.js.map +1 -1
  109. package/dist/store/evidence/source-text.d.ts +1 -1
  110. package/dist/store/session-index/sqlite.d.ts.map +1 -1
  111. package/dist/store/session-index/sqlite.js +7 -3
  112. package/dist/store/session-index/sqlite.js.map +1 -1
  113. package/dist/store/session-log/core.d.ts.map +1 -1
  114. package/dist/store/session-log/core.js +88 -24
  115. package/dist/store/session-log/core.js.map +1 -1
  116. package/dist/store/session-log/disk.js +1 -1
  117. package/dist/store/session-log/disk.js.map +1 -1
  118. package/dist/tools/builtins/atomic-write-file.d.ts +2 -0
  119. package/dist/tools/builtins/atomic-write-file.d.ts.map +1 -1
  120. package/dist/tools/builtins/atomic-write-file.js +37 -8
  121. package/dist/tools/builtins/atomic-write-file.js.map +1 -1
  122. package/dist/tools/builtins/code-analysis.d.ts.map +1 -1
  123. package/dist/tools/builtins/code-analysis.js +4 -1
  124. package/dist/tools/builtins/code-analysis.js.map +1 -1
  125. package/dist/tools/builtins/edit-apply.d.ts.map +1 -1
  126. package/dist/tools/builtins/edit-apply.js +24 -10
  127. package/dist/tools/builtins/edit-apply.js.map +1 -1
  128. package/dist/tools/builtins/edit.d.ts.map +1 -1
  129. package/dist/tools/builtins/edit.js +31 -15
  130. package/dist/tools/builtins/edit.js.map +1 -1
  131. package/dist/tools/builtins/file-text.d.ts +3 -0
  132. package/dist/tools/builtins/file-text.d.ts.map +1 -0
  133. package/dist/tools/builtins/file-text.js +14 -0
  134. package/dist/tools/builtins/file-text.js.map +1 -0
  135. package/dist/tools/builtins/glob.d.ts.map +1 -1
  136. package/dist/tools/builtins/glob.js +7 -2
  137. package/dist/tools/builtins/glob.js.map +1 -1
  138. package/dist/tools/builtins/grep.d.ts.map +1 -1
  139. package/dist/tools/builtins/grep.js +8 -5
  140. package/dist/tools/builtins/grep.js.map +1 -1
  141. package/dist/tools/builtins/ls.d.ts.map +1 -1
  142. package/dist/tools/builtins/ls.js +2 -1
  143. package/dist/tools/builtins/ls.js.map +1 -1
  144. package/dist/tools/builtins/notebook-edit.d.ts.map +1 -1
  145. package/dist/tools/builtins/notebook-edit.js +19 -10
  146. package/dist/tools/builtins/notebook-edit.js.map +1 -1
  147. package/dist/tools/builtins/read-file.d.ts.map +1 -1
  148. package/dist/tools/builtins/read-file.js +61 -29
  149. package/dist/tools/builtins/read-file.js.map +1 -1
  150. package/dist/tools/builtins/read-regular-file.d.ts +5 -0
  151. package/dist/tools/builtins/read-regular-file.d.ts.map +1 -0
  152. package/dist/tools/builtins/read-regular-file.js +23 -0
  153. package/dist/tools/builtins/read-regular-file.js.map +1 -0
  154. package/dist/tools/builtins/search-support.d.ts +2 -0
  155. package/dist/tools/builtins/search-support.d.ts.map +1 -1
  156. package/dist/tools/builtins/search-support.js +14 -0
  157. package/dist/tools/builtins/search-support.js.map +1 -1
  158. package/dist/tools/builtins/stale-before-review.d.ts.map +1 -1
  159. package/dist/tools/builtins/stale-before-review.js +8 -5
  160. package/dist/tools/builtins/stale-before-review.js.map +1 -1
  161. package/dist/tools/builtins/write-file.d.ts.map +1 -1
  162. package/dist/tools/builtins/write-file.js +17 -13
  163. package/dist/tools/builtins/write-file.js.map +1 -1
  164. package/dist/tools/defineTool.d.ts.map +1 -1
  165. package/dist/tools/defineTool.js +4 -3
  166. package/dist/tools/defineTool.js.map +1 -1
  167. package/dist/tools/paths.d.ts +9 -0
  168. package/dist/tools/paths.d.ts.map +1 -1
  169. package/dist/tools/paths.js +39 -9
  170. package/dist/tools/paths.js.map +1 -1
  171. package/dist/tools/posix-path.d.ts +2 -14
  172. package/dist/tools/posix-path.d.ts.map +1 -1
  173. package/dist/tools/posix-path.js +7 -0
  174. package/dist/tools/posix-path.js.map +1 -1
  175. package/dist/tools/tool-is-available.d.ts +4 -0
  176. package/dist/tools/tool-is-available.d.ts.map +1 -0
  177. package/dist/tools/tool-is-available.js +8 -0
  178. package/dist/tools/tool-is-available.js.map +1 -0
  179. package/dist/types/code-analysis/index.d.ts +1 -1
  180. package/dist/types/code-analysis/index.d.ts.map +1 -1
  181. package/dist/types/common/index.d.ts +6 -0
  182. package/dist/types/common/index.d.ts.map +1 -1
  183. package/dist/types/common/index.js +13 -0
  184. package/dist/types/common/index.js.map +1 -1
  185. package/dist/types/provider/errors.d.ts.map +1 -1
  186. package/dist/types/provider/errors.js +3 -5
  187. package/dist/types/provider/errors.js.map +1 -1
  188. package/dist/types/sandbox/index.d.ts +13 -2
  189. package/dist/types/sandbox/index.d.ts.map +1 -1
  190. package/dist/types/sandbox/index.js.map +1 -1
  191. package/dist/types/session/checkpoint.d.ts +4 -0
  192. package/dist/types/session/checkpoint.d.ts.map +1 -1
  193. package/dist/types/session/checkpoint.js +2 -0
  194. package/dist/types/session/checkpoint.js.map +1 -1
  195. package/dist/types/session/events.d.ts +1 -0
  196. package/dist/types/session/events.d.ts.map +1 -1
  197. package/dist/types/session/events.js.map +1 -1
  198. package/dist/types/session/records.d.ts +42 -6
  199. package/dist/types/session/records.d.ts.map +1 -1
  200. package/dist/types/session/records.js +1 -0
  201. package/dist/types/session/records.js.map +1 -1
  202. package/dist/types/tool/index.d.ts +2 -0
  203. package/dist/types/tool/index.d.ts.map +1 -1
  204. package/dist/types/tool/index.js.map +1 -1
  205. package/dist/utils/cost.d.ts +17 -0
  206. package/dist/utils/cost.d.ts.map +1 -1
  207. package/dist/utils/cost.js +78 -8
  208. package/dist/utils/cost.js.map +1 -1
  209. package/package.json +1 -1
  210. package/src/bridge/acp/server.ts +16 -7
  211. package/src/connector/mcp/adapter.ts +4 -3
  212. package/src/connector/mcp/client.ts +33 -32
  213. package/src/index.ts +2 -0
  214. package/src/manager/session/turn-recorder.ts +31 -7
  215. package/src/pricing/catalogue.generated.ts +176 -21
  216. package/src/pricing/rates.source.json +108 -33
  217. package/src/provider/errors.ts +12 -19
  218. package/src/provider/stream-request-timeout.ts +34 -0
  219. package/src/public-runtime.ts +2 -0
  220. package/src/public-tools.ts +1 -0
  221. package/src/runtime/query/executor.ts +29 -3
  222. package/src/runtime/query/file-evidence-replay.ts +73 -19
  223. package/src/runtime/query/file-evidence-seed.ts +16 -0
  224. package/src/runtime/query/guard.ts +13 -2
  225. package/src/runtime/query/index.ts +10 -1
  226. package/src/runtime/query/iteration/index.ts +32 -11
  227. package/src/runtime/query/iteration/phases/advisory.ts +2 -2
  228. package/src/runtime/query/path-escalation.ts +4 -3
  229. package/src/runtime/query/prepare-turn.ts +2 -1
  230. package/src/runtime/query/tooling.ts +3 -0
  231. package/src/sandbox/file-walk-program.ts +1 -1
  232. package/src/sandbox/ignore-matcher.ts +12 -3
  233. package/src/sandbox/ignore-source.ts +51 -7
  234. package/src/sandbox/limit-error.ts +10 -0
  235. package/src/sandbox/provider/local.ts +107 -48
  236. package/src/schedules/cron.ts +1 -1
  237. package/src/schedules/describe.ts +1 -1
  238. package/src/schedules/next-fire.ts +7 -4
  239. package/src/schedules/spec.ts +36 -7
  240. package/src/schedules/types.ts +2 -0
  241. package/src/store/budget/ledger.ts +93 -2
  242. package/src/store/session-index/sqlite.ts +8 -4
  243. package/src/store/session-log/core.ts +96 -25
  244. package/src/store/session-log/disk.ts +1 -1
  245. package/src/tools/builtins/atomic-write-file.ts +49 -7
  246. package/src/tools/builtins/code-analysis.ts +6 -1
  247. package/src/tools/builtins/edit-apply.ts +25 -10
  248. package/src/tools/builtins/edit.ts +31 -15
  249. package/src/tools/builtins/file-text.ts +14 -0
  250. package/src/tools/builtins/glob.ts +6 -1
  251. package/src/tools/builtins/grep.ts +7 -5
  252. package/src/tools/builtins/ls.ts +2 -1
  253. package/src/tools/builtins/notebook-edit.ts +18 -11
  254. package/src/tools/builtins/read-file.ts +71 -24
  255. package/src/tools/builtins/read-regular-file.ts +25 -0
  256. package/src/tools/builtins/search-support.ts +13 -0
  257. package/src/tools/builtins/stale-before-review.ts +8 -6
  258. package/src/tools/builtins/write-file.ts +18 -12
  259. package/src/tools/defineTool.ts +4 -3
  260. package/src/tools/paths.ts +49 -7
  261. package/src/tools/posix-path.ts +9 -0
  262. package/src/tools/tool-is-available.ts +11 -0
  263. package/src/types/code-analysis/index.ts +1 -1
  264. package/src/types/common/index.ts +24 -0
  265. package/src/types/provider/errors.ts +3 -5
  266. package/src/types/sandbox/index.ts +12 -1
  267. package/src/types/session/checkpoint.ts +2 -0
  268. package/src/types/session/events.ts +1 -0
  269. package/src/types/session/records.ts +1 -0
  270. package/src/types/tool/index.ts +2 -0
  271. package/src/utils/cost.ts +101 -8
@@ -71,7 +71,7 @@
71
71
  "promptIncludesCacheReads": false,
72
72
  "reportsCacheWrites": true,
73
73
  "webSearchPer1000": 10,
74
- "note": "The last two rows exist because the driver's own offline catalogue offers those models and this table did not price them — a lookup-key gap that reads as `cost unknown` and is invisible to the generator's own check, which only proves the module matches this file. `providers/anthropic` asserts the two lists agree. Vendor list prices, every row checked against its pricing page on the `verified` date. Cache read is the vendor's published 0.1x of the input rate, except on the six models it prices differently: 0.05x on claude-opus-5-5 and claude-sonnet-5-5 and 0.025x on claude-fable-5-1, claude-mythos-5-1, claude-fable-5-2 and claude-mythos-5-2, entered at the published rate rather than derived. The claude-haiku-5-5 tiers were checked on 2026-12-04 at https://platform.claude.com/docs/en/about-claude/pricing. The higher rates apply to the whole request above 100,000 prompt tokens, including cache reads and writes in the threshold count. Cache write is its published 1.25x for the five-minute entry, which is the default TTL and the one the driver's `cacheControl: { type: 'auto' }` asks for. claude-sonnet-5 launched at an introductory $2/$10 with $3/$15 scheduled from 2026-09-01, and this table recorded the scheduled rate; the vendor has since made $2/$10 the standard price and cancelled the increase. The table has no time dimension, so a future promotional window is still recorded at the list rate and over-reported rather than mis-modelled.",
74
+ "note": "The last two rows exist because the driver's own offline catalogue offers those models and this table did not price them — a lookup-key gap that reads as `cost unknown` and is invisible to the generator's own check, which only proves the module matches this file. `providers/anthropic` asserts the two lists agree. Vendor list prices, every row checked against its pricing page on the `verified` date. Cache read is the vendor's published 0.1x of the input rate, except on the six models it prices differently: 0.05x on claude-opus-5-5 and claude-sonnet-5-5 and 0.025x on claude-fable-5-1, claude-mythos-5-1, claude-fable-5-2 and claude-mythos-5-2, entered at the published rate rather than derived. The claude-haiku-5-5 tiers were checked on 2026-12-04 at https://platform.claude.com/docs/en/about-claude/pricing. The higher rates apply to the whole request above 100,000 prompt tokens, including cache reads and writes in the threshold count. Cache write is its published 1.25x for the five-minute entry, which is the default TTL and the one the driver's `cacheControl: { type: 'auto' }` asks for. The one-hour rate is 2x input. The direct API applies a 1.1x US-only surcharge on eligible models. claude-sonnet-5 launched at an introductory $2/$10 with $3/$15 scheduled from 2026-09-01, and this table recorded the scheduled rate; the vendor has since made $2/$10 the standard price and cancelled the increase. The table has no time dimension, so a future promotional window is still recorded at the list rate and over-reported rather than mis-modelled.",
75
75
  "models": [
76
76
  {
77
77
  "id": "claude-fable-5-2",
@@ -79,7 +79,9 @@
79
79
  "outputPer1M": 40,
80
80
  "cacheReadPer1M": 0.2,
81
81
  "cacheWritePer1M": 10,
82
- "fastMultiplier": 2
82
+ "fastMultiplier": 2,
83
+ "cacheWrite1hPer1M": 16,
84
+ "usMultiplier": 1.1
83
85
  },
84
86
  {
85
87
  "id": "claude-mythos-5-2",
@@ -87,21 +89,27 @@
87
89
  "outputPer1M": 40,
88
90
  "cacheReadPer1M": 0.2,
89
91
  "cacheWritePer1M": 10,
90
- "fastMultiplier": 2
92
+ "fastMultiplier": 2,
93
+ "cacheWrite1hPer1M": 16,
94
+ "usMultiplier": 1.1
91
95
  },
92
96
  {
93
97
  "id": "claude-fable-5-1",
94
98
  "inputPer1M": 10,
95
99
  "outputPer1M": 50,
96
100
  "cacheReadPer1M": 0.25,
97
- "cacheWritePer1M": 12.5
101
+ "cacheWritePer1M": 12.5,
102
+ "cacheWrite1hPer1M": 20,
103
+ "usMultiplier": 1.1
98
104
  },
99
105
  {
100
106
  "id": "claude-mythos-5-1",
101
107
  "inputPer1M": 10,
102
108
  "outputPer1M": 50,
103
109
  "cacheReadPer1M": 0.25,
104
- "cacheWritePer1M": 12.5
110
+ "cacheWritePer1M": 12.5,
111
+ "cacheWrite1hPer1M": 20,
112
+ "usMultiplier": 1.1
105
113
  },
106
114
  {
107
115
  "id": "claude-opus-5-5",
@@ -109,28 +117,36 @@
109
117
  "outputPer1M": 20,
110
118
  "cacheReadPer1M": 0.2,
111
119
  "cacheWritePer1M": 5,
112
- "fastMultiplier": 2
120
+ "fastMultiplier": 2,
121
+ "cacheWrite1hPer1M": 8,
122
+ "usMultiplier": 1.1
113
123
  },
114
124
  {
115
125
  "id": "claude-sonnet-5-5",
116
126
  "inputPer1M": 2,
117
127
  "outputPer1M": 10,
118
128
  "cacheReadPer1M": 0.1,
119
- "cacheWritePer1M": 2.5
129
+ "cacheWritePer1M": 2.5,
130
+ "cacheWrite1hPer1M": 4,
131
+ "usMultiplier": 1.1
120
132
  },
121
133
  {
122
134
  "id": "claude-fable-5",
123
135
  "inputPer1M": 10,
124
136
  "outputPer1M": 50,
125
137
  "cacheReadPer1M": 1,
126
- "cacheWritePer1M": 12.5
138
+ "cacheWritePer1M": 12.5,
139
+ "cacheWrite1hPer1M": 20,
140
+ "usMultiplier": 1.1
127
141
  },
128
142
  {
129
143
  "id": "claude-mythos-5",
130
144
  "inputPer1M": 10,
131
145
  "outputPer1M": 50,
132
146
  "cacheReadPer1M": 1,
133
- "cacheWritePer1M": 12.5
147
+ "cacheWritePer1M": 12.5,
148
+ "cacheWrite1hPer1M": 20,
149
+ "usMultiplier": 1.1
134
150
  },
135
151
  {
136
152
  "id": "claude-opus-5",
@@ -138,7 +154,9 @@
138
154
  "outputPer1M": 25,
139
155
  "cacheReadPer1M": 0.5,
140
156
  "cacheWritePer1M": 6.25,
141
- "fastMultiplier": 2
157
+ "fastMultiplier": 2,
158
+ "cacheWrite1hPer1M": 10,
159
+ "usMultiplier": 1.1
142
160
  },
143
161
  {
144
162
  "id": "claude-opus-4-8",
@@ -146,35 +164,44 @@
146
164
  "outputPer1M": 25,
147
165
  "cacheReadPer1M": 0.5,
148
166
  "cacheWritePer1M": 6.25,
149
- "fastMultiplier": 2
167
+ "cacheWrite1hPer1M": 10,
168
+ "usMultiplier": 1.1
150
169
  },
151
170
  {
152
171
  "id": "claude-opus-4-7",
153
172
  "inputPer1M": 5,
154
173
  "outputPer1M": 25,
155
174
  "cacheReadPer1M": 0.5,
156
- "cacheWritePer1M": 6.25
175
+ "cacheWritePer1M": 6.25,
176
+ "cacheWrite1hPer1M": 10,
177
+ "usMultiplier": 1.1
157
178
  },
158
179
  {
159
180
  "id": "claude-opus-4-6",
160
181
  "inputPer1M": 5,
161
182
  "outputPer1M": 25,
162
183
  "cacheReadPer1M": 0.5,
163
- "cacheWritePer1M": 6.25
184
+ "cacheWritePer1M": 6.25,
185
+ "cacheWrite1hPer1M": 10,
186
+ "usMultiplier": 1.1
164
187
  },
165
188
  {
166
189
  "id": "claude-sonnet-5",
167
190
  "inputPer1M": 2,
168
191
  "outputPer1M": 10,
169
192
  "cacheReadPer1M": 0.2,
170
- "cacheWritePer1M": 2.5
193
+ "cacheWritePer1M": 2.5,
194
+ "cacheWrite1hPer1M": 4,
195
+ "usMultiplier": 1.1
171
196
  },
172
197
  {
173
198
  "id": "claude-sonnet-4-6",
174
199
  "inputPer1M": 3,
175
200
  "outputPer1M": 15,
176
201
  "cacheReadPer1M": 0.3,
177
- "cacheWritePer1M": 3.75
202
+ "cacheWritePer1M": 3.75,
203
+ "cacheWrite1hPer1M": 6,
204
+ "usMultiplier": 1.1
178
205
  },
179
206
  {
180
207
  "id": "claude-haiku-5-5",
@@ -182,12 +209,15 @@
182
209
  "outputPer1M": 0.5,
183
210
  "cacheReadPer1M": 0.01,
184
211
  "cacheWritePer1M": 0.125,
212
+ "cacheWrite1hPer1M": 0.2,
213
+ "usMultiplier": 1.1,
185
214
  "longContext": {
186
215
  "aboveInputTokens": 100000,
187
216
  "inputPer1M": 0.5,
188
217
  "outputPer1M": 2.5,
189
218
  "cacheReadPer1M": 0.05,
190
- "cacheWritePer1M": 0.625
219
+ "cacheWritePer1M": 0.625,
220
+ "cacheWrite1hPer1M": 1
191
221
  }
192
222
  },
193
223
  {
@@ -195,35 +225,40 @@
195
225
  "inputPer1M": 1,
196
226
  "outputPer1M": 5,
197
227
  "cacheReadPer1M": 0.1,
198
- "cacheWritePer1M": 1.25
228
+ "cacheWritePer1M": 1.25,
229
+ "cacheWrite1hPer1M": 2
199
230
  },
200
231
  {
201
232
  "id": "claude-sonnet-4",
202
233
  "inputPer1M": 3,
203
234
  "outputPer1M": 15,
204
235
  "cacheReadPer1M": 0.3,
205
- "cacheWritePer1M": 3.75
236
+ "cacheWritePer1M": 3.75,
237
+ "cacheWrite1hPer1M": 6
206
238
  },
207
239
  {
208
240
  "id": "claude-sonnet-4-5",
209
241
  "inputPer1M": 3,
210
242
  "outputPer1M": 15,
211
243
  "cacheReadPer1M": 0.3,
212
- "cacheWritePer1M": 3.75
244
+ "cacheWritePer1M": 3.75,
245
+ "cacheWrite1hPer1M": 6
213
246
  },
214
247
  {
215
248
  "id": "claude-opus-4",
216
249
  "inputPer1M": 15,
217
250
  "outputPer1M": 75,
218
251
  "cacheReadPer1M": 1.5,
219
- "cacheWritePer1M": 18.75
252
+ "cacheWritePer1M": 18.75,
253
+ "cacheWrite1hPer1M": 30
220
254
  },
221
255
  {
222
256
  "id": "claude-opus-4-1",
223
257
  "inputPer1M": 15,
224
258
  "outputPer1M": 75,
225
259
  "cacheReadPer1M": 1.5,
226
- "cacheWritePer1M": 18.75
260
+ "cacheWritePer1M": 18.75,
261
+ "cacheWrite1hPer1M": 30
227
262
  }
228
263
  ]
229
264
  },
@@ -245,7 +280,8 @@
245
280
  "aboveInputTokens": 272000,
246
281
  "inputPer1M": 16,
247
282
  "outputPer1M": 60,
248
- "cacheReadPer1M": 0.8
283
+ "cacheReadPer1M": 0.8,
284
+ "fastMultiplier": 2
249
285
  }
250
286
  },
251
287
  {
@@ -270,7 +306,8 @@
270
306
  "aboveInputTokens": 272000,
271
307
  "inputPer1M": 4,
272
308
  "outputPer1M": 15,
273
- "cacheReadPer1M": 0.2
309
+ "cacheReadPer1M": 0.2,
310
+ "fastMultiplier": 2
274
311
  }
275
312
  },
276
313
  {
@@ -295,7 +332,8 @@
295
332
  "aboveInputTokens": 272000,
296
333
  "inputPer1M": 4,
297
334
  "outputPer1M": 15,
298
- "cacheReadPer1M": 0.2
335
+ "cacheReadPer1M": 0.2,
336
+ "fastMultiplier": 2
299
337
  }
300
338
  },
301
339
  {
@@ -320,7 +358,8 @@
320
358
  "aboveInputTokens": 272000,
321
359
  "inputPer1M": 2,
322
360
  "outputPer1M": 7.5,
323
- "cacheReadPer1M": 0.1
361
+ "cacheReadPer1M": 0.1,
362
+ "fastMultiplier": 2
324
363
  }
325
364
  },
326
365
  {
@@ -333,7 +372,8 @@
333
372
  "aboveInputTokens": 272000,
334
373
  "inputPer1M": 20,
335
374
  "outputPer1M": 75,
336
- "cacheReadPer1M": 2
375
+ "cacheReadPer1M": 2,
376
+ "fastMultiplier": 2
337
377
  }
338
378
  },
339
379
  {
@@ -358,7 +398,8 @@
358
398
  "aboveInputTokens": 272000,
359
399
  "inputPer1M": 0.2,
360
400
  "outputPer1M": 0.75,
361
- "cacheReadPer1M": 0.02
401
+ "cacheReadPer1M": 0.02,
402
+ "fastMultiplier": 2
362
403
  }
363
404
  },
364
405
  {
@@ -371,7 +412,8 @@
371
412
  "aboveInputTokens": 272000,
372
413
  "inputPer1M": 4,
373
414
  "outputPer1M": 15,
374
- "cacheReadPer1M": 0.4
415
+ "cacheReadPer1M": 0.4,
416
+ "fastMultiplier": 2
375
417
  }
376
418
  },
377
419
  {
@@ -379,35 +421,68 @@
379
421
  "inputPer1M": 5,
380
422
  "outputPer1M": 30,
381
423
  "cacheReadPer1M": 0.5,
382
- "fastMultiplier": 2
424
+ "fastMultiplier": 2,
425
+ "longContext": {
426
+ "aboveInputTokens": 272000,
427
+ "inputPer1M": 10,
428
+ "outputPer1M": 45,
429
+ "cacheReadPer1M": 1,
430
+ "fastMultiplier": 2
431
+ }
383
432
  },
384
433
  {
385
434
  "id": "gpt-5.6-terra",
386
435
  "inputPer1M": 2,
387
436
  "outputPer1M": 12,
388
437
  "cacheReadPer1M": 0.2,
389
- "fastMultiplier": 2
438
+ "fastMultiplier": 2,
439
+ "longContext": {
440
+ "aboveInputTokens": 272000,
441
+ "inputPer1M": 4,
442
+ "outputPer1M": 18,
443
+ "cacheReadPer1M": 0.4,
444
+ "fastMultiplier": 2
445
+ }
390
446
  },
391
447
  {
392
448
  "id": "gpt-5.6-luna",
393
449
  "inputPer1M": 0.2,
394
450
  "outputPer1M": 1.2,
395
451
  "cacheReadPer1M": 0.02,
396
- "fastMultiplier": 2
452
+ "fastMultiplier": 2,
453
+ "longContext": {
454
+ "aboveInputTokens": 272000,
455
+ "inputPer1M": 0.4,
456
+ "outputPer1M": 1.8,
457
+ "cacheReadPer1M": 0.04,
458
+ "fastMultiplier": 2
459
+ }
397
460
  },
398
461
  {
399
462
  "id": "gpt-5.5",
400
463
  "inputPer1M": 5,
401
464
  "outputPer1M": 30,
402
465
  "cacheReadPer1M": 0.5,
403
- "fastMultiplier": 2.5
466
+ "fastMultiplier": 2.5,
467
+ "longContext": {
468
+ "aboveInputTokens": 272000,
469
+ "inputPer1M": 10,
470
+ "outputPer1M": 45,
471
+ "cacheReadPer1M": 1
472
+ }
404
473
  },
405
474
  {
406
475
  "id": "gpt-5.4",
407
476
  "inputPer1M": 2.5,
408
477
  "outputPer1M": 15,
409
478
  "cacheReadPer1M": 0.25,
410
- "fastMultiplier": 2
479
+ "fastMultiplier": 2,
480
+ "longContext": {
481
+ "aboveInputTokens": 272000,
482
+ "inputPer1M": 5,
483
+ "outputPer1M": 22.5,
484
+ "cacheReadPer1M": 0.5
485
+ }
411
486
  },
412
487
  {
413
488
  "id": "gpt-5.4-mini",
@@ -135,25 +135,18 @@ function providerCode(value: unknown): string | undefined {
135
135
  }
136
136
 
137
137
  /**
138
- * A vendor can name a spent allowance in `type` instead of `code`
139
- * (`{"error":{"type":"usage_limit_reached"}}`, `{"error":{"type":"billing_error"}}`).
140
- * Only those identifiers are lifted to a provider code; any other `type` is a
141
- * category and stays where it was.
138
+ * A vendor can report an allowance failure in `type` or in the error's
139
+ * `details.error_code`. Lift known allowance identifiers to a provider code.
142
140
  */
143
- function usageLimitTypeOf(error: unknown): string | undefined {
144
- if (typeof error !== 'object' || error === null) return undefined
145
- const outer = error as { type?: unknown; error?: unknown }
146
- const inner =
147
- typeof outer.error === 'object' && outer.error !== null
148
- ? (outer.error as { type?: unknown; error?: unknown })
149
- : undefined
150
- const innermost =
151
- typeof inner?.error === 'object' && inner.error !== null
152
- ? (inner.error as { type?: unknown })
153
- : undefined
154
- for (const candidate of [outer.type, inner?.type, innermost?.type]) {
155
- if (typeof candidate === 'string' && isUsageLimitSignal(candidate, undefined)) {
156
- return safeProviderCode(candidate)
141
+ function usageLimitCodeOf(error: unknown): string | undefined {
142
+ const outer = parsedBody(error)
143
+ const inner = parsedBody(outer?.error)
144
+ const innermost = parsedBody(inner?.error)
145
+ for (const record of [outer, inner, innermost]) {
146
+ const details = parsedBody(record?.details)
147
+ for (const value of [details?.error_code, record?.error_code, record?.type]) {
148
+ const code = safeProviderCode(value)
149
+ if (code !== undefined && isUsageLimitSignal(code, undefined)) return code
157
150
  }
158
151
  }
159
152
  return undefined
@@ -581,7 +574,7 @@ export function providerVendorError(input: {
581
574
  }): ProviderRequestError {
582
575
  const { error } = input
583
576
  const status = vendorErrorStatus(error)
584
- const exactProviderCode = providerCode(error) ?? usageLimitTypeOf(error)
577
+ const exactProviderCode = providerCode(error) ?? usageLimitCodeOf(error)
585
578
  const name = error instanceof Error ? error.name : ''
586
579
  const message = error instanceof Error ? error.message : ''
587
580
 
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Give each network operation in a streaming request a fresh timeout, using
3
+ * one signal for fetch and its body. Run the setup and each body read in
4
+ * sequence so time spent processing or yielding chunks uses no timer.
5
+ */
6
+ export function createStreamRequestTimeout(timeoutMs: number, caller?: AbortSignal) {
7
+ if (!Number.isInteger(timeoutMs) || timeoutMs < 0 || timeoutMs > 0xffff_ffff) {
8
+ throw new RangeError('Stream timeout must be an unsigned 32-bit integer in milliseconds')
9
+ }
10
+ const controller = new AbortController()
11
+ const signal = caller ? AbortSignal.any([caller, controller.signal]) : controller.signal
12
+
13
+ return {
14
+ async run<T>(operation: (signal: AbortSignal) => Promise<T>): Promise<T> {
15
+ signal.throwIfAborted()
16
+ const timer = setTimeout(() => {
17
+ controller.abort(
18
+ new DOMException('The operation was aborted due to timeout', 'TimeoutError'),
19
+ )
20
+ }, timeoutMs)
21
+ timer.unref()
22
+ try {
23
+ const result = await operation(signal)
24
+ signal.throwIfAborted()
25
+ return result
26
+ } catch (error) {
27
+ signal.throwIfAborted()
28
+ throw error
29
+ } finally {
30
+ clearTimeout(timer)
31
+ }
32
+ },
33
+ }
34
+ }
@@ -1014,6 +1014,7 @@ export {
1014
1014
 
1015
1015
  // ─── providers, sandbox, vault ───────────────────────────────────────────
1016
1016
 
1017
+ export { createStreamRequestTimeout } from './provider/stream-request-timeout.js'
1017
1018
  export {
1018
1019
  classifyProviderError,
1019
1020
  DEFAULT_PROVIDER_RETRY,
@@ -1073,6 +1074,7 @@ export type {
1073
1074
  LocalSandboxProviderOptions,
1074
1075
  SandboxFileWalkExec,
1075
1076
  } from './sandbox/index.js'
1077
+ export { SandboxLimitError } from './sandbox/limit-error.js'
1076
1078
 
1077
1079
  // The classified provider-failure surface: a driver states what went wrong
1078
1080
  // first-hand, and the turn boundary reads it to choose between a pause and a
@@ -335,6 +335,7 @@ export type { LedgerReplayReport } from './runtime/query/file-evidence-replay.js
335
335
  */
336
336
  export {
337
337
  type ObservationSeedContext,
338
+ replayFileComparisonBodies,
338
339
  seedObservationLedger,
339
340
  } from './runtime/query/file-evidence-seed.js'
340
341
 
@@ -22,10 +22,18 @@ import {
22
22
  } from '../../tools/builtins/bash-cwd.js'
23
23
  import { BashTool } from '../../tools/builtins/bash.js'
24
24
  import { fingerprintContent } from '../../tools/builtins/content-fingerprint.js'
25
+ import { EditTool } from '../../tools/builtins/edit.js'
26
+ import { ReadFileTool } from '../../tools/builtins/read-file.js'
27
+ import { WriteFileTool } from '../../tools/builtins/write-file.js'
25
28
  import { sandboxShellSpawn, withoutBashStartup } from '../../tools/command-shell.js'
26
29
  import { isAlwaysDestructive } from '../../tools/defineTool.js'
27
30
  import { createFileReadTracker } from '../../tools/file-read-tracker.js'
28
- import { pathOutsideRoots, resolveWithinAnyReal, toolRoots } from '../../tools/paths.js'
31
+ import {
32
+ isAllowedFile,
33
+ pathOutsideRoots,
34
+ resolveWithinAnyReal,
35
+ toolRoots,
36
+ } from '../../tools/paths.js'
29
37
  import { resolveRetainedOutput } from '../../tools/retained-output.js'
30
38
  import { isTrustedReadOnly } from '../../tools/trusted-read-only.js'
31
39
  import type { ToolManager } from '../../toolsets/manager.js'
@@ -402,6 +410,8 @@ export interface ToolExecutorConfig {
402
410
  workingDirectory: string
403
411
  /** See `ToolContext.additionalDirectories`. */
404
412
  additionalDirectories?: readonly string[]
413
+ /** Host-owned absolute file paths available to read, write and edit, including in a sandbox. */
414
+ allowedFiles?: readonly string[]
405
415
  /**
406
416
  * Where this session's own scratch folder is. It becomes a root of the file
407
417
  * tools once it has been made and checked, a write inside it needs no review,
@@ -1475,6 +1485,18 @@ export class ToolExecutor {
1475
1485
  return this.publishPreparedBatch(calls, escalations, scratchpadWrites)
1476
1486
  }
1477
1487
 
1488
+ private isAllowedToolFile(tool: ToolDefinition, path: string): boolean {
1489
+ return (
1490
+ (tool.execute === ReadFileTool.execute ||
1491
+ tool.execute === WriteFileTool.execute ||
1492
+ tool.execute === EditTool.execute) &&
1493
+ isAllowedFile(
1494
+ { workingDirectory: this.config.workingDirectory, allowedFiles: this.config.allowedFiles },
1495
+ path,
1496
+ )
1497
+ )
1498
+ }
1499
+
1478
1500
  /**
1479
1501
  * A file tool's path outside the roots, refused with the host's own words
1480
1502
  * (`QueryParams.outsideRootRefusal`) instead of the tool's generic one.
@@ -1498,7 +1520,7 @@ export class ToolExecutor {
1498
1520
  try {
1499
1521
  const retained =
1500
1522
  tool.name === 'read' && (await resolveRetainedOutput(this.outputDirectory(), value))
1501
- if (retained) return call
1523
+ if (retained || this.isAllowedToolFile(tool, value)) return call
1502
1524
  const outside = await pathOutsideRoots(this.rootsNow(), value)
1503
1525
  if (outside === undefined) return call
1504
1526
  return {
@@ -1624,7 +1646,10 @@ export class ToolExecutor {
1624
1646
  // result that was cut told the model to look.
1625
1647
  const retained =
1626
1648
  tool.name === 'read' && (await resolveRetainedOutput(this.outputDirectory(), value))
1627
- const outside = retained ? undefined : await pathOutsideRoots(this.rootsNow(), value)
1649
+ const outside =
1650
+ retained || this.isAllowedToolFile(tool, value)
1651
+ ? undefined
1652
+ : await pathOutsideRoots(this.rootsNow(), value)
1628
1653
  if (outside !== undefined) outsidePaths = [outside]
1629
1654
  }
1630
1655
  }
@@ -2791,6 +2816,7 @@ export class ToolExecutor {
2791
2816
  ...(this.additionalDirectoriesNow()?.length
2792
2817
  ? { additionalDirectories: this.additionalDirectoriesNow() }
2793
2818
  : {}),
2819
+ ...(this.config.allowedFiles?.length ? { allowedFiles: this.config.allowedFiles } : {}),
2794
2820
  ...(this.config.authorizationGate
2795
2821
  ? {
2796
2822
  readDenied: (absolutePath: string) =>