@kortix/sdk 0.13.4 → 0.13.7

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 (380) hide show
  1. package/README.md +63 -6
  2. package/dist/browser/cache/idb-sync-cache.d.ts +19 -1
  3. package/dist/browser/cache/idb-sync-cache.d.ts.map +1 -1
  4. package/dist/browser/cache/idb-sync-cache.js +39 -4
  5. package/dist/browser/cache/idb-sync-cache.js.map +1 -1
  6. package/dist/browser/session-sync/server-transcript-mirror.d.ts +82 -0
  7. package/dist/browser/session-sync/server-transcript-mirror.d.ts.map +1 -0
  8. package/dist/browser/session-sync/server-transcript-mirror.js +143 -0
  9. package/dist/browser/session-sync/server-transcript-mirror.js.map +1 -0
  10. package/dist/browser/session-sync/session-sync-registry.d.ts +11 -1
  11. package/dist/browser/session-sync/session-sync-registry.d.ts.map +1 -1
  12. package/dist/browser/session-sync/session-sync-registry.js +117 -9
  13. package/dist/browser/session-sync/session-sync-registry.js.map +1 -1
  14. package/dist/browser/session-sync/visibility.d.ts +19 -0
  15. package/dist/browser/session-sync/visibility.d.ts.map +1 -0
  16. package/dist/browser/session-sync/visibility.js +16 -0
  17. package/dist/browser/session-sync/visibility.js.map +1 -0
  18. package/dist/browser/stores/sandbox-connection-store.d.ts +13 -1
  19. package/dist/browser/stores/sandbox-connection-store.d.ts.map +1 -1
  20. package/dist/browser/stores/sandbox-connection-store.js +6 -3
  21. package/dist/browser/stores/sandbox-connection-store.js.map +1 -1
  22. package/dist/browser/stores/session-working-store.d.ts +10 -5
  23. package/dist/browser/stores/session-working-store.d.ts.map +1 -1
  24. package/dist/browser/stores/session-working-store.js +32 -8
  25. package/dist/browser/stores/session-working-store.js.map +1 -1
  26. package/dist/browser/stores/sync-store.d.ts +56 -2
  27. package/dist/browser/stores/sync-store.d.ts.map +1 -1
  28. package/dist/browser/stores/sync-store.js +682 -402
  29. package/dist/browser/stores/sync-store.js.map +1 -1
  30. package/dist/core/auth/app-viewer.d.ts +57 -0
  31. package/dist/core/auth/app-viewer.d.ts.map +1 -0
  32. package/dist/core/auth/app-viewer.js +82 -0
  33. package/dist/core/auth/app-viewer.js.map +1 -0
  34. package/dist/core/auth/session.d.ts +45 -0
  35. package/dist/core/auth/session.d.ts.map +1 -0
  36. package/dist/core/auth/session.js +113 -0
  37. package/dist/core/auth/session.js.map +1 -0
  38. package/dist/core/client/kortix.d.ts +37 -29
  39. package/dist/core/client/kortix.d.ts.map +1 -1
  40. package/dist/core/client/kortix.js +61 -8
  41. package/dist/core/client/kortix.js.map +1 -1
  42. package/dist/core/http/config.d.ts +4 -2
  43. package/dist/core/http/config.d.ts.map +1 -1
  44. package/dist/core/http/config.js.map +1 -1
  45. package/dist/core/http/opencode-errors.d.ts +17 -0
  46. package/dist/core/http/opencode-errors.d.ts.map +1 -1
  47. package/dist/core/http/opencode-errors.js +25 -0
  48. package/dist/core/http/opencode-errors.js.map +1 -1
  49. package/dist/core/rest/platform-client/auth.d.ts +120 -0
  50. package/dist/core/rest/platform-client/auth.d.ts.map +1 -0
  51. package/dist/core/rest/platform-client/auth.js +98 -0
  52. package/dist/core/rest/platform-client/auth.js.map +1 -0
  53. package/dist/core/rest/platform-client/host-boundary.d.ts +5 -0
  54. package/dist/core/rest/platform-client/host-boundary.d.ts.map +1 -1
  55. package/dist/core/rest/platform-client/host-boundary.js.map +1 -1
  56. package/dist/core/rest/projects-client/accounts.d.ts +57 -0
  57. package/dist/core/rest/projects-client/accounts.d.ts.map +1 -1
  58. package/dist/core/rest/projects-client/accounts.js +31 -0
  59. package/dist/core/rest/projects-client/accounts.js.map +1 -1
  60. package/dist/core/rest/projects-client/apps.d.ts +9 -0
  61. package/dist/core/rest/projects-client/apps.d.ts.map +1 -1
  62. package/dist/core/rest/projects-client/apps.js.map +1 -1
  63. package/dist/core/rest/projects-client/billing.d.ts +2 -0
  64. package/dist/core/rest/projects-client/billing.d.ts.map +1 -1
  65. package/dist/core/rest/projects-client/billing.js.map +1 -1
  66. package/dist/core/rest/projects-client/channels.d.ts +0 -3
  67. package/dist/core/rest/projects-client/channels.d.ts.map +1 -1
  68. package/dist/core/rest/projects-client/channels.js +0 -6
  69. package/dist/core/rest/projects-client/channels.js.map +1 -1
  70. package/dist/core/rest/projects-client/connectors.d.ts +104 -19
  71. package/dist/core/rest/projects-client/connectors.d.ts.map +1 -1
  72. package/dist/core/rest/projects-client/connectors.js +56 -2
  73. package/dist/core/rest/projects-client/connectors.js.map +1 -1
  74. package/dist/core/rest/projects-client/index.d.ts +1 -2
  75. package/dist/core/rest/projects-client/index.d.ts.map +1 -1
  76. package/dist/core/rest/projects-client/index.js +1 -2
  77. package/dist/core/rest/projects-client/index.js.map +1 -1
  78. package/dist/core/rest/projects-client/oauth-clients.d.ts +47 -0
  79. package/dist/core/rest/projects-client/oauth-clients.d.ts.map +1 -0
  80. package/dist/core/rest/projects-client/oauth-clients.js +33 -0
  81. package/dist/core/rest/projects-client/oauth-clients.js.map +1 -0
  82. package/dist/core/rest/projects-client/projects.d.ts +23 -6
  83. package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
  84. package/dist/core/rest/projects-client/projects.js +6 -3
  85. package/dist/core/rest/projects-client/projects.js.map +1 -1
  86. package/dist/core/rest/projects-client/session-sandbox.d.ts +52 -0
  87. package/dist/core/rest/projects-client/session-sandbox.d.ts.map +1 -1
  88. package/dist/core/rest/projects-client/session-sandbox.js.map +1 -1
  89. package/dist/core/rest/projects-client/sessions.d.ts +142 -34
  90. package/dist/core/rest/projects-client/sessions.d.ts.map +1 -1
  91. package/dist/core/rest/projects-client/sessions.js +48 -19
  92. package/dist/core/rest/projects-client/sessions.js.map +1 -1
  93. package/dist/core/runtime/attachment-part.d.ts +26 -0
  94. package/dist/core/runtime/attachment-part.d.ts.map +1 -0
  95. package/dist/core/runtime/attachment-part.js +41 -0
  96. package/dist/core/runtime/attachment-part.js.map +1 -0
  97. package/dist/core/runtime/client.d.ts +4 -2
  98. package/dist/core/runtime/client.d.ts.map +1 -1
  99. package/dist/core/runtime/client.js +3 -2
  100. package/dist/core/runtime/client.js.map +1 -1
  101. package/dist/core/runtime/opencode-v2-event-aliases.d.ts +184 -0
  102. package/dist/core/runtime/opencode-v2-event-aliases.d.ts.map +1 -0
  103. package/dist/core/runtime/opencode-v2-event-aliases.js +2 -0
  104. package/dist/core/runtime/opencode-v2-event-aliases.js.map +1 -0
  105. package/dist/core/runtime/pty.d.ts +11 -1
  106. package/dist/core/runtime/pty.d.ts.map +1 -1
  107. package/dist/core/runtime/pty.js +19 -6
  108. package/dist/core/runtime/pty.js.map +1 -1
  109. package/dist/core/session/connection.d.ts +64 -0
  110. package/dist/core/session/connection.d.ts.map +1 -0
  111. package/dist/core/session/connection.js +36 -0
  112. package/dist/core/session/connection.js.map +1 -0
  113. package/dist/core/session/index.d.ts +2 -0
  114. package/dist/core/session/index.d.ts.map +1 -1
  115. package/dist/core/session/index.js +2 -0
  116. package/dist/core/session/index.js.map +1 -1
  117. package/dist/core/session/open-bundle.d.ts +110 -0
  118. package/dist/core/session/open-bundle.d.ts.map +1 -0
  119. package/dist/core/session/open-bundle.js +183 -0
  120. package/dist/core/session/open-bundle.js.map +1 -0
  121. package/dist/core/session/poll-owner.d.ts +35 -0
  122. package/dist/core/session/poll-owner.d.ts.map +1 -0
  123. package/dist/core/session/poll-owner.js +90 -0
  124. package/dist/core/session/poll-owner.js.map +1 -0
  125. package/dist/core/session/preview-auth.d.ts +25 -0
  126. package/dist/core/session/preview-auth.d.ts.map +1 -1
  127. package/dist/core/session/preview-auth.js +31 -1
  128. package/dist/core/session/preview-auth.js.map +1 -1
  129. package/dist/core/session/preview-config.d.ts +26 -0
  130. package/dist/core/session/preview-config.d.ts.map +1 -0
  131. package/dist/core/session/preview-config.js +95 -0
  132. package/dist/core/session/preview-config.js.map +1 -0
  133. package/dist/core/session/preview-options.d.ts +25 -0
  134. package/dist/core/session/preview-options.d.ts.map +1 -0
  135. package/dist/core/session/preview-options.js +45 -0
  136. package/dist/core/session/preview-options.js.map +1 -0
  137. package/dist/core/session/preview.d.ts +8 -3
  138. package/dist/core/session/preview.d.ts.map +1 -1
  139. package/dist/core/session/preview.js +11 -4
  140. package/dist/core/session/preview.js.map +1 -1
  141. package/dist/core/session/rewind.d.ts +67 -24
  142. package/dist/core/session/rewind.d.ts.map +1 -1
  143. package/dist/core/session/rewind.js +74 -26
  144. package/dist/core/session/rewind.js.map +1 -1
  145. package/dist/core/session/server-store/active.d.ts +10 -12
  146. package/dist/core/session/server-store/active.d.ts.map +1 -1
  147. package/dist/core/session/server-store/active.js +11 -9
  148. package/dist/core/session/server-store/active.js.map +1 -1
  149. package/dist/core/session/server-store/url-helpers.d.ts +11 -2
  150. package/dist/core/session/server-store/url-helpers.d.ts.map +1 -1
  151. package/dist/core/session/server-store/url-helpers.js +11 -2
  152. package/dist/core/session/server-store/url-helpers.js.map +1 -1
  153. package/dist/core/session/static-file-preview.d.ts +50 -0
  154. package/dist/core/session/static-file-preview.d.ts.map +1 -0
  155. package/dist/core/session/static-file-preview.js +91 -0
  156. package/dist/core/session/static-file-preview.js.map +1 -0
  157. package/dist/core/session/url.d.ts +25 -2
  158. package/dist/core/session/url.d.ts.map +1 -1
  159. package/dist/core/session/url.js +87 -11
  160. package/dist/core/session/url.js.map +1 -1
  161. package/dist/core/session/wake-escalation.d.ts +188 -0
  162. package/dist/core/session/wake-escalation.d.ts.map +1 -0
  163. package/dist/core/session/wake-escalation.js +241 -0
  164. package/dist/core/session/wake-escalation.js.map +1 -0
  165. package/dist/core/session/working.d.ts +107 -2
  166. package/dist/core/session/working.d.ts.map +1 -1
  167. package/dist/core/session/working.js +206 -7
  168. package/dist/core/session/working.js.map +1 -1
  169. package/dist/core/session-sync/durable-log.d.ts +96 -0
  170. package/dist/core/session-sync/durable-log.d.ts.map +1 -0
  171. package/dist/core/session-sync/durable-log.js +94 -0
  172. package/dist/core/session-sync/durable-log.js.map +1 -0
  173. package/dist/core/session-sync/fragment.d.ts +27 -0
  174. package/dist/core/session-sync/fragment.d.ts.map +1 -0
  175. package/dist/core/session-sync/fragment.js +24 -0
  176. package/dist/core/session-sync/fragment.js.map +1 -0
  177. package/dist/core/session-sync/session-sync-controller.d.ts +117 -11
  178. package/dist/core/session-sync/session-sync-controller.d.ts.map +1 -1
  179. package/dist/core/session-sync/session-sync-controller.js +278 -26
  180. package/dist/core/session-sync/session-sync-controller.js.map +1 -1
  181. package/dist/core/stream/keepalive.d.ts +17 -0
  182. package/dist/core/stream/keepalive.d.ts.map +1 -0
  183. package/dist/core/stream/keepalive.js +19 -0
  184. package/dist/core/stream/keepalive.js.map +1 -0
  185. package/dist/core/turns/grouping.d.ts.map +1 -1
  186. package/dist/core/turns/grouping.js +73 -23
  187. package/dist/core/turns/grouping.js.map +1 -1
  188. package/dist/core/turns/types.d.ts +5 -0
  189. package/dist/core/turns/types.d.ts.map +1 -1
  190. package/dist/index.d.ts +16 -1
  191. package/dist/index.d.ts.map +1 -1
  192. package/dist/index.js +19 -0
  193. package/dist/index.js.map +1 -1
  194. package/dist/kortix.esm.min.js +25 -25
  195. package/dist/kortix.global.js +25 -25
  196. package/dist/node/app-viewer.d.ts +41 -0
  197. package/dist/node/app-viewer.d.ts.map +1 -0
  198. package/dist/node/app-viewer.js +150 -0
  199. package/dist/node/app-viewer.js.map +1 -0
  200. package/dist/node/auth.d.ts +84 -0
  201. package/dist/node/auth.d.ts.map +1 -0
  202. package/dist/node/auth.js +414 -0
  203. package/dist/node/auth.js.map +1 -0
  204. package/dist/node/server.d.ts +19 -0
  205. package/dist/node/server.d.ts.map +1 -1
  206. package/dist/node/server.js +13 -1
  207. package/dist/node/server.js.map +1 -1
  208. package/dist/platform/auth-core.d.ts +13 -1
  209. package/dist/platform/auth-core.d.ts.map +1 -1
  210. package/dist/platform/auth-core.js +13 -1
  211. package/dist/platform/auth-core.js.map +1 -1
  212. package/dist/react/bedrock-invokable.d.ts +58 -0
  213. package/dist/react/bedrock-invokable.d.ts.map +1 -0
  214. package/dist/react/bedrock-invokable.js +83 -0
  215. package/dist/react/bedrock-invokable.js.map +1 -0
  216. package/dist/react/index.d.ts +3 -0
  217. package/dist/react/index.d.ts.map +1 -1
  218. package/dist/react/index.js +7 -0
  219. package/dist/react/index.js.map +1 -1
  220. package/dist/react/model-flatten.d.ts +14 -1
  221. package/dist/react/model-flatten.d.ts.map +1 -1
  222. package/dist/react/model-flatten.js +3 -4
  223. package/dist/react/model-flatten.js.map +1 -1
  224. package/dist/react/opencode.d.ts +3 -1
  225. package/dist/react/opencode.d.ts.map +1 -1
  226. package/dist/react/opencode.js +5 -1
  227. package/dist/react/opencode.js.map +1 -1
  228. package/dist/react/provider-selection.d.ts +58 -0
  229. package/dist/react/provider-selection.d.ts.map +1 -1
  230. package/dist/react/provider-selection.js +253 -2
  231. package/dist/react/provider-selection.js.map +1 -1
  232. package/dist/react/session-start-giveup.d.ts +12 -0
  233. package/dist/react/session-start-giveup.d.ts.map +1 -0
  234. package/dist/react/session-start-giveup.js +13 -0
  235. package/dist/react/session-start-giveup.js.map +1 -0
  236. package/dist/react/session-title-sync.d.ts.map +1 -1
  237. package/dist/react/session-title-sync.js +15 -5
  238. package/dist/react/session-title-sync.js.map +1 -1
  239. package/dist/react/sign-in-with-kortix.d.ts +346 -0
  240. package/dist/react/sign-in-with-kortix.d.ts.map +1 -0
  241. package/dist/react/sign-in-with-kortix.js +65 -0
  242. package/dist/react/sign-in-with-kortix.js.map +1 -0
  243. package/dist/react/use-admin-accounts.d.ts +36 -1
  244. package/dist/react/use-admin-accounts.d.ts.map +1 -1
  245. package/dist/react/use-admin-accounts.js +19 -0
  246. package/dist/react/use-admin-accounts.js.map +1 -1
  247. package/dist/react/use-gateway-routing-policy.d.ts +1 -0
  248. package/dist/react/use-gateway-routing-policy.d.ts.map +1 -1
  249. package/dist/react/use-gateway-routing-policy.js +12 -1
  250. package/dist/react/use-gateway-routing-policy.js.map +1 -1
  251. package/dist/react/use-kortix-app-viewer.d.ts +13 -0
  252. package/dist/react/use-kortix-app-viewer.d.ts.map +1 -0
  253. package/dist/react/use-kortix-app-viewer.js +29 -0
  254. package/dist/react/use-kortix-app-viewer.js.map +1 -0
  255. package/dist/react/use-model-defaults.d.ts +7 -0
  256. package/dist/react/use-model-defaults.d.ts.map +1 -1
  257. package/dist/react/use-model-defaults.js +7 -1
  258. package/dist/react/use-model-defaults.js.map +1 -1
  259. package/dist/react/use-model-enablement.d.ts.map +1 -1
  260. package/dist/react/use-model-enablement.js +5 -1
  261. package/dist/react/use-model-enablement.js.map +1 -1
  262. package/dist/react/use-model-store.d.ts +31 -0
  263. package/dist/react/use-model-store.d.ts.map +1 -1
  264. package/dist/react/use-model-store.js +31 -2
  265. package/dist/react/use-model-store.js.map +1 -1
  266. package/dist/react/use-opencode-events/handle-event.d.ts.map +1 -1
  267. package/dist/react/use-opencode-events/handle-event.js +26 -0
  268. package/dist/react/use-opencode-events/handle-event.js.map +1 -1
  269. package/dist/react/use-opencode-events/helpers.d.ts +49 -5
  270. package/dist/react/use-opencode-events/helpers.d.ts.map +1 -1
  271. package/dist/react/use-opencode-events/helpers.js +54 -6
  272. package/dist/react/use-opencode-events/helpers.js.map +1 -1
  273. package/dist/react/use-opencode-events/index.d.ts.map +1 -1
  274. package/dist/react/use-opencode-events/index.js +80 -8
  275. package/dist/react/use-opencode-events/index.js.map +1 -1
  276. package/dist/react/use-opencode-events/rehydrate-targets.d.ts +18 -0
  277. package/dist/react/use-opencode-events/rehydrate-targets.d.ts.map +1 -0
  278. package/dist/react/use-opencode-events/rehydrate-targets.js +20 -0
  279. package/dist/react/use-opencode-events/rehydrate-targets.js.map +1 -0
  280. package/dist/react/use-opencode-events/stream-revival.d.ts +37 -0
  281. package/dist/react/use-opencode-events/stream-revival.d.ts.map +1 -0
  282. package/dist/react/use-opencode-events/stream-revival.js +53 -0
  283. package/dist/react/use-opencode-events/stream-revival.js.map +1 -0
  284. package/dist/react/use-opencode-events/use-event-stream-refs.d.ts.map +1 -1
  285. package/dist/react/use-opencode-events/use-event-stream-refs.js +14 -2
  286. package/dist/react/use-opencode-events/use-event-stream-refs.js.map +1 -1
  287. package/dist/react/use-opencode-local.d.ts.map +1 -1
  288. package/dist/react/use-opencode-local.js +27 -8
  289. package/dist/react/use-opencode-local.js.map +1 -1
  290. package/dist/react/use-opencode-pty.d.ts +7 -1
  291. package/dist/react/use-opencode-pty.d.ts.map +1 -1
  292. package/dist/react/use-opencode-pty.js +6 -2
  293. package/dist/react/use-opencode-pty.js.map +1 -1
  294. package/dist/react/use-opencode-sessions/agents.d.ts.map +1 -1
  295. package/dist/react/use-opencode-sessions/agents.js +13 -2
  296. package/dist/react/use-opencode-sessions/agents.js.map +1 -1
  297. package/dist/react/use-opencode-sessions/commands.d.ts +12 -0
  298. package/dist/react/use-opencode-sessions/commands.d.ts.map +1 -1
  299. package/dist/react/use-opencode-sessions/commands.js +15 -3
  300. package/dist/react/use-opencode-sessions/commands.js.map +1 -1
  301. package/dist/react/use-opencode-sessions/index.d.ts +1 -0
  302. package/dist/react/use-opencode-sessions/index.d.ts.map +1 -1
  303. package/dist/react/use-opencode-sessions/index.js +1 -0
  304. package/dist/react/use-opencode-sessions/index.js.map +1 -1
  305. package/dist/react/use-opencode-sessions/keys.d.ts +8 -0
  306. package/dist/react/use-opencode-sessions/keys.d.ts.map +1 -1
  307. package/dist/react/use-opencode-sessions/keys.js +8 -0
  308. package/dist/react/use-opencode-sessions/keys.js.map +1 -1
  309. package/dist/react/use-opencode-sessions/providers.d.ts.map +1 -1
  310. package/dist/react/use-opencode-sessions/providers.js +56 -5
  311. package/dist/react/use-opencode-sessions/providers.js.map +1 -1
  312. package/dist/react/use-opencode-sessions/shared.d.ts +23 -0
  313. package/dist/react/use-opencode-sessions/shared.d.ts.map +1 -1
  314. package/dist/react/use-opencode-sessions/shared.js +31 -0
  315. package/dist/react/use-opencode-sessions/shared.js.map +1 -1
  316. package/dist/react/use-opencode-sessions/vcs.d.ts +28 -0
  317. package/dist/react/use-opencode-sessions/vcs.d.ts.map +1 -0
  318. package/dist/react/use-opencode-sessions/vcs.js +42 -0
  319. package/dist/react/use-opencode-sessions/vcs.js.map +1 -0
  320. package/dist/react/use-poll-owner.d.ts +14 -0
  321. package/dist/react/use-poll-owner.d.ts.map +1 -0
  322. package/dist/react/use-poll-owner.js +32 -0
  323. package/dist/react/use-poll-owner.js.map +1 -0
  324. package/dist/react/use-project-llm-gateway.d.ts +27 -0
  325. package/dist/react/use-project-llm-gateway.d.ts.map +1 -0
  326. package/dist/react/use-project-llm-gateway.js +41 -0
  327. package/dist/react/use-project-llm-gateway.js.map +1 -0
  328. package/dist/react/use-project-models.d.ts +9 -0
  329. package/dist/react/use-project-models.d.ts.map +1 -1
  330. package/dist/react/use-project-models.js +24 -1
  331. package/dist/react/use-project-models.js.map +1 -1
  332. package/dist/react/use-runtime-reconnect.d.ts +11 -0
  333. package/dist/react/use-runtime-reconnect.d.ts.map +1 -1
  334. package/dist/react/use-runtime-reconnect.js +34 -3
  335. package/dist/react/use-runtime-reconnect.js.map +1 -1
  336. package/dist/react/use-session-prompts.d.ts +53 -3
  337. package/dist/react/use-session-prompts.d.ts.map +1 -1
  338. package/dist/react/use-session-prompts.js +133 -21
  339. package/dist/react/use-session-prompts.js.map +1 -1
  340. package/dist/react/use-session-send.d.ts +17 -0
  341. package/dist/react/use-session-send.d.ts.map +1 -1
  342. package/dist/react/use-session-send.js +54 -5
  343. package/dist/react/use-session-send.js.map +1 -1
  344. package/dist/react/use-session-start-give-up.d.ts +20 -0
  345. package/dist/react/use-session-start-give-up.d.ts.map +1 -0
  346. package/dist/react/use-session-start-give-up.js +60 -0
  347. package/dist/react/use-session-start-give-up.js.map +1 -0
  348. package/dist/react/use-session-sync.d.ts +35 -1
  349. package/dist/react/use-session-sync.d.ts.map +1 -1
  350. package/dist/react/use-session-sync.js +135 -53
  351. package/dist/react/use-session-sync.js.map +1 -1
  352. package/dist/react/use-session-working.d.ts +55 -0
  353. package/dist/react/use-session-working.d.ts.map +1 -1
  354. package/dist/react/use-session-working.js +114 -13
  355. package/dist/react/use-session-working.js.map +1 -1
  356. package/dist/react/use-session.d.ts +13 -13
  357. package/dist/react/use-session.d.ts.map +1 -1
  358. package/dist/react/use-session.js +74 -53
  359. package/dist/react/use-session.js.map +1 -1
  360. package/dist/react/use-static-file-preview.d.ts +12 -0
  361. package/dist/react/use-static-file-preview.d.ts.map +1 -0
  362. package/dist/react/use-static-file-preview.js +119 -0
  363. package/dist/react/use-static-file-preview.js.map +1 -0
  364. package/dist/react/use-wake-escalation.d.ts +51 -0
  365. package/dist/react/use-wake-escalation.d.ts.map +1 -0
  366. package/dist/react/use-wake-escalation.js +62 -0
  367. package/dist/react/use-wake-escalation.js.map +1 -0
  368. package/package.json +6 -4
  369. package/dist/browser/session-sync/session-transcript-cache.d.ts +0 -79
  370. package/dist/browser/session-sync/session-transcript-cache.d.ts.map +0 -1
  371. package/dist/browser/session-sync/session-transcript-cache.js +0 -91
  372. package/dist/browser/session-sync/session-transcript-cache.js.map +0 -1
  373. package/dist/core/rest/projects-client/public-voice-join.d.ts +0 -59
  374. package/dist/core/rest/projects-client/public-voice-join.d.ts.map +0 -1
  375. package/dist/core/rest/projects-client/public-voice-join.js +0 -64
  376. package/dist/core/rest/projects-client/public-voice-join.js.map +0 -1
  377. package/dist/core/rest/projects-client/transcription.d.ts +0 -5
  378. package/dist/core/rest/projects-client/transcription.d.ts.map +0 -1
  379. package/dist/core/rest/projects-client/transcription.js +0 -14
  380. package/dist/core/rest/projects-client/transcription.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/react/use-opencode-sessions/shared.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAMxC;AAMD,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE;IAChC,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ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AE,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAE3E;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAE/E;AAMD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,GAAG,CAAC,EAAE,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,GAAG,SAAS,CAGpF;AAKD,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,IAAI,MAAM,CAEjG;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGjE;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,WAAW,CAAC"}
