@namzu/sdk 72.0.0 → 74.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 (394) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/README.md +34 -34
  3. package/dist/agents/examples/SupervisorAgent.d.ts.map +1 -1
  4. package/dist/agents/examples/SupervisorAgent.js +5 -0
  5. package/dist/agents/examples/SupervisorAgent.js.map +1 -1
  6. package/dist/authorization/protected-paths.d.ts +7 -0
  7. package/dist/authorization/protected-paths.d.ts.map +1 -1
  8. package/dist/authorization/protected-paths.js +11 -0
  9. package/dist/authorization/protected-paths.js.map +1 -1
  10. package/dist/authorization/readonly-commands.d.ts +23 -0
  11. package/dist/authorization/readonly-commands.d.ts.map +1 -1
  12. package/dist/authorization/readonly-commands.js +89 -3
  13. package/dist/authorization/readonly-commands.js.map +1 -1
  14. package/dist/authorization/shell-paths.d.ts +8 -0
  15. package/dist/authorization/shell-paths.d.ts.map +1 -1
  16. package/dist/authorization/shell-paths.js +125 -2
  17. package/dist/authorization/shell-paths.js.map +1 -1
  18. package/dist/bridge/acp/permission.d.ts +6 -0
  19. package/dist/bridge/acp/permission.d.ts.map +1 -1
  20. package/dist/bridge/acp/permission.js.map +1 -1
  21. package/dist/bridge/acp/server.d.ts.map +1 -1
  22. package/dist/bridge/acp/server.js +21 -3
  23. package/dist/bridge/acp/server.js.map +1 -1
  24. package/dist/compaction/context-window.d.ts.map +1 -1
  25. package/dist/compaction/context-window.js +11 -0
  26. package/dist/compaction/context-window.js.map +1 -1
  27. package/dist/compaction/manual.d.ts +16 -1
  28. package/dist/compaction/manual.d.ts.map +1 -1
  29. package/dist/compaction/manual.js +75 -13
  30. package/dist/compaction/manual.js.map +1 -1
  31. package/dist/compaction/plan.d.ts +2 -1
  32. package/dist/compaction/plan.d.ts.map +1 -1
  33. package/dist/compaction/plan.js +6 -5
  34. package/dist/compaction/plan.js.map +1 -1
  35. package/dist/compaction/precompute.d.ts +179 -0
  36. package/dist/compaction/precompute.d.ts.map +1 -0
  37. package/dist/compaction/precompute.js +274 -0
  38. package/dist/compaction/precompute.js.map +1 -0
  39. package/dist/compaction/retained-images.d.ts +16 -0
  40. package/dist/compaction/retained-images.d.ts.map +1 -0
  41. package/dist/compaction/retained-images.js +113 -0
  42. package/dist/compaction/retained-images.js.map +1 -0
  43. package/dist/compaction/token-estimate.d.ts +8 -3
  44. package/dist/compaction/token-estimate.d.ts.map +1 -1
  45. package/dist/compaction/token-estimate.js +76 -8
  46. package/dist/compaction/token-estimate.js.map +1 -1
  47. package/dist/compaction/tool-result-editing.d.ts.map +1 -1
  48. package/dist/compaction/tool-result-editing.js +15 -8
  49. package/dist/compaction/tool-result-editing.js.map +1 -1
  50. package/dist/config/runtime.d.ts +4 -0
  51. package/dist/config/runtime.d.ts.map +1 -1
  52. package/dist/config/runtime.js +17 -0
  53. package/dist/config/runtime.js.map +1 -1
  54. package/dist/constants/acp/index.d.ts +2 -0
  55. package/dist/constants/acp/index.d.ts.map +1 -1
  56. package/dist/constants/acp/index.js +2 -0
  57. package/dist/constants/acp/index.js.map +1 -1
  58. package/dist/manager/agent/lifecycle.d.ts.map +1 -1
  59. package/dist/manager/agent/lifecycle.js +8 -0
  60. package/dist/manager/agent/lifecycle.js.map +1 -1
  61. package/dist/manager/session/turn-recorder.d.ts +26 -0
  62. package/dist/manager/session/turn-recorder.d.ts.map +1 -1
  63. package/dist/manager/session/turn-recorder.js +72 -5
  64. package/dist/manager/session/turn-recorder.js.map +1 -1
  65. package/dist/peers/protocol.d.ts +9 -0
  66. package/dist/peers/protocol.d.ts.map +1 -1
  67. package/dist/peers/protocol.js +4 -0
  68. package/dist/peers/protocol.js.map +1 -1
  69. package/dist/peers/record.d.ts +6 -0
  70. package/dist/peers/record.d.ts.map +1 -1
  71. package/dist/peers/record.js +4 -0
  72. package/dist/peers/record.js.map +1 -1
  73. package/dist/plugin/index.d.ts +2 -2
  74. package/dist/plugin/index.d.ts.map +1 -1
  75. package/dist/plugin/index.js +1 -1
  76. package/dist/plugin/index.js.map +1 -1
  77. package/dist/plugin/shell-hook.d.ts +30 -0
  78. package/dist/plugin/shell-hook.d.ts.map +1 -1
  79. package/dist/plugin/shell-hook.js +35 -0
  80. package/dist/plugin/shell-hook.js.map +1 -1
  81. package/dist/pricing/catalogue.generated.d.ts.map +1 -1
  82. package/dist/pricing/catalogue.generated.js +178 -1
  83. package/dist/pricing/catalogue.generated.js.map +1 -1
  84. package/dist/provider/attribution.js +1 -1
  85. package/dist/provider/attribution.js.map +1 -1
  86. package/dist/public-runtime.d.ts +9 -5
  87. package/dist/public-runtime.d.ts.map +1 -1
  88. package/dist/public-runtime.js +12 -4
  89. package/dist/public-runtime.js.map +1 -1
  90. package/dist/public-tools.d.ts +1 -1
  91. package/dist/public-tools.d.ts.map +1 -1
  92. package/dist/public-tools.js +1 -1
  93. package/dist/public-tools.js.map +1 -1
  94. package/dist/public-types.d.ts +3 -2
  95. package/dist/public-types.d.ts.map +1 -1
  96. package/dist/rag/embedding.d.ts +5 -1
  97. package/dist/rag/embedding.d.ts.map +1 -1
  98. package/dist/rag/embedding.js +22 -7
  99. package/dist/rag/embedding.js.map +1 -1
  100. package/dist/registry/command/kernel-commands.d.ts +7 -1
  101. package/dist/registry/command/kernel-commands.d.ts.map +1 -1
  102. package/dist/registry/command/kernel-commands.js +40 -2
  103. package/dist/registry/command/kernel-commands.js.map +1 -1
  104. package/dist/registry/tool/execute.d.ts +8 -0
  105. package/dist/registry/tool/execute.d.ts.map +1 -1
  106. package/dist/registry/tool/execute.js +12 -0
  107. package/dist/registry/tool/execute.js.map +1 -1
  108. package/dist/runtime/query/abandon-turn.d.ts.map +1 -1
  109. package/dist/runtime/query/abandon-turn.js +9 -0
  110. package/dist/runtime/query/abandon-turn.js.map +1 -1
  111. package/dist/runtime/query/budget-nudge.d.ts +27 -0
  112. package/dist/runtime/query/budget-nudge.d.ts.map +1 -0
  113. package/dist/runtime/query/budget-nudge.js +66 -0
  114. package/dist/runtime/query/budget-nudge.js.map +1 -0
  115. package/dist/runtime/query/compact-session.d.ts +19 -3
  116. package/dist/runtime/query/compact-session.d.ts.map +1 -1
  117. package/dist/runtime/query/compact-session.js +180 -93
  118. package/dist/runtime/query/compact-session.js.map +1 -1
  119. package/dist/runtime/query/guard.d.ts +8 -0
  120. package/dist/runtime/query/guard.d.ts.map +1 -1
  121. package/dist/runtime/query/guard.js +20 -0
  122. package/dist/runtime/query/guard.js.map +1 -1
  123. package/dist/runtime/query/index.d.ts.map +1 -1
  124. package/dist/runtime/query/index.js +1 -0
  125. package/dist/runtime/query/index.js.map +1 -1
  126. package/dist/runtime/query/iteration/index.d.ts +2 -0
  127. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  128. package/dist/runtime/query/iteration/index.js +41 -1
  129. package/dist/runtime/query/iteration/index.js.map +1 -1
  130. package/dist/runtime/query/iteration/phases/compaction.d.ts +1 -0
  131. package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
  132. package/dist/runtime/query/iteration/phases/compaction.js +203 -45
  133. package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
  134. package/dist/runtime/query/iteration/phases/context.d.ts +2 -0
  135. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  136. package/dist/runtime/query/iteration/phases/context.js +1 -0
  137. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  138. package/dist/runtime/query/iteration/phases/precompute.d.ts +60 -0
  139. package/dist/runtime/query/iteration/phases/precompute.d.ts.map +1 -0
  140. package/dist/runtime/query/iteration/phases/precompute.js +240 -0
  141. package/dist/runtime/query/iteration/phases/precompute.js.map +1 -0
  142. package/dist/runtime/query/iteration/request-prefix.d.ts +21 -0
  143. package/dist/runtime/query/iteration/request-prefix.d.ts.map +1 -0
  144. package/dist/runtime/query/iteration/request-prefix.js +111 -0
  145. package/dist/runtime/query/iteration/request-prefix.js.map +1 -0
  146. package/dist/runtime/query/review-policy.d.ts +11 -3
  147. package/dist/runtime/query/review-policy.d.ts.map +1 -1
  148. package/dist/runtime/query/review-policy.js +54 -3
  149. package/dist/runtime/query/review-policy.js.map +1 -1
  150. package/dist/runtime/query/turn/outcome-ledger.d.ts +14 -0
  151. package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -1
  152. package/dist/runtime/query/turn/outcome-ledger.js +28 -0
  153. package/dist/runtime/query/turn/outcome-ledger.js.map +1 -1
  154. package/dist/sandbox/exec-stdin.d.ts +21 -0
  155. package/dist/sandbox/exec-stdin.d.ts.map +1 -0
  156. package/dist/sandbox/exec-stdin.js +40 -0
  157. package/dist/sandbox/exec-stdin.js.map +1 -0
  158. package/dist/sandbox/file-walk.d.ts +12 -7
  159. package/dist/sandbox/file-walk.d.ts.map +1 -1
  160. package/dist/sandbox/file-walk.js +13 -4
  161. package/dist/sandbox/file-walk.js.map +1 -1
  162. package/dist/sandbox/ignore-matcher.d.ts +1 -0
  163. package/dist/sandbox/ignore-matcher.d.ts.map +1 -1
  164. package/dist/sandbox/ignore-matcher.js.map +1 -1
  165. package/dist/sandbox/ignore-source.js +1 -1
  166. package/dist/sandbox/index.d.ts +3 -2
  167. package/dist/sandbox/index.d.ts.map +1 -1
  168. package/dist/sandbox/index.js +2 -1
  169. package/dist/sandbox/index.js.map +1 -1
  170. package/dist/sandbox/provider/local.d.ts.map +1 -1
  171. package/dist/sandbox/provider/local.js +2 -0
  172. package/dist/sandbox/provider/local.js.map +1 -1
  173. package/dist/session/paths.d.ts +6 -0
  174. package/dist/session/paths.d.ts.map +1 -1
  175. package/dist/session/paths.js +7 -0
  176. package/dist/session/paths.js.map +1 -1
  177. package/dist/session-query/index.d.ts +1 -0
  178. package/dist/session-query/index.d.ts.map +1 -1
  179. package/dist/session-query/index.js +26 -15
  180. package/dist/session-query/index.js.map +1 -1
  181. package/dist/store/evidence/disk.js +3 -1
  182. package/dist/store/evidence/disk.js.map +1 -1
  183. package/dist/store/evidence/index-page.d.ts +1 -0
  184. package/dist/store/evidence/index-page.d.ts.map +1 -1
  185. package/dist/store/evidence/index-page.js +8 -0
  186. package/dist/store/evidence/index-page.js.map +1 -1
  187. package/dist/store/goal/gates.d.ts +53 -0
  188. package/dist/store/goal/gates.d.ts.map +1 -0
  189. package/dist/store/goal/gates.js +664 -0
  190. package/dist/store/goal/gates.js.map +1 -0
  191. package/dist/store/goal/index.d.ts +16 -1
  192. package/dist/store/goal/index.d.ts.map +1 -1
  193. package/dist/store/goal/index.js +74 -0
  194. package/dist/store/goal/index.js.map +1 -1
  195. package/dist/store/memory/operation-lock.d.ts.map +1 -1
  196. package/dist/store/memory/operation-lock.js +15 -1
  197. package/dist/store/memory/operation-lock.js.map +1 -1
  198. package/dist/store/session-log/core.d.ts.map +1 -1
  199. package/dist/store/session-log/core.js +23 -0
  200. package/dist/store/session-log/core.js.map +1 -1
  201. package/dist/tools/builtins/bash.js +1 -1
  202. package/dist/tools/builtins/bash.js.map +1 -1
  203. package/dist/tools/builtins/browser.d.ts.map +1 -1
  204. package/dist/tools/builtins/browser.js +2 -0
  205. package/dist/tools/builtins/browser.js.map +1 -1
  206. package/dist/tools/builtins/computer-use-image.d.ts +9 -0
  207. package/dist/tools/builtins/computer-use-image.d.ts.map +1 -1
  208. package/dist/tools/builtins/computer-use-image.js +21 -0
  209. package/dist/tools/builtins/computer-use-image.js.map +1 -1
  210. package/dist/tools/builtins/computer-use.d.ts +1 -9
  211. package/dist/tools/builtins/computer-use.d.ts.map +1 -1
  212. package/dist/tools/builtins/computer-use.js +2 -22
  213. package/dist/tools/builtins/computer-use.js.map +1 -1
  214. package/dist/tools/builtins/monitor.d.ts.map +1 -1
  215. package/dist/tools/builtins/monitor.js +1 -0
  216. package/dist/tools/builtins/monitor.js.map +1 -1
  217. package/dist/tools/builtins/search-tools.js +2 -2
  218. package/dist/tools/builtins/search-tools.js.map +1 -1
  219. package/dist/tools/builtins/sleep-guard.js +1 -1
  220. package/dist/tools/builtins/sleep-guard.js.map +1 -1
  221. package/dist/tools/builtins/wait-for-job.js +1 -1
  222. package/dist/tools/builtins/wait-for-job.js.map +1 -1
  223. package/dist/tools/coordinator/ask-user-question.d.ts.map +1 -1
  224. package/dist/tools/coordinator/ask-user-question.js +25 -0
  225. package/dist/tools/coordinator/ask-user-question.js.map +1 -1
  226. package/dist/tools/coordinator/index.d.ts.map +1 -1
  227. package/dist/tools/coordinator/index.js +3 -0
  228. package/dist/tools/coordinator/index.js.map +1 -1
  229. package/dist/tools/defineTool.d.ts +2 -0
  230. package/dist/tools/defineTool.d.ts.map +1 -1
  231. package/dist/tools/defineTool.js +3 -0
  232. package/dist/tools/defineTool.js.map +1 -1
  233. package/dist/tools/goal/confirmation.d.ts +40 -2
  234. package/dist/tools/goal/confirmation.d.ts.map +1 -1
  235. package/dist/tools/goal/confirmation.js +117 -0
  236. package/dist/tools/goal/confirmation.js.map +1 -1
  237. package/dist/tools/goal/index.d.ts.map +1 -1
  238. package/dist/tools/goal/index.js +14 -2
  239. package/dist/tools/goal/index.js.map +1 -1
  240. package/dist/tools/memory/save.d.ts.map +1 -1
  241. package/dist/tools/memory/save.js +1 -0
  242. package/dist/tools/memory/save.js.map +1 -1
  243. package/dist/tools/schedules/index.d.ts +1 -0
  244. package/dist/tools/schedules/index.d.ts.map +1 -1
  245. package/dist/tools/schedules/index.js +1 -0
  246. package/dist/tools/schedules/index.js.map +1 -1
  247. package/dist/tools/schedules/loop-tool.d.ts.map +1 -1
  248. package/dist/tools/schedules/loop-tool.js +1 -0
  249. package/dist/tools/schedules/loop-tool.js.map +1 -1
  250. package/dist/tools/schedules/present.d.ts.map +1 -1
  251. package/dist/tools/schedules/present.js +2 -0
  252. package/dist/tools/schedules/present.js.map +1 -1
  253. package/dist/tools/schedules/schedule-tool.d.ts.map +1 -1
  254. package/dist/tools/schedules/schedule-tool.js +79 -9
  255. package/dist/tools/schedules/schedule-tool.js.map +1 -1
  256. package/dist/tools/schedules/self-tool.d.ts +16 -0
  257. package/dist/tools/schedules/self-tool.d.ts.map +1 -0
  258. package/dist/tools/schedules/self-tool.js +140 -0
  259. package/dist/tools/schedules/self-tool.js.map +1 -0
  260. package/dist/tools/schedules/timer-tools.d.ts.map +1 -1
  261. package/dist/tools/schedules/timer-tools.js +1 -0
  262. package/dist/tools/schedules/timer-tools.js.map +1 -1
  263. package/dist/tools/schedules/types.d.ts +63 -0
  264. package/dist/tools/schedules/types.d.ts.map +1 -1
  265. package/dist/toolsets/manager.d.ts +14 -0
  266. package/dist/toolsets/manager.d.ts.map +1 -1
  267. package/dist/toolsets/manager.js +60 -7
  268. package/dist/toolsets/manager.js.map +1 -1
  269. package/dist/types/agent/supervisor.d.ts +10 -0
  270. package/dist/types/agent/supervisor.d.ts.map +1 -1
  271. package/dist/types/agent/task.d.ts +6 -0
  272. package/dist/types/agent/task.d.ts.map +1 -1
  273. package/dist/types/common/index.d.ts +20 -0
  274. package/dist/types/common/index.d.ts.map +1 -1
  275. package/dist/types/common/index.js +4 -1
  276. package/dist/types/common/index.js.map +1 -1
  277. package/dist/types/goal/index.d.ts +66 -0
  278. package/dist/types/goal/index.d.ts.map +1 -1
  279. package/dist/types/hitl/index.d.ts +11 -0
  280. package/dist/types/hitl/index.d.ts.map +1 -1
  281. package/dist/types/hitl/index.js.map +1 -1
  282. package/dist/types/rag/embedding.d.ts +4 -0
  283. package/dist/types/rag/embedding.d.ts.map +1 -1
  284. package/dist/types/sandbox/index.d.ts +19 -0
  285. package/dist/types/sandbox/index.d.ts.map +1 -1
  286. package/dist/types/sandbox/index.js.map +1 -1
  287. package/dist/types/session/events.d.ts +55 -0
  288. package/dist/types/session/events.d.ts.map +1 -1
  289. package/dist/types/session/events.js.map +1 -1
  290. package/dist/types/session/outcome.d.ts +12 -0
  291. package/dist/types/session/outcome.d.ts.map +1 -1
  292. package/dist/types/session/outcome.js.map +1 -1
  293. package/dist/types/session/records.d.ts +81 -1
  294. package/dist/types/session/records.d.ts.map +1 -1
  295. package/dist/types/session/records.js +33 -0
  296. package/dist/types/session/records.js.map +1 -1
  297. package/dist/types/tool/index.d.ts +7 -0
  298. package/dist/types/tool/index.d.ts.map +1 -1
  299. package/dist/types/tool/index.js.map +1 -1
  300. package/dist/utils/cost.d.ts +15 -0
  301. package/dist/utils/cost.d.ts.map +1 -1
  302. package/dist/utils/cost.js +24 -1
  303. package/dist/utils/cost.js.map +1 -1
  304. package/package.json +2 -2
  305. package/src/agents/examples/SupervisorAgent.ts +5 -0
  306. package/src/authorization/protected-paths.ts +11 -0
  307. package/src/authorization/readonly-commands.ts +85 -3
  308. package/src/authorization/shell-paths.ts +141 -3
  309. package/src/bridge/acp/permission.ts +6 -0
  310. package/src/bridge/acp/server.ts +20 -1
  311. package/src/compaction/context-window.ts +11 -0
  312. package/src/compaction/manual.ts +103 -17
  313. package/src/compaction/plan.ts +11 -5
  314. package/src/compaction/precompute.ts +390 -0
  315. package/src/compaction/retained-images.ts +130 -0
  316. package/src/compaction/token-estimate.ts +86 -8
  317. package/src/compaction/tool-result-editing.ts +20 -8
  318. package/src/config/runtime.ts +17 -0
  319. package/src/constants/acp/index.ts +2 -0
  320. package/src/manager/agent/lifecycle.ts +9 -0
  321. package/src/manager/session/turn-recorder.ts +92 -5
  322. package/src/peers/protocol.ts +4 -0
  323. package/src/peers/record.ts +4 -0
  324. package/src/plugin/index.ts +2 -0
  325. package/src/plugin/shell-hook.ts +60 -0
  326. package/src/pricing/catalogue.generated.ts +178 -1
  327. package/src/pricing/rates.source.json +155 -2
  328. package/src/provider/attribution.ts +1 -1
  329. package/src/public-runtime.ts +48 -0
  330. package/src/public-tools.ts +2 -0
  331. package/src/public-types.ts +8 -0
  332. package/src/rag/embedding.ts +23 -7
  333. package/src/registry/command/kernel-commands.ts +62 -3
  334. package/src/registry/tool/execute.ts +14 -0
  335. package/src/runtime/query/abandon-turn.ts +9 -0
  336. package/src/runtime/query/budget-nudge.ts +92 -0
  337. package/src/runtime/query/compact-session.ts +242 -87
  338. package/src/runtime/query/guard.ts +22 -0
  339. package/src/runtime/query/index.ts +1 -0
  340. package/src/runtime/query/iteration/index.ts +40 -1
  341. package/src/runtime/query/iteration/phases/compaction.ts +224 -46
  342. package/src/runtime/query/iteration/phases/context.ts +3 -0
  343. package/src/runtime/query/iteration/phases/precompute.ts +277 -0
  344. package/src/runtime/query/iteration/request-prefix.ts +161 -0
  345. package/src/runtime/query/review-policy.ts +79 -11
  346. package/src/runtime/query/turn/outcome-ledger.ts +34 -0
  347. package/src/sandbox/exec-stdin.ts +54 -0
  348. package/src/sandbox/file-walk.ts +25 -18
  349. package/src/sandbox/ignore-matcher.ts +1 -0
  350. package/src/sandbox/ignore-source.ts +1 -1
  351. package/src/sandbox/index.ts +8 -2
  352. package/src/sandbox/provider/local.ts +2 -0
  353. package/src/session/paths.ts +9 -0
  354. package/src/session-query/index.ts +23 -14
  355. package/src/store/evidence/disk.ts +3 -1
  356. package/src/store/evidence/index-page.ts +11 -0
  357. package/src/store/goal/gates.ts +738 -0
  358. package/src/store/goal/index.ts +109 -0
  359. package/src/store/memory/operation-lock.ts +19 -1
  360. package/src/store/session-log/core.ts +26 -0
  361. package/src/tools/builtins/bash.ts +1 -1
  362. package/src/tools/builtins/browser.ts +4 -0
  363. package/src/tools/builtins/computer-use-image.ts +20 -0
  364. package/src/tools/builtins/computer-use.ts +1 -20
  365. package/src/tools/builtins/monitor.ts +2 -0
  366. package/src/tools/builtins/search-tools.ts +2 -2
  367. package/src/tools/builtins/sleep-guard.ts +1 -1
  368. package/src/tools/builtins/wait-for-job.ts +1 -1
  369. package/src/tools/coordinator/ask-user-question.ts +37 -10
  370. package/src/tools/coordinator/index.ts +3 -0
  371. package/src/tools/defineTool.ts +5 -0
  372. package/src/tools/goal/confirmation.ts +171 -3
  373. package/src/tools/goal/index.ts +15 -3
  374. package/src/tools/memory/save.ts +2 -0
  375. package/src/tools/schedules/index.ts +1 -0
  376. package/src/tools/schedules/loop-tool.ts +2 -0
  377. package/src/tools/schedules/present.ts +2 -0
  378. package/src/tools/schedules/schedule-tool.ts +84 -9
  379. package/src/tools/schedules/self-tool.ts +152 -0
  380. package/src/tools/schedules/timer-tools.ts +2 -0
  381. package/src/tools/schedules/types.ts +62 -0
  382. package/src/toolsets/manager.ts +59 -8
  383. package/src/types/agent/supervisor.ts +11 -0
  384. package/src/types/agent/task.ts +7 -0
  385. package/src/types/common/index.ts +26 -1
  386. package/src/types/goal/index.ts +72 -0
  387. package/src/types/hitl/index.ts +11 -0
  388. package/src/types/rag/embedding.ts +7 -0
  389. package/src/types/sandbox/index.ts +19 -0
  390. package/src/types/session/events.ts +56 -0
  391. package/src/types/session/outcome.ts +16 -1
  392. package/src/types/session/records.ts +41 -0
  393. package/src/types/tool/index.ts +7 -0
  394. package/src/utils/cost.ts +44 -1
