@kortix/sdk 0.9.98

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 (618) hide show
  1. package/README.md +313 -0
  2. package/dist/files/client.d.ts +96 -0
  3. package/dist/files/client.d.ts.map +1 -0
  4. package/dist/files/client.js +346 -0
  5. package/dist/files/client.js.map +1 -0
  6. package/dist/files/types.d.ts +82 -0
  7. package/dist/files/types.d.ts.map +1 -0
  8. package/dist/files/types.js +6 -0
  9. package/dist/files/types.js.map +1 -0
  10. package/dist/index.d.ts +119 -0
  11. package/dist/index.d.ts.map +1 -0
  12. package/dist/index.js +93 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/kortix.d.ts +897 -0
  15. package/dist/kortix.d.ts.map +1 -0
  16. package/dist/kortix.js +772 -0
  17. package/dist/kortix.js.map +1 -0
  18. package/dist/opencode/client.d.ts +89 -0
  19. package/dist/opencode/client.d.ts.map +1 -0
  20. package/dist/opencode/client.js +191 -0
  21. package/dist/opencode/client.js.map +1 -0
  22. package/dist/opencode/env.d.ts +13 -0
  23. package/dist/opencode/env.d.ts.map +1 -0
  24. package/dist/opencode/env.js +63 -0
  25. package/dist/opencode/env.js.map +1 -0
  26. package/dist/opencode/kortix-master.d.ts +487 -0
  27. package/dist/opencode/kortix-master.d.ts.map +1 -0
  28. package/dist/opencode/kortix-master.js +313 -0
  29. package/dist/opencode/kortix-master.js.map +1 -0
  30. package/dist/opencode/triggers.d.ts +6 -0
  31. package/dist/opencode/triggers.d.ts.map +1 -0
  32. package/dist/opencode/triggers.js +34 -0
  33. package/dist/opencode/triggers.js.map +1 -0
  34. package/dist/platform/api/errors.d.ts +106 -0
  35. package/dist/platform/api/errors.d.ts.map +1 -0
  36. package/dist/platform/api/errors.js +137 -0
  37. package/dist/platform/api/errors.js.map +1 -0
  38. package/dist/platform/api-client.d.ts +35 -0
  39. package/dist/platform/api-client.d.ts.map +1 -0
  40. package/dist/platform/api-client.js +279 -0
  41. package/dist/platform/api-client.js.map +1 -0
  42. package/dist/platform/auth-core.d.ts +60 -0
  43. package/dist/platform/auth-core.d.ts.map +1 -0
  44. package/dist/platform/auth-core.js +104 -0
  45. package/dist/platform/auth-core.js.map +1 -0
  46. package/dist/platform/auth.d.ts +88 -0
  47. package/dist/platform/auth.d.ts.map +1 -0
  48. package/dist/platform/auth.js +161 -0
  49. package/dist/platform/auth.js.map +1 -0
  50. package/dist/platform/config-node.d.ts +33 -0
  51. package/dist/platform/config-node.d.ts.map +1 -0
  52. package/dist/platform/config-node.js +63 -0
  53. package/dist/platform/config-node.js.map +1 -0
  54. package/dist/platform/config.d.ts +77 -0
  55. package/dist/platform/config.d.ts.map +1 -0
  56. package/dist/platform/config.js +62 -0
  57. package/dist/platform/config.js.map +1 -0
  58. package/dist/platform/feature-flags.d.ts +25 -0
  59. package/dist/platform/feature-flags.d.ts.map +1 -0
  60. package/dist/platform/feature-flags.js +114 -0
  61. package/dist/platform/feature-flags.js.map +1 -0
  62. package/dist/platform/fresh-sessions.d.ts +4 -0
  63. package/dist/platform/fresh-sessions.d.ts.map +1 -0
  64. package/dist/platform/fresh-sessions.js +22 -0
  65. package/dist/platform/fresh-sessions.js.map +1 -0
  66. package/dist/platform/instance-routes.d.ts +17 -0
  67. package/dist/platform/instance-routes.d.ts.map +1 -0
  68. package/dist/platform/instance-routes.js +105 -0
  69. package/dist/platform/instance-routes.js.map +1 -0
  70. package/dist/platform/logger.d.ts +20 -0
  71. package/dist/platform/logger.d.ts.map +1 -0
  72. package/dist/platform/logger.js +44 -0
  73. package/dist/platform/logger.js.map +1 -0
  74. package/dist/platform/opencode-errors.d.ts +20 -0
  75. package/dist/platform/opencode-errors.d.ts.map +1 -0
  76. package/dist/platform/opencode-errors.js +71 -0
  77. package/dist/platform/opencode-errors.js.map +1 -0
  78. package/dist/platform/platform-client/backups.d.ts +22 -0
  79. package/dist/platform/platform-client/backups.d.ts.map +1 -0
  80. package/dist/platform/platform-client/backups.js +16 -0
  81. package/dist/platform/platform-client/backups.js.map +1 -0
  82. package/dist/platform/platform-client/index.d.ts +21 -0
  83. package/dist/platform/platform-client/index.d.ts.map +1 -0
  84. package/dist/platform/platform-client/index.js +21 -0
  85. package/dist/platform/platform-client/index.js.map +1 -0
  86. package/dist/platform/platform-client/instance-admin.d.ts +67 -0
  87. package/dist/platform/platform-client/instance-admin.d.ts.map +1 -0
  88. package/dist/platform/platform-client/instance-admin.js +59 -0
  89. package/dist/platform/platform-client/instance-admin.js.map +1 -0
  90. package/dist/platform/platform-client/invites.d.ts +35 -0
  91. package/dist/platform/platform-client/invites.d.ts.map +1 -0
  92. package/dist/platform/platform-client/invites.js +25 -0
  93. package/dist/platform/platform-client/invites.js.map +1 -0
  94. package/dist/platform/platform-client/lifecycle.d.ts +78 -0
  95. package/dist/platform/platform-client/lifecycle.d.ts.map +1 -0
  96. package/dist/platform/platform-client/lifecycle.js +151 -0
  97. package/dist/platform/platform-client/lifecycle.js.map +1 -0
  98. package/dist/platform/platform-client/members.d.ts +81 -0
  99. package/dist/platform/platform-client/members.d.ts.map +1 -0
  100. package/dist/platform/platform-client/members.js +59 -0
  101. package/dist/platform/platform-client/members.js.map +1 -0
  102. package/dist/platform/platform-client/shared.d.ts +44 -0
  103. package/dist/platform/platform-client/shared.d.ts.map +1 -0
  104. package/dist/platform/platform-client/shared.js +177 -0
  105. package/dist/platform/platform-client/shared.js.map +1 -0
  106. package/dist/platform/platform-client/ssh.d.ts +29 -0
  107. package/dist/platform/platform-client/ssh.d.ts.map +1 -0
  108. package/dist/platform/platform-client/ssh.js +14 -0
  109. package/dist/platform/platform-client/ssh.js.map +1 -0
  110. package/dist/platform/platform-client/types.d.ts +56 -0
  111. package/dist/platform/platform-client/types.d.ts.map +1 -0
  112. package/dist/platform/platform-client/types.js +19 -0
  113. package/dist/platform/platform-client/types.js.map +1 -0
  114. package/dist/platform/platform-client/updates.d.ts +117 -0
  115. package/dist/platform/platform-client/updates.d.ts.map +1 -0
  116. package/dist/platform/platform-client/updates.js +97 -0
  117. package/dist/platform/platform-client/updates.js.map +1 -0
  118. package/dist/platform/platform-client/urls.d.ts +18 -0
  119. package/dist/platform/platform-client/urls.d.ts.map +1 -0
  120. package/dist/platform/platform-client/urls.js +31 -0
  121. package/dist/platform/platform-client/urls.js.map +1 -0
  122. package/dist/platform/projects-client/access.d.ts +273 -0
  123. package/dist/platform/projects-client/access.d.ts.map +1 -0
  124. package/dist/platform/projects-client/access.js +89 -0
  125. package/dist/platform/projects-client/access.js.map +1 -0
  126. package/dist/platform/projects-client/accounts.d.ts +184 -0
  127. package/dist/platform/projects-client/accounts.d.ts.map +1 -0
  128. package/dist/platform/projects-client/accounts.js +78 -0
  129. package/dist/platform/projects-client/accounts.js.map +1 -0
  130. package/dist/platform/projects-client/agent-config.d.ts +58 -0
  131. package/dist/platform/projects-client/agent-config.d.ts.map +1 -0
  132. package/dist/platform/projects-client/agent-config.js +9 -0
  133. package/dist/platform/projects-client/agent-config.js.map +1 -0
  134. package/dist/platform/projects-client/agent-scope.d.ts +12 -0
  135. package/dist/platform/projects-client/agent-scope.d.ts.map +1 -0
  136. package/dist/platform/projects-client/agent-scope.js +6 -0
  137. package/dist/platform/projects-client/agent-scope.js.map +1 -0
  138. package/dist/platform/projects-client/apps.d.ts +98 -0
  139. package/dist/platform/projects-client/apps.d.ts.map +1 -0
  140. package/dist/platform/projects-client/apps.js +29 -0
  141. package/dist/platform/projects-client/apps.js.map +1 -0
  142. package/dist/platform/projects-client/audit.d.ts +85 -0
  143. package/dist/platform/projects-client/audit.d.ts.map +1 -0
  144. package/dist/platform/projects-client/audit.js +51 -0
  145. package/dist/platform/projects-client/audit.js.map +1 -0
  146. package/dist/platform/projects-client/billing.d.ts +336 -0
  147. package/dist/platform/projects-client/billing.d.ts.map +1 -0
  148. package/dist/platform/projects-client/billing.js +260 -0
  149. package/dist/platform/projects-client/billing.js.map +1 -0
  150. package/dist/platform/projects-client/change-requests.d.ts +119 -0
  151. package/dist/platform/projects-client/change-requests.d.ts.map +1 -0
  152. package/dist/platform/projects-client/change-requests.js +56 -0
  153. package/dist/platform/projects-client/change-requests.js.map +1 -0
  154. package/dist/platform/projects-client/channels.d.ts +135 -0
  155. package/dist/platform/projects-client/channels.d.ts.map +1 -0
  156. package/dist/platform/projects-client/channels.js +103 -0
  157. package/dist/platform/projects-client/channels.js.map +1 -0
  158. package/dist/platform/projects-client/connectors.d.ts +148 -0
  159. package/dist/platform/projects-client/connectors.d.ts.map +1 -0
  160. package/dist/platform/projects-client/connectors.js +66 -0
  161. package/dist/platform/projects-client/connectors.js.map +1 -0
  162. package/dist/platform/projects-client/files.d.ts +37 -0
  163. package/dist/platform/projects-client/files.d.ts.map +1 -0
  164. package/dist/platform/projects-client/files.js +58 -0
  165. package/dist/platform/projects-client/files.js.map +1 -0
  166. package/dist/platform/projects-client/gateway.d.ts +177 -0
  167. package/dist/platform/projects-client/gateway.d.ts.map +1 -0
  168. package/dist/platform/projects-client/gateway.js +59 -0
  169. package/dist/platform/projects-client/gateway.js.map +1 -0
  170. package/dist/platform/projects-client/git-history.d.ts +74 -0
  171. package/dist/platform/projects-client/git-history.d.ts.map +1 -0
  172. package/dist/platform/projects-client/git-history.js +40 -0
  173. package/dist/platform/projects-client/git-history.js.map +1 -0
  174. package/dist/platform/projects-client/github.d.ts +62 -0
  175. package/dist/platform/projects-client/github.d.ts.map +1 -0
  176. package/dist/platform/projects-client/github.js +30 -0
  177. package/dist/platform/projects-client/github.js.map +1 -0
  178. package/dist/platform/projects-client/index.d.ts +32 -0
  179. package/dist/platform/projects-client/index.d.ts.map +1 -0
  180. package/dist/platform/projects-client/index.js +34 -0
  181. package/dist/platform/projects-client/index.js.map +1 -0
  182. package/dist/platform/projects-client/marketplace-catalog.d.ts +76 -0
  183. package/dist/platform/projects-client/marketplace-catalog.d.ts.map +1 -0
  184. package/dist/platform/projects-client/marketplace-catalog.js +48 -0
  185. package/dist/platform/projects-client/marketplace-catalog.js.map +1 -0
  186. package/dist/platform/projects-client/marketplace.d.ts +80 -0
  187. package/dist/platform/projects-client/marketplace.d.ts.map +1 -0
  188. package/dist/platform/projects-client/marketplace.js +52 -0
  189. package/dist/platform/projects-client/marketplace.js.map +1 -0
  190. package/dist/platform/projects-client/model-defaults.d.ts +36 -0
  191. package/dist/platform/projects-client/model-defaults.d.ts.map +1 -0
  192. package/dist/platform/projects-client/model-defaults.js +16 -0
  193. package/dist/platform/projects-client/model-defaults.js.map +1 -0
  194. package/dist/platform/projects-client/policies.d.ts +21 -0
  195. package/dist/platform/projects-client/policies.d.ts.map +1 -0
  196. package/dist/platform/projects-client/policies.js +10 -0
  197. package/dist/platform/projects-client/policies.js.map +1 -0
  198. package/dist/platform/projects-client/projects.d.ts +235 -0
  199. package/dist/platform/projects-client/projects.d.ts.map +1 -0
  200. package/dist/platform/projects-client/projects.js +161 -0
  201. package/dist/platform/projects-client/projects.js.map +1 -0
  202. package/dist/platform/projects-client/public-session-shares.d.ts +52 -0
  203. package/dist/platform/projects-client/public-session-shares.d.ts.map +1 -0
  204. package/dist/platform/projects-client/public-session-shares.js +54 -0
  205. package/dist/platform/projects-client/public-session-shares.js.map +1 -0
  206. package/dist/platform/projects-client/review.d.ts +57 -0
  207. package/dist/platform/projects-client/review.d.ts.map +1 -0
  208. package/dist/platform/projects-client/review.js +28 -0
  209. package/dist/platform/projects-client/review.js.map +1 -0
  210. package/dist/platform/projects-client/sandbox-shares.d.ts +25 -0
  211. package/dist/platform/projects-client/sandbox-shares.d.ts.map +1 -0
  212. package/dist/platform/projects-client/sandbox-shares.js +29 -0
  213. package/dist/platform/projects-client/sandbox-shares.js.map +1 -0
  214. package/dist/platform/projects-client/sandbox.d.ts +123 -0
  215. package/dist/platform/projects-client/sandbox.d.ts.map +1 -0
  216. package/dist/platform/projects-client/sandbox.js +45 -0
  217. package/dist/platform/projects-client/sandbox.js.map +1 -0
  218. package/dist/platform/projects-client/secrets.d.ts +122 -0
  219. package/dist/platform/projects-client/secrets.d.ts.map +1 -0
  220. package/dist/platform/projects-client/secrets.js +34 -0
  221. package/dist/platform/projects-client/secrets.js.map +1 -0
  222. package/dist/platform/projects-client/session-sandbox.d.ts +61 -0
  223. package/dist/platform/projects-client/session-sandbox.d.ts.map +1 -0
  224. package/dist/platform/projects-client/session-sandbox.js +82 -0
  225. package/dist/platform/projects-client/session-sandbox.js.map +1 -0
  226. package/dist/platform/projects-client/sessions.d.ts +216 -0
  227. package/dist/platform/projects-client/sessions.d.ts.map +1 -0
  228. package/dist/platform/projects-client/sessions.js +74 -0
  229. package/dist/platform/projects-client/sessions.js.map +1 -0
  230. package/dist/platform/projects-client/setup-links.d.ts +35 -0
  231. package/dist/platform/projects-client/setup-links.d.ts.map +1 -0
  232. package/dist/platform/projects-client/setup-links.js +24 -0
  233. package/dist/platform/projects-client/setup-links.js.map +1 -0
  234. package/dist/platform/projects-client/shared.d.ts +66 -0
  235. package/dist/platform/projects-client/shared.d.ts.map +1 -0
  236. package/dist/platform/projects-client/shared.js +44 -0
  237. package/dist/platform/projects-client/shared.js.map +1 -0
  238. package/dist/platform/projects-client/tokens.d.ts +77 -0
  239. package/dist/platform/projects-client/tokens.d.ts.map +1 -0
  240. package/dist/platform/projects-client/tokens.js +43 -0
  241. package/dist/platform/projects-client/tokens.js.map +1 -0
  242. package/dist/platform/projects-client/transcription.d.ts +5 -0
  243. package/dist/platform/projects-client/transcription.d.ts.map +1 -0
  244. package/dist/platform/projects-client/transcription.js +14 -0
  245. package/dist/platform/projects-client/transcription.js.map +1 -0
  246. package/dist/platform/projects-client/triggers.d.ts +102 -0
  247. package/dist/platform/projects-client/triggers.d.ts.map +1 -0
  248. package/dist/platform/projects-client/triggers.js +27 -0
  249. package/dist/platform/projects-client/triggers.js.map +1 -0
  250. package/dist/platform/session-id.d.ts +9 -0
  251. package/dist/platform/session-id.d.ts.map +1 -0
  252. package/dist/platform/session-id.js +23 -0
  253. package/dist/platform/session-id.js.map +1 -0
  254. package/dist/platform/storage/managed-storage.d.ts +97 -0
  255. package/dist/platform/storage/managed-storage.d.ts.map +1 -0
  256. package/dist/platform/storage/managed-storage.js +271 -0
  257. package/dist/platform/storage/managed-storage.js.map +1 -0
  258. package/dist/platform/strings.d.ts +12 -0
  259. package/dist/platform/strings.d.ts.map +1 -0
  260. package/dist/platform/strings.js +17 -0
  261. package/dist/platform/strings.js.map +1 -0
  262. package/dist/platform/ui.d.ts +11 -0
  263. package/dist/platform/ui.d.ts.map +1 -0
  264. package/dist/platform/ui.js +22 -0
  265. package/dist/platform/ui.js.map +1 -0
  266. package/dist/react/chat/index.d.ts +3 -0
  267. package/dist/react/chat/index.d.ts.map +1 -0
  268. package/dist/react/chat/index.js +7 -0
  269. package/dist/react/chat/index.js.map +1 -0
  270. package/dist/react/chat/render-parts.d.ts +39 -0
  271. package/dist/react/chat/render-parts.d.ts.map +1 -0
  272. package/dist/react/chat/render-parts.js +34 -0
  273. package/dist/react/chat/render-parts.js.map +1 -0
  274. package/dist/react/chat/use-chat-turns.d.ts +19 -0
  275. package/dist/react/chat/use-chat-turns.d.ts.map +1 -0
  276. package/dist/react/chat/use-chat-turns.js +27 -0
  277. package/dist/react/chat/use-chat-turns.js.map +1 -0
  278. package/dist/react/file-keys.d.ts +18 -0
  279. package/dist/react/file-keys.d.ts.map +1 -0
  280. package/dist/react/file-keys.js +18 -0
  281. package/dist/react/file-keys.js.map +1 -0
  282. package/dist/react/index.d.ts +12 -0
  283. package/dist/react/index.d.ts.map +1 -0
  284. package/dist/react/index.js +49 -0
  285. package/dist/react/index.js.map +1 -0
  286. package/dist/react/model-flatten.d.ts +33 -0
  287. package/dist/react/model-flatten.d.ts.map +1 -0
  288. package/dist/react/model-flatten.js +59 -0
  289. package/dist/react/model-flatten.js.map +1 -0
  290. package/dist/react/opencode.d.ts +43 -0
  291. package/dist/react/opencode.d.ts.map +1 -0
  292. package/dist/react/opencode.js +100 -0
  293. package/dist/react/opencode.js.map +1 -0
  294. package/dist/react/prefetch-session-start.d.ts +10 -0
  295. package/dist/react/prefetch-session-start.d.ts.map +1 -0
  296. package/dist/react/prefetch-session-start.js +17 -0
  297. package/dist/react/prefetch-session-start.js.map +1 -0
  298. package/dist/react/provider-refresh.d.ts +7 -0
  299. package/dist/react/provider-refresh.d.ts.map +1 -0
  300. package/dist/react/provider-refresh.js +28 -0
  301. package/dist/react/provider-refresh.js.map +1 -0
  302. package/dist/react/provider-selection.d.ts +31 -0
  303. package/dist/react/provider-selection.d.ts.map +1 -0
  304. package/dist/react/provider-selection.js +135 -0
  305. package/dist/react/provider-selection.js.map +1 -0
  306. package/dist/react/route-project.d.ts +7 -0
  307. package/dist/react/route-project.d.ts.map +1 -0
  308. package/dist/react/route-project.js +19 -0
  309. package/dist/react/route-project.js.map +1 -0
  310. package/dist/react/session-start-stash.d.ts +56 -0
  311. package/dist/react/session-start-stash.d.ts.map +1 -0
  312. package/dist/react/session-start-stash.js +202 -0
  313. package/dist/react/session-start-stash.js.map +1 -0
  314. package/dist/react/use-canonical-opencode-session.d.ts +35 -0
  315. package/dist/react/use-canonical-opencode-session.d.ts.map +1 -0
  316. package/dist/react/use-canonical-opencode-session.js +52 -0
  317. package/dist/react/use-canonical-opencode-session.js.map +1 -0
  318. package/dist/react/use-change-requests.d.ts +321 -0
  319. package/dist/react/use-change-requests.d.ts.map +1 -0
  320. package/dist/react/use-change-requests.js +43 -0
  321. package/dist/react/use-change-requests.js.map +1 -0
  322. package/dist/react/use-current-runtime.d.ts +8 -0
  323. package/dist/react/use-current-runtime.d.ts.map +1 -0
  324. package/dist/react/use-current-runtime.js +12 -0
  325. package/dist/react/use-current-runtime.js.map +1 -0
  326. package/dist/react/use-gateway-catalog-sync.d.ts +2 -0
  327. package/dist/react/use-gateway-catalog-sync.d.ts.map +1 -0
  328. package/dist/react/use-gateway-catalog-sync.js +39 -0
  329. package/dist/react/use-gateway-catalog-sync.js.map +1 -0
  330. package/dist/react/use-kortix-master.d.ts +384 -0
  331. package/dist/react/use-kortix-master.d.ts.map +1 -0
  332. package/dist/react/use-kortix-master.js +958 -0
  333. package/dist/react/use-kortix-master.js.map +1 -0
  334. package/dist/react/use-model-store.d.ts +71 -0
  335. package/dist/react/use-model-store.d.ts.map +1 -0
  336. package/dist/react/use-model-store.js +411 -0
  337. package/dist/react/use-model-store.js.map +1 -0
  338. package/dist/react/use-opencode-config.d.ts +15 -0
  339. package/dist/react/use-opencode-config.d.ts.map +1 -0
  340. package/dist/react/use-opencode-config.js +79 -0
  341. package/dist/react/use-opencode-config.js.map +1 -0
  342. package/dist/react/use-opencode-events/diagnostics.d.ts +11 -0
  343. package/dist/react/use-opencode-events/diagnostics.d.ts.map +1 -0
  344. package/dist/react/use-opencode-events/diagnostics.js +58 -0
  345. package/dist/react/use-opencode-events/diagnostics.js.map +1 -0
  346. package/dist/react/use-opencode-events/handle-event.d.ts +20 -0
  347. package/dist/react/use-opencode-events/handle-event.d.ts.map +1 -0
  348. package/dist/react/use-opencode-events/handle-event.js +450 -0
  349. package/dist/react/use-opencode-events/handle-event.js.map +1 -0
  350. package/dist/react/use-opencode-events/helpers.d.ts +30 -0
  351. package/dist/react/use-opencode-events/helpers.d.ts.map +1 -0
  352. package/dist/react/use-opencode-events/helpers.js +93 -0
  353. package/dist/react/use-opencode-events/helpers.js.map +1 -0
  354. package/dist/react/use-opencode-events/index.d.ts +25 -0
  355. package/dist/react/use-opencode-events/index.d.ts.map +1 -0
  356. package/dist/react/use-opencode-events/index.js +242 -0
  357. package/dist/react/use-opencode-events/index.js.map +1 -0
  358. package/dist/react/use-opencode-events/types.d.ts +10 -0
  359. package/dist/react/use-opencode-events/types.d.ts.map +1 -0
  360. package/dist/react/use-opencode-events/types.js +2 -0
  361. package/dist/react/use-opencode-events/types.js.map +1 -0
  362. package/dist/react/use-opencode-events/use-event-stream-refs.d.ts +22 -0
  363. package/dist/react/use-opencode-events/use-event-stream-refs.d.ts.map +1 -0
  364. package/dist/react/use-opencode-events/use-event-stream-refs.js +158 -0
  365. package/dist/react/use-opencode-events/use-event-stream-refs.js.map +1 -0
  366. package/dist/react/use-opencode-local.d.ts +139 -0
  367. package/dist/react/use-opencode-local.d.ts.map +1 -0
  368. package/dist/react/use-opencode-local.js +484 -0
  369. package/dist/react/use-opencode-local.js.map +1 -0
  370. package/dist/react/use-opencode-mcp.d.ts +34 -0
  371. package/dist/react/use-opencode-mcp.d.ts.map +1 -0
  372. package/dist/react/use-opencode-mcp.js +190 -0
  373. package/dist/react/use-opencode-mcp.js.map +1 -0
  374. package/dist/react/use-opencode-pty.d.ts +30 -0
  375. package/dist/react/use-opencode-pty.d.ts.map +1 -0
  376. package/dist/react/use-opencode-pty.js +126 -0
  377. package/dist/react/use-opencode-pty.js.map +1 -0
  378. package/dist/react/use-opencode-sessions/agents.d.ts +14 -0
  379. package/dist/react/use-opencode-sessions/agents.d.ts.map +1 -0
  380. package/dist/react/use-opencode-sessions/agents.js +82 -0
  381. package/dist/react/use-opencode-sessions/agents.js.map +1 -0
  382. package/dist/react/use-opencode-sessions/commands.d.ts +8 -0
  383. package/dist/react/use-opencode-sessions/commands.d.ts.map +1 -0
  384. package/dist/react/use-opencode-sessions/commands.js +46 -0
  385. package/dist/react/use-opencode-sessions/commands.js.map +1 -0
  386. package/dist/react/use-opencode-sessions/files.d.ts +2 -0
  387. package/dist/react/use-opencode-sessions/files.d.ts.map +1 -0
  388. package/dist/react/use-opencode-sessions/files.js +181 -0
  389. package/dist/react/use-opencode-sessions/files.js.map +1 -0
  390. package/dist/react/use-opencode-sessions/index.d.ts +15 -0
  391. package/dist/react/use-opencode-sessions/index.d.ts.map +1 -0
  392. package/dist/react/use-opencode-sessions/index.js +21 -0
  393. package/dist/react/use-opencode-sessions/index.js.map +1 -0
  394. package/dist/react/use-opencode-sessions/keys.d.ts +94 -0
  395. package/dist/react/use-opencode-sessions/keys.d.ts.map +1 -0
  396. package/dist/react/use-opencode-sessions/keys.js +39 -0
  397. package/dist/react/use-opencode-sessions/keys.js.map +1 -0
  398. package/dist/react/use-opencode-sessions/mcp.d.ts +3 -0
  399. package/dist/react/use-opencode-sessions/mcp.d.ts.map +1 -0
  400. package/dist/react/use-opencode-sessions/mcp.js +23 -0
  401. package/dist/react/use-opencode-sessions/mcp.js.map +1 -0
  402. package/dist/react/use-opencode-sessions/messages.d.ts +75 -0
  403. package/dist/react/use-opencode-sessions/messages.d.ts.map +1 -0
  404. package/dist/react/use-opencode-sessions/messages.js +319 -0
  405. package/dist/react/use-opencode-sessions/messages.js.map +1 -0
  406. package/dist/react/use-opencode-sessions/parts.d.ts +23 -0
  407. package/dist/react/use-opencode-sessions/parts.d.ts.map +1 -0
  408. package/dist/react/use-opencode-sessions/parts.js +49 -0
  409. package/dist/react/use-opencode-sessions/parts.js.map +1 -0
  410. package/dist/react/use-opencode-sessions/permissions.d.ts +17 -0
  411. package/dist/react/use-opencode-sessions/permissions.d.ts.map +1 -0
  412. package/dist/react/use-opencode-sessions/permissions.js +66 -0
  413. package/dist/react/use-opencode-sessions/permissions.js.map +1 -0
  414. package/dist/react/use-opencode-sessions/projects.d.ts +5 -0
  415. package/dist/react/use-opencode-sessions/projects.d.ts.map +1 -0
  416. package/dist/react/use-opencode-sessions/projects.js +54 -0
  417. package/dist/react/use-opencode-sessions/projects.js.map +1 -0
  418. package/dist/react/use-opencode-sessions/providers.d.ts +10 -0
  419. package/dist/react/use-opencode-sessions/providers.d.ts.map +1 -0
  420. package/dist/react/use-opencode-sessions/providers.js +98 -0
  421. package/dist/react/use-opencode-sessions/providers.js.map +1 -0
  422. package/dist/react/use-opencode-sessions/sessions.d.ts +35 -0
  423. package/dist/react/use-opencode-sessions/sessions.d.ts.map +1 -0
  424. package/dist/react/use-opencode-sessions/sessions.js +380 -0
  425. package/dist/react/use-opencode-sessions/sessions.js.map +1 -0
  426. package/dist/react/use-opencode-sessions/shared.d.ts +43 -0
  427. package/dist/react/use-opencode-sessions/shared.d.ts.map +1 -0
  428. package/dist/react/use-opencode-sessions/shared.js +109 -0
  429. package/dist/react/use-opencode-sessions/shared.js.map +1 -0
  430. package/dist/react/use-opencode-sessions/sharing.d.ts +4 -0
  431. package/dist/react/use-opencode-sessions/sharing.d.ts.map +1 -0
  432. package/dist/react/use-opencode-sessions/sharing.js +57 -0
  433. package/dist/react/use-opencode-sessions/sharing.js.map +1 -0
  434. package/dist/react/use-opencode-sessions/tools.d.ts +5 -0
  435. package/dist/react/use-opencode-sessions/tools.d.ts.map +1 -0
  436. package/dist/react/use-opencode-sessions/tools.js +54 -0
  437. package/dist/react/use-opencode-sessions/tools.js.map +1 -0
  438. package/dist/react/use-permission-self-heal.d.ts +45 -0
  439. package/dist/react/use-permission-self-heal.d.ts.map +1 -0
  440. package/dist/react/use-permission-self-heal.js +144 -0
  441. package/dist/react/use-permission-self-heal.js.map +1 -0
  442. package/dist/react/use-project-config.d.ts +11 -0
  443. package/dist/react/use-project-config.d.ts.map +1 -0
  444. package/dist/react/use-project-config.js +22 -0
  445. package/dist/react/use-project-config.js.map +1 -0
  446. package/dist/react/use-project-models.d.ts +11 -0
  447. package/dist/react/use-project-models.d.ts.map +1 -0
  448. package/dist/react/use-project-models.js +25 -0
  449. package/dist/react/use-project-models.js.map +1 -0
  450. package/dist/react/use-project-secrets.d.ts +265 -0
  451. package/dist/react/use-project-secrets.d.ts.map +1 -0
  452. package/dist/react/use-project-secrets.js +41 -0
  453. package/dist/react/use-project-secrets.js.map +1 -0
  454. package/dist/react/use-project-triggers.d.ts +228 -0
  455. package/dist/react/use-project-triggers.d.ts.map +1 -0
  456. package/dist/react/use-project-triggers.js +42 -0
  457. package/dist/react/use-project-triggers.js.map +1 -0
  458. package/dist/react/use-question-self-heal.d.ts +36 -0
  459. package/dist/react/use-question-self-heal.d.ts.map +1 -0
  460. package/dist/react/use-question-self-heal.js +95 -0
  461. package/dist/react/use-question-self-heal.js.map +1 -0
  462. package/dist/react/use-runtime-phase.d.ts +9 -0
  463. package/dist/react/use-runtime-phase.d.ts.map +1 -0
  464. package/dist/react/use-runtime-phase.js +20 -0
  465. package/dist/react/use-runtime-phase.js.map +1 -0
  466. package/dist/react/use-runtime-reconnect.d.ts +90 -0
  467. package/dist/react/use-runtime-reconnect.d.ts.map +1 -0
  468. package/dist/react/use-runtime-reconnect.js +234 -0
  469. package/dist/react/use-runtime-reconnect.js.map +1 -0
  470. package/dist/react/use-session-picks.d.ts +17 -0
  471. package/dist/react/use-session-picks.d.ts.map +1 -0
  472. package/dist/react/use-session-picks.js +36 -0
  473. package/dist/react/use-session-picks.js.map +1 -0
  474. package/dist/react/use-session-prefetch.d.ts +18 -0
  475. package/dist/react/use-session-prefetch.d.ts.map +1 -0
  476. package/dist/react/use-session-prefetch.js +84 -0
  477. package/dist/react/use-session-prefetch.js.map +1 -0
  478. package/dist/react/use-session-send.d.ts +183 -0
  479. package/dist/react/use-session-send.d.ts.map +1 -0
  480. package/dist/react/use-session-send.js +287 -0
  481. package/dist/react/use-session-send.js.map +1 -0
  482. package/dist/react/use-session-sync.d.ts +24 -0
  483. package/dist/react/use-session-sync.d.ts.map +1 -0
  484. package/dist/react/use-session-sync.js +375 -0
  485. package/dist/react/use-session-sync.js.map +1 -0
  486. package/dist/react/use-session.d.ts +171 -0
  487. package/dist/react/use-session.d.ts.map +1 -0
  488. package/dist/react/use-session.js +396 -0
  489. package/dist/react/use-session.js.map +1 -0
  490. package/dist/react/use-visible-agents.d.ts +22 -0
  491. package/dist/react/use-visible-agents.d.ts.map +1 -0
  492. package/dist/react/use-visible-agents.js +45 -0
  493. package/dist/react/use-visible-agents.js.map +1 -0
  494. package/dist/server.d.ts +55 -0
  495. package/dist/server.d.ts.map +1 -0
  496. package/dist/server.js +122 -0
  497. package/dist/server.js.map +1 -0
  498. package/dist/session/health.d.ts +49 -0
  499. package/dist/session/health.d.ts.map +1 -0
  500. package/dist/session/health.js +57 -0
  501. package/dist/session/health.js.map +1 -0
  502. package/dist/session/index.d.ts +19 -0
  503. package/dist/session/index.d.ts.map +1 -0
  504. package/dist/session/index.js +19 -0
  505. package/dist/session/index.js.map +1 -0
  506. package/dist/session/preview.d.ts +24 -0
  507. package/dist/session/preview.d.ts.map +1 -0
  508. package/dist/session/preview.js +85 -0
  509. package/dist/session/preview.js.map +1 -0
  510. package/dist/session/url.d.ts +160 -0
  511. package/dist/session/url.d.ts.map +1 -0
  512. package/dist/session/url.js +522 -0
  513. package/dist/session/url.js.map +1 -0
  514. package/dist/state/chat-events.d.ts +141 -0
  515. package/dist/state/chat-events.d.ts.map +1 -0
  516. package/dist/state/chat-events.js +135 -0
  517. package/dist/state/chat-events.js.map +1 -0
  518. package/dist/state/current-runtime.d.ts +44 -0
  519. package/dist/state/current-runtime.d.ts.map +1 -0
  520. package/dist/state/current-runtime.js +44 -0
  521. package/dist/state/current-runtime.js.map +1 -0
  522. package/dist/state/diagnostics-store.d.ts +114 -0
  523. package/dist/state/diagnostics-store.d.ts.map +1 -0
  524. package/dist/state/diagnostics-store.js +319 -0
  525. package/dist/state/diagnostics-store.js.map +1 -0
  526. package/dist/state/event-stream.d.ts +134 -0
  527. package/dist/state/event-stream.d.ts.map +1 -0
  528. package/dist/state/event-stream.js +424 -0
  529. package/dist/state/event-stream.js.map +1 -0
  530. package/dist/state/idb-sync-cache.d.ts +18 -0
  531. package/dist/state/idb-sync-cache.d.ts.map +1 -0
  532. package/dist/state/idb-sync-cache.js +209 -0
  533. package/dist/state/idb-sync-cache.js.map +1 -0
  534. package/dist/state/opencode-compaction-store.d.ts +10 -0
  535. package/dist/state/opencode-compaction-store.d.ts.map +1 -0
  536. package/dist/state/opencode-compaction-store.js +32 -0
  537. package/dist/state/opencode-compaction-store.js.map +1 -0
  538. package/dist/state/opencode-pending-store.d.ts +19 -0
  539. package/dist/state/opencode-pending-store.d.ts.map +1 -0
  540. package/dist/state/opencode-pending-store.js +76 -0
  541. package/dist/state/opencode-pending-store.js.map +1 -0
  542. package/dist/state/sandbox-connection-store.d.ts +62 -0
  543. package/dist/state/sandbox-connection-store.d.ts.map +1 -0
  544. package/dist/state/sandbox-connection-store.js +290 -0
  545. package/dist/state/sandbox-connection-store.js.map +1 -0
  546. package/dist/state/server-store/active.d.ts +49 -0
  547. package/dist/state/server-store/active.d.ts.map +1 -0
  548. package/dist/state/server-store/active.js +76 -0
  549. package/dist/state/server-store/active.js.map +1 -0
  550. package/dist/state/server-store/types.d.ts +12 -0
  551. package/dist/state/server-store/types.d.ts.map +1 -0
  552. package/dist/state/server-store/types.js +2 -0
  553. package/dist/state/server-store/types.js.map +1 -0
  554. package/dist/state/server-store/url-helpers.d.ts +33 -0
  555. package/dist/state/server-store/url-helpers.d.ts.map +1 -0
  556. package/dist/state/server-store/url-helpers.js +55 -0
  557. package/dist/state/server-store/url-helpers.js.map +1 -0
  558. package/dist/state/server-store.d.ts +18 -0
  559. package/dist/state/server-store.d.ts.map +1 -0
  560. package/dist/state/server-store.js +23 -0
  561. package/dist/state/server-store.js.map +1 -0
  562. package/dist/state/session-runtime-registry.d.ts +49 -0
  563. package/dist/state/session-runtime-registry.d.ts.map +1 -0
  564. package/dist/state/session-runtime-registry.js +85 -0
  565. package/dist/state/session-runtime-registry.js.map +1 -0
  566. package/dist/state/sync-store/ascending-id.d.ts +2 -0
  567. package/dist/state/sync-store/ascending-id.d.ts.map +1 -0
  568. package/dist/state/sync-store/ascending-id.js +21 -0
  569. package/dist/state/sync-store/ascending-id.js.map +1 -0
  570. package/dist/state/sync-store/binary.d.ts +7 -0
  571. package/dist/state/sync-store/binary.d.ts.map +1 -0
  572. package/dist/state/sync-store/binary.js +21 -0
  573. package/dist/state/sync-store/binary.js.map +1 -0
  574. package/dist/state/sync-store/stream-cache.d.ts +2 -0
  575. package/dist/state/sync-store/stream-cache.d.ts.map +1 -0
  576. package/dist/state/sync-store/stream-cache.js +29 -0
  577. package/dist/state/sync-store/stream-cache.js.map +1 -0
  578. package/dist/state/sync-store/types.d.ts +29 -0
  579. package/dist/state/sync-store/types.d.ts.map +1 -0
  580. package/dist/state/sync-store/types.js +2 -0
  581. package/dist/state/sync-store/types.js.map +1 -0
  582. package/dist/state/sync-store.d.ts +39 -0
  583. package/dist/state/sync-store.d.ts.map +1 -0
  584. package/dist/state/sync-store.js +692 -0
  585. package/dist/state/sync-store.js.map +1 -0
  586. package/dist/state/tab-store.d.ts +91 -0
  587. package/dist/state/tab-store.d.ts.map +1 -0
  588. package/dist/state/tab-store.js +369 -0
  589. package/dist/state/tab-store.js.map +1 -0
  590. package/dist/transcript.d.ts +40 -0
  591. package/dist/transcript.d.ts.map +1 -0
  592. package/dist/transcript.js +126 -0
  593. package/dist/transcript.js.map +1 -0
  594. package/dist/turns/classify.d.ts +166 -0
  595. package/dist/turns/classify.d.ts.map +1 -0
  596. package/dist/turns/classify.js +259 -0
  597. package/dist/turns/classify.js.map +1 -0
  598. package/dist/turns/errors.d.ts +11 -0
  599. package/dist/turns/errors.d.ts.map +1 -0
  600. package/dist/turns/errors.js +85 -0
  601. package/dist/turns/errors.js.map +1 -0
  602. package/dist/turns/index.d.ts +264 -0
  603. package/dist/turns/index.d.ts.map +1 -0
  604. package/dist/turns/index.js +1243 -0
  605. package/dist/turns/index.js.map +1 -0
  606. package/dist/turns/tool-registry.d.ts +33 -0
  607. package/dist/turns/tool-registry.d.ts.map +1 -0
  608. package/dist/turns/tool-registry.js +108 -0
  609. package/dist/turns/tool-registry.js.map +1 -0
  610. package/dist/turns/types.d.ts +125 -0
  611. package/dist/turns/types.d.ts.map +1 -0
  612. package/dist/turns/types.js +12 -0
  613. package/dist/turns/types.js.map +1 -0
  614. package/dist/turns/view-model.d.ts +127 -0
  615. package/dist/turns/view-model.d.ts.map +1 -0
  616. package/dist/turns/view-model.js +401 -0
  617. package/dist/turns/view-model.js.map +1 -0
  618. package/package.json +155 -0