@@ -90,6 +90,37 @@ export function getLSCache(family, scope) {
90
90
  export function setLSCache(family, value, scope) {
91
91
  cacheByFamily[family]?.set(scope ?? activeServerKey(), value);
92
92
  }
93
+ // ============================================================================
94
+ // Helper: shape guard for runtime LIST endpoints
95
+ // ============================================================================
96
+ /**
97
+ * Coerce a runtime list response to an array.
98
+ *
99
+ * The OpenCode REST types say `GET /command`, `GET /agent`, … return an array,
100
+ * but the value that actually arrives does not always agree: a daemon or proxy
101
+ * that answers a list route with an object body hands the caller a TRUTHY
102
+ * non-array. Consumers iterate the list (`for…of`, `.find`, `.some`,
103
+ * `.filter`), so that value does not degrade — it throws
104
+ * `TypeError: <x> is not iterable` inside a render and takes the whole session
105
+ * view down with it (dev, 2026-08-23). Normalize at the seam so an unexpected
106
+ * body reads as "no items" instead.
107
+ *
108
+ * This is the list-level twin of `detectCommandFromText`'s per-item
109
+ * `typeof cmd.template !== 'string'` guard in `apps/web`.
110
+ */
111
+ export function asRuntimeList(value) {
112
+ return Array.isArray(value) ? value : [];
113
+ }
114
+ /**
115
+ * Read a localStorage-cached list for `placeholderData`. A cached value that is
116
+ * not an array reads as a MISS (`undefined`), exactly like a legacy-shaped
117
+ * entry — the query then simply refetches instead of painting a corrupt
118
+ * placeholder into the render.
119
+ */
120
+ export function cachedRuntimeList(family, scope) {
121
+ const cached = getLSCache(family, scope);
122
+ return Array.isArray(cached) ? cached : undefined;
123
+ }
93
124
  const PROJECT_SESSION_UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
94
125
  export function canQueryOpenCodeSession(sessionId) {
95
126
  return !!sessionId && !PROJECT_SESSION_UUID_RE.test(sessionId);
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/react/use-opencode-sessions/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAQhF,+EAA+E;AAC/E,aAAa;AACb,+EAA+E;AAE/E;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,eAAe;IAC7B,IAAI,CAAC;QACH,OAAO,0BAA0B,EAAE,IAAI,MAAM,CAAC;IAChD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,MAAM,CAAC;IAChB,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,6CAA6C;AAC7C,+EAA+E;AAE/E,MAAM,UAAU,MAAM,CAAI,MAIzB;IACC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QACjB,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC;QACzB,MAAM,MAAM,GAAI,MAAM,CAAC,QAAiC,EAAE,MAAM,CAAC;QACjE,wEAAwE;QACxE,sEAAsE;QACtE,sEAAsE;QACtE,sDAAsD;QACtD,MAAM,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{ VcsFileDiff };
3
+ /**
4
+ * Which set of changes `/vcs/diff` describes.
5
+ *
6
+ * - `git` — the WORKING TREE only. Goes to zero the moment the agent commits.
7
+ * - `branch` — the working tree PLUS every commit this branch carries over the
8
+ * repository's default branch. This is the "what has this version changed
9
+ * that is not in main yet" set, and it is the one the Changes surface means.
10
+ */
11
+ export type VcsDiffMode = 'git' | 'branch';
12
+ /**
13
+ * The session's file changes, as ONE array with ONE query key.
14
+ *
15
+ * Every Changes surface (the tab badge, the header chip, the diff panel) must
16
+ * read this hook. React Query dedupes by key, so they cannot disagree: a badge
17
+ * reading "32" above a body reading "no changes yet" is not possible when both
18
+ * derive from the same cache entry.
19
+ *
20
+ * `session.diff` — the endpoint the diff panel used to read — answers a
21
+ * different question ("what did THIS user message change"), which is why a
22
+ * fresh session with no user message returned `[]` while `git status` reported
23
+ * a dirty tree.
24
+ */
25
+ export declare function useOpenCodeVcsDiff(mode?: VcsDiffMode, options?: {
26
+ enabled?: boolean;
27
+ }): import("@tanstack/react-query").UseQueryResult<NoInfer<VcsFileDiff[]>, Error>;
28
+ //# sourceMappingURL=vcs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vcs.d.ts","sourceRoot":"","sources":["../../../src/react/use-opencode-sessions/vcs.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAS9D,YAAY,EAAE,WAAW,EAAE,CAAC;AAE5B;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,GAAE,WAAsB,EAC5B,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,iFAsBhC"}
@@ -0,0 +1,42 @@
1
+ 'use client';
2
+ import { useQuery } from '@tanstack/react-query';
3
+ import { getClient } from '../../core/runtime/client.js';
4
+ import { useCurrentRuntime } from '../use-current-runtime.js';
5
+ import { opencodeKeys, useOpenCodeRuntimeReady } from './keys.js';
6
+ import { unwrap } from './shared.js';
7
+ /**
8
+ * The session's file changes, as ONE array with ONE query key.
9
+ *
10
+ * Every Changes surface (the tab badge, the header chip, the diff panel) must
11
+ * read this hook. React Query dedupes by key, so they cannot disagree: a badge
12
+ * reading "32" above a body reading "no changes yet" is not possible when both
13
+ * derive from the same cache entry.
14
+ *
15
+ * `session.diff` — the endpoint the diff panel used to read — answers a
16
+ * different question ("what did THIS user message change"), which is why a
17
+ * fresh session with no user message returned `[]` while `git status` reported
18
+ * a dirty tree.
19
+ */
20
+ export function useOpenCodeVcsDiff(mode = 'branch', options) {
21
+ const runtimeReady = useOpenCodeRuntimeReady();
22
+ // Subscribe to the active sandbox so the key recomputes the instant the
23
+ // runtime switches — session A's diff must never paint under session B.
24
+ const serverId = useCurrentRuntime((s) => s.sandboxId) ?? undefined;
25
+ return useQuery({
26
+ queryKey: opencodeKeys.vcsDiff(mode, serverId),
27
+ queryFn: async () => {
28
+ const client = getClient();
29
+ const result = await client.vcs.diff({ mode });
30
+ const data = unwrap(result);
31
+ return Array.isArray(data) ? data : [];
32
+ },
33
+ enabled: runtimeReady && options?.enabled !== false,
34
+ // Agent edits arrive as SSE events that invalidate `vcsDiffAll()`, so the
35
+ // panel does not depend on a poll; this only bounds refetch churn from
36
+ // remounts while a turn is running.
37
+ staleTime: 30_000,
38
+ gcTime: 5 * 60_000,
39
+ refetchOnWindowFocus: false,
40
+ });
41
+ }
42
+ //# sourceMappingURL=vcs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vcs.js","sourceRoot":"","sources":["../../../src/react/use-opencode-sessions/vcs.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAgBlC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAoB,QAAQ,EAC5B,OAA+B;IAE/B,MAAM,YAAY,GAAG,uBAAuB,EAAE,CAAC;IAC/C,wEAAwE;IACxE,wEAAwE;IACxE,MAAM,QAAQ,GAAG,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,SAAS,CAAC;IACpE,OAAO,QAAQ,CAAgB;QAC7B,QAAQ,EAAE,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;QAC9C,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;YAC3B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;YAC/C,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;YAC5B,OAAO,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,CAAC;QACD,OAAO,EAAE,YAAY,IAAI,OAAO,EAAE,OAAO,KAAK,KAAK;QACnD,0EAA0E;QAC1E,uEAAuE;QACvE,oCAAoC;QACpC,SAAS,EAAE,MAAM;QACjB,MAAM,EAAE,CAAC,GAAG,MAAM;QAClB,oBAAoB,EAAE,KAAK;KAC5B,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Does THIS component own the polling cadence for `scope`?
3
+ *
4
+ * TanStack schedules `refetchInterval` per OBSERVER, so N components mounting
5
+ * one query polled it N times over. Give the interval to the owner and `false`
6
+ * to everyone else: they all read the same cache entry, so an answer still
7
+ * reaches every one of them — only the scheduling is exclusive. See
8
+ * `core/session/poll-owner.ts` for the rules and the measurements.
9
+ *
10
+ * `enabled` is not a convenience. An observer that is not going to poll must
11
+ * not hold the cadence, or the session stops being polled at all.
12
+ */
13
+ export declare function usePollOwner(scope: string, enabled?: boolean): boolean;
14
+ //# sourceMappingURL=use-poll-owner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-poll-owner.d.ts","sourceRoot":"","sources":["../../src/react/use-poll-owner.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,UAAO,GAAG,OAAO,CAmBnE"}
@@ -0,0 +1,32 @@
1
+ 'use client';
2
+ import { useEffect, useId, useSyncExternalStore } from 'react';
3
+ import { claimPoller, isPollOwner, releasePoller, subscribePollOwner, } from '../core/session/poll-owner.js';
4
+ /**
5
+ * Does THIS component own the polling cadence for `scope`?
6
+ *
7
+ * TanStack schedules `refetchInterval` per OBSERVER, so N components mounting
8
+ * one query polled it N times over. Give the interval to the owner and `false`
9
+ * to everyone else: they all read the same cache entry, so an answer still
10
+ * reaches every one of them — only the scheduling is exclusive. See
11
+ * `core/session/poll-owner.ts` for the rules and the measurements.
12
+ *
13
+ * `enabled` is not a convenience. An observer that is not going to poll must
14
+ * not hold the cadence, or the session stops being polled at all.
15
+ */
16
+ export function usePollOwner(scope, enabled = true) {
17
+ // Stable for the life of this component instance, and unique across
18
+ // instances — which is exactly the identity a claim needs.
19
+ const id = useId();
20
+ const active = enabled && !!scope;
21
+ useEffect(() => {
22
+ if (!active)
23
+ return;
24
+ claimPoller(scope, id);
25
+ return () => releasePoller(scope, id);
26
+ }, [active, scope, id]);
27
+ return useSyncExternalStore((onChange) => (active ? subscribePollOwner(scope, onChange) : () => { }), () => active && isPollOwner(scope, id),
28
+ // On the server nothing polls, and rendering "not the owner" everywhere is
29
+ // the honest answer: no timer exists to own.
30
+ () => false);
31
+ }
32
+ //# sourceMappingURL=use-poll-owner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-poll-owner.js","sourceRoot":"","sources":["../../src/react/use-poll-owner.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAE/D,OAAO,EACL,WAAW,EACX,WAAW,EACX,aAAa,EACb,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa,EAAE,OAAO,GAAG,IAAI;IACxD,oEAAoE;IACpE,2DAA2D;IAC3D,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;IACnB,MAAM,MAAM,GAAG,OAAO,IAAI,CAAC,CAAC,KAAK,CAAC;IAElC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACvB,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACxC,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;IAExB,OAAO,oBAAoB,CACzB,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,EACvE,GAAG,EAAE,CAAC,MAAM,IAAI,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC;IACtC,2EAA2E;IAC3E,6CAA6C;IAC7C,GAAG,EAAE,CAAC,KAAK,CACZ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { type ProjectDetail } from '../core/rest/projects-client/index.js';
2
+ /**
3
+ * Pure predicate: the project's effective `llm_gateway` flag from a
4
+ * `getProjectDetail` response. `experimental` is the full effective flag map
5
+ * (explicit project choice over platform default, AND-gated on operator
6
+ * availability) — the same field `useOpenCodeProviders` forks provider
7
+ * loading on, so every gateway-gated query in this package answers from ONE
8
+ * source and can never disagree with the provider mode.
9
+ */
10
+ export declare function projectDetailLlmGatewayEnabled(detail: ProjectDetail | undefined): boolean;
11
+ /**
12
+ * The project's `llm_gateway` flag, for gating gateway-only queries
13
+ * (`/model-defaults`, `/model-picker`, gateway routing policy — all of which
14
+ * answer `404 llm_gateway_disabled` when the flag is off).
15
+ *
16
+ * `known` is false until the detail read settles: a gateway-only query must
17
+ * hold (not fire-and-404) while the answer is loading, and a caller that
18
+ * renders alternate native UI should wait for `known` before committing.
19
+ *
20
+ * Shares `qk.project.detail(id)` with every other detail reader, so this adds
21
+ * no request on pages that already load the project shell.
22
+ */
23
+ export declare function useProjectLlmGatewayEnabled(projectId: string | null | undefined): {
24
+ enabled: boolean;
25
+ known: boolean;
26
+ };
27
+ //# sourceMappingURL=use-project-llm-gateway.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-project-llm-gateway.d.ts","sourceRoot":"","sources":["../../src/react/use-project-llm-gateway.ts"],"names":[],"mappings":"AAIA,OAAO,EAAoB,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAIpF;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,GAAG,OAAO,CAEzF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG;IACjF,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;CAChB,CAWA"}
@@ -0,0 +1,41 @@
1
+ 'use client';
2
+ import { useQuery } from '@tanstack/react-query';
3
+ import { getProjectDetail } from '../core/rest/projects-client/index.js';
4
+ import { contract } from './query-contracts.js';
5
+ import { qk } from './query-keys.js';
6
+ /**
7
+ * Pure predicate: the project's effective `llm_gateway` flag from a
8
+ * `getProjectDetail` response. `experimental` is the full effective flag map
9
+ * (explicit project choice over platform default, AND-gated on operator
10
+ * availability) — the same field `useOpenCodeProviders` forks provider
11
+ * loading on, so every gateway-gated query in this package answers from ONE
12
+ * source and can never disagree with the provider mode.
13
+ */
14
+ export function projectDetailLlmGatewayEnabled(detail) {
15
+ return detail?.project?.experimental?.llm_gateway === true;
16
+ }
17
+ /**
18
+ * The project's `llm_gateway` flag, for gating gateway-only queries
19
+ * (`/model-defaults`, `/model-picker`, gateway routing policy — all of which
20
+ * answer `404 llm_gateway_disabled` when the flag is off).
21
+ *
22
+ * `known` is false until the detail read settles: a gateway-only query must
23
+ * hold (not fire-and-404) while the answer is loading, and a caller that
24
+ * renders alternate native UI should wait for `known` before committing.
25
+ *
26
+ * Shares `qk.project.detail(id)` with every other detail reader, so this adds
27
+ * no request on pages that already load the project shell.
28
+ */
29
+ export function useProjectLlmGatewayEnabled(projectId) {
30
+ const detailQuery = useQuery({
31
+ queryKey: qk.project.detail(projectId ?? ''),
32
+ queryFn: () => getProjectDetail(projectId),
33
+ enabled: !!projectId,
34
+ ...contract('config'),
35
+ });
36
+ return {
37
+ enabled: !!projectId && projectDetailLlmGatewayEnabled(detailQuery.data),
38
+ known: !projectId || detailQuery.isSuccess,
39
+ };
40
+ }
41
+ //# sourceMappingURL=use-project-llm-gateway.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-project-llm-gateway.js","sourceRoot":"","sources":["../../src/react/use-project-llm-gateway.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAsB,MAAM,8BAA8B,CAAC;AACpF,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAiC;IAC9E,OAAO,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,KAAK,IAAI,CAAC;AAC7D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,2BAA2B,CAAC,SAAoC;IAI9E,MAAM,WAAW,GAAG,QAAQ,CAAC;QAC3B,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,IAAI,EAAE,CAAC;QAC5C,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,SAAmB,CAAC;QACpD,OAAO,EAAE,CAAC,CAAC,SAAS;QACpB,GAAG,QAAQ,CAAC,QAAQ,CAAC;KACtB,CAAC,CAAC;IACH,OAAO;QACL,OAAO,EAAE,CAAC,CAAC,SAAS,IAAI,8BAA8B,CAAC,WAAW,CAAC,IAAI,CAAC;QACxE,KAAK,EAAE,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS;KAC3C,CAAC;AACJ,CAAC"}
@@ -1,3 +1,4 @@
1
+ import type { ProjectLlmCatalogResponse } from '../core/rest/projects-client/index.js';
1
2
  import { type FlatModel } from './model-flatten.js';
2
3
  /**
3
4
  * Server-side model list for a project — the model parallel to
@@ -6,5 +7,13 @@ import { type FlatModel } from './model-flatten.js';
6
7
  * with correct provider/model ids. Works before any sandbox runtime exists and
7
8
  * avoids transferring or scanning the complete runtime models.dev catalog.
8
9
  */
10
+ /**
11
+ * The raw `/model-picker` response for a project — the API's live catalog
12
+ * record per wire model (`reasoning_options`, `temperature`, `limit`, …), for
13
+ * a capability-gated control that needs more than the flattened list carries.
14
+ * Same query key + fetcher as `useProjectModels`, so both read one cache
15
+ * entry and one invalidation reaches both.
16
+ */
17
+ export declare function useProjectModelPickerCatalog(projectId: string | null | undefined): ProjectLlmCatalogResponse | undefined;
9
18
  export declare function useProjectModels(projectId: string | null | undefined): FlatModel[];
10
19
  //# sourceMappingURL=use-project-models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-project-models.d.ts","sourceRoot":"","sources":["../../src/react/use-project-models.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAKhE;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,EAAE,CAalF"}
1
+ {"version":3,"file":"use-project-models.d.ts","sourceRoot":"","sources":["../../src/react/use-project-models.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,KAAK,SAAS,EAAiB,MAAM,iBAAiB,CAAC;AAMhE;;;;;;GAMG;AACH;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACnC,yBAAyB,GAAG,SAAS,CAUvC;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,EAAE,CAiBlF"}
@@ -6,6 +6,7 @@ import { flattenModels } from './model-flatten.js';
6
6
  import { projectLlmCatalogToProviderList } from './provider-selection.js';
7
7
  import { contract } from './query-contracts.js';
8
8
  import { qk } from './query-keys.js';
9
+ import { useProjectLlmGatewayEnabled } from './use-project-llm-gateway.js';
9
10
  /**
10
11
  * Server-side model list for a project — the model parallel to
11
12
  * `useVisibleAgents({ projectId })`. Reads the compact, connection-aware picker
@@ -13,7 +14,29 @@ import { qk } from './query-keys.js';
13
14
  * with correct provider/model ids. Works before any sandbox runtime exists and
14
15
  * avoids transferring or scanning the complete runtime models.dev catalog.
15
16
  */
17
+ /**
18
+ * The raw `/model-picker` response for a project — the API's live catalog
19
+ * record per wire model (`reasoning_options`, `temperature`, `limit`, …), for
20
+ * a capability-gated control that needs more than the flattened list carries.
21
+ * Same query key + fetcher as `useProjectModels`, so both read one cache
22
+ * entry and one invalidation reaches both.
23
+ */
24
+ export function useProjectModelPickerCatalog(projectId) {
25
+ const gateway = useProjectLlmGatewayEnabled(projectId);
26
+ const { data } = useQuery({
27
+ queryKey: qk.project.modelPicker(projectId ?? ''),
28
+ queryFn: () => getProjectModelPicker(projectId),
29
+ enabled: !!projectId && gateway.enabled,
30
+ ...contract('config'),
31
+ retry: false,
32
+ });
33
+ return data;
34
+ }
16
35
  export function useProjectModels(projectId) {
36
+ // `/model-picker` is a gateway route: with the project's llm_gateway flag
37
+ // off it answers 404 llm_gateway_disabled — never fetch. Native projects
38
+ // read models from the session runtime (`useOpenCodeProviders`).
39
+ const gateway = useProjectLlmGatewayEnabled(projectId);
17
40
  const { data } = useQuery({
18
41
  // Shared with `useModelEnablement` (same fetcher) and the routing-policy
19
42
  // save's invalidation (`gateway-routing.tsx`) — all three must key on the
@@ -21,7 +44,7 @@ export function useProjectModels(projectId) {
21
44
  // fails to reach this reader (see that member's doc comment).
22
45
  queryKey: qk.project.modelPicker(projectId ?? ''),
23
46
  queryFn: () => getProjectModelPicker(projectId),
24
- enabled: !!projectId,
47
+ enabled: !!projectId && gateway.enabled,
25
48
  ...contract('config'),
26
49
  retry: false,
27
50
  });
@@ -1 +1 @@
1
- {"version":3,"file":"use-project-models.js","sourceRoot":"","sources":["../../src/react/use-project-models.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAkB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,+BAA+B,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,EAAE,EAAE,MAAM,cAAc,CAAC;AAElC;;;;;;GAMG;AACH,MAAM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vD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;QACxB,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,IAAI,EAAE,CAAC;QACjD,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,SAAmB,CAAC;QACzD,OAAO,EAAE,CAAC,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO;QACvC,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACrB,KAAK,EAAE,KAAK;KACb,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,SAAoC;IACnE,0EAA0E;IAC1E,yEAAyE;IACzE,iEAAiE;IACjE,MAAM,OAAO,GAAG,2BAA2B,CAAC,SAAS,CAAC,CAAC;IACvD,MAAM,EAAE,IAAI,EAAE,GAAG,QAAQ,CAAC;QACxB,yEAAyE;QACzE,0EAA0E;QAC1E,qEAAqE;QACrE,8DAA8D;QAC9D,QAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,IAAI,EAAE,CAAC;QACjD,OAAO,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,SAAmB,CAAC;QACzD,OAAO,EAAE,CAAC,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO;QACvC,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACrB,KAAK,EAAE,KAAK;KACb,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,+BAA+B,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;AACnG,CAAC"}
@@ -72,6 +72,17 @@ export declare function shouldCountProbeFailure(input: {
72
72
  lastRuntimeEvidenceAt: number | null;
73
73
  nowMs: number;
74
74
  }): boolean;
75
+ /**
76
+ * The one genuine runtime error a health body can carry.
77
+ *
78
+ * A cold boot answers `{status:'starting', reason:'schema not ready'}` (503) —
79
+ * `reason`/`message`/`status` are routine PROGRESS, not failures. Treating them
80
+ * as `store.runtimeError` painted a terminal "OpenCode runtime is not ready"
81
+ * card over a session that was simply booting (RC-1). Only `boot_error` — set
82
+ * by the daemon when a boot actually failed — is an error worth surfacing;
83
+ * everything else is null.
84
+ */
85
+ export declare function runtimeErrorFromHealth(health: SessionHealthResponse | null): string | null;
75
86
  /** Statuses whose HTTP response itself signals "nothing is home" — no threshold needed. */
76
87
  export declare function isImmediateOfflineStatus(status: number): boolean;
77
88
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"use-runtime-reconnect.d.ts","sourceRoot":"","sources":["../../src/react/use-runtime-reconnect.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,QAAQ,EACb,KAAK,qBAAqB,EAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAQL,KAAK,uBAAuB,EAC7B,MAAM,4CAA4C,CAAC;AAGpD;;;;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;;;;;;;;GAQG;AACH,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,qBAAqB,EAAE,MAAM,GAAG,IAAI,EACpC,GAAG,EAAE,MAAM,GACV,OAAO,CAGT;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,GAAG,EAAE,QAAQ,GAAG,IAAI,CAAC;IACrB,qBAAqB,EAAE,MAAM,GA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 @@ export function shouldCountProbeFailure(input) {
87
87
  return false;
88
88
  return true;
89
89
  }
90
+ /**
91
+ * The one genuine runtime error a health body can carry.
92
+ *
93
+ * A cold boot answers `{status:'starting', reason:'schema not ready'}` (503) —
94
+ * `reason`/`message`/`status` are routine PROGRESS, not failures. Treating them
95
+ * as `store.runtimeError` painted a terminal "OpenCode runtime is not ready"
96
+ * card over a session that was simply booting (RC-1). Only `boot_error` — set
97
+ * by the daemon when a boot actually failed — is an error worth surfacing;
98
+ * everything else is null.
99
+ */
100
+ export function runtimeErrorFromHealth(health) {
101
+ return health?.boot_error ?? null;
102
+ }
90
103
  /** Statuses whose HTTP response itself signals "nothing is home" — no threshold needed. */
91
104
  export function isImmediateOfflineStatus(status) {
92
105
  return status === 502 || status === 503 || status === 504;
@@ -251,8 +264,23 @@ export function useRuntimeReconnect() {
251
264
  }
252
265
  case 'booting': {
253
266
  resetSandboxFail();
254
- setSandboxStatus('connected');
255
- setOpenCodeHealth(false, outcome.health?.version, outcome.health?.boot_error ?? outcome.health?.message ?? outcome.health?.reason ?? null);
267
+ // A 503 the proxy attributes to `control_plane` was answered from
268
+ // the session row without dialling the box: the sandbox is PARKED
269
+ // (stopped/queued), not "OpenCode booting behind a live proxy". It
270
+ // resumes only on the next SEND, so it must not be reported as
271
+ // `connected`, and its stall clock must stay off (RC-3) — otherwise
272
+ // the idle session escalates to "taking longer than usual" forever.
273
+ const parked = result.hop === 'control_plane';
274
+ if (parked) {
275
+ setOpenCodeHealth(false, outcome.health?.version, null, { parked: true });
276
+ }
277
+ else {
278
+ setSandboxStatus('connected');
279
+ // Only a real `boot_error` is an error; the routine boot `reason`
280
+ // ("schema not ready") is progress and must not paint a terminal
281
+ // card (RC-1). See `runtimeErrorFromHealth`.
282
+ setOpenCodeHealth(false, outcome.health?.version, runtimeErrorFromHealth(outcome.health));
283
+ }
256
284
  break;
257
285
  }
258
286
  case 'failure': {
@@ -264,7 +292,10 @@ export function useRuntimeReconnect() {
264
292
  case 'healthy': {
265
293
  resetSandboxFail();
266
294
  setSandboxStatus('connected');
267
- setOpenCodeHealth(isRuntimeReady(outcome.health), outcome.health?.version, outcome.health?.boot_error ?? outcome.health?.message ?? outcome.health?.reason ?? null);
295
+ // Same rule as the booting branch: a `200` that is not yet ready
296
+ // still carries only routine progress in `reason`/`message`; only a
297
+ // real `boot_error` is an error (RC-1).
298
+ setOpenCodeHealth(isRuntimeReady(outcome.health), outcome.health?.version, runtimeErrorFromHealth(outcome.health));
268
299
  break;
269
300
  }
270
301
  }
@@ -1 +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;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EACL,gBAAgB,EAChB,cAAc,GAGf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,yBAAyB,GAE1B,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAEhE;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAEtC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC;AAE1C,0CAA0C;AAC1C,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,mBAAmB;AACzD,+EAA+E;AAC/E,+EAA+E;AAC/E,gFAAgF;AAChF,8EAA8E;AAC9E,6EAA6E;AAC7E,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC;AAChC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC,CAAC,gCAAgC;AAEvE,MAAM,CA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AAS,EAAE,YAAY,EAAE,GAAG,yBAAyB,CAAC,QAAQ,EAAE,CAAC;wBACzE,MAAM,UAAU,GAAG,oBAAoB,CAAC,SAAS,EAAE,YAAY,EAAE,gBAAgB,CAAC,CAAC;wBACnF,IAAI,UAAU;4BAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;oBAC/C,CAAC;gBACH,CAAC;gBAED,gEAAgE;gBAChE,oEAAoE;gBACpE,mEAAmE;gBACnE,sEAAsE;gBACtE,8CAA8C;gBAC9C,IAAI,KAAK,EAAE,CAAC;oBACV,oBAAoB,EAAE,CAAC;oBACvB,YAAY,EAAE,CAAC;gBACjB,CAAC;YACH,CAAC;QACH,CAAC;QAED,SAAS,YAAY;YACnB,IAAI,CAAC,KAAK;gBAAE,OAAO;YACnB,IAAI,QAAQ,CAAC,OAAO;gBAAE,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACrD,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,CAAC,gBAAgB,CAAC,CAAC,CAAC;AACzB,CAAC"}
@@ -23,8 +23,19 @@ export declare const SESSION_PROMPTS_POLL_MS = 1000;
23
23
  /** The floor for an EMPTY list. Slow enough to be free, fast enough that a
24
24
  * prompt handed back by the server appears while the user is still looking. */
25
25
  export declare const SESSION_PROMPTS_IDLE_POLL_MS = 15000;
26
- /** The cadence for a list of `count` prompts. Pure, so the floor is testable. */
27
- export declare function sessionPromptsPollMs(count: number, pollMs?: number): number;
26
+ /**
27
+ * The cadence for a list of `count` prompts. Pure, so the floor is testable.
28
+ *
29
+ * `believedPending` is what this TAB thinks is in flight — the row
30
+ * `notePromptAccepted` recorded when `POST .../prompts` returned, before any
31
+ * list read could see it. It counts toward the cadence because the belief is an
32
+ * observation with a life (`INBOX_OBSERVATION_MAX_MS`) and only a list read
33
+ * refreshes it: a first read that landed before the row existed answered zero,
34
+ * locked the cadence to the 15s idle floor, and let a 10s belief die under a
35
+ * prompt that was still queued. The list length alone cannot close that hole,
36
+ * because at that instant the list is honestly empty.
37
+ */
38
+ export declare function sessionPromptsPollMs(count: number, pollMs?: number, believedPending?: number): number;
28
39
  /**
29
40
  * Feed one reading of the list into the working projection.
30
41
  *
@@ -35,7 +46,22 @@ export declare function sessionPromptsPollMs(count: number, pollMs?: number): nu
35
46
  * — swapping Stop back to Send while the user's prompt was still queued. The
36
47
  * stamp is the instant the read was ISSUED, for the same reason `/turn`'s is.
37
48
  */
38
- export declare function noteInboxObservation(sessionId: string, prompts: readonly SessionPrompt[], atMs: number): void;
49
+ export declare function noteInboxObservation(sessionId: string, prompts: readonly SessionPrompt[], atMs: number, serverAtMs?: number): void;
50
+ /**
51
+ * Apply one server inbox snapshot to both projections, with one freshness rule.
52
+ *
53
+ * A direct read and the session stream can settle out of order. Updating the
54
+ * working projection through `noteInboxObservation` already rejected an older
55
+ * answer, but updating the React Query cache did not. That split let an old
56
+ * empty control frame hide a prompt that a newer POST/read had confirmed.
57
+ *
58
+ * `atMs` is this tab's clock (age); `serverAtMs` is the server's `observed_at`
59
+ * (ordering). Snapshots that both carry a server stamp rank on the server clock
60
+ * alone — `inboxObservationSupersedes` — so a read issued before a POST can
61
+ * never erase the row the POST confirmed, and a client clock ±10 minutes off
62
+ * changes nothing.
63
+ */
64
+ export declare function applyInboxObservation(sessionId: string, cached: readonly SessionPrompt[] | undefined, prompts: readonly SessionPrompt[], atMs: number, serverAtMs?: number): SessionPrompt[];
39
65
  export declare const OPTIMISTIC_PROMPT_PREFIX = "optimistic:";
40
66
  /** Is this row the tab's own echo, not yet confirmed by the server? */
41
67
  export declare function isOptimisticSessionPrompt(prompt: Pick<SessionPrompt, 'prompt_id'>): boolean;
@@ -57,6 +83,30 @@ export declare function removeOptimisticPrompt(prompts: readonly SessionPrompt[]
57
83
  * its submission yet (the POST is still in flight).
58
84
  */
59
85
  export declare function reconcileOptimisticPrompts(cached: readonly SessionPrompt[] | undefined, server: readonly SessionPrompt[]): SessionPrompt[];
86
+ /**
87
+ * One read of a session's inbox — and the refusal that keeps a project-scoped
88
+ * URL from ever being built for a session that has no project.
89
+ *
90
+ * Not every session has one. A sub-session (the "Agent · general: …" panel
91
+ * `SubSessionModal` opens over the transcript) is a local OpenCode child:
92
+ * `SessionChat` renders it with a `sessionId` and nothing else — no project id,
93
+ * no project session id — and there is no server-side inbox to read. Both ids
94
+ * are then genuinely `undefined`, and `listSessionPrompts` interpolates them
95
+ * into its path as the literal text: `GET
96
+ * /projects/undefined/sessions/undefined/prompts` → 400 `Invalid session id`,
97
+ * which the host's `onError` sink turns into a red toast beside a sub-agent
98
+ * that is streaming perfectly.
99
+ *
100
+ * The hook's `enabled` flag does not stop it on its own. `enabled` governs
101
+ * react-query's SCHEDULING; `QueryObserver.refetch()` goes straight to
102
+ * `query.fetch()` with no `enabled` check, and `session-chat.tsx` refetches the
103
+ * inbox on every new user bubble — exactly what a streaming sub-agent produces.
104
+ * So the refusal belongs here, on the read itself.
105
+ *
106
+ * `cached` is this tab's current rows: with no project there is nothing to
107
+ * reconcile against, and the optimistic rows already on screen stay on screen.
108
+ */
109
+ export declare function readSessionPromptsInbox(projectId: string | undefined, sessionId: string | undefined, cached: readonly SessionPrompt[] | undefined): Promise<SessionPrompt[]>;
60
110
  export interface UseSessionPromptsResult {
61
111
  prompts: SessionPrompt[];
62
112
  isLoading: boolean;
@@ -1 +1 @@
1
- {"version":3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