@@ -5,6 +5,7 @@ import {
5
5
  } from '../runtime/query/tool-output-budget.js'
6
6
  import { toolResultToText } from '../types/message/content.js'
7
7
  import type { Message, ToolMessage, ToolResultBlock } from '../types/message/index.js'
8
+ import { compactedImageMarker } from './retained-images.js'
8
9
  import { findRetainedIndices } from './retention.js'
9
10
  import { estimateMessageTokens } from './token-estimate.js'
10
11
 
@@ -143,6 +144,21 @@ export function clearToolResult(
143
144
  toolName: string,
144
145
  ): { readonly message: ToolMessage; readonly charsReclaimed: number } {
145
146
  const size = measureContent(tool.content)
147
+ if (
148
+ typeof tool.content !== 'string' &&
149
+ tool.content.some((block) => block.type === 'image' && !block.modelOmission)
150
+ ) {
151
+ const content = tool.content.map(
152
+ (block): ToolResultBlock =>
153
+ block.type === 'image' && !block.modelOmission
154
+ ? { type: 'text', text: compactedImageMarker(block, toolName) }
155
+ : block,
156
+ )
157
+ return {
158
+ message: { ...tool, content },
159
+ charsReclaimed: Math.max(0, size - measureContent(content)),
160
+ }
161
+ }
146
162
  const content = clearedPlaceholder(tool.content, toolName, size)
147
163
  return { message: { ...tool, content }, charsReclaimed: Math.max(0, size - content.length) }
148
164
  }
