@code-yeongyu/senpi 2026.9.4 → 2026.9.5-3

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 (1047) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/README.md +5 -4
  3. package/dist/cli/startup-ui.d.ts.map +1 -1
  4. package/dist/cli/startup-ui.js +2 -1
  5. package/dist/cli/startup-ui.js.map +1 -1
  6. package/dist/core/agent-session-runtime.js +2 -2
  7. package/dist/core/agent-session-runtime.js.map +1 -1
  8. package/dist/core/agent-session.d.ts +17 -1
  9. package/dist/core/agent-session.d.ts.map +1 -1
  10. package/dist/core/agent-session.js +106 -3
  11. package/dist/core/agent-session.js.map +1 -1
  12. package/dist/core/auth-storage.d.ts.map +1 -1
  13. package/dist/core/auth-storage.js +31 -41
  14. package/dist/core/auth-storage.js.map +1 -1
  15. package/dist/core/compaction/compaction.d.ts.map +1 -1
  16. package/dist/core/compaction/compaction.js +20 -7
  17. package/dist/core/compaction/compaction.js.map +1 -1
  18. package/dist/core/credential-pool/state-store.d.ts +1 -0
  19. package/dist/core/credential-pool/state-store.d.ts.map +1 -1
  20. package/dist/core/credential-pool/state-store.js +22 -2
  21. package/dist/core/credential-pool/state-store.js.map +1 -1
  22. package/dist/core/extensions/builtin/bash-timeout/index.d.ts.map +1 -1
  23. package/dist/core/extensions/builtin/bash-timeout/index.js +1 -5
  24. package/dist/core/extensions/builtin/bash-timeout/index.js.map +1 -1
  25. package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts +0 -2
  26. package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts.map +1 -1
  27. package/dist/core/extensions/builtin/bash-timeout/timeout.js +3 -4
  28. package/dist/core/extensions/builtin/bash-timeout/timeout.js.map +1 -1
  29. package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.d.ts.map +1 -1
  30. package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js +2 -0
  31. package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js.map +1 -1
  32. package/dist/core/extensions/builtin/compaction/model-usability-budget.d.ts +5 -0
  33. package/dist/core/extensions/builtin/compaction/model-usability-budget.d.ts.map +1 -1
  34. package/dist/core/extensions/builtin/compaction/model-usability-budget.js +11 -4
  35. package/dist/core/extensions/builtin/compaction/model-usability-budget.js.map +1 -1
  36. package/dist/core/extensions/builtin/compaction/openai-remote-convert.d.ts.map +1 -1
  37. package/dist/core/extensions/builtin/compaction/openai-remote-convert.js +2 -0
  38. package/dist/core/extensions/builtin/compaction/openai-remote-convert.js.map +1 -1
  39. package/dist/core/extensions/builtin/goal/prompt.d.ts.map +1 -1
  40. package/dist/core/extensions/builtin/goal/prompt.js +1 -3
  41. package/dist/core/extensions/builtin/goal/prompt.js.map +1 -1
  42. package/dist/core/extensions/builtin/goal/store.d.ts.map +1 -1
  43. package/dist/core/extensions/builtin/goal/store.js +8 -20
  44. package/dist/core/extensions/builtin/goal/store.js.map +1 -1
  45. package/dist/core/extensions/builtin/goal/tool-registration.js +1 -1
  46. package/dist/core/extensions/builtin/goal/tool-registration.js.map +1 -1
  47. package/dist/core/extensions/builtin/hooks/trust-storage.d.ts.map +1 -1
  48. package/dist/core/extensions/builtin/hooks/trust-storage.js +3 -1
  49. package/dist/core/extensions/builtin/hooks/trust-storage.js.map +1 -1
  50. package/dist/core/extensions/builtin/imagegen/auth.d.ts.map +1 -1
  51. package/dist/core/extensions/builtin/imagegen/auth.js +10 -2
  52. package/dist/core/extensions/builtin/imagegen/auth.js.map +1 -1
  53. package/dist/core/extensions/builtin/loop/index.d.ts.map +1 -1
  54. package/dist/core/extensions/builtin/loop/index.js +20 -1
  55. package/dist/core/extensions/builtin/loop/index.js.map +1 -1
  56. package/dist/core/extensions/builtin/loop/store.d.ts +8 -6
  57. package/dist/core/extensions/builtin/loop/store.d.ts.map +1 -1
  58. package/dist/core/extensions/builtin/loop/store.js +54 -88
  59. package/dist/core/extensions/builtin/loop/store.js.map +1 -1
  60. package/dist/core/extensions/builtin/loop/tools.d.ts +6 -1
  61. package/dist/core/extensions/builtin/loop/tools.d.ts.map +1 -1
  62. package/dist/core/extensions/builtin/loop/tools.js +8 -1
  63. package/dist/core/extensions/builtin/loop/tools.js.map +1 -1
  64. package/dist/core/extensions/builtin/monitor-state-event.d.ts +2 -0
  65. package/dist/core/extensions/builtin/monitor-state-event.d.ts.map +1 -1
  66. package/dist/core/extensions/builtin/monitor-state-event.js.map +1 -1
  67. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts +10 -6
  68. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts.map +1 -1
  69. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js +27 -12
  70. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js.map +1 -1
  71. package/dist/core/extensions/builtin/recommended-models/index.d.ts +1 -1
  72. package/dist/core/extensions/builtin/recommended-models/index.d.ts.map +1 -1
  73. package/dist/core/extensions/builtin/recommended-models/index.js +1 -0
  74. package/dist/core/extensions/builtin/recommended-models/index.js.map +1 -1
  75. package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -1
  76. package/dist/core/extensions/builtin/service-tier.js +12 -4
  77. package/dist/core/extensions/builtin/service-tier.js.map +1 -1
  78. package/dist/core/extensions/builtin/terminal/durable-command.d.ts +31 -0
  79. package/dist/core/extensions/builtin/terminal/durable-command.d.ts.map +1 -0
  80. package/dist/core/extensions/builtin/terminal/durable-command.js +96 -0
  81. package/dist/core/extensions/builtin/terminal/durable-command.js.map +1 -0
  82. package/dist/core/extensions/builtin/terminal/durable-file.d.ts +42 -0
  83. package/dist/core/extensions/builtin/terminal/durable-file.d.ts.map +1 -0
  84. package/dist/core/extensions/builtin/terminal/durable-file.js +102 -0
  85. package/dist/core/extensions/builtin/terminal/durable-file.js.map +1 -0
  86. package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
  87. package/dist/core/extensions/builtin/terminal/extension.js +226 -3
  88. package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
  89. package/dist/core/extensions/builtin/terminal/manager.d.ts +10 -0
  90. package/dist/core/extensions/builtin/terminal/manager.d.ts.map +1 -1
  91. package/dist/core/extensions/builtin/terminal/manager.js +21 -0
  92. package/dist/core/extensions/builtin/terminal/manager.js.map +1 -1
  93. package/dist/core/extensions/builtin/terminal/manifest-lease.d.ts +24 -0
  94. package/dist/core/extensions/builtin/terminal/manifest-lease.d.ts.map +1 -0
  95. package/dist/core/extensions/builtin/terminal/manifest-lease.js +105 -0
  96. package/dist/core/extensions/builtin/terminal/manifest-lease.js.map +1 -0
  97. package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts.map +1 -1
  98. package/dist/core/extensions/builtin/terminal/monitor-notify.js +5 -1
  99. package/dist/core/extensions/builtin/terminal/monitor-notify.js.map +1 -1
  100. package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts +42 -2
  101. package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts.map +1 -1
  102. package/dist/core/extensions/builtin/terminal/monitor-registry.js +73 -2
  103. package/dist/core/extensions/builtin/terminal/monitor-registry.js.map +1 -1
  104. package/dist/core/extensions/builtin/terminal/monitor-status.d.ts.map +1 -1
  105. package/dist/core/extensions/builtin/terminal/monitor-status.js +21 -1
  106. package/dist/core/extensions/builtin/terminal/monitor-status.js.map +1 -1
  107. package/dist/core/extensions/builtin/terminal/prompt.d.ts.map +1 -1
  108. package/dist/core/extensions/builtin/terminal/prompt.js +9 -5
  109. package/dist/core/extensions/builtin/terminal/prompt.js.map +1 -1
  110. package/dist/core/extensions/builtin/terminal/restore.d.ts +56 -0
  111. package/dist/core/extensions/builtin/terminal/restore.d.ts.map +1 -0
  112. package/dist/core/extensions/builtin/terminal/restore.js +177 -0
  113. package/dist/core/extensions/builtin/terminal/restore.js.map +1 -0
  114. package/dist/core/extensions/builtin/terminal/shared.d.ts +25 -0
  115. package/dist/core/extensions/builtin/terminal/shared.d.ts.map +1 -1
  116. package/dist/core/extensions/builtin/terminal/shared.js +25 -0
  117. package/dist/core/extensions/builtin/terminal/shared.js.map +1 -1
  118. package/dist/core/extensions/builtin/terminal/terminal-manifest-model.d.ts +91 -0
  119. package/dist/core/extensions/builtin/terminal/terminal-manifest-model.d.ts.map +1 -0
  120. package/dist/core/extensions/builtin/terminal/terminal-manifest-model.js +14 -0
  121. package/dist/core/extensions/builtin/terminal/terminal-manifest-model.js.map +1 -0
  122. package/dist/core/extensions/builtin/terminal/terminal-manifest.d.ts +62 -0
  123. package/dist/core/extensions/builtin/terminal/terminal-manifest.d.ts.map +1 -0
  124. package/dist/core/extensions/builtin/terminal/terminal-manifest.js +204 -0
  125. package/dist/core/extensions/builtin/terminal/terminal-manifest.js.map +1 -0
  126. package/dist/core/extensions/builtin/terminal/tools/bash-input.d.ts.map +1 -1
  127. package/dist/core/extensions/builtin/terminal/tools/bash-input.js +3 -2
  128. package/dist/core/extensions/builtin/terminal/tools/bash-input.js.map +1 -1
  129. package/dist/core/extensions/builtin/terminal/tools/bash-output.d.ts.map +1 -1
  130. package/dist/core/extensions/builtin/terminal/tools/bash-output.js +5 -4
  131. package/dist/core/extensions/builtin/terminal/tools/bash-output.js.map +1 -1
  132. package/dist/core/extensions/builtin/terminal/tools/bash-resize.d.ts.map +1 -1
  133. package/dist/core/extensions/builtin/terminal/tools/bash-resize.js +3 -2
  134. package/dist/core/extensions/builtin/terminal/tools/bash-resize.js.map +1 -1
  135. package/dist/core/extensions/builtin/terminal/tools/context.d.ts +8 -0
  136. package/dist/core/extensions/builtin/terminal/tools/context.d.ts.map +1 -1
  137. package/dist/core/extensions/builtin/terminal/tools/context.js +10 -0
  138. package/dist/core/extensions/builtin/terminal/tools/context.js.map +1 -1
  139. package/dist/core/extensions/builtin/terminal/tools/kill-bash.d.ts.map +1 -1
  140. package/dist/core/extensions/builtin/terminal/tools/kill-bash.js +5 -4
  141. package/dist/core/extensions/builtin/terminal/tools/kill-bash.js.map +1 -1
  142. package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts +4 -1
  143. package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts.map +1 -1
  144. package/dist/core/extensions/builtin/terminal/tools/monitor.js +114 -22
  145. package/dist/core/extensions/builtin/terminal/tools/monitor.js.map +1 -1
  146. package/dist/core/extensions/builtin/todotools/prompt.d.ts +2 -2
  147. package/dist/core/extensions/builtin/todotools/prompt.d.ts.map +1 -1
  148. package/dist/core/extensions/builtin/todotools/prompt.js +3 -6
  149. package/dist/core/extensions/builtin/todotools/prompt.js.map +1 -1
  150. package/dist/core/extensions/builtin/tool-search/index.d.ts.map +1 -1
  151. package/dist/core/extensions/builtin/tool-search/index.js +1 -1
  152. package/dist/core/extensions/builtin/tool-search/index.js.map +1 -1
  153. package/dist/core/extensions/builtin/tool-search/native-search.d.ts +9 -4
  154. package/dist/core/extensions/builtin/tool-search/native-search.d.ts.map +1 -1
  155. package/dist/core/extensions/builtin/tool-search/native-search.js +11 -6
  156. package/dist/core/extensions/builtin/tool-search/native-search.js.map +1 -1
  157. package/dist/core/extensions/builtin/tool-search/native-support.d.ts +13 -0
  158. package/dist/core/extensions/builtin/tool-search/native-support.d.ts.map +1 -0
  159. package/dist/core/extensions/builtin/tool-search/native-support.js +45 -0
  160. package/dist/core/extensions/builtin/tool-search/native-support.js.map +1 -0
  161. package/dist/core/extensions/index.d.ts +1 -1
  162. package/dist/core/extensions/index.d.ts.map +1 -1
  163. package/dist/core/extensions/index.js.map +1 -1
  164. package/dist/core/extensions/runner.d.ts +5 -0
  165. package/dist/core/extensions/runner.d.ts.map +1 -1
  166. package/dist/core/extensions/runner.js +44 -1
  167. package/dist/core/extensions/runner.js.map +1 -1
  168. package/dist/core/extensions/types.d.ts +26 -3
  169. package/dist/core/extensions/types.d.ts.map +1 -1
  170. package/dist/core/extensions/types.js.map +1 -1
  171. package/dist/core/footer-data-provider.d.ts.map +1 -1
  172. package/dist/core/footer-data-provider.js +18 -1
  173. package/dist/core/footer-data-provider.js.map +1 -1
  174. package/dist/core/http-dispatcher.d.ts.map +1 -1
  175. package/dist/core/http-dispatcher.js +2 -0
  176. package/dist/core/http-dispatcher.js.map +1 -1
  177. package/dist/core/lockfile-policy.d.ts +11 -0
  178. package/dist/core/lockfile-policy.d.ts.map +1 -1
  179. package/dist/core/lockfile-policy.js +19 -0
  180. package/dist/core/lockfile-policy.js.map +1 -1
  181. package/dist/core/manual-continue.d.ts +13 -0
  182. package/dist/core/manual-continue.d.ts.map +1 -0
  183. package/dist/core/manual-continue.js +19 -0
  184. package/dist/core/manual-continue.js.map +1 -0
  185. package/dist/core/messages.d.ts +7 -0
  186. package/dist/core/messages.d.ts.map +1 -1
  187. package/dist/core/messages.js +10 -2
  188. package/dist/core/messages.js.map +1 -1
  189. package/dist/core/model-config.d.ts.map +1 -1
  190. package/dist/core/model-config.js +3 -0
  191. package/dist/core/model-config.js.map +1 -1
  192. package/dist/core/provider-composer.d.ts.map +1 -1
  193. package/dist/core/provider-composer.js +13 -2
  194. package/dist/core/provider-composer.js.map +1 -1
  195. package/dist/core/retry-fallback/chains.d.ts +1 -13
  196. package/dist/core/retry-fallback/chains.d.ts.map +1 -1
  197. package/dist/core/retry-fallback/chains.js +3 -49
  198. package/dist/core/retry-fallback/chains.js.map +1 -1
  199. package/dist/core/retry-fallback/controller.d.ts.map +1 -1
  200. package/dist/core/retry-fallback/controller.js +4 -9
  201. package/dist/core/retry-fallback/controller.js.map +1 -1
  202. package/dist/core/retry-fallback/expansion.js +1 -1
  203. package/dist/core/retry-fallback/expansion.js.map +1 -1
  204. package/dist/core/retry-fallback/settings.d.ts +2 -4
  205. package/dist/core/retry-fallback/settings.d.ts.map +1 -1
  206. package/dist/core/retry-fallback/settings.js +7 -36
  207. package/dist/core/retry-fallback/settings.js.map +1 -1
  208. package/dist/core/sdk.d.ts.map +1 -1
  209. package/dist/core/sdk.js +6 -1
  210. package/dist/core/sdk.js.map +1 -1
  211. package/dist/core/session-manager.d.ts +12 -1
  212. package/dist/core/session-manager.d.ts.map +1 -1
  213. package/dist/core/session-manager.js +39 -6
  214. package/dist/core/session-manager.js.map +1 -1
  215. package/dist/core/session-sidecar-store.d.ts +62 -0
  216. package/dist/core/session-sidecar-store.d.ts.map +1 -0
  217. package/dist/core/session-sidecar-store.js +149 -0
  218. package/dist/core/session-sidecar-store.js.map +1 -0
  219. package/dist/core/settings-manager.d.ts +5 -1
  220. package/dist/core/settings-manager.d.ts.map +1 -1
  221. package/dist/core/settings-manager.js +45 -15
  222. package/dist/core/settings-manager.js.map +1 -1
  223. package/dist/core/skills.d.ts.map +1 -1
  224. package/dist/core/skills.js +19 -2
  225. package/dist/core/skills.js.map +1 -1
  226. package/dist/core/terminal-settings.d.ts +3 -0
  227. package/dist/core/terminal-settings.d.ts.map +1 -1
  228. package/dist/core/terminal-settings.js.map +1 -1
  229. package/dist/core/tools/bash.d.ts.map +1 -1
  230. package/dist/core/tools/bash.js +1 -1
  231. package/dist/core/tools/bash.js.map +1 -1
  232. package/dist/core/tools/edit.d.ts.map +1 -1
  233. package/dist/core/tools/edit.js +2 -2
  234. package/dist/core/tools/edit.js.map +1 -1
  235. package/dist/core/tools/find.d.ts.map +1 -1
  236. package/dist/core/tools/find.js +2 -2
  237. package/dist/core/tools/find.js.map +1 -1
  238. package/dist/core/tools/grep.d.ts.map +1 -1
  239. package/dist/core/tools/grep.js +2 -2
  240. package/dist/core/tools/grep.js.map +1 -1
  241. package/dist/core/tools/ls.d.ts.map +1 -1
  242. package/dist/core/tools/ls.js +2 -2
  243. package/dist/core/tools/ls.js.map +1 -1
  244. package/dist/core/tools/read.d.ts.map +1 -1
  245. package/dist/core/tools/read.js +1 -1
  246. package/dist/core/tools/read.js.map +1 -1
  247. package/dist/core/tools/write.d.ts.map +1 -1
  248. package/dist/core/tools/write.js +3 -3
  249. package/dist/core/tools/write.js.map +1 -1
  250. package/dist/index.d.ts +1 -1
  251. package/dist/index.d.ts.map +1 -1
  252. package/dist/index.js.map +1 -1
  253. package/dist/main.d.ts.map +1 -1
  254. package/dist/main.js +2 -0
  255. package/dist/main.js.map +1 -1
  256. package/dist/modes/app-server/daemon/process.d.ts +33 -3
  257. package/dist/modes/app-server/daemon/process.d.ts.map +1 -1
  258. package/dist/modes/app-server/daemon/process.js +57 -6
  259. package/dist/modes/app-server/daemon/process.js.map +1 -1
  260. package/dist/modes/app-server/daemon.js +9 -1
  261. package/dist/modes/app-server/daemon.js.map +1 -1
  262. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  263. package/dist/modes/interactive/components/scoped-models-selector.js +5 -11
  264. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  265. package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  266. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  267. package/dist/modes/interactive/components/settings-selector.js +21 -8
  268. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  269. package/dist/modes/interactive/components/thinking-selector.js +2 -2
  270. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  271. package/dist/modes/interactive/components/trust-selector.js +2 -2
  272. package/dist/modes/interactive/components/trust-selector.js.map +1 -1
  273. package/dist/modes/interactive/grok/welcome-card.d.ts.map +1 -1
  274. package/dist/modes/interactive/grok/welcome-card.js +5 -2
  275. package/dist/modes/interactive/grok/welcome-card.js.map +1 -1
  276. package/dist/modes/interactive/interactive-mode.d.ts +3 -0
  277. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  278. package/dist/modes/interactive/interactive-mode.js +86 -14
  279. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  280. package/dist/modes/interactive/version-label.d.ts +7 -0
  281. package/dist/modes/interactive/version-label.d.ts.map +1 -0
  282. package/dist/modes/interactive/version-label.js +9 -0
  283. package/dist/modes/interactive/version-label.js.map +1 -0
  284. package/dist/modes/rpc/host-ensure.d.ts +2 -0
  285. package/dist/modes/rpc/host-ensure.d.ts.map +1 -1
  286. package/dist/modes/rpc/host-ensure.js +77 -18
  287. package/dist/modes/rpc/host-ensure.js.map +1 -1
  288. package/dist/utils/version-check.d.ts.map +1 -1
  289. package/dist/utils/version-check.js +3 -4
  290. package/dist/utils/version-check.js.map +1 -1
  291. package/docs/compaction.md +2 -0
  292. package/docs/environment-variables.md +5 -0
  293. package/docs/extensions.md +22 -2
  294. package/docs/keybindings.md +1 -1
  295. package/docs/models.md +3 -0
  296. package/docs/quickstart.md +1 -1
  297. package/docs/rpc.md +1 -1
  298. package/docs/settings.md +13 -5
  299. package/docs/terminal-setup.md +27 -0
  300. package/docs/terminal-tools.md +35 -4
  301. package/docs/usage.md +5 -3
  302. package/node_modules/@anthropic-ai/sdk/CHANGELOG.md +96 -0
  303. package/node_modules/@anthropic-ai/sdk/README.md +1 -1
  304. package/node_modules/@anthropic-ai/sdk/core/credentials.d.mts.map +1 -1
  305. package/node_modules/@anthropic-ai/sdk/core/credentials.d.ts.map +1 -1
  306. package/node_modules/@anthropic-ai/sdk/core/credentials.js +5 -7
  307. package/node_modules/@anthropic-ai/sdk/core/credentials.js.map +1 -1
  308. package/node_modules/@anthropic-ai/sdk/core/credentials.mjs +5 -7
  309. package/node_modules/@anthropic-ai/sdk/core/credentials.mjs.map +1 -1
  310. package/node_modules/@anthropic-ai/sdk/core/middleware.d.mts.map +1 -1
  311. package/node_modules/@anthropic-ai/sdk/core/middleware.d.ts.map +1 -1
  312. package/node_modules/@anthropic-ai/sdk/core/middleware.js +4 -4
  313. package/node_modules/@anthropic-ai/sdk/core/middleware.js.map +1 -1
  314. package/node_modules/@anthropic-ai/sdk/core/middleware.mjs +4 -4
  315. package/node_modules/@anthropic-ai/sdk/core/middleware.mjs.map +1 -1
  316. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.mts +45 -0
  317. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.mts.map +1 -0
  318. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.ts +45 -0
  319. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.ts.map +1 -0
  320. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.js +58 -0
  321. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.js.map +1 -0
  322. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.mjs +54 -0
  323. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.mjs.map +1 -0
  324. package/node_modules/@anthropic-ai/sdk/internal/detect-platform.js +1 -1
  325. package/node_modules/@anthropic-ai/sdk/internal/detect-platform.js.map +1 -1
  326. package/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs +1 -1
  327. package/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs.map +1 -1
  328. package/node_modules/@anthropic-ai/sdk/internal/errors.d.mts.map +1 -1
  329. package/node_modules/@anthropic-ai/sdk/internal/errors.d.ts.map +1 -1
  330. package/node_modules/@anthropic-ai/sdk/internal/errors.js +3 -1
  331. package/node_modules/@anthropic-ai/sdk/internal/errors.js.map +1 -1
  332. package/node_modules/@anthropic-ai/sdk/internal/errors.mjs +3 -1
  333. package/node_modules/@anthropic-ai/sdk/internal/errors.mjs.map +1 -1
  334. package/node_modules/@anthropic-ai/sdk/internal/file-store.d.mts.map +1 -1
  335. package/node_modules/@anthropic-ai/sdk/internal/file-store.d.ts.map +1 -1
  336. package/node_modules/@anthropic-ai/sdk/internal/file-store.js +23 -25
  337. package/node_modules/@anthropic-ai/sdk/internal/file-store.js.map +1 -1
  338. package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs +5 -6
  339. package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs.map +1 -1
  340. package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.mts +9 -0
  341. package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.mts.map +1 -0
  342. package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.ts +9 -0
  343. package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.ts.map +1 -0
  344. package/node_modules/@anthropic-ai/sdk/internal/node.browser.js +22 -0
  345. package/node_modules/@anthropic-ai/sdk/internal/node.browser.js.map +1 -0
  346. package/node_modules/@anthropic-ai/sdk/internal/node.browser.mjs +19 -0
  347. package/node_modules/@anthropic-ai/sdk/internal/node.browser.mjs.map +1 -0
  348. package/node_modules/@anthropic-ai/sdk/internal/node.d.mts +14 -0
  349. package/node_modules/@anthropic-ai/sdk/internal/node.d.mts.map +1 -0
  350. package/node_modules/@anthropic-ai/sdk/internal/node.d.ts +14 -0
  351. package/node_modules/@anthropic-ai/sdk/internal/node.d.ts.map +1 -0
  352. package/node_modules/@anthropic-ai/sdk/internal/node.js +24 -0
  353. package/node_modules/@anthropic-ai/sdk/internal/node.js.map +1 -0
  354. package/node_modules/@anthropic-ai/sdk/internal/node.mjs +14 -0
  355. package/node_modules/@anthropic-ai/sdk/internal/node.mjs.map +1 -0
  356. package/node_modules/@anthropic-ai/sdk/internal/parse.js +1 -1
  357. package/node_modules/@anthropic-ai/sdk/internal/parse.js.map +1 -1
  358. package/node_modules/@anthropic-ai/sdk/internal/parse.mjs +1 -1
  359. package/node_modules/@anthropic-ai/sdk/internal/parse.mjs.map +1 -1
  360. package/node_modules/@anthropic-ai/sdk/internal/uploads.js +10 -6
  361. package/node_modules/@anthropic-ai/sdk/internal/uploads.js.map +1 -1
  362. package/node_modules/@anthropic-ai/sdk/internal/uploads.mjs +10 -6
  363. package/node_modules/@anthropic-ai/sdk/internal/uploads.mjs.map +1 -1
  364. package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.mts +6 -0
  365. package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.mts.map +1 -1
  366. package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.ts +6 -0
  367. package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.ts.map +1 -1
  368. package/node_modules/@anthropic-ai/sdk/internal/utils/values.js +7 -0
  369. package/node_modules/@anthropic-ai/sdk/internal/utils/values.js.map +1 -1
  370. package/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs +6 -0
  371. package/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs.map +1 -1
  372. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.mts.map +1 -1
  373. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.ts.map +1 -1
  374. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js +6 -4
  375. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js.map +1 -1
  376. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs +4 -2
  377. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs.map +1 -1
  378. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.mts.map +1 -1
  379. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts.map +1 -1
  380. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js +3 -4
  381. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js.map +1 -1
  382. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs +1 -2
  383. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs.map +1 -1
  384. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js +1 -1
  385. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js.map +1 -1
  386. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs +1 -1
  387. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs.map +1 -1
  388. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js +1 -1
  389. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js.map +1 -1
  390. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs +1 -1
  391. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs.map +1 -1
  392. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.mts.map +1 -1
  393. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.ts.map +1 -1
  394. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js +2 -3
  395. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js.map +1 -1
  396. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs +2 -3
  397. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs.map +1 -1
  398. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js +1 -1
  399. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js.map +1 -1
  400. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs +1 -1
  401. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs.map +1 -1
  402. package/node_modules/@anthropic-ai/sdk/lib/middleware.d.mts.map +1 -1
  403. package/node_modules/@anthropic-ai/sdk/lib/middleware.d.ts.map +1 -1
  404. package/node_modules/@anthropic-ai/sdk/lib/middleware.js +30 -7
  405. package/node_modules/@anthropic-ai/sdk/lib/middleware.js.map +1 -1
  406. package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs +30 -7
  407. package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs.map +1 -1
  408. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts +3 -2
  409. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts.map +1 -1
  410. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts +3 -2
  411. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts.map +1 -1
  412. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js +3 -46
  413. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js.map +1 -1
  414. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs +3 -46
  415. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs.map +1 -1
  416. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.mts +131 -0
  417. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.mts.map +1 -0
  418. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.ts +131 -0
  419. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.ts.map +1 -0
  420. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.js +45 -0
  421. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.js.map +1 -0
  422. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.mjs +41 -0
  423. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.mjs.map +1 -0
  424. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.mts.map +1 -1
  425. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.ts.map +1 -1
  426. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js +35 -6
  427. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js.map +1 -1
  428. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs +35 -6
  429. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs.map +1 -1
  430. package/node_modules/@anthropic-ai/sdk/package.json +4 -11
  431. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts +1 -1
  432. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts.map +1 -1
  433. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts +1 -1
  434. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts.map +1 -1
  435. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.js.map +1 -1
  436. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.mjs.map +1 -1
  437. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts +13 -9
  438. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts.map +1 -1
  439. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts +13 -9
  440. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts.map +1 -1
  441. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js +4 -0
  442. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js.map +1 -1
  443. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs +4 -0
  444. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs.map +1 -1
  445. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.mts +6 -6
  446. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.ts +6 -6
  447. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts +3 -2
  448. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts.map +1 -1
  449. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts +3 -2
  450. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts.map +1 -1
  451. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts +28 -1
  452. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts.map +1 -1
  453. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts +28 -1
  454. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts.map +1 -1
  455. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts +8 -1
  456. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts.map +1 -1
  457. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts +8 -1
  458. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts.map +1 -1
  459. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.js.map +1 -1
  460. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.mjs.map +1 -1
  461. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts +25 -5
  462. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts.map +1 -1
  463. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts +25 -5
  464. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts.map +1 -1
  465. package/node_modules/@anthropic-ai/sdk/resources/beta/files.js +6 -6
  466. package/node_modules/@anthropic-ai/sdk/resources/beta/files.js.map +1 -1
  467. package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs +7 -7
  468. package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs.map +1 -1
  469. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts +5 -4
  470. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts.map +1 -1
  471. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts +5 -4
  472. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts.map +1 -1
  473. package/node_modules/@anthropic-ai/sdk/resources/beta/index.js +11 -9
  474. package/node_modules/@anthropic-ai/sdk/resources/beta/index.js.map +1 -1
  475. package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs +1 -0
  476. package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs.map +1 -1
  477. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts +12 -9
  478. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts.map +1 -1
  479. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts +12 -9
  480. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts.map +1 -1
  481. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts +8 -5
  482. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
  483. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts +8 -5
  484. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
  485. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts +1 -1
  486. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts.map +1 -1
  487. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts +1 -1
  488. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts.map +1 -1
  489. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.js.map +1 -1
  490. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.mjs.map +1 -1
  491. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts +198 -29
  492. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts.map +1 -1
  493. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts +198 -29
  494. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts.map +1 -1
  495. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js.map +1 -1
  496. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs.map +1 -1
  497. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.mts +177 -0
  498. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.mts.map +1 -0
  499. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.ts +177 -0
  500. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.ts.map +1 -0
  501. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.js +56 -0
  502. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.js.map +1 -0
  503. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.mjs +52 -0
  504. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.mjs.map +1 -0
  505. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.mts +74 -0
  506. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.mts.map +1 -0
  507. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.ts +74 -0
  508. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.ts.map +1 -0
  509. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.js +52 -0
  510. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.js.map +1 -0
  511. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.mjs +48 -0
  512. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.mjs.map +1 -0
  513. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.mts +272 -0
  514. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.mts.map +1 -0
  515. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.ts +272 -0
  516. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.ts.map +1 -0
  517. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.js +119 -0
  518. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.js.map +1 -0
  519. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.mjs +115 -0
  520. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.mjs.map +1 -0
  521. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.mts +14 -0
  522. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.mts.map +1 -0
  523. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.ts +14 -0
  524. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.ts.map +1 -0
  525. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.js +21 -0
  526. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.js.map +1 -0
  527. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.mjs +16 -0
  528. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.mjs.map +1 -0
  529. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.mts +4 -0
  530. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.mts.map +1 -0
  531. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.ts +4 -0
  532. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.ts.map +1 -0
  533. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.js +11 -0
  534. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.js.map +1 -0
  535. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.mjs +5 -0
  536. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.mjs.map +1 -0
  537. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.mts +353 -0
  538. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.mts.map +1 -0
  539. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.ts +353 -0
  540. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.ts.map +1 -0
  541. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.js +169 -0
  542. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.js.map +1 -0
  543. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.mjs +165 -0
  544. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.mjs.map +1 -0
  545. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.mts +3 -0
  546. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.mts.map +1 -0
  547. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.ts +3 -0
  548. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.ts.map +1 -0
  549. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.js +9 -0
  550. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.js.map +1 -0
  551. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.mjs +4 -0
  552. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.mjs.map +1 -0
  553. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.mts +468 -0
  554. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.mts.map +1 -0
  555. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.ts +468 -0
  556. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.ts.map +1 -0
  557. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.js +198 -0
  558. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.js.map +1 -0
  559. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.mjs +193 -0
  560. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.mjs.map +1 -0
  561. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.mts +124 -0
  562. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.mts.map +1 -0
  563. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.ts +124 -0
  564. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.ts.map +1 -0
  565. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.js +114 -0
  566. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.js.map +1 -0
  567. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.mjs +110 -0
  568. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.mjs.map +1 -0
  569. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.mts +2 -0
  570. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.mts.map +1 -0
  571. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.ts +2 -0
  572. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.ts.map +1 -0
  573. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.js +6 -0
  574. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.js.map +1 -0
  575. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.mjs +3 -0
  576. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.mjs.map +1 -0
  577. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.mts +2 -0
  578. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.mts.map +1 -0
  579. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.ts +2 -0
  580. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.ts.map +1 -0
  581. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.js +6 -0
  582. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.js.map +1 -0
  583. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.mjs +3 -0
  584. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.mjs.map +1 -0
  585. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.mts +11 -0
  586. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.mts.map +1 -0
  587. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.ts +11 -0
  588. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.ts.map +1 -0
  589. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.js +25 -0
  590. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.js.map +1 -0
  591. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.mjs +12 -0
  592. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.mjs.map +1 -0
  593. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.mts +162 -0
  594. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.mts.map +1 -0
  595. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.ts +162 -0
  596. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.ts.map +1 -0
  597. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.js +76 -0
  598. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.js.map +1 -0
  599. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.mjs +72 -0
  600. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.mjs.map +1 -0
  601. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.mts +73 -0
  602. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.mts.map +1 -0
  603. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.ts +73 -0
  604. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.ts.map +1 -0
  605. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.js +62 -0
  606. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.js.map +1 -0
  607. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.mjs +57 -0
  608. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.mjs.map +1 -0
  609. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.mts +77 -0
  610. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.mts.map +1 -0
  611. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.ts +77 -0
  612. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.ts.map +1 -0
  613. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.js +31 -0
  614. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.js.map +1 -0
  615. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.mjs +27 -0
  616. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.mjs.map +1 -0
  617. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.mts +3 -0
  618. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.mts.map +1 -0
  619. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.ts +3 -0
  620. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.ts.map +1 -0
  621. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.js +9 -0
  622. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.js.map +1 -0
  623. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.mjs +4 -0
  624. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.mjs.map +1 -0
  625. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.mts +258 -0
  626. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.mts.map +1 -0
  627. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.ts +258 -0
  628. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.ts.map +1 -0
  629. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.js +174 -0
  630. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.js.map +1 -0
  631. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.mjs +169 -0
  632. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.mjs.map +1 -0
  633. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.mts +141 -0
  634. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.mts.map +1 -0
  635. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.ts +141 -0
  636. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.ts.map +1 -0
  637. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.js +125 -0
  638. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.js.map +1 -0
  639. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.mjs +121 -0
  640. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.mjs.map +1 -0
  641. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.mts +2 -0
  642. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.mts.map +1 -0
  643. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.ts +2 -0
  644. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.ts.map +1 -0
  645. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.js +6 -0
  646. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.js.map +1 -0
  647. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.mjs +3 -0
  648. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.mjs.map +1 -0
  649. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.mts +124 -0
  650. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.mts.map +1 -0
  651. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.ts +124 -0
  652. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.ts.map +1 -0
  653. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.js +67 -0
  654. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.js.map +1 -0
  655. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.mjs +63 -0
  656. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.mjs.map +1 -0
  657. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.mts +5 -0
  658. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.mts.map +1 -0
  659. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.ts +5 -0
  660. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.ts.map +1 -0
  661. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.js +13 -0
  662. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.js.map +1 -0
  663. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.mjs +6 -0
  664. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.mjs.map +1 -0
  665. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.mts +135 -0
  666. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.mts.map +1 -0
  667. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.ts +135 -0
  668. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.ts.map +1 -0
  669. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.js +102 -0
  670. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.js.map +1 -0
  671. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.mjs +98 -0
  672. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.mjs.map +1 -0
  673. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.mts +83 -0
  674. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.mts.map +1 -0
  675. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.ts +83 -0
  676. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.ts.map +1 -0
  677. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.js +34 -0
  678. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.js.map +1 -0
  679. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.mjs +30 -0
  680. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.mjs.map +1 -0
  681. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.mts +210 -0
  682. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.mts.map +1 -0
  683. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.ts +210 -0
  684. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.ts.map +1 -0
  685. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.js +189 -0
  686. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.js.map +1 -0
  687. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.mjs +185 -0
  688. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.mjs.map +1 -0
  689. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.mts +303 -0
  690. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.mts.map +1 -0
  691. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.ts +303 -0
  692. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.ts.map +1 -0
  693. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.js +112 -0
  694. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.js.map +1 -0
  695. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.mjs +107 -0
  696. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.mjs.map +1 -0
  697. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.mts +2 -0
  698. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.mts.map +1 -0
  699. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.ts +2 -0
  700. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.ts.map +1 -0
  701. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.js +6 -0
  702. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.js.map +1 -0
  703. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.mjs +3 -0
  704. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.mjs.map +1 -0
  705. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.mts +2 -0
  706. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.mts.map +1 -0
  707. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.ts +2 -0
  708. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.ts.map +1 -0
  709. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.js +6 -0
  710. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.js.map +1 -0
  711. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.mjs +3 -0
  712. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.mjs.map +1 -0
  713. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.mts +1 -1
  714. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.ts +1 -1
  715. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.mts +10 -10
  716. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.ts +10 -10
  717. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts +2 -1
  718. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts.map +1 -1
  719. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts +2 -1
  720. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts.map +1 -1
  721. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.js.map +1 -1
  722. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.mjs.map +1 -1
  723. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts +2 -2
  724. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts.map +1 -1
  725. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts +2 -2
  726. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts.map +1 -1
  727. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.js.map +1 -1
  728. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.mjs.map +1 -1
  729. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts +48 -120
  730. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts.map +1 -1
  731. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts +48 -120
  732. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts.map +1 -1
  733. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js +12 -8
  734. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js.map +1 -1
  735. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs +12 -8
  736. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs.map +1 -1
  737. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts +35 -138
  738. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts.map +1 -1
  739. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts +35 -138
  740. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts.map +1 -1
  741. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js +18 -18
  742. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js.map +1 -1
  743. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs +18 -18
  744. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs.map +1 -1
  745. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts +21 -25
  746. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts.map +1 -1
  747. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts +21 -25
  748. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts.map +1 -1
  749. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts +16 -17
  750. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts.map +1 -1
  751. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts +16 -17
  752. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts.map +1 -1
  753. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js +21 -8
  754. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js.map +1 -1
  755. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs +21 -8
  756. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs.map +1 -1
  757. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts +1 -3
  758. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts.map +1 -1
  759. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts +1 -3
  760. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts.map +1 -1
  761. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.js.map +1 -1
  762. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs.map +1 -1
  763. package/node_modules/@anthropic-ai/sdk/src/core/credentials.ts +5 -7
  764. package/node_modules/@anthropic-ai/sdk/src/core/middleware.ts +4 -3
  765. package/node_modules/@anthropic-ai/sdk/src/helpers/beta/standard-schema.ts +99 -0
  766. package/node_modules/@anthropic-ai/sdk/src/internal/detect-platform.ts +1 -1
  767. package/node_modules/@anthropic-ai/sdk/src/internal/errors.ts +3 -1
  768. package/node_modules/@anthropic-ai/sdk/src/internal/file-store.ts +11 -10
  769. package/node_modules/@anthropic-ai/sdk/src/internal/node.browser.ts +22 -0
  770. package/node_modules/@anthropic-ai/sdk/src/internal/node.ts +14 -0
  771. package/node_modules/@anthropic-ai/sdk/src/internal/parse.ts +1 -1
  772. package/node_modules/@anthropic-ai/sdk/src/internal/uploads.ts +10 -7
  773. package/node_modules/@anthropic-ai/sdk/src/internal/utils/values.ts +7 -0
  774. package/node_modules/@anthropic-ai/sdk/src/lib/BetaMessageStream.ts +5 -3
  775. package/node_modules/@anthropic-ai/sdk/src/lib/MessageStream.ts +1 -3
  776. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/credential-chain.ts +1 -1
  777. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/identity-token.ts +1 -1
  778. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/types.ts +2 -3
  779. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/user-oauth.ts +1 -1
  780. package/node_modules/@anthropic-ai/sdk/src/lib/middleware.ts +33 -9
  781. package/node_modules/@anthropic-ai/sdk/src/lib/sessions/accumulate.ts +7 -49
  782. package/node_modules/@anthropic-ai/sdk/src/lib/standard-schema.ts +209 -0
  783. package/node_modules/@anthropic-ai/sdk/src/lib/tools/BetaToolRunner.ts +38 -6
  784. package/node_modules/@anthropic-ai/sdk/src/resources/beta/agents/agents.ts +1 -0
  785. package/node_modules/@anthropic-ai/sdk/src/resources/beta/beta.ts +45 -15
  786. package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployment-runs.ts +6 -6
  787. package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployments.ts +3 -2
  788. package/node_modules/@anthropic-ai/sdk/src/resources/beta/dreams.ts +42 -0
  789. package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/environments.ts +8 -1
  790. package/node_modules/@anthropic-ai/sdk/src/resources/beta/files.ts +34 -11
  791. package/node_modules/@anthropic-ai/sdk/src/resources/beta/index.ts +13 -7
  792. package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memories.ts +12 -9
  793. package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memory-versions.ts +8 -5
  794. package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/index.ts +5 -1
  795. package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/messages.ts +221 -38
  796. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/api-keys.ts +231 -0
  797. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/compliance-settings.ts +96 -0
  798. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/external-keys.ts +365 -0
  799. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/federation.ts +71 -0
  800. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/index.ts +31 -0
  801. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/issuers.ts +486 -0
  802. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules/index.ts +23 -0
  803. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules/rules.ts +624 -0
  804. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules/workspaces.ts +196 -0
  805. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules.ts +3 -0
  806. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation.ts +3 -0
  807. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/index.ts +92 -0
  808. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/invites.ts +207 -0
  809. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/organization.ts +269 -0
  810. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/rate-limits.ts +104 -0
  811. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts/index.ts +21 -0
  812. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts/service-accounts.ts +389 -0
  813. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts/workspaces.ts +217 -0
  814. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts.ts +3 -0
  815. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/users.ts +163 -0
  816. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/index.ts +43 -0
  817. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/members.ts +209 -0
  818. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/rate-limits.ts +113 -0
  819. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/service-accounts.ts +325 -0
  820. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/workspaces.ts +450 -0
  821. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces.ts +3 -0
  822. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization.ts +3 -0
  823. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/events.ts +1 -1
  824. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/sessions.ts +10 -10
  825. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/threads.ts +2 -1
  826. package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/index.ts +7 -10
  827. package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/skills.ts +60 -150
  828. package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/versions.ts +43 -166
  829. package/node_modules/@anthropic-ai/sdk/src/resources/beta/user-profiles.ts +24 -27
  830. package/node_modules/@anthropic-ai/sdk/src/resources/beta/webhooks.ts +25 -29
  831. package/node_modules/@anthropic-ai/sdk/src/resources/messages/messages.ts +2 -8
  832. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/fs-util.ts +6 -5
  833. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/memories.ts +5 -3
  834. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.browser.ts +1 -5
  835. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.ts +122 -17
  836. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/skills.ts +10 -43
  837. package/node_modules/@anthropic-ai/sdk/src/version.ts +1 -1
  838. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.mts.map +1 -1
  839. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.ts.map +1 -1
  840. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js +13 -15
  841. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js.map +1 -1
  842. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs +3 -4
  843. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs.map +1 -1
  844. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.mts.map +1 -1
  845. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.ts.map +1 -1
  846. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js +6 -4
  847. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js.map +1 -1
  848. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs +5 -3
  849. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs.map +1 -1
  850. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts +1 -2
  851. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts.map +1 -1
  852. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts +1 -2
  853. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts.map +1 -1
  854. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js +0 -4
  855. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js.map +1 -1
  856. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs +0 -3
  857. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs.map +1 -1
  858. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts +11 -9
  859. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts.map +1 -1
  860. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts +11 -9
  861. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts.map +1 -1
  862. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js +96 -8
  863. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js.map +1 -1
  864. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs +96 -7
  865. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs.map +1 -1
  866. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts +0 -8
  867. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts.map +1 -1
  868. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts +0 -8
  869. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts.map +1 -1
  870. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js +20 -46
  871. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js.map +1 -1
  872. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs +9 -33
  873. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs.map +1 -1
  874. package/node_modules/@anthropic-ai/sdk/version.d.mts +1 -1
  875. package/node_modules/@anthropic-ai/sdk/version.d.ts +1 -1
  876. package/node_modules/@anthropic-ai/sdk/version.js +1 -1
  877. package/node_modules/@anthropic-ai/sdk/version.mjs +1 -1
  878. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +71 -0
  879. package/node_modules/@code-yeongyu/senpi-codemode/README.md +4 -2
  880. package/node_modules/@code-yeongyu/senpi-codemode/package.json +5 -5
  881. package/node_modules/@code-yeongyu/senpi-codemode/src/config/settings.ts +29 -0
  882. package/node_modules/@code-yeongyu/senpi-codemode/src/extension/session-manager.ts +8 -4
  883. package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +3 -1
  884. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/display-image.js +162 -0
  885. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/prelude.ts +2 -2
  886. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-runtime.js +29 -60
  887. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/prelude.py +66 -1
  888. package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +35 -96
  889. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-execution.ts +7 -0
  890. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool-options.ts +6 -0
  891. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +14 -2
  892. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +12 -7
  893. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  894. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +58 -64
  895. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  896. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
  897. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +3 -1
  898. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
  899. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
  900. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +17 -0
  901. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
  902. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
  903. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +1 -0
  904. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -1
  905. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
  906. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +17 -6
  907. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
  908. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +1 -1
  909. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -1
  910. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +6 -1
  911. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -1
  912. package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.d.ts.map +1 -1
  913. package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +6 -0
  914. package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js.map +1 -1
  915. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.d.ts +2 -1
  916. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.d.ts.map +1 -1
  917. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js +5 -1
  918. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js.map +1 -1
  919. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.d.ts.map +1 -1
  920. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js +1 -0
  921. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js.map +1 -1
  922. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts +7 -1
  923. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts.map +1 -1
  924. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js.map +1 -1
  925. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +1 -1
  926. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js.map +1 -1
  927. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +2 -0
  928. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -1
  929. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +40 -10
  930. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
  931. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +8 -2
  932. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  933. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  934. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  935. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts +1 -1
  936. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  937. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +130 -15
  938. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  939. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js +4 -4
  940. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -1
  941. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +3 -1
  942. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
  943. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts +1 -1
  944. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  945. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +3 -1
  946. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  947. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
  948. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +30 -10
  949. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
  950. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts +3 -3
  951. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
  952. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +15 -0
  953. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
  954. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts +1 -1
  955. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
  956. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +8 -5
  957. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  958. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +2 -0
  959. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts.map +1 -1
  960. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +6 -0
  961. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -1
  962. package/node_modules/@earendil-works/pi-ai/dist/api/warm-prompt-cache.js +1 -1
  963. package/node_modules/@earendil-works/pi-ai/dist/api/warm-prompt-cache.js.map +1 -1
  964. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +30 -0
  965. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
  966. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +30 -0
  967. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
  968. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
  969. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
  970. package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
  971. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
  972. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +3 -1
  973. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  974. package/node_modules/@earendil-works/pi-ai/dist/models.js +27 -3
  975. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  976. package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts +2 -0
  977. package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts.map +1 -1
  978. package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.js.map +1 -1
  979. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  980. package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
  981. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
  982. package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
  983. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  984. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  985. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  986. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
  987. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  988. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  989. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  990. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  991. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  992. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  993. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +2 -0
  994. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  995. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts +1 -1
  996. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts.map +1 -1
  997. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +8 -1
  998. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js.map +1 -1
  999. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +22 -2
  1000. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  1001. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  1002. package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.d.ts +23 -0
  1003. package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.d.ts.map +1 -0
  1004. package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.js +58 -0
  1005. package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.js.map +1 -0
  1006. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.d.ts.map +1 -1
  1007. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js +2 -0
  1008. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js.map +1 -1
  1009. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts.map +1 -1
  1010. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js +53 -12
  1011. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js.map +1 -1
  1012. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts +4 -2
  1013. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts.map +1 -1
  1014. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js +3 -0
  1015. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js.map +1 -1
  1016. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
  1017. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +3 -0
  1018. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
  1019. package/node_modules/@earendil-works/pi-ai/package.json +3 -3
  1020. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  1021. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  1022. package/node_modules/@earendil-works/pi-tui/README.md +1 -1
  1023. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +1 -0
  1024. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
  1025. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +36 -3
  1026. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
  1027. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +1 -1
  1028. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
  1029. package/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
  1030. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
  1031. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +2 -0
  1032. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  1033. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +106 -6
  1034. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  1035. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +6 -0
  1036. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  1037. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +17 -4
  1038. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  1039. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +11 -0
  1040. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
  1041. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +57 -15
  1042. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
  1043. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
  1044. package/node_modules/@earendil-works/pi-tui/dist/tui.js +22 -7
  1045. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
  1046. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  1047. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"tool-registration.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/goal/tool-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EAAE,sBAAsB,EAA8B,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACxG,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,yBAAyB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACzF,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAE/E,OAAO,EAAE,iCAAiC,EAAE,MAAM,YAAY,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAa/E,MAAM,UAAU,iBAAiB,CAAC,EAAgB,EAAE,IAA8B;IACjF,EAAE,CAAC,YAAY,CAAC;QACf,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,aAAa;QACpB,WAAW,EACV,uWAAuW;QACxW,UAAU,EAAE,IAAI,CAAC,MAAM,CACtB;YACC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC;gBACtB,WAAW,EACV,gKAAgK;aACjK,CAAC;SACF,EACD,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAC/B;QACD,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG;YACzD,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YACnC,MAAM,OAAO,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AO,QAAQ,CAAC,sBAAsB,CAAC,IAAI,CAAC,EAAE,qBAAqB,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5E,CAAC;QACD,UAAU,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAU,EAAE,IAAI,EAAE,KAAK,CAAC;QACxE,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,oBAAoB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;KACtF,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,OAA8B;IAC7D,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC;AAChE,CAAC","sourcesContent":["import { Type } from \"typebox\";\nimport type { AgentToolResult, ExtensionAPI, ExtensionContext } from \"../../types.ts\";\nimport { formatGoalToolResponse, type GoalToolRenderDetails, goalToolRenderDetails } from \"./format.ts\";\nimport { renderGoalToolCall, renderGoalToolResult } from \"./renderers.ts\";\nimport { createGoal, objectiveFullTextFileName, readGoal, updateGoal } from \"./store.ts\";\nimport { openTodoCompletionError, openTodoTaskContents } from \"./todo-gate.ts\";\nimport type { Goal, GoalAccountingMode, GoalStoreRef } from \"./types.ts\";\nimport { MODEL_SETTABLE_GOAL_STATUS_VALUES } from \"./types.ts\";\nimport { objectiveTruncationNotice, validateObjective } from \"./validation.ts\";\n\ntype GoalToolResult = AgentToolResult<GoalToolRenderDetails>;\n\nexport type GoalToolRegistrationDeps = {\n\treadonly goalStoreRef: (ctx: ExtensionContext) => GoalStoreRef;\n\treadonly accountCurrentAgentTurn: (ctx: ExtensionContext, mode: GoalAccountingMode) => Promise<Goal | null>;\n\treadonly beginAgentGoalAccounting: (goal: Goal) => void;\n\treadonly markGoalBlockedThisTurn: (goal: Goal) => void;\n\treadonly markGoalCompletedThisTurn: (goal: Goal) => void;\n\treadonly refreshGoalUi: (ctx: ExtensionContext, goal: Goal | null) => void;\n};\n\nexport function registerGoalTools(pi: ExtensionAPI, deps: GoalToolRegistrationDeps): void {\n\tpi.registerTool({\n\t\tname: \"create_goal\",\n\t\tlabel: \"Create Goal\",\n\t\tdescription:\n\t\t\t\"Create a goal only when explicitly requested by the user or system/developer instructions; do not infer goals from ordinary tasks.\\nObjectives are limited to 4,000 characters. For longer instructions, put the full objective in a file and refer to that file.\\nReplaces the current goal when it is complete and archives it; fails if an unfinished goal exists.\",\n\t\tparameters: Type.Object(\n\t\t\t{\n\t\t\t\tobjective: Type.String({\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Required. The concrete objective to start pursuing. Limit: 4,000 characters. For longer instructions, put the full objective in a file and refer to that file.\",\n\t\t\t\t}),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\tasync execute(_toolCallId, params, _signal, _onUpdate, ctx) {\n\t\t\tconst ref = deps.goalStoreRef(ctx);\n\t\t\tconst current = await readGoal(ref);\n\t\t\tif (current !== null && current.status !== \"complete\") {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"cannot create a new goal because this thread already has an unfinished goal; use update_goal only when the existing goal is complete\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst validatedObjective = validateObjective(params.objective, objectiveFullTextFileName(ref));\n\t\t\tconst goal = await createGoal(ref, params.objective);\n\t\t\tdeps.beginAgentGoalAccounting(goal);\n\t\t\tdeps.refreshGoalUi(ctx, goal);\n\t\t\tconst notice = validatedObjective.truncated\n\t\t\t\t? objectiveTruncationNotice(objectiveFullTextFileName(ref))\n\t\t\t\t: undefined;\n\t\t\treturn toolText(formatGoalToolResponse(goal, notice), goalToolRenderDetails(goal, notice));\n\t\t},\n\t\trenderCall: (args, theme) => renderGoalToolCall(\"create_goal\", args, theme),\n\t\trenderResult: (result, options, theme) => renderGoalToolResult(result, options, theme),\n\t});\n\n\tpi.registerTool({\n\t\tname: \"update_goal\",\n\t\tlabel: \"Update Goal\",\n\t\tdescription:\n\t\t\t\"Update the existing goal.\\nSet status to `complete` only when the completion audit proves the objective has actually been achieved and no required work remains. Completion is rejected while the todo list has open tasks: finish or drop them first. When the audit passes, call this tool in that same turn instead of repeating that the work is done. Do not mark a goal complete merely because you are stopping work.\\nSet status to `blocked` only at a true impasse: first confirm no live monitor, subscription, background task, or other resumption channel can still deliver the change the goal is waiting on (a wait on such a channel is not an impasse - end the turn and let it wake the goal instead of blocking), the blocking condition is unmistakably clear, and it has recurred for at least 3 consecutive goal turns. If the user resumes a blocked goal, start a fresh blocked audit after resume. Never mark a goal blocked merely because the work is hard, slow, or uncertain.\\nA non-empty reason is required when blocking; reason must not be provided when completing.\\nYou cannot use this tool to pause or resume a goal; those status changes are controlled by the user or system.\\nWhen marking the goal achieved with status `complete`, report the final elapsed time and token usage from the tool result to the user.\",\n\t\tparameters: Type.Object(\n\t\t\t{\n\t\t\t\tstatus: Type.Union(\n\t\t\t\t\tMODEL_SETTABLE_GOAL_STATUS_VALUES.map((status) => Type.Literal(status)),\n\t\t\t\t\t{ description: \"Required. Set to complete when achieved or blocked with a non-empty reason.\" },\n\t\t\t\t),\n\t\t\t\treason: Type.Optional(\n\t\t\t\t\tType.String({\n\t\t\t\t\t\tdescription: \"Required and non-empty when status is blocked; rejected when status is complete.\",\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\tasync execute(_toolCallId, params, _signal, _onUpdate, ctx) {\n\t\t\tconst reason = typeof params.reason === \"string\" ? params.reason.trim() : undefined;\n\t\t\tif (params.status === \"blocked\" && (reason === undefined || reason.length === 0)) {\n\t\t\t\tthrow new Error(\"reason is required when status is blocked\");\n\t\t\t}\n\t\t\tif (params.status === \"complete\" && reason !== undefined && reason.length > 0) {\n\t\t\t\tthrow new Error(\"reason must not be provided when status is complete\");\n\t\t\t}\n\t\t\tif (params.status === \"complete\") {\n\t\t\t\tconst openTasks = openTodoTaskContents(ctx.sessionManager.getBranch());\n\t\t\t\tif (openTasks.length > 0) throw new Error(openTodoCompletionError(openTasks));\n\t\t\t}\n\t\t\tawait deps.accountCurrentAgentTurn(ctx, \"active\");\n\t\t\tconst goal = await updateGoal(\n\t\t\t\tdeps.goalStoreRef(ctx),\n\t\t\t\tparams.status === \"blocked\" ? { status: \"blocked\", reason } : { status: \"complete\" },\n\t\t\t\t\"model\",\n\t\t\t);\n\t\t\tif (goal.status === \"blocked\") deps.markGoalBlockedThisTurn(goal);\n\t\t\telse deps.markGoalCompletedThisTurn(goal);\n\t\t\tdeps.refreshGoalUi(ctx, goal);\n\t\t\treturn toolText(formatGoalToolResponse(goal), goalToolRenderDetails(goal));\n\t\t},\n\t\trenderCall: (args, theme) => renderGoalToolCall(\"update_goal\", args, theme),\n\t\trenderResult: (result, options, theme) => renderGoalToolResult(result, options, theme),\n\t});\n\n\tpi.registerTool({\n\t\tname: \"get_goal\",\n\t\tlabel: \"Get Goal\",\n\t\tdescription: \"Get the current goal for this thread, including status, token and elapsed-time usage.\",\n\t\tparameters: Type.Object({}, { additionalProperties: false }),\n\t\tasync execute(_toolCallId, _params, _signal, _onUpdate, ctx) {\n\t\t\tconst goal = await deps.accountCurrentAgentTurn(ctx, \"active\");\n\t\t\tdeps.refreshGoalUi(ctx, goal);\n\t\t\treturn toolText(formatGoalToolResponse(goal), goalToolRenderDetails(goal));\n\t\t},\n\t\trenderCall: (args, theme) => renderGoalToolCall(\"get_goal\", args, theme),\n\t\trenderResult: (result, options, theme) => renderGoalToolResult(result, options, theme),\n\t});\n}\n\nfunction toolText(text: string, details: GoalToolRenderDetails): GoalToolResult {\n\treturn { content: [{ type: \"text\" as const, text }], details };\n}\n"]}
