@openllmsh/sdk 2.10.12-alpha.0 → 2.10.12-alpha.2

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 (634) hide show
  1. package/README.md +27 -7
  2. package/dist/client/chat.d.ts +38 -0
  3. package/dist/client/chat.js +77 -0
  4. package/dist/client/devices.d.ts +70 -0
  5. package/dist/client/devices.js +172 -0
  6. package/dist/client/http.d.ts +24 -0
  7. package/dist/client/http.js +34 -0
  8. package/dist/client/index.d.ts +43 -0
  9. package/dist/client/index.js +57 -0
  10. package/dist/client/relay-mux.d.ts +71 -0
  11. package/dist/client/relay-mux.js +394 -0
  12. package/dist/client/types.d.ts +47 -0
  13. package/dist/client/types.js +5 -0
  14. package/dist/client/vault.d.ts +68 -0
  15. package/dist/client/vault.js +113 -0
  16. package/dist/connect/chat.d.ts +24 -0
  17. package/dist/connect/chat.js +25 -0
  18. package/dist/connect/client.d.ts +50 -0
  19. package/dist/connect/client.js +141 -0
  20. package/dist/connect/config.d.ts +22 -0
  21. package/dist/connect/config.js +22 -0
  22. package/dist/connect/errors.d.ts +32 -0
  23. package/dist/connect/errors.js +85 -0
  24. package/{connect/index.ts → dist/connect/index.d.ts} +7 -7
  25. package/dist/connect/index.js +23 -0
  26. package/dist/connect/oauth.d.ts +51 -0
  27. package/dist/connect/oauth.js +150 -0
  28. package/dist/connect/routes.d.ts +38 -0
  29. package/dist/connect/routes.js +175 -0
  30. package/dist/connect/store.d.ts +26 -0
  31. package/dist/connect/store.js +65 -0
  32. package/dist/mcp/handle.d.ts +6 -0
  33. package/dist/mcp/handle.js +6 -0
  34. package/dist/mcp/index.d.ts +15 -0
  35. package/dist/mcp/index.js +10 -0
  36. package/dist/mcp/server.d.ts +84 -0
  37. package/dist/mcp/server.js +168 -0
  38. package/dist/mcp/tools/marketplace.d.ts +94 -0
  39. package/dist/mcp/tools/marketplace.js +303 -0
  40. package/dist/mcp/tools/memory-client.d.ts +109 -0
  41. package/dist/mcp/tools/memory-client.js +200 -0
  42. package/dist/mcp/tools/memory-config.d.ts +29 -0
  43. package/dist/mcp/tools/memory-config.js +12 -0
  44. package/dist/mcp/tools/memory.d.ts +92 -0
  45. package/dist/mcp/tools/memory.js +312 -0
  46. package/dist/mcp/tools/model-priority.d.ts +16 -0
  47. package/dist/mcp/tools/model-priority.js +87 -0
  48. package/dist/mcp/tools/openllm.d.ts +75 -0
  49. package/dist/mcp/tools/openllm.js +715 -0
  50. package/dist/mcp/types.d.ts +25 -0
  51. package/dist/mcp/types.js +7 -0
  52. package/dist/openapi/call.d.ts +26 -0
  53. package/dist/openapi/call.js +56 -0
  54. package/dist/openapi/index.d.ts +2 -0
  55. package/dist/openapi/index.js +2 -0
  56. package/dist/openapi/openapi.json +80213 -0
  57. package/dist/openapi/operations.d.ts +14 -0
  58. package/dist/openapi/operations.js +2060 -0
  59. package/dist/protocol/access.d.ts +81 -0
  60. package/dist/protocol/access.js +125 -0
  61. package/dist/protocol/agent-prompt-text.d.ts +15 -0
  62. package/{protocol/agent-prompt-text.ts → dist/protocol/agent-prompt-text.js} +9 -14
  63. package/dist/protocol/agent.d.ts +1487 -0
  64. package/dist/protocol/agent.js +787 -0
  65. package/dist/protocol/api-key-syntax.d.ts +58 -0
  66. package/dist/protocol/api-key-syntax.js +73 -0
  67. package/dist/protocol/audio.d.ts +18 -0
  68. package/dist/protocol/audio.js +21 -0
  69. package/dist/protocol/auth.d.ts +126 -0
  70. package/dist/protocol/auth.js +119 -0
  71. package/dist/protocol/changelog.d.ts +69 -0
  72. package/dist/protocol/changelog.js +107 -0
  73. package/dist/protocol/chat.d.ts +789 -0
  74. package/dist/protocol/chat.js +394 -0
  75. package/dist/protocol/client-registry.d.ts +151 -0
  76. package/dist/protocol/client-registry.js +238 -0
  77. package/dist/protocol/config.d.ts +508 -0
  78. package/dist/protocol/config.js +289 -0
  79. package/dist/protocol/control-channel.d.ts +102 -0
  80. package/{protocol/control-channel.ts → dist/protocol/control-channel.js} +33 -61
  81. package/dist/protocol/cooldown-reason.d.ts +30 -0
  82. package/dist/protocol/cooldown-reason.js +44 -0
  83. package/dist/protocol/cost.d.ts +9 -0
  84. package/dist/protocol/cost.js +8 -0
  85. package/dist/protocol/daemon-port.d.ts +2 -0
  86. package/dist/protocol/daemon-port.js +28 -0
  87. package/dist/protocol/daemon.d.ts +2034 -0
  88. package/dist/protocol/daemon.js +1286 -0
  89. package/dist/protocol/default-chains.d.ts +15 -0
  90. package/dist/protocol/default-chains.js +21 -0
  91. package/dist/protocol/device-state.d.ts +223 -0
  92. package/dist/protocol/device-state.js +52 -0
  93. package/dist/protocol/doctor-report-local.d.ts +105 -0
  94. package/{protocol/doctor-report-local.ts → dist/protocol/doctor-report-local.js} +92 -196
  95. package/dist/protocol/doctor-report-policy.d.ts +62 -0
  96. package/{protocol/doctor-report-policy.ts → dist/protocol/doctor-report-policy.js} +23 -76
  97. package/dist/protocol/doctor-report.d.ts +406 -0
  98. package/dist/protocol/doctor-report.js +645 -0
  99. package/dist/protocol/errors.d.ts +17 -0
  100. package/dist/protocol/errors.js +10 -0
  101. package/dist/protocol/execution-selection.d.ts +92 -0
  102. package/{protocol/execution-selection.ts → dist/protocol/execution-selection.js} +38 -63
  103. package/dist/protocol/hop-grant.d.ts +28 -0
  104. package/{protocol/hop-grant.ts → dist/protocol/hop-grant.js} +7 -13
  105. package/dist/protocol/image-edit-parse.d.ts +25 -0
  106. package/dist/protocol/image-edit-parse.js +196 -0
  107. package/dist/protocol/images.d.ts +288 -0
  108. package/dist/protocol/images.js +229 -0
  109. package/dist/protocol/index.d.ts +69 -0
  110. package/dist/protocol/index.js +74 -0
  111. package/dist/protocol/inference-headers.d.ts +3 -0
  112. package/dist/protocol/keepalive.d.ts +36 -0
  113. package/dist/protocol/keepalive.js +51 -0
  114. package/dist/protocol/local-auth.d.ts +125 -0
  115. package/dist/protocol/local-auth.js +227 -0
  116. package/dist/protocol/local-device-control.d.ts +108 -0
  117. package/{protocol/local-device-control.ts → dist/protocol/local-device-control.js} +40 -70
  118. package/dist/protocol/local-provider.d.ts +105 -0
  119. package/dist/protocol/local-provider.js +213 -0
  120. package/dist/protocol/local-session.d.ts +70 -0
  121. package/dist/protocol/local-session.js +87 -0
  122. package/dist/protocol/marketplace.d.ts +190 -0
  123. package/dist/protocol/marketplace.js +140 -0
  124. package/{protocol/media-attempt.ts → dist/protocol/media-attempt.d.ts} +11 -50
  125. package/dist/protocol/media-attempt.js +50 -0
  126. package/dist/protocol/media-bytes.d.ts +8 -0
  127. package/dist/protocol/media-bytes.js +21 -0
  128. package/dist/protocol/media-default.d.ts +56 -0
  129. package/dist/protocol/media-default.js +302 -0
  130. package/{protocol/media-dimensions.ts → dist/protocol/media-dimensions.d.ts} +11 -78
  131. package/dist/protocol/media-dimensions.js +90 -0
  132. package/dist/protocol/media-input.d.ts +20 -0
  133. package/dist/protocol/media-input.js +29 -0
  134. package/dist/protocol/media-model.d.ts +77 -0
  135. package/dist/protocol/media-model.js +89 -0
  136. package/{protocol/media-option-issue.ts → dist/protocol/media-option-issue.d.ts} +25 -53
  137. package/dist/protocol/media-option-issue.js +50 -0
  138. package/dist/protocol/media-types.d.ts +14 -0
  139. package/dist/protocol/media-types.js +61 -0
  140. package/dist/protocol/model-match.d.ts +254 -0
  141. package/dist/protocol/model-match.js +760 -0
  142. package/dist/protocol/model-settings.d.ts +153 -0
  143. package/dist/protocol/model-settings.js +246 -0
  144. package/dist/protocol/models.d.ts +1065 -0
  145. package/dist/protocol/models.js +638 -0
  146. package/dist/protocol/mux.d.ts +350 -0
  147. package/dist/protocol/mux.js +595 -0
  148. package/{protocol/plan-surface.ts → dist/protocol/plan-surface.d.ts} +12 -26
  149. package/dist/protocol/plan-surface.js +39 -0
  150. package/dist/protocol/provider-models.d.ts +8 -0
  151. package/{protocol/provider-models.ts → dist/protocol/provider-models.js} +7 -9
  152. package/dist/protocol/provider-status.d.ts +59 -0
  153. package/dist/protocol/provider-status.js +142 -0
  154. package/dist/protocol/provider-tier.d.ts +34 -0
  155. package/{protocol/provider-tier.ts → dist/protocol/provider-tier.js} +9 -34
  156. package/dist/protocol/provider-usage.d.ts +230 -0
  157. package/dist/protocol/provider-usage.js +214 -0
  158. package/dist/protocol/providers.d.ts +2496 -0
  159. package/dist/protocol/providers.js +723 -0
  160. package/dist/protocol/public-usage-index.d.ts +449 -0
  161. package/dist/protocol/public-usage-index.js +279 -0
  162. package/dist/protocol/realtime-generated.d.ts +29 -0
  163. package/{protocol/realtime-generated.ts → dist/protocol/realtime-generated.js} +3 -5
  164. package/dist/protocol/realtime.d.ts +241 -0
  165. package/{protocol/realtime.ts → dist/protocol/realtime.js} +88 -155
  166. package/dist/protocol/registry-pointer.d.ts +24 -0
  167. package/dist/protocol/registry-pointer.js +78 -0
  168. package/dist/protocol/relay.d.ts +1152 -0
  169. package/{protocol/relay.ts → dist/protocol/relay.js} +237 -370
  170. package/dist/protocol/replay-session.d.ts +4 -0
  171. package/{protocol/replay-session.ts → dist/protocol/replay-session.js} +1 -8
  172. package/dist/protocol/responses.d.ts +303 -0
  173. package/dist/protocol/responses.js +240 -0
  174. package/dist/protocol/semver.d.ts +59 -0
  175. package/dist/protocol/semver.js +171 -0
  176. package/{protocol/setup-mode.ts → dist/protocol/setup-mode.d.ts} +4 -12
  177. package/dist/protocol/setup-mode.js +18 -0
  178. package/dist/protocol/sha256-hex.d.ts +2 -0
  179. package/dist/protocol/sha256-hex.js +93 -0
  180. package/dist/protocol/stats.d.ts +711 -0
  181. package/dist/protocol/stats.js +353 -0
  182. package/dist/protocol/streaming.d.ts +16 -0
  183. package/dist/protocol/streaming.js +15 -0
  184. package/{protocol/subscription-daemon-floors.ts → dist/protocol/subscription-daemon-floors.d.ts} +8 -14
  185. package/dist/protocol/subscription-daemon-floors.js +4 -0
  186. package/dist/protocol/subscription-provider-compat.d.ts +44 -0
  187. package/dist/protocol/subscription-provider-compat.js +67 -0
  188. package/dist/protocol/subscription-provider.d.ts +15 -0
  189. package/dist/protocol/subscription-provider.js +17 -0
  190. package/dist/protocol/team-grant.d.ts +14 -0
  191. package/{protocol/team-grant.ts → dist/protocol/team-grant.js} +0 -3
  192. package/dist/protocol/team-shareable.d.ts +6 -0
  193. package/{protocol/team-shareable.ts → dist/protocol/team-shareable.js} +29 -33
  194. package/dist/protocol/transcription-encoding.d.ts +25 -0
  195. package/dist/protocol/transcription-encoding.js +47 -0
  196. package/{protocol/url-locality-dns.ts → dist/protocol/url-locality-dns.d.ts} +1 -23
  197. package/dist/protocol/url-locality-dns.js +33 -0
  198. package/dist/protocol/url-locality.d.ts +45 -0
  199. package/dist/protocol/url-locality.js +288 -0
  200. package/dist/protocol/usage-snapshots.d.ts +8 -0
  201. package/{protocol/usage-snapshots.ts → dist/protocol/usage-snapshots.js} +1 -2
  202. package/dist/protocol/vendor-cli-install.d.ts +20 -0
  203. package/{protocol/vendor-cli-install.ts → dist/protocol/vendor-cli-install.js} +10 -15
  204. package/dist/protocol/video-job-plan.d.ts +18 -0
  205. package/dist/protocol/video-job-plan.js +44 -0
  206. package/dist/protocol/videos.d.ts +107 -0
  207. package/dist/protocol/videos.js +154 -0
  208. package/dist/tunnel/channel-envelope.d.ts +53 -0
  209. package/dist/tunnel/channel-envelope.js +100 -0
  210. package/dist/tunnel/codec.d.ts +71 -0
  211. package/dist/tunnel/codec.js +151 -0
  212. package/dist/tunnel/device-anchor.d.ts +62 -0
  213. package/dist/tunnel/device-anchor.js +168 -0
  214. package/dist/tunnel/device-control.d.ts +50 -0
  215. package/dist/tunnel/device-control.js +88 -0
  216. package/dist/tunnel/device-grant.d.ts +91 -0
  217. package/dist/tunnel/device-grant.js +105 -0
  218. package/dist/tunnel/fleet.d.ts +28 -0
  219. package/dist/tunnel/fleet.js +41 -0
  220. package/dist/tunnel/index.d.ts +22 -0
  221. package/dist/tunnel/index.js +22 -0
  222. package/dist/tunnel/mux.d.ts +64 -0
  223. package/dist/tunnel/mux.js +449 -0
  224. package/dist/tunnel/peer-link.d.ts +88 -0
  225. package/dist/tunnel/peer-link.js +271 -0
  226. package/dist/tunnel/rtc-auth.d.ts +159 -0
  227. package/dist/tunnel/rtc-auth.js +340 -0
  228. package/dist/tunnel/rtc-duplex.d.ts +52 -0
  229. package/dist/tunnel/rtc-duplex.js +148 -0
  230. package/dist/tunnel/rtc-ice.d.ts +55 -0
  231. package/dist/tunnel/rtc-ice.js +100 -0
  232. package/dist/tunnel/secure.d.ts +179 -0
  233. package/dist/tunnel/secure.js +936 -0
  234. package/dist/tunnel/stream-reset-error.d.ts +6 -0
  235. package/dist/tunnel/stream-reset-error.js +9 -0
  236. package/dist/tunnel/streams.d.ts +244 -0
  237. package/dist/tunnel/streams.js +1071 -0
  238. package/dist/tunnel/team-grant.d.ts +90 -0
  239. package/dist/tunnel/team-grant.js +226 -0
  240. package/dist/tunnel/wire-bytes.d.ts +32 -0
  241. package/dist/tunnel/wire-bytes.js +90 -0
  242. package/dist/vault/api-key.d.ts +71 -0
  243. package/dist/vault/api-key.js +130 -0
  244. package/{vault/argon2.ts → dist/vault/argon2.d.ts} +18 -53
  245. package/dist/vault/argon2.js +82 -0
  246. package/dist/vault/cli-auth-seal.d.ts +35 -0
  247. package/dist/vault/cli-auth-seal.js +78 -0
  248. package/dist/vault/cred-seal.d.ts +18 -0
  249. package/dist/vault/cred-seal.js +86 -0
  250. package/dist/vault/credential.d.ts +21 -0
  251. package/dist/vault/credential.js +26 -0
  252. package/dist/vault/crypto.d.ts +51 -0
  253. package/dist/vault/crypto.js +156 -0
  254. package/dist/vault/daemon-attest.d.ts +68 -0
  255. package/dist/vault/daemon-attest.js +147 -0
  256. package/dist/vault/derive.d.ts +34 -0
  257. package/dist/vault/derive.js +84 -0
  258. package/dist/vault/device-access.d.ts +17 -0
  259. package/dist/vault/device-access.js +77 -0
  260. package/dist/vault/device-anchor.d.ts +42 -0
  261. package/dist/vault/device-anchor.js +90 -0
  262. package/dist/vault/device-control.d.ts +80 -0
  263. package/{vault/device-control.ts → dist/vault/device-control.js} +46 -104
  264. package/dist/vault/handoff.d.ts +102 -0
  265. package/dist/vault/handoff.js +236 -0
  266. package/dist/vault/index.d.ts +21 -0
  267. package/dist/vault/index.js +21 -0
  268. package/dist/vault/passkey.d.ts +82 -0
  269. package/{vault/passkey.ts → dist/vault/passkey.js} +63 -153
  270. package/dist/vault/phrase.d.ts +40 -0
  271. package/{vault/phrase.ts → dist/vault/phrase.js} +17 -23
  272. package/dist/vault/pin.d.ts +46 -0
  273. package/dist/vault/pin.js +92 -0
  274. package/dist/vault/public-key-seal.d.ts +17 -0
  275. package/dist/vault/public-key-seal.js +59 -0
  276. package/dist/vault/seed.d.ts +96 -0
  277. package/dist/vault/seed.js +179 -0
  278. package/dist/vault/team.d.ts +134 -0
  279. package/dist/vault/team.js +217 -0
  280. package/dist/vault/vault-item.d.ts +45 -0
  281. package/dist/vault/vault-item.js +62 -0
  282. package/dist/vault/vault-migrate-digest.d.ts +10 -0
  283. package/dist/vault/vault-migrate-digest.js +22 -0
  284. package/dist/vault/wrapped.d.ts +19 -0
  285. package/dist/vault/wrapped.js +52 -0
  286. package/dist/wire/adapters/messages/anthropic-map.d.ts +8 -0
  287. package/dist/wire/adapters/messages/anthropic-map.js +32 -0
  288. package/dist/wire/adapters/messages/index.d.ts +7 -0
  289. package/dist/wire/adapters/messages/index.js +7 -0
  290. package/dist/wire/adapters/messages/reasoning-from-items.d.ts +14 -0
  291. package/dist/wire/adapters/messages/reasoning-from-items.js +39 -0
  292. package/dist/wire/adapters/messages/reasoning-signature.d.ts +81 -0
  293. package/dist/wire/adapters/messages/reasoning-signature.js +180 -0
  294. package/dist/wire/adapters/messages/request.d.ts +28 -0
  295. package/dist/wire/adapters/messages/request.js +490 -0
  296. package/dist/wire/adapters/messages/response.d.ts +10 -0
  297. package/dist/wire/adapters/messages/response.js +177 -0
  298. package/dist/wire/adapters/messages/streaming.d.ts +134 -0
  299. package/dist/wire/adapters/messages/streaming.js +791 -0
  300. package/dist/wire/adapters/messages/usage.d.ts +20 -0
  301. package/dist/wire/adapters/messages/usage.js +10 -0
  302. package/dist/wire/adapters/responses/index.d.ts +3 -0
  303. package/dist/wire/adapters/responses/index.js +3 -0
  304. package/dist/wire/adapters/responses/request.d.ts +2 -0
  305. package/dist/wire/adapters/responses/request.js +287 -0
  306. package/dist/wire/adapters/responses/response.d.ts +11 -0
  307. package/dist/wire/adapters/responses/response.js +69 -0
  308. package/dist/wire/adapters/responses/streaming.d.ts +2 -0
  309. package/dist/wire/adapters/responses/streaming.js +267 -0
  310. package/dist/wire/features/account-rank.d.ts +61 -0
  311. package/dist/wire/features/account-rank.js +109 -0
  312. package/dist/wire/features/compaction/compact-request.d.ts +69 -0
  313. package/dist/wire/features/compaction/compact-request.js +667 -0
  314. package/dist/wire/features/compaction/compaction-text.d.ts +17 -0
  315. package/dist/wire/features/compaction/compaction-text.js +29 -0
  316. package/dist/wire/features/context-demote.d.ts +15 -0
  317. package/dist/wire/features/context-demote.js +45 -0
  318. package/dist/wire/features/context-overflow-strategy.d.ts +12 -0
  319. package/dist/wire/features/context-overflow-strategy.js +8 -0
  320. package/dist/wire/features/context-skip.d.ts +120 -0
  321. package/{wire/features/context-skip.ts → dist/wire/features/context-skip.js} +23 -57
  322. package/dist/wire/features/conversation-affinity.d.ts +49 -0
  323. package/dist/wire/features/conversation-affinity.js +121 -0
  324. package/dist/wire/features/max-tokens-backfill.d.ts +50 -0
  325. package/dist/wire/features/max-tokens-backfill.js +118 -0
  326. package/dist/wire/features/model-caps.d.ts +7 -0
  327. package/dist/wire/features/model-caps.js +40 -0
  328. package/dist/wire/features/model-settings.d.ts +3 -0
  329. package/dist/wire/features/model-settings.js +13 -0
  330. package/dist/wire/features/output-limit-clamp.d.ts +14 -0
  331. package/dist/wire/features/output-limit-clamp.js +36 -0
  332. package/dist/wire/features/quota-gate.d.ts +16 -0
  333. package/dist/wire/features/quota-gate.js +48 -0
  334. package/dist/wire/index.d.ts +44 -0
  335. package/dist/wire/index.js +44 -0
  336. package/dist/wire/lib/attempt-outcome.d.ts +19 -0
  337. package/dist/wire/lib/attempt-outcome.js +18 -0
  338. package/{wire/lib/canonical/content-part.ts → dist/wire/lib/canonical/content-part.d.ts} +12 -18
  339. package/dist/wire/lib/canonical/content-part.js +11 -0
  340. package/dist/wire/lib/canonical/count-tokens-capability.d.ts +52 -0
  341. package/dist/wire/lib/canonical/count-tokens-capability.js +109 -0
  342. package/{wire/lib/canonical/encoding-select.ts → dist/wire/lib/canonical/encoding-select.d.ts} +7 -24
  343. package/dist/wire/lib/canonical/encoding-select.js +26 -0
  344. package/dist/wire/lib/canonical/image-signature.d.ts +20 -0
  345. package/dist/wire/lib/canonical/image-signature.js +184 -0
  346. package/dist/wire/lib/canonical/image-sse.d.ts +88 -0
  347. package/dist/wire/lib/canonical/image-sse.js +173 -0
  348. package/{wire/lib/canonical/message.ts → dist/wire/lib/canonical/message.d.ts} +2 -20
  349. package/dist/wire/lib/canonical/message.js +31 -0
  350. package/dist/wire/lib/canonical/token-estimate.d.ts +98 -0
  351. package/dist/wire/lib/canonical/token-estimate.js +230 -0
  352. package/dist/wire/lib/encrypted-content.d.ts +22 -0
  353. package/dist/wire/lib/encrypted-content.js +55 -0
  354. package/dist/wire/lib/error-class.d.ts +57 -0
  355. package/dist/wire/lib/error-class.js +97 -0
  356. package/dist/wire/lib/error-envelope.d.ts +20 -0
  357. package/dist/wire/lib/error-envelope.js +53 -0
  358. package/dist/wire/lib/forwarded-headers.d.ts +16 -0
  359. package/{wire/lib/forwarded-headers.ts → dist/wire/lib/forwarded-headers.js} +62 -72
  360. package/dist/wire/lib/provider-error-rules.d.ts +21 -0
  361. package/dist/wire/lib/provider-error-rules.js +20 -0
  362. package/{wire/lib/refusal.ts → dist/wire/lib/refusal.d.ts} +3 -13
  363. package/dist/wire/lib/refusal.js +27 -0
  364. package/dist/wire/lib/responses-apply-patch.d.ts +57 -0
  365. package/dist/wire/lib/responses-apply-patch.js +81 -0
  366. package/dist/wire/lib/responses-namespace.d.ts +27 -0
  367. package/{wire/lib/responses-namespace.ts → dist/wire/lib/responses-namespace.js} +16 -32
  368. package/dist/wire/lib/secret-scrub.d.ts +23 -0
  369. package/dist/wire/lib/secret-scrub.js +72 -0
  370. package/dist/wire/lib/streaming/accumulate.d.ts +12 -0
  371. package/dist/wire/lib/streaming/accumulate.js +187 -0
  372. package/dist/wire/lib/streaming/finish-reason.d.ts +20 -0
  373. package/dist/wire/lib/streaming/finish-reason.js +15 -0
  374. package/{wire/lib/streaming/peek.ts → dist/wire/lib/streaming/peek.d.ts} +13 -82
  375. package/dist/wire/lib/streaming/peek.js +100 -0
  376. package/dist/wire/lib/streaming/provider-decode.d.ts +57 -0
  377. package/dist/wire/lib/streaming/provider-decode.js +210 -0
  378. package/dist/wire/lib/streaming/response-stream.d.ts +16 -0
  379. package/dist/wire/lib/streaming/response-stream.js +64 -0
  380. package/dist/wire/lib/streaming/sse.d.ts +130 -0
  381. package/dist/wire/lib/streaming/sse.js +600 -0
  382. package/dist/wire/lib/streaming/strip-tool-calls.d.ts +14 -0
  383. package/dist/wire/lib/streaming/strip-tool-calls.js +75 -0
  384. package/dist/wire/lib/streaming/upstream-error.d.ts +32 -0
  385. package/dist/wire/lib/streaming/upstream-error.js +45 -0
  386. package/dist/wire/lib/strip-subagent-isolation.d.ts +16 -0
  387. package/dist/wire/lib/strip-subagent-isolation.js +240 -0
  388. package/dist/wire/lib/thinking-signature.d.ts +56 -0
  389. package/{wire/lib/thinking-signature.ts → dist/wire/lib/thinking-signature.js} +77 -84
  390. package/dist/wire/lib/token-ruler/bpe-core.d.ts +105 -0
  391. package/dist/wire/lib/token-ruler/bpe-core.js +398 -0
  392. package/dist/wire/lib/token-ruler/index.d.ts +2 -0
  393. package/dist/wire/lib/token-ruler/index.js +2 -0
  394. package/dist/wire/lib/token-ruler/ruler.d.ts +36 -0
  395. package/dist/wire/lib/token-ruler/ruler.js +50 -0
  396. package/dist/wire/lib/token-ruler/vocab/claude-ranks.d.ts +14 -0
  397. package/dist/wire/lib/token-ruler/vocab/claude-ranks.js +16 -0
  398. package/{wire/lib/token-ruler/vocab/claude.ts → dist/wire/lib/token-ruler/vocab/claude.d.ts} +2 -12
  399. package/dist/wire/lib/token-ruler/vocab/claude.js +8 -0
  400. package/dist/wire/lib/token-ruler/vocab/o200k-ranks.d.ts +3 -0
  401. package/dist/wire/lib/token-ruler/vocab/o200k-ranks.js +18 -0
  402. package/dist/wire/lib/token-ruler/vocab/o200k.d.ts +11 -0
  403. package/dist/wire/lib/token-ruler/vocab/o200k.js +6 -0
  404. package/dist/wire/lib/tool-name-map.d.ts +44 -0
  405. package/dist/wire/lib/tool-name-map.js +186 -0
  406. package/dist/wire/lib/tool-schema.d.ts +15 -0
  407. package/dist/wire/lib/tool-schema.js +307 -0
  408. package/dist/wire/lib/usage-observer.d.ts +9 -0
  409. package/dist/wire/lib/usage-observer.js +108 -0
  410. package/dist/wire/providers/anthropic/adaptive-thinking.d.ts +125 -0
  411. package/dist/wire/providers/anthropic/adaptive-thinking.js +221 -0
  412. package/dist/wire/providers/anthropic/beta-headers.d.ts +44 -0
  413. package/{wire/providers/anthropic/beta-headers.ts → dist/wire/providers/anthropic/beta-headers.js} +57 -79
  414. package/dist/wire/providers/anthropic/index.d.ts +6 -0
  415. package/{wire/providers/anthropic/index.ts → dist/wire/providers/anthropic/index.js} +6 -6
  416. package/dist/wire/providers/anthropic/request.d.ts +12 -0
  417. package/dist/wire/providers/anthropic/request.js +456 -0
  418. package/dist/wire/providers/anthropic/response.d.ts +3 -0
  419. package/dist/wire/providers/anthropic/response.js +126 -0
  420. package/dist/wire/providers/anthropic/streaming.d.ts +28 -0
  421. package/dist/wire/providers/anthropic/streaming.js +268 -0
  422. package/dist/wire/providers/anthropic/web-search-domains.d.ts +7 -0
  423. package/dist/wire/providers/anthropic/web-search-domains.js +36 -0
  424. package/dist/wire/providers/chatgpt/common.d.ts +27 -0
  425. package/{wire/providers/chatgpt/common.ts → dist/wire/providers/chatgpt/common.js} +69 -89
  426. package/dist/wire/providers/chatgpt/index.d.ts +4 -0
  427. package/{wire/providers/chatgpt/index.ts → dist/wire/providers/chatgpt/index.js} +4 -4
  428. package/dist/wire/providers/chatgpt/request.d.ts +132 -0
  429. package/dist/wire/providers/chatgpt/request.js +696 -0
  430. package/dist/wire/providers/chatgpt/streaming.d.ts +69 -0
  431. package/dist/wire/providers/chatgpt/streaming.js +761 -0
  432. package/dist/wire/providers/chatgpt/web-search.d.ts +19 -0
  433. package/dist/wire/providers/chatgpt/web-search.js +55 -0
  434. package/dist/wire/providers/grok/web-search.d.ts +23 -0
  435. package/dist/wire/providers/grok/web-search.js +74 -0
  436. package/dist/wire/providers/kimi/web-search.d.ts +48 -0
  437. package/dist/wire/providers/kimi/web-search.js +106 -0
  438. package/dist/wire/providers/upstream-deny.d.ts +61 -0
  439. package/dist/wire/providers/upstream-deny.js +293 -0
  440. package/dist/wire/providers/upstream-request.d.ts +104 -0
  441. package/dist/wire/providers/upstream-request.js +411 -0
  442. package/package.json +105 -23
  443. package/ARCHITECTURE.md +0 -43
  444. package/client/chat.ts +0 -140
  445. package/client/devices.ts +0 -269
  446. package/client/http.ts +0 -72
  447. package/client/index.ts +0 -129
  448. package/client/relay-mux.ts +0 -547
  449. package/client/types.ts +0 -51
  450. package/client/vault.ts +0 -239
  451. package/connect/chat.ts +0 -58
  452. package/connect/client.ts +0 -240
  453. package/connect/config.ts +0 -47
  454. package/connect/errors.ts +0 -121
  455. package/connect/oauth.ts +0 -265
  456. package/connect/routes.ts +0 -234
  457. package/connect/store.ts +0 -107
  458. package/mcp/handle.ts +0 -24
  459. package/mcp/index.ts +0 -76
  460. package/mcp/server.ts +0 -319
  461. package/mcp/tools/marketplace.ts +0 -439
  462. package/mcp/tools/memory-client.ts +0 -297
  463. package/mcp/tools/memory-config.ts +0 -32
  464. package/mcp/tools/memory.ts +0 -369
  465. package/mcp/tools/model-priority.ts +0 -88
  466. package/mcp/tools/openllm.ts +0 -883
  467. package/mcp/types.ts +0 -28
  468. package/openapi/call.ts +0 -90
  469. package/openapi/index.ts +0 -8
  470. package/openapi/openapi.json +0 -80213
  471. package/openapi/operations.ts +0 -2075
  472. package/protocol/CONTRIBUTING.md +0 -21
  473. package/protocol/README.md +0 -134
  474. package/protocol/access.ts +0 -186
  475. package/protocol/agent.ts +0 -991
  476. package/protocol/api-key-syntax.ts +0 -105
  477. package/protocol/assets/openllm-light.svg +0 -18
  478. package/protocol/assets/openllm.svg +0 -18
  479. package/protocol/audio.ts +0 -29
  480. package/protocol/auth.ts +0 -142
  481. package/protocol/changelog.ts +0 -155
  482. package/protocol/chat.ts +0 -458
  483. package/protocol/client-registry.ts +0 -356
  484. package/protocol/config.ts +0 -345
  485. package/protocol/cooldown-reason.ts +0 -78
  486. package/protocol/cost.ts +0 -10
  487. package/protocol/daemon-port.ts +0 -31
  488. package/protocol/daemon.ts +0 -1524
  489. package/protocol/default-chains.ts +0 -66
  490. package/protocol/device-state.ts +0 -85
  491. package/protocol/doctor-report.ts +0 -947
  492. package/protocol/errors.ts +0 -14
  493. package/protocol/image-edit-parse.ts +0 -263
  494. package/protocol/images.ts +0 -298
  495. package/protocol/index.ts +0 -74
  496. package/protocol/keepalive.ts +0 -69
  497. package/protocol/local-auth.ts +0 -300
  498. package/protocol/local-provider.ts +0 -288
  499. package/protocol/local-session.ts +0 -118
  500. package/protocol/marketplace.ts +0 -187
  501. package/protocol/media-bytes.ts +0 -28
  502. package/protocol/media-default.ts +0 -357
  503. package/protocol/media-input.ts +0 -61
  504. package/protocol/media-model.ts +0 -142
  505. package/protocol/media-types.ts +0 -70
  506. package/protocol/model-match.ts +0 -1051
  507. package/protocol/model-settings.ts +0 -327
  508. package/protocol/models.ts +0 -767
  509. package/protocol/mux.ts +0 -722
  510. package/protocol/provider-status.ts +0 -206
  511. package/protocol/provider-usage.ts +0 -263
  512. package/protocol/providers.ts +0 -901
  513. package/protocol/public-usage-index.ts +0 -354
  514. package/protocol/registry-pointer.ts +0 -118
  515. package/protocol/responses.ts +0 -280
  516. package/protocol/semver.ts +0 -182
  517. package/protocol/sha256-hex.ts +0 -98
  518. package/protocol/stats.ts +0 -406
  519. package/protocol/streaming.ts +0 -19
  520. package/protocol/subscription-provider-compat.ts +0 -104
  521. package/protocol/subscription-provider.ts +0 -32
  522. package/protocol/transcription-encoding.ts +0 -76
  523. package/protocol/url-locality.ts +0 -288
  524. package/protocol/video-job-plan.ts +0 -50
  525. package/protocol/videos.ts +0 -227
  526. package/tsconfig.json +0 -14
  527. package/tunnel/ARCHITECTURE.md +0 -111
  528. package/tunnel/assets/openllm-light.svg +0 -18
  529. package/tunnel/assets/openllm.svg +0 -18
  530. package/tunnel/channel-envelope.ts +0 -139
  531. package/tunnel/codec.ts +0 -191
  532. package/tunnel/device-anchor.ts +0 -229
  533. package/tunnel/device-control.ts +0 -118
  534. package/tunnel/device-grant.ts +0 -173
  535. package/tunnel/fleet.ts +0 -77
  536. package/tunnel/index.ts +0 -22
  537. package/tunnel/mux.ts +0 -580
  538. package/tunnel/peer-link.ts +0 -390
  539. package/tunnel/rtc-auth.ts +0 -415
  540. package/tunnel/rtc-duplex.ts +0 -187
  541. package/tunnel/rtc-ice.ts +0 -136
  542. package/tunnel/secure.ts +0 -1298
  543. package/tunnel/stream-reset-error.ts +0 -14
  544. package/tunnel/streams.ts +0 -1430
  545. package/tunnel/team-grant.ts +0 -302
  546. package/tunnel/wire-bytes.ts +0 -102
  547. package/vault/ARCHITECTURE.md +0 -470
  548. package/vault/api-key.ts +0 -190
  549. package/vault/cli-auth-seal.ts +0 -157
  550. package/vault/cred-seal.ts +0 -146
  551. package/vault/credential.ts +0 -55
  552. package/vault/crypto.ts +0 -210
  553. package/vault/daemon-attest.ts +0 -229
  554. package/vault/derive.ts +0 -113
  555. package/vault/device-access.ts +0 -87
  556. package/vault/device-anchor.ts +0 -185
  557. package/vault/handoff.ts +0 -396
  558. package/vault/index.ts +0 -21
  559. package/vault/pin.ts +0 -153
  560. package/vault/public-key-seal.ts +0 -131
  561. package/vault/seed.ts +0 -272
  562. package/vault/team.ts +0 -355
  563. package/vault/vault-item.ts +0 -131
  564. package/vault/vault-migrate-digest.ts +0 -29
  565. package/vault/wrapped.ts +0 -77
  566. package/wire/ARCHITECTURE.md +0 -90
  567. package/wire/CONTRIBUTING.md +0 -19
  568. package/wire/adapters/messages/anthropic-map.ts +0 -37
  569. package/wire/adapters/messages/index.ts +0 -7
  570. package/wire/adapters/messages/reasoning-from-items.ts +0 -38
  571. package/wire/adapters/messages/reasoning-signature.ts +0 -243
  572. package/wire/adapters/messages/request.ts +0 -574
  573. package/wire/adapters/messages/response.ts +0 -215
  574. package/wire/adapters/messages/streaming.ts +0 -1027
  575. package/wire/adapters/messages/usage.ts +0 -43
  576. package/wire/adapters/responses/index.ts +0 -3
  577. package/wire/adapters/responses/request.ts +0 -395
  578. package/wire/adapters/responses/response.ts +0 -88
  579. package/wire/adapters/responses/streaming.ts +0 -344
  580. package/wire/assets/openllm-light.svg +0 -18
  581. package/wire/assets/openllm.svg +0 -18
  582. package/wire/features/account-rank.ts +0 -166
  583. package/wire/features/compaction/compact-request.ts +0 -862
  584. package/wire/features/compaction/compaction-text.ts +0 -43
  585. package/wire/features/context-demote.ts +0 -47
  586. package/wire/features/context-overflow-strategy.ts +0 -26
  587. package/wire/features/conversation-affinity.ts +0 -144
  588. package/wire/features/max-tokens-backfill.ts +0 -141
  589. package/wire/features/model-caps.ts +0 -53
  590. package/wire/features/model-settings.ts +0 -24
  591. package/wire/features/output-limit-clamp.ts +0 -64
  592. package/wire/features/quota-gate.ts +0 -85
  593. package/wire/index.ts +0 -44
  594. package/wire/lib/attempt-outcome.ts +0 -43
  595. package/wire/lib/canonical/count-tokens-capability.ts +0 -138
  596. package/wire/lib/canonical/image-signature.ts +0 -202
  597. package/wire/lib/canonical/image-sse.ts +0 -216
  598. package/wire/lib/canonical/token-estimate.ts +0 -266
  599. package/wire/lib/encrypted-content.ts +0 -66
  600. package/wire/lib/error-class.ts +0 -154
  601. package/wire/lib/error-envelope.ts +0 -56
  602. package/wire/lib/provider-error-rules.ts +0 -48
  603. package/wire/lib/responses-apply-patch.ts +0 -104
  604. package/wire/lib/secret-scrub.ts +0 -101
  605. package/wire/lib/streaming/accumulate.ts +0 -221
  606. package/wire/lib/streaming/finish-reason.ts +0 -33
  607. package/wire/lib/streaming/provider-decode.ts +0 -259
  608. package/wire/lib/streaming/response-stream.ts +0 -71
  609. package/wire/lib/streaming/sse.ts +0 -699
  610. package/wire/lib/streaming/strip-tool-calls.ts +0 -95
  611. package/wire/lib/streaming/upstream-error.ts +0 -58
  612. package/wire/lib/strip-subagent-isolation.ts +0 -284
  613. package/wire/lib/token-ruler/bpe-core.ts +0 -426
  614. package/wire/lib/token-ruler/index.ts +0 -2
  615. package/wire/lib/token-ruler/ruler.ts +0 -79
  616. package/wire/lib/token-ruler/vocab/claude-ranks.ts +0 -16
  617. package/wire/lib/token-ruler/vocab/o200k-ranks.ts +0 -18
  618. package/wire/lib/token-ruler/vocab/o200k.ts +0 -19
  619. package/wire/lib/tool-name-map.ts +0 -271
  620. package/wire/lib/tool-schema.ts +0 -353
  621. package/wire/lib/usage-observer.ts +0 -125
  622. package/wire/providers/anthropic/adaptive-thinking.ts +0 -291
  623. package/wire/providers/anthropic/request.ts +0 -607
  624. package/wire/providers/anthropic/response.ts +0 -155
  625. package/wire/providers/anthropic/streaming.ts +0 -315
  626. package/wire/providers/anthropic/web-search-domains.ts +0 -49
  627. package/wire/providers/chatgpt/request.ts +0 -959
  628. package/wire/providers/chatgpt/streaming.ts +0 -1007
  629. package/wire/providers/chatgpt/web-search.ts +0 -63
  630. package/wire/providers/grok/web-search.ts +0 -87
  631. package/wire/providers/kimi/web-search.ts +0 -145
  632. package/wire/providers/upstream-deny.ts +0 -355
  633. package/wire/providers/upstream-request.ts +0 -619
  634. /package/{protocol/inference-headers.ts → dist/protocol/inference-headers.js} +0 -0