@@ -209,17 +225,13 @@ export function clearStaleToolResults(
209
225
  const toolName = toolNameByCallId.get(tool.toolCallId) ?? 'unknown'
210
226
  if (preserve.has(toolName)) return msg
211
227
 
212
- const size = measureContent(tool.content)
213
228
  if (estimateMessageTokens(tool) * CHARS_PER_TOKEN < minChars) return msg
214
229
 
215
- const content = clearedPlaceholder(tool.content, toolName, size)
216
- if (estimateMessageTokens({ ...tool, content }) >= estimateMessageTokens(tool)) return msg
230
+ const cleared = clearToolResult(tool, toolName)
231
+ if (estimateMessageTokens(cleared.message) >= estimateMessageTokens(tool)) return msg
217
232
  clearedCount++
218
- charsReclaimed += size - content.length
219
- return {
220
- ...tool,
221
- content,
222
- } satisfies ToolMessage
233
+ charsReclaimed += cleared.charsReclaimed
234
+ return cleared.message
223
235
  })
224
236
 
225
237
  return { messages: edited, clearedCount, charsReclaimed: Math.max(0, charsReclaimed) }
@@ -72,6 +72,23 @@ export const CompactionConfigSchema = z.object({
72
72
  * compaction on.
73
73
  */
74
74
  autoCompact: z.boolean().optional(),
75
+ /**
76
+ * Write the summary before it is needed. When the context nears the
77
+ * trigger and the host has a model set aside for summaries, one summary
78
+ * request starts in the background; at the trigger the pass installs it at
79
+ * once if the conversation it saw is still the start of this one, and makes
80
+ * a fresh summary when it is not. Nothing runs when automatic compaction is
81
+ * off, and a short session never reaches the arm point. Absent or `true` keeps it on; `false`
82
+ * keeps every summary to the moment it is needed.
83
+ */
84
+ precompute: z.boolean().optional(),
85
+ /**
86
+ * How far before the window is full the summary starts: the arm point is
87
+ * `1 - precomputeArmFraction` of the window (0.2 when absent, so 0.8 of it), or
88
+ * the trigger when that is lower. `0` arms only at the trigger, which is no
89
+ * head start.
90
+ */
91
+ precomputeArmFraction: z.number().min(0).max(1).optional(),
75
92
  /** Optional automatic-summary window; capped to the actual model window. */
76
93
  autoCompactWindowTokens: z.number().int().positive().safe().optional(),
77
94
  /**
@@ -50,6 +50,8 @@ export type AcpMethod = (typeof ACP_METHODS)[keyof typeof ACP_METHODS]
50
50
  export const ACP_CLIENT_NOTIFICATIONS = {
51
51
  SESSION_UPDATE: 'session/update',
52
52
  TASK_UPDATE: 'namzu/tasks/update',
53
+ /** The agent takes back a request it made (an approval the person no longer needs to answer). */
54
+ CANCEL_REQUEST: '$/cancel_request',
53
55
  } as const
54
56
 
55
57
  /**
@@ -946,6 +946,15 @@ export class AgentManager {
946
946
  childConfig.toolResultGuardrails = inheritedScreens
947
947
  }
948
948
 
949
+ // The parent's hook manager, for the same reason as the screens: a
950
+ // child's `configBuilder` cannot forward what it was never told about.
951
+ const inheritedPlugins =
952
+ (options.configOverrides as { pluginManager?: unknown } | undefined)?.pluginManager ??
953
+ context.pluginManager
954
+ if (inheritedPlugins !== undefined) {
955
+ ;(childConfig as { pluginManager?: unknown }).pluginManager = inheritedPlugins
956
+ }
957
+
949
958
  // A child of its own reader record over the family's authored ledger, so
950
959
  // what the parent wrote is still "this session's" to a child that runs
951
960
  // it, while what the child has read stays its own and a write by a
@@ -266,6 +266,10 @@ export class TurnRecorder {
266
266
  #turnSystemPrompt: string | undefined
267
267
  /** Set by {@link resume}: the next reconciliation re-bases the fold on the restored context. */
268
268
  #rebasePending = false
269
+ /** What the pass that is about to be re-based on measured; see {@link noteCompaction}. */
270
+ #pendingCompaction: CompactionFacts | undefined
271
+ /** Tokens all earlier compactions of this session dropped; read from the log when the first compaction of this recorder is written. */
272
+ #cumulativeDropped: number | undefined
269
273
  /** The summary the log already folds to, read when the recorder opened. */
270
274
  #foldSummary: readonly Message[] = []
271
275
  /**
@@ -371,6 +375,11 @@ export class TurnRecorder {
371
375
  return this.#phase === 'active'
372
376
  }
373
377
 
378
+ /** Whether usage accumulated now still reaches the turn's record: the turn is active and its closing record is not queued. */
379
+ get acceptsUsage(): boolean {
380
+ return this.#turnOpen()
381
+ }
382
+
374
383
  /** Whether the turn's last segment record is `turn_paused`. */
375
384
  get isPaused(): boolean {
376
385
  return this.#phase === 'paused'
@@ -578,6 +587,17 @@ export class TurnRecorder {
578
587
  this.#lastPromptMessageCount = this.#turn.messages.length
579
588
  }
580
589
 
590
+ /**
591
+ * Say what the compaction pass that just replaced the context measured. The
592
+ * `compaction` record the next reconciliation writes carries it (its
593
+ * trigger, real token counts, duration and the running total of tokens
594
+ * dropped). Without it the record still names the messages kept, with the
595
+ * counts left at zero.
596
+ */
597
+ noteCompaction(facts: CompactionFacts): void {
598
+ this.#pendingCompaction = facts
599
+ }
600
+
581
601
  /** Forget the last prompt measurement (after compaction replaced the context it described). */
582
602
  clearLastPromptTokens(): void {
583
603
  this.#lastPromptTokens = undefined
@@ -1479,20 +1499,40 @@ export class TurnRecorder {
1479
1499
  const keptMessageIds = keptEntries.map((entry) => entry.id as MessageId)
1480
1500
  this.#view = next
1481
1501
  const turnId = this.turnId
1502
+ const facts = this.#pendingCompaction
1503
+ this.#pendingCompaction = undefined
1504
+ const dropped = facts ? Math.max(0, facts.tokensBefore - facts.tokensAfter) : 0
1482
1505
  void this.#enqueue(async () => {
1506
+ // Read once, from the records already in the log, when the first
1507
+ // compaction of this recorder is written: a session that never compacts
1508
+ // never reads it.
1509
+ this.#cumulativeDropped ??= await readCumulativeDropped(this.log)
1510
+ this.#cumulativeDropped += dropped
1511
+ const cumulativeDropped = this.#cumulativeDropped
1483
1512
  const toSeq = this.#lastEntry?.record.seq ?? (await this.log.head())?.pointer.seq ?? 1
1484
- return this.#append({
1513
+ const compactionId = generateMessageId()
1514
+ const entry = await this.#append({
1485
1515
  type: 'compaction',
1486
1516
  turnId,
1487
- compactionId: generateMessageId(),
1517
+ compactionId,
1488
1518
  strategy: 'context-rewrite',
1489
- trigger: 'auto',
1519
+ // What an earlier release reads: `prepared` is told by the record below.
1520
+ trigger:
1521
+ facts?.trigger === 'prepared' || facts?.trigger === undefined ? 'auto' : facts.trigger,
1490
1522
  replacesSeqRange: [1, toSeq],
1491
1523
  summary,
1492
1524
  keptMessageIds,
1493
- tokensBefore: 0,
1494
- tokensAfter: 0,
1525
+ tokensBefore: facts?.tokensBefore ?? 0,
1526
+ tokensAfter: facts?.tokensAfter ?? 0,
1495
1527
  })
1528
+ if (facts) {
1529
+ // A record of its own, never a field of the one above: see
1530
+ // `CompactionMeasuredRecordSchema`. A refused write loses only the measures.
1531
+ await this.#append(measuredDraft(compactionId, facts, cumulativeDropped, turnId)).catch(
1532
+ () => undefined,
1533
+ )
1534
+ }
1535
+ return entry
1496
1536
  }).catch(() => undefined)
