@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
@@ -0,0 +1,51 @@
1
+ import { type WakeEscalationLimits, type WakeEscalationState } from '../core/session/wake-escalation.js';
2
+ export interface UseWakeEscalationInput {
3
+ /** Switch the ladder off entirely (no user, gated, not this session's view). */
4
+ enabled?: boolean;
5
+ /** A wake is applicable: this session's runtime is being brought up. */
6
+ waking: boolean;
7
+ /**
8
+ * The RUNTIME answered — daemon health, never the session row. See the
9
+ * module comment on `core/session/wake-escalation.ts` for why this is a
10
+ * separate input from `waking`.
11
+ */
12
+ runtimeReachable: boolean;
13
+ /** Everything observable about the wake, from `wakeProgressFingerprint`. */
14
+ progress: string;
15
+ /** The server declared the wake failed (the old terminal-card state). */
16
+ serverGaveUp: boolean;
17
+ /** Re-issue `/start`. Cheap, and it heals a row that recovered on its own. */
18
+ onRetryStart: () => void;
19
+ /** `POST /restart` — the thing the human always clicks. */
20
+ onRestart: () => void;
21
+ limits?: WakeEscalationLimits;
22
+ }
23
+ export interface WakeEscalationView {
24
+ status: WakeEscalationState['status'];
25
+ attempts: WakeEscalationState['attempts'];
26
+ /** 1 for the original wake, 2 for the first ladder action, and so on. */
27
+ attemptNumber: number;
28
+ /** Honest status line while escalating, or null. */
29
+ note: string | null;
30
+ /** The ladder is spent; the host may now render a terminal card. */
31
+ exhausted: boolean;
32
+ /** What was tried, for that card. Null until exhausted. */
33
+ summary: string | null;
34
+ /**
35
+ * How long the wake has shown no observable change. THE progress-aware
36
+ * budget: a host must render against this, never against time since the wake
37
+ * began.
38
+ */
39
+ msSinceProgress: number;
40
+ }
41
+ /**
42
+ * Drive the wake escalation ladder (`core/session/wake-escalation.ts`) from a
43
+ * session view, and dispatch its actions through the two callbacks the host
44
+ * already owns.
45
+ *
46
+ * All the policy is in the pure machine; this is the `setInterval` + effect
47
+ * glue, kept deliberately thin because the repo has no harness to render-test a
48
+ * hook directly (same reasoning as `useRuntimeReconnect`).
49
+ */
50
+ export declare function useWakeEscalation(input: UseWakeEscalationInput): WakeEscalationView;
51
+ //# sourceMappingURL=use-wake-escalation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-wake-escalation.d.ts","sourceRoot":"","sources":["../../src/react/use-wake-escalation.ts"],"names":[],"mappings":"AAGA,OAAO,EAKL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,sBAAsB;IACrC,gFAAgF;IAChF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,MAAM,EAAE,OAAO,CAAC;IAChB;;;;OAIG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAC1B,4EAA4E;IAC5E,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,YAAY,EAAE,OAAO,CAAC;IACtB,8EAA8E;IAC9E,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACtC,QAAQ,EAAE,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC1C,yEAAyE;IACzE,aAAa,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,oEAAoE;IACpE,SAAS,EAAE,OAAO,CAAC;IACnB,2DAA2D;IAC3D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;;OAIG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAKD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,kBAAkB,CA6DnF"}
@@ -0,0 +1,62 @@
1
+ 'use client';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { advanceWakeEscalation, initialWakeEscalationState, wakeEscalationAttemptSummary, wakeEscalationNote, } from '../core/session/wake-escalation.js';
4
+ /** Re-evaluate this often, because silence produces no input change of its own. */
5
+ const WAKE_TICK_MS = 1_000;
6
+ /**
7
+ * Drive the wake escalation ladder (`core/session/wake-escalation.ts`) from a
8
+ * session view, and dispatch its actions through the two callbacks the host
9
+ * already owns.
10
+ *
11
+ * All the policy is in the pure machine; this is the `setInterval` + effect
12
+ * glue, kept deliberately thin because the repo has no harness to render-test a
13
+ * hook directly (same reasoning as `useRuntimeReconnect`).
14
+ */
15
+ export function useWakeEscalation(input) {
16
+ const { enabled = true, waking, runtimeReachable, progress, serverGaveUp, onRetryStart, onRestart, limits, } = input;
17
+ const [state, setState] = useState(initialWakeEscalationState);
18
+ const stateRef = useRef(state);
19
+ const [tick, setTick] = useState(0);
20
+ // Callbacks through a ref: a host that rebuilds them every render must not
21
+ // re-run the decision effect, which would re-read the clock and could dispatch
22
+ // twice for one transition. Written in an effect declared BEFORE the decision
23
+ // effect (React runs them in order), never during render.
24
+ const actionsRef = useRef({ onRetryStart, onRestart });
25
+ const limitsRef = useRef(limits);
26
+ useEffect(() => {
27
+ actionsRef.current = { onRetryStart, onRestart };
28
+ limitsRef.current = limits;
29
+ });
30
+ const active = enabled && waking && !runtimeReachable;
31
+ useEffect(() => {
32
+ if (!active)
33
+ return;
34
+ const id = setInterval(() => setTick((value) => value + 1), WAKE_TICK_MS);
35
+ return () => clearInterval(id);
36
+ }, [active]);
37
+ useEffect(() => {
38
+ const next = advanceWakeEscalation(stateRef.current, {
39
+ nowMs: Date.now(),
40
+ waking: enabled && waking,
41
+ runtimeReachable,
42
+ progress,
43
+ serverGaveUp,
44
+ }, limitsRef.current);
45
+ stateRef.current = next;
46
+ setState(next);
47
+ if (next.dispatch === 'retry-start')
48
+ actionsRef.current.onRetryStart();
49
+ else if (next.dispatch === 'restart')
50
+ actionsRef.current.onRestart();
51
+ }, [enabled, waking, runtimeReachable, progress, serverGaveUp, tick]);
52
+ return {
53
+ status: state.status,
54
+ attempts: state.attempts,
55
+ attemptNumber: state.attempts.length + 1,
56
+ note: wakeEscalationNote(state),
57
+ exhausted: state.status === 'exhausted',
58
+ summary: wakeEscalationAttemptSummary(state),
59
+ msSinceProgress: state.msSinceProgress,
60
+ };
61
+ }
62
+ //# sourceMappingURL=use-wake-escalation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-wake-escalation.js","sourceRoot":"","sources":["../../src/react/use-wake-escalation.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,SAAS,EAAE,M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— one typed client for the Kortix agent platform. Unifies project/session lifecycle and live agent streaming behind a single ergonomic Session handle, so web, mobile, and white-label apps never touch the raw HTTP API or OpenCode semantics.",
5
5
  "type": "module",
