@jini-ai/agent-runtime 0.7.1 → 0.7.3-next.1

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 (397) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/README.md +1 -0
  3. package/dist/acp-model-probe.d.ts +2 -3
  4. package/dist/acp-model-probe.js +1 -1
  5. package/dist/agent-protocol/acp/account-failure.d.ts +3 -1
  6. package/dist/agent-protocol/acp/account-failure.js +1 -1
  7. package/dist/agent-protocol/acp/constants.d.ts +3 -1
  8. package/dist/agent-protocol/acp/constants.js +2 -0
  9. package/dist/agent-protocol/acp/index.d.ts +2 -1
  10. package/dist/agent-protocol/acp/index.js +2 -1
  11. package/dist/agent-protocol/acp/json.d.ts +26 -7
  12. package/dist/agent-protocol/acp/json.js +11 -11
  13. package/dist/agent-protocol/acp/models.d.ts +26 -6
  14. package/dist/agent-protocol/acp/models.js +157 -129
  15. package/dist/agent-protocol/acp/rpc.d.ts +37 -9
  16. package/dist/agent-protocol/acp/rpc.js +19 -16
  17. package/dist/agent-protocol/acp/session-params.d.ts +4 -1
  18. package/dist/agent-protocol/acp/session-params.js +1 -1
  19. package/dist/agent-protocol/acp/session-permission.d.ts +13 -0
  20. package/dist/agent-protocol/acp/session-permission.js +110 -0
  21. package/dist/agent-protocol/acp/session-results.d.ts +61 -0
  22. package/dist/agent-protocol/acp/session-results.js +226 -0
  23. package/dist/agent-protocol/acp/session-run.d.ts +92 -0
  24. package/dist/agent-protocol/acp/session-run.js +555 -0
  25. package/dist/agent-protocol/acp/session-state.d.ts +9 -0
  26. package/dist/agent-protocol/acp/session-state.js +29 -0
  27. package/dist/agent-protocol/acp/session-text-updates.d.ts +56 -0
  28. package/dist/agent-protocol/acp/session-text-updates.js +119 -0
  29. package/dist/agent-protocol/acp/session-tool-updates.d.ts +21 -0
  30. package/dist/agent-protocol/acp/session-tool-updates.js +90 -0
  31. package/dist/agent-protocol/acp/session-types.d.ts +166 -0
  32. package/dist/agent-protocol/acp/session-types.js +4 -0
  33. package/dist/agent-protocol/acp/session.d.ts +4 -280
  34. package/dist/agent-protocol/acp/session.js +65 -998
  35. package/dist/agent-protocol/acp/text-suppression.d.ts +5 -1
  36. package/dist/agent-protocol/acp/text-suppression.js +1 -1
  37. package/dist/agent-protocol/acp/updates.d.ts +43 -12
  38. package/dist/agent-protocol/acp/updates.js +34 -34
  39. package/dist/agent-protocol/core/json-line-stream.d.ts +133 -36
  40. package/dist/agent-protocol/core/json-line-stream.js +62 -62
  41. package/dist/agent-protocol/pi-rpc/events.d.ts +14 -4
  42. package/dist/agent-protocol/pi-rpc/events.js +14 -14
  43. package/dist/agent-protocol/pi-rpc/internal.d.ts +9 -3
  44. package/dist/agent-protocol/pi-rpc/internal.js +3 -3
  45. package/dist/agent-protocol/pi-rpc/models.d.ts +3 -17
  46. package/dist/agent-protocol/pi-rpc/models.js +1 -45
  47. package/dist/agent-protocol/pi-rpc/session.d.ts +36 -12
  48. package/dist/agent-protocol/pi-rpc/session.js +134 -122
  49. package/dist/amr-model-cache.d.ts +1 -1
  50. package/dist/anthropic-live-models.d.ts +8 -3
  51. package/dist/anthropic-live-models.js +0 -0
  52. package/dist/auth-common.d.ts +2 -0
  53. package/dist/auth-common.js +2 -0
  54. package/dist/auth.d.ts +7 -34
  55. package/dist/auth.js +25 -139
  56. package/dist/capabilities.d.ts +1 -1
  57. package/dist/claude-code-models.d.ts +13 -5
  58. package/dist/claude-code-models.js +12 -10
  59. package/dist/claude-filesystem-policy.d.ts +1 -1
  60. package/dist/claude-stream-frames.d.ts +125 -0
  61. package/dist/claude-stream-frames.js +327 -0
  62. package/dist/claude-stream-handler.d.ts +19 -0
  63. package/dist/claude-stream-handler.js +480 -0
  64. package/dist/claude-stream.d.ts +3 -72
  65. package/dist/claude-stream.js +2 -801
  66. package/dist/core/model-discovery-shared.d.ts +14 -8
  67. package/dist/core/model-discovery-shared.js +6 -9
  68. package/dist/core/omit-keys.d.ts +4 -1
  69. package/dist/core/omit-keys.js +1 -1
  70. package/dist/defs/aider/executable.d.ts +2 -0
  71. package/dist/defs/aider/executable.js +2 -0
  72. package/dist/defs/aider/model-discovery.d.ts +3 -0
  73. package/dist/defs/aider/model-discovery.js +6 -0
  74. package/dist/defs/aider.d.ts +10 -10
  75. package/dist/defs/amp/index.d.ts +35 -0
  76. package/dist/defs/amp/index.js +75 -0
  77. package/dist/defs/amp.d.ts +1 -34
  78. package/dist/defs/amp.js +1 -74
  79. package/dist/defs/amr/executable-resolution.d.ts +7 -0
  80. package/dist/defs/amr/executable-resolution.js +50 -0
  81. package/dist/defs/amr/executable.d.ts +2 -0
  82. package/dist/defs/amr/executable.js +2 -0
  83. package/dist/defs/amr/index.d.ts +69 -0
  84. package/dist/defs/amr/index.js +279 -0
  85. package/dist/defs/amr/model-discovery.d.ts +3 -0
  86. package/dist/defs/amr/model-discovery.js +4 -0
  87. package/dist/defs/amr.d.ts +1 -68
  88. package/dist/defs/amr.js +1 -291
  89. package/dist/defs/antigravity/auth.d.ts +14 -0
  90. package/dist/defs/antigravity/auth.js +47 -0
  91. package/dist/defs/antigravity/index.d.ts +9 -9
  92. package/dist/defs/antigravity/index.js +3 -3
  93. package/dist/defs/antigravity/model-discovery.d.ts +3 -0
  94. package/dist/defs/antigravity/model-discovery.js +5 -0
  95. package/dist/defs/auggie/executable.d.ts +2 -0
  96. package/dist/defs/auggie/executable.js +2 -0
  97. package/dist/defs/auggie.d.ts +13 -13
  98. package/dist/defs/auggie.js +2 -9
  99. package/dist/defs/claude/auth.d.ts +15 -0
  100. package/dist/defs/claude/auth.js +47 -0
  101. package/dist/defs/claude/executable.d.ts +2 -0
  102. package/dist/defs/claude/executable.js +2 -0
  103. package/dist/defs/claude/model-discovery.d.ts +3 -0
  104. package/dist/defs/claude/model-discovery.js +20 -0
  105. package/dist/defs/claude-compatible-args.d.ts +10 -6
  106. package/dist/defs/claude-compatible-args.js +5 -5
  107. package/dist/defs/claude.d.ts +11 -11
  108. package/dist/defs/claude.js +5 -4
  109. package/dist/defs/cline/executable.d.ts +2 -0
  110. package/dist/defs/cline/executable.js +2 -0
  111. package/dist/defs/cline.d.ts +13 -13
  112. package/dist/defs/cline.js +2 -9
  113. package/dist/defs/codebuddy/executable.d.ts +2 -0
  114. package/dist/defs/codebuddy/executable.js +2 -0
  115. package/dist/defs/codebuddy/index.d.ts +48 -0
  116. package/dist/defs/codebuddy/index.js +121 -0
  117. package/dist/defs/codebuddy/model-discovery.d.ts +3 -0
  118. package/dist/defs/codebuddy/model-discovery.js +5 -0
  119. package/dist/defs/codebuddy.d.ts +1 -47
  120. package/dist/defs/codebuddy.js +1 -120
  121. package/dist/defs/codex/auth.d.ts +4 -0
  122. package/dist/defs/codex/auth.js +2 -0
  123. package/dist/defs/codex/event-stream.d.ts +10 -0
  124. package/dist/defs/codex/event-stream.js +353 -0
  125. package/dist/defs/codex/executable-resolution.d.ts +7 -0
  126. package/dist/defs/codex/executable-resolution.js +37 -0
  127. package/dist/defs/codex/executable.d.ts +2 -0
  128. package/dist/defs/codex/executable.js +2 -0
  129. package/dist/defs/codex/launch.d.ts +3 -0
  130. package/dist/defs/codex/launch.js +155 -0
  131. package/dist/defs/codex/model-discovery.d.ts +3 -0
  132. package/dist/defs/codex/model-discovery.js +11 -0
  133. package/dist/defs/codex/options.d.ts +11 -0
  134. package/dist/defs/codex/options.js +5 -0
  135. package/dist/defs/codex.d.ts +18 -11
  136. package/dist/defs/codex.js +32 -29
  137. package/dist/defs/crush/executable.d.ts +2 -0
  138. package/dist/defs/crush/executable.js +2 -0
  139. package/dist/defs/crush/model-discovery.d.ts +3 -0
  140. package/dist/defs/crush/model-discovery.js +6 -0
  141. package/dist/defs/crush.d.ts +10 -10
  142. package/dist/defs/cursor-agent/auth.d.ts +13 -0
  143. package/dist/defs/cursor-agent/auth.js +22 -0
  144. package/dist/defs/cursor-agent/event-stream.d.ts +8 -0
  145. package/dist/defs/cursor-agent/event-stream.js +104 -0
  146. package/dist/defs/cursor-agent/executable.d.ts +2 -0
  147. package/dist/defs/cursor-agent/executable.js +2 -0
  148. package/dist/defs/cursor-agent/model-discovery.d.ts +3 -0
  149. package/dist/defs/cursor-agent/model-discovery.js +5 -0
  150. package/dist/defs/cursor-agent.d.ts +11 -13
  151. package/dist/defs/cursor-agent.js +1 -1
  152. package/dist/defs/deepseek/auth.d.ts +13 -0
  153. package/dist/defs/deepseek/auth.js +18 -0
  154. package/dist/defs/deepseek/executable.d.ts +2 -0
  155. package/dist/defs/deepseek/executable.js +2 -0
  156. package/dist/defs/deepseek/model-discovery.d.ts +3 -0
  157. package/dist/defs/deepseek/model-discovery.js +5 -0
  158. package/dist/defs/deepseek.d.ts +10 -10
  159. package/dist/defs/devin/executable.d.ts +2 -0
  160. package/dist/defs/devin/executable.js +2 -0
  161. package/dist/defs/devin.d.ts +15 -15
  162. package/dist/defs/devin.js +3 -10
  163. package/dist/defs/droid/executable.d.ts +2 -0
  164. package/dist/defs/droid/executable.js +2 -0
  165. package/dist/defs/droid/model-discovery.d.ts +3 -0
  166. package/dist/defs/droid/model-discovery.js +5 -0
  167. package/dist/defs/droid.d.ts +10 -10
  168. package/dist/defs/gemini/event-stream.d.ts +14 -0
  169. package/dist/defs/gemini/event-stream.js +193 -0
  170. package/dist/defs/goose/executable.d.ts +2 -0
  171. package/dist/defs/goose/executable.js +2 -0
  172. package/dist/defs/goose.d.ts +13 -13
  173. package/dist/defs/goose.js +2 -9
  174. package/dist/defs/grok-build/model-discovery.d.ts +3 -0
  175. package/dist/defs/grok-build/model-discovery.js +5 -0
  176. package/dist/defs/grok-build.d.ts +10 -10
  177. package/dist/defs/hermes/executable.d.ts +2 -0
  178. package/dist/defs/hermes/executable.js +2 -0
  179. package/dist/defs/hermes/index.d.ts +34 -0
  180. package/dist/defs/hermes/index.js +57 -0
  181. package/dist/defs/hermes.d.ts +1 -33
  182. package/dist/defs/hermes.js +1 -56
  183. package/dist/defs/index.d.ts +1 -0
  184. package/dist/defs/index.js +1 -0
  185. package/dist/defs/kilo/executable.d.ts +2 -0
  186. package/dist/defs/kilo/executable.js +2 -0
  187. package/dist/defs/kilo.d.ts +13 -13
  188. package/dist/defs/kilo.js +2 -9
  189. package/dist/defs/kimi/event-stream.d.ts +3 -0
  190. package/dist/defs/kimi/event-stream.js +46 -0
  191. package/dist/defs/kimi/executable.d.ts +2 -0
  192. package/dist/defs/kimi/executable.js +2 -0
  193. package/dist/defs/kimi.d.ts +13 -13
  194. package/dist/defs/kimi.js +2 -9
  195. package/dist/defs/kiro/executable.d.ts +2 -0
  196. package/dist/defs/kiro/executable.js +2 -0
  197. package/dist/defs/kiro.d.ts +13 -13
  198. package/dist/defs/kiro.js +2 -9
  199. package/dist/defs/mimo/executable.d.ts +2 -0
  200. package/dist/defs/mimo/executable.js +2 -0
  201. package/dist/defs/mimo/model-discovery.d.ts +3 -0
  202. package/dist/defs/mimo/model-discovery.js +7 -0
  203. package/dist/defs/mimo.d.ts +10 -10
  204. package/dist/defs/opencode/event-stream.d.ts +8 -0
  205. package/dist/defs/opencode/event-stream.js +108 -0
  206. package/dist/defs/opencode/executable.d.ts +2 -0
  207. package/dist/defs/opencode/executable.js +2 -0
  208. package/dist/defs/opencode/model-discovery.d.ts +4 -0
  209. package/dist/defs/opencode/model-discovery.js +14 -0
  210. package/dist/defs/opencode-acp.d.ts +42 -0
  211. package/dist/defs/opencode-acp.js +23 -0
  212. package/dist/defs/opencode.d.ts +9 -9
  213. package/dist/defs/pi/executable.d.ts +2 -0
  214. package/dist/defs/pi/executable.js +2 -0
  215. package/dist/defs/pi/model-discovery.d.ts +4 -0
  216. package/dist/defs/pi/model-discovery.js +16 -0
  217. package/dist/defs/pi/options.d.ts +11 -0
  218. package/dist/defs/pi/options.js +5 -0
  219. package/dist/defs/pi.d.ts +10 -10
  220. package/dist/defs/qoder/executable.d.ts +2 -0
  221. package/dist/defs/qoder/executable.js +2 -0
  222. package/dist/defs/qoder/model-discovery.d.ts +3 -0
  223. package/dist/defs/qoder/model-discovery.js +7 -0
  224. package/dist/defs/qoder.d.ts +9 -9
  225. package/dist/defs/qwen/executable.d.ts +2 -0
  226. package/dist/defs/qwen/executable.js +2 -0
  227. package/dist/defs/qwen/model-discovery.d.ts +3 -0
  228. package/dist/defs/qwen/model-discovery.js +7 -0
  229. package/dist/defs/qwen.d.ts +10 -10
  230. package/dist/defs/reasonix/auth.d.ts +13 -0
  231. package/dist/defs/reasonix/auth.js +18 -0
  232. package/dist/defs/reasonix/executable.d.ts +2 -0
  233. package/dist/defs/reasonix/executable.js +2 -0
  234. package/dist/defs/reasonix.d.ts +13 -13
  235. package/dist/defs/reasonix.js +2 -9
  236. package/dist/defs/shared.d.ts +10 -2
  237. package/dist/defs/shared.js +5 -1
  238. package/dist/defs/trae-cli/executable.d.ts +2 -0
  239. package/dist/defs/trae-cli/executable.js +2 -0
  240. package/dist/defs/trae-cli.d.ts +15 -15
  241. package/dist/defs/trae-cli.js +2 -9
  242. package/dist/defs/vibe/executable.d.ts +2 -0
  243. package/dist/defs/vibe/executable.js +2 -0
  244. package/dist/defs/vibe.d.ts +13 -13
  245. package/dist/defs/vibe.js +2 -9
  246. package/dist/detection.d.ts +4 -3
  247. package/dist/detection.js +22 -22
  248. package/dist/diagnostics.d.ts +4 -4
  249. package/dist/diagnostics.js +2 -2
  250. package/dist/env.js +2 -1
  251. package/dist/executable-helpers.d.ts +21 -0
  252. package/dist/executable-helpers.js +2 -0
  253. package/dist/executables.d.ts +2 -2
  254. package/dist/executables.js +68 -114
  255. package/dist/index.d.ts +6 -2
  256. package/dist/index.js +5 -1
  257. package/dist/invocation.d.ts +22 -6
  258. package/dist/invocation.js +19 -17
  259. package/dist/json-event-stream-shared.d.ts +81 -0
  260. package/dist/json-event-stream-shared.js +147 -0
  261. package/dist/json-event-stream.d.ts +2 -4
  262. package/dist/json-event-stream.js +15 -940
  263. package/dist/launch.d.ts +1 -9
  264. package/dist/launch.js +6 -155
  265. package/dist/log-file.d.ts +2 -8
  266. package/dist/log-file.js +1 -1
  267. package/dist/mcp.d.ts +2 -2
  268. package/dist/mcp.js +1 -1
  269. package/dist/mmd-routes.d.ts +7 -7
  270. package/dist/mmd-routes.js +19 -27
  271. package/dist/model-discovery-adapters.d.ts +47 -11
  272. package/dist/model-discovery-adapters.js +47 -41
  273. package/dist/model-discovery-config-types.d.ts +44 -0
  274. package/dist/model-discovery-config-types.js +20 -0
  275. package/dist/model-discovery-config.d.ts +19 -11
  276. package/dist/model-discovery-config.js +64 -87
  277. package/dist/model-discovery-native.d.ts +2 -1
  278. package/dist/model-discovery-native.js +3 -3
  279. package/dist/model-discovery-sdk.d.ts +6 -2
  280. package/dist/model-discovery-sdk.js +2 -2
  281. package/dist/model-discovery-types.d.ts +1 -138
  282. package/dist/model-discovery-yaml.d.ts +3 -1
  283. package/dist/model-discovery-yaml.js +1 -1
  284. package/dist/model-discovery.d.ts +15 -5
  285. package/dist/model-discovery.js +119 -105
  286. package/dist/model-loading-state.d.ts +1 -1
  287. package/dist/model-loading-state.js +1 -1
  288. package/dist/model-registry.d.ts +5 -5
  289. package/dist/model-registry.js +7 -6
  290. package/dist/models.d.ts +4 -3
  291. package/dist/models.js +2 -2
  292. package/dist/native-permissions.d.ts +47 -0
  293. package/dist/native-permissions.js +80 -0
  294. package/dist/native-runtime.d.ts +11 -8
  295. package/dist/native-runtime.js +8 -4
  296. package/dist/native-tool-policy.d.ts +1 -40
  297. package/dist/opencode-log.d.ts +3 -3
  298. package/dist/opencode-log.js +5 -3
  299. package/dist/paths.d.ts +1 -1
  300. package/dist/paths.js +1 -1
  301. package/dist/pi-models.d.ts +12 -2
  302. package/dist/pi-models.js +11 -1
  303. package/dist/prompt-augmenter.d.ts +1 -37
  304. package/dist/prompt-augmenter.js +0 -6
  305. package/dist/prompt-budget.d.ts +3 -3
  306. package/dist/prompt-budget.js +2 -2
  307. package/dist/prompt-file.d.ts +2 -6
  308. package/dist/prompt-file.js +1 -1
  309. package/dist/providers/aihubmix.d.ts +8 -8
  310. package/dist/providers/aihubmix.js +8 -8
  311. package/dist/providers/anthropic-messages.d.ts +22 -23
  312. package/dist/providers/anthropic-messages.js +26 -53
  313. package/dist/providers/azure-chat.d.ts +7 -6
  314. package/dist/providers/azure-chat.js +9 -6
  315. package/dist/providers/connection-guard.d.ts +3 -9
  316. package/dist/providers/connection-guard.js +6 -14
  317. package/dist/providers/connection-test.d.ts +1 -2
  318. package/dist/providers/connection-test.js +51 -51
  319. package/dist/providers/credentials.d.ts +59 -0
  320. package/dist/providers/credentials.js +80 -0
  321. package/dist/providers/elevenlabs.d.ts +2 -6
  322. package/dist/providers/elevenlabs.js +2 -31
  323. package/dist/providers/google-messages.d.ts +11 -10
  324. package/dist/providers/google-messages.js +16 -35
  325. package/dist/providers/google-schema.d.ts +1 -1
  326. package/dist/providers/google-schema.js +1 -1
  327. package/dist/providers/google.d.ts +6 -6
  328. package/dist/providers/google.js +6 -6
  329. package/dist/providers/index.d.ts +5 -2
  330. package/dist/providers/index.js +5 -2
  331. package/dist/providers/model-catalog.d.ts +4 -9
  332. package/dist/providers/model-catalog.js +3 -11
  333. package/dist/providers/oauth-callback-server.js +93 -87
  334. package/dist/providers/oauth-provider.d.ts +1 -1
  335. package/dist/providers/oauth-provider.js +1 -1
  336. package/dist/providers/oauth-tokens.d.ts +5 -5
  337. package/dist/providers/oauth-tokens.js +8 -9
  338. package/dist/providers/ollama-chat.d.ts +13 -12
  339. package/dist/providers/ollama-chat.js +15 -24
  340. package/dist/providers/openai-chat-request.d.ts +34 -0
  341. package/dist/providers/openai-chat-request.js +152 -0
  342. package/dist/providers/openai-chat-stream.d.ts +48 -0
  343. package/dist/providers/openai-chat-stream.js +89 -0
  344. package/dist/providers/openai-chat-tool-results.d.ts +81 -0
  345. package/dist/providers/openai-chat-tool-results.js +124 -0
  346. package/dist/providers/openai-chat-types.d.ts +180 -0
  347. package/dist/providers/openai-chat-types.js +3 -0
  348. package/dist/providers/openai-chat.d.ts +5 -405
  349. package/dist/providers/openai-chat.js +9 -388
  350. package/dist/providers/pkce.d.ts +1 -1
  351. package/dist/providers/pkce.js +1 -1
  352. package/dist/providers/provider-url.d.ts +6 -0
  353. package/dist/providers/provider-url.js +9 -0
  354. package/dist/providers/response-text.d.ts +4 -0
  355. package/dist/providers/response-text.js +16 -0
  356. package/dist/providers/sse-decode.d.ts +4 -0
  357. package/dist/providers/sse-decode.js +11 -0
  358. package/dist/providers/token-params.d.ts +5 -5
  359. package/dist/providers/token-params.js +5 -5
  360. package/dist/providers/tool-loop-verdict.d.ts +1 -1
  361. package/dist/providers/tool-loop-verdict.js +1 -1
  362. package/dist/providers/tool-turn-types.d.ts +2 -1
  363. package/dist/providers/tool-turn.js +30 -50
  364. package/dist/providers/turn-end-guard.d.ts +4 -1
  365. package/dist/providers/turn-end-guard.js +1 -1
  366. package/dist/qoder-stream.d.ts +1 -1
  367. package/dist/qoder-stream.js +1 -1
  368. package/dist/registry.d.ts +5 -5
  369. package/dist/registry.js +4 -4
  370. package/dist/role-marker-guard.d.ts +13 -1
  371. package/dist/role-marker-guard.js +15 -1
  372. package/dist/runtime-def-binding.d.ts +15 -0
  373. package/dist/runtime-def-binding.js +19 -0
  374. package/dist/runtime-port-bindings.d.ts +181 -0
  375. package/dist/runtime-port-bindings.js +95 -0
  376. package/dist/runtime-state.d.ts +2 -11
  377. package/dist/runtime-state.js +0 -13
  378. package/dist/types.d.ts +1 -454
  379. package/package.json +27 -15
  380. package/dist/ai-trace/capture.d.ts +0 -17
  381. package/dist/ai-trace/capture.js +0 -43
  382. package/dist/ai-trace/classify.d.ts +0 -12
  383. package/dist/ai-trace/classify.js +0 -16
  384. package/dist/ai-trace/index.d.ts +0 -13
  385. package/dist/ai-trace/index.js +0 -6
  386. package/dist/ai-trace/recorder.d.ts +0 -64
  387. package/dist/ai-trace/recorder.js +0 -258
  388. package/dist/ai-trace/sinks.d.ts +0 -51
  389. package/dist/ai-trace/sinks.js +0 -153
  390. package/dist/ai-trace/types.d.ts +0 -123
  391. package/dist/ai-trace/types.js +0 -17
  392. package/dist/ai-trace/usage.d.ts +0 -13
  393. package/dist/ai-trace/usage.js +0 -45
  394. package/dist/model-contracts.d.ts +0 -29
  395. package/dist/model-contracts.js +0 -2
  396. package/dist/providers/types.d.ts +0 -36
  397. package/dist/providers/types.js +0 -13