1497
1537
  for (const entry of tailEntries) {
1498
1538
  const message = entry.message
@@ -1673,6 +1713,53 @@ export async function recordedTurnStart(
1673
1713
  return undefined
1674
1714
  }
1675
1715
 
1716
+ /** What a compaction pass measured, handed to the recorder so its record is not left at zero. */
1717
+ export interface CompactionFacts {
1718
+ readonly trigger?: 'auto' | 'manual' | 'idle' | 'prepared'
1719
+ readonly tokensBefore: number
1720
+ readonly tokensAfter: number
1721
+ readonly durationMs?: number
1722
+ readonly precomputed?: boolean
1723
+ }
1724
+
1725
+ /** The `compaction_measured` record that follows the `compaction` record `compactionId`. */
1726
+ export function measuredDraft(
1727
+ compactionId: string,
1728
+ facts: CompactionFacts,
1729
+ cumulativeDroppedTokens: number,
1730
+ turnId?: TurnId,
1731
+ ): Parameters<SessionLog['append']>[1] {
1732
+ return {
1733
+ type: 'compaction_measured',
1734
+ ...(turnId ? { turnId } : {}),
1735
+ ignorable: true,
1736
+ compactionId,
1737
+ trigger: facts.trigger ?? 'auto',
1738
+ ...(facts.durationMs !== undefined ? { durationMs: facts.durationMs } : {}),
1739
+ cumulativeDroppedTokens,
1740
+ ...(facts.precomputed ? { precomputed: true } : {}),
1741
+ }
1742
+ }
1743
+
1744
+ /**
1745
+ * The running total of tokens the session's compactions have dropped: what
1746
+ * each `compaction` record's sizes say, summed. Read from the sizes, which an
1747
+ * earlier release also writes and reads, never from a stored total.
1748
+ */
1749
+ export async function readCumulativeDropped(log: SessionLog): Promise<number> {
1750
+ return foldSessionLog(log, {
1751
+ name: 'compaction-dropped',
1752
+ mode: 'strict',
1753
+ create: () => ({ total: 0 }),
1754
+ apply: (state, entry) => {
1755
+ const record = entry.record as SessionRecord
1756
+ if (record.type !== 'compaction') return
1757
+ state.total += Math.max(0, record.tokensBefore - record.tokensAfter)
1758
+ },
1759
+ result: (state) => state.total,
1760
+ })
1761
+ }
1762
+
1676
1763
  /**
1677
1764
  * The session's folded context with the id each message's record gave it,
1678
1765
  * spilled bodies read back.
@@ -43,6 +43,9 @@ export const MAX_PEER_CONNECTIONS = 16
43
43
  // only long enough to be verified, never accepts messages, and is not a terminal.
44
44
  // 'person' is `namzu send` or the watcher's message key: the operator's own words from another terminal. It
45
45
  // listens only long enough to be verified, never accepts messages, and is not a terminal either.
46
+ // 'run' is one scheduled run of a job: it opens a restricted endpoint for the life of the run, takes
47
+ // only plain messages (never an approval or an interrupt), and is not a terminal. An older reader skips
48
+ // a record of this kind, so it simply does not see the run.
46
49
  export const PeerSessionKindSchema = z.enum([
47
50
  'tui',
48
51
  'exec',
@@ -51,6 +54,7 @@ export const PeerSessionKindSchema = z.enum([
51
54
  'cli',
52
55
  'person',
53
56
  'net',
57
+ 'run',
54
58
  ])
55
59
  export type PeerSessionKind = z.infer<typeof PeerSessionKindSchema>
56
60
 
@@ -107,6 +107,10 @@ export const PeerRecordSchema = z
107
107
  /** The name of the machine that set the role. */
108
108
  roleBy: z.string().min(1).max(80).optional(),
109
109
  roleAt: z.number().int().nonnegative().optional(),
110
+ /** `kind: 'run'` only: the name of the scheduled job this run belongs to. */
111
+ jobName: z.string().min(1).max(64).optional(),
112
+ /** `kind: 'run'` only: the id of this run. */
113
+ runId: z.string().min(1).max(128).optional(),
110
114
  })
