@code-yeongyu/senpi 2026.9.4 → 2026.9.5-3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1047) hide show
  1. package/CHANGELOG.md +143 -0
  2. package/README.md +5 -4
  3. package/dist/cli/startup-ui.d.ts.map +1 -1
  4. package/dist/cli/startup-ui.js +2 -1
  5. package/dist/cli/startup-ui.js.map +1 -1
  6. package/dist/core/agent-session-runtime.js +2 -2
  7. package/dist/core/agent-session-runtime.js.map +1 -1
  8. package/dist/core/agent-session.d.ts +17 -1
  9. package/dist/core/agent-session.d.ts.map +1 -1
  10. package/dist/core/agent-session.js +106 -3
  11. package/dist/core/agent-session.js.map +1 -1
  12. package/dist/core/auth-storage.d.ts.map +1 -1
  13. package/dist/core/auth-storage.js +31 -41
  14. package/dist/core/auth-storage.js.map +1 -1
  15. package/dist/core/compaction/compaction.d.ts.map +1 -1
  16. package/dist/core/compaction/compaction.js +20 -7
  17. package/dist/core/compaction/compaction.js.map +1 -1
  18. package/dist/core/credential-pool/state-store.d.ts +1 -0
  19. package/dist/core/credential-pool/state-store.d.ts.map +1 -1
  20. package/dist/core/credential-pool/state-store.js +22 -2
  21. package/dist/core/credential-pool/state-store.js.map +1 -1
  22. package/dist/core/extensions/builtin/bash-timeout/index.d.ts.map +1 -1
  23. package/dist/core/extensions/builtin/bash-timeout/index.js +1 -5
  24. package/dist/core/extensions/builtin/bash-timeout/index.js.map +1 -1
  25. package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts +0 -2
  26. package/dist/core/extensions/builtin/bash-timeout/timeout.d.ts.map +1 -1
  27. package/dist/core/extensions/builtin/bash-timeout/timeout.js +3 -4
  28. package/dist/core/extensions/builtin/bash-timeout/timeout.js.map +1 -1
  29. package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.d.ts.map +1 -1
  30. package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js +2 -0
  31. package/dist/core/extensions/builtin/claude-sdk-oauth/prompt-bridge.js.map +1 -1
  32. package/dist/core/extensions/builtin/compaction/model-usability-budget.d.ts +5 -0
  33. package/dist/core/extensions/builtin/compaction/model-usability-budget.d.ts.map +1 -1
  34. package/dist/core/extensions/builtin/compaction/model-usability-budget.js +11 -4
  35. package/dist/core/extensions/builtin/compaction/model-usability-budget.js.map +1 -1
  36. package/dist/core/extensions/builtin/compaction/openai-remote-convert.d.ts.map +1 -1
  37. package/dist/core/extensions/builtin/compaction/openai-remote-convert.js +2 -0
  38. package/dist/core/extensions/builtin/compaction/openai-remote-convert.js.map +1 -1
  39. package/dist/core/extensions/builtin/goal/prompt.d.ts.map +1 -1
  40. package/dist/core/extensions/builtin/goal/prompt.js +1 -3
  41. package/dist/core/extensions/builtin/goal/prompt.js.map +1 -1
  42. package/dist/core/extensions/builtin/goal/store.d.ts.map +1 -1
  43. package/dist/core/extensions/builtin/goal/store.js +8 -20
  44. package/dist/core/extensions/builtin/goal/store.js.map +1 -1
  45. package/dist/core/extensions/builtin/goal/tool-registration.js +1 -1
  46. package/dist/core/extensions/builtin/goal/tool-registration.js.map +1 -1
  47. package/dist/core/extensions/builtin/hooks/trust-storage.d.ts.map +1 -1
  48. package/dist/core/extensions/builtin/hooks/trust-storage.js +3 -1
  49. package/dist/core/extensions/builtin/hooks/trust-storage.js.map +1 -1
  50. package/dist/core/extensions/builtin/imagegen/auth.d.ts.map +1 -1
  51. package/dist/core/extensions/builtin/imagegen/auth.js +10 -2
  52. package/dist/core/extensions/builtin/imagegen/auth.js.map +1 -1
  53. package/dist/core/extensions/builtin/loop/index.d.ts.map +1 -1
  54. package/dist/core/extensions/builtin/loop/index.js +20 -1
  55. package/dist/core/extensions/builtin/loop/index.js.map +1 -1
  56. package/dist/core/extensions/builtin/loop/store.d.ts +8 -6
  57. package/dist/core/extensions/builtin/loop/store.d.ts.map +1 -1
  58. package/dist/core/extensions/builtin/loop/store.js +54 -88
  59. package/dist/core/extensions/builtin/loop/store.js.map +1 -1
  60. package/dist/core/extensions/builtin/loop/tools.d.ts +6 -1
  61. package/dist/core/extensions/builtin/loop/tools.d.ts.map +1 -1
  62. package/dist/core/extensions/builtin/loop/tools.js +8 -1
  63. package/dist/core/extensions/builtin/loop/tools.js.map +1 -1
  64. package/dist/core/extensions/builtin/monitor-state-event.d.ts +2 -0
  65. package/dist/core/extensions/builtin/monitor-state-event.d.ts.map +1 -1
  66. package/dist/core/extensions/builtin/monitor-state-event.js.map +1 -1
  67. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts +10 -6
  68. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.d.ts.map +1 -1
  69. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js +27 -12
  70. package/dist/core/extensions/builtin/prompt-preset/gpt-6-astra.js.map +1 -1
  71. package/dist/core/extensions/builtin/recommended-models/index.d.ts +1 -1
  72. package/dist/core/extensions/builtin/recommended-models/index.d.ts.map +1 -1
  73. package/dist/core/extensions/builtin/recommended-models/index.js +1 -0
  74. package/dist/core/extensions/builtin/recommended-models/index.js.map +1 -1
  75. package/dist/core/extensions/builtin/service-tier.d.ts.map +1 -1
  76. package/dist/core/extensions/builtin/service-tier.js +12 -4
  77. package/dist/core/extensions/builtin/service-tier.js.map +1 -1
  78. package/dist/core/extensions/builtin/terminal/durable-command.d.ts +31 -0
  79. package/dist/core/extensions/builtin/terminal/durable-command.d.ts.map +1 -0
  80. package/dist/core/extensions/builtin/terminal/durable-command.js +96 -0
  81. package/dist/core/extensions/builtin/terminal/durable-command.js.map +1 -0
  82. package/dist/core/extensions/builtin/terminal/durable-file.d.ts +42 -0
  83. package/dist/core/extensions/builtin/terminal/durable-file.d.ts.map +1 -0
  84. package/dist/core/extensions/builtin/terminal/durable-file.js +102 -0
  85. package/dist/core/extensions/builtin/terminal/durable-file.js.map +1 -0
  86. package/dist/core/extensions/builtin/terminal/extension.d.ts.map +1 -1
  87. package/dist/core/extensions/builtin/terminal/extension.js +226 -3
  88. package/dist/core/extensions/builtin/terminal/extension.js.map +1 -1
  89. package/dist/core/extensions/builtin/terminal/manager.d.ts +10 -0
  90. package/dist/core/extensions/builtin/terminal/manager.d.ts.map +1 -1
  91. package/dist/core/extensions/builtin/terminal/manager.js +21 -0
  92. package/dist/core/extensions/builtin/terminal/manager.js.map +1 -1
  93. package/dist/core/extensions/builtin/terminal/manifest-lease.d.ts +24 -0
  94. package/dist/core/extensions/builtin/terminal/manifest-lease.d.ts.map +1 -0
  95. package/dist/core/extensions/builtin/terminal/manifest-lease.js +105 -0
  96. package/dist/core/extensions/builtin/terminal/manifest-lease.js.map +1 -0
  97. package/dist/core/extensions/builtin/terminal/monitor-notify.d.ts.map +1 -1
  98. package/dist/core/extensions/builtin/terminal/monitor-notify.js +5 -1
  99. package/dist/core/extensions/builtin/terminal/monitor-notify.js.map +1 -1
  100. package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts +42 -2
  101. package/dist/core/extensions/builtin/terminal/monitor-registry.d.ts.map +1 -1
  102. package/dist/core/extensions/builtin/terminal/monitor-registry.js +73 -2
  103. package/dist/core/extensions/builtin/terminal/monitor-registry.js.map +1 -1
  104. package/dist/core/extensions/builtin/terminal/monitor-status.d.ts.map +1 -1
  105. package/dist/core/extensions/builtin/terminal/monitor-status.js +21 -1
  106. package/dist/core/extensions/builtin/terminal/monitor-status.js.map +1 -1
  107. package/dist/core/extensions/builtin/terminal/prompt.d.ts.map +1 -1
  108. package/dist/core/extensions/builtin/terminal/prompt.js +9 -5
  109. package/dist/core/extensions/builtin/terminal/prompt.js.map +1 -1
  110. package/dist/core/extensions/builtin/terminal/restore.d.ts +56 -0
  111. package/dist/core/extensions/builtin/terminal/restore.d.ts.map +1 -0
  112. package/dist/core/extensions/builtin/terminal/restore.js +177 -0
  113. package/dist/core/extensions/builtin/terminal/restore.js.map +1 -0
  114. package/dist/core/extensions/builtin/terminal/shared.d.ts +25 -0
  115. package/dist/core/extensions/builtin/terminal/shared.d.ts.map +1 -1
  116. package/dist/core/extensions/builtin/terminal/shared.js +25 -0
  117. package/dist/core/extensions/builtin/terminal/shared.js.map +1 -1
  118. package/dist/core/extensions/builtin/terminal/terminal-manifest-model.d.ts +91 -0
  119. package/dist/core/extensions/builtin/terminal/terminal-manifest-model.d.ts.map +1 -0
  120. package/dist/core/extensions/builtin/terminal/terminal-manifest-model.js +14 -0
  121. package/dist/core/extensions/builtin/terminal/terminal-manifest-model.js.map +1 -0
  122. package/dist/core/extensions/builtin/terminal/terminal-manifest.d.ts +62 -0
  123. package/dist/core/extensions/builtin/terminal/terminal-manifest.d.ts.map +1 -0
  124. package/dist/core/extensions/builtin/terminal/terminal-manifest.js +204 -0
  125. package/dist/core/extensions/builtin/terminal/terminal-manifest.js.map +1 -0
  126. package/dist/core/extensions/builtin/terminal/tools/bash-input.d.ts.map +1 -1
  127. package/dist/core/extensions/builtin/terminal/tools/bash-input.js +3 -2
  128. package/dist/core/extensions/builtin/terminal/tools/bash-input.js.map +1 -1
  129. package/dist/core/extensions/builtin/terminal/tools/bash-output.d.ts.map +1 -1
  130. package/dist/core/extensions/builtin/terminal/tools/bash-output.js +5 -4
  131. package/dist/core/extensions/builtin/terminal/tools/bash-output.js.map +1 -1
  132. package/dist/core/extensions/builtin/terminal/tools/bash-resize.d.ts.map +1 -1
  133. package/dist/core/extensions/builtin/terminal/tools/bash-resize.js +3 -2
  134. package/dist/core/extensions/builtin/terminal/tools/bash-resize.js.map +1 -1
  135. package/dist/core/extensions/builtin/terminal/tools/context.d.ts +8 -0
  136. package/dist/core/extensions/builtin/terminal/tools/context.d.ts.map +1 -1
  137. package/dist/core/extensions/builtin/terminal/tools/context.js +10 -0
  138. package/dist/core/extensions/builtin/terminal/tools/context.js.map +1 -1
  139. package/dist/core/extensions/builtin/terminal/tools/kill-bash.d.ts.map +1 -1
  140. package/dist/core/extensions/builtin/terminal/tools/kill-bash.js +5 -4
  141. package/dist/core/extensions/builtin/terminal/tools/kill-bash.js.map +1 -1
  142. package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts +4 -1
  143. package/dist/core/extensions/builtin/terminal/tools/monitor.d.ts.map +1 -1
  144. package/dist/core/extensions/builtin/terminal/tools/monitor.js +114 -22
  145. package/dist/core/extensions/builtin/terminal/tools/monitor.js.map +1 -1
  146. package/dist/core/extensions/builtin/todotools/prompt.d.ts +2 -2
  147. package/dist/core/extensions/builtin/todotools/prompt.d.ts.map +1 -1
  148. package/dist/core/extensions/builtin/todotools/prompt.js +3 -6
  149. package/dist/core/extensions/builtin/todotools/prompt.js.map +1 -1
  150. package/dist/core/extensions/builtin/tool-search/index.d.ts.map +1 -1
  151. package/dist/core/extensions/builtin/tool-search/index.js +1 -1
  152. package/dist/core/extensions/builtin/tool-search/index.js.map +1 -1
  153. package/dist/core/extensions/builtin/tool-search/native-search.d.ts +9 -4
  154. package/dist/core/extensions/builtin/tool-search/native-search.d.ts.map +1 -1
  155. package/dist/core/extensions/builtin/tool-search/native-search.js +11 -6
  156. package/dist/core/extensions/builtin/tool-search/native-search.js.map +1 -1
  157. package/dist/core/extensions/builtin/tool-search/native-support.d.ts +13 -0
  158. package/dist/core/extensions/builtin/tool-search/native-support.d.ts.map +1 -0
  159. package/dist/core/extensions/builtin/tool-search/native-support.js +45 -0
  160. package/dist/core/extensions/builtin/tool-search/native-support.js.map +1 -0
  161. package/dist/core/extensions/index.d.ts +1 -1
  162. package/dist/core/extensions/index.d.ts.map +1 -1
  163. package/dist/core/extensions/index.js.map +1 -1
  164. package/dist/core/extensions/runner.d.ts +5 -0
  165. package/dist/core/extensions/runner.d.ts.map +1 -1
  166. package/dist/core/extensions/runner.js +44 -1
  167. package/dist/core/extensions/runner.js.map +1 -1
  168. package/dist/core/extensions/types.d.ts +26 -3
  169. package/dist/core/extensions/types.d.ts.map +1 -1
  170. package/dist/core/extensions/types.js.map +1 -1
  171. package/dist/core/footer-data-provider.d.ts.map +1 -1
  172. package/dist/core/footer-data-provider.js +18 -1
  173. package/dist/core/footer-data-provider.js.map +1 -1
  174. package/dist/core/http-dispatcher.d.ts.map +1 -1
  175. package/dist/core/http-dispatcher.js +2 -0
  176. package/dist/core/http-dispatcher.js.map +1 -1
  177. package/dist/core/lockfile-policy.d.ts +11 -0
  178. package/dist/core/lockfile-policy.d.ts.map +1 -1
  179. package/dist/core/lockfile-policy.js +19 -0
  180. package/dist/core/lockfile-policy.js.map +1 -1
  181. package/dist/core/manual-continue.d.ts +13 -0
  182. package/dist/core/manual-continue.d.ts.map +1 -0
  183. package/dist/core/manual-continue.js +19 -0
  184. package/dist/core/manual-continue.js.map +1 -0
  185. package/dist/core/messages.d.ts +7 -0
  186. package/dist/core/messages.d.ts.map +1 -1
  187. package/dist/core/messages.js +10 -2
  188. package/dist/core/messages.js.map +1 -1
  189. package/dist/core/model-config.d.ts.map +1 -1
  190. package/dist/core/model-config.js +3 -0
  191. package/dist/core/model-config.js.map +1 -1
  192. package/dist/core/provider-composer.d.ts.map +1 -1
  193. package/dist/core/provider-composer.js +13 -2
  194. package/dist/core/provider-composer.js.map +1 -1
  195. package/dist/core/retry-fallback/chains.d.ts +1 -13
  196. package/dist/core/retry-fallback/chains.d.ts.map +1 -1
  197. package/dist/core/retry-fallback/chains.js +3 -49
  198. package/dist/core/retry-fallback/chains.js.map +1 -1
  199. package/dist/core/retry-fallback/controller.d.ts.map +1 -1
  200. package/dist/core/retry-fallback/controller.js +4 -9
  201. package/dist/core/retry-fallback/controller.js.map +1 -1
  202. package/dist/core/retry-fallback/expansion.js +1 -1
  203. package/dist/core/retry-fallback/expansion.js.map +1 -1
  204. package/dist/core/retry-fallback/settings.d.ts +2 -4
  205. package/dist/core/retry-fallback/settings.d.ts.map +1 -1
  206. package/dist/core/retry-fallback/settings.js +7 -36
  207. package/dist/core/retry-fallback/settings.js.map +1 -1
  208. package/dist/core/sdk.d.ts.map +1 -1
  209. package/dist/core/sdk.js +6 -1
  210. package/dist/core/sdk.js.map +1 -1
  211. package/dist/core/session-manager.d.ts +12 -1
  212. package/dist/core/session-manager.d.ts.map +1 -1
  213. package/dist/core/session-manager.js +39 -6
  214. package/dist/core/session-manager.js.map +1 -1
  215. package/dist/core/session-sidecar-store.d.ts +62 -0
  216. package/dist/core/session-sidecar-store.d.ts.map +1 -0
  217. package/dist/core/session-sidecar-store.js +149 -0
  218. package/dist/core/session-sidecar-store.js.map +1 -0
  219. package/dist/core/settings-manager.d.ts +5 -1
  220. package/dist/core/settings-manager.d.ts.map +1 -1
  221. package/dist/core/settings-manager.js +45 -15
  222. package/dist/core/settings-manager.js.map +1 -1
  223. package/dist/core/skills.d.ts.map +1 -1
  224. package/dist/core/skills.js +19 -2
  225. package/dist/core/skills.js.map +1 -1
  226. package/dist/core/terminal-settings.d.ts +3 -0
  227. package/dist/core/terminal-settings.d.ts.map +1 -1
  228. package/dist/core/terminal-settings.js.map +1 -1
  229. package/dist/core/tools/bash.d.ts.map +1 -1
  230. package/dist/core/tools/bash.js +1 -1
  231. package/dist/core/tools/bash.js.map +1 -1
  232. package/dist/core/tools/edit.d.ts.map +1 -1
  233. package/dist/core/tools/edit.js +2 -2
  234. package/dist/core/tools/edit.js.map +1 -1
  235. package/dist/core/tools/find.d.ts.map +1 -1
  236. package/dist/core/tools/find.js +2 -2
  237. package/dist/core/tools/find.js.map +1 -1
  238. package/dist/core/tools/grep.d.ts.map +1 -1
  239. package/dist/core/tools/grep.js +2 -2
  240. package/dist/core/tools/grep.js.map +1 -1
  241. package/dist/core/tools/ls.d.ts.map +1 -1
  242. package/dist/core/tools/ls.js +2 -2
  243. package/dist/core/tools/ls.js.map +1 -1
  244. package/dist/core/tools/read.d.ts.map +1 -1
  245. package/dist/core/tools/read.js +1 -1
  246. package/dist/core/tools/read.js.map +1 -1
  247. package/dist/core/tools/write.d.ts.map +1 -1
  248. package/dist/core/tools/write.js +3 -3
  249. package/dist/core/tools/write.js.map +1 -1
  250. package/dist/index.d.ts +1 -1
  251. package/dist/index.d.ts.map +1 -1
  252. package/dist/index.js.map +1 -1
  253. package/dist/main.d.ts.map +1 -1
  254. package/dist/main.js +2 -0
  255. package/dist/main.js.map +1 -1
  256. package/dist/modes/app-server/daemon/process.d.ts +33 -3
  257. package/dist/modes/app-server/daemon/process.d.ts.map +1 -1
  258. package/dist/modes/app-server/daemon/process.js +57 -6
  259. package/dist/modes/app-server/daemon/process.js.map +1 -1
  260. package/dist/modes/app-server/daemon.js +9 -1
  261. package/dist/modes/app-server/daemon.js.map +1 -1
  262. package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
  263. package/dist/modes/interactive/components/scoped-models-selector.js +5 -11
  264. package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
  265. package/dist/modes/interactive/components/settings-selector.d.ts +2 -0
  266. package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
  267. package/dist/modes/interactive/components/settings-selector.js +21 -8
  268. package/dist/modes/interactive/components/settings-selector.js.map +1 -1
  269. package/dist/modes/interactive/components/thinking-selector.js +2 -2
  270. package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
  271. package/dist/modes/interactive/components/trust-selector.js +2 -2
  272. package/dist/modes/interactive/components/trust-selector.js.map +1 -1
  273. package/dist/modes/interactive/grok/welcome-card.d.ts.map +1 -1
  274. package/dist/modes/interactive/grok/welcome-card.js +5 -2
  275. package/dist/modes/interactive/grok/welcome-card.js.map +1 -1
  276. package/dist/modes/interactive/interactive-mode.d.ts +3 -0
  277. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  278. package/dist/modes/interactive/interactive-mode.js +86 -14
  279. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  280. package/dist/modes/interactive/version-label.d.ts +7 -0
  281. package/dist/modes/interactive/version-label.d.ts.map +1 -0
  282. package/dist/modes/interactive/version-label.js +9 -0
  283. package/dist/modes/interactive/version-label.js.map +1 -0
  284. package/dist/modes/rpc/host-ensure.d.ts +2 -0
  285. package/dist/modes/rpc/host-ensure.d.ts.map +1 -1
  286. package/dist/modes/rpc/host-ensure.js +77 -18
  287. package/dist/modes/rpc/host-ensure.js.map +1 -1
  288. package/dist/utils/version-check.d.ts.map +1 -1
  289. package/dist/utils/version-check.js +3 -4
  290. package/dist/utils/version-check.js.map +1 -1
  291. package/docs/compaction.md +2 -0
  292. package/docs/environment-variables.md +5 -0
  293. package/docs/extensions.md +22 -2
  294. package/docs/keybindings.md +1 -1
  295. package/docs/models.md +3 -0
  296. package/docs/quickstart.md +1 -1
  297. package/docs/rpc.md +1 -1
  298. package/docs/settings.md +13 -5
  299. package/docs/terminal-setup.md +27 -0
  300. package/docs/terminal-tools.md +35 -4
  301. package/docs/usage.md +5 -3
  302. package/node_modules/@anthropic-ai/sdk/CHANGELOG.md +96 -0
  303. package/node_modules/@anthropic-ai/sdk/README.md +1 -1
  304. package/node_modules/@anthropic-ai/sdk/core/credentials.d.mts.map +1 -1
  305. package/node_modules/@anthropic-ai/sdk/core/credentials.d.ts.map +1 -1
  306. package/node_modules/@anthropic-ai/sdk/core/credentials.js +5 -7
  307. package/node_modules/@anthropic-ai/sdk/core/credentials.js.map +1 -1
  308. package/node_modules/@anthropic-ai/sdk/core/credentials.mjs +5 -7
  309. package/node_modules/@anthropic-ai/sdk/core/credentials.mjs.map +1 -1
  310. package/node_modules/@anthropic-ai/sdk/core/middleware.d.mts.map +1 -1
  311. package/node_modules/@anthropic-ai/sdk/core/middleware.d.ts.map +1 -1
  312. package/node_modules/@anthropic-ai/sdk/core/middleware.js +4 -4
  313. package/node_modules/@anthropic-ai/sdk/core/middleware.js.map +1 -1
  314. package/node_modules/@anthropic-ai/sdk/core/middleware.mjs +4 -4
  315. package/node_modules/@anthropic-ai/sdk/core/middleware.mjs.map +1 -1
  316. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.mts +45 -0
  317. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.mts.map +1 -0
  318. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.ts +45 -0
  319. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.d.ts.map +1 -0
  320. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.js +58 -0
  321. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.js.map +1 -0
  322. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.mjs +54 -0
  323. package/node_modules/@anthropic-ai/sdk/helpers/beta/standard-schema.mjs.map +1 -0
  324. package/node_modules/@anthropic-ai/sdk/internal/detect-platform.js +1 -1
  325. package/node_modules/@anthropic-ai/sdk/internal/detect-platform.js.map +1 -1
  326. package/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs +1 -1
  327. package/node_modules/@anthropic-ai/sdk/internal/detect-platform.mjs.map +1 -1
  328. package/node_modules/@anthropic-ai/sdk/internal/errors.d.mts.map +1 -1
  329. package/node_modules/@anthropic-ai/sdk/internal/errors.d.ts.map +1 -1
  330. package/node_modules/@anthropic-ai/sdk/internal/errors.js +3 -1
  331. package/node_modules/@anthropic-ai/sdk/internal/errors.js.map +1 -1
  332. package/node_modules/@anthropic-ai/sdk/internal/errors.mjs +3 -1
  333. package/node_modules/@anthropic-ai/sdk/internal/errors.mjs.map +1 -1
  334. package/node_modules/@anthropic-ai/sdk/internal/file-store.d.mts.map +1 -1
  335. package/node_modules/@anthropic-ai/sdk/internal/file-store.d.ts.map +1 -1
  336. package/node_modules/@anthropic-ai/sdk/internal/file-store.js +23 -25
  337. package/node_modules/@anthropic-ai/sdk/internal/file-store.js.map +1 -1
  338. package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs +5 -6
  339. package/node_modules/@anthropic-ai/sdk/internal/file-store.mjs.map +1 -1
  340. package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.mts +9 -0
  341. package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.mts.map +1 -0
  342. package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.ts +9 -0
  343. package/node_modules/@anthropic-ai/sdk/internal/node.browser.d.ts.map +1 -0
  344. package/node_modules/@anthropic-ai/sdk/internal/node.browser.js +22 -0
  345. package/node_modules/@anthropic-ai/sdk/internal/node.browser.js.map +1 -0
  346. package/node_modules/@anthropic-ai/sdk/internal/node.browser.mjs +19 -0
  347. package/node_modules/@anthropic-ai/sdk/internal/node.browser.mjs.map +1 -0
  348. package/node_modules/@anthropic-ai/sdk/internal/node.d.mts +14 -0
  349. package/node_modules/@anthropic-ai/sdk/internal/node.d.mts.map +1 -0
  350. package/node_modules/@anthropic-ai/sdk/internal/node.d.ts +14 -0
  351. package/node_modules/@anthropic-ai/sdk/internal/node.d.ts.map +1 -0
  352. package/node_modules/@anthropic-ai/sdk/internal/node.js +24 -0
  353. package/node_modules/@anthropic-ai/sdk/internal/node.js.map +1 -0
  354. package/node_modules/@anthropic-ai/sdk/internal/node.mjs +14 -0
  355. package/node_modules/@anthropic-ai/sdk/internal/node.mjs.map +1 -0
  356. package/node_modules/@anthropic-ai/sdk/internal/parse.js +1 -1
  357. package/node_modules/@anthropic-ai/sdk/internal/parse.js.map +1 -1
  358. package/node_modules/@anthropic-ai/sdk/internal/parse.mjs +1 -1
  359. package/node_modules/@anthropic-ai/sdk/internal/parse.mjs.map +1 -1
  360. package/node_modules/@anthropic-ai/sdk/internal/uploads.js +10 -6
  361. package/node_modules/@anthropic-ai/sdk/internal/uploads.js.map +1 -1
  362. package/node_modules/@anthropic-ai/sdk/internal/uploads.mjs +10 -6
  363. package/node_modules/@anthropic-ai/sdk/internal/uploads.mjs.map +1 -1
  364. package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.mts +6 -0
  365. package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.mts.map +1 -1
  366. package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.ts +6 -0
  367. package/node_modules/@anthropic-ai/sdk/internal/utils/values.d.ts.map +1 -1
  368. package/node_modules/@anthropic-ai/sdk/internal/utils/values.js +7 -0
  369. package/node_modules/@anthropic-ai/sdk/internal/utils/values.js.map +1 -1
  370. package/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs +6 -0
  371. package/node_modules/@anthropic-ai/sdk/internal/utils/values.mjs.map +1 -1
  372. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.mts.map +1 -1
  373. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.d.ts.map +1 -1
  374. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js +6 -4
  375. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.js.map +1 -1
  376. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs +4 -2
  377. package/node_modules/@anthropic-ai/sdk/lib/BetaMessageStream.mjs.map +1 -1
  378. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.mts.map +1 -1
  379. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.d.ts.map +1 -1
  380. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js +3 -4
  381. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.js.map +1 -1
  382. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs +1 -2
  383. package/node_modules/@anthropic-ai/sdk/lib/MessageStream.mjs.map +1 -1
  384. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js +1 -1
  385. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.js.map +1 -1
  386. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs +1 -1
  387. package/node_modules/@anthropic-ai/sdk/lib/credentials/credential-chain.mjs.map +1 -1
  388. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js +1 -1
  389. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.js.map +1 -1
  390. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs +1 -1
  391. package/node_modules/@anthropic-ai/sdk/lib/credentials/identity-token.mjs.map +1 -1
  392. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.mts.map +1 -1
  393. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.d.ts.map +1 -1
  394. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js +2 -3
  395. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.js.map +1 -1
  396. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs +2 -3
  397. package/node_modules/@anthropic-ai/sdk/lib/credentials/types.mjs.map +1 -1
  398. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js +1 -1
  399. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.js.map +1 -1
  400. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs +1 -1
  401. package/node_modules/@anthropic-ai/sdk/lib/credentials/user-oauth.mjs.map +1 -1
  402. package/node_modules/@anthropic-ai/sdk/lib/middleware.d.mts.map +1 -1
  403. package/node_modules/@anthropic-ai/sdk/lib/middleware.d.ts.map +1 -1
  404. package/node_modules/@anthropic-ai/sdk/lib/middleware.js +30 -7
  405. package/node_modules/@anthropic-ai/sdk/lib/middleware.js.map +1 -1
  406. package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs +30 -7
  407. package/node_modules/@anthropic-ai/sdk/lib/middleware.mjs.map +1 -1
  408. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts +3 -2
  409. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.mts.map +1 -1
  410. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts +3 -2
  411. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.d.ts.map +1 -1
  412. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js +3 -46
  413. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.js.map +1 -1
  414. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs +3 -46
  415. package/node_modules/@anthropic-ai/sdk/lib/sessions/accumulate.mjs.map +1 -1
  416. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.mts +131 -0
  417. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.mts.map +1 -0
  418. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.ts +131 -0
  419. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.d.ts.map +1 -0
  420. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.js +45 -0
  421. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.js.map +1 -0
  422. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.mjs +41 -0
  423. package/node_modules/@anthropic-ai/sdk/lib/standard-schema.mjs.map +1 -0
  424. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.mts.map +1 -1
  425. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.d.ts.map +1 -1
  426. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js +35 -6
  427. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.js.map +1 -1
  428. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs +35 -6
  429. package/node_modules/@anthropic-ai/sdk/lib/tools/BetaToolRunner.mjs.map +1 -1
  430. package/node_modules/@anthropic-ai/sdk/package.json +4 -11
  431. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts +1 -1
  432. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.mts.map +1 -1
  433. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts +1 -1
  434. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.d.ts.map +1 -1
  435. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.js.map +1 -1
  436. package/node_modules/@anthropic-ai/sdk/resources/beta/agents/agents.mjs.map +1 -1
  437. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts +13 -9
  438. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.mts.map +1 -1
  439. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts +13 -9
  440. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.d.ts.map +1 -1
  441. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js +4 -0
  442. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.js.map +1 -1
  443. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs +4 -0
  444. package/node_modules/@anthropic-ai/sdk/resources/beta/beta.mjs.map +1 -1
  445. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.mts +6 -6
  446. package/node_modules/@anthropic-ai/sdk/resources/beta/deployment-runs.d.ts +6 -6
  447. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts +3 -2
  448. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.mts.map +1 -1
  449. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts +3 -2
  450. package/node_modules/@anthropic-ai/sdk/resources/beta/deployments.d.ts.map +1 -1
  451. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts +28 -1
  452. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.mts.map +1 -1
  453. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts +28 -1
  454. package/node_modules/@anthropic-ai/sdk/resources/beta/dreams.d.ts.map +1 -1
  455. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts +8 -1
  456. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.mts.map +1 -1
  457. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts +8 -1
  458. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.d.ts.map +1 -1
  459. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.js.map +1 -1
  460. package/node_modules/@anthropic-ai/sdk/resources/beta/environments/environments.mjs.map +1 -1
  461. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts +25 -5
  462. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.mts.map +1 -1
  463. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts +25 -5
  464. package/node_modules/@anthropic-ai/sdk/resources/beta/files.d.ts.map +1 -1
  465. package/node_modules/@anthropic-ai/sdk/resources/beta/files.js +6 -6
  466. package/node_modules/@anthropic-ai/sdk/resources/beta/files.js.map +1 -1
  467. package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs +7 -7
  468. package/node_modules/@anthropic-ai/sdk/resources/beta/files.mjs.map +1 -1
  469. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts +5 -4
  470. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.mts.map +1 -1
  471. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts +5 -4
  472. package/node_modules/@anthropic-ai/sdk/resources/beta/index.d.ts.map +1 -1
  473. package/node_modules/@anthropic-ai/sdk/resources/beta/index.js +11 -9
  474. package/node_modules/@anthropic-ai/sdk/resources/beta/index.js.map +1 -1
  475. package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs +1 -0
  476. package/node_modules/@anthropic-ai/sdk/resources/beta/index.mjs.map +1 -1
  477. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts +12 -9
  478. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.mts.map +1 -1
  479. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts +12 -9
  480. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memories.d.ts.map +1 -1
  481. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts +8 -5
  482. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.mts.map +1 -1
  483. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts +8 -5
  484. package/node_modules/@anthropic-ai/sdk/resources/beta/memory-stores/memory-versions.d.ts.map +1 -1
  485. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts +1 -1
  486. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.mts.map +1 -1
  487. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts +1 -1
  488. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.d.ts.map +1 -1
  489. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.js.map +1 -1
  490. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/index.mjs.map +1 -1
  491. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts +198 -29
  492. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.mts.map +1 -1
  493. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts +198 -29
  494. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.d.ts.map +1 -1
  495. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.js.map +1 -1
  496. package/node_modules/@anthropic-ai/sdk/resources/beta/messages/messages.mjs.map +1 -1
  497. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.mts +177 -0
  498. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.mts.map +1 -0
  499. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.ts +177 -0
  500. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.d.ts.map +1 -0
  501. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.js +56 -0
  502. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.js.map +1 -0
  503. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.mjs +52 -0
  504. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/api-keys.mjs.map +1 -0
  505. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.mts +74 -0
  506. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.mts.map +1 -0
  507. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.ts +74 -0
  508. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.d.ts.map +1 -0
  509. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.js +52 -0
  510. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.js.map +1 -0
  511. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.mjs +48 -0
  512. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/compliance-settings.mjs.map +1 -0
  513. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.mts +272 -0
  514. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.mts.map +1 -0
  515. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.ts +272 -0
  516. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.d.ts.map +1 -0
  517. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.js +119 -0
  518. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.js.map +1 -0
  519. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.mjs +115 -0
  520. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/external-keys.mjs.map +1 -0
  521. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.mts +14 -0
  522. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.mts.map +1 -0
  523. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.ts +14 -0
  524. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.d.ts.map +1 -0
  525. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.js +21 -0
  526. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.js.map +1 -0
  527. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.mjs +16 -0
  528. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/federation.mjs.map +1 -0
  529. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.mts +4 -0
  530. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.mts.map +1 -0
  531. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.ts +4 -0
  532. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.d.ts.map +1 -0
  533. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.js +11 -0
  534. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.js.map +1 -0
  535. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.mjs +5 -0
  536. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/index.mjs.map +1 -0
  537. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.mts +353 -0
  538. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.mts.map +1 -0
  539. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.ts +353 -0
  540. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.d.ts.map +1 -0
  541. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.js +169 -0
  542. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.js.map +1 -0
  543. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.mjs +165 -0
  544. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/issuers.mjs.map +1 -0
  545. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.mts +3 -0
  546. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.mts.map +1 -0
  547. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.ts +3 -0
  548. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.d.ts.map +1 -0
  549. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.js +9 -0
  550. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.js.map +1 -0
  551. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.mjs +4 -0
  552. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/index.mjs.map +1 -0
  553. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.mts +468 -0
  554. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.mts.map +1 -0
  555. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.ts +468 -0
  556. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.d.ts.map +1 -0
  557. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.js +198 -0
  558. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.js.map +1 -0
  559. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.mjs +193 -0
  560. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/rules.mjs.map +1 -0
  561. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.mts +124 -0
  562. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.mts.map +1 -0
  563. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.ts +124 -0
  564. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.d.ts.map +1 -0
  565. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.js +114 -0
  566. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.js.map +1 -0
  567. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.mjs +110 -0
  568. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules/workspaces.mjs.map +1 -0
  569. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.mts +2 -0
  570. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.mts.map +1 -0
  571. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.ts +2 -0
  572. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.d.ts.map +1 -0
  573. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.js +6 -0
  574. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.js.map +1 -0
  575. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.mjs +3 -0
  576. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation/rules.mjs.map +1 -0
  577. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.mts +2 -0
  578. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.mts.map +1 -0
  579. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.ts +2 -0
  580. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.d.ts.map +1 -0
  581. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.js +6 -0
  582. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.js.map +1 -0
  583. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.mjs +3 -0
  584. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/federation.mjs.map +1 -0
  585. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.mts +11 -0
  586. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.mts.map +1 -0
  587. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.ts +11 -0
  588. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.d.ts.map +1 -0
  589. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.js +25 -0
  590. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.js.map +1 -0
  591. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.mjs +12 -0
  592. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/index.mjs.map +1 -0
  593. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.mts +162 -0
  594. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.mts.map +1 -0
  595. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.ts +162 -0
  596. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.d.ts.map +1 -0
  597. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.js +76 -0
  598. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.js.map +1 -0
  599. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.mjs +72 -0
  600. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/invites.mjs.map +1 -0
  601. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.mts +73 -0
  602. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.mts.map +1 -0
  603. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.ts +73 -0
  604. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.d.ts.map +1 -0
  605. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.js +62 -0
  606. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.js.map +1 -0
  607. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.mjs +57 -0
  608. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/organization.mjs.map +1 -0
  609. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.mts +77 -0
  610. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.mts.map +1 -0
  611. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.ts +77 -0
  612. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.d.ts.map +1 -0
  613. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.js +31 -0
  614. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.js.map +1 -0
  615. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.mjs +27 -0
  616. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/rate-limits.mjs.map +1 -0
  617. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.mts +3 -0
  618. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.mts.map +1 -0
  619. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.ts +3 -0
  620. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.d.ts.map +1 -0
  621. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.js +9 -0
  622. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.js.map +1 -0
  623. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.mjs +4 -0
  624. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/index.mjs.map +1 -0
  625. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.mts +258 -0
  626. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.mts.map +1 -0
  627. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.ts +258 -0
  628. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.d.ts.map +1 -0
  629. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.js +174 -0
  630. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.js.map +1 -0
  631. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.mjs +169 -0
  632. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/service-accounts.mjs.map +1 -0
  633. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.mts +141 -0
  634. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.mts.map +1 -0
  635. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.ts +141 -0
  636. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.d.ts.map +1 -0
  637. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.js +125 -0
  638. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.js.map +1 -0
  639. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.mjs +121 -0
  640. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts/workspaces.mjs.map +1 -0
  641. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.mts +2 -0
  642. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.mts.map +1 -0
  643. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.ts +2 -0
  644. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.d.ts.map +1 -0
  645. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.js +6 -0
  646. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.js.map +1 -0
  647. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.mjs +3 -0
  648. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/service-accounts.mjs.map +1 -0
  649. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.mts +124 -0
  650. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.mts.map +1 -0
  651. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.ts +124 -0
  652. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.d.ts.map +1 -0
  653. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.js +67 -0
  654. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.js.map +1 -0
  655. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.mjs +63 -0
  656. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/users.mjs.map +1 -0
  657. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.mts +5 -0
  658. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.mts.map +1 -0
  659. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.ts +5 -0
  660. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.d.ts.map +1 -0
  661. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.js +13 -0
  662. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.js.map +1 -0
  663. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.mjs +6 -0
  664. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/index.mjs.map +1 -0
  665. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.mts +135 -0
  666. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.mts.map +1 -0
  667. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.ts +135 -0
  668. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.d.ts.map +1 -0
  669. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.js +102 -0
  670. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.js.map +1 -0
  671. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.mjs +98 -0
  672. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/members.mjs.map +1 -0
  673. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.mts +83 -0
  674. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.mts.map +1 -0
  675. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.ts +83 -0
  676. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.d.ts.map +1 -0
  677. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.js +34 -0
  678. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.js.map +1 -0
  679. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.mjs +30 -0
  680. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/rate-limits.mjs.map +1 -0
  681. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.mts +210 -0
  682. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.mts.map +1 -0
  683. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.ts +210 -0
  684. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.d.ts.map +1 -0
  685. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.js +189 -0
  686. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.js.map +1 -0
  687. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.mjs +185 -0
  688. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/service-accounts.mjs.map +1 -0
  689. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.mts +303 -0
  690. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.mts.map +1 -0
  691. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.ts +303 -0
  692. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.d.ts.map +1 -0
  693. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.js +112 -0
  694. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.js.map +1 -0
  695. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.mjs +107 -0
  696. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces/workspaces.mjs.map +1 -0
  697. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.mts +2 -0
  698. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.mts.map +1 -0
  699. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.ts +2 -0
  700. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.d.ts.map +1 -0
  701. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.js +6 -0
  702. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.js.map +1 -0
  703. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.mjs +3 -0
  704. package/node_modules/@anthropic-ai/sdk/resources/beta/organization/workspaces.mjs.map +1 -0
  705. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.mts +2 -0
  706. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.mts.map +1 -0
  707. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.ts +2 -0
  708. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.d.ts.map +1 -0
  709. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.js +6 -0
  710. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.js.map +1 -0
  711. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.mjs +3 -0
  712. package/node_modules/@anthropic-ai/sdk/resources/beta/organization.mjs.map +1 -0
  713. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.mts +1 -1
  714. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/events.d.ts +1 -1
  715. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.mts +10 -10
  716. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/sessions.d.ts +10 -10
  717. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts +2 -1
  718. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.mts.map +1 -1
  719. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts +2 -1
  720. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.d.ts.map +1 -1
  721. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.js.map +1 -1
  722. package/node_modules/@anthropic-ai/sdk/resources/beta/sessions/threads/threads.mjs.map +1 -1
  723. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts +2 -2
  724. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.mts.map +1 -1
  725. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts +2 -2
  726. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.d.ts.map +1 -1
  727. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.js.map +1 -1
  728. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/index.mjs.map +1 -1
  729. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts +48 -120
  730. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.mts.map +1 -1
  731. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts +48 -120
  732. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.d.ts.map +1 -1
  733. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js +12 -8
  734. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.js.map +1 -1
  735. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs +12 -8
  736. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/skills.mjs.map +1 -1
  737. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts +35 -138
  738. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.mts.map +1 -1
  739. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts +35 -138
  740. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.d.ts.map +1 -1
  741. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js +18 -18
  742. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.js.map +1 -1
  743. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs +18 -18
  744. package/node_modules/@anthropic-ai/sdk/resources/beta/skills/versions.mjs.map +1 -1
  745. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts +21 -25
  746. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.mts.map +1 -1
  747. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts +21 -25
  748. package/node_modules/@anthropic-ai/sdk/resources/beta/user-profiles.d.ts.map +1 -1
  749. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts +16 -17
  750. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.mts.map +1 -1
  751. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts +16 -17
  752. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.d.ts.map +1 -1
  753. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js +21 -8
  754. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.js.map +1 -1
  755. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs +21 -8
  756. package/node_modules/@anthropic-ai/sdk/resources/beta/webhooks.mjs.map +1 -1
  757. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts +1 -3
  758. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.mts.map +1 -1
  759. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts +1 -3
  760. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.d.ts.map +1 -1
  761. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.js.map +1 -1
  762. package/node_modules/@anthropic-ai/sdk/resources/messages/messages.mjs.map +1 -1
  763. package/node_modules/@anthropic-ai/sdk/src/core/credentials.ts +5 -7
  764. package/node_modules/@anthropic-ai/sdk/src/core/middleware.ts +4 -3
  765. package/node_modules/@anthropic-ai/sdk/src/helpers/beta/standard-schema.ts +99 -0
  766. package/node_modules/@anthropic-ai/sdk/src/internal/detect-platform.ts +1 -1
  767. package/node_modules/@anthropic-ai/sdk/src/internal/errors.ts +3 -1
  768. package/node_modules/@anthropic-ai/sdk/src/internal/file-store.ts +11 -10
  769. package/node_modules/@anthropic-ai/sdk/src/internal/node.browser.ts +22 -0
  770. package/node_modules/@anthropic-ai/sdk/src/internal/node.ts +14 -0
  771. package/node_modules/@anthropic-ai/sdk/src/internal/parse.ts +1 -1
  772. package/node_modules/@anthropic-ai/sdk/src/internal/uploads.ts +10 -7
  773. package/node_modules/@anthropic-ai/sdk/src/internal/utils/values.ts +7 -0
  774. package/node_modules/@anthropic-ai/sdk/src/lib/BetaMessageStream.ts +5 -3
  775. package/node_modules/@anthropic-ai/sdk/src/lib/MessageStream.ts +1 -3
  776. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/credential-chain.ts +1 -1
  777. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/identity-token.ts +1 -1
  778. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/types.ts +2 -3
  779. package/node_modules/@anthropic-ai/sdk/src/lib/credentials/user-oauth.ts +1 -1
  780. package/node_modules/@anthropic-ai/sdk/src/lib/middleware.ts +33 -9
  781. package/node_modules/@anthropic-ai/sdk/src/lib/sessions/accumulate.ts +7 -49
  782. package/node_modules/@anthropic-ai/sdk/src/lib/standard-schema.ts +209 -0
  783. package/node_modules/@anthropic-ai/sdk/src/lib/tools/BetaToolRunner.ts +38 -6
  784. package/node_modules/@anthropic-ai/sdk/src/resources/beta/agents/agents.ts +1 -0
  785. package/node_modules/@anthropic-ai/sdk/src/resources/beta/beta.ts +45 -15
  786. package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployment-runs.ts +6 -6
  787. package/node_modules/@anthropic-ai/sdk/src/resources/beta/deployments.ts +3 -2
  788. package/node_modules/@anthropic-ai/sdk/src/resources/beta/dreams.ts +42 -0
  789. package/node_modules/@anthropic-ai/sdk/src/resources/beta/environments/environments.ts +8 -1
  790. package/node_modules/@anthropic-ai/sdk/src/resources/beta/files.ts +34 -11
  791. package/node_modules/@anthropic-ai/sdk/src/resources/beta/index.ts +13 -7
  792. package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memories.ts +12 -9
  793. package/node_modules/@anthropic-ai/sdk/src/resources/beta/memory-stores/memory-versions.ts +8 -5
  794. package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/index.ts +5 -1
  795. package/node_modules/@anthropic-ai/sdk/src/resources/beta/messages/messages.ts +221 -38
  796. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/api-keys.ts +231 -0
  797. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/compliance-settings.ts +96 -0
  798. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/external-keys.ts +365 -0
  799. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/federation.ts +71 -0
  800. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/index.ts +31 -0
  801. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/issuers.ts +486 -0
  802. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules/index.ts +23 -0
  803. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules/rules.ts +624 -0
  804. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules/workspaces.ts +196 -0
  805. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation/rules.ts +3 -0
  806. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/federation.ts +3 -0
  807. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/index.ts +92 -0
  808. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/invites.ts +207 -0
  809. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/organization.ts +269 -0
  810. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/rate-limits.ts +104 -0
  811. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts/index.ts +21 -0
  812. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts/service-accounts.ts +389 -0
  813. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts/workspaces.ts +217 -0
  814. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/service-accounts.ts +3 -0
  815. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/users.ts +163 -0
  816. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/index.ts +43 -0
  817. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/members.ts +209 -0
  818. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/rate-limits.ts +113 -0
  819. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/service-accounts.ts +325 -0
  820. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces/workspaces.ts +450 -0
  821. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization/workspaces.ts +3 -0
  822. package/node_modules/@anthropic-ai/sdk/src/resources/beta/organization.ts +3 -0
  823. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/events.ts +1 -1
  824. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/sessions.ts +10 -10
  825. package/node_modules/@anthropic-ai/sdk/src/resources/beta/sessions/threads/threads.ts +2 -1
  826. package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/index.ts +7 -10
  827. package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/skills.ts +60 -150
  828. package/node_modules/@anthropic-ai/sdk/src/resources/beta/skills/versions.ts +43 -166
  829. package/node_modules/@anthropic-ai/sdk/src/resources/beta/user-profiles.ts +24 -27
  830. package/node_modules/@anthropic-ai/sdk/src/resources/beta/webhooks.ts +25 -29
  831. package/node_modules/@anthropic-ai/sdk/src/resources/messages/messages.ts +2 -8
  832. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/fs-util.ts +6 -5
  833. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/memories.ts +5 -3
  834. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.browser.ts +1 -5
  835. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/node.ts +122 -17
  836. package/node_modules/@anthropic-ai/sdk/src/tools/agent-toolset/skills.ts +10 -43
  837. package/node_modules/@anthropic-ai/sdk/src/version.ts +1 -1
  838. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.mts.map +1 -1
  839. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.d.ts.map +1 -1
  840. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js +13 -15
  841. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.js.map +1 -1
  842. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs +3 -4
  843. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/fs-util.mjs.map +1 -1
  844. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.mts.map +1 -1
  845. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.d.ts.map +1 -1
  846. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js +6 -4
  847. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.js.map +1 -1
  848. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs +5 -3
  849. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/memories.mjs.map +1 -1
  850. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts +1 -2
  851. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.mts.map +1 -1
  852. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts +1 -2
  853. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.d.ts.map +1 -1
  854. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js +0 -4
  855. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.js.map +1 -1
  856. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs +0 -3
  857. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.browser.mjs.map +1 -1
  858. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts +11 -9
  859. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.mts.map +1 -1
  860. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts +11 -9
  861. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.d.ts.map +1 -1
  862. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js +96 -8
  863. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.js.map +1 -1
  864. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs +96 -7
  865. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/node.mjs.map +1 -1
  866. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts +0 -8
  867. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.mts.map +1 -1
  868. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts +0 -8
  869. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.d.ts.map +1 -1
  870. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js +20 -46
  871. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.js.map +1 -1
  872. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs +9 -33
  873. package/node_modules/@anthropic-ai/sdk/tools/agent-toolset/skills.mjs.map +1 -1
  874. package/node_modules/@anthropic-ai/sdk/version.d.mts +1 -1
  875. package/node_modules/@anthropic-ai/sdk/version.d.ts +1 -1
  876. package/node_modules/@anthropic-ai/sdk/version.js +1 -1
  877. package/node_modules/@anthropic-ai/sdk/version.mjs +1 -1
  878. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +71 -0
  879. package/node_modules/@code-yeongyu/senpi-codemode/README.md +4 -2
  880. package/node_modules/@code-yeongyu/senpi-codemode/package.json +5 -5
  881. package/node_modules/@code-yeongyu/senpi-codemode/src/config/settings.ts +29 -0
  882. package/node_modules/@code-yeongyu/senpi-codemode/src/extension/session-manager.ts +8 -4
  883. package/node_modules/@code-yeongyu/senpi-codemode/src/index.ts +3 -1
  884. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/display-image.js +162 -0
  885. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/prelude.ts +2 -2
  886. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/js/worker-runtime.js +29 -60
  887. package/node_modules/@code-yeongyu/senpi-codemode/src/kernels/py/prelude.py +66 -1
  888. package/node_modules/@code-yeongyu/senpi-codemode/src/prompt/eval-prompt.ts +35 -96
  889. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-execution.ts +7 -0
  890. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool-options.ts +6 -0
  891. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/eval-tool.ts +14 -2
  892. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +12 -7
  893. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  894. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +58 -64
  895. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  896. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
  897. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +3 -1
  898. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
  899. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
  900. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +17 -0
  901. package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
  902. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
  903. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +1 -0
  904. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -1
  905. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
  906. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +17 -6
  907. package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
  908. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts +1 -1
  909. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.d.ts.map +1 -1
  910. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js +6 -1
  911. package/node_modules/@earendil-works/pi-agent-core/dist/harness/messages.js.map +1 -1
  912. package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.d.ts.map +1 -1
  913. package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js +6 -0
  914. package/node_modules/@earendil-works/pi-agent-core/dist/harness/reducer.js.map +1 -1
  915. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.d.ts +2 -1
  916. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.d.ts.map +1 -1
  917. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js +5 -1
  918. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/context.js.map +1 -1
  919. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.d.ts.map +1 -1
  920. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js +1 -0
  921. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/jsonl/codec.js.map +1 -1
  922. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts +7 -1
  923. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.d.ts.map +1 -1
  924. package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/types.js.map +1 -1
  925. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js +1 -1
  926. package/node_modules/@earendil-works/pi-agent-core/dist/harness/tools/write.js.map +1 -1
  927. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts +2 -0
  928. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.d.ts.map +1 -1
  929. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js +40 -10
  930. package/node_modules/@earendil-works/pi-agent-core/dist/proxy.js.map +1 -1
  931. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +8 -2
  932. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  933. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  934. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  935. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts +1 -1
  936. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.d.ts.map +1 -1
  937. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js +130 -15
  938. package/node_modules/@earendil-works/pi-ai/dist/api/anthropic-messages.js.map +1 -1
  939. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js +4 -4
  940. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -1
  941. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js +3 -1
  942. package/node_modules/@earendil-works/pi-ai/dist/api/mistral-conversations.js.map +1 -1
  943. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts +1 -1
  944. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.d.ts.map +1 -1
  945. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js +3 -1
  946. package/node_modules/@earendil-works/pi-ai/dist/api/openai-codex-responses.js.map +1 -1
  947. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.d.ts.map +1 -1
  948. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js +30 -10
  949. package/node_modules/@earendil-works/pi-ai/dist/api/openai-completions.js.map +1 -1
  950. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts +3 -3
  951. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.d.ts.map +1 -1
  952. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js +15 -0
  953. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses-shared.js.map +1 -1
  954. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts +1 -1
  955. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.d.ts.map +1 -1
  956. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js +8 -5
  957. package/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js.map +1 -1
  958. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts +2 -0
  959. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.d.ts.map +1 -1
  960. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js +6 -0
  961. package/node_modules/@earendil-works/pi-ai/dist/api/pi-messages.js.map +1 -1
  962. package/node_modules/@earendil-works/pi-ai/dist/api/warm-prompt-cache.js +1 -1
  963. package/node_modules/@earendil-works/pi-ai/dist/api/warm-prompt-cache.js.map +1 -1
  964. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts +30 -0
  965. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.d.ts.map +1 -1
  966. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js +30 -0
  967. package/node_modules/@earendil-works/pi-ai/dist/image-models.generated.js.map +1 -1
  968. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +1 -0
  969. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
  970. package/node_modules/@earendil-works/pi-ai/dist/index.js +1 -0
  971. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
  972. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts +3 -1
  973. package/node_modules/@earendil-works/pi-ai/dist/models.d.ts.map +1 -1
  974. package/node_modules/@earendil-works/pi-ai/dist/models.js +27 -3
  975. package/node_modules/@earendil-works/pi-ai/dist/models.js.map +1 -1
  976. package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts +2 -0
  977. package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.d.ts.map +1 -1
  978. package/node_modules/@earendil-works/pi-ai/dist/openai-responses-compat.js.map +1 -1
  979. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  980. package/node_modules/@earendil-works/pi-ai/dist/providers/data/anthropic.json +1 -1
  981. package/node_modules/@earendil-works/pi-ai/dist/providers/data/azure-openai-responses.json +1 -1
  982. package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
  983. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  984. package/node_modules/@earendil-works/pi-ai/dist/providers/data/fireworks.json +1 -1
  985. package/node_modules/@earendil-works/pi-ai/dist/providers/data/github-copilot.json +1 -1
  986. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
  987. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai.json +1 -1
  988. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode-go.json +1 -1
  989. package/node_modules/@earendil-works/pi-ai/dist/providers/data/opencode.json +1 -1
  990. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  991. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  992. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.d.ts.map +1 -1
  993. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js +2 -0
  994. package/node_modules/@earendil-works/pi-ai/dist/providers/faux.js.map +1 -1
  995. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts +1 -1
  996. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.d.ts.map +1 -1
  997. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js +8 -1
  998. package/node_modules/@earendil-works/pi-ai/dist/providers/openrouter.js.map +1 -1
  999. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +22 -2
  1000. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  1001. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  1002. package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.d.ts +23 -0
  1003. package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.d.ts.map +1 -0
  1004. package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.js +58 -0
  1005. package/node_modules/@earendil-works/pi-ai/dist/utils/drop-failed-assistant-turns.js.map +1 -0
  1006. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.d.ts.map +1 -1
  1007. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js +2 -0
  1008. package/node_modules/@earendil-works/pi-ai/dist/utils/estimate.js.map +1 -1
  1009. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.d.ts.map +1 -1
  1010. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js +53 -12
  1011. package/node_modules/@earendil-works/pi-ai/dist/utils/node-http-proxy.js.map +1 -1
  1012. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts +4 -2
  1013. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.d.ts.map +1 -1
  1014. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js +3 -0
  1015. package/node_modules/@earendil-works/pi-ai/dist/utils/prompt-cache-ttl.js.map +1 -1
  1016. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.d.ts.map +1 -1
  1017. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js +3 -0
  1018. package/node_modules/@earendil-works/pi-ai/dist/utils/retry.js.map +1 -1
  1019. package/node_modules/@earendil-works/pi-ai/package.json +3 -3
  1020. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  1021. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  1022. package/node_modules/@earendil-works/pi-tui/README.md +1 -1
  1023. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts +1 -0
  1024. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
  1025. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +36 -3
  1026. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
  1027. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +1 -1
  1028. package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
  1029. package/node_modules/@earendil-works/pi-tui/dist/index.js +1 -1
  1030. package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
  1031. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +2 -0
  1032. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
  1033. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +106 -6
  1034. package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
  1035. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +6 -0
  1036. package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
  1037. package/node_modules/@earendil-works/pi-tui/dist/terminal.js +17 -4
  1038. package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
  1039. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts +11 -0
  1040. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.d.ts.map +1 -1
  1041. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js +57 -15
  1042. package/node_modules/@earendil-works/pi-tui/dist/tui-alt-screen.js.map +1 -1
  1043. package/node_modules/@earendil-works/pi-tui/dist/tui.d.ts.map +1 -1
  1044. package/node_modules/@earendil-works/pi-tui/dist/tui.js +22 -7
  1045. package/node_modules/@earendil-works/pi-tui/dist/tui.js.map +1 -1
  1046. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  1047. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAGN,wBAAwB,EAKxB,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EAatB,wBAAwB,GAIxB,MAAM,YAAY,CAAC;AAEpB,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC/C,YAAY,OAAe,EAAE,OAA6B;QACzD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACrC,CAAC;CACD;AAED,MAAM,OAAO,gCAAiC,SAAQ,KAAK;IAC1D,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kCAAkC,CAAC;IAChD,CAAC;CACD;AAKD,MAAM,aAAa,GAAG,IAAI,GAAG,EAAyB,CAAC;AACvD,MAAM,SAAS,GAAG,IAAI,GAAG,EAAqB,CAAC;AAE/C,MAAM,UAAU,gBAAgB,CAAC,GAAiB;IACjD,OAAO,kBAAkB,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;AAC1C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAiB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AAgB,CAAC,KAAa;IACtC,OAAQ,sBAA4C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAa;IAC7C,OAAQ,wBAA8C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,uBAAuB,CAAC,KAAa;IAC7C,OAAQ,wBAA8C,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAc,EAAE,IAAY;IACtD,OAAO,KAAK,YAAY,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;AACzE,CAAC","sourcesContent":["/**\n * Atomic, versioned, per-session sidecar store for `/loop` state.\n *\n * Mirrors the goal store's persistence discipline (temp file + rename, per-file mutation\n * serialization, strict versioned parsing) because scheduler state must never be half\n * written or silently reset: a corrupt file arms nothing and surfaces a typed error so\n * the extension can end affected loops with `error` instead of guessing.\n *\n * Session custom entries are deliberately NOT the authoritative store: they are branch\n * nodes, so a globally scanned \"latest\" entry can come from an abandoned branch, while\n * loop schedules are session-scoped.\n */\n\nimport { randomUUID } from \"node:crypto\";\nimport { mkdir, readFile, rename, rm, writeFile } from \"node:fs/promises\";\nimport { dirname, join } from \"node:path\";\nimport {\n\ttype CronEntry,\n\ttype DynamicCronEntry,\n\tEFFECTIVE_INTERVAL_UNITS,\n\ttype EffectiveInterval,\n\ttype EffectiveIntervalUnit,\n\ttype EpochMs,\n\ttype FixedCronEntry,\n\tisRecord,\n\tLOOP_END_REASONS,\n\tLOOP_PHASES,\n\tLOOP_SENTINELS,\n\tLOOP_STATE_VERSION,\n\tLOOP_WAKE_SOURCE_KINDS,\n\ttype LoopEndReason,\n\ttype LoopEntryFields,\n\ttype LoopFileFingerprint,\n\ttype LoopLifecycle,\n\ttype LoopPayload,\n\ttype LoopPhase,\n\ttype LoopSentinel,\n\ttype LoopState,\n\ttype LoopStoreRef,\n\ttype LoopWakeSource,\n\ttype LoopWakeSourceKind,\n\ttype PendingWakeup,\n\tREQUESTED_INTERVAL_UNITS,\n\ttype RequestedInterval,\n\ttype RequestedIntervalUnit,\n\ttype SentinelDeliveryState,\n} from \"./types.ts\";\n\nexport class InvalidLoopStoreError extends Error {\n\tconstructor(message: string, options?: { cause?: unknown }) {\n\t\tsuper(message, options);\n\t\tthis.name = \"InvalidLoopStoreError\";\n\t}\n}\n\nexport class UnsupportedLoopStoreVersionError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"UnsupportedLoopStoreVersionError\";\n\t}\n}\n\n/** Mutation callback. May be async; its result becomes the next persisted state. */\nexport type LoopStateMutation = (current: LoopState) => LoopState | Promise<LoopState>;\n\nconst mutationTails = new Map<string, Promise<void>>();\nconst snapshots = new Map<string, LoopState>();\n\nexport function encodedSessionId(ref: LoopStoreRef): string {\n\treturn encodeURIComponent(ref.sessionId);\n}\n\nexport function loopStateFilePath(ref: LoopStoreRef): string {\n\treturn join(ref.baseDir, `${encodedSessionId(ref)}.json`);\n}\n\nexport function emptyLoopState(sessionId: string): LoopState {\n\treturn { version: LOOP_STATE_VERSION, sessionId, entries: {}, activeDynamicId: null, updatedAt: 0 };\n}\n\n/**\n * Reads persisted state, or null when this session has never persisted any loop.\n * Throws {@link InvalidLoopStoreError} / {@link UnsupportedLoopStoreVersionError} on\n * unusable state so callers fail closed rather than resetting a user's schedule.\n */\nexport async function readLoopState(ref: LoopStoreRef): Promise<LoopState | null> {\n\tlet raw: string;\n\ttry {\n\t\traw = await readFile(loopStateFilePath(ref), \"utf8\");\n\t} catch (error) {\n\t\tif (isFileSystemError(error, \"ENOENT\")) return null;\n\t\tthrow error;\n\t}\n\tconst state = parseLoopState(raw, ref);\n\tsnapshots.set(loopStateFilePath(ref), state);\n\treturn state;\n}\n\n/** Like {@link readLoopState}, but returns an empty state when nothing is persisted. */\nexport async function loadLoopState(ref: LoopStoreRef): Promise<LoopState> {\n\treturn (await readLoopState(ref)) ?? emptyLoopState(ref.sessionId);\n}\n\n/**\n * Last successfully loaded or written state for this ref, for synchronous consumers\n * (status line, tick attribution). Undefined until the store has been touched.\n */\nexport function snapshotLoopState(ref: LoopStoreRef): LoopState | undefined {\n\treturn snapshots.get(loopStateFilePath(ref));\n}\n\n/**\n * Serializes read-modify-write cycles through a per-file promise tail so command,\n * timer, tool, and lifecycle writes cannot interleave and lose an update.\n */\nexport function mutateLoopState(ref: LoopStoreRef, mutation: LoopStateMutation): Promise<LoopState> {\n\treturn enqueue(ref, async () => {\n\t\tconst current = await loadLoopState(ref);\n\t\tconst next = await mutation(current);\n\t\tawait writeLoopState(ref, next);\n\t\treturn next;\n\t});\n}\n\n/** Persists a complete state atomically. Prefer {@link mutateLoopState} for updates. */\nexport async function writeLoopState(ref: LoopStoreRef, state: LoopState): Promise<void> {\n\tconst filePath = loopStateFilePath(ref);\n\tawait mkdir(dirname(filePath), { recursive: true });\n\tawait writeAtomic(filePath, `${JSON.stringify(state, null, 2)}\\n`);\n\tsnapshots.set(filePath, state);\n}\n\n/** Drops cached snapshots; used when a session ends or tests reset global state. */\nexport function clearLoopStateSnapshot(ref: LoopStoreRef): void {\n\tsnapshots.delete(loopStateFilePath(ref));\n}\n\nfunction enqueue<T>(ref: LoopStoreRef, operation: () => Promise<T>): Promise<T> {\n\tconst key = loopStateFilePath(ref);\n\tconst previous = mutationTails.get(key) ?? Promise.resolve();\n\tconst run = previous.then(operation);\n\tconst tail = run.then(\n\t\t() => undefined,\n\t\t() => undefined,\n\t);\n\tmutationTails.set(key, tail);\n\tvoid tail.then(() => {\n\t\tif (mutationTails.get(key) === tail) mutationTails.delete(key);\n\t});\n\treturn run;\n}\n\nasync function writeAtomic(filePath: string, contents: string): Promise<void> {\n\tconst tempPath = join(dirname(filePath), `.loop-${randomUUID()}.tmp`);\n\ttry {\n\t\tawait writeFile(tempPath, contents, { encoding: \"utf8\", mode: 0o600 });\n\t\tawait rename(tempPath, filePath);\n\t} catch (error) {\n\t\ttry {\n\t\t\tawait rm(tempPath, { force: true });\n\t\t} catch (cleanupError) {\n\t\t\tthrow new AggregateError(\n\t\t\t\t[error, cleanupError],\n\t\t\t\t\"loop store write failed and its temporary file could not be removed\",\n\t\t\t);\n\t\t}\n\t\tthrow error;\n\t}\n}\n\nfunction parseLoopState(raw: string, ref: LoopStoreRef): LoopState {\n\tlet parsed: unknown;\n\ttry {\n\t\tparsed = JSON.parse(raw);\n\t} catch (error) {\n\t\tthrow new InvalidLoopStoreError(\"loop store contains unparseable JSON\", { cause: error });\n\t}\n\tif (!isRecord(parsed)) throw new InvalidLoopStoreError(\"loop store must be a JSON object\");\n\tif (parsed.version !== LOOP_STATE_VERSION) {\n\t\tthrow new UnsupportedLoopStoreVersionError(\n\t\t\t`unsupported loop store version: ${JSON.stringify(parsed.version)} (expected ${LOOP_STATE_VERSION})`,\n\t\t);\n\t}\n\tif (typeof parsed.sessionId !== \"string\" || parsed.sessionId.length === 0) {\n\t\tthrow new InvalidLoopStoreError(\"loop store is missing a sessionId\");\n\t}\n\tif (parsed.sessionId !== ref.sessionId) {\n\t\tthrow new InvalidLoopStoreError(\n\t\t\t`loop store sessionId ${parsed.sessionId} does not match the session it was loaded for`,\n\t\t);\n\t}\n\tif (!isEpochMs(parsed.updatedAt)) throw new InvalidLoopStoreError(\"loop store has an invalid updatedAt\");\n\tif (!isRecord(parsed.entries)) throw new InvalidLoopStoreError(\"loop store entries must be an object\");\n\n\tconst entries: Record<string, CronEntry> = {};\n\tfor (const [id, value] of Object.entries(parsed.entries)) {\n\t\tconst entry = parseEntry(id, value);\n\t\tentries[id] = entry;\n\t}\n\n\tconst activeDynamicId = parsed.activeDynamicId;\n\tif (activeDynamicId !== null) {\n\t\tif (typeof activeDynamicId !== \"string\") {\n\t\t\tthrow new InvalidLoopStoreError(\"loop store activeDynamicId must be a string or null\");\n\t\t}\n\t\tconst active = entries[activeDynamicId];\n\t\tif (active === undefined || active.kind !== \"dynamic\") {\n\t\t\tthrow new InvalidLoopStoreError(`loop store activeDynamicId ${activeDynamicId} does not name a dynamic loop`);\n\t\t}\n\t}\n\n\treturn {\n\t\tversion: LOOP_STATE_VERSION,\n\t\tsessionId: parsed.sessionId,\n\t\tentries,\n\t\tactiveDynamicId,\n\t\tupdatedAt: parsed.updatedAt,\n\t};\n}\n\nfunction parseEntry(id: string, value: unknown): CronEntry {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} is not an object`);\n\tif (value.id !== id) throw new InvalidLoopStoreError(`loop entry ${id} carries a mismatched id`);\n\tconst kind = value.kind;\n\tif (kind !== \"fixed\" && kind !== \"dynamic\") throw new InvalidLoopStoreError(`loop entry ${id} has an unknown kind`);\n\n\tconst base = parseEntryFields(id, value);\n\tif (kind === \"fixed\") {\n\t\tconst fixed: FixedCronEntry = {\n\t\t\t...base,\n\t\t\tkind: \"fixed\",\n\t\t\trequestedInterval: parseRequestedInterval(id, value.requestedInterval),\n\t\t\teffectiveInterval: parseEffectiveInterval(id, value.effectiveInterval),\n\t\t\tcronExpression: requireString(id, \"cronExpression\", value.cronExpression),\n\t\t\tnextFireAt: requireEpochMs(id, \"nextFireAt\", value.nextFireAt),\n\t\t\tintervalMs: requirePositiveInteger(id, \"intervalMs\", value.intervalMs),\n\t\t};\n\t\treturn fixed;\n\t}\n\n\tconst keepaliveCredit = value.keepaliveCredit;\n\tif (keepaliveCredit !== 0 && keepaliveCredit !== 1) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid keepaliveCredit`);\n\t}\n\tconst dynamic: DynamicCronEntry = {\n\t\t...base,\n\t\tkind: \"dynamic\",\n\t\tpendingWakeup: parsePendingWakeup(id, value.pendingWakeup),\n\t\tkeepaliveCredit,\n\t};\n\treturn dynamic;\n}\n\nfunction parseEntryFields(id: string, value: Record<string, unknown>): LoopEntryFields & LoopLifecycle {\n\tconst fields = {\n\t\tid,\n\t\toriginalArgs: requireString(id, \"originalArgs\", value.originalArgs, { allowEmpty: true }),\n\t\treentryPrompt: requireString(id, \"reentryPrompt\", value.reentryPrompt),\n\t\tpayload: parsePayload(id, value.payload),\n\t\tcreatedAt: requireEpochMs(id, \"createdAt\", value.createdAt),\n\t\tlastFiredAt: parseNullableEpochMs(id, \"lastFiredAt\", value.lastFiredAt),\n\t\texpiresAt: requireEpochMs(id, \"expiresAt\", value.expiresAt),\n\t\tlastScheduledForAt: parseNullableEpochMs(id, \"lastScheduledForAt\", value.lastScheduledForAt),\n\t\tcoalescedFirePending: requireBoolean(id, \"coalescedFirePending\", value.coalescedFirePending),\n\t\tqueuedForAt: parseNullableEpochMs(id, \"queuedForAt\", value.queuedForAt),\n\t\tnoopStreak: requireNonNegativeInteger(id, \"noopStreak\", value.noopStreak),\n\t\ttickCount: requireNonNegativeInteger(id, \"tickCount\", value.tickCount),\n\t\tsentinelDelivery: parseSentinelDelivery(id, value.sentinelDelivery),\n\t\twakeSources: parseWakeSources(id, value.wakeSources),\n\t};\n\treturn { ...fields, ...parseLifecycle(id, value) };\n}\n\ntype ParsedLifecycle =\n\t| { phase: Exclude<LoopPhase, \"ended\"> }\n\t| { phase: \"ended\"; endedAt: EpochMs; endReason: LoopEndReason; endDetail?: string };\n\nfunction parseLifecycle(id: string, value: Record<string, unknown>): ParsedLifecycle {\n\tconst phase = value.phase;\n\tif (typeof phase !== \"string\" || !isLoopPhase(phase)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid phase`);\n\t}\n\tif (phase !== \"ended\") {\n\t\tif (value.endedAt !== undefined || value.endReason !== undefined || value.endDetail !== undefined) {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} carries terminal fields while not ended`);\n\t\t}\n\t\treturn { phase };\n\t}\n\tconst endReason = value.endReason;\n\tif (typeof endReason !== \"string\" || !isLoopEndReason(endReason)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid endReason`);\n\t}\n\tconst endDetail = value.endDetail;\n\tif (endDetail !== undefined && typeof endDetail !== \"string\") {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid endDetail`);\n\t}\n\treturn {\n\t\tphase: \"ended\",\n\t\tendedAt: requireEpochMs(id, \"endedAt\", value.endedAt),\n\t\tendReason,\n\t\t...(endDetail === undefined ? {} : { endDetail }),\n\t};\n}\n\nfunction parsePayload(id: string, value: unknown): LoopPayload {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid payload`);\n\tif (value.type === \"prompt\") {\n\t\treturn { type: \"prompt\", prompt: requireString(id, \"payload.prompt\", value.prompt) };\n\t}\n\tif (value.type === \"sentinel\") {\n\t\tconst sentinel = value.sentinel;\n\t\tif (typeof sentinel !== \"string\" || !isLoopSentinel(sentinel)) {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an unknown payload sentinel`);\n\t\t}\n\t\treturn { type: \"sentinel\", sentinel };\n\t}\n\tthrow new InvalidLoopStoreError(`loop entry ${id} has an unknown payload type`);\n}\n\nfunction parseSentinelDelivery(id: string, value: unknown): SentinelDeliveryState {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid sentinelDelivery`);\n\treturn {\n\t\tautonomousPreambleDelivered: requireBoolean(\n\t\t\tid,\n\t\t\t\"sentinelDelivery.autonomousPreambleDelivered\",\n\t\t\tvalue.autonomousPreambleDelivered,\n\t\t),\n\t\tlastLoopFileDelivered: parseFingerprint(id, value.lastLoopFileDelivered),\n\t\tforceFullDelivery: requireBoolean(id, \"sentinelDelivery.forceFullDelivery\", value.forceFullDelivery),\n\t};\n}\n\nfunction parseFingerprint(id: string, value: unknown): LoopFileFingerprint | null {\n\tif (value === null) return null;\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid loop-file fingerprint`);\n\treturn {\n\t\tpath: requireString(id, \"fingerprint.path\", value.path),\n\t\tmtimeMs: requireFiniteNumber(id, \"fingerprint.mtimeMs\", value.mtimeMs),\n\t\tsize: requireNonNegativeInteger(id, \"fingerprint.size\", value.size),\n\t\tcontentHash: requireString(id, \"fingerprint.contentHash\", value.contentHash),\n\t\tanchorDeliveryId: requireString(id, \"fingerprint.anchorDeliveryId\", value.anchorDeliveryId),\n\t};\n}\n\nfunction parseWakeSources(id: string, value: unknown): readonly LoopWakeSource[] {\n\tif (!Array.isArray(value)) throw new InvalidLoopStoreError(`loop entry ${id} has invalid wakeSources`);\n\treturn value.map((candidate): LoopWakeSource => {\n\t\tif (!isRecord(candidate)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid wake source`);\n\t\tconst source = candidate.source;\n\t\tif (typeof source !== \"string\" || !isWakeSourceKind(source)) {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an unknown wake source kind`);\n\t\t}\n\t\tconst description = candidate.description;\n\t\tif (description !== undefined && typeof description !== \"string\") {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid wake source description`);\n\t\t}\n\t\treturn {\n\t\t\tsource,\n\t\t\tid: requireString(id, \"wakeSource.id\", candidate.id),\n\t\t\tcreatedAt: requireEpochMs(id, \"wakeSource.createdAt\", candidate.createdAt),\n\t\t\t...(description === undefined ? {} : { description }),\n\t\t};\n\t});\n}\n\nfunction parsePendingWakeup(id: string, value: unknown): PendingWakeup | null {\n\tif (value === null || value === undefined) return null;\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid pendingWakeup`);\n\tconst source = value.source;\n\tif (source !== \"model\" && source !== \"keepalive\") {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid pendingWakeup source`);\n\t}\n\tif (value.kind !== \"dynamic\") throw new InvalidLoopStoreError(`loop entry ${id} has an invalid pendingWakeup kind`);\n\treturn {\n\t\tid: requireString(id, \"pendingWakeup.id\", value.id),\n\t\tloopId: requireString(id, \"pendingWakeup.loopId\", value.loopId),\n\t\tkind: \"dynamic\",\n\t\tsource,\n\t\trequestedDelaySeconds: requireFiniteNumber(\n\t\t\tid,\n\t\t\t\"pendingWakeup.requestedDelaySeconds\",\n\t\t\tvalue.requestedDelaySeconds,\n\t\t),\n\t\tdelaySeconds: requirePositiveInteger(id, \"pendingWakeup.delaySeconds\", value.delaySeconds),\n\t\tdueAt: requireEpochMs(id, \"pendingWakeup.dueAt\", value.dueAt),\n\t\treason: requireString(id, \"pendingWakeup.reason\", value.reason),\n\t\tprompt: requireString(id, \"pendingWakeup.prompt\", value.prompt),\n\t\tnoop: requireBoolean(id, \"pendingWakeup.noop\", value.noop),\n\t\tcreatedAt: requireEpochMs(id, \"pendingWakeup.createdAt\", value.createdAt),\n\t};\n}\n\nfunction parseRequestedInterval(id: string, value: unknown): RequestedInterval {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid requestedInterval`);\n\tconst unit = value.unit;\n\tif (typeof unit !== \"string\" || !isRequestedIntervalUnit(unit)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid requestedInterval unit`);\n\t}\n\treturn {\n\t\tvalue: requirePositiveInteger(id, \"requestedInterval.value\", value.value),\n\t\tunit,\n\t\traw: requireString(id, \"requestedInterval.raw\", value.raw),\n\t};\n}\n\nfunction parseEffectiveInterval(id: string, value: unknown): EffectiveInterval {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid effectiveInterval`);\n\tconst unit = value.unit;\n\tif (typeof unit !== \"string\" || !isEffectiveIntervalUnit(unit)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid effectiveInterval unit`);\n\t}\n\tconst roundingNotice = value.roundingNotice;\n\tif (roundingNotice !== undefined && typeof roundingNotice !== \"string\") {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid effectiveInterval roundingNotice`);\n\t}\n\treturn {\n\t\tvalue: requirePositiveInteger(id, \"effectiveInterval.value\", value.value),\n\t\tunit,\n\t\thuman: requireString(id, \"effectiveInterval.human\", value.human),\n\t\trounded: requireBoolean(id, \"effectiveInterval.rounded\", value.rounded),\n\t\t...(roundingNotice === undefined ? {} : { roundingNotice }),\n\t};\n}\n\nfunction requireString(id: string, field: string, value: unknown, options?: { allowEmpty?: boolean }): string {\n\tif (typeof value !== \"string\" || (options?.allowEmpty !== true && value.length === 0)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value;\n}\n\nfunction requireBoolean(id: string, field: string, value: unknown): boolean {\n\tif (typeof value !== \"boolean\") throw new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\treturn value;\n}\n\nfunction requireFiniteNumber(id: string, field: string, value: unknown): number {\n\tif (typeof value !== \"number\" || !Number.isFinite(value)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value;\n}\n\nfunction requireNonNegativeInteger(id: string, field: string, value: unknown): number {\n\tif (!Number.isSafeInteger(value) || (value as number) < 0) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value as number;\n}\n\nfunction requirePositiveInteger(id: string, field: string, value: unknown): number {\n\tif (!Number.isSafeInteger(value) || (value as number) <= 0) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value as number;\n}\n\nfunction requireEpochMs(id: string, field: string, value: unknown): EpochMs {\n\tif (!isEpochMs(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\treturn value;\n}\n\nfunction parseNullableEpochMs(id: string, field: string, value: unknown): EpochMs | null {\n\tif (value === null || value === undefined) return null;\n\treturn requireEpochMs(id, field, value);\n}\n\nfunction isEpochMs(value: unknown): value is EpochMs {\n\treturn Number.isSafeInteger(value) && (value as number) >= 0;\n}\n\nfunction isLoopPhase(value: string): value is LoopPhase {\n\treturn (LOOP_PHASES as readonly string[]).includes(value);\n}\n\nfunction isLoopEndReason(value: string): value is LoopEndReason {\n\treturn (LOOP_END_REASONS as readonly string[]).includes(value);\n}\n\nfunction isLoopSentinel(value: string): value is LoopSentinel {\n\treturn (LOOP_SENTINELS as readonly string[]).includes(value);\n}\n\nfunction isWakeSourceKind(value: string): value is LoopWakeSourceKind {\n\treturn (LOOP_WAKE_SOURCE_KINDS as readonly string[]).includes(value);\n}\n\nfunction isRequestedIntervalUnit(value: string): value is RequestedIntervalUnit {\n\treturn (REQUESTED_INTERVAL_UNITS as readonly string[]).includes(value);\n}\n\nfunction isEffectiveIntervalUnit(value: string): value is EffectiveIntervalUnit {\n\treturn (EFFECTIVE_INTERVAL_UNITS as readonly string[]).includes(value);\n}\n\nfunction isFileSystemError(error: unknown, code: string): boolean {\n\treturn error instanceof Error && \"code\" in error && error.code === code;\n}\n"]}
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACN,kBAAkB,EAClB,gBAAgB,IAAI,sBAAsB,EAC1C,wBAAwB,EAGxB,eAAe,EACf,mCAAmC,GACnC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAGN,wBAAwB,EAKxB,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,sBAAsB,EAatB,wBAAwB,GAIxB,MAAM,YAAY,CAAC;AAEpB,MAAM,OAAO,qBAAsB,SAAQ,wBAAwB;IAClE,YAAY,OAAe,EAAE,OAA6B;QACzD,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;IACrC,CAAC;CACD;AAED,MAAM,OAAO,gCAAiC,SAAQ,mCAAmC;IACxF,YAAY,OAAe;QAC1B,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kCAAkC,CAAC;IAChD,CAAC;CACD;AAKD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAmC,CAAC;AAE1D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per-session sidecar store for `/loop` state.\n *\n * Persistence (temp file + rename, per-file mutation serialization, envelope\n * version/session checks) lives in the shared session sidecar primitive. This\n * module supplies the loop domain parser and keeps the historical exported\n * surface so callers continue to catch {@link InvalidLoopStoreError} /\n * {@link UnsupportedLoopStoreVersionError} by name.\n *\n * Session custom entries are deliberately NOT the authoritative store: they are branch\n * nodes, so a globally scanned \"latest\" entry can come from an abandoned branch, while\n * loop schedules are session-scoped.\n */\n\nimport {\n\tcreateSidecarStore,\n\tencodedSessionId as encodeSidecarSessionId,\n\tInvalidSidecarStoreError,\n\ttype SidecarStore,\n\ttype SidecarStoreRef,\n\tsidecarFilePath,\n\tUnsupportedSidecarStoreVersionError,\n} from \"../../../session-sidecar-store.ts\";\nimport {\n\ttype CronEntry,\n\ttype DynamicCronEntry,\n\tEFFECTIVE_INTERVAL_UNITS,\n\ttype EffectiveInterval,\n\ttype EffectiveIntervalUnit,\n\ttype EpochMs,\n\ttype FixedCronEntry,\n\tisRecord,\n\tLOOP_END_REASONS,\n\tLOOP_PHASES,\n\tLOOP_SENTINELS,\n\tLOOP_STATE_VERSION,\n\tLOOP_WAKE_SOURCE_KINDS,\n\ttype LoopEndReason,\n\ttype LoopEntryFields,\n\ttype LoopFileFingerprint,\n\ttype LoopLifecycle,\n\ttype LoopPayload,\n\ttype LoopPhase,\n\ttype LoopSentinel,\n\ttype LoopState,\n\ttype LoopStoreRef,\n\ttype LoopWakeSource,\n\ttype LoopWakeSourceKind,\n\ttype PendingWakeup,\n\tREQUESTED_INTERVAL_UNITS,\n\ttype RequestedInterval,\n\ttype RequestedIntervalUnit,\n\ttype SentinelDeliveryState,\n} from \"./types.ts\";\n\nexport class InvalidLoopStoreError extends InvalidSidecarStoreError {\n\tconstructor(message: string, options?: { cause?: unknown }) {\n\t\tsuper(message, options);\n\t\tthis.name = \"InvalidLoopStoreError\";\n\t}\n}\n\nexport class UnsupportedLoopStoreVersionError extends UnsupportedSidecarStoreVersionError {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"UnsupportedLoopStoreVersionError\";\n\t}\n}\n\n/** Mutation callback. May be async; its result becomes the next persisted state. */\nexport type LoopStateMutation = (current: LoopState) => LoopState | Promise<LoopState>;\n\nconst stores = new Map<string, SidecarStore<LoopState>>();\n\nexport function encodedSessionId(ref: LoopStoreRef): string {\n\treturn encodeSidecarSessionId(ref.sessionId);\n}\n\nexport function loopStateFilePath(ref: LoopStoreRef): string {\n\treturn sidecarFilePath(ref);\n}\n\nexport function emptyLoopState(sessionId: string): LoopState {\n\treturn { version: LOOP_STATE_VERSION, sessionId, entries: {}, activeDynamicId: null, updatedAt: 0 };\n}\n\nfunction storeFor(ref: LoopStoreRef): SidecarStore<LoopState> {\n\tconst filePath = loopStateFilePath(ref);\n\tconst existing = stores.get(filePath);\n\tif (existing !== undefined) return existing;\n\tconst store = createSidecarStore<LoopState>({\n\t\tbaseDir: ref.baseDir,\n\t\tsessionId: ref.sessionId,\n\t\tversion: LOOP_STATE_VERSION,\n\t\ttempPrefix: \"loop\",\n\t\tparse: parseLoopPayload,\n\t});\n\tstores.set(filePath, store);\n\treturn store;\n}\n\nfunction remapLoopStoreError(error: unknown): never {\n\tif (error instanceof InvalidLoopStoreError || error instanceof UnsupportedLoopStoreVersionError) {\n\t\tthrow error;\n\t}\n\tif (error instanceof UnsupportedSidecarStoreVersionError) {\n\t\tthrow new UnsupportedLoopStoreVersionError(error.message.replaceAll(\"sidecar store\", \"loop store\"));\n\t}\n\tif (error instanceof InvalidSidecarStoreError) {\n\t\tthrow new InvalidLoopStoreError(error.message.replaceAll(\"sidecar store\", \"loop store\"), { cause: error });\n\t}\n\tthrow error;\n}\n\n/**\n * Reads persisted state, or null when this session has never persisted any loop.\n * Throws {@link InvalidLoopStoreError} / {@link UnsupportedLoopStoreVersionError} on\n * unusable state so callers fail closed rather than resetting a user's schedule.\n */\nexport async function readLoopState(ref: LoopStoreRef): Promise<LoopState | null> {\n\ttry {\n\t\treturn await storeFor(ref).read();\n\t} catch (error) {\n\t\tremapLoopStoreError(error);\n\t}\n}\n\n/** Like {@link readLoopState}, but returns an empty state when nothing is persisted. */\nexport async function loadLoopState(ref: LoopStoreRef): Promise<LoopState> {\n\treturn (await readLoopState(ref)) ?? emptyLoopState(ref.sessionId);\n}\n\n/**\n * Last successfully loaded or written state for this ref, for synchronous consumers\n * (status line, tick attribution). Undefined until the store has been touched.\n */\nexport function snapshotLoopState(ref: LoopStoreRef): LoopState | undefined {\n\treturn storeFor(ref).snapshot();\n}\n\n/**\n * Serializes read-modify-write cycles through a per-file promise tail so command,\n * timer, tool, and lifecycle writes cannot interleave and lose an update.\n */\nexport function mutateLoopState(ref: LoopStoreRef, mutation: LoopStateMutation): Promise<LoopState> {\n\treturn storeFor(ref)\n\t\t.mutate((current) => mutation(current ?? emptyLoopState(ref.sessionId)))\n\t\t.catch((error: unknown) => remapLoopStoreError(error));\n}\n\n/** Persists a complete state atomically. Prefer {@link mutateLoopState} for updates. */\nexport async function writeLoopState(ref: LoopStoreRef, state: LoopState): Promise<void> {\n\tawait storeFor(ref).write(state);\n}\n\n/** Drops cached snapshots; used when a session ends or tests reset global state. */\nexport function clearLoopStateSnapshot(ref: LoopStoreRef): void {\n\tstoreFor(ref).clear();\n}\n\nfunction parseLoopPayload(raw: unknown, ref: SidecarStoreRef): LoopState {\n\tif (!isRecord(raw)) throw new InvalidLoopStoreError(\"loop store must be a JSON object\");\n\tif (!isEpochMs(raw.updatedAt)) throw new InvalidLoopStoreError(\"loop store has an invalid updatedAt\");\n\tif (!isRecord(raw.entries)) throw new InvalidLoopStoreError(\"loop store entries must be an object\");\n\n\tconst entries: Record<string, CronEntry> = {};\n\tfor (const [id, value] of Object.entries(raw.entries)) {\n\t\tconst entry = parseEntry(id, value);\n\t\tentries[id] = entry;\n\t}\n\n\tconst activeDynamicId = raw.activeDynamicId;\n\tif (activeDynamicId !== null) {\n\t\tif (typeof activeDynamicId !== \"string\") {\n\t\t\tthrow new InvalidLoopStoreError(\"loop store activeDynamicId must be a string or null\");\n\t\t}\n\t\tconst active = entries[activeDynamicId];\n\t\tif (active === undefined || active.kind !== \"dynamic\") {\n\t\t\tthrow new InvalidLoopStoreError(`loop store activeDynamicId ${activeDynamicId} does not name a dynamic loop`);\n\t\t}\n\t}\n\n\treturn {\n\t\tversion: LOOP_STATE_VERSION,\n\t\tsessionId: ref.sessionId,\n\t\tentries,\n\t\tactiveDynamicId,\n\t\tupdatedAt: raw.updatedAt,\n\t};\n}\n\nfunction parseEntry(id: string, value: unknown): CronEntry {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} is not an object`);\n\tif (value.id !== id) throw new InvalidLoopStoreError(`loop entry ${id} carries a mismatched id`);\n\tconst kind = value.kind;\n\tif (kind !== \"fixed\" && kind !== \"dynamic\") throw new InvalidLoopStoreError(`loop entry ${id} has an unknown kind`);\n\n\tconst base = parseEntryFields(id, value);\n\tif (kind === \"fixed\") {\n\t\tconst fixed: FixedCronEntry = {\n\t\t\t...base,\n\t\t\tkind: \"fixed\",\n\t\t\trequestedInterval: parseRequestedInterval(id, value.requestedInterval),\n\t\t\teffectiveInterval: parseEffectiveInterval(id, value.effectiveInterval),\n\t\t\tcronExpression: requireString(id, \"cronExpression\", value.cronExpression),\n\t\t\tnextFireAt: requireEpochMs(id, \"nextFireAt\", value.nextFireAt),\n\t\t\tintervalMs: requirePositiveInteger(id, \"intervalMs\", value.intervalMs),\n\t\t};\n\t\treturn fixed;\n\t}\n\n\tconst keepaliveCredit = value.keepaliveCredit;\n\tif (keepaliveCredit !== 0 && keepaliveCredit !== 1) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid keepaliveCredit`);\n\t}\n\tconst dynamic: DynamicCronEntry = {\n\t\t...base,\n\t\tkind: \"dynamic\",\n\t\tpendingWakeup: parsePendingWakeup(id, value.pendingWakeup),\n\t\tkeepaliveCredit,\n\t};\n\treturn dynamic;\n}\n\nfunction parseEntryFields(id: string, value: Record<string, unknown>): LoopEntryFields & LoopLifecycle {\n\tconst fields = {\n\t\tid,\n\t\toriginalArgs: requireString(id, \"originalArgs\", value.originalArgs, { allowEmpty: true }),\n\t\treentryPrompt: requireString(id, \"reentryPrompt\", value.reentryPrompt),\n\t\tpayload: parsePayload(id, value.payload),\n\t\tcreatedAt: requireEpochMs(id, \"createdAt\", value.createdAt),\n\t\tlastFiredAt: parseNullableEpochMs(id, \"lastFiredAt\", value.lastFiredAt),\n\t\texpiresAt: requireEpochMs(id, \"expiresAt\", value.expiresAt),\n\t\tlastScheduledForAt: parseNullableEpochMs(id, \"lastScheduledForAt\", value.lastScheduledForAt),\n\t\tcoalescedFirePending: requireBoolean(id, \"coalescedFirePending\", value.coalescedFirePending),\n\t\tqueuedForAt: parseNullableEpochMs(id, \"queuedForAt\", value.queuedForAt),\n\t\tnoopStreak: requireNonNegativeInteger(id, \"noopStreak\", value.noopStreak),\n\t\ttickCount: requireNonNegativeInteger(id, \"tickCount\", value.tickCount),\n\t\tsentinelDelivery: parseSentinelDelivery(id, value.sentinelDelivery),\n\t\twakeSources: parseWakeSources(id, value.wakeSources),\n\t};\n\treturn { ...fields, ...parseLifecycle(id, value) };\n}\n\ntype ParsedLifecycle =\n\t| { phase: Exclude<LoopPhase, \"ended\"> }\n\t| { phase: \"ended\"; endedAt: EpochMs; endReason: LoopEndReason; endDetail?: string };\n\nfunction parseLifecycle(id: string, value: Record<string, unknown>): ParsedLifecycle {\n\tconst phase = value.phase;\n\tif (typeof phase !== \"string\" || !isLoopPhase(phase)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid phase`);\n\t}\n\tif (phase !== \"ended\") {\n\t\tif (value.endedAt !== undefined || value.endReason !== undefined || value.endDetail !== undefined) {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} carries terminal fields while not ended`);\n\t\t}\n\t\treturn { phase };\n\t}\n\tconst endReason = value.endReason;\n\tif (typeof endReason !== \"string\" || !isLoopEndReason(endReason)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid endReason`);\n\t}\n\tconst endDetail = value.endDetail;\n\tif (endDetail !== undefined && typeof endDetail !== \"string\") {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid endDetail`);\n\t}\n\treturn {\n\t\tphase: \"ended\",\n\t\tendedAt: requireEpochMs(id, \"endedAt\", value.endedAt),\n\t\tendReason,\n\t\t...(endDetail === undefined ? {} : { endDetail }),\n\t};\n}\n\nfunction parsePayload(id: string, value: unknown): LoopPayload {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid payload`);\n\tif (value.type === \"prompt\") {\n\t\treturn { type: \"prompt\", prompt: requireString(id, \"payload.prompt\", value.prompt) };\n\t}\n\tif (value.type === \"sentinel\") {\n\t\tconst sentinel = value.sentinel;\n\t\tif (typeof sentinel !== \"string\" || !isLoopSentinel(sentinel)) {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an unknown payload sentinel`);\n\t\t}\n\t\treturn { type: \"sentinel\", sentinel };\n\t}\n\tthrow new InvalidLoopStoreError(`loop entry ${id} has an unknown payload type`);\n}\n\nfunction parseSentinelDelivery(id: string, value: unknown): SentinelDeliveryState {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid sentinelDelivery`);\n\treturn {\n\t\tautonomousPreambleDelivered: requireBoolean(\n\t\t\tid,\n\t\t\t\"sentinelDelivery.autonomousPreambleDelivered\",\n\t\t\tvalue.autonomousPreambleDelivered,\n\t\t),\n\t\tlastLoopFileDelivered: parseFingerprint(id, value.lastLoopFileDelivered),\n\t\tforceFullDelivery: requireBoolean(id, \"sentinelDelivery.forceFullDelivery\", value.forceFullDelivery),\n\t};\n}\n\nfunction parseFingerprint(id: string, value: unknown): LoopFileFingerprint | null {\n\tif (value === null) return null;\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid loop-file fingerprint`);\n\treturn {\n\t\tpath: requireString(id, \"fingerprint.path\", value.path),\n\t\tmtimeMs: requireFiniteNumber(id, \"fingerprint.mtimeMs\", value.mtimeMs),\n\t\tsize: requireNonNegativeInteger(id, \"fingerprint.size\", value.size),\n\t\tcontentHash: requireString(id, \"fingerprint.contentHash\", value.contentHash),\n\t\tanchorDeliveryId: requireString(id, \"fingerprint.anchorDeliveryId\", value.anchorDeliveryId),\n\t};\n}\n\nfunction parseWakeSources(id: string, value: unknown): readonly LoopWakeSource[] {\n\tif (!Array.isArray(value)) throw new InvalidLoopStoreError(`loop entry ${id} has invalid wakeSources`);\n\treturn value.map((candidate): LoopWakeSource => {\n\t\tif (!isRecord(candidate)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid wake source`);\n\t\tconst source = candidate.source;\n\t\tif (typeof source !== \"string\" || !isWakeSourceKind(source)) {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an unknown wake source kind`);\n\t\t}\n\t\tconst description = candidate.description;\n\t\tif (description !== undefined && typeof description !== \"string\") {\n\t\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid wake source description`);\n\t\t}\n\t\treturn {\n\t\t\tsource,\n\t\t\tid: requireString(id, \"wakeSource.id\", candidate.id),\n\t\t\tcreatedAt: requireEpochMs(id, \"wakeSource.createdAt\", candidate.createdAt),\n\t\t\t...(description === undefined ? {} : { description }),\n\t\t};\n\t});\n}\n\nfunction parsePendingWakeup(id: string, value: unknown): PendingWakeup | null {\n\tif (value === null || value === undefined) return null;\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid pendingWakeup`);\n\tconst source = value.source;\n\tif (source !== \"model\" && source !== \"keepalive\") {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid pendingWakeup source`);\n\t}\n\tif (value.kind !== \"dynamic\") throw new InvalidLoopStoreError(`loop entry ${id} has an invalid pendingWakeup kind`);\n\treturn {\n\t\tid: requireString(id, \"pendingWakeup.id\", value.id),\n\t\tloopId: requireString(id, \"pendingWakeup.loopId\", value.loopId),\n\t\tkind: \"dynamic\",\n\t\tsource,\n\t\trequestedDelaySeconds: requireFiniteNumber(\n\t\t\tid,\n\t\t\t\"pendingWakeup.requestedDelaySeconds\",\n\t\t\tvalue.requestedDelaySeconds,\n\t\t),\n\t\tdelaySeconds: requirePositiveInteger(id, \"pendingWakeup.delaySeconds\", value.delaySeconds),\n\t\tdueAt: requireEpochMs(id, \"pendingWakeup.dueAt\", value.dueAt),\n\t\treason: requireString(id, \"pendingWakeup.reason\", value.reason),\n\t\tprompt: requireString(id, \"pendingWakeup.prompt\", value.prompt),\n\t\tnoop: requireBoolean(id, \"pendingWakeup.noop\", value.noop),\n\t\tcreatedAt: requireEpochMs(id, \"pendingWakeup.createdAt\", value.createdAt),\n\t};\n}\n\nfunction parseRequestedInterval(id: string, value: unknown): RequestedInterval {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid requestedInterval`);\n\tconst unit = value.unit;\n\tif (typeof unit !== \"string\" || !isRequestedIntervalUnit(unit)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid requestedInterval unit`);\n\t}\n\treturn {\n\t\tvalue: requirePositiveInteger(id, \"requestedInterval.value\", value.value),\n\t\tunit,\n\t\traw: requireString(id, \"requestedInterval.raw\", value.raw),\n\t};\n}\n\nfunction parseEffectiveInterval(id: string, value: unknown): EffectiveInterval {\n\tif (!isRecord(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid effectiveInterval`);\n\tconst unit = value.unit;\n\tif (typeof unit !== \"string\" || !isEffectiveIntervalUnit(unit)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid effectiveInterval unit`);\n\t}\n\tconst roundingNotice = value.roundingNotice;\n\tif (roundingNotice !== undefined && typeof roundingNotice !== \"string\") {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid effectiveInterval roundingNotice`);\n\t}\n\treturn {\n\t\tvalue: requirePositiveInteger(id, \"effectiveInterval.value\", value.value),\n\t\tunit,\n\t\thuman: requireString(id, \"effectiveInterval.human\", value.human),\n\t\trounded: requireBoolean(id, \"effectiveInterval.rounded\", value.rounded),\n\t\t...(roundingNotice === undefined ? {} : { roundingNotice }),\n\t};\n}\n\nfunction requireString(id: string, field: string, value: unknown, options?: { allowEmpty?: boolean }): string {\n\tif (typeof value !== \"string\" || (options?.allowEmpty !== true && value.length === 0)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value;\n}\n\nfunction requireBoolean(id: string, field: string, value: unknown): boolean {\n\tif (typeof value !== \"boolean\") throw new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\treturn value;\n}\n\nfunction requireFiniteNumber(id: string, field: string, value: unknown): number {\n\tif (typeof value !== \"number\" || !Number.isFinite(value)) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value;\n}\n\nfunction requireNonNegativeInteger(id: string, field: string, value: unknown): number {\n\tif (!Number.isSafeInteger(value) || (value as number) < 0) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value as number;\n}\n\nfunction requirePositiveInteger(id: string, field: string, value: unknown): number {\n\tif (!Number.isSafeInteger(value) || (value as number) <= 0) {\n\t\tthrow new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\t}\n\treturn value as number;\n}\n\nfunction requireEpochMs(id: string, field: string, value: unknown): EpochMs {\n\tif (!isEpochMs(value)) throw new InvalidLoopStoreError(`loop entry ${id} has an invalid ${field}`);\n\treturn value;\n}\n\nfunction parseNullableEpochMs(id: string, field: string, value: unknown): EpochMs | null {\n\tif (value === null || value === undefined) return null;\n\treturn requireEpochMs(id, field, value);\n}\n\nfunction isEpochMs(value: unknown): value is EpochMs {\n\treturn Number.isSafeInteger(value) && (value as number) >= 0;\n}\n\nfunction isLoopPhase(value: string): value is LoopPhase {\n\treturn (LOOP_PHASES as readonly string[]).includes(value);\n}\n\nfunction isLoopEndReason(value: string): value is LoopEndReason {\n\treturn (LOOP_END_REASONS as readonly string[]).includes(value);\n}\n\nfunction isLoopSentinel(value: string): value is LoopSentinel {\n\treturn (LOOP_SENTINELS as readonly string[]).includes(value);\n}\n\nfunction isWakeSourceKind(value: string): value is LoopWakeSourceKind {\n\treturn (LOOP_WAKE_SOURCE_KINDS as readonly string[]).includes(value);\n}\n\nfunction isRequestedIntervalUnit(value: string): value is RequestedIntervalUnit {\n\treturn (REQUESTED_INTERVAL_UNITS as readonly string[]).includes(value);\n}\n\nfunction isEffectiveIntervalUnit(value: string): value is EffectiveIntervalUnit {\n\treturn (EFFECTIVE_INTERVAL_UNITS as readonly string[]).includes(value);\n}\n"]}
@@ -2,6 +2,11 @@
2
2
  * The `schedule_wakeup` model tool: the ONLY model-callable surface of the `/loop`
