@code-yeongyu/senpi 2026.8.24 → 2026.8.26

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 (1589) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/dist/cli/args.d.ts.map +1 -1
  3. package/dist/cli/args.js +24 -9
  4. package/dist/cli/args.js.map +1 -1
  5. package/dist/cli/file-processor.d.ts.map +1 -1
  6. package/dist/cli/file-processor.js +2 -1
  7. package/dist/cli/file-processor.js.map +1 -1
  8. package/dist/config.d.ts +6 -3
  9. package/dist/config.d.ts.map +1 -1
  10. package/dist/config.js +24 -14
  11. package/dist/config.js.map +1 -1
  12. package/dist/core/agent-abort-provenance.d.ts.map +1 -1
  13. package/dist/core/agent-abort-provenance.js +5 -1
  14. package/dist/core/agent-abort-provenance.js.map +1 -1
  15. package/dist/core/agent-session.d.ts +11 -0
  16. package/dist/core/agent-session.d.ts.map +1 -1
  17. package/dist/core/agent-session.js +154 -29
  18. package/dist/core/agent-session.js.map +1 -1
  19. package/dist/core/auth-storage.d.ts +4 -0
  20. package/dist/core/auth-storage.d.ts.map +1 -1
  21. package/dist/core/auth-storage.js +35 -8
  22. package/dist/core/auth-storage.js.map +1 -1
  23. package/dist/core/brand.d.ts +2 -0
  24. package/dist/core/brand.d.ts.map +1 -1
  25. package/dist/core/brand.js +1 -0
  26. package/dist/core/brand.js.map +1 -1
  27. package/dist/core/compaction/compaction.d.ts +1 -0
  28. package/dist/core/compaction/compaction.d.ts.map +1 -1
  29. package/dist/core/compaction/compaction.js +24 -8
  30. package/dist/core/compaction/compaction.js.map +1 -1
  31. package/dist/core/defaults.d.ts +1 -0
  32. package/dist/core/defaults.d.ts.map +1 -1
  33. package/dist/core/defaults.js +9 -0
  34. package/dist/core/defaults.js.map +1 -1
  35. package/dist/core/extensions/builtin/compaction/per-turn-cap.d.ts +5 -9
  36. package/dist/core/extensions/builtin/compaction/per-turn-cap.d.ts.map +1 -1
  37. package/dist/core/extensions/builtin/compaction/per-turn-cap.js +5 -11
  38. package/dist/core/extensions/builtin/compaction/per-turn-cap.js.map +1 -1
  39. package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts +2 -3
  40. package/dist/core/extensions/builtin/compaction/todo-bridge.d.ts.map +1 -1
  41. package/dist/core/extensions/builtin/compaction/todo-bridge.js +53 -14
  42. package/dist/core/extensions/builtin/compaction/todo-bridge.js.map +1 -1
  43. package/dist/core/extensions/builtin/goal/terminal-provider-error.js +1 -1
  44. package/dist/core/extensions/builtin/goal/terminal-provider-error.js.map +1 -1
  45. package/dist/core/extensions/builtin/loop-guard/notice.d.ts.map +1 -1
  46. package/dist/core/extensions/builtin/loop-guard/notice.js +5 -1
  47. package/dist/core/extensions/builtin/loop-guard/notice.js.map +1 -1
  48. package/dist/core/extensions/builtin/mcp/config-schema.d.ts +2 -2
  49. package/dist/core/extensions/builtin/ttsr/index.d.ts.map +1 -1
  50. package/dist/core/extensions/builtin/ttsr/index.js +6 -6
  51. package/dist/core/extensions/builtin/ttsr/index.js.map +1 -1
  52. package/dist/core/extensions/builtin/ttsr/message-update.d.ts +10 -0
  53. package/dist/core/extensions/builtin/ttsr/message-update.d.ts.map +1 -0
  54. package/dist/core/extensions/builtin/ttsr/message-update.js +38 -0
  55. package/dist/core/extensions/builtin/ttsr/message-update.js.map +1 -0
  56. package/dist/core/extensions/builtin/ttsr/remediation.d.ts +5 -10
  57. package/dist/core/extensions/builtin/ttsr/remediation.d.ts.map +1 -1
  58. package/dist/core/extensions/builtin/ttsr/remediation.js +19 -3
  59. package/dist/core/extensions/builtin/ttsr/remediation.js.map +1 -1
  60. package/dist/core/extensions/builtin/ttsr/stream-remediation.d.ts +1 -1
  61. package/dist/core/extensions/builtin/ttsr/stream-remediation.d.ts.map +1 -1
  62. package/dist/core/extensions/builtin/ttsr/stream-remediation.js.map +1 -1
  63. package/dist/core/extensions/builtin/ttsr/types.d.ts +1 -1
  64. package/dist/core/extensions/builtin/ttsr/types.d.ts.map +1 -1
  65. package/dist/core/extensions/builtin/ttsr/types.js.map +1 -1
  66. package/dist/core/extensions/builtin/ttsr/watch.d.ts +1 -1
  67. package/dist/core/extensions/builtin/ttsr/watch.d.ts.map +1 -1
  68. package/dist/core/extensions/builtin/ttsr/watch.js +2 -2
  69. package/dist/core/extensions/builtin/ttsr/watch.js.map +1 -1
  70. package/dist/core/extensions/index.d.ts +2 -2
  71. package/dist/core/extensions/index.d.ts.map +1 -1
  72. package/dist/core/extensions/index.js +1 -1
  73. package/dist/core/extensions/index.js.map +1 -1
  74. package/dist/core/extensions/loader.d.ts.map +1 -1
  75. package/dist/core/extensions/loader.js +107 -45
  76. package/dist/core/extensions/loader.js.map +1 -1
  77. package/dist/core/extensions/types.d.ts +17 -6
  78. package/dist/core/extensions/types.d.ts.map +1 -1
  79. package/dist/core/extensions/types.js +3 -0
  80. package/dist/core/extensions/types.js.map +1 -1
  81. package/dist/core/footer-data-provider.d.ts +1 -1
  82. package/dist/core/footer-data-provider.js +1 -1
  83. package/dist/core/footer-data-provider.js.map +1 -1
  84. package/dist/core/keybindings.d.ts +20 -19
  85. package/dist/core/keybindings.d.ts.map +1 -1
  86. package/dist/core/keybindings.js +26 -5
  87. package/dist/core/keybindings.js.map +1 -1
  88. package/dist/core/model-config-schema.d.ts +17 -5
  89. package/dist/core/model-config-schema.d.ts.map +1 -1
  90. package/dist/core/model-config-schema.js +1 -1
  91. package/dist/core/model-config-schema.js.map +1 -1
  92. package/dist/core/model-config.d.ts.map +1 -1
  93. package/dist/core/model-config.js +7 -5
  94. package/dist/core/model-config.js.map +1 -1
  95. package/dist/core/model-resolver.d.ts +3 -2
  96. package/dist/core/model-resolver.d.ts.map +1 -1
  97. package/dist/core/model-resolver.js +3 -2
  98. package/dist/core/model-resolver.js.map +1 -1
  99. package/dist/core/model-runtime.d.ts +0 -1
  100. package/dist/core/model-runtime.d.ts.map +1 -1
  101. package/dist/core/model-runtime.js +0 -18
  102. package/dist/core/model-runtime.js.map +1 -1
  103. package/dist/core/models-store.d.ts.map +1 -1
  104. package/dist/core/models-store.js +2 -1
  105. package/dist/core/models-store.js.map +1 -1
  106. package/dist/core/package-manager.d.ts.map +1 -1
  107. package/dist/core/package-manager.js +14 -10
  108. package/dist/core/package-manager.js.map +1 -1
  109. package/dist/core/pi-manifest.d.ts.map +1 -1
  110. package/dist/core/pi-manifest.js +2 -1
  111. package/dist/core/pi-manifest.js.map +1 -1
  112. package/dist/core/provider-composer.d.ts +2 -0
  113. package/dist/core/provider-composer.d.ts.map +1 -1
  114. package/dist/core/provider-composer.js +3 -6
  115. package/dist/core/provider-composer.js.map +1 -1
  116. package/dist/core/provider-display-names.d.ts.map +1 -1
  117. package/dist/core/provider-display-names.js +0 -1
  118. package/dist/core/provider-display-names.js.map +1 -1
  119. package/dist/core/provider-timeout-retry.d.ts.map +1 -1
  120. package/dist/core/provider-timeout-retry.js +8 -12
  121. package/dist/core/provider-timeout-retry.js.map +1 -1
  122. package/dist/core/resource-loader.d.ts.map +1 -1
  123. package/dist/core/resource-loader.js +3 -2
  124. package/dist/core/resource-loader.js.map +1 -1
  125. package/dist/core/retry-fallback/profile-override.d.ts +24 -0
  126. package/dist/core/retry-fallback/profile-override.d.ts.map +1 -0
  127. package/dist/core/retry-fallback/profile-override.js +138 -0
  128. package/dist/core/retry-fallback/profile-override.js.map +1 -0
  129. package/dist/core/retry-fallback/settings.d.ts +1 -0
  130. package/dist/core/retry-fallback/settings.d.ts.map +1 -1
  131. package/dist/core/retry-fallback/settings.js.map +1 -1
  132. package/dist/core/sdk.d.ts +2 -2
  133. package/dist/core/sdk.d.ts.map +1 -1
  134. package/dist/core/sdk.js +20 -5
  135. package/dist/core/sdk.js.map +1 -1
  136. package/dist/core/session-export.d.ts +4 -0
  137. package/dist/core/session-export.d.ts.map +1 -0
  138. package/dist/core/session-export.js +32 -0
  139. package/dist/core/session-export.js.map +1 -0
  140. package/dist/core/session-manager.d.ts.map +1 -1
  141. package/dist/core/session-manager.js +2 -1
  142. package/dist/core/session-manager.js.map +1 -1
  143. package/dist/core/settings-diagnostics.d.ts +9 -0
  144. package/dist/core/settings-diagnostics.d.ts.map +1 -0
  145. package/dist/core/settings-diagnostics.js +21 -0
  146. package/dist/core/settings-diagnostics.js.map +1 -0
  147. package/dist/core/settings-manager.d.ts +18 -0
  148. package/dist/core/settings-manager.d.ts.map +1 -1
  149. package/dist/core/settings-manager.js +88 -7
  150. package/dist/core/settings-manager.js.map +1 -1
  151. package/dist/core/slash-commands.d.ts.map +1 -1
  152. package/dist/core/slash-commands.js +2 -1
  153. package/dist/core/slash-commands.js.map +1 -1
  154. package/dist/core/system-prompt.d.ts.map +1 -1
  155. package/dist/core/system-prompt.js +11 -2
  156. package/dist/core/system-prompt.js.map +1 -1
  157. package/dist/core/tools/bash.d.ts +14 -1
  158. package/dist/core/tools/bash.d.ts.map +1 -1
  159. package/dist/core/tools/bash.js +35 -19
  160. package/dist/core/tools/bash.js.map +1 -1
  161. package/dist/core/tools/edit-diff.d.ts +0 -5
  162. package/dist/core/tools/edit-diff.d.ts.map +1 -1
  163. package/dist/core/tools/edit-diff.js +2 -5
  164. package/dist/core/tools/edit-diff.js.map +1 -1
  165. package/dist/core/tools/edit.d.ts.map +1 -1
  166. package/dist/core/tools/edit.js +3 -2
  167. package/dist/core/tools/edit.js.map +1 -1
  168. package/dist/core/tools/index.d.ts +4 -1
  169. package/dist/core/tools/index.d.ts.map +1 -1
  170. package/dist/core/tools/index.js +13 -1
  171. package/dist/core/tools/index.js.map +1 -1
  172. package/dist/core/tools/powershell.d.ts +16 -0
  173. package/dist/core/tools/powershell.d.ts.map +1 -0
  174. package/dist/core/tools/powershell.js +39 -0
  175. package/dist/core/tools/powershell.js.map +1 -0
  176. package/dist/core/trust-manager.d.ts.map +1 -1
  177. package/dist/core/trust-manager.js +2 -1
  178. package/dist/core/trust-manager.js.map +1 -1
  179. package/dist/extensions/llama/client.d.ts +6 -0
  180. package/dist/extensions/llama/client.d.ts.map +1 -1
  181. package/dist/extensions/llama/client.js +7 -0
  182. package/dist/extensions/llama/client.js.map +1 -1
  183. package/dist/extensions/llama/provider.d.ts +3 -1
  184. package/dist/extensions/llama/provider.d.ts.map +1 -1
  185. package/dist/extensions/llama/provider.js +27 -6
  186. package/dist/extensions/llama/provider.js.map +1 -1
  187. package/dist/index.d.ts +5 -4
  188. package/dist/index.d.ts.map +1 -1
  189. package/dist/index.js +4 -3
  190. package/dist/index.js.map +1 -1
  191. package/dist/main.d.ts.map +1 -1
  192. package/dist/main.js +13 -2
  193. package/dist/main.js.map +1 -1
  194. package/dist/migrations.d.ts.map +1 -1
  195. package/dist/migrations.js +4 -3
  196. package/dist/migrations.js.map +1 -1
  197. package/dist/modes/app-server/daemon/probe.js +1 -1
  198. package/dist/modes/app-server/daemon/probe.js.map +1 -1
  199. package/dist/modes/app-server/daemon.js +13 -2
  200. package/dist/modes/app-server/daemon.js.map +1 -1
  201. package/dist/modes/app-server/transports/websocket-connection-handler.d.ts.map +1 -1
  202. package/dist/modes/app-server/transports/websocket-connection-handler.js +4 -0
  203. package/dist/modes/app-server/transports/websocket-connection-handler.js.map +1 -1
  204. package/dist/modes/interactive/aborted-error-label.d.ts +2 -0
  205. package/dist/modes/interactive/aborted-error-label.d.ts.map +1 -1
  206. package/dist/modes/interactive/aborted-error-label.js +7 -0
  207. package/dist/modes/interactive/aborted-error-label.js.map +1 -1
  208. package/dist/modes/interactive/components/thinking-selector.d.ts +15 -3
  209. package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
  210. package/dist/modes/interactive/components/thinking-selector.js +68 -17
  211. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  212. package/dist/modes/interactive/external-editor.d.ts.map +1 -1
  213. package/dist/modes/interactive/external-editor.js +2 -1
  214. package/dist/modes/interactive/external-editor.js.map +1 -1
  215. package/dist/modes/interactive/interactive-mode.d.ts +6 -0
  216. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  217. package/dist/modes/interactive/interactive-mode.js +19 -12
  218. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  219. package/dist/modes/json-event.d.ts +16 -13
  220. package/dist/modes/json-event.d.ts.map +1 -1
  221. package/dist/modes/json-event.js +20 -6
  222. package/dist/modes/json-event.js.map +1 -1
  223. package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
  224. package/dist/modes/rpc/connection-handler.js +3 -0
  225. package/dist/modes/rpc/connection-handler.js.map +1 -1
  226. package/dist/modes/rpc/rpc-client.d.ts +7 -0
  227. package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
  228. package/dist/modes/rpc/rpc-client.js +7 -0
  229. package/dist/modes/rpc/rpc-client.js.map +1 -1
  230. package/dist/modes/rpc/rpc-types.d.ts +12 -0
  231. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  232. package/dist/modes/rpc/rpc-types.js.map +1 -1
  233. package/dist/package-manager-cli.d.ts +1 -0
  234. package/dist/package-manager-cli.d.ts.map +1 -1
  235. package/dist/package-manager-cli.js +186 -2
  236. package/dist/package-manager-cli.js.map +1 -1
  237. package/dist/utils/frontmatter.d.ts.map +1 -1
  238. package/dist/utils/frontmatter.js +2 -1
  239. package/dist/utils/frontmatter.js.map +1 -1
  240. package/dist/utils/shell.d.ts +3 -0
  241. package/dist/utils/shell.d.ts.map +1 -1
  242. package/dist/utils/shell.js +17 -5
  243. package/dist/utils/shell.js.map +1 -1
  244. package/dist/utils/syntax-highlight.d.ts +1 -0
  245. package/dist/utils/syntax-highlight.d.ts.map +1 -1
  246. package/dist/utils/syntax-highlight.js +60 -1
  247. package/dist/utils/syntax-highlight.js.map +1 -1
  248. package/dist/utils/text.d.ts +8 -0
  249. package/dist/utils/text.d.ts.map +1 -0
  250. package/dist/utils/text.js +9 -0
  251. package/dist/utils/text.js.map +1 -0
  252. package/docs/compaction.md +0 -2
  253. package/docs/custom-provider.md +6 -6
  254. package/docs/environment-variables.md +8 -8
  255. package/docs/extensions.md +6 -5
  256. package/docs/json.md +7 -2
  257. package/docs/keybindings.md +1 -1
  258. package/docs/packages.md +2 -2
  259. package/docs/rpc.md +32 -3
  260. package/docs/sdk.md +7 -2
  261. package/docs/settings.md +9 -1
  262. package/docs/terminal-setup.md +11 -9
  263. package/docs/usage.md +4 -1
  264. package/docs/windows.md +24 -2
  265. package/examples/extensions/custom-provider-anthropic/package-lock.json +28 -5
  266. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  267. package/node_modules/@anthropic-ai/sdk/CHANGELOG.md +558 -0
  268. package/node_modules/@anthropic-ai/sdk/README.md +16 -1
  269. package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.d.mts.map +1 -1
  270. package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.d.ts.map +1 -1
  271. package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.js +14 -2
  272. package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.js.map +1 -1
  273. package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.mjs +14 -2
  274. package/node_modules/@anthropic-ai/sdk/_vendor/partial-json-parser/parser.mjs.map +1 -1
  275. package/node_modules/@anthropic-ai/sdk/api-promise.d.mts +1 -0
  276. package/node_modules/@anthropic-ai/sdk/api-promise.d.mts.map +1 -1
  277. package/node_modules/@anthropic-ai/sdk/api-promise.d.ts +1 -0
  278. package/node_modules/@anthropic-ai/sdk/api-promise.d.ts.map +1 -1
  279. package/node_modules/@anthropic-ai/sdk/api-promise.mjs +1 -0
  280. package/node_modules/@anthropic-ai/sdk/api-promise.mjs.map +1 -1
  281. package/node_modules/@anthropic-ai/sdk/bin/migration-config.json +481 -0
  282. package/node_modules/@anthropic-ai/sdk/client.d.mts +165 -11
  283. package/node_modules/@anthropic-ai/sdk/client.d.mts.map +1 -1
  284. package/node_modules/@anthropic-ai/sdk/client.d.ts +165 -11
  285. package/node_modules/@anthropic-ai/sdk/client.d.ts.map +1 -1
  286. package/node_modules/@anthropic-ai/sdk/client.js +415 -38
  287. package/node_modules/@anthropic-ai/sdk/client.js.map +1 -1
  288. package/node_modules/@anthropic-ai/sdk/client.mjs +414 -37
  289. package/node_modules/@anthropic-ai/sdk/client.mjs.map +1 -1
  290. package/node_modules/@anthropic-ai/sdk/core/api-promise.d.mts +1 -0
  291. package/node_modules/@anthropic-ai/sdk/core/api-promise.d.mts.map +1 -1
  292. package/node_modules/@anthropic-ai/sdk/core/api-promise.d.ts +1 -0
  293. package/node_modules/@anthropic-ai/sdk/core/api-promise.d.ts.map +1 -1
  294. package/node_modules/@anthropic-ai/sdk/core/api-promise.js +7 -2
  295. package/node_modules/@anthropic-ai/sdk/core/api-promise.js.map +1 -1
  296. package/node_modules/@anthropic-ai/sdk/core/api-promise.mjs +8 -3
  297. package/node_modules/@anthropic-ai/sdk/core/api-promise.mjs.map +1 -1
  298. package/node_modules/@anthropic-ai/sdk/core/api.d.mts +11 -0
  299. package/node_modules/@anthropic-ai/sdk/core/api.d.mts.map +1 -0
  300. package/node_modules/@anthropic-ai/sdk/core/api.d.ts +11 -0
  301. package/node_modules/@anthropic-ai/sdk/core/api.d.ts.map +1 -0
  302. package/node_modules/@anthropic-ai/sdk/core/api.js +3 -0
  303. package/node_modules/@anthropic-ai/sdk/core/api.js.map +1 -0
  304. package/node_modules/@anthropic-ai/sdk/core/api.mjs +2 -0
  305. package/node_modules/@anthropic-ai/sdk/core/api.mjs.map +1 -0
  306. package/node_modules/@anthropic-ai/sdk/core/credentials.d.mts +131 -0
  307. package/node_modules/@anthropic-ai/sdk/core/credentials.d.mts.map +1 -0
  308. package/node_modules/@anthropic-ai/sdk/core/credentials.d.ts +131 -0
  309. package/node_modules/@anthropic-ai/sdk/core/credentials.d.ts.map +1 -0
  310. package/node_modules/@anthropic-ai/sdk/core/credentials.js +317 -0
  311. package/node_modules/@anthropic-ai/sdk/core/credentials.js.map +1 -0
  312. package/node_modules/@anthropic-ai/sdk/core/credentials.mjs +277 -0
  313. package/node_modules/@anthropic-ai/sdk/core/credentials.mjs.map +1 -0
  314. package/node_modules/@anthropic-ai/sdk/core/error.d.mts +12 -0
  315. package/node_modules/@anthropic-ai/sdk/core/error.d.mts.map +1 -1
  316. package/node_modules/@anthropic-ai/sdk/core/error.d.ts +12 -0
  317. package/node_modules/@anthropic-ai/sdk/core/error.d.ts.map +1 -1
  318. package/node_modules/@anthropic-ai/sdk/core/error.js +18 -1
  319. package/node_modules/@anthropic-ai/sdk/core/error.js.map +1 -1
  320. package/node_modules/@anthropic-ai/sdk/core/error.mjs +16 -0
  321. package/node_modules/@anthropic-ai/sdk/core/error.mjs.map +1 -1
  322. package/node_modules/@anthropic-ai/sdk/core/middleware.d.mts +154 -0
  323. package/node_modules/@anthropic-ai/sdk/core/middleware.d.mts.map +1 -0
  324. package/node_modules/@anthropic-ai/sdk/core/middleware.d.ts +154 -0
  325. package/node_modules/@anthropic-ai/sdk/core/middleware.d.ts.map +1 -0
  326. package/node_modules/@anthropic-ai/sdk/core/middleware.js +174 -0
  327. package/node_modules/@anthropic-ai/sdk/core/middleware.js.map +1 -0
  328. package/node_modules/@anthropic-ai/sdk/core/middleware.mjs +168 -0
  329. package/node_modules/@anthropic-ai/sdk/core/middleware.mjs.map +1 -0
  330. package/node_modules/@anthropic-ai/sdk/core/pagination.d.mts +20 -0
  331. package/node_modules/@anthropic-ai/sdk/core/pagination.d.mts.map +1 -1
  332. package/node_modules/@anthropic-ai/sdk/core/pagination.d.ts +20 -0
  333. package/node_modules/@anthropic-ai/sdk/core/pagination.d.ts.map +1 -1
  334. package/node_modules/@anthropic-ai/sdk/core/pagination.js +26 -1
  335. package/node_modules/@anthropic-ai/sdk/core/pagination.js.map +1 -1
  336. package/node_modules/@anthropic-ai/sdk/core/pagination.mjs +24 -0
  337. package/node_modules/@anthropic-ai/sdk/core/pagination.mjs.map +1 -1
  338. package/node_modules/@anthropic-ai/sdk/core/resource.d.mts.map +1 -1
  339. package/node_modules/@anthropic-ai/sdk/core/resource.d.ts.map +1 -1
  340. package/node_modules/@anthropic-ai/sdk/core/streaming.d.mts +9 -0
  341. package/node_modules/@anthropic-ai/sdk/core/streaming.d.mts.map +1 -1
  342. package/node_modules/@anthropic-ai/sdk/core/streaming.d.ts +9 -0
  343. package/node_modules/@anthropic-ai/sdk/core/streaming.d.ts.map +1 -1
  344. package/node_modules/@anthropic-ai/sdk/core/streaming.js +34 -1
  345. package/node_modules/@anthropic-ai/sdk/core/streaming.js.map +1 -1
  346. package/node_modules/@anthropic-ai/sdk/core/streaming.mjs +34 -1
  347. package/node_modules/@anthropic-ai/sdk/core/streaming.mjs.map +1 -1
  348. package/node_modules/@anthropic-ai/sdk/core/uploads.d.mts.map +1 -1
  349. package/node_modules/@anthropic-ai/sdk/core/uploads.d.ts.map +1 -1
  350. package/node_modules/@anthropic-ai/sdk/core/uploads.mjs.map +1 -1
  351. package/node_modules/@anthropic-ai/sdk/error.d.mts +1 -0
  352. package/node_modules/@anthropic-ai/sdk/error.d.mts.map +1 -1
  353. package/node_modules/@anthropic-ai/sdk/error.d.ts +1 -0
  354. package/node_modules/@anthropic-ai/sdk/error.d.ts.map +1 -1
  355. package/node_modules/@anthropic-ai/sdk/error.mjs +1 -0
  356. package/node_modules/@anthropic-ai/sdk/error.mjs.map +1 -1
  357. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.d.mts +23 -0
  358. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.d.mts.map +1 -0
  359. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.d.ts +23 -0
  360. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.d.ts.map +1 -0
  361. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.js +31 -0
  362. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.js.map +1 -0
  363. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.mjs +23 -0
  364. package/node_modules/@anthropic-ai/sdk/helpers/beta/environments.mjs.map +1 -0
  365. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.d.mts +6 -0
  366. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.d.mts.map +1 -1
  367. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.d.ts +6 -0
  368. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.d.ts.map +1 -1
  369. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.js +1 -0
  370. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.js.map +1 -1
  371. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.mjs +1 -0
  372. package/node_modules/@anthropic-ai/sdk/helpers/beta/json-schema.mjs.map +1 -1
  373. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.d.mts +1 -1
  374. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.d.mts.map +1 -1
  375. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.d.ts +1 -1
  376. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.d.ts.map +1 -1
  377. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.js +1 -1
  378. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.js.map +1 -1
  379. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.mjs +1 -1
  380. package/node_modules/@anthropic-ai/sdk/helpers/beta/mcp.mjs.map +1 -1
  381. package/node_modules/@anthropic-ai/sdk/helpers/beta/memory.d.mts.map +1 -1
  382. package/node_modules/@anthropic-ai/sdk/helpers/beta/memory.d.ts.map +1 -1
  383. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.d.mts +11 -5
  384. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.d.mts.map +1 -1
  385. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.d.ts +11 -5
  386. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.d.ts.map +1 -1
  387. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.js +2 -2
  388. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.js.map +1 -1
  389. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.mjs +2 -2
  390. package/node_modules/@anthropic-ai/sdk/helpers/beta/zod.mjs.map +1 -1
  391. package/node_modules/@anthropic-ai/sdk/helpers/index.d.mts.map +1 -1
  392. package/node_modules/@anthropic-ai/sdk/helpers/index.d.ts.map +1 -1
  393. package/node_modules/@anthropic-ai/sdk/helpers/index.mjs.map +1 -1
  394. package/node_modules/@anthropic-ai/sdk/helpers/json-schema.d.mts.map +1 -1
  395. package/node_modules/@anthropic-ai/sdk/helpers/json-schema.d.ts.map +1 -1
  396. package/node_modules/@anthropic-ai/sdk/helpers/json-schema.mjs.map +1 -1
  397. package/node_modules/@anthropic-ai/sdk/helpers/zod.d.mts +2 -2
  398. package/node_modules/@anthropic-ai/sdk/helpers/zod.d.mts.map +1 -1
  399. package/node_modules/@anthropic-ai/sdk/helpers/zod.d.ts +2 -2
  400. package/node_modules/@anthropic-ai/sdk/helpers/zod.d.ts.map +1 -1
  401. package/node_modules/@anthropic-ai/sdk/helpers/zod.js +1 -2
  402. package/node_modules/@anthropic-ai/sdk/helpers/zod.js.map +1 -1
  403. package/node_modules/@anthropic-ai/sdk/helpers/zod.mjs +1 -2
  404. package/node_modules/@anthropic-ai/sdk/helpers/zod.mjs.map +1 -1
  405. package/node_modules/@anthropic-ai/sdk/index.d.mts +4 -2
  406. package/node_modules/@anthropic-ai/sdk/index.d.mts.map +1 -1
  407. package/node_modules/@anthropic-ai/sdk/index.d.ts +4 -2
  408. package/node_modules/@anthropic-ai/sdk/index.d.ts.map +1 -1
  409. package/node_modules/@anthropic-ai/sdk/index.js +5 -1
  410. package/node_modules/@anthropic-ai/sdk/index.js.map +1 -1
  411. package/node_modules/@anthropic-ai/sdk/index.mjs +3 -2
  412. package/node_modules/@anthropic-ai/sdk/index.mjs.map +1 -1
  413. package/node_modules/@anthropic-ai/sdk/internal/constants.d.mts.map +1 -1
  414. package/node_modules/@anthropic-ai/sdk/internal/constants.d.ts.map +1 -1
  415. package/node_modules/@anthropic-ai/sdk/internal/constants.js +0 -5
  416. package/node_modules/@anthropic-ai/sdk/internal/constants.js.map +1 -1
  417. package/node_modules/@anthropic-ai/sdk/internal/constants.mjs +0 -5
  418. package/node_modules/@anthropic-ai/sdk/internal/constants.mjs.map +1 -1
  419. package/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.d.mts.map +1 -1
  420. package/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.d.ts.map +1 -1
  421. package/node_modules/@anthropic-ai/sdk/internal/decoders/jsonl.mjs.map +1 -1
  422. package/node_modules/@anthropic-ai/sdk/internal/decoders/line.mjs.map +1 -1
  423. package/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs.map +1 -1
  424. package/node_modules/@anthropic-ai/sdk/internal/file-store.d.mts +136 -0
  425. package/node_modules/@anthropic-ai/sdk/internal/file-store.d.mts.map +1 -0
  426. package/node_modules/@anthropic-ai/sdk/internal/file-store.d.ts +136 -0
  427. package/node_modules/@anthropic-ai/sdk/internal/file-store.d.ts.map +1 -0
  428. package/node_modules/@anthropic-ai/sdk/internal/file-store.js +531 -0
  429. package/node_modules/@anthropic-ai/sdk/internal/file-store.js.map +1 -0
  430. package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs +523 -0
  431. package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs.map +1 -0
  432. package/node_modules/@anthropic-ai/sdk/internal/headers.d.mts +7 -0
  433. package/node_modules/@anthropic-ai/sdk/internal/headers.d.mts.map +1 -1
  434. package/node_modules/@anthropic-ai/sdk/internal/headers.d.ts +7 -0
  435. package/node_modules/@anthropic-ai/sdk/internal/headers.d.ts.map +1 -1
  436. package/node_modules/@anthropic-ai/sdk/internal/headers.js +45 -4
  437. package/node_modules/@anthropic-ai/sdk/internal/headers.js.map +1 -1
  438. package/node_modules/@anthropic-ai/sdk/internal/headers.mjs +43 -3
  439. package/node_modules/@anthropic-ai/sdk/internal/headers.mjs.map +1 -1
  440. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.d.mts +10 -0
  441. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.d.mts.map +1 -0
  442. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.d.ts +10 -0
  443. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.d.ts.map +1 -0
  444. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.js +34 -0
  445. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.js.map +1 -0
  446. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.mjs +30 -0
  447. package/node_modules/@anthropic-ai/sdk/internal/message-stream-utils.mjs.map +1 -0
  448. package/node_modules/@anthropic-ai/sdk/internal/parse.d.mts +2 -1
  449. package/node_modules/@anthropic-ai/sdk/internal/parse.d.mts.map +1 -1
  450. package/node_modules/@anthropic-ai/sdk/internal/parse.d.ts +2 -1
  451. package/node_modules/@anthropic-ai/sdk/internal/parse.d.ts.map +1 -1
  452. package/node_modules/@anthropic-ai/sdk/internal/parse.js +16 -10
  453. package/node_modules/@anthropic-ai/sdk/internal/parse.js.map +1 -1
  454. package/node_modules/@anthropic-ai/sdk/internal/parse.mjs +15 -9
  455. package/node_modules/@anthropic-ai/sdk/internal/parse.mjs.map +1 -1
  456. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.d.mts +7 -0
  457. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.d.mts.map +1 -0
  458. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.d.ts +7 -0
  459. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.d.ts.map +1 -0
  460. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.js +13 -0
  461. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.js.map +1 -0
  462. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.mjs +9 -0
  463. package/node_modules/@anthropic-ai/sdk/internal/qs/formats.mjs.map +1 -0
  464. package/node_modules/@anthropic-ai/sdk/internal/qs/index.d.mts +10 -0
  465. package/node_modules/@anthropic-ai/sdk/internal/qs/index.d.mts.map +1 -0
  466. package/node_modules/@anthropic-ai/sdk/internal/qs/index.d.ts +10 -0
  467. package/node_modules/@anthropic-ai/sdk/internal/qs/index.d.ts.map +1 -0
  468. package/node_modules/@anthropic-ai/sdk/internal/qs/index.js +14 -0
  469. package/node_modules/@anthropic-ai/sdk/internal/qs/index.js.map +1 -0
  470. package/node_modules/@anthropic-ai/sdk/internal/qs/index.mjs +10 -0
  471. package/node_modules/@anthropic-ai/sdk/internal/qs/index.mjs.map +1 -0
  472. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.d.mts +3 -0
  473. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.d.mts.map +1 -0
  474. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.d.ts +3 -0
  475. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.d.ts.map +1 -0
  476. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.js +277 -0
  477. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.js.map +1 -0
  478. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.mjs +274 -0
  479. package/node_modules/@anthropic-ai/sdk/internal/qs/stringify.mjs.map +1 -0
  480. package/node_modules/@anthropic-ai/sdk/internal/qs/types.d.mts +57 -0
  481. package/node_modules/@anthropic-ai/sdk/internal/qs/types.d.mts.map +1 -0
  482. package/node_modules/@anthropic-ai/sdk/internal/qs/types.d.ts +57 -0
  483. package/node_modules/@anthropic-ai/sdk/internal/qs/types.d.ts.map +1 -0
  484. package/node_modules/@anthropic-ai/sdk/internal/qs/types.js +3 -0
  485. package/node_modules/@anthropic-ai/sdk/internal/qs/types.js.map +1 -0
  486. package/node_modules/@anthropic-ai/sdk/internal/qs/types.mjs +2 -0
  487. package/node_modules/@anthropic-ai/sdk/internal/qs/types.mjs.map +1 -0
  488. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.d.mts +15 -0
  489. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.d.mts.map +1 -0
  490. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.d.ts +15 -0
  491. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.d.ts.map +1 -0
  492. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.js +230 -0
  493. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.js.map +1 -0
  494. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.mjs +217 -0
  495. package/node_modules/@anthropic-ai/sdk/internal/qs/utils.mjs.map +1 -0
  496. package/node_modules/@anthropic-ai/sdk/internal/request-options.d.mts +52 -2
  497. package/node_modules/@anthropic-ai/sdk/internal/request-options.d.mts.map +1 -1
  498. package/node_modules/@anthropic-ai/sdk/internal/request-options.d.ts +52 -2
  499. package/node_modules/@anthropic-ai/sdk/internal/request-options.d.ts.map +1 -1
  500. package/node_modules/@anthropic-ai/sdk/internal/request-options.js +12 -1
  501. package/node_modules/@anthropic-ai/sdk/internal/request-options.js.map +1 -1
  502. package/node_modules/@anthropic-ai/sdk/internal/request-options.mjs +10 -0
  503. package/node_modules/@anthropic-ai/sdk/internal/request-options.mjs.map +1 -1
  504. package/node_modules/@anthropic-ai/sdk/internal/request-signal.d.mts +4 -0
  505. package/node_modules/@anthropic-ai/sdk/internal/request-signal.d.mts.map +1 -0
  506. package/node_modules/@anthropic-ai/sdk/internal/request-signal.d.ts +4 -0
  507. package/node_modules/@anthropic-ai/sdk/internal/request-signal.d.ts.map +1 -0
  508. package/node_modules/@anthropic-ai/sdk/internal/request-signal.js +50 -0
  509. package/node_modules/@anthropic-ai/sdk/internal/request-signal.js.map +1 -0
  510. package/node_modules/@anthropic-ai/sdk/internal/request-signal.mjs +45 -0
  511. package/node_modules/@anthropic-ai/sdk/internal/request-signal.mjs.map +1 -0
  512. package/node_modules/@anthropic-ai/sdk/internal/shims.d.mts +6 -0
  513. package/node_modules/@anthropic-ai/sdk/internal/shims.d.mts.map +1 -1
  514. package/node_modules/@anthropic-ai/sdk/internal/shims.d.ts +6 -0
  515. package/node_modules/@anthropic-ai/sdk/internal/shims.d.ts.map +1 -1
  516. package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.d.mts +60 -0
  517. package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.d.mts.map +1 -0
  518. package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.d.ts +60 -0
  519. package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.d.ts.map +1 -0
  520. package/node_modules/@anthropic-ai/sdk/{lib → internal}/stainless-helper-header.js +27 -6
  521. package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.js.map +1 -0
  522. package/node_modules/@anthropic-ai/sdk/{lib → internal}/stainless-helper-header.mjs +25 -5
  523. package/node_modules/@anthropic-ai/sdk/internal/stainless-helper-header.mjs.map +1 -0
  524. package/node_modules/@anthropic-ai/sdk/internal/to-file.d.mts.map +1 -1
  525. package/node_modules/@anthropic-ai/sdk/internal/to-file.d.ts.map +1 -1
  526. package/node_modules/@anthropic-ai/sdk/internal/to-file.mjs.map +1 -1
  527. package/node_modules/@anthropic-ai/sdk/internal/types.d.mts +12 -6
  528. package/node_modules/@anthropic-ai/sdk/internal/types.d.mts.map +1 -1
  529. package/node_modules/@anthropic-ai/sdk/internal/types.d.ts +12 -6
  530. package/node_modules/@anthropic-ai/sdk/internal/types.d.ts.map +1 -1
  531. package/node_modules/@anthropic-ai/sdk/internal/uploads.d.mts.map +1 -1
  532. package/node_modules/@anthropic-ai/sdk/internal/uploads.d.ts.map +1 -1
  533. package/node_modules/@anthropic-ai/sdk/internal/uploads.mjs.map +1 -1
  534. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.d.mts +13 -0
  535. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.d.mts.map +1 -0
  536. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.d.ts +13 -0
  537. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.d.ts.map +1 -0
  538. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.js +26 -0
  539. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.js.map +1 -0
  540. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.mjs +23 -0
  541. package/node_modules/@anthropic-ai/sdk/internal/utils/abort.mjs.map +1 -0
  542. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.d.mts +31 -0
  543. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.d.mts.map +1 -0
  544. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.d.ts +31 -0
  545. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.d.ts.map +1 -0
  546. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.js +75 -0
  547. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.js.map +1 -0
  548. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.mjs +71 -0
  549. package/node_modules/@anthropic-ai/sdk/internal/utils/async-queue.mjs.map +1 -0
  550. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.d.mts +23 -0
  551. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.d.mts.map +1 -0
  552. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.d.ts +23 -0
  553. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.d.ts.map +1 -0
  554. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.js +44 -0
  555. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.js.map +1 -0
  556. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.mjs +36 -0
  557. package/node_modules/@anthropic-ai/sdk/internal/utils/backoff.mjs.map +1 -0
  558. package/node_modules/@anthropic-ai/sdk/internal/utils/base64.mjs.map +1 -1
  559. package/node_modules/@anthropic-ai/sdk/internal/utils/log.d.mts +11 -1
  560. package/node_modules/@anthropic-ai/sdk/internal/utils/log.d.mts.map +1 -1
  561. package/node_modules/@anthropic-ai/sdk/internal/utils/log.d.ts +11 -1
  562. package/node_modules/@anthropic-ai/sdk/internal/utils/log.d.ts.map +1 -1
  563. package/node_modules/@anthropic-ai/sdk/internal/utils/log.js +37 -11
  564. package/node_modules/@anthropic-ai/sdk/internal/utils/log.js.map +1 -1
  565. package/node_modules/@anthropic-ai/sdk/internal/utils/log.mjs +35 -10
  566. package/node_modules/@anthropic-ai/sdk/internal/utils/log.mjs.map +1 -1
  567. package/node_modules/@anthropic-ai/sdk/internal/utils/path.mjs.map +1 -1
  568. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.d.mts +11 -0
  569. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.d.mts.map +1 -0
  570. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.d.ts +11 -0
  571. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.d.ts.map +1 -0
  572. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.js +18 -0
  573. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.js.map +1 -0
  574. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.mjs +15 -0
  575. package/node_modules/@anthropic-ai/sdk/internal/utils/promise.mjs.map +1 -0
  576. package/node_modules/@anthropic-ai/sdk/internal/utils/query.d.mts +0 -3
  577. package/node_modules/@anthropic-ai/sdk/internal/utils/query.d.mts.map +1 -1
  578. package/node_modules/@anthropic-ai/sdk/internal/utils/query.d.ts +0 -3
  579. package/node_modules/@anthropic-ai/sdk/internal/utils/query.d.ts.map +1 -1
  580. package/node_modules/@anthropic-ai/sdk/internal/utils/query.js +3 -16
  581. package/node_modules/@anthropic-ai/sdk/internal/utils/query.js.map +1 -1
  582. package/node_modules/@anthropic-ai/sdk/internal/utils/query.mjs +2 -16
  583. package/node_modules/@anthropic-ai/sdk/internal/utils/query.mjs.map +1 -1
  584. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.mts +9 -1
  585. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.mts.map +1 -1
  586. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.ts +9 -1
  587. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.d.ts.map +1 -1
  588. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.js +23 -2
  589. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.js.map +1 -1
  590. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs +23 -2
  591. package/node_modules/@anthropic-ai/sdk/internal/utils/sleep.mjs.map +1 -1
  592. package/node_modules/@anthropic-ai/sdk/internal/utils/time.d.mts +3 -0
  593. package/node_modules/@anthropic-ai/sdk/internal/utils/time.d.mts.map +1 -0
  594. package/node_modules/@anthropic-ai/sdk/internal/utils/time.d.ts +3 -0
  595. package/node_modules/@anthropic-ai/sdk/internal/utils/time.d.ts.map +1 -0
  596. package/node_modules/@anthropic-ai/sdk/internal/utils/time.js +8 -0
  597. package/node_modules/@anthropic-ai/sdk/internal/utils/time.js.map +1 -0
  598. package/node_modules/@anthropic-ai/sdk/internal/utils/time.mjs +5 -0
  599. package/node_modules/@anthropic-ai/sdk/internal/utils/time.mjs.map +1 -0
  600. package/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs.map +1 -1
  601. package/node_modules/@anthropic-ai/sdk/internal/utils.d.mts.map +1 -1
  602. package/node_modules/@anthropic-ai/sdk/internal/utils.d.ts.map +1 -1
  603. package/node_modules/@anthropic-ai/sdk/internal/utils.mjs.map +1 -1
  604. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.mts +2 -0
  605. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.mts.map +1 -1
  606. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.ts +2 -0
  607. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.ts.map +1 -1
  608. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js +66 -31
  609. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js.map +1 -1
  610. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs +66 -31
  611. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs.map +1 -1
  612. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.mts +2 -0
  613. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.mts.map +1 -1
  614. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts +2 -0
  615. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts.map +1 -1
  616. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js +37 -26
  617. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js.map +1 -1
  618. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs +34 -23
  619. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs.map +1 -1
  620. package/node_modules/@anthropic-ai/sdk/lib/beta-parser.d.mts.map +1 -1
  621. package/node_modules/@anthropic-ai/sdk/lib/beta-parser.d.ts.map +1 -1
  622. package/node_modules/@anthropic-ai/sdk/lib/beta-parser.mjs.map +1 -1
  623. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.d.mts +39 -0
  624. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.d.mts.map +1 -0
  625. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.d.ts +39 -0
  626. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.d.ts.map +1 -0
  627. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js +245 -0
  628. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js.map +1 -0
  629. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs +208 -0
  630. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs.map +1 -0
  631. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.d.mts +11 -0
  632. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.d.mts.map +1 -0
  633. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.d.ts +11 -0
  634. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.d.ts.map +1 -0
  635. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js +72 -0
  636. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js.map +1 -0
  637. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs +35 -0
  638. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs.map +1 -0
  639. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.d.mts +40 -0
  640. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.d.mts.map +1 -0
  641. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.d.ts +40 -0
  642. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.d.ts.map +1 -0
  643. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.js +82 -0
  644. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.js.map +1 -0
  645. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.mjs +79 -0
  646. package/node_modules/@anthropic-ai/sdk/lib/credentials/oidc-federation.mjs.map +1 -0
  647. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.d.mts +54 -0
  648. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.d.mts.map +1 -0
  649. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.d.ts +54 -0
  650. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.d.ts.map +1 -0
  651. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.js +112 -0
  652. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.js.map +1 -0
  653. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.mjs +108 -0
  654. package/node_modules/@anthropic-ai/sdk/lib/credentials/token-cache.mjs.map +1 -0
  655. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.mts +96 -0
  656. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.mts.map +1 -0
  657. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.ts +96 -0
  658. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.ts.map +1 -0
  659. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js +266 -0
  660. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js.map +1 -0
  661. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs +224 -0
  662. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs.map +1 -0
  663. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.d.mts +21 -0
  664. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.d.mts.map +1 -0
  665. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.d.ts +21 -0
  666. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.d.ts.map +1 -0
  667. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js +130 -0
  668. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js.map +1 -0
  669. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs +94 -0
  670. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs.map +1 -0
  671. package/node_modules/@anthropic-ai/sdk/lib/credentials.d.mts +4 -0
  672. package/node_modules/@anthropic-ai/sdk/lib/credentials.d.mts.map +1 -0
  673. package/node_modules/@anthropic-ai/sdk/lib/credentials.d.ts +4 -0
  674. package/node_modules/@anthropic-ai/sdk/lib/credentials.d.ts.map +1 -0
  675. package/node_modules/@anthropic-ai/sdk/lib/credentials.js +8 -0
  676. package/node_modules/@anthropic-ai/sdk/lib/credentials.js.map +1 -0
  677. package/node_modules/@anthropic-ai/sdk/lib/credentials.mjs +3 -0
  678. package/node_modules/@anthropic-ai/sdk/lib/credentials.mjs.map +1 -0
  679. package/node_modules/@anthropic-ai/sdk/lib/environments/index.d.mts +4 -0
  680. package/node_modules/@anthropic-ai/sdk/lib/environments/index.d.mts.map +1 -0
  681. package/node_modules/@anthropic-ai/sdk/lib/environments/index.d.ts +4 -0
  682. package/node_modules/@anthropic-ai/sdk/lib/environments/index.d.ts.map +1 -0
  683. package/node_modules/@anthropic-ai/sdk/lib/environments/index.js +18 -0
  684. package/node_modules/@anthropic-ai/sdk/lib/environments/index.js.map +1 -0
  685. package/node_modules/@anthropic-ai/sdk/lib/environments/index.mjs +4 -0
  686. package/node_modules/@anthropic-ai/sdk/lib/environments/index.mjs.map +1 -0
  687. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.d.mts +95 -0
  688. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.d.mts.map +1 -0
  689. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.d.ts +95 -0
  690. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.d.ts.map +1 -0
  691. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.js +226 -0
  692. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.js.map +1 -0
  693. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.mjs +217 -0
  694. package/node_modules/@anthropic-ai/sdk/lib/environments/poller.mjs.map +1 -0
  695. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.d.mts +227 -0
  696. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.d.mts.map +1 -0
  697. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.d.ts +227 -0
  698. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.d.ts.map +1 -0
  699. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.js +569 -0
  700. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.js.map +1 -0
  701. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.mjs +564 -0
  702. package/node_modules/@anthropic-ai/sdk/lib/environments/worker.mjs.map +1 -0
  703. package/node_modules/@anthropic-ai/sdk/lib/helper-client.d.mts +31 -0
  704. package/node_modules/@anthropic-ai/sdk/lib/helper-client.d.mts.map +1 -0
  705. package/node_modules/@anthropic-ai/sdk/lib/helper-client.d.ts +31 -0
  706. package/node_modules/@anthropic-ai/sdk/lib/helper-client.d.ts.map +1 -0
  707. package/node_modules/@anthropic-ai/sdk/lib/helper-client.js +58 -0
  708. package/node_modules/@anthropic-ai/sdk/lib/helper-client.js.map +1 -0
  709. package/node_modules/@anthropic-ai/sdk/lib/helper-client.mjs +55 -0
  710. package/node_modules/@anthropic-ai/sdk/lib/helper-client.mjs.map +1 -0
  711. package/node_modules/@anthropic-ai/sdk/lib/middleware.d.mts +98 -0
  712. package/node_modules/@anthropic-ai/sdk/lib/middleware.d.mts.map +1 -0
  713. package/node_modules/@anthropic-ai/sdk/lib/middleware.d.ts +98 -0
  714. package/node_modules/@anthropic-ai/sdk/lib/middleware.d.ts.map +1 -0
  715. package/node_modules/@anthropic-ai/sdk/lib/middleware.js +754 -0
  716. package/node_modules/@anthropic-ai/sdk/lib/middleware.js.map +1 -0
  717. package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs +749 -0
  718. package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs.map +1 -0
  719. package/node_modules/@anthropic-ai/sdk/lib/parser.d.mts.map +1 -1
  720. package/node_modules/@anthropic-ai/sdk/lib/parser.d.ts.map +1 -1
  721. package/node_modules/@anthropic-ai/sdk/lib/parser.mjs.map +1 -1
  722. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts +22 -0
  723. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts.map +1 -0
  724. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts +22 -0
  725. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts.map +1 -0
  726. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js +88 -0
  727. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js.map +1 -0
  728. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs +85 -0
  729. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs.map +1 -0
  730. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.d.mts +38 -5
  731. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.d.mts.map +1 -1
  732. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.d.ts +38 -5
  733. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.d.ts.map +1 -1
  734. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.js +28 -0
  735. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.js.map +1 -1
  736. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.mjs +25 -1
  737. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaRunnableTool.mjs.map +1 -1
  738. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.mts +1 -1
  739. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.mts.map +1 -1
  740. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.ts +1 -1
  741. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.ts.map +1 -1
  742. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js +107 -29
  743. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js.map +1 -1
  744. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs +105 -27
  745. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs.map +1 -1
  746. package/node_modules/@anthropic-ai/sdk/lib/tools/CompactionControl.d.mts.map +1 -1
  747. package/node_modules/@anthropic-ai/sdk/lib/tools/CompactionControl.d.ts.map +1 -1
  748. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.d.mts +179 -0
  749. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.d.mts.map +1 -0
  750. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.d.ts +179 -0
  751. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.d.ts.map +1 -0
  752. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.js +728 -0
  753. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.js.map +1 -0
  754. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.mjs +724 -0
  755. package/node_modules/@anthropic-ai/sdk/lib/tools/SessionToolRunner.mjs.map +1 -0
  756. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolError.d.mts.map +1 -1
  757. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolError.d.ts.map +1 -1
  758. package/node_modules/@anthropic-ai/sdk/lib/transform-json-schema.mjs.map +1 -1
  759. package/node_modules/@anthropic-ai/sdk/package.json +32 -15
  760. package/node_modules/@anthropic-ai/sdk/pagination.d.mts +1 -0
  761. package/node_modules/@anthropic-ai/sdk/pagination.d.mts.map +1 -1
  762. package/node_modules/@anthropic-ai/sdk/pagination.d.ts +1 -0
  763. package/node_modules/@anthropic-ai/sdk/pagination.d.ts.map +1 -1
  764. package/node_modules/@anthropic-ai/sdk/pagination.mjs +1 -0
  765. package/node_modules/@anthropic-ai/sdk/pagination.mjs.map +1 -1
  766. package/node_modules/@anthropic-ai/sdk/resource.d.mts +1 -0
  767. package/node_modules/@anthropic-ai/sdk/resource.d.mts.map +1 -1
  768. package/node_modules/@anthropic-ai/sdk/resource.d.ts +1 -0
  769. package/node_modules/@anthropic-ai/sdk/resource.d.ts.map +1 -1
  770. package/node_modules/@anthropic-ai/sdk/resource.mjs +1 -0
  771. package/node_modules/@anthropic-ai/sdk/resource.mjs.map +1 -1
  772. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts +608 -68
  773. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts.map +1 -1
  774. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts +608 -68
  775. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts.map +1 -1
  776. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.js +2 -2
  777. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.js.map +1 -1
  778. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.mjs +2 -2
  779. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.mjs.map +1 -1
  780. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.d.mts +1 -1
  781. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.d.mts.map +1 -1
  782. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.d.ts +1 -1
  783. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.d.ts.map +1 -1
  784. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.js.map +1 -1
  785. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/index.mjs.map +1 -1
  786. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/versions.d.mts.map +1 -1
  787. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/versions.d.ts.map +1 -1
  788. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/versions.mjs.map +1 -1
  789. package/node_modules/@anthropic-ai/sdk/resources/beta/agents.d.mts.map +1 -1
  790. package/node_modules/@anthropic-ai/sdk/resources/beta/agents.d.ts.map +1 -1
  791. package/node_modules/@anthropic-ai/sdk/resources/beta/agents.mjs.map +1 -1
  792. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts +51 -13
  793. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts.map +1 -1
  794. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts +51 -13
  795. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts.map +1 -1
  796. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js +22 -2
  797. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js.map +1 -1
  798. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs +22 -2
  799. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs.map +1 -1
  800. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.mts +306 -0
  801. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.mts.map +1 -0
  802. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.ts +306 -0
  803. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.ts.map +1 -0
  804. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.js +55 -0
  805. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.js.map +1 -0
  806. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.mjs +51 -0
  807. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.mjs.map +1 -0
  808. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts +698 -0
  809. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts.map +1 -0
  810. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts +698 -0
  811. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts.map +1 -0
  812. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.js +196 -0
  813. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.js.map +1 -0
  814. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.mjs +192 -0
  815. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.mjs.map +1 -0
  816. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts +309 -0
  817. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts.map +1 -0
  818. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts +309 -0
  819. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts.map +1 -0
  820. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.js +116 -0
  821. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.js.map +1 -0
  822. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.mjs +112 -0
  823. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.mjs.map +1 -0
  824. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts +426 -0
  825. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts.map +1 -0
  826. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts +426 -0
  827. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts.map +1 -0
  828. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.js +150 -0
  829. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.js.map +1 -0
  830. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.mjs +145 -0
  831. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.mjs.map +1 -0
  832. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.d.mts +3 -0
  833. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.d.mts.map +1 -0
  834. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.d.ts +3 -0
  835. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.d.ts.map +1 -0
  836. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.js +9 -0
  837. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.js.map +1 -0
  838. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.mjs +4 -0
  839. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/index.mjs.map +1 -0
  840. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.d.mts +501 -0
  841. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.d.mts.map +1 -0
  842. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.d.ts +501 -0
  843. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.d.ts.map +1 -0
  844. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.js +257 -0
  845. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.js.map +1 -0
  846. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.mjs +251 -0
  847. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/work.mjs.map +1 -0
  848. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.d.mts +1 -388
  849. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.d.mts.map +1 -1
  850. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.d.ts +1 -388
  851. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.d.ts.map +1 -1
  852. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.js +2 -138
  853. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.js.map +1 -1
  854. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.mjs +1 -136
  855. package/node_modules/@anthropic-ai/sdk/resources/beta/environments.mjs.map +1 -1
  856. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts +22 -22
  857. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts.map +1 -1
  858. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts +22 -22
  859. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts.map +1 -1
  860. package/node_modules/@anthropic-ai/sdk/resources/beta/files.js +5 -5
  861. package/node_modules/@anthropic-ai/sdk/resources/beta/files.js.map +1 -1
  862. package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs +5 -5
  863. package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs.map +1 -1
  864. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts +11 -6
  865. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts.map +1 -1
  866. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts +11 -6
  867. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts.map +1 -1
  868. package/node_modules/@anthropic-ai/sdk/resources/beta/index.js +23 -13
  869. package/node_modules/@anthropic-ai/sdk/resources/beta/index.js.map +1 -1
  870. package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs +6 -1
  871. package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs.map +1 -1
  872. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.d.mts +1 -1
  873. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.d.mts.map +1 -1
  874. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.d.ts +1 -1
  875. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.d.ts.map +1 -1
  876. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.js.map +1 -1
  877. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/index.mjs.map +1 -1
  878. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts +136 -24
  879. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts.map +1 -1
  880. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts +136 -24
  881. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts.map +1 -1
  882. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.js +10 -10
  883. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.js.map +1 -1
  884. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.mjs +10 -10
  885. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.mjs.map +1 -1
  886. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.d.mts +60 -16
  887. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.d.mts.map +1 -1
  888. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.d.ts +60 -16
  889. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.d.ts.map +1 -1
  890. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.js +12 -12
  891. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.js.map +1 -1
  892. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.mjs +12 -12
  893. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-stores.mjs.map +1 -1
  894. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts +105 -7
  895. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
  896. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts +105 -7
  897. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
  898. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.js +6 -6
  899. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.js.map +1 -1
  900. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.mjs +6 -6
  901. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.mjs.map +1 -1
  902. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores.d.mts.map +1 -1
  903. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores.d.ts.map +1 -1
  904. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores.mjs.map +1 -1
  905. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.mts +81 -30
  906. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.mts.map +1 -1
  907. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.ts +81 -30
  908. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.d.ts.map +1 -1
  909. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.js +12 -9
  910. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.js.map +1 -1
  911. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.mjs +12 -9
  912. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/batches.mjs.map +1 -1
  913. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts +1 -1
  914. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts.map +1 -1
  915. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts +1 -1
  916. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts.map +1 -1
  917. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.js.map +1 -1
  918. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.mjs.map +1 -1
  919. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts +2453 -380
  920. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts.map +1 -1
  921. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts +2453 -380
  922. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts.map +1 -1
  923. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js +16 -22
  924. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js.map +1 -1
  925. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs +16 -22
  926. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs.map +1 -1
  927. package/node_modules/@anthropic-ai/sdk/resources/beta/messages.d.mts.map +1 -1
  928. package/node_modules/@anthropic-ai/sdk/resources/beta/messages.d.ts.map +1 -1
  929. package/node_modules/@anthropic-ai/sdk/resources/beta/messages.mjs.map +1 -1
  930. package/node_modules/@anthropic-ai/sdk/resources/beta/models.d.mts +6 -0
  931. package/node_modules/@anthropic-ai/sdk/resources/beta/models.d.mts.map +1 -1
  932. package/node_modules/@anthropic-ai/sdk/resources/beta/models.d.ts +6 -0
  933. package/node_modules/@anthropic-ai/sdk/resources/beta/models.d.ts.map +1 -1
  934. package/node_modules/@anthropic-ai/sdk/resources/beta/models.mjs.map +1 -1
  935. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.mts +643 -19
  936. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.mts.map +1 -1
  937. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.ts +643 -19
  938. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.ts.map +1 -1
  939. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.js +29 -2
  940. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.js.map +1 -1
  941. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.mjs +27 -1
  942. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.mjs.map +1 -1
  943. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.d.mts +3 -2
  944. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.d.mts.map +1 -1
  945. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.d.ts +3 -2
  946. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.d.ts.map +1 -1
  947. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.js +3 -1
  948. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.js.map +1 -1
  949. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.mjs +1 -0
  950. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/index.mjs.map +1 -1
  951. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/resources.d.mts.map +1 -1
  952. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/resources.d.ts.map +1 -1
  953. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/resources.mjs.map +1 -1
  954. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.mts +455 -8
  955. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.mts.map +1 -1
  956. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.ts +455 -8
  957. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.ts.map +1 -1
  958. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.js +5 -1
  959. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.js.map +1 -1
  960. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.mjs +6 -2
  961. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.mjs.map +1 -1
  962. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.d.mts +78 -0
  963. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.d.mts.map +1 -0
  964. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.d.ts +78 -0
  965. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.d.ts.map +1 -0
  966. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.js +61 -0
  967. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.js.map +1 -0
  968. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.mjs +57 -0
  969. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/events.mjs.map +1 -0
  970. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.d.mts +3 -0
  971. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.d.mts.map +1 -0
  972. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.d.ts +3 -0
  973. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.d.ts.map +1 -0
  974. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.js +9 -0
  975. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.js.map +1 -0
  976. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.mjs +4 -0
  977. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/index.mjs.map +1 -0
  978. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts +195 -0
  979. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts.map +1 -0
  980. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts +195 -0
  981. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts.map +1 -0
  982. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.js +88 -0
  983. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.js.map +1 -0
  984. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.mjs +83 -0
  985. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.mjs.map +1 -0
  986. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.d.mts +2 -0
  987. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.d.mts.map +1 -0
  988. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.d.ts +2 -0
  989. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.d.ts.map +1 -0
  990. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.js +6 -0
  991. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.js.map +1 -0
  992. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.mjs +3 -0
  993. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads.mjs.map +1 -0
  994. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions.d.mts.map +1 -1
  995. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions.d.ts.map +1 -1
  996. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions.mjs.map +1 -1
  997. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts +1 -1
  998. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts.map +1 -1
  999. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts +1 -1
  1000. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts.map +1 -1
  1001. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.js.map +1 -1
  1002. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.mjs.map +1 -1
  1003. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts +13 -11
  1004. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts.map +1 -1
  1005. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts +13 -11
  1006. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts.map +1 -1
  1007. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js +5 -3
  1008. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js.map +1 -1
  1009. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs +5 -3
  1010. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs.map +1 -1
  1011. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts +31 -3
  1012. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts.map +1 -1
  1013. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts +31 -3
  1014. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts.map +1 -1
  1015. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js +32 -3
  1016. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js.map +1 -1
  1017. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs +32 -3
  1018. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs.map +1 -1
  1019. package/node_modules/@anthropic-ai/sdk/resources/beta/skills.d.mts.map +1 -1
  1020. package/node_modules/@anthropic-ai/sdk/resources/beta/skills.d.ts.map +1 -1
  1021. package/node_modules/@anthropic-ai/sdk/resources/beta/skills.mjs.map +1 -1
  1022. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.d.mts +163 -0
  1023. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.d.mts.map +1 -0
  1024. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.d.ts +163 -0
  1025. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.d.ts.map +1 -0
  1026. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.js +129 -0
  1027. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.js.map +1 -0
  1028. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.mjs +125 -0
  1029. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/certificates.mjs.map +1 -0
  1030. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.d.mts +3 -0
  1031. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.d.mts.map +1 -0
  1032. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.d.ts +3 -0
  1033. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.d.ts.map +1 -0
  1034. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.js +9 -0
  1035. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.js.map +1 -0
  1036. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.mjs +4 -0
  1037. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/index.mjs.map +1 -0
  1038. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.d.mts +212 -0
  1039. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.d.mts.map +1 -0
  1040. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.d.ts +212 -0
  1041. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.d.ts.map +1 -0
  1042. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.js +181 -0
  1043. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.js.map +1 -0
  1044. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.mjs +176 -0
  1045. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels/tunnels.mjs.map +1 -0
  1046. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.d.mts +2 -0
  1047. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.d.mts.map +1 -0
  1048. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.d.ts +2 -0
  1049. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.d.ts.map +1 -0
  1050. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.js +6 -0
  1051. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.js.map +1 -0
  1052. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.mjs +3 -0
  1053. package/node_modules/@anthropic-ai/sdk/resources/beta/tunnels.mjs.map +1 -0
  1054. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts +62 -0
  1055. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts.map +1 -1
  1056. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts +62 -0
  1057. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts.map +1 -1
  1058. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.js +5 -5
  1059. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.mjs +5 -5
  1060. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.mjs.map +1 -1
  1061. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.d.mts +256 -4
  1062. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.d.mts.map +1 -1
  1063. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.d.ts +256 -4
  1064. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.d.ts.map +1 -1
  1065. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.js +22 -0
  1066. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.js.map +1 -1
  1067. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.mjs +22 -0
  1068. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/credentials.mjs.map +1 -1
  1069. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.d.mts +1 -1
  1070. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.d.mts.map +1 -1
  1071. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.d.ts +1 -1
  1072. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.d.ts.map +1 -1
  1073. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.js.map +1 -1
  1074. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/index.mjs.map +1 -1
  1075. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.d.mts +2 -2
  1076. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.d.mts.map +1 -1
  1077. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.d.ts +2 -2
  1078. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.d.ts.map +1 -1
  1079. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.js.map +1 -1
  1080. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults/vaults.mjs.map +1 -1
  1081. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults.d.mts.map +1 -1
  1082. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults.d.ts.map +1 -1
  1083. package/node_modules/@anthropic-ai/sdk/resources/beta/vaults.mjs.map +1 -1
  1084. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts +466 -0
  1085. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts.map +1 -0
  1086. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts +466 -0
  1087. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts.map +1 -0
  1088. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js +20 -0
  1089. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js.map +1 -0
  1090. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs +16 -0
  1091. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs.map +1 -0
  1092. package/node_modules/@anthropic-ai/sdk/resources/beta.d.mts.map +1 -1
  1093. package/node_modules/@anthropic-ai/sdk/resources/beta.d.ts.map +1 -1
  1094. package/node_modules/@anthropic-ai/sdk/resources/beta.mjs.map +1 -1
  1095. package/node_modules/@anthropic-ai/sdk/resources/completions.d.mts +18 -11
  1096. package/node_modules/@anthropic-ai/sdk/resources/completions.d.mts.map +1 -1
  1097. package/node_modules/@anthropic-ai/sdk/resources/completions.d.ts +18 -11
  1098. package/node_modules/@anthropic-ai/sdk/resources/completions.d.ts.map +1 -1
  1099. package/node_modules/@anthropic-ai/sdk/resources/completions.mjs.map +1 -1
  1100. package/node_modules/@anthropic-ai/sdk/resources/files.d.mts +105 -0
  1101. package/node_modules/@anthropic-ai/sdk/resources/files.d.mts.map +1 -0
  1102. package/node_modules/@anthropic-ai/sdk/resources/files.d.ts +105 -0
  1103. package/node_modules/@anthropic-ai/sdk/resources/files.d.ts.map +1 -0
  1104. package/node_modules/@anthropic-ai/sdk/resources/files.js +52 -0
  1105. package/node_modules/@anthropic-ai/sdk/resources/files.js.map +1 -0
  1106. package/node_modules/@anthropic-ai/sdk/resources/files.mjs +48 -0
  1107. package/node_modules/@anthropic-ai/sdk/resources/files.mjs.map +1 -0
  1108. package/node_modules/@anthropic-ai/sdk/resources/index.d.mts +4 -2
  1109. package/node_modules/@anthropic-ai/sdk/resources/index.d.mts.map +1 -1
  1110. package/node_modules/@anthropic-ai/sdk/resources/index.d.ts +4 -2
  1111. package/node_modules/@anthropic-ai/sdk/resources/index.d.ts.map +1 -1
  1112. package/node_modules/@anthropic-ai/sdk/resources/index.js +5 -1
  1113. package/node_modules/@anthropic-ai/sdk/resources/index.js.map +1 -1
  1114. package/node_modules/@anthropic-ai/sdk/resources/index.mjs +2 -0
  1115. package/node_modules/@anthropic-ai/sdk/resources/index.mjs.map +1 -1
  1116. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.mts +20 -11
  1117. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.mts.map +1 -1
  1118. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.ts +20 -11
  1119. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.d.ts.map +1 -1
  1120. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.js +17 -9
  1121. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.js.map +1 -1
  1122. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.mjs +17 -9
  1123. package/node_modules/@anthropic-ai/sdk/resources/messages/batches.mjs.map +1 -1
  1124. package/node_modules/@anthropic-ai/sdk/resources/messages/index.d.mts +1 -1
  1125. package/node_modules/@anthropic-ai/sdk/resources/messages/index.d.mts.map +1 -1
  1126. package/node_modules/@anthropic-ai/sdk/resources/messages/index.d.ts +1 -1
  1127. package/node_modules/@anthropic-ai/sdk/resources/messages/index.d.ts.map +1 -1
  1128. package/node_modules/@anthropic-ai/sdk/resources/messages/index.js.map +1 -1
  1129. package/node_modules/@anthropic-ai/sdk/resources/messages/index.mjs.map +1 -1
  1130. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts +1782 -162
  1131. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts.map +1 -1
  1132. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts +1782 -162
  1133. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts.map +1 -1
  1134. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.js +23 -28
  1135. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.js.map +1 -1
  1136. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs +23 -28
  1137. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs.map +1 -1
  1138. package/node_modules/@anthropic-ai/sdk/resources/messages.d.mts.map +1 -1
  1139. package/node_modules/@anthropic-ai/sdk/resources/messages.d.ts.map +1 -1
  1140. package/node_modules/@anthropic-ai/sdk/resources/messages.mjs.map +1 -1
  1141. package/node_modules/@anthropic-ai/sdk/resources/models.d.mts.map +1 -1
  1142. package/node_modules/@anthropic-ai/sdk/resources/models.d.ts.map +1 -1
  1143. package/node_modules/@anthropic-ai/sdk/resources/models.mjs.map +1 -1
  1144. package/node_modules/@anthropic-ai/sdk/resources/skills/index.d.mts +3 -0
  1145. package/node_modules/@anthropic-ai/sdk/resources/skills/index.d.mts.map +1 -0
  1146. package/node_modules/@anthropic-ai/sdk/resources/skills/index.d.ts +3 -0
  1147. package/node_modules/@anthropic-ai/sdk/resources/skills/index.d.ts.map +1 -0
  1148. package/node_modules/@anthropic-ai/sdk/resources/skills/index.js +9 -0
  1149. package/node_modules/@anthropic-ai/sdk/resources/skills/index.js.map +1 -0
  1150. package/node_modules/@anthropic-ai/sdk/resources/skills/index.mjs +4 -0
  1151. package/node_modules/@anthropic-ai/sdk/resources/skills/index.mjs.map +1 -0
  1152. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.d.mts +129 -0
  1153. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.d.mts.map +1 -0
  1154. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.d.ts +129 -0
  1155. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.d.ts.map +1 -0
  1156. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.js +44 -0
  1157. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.js.map +1 -0
  1158. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.mjs +39 -0
  1159. package/node_modules/@anthropic-ai/sdk/resources/skills/skills.mjs.map +1 -0
  1160. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.d.mts +104 -0
  1161. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.d.mts.map +1 -0
  1162. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.d.ts +104 -0
  1163. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.d.ts.map +1 -0
  1164. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.js +41 -0
  1165. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.js.map +1 -0
  1166. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.mjs +37 -0
  1167. package/node_modules/@anthropic-ai/sdk/resources/skills/versions.mjs.map +1 -0
  1168. package/node_modules/@anthropic-ai/sdk/resources/skills.d.mts +2 -0
  1169. package/node_modules/@anthropic-ai/sdk/resources/skills.d.mts.map +1 -0
  1170. package/node_modules/@anthropic-ai/sdk/resources/skills.d.ts +2 -0
  1171. package/node_modules/@anthropic-ai/sdk/resources/skills.d.ts.map +1 -0
  1172. package/node_modules/@anthropic-ai/sdk/resources/skills.js +6 -0
  1173. package/node_modules/@anthropic-ai/sdk/resources/skills.js.map +1 -0
  1174. package/node_modules/@anthropic-ai/sdk/resources/skills.mjs +3 -0
  1175. package/node_modules/@anthropic-ai/sdk/resources/skills.mjs.map +1 -0
  1176. package/node_modules/@anthropic-ai/sdk/resources.d.mts.map +1 -1
  1177. package/node_modules/@anthropic-ai/sdk/resources.d.ts.map +1 -1
  1178. package/node_modules/@anthropic-ai/sdk/resources.mjs.map +1 -1
  1179. package/node_modules/@anthropic-ai/sdk/src/_vendor/partial-json-parser/parser.ts +18 -2
  1180. package/node_modules/@anthropic-ai/sdk/src/client.ts +749 -42
  1181. package/node_modules/@anthropic-ai/sdk/src/core/api-promise.ts +14 -4
  1182. package/node_modules/@anthropic-ai/sdk/src/core/api.ts +11 -0
  1183. package/node_modules/@anthropic-ai/sdk/src/core/credentials.ts +379 -0
  1184. package/node_modules/@anthropic-ai/sdk/src/core/error.ts +17 -0
  1185. package/node_modules/@anthropic-ai/sdk/src/core/middleware.ts +339 -0
  1186. package/node_modules/@anthropic-ai/sdk/src/core/pagination.ts +60 -0
  1187. package/node_modules/@anthropic-ai/sdk/src/core/streaming.ts +38 -1
  1188. package/node_modules/@anthropic-ai/sdk/src/helpers/beta/environments.ts +34 -0
  1189. package/node_modules/@anthropic-ai/sdk/src/helpers/beta/json-schema.ts +7 -0
  1190. package/node_modules/@anthropic-ai/sdk/src/helpers/beta/mcp.ts +1 -1
  1191. package/node_modules/@anthropic-ai/sdk/src/helpers/beta/zod.ts +14 -10
  1192. package/node_modules/@anthropic-ai/sdk/src/helpers/zod.ts +3 -6
  1193. package/node_modules/@anthropic-ai/sdk/src/index.ts +16 -1
  1194. package/node_modules/@anthropic-ai/sdk/src/internal/constants.ts +0 -5
  1195. package/node_modules/@anthropic-ai/sdk/src/internal/file-store.ts +550 -0
  1196. package/node_modules/@anthropic-ai/sdk/src/internal/headers.ts +47 -4
  1197. package/node_modules/@anthropic-ai/sdk/src/internal/message-stream-utils.ts +30 -0
  1198. package/node_modules/@anthropic-ai/sdk/src/internal/parse.ts +16 -11
  1199. package/node_modules/@anthropic-ai/sdk/src/internal/qs/LICENSE.md +13 -0
  1200. package/node_modules/@anthropic-ai/sdk/src/internal/qs/README.md +3 -0
  1201. package/node_modules/@anthropic-ai/sdk/src/internal/qs/formats.ts +10 -0
  1202. package/node_modules/@anthropic-ai/sdk/src/internal/qs/index.ts +13 -0
  1203. package/node_modules/@anthropic-ai/sdk/src/internal/qs/stringify.ts +385 -0
  1204. package/node_modules/@anthropic-ai/sdk/src/internal/qs/types.ts +71 -0
  1205. package/node_modules/@anthropic-ai/sdk/src/internal/qs/utils.ts +265 -0
  1206. package/node_modules/@anthropic-ai/sdk/src/internal/request-options.ts +55 -2
  1207. package/node_modules/@anthropic-ai/sdk/src/internal/request-signal.ts +68 -0
  1208. package/node_modules/@anthropic-ai/sdk/src/internal/stainless-helper-header.ts +122 -0
  1209. package/node_modules/@anthropic-ai/sdk/src/internal/utils/abort.ts +21 -0
  1210. package/node_modules/@anthropic-ai/sdk/src/internal/utils/async-queue.ts +66 -0
  1211. package/node_modules/@anthropic-ai/sdk/src/internal/utils/backoff.ts +41 -0
  1212. package/node_modules/@anthropic-ai/sdk/src/internal/utils/log.ts +41 -10
  1213. package/node_modules/@anthropic-ai/sdk/src/internal/utils/promise.ts +18 -0
  1214. package/node_modules/@anthropic-ai/sdk/src/internal/utils/query.ts +2 -18
  1215. package/node_modules/@anthropic-ai/sdk/src/internal/utils/sleep.ts +25 -2
  1216. package/node_modules/@anthropic-ai/sdk/src/internal/utils/time.ts +4 -0
  1217. package/node_modules/@anthropic-ai/sdk/src/lib/BetaMessageStream.ts +72 -33
  1218. package/node_modules/@anthropic-ai/sdk/src/lib/MessageStream.ts +36 -24
  1219. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/credential-chain.ts +292 -0
  1220. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/identity-token.ts +37 -0
  1221. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/oidc-federation.ts +140 -0
  1222. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/token-cache.ts +130 -0
  1223. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/types.ts +295 -0
  1224. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/user-oauth.ts +144 -0
  1225. package/node_modules/@anthropic-ai/sdk/src/lib/credentials.ts +3 -0
  1226. package/node_modules/@anthropic-ai/sdk/src/lib/environments/index.ts +23 -0
  1227. package/node_modules/@anthropic-ai/sdk/src/lib/environments/poller.ts +299 -0
  1228. package/node_modules/@anthropic-ai/sdk/src/lib/environments/worker.ts +779 -0
  1229. package/node_modules/@anthropic-ai/sdk/src/lib/helper-client.ts +86 -0
  1230. package/node_modules/@anthropic-ai/sdk/src/lib/middleware.ts +994 -0
  1231. package/node_modules/@anthropic-ai/sdk/src/lib/sessions/accumulate.ts +130 -0
  1232. package/node_modules/@anthropic-ai/sdk/src/lib/tools/BetaRunnableTool.ts +71 -7
  1233. package/node_modules/@anthropic-ai/sdk/src/lib/tools/BetaToolRunner.ts +135 -35
  1234. package/node_modules/@anthropic-ai/sdk/src/lib/tools/SessionToolRunner.ts +885 -0
  1235. package/node_modules/@anthropic-ai/sdk/src/resources/beta/agents/agents.ts +806 -69
  1236. package/node_modules/@anthropic-ai/sdk/src/resources/beta/agents/index.ts +34 -0
  1237. package/node_modules/@anthropic-ai/sdk/src/resources/beta/beta.ts +690 -28
  1238. package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployment-runs.ts +441 -0
  1239. package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployments.ts +996 -0
  1240. package/node_modules/@anthropic-ai/sdk/src/resources/beta/dreams.ts +453 -0
  1241. package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/environments.ts +626 -0
  1242. package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/index.ts +42 -0
  1243. package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/work.ts +705 -0
  1244. package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments.ts +1 -540
  1245. package/node_modules/@anthropic-ai/sdk/src/resources/beta/files.ts +28 -28
  1246. package/node_modules/@anthropic-ai/sdk/src/resources/beta/index.ts +312 -5
  1247. package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/index.ts +1 -0
  1248. package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memories.ts +141 -31
  1249. package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memory-stores.ts +66 -20
  1250. package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memory-versions.ts +112 -9
  1251. package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/batches.ts +90 -33
  1252. package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/index.ts +90 -0
  1253. package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/messages.ts +2755 -211
  1254. package/node_modules/@anthropic-ai/sdk/src/resources/beta/models.ts +7 -0
  1255. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/events.ts +888 -18
  1256. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/index.ts +60 -1
  1257. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/sessions.ts +669 -14
  1258. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/events.ts +123 -0
  1259. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/index.ts +15 -0
  1260. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/threads.ts +330 -0
  1261. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads.ts +3 -0
  1262. package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/index.ts +1 -0
  1263. package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/skills.ts +15 -14
  1264. package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/versions.ts +49 -3
  1265. package/node_modules/@anthropic-ai/sdk/src/resources/beta/tunnels/certificates.ts +252 -0
  1266. package/node_modules/@anthropic-ai/sdk/src/resources/beta/tunnels/index.ts +23 -0
  1267. package/node_modules/@anthropic-ai/sdk/src/resources/beta/tunnels/tunnels.ts +347 -0
  1268. package/node_modules/@anthropic-ai/sdk/src/resources/beta/tunnels.ts +3 -0
  1269. package/node_modules/@anthropic-ai/sdk/src/resources/beta/user-profiles.ts +76 -5
  1270. package/node_modules/@anthropic-ai/sdk/src/resources/beta/vaults/credentials.ts +347 -3
  1271. package/node_modules/@anthropic-ai/sdk/src/resources/beta/vaults/index.ts +17 -0
  1272. package/node_modules/@anthropic-ai/sdk/src/resources/beta/vaults/vaults.ts +34 -0
  1273. package/node_modules/@anthropic-ai/sdk/src/resources/beta/webhooks.ts +762 -0
  1274. package/node_modules/@anthropic-ai/sdk/src/resources/completions.ts +18 -11
  1275. package/node_modules/@anthropic-ai/sdk/src/resources/files.ts +163 -0
  1276. package/node_modules/@anthropic-ai/sdk/src/resources/index.ts +89 -0
  1277. package/node_modules/@anthropic-ai/sdk/src/resources/messages/batches.ts +30 -12
  1278. package/node_modules/@anthropic-ai/sdk/src/resources/messages/index.ts +70 -0
  1279. package/node_modules/@anthropic-ai/sdk/src/resources/messages/messages.ts +2202 -226
  1280. package/node_modules/@anthropic-ai/sdk/src/resources/skills/index.ts +21 -0
  1281. package/node_modules/@anthropic-ai/sdk/src/resources/skills/skills.ts +194 -0
  1282. package/node_modules/@anthropic-ai/sdk/src/resources/skills/versions.ts +160 -0
  1283. package/node_modules/@anthropic-ai/sdk/src/resources/skills.ts +3 -0
  1284. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/fs-util.ts +190 -0
  1285. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/memories.ts +1017 -0
  1286. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.browser.ts +172 -0
  1287. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.ts +914 -0
  1288. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/skills.ts +372 -0
  1289. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/sync-interval.ts +30 -0
  1290. package/node_modules/@anthropic-ai/sdk/src/tools/memory/node.browser.ts +64 -0
  1291. package/node_modules/@anthropic-ai/sdk/src/version.ts +1 -1
  1292. package/node_modules/@anthropic-ai/sdk/streaming.d.mts +1 -0
  1293. package/node_modules/@anthropic-ai/sdk/streaming.d.mts.map +1 -1
  1294. package/node_modules/@anthropic-ai/sdk/streaming.d.ts +1 -0
  1295. package/node_modules/@anthropic-ai/sdk/streaming.d.ts.map +1 -1
  1296. package/node_modules/@anthropic-ai/sdk/streaming.mjs +1 -0
  1297. package/node_modules/@anthropic-ai/sdk/streaming.mjs.map +1 -1
  1298. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.mts +75 -0
  1299. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.mts.map +1 -0
  1300. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.ts +75 -0
  1301. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.ts.map +1 -0
  1302. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js +196 -0
  1303. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js.map +1 -0
  1304. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs +185 -0
  1305. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs.map +1 -0
  1306. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.mts +173 -0
  1307. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.mts.map +1 -0
  1308. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.ts +173 -0
  1309. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.ts.map +1 -0
  1310. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js +902 -0
  1311. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js.map +1 -0
  1312. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs +895 -0
  1313. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs.map +1 -0
  1314. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts +82 -0
  1315. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts.map +1 -0
  1316. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts +82 -0
  1317. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts.map +1 -0
  1318. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js +151 -0
  1319. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js.map +1 -0
  1320. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs +131 -0
  1321. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs.map +1 -0
  1322. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts +190 -0
  1323. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts.map +1 -0
  1324. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts +190 -0
  1325. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts.map +1 -0
  1326. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js +819 -0
  1327. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js.map +1 -0
  1328. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs +797 -0
  1329. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs.map +1 -0
  1330. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts +82 -0
  1331. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts.map +1 -0
  1332. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts +82 -0
  1333. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts.map +1 -0
  1334. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js +352 -0
  1335. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js.map +1 -0
  1336. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs +344 -0
  1337. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs.map +1 -0
  1338. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.d.mts +19 -0
  1339. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.d.mts.map +1 -0
  1340. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.d.ts +19 -0
  1341. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.d.ts.map +1 -0
  1342. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.js +29 -0
  1343. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.js.map +1 -0
  1344. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.mjs +25 -0
  1345. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/sync-interval.mjs.map +1 -0
  1346. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.d.mts +27 -0
  1347. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.d.mts.map +1 -0
  1348. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.d.ts +27 -0
  1349. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.d.ts.map +1 -0
  1350. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.js +49 -0
  1351. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.js.map +1 -0
  1352. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.mjs +44 -0
  1353. package/node_modules/@anthropic-ai/sdk/tools/memory/node.browser.mjs.map +1 -0
  1354. package/node_modules/@anthropic-ai/sdk/tools/memory/node.d.mts.map +1 -1
  1355. package/node_modules/@anthropic-ai/sdk/tools/memory/node.d.ts.map +1 -1
  1356. package/node_modules/@anthropic-ai/sdk/tools/memory/node.mjs.map +1 -1
  1357. package/node_modules/@anthropic-ai/sdk/uploads.d.mts +1 -0
  1358. package/node_modules/@anthropic-ai/sdk/uploads.d.mts.map +1 -1
  1359. package/node_modules/@anthropic-ai/sdk/uploads.d.ts +1 -0
  1360. package/node_modules/@anthropic-ai/sdk/uploads.d.ts.map +1 -1
  1361. package/node_modules/@anthropic-ai/sdk/uploads.mjs +1 -0
  1362. package/node_modules/@anthropic-ai/sdk/uploads.mjs.map +1 -1
  1363. package/node_modules/@anthropic-ai/sdk/version.d.mts +1 -1
  1364. package/node_modules/@anthropic-ai/sdk/version.d.mts.map +1 -1
  1365. package/node_modules/@anthropic-ai/sdk/version.d.ts +1 -1
  1366. package/node_modules/@anthropic-ai/sdk/version.d.ts.map +1 -1
  1367. package/node_modules/@anthropic-ai/sdk/version.js +1 -1
  1368. package/node_modules/@anthropic-ai/sdk/version.js.map +1 -1
  1369. package/node_modules/@anthropic-ai/sdk/version.mjs +1 -1
  1370. package/node_modules/@anthropic-ai/sdk/version.mjs.map +1 -1
  1371. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +24 -0
  1372. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  1373. package/node_modules/@code-yeongyu/senpi-codemode/src/extension/session-manager-proxy.ts +39 -5
  1374. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  1375. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +7 -4
  1376. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  1377. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +2 -3
  1378. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
  1379. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +7 -6
  1380. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
  1381. package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.d.ts +4 -0
  1382. package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.d.ts.map +1 -1
  1383. package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.js +8 -0
  1384. package/node_modules/@earendil-works/pi-agent-core/dist/assistant-terminal-state.js.map +1 -1
  1385. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts +1 -0
  1386. package/node_modules/@earendil-works/pi-agent-core/dist/index.d.ts.map +1 -1
  1387. package/node_modules/@earendil-works/pi-agent-core/dist/index.js +1 -0
  1388. package/node_modules/@earendil-works/pi-agent-core/dist/index.js.map +1 -1
  1389. package/node_modules/@earendil-works/pi-agent-core/package.json +5 -5
  1390. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts +1 -5
  1391. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  1392. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +25 -13
  1393. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  1394. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.d.ts.map +1 -1
  1395. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js +2 -1
  1396. package/node_modules/@earendil-works/pi-ai/dist/api/azure-openai-responses.js.map +1 -1
  1397. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.d.ts.map +1 -1
  1398. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js +91 -5
  1399. package/node_modules/@earendil-works/pi-ai/dist/api/bedrock-converse-stream.js.map +1 -1
  1400. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.d.ts.map +1 -1
  1401. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js +4 -2
  1402. package/node_modules/@earendil-works/pi-ai/dist/api/google-generative-ai.js.map +1 -1
  1403. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.d.ts.map +1 -1
  1404. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js +4 -2
  1405. package/node_modules/@earendil-works/pi-ai/dist/api/google-vertex.js.map +1 -1
  1406. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.d.ts.map +1 -1
  1407. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +2 -0
  1408. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
  1409. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
  1410. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +93 -54
  1411. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
  1412. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +2 -5
  1413. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  1414. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js +1 -1
  1415. package/node_modules/@earendil-works/pi-ai/dist/api/transform-messages.js.map +1 -1
  1416. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.d.ts.map +1 -1
  1417. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js +97 -46
  1418. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/github-copilot.js.map +1 -1
  1419. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.d.ts.map +1 -1
  1420. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js +1 -14
  1421. package/node_modules/@earendil-works/pi-ai/dist/auth/oauth/kimi-coding.js.map +1 -1
  1422. package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts +50 -0
  1423. package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.d.ts.map +1 -0
  1424. package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js +129 -0
  1425. package/node_modules/@earendil-works/pi-ai/dist/auth/pool/slots.js.map +1 -0
  1426. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.d.ts.map +1 -1
  1427. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js +3 -1
  1428. package/node_modules/@earendil-works/pi-ai/dist/auth/resolve.js.map +1 -1
  1429. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +8 -1
  1430. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  1431. package/node_modules/@earendil-works/pi-ai/dist/models.js +16 -3
  1432. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  1433. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts +3 -1
  1434. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.d.ts.map +1 -1
  1435. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js +10 -1
  1436. package/node_modules/@earendil-works/pi-ai/dist/providers/cloudflare-ai-gateway.js.map +1 -1
  1437. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  1438. package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
  1439. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
  1440. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  1441. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  1442. package/node_modules/@earendil-works/pi-ai/dist/providers/data/nvidia.json +1 -1
  1443. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  1444. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  1445. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  1446. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opengateway.json +1 -1
  1447. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  1448. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  1449. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai-coding-cn.json +1 -1
  1450. package/node_modules/@earendil-works/pi-ai/dist/providers/data/zai.json +1 -1
  1451. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts +1 -0
  1452. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  1453. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +1 -0
  1454. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  1455. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.d.ts.map +1 -1
  1456. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js +4 -0
  1457. package/node_modules/@earendil-works/pi-ai/dist/providers/kimi-coding.js.map +1 -1
  1458. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +8 -1
  1459. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  1460. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  1461. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts +16 -0
  1462. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.d.ts.map +1 -1
  1463. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js +17 -1
  1464. package/node_modules/@earendil-works/pi-ai/dist/utils/overflow.js.map +1 -1
  1465. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/backoff.d.ts +14 -0
  1466. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/backoff.d.ts.map +1 -0
  1467. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/backoff.js +24 -0
  1468. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/backoff.js.map +1 -0
  1469. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.d.ts +36 -0
  1470. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.d.ts.map +1 -0
  1471. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.js +109 -0
  1472. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/classifiers.js.map +1 -0
  1473. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/failure.d.ts +12 -0
  1474. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/failure.d.ts.map +1 -0
  1475. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/failure.js +109 -0
  1476. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/failure.js.map +1 -0
  1477. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/index.d.ts +9 -0
  1478. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/index.d.ts.map +1 -0
  1479. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/index.js +6 -0
  1480. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/index.js.map +1 -0
  1481. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/planner.d.ts +46 -0
  1482. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/planner.d.ts.map +1 -0
  1483. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/planner.js +41 -0
  1484. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/planner.js.map +1 -0
  1485. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.d.ts +4 -0
  1486. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.d.ts.map +1 -0
  1487. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.js +93 -0
  1488. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/profiles.js.map +1 -0
  1489. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.d.ts +121 -0
  1490. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.d.ts.map +1 -0
  1491. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.js +11 -0
  1492. package/node_modules/@earendil-works/pi-ai/dist/utils/retry-profile/types.js.map +1 -0
  1493. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts +12 -0
  1494. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
  1495. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +25 -5
  1496. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
  1497. package/node_modules/@earendil-works/pi-ai/dist/utils/sleep.d.ts +2 -0
  1498. package/node_modules/@earendil-works/pi-ai/dist/utils/sleep.d.ts.map +1 -0
  1499. package/node_modules/@earendil-works/pi-ai/dist/utils/sleep.js +15 -0
  1500. package/node_modules/@earendil-works/pi-ai/dist/utils/sleep.js.map +1 -0
  1501. package/node_modules/@earendil-works/pi-ai/package.json +21 -17
  1502. package/node_modules/@earendil-works/pi-pty/dist/index.d.ts +1 -0
  1503. package/node_modules/@earendil-works/pi-pty/dist/index.d.ts.map +1 -1
  1504. package/node_modules/@earendil-works/pi-pty/dist/index.js +1 -0
  1505. package/node_modules/@earendil-works/pi-pty/dist/index.js.map +1 -1
  1506. package/node_modules/@earendil-works/pi-pty/dist/session-bun.d.ts +30 -0
  1507. package/node_modules/@earendil-works/pi-pty/dist/session-bun.d.ts.map +1 -0
  1508. package/node_modules/@earendil-works/pi-pty/dist/session-bun.js +76 -0
  1509. package/node_modules/@earendil-works/pi-pty/dist/session-bun.js.map +1 -0
  1510. package/node_modules/@earendil-works/pi-pty/dist/session-types.d.ts +3 -1
  1511. package/node_modules/@earendil-works/pi-pty/dist/session-types.d.ts.map +1 -1
  1512. package/node_modules/@earendil-works/pi-pty/dist/session-types.js.map +1 -1
  1513. package/node_modules/@earendil-works/pi-pty/dist/session.d.ts +2 -0
  1514. package/node_modules/@earendil-works/pi-pty/dist/session.d.ts.map +1 -1
  1515. package/node_modules/@earendil-works/pi-pty/dist/session.js +19 -9
  1516. package/node_modules/@earendil-works/pi-pty/dist/session.js.map +1 -1
  1517. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  1518. package/node_modules/@earendil-works/pi-telemetry/package.json +3 -3
  1519. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -1
  1520. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +9 -4
  1521. package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -1
  1522. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts +8 -2
  1523. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.d.ts.map +1 -1
  1524. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js +24 -4
  1525. package/node_modules/@earendil-works/pi-tui/dist/components/settings-list.js.map +1 -1
  1526. package/node_modules/@earendil-works/pi-tui/dist/keybindings.d.ts +2 -2
  1527. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js +2 -2
  1528. package/node_modules/@earendil-works/pi-tui/dist/keybindings.js.map +1 -1
  1529. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.d.ts.map +1 -1
  1530. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js +2 -8
  1531. package/node_modules/@earendil-works/pi-tui/dist/native-modifiers.js.map +1 -1
  1532. package/node_modules/@earendil-works/pi-tui/dist/native-module-path.d.ts +7 -0
  1533. package/node_modules/@earendil-works/pi-tui/dist/native-module-path.d.ts.map +1 -0
  1534. package/node_modules/@earendil-works/pi-tui/dist/native-module-path.js +19 -0
  1535. package/node_modules/@earendil-works/pi-tui/dist/native-module-path.js.map +1 -0
  1536. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  1537. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +4 -10
  1538. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  1539. package/node_modules/@earendil-works/pi-tui/package.json +5 -5
  1540. package/node_modules/@stablelib/base64/LICENSE +21 -0
  1541. package/node_modules/@stablelib/base64/base64.bench.ts +25 -0
  1542. package/node_modules/@stablelib/base64/base64.test.ts +85 -0
  1543. package/node_modules/@stablelib/base64/base64.ts +283 -0
  1544. package/node_modules/@stablelib/base64/lib/base64.bench.d.ts +1 -0
  1545. package/node_modules/@stablelib/base64/lib/base64.bench.js +23 -0
  1546. package/node_modules/@stablelib/base64/lib/base64.bench.js.map +1 -0
  1547. package/node_modules/@stablelib/base64/lib/base64.d.ts +34 -0
  1548. package/node_modules/@stablelib/base64/lib/base64.js +282 -0
  1549. package/node_modules/@stablelib/base64/lib/base64.js.map +1 -0
  1550. package/node_modules/@stablelib/base64/lib/base64.test.d.ts +1 -0
  1551. package/node_modules/@stablelib/base64/lib/base64.test.js +82 -0
  1552. package/node_modules/@stablelib/base64/lib/base64.test.js.map +1 -0
  1553. package/node_modules/@stablelib/base64/package.json +25 -0
  1554. package/node_modules/@stablelib/base64/tsconfig.json +27 -0
  1555. package/node_modules/fast-sha256/LICENSE +24 -0
  1556. package/node_modules/fast-sha256/README.md +127 -0
  1557. package/node_modules/fast-sha256/package.json +42 -0
  1558. package/node_modules/fast-sha256/sha256.d.ts +39 -0
  1559. package/node_modules/fast-sha256/sha256.js +427 -0
  1560. package/node_modules/fast-sha256/sha256.min.js +1 -0
  1561. package/node_modules/standardwebhooks/README.md +41 -0
  1562. package/node_modules/standardwebhooks/dist/index.d.ts +24 -0
  1563. package/node_modules/standardwebhooks/dist/index.js +106 -0
  1564. package/node_modules/standardwebhooks/dist/index.js.map +1 -0
  1565. package/node_modules/standardwebhooks/dist/timing_safe_equal.d.ts +1 -0
  1566. package/node_modules/standardwebhooks/dist/timing_safe_equal.js +30 -0
  1567. package/node_modules/standardwebhooks/dist/timing_safe_equal.js.map +1 -0
  1568. package/node_modules/standardwebhooks/package.json +45 -0
  1569. package/package.json +100 -89
  1570. package/dist/core/radius.d.ts +0 -2
  1571. package/dist/core/radius.d.ts.map +0 -1
  1572. package/dist/core/radius.js +0 -2
  1573. package/dist/core/radius.js.map +0 -1
  1574. package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.d.mts +0 -34
  1575. package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.d.mts.map +0 -1
  1576. package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.d.ts +0 -34
  1577. package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.d.ts.map +0 -1
  1578. package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.js.map +0 -1
  1579. package/node_modules/@anthropic-ai/sdk/lib/stainless-helper-header.mjs.map +0 -1
  1580. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.d.mts +0 -132
  1581. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.d.mts.map +0 -1
  1582. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.d.ts +0 -132
  1583. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.d.ts.map +0 -1
  1584. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.js +0 -294
  1585. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.js.map +0 -1
  1586. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.mjs +0 -290
  1587. package/node_modules/@anthropic-ai/sdk/lib/tools/ToolRunner.mjs.map +0 -1
  1588. package/node_modules/@anthropic-ai/sdk/src/lib/stainless-helper-header.ts +0 -80
  1589. package/node_modules/@anthropic-ai/sdk/src/lib/tools/ToolRunner.ts +0 -381
