@juspay/shooter 1.0.0

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 (327) hide show
  1. package/.claude/hooks/notifier.cjs +1431 -0
  2. package/.claude/settings.json +162 -0
  3. package/README.md +515 -0
  4. package/bin/shooter.cjs +141 -0
  5. package/build/client/_app/immutable/assets/0.CM9Hl6d-.css +1 -0
  6. package/build/client/_app/immutable/assets/0.CM9Hl6d-.css.br +0 -0
  7. package/build/client/_app/immutable/assets/0.CM9Hl6d-.css.gz +0 -0
  8. package/build/client/_app/immutable/assets/2.CAShZ7lQ.css +1 -0
  9. package/build/client/_app/immutable/assets/2.CAShZ7lQ.css.br +1 -0
  10. package/build/client/_app/immutable/assets/2.CAShZ7lQ.css.gz +0 -0
  11. package/build/client/_app/immutable/assets/3.C0uFg0IS.css +1 -0
  12. package/build/client/_app/immutable/assets/3.C0uFg0IS.css.br +0 -0
  13. package/build/client/_app/immutable/assets/3.C0uFg0IS.css.gz +0 -0
  14. package/build/client/_app/immutable/assets/4.cJuCkJKZ.css +1 -0
  15. package/build/client/_app/immutable/assets/4.cJuCkJKZ.css.br +0 -0
  16. package/build/client/_app/immutable/assets/4.cJuCkJKZ.css.gz +0 -0
  17. package/build/client/_app/immutable/assets/5.DRjApZQW.css +1 -0
  18. package/build/client/_app/immutable/assets/5.DRjApZQW.css.br +0 -0
  19. package/build/client/_app/immutable/assets/5.DRjApZQW.css.gz +0 -0
  20. package/build/client/_app/immutable/assets/6.AraZrY8I.css +1 -0
  21. package/build/client/_app/immutable/assets/6.AraZrY8I.css.br +0 -0
  22. package/build/client/_app/immutable/assets/6.AraZrY8I.css.gz +0 -0
  23. package/build/client/_app/immutable/assets/7.BCJ1IuMx.css +1 -0
  24. package/build/client/_app/immutable/assets/7.BCJ1IuMx.css.br +0 -0
  25. package/build/client/_app/immutable/assets/7.BCJ1IuMx.css.gz +0 -0
  26. package/build/client/_app/immutable/assets/ChatView.CsdBAOKx.css +1 -0
  27. package/build/client/_app/immutable/assets/ChatView.CsdBAOKx.css.br +0 -0
  28. package/build/client/_app/immutable/assets/ChatView.CsdBAOKx.css.gz +0 -0
  29. package/build/client/_app/immutable/assets/markdown.B0b5w2tq.css +1 -0
  30. package/build/client/_app/immutable/assets/markdown.B0b5w2tq.css.br +0 -0
  31. package/build/client/_app/immutable/assets/markdown.B0b5w2tq.css.gz +0 -0
  32. package/build/client/_app/immutable/assets/xterm.DFuMZ0ql.css +1 -0
  33. package/build/client/_app/immutable/assets/xterm.DFuMZ0ql.css.br +0 -0
  34. package/build/client/_app/immutable/assets/xterm.DFuMZ0ql.css.gz +0 -0
  35. package/build/client/_app/immutable/chunks/BNJphC1q.js +56 -0
  36. package/build/client/_app/immutable/chunks/BNJphC1q.js.br +0 -0
  37. package/build/client/_app/immutable/chunks/BNJphC1q.js.gz +0 -0
  38. package/build/client/_app/immutable/chunks/BTGVxaYV.js +9 -0
  39. package/build/client/_app/immutable/chunks/BTGVxaYV.js.br +0 -0
  40. package/build/client/_app/immutable/chunks/BTGVxaYV.js.gz +0 -0
  41. package/build/client/_app/immutable/chunks/BlxrFPDK.js +1 -0
  42. package/build/client/_app/immutable/chunks/BlxrFPDK.js.br +0 -0
  43. package/build/client/_app/immutable/chunks/BlxrFPDK.js.gz +0 -0
  44. package/build/client/_app/immutable/chunks/Bvk7mfPM.js +1 -0
  45. package/build/client/_app/immutable/chunks/Bvk7mfPM.js.br +0 -0
  46. package/build/client/_app/immutable/chunks/Bvk7mfPM.js.gz +0 -0
  47. package/build/client/_app/immutable/chunks/CAokzuPQ.js +1 -0
  48. package/build/client/_app/immutable/chunks/CAokzuPQ.js.br +0 -0
  49. package/build/client/_app/immutable/chunks/CAokzuPQ.js.gz +0 -0
  50. package/build/client/_app/immutable/chunks/CGLrx-H5.js +1 -0
  51. package/build/client/_app/immutable/chunks/CGLrx-H5.js.br +0 -0
  52. package/build/client/_app/immutable/chunks/CGLrx-H5.js.gz +0 -0
  53. package/build/client/_app/immutable/chunks/CgCpWzEA.js +1 -0
  54. package/build/client/_app/immutable/chunks/CgCpWzEA.js.br +0 -0
  55. package/build/client/_app/immutable/chunks/CgCpWzEA.js.gz +0 -0
  56. package/build/client/_app/immutable/chunks/Cjwk_cGO.js +6 -0
  57. package/build/client/_app/immutable/chunks/Cjwk_cGO.js.br +0 -0
  58. package/build/client/_app/immutable/chunks/Cjwk_cGO.js.gz +0 -0
  59. package/build/client/_app/immutable/chunks/CtQ8EED1.js +11 -0
  60. package/build/client/_app/immutable/chunks/CtQ8EED1.js.br +0 -0
  61. package/build/client/_app/immutable/chunks/CtQ8EED1.js.gz +0 -0
  62. package/build/client/_app/immutable/chunks/DERQCisl.js +1 -0
  63. package/build/client/_app/immutable/chunks/DERQCisl.js.br +0 -0
  64. package/build/client/_app/immutable/chunks/DERQCisl.js.gz +0 -0
  65. package/build/client/_app/immutable/chunks/DKrg8TQs.js +1 -0
  66. package/build/client/_app/immutable/chunks/DKrg8TQs.js.br +0 -0
  67. package/build/client/_app/immutable/chunks/DKrg8TQs.js.gz +0 -0
  68. package/build/client/_app/immutable/chunks/DLu6yJIZ.js +1 -0
  69. package/build/client/_app/immutable/chunks/DLu6yJIZ.js.br +0 -0
  70. package/build/client/_app/immutable/chunks/DLu6yJIZ.js.gz +0 -0
  71. package/build/client/_app/immutable/chunks/Dkkpz_4D.js +126 -0
  72. package/build/client/_app/immutable/chunks/Dkkpz_4D.js.br +0 -0
  73. package/build/client/_app/immutable/chunks/Dkkpz_4D.js.gz +0 -0
  74. package/build/client/_app/immutable/chunks/DoczjQhA.js +1 -0
  75. package/build/client/_app/immutable/chunks/DoczjQhA.js.br +0 -0
  76. package/build/client/_app/immutable/chunks/DoczjQhA.js.gz +0 -0
  77. package/build/client/_app/immutable/chunks/PPVm8Dsz.js +1 -0
  78. package/build/client/_app/immutable/chunks/PPVm8Dsz.js.br +0 -0
  79. package/build/client/_app/immutable/chunks/PPVm8Dsz.js.gz +0 -0
  80. package/build/client/_app/immutable/chunks/RpcNruLP.js +2 -0
  81. package/build/client/_app/immutable/chunks/RpcNruLP.js.br +0 -0
  82. package/build/client/_app/immutable/chunks/RpcNruLP.js.gz +0 -0
  83. package/build/client/_app/immutable/chunks/a-St0Zwo.js +1 -0
  84. package/build/client/_app/immutable/chunks/a-St0Zwo.js.br +0 -0
  85. package/build/client/_app/immutable/chunks/a-St0Zwo.js.gz +0 -0
  86. package/build/client/_app/immutable/chunks/bo70OQUZ.js +1 -0
  87. package/build/client/_app/immutable/chunks/bo70OQUZ.js.br +0 -0
  88. package/build/client/_app/immutable/chunks/bo70OQUZ.js.gz +0 -0
  89. package/build/client/_app/immutable/entry/app.QvGgdvTI.js +2 -0
  90. package/build/client/_app/immutable/entry/app.QvGgdvTI.js.br +0 -0
  91. package/build/client/_app/immutable/entry/app.QvGgdvTI.js.gz +0 -0
  92. package/build/client/_app/immutable/entry/start.BntDNRMC.js +1 -0
  93. package/build/client/_app/immutable/entry/start.BntDNRMC.js.br +0 -0
  94. package/build/client/_app/immutable/entry/start.BntDNRMC.js.gz +0 -0
  95. package/build/client/_app/immutable/nodes/0.CzkdvJ7j.js +1 -0
  96. package/build/client/_app/immutable/nodes/0.CzkdvJ7j.js.br +0 -0
  97. package/build/client/_app/immutable/nodes/0.CzkdvJ7j.js.gz +0 -0
  98. package/build/client/_app/immutable/nodes/1.MG1QhfrI.js +1 -0
  99. package/build/client/_app/immutable/nodes/1.MG1QhfrI.js.br +0 -0
  100. package/build/client/_app/immutable/nodes/1.MG1QhfrI.js.gz +0 -0
  101. package/build/client/_app/immutable/nodes/2.B4MlOSh6.js +1 -0
  102. package/build/client/_app/immutable/nodes/2.B4MlOSh6.js.br +0 -0
  103. package/build/client/_app/immutable/nodes/2.B4MlOSh6.js.gz +0 -0
  104. package/build/client/_app/immutable/nodes/3.DIwYkjDn.js +3 -0
  105. package/build/client/_app/immutable/nodes/3.DIwYkjDn.js.br +0 -0
  106. package/build/client/_app/immutable/nodes/3.DIwYkjDn.js.gz +0 -0
  107. package/build/client/_app/immutable/nodes/4.D-cIe70D.js +1 -0
  108. package/build/client/_app/immutable/nodes/4.D-cIe70D.js.br +0 -0
  109. package/build/client/_app/immutable/nodes/4.D-cIe70D.js.gz +0 -0
  110. package/build/client/_app/immutable/nodes/5.D7zPRe3L.js +1 -0
  111. package/build/client/_app/immutable/nodes/5.D7zPRe3L.js.br +0 -0
  112. package/build/client/_app/immutable/nodes/5.D7zPRe3L.js.gz +0 -0
  113. package/build/client/_app/immutable/nodes/6.BB7QE48r.js +2 -0
  114. package/build/client/_app/immutable/nodes/6.BB7QE48r.js.br +0 -0
  115. package/build/client/_app/immutable/nodes/6.BB7QE48r.js.gz +0 -0
  116. package/build/client/_app/immutable/nodes/7.D8mqsrZG.js +2 -0
  117. package/build/client/_app/immutable/nodes/7.D8mqsrZG.js.br +0 -0
  118. package/build/client/_app/immutable/nodes/7.D8mqsrZG.js.gz +0 -0
  119. package/build/client/_app/version.json +1 -0
  120. package/build/client/_app/version.json.br +0 -0
  121. package/build/client/_app/version.json.gz +0 -0
  122. package/build/client/app-icon.png +0 -0
  123. package/build/client/apple-touch-icon.png +0 -0
  124. package/build/client/favicon.png +0 -0
  125. package/build/client/favicon.svg +10 -0
  126. package/build/client/favicon.svg.br +0 -0
  127. package/build/client/favicon.svg.gz +0 -0
  128. package/build/client/manifest.webmanifest +1 -0
  129. package/build/client/pwa-192x192.png +0 -0
  130. package/build/client/pwa-512x512.png +0 -0
  131. package/build/client/registerSW.js +1 -0
  132. package/build/client/registerSW.js.br +0 -0
  133. package/build/client/registerSW.js.gz +0 -0
  134. package/build/client/sw.js +222 -0
  135. package/build/client/sw.js.br +0 -0
  136. package/build/client/sw.js.gz +0 -0
  137. package/build/client/workbox-5119daf5.js +3395 -0
  138. package/build/client/workbox-5119daf5.js.br +0 -0
  139. package/build/client/workbox-5119daf5.js.gz +0 -0
  140. package/build/env.js +94 -0
  141. package/build/handler.js +1494 -0
  142. package/build/index.js +345 -0
  143. package/build/pty-holder.cjs +510 -0
  144. package/build/server/chunks/0-q2IUp76Y.js +9 -0
  145. package/build/server/chunks/0-q2IUp76Y.js.map +1 -0
  146. package/build/server/chunks/1-CU50G5wZ.js +9 -0
  147. package/build/server/chunks/1-CU50G5wZ.js.map +1 -0
  148. package/build/server/chunks/2-D01t9s8T.js +9 -0
  149. package/build/server/chunks/2-D01t9s8T.js.map +1 -0
  150. package/build/server/chunks/3-5PUQ04wC.js +9 -0
  151. package/build/server/chunks/3-5PUQ04wC.js.map +1 -0
  152. package/build/server/chunks/4-e7gywnSG.js +9 -0
  153. package/build/server/chunks/4-e7gywnSG.js.map +1 -0
  154. package/build/server/chunks/5-CA1SA6KZ.js +9 -0
  155. package/build/server/chunks/5-CA1SA6KZ.js.map +1 -0
  156. package/build/server/chunks/6-71H221sV.js +9 -0
  157. package/build/server/chunks/6-71H221sV.js.map +1 -0
  158. package/build/server/chunks/7-Bo-vmdyz.js +9 -0
  159. package/build/server/chunks/7-Bo-vmdyz.js.map +1 -0
  160. package/build/server/chunks/_layout.svelte-SFHOxs74.js +132 -0
  161. package/build/server/chunks/_layout.svelte-SFHOxs74.js.map +1 -0
  162. package/build/server/chunks/_page.svelte-B4w-2wD-.js +120 -0
  163. package/build/server/chunks/_page.svelte-B4w-2wD-.js.map +1 -0
  164. package/build/server/chunks/_page.svelte-B_qAXjkh.js +213 -0
  165. package/build/server/chunks/_page.svelte-B_qAXjkh.js.map +1 -0
  166. package/build/server/chunks/_page.svelte-CsF1_TRG.js +50 -0
  167. package/build/server/chunks/_page.svelte-CsF1_TRG.js.map +1 -0
  168. package/build/server/chunks/_page.svelte-DJC6U-P0.js +68 -0
  169. package/build/server/chunks/_page.svelte-DJC6U-P0.js.map +1 -0
  170. package/build/server/chunks/_page.svelte-DQ6HBtsz.js +407 -0
  171. package/build/server/chunks/_page.svelte-DQ6HBtsz.js.map +1 -0
  172. package/build/server/chunks/_page.svelte-LbhhjP21.js +148 -0
  173. package/build/server/chunks/_page.svelte-LbhhjP21.js.map +1 -0
  174. package/build/server/chunks/_server.ts-BL2FGb5Z.js +387 -0
  175. package/build/server/chunks/_server.ts-BL2FGb5Z.js.map +1 -0
  176. package/build/server/chunks/_server.ts-BgdjBZco.js +47 -0
  177. package/build/server/chunks/_server.ts-BgdjBZco.js.map +1 -0
  178. package/build/server/chunks/_server.ts-BihKSdj_.js +59 -0
  179. package/build/server/chunks/_server.ts-BihKSdj_.js.map +1 -0
  180. package/build/server/chunks/_server.ts-BjOJsoy4.js +63 -0
  181. package/build/server/chunks/_server.ts-BjOJsoy4.js.map +1 -0
  182. package/build/server/chunks/_server.ts-C29xzfaw.js +77 -0
  183. package/build/server/chunks/_server.ts-C29xzfaw.js.map +1 -0
  184. package/build/server/chunks/_server.ts-CPa6DgIt.js +71 -0
  185. package/build/server/chunks/_server.ts-CPa6DgIt.js.map +1 -0
  186. package/build/server/chunks/_server.ts-CbDRDIoP.js +36 -0
  187. package/build/server/chunks/_server.ts-CbDRDIoP.js.map +1 -0
  188. package/build/server/chunks/_server.ts-Cl1OEWL4.js +54 -0
  189. package/build/server/chunks/_server.ts-Cl1OEWL4.js.map +1 -0
  190. package/build/server/chunks/_server.ts-ColfDHW8.js +60 -0
  191. package/build/server/chunks/_server.ts-ColfDHW8.js.map +1 -0
  192. package/build/server/chunks/_server.ts-Cv_OrRuL.js +494 -0
  193. package/build/server/chunks/_server.ts-Cv_OrRuL.js.map +1 -0
  194. package/build/server/chunks/_server.ts-D4MNi4cD.js +25 -0
  195. package/build/server/chunks/_server.ts-D4MNi4cD.js.map +1 -0
  196. package/build/server/chunks/_server.ts-DRVbgm6k.js +125 -0
  197. package/build/server/chunks/_server.ts-DRVbgm6k.js.map +1 -0
  198. package/build/server/chunks/_server.ts-DfajWaqh.js +39 -0
  199. package/build/server/chunks/_server.ts-DfajWaqh.js.map +1 -0
  200. package/build/server/chunks/_server.ts-y9-WYDMa.js +35 -0
  201. package/build/server/chunks/_server.ts-y9-WYDMa.js.map +1 -0
  202. package/build/server/chunks/auth-CEgFis71.js +32 -0
  203. package/build/server/chunks/auth-CEgFis71.js.map +1 -0
  204. package/build/server/chunks/client-CxCatAKr.js +255 -0
  205. package/build/server/chunks/client-CxCatAKr.js.map +1 -0
  206. package/build/server/chunks/error.svelte-BqdwMWdK.js +26 -0
  207. package/build/server/chunks/error.svelte-BqdwMWdK.js.map +1 -0
  208. package/build/server/chunks/exports-CJ0Q5XmL.js +4081 -0
  209. package/build/server/chunks/exports-CJ0Q5XmL.js.map +1 -0
  210. package/build/server/chunks/index2-DAxIoAO-.js +36 -0
  211. package/build/server/chunks/index2-DAxIoAO-.js.map +1 -0
  212. package/build/server/chunks/jsonl-parser-dmZU_Hyu.js +137 -0
  213. package/build/server/chunks/jsonl-parser-dmZU_Hyu.js.map +1 -0
  214. package/build/server/chunks/library-apns-BHxLmuIx.js +104 -0
  215. package/build/server/chunks/library-apns-BHxLmuIx.js.map +1 -0
  216. package/build/server/chunks/markdown-Bxrl3cCF.js +1241 -0
  217. package/build/server/chunks/markdown-Bxrl3cCF.js.map +1 -0
  218. package/build/server/chunks/pending-requests-D8UiTw7L.js +44 -0
  219. package/build/server/chunks/pending-requests-D8UiTw7L.js.map +1 -0
  220. package/build/server/chunks/pty-manager-C0FhBiVq.js +1697 -0
  221. package/build/server/chunks/pty-manager-C0FhBiVq.js.map +1 -0
  222. package/build/server/chunks/shared-server-BDY8jh20.js +200 -0
  223. package/build/server/chunks/shared-server-BDY8jh20.js.map +1 -0
  224. package/build/server/chunks/stores-D0HorpgL.js +36 -0
  225. package/build/server/chunks/stores-D0HorpgL.js.map +1 -0
  226. package/build/server/index.js +6466 -0
  227. package/build/server/index.js.map +1 -0
  228. package/build/server/manifest.js +184 -0
  229. package/build/server/manifest.js.map +1 -0
  230. package/build/shims.js +32 -0
  231. package/package.json +94 -0
  232. package/scripts/clipboard-shims/wl-paste +48 -0
  233. package/scripts/clipboard-shims/xclip +31 -0
  234. package/scripts/install.sh +477 -0
  235. package/scripts/setup-node-pty.sh +63 -0
  236. package/scripts/setup.cjs +571 -0
  237. package/scripts/test-runner.ts +243 -0
  238. package/scripts/vercel-env-commands.sh +60 -0
  239. package/server.ts +139 -0
  240. package/src/app.css +1835 -0
  241. package/src/app.d.ts +31 -0
  242. package/src/app.html +24 -0
  243. package/src/generated/types/APN.ts +305 -0
  244. package/src/generated/types/CLI.ts +52 -0
  245. package/src/generated/types/JWT.ts +92 -0
  246. package/src/generated/types/Terminal.ts +2736 -0
  247. package/src/generated/types/index.ts +6 -0
  248. package/src/lib/assets/icons/alert-triangle.svg +5 -0
  249. package/src/lib/assets/icons/bell.svg +4 -0
  250. package/src/lib/assets/icons/check-circle.svg +4 -0
  251. package/src/lib/assets/icons/file.svg +4 -0
  252. package/src/lib/assets/icons/folder.svg +3 -0
  253. package/src/lib/assets/icons/play.svg +3 -0
  254. package/src/lib/assets/icons/refresh.svg +4 -0
  255. package/src/lib/assets/icons/settings.svg +4 -0
  256. package/src/lib/assets/icons/terminal.svg +1 -0
  257. package/src/lib/assets/icons/tool.svg +3 -0
  258. package/src/lib/assets/icons/x-circle.svg +5 -0
  259. package/src/lib/modules/client/common/Card.svelte +26 -0
  260. package/src/lib/modules/client/common/EmptyState.svelte +36 -0
  261. package/src/lib/modules/client/common/Icon.svelte +61 -0
  262. package/src/lib/modules/client/common/StatusBadge.svelte +38 -0
  263. package/src/lib/modules/client/common/cache.ts +31 -0
  264. package/src/lib/modules/client/common/config-guard.ts +18 -0
  265. package/src/lib/modules/client/common/index.ts +12 -0
  266. package/src/lib/modules/client/common/markdown.ts +23 -0
  267. package/src/lib/modules/client/common/native-bridge.ts +50 -0
  268. package/src/lib/modules/client/common/time.ts +22 -0
  269. package/src/lib/modules/client/common/tool-title.ts +28 -0
  270. package/src/lib/modules/client/terminal/ChatView.svelte +400 -0
  271. package/src/lib/modules/client/terminal/CommandPalette.svelte +60 -0
  272. package/src/lib/modules/client/terminal/ConnectionStatus.svelte +99 -0
  273. package/src/lib/modules/client/terminal/LaunchSheet.svelte +294 -0
  274. package/src/lib/modules/client/terminal/QuickKeys.svelte +71 -0
  275. package/src/lib/modules/client/terminal/ShortcutsHelp.svelte +79 -0
  276. package/src/lib/modules/client/terminal/keyboard-shortcuts.ts +70 -0
  277. package/src/lib/modules/client/terminal/xterm-wrapper.ts +243 -0
  278. package/src/lib/modules/server/apn/library-apns.ts +137 -0
  279. package/src/lib/modules/server/apn/notification-history.ts +35 -0
  280. package/src/lib/modules/server/apn/notification-sessions.ts +117 -0
  281. package/src/lib/modules/server/apn/pending-requests.ts +65 -0
  282. package/src/lib/modules/server/apn/types.ts +51 -0
  283. package/src/lib/modules/server/auth.ts +34 -0
  284. package/src/lib/modules/server/cli/index.ts +79 -0
  285. package/src/lib/modules/server/cli/runner.ts +162 -0
  286. package/src/lib/modules/server/fcm/fcm-service.ts +72 -0
  287. package/src/lib/modules/server/sessions/jsonl-parser.ts +197 -0
  288. package/src/lib/modules/server/sessions/jsonl-reader.ts +301 -0
  289. package/src/lib/modules/server/sessions/opencode-reader.ts +264 -0
  290. package/src/lib/modules/server/sessions/types.ts +53 -0
  291. package/src/lib/modules/server/terminal/holder-client.ts +273 -0
  292. package/src/lib/modules/server/terminal/opencode-watcher.ts +661 -0
  293. package/src/lib/modules/server/terminal/pty-holder.cjs +510 -0
  294. package/src/lib/modules/server/terminal/pty-manager.ts +1012 -0
  295. package/src/lib/modules/server/terminal/session-watcher.ts +320 -0
  296. package/src/lib/modules/server/terminal/terminal-store.ts +198 -0
  297. package/src/lib/modules/server/ws/events-handler.ts +73 -0
  298. package/src/lib/modules/server/ws/keepalive.ts +108 -0
  299. package/src/lib/modules/server/ws/server.ts +93 -0
  300. package/src/lib/modules/server/ws/session-handler.ts +462 -0
  301. package/src/lib/modules/server/ws/terminal-handler.ts +197 -0
  302. package/src/lib/modules/server/ws/ticket-store.ts +58 -0
  303. package/src/lib/theme.css +529 -0
  304. package/src/lib/types/config.ts +6 -0
  305. package/src/routes/+layout.svelte +218 -0
  306. package/src/routes/+page.svelte +261 -0
  307. package/src/routes/api/debug/+server.ts +33 -0
  308. package/src/routes/api/device-token/+server.ts +85 -0
  309. package/src/routes/api/health/+server.ts +100 -0
  310. package/src/routes/api/notify/+server.ts +418 -0
  311. package/src/routes/api/qr-config/+server.ts +45 -0
  312. package/src/routes/api/response/+server.ts +73 -0
  313. package/src/routes/api/sessions/+server.ts +120 -0
  314. package/src/routes/api/terminals/+server.ts +141 -0
  315. package/src/routes/api/terminals/[id]/+server.ts +75 -0
  316. package/src/routes/api/terminals/[id]/paste-image/+server.ts +61 -0
  317. package/src/routes/api/terminals/[id]/resize/+server.ts +60 -0
  318. package/src/routes/api/webhook/+server.ts +42 -0
  319. package/src/routes/api/ws-status/+server.ts +23 -0
  320. package/src/routes/api/ws-ticket/+server.ts +86 -0
  321. package/src/routes/config/+page.svelte +600 -0
  322. package/src/routes/project/+page.svelte +274 -0
  323. package/src/routes/session/[id]/+page.svelte +434 -0
  324. package/src/routes/terminals/+page.svelte +618 -0
  325. package/src/routes/terminals/[id]/+page.svelte +968 -0
  326. package/svelte.config.js +18 -0
  327. package/tsconfig.json +14 -0