@@ -0,0 +1,110 @@
1
+ import { asObject } from './json.js';
2
+ import { sendRpcResult, isJsonRpcId, choosePermissionOutcome } from './rpc.js';
3
+ import { clearStageTimer, resetStageTimer, sendAgent } from './session-run.js';
4
+ /** ACP `PermissionOptionKind` values; other offered options are ignored. */
5
+ const ACP_PERMISSION_OPTION_KINDS = ['allow_once', 'allow_always', 'reject_once', 'reject_always'];
6
+ /** ACP `ToolKind` values; anything else is logged as `other`. */
7
+ const ACP_TOOL_KINDS = ['read', 'edit', 'delete', 'move', 'search', 'execute', 'think', 'fetch', 'switch_mode', 'other'];
8
+ /** The well-formed options of a permission request: a non-empty `optionId`
9
+ * and an ACP `PermissionOptionKind`; anything else offered is ignored. */
10
+ function offeredPermissionOptions(params) {
11
+ if (!Array.isArray(params?.options))
12
+ return [];
13
+ return params.options.filter((option) => {
14
+ const record = asObject({ value: option });
15
+ return typeof record?.optionId === 'string' && record.optionId !== '' &&
16
+ typeof record.kind === 'string' && ACP_PERMISSION_OPTION_KINDS.includes(record.kind);
17
+ });
18
+ }
19
+ /** The tool call's ACP `ToolKind` for permission logging, `other` when absent or unknown. */
20
+ function permissionToolKind(toolCall) {
21
+ return typeof toolCall?.kind === 'string' && ACP_TOOL_KINDS.includes(toolCall.kind) ? toolCall.kind : 'other';
22
+ }
23
+ /** The permission decision used when no `onPermissionRequest` handler is
24
+ * injected: the option `choosePermissionOutcome` picks under the run's
25
+ * `permissionMode` / `cliParity`, or a cancellation when it picks none. */
26
+ function defaultPermissionDecision({ optionRecords }, { permissionMode, cliParity, } = {}) {
27
+ const optionId = choosePermissionOutcome({ options: optionRecords }, { ...(permissionMode ? { permissionMode } : {}), ...(cliParity ? { cliParity: true } : {}) });
28
+ return optionId ? { outcome: 'selected', optionId } : { outcome: 'cancelled' };
29
+ }
30
+ // One status event per request. Only protocol categories leave this
31
+ // boundary: titles, names, option ids and raw arguments can contain
32
+ // commands, paths or credentials.
33
+ function logPermissionDecision({ run, toolCall }, { selected } = {}) {
34
+ try {
35
+ const tool = permissionToolKind(toolCall);
36
+ sendAgent({ run,
37
+ payload: { type: 'status', label: 'acp_permission', detail: `tool=${tool} decision=${selected?.kind ?? 'cancelled'}` },
38
+ });
39
+ }
40
+ catch {
41
+ // Host telemetry must not turn a handled request into a run failure.
42
+ }
43
+ }
44
+ function respondToPermission(reply, decision) {
45
+ const { run, requestId, optionRecords, toolCall } = reply;
46
+ run.pendingPermissionRequests.delete(requestId);
47
+ if (run.aborted || run.finished)
48
+ return;
49
+ // Anything but an offered option (including an invalid handler result) cancels.
50
+ const choice = asObject({ value: decision });
51
+ const selected = choice?.outcome === 'selected'
52
+ ? optionRecords.find((option) => option.optionId === choice.optionId)
53
+ : undefined;
54
+ resetStageTimer({ run, label: 'session/request_permission' });
55
+ try {
56
+ sendRpcResult({ writable: run.stdin, id: requestId, result: {
57
+ outcome: selected ? { outcome: 'selected', optionId: selected.optionId } : { outcome: 'cancelled' },
58
+ } });
59
+ }
60
+ catch {
61
+ // A broken pipe cannot carry a response; ordinary transport lifecycle
62
+ // handling still owns process failure, not the permission decision.
63
+ }
64
+ logPermissionDecision({ run, toolCall }, selected === undefined ? {} : { selected });
65
+ }
66
+ function askPermissionHandler(reply, params) {
67
+ const { run, requestId, toolCall, optionRecords } = reply;
68
+ const { onPermissionRequest, permissionMode, cliParity } = run.options;
69
+ const cancel = () => respondToPermission(reply, { outcome: 'cancelled' });
70
+ try {
71
+ if (!onPermissionRequest) {
72
+ respondToPermission(reply, defaultPermissionDecision({ optionRecords }, { permissionMode, cliParity }));
73
+ return;
74
+ }
75
+ const request = {
76
+ requestId,
77
+ sessionId: typeof params.sessionId === 'string' ? params.sessionId : null,
78
+ toolCall: toolCall ?? null,
79
+ options: optionRecords,
80
+ rawParams: params,
81
+ };
82
+ Promise.resolve(onPermissionRequest(request)).then((decision) => respondToPermission(reply, decision), cancel);
83
+ }
84
+ catch {
85
+ cancel();
86
+ }
87
+ }
88
+ export function replyPermission({ run, raw }, _optional = {}) {
89
+ const params = asObject({ value: raw.params });
90
+ const toolCall = asObject({ value: params?.toolCall });
91
+ if (!isJsonRpcId(raw.id)) {
92
+ // No response can be correlated without a valid id; drop it rather
93
+ // than failing the run.
94
+ logPermissionDecision({ run, toolCall });
95
+ return;
96
+ }
97
+ const reply = {
98
+ run, requestId: raw.id, toolCall, optionRecords: offeredPermissionOptions(params),
99
+ };
100
+ if (!params) {
101
+ respondToPermission(reply, { outcome: 'cancelled' });
102
+ return;
103
+ }
104
+ run.pendingPermissionRequests.set(raw.id, () => logPermissionDecision({ run, toolCall }));
105
+ // Human decision time is outside the agent's inactivity budget. All timer
106
+ // resets stay paused until the last pending permission response is sent.
107
+ clearStageTimer({ run });
108
+ askPermissionHandler(reply, params);
109
+ }
110
+ //# sourceMappingURL=session-permission.js.map
@@ -0,0 +1,61 @@
1
+ import type { UnknownRecord } from './types.js';
2
+ import { type AcpSessionState, type AcpSessionEffects } from './session-types.js';
3
+ /**
4
+ * Handles a JSON-RPC error frame from the agent.
5
+ *
6
+ * -32603 unexpected-id errors are cleanup noise. Expected-id model selection
7
+ * failures are recoverable; all other RPC errors are real protocol failures
8
+ * for initialize/session/new/session/prompt.
9
+ */
10
+ export declare function handleRpcError({ state, effects, obj, error, rpcErr, }: {
11
+ state: AcpSessionState;
12
+ effects: AcpSessionEffects;
13
+ obj: UnknownRecord;
14
+ error: UnknownRecord | null;
15
+ rpcErr: string;
16
+ }, _optional?: Record<string, never>): void;
17
+ /** Handles the `initialize` ack: sends `session/load` (resume) or `session/new` (fresh). */
18
+ export declare function handleInitializeAck({ state, effects, result }: {
19
+ state: AcpSessionState;
20
+ effects: AcpSessionEffects;
21
+ result: UnknownRecord;
22
+ }, _optional?: Record<string, never>): void;
23
+ /** Sends `session/set_model` (or `session/set_config_option`) when a non-default model was requested. Returns `true` when it did (caller should not send the prompt yet). */
24
+ export declare function triggerSetModelIfNeeded({ state, effects, }: {
25
+ state: AcpSessionState;
26
+ effects: AcpSessionEffects;
27
+ }, _optional?: Record<string, never>): boolean;
28
+ /** Handles the `session/new` (or `session/load`) ack: records the session id, model config, and either triggers a model switch or sends the prompt. */
29
+ export declare function handleSessionNewAck({ state, effects, result, rawLine, }: {
30
+ state: AcpSessionState;
31
+ effects: AcpSessionEffects;
32
+ result: UnknownRecord;
33
+ rawLine: string;
34
+ }, _optional?: Record<string, never>): void;
35
+ /** Handles the `session/prompt` ack: fails a turn that reported model activity but produced no visible output, otherwise flushes and finishes cleanly. */
36
+ export declare function handlePromptResult({ state, effects, result, }: {
37
+ state: AcpSessionState;
38
+ effects: AcpSessionEffects;
39
+ result: UnknownRecord;
40
+ }, _optional?: Record<string, never>): void;
41
+ /** Whether an incoming result frame is the ack for an in-flight `session/set_model` (or `set_config_option`) request. */
42
+ export declare function isModelSetAckExpected({ state, effects, obj, }: {
43
+ state: AcpSessionState;
44
+ effects: AcpSessionEffects;
45
+ obj: UnknownRecord;
46
+ }, _optional?: Record<string, never>): boolean;
47
+ /** Handles the `session/set_model` (or `set_config_option`) ack: records the confirmed model and sends the prompt. */
48
+ export declare function handleModelSetAck({ state, effects, result, }: {
49
+ state: AcpSessionState;
50
+ effects: AcpSessionEffects;
51
+ result: UnknownRecord;
52
+ }, _optional?: Record<string, never>): void;
53
+ /** Top-level JSON-RPC result dispatcher, keyed by which request `expectedId`/`promptRequestId` is currently outstanding. */
54
+ export declare function routeResultById({ state, effects, obj, result, rawLine, }: {
55
+ state: AcpSessionState;
56
+ effects: AcpSessionEffects;
57
+ obj: UnknownRecord;
58
+ result: UnknownRecord | null;
59
+ rawLine: string;
60
+ }, _optional?: Record<string, never>): void;
61
+ //# sourceMappingURL=session-results.d.ts.map
@@ -0,0 +1,226 @@
1
+ import { asObject } from './json.js';
2
+ import { ACP_AUTH_REQUIRED_ERROR_CODE } from './constants.js';
3
+ import { accountFailureDetails } from './account-failure.js';
4
+ import { rpcErrorData, rpcErrorRetryable, promotedOpenCodeSessionErrorPayload, formatUsage } from './rpc.js';
5
+ import { findEffortConfigOption, findModelConfigOption, currentModelFromSessionResult, modelSelectionErrorIsRecoverable } from './models.js';
6
+ import { buildAcpSessionNewParams } from './session-params.js';
7
+ import {} from './session-types.js';
8
+ /** `typeof value === 'string' ? value : null` as a named predicate — too trivial to export on its own. */
9
+ function asOptionalString(value) {
10
+ return typeof value === 'string' ? value : null;
11
+ }
12
+ /**
13
+ * Handles a JSON-RPC error frame from the agent.
14
+ *
15
+ * -32603 unexpected-id errors are cleanup noise. Expected-id model selection
16
+ * failures are recoverable; all other RPC errors are real protocol failures
17
+ * for initialize/session/new/session/prompt.
18
+ */
19
+ export function handleRpcError({ state, effects, obj, error, rpcErr, }, _optional = {}) {
20
+ if (isRecoverableModelSelectionError({ state, effects, obj, error })) {
21
+ effects.recoverFromModelSelectionError();
22
+ return;
23
+ }
24
+ if (error?.code === -32603 && obj.id !== state.expectedId) {
25
+ return;
26
+ }
27
+ if (error?.code === ACP_AUTH_REQUIRED_ERROR_CODE && /auth/i.test(rpcErr)) {
28
+ failAuthRequired({ effects, rpcErr });
29
+ return;
30
+ }
31
+ if (awaitingModelSelectionReply({ state, obj }) && effects.model && effects.model !== 'default') {
32
+ effects.fail(`This agent did not accept the model "${effects.model}". Pick a model from its list and retry. (${rpcErr})`, {
33
+ details: { kind: 'model_unsupported', model: effects.model }, retryable: false,
34
+ });
35
+ return;
36
+ }
37
+ failWithRpcError({ effects, obj, rpcErr });
38
+ }
39
+ function failAuthRequired({ effects, rpcErr }) {
40
+ const message = `This agent is not signed in. Sign in to its command-line tool on this computer, then retry. (${rpcErr})`;
41
+ effects.failWithPayload({ message, error: { code: 'AUTH_REQUIRED', message, retryable: false,
42
+ details: accountFailureDetails({ failure: { code: 'AUTH_REQUIRED', message, action: 'sign_in' } }) } });
43
+ }
44
+ function awaitingModelSelectionReply({ state, obj }) {
45
+ return state.setModelRequestId !== null && obj.id === state.setModelRequestId && state.promptRequestId === null;
46
+ }
47
+ /** True when `obj` is a recoverable error answering our own `session/set_model`
48
+ * request, sent before any prompt, for a run that asked for no specific model. */
49
+ function isRecoverableModelSelectionError({ state, effects, obj, error, }) {
50
+ return awaitingModelSelectionReply({ state, obj }) && modelSelectionErrorIsRecoverable({ code: error?.code }) && (!effects.model || effects.model === 'default');
51
+ }
52
+ /** Fails the run for a real RPC error, promoting a known OpenCode session error
53
+ * payload when present and carrying the RPC `data` details and retryability. */
54
+ function failWithRpcError({ effects, obj, rpcErr, }) {
55
+ const details = rpcErrorData({ raw: obj });
56
+ const promotedPayload = promotedOpenCodeSessionErrorPayload({ data: details, fallbackMessage: rpcErr });
57
+ if (promotedPayload) {
58
+ effects.failWithPayload(promotedPayload);
59
+ return;
60
+ }
61
+ const retryable = rpcErrorRetryable({ data: details });
62
+ effects.fail(rpcErr, {
63
+ details,
64
+ ...(retryable === undefined ? {} : { retryable }),
65
+ });
66
+ }
67
+ /** Handles the `initialize` ack: sends `session/load` (resume) or `session/new` (fresh). */
68
+ export function handleInitializeAck({ state, effects, result }, _optional = {}) {
69
+ if (effects.resumeSessionId && asObject({ value: result.agentCapabilities })?.loadSession !== true) {
70
+ effects.fail('This agent cannot reopen a saved conversation (it does not offer session/load); a new conversation is needed.', { details: { reason: 'load_session_unsupported' } });
71
+ return;
72
+ }
73
+ state.expectedId = state.nextId;
74
+ if (effects.resumeSessionId) {
75
+ // Resume the prior upstream session instead of creating a fresh one.
76
+ effects.writeRpc(state.nextId, 'session/load', {
77
+ ...buildAcpSessionNewParams({ cwd: effects.effectiveCwd }, effects.mcpServers
78
+ ? { mcpServers: effects.mcpServers, envFormat: effects.envFormat }
79
+ : { envFormat: effects.envFormat }),
80
+ sessionId: effects.resumeSessionId,
81
+ }, 'session/load');
82
+ }
83
+ else {
84
+ effects.writeRpc(state.nextId, 'session/new', buildAcpSessionNewParams({ cwd: effects.effectiveCwd }, effects.mcpServers ? { mcpServers: effects.mcpServers, envFormat: effects.envFormat } : { envFormat: effects.envFormat }), 'session/new');
85
+ }
86
+ state.nextId += 1;
87
+ }
88
+ /** Sends `session/set_model` (or `session/set_config_option`) when a non-default model was requested. Returns `true` when it did (caller should not send the prompt yet). */
89
+ export function triggerSetModelIfNeeded({ state, effects, }, _optional = {}) {
90
+ if (!state.sessionId || !effects.model || effects.model === 'default')
91
+ return false;
92
+ // Hosts now pin the concrete starting model on every run. When session/new already reports that
93
+ // model, a set_model round-trip is redundant, and a CLI without set_model support would turn it
94
+ // into a fatal explicit-model rejection.
95
+ if (state.activeModel === effects.model)
96
+ return false;
97
+ state.setModelRequestId = state.nextId;
98
+ state.expectedId = state.nextId;
99
+ const setModelMethod = state.modelConfigId ? 'session/set_config_option' : 'session/set_model';
100
+ const setModelParams = state.modelConfigId
101
+ ? { sessionId: state.sessionId, configId: state.modelConfigId, value: effects.model }
102
+ : { sessionId: state.sessionId, modelId: effects.model };
103
+ effects.writeRpc(state.nextId, setModelMethod, setModelParams, setModelMethod);
104
+ state.nextId += 1;
105
+ return true;
106
+ }
107
+ /** Records handshake identity, retaining the requested handle on an ID-free load ack.
108
+ * Mutates only the two session handles; performs no I/O.
109
+ * @complexity O(1) time and space.
110
+ */
111
+ function recordSessionIdentity({ state, result }, { resumeSessionId = null } = {}) {
112
+ // ACP load responses need not repeat the handle supplied in the request.
113
+ state.sessionId = asOptionalString(result.sessionId) ?? resumeSessionId;
114
+ // The durable handle for resuming this session on the next turn.
115
+ state.durableSessionId = asOptionalString(result.openCodeSessionId) ?? state.sessionId;
116
+ }
117
+ function sendEffortOrPrompt({ state, effects }) {
118
+ const effort = effects.effort;
119
+ if (!effort) {
120
+ effects.sendPrompt();
121
+ return;
122
+ }
123
+ const option = findEffortConfigOption({ configOptions: state.configOptions });
124
+ const offered = option?.values ?? [];
125
+ if (!option || !offered.includes(effort)) {
126
+ effects.fail(`This agent does not offer the reasoning effort "${effort}". It offers: ${offered.join(', ') || 'none'}. Pick one of those and retry.`, {
127
+ details: { kind: 'effort_unsupported', effort, offered }, retryable: false,
128
+ });
129
+ return;
130
+ }
131
+ state.effortRequestId = state.nextId;
132
+ state.expectedId = state.nextId;
133
+ effects.writeRpc(state.nextId, 'session/set_config_option', {
134
+ sessionId: state.sessionId, configId: option.configId, value: effort,
135
+ }, 'session/set_config_option');
136
+ state.nextId += 1;
137
+ }
138
+ /** Handles the `session/new` (or `session/load`) ack: records the session id, model config, and either triggers a model switch or sends the prompt. */
139
+ export function handleSessionNewAck({ state, effects, result, rawLine, }, _optional = {}) {
140
+ recordSessionIdentity({ state, result }, { resumeSessionId: effects.resumeSessionId });
141
+ // session/new acknowledged with a session id = handshake done.
142
+ // Invoke the optional callback here instead of relocating its complexity score to a one-line wrapper.
143
+ if (state.sessionId)
144
+ effects.onSessionInit?.();
145
+ // findModelConfigOption returns null or a parsed config with a required string id.
146
+ const modelConfig = findModelConfigOption({ configOptions: result.configOptions });
147
+ state.modelConfigId = modelConfigIdOrNull({ modelConfig });
148
+ state.activeModel = currentModelFromSessionResult({ result });
149
+ state.configOptions = result.configOptions;
150
+ if (state.sessionId && state.activeModel && (!effects.model || effects.model === state.activeModel)) {
151
+ effects.send({ event: 'agent', payload: { type: 'status', label: 'model', model: state.activeModel } });
152
+ }
153
+ if (triggerSetModelIfNeeded({ state, effects }))
154
+ return;
155
+ if (!state.sessionId) {
156
+ effects.fail(`invalid session/new response: ${rawLine}`);
157
+ return;
158
+ }
159
+ sendEffortOrPrompt({ state, effects });
160
+ }
161
+ function modelConfigIdOrNull({ modelConfig }, _optional = {}) { return modelConfig ? modelConfig.configId : null; }
162
+ /** Handles the `session/prompt` ack: fails a turn that reported model activity but produced no visible output, otherwise flushes and finishes cleanly. */
163
+ export function handlePromptResult({ state, effects, result, }, _optional = {}) {
164
+ const usage = formatUsage({ usage: result.usage });
165
+ if (!state.emittedVisibleTextChunk && !state.emittedConcreteToolEvent && effects.modelUnavailableErrorCode) {
166
+ const outputTokens = usage?.output_tokens;
167
+ const hadCompletionTokens = typeof outputTokens === 'number' && outputTokens > 0;
168
+ if (hadCompletionTokens || state.emittedToolCall || state.emittedTextChunk) {
169
+ effects.fail('ACP session completed after reporting model activity, but did not produce visible assistant text, concrete tool results, or artifacts.', {
170
+ retryable: true,
171
+ details: {
172
+ kind: 'acp_no_visible_output',
173
+ output_tokens: outputTokens,
174
+ raw_tool_update_seen: state.emittedToolCall,
175
+ text_chunk_seen: state.emittedTextChunk,
176
+ },
177
+ });
178
+ }
179
+ else {
180
+ effects.fail('ACP session completed without producing any assistant text. Refresh the AMR model list, choose a supported model, and retry this run.', { forceModelUnavailable: true });
181
+ }
182
+ return;
183
+ }
184
+ effects.finishCleanPrompt(result.usage);
185
+ }
186
+ /** Whether an incoming result frame is the ack for an in-flight `session/set_model` (or `set_config_option`) request. */
187
+ export function isModelSetAckExpected({ state, effects, obj, }, _optional = {}) {
188
+ return Boolean(state.sessionId && effects.model && effects.model !== 'default' && obj.id === state.expectedId);
189
+ }
190
+ /** Handles the `session/set_model` (or `set_config_option`) ack: records the confirmed model and sends the prompt. */
191
+ export function handleModelSetAck({ state, effects, result, }, _optional = {}) {
192
+ // `isModelSetAckExpected` already confirmed `effects.model` is a truthy
193
+ // string before this runs; the assertion is only to carry that narrowing
194
+ // across the function boundary for the type checker (it doesn't survive
195
+ // the call), not a behavior change.
196
+ state.activeModel = currentModelFromSessionResult({ result }) ?? effects.model;
197
+ effects.send({ event: 'agent', payload: { type: 'status', label: 'model', model: state.activeModel } });
198
+ if (result.configOptions !== undefined)
199
+ state.configOptions = result.configOptions;
200
+ sendEffortOrPrompt({ state, effects });
201
+ }
202
+ /** Top-level JSON-RPC result dispatcher, keyed by which request `expectedId`/`promptRequestId` is currently outstanding. */
203
+ export function routeResultById({ state, effects, obj, result, rawLine, }, _optional = {}) {
204
+ if (obj.id !== state.expectedId || !result)
205
+ return;
206
+ if (state.expectedId === 1) {
207
+ handleInitializeAck({ state, effects, result });
208
+ return;
209
+ }
210
+ if (state.expectedId === 2) {
211
+ handleSessionNewAck({ state, effects, result, rawLine });
212
+ return;
213
+ }
214
+ if (state.promptRequestId !== null && obj.id === state.promptRequestId) {
215
+ handlePromptResult({ state, effects, result });
216
+ return;
217
+ }
218
+ if (obj.id === state.effortRequestId) {
219
+ effects.sendPrompt();
220
+ return;
221
+ }
222
+ if (isModelSetAckExpected({ state, effects, obj })) {
223
+ handleModelSetAck({ state, effects, result });
224
+ }
225
+ }
226
+ //# sourceMappingURL=session-results.js.map
@@ -0,0 +1,92 @@
1
+ import type { JsonRpcId, UnknownRecord, TimerHandle, AcpChildProcess } from './types.js';
2
+ import { type ArtifactTextSuppressor } from './text-suppression.js';
3
+ import type { createJsonLineStream } from '../core/index.js';
4
+ import type { AcpSessionController, AcpSessionEffects, AcpSessionState, AttachAcpSessionOptions, ResolvedAcpSessionOptions } from './session-types.js';
5
+ interface SuppressionSummary {
6
+ suppressedChars: number;
7
+ suppressedChunks: number;
8
+ openedBlocks: number;
9
+ closedBlocks: number;
10
+ }
11
+ /** Mutable state of one attached ACP session, shared by the helpers below. */
12
+ export interface AcpRun {
13
+ options: AttachAcpSessionOptions;
14
+ resolved: ResolvedAcpSessionOptions;
15
+ child: AcpChildProcess;
16
+ stdin: NonNullable<AcpChildProcess['stdin']>;
17
+ state: AcpSessionState;
18
+ runStartedAt: number;
19
+ effectiveCwd: string;
20
+ emittedFirstTokenStatus: boolean;
21
+ rawAcpShapeDiagnosticCount: number;
22
+ artifactSuppressionDiagnosticCount: number;
23
+ amrStderrRetryTail: string;
24
+ finished: boolean;
25
+ fatal: boolean;
26
+ aborted: boolean;
27
+ stageTimer: TimerHandle | null;
28
+ pendingPermissionRequests: Map<JsonRpcId, () => void>;
29
+ toolCallTextSuppressor: ArtifactTextSuppressor;
30
+ toolCallTextSuppressorLastSuppressedChars: number;
31
+ artifactTextSuppressionSummary: SuppressionSummary;
32
+ toolCallTextSuppressionSummary: SuppressionSummary;
33
+ }
34
+ type FailOptions = {
35
+ forceModelUnavailable?: boolean;
36
+ details?: unknown;
37
+ retryable?: boolean;
38
+ };
39
+ /** Builds the run context, rejecting a child without piped stdin/stdout. */
40
+ export declare function createAcpRun({ options, resolved }: {
41
+ options: AttachAcpSessionOptions;
42
+ resolved: ResolvedAcpSessionOptions;
43
+ }, _optional?: Record<string, never>): AcpRun;
44
+ export declare function sendAgent({ run, payload }: {
45
+ run: AcpRun;
46
+ } & {
47
+ payload: unknown;
48
+ }, _optional?: Record<string, never>): void;
49
+ export declare function clearStageTimer({ run }: {
50
+ run: AcpRun;
51
+ }, _optional?: Record<string, never>): void;
52
+ export declare function resetStageTimer({ run, label }: {
53
+ run: AcpRun;
54
+ } & {
55
+ label: string;
56
+ }, _optional?: Record<string, never>): void;
57
+ export declare function failWithPayload({ run, payload }: {
58
+ run: AcpRun;
59
+ payload: UnknownRecord;
60
+ }, _optional?: Record<string, never>): void;
61
+ export declare function failRun({ run, message }: {
62
+ run: AcpRun;
63
+ message: string;
64
+ }, options?: FailOptions): void;
65
+ export declare function writeRpc({ run, ...rpc }: {
66
+ run: AcpRun;
67
+ } & {
68
+ id: JsonRpcId;
69
+ method: string;
70
+ params: unknown;
71
+ timeoutLabel: string;
72
+ }, _optional?: Record<string, never>): void;
73
+ /** Binds the run to the side-effect bundle the exported ACP handlers consume. */
74
+ export declare function buildAcpEffects({ run }: {
75
+ run: AcpRun;
76
+ }, _optional?: Record<string, never>): AcpSessionEffects;
77
+ type JsonLineParser = ReturnType<typeof createJsonLineStream>;
78
+ /** Connects the child's streams and lifecycle events to the parser and failure paths. */
79
+ export declare function wireAcpProcessListeners({ run, parser }: {
80
+ run: AcpRun;
81
+ parser: JsonLineParser;
82
+ }, _optional?: Record<string, never>): void;
83
+ /** Sends the `initialize` request that opens the ACP handshake. */
84
+ export declare function sendInitialize({ run }: {
85
+ run: AcpRun;
86
+ }, _optional?: Record<string, never>): void;
87
+ /** The public handle `attachAcpSession` returns for one run. */
88
+ export declare function buildAcpController({ run }: {
89
+ run: AcpRun;
90
+ }, _optional?: Record<string, never>): AcpSessionController;
91
+ export {};
92
+ //# sourceMappingURL=session-run.d.ts.map