@@ -1 +1 @@
1
- {"version":3,"file":"todo-bridge.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/compaction/todo-bridge.ts"],"names":[],"mappings":"AAIA,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AAC7D,MAAM,oBAAoB,GAAG,mCAAmC,CAAC;AACjE,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAiCjD,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACpD,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IACnC,8EAA8E;IAC9E,2EAA2E;IAC3E,0EAA0E;IAC1E,OAAO,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AACzD,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IAClC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,EAAE,KAAK,QAAQ,CAAC;IAC3C,MAAM,UAAU,GAAG,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;IACvF,OAAO,CAAC,KAAK,IAAI,UAAU,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC5D,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IAClC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACpG,OAAO,KAAK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ACtF,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,QAAQ;KACjB,EACD,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAC5C,CAAC;AACH,CAAC","sourcesContent":["import type { CustomEntry, SessionEntry } from \"../../../session-manager.ts\";\nimport type { ExtensionAPI, ExtensionContext } from \"../../types.ts\";\nimport type { TodoPhase } from \"../todotools/state.ts\";\n\nconst TODO_SNAPSHOT_CUSTOM_TYPE = \"compaction.todo-snapshot\";\nconst TODO_SNAPSHOT_SCHEMA = \"senpi.compaction.todo-snapshot.v1\";\nconst TODO_STATE_ENTRY_TYPE = \"senpi.todo-state\";\n\nexport interface TodoEntry {\n\tid?: string;\n\tcontent?: string;\n\ttext?: string;\n\tstatus?: string;\n}\n\nexport type TodoSnapshotItems = TodoEntry[] | TodoPhase[];\n\nexport interface TodoSnapshotPayload {\n\tschema: typeof TODO_SNAPSHOT_SCHEMA;\n\ttodos: TodoSnapshotItems | SessionEntry[];\n\tcapturedAt: number;\n}\n\ninterface AppendEntryTarget {\n\tappendEntry<T = unknown>(customType: string, data?: T): void;\n}\n\ninterface SendMessageTarget extends AppendEntryTarget {\n\tsendMessage<T = unknown>(\n\t\tmessage: { customType: string; content: string; display: boolean; details?: T },\n\t\toptions?: { triggerTurn?: boolean; deliverAs?: \"steer\" | \"followUp\" | \"nextTurn\" },\n\t): void;\n}\n\nexport interface RestoreResult<T extends TodoSnapshotItems = TodoSnapshotItems> {\n\tapplied: boolean;\n\trestoredTodos: T;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction isTodoStatus(value: unknown): value is TodoEntry[\"status\"] {\n\t// Legacy todowrite entries carried arbitrary status strings (e.g. \"blocked\").\n\t// The bridge is a pass-through snapshot carrier, not a validator: preserve\n\t// every string-status entry so restore never silently drops legacy todos.\n\treturn value === undefined || typeof value === \"string\";\n}\n\nfunction isTodoEntry(value: unknown): value is TodoEntry {\n\tif (!isRecord(value)) return false;\n\tconst hasId = typeof value.id === \"string\";\n\tconst hasContent = typeof value.content === \"string\" || typeof value.text === \"string\";\n\treturn (hasId || hasContent) && isTodoStatus(value.status);\n}\n\nfunction isTodoPhase(value: unknown): value is TodoPhase {\n\tif (!isRecord(value) || typeof value.name !== \"string\" || !Array.isArray(value.tasks)) return false;\n\treturn value.tasks.every(isTodoEntry);\n}\n\nfunction isCustomTodoEntry(entry: SessionEntry): entry is CustomEntry {\n\treturn (\n\t\tentry.type === \"custom\" &&\n\t\t(entry.customType.startsWith(\"todowrite\") || entry.customType === TODO_STATE_ENTRY_TYPE)\n\t);\n}\n\nfunction isLegacyTodoListEntry(entry: SessionEntry): entry is CustomEntry {\n\treturn entry.type === \"custom\" && entry.customType === \"todo-list\";\n}\n\nfunction readTodosFromEntry(entry: CustomEntry): TodoEntry[] {\n\tconst data = entry.data;\n\tif (!isRecord(data)) return [];\n\tif (Array.isArray(data.todos)) return data.todos.filter(isTodoEntry);\n\tif (Array.isArray(data.phases)) {\n\t\treturn data.phases.filter(isTodoPhase).flatMap((phase) => phase.tasks);\n\t}\n\treturn [];\n}\n\nfunction findLatestTodoSnapshot(ctx: ExtensionContext): TodoSnapshotPayload | null {\n\tconst entries = ctx.sessionManager.getEntries();\n\tfor (let index = entries.length - 1; index >= 0; index -= 1) {\n\t\tconst entry = entries[index];\n\t\tif (entry.type !== \"custom\" || entry.customType !== TODO_SNAPSHOT_CUSTOM_TYPE) continue;\n\t\tconst data = entry.data;\n\t\tif (isRecord(data) && data.schema === TODO_SNAPSHOT_SCHEMA && Array.isArray(data.todos)) {\n\t\t\treturn data as unknown as TodoSnapshotPayload;\n\t\t}\n\t}\n\treturn null;\n}\n\nexport function findTodoEntries(ctx: ExtensionContext): SessionEntry[];\nexport function findTodoEntries(entries: SessionEntry[], options?: { branchId?: string }): TodoEntry[];\nexport function findTodoEntries(\n\tctxOrEntries: ExtensionContext | SessionEntry[],\n\toptions?: { branchId?: string },\n): SessionEntry[] | TodoEntry[] {\n\tif (Array.isArray(ctxOrEntries)) {\n\t\treturn ctxOrEntries\n\t\t\t.filter((entry) => isLegacyTodoListEntry(entry) || isCustomTodoEntry(entry))\n\t\t\t.filter((entry) => options?.branchId === undefined || entry.parentId === options.branchId)\n\t\t\t.flatMap(readTodosFromEntry);\n\t}\n\n\treturn ctxOrEntries.sessionManager.getEntries().filter(isCustomTodoEntry);\n}\n\nexport function createTodoSnapshot(ctx: ExtensionContext): TodoSnapshotPayload {\n\treturn {\n\t\tschema: TODO_SNAPSHOT_SCHEMA,\n\t\ttodos: findTodoEntries(ctx),\n\t\tcapturedAt: Date.now(),\n\t};\n}\n\nexport function persistTodoSnapshot(pi: AppendEntryTarget, snapshot: TodoSnapshotPayload): void {\n\tpi.appendEntry(TODO_SNAPSHOT_CUSTOM_TYPE, snapshot);\n}\n\nexport function captureTodoSnapshot(pi: ExtensionAPI, ctx: ExtensionContext): void;\nexport function captureTodoSnapshot(currentTodos: TodoSnapshotItems, pi: AppendEntryTarget, branchId?: string): void;\nexport function captureTodoSnapshot(\n\tpiOrTodos: ExtensionAPI | TodoSnapshotItems,\n\tctxOrPi: ExtensionContext | AppendEntryTarget,\n\t_branchId?: string,\n): void {\n\tif (Array.isArray(piOrTodos)) {\n\t\tconst pi = ctxOrPi as AppendEntryTarget;\n\t\tpersistTodoSnapshot(pi, {\n\t\t\tschema: TODO_SNAPSHOT_SCHEMA,\n\t\t\ttodos: piOrTodos,\n\t\t\tcapturedAt: Date.now(),\n\t\t});\n\t\treturn;\n\t}\n\n\tpersistTodoSnapshot(piOrTodos, createTodoSnapshot(ctxOrPi as ExtensionContext));\n}\n\nexport function restoreTodosIfMissing(pi: ExtensionAPI, ctx: ExtensionContext): void;\nexport function restoreTodosIfMissing<T extends TodoSnapshotItems>(\n\tsnapshot: T,\n\tcurrentTodos: T,\n\tpi: AppendEntryTarget,\n): RestoreResult<T>;\nexport function restoreTodosIfMissing(\n\tpiOrSnapshot: ExtensionAPI | TodoSnapshotItems,\n\tctxOrCurrentTodos: ExtensionContext | TodoSnapshotItems,\n\t_pi?: AppendEntryTarget,\n): undefined | RestoreResult {\n\tif (Array.isArray(piOrSnapshot) && Array.isArray(ctxOrCurrentTodos)) {\n\t\tif (ctxOrCurrentTodos.length > 0) {\n\t\t\treturn { applied: false, restoredTodos: ctxOrCurrentTodos };\n\t\t}\n\t\treturn { applied: piOrSnapshot.length > 0, restoredTodos: piOrSnapshot };\n\t}\n\n\tconst pi = piOrSnapshot as SendMessageTarget;\n\tconst ctx = ctxOrCurrentTodos as ExtensionContext;\n\tif (findTodoEntries(ctx).length > 0) return;\n\n\tconst snapshot = findLatestTodoSnapshot(ctx);\n\tif (!snapshot || snapshot.todos.length === 0) return;\n\n\tpi.sendMessage(\n\t\t{\n\t\t\tcustomType: \"compaction.todo-restore-request\",\n\t\t\tcontent: `Restore missing todo tasks from snapshot: ${JSON.stringify(snapshot.todos)}`,\n\t\t\tdisplay: false,\n\t\t\tdetails: snapshot,\n\t\t},\n\t\t{ triggerTurn: true, deliverAs: \"nextTurn\" },\n\t);\n}\n"]}
1
+ {"version":3,"file":"todo-bridge.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/compaction/todo-bridge.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gCAAgC,EAAkB,MAAM,uBAAuB,CAAC;AAEzF,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AAC7D,MAAM,oBAAoB,GAAG,mCAAmC,CAAC;AACjE,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAiCjD,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACpD,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IACnC,8EAA8E;IAC9E,2EAA2E;IAC3E,0EAA0E;IAC1E,OAAO,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AACzD,CAAC;AA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8C,EAC9C,iBAAuD,EACvD,GAAuB;IAEvB,IAAI,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACrE,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,CAAC;QAC7D,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,aAAa,EAAE,YAAY,EAAE,CAAC;IAC1E,CAAC;IAED,MAAM,EAAE,GAAG,YAAiC,CAAC;IAC7C,MAAM,GAAG,GAAG,iBAAqC,CAAC;IAClD,IAAI,oBAAoB,CAAC,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO;IAEjD,MAAM,QAAQ,GAAG,sBAAsB,CAAC,GAAG,CAAC,CAAC;IAC7C,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAErD,EAAE,CAAC,WAAW,CACb;QACC,UAAU,EAAE,iCAAiC;QAC7C,OAAO,EAAE,6CAA6C,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;QACtF,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,QAAQ;KACjB,EACD,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,CAC5C,CAAC;AACH,CAAC","sourcesContent":["import type { CustomEntry, SessionEntry } from \"../../../session-manager.ts\";\nimport type { ExtensionAPI, ExtensionContext } from \"../../types.ts\";\nimport { getLatestPhasesFromBranchEntries, type TodoPhase } from \"../todotools/state.ts\";\n\nconst TODO_SNAPSHOT_CUSTOM_TYPE = \"compaction.todo-snapshot\";\nconst TODO_SNAPSHOT_SCHEMA = \"senpi.compaction.todo-snapshot.v1\";\nconst TODO_STATE_ENTRY_TYPE = \"senpi.todo-state\";\n\nexport interface TodoEntry {\n\tid?: string;\n\tcontent?: string;\n\ttext?: string;\n\tstatus?: string;\n}\n\nexport type TodoSnapshotItems = TodoEntry[] | TodoPhase[];\n\nexport interface TodoSnapshotPayload {\n\tschema: typeof TODO_SNAPSHOT_SCHEMA;\n\ttodos: TodoSnapshotItems;\n\tcapturedAt: number;\n}\n\ninterface AppendEntryTarget {\n\tappendEntry<T = unknown>(customType: string, data?: T): void;\n}\n\ninterface SendMessageTarget extends AppendEntryTarget {\n\tsendMessage<T = unknown>(\n\t\tmessage: { customType: string; content: string; display: boolean; details?: T },\n\t\toptions?: { triggerTurn?: boolean; deliverAs?: \"steer\" | \"followUp\" | \"nextTurn\" },\n\t): void;\n}\n\nexport interface RestoreResult<T extends TodoSnapshotItems = TodoSnapshotItems> {\n\tapplied: boolean;\n\trestoredTodos: T;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction isTodoStatus(value: unknown): value is TodoEntry[\"status\"] {\n\t// Legacy todowrite entries carried arbitrary status strings (e.g. \"blocked\").\n\t// The bridge is a pass-through snapshot carrier, not a validator: preserve\n\t// every string-status entry so restore never silently drops legacy todos.\n\treturn value === undefined || typeof value === \"string\";\n}\n\nfunction isTodoEntry(value: unknown): value is TodoEntry {\n\tif (!isRecord(value)) return false;\n\tconst hasId = typeof value.id === \"string\";\n\tconst hasContent = typeof value.content === \"string\" || typeof value.text === \"string\";\n\treturn (hasId || hasContent) && isTodoStatus(value.status);\n}\n\nfunction isTodoPhase(value: unknown): value is TodoPhase {\n\tif (!isRecord(value) || typeof value.name !== \"string\" || !Array.isArray(value.tasks)) return false;\n\treturn value.tasks.every(isTodoEntry);\n}\n\nfunction isCustomTodoEntry(entry: SessionEntry): entry is CustomEntry {\n\treturn (\n\t\tentry.type === \"custom\" &&\n\t\t(entry.customType.startsWith(\"todowrite\") || entry.customType === TODO_STATE_ENTRY_TYPE)\n\t);\n}\n\nfunction isLegacyTodoListEntry(entry: SessionEntry): entry is CustomEntry {\n\treturn entry.type === \"custom\" && entry.customType === \"todo-list\";\n}\n\nfunction readTodosFromEntry(entry: CustomEntry): TodoEntry[] {\n\tconst data = entry.data;\n\tif (!isRecord(data)) return [];\n\tif (Array.isArray(data.todos)) return data.todos.filter(isTodoEntry);\n\tif (Array.isArray(data.phases)) {\n\t\treturn data.phases.filter(isTodoPhase).flatMap((phase) => phase.tasks);\n\t}\n\treturn [];\n}\n\nfunction isCustomEntryEnvelope(value: unknown): value is CustomEntry {\n\treturn (\n\t\tisRecord(value) &&\n\t\tvalue.type === \"custom\" &&\n\t\ttypeof value.id === \"string\" &&\n\t\t(value.parentId === null || typeof value.parentId === \"string\") &&\n\t\ttypeof value.timestamp === \"string\" &&\n\t\ttypeof value.customType === \"string\"\n\t);\n}\n\nfunction normalizeLegacySnapshotEntries(entries: CustomEntry[]): TodoSnapshotItems {\n\tfor (let index = entries.length - 1; index >= 0; index -= 1) {\n\t\tconst entry = entries[index];\n\t\tif (!isLegacyTodoListEntry(entry) && !isCustomTodoEntry(entry)) continue;\n\t\tif (entry.customType === TODO_STATE_ENTRY_TYPE) {\n\t\t\treturn getLatestPhasesFromBranchEntries(entries.slice(0, index + 1));\n\t\t}\n\t\treturn readTodosFromEntry(entry);\n\t}\n\treturn [];\n}\n\nfunction normalizeSnapshotItems(value: unknown): TodoSnapshotItems | null {\n\tif (!Array.isArray(value)) return null;\n\tif (value.every(isTodoPhase)) return value;\n\tif (value.every(isCustomEntryEnvelope)) return normalizeLegacySnapshotEntries(value);\n\tif (value.every(isTodoEntry)) return value;\n\treturn null;\n}\n\nfunction getCurrentTodoPhases(ctx: ExtensionContext): TodoPhase[] {\n\treturn getLatestPhasesFromBranchEntries(ctx.sessionManager.getBranch());\n}\n\nfunction findLatestTodoSnapshot(ctx: ExtensionContext): TodoSnapshotPayload | null {\n\tconst entries = ctx.sessionManager.getBranch();\n\tfor (let index = entries.length - 1; index >= 0; index -= 1) {\n\t\tconst entry = entries[index];\n\t\tif (entry.type !== \"custom\" || entry.customType !== TODO_SNAPSHOT_CUSTOM_TYPE) continue;\n\t\tconst data = entry.data;\n\t\tif (!isRecord(data) || data.schema !== TODO_SNAPSHOT_SCHEMA) continue;\n\t\tconst todos = normalizeSnapshotItems(data.todos);\n\t\tif (!todos) continue;\n\t\treturn {\n\t\t\tschema: TODO_SNAPSHOT_SCHEMA,\n\t\t\ttodos,\n\t\t\tcapturedAt: typeof data.capturedAt === \"number\" ? data.capturedAt : 0,\n\t\t};\n\t}\n\treturn null;\n}\n\nexport function findTodoEntries(entries: SessionEntry[], options?: { branchId?: string }): TodoEntry[] {\n\treturn entries\n\t\t.filter((entry) => isLegacyTodoListEntry(entry) || isCustomTodoEntry(entry))\n\t\t.filter((entry) => options?.branchId === undefined || entry.parentId === options.branchId)\n\t\t.flatMap(readTodosFromEntry);\n}\n\nexport function createTodoSnapshot(ctx: ExtensionContext): TodoSnapshotPayload {\n\treturn {\n\t\tschema: TODO_SNAPSHOT_SCHEMA,\n\t\ttodos: getCurrentTodoPhases(ctx),\n\t\tcapturedAt: Date.now(),\n\t};\n}\n\nexport function persistTodoSnapshot(pi: AppendEntryTarget, snapshot: TodoSnapshotPayload): void {\n\tpi.appendEntry(TODO_SNAPSHOT_CUSTOM_TYPE, snapshot);\n}\n\nexport function captureTodoSnapshot(pi: ExtensionAPI, ctx: ExtensionContext): void;\nexport function captureTodoSnapshot(currentTodos: TodoSnapshotItems, pi: AppendEntryTarget, branchId?: string): void;\nexport function captureTodoSnapshot(\n\tpiOrTodos: ExtensionAPI | TodoSnapshotItems,\n\tctxOrPi: ExtensionContext | AppendEntryTarget,\n\t_branchId?: string,\n): void {\n\tif (Array.isArray(piOrTodos)) {\n\t\tconst pi = ctxOrPi as AppendEntryTarget;\n\t\tpersistTodoSnapshot(pi, {\n\t\t\tschema: TODO_SNAPSHOT_SCHEMA,\n\t\t\ttodos: piOrTodos,\n\t\t\tcapturedAt: Date.now(),\n\t\t});\n\t\treturn;\n\t}\n\n\tpersistTodoSnapshot(piOrTodos, createTodoSnapshot(ctxOrPi as ExtensionContext));\n}\n\nexport function restoreTodosIfMissing(pi: ExtensionAPI, ctx: ExtensionContext): void;\nexport function restoreTodosIfMissing<T extends TodoSnapshotItems>(\n\tsnapshot: T,\n\tcurrentTodos: T,\n\tpi: AppendEntryTarget,\n): RestoreResult<T>;\nexport function restoreTodosIfMissing(\n\tpiOrSnapshot: ExtensionAPI | TodoSnapshotItems,\n\tctxOrCurrentTodos: ExtensionContext | TodoSnapshotItems,\n\t_pi?: AppendEntryTarget,\n): undefined | RestoreResult {\n\tif (Array.isArray(piOrSnapshot) && Array.isArray(ctxOrCurrentTodos)) {\n\t\tif (ctxOrCurrentTodos.length > 0) {\n\t\t\treturn { applied: false, restoredTodos: ctxOrCurrentTodos };\n\t\t}\n\t\treturn { applied: piOrSnapshot.length > 0, restoredTodos: piOrSnapshot };\n\t}\n\n\tconst pi = piOrSnapshot as SendMessageTarget;\n\tconst ctx = ctxOrCurrentTodos as ExtensionContext;\n\tif (getCurrentTodoPhases(ctx).length > 0) return;\n\n\tconst snapshot = findLatestTodoSnapshot(ctx);\n\tif (!snapshot || snapshot.todos.length === 0) return;\n\n\tpi.sendMessage(\n\t\t{\n\t\t\tcustomType: \"compaction.todo-restore-request\",\n\t\t\tcontent: `Restore missing todo tasks from snapshot: ${JSON.stringify(snapshot.todos)}`,\n\t\t\tdisplay: false,\n\t\t\tdetails: snapshot,\n\t\t},\n\t\t{ triggerTurn: true, deliverAs: \"nextTurn\" },\n\t);\n}\n"]}
@@ -21,6 +21,6 @@ export function didTerminalProviderErrorEndTurn(event) {
21
21
  const message = lastAssistantMessage(event.messages);
22
22
  if (isSdkOauthAccountExhaustion(message))
23
23
  return true;
24
- return message?.stopReason === "error" || (message?.stopReason === "aborted" && event.abortSource === undefined);
24
+ return message?.stopReason === "error" || (message?.stopReason === "aborted" && event.abortSource !== "user");
25
25
  }