3
3
  * extension. It lets a dynamic (self-paced) loop pick its own next delay, or end itself.
4
4
  *
5
+ * Exposure: the tool is registered `exposure: "search"` with lazy activation disabled, so it is
6
+ * absent from the resident tool list (and from `tool_search`) until the loop extension activates it
7
+ * for a live dynamic loop and retires it when that loop ends. Outside a dynamic loop every call is
8
+ * an error, so a resident registration only cost prompt tokens.
9
+ *
5
10
  * Two deliberate shape decisions:
6
11
  * - The TypeBox schema is a FLAT object with no root union. Several provider payload
7
12
  * conversions rebuild tool schemas from top-level `properties` only, so a root
@@ -22,7 +27,7 @@ export declare const SCHEDULE_WAKEUP_TOOL = "schedule_wakeup";
22
27
  /** Inclusive bounds the executor clamps `delaySeconds` into. */
23
28
  export declare const MIN_WAKEUP_DELAY_SECONDS = 60;
24
29
  export declare const MAX_WAKEUP_DELAY_SECONDS = 3600;
25
- export declare const SCHEDULE_WAKEUP_DESCRIPTION = "Schedule when to resume work in /loop dynamic mode. Always pass the `prompt` argument unless stopping. Call this as the last action before ending a dynamic loop iteration so the loop remains alive; call with `stop: true` to end the active dynamic loop immediately.\n\n`delaySeconds` is clamped to 60-3600 seconds. For idle polling, normally use 1200-1800 seconds. Avoid choosing 300 seconds merely to poll: short polling repeatedly loses prompt-cache value on many API paths. When work is gated on observable terminal state, use `monitor` instead of sleeping or polling; inspect it with `bash_output` and stop the watcher with `kill_bash`. For delegated work, use the available `task` output and control tools and let task completion notifications wake the session. When a monitor or task notification is the primary wake source, the scheduled delay is only a fallback heartbeat.\n\nFor normal dynamic re-entry, set `prompt` to the complete original command, for example `/loop check the deploy`, preserving the user's text verbatim. Set `noop: true` only when this iteration found no actionable change; consecutive noop iterations are folded in the terminal view. Omit `noop` when stopping. Notify the user only when state changes in a way worth acting on, not once per tick.";
30
+ export declare const SCHEDULE_WAKEUP_DESCRIPTION = "Schedule when to resume work in /loop dynamic mode. Always pass the `prompt` argument unless stopping. Call this as the last action before ending a dynamic loop iteration so the loop remains alive; call with `stop: true` to end the active dynamic loop immediately.\n\n`delaySeconds` is clamped to 60-3600 seconds; 1200-1800 is the normal idle range, and a short delay chosen merely to poll loses prompt-cache value on many API paths. When a monitor or task notification is the primary wake source, the scheduled delay is only a fallback heartbeat.\n\nFor normal dynamic re-entry, set `prompt` to the complete original command, for example `/loop check the deploy`, preserving the user's text verbatim. Set `noop: true` only when this iteration found no actionable change; consecutive noop iterations are folded in the terminal view. Omit `noop` when stopping. Notify the user only when state changes in a way worth acting on, not once per tick.";
26
31
  export declare const scheduleWakeupSchema: Type.TObject<{
27
32
  delaySeconds: Type.TOptional<Type.TInteger>;
28
33
  reason: Type.TString;
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,KAAK,EAAmB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE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AED;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC3C,qEAAqE;IACrE,eAAe,IAAI,oBAAoB,CAAC;IACxC,cAAc,CAAC,OAAO,EAAE,qBAAqB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAC/E,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;CAClF;AAED,MAAM,WAAW,wBAAwB;IACxC,QAAQ,CAAC,SAAS,EAAE,2BAA2B,CAAC;CAChD;AAED,eAAO,MAAM,4BAA4B,sEAA8E,CAAC;AACxH,eAAO,MAAM,gBAAgB,2GAAmH,CAAC;AACjJ,eAAO,MAAM,oBAAoB,kEAAkE,CAAC;AACpG,eAAO,MAAM,mBAAmB,kDAAkD,CAAC;AACnF,eAAO,MAAM,uBAAuB,6DAA6D,CAAC;AAClG,eAAO,MAAM,kBAAkB,8CAA8C,CAAC;AAC9E,eAAO,MAAM,oBAAoB,4CAA4C,CAAC;AAkG9E,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,wBAAwB,GAAG,IAAI,CAcxF"}
@@ -2,6 +2,11 @@
2
2
  * The `schedule_wakeup` model tool: the ONLY model-callable surface of the `/loop`
3
3
  * extension. It lets a dynamic (self-paced) loop pick its own next delay, or end itself.
4
4
  *
5
+ * Exposure: the tool is registered `exposure: "search"` with lazy activation disabled, so it is
6
+ * absent from the resident tool list (and from `tool_search`) until the loop extension activates it
7
+ * for a live dynamic loop and retires it when that loop ends. Outside a dynamic loop every call is
8
+ * an error, so a resident registration only cost prompt tokens.
9
+ *
5
10
  * Two deliberate shape decisions:
6
11
  * - The TypeBox schema is a FLAT object with no root union. Several provider payload
7
12
  * conversions rebuild tool schemas from top-level `properties` only, so a root
@@ -22,7 +27,7 @@ export const MIN_WAKEUP_DELAY_SECONDS = 60;
22
27
  export const MAX_WAKEUP_DELAY_SECONDS = 3600;
23
28
  export const SCHEDULE_WAKEUP_DESCRIPTION = `Schedule when to resume work in /loop dynamic mode. Always pass the \`prompt\` argument unless stopping. Call this as the last action before ending a dynamic loop iteration so the loop remains alive; call with \`stop: true\` to end the active dynamic loop immediately.
24
29
 
25
- \`delaySeconds\` is clamped to ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS} seconds. For idle polling, normally use 1200-1800 seconds. Avoid choosing 300 seconds merely to poll: short polling repeatedly loses prompt-cache value on many API paths. When work is gated on observable terminal state, use \`monitor\` instead of sleeping or polling; inspect it with \`bash_output\` and stop the watcher with \`kill_bash\`. For delegated work, use the available \`task\` output and control tools and let task completion notifications wake the session. When a monitor or task notification is the primary wake source, the scheduled delay is only a fallback heartbeat.
30
+ \`delaySeconds\` is clamped to ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS} seconds; 1200-1800 is the normal idle range, and a short delay chosen merely to poll loses prompt-cache value on many API paths. When a monitor or task notification is the primary wake source, the scheduled delay is only a fallback heartbeat.
26
31
 
27
32
  For normal dynamic re-entry, set \`prompt\` to the complete original command, for example \`/loop check the deploy\`, preserving the user's text verbatim. Set \`noop: true\` only when this iteration found no actionable change; consecutive noop iterations are folded in the terminal view. Omit \`noop\` when stopping. Notify the user only when state changes in a way worth acting on, not once per tick.`;
28
33
  export const scheduleWakeupSchema = Type.Object({
@@ -145,6 +150,8 @@ export function registerLoopTools(pi, deps) {
145
150
  label: "Schedule Wakeup",
146
151
  description: SCHEDULE_WAKEUP_DESCRIPTION,
147
152
  parameters: scheduleWakeupSchema,
153
+ exposure: "search",
154
+ allowLazyActivation: false,
148
155
  // Sequential so two concurrent model tool calls cannot race scheduler state.
149
156
  executionMode: "sequential",
150
157
  async execute(_toolCallId, params) {
@@ -1 +1 @@
1
- {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,IAAI,E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UAAU,EAAE,oBAAoB;QAChC,6EAA6E;QAC7E,aAAa,EAAE,YAAY;QAC3B,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM;YAChC,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC7G,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The `schedule_wakeup` model tool: the ONLY model-callable surface of the `/loop`\n * extension. It lets a dynamic (self-paced) loop pick its own next delay, or end itself.\n *\n * Two deliberate shape decisions:\n * - The TypeBox schema is a FLAT object with no root union. Several provider payload\n * conversions rebuild tool schemas from top-level `properties` only, so a root\n * `anyOf` would reach the model as an empty schema (same reasoning as\n * `terminal/tools/monitor.ts`). Branch requirements are enforced in `execute`.\n * - `delaySeconds` carries NO schema `minimum`/`maximum`. The contract clamps\n * out-of-range integers instead of rejecting them, and schema bounds would make the\n * clamp unreachable.\n *\n * Scheduler state is never mutated here: every effect goes through the injected\n * `ScheduleWakeupSchedulerPort`.\n */\n\nimport { Type } from \"typebox\";\nimport type { AgentToolResult, ExtensionAPI } from \"../../types.ts\";\nimport type { EpochMs, LoopId, WakeupId } from \"./types.ts\";\n\n/** Model-visible tool name. */\nexport const SCHEDULE_WAKEUP_TOOL = \"schedule_wakeup\";\n\n/** Inclusive bounds the executor clamps `delaySeconds` into. */\nexport const MIN_WAKEUP_DELAY_SECONDS = 60;\nexport const MAX_WAKEUP_DELAY_SECONDS = 3600;\n\nexport const SCHEDULE_WAKEUP_DESCRIPTION = `Schedule when to resume work in /loop dynamic mode. Always pass the \\`prompt\\` argument unless stopping. Call this as the last action before ending a dynamic loop iteration so the loop remains alive; call with \\`stop: true\\` to end the active dynamic loop immediately.\n\n\\`delaySeconds\\` is clamped to ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS} seconds. For idle polling, normally use 1200-1800 seconds. Avoid choosing 300 seconds merely to poll: short polling repeatedly loses prompt-cache value on many API paths. When work is gated on observable terminal state, use \\`monitor\\` instead of sleeping or polling; inspect it with \\`bash_output\\` and stop the watcher with \\`kill_bash\\`. For delegated work, use the available \\`task\\` output and control tools and let task completion notifications wake the session. When a monitor or task notification is the primary wake source, the scheduled delay is only a fallback heartbeat.\n\nFor normal dynamic re-entry, set \\`prompt\\` to the complete original command, for example \\`/loop check the deploy\\`, preserving the user's text verbatim. Set \\`noop: true\\` only when this iteration found no actionable change; consecutive noop iterations are folded in the terminal view. Omit \\`noop\\` when stopping. Notify the user only when state changes in a way worth acting on, not once per tick.`;\n\nexport const scheduleWakeupSchema = Type.Object(\n\t{\n\t\tdelaySeconds: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription: `Dynamic loop delay in seconds. Values are clamped to ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS}.`,\n\t\t\t}),\n\t\t),\n\t\treason: Type.String({\n\t\t\tminLength: 1,\n\t\t\tdescription: \"Why this wakeup or stop is appropriate. Must not be blank.\",\n\t\t}),\n\t\tprompt: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Prompt to dispatch when the wakeup fires. Required unless stop is true; preserve the original /loop command verbatim for normal dynamic re-entry.\",\n\t\t\t}),\n\t\t),\n\t\tstop: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"End the active dynamic loop immediately instead of scheduling another wakeup.\",\n\t\t\t}),\n\t\t),\n\t\tnoop: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"True when this iteration observed no actionable change. Consecutive noop iterations are folded in the terminal view. Omit when stopping.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\n/** Runtime-validated parameter shape; the schema itself stays flat and permissive. */\nexport interface ScheduleWakeupParams {\n\treadonly delaySeconds?: number;\n\treadonly reason: string;\n\treadonly prompt?: string;\n\treadonly stop?: boolean;\n\treadonly noop?: boolean;\n}\n\nexport interface ScheduleWakeupScheduledDetails {\n\treadonly ok: true;\n\treadonly action: \"scheduled\";\n\treadonly loopId: LoopId;\n\treadonly wakeupId: WakeupId;\n\treadonly replacedWakeupId?: WakeupId;\n\n\t/** Integer the model asked for, before the clamp. */\n\treadonly requestedDelaySeconds: number;\n\t/** Effective delay after clamping to `[60, 3600]`. */\n\treadonly delaySeconds: number;\n\treadonly clamped: boolean;\n\treadonly dueAt: EpochMs;\n\n\treadonly reason: string;\n\t/** Preserved verbatim after the non-blank check. */\n\treadonly prompt: string;\n\treadonly noop: boolean;\n\treadonly noopStreak: number;\n}\n\nexport interface ScheduleWakeupStoppedDetails {\n\treadonly ok: true;\n\treadonly action: \"stopped\";\n\treadonly loopId: LoopId;\n\treadonly terminalReason: \"stopped\";\n\treadonly reason: string;\n\treadonly endedAt: EpochMs;\n\t/** Fields accepted for model compatibility but not applied. */\n\treadonly ignoredFields: readonly ScheduleWakeupIgnorableField[];\n}\n\nexport type ScheduleWakeupIgnorableField = \"delaySeconds\" | \"prompt\";\n\nexport type ScheduleWakeupDetails = ScheduleWakeupScheduledDetails | ScheduleWakeupStoppedDetails;\n\n/**\n * Which loop, if any, this tool call belongs to. `null` means no loop context at all;\n * a `fixed` target means the call came from a fixed tick, whose schedule re-arms itself.\n */\nexport type ScheduleWakeupTarget = { readonly kind: \"dynamic\" | \"fixed\"; readonly loopId: LoopId } | null;\n\nexport interface ScheduleWakeupRequest {\n\treadonly loopId: LoopId;\n\treadonly requestedDelaySeconds: number;\n\treadonly delaySeconds: number;\n\treadonly reason: string;\n\treadonly prompt: string;\n\treadonly noop: boolean;\n}\n\nexport interface ScheduleWakeupOutcome {\n\treadonly wakeupId: WakeupId;\n\t/** Set when this schedule replaced a still-pending wakeup for the same loop. */\n\treadonly replacedWakeupId?: WakeupId;\n\treadonly dueAt: EpochMs;\n\treadonly noopStreak: number;\n}\n\nexport interface StopDynamicLoopRequest {\n\treadonly loopId: LoopId;\n\treadonly reason: string;\n}\n\nexport interface StopDynamicLoopOutcome {\n\treadonly endedAt: EpochMs;\n}\n\n/**\n * Minimal scheduler surface this tool needs. Declared locally so the tool module stays\n * independent of the scheduler implementation and testable with a fake.\n */\nexport interface ScheduleWakeupSchedulerPort {\n\t/** Loop the current turn is attributed to, resolved at call time. */\n\tgetWakeupTarget(): ScheduleWakeupTarget;\n\tscheduleWakeup(request: ScheduleWakeupRequest): Promise<ScheduleWakeupOutcome>;\n\tstopDynamicLoop(request: StopDynamicLoopRequest): Promise<StopDynamicLoopOutcome>;\n}\n\nexport interface LoopToolRegistrationDeps {\n\treadonly scheduler: ScheduleWakeupSchedulerPort;\n}\n\nexport const NO_ACTIVE_DYNAMIC_LOOP_ERROR = `${SCHEDULE_WAKEUP_TOOL} can only be used while a dynamic /loop is active.`;\nexport const FIXED_TICK_ERROR = `This is a fixed /loop tick; the recurring schedule re-arms automatically. Do not call ${SCHEDULE_WAKEUP_TOOL}.`;\nexport const MISSING_PROMPT_ERROR = \"prompt is required and must be non-empty unless stop is true.\";\nexport const MISSING_DELAY_ERROR = \"delaySeconds is required unless stop is true.\";\nexport const NON_INTEGER_DELAY_ERROR = \"delaySeconds must be a finite integer number of seconds.\";\nexport const BLANK_REASON_ERROR = \"reason is required and must be non-empty.\";\nexport const NOOP_WITH_STOP_ERROR = \"noop must be omitted when stop is true.\";\n\nfunction clampDelaySeconds(requested: number): number {\n\treturn Math.min(MAX_WAKEUP_DELAY_SECONDS, Math.max(MIN_WAKEUP_DELAY_SECONDS, requested));\n}\n\nfunction resolveDynamicLoopId(scheduler: ScheduleWakeupSchedulerPort): LoopId {\n\tconst target = scheduler.getWakeupTarget();\n\tif (target === null) throw new Error(NO_ACTIVE_DYNAMIC_LOOP_ERROR);\n\tif (target.kind === \"fixed\") throw new Error(FIXED_TICK_ERROR);\n\treturn target.loopId;\n}\n\nfunction requireReason(reason: string): string {\n\tconst trimmed = typeof reason === \"string\" ? reason.trim() : \"\";\n\tif (trimmed.length === 0) throw new Error(BLANK_REASON_ERROR);\n\treturn trimmed;\n}\n\nfunction collectIgnoredFields(params: ScheduleWakeupParams): ScheduleWakeupIgnorableField[] {\n\tconst ignored: ScheduleWakeupIgnorableField[] = [];\n\tif (params.delaySeconds !== undefined) ignored.push(\"delaySeconds\");\n\tif (params.prompt !== undefined) ignored.push(\"prompt\");\n\treturn ignored;\n}\n\nasync function executeStop(\n\tscheduler: ScheduleWakeupSchedulerPort,\n\tparams: ScheduleWakeupParams,\n): Promise<AgentToolResult<ScheduleWakeupDetails>> {\n\tif (params.noop !== undefined) throw new Error(NOOP_WITH_STOP_ERROR);\n\tconst reason = requireReason(params.reason);\n\tconst loopId = resolveDynamicLoopId(scheduler);\n\tconst ignoredFields = collectIgnoredFields(params);\n\tconst { endedAt } = await scheduler.stopDynamicLoop({ loopId, reason });\n\treturn {\n\t\tcontent: [{ type: \"text\" as const, text: `Stopped dynamic loop ${loopId}.` }],\n\t\tdetails: {\n\t\t\tok: true,\n\t\t\taction: \"stopped\",\n\t\t\tloopId,\n\t\t\tterminalReason: \"stopped\",\n\t\t\treason,\n\t\t\tendedAt,\n\t\t\tignoredFields,\n\t\t},\n\t};\n}\n\nasync function executeSchedule(\n\tscheduler: ScheduleWakeupSchedulerPort,\n\tparams: ScheduleWakeupParams,\n): Promise<AgentToolResult<ScheduleWakeupDetails>> {\n\tconst reason = requireReason(params.reason);\n\tconst requestedDelaySeconds = params.delaySeconds;\n\tif (requestedDelaySeconds === undefined) throw new Error(MISSING_DELAY_ERROR);\n\tif (!Number.isInteger(requestedDelaySeconds)) throw new Error(NON_INTEGER_DELAY_ERROR);\n\tconst prompt = params.prompt;\n\tif (prompt === undefined || prompt.trim().length === 0) throw new Error(MISSING_PROMPT_ERROR);\n\n\tconst loopId = resolveDynamicLoopId(scheduler);\n\tconst delaySeconds = clampDelaySeconds(requestedDelaySeconds);\n\tconst clamped = delaySeconds !== requestedDelaySeconds;\n\tconst noop = params.noop === true;\n\n\tconst outcome = await scheduler.scheduleWakeup({\n\t\tloopId,\n\t\trequestedDelaySeconds,\n\t\tdelaySeconds,\n\t\treason,\n\t\tprompt,\n\t\tnoop,\n\t});\n\n\tconst text = clamped\n\t\t? `Scheduled loop ${loopId} in ${delaySeconds}s; requested ${requestedDelaySeconds}s was clamped to the supported ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS}s range.`\n\t\t: `Scheduled loop ${loopId} in ${delaySeconds}s.`;\n\n\treturn {\n\t\tcontent: [{ type: \"text\" as const, text }],\n\t\tdetails: {\n\t\t\tok: true,\n\t\t\taction: \"scheduled\",\n\t\t\tloopId,\n\t\t\twakeupId: outcome.wakeupId,\n\t\t\t...(outcome.replacedWakeupId === undefined ? {} : { replacedWakeupId: outcome.replacedWakeupId }),\n\t\t\trequestedDelaySeconds,\n\t\t\tdelaySeconds,\n\t\t\tclamped,\n\t\t\tdueAt: outcome.dueAt,\n\t\t\treason,\n\t\t\tprompt,\n\t\t\tnoop,\n\t\t\tnoopStreak: outcome.noopStreak,\n\t\t},\n\t};\n}\n\nexport function registerLoopTools(pi: ExtensionAPI, deps: LoopToolRegistrationDeps): void {\n\tpi.registerTool({\n\t\tname: SCHEDULE_WAKEUP_TOOL,\n\t\tlabel: \"Schedule Wakeup\",\n\t\tdescription: SCHEDULE_WAKEUP_DESCRIPTION,\n\t\tparameters: scheduleWakeupSchema,\n\t\t// Sequential so two concurrent model tool calls cannot race scheduler state.\n\t\texecutionMode: \"sequential\",\n\t\tasync execute(_toolCallId, params): Promise<AgentToolResult<ScheduleWakeupDetails>> {\n\t\t\treturn params.stop === true ? executeStop(deps.scheduler, params) : executeSchedule(deps.scheduler, params);\n\t\t},\n\t});\n}\n"]}
1
+ {"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/loop/tools.ts"],"names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AE,oBAAoB;QAC1B,KAAK,EAAE,iBAAiB;QACxB,WAAW,EAAE,2BAA2B;QACxC,UAAU,EAAE,oBAAoB;QAChC,QAAQ,EAAE,QAAQ;QAClB,mBAAmB,EAAE,KAAK;QAC1B,6EAA6E;QAC7E,aAAa,EAAE,YAAY;QAC3B,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,MAAM;YAChC,OAAO,MAAM,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC7G,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * The `schedule_wakeup` model tool: the ONLY model-callable surface of the `/loop`\n * extension. It lets a dynamic (self-paced) loop pick its own next delay, or end itself.\n *\n * Exposure: the tool is registered `exposure: \"search\"` with lazy activation disabled, so it is\n * absent from the resident tool list (and from `tool_search`) until the loop extension activates it\n * for a live dynamic loop and retires it when that loop ends. Outside a dynamic loop every call is\n * an error, so a resident registration only cost prompt tokens.\n *\n * Two deliberate shape decisions:\n * - The TypeBox schema is a FLAT object with no root union. Several provider payload\n * conversions rebuild tool schemas from top-level `properties` only, so a root\n * `anyOf` would reach the model as an empty schema (same reasoning as\n * `terminal/tools/monitor.ts`). Branch requirements are enforced in `execute`.\n * - `delaySeconds` carries NO schema `minimum`/`maximum`. The contract clamps\n * out-of-range integers instead of rejecting them, and schema bounds would make the\n * clamp unreachable.\n *\n * Scheduler state is never mutated here: every effect goes through the injected\n * `ScheduleWakeupSchedulerPort`.\n */\n\nimport { Type } from \"typebox\";\nimport type { AgentToolResult, ExtensionAPI } from \"../../types.ts\";\nimport type { EpochMs, LoopId, WakeupId } from \"./types.ts\";\n\n/** Model-visible tool name. */\nexport const SCHEDULE_WAKEUP_TOOL = \"schedule_wakeup\";\n\n/** Inclusive bounds the executor clamps `delaySeconds` into. */\nexport const MIN_WAKEUP_DELAY_SECONDS = 60;\nexport const MAX_WAKEUP_DELAY_SECONDS = 3600;\n\nexport const SCHEDULE_WAKEUP_DESCRIPTION = `Schedule when to resume work in /loop dynamic mode. Always pass the \\`prompt\\` argument unless stopping. Call this as the last action before ending a dynamic loop iteration so the loop remains alive; call with \\`stop: true\\` to end the active dynamic loop immediately.\n\n\\`delaySeconds\\` is clamped to ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS} seconds; 1200-1800 is the normal idle range, and a short delay chosen merely to poll loses prompt-cache value on many API paths. When a monitor or task notification is the primary wake source, the scheduled delay is only a fallback heartbeat.\n\nFor normal dynamic re-entry, set \\`prompt\\` to the complete original command, for example \\`/loop check the deploy\\`, preserving the user's text verbatim. Set \\`noop: true\\` only when this iteration found no actionable change; consecutive noop iterations are folded in the terminal view. Omit \\`noop\\` when stopping. Notify the user only when state changes in a way worth acting on, not once per tick.`;\n\nexport const scheduleWakeupSchema = Type.Object(\n\t{\n\t\tdelaySeconds: Type.Optional(\n\t\t\tType.Integer({\n\t\t\t\tdescription: `Dynamic loop delay in seconds. Values are clamped to ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS}.`,\n\t\t\t}),\n\t\t),\n\t\treason: Type.String({\n\t\t\tminLength: 1,\n\t\t\tdescription: \"Why this wakeup or stop is appropriate. Must not be blank.\",\n\t\t}),\n\t\tprompt: Type.Optional(\n\t\t\tType.String({\n\t\t\t\tdescription:\n\t\t\t\t\t\"Prompt to dispatch when the wakeup fires. Required unless stop is true; preserve the original /loop command verbatim for normal dynamic re-entry.\",\n\t\t\t}),\n\t\t),\n\t\tstop: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription: \"End the active dynamic loop immediately instead of scheduling another wakeup.\",\n\t\t\t}),\n\t\t),\n\t\tnoop: Type.Optional(\n\t\t\tType.Boolean({\n\t\t\t\tdescription:\n\t\t\t\t\t\"True when this iteration observed no actionable change. Consecutive noop iterations are folded in the terminal view. Omit when stopping.\",\n\t\t\t}),\n\t\t),\n\t},\n\t{ additionalProperties: false },\n);\n\n/** Runtime-validated parameter shape; the schema itself stays flat and permissive. */\nexport interface ScheduleWakeupParams {\n\treadonly delaySeconds?: number;\n\treadonly reason: string;\n\treadonly prompt?: string;\n\treadonly stop?: boolean;\n\treadonly noop?: boolean;\n}\n\nexport interface ScheduleWakeupScheduledDetails {\n\treadonly ok: true;\n\treadonly action: \"scheduled\";\n\treadonly loopId: LoopId;\n\treadonly wakeupId: WakeupId;\n\treadonly replacedWakeupId?: WakeupId;\n\n\t/** Integer the model asked for, before the clamp. */\n\treadonly requestedDelaySeconds: number;\n\t/** Effective delay after clamping to `[60, 3600]`. */\n\treadonly delaySeconds: number;\n\treadonly clamped: boolean;\n\treadonly dueAt: EpochMs;\n\n\treadonly reason: string;\n\t/** Preserved verbatim after the non-blank check. */\n\treadonly prompt: string;\n\treadonly noop: boolean;\n\treadonly noopStreak: number;\n}\n\nexport interface ScheduleWakeupStoppedDetails {\n\treadonly ok: true;\n\treadonly action: \"stopped\";\n\treadonly loopId: LoopId;\n\treadonly terminalReason: \"stopped\";\n\treadonly reason: string;\n\treadonly endedAt: EpochMs;\n\t/** Fields accepted for model compatibility but not applied. */\n\treadonly ignoredFields: readonly ScheduleWakeupIgnorableField[];\n}\n\nexport type ScheduleWakeupIgnorableField = \"delaySeconds\" | \"prompt\";\n\nexport type ScheduleWakeupDetails = ScheduleWakeupScheduledDetails | ScheduleWakeupStoppedDetails;\n\n/**\n * Which loop, if any, this tool call belongs to. `null` means no loop context at all;\n * a `fixed` target means the call came from a fixed tick, whose schedule re-arms itself.\n */\nexport type ScheduleWakeupTarget = { readonly kind: \"dynamic\" | \"fixed\"; readonly loopId: LoopId } | null;\n\nexport interface ScheduleWakeupRequest {\n\treadonly loopId: LoopId;\n\treadonly requestedDelaySeconds: number;\n\treadonly delaySeconds: number;\n\treadonly reason: string;\n\treadonly prompt: string;\n\treadonly noop: boolean;\n}\n\nexport interface ScheduleWakeupOutcome {\n\treadonly wakeupId: WakeupId;\n\t/** Set when this schedule replaced a still-pending wakeup for the same loop. */\n\treadonly replacedWakeupId?: WakeupId;\n\treadonly dueAt: EpochMs;\n\treadonly noopStreak: number;\n}\n\nexport interface StopDynamicLoopRequest {\n\treadonly loopId: LoopId;\n\treadonly reason: string;\n}\n\nexport interface StopDynamicLoopOutcome {\n\treadonly endedAt: EpochMs;\n}\n\n/**\n * Minimal scheduler surface this tool needs. Declared locally so the tool module stays\n * independent of the scheduler implementation and testable with a fake.\n */\nexport interface ScheduleWakeupSchedulerPort {\n\t/** Loop the current turn is attributed to, resolved at call time. */\n\tgetWakeupTarget(): ScheduleWakeupTarget;\n\tscheduleWakeup(request: ScheduleWakeupRequest): Promise<ScheduleWakeupOutcome>;\n\tstopDynamicLoop(request: StopDynamicLoopRequest): Promise<StopDynamicLoopOutcome>;\n}\n\nexport interface LoopToolRegistrationDeps {\n\treadonly scheduler: ScheduleWakeupSchedulerPort;\n}\n\nexport const NO_ACTIVE_DYNAMIC_LOOP_ERROR = `${SCHEDULE_WAKEUP_TOOL} can only be used while a dynamic /loop is active.`;\nexport const FIXED_TICK_ERROR = `This is a fixed /loop tick; the recurring schedule re-arms automatically. Do not call ${SCHEDULE_WAKEUP_TOOL}.`;\nexport const MISSING_PROMPT_ERROR = \"prompt is required and must be non-empty unless stop is true.\";\nexport const MISSING_DELAY_ERROR = \"delaySeconds is required unless stop is true.\";\nexport const NON_INTEGER_DELAY_ERROR = \"delaySeconds must be a finite integer number of seconds.\";\nexport const BLANK_REASON_ERROR = \"reason is required and must be non-empty.\";\nexport const NOOP_WITH_STOP_ERROR = \"noop must be omitted when stop is true.\";\n\nfunction clampDelaySeconds(requested: number): number {\n\treturn Math.min(MAX_WAKEUP_DELAY_SECONDS, Math.max(MIN_WAKEUP_DELAY_SECONDS, requested));\n}\n\nfunction resolveDynamicLoopId(scheduler: ScheduleWakeupSchedulerPort): LoopId {\n\tconst target = scheduler.getWakeupTarget();\n\tif (target === null) throw new Error(NO_ACTIVE_DYNAMIC_LOOP_ERROR);\n\tif (target.kind === \"fixed\") throw new Error(FIXED_TICK_ERROR);\n\treturn target.loopId;\n}\n\nfunction requireReason(reason: string): string {\n\tconst trimmed = typeof reason === \"string\" ? reason.trim() : \"\";\n\tif (trimmed.length === 0) throw new Error(BLANK_REASON_ERROR);\n\treturn trimmed;\n}\n\nfunction collectIgnoredFields(params: ScheduleWakeupParams): ScheduleWakeupIgnorableField[] {\n\tconst ignored: ScheduleWakeupIgnorableField[] = [];\n\tif (params.delaySeconds !== undefined) ignored.push(\"delaySeconds\");\n\tif (params.prompt !== undefined) ignored.push(\"prompt\");\n\treturn ignored;\n}\n\nasync function executeStop(\n\tscheduler: ScheduleWakeupSchedulerPort,\n\tparams: ScheduleWakeupParams,\n): Promise<AgentToolResult<ScheduleWakeupDetails>> {\n\tif (params.noop !== undefined) throw new Error(NOOP_WITH_STOP_ERROR);\n\tconst reason = requireReason(params.reason);\n\tconst loopId = resolveDynamicLoopId(scheduler);\n\tconst ignoredFields = collectIgnoredFields(params);\n\tconst { endedAt } = await scheduler.stopDynamicLoop({ loopId, reason });\n\treturn {\n\t\tcontent: [{ type: \"text\" as const, text: `Stopped dynamic loop ${loopId}.` }],\n\t\tdetails: {\n\t\t\tok: true,\n\t\t\taction: \"stopped\",\n\t\t\tloopId,\n\t\t\tterminalReason: \"stopped\",\n\t\t\treason,\n\t\t\tendedAt,\n\t\t\tignoredFields,\n\t\t},\n\t};\n}\n\nasync function executeSchedule(\n\tscheduler: ScheduleWakeupSchedulerPort,\n\tparams: ScheduleWakeupParams,\n): Promise<AgentToolResult<ScheduleWakeupDetails>> {\n\tconst reason = requireReason(params.reason);\n\tconst requestedDelaySeconds = params.delaySeconds;\n\tif (requestedDelaySeconds === undefined) throw new Error(MISSING_DELAY_ERROR);\n\tif (!Number.isInteger(requestedDelaySeconds)) throw new Error(NON_INTEGER_DELAY_ERROR);\n\tconst prompt = params.prompt;\n\tif (prompt === undefined || prompt.trim().length === 0) throw new Error(MISSING_PROMPT_ERROR);\n\n\tconst loopId = resolveDynamicLoopId(scheduler);\n\tconst delaySeconds = clampDelaySeconds(requestedDelaySeconds);\n\tconst clamped = delaySeconds !== requestedDelaySeconds;\n\tconst noop = params.noop === true;\n\n\tconst outcome = await scheduler.scheduleWakeup({\n\t\tloopId,\n\t\trequestedDelaySeconds,\n\t\tdelaySeconds,\n\t\treason,\n\t\tprompt,\n\t\tnoop,\n\t});\n\n\tconst text = clamped\n\t\t? `Scheduled loop ${loopId} in ${delaySeconds}s; requested ${requestedDelaySeconds}s was clamped to the supported ${MIN_WAKEUP_DELAY_SECONDS}-${MAX_WAKEUP_DELAY_SECONDS}s range.`\n\t\t: `Scheduled loop ${loopId} in ${delaySeconds}s.`;\n\n\treturn {\n\t\tcontent: [{ type: \"text\" as const, text }],\n\t\tdetails: {\n\t\t\tok: true,\n\t\t\taction: \"scheduled\",\n\t\t\tloopId,\n\t\t\twakeupId: outcome.wakeupId,\n\t\t\t...(outcome.replacedWakeupId === undefined ? {} : { replacedWakeupId: outcome.replacedWakeupId }),\n\t\t\trequestedDelaySeconds,\n\t\t\tdelaySeconds,\n\t\t\tclamped,\n\t\t\tdueAt: outcome.dueAt,\n\t\t\treason,\n\t\t\tprompt,\n\t\t\tnoop,\n\t\t\tnoopStreak: outcome.noopStreak,\n\t\t},\n\t};\n}\n\nexport function registerLoopTools(pi: ExtensionAPI, deps: LoopToolRegistrationDeps): void {\n\tpi.registerTool({\n\t\tname: SCHEDULE_WAKEUP_TOOL,\n\t\tlabel: \"Schedule Wakeup\",\n\t\tdescription: SCHEDULE_WAKEUP_DESCRIPTION,\n\t\tparameters: scheduleWakeupSchema,\n\t\texposure: \"search\",\n\t\tallowLazyActivation: false,\n\t\t// Sequential so two concurrent model tool calls cannot race scheduler state.\n\t\texecutionMode: \"sequential\",\n\t\tasync execute(_toolCallId, params): Promise<AgentToolResult<ScheduleWakeupDetails>> {\n\t\t\treturn params.stop === true ? executeStop(deps.scheduler, params) : executeSchedule(deps.scheduler, params);\n\t\t},\n\t});\n}\n"]}
@@ -24,6 +24,8 @@ export declare function isContinuationHoldStateEvent(data: unknown): data is Con
24
24
  /** One live watch as broadcast on the monitor state event; mirrors MonitorSnapshotEntry. */
25
25
  export interface TerminalMonitorStateMonitorEntry {
26
26
  readonly id: string;
27
+ /** Stable "mon_" identity surviving runtime id churn; absent in pre-enrichment payloads. */
28
+ readonly monitorId?: string;
27
29
  readonly description: string;
28
30
  readonly paused: boolean;
29
31
  /** Epoch milliseconds when the watch registered; lets consumers render their own elapsed labels. */
@@ -1 +1 @@
1
- {"version":3,"file":"monitor-state-event.d.ts","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/monitor-state-event.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,4BAA4B,2BAA2B,CAAC;AACrE,eAAO,MAAM,uBAAuB,sBAAsB,CAAC;AAC3D,eAAO,MAAM,6BAA6B,4BAA4B,CAAC;AAEvE,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,oBAAoB;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAChD;AAED,MAAM,WAAW,0BAA0B;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CACzB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,oBAAoB,CAWlF;AAED,wBAAgB,4BAA4B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IAAI;QACrB,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;QACpC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CACjC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,IAAa;IACzD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACtB,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,CAChC,CAAC;AACH,CAAC;AAiBD,MAAM,UAAU,2BAA2B,CAAC,IAAa;IACxD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,aAAa,IAAI,IAAI;QACrB,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;QACpC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC;QAClC,IAAI,CAAC,WAAW,IAAI,CAAC,CACrB,CAAC;AACH,CAAC","sourcesContent":["export const TERMINAL_MONITOR_STATE_EVENT = \"terminal_monitor_state\";\nexport const WAKE_SOURCE_STATE_EVENT = \"wake_source_state\";\nexport const CONTINUATION_HOLD_STATE_EVENT = \"continuation_hold_state\";\n\nexport interface WakeSourceStateItem {\n\treadonly id: string;\n\treadonly description?: string;\n\treadonly startedAtMs?: number;\n}\n\nexport interface WakeSourceStateEvent {\n\treadonly source: string;\n\treadonly activeCount: number;\n\treadonly items?: readonly WakeSourceStateItem[];\n}\n\nexport interface ContinuationHoldStateEvent {\n\treadonly source: string;\n\treadonly active: boolean;\n}\n\n/**\n * Deliberately validates only the shared cross-package fields. Emitters may add\n * source-specific details such as `channels` or `monitors`.\n */\nexport function isWakeSourceStateEvent(data: unknown): data is WakeSourceStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"source\" in data &&\n\t\ttypeof data.source === \"string\" &&\n\t\tdata.source.length > 0 &&\n\t\t\"activeCount\" in data &&\n\t\ttypeof data.activeCount === \"number\" &&\n\t\tNumber.isFinite(data.activeCount)\n\t);\n}\n\nexport function isContinuationHoldStateEvent(data: unknown): data is ContinuationHoldStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"source\" in data &&\n\t\ttypeof data.source === \"string\" &&\n\t\tdata.source.length > 0 &&\n\t\t\"active\" in data &&\n\t\ttypeof data.active === \"boolean\"\n\t);\n}\n\n/** One live watch as broadcast on the monitor state event; mirrors MonitorSnapshotEntry. */\nexport interface TerminalMonitorStateMonitorEntry {\n\treadonly id: string;\n\treadonly description: string;\n\treadonly paused: boolean;\n\t/** Epoch milliseconds when the watch registered; lets consumers render their own elapsed labels. */\n\treadonly startedAtMs: number;\n}\n\nexport interface TerminalMonitorStateEvent {\n\treadonly activeCount: number;\n\t/** Per-watch detail for consumers that need more than the count; absent in pre-enrichment payloads. */\n\treadonly monitors?: readonly TerminalMonitorStateMonitorEntry[];\n}\n\nexport function isTerminalMonitorStateEvent(data: unknown): data is TerminalMonitorStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"activeCount\" in data &&\n\t\ttypeof data.activeCount === \"number\" &&\n\t\tNumber.isInteger(data.activeCount) &&\n\t\tdata.activeCount >= 0\n\t);\n}\n"]}
1
+ {"version":3,"file":"monitor-state-event.js","sourceRoot":"","sources":["../../../../src/core/extensions/builtin/monitor-state-event.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,4BAA4B,GAAG,wBAAwB,CAAC;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAC3D,MAAM,CAAC,MAAM,6BAA6B,GAAG,yBAAyB,CAAC;AAmBvE;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAa;IACnD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACtB,aAAa,IAAI,IAAI;QACrB,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;QACpC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,CACjC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,IAAa;IACzD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,QAAQ;QAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QACtB,QAAQ,IAAI,IAAI;QAChB,OAAO,IAAI,CAAC,MAAM,KAAK,SAAS,CAChC,CAAC;AACH,CAAC;AAmBD,MAAM,UAAU,2BAA2B,CAAC,IAAa;IACxD,OAAO,CACN,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACb,aAAa,IAAI,IAAI;QACrB,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ;QACpC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC;QAClC,IAAI,CAAC,WAAW,IAAI,CAAC,CACrB,CAAC;AACH,CAAC","sourcesContent":["export const TERMINAL_MONITOR_STATE_EVENT = \"terminal_monitor_state\";\nexport const WAKE_SOURCE_STATE_EVENT = \"wake_source_state\";\nexport const CONTINUATION_HOLD_STATE_EVENT = \"continuation_hold_state\";\n\nexport interface WakeSourceStateItem {\n\treadonly id: string;\n\treadonly description?: string;\n\treadonly startedAtMs?: number;\n}\n\nexport interface WakeSourceStateEvent {\n\treadonly source: string;\n\treadonly activeCount: number;\n\treadonly items?: readonly WakeSourceStateItem[];\n}\n\nexport interface ContinuationHoldStateEvent {\n\treadonly source: string;\n\treadonly active: boolean;\n}\n\n/**\n * Deliberately validates only the shared cross-package fields. Emitters may add\n * source-specific details such as `channels` or `monitors`.\n */\nexport function isWakeSourceStateEvent(data: unknown): data is WakeSourceStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"source\" in data &&\n\t\ttypeof data.source === \"string\" &&\n\t\tdata.source.length > 0 &&\n\t\t\"activeCount\" in data &&\n\t\ttypeof data.activeCount === \"number\" &&\n\t\tNumber.isFinite(data.activeCount)\n\t);\n}\n\nexport function isContinuationHoldStateEvent(data: unknown): data is ContinuationHoldStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"source\" in data &&\n\t\ttypeof data.source === \"string\" &&\n\t\tdata.source.length > 0 &&\n\t\t\"active\" in data &&\n\t\ttypeof data.active === \"boolean\"\n\t);\n}\n\n/** One live watch as broadcast on the monitor state event; mirrors MonitorSnapshotEntry. */\nexport interface TerminalMonitorStateMonitorEntry {\n\treadonly id: string;\n\t/** Stable \"mon_\" identity surviving runtime id churn; absent in pre-enrichment payloads. */\n\treadonly monitorId?: string;\n\treadonly description: string;\n\treadonly paused: boolean;\n\t/** Epoch milliseconds when the watch registered; lets consumers render their own elapsed labels. */\n\treadonly startedAtMs: number;\n}\n\nexport interface TerminalMonitorStateEvent {\n\treadonly activeCount: number;\n\t/** Per-watch detail for consumers that need more than the count; absent in pre-enrichment payloads. */\n\treadonly monitors?: readonly TerminalMonitorStateMonitorEntry[];\n}\n\nexport function isTerminalMonitorStateEvent(data: unknown): data is TerminalMonitorStateEvent {\n\treturn (\n\t\ttypeof data === \"object\" &&\n\t\tdata !== null &&\n\t\t\"activeCount\" in data &&\n\t\ttypeof data.activeCount === \"number\" &&\n\t\tNumber.isInteger(data.activeCount) &&\n\t\tdata.activeCount >= 0\n\t);\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { type BuildDynamicSystemPromptOptions } from "../../../dynamic-prompt/build.ts";
2
- export type Gpt6AstraRuleId = "initiative-bias" | "approval-last" | "steering" | "no-unsolicited-caution" | "instruction-precedence" | "pause-transparency" | "eval-first-routing" | "parallel-batching" | "bun-runtime" | "over-call-bias" | "in-kernel-reduction" | "stay-direct-exceptions" | "lsp-symbol-routing" | "delegation" | "legible-messages" | "todo-granularity" | "async-handles" | "turn-end-is-wait" | "monitor-conditions" | "verification-once" | "test-first" | "failure-cap" | "atomic-commits" | "no-external-messaging" | "plain-prose" | "slop-ban" | "direct-statements" | "final-message-shape";
2
+ export type Gpt6AstraRuleId = "initiative-bias" | "approval-last" | "steering" | "no-unsolicited-caution" | "instruction-precedence" | "pause-transparency" | "eval-first-routing" | "parallel-batching" | "bun-runtime" | "over-call-bias" | "in-kernel-reduction" | "stay-direct-exceptions" | "lsp-symbol-routing" | "delegation" | "legible-messages" | "todo-granularity" | "async-default" | "foreground-exception" | "turn-end-is-wait" | "monitor-conditions" | "verification-once" | "test-first" | "failure-cap" | "atomic-commits" | "no-external-messaging" | "plain-prose" | "slop-ban" | "direct-statements" | "final-message-shape";
3
3
  export type Gpt6AstraConcern = "initiative" | "instruction-precedence" | "tool-orchestration" | "symbol-routing" | "delegation" | "todo-discipline" | "async-work" | "verification" | "test-first" | "failure-recovery" | "commit-discipline" | "external-side-effects" | "writing-style" | "reporting";
4
4
  export interface Gpt6AstraRule {
5
5
  id: Gpt6AstraRuleId;
@@ -61,7 +61,7 @@ export declare const GPT6_ASTRA_RULES: readonly [{
61
61
  }, {
62
62
  readonly id: "delegation";
63
63
  readonly concern: "delegation";
64
- readonly directive: "Independent tracks are worth handing to subagents or a team when the tools are there and the parallelism pays for the coordination. Send them together, each brief stating what to produce, where its edits may land, the observable condition that ends it, and the evidence it hands back for you to check. What you can close in a handful of calls, keep.";
64
+ readonly directive: "Hand independent tracks to subagents or a team whenever running them beside your own work saves time or improves the result: spawn them together in the background, each brief stating what to produce, where its edits may land, the observable condition that ends it, and the evidence it hands back for you to check. What you can close in a handful of calls, keep.";
65
65
  }, {
66
66
  readonly id: "legible-messages";
67
67
  readonly concern: "delegation";
@@ -71,17 +71,21 @@ export declare const GPT6_ASTRA_RULES: readonly [{
71
71
  readonly concern: "todo-discipline";
72
72
  readonly directive: "Given a todo tool, cut multi-step work into the smallest items that still stand alone - an edit paired with the check that proves it - and move each one the instant its state changes: opened, finished, newly discovered and appended, abandoned and dropped. A one-step ask carries no list.";
73
73
  }, {
74
- readonly id: "async-handles";
74
+ readonly id: "async-default";
75
75
  readonly concern: "async-work";
76
- readonly directive: "**RUN LONG WORK ASYNCHRONOUSLY.** A background bash session, a detached eval cell, or a child task returns at once with a handle and delivers its result later as a message in this conversation. Treat a handle exactly like a pending async call: keep working on everything that does not need it, and never assume or invent what it will contain.";
76
+ readonly directive: "**ASYNCHRONOUS IS THE DEFAULT FORM OF EVERY CALL THAT OFFERS ONE: CHILD TASKS AND BASH SESSIONS START IN THE BACKGROUND, A LONG COMPUTATION DETACHES ITS EVAL CELL, AND A WAIT IS A `tool.monitor` SUBSCRIPTION - NEVER A CELL THAT SITS ON A `--watch` OR A SPAWNED PROCESS, NEVER A CHILD SPAWNED TO WATCH.** Each returns a handle at once and delivers its result later as a message; treat the handle like a pending async call and keep working on everything that does not need it.";
77
+ }, {
78
+ readonly id: "foreground-exception";
79
+ readonly concern: "async-work";
80
+ readonly directive: "Block only on a call that finishes within the time a reply takes and decides your very next call, or on an approval-gated or destructive action you must watch directly. A child task never meets the first test, even when its result is your next input; spawn it in the background and let the completion deliver it.";
77
81
  }, {
78
82
  readonly id: "turn-end-is-wait";
79
83
  readonly concern: "async-work";
80
- readonly directive: "**THERE IS NO WAIT TOOL. WHEN THE NEXT STEP NEEDS A PENDING RESULT, END YOUR TURN; THE COMPLETION WAKES YOU.** Repeated status reads, sleeps, and timed retries replay the whole context for nothing; a single peek serves a midpoint decision only.";
84
+ readonly directive: "**THERE IS NO WAIT TOOL. WHEN THE NEXT STEP NEEDS A PENDING RESULT, END YOUR TURN; THE COMPLETION WAKES YOU AND THE TASK CONTINUES.** Repeated status reads, sleeps, and timed retries replay the whole context for nothing; a single peek serves a midpoint decision only.";
81
85
  }, {
82
86
  readonly id: "monitor-conditions";
83
87
  readonly concern: "async-work";
84
- readonly directive: "**WHEN `monitor` IS AVAILABLE, USE IT FOR EVERY OBSERVABLE WAIT** - a log line, a build or test run finishing, a file appearing, a check turning green: register it, from inside the same cell when the run starts there, and keep working. Steer, read, or stop a running session or child through its session tools instead of launching a duplicate.";
88
+ readonly directive: "**EVERY CONDITION YOU WOULD OTHERWISE CHECK ON GETS A SUBSCRIPTION: `tool.monitor({ description, command, filter })` FROM THE EVAL CELL THAT STARTS THE RUN** (a direct `monitor` call only in a session without `eval`). A build, install, or test run finishing, a CI check or PR turning green, a deploy landing, a log line, a file appearing, another session or machine changing state: arm the watch the moment your work starts it or the user names it. A run, check, PR, or deploy the user mentions is in scope even when the ask is about something else - it gets its watch in the same turn, without being asked. The subscription is the whole cost of the wait and its matching line wakes you; a cell that awaits the wait holds the js kernel until the cell limit kills it. Steer, read, or stop a running session or child through its session tools instead of launching a duplicate.";
85
89
  }, {
86
90
  readonly id: "verification-once";
87
91
  readonly concern: "verification";
@@ -1 +1 @@
1
- {"version":3,"file":"gpt-6-astra.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-6-astra.ts"],"names":[],"mappings":"AAyDA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;AAKlH,MAAM,MAAM,eAAe,GACxB,iBAAiB,GACjB,eAAe,GACf,UAAU,GACV,wBAAwB,GACxB,wBAAwB,GACxB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,aAAa,GACb,gBAAgB,GAChB,qBAAqB,GACrB,wBAAwB,GACxB,oBAAoB,GACpB,YAAY,GACZ,kBAAkB,GAClB,kBAAkB,GAClB,eAAe,GACf,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,GACnB,YAAY,GACZ,aAAa,GACb,gBAAgB,GAChB,uBAAuB,GACvB,aAAa,GACb,UAAU,GACV,mBAAmB,GACnB,qBAAqB,CAAC;AAEzB,MAAM,MAAM,gBAAgB,GACzB,YAAY,GACZ,wBAAwB,GACxB,oBAAoB,GACpB,gBAAgB,GAChB,YAAY,GACZ,iBAAiB,GACjB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,uBAAuB,GACvB,eAAe,GACf,WAAW,CAAC;AAEf,MAAM,WAAW,aAAa;IAC7B,EAAE,EAAE,eAAe,CAAC;IACpB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CAClB;AAsFD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BgB,CAAC;AAoF9C,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAErF"}
1
+ {"version":3,"file":"gpt-6-astra.d.ts","sourceRoot":"","sources":["../../../../../src/core/extensions/builtin/prompt-preset/gpt-6-astra.ts"],"names":[],"mappings":"AAsEA,OAAO,EAAE,KAAK,+BAA+B,EAA4B,MAAM,kCAAkC,CAAC;AAKlH,MAAM,MAAM,eAAe,GACxB,iBAAiB,GACjB,eAAe,GACf,UAAU,GACV,wBAAwB,GACxB,wBAAwB,GACxB,oBAAoB,GACpB,oBAAoB,GACpB,mBAAmB,GACnB,aAAa,GACb,gBAAgB,GAChB,qBAAqB,GACrB,wBAAwB,GACxB,oBAAoB,GACpB,YAAY,GACZ,kBAAkB,GAClB,kBAAkB,GAClB,eAAe,GACf,sBAAsB,GACtB,kBAAkB,GAClB,oBAAoB,GACpB,mBAAmB,GACnB,YAAY,GACZ,aAAa,GACb,gBAAgB,GAChB,uBAAuB,GACvB,aAAa,GACb,UAAU,GACV,mBAAmB,GACnB,qBAAqB,CAAC;AAEzB,MAAM,MAAM,gBAAgB,GACzB,YAAY,GACZ,wBAAwB,GACxB,oBAAoB,GACpB,gBAAgB,GAChB,YAAY,GACZ,iBAAiB,GACjB,YAAY,GACZ,cAAc,GACd,YAAY,GACZ,kBAAkB,GAClB,mBAAmB,GACnB,uBAAuB,GACvB,eAAe,GACf,WAAW,CAAC;AAEf,MAAM,WAAW,aAAa;IAC7B,EAAE,EAAE,eAAe,CAAC;IACpB,OAAO,EAAE,gBAAgB,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CAClB;AAyFD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BgB,CAAC;AAoF9C,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAErF"}
@@ -27,8 +27,9 @@
27
27
  //
28
28
  // Emphasis is deliberate and rationed: only the owner's two hard operating
29
29
  // rules render in capitals and bold - one js cell per multi-call step on the
30
- // Bun eval kernel, and asynchronous execution with `monitor` subscriptions in
31
- // place of waiting. Everything else stays plain so those two keep their weight.
30
+ // Bun eval kernel, and asynchronous execution as the default form of every
31
+ // call, with `monitor` subscriptions in place of waiting. Everything else
32
+ // stays plain so those two keep their weight.
32
33
  //
33
34
  // Two harness facts Astra cannot derive get their own sections. Astra is
34
35
  // trained on async tool calling (an `async: true` call returns later on its
@@ -36,8 +37,20 @@
36
37
  // runs long work as background sessions, detached eval cells, monitors, and
37
38
  // child tasks whose completions arrive as injected messages, with no wait
38
39
  // tool at all. `## Asynchronous Work` maps the trained model onto these
39
- // surfaces: keep working, never invent the pending result, end the turn when
40
- // the next step needs it. Codex's own Astra template runs "code mode only"
40
+ // surfaces: the asynchronous form is the default for every call that offers
41
+ // one, blocking is a named exception (a call that finishes within a reply and
42
+ // decides the very next call, or an approval-gated or destructive action
43
+ // watched directly), and the turn ends when the next step needs a pending
44
+ // result. A child task never meets the exception, even when its result is
45
+ // the next input: an orchestrator that blocks on one child at a time forfeits
46
+ // every other track, which is the failure this section exists to prevent.
47
+ // The subscription rule names the form the session can call - `bash` and
48
+ // `monitor` leave the direct tool list whenever `eval` exists, so
49
+ // `tool.monitor` inside a cell is the only form there is and a rule
50
+ // conditioned on `monitor` being available never fires - and names the
51
+ // trigger as state the user mentions, not only a wait the model itself
52
+ // started.
53
+ // Codex's own Astra template runs "code mode only"
41
54
  // (`functions.exec` batching independent calls with Promise.allSettled), so
42
55
  // senpi's eval-first orchestration rules fit Astra's prior directly.
43
56
  //
@@ -70,12 +83,13 @@ const OVER_CALL_BIAS = "Over-call read-only work inside that wave: when unsure w
70
83
  const IN_KERNEL_REDUCTION = "Reduce in the kernel - filter, join, rank, dedup, aggregate, guard each risky call - and return distilled facts instead of raw dumps.";
71
84
  const STAY_DIRECT_EXCEPTIONS = "Skip the cell when it buys nothing: a lone call, an already-small result, a result you must read before choosing the next call, a judgment call between steps, or an action that needs approval. If two cell attempts miss the same fact, or the wave comes back empty or oddly thin, probe a direct alternative or two before you trust the absence.";
72
85
  const LSP_SYMBOL_ROUTING = "Where LSP tools exist, let the language server answer symbol questions - a definition, its callers, the blast radius of a rename, the diagnostics on a file you just touched. Plain text search earns its place on literal strings, filenames, and commit history.";
73
- const DELEGATION = "Independent tracks are worth handing to subagents or a team when the tools are there and the parallelism pays for the coordination. Send them together, each brief stating what to produce, where its edits may land, the observable condition that ends it, and the evidence it hands back for you to check. What you can close in a handful of calls, keep.";
86
+ const DELEGATION = "Hand independent tracks to subagents or a team whenever running them beside your own work saves time or improves the result: spawn them together in the background, each brief stating what to produce, where its edits may land, the observable condition that ends it, and the evidence it hands back for you to check. What you can close in a handful of calls, keep.";
74
87
  const LEGIBLE_MESSAGES = "Messages to other agents and your final answer are read by people: full sentences, proper spaces between words and numbers, no private shorthand.";
75
88
  const TODO_GRANULARITY = "Given a todo tool, cut multi-step work into the smallest items that still stand alone - an edit paired with the check that proves it - and move each one the instant its state changes: opened, finished, newly discovered and appended, abandoned and dropped. A one-step ask carries no list.";
76
- const ASYNC_HANDLES = "**RUN LONG WORK ASYNCHRONOUSLY.** A background bash session, a detached eval cell, or a child task returns at once with a handle and delivers its result later as a message in this conversation. Treat a handle exactly like a pending async call: keep working on everything that does not need it, and never assume or invent what it will contain.";
77
- const TURN_END_IS_WAIT = "**THERE IS NO WAIT TOOL. WHEN THE NEXT STEP NEEDS A PENDING RESULT, END YOUR TURN; THE COMPLETION WAKES YOU.** Repeated status reads, sleeps, and timed retries replay the whole context for nothing; a single peek serves a midpoint decision only.";
78
- const MONITOR_CONDITIONS = "**WHEN `monitor` IS AVAILABLE, USE IT FOR EVERY OBSERVABLE WAIT** - a log line, a build or test run finishing, a file appearing, a check turning green: register it, from inside the same cell when the run starts there, and keep working. Steer, read, or stop a running session or child through its session tools instead of launching a duplicate.";
89
+ const ASYNC_DEFAULT = "**ASYNCHRONOUS IS THE DEFAULT FORM OF EVERY CALL THAT OFFERS ONE: CHILD TASKS AND BASH SESSIONS START IN THE BACKGROUND, A LONG COMPUTATION DETACHES ITS EVAL CELL, AND A WAIT IS A `tool.monitor` SUBSCRIPTION - NEVER A CELL THAT SITS ON A `--watch` OR A SPAWNED PROCESS, NEVER A CHILD SPAWNED TO WATCH.** Each returns a handle at once and delivers its result later as a message; treat the handle like a pending async call and keep working on everything that does not need it.";
90
+ const FOREGROUND_EXCEPTION = "Block only on a call that finishes within the time a reply takes and decides your very next call, or on an approval-gated or destructive action you must watch directly. A child task never meets the first test, even when its result is your next input; spawn it in the background and let the completion deliver it.";
91
+ const TURN_END_IS_WAIT = "**THERE IS NO WAIT TOOL. WHEN THE NEXT STEP NEEDS A PENDING RESULT, END YOUR TURN; THE COMPLETION WAKES YOU AND THE TASK CONTINUES.** Repeated status reads, sleeps, and timed retries replay the whole context for nothing; a single peek serves a midpoint decision only.";
92
+ const MONITOR_CONDITIONS = "**EVERY CONDITION YOU WOULD OTHERWISE CHECK ON GETS A SUBSCRIPTION: `tool.monitor({ description, command, filter })` FROM THE EVAL CELL THAT STARTS THE RUN** (a direct `monitor` call only in a session without `eval`). A build, install, or test run finishing, a CI check or PR turning green, a deploy landing, a log line, a file appearing, another session or machine changing state: arm the watch the moment your work starts it or the user names it. A run, check, PR, or deploy the user mentions is in scope even when the ask is about something else - it gets its watch in the same turn, without being asked. The subscription is the whole cost of the wait and its matching line wakes you; a cell that awaits the wait holds the js kernel until the cell limit kills it. Steer, read, or stop a running session or child through its session tools instead of launching a duplicate.";
79
93
  const VERIFICATION_ONCE = "Broaden or repeat checks only when a new change, a failure, or an open concern justifies it; otherwise keep moving toward completion.";
80
94
  const TEST_FIRST = "A behavior change starts with one failing test at the seam it touches, watched to fail for the right reason, then the smallest change that passes it. Formatting, comments, renames, dependency bumps, and visual-only work get review and a real-surface check instead; leave out any test that mirrors the implementation or cannot fail for the regression it names.";
81
95
  const FAILURE_CAP = "When an approach fails, change something material - a different algorithm, library, or pattern - and re-verify after each attempt, since stale state explains most confusing failures; after three materially different attempts fail, return the files to the last known-good state with your file tools, write down what failed and why, and ask the user one precise question.";
@@ -102,7 +116,8 @@ export const GPT6_ASTRA_RULES = [
102
116
  { id: "delegation", concern: "delegation", directive: DELEGATION },
103
117
  { id: "legible-messages", concern: "delegation", directive: LEGIBLE_MESSAGES },
104
118
  { id: "todo-granularity", concern: "todo-discipline", directive: TODO_GRANULARITY },
105
- { id: "async-handles", concern: "async-work", directive: ASYNC_HANDLES },
119
+ { id: "async-default", concern: "async-work", directive: ASYNC_DEFAULT },
120
+ { id: "foreground-exception", concern: "async-work", directive: FOREGROUND_EXCEPTION },
106
121
  { id: "turn-end-is-wait", concern: "async-work", directive: TURN_END_IS_WAIT },
107
122
  { id: "monitor-conditions", concern: "async-work", directive: MONITOR_CONDITIONS },
108
123
  { id: "verification-once", concern: "verification", directive: VERIFICATION_ONCE },
@@ -122,7 +137,7 @@ function buildGpt6AstraCore(context) {
122
137
 
123
138
  Open every turn with one short routing line before anything else:
124
139
 
125
- > I read this as [intent] - [plan]. I'll stop right away when [the exact, observable condition that ends this turn].
140
+ > I read this as [intent] - [plan]. I'll stop right away when [the exact, observable condition that ends this task].
126
141
 
127
142
  The declared stop condition is binding: work until it holds, then stop (see Stop Goal). Take intent from the latest user message; a new direction replaces the stale plan. Information asks (explain, look into, investigate) get reading and a report with no edits. Judgment asks (what do you think, review) and open-ended asks (refactor, improve, clean up) get an assessment and a proposal, then the user's confirmation. Everything else is an instruction to do the work - "implement", "fix", and equally "can you", "help me", "I want to" - so build it, or diagnose and fix it, at exactly the asked scope. Keep prompt scaffolding out of user-visible output.
128
143
 
@@ -148,7 +163,7 @@ ${TODO_GRANULARITY}
148
163
 
149
164
  ## Asynchronous Work
150
165
 
151
- ${ASYNC_HANDLES} ${TURN_END_IS_WAIT} ${MONITOR_CONDITIONS}
166
+ ${ASYNC_DEFAULT} ${FOREGROUND_EXCEPTION} ${TURN_END_IS_WAIT} ${MONITOR_CONDITIONS}
152
167
 
153
168
  ## Verification
154
169
 
@@ -192,7 +207,7 @@ Code reviews: findings first, ordered by severity with file references, then ope
192
207
 
193
208
  ## Stop Goal
194
209
 
195
- The turn is over the moment all of these hold: every requested behavior works in observable use with nothing deferred, the checks for the change's tier are clean or explained, and the final message is delivered. Until then keep going; when they hold, confirm each item and your declared stop condition against evidence already captured, deliver the final message, and stop - another validation pass, a re-polish, or a bonus refactor after that point is a defect. Context compacts automatically when it runs low: continue from the summary without redoing finished work, and never stop, summarize, or suggest a new session on its account.
210
+ The task is over the moment all of these hold: every requested behavior works in observable use with nothing deferred, the checks for the change's tier are clean or explained, and the final message is delivered. Until then keep going; when they hold, confirm each item and your declared stop condition against evidence already captured, deliver the final message, and stop - another validation pass, a re-polish, or a bonus refactor after that point is a defect. Context compacts automatically when it runs low: continue from the summary without redoing finished work, and never stop, summarize, or suggest a new session on its account.
196
211
 
197
212
  ${buildFileOperationsTuning()}`;
198
213
  }