@code-yeongyu/senpi 2026.8.16 → 2026.8.18

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 (628) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/bun/cli.js +1 -0
  3. package/dist/bun/cli.js.map +1 -1
  4. package/dist/bun/register-cursor-agent.d.ts +2 -0
  5. package/dist/bun/register-cursor-agent.d.ts.map +1 -0
  6. package/dist/bun/register-cursor-agent.js +4 -0
  7. package/dist/bun/register-cursor-agent.js.map +1 -0
  8. package/dist/core/agent-session-services.js +2 -2
  9. package/dist/core/agent-session-services.js.map +1 -1
  10. package/dist/core/agent-session.d.ts +48 -5
  11. package/dist/core/agent-session.d.ts.map +1 -1
  12. package/dist/core/agent-session.js +239 -61
  13. package/dist/core/agent-session.js.map +1 -1
  14. package/dist/core/cursor-exec-bridge-session.d.ts +11 -0
  15. package/dist/core/cursor-exec-bridge-session.d.ts.map +1 -0
  16. package/dist/core/cursor-exec-bridge-session.js +17 -0
  17. package/dist/core/cursor-exec-bridge-session.js.map +1 -0
  18. package/dist/core/cursor-exec-bridge.d.ts +52 -0
  19. package/dist/core/cursor-exec-bridge.d.ts.map +1 -0
  20. package/dist/core/cursor-exec-bridge.js +196 -0
  21. package/dist/core/cursor-exec-bridge.js.map +1 -0
  22. package/dist/core/extensions/builtin/cursor-cli-oauth/account-command.d.ts +31 -0
  23. package/dist/core/extensions/builtin/cursor-cli-oauth/account-command.d.ts.map +1 -0
  24. package/dist/core/extensions/builtin/cursor-cli-oauth/account-command.js +298 -0
  25. package/dist/core/extensions/builtin/cursor-cli-oauth/account-command.js.map +1 -0
  26. package/dist/core/extensions/builtin/cursor-cli-oauth/accounts.d.ts +38 -0
  27. package/dist/core/extensions/builtin/cursor-cli-oauth/accounts.d.ts.map +1 -0
  28. package/dist/core/extensions/builtin/cursor-cli-oauth/accounts.js +75 -0
  29. package/dist/core/extensions/builtin/cursor-cli-oauth/accounts.js.map +1 -0
  30. package/dist/core/extensions/builtin/cursor-cli-oauth/affinity.d.ts +24 -0
  31. package/dist/core/extensions/builtin/cursor-cli-oauth/affinity.d.ts.map +1 -0
  32. package/dist/core/extensions/builtin/cursor-cli-oauth/affinity.js +64 -0
  33. package/dist/core/extensions/builtin/cursor-cli-oauth/affinity.js.map +1 -0
  34. package/dist/core/extensions/builtin/cursor-cli-oauth/diagnostics.d.ts +139 -0
  35. package/dist/core/extensions/builtin/cursor-cli-oauth/diagnostics.d.ts.map +1 -0
  36. package/dist/core/extensions/builtin/cursor-cli-oauth/diagnostics.js +362 -0
  37. package/dist/core/extensions/builtin/cursor-cli-oauth/diagnostics.js.map +1 -0
  38. package/dist/core/extensions/builtin/cursor-cli-oauth/errors.d.ts +19 -0
  39. package/dist/core/extensions/builtin/cursor-cli-oauth/errors.d.ts.map +1 -0
  40. package/dist/core/extensions/builtin/cursor-cli-oauth/errors.js +122 -0
  41. package/dist/core/extensions/builtin/cursor-cli-oauth/errors.js.map +1 -0
  42. package/dist/core/extensions/builtin/cursor-cli-oauth/executable.d.ts +30 -0
  43. package/dist/core/extensions/builtin/cursor-cli-oauth/executable.d.ts.map +1 -0
  44. package/dist/core/extensions/builtin/cursor-cli-oauth/executable.js +117 -0
  45. package/dist/core/extensions/builtin/cursor-cli-oauth/executable.js.map +1 -0
  46. package/dist/core/extensions/builtin/cursor-cli-oauth/failover.d.ts +39 -0
  47. package/dist/core/extensions/builtin/cursor-cli-oauth/failover.d.ts.map +1 -0
  48. package/dist/core/extensions/builtin/cursor-cli-oauth/failover.js +155 -0
  49. package/dist/core/extensions/builtin/cursor-cli-oauth/failover.js.map +1 -0
  50. package/dist/core/extensions/builtin/cursor-cli-oauth/guardrails.d.ts +89 -0
  51. package/dist/core/extensions/builtin/cursor-cli-oauth/guardrails.d.ts.map +1 -0
  52. package/dist/core/extensions/builtin/cursor-cli-oauth/guardrails.js +147 -0
  53. package/dist/core/extensions/builtin/cursor-cli-oauth/guardrails.js.map +1 -0
  54. package/dist/core/extensions/builtin/cursor-cli-oauth/home-store.d.ts +20 -0
  55. package/dist/core/extensions/builtin/cursor-cli-oauth/home-store.d.ts.map +1 -0
  56. package/dist/core/extensions/builtin/cursor-cli-oauth/home-store.js +99 -0
  57. package/dist/core/extensions/builtin/cursor-cli-oauth/home-store.js.map +1 -0
  58. package/dist/core/extensions/builtin/cursor-cli-oauth/index.d.ts +25 -0
  59. package/dist/core/extensions/builtin/cursor-cli-oauth/index.d.ts.map +1 -0
  60. package/dist/core/extensions/builtin/cursor-cli-oauth/index.js +69 -0
  61. package/dist/core/extensions/builtin/cursor-cli-oauth/index.js.map +1 -0
  62. package/dist/core/extensions/builtin/cursor-cli-oauth/models.d.ts +27 -0
  63. package/dist/core/extensions/builtin/cursor-cli-oauth/models.d.ts.map +1 -0
  64. package/dist/core/extensions/builtin/cursor-cli-oauth/models.js +242 -0
  65. package/dist/core/extensions/builtin/cursor-cli-oauth/models.js.map +1 -0
  66. package/dist/core/extensions/builtin/cursor-cli-oauth/oauth-login.d.ts +77 -0
  67. package/dist/core/extensions/builtin/cursor-cli-oauth/oauth-login.d.ts.map +1 -0
  68. package/dist/core/extensions/builtin/cursor-cli-oauth/oauth-login.js +361 -0
  69. package/dist/core/extensions/builtin/cursor-cli-oauth/oauth-login.js.map +1 -0
  70. package/dist/core/extensions/builtin/cursor-cli-oauth/session-router.d.ts +94 -0
  71. package/dist/core/extensions/builtin/cursor-cli-oauth/session-router.d.ts.map +1 -0
  72. package/dist/core/extensions/builtin/cursor-cli-oauth/session-router.js +248 -0
  73. package/dist/core/extensions/builtin/cursor-cli-oauth/session-router.js.map +1 -0
  74. package/dist/core/extensions/builtin/cursor-cli-oauth/settings.d.ts +37 -0
  75. package/dist/core/extensions/builtin/cursor-cli-oauth/settings.d.ts.map +1 -0
  76. package/dist/core/extensions/builtin/cursor-cli-oauth/settings.js +196 -0
  77. package/dist/core/extensions/builtin/cursor-cli-oauth/settings.js.map +1 -0
  78. package/dist/core/extensions/builtin/cursor-cli-oauth/spawn-args.d.ts +11 -0
  79. package/dist/core/extensions/builtin/cursor-cli-oauth/spawn-args.d.ts.map +1 -0
  80. package/dist/core/extensions/builtin/cursor-cli-oauth/spawn-args.js +17 -0
  81. package/dist/core/extensions/builtin/cursor-cli-oauth/spawn-args.js.map +1 -0
  82. package/dist/core/extensions/builtin/cursor-cli-oauth/stream-parser.d.ts +104 -0
  83. package/dist/core/extensions/builtin/cursor-cli-oauth/stream-parser.d.ts.map +1 -0
  84. package/dist/core/extensions/builtin/cursor-cli-oauth/stream-parser.js +301 -0
  85. package/dist/core/extensions/builtin/cursor-cli-oauth/stream-parser.js.map +1 -0
  86. package/dist/core/extensions/builtin/cursor-cli-oauth/stream.d.ts +26 -0
  87. package/dist/core/extensions/builtin/cursor-cli-oauth/stream.d.ts.map +1 -0
  88. package/dist/core/extensions/builtin/cursor-cli-oauth/stream.js +587 -0
  89. package/dist/core/extensions/builtin/cursor-cli-oauth/stream.js.map +1 -0
  90. package/dist/core/extensions/builtin/cursor-cli-oauth/transport.d.ts +43 -0
  91. package/dist/core/extensions/builtin/cursor-cli-oauth/transport.d.ts.map +1 -0
  92. package/dist/core/extensions/builtin/cursor-cli-oauth/transport.js +196 -0
  93. package/dist/core/extensions/builtin/cursor-cli-oauth/transport.js.map +1 -0
  94. package/dist/core/extensions/builtin/goal/channel-state-subscriptions.d.ts +9 -0
  95. package/dist/core/extensions/builtin/goal/channel-state-subscriptions.d.ts.map +1 -0
  96. package/dist/core/extensions/builtin/goal/channel-state-subscriptions.js +18 -0
  97. package/dist/core/extensions/builtin/goal/channel-state-subscriptions.js.map +1 -0
  98. package/dist/core/extensions/builtin/goal/monitor-continuation.d.ts.map +1 -1
  99. package/dist/core/extensions/builtin/goal/monitor-continuation.js +10 -9
  100. package/dist/core/extensions/builtin/goal/monitor-continuation.js.map +1 -1
  101. package/dist/core/extensions/builtin/index.d.ts.map +1 -1
  102. package/dist/core/extensions/builtin/index.js +5 -2
  103. package/dist/core/extensions/builtin/index.js.map +1 -1
  104. package/dist/core/extensions/builtin/loop-guard/detectors.d.ts.map +1 -1
  105. package/dist/core/extensions/builtin/loop-guard/detectors.js +21 -3
  106. package/dist/core/extensions/builtin/loop-guard/detectors.js.map +1 -1
  107. package/dist/core/extensions/builtin/loop-guard/escalation.d.ts +24 -0
  108. package/dist/core/extensions/builtin/loop-guard/escalation.d.ts.map +1 -0
  109. package/dist/core/extensions/builtin/loop-guard/escalation.js +77 -0
  110. package/dist/core/extensions/builtin/loop-guard/escalation.js.map +1 -0
  111. package/dist/core/extensions/builtin/loop-guard/index.d.ts.map +1 -1
  112. package/dist/core/extensions/builtin/loop-guard/index.js +98 -3
  113. package/dist/core/extensions/builtin/loop-guard/index.js.map +1 -1
  114. package/dist/core/extensions/builtin/loop-guard/notice.d.ts +9 -0
  115. package/dist/core/extensions/builtin/loop-guard/notice.d.ts.map +1 -1
  116. package/dist/core/extensions/builtin/loop-guard/notice.js +17 -0
  117. package/dist/core/extensions/builtin/loop-guard/notice.js.map +1 -1
  118. package/dist/core/extensions/builtin/loop-guard/policy.d.ts +4 -0
  119. package/dist/core/extensions/builtin/loop-guard/policy.d.ts.map +1 -1
  120. package/dist/core/extensions/builtin/loop-guard/policy.js +4 -0
  121. package/dist/core/extensions/builtin/loop-guard/policy.js.map +1 -1
  122. package/dist/core/extensions/builtin/loop-guard/renderer.d.ts +2 -0
  123. package/dist/core/extensions/builtin/loop-guard/renderer.d.ts.map +1 -1
  124. package/dist/core/extensions/builtin/loop-guard/renderer.js +11 -0
  125. package/dist/core/extensions/builtin/loop-guard/renderer.js.map +1 -1
  126. package/dist/core/extensions/builtin/loop-guard/tracker.d.ts +1 -1
  127. package/dist/core/extensions/builtin/loop-guard/tracker.d.ts.map +1 -1
  128. package/dist/core/extensions/builtin/loop-guard/tracker.js +3 -1
  129. package/dist/core/extensions/builtin/loop-guard/tracker.js.map +1 -1
  130. package/dist/core/extensions/builtin/monitor-state-event.d.ts +6 -0
  131. package/dist/core/extensions/builtin/monitor-state-event.d.ts.map +1 -1
  132. package/dist/core/extensions/builtin/monitor-state-event.js +10 -0
  133. package/dist/core/extensions/builtin/monitor-state-event.js.map +1 -1
  134. package/dist/core/model-resolver.js +1 -1
  135. package/dist/core/model-resolver.js.map +1 -1
  136. package/dist/core/model-runtime.d.ts +7 -2
  137. package/dist/core/model-runtime.d.ts.map +1 -1
  138. package/dist/core/model-runtime.js +14 -2
  139. package/dist/core/model-runtime.js.map +1 -1
  140. package/dist/core/prompt-templates.d.ts +5 -0
  141. package/dist/core/prompt-templates.d.ts.map +1 -1
  142. package/dist/core/prompt-templates.js +8 -9
  143. package/dist/core/prompt-templates.js.map +1 -1
  144. package/dist/core/provider-display-names.d.ts.map +1 -1
  145. package/dist/core/provider-display-names.js +1 -0
  146. package/dist/core/provider-display-names.js.map +1 -1
  147. package/dist/core/sdk.d.ts.map +1 -1
  148. package/dist/core/sdk.js +6 -0
  149. package/dist/core/sdk.js.map +1 -1
  150. package/dist/modes/interactive/editor-paste-transfer.d.ts +10 -0
  151. package/dist/modes/interactive/editor-paste-transfer.d.ts.map +1 -1
  152. package/dist/modes/interactive/editor-paste-transfer.js +16 -0
  153. package/dist/modes/interactive/editor-paste-transfer.js.map +1 -1
  154. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  155. package/dist/modes/interactive/interactive-mode.js +13 -7
  156. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  157. package/dist/modes/rpc/connection-handler.d.ts.map +1 -1
  158. package/dist/modes/rpc/connection-handler.js +32 -27
  159. package/dist/modes/rpc/connection-handler.js.map +1 -1
  160. package/dist/modes/rpc/jsonl.d.ts +6 -1
  161. package/dist/modes/rpc/jsonl.d.ts.map +1 -1
  162. package/dist/modes/rpc/jsonl.js +47 -14
  163. package/dist/modes/rpc/jsonl.js.map +1 -1
  164. package/dist/modes/rpc/multi-session-host.d.ts.map +1 -1
  165. package/dist/modes/rpc/multi-session-host.js +26 -4
  166. package/dist/modes/rpc/multi-session-host.js.map +1 -1
  167. package/dist/modes/rpc/rpc-command-invocation.d.ts +5 -0
  168. package/dist/modes/rpc/rpc-command-invocation.d.ts.map +1 -0
  169. package/dist/modes/rpc/rpc-command-invocation.js +2 -0
  170. package/dist/modes/rpc/rpc-command-invocation.js.map +1 -0
  171. package/dist/modes/rpc/rpc-command-surface.d.ts +49 -0
  172. package/dist/modes/rpc/rpc-command-surface.d.ts.map +1 -0
  173. package/dist/modes/rpc/rpc-command-surface.js +40 -0
  174. package/dist/modes/rpc/rpc-command-surface.js.map +1 -0
  175. package/dist/modes/rpc/rpc-input-validation.d.ts +4 -0
  176. package/dist/modes/rpc/rpc-input-validation.d.ts.map +1 -0
  177. package/dist/modes/rpc/rpc-input-validation.js +20 -0
  178. package/dist/modes/rpc/rpc-input-validation.js.map +1 -0
  179. package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
  180. package/dist/modes/rpc/rpc-mode.js +12 -1
  181. package/dist/modes/rpc/rpc-mode.js.map +1 -1
  182. package/dist/modes/rpc/rpc-types.d.ts +12 -12
  183. package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
  184. package/dist/modes/rpc/rpc-types.js.map +1 -1
  185. package/docs/providers.md +52 -1
  186. package/docs/rpc.md +78 -6
  187. package/docs/skills.md +14 -3
  188. package/node_modules/@bufbuild/protobuf/README.md +44 -0
  189. package/node_modules/@bufbuild/protobuf/dist/commonjs/clone.d.ts +6 -0
  190. package/node_modules/@bufbuild/protobuf/dist/commonjs/clone.js +66 -0
  191. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/boot.d.ts +1 -0
  192. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/boot.js +18 -0
  193. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/enum.d.ts +10 -0
  194. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/enum.js +31 -0
  195. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/extension.d.ts +9 -0
  196. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/extension.js +28 -0
  197. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/file.d.ts +1 -0
  198. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/file.js +18 -0
  199. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/index.d.ts +10 -0
  200. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/index.js +39 -0
  201. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/message.d.ts +10 -0
  202. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/message.js +24 -0
  203. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/service.d.ts +8 -0
  204. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/service.js +27 -0
  205. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/symbols.d.ts +140 -0
  206. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/symbols.js +43 -0
  207. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/types.d.ts +79 -0
  208. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv1/types.js +15 -0
  209. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/boot.d.ts +63 -0
  210. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/boot.js +105 -0
  211. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/embed.d.ts +43 -0
  212. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/embed.js +244 -0
  213. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/enum.d.ts +29 -0
  214. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/enum.js +58 -0
  215. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/extension.d.ts +9 -0
  216. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/extension.js +28 -0
  217. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/file.d.ts +7 -0
  218. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/file.js +35 -0
  219. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/index.d.ts +10 -0
  220. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/index.js +39 -0
  221. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/message.d.ts +15 -0
  222. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/message.js +24 -0
  223. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/restore-json-names.d.ts +5 -0
  224. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/restore-json-names.js +29 -0
  225. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/scalar.d.ts +9 -0
  226. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/scalar.js +67 -0
  227. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/service.d.ts +8 -0
  228. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/service.js +27 -0
  229. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/symbols.d.ts +145 -0
  230. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/symbols.js +74 -0
  231. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/types.d.ts +85 -0
  232. package/node_modules/@bufbuild/protobuf/dist/commonjs/codegenv2/types.js +15 -0
  233. package/node_modules/@bufbuild/protobuf/dist/commonjs/create.d.ts +9 -0
  234. package/node_modules/@bufbuild/protobuf/dist/commonjs/create.js +259 -0
  235. package/node_modules/@bufbuild/protobuf/dist/commonjs/descriptors.d.ts +634 -0
  236. package/node_modules/@bufbuild/protobuf/dist/commonjs/descriptors.js +53 -0
  237. package/node_modules/@bufbuild/protobuf/dist/commonjs/equals.d.ts +46 -0
  238. package/node_modules/@bufbuild/protobuf/dist/commonjs/equals.js +209 -0
  239. package/node_modules/@bufbuild/protobuf/dist/commonjs/extensions.d.ts +60 -0
  240. package/node_modules/@bufbuild/protobuf/dist/commonjs/extensions.js +168 -0
  241. package/node_modules/@bufbuild/protobuf/dist/commonjs/fields.d.ts +23 -0
  242. package/node_modules/@bufbuild/protobuf/dist/commonjs/fields.js +45 -0
  243. package/node_modules/@bufbuild/protobuf/dist/commonjs/from-binary.d.ts +48 -0
  244. package/node_modules/@bufbuild/protobuf/dist/commonjs/from-binary.js +247 -0
  245. package/node_modules/@bufbuild/protobuf/dist/commonjs/from-json.d.ts +73 -0
  246. package/node_modules/@bufbuild/protobuf/dist/commonjs/from-json.js +739 -0
  247. package/node_modules/@bufbuild/protobuf/dist/commonjs/index.d.ts +19 -0
  248. package/node_modules/@bufbuild/protobuf/dist/commonjs/index.js +55 -0
  249. package/node_modules/@bufbuild/protobuf/dist/commonjs/is-message.d.ts +7 -0
  250. package/node_modules/@bufbuild/protobuf/dist/commonjs/is-message.js +33 -0
  251. package/node_modules/@bufbuild/protobuf/dist/commonjs/json-value.d.ts +16 -0
  252. package/node_modules/@bufbuild/protobuf/dist/commonjs/json-value.js +15 -0
  253. package/node_modules/@bufbuild/protobuf/dist/commonjs/merge.d.ts +13 -0
  254. package/node_modules/@bufbuild/protobuf/dist/commonjs/merge.js +70 -0
  255. package/node_modules/@bufbuild/protobuf/dist/commonjs/package.json +4 -0
  256. package/node_modules/@bufbuild/protobuf/dist/commonjs/proto-int64.d.ts +98 -0
  257. package/node_modules/@bufbuild/protobuf/dist/commonjs/proto-int64.js +131 -0
  258. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/error.d.ts +9 -0
  259. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/error.js +36 -0
  260. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/guard.d.ts +20 -0
  261. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/guard.js +78 -0
  262. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/index.d.ts +8 -0
  263. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/index.js +41 -0
  264. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/names.d.ts +30 -0
  265. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/names.js +115 -0
  266. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/nested-types.d.ts +35 -0
  267. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/nested-types.js +110 -0
  268. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/path.d.ts +107 -0
  269. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/path.js +376 -0
  270. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-check.d.ts +19 -0
  271. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-check.js +268 -0
  272. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-types.d.ts +217 -0
  273. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect-types.js +16 -0
  274. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect.d.ts +43 -0
  275. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/reflect.js +546 -0
  276. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/scalar.d.ts +43 -0
  277. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/scalar.js +129 -0
  278. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/unsafe.d.ts +39 -0
  279. package/node_modules/@bufbuild/protobuf/dist/commonjs/reflect/unsafe.js +149 -0
  280. package/node_modules/@bufbuild/protobuf/dist/commonjs/registry.d.ts +98 -0
  281. package/node_modules/@bufbuild/protobuf/dist/commonjs/registry.js +945 -0
  282. package/node_modules/@bufbuild/protobuf/dist/commonjs/to-binary.d.ts +24 -0
  283. package/node_modules/@bufbuild/protobuf/dist/commonjs/to-binary.js +199 -0
  284. package/node_modules/@bufbuild/protobuf/dist/commonjs/to-json.d.ts +67 -0
  285. package/node_modules/@bufbuild/protobuf/dist/commonjs/to-json.js +391 -0
  286. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/from-text.d.ts +35 -0
  287. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/from-text.js +684 -0
  288. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/index.d.ts +4 -0
  289. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/index.js +21 -0
  290. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/is-group-like.d.ts +19 -0
  291. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/is-group-like.js +47 -0
  292. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/reader.d.ts +91 -0
  293. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/reader.js +481 -0
  294. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/to-text.d.ts +34 -0
  295. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/to-text.js +358 -0
  296. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/writer.d.ts +76 -0
  297. package/node_modules/@bufbuild/protobuf/dist/commonjs/txtpb/writer.js +220 -0
  298. package/node_modules/@bufbuild/protobuf/dist/commonjs/types.d.ts +135 -0
  299. package/node_modules/@bufbuild/protobuf/dist/commonjs/types.js +15 -0
  300. package/node_modules/@bufbuild/protobuf/dist/commonjs/unknown-enum.d.ts +10 -0
  301. package/node_modules/@bufbuild/protobuf/dist/commonjs/unknown-enum.js +26 -0
  302. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/base64-encoding.d.ts +23 -0
  303. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/base64-encoding.js +156 -0
  304. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/binary-encoding.d.ts +268 -0
  305. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/binary-encoding.js +530 -0
  306. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/index.d.ts +5 -0
  307. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/index.js +34 -0
  308. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/size-delimited.d.ts +69 -0
  309. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/size-delimited.js +191 -0
  310. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-encoding.d.ts +28 -0
  311. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-encoding.js +61 -0
  312. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-format.d.ts +13 -0
  313. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/text-format.js +199 -0
  314. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/varint.d.ts +70 -0
  315. package/node_modules/@bufbuild/protobuf/dist/commonjs/wire/varint.js +322 -0
  316. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/any.d.ts +38 -0
  317. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/any.js +75 -0
  318. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/duration.d.ts +9 -0
  319. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/duration.js +39 -0
  320. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/any_pb.d.ts +238 -0
  321. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/any_pb.js +27 -0
  322. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/api_pb.d.ts +537 -0
  323. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/api_pb.js +39 -0
  324. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +490 -0
  325. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/compiler/plugin_pb.js +68 -0
  326. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/cpp_features_pb.d.ts +91 -0
  327. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/cpp_features_pb.js +60 -0
  328. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +4143 -0
  329. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/descriptor_pb.js +892 -0
  330. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/duration_pb.d.ts +161 -0
  331. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/duration_pb.js +27 -0
  332. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/empty_pb.d.ts +39 -0
  333. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/empty_pb.js +27 -0
  334. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/field_mask_pb.d.ts +424 -0
  335. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/field_mask_pb.js +27 -0
  336. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/go_features_pb.d.ts +189 -0
  337. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/go_features_pb.js +126 -0
  338. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/java_features_pb.d.ts +194 -0
  339. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/java_features_pb.js +106 -0
  340. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/source_context_pb.d.ts +43 -0
  341. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/source_context_pb.js +27 -0
  342. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/struct_pb.d.ts +195 -0
  343. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/struct_pb.js +59 -0
  344. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/timestamp_pb.d.ts +222 -0
  345. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/timestamp_pb.js +27 -0
  346. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/type_pb.d.ts +722 -0
  347. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/type_pb.js +242 -0
  348. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/wrappers_pb.d.ts +330 -0
  349. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/gen/google/protobuf/wrappers_pb.js +67 -0
  350. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/index.d.ts +19 -0
  351. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/index.js +48 -0
  352. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/timestamp.d.ts +21 -0
  353. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/timestamp.js +57 -0
  354. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/wrappers.d.ts +25 -0
  355. package/node_modules/@bufbuild/protobuf/dist/commonjs/wkt/wrappers.js +66 -0
  356. package/node_modules/@bufbuild/protobuf/dist/esm/clone.d.ts +6 -0
  357. package/node_modules/@bufbuild/protobuf/dist/esm/clone.js +63 -0
  358. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/boot.d.ts +1 -0
  359. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/boot.js +14 -0
  360. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/enum.d.ts +10 -0
  361. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/enum.js +26 -0
  362. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/extension.d.ts +9 -0
  363. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/extension.js +25 -0
  364. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/file.d.ts +1 -0
  365. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/file.js +14 -0
  366. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/index.d.ts +10 -0
  367. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/index.js +23 -0
  368. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/message.d.ts +10 -0
  369. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/message.js +21 -0
  370. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/service.d.ts +8 -0
  371. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/service.js +24 -0
  372. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/symbols.d.ts +140 -0
  373. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/symbols.js +40 -0
  374. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/types.d.ts +79 -0
  375. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv1/types.js +14 -0
  376. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/boot.d.ts +63 -0
  377. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/boot.js +101 -0
  378. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/embed.d.ts +43 -0
  379. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/embed.js +239 -0
  380. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/enum.d.ts +29 -0
  381. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/enum.js +53 -0
  382. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/extension.d.ts +9 -0
  383. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/extension.js +25 -0
  384. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.d.ts +7 -0
  385. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/file.js +32 -0
  386. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/index.d.ts +10 -0
  387. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/index.js +23 -0
  388. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/message.d.ts +15 -0
  389. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/message.js +21 -0
  390. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/restore-json-names.d.ts +5 -0
  391. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/restore-json-names.js +26 -0
  392. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/scalar.d.ts +9 -0
  393. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/scalar.js +63 -0
  394. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/service.d.ts +8 -0
  395. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/service.js +24 -0
  396. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/symbols.d.ts +145 -0
  397. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/symbols.js +71 -0
  398. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/types.d.ts +85 -0
  399. package/node_modules/@bufbuild/protobuf/dist/esm/codegenv2/types.js +14 -0
  400. package/node_modules/@bufbuild/protobuf/dist/esm/create.d.ts +9 -0
  401. package/node_modules/@bufbuild/protobuf/dist/esm/create.js +256 -0
  402. package/node_modules/@bufbuild/protobuf/dist/esm/descriptors.d.ts +634 -0
  403. package/node_modules/@bufbuild/protobuf/dist/esm/descriptors.js +50 -0
  404. package/node_modules/@bufbuild/protobuf/dist/esm/equals.d.ts +46 -0
  405. package/node_modules/@bufbuild/protobuf/dist/esm/equals.js +206 -0
  406. package/node_modules/@bufbuild/protobuf/dist/esm/extensions.d.ts +60 -0
  407. package/node_modules/@bufbuild/protobuf/dist/esm/extensions.js +159 -0
  408. package/node_modules/@bufbuild/protobuf/dist/esm/fields.d.ts +23 -0
  409. package/node_modules/@bufbuild/protobuf/dist/esm/fields.js +41 -0
  410. package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.d.ts +48 -0
  411. package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +241 -0
  412. package/node_modules/@bufbuild/protobuf/dist/esm/from-json.d.ts +73 -0
  413. package/node_modules/@bufbuild/protobuf/dist/esm/from-json.js +731 -0
  414. package/node_modules/@bufbuild/protobuf/dist/esm/index.d.ts +19 -0
  415. package/node_modules/@bufbuild/protobuf/dist/esm/index.js +29 -0
  416. package/node_modules/@bufbuild/protobuf/dist/esm/is-message.d.ts +7 -0
  417. package/node_modules/@bufbuild/protobuf/dist/esm/is-message.js +30 -0
  418. package/node_modules/@bufbuild/protobuf/dist/esm/json-value.d.ts +16 -0
  419. package/node_modules/@bufbuild/protobuf/dist/esm/json-value.js +14 -0
  420. package/node_modules/@bufbuild/protobuf/dist/esm/merge.d.ts +13 -0
  421. package/node_modules/@bufbuild/protobuf/dist/esm/merge.js +67 -0
  422. package/node_modules/@bufbuild/protobuf/dist/esm/package.json +4 -0
  423. package/node_modules/@bufbuild/protobuf/dist/esm/proto-int64.d.ts +98 -0
  424. package/node_modules/@bufbuild/protobuf/dist/esm/proto-int64.js +128 -0
  425. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/error.d.ts +9 -0
  426. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/error.js +31 -0
  427. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.d.ts +20 -0
  428. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/guard.js +71 -0
  429. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/index.d.ts +8 -0
  430. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/index.js +21 -0
  431. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/names.d.ts +30 -0
  432. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/names.js +109 -0
  433. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/nested-types.d.ts +35 -0
  434. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/nested-types.js +105 -0
  435. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/path.d.ts +107 -0
  436. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/path.js +369 -0
  437. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-check.d.ts +19 -0
  438. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-check.js +262 -0
  439. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-types.d.ts +217 -0
  440. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect-types.js +14 -0
  441. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.d.ts +43 -0
  442. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/reflect.js +541 -0
  443. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/scalar.d.ts +43 -0
  444. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/scalar.js +124 -0
  445. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/unsafe.d.ts +39 -0
  446. package/node_modules/@bufbuild/protobuf/dist/esm/reflect/unsafe.js +140 -0
  447. package/node_modules/@bufbuild/protobuf/dist/esm/registry.d.ts +98 -0
  448. package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +939 -0
  449. package/node_modules/@bufbuild/protobuf/dist/esm/to-binary.d.ts +24 -0
  450. package/node_modules/@bufbuild/protobuf/dist/esm/to-binary.js +195 -0
  451. package/node_modules/@bufbuild/protobuf/dist/esm/to-json.d.ts +67 -0
  452. package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +386 -0
  453. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/from-text.d.ts +35 -0
  454. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/from-text.js +680 -0
  455. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/index.d.ts +4 -0
  456. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/index.js +15 -0
  457. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/is-group-like.d.ts +19 -0
  458. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/is-group-like.js +44 -0
  459. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/reader.d.ts +91 -0
  460. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/reader.js +477 -0
  461. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/to-text.d.ts +34 -0
  462. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/to-text.js +355 -0
  463. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/writer.d.ts +76 -0
  464. package/node_modules/@bufbuild/protobuf/dist/esm/txtpb/writer.js +214 -0
  465. package/node_modules/@bufbuild/protobuf/dist/esm/types.d.ts +135 -0
  466. package/node_modules/@bufbuild/protobuf/dist/esm/types.js +14 -0
  467. package/node_modules/@bufbuild/protobuf/dist/esm/unknown-enum.d.ts +10 -0
  468. package/node_modules/@bufbuild/protobuf/dist/esm/unknown-enum.js +23 -0
  469. package/node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.d.ts +23 -0
  470. package/node_modules/@bufbuild/protobuf/dist/esm/wire/base64-encoding.js +152 -0
  471. package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.d.ts +268 -0
  472. package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +525 -0
  473. package/node_modules/@bufbuild/protobuf/dist/esm/wire/index.d.ts +5 -0
  474. package/node_modules/@bufbuild/protobuf/dist/esm/wire/index.js +18 -0
  475. package/node_modules/@bufbuild/protobuf/dist/esm/wire/size-delimited.d.ts +69 -0
  476. package/node_modules/@bufbuild/protobuf/dist/esm/wire/size-delimited.js +186 -0
  477. package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.d.ts +28 -0
  478. package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +57 -0
  479. package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-format.d.ts +13 -0
  480. package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-format.js +195 -0
  481. package/node_modules/@bufbuild/protobuf/dist/esm/wire/varint.d.ts +70 -0
  482. package/node_modules/@bufbuild/protobuf/dist/esm/wire/varint.js +313 -0
  483. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/any.d.ts +38 -0
  484. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/any.js +69 -0
  485. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/duration.d.ts +9 -0
  486. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/duration.js +35 -0
  487. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/any_pb.d.ts +238 -0
  488. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/any_pb.js +24 -0
  489. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +537 -0
  490. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.js +36 -0
  491. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +490 -0
  492. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.js +65 -0
  493. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/cpp_features_pb.d.ts +91 -0
  494. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/cpp_features_pb.js +57 -0
  495. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +4143 -0
  496. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +888 -0
  497. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/duration_pb.d.ts +161 -0
  498. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/duration_pb.js +24 -0
  499. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/empty_pb.d.ts +39 -0
  500. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/empty_pb.js +24 -0
  501. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/field_mask_pb.d.ts +424 -0
  502. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/field_mask_pb.js +24 -0
  503. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.d.ts +189 -0
  504. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.js +123 -0
  505. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/java_features_pb.d.ts +194 -0
  506. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/java_features_pb.js +103 -0
  507. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/source_context_pb.d.ts +43 -0
  508. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/source_context_pb.js +24 -0
  509. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/struct_pb.d.ts +195 -0
  510. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/struct_pb.js +56 -0
  511. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.d.ts +222 -0
  512. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.js +24 -0
  513. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/type_pb.d.ts +722 -0
  514. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/type_pb.js +239 -0
  515. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/wrappers_pb.d.ts +330 -0
  516. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/wrappers_pb.js +64 -0
  517. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/index.d.ts +19 -0
  518. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/index.js +32 -0
  519. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/timestamp.d.ts +21 -0
  520. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/timestamp.js +50 -0
  521. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.d.ts +25 -0
  522. package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.js +61 -0
  523. package/node_modules/@bufbuild/protobuf/package.json +147 -0
  524. package/node_modules/@code-yeongyu/senpi-codemode/CHANGELOG.md +26 -0
  525. package/node_modules/@code-yeongyu/senpi-codemode/package.json +4 -4
  526. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/cell-runtime.ts +2 -0
  527. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/render.ts +43 -6
  528. package/node_modules/@code-yeongyu/senpi-codemode/src/tool/types.ts +4 -0
  529. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.d.ts.map +1 -1
  530. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js +59 -17
  531. package/node_modules/@earendil-works/pi-agent-core/dist/agent-loop.js.map +1 -1
  532. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts +14 -0
  533. package/node_modules/@earendil-works/pi-agent-core/dist/agent.d.ts.map +1 -1
  534. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js +14 -0
  535. package/node_modules/@earendil-works/pi-agent-core/dist/agent.js.map +1 -1
  536. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts +12 -1
  537. package/node_modules/@earendil-works/pi-agent-core/dist/types.d.ts.map +1 -1
  538. package/node_modules/@earendil-works/pi-agent-core/dist/types.js.map +1 -1
  539. package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
  540. package/node_modules/@earendil-works/pi-ai/README.md +3 -2
  541. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/deterministic-id.d.ts +17 -0
  542. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/deterministic-id.d.ts.map +1 -0
  543. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/deterministic-id.js +14 -0
  544. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/deterministic-id.js.map +1 -0
  545. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-lifecycle.d.ts +13 -0
  546. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-lifecycle.d.ts.map +1 -0
  547. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-lifecycle.js +33 -0
  548. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-lifecycle.js.map +1 -0
  549. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-modern.d.ts +79 -0
  550. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-modern.d.ts.map +1 -0
  551. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-modern.js +360 -0
  552. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/exec-modern.js.map +1 -0
  553. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/gen/agent_pb.d.ts +16797 -0
  554. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/gen/agent_pb.d.ts.map +1 -0
  555. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/gen/agent_pb.js +3828 -0
  556. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/gen/agent_pb.js.map +1 -0
  557. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/pi-args.d.ts +55 -0
  558. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/pi-args.d.ts.map +1 -0
  559. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/pi-args.js +76 -0
  560. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/pi-args.js.map +1 -0
  561. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/types.d.ts +116 -0
  562. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/types.d.ts.map +1 -0
  563. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/types.js +16 -0
  564. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent/types.js.map +1 -0
  565. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts +191 -0
  566. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.d.ts.map +1 -0
  567. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js +3316 -0
  568. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.js.map +1 -0
  569. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.lazy.d.ts +29 -0
  570. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.lazy.d.ts.map +1 -0
  571. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.lazy.js +33 -0
  572. package/node_modules/@earendil-works/pi-ai/dist/api/cursor-agent.lazy.js.map +1 -0
  573. package/node_modules/@earendil-works/pi-ai/dist/compat.d.ts +1 -0
  574. package/node_modules/@earendil-works/pi-ai/dist/compat.d.ts.map +1 -1
  575. package/node_modules/@earendil-works/pi-ai/dist/compat.js +3 -0
  576. package/node_modules/@earendil-works/pi-ai/dist/compat.js.map +1 -1
  577. package/node_modules/@earendil-works/pi-ai/dist/cursor-agent-provider.d.ts +11 -0
  578. package/node_modules/@earendil-works/pi-ai/dist/cursor-agent-provider.d.ts.map +1 -0
  579. package/node_modules/@earendil-works/pi-ai/dist/cursor-agent-provider.js +11 -0
  580. package/node_modules/@earendil-works/pi-ai/dist/cursor-agent-provider.js.map +1 -0
  581. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts +3 -0
  582. package/node_modules/@earendil-works/pi-ai/dist/index.d.ts.map +1 -1
  583. package/node_modules/@earendil-works/pi-ai/dist/index.js +2 -0
  584. package/node_modules/@earendil-works/pi-ai/dist/index.js.map +1 -1
  585. package/node_modules/@earendil-works/pi-ai/dist/model.d.ts +6 -1
  586. package/node_modules/@earendil-works/pi-ai/dist/model.d.ts.map +1 -1
  587. package/node_modules/@earendil-works/pi-ai/dist/model.js.map +1 -1
  588. package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.d.ts +6 -9
  589. package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.d.ts.map +1 -1
  590. package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js +42 -9
  591. package/node_modules/@earendil-works/pi-ai/dist/providers/cursor.js.map +1 -1
  592. package/node_modules/@earendil-works/pi-ai/dist/providers/data/.manifest.json +1 -1
  593. package/node_modules/@earendil-works/pi-ai/dist/providers/data/amazon-bedrock.json +1 -1
  594. package/node_modules/@earendil-works/pi-ai/dist/providers/data/baseten.json +1 -1
  595. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cerebras.json +1 -1
  596. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-ai-gateway.json +1 -1
  597. package/node_modules/@earendil-works/pi-ai/dist/providers/data/cloudflare-workers-ai.json +1 -1
  598. package/node_modules/@earendil-works/pi-ai/dist/providers/data/huggingface.json +1 -1
  599. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openai-codex.json +1 -1
  600. package/node_modules/@earendil-works/pi-ai/dist/providers/data/openrouter.json +1 -1
  601. package/node_modules/@earendil-works/pi-ai/dist/providers/data/together.json +1 -1
  602. package/node_modules/@earendil-works/pi-ai/dist/providers/data/vercel-ai-gateway.json +1 -1
  603. package/node_modules/@earendil-works/pi-ai/dist/providers/data/xai.json +1 -1
  604. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +3 -1
  605. package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
  606. package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
  607. package/node_modules/@earendil-works/pi-ai/dist/utils/block-symbols.d.ts +57 -0
  608. package/node_modules/@earendil-works/pi-ai/dist/utils/block-symbols.d.ts.map +1 -0
  609. package/node_modules/@earendil-works/pi-ai/dist/utils/block-symbols.js +57 -0
  610. package/node_modules/@earendil-works/pi-ai/dist/utils/block-symbols.js.map +1 -0
  611. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts +10 -0
  612. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.d.ts.map +1 -1
  613. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js +22 -0
  614. package/node_modules/@earendil-works/pi-ai/dist/utils/event-stream.js.map +1 -1
  615. package/node_modules/@earendil-works/pi-ai/package.json +3 -2
  616. package/node_modules/@earendil-works/pi-pty/package.json +1 -1
  617. package/node_modules/@earendil-works/pi-telemetry/package.json +1 -1
  618. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.d.ts.map +1 -1
  619. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js +21 -0
  620. package/node_modules/@earendil-works/pi-tui/dist/autocomplete.js.map +1 -1
  621. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +1 -1
  622. package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
  623. package/node_modules/@earendil-works/pi-tui/dist/dollar-invocation-autocomplete.d.ts +9 -0
  624. package/node_modules/@earendil-works/pi-tui/dist/dollar-invocation-autocomplete.d.ts.map +1 -0
  625. package/node_modules/@earendil-works/pi-tui/dist/dollar-invocation-autocomplete.js +82 -0
  626. package/node_modules/@earendil-works/pi-tui/dist/dollar-invocation-autocomplete.js.map +1 -0
  627. package/node_modules/@earendil-works/pi-tui/package.json +1 -1
  628. package/package.json +11 -8