26
26
  //# sourceMappingURL=terminal-provider-error.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"terminal-provider-error.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/goal/terminal-provider-error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,kFAAkF;AAClF,kFAAkF;AAClF,mFAAmF;AACnF,iFAAiF;AACjF,wDAAwD;AACxD,MAAM,4BAA4B,GAAG,CAAC,oDAAoD,EAAE,oBAAoB,CAAC,CAAC;AAElH,SAAS,2BAA2B,CACnC,OAA6E;IAE7E,IAAI,OAAO,EAAE,GAAG,KAAK,kBAAkB,IAAI,OAAO,CAAC,UAAU,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IACvF,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;QAC1C,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACpF,CAAC,CAAC,EAAE,CAAC;IACN,OAAO,4BAA4B,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,KAAoB;IACnE,IAAI,KAAK,CAAC,WAAW,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACjD,IAAI,KAAK,CAAC,SAAS,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,OAAO,GAAG,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,2BAA2B,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,OAAO,OAAO,EAAE,UAAU,KAAK,OAAO,IAAI,CAAC,OAAO,EAAE,UAAU,KAAK,SAAS,IAAI,KAAK,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC;AAClH,CAAC","sourcesContent":["import type { AgentEndEvent } from \"../../types.ts\";\nimport { lastAssistantMessage } from \"./last-assistant-message.ts\";\n\n// The claude-sdk-oauth account-rotating proxy reports total account exhaustion as\n// an assistant message with `stopReason: \"stop\"` and zero usage, so it slips past\n// the stopReason checks below and the goal reads it as a clean turn end. Match the\n// two stable phrases of that exact response; the account count and the `Retry in\n// NNNs` suffix vary, so they are not part of the match.\nconst SDK_OAUTH_EXHAUSTION_MARKERS = [\"API Error: Server is temporarily limiting requests\", \"accounts exhausted\"];\n\nfunction isSdkOauthAccountExhaustion(\n\tmessage: { api?: string; stopReason?: string; content?: unknown } | undefined,\n): boolean {\n\tif (message?.api !== \"claude-sdk-oauth\" || message.stopReason !== \"stop\") return false;\n\tconst text = Array.isArray(message.content)\n\t\t? message.content.map((part) => (part?.type === \"text\" ? part.text : \"\")).join(\"\\n\")\n\t\t: \"\";\n\treturn SDK_OAUTH_EXHAUSTION_MARKERS.every((marker) => text.includes(marker));\n}\n\nexport function didTerminalProviderErrorEndTurn(event: AgentEndEvent): boolean {\n\tif (event.abortSource === \"system\") return false;\n\tif (event.willRetry !== false) return false;\n\tconst message = lastAssistantMessage(event.messages);\n\tif (isSdkOauthAccountExhaustion(message)) return true;\n\treturn message?.stopReason === \"error\" || (message?.stopReason === \"aborted\" && event.abortSource === undefined);\n}\n"]}