1
+ {"version":3,"file":"tool-registration.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/goal/tool-registration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,OAAO,EA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AAC,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,IAAY,EAAE,OAA8B;IAC7D,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC;AAChE,CAAC","sourcesContent":["import { Type } from \"typebox\";\nimport type { AgentToolResult, ExtensionAPI, ExtensionContext } from \"../../types.ts\";\nimport { formatGoalToolResponse, type GoalToolRenderDetails, goalToolRenderDetails } from \"./format.ts\";\nimport { renderGoalToolCall, renderGoalToolResult } from \"./renderers.ts\";\nimport { createGoal, objectiveFullTextFileName, readGoal, updateGoal } from \"./store.ts\";\nimport { openTodoCompletionError, openTodoTaskContents } from \"./todo-gate.ts\";\nimport type { Goal, GoalAccountingMode, GoalStoreRef } from \"./types.ts\";\nimport { MODEL_SETTABLE_GOAL_STATUS_VALUES } from \"./types.ts\";\nimport { objectiveTruncationNotice, validateObjective } from \"./validation.ts\";\n\ntype GoalToolResult = AgentToolResult<GoalToolRenderDetails>;\n\nexport type GoalToolRegistrationDeps = {\n\treadonly goalStoreRef: (ctx: ExtensionContext) => GoalStoreRef;\n\treadonly accountCurrentAgentTurn: (ctx: ExtensionContext, mode: GoalAccountingMode) => Promise<Goal | null>;\n\treadonly beginAgentGoalAccounting: (goal: Goal) => void;\n\treadonly markGoalBlockedThisTurn: (goal: Goal) => void;\n\treadonly markGoalCompletedThisTurn: (goal: Goal) => void;\n\treadonly refreshGoalUi: (ctx: ExtensionContext, goal: Goal | null) => void;\n};\n\nexport function registerGoalTools(pi: ExtensionAPI, deps: GoalToolRegistrationDeps): void {\n\tpi.registerTool({\n\t\tname: \"create_goal\",\n\t\tlabel: \"Create Goal\",\n\t\tdescription:\n\t\t\t\"Create a goal only when explicitly requested by the user or system/developer instructions; do not infer goals from ordinary tasks.\\nObjectives are limited to 4,000 characters. For longer instructions, put the full objective in a file and refer to that file.\\nReplaces the current goal when it is complete and archives it; fails if an unfinished goal exists.\",\n\t\tparameters: Type.Object(\n\t\t\t{\n\t\t\t\tobjective: Type.String({\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t\"Required. The concrete objective to start pursuing. Limit: 4,000 characters. For longer instructions, put the full objective in a file and refer to that file.\",\n\t\t\t\t}),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\tasync execute(_toolCallId, params, _signal, _onUpdate, ctx) {\n\t\t\tconst ref = deps.goalStoreRef(ctx);\n\t\t\tconst current = await readGoal(ref);\n\t\t\tif (current !== null && current.status !== \"complete\") {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"cannot create a new goal because this thread already has an unfinished goal; use update_goal only when the existing goal is complete\",\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst validatedObjective = validateObjective(params.objective, objectiveFullTextFileName(ref));\n\t\t\tconst goal = await createGoal(ref, params.objective);\n\t\t\tdeps.beginAgentGoalAccounting(goal);\n\t\t\tdeps.refreshGoalUi(ctx, goal);\n\t\t\tconst notice = validatedObjective.truncated\n\t\t\t\t? objectiveTruncationNotice(objectiveFullTextFileName(ref))\n\t\t\t\t: undefined;\n\t\t\treturn toolText(formatGoalToolResponse(goal, notice), goalToolRenderDetails(goal, notice));\n\t\t},\n\t\trenderCall: (args, theme) => renderGoalToolCall(\"create_goal\", args, theme),\n\t\trenderResult: (result, options, theme) => renderGoalToolResult(result, options, theme),\n\t});\n\n\tpi.registerTool({\n\t\tname: \"update_goal\",\n\t\tlabel: \"Update Goal\",\n\t\tdescription:\n\t\t\t\"Set the existing goal's status to `complete` or `blocked`; the completion audit and blocked audit in the goal continuation prompt decide which, and only a passing audit permits the call.\\n`complete` is rejected while todo tasks are open, and stopping work is never by itself a reason to complete; after it succeeds, report the final elapsed time and token usage from the result to the user.\\n`blocked` requires a non-empty `reason` (omit `reason` for `complete`); a user resume starts a fresh blocked audit.\\nPausing and resuming are user or system actions, not this tool.\",\n\t\tparameters: Type.Object(\n\t\t\t{\n\t\t\t\tstatus: Type.Union(\n\t\t\t\t\tMODEL_SETTABLE_GOAL_STATUS_VALUES.map((status) => Type.Literal(status)),\n\t\t\t\t\t{ description: \"Required. Set to complete when achieved or blocked with a non-empty reason.\" },\n\t\t\t\t),\n\t\t\t\treason: Type.Optional(\n\t\t\t\t\tType.String({\n\t\t\t\t\t\tdescription: \"Required and non-empty when status is blocked; rejected when status is complete.\",\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t},\n\t\t\t{ additionalProperties: false },\n\t\t),\n\t\tasync execute(_toolCallId, params, _signal, _onUpdate, ctx) {\n\t\t\tconst reason = typeof params.reason === \"string\" ? params.reason.trim() : undefined;\n\t\t\tif (params.status === \"blocked\" && (reason === undefined || reason.length === 0)) {\n\t\t\t\tthrow new Error(\"reason is required when status is blocked\");\n\t\t\t}\n\t\t\tif (params.status === \"complete\" && reason !== undefined && reason.length > 0) {\n\t\t\t\tthrow new Error(\"reason must not be provided when status is complete\");\n\t\t\t}\n\t\t\tif (params.status === \"complete\") {\n\t\t\t\tconst openTasks = openTodoTaskContents(ctx.sessionManager.getBranch());\n\t\t\t\tif (openTasks.length > 0) throw new Error(openTodoCompletionError(openTasks));\n\t\t\t}\n\t\t\tawait deps.accountCurrentAgentTurn(ctx, \"active\");\n\t\t\tconst goal = await updateGoal(\n\t\t\t\tdeps.goalStoreRef(ctx),\n\t\t\t\tparams.status === \"blocked\" ? { status: \"blocked\", reason } : { status: \"complete\" },\n\t\t\t\t\"model\",\n\t\t\t);\n\t\t\tif (goal.status === \"blocked\") deps.markGoalBlockedThisTurn(goal);\n\t\t\telse deps.markGoalCompletedThisTurn(goal);\n\t\t\tdeps.refreshGoalUi(ctx, goal);\n\t\t\treturn toolText(formatGoalToolResponse(goal), goalToolRenderDetails(goal));\n\t\t},\n\t\trenderCall: (args, theme) => renderGoalToolCall(\"update_goal\", args, theme),\n\t\trenderResult: (result, options, theme) => renderGoalToolResult(result, options, theme),\n\t});\n\n\tpi.registerTool({\n\t\tname: \"get_goal\",\n\t\tlabel: \"Get Goal\",\n\t\tdescription: \"Get the current goal for this thread, including status, token and elapsed-time usage.\",\n\t\tparameters: Type.Object({}, { additionalProperties: false }),\n\t\tasync execute(_toolCallId, _params, _signal, _onUpdate, ctx) {\n\t\t\tconst goal = await deps.accountCurrentAgentTurn(ctx, \"active\");\n\t\t\tdeps.refreshGoalUi(ctx, goal);\n\t\t\treturn toolText(formatGoalToolResponse(goal), goalToolRenderDetails(goal));\n\t\t},\n\t\trenderCall: (args, theme) => renderGoalToolCall(\"get_goal\", args, theme),\n\t\trenderResult: (result, options, theme) => renderGoalToolResult(result, options, theme),\n\t});\n}\n\nfunction toolText(text: string, details: GoalToolRenderDetails): GoalToolResult {\n\treturn { content: [{ type: \"text\" as const, text }], details };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"trust-storage.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/hooks/trust-storage.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,OAAO,KAAK,EAAkB,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAChC,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,cAAc,CAAC;IACnD,MAAM,CAAC,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,cAAc,GAAG,cAAc,CAAC;CAC3G;AAED,MAAM,MAAM,2BAA2B,GAAG;IACzC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;;GAKG;AACH,qBAAa,oBAAqB,YAAW,gBAAgB;IAC5D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;gBAE9B,OAAO,EAAE,2BAA2B;IAMhD,IAAI,CAAC,KAAK,E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AAE,CAAC,OAAO,EAAE,cAAc,KAAK,cAAc,GAAG,cAAc;CAyB1G;AAED,qBAAa,wBAAyB,YAAW,gBAAgB;IAChE,OAAO,CAAC,WAAW,CAAyC;IAC5D,OAAO,CAAC,YAAY,CAAyC;IAE7D,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,cAAc;IAIlD,MAAM,CAAC,KAAK,EAAE,qBAAqB,EAAE,OAAO,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,cAAc,GAAG,cAAc;CAS1G"}
@@ -27,7 +27,9 @@ export class FileHookStateStorage {
27
27
  release = acquireHookStateLockSync(path);
28
28
  }
29
29
  catch (error) {
30
- if (errorCode(error) === "ELOCKED") {
30
+ const code = errorCode(error);
31
+ // Sandboxed/read-only children cannot mkdir the lock dir; fail open on read.
32
+ if (code === "ELOCKED" || code === "EPERM" || code === "EACCES" || code === "EROFS") {
31
33
  return emptyHookTrustState();
32
34
  }
33
35
  throw error;
@@ -1 +1 @@
1
- {"version":3,"file":"trust-storage.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/hooks/trust-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAa7G;;;;;GAKG;AACH,MAAM,OAAO,oBAAoB;IAIhC,YAAY,OAAoC;QAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,Q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,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC/B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC7E,CAAC;AAED,SAAS,qBAAqB,CAAI,IAAY,EAAE,EAAuB;IACtE,MAAM,OAAO,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;IAC/C,OAAO,2BAA2B,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,2BAA2B,CAAI,OAAmB,EAAE,SAAkB;IAC9E,IAAI,MAAS,CAAC;IACd,IAAI,CAAC;QACJ,MAAM,GAAG,SAAS,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,cAAc,EAAE,CAAC;QACzB,IAAI,CAAC;YACJ,OAAO,EAAE,CAAC;QACX,CAAC;QAAC,OAAO,YAAY,EAAE,CAAC;YACvB,MAAM,IAAI,cAAc,CACvB,cAAc,YAAY,cAAc;gBACvC,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC;gBAC1C,CAAC,CAAC,CAAC,cAAc,EAAE,YAAY,CAAC,EACjC,mDAAmD,CACnD,CAAC;QACH,CAAC;QACD,MAAM,cAAc,CAAC;IACtB,CAAC;IACD,OAAO,EAAE,CAAC;IACV,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport lockfile from \"proper-lockfile\";\nimport { CONFIG_DIR_NAME, getAgentDir } from \"../../../../config.ts\";\nimport type { HookTrustStorageScope } from \"./trust.ts\";\nimport { emptyHookTrustState, parseHookTrustStateJson, readHookTrustStateJson } from \"./trust-state-json.ts\";\nimport type { HookTrustEntry, HookTrustState } from \"./types.ts\";\n\nexport interface HookStateStorage {\n\tread(scope: HookTrustStorageScope): HookTrustState;\n\tupdate(scope: HookTrustStorageScope, updater: (current: HookTrustState) => HookTrustState): HookTrustState;\n}\n\nexport type FileHookStateStorageOptions = {\n\treadonly agentDir?: string;\n\treadonly cwd: string;\n};\n\n/**\n * Internal same-account application state at `<agentDir>/hooks-state.json` and\n * `<cwd>/.senpi/hooks-state.json`. POSIX files retain their numeric mode and new\n * files use 0600; reassigned ownership, named ACLs, and custom DACLs are outside\n * this storage contract.\n */\nexport class FileHookStateStorage implements HookStateStorage {\n\tprivate readonly globalStatePath: string;\n\tprivate readonly projectStatePath: string;\n\n\tconstructor(options: FileHookStateStorageOptions) {\n\t\tconst agentDir = options.agentDir ?? getAgentDir();\n\t\tthis.globalStatePath = join(agentDir, \"hooks-state.json\");\n\t\tthis.projectStatePath = join(options.cwd, CONFIG_DIR_NAME, \"hooks-state.json\");\n\t}\n\n\tread(scope: HookTrustStorageScope): HookTrustState {\n\t\tconst path = statePathForScope(scope, this.globalStatePath, this.projectStatePath);\n\t\tconst snapshot = parseHookTrustStateJson(existsSync(path) ? readFileSync(path, \"utf-8\") : undefined);\n\t\tif (snapshot !== undefined) {\n\t\t\treturn snapshot;\n\t\t}\n\n\t\tlet release: () => void;\n\t\ttry {\n\t\t\trelease = acquireHookStateLockSync(path);\n\t\t} catch (error) {\n\t\t\tif (errorCode(error) === \"ELOCKED\") {\n\t\t\t\treturn emptyHookTrustState();\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\treturn runWithHookStateLockRelease(release, () =>\n\t\t\treadHookTrustStateJson(existsSync(path) ? readFileSync(path, \"utf-8\") : undefined),\n\t\t);\n\t}\n\n\tupdate(scope: HookTrustStorageScope, updater: (current: HookTrustState) => HookTrustState): HookTrustState {\n\t\treturn withHookStateFileLock(statePathForScope(scope, this.globalStatePath, this.projectStatePath), (path) => {\n\t\t\tconst stateExists = existsSync(path);\n\t\t\tconst current = readHookTrustStateJson(stateExists ? readFileSync(path, \"utf-8\") : undefined);\n\t\t\tconst mode = stateExists ? statSync(path).mode & 0o777 : 0o600;\n\t\t\tconst next = updater(current);\n\t\t\tconst tempPath = `${path}.${process.pid}.${randomUUID()}.tmp`;\n\t\t\ttry {\n\t\t\t\twriteFileSync(tempPath, serializeHookTrustState(next), { encoding: \"utf-8\", mode });\n\t\t\t\tchmodSync(tempPath, mode);\n\t\t\t\trenameSync(tempPath, path);\n\t\t\t} catch (publicationError) {\n\t\t\t\ttry {\n\t\t\t\t\trmSync(tempPath, { force: true });\n\t\t\t\t} catch (cleanupError) {\n\t\t\t\t\tthrow new AggregateError(\n\t\t\t\t\t\t[publicationError, cleanupError],\n\t\t\t\t\t\t\"Failed to publish and clean up hook trust state snapshot\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthrow publicationError;\n\t\t\t}\n\t\t\treturn next;\n\t\t});\n\t}\n}\n\nexport class InMemoryHookStateStorage implements HookStateStorage {\n\tprivate globalState: HookTrustState = emptyHookTrustState();\n\tprivate projectState: HookTrustState = emptyHookTrustState();\n\n\tread(scope: HookTrustStorageScope): HookTrustState {\n\t\treturn scope === \"global\" ? this.globalState : this.projectState;\n\t}\n\n\tupdate(scope: HookTrustStorageScope, updater: (current: HookTrustState) => HookTrustState): HookTrustState {\n\t\tconst next = updater(this.read(scope));\n\t\tif (scope === \"global\") {\n\t\t\tthis.globalState = next;\n\t\t} else {\n\t\t\tthis.projectState = next;\n\t\t}\n\t\treturn next;\n\t}\n}\n\nfunction statePathForScope(scope: HookTrustStorageScope, globalStatePath: string, projectStatePath: string): string {\n\treturn scope === \"global\" ? globalStatePath : projectStatePath;\n}\n\nfunction serializeHookTrustState(state: HookTrustState): string {\n\tconst sortedHooks: Record<string, HookTrustEntry> = {};\n\tfor (const key of Object.keys(state.hooks).sort()) {\n\t\tconst entry = state.hooks[key];\n\t\tif (entry !== undefined) {\n\t\t\tsortedHooks[key] = entry;\n\t\t}\n\t}\n\treturn `${JSON.stringify({ version: 1, hooks: sortedHooks }, null, 2)}\\n`;\n}\n\nfunction acquireHookStateLockSync(path: string): () => void {\n\tconst stateDir = dirname(path);\n\tmkdirSync(stateDir, { recursive: true });\n\tconst maxAttempts = 10;\n\tconst delayMs = 20;\n\tlet lastError: unknown;\n\n\tfor (let attempt = 1; attempt <= maxAttempts; attempt++) {\n\t\ttry {\n\t\t\treturn lockfile.lockSync(stateDir, { realpath: false, lockfilePath: `${path}.lock` });\n\t\t} catch (error) {\n\t\t\tconst code = errorCode(error);\n\t\t\tif (code !== \"ELOCKED\" || attempt === maxAttempts) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tlastError = error;\n\t\t\tconst start = Date.now();\n\t\t\twhile (Date.now() - start < delayMs) {\n\t\t\t\tDate.now();\n\t\t\t}\n\t\t}\n\t}\n\n\tif (lastError instanceof Error) {\n\t\tthrow lastError;\n\t}\n\tthrow new Error(\"Failed to acquire hook state lock\");\n}\n\nfunction errorCode(error: unknown): string | undefined {\n\tif (!isRecord(error)) {\n\t\treturn undefined;\n\t}\n\tconst code = error.code;\n\treturn typeof code === \"string\" ? code : undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction withHookStateFileLock<T>(path: string, fn: (path: string) => T): T {\n\tconst release = acquireHookStateLockSync(path);\n\treturn runWithHookStateLockRelease(release, () => fn(path));\n}\n\nfunction runWithHookStateLockRelease<T>(release: () => void, operation: () => T): T {\n\tlet result: T;\n\ttry {\n\t\tresult = operation();\n\t} catch (operationError) {\n\t\ttry {\n\t\t\trelease();\n\t\t} catch (releaseError) {\n\t\t\tthrow new AggregateError(\n\t\t\t\toperationError instanceof AggregateError\n\t\t\t\t\t? [...operationError.errors, releaseError]\n\t\t\t\t\t: [operationError, releaseError],\n\t\t\t\t\"Hook state operation and lock release both failed\",\n\t\t\t);\n\t\t}\n\t\tthrow operationError;\n\t}\n\trelease();\n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ACJ,MAAM,GAAG,SAAS,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,cAAc,EAAE,CAAC;QACzB,IAAI,CAAC;YACJ,OAAO,EAAE,CAAC;QACX,CAAC;QAAC,OAAO,YAAY,EAAE,CAAC;YACvB,MAAM,IAAI,cAAc,CACvB,cAAc,YAAY,cAAc;gBACvC,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC;gBAC1C,CAAC,CAAC,CAAC,cAAc,EAAE,YAAY,CAAC,EACjC,mDAAmD,CACnD,CAAC;QACH,CAAC;QACD,MAAM,cAAc,CAAC;IACtB,CAAC;IACD,OAAO,EAAE,CAAC;IACV,OAAO,MAAM,CAAC;AACf,CAAC","sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport { chmodSync, existsSync, mkdirSync, readFileSync, renameSync, rmSync, statSync, writeFileSync } from \"node:fs\";\nimport { dirname, join } from \"node:path\";\nimport lockfile from \"proper-lockfile\";\nimport { CONFIG_DIR_NAME, getAgentDir } from \"../../../../config.ts\";\nimport type { HookTrustStorageScope } from \"./trust.ts\";\nimport { emptyHookTrustState, parseHookTrustStateJson, readHookTrustStateJson } from \"./trust-state-json.ts\";\nimport type { HookTrustEntry, HookTrustState } from \"./types.ts\";\n\nexport interface HookStateStorage {\n\tread(scope: HookTrustStorageScope): HookTrustState;\n\tupdate(scope: HookTrustStorageScope, updater: (current: HookTrustState) => HookTrustState): HookTrustState;\n}\n\nexport type FileHookStateStorageOptions = {\n\treadonly agentDir?: string;\n\treadonly cwd: string;\n};\n\n/**\n * Internal same-account application state at `<agentDir>/hooks-state.json` and\n * `<cwd>/.senpi/hooks-state.json`. POSIX files retain their numeric mode and new\n * files use 0600; reassigned ownership, named ACLs, and custom DACLs are outside\n * this storage contract.\n */\nexport class FileHookStateStorage implements HookStateStorage {\n\tprivate readonly globalStatePath: string;\n\tprivate readonly projectStatePath: string;\n\n\tconstructor(options: FileHookStateStorageOptions) {\n\t\tconst agentDir = options.agentDir ?? getAgentDir();\n\t\tthis.globalStatePath = join(agentDir, \"hooks-state.json\");\n\t\tthis.projectStatePath = join(options.cwd, CONFIG_DIR_NAME, \"hooks-state.json\");\n\t}\n\n\tread(scope: HookTrustStorageScope): HookTrustState {\n\t\tconst path = statePathForScope(scope, this.globalStatePath, this.projectStatePath);\n\t\tconst snapshot = parseHookTrustStateJson(existsSync(path) ? readFileSync(path, \"utf-8\") : undefined);\n\t\tif (snapshot !== undefined) {\n\t\t\treturn snapshot;\n\t\t}\n\n\t\tlet release: () => void;\n\t\ttry {\n\t\t\trelease = acquireHookStateLockSync(path);\n\t\t} catch (error) {\n\t\t\tconst code = errorCode(error);\n\t\t\t// Sandboxed/read-only children cannot mkdir the lock dir; fail open on read.\n\t\t\tif (code === \"ELOCKED\" || code === \"EPERM\" || code === \"EACCES\" || code === \"EROFS\") {\n\t\t\t\treturn emptyHookTrustState();\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t\treturn runWithHookStateLockRelease(release, () =>\n\t\t\treadHookTrustStateJson(existsSync(path) ? readFileSync(path, \"utf-8\") : undefined),\n\t\t);\n\t}\n\n\tupdate(scope: HookTrustStorageScope, updater: (current: HookTrustState) => HookTrustState): HookTrustState {\n\t\treturn withHookStateFileLock(statePathForScope(scope, this.globalStatePath, this.projectStatePath), (path) => {\n\t\t\tconst stateExists = existsSync(path);\n\t\t\tconst current = readHookTrustStateJson(stateExists ? readFileSync(path, \"utf-8\") : undefined);\n\t\t\tconst mode = stateExists ? statSync(path).mode & 0o777 : 0o600;\n\t\t\tconst next = updater(current);\n\t\t\tconst tempPath = `${path}.${process.pid}.${randomUUID()}.tmp`;\n\t\t\ttry {\n\t\t\t\twriteFileSync(tempPath, serializeHookTrustState(next), { encoding: \"utf-8\", mode });\n\t\t\t\tchmodSync(tempPath, mode);\n\t\t\t\trenameSync(tempPath, path);\n\t\t\t} catch (publicationError) {\n\t\t\t\ttry {\n\t\t\t\t\trmSync(tempPath, { force: true });\n\t\t\t\t} catch (cleanupError) {\n\t\t\t\t\tthrow new AggregateError(\n\t\t\t\t\t\t[publicationError, cleanupError],\n\t\t\t\t\t\t\"Failed to publish and clean up hook trust state snapshot\",\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t\tthrow publicationError;\n\t\t\t}\n\t\t\treturn next;\n\t\t});\n\t}\n}\n\nexport class InMemoryHookStateStorage implements HookStateStorage {\n\tprivate globalState: HookTrustState = emptyHookTrustState();\n\tprivate projectState: HookTrustState = emptyHookTrustState();\n\n\tread(scope: HookTrustStorageScope): HookTrustState {\n\t\treturn scope === \"global\" ? this.globalState : this.projectState;\n\t}\n\n\tupdate(scope: HookTrustStorageScope, updater: (current: HookTrustState) => HookTrustState): HookTrustState {\n\t\tconst next = updater(this.read(scope));\n\t\tif (scope === \"global\") {\n\t\t\tthis.globalState = next;\n\t\t} else {\n\t\t\tthis.projectState = next;\n\t\t}\n\t\treturn next;\n\t}\n}\n\nfunction statePathForScope(scope: HookTrustStorageScope, globalStatePath: string, projectStatePath: string): string {\n\treturn scope === \"global\" ? globalStatePath : projectStatePath;\n}\n\nfunction serializeHookTrustState(state: HookTrustState): string {\n\tconst sortedHooks: Record<string, HookTrustEntry> = {};\n\tfor (const key of Object.keys(state.hooks).sort()) {\n\t\tconst entry = state.hooks[key];\n\t\tif (entry !== undefined) {\n\t\t\tsortedHooks[key] = entry;\n\t\t}\n\t}\n\treturn `${JSON.stringify({ version: 1, hooks: sortedHooks }, null, 2)}\\n`;\n}\n\nfunction acquireHookStateLockSync(path: string): () => void {\n\tconst stateDir = dirname(path);\n\tmkdirSync(stateDir, { recursive: true });\n\tconst maxAttempts = 10;\n\tconst delayMs = 20;\n\tlet lastError: unknown;\n\n\tfor (let attempt = 1; attempt <= maxAttempts; attempt++) {\n\t\ttry {\n\t\t\treturn lockfile.lockSync(stateDir, { realpath: false, lockfilePath: `${path}.lock` });\n\t\t} catch (error) {\n\t\t\tconst code = errorCode(error);\n\t\t\tif (code !== \"ELOCKED\" || attempt === maxAttempts) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tlastError = error;\n\t\t\tconst start = Date.now();\n\t\t\twhile (Date.now() - start < delayMs) {\n\t\t\t\tDate.now();\n\t\t\t}\n\t\t}\n\t}\n\n\tif (lastError instanceof Error) {\n\t\tthrow lastError;\n\t}\n\tthrow new Error(\"Failed to acquire hook state lock\");\n}\n\nfunction errorCode(error: unknown): string | undefined {\n\tif (!isRecord(error)) {\n\t\treturn undefined;\n\t}\n\tconst code = error.code;\n\treturn typeof code === \"string\" ? code : undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null && !Array.isArray(value);\n}\n\nfunction withHookStateFileLock<T>(path: string, fn: (path: string) => T): T {\n\tconst release = acquireHookStateLockSync(path);\n\treturn runWithHookStateLockRelease(release, () => fn(path));\n}\n\nfunction runWithHookStateLockRelease<T>(release: () => void, operation: () => T): T {\n\tlet result: T;\n\ttry {\n\t\tresult = operation();\n\t} catch (operationError) {\n\t\ttry {\n\t\t\trelease();\n\t\t} catch (releaseError) {\n\t\t\tthrow new AggregateError(\n\t\t\t\toperationError instanceof AggregateError\n\t\t\t\t\t? [...operationError.errors, releaseError]\n\t\t\t\t\t: [operationError, releaseError],\n\t\t\t\t\"Hook state operation and lock release both failed\",\n\t\t\t);\n\t\t}\n\t\tthrow operationError;\n\t}\n\trelease();\n\treturn result;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/imagegen/auth.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,0BAA0B,GACnC;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,CAAC,EAA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AC,0BAA0B,GAAG,SAAS,CAAC,CAAC;CACnF;AAED,MAAM,WAAW,uBAAuB,CAAC,MAAM,SAAS,iBAAiB,GAAG,iBAAiB;IAC5F,aAAa,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC5C,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;CACnD;AAED,MAAM,MAAM,sBAAsB,GAC/B;IACA,IAAI,EAAE,eAAe,GAAG,SAAS,CAAC;IAClC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,UAAU,EAAE,OAAO,GAAG,KAAK,GAAG,iBAAiB,CAAC;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;CACnB,GACD;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AA0HpC,wBAAsB,mBAAmB,CAAC,MAAM,SAAS,iBAAiB,EACzE,IAAI,EAAE,uBAAuB,CAAC,MAAM,CAAC,GACnC,OAAO,CAAC,sBAAsB,CAAC,CAoCjC"}
@@ -14,9 +14,17 @@ function resolvedHeaders(headers) {
14
14
  }
15
15
  return Object.keys(resolved).length > 0 ? resolved : undefined;
16
16
  }
17
+ /**
18
+ * Seeded placeholder keys (`SK-SENTINEL-DO-NOT-LOG-*`) are not credentials. Left unfiltered, such a
19
+ * value satisfies the stored-openai branch, pins `api.openai.com`, and every request 401s with
20
+ * `Incorrect API key provided: SK-SENTI***OG-2` while a working gateway sits unused.
21
+ */
22
+ function isPlaceholderKey(apiKey) {
23
+ return /^SK-SENTINEL-DO-NOT-LOG/i.test(apiKey);
24
+ }
17
25
  function credentialParts(auth) {
18
26
  const apiKey = nonEmpty(auth?.apiKey);
19
- if (!apiKey)
27
+ if (!apiKey || isPlaceholderKey(apiKey))
20
28
  return undefined;
21
29
  const headers = resolvedHeaders(auth?.headers);
22
30
  return { apiKey, ...(headers ? { headers } : {}) };
@@ -124,7 +132,7 @@ export async function resolveImageGenAuth(deps) {
124
132
  return gateway;
125
133
  }
126
134
  const envApiKey = nonEmpty(env.OPENAI_API_KEY);
127
- if (envApiKey) {
135
+ if (envApiKey && !isPlaceholderKey(envApiKey)) {
128
136
  return {
129
137
  kind: "native-openai",
130
138
  apiKey: envApiKey,
@@ -1 +1 @@
1
- {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/imagegen/auth.ts"],"names":[],"mappings":"AAgDA,MAAM,eAAe,GAAG,2BAA2B,CAAC;AACpD,MAAM,YAAY,GACjB,mNAAmN,CAAC;AAErN,SAAS,QAAQ,CAAC,KAAyB;IAC1C,MAAM,OAAO,GAAG,KAAK,EAAE,IAAI,EAAE,CAAC;IAC9B,OAAO,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AACtC,CAAC;AAED,SAAS,eAAe,CAAC,OAAkD;IAC1E,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAC/B,MAAM,QAAQ,GAA2B,EAAE,CAAC;IAC5C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACrD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;IAClF,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;AAChE,CAAC;AAED,SAAS,eAAe,CACvB,IAA8E;IAE9E,MAAM,MAAM,GAAG,QAAQ,C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C;YACrF,IAAI,MAAM;gBAAE,OAAO,MAAM,CAAC;QAC3B,CAAC;IACF,CAAC;IAED,MAAM,WAAW,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC;SACpC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,KAAK,cAAc,CAAC;SACrD,IAAI,CAAC,kBAAkB,CAAC,CAAC;IAC3B,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5E,IAAI,OAAO;YAAE,OAAO,OAAO,CAAC;IAC7B,CAAC;IAED,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC/C,IAAI,SAAS,EAAE,CAAC;QACf,OAAO;YACN,IAAI,EAAE,eAAe;YACrB,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,eAAe;YACxB,UAAU,EAAE,KAAK;SACjB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["export interface ImageGenAuthModel {\n\tprovider: string;\n\tid: string;\n\tbaseUrl: string;\n\tapi?: string;\n}\n\nexport type ImageGenRegistryAuthResult =\n\t| { ok: true; apiKey?: string; headers?: Record<string, string | null> }\n\t| { ok: false; error: string };\n\nexport interface ImageGenProviderAuthResult {\n\tauth: {\n\t\tapiKey?: string;\n\t\theaders?: Record<string, string | null>;\n\t};\n}\n\nexport interface ImageGenAuthRegistry<TModel extends ImageGenAuthModel = ImageGenAuthModel> {\n\tauthStorage: {\n\t\tget(provider: string): unknown;\n\t};\n\tgetAll(): TModel[];\n\tgetApiKeyAndHeaders(model: TModel): Promise<ImageGenRegistryAuthResult>;\n\tgetProviderAuth(provider: string): Promise<ImageGenProviderAuthResult | undefined>;\n}\n\nexport interface ResolveImageGenAuthDeps<TModel extends ImageGenAuthModel = ImageGenAuthModel> {\n\tmodelRegistry: ImageGenAuthRegistry<TModel>;\n\tenv?: Readonly<Record<string, string | undefined>>;\n}\n\nexport type ImageGenAuthResolution =\n\t| {\n\t\t\tkind: \"native-openai\" | \"gateway\";\n\t\t\tapiKey: string | undefined;\n\t\t\tbaseUrl: string;\n\t\t\theaders?: Record<string, string>;\n\t\t\tprovenance: \"store\" | \"env\" | \"provider-config\";\n\t\t\tproviderId?: string;\n\t }\n\t| { kind: \"none\"; reason: string };\n\ninterface CredentialParts {\n\tapiKey: string | undefined;\n\theaders?: Record<string, string>;\n}\n\nconst OPENAI_BASE_URL = \"https://api.openai.com/v1\";\nconst SETUP_REASON =\n\t'Image generation is not configured. Store an OpenAI API key for provider \"openai\", configure an OpenAI-compatible gateway in models.json and optionally pin it with PI_IMAGE_GEN_PROVIDER, or set OPENAI_API_KEY.';\n\nfunction nonEmpty(value: string | undefined): string | undefined {\n\tconst trimmed = value?.trim();\n\treturn trimmed ? trimmed : undefined;\n}\n\nfunction resolvedHeaders(headers: Record<string, string | null> | undefined): Record<string, string> | undefined {\n\tif (!headers) return undefined;\n\tconst resolved: Record<string, string> = {};\n\tfor (const [name, value] of Object.entries(headers)) {\n\t\tif (typeof value === \"string\" && value.trim().length > 0) resolved[name] = value;\n\t}\n\treturn Object.keys(resolved).length > 0 ? resolved : undefined;\n}\n\nfunction credentialParts(\n\tauth: { apiKey?: string; headers?: Record<string, string | null> } | undefined,\n): CredentialParts | undefined {\n\tconst apiKey = nonEmpty(auth?.apiKey);\n\tif (!apiKey) return undefined;\n\tconst headers = resolvedHeaders(auth?.headers);\n\treturn { apiKey, ...(headers ? { headers } : {}) };\n}\n\nfunction isStoredApiKey(value: unknown): boolean {\n\treturn typeof value === \"object\" && value !== null && \"type\" in value && value.type === \"api_key\";\n}\n\nfunction isGatewayApi(api: string | undefined): boolean {\n\treturn api === \"openai-completions\" || api === \"openai-responses\";\n}\n\nfunction compareText(left: string, right: string): number {\n\tif (left < right) return -1;\n\tif (left > right) return 1;\n\treturn 0;\n}\n\nfunction compareProviderIds(left: string, right: string): number {\n\tconst leftMatches = /openai/i.test(left);\n\tconst rightMatches = /openai/i.test(right);\n\tif (leftMatches !== rightMatches) return leftMatches ? -1 : 1;\n\treturn compareText(left, right);\n}\n\nfunction groupGatewayModels<TModel extends ImageGenAuthModel>(models: readonly TModel[]): Map<string, TModel> {\n\tconst groups = new Map<string, TModel>();\n\tconst ordered = [...models].sort(\n\t\t(left, right) => compareText(left.provider, right.provider) || compareText(left.id, right.id),\n\t);\n\tfor (const model of ordered) {\n\t\tif (model.provider === \"openai\" || !isGatewayApi(model.api) || !nonEmpty(model.baseUrl)) continue;\n\t\tif (!groups.has(model.provider)) groups.set(model.provider, model);\n\t}\n\treturn groups;\n}\n\nasync function resolveStoredOpenAi<TModel extends ImageGenAuthModel>(\n\tregistry: ImageGenAuthRegistry<TModel>,\n): Promise<ImageGenAuthResolution | undefined> {\n\tif (!isStoredApiKey(registry.authStorage.get(\"openai\"))) return undefined;\n\tlet resolved: ImageGenProviderAuthResult | undefined;\n\ttry {\n\t\tresolved = await registry.getProviderAuth(\"openai\");\n\t} catch {\n\t\treturn undefined;\n\t}\n\tconst credentials = credentialParts(resolved?.auth);\n\tif (!credentials) return undefined;\n\treturn {\n\t\tkind: \"native-openai\",\n\t\t...credentials,\n\t\tbaseUrl: OPENAI_BASE_URL,\n\t\tprovenance: \"store\",\n\t\tproviderId: \"openai\",\n\t};\n}\n\nasync function resolveGateway<TModel extends ImageGenAuthModel>(\n\tproviderId: string,\n\tmodel: TModel,\n\tregistry: ImageGenAuthRegistry<TModel>,\n): Promise<ImageGenAuthResolution | undefined> {\n\tconst baseUrl = nonEmpty(model.baseUrl);\n\tif (!baseUrl) return undefined;\n\tlet resolved: ImageGenRegistryAuthResult;\n\ttry {\n\t\tresolved = await registry.getApiKeyAndHeaders(model);\n\t} catch {\n\t\treturn undefined;\n\t}\n\tif (!resolved.ok) return undefined;\n\tconst credentials = credentialParts(resolved);\n\tif (!credentials) return undefined;\n\treturn {\n\t\tkind: \"gateway\",\n\t\t...credentials,\n\t\tbaseUrl,\n\t\tprovenance: \"provider-config\",\n\t\tproviderId,\n\t};\n}\n\nexport async function resolveImageGenAuth<TModel extends ImageGenAuthModel>(\n\tdeps: ResolveImageGenAuthDeps<TModel>,\n): Promise<ImageGenAuthResolution> {\n\tconst native = await resolveStoredOpenAi(deps.modelRegistry);\n\tif (native) return native;\n\n\tconst groups = groupGatewayModels(deps.modelRegistry.getAll());\n\tconst env = deps.env ?? process.env;\n\tconst pinnedProvider = nonEmpty(env.PI_IMAGE_GEN_PROVIDER);\n\tif (pinnedProvider) {\n\t\tconst pinnedModel = groups.get(pinnedProvider);\n\t\tif (pinnedModel) {\n\t\t\tconst pinned = await resolveGateway(pinnedProvider, pinnedModel, deps.modelRegistry);\n\t\t\tif (pinned) return pinned;\n\t\t}\n\t}\n\n\tconst providerIds = [...groups.keys()]\n\t\t.filter((providerId) => providerId !== pinnedProvider)\n\t\t.sort(compareProviderIds);\n\tfor (const providerId of providerIds) {\n\t\tconst model = groups.get(providerId);\n\t\tif (!model) continue;\n\t\tconst gateway = await resolveGateway(providerId, model, deps.modelRegistry);\n\t\tif (gateway) return gateway;\n\t}\n\n\tconst envApiKey = nonEmpty(env.OPENAI_API_KEY);\n\tif (envApiKey) {\n\t\treturn {\n\t\t\tkind: \"native-openai\",\n\t\t\tapiKey: envApiKey,\n\t\t\tbaseUrl: OPENAI_BASE_URL,\n\t\t\tprovenance: \"env\",\n\t\t};\n\t}\n\n\treturn { kind: \"none\", reason: SETUP_REASON };\n}\n"]}
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/imagegen/auth.ts"],"names":[],"mappings":"A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K,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACtC,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QACrC,IAAI,CAAC,KAAK;YAAE,SAAS;QACrB,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QAC5E,IAAI,OAAO;YAAE,OAAO,OAAO,CAAC;IAC7B,CAAC;IAED,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAC/C,IAAI,SAAS,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,CAAC;QAC/C,OAAO;YACN,IAAI,EAAE,eAAe;YACrB,MAAM,EAAE,SAAS;YACjB,OAAO,EAAE,eAAe;YACxB,UAAU,EAAE,KAAK;SACjB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["export interface ImageGenAuthModel {\n\tprovider: string;\n\tid: string;\n\tbaseUrl: string;\n\tapi?: string;\n}\n\nexport type ImageGenRegistryAuthResult =\n\t| { ok: true; apiKey?: string; headers?: Record<string, string | null> }\n\t| { ok: false; error: string };\n\nexport interface ImageGenProviderAuthResult {\n\tauth: {\n\t\tapiKey?: string;\n\t\theaders?: Record<string, string | null>;\n\t};\n}\n\nexport interface ImageGenAuthRegistry<TModel extends ImageGenAuthModel = ImageGenAuthModel> {\n\tauthStorage: {\n\t\tget(provider: string): unknown;\n\t};\n\tgetAll(): TModel[];\n\tgetApiKeyAndHeaders(model: TModel): Promise<ImageGenRegistryAuthResult>;\n\tgetProviderAuth(provider: string): Promise<ImageGenProviderAuthResult | undefined>;\n}\n\nexport interface ResolveImageGenAuthDeps<TModel extends ImageGenAuthModel = ImageGenAuthModel> {\n\tmodelRegistry: ImageGenAuthRegistry<TModel>;\n\tenv?: Readonly<Record<string, string | undefined>>;\n}\n\nexport type ImageGenAuthResolution =\n\t| {\n\t\t\tkind: \"native-openai\" | \"gateway\";\n\t\t\tapiKey: string | undefined;\n\t\t\tbaseUrl: string;\n\t\t\theaders?: Record<string, string>;\n\t\t\tprovenance: \"store\" | \"env\" | \"provider-config\";\n\t\t\tproviderId?: string;\n\t }\n\t| { kind: \"none\"; reason: string };\n\ninterface CredentialParts {\n\tapiKey: string | undefined;\n\theaders?: Record<string, string>;\n}\n\nconst OPENAI_BASE_URL = \"https://api.openai.com/v1\";\nconst SETUP_REASON =\n\t'Image generation is not configured. Store an OpenAI API key for provider \"openai\", configure an OpenAI-compatible gateway in models.json and optionally pin it with PI_IMAGE_GEN_PROVIDER, or set OPENAI_API_KEY.';\n\nfunction nonEmpty(value: string | undefined): string | undefined {\n\tconst trimmed = value?.trim();\n\treturn trimmed ? trimmed : undefined;\n}\n\nfunction resolvedHeaders(headers: Record<string, string | null> | undefined): Record<string, string> | undefined {\n\tif (!headers) return undefined;\n\tconst resolved: Record<string, string> = {};\n\tfor (const [name, value] of Object.entries(headers)) {\n\t\tif (typeof value === \"string\" && value.trim().length > 0) resolved[name] = value;\n\t}\n\treturn Object.keys(resolved).length > 0 ? resolved : undefined;\n}\n\n/**\n * Seeded placeholder keys (`SK-SENTINEL-DO-NOT-LOG-*`) are not credentials. Left unfiltered, such a\n * value satisfies the stored-openai branch, pins `api.openai.com`, and every request 401s with\n * `Incorrect API key provided: SK-SENTI***OG-2` while a working gateway sits unused.\n */\nfunction isPlaceholderKey(apiKey: string): boolean {\n\treturn /^SK-SENTINEL-DO-NOT-LOG/i.test(apiKey);\n}\n\nfunction credentialParts(\n\tauth: { apiKey?: string; headers?: Record<string, string | null> } | undefined,\n): CredentialParts | undefined {\n\tconst apiKey = nonEmpty(auth?.apiKey);\n\tif (!apiKey || isPlaceholderKey(apiKey)) return undefined;\n\tconst headers = resolvedHeaders(auth?.headers);\n\treturn { apiKey, ...(headers ? { headers } : {}) };\n}\n\nfunction isStoredApiKey(value: unknown): boolean {\n\treturn typeof value === \"object\" && value !== null && \"type\" in value && value.type === \"api_key\";\n}\n\nfunction isGatewayApi(api: string | undefined): boolean {\n\treturn api === \"openai-completions\" || api === \"openai-responses\";\n}\n\nfunction compareText(left: string, right: string): number {\n\tif (left < right) return -1;\n\tif (left > right) return 1;\n\treturn 0;\n}\n\nfunction compareProviderIds(left: string, right: string): number {\n\tconst leftMatches = /openai/i.test(left);\n\tconst rightMatches = /openai/i.test(right);\n\tif (leftMatches !== rightMatches) return leftMatches ? -1 : 1;\n\treturn compareText(left, right);\n}\n\nfunction groupGatewayModels<TModel extends ImageGenAuthModel>(models: readonly TModel[]): Map<string, TModel> {\n\tconst groups = new Map<string, TModel>();\n\tconst ordered = [...models].sort(\n\t\t(left, right) => compareText(left.provider, right.provider) || compareText(left.id, right.id),\n\t);\n\tfor (const model of ordered) {\n\t\tif (model.provider === \"openai\" || !isGatewayApi(model.api) || !nonEmpty(model.baseUrl)) continue;\n\t\tif (!groups.has(model.provider)) groups.set(model.provider, model);\n\t}\n\treturn groups;\n}\n\nasync function resolveStoredOpenAi<TModel extends ImageGenAuthModel>(\n\tregistry: ImageGenAuthRegistry<TModel>,\n): Promise<ImageGenAuthResolution | undefined> {\n\tif (!isStoredApiKey(registry.authStorage.get(\"openai\"))) return undefined;\n\tlet resolved: ImageGenProviderAuthResult | undefined;\n\ttry {\n\t\tresolved = await registry.getProviderAuth(\"openai\");\n\t} catch {\n\t\treturn undefined;\n\t}\n\tconst credentials = credentialParts(resolved?.auth);\n\tif (!credentials) return undefined;\n\treturn {\n\t\tkind: \"native-openai\",\n\t\t...credentials,\n\t\tbaseUrl: OPENAI_BASE_URL,\n\t\tprovenance: \"store\",\n\t\tproviderId: \"openai\",\n\t};\n}\n\nasync function resolveGateway<TModel extends ImageGenAuthModel>(\n\tproviderId: string,\n\tmodel: TModel,\n\tregistry: ImageGenAuthRegistry<TModel>,\n): Promise<ImageGenAuthResolution | undefined> {\n\tconst baseUrl = nonEmpty(model.baseUrl);\n\tif (!baseUrl) return undefined;\n\tlet resolved: ImageGenRegistryAuthResult;\n\ttry {\n\t\tresolved = await registry.getApiKeyAndHeaders(model);\n\t} catch {\n\t\treturn undefined;\n\t}\n\tif (!resolved.ok) return undefined;\n\tconst credentials = credentialParts(resolved);\n\tif (!credentials) return undefined;\n\treturn {\n\t\tkind: \"gateway\",\n\t\t...credentials,\n\t\tbaseUrl,\n\t\tprovenance: \"provider-config\",\n\t\tproviderId,\n\t};\n}\n\nexport async function resolveImageGenAuth<TModel extends ImageGenAuthModel>(\n\tdeps: ResolveImageGenAuthDeps<TModel>,\n): Promise<ImageGenAuthResolution> {\n\tconst native = await resolveStoredOpenAi(deps.modelRegistry);\n\tif (native) return native;\n\n\tconst groups = groupGatewayModels(deps.modelRegistry.getAll());\n\tconst env = deps.env ?? process.env;\n\tconst pinnedProvider = nonEmpty(env.PI_IMAGE_GEN_PROVIDER);\n\tif (pinnedProvider) {\n\t\tconst pinnedModel = groups.get(pinnedProvider);\n\t\tif (pinnedModel) {\n\t\t\tconst pinned = await resolveGateway(pinnedProvider, pinnedModel, deps.modelRegistry);\n\t\t\tif (pinned) return pinned;\n\t\t}\n\t}\n\n\tconst providerIds = [...groups.keys()]\n\t\t.filter((providerId) => providerId !== pinnedProvider)\n\t\t.sort(compareProviderIds);\n\tfor (const providerId of providerIds) {\n\t\tconst model = groups.get(providerId);\n\t\tif (!model) continue;\n\t\tconst gateway = await resolveGateway(providerId, model, deps.modelRegistry);\n\t\tif (gateway) return gateway;\n\t}\n\n\tconst envApiKey = nonEmpty(env.OPENAI_API_KEY);\n\tif (envApiKey && !isPlaceholderKey(envApiKey)) {\n\t\treturn {\n\t\t\tkind: \"native-openai\",\n\t\t\tapiKey: envApiKey,\n\t\t\tbaseUrl: OPENAI_BASE_URL,\n\t\t\tprovenance: \"env\",\n\t\t};\n\t}\n\n\treturn { kind: \"none\", reason: SETUP_REASON };\n}\n"]}
@@ -1 +1 @@
1
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,iBAAiB,CAAC,EAAE,CAAC,UAAU,EAAE,cAAc,KAAK,IAAI,CAAC;CAClE;AAED,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,iBAAiB,CAc/D,CAAC;AAEH;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,aAAa,CA6BnD;AAiFD,wBAAgB,mBAAmB,CAAC,IAAI,GAAE,iBAAsB,GAAG,gBAAgB,CAqmBlF;;AAOD,wBAAqC"}
@@ -28,7 +28,7 @@ import { createLoopScheduler, } from "./scheduler.js";
28
28
  import { formatLoopStatus, formatNoopFold, LoopStatusTicker } from "./status.js";
29
29
  import { readLoopState, writeLoopState } from "./store.js";
30
30
  import { buildTickMessage } from "./tick-prompt.js";
31
- import { registerLoopTools } from "./tools.js";
31
+ import { registerLoopTools, SCHEDULE_WAKEUP_TOOL } from "./tools.js";
32
32
  /** Custom entry type carrying one dispatched tick, used for attribution and folding. */
33
33
  export const LOOP_TICK_ENTRY_TYPE = "loop-tick";
34
34
  export const renderLoopTickEntry = noticeEntryRenderer((entry) => {
@@ -286,7 +286,23 @@ export function createLoopExtension(deps = {}) {
286
286
  ticker.dispose();
287
287
  ctx?.ui.notify(`/loop state could not be used and the affected loops were ended: ${message}`, "error");
288
288
  }
289
+ /**
290
+ * `schedule_wakeup` is search-exposed, so it is callable only while this extension keeps it
291
+ * active: exactly when a dynamic loop is live (not ended, not suspended). Idempotent, so
292
+ * every state transition can call it without churning the active tool list.
293
+ */
294
+ function syncScheduleWakeupActivation() {
295
+ if (scheduler === undefined)
296
+ return;
297
+ const wanted = Object.values(scheduler.getState().entries).some((entry) => entry.kind === "dynamic" && entry.phase !== "ended" && entry.phase !== "suspended");
298
+ const active = pi.getActiveTools();
299
+ const present = active.includes(SCHEDULE_WAKEUP_TOOL);
300
+ if (wanted === present)
301
+ return;
302
+ pi.setActiveTools(wanted ? [...active, SCHEDULE_WAKEUP_TOOL] : active.filter((name) => name !== SCHEDULE_WAKEUP_TOOL));
303
+ }
289
304
  function refreshStatus() {
305
+ syncScheduleWakeupActivation();
290
306
  if (scheduler === undefined)
291
307
  return;
292
308
  const state = scheduler.getState();
@@ -371,6 +387,9 @@ export function createLoopExtension(deps = {}) {
371
387
  attributedLoopId = entry.id;
372
388
  attributedDeliveryId = tick.deliveryId;
373
389
  attributionResolved = false;
390
+ // The tick prompt tells the model to call schedule_wakeup, so the tool must be active
391
+ // before the tick is queued, not after the turn has already read its tool list.
392
+ syncScheduleWakeupActivation();
374
393
  pi.sendUserMessage(built.text, {
375
394
  expandPromptTemplates: true,
376
395
  ...(busy ? { deliverAs: "followUp" } : {}),