111
115
  .strict()
112
116
 
@@ -45,6 +45,7 @@ export {
45
45
  SHELL_HOOK_PASCAL_EVENT_NAMES,
46
46
  SHELL_HOOKS_PLUGIN_ID,
47
47
  shellHookIfMatches,
48
+ shellHookEntryLimitProblem,
48
49
  shellHookIfProblem,
49
50
  shellHookMatcherProblem,
50
51
  shellHookMatches,
@@ -80,6 +81,7 @@ export type {
80
81
  ShellHookOnFailure,
81
82
  ShellHookCall,
82
83
  ShellHookInput,
84
+ ShellHookHandlerType,
83
85
  ShellHookOptions,
84
86
  ShellHookPathFilter,
85
87
  ShellHookOutcome,
@@ -2123,6 +2123,37 @@ export type ShellHookMcpToolCaller = (request: {
2123
2123
  readonly signal: AbortSignal
2124
2124
  }) => Promise<ShellHookMcpToolAnswer | undefined>
2125
2125
 
2126
+ /** A part `matcherForms: 'names'` accepts: a name, or a prefix with one `*` at the end only. */
2127
+ const NAME_ONLY_PART = /^[A-Za-z0-9_.:-]+\*?$|^\*$/
2128
+
2129
+ /** The types an entry can have (`type` absent reads as `command`). */
2130
+ export type ShellHookHandlerType = 'command' | 'http' | 'prompt' | 'mcp_tool'
2131
+
2132
+ /**
2133
+ * Why `entry` may not be registered under `options.handlerTypes` and
2134
+ * `options.matcherForms`, or `undefined` when it may. The wording names what
2135
+ * was refused and which option refused it.
2136
+ */
2137
+ export function shellHookEntryLimitProblem(
2138
+ entry: Pick<ShellHookHandler, 'matcher'> & { readonly type?: ShellHookHandlerType },
2139
+ options: Pick<ShellHookOptions, 'handlerTypes' | 'matcherForms'>,
2140
+ ): string | undefined {
2141
+ const type: ShellHookHandlerType = entry.type ?? 'command'
2142
+ if (options.handlerTypes !== undefined && !options.handlerTypes.includes(type)) {
2143
+ const allowed = options.handlerTypes.length > 0 ? options.handlerTypes.join(', ') : 'none'
2144
+ return `a ${type} hook is refused: this host accepts only ${allowed} hooks (handlerTypes), so the entry was not attached`
2145
+ }
2146
+ if (options.matcherForms === 'names') {
2147
+ const matcher = entry.matcher
2148
+ if (matcher === undefined || matcher.trim() === '' || matcher.trim() === '*') return undefined
2149
+ const parts = matcher.split(/[|,]/).map((part) => part.trim())
2150
+ if (!parts.every((part) => NAME_ONLY_PART.test(part)) || matcher.includes('.*')) {
2151
+ return `the matcher "${matcher}" is refused: this host accepts only a name, names joined by |, a prefix ending in * (mcp__server__*), empty or * (matcherForms: names), so the entry was not attached`
2152
+ }
2153
+ }
2154
+ return undefined
2155
+ }
2156
+
2126
2157
  export interface ShellHookOptions {
2127
2158
  /** Answers `prompt` hooks. Without it a `prompt` hook is logged and lets the action go ahead. */
2128
2159
  readonly judge?: ShellHookJudge
@@ -2209,6 +2240,26 @@ export interface ShellHookOptions {
2209
2240
  * is read as before.
2210
2241
  */
2211
2242
  readonly restrictVerdicts?: boolean
2243
+ /**
2244
+ * The entry types this adapter accepts: an allow-list of `command`, `http`,
2245
+ * `prompt` and `mcp_tool`. An entry of any other type is refused when it is
2246
+ * registered, before anything is attached, with a refusal that names the
2247
+ * entry's type and the list (`createShellHook` and `attachShellHooks` throw
2248
+ * it). For a host that runs untrusted entries and wants no web request, no
2249
+ * judge call and no tool call to leave from its own process. Absent, every
2250
+ * type is accepted. An entry with no `type` is a `command`.
2251
+ */
2252
+ readonly handlerTypes?: readonly ShellHookHandlerType[]
2253
+ /**
2254
+ * How an entry's `matcher` may be written. `'names'` refuses, when the entry
2255
+ * is registered, any matcher that is not a plain name list: a name, names
2256
+ * joined by `|` (or `,`), a prefix ending in `*` (`mcp__server__*`), empty or
2257
+ * `*`. A regular expression is never compiled or run then, so a pattern that
2258
+ * backtracks without bound cannot reach the host. The refusal names the
2259
+ * matcher. Absent, a matcher is read as before (a name list, or a regular
2260
+ * expression).
2261
+ */
2262
+ readonly matcherForms?: 'names'
2212
2263
  /**
2213
2264
  * Called when a hook of this adapter ran out its deadline and was ended.
2214
2265
  * `hook` is the command, URL or prompt text the entry names.
@@ -2518,6 +2569,8 @@ export function createShellHook(
2518
2569
  configured: ShellHookHandler,
2519
2570
  options: ShellHookOptions,
2520
2571
  ): PluginHookDefinition {
2572
+ const refusal = shellHookEntryLimitProblem(configured, options)
2573
+ if (refusal !== undefined) throw new Error(`Shell hook ${event}: ${refusal}`)
2521
2574
  const log = options.log ?? NOOP_LOGGER
2522
2575
  const envSlot = nextHookEnvSlot++
2523
2576
  const eventDefault = options.defaultTimeoutMs?.[event]
@@ -2741,6 +2794,13 @@ export function attachShellHooks(
2741
2794
  )
2742
2795
  }
2743
2796
  }
2797
+ // Every entry is checked against the limits first, so a refusal leaves nothing attached.
2798
+ for (const event of SHELL_HOOK_EVENTS) {
2799
+ for (const entry of hooks[event] ?? []) {
2800
+ const refusal = shellHookEntryLimitProblem(entry, options)
2801
+ if (refusal !== undefined) throw new Error(`Shell hook ${event}: ${refusal}`)
2802
+ }
2803
+ }
2744
2804
  const pluginId = options.pluginId ?? SHELL_HOOKS_PLUGIN_ID
2745
2805
  let count = 0
2746
2806
  for (const event of SHELL_HOOK_EVENTS) {
@@ -5,7 +5,7 @@
5
5
  // CI re-runs the generator and fails on any difference, so a hand edit here is
6
6
  // reverted by the next run at best and reported as drift at worst.
7
7
  //
8
- // 4 vendors, 40 priced models.
8
+ // 4 vendors, 52 priced models.
9
9
 
10
10
  import type { ModelPricing } from '../utils/cost.js'
11
11
 
@@ -64,6 +64,22 @@ export const VENDOR_RATES: readonly VendorRates[] = [
64
64
  webSearchCostPer1000: 10,
65
65
  },
66
66
  ],
67
+ [
68
+ 'claude-haiku-5-5',
69
+ {
70
+ inputCostPer1M: 0.1,
71
+ outputCostPer1M: 0.5,
72
+ cache: { promptIncludesCacheReads: false, readCostPer1M: 0.01, writeCostPer1M: 0.125 },
73
+ longContext: {
74
+ aboveInputTokens: 100000,
75
+ inputCostPer1M: 0.5,
76
+ outputCostPer1M: 2.5,
77
+ cacheReadCostPer1M: 0.05,
78
+ cacheWriteCostPer1M: 0.625,
79
+ },
80
+ webSearchCostPer1000: 10,
81
+ },
82
+ ],
67
83
  [
68
84
  'claude-mythos-5',
69
85
  {
@@ -365,6 +381,167 @@ export const VENDOR_RATES: readonly VendorRates[] = [
365
381
  fastMultiplier: 2,
366
382
  },
367
383
  ],
384
+ [
385
+ 'gpt-6-astra',
386
+ {
387
+ inputCostPer1M: 10,
388
+ outputCostPer1M: 50,
389
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 1 },
390
+ fastMultiplier: 2,
391
+ longContext: {
392
+ aboveInputTokens: 272000,
393
+ inputCostPer1M: 20,
394
+ outputCostPer1M: 75,
395
+ cacheReadCostPer1M: 2,
396
+ },
397
+ },
398
+ ],
399
+ [
400
+ 'gpt-6-astra-healthcare',
401
+ {
402
+ inputCostPer1M: 10,
403
+ outputCostPer1M: 50,
404
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 1 },
405
+ longContext: {
406
+ aboveInputTokens: 272000,
407
+ inputCostPer1M: 20,
408
+ outputCostPer1M: 75,
409
+ cacheReadCostPer1M: 2,
410
+ },
411
+ },
412
+ ],
413
+ [
414
+ 'gpt-6-luna',
415
+ {
416
+ inputCostPer1M: 0.1,
417
+ outputCostPer1M: 0.5,
418
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.01 },
419
+ fastMultiplier: 2,
420
+ longContext: {
421
+ aboveInputTokens: 272000,
422
+ inputCostPer1M: 0.2,
423
+ outputCostPer1M: 0.75,
424
+ cacheReadCostPer1M: 0.02,
425
+ },
426
+ },
427
+ ],
428
+ [
429
+ 'gpt-6-sol',
430
+ {
431
+ inputCostPer1M: 2,
432
+ outputCostPer1M: 10,
433
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.2 },
434
+ fastMultiplier: 2,
435
+ longContext: {
436
+ aboveInputTokens: 272000,
437
+ inputCostPer1M: 4,
438
+ outputCostPer1M: 15,
439
+ cacheReadCostPer1M: 0.4,
440
+ },
441
+ },
442
+ ],
443
+ [
444
+ 'gpt-6.1-sol',
445
+ {
446
+ inputCostPer1M: 2,
447
+ outputCostPer1M: 10,
448
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.1 },
449
+ fastMultiplier: 2,
450
+ longContext: {
451
+ aboveInputTokens: 272000,
452
+ inputCostPer1M: 4,
453
+ outputCostPer1M: 15,
454
+ cacheReadCostPer1M: 0.2,
455
+ },
456
+ },
457
+ ],
458
+ [
459
+ 'gpt-6.1-sol-healthcare',
460
+ {
461
+ inputCostPer1M: 2,
462
+ outputCostPer1M: 10,
463
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.1 },
464
+ longContext: {
465
+ aboveInputTokens: 272000,
466
+ inputCostPer1M: 4,
467
+ outputCostPer1M: 15,
468
+ cacheReadCostPer1M: 0.2,
469
+ },
470
+ },
471
+ ],
472
+ [
473
+ 'gpt-6.1-terra',
474
+ {
475
+ inputCostPer1M: 1,
476
+ outputCostPer1M: 5,
477
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.05 },
478
+ fastMultiplier: 2,
479
+ longContext: {
480
+ aboveInputTokens: 272000,
481
+ inputCostPer1M: 2,
482
+ outputCostPer1M: 7.5,
483
+ cacheReadCostPer1M: 0.1,
484
+ },
485
+ },
486
+ ],
487
+ [
488
+ 'gpt-6.2-astra',
489
+ {
490
+ inputCostPer1M: 8,
491
+ outputCostPer1M: 40,
492
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.4 },
493
+ fastMultiplier: 2,
494
+ longContext: {
495
+ aboveInputTokens: 272000,
496
+ inputCostPer1M: 16,
497
+ outputCostPer1M: 60,
498
+ cacheReadCostPer1M: 0.8,
499
+ },
500
+ },
501
+ ],
502
+ [
503
+ 'gpt-6.2-astra-healthcare',
504
+ {
505
+ inputCostPer1M: 8,
506
+ outputCostPer1M: 40,
507
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.4 },
508
+ longContext: {
509
+ aboveInputTokens: 272000,
510
+ inputCostPer1M: 16,
511
+ outputCostPer1M: 60,
512
+ cacheReadCostPer1M: 0.8,
513
+ },
514
+ },
515
+ ],
516
+ [
517
+ 'gpt-6.2-sol',
518
+ {
519
+ inputCostPer1M: 2,
520
+ outputCostPer1M: 10,
521
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.1 },
522
+ fastMultiplier: 2,
523
+ longContext: {
524
+ aboveInputTokens: 272000,
525
+ inputCostPer1M: 4,
526
+ outputCostPer1M: 15,
527
+ cacheReadCostPer1M: 0.2,
528
+ },
529
+ },
530
+ ],
531
+ [
532
+ 'gpt-6.2-sol-healthcare',
533
+ {
534
+ inputCostPer1M: 2,
535
+ outputCostPer1M: 10,
536
+ cache: { promptIncludesCacheReads: true, readCostPer1M: 0.1 },
537
+ longContext: {
538
+ aboveInputTokens: 272000,
539
+ inputCostPer1M: 4,
540
+ outputCostPer1M: 15,
541
+ cacheReadCostPer1M: 0.2,
542
+ },
543
+ },
544
+ ],
368
545
  [
369
546
  'o1',
370
547
  {