1
+ {"version":3,"file":"terminal-provider-error.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/goal/terminal-provider-error.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE,kFAAkF;AAClF,kFAAkF;AAClF,mFAAmF;AACnF,iFAAiF;AACjF,wDAAwD;AACxD,MAAM,4BAA4B,GAAG,CAAC,oDAAoD,EAAE,oBAAoB,CAAC,CAAC;AAElH,SAAS,2BAA2B,CACnC,OAA6E;IAE7E,IAAI,OAAO,EAAE,GAAG,KAAK,kBAAkB,IAAI,OAAO,CAAC,UAAU,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IACvF,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;QAC1C,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACpF,CAAC,CAAC,EAAE,CAAC;IACN,OAAO,4BAA4B,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAC9E,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,KAAoB;IACnE,IAAI,KAAK,CAAC,WAAW,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACjD,IAAI,KAAK,CAAC,SAAS,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IAC5C,MAAM,OAAO,GAAG,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACrD,IAAI,2BAA2B,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IACtD,OAAO,OAAO,EAAE,UAAU,KAAK,OAAO,IAAI,CAAC,OAAO,EAAE,UAAU,KAAK,SAAS,IAAI,KAAK,CAAC,WAAW,KAAK,MAAM,CAAC,CAAC;AAC/G,CAAC","sourcesContent":["import type { AgentEndEvent } from \"../../types.ts\";\nimport { lastAssistantMessage } from \"./last-assistant-message.ts\";\n\n// The claude-sdk-oauth account-rotating proxy reports total account exhaustion as\n// an assistant message with `stopReason: \"stop\"` and zero usage, so it slips past\n// the stopReason checks below and the goal reads it as a clean turn end. Match the\n// two stable phrases of that exact response; the account count and the `Retry in\n// NNNs` suffix vary, so they are not part of the match.\nconst SDK_OAUTH_EXHAUSTION_MARKERS = [\"API Error: Server is temporarily limiting requests\", \"accounts exhausted\"];\n\nfunction isSdkOauthAccountExhaustion(\n\tmessage: { api?: string; stopReason?: string; content?: unknown } | undefined,\n): boolean {\n\tif (message?.api !== \"claude-sdk-oauth\" || message.stopReason !== \"stop\") return false;\n\tconst text = Array.isArray(message.content)\n\t\t? message.content.map((part) => (part?.type === \"text\" ? part.text : \"\")).join(\"\\n\")\n\t\t: \"\";\n\treturn SDK_OAUTH_EXHAUSTION_MARKERS.every((marker) => text.includes(marker));\n}\n\nexport function didTerminalProviderErrorEndTurn(event: AgentEndEvent): boolean {\n\tif (event.abortSource === \"system\") return false;\n\tif (event.willRetry !== false) return false;\n\tconst message = lastAssistantMessage(event.messages);\n\tif (isSdkOauthAccountExhaustion(message)) return true;\n\treturn message?.stopReason === \"error\" || (message?.stopReason === \"aborted\" && event.abortSource !== \"user\");\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"notice.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop-guard/notice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,eAAO,MAAM,6BAA6B,sBAAsB,CAAC;AACjE,eAAO,MAAM,iCAAiC,0BAA0B,CAAC;AACzE,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AAErE,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAExD,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CAClC;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAK5F;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAEhG;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKpE;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,kBAAkB,GAAG,MAAM,CAuC5E"}
1
+ {"version":3,"file":"notice.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop-guard/notice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEzD,eAAO,MAAM,6BAA6B,sBAAsB,CAAC;AACjE,eAAO,MAAM,iCAAiC,0BAA0B,CAAC;AACzE,eAAO,MAAM,+BAA+B,wBAAwB,CAAC;AAErE,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,CAAC;AAExD,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CAClC;AAID,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAQ5F;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAEhG;AAED,wBAAgB,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKpE;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,kBAAkB,GAAG,MAAM,CAuC5E"}
@@ -1,10 +1,14 @@
1
1
  export const LOOP_GUARD_NOTICE_CUSTOM_TYPE = "loop-guard:notice";
2
2
  export const LOOP_GUARD_ESCALATION_CUSTOM_TYPE = "loop-guard:escalation";
3
3
  export const LOOP_GUARD_RECOVERY_CUSTOM_TYPE = "loop-guard:recovery";
4
+ const POLLING_TOOL_NAMES = new Set(["bash_output", "task_output"]);
4
5
  export function buildLoopGuardBlockReason(toolName, blockedCallCount) {
6
+ const recovery = POLLING_TOOL_NAMES.has(toolName)
7
+ ? "Stop polling this target. If you need to wait for a change, arm a monitor or rely on a completion notification when this mode supports it; otherwise re-plan or choose a different tool."
8
+ : "Reuse the existing result, stop repeating this call, and re-plan from the current goal or choose a different tool.";
5
9
  return [
6
10
  `Loop guard blocked repeated call ${blockedCallCount} to \`${toolName}\` with arguments that already triggered two identical-call warnings.`,
7
- "Reuse the existing result, change an argument deliberately, or choose a different tool.",
11
+ recovery,
8
12
  ].join(" ");
9
13
  }
10
14
  export function buildLoopGuardHardStopWarning(toolName, blockedCallCount) {
@@ -1 +1 @@
1
- {"version":3,"file":"notice.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop-guard/notice.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,6BAA6B,GAAG,mBAAmB,CAAC;AACjE,MAAM,CAAC,MAAM,iCAAiC,GAAG,uBAAuB,CAAC;AACzE,MAAM,CAAC,MAAM,+BAA+B,GAAG,qBAAqB,CAAC;AASrE,MAAM,UAAU,yBAAyB,CAAC,QAAgB,EAAE,gBAAwB;IACnF,OAAO;QACN,oCAAoC,gBAAgB,SAAS,QAAQ,uEAAuE;QAC5I,yFAAyF;KACzF,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACb,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,QAAgB,EAAE,gBAAwB;IACvF,OAAO,kDAAkD,gBAAgB,sBAAsB,QAAQ,GAAG,CAAC;AAC5G,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,QAAgB;IAC3D,OAAO;QACN,uEAAuE,QAAQ,kDAAkD;QACjI,oHAAoH;KACpH,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACb,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,SAA6B;IACnE,QAAQ,SAAS,CAAC,IAAI,EAAE,CAAC;QACxB,KAAK,WAAW,CAAC,CAAC,CAAC;YAClB,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,SAAS,CAAC;YACtC,OAAO;gBACN,mBAAmB;gBACnB,mDAAmD,QAAQ,MAAM,KAAK,oPAAoP;gBAC1T,+DAA+D;gBAC/D,mJAAmJ;gBACnJ,kIAAkI;gBAClI,iBAAiB,QAAQ,oCAAoC;gBAC7D,oBAAoB;aACpB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,CAAC;QACD,KAAK,SAAS,CAAC,CAAC,CAAC;YAChB,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;YAClD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC;YAC7C,OAAO;gBACN,mBAAmB;gBACnB,qDAAqD,KAAK,eAAe,QAAQ,0BAA0B,OAAO,mKAAmK;gBACrR,oMAAoM;gBACpM,uJAAuJ;gBACvJ,iJAAiJ;gBACjJ,oBAAoB;aACpB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,CAAC;QACD,KAAK,OAAO,CAAC,CAAC,CAAC;YACd,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;YAChD,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACxC,OAAO;gBACN,mBAAmB;gBACnB,sFAAsF,OAAO,KAAK,KAAK,kBAAkB,MAAM,uJAAuJ;gBACtR,kKAAkK;gBAClK,sMAAsM;gBACtM,yKAAyK;gBACzK,oBAAoB;aACpB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import type { LoopGuardDetection } from \"./detectors.ts\";\n\nexport const LOOP_GUARD_NOTICE_CUSTOM_TYPE = \"loop-guard:notice\";\nexport const LOOP_GUARD_ESCALATION_CUSTOM_TYPE = \"loop-guard:escalation\";\nexport const LOOP_GUARD_RECOVERY_CUSTOM_TYPE = \"loop-guard:recovery\";\n\nexport type LoopGuardNoticeDetails = LoopGuardDetection;\n\nexport interface LoopGuardEscalationDetails {\n\treadonly toolName: string;\n\treadonly blockedCallCount: number;\n}\n\nexport function buildLoopGuardBlockReason(toolName: string, blockedCallCount: number): string {\n\treturn [\n\t\t`Loop guard blocked repeated call ${blockedCallCount} to \\`${toolName}\\` with arguments that already triggered two identical-call warnings.`,\n\t\t\"Reuse the existing result, change an argument deliberately, or choose a different tool.\",\n\t].join(\" \");\n}\n\nexport function buildLoopGuardHardStopWarning(toolName: string, blockedCallCount: number): string {\n\treturn `Loop guard interrupted the turn after blocking ${blockedCallCount} repeated calls to ${toolName}.`;\n}\n\nexport function buildLoopGuardHardStopSteer(toolName: string): string {\n\treturn [\n\t\t`The loop guard stopped the previous turn because you kept calling \\`${toolName}\\` with arguments that had already been blocked.`,\n\t\t\"Do not repeat that call. Re-plan from the current goal and use a different tool or deliberately changed arguments.\",\n\t].join(\" \");\n}\n\nexport function buildLoopGuardReminder(detection: LoopGuardDetection): string {\n\tswitch (detection.kind) {\n\t\tcase \"identical\": {\n\t\t\tconst { toolName, count } = detection;\n\t\t\treturn [\n\t\t\t\t`<system-reminder>`,\n\t\t\t\t`LOOP GUARD - IDENTICAL TOOL CALLS: you called \\`${toolName}\\` ${count} times in a row with the EXACT same arguments. This is the tool-call stream, not consecutive text - another tool ran between these calls and it changed nothing about your plan. Re-issuing the same call returns the same result. Snap out of it:`,\n\t\t\t\t`- reuse the result you already received from this exact call;`,\n\t\t\t\t`- if you were re-checking for new output or state, switch to the monitor/watch tool or change one parameter deliberately (filter, offset, query);`,\n\t\t\t\t`- if nothing is actually changing, stop calling this tool, state what is blocking you, and try a different tool or ask the user.`,\n\t\t\t\t`Do not call \\`${toolName}\\` again with identical arguments.`,\n\t\t\t\t`</system-reminder>`,\n\t\t\t].join(\"\\n\");\n\t\t}\n\t\tcase \"similar\": {\n\t\t\tconst { toolName, count, similarity } = detection;\n\t\t\tconst percent = Math.round(similarity * 100);\n\t\t\treturn [\n\t\t\t\t`<system-reminder>`,\n\t\t\t\t`LOOP GUARD - NEAR-IDENTICAL TOOL CALLS: your last ${count} calls to \\`${toolName}\\` had arguments about ${percent}% identical (bigram similarity over canonical args). This may be legitimate batch work - or it may be a lazy loop that only LOOKS like progress. Attention check:`,\n\t\t\t\t`- if these calls target genuinely different inputs (distinct files, queries, offsets), continue deliberately - but consider batching or widening the scope instead of one call per tiny variation;`,\n\t\t\t\t`- if you are scanning output incrementally (reads, peeks, polls), widen the window once or use the monitor/watch tool rather than nudging parameters;`,\n\t\t\t\t`- if the results keep saying the same thing, change strategy now - a different tool, a wider query, or asking the user beats a sixth near-copy.`,\n\t\t\t\t`</system-reminder>`,\n\t\t\t].join(\"\\n\");\n\t\t}\n\t\tcase \"cycle\": {\n\t\t\tconst { period, count, cycleTools } = detection;\n\t\t\tconst pattern = cycleTools.join(\" -> \");\n\t\t\treturn [\n\t\t\t\t`<system-reminder>`,\n\t\t\t\t`LOOP GUARD - REPEATING TOOL-CALL PATTERN: your recent tool calls repeat the cycle [${pattern}] ${count} times (period ${period}), with other calls possibly interleaved between repetitions. A fixed rotation usually means waiting, guessing, or searching without a discriminator:`,\n\t\t\t\t`- if this is a wait/poll rotation (spawn then peek, write then check), replace the rotation with the monitor/watch tool and react to the decisive event instead;`,\n\t\t\t\t`- if this is a search rotation, change ONE axis decisively: broader query, different tool, or a different source - repeating the same rotation at the same parameters will not find new information;`,\n\t\t\t\t`- if the cycle is genuinely progressing (each rotation moves distinct work forward), keep going - but say what each rotation accomplished so the next rotation can end.`,\n\t\t\t\t`</system-reminder>`,\n\t\t\t].join(\"\\n\");\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"notice.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop-guard/notice.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,6BAA6B,GAAG,mBAAmB,CAAC;AACjE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K,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;YAClD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,GAAG,CAAC,CAAC;YAC7C,OAAO;gBACN,mBAAmB;gBACnB,qDAAqD,KAAK,eAAe,QAAQ,0BAA0B,OAAO,mKAAmK;gBACrR,oMAAoM;gBACpM,uJAAuJ;gBACvJ,iJAAiJ;gBACjJ,oBAAoB;aACpB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,CAAC;QACD,KAAK,OAAO,CAAC,CAAC,CAAC;YACd,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,SAAS,CAAC;YAChD,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACxC,OAAO;gBACN,mBAAmB;gBACnB,sFAAsF,OAAO,KAAK,KAAK,kBAAkB,MAAM,uJAAuJ;gBACtR,kKAAkK;gBAClK,sMAAsM;gBACtM,yKAAyK;gBACzK,oBAAoB;aACpB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import type { LoopGuardDetection } from \"./detectors.ts\";\n\nexport const LOOP_GUARD_NOTICE_CUSTOM_TYPE = \"loop-guard:notice\";\nexport const LOOP_GUARD_ESCALATION_CUSTOM_TYPE = \"loop-guard:escalation\";\nexport const LOOP_GUARD_RECOVERY_CUSTOM_TYPE = \"loop-guard:recovery\";\n\nexport type LoopGuardNoticeDetails = LoopGuardDetection;\n\nexport interface LoopGuardEscalationDetails {\n\treadonly toolName: string;\n\treadonly blockedCallCount: number;\n}\n\nconst POLLING_TOOL_NAMES = new Set([\"bash_output\", \"task_output\"]);\n\nexport function buildLoopGuardBlockReason(toolName: string, blockedCallCount: number): string {\n\tconst recovery = POLLING_TOOL_NAMES.has(toolName)\n\t\t? \"Stop polling this target. If you need to wait for a change, arm a monitor or rely on a completion notification when this mode supports it; otherwise re-plan or choose a different tool.\"\n\t\t: \"Reuse the existing result, stop repeating this call, and re-plan from the current goal or choose a different tool.\";\n\treturn [\n\t\t`Loop guard blocked repeated call ${blockedCallCount} to \\`${toolName}\\` with arguments that already triggered two identical-call warnings.`,\n\t\trecovery,\n\t].join(\" \");\n}\n\nexport function buildLoopGuardHardStopWarning(toolName: string, blockedCallCount: number): string {\n\treturn `Loop guard interrupted the turn after blocking ${blockedCallCount} repeated calls to ${toolName}.`;\n}\n\nexport function buildLoopGuardHardStopSteer(toolName: string): string {\n\treturn [\n\t\t`The loop guard stopped the previous turn because you kept calling \\`${toolName}\\` with arguments that had already been blocked.`,\n\t\t\"Do not repeat that call. Re-plan from the current goal and use a different tool or deliberately changed arguments.\",\n\t].join(\" \");\n}\n\nexport function buildLoopGuardReminder(detection: LoopGuardDetection): string {\n\tswitch (detection.kind) {\n\t\tcase \"identical\": {\n\t\t\tconst { toolName, count } = detection;\n\t\t\treturn [\n\t\t\t\t`<system-reminder>`,\n\t\t\t\t`LOOP GUARD - IDENTICAL TOOL CALLS: you called \\`${toolName}\\` ${count} times in a row with the EXACT same arguments. This is the tool-call stream, not consecutive text - another tool ran between these calls and it changed nothing about your plan. Re-issuing the same call returns the same result. Snap out of it:`,\n\t\t\t\t`- reuse the result you already received from this exact call;`,\n\t\t\t\t`- if you were re-checking for new output or state, switch to the monitor/watch tool or change one parameter deliberately (filter, offset, query);`,\n\t\t\t\t`- if nothing is actually changing, stop calling this tool, state what is blocking you, and try a different tool or ask the user.`,\n\t\t\t\t`Do not call \\`${toolName}\\` again with identical arguments.`,\n\t\t\t\t`</system-reminder>`,\n\t\t\t].join(\"\\n\");\n\t\t}\n\t\tcase \"similar\": {\n\t\t\tconst { toolName, count, similarity } = detection;\n\t\t\tconst percent = Math.round(similarity * 100);\n\t\t\treturn [\n\t\t\t\t`<system-reminder>`,\n\t\t\t\t`LOOP GUARD - NEAR-IDENTICAL TOOL CALLS: your last ${count} calls to \\`${toolName}\\` had arguments about ${percent}% identical (bigram similarity over canonical args). This may be legitimate batch work - or it may be a lazy loop that only LOOKS like progress. Attention check:`,\n\t\t\t\t`- if these calls target genuinely different inputs (distinct files, queries, offsets), continue deliberately - but consider batching or widening the scope instead of one call per tiny variation;`,\n\t\t\t\t`- if you are scanning output incrementally (reads, peeks, polls), widen the window once or use the monitor/watch tool rather than nudging parameters;`,\n\t\t\t\t`- if the results keep saying the same thing, change strategy now - a different tool, a wider query, or asking the user beats a sixth near-copy.`,\n\t\t\t\t`</system-reminder>`,\n\t\t\t].join(\"\\n\");\n\t\t}\n\t\tcase \"cycle\": {\n\t\t\tconst { period, count, cycleTools } = detection;\n\t\t\tconst pattern = cycleTools.join(\" -> \");\n\t\t\treturn [\n\t\t\t\t`<system-reminder>`,\n\t\t\t\t`LOOP GUARD - REPEATING TOOL-CALL PATTERN: your recent tool calls repeat the cycle [${pattern}] ${count} times (period ${period}), with other calls possibly interleaved between repetitions. A fixed rotation usually means waiting, guessing, or searching without a discriminator:`,\n\t\t\t\t`- if this is a wait/poll rotation (spawn then peek, write then check), replace the rotation with the monitor/watch tool and react to the decisive event instead;`,\n\t\t\t\t`- if this is a search rotation, change ONE axis decisively: broader query, different tool, or a different source - repeating the same rotation at the same parameters will not find new information;`,\n\t\t\t\t`- if the cycle is genuinely progressing (each rotation moves distinct work forward), keep going - but say what each rotation accomplished so the next rotation can end.`,\n\t\t\t\t`</system-reminder>`,\n\t\t\t].join(\"\\n\");\n\t\t}\n\t}\n}\n"]}
@@ -188,6 +188,7 @@ export declare const validateConfig: import("typebox/compile").Validator<{}, Typ
188
188
  auth?: false | "oauth" | "bearer" | undefined;
189
189
  url?: string | undefined;
190
190
  type?: "stdio" | "http" | undefined;
191
+ enabled?: boolean | undefined;
191
192
  env?: Record<string, string> | undefined;
192
193
  args?: string[] | undefined;
193
194
  oauth?: {
@@ -197,7 +198,6 @@ export declare const validateConfig: import("typebox/compile").Validator<{}, Typ
197
198
  clientMetadataUrl?: string | undefined;
198
199
  flow?: "code" | "client_credentials" | undefined;
199
200
  } | undefined;
200
- enabled?: boolean | undefined;
201
201
  cwd?: string | undefined;
202
202
  exposure?: "search" | "auto" | "direct" | "proxy" | undefined;
203
203
  bearerTokenEnv?: string | undefined;
@@ -231,6 +231,7 @@ export declare const validateConfig: import("typebox/compile").Validator<{}, Typ
231
231
  auth?: false | "oauth" | "bearer" | undefined;
232
232
  url?: string | undefined;
233
233
  type?: "stdio" | "http" | undefined;
234
+ enabled?: boolean | undefined;
234
235
  env?: Record<string, string> | undefined;
235
236
  args?: string[] | undefined;
236
237
  oauth?: {
@@ -240,7 +241,6 @@ export declare const validateConfig: import("typebox/compile").Validator<{}, Typ
240
241
  clientMetadataUrl?: string | undefined;
241
242
  flow?: "code" | "client_credentials" | undefined;
242
243
  } | undefined;
243
- enabled?: boolean | undefined;
244
244
  cwd?: string | undefined;
245
245
  exposure?: "search" | "auto" | "direct" | "proxy" | undefined;
246
246
  bearerTokenEnv?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,YAAY,EAAwC,MAAM,gBAAgB,CAAC;AAmDxG,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA2N5D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,YAAY,EAAwC,MAAM,gBAAgB,CAAC;AAoDxG,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,EAAE,EAAE,YAAY,GAAG,IAAI,CA0N5D"}
@@ -7,6 +7,7 @@ import { claimAbort, createGenerationState, markUserCancelled } from "./coordina
7
7
  import { REPETITIVE_TURNS_RULE_NAME } from "./detectors/repetitive-turns.js";
8
8
  import { discoverTtsrRulesSync } from "./discovery.js";
9
9
  import { TtsrManager } from "./manager.js";
10
+ import { getTtsrStreamDelta } from "./message-update.js";
10
11
  import { REPETITIVE_TURNS_RULE_CONTENT } from "./prompts.js";
11
12
  import { buildNudgeMessage } from "./remediation.js";
12
13
  import { collectAssistantText, RepetitiveTurnsLane, readPersistedAssistantTexts } from "./repetitive-turns-lane.js";
@@ -160,12 +161,11 @@ export default function ttsrExtension(pi) {
160
161
  ensureInitialized(ctx);
161
162
  if (disabled || manager === null || watcher === null)
162
163
  return;
163
- const deltaEvent = event.assistantMessageEvent;
164
- if (deltaEvent.type !== "text_delta" && deltaEvent.type !== "thinking_delta")
164
+ const streamDelta = getTtsrStreamDelta(event);
165
+ if (streamDelta === null)
165
166
  return;
166
- const source = deltaEvent.type === "text_delta" ? "text" : "thinking";
167
- const streamKey = `${source}:${String(deltaEvent.contentIndex)}`;
168
- const outcome = watcher.handleDelta(source, streamKey, deltaEvent.delta, generation);
167
+ const { source, streamKey, delta, toolName } = streamDelta;
168
+ const outcome = watcher.handleDelta(source, streamKey, delta, generation, toolName);
169
169
  if (outcome.resolution !== null && claimAbort(genState, outcome.resolution)) {
170
170
  pendingRemediation = { resolution: outcome.resolution, streamKind: source };
171
171
  ctx.abort("system");
@@ -173,7 +173,7 @@ export default function ttsrExtension(pi) {
173
173
  }
174
174
  if (source === "text") {
175
175
  const canArm = pendingRuleNudge === null && !genState.abortClaimed;
176
- if (repetitiveTurns.observeTextDelta(deltaEvent.delta, canArm) && !genState.abortClaimed) {
176
+ if (repetitiveTurns.observeTextDelta(delta, canArm) && !genState.abortClaimed) {
177
177
  genState.abortClaimed = true;
178
178
  genState.abortOwner = "collapse-repetition";
179
179
  genState.selfAbortAt = Date.now();
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAAE,8BAA8B,E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, MessageUpdateEvent } from \"../../types.ts\";\nimport { appendRuleActivation, registerRuleActivationRenderer } from \"../rule-activation/index.ts\";\nimport { parseRuleActivationDetails, RULE_ACTIVATION_ENTRY_TYPE } from \"../rule-activation/types.ts\";\nimport { BUILTIN_TTSR_RULES } from \"./builtin-rules.ts\";\nimport { registerTtsrCommands, type TtsrPublicState } from \"./commands.ts\";\nimport { claimAbort, createGenerationState, markUserCancelled } from \"./coordinator.ts\";\nimport { REPETITIVE_TURNS_RULE_NAME } from \"./detectors/repetitive-turns.ts\";\nimport { discoverTtsrRulesSync } from \"./discovery.ts\";\nimport { TtsrManager } from \"./manager.ts\";\nimport { REPETITIVE_TURNS_RULE_CONTENT } from \"./prompts.ts\";\nimport { buildNudgeMessage, type TtsrNudgeMessage } from \"./remediation.ts\";\nimport { collectAssistantText, RepetitiveTurnsLane, readPersistedAssistantTexts } from \"./repetitive-turns-lane.ts\";\nimport { compileRuleCondition } from \"./rule-condition.ts\";\nimport { buildStreamRemediation } from \"./stream-remediation.ts\";\nimport {\n\tDEFAULT_TTSR_SETTINGS,\n\ttype DetectionResolution,\n\ttype GenerationDetectionState,\n\tTTSR_INJECTION_CUSTOM_TYPE,\n\ttype TtsrRule,\n} from \"./types.ts\";\nimport { StreamWatcher } from \"./watch.ts\";\n\ninterface PendingRemediation {\n\treadonly resolution: DetectionResolution;\n\treadonly streamKind: \"text\" | \"thinking\";\n}\n\ninterface PendingRuleNudge {\n\treadonly rule: TtsrRule;\n}\n\nconst INTERRUPT_KEYBINDING = \"app.interrupt\";\n\nfunction isInterruptKey(data: string): boolean {\n\ttry {\n\t\treturn getKeybindings().matches(data, INTERRUPT_KEYBINDING);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction parseDisabledRules(raw: boolean | string | undefined): string[] {\n\treturn typeof raw === \"string\" && raw.length > 0\n\t\t? raw\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((name) => name.trim())\n\t\t\t\t.filter((name) => name.length > 0)\n\t\t: [];\n}\n\nexport default function ttsrExtension(pi: ExtensionAPI): void {\n\tregisterRuleActivationRenderer(pi);\n\tpi.registerFlag(\"ttsr-disabled\", {\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t\tdescription: \"Disable TTSR stream-rule detection.\",\n\t});\n\tpi.registerFlag(\"ttsr-rules-disabled\", {\n\t\ttype: \"string\",\n\t\tdefault: \"\",\n\t\tdescription: \"Comma-separated TTSR rule names to disable.\",\n\t});\n\n\tlet manager: TtsrManager | null = null;\n\tlet watcher: StreamWatcher | null = null;\n\tlet genState: GenerationDetectionState = createGenerationState();\n\tlet generation = 0;\n\tlet pendingRemediation: PendingRemediation | null = null;\n\tlet pendingRuleNudge: PendingRuleNudge | null = null;\n\tlet pendingNudge: TtsrNudgeMessage | null = null;\n\tlet settlingAgentEnd: AgentEndEvent | null = null;\n\tlet disabled = false;\n\tconst repetitiveTurns = new RepetitiveTurnsLane();\n\n\tfunction cancelRemediation(): void {\n\t\tif (pendingRemediation !== null || pendingNudge !== null || pendingRuleNudge !== null) {\n\t\t\tmarkUserCancelled(genState);\n\t\t\tpendingRemediation = null;\n\t\t\tpendingRuleNudge = null;\n\t\t\tpendingNudge = null;\n\t\t\trepetitiveTurns.disarm();\n\t\t}\n\t}\n\n\tfunction resetGenerationState(): void {\n\t\tgeneration += 1;\n\t\tgenState = createGenerationState();\n\t\tpendingRemediation = null;\n\t\tpendingRuleNudge = null;\n\t\trepetitiveTurns.resetTurn();\n\t\twatcher?.reset();\n\t}\n\n\tfunction recordInjection(owner: string, observed: readonly string[], retryMode: \"nudge\" | \"provider-error\"): void {\n\t\tappendRuleActivation(pi, {\n\t\t\tkind: \"ttsr\",\n\t\t\towner,\n\t\t\trules: observed,\n\t\t\tremediation: retryMode,\n\t\t});\n\t}\n\n\tfunction ensureInitialized(ctx: ExtensionContext): void {\n\t\tif (manager !== null) return;\n\t\tdisabled = pi.getFlag(\"ttsr-disabled\") === true;\n\t\tconst disabledRules = parseDisabledRules(pi.getFlag(\"ttsr-rules-disabled\"));\n\t\trepetitiveTurns.configure(new Set(disabledRules));\n\t\tconst settings = { ...DEFAULT_TTSR_SETTINGS, enabled: !disabled, disabledRules };\n\t\tmanager = new TtsrManager(settings, (pattern) => compileRuleCondition(pattern).regex);\n\t\tconst injectedNames = ctx.sessionManager.getEntries().flatMap((entry) => {\n\t\t\tif (entry.type !== \"custom\") return [];\n\t\t\tif (entry.customType === RULE_ACTIVATION_ENTRY_TYPE) {\n\t\t\t\tconst details = parseRuleActivationDetails(entry.data);\n\t\t\t\treturn details?.kind === \"ttsr\" ? [...details.rules] : [];\n\t\t\t}\n\t\t\tif (entry.customType !== TTSR_INJECTION_CUSTOM_TYPE) return [];\n\t\t\tconst data = entry.data;\n\t\t\tif (typeof data !== \"object\" || data === null || !(\"rules\" in data)) return [];\n\t\t\tconst rules = (data as { rules?: unknown }).rules;\n\t\t\treturn Array.isArray(rules) ? rules.filter((rule): rule is string => typeof rule === \"string\") : [];\n\t\t});\n\t\tmanager.restoreInjected(injectedNames);\n\t\tfor (const rule of BUILTIN_TTSR_RULES) {\n\t\t\tmanager.addRule(rule);\n\t\t}\n\t\tconst discovered = discoverTtsrRulesSync(ctx.cwd);\n\t\tfor (const rule of discovered.rules) {\n\t\t\tmanager.addRule(rule);\n\t\t}\n\t\twatcher = new StreamWatcher(manager, disabledRules);\n\t\trepetitiveTurns.restoreFromHistory(readPersistedAssistantTexts(ctx));\n\t\tif (ctx.mode === \"tui\") {\n\t\t\ttry {\n\t\t\t\tctx.ui.onTerminalInput((data) => {\n\t\t\t\t\tif (isInterruptKey(data)) cancelRemediation();\n\t\t\t\t});\n\t\t\t} catch {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction publicState(): TtsrPublicState {\n\t\treturn {\n\t\t\trules: manager?.getRules() ?? [],\n\t\t\tinjectedRuleNames: manager?.getInjectedRuleNames() ?? [],\n\t\t\tdisabled,\n\t\t};\n\t}\n\n\tregisterTtsrCommands(pi, publicState);\n\n\tpi.on(\"session_start\", (_event, ctx) => {\n\t\tensureInitialized(ctx);\n\t});\n\n\tpi.on(\"session_abort\", () => {\n\t\tcancelRemediation();\n\t});\n\n\tpi.on(\"input\", () => {\n\t\tcancelRemediation();\n\t});\n\n\tpi.on(\"agent_end\", (event) => {\n\t\tsettlingAgentEnd = event;\n\t\tif (event.abortSource === \"user\") {\n\t\t\tcancelRemediation();\n\t\t\treturn;\n\t\t}\n\t\tif (event.willRetry === true) resetGenerationState();\n\t});\n\n\tpi.on(\"turn_start\", (_event, ctx) => {\n\t\tensureInitialized(ctx);\n\t\tresetGenerationState();\n\t});\n\n\tpi.on(\"turn_end\", () => {\n\t\tmanager?.incrementMessageCount();\n\t});\n\n\tpi.on(\"message_update\", (event: MessageUpdateEvent, ctx) => {\n\t\tensureInitialized(ctx);\n\t\tif (disabled || manager === null || watcher === null) return;\n\t\tconst deltaEvent = event.assistantMessageEvent;\n\t\tif (deltaEvent.type !== \"text_delta\" && deltaEvent.type !== \"thinking_delta\") return;\n\t\tconst source = deltaEvent.type === \"text_delta\" ? \"text\" : \"thinking\";\n\t\tconst streamKey = `${source}:${String(deltaEvent.contentIndex)}`;\n\t\tconst outcome = watcher.handleDelta(source, streamKey, deltaEvent.delta, generation);\n\t\tif (outcome.resolution !== null && claimAbort(genState, outcome.resolution)) {\n\t\t\tpendingRemediation = { resolution: outcome.resolution, streamKind: source };\n\t\t\tctx.abort(\"system\");\n\t\t\treturn;\n\t\t}\n\t\tif (source === \"text\") {\n\t\t\tconst canArm = pendingRuleNudge === null && !genState.abortClaimed;\n\t\t\tif (repetitiveTurns.observeTextDelta(deltaEvent.delta, canArm) && !genState.abortClaimed) {\n\t\t\t\tgenState.abortClaimed = true;\n\t\t\t\tgenState.abortOwner = \"collapse-repetition\";\n\t\t\t\tgenState.selfAbortAt = Date.now();\n\t\t\t\tctx.abort(\"system\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tconst interrupting = outcome.ruleMatches.filter((rule) => rule.interruptMode === \"always\");\n\t\tconst rule = interrupting[0];\n\t\tif (rule !== undefined && pendingRuleNudge === null && !genState.abortClaimed) {\n\t\t\tgenState.abortClaimed = true;\n\t\t\tgenState.abortOwner = \"collapse-repetition\";\n\t\t\tgenState.selfAbortAt = Date.now();\n\t\t\tpendingRuleNudge = { rule };\n\t\t\tctx.abort(\"system\");\n\t\t}\n\t});\n\n\tpi.on(\"message_end\", (event) => {\n\t\tif (genState.userCancelled) return undefined;\n\t\tif (event.message.role !== \"assistant\") return undefined;\n\t\tconst turnText = collectAssistantText(event.message);\n\t\tif (repetitiveTurns.armed) {\n\t\t\trepetitiveTurns.commitArmedTurn(turnText);\n\t\t\tmanager?.markInjectedByNames([REPETITIVE_TURNS_RULE_NAME]);\n\t\t\trecordInjection(REPETITIVE_TURNS_RULE_NAME, [REPETITIVE_TURNS_RULE_NAME], \"nudge\");\n\t\t\tpendingNudge = buildNudgeMessage(REPETITIVE_TURNS_RULE_NAME, REPETITIVE_TURNS_RULE_CONTENT);\n\t\t\treturn undefined;\n\t\t}\n\t\tif (pendingRuleNudge !== null) {\n\t\t\tconst pending = pendingRuleNudge;\n\t\t\tpendingRuleNudge = null;\n\t\t\tmanager?.markInjectedByNames([pending.rule.name]);\n\t\t\trecordInjection(pending.rule.name, [pending.rule.name], \"nudge\");\n\t\t\tpendingNudge = buildNudgeMessage(pending.rule.name, pending.rule.content);\n\t\t\treturn undefined;\n\t\t}\n\t\tif (pendingRemediation !== null) {\n\t\t\tif (turnText !== null) repetitiveTurns.recordCompletedTurn(turnText);\n\t\t\tconst pending = pendingRemediation;\n\t\t\tpendingRemediation = null;\n\t\t\ttry {\n\t\t\t\tconst outcome = buildStreamRemediation(pending, event.message);\n\t\t\t\trecordInjection(outcome.owner, outcome.observedRules, outcome.retryMode);\n\t\t\t\tif (outcome.nudge !== null) {\n\t\t\t\t\tpendingNudge = outcome.nudge;\n\t\t\t\t}\n\t\t\t\tconst merged = { ...event.message, ...outcome.replacement };\n\t\t\t\treturn { message: merged as unknown as typeof event.message };\n\t\t\t} catch (error) {\n\t\t\t\tpi.appendEntry(\"ttsr-remediation-error\", {\n\t\t\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t\t\t\tat: Date.now(),\n\t\t\t\t});\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t\tif (turnText !== null) repetitiveTurns.recordCompletedTurn(turnText);\n\t\treturn undefined;\n\t});\n\n\tpi.on(\"agent_settled\", () => {\n\t\tif (pendingNudge === null || genState.userCancelled || settlingAgentEnd?.abortSource === \"user\") {\n\t\t\tpendingNudge = null;\n\t\t\tsettlingAgentEnd = null;\n\t\t\treturn;\n\t\t}\n\t\tconst nudge = pendingNudge;\n\t\tpendingNudge = null;\n\t\tpi.sendMessage(nudge, { triggerTurn: true });\n\t});\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,OAAO,EAAE,oBAAoB,EAAE,8BAA8B,EAAE,MAAM,6BAA6B,CAAC;AACnG,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACrG,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAwB,MAAM,eAAe,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,6BAA6B,EAAE,MAAM,cAAc,CAA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AAQ,CAAC,CAAC;QACrE,OAAO,SAAS,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;QAC3B,IAAI,YAAY,KAAK,IAAI,IAAI,QAAQ,CAAC,aAAa,IAAI,gBAAgB,EAAE,WAAW,KAAK,MAAM,EAAE,CAAC;YACjG,YAAY,GAAG,IAAI,CAAC;YACpB,gBAAgB,GAAG,IAAI,CAAC;YACxB,OAAO;QACR,CAAC;QACD,MAAM,KAAK,GAAG,YAAY,CAAC;QAC3B,YAAY,GAAG,IAAI,CAAC;QACpB,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { getKeybindings } from \"@earendil-works/pi-tui\";\n\nimport type { AgentEndEvent, ExtensionAPI, ExtensionContext, MessageUpdateEvent } from \"../../types.ts\";\nimport { appendRuleActivation, registerRuleActivationRenderer } from \"../rule-activation/index.ts\";\nimport { parseRuleActivationDetails, RULE_ACTIVATION_ENTRY_TYPE } from \"../rule-activation/types.ts\";\nimport { BUILTIN_TTSR_RULES } from \"./builtin-rules.ts\";\nimport { registerTtsrCommands, type TtsrPublicState } from \"./commands.ts\";\nimport { claimAbort, createGenerationState, markUserCancelled } from \"./coordinator.ts\";\nimport { REPETITIVE_TURNS_RULE_NAME } from \"./detectors/repetitive-turns.ts\";\nimport { discoverTtsrRulesSync } from \"./discovery.ts\";\nimport { TtsrManager } from \"./manager.ts\";\nimport { getTtsrStreamDelta } from \"./message-update.ts\";\nimport { REPETITIVE_TURNS_RULE_CONTENT } from \"./prompts.ts\";\nimport { buildNudgeMessage, type TtsrNudgeMessage } from \"./remediation.ts\";\nimport { collectAssistantText, RepetitiveTurnsLane, readPersistedAssistantTexts } from \"./repetitive-turns-lane.ts\";\nimport { compileRuleCondition } from \"./rule-condition.ts\";\nimport { buildStreamRemediation } from \"./stream-remediation.ts\";\nimport {\n\tDEFAULT_TTSR_SETTINGS,\n\ttype DetectionResolution,\n\ttype GenerationDetectionState,\n\tTTSR_INJECTION_CUSTOM_TYPE,\n\ttype TtsrRule,\n} from \"./types.ts\";\nimport { StreamWatcher } from \"./watch.ts\";\n\ninterface PendingRemediation {\n\treadonly resolution: DetectionResolution;\n\treadonly streamKind: \"text\" | \"thinking\" | \"tool\";\n}\n\ninterface PendingRuleNudge {\n\treadonly rule: TtsrRule;\n}\n\nconst INTERRUPT_KEYBINDING = \"app.interrupt\";\n\nfunction isInterruptKey(data: string): boolean {\n\ttry {\n\t\treturn getKeybindings().matches(data, INTERRUPT_KEYBINDING);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nfunction parseDisabledRules(raw: boolean | string | undefined): string[] {\n\treturn typeof raw === \"string\" && raw.length > 0\n\t\t? raw\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((name) => name.trim())\n\t\t\t\t.filter((name) => name.length > 0)\n\t\t: [];\n}\n\nexport default function ttsrExtension(pi: ExtensionAPI): void {\n\tregisterRuleActivationRenderer(pi);\n\tpi.registerFlag(\"ttsr-disabled\", {\n\t\ttype: \"boolean\",\n\t\tdefault: false,\n\t\tdescription: \"Disable TTSR stream-rule detection.\",\n\t});\n\tpi.registerFlag(\"ttsr-rules-disabled\", {\n\t\ttype: \"string\",\n\t\tdefault: \"\",\n\t\tdescription: \"Comma-separated TTSR rule names to disable.\",\n\t});\n\n\tlet manager: TtsrManager | null = null;\n\tlet watcher: StreamWatcher | null = null;\n\tlet genState: GenerationDetectionState = createGenerationState();\n\tlet generation = 0;\n\tlet pendingRemediation: PendingRemediation | null = null;\n\tlet pendingRuleNudge: PendingRuleNudge | null = null;\n\tlet pendingNudge: TtsrNudgeMessage | null = null;\n\tlet settlingAgentEnd: AgentEndEvent | null = null;\n\tlet disabled = false;\n\tconst repetitiveTurns = new RepetitiveTurnsLane();\n\n\tfunction cancelRemediation(): void {\n\t\tif (pendingRemediation !== null || pendingNudge !== null || pendingRuleNudge !== null) {\n\t\t\tmarkUserCancelled(genState);\n\t\t\tpendingRemediation = null;\n\t\t\tpendingRuleNudge = null;\n\t\t\tpendingNudge = null;\n\t\t\trepetitiveTurns.disarm();\n\t\t}\n\t}\n\n\tfunction resetGenerationState(): void {\n\t\tgeneration += 1;\n\t\tgenState = createGenerationState();\n\t\tpendingRemediation = null;\n\t\tpendingRuleNudge = null;\n\t\trepetitiveTurns.resetTurn();\n\t\twatcher?.reset();\n\t}\n\n\tfunction recordInjection(owner: string, observed: readonly string[], retryMode: \"nudge\" | \"provider-error\"): void {\n\t\tappendRuleActivation(pi, {\n\t\t\tkind: \"ttsr\",\n\t\t\towner,\n\t\t\trules: observed,\n\t\t\tremediation: retryMode,\n\t\t});\n\t}\n\n\tfunction ensureInitialized(ctx: ExtensionContext): void {\n\t\tif (manager !== null) return;\n\t\tdisabled = pi.getFlag(\"ttsr-disabled\") === true;\n\t\tconst disabledRules = parseDisabledRules(pi.getFlag(\"ttsr-rules-disabled\"));\n\t\trepetitiveTurns.configure(new Set(disabledRules));\n\t\tconst settings = { ...DEFAULT_TTSR_SETTINGS, enabled: !disabled, disabledRules };\n\t\tmanager = new TtsrManager(settings, (pattern) => compileRuleCondition(pattern).regex);\n\t\tconst injectedNames = ctx.sessionManager.getEntries().flatMap((entry) => {\n\t\t\tif (entry.type !== \"custom\") return [];\n\t\t\tif (entry.customType === RULE_ACTIVATION_ENTRY_TYPE) {\n\t\t\t\tconst details = parseRuleActivationDetails(entry.data);\n\t\t\t\treturn details?.kind === \"ttsr\" ? [...details.rules] : [];\n\t\t\t}\n\t\t\tif (entry.customType !== TTSR_INJECTION_CUSTOM_TYPE) return [];\n\t\t\tconst data = entry.data;\n\t\t\tif (typeof data !== \"object\" || data === null || !(\"rules\" in data)) return [];\n\t\t\tconst rules = (data as { rules?: unknown }).rules;\n\t\t\treturn Array.isArray(rules) ? rules.filter((rule): rule is string => typeof rule === \"string\") : [];\n\t\t});\n\t\tmanager.restoreInjected(injectedNames);\n\t\tfor (const rule of BUILTIN_TTSR_RULES) {\n\t\t\tmanager.addRule(rule);\n\t\t}\n\t\tconst discovered = discoverTtsrRulesSync(ctx.cwd);\n\t\tfor (const rule of discovered.rules) {\n\t\t\tmanager.addRule(rule);\n\t\t}\n\t\twatcher = new StreamWatcher(manager, disabledRules);\n\t\trepetitiveTurns.restoreFromHistory(readPersistedAssistantTexts(ctx));\n\t\tif (ctx.mode === \"tui\") {\n\t\t\ttry {\n\t\t\t\tctx.ui.onTerminalInput((data) => {\n\t\t\t\t\tif (isInterruptKey(data)) cancelRemediation();\n\t\t\t\t});\n\t\t\t} catch {\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction publicState(): TtsrPublicState {\n\t\treturn {\n\t\t\trules: manager?.getRules() ?? [],\n\t\t\tinjectedRuleNames: manager?.getInjectedRuleNames() ?? [],\n\t\t\tdisabled,\n\t\t};\n\t}\n\n\tregisterTtsrCommands(pi, publicState);\n\n\tpi.on(\"session_start\", (_event, ctx) => {\n\t\tensureInitialized(ctx);\n\t});\n\n\tpi.on(\"session_abort\", () => {\n\t\tcancelRemediation();\n\t});\n\n\tpi.on(\"input\", () => {\n\t\tcancelRemediation();\n\t});\n\n\tpi.on(\"agent_end\", (event) => {\n\t\tsettlingAgentEnd = event;\n\t\tif (event.abortSource === \"user\") {\n\t\t\tcancelRemediation();\n\t\t\treturn;\n\t\t}\n\t\tif (event.willRetry === true) resetGenerationState();\n\t});\n\n\tpi.on(\"turn_start\", (_event, ctx) => {\n\t\tensureInitialized(ctx);\n\t\tresetGenerationState();\n\t});\n\n\tpi.on(\"turn_end\", () => {\n\t\tmanager?.incrementMessageCount();\n\t});\n\n\tpi.on(\"message_update\", (event: MessageUpdateEvent, ctx) => {\n\t\tensureInitialized(ctx);\n\t\tif (disabled || manager === null || watcher === null) return;\n\t\tconst streamDelta = getTtsrStreamDelta(event);\n\t\tif (streamDelta === null) return;\n\t\tconst { source, streamKey, delta, toolName } = streamDelta;\n\t\tconst outcome = watcher.handleDelta(source, streamKey, delta, generation, toolName);\n\t\tif (outcome.resolution !== null && claimAbort(genState, outcome.resolution)) {\n\t\t\tpendingRemediation = { resolution: outcome.resolution, streamKind: source };\n\t\t\tctx.abort(\"system\");\n\t\t\treturn;\n\t\t}\n\t\tif (source === \"text\") {\n\t\t\tconst canArm = pendingRuleNudge === null && !genState.abortClaimed;\n\t\t\tif (repetitiveTurns.observeTextDelta(delta, canArm) && !genState.abortClaimed) {\n\t\t\t\tgenState.abortClaimed = true;\n\t\t\t\tgenState.abortOwner = \"collapse-repetition\";\n\t\t\t\tgenState.selfAbortAt = Date.now();\n\t\t\t\tctx.abort(\"system\");\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tconst interrupting = outcome.ruleMatches.filter((rule) => rule.interruptMode === \"always\");\n\t\tconst rule = interrupting[0];\n\t\tif (rule !== undefined && pendingRuleNudge === null && !genState.abortClaimed) {\n\t\t\tgenState.abortClaimed = true;\n\t\t\tgenState.abortOwner = \"collapse-repetition\";\n\t\t\tgenState.selfAbortAt = Date.now();\n\t\t\tpendingRuleNudge = { rule };\n\t\t\tctx.abort(\"system\");\n\t\t}\n\t});\n\n\tpi.on(\"message_end\", (event) => {\n\t\tif (genState.userCancelled) return undefined;\n\t\tif (event.message.role !== \"assistant\") return undefined;\n\t\tconst turnText = collectAssistantText(event.message);\n\t\tif (repetitiveTurns.armed) {\n\t\t\trepetitiveTurns.commitArmedTurn(turnText);\n\t\t\tmanager?.markInjectedByNames([REPETITIVE_TURNS_RULE_NAME]);\n\t\t\trecordInjection(REPETITIVE_TURNS_RULE_NAME, [REPETITIVE_TURNS_RULE_NAME], \"nudge\");\n\t\t\tpendingNudge = buildNudgeMessage(REPETITIVE_TURNS_RULE_NAME, REPETITIVE_TURNS_RULE_CONTENT);\n\t\t\treturn undefined;\n\t\t}\n\t\tif (pendingRuleNudge !== null) {\n\t\t\tconst pending = pendingRuleNudge;\n\t\t\tpendingRuleNudge = null;\n\t\t\tmanager?.markInjectedByNames([pending.rule.name]);\n\t\t\trecordInjection(pending.rule.name, [pending.rule.name], \"nudge\");\n\t\t\tpendingNudge = buildNudgeMessage(pending.rule.name, pending.rule.content);\n\t\t\treturn undefined;\n\t\t}\n\t\tif (pendingRemediation !== null) {\n\t\t\tif (turnText !== null) repetitiveTurns.recordCompletedTurn(turnText);\n\t\t\tconst pending = pendingRemediation;\n\t\t\tpendingRemediation = null;\n\t\t\ttry {\n\t\t\t\tconst outcome = buildStreamRemediation(pending, event.message);\n\t\t\t\trecordInjection(outcome.owner, outcome.observedRules, outcome.retryMode);\n\t\t\t\tif (outcome.nudge !== null) {\n\t\t\t\t\tpendingNudge = outcome.nudge;\n\t\t\t\t}\n\t\t\t\tconst merged = { ...event.message, ...outcome.replacement };\n\t\t\t\treturn { message: merged };\n\t\t\t} catch (error) {\n\t\t\t\tpi.appendEntry(\"ttsr-remediation-error\", {\n\t\t\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t\t\t\tat: Date.now(),\n\t\t\t\t});\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t}\n\t\tif (turnText !== null) repetitiveTurns.recordCompletedTurn(turnText);\n\t\treturn undefined;\n\t});\n\n\tpi.on(\"agent_settled\", () => {\n\t\tif (pendingNudge === null || genState.userCancelled || settlingAgentEnd?.abortSource === \"user\") {\n\t\t\tpendingNudge = null;\n\t\t\tsettlingAgentEnd = null;\n\t\t\treturn;\n\t\t}\n\t\tconst nudge = pendingNudge;\n\t\tpendingNudge = null;\n\t\tpi.sendMessage(nudge, { triggerTurn: true });\n\t});\n}\n"]}
@@ -0,0 +1,10 @@
1
+ import type { MessageUpdateEvent } from "../../types.ts";
2
+ import type { TtsrStreamSource } from "./types.ts";
3
+ export interface TtsrStreamDelta {
4
+ readonly source: TtsrStreamSource;
5
+ readonly streamKey: string;
6
+ readonly delta: string;
7
+ readonly toolName?: string;
8
+ }
9
+ export declare function getTtsrStreamDelta(event: MessageUpdateEvent): TtsrStreamDelta | null;
10
+ //# sourceMappingURL=message-update.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-update.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/message-update.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAMnD,MAAM,WAAW,eAAe;IAC/B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,kBAAkB,GAAG,eAAe,GAAG,IAAI,CAiCpF"}
@@ -0,0 +1,38 @@
1
+ function assertNever(value) {
2
+ throw new Error(`unexpected assistant message event: ${String(value)}`);
3
+ }
4
+ export function getTtsrStreamDelta(event) {
5
+ const deltaEvent = event.assistantMessageEvent;
6
+ switch (deltaEvent.type) {
7
+ case "text_delta":
8
+ return { source: "text", streamKey: `text:${String(deltaEvent.contentIndex)}`, delta: deltaEvent.delta };
9
+ case "thinking_delta":
10
+ return {
11
+ source: "thinking",
12
+ streamKey: `thinking:${String(deltaEvent.contentIndex)}`,
13
+ delta: deltaEvent.delta,
14
+ };
15
+ case "toolcall_delta": {
16
+ const block = deltaEvent.partial.content[deltaEvent.contentIndex];
17
+ return {
18
+ source: "tool",
19
+ streamKey: `tool:${String(deltaEvent.contentIndex)}`,
20
+ delta: deltaEvent.delta,
21
+ toolName: block?.type === "toolCall" ? block.name : undefined,
22
+ };
23
+ }
24
+ case "start":
25
+ case "text_start":
26
+ case "text_end":
27
+ case "thinking_start":
28
+ case "thinking_end":
29
+ case "toolcall_start":
30
+ case "toolcall_end":
31
+ case "done":
32
+ case "error":
33
+ return null;
34
+ default:
35
+ return assertNever(deltaEvent);
36
+ }
37
+ }
38
+ //# sourceMappingURL=message-update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"message-update.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/message-update.ts"],"names":[],"mappings":"AAGA,SAAS,WAAW,CAAC,KAAY;IAChC,MAAM,IAAI,KAAK,CAAC,uCAAuC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACzE,CAAC;AASD,MAAM,UAAU,kBAAkB,CAAC,KAAyB;IAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,qBAAqB,CAAC;IAC/C,QAAQ,UAAU,CAAC,IAAI,EAAE,CAAC;QACzB,KAAK,YAAY;YAChB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE,CAAC;QAC1G,KAAK,gBAAgB;YACpB,OAAO;gBACN,MAAM,EAAE,UAAU;gBAClB,SAAS,EAAE,YAAY,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;gBACxD,KAAK,EAAE,UAAU,CAAC,KAAK;aACvB,CAAC;QACH,KAAK,gBAAgB,CAAC,CAAC,CAAC;YACvB,MAAM,KAAK,GAAG,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;YAClE,OAAO;gBACN,MAAM,EAAE,MAAM;gBACd,SAAS,EAAE,QAAQ,MAAM,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;gBACpD,KAAK,EAAE,UAAU,CAAC,KAAK;gBACvB,QAAQ,EAAE,KAAK,EAAE,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;aAC7D,CAAC;QACH,CAAC;QACD,KAAK,OAAO,CAAC;QACb,KAAK,YAAY,CAAC;QAClB,KAAK,UAAU,CAAC;QAChB,KAAK,gBAAgB,CAAC;QACtB,KAAK,cAAc,CAAC;QACpB,KAAK,gBAAgB,CAAC;QACtB,KAAK,cAAc,CAAC;QACpB,KAAK,MAAM,CAAC;QACZ,KAAK,OAAO;YACX,OAAO,IAAI,CAAC;QACb;YACC,OAAO,WAAW,CAAC,UAAU,CAAC,CAAC;IACjC,CAAC;AACF,CAAC","sourcesContent":["import type { MessageUpdateEvent } from \"../../types.ts\";\nimport type { TtsrStreamSource } from \"./types.ts\";\n\nfunction assertNever(value: never): never {\n\tthrow new Error(`unexpected assistant message event: ${String(value)}`);\n}\n\nexport interface TtsrStreamDelta {\n\treadonly source: TtsrStreamSource;\n\treadonly streamKey: string;\n\treadonly delta: string;\n\treadonly toolName?: string;\n}\n\nexport function getTtsrStreamDelta(event: MessageUpdateEvent): TtsrStreamDelta | null {\n\tconst deltaEvent = event.assistantMessageEvent;\n\tswitch (deltaEvent.type) {\n\t\tcase \"text_delta\":\n\t\t\treturn { source: \"text\", streamKey: `text:${String(deltaEvent.contentIndex)}`, delta: deltaEvent.delta };\n\t\tcase \"thinking_delta\":\n\t\t\treturn {\n\t\t\t\tsource: \"thinking\",\n\t\t\t\tstreamKey: `thinking:${String(deltaEvent.contentIndex)}`,\n\t\t\t\tdelta: deltaEvent.delta,\n\t\t\t};\n\t\tcase \"toolcall_delta\": {\n\t\t\tconst block = deltaEvent.partial.content[deltaEvent.contentIndex];\n\t\t\treturn {\n\t\t\t\tsource: \"tool\",\n\t\t\t\tstreamKey: `tool:${String(deltaEvent.contentIndex)}`,\n\t\t\t\tdelta: deltaEvent.delta,\n\t\t\t\ttoolName: block?.type === \"toolCall\" ? block.name : undefined,\n\t\t\t};\n\t\t}\n\t\tcase \"start\":\n\t\tcase \"text_start\":\n\t\tcase \"text_end\":\n\t\tcase \"thinking_start\":\n\t\tcase \"thinking_end\":\n\t\tcase \"toolcall_start\":\n\t\tcase \"toolcall_end\":\n\t\tcase \"done\":\n\t\tcase \"error\":\n\t\t\treturn null;\n\t\tdefault:\n\t\t\treturn assertNever(deltaEvent);\n\t}\n}\n"]}
@@ -1,17 +1,12 @@
1
+ import type { AssistantMessage } from "@earendil-works/pi-ai";
1
2
  import { TTSR_INJECTION_CUSTOM_TYPE } from "./types.ts";
2
- export interface TruncatableAssistantMessage {
3
- readonly role: "assistant";
4
- readonly content: unknown[];
5
- readonly stopReason: string;
6
- readonly errorMessage?: string;
7
- readonly [key: string]: unknown;
8
- }
9
- export interface ErrorShellReplacement {
3
+ export type TruncatableAssistantMessage = AssistantMessage;
4
+ export type ErrorShellReplacement = {
10
5
  readonly role: "assistant";
11
6
  readonly content: never[];
12
7
  readonly stopReason: "error";
13
8
  readonly errorMessage: string;
14
- }
9
+ };
15
10
  export interface TtsrNudgeMessage {
16
11
  readonly customType: typeof TTSR_INJECTION_CUSTOM_TYPE;
17
12
  readonly content: string;
@@ -20,7 +15,7 @@ export interface TtsrNudgeMessage {
20
15
  readonly rules: readonly string[];
21
16
  };
22
17
  }
23
- type StreamKind = "text" | "thinking";
18
+ type StreamKind = "text" | "thinking" | "tool";
24
19
  export declare function buildTruncateReplacement(message: TruncatableAssistantMessage, garbageStartOffset: number, streamKind: StreamKind): TruncatableAssistantMessage;
25
20
  export declare function buildErrorShellReplacement(): ErrorShellReplacement;
26
21
  export declare function buildNudgeMessage(ruleName: string, ruleContent: string): TtsrNudgeMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"remediation.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/remediation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAKxD,MAAM,WAAW,2BAA2B;IAC3C,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC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IAC3B,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,UAAU,EAAE,OAAO,0BAA0B,CAAC;IACvD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE;QAAE,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAA;KAAE,CAAC;CACxD;AAED,KAAK,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;AAoB/C,wBAAgB,wBAAwB,CACvC,OAAO,EAAE,2BAA2B,EACpC,kBAAkB,EAAE,MAAM,EAC1B,UAAU,EAAE,UAAU,GACpB,2BAA2B,CAgC7B;AAED,wBAAgB,0BAA0B,IAAI,qBAAqB,CAElE;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,gBAAgB,CAOzF"}
@@ -3,6 +3,8 @@ import { TTSR_INJECTION_CUSTOM_TYPE } from "./types.js";
3
3
  const TRUNCATION_MARKER = "[output interrupted by stream rule]";
4
4
  const TRANSPORT_TIMEOUT_ERROR_PATTERN = /^Request timed out\.?$/i;
5
5
  function streamBlockText(block, kind) {
6
+ if (kind === "tool")
7
+ return undefined;
6
8
  if (typeof block !== "object" || block === null)
7
9
  return undefined;
8
10
  if (!("type" in block) || block.type !== kind)
@@ -11,11 +13,25 @@ function streamBlockText(block, kind) {
11
13
  return typeof value === "string" ? value : undefined;
12
14
  }
13
15
  function replaceStreamBlockText(block, kind, text) {
14
- if (typeof block !== "object" || block === null)
15
- return block;
16
- return { ...block, [kind]: text };
16
+ if (kind === "text" && block.type === "text")
17
+ return { ...block, text };
18
+ if (kind === "thinking" && block.type === "thinking")
19
+ return { ...block, thinking: text };
20
+ return block;
17
21
  }
18
22
  export function buildTruncateReplacement(message, garbageStartOffset, streamKind) {
23
+ if (streamKind === "tool") {
24
+ const content = message.content.filter((block) => {
25
+ if (typeof block !== "object" || block === null || !("type" in block))
26
+ return true;
27
+ return block.type !== "toolCall";
28
+ });
29
+ return {
30
+ ...message,
31
+ content: [...content, { type: "text", text: TRUNCATION_MARKER }],
32
+ stopReason: message.stopReason === "toolUse" ? "aborted" : message.stopReason,
33
+ };
34
+ }
19
35
  let remaining = Math.max(0, garbageStartOffset);
20
36
  let truncated = false;
21
37
  const content = [];
@@ -1 +1 @@
1
- {"version":3,"file":"remediation.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/remediation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,iBAAiB,GAAG,qCAAqC,CAAC;AAChE,MAAM,+BAA+B,GAAG,yBAAyB,CAAC;AAkClE,SAAS,eAAe,CAAC,KAAc,EAAE,IAAgB;IACxD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAClE,IAAI,CAAC,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI;QAAE,OAAO,SAAS,CAAC;IAChE,MAAM,KAAK,GAAY,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAChD,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACtD,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAc,EAAE,IAAgB,EAAE,IAAY;IAC7E,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IA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C;IAC5B,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,MAAM,UAAU,0BAA0B;IACzC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAClG,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,WAAmB;IACtE,OAAO;QACN,UAAU,EAAE,0BAA0B;QACtC,OAAO,EAAE,qBAAqB,CAAC,QAAQ,EAAE,WAAW,CAAC;QACrD,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE;KAC9B,CAAC;AACH,CAAC","sourcesContent":["import { LEAK_ERROR_MESSAGE, renderSystemInterrupt } from \"./prompts.ts\";\nimport { TTSR_INJECTION_CUSTOM_TYPE } from \"./types.ts\";\n\nconst TRUNCATION_MARKER = \"[output interrupted by stream rule]\";\nconst TRANSPORT_TIMEOUT_ERROR_PATTERN = /^Request timed out\\.?$/i;\n\nexport interface TruncatableAssistantMessage {\n\treadonly role: \"assistant\";\n\treadonly content: unknown[];\n\treadonly stopReason: string;\n\treadonly errorMessage?: string;\n\treadonly [key: string]: unknown;\n}\n\nexport interface ErrorShellReplacement {\n\treadonly role: \"assistant\";\n\treadonly content: never[];\n\treadonly stopReason: \"error\";\n\treadonly errorMessage: string;\n}\n\nexport interface TtsrNudgeMessage {\n\treadonly customType: typeof TTSR_INJECTION_CUSTOM_TYPE;\n\treadonly content: string;\n\treadonly display: false;\n\treadonly details: { readonly rules: readonly string[] };\n}\n\ntype StreamKind = \"text\" | \"thinking\";\n\ninterface MutableTruncateResult {\n\trole: \"assistant\";\n\tcontent: unknown[];\n\tstopReason: string;\n\terrorMessage?: string;\n\t[key: string]: unknown;\n}\n\nfunction streamBlockText(block: unknown, kind: StreamKind): string | undefined {\n\tif (typeof block !== \"object\" || block === null) return undefined;\n\tif (!(\"type\" in block) || block.type !== kind) return undefined;\n\tconst value: unknown = Reflect.get(block, kind);\n\treturn typeof value === \"string\" ? value : undefined;\n}\n\nfunction replaceStreamBlockText(block: unknown, kind: StreamKind, text: string): unknown {\n\tif (typeof block !== \"object\" || block === null) return block;\n\treturn { ...block, [kind]: text };\n}\n\nexport function buildTruncateReplacement(\n\tmessage: TruncatableAssistantMessage,\n\tgarbageStartOffset: number,\n\tstreamKind: StreamKind,\n): TruncatableAssistantMessage {\n\tlet remaining = Math.max(0, garbageStartOffset);\n\tlet truncated = false;\n\tconst content: unknown[] = [];\n\tfor (const block of message.content) {\n\t\tconst text = streamBlockText(block, streamKind);\n\t\tif (truncated && text !== undefined) continue;\n\t\tif (text === undefined || remaining > text.length) {\n\t\t\tcontent.push(block);\n\t\t\tif (text !== undefined) remaining -= text.length;\n\t\t\tcontinue;\n\t\t}\n\t\tcontent.push(replaceStreamBlockText(block, streamKind, text.slice(0, remaining)));\n\t\ttruncated = true;\n\t}\n\tcontent.push({ type: \"text\", text: TRUNCATION_MARKER });\n\tconst result: MutableTruncateResult = { ...message, content };\n\tif (result.errorMessage !== undefined && TRANSPORT_TIMEOUT_ERROR_PATTERN.test(result.errorMessage)) {\n\t\tdelete result.errorMessage;\n\t}\n\treturn result;\n}\n\nexport function buildErrorShellReplacement(): ErrorShellReplacement {\n\treturn { role: \"assistant\", content: [], stopReason: \"error\", errorMessage: LEAK_ERROR_MESSAGE };\n}\n\nexport function buildNudgeMessage(ruleName: string, ruleContent: string): TtsrNudgeMessage {\n\treturn {\n\t\tcustomType: TTSR_INJECTION_CUSTOM_TYPE,\n\t\tcontent: renderSystemInterrupt(ruleName, ruleContent),\n\t\tdisplay: false,\n\t\tdetails: { rules: [ruleName] },\n\t};\n}\n"]}
1
+ {"version":3,"file":"remediation.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/remediation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,cA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,MAAM,MAAM,GAAqB,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE,CAAC;IACzD,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,IAAI,+BAA+B,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;QACpG,OAAO,MAAM,CAAC,YAAY,CAAC;IAC5B,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,MAAM,UAAU,0BAA0B;IACzC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAClG,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,WAAmB;IACtE,OAAO;QACN,UAAU,EAAE,0BAA0B;QACtC,OAAO,EAAE,qBAAqB,CAAC,QAAQ,EAAE,WAAW,CAAC;QACrD,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAE;KAC9B,CAAC;AACH,CAAC","sourcesContent":["import type { AssistantMessage } from \"@earendil-works/pi-ai\";\nimport { LEAK_ERROR_MESSAGE, renderSystemInterrupt } from \"./prompts.ts\";\nimport { TTSR_INJECTION_CUSTOM_TYPE } from \"./types.ts\";\n\nconst TRUNCATION_MARKER = \"[output interrupted by stream rule]\";\nconst TRANSPORT_TIMEOUT_ERROR_PATTERN = /^Request timed out\\.?$/i;\n\nexport type TruncatableAssistantMessage = AssistantMessage;\nexport type ErrorShellReplacement = {\n\treadonly role: \"assistant\";\n\treadonly content: never[];\n\treadonly stopReason: \"error\";\n\treadonly errorMessage: string;\n};\n\nexport interface TtsrNudgeMessage {\n\treadonly customType: typeof TTSR_INJECTION_CUSTOM_TYPE;\n\treadonly content: string;\n\treadonly display: false;\n\treadonly details: { readonly rules: readonly string[] };\n}\n\ntype StreamKind = \"text\" | \"thinking\" | \"tool\";\n\nfunction streamBlockText(block: unknown, kind: StreamKind): string | undefined {\n\tif (kind === \"tool\") return undefined;\n\tif (typeof block !== \"object\" || block === null) return undefined;\n\tif (!(\"type\" in block) || block.type !== kind) return undefined;\n\tconst value: unknown = Reflect.get(block, kind);\n\treturn typeof value === \"string\" ? value : undefined;\n}\n\nfunction replaceStreamBlockText(\n\tblock: AssistantMessage[\"content\"][number],\n\tkind: StreamKind,\n\ttext: string,\n): AssistantMessage[\"content\"][number] {\n\tif (kind === \"text\" && block.type === \"text\") return { ...block, text };\n\tif (kind === \"thinking\" && block.type === \"thinking\") return { ...block, thinking: text };\n\treturn block;\n}\n\nexport function buildTruncateReplacement(\n\tmessage: TruncatableAssistantMessage,\n\tgarbageStartOffset: number,\n\tstreamKind: StreamKind,\n): TruncatableAssistantMessage {\n\tif (streamKind === \"tool\") {\n\t\tconst content = message.content.filter((block) => {\n\t\t\tif (typeof block !== \"object\" || block === null || !(\"type\" in block)) return true;\n\t\t\treturn block.type !== \"toolCall\";\n\t\t});\n\t\treturn {\n\t\t\t...message,\n\t\t\tcontent: [...content, { type: \"text\", text: TRUNCATION_MARKER }],\n\t\t\tstopReason: message.stopReason === \"toolUse\" ? \"aborted\" : message.stopReason,\n\t\t};\n\t}\n\tlet remaining = Math.max(0, garbageStartOffset);\n\tlet truncated = false;\n\tconst content: AssistantMessage[\"content\"] = [];\n\tfor (const block of message.content) {\n\t\tconst text = streamBlockText(block, streamKind);\n\t\tif (truncated && text !== undefined) continue;\n\t\tif (text === undefined || remaining > text.length) {\n\t\t\tcontent.push(block);\n\t\t\tif (text !== undefined) remaining -= text.length;\n\t\t\tcontinue;\n\t\t}\n\t\tcontent.push(replaceStreamBlockText(block, streamKind, text.slice(0, remaining)));\n\t\ttruncated = true;\n\t}\n\tcontent.push({ type: \"text\", text: TRUNCATION_MARKER });\n\tconst result: AssistantMessage = { ...message, content };\n\tif (result.errorMessage !== undefined && TRANSPORT_TIMEOUT_ERROR_PATTERN.test(result.errorMessage)) {\n\t\tdelete result.errorMessage;\n\t}\n\treturn result;\n}\n\nexport function buildErrorShellReplacement(): ErrorShellReplacement {\n\treturn { role: \"assistant\", content: [], stopReason: \"error\", errorMessage: LEAK_ERROR_MESSAGE };\n}\n\nexport function buildNudgeMessage(ruleName: string, ruleContent: string): TtsrNudgeMessage {\n\treturn {\n\t\tcustomType: TTSR_INJECTION_CUSTOM_TYPE,\n\t\tcontent: renderSystemInterrupt(ruleName, ruleContent),\n\t\tdisplay: false,\n\t\tdetails: { rules: [ruleName] },\n\t};\n}\n"]}
@@ -2,7 +2,7 @@ import { type ErrorShellReplacement, type TruncatableAssistantMessage, type Ttsr
2
2
  import type { DetectionResolution } from "./types.ts";
3
3
  export interface StreamRemediationInput {
4
4
  readonly resolution: DetectionResolution;
5
- readonly streamKind: "text" | "thinking";
5
+ readonly streamKind: "text" | "thinking" | "tool";
6
6
  }
7
7
  export interface StreamRemediationOutcome {
8
8
  readonly replacement: ErrorShellReplacement | TruncatableAssistantMessage;
@@ -1 +1 @@
1
- {"version":3,"file":"stream-remediation.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/stream-remediation.ts"],"names":[],"mappings":"AACA,OAAO,EAIN,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAAC;CACzC;AAED,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,WAAW,EAAE,qBAAqB,GAAG,2BAA2B,CAAC;IAC1E,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,gBAAgB,CAAC;CAC/C;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,sBAAsB,EAAE,OAAO,EAAE,OAAO,GAAG,wBAAwB,CAsBlH"}
1
+ {"version":3,"file":"stream-remediation.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/stream-remediation.ts"],"names":[],"mappings":"AACA,OAAO,EAIN,KAAK,qBAAqB,EAC1B,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,WAAW,sBAAsB;IACtC,QAAQ,CAAC,UAAU,EAAE,mBAAmB,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;CAClD;AAED,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,WAAW,EAAE,qBAAqB,GAAG,2BAA2B,CAAC;IAC1E,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,aAAa,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1C,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,gBAAgB,CAAC;CAC/C;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,sBAAsB,EAAE,OAAO,EAAE,OAAO,GAAG,wBAAwB,CAsBlH"}
@@ -1 +1 @@
1
- {"version":3,"file":"stream-remediation.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/stream-remediation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EACN,0BAA0B,EAC1B,iBAAiB,EACjB,wBAAwB,GAIxB,MAAM,kBAAkB,CAAC;AAgB1B,MAAM,UAAU,sBAAsB,CAAC,OAA+B,EAAE,OAAgB;IACvF,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,eAAe,KAAK,YAAY,EAAE,CAAC;QACrE,OAAO;YACN,WAAW,EAAE,0BAA0B,EAAE;YACzC,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;YAC/B,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,aAAa;YAC/C,SAAS,EAAE,gBAAgB;SAC3B,CAAC;IACH,CAAC;IACD,MAAM,QAAQ,GAAG,wBAAwB,CACxC,OAAsC,EACtC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,kBAAkB,EAC3C,OAAO,CAAC,UAAU,CAClB,CAAC;IACF,OAAO;QACN,WAAW,EAAE,QAAQ;QACrB,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,qBAAqB,CAAC;QACzE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;QAC/B,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,aAAa;QAC/C,SAAS,EAAE,OAAO;KAClB,CAAC;AACH,CAAC","sourcesContent":["import { COLLAPSE_RULE_CONTENT } from \"./prompts.ts\";\nimport {\n\tbuildErrorShellReplacement,\n\tbuildNudgeMessage,\n\tbuildTruncateReplacement,\n\ttype ErrorShellReplacement,\n\ttype TruncatableAssistantMessage,\n\ttype TtsrNudgeMessage,\n} from \"./remediation.ts\";\nimport type { DetectionResolution } from \"./types.ts\";\n\nexport interface StreamRemediationInput {\n\treadonly resolution: DetectionResolution;\n\treadonly streamKind: \"text\" | \"thinking\";\n}\n\nexport interface StreamRemediationOutcome {\n\treadonly replacement: ErrorShellReplacement | TruncatableAssistantMessage;\n\treadonly nudge: TtsrNudgeMessage | null;\n\treadonly owner: string;\n\treadonly observedRules: readonly string[];\n\treadonly retryMode: \"nudge\" | \"provider-error\";\n}\n\nexport function buildStreamRemediation(pending: StreamRemediationInput, message: unknown): StreamRemediationOutcome {\n\tif (pending.resolution.remediation.corruptionScope === \"generation\") {\n\t\treturn {\n\t\t\treplacement: buildErrorShellReplacement(),\n\t\t\tnudge: null,\n\t\t\towner: pending.resolution.owner,\n\t\t\tobservedRules: pending.resolution.observedRules,\n\t\t\tretryMode: \"provider-error\",\n\t\t};\n\t}\n\tconst replaced = buildTruncateReplacement(\n\t\tmessage as TruncatableAssistantMessage,\n\t\tpending.resolution.match.garbageStartOffset,\n\t\tpending.streamKind,\n\t);\n\treturn {\n\t\treplacement: replaced,\n\t\tnudge: buildNudgeMessage(pending.resolution.owner, COLLAPSE_RULE_CONTENT),\n\t\towner: pending.resolution.owner,\n\t\tobservedRules: pending.resolution.observedRules,\n\t\tretryMode: \"nudge\",\n\t};\n}\n"]}
1
+ {"version":3,"file":"stream-remediation.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/stream-remediation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EACN,0BAA0B,EAC1B,iBAAiB,EACjB,wBAAwB,GAIxB,MAAM,kBAAkB,CAAC;AAgB1B,MAAM,UAAU,sBAAsB,CAAC,OAA+B,EAAE,OAAgB;IACvF,IAAI,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,eAAe,KAAK,YAAY,EAAE,CAAC;QACrE,OAAO;YACN,WAAW,EAAE,0BAA0B,EAAE;YACzC,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;YAC/B,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,aAAa;YAC/C,SAAS,EAAE,gBAAgB;SAC3B,CAAC;IACH,CAAC;IACD,MAAM,QAAQ,GAAG,wBAAwB,CACxC,OAAsC,EACtC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,kBAAkB,EAC3C,OAAO,CAAC,UAAU,CAClB,CAAC;IACF,OAAO;QACN,WAAW,EAAE,QAAQ;QACrB,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,EAAE,qBAAqB,CAAC;QACzE,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;QAC/B,aAAa,EAAE,OAAO,CAAC,UAAU,CAAC,aAAa;QAC/C,SAAS,EAAE,OAAO;KAClB,CAAC;AACH,CAAC","sourcesContent":["import { COLLAPSE_RULE_CONTENT } from \"./prompts.ts\";\nimport {\n\tbuildErrorShellReplacement,\n\tbuildNudgeMessage,\n\tbuildTruncateReplacement,\n\ttype ErrorShellReplacement,\n\ttype TruncatableAssistantMessage,\n\ttype TtsrNudgeMessage,\n} from \"./remediation.ts\";\nimport type { DetectionResolution } from \"./types.ts\";\n\nexport interface StreamRemediationInput {\n\treadonly resolution: DetectionResolution;\n\treadonly streamKind: \"text\" | \"thinking\" | \"tool\";\n}\n\nexport interface StreamRemediationOutcome {\n\treadonly replacement: ErrorShellReplacement | TruncatableAssistantMessage;\n\treadonly nudge: TtsrNudgeMessage | null;\n\treadonly owner: string;\n\treadonly observedRules: readonly string[];\n\treadonly retryMode: \"nudge\" | \"provider-error\";\n}\n\nexport function buildStreamRemediation(pending: StreamRemediationInput, message: unknown): StreamRemediationOutcome {\n\tif (pending.resolution.remediation.corruptionScope === \"generation\") {\n\t\treturn {\n\t\t\treplacement: buildErrorShellReplacement(),\n\t\t\tnudge: null,\n\t\t\towner: pending.resolution.owner,\n\t\t\tobservedRules: pending.resolution.observedRules,\n\t\t\tretryMode: \"provider-error\",\n\t\t};\n\t}\n\tconst replaced = buildTruncateReplacement(\n\t\tmessage as TruncatableAssistantMessage,\n\t\tpending.resolution.match.garbageStartOffset,\n\t\tpending.streamKind,\n\t);\n\treturn {\n\t\treplacement: replaced,\n\t\tnudge: buildNudgeMessage(pending.resolution.owner, COLLAPSE_RULE_CONTENT),\n\t\towner: pending.resolution.owner,\n\t\tobservedRules: pending.resolution.observedRules,\n\t\tretryMode: \"nudge\",\n\t};\n}\n"]}
@@ -28,7 +28,7 @@ export interface TtsrSettings {
28
28
  }
29
29
  export declare const DEFAULT_TTSR_SETTINGS: TtsrSettings;
30
30
  export interface DetectorContext {
31
- readonly source: Exclude<TtsrStreamSource, "tool">;
31
+ readonly source: TtsrStreamSource;
32
32
  readonly streamKey: string;
33
33
  readonly generation: number;
34
34
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;AAE5D,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,SAAS;IACzB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;CAC9C;AAED,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEnD,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,SAAS,EAAE,SAAS,MAAM,EAAE,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,aAAa,EAAE,iBAAiB,CAAC;IAC1C,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,G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;IAClB,WAAW,EAAE,UAAU;IACvB,eAAe,EAAE,eAAe;IAChC,QAAQ,EAAE,qBAAqB;CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAoB;IACxD,SAAS,EAAE,gBAAgB;IAC3B,WAAW,EAAE,SAAS;IACtB,eAAe,EAAE,YAAY;IAC7B,SAAS,EAAE,oBAAoB;CAC/B,CAAC;AAuBF,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAC","sourcesContent":["export type TtsrStreamSource = \"text\" | \"thinking\" | \"tool\";\n\nexport interface TtsrToolScope {\n\treadonly toolName: string;\n\treadonly pathGlob?: string;\n}\n\nexport interface TtsrScope {\n\treadonly allowText: boolean;\n\treadonly allowThinking: boolean;\n\treadonly toolScopes: readonly TtsrToolScope[];\n}\n\nexport type TtsrInterruptMode = \"always\" | \"never\";\n\nexport interface TtsrRule {\n\treadonly name: string;\n\treadonly path?: string;\n\treadonly content: string;\n\treadonly description?: string;\n\treadonly globs?: readonly string[];\n\treadonly condition: readonly string[];\n\treadonly scope: TtsrScope;\n\treadonly interruptMode: TtsrInterruptMode;\n\treadonly source: \"builtin\" | \"project\" | \"global\";\n}\n\nexport interface TtsrSettings {\n\treadonly enabled: boolean;\n\treadonly repeatMode: \"once\" | \"after-gap\";\n\treadonly repeatGap: number;\n\treadonly disabledRules: readonly string[];\n}\n\nexport const DEFAULT_TTSR_SETTINGS: TtsrSettings = {\n\tenabled: true,\n\trepeatMode: \"once\",\n\trepeatGap: 10,\n\tdisabledRules: [],\n};\n\nexport interface DetectorContext {\n\treadonly source: Exclude<TtsrStreamSource, \"tool\">;\n\treadonly streamKey: string;\n\treadonly generation: number;\n}\n\nexport interface DetectorMatch {\n\treadonly rule: \"collapse-repetition\" | \"control-token-leak\" | \"repetitive-turns\";\n\treadonly reason: string;\n\treadonly anomalyStartOffset: number;\n\treadonly garbageStartOffset: number;\n\treadonly detail: Readonly<Record<string, string | number | boolean>>;\n}\n\nexport interface StreamDetector<State> {\n\tcreateState(): State;\n\tcheckDelta(state: State, delta: string, ctx: DetectorContext): DetectorMatch | null;\n\tflush?(state: State, ctx: DetectorContext): DetectorMatch | null;\n}\n\nexport type TtsrContextMode = \"keep\" | \"truncate\" | \"discard\";\n\nexport type RuleRemediation =\n\t| {\n\t\t\treadonly retryMode: \"nudge\";\n\t\t\treadonly contextMode: TtsrContextMode;\n\t\t\treadonly corruptionScope: \"output-region\";\n\t\t\treadonly nudgeKey: string;\n\t }\n\t| {\n\t\t\treadonly retryMode: \"provider-error\";\n\t\t\treadonly contextMode: \"discard\";\n\t\t\treadonly corruptionScope: \"generation\";\n\t\t\treadonly errorKind: \"control-token-leak\";\n\t };\n\nexport const COLLAPSE_REMEDIATION: RuleRemediation = {\n\tretryMode: \"nudge\",\n\tcontextMode: \"truncate\",\n\tcorruptionScope: \"output-region\",\n\tnudgeKey: \"collapse-repetition\",\n};\n\nexport const CONTROL_LEAK_REMEDIATION: RuleRemediation = {\n\tretryMode: \"provider-error\",\n\tcontextMode: \"discard\",\n\tcorruptionScope: \"generation\",\n\terrorKind: \"control-token-leak\",\n};\n\nexport interface DetectionResolution {\n\treadonly owner: \"collapse-repetition\" | \"control-token-leak\";\n\treadonly observedRules: readonly (\"collapse-repetition\" | \"control-token-leak\")[];\n\treadonly match: DetectorMatch;\n\treadonly remediation: RuleRemediation;\n}\n\nexport interface GenerationDetectionState {\n\tabortClaimed: boolean;\n\tabortOwner?: DetectionResolution[\"owner\"];\n\tselfAbortAt?: number;\n\tuserCancelled: boolean;\n}\n\nexport interface TtsrInjectionRecord {\n\treadonly rules: readonly string[];\n\treadonly owner: DetectionResolution[\"owner\"];\n\treadonly remediation: RuleRemediation[\"retryMode\"];\n\treadonly at: number;\n}\n\nexport const TTSR_INJECTION_CUSTOM_TYPE = \"ttsr-injection\";\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/ttsr/types.ts"],"names":[],"mappings":"AAkCA,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IAClD,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,MAAM;IAClB,SAAS,EAAE,EAAE;IACb,aAAa,EAAE,EAAE;CACjB,CAAC;AAsCF,MAAM,CAAC,MAAM,oBAAoB,GAAoB;IACpD,SAAS,EAAE,OAAO;IAClB,WAAW,EAAE,UAAU;IACvB,eAAe,EAAE,eAAe;IAChC,QAAQ,EAAE,qBAAqB;CAC/B,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAoB;IACxD,SAAS,EAAE,gBAAgB;IAC3B,WAAW,EAAE,SAAS;IACtB,eAAe,EAAE,YAAY;IAC7B,SAAS,EAAE,oBAAoB;CAC/B,CAAC;AAuBF,MAAM,CAAC,MAAM,0BAA0B,GAAG,gBAAgB,CAAC","sourcesContent":["export type TtsrStreamSource = \"text\" | \"thinking\" | \"tool\";\n\nexport interface TtsrToolScope {\n\treadonly toolName: string;\n\treadonly pathGlob?: string;\n}\n\nexport interface TtsrScope {\n\treadonly allowText: boolean;\n\treadonly allowThinking: boolean;\n\treadonly toolScopes: readonly TtsrToolScope[];\n}\n\nexport type TtsrInterruptMode = \"always\" | \"never\";\n\nexport interface TtsrRule {\n\treadonly name: string;\n\treadonly path?: string;\n\treadonly content: string;\n\treadonly description?: string;\n\treadonly globs?: readonly string[];\n\treadonly condition: readonly string[];\n\treadonly scope: TtsrScope;\n\treadonly interruptMode: TtsrInterruptMode;\n\treadonly source: \"builtin\" | \"project\" | \"global\";\n}\n\nexport interface TtsrSettings {\n\treadonly enabled: boolean;\n\treadonly repeatMode: \"once\" | \"after-gap\";\n\treadonly repeatGap: number;\n\treadonly disabledRules: readonly string[];\n}\n\nexport const DEFAULT_TTSR_SETTINGS: TtsrSettings = {\n\tenabled: true,\n\trepeatMode: \"once\",\n\trepeatGap: 10,\n\tdisabledRules: [],\n};\n\nexport interface DetectorContext {\n\treadonly source: TtsrStreamSource;\n\treadonly streamKey: string;\n\treadonly generation: number;\n}\n\nexport interface DetectorMatch {\n\treadonly rule: \"collapse-repetition\" | \"control-token-leak\" | \"repetitive-turns\";\n\treadonly reason: string;\n\treadonly anomalyStartOffset: number;\n\treadonly garbageStartOffset: number;\n\treadonly detail: Readonly<Record<string, string | number | boolean>>;\n}\n\nexport interface StreamDetector<State> {\n\tcreateState(): State;\n\tcheckDelta(state: State, delta: string, ctx: DetectorContext): DetectorMatch | null;\n\tflush?(state: State, ctx: DetectorContext): DetectorMatch | null;\n}\n\nexport type TtsrContextMode = \"keep\" | \"truncate\" | \"discard\";\n\nexport type RuleRemediation =\n\t| {\n\t\t\treadonly retryMode: \"nudge\";\n\t\t\treadonly contextMode: TtsrContextMode;\n\t\t\treadonly corruptionScope: \"output-region\";\n\t\t\treadonly nudgeKey: string;\n\t }\n\t| {\n\t\t\treadonly retryMode: \"provider-error\";\n\t\t\treadonly contextMode: \"discard\";\n\t\t\treadonly corruptionScope: \"generation\";\n\t\t\treadonly errorKind: \"control-token-leak\";\n\t };\n\nexport const COLLAPSE_REMEDIATION: RuleRemediation = {\n\tretryMode: \"nudge\",\n\tcontextMode: \"truncate\",\n\tcorruptionScope: \"output-region\",\n\tnudgeKey: \"collapse-repetition\",\n};\n\nexport const CONTROL_LEAK_REMEDIATION: RuleRemediation = {\n\tretryMode: \"provider-error\",\n\tcontextMode: \"discard\",\n\tcorruptionScope: \"generation\",\n\terrorKind: \"control-token-leak\",\n};\n\nexport interface DetectionResolution {\n\treadonly owner: \"collapse-repetition\" | \"control-token-leak\";\n\treadonly observedRules: readonly (\"collapse-repetition\" | \"control-token-leak\")[];\n\treadonly match: DetectorMatch;\n\treadonly remediation: RuleRemediation;\n}\n\nexport interface GenerationDetectionState {\n\tabortClaimed: boolean;\n\tabortOwner?: DetectionResolution[\"owner\"];\n\tselfAbortAt?: number;\n\tuserCancelled: boolean;\n}\n\nexport interface TtsrInjectionRecord {\n\treadonly rules: readonly string[];\n\treadonly owner: DetectionResolution[\"owner\"];\n\treadonly remediation: RuleRemediation[\"retryMode\"];\n\treadonly at: number;\n}\n\nexport const TTSR_INJECTION_CUSTOM_TYPE = \"ttsr-injection\";\n"]}
@@ -8,6 +8,6 @@ export declare class StreamWatcher {
8
8
  #private;
9
9
  constructor(manager: TtsrManager, disabledBuiltinRules: readonly string[]);
10
10
  reset(): void;
11
- handleDelta(source: "text" | "thinking", streamKey: string, delta: string, generation: number): WatchOutcome;
11
+ handleDelta(source: "text" | "thinking" | "tool", streamKey: string, delta: string, generation: number, toolName?: string): WatchOutcome;
12
12
  }
13
13
  //# sourceMappingURL=watch.d.ts.map