@@ -0,0 +1,95 @@
1
+ 'use client';
2
+ import { useEffect, useMemo, useRef } from 'react';
3
+ import { getClient } from '../opencode/client.js';
4
+ import { useOpenCodePendingStore } from '../state/opencode-pending-store.js';
5
+ /**
6
+ * True when any assistant message has a `question` tool part still
7
+ * running/pending — the signal `useQuestionSelfHeal` reacts to. Pure so it's
8
+ * independently testable without rendering the hook.
9
+ */
10
+ export function hasRunningQuestionTool(messages) {
11
+ if (!messages)
12
+ return false;
13
+ return messages.some((m) => {
14
+ if (m.info.role !== 'assistant')
15
+ return false;
16
+ return m.parts.some((p) => {
17
+ if (p.type !== 'tool')
18
+ return false;
19
+ const tool = p;
20
+ if (tool.tool !== 'question')
21
+ return false;
22
+ return tool.state.status === 'running' || tool.state.status === 'pending';
23
+ });
24
+ });
25
+ }
26
+ /**
27
+ * Self-heals a missed `question.asked` SSE event: when a `question` tool part
28
+ * is rendering as running/pending but the pending-request store has nothing
29
+ * for this session, re-hydrate from `question.list()`.
30
+ *
31
+ * This is a LIVE-CONNECTION safety net, distinct from `useOpenCodeEventStream`'s
32
+ * reconnect-gap hydration (which only re-hydrates questions/permissions after
33
+ * an SSE gap >5s): it covers a `question.asked` event being dropped, or racing
34
+ * the `message.part.updated` event that renders the tool as running, while the
35
+ * stream stays connected the whole time — the first `question.list()` call can
36
+ * itself race the backend's request creation and return an empty list, so this
37
+ * keeps polling (every 2s, rate-limited to one in-flight call every 1.5s) for
38
+ * as long as the tool shows running with nothing pending, and stops the moment
39
+ * a pending question shows up (from either this poll or the SSE event finally
40
+ * arriving).
41
+ */
42
+ export function useQuestionSelfHeal(sessionId, messages, options = {}) {
43
+ const { enabled = true, isSuppressed } = options;
44
+ const addQuestion = useOpenCodePendingStore((s) => s.addQuestion);
45
+ const pendingCount = useOpenCodePendingStore((s) => Object.values(s.questions).filter((q) => q.sessionID === sessionId && !isSuppressed?.(q.id))
46
+ .length);
47
+ const running = useMemo(() => hasRunningQuestionTool(messages), [messages]);
48
+ const inFlightRef = useRef(false);
49
+ const lastAtRef = useRef(0);
50
+ useEffect(() => {
51
+ if (!enabled || !running || pendingCount > 0)
52
+ return;
53
+ let cancelled = false;
54
+ const hydrate = () => {
55
+ if (inFlightRef.current || cancelled)
56
+ return;
57
+ const now = Date.now();
58
+ if (now - lastAtRef.current < 1500)
59
+ return;
60
+ // Acquire the client lazily: during the sandbox-loading window
61
+ // getClient() throws "Server URL not ready". Skip this tick and let the
62
+ // interval retry once the runtime URL is pinned — never throw here.
63
+ let client;
64
+ try {
65
+ client = getClient();
66
+ }
67
+ catch {
68
+ return;
69
+ }
70
+ inFlightRef.current = true;
71
+ lastAtRef.current = now;
72
+ void client.question
73
+ .list()
74
+ .then((res) => {
75
+ if (!res.data || cancelled)
76
+ return;
77
+ res.data.forEach((q) => {
78
+ if (!q?.id || isSuppressed?.(q.id))
79
+ return;
80
+ addQuestion(q);
81
+ });
82
+ })
83
+ .finally(() => {
84
+ inFlightRef.current = false;
85
+ });
86
+ };
87
+ hydrate();
88
+ const timer = setInterval(hydrate, 2000);
89
+ return () => {
90
+ cancelled = true;
91
+ clearInterval(timer);
92
+ };
93
+ }, [enabled, running, pendingCount, addQuestion, isSuppressed]);
94
+ }
95
+ //# sourceMappingURL=use-question-self-heal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-question-self-heal.js","sourceRoot":"","sources":["../../src/react/use-question-self-heal.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAG1E;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CAAC,QAA4C;IACjF,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5B,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;QACzB,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,WAAW;YAAE,OAAO,KAAK,CAAC;QAC9C,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE;YACxB,IAAI,CAAC,CAAC,IAAI,KAAK,MAAM;gBAAE,OAAO,KAAK,CAAC;YACpC,M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AC,CAAC,CAAC;AAClE,CAAC"}
@@ -0,0 +1,9 @@
1
+ export type RuntimePhase = 'connecting' | 'booting' | 'ready' | 'unreachable';
2
+ /**
3
+ * Coarse, render-friendly runtime connection phase for boot/reconnect UI. Reads
4
+ * the SDK's connection store — the host never touches it directly. `useSession`
5
+ * also returns this as `runtimePhase`; use this standalone hook when you want the
6
+ * phase without a full session (e.g. a lightweight status pill).
7
+ */
8
+ export declare function useRuntimePhase(): RuntimePhase;
9
+ //# sourceMappingURL=use-runtime-phase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-runtime-phase.d.ts","sourceRoot":"","sources":["../../src/react/use-runtime-phase.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,YAAY,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,aAAa,CAAC;AAE9E;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAO9C"}
@@ -0,0 +1,20 @@
1
+ 'use client';
2
+ import { useSandboxConnectionStore } from '../state/sandbox-connection-store.js';
3
+ /**
4
+ * Coarse, render-friendly runtime connection phase for boot/reconnect UI. Reads
5
+ * the SDK's connection store — the host never touches it directly. `useSession`
6
+ * also returns this as `runtimePhase`; use this standalone hook when you want the
7
+ * phase without a full session (e.g. a lightweight status pill).
8
+ */
9
+ export function useRuntimePhase() {
10
+ const status = useSandboxConnectionStore((s) => s.status);
11
+ const healthy = useSandboxConnectionStore((s) => s.healthy);
12
+ if (status === 'unreachable')
13
+ return 'unreachable';
14
+ if (healthy === true)
15
+ return 'ready';
16
+ if (status === 'connected')
17
+ return 'booting'; // reachable, OpenCode still warming
18
+ return 'connecting';
19
+ }
20
+ //# sourceMappingURL=use-runtime-phase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-runtime-phase.js","sourceRoot":"","sources":["../../src/react/use-runtime-phase.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAI9E;;;;;GAKG;AACH,MAAM,UAAU,eAAe;IAC7B,MAAM,MAAM,GAAG,yBAAyB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,yBAAyB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC5D,IAAI,MAAM,KAAK,aAAa;QAAE,OAAO,aAAa,CAAC;IACnD,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,OAAO,CAAC;IACrC,IAAI,MAAM,KAAK,WAAW;QAAE,OAAO,SAAS,CAAC,CAAC,oCAAoC;IAClF,OAAO,YAAY,CAAC;AACtB,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { type SessionHealthResponse } from '../session/index.js';
2
+ import { type SandboxConnectionStatus } from '../state/sandbox-connection-store.js';
3
+ /**
4
+ * Number of consecutive failures before marking as unreachable
5
+ * when this is the FIRST connection (never been connected).
6
+ * Set high enough to ride through transient proxy startup delays.
7
+ */
8
+ export declare const FAIL_THRESHOLD_FIRST = 5;
9
+ /**
10
+ * For reconnection (was connected, then failed) — require two consecutive
11
+ * failures before declaring the instance unreachable. The first miss drops
12
+ * into a lightweight reconnecting state so transient timeouts don't kick the
13
+ * user to an offline/error UI.
14
+ */
15
+ export declare const FAIL_THRESHOLD_RECONNECT = 2;
16
+ /** Interval between health checks (ms) */
17
+ export declare const POLL_CONNECTED = 30000;
18
+ export declare const POLL_FAILING = 150;
19
+ export declare const POLL_UNREACHABLE = 5000;
20
+ export declare const CHECK_TIMEOUT = 20000;
21
+ /** Statuses whose HTTP response itself signals "nothing is home" — no threshold needed. */
22
+ export declare function isImmediateOfflineStatus(status: number): boolean;
23
+ /**
24
+ * Whether a resolved-but-failed probe response should be treated as an
25
+ * immediate "unreachable" signal rather than counted against the normal
26
+ * failure threshold — either a proxy-dead HTTP status, or a body that
27
+ * explicitly says no service answered.
28
+ */
29
+ export declare function isImmediateOfflineSignal(status: number, body: string): boolean;
30
+ /**
31
+ * The result of interpreting one resolved `getSessionHealth` response. Pure —
32
+ * given the same `SessionHealthResult` shape it always classifies the same
33
+ * way, independent of the store or the network. A thrown/aborted probe
34
+ * (network error, `CHECK_TIMEOUT` abort) never reaches this function — the
35
+ * hook folds those into `{ kind: 'failure', immediateOffline: false }` itself,
36
+ * since there is no HTTP status/body to classify.
37
+ */
38
+ export type ProbeOutcome = {
39
+ kind: 'auth-error';
40
+ } | {
41
+ kind: 'booting';
42
+ health: SessionHealthResponse | null;
43
+ } | {
44
+ kind: 'failure';
45
+ immediateOffline: boolean;
46
+ } | {
47
+ kind: 'healthy';
48
+ health: SessionHealthResponse | null;
49
+ };
50
+ export interface ProbeResultLike {
51
+ status: number;
52
+ ok: boolean;
53
+ health: SessionHealthResponse | null;
54
+ body: string;
55
+ }
56
+ export declare function classifyProbeResult(result: ProbeResultLike): ProbeOutcome;
57
+ /**
58
+ * Threshold counting — the one piece of state this machine actually needs to
59
+ * decide a transition. `failCount` is the count AFTER the current failure has
60
+ * been recorded (matches `incrementSandboxFail()` semantics: increment, then
61
+ * read). Returns the next status, or `null` for "no status change" (still
62
+ * below threshold on a first-ever connection, which stays in whatever status
63
+ * it already had — normally "connecting").
64
+ */
65
+ export declare function computeFailureStatus(failCount: number, wasConnected: boolean, immediateOffline: boolean): SandboxConnectionStatus | null;
66
+ /**
67
+ * Next poll interval, purely a function of the current store status/healthy
68
+ * pair — fast while anything is unresolved or unhealthy, slow once truly
69
+ * settled into "connected and healthy".
70
+ */
71
+ export declare function nextPollDelay(status: SandboxConnectionStatus, healthy: boolean | null): number;
72
+ /**
73
+ * useRuntimeReconnect — monitors the active session's runtime reachability
74
+ * mid-session (see `react/opencode.ts` for how this fits alongside the
75
+ * server-truth boot readiness and the SSE heartbeat).
76
+ *
77
+ * Probes `getSessionHealth` (the SDK's `/kortix/health`) and maps the result
78
+ * into the shared `sandbox-connection-store`. Behaviour:
79
+ * - On first failure, immediately switches to fast polling.
80
+ * - If the user was previously connected, the first failure moves to
81
+ * "connecting" and the second consecutive failure marks unreachable.
82
+ * - If it's the first connection, requires FAIL_THRESHOLD_FIRST failures.
83
+ *
84
+ * The transition logic itself (`classifyProbeResult`, `computeFailureStatus`,
85
+ * `nextPollDelay`) is pure and exported above — this hook is thin glue that
86
+ * wires those decisions to a `setTimeout` loop and the store's action
87
+ * functions, since the repo has no harness to render-test a hook directly.
88
+ */
89
+ export declare function useRuntimeReconnect(): void;
90
+ //# sourceMappingURL=use-runtime-reconnect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-runtime-reconnect.d.ts","sourceRoot":"","sources":["../../src/react/use-runtime-reconnect.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoC,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC1F,OAAO,EASL,KAAK,uBAAuB,EAC7B,MAAM,mCAAmC,CAAC;AAG3C;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,0CAA0C;AAC1C,eAAO,MAAM,cAAc,QAAS,CAAC;AAMrC,eAAO,MAAM,YAAY,MAAM,CAAC;AAChC,eAAO,MAAM,gBAAgB,OAAQ,CAAC;AAEtC,eAAO,MAAM,aAAa,QAAS,CAAC;AAEpC,2FAA2F;AAC3F,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhE;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE9E;AAED;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,gBAAgB,EAAE,OAAO,CAAA;CAAE,GAC9C;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAA;CAAE,CAAC;AAE9D,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,YAAY,CAqBzE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,OAAO,EACrB,gBAAgB,EAAE,OAAO,GACxB,uBAAuB,GAAG,IAAI,CAOhC;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,uBAAuB,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,MAAM,CAQ9F;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,SAoIlC"}
@@ -0,0 +1,234 @@
1
+ 'use client';
2
+ import { useEffect, useRef } from 'react';
3
+ import { getSupabaseAccessToken } from '../platform/auth.js';
4
+ import { getSessionHealth, isRuntimeReady } from '../session/index.js';
5
+ import { incrementSandboxFail, markInitialCheckDone, resetForServerSwitch, resetSandboxFail, setOpenCodeHealth, setSandboxStatus, setSandboxVersion, useSandboxConnectionStore, } from '../state/sandbox-connection-store.js';
6
+ import { useServerStore } from '../state/server-store.js';
7
+ /**
8
+ * Number of consecutive failures before marking as unreachable
9
+ * when this is the FIRST connection (never been connected).
10
+ * Set high enough to ride through transient proxy startup delays.
11
+ */
12
+ export const FAIL_THRESHOLD_FIRST = 5;
13
+ /**
14
+ * For reconnection (was connected, then failed) — require two consecutive
15
+ * failures before declaring the instance unreachable. The first miss drops
16
+ * into a lightweight reconnecting state so transient timeouts don't kick the
17
+ * user to an offline/error UI.
18
+ */
19
+ export const FAIL_THRESHOLD_RECONNECT = 2;
20
+ /** Interval between health checks (ms) */
21
+ export const POLL_CONNECTED = 30_000; // 30s when healthy
22
+ // Tight cadence while a sandbox is booting/unhealthy. This is the gate between
23
+ // "sandbox active" and "OpenCode healthy" AND the enable-gate for the opencode
24
+ // session list — so every extra interval is visible dead time after the backend
25
+ // is already ready. 150ms keeps the healthy flip (and the session-list start)
26
+ // tracking actual daemon readiness tightly; the health probe is a cheap GET.
27
+ export const POLL_FAILING = 150;
28
+ export const POLL_UNREACHABLE = 5_000; // 5s when confirmed unreachable
29
+ export const CHECK_TIMEOUT = 20_000;
30
+ /** Statuses whose HTTP response itself signals "nothing is home" — no threshold needed. */
31
+ export function isImmediateOfflineStatus(status) {
32
+ return status === 502 || status === 503 || status === 504;
33
+ }
34
+ /**
35
+ * Whether a resolved-but-failed probe response should be treated as an
36
+ * immediate "unreachable" signal rather than counted against the normal
37
+ * failure threshold — either a proxy-dead HTTP status, or a body that
38
+ * explicitly says no service answered.
39
+ */
40
+ export function isImmediateOfflineSignal(status, body) {
41
+ return isImmediateOfflineStatus(status) || /no service is responding|not reachable/i.test(body);
42
+ }
43
+ export function classifyProbeResult(result) {
44
+ if (result.status === 401 || result.status === 403) {
45
+ // Treat auth errors like any other failure — respect the threshold
46
+ // instead of immediately marking unreachable. During transitions (e.g.
47
+ // provisioning → dashboard), the proxy may briefly return 401 before auth
48
+ // propagates.
49
+ return { kind: 'auth-error' };
50
+ }
51
+ if (result.status === 503) {
52
+ // OpenCode still booting behind an already-live sandbox proxy — this is
53
+ // progress, not failure: reset the fail counter and report "connected"
54
+ // (sandbox is up) with `healthy: false` (OpenCode isn't yet).
55
+ return { kind: 'booting', health: result.health };
56
+ }
57
+ if (!result.ok) {
58
+ return { kind: 'failure', immediateOffline: isImmediateOfflineSignal(result.status, result.body) };
59
+ }
60
+ return { kind: 'healthy', health: result.health };
61
+ }
62
+ /**
63
+ * Threshold counting — the one piece of state this machine actually needs to
64
+ * decide a transition. `failCount` is the count AFTER the current failure has
65
+ * been recorded (matches `incrementSandboxFail()` semantics: increment, then
66
+ * read). Returns the next status, or `null` for "no status change" (still
67
+ * below threshold on a first-ever connection, which stays in whatever status
68
+ * it already had — normally "connecting").
69
+ */
70
+ export function computeFailureStatus(failCount, wasConnected, immediateOffline) {
71
+ if (immediateOffline)
72
+ return 'unreachable';
73
+ const threshold = wasConnected ? FAIL_THRESHOLD_RECONNECT : FAIL_THRESHOLD_FIRST;
74
+ if (failCount >= threshold)
75
+ return 'unreachable';
76
+ if (wasConnected)
77
+ return 'connecting';
78
+ return null;
79
+ }
80
+ /**
81
+ * Next poll interval, purely a function of the current store status/healthy
82
+ * pair — fast while anything is unresolved or unhealthy, slow once truly
83
+ * settled into "connected and healthy".
84
+ */
85
+ export function nextPollDelay(status, healthy) {
86
+ if (status === 'connected' && healthy === false)
87
+ return POLL_FAILING;
88
+ if (status === 'connected')
89
+ return POLL_CONNECTED;
90
+ if (status === 'unreachable')
91
+ return POLL_UNREACHABLE;
92
+ // Initial "connecting" phase (sandbox just went active, opencode still
93
+ // booting) — poll fast so the runtime appears the moment it's healthy
94
+ // instead of waiting out a long interval.
95
+ return POLL_FAILING;
96
+ }
97
+ /**
98
+ * useRuntimeReconnect — monitors the active session's runtime reachability
99
+ * mid-session (see `react/opencode.ts` for how this fits alongside the
100
+ * server-truth boot readiness and the SSE heartbeat).
101
+ *
102
+ * Probes `getSessionHealth` (the SDK's `/kortix/health`) and maps the result
103
+ * into the shared `sandbox-connection-store`. Behaviour:
104
+ * - On first failure, immediately switches to fast polling.
105
+ * - If the user was previously connected, the first failure moves to
106
+ * "connecting" and the second consecutive failure marks unreachable.
107
+ * - If it's the first connection, requires FAIL_THRESHOLD_FIRST failures.
108
+ *
109
+ * The transition logic itself (`classifyProbeResult`, `computeFailureStatus`,
110
+ * `nextPollDelay`) is pure and exported above — this hook is thin glue that
111
+ * wires those decisions to a `setTimeout` loop and the store's action
112
+ * functions, since the repo has no harness to render-test a hook directly.
113
+ */
114
+ export function useRuntimeReconnect() {
115
+ const timerRef = useRef(null);
116
+ const abortRef = useRef(null);
117
+ const isMountRef = useRef(true);
118
+ useEffect(() => {
119
+ const isFirstMount = isMountRef.current;
120
+ isMountRef.current = false;
121
+ if (isFirstMount) {
122
+ // Full reset — clears wasConnected, failCount, status, everything.
123
+ resetForServerSwitch();
124
+ }
125
+ let alive = true;
126
+ async function check() {
127
+ if (!alive)
128
+ return;
129
+ const url = useServerStore.getState().getActiveServerUrl();
130
+ if (!url) {
131
+ scheduleNext();
132
+ return;
133
+ }
134
+ // Don't fire health checks until auth is ready — avoids naked requests
135
+ // that return synthetic 401s and cause false "unreachable" status.
136
+ const token = await getSupabaseAccessToken();
137
+ if (!token) {
138
+ scheduleNext();
139
+ return;
140
+ }
141
+ abortRef.current?.abort();
142
+ const controller = new AbortController();
143
+ abortRef.current = controller;
144
+ let immediateOffline = false;
145
+ let failed = false;
146
+ try {
147
+ const timer = setTimeout(() => controller.abort(), CHECK_TIMEOUT);
148
+ const result = await getSessionHealth(url, { signal: controller.signal });
149
+ clearTimeout(timer);
150
+ if (!alive)
151
+ return;
152
+ const outcome = classifyProbeResult(result);
153
+ switch (outcome.kind) {
154
+ case 'auth-error': {
155
+ failed = true;
156
+ immediateOffline = false;
157
+ break;
158
+ }
159
+ case 'booting': {
160
+ resetSandboxFail();
161
+ setSandboxStatus('connected');
162
+ setOpenCodeHealth(false, outcome.health?.version, outcome.health?.boot_error ?? outcome.health?.message ?? outcome.health?.reason ?? null);
163
+ if (outcome.health?.version) {
164
+ setSandboxVersion(outcome.health.version);
165
+ }
166
+ break;
167
+ }
168
+ case 'failure': {
169
+ failed = true;
170
+ immediateOffline = outcome.immediateOffline;
171
+ break;
172
+ }
173
+ case 'healthy': {
174
+ resetSandboxFail();
175
+ setSandboxStatus('connected');
176
+ setOpenCodeHealth(isRuntimeReady(outcome.health), outcome.health?.version, outcome.health?.boot_error ?? outcome.health?.message ?? outcome.health?.reason ?? null);
177
+ if (outcome.health?.version) {
178
+ setSandboxVersion(outcome.health.version);
179
+ }
180
+ break;
181
+ }
182
+ }
183
+ }
184
+ catch {
185
+ // Network error or `CHECK_TIMEOUT` abort — no HTTP status/body to
186
+ // classify, so this always counts as a plain (non-immediate) failure;
187
+ // the threshold decides whether it flips the status.
188
+ if (!alive)
189
+ return;
190
+ failed = true;
191
+ immediateOffline = false;
192
+ }
193
+ finally {
194
+ if (failed) {
195
+ incrementSandboxFail();
196
+ if (immediateOffline) {
197
+ setSandboxStatus('unreachable');
198
+ }
199
+ else {
200
+ const { failCount, wasConnected } = useSandboxConnectionStore.getState();
201
+ const nextStatus = computeFailureStatus(failCount, wasConnected, immediateOffline);
202
+ if (nextStatus)
203
+ setSandboxStatus(nextStatus);
204
+ }
205
+ }
206
+ // Reschedule from finally so EVERY path re-arms the poll loop —
207
+ // notably the "booting" branch returns early; without this it stops
208
+ // polling and `healthy` never flips, so useSessionSync and the SSE
209
+ // (both gated on healthy) never subscribe and a fresh session's first
210
+ // turn stays invisible until a manual reload.
211
+ if (alive) {
212
+ markInitialCheckDone();
213
+ scheduleNext();
214
+ }
215
+ }
216
+ }
217
+ function scheduleNext() {
218
+ if (!alive)
219
+ return;
220
+ if (timerRef.current)
221
+ clearTimeout(timerRef.current);
222
+ const { status, healthy } = useSandboxConnectionStore.getState();
223
+ timerRef.current = setTimeout(check, nextPollDelay(status, healthy));
224
+ }
225
+ check();
226
+ return () => {
227
+ alive = false;
228
+ abortRef.current?.abort();
229
+ if (timerRef.current)
230
+ clearTimeout(timerRef.current);
231
+ };
232
+ }, []);
233
+ }
234
+ //# sourceMappingURL=use-runtime-reconnect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-runtime-reconnect.js","sourceRoot":"","sources":["../../src/react/use-runtime-reconnect.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC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MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,yBAAyB,CAAC,QAAQ,EAAE,CAAC;YACjE,QAAQ,CAAC,OAAO,GAAG,UAAU,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;QACvE,CAAC;QAED,KAAK,EAAE,CAAC;QAER,OAAO,GAAG,EAAE;YACV,KAAK,GAAG,KAAK,CAAC;YACd,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;YAC1B,IAAI,QAAQ,CAAC,OAAO;gBAAE,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvD,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { ModelKey } from './use-model-store.js';
2
+ /**
3
+ * Per-session model + agent selection, persisted locally. The lists come from the
4
+ * server-side hooks (`useProjectModels`, `useVisibleAgents`); this just remembers
5
+ * which one is chosen for a session and feeds it to send. `null` means "use the
6
+ * project/agent default" — the field is omitted and the runtime decides. Owned by
7
+ * the SDK so every host shares one implementation (and `useSession` can apply the
8
+ * picks to send without the host wiring it).
9
+ */
10
+ export interface SessionPicks {
11
+ model: ModelKey | null;
12
+ agent: string | null;
13
+ setModel: (model: ModelKey | null) => void;
14
+ setAgent: (agent: string | null) => void;
15
+ }
16
+ export declare function useSessionPicks(sessionId: string): SessionPicks;
17
+ //# sourceMappingURL=use-session-picks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-session-picks.d.ts","sourceRoot":"","sources":["../../src/react/use-session-picks.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1C;AAID,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,YAAY,CAiC/D"}
@@ -0,0 +1,36 @@
1
+ 'use client';
2
+ import { useEffect, useState } from 'react';
3
+ const storageKey = (sessionId) => `kortix:picks:${sessionId}`;
4
+ export function useSessionPicks(sessionId) {
5
+ const [picks, setPicks] = useState({
6
+ model: null,
7
+ agent: null,
8
+ });
9
+ useEffect(() => {
10
+ // Always reset on session change — a host page instance is reused across
11
+ // session navigation, so without resetting a new session would inherit the
12
+ // previous one's picks (and persist them under the wrong key).
13
+ try {
14
+ const raw = localStorage.getItem(storageKey(sessionId));
15
+ setPicks(raw ? JSON.parse(raw) : { model: null, agent: null });
16
+ }
17
+ catch {
18
+ setPicks({ model: null, agent: null });
19
+ }
20
+ }, [sessionId]);
21
+ const update = (patch) => setPicks((prev) => {
22
+ const next = { ...prev, ...patch };
23
+ try {
24
+ localStorage.setItem(storageKey(sessionId), JSON.stringify(next));
25
+ }
26
+ catch { }
27
+ return next;
28
+ });
29
+ return {
30
+ model: picks.model,
31
+ agent: picks.agent,
32
+ setModel: (model) => update({ model }),
33
+ setAgent: (agent) => update({ agent }),
34
+ };
35
+ }
36
+ //# sourceMappingURL=use-session-picks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-session-picks.js","sourceRoot":"","sources":["../../src/react/use-session-picks.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAkB5C,MAAM,UAAU,GAAG,CAAC,SAAiB,EAAE,EAAE,CAAC,gBAAgB,SAAS,EAAE,CAAC;AAEtE,MAAM,UAAU,eAAe,CAAC,SAAiB;IAC/C,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,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ACvC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type Session } from "./use-opencode-sessions/index.js";
2
+ /**
3
+ * Prefetch a single session's messages into the sync store + IDB cache.
4
+ * Skips if the session is already in the sync store.
5
+ */
6
+ export declare function prefetchSession(sessionId: string): Promise<void>;
7
+ /**
8
+ * Reset prefetch tracking (e.g., on server switch).
9
+ */
10
+ export declare function resetPrefetchState(): void;
11
+ /**
12
+ * Hook: background-prefetch top N sessions after session list loads.
13
+ * Uses requestIdleCallback to avoid blocking UI.
14
+ */
15
+ export declare function useBackgroundSessionPrefetch(sessions: Session[] | undefined): {
16
+ prefetchOnHover: (sessionId: string) => void;
17
+ };
18
+ //# sourceMappingURL=use-session-prefetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-session-prefetch.d.ts","sourceRoot":"","sources":["../../src/react/use-session-prefetch.ts"],"names":[],"mappings":"AAWA,OAAO,EAA2B,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAKhF;;;GAGG;AACH,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiDtE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAGzC;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,SAAS;iCAM1B,MAAM;EAKvD"}
@@ -0,0 +1,84 @@
1
+ "use client";
2
+ import { useCallback, useEffect } from "react";
3
+ import { getClient } from "../opencode/client.js";
4
+ import { useSyncStore } from "../state/sync-store.js";
5
+ import { useSandboxConnectionStore } from "../state/sandbox-connection-store.js";
6
+ import { saveSessionToIDB, loadSessionFromIDB, pruneIDBCache, } from "../state/idb-sync-cache.js";
7
+ import { canQueryOpenCodeSession } from "./use-opencode-sessions/index.js";
8
+ const prefetchedSessions = new Set();
9
+ const inFlightPrefetches = new Map();
10
+ /**
11
+ * Prefetch a single session's messages into the sync store + IDB cache.
12
+ * Skips if the session is already in the sync store.
13
+ */
14
+ export async function prefetchSession(sessionId) {
15
+ if (!canQueryOpenCodeSession(sessionId))
16
+ return;
17
+ if (useSandboxConnectionStore.getState().healthy !== true)
18
+ return;
19
+ if (prefetchedSessions.has(sessionId))
20
+ return;
21
+ const existingPrefetch = inFlightPrefetches.get(sessionId);
22
+ if (existingPrefetch)
23
+ return existingPrefetch;
24
+ const run = (async () => {
25
+ const state = useSyncStore.getState();
26
+ if (sessionId in state.messages && (state.messages[sessionId]?.length ?? 0) > 0) {
27
+ prefetchedSessions.add(sessionId);
28
+ return;
29
+ }
30
+ // Try IDB cache first
31
+ const cached = await loadSessionFromIDB(sessionId);
32
+ if (cached && cached.messages.length > 0) {
33
+ const currentState = useSyncStore.getState();
34
+ if (!(sessionId in currentState.messages) || (currentState.messages[sessionId]?.length ?? 0) === 0) {
35
+ currentState.hydrate(sessionId, cached.messages.map((info) => ({
36
+ info,
37
+ parts: cached.parts[info.id] ?? [],
38
+ })));
39
+ }
40
+ }
41
+ // Fetch fresh data from server in background
42
+ try {
43
+ const res = await getClient().session.messages({ sessionID: sessionId });
44
+ const data = res.data ?? [];
45
+ if (data.length > 0) {
46
+ useSyncStore.getState().hydrate(sessionId, data);
47
+ const parts = useSyncStore.getState().parts;
48
+ const msgs = useSyncStore.getState().messages[sessionId] ?? [];
49
+ saveSessionToIDB(sessionId, msgs, parts);
50
+ }
51
+ prefetchedSessions.add(sessionId);
52
+ }
53
+ catch {
54
+ // Non-critical — cache is still warm from IDB
55
+ }
56
+ })().finally(() => {
57
+ inFlightPrefetches.delete(sessionId);
58
+ });
59
+ inFlightPrefetches.set(sessionId, run);
60
+ return run;
61
+ }
62
+ /**
63
+ * Reset prefetch tracking (e.g., on server switch).
64
+ */
65
+ export function resetPrefetchState() {
66
+ prefetchedSessions.clear();
67
+ inFlightPrefetches.clear();
68
+ }
69
+ /**
70
+ * Hook: background-prefetch top N sessions after session list loads.
71
+ * Uses requestIdleCallback to avoid blocking UI.
72
+ */
73
+ export function useBackgroundSessionPrefetch(sessions) {
74
+ useEffect(() => {
75
+ if (!sessions || sessions.length === 0)
76
+ return;
77
+ void pruneIDBCache();
78
+ }, [sessions]);
79
+ const prefetchOnHover = useCallback((sessionId) => {
80
+ prefetchSession(sessionId);
81
+ }, []);
82
+ return { prefetchOnHover };
83
+ }
84
+ //# sourceMappingURL=use-session-prefetch.js.map