@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
@@ -11,6 +11,8 @@ export { SessionRegistryCapacityError } from "@earendil-works/pi-pty";
11
11
  export class TerminalManager {
12
12
  constructor(options = {}) {
13
13
  this.runtimes = new Map();
14
+ /** Stable "mon_" identities bound to runtime session ids; survives PTY exit, then drops on session prune or teardown. */
15
+ this.monitorIds = new Map();
14
16
  this.exited = new Set();
15
17
  this.reservations = 0;
16
18
  this.maxSessions = options.maxSessions ?? DEFAULT_MAX_SESSIONS;
@@ -69,6 +71,20 @@ export class TerminalManager {
69
71
  return null;
70
72
  return this.runtimes.get(id) ?? null;
71
73
  }
74
+ /** Bind a stable "mon_" id to its runtime session id; a later restore re-binds the same id. */
75
+ bindMonitorId(monitorId, sessionId) {
76
+ this.monitorIds.set(monitorId, sessionId);
77
+ }
78
+ /**
79
+ * Resolve a "mon_" monitor id to its current runtime "bash_N" (or "watch_N"), passing a
80
+ * runtime id through unchanged; undefined when neither resolves. Bindings intentionally
81
+ * outlive PTY exit for a final output read, then drop when the session is pruned or torn down.
82
+ */
83
+ resolveId(idOrMonitorId) {
84
+ if (idOrMonitorId.startsWith("mon_"))
85
+ return this.monitorIds.get(idOrMonitorId);
86
+ return this.registry.get(idOrMonitorId) ? idOrMonitorId : undefined;
87
+ }
72
88
  list() {
73
89
  const result = [];
74
90
  for (const entry of this.registry.list()) {
@@ -91,6 +107,7 @@ export class TerminalManager {
91
107
  runtime.dispose();
92
108
  this.runtimes.clear();
93
109
  this.exited.clear();
110
+ this.monitorIds.clear();
94
111
  }
95
112
  /** Dispose runtime wrappers whose registry entry was pruned (capacity/LRU eviction). */
96
113
  reconcileRuntimes() {
@@ -101,6 +118,10 @@ export class TerminalManager {
101
118
  runtime.dispose();
102
119
  this.runtimes.delete(id);
103
120
  this.exited.delete(id);
121
+ for (const [monitorId, sessionId] of this.monitorIds) {
122
+ if (sessionId === id)
123
+ this.monitorIds.delete(monitorId);
124
+ }
104
125
  }
105
126
  }
106
127
  }
@@ -1 +1 @@
1
- {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,4BAA4B,GAG5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAA+B,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnD,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAYtE;;;;;GAKG;AACH,MAAM,OAAO,eAAe;IAQ3B,YAAY,UAAkC,EAAE;QAN/B,aAAQ,GAAG,IAAI,GAAG,EAAkC,CAAC;QAGrD,WAAM,GAAG,IAAI,GAAG,EAAU,CAAC;QACpC,iBAAY,GAAG,CAAC,CAAC;QAGxB,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,IAAI,oBAAoB,CAAC;QAC/D,IAAI,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAkB,EAAE,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QACxF,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,CAAC;IAED,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC3B,CAAC;IAED,IAAI,UAAU;QACb,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC;IAClE,CAAC;IAED,OAAO;QACN,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,G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AE;YAAE,OAAO,CAAC,OAAO,EAAE,CAAC;QAChE,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAED,wFAAwF;IAChF,iBAAiB;QACxB,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;QACvE,KAAK,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC3C,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;gBAAE,SAAS;YAC9B,OAAO,CAAC,OAAO,EAAE,CAAC;YAClB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACxB,CAAC;IACF,CAAC;CACD;AAED,MAAM,UAAU,eAAe,CAAC,KAAc;IAC7C,OAAO,KAAK,YAAY,4BAA4B,CAAC;AACtD,CAAC","sourcesContent":["import {\n\tSessionRegistry,\n\tSessionRegistryCapacityError,\n\ttype TerminalSession,\n\ttype TerminalSessionOptions,\n} from \"@earendil-works/pi-pty\";\nimport { type TerminalRuntimeOptions, TerminalRuntimeSession } from \"./runtime-session.ts\";\nimport { DEFAULT_MAX_SESSIONS } from \"./shared.ts\";\n\nexport { SessionRegistryCapacityError } from \"@earendil-works/pi-pty\";\n\nexport interface TerminalManagerOptions {\n\treadonly maxSessions?: number;\n\treadonly scrollback?: number;\n}\n\nexport interface CreatedTerminalSession {\n\treadonly id: string;\n\treadonly runtime: TerminalRuntimeSession;\n}\n\n/**\n * Owns the live terminal sessions for one agent session. Delegates id allocation,\n * capacity caps, LRU-exited pruning, and tree-kill teardown to the pi-pty\n * {@link SessionRegistry}, while keeping the richer {@link TerminalRuntimeSession}\n * wrappers (screen model + output buffer) in lock-step.\n */\nexport class TerminalManager {\n\tprivate readonly registry: SessionRegistry<TerminalSession>;\n\tprivate readonly runtimes = new Map<string, TerminalRuntimeSession>();\n\tprivate readonly scrollback?: number;\n\tprivate readonly maxSessions: number;\n\tprivate readonly exited = new Set<string>();\n\tprivate reservations = 0;\n\n\tconstructor(options: TerminalManagerOptions = {}) {\n\t\tthis.maxSessions = options.maxSessions ?? DEFAULT_MAX_SESSIONS;\n\t\tthis.registry = new SessionRegistry<TerminalSession>({ maxSessions: this.maxSessions });\n\t\tthis.scrollback = options.scrollback;\n\t}\n\n\tget size(): number {\n\t\treturn this.runtimes.size;\n\t}\n\n\tget activeSize(): number {\n\t\tthis.reconcileRuntimes();\n\t\treturn this.runtimes.size - this.exited.size + this.reservations;\n\t}\n\n\treserve(): (() => void) | null {\n\t\tthis.reconcileRuntimes();\n\t\tif (this.runtimes.size - this.exited.size + this.reservations >= this.maxSessions) return null;\n\t\tthis.reservations += 1;\n\t\tlet released = false;\n\t\treturn () => {\n\t\t\tif (released) return;\n\t\t\treleased = true;\n\t\t\tthis.reservations -= 1;\n\t\t};\n\t}\n\n\t/** Spawn a new terminal session and register it under an allocated `bash_N` id. */\n\tasync create(command: string, options: TerminalSessionOptions): Promise<CreatedTerminalSession> {\n\t\tconst release = this.reserve();\n\t\tif (!release) throw new SessionRegistryCapacityError(this.maxSessions);\n\t\tconst runtimeOptions: TerminalRuntimeOptions = { ...options, scrollback: this.scrollback };\n\t\tconst runtime = new TerminalRuntimeSession(command, runtimeOptions);\n\t\tlet entry: { id: string };\n\t\ttry {\n\t\t\tentry = await this.registry.create({ command, session: runtime.session });\n\t\t} catch (error) {\n\t\t\trelease();\n\t\t\truntime.dispose();\n\t\t\truntime.session.kill();\n\t\t\tthrow error;\n\t\t}\n\t\tthis.runtimes.set(entry.id, runtime);\n\t\truntime.session.onExit(() => {\n\t\t\tthis.exited.add(entry.id);\n\t\t});\n\t\trelease();\n\t\tthis.reconcileRuntimes();\n\t\treturn { id: entry.id, runtime };\n\t}\n\n\t/** Look up a live-or-exited session, refreshing its LRU timestamp. */\n\tget(id: string): TerminalRuntimeSession | null {\n\t\tconst entry = this.registry.get(id);\n\t\tif (!entry) return null;\n\t\treturn this.runtimes.get(id) ?? null;\n\t}\n\n\tlist(): { id: string; runtime: TerminalRuntimeSession }[] {\n\t\tconst result: { id: string; runtime: TerminalRuntimeSession }[] = [];\n\t\tfor (const entry of this.registry.list()) {\n\t\t\tconst runtime = this.runtimes.get(entry.id);\n\t\t\tif (runtime) result.push({ id: entry.id, runtime });\n\t\t}\n\t\treturn result;\n\t}\n\n\t/** Tree-kill one session; the exited entry is kept for a final output read until swept. */\n\tasync stop(id: string): Promise<boolean> {\n\t\tconst stopped = await this.registry.stop(id);\n\t\tthis.reconcileRuntimes();\n\t\treturn stopped;\n\t}\n\n\t/** Tree-kill every session and dispose all runtime wrappers. */\n\tasync teardown(): Promise<void> {\n\t\tawait this.registry.teardown();\n\t\tfor (const runtime of this.runtimes.values()) runtime.dispose();\n\t\tthis.runtimes.clear();\n\t\tthis.exited.clear();\n\t}\n\n\t/** Dispose runtime wrappers whose registry entry was pruned (capacity/LRU eviction). */\n\tprivate reconcileRuntimes(): void {\n\t\tconst liveIds = new Set(this.registry.list().map((entry) => entry.id));\n\t\tfor (const [id, runtime] of this.runtimes) {\n\t\t\tif (liveIds.has(id)) continue;\n\t\t\truntime.dispose();\n\t\t\tthis.runtimes.delete(id);\n\t\t\tthis.exited.delete(id);\n\t\t}\n\t}\n}\n\nexport function isCapacityError(error: unknown): error is SessionRegistryCapacityError {\n\treturn error instanceof SessionRegistryCapacityError;\n}\n"]}
1
+ {"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/manager.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,4BAA4B,GAG5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAA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ype TerminalSessionOptions,\n} from \"@earendil-works/pi-pty\";\nimport { type TerminalRuntimeOptions, TerminalRuntimeSession } from \"./runtime-session.ts\";\nimport { DEFAULT_MAX_SESSIONS } from \"./shared.ts\";\n\nexport { SessionRegistryCapacityError } from \"@earendil-works/pi-pty\";\n\nexport interface TerminalManagerOptions {\n\treadonly maxSessions?: number;\n\treadonly scrollback?: number;\n}\n\nexport interface CreatedTerminalSession {\n\treadonly id: string;\n\treadonly runtime: TerminalRuntimeSession;\n}\n\n/**\n * Owns the live terminal sessions for one agent session. Delegates id allocation,\n * capacity caps, LRU-exited pruning, and tree-kill teardown to the pi-pty\n * {@link SessionRegistry}, while keeping the richer {@link TerminalRuntimeSession}\n * wrappers (screen model + output buffer) in lock-step.\n */\nexport class TerminalManager {\n\tprivate readonly registry: SessionRegistry<TerminalSession>;\n\tprivate readonly runtimes = new Map<string, TerminalRuntimeSession>();\n\t/** Stable \"mon_\" identities bound to runtime session ids; survives PTY exit, then drops on session prune or teardown. */\n\tprivate readonly monitorIds = new Map<string, string>();\n\tprivate readonly scrollback?: number;\n\tprivate readonly maxSessions: number;\n\tprivate readonly exited = new Set<string>();\n\tprivate reservations = 0;\n\n\tconstructor(options: TerminalManagerOptions = {}) {\n\t\tthis.maxSessions = options.maxSessions ?? DEFAULT_MAX_SESSIONS;\n\t\tthis.registry = new SessionRegistry<TerminalSession>({ maxSessions: this.maxSessions });\n\t\tthis.scrollback = options.scrollback;\n\t}\n\n\tget size(): number {\n\t\treturn this.runtimes.size;\n\t}\n\n\tget activeSize(): number {\n\t\tthis.reconcileRuntimes();\n\t\treturn this.runtimes.size - this.exited.size + this.reservations;\n\t}\n\n\treserve(): (() => void) | null {\n\t\tthis.reconcileRuntimes();\n\t\tif (this.runtimes.size - this.exited.size + this.reservations >= this.maxSessions) return null;\n\t\tthis.reservations += 1;\n\t\tlet released = false;\n\t\treturn () => {\n\t\t\tif (released) return;\n\t\t\treleased = true;\n\t\t\tthis.reservations -= 1;\n\t\t};\n\t}\n\n\t/** Spawn a new terminal session and register it under an allocated `bash_N` id. */\n\tasync create(command: string, options: TerminalSessionOptions): Promise<CreatedTerminalSession> {\n\t\tconst release = this.reserve();\n\t\tif (!release) throw new SessionRegistryCapacityError(this.maxSessions);\n\t\tconst runtimeOptions: TerminalRuntimeOptions = { ...options, scrollback: this.scrollback };\n\t\tconst runtime = new TerminalRuntimeSession(command, runtimeOptions);\n\t\tlet entry: { id: string };\n\t\ttry {\n\t\t\tentry = await this.registry.create({ command, session: runtime.session });\n\t\t} catch (error) {\n\t\t\trelease();\n\t\t\truntime.dispose();\n\t\t\truntime.session.kill();\n\t\t\tthrow error;\n\t\t}\n\t\tthis.runtimes.set(entry.id, runtime);\n\t\truntime.session.onExit(() => {\n\t\t\tthis.exited.add(entry.id);\n\t\t});\n\t\trelease();\n\t\tthis.reconcileRuntimes();\n\t\treturn { id: entry.id, runtime };\n\t}\n\n\t/** Look up a live-or-exited session, refreshing its LRU timestamp. */\n\tget(id: string): TerminalRuntimeSession | null {\n\t\tconst entry = this.registry.get(id);\n\t\tif (!entry) return null;\n\t\treturn this.runtimes.get(id) ?? null;\n\t}\n\n\t/** Bind a stable \"mon_\" id to its runtime session id; a later restore re-binds the same id. */\n\tbindMonitorId(monitorId: string, sessionId: string): void {\n\t\tthis.monitorIds.set(monitorId, sessionId);\n\t}\n\n\t/**\n\t * Resolve a \"mon_\" monitor id to its current runtime \"bash_N\" (or \"watch_N\"), passing a\n\t * runtime id through unchanged; undefined when neither resolves. Bindings intentionally\n\t * outlive PTY exit for a final output read, then drop when the session is pruned or torn down.\n\t */\n\tresolveId(idOrMonitorId: string): string | undefined {\n\t\tif (idOrMonitorId.startsWith(\"mon_\")) return this.monitorIds.get(idOrMonitorId);\n\t\treturn this.registry.get(idOrMonitorId) ? idOrMonitorId : undefined;\n\t}\n\n\tlist(): { id: string; runtime: TerminalRuntimeSession }[] {\n\t\tconst result: { id: string; runtime: TerminalRuntimeSession }[] = [];\n\t\tfor (const entry of this.registry.list()) {\n\t\t\tconst runtime = this.runtimes.get(entry.id);\n\t\t\tif (runtime) result.push({ id: entry.id, runtime });\n\t\t}\n\t\treturn result;\n\t}\n\n\t/** Tree-kill one session; the exited entry is kept for a final output read until swept. */\n\tasync stop(id: string): Promise<boolean> {\n\t\tconst stopped = await this.registry.stop(id);\n\t\tthis.reconcileRuntimes();\n\t\treturn stopped;\n\t}\n\n\t/** Tree-kill every session and dispose all runtime wrappers. */\n\tasync teardown(): Promise<void> {\n\t\tawait this.registry.teardown();\n\t\tfor (const runtime of this.runtimes.values()) runtime.dispose();\n\t\tthis.runtimes.clear();\n\t\tthis.exited.clear();\n\t\tthis.monitorIds.clear();\n\t}\n\n\t/** Dispose runtime wrappers whose registry entry was pruned (capacity/LRU eviction). */\n\tprivate reconcileRuntimes(): void {\n\t\tconst liveIds = new Set(this.registry.list().map((entry) => entry.id));\n\t\tfor (const [id, runtime] of this.runtimes) {\n\t\t\tif (liveIds.has(id)) continue;\n\t\t\truntime.dispose();\n\t\t\tthis.runtimes.delete(id);\n\t\t\tthis.exited.delete(id);\n\t\t\tfor (const [monitorId, sessionId] of this.monitorIds) {\n\t\t\t\tif (sessionId === id) this.monitorIds.delete(monitorId);\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function isCapacityError(error: unknown): error is SessionRegistryCapacityError {\n\treturn error instanceof SessionRegistryCapacityError;\n}\n"]}
@@ -0,0 +1,24 @@
1
+ export type AcquireTerminalLeaseOptions = {
2
+ dir: string;
3
+ encodedSessionId: string;
4
+ pid?: number;
5
+ now?: () => number;
6
+ isProcessAlive?: (pid: number) => boolean;
7
+ };
8
+ export type AcquireTerminalLeaseResult = {
9
+ acquired: true;
10
+ path: string;
11
+ pid: number;
12
+ } | {
13
+ acquired: false;
14
+ holder: {
15
+ pid: number;
16
+ startedAtMs: number;
17
+ };
18
+ };
19
+ export declare function acquireTerminalLease(options: AcquireTerminalLeaseOptions): Promise<AcquireTerminalLeaseResult>;
20
+ export declare function releaseTerminalLease(handle: {
21
+ path: string;
22
+ pid: number;
23
+ }): Promise<void>;
24
+ //# sourceMappingURL=manifest-lease.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-lease.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/manifest-lease.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,2BAA2B,GAAG;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,0BAA0B,GACnC;IAAE,QAAQ,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC;AA2FrE,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAMpH;AAED,wBAAsB,oBAAoB,CAAC,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAK/F"}
@@ -0,0 +1,105 @@
1
+ import { mkdir, open, readFile, unlink } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ function errorCode(error) {
4
+ if (typeof error === "object" && error !== null && "code" in error && typeof error.code === "string") {
5
+ return error.code;
6
+ }
7
+ return undefined;
8
+ }
9
+ function probeAlive(pid, probe) {
10
+ try {
11
+ if (probe)
12
+ return probe(pid);
13
+ process.kill(pid, 0);
14
+ return true;
15
+ }
16
+ catch (error) {
17
+ const code = errorCode(error);
18
+ if (code === "EPERM")
19
+ return true;
20
+ if (code === "ESRCH")
21
+ return false;
22
+ throw error;
23
+ }
24
+ }
25
+ async function readLease(path) {
26
+ let raw;
27
+ try {
28
+ raw = await readFile(path, "utf8");
29
+ }
30
+ catch (error) {
31
+ if (errorCode(error) === "ENOENT")
32
+ return "missing";
33
+ throw error;
34
+ }
35
+ try {
36
+ const parsed = JSON.parse(raw);
37
+ if (typeof parsed !== "object" || parsed === null)
38
+ return "unparseable";
39
+ const pid = parsed.pid;
40
+ const startedAtMs = parsed.startedAtMs;
41
+ if (typeof pid !== "number" ||
42
+ !Number.isFinite(pid) ||
43
+ typeof startedAtMs !== "number" ||
44
+ !Number.isFinite(startedAtMs)) {
45
+ return "unparseable";
46
+ }
47
+ return { pid, startedAtMs };
48
+ }
49
+ catch {
50
+ return "unparseable";
51
+ }
52
+ }
53
+ async function exclusiveCreate(path, record) {
54
+ const file = await open(path, "wx");
55
+ try {
56
+ await file.writeFile(JSON.stringify(record), "utf8");
57
+ }
58
+ finally {
59
+ await file.close();
60
+ }
61
+ }
62
+ async function unlinkIfPresent(path) {
63
+ try {
64
+ await unlink(path);
65
+ }
66
+ catch (error) {
67
+ if (errorCode(error) !== "ENOENT")
68
+ throw error;
69
+ }
70
+ }
71
+ async function tryAcquire(path, record, isProcessAlive, retry) {
72
+ try {
73
+ await exclusiveCreate(path, record);
74
+ return { acquired: true, path, pid: record.pid };
75
+ }
76
+ catch (error) {
77
+ if (errorCode(error) !== "EEXIST")
78
+ throw error;
79
+ const existing = await readLease(path);
80
+ const reclaimable = existing === "missing" || existing === "unparseable" || !probeAlive(existing.pid, isProcessAlive);
81
+ if (reclaimable && retry) {
82
+ await unlinkIfPresent(path);
83
+ return tryAcquire(path, record, isProcessAlive, false);
84
+ }
85
+ if (existing === "missing" || existing === "unparseable")
86
+ throw error;
87
+ return { acquired: false, holder: existing };
88
+ }
89
+ }
90
+ export async function acquireTerminalLease(options) {
91
+ const pid = options.pid ?? process.pid;
92
+ const startedAtMs = (options.now ?? Date.now)();
93
+ const path = join(options.dir, `${options.encodedSessionId}.lease`);
94
+ await mkdir(options.dir, { recursive: true });
95
+ return tryAcquire(path, { pid, startedAtMs }, options.isProcessAlive, true);
96
+ }
97
+ export async function releaseTerminalLease(handle) {
98
+ const existing = await readLease(handle.path);
99
+ if (existing === "missing" || existing === "unparseable")
100
+ return;
101
+ if (existing.pid !== handle.pid)
102
+ return;
103
+ await unlinkIfPresent(handle.path);
104
+ }
105
+ //# sourceMappingURL=manifest-lease.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-lease.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/manifest-lease.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAgBjC,SAAS,SAAS,CAAC,KAAc;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtG,OAAO,KAAK,CAAC,IAAI,CAAC;IACnB,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,SAAS,UAAU,CAAC,GAAW,EAAE,KAAgC;IAChE,IAAI,CAAC;QACJ,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACb,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,IAAI,KAAK,OAAO;YAAE,OAAO,IAAI,CAAC;QAClC,IAAI,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,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,OAAoC;IAC9E,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IACvC,MAAM,WAAW,GAAG,CAAC,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAChD,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,OAAO,CAAC,gBAAgB,QAAQ,CAAC,CAAC;IACpE,MAAM,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,OAAO,UAAU,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,WAAW,EAAE,EAAE,OAAO,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;AAC7E,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,MAAqC;IAC/E,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,aAAa;QAAE,OAAO;IACjE,IAAI,QAAQ,CAAC,GAAG,KAAK,MAAM,CAAC,GAAG;QAAE,OAAO;IACxC,MAAM,eAAe,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC","sourcesContent":["import { mkdir, open, readFile, unlink } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nexport type AcquireTerminalLeaseOptions = {\n\tdir: string;\n\tencodedSessionId: string;\n\tpid?: number;\n\tnow?: () => number;\n\tisProcessAlive?: (pid: number) => boolean;\n};\n\nexport type AcquireTerminalLeaseResult =\n\t| { acquired: true; path: string; pid: number }\n\t| { acquired: false; holder: { pid: number; startedAtMs: number } };\n\ntype LeaseRecord = { pid: number; startedAtMs: number };\n\nfunction errorCode(error: unknown): string | undefined {\n\tif (typeof error === \"object\" && error !== null && \"code\" in error && typeof error.code === \"string\") {\n\t\treturn error.code;\n\t}\n\treturn undefined;\n}\n\nfunction probeAlive(pid: number, probe?: (pid: number) => boolean): boolean {\n\ttry {\n\t\tif (probe) return probe(pid);\n\t\tprocess.kill(pid, 0);\n\t\treturn true;\n\t} catch (error) {\n\t\tconst code = errorCode(error);\n\t\tif (code === \"EPERM\") return true;\n\t\tif (code === \"ESRCH\") return false;\n\t\tthrow error;\n\t}\n}\n\nasync function readLease(path: string): Promise<LeaseRecord | \"missing\" | \"unparseable\"> {\n\tlet raw: string;\n\ttry {\n\t\traw = await readFile(path, \"utf8\");\n\t} catch (error) {\n\t\tif (errorCode(error) === \"ENOENT\") return \"missing\";\n\t\tthrow error;\n\t}\n\ttry {\n\t\tconst parsed: unknown = JSON.parse(raw);\n\t\tif (typeof parsed !== \"object\" || parsed === null) return \"unparseable\";\n\t\tconst pid = (parsed as { pid?: unknown }).pid;\n\t\tconst startedAtMs = (parsed as { startedAtMs?: unknown }).startedAtMs;\n\t\tif (\n\t\t\ttypeof pid !== \"number\" ||\n\t\t\t!Number.isFinite(pid) ||\n\t\t\ttypeof startedAtMs !== \"number\" ||\n\t\t\t!Number.isFinite(startedAtMs)\n\t\t) {\n\t\t\treturn \"unparseable\";\n\t\t}\n\t\treturn { pid, startedAtMs };\n\t} catch {\n\t\treturn \"unparseable\";\n\t}\n}\n\nasync function exclusiveCreate(path: string, record: LeaseRecord): Promise<void> {\n\tconst file = await open(path, \"wx\");\n\ttry {\n\t\tawait file.writeFile(JSON.stringify(record), \"utf8\");\n\t} finally {\n\t\tawait file.close();\n\t}\n}\n\nasync function unlinkIfPresent(path: string): Promise<void> {\n\ttry {\n\t\tawait unlink(path);\n\t} catch (error) {\n\t\tif (errorCode(error) !== \"ENOENT\") throw error;\n\t}\n}\n\nasync function tryAcquire(\n\tpath: string,\n\trecord: LeaseRecord,\n\tisProcessAlive: ((pid: number) => boolean) | undefined,\n\tretry: boolean,\n): Promise<AcquireTerminalLeaseResult> {\n\ttry {\n\t\tawait exclusiveCreate(path, record);\n\t\treturn { acquired: true, path, pid: record.pid };\n\t} catch (error) {\n\t\tif (errorCode(error) !== \"EEXIST\") throw error;\n\t\tconst existing = await readLease(path);\n\t\tconst reclaimable =\n\t\t\texisting === \"missing\" || existing === \"unparseable\" || !probeAlive(existing.pid, isProcessAlive);\n\t\tif (reclaimable && retry) {\n\t\t\tawait unlinkIfPresent(path);\n\t\t\treturn tryAcquire(path, record, isProcessAlive, false);\n\t\t}\n\t\tif (existing === \"missing\" || existing === \"unparseable\") throw error;\n\t\treturn { acquired: false, holder: existing };\n\t}\n}\n\nexport async function acquireTerminalLease(options: AcquireTerminalLeaseOptions): Promise<AcquireTerminalLeaseResult> {\n\tconst pid = options.pid ?? process.pid;\n\tconst startedAtMs = (options.now ?? Date.now)();\n\tconst path = join(options.dir, `${options.encodedSessionId}.lease`);\n\tawait mkdir(options.dir, { recursive: true });\n\treturn tryAcquire(path, { pid, startedAtMs }, options.isProcessAlive, true);\n}\n\nexport async function releaseTerminalLease(handle: { path: string; pid: number }): Promise<void> {\n\tconst existing = await readLease(handle.path);\n\tif (existing === \"missing\" || existing === \"unparseable\") return;\n\tif (existing.pid !== handle.pid) return;\n\tawait unlinkIfPresent(handle.path);\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"monitor-notify.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/monitor-notify.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAmC,KAAK,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEzF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAQ7D,MAAM,WAAW,4BAA4B;IAC5C,GAAG,IAAI,MAAM,CAAC;IACd,UAAU,CAAC,QAAQ,EAAE,MAAM,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAC3D,YAAY,CAAC,KAAK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CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,KAAK,SAAS,MAAM,EAAE,CAAC;IACtE,QAAQ,CAAC,SAAS,CAAC,EAAE,4BAA4B,CAAC;CAClD;AA+CD;;;GAGG;AACH,qBAAa,eAAe;;gBAaf,IAAI,EAAE,mBAAmB;IAKrC,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAqBtC,wFAAwF;IACxF,YAAY,IAAI,IAAI;IAIpB,kFAAkF;IAClF,MAAM,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IAQpC,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAIvB,OAAO,IAAI,IAAI;CAyJf"}
@@ -1,5 +1,6 @@
1
1
  import { getTerminalNotificationDelivery } from "./notify.js";
2
2
  import { sanitizeTerminalOutput } from "./output-format.js";
3
+ import { FIRE_BUDGET_AUTO_MUTE_SUMMARY } from "./shared.js";
3
4
  const SYSTEM_REMINDER_OPEN = "<system-reminder>";
4
5
  const SYSTEM_REMINDER_CLOSE = "</system-reminder>";
5
6
  const QUEUE_OVERHEAD_CHARS = 512;
@@ -169,7 +170,10 @@ export class MonitorNotifier {
169
170
  now - this.#lastWakeAt > settings.rateLimitMs * WAKE_STREAK_QUIET_GAP_MULTIPLIER) {
170
171
  this.#consecutiveWakes = 0;
171
172
  }
172
- const deliversSummary = selected.some((event) => event.type === "summary");
173
+ const deliversSummary = selected.some(
174
+ // A fire-budget auto-mute summary is a mute, not a completion: exempting it keeps the
175
+ // session-global wake streak — the notifier's own pause state — from being cleared.
176
+ (event) => event.type === "summary" && event.summary !== FIRE_BUDGET_AUTO_MUTE_SUMMARY);
173
177
  const reachesBudget = !deliversSummary && this.#consecutiveWakes + 1 >= settings.wakeBudget;
174
178
  const pauseNotice = reachesBudget
175
179
  ? "Monitor paused after repeated updates. Completion still wakes this session; peek bash_output or re-arm only for intermediate events."
@@ -1 +1 @@
1
- {"version":3,"file":"monitor-notify.js","sourceRoot":"","s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AAC;CACD","sourcesContent":["import type { MonitorEvent } from \"./monitor-registry.ts\";\nimport { getTerminalNotificationDelivery, type TerminalNotifierDeps } from \"./notify.ts\";\nimport { sanitizeTerminalOutput } from \"./output-format.ts\";\nimport type { MonitorDeliverySettings } from \"./settings.ts\";\n\nconst SYSTEM_REMINDER_OPEN = \"<system-reminder>\";\nconst SYSTEM_REMINDER_CLOSE = \"</system-reminder>\";\nconst QUEUE_OVERHEAD_CHARS = 512;\nconst MONITOR_NOTIFICATION_CUSTOM_TYPE = \"senpi-monitor:notification\";\nconst WAKE_STREAK_QUIET_GAP_MULTIPLIER = 2;\n\nexport interface MonitorNotificationScheduler {\n\tnow(): number;\n\tsetTimeout(callback: () => void, delayMs: number): unknown;\n\tclearTimeout(timer: unknown): void;\n}\n\nconst systemScheduler: MonitorNotificationScheduler = {\n\tnow: () => Date.now(),\n\tsetTimeout: (callback, delayMs) => setTimeout(callback, delayMs),\n\tclearTimeout: (timer) => clearTimeout(timer as ReturnType<typeof setTimeout>),\n};\n\nexport interface MonitorNotifierDeps extends TerminalNotifierDeps {\n\treadonly getSettings: () => MonitorDeliverySettings;\n\t/** Pause the monitors contributing to a shared wake-budget exhaustion. */\n\treadonly pauseMonitors: (ids: readonly string[]) => readonly string[];\n\treadonly scheduler?: MonitorNotificationScheduler;\n}\n\ninterface Overflow {\n\treadonly id: string;\n\tcount: number;\n}\n\nfunction boundedPositiveInt(value: number, fallback: number, minimum: number, maximum: number): number {\n\tif (!Number.isFinite(value)) return fallback;\n\treturn Math.min(Math.max(Math.trunc(value), minimum), maximum);\n}\n\nfunction resolveSettings(settings: MonitorDeliverySettings): MonitorDeliverySettings {\n\treturn {\n\t\tcoalesceWindowMs: boundedPositiveInt(settings.coalesceWindowMs, 2000, 1, 60_000),\n\t\trateLimitMs: boundedPositiveInt(settings.rateLimitMs, 5000, 1, 3_600_000),\n\t\tmaxLinesPerInjection: boundedPositiveInt(settings.maxLinesPerInjection, 50, 1, 200),\n\t\tmaxCharsPerInjection: boundedPositiveInt(settings.maxCharsPerInjection, 4096, 512, 16_384),\n\t\twakeBudget: boundedPositiveInt(settings.wakeBudget, 5, 1, 100),\n\t};\n}\n\nfunction eventBody(event: MonitorEvent): string {\n\tconst value = event.type === \"line\" ? event.line : event.summary;\n\treturn sanitizeTerminalOutput(value)\n\t\t.replace(/[\\r\\n]+/g, \" \")\n\t\t.trimEnd();\n}\n\nfunction clip(text: string, maxChars: number): string {\n\tif (text.length <= maxChars) return text;\n\tif (maxChars <= 3) return text.slice(0, maxChars);\n\treturn `${text.slice(0, maxChars - 3)}...`;\n}\n\nfunction formatEvents(events: readonly MonitorEvent[]): string {\n\tconst groups = new Map<string, { description: string; bodies: string[] }>();\n\tfor (const event of events) {\n\t\tconst group = groups.get(event.id) ?? { description: event.description, bodies: [] };\n\t\tgroup.bodies.push(eventBody(event));\n\t\tgroups.set(event.id, group);\n\t}\n\treturn [...groups.values()]\n\t\t.map((group) => `Monitor event(${group.description}): ${group.bodies.join(\"\\n\")}`)\n\t\t.join(\"\\n\");\n}\n\n/**\n * Session-scoped monitor delivery queue. It preserves the terminal runtime as the authoritative,\n * bounded event history while retaining only one capped coalescing batch for chat injection.\n */\nexport class MonitorNotifier {\n\treadonly #deps: MonitorNotifierDeps;\n\treadonly #scheduler: MonitorNotificationScheduler;\n\t#events: MonitorEvent[] = [];\n\t#eventChars = 0;\n\t#overflow = new Map<string, Overflow>();\n\t#lastInjectionAt = new Map<string, number>();\n\t#lastInjectedBatch = new Map<string, string>();\n\t#timer: unknown;\n\t#scheduledAt: number | undefined;\n\t#consecutiveWakes = 0;\n\t#lastWakeAt: number | undefined;\n\n\tconstructor(deps: MonitorNotifierDeps) {\n\t\tthis.#deps = deps;\n\t\tthis.#scheduler = deps.scheduler ?? systemScheduler;\n\t}\n\n\tnotifyEvent(event: MonitorEvent): void {\n\t\tif (event.type === \"summary\") {\n\t\t\tthis.#lastInjectionAt.delete(event.id);\n\t\t\tthis.#lastInjectedBatch.delete(event.id);\n\t\t}\n\t\tif (!getTerminalNotificationDelivery(this.#deps, MONITOR_NOTIFICATION_CUSTOM_TYPE)) return;\n\t\tconst settings = resolveSettings(this.#deps.getSettings());\n\t\tconst rendered = `Monitor event(${event.description}): ${eventBody(event)}`;\n\t\tconst queueLimit = Math.max(1, settings.maxCharsPerInjection - QUEUE_OVERHEAD_CHARS);\n\t\tif (\n\t\t\tevent.type !== \"summary\" &&\n\t\t\t(this.#events.length >= settings.maxLinesPerInjection || this.#eventChars + rendered.length > queueLimit)\n\t\t) {\n\t\t\tthis.#recordOverflow(event.id);\n\t\t} else {\n\t\t\tthis.#events.push(event);\n\t\t\tthis.#eventChars += rendered.length;\n\t\t}\n\t\tthis.#schedule(settings.coalesceWindowMs);\n\t}\n\n\t/** Any explicit user or tool activity breaks a consecutive monitor-only wake streak. */\n\tnoteActivity(): void {\n\t\tthis.#consecutiveWakes = 0;\n\t}\n\n\t/** Clear delivery bookkeeping for monitors explicitly resumed by the registry. */\n\tresume(ids: readonly string[]): void {\n\t\tfor (const id of ids) {\n\t\t\tthis.#lastInjectionAt.delete(id);\n\t\t\tthis.#lastInjectedBatch.delete(id);\n\t\t}\n\t\tthis.#consecutiveWakes = 0;\n\t}\n\n\trearm(id: string): void {\n\t\tthis.resume([id]);\n\t}\n\n\tdispose(): void {\n\t\tif (this.#timer !== undefined) this.#scheduler.clearTimeout(this.#timer);\n\t\tthis.#timer = undefined;\n\t\tthis.#scheduledAt = undefined;\n\t\tthis.#events = [];\n\t\tthis.#eventChars = 0;\n\t\tthis.#overflow.clear();\n\t\tthis.#lastInjectedBatch.clear();\n\t}\n\n\t#recordOverflow(id: string): void {\n\t\tconst overflow = this.#overflow.get(id) ?? { id, count: 0 };\n\t\toverflow.count++;\n\t\tthis.#overflow.set(id, overflow);\n\t}\n\n\t#schedule(delayMs: number): void {\n\t\tconst due = this.#scheduler.now() + delayMs;\n\t\tif (this.#timer !== undefined && this.#scheduledAt !== undefined && this.#scheduledAt <= due) return;\n\t\tif (this.#timer !== undefined) this.#scheduler.clearTimeout(this.#timer);\n\t\tthis.#scheduledAt = due;\n\t\tthis.#timer = this.#scheduler.setTimeout(() => this.#flush(), delayMs);\n\t}\n\n\t#flush(): void {\n\t\tthis.#timer = undefined;\n\t\tthis.#scheduledAt = undefined;\n\t\tconst delivery = getTerminalNotificationDelivery(this.#deps, MONITOR_NOTIFICATION_CUSTOM_TYPE);\n\t\tif (!delivery) {\n\t\t\tthis.dispose();\n\t\t\treturn;\n\t\t}\n\n\t\tconst settings = resolveSettings(this.#deps.getSettings());\n\t\tconst now = this.#scheduler.now();\n\t\tconst pendingIds = new Set([...this.#events.map((event) => event.id), ...this.#overflow.keys()]);\n\t\tif (pendingIds.size === 0) return;\n\t\tconst summaryIds = new Set(this.#events.filter((event) => event.type === \"summary\").map((event) => event.id));\n\t\tconst ready = new Set(\n\t\t\t[...pendingIds].filter((id) => {\n\t\t\t\tif (summaryIds.has(id)) return true;\n\t\t\t\tconst last = this.#lastInjectionAt.get(id);\n\t\t\t\treturn last === undefined || now - last >= settings.rateLimitMs;\n\t\t\t}),\n\t\t);\n\t\tif (ready.size === 0) {\n\t\t\tthis.#scheduleNextRateLimit(pendingIds, now, settings);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fingerprints = this.#batchFingerprints(ready);\n\t\tconst suppressedIds = new Set(\n\t\t\t[...fingerprints]\n\t\t\t\t.filter(([id, fingerprint]) => this.#lastInjectedBatch.get(id) === fingerprint)\n\t\t\t\t.map(([id]) => id),\n\t\t);\n\t\tconst injectedIds = new Set([...ready].filter((id) => !suppressedIds.has(id)));\n\t\tconst selected = this.#events.filter((event) => injectedIds.has(event.id));\n\t\tconst deferred = this.#events.filter((event) => !ready.has(event.id));\n\t\tif (injectedIds.size === 0) {\n\t\t\tthis.#discardSuppressed(deferred, now, settings);\n\t\t\treturn;\n\t\t}\n\t\tconst overflowCount = [...this.#overflow.values()]\n\t\t\t.filter((overflow) => injectedIds.has(overflow.id))\n\t\t\t.reduce((total, overflow) => total + overflow.count, 0);\n\t\tif (\n\t\t\tthis.#lastWakeAt !== undefined &&\n\t\t\tnow - this.#lastWakeAt > settings.rateLimitMs * WAKE_STREAK_QUIET_GAP_MULTIPLIER\n\t\t) {\n\t\t\tthis.#consecutiveWakes = 0;\n\t\t}\n\t\tconst deliversSummary = selected.some((event) => event.type === \"summary\");\n\t\tconst reachesBudget = !deliversSummary && this.#consecutiveWakes + 1 >= settings.wakeBudget;\n\t\tconst pauseNotice = reachesBudget\n\t\t\t? \"Monitor paused after repeated updates. Completion still wakes this session; peek bash_output or re-arm only for intermediate events.\"\n\t\t\t: \"\";\n\t\tconst content = this.#buildMessage(selected, overflowCount, pauseNotice, settings.maxCharsPerInjection);\n\n\t\tdelivery.send(content, reachesBudget ? { forceWake: true } : undefined);\n\t\tthis.#lastWakeAt = now;\n\t\tfor (const id of injectedIds) {\n\t\t\tthis.#lastInjectionAt.set(id, now);\n\t\t\tthis.#overflow.delete(id);\n\t\t\tconst fingerprint = fingerprints.get(id);\n\t\t\tif (fingerprint === undefined) this.#lastInjectedBatch.delete(id);\n\t\t\telse this.#lastInjectedBatch.set(id, fingerprint);\n\t\t}\n\t\tthis.#events = deferred;\n\t\tthis.#eventChars = deferred.reduce(\n\t\t\t(total, event) => total + `Monitor event(${event.description}): ${eventBody(event)}`.length,\n\t\t\t0,\n\t\t);\n\t\tthis.#consecutiveWakes = deliversSummary ? 0 : this.#consecutiveWakes + 1;\n\n\t\tif (reachesBudget) {\n\t\t\tthis.#deps.pauseMonitors([...injectedIds]);\n\t\t\tthis.#events = [];\n\t\t\tthis.#eventChars = 0;\n\t\t\tthis.#overflow.clear();\n\t\t\tthis.#consecutiveWakes = 0;\n\t\t\treturn;\n\t\t}\n\t\tconst remainingIds = new Set([...this.#events.map((event) => event.id), ...this.#overflow.keys()]);\n\t\tif (remainingIds.size > 0) this.#scheduleNextRateLimit(remainingIds, now, settings);\n\t}\n\n\t#scheduleNextRateLimit(ids: ReadonlySet<string>, now: number, settings: MonitorDeliverySettings): void {\n\t\tconst nextAt = Math.min(...[...ids].map((id) => (this.#lastInjectionAt.get(id) ?? now) + settings.rateLimitMs));\n\t\tthis.#schedule(Math.max(1, nextAt - now));\n\t}\n\n\t/** A ready monitor whose line-only batch matches its previous injection carries no new information. */\n\t#batchFingerprints(ids: ReadonlySet<string>): Map<string, string> {\n\t\tconst fingerprints = new Map<string, string>();\n\t\tfor (const id of ids) {\n\t\t\tif ((this.#overflow.get(id)?.count ?? 0) > 0) continue;\n\t\t\tconst batch = this.#events.filter((event) => event.id === id);\n\t\t\tif (batch.length === 0 || batch.some((event) => event.type !== \"line\")) continue;\n\t\t\tfingerprints.set(id, batch.map(eventBody).join(\"\\n\"));\n\t\t}\n\t\treturn fingerprints;\n\t}\n\n\t#discardSuppressed(deferred: MonitorEvent[], now: number, settings: MonitorDeliverySettings): void {\n\t\tthis.#events = deferred;\n\t\tthis.#eventChars = deferred.reduce(\n\t\t\t(total, event) => total + `Monitor event(${event.description}): ${eventBody(event)}`.length,\n\t\t\t0,\n\t\t);\n\t\tconst remainingIds = new Set([...deferred.map((event) => event.id), ...this.#overflow.keys()]);\n\t\tif (remainingIds.size > 0) this.#scheduleNextRateLimit(remainingIds, now, settings);\n\t}\n\n\t#buildMessage(\n\t\tevents: readonly MonitorEvent[],\n\t\toverflowCount: number,\n\t\tpauseNotice: string,\n\t\tmaxChars: number,\n\t): string {\n\t\tconst overflowNotice =\n\t\t\toverflowCount > 0\n\t\t\t\t? `[${overflowCount} additional event lines omitted; peek bash_output for full history.]`\n\t\t\t\t: \"\";\n\t\tconst suffix = [overflowNotice, pauseNotice].filter(Boolean).join(\"\\n\");\n\t\tconst fixedChars = SYSTEM_REMINDER_OPEN.length + SYSTEM_REMINDER_CLOSE.length + (suffix ? suffix.length + 1 : 0);\n\t\tconst body = clip(formatEvents(events), Math.max(0, maxChars - fixedChars));\n\t\treturn `${SYSTEM_REMINDER_OPEN}${body}${body && suffix ? \"\\n\" : \"\"}${suffix}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AAE,QAAQ,GAAG,UAAU,CAAC,CAAC,CAAC;QAC5E,OAAO,GAAG,oBAAoB,GAAG,IAAI,GAAG,IAAI,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,MAAM,GAAG,qBAAqB,EAAE,CAAC;IACvG,CAAC;CACD","sourcesContent":["import type { MonitorEvent } from \"./monitor-registry.ts\";\nimport { getTerminalNotificationDelivery, type TerminalNotifierDeps } from \"./notify.ts\";\nimport { sanitizeTerminalOutput } from \"./output-format.ts\";\nimport type { MonitorDeliverySettings } from \"./settings.ts\";\nimport { FIRE_BUDGET_AUTO_MUTE_SUMMARY } from \"./shared.ts\";\n\nconst SYSTEM_REMINDER_OPEN = \"<system-reminder>\";\nconst SYSTEM_REMINDER_CLOSE = \"</system-reminder>\";\nconst QUEUE_OVERHEAD_CHARS = 512;\nconst MONITOR_NOTIFICATION_CUSTOM_TYPE = \"senpi-monitor:notification\";\nconst WAKE_STREAK_QUIET_GAP_MULTIPLIER = 2;\n\nexport interface MonitorNotificationScheduler {\n\tnow(): number;\n\tsetTimeout(callback: () => void, delayMs: number): unknown;\n\tclearTimeout(timer: unknown): void;\n}\n\nconst systemScheduler: MonitorNotificationScheduler = {\n\tnow: () => Date.now(),\n\tsetTimeout: (callback, delayMs) => setTimeout(callback, delayMs),\n\tclearTimeout: (timer) => clearTimeout(timer as ReturnType<typeof setTimeout>),\n};\n\nexport interface MonitorNotifierDeps extends TerminalNotifierDeps {\n\treadonly getSettings: () => MonitorDeliverySettings;\n\t/** Pause the monitors contributing to a shared wake-budget exhaustion. */\n\treadonly pauseMonitors: (ids: readonly string[]) => readonly string[];\n\treadonly scheduler?: MonitorNotificationScheduler;\n}\n\ninterface Overflow {\n\treadonly id: string;\n\tcount: number;\n}\n\nfunction boundedPositiveInt(value: number, fallback: number, minimum: number, maximum: number): number {\n\tif (!Number.isFinite(value)) return fallback;\n\treturn Math.min(Math.max(Math.trunc(value), minimum), maximum);\n}\n\nfunction resolveSettings(settings: MonitorDeliverySettings): MonitorDeliverySettings {\n\treturn {\n\t\tcoalesceWindowMs: boundedPositiveInt(settings.coalesceWindowMs, 2000, 1, 60_000),\n\t\trateLimitMs: boundedPositiveInt(settings.rateLimitMs, 5000, 1, 3_600_000),\n\t\tmaxLinesPerInjection: boundedPositiveInt(settings.maxLinesPerInjection, 50, 1, 200),\n\t\tmaxCharsPerInjection: boundedPositiveInt(settings.maxCharsPerInjection, 4096, 512, 16_384),\n\t\twakeBudget: boundedPositiveInt(settings.wakeBudget, 5, 1, 100),\n\t};\n}\n\nfunction eventBody(event: MonitorEvent): string {\n\tconst value = event.type === \"line\" ? event.line : event.summary;\n\treturn sanitizeTerminalOutput(value)\n\t\t.replace(/[\\r\\n]+/g, \" \")\n\t\t.trimEnd();\n}\n\nfunction clip(text: string, maxChars: number): string {\n\tif (text.length <= maxChars) return text;\n\tif (maxChars <= 3) return text.slice(0, maxChars);\n\treturn `${text.slice(0, maxChars - 3)}...`;\n}\n\nfunction formatEvents(events: readonly MonitorEvent[]): string {\n\tconst groups = new Map<string, { description: string; bodies: string[] }>();\n\tfor (const event of events) {\n\t\tconst group = groups.get(event.id) ?? { description: event.description, bodies: [] };\n\t\tgroup.bodies.push(eventBody(event));\n\t\tgroups.set(event.id, group);\n\t}\n\treturn [...groups.values()]\n\t\t.map((group) => `Monitor event(${group.description}): ${group.bodies.join(\"\\n\")}`)\n\t\t.join(\"\\n\");\n}\n\n/**\n * Session-scoped monitor delivery queue. It preserves the terminal runtime as the authoritative,\n * bounded event history while retaining only one capped coalescing batch for chat injection.\n */\nexport class MonitorNotifier {\n\treadonly #deps: MonitorNotifierDeps;\n\treadonly #scheduler: MonitorNotificationScheduler;\n\t#events: MonitorEvent[] = [];\n\t#eventChars = 0;\n\t#overflow = new Map<string, Overflow>();\n\t#lastInjectionAt = new Map<string, number>();\n\t#lastInjectedBatch = new Map<string, string>();\n\t#timer: unknown;\n\t#scheduledAt: number | undefined;\n\t#consecutiveWakes = 0;\n\t#lastWakeAt: number | undefined;\n\n\tconstructor(deps: MonitorNotifierDeps) {\n\t\tthis.#deps = deps;\n\t\tthis.#scheduler = deps.scheduler ?? systemScheduler;\n\t}\n\n\tnotifyEvent(event: MonitorEvent): void {\n\t\tif (event.type === \"summary\") {\n\t\t\tthis.#lastInjectionAt.delete(event.id);\n\t\t\tthis.#lastInjectedBatch.delete(event.id);\n\t\t}\n\t\tif (!getTerminalNotificationDelivery(this.#deps, MONITOR_NOTIFICATION_CUSTOM_TYPE)) return;\n\t\tconst settings = resolveSettings(this.#deps.getSettings());\n\t\tconst rendered = `Monitor event(${event.description}): ${eventBody(event)}`;\n\t\tconst queueLimit = Math.max(1, settings.maxCharsPerInjection - QUEUE_OVERHEAD_CHARS);\n\t\tif (\n\t\t\tevent.type !== \"summary\" &&\n\t\t\t(this.#events.length >= settings.maxLinesPerInjection || this.#eventChars + rendered.length > queueLimit)\n\t\t) {\n\t\t\tthis.#recordOverflow(event.id);\n\t\t} else {\n\t\t\tthis.#events.push(event);\n\t\t\tthis.#eventChars += rendered.length;\n\t\t}\n\t\tthis.#schedule(settings.coalesceWindowMs);\n\t}\n\n\t/** Any explicit user or tool activity breaks a consecutive monitor-only wake streak. */\n\tnoteActivity(): void {\n\t\tthis.#consecutiveWakes = 0;\n\t}\n\n\t/** Clear delivery bookkeeping for monitors explicitly resumed by the registry. */\n\tresume(ids: readonly string[]): void {\n\t\tfor (const id of ids) {\n\t\t\tthis.#lastInjectionAt.delete(id);\n\t\t\tthis.#lastInjectedBatch.delete(id);\n\t\t}\n\t\tthis.#consecutiveWakes = 0;\n\t}\n\n\trearm(id: string): void {\n\t\tthis.resume([id]);\n\t}\n\n\tdispose(): void {\n\t\tif (this.#timer !== undefined) this.#scheduler.clearTimeout(this.#timer);\n\t\tthis.#timer = undefined;\n\t\tthis.#scheduledAt = undefined;\n\t\tthis.#events = [];\n\t\tthis.#eventChars = 0;\n\t\tthis.#overflow.clear();\n\t\tthis.#lastInjectedBatch.clear();\n\t}\n\n\t#recordOverflow(id: string): void {\n\t\tconst overflow = this.#overflow.get(id) ?? { id, count: 0 };\n\t\toverflow.count++;\n\t\tthis.#overflow.set(id, overflow);\n\t}\n\n\t#schedule(delayMs: number): void {\n\t\tconst due = this.#scheduler.now() + delayMs;\n\t\tif (this.#timer !== undefined && this.#scheduledAt !== undefined && this.#scheduledAt <= due) return;\n\t\tif (this.#timer !== undefined) this.#scheduler.clearTimeout(this.#timer);\n\t\tthis.#scheduledAt = due;\n\t\tthis.#timer = this.#scheduler.setTimeout(() => this.#flush(), delayMs);\n\t}\n\n\t#flush(): void {\n\t\tthis.#timer = undefined;\n\t\tthis.#scheduledAt = undefined;\n\t\tconst delivery = getTerminalNotificationDelivery(this.#deps, MONITOR_NOTIFICATION_CUSTOM_TYPE);\n\t\tif (!delivery) {\n\t\t\tthis.dispose();\n\t\t\treturn;\n\t\t}\n\n\t\tconst settings = resolveSettings(this.#deps.getSettings());\n\t\tconst now = this.#scheduler.now();\n\t\tconst pendingIds = new Set([...this.#events.map((event) => event.id), ...this.#overflow.keys()]);\n\t\tif (pendingIds.size === 0) return;\n\t\tconst summaryIds = new Set(this.#events.filter((event) => event.type === \"summary\").map((event) => event.id));\n\t\tconst ready = new Set(\n\t\t\t[...pendingIds].filter((id) => {\n\t\t\t\tif (summaryIds.has(id)) return true;\n\t\t\t\tconst last = this.#lastInjectionAt.get(id);\n\t\t\t\treturn last === undefined || now - last >= settings.rateLimitMs;\n\t\t\t}),\n\t\t);\n\t\tif (ready.size === 0) {\n\t\t\tthis.#scheduleNextRateLimit(pendingIds, now, settings);\n\t\t\treturn;\n\t\t}\n\n\t\tconst fingerprints = this.#batchFingerprints(ready);\n\t\tconst suppressedIds = new Set(\n\t\t\t[...fingerprints]\n\t\t\t\t.filter(([id, fingerprint]) => this.#lastInjectedBatch.get(id) === fingerprint)\n\t\t\t\t.map(([id]) => id),\n\t\t);\n\t\tconst injectedIds = new Set([...ready].filter((id) => !suppressedIds.has(id)));\n\t\tconst selected = this.#events.filter((event) => injectedIds.has(event.id));\n\t\tconst deferred = this.#events.filter((event) => !ready.has(event.id));\n\t\tif (injectedIds.size === 0) {\n\t\t\tthis.#discardSuppressed(deferred, now, settings);\n\t\t\treturn;\n\t\t}\n\t\tconst overflowCount = [...this.#overflow.values()]\n\t\t\t.filter((overflow) => injectedIds.has(overflow.id))\n\t\t\t.reduce((total, overflow) => total + overflow.count, 0);\n\t\tif (\n\t\t\tthis.#lastWakeAt !== undefined &&\n\t\t\tnow - this.#lastWakeAt > settings.rateLimitMs * WAKE_STREAK_QUIET_GAP_MULTIPLIER\n\t\t) {\n\t\t\tthis.#consecutiveWakes = 0;\n\t\t}\n\t\tconst deliversSummary = selected.some(\n\t\t\t// A fire-budget auto-mute summary is a mute, not a completion: exempting it keeps the\n\t\t\t// session-global wake streak — the notifier's own pause state — from being cleared.\n\t\t\t(event) => event.type === \"summary\" && event.summary !== FIRE_BUDGET_AUTO_MUTE_SUMMARY,\n\t\t);\n\t\tconst reachesBudget = !deliversSummary && this.#consecutiveWakes + 1 >= settings.wakeBudget;\n\t\tconst pauseNotice = reachesBudget\n\t\t\t? \"Monitor paused after repeated updates. Completion still wakes this session; peek bash_output or re-arm only for intermediate events.\"\n\t\t\t: \"\";\n\t\tconst content = this.#buildMessage(selected, overflowCount, pauseNotice, settings.maxCharsPerInjection);\n\n\t\tdelivery.send(content, reachesBudget ? { forceWake: true } : undefined);\n\t\tthis.#lastWakeAt = now;\n\t\tfor (const id of injectedIds) {\n\t\t\tthis.#lastInjectionAt.set(id, now);\n\t\t\tthis.#overflow.delete(id);\n\t\t\tconst fingerprint = fingerprints.get(id);\n\t\t\tif (fingerprint === undefined) this.#lastInjectedBatch.delete(id);\n\t\t\telse this.#lastInjectedBatch.set(id, fingerprint);\n\t\t}\n\t\tthis.#events = deferred;\n\t\tthis.#eventChars = deferred.reduce(\n\t\t\t(total, event) => total + `Monitor event(${event.description}): ${eventBody(event)}`.length,\n\t\t\t0,\n\t\t);\n\t\tthis.#consecutiveWakes = deliversSummary ? 0 : this.#consecutiveWakes + 1;\n\n\t\tif (reachesBudget) {\n\t\t\tthis.#deps.pauseMonitors([...injectedIds]);\n\t\t\tthis.#events = [];\n\t\t\tthis.#eventChars = 0;\n\t\t\tthis.#overflow.clear();\n\t\t\tthis.#consecutiveWakes = 0;\n\t\t\treturn;\n\t\t}\n\t\tconst remainingIds = new Set([...this.#events.map((event) => event.id), ...this.#overflow.keys()]);\n\t\tif (remainingIds.size > 0) this.#scheduleNextRateLimit(remainingIds, now, settings);\n\t}\n\n\t#scheduleNextRateLimit(ids: ReadonlySet<string>, now: number, settings: MonitorDeliverySettings): void {\n\t\tconst nextAt = Math.min(...[...ids].map((id) => (this.#lastInjectionAt.get(id) ?? now) + settings.rateLimitMs));\n\t\tthis.#schedule(Math.max(1, nextAt - now));\n\t}\n\n\t/** A ready monitor whose line-only batch matches its previous injection carries no new information. */\n\t#batchFingerprints(ids: ReadonlySet<string>): Map<string, string> {\n\t\tconst fingerprints = new Map<string, string>();\n\t\tfor (const id of ids) {\n\t\t\tif ((this.#overflow.get(id)?.count ?? 0) > 0) continue;\n\t\t\tconst batch = this.#events.filter((event) => event.id === id);\n\t\t\tif (batch.length === 0 || batch.some((event) => event.type !== \"line\")) continue;\n\t\t\tfingerprints.set(id, batch.map(eventBody).join(\"\\n\"));\n\t\t}\n\t\treturn fingerprints;\n\t}\n\n\t#discardSuppressed(deferred: MonitorEvent[], now: number, settings: MonitorDeliverySettings): void {\n\t\tthis.#events = deferred;\n\t\tthis.#eventChars = deferred.reduce(\n\t\t\t(total, event) => total + `Monitor event(${event.description}): ${eventBody(event)}`.length,\n\t\t\t0,\n\t\t);\n\t\tconst remainingIds = new Set([...deferred.map((event) => event.id), ...this.#overflow.keys()]);\n\t\tif (remainingIds.size > 0) this.#scheduleNextRateLimit(remainingIds, now, settings);\n\t}\n\n\t#buildMessage(\n\t\tevents: readonly MonitorEvent[],\n\t\toverflowCount: number,\n\t\tpauseNotice: string,\n\t\tmaxChars: number,\n\t): string {\n\t\tconst overflowNotice =\n\t\t\toverflowCount > 0\n\t\t\t\t? `[${overflowCount} additional event lines omitted; peek bash_output for full history.]`\n\t\t\t\t: \"\";\n\t\tconst suffix = [overflowNotice, pauseNotice].filter(Boolean).join(\"\\n\");\n\t\tconst fixedChars = SYSTEM_REMINDER_OPEN.length + SYSTEM_REMINDER_CLOSE.length + (suffix ? suffix.length + 1 : 0);\n\t\tconst body = clip(formatEvents(events), Math.max(0, maxChars - fixedChars));\n\t\treturn `${SYSTEM_REMINDER_OPEN}${body}${body && suffix ? \"\\n\" : \"\"}${suffix}${SYSTEM_REMINDER_CLOSE}`;\n\t}\n}\n"]}
@@ -1,4 +1,5 @@
1
1
  import type { TerminalRuntimeSession } from "./runtime-session.ts";
2
+ import type { MonitorDurabilityClass } from "./terminal-manifest.ts";
2
3
  export interface MonitorLineEvent {
3
4
  readonly type: "line";
4
5
  readonly id: string;
@@ -17,12 +18,23 @@ export interface MonitorResumeResult {
17
18
  readonly id: string;
18
19
  readonly mutedDropped: number;
19
20
  }
21
+ /** Allocate a stable monitor identity: "mon_" + 16 Crockford base-32 chars (80 random bits). */
22
+ export declare function allocateMonitorId(): string;
23
+ export type MonitorFireWindow = {
24
+ startMs: number;
25
+ count: number;
26
+ };
20
27
  export interface MonitorSnapshotEntry {
21
28
  readonly id: string;
29
+ /** Stable "mon_" identity carried alongside the runtime id; always set on live snapshots. */
30
+ readonly monitorId?: string;
22
31
  readonly description: string;
23
32
  readonly paused: boolean;
24
33
  /** Epoch milliseconds when the watch registered; feeds the footer's live elapsed label. */
25
34
  readonly startedAtMs: number;
35
+ /** Durability deadline of a restart-surviving watch; undefined for every ephemeral one. */
36
+ readonly expiresAt?: number;
37
+ readonly fireWindow?: MonitorFireWindow;
26
38
  }
27
39
  export interface MonitorRegistryOptions {
28
40
  /** Observes every registry transition (register/pause/rearm/settle/dispose) with the live snapshot. */
@@ -33,16 +45,28 @@ export interface MonitorRegistryOptions {
33
45
  export interface RegisterFileMonitorOptions {
34
46
  readonly description: string;
35
47
  readonly path: string;
48
+ /** Caller-supplied stable identity so a restore can re-bind the same "mon_" id. */
49
+ readonly monitorId?: string;
36
50
  readonly event: "create" | "modify";
37
51
  readonly timeoutMs: number;
38
52
  readonly cwd: string;
39
53
  readonly approvedParent?: string;
54
+ /** Durability deadline of a `checkpointed-file` watch; omitted for a one-shot ephemeral one. */
55
+ readonly expiresAt?: number;
40
56
  }
41
57
  export interface RegisterMonitorOptions {
42
58
  readonly id: string;
59
+ /** Caller-supplied stable identity so a restore can re-bind the same "mon_" id. */
60
+ readonly monitorId?: string;
43
61
  readonly description: string;
44
62
  readonly runtime: TerminalRuntimeSession;
45
63
  readonly filter?: RegExp;
64
+ /** Durability class from the manifest spec; non-ephemeral records carry the fire budget. */
65
+ readonly durabilityClass?: MonitorDurabilityClass;
66
+ /** Persisted fire window re-bound by a restore, so a restart cannot reset the budget. */
67
+ readonly fireWindow?: MonitorFireWindow;
68
+ /** Durability deadline of a durable watch; omitted for an ephemeral one. */
69
+ readonly expiresAt?: number;
46
70
  }
47
71
  /**
48
72
  * Tracks active monitor sessions alongside the terminal manager's existing bash-id registry.
@@ -53,15 +77,31 @@ export declare class MonitorRegistry {
53
77
  #private;
54
78
  constructor(emit: (event: MonitorEvent) => void, options?: MonitorRegistryOptions);
55
79
  snapshot(): readonly MonitorSnapshotEntry[];
56
- registerFile(options: RegisterFileMonitorOptions): Promise<string>;
80
+ registerFile(options: RegisterFileMonitorOptions): Promise<{
81
+ id: string;
82
+ monitorId: string;
83
+ }>;
84
+ /** Live identity tuple of one file watch; undefined when the id is not a live file watch. */
85
+ fileCheckpoint(id: string): {
86
+ dev: number;
87
+ ino: number;
88
+ size: number;
89
+ mtimeMs: number;
90
+ digest: string;
91
+ present: boolean;
92
+ } | undefined;
93
+ /** Emit one restored-watch line through the SAME sink a live watch uses (coalescing, wake budget). */
94
+ emitFileLine(id: string, line: string): boolean;
57
95
  stopFile(id: string): Promise<boolean>;
58
96
  stopAllFiles(): Promise<number>;
59
- register(options: RegisterMonitorOptions): void;
97
+ register(options: RegisterMonitorOptions): string;
60
98
  pause(ids: readonly string[]): string[];
61
99
  pauseAll(): string[];
62
100
  resume(ids?: readonly string[]): MonitorResumeResult[];
63
101
  mutedDropped(id: string): number;
64
102
  rearm(id: string): MonitorRearmResult;
103
+ /** Re-bind a persisted fire window onto the record for a durable monitor id (a restore re-arms the budget). */
104
+ adoptFireWindow(monitorId: string, fireWindow: MonitorFireWindow): boolean;
65
105
  dispose(): void;
66
106
  }
67
107
  //# sourceMappingURL=monitor-registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"monitor-registry.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/terminal/monitor-registry.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAGnE,MAAM,WAAW,gBAAgB;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAElE,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,YAAY,GAAG,WAAW,CAAC;AAExE,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC9B;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