@@ -1 +1 @@
1
- {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAsBpD,SAAS,mBAAmB,CAAC,QAAwB;IACpD,OAAO,QAAQ,CAAC,MAAM,CACrB,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CACrG,CAAC;AACH,CAAC;AAED,MAAM,WAAW,GAAG;IACnB,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,CAA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,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC;QACtD,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC9D,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACvC,MAAM,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC/B,CAAC;IACF,CAAC;CACD","sourcesContent":["import type {\n\tImageContent,\n\tMessage,\n\tModel,\n\tSimpleStreamOptions,\n\tTextContent,\n\tThinkingBudgets,\n\tTransport,\n} from \"@earendil-works/pi-ai\";\nimport { runAgentLoop, runAgentLoopContinue } from \"./agent-loop.ts\";\nimport { getDefaultStreamFn } from \"./stream-fn.ts\";\nimport type {\n\tAfterToolCallContext,\n\tAfterToolCallResult,\n\tAgentContext,\n\tAgentEvent,\n\tAgentLoopConfig,\n\tAgentLoopTurnUpdate,\n\tAgentMessage,\n\tAgentState,\n\tAgentTool,\n\tBeforeToolCallContext,\n\tBeforeToolCallResult,\n\tPrepareNextTurnContext,\n\tQueueMode,\n\tShouldStopAfterTurnContext,\n\tStreamFn,\n\tToolExecutionMode,\n} from \"./types.ts\";\n\nexport type { QueueMode } from \"./types.ts\";\n\nfunction defaultConvertToLlm(messages: AgentMessage[]): Message[] {\n\treturn messages.filter(\n\t\t(message) => message.role === \"user\" || message.role === \"assistant\" || message.role === \"toolResult\",\n\t);\n}\n\nconst EMPTY_USAGE = {\n\tinput: 0,\n\toutput: 0,\n\tcacheRead: 0,\n\tcacheWrite: 0,\n\ttotalTokens: 0,\n\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n};\n\nconst DEFAULT_MODEL = {\n\tid: \"unknown\",\n\tname: \"unknown\",\n\tapi: \"unknown\",\n\tprovider: \"unknown\",\n\tbaseUrl: \"\",\n\treasoning: false,\n\tinput: [],\n\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\tcontextWindow: 0,\n\tmaxTokens: 0,\n} satisfies Model<any>;\n\ntype MutableAgentState = Omit<AgentState, \"isStreaming\" | \"streamingMessage\" | \"pendingToolCalls\" | \"errorMessage\"> & {\n\tisStreaming: boolean;\n\tstreamingMessage?: AgentMessage;\n\tpendingToolCalls: Set<string>;\n\terrorMessage?: string;\n};\n\nfunction createMutableAgentState(\n\tinitialState?: Partial<Omit<AgentState, \"pendingToolCalls\" | \"isStreaming\" | \"streamingMessage\" | \"errorMessage\">>,\n): MutableAgentState {\n\tlet tools = initialState?.tools?.slice() ?? [];\n\tlet messages = initialState?.messages?.slice() ?? [];\n\n\treturn {\n\t\tsystemPrompt: initialState?.systemPrompt ?? \"\",\n\t\tmodel: initialState?.model ?? DEFAULT_MODEL,\n\t\tthinkingLevel: initialState?.thinkingLevel ?? \"off\",\n\t\tget tools() {\n\t\t\treturn tools;\n\t\t},\n\t\tset tools(nextTools: AgentTool<any>[]) {\n\t\t\ttools = nextTools.slice();\n\t\t},\n\t\tget messages() {\n\t\t\treturn messages;\n\t\t},\n\t\tset messages(nextMessages: AgentMessage[]) {\n\t\t\tmessages = nextMessages.slice();\n\t\t},\n\t\tisStreaming: false,\n\t\tstreamingMessage: undefined,\n\t\tpendingToolCalls: new Set<string>(),\n\t\terrorMessage: undefined,\n\t};\n}\n\n/** Options for constructing an {@link Agent}. */\nexport interface AgentOptions {\n\tinitialState?: Partial<Omit<AgentState, \"pendingToolCalls\" | \"isStreaming\" | \"streamingMessage\" | \"errorMessage\">>;\n\tconvertToLlm?: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;\n\ttransformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;\n\tstreamFn: StreamFn;\n\tgetApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;\n\tonPayload?: SimpleStreamOptions[\"onPayload\"];\n\tonResponse?: SimpleStreamOptions[\"onResponse\"];\n\tbeforeToolCall?: (context: BeforeToolCallContext, signal?: AbortSignal) => Promise<BeforeToolCallResult | undefined>;\n\tafterToolCall?: (context: AfterToolCallContext, signal?: AbortSignal) => Promise<AfterToolCallResult | undefined>;\n\tshouldStopAfterTurn?: (context: ShouldStopAfterTurnContext, signal?: AbortSignal) => boolean | Promise<boolean>;\n\tprepareNextTurn?: (\n\t\tsignal?: AbortSignal,\n\t) => Promise<AgentLoopTurnUpdate | undefined> | AgentLoopTurnUpdate | undefined;\n\tprepareNextTurnWithContext?: (\n\t\tcontext: PrepareNextTurnContext,\n\t\tsignal?: AbortSignal,\n\t) => Promise<AgentLoopTurnUpdate | undefined> | AgentLoopTurnUpdate | undefined;\n\tsteeringMode?: QueueMode;\n\tfollowUpMode?: QueueMode;\n\tsessionId?: string;\n\tthinkingBudgets?: ThinkingBudgets;\n\ttransport?: Transport;\n\ttimeoutMs?: number;\n\tstreamStartTimeoutMs?: number;\n\tmaxRetryDelayMs?: number;\n\ttoolExecution?: ToolExecutionMode;\n\tremovedToolHints?: Record<string, string>;\n\tresolveUnknownToolCall?: AgentLoopConfig[\"resolveUnknownToolCall\"];\n\tabortServerSideFallback?: boolean;\n}\n\nexport interface AgentContinuationOptions {\n\t/** Keep queued steering and follow-up input out of the continuation's first provider request only. */\n\tdeferQueuedMessages?: boolean;\n\t/** Override the provider stream idle timeout for the continuation's first provider request only. */\n\ttimeoutMs?: number;\n\t/** Override the provider stream-start timeout for the continuation's first provider request only. */\n\tstreamStartTimeoutMs?: number;\n}\n\nclass PendingMessageQueue {\n\tprivate messages: AgentMessage[] = [];\n\tprivate clearGeneration = 0;\n\tpublic mode: QueueMode;\n\n\tconstructor(mode: QueueMode) {\n\t\tthis.mode = mode;\n\t}\n\n\tenqueue(message: AgentMessage): void {\n\t\tthis.messages.push(message);\n\t}\n\n\thasItems(): boolean {\n\t\treturn this.messages.length > 0;\n\t}\n\n\tgetClearGeneration(): number {\n\t\treturn this.clearGeneration;\n\t}\n\n\tdrain(): AgentMessage[] {\n\t\tif (this.mode === \"all\") {\n\t\t\tconst drained = this.messages.slice();\n\t\t\tthis.messages = [];\n\t\t\treturn drained;\n\t\t}\n\n\t\tconst first = this.messages[0];\n\t\tif (!first) {\n\t\t\treturn [];\n\t\t}\n\t\tthis.messages = this.messages.slice(1);\n\t\treturn [first];\n\t}\n\n\tprepend(messages: AgentMessage[]): void {\n\t\tthis.messages = [...messages, ...this.messages];\n\t}\n\n\tclear(): void {\n\t\tthis.messages = [];\n\t\tthis.clearGeneration++;\n\t}\n}\n\ntype ActiveRun = {\n\tpromise: Promise<void>;\n\tresolve: () => void;\n\tabortController: AbortController;\n\tsuppressQueuedMessageDrain: boolean;\n};\n\n/**\n * Stateful wrapper around the low-level agent loop.\n *\n * `Agent` owns the current transcript, emits lifecycle events, executes tools,\n * and exposes queueing APIs for steering and follow-up messages.\n */\nexport class Agent {\n\tprivate _state: MutableAgentState;\n\tprivate readonly listeners = new Set<(event: AgentEvent, signal: AbortSignal) => Promise<void> | void>();\n\tprivate readonly steeringQueue: PendingMessageQueue;\n\tprivate readonly followUpQueue: PendingMessageQueue;\n\n\tpublic convertToLlm: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;\n\tpublic transformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;\n\tpublic streamFunction: StreamFn;\n\tpublic getApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;\n\tpublic onPayload?: SimpleStreamOptions[\"onPayload\"];\n\tpublic onResponse?: SimpleStreamOptions[\"onResponse\"];\n\tpublic beforeToolCall?: (\n\t\tcontext: BeforeToolCallContext,\n\t\tsignal?: AbortSignal,\n\t) => Promise<BeforeToolCallResult | undefined>;\n\tpublic afterToolCall?: (\n\t\tcontext: AfterToolCallContext,\n\t\tsignal?: AbortSignal,\n\t) => Promise<AfterToolCallResult | undefined>;\n\tpublic shouldStopAfterTurn?: (\n\t\tcontext: ShouldStopAfterTurnContext,\n\t\tsignal?: AbortSignal,\n\t) => boolean | Promise<boolean>;\n\tpublic prepareNextTurn?: (\n\t\tsignal?: AbortSignal,\n\t) => Promise<AgentLoopTurnUpdate | undefined> | AgentLoopTurnUpdate | undefined;\n\tpublic prepareNextTurnWithContext?: (\n\t\tcontext: PrepareNextTurnContext,\n\t\tsignal?: AbortSignal,\n\t) => Promise<AgentLoopTurnUpdate | undefined> | AgentLoopTurnUpdate | undefined;\n\tprivate activeRun?: ActiveRun;\n\t/** Session identifier forwarded to providers for cache-aware backends. */\n\tpublic sessionId?: string;\n\t/** Optional per-level thinking token budgets forwarded to the stream function. */\n\tpublic thinkingBudgets?: ThinkingBudgets;\n\t/** Preferred transport forwarded to the stream function. */\n\tpublic transport: Transport;\n\tpublic timeoutMs?: number;\n\t/** Optional bound on the wait for the first provider stream event. */\n\tpublic streamStartTimeoutMs?: number;\n\t/** Optional cap for provider-requested retry delays. */\n\tpublic maxRetryDelayMs?: number;\n\t/** Tool execution strategy for assistant messages that contain multiple tool calls. */\n\tpublic toolExecution: ToolExecutionMode;\n\t/** Migration guidance returned when a removed tool name is called. */\n\tpublic removedToolHints: Record<string, string>;\n\t/** Optional call-time resolver for tools absent from the request context. */\n\tpublic resolveUnknownToolCall?: AgentLoopConfig[\"resolveUnknownToolCall\"];\n\t/** Forwarded to the stream function; providers without server-side fallback ignore it. */\n\tpublic abortServerSideFallback?: boolean;\n\n\tconstructor(options: AgentOptions) {\n\t\t// Older compiled consumers may omit options or streamFn even though the current API requires them.\n\t\tconst runtimeOptions: Partial<AgentOptions> = options ?? {};\n\t\tthis._state = createMutableAgentState(runtimeOptions.initialState);\n\t\tthis.convertToLlm = runtimeOptions.convertToLlm ?? defaultConvertToLlm;\n\t\tthis.transformContext = runtimeOptions.transformContext;\n\t\tthis.streamFunction = runtimeOptions.streamFn ?? getDefaultStreamFn();\n\t\tthis.getApiKey = runtimeOptions.getApiKey;\n\t\tthis.onPayload = runtimeOptions.onPayload;\n\t\tthis.onResponse = runtimeOptions.onResponse;\n\t\tthis.beforeToolCall = runtimeOptions.beforeToolCall;\n\t\tthis.afterToolCall = runtimeOptions.afterToolCall;\n\t\tthis.shouldStopAfterTurn = runtimeOptions.shouldStopAfterTurn;\n\t\tthis.prepareNextTurn = runtimeOptions.prepareNextTurn;\n\t\tthis.prepareNextTurnWithContext = runtimeOptions.prepareNextTurnWithContext;\n\t\tthis.steeringQueue = new PendingMessageQueue(runtimeOptions.steeringMode ?? \"one-at-a-time\");\n\t\tthis.followUpQueue = new PendingMessageQueue(runtimeOptions.followUpMode ?? \"one-at-a-time\");\n\t\tthis.sessionId = runtimeOptions.sessionId;\n\t\tthis.thinkingBudgets = runtimeOptions.thinkingBudgets;\n\t\tthis.transport = runtimeOptions.transport ?? \"auto\";\n\t\tthis.timeoutMs = runtimeOptions.timeoutMs;\n\t\tthis.streamStartTimeoutMs = runtimeOptions.streamStartTimeoutMs;\n\t\tthis.maxRetryDelayMs = runtimeOptions.maxRetryDelayMs;\n\t\tthis.toolExecution = runtimeOptions.toolExecution ?? \"parallel\";\n\t\tthis.removedToolHints = runtimeOptions.removedToolHints ?? {};\n\t\tthis.resolveUnknownToolCall = runtimeOptions.resolveUnknownToolCall;\n\t\tthis.abortServerSideFallback = runtimeOptions.abortServerSideFallback;\n\t}\n\n\t/**\n\t * Subscribe to agent lifecycle events.\n\t *\n\t * Listener promises are awaited in subscription order and are included in\n\t * the current run's settlement. Listeners also receive the active abort\n\t * signal for the current run.\n\t *\n\t * `agent_end` is the final emitted event for a run, but the agent does not\n\t * become idle until all awaited listeners for that event have settled.\n\t */\n\tsubscribe(listener: (event: AgentEvent, signal: AbortSignal) => Promise<void> | void): () => void {\n\t\tthis.listeners.add(listener);\n\t\treturn () => this.listeners.delete(listener);\n\t}\n\n\t/**\n\t * Current agent state.\n\t *\n\t * Assigning `state.tools` or `state.messages` copies the provided top-level array.\n\t */\n\tget state(): AgentState {\n\t\treturn this._state;\n\t}\n\n\t/** Controls how queued steering messages are drained. */\n\tset steeringMode(mode: QueueMode) {\n\t\tthis.steeringQueue.mode = mode;\n\t}\n\n\tget steeringMode(): QueueMode {\n\t\treturn this.steeringQueue.mode;\n\t}\n\n\t/** Controls how queued follow-up messages are drained. */\n\tset followUpMode(mode: QueueMode) {\n\t\tthis.followUpQueue.mode = mode;\n\t}\n\n\tget followUpMode(): QueueMode {\n\t\treturn this.followUpQueue.mode;\n\t}\n\n\t/** Queue a message to be injected after the current assistant turn finishes. */\n\tsteer(message: AgentMessage): void {\n\t\tthis.steeringQueue.enqueue(message);\n\t}\n\n\t/** Queue a message to run only after the agent would otherwise stop. */\n\tfollowUp(message: AgentMessage): void {\n\t\tthis.followUpQueue.enqueue(message);\n\t}\n\n\t/** Remove all queued steering messages. */\n\tclearSteeringQueue(): void {\n\t\tthis.steeringQueue.clear();\n\t}\n\n\t/** Remove all queued follow-up messages. */\n\tclearFollowUpQueue(): void {\n\t\tthis.followUpQueue.clear();\n\t}\n\n\t/** Remove all queued steering and follow-up messages. */\n\tclearAllQueues(): void {\n\t\tthis.clearSteeringQueue();\n\t\tthis.clearFollowUpQueue();\n\t}\n\n\t/** Returns true when either queue still contains pending messages. */\n\thasQueuedMessages(): boolean {\n\t\treturn this.steeringQueue.hasItems() || this.followUpQueue.hasItems();\n\t}\n\n\t/** Active abort signal for the current run, if any. */\n\tget signal(): AbortSignal | undefined {\n\t\treturn this.activeRun?.abortController.signal;\n\t}\n\n\t/** Abort the current run, if one is active. */\n\tabort(): void {\n\t\tthis.activeRun?.abortController.abort();\n\t}\n\n\t/**\n\t * Keep queued steering and follow-up messages for an external owner after\n\t * this run reaches agent_end, without changing the active abort signal.\n\t * This is ownership suppression for one active run; terminal error/abort\n\t * parking is a separate stop-reason policy enforced by the run lifecycle.\n\t */\n\tsuppressQueuedMessageDrain(): void {\n\t\tif (this.activeRun) {\n\t\t\tthis.activeRun.suppressQueuedMessageDrain = true;\n\t\t}\n\t}\n\n\t/**\n\t * Resolve when the current run and all awaited event listeners have finished.\n\t *\n\t * This resolves after `agent_end` listeners settle.\n\t */\n\twaitForIdle(): Promise<void> {\n\t\treturn this.activeRun?.promise ?? Promise.resolve();\n\t}\n\n\t/** Clear transcript state, runtime state, and queued messages. */\n\treset(): void {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\"Agent is already processing. Wait for completion before resetting.\");\n\t\t}\n\n\t\tthis._state.messages = [];\n\t\tthis._state.isStreaming = false;\n\t\tthis._state.streamingMessage = undefined;\n\t\tthis._state.pendingToolCalls = new Set<string>();\n\t\tthis._state.errorMessage = undefined;\n\t\tthis.clearFollowUpQueue();\n\t\tthis.clearSteeringQueue();\n\t}\n\n\t/** Start a new prompt from text, a single message, or a batch of messages. */\n\tasync prompt(message: AgentMessage | AgentMessage[]): Promise<void>;\n\tasync prompt(input: string, images?: ImageContent[]): Promise<void>;\n\tasync prompt(input: string | AgentMessage | AgentMessage[], images?: ImageContent[]): Promise<void> {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Agent is already processing a prompt. Use steer() or followUp() to queue messages, or wait for completion.\",\n\t\t\t);\n\t\t}\n\t\tconst messages = this.normalizePromptInput(input, images);\n\t\tawait this.runPromptMessages(messages);\n\t}\n\n\t/**\n\t * Continue by delivering queued input first when a compaction leaves custom context at the tail.\n\t * Queue-first recovery takes precedence over `deferQueuedMessages`: the selected queued message is\n\t * the continuation input, while timeout overrides still apply to its first provider request.\n\t */\n\tasync continueWithQueuedMessages(options: AgentContinuationOptions = {}): Promise<void> {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\"Agent is already processing. Wait for completion before continuing.\");\n\t\t}\n\n\t\tif (this._state.messages[this._state.messages.length - 1]?.role === \"assistant\") {\n\t\t\tawait this.continue(options);\n\t\t\treturn;\n\t\t}\n\n\t\tconst queuedSteering = this.steeringQueue.drain();\n\t\tif (queuedSteering.length > 0) {\n\t\t\tawait this.runPromptMessages(queuedSteering, {\n\t\t\t\tskipInitialSteeringPoll: true,\n\t\t\t\tinitialRequestTimeoutMs: options.timeoutMs,\n\t\t\t\tinitialRequestStreamStartTimeoutMs: options.streamStartTimeoutMs,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst queuedFollowUps = this.followUpQueue.drain();\n\t\tif (queuedFollowUps.length > 0) {\n\t\t\tawait this.runPromptMessages(queuedFollowUps, {\n\t\t\t\tinitialRequestTimeoutMs: options.timeoutMs,\n\t\t\t\tinitialRequestStreamStartTimeoutMs: options.streamStartTimeoutMs,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tawait this.continue(options);\n\t}\n\n\t/**\n\t * Continue from the current transcript. The last message must be a user or tool-result message.\n\t * Queue deferral and timeout overrides apply only to the first provider request; later requests in\n\t * the same run and later runs use the configured Agent defaults.\n\t */\n\tasync continue(options: AgentContinuationOptions = {}): Promise<void> {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\"Agent is already processing. Wait for completion before continuing.\");\n\t\t}\n\n\t\tconst lastMessage = this._state.messages[this._state.messages.length - 1];\n\t\tif (!lastMessage) {\n\t\t\tthrow new Error(\"No messages to continue from\");\n\t\t}\n\n\t\tif (lastMessage.role === \"assistant\") {\n\t\t\tconst queuedSteering = this.steeringQueue.drain();\n\t\t\tif (queuedSteering.length > 0) {\n\t\t\t\tawait this.runPromptMessages(queuedSteering, {\n\t\t\t\t\tskipInitialSteeringPoll: true,\n\t\t\t\t\tinitialRequestTimeoutMs: options.timeoutMs,\n\t\t\t\t\tinitialRequestStreamStartTimeoutMs: options.streamStartTimeoutMs,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst queuedFollowUps = this.followUpQueue.drain();\n\t\t\tif (queuedFollowUps.length > 0) {\n\t\t\t\tawait this.runPromptMessages(queuedFollowUps, {\n\t\t\t\t\tinitialRequestTimeoutMs: options.timeoutMs,\n\t\t\t\t\tinitialRequestStreamStartTimeoutMs: options.streamStartTimeoutMs,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthrow new Error(\"Cannot continue from message role: assistant\");\n\t\t}\n\n\t\tawait this.runContinuation(options);\n\t}\n\n\tprivate normalizePromptInput(\n\t\tinput: string | AgentMessage | AgentMessage[],\n\t\timages?: ImageContent[],\n\t): AgentMessage[] {\n\t\tif (Array.isArray(input)) {\n\t\t\treturn input;\n\t\t}\n\n\t\tif (typeof input !== \"string\") {\n\t\t\treturn [input];\n\t\t}\n\n\t\tconst content: Array<TextContent | ImageContent> = [{ type: \"text\", text: input }];\n\t\tif (images && images.length > 0) {\n\t\t\tcontent.push(...images);\n\t\t}\n\t\treturn [{ role: \"user\", content, timestamp: Date.now() }];\n\t}\n\n\tprivate async runPromptMessages(\n\t\tmessages: AgentMessage[],\n\t\toptions: {\n\t\t\tskipInitialSteeringPoll?: boolean;\n\t\t\tinitialRequestTimeoutMs?: number;\n\t\t\tinitialRequestStreamStartTimeoutMs?: number;\n\t\t} = {},\n\t): Promise<void> {\n\t\tawait this.runWithLifecycle(async (signal) => {\n\t\t\tawait runAgentLoop(\n\t\t\t\tmessages,\n\t\t\t\tthis.createContextSnapshot(),\n\t\t\t\tthis.createLoopConfig(options),\n\t\t\t\t(event) => this.processEvents(event),\n\t\t\t\tsignal,\n\t\t\t\tthis.streamFunction,\n\t\t\t);\n\t\t});\n\t}\n\n\tprivate async runContinuation(options: AgentContinuationOptions = {}): Promise<void> {\n\t\tawait this.runWithLifecycle(async (signal) => {\n\t\t\tawait runAgentLoopContinue(\n\t\t\t\tthis.createContextSnapshot(),\n\t\t\t\tthis.createLoopConfig({\n\t\t\t\t\tskipInitialSteeringPoll: options.deferQueuedMessages,\n\t\t\t\t\tinitialRequestTimeoutMs: options.timeoutMs,\n\t\t\t\t\tinitialRequestStreamStartTimeoutMs: options.streamStartTimeoutMs,\n\t\t\t\t}),\n\t\t\t\t(event) => this.processEvents(event),\n\t\t\t\tsignal,\n\t\t\t\tthis.streamFunction,\n\t\t\t);\n\t\t});\n\t}\n\n\tprivate createContextSnapshot(): AgentContext {\n\t\treturn {\n\t\t\tsystemPrompt: this._state.systemPrompt,\n\t\t\tmessages: this._state.messages.slice(),\n\t\t\ttools: this._state.tools.slice(),\n\t\t};\n\t}\n\n\tprivate createLoopConfig(\n\t\toptions: {\n\t\t\tskipInitialSteeringPoll?: boolean;\n\t\t\tinitialRequestTimeoutMs?: number;\n\t\t\tinitialRequestStreamStartTimeoutMs?: number;\n\t\t} = {},\n\t): AgentLoopConfig {\n\t\tlet skipInitialSteeringPoll = options.skipInitialSteeringPoll === true;\n\t\tlet steeringQueueGeneration = this.steeringQueue.getClearGeneration();\n\t\tlet followUpQueueGeneration = this.followUpQueue.getClearGeneration();\n\t\tconst shouldStopAfterTurn = this.shouldStopAfterTurn;\n\t\treturn {\n\t\t\tmodel: this._state.model,\n\t\t\treasoning: this._state.thinkingLevel === \"off\" ? undefined : this._state.thinkingLevel,\n\t\t\tsessionId: this.sessionId,\n\t\t\tonPayload: this.onPayload,\n\t\t\tonResponse: this.onResponse,\n\t\t\ttransport: this.transport,\n\t\t\tthinkingBudgets: this.thinkingBudgets,\n\t\t\ttimeoutMs: this.timeoutMs,\n\t\t\tstreamStartTimeoutMs: this.streamStartTimeoutMs,\n\t\t\tinitialRequestTimeoutMs: options.initialRequestTimeoutMs,\n\t\t\tinitialRequestStreamStartTimeoutMs: options.initialRequestStreamStartTimeoutMs,\n\t\t\tmaxRetryDelayMs: this.maxRetryDelayMs,\n\t\t\tabortServerSideFallback: this.abortServerSideFallback,\n\t\t\ttoolExecution: this.toolExecution,\n\t\t\tremovedToolHints: this.removedToolHints,\n\t\t\tresolveUnknownToolCall: this.resolveUnknownToolCall,\n\t\t\tbeforeToolCall: this.beforeToolCall,\n\t\t\tafterToolCall: this.afterToolCall,\n\t\t\tshouldStopAfterTurn: shouldStopAfterTurn\n\t\t\t\t? async (context) => await shouldStopAfterTurn(context, this.signal)\n\t\t\t\t: undefined,\n\t\t\tprepareNextTurn:\n\t\t\t\tthis.prepareNextTurnWithContext || this.prepareNextTurn\n\t\t\t\t\t? async (context) => {\n\t\t\t\t\t\t\tif (this.prepareNextTurnWithContext) {\n\t\t\t\t\t\t\t\treturn await this.prepareNextTurnWithContext(context, this.signal);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn await this.prepareNextTurn?.(this.signal);\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\tconvertToLlm: this.convertToLlm,\n\t\t\ttransformContext: this.transformContext,\n\t\t\tgetApiKey: this.getApiKey,\n\t\t\tgetSteeringMessages: async () => {\n\t\t\t\tif (skipInitialSteeringPoll) {\n\t\t\t\t\tskipInitialSteeringPoll = false;\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\tsteeringQueueGeneration = this.steeringQueue.getClearGeneration();\n\t\t\t\treturn this.steeringQueue.drain();\n\t\t\t},\n\t\t\tgetFollowUpMessages: async () => {\n\t\t\t\tfollowUpQueueGeneration = this.followUpQueue.getClearGeneration();\n\t\t\t\treturn this.followUpQueue.drain();\n\t\t\t},\n\t\t\trestorePendingMessages: (queue, messages) => {\n\t\t\t\tif (queue === \"steering\") {\n\t\t\t\t\tif (this.steeringQueue.getClearGeneration() !== steeringQueueGeneration) return;\n\t\t\t\t\tthis.steeringQueue.prepend(messages);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (this.followUpQueue.getClearGeneration() !== followUpQueueGeneration) return;\n\t\t\t\tthis.followUpQueue.prepend(messages);\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate async runWithLifecycle(executor: (signal: AbortSignal) => Promise<void>): Promise<void> {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\"Agent is already processing.\");\n\t\t}\n\n\t\tconst abortController = new AbortController();\n\t\tlet resolvePromise = () => {};\n\t\tconst promise = new Promise<void>((resolve) => {\n\t\t\tresolvePromise = resolve;\n\t\t});\n\t\tthis.activeRun = { promise, resolve: resolvePromise, abortController, suppressQueuedMessageDrain: false };\n\n\t\tthis._state.isStreaming = true;\n\t\tthis._state.streamingMessage = undefined;\n\t\tthis._state.errorMessage = undefined;\n\n\t\ttry {\n\t\t\tawait executor(abortController.signal);\n\t\t\t// A provider-returned terminal error/abort has no safe implicit owner for\n\t\t\t// queued work. Park it until an external retry/compaction owner continues,\n\t\t\t// or until a later admitted prompt drains it through the normal queue poll.\n\t\t\twhile (\n\t\t\t\t!abortController.signal.aborted &&\n\t\t\t\t!this.activeRun?.suppressQueuedMessageDrain &&\n\t\t\t\tthis.canDrainQueuedMessagesAfterRun() &&\n\t\t\t\tthis.hasQueuedMessages()\n\t\t\t) {\n\t\t\t\tawait this.runQueuedMessagesAfterAgentEnd(abortController.signal);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tawait this.handleRunFailure(error, abortController.signal.aborted);\n\t\t} finally {\n\t\t\tthis.finishRun();\n\t\t}\n\t}\n\n\tprivate canDrainQueuedMessagesAfterRun(): boolean {\n\t\tconst lastMessage = this._state.messages[this._state.messages.length - 1];\n\t\treturn (\n\t\t\tlastMessage?.role !== \"assistant\" ||\n\t\t\t(lastMessage.stopReason !== \"error\" && lastMessage.stopReason !== \"aborted\")\n\t\t);\n\t}\n\n\tprivate async runQueuedMessagesAfterAgentEnd(signal: AbortSignal): Promise<void> {\n\t\tconst queuedSteering = this.steeringQueue.drain();\n\t\tif (queuedSteering.length > 0) {\n\t\t\tawait runAgentLoop(\n\t\t\t\tqueuedSteering,\n\t\t\t\tthis.createContextSnapshot(),\n\t\t\t\tthis.createLoopConfig({ skipInitialSteeringPoll: true }),\n\t\t\t\t(event) => this.processEvents(event),\n\t\t\t\tsignal,\n\t\t\t\tthis.streamFunction,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst queuedFollowUps = this.followUpQueue.drain();\n\t\tif (queuedFollowUps.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait runAgentLoop(\n\t\t\tqueuedFollowUps,\n\t\t\tthis.createContextSnapshot(),\n\t\t\tthis.createLoopConfig(),\n\t\t\t(event) => this.processEvents(event),\n\t\t\tsignal,\n\t\t\tthis.streamFunction,\n\t\t);\n\t}\n\n\tprivate async handleRunFailure(error: unknown, aborted: boolean): Promise<void> {\n\t\tconst failureMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [{ type: \"text\", text: \"\" }],\n\t\t\tapi: this._state.model.api,\n\t\t\tprovider: this._state.model.provider,\n\t\t\tmodel: this._state.model.id,\n\t\t\tusage: EMPTY_USAGE,\n\t\t\tstopReason: aborted ? \"aborted\" : \"error\",\n\t\t\terrorMessage: error instanceof Error ? error.message : String(error),\n\t\t\ttimestamp: Date.now(),\n\t\t} satisfies AgentMessage;\n\t\tawait this.processEvents({ type: \"message_start\", message: failureMessage });\n\t\tawait this.processEvents({ type: \"message_end\", message: failureMessage });\n\t\tawait this.processEvents({ type: \"turn_end\", message: failureMessage, toolResults: [] });\n\t\tawait this.processEvents({ type: \"agent_end\", messages: [failureMessage] });\n\t}\n\n\tprivate finishRun(): void {\n\t\tthis._state.isStreaming = false;\n\t\tthis._state.streamingMessage = undefined;\n\t\tthis._state.pendingToolCalls = new Set<string>();\n\t\tthis.activeRun?.resolve();\n\t\tthis.activeRun = undefined;\n\t}\n\n\t/**\n\t * Reduce internal state for a loop event, then await listeners.\n\t *\n\t * `agent_end` only means no further loop events will be emitted. The run is\n\t * considered idle later, after all awaited listeners for `agent_end` finish\n\t * and `finishRun()` clears runtime-owned state.\n\t */\n\tprivate async processEvents(event: AgentEvent): Promise<void> {\n\t\tswitch (event.type) {\n\t\t\tcase \"message_start\":\n\t\t\t\tthis._state.streamingMessage = event.message;\n\t\t\t\tbreak;\n\n\t\t\tcase \"message_update\":\n\t\t\t\tthis._state.streamingMessage = event.message;\n\t\t\t\tbreak;\n\n\t\t\tcase \"message_end\":\n\t\t\t\tthis._state.streamingMessage = undefined;\n\t\t\t\tthis._state.messages.push(event.message);\n\t\t\t\tbreak;\n\n\t\t\tcase \"tool_execution_start\": {\n\t\t\t\tconst pendingToolCalls = new Set(this._state.pendingToolCalls);\n\t\t\t\tpendingToolCalls.add(event.toolCallId);\n\t\t\t\tthis._state.pendingToolCalls = pendingToolCalls;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"tool_execution_end\": {\n\t\t\t\tconst pendingToolCalls = new Set(this._state.pendingToolCalls);\n\t\t\t\tpendingToolCalls.delete(event.toolCallId);\n\t\t\t\tthis._state.pendingToolCalls = pendingToolCalls;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"turn_end\":\n\t\t\t\tif (event.message.role === \"assistant\" && event.message.errorMessage) {\n\t\t\t\t\tthis._state.errorMessage = event.message.errorMessage;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase \"agent_end\":\n\t\t\t\tthis._state.streamingMessage = undefined;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tconst signal = this.activeRun?.abortController.signal;\n\t\tif (!signal) {\n\t\t\tthrow new Error(\"Agent listener invoked outside active run\");\n\t\t}\n\t\tfor (const listener of this.listeners) {\n\t\t\tawait listener(event, signal);\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"file":"agent.js","sourceRoot":"","sources":["../src/agent.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAsBpD,SAAS,mBAAmB,CAAC,QAAwB;IACpD,OAAO,QAAQ,CAAC,MAAM,CACrB,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,IAAI,KAAK,WAAW,IAAI,OAAO,CAAC,IAAI,KAAK,YAAY,CACrG,CAAC;AACH,CAAC;AAED,MAAM,WAAW,GAAG;IACnB,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC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C;gBACzC,MAAM;QACR,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC,MAAM,CAAC;QACtD,IAAI,CAAC,MAAM,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC9D,CAAC;QACD,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACvC,MAAM,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QAC/B,CAAC;IACF,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,iBAAiB,CAAC,KAAiB;QACxC,MAAM,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;CACD","sourcesContent":["import type {\n\tImageContent,\n\tMessage,\n\tModel,\n\tSimpleStreamOptions,\n\tTextContent,\n\tThinkingBudgets,\n\tTransport,\n} from \"@earendil-works/pi-ai\";\nimport { runAgentLoop, runAgentLoopContinue } from \"./agent-loop.ts\";\nimport { getDefaultStreamFn } from \"./stream-fn.ts\";\nimport type {\n\tAfterToolCallContext,\n\tAfterToolCallResult,\n\tAgentContext,\n\tAgentEvent,\n\tAgentLoopConfig,\n\tAgentLoopTurnUpdate,\n\tAgentMessage,\n\tAgentState,\n\tAgentTool,\n\tBeforeToolCallContext,\n\tBeforeToolCallResult,\n\tPrepareNextTurnContext,\n\tQueueMode,\n\tShouldStopAfterTurnContext,\n\tStreamFn,\n\tToolExecutionMode,\n} from \"./types.ts\";\n\nexport type { QueueMode } from \"./types.ts\";\n\nfunction defaultConvertToLlm(messages: AgentMessage[]): Message[] {\n\treturn messages.filter(\n\t\t(message) => message.role === \"user\" || message.role === \"assistant\" || message.role === \"toolResult\",\n\t);\n}\n\nconst EMPTY_USAGE = {\n\tinput: 0,\n\toutput: 0,\n\tcacheRead: 0,\n\tcacheWrite: 0,\n\ttotalTokens: 0,\n\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0 },\n};\n\nconst DEFAULT_MODEL = {\n\tid: \"unknown\",\n\tname: \"unknown\",\n\tapi: \"unknown\",\n\tprovider: \"unknown\",\n\tbaseUrl: \"\",\n\treasoning: false,\n\tinput: [],\n\tcost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },\n\tcontextWindow: 0,\n\tmaxTokens: 0,\n} satisfies Model<any>;\n\ntype MutableAgentState = Omit<AgentState, \"isStreaming\" | \"streamingMessage\" | \"pendingToolCalls\" | \"errorMessage\"> & {\n\tisStreaming: boolean;\n\tstreamingMessage?: AgentMessage;\n\tpendingToolCalls: Set<string>;\n\terrorMessage?: string;\n};\n\nfunction createMutableAgentState(\n\tinitialState?: Partial<Omit<AgentState, \"pendingToolCalls\" | \"isStreaming\" | \"streamingMessage\" | \"errorMessage\">>,\n): MutableAgentState {\n\tlet tools = initialState?.tools?.slice() ?? [];\n\tlet messages = initialState?.messages?.slice() ?? [];\n\n\treturn {\n\t\tsystemPrompt: initialState?.systemPrompt ?? \"\",\n\t\tmodel: initialState?.model ?? DEFAULT_MODEL,\n\t\tthinkingLevel: initialState?.thinkingLevel ?? \"off\",\n\t\tget tools() {\n\t\t\treturn tools;\n\t\t},\n\t\tset tools(nextTools: AgentTool<any>[]) {\n\t\t\ttools = nextTools.slice();\n\t\t},\n\t\tget messages() {\n\t\t\treturn messages;\n\t\t},\n\t\tset messages(nextMessages: AgentMessage[]) {\n\t\t\tmessages = nextMessages.slice();\n\t\t},\n\t\tisStreaming: false,\n\t\tstreamingMessage: undefined,\n\t\tpendingToolCalls: new Set<string>(),\n\t\terrorMessage: undefined,\n\t};\n}\n\n/** Options for constructing an {@link Agent}. */\nexport interface AgentOptions {\n\tinitialState?: Partial<Omit<AgentState, \"pendingToolCalls\" | \"isStreaming\" | \"streamingMessage\" | \"errorMessage\">>;\n\tconvertToLlm?: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;\n\ttransformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;\n\tstreamFn: StreamFn;\n\tgetApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;\n\tonPayload?: SimpleStreamOptions[\"onPayload\"];\n\tonResponse?: SimpleStreamOptions[\"onResponse\"];\n\tbeforeToolCall?: (context: BeforeToolCallContext, signal?: AbortSignal) => Promise<BeforeToolCallResult | undefined>;\n\tafterToolCall?: (context: AfterToolCallContext, signal?: AbortSignal) => Promise<AfterToolCallResult | undefined>;\n\tshouldStopAfterTurn?: (context: ShouldStopAfterTurnContext, signal?: AbortSignal) => boolean | Promise<boolean>;\n\tprepareNextTurn?: (\n\t\tsignal?: AbortSignal,\n\t) => Promise<AgentLoopTurnUpdate | undefined> | AgentLoopTurnUpdate | undefined;\n\tprepareNextTurnWithContext?: (\n\t\tcontext: PrepareNextTurnContext,\n\t\tsignal?: AbortSignal,\n\t) => Promise<AgentLoopTurnUpdate | undefined> | AgentLoopTurnUpdate | undefined;\n\tsteeringMode?: QueueMode;\n\tfollowUpMode?: QueueMode;\n\tsessionId?: string;\n\tthinkingBudgets?: ThinkingBudgets;\n\ttransport?: Transport;\n\ttimeoutMs?: number;\n\tstreamStartTimeoutMs?: number;\n\tmaxRetryDelayMs?: number;\n\ttoolExecution?: ToolExecutionMode;\n\tremovedToolHints?: Record<string, string>;\n\tresolveUnknownToolCall?: AgentLoopConfig[\"resolveUnknownToolCall\"];\n\tabortServerSideFallback?: boolean;\n\t/** Cursor exec-channel tool handlers; see {@link AgentLoopConfig.cursorExecHandlers}. */\n\tcursorExecHandlers?: AgentLoopConfig[\"cursorExecHandlers\"];\n}\n\nexport interface AgentContinuationOptions {\n\t/** Keep queued steering and follow-up input out of the continuation's first provider request only. */\n\tdeferQueuedMessages?: boolean;\n\t/** Override the provider stream idle timeout for the continuation's first provider request only. */\n\ttimeoutMs?: number;\n\t/** Override the provider stream-start timeout for the continuation's first provider request only. */\n\tstreamStartTimeoutMs?: number;\n}\n\nclass PendingMessageQueue {\n\tprivate messages: AgentMessage[] = [];\n\tprivate clearGeneration = 0;\n\tpublic mode: QueueMode;\n\n\tconstructor(mode: QueueMode) {\n\t\tthis.mode = mode;\n\t}\n\n\tenqueue(message: AgentMessage): void {\n\t\tthis.messages.push(message);\n\t}\n\n\thasItems(): boolean {\n\t\treturn this.messages.length > 0;\n\t}\n\n\tgetClearGeneration(): number {\n\t\treturn this.clearGeneration;\n\t}\n\n\tdrain(): AgentMessage[] {\n\t\tif (this.mode === \"all\") {\n\t\t\tconst drained = this.messages.slice();\n\t\t\tthis.messages = [];\n\t\t\treturn drained;\n\t\t}\n\n\t\tconst first = this.messages[0];\n\t\tif (!first) {\n\t\t\treturn [];\n\t\t}\n\t\tthis.messages = this.messages.slice(1);\n\t\treturn [first];\n\t}\n\n\tprepend(messages: AgentMessage[]): void {\n\t\tthis.messages = [...messages, ...this.messages];\n\t}\n\n\tclear(): void {\n\t\tthis.messages = [];\n\t\tthis.clearGeneration++;\n\t}\n}\n\ntype ActiveRun = {\n\tpromise: Promise<void>;\n\tresolve: () => void;\n\tabortController: AbortController;\n\tsuppressQueuedMessageDrain: boolean;\n};\n\n/**\n * Stateful wrapper around the low-level agent loop.\n *\n * `Agent` owns the current transcript, emits lifecycle events, executes tools,\n * and exposes queueing APIs for steering and follow-up messages.\n */\nexport class Agent {\n\tprivate _state: MutableAgentState;\n\tprivate readonly listeners = new Set<(event: AgentEvent, signal: AbortSignal) => Promise<void> | void>();\n\tprivate readonly steeringQueue: PendingMessageQueue;\n\tprivate readonly followUpQueue: PendingMessageQueue;\n\n\tpublic convertToLlm: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;\n\tpublic transformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;\n\tpublic streamFunction: StreamFn;\n\tpublic getApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;\n\tpublic onPayload?: SimpleStreamOptions[\"onPayload\"];\n\tpublic onResponse?: SimpleStreamOptions[\"onResponse\"];\n\tpublic beforeToolCall?: (\n\t\tcontext: BeforeToolCallContext,\n\t\tsignal?: AbortSignal,\n\t) => Promise<BeforeToolCallResult | undefined>;\n\tpublic afterToolCall?: (\n\t\tcontext: AfterToolCallContext,\n\t\tsignal?: AbortSignal,\n\t) => Promise<AfterToolCallResult | undefined>;\n\tpublic shouldStopAfterTurn?: (\n\t\tcontext: ShouldStopAfterTurnContext,\n\t\tsignal?: AbortSignal,\n\t) => boolean | Promise<boolean>;\n\tpublic prepareNextTurn?: (\n\t\tsignal?: AbortSignal,\n\t) => Promise<AgentLoopTurnUpdate | undefined> | AgentLoopTurnUpdate | undefined;\n\tpublic prepareNextTurnWithContext?: (\n\t\tcontext: PrepareNextTurnContext,\n\t\tsignal?: AbortSignal,\n\t) => Promise<AgentLoopTurnUpdate | undefined> | AgentLoopTurnUpdate | undefined;\n\tprivate activeRun?: ActiveRun;\n\t/** Session identifier forwarded to providers for cache-aware backends. */\n\tpublic sessionId?: string;\n\t/** Optional per-level thinking token budgets forwarded to the stream function. */\n\tpublic thinkingBudgets?: ThinkingBudgets;\n\t/** Preferred transport forwarded to the stream function. */\n\tpublic transport: Transport;\n\tpublic timeoutMs?: number;\n\t/** Optional bound on the wait for the first provider stream event. */\n\tpublic streamStartTimeoutMs?: number;\n\t/** Optional cap for provider-requested retry delays. */\n\tpublic maxRetryDelayMs?: number;\n\t/** Tool execution strategy for assistant messages that contain multiple tool calls. */\n\tpublic toolExecution: ToolExecutionMode;\n\t/** Migration guidance returned when a removed tool name is called. */\n\tpublic removedToolHints: Record<string, string>;\n\t/** Optional call-time resolver for tools absent from the request context. */\n\tpublic resolveUnknownToolCall?: AgentLoopConfig[\"resolveUnknownToolCall\"];\n\t/** Forwarded to the stream function; providers without server-side fallback ignore it. */\n\tpublic abortServerSideFallback?: boolean;\n\t/** Cursor exec-channel tool handlers; see {@link AgentLoopConfig.cursorExecHandlers}. */\n\tpublic cursorExecHandlers?: AgentLoopConfig[\"cursorExecHandlers\"];\n\n\tconstructor(options: AgentOptions) {\n\t\t// Older compiled consumers may omit options or streamFn even though the current API requires them.\n\t\tconst runtimeOptions: Partial<AgentOptions> = options ?? {};\n\t\tthis._state = createMutableAgentState(runtimeOptions.initialState);\n\t\tthis.convertToLlm = runtimeOptions.convertToLlm ?? defaultConvertToLlm;\n\t\tthis.transformContext = runtimeOptions.transformContext;\n\t\tthis.streamFunction = runtimeOptions.streamFn ?? getDefaultStreamFn();\n\t\tthis.getApiKey = runtimeOptions.getApiKey;\n\t\tthis.onPayload = runtimeOptions.onPayload;\n\t\tthis.onResponse = runtimeOptions.onResponse;\n\t\tthis.beforeToolCall = runtimeOptions.beforeToolCall;\n\t\tthis.afterToolCall = runtimeOptions.afterToolCall;\n\t\tthis.shouldStopAfterTurn = runtimeOptions.shouldStopAfterTurn;\n\t\tthis.prepareNextTurn = runtimeOptions.prepareNextTurn;\n\t\tthis.prepareNextTurnWithContext = runtimeOptions.prepareNextTurnWithContext;\n\t\tthis.steeringQueue = new PendingMessageQueue(runtimeOptions.steeringMode ?? \"one-at-a-time\");\n\t\tthis.followUpQueue = new PendingMessageQueue(runtimeOptions.followUpMode ?? \"one-at-a-time\");\n\t\tthis.sessionId = runtimeOptions.sessionId;\n\t\tthis.thinkingBudgets = runtimeOptions.thinkingBudgets;\n\t\tthis.transport = runtimeOptions.transport ?? \"auto\";\n\t\tthis.timeoutMs = runtimeOptions.timeoutMs;\n\t\tthis.streamStartTimeoutMs = runtimeOptions.streamStartTimeoutMs;\n\t\tthis.maxRetryDelayMs = runtimeOptions.maxRetryDelayMs;\n\t\tthis.toolExecution = runtimeOptions.toolExecution ?? \"parallel\";\n\t\tthis.removedToolHints = runtimeOptions.removedToolHints ?? {};\n\t\tthis.resolveUnknownToolCall = runtimeOptions.resolveUnknownToolCall;\n\t\tthis.abortServerSideFallback = runtimeOptions.abortServerSideFallback;\n\t\tthis.cursorExecHandlers = runtimeOptions.cursorExecHandlers;\n\t}\n\n\t/**\n\t * Subscribe to agent lifecycle events.\n\t *\n\t * Listener promises are awaited in subscription order and are included in\n\t * the current run's settlement. Listeners also receive the active abort\n\t * signal for the current run.\n\t *\n\t * `agent_end` is the final emitted event for a run, but the agent does not\n\t * become idle until all awaited listeners for that event have settled.\n\t */\n\tsubscribe(listener: (event: AgentEvent, signal: AbortSignal) => Promise<void> | void): () => void {\n\t\tthis.listeners.add(listener);\n\t\treturn () => this.listeners.delete(listener);\n\t}\n\n\t/**\n\t * Current agent state.\n\t *\n\t * Assigning `state.tools` or `state.messages` copies the provided top-level array.\n\t */\n\tget state(): AgentState {\n\t\treturn this._state;\n\t}\n\n\t/** Controls how queued steering messages are drained. */\n\tset steeringMode(mode: QueueMode) {\n\t\tthis.steeringQueue.mode = mode;\n\t}\n\n\tget steeringMode(): QueueMode {\n\t\treturn this.steeringQueue.mode;\n\t}\n\n\t/** Controls how queued follow-up messages are drained. */\n\tset followUpMode(mode: QueueMode) {\n\t\tthis.followUpQueue.mode = mode;\n\t}\n\n\tget followUpMode(): QueueMode {\n\t\treturn this.followUpQueue.mode;\n\t}\n\n\t/** Queue a message to be injected after the current assistant turn finishes. */\n\tsteer(message: AgentMessage): void {\n\t\tthis.steeringQueue.enqueue(message);\n\t}\n\n\t/** Queue a message to run only after the agent would otherwise stop. */\n\tfollowUp(message: AgentMessage): void {\n\t\tthis.followUpQueue.enqueue(message);\n\t}\n\n\t/** Remove all queued steering messages. */\n\tclearSteeringQueue(): void {\n\t\tthis.steeringQueue.clear();\n\t}\n\n\t/** Remove all queued follow-up messages. */\n\tclearFollowUpQueue(): void {\n\t\tthis.followUpQueue.clear();\n\t}\n\n\t/** Remove all queued steering and follow-up messages. */\n\tclearAllQueues(): void {\n\t\tthis.clearSteeringQueue();\n\t\tthis.clearFollowUpQueue();\n\t}\n\n\t/** Returns true when either queue still contains pending messages. */\n\thasQueuedMessages(): boolean {\n\t\treturn this.steeringQueue.hasItems() || this.followUpQueue.hasItems();\n\t}\n\n\t/** Active abort signal for the current run, if any. */\n\tget signal(): AbortSignal | undefined {\n\t\treturn this.activeRun?.abortController.signal;\n\t}\n\n\t/** Abort the current run, if one is active. */\n\tabort(): void {\n\t\tthis.activeRun?.abortController.abort();\n\t}\n\n\t/**\n\t * Keep queued steering and follow-up messages for an external owner after\n\t * this run reaches agent_end, without changing the active abort signal.\n\t * This is ownership suppression for one active run; terminal error/abort\n\t * parking is a separate stop-reason policy enforced by the run lifecycle.\n\t */\n\tsuppressQueuedMessageDrain(): void {\n\t\tif (this.activeRun) {\n\t\t\tthis.activeRun.suppressQueuedMessageDrain = true;\n\t\t}\n\t}\n\n\t/**\n\t * Resolve when the current run and all awaited event listeners have finished.\n\t *\n\t * This resolves after `agent_end` listeners settle.\n\t */\n\twaitForIdle(): Promise<void> {\n\t\treturn this.activeRun?.promise ?? Promise.resolve();\n\t}\n\n\t/** Clear transcript state, runtime state, and queued messages. */\n\treset(): void {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\"Agent is already processing. Wait for completion before resetting.\");\n\t\t}\n\n\t\tthis._state.messages = [];\n\t\tthis._state.isStreaming = false;\n\t\tthis._state.streamingMessage = undefined;\n\t\tthis._state.pendingToolCalls = new Set<string>();\n\t\tthis._state.errorMessage = undefined;\n\t\tthis.clearFollowUpQueue();\n\t\tthis.clearSteeringQueue();\n\t}\n\n\t/** Start a new prompt from text, a single message, or a batch of messages. */\n\tasync prompt(message: AgentMessage | AgentMessage[]): Promise<void>;\n\tasync prompt(input: string, images?: ImageContent[]): Promise<void>;\n\tasync prompt(input: string | AgentMessage | AgentMessage[], images?: ImageContent[]): Promise<void> {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Agent is already processing a prompt. Use steer() or followUp() to queue messages, or wait for completion.\",\n\t\t\t);\n\t\t}\n\t\tconst messages = this.normalizePromptInput(input, images);\n\t\tawait this.runPromptMessages(messages);\n\t}\n\n\t/**\n\t * Continue by delivering queued input first when a compaction leaves custom context at the tail.\n\t * Queue-first recovery takes precedence over `deferQueuedMessages`: the selected queued message is\n\t * the continuation input, while timeout overrides still apply to its first provider request.\n\t */\n\tasync continueWithQueuedMessages(options: AgentContinuationOptions = {}): Promise<void> {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\"Agent is already processing. Wait for completion before continuing.\");\n\t\t}\n\n\t\tif (this._state.messages[this._state.messages.length - 1]?.role === \"assistant\") {\n\t\t\tawait this.continue(options);\n\t\t\treturn;\n\t\t}\n\n\t\tconst queuedSteering = this.steeringQueue.drain();\n\t\tif (queuedSteering.length > 0) {\n\t\t\tawait this.runPromptMessages(queuedSteering, {\n\t\t\t\tskipInitialSteeringPoll: true,\n\t\t\t\tinitialRequestTimeoutMs: options.timeoutMs,\n\t\t\t\tinitialRequestStreamStartTimeoutMs: options.streamStartTimeoutMs,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tconst queuedFollowUps = this.followUpQueue.drain();\n\t\tif (queuedFollowUps.length > 0) {\n\t\t\tawait this.runPromptMessages(queuedFollowUps, {\n\t\t\t\tinitialRequestTimeoutMs: options.timeoutMs,\n\t\t\t\tinitialRequestStreamStartTimeoutMs: options.streamStartTimeoutMs,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tawait this.continue(options);\n\t}\n\n\t/**\n\t * Continue from the current transcript. The last message must be a user or tool-result message.\n\t * Queue deferral and timeout overrides apply only to the first provider request; later requests in\n\t * the same run and later runs use the configured Agent defaults.\n\t */\n\tasync continue(options: AgentContinuationOptions = {}): Promise<void> {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\"Agent is already processing. Wait for completion before continuing.\");\n\t\t}\n\n\t\tconst lastMessage = this._state.messages[this._state.messages.length - 1];\n\t\tif (!lastMessage) {\n\t\t\tthrow new Error(\"No messages to continue from\");\n\t\t}\n\n\t\tif (lastMessage.role === \"assistant\") {\n\t\t\tconst queuedSteering = this.steeringQueue.drain();\n\t\t\tif (queuedSteering.length > 0) {\n\t\t\t\tawait this.runPromptMessages(queuedSteering, {\n\t\t\t\t\tskipInitialSteeringPoll: true,\n\t\t\t\t\tinitialRequestTimeoutMs: options.timeoutMs,\n\t\t\t\t\tinitialRequestStreamStartTimeoutMs: options.streamStartTimeoutMs,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst queuedFollowUps = this.followUpQueue.drain();\n\t\t\tif (queuedFollowUps.length > 0) {\n\t\t\t\tawait this.runPromptMessages(queuedFollowUps, {\n\t\t\t\t\tinitialRequestTimeoutMs: options.timeoutMs,\n\t\t\t\t\tinitialRequestStreamStartTimeoutMs: options.streamStartTimeoutMs,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthrow new Error(\"Cannot continue from message role: assistant\");\n\t\t}\n\n\t\tawait this.runContinuation(options);\n\t}\n\n\tprivate normalizePromptInput(\n\t\tinput: string | AgentMessage | AgentMessage[],\n\t\timages?: ImageContent[],\n\t): AgentMessage[] {\n\t\tif (Array.isArray(input)) {\n\t\t\treturn input;\n\t\t}\n\n\t\tif (typeof input !== \"string\") {\n\t\t\treturn [input];\n\t\t}\n\n\t\tconst content: Array<TextContent | ImageContent> = [{ type: \"text\", text: input }];\n\t\tif (images && images.length > 0) {\n\t\t\tcontent.push(...images);\n\t\t}\n\t\treturn [{ role: \"user\", content, timestamp: Date.now() }];\n\t}\n\n\tprivate async runPromptMessages(\n\t\tmessages: AgentMessage[],\n\t\toptions: {\n\t\t\tskipInitialSteeringPoll?: boolean;\n\t\t\tinitialRequestTimeoutMs?: number;\n\t\t\tinitialRequestStreamStartTimeoutMs?: number;\n\t\t} = {},\n\t): Promise<void> {\n\t\tawait this.runWithLifecycle(async (signal) => {\n\t\t\tawait runAgentLoop(\n\t\t\t\tmessages,\n\t\t\t\tthis.createContextSnapshot(),\n\t\t\t\tthis.createLoopConfig(options),\n\t\t\t\t(event) => this.processEvents(event),\n\t\t\t\tsignal,\n\t\t\t\tthis.streamFunction,\n\t\t\t);\n\t\t});\n\t}\n\n\tprivate async runContinuation(options: AgentContinuationOptions = {}): Promise<void> {\n\t\tawait this.runWithLifecycle(async (signal) => {\n\t\t\tawait runAgentLoopContinue(\n\t\t\t\tthis.createContextSnapshot(),\n\t\t\t\tthis.createLoopConfig({\n\t\t\t\t\tskipInitialSteeringPoll: options.deferQueuedMessages,\n\t\t\t\t\tinitialRequestTimeoutMs: options.timeoutMs,\n\t\t\t\t\tinitialRequestStreamStartTimeoutMs: options.streamStartTimeoutMs,\n\t\t\t\t}),\n\t\t\t\t(event) => this.processEvents(event),\n\t\t\t\tsignal,\n\t\t\t\tthis.streamFunction,\n\t\t\t);\n\t\t});\n\t}\n\n\tprivate createContextSnapshot(): AgentContext {\n\t\treturn {\n\t\t\tsystemPrompt: this._state.systemPrompt,\n\t\t\tmessages: this._state.messages.slice(),\n\t\t\ttools: this._state.tools.slice(),\n\t\t};\n\t}\n\n\tprivate createLoopConfig(\n\t\toptions: {\n\t\t\tskipInitialSteeringPoll?: boolean;\n\t\t\tinitialRequestTimeoutMs?: number;\n\t\t\tinitialRequestStreamStartTimeoutMs?: number;\n\t\t} = {},\n\t): AgentLoopConfig {\n\t\tlet skipInitialSteeringPoll = options.skipInitialSteeringPoll === true;\n\t\tlet steeringQueueGeneration = this.steeringQueue.getClearGeneration();\n\t\tlet followUpQueueGeneration = this.followUpQueue.getClearGeneration();\n\t\tconst shouldStopAfterTurn = this.shouldStopAfterTurn;\n\t\treturn {\n\t\t\tmodel: this._state.model,\n\t\t\treasoning: this._state.thinkingLevel === \"off\" ? undefined : this._state.thinkingLevel,\n\t\t\tsessionId: this.sessionId,\n\t\t\tonPayload: this.onPayload,\n\t\t\tonResponse: this.onResponse,\n\t\t\ttransport: this.transport,\n\t\t\tthinkingBudgets: this.thinkingBudgets,\n\t\t\ttimeoutMs: this.timeoutMs,\n\t\t\tstreamStartTimeoutMs: this.streamStartTimeoutMs,\n\t\t\tinitialRequestTimeoutMs: options.initialRequestTimeoutMs,\n\t\t\tinitialRequestStreamStartTimeoutMs: options.initialRequestStreamStartTimeoutMs,\n\t\t\tmaxRetryDelayMs: this.maxRetryDelayMs,\n\t\t\tabortServerSideFallback: this.abortServerSideFallback,\n\t\t\tcursorExecHandlers: this.cursorExecHandlers,\n\t\t\ttoolExecution: this.toolExecution,\n\t\t\tremovedToolHints: this.removedToolHints,\n\t\t\tresolveUnknownToolCall: this.resolveUnknownToolCall,\n\t\t\tbeforeToolCall: this.beforeToolCall,\n\t\t\tafterToolCall: this.afterToolCall,\n\t\t\tshouldStopAfterTurn: shouldStopAfterTurn\n\t\t\t\t? async (context) => await shouldStopAfterTurn(context, this.signal)\n\t\t\t\t: undefined,\n\t\t\tprepareNextTurn:\n\t\t\t\tthis.prepareNextTurnWithContext || this.prepareNextTurn\n\t\t\t\t\t? async (context) => {\n\t\t\t\t\t\t\tif (this.prepareNextTurnWithContext) {\n\t\t\t\t\t\t\t\treturn await this.prepareNextTurnWithContext(context, this.signal);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn await this.prepareNextTurn?.(this.signal);\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t\tconvertToLlm: this.convertToLlm,\n\t\t\ttransformContext: this.transformContext,\n\t\t\tgetApiKey: this.getApiKey,\n\t\t\tgetSteeringMessages: async () => {\n\t\t\t\tif (skipInitialSteeringPoll) {\n\t\t\t\t\tskipInitialSteeringPoll = false;\n\t\t\t\t\treturn [];\n\t\t\t\t}\n\t\t\t\tsteeringQueueGeneration = this.steeringQueue.getClearGeneration();\n\t\t\t\treturn this.steeringQueue.drain();\n\t\t\t},\n\t\t\tgetFollowUpMessages: async () => {\n\t\t\t\tfollowUpQueueGeneration = this.followUpQueue.getClearGeneration();\n\t\t\t\treturn this.followUpQueue.drain();\n\t\t\t},\n\t\t\trestorePendingMessages: (queue, messages) => {\n\t\t\t\tif (queue === \"steering\") {\n\t\t\t\t\tif (this.steeringQueue.getClearGeneration() !== steeringQueueGeneration) return;\n\t\t\t\t\tthis.steeringQueue.prepend(messages);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (this.followUpQueue.getClearGeneration() !== followUpQueueGeneration) return;\n\t\t\t\tthis.followUpQueue.prepend(messages);\n\t\t\t},\n\t\t};\n\t}\n\n\tprivate async runWithLifecycle(executor: (signal: AbortSignal) => Promise<void>): Promise<void> {\n\t\tif (this.activeRun) {\n\t\t\tthrow new Error(\"Agent is already processing.\");\n\t\t}\n\n\t\tconst abortController = new AbortController();\n\t\tlet resolvePromise = () => {};\n\t\tconst promise = new Promise<void>((resolve) => {\n\t\t\tresolvePromise = resolve;\n\t\t});\n\t\tthis.activeRun = { promise, resolve: resolvePromise, abortController, suppressQueuedMessageDrain: false };\n\n\t\tthis._state.isStreaming = true;\n\t\tthis._state.streamingMessage = undefined;\n\t\tthis._state.errorMessage = undefined;\n\n\t\ttry {\n\t\t\tawait executor(abortController.signal);\n\t\t\t// A provider-returned terminal error/abort has no safe implicit owner for\n\t\t\t// queued work. Park it until an external retry/compaction owner continues,\n\t\t\t// or until a later admitted prompt drains it through the normal queue poll.\n\t\t\twhile (\n\t\t\t\t!abortController.signal.aborted &&\n\t\t\t\t!this.activeRun?.suppressQueuedMessageDrain &&\n\t\t\t\tthis.canDrainQueuedMessagesAfterRun() &&\n\t\t\t\tthis.hasQueuedMessages()\n\t\t\t) {\n\t\t\t\tawait this.runQueuedMessagesAfterAgentEnd(abortController.signal);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tawait this.handleRunFailure(error, abortController.signal.aborted);\n\t\t} finally {\n\t\t\tthis.finishRun();\n\t\t}\n\t}\n\n\tprivate canDrainQueuedMessagesAfterRun(): boolean {\n\t\tconst lastMessage = this._state.messages[this._state.messages.length - 1];\n\t\treturn (\n\t\t\tlastMessage?.role !== \"assistant\" ||\n\t\t\t(lastMessage.stopReason !== \"error\" && lastMessage.stopReason !== \"aborted\")\n\t\t);\n\t}\n\n\tprivate async runQueuedMessagesAfterAgentEnd(signal: AbortSignal): Promise<void> {\n\t\tconst queuedSteering = this.steeringQueue.drain();\n\t\tif (queuedSteering.length > 0) {\n\t\t\tawait runAgentLoop(\n\t\t\t\tqueuedSteering,\n\t\t\t\tthis.createContextSnapshot(),\n\t\t\t\tthis.createLoopConfig({ skipInitialSteeringPoll: true }),\n\t\t\t\t(event) => this.processEvents(event),\n\t\t\t\tsignal,\n\t\t\t\tthis.streamFunction,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst queuedFollowUps = this.followUpQueue.drain();\n\t\tif (queuedFollowUps.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tawait runAgentLoop(\n\t\t\tqueuedFollowUps,\n\t\t\tthis.createContextSnapshot(),\n\t\t\tthis.createLoopConfig(),\n\t\t\t(event) => this.processEvents(event),\n\t\t\tsignal,\n\t\t\tthis.streamFunction,\n\t\t);\n\t}\n\n\tprivate async handleRunFailure(error: unknown, aborted: boolean): Promise<void> {\n\t\tconst failureMessage = {\n\t\t\trole: \"assistant\",\n\t\t\tcontent: [{ type: \"text\", text: \"\" }],\n\t\t\tapi: this._state.model.api,\n\t\t\tprovider: this._state.model.provider,\n\t\t\tmodel: this._state.model.id,\n\t\t\tusage: EMPTY_USAGE,\n\t\t\tstopReason: aborted ? \"aborted\" : \"error\",\n\t\t\terrorMessage: error instanceof Error ? error.message : String(error),\n\t\t\ttimestamp: Date.now(),\n\t\t} satisfies AgentMessage;\n\t\tawait this.processEvents({ type: \"message_start\", message: failureMessage });\n\t\tawait this.processEvents({ type: \"message_end\", message: failureMessage });\n\t\tawait this.processEvents({ type: \"turn_end\", message: failureMessage, toolResults: [] });\n\t\tawait this.processEvents({ type: \"agent_end\", messages: [failureMessage] });\n\t}\n\n\tprivate finishRun(): void {\n\t\tthis._state.isStreaming = false;\n\t\tthis._state.streamingMessage = undefined;\n\t\tthis._state.pendingToolCalls = new Set<string>();\n\t\tthis.activeRun?.resolve();\n\t\tthis.activeRun = undefined;\n\t}\n\n\t/**\n\t * Reduce internal state for a loop event, then await listeners.\n\t *\n\t * `agent_end` only means no further loop events will be emitted. The run is\n\t * considered idle later, after all awaited listeners for `agent_end` finish\n\t * and `finishRun()` clears runtime-owned state.\n\t */\n\tprivate async processEvents(event: AgentEvent): Promise<void> {\n\t\tswitch (event.type) {\n\t\t\tcase \"message_start\":\n\t\t\t\tthis._state.streamingMessage = event.message;\n\t\t\t\tbreak;\n\n\t\t\tcase \"message_update\":\n\t\t\t\tthis._state.streamingMessage = event.message;\n\t\t\t\tbreak;\n\n\t\t\tcase \"message_end\":\n\t\t\t\tthis._state.streamingMessage = undefined;\n\t\t\t\tthis._state.messages.push(event.message);\n\t\t\t\tbreak;\n\n\t\t\tcase \"tool_execution_start\": {\n\t\t\t\tconst pendingToolCalls = new Set(this._state.pendingToolCalls);\n\t\t\t\tpendingToolCalls.add(event.toolCallId);\n\t\t\t\tthis._state.pendingToolCalls = pendingToolCalls;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"tool_execution_end\": {\n\t\t\t\tconst pendingToolCalls = new Set(this._state.pendingToolCalls);\n\t\t\t\tpendingToolCalls.delete(event.toolCallId);\n\t\t\t\tthis._state.pendingToolCalls = pendingToolCalls;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"turn_end\":\n\t\t\t\tif (event.message.role === \"assistant\" && event.message.errorMessage) {\n\t\t\t\t\tthis._state.errorMessage = event.message.errorMessage;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase \"agent_end\":\n\t\t\t\tthis._state.streamingMessage = undefined;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tconst signal = this.activeRun?.abortController.signal;\n\t\tif (!signal) {\n\t\t\tthrow new Error(\"Agent listener invoked outside active run\");\n\t\t}\n\t\tfor (const listener of this.listeners) {\n\t\t\tawait listener(event, signal);\n\t\t}\n\t}\n\n\t/**\n\t * Emit a host-generated event through the normal listener pipeline.\n\t *\n\t * Used by the Cursor exec bridge: bridge-run tools execute inside the\n\t * provider stream, outside the loop's executor, so their\n\t * `tool_execution_start`/`tool_execution_end` lifecycle must be injected\n\t * here or the live tool card for a synthesized call never resolves.\n\t * Only valid during an active run (bridge executions always are).\n\t */\n\tasync emitExternalEvent(event: AgentEvent): Promise<void> {\n\t\tawait this.processEvents(event);\n\t}\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { Api, AssistantMessage, AssistantMessageEvent, AssistantMessageEventStream, Context, ImageContent, Message, Model, SimpleStreamOptions, TextContent, Tool, ToolResultMessage, Usage } from "@earendil-works/pi-ai";
1
+ import type { Api, AssistantMessage, AssistantMessageEvent, AssistantMessageEventStream, Context, CursorExecHandlers, ImageContent, Message, Model, SimpleStreamOptions, TextContent, Tool, ToolResultMessage, Usage } from "@earendil-works/pi-ai";
2
2
  import type { Static, TSchema } from "typebox";
3
3
  /**
4
4
  * Stream function used by the agent loop. `Models.streamSimple` satisfies
@@ -125,6 +125,17 @@ export interface PrepareNextTurnContext extends ShouldStopAfterTurnContext {
125
125
  }
126
126
  export interface AgentLoopConfig extends SimpleStreamOptions {
127
127
  model: Model<any>;
128
+ /**
129
+ * Cursor exec-channel tool handlers (cursor-agent models only).
130
+ *
131
+ * Cursor's server-driven protocol executes tools MID-STREAM: the server
132
+ * blocks on an in-band reply, so the provider runs these handlers while
133
+ * the Run stream is open, synthesizes already-resolved `toolCall` blocks
134
+ * (marked `kCursorExecResolved`, which this loop skips), and buffers each
135
+ * paired `ToolResultMessage` for emission right after the assistant
136
+ * message. Other providers ignore this field.
137
+ */
138
+ cursorExecHandlers?: CursorExecHandlers;
128
139
  /**
129
140
  * Maximum time in milliseconds to wait for the FIRST provider stream event.
130
141
  * Providers emit their first event only once the HTTP response begins, so a
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,GAAG,EACH,gBAAgB,EAChB,qBAAqB,EACrB,2BAA2B,EAC3B,OAAO,EACP,YAAY,EACZ,OAAO,EACP,KAAK,EACL,mBAAmB,EACnB,WAAW,EACX,IAAI,EACJ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AO,EAAE,YAAY,CAAA;CAAE,GAE9C;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,CAAA;CAAE,GACjF;IAAE,IAAI,EAAE,uBAAuB,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,GAAG,CAAC;IAAC,aAAa,EAAE,GAAG,CAAA;CAAE,GACtG;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n\tApi,\n\tAssistantMessage,\n\tAssistantMessageEvent,\n\tAssistantMessageEventStream,\n\tContext,\n\tImageContent,\n\tMessage,\n\tModel,\n\tSimpleStreamOptions,\n\tTextContent,\n\tTool,\n\tToolResultMessage,\n\tUsage,\n} from \"@earendil-works/pi-ai\";\nimport type { Static, TSchema } from \"typebox\";\n\n/**\n * Stream function used by the agent loop. `Models.streamSimple` satisfies\n * this shape.\n *\n * Contract:\n * - Must not throw or return a rejected promise for request/model/runtime failures.\n * - Must return an AssistantMessageEventStream.\n * - Failures must be encoded in the returned stream via protocol events and a\n * final AssistantMessage with stopReason \"error\" or \"aborted\" and errorMessage.\n */\nexport type StreamFn = (\n\tmodel: Model<Api>,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n) => AssistantMessageEventStream | Promise<AssistantMessageEventStream>;\n\n/**\n * Configuration for how tool calls from a single assistant message are executed.\n *\n * - \"sequential\": each tool call is prepared, executed, and finalized before the next one starts.\n * - \"parallel\": tool calls are prepared sequentially, then scheduled in concurrent waves.\n * Tools with `executionMode: \"sequential\"` run as exclusive barriers; parallel tools before\n * or after the barrier can still execute concurrently with each other.\n * `tool_execution_end` is emitted in tool completion order after each tool is finalized,\n * while tool-result message artifacts are emitted later in assistant source order.\n */\nexport type ToolExecutionMode = \"sequential\" | \"parallel\";\n\n/**\n * Controls how many queued user messages are injected when the agent loop reaches a queue drain point.\n *\n * - \"all\": drain and inject every queued message at that point.\n * - \"one-at-a-time\": drain and inject only the oldest queued message, leaving the rest queued for later drain points.\n */\nexport type QueueMode = \"all\" | \"one-at-a-time\";\n\n/** A single tool call content block emitted by an assistant message. */\nexport type AgentToolCall = Extract<AssistantMessage[\"content\"][number], { type: \"toolCall\" }>;\n\n/**\n * Result returned from `beforeToolCall`.\n *\n * Returning `{ block: true }` prevents the tool from executing. The loop emits an error tool result instead.\n * `reason` becomes the text shown in that error result. If omitted, a default blocked message is used.\n */\nexport interface BeforeToolCallResult {\n\tblock?: boolean;\n\treason?: string;\n\t/**\n\t * Hint that the agent should stop after the current tool batch when this call is blocked.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/**\n * Partial override returned from `afterToolCall`.\n *\n * Merge semantics are field-by-field:\n * - `content`: if provided, replaces the tool result content array in full\n * - `details`: if provided, replaces the tool result details value in full\n * - `isError`: if provided, replaces the tool result error flag\n * - `usage`: if provided, replaces the tool result usage\n * - `terminate`: if provided, replaces the early-termination hint\n *\n * Omitted fields keep the original executed tool result values.\n * There is no deep merge for `content`, `details`, or `usage`.\n */\nexport interface AfterToolCallResult {\n\tcontent?: (TextContent | ImageContent)[];\n\tdetails?: unknown;\n\tisError?: boolean;\n\t/** Usage from the final tool execution itself, if available. Not used for main LLM context accounting. */\n\tusage?: Usage;\n\t/**\n\t * Hint that the agent should stop after the current tool batch.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/** Context passed to `beforeToolCall`. */\nexport interface BeforeToolCallContext {\n\t/** The assistant message that requested the tool call. */\n\tassistantMessage: AssistantMessage;\n\t/** The raw tool call block from `assistantMessage.content`. */\n\ttoolCall: AgentToolCall;\n\t/** Validated tool arguments for the target tool schema. */\n\targs: unknown;\n\t/** Current agent context at the time the tool call is prepared. */\n\tcontext: AgentContext;\n}\n\n/** Context passed to `afterToolCall`. */\nexport interface AfterToolCallContext {\n\t/** The assistant message that requested the tool call. */\n\tassistantMessage: AssistantMessage;\n\t/** The raw tool call block from `assistantMessage.content`. */\n\ttoolCall: AgentToolCall;\n\t/** Validated tool arguments for the target tool schema. */\n\targs: unknown;\n\t/** The executed tool result before any `afterToolCall` overrides are applied. */\n\tresult: AgentToolResult<any>;\n\t/** Whether the executed tool result is currently treated as an error. */\n\tisError: boolean;\n\t/** Current agent context at the time the tool call is finalized. */\n\tcontext: AgentContext;\n}\n\n/** Context passed to `shouldStopAfterTurn`. */\nexport interface ShouldStopAfterTurnContext {\n\t/** The assistant message that completed the turn. */\n\tmessage: AssistantMessage;\n\t/** Tool result messages passed to the preceding `turn_end` event. */\n\ttoolResults: ToolResultMessage[];\n\t/** Current agent context after the turn's assistant message and tool results have been appended. */\n\tcontext: AgentContext;\n\t/** Messages that this loop invocation will return if it exits at this point. Prompt runs include the initial prompt messages; continuation runs do not include pre-existing context messages. */\n\tnewMessages: AgentMessage[];\n}\n\n/** Replacement runtime state used by the agent loop before starting another provider request. */\nexport interface AgentLoopTurnUpdate {\n\t/** Context for the next provider request. */\n\tcontext?: AgentContext;\n\t/** Model for the next provider request. */\n\tmodel?: Model<any>;\n\t/** Thinking level for the next provider request. */\n\tthinkingLevel?: ThinkingLevel;\n\t/** Whether the next provider request should abort a server-selected fallback. */\n\tabortServerSideFallback?: boolean;\n}\n\nexport interface PrepareNextTurnContext extends ShouldStopAfterTurnContext {}\n\nexport interface AgentLoopConfig extends SimpleStreamOptions {\n\tmodel: Model<any>;\n\n\t/**\n\t * Maximum time in milliseconds to wait for the FIRST provider stream event.\n\t * Providers emit their first event only once the HTTP response begins, so a\n\t * dead upstream that accepts the request but never answers is otherwise only\n\t * bounded by `timeoutMs` (the idle timeout, default 5 minutes). After the\n\t * first event arrives, `timeoutMs` governs inter-event idleness as before.\n\t * Unset or non-positive values disable the start bound.\n\t */\n\tstreamStartTimeoutMs?: number;\n\n\t/** Provider/SDK timeout override for only the first request in this loop invocation. */\n\tinitialRequestTimeoutMs?: number;\n\n\t/** Stream-start timeout override for only the first request in this loop invocation. */\n\tinitialRequestStreamStartTimeoutMs?: number;\n\n\t/**\n\t * Converts AgentMessage[] to LLM-compatible Message[] before each LLM call.\n\t *\n\t * Each AgentMessage must be converted to a UserMessage, AssistantMessage, or ToolResultMessage\n\t * that the LLM can understand. AgentMessages that cannot be converted (e.g., UI-only notifications,\n\t * status messages) should be filtered out.\n\t *\n\t * Contract: must not throw or reject. Return a safe fallback value instead.\n\t * Throwing interrupts the low-level agent loop without producing a normal event sequence.\n\t *\n\t * @example\n\t * ```typescript\n\t * convertToLlm: (messages) => messages.flatMap(m => {\n\t * if (m.role === \"custom\") {\n\t * // Convert custom message to user message\n\t * return [{ role: \"user\", content: m.content, timestamp: m.timestamp }];\n\t * }\n\t * if (m.role === \"notification\") {\n\t * // Filter out UI-only messages\n\t * return [];\n\t * }\n\t * // Pass through standard LLM messages\n\t * return [m];\n\t * })\n\t * ```\n\t */\n\tconvertToLlm: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;\n\n\t/**\n\t * Optional transform applied to the context before `convertToLlm`.\n\t *\n\t * Use this for operations that work at the AgentMessage level:\n\t * - Context window management (pruning old messages)\n\t * - Injecting context from external sources\n\t *\n\t * Contract: must not throw or reject. Return the original messages or another\n\t * safe fallback value instead.\n\t *\n\t * @example\n\t * ```typescript\n\t * transformContext: async (messages) => {\n\t * if (estimateTokens(messages) > MAX_TOKENS) {\n\t * return pruneOldMessages(messages);\n\t * }\n\t * return messages;\n\t * }\n\t * ```\n\t */\n\ttransformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;\n\n\t/**\n\t * Resolves an API key dynamically for each LLM call.\n\t *\n\t * Useful for short-lived OAuth tokens (e.g., GitHub Copilot) that may expire\n\t * during long-running tool execution phases.\n\t *\n\t * Contract: must not throw or reject. Return undefined when no key is available.\n\t */\n\tgetApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;\n\n\t/**\n\t * Called after each turn fully completes and `turn_end` has been emitted.\n\t *\n\t * If it returns true, the loop emits `agent_end` and exits before polling steering or follow-up queues,\n\t * without starting another LLM call. The current assistant response and any tool executions finish normally.\n\t *\n\t * Use this to request a graceful stop after the current turn, e.g. before context gets too full.\n\t *\n\t * Contract: must not throw or reject. Throwing interrupts the low-level agent loop without producing a normal event sequence.\n\t */\n\tshouldStopAfterTurn?: (context: ShouldStopAfterTurnContext) => boolean | Promise<boolean>;\n\n\t/**\n\t * Called after `turn_end` and before the loop decides whether another provider request should start.\n\t * Return replacement context/model/thinking state to affect the next turn in this run.\n\t * Return undefined to keep using the current context/config.\n\t */\n\tprepareNextTurn?: (\n\t\tcontext: PrepareNextTurnContext,\n\t) => AgentLoopTurnUpdate | undefined | Promise<AgentLoopTurnUpdate | undefined>;\n\n\t/**\n\t * Returns steering messages to inject into the conversation mid-run.\n\t *\n\t * Called after the current assistant turn finishes executing its tool calls, unless `shouldStopAfterTurn` exits first.\n\t * If messages are returned, they are added to the context before the next LLM call.\n\t * Tool calls from the current assistant message are not skipped.\n\t *\n\t * Use this for \"steering\" the agent while it's working.\n\t *\n\t * Contract: must not throw or reject. Return [] when no steering messages are available.\n\t */\n\tgetSteeringMessages?: () => Promise<AgentMessage[]>;\n\n\t/**\n\t * Returns follow-up messages to process after the agent would otherwise stop.\n\t *\n\t * Called when the agent has no more tool calls and no steering messages.\n\t * If messages are returned, they're added to the context and the agent\n\t * continues with another turn.\n\t *\n\t * Use this for follow-up messages that should wait until the agent finishes.\n\t *\n\t * Contract: must not throw or reject. Return [] when no follow-up messages are available.\n\t */\n\tgetFollowUpMessages?: () => Promise<AgentMessage[]>;\n\n\t/**\n\t * Restores messages previously returned by a queue callback when next-turn preparation cannot continue.\n\t * Restored messages must be placed before messages queued after the drain.\n\t */\n\trestorePendingMessages?: (queue: \"steering\" | \"followUp\", messages: AgentMessage[]) => Promise<void> | void;\n\n\t/**\n\t * Tool execution mode.\n\t * - \"sequential\": execute tool calls one by one\n\t * - \"parallel\": preflight tool calls sequentially, then execute allowed tools in concurrent waves;\n\t * per-tool `executionMode: \"sequential\"` calls act as exclusive barriers,\n\t * emit `tool_execution_end` in tool completion order after each tool is finalized,\n\t * then emit tool-result message artifacts later in assistant source order\n\t *\n\t * Default: \"parallel\"\n\t */\n\ttoolExecution?: ToolExecutionMode;\n\n\t/**\n\t * Optional migration guidance for tool names intentionally removed by an extension.\n\t * The matching hint is appended to the normal unknown-tool error before hooks run.\n\t */\n\tremovedToolHints?: Record<string, string>;\n\n\t/**\n\t * Called when a model names a tool absent from the current context snapshot.\n\t * Return a newly available tool to continue normal validation and execution, or\n\t * undefined to emit the existing unknown-tool result. Hosts may use this to\n\t * activate a registered lazy tool at call time.\n\t */\n\tresolveUnknownToolCall?: (\n\t\ttoolName: string,\n\t\tcontext: AgentContext,\n\t) => AgentTool | undefined | Promise<AgentTool | undefined>;\n\n\t/**\n\t * Called before a tool is executed, after arguments have been validated.\n\t *\n\t * Return `{ block: true }` to prevent execution. The loop emits an error tool result instead.\n\t * A blocked result can also set `terminate: true` to participate in the batch early-termination rule.\n\t * The hook receives the agent abort signal and is responsible for honoring it.\n\t */\n\tbeforeToolCall?: (context: BeforeToolCallContext, signal?: AbortSignal) => Promise<BeforeToolCallResult | undefined>;\n\n\t/**\n\t * Called after a tool finishes executing, before `tool_execution_end` and tool-result message events are emitted.\n\t *\n\t * Return an `AfterToolCallResult` to override parts of the executed tool result:\n\t * - `content` replaces the full content array\n\t * - `details` replaces the full details payload\n\t * - `isError` replaces the error flag\n\t * - `usage` replaces the tool result usage\n\t * - `terminate` replaces the early-termination hint\n\t *\n\t * Any omitted fields keep their original values. No deep merge is performed.\n\t * The hook receives the agent abort signal and is responsible for honoring it.\n\t */\n\tafterToolCall?: (context: AfterToolCallContext, signal?: AbortSignal) => Promise<AfterToolCallResult | undefined>;\n}\n\n/**\n * Thinking/reasoning level for models that support it.\n * Note: \"xhigh\" and \"max\" are only supported by selected model families. Use model\n * thinking-level metadata from @earendil-works/pi-ai to detect support for a concrete model.\n */\nexport type ThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\n/**\n * Extensible interface for custom app messages.\n * Apps can extend via declaration merging:\n *\n * @example\n * ```typescript\n * declare module \"@earendil-works/pi-agent-core\" {\n * interface CustomAgentMessages {\n * artifact: ArtifactMessage;\n * notification: NotificationMessage;\n * }\n * }\n * ```\n */\nexport interface CustomAgentMessages {\n\t// Empty by default - apps extend via declaration merging\n}\n\n/**\n * AgentMessage: Union of LLM messages + custom messages.\n * This abstraction allows apps to add custom message types while maintaining\n * type safety and compatibility with the base LLM messages.\n */\nexport type AgentMessage = Message | CustomAgentMessages[keyof CustomAgentMessages];\n\n/**\n * Public agent state.\n *\n * `tools` and `messages` use accessor properties so implementations can copy\n * assigned arrays before storing them.\n */\nexport interface AgentState {\n\t/** System prompt sent with each model request. */\n\tsystemPrompt: string;\n\t/** Active model used for future turns. */\n\tmodel: Model<any>;\n\t/** Requested reasoning level for future turns. */\n\tthinkingLevel: ThinkingLevel;\n\t/** Available tools. Assigning a new array copies the top-level array. */\n\tset tools(tools: AgentTool<any>[]);\n\tget tools(): AgentTool<any>[];\n\t/** Conversation transcript. Assigning a new array copies the top-level array. */\n\tset messages(messages: AgentMessage[]);\n\tget messages(): AgentMessage[];\n\t/**\n\t * True while the agent is processing a prompt or continuation.\n\t *\n\t * This remains true until awaited `agent_end` listeners settle.\n\t */\n\treadonly isStreaming: boolean;\n\t/** Partial assistant message for the current streamed response, if any. */\n\treadonly streamingMessage?: AgentMessage;\n\t/** Tool call ids currently executing. */\n\treadonly pendingToolCalls: ReadonlySet<string>;\n\t/** Error message from the most recent failed or aborted assistant turn, if any. */\n\treadonly errorMessage?: string;\n}\n\n/** Final or partial result produced by a tool. */\nexport interface AgentToolResult<T> {\n\t/** Text or image content returned to the model. */\n\tcontent: (TextContent | ImageContent)[];\n\t/** Arbitrary structured details for logs or UI rendering. */\n\tdetails: T;\n\t/** Usage from the final tool execution itself, if available. Not used for main LLM context accounting. */\n\tusage?: Usage;\n\t/** Names of tools introduced by this result and available from this transcript point onward. */\n\taddedToolNames?: string[];\n\t/**\n\t * Hint that the agent should stop after the current tool batch.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/**\n * Callback used by tools to stream partial execution updates.\n *\n * The callback is scoped to the current `execute()` invocation. Calls made after\n * the tool promise settles are ignored.\n */\nexport type AgentToolUpdateCallback<T = any> = (partialResult: AgentToolResult<T>) => void;\n\n/** Tool definition used by the agent runtime. */\nexport interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any> extends Tool<TParameters> {\n\t/** Human-readable label for UI display. */\n\tlabel: string;\n\t/**\n\t * Optional compatibility shim for raw tool-call arguments before schema validation.\n\t * Must return an object that matches `TParameters`.\n\t */\n\tprepareArguments?: (args: unknown) => Static<TParameters>;\n\t/** Execute the tool call. Throw on failure instead of encoding errors in `content`. */\n\texecute: (\n\t\ttoolCallId: string,\n\t\tparams: Static<TParameters>,\n\t\tsignal?: AbortSignal,\n\t\tonUpdate?: AgentToolUpdateCallback<TDetails>,\n\t) => Promise<AgentToolResult<TDetails>>;\n\t/**\n\t * Per-tool execution mode override.\n\t * - \"sequential\": this tool acts as an exclusive barrier in parallel batches.\n\t * - \"parallel\": this tool can execute concurrently with other tool calls.\n\t *\n\t * If omitted, the default execution mode applies.\n\t */\n\texecutionMode?: ToolExecutionMode;\n}\n\n/** Context snapshot passed into the low-level agent loop. */\nexport interface AgentContext {\n\t/** System prompt included with the request. */\n\tsystemPrompt: string;\n\t/** Transcript visible to the model. */\n\tmessages: AgentMessage[];\n\t/** Tools available for this run. */\n\ttools?: AgentTool<any>[];\n}\n\n/**\n * Events emitted by the Agent for UI updates.\n *\n * `agent_end` is the last event emitted for a run, but awaited `Agent.subscribe()`\n * listeners for that event are still part of run settlement. The agent becomes\n * idle only after those listeners finish.\n */\nexport type AgentEvent =\n\t// Agent lifecycle\n\t| { type: \"agent_start\" }\n\t| { type: \"agent_end\"; messages: AgentMessage[] }\n\t// Turn lifecycle - a turn is one assistant response + any tool calls/results\n\t| { type: \"turn_start\" }\n\t| { type: \"turn_end\"; message: AgentMessage; toolResults: ToolResultMessage[] }\n\t// Message lifecycle - emitted for user, assistant, and toolResult messages\n\t| { type: \"message_start\"; message: AgentMessage }\n\t// Only emitted for assistant messages during streaming\n\t| { type: \"message_update\"; message: AgentMessage; assistantMessageEvent: AssistantMessageEvent }\n\t| { type: \"message_end\"; message: AgentMessage }\n\t// Tool execution lifecycle\n\t| { type: \"tool_execution_start\"; toolCallId: string; toolName: string; args: any }\n\t| { type: \"tool_execution_update\"; toolCallId: string; toolName: string; args: any; partialResult: any }\n\t| { type: \"tool_execution_end\"; toolCallId: string; toolName: string; result: any; isError: boolean };\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n\tApi,\n\tAssistantMessage,\n\tAssistantMessageEvent,\n\tAssistantMessageEventStream,\n\tContext,\n\tCursorExecHandlers,\n\tImageContent,\n\tMessage,\n\tModel,\n\tSimpleStreamOptions,\n\tTextContent,\n\tTool,\n\tToolResultMessage,\n\tUsage,\n} from \"@earendil-works/pi-ai\";\nimport type { Static, TSchema } from \"typebox\";\n\n/**\n * Stream function used by the agent loop. `Models.streamSimple` satisfies\n * this shape.\n *\n * Contract:\n * - Must not throw or return a rejected promise for request/model/runtime failures.\n * - Must return an AssistantMessageEventStream.\n * - Failures must be encoded in the returned stream via protocol events and a\n * final AssistantMessage with stopReason \"error\" or \"aborted\" and errorMessage.\n */\nexport type StreamFn = (\n\tmodel: Model<Api>,\n\tcontext: Context,\n\toptions?: SimpleStreamOptions,\n) => AssistantMessageEventStream | Promise<AssistantMessageEventStream>;\n\n/**\n * Configuration for how tool calls from a single assistant message are executed.\n *\n * - \"sequential\": each tool call is prepared, executed, and finalized before the next one starts.\n * - \"parallel\": tool calls are prepared sequentially, then scheduled in concurrent waves.\n * Tools with `executionMode: \"sequential\"` run as exclusive barriers; parallel tools before\n * or after the barrier can still execute concurrently with each other.\n * `tool_execution_end` is emitted in tool completion order after each tool is finalized,\n * while tool-result message artifacts are emitted later in assistant source order.\n */\nexport type ToolExecutionMode = \"sequential\" | \"parallel\";\n\n/**\n * Controls how many queued user messages are injected when the agent loop reaches a queue drain point.\n *\n * - \"all\": drain and inject every queued message at that point.\n * - \"one-at-a-time\": drain and inject only the oldest queued message, leaving the rest queued for later drain points.\n */\nexport type QueueMode = \"all\" | \"one-at-a-time\";\n\n/** A single tool call content block emitted by an assistant message. */\nexport type AgentToolCall = Extract<AssistantMessage[\"content\"][number], { type: \"toolCall\" }>;\n\n/**\n * Result returned from `beforeToolCall`.\n *\n * Returning `{ block: true }` prevents the tool from executing. The loop emits an error tool result instead.\n * `reason` becomes the text shown in that error result. If omitted, a default blocked message is used.\n */\nexport interface BeforeToolCallResult {\n\tblock?: boolean;\n\treason?: string;\n\t/**\n\t * Hint that the agent should stop after the current tool batch when this call is blocked.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/**\n * Partial override returned from `afterToolCall`.\n *\n * Merge semantics are field-by-field:\n * - `content`: if provided, replaces the tool result content array in full\n * - `details`: if provided, replaces the tool result details value in full\n * - `isError`: if provided, replaces the tool result error flag\n * - `usage`: if provided, replaces the tool result usage\n * - `terminate`: if provided, replaces the early-termination hint\n *\n * Omitted fields keep the original executed tool result values.\n * There is no deep merge for `content`, `details`, or `usage`.\n */\nexport interface AfterToolCallResult {\n\tcontent?: (TextContent | ImageContent)[];\n\tdetails?: unknown;\n\tisError?: boolean;\n\t/** Usage from the final tool execution itself, if available. Not used for main LLM context accounting. */\n\tusage?: Usage;\n\t/**\n\t * Hint that the agent should stop after the current tool batch.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/** Context passed to `beforeToolCall`. */\nexport interface BeforeToolCallContext {\n\t/** The assistant message that requested the tool call. */\n\tassistantMessage: AssistantMessage;\n\t/** The raw tool call block from `assistantMessage.content`. */\n\ttoolCall: AgentToolCall;\n\t/** Validated tool arguments for the target tool schema. */\n\targs: unknown;\n\t/** Current agent context at the time the tool call is prepared. */\n\tcontext: AgentContext;\n}\n\n/** Context passed to `afterToolCall`. */\nexport interface AfterToolCallContext {\n\t/** The assistant message that requested the tool call. */\n\tassistantMessage: AssistantMessage;\n\t/** The raw tool call block from `assistantMessage.content`. */\n\ttoolCall: AgentToolCall;\n\t/** Validated tool arguments for the target tool schema. */\n\targs: unknown;\n\t/** The executed tool result before any `afterToolCall` overrides are applied. */\n\tresult: AgentToolResult<any>;\n\t/** Whether the executed tool result is currently treated as an error. */\n\tisError: boolean;\n\t/** Current agent context at the time the tool call is finalized. */\n\tcontext: AgentContext;\n}\n\n/** Context passed to `shouldStopAfterTurn`. */\nexport interface ShouldStopAfterTurnContext {\n\t/** The assistant message that completed the turn. */\n\tmessage: AssistantMessage;\n\t/** Tool result messages passed to the preceding `turn_end` event. */\n\ttoolResults: ToolResultMessage[];\n\t/** Current agent context after the turn's assistant message and tool results have been appended. */\n\tcontext: AgentContext;\n\t/** Messages that this loop invocation will return if it exits at this point. Prompt runs include the initial prompt messages; continuation runs do not include pre-existing context messages. */\n\tnewMessages: AgentMessage[];\n}\n\n/** Replacement runtime state used by the agent loop before starting another provider request. */\nexport interface AgentLoopTurnUpdate {\n\t/** Context for the next provider request. */\n\tcontext?: AgentContext;\n\t/** Model for the next provider request. */\n\tmodel?: Model<any>;\n\t/** Thinking level for the next provider request. */\n\tthinkingLevel?: ThinkingLevel;\n\t/** Whether the next provider request should abort a server-selected fallback. */\n\tabortServerSideFallback?: boolean;\n}\n\nexport interface PrepareNextTurnContext extends ShouldStopAfterTurnContext {}\n\nexport interface AgentLoopConfig extends SimpleStreamOptions {\n\tmodel: Model<any>;\n\n\t/**\n\t * Cursor exec-channel tool handlers (cursor-agent models only).\n\t *\n\t * Cursor's server-driven protocol executes tools MID-STREAM: the server\n\t * blocks on an in-band reply, so the provider runs these handlers while\n\t * the Run stream is open, synthesizes already-resolved `toolCall` blocks\n\t * (marked `kCursorExecResolved`, which this loop skips), and buffers each\n\t * paired `ToolResultMessage` for emission right after the assistant\n\t * message. Other providers ignore this field.\n\t */\n\tcursorExecHandlers?: CursorExecHandlers;\n\n\t/**\n\t * Maximum time in milliseconds to wait for the FIRST provider stream event.\n\t * Providers emit their first event only once the HTTP response begins, so a\n\t * dead upstream that accepts the request but never answers is otherwise only\n\t * bounded by `timeoutMs` (the idle timeout, default 5 minutes). After the\n\t * first event arrives, `timeoutMs` governs inter-event idleness as before.\n\t * Unset or non-positive values disable the start bound.\n\t */\n\tstreamStartTimeoutMs?: number;\n\n\t/** Provider/SDK timeout override for only the first request in this loop invocation. */\n\tinitialRequestTimeoutMs?: number;\n\n\t/** Stream-start timeout override for only the first request in this loop invocation. */\n\tinitialRequestStreamStartTimeoutMs?: number;\n\n\t/**\n\t * Converts AgentMessage[] to LLM-compatible Message[] before each LLM call.\n\t *\n\t * Each AgentMessage must be converted to a UserMessage, AssistantMessage, or ToolResultMessage\n\t * that the LLM can understand. AgentMessages that cannot be converted (e.g., UI-only notifications,\n\t * status messages) should be filtered out.\n\t *\n\t * Contract: must not throw or reject. Return a safe fallback value instead.\n\t * Throwing interrupts the low-level agent loop without producing a normal event sequence.\n\t *\n\t * @example\n\t * ```typescript\n\t * convertToLlm: (messages) => messages.flatMap(m => {\n\t * if (m.role === \"custom\") {\n\t * // Convert custom message to user message\n\t * return [{ role: \"user\", content: m.content, timestamp: m.timestamp }];\n\t * }\n\t * if (m.role === \"notification\") {\n\t * // Filter out UI-only messages\n\t * return [];\n\t * }\n\t * // Pass through standard LLM messages\n\t * return [m];\n\t * })\n\t * ```\n\t */\n\tconvertToLlm: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;\n\n\t/**\n\t * Optional transform applied to the context before `convertToLlm`.\n\t *\n\t * Use this for operations that work at the AgentMessage level:\n\t * - Context window management (pruning old messages)\n\t * - Injecting context from external sources\n\t *\n\t * Contract: must not throw or reject. Return the original messages or another\n\t * safe fallback value instead.\n\t *\n\t * @example\n\t * ```typescript\n\t * transformContext: async (messages) => {\n\t * if (estimateTokens(messages) > MAX_TOKENS) {\n\t * return pruneOldMessages(messages);\n\t * }\n\t * return messages;\n\t * }\n\t * ```\n\t */\n\ttransformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;\n\n\t/**\n\t * Resolves an API key dynamically for each LLM call.\n\t *\n\t * Useful for short-lived OAuth tokens (e.g., GitHub Copilot) that may expire\n\t * during long-running tool execution phases.\n\t *\n\t * Contract: must not throw or reject. Return undefined when no key is available.\n\t */\n\tgetApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;\n\n\t/**\n\t * Called after each turn fully completes and `turn_end` has been emitted.\n\t *\n\t * If it returns true, the loop emits `agent_end` and exits before polling steering or follow-up queues,\n\t * without starting another LLM call. The current assistant response and any tool executions finish normally.\n\t *\n\t * Use this to request a graceful stop after the current turn, e.g. before context gets too full.\n\t *\n\t * Contract: must not throw or reject. Throwing interrupts the low-level agent loop without producing a normal event sequence.\n\t */\n\tshouldStopAfterTurn?: (context: ShouldStopAfterTurnContext) => boolean | Promise<boolean>;\n\n\t/**\n\t * Called after `turn_end` and before the loop decides whether another provider request should start.\n\t * Return replacement context/model/thinking state to affect the next turn in this run.\n\t * Return undefined to keep using the current context/config.\n\t */\n\tprepareNextTurn?: (\n\t\tcontext: PrepareNextTurnContext,\n\t) => AgentLoopTurnUpdate | undefined | Promise<AgentLoopTurnUpdate | undefined>;\n\n\t/**\n\t * Returns steering messages to inject into the conversation mid-run.\n\t *\n\t * Called after the current assistant turn finishes executing its tool calls, unless `shouldStopAfterTurn` exits first.\n\t * If messages are returned, they are added to the context before the next LLM call.\n\t * Tool calls from the current assistant message are not skipped.\n\t *\n\t * Use this for \"steering\" the agent while it's working.\n\t *\n\t * Contract: must not throw or reject. Return [] when no steering messages are available.\n\t */\n\tgetSteeringMessages?: () => Promise<AgentMessage[]>;\n\n\t/**\n\t * Returns follow-up messages to process after the agent would otherwise stop.\n\t *\n\t * Called when the agent has no more tool calls and no steering messages.\n\t * If messages are returned, they're added to the context and the agent\n\t * continues with another turn.\n\t *\n\t * Use this for follow-up messages that should wait until the agent finishes.\n\t *\n\t * Contract: must not throw or reject. Return [] when no follow-up messages are available.\n\t */\n\tgetFollowUpMessages?: () => Promise<AgentMessage[]>;\n\n\t/**\n\t * Restores messages previously returned by a queue callback when next-turn preparation cannot continue.\n\t * Restored messages must be placed before messages queued after the drain.\n\t */\n\trestorePendingMessages?: (queue: \"steering\" | \"followUp\", messages: AgentMessage[]) => Promise<void> | void;\n\n\t/**\n\t * Tool execution mode.\n\t * - \"sequential\": execute tool calls one by one\n\t * - \"parallel\": preflight tool calls sequentially, then execute allowed tools in concurrent waves;\n\t * per-tool `executionMode: \"sequential\"` calls act as exclusive barriers,\n\t * emit `tool_execution_end` in tool completion order after each tool is finalized,\n\t * then emit tool-result message artifacts later in assistant source order\n\t *\n\t * Default: \"parallel\"\n\t */\n\ttoolExecution?: ToolExecutionMode;\n\n\t/**\n\t * Optional migration guidance for tool names intentionally removed by an extension.\n\t * The matching hint is appended to the normal unknown-tool error before hooks run.\n\t */\n\tremovedToolHints?: Record<string, string>;\n\n\t/**\n\t * Called when a model names a tool absent from the current context snapshot.\n\t * Return a newly available tool to continue normal validation and execution, or\n\t * undefined to emit the existing unknown-tool result. Hosts may use this to\n\t * activate a registered lazy tool at call time.\n\t */\n\tresolveUnknownToolCall?: (\n\t\ttoolName: string,\n\t\tcontext: AgentContext,\n\t) => AgentTool | undefined | Promise<AgentTool | undefined>;\n\n\t/**\n\t * Called before a tool is executed, after arguments have been validated.\n\t *\n\t * Return `{ block: true }` to prevent execution. The loop emits an error tool result instead.\n\t * A blocked result can also set `terminate: true` to participate in the batch early-termination rule.\n\t * The hook receives the agent abort signal and is responsible for honoring it.\n\t */\n\tbeforeToolCall?: (context: BeforeToolCallContext, signal?: AbortSignal) => Promise<BeforeToolCallResult | undefined>;\n\n\t/**\n\t * Called after a tool finishes executing, before `tool_execution_end` and tool-result message events are emitted.\n\t *\n\t * Return an `AfterToolCallResult` to override parts of the executed tool result:\n\t * - `content` replaces the full content array\n\t * - `details` replaces the full details payload\n\t * - `isError` replaces the error flag\n\t * - `usage` replaces the tool result usage\n\t * - `terminate` replaces the early-termination hint\n\t *\n\t * Any omitted fields keep their original values. No deep merge is performed.\n\t * The hook receives the agent abort signal and is responsible for honoring it.\n\t */\n\tafterToolCall?: (context: AfterToolCallContext, signal?: AbortSignal) => Promise<AfterToolCallResult | undefined>;\n}\n\n/**\n * Thinking/reasoning level for models that support it.\n * Note: \"xhigh\" and \"max\" are only supported by selected model families. Use model\n * thinking-level metadata from @earendil-works/pi-ai to detect support for a concrete model.\n */\nexport type ThinkingLevel = \"off\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\n\n/**\n * Extensible interface for custom app messages.\n * Apps can extend via declaration merging:\n *\n * @example\n * ```typescript\n * declare module \"@earendil-works/pi-agent-core\" {\n * interface CustomAgentMessages {\n * artifact: ArtifactMessage;\n * notification: NotificationMessage;\n * }\n * }\n * ```\n */\nexport interface CustomAgentMessages {\n\t// Empty by default - apps extend via declaration merging\n}\n\n/**\n * AgentMessage: Union of LLM messages + custom messages.\n * This abstraction allows apps to add custom message types while maintaining\n * type safety and compatibility with the base LLM messages.\n */\nexport type AgentMessage = Message | CustomAgentMessages[keyof CustomAgentMessages];\n\n/**\n * Public agent state.\n *\n * `tools` and `messages` use accessor properties so implementations can copy\n * assigned arrays before storing them.\n */\nexport interface AgentState {\n\t/** System prompt sent with each model request. */\n\tsystemPrompt: string;\n\t/** Active model used for future turns. */\n\tmodel: Model<any>;\n\t/** Requested reasoning level for future turns. */\n\tthinkingLevel: ThinkingLevel;\n\t/** Available tools. Assigning a new array copies the top-level array. */\n\tset tools(tools: AgentTool<any>[]);\n\tget tools(): AgentTool<any>[];\n\t/** Conversation transcript. Assigning a new array copies the top-level array. */\n\tset messages(messages: AgentMessage[]);\n\tget messages(): AgentMessage[];\n\t/**\n\t * True while the agent is processing a prompt or continuation.\n\t *\n\t * This remains true until awaited `agent_end` listeners settle.\n\t */\n\treadonly isStreaming: boolean;\n\t/** Partial assistant message for the current streamed response, if any. */\n\treadonly streamingMessage?: AgentMessage;\n\t/** Tool call ids currently executing. */\n\treadonly pendingToolCalls: ReadonlySet<string>;\n\t/** Error message from the most recent failed or aborted assistant turn, if any. */\n\treadonly errorMessage?: string;\n}\n\n/** Final or partial result produced by a tool. */\nexport interface AgentToolResult<T> {\n\t/** Text or image content returned to the model. */\n\tcontent: (TextContent | ImageContent)[];\n\t/** Arbitrary structured details for logs or UI rendering. */\n\tdetails: T;\n\t/** Usage from the final tool execution itself, if available. Not used for main LLM context accounting. */\n\tusage?: Usage;\n\t/** Names of tools introduced by this result and available from this transcript point onward. */\n\taddedToolNames?: string[];\n\t/**\n\t * Hint that the agent should stop after the current tool batch.\n\t * Early termination only happens when every finalized tool result in the batch sets this to true.\n\t */\n\tterminate?: boolean;\n}\n\n/**\n * Callback used by tools to stream partial execution updates.\n *\n * The callback is scoped to the current `execute()` invocation. Calls made after\n * the tool promise settles are ignored.\n */\nexport type AgentToolUpdateCallback<T = any> = (partialResult: AgentToolResult<T>) => void;\n\n/** Tool definition used by the agent runtime. */\nexport interface AgentTool<TParameters extends TSchema = TSchema, TDetails = any> extends Tool<TParameters> {\n\t/** Human-readable label for UI display. */\n\tlabel: string;\n\t/**\n\t * Optional compatibility shim for raw tool-call arguments before schema validation.\n\t * Must return an object that matches `TParameters`.\n\t */\n\tprepareArguments?: (args: unknown) => Static<TParameters>;\n\t/** Execute the tool call. Throw on failure instead of encoding errors in `content`. */\n\texecute: (\n\t\ttoolCallId: string,\n\t\tparams: Static<TParameters>,\n\t\tsignal?: AbortSignal,\n\t\tonUpdate?: AgentToolUpdateCallback<TDetails>,\n\t) => Promise<AgentToolResult<TDetails>>;\n\t/**\n\t * Per-tool execution mode override.\n\t * - \"sequential\": this tool acts as an exclusive barrier in parallel batches.\n\t * - \"parallel\": this tool can execute concurrently with other tool calls.\n\t *\n\t * If omitted, the default execution mode applies.\n\t */\n\texecutionMode?: ToolExecutionMode;\n}\n\n/** Context snapshot passed into the low-level agent loop. */\nexport interface AgentContext {\n\t/** System prompt included with the request. */\n\tsystemPrompt: string;\n\t/** Transcript visible to the model. */\n\tmessages: AgentMessage[];\n\t/** Tools available for this run. */\n\ttools?: AgentTool<any>[];\n}\n\n/**\n * Events emitted by the Agent for UI updates.\n *\n * `agent_end` is the last event emitted for a run, but awaited `Agent.subscribe()`\n * listeners for that event are still part of run settlement. The agent becomes\n * idle only after those listeners finish.\n */\nexport type AgentEvent =\n\t// Agent lifecycle\n\t| { type: \"agent_start\" }\n\t| { type: \"agent_end\"; messages: AgentMessage[] }\n\t// Turn lifecycle - a turn is one assistant response + any tool calls/results\n\t| { type: \"turn_start\" }\n\t| { type: \"turn_end\"; message: AgentMessage; toolResults: ToolResultMessage[] }\n\t// Message lifecycle - emitted for user, assistant, and toolResult messages\n\t| { type: \"message_start\"; message: AgentMessage }\n\t// Only emitted for assistant messages during streaming\n\t| { type: \"message_update\"; message: AgentMessage; assistantMessageEvent: AssistantMessageEvent }\n\t| { type: \"message_end\"; message: AgentMessage }\n\t// Tool execution lifecycle\n\t| { type: \"tool_execution_start\"; toolCallId: string; toolName: string; args: any }\n\t| { type: \"tool_execution_update\"; toolCallId: string; toolName: string; args: any; partialResult: any }\n\t| { type: \"tool_execution_end\"; toolCallId: string; toolName: string; result: any; isError: boolean };\n"]}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@earendil-works/pi-agent-core",
3
3
  "private": true,