@@ -0,0 +1,1487 @@
1
+ /**
2
+ * Agent session protocol — the structured replacement for remote PTY
3
+ * mirroring (docs/plan/2026-10-23-agent-sessions-replace-remote-pty.md).
4
+ *
5
+ * A consumer opens a mux stream with {@link AgentStreamOpenPayload}
6
+ * (`kind:"agent"`, seed-gated on the daemon) or reaches the daemon's loopback
7
+ * agent endpoint, then exchanges NDJSON lines over the flow-controlled DATA
8
+ * channel:
9
+ *
10
+ * consumer → daemon : {@link AgentCommand} (start / attach / send /
11
+ * interrupt / respond / close / attachment_get /
12
+ * set_model / delete_session / history_get)
13
+ * daemon → consumer : {@link AgentEvent} (session / turn / item / content /
14
+ * request / user-input / token-usage / runtime /
15
+ * attachment.data / history.page)
16
+ *
17
+ * History is paged (after t3code's windowed thread detail): an attach replays
18
+ * only the LATEST window of the session, ending on a turn boundary, then a
19
+ * {@link AgentHistoryPageEvent} names the opaque cursor before that window.
20
+ * `history_get{before}` returns the adjacent, strictly older page.
21
+ *
22
+ * The event families are a trimmed subset of t3code's `ProviderRuntimeEvent`:
23
+ * no multi-CLI orchestration, no event-sourcing / checkpoint / git tooling, no
24
+ * terminal drawer, no realtime-audio, account or MCP-OAuth events. Every
25
+ * engine adapter on the daemon emits this one stream, so the UI renders one
26
+ * vocabulary whichever engine runs the session.
27
+ *
28
+ * Forward compatibility: an event whose `type` this build does not know
29
+ * decodes to `null` and is dropped by consumers. Commands are validated
30
+ * strictly by the serving daemon.
31
+ */
32
+ import { Schema as S } from "effect";
33
+ /**
34
+ * Capability advertising `kind:"agent"` stream support. Consumers MUST check
35
+ * {@link hasAgentCap} before OPEN; a peer without it gets "update your device".
36
+ */
37
+ export declare const AGENT_CAP = "agent1";
38
+ /** Returns whether an open-vocabulary capability list advertises agent sessions. */
39
+ export declare const hasAgentCap: (caps: readonly string[] | undefined) => boolean;
40
+ /**
41
+ * Bound on ONE NDJSON agent line (JSON-encoded UTF-8 bytes, including the
42
+ * trailing `\n`). Larger than the realtime bound because a `send` command may
43
+ * carry inline attachments; a line (or unterminated remainder) over the bound
44
+ * is an overflow, never a growing buffer.
45
+ */
46
+ export declare const AGENT_MAX_LINE_BYTES: number;
47
+ /** Max characters of one prompt. */
48
+ export declare const AGENT_MAX_PROMPT_LENGTH: number;
49
+ /**
50
+ * Daemon loopback route Claude's hooks post to (`openllm exec agent hook`):
51
+ * busy/idle and PermissionRequest for agent sessions. Admitted like the other
52
+ * `/local/*` routes (loopback peer + Host, local control capability).
53
+ * Body: `{session_id, event, payload}`; reply: `{output}` (the hook's stdout
54
+ * JSON) or `{}` for no output.
55
+ */
56
+ export declare const AGENT_HOOK_LOCAL_PATH = "/local/agent-hook";
57
+ /**
58
+ * Claude hook events `openllm exec agent hook` forwards. `SessionStart` is the
59
+ * engine's readiness signal: Claude runs it once the TUI is up (after any
60
+ * folder-trust dialog), so a queued web prompt is pasted only then.
61
+ */
62
+ export declare const AGENT_HOOK_EVENTS: readonly ["PermissionRequest", "PreToolUse", "Stop", "SessionStart"];
63
+ /** Max inline attachments on one `send`. */
64
+ export declare const AGENT_MAX_ATTACHMENTS = 8;
65
+ /** Max base64 characters of one inline attachment. */
66
+ export declare const AGENT_MAX_ATTACHMENT_BASE64_LENGTH: number;
67
+ /**
68
+ * Engines an agent session can run. Each id is the `openllm <client>` the
69
+ * daemon launches the engine through (same overlay, gateway URL, key, model
70
+ * mapping), so a session's inference is routed through openllm whatever
71
+ * model the user picked.
72
+ */
73
+ export declare const AgentEngine: S.Literals<readonly ["claude", "codex"]>;
74
+ export type TAgentEngine = S.Schema.Type<typeof AgentEngine>;
75
+ /**
76
+ * Agent session id: daemon-minted (a UUID), the consumer's own record id, or
77
+ * a vendor session id for attach/resume (Claude / Codex ids are UUIDs). The
78
+ * id names the session host's registry dir and its attachments dir, so it is
79
+ * the local session id itself: url-safe, no `.`, so never `.` / `..`.
80
+ */
81
+ export declare const AGENT_SESSION_ID_PATTERN: RegExp;
82
+ export declare const AgentSessionId: S.String;
83
+ export type TAgentSessionId = S.Schema.Type<typeof AgentSessionId>;
84
+ /**
85
+ * Length caps (UTF-16 code units, as `String.length`) of an event's short
86
+ * label fields (titles, messages, option labels), its detail text, and a tool
87
+ * call's `tool_name`. An event over one fails to decode and consumers drop it,
88
+ * so builders clip to these.
89
+ */
90
+ export declare const AGENT_SHORT_TEXT_MAX_LENGTH = 256;
91
+ export declare const AGENT_DETAIL_TEXT_MAX_LENGTH: number;
92
+ export declare const AGENT_TOOL_NAME_MAX_LENGTH = 128;
93
+ /**
94
+ * Mux `kind:"agent"` OPEN payload — folded into `StreamOpenPayload` in
95
+ * `./mux`. Carries nothing but the kind: the session itself is driven by
96
+ * {@link AgentCommand} lines on the stream, so one OPEN shape serves start,
97
+ * attach and resume.
98
+ */
99
+ export declare const AgentStreamOpenPayload: S.Struct<{
100
+ readonly kind: S.Literal<"agent">;
101
+ }>;
102
+ export type TAgentStreamOpenPayload = S.Schema.Type<typeof AgentStreamOpenPayload>;
103
+ export declare const AgentAttachment: S.Struct<{
104
+ readonly kind: S.Literals<readonly ["image", "file"]>;
105
+ readonly name: S.optional<S.String>;
106
+ readonly media_type: S.String;
107
+ /** Base64 bytes. */
108
+ readonly data: S.String;
109
+ }>;
110
+ export type TAgentAttachment = S.Schema.Type<typeof AgentAttachment>;
111
+ /**
112
+ * Metadata for an attachment that was saved on the device for a turn. The
113
+ * `name` is the on-disk basename under the session's attachments dir (what
114
+ * {@link AgentAttachmentGetCommand} looks up) — not the original upload name
115
+ * when they differ. Optional on `turn.started` so terminal prompts and older
116
+ * daemons stay compatible.
117
+ */
118
+ export declare const AgentAttachmentMeta: S.Struct<{
119
+ readonly name: S.String;
120
+ readonly mime: S.String;
121
+ readonly size: S.Number;
122
+ }>;
123
+ export type TAgentAttachmentMeta = S.Schema.Type<typeof AgentAttachmentMeta>;
124
+ /** Decoded-byte cap mirroring {@link AGENT_MAX_ATTACHMENT_BASE64_LENGTH}. */
125
+ export declare const AGENT_MAX_ATTACHMENT_BYTES: number;
126
+ /** Decision on an approval request (`request.opened`). */
127
+ export declare const AgentRequestDecision: S.Literals<readonly ["accept", "accept_for_session", "decline", "cancel"]>;
128
+ export type TAgentRequestDecision = S.Schema.Type<typeof AgentRequestDecision>;
129
+ /** Answers to a `user-input.requested`, keyed by question id. */
130
+ export declare const AgentUserInputAnswers: S.$Record<S.String, S.Union<readonly [S.String, S.$Array<S.String>]>>;
131
+ export type TAgentUserInputAnswers = S.Schema.Type<typeof AgentUserInputAnswers>;
132
+ export declare const AgentStartCommand: S.Struct<{
133
+ readonly type: S.Literal<"start">;
134
+ readonly id: S.optional<S.String>;
135
+ readonly engine: S.Literals<readonly ["claude", "codex"]>;
136
+ /** Gateway model id; omitted → the engine's openllm default. */
137
+ readonly model: S.optional<S.String>;
138
+ /** Omitted → the daemon user's home directory. */
139
+ readonly cwd: S.optional<S.String>;
140
+ /**
141
+ * Per-session opt-in to the engine's skip-permissions mode
142
+ * (`--dangerously-skip-permissions` or the vendor equivalent). Default off:
143
+ * approvals surface as `request.opened` events.
144
+ */
145
+ readonly skip_permissions: S.optional<S.Boolean>;
146
+ readonly title: S.optional<S.String>;
147
+ /**
148
+ * The id the new session takes (the consumer's own record id, e.g. the web's
149
+ * cloud session row). Omitted → the daemon mints one. One id end to end (the
150
+ * cloud row, the session host, Claude's transcript) is what lets a reload
151
+ * re-attach and a running row match the daemon's status.
152
+ */
153
+ readonly session_id: S.optional<S.String>;
154
+ }>;
155
+ export type TAgentStartCommand = S.Schema.Type<typeof AgentStartCommand>;
156
+ export declare const AgentAttachCommand: S.Struct<{
157
+ readonly type: S.Literal<"attach">;
158
+ readonly id: S.optional<S.String>;
159
+ readonly session_id: S.String;
160
+ /** Engine of the target session when the consumer knows it (local index). */
161
+ readonly engine: S.optional<S.Literals<readonly ["claude", "codex"]>>;
162
+ /**
163
+ * The session was started with skip-permissions: a resume (the session is
164
+ * not running) relaunches the engine the same way. Ignored when joining a
165
+ * live session, which keeps the mode it runs in.
166
+ */
167
+ readonly skip_permissions: S.optional<S.Boolean>;
168
+ }>;
169
+ export type TAgentAttachCommand = S.Schema.Type<typeof AgentAttachCommand>;
170
+ export declare const AgentSendCommand: S.Struct<{
171
+ readonly type: S.Literal<"send">;
172
+ readonly id: S.optional<S.String>;
173
+ readonly prompt: S.String;
174
+ readonly attachments: S.optional<S.$Array<S.Struct<{
175
+ readonly kind: S.Literals<readonly ["image", "file"]>;
176
+ readonly name: S.optional<S.String>;
177
+ readonly media_type: S.String;
178
+ /** Base64 bytes. */
179
+ readonly data: S.String;
180
+ }>>>;
181
+ }>;
182
+ export type TAgentSendCommand = S.Schema.Type<typeof AgentSendCommand>;
183
+ /**
184
+ * Deliver the queued prompts NOW instead of after the running turn. Plain,
185
+ * they join the running turn at its next tool boundary and running tools
186
+ * finish. With `interrupt`, the engine's own send-now (Claude Code's
187
+ * ctrl+enter) runs: running shells move to the background and tools that
188
+ * can't (an MCP call) are stopped — consumers ask the user before setting it.
189
+ * A daemon that predates it rejects the line; consumers offer it only after
190
+ * a `queue.updated` showed the daemon queues.
191
+ */
192
+ export declare const AgentSendNowCommand: S.Struct<{
193
+ readonly type: S.Literal<"send_now">;
194
+ readonly id: S.optional<S.String>;
195
+ readonly interrupt: S.optional<S.Boolean>;
196
+ }>;
197
+ export type TAgentSendNowCommand = S.Schema.Type<typeof AgentSendNowCommand>;
198
+ /** Resume a queue that an interrupt deliberately paused. */
199
+ export declare const AgentResumeQueueCommand: S.Struct<{
200
+ readonly type: S.Literal<"resume_queue">;
201
+ readonly id: S.optional<S.String>;
202
+ }>;
203
+ export type TAgentResumeQueueCommand = S.Schema.Type<typeof AgentResumeQueueCommand>;
204
+ /** Remove one queued prompt without affecting the active turn. */
205
+ export declare const AgentCancelQueuedCommand: S.Struct<{
206
+ readonly type: S.Literal<"cancel_queued">;
207
+ readonly id: S.optional<S.String>;
208
+ readonly queue_id: S.String;
209
+ }>;
210
+ export type TAgentCancelQueuedCommand = S.Schema.Type<typeof AgentCancelQueuedCommand>;
211
+ export declare const AgentInterruptCommand: S.Struct<{
212
+ readonly type: S.Literal<"interrupt">;
213
+ readonly id: S.optional<S.String>;
214
+ /** Omitted → the active turn. */
215
+ readonly turn_id: S.optional<S.String>;
216
+ }>;
217
+ export type TAgentInterruptCommand = S.Schema.Type<typeof AgentInterruptCommand>;
218
+ /**
219
+ * Answer a pending approval (`decision`) or user-input request (`answers`).
220
+ * Exactly one of the two is present.
221
+ */
222
+ export declare const AgentRespondCommand: S.Struct<{
223
+ readonly type: S.Literal<"respond">;
224
+ readonly id: S.optional<S.String>;
225
+ readonly request_id: S.String;
226
+ readonly decision: S.optional<S.Literals<readonly ["accept", "accept_for_session", "decline", "cancel"]>>;
227
+ readonly answers: S.optional<S.$Record<S.String, S.Union<readonly [S.String, S.$Array<S.String>]>>>;
228
+ }>;
229
+ export type TAgentRespondCommand = S.Schema.Type<typeof AgentRespondCommand>;
230
+ export declare const AgentCloseCommand: S.Struct<{
231
+ readonly type: S.Literal<"close">;
232
+ readonly id: S.optional<S.String>;
233
+ }>;
234
+ export type TAgentCloseCommand = S.Schema.Type<typeof AgentCloseCommand>;
235
+ /**
236
+ * Fetch one attachment from the current session's on-device attachments dir.
237
+ * `name` is the basename recorded on `turn.started.attachments` (no path
238
+ * separators). The daemon refuses traversal / absolute / symlink-escape names
239
+ * and streams the bytes back as one or more {@link AgentAttachmentDataEvent}
240
+ * lines under the same `command_id`.
241
+ */
242
+ export declare const AgentAttachmentGetCommand: S.Struct<{
243
+ readonly type: S.Literal<"attachment_get">;
244
+ readonly id: S.optional<S.String>;
245
+ readonly name: S.String;
246
+ }>;
247
+ export type TAgentAttachmentGetCommand = S.Schema.Type<typeof AgentAttachmentGetCommand>;
248
+ /**
249
+ * A model id a running session can switch to: gateway ids and Claude aliases
250
+ * (`ultra`, `sonnet`, `openai/gpt-5`, `claude-opus-4-5[1m]`). No whitespace or
251
+ * control characters: it is typed into the engine's own `/model` command.
252
+ */
253
+ export declare const AGENT_SWITCH_MODEL_PATTERN: RegExp;
254
+ /**
255
+ * Switch the running session's model (Claude: its own `/model <id>`, applied
256
+ * when the session is idle, queued while a turn runs). Confirmed by a
257
+ * `session.configured` event once the engine reports the change.
258
+ */
259
+ export declare const AgentSetModelCommand: S.Struct<{
260
+ readonly type: S.Literal<"set_model">;
261
+ readonly id: S.optional<S.String>;
262
+ readonly model: S.String;
263
+ }>;
264
+ export type TAgentSetModelCommand = S.Schema.Type<typeof AgentSetModelCommand>;
265
+ /**
266
+ * Delete one session from this device: stop its process if it runs (here or
267
+ * in a terminal), then remove its attachments, Claude's transcript
268
+ * (`~/.claude/projects/<slug of its cwd>/<id>.jsonl`) and its lines in
269
+ * `~/.claude/history.jsonl`. Stream-level (needs no bound session). Answered
270
+ * by `session.deleted`, or a `runtime.error`. `close` is the non-destructive
271
+ * Stop: it kills the process and keeps the history.
272
+ */
273
+ export declare const AgentDeleteSessionCommand: S.Struct<{
274
+ readonly type: S.Literal<"delete_session">;
275
+ readonly id: S.optional<S.String>;
276
+ readonly session_id: S.String;
277
+ }>;
278
+ export type TAgentDeleteSessionCommand = S.Schema.Type<typeof AgentDeleteSessionCommand>;
279
+ /** Turns one `history_get` page holds at most. */
280
+ export declare const AGENT_HISTORY_MAX_PAGE_TURNS = 100;
281
+ /** Events one `history.page` carries at most. */
282
+ export declare const AGENT_HISTORY_MAX_PAGE_EVENTS = 4000;
283
+ /**
284
+ * Older history of the bound session: the turns strictly before `before`
285
+ * (a cursor from an earlier `history.page`), newest `limit` of them. Answered
286
+ * by one `history.page` carrying the events, under the same `command_id`.
287
+ */
288
+ export declare const AgentHistoryGetCommand: S.Struct<{
289
+ readonly type: S.Literal<"history_get">;
290
+ readonly id: S.optional<S.String>;
291
+ readonly before: S.String;
292
+ readonly limit: S.optional<S.Number>;
293
+ }>;
294
+ export type TAgentHistoryGetCommand = S.Schema.Type<typeof AgentHistoryGetCommand>;
295
+ /** One consumer → daemon command line. */
296
+ export declare const AgentCommand: S.Union<readonly [S.Struct<{
297
+ readonly type: S.Literal<"start">;
298
+ readonly id: S.optional<S.String>;
299
+ readonly engine: S.Literals<readonly ["claude", "codex"]>;
300
+ /** Gateway model id; omitted → the engine's openllm default. */
301
+ readonly model: S.optional<S.String>;
302
+ /** Omitted → the daemon user's home directory. */
303
+ readonly cwd: S.optional<S.String>;
304
+ /**
305
+ * Per-session opt-in to the engine's skip-permissions mode
306
+ * (`--dangerously-skip-permissions` or the vendor equivalent). Default off:
307
+ * approvals surface as `request.opened` events.
308
+ */
309
+ readonly skip_permissions: S.optional<S.Boolean>;
310
+ readonly title: S.optional<S.String>;
311
+ /**
312
+ * The id the new session takes (the consumer's own record id, e.g. the web's
313
+ * cloud session row). Omitted → the daemon mints one. One id end to end (the
314
+ * cloud row, the session host, Claude's transcript) is what lets a reload
315
+ * re-attach and a running row match the daemon's status.
316
+ */
317
+ readonly session_id: S.optional<S.String>;
318
+ }>, S.Struct<{
319
+ readonly type: S.Literal<"attach">;
320
+ readonly id: S.optional<S.String>;
321
+ readonly session_id: S.String;
322
+ /** Engine of the target session when the consumer knows it (local index). */
323
+ readonly engine: S.optional<S.Literals<readonly ["claude", "codex"]>>;
324
+ /**
325
+ * The session was started with skip-permissions: a resume (the session is
326
+ * not running) relaunches the engine the same way. Ignored when joining a
327
+ * live session, which keeps the mode it runs in.
328
+ */
329
+ readonly skip_permissions: S.optional<S.Boolean>;
330
+ }>, S.Struct<{
331
+ readonly type: S.Literal<"send">;
332
+ readonly id: S.optional<S.String>;
333
+ readonly prompt: S.String;
334
+ readonly attachments: S.optional<S.$Array<S.Struct<{
335
+ readonly kind: S.Literals<readonly ["image", "file"]>;
336
+ readonly name: S.optional<S.String>;
337
+ readonly media_type: S.String;
338
+ /** Base64 bytes. */
339
+ readonly data: S.String;
340
+ }>>>;
341
+ }>, S.Struct<{
342
+ readonly type: S.Literal<"send_now">;
343
+ readonly id: S.optional<S.String>;
344
+ readonly interrupt: S.optional<S.Boolean>;
345
+ }>, S.Struct<{
346
+ readonly type: S.Literal<"resume_queue">;
347
+ readonly id: S.optional<S.String>;
348
+ }>, S.Struct<{
349
+ readonly type: S.Literal<"cancel_queued">;
350
+ readonly id: S.optional<S.String>;
351
+ readonly queue_id: S.String;
352
+ }>, S.Struct<{
353
+ readonly type: S.Literal<"interrupt">;
354
+ readonly id: S.optional<S.String>;
355
+ /** Omitted → the active turn. */
356
+ readonly turn_id: S.optional<S.String>;
357
+ }>, S.Struct<{
358
+ readonly type: S.Literal<"respond">;
359
+ readonly id: S.optional<S.String>;
360
+ readonly request_id: S.String;
361
+ readonly decision: S.optional<S.Literals<readonly ["accept", "accept_for_session", "decline", "cancel"]>>;
362
+ readonly answers: S.optional<S.$Record<S.String, S.Union<readonly [S.String, S.$Array<S.String>]>>>;
363
+ }>, S.Struct<{
364
+ readonly type: S.Literal<"close">;
365
+ readonly id: S.optional<S.String>;
366
+ }>, S.Struct<{
367
+ readonly type: S.Literal<"attachment_get">;
368
+ readonly id: S.optional<S.String>;
369
+ readonly name: S.String;
370
+ }>, S.Struct<{
371
+ readonly type: S.Literal<"set_model">;
372
+ readonly id: S.optional<S.String>;
373
+ readonly model: S.String;
374
+ }>, S.Struct<{
375
+ readonly type: S.Literal<"delete_session">;
376
+ readonly id: S.optional<S.String>;
377
+ readonly session_id: S.String;
378
+ }>, S.Struct<{
379
+ readonly type: S.Literal<"history_get">;
380
+ readonly id: S.optional<S.String>;
381
+ readonly before: S.String;
382
+ readonly limit: S.optional<S.Number>;
383
+ }>]>;
384
+ export type TAgentCommand = S.Schema.Type<typeof AgentCommand>;
385
+ export type TAgentCommandType = TAgentCommand["type"];
386
+ export declare const AgentTokenUsage: S.Struct<{
387
+ readonly input_tokens: S.Number;
388
+ readonly output_tokens: S.Number;
389
+ readonly cached_input_tokens: S.optional<S.Number>;
390
+ readonly reasoning_tokens: S.optional<S.Number>;
391
+ readonly total_tokens: S.optional<S.Number>;
392
+ /** The model's context window, when known, for a fill gauge. */
393
+ readonly context_window: S.optional<S.Number>;
394
+ }>;
395
+ export type TAgentTokenUsage = S.Schema.Type<typeof AgentTokenUsage>;
396
+ export declare const AgentSessionExitReason: S.Literals<readonly ["closed", "completed", "killed", "error"]>;
397
+ export type TAgentSessionExitReason = S.Schema.Type<typeof AgentSessionExitReason>;
398
+ export declare const AgentSessionStartedEvent: S.Struct<{
399
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
400
+ readonly seq: S.optional<S.Number>;
401
+ /** Epoch milliseconds on the daemon. */
402
+ readonly at: S.optional<S.Number>;
403
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
404
+ readonly command_id: S.optional<S.String>;
405
+ readonly type: S.Literal<"session.started">;
406
+ readonly session_id: S.String;
407
+ readonly engine: S.Literals<readonly ["claude", "codex"]>;
408
+ readonly model: S.optional<S.String>;
409
+ readonly cwd: S.optional<S.String>;
410
+ /** True when this is an attach/resume of an existing engine session. */
411
+ readonly resumed: S.optional<S.Boolean>;
412
+ readonly skip_permissions: S.optional<S.Boolean>;
413
+ }>;
414
+ /**
415
+ * The engine began a new conversation in the same live TUI (for example,
416
+ * Claude Code's `/new`). The consumer must discard the prior transcript; the
417
+ * daemon also starts its replay buffer over so a later attach stays clean.
418
+ */
419
+ export declare const AgentSessionResetEvent: S.Struct<{
420
+ /** The session this event belongs to (absent only before one exists). */
421
+ readonly session_id: S.optional<S.String>;
422
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
423
+ readonly seq: S.optional<S.Number>;
424
+ /** Epoch milliseconds on the daemon. */
425
+ readonly at: S.optional<S.Number>;
426
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
427
+ readonly command_id: S.optional<S.String>;
428
+ readonly type: S.Literal<"session.reset">;
429
+ }>;
430
+ /**
431
+ * The session's configuration changed (today: its model), from whichever side
432
+ * changed it (a web `set_model`, or `/model` typed in the terminal). Read from
433
+ * the engine's own record, so every viewer converges on the same value.
434
+ */
435
+ export declare const AgentSessionConfiguredEvent: S.Struct<{
436
+ /** The session this event belongs to (absent only before one exists). */
437
+ readonly session_id: S.optional<S.String>;
438
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
439
+ readonly seq: S.optional<S.Number>;
440
+ /** Epoch milliseconds on the daemon. */
441
+ readonly at: S.optional<S.Number>;
442
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
443
+ readonly command_id: S.optional<S.String>;
444
+ readonly type: S.Literal<"session.configured">;
445
+ readonly model: S.optional<S.String>;
446
+ /**
447
+ * The conversation's title, from the engine's own record (Claude's
448
+ * `ai-title`). Optional: older daemons omit it, older consumers ignore it.
449
+ */
450
+ readonly title: S.optional<S.String>;
451
+ }>;
452
+ export declare const AgentSessionExitedEvent: S.Struct<{
453
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
454
+ readonly seq: S.optional<S.Number>;
455
+ /** Epoch milliseconds on the daemon. */
456
+ readonly at: S.optional<S.Number>;
457
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
458
+ readonly command_id: S.optional<S.String>;
459
+ readonly type: S.Literal<"session.exited">;
460
+ readonly session_id: S.String;
461
+ readonly reason: S.Literals<readonly ["closed", "completed", "killed", "error"]>;
462
+ readonly message: S.optional<S.String>;
463
+ }>;
464
+ export declare const AgentTurnStartedEvent: S.Struct<{
465
+ /** The session this event belongs to (absent only before one exists). */
466
+ readonly session_id: S.optional<S.String>;
467
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
468
+ readonly seq: S.optional<S.Number>;
469
+ /** Epoch milliseconds on the daemon. */
470
+ readonly at: S.optional<S.Number>;
471
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
472
+ readonly command_id: S.optional<S.String>;
473
+ readonly type: S.Literal<"turn.started">;
474
+ readonly turn_id: S.String;
475
+ readonly model: S.optional<S.String>;
476
+ /**
477
+ * The prompt text that opened the turn. Lets a consumer that attaches later
478
+ * (replay) render the user's side of the transcript. Optional: older daemons
479
+ * omit it and older consumers ignore it.
480
+ */
481
+ readonly prompt: S.optional<S.String>;
482
+ /**
483
+ * Attachments saved for this turn (on-disk basename + mime + size). Optional:
484
+ * terminal prompts and older daemons omit it; older consumers ignore it.
485
+ */
486
+ readonly attachments: S.optional<S.$Array<S.Struct<{
487
+ readonly name: S.String;
488
+ readonly mime: S.String;
489
+ readonly size: S.Number;
490
+ }>>>;
491
+ }>;
492
+ /** Most prompts a session holds behind its running turn. */
493
+ export declare const AGENT_MAX_QUEUED_PROMPTS = 16;
494
+ /**
495
+ * The prompts waiting behind the running turn, oldest first — the whole
496
+ * queue, so the latest event is the state. A `send` that lands mid-turn is
497
+ * queued on the daemon and goes out as the turn ends (or on `send_now`).
498
+ * Older consumers ignore it.
499
+ */
500
+ export declare const AgentQueuedPrompt: S.Struct<{
501
+ /** Stable while the prompt is queued; used for a targeted cancel. */
502
+ readonly id: S.String;
503
+ /** Clipped preview, never the complete prompt. */
504
+ readonly prompt: S.String;
505
+ readonly attachment_count: S.Number;
506
+ }>;
507
+ export type TAgentQueuedPrompt = S.Schema.Type<typeof AgentQueuedPrompt>;
508
+ export declare const AgentQueueUpdatedEvent: S.Struct<{
509
+ /** The session this event belongs to (absent only before one exists). */
510
+ readonly session_id: S.optional<S.String>;
511
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
512
+ readonly seq: S.optional<S.Number>;
513
+ /** Epoch milliseconds on the daemon. */
514
+ readonly at: S.optional<S.Number>;
515
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
516
+ readonly command_id: S.optional<S.String>;
517
+ readonly type: S.Literal<"queue.updated">;
518
+ /**
519
+ * Identified entries, oldest first. `string[]` remains valid on the browser
520
+ * boundary for daemons predating this protocol shape.
521
+ */
522
+ readonly prompts: S.$Array<S.Union<readonly [S.Struct<{
523
+ /** Stable while the prompt is queued; used for a targeted cancel. */
524
+ readonly id: S.String;
525
+ /** Clipped preview, never the complete prompt. */
526
+ readonly prompt: S.String;
527
+ readonly attachment_count: S.Number;
528
+ }>, S.String]>>;
529
+ /** An interrupt pauses automatic draining until `resume_queue`. */
530
+ readonly held: S.optional<S.Boolean>;
531
+ }>;
532
+ export declare const AgentTurnCompletedEvent: S.Struct<{
533
+ /** The session this event belongs to (absent only before one exists). */
534
+ readonly session_id: S.optional<S.String>;
535
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
536
+ readonly seq: S.optional<S.Number>;
537
+ /** Epoch milliseconds on the daemon. */
538
+ readonly at: S.optional<S.Number>;
539
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
540
+ readonly command_id: S.optional<S.String>;
541
+ readonly type: S.Literal<"turn.completed">;
542
+ readonly turn_id: S.String;
543
+ readonly stop_reason: S.optional<S.String>;
544
+ /**
545
+ * What the turn cost, from the engine's own record: `input_tokens` is the
546
+ * context the turn's last request carried, `output_tokens` the sum the turn
547
+ * generated. Optional: older daemons omit it, older consumers ignore it.
548
+ */
549
+ readonly usage: S.optional<S.Struct<{
550
+ readonly input_tokens: S.Number;
551
+ readonly output_tokens: S.Number;
552
+ readonly cached_input_tokens: S.optional<S.Number>;
553
+ readonly reasoning_tokens: S.optional<S.Number>;
554
+ readonly total_tokens: S.optional<S.Number>;
555
+ /** The model's context window, when known, for a fill gauge. */
556
+ readonly context_window: S.optional<S.Number>;
557
+ }>>;
558
+ }>;
559
+ export declare const AgentTurnAbortedEvent: S.Struct<{
560
+ /** The session this event belongs to (absent only before one exists). */
561
+ readonly session_id: S.optional<S.String>;
562
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
563
+ readonly seq: S.optional<S.Number>;
564
+ /** Epoch milliseconds on the daemon. */
565
+ readonly at: S.optional<S.Number>;
566
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
567
+ readonly command_id: S.optional<S.String>;
568
+ readonly type: S.Literal<"turn.aborted">;
569
+ readonly turn_id: S.String;
570
+ readonly reason: S.Literals<readonly ["interrupted", "failed", "cancelled"]>;
571
+ readonly message: S.optional<S.String>;
572
+ }>;
573
+ export declare const AgentToolStatus: S.Literals<readonly ["in_progress", "completed", "failed"]>;
574
+ export type TAgentToolStatus = S.Schema.Type<typeof AgentToolStatus>;
575
+ export declare const AgentNoticeKind: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
576
+ export type TAgentNoticeKind = S.Schema.Type<typeof AgentNoticeKind>;
577
+ /** The renderable unit of a turn. */
578
+ export declare const AgentItem: S.Union<readonly [S.Struct<{
579
+ readonly kind: S.Literal<"assistant_message">;
580
+ readonly text: S.String;
581
+ }>, S.Struct<{
582
+ readonly kind: S.Literal<"reasoning">;
583
+ readonly text: S.String;
584
+ }>, S.Struct<{
585
+ readonly kind: S.Literal<"tool_call">;
586
+ readonly tool_name: S.String;
587
+ readonly title: S.optional<S.String>;
588
+ /** The tool's input as the engine reported it (JSON). */
589
+ readonly input: S.optional<S.Unknown>;
590
+ readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
591
+ /** Result text, truncated by the daemon to fit one line. */
592
+ readonly output: S.optional<S.String>;
593
+ readonly is_error: S.optional<S.Boolean>;
594
+ /** The user (or a policy) refused the call; optional, additive. */
595
+ readonly denied: S.optional<S.Boolean>;
596
+ /** Wall time from call to result, when the engine recorded both. */
597
+ readonly duration_ms: S.optional<S.Number>;
598
+ /** A shell command's exit status, when the engine reported it. */
599
+ readonly exit_code: S.optional<S.Number>;
600
+ /**
601
+ * A subagent launched in the background: the call's own result is only
602
+ * the launch ack, so it stays in progress past its turn until the
603
+ * subagent finishes. Optional, additive.
604
+ */
605
+ readonly background: S.optional<S.Boolean>;
606
+ }>, S.Struct<{
607
+ readonly kind: S.Literal<"notice">;
608
+ readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
609
+ readonly text: S.optional<S.String>;
610
+ /** The item the notice is about (a subagent's call). Optional, additive. */
611
+ readonly ref_item_id: S.optional<S.String>;
612
+ }>]>;
613
+ export type TAgentItem = S.Schema.Type<typeof AgentItem>;
614
+ export declare const AgentItemStartedEvent: S.Struct<{
615
+ /** The session this event belongs to (absent only before one exists). */
616
+ readonly session_id: S.optional<S.String>;
617
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
618
+ readonly seq: S.optional<S.Number>;
619
+ /** Epoch milliseconds on the daemon. */
620
+ readonly at: S.optional<S.Number>;
621
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
622
+ readonly command_id: S.optional<S.String>;
623
+ readonly turn_id: S.optional<S.String>;
624
+ readonly item_id: S.String;
625
+ readonly item: S.Union<readonly [S.Struct<{
626
+ readonly kind: S.Literal<"assistant_message">;
627
+ readonly text: S.String;
628
+ }>, S.Struct<{
629
+ readonly kind: S.Literal<"reasoning">;
630
+ readonly text: S.String;
631
+ }>, S.Struct<{
632
+ readonly kind: S.Literal<"tool_call">;
633
+ readonly tool_name: S.String;
634
+ readonly title: S.optional<S.String>;
635
+ /** The tool's input as the engine reported it (JSON). */
636
+ readonly input: S.optional<S.Unknown>;
637
+ readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
638
+ /** Result text, truncated by the daemon to fit one line. */
639
+ readonly output: S.optional<S.String>;
640
+ readonly is_error: S.optional<S.Boolean>;
641
+ /** The user (or a policy) refused the call; optional, additive. */
642
+ readonly denied: S.optional<S.Boolean>;
643
+ /** Wall time from call to result, when the engine recorded both. */
644
+ readonly duration_ms: S.optional<S.Number>;
645
+ /** A shell command's exit status, when the engine reported it. */
646
+ readonly exit_code: S.optional<S.Number>;
647
+ /**
648
+ * A subagent launched in the background: the call's own result is only
649
+ * the launch ack, so it stays in progress past its turn until the
650
+ * subagent finishes. Optional, additive.
651
+ */
652
+ readonly background: S.optional<S.Boolean>;
653
+ }>, S.Struct<{
654
+ readonly kind: S.Literal<"notice">;
655
+ readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
656
+ readonly text: S.optional<S.String>;
657
+ /** The item the notice is about (a subagent's call). Optional, additive. */
658
+ readonly ref_item_id: S.optional<S.String>;
659
+ }>]>;
660
+ /**
661
+ * The tool call (a Task / Agent subagent) this item belongs to: a
662
+ * subagent's own text and tool calls nest under the call that spawned it.
663
+ * Absent → a top-level item of the turn. Older consumers ignore it.
664
+ */
665
+ readonly parent_item_id: S.optional<S.String>;
666
+ readonly type: S.Literal<"item.started">;
667
+ }>;
668
+ export declare const AgentItemUpdatedEvent: S.Struct<{
669
+ /** The session this event belongs to (absent only before one exists). */
670
+ readonly session_id: S.optional<S.String>;
671
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
672
+ readonly seq: S.optional<S.Number>;
673
+ /** Epoch milliseconds on the daemon. */
674
+ readonly at: S.optional<S.Number>;
675
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
676
+ readonly command_id: S.optional<S.String>;
677
+ readonly turn_id: S.optional<S.String>;
678
+ readonly item_id: S.String;
679
+ readonly item: S.Union<readonly [S.Struct<{
680
+ readonly kind: S.Literal<"assistant_message">;
681
+ readonly text: S.String;
682
+ }>, S.Struct<{
683
+ readonly kind: S.Literal<"reasoning">;
684
+ readonly text: S.String;
685
+ }>, S.Struct<{
686
+ readonly kind: S.Literal<"tool_call">;
687
+ readonly tool_name: S.String;
688
+ readonly title: S.optional<S.String>;
689
+ /** The tool's input as the engine reported it (JSON). */
690
+ readonly input: S.optional<S.Unknown>;
691
+ readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
692
+ /** Result text, truncated by the daemon to fit one line. */
693
+ readonly output: S.optional<S.String>;
694
+ readonly is_error: S.optional<S.Boolean>;
695
+ /** The user (or a policy) refused the call; optional, additive. */
696
+ readonly denied: S.optional<S.Boolean>;
697
+ /** Wall time from call to result, when the engine recorded both. */
698
+ readonly duration_ms: S.optional<S.Number>;
699
+ /** A shell command's exit status, when the engine reported it. */
700
+ readonly exit_code: S.optional<S.Number>;
701
+ /**
702
+ * A subagent launched in the background: the call's own result is only
703
+ * the launch ack, so it stays in progress past its turn until the
704
+ * subagent finishes. Optional, additive.
705
+ */
706
+ readonly background: S.optional<S.Boolean>;
707
+ }>, S.Struct<{
708
+ readonly kind: S.Literal<"notice">;
709
+ readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
710
+ readonly text: S.optional<S.String>;
711
+ /** The item the notice is about (a subagent's call). Optional, additive. */
712
+ readonly ref_item_id: S.optional<S.String>;
713
+ }>]>;
714
+ /**
715
+ * The tool call (a Task / Agent subagent) this item belongs to: a
716
+ * subagent's own text and tool calls nest under the call that spawned it.
717
+ * Absent → a top-level item of the turn. Older consumers ignore it.
718
+ */
719
+ readonly parent_item_id: S.optional<S.String>;
720
+ readonly type: S.Literal<"item.updated">;
721
+ }>;
722
+ export declare const AgentItemCompletedEvent: S.Struct<{
723
+ /** The session this event belongs to (absent only before one exists). */
724
+ readonly session_id: S.optional<S.String>;
725
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
726
+ readonly seq: S.optional<S.Number>;
727
+ /** Epoch milliseconds on the daemon. */
728
+ readonly at: S.optional<S.Number>;
729
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
730
+ readonly command_id: S.optional<S.String>;
731
+ readonly turn_id: S.optional<S.String>;
732
+ readonly item_id: S.String;
733
+ readonly item: S.Union<readonly [S.Struct<{
734
+ readonly kind: S.Literal<"assistant_message">;
735
+ readonly text: S.String;
736
+ }>, S.Struct<{
737
+ readonly kind: S.Literal<"reasoning">;
738
+ readonly text: S.String;
739
+ }>, S.Struct<{
740
+ readonly kind: S.Literal<"tool_call">;
741
+ readonly tool_name: S.String;
742
+ readonly title: S.optional<S.String>;
743
+ /** The tool's input as the engine reported it (JSON). */
744
+ readonly input: S.optional<S.Unknown>;
745
+ readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
746
+ /** Result text, truncated by the daemon to fit one line. */
747
+ readonly output: S.optional<S.String>;
748
+ readonly is_error: S.optional<S.Boolean>;
749
+ /** The user (or a policy) refused the call; optional, additive. */
750
+ readonly denied: S.optional<S.Boolean>;
751
+ /** Wall time from call to result, when the engine recorded both. */
752
+ readonly duration_ms: S.optional<S.Number>;
753
+ /** A shell command's exit status, when the engine reported it. */
754
+ readonly exit_code: S.optional<S.Number>;
755
+ /**
756
+ * A subagent launched in the background: the call's own result is only
757
+ * the launch ack, so it stays in progress past its turn until the
758
+ * subagent finishes. Optional, additive.
759
+ */
760
+ readonly background: S.optional<S.Boolean>;
761
+ }>, S.Struct<{
762
+ readonly kind: S.Literal<"notice">;
763
+ readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
764
+ readonly text: S.optional<S.String>;
765
+ /** The item the notice is about (a subagent's call). Optional, additive. */
766
+ readonly ref_item_id: S.optional<S.String>;
767
+ }>]>;
768
+ /**
769
+ * The tool call (a Task / Agent subagent) this item belongs to: a
770
+ * subagent's own text and tool calls nest under the call that spawned it.
771
+ * Absent → a top-level item of the turn. Older consumers ignore it.
772
+ */
773
+ readonly parent_item_id: S.optional<S.String>;
774
+ readonly type: S.Literal<"item.completed">;
775
+ }>;
776
+ export declare const AgentContentStream: S.Literals<readonly ["assistant_text", "reasoning_text", "tool_output"]>;
777
+ export type TAgentContentStream = S.Schema.Type<typeof AgentContentStream>;
778
+ export declare const AgentContentDeltaEvent: S.Struct<{
779
+ /** The session this event belongs to (absent only before one exists). */
780
+ readonly session_id: S.optional<S.String>;
781
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
782
+ readonly seq: S.optional<S.Number>;
783
+ /** Epoch milliseconds on the daemon. */
784
+ readonly at: S.optional<S.Number>;
785
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
786
+ readonly command_id: S.optional<S.String>;
787
+ readonly type: S.Literal<"content.delta">;
788
+ readonly turn_id: S.optional<S.String>;
789
+ readonly item_id: S.String;
790
+ readonly stream: S.Literals<readonly ["assistant_text", "reasoning_text", "tool_output"]>;
791
+ readonly delta: S.String;
792
+ }>;
793
+ /** What an approval request asks permission for. */
794
+ export declare const AgentRequestKind: S.Literals<readonly ["command", "file_change", "tool", "other"]>;
795
+ export type TAgentRequestKind = S.Schema.Type<typeof AgentRequestKind>;
796
+ export declare const AgentRequestOpenedEvent: S.Struct<{
797
+ /** The session this event belongs to (absent only before one exists). */
798
+ readonly session_id: S.optional<S.String>;
799
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
800
+ readonly seq: S.optional<S.Number>;
801
+ /** Epoch milliseconds on the daemon. */
802
+ readonly at: S.optional<S.Number>;
803
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
804
+ readonly command_id: S.optional<S.String>;
805
+ readonly type: S.Literal<"request.opened">;
806
+ readonly request_id: S.String;
807
+ readonly turn_id: S.optional<S.String>;
808
+ readonly item_id: S.optional<S.String>;
809
+ readonly request_kind: S.Literals<readonly ["command", "file_change", "tool", "other"]>;
810
+ readonly title: S.optional<S.String>;
811
+ readonly detail: S.optional<S.String>;
812
+ readonly input: S.optional<S.Unknown>;
813
+ }>;
814
+ export declare const AgentRequestResolvedEvent: S.Struct<{
815
+ /** The session this event belongs to (absent only before one exists). */
816
+ readonly session_id: S.optional<S.String>;
817
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
818
+ readonly seq: S.optional<S.Number>;
819
+ /** Epoch milliseconds on the daemon. */
820
+ readonly at: S.optional<S.Number>;
821
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
822
+ readonly command_id: S.optional<S.String>;
823
+ readonly type: S.Literal<"request.resolved">;
824
+ readonly request_id: S.String;
825
+ readonly decision: S.Literals<readonly ["accept", "accept_for_session", "decline", "cancel"]>;
826
+ }>;
827
+ export declare const AgentUserInputQuestion: S.Struct<{
828
+ readonly id: S.String;
829
+ readonly header: S.optional<S.String>;
830
+ readonly question: S.String;
831
+ readonly options: S.optional<S.$Array<S.Struct<{
832
+ readonly label: S.String;
833
+ readonly description: S.optional<S.String>;
834
+ }>>>;
835
+ readonly multi_select: S.optional<S.Boolean>;
836
+ }>;
837
+ export type TAgentUserInputQuestion = S.Schema.Type<typeof AgentUserInputQuestion>;
838
+ export declare const AgentUserInputRequestedEvent: S.Struct<{
839
+ /** The session this event belongs to (absent only before one exists). */
840
+ readonly session_id: S.optional<S.String>;
841
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
842
+ readonly seq: S.optional<S.Number>;
843
+ /** Epoch milliseconds on the daemon. */
844
+ readonly at: S.optional<S.Number>;
845
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
846
+ readonly command_id: S.optional<S.String>;
847
+ readonly type: S.Literal<"user-input.requested">;
848
+ readonly request_id: S.String;
849
+ readonly turn_id: S.optional<S.String>;
850
+ readonly questions: S.$Array<S.Struct<{
851
+ readonly id: S.String;
852
+ readonly header: S.optional<S.String>;
853
+ readonly question: S.String;
854
+ readonly options: S.optional<S.$Array<S.Struct<{
855
+ readonly label: S.String;
856
+ readonly description: S.optional<S.String>;
857
+ }>>>;
858
+ readonly multi_select: S.optional<S.Boolean>;
859
+ }>>;
860
+ }>;
861
+ export declare const AgentUserInputResolvedEvent: S.Struct<{
862
+ /** The session this event belongs to (absent only before one exists). */
863
+ readonly session_id: S.optional<S.String>;
864
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
865
+ readonly seq: S.optional<S.Number>;
866
+ /** Epoch milliseconds on the daemon. */
867
+ readonly at: S.optional<S.Number>;
868
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
869
+ readonly command_id: S.optional<S.String>;
870
+ readonly type: S.Literal<"user-input.resolved">;
871
+ readonly request_id: S.String;
872
+ readonly answers: S.$Record<S.String, S.Union<readonly [S.String, S.$Array<S.String>]>>;
873
+ }>;
874
+ export declare const AgentTokenUsageUpdatedEvent: S.Struct<{
875
+ /** The session this event belongs to (absent only before one exists). */
876
+ readonly session_id: S.optional<S.String>;
877
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
878
+ readonly seq: S.optional<S.Number>;
879
+ /** Epoch milliseconds on the daemon. */
880
+ readonly at: S.optional<S.Number>;
881
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
882
+ readonly command_id: S.optional<S.String>;
883
+ readonly type: S.Literal<"thread.token-usage.updated">;
884
+ readonly usage: S.Struct<{
885
+ readonly input_tokens: S.Number;
886
+ readonly output_tokens: S.Number;
887
+ readonly cached_input_tokens: S.optional<S.Number>;
888
+ readonly reasoning_tokens: S.optional<S.Number>;
889
+ readonly total_tokens: S.optional<S.Number>;
890
+ /** The model's context window, when known, for a fill gauge. */
891
+ readonly context_window: S.optional<S.Number>;
892
+ }>;
893
+ }>;
894
+ export declare const AgentRuntimeWarningEvent: S.Struct<{
895
+ /** The session this event belongs to (absent only before one exists). */
896
+ readonly session_id: S.optional<S.String>;
897
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
898
+ readonly seq: S.optional<S.Number>;
899
+ /** Epoch milliseconds on the daemon. */
900
+ readonly at: S.optional<S.Number>;
901
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
902
+ readonly command_id: S.optional<S.String>;
903
+ readonly type: S.Literal<"runtime.warning">;
904
+ readonly code: S.optional<S.String>;
905
+ readonly message: S.String;
906
+ }>;
907
+ /**
908
+ * `runtime.error` code of a `set_model` the engine accepted but could not
909
+ * apply (the CLI refused the model, or never confirmed the switch).
910
+ */
911
+ export declare const AGENT_MODEL_SWITCH_FAILED_CODE = "model_switch_failed";
912
+ /** `runtime.warning` code of a model switch the user declined. */
913
+ export declare const AGENT_MODEL_SWITCH_DECLINED_CODE = "model_switch_declined";
914
+ export declare const AgentRuntimeErrorEvent: S.Struct<{
915
+ /** The session this event belongs to (absent only before one exists). */
916
+ readonly session_id: S.optional<S.String>;
917
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
918
+ readonly seq: S.optional<S.Number>;
919
+ /** Epoch milliseconds on the daemon. */
920
+ readonly at: S.optional<S.Number>;
921
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
922
+ readonly command_id: S.optional<S.String>;
923
+ readonly type: S.Literal<"runtime.error">;
924
+ readonly code: S.optional<S.String>;
925
+ readonly message: S.String;
926
+ /** True when the session cannot continue (a `session.exited` follows). */
927
+ readonly fatal: S.optional<S.Boolean>;
928
+ }>;
929
+ /**
930
+ * One chunk of an `attachment_get` response. Chunked so a single NDJSON line
931
+ * stays under {@link AGENT_MAX_LINE_BYTES}: `data` is base64 of
932
+ * `file[offset .. offset+decodedLen)`, and `done` is true on the last chunk.
933
+ */
934
+ export declare const AgentAttachmentDataEvent: S.Struct<{
935
+ /** The session this event belongs to (absent only before one exists). */
936
+ readonly session_id: S.optional<S.String>;
937
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
938
+ readonly seq: S.optional<S.Number>;
939
+ /** Epoch milliseconds on the daemon. */
940
+ readonly at: S.optional<S.Number>;
941
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
942
+ readonly command_id: S.optional<S.String>;
943
+ readonly type: S.Literal<"attachment.data">;
944
+ readonly name: S.String;
945
+ readonly mime: S.String;
946
+ /** Total decoded byte length of the file. */
947
+ readonly size: S.Number;
948
+ /** Decoded-byte offset of this chunk within the file. */
949
+ readonly offset: S.Number;
950
+ /** Base64 of this chunk. */
951
+ readonly data: S.String;
952
+ /** True when this is the last chunk. */
953
+ readonly done: S.Boolean;
954
+ }>;
955
+ export type TAgentAttachmentDataEvent = S.Schema.Type<typeof AgentAttachmentDataEvent>;
956
+ /** Answer to `delete_session`: the session is gone from the device. */
957
+ export declare const AgentSessionDeletedEvent: S.Struct<{
958
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
959
+ readonly seq: S.optional<S.Number>;
960
+ /** Epoch milliseconds on the daemon. */
961
+ readonly at: S.optional<S.Number>;
962
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
963
+ readonly command_id: S.optional<S.String>;
964
+ readonly type: S.Literal<"session.deleted">;
965
+ readonly session_id: S.String;
966
+ }>;
967
+ /**
968
+ * A page of session history. On attach (no `events`): the cursor before the
969
+ * replayed window. Answering `history_get` (same `command_id`): the older
970
+ * events themselves, oldest first, each one {@link AgentEvent} line's value
971
+ * (decode with {@link parseAgentEvent}; unknown types are dropped). Paging is
972
+ * by whole turns, so a page never splits one. `has_more` false → the page
973
+ * reaches the start of the session.
974
+ */
975
+ export declare const AgentHistoryPageEvent: S.Struct<{
976
+ /** The session this event belongs to (absent only before one exists). */
977
+ readonly session_id: S.optional<S.String>;
978
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
979
+ readonly seq: S.optional<S.Number>;
980
+ /** Epoch milliseconds on the daemon. */
981
+ readonly at: S.optional<S.Number>;
982
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
983
+ readonly command_id: S.optional<S.String>;
984
+ readonly type: S.Literal<"history.page">;
985
+ readonly before_cursor: S.optional<S.String>;
986
+ readonly has_more: S.Boolean;
987
+ readonly events: S.optional<S.$Array<S.Unknown>>;
988
+ }>;
989
+ export type TAgentHistoryPageEvent = S.Schema.Type<typeof AgentHistoryPageEvent>;
990
+ /** One daemon → consumer event line. */
991
+ export declare const AgentEvent: S.Union<readonly [S.Struct<{
992
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
993
+ readonly seq: S.optional<S.Number>;
994
+ /** Epoch milliseconds on the daemon. */
995
+ readonly at: S.optional<S.Number>;
996
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
997
+ readonly command_id: S.optional<S.String>;
998
+ readonly type: S.Literal<"session.started">;
999
+ readonly session_id: S.String;
1000
+ readonly engine: S.Literals<readonly ["claude", "codex"]>;
1001
+ readonly model: S.optional<S.String>;
1002
+ readonly cwd: S.optional<S.String>;
1003
+ /** True when this is an attach/resume of an existing engine session. */
1004
+ readonly resumed: S.optional<S.Boolean>;
1005
+ readonly skip_permissions: S.optional<S.Boolean>;
1006
+ }>, S.Struct<{
1007
+ /** The session this event belongs to (absent only before one exists). */
1008
+ readonly session_id: S.optional<S.String>;
1009
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1010
+ readonly seq: S.optional<S.Number>;
1011
+ /** Epoch milliseconds on the daemon. */
1012
+ readonly at: S.optional<S.Number>;
1013
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1014
+ readonly command_id: S.optional<S.String>;
1015
+ readonly type: S.Literal<"session.reset">;
1016
+ }>, S.Struct<{
1017
+ /** The session this event belongs to (absent only before one exists). */
1018
+ readonly session_id: S.optional<S.String>;
1019
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1020
+ readonly seq: S.optional<S.Number>;
1021
+ /** Epoch milliseconds on the daemon. */
1022
+ readonly at: S.optional<S.Number>;
1023
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1024
+ readonly command_id: S.optional<S.String>;
1025
+ readonly type: S.Literal<"session.configured">;
1026
+ readonly model: S.optional<S.String>;
1027
+ /**
1028
+ * The conversation's title, from the engine's own record (Claude's
1029
+ * `ai-title`). Optional: older daemons omit it, older consumers ignore it.
1030
+ */
1031
+ readonly title: S.optional<S.String>;
1032
+ }>, S.Struct<{
1033
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1034
+ readonly seq: S.optional<S.Number>;
1035
+ /** Epoch milliseconds on the daemon. */
1036
+ readonly at: S.optional<S.Number>;
1037
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1038
+ readonly command_id: S.optional<S.String>;
1039
+ readonly type: S.Literal<"session.exited">;
1040
+ readonly session_id: S.String;
1041
+ readonly reason: S.Literals<readonly ["closed", "completed", "killed", "error"]>;
1042
+ readonly message: S.optional<S.String>;
1043
+ }>, S.Struct<{
1044
+ /** The session this event belongs to (absent only before one exists). */
1045
+ readonly session_id: S.optional<S.String>;
1046
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1047
+ readonly seq: S.optional<S.Number>;
1048
+ /** Epoch milliseconds on the daemon. */
1049
+ readonly at: S.optional<S.Number>;
1050
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1051
+ readonly command_id: S.optional<S.String>;
1052
+ readonly type: S.Literal<"turn.started">;
1053
+ readonly turn_id: S.String;
1054
+ readonly model: S.optional<S.String>;
1055
+ /**
1056
+ * The prompt text that opened the turn. Lets a consumer that attaches later
1057
+ * (replay) render the user's side of the transcript. Optional: older daemons
1058
+ * omit it and older consumers ignore it.
1059
+ */
1060
+ readonly prompt: S.optional<S.String>;
1061
+ /**
1062
+ * Attachments saved for this turn (on-disk basename + mime + size). Optional:
1063
+ * terminal prompts and older daemons omit it; older consumers ignore it.
1064
+ */
1065
+ readonly attachments: S.optional<S.$Array<S.Struct<{
1066
+ readonly name: S.String;
1067
+ readonly mime: S.String;
1068
+ readonly size: S.Number;
1069
+ }>>>;
1070
+ }>, S.Struct<{
1071
+ /** The session this event belongs to (absent only before one exists). */
1072
+ readonly session_id: S.optional<S.String>;
1073
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1074
+ readonly seq: S.optional<S.Number>;
1075
+ /** Epoch milliseconds on the daemon. */
1076
+ readonly at: S.optional<S.Number>;
1077
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1078
+ readonly command_id: S.optional<S.String>;
1079
+ readonly type: S.Literal<"queue.updated">;
1080
+ /**
1081
+ * Identified entries, oldest first. `string[]` remains valid on the browser
1082
+ * boundary for daemons predating this protocol shape.
1083
+ */
1084
+ readonly prompts: S.$Array<S.Union<readonly [S.Struct<{
1085
+ /** Stable while the prompt is queued; used for a targeted cancel. */
1086
+ readonly id: S.String;
1087
+ /** Clipped preview, never the complete prompt. */
1088
+ readonly prompt: S.String;
1089
+ readonly attachment_count: S.Number;
1090
+ }>, S.String]>>;
1091
+ /** An interrupt pauses automatic draining until `resume_queue`. */
1092
+ readonly held: S.optional<S.Boolean>;
1093
+ }>, S.Struct<{
1094
+ /** The session this event belongs to (absent only before one exists). */
1095
+ readonly session_id: S.optional<S.String>;
1096
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1097
+ readonly seq: S.optional<S.Number>;
1098
+ /** Epoch milliseconds on the daemon. */
1099
+ readonly at: S.optional<S.Number>;
1100
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1101
+ readonly command_id: S.optional<S.String>;
1102
+ readonly type: S.Literal<"turn.completed">;
1103
+ readonly turn_id: S.String;
1104
+ readonly stop_reason: S.optional<S.String>;
1105
+ /**
1106
+ * What the turn cost, from the engine's own record: `input_tokens` is the
1107
+ * context the turn's last request carried, `output_tokens` the sum the turn
1108
+ * generated. Optional: older daemons omit it, older consumers ignore it.
1109
+ */
1110
+ readonly usage: S.optional<S.Struct<{
1111
+ readonly input_tokens: S.Number;
1112
+ readonly output_tokens: S.Number;
1113
+ readonly cached_input_tokens: S.optional<S.Number>;
1114
+ readonly reasoning_tokens: S.optional<S.Number>;
1115
+ readonly total_tokens: S.optional<S.Number>;
1116
+ /** The model's context window, when known, for a fill gauge. */
1117
+ readonly context_window: S.optional<S.Number>;
1118
+ }>>;
1119
+ }>, S.Struct<{
1120
+ /** The session this event belongs to (absent only before one exists). */
1121
+ readonly session_id: S.optional<S.String>;
1122
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1123
+ readonly seq: S.optional<S.Number>;
1124
+ /** Epoch milliseconds on the daemon. */
1125
+ readonly at: S.optional<S.Number>;
1126
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1127
+ readonly command_id: S.optional<S.String>;
1128
+ readonly type: S.Literal<"turn.aborted">;
1129
+ readonly turn_id: S.String;
1130
+ readonly reason: S.Literals<readonly ["interrupted", "failed", "cancelled"]>;
1131
+ readonly message: S.optional<S.String>;
1132
+ }>, S.Struct<{
1133
+ /** The session this event belongs to (absent only before one exists). */
1134
+ readonly session_id: S.optional<S.String>;
1135
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1136
+ readonly seq: S.optional<S.Number>;
1137
+ /** Epoch milliseconds on the daemon. */
1138
+ readonly at: S.optional<S.Number>;
1139
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1140
+ readonly command_id: S.optional<S.String>;
1141
+ readonly turn_id: S.optional<S.String>;
1142
+ readonly item_id: S.String;
1143
+ readonly item: S.Union<readonly [S.Struct<{
1144
+ readonly kind: S.Literal<"assistant_message">;
1145
+ readonly text: S.String;
1146
+ }>, S.Struct<{
1147
+ readonly kind: S.Literal<"reasoning">;
1148
+ readonly text: S.String;
1149
+ }>, S.Struct<{
1150
+ readonly kind: S.Literal<"tool_call">;
1151
+ readonly tool_name: S.String;
1152
+ readonly title: S.optional<S.String>;
1153
+ /** The tool's input as the engine reported it (JSON). */
1154
+ readonly input: S.optional<S.Unknown>;
1155
+ readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
1156
+ /** Result text, truncated by the daemon to fit one line. */
1157
+ readonly output: S.optional<S.String>;
1158
+ readonly is_error: S.optional<S.Boolean>;
1159
+ /** The user (or a policy) refused the call; optional, additive. */
1160
+ readonly denied: S.optional<S.Boolean>;
1161
+ /** Wall time from call to result, when the engine recorded both. */
1162
+ readonly duration_ms: S.optional<S.Number>;
1163
+ /** A shell command's exit status, when the engine reported it. */
1164
+ readonly exit_code: S.optional<S.Number>;
1165
+ /**
1166
+ * A subagent launched in the background: the call's own result is only
1167
+ * the launch ack, so it stays in progress past its turn until the
1168
+ * subagent finishes. Optional, additive.
1169
+ */
1170
+ readonly background: S.optional<S.Boolean>;
1171
+ }>, S.Struct<{
1172
+ readonly kind: S.Literal<"notice">;
1173
+ readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
1174
+ readonly text: S.optional<S.String>;
1175
+ /** The item the notice is about (a subagent's call). Optional, additive. */
1176
+ readonly ref_item_id: S.optional<S.String>;
1177
+ }>]>;
1178
+ /**
1179
+ * The tool call (a Task / Agent subagent) this item belongs to: a
1180
+ * subagent's own text and tool calls nest under the call that spawned it.
1181
+ * Absent → a top-level item of the turn. Older consumers ignore it.
1182
+ */
1183
+ readonly parent_item_id: S.optional<S.String>;
1184
+ readonly type: S.Literal<"item.started">;
1185
+ }>, S.Struct<{
1186
+ /** The session this event belongs to (absent only before one exists). */
1187
+ readonly session_id: S.optional<S.String>;
1188
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1189
+ readonly seq: S.optional<S.Number>;
1190
+ /** Epoch milliseconds on the daemon. */
1191
+ readonly at: S.optional<S.Number>;
1192
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1193
+ readonly command_id: S.optional<S.String>;
1194
+ readonly turn_id: S.optional<S.String>;
1195
+ readonly item_id: S.String;
1196
+ readonly item: S.Union<readonly [S.Struct<{
1197
+ readonly kind: S.Literal<"assistant_message">;
1198
+ readonly text: S.String;
1199
+ }>, S.Struct<{
1200
+ readonly kind: S.Literal<"reasoning">;
1201
+ readonly text: S.String;
1202
+ }>, S.Struct<{
1203
+ readonly kind: S.Literal<"tool_call">;
1204
+ readonly tool_name: S.String;
1205
+ readonly title: S.optional<S.String>;
1206
+ /** The tool's input as the engine reported it (JSON). */
1207
+ readonly input: S.optional<S.Unknown>;
1208
+ readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
1209
+ /** Result text, truncated by the daemon to fit one line. */
1210
+ readonly output: S.optional<S.String>;
1211
+ readonly is_error: S.optional<S.Boolean>;
1212
+ /** The user (or a policy) refused the call; optional, additive. */
1213
+ readonly denied: S.optional<S.Boolean>;
1214
+ /** Wall time from call to result, when the engine recorded both. */
1215
+ readonly duration_ms: S.optional<S.Number>;
1216
+ /** A shell command's exit status, when the engine reported it. */
1217
+ readonly exit_code: S.optional<S.Number>;
1218
+ /**
1219
+ * A subagent launched in the background: the call's own result is only
1220
+ * the launch ack, so it stays in progress past its turn until the
1221
+ * subagent finishes. Optional, additive.
1222
+ */
1223
+ readonly background: S.optional<S.Boolean>;
1224
+ }>, S.Struct<{
1225
+ readonly kind: S.Literal<"notice">;
1226
+ readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
1227
+ readonly text: S.optional<S.String>;
1228
+ /** The item the notice is about (a subagent's call). Optional, additive. */
1229
+ readonly ref_item_id: S.optional<S.String>;
1230
+ }>]>;
1231
+ /**
1232
+ * The tool call (a Task / Agent subagent) this item belongs to: a
1233
+ * subagent's own text and tool calls nest under the call that spawned it.
1234
+ * Absent → a top-level item of the turn. Older consumers ignore it.
1235
+ */
1236
+ readonly parent_item_id: S.optional<S.String>;
1237
+ readonly type: S.Literal<"item.updated">;
1238
+ }>, S.Struct<{
1239
+ /** The session this event belongs to (absent only before one exists). */
1240
+ readonly session_id: S.optional<S.String>;
1241
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1242
+ readonly seq: S.optional<S.Number>;
1243
+ /** Epoch milliseconds on the daemon. */
1244
+ readonly at: S.optional<S.Number>;
1245
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1246
+ readonly command_id: S.optional<S.String>;
1247
+ readonly turn_id: S.optional<S.String>;
1248
+ readonly item_id: S.String;
1249
+ readonly item: S.Union<readonly [S.Struct<{
1250
+ readonly kind: S.Literal<"assistant_message">;
1251
+ readonly text: S.String;
1252
+ }>, S.Struct<{
1253
+ readonly kind: S.Literal<"reasoning">;
1254
+ readonly text: S.String;
1255
+ }>, S.Struct<{
1256
+ readonly kind: S.Literal<"tool_call">;
1257
+ readonly tool_name: S.String;
1258
+ readonly title: S.optional<S.String>;
1259
+ /** The tool's input as the engine reported it (JSON). */
1260
+ readonly input: S.optional<S.Unknown>;
1261
+ readonly status: S.Literals<readonly ["in_progress", "completed", "failed"]>;
1262
+ /** Result text, truncated by the daemon to fit one line. */
1263
+ readonly output: S.optional<S.String>;
1264
+ readonly is_error: S.optional<S.Boolean>;
1265
+ /** The user (or a policy) refused the call; optional, additive. */
1266
+ readonly denied: S.optional<S.Boolean>;
1267
+ /** Wall time from call to result, when the engine recorded both. */
1268
+ readonly duration_ms: S.optional<S.Number>;
1269
+ /** A shell command's exit status, when the engine reported it. */
1270
+ readonly exit_code: S.optional<S.Number>;
1271
+ /**
1272
+ * A subagent launched in the background: the call's own result is only
1273
+ * the launch ack, so it stays in progress past its turn until the
1274
+ * subagent finishes. Optional, additive.
1275
+ */
1276
+ readonly background: S.optional<S.Boolean>;
1277
+ }>, S.Struct<{
1278
+ readonly kind: S.Literal<"notice">;
1279
+ readonly notice: S.Literals<readonly ["compacted", "interrupted", "model_changed", "error", "subagent_finished"]>;
1280
+ readonly text: S.optional<S.String>;
1281
+ /** The item the notice is about (a subagent's call). Optional, additive. */
1282
+ readonly ref_item_id: S.optional<S.String>;
1283
+ }>]>;
1284
+ /**
1285
+ * The tool call (a Task / Agent subagent) this item belongs to: a
1286
+ * subagent's own text and tool calls nest under the call that spawned it.
1287
+ * Absent → a top-level item of the turn. Older consumers ignore it.
1288
+ */
1289
+ readonly parent_item_id: S.optional<S.String>;
1290
+ readonly type: S.Literal<"item.completed">;
1291
+ }>, S.Struct<{
1292
+ /** The session this event belongs to (absent only before one exists). */
1293
+ readonly session_id: S.optional<S.String>;
1294
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1295
+ readonly seq: S.optional<S.Number>;
1296
+ /** Epoch milliseconds on the daemon. */
1297
+ readonly at: S.optional<S.Number>;
1298
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1299
+ readonly command_id: S.optional<S.String>;
1300
+ readonly type: S.Literal<"content.delta">;
1301
+ readonly turn_id: S.optional<S.String>;
1302
+ readonly item_id: S.String;
1303
+ readonly stream: S.Literals<readonly ["assistant_text", "reasoning_text", "tool_output"]>;
1304
+ readonly delta: S.String;
1305
+ }>, S.Struct<{
1306
+ /** The session this event belongs to (absent only before one exists). */
1307
+ readonly session_id: S.optional<S.String>;
1308
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1309
+ readonly seq: S.optional<S.Number>;
1310
+ /** Epoch milliseconds on the daemon. */
1311
+ readonly at: S.optional<S.Number>;
1312
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1313
+ readonly command_id: S.optional<S.String>;
1314
+ readonly type: S.Literal<"request.opened">;
1315
+ readonly request_id: S.String;
1316
+ readonly turn_id: S.optional<S.String>;
1317
+ readonly item_id: S.optional<S.String>;
1318
+ readonly request_kind: S.Literals<readonly ["command", "file_change", "tool", "other"]>;
1319
+ readonly title: S.optional<S.String>;
1320
+ readonly detail: S.optional<S.String>;
1321
+ readonly input: S.optional<S.Unknown>;
1322
+ }>, S.Struct<{
1323
+ /** The session this event belongs to (absent only before one exists). */
1324
+ readonly session_id: S.optional<S.String>;
1325
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1326
+ readonly seq: S.optional<S.Number>;
1327
+ /** Epoch milliseconds on the daemon. */
1328
+ readonly at: S.optional<S.Number>;
1329
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1330
+ readonly command_id: S.optional<S.String>;
1331
+ readonly type: S.Literal<"request.resolved">;
1332
+ readonly request_id: S.String;
1333
+ readonly decision: S.Literals<readonly ["accept", "accept_for_session", "decline", "cancel"]>;
1334
+ }>, S.Struct<{
1335
+ /** The session this event belongs to (absent only before one exists). */
1336
+ readonly session_id: S.optional<S.String>;
1337
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1338
+ readonly seq: S.optional<S.Number>;
1339
+ /** Epoch milliseconds on the daemon. */
1340
+ readonly at: S.optional<S.Number>;
1341
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1342
+ readonly command_id: S.optional<S.String>;
1343
+ readonly type: S.Literal<"user-input.requested">;
1344
+ readonly request_id: S.String;
1345
+ readonly turn_id: S.optional<S.String>;
1346
+ readonly questions: S.$Array<S.Struct<{
1347
+ readonly id: S.String;
1348
+ readonly header: S.optional<S.String>;
1349
+ readonly question: S.String;
1350
+ readonly options: S.optional<S.$Array<S.Struct<{
1351
+ readonly label: S.String;
1352
+ readonly description: S.optional<S.String>;
1353
+ }>>>;
1354
+ readonly multi_select: S.optional<S.Boolean>;
1355
+ }>>;
1356
+ }>, S.Struct<{
1357
+ /** The session this event belongs to (absent only before one exists). */
1358
+ readonly session_id: S.optional<S.String>;
1359
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1360
+ readonly seq: S.optional<S.Number>;
1361
+ /** Epoch milliseconds on the daemon. */
1362
+ readonly at: S.optional<S.Number>;
1363
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1364
+ readonly command_id: S.optional<S.String>;
1365
+ readonly type: S.Literal<"user-input.resolved">;
1366
+ readonly request_id: S.String;
1367
+ readonly answers: S.$Record<S.String, S.Union<readonly [S.String, S.$Array<S.String>]>>;
1368
+ }>, S.Struct<{
1369
+ /** The session this event belongs to (absent only before one exists). */
1370
+ readonly session_id: S.optional<S.String>;
1371
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1372
+ readonly seq: S.optional<S.Number>;
1373
+ /** Epoch milliseconds on the daemon. */
1374
+ readonly at: S.optional<S.Number>;
1375
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1376
+ readonly command_id: S.optional<S.String>;
1377
+ readonly type: S.Literal<"thread.token-usage.updated">;
1378
+ readonly usage: S.Struct<{
1379
+ readonly input_tokens: S.Number;
1380
+ readonly output_tokens: S.Number;
1381
+ readonly cached_input_tokens: S.optional<S.Number>;
1382
+ readonly reasoning_tokens: S.optional<S.Number>;
1383
+ readonly total_tokens: S.optional<S.Number>;
1384
+ /** The model's context window, when known, for a fill gauge. */
1385
+ readonly context_window: S.optional<S.Number>;
1386
+ }>;
1387
+ }>, S.Struct<{
1388
+ /** The session this event belongs to (absent only before one exists). */
1389
+ readonly session_id: S.optional<S.String>;
1390
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1391
+ readonly seq: S.optional<S.Number>;
1392
+ /** Epoch milliseconds on the daemon. */
1393
+ readonly at: S.optional<S.Number>;
1394
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1395
+ readonly command_id: S.optional<S.String>;
1396
+ readonly type: S.Literal<"runtime.warning">;
1397
+ readonly code: S.optional<S.String>;
1398
+ readonly message: S.String;
1399
+ }>, S.Struct<{
1400
+ /** The session this event belongs to (absent only before one exists). */
1401
+ readonly session_id: S.optional<S.String>;
1402
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1403
+ readonly seq: S.optional<S.Number>;
1404
+ /** Epoch milliseconds on the daemon. */
1405
+ readonly at: S.optional<S.Number>;
1406
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1407
+ readonly command_id: S.optional<S.String>;
1408
+ readonly type: S.Literal<"runtime.error">;
1409
+ readonly code: S.optional<S.String>;
1410
+ readonly message: S.String;
1411
+ /** True when the session cannot continue (a `session.exited` follows). */
1412
+ readonly fatal: S.optional<S.Boolean>;
1413
+ }>, S.Struct<{
1414
+ /** The session this event belongs to (absent only before one exists). */
1415
+ readonly session_id: S.optional<S.String>;
1416
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1417
+ readonly seq: S.optional<S.Number>;
1418
+ /** Epoch milliseconds on the daemon. */
1419
+ readonly at: S.optional<S.Number>;
1420
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1421
+ readonly command_id: S.optional<S.String>;
1422
+ readonly type: S.Literal<"attachment.data">;
1423
+ readonly name: S.String;
1424
+ readonly mime: S.String;
1425
+ /** Total decoded byte length of the file. */
1426
+ readonly size: S.Number;
1427
+ /** Decoded-byte offset of this chunk within the file. */
1428
+ readonly offset: S.Number;
1429
+ /** Base64 of this chunk. */
1430
+ readonly data: S.String;
1431
+ /** True when this is the last chunk. */
1432
+ readonly done: S.Boolean;
1433
+ }>, S.Struct<{
1434
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1435
+ readonly seq: S.optional<S.Number>;
1436
+ /** Epoch milliseconds on the daemon. */
1437
+ readonly at: S.optional<S.Number>;
1438
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1439
+ readonly command_id: S.optional<S.String>;
1440
+ readonly type: S.Literal<"session.deleted">;
1441
+ readonly session_id: S.String;
1442
+ }>, S.Struct<{
1443
+ /** The session this event belongs to (absent only before one exists). */
1444
+ readonly session_id: S.optional<S.String>;
1445
+ /** Daemon-assigned ordinal, monotonically increasing per session. */
1446
+ readonly seq: S.optional<S.Number>;
1447
+ /** Epoch milliseconds on the daemon. */
1448
+ readonly at: S.optional<S.Number>;
1449
+ /** Echo of the {@link AgentCommand} `id` this event answers, if any. */
1450
+ readonly command_id: S.optional<S.String>;
1451
+ readonly type: S.Literal<"history.page">;
1452
+ readonly before_cursor: S.optional<S.String>;
1453
+ readonly has_more: S.Boolean;
1454
+ readonly events: S.optional<S.$Array<S.Unknown>>;
1455
+ }>]>;
1456
+ export type TAgentEvent = S.Schema.Type<typeof AgentEvent>;
1457
+ export type TAgentEventType = TAgentEvent["type"];
1458
+ /** Narrow {@link TAgentEvent} to one `type`. */
1459
+ export type TAgentEventOf<K extends TAgentEventType> = Extract<TAgentEvent, {
1460
+ readonly type: K;
1461
+ }>;
1462
+ /** Decode an already-parsed JSON value as a command, or null. */
1463
+ export declare const parseAgentCommand: (value: unknown) => TAgentCommand | null;
1464
+ /** Decode an already-parsed JSON value as an event, or null (unknown types too). */
1465
+ export declare const parseAgentEvent: (value: unknown) => TAgentEvent | null;
1466
+ /**
1467
+ * JSON-encode one value as a newline-terminated line. Null when it does not
1468
+ * serialize or exceeds {@link AGENT_MAX_LINE_BYTES} — the caller decides
1469
+ * (truncate, or emit a `runtime.warning`); a truncated line would desync the
1470
+ * framing.
1471
+ */
1472
+ export declare const encodeAgentLine: (value: unknown) => Uint8Array | null;
1473
+ /** Decode one line's bytes (without `\n`) into JSON, or `undefined`. */
1474
+ export declare const decodeAgentLine: (line: Uint8Array) => unknown;
1475
+ export type TAgentLineSplitter = {
1476
+ /**
1477
+ * Feed one chunk; returns the complete lines it finished (without `\n`), or
1478
+ * null once a line exceeds `maxLineBytes` (the splitter stays failed).
1479
+ */
1480
+ readonly push: (chunk: Uint8Array) => readonly Uint8Array[] | null;
1481
+ };
1482
+ /**
1483
+ * Stateful NDJSON splitter. Partial lines are kept as a chunk list and joined
1484
+ * once, when their newline arrives, so a multi-megabyte line costs one copy
1485
+ * rather than one per DATA frame.
1486
+ */
1487
+ export declare const createAgentLineSplitter: (maxLineBytes?: number) => TAgentLineSplitter;