6
6
  "license": "Elastic-2.0",
@@ -20,8 +20,8 @@
20
20
  ],
21
21
  "sideEffects": false,
22
22
  "dependencies": {
23
- "@kortix/llm-catalog": "0.13.4",
24
- "@opencode-ai/sdk": "1.17.11",
23
+ "@kortix/llm-catalog": "0.13.7",
24
+ "@opencode-ai/sdk": "1.18.23",
25
25
  "zustand": "^5.0.3"
26
26
  },
27
27
  "peerDependencies": {
@@ -165,7 +165,7 @@
165
165
  ],
166
166
  "scripts": {
167
167
  "typecheck": "tsc --noEmit && tsc --noEmit -p examples/tsconfig.json",
168
- "test": "bun test --isolate src",
168
+ "test": "find src -name '*.test.ts' -print0 | sort -z | xargs -0 -n1 -P4 bun test --isolate",
169
169
  "build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths",
170
170
  "build:bundles": "pnpm run build && tsup",
171
171
  "prepublishOnly": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json --resolve-full-paths && tsup",
@@ -175,8 +175,10 @@
175
175
  "@tanstack/react-query": "^5.75.2",
176
176
  "@types/react": "^19.2.0",
177
177
  "@types/react-dom": "^19.2.3",
178
+ "@types/react-test-renderer": "^19.1.0",
178
179
  "react": "^19.2.0",
179
180
  "react-dom": "^19.2.0",
181
+ "react-test-renderer": "^19.2.0",
180
182
  "tsc-alias": "^1.8.17",
181
183
  "tsup": "^8.5.1",
182
184
  "typescript": "^5.4.0"
@@ -1,79 +0,0 @@
1
- /**
2
- * Local transcript cache — the reason a session can paint before its sandbox
3
- * is awake.
4
- *
5
- * Reading a transcript used to be gated on booting a VM: the messages live on
6
- * the opencode runtime *inside* the session's sandbox, reachable only through
7
- * `/p/{externalId}/…`, so opening a hibernated session meant waiting out the
8
- * whole `/start` wake before a single word appeared. The transcript is already
9
- * settled history; it does not need a running machine to be shown.
10
- *
11
- * So: mirror the tail into IndexedDB as it arrives, and hydrate straight back
12
- * out of it on open. The live runtime still reconciles behind it — this only
13
- * changes WHEN the user sees what is already theirs, never what is true.
14
- */
15
- import type { Message, Part } from '@opencode-ai/sdk/v2/client';
16
- export interface CachedTranscript {
17
- messages: Message[];
18
- parts: Record<string, Part[]>;
19
- }
20
- interface TranscriptStoreSlice {
21
- messages: Record<string, Message[]>;
22
- parts: Record<string, Part[]>;
23
- }
24
- /**
25
- * Pull one session's messages, plus only the parts belonging to them, out of
26
- * the (globally part-keyed) sync store. Returns null when there is nothing
27
- * worth persisting — an absent session and an empty one are the same to a
28
- * cache whose entire job is having something to show.
29
- */
30
- export declare function selectSessionTranscript(state: TranscriptStoreSlice, sessionId: string,
31
- /**
32
- * Messages to leave OUT of the entry — this tab's optimistic stubs. The
33
- * cache mirrors the runtime's transcript, and a stub is not in it: persisted,
34
- * it came back after a reload as a plain message the runtime had never
35
- * heard of, beside the real one, for ever.
36
- */
37
- exclude?: (messageId: string) => boolean): CachedTranscript | null;
38
- /** Reshape a cached transcript into the `{ info, parts }` rows `hydrate` takes. */
39
- export declare function toHydrateEntries(transcript: CachedTranscript): Array<{
40
- info: Message;
41
- parts: Part[];
42
- }>;
43
- /**
44
- * The cache is a first-paint accelerator, never a source of truth. Once the
45
- * store holds anything for this session — from SSE, an optimistic send, or a
46
- * completed reconcile — it outranks whatever is on disk, so hydrating again
47
- * could only ever move the transcript backwards.
48
- *
49
- * With exactly one exception, and it is not hypothetical: a session whose agent
50
- * is still running when the store evicts it. Eviction deletes the key; the
51
- * agent's next SSE frame puts it straight back, holding only what streamed
52
- * after the eviction. The store "has" the session, but what it has is strictly
53
- * less than the disk copy, so standing down leaves the user with a fragment and
54
- * a `loadOlder` for their own history. `hydrate` merges rather than replaces —
55
- * it never drops a message the store has that the incoming set lacks, and for
56
- * text parts it keeps whichever side has more — so painting the disk copy under
57
- * a live fragment restores the history without touching the live tail.
58
- */
59
- export declare function shouldHydrateFromCache(input: {
60
- storeHasSession: boolean;
61
- cachedMessageCount: number;
62
- /**
63
- * The store's entry for this session is a post-eviction fragment. From
64
- * `useSyncStore.wasTranscriptEvicted`, which also reports false the moment a
65
- * send goes in flight — repainting under one would retire the message the
66
- * user just typed.
67
- */
68
- storeSessionWasEvicted?: boolean;
69
- }): boolean;
70
- /**
71
- * Read this session's cached transcript. Resolves to null when there is no
72
- * usable entry — the caller then simply waits for the runtime, exactly as
73
- * before this cache existed.
74
- */
75
- export declare function readCachedTranscript(sessionId: string, kortixSessionScope?: string): Promise<CachedTranscript | null>;
76
- /** Mirror the session's current tail to disk. Debounced inside the IDB layer. */
77
- export declare function writeCachedTranscript(state: TranscriptStoreSlice, sessionId: string, kortixSessionScope?: string, exclude?: (messageId: string) => boolean): Promise<void>;
78
- export {};
79
- //# sourceMappingURL=session-transcript-cache.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-transcript-cache.d.ts","sourceRoot":"","sources":["../../../src/browser/session-sync/session-transcript-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,4BAA4B,CAAC;AAIhE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;CAC/B;AAED,UAAU,oBAAoB;IAC5B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;IACpC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,oBAAoB,EAC3B,SAAS,EAAE,MAAM;AACjB;;;;;GAKG;AACH,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,GACvC,gBAAgB,GAAG,IAAI,CAWzB;AACD,mFAAmF;AACnF,wBAAgB,gBAAgB,CAC9B,UAAU,EAAE,gBAAgB,GAC3B,KAAK,CAAC;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,IAAI,EAAE,CAAA;CAAE,CAAC,CAIzC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAC5C,eAAe,EAAE,OAAO,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;;OAKG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC,GAAG,OAAO,CAIV;AAED;;;;GAIG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,EACjB,kBAAkB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAIlC;AAED,iFAAiF;AACjF,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,oBAAoB,EAC3B,SAAS,EAAE,MAAM,EACjB,kBAAkB,CAAC,EAAE,MAAM,EAC3B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,GACvC,OAAO,CAAC,IAAI,CAAC,CAIf"}
@@ -1,91 +0,0 @@
1
- /**
2
- * Local transcript cache — the reason a session can paint before its sandbox
3
- * is awake.
4
- *
5
- * Reading a transcript used to be gated on booting a VM: the messages live on
6
- * the opencode runtime *inside* the session's sandbox, reachable only through
7
- * `/p/{externalId}/…`, so opening a hibernated session meant waiting out the
8
- * whole `/start` wake before a single word appeared. The transcript is already
9
- * settled history; it does not need a running machine to be shown.
10
- *
11
- * So: mirror the tail into IndexedDB as it arrives, and hydrate straight back
12
- * out of it on open. The live runtime still reconciles behind it — this only
13
- * changes WHEN the user sees what is already theirs, never what is true.
14
- */
15
- import { loadSessionFromIDB, saveSessionToIDB } from '../cache/idb-sync-cache.js';
16
- /**
17
- * Pull one session's messages, plus only the parts belonging to them, out of
18
- * the (globally part-keyed) sync store. Returns null when there is nothing
19
- * worth persisting — an absent session and an empty one are the same to a
20
- * cache whose entire job is having something to show.
21
- */
22
- export function selectSessionTranscript(state, sessionId,
23
- /**
24
- * Messages to leave OUT of the entry — this tab's optimistic stubs. The
25
- * cache mirrors the runtime's transcript, and a stub is not in it: persisted,
26
- * it came back after a reload as a plain message the runtime had never
27
- * heard of, beside the real one, for ever.
28
- */
29
- exclude) {
30
- const all = state.messages[sessionId];
31
- if (!all || all.length === 0)
32
- return null;
33
- const messages = exclude ? all.filter((message) => !message?.id || !exclude(message.id)) : all;
34
- if (messages.length === 0)
35
- return null;
36
- const parts = {};
37
- for (const message of messages) {
38
- if (!message?.id)
39
- continue;
40
- parts[message.id] = state.parts[message.id] ?? [];
41
- }
42
- return { messages, parts };
43
- }
44
- /** Reshape a cached transcript into the `{ info, parts }` rows `hydrate` takes. */
45
- export function toHydrateEntries(transcript) {
46
- return (transcript.messages ?? [])
47
- .filter((message) => !!message?.id)
48
- .map((message) => ({ info: message, parts: transcript.parts?.[message.id] ?? [] }));
49
- }
50
- /**
51
- * The cache is a first-paint accelerator, never a source of truth. Once the
52
- * store holds anything for this session — from SSE, an optimistic send, or a
53
- * completed reconcile — it outranks whatever is on disk, so hydrating again
54
- * could only ever move the transcript backwards.
55
- *
56
- * With exactly one exception, and it is not hypothetical: a session whose agent
57
- * is still running when the store evicts it. Eviction deletes the key; the
58
- * agent's next SSE frame puts it straight back, holding only what streamed
59
- * after the eviction. The store "has" the session, but what it has is strictly
60
- * less than the disk copy, so standing down leaves the user with a fragment and
61
- * a `loadOlder` for their own history. `hydrate` merges rather than replaces —
62
- * it never drops a message the store has that the incoming set lacks, and for
63
- * text parts it keeps whichever side has more — so painting the disk copy under
64
- * a live fragment restores the history without touching the live tail.
65
- */
66
- export function shouldHydrateFromCache(input) {
67
- if (input.cachedMessageCount <= 0)
68
- return false;
69
- if (!input.storeHasSession)
70
- return true;
71
- return input.storeSessionWasEvicted === true;
72
- }
73
- /**
74
- * Read this session's cached transcript. Resolves to null when there is no
75
- * usable entry — the caller then simply waits for the runtime, exactly as
76
- * before this cache existed.
77
- */
78
- export async function readCachedTranscript(sessionId, kortixSessionScope) {
79
- const cached = await loadSessionFromIDB(sessionId, kortixSessionScope);
80
- if (!cached || !Array.isArray(cached.messages) || cached.messages.length === 0)
81
- return null;
82
- return { messages: cached.messages, parts: cached.parts ?? {} };
83
- }
84
- /** Mirror the session's current tail to disk. Debounced inside the IDB layer. */
85
- export function writeCachedTranscript(state, sessionId, kortixSessionScope, exclude) {
86
- const transcript = selectSessionTranscript(state, sessionId, exclude);
87
- if (!transcript)
88
- return Promise.resolve();
89
- return saveSessionToIDB(sessionId, transcript.messages, transcript.parts, kortixSessionScope);
90
- }
91
- //# sourceMappingURL=session-transcript-cache.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-transcript-cache.js","sourceRoot":"","sources":["../../../src/browser/session-sync/session-transcript-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAY/E;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAA2B,EAC3B,SAAiB;AACjB;;;;;GAKG;AACH,OAAwC;IAExC,MAAM,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACtC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1C,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC/F,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,MAAM,KAAK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C,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,EAAE,EAAE,CAAC;AAClE,CAAC;AAED,iFAAiF;AACjF,MAAM,UAAU,qBAAqB,CACnC,KAA2B,EAC3B,SAAiB,EACjB,kBAA2B,EAC3B,OAAwC;IAExC,MAAM,UAAU,GAAG,uBAAuB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACtE,IAAI,CAAC,UAAU;QAAE,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1C,OAAO,gBAAgB,CAAC,SAAS,EAAE,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,KAAK,EAAE,kBAAkB,CAAC,CAAC;AAChG,CAAC"}
@@ -1,59 +0,0 @@
1
- export declare class PublicVoiceJoinError extends Error {
2
- readonly status: number;
3
- constructor(message: string, status: number);
4
- }
5
- export interface PublicVoiceJoinInfo {
6
- call_id: string;
7
- /** The LiveKit server's `ws(s)://` URL — never assume it shares an origin
8
- * with either the API or the frontend that served this page. */
9
- url: string;
10
- /** A freshly-minted, room-scoped LiveKit access token — not the join
11
- * link's own token. */
12
- token: string;
13
- }
14
- /** Resolves a short `voice_spawn` join-link token into a live LiveKit
15
- * session's server URL + a fresh access token. Throws `PublicVoiceJoinError`
16
- * (404 unknown, 410 expired/revoked) on anything but 200. */
17
- export declare function getPublicVoiceJoin(token: string): Promise<PublicVoiceJoinInfo>;
18
- /**
19
- * One line of a call's durable record (`kortix.voice_call_turns`).
20
- *
21
- * `role` + `speaker` together say who — and they must be read together,
22
- * because `agent` covers two different things:
23
- * - `user` — a human in the room. `speaker` is a display name if one is known.
24
- * - `agent` + `speaker === 'kortix'` — what the KORTIX agent put into the
25
- * call (`send_prompt`, a finished turn's result, an error).
26
- * - `agent` + anything else — what the voice itself actually said, labelled
27
- * with the bot's display name.
28
- * - `tool` — an MCP call the voice made; `speaker` is the tool name
29
- * (`ask_kortix`, `run_command`) and `text` is the call and its outcome.
30
- * Nobody spoke this line.
31
- */
32
- export interface PublicVoiceTranscriptTurn {
33
- /** Monotonic per-call sequence number — pass the page's last one back as `cursor`. */
34
- cursor: number;
35
- role: 'user' | 'agent' | 'tool' | (string & {});
36
- speaker: string | null;
37
- text: string;
38
- /** ISO-8601. */
39
- at: string;
40
- }
41
- export interface PublicVoiceTranscriptPage {
42
- call_id: string;
43
- /** The cursor to poll with next — unchanged when nothing new arrived. */
44
- cursor: number;
45
- turns: PublicVoiceTranscriptTurn[];
46
- }
47
- /**
48
- * Reads the durable transcript of the ONE call a join-link token was minted
49
- * for — every spoken turn on both sides, everything the Kortix agent said into
50
- * the call, and every tool call the voice made.
51
- *
52
- * This is not the same stream as LiveKit's client-side transcription, which
53
- * only ever carries the two voices. Authorized by the join link alone (same
54
- * capability, same revocation as `getPublicVoiceJoin`), so it works on the
55
- * logged-out `/voice/[token]` page. Throws `PublicVoiceJoinError` (404
56
- * unknown, 410 expired or the call ended).
57
- */
58
- export declare function getPublicVoiceTranscript(token: string, cursor?: number): Promise<PublicVoiceTranscriptPage>;
59
- //# sourceMappingURL=public-voice-join.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"public-voice-join.d.ts","sourceRoot":"","sources":["../../../../src/core/rest/projects-client/public-voice-join.ts"],"names":[],"mappings":"AAeA,qBAAa,oBAAqB,SAAQ,KAAK;aAG3B,MAAM,EAAE,MAAM;gBAD9B,OAAO,EAAE,MAAM,EACC,MAAM,EAAE,MAAM;CAKjC;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB;qEACiE;IACjE,GAAG,EAAE,MAAM,CAAC;IACZ;4BACwB;IACxB,KAAK,EAAE,MAAM,CAAC;CACf;AAyBD;;8DAE8D;AAC9D,wBAAsB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAEpF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,yBAAyB;IACxC,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IAChD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,yBAAyB,EAAE,CAAC;CACpC;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,wBAAwB,CAC5C,KAAK,EAAE,MAAM,EACb,MAAM,SAAI,GACT,OAAO,CAAC,yBAAyB,CAAC,CAGpC"}
@@ -1,64 +0,0 @@
1
- // Anonymous resolve step for a `voice_spawn` join link — `/v1/public/voice-join/:token`
2
- // (apps/api/src/channels/voice/public-join-routes.ts). Backs the logged-out
3
- // `(public)/voice/[token]` page: the URL now carries a short, ungessable id
4
- // rather than the raw LiveKit access token, so the page exchanges it here for
5
- // a freshly-minted token + the LiveKit server URL.
6
- //
7
- // Deliberately NOT built on `backendApi` (platform/api-client.ts) for the same
8
- // reason `public-session-shares.ts` isn't: that client's authenticated fetch
9
- // path synthesizes a failure for a visitor with no token WITHOUT ever making
10
- // the network call. This route is genuinely public — no Authorization header,
11
- // no `configureKortix()` call required — mirroring `getPublicShareUrlForToken`'s
12
- // and `getPublicSessionShare`'s stance.
13
- import { getBackendUrl } from '../../session/server-store/url-helpers.js';
14
- export class PublicVoiceJoinError extends Error {
15
- status;
16
- constructor(message, status) {
17
- super(message);
18
- this.status = status;
19
- this.name = 'PublicVoiceJoinError';
20
- }
21
- }
22
- function publicVoiceJoinUrl(token) {
23
- return `${getBackendUrl()}/public/voice-join/${encodeURIComponent(token)}`;
24
- }
25
- async function getPublicVoiceJson(url) {
26
- const res = await fetch(url, { method: 'GET', headers: { Accept: 'application/json' } });
27
- const text = await res.text().catch(() => '');
28
- let body = null;
29
- try {
30
- body = text ? JSON.parse(text) : null;
31
- }
32
- catch {
33
- // Non-JSON body — fall through to the generic error message below.
34
- }
35
- if (!res.ok) {
36
- const message = (body && typeof body === 'object' && 'error' in body && typeof body.error === 'string'
37
- ? body.error
38
- : null) || res.statusText || `HTTP ${res.status}`;
39
- throw new PublicVoiceJoinError(message, res.status);
40
- }
41
- return body;
42
- }
43
- /** Resolves a short `voice_spawn` join-link token into a live LiveKit
44
- * session's server URL + a fresh access token. Throws `PublicVoiceJoinError`
45
- * (404 unknown, 410 expired/revoked) on anything but 200. */
46
- export async function getPublicVoiceJoin(token) {
47
- return getPublicVoiceJson(publicVoiceJoinUrl(token));
48
- }
49
- /**
50
- * Reads the durable transcript of the ONE call a join-link token was minted
51
- * for — every spoken turn on both sides, everything the Kortix agent said into
52
- * the call, and every tool call the voice made.
53
- *
54
- * This is not the same stream as LiveKit's client-side transcription, which
55
- * only ever carries the two voices. Authorized by the join link alone (same
56
- * capability, same revocation as `getPublicVoiceJoin`), so it works on the
57
- * logged-out `/voice/[token]` page. Throws `PublicVoiceJoinError` (404
58
- * unknown, 410 expired or the call ended).
59
- */
60
- export async function getPublicVoiceTranscript(token, cursor = 0) {
61
- const url = `${publicVoiceJoinUrl(token)}/transcript?cursor=${encodeURIComponent(String(cursor))}`;
62
- return getPublicVoiceJson(url);
63
- }
64
- //# sourceMappingURL=public-voice-join.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"public-voice-join.js","sourceRoot":"","sources":["../../../../src/core/rest/projects-client/public-voice-join.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,4EAA4E;AAC5E,4EAA4E;AAC5E,8EAA8E;AAC9E,mDAAmD;AACnD,EAAE;AACF,+EAA+E;AAC/E,6EAA6E;AAC7E,6EAA6E;AAC7E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,MAAM,EAAE,CAAC;QACtD,MAAM,IAAI,oBAAoB,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,IAAS,CAAC;AACnB,CAAC;AAED;;8DAE8D;AAC9D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,KAAa;IACpD,OAAO,kBAAkB,CAAsB,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC;AAC5E,CAAC;AAiCD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,KAAa,EACb,MAAM,GAAG,CAAC;IAEV,MAAM,GAAG,GAAG,GAAG,kBAAkB,CAAC,KAAK,CAAC,sBAAsB,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;IACnG,OAAO,kBAAkB,CAA4B,GAAG,CAAC,CAAC;AAC5D,CAAC"}
@@ -1,5 +0,0 @@
1
- export interface TranscriptionResponse {
2
- text: string;
3
- }
4
- export declare function transcribeAudio(audioFile: File): Promise<TranscriptionResponse>;
5
- //# sourceMappingURL=transcription.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transcription.d.ts","sourceRoot":"","sources":["../../../../src/core/rest/projects-client/transcription.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,eAAe,CAAC,SAAS,EAAE,IAAI,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAerF"}
@@ -1,14 +0,0 @@
1
- // Speech-to-text transcription — POSTs an audio file as multipart form-data.
2
- import { backendApi } from '../../http/api-client.js';
3
- export async function transcribeAudio(audioFile) {
4
- const formData = new FormData();
5
- formData.append('audio_file', audioFile);
6
- const response = await backendApi.upload('/transcription', formData, {
7
- showErrors: true,
8
- });
9
- if (response.error) {
10
- throw new Error(`Error transcribing audio: ${response.error.message} (${response.error.status})`);
11
- }
12
- return response.data;
13
- }
14
- //# sourceMappingURL=transcription.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"transcription.js","sourceRoot":"","sources":["../../../../src/core/rest/projects-client/transcription.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAE7E,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAMnD,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,SAAe;IACnD,MAAM,QAAQ,GAAG,IAAI,QAAQ,EAAE,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;IAEzC,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,MAAM,CAAwB,gBAAgB,EAAE,QAAQ,EAAE;QAC1F,UAAU,EAAE,IAAI;KACjB,CAAC,CAAC;IAEH,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CACb,6BAA6B,QAAQ,CAAC,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,CACjF,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC,IAAK,CAAC;AACxB,CAAC"}