4
- "version": "2026.8.16",
4
+ "version": "2026.8.18",
5
5
  "description": "General-purpose agent with transport abstraction, state management, and attachment support",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -36,8 +36,8 @@
36
36
  "prepublishOnly": "npm run build"
37
37
  },
38
38
  "dependencies": {
39
- "@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.8.16",
40
- "@earendil-works/pi-telemetry": "npm:@code-yeongyu/senpi-telemetry@2026.8.16",
39
+ "@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.8.18",
40
+ "@earendil-works/pi-telemetry": "npm:@code-yeongyu/senpi-telemetry@2026.8.18",
41
41
  "diff": "9.0.0",
42
42
  "ignore": "7.0.6",
43
43
  "typebox": "1.3.8",
@@ -90,7 +90,7 @@ Unified LLM API with provider collections, automatic auth resolution, token and
90
90
  - **Qwen Token Plan** (separate Individual and existing catalogs, with a separate China provider)
91
91
  - **Xiaomi MiMo** (defaults to API billing endpoint, with separate Token Plan providers for `cn`/`ams`/`sgp` regions)
92
92
  - **Alibaba Token Plan** (Alibaba Cloud Model Studio prepaid Token Plan, OpenAI-compatible `ap-southeast-1` endpoint)
93
- - **Cursor** (Pro/Ultra/Teams subscription, OAuth authentication only the Cursor chat protocol is not ported yet, see below)
93
+ - **Cursor** (Pro/Ultra/Teams subscription; native `cursor-agent` protocol with full chat + server-driven tool calling, per-account dynamic catalog, requires OAuth, see below)
94
94
  - **Any other OpenAI-compatible API**: local Ollama, vLLM, LM Studio, etc.
95
95
 
96
96
  ## Installation
@@ -1162,6 +1162,7 @@ Built-in API implementations live under `./api/<api-id>`:
1162
1162
  | `openai-completions` | `OpenAICompletionsOptions` |
1163
1163
  | `openai-responses` | `OpenAIResponsesOptions` |
1164
1164
  | `openai-codex-responses` | `OpenAICodexResponsesOptions` |
1165
+ | `cursor-agent` | `CursorAgentOptions` |
1165
1166
  | `azure-openai-responses` | `AzureOpenAIResponsesOptions` |
1166
1167
  | `google-generative-ai` | `GoogleOptions` |
1167
1168
  | `google-vertex` | `GoogleVertexOptions` |
@@ -1484,7 +1485,7 @@ Several providers support OAuth authentication instead of static API keys:
1484
1485
  - **OpenAI Codex** (ChatGPT Plus/Pro subscription, access to GPT-5.x Codex models)
1485
1486
  - **GitHub Copilot** (Copilot subscription)
1486
1487
  - **OpenRouter** (OAuth PKCE that mints a user-controlled API key)
1487
- - **Cursor** (Pro/Ultra/Teams subscription; browser deep-link + poll flow. Login, refresh, and credential storage are fully functional, but the provider exposes no models until the Cursor Connect-RPC chat protocol is ported the stored access token resolves through `models.getAuth("cursor")` for external integrations)
1488
+ - **Cursor** (Pro/Ultra/Teams subscription; browser deep-link + poll flow. After login, the per-account model catalog is discovered through `GetUsableModels` and chat streams over the native `cursor-agent` protocol with in-band tool execution hosts supply `CursorAgentOptions.execHandlers` to bridge Cursor's server-driven tool calls onto local tools)
1488
1489
 
1489
1490
  Each of these providers carries an `OAuthAuth` on `provider.auth.oauth` with three operations: `login(interaction)` uses the provider-neutral `AuthInteraction.prompt()`/`notify()` protocol and returns a credential, `refresh(credential, signal)` refreshes expiring credentials when applicable, and `toAuth(credential)` derives request auth (GitHub Copilot's per-account base URL comes from here). Provider login interactions and refresh calls always carry a concrete abort signal. Refresh is automatic: `models.getAuth(providerId)` and request paths refresh expired tokens under a credential-store lock, so concurrent requests and processes cannot double-refresh. OpenRouter's OAuth flow instead returns a permanent API key, so its refresh operation is a no-op.
1490
1491
 
@@ -0,0 +1,17 @@
1
+ /**
2
+ * A UUID-shaped string: five hex groups in the canonical 8-4-4-4-12 layout.
3
+ *
4
+ * NOT a spec-compliant RFC 4122 UUID — the version/variant nibbles are left as
5
+ * raw hash output — but the shape passes everywhere a UUID string is expected.
6
+ */
7
+ export type DeterministicUuid = `${string}-${string}-${string}-${string}-${string}`;
8
+ /**
9
+ * Format the leading 128 bits of `seed`'s SHA-256 digest as a v4-shape UUID
10
+ * (8-4-4-4-12 hex groups).
11
+ *
12
+ * Deterministic: identical seeds always map to the same id, so callers get
13
+ * stable ids across requests / conversation turns (reusing message-blob ids,
14
+ * keying prompt caches) without persisting a seed→id mapping.
15
+ */
16
+ export declare function deterministicUuid(seed: string): DeterministicUuid;
17
+ //# sourceMappingURL=deterministic-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deterministic-id.d.ts","sourceRoot":"","sources":["../../../src/api/cursor-agent/deterministic-id.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,GAAG,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,EAAE,CAAC;AAEpF;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,CAGjE"}
@@ -0,0 +1,14 @@
1
+ import { createHash } from "node:crypto";
2
+ /**
3
+ * Format the leading 128 bits of `seed`'s SHA-256 digest as a v4-shape UUID
4
+ * (8-4-4-4-12 hex groups).
5
+ *
6
+ * Deterministic: identical seeds always map to the same id, so callers get
7
+ * stable ids across requests / conversation turns (reusing message-blob ids,
8
+ * keying prompt caches) without persisting a seed→id mapping.
9
+ */
10
+ export function deterministicUuid(seed) {
11
+ const hex = createHash("sha256").update(seed).digest("hex");
12
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;
13
+ }
14
+ //# sourceMappingURL=deterministic-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deterministic-id.js","sourceRoot":"","sources":["../../../src/api/cursor-agent/deterministic-id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAUzC;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC7C,MAAM,GAAG,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5D,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;AAChH,CAAC","sourcesContent":["import { createHash } from \"node:crypto\";\n\n/**\n * A UUID-shaped string: five hex groups in the canonical 8-4-4-4-12 layout.\n *\n * NOT a spec-compliant RFC 4122 UUID — the version/variant nibbles are left as\n * raw hash output — but the shape passes everywhere a UUID string is expected.\n */\nexport type DeterministicUuid = `${string}-${string}-${string}-${string}-${string}`;\n\n/**\n * Format the leading 128 bits of `seed`'s SHA-256 digest as a v4-shape UUID\n * (8-4-4-4-12 hex groups).\n *\n * Deterministic: identical seeds always map to the same id, so callers get\n * stable ids across requests / conversation turns (reusing message-blob ids,\n * keying prompt caches) without persisting a seed→id mapping.\n */\nexport function deterministicUuid(seed: string): DeterministicUuid {\n\tconst hex = createHash(\"sha256\").update(seed).digest(\"hex\");\n\treturn `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;\n}\n"]}
@@ -0,0 +1,13 @@
1
+ export type ExecHeartbeatOptions = {
2
+ readonly intervalMs: number;
3
+ readonly isClosed: () => boolean;
4
+ readonly writeHeartbeat: (onComplete: (error?: Error | null) => void) => void;
5
+ };
6
+ /**
7
+ * Arm one exec-scoped heartbeat at a time.
8
+ *
9
+ * The next timer starts only after the current write callback succeeds, so a
10
+ * slow HTTP/2 write can never accumulate overlapping heartbeat frames.
11
+ */
12
+ export declare function armExecHeartbeat(options: ExecHeartbeatOptions): () => void;
13
+ //# sourceMappingURL=exec-lifecycle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec-lifecycle.d.ts","sourceRoot":"","sources":["../../../src/api/cursor-agent/exec-lifecycle.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,oBAAoB,GAAG;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,OAAO,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,KAAK,IAAI,KAAK,IAAI,CAAC;CAC9E,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,oBAAoB,GAAG,MAAM,IAAI,CAwB1E"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Arm one exec-scoped heartbeat at a time.
3
+ *
4
+ * The next timer starts only after the current write callback succeeds, so a
5
+ * slow HTTP/2 write can never accumulate overlapping heartbeat frames.
6
+ */
7
+ export function armExecHeartbeat(options) {
8
+ let active = true;
9
+ let timer;
10
+ const schedule = () => {
11
+ if (!active || options.isClosed())
12
+ return;
13
+ timer = setTimeout(() => {
14
+ timer = undefined;
15
+ if (!active || options.isClosed())
16
+ return;
17
+ options.writeHeartbeat((error) => {
18
+ if (error || !active || options.isClosed())
19
+ return;
20
+ schedule();
21
+ });
22
+ }, options.intervalMs);
23
+ };
24
+ schedule();
25
+ return () => {
26
+ active = false;
27
+ if (timer !== undefined) {
28
+ clearTimeout(timer);
29
+ timer = undefined;
30
+ }
31
+ };
32
+ }
33
+ //# sourceMappingURL=exec-lifecycle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exec-lifecycle.js","sourceRoot":"","sources":["../../../src/api/cursor-agent/exec-lifecycle.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA6B;IAC7D,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,IAAI,KAAiC,CAAC;IAEtC,MAAM,QAAQ,GAAG,GAAG,EAAE;QACrB,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ,EAAE;YAAE,OAAO;QAC1C,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACvB,KAAK,GAAG,SAAS,CAAC;YAClB,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ,EAAE;gBAAE,OAAO;YAC1C,OAAO,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,EAAE;gBAChC,IAAI,KAAK,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC,QAAQ,EAAE;oBAAE,OAAO;gBACnD,QAAQ,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;QACJ,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACxB,CAAC,CAAC;IAEF,QAAQ,EAAE,CAAC;IACX,OAAO,GAAG,EAAE;QACX,MAAM,GAAG,KAAK,CAAC;QACf,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACzB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,KAAK,GAAG,SAAS,CAAC;QACnB,CAAC;IACF,CAAC,CAAC;AACH,CAAC","sourcesContent":["export type ExecHeartbeatOptions = {\n\treadonly intervalMs: number;\n\treadonly isClosed: () => boolean;\n\treadonly writeHeartbeat: (onComplete: (error?: Error | null) => void) => void;\n};\n\n/**\n * Arm one exec-scoped heartbeat at a time.\n *\n * The next timer starts only after the current write callback succeeds, so a\n * slow HTTP/2 write can never accumulate overlapping heartbeat frames.\n */\nexport function armExecHeartbeat(options: ExecHeartbeatOptions): () => void {\n\tlet active = true;\n\tlet timer: NodeJS.Timeout | undefined;\n\n\tconst schedule = () => {\n\t\tif (!active || options.isClosed()) return;\n\t\ttimer = setTimeout(() => {\n\t\t\ttimer = undefined;\n\t\t\tif (!active || options.isClosed()) return;\n\t\t\toptions.writeHeartbeat((error) => {\n\t\t\t\tif (error || !active || options.isClosed()) return;\n\t\t\t\tschedule();\n\t\t\t});\n\t\t}, options.intervalMs);\n\t};\n\n\tschedule();\n\treturn () => {\n\t\tactive = false;\n\t\tif (timer !== undefined) {\n\t\t\tclearTimeout(timer);\n\t\t\ttimer = undefined;\n\t\t}\n\t};\n}\n"]}