@@ -0,0 +1,2736 @@
1
+ import { _decodeArray, _decodeBoolean, _decodeNumber , _decodeString, decodeArray , decodeBoolean, decodeNumber , decodeString, isJSON } from 'type-decoder';
2
+
3
+ /**
4
+ * @type { CreateTerminalRequest }
5
+ * @description Request body for creating a new managed terminal session
6
+ */
7
+ export interface CreateTerminalRequest {
8
+ /**
9
+ * @description Optional command arguments
10
+ * @type { string[] }
11
+ * @memberof CreateTerminalRequest
12
+ */
13
+ args: null | string[];
14
+ /**
15
+ * @description Terminal width in columns (default 80)
16
+ * @type { number }
17
+ * @memberof CreateTerminalRequest
18
+ */
19
+ cols: null | number;
20
+ /**
21
+ * @description The command to execute (e.g. "zsh", "claude", "opencode")
22
+ * @type { string }
23
+ * @memberof CreateTerminalRequest
24
+ */
25
+ command: string;
26
+ /**
27
+ * @description Working directory for the new terminal
28
+ * @type { string }
29
+ * @memberof CreateTerminalRequest
30
+ */
31
+ cwd: string;
32
+ /**
33
+ * @description Terminal height in rows (default 24)
34
+ * @type { number }
35
+ * @memberof CreateTerminalRequest
36
+ */
37
+ rows: null | number;
38
+ }
39
+
40
+ /**
41
+ * @type { CreateTerminalResponse }
42
+ * @description Response after successfully creating a managed terminal session
43
+ */
44
+ export interface CreateTerminalResponse {
45
+ /**
46
+ * @description The command that was launched
47
+ * @type { string }
48
+ * @memberof CreateTerminalResponse
49
+ */
50
+ command: string;
51
+ /**
52
+ * @description ISO 8601 timestamp when the terminal was created
53
+ * @type { string }
54
+ * @memberof CreateTerminalResponse
55
+ */
56
+ createdAt: string;
57
+ /**
58
+ * @description Working directory the terminal was launched in
59
+ * @type { string }
60
+ * @memberof CreateTerminalResponse
61
+ */
62
+ cwd: string;
63
+ /**
64
+ * @description Unique terminal identifier
65
+ * @type { string }
66
+ * @memberof CreateTerminalResponse
67
+ */
68
+ id: string;
69
+ /**
70
+ * @description OS process ID of the spawned process
71
+ * @type { number }
72
+ * @memberof CreateTerminalResponse
73
+ */
74
+ pid: number;
75
+ /**
76
+ * @description WebSocket path for structured session stream, or null if not an AI session
77
+ * @type { string }
78
+ * @memberof CreateTerminalResponse
79
+ */
80
+ sessionWs: null | string;
81
+ /**
82
+ * @description WebSocket path for raw terminal I/O (e.g. "/ws/terminal/term_a1b2c3")
83
+ * @type { string }
84
+ * @memberof CreateTerminalResponse
85
+ */
86
+ ws: string;
87
+ }
88
+
89
+ export type HolderClientMessage =
90
+ | CHolderClientMessage1
91
+ | CHolderClientMessage2
92
+ | CHolderClientMessage3
93
+ | CHolderClientMessage4
94
+ | CHolderClientMessage5
95
+ | CHolderClientMessage6
96
+ ;
97
+
98
+ /**
99
+ * @type { HolderClientMessage1 }
100
+ * @description Current holder state sent on connection
101
+ */
102
+ export interface HolderClientMessage1 {
103
+ /**
104
+ * @description Exit code if process has exited
105
+ * @type { number }
106
+ * @memberof HolderClientMessage1
107
+ */
108
+ exitCode: null | number;
109
+ /**
110
+ * @description Whether the PTY process has exited
111
+ * @type { boolean }
112
+ * @memberof HolderClientMessage1
113
+ */
114
+ exited: boolean;
115
+ /**
116
+ * @description PTY child process ID
117
+ * @type { number }
118
+ * @memberof HolderClientMessage1
119
+ */
120
+ pid: number;
121
+ /**
122
+ * @type { string }
123
+ * @memberof HolderClientMessage1
124
+ */
125
+ type: string;
126
+ }
127
+
128
+ /**
129
+ * @type { HolderClientMessage2 }
130
+ * @description Full scrollback replay sent on connection
131
+ */
132
+ export interface HolderClientMessage2 {
133
+ /**
134
+ * @description Full scrollback buffer content
135
+ * @type { string }
136
+ * @memberof HolderClientMessage2
137
+ */
138
+ data: string;
139
+ /**
140
+ * @type { string }
141
+ * @memberof HolderClientMessage2
142
+ */
143
+ type: string;
144
+ }
145
+
146
+ /**
147
+ * @type { HolderClientMessage3 }
148
+ * @description PTY output chunk during normal operation
149
+ */
150
+ export interface HolderClientMessage3 {
151
+ /**
152
+ * @description Raw PTY output data
153
+ * @type { string }
154
+ * @memberof HolderClientMessage3
155
+ */
156
+ data: string;
157
+ /**
158
+ * @type { string }
159
+ * @memberof HolderClientMessage3
160
+ */
161
+ type: string;
162
+ }
163
+
164
+ /**
165
+ * @type { HolderClientMessage4 }
166
+ * @description PTY process has exited
167
+ */
168
+ export interface HolderClientMessage4 {
169
+ /**
170
+ * @description Process exit code
171
+ * @type { number }
172
+ * @memberof HolderClientMessage4
173
+ */
174
+ code: number;
175
+ /**
176
+ * @description Signal that caused exit
177
+ * @type { string }
178
+ * @memberof HolderClientMessage4
179
+ */
180
+ signal: null | string;
181
+ /**
182
+ * @type { string }
183
+ * @memberof HolderClientMessage4
184
+ */
185
+ type: string;
186
+ }
187
+
188
+ /**
189
+ * @type { HolderClientMessage5 }
190
+ * @description Terminal activity state change (active/idle)
191
+ */
192
+ export interface HolderClientMessage5 {
193
+ /**
194
+ * @description Whether the terminal is currently producing output
195
+ * @type { boolean }
196
+ * @memberof HolderClientMessage5
197
+ */
198
+ active: boolean;
199
+ /**
200
+ * @type { string }
201
+ * @memberof HolderClientMessage5
202
+ */
203
+ type: string;
204
+ }
205
+
206
+ /**
207
+ * @type { HolderClientMessage6 }
208
+ * @description Current working directory change detected via OSC 7
209
+ */
210
+ export interface HolderClientMessage6 {
211
+ /**
212
+ * @description Absolute path of the new working directory
213
+ * @type { string }
214
+ * @memberof HolderClientMessage6
215
+ */
216
+ path: string;
217
+ /**
218
+ * @type { string }
219
+ * @memberof HolderClientMessage6
220
+ */
221
+ type: string;
222
+ }
223
+
224
+ export type HolderServerMessage =
225
+ | CHolderServerMessage1
226
+ | CHolderServerMessage2
227
+ | CHolderServerMessage3
228
+ ;
229
+
230
+ /**
231
+ * @type { HolderServerMessage1 }
232
+ * @description Write data to PTY stdin
233
+ */
234
+ export interface HolderServerMessage1 {
235
+ /**
236
+ * @description Raw input data to write to PTY
237
+ * @type { string }
238
+ * @memberof HolderServerMessage1
239
+ */
240
+ data: string;
241
+ /**
242
+ * @type { string }
243
+ * @memberof HolderServerMessage1
244
+ */
245
+ type: string;
246
+ }
247
+
248
+
249
+ /**
250
+ * @type { HolderServerMessage2 }
251
+ * @description Resize the PTY dimensions
252
+ */
253
+ export interface HolderServerMessage2 {
254
+ /**
255
+ * @description New width in columns
256
+ * @type { number }
257
+ * @memberof HolderServerMessage2
258
+ */
259
+ cols: number;
260
+ /**
261
+ * @description New height in rows
262
+ * @type { number }
263
+ * @memberof HolderServerMessage2
264
+ */
265
+ rows: number;
266
+ /**
267
+ * @type { string }
268
+ * @memberof HolderServerMessage2
269
+ */
270
+ type: string;
271
+ }
272
+
273
+ /**
274
+ * @type { HolderServerMessage3 }
275
+ * @description Send a signal to the PTY process
276
+ */
277
+ export interface HolderServerMessage3 {
278
+ /**
279
+ * @description Signal name to send (default SIGTERM)
280
+ * @type { string }
281
+ * @memberof HolderServerMessage3
282
+ */
283
+ signal: null | string;
284
+ /**
285
+ * @type { string }
286
+ * @memberof HolderServerMessage3
287
+ */
288
+ type: string;
289
+ }
290
+
291
+
292
+ /**
293
+ * @type { ManagedTerminalInfo }
294
+ * @description Serializable info about a managed terminal session (excludes runtime handles like PTY, watchers, client sets)
295
+ */
296
+ export interface ManagedTerminalInfo {
297
+ /**
298
+ * @description Command arguments passed at launch
299
+ * @type { string[] }
300
+ * @memberof ManagedTerminalInfo
301
+ */
302
+ args: string[];
303
+ /**
304
+ * @description The command that was launched (e.g. "zsh", "claude", "opencode")
305
+ * @type { string }
306
+ * @memberof ManagedTerminalInfo
307
+ */
308
+ command: string;
309
+ /**
310
+ * @description ISO 8601 timestamp when the terminal was created
311
+ * @type { string }
312
+ * @memberof ManagedTerminalInfo
313
+ */
314
+ createdAt: string;
315
+ /**
316
+ * @description Current working directory detected via OSC 7, or null if not yet detected
317
+ * @type { string }
318
+ * @memberof ManagedTerminalInfo
319
+ */
320
+ currentCwd: null | string;
321
+ /**
322
+ * @description Working directory the terminal was launched in
323
+ * @type { string }
324
+ * @memberof ManagedTerminalInfo
325
+ */
326
+ cwd: string;
327
+ /**
328
+ * @description Process exit code (0 = success), or null if still running
329
+ * @type { number }
330
+ * @memberof ManagedTerminalInfo
331
+ */
332
+ exitCode: null | number;
333
+ /**
334
+ * @description ISO 8601 timestamp when the process exited, or null if still running
335
+ * @type { string }
336
+ * @memberof ManagedTerminalInfo
337
+ */
338
+ exitedAt: null | string;
339
+ /**
340
+ * @description PID of the PTY holder process, or null if not using holder architecture
341
+ * @type { number }
342
+ * @memberof ManagedTerminalInfo
343
+ */
344
+ holderPid: null | number;
345
+ /**
346
+ * @description Unique terminal identifier (e.g. "term_a1b2c3")
347
+ * @type { string }
348
+ * @memberof ManagedTerminalInfo
349
+ */
350
+ id: string;
351
+ /**
352
+ * @description Whether the terminal is currently producing output (true) or idle (false)
353
+ * @type { boolean }
354
+ * @memberof ManagedTerminalInfo
355
+ */
356
+ isActive: boolean | null;
357
+ /**
358
+ * @description OS process ID of the terminal process
359
+ * @type { number }
360
+ * @memberof ManagedTerminalInfo
361
+ */
362
+ pid: number;
363
+ /**
364
+ * @description Unix domain socket path for the holder process, or null if not applicable
365
+ * @type { string }
366
+ * @memberof ManagedTerminalInfo
367
+ */
368
+ socketPath: null | string;
369
+ /**
370
+ * @description Current lifecycle status of the terminal
371
+ * @type { TerminalStatus }
372
+ * @memberof ManagedTerminalInfo
373
+ */
374
+ status: TerminalStatus;
375
+ }
376
+
377
+ /**
378
+ * @type { RoleEnum }
379
+ * @description Who sent the message
380
+ */
381
+ export type RoleEnum =
382
+ | 'assistant'
383
+ | 'user'
384
+ ;
385
+
386
+
387
+ /**
388
+ * @type { TerminalListResponse }
389
+ * @description Response for listing all managed terminal sessions
390
+ */
391
+ export interface TerminalListResponse {
392
+ /**
393
+ * @description Total number of terminals in the list
394
+ * @type { number }
395
+ * @memberof TerminalListResponse
396
+ */
397
+ count: number;
398
+ /**
399
+ * @description Array of managed terminal info objects
400
+ * @type { ManagedTerminalInfo[] }
401
+ * @memberof TerminalListResponse
402
+ */
403
+ terminals: ManagedTerminalInfo[];
404
+ }
405
+
406
+ /**
407
+ * @type { TerminalRecord }
408
+ * @description Persisted terminal metadata stored in SQLite for recovery across server restarts
409
+ */
410
+ export interface TerminalRecord {
411
+ /**
412
+ * @description JSON-encoded array of command arguments
413
+ * @type { string }
414
+ * @memberof TerminalRecord
415
+ */
416
+ args: string;
417
+ /**
418
+ * @description Terminal width in columns
419
+ * @type { number }
420
+ * @memberof TerminalRecord
421
+ */
422
+ cols: number;
423
+ /**
424
+ * @description The command that was launched
425
+ * @type { string }
426
+ * @memberof TerminalRecord
427
+ */
428
+ command: string;
429
+ /**
430
+ * @description ISO 8601 timestamp when the terminal was created
431
+ * @type { string }
432
+ * @memberof TerminalRecord
433
+ */
434
+ createdAt: string;
435
+ /**
436
+ * @description Working directory the terminal was launched in
437
+ * @type { string }
438
+ * @memberof TerminalRecord
439
+ */
440
+ cwd: string;
441
+ /**
442
+ * @description Process exit code
443
+ * @type { number }
444
+ * @memberof TerminalRecord
445
+ */
446
+ exitCode: null | number;
447
+ /**
448
+ * @description ISO 8601 timestamp when the process exited
449
+ * @type { string }
450
+ * @memberof TerminalRecord
451
+ */
452
+ exitedAt: null | string;
453
+ /**
454
+ * @description Holder process ID
455
+ * @type { number }
456
+ * @memberof TerminalRecord
457
+ */
458
+ holderPid: null | number;
459
+ /**
460
+ * @description Unique terminal identifier
461
+ * @type { string }
462
+ * @memberof TerminalRecord
463
+ */
464
+ id: string;
465
+ /**
466
+ * @description OpenCode SQLite session ID
467
+ * @type { string }
468
+ * @memberof TerminalRecord
469
+ */
470
+ opencodeSessionId: null | string;
471
+ /**
472
+ * @description PTY child process ID
473
+ * @type { number }
474
+ * @memberof TerminalRecord
475
+ */
476
+ pid: null | number;
477
+ /**
478
+ * @description Terminal height in rows
479
+ * @type { number }
480
+ * @memberof TerminalRecord
481
+ */
482
+ rows: number;
483
+ /**
484
+ * @description Claude Code JSONL session file path
485
+ * @type { string }
486
+ * @memberof TerminalRecord
487
+ */
488
+ sessionFile: null | string;
489
+ /**
490
+ * @description Unix domain socket path for holder communication
491
+ * @type { string }
492
+ * @memberof TerminalRecord
493
+ */
494
+ socketPath: null | string;
495
+ /**
496
+ * @description Terminal lifecycle status
497
+ * @type { TerminalStatus }
498
+ * @memberof TerminalRecord
499
+ */
500
+ status: TerminalStatus;
501
+ }
502
+
503
+
504
+ /**
505
+ * @type { TerminalStatus }
506
+ * @description Lifecycle status of a terminal session
507
+ */
508
+ export type TerminalStatus =
509
+ | 'exited'
510
+ | 'orphaned'
511
+ | 'running'
512
+ ;
513
+
514
+ /**
515
+ * @type { ToolExecutionStatus }
516
+ * @description Current execution status of a tool invocation
517
+ */
518
+ export type ToolExecutionStatus =
519
+ | 'done'
520
+ | 'error'
521
+ | 'running'
522
+ ;
523
+
524
+
525
+ /**
526
+ * @type { ToolResultStatus }
527
+ * @description Whether a tool completed successfully or with an error
528
+ */
529
+ export type ToolResultStatus =
530
+ | 'done'
531
+ | 'error'
532
+ ;
533
+
534
+ export type WsEvent =
535
+ | CWsEvent1
536
+ | CWsEvent2
537
+ | CWsEvent3
538
+ | CWsEvent4
539
+ | CWsEvent5
540
+ ;
541
+
542
+
543
+ /**
544
+ * @type { WsEvent1 }
545
+ * @description A new AI session has started
546
+ */
547
+ export interface WsEvent1 {
548
+ /**
549
+ * @description Project name or path
550
+ * @type { string }
551
+ * @memberof WsEvent1
552
+ */
553
+ project: string;
554
+ /**
555
+ * @description Unique session identifier
556
+ * @type { string }
557
+ * @memberof WsEvent1
558
+ */
559
+ sessionId: string;
560
+ /**
561
+ * @description Source tool that started the session (e.g. "claude-code", "opencode")
562
+ * @type { string }
563
+ * @memberof WsEvent1
564
+ */
565
+ source: string;
566
+ /**
567
+ * @type { string }
568
+ * @memberof WsEvent1
569
+ */
570
+ type: string;
571
+ }
572
+
573
+ /**
574
+ * @type { WsEvent2 }
575
+ * @description An AI session has ended
576
+ */
577
+ export interface WsEvent2 {
578
+ /**
579
+ * @description Session identifier that ended
580
+ * @type { string }
581
+ * @memberof WsEvent2
582
+ */
583
+ sessionId: string;
584
+ /**
585
+ * @description Optional summary of what happened in the session
586
+ * @type { string }
587
+ * @memberof WsEvent2
588
+ */
589
+ summary: null | string;
590
+ /**
591
+ * @type { string }
592
+ * @memberof WsEvent2
593
+ */
594
+ type: string;
595
+ }
596
+
597
+
598
+
599
+
600
+ /**
601
+ * @type { WsEvent3 }
602
+ * @description A permission request is awaiting approval
603
+ */
604
+ export interface WsEvent3 {
605
+ /**
606
+ * @description Tool input that requires approval
607
+ * @type { WsEvent3Input }
608
+ * @memberof WsEvent3
609
+ */
610
+ input: WsEvent3Input;
611
+ /**
612
+ * @description Unique request identifier for the permission flow
613
+ * @type { string }
614
+ * @memberof WsEvent3
615
+ */
616
+ requestId: string;
617
+ /**
618
+ * @description Tool requesting permission (e.g. "Bash", "Edit")
619
+ * @type { string }
620
+ * @memberof WsEvent3
621
+ */
622
+ tool: string;
623
+ /**
624
+ * @type { string }
625
+ * @memberof WsEvent3
626
+ */
627
+ type: string;
628
+ }
629
+
630
+ /**
631
+ * @type { WsEvent3Input }
632
+ * @description Tool input that requires approval
633
+ */
634
+ export type WsEvent3Input = Record<string, unknown>;
635
+
636
+
637
+
638
+ /**
639
+ * @type { WsEvent4 }
640
+ * @description A new managed terminal has been created
641
+ */
642
+ export interface WsEvent4 {
643
+ /**
644
+ * @description Command that was launched
645
+ * @type { string }
646
+ * @memberof WsEvent4
647
+ */
648
+ command: string;
649
+ /**
650
+ * @description Unique terminal identifier
651
+ * @type { string }
652
+ * @memberof WsEvent4
653
+ */
654
+ terminalId: string;
655
+ /**
656
+ * @type { string }
657
+ * @memberof WsEvent4
658
+ */
659
+ type: string;
660
+ }
661
+
662
+ /**
663
+ * @type { WsEvent5 }
664
+ * @description A managed terminal process has exited
665
+ */
666
+ export interface WsEvent5 {
667
+ /**
668
+ * @description Process exit code
669
+ * @type { number }
670
+ * @memberof WsEvent5
671
+ */
672
+ code: number;
673
+ /**
674
+ * @description Terminal identifier that exited
675
+ * @type { string }
676
+ * @memberof WsEvent5
677
+ */
678
+ terminalId: string;
679
+ /**
680
+ * @type { string }
681
+ * @memberof WsEvent5
682
+ */
683
+ type: string;
684
+ }
685
+
686
+
687
+
688
+ export type WsSessionMessage =
689
+ | CWsSessionMessage1
690
+ | CWsSessionMessage2
691
+ | CWsSessionMessage3
692
+ ;
693
+
694
+ /**
695
+ * @type { WsSessionMessage1 }
696
+ * @description Subscribe to a live AI session stream
697
+ */
698
+ export interface WsSessionMessage1 {
699
+ /**
700
+ * @description Session ID to subscribe to
701
+ * @type { string }
702
+ * @memberof WsSessionMessage1
703
+ */
704
+ sessionId: string;
705
+ /**
706
+ * @type { string }
707
+ * @memberof WsSessionMessage1
708
+ */
709
+ type: string;
710
+ }
711
+
712
+
713
+
714
+ /**
715
+ * @type { WsSessionMessage2 }
716
+ * @description Send text input to the AI session (writes to PTY stdin with newline)
717
+ */
718
+ export interface WsSessionMessage2 {
719
+ /**
720
+ * @description Text to send to the AI session
721
+ * @type { string }
722
+ * @memberof WsSessionMessage2
723
+ */
724
+ text: string;
725
+ /**
726
+ * @type { string }
727
+ * @memberof WsSessionMessage2
728
+ */
729
+ type: string;
730
+ }
731
+
732
+ /**
733
+ * @type { WsSessionMessage3 }
734
+ * @description Cancel the current AI operation (sends SIGINT to PTY)
735
+ */
736
+ export interface WsSessionMessage3 {
737
+ /**
738
+ * @type { string }
739
+ * @memberof WsSessionMessage3
740
+ */
741
+ type: string;
742
+ }
743
+
744
+
745
+
746
+ export type WsSessionOutput =
747
+ | CWsSessionOutput1
748
+ | CWsSessionOutput2
749
+ | CWsSessionOutput3
750
+ | CWsSessionOutput4
751
+ | CWsSessionOutput5
752
+ | CWsSessionOutput6
753
+ ;
754
+
755
+ /**
756
+ * @type { WsSessionOutput1 }
757
+ * @description Full conversation history sent on connect
758
+ */
759
+ export interface WsSessionOutput1 {
760
+ /**
761
+ * @description All session messages from the beginning up to the current point
762
+ * @type { messagesItem[] }
763
+ * @memberof WsSessionOutput1
764
+ */
765
+ messages: messagesItem[];
766
+ /**
767
+ * @type { string }
768
+ * @memberof WsSessionOutput1
769
+ */
770
+ type: string;
771
+ }
772
+
773
+
774
+
775
+ /**
776
+ * @type { WsSessionOutput2 }
777
+ * @description A new conversation message (user or assistant)
778
+ */
779
+ export interface WsSessionOutput2 {
780
+ /**
781
+ * @description Message content blocks
782
+ * @type { contentItem[] }
783
+ * @memberof WsSessionOutput2
784
+ */
785
+ content: contentItem[];
786
+ /**
787
+ * @description Who sent the message
788
+ * @type { RoleEnum }
789
+ * @memberof WsSessionOutput2
790
+ */
791
+ role: RoleEnum;
792
+ /**
793
+ * @description ISO 8601 timestamp of the message
794
+ * @type { string }
795
+ * @memberof WsSessionOutput2
796
+ */
797
+ timestamp: string;
798
+ /**
799
+ * @type { string }
800
+ * @memberof WsSessionOutput2
801
+ */
802
+ type: string;
803
+ }
804
+
805
+ /**
806
+ * @type { WsSessionOutput3 }
807
+ * @description A tool invocation by the AI assistant
808
+ */
809
+ export interface WsSessionOutput3 {
810
+ /**
811
+ * @description Tool input parameters
812
+ * @type { WsSessionOutput3Input }
813
+ * @memberof WsSessionOutput3
814
+ */
815
+ input: WsSessionOutput3Input;
816
+ /**
817
+ * @description Tool name (e.g. "Edit", "Bash", "Read")
818
+ * @type { string }
819
+ * @memberof WsSessionOutput3
820
+ */
821
+ name: string;
822
+ /**
823
+ * @description Current execution status of the tool
824
+ * @type { ToolExecutionStatus }
825
+ * @memberof WsSessionOutput3
826
+ */
827
+ status: ToolExecutionStatus;
828
+ /**
829
+ * @type { string }
830
+ * @memberof WsSessionOutput3
831
+ */
832
+ type: string;
833
+ }
834
+
835
+
836
+ /**
837
+ * @type { WsSessionOutput3Input }
838
+ * @description Tool input parameters
839
+ */
840
+ export type WsSessionOutput3Input = Record<string, unknown>;
841
+
842
+ /**
843
+ * @type { WsSessionOutput4 }
844
+ * @description Result from a completed tool invocation
845
+ */
846
+ export interface WsSessionOutput4 {
847
+ /**
848
+ * @description Tool use ID this result corresponds to
849
+ * @type { string }
850
+ * @memberof WsSessionOutput4
851
+ */
852
+ id: string;
853
+ /**
854
+ * @description Tool output text
855
+ * @type { string }
856
+ * @memberof WsSessionOutput4
857
+ */
858
+ output: string;
859
+ /**
860
+ * @description Whether the tool completed successfully
861
+ * @type { ToolResultStatus }
862
+ * @memberof WsSessionOutput4
863
+ */
864
+ status: ToolResultStatus;
865
+ /**
866
+ * @type { string }
867
+ * @memberof WsSessionOutput4
868
+ */
869
+ type: string;
870
+ }
871
+
872
+
873
+
874
+
875
+ /**
876
+ * @type { WsSessionOutput5 }
877
+ * @description AI thinking/reasoning block (extended thinking)
878
+ */
879
+ export interface WsSessionOutput5 {
880
+ /**
881
+ * @description Thinking content text
882
+ * @type { string }
883
+ * @memberof WsSessionOutput5
884
+ */
885
+ text: string;
886
+ /**
887
+ * @type { string }
888
+ * @memberof WsSessionOutput5
889
+ */
890
+ type: string;
891
+ }
892
+
893
+ /**
894
+ * @type { WsSessionOutput6 }
895
+ * @description Session has ended (process exited or session file closed)
896
+ */
897
+ export interface WsSessionOutput6 {
898
+ /**
899
+ * @type { string }
900
+ * @memberof WsSessionOutput6
901
+ */
902
+ type: string;
903
+ }
904
+
905
+
906
+
907
+ /**
908
+ * @type { WsStatusResponse }
909
+ * @description Response indicating how many WebSocket clients are currently connected
910
+ */
911
+ export interface WsStatusResponse {
912
+ /**
913
+ * @description Number of active WebSocket connections across all channels
914
+ * @type { number }
915
+ * @memberof WsStatusResponse
916
+ */
917
+ connectedClients: number;
918
+ }
919
+
920
+ export type WsTerminalMessage =
921
+ | CWsTerminalMessage1
922
+ | CWsTerminalMessage2
923
+ | CWsTerminalMessage3
924
+ ;
925
+
926
+
927
+
928
+ /**
929
+ * @type { WsTerminalMessage1 }
930
+ * @description Send keyboard input to the terminal PTY
931
+ */
932
+ export interface WsTerminalMessage1 {
933
+ /**
934
+ * @description Raw terminal input data (keystrokes, pasted text)
935
+ * @type { string }
936
+ * @memberof WsTerminalMessage1
937
+ */
938
+ data: string;
939
+ /**
940
+ * @type { string }
941
+ * @memberof WsTerminalMessage1
942
+ */
943
+ type: string;
944
+ }
945
+
946
+ /**
947
+ * @type { WsTerminalMessage2 }
948
+ * @description Resize the terminal PTY dimensions
949
+ */
950
+ export interface WsTerminalMessage2 {
951
+ /**
952
+ * @description New terminal width in columns
953
+ * @type { number }
954
+ * @memberof WsTerminalMessage2
955
+ */
956
+ cols: number;
957
+ /**
958
+ * @description New terminal height in rows
959
+ * @type { number }
960
+ * @memberof WsTerminalMessage2
961
+ */
962
+ rows: number;
963
+ /**
964
+ * @type { string }
965
+ * @memberof WsTerminalMessage2
966
+ */
967
+ type: string;
968
+ }
969
+
970
+
971
+
972
+ /**
973
+ * @type { WsTerminalMessage3 }
974
+ * @description Send a signal to the terminal process
975
+ */
976
+ export interface WsTerminalMessage3 {
977
+ /**
978
+ * @description Signal name to send (e.g. "SIGINT", "SIGTERM", "SIGTSTP")
979
+ * @type { string }
980
+ * @memberof WsTerminalMessage3
981
+ */
982
+ signal: string;
983
+ /**
984
+ * @type { string }
985
+ * @memberof WsTerminalMessage3
986
+ */
987
+ type: string;
988
+ }
989
+
990
+ export type WsTerminalOutput =
991
+ | CWsTerminalOutput1
992
+ | CWsTerminalOutput2
993
+ | CWsTerminalOutput3
994
+ | CWsTerminalOutput4
995
+ ;
996
+
997
+
998
+
999
+ /**
1000
+ * @type { WsTerminalOutput1 }
1001
+ * @description Terminal output data from the PTY
1002
+ */
1003
+ export interface WsTerminalOutput1 {
1004
+ /**
1005
+ * @description Raw terminal output data
1006
+ * @type { string }
1007
+ * @memberof WsTerminalOutput1
1008
+ */
1009
+ data: string;
1010
+ /**
1011
+ * @type { string }
1012
+ * @memberof WsTerminalOutput1
1013
+ */
1014
+ type: string;
1015
+ }
1016
+
1017
+ /**
1018
+ * @type { WsTerminalOutput2 }
1019
+ * @description Terminal process has exited
1020
+ */
1021
+ export interface WsTerminalOutput2 {
1022
+ /**
1023
+ * @description Process exit code
1024
+ * @type { number }
1025
+ * @memberof WsTerminalOutput2
1026
+ */
1027
+ code: number;
1028
+ /**
1029
+ * @description Signal that caused the exit, or null if exited normally
1030
+ * @type { string }
1031
+ * @memberof WsTerminalOutput2
1032
+ */
1033
+ signal: null | string;
1034
+ /**
1035
+ * @type { string }
1036
+ * @memberof WsTerminalOutput2
1037
+ */
1038
+ type: string;
1039
+ }
1040
+
1041
+
1042
+
1043
+ /**
1044
+ * @type { WsTerminalOutput3 }
1045
+ * @description Scrollback chunk sent on reconnection
1046
+ */
1047
+ export interface WsTerminalOutput3 {
1048
+ /**
1049
+ * @description 1-based chunk index
1050
+ * @type { number }
1051
+ * @memberof WsTerminalOutput3
1052
+ */
1053
+ chunk: number;
1054
+ /**
1055
+ * @description Scrollback content for this chunk (max 50KB)
1056
+ * @type { string }
1057
+ * @memberof WsTerminalOutput3
1058
+ */
1059
+ data: string;
1060
+ /**
1061
+ * @description Total number of scrollback chunks
1062
+ * @type { number }
1063
+ * @memberof WsTerminalOutput3
1064
+ */
1065
+ total: number;
1066
+ /**
1067
+ * @type { string }
1068
+ * @memberof WsTerminalOutput3
1069
+ */
1070
+ type: string;
1071
+ }
1072
+
1073
+ /**
1074
+ * @type { WsTerminalOutput4 }
1075
+ * @description Error message from the terminal server
1076
+ */
1077
+ export interface WsTerminalOutput4 {
1078
+ /**
1079
+ * @description Human-readable error message
1080
+ * @type { string }
1081
+ * @memberof WsTerminalOutput4
1082
+ */
1083
+ message: string;
1084
+ /**
1085
+ * @type { string }
1086
+ * @memberof WsTerminalOutput4
1087
+ */
1088
+ type: string;
1089
+ }
1090
+
1091
+
1092
+
1093
+ /**
1094
+ * @type { WsTicketResponse }
1095
+ * @description Response containing a short-lived ticket for WebSocket authentication
1096
+ */
1097
+ export interface WsTicketResponse {
1098
+ /**
1099
+ * @description ISO 8601 timestamp when the ticket expires
1100
+ * @type { string }
1101
+ * @memberof WsTicketResponse
1102
+ */
1103
+ expiresAt: string;
1104
+ /**
1105
+ * @description Single-use random ticket string (expires in 30 seconds)
1106
+ * @type { string }
1107
+ * @memberof WsTicketResponse
1108
+ */
1109
+ ticket: string;
1110
+ }
1111
+
1112
+ export class CHolderClientMessageHolderClientMessage1 {
1113
+ data: HolderClientMessage1;
1114
+ constructor(data: HolderClientMessage1) {
1115
+ this.data = data;
1116
+ }
1117
+ }
1118
+
1119
+
1120
+
1121
+ export class CHolderClientMessageHolderClientMessage2 {
1122
+ data: HolderClientMessage2;
1123
+ constructor(data: HolderClientMessage2) {
1124
+ this.data = data;
1125
+ }
1126
+ }
1127
+
1128
+ export class CHolderClientMessageHolderClientMessage3 {
1129
+ data: HolderClientMessage3;
1130
+ constructor(data: HolderClientMessage3) {
1131
+ this.data = data;
1132
+ }
1133
+ }
1134
+
1135
+
1136
+ export class CHolderClientMessageHolderClientMessage4 {
1137
+ data: HolderClientMessage4;
1138
+ constructor(data: HolderClientMessage4) {
1139
+ this.data = data;
1140
+ }
1141
+ }
1142
+
1143
+ export class CHolderClientMessageHolderClientMessage5 {
1144
+ data: HolderClientMessage5;
1145
+ constructor(data: HolderClientMessage5) {
1146
+ this.data = data;
1147
+ }
1148
+ }
1149
+
1150
+
1151
+
1152
+
1153
+ export class CHolderClientMessageHolderClientMessage6 {
1154
+ data: HolderClientMessage6;
1155
+ constructor(data: HolderClientMessage6) {
1156
+ this.data = data;
1157
+ }
1158
+ }
1159
+
1160
+ export class CHolderServerMessageHolderServerMessage1 {
1161
+ data: HolderServerMessage1;
1162
+ constructor(data: HolderServerMessage1) {
1163
+ this.data = data;
1164
+ }
1165
+ }
1166
+
1167
+
1168
+
1169
+ export class CHolderServerMessageHolderServerMessage2 {
1170
+ data: HolderServerMessage2;
1171
+ constructor(data: HolderServerMessage2) {
1172
+ this.data = data;
1173
+ }
1174
+ }
1175
+
1176
+ export class CHolderServerMessageHolderServerMessage3 {
1177
+ data: HolderServerMessage3;
1178
+ constructor(data: HolderServerMessage3) {
1179
+ this.data = data;
1180
+ }
1181
+ }
1182
+
1183
+
1184
+
1185
+ export class CWsEventWsEvent1 {
1186
+ data: WsEvent1;
1187
+ constructor(data: WsEvent1) {
1188
+ this.data = data;
1189
+ }
1190
+ }
1191
+
1192
+ export class CWsEventWsEvent2 {
1193
+ data: WsEvent2;
1194
+ constructor(data: WsEvent2) {
1195
+ this.data = data;
1196
+ }
1197
+ }
1198
+
1199
+
1200
+
1201
+ export class CWsEventWsEvent3 {
1202
+ data: WsEvent3;
1203
+ constructor(data: WsEvent3) {
1204
+ this.data = data;
1205
+ }
1206
+ }
1207
+
1208
+ export class CWsEventWsEvent4 {
1209
+ data: WsEvent4;
1210
+ constructor(data: WsEvent4) {
1211
+ this.data = data;
1212
+ }
1213
+ }
1214
+
1215
+
1216
+
1217
+ export class CWsEventWsEvent5 {
1218
+ data: WsEvent5;
1219
+ constructor(data: WsEvent5) {
1220
+ this.data = data;
1221
+ }
1222
+ }
1223
+
1224
+ export class CWsSessionMessageWsSessionMessage1 {
1225
+ data: WsSessionMessage1;
1226
+ constructor(data: WsSessionMessage1) {
1227
+ this.data = data;
1228
+ }
1229
+ }
1230
+
1231
+
1232
+
1233
+ export class CWsSessionMessageWsSessionMessage2 {
1234
+ data: WsSessionMessage2;
1235
+ constructor(data: WsSessionMessage2) {
1236
+ this.data = data;
1237
+ }
1238
+ }
1239
+
1240
+ export class CWsSessionMessageWsSessionMessage3 {
1241
+ data: WsSessionMessage3;
1242
+ constructor(data: WsSessionMessage3) {
1243
+ this.data = data;
1244
+ }
1245
+ }
1246
+
1247
+
1248
+ export class CWsSessionOutputWsSessionOutput1 {
1249
+ data: WsSessionOutput1;
1250
+ constructor(data: WsSessionOutput1) {
1251
+ this.data = data;
1252
+ }
1253
+ }
1254
+
1255
+ export class CWsSessionOutputWsSessionOutput2 {
1256
+ data: WsSessionOutput2;
1257
+ constructor(data: WsSessionOutput2) {
1258
+ this.data = data;
1259
+ }
1260
+ }
1261
+
1262
+
1263
+
1264
+
1265
+ export class CWsSessionOutputWsSessionOutput3 {
1266
+ data: WsSessionOutput3;
1267
+ constructor(data: WsSessionOutput3) {
1268
+ this.data = data;
1269
+ }
1270
+ }
1271
+
1272
+ export class CWsSessionOutputWsSessionOutput4 {
1273
+ data: WsSessionOutput4;
1274
+ constructor(data: WsSessionOutput4) {
1275
+ this.data = data;
1276
+ }
1277
+ }
1278
+
1279
+
1280
+
1281
+ export class CWsSessionOutputWsSessionOutput5 {
1282
+ data: WsSessionOutput5;
1283
+ constructor(data: WsSessionOutput5) {
1284
+ this.data = data;
1285
+ }
1286
+ }
1287
+
1288
+ export class CWsSessionOutputWsSessionOutput6 {
1289
+ data: WsSessionOutput6;
1290
+ constructor(data: WsSessionOutput6) {
1291
+ this.data = data;
1292
+ }
1293
+ }
1294
+
1295
+
1296
+
1297
+ export class CWsTerminalMessageWsTerminalMessage1 {
1298
+ data: WsTerminalMessage1;
1299
+ constructor(data: WsTerminalMessage1) {
1300
+ this.data = data;
1301
+ }
1302
+ }
1303
+
1304
+ export class CWsTerminalMessageWsTerminalMessage2 {
1305
+ data: WsTerminalMessage2;
1306
+ constructor(data: WsTerminalMessage2) {
1307
+ this.data = data;
1308
+ }
1309
+ }
1310
+
1311
+ export class CWsTerminalMessageWsTerminalMessage3 {
1312
+ data: WsTerminalMessage3;
1313
+ constructor(data: WsTerminalMessage3) {
1314
+ this.data = data;
1315
+ }
1316
+ }
1317
+
1318
+ export class CWsTerminalOutputWsTerminalOutput1 {
1319
+ data: WsTerminalOutput1;
1320
+ constructor(data: WsTerminalOutput1) {
1321
+ this.data = data;
1322
+ }
1323
+ }
1324
+
1325
+ export class CWsTerminalOutputWsTerminalOutput2 {
1326
+ data: WsTerminalOutput2;
1327
+ constructor(data: WsTerminalOutput2) {
1328
+ this.data = data;
1329
+ }
1330
+ }
1331
+
1332
+
1333
+ export class CWsTerminalOutputWsTerminalOutput3 {
1334
+ data: WsTerminalOutput3;
1335
+ constructor(data: WsTerminalOutput3) {
1336
+ this.data = data;
1337
+ }
1338
+ }
1339
+
1340
+ export class CWsTerminalOutputWsTerminalOutput4 {
1341
+ data: WsTerminalOutput4;
1342
+ constructor(data: WsTerminalOutput4) {
1343
+ this.data = data;
1344
+ }
1345
+ }
1346
+
1347
+
1348
+
1349
+ export function _decodeRoleEnum(rawInput: unknown): RoleEnum | undefined {
1350
+ switch (rawInput) {
1351
+ case 'assistant':
1352
+ case 'user':
1353
+ return rawInput;
1354
+ }
1355
+ return;
1356
+ }
1357
+
1358
+ export function _decodeTerminalStatus(rawInput: unknown): TerminalStatus | undefined {
1359
+ switch (rawInput) {
1360
+ case 'exited':
1361
+ case 'orphaned':
1362
+ case 'running':
1363
+ return rawInput;
1364
+ }
1365
+ return;
1366
+ }
1367
+
1368
+ export function _decodeToolExecutionStatus(rawInput: unknown): ToolExecutionStatus | undefined {
1369
+ switch (rawInput) {
1370
+ case 'done':
1371
+ case 'error':
1372
+ case 'running':
1373
+ return rawInput;
1374
+ }
1375
+ return;
1376
+ }
1377
+
1378
+ export function _decodeToolResultStatus(rawInput: unknown): ToolResultStatus | undefined {
1379
+ switch (rawInput) {
1380
+ case 'done':
1381
+ case 'error':
1382
+ return rawInput;
1383
+ }
1384
+ return;
1385
+ }
1386
+
1387
+
1388
+
1389
+ export function decodeCHolderClientMessage1(rawInput: unknown) {
1390
+ const result = decodeHolderClientMessage1(rawInput);
1391
+ if (result === null) {
1392
+ return null;
1393
+ }
1394
+ return new CHolderClientMessageHolderClientMessage1(result);
1395
+ }
1396
+
1397
+ export function decodeCHolderClientMessage2(rawInput: unknown) {
1398
+ const result = decodeHolderClientMessage2(rawInput);
1399
+ if (result === null) {
1400
+ return null;
1401
+ }
1402
+ return new CHolderClientMessageHolderClientMessage2(result);
1403
+ }
1404
+
1405
+
1406
+
1407
+ export function decodeCHolderClientMessage3(rawInput: unknown) {
1408
+ const result = decodeHolderClientMessage3(rawInput);
1409
+ if (result === null) {
1410
+ return null;
1411
+ }
1412
+ return new CHolderClientMessageHolderClientMessage3(result);
1413
+ }
1414
+
1415
+ export function decodeCHolderClientMessage4(rawInput: unknown) {
1416
+ const result = decodeHolderClientMessage4(rawInput);
1417
+ if (result === null) {
1418
+ return null;
1419
+ }
1420
+ return new CHolderClientMessageHolderClientMessage4(result);
1421
+ }
1422
+
1423
+
1424
+
1425
+ export function decodeCHolderClientMessage5(rawInput: unknown) {
1426
+ const result = decodeHolderClientMessage5(rawInput);
1427
+ if (result === null) {
1428
+ return null;
1429
+ }
1430
+ return new CHolderClientMessageHolderClientMessage5(result);
1431
+ }
1432
+
1433
+ export function decodeCHolderClientMessage6(rawInput: unknown) {
1434
+ const result = decodeHolderClientMessage6(rawInput);
1435
+ if (result === null) {
1436
+ return null;
1437
+ }
1438
+ return new CHolderClientMessageHolderClientMessage6(result);
1439
+ }
1440
+
1441
+
1442
+
1443
+ export function decodeCHolderServerMessage1(rawInput: unknown) {
1444
+ const result = decodeHolderServerMessage1(rawInput);
1445
+ if (result === null) {
1446
+ return null;
1447
+ }
1448
+ return new CHolderServerMessageHolderServerMessage1(result);
1449
+ }
1450
+
1451
+ export function decodeCHolderServerMessage2(rawInput: unknown) {
1452
+ const result = decodeHolderServerMessage2(rawInput);
1453
+ if (result === null) {
1454
+ return null;
1455
+ }
1456
+ return new CHolderServerMessageHolderServerMessage2(result);
1457
+ }
1458
+
1459
+
1460
+
1461
+ export function decodeCHolderServerMessage3(rawInput: unknown) {
1462
+ const result = decodeHolderServerMessage3(rawInput);
1463
+ if (result === null) {
1464
+ return null;
1465
+ }
1466
+ return new CHolderServerMessageHolderServerMessage3(result);
1467
+ }
1468
+
1469
+ export function decodeCreateTerminalRequest(rawInput: unknown): CreateTerminalRequest | null {
1470
+ if (isJSON(rawInput)) {
1471
+ const decodedCommand = decodeString(rawInput.command);
1472
+ const decodedArgs = decodeArray(rawInput.args, decodeString);
1473
+ const decodedCwd = decodeString(rawInput.cwd);
1474
+ const decodedCols = decodeNumber(rawInput.cols);
1475
+ const decodedRows = decodeNumber(rawInput.rows);
1476
+
1477
+ if (
1478
+ decodedCommand === null ||
1479
+ decodedCwd === null
1480
+ ) {
1481
+ return null;
1482
+ }
1483
+
1484
+ return {
1485
+ args: decodedArgs,
1486
+ cols: decodedCols,
1487
+ command: decodedCommand,
1488
+ cwd: decodedCwd,
1489
+ rows: decodedRows
1490
+ };
1491
+ }
1492
+ return null;
1493
+ }
1494
+
1495
+
1496
+
1497
+ export function decodeCreateTerminalResponse(rawInput: unknown): CreateTerminalResponse | null {
1498
+ if (isJSON(rawInput)) {
1499
+ const decodedId = decodeString(rawInput.id);
1500
+ const decodedPid = decodeNumber(rawInput.pid);
1501
+ const decodedCommand = decodeString(rawInput.command);
1502
+ const decodedCwd = decodeString(rawInput.cwd);
1503
+ const decodedWs = decodeString(rawInput.ws);
1504
+ const decodedSessionWs = decodeString(rawInput.sessionWs);
1505
+ const decodedCreatedAt = decodeString(rawInput.createdAt);
1506
+
1507
+ if (
1508
+ decodedId === null ||
1509
+ decodedPid === null ||
1510
+ decodedCommand === null ||
1511
+ decodedCwd === null ||
1512
+ decodedWs === null ||
1513
+ decodedCreatedAt === null
1514
+ ) {
1515
+ return null;
1516
+ }
1517
+
1518
+ return {
1519
+ command: decodedCommand,
1520
+ createdAt: decodedCreatedAt,
1521
+ cwd: decodedCwd,
1522
+ id: decodedId,
1523
+ pid: decodedPid,
1524
+ sessionWs: decodedSessionWs,
1525
+ ws: decodedWs
1526
+ };
1527
+ }
1528
+ return null;
1529
+ }
1530
+
1531
+ export function decodeCWsEvent1(rawInput: unknown) {
1532
+ const result = decodeWsEvent1(rawInput);
1533
+ if (result === null) {
1534
+ return null;
1535
+ }
1536
+ return new CWsEventWsEvent1(result);
1537
+ }
1538
+
1539
+
1540
+
1541
+ export function decodeCWsEvent2(rawInput: unknown) {
1542
+ const result = decodeWsEvent2(rawInput);
1543
+ if (result === null) {
1544
+ return null;
1545
+ }
1546
+ return new CWsEventWsEvent2(result);
1547
+ }
1548
+
1549
+ export function decodeCWsEvent3(rawInput: unknown) {
1550
+ const result = decodeWsEvent3(rawInput);
1551
+ if (result === null) {
1552
+ return null;
1553
+ }
1554
+ return new CWsEventWsEvent3(result);
1555
+ }
1556
+
1557
+
1558
+ export function decodeCWsEvent4(rawInput: unknown) {
1559
+ const result = decodeWsEvent4(rawInput);
1560
+ if (result === null) {
1561
+ return null;
1562
+ }
1563
+ return new CWsEventWsEvent4(result);
1564
+ }
1565
+
1566
+ export function decodeCWsEvent5(rawInput: unknown) {
1567
+ const result = decodeWsEvent5(rawInput);
1568
+ if (result === null) {
1569
+ return null;
1570
+ }
1571
+ return new CWsEventWsEvent5(result);
1572
+ }
1573
+
1574
+
1575
+
1576
+
1577
+ export function decodeCWsSessionMessage1(rawInput: unknown) {
1578
+ const result = decodeWsSessionMessage1(rawInput);
1579
+ if (result === null) {
1580
+ return null;
1581
+ }
1582
+ return new CWsSessionMessageWsSessionMessage1(result);
1583
+ }
1584
+
1585
+ export function decodeCWsSessionMessage2(rawInput: unknown) {
1586
+ const result = decodeWsSessionMessage2(rawInput);
1587
+ if (result === null) {
1588
+ return null;
1589
+ }
1590
+ return new CWsSessionMessageWsSessionMessage2(result);
1591
+ }
1592
+
1593
+
1594
+
1595
+ export function decodeCWsSessionMessage3(rawInput: unknown) {
1596
+ const result = decodeWsSessionMessage3(rawInput);
1597
+ if (result === null) {
1598
+ return null;
1599
+ }
1600
+ return new CWsSessionMessageWsSessionMessage3(result);
1601
+ }
1602
+
1603
+ export function decodeCWsSessionOutput1(rawInput: unknown) {
1604
+ const result = decodeWsSessionOutput1(rawInput);
1605
+ if (result === null) {
1606
+ return null;
1607
+ }
1608
+ return new CWsSessionOutputWsSessionOutput1(result);
1609
+ }
1610
+
1611
+
1612
+
1613
+ export function decodeCWsSessionOutput2(rawInput: unknown) {
1614
+ const result = decodeWsSessionOutput2(rawInput);
1615
+ if (result === null) {
1616
+ return null;
1617
+ }
1618
+ return new CWsSessionOutputWsSessionOutput2(result);
1619
+ }
1620
+
1621
+ export function decodeCWsSessionOutput3(rawInput: unknown) {
1622
+ const result = decodeWsSessionOutput3(rawInput);
1623
+ if (result === null) {
1624
+ return null;
1625
+ }
1626
+ return new CWsSessionOutputWsSessionOutput3(result);
1627
+ }
1628
+
1629
+
1630
+
1631
+ export function decodeCWsSessionOutput4(rawInput: unknown) {
1632
+ const result = decodeWsSessionOutput4(rawInput);
1633
+ if (result === null) {
1634
+ return null;
1635
+ }
1636
+ return new CWsSessionOutputWsSessionOutput4(result);
1637
+ }
1638
+
1639
+ export function decodeCWsSessionOutput5(rawInput: unknown) {
1640
+ const result = decodeWsSessionOutput5(rawInput);
1641
+ if (result === null) {
1642
+ return null;
1643
+ }
1644
+ return new CWsSessionOutputWsSessionOutput5(result);
1645
+ }
1646
+
1647
+
1648
+
1649
+ export function decodeCWsSessionOutput6(rawInput: unknown) {
1650
+ const result = decodeWsSessionOutput6(rawInput);
1651
+ if (result === null) {
1652
+ return null;
1653
+ }
1654
+ return new CWsSessionOutputWsSessionOutput6(result);
1655
+ }
1656
+
1657
+ export function decodeCWsTerminalMessage1(rawInput: unknown) {
1658
+ const result = decodeWsTerminalMessage1(rawInput);
1659
+ if (result === null) {
1660
+ return null;
1661
+ }
1662
+ return new CWsTerminalMessageWsTerminalMessage1(result);
1663
+ }
1664
+
1665
+ export function decodeCWsTerminalMessage2(rawInput: unknown) {
1666
+ const result = decodeWsTerminalMessage2(rawInput);
1667
+ if (result === null) {
1668
+ return null;
1669
+ }
1670
+ return new CWsTerminalMessageWsTerminalMessage2(result);
1671
+ }
1672
+
1673
+ export function decodeCWsTerminalMessage3(rawInput: unknown) {
1674
+ const result = decodeWsTerminalMessage3(rawInput);
1675
+ if (result === null) {
1676
+ return null;
1677
+ }
1678
+ return new CWsTerminalMessageWsTerminalMessage3(result);
1679
+ }
1680
+
1681
+
1682
+
1683
+ export function decodeCWsTerminalOutput1(rawInput: unknown) {
1684
+ const result = decodeWsTerminalOutput1(rawInput);
1685
+ if (result === null) {
1686
+ return null;
1687
+ }
1688
+ return new CWsTerminalOutputWsTerminalOutput1(result);
1689
+ }
1690
+
1691
+ export function decodeCWsTerminalOutput2(rawInput: unknown) {
1692
+ const result = decodeWsTerminalOutput2(rawInput);
1693
+ if (result === null) {
1694
+ return null;
1695
+ }
1696
+ return new CWsTerminalOutputWsTerminalOutput2(result);
1697
+ }
1698
+
1699
+
1700
+
1701
+ export function decodeCWsTerminalOutput3(rawInput: unknown) {
1702
+ const result = decodeWsTerminalOutput3(rawInput);
1703
+ if (result === null) {
1704
+ return null;
1705
+ }
1706
+ return new CWsTerminalOutputWsTerminalOutput3(result);
1707
+ }
1708
+
1709
+ export function decodeCWsTerminalOutput4(rawInput: unknown) {
1710
+ const result = decodeWsTerminalOutput4(rawInput);
1711
+ if (result === null) {
1712
+ return null;
1713
+ }
1714
+ return new CWsTerminalOutputWsTerminalOutput4(result);
1715
+ }
1716
+
1717
+
1718
+
1719
+ export function decodeHolderClientMessage(rawInput: unknown): HolderClientMessage | null {
1720
+ const result: HolderClientMessage | null =
1721
+ decodeCHolderClientMessage1(rawInput)
1722
+ ??
1723
+ decodeCHolderClientMessage2(rawInput)
1724
+ ??
1725
+ decodeCHolderClientMessage3(rawInput)
1726
+ ??
1727
+ decodeCHolderClientMessage4(rawInput)
1728
+ ??
1729
+ decodeCHolderClientMessage5(rawInput)
1730
+ ??
1731
+ decodeCHolderClientMessage6(rawInput)
1732
+
1733
+ ;
1734
+ return result;
1735
+ }
1736
+
1737
+ export function decodeHolderClientMessage1(rawInput: unknown): HolderClientMessage1 | null {
1738
+ if (isJSON(rawInput)) {
1739
+ const decodedType = decodeString(rawInput.type);
1740
+ const decodedPid = decodeNumber(rawInput.pid);
1741
+ const decodedExited = decodeBoolean(rawInput.exited);
1742
+ const decodedExitCode = decodeNumber(rawInput.exitCode);
1743
+
1744
+ if (
1745
+ decodedType === null ||
1746
+ decodedPid === null ||
1747
+ decodedExited === null
1748
+ ) {
1749
+ return null;
1750
+ }
1751
+
1752
+ return {
1753
+ exitCode: decodedExitCode,
1754
+ exited: decodedExited,
1755
+ pid: decodedPid,
1756
+ type: decodedType
1757
+ };
1758
+ }
1759
+ return null;
1760
+ }
1761
+
1762
+
1763
+
1764
+ export function decodeHolderClientMessage2(rawInput: unknown): HolderClientMessage2 | null {
1765
+ if (isJSON(rawInput)) {
1766
+ const decodedType = decodeString(rawInput.type);
1767
+ const decodedData = decodeString(rawInput.data);
1768
+
1769
+ if (
1770
+ decodedType === null ||
1771
+ decodedData === null
1772
+ ) {
1773
+ return null;
1774
+ }
1775
+
1776
+ return {
1777
+ data: decodedData,
1778
+ type: decodedType
1779
+ };
1780
+ }
1781
+ return null;
1782
+ }
1783
+
1784
+ export function decodeHolderClientMessage3(rawInput: unknown): HolderClientMessage3 | null {
1785
+ if (isJSON(rawInput)) {
1786
+ const decodedType = decodeString(rawInput.type);
1787
+ const decodedData = decodeString(rawInput.data);
1788
+
1789
+ if (
1790
+ decodedType === null ||
1791
+ decodedData === null
1792
+ ) {
1793
+ return null;
1794
+ }
1795
+
1796
+ return {
1797
+ data: decodedData,
1798
+ type: decodedType
1799
+ };
1800
+ }
1801
+ return null;
1802
+ }
1803
+
1804
+
1805
+
1806
+ export function decodeHolderClientMessage4(rawInput: unknown): HolderClientMessage4 | null {
1807
+ if (isJSON(rawInput)) {
1808
+ const decodedType = decodeString(rawInput.type);
1809
+ const decodedCode = decodeNumber(rawInput.code);
1810
+ const decodedSignal = decodeString(rawInput.signal);
1811
+
1812
+ if (
1813
+ decodedType === null ||
1814
+ decodedCode === null
1815
+ ) {
1816
+ return null;
1817
+ }
1818
+
1819
+ return {
1820
+ code: decodedCode,
1821
+ signal: decodedSignal,
1822
+ type: decodedType
1823
+ };
1824
+ }
1825
+ return null;
1826
+ }
1827
+
1828
+ export function decodeHolderClientMessage5(rawInput: unknown): HolderClientMessage5 | null {
1829
+ if (isJSON(rawInput)) {
1830
+ const decodedType = decodeString(rawInput.type);
1831
+ const decodedActive = decodeBoolean(rawInput.active);
1832
+
1833
+ if (
1834
+ decodedType === null ||
1835
+ decodedActive === null
1836
+ ) {
1837
+ return null;
1838
+ }
1839
+
1840
+ return {
1841
+ active: decodedActive,
1842
+ type: decodedType
1843
+ };
1844
+ }
1845
+ return null;
1846
+ }
1847
+
1848
+
1849
+ export function decodeHolderClientMessage6(rawInput: unknown): HolderClientMessage6 | null {
1850
+ if (isJSON(rawInput)) {
1851
+ const decodedType = decodeString(rawInput.type);
1852
+ const decodedPath = decodeString(rawInput.path);
1853
+
1854
+ if (
1855
+ decodedType === null ||
1856
+ decodedPath === null
1857
+ ) {
1858
+ return null;
1859
+ }
1860
+
1861
+ return {
1862
+ path: decodedPath,
1863
+ type: decodedType
1864
+ };
1865
+ }
1866
+ return null;
1867
+ }
1868
+
1869
+ export function decodeHolderServerMessage(rawInput: unknown): HolderServerMessage | null {
1870
+ const result: HolderServerMessage | null =
1871
+ decodeCHolderServerMessage1(rawInput)
1872
+ ??
1873
+ decodeCHolderServerMessage2(rawInput)
1874
+ ??
1875
+ decodeCHolderServerMessage3(rawInput)
1876
+
1877
+ ;
1878
+ return result;
1879
+ }
1880
+
1881
+
1882
+ export function decodeHolderServerMessage1(rawInput: unknown): HolderServerMessage1 | null {
1883
+ if (isJSON(rawInput)) {
1884
+ const decodedType = decodeString(rawInput.type);
1885
+ const decodedData = decodeString(rawInput.data);
1886
+
1887
+ if (
1888
+ decodedType === null ||
1889
+ decodedData === null
1890
+ ) {
1891
+ return null;
1892
+ }
1893
+
1894
+ return {
1895
+ data: decodedData,
1896
+ type: decodedType
1897
+ };
1898
+ }
1899
+ return null;
1900
+ }
1901
+
1902
+ export function decodeHolderServerMessage2(rawInput: unknown): HolderServerMessage2 | null {
1903
+ if (isJSON(rawInput)) {
1904
+ const decodedType = decodeString(rawInput.type);
1905
+ const decodedCols = decodeNumber(rawInput.cols);
1906
+ const decodedRows = decodeNumber(rawInput.rows);
1907
+
1908
+ if (
1909
+ decodedType === null ||
1910
+ decodedCols === null ||
1911
+ decodedRows === null
1912
+ ) {
1913
+ return null;
1914
+ }
1915
+
1916
+ return {
1917
+ cols: decodedCols,
1918
+ rows: decodedRows,
1919
+ type: decodedType
1920
+ };
1921
+ }
1922
+ return null;
1923
+ }
1924
+
1925
+
1926
+
1927
+
1928
+ export function decodeHolderServerMessage3(rawInput: unknown): HolderServerMessage3 | null {
1929
+ if (isJSON(rawInput)) {
1930
+ const decodedType = decodeString(rawInput.type);
1931
+ const decodedSignal = decodeString(rawInput.signal);
1932
+
1933
+ if (
1934
+ decodedType === null
1935
+ ) {
1936
+ return null;
1937
+ }
1938
+
1939
+ return {
1940
+ signal: decodedSignal,
1941
+ type: decodedType
1942
+ };
1943
+ }
1944
+ return null;
1945
+ }
1946
+
1947
+ export function decodeManagedTerminalInfo(rawInput: unknown): ManagedTerminalInfo | null {
1948
+ if (isJSON(rawInput)) {
1949
+ const decodedId = decodeString(rawInput.id);
1950
+ const decodedCommand = decodeString(rawInput.command);
1951
+ const decodedArgs = decodeArray(rawInput.args, decodeString);
1952
+ const decodedCwd = decodeString(rawInput.cwd);
1953
+ const decodedPid = decodeNumber(rawInput.pid);
1954
+ const decodedCreatedAt = decodeString(rawInput.createdAt);
1955
+ const decodedExitedAt = decodeString(rawInput.exitedAt);
1956
+ const decodedStatus = decodeTerminalStatus(rawInput.status);
1957
+ const decodedExitCode = decodeNumber(rawInput.exitCode);
1958
+ const decodedHolderPid = decodeNumber(rawInput.holderPid);
1959
+ const decodedSocketPath = decodeString(rawInput.socketPath);
1960
+ const decodedIsActive = decodeBoolean(rawInput.isActive);
1961
+ const decodedCurrentCwd = decodeString(rawInput.currentCwd);
1962
+
1963
+ if (
1964
+ decodedId === null ||
1965
+ decodedCommand === null ||
1966
+ decodedArgs === null ||
1967
+ decodedCwd === null ||
1968
+ decodedPid === null ||
1969
+ decodedCreatedAt === null ||
1970
+ decodedStatus === null
1971
+ ) {
1972
+ return null;
1973
+ }
1974
+
1975
+ return {
1976
+ args: decodedArgs,
1977
+ command: decodedCommand,
1978
+ createdAt: decodedCreatedAt,
1979
+ currentCwd: decodedCurrentCwd,
1980
+ cwd: decodedCwd,
1981
+ exitCode: decodedExitCode,
1982
+ exitedAt: decodedExitedAt,
1983
+ holderPid: decodedHolderPid,
1984
+ id: decodedId,
1985
+ isActive: decodedIsActive,
1986
+ pid: decodedPid,
1987
+ socketPath: decodedSocketPath,
1988
+ status: decodedStatus
1989
+ };
1990
+ }
1991
+ return null;
1992
+ }
1993
+
1994
+
1995
+
1996
+ export function decodeRoleEnum(rawInput: unknown): null | RoleEnum {
1997
+ switch (rawInput) {
1998
+ case 'assistant':
1999
+ case 'user':
2000
+ return rawInput;
2001
+ }
2002
+ return null;
2003
+ }
2004
+
2005
+ export function decodeTerminalListResponse(rawInput: unknown): null | TerminalListResponse {
2006
+ if (isJSON(rawInput)) {
2007
+ const decodedTerminals = decodeArray(rawInput.terminals, decodeManagedTerminalInfo);
2008
+ const decodedCount = decodeNumber(rawInput.count);
2009
+
2010
+ if (
2011
+ decodedTerminals === null ||
2012
+ decodedCount === null
2013
+ ) {
2014
+ return null;
2015
+ }
2016
+
2017
+ return {
2018
+ count: decodedCount,
2019
+ terminals: decodedTerminals
2020
+ };
2021
+ }
2022
+ return null;
2023
+ }
2024
+
2025
+
2026
+
2027
+ export function decodeTerminalRecord(rawInput: unknown): null | TerminalRecord {
2028
+ if (isJSON(rawInput)) {
2029
+ const decodedId = decodeString(rawInput.id);
2030
+ const decodedCommand = decodeString(rawInput.command);
2031
+ const decodedArgs = decodeString(rawInput.args);
2032
+ const decodedCwd = decodeString(rawInput.cwd);
2033
+ const decodedCols = decodeNumber(rawInput.cols);
2034
+ const decodedRows = decodeNumber(rawInput.rows);
2035
+ const decodedPid = decodeNumber(rawInput.pid);
2036
+ const decodedHolderPid = decodeNumber(rawInput.holderPid);
2037
+ const decodedSocketPath = decodeString(rawInput.socketPath);
2038
+ const decodedSessionFile = decodeString(rawInput.sessionFile);
2039
+ const decodedOpencodeSessionId = decodeString(rawInput.opencodeSessionId);
2040
+ const decodedStatus = decodeTerminalStatus(rawInput.status);
2041
+ const decodedExitCode = decodeNumber(rawInput.exitCode);
2042
+ const decodedCreatedAt = decodeString(rawInput.createdAt);
2043
+ const decodedExitedAt = decodeString(rawInput.exitedAt);
2044
+
2045
+ if (
2046
+ decodedId === null ||
2047
+ decodedCommand === null ||
2048
+ decodedArgs === null ||
2049
+ decodedCwd === null ||
2050
+ decodedCols === null ||
2051
+ decodedRows === null ||
2052
+ decodedStatus === null ||
2053
+ decodedCreatedAt === null
2054
+ ) {
2055
+ return null;
2056
+ }
2057
+
2058
+ return {
2059
+ args: decodedArgs,
2060
+ cols: decodedCols,
2061
+ command: decodedCommand,
2062
+ createdAt: decodedCreatedAt,
2063
+ cwd: decodedCwd,
2064
+ exitCode: decodedExitCode,
2065
+ exitedAt: decodedExitedAt,
2066
+ holderPid: decodedHolderPid,
2067
+ id: decodedId,
2068
+ opencodeSessionId: decodedOpencodeSessionId,
2069
+ pid: decodedPid,
2070
+ rows: decodedRows,
2071
+ sessionFile: decodedSessionFile,
2072
+ socketPath: decodedSocketPath,
2073
+ status: decodedStatus
2074
+ };
2075
+ }
2076
+ return null;
2077
+ }
2078
+
2079
+ export function decodeTerminalStatus(rawInput: unknown): null | TerminalStatus {
2080
+ switch (rawInput) {
2081
+ case 'exited':
2082
+ case 'orphaned':
2083
+ case 'running':
2084
+ return rawInput;
2085
+ }
2086
+ return null;
2087
+ }
2088
+
2089
+
2090
+
2091
+ export function decodeToolExecutionStatus(rawInput: unknown): null | ToolExecutionStatus {
2092
+ switch (rawInput) {
2093
+ case 'done':
2094
+ case 'error':
2095
+ case 'running':
2096
+ return rawInput;
2097
+ }
2098
+ return null;
2099
+ }
2100
+
2101
+ export function decodeToolResultStatus(rawInput: unknown): null | ToolResultStatus {
2102
+ switch (rawInput) {
2103
+ case 'done':
2104
+ case 'error':
2105
+ return rawInput;
2106
+ }
2107
+ return null;
2108
+ }
2109
+
2110
+
2111
+
2112
+ export function decodeWsEvent(rawInput: unknown): null | WsEvent {
2113
+ const result: null | WsEvent =
2114
+ decodeCWsEvent1(rawInput)
2115
+ ??
2116
+ decodeCWsEvent2(rawInput)
2117
+ ??
2118
+ decodeCWsEvent3(rawInput)
2119
+ ??
2120
+ decodeCWsEvent4(rawInput)
2121
+ ??
2122
+ decodeCWsEvent5(rawInput)
2123
+
2124
+ ;
2125
+ return result;
2126
+ }
2127
+
2128
+ export function decodeWsEvent1(rawInput: unknown): null | WsEvent1 {
2129
+ if (isJSON(rawInput)) {
2130
+ const decodedType = decodeString(rawInput.type);
2131
+ const decodedSessionId = decodeString(rawInput.sessionId);
2132
+ const decodedProject = decodeString(rawInput.project);
2133
+ const decodedSource = decodeString(rawInput.source);
2134
+
2135
+ if (
2136
+ decodedType === null ||
2137
+ decodedSessionId === null ||
2138
+ decodedProject === null ||
2139
+ decodedSource === null
2140
+ ) {
2141
+ return null;
2142
+ }
2143
+
2144
+ return {
2145
+ project: decodedProject,
2146
+ sessionId: decodedSessionId,
2147
+ source: decodedSource,
2148
+ type: decodedType
2149
+ };
2150
+ }
2151
+ return null;
2152
+ }
2153
+
2154
+
2155
+
2156
+ export function decodeWsEvent2(rawInput: unknown): null | WsEvent2 {
2157
+ if (isJSON(rawInput)) {
2158
+ const decodedType = decodeString(rawInput.type);
2159
+ const decodedSessionId = decodeString(rawInput.sessionId);
2160
+ const decodedSummary = decodeString(rawInput.summary);
2161
+
2162
+ if (
2163
+ decodedType === null ||
2164
+ decodedSessionId === null
2165
+ ) {
2166
+ return null;
2167
+ }
2168
+
2169
+ return {
2170
+ sessionId: decodedSessionId,
2171
+ summary: decodedSummary,
2172
+ type: decodedType
2173
+ };
2174
+ }
2175
+ return null;
2176
+ }
2177
+
2178
+ export function decodeWsEvent3(rawInput: unknown): null | WsEvent3 {
2179
+ if (isJSON(rawInput)) {
2180
+ const decodedType = decodeString(rawInput.type);
2181
+ const decodedRequestId = decodeString(rawInput.requestId);
2182
+ const decodedTool = decodeString(rawInput.tool);
2183
+ const decodedInput = decodeWsEvent3Input(rawInput.input);
2184
+
2185
+ if (
2186
+ decodedType === null ||
2187
+ decodedRequestId === null ||
2188
+ decodedTool === null ||
2189
+ decodedInput === null
2190
+ ) {
2191
+ return null;
2192
+ }
2193
+
2194
+ return {
2195
+ input: decodedInput,
2196
+ requestId: decodedRequestId,
2197
+ tool: decodedTool,
2198
+ type: decodedType
2199
+ };
2200
+ }
2201
+ return null;
2202
+ }
2203
+
2204
+
2205
+ export function decodeWsEvent3Input(rawInput: unknown): null | WsEvent3Input {
2206
+ if (isJSON(rawInput)) {
2207
+
2208
+
2209
+ return {
2210
+ ...rawInput,
2211
+ };
2212
+ }
2213
+ return null;
2214
+ }
2215
+
2216
+ export function decodeWsEvent4(rawInput: unknown): null | WsEvent4 {
2217
+ if (isJSON(rawInput)) {
2218
+ const decodedType = decodeString(rawInput.type);
2219
+ const decodedTerminalId = decodeString(rawInput.terminalId);
2220
+ const decodedCommand = decodeString(rawInput.command);
2221
+
2222
+ if (
2223
+ decodedType === null ||
2224
+ decodedTerminalId === null ||
2225
+ decodedCommand === null
2226
+ ) {
2227
+ return null;
2228
+ }
2229
+
2230
+ return {
2231
+ command: decodedCommand,
2232
+ terminalId: decodedTerminalId,
2233
+ type: decodedType
2234
+ };
2235
+ }
2236
+ return null;
2237
+ }
2238
+
2239
+
2240
+
2241
+
2242
+ export function decodeWsEvent5(rawInput: unknown): null | WsEvent5 {
2243
+ if (isJSON(rawInput)) {
2244
+ const decodedType = decodeString(rawInput.type);
2245
+ const decodedTerminalId = decodeString(rawInput.terminalId);
2246
+ const decodedCode = decodeNumber(rawInput.code);
2247
+
2248
+ if (
2249
+ decodedType === null ||
2250
+ decodedTerminalId === null ||
2251
+ decodedCode === null
2252
+ ) {
2253
+ return null;
2254
+ }
2255
+
2256
+ return {
2257
+ code: decodedCode,
2258
+ terminalId: decodedTerminalId,
2259
+ type: decodedType
2260
+ };
2261
+ }
2262
+ return null;
2263
+ }
2264
+
2265
+ export function decodeWsSessionMessage(rawInput: unknown): null | WsSessionMessage {
2266
+ const result: null | WsSessionMessage =
2267
+ decodeCWsSessionMessage1(rawInput)
2268
+ ??
2269
+ decodeCWsSessionMessage2(rawInput)
2270
+ ??
2271
+ decodeCWsSessionMessage3(rawInput)
2272
+
2273
+ ;
2274
+ return result;
2275
+ }
2276
+
2277
+
2278
+
2279
+ export function decodeWsSessionMessage1(rawInput: unknown): null | WsSessionMessage1 {
2280
+ if (isJSON(rawInput)) {
2281
+ const decodedType = decodeString(rawInput.type);
2282
+ const decodedSessionId = decodeString(rawInput.sessionId);
2283
+
2284
+ if (
2285
+ decodedType === null ||
2286
+ decodedSessionId === null
2287
+ ) {
2288
+ return null;
2289
+ }
2290
+
2291
+ return {
2292
+ sessionId: decodedSessionId,
2293
+ type: decodedType
2294
+ };
2295
+ }
2296
+ return null;
2297
+ }
2298
+
2299
+ export function decodeWsSessionMessage2(rawInput: unknown): null | WsSessionMessage2 {
2300
+ if (isJSON(rawInput)) {
2301
+ const decodedType = decodeString(rawInput.type);
2302
+ const decodedText = decodeString(rawInput.text);
2303
+
2304
+ if (
2305
+ decodedType === null ||
2306
+ decodedText === null
2307
+ ) {
2308
+ return null;
2309
+ }
2310
+
2311
+ return {
2312
+ text: decodedText,
2313
+ type: decodedType
2314
+ };
2315
+ }
2316
+ return null;
2317
+ }
2318
+
2319
+
2320
+
2321
+ export function decodeWsSessionMessage3(rawInput: unknown): null | WsSessionMessage3 {
2322
+ if (isJSON(rawInput)) {
2323
+ const decodedType = decodeString(rawInput.type);
2324
+
2325
+ if (
2326
+ decodedType === null
2327
+ ) {
2328
+ return null;
2329
+ }
2330
+
2331
+ return {
2332
+ type: decodedType
2333
+ };
2334
+ }
2335
+ return null;
2336
+ }
2337
+
2338
+ export function decodeWsSessionOutput(rawInput: unknown): null | WsSessionOutput {
2339
+ const result: null | WsSessionOutput =
2340
+ decodeCWsSessionOutput1(rawInput)
2341
+ ??
2342
+ decodeCWsSessionOutput2(rawInput)
2343
+ ??
2344
+ decodeCWsSessionOutput3(rawInput)
2345
+ ??
2346
+ decodeCWsSessionOutput4(rawInput)
2347
+ ??
2348
+ decodeCWsSessionOutput5(rawInput)
2349
+ ??
2350
+ decodeCWsSessionOutput6(rawInput)
2351
+
2352
+ ;
2353
+ return result;
2354
+ }
2355
+
2356
+
2357
+
2358
+ export function decodeWsSessionOutput1(rawInput: unknown): null | WsSessionOutput1 {
2359
+ if (isJSON(rawInput)) {
2360
+ const decodedType = decodeString(rawInput.type);
2361
+ const decodedMessages = decodeArray(rawInput.messages, decodeMessagesItem);
2362
+
2363
+ if (
2364
+ decodedType === null ||
2365
+ decodedMessages === null
2366
+ ) {
2367
+ return null;
2368
+ }
2369
+
2370
+ return {
2371
+ messages: decodedMessages,
2372
+ type: decodedType
2373
+ };
2374
+ }
2375
+ return null;
2376
+ }
2377
+
2378
+ export function decodeWsSessionOutput2(rawInput: unknown): null | WsSessionOutput2 {
2379
+ if (isJSON(rawInput)) {
2380
+ const decodedType = decodeString(rawInput.type);
2381
+ const decodedRole = decodeRoleEnum(rawInput.role);
2382
+ const decodedContent = decodeArray(rawInput.content, decodeContentItem);
2383
+ const decodedTimestamp = decodeString(rawInput.timestamp);
2384
+
2385
+ if (
2386
+ decodedType === null ||
2387
+ decodedRole === null ||
2388
+ decodedContent === null ||
2389
+ decodedTimestamp === null
2390
+ ) {
2391
+ return null;
2392
+ }
2393
+
2394
+ return {
2395
+ content: decodedContent,
2396
+ role: decodedRole,
2397
+ timestamp: decodedTimestamp,
2398
+ type: decodedType
2399
+ };
2400
+ }
2401
+ return null;
2402
+ }
2403
+
2404
+
2405
+
2406
+ export function decodeWsSessionOutput3(rawInput: unknown): null | WsSessionOutput3 {
2407
+ if (isJSON(rawInput)) {
2408
+ const decodedType = decodeString(rawInput.type);
2409
+ const decodedName = decodeString(rawInput.name);
2410
+ const decodedInput = decodeWsSessionOutput3Input(rawInput.input);
2411
+ const decodedStatus = decodeToolExecutionStatus(rawInput.status);
2412
+
2413
+ if (
2414
+ decodedType === null ||
2415
+ decodedName === null ||
2416
+ decodedInput === null ||
2417
+ decodedStatus === null
2418
+ ) {
2419
+ return null;
2420
+ }
2421
+
2422
+ return {
2423
+ input: decodedInput,
2424
+ name: decodedName,
2425
+ status: decodedStatus,
2426
+ type: decodedType
2427
+ };
2428
+ }
2429
+ return null;
2430
+ }
2431
+
2432
+ export function decodeWsSessionOutput3Input(rawInput: unknown): null | WsSessionOutput3Input {
2433
+ if (isJSON(rawInput)) {
2434
+
2435
+
2436
+ return {
2437
+ ...rawInput,
2438
+ };
2439
+ }
2440
+ return null;
2441
+ }
2442
+
2443
+
2444
+
2445
+ export function decodeWsSessionOutput4(rawInput: unknown): null | WsSessionOutput4 {
2446
+ if (isJSON(rawInput)) {
2447
+ const decodedType = decodeString(rawInput.type);
2448
+ const decodedId = decodeString(rawInput.id);
2449
+ const decodedOutput = decodeString(rawInput.output);
2450
+ const decodedStatus = decodeToolResultStatus(rawInput.status);
2451
+
2452
+ if (
2453
+ decodedType === null ||
2454
+ decodedId === null ||
2455
+ decodedOutput === null ||
2456
+ decodedStatus === null
2457
+ ) {
2458
+ return null;
2459
+ }
2460
+
2461
+ return {
2462
+ id: decodedId,
2463
+ output: decodedOutput,
2464
+ status: decodedStatus,
2465
+ type: decodedType
2466
+ };
2467
+ }
2468
+ return null;
2469
+ }
2470
+
2471
+ export function decodeWsSessionOutput5(rawInput: unknown): null | WsSessionOutput5 {
2472
+ if (isJSON(rawInput)) {
2473
+ const decodedType = decodeString(rawInput.type);
2474
+ const decodedText = decodeString(rawInput.text);
2475
+
2476
+ if (
2477
+ decodedType === null ||
2478
+ decodedText === null
2479
+ ) {
2480
+ return null;
2481
+ }
2482
+
2483
+ return {
2484
+ text: decodedText,
2485
+ type: decodedType
2486
+ };
2487
+ }
2488
+ return null;
2489
+ }
2490
+
2491
+
2492
+
2493
+ export function decodeWsSessionOutput6(rawInput: unknown): null | WsSessionOutput6 {
2494
+ if (isJSON(rawInput)) {
2495
+ const decodedType = decodeString(rawInput.type);
2496
+
2497
+ if (
2498
+ decodedType === null
2499
+ ) {
2500
+ return null;
2501
+ }
2502
+
2503
+ return {
2504
+ type: decodedType
2505
+ };
2506
+ }
2507
+ return null;
2508
+ }
2509
+
2510
+ export function decodeWsStatusResponse(rawInput: unknown): null | WsStatusResponse {
2511
+ if (isJSON(rawInput)) {
2512
+ const decodedConnectedClients = decodeNumber(rawInput.connectedClients);
2513
+
2514
+ if (
2515
+ decodedConnectedClients === null
2516
+ ) {
2517
+ return null;
2518
+ }
2519
+
2520
+ return {
2521
+ connectedClients: decodedConnectedClients
2522
+ };
2523
+ }
2524
+ return null;
2525
+ }
2526
+
2527
+
2528
+
2529
+ export function decodeWsTerminalMessage(rawInput: unknown): null | WsTerminalMessage {
2530
+ const result: null | WsTerminalMessage =
2531
+ decodeCWsTerminalMessage1(rawInput)
2532
+ ??
2533
+ decodeCWsTerminalMessage2(rawInput)
2534
+ ??
2535
+ decodeCWsTerminalMessage3(rawInput)
2536
+
2537
+ ;
2538
+ return result;
2539
+ }
2540
+
2541
+ export function decodeWsTerminalMessage1(rawInput: unknown): null | WsTerminalMessage1 {
2542
+ if (isJSON(rawInput)) {
2543
+ const decodedType = decodeString(rawInput.type);
2544
+ const decodedData = decodeString(rawInput.data);
2545
+
2546
+ if (
2547
+ decodedType === null ||
2548
+ decodedData === null
2549
+ ) {
2550
+ return null;
2551
+ }
2552
+
2553
+ return {
2554
+ data: decodedData,
2555
+ type: decodedType
2556
+ };
2557
+ }
2558
+ return null;
2559
+ }
2560
+
2561
+
2562
+
2563
+ export function decodeWsTerminalMessage2(rawInput: unknown): null | WsTerminalMessage2 {
2564
+ if (isJSON(rawInput)) {
2565
+ const decodedType = decodeString(rawInput.type);
2566
+ const decodedCols = decodeNumber(rawInput.cols);
2567
+ const decodedRows = decodeNumber(rawInput.rows);
2568
+
2569
+ if (
2570
+ decodedType === null ||
2571
+ decodedCols === null ||
2572
+ decodedRows === null
2573
+ ) {
2574
+ return null;
2575
+ }
2576
+
2577
+ return {
2578
+ cols: decodedCols,
2579
+ rows: decodedRows,
2580
+ type: decodedType
2581
+ };
2582
+ }
2583
+ return null;
2584
+ }
2585
+
2586
+ export function decodeWsTerminalMessage3(rawInput: unknown): null | WsTerminalMessage3 {
2587
+ if (isJSON(rawInput)) {
2588
+ const decodedType = decodeString(rawInput.type);
2589
+ const decodedSignal = decodeString(rawInput.signal);
2590
+
2591
+ if (
2592
+ decodedType === null ||
2593
+ decodedSignal === null
2594
+ ) {
2595
+ return null;
2596
+ }
2597
+
2598
+ return {
2599
+ signal: decodedSignal,
2600
+ type: decodedType
2601
+ };
2602
+ }
2603
+ return null;
2604
+ }
2605
+
2606
+
2607
+
2608
+ export function decodeWsTerminalOutput(rawInput: unknown): null | WsTerminalOutput {
2609
+ const result: null | WsTerminalOutput =
2610
+ decodeCWsTerminalOutput1(rawInput)
2611
+ ??
2612
+ decodeCWsTerminalOutput2(rawInput)
2613
+ ??
2614
+ decodeCWsTerminalOutput3(rawInput)
2615
+ ??
2616
+ decodeCWsTerminalOutput4(rawInput)
2617
+
2618
+ ;
2619
+ return result;
2620
+ }
2621
+
2622
+ export function decodeWsTerminalOutput1(rawInput: unknown): null | WsTerminalOutput1 {
2623
+ if (isJSON(rawInput)) {
2624
+ const decodedType = decodeString(rawInput.type);
2625
+ const decodedData = decodeString(rawInput.data);
2626
+
2627
+ if (
2628
+ decodedType === null ||
2629
+ decodedData === null
2630
+ ) {
2631
+ return null;
2632
+ }
2633
+
2634
+ return {
2635
+ data: decodedData,
2636
+ type: decodedType
2637
+ };
2638
+ }
2639
+ return null;
2640
+ }
2641
+
2642
+
2643
+
2644
+ export function decodeWsTerminalOutput2(rawInput: unknown): null | WsTerminalOutput2 {
2645
+ if (isJSON(rawInput)) {
2646
+ const decodedType = decodeString(rawInput.type);
2647
+ const decodedCode = decodeNumber(rawInput.code);
2648
+ const decodedSignal = decodeString(rawInput.signal);
2649
+
2650
+ if (
2651
+ decodedType === null ||
2652
+ decodedCode === null
2653
+ ) {
2654
+ return null;
2655
+ }
2656
+
2657
+ return {
2658
+ code: decodedCode,
2659
+ signal: decodedSignal,
2660
+ type: decodedType
2661
+ };
2662
+ }
2663
+ return null;
2664
+ }
2665
+
2666
+ export function decodeWsTerminalOutput3(rawInput: unknown): null | WsTerminalOutput3 {
2667
+ if (isJSON(rawInput)) {
2668
+ const decodedType = decodeString(rawInput.type);
2669
+ const decodedData = decodeString(rawInput.data);
2670
+ const decodedChunk = decodeNumber(rawInput.chunk);
2671
+ const decodedTotal = decodeNumber(rawInput.total);
2672
+
2673
+ if (
2674
+ decodedType === null ||
2675
+ decodedData === null ||
2676
+ decodedChunk === null ||
2677
+ decodedTotal === null
2678
+ ) {
2679
+ return null;
2680
+ }
2681
+
2682
+ return {
2683
+ chunk: decodedChunk,
2684
+ data: decodedData,
2685
+ total: decodedTotal,
2686
+ type: decodedType
2687
+ };
2688
+ }
2689
+ return null;
2690
+ }
2691
+
2692
+
2693
+
2694
+ export function decodeWsTerminalOutput4(rawInput: unknown): null | WsTerminalOutput4 {
2695
+ if (isJSON(rawInput)) {
2696
+ const decodedType = decodeString(rawInput.type);
2697
+ const decodedMessage = decodeString(rawInput.message);
2698
+
2699
+ if (
2700
+ decodedType === null ||
2701
+ decodedMessage === null
2702
+ ) {
2703
+ return null;
2704
+ }
2705
+
2706
+ return {
2707
+ message: decodedMessage,
2708
+ type: decodedType
2709
+ };
2710
+ }
2711
+ return null;
2712
+ }
2713
+
2714
+ export function decodeWsTicketResponse(rawInput: unknown): null | WsTicketResponse {
2715
+ if (isJSON(rawInput)) {
2716
+ const decodedTicket = decodeString(rawInput.ticket);
2717
+ const decodedExpiresAt = decodeString(rawInput.expiresAt);
2718
+
2719
+ if (
2720
+ decodedTicket === null ||
2721
+ decodedExpiresAt === null
2722
+ ) {
2723
+ return null;
2724
+ }
2725
+
2726
+ return {
2727
+ expiresAt: decodedExpiresAt,
2728
+ ticket: decodedTicket
2729
+ };
2730
+ }
2731
+ return null;
2732
+ }
2733
+
2734
+
2735
+
2736
+