@kortix/sdk 0.13.46 → 0.13.48

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 (549) hide show
  1. package/README.md +67 -44
  2. package/dist/browser/session-sync/server-transcript-mirror.d.ts +1 -1
  3. package/dist/browser/session-sync/server-transcript-mirror.d.ts.map +1 -1
  4. package/dist/browser/session-sync/session-sync-registry.d.ts +1 -1
  5. package/dist/browser/session-sync/session-sync-registry.d.ts.map +1 -1
  6. package/dist/browser/session-sync/visibility.d.ts +0 -12
  7. package/dist/browser/session-sync/visibility.d.ts.map +1 -1
  8. package/dist/browser/session-sync/visibility.js +23 -2
  9. package/dist/browser/session-sync/visibility.js.map +1 -1
  10. package/dist/browser/stores/opencode-pending-store.d.ts +1 -1
  11. package/dist/browser/stores/opencode-pending-store.d.ts.map +1 -1
  12. package/dist/browser/stores/sandbox-connection-store.d.ts +8 -0
  13. package/dist/browser/stores/sandbox-connection-store.d.ts.map +1 -1
  14. package/dist/browser/stores/sandbox-connection-store.js +14 -0
  15. package/dist/browser/stores/sandbox-connection-store.js.map +1 -1
  16. package/dist/browser/stores/sync-store/reconcile-parts.d.ts +1 -1
  17. package/dist/browser/stores/sync-store/reconcile-parts.d.ts.map +1 -1
  18. package/dist/browser/stores/sync-store/types.d.ts +1 -1
  19. package/dist/browser/stores/sync-store/types.d.ts.map +1 -1
  20. package/dist/browser/stores/sync-store.d.ts +1 -1
  21. package/dist/browser/stores/sync-store.d.ts.map +1 -1
  22. package/dist/browser/stores/sync-store.js +79 -60
  23. package/dist/browser/stores/sync-store.js.map +1 -1
  24. package/dist/core/agents/composer-agents.d.ts +8 -6
  25. package/dist/core/agents/composer-agents.d.ts.map +1 -1
  26. package/dist/core/agents/composer-agents.js +3 -3
  27. package/dist/core/agents/composer-agents.js.map +1 -1
  28. package/dist/core/client/binding-types.d.ts +2 -0
  29. package/dist/core/client/binding-types.d.ts.map +1 -0
  30. package/dist/core/client/binding-types.js +2 -0
  31. package/dist/core/client/binding-types.js.map +1 -0
  32. package/dist/core/client/facade-accounts.d.ts +57 -0
  33. package/dist/core/client/facade-accounts.d.ts.map +1 -0
  34. package/dist/core/client/facade-accounts.js +59 -0
  35. package/dist/core/client/facade-accounts.js.map +1 -0
  36. package/dist/core/client/facade-catalog.d.ts +58 -0
  37. package/dist/core/client/facade-catalog.d.ts.map +1 -0
  38. package/dist/core/client/facade-catalog.js +70 -0
  39. package/dist/core/client/facade-catalog.js.map +1 -0
  40. package/dist/core/client/facade-commerce.d.ts +45 -0
  41. package/dist/core/client/facade-commerce.d.ts.map +1 -0
  42. package/dist/core/client/facade-commerce.js +53 -0
  43. package/dist/core/client/facade-commerce.js.map +1 -0
  44. package/dist/core/client/facade-iam.d.ts +54 -0
  45. package/dist/core/client/facade-iam.d.ts.map +1 -0
  46. package/dist/core/client/facade-iam.js +62 -0
  47. package/dist/core/client/facade-iam.js.map +1 -0
  48. package/dist/core/client/facade-identity.d.ts +104 -0
  49. package/dist/core/client/facade-identity.d.ts.map +1 -0
  50. package/dist/core/client/facade-identity.js +36 -0
  51. package/dist/core/client/facade-identity.js.map +1 -0
  52. package/dist/core/client/facade-preview.d.ts +4 -0
  53. package/dist/core/client/facade-preview.d.ts.map +1 -0
  54. package/dist/core/client/facade-preview.js +61 -0
  55. package/dist/core/client/facade-preview.js.map +1 -0
  56. package/dist/core/client/kortix.d.ts +662 -985
  57. package/dist/core/client/kortix.d.ts.map +1 -1
  58. package/dist/core/client/kortix.js +31 -1162
  59. package/dist/core/client/kortix.js.map +1 -1
  60. package/dist/core/client/project-access-resources.d.ts +38 -0
  61. package/dist/core/client/project-access-resources.d.ts.map +1 -0
  62. package/dist/core/client/project-access-resources.js +37 -0
  63. package/dist/core/client/project-access-resources.js.map +1 -0
  64. package/dist/core/client/project-access-security.d.ts +117 -0
  65. package/dist/core/client/project-access-security.d.ts.map +1 -0
  66. package/dist/core/client/project-access-security.js +41 -0
  67. package/dist/core/client/project-access-security.js.map +1 -0
  68. package/dist/core/client/project-connections.d.ts +34 -0
  69. package/dist/core/client/project-connections.d.ts.map +1 -0
  70. package/dist/core/client/project-connections.js +20 -0
  71. package/dist/core/client/project-connections.js.map +1 -0
  72. package/dist/core/client/project-connectors.d.ts +21 -0
  73. package/dist/core/client/project-connectors.d.ts.map +1 -0
  74. package/dist/core/client/project-connectors.js +20 -0
  75. package/dist/core/client/project-connectors.js.map +1 -0
  76. package/dist/core/client/project-core.d.ts +72 -0
  77. package/dist/core/client/project-core.d.ts.map +1 -0
  78. package/dist/core/client/project-core.js +24 -0
  79. package/dist/core/client/project-core.js.map +1 -0
  80. package/dist/core/client/project-membership.d.ts +64 -0
  81. package/dist/core/client/project-membership.d.ts.map +1 -0
  82. package/dist/core/client/project-membership.js +26 -0
  83. package/dist/core/client/project-membership.js.map +1 -0
  84. package/dist/core/client/project-operations-admin.d.ts +112 -0
  85. package/dist/core/client/project-operations-admin.d.ts.map +1 -0
  86. package/dist/core/client/project-operations-admin.js +24 -0
  87. package/dist/core/client/project-operations-admin.js.map +1 -0
  88. package/dist/core/client/project-operations-review.d.ts +44 -0
  89. package/dist/core/client/project-operations-review.d.ts.map +1 -0
  90. package/dist/core/client/project-operations-review.js +34 -0
  91. package/dist/core/client/project-operations-review.js.map +1 -0
  92. package/dist/core/client/project-operations-workspace.d.ts +91 -0
  93. package/dist/core/client/project-operations-workspace.d.ts.map +1 -0
  94. package/dist/core/client/project-operations-workspace.js +36 -0
  95. package/dist/core/client/project-operations-workspace.js.map +1 -0
  96. package/dist/core/client/project-operations.d.ts +225 -0
  97. package/dist/core/client/project-operations.d.ts.map +1 -0
  98. package/dist/core/client/project-operations.js +47 -0
  99. package/dist/core/client/project-operations.js.map +1 -0
  100. package/dist/core/client/project-platform-resources.d.ts +36 -0
  101. package/dist/core/client/project-platform-resources.d.ts.map +1 -0
  102. package/dist/core/client/project-platform-resources.js +29 -0
  103. package/dist/core/client/project-platform-resources.js.map +1 -0
  104. package/dist/core/client/project-platform-security.d.ts +83 -0
  105. package/dist/core/client/project-platform-security.d.ts.map +1 -0
  106. package/dist/core/client/project-platform-security.js +39 -0
  107. package/dist/core/client/project-platform-security.js.map +1 -0
  108. package/dist/core/client/project-platform-settings.d.ts +58 -0
  109. package/dist/core/client/project-platform-settings.d.ts.map +1 -0
  110. package/dist/core/client/project-platform-settings.js +28 -0
  111. package/dist/core/client/project-platform-settings.js.map +1 -0
  112. package/dist/core/client/session-actions-resources.d.ts +18 -0
  113. package/dist/core/client/session-actions-resources.d.ts.map +1 -0
  114. package/dist/core/client/session-actions-resources.js +31 -0
  115. package/dist/core/client/session-actions-resources.js.map +1 -0
  116. package/dist/core/client/session-actions-security.d.ts +31 -0
  117. package/dist/core/client/session-actions-security.d.ts.map +1 -0
  118. package/dist/core/client/session-actions-security.js +51 -0
  119. package/dist/core/client/session-actions-security.js.map +1 -0
  120. package/dist/core/client/session-actions-services.d.ts +64 -0
  121. package/dist/core/client/session-actions-services.d.ts.map +1 -0
  122. package/dist/core/client/session-actions-services.js +59 -0
  123. package/dist/core/client/session-actions-services.js.map +1 -0
  124. package/dist/core/client/session-context.d.ts +22 -0
  125. package/dist/core/client/session-context.d.ts.map +1 -0
  126. package/dist/core/client/session-context.js +2 -0
  127. package/dist/core/client/session-context.js.map +1 -0
  128. package/dist/core/client/session-defaults.d.ts +9 -0
  129. package/dist/core/client/session-defaults.d.ts.map +1 -0
  130. package/dist/core/client/session-defaults.js +45 -0
  131. package/dist/core/client/session-defaults.js.map +1 -0
  132. package/dist/core/client/session-files.d.ts +26 -0
  133. package/dist/core/client/session-files.d.ts.map +1 -0
  134. package/dist/core/client/session-files.js +24 -0
  135. package/dist/core/client/session-files.js.map +1 -0
  136. package/dist/core/client/session-handle.d.ts +186 -0
  137. package/dist/core/client/session-handle.d.ts.map +1 -0
  138. package/dist/core/client/session-handle.js +68 -0
  139. package/dist/core/client/session-handle.js.map +1 -0
  140. package/dist/core/client/session-lifecycle-resources.d.ts +67 -0
  141. package/dist/core/client/session-lifecycle-resources.d.ts.map +1 -0
  142. package/dist/core/client/session-lifecycle-resources.js +56 -0
  143. package/dist/core/client/session-lifecycle-resources.js.map +1 -0
  144. package/dist/core/client/session-lifecycle-security.d.ts +65 -0
  145. package/dist/core/client/session-lifecycle-security.d.ts.map +1 -0
  146. package/dist/core/client/session-lifecycle-security.js +54 -0
  147. package/dist/core/client/session-lifecycle-security.js.map +1 -0
  148. package/dist/core/client/session-preview.d.ts +26 -0
  149. package/dist/core/client/session-preview.d.ts.map +1 -0
  150. package/dist/core/client/session-preview.js +31 -0
  151. package/dist/core/client/session-preview.js.map +1 -0
  152. package/dist/core/client/session-readiness.d.ts +11 -0
  153. package/dist/core/client/session-readiness.d.ts.map +1 -0
  154. package/dist/core/client/session-readiness.js +77 -0
  155. package/dist/core/client/session-readiness.js.map +1 -0
  156. package/dist/core/client/session-runtime.d.ts +35 -0
  157. package/dist/core/client/session-runtime.d.ts.map +1 -0
  158. package/dist/core/client/session-runtime.js +30 -0
  159. package/dist/core/client/session-runtime.js.map +1 -0
  160. package/dist/core/client/session-shared.d.ts +46 -0
  161. package/dist/core/client/session-shared.d.ts.map +1 -0
  162. package/dist/core/client/session-shared.js +48 -0
  163. package/dist/core/client/session-shared.js.map +1 -0
  164. package/dist/core/client/session-start.d.ts +3 -0
  165. package/dist/core/client/session-start.d.ts.map +1 -0
  166. package/dist/core/client/session-start.js +60 -0
  167. package/dist/core/client/session-start.js.map +1 -0
  168. package/dist/core/files/client.d.ts.map +1 -1
  169. package/dist/core/files/client.js +29 -3
  170. package/dist/core/files/client.js.map +1 -1
  171. package/dist/core/http/api-client.d.ts.map +1 -1
  172. package/dist/core/http/api-client.js +2 -419
  173. package/dist/core/http/api-client.js.map +1 -1
  174. package/dist/core/http/config.d.ts +15 -0
  175. package/dist/core/http/config.d.ts.map +1 -1
  176. package/dist/core/http/config.js.map +1 -1
  177. package/dist/core/http/request.d.ts +3 -0
  178. package/dist/core/http/request.d.ts.map +1 -0
  179. package/dist/core/http/request.js +215 -0
  180. package/dist/core/http/request.js.map +1 -0
  181. package/dist/core/http/response-error.d.ts +3 -0
  182. package/dist/core/http/response-error.d.ts.map +1 -0
  183. package/dist/core/http/response-error.js +113 -0
  184. package/dist/core/http/response-error.js.map +1 -0
  185. package/dist/core/http/runtime-errors.d.ts +23 -0
  186. package/dist/core/http/runtime-errors.d.ts.map +1 -1
  187. package/dist/core/http/runtime-errors.js +39 -1
  188. package/dist/core/http/runtime-errors.js.map +1 -1
  189. package/dist/core/http/transport.d.ts +13 -1
  190. package/dist/core/http/transport.d.ts.map +1 -1
  191. package/dist/core/http/transport.js +25 -4
  192. package/dist/core/http/transport.js.map +1 -1
  193. package/dist/core/models/composer-model.d.ts +1 -1
  194. package/dist/core/models/composer-model.d.ts.map +1 -1
  195. package/dist/core/models/model-flatten.d.ts +8 -1
  196. package/dist/core/models/model-flatten.d.ts.map +1 -1
  197. package/dist/core/models/model-flatten.js +2 -0
  198. package/dist/core/models/model-flatten.js.map +1 -1
  199. package/dist/core/models/model-key.d.ts +11 -0
  200. package/dist/core/models/model-key.d.ts.map +1 -1
  201. package/dist/core/models/model-key.js +20 -0
  202. package/dist/core/models/model-key.js.map +1 -1
  203. package/dist/core/models/provider-selection.d.ts +1 -1
  204. package/dist/core/models/provider-selection.d.ts.map +1 -1
  205. package/dist/core/rest/platform-client/host-boundary.d.ts +14 -19
  206. package/dist/core/rest/platform-client/host-boundary.d.ts.map +1 -1
  207. package/dist/core/rest/platform-client/host-boundary.js +7 -38
  208. package/dist/core/rest/platform-client/host-boundary.js.map +1 -1
  209. package/dist/core/rest/projects-client/admin-providers.d.ts +64 -3
  210. package/dist/core/rest/projects-client/admin-providers.d.ts.map +1 -1
  211. package/dist/core/rest/projects-client/admin-providers.js.map +1 -1
  212. package/dist/core/rest/projects-client/agent-config.d.ts +8 -0
  213. package/dist/core/rest/projects-client/agent-config.d.ts.map +1 -1
  214. package/dist/core/rest/projects-client/agent-config.js.map +1 -1
  215. package/dist/core/rest/projects-client/apps.d.ts +30 -0
  216. package/dist/core/rest/projects-client/apps.d.ts.map +1 -1
  217. package/dist/core/rest/projects-client/apps.js +10 -0
  218. package/dist/core/rest/projects-client/apps.js.map +1 -1
  219. package/dist/core/rest/projects-client/audit-filter.d.ts +6 -0
  220. package/dist/core/rest/projects-client/audit-filter.d.ts.map +1 -0
  221. package/dist/core/rest/projects-client/audit-filter.js +11 -0
  222. package/dist/core/rest/projects-client/audit-filter.js.map +1 -0
  223. package/dist/core/rest/projects-client/audit.d.ts +6 -18
  224. package/dist/core/rest/projects-client/audit.d.ts.map +1 -1
  225. package/dist/core/rest/projects-client/audit.js +30 -108
  226. package/dist/core/rest/projects-client/audit.js.map +1 -1
  227. package/dist/core/rest/projects-client/channels.d.ts +19 -0
  228. package/dist/core/rest/projects-client/channels.d.ts.map +1 -1
  229. package/dist/core/rest/projects-client/channels.js.map +1 -1
  230. package/dist/core/rest/projects-client/connectors.d.ts +4 -3
  231. package/dist/core/rest/projects-client/connectors.d.ts.map +1 -1
  232. package/dist/core/rest/projects-client/connectors.js.map +1 -1
  233. package/dist/core/rest/projects-client/iam-roles.d.ts +5 -0
  234. package/dist/core/rest/projects-client/iam-roles.d.ts.map +1 -1
  235. package/dist/core/rest/projects-client/iam-roles.js +9 -0
  236. package/dist/core/rest/projects-client/iam-roles.js.map +1 -1
  237. package/dist/core/rest/projects-client/projects.d.ts +11 -6
  238. package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
  239. package/dist/core/rest/projects-client/projects.js +0 -2
  240. package/dist/core/rest/projects-client/projects.js.map +1 -1
  241. package/dist/core/rest/projects-client/secrets.d.ts +61 -8
  242. package/dist/core/rest/projects-client/secrets.d.ts.map +1 -1
  243. package/dist/core/rest/projects-client/secrets.js +52 -0
  244. package/dist/core/rest/projects-client/secrets.js.map +1 -1
  245. package/dist/core/rest/projects-client/session-sandbox.d.ts +6 -0
  246. package/dist/core/rest/projects-client/session-sandbox.d.ts.map +1 -1
  247. package/dist/core/rest/projects-client/session-sandbox.js.map +1 -1
  248. package/dist/core/rest/projects-client/sessions.d.ts +49 -24
  249. package/dist/core/rest/projects-client/sessions.d.ts.map +1 -1
  250. package/dist/core/rest/projects-client/sessions.js +33 -4
  251. package/dist/core/rest/projects-client/sessions.js.map +1 -1
  252. package/dist/core/rest/projects-client/triggers.d.ts +12 -0
  253. package/dist/core/rest/projects-client/triggers.d.ts.map +1 -1
  254. package/dist/core/rest/projects-client/triggers.js.map +1 -1
  255. package/dist/core/runtime/client.d.ts +12 -11
  256. package/dist/core/runtime/client.d.ts.map +1 -1
  257. package/dist/core/runtime/client.js +36 -5
  258. package/dist/core/runtime/client.js.map +1 -1
  259. package/dist/core/runtime/runtime-rest-client.d.ts +462 -0
  260. package/dist/core/runtime/runtime-rest-client.d.ts.map +1 -0
  261. package/dist/core/runtime/runtime-rest-client.js +309 -0
  262. package/dist/core/runtime/runtime-rest-client.js.map +1 -0
  263. package/dist/core/runtime/runtime-types.d.ts +1174 -0
  264. package/dist/core/runtime/runtime-types.d.ts.map +1 -0
  265. package/dist/core/runtime/runtime-types.js +2 -0
  266. package/dist/core/runtime/runtime-types.js.map +1 -0
  267. package/dist/core/runtime/transcript-types.d.ts +564 -0
  268. package/dist/core/runtime/transcript-types.d.ts.map +1 -0
  269. package/dist/core/runtime/transcript-types.js +57 -0
  270. package/dist/core/runtime/transcript-types.js.map +1 -0
  271. package/dist/core/session/health.d.ts +2 -1
  272. package/dist/core/session/health.d.ts.map +1 -1
  273. package/dist/core/session/health.js.map +1 -1
  274. package/dist/core/session/host-signals.d.ts +16 -0
  275. package/dist/core/session/host-signals.d.ts.map +1 -0
  276. package/dist/core/session/host-signals.js +20 -0
  277. package/dist/core/session/host-signals.js.map +1 -0
  278. package/dist/core/session/index.d.ts +3 -0
  279. package/dist/core/session/index.d.ts.map +1 -1
  280. package/dist/core/session/index.js +2 -0
  281. package/dist/core/session/index.js.map +1 -1
  282. package/dist/core/session/open-bundle.d.ts +16 -0
  283. package/dist/core/session/open-bundle.d.ts.map +1 -1
  284. package/dist/core/session/open-bundle.js +31 -0
  285. package/dist/core/session/open-bundle.js.map +1 -1
  286. package/dist/core/session/runtime-sessions.d.ts +26 -0
  287. package/dist/core/session/runtime-sessions.d.ts.map +1 -0
  288. package/dist/core/session/runtime-sessions.js +39 -0
  289. package/dist/core/session/runtime-sessions.js.map +1 -0
  290. package/dist/core/session/runtime-verbs.d.ts +55 -0
  291. package/dist/core/session/runtime-verbs.d.ts.map +1 -0
  292. package/dist/core/session/runtime-verbs.js +124 -0
  293. package/dist/core/session/runtime-verbs.js.map +1 -0
  294. package/dist/core/session/wake-escalation.d.ts +1 -1
  295. package/dist/core/session/wake-escalation.js +1 -1
  296. package/dist/core/session/wire-message-id.d.ts +55 -12
  297. package/dist/core/session/wire-message-id.d.ts.map +1 -1
  298. package/dist/core/session/wire-message-id.js +62 -12
  299. package/dist/core/session/wire-message-id.js.map +1 -1
  300. package/dist/core/session/working-evidence.d.ts +15 -0
  301. package/dist/core/session/working-evidence.d.ts.map +1 -0
  302. package/dist/core/session/working-evidence.js +27 -0
  303. package/dist/core/session/working-evidence.js.map +1 -0
  304. package/dist/core/session/working-project.d.ts +3 -0
  305. package/dist/core/session/working-project.d.ts.map +1 -0
  306. package/dist/core/session/working-project.js +187 -0
  307. package/dist/core/session/working-project.js.map +1 -0
  308. package/dist/core/session/working-runtime.d.ts +33 -0
  309. package/dist/core/session/working-runtime.d.ts.map +1 -0
  310. package/dist/core/session/working-runtime.js +46 -0
  311. package/dist/core/session/working-runtime.js.map +1 -0
  312. package/dist/core/session/working-time.d.ts +2 -0
  313. package/dist/core/session/working-time.d.ts.map +1 -0
  314. package/dist/core/session/working-time.js +7 -0
  315. package/dist/core/session/working-time.js.map +1 -0
  316. package/dist/core/session/working.d.ts.map +1 -1
  317. package/dist/core/session/working.js +2 -316
  318. package/dist/core/session/working.js.map +1 -1
  319. package/dist/core/session-sync/session-sync-controller.d.ts +1 -1
  320. package/dist/core/session-sync/session-sync-controller.d.ts.map +1 -1
  321. package/dist/core/stream/event-stream.d.ts +25 -6
  322. package/dist/core/stream/event-stream.d.ts.map +1 -1
  323. package/dist/core/stream/event-stream.js +63 -9
  324. package/dist/core/stream/event-stream.js.map +1 -1
  325. package/dist/core/turns/classify.d.ts +31 -2
  326. package/dist/core/turns/classify.d.ts.map +1 -1
  327. package/dist/core/turns/classify.js +94 -0
  328. package/dist/core/turns/classify.js.map +1 -1
  329. package/dist/core/turns/index.d.ts +1 -0
  330. package/dist/core/turns/index.d.ts.map +1 -1
  331. package/dist/core/turns/index.js +1 -0
  332. package/dist/core/turns/index.js.map +1 -1
  333. package/dist/core/turns/parts.d.ts +6 -1
  334. package/dist/core/turns/parts.d.ts.map +1 -1
  335. package/dist/core/turns/parts.js +57 -49
  336. package/dist/core/turns/parts.js.map +1 -1
  337. package/dist/core/turns/segments/narration.d.ts.map +1 -1
  338. package/dist/core/turns/segments/narration.js +40 -130
  339. package/dist/core/turns/segments/narration.js.map +1 -1
  340. package/dist/core/turns/segments/turn-busy-visibility.d.ts +1 -1
  341. package/dist/core/turns/segments/turn-busy-visibility.js +1 -1
  342. package/dist/core/turns/segments/working-turn.js +1 -1
  343. package/dist/core/turns/segments/working-turn.js.map +1 -1
  344. package/dist/core/turns/tool-kind.d.ts +15 -0
  345. package/dist/core/turns/tool-kind.d.ts.map +1 -0
  346. package/dist/core/turns/tool-kind.js +115 -0
  347. package/dist/core/turns/tool-kind.js.map +1 -0
  348. package/dist/core/turns/tool-registry.d.ts +6 -7
  349. package/dist/core/turns/tool-registry.d.ts.map +1 -1
  350. package/dist/core/turns/tool-registry.js +78 -73
  351. package/dist/core/turns/tool-registry.js.map +1 -1
  352. package/dist/core/turns/tools/tool-meta.d.ts +1 -0
  353. package/dist/core/turns/tools/tool-meta.d.ts.map +1 -1
  354. package/dist/core/turns/tools/tool-meta.js +7 -6
  355. package/dist/core/turns/tools/tool-meta.js.map +1 -1
  356. package/dist/core/turns/view-model.d.ts.map +1 -1
  357. package/dist/core/turns/view-model.js +19 -12
  358. package/dist/core/turns/view-model.js.map +1 -1
  359. package/dist/index.d.ts +3 -3
  360. package/dist/index.d.ts.map +1 -1
  361. package/dist/index.js +1 -0
  362. package/dist/index.js.map +1 -1
  363. package/dist/kortix.esm.min.js +46 -45
  364. package/dist/kortix.global.js +46 -45
  365. package/dist/node/app-viewer.js +1 -1
  366. package/dist/node/app-viewer.js.map +1 -1
  367. package/dist/node/auth.js +1 -1
  368. package/dist/node/auth.js.map +1 -1
  369. package/dist/node/scoped-client.d.ts +20 -0
  370. package/dist/node/scoped-client.d.ts.map +1 -0
  371. package/dist/node/scoped-client.js +170 -0
  372. package/dist/node/scoped-client.js.map +1 -0
  373. package/dist/node/server.d.ts +2 -21
  374. package/dist/node/server.d.ts.map +1 -1
  375. package/dist/node/server.js +2 -170
  376. package/dist/node/server.js.map +1 -1
  377. package/dist/react/index.d.ts +4 -1
  378. package/dist/react/index.d.ts.map +1 -1
  379. package/dist/react/index.js +3 -0
  380. package/dist/react/index.js.map +1 -1
  381. package/dist/react/prefetch-session-open.d.ts +13 -0
  382. package/dist/react/prefetch-session-open.d.ts.map +1 -1
  383. package/dist/react/prefetch-session-open.js +22 -1
  384. package/dist/react/prefetch-session-open.js.map +1 -1
  385. package/dist/react/query-keys.d.ts +3 -2
  386. package/dist/react/query-keys.d.ts.map +1 -1
  387. package/dist/react/query-keys.js +4 -4
  388. package/dist/react/query-keys.js.map +1 -1
  389. package/dist/react/sign-in-with-kortix.d.ts +8 -8
  390. package/dist/react/use-admin-providers.d.ts +18 -0
  391. package/dist/react/use-admin-providers.d.ts.map +1 -0
  392. package/dist/react/use-admin-providers.js +36 -0
  393. package/dist/react/use-admin-providers.js.map +1 -0
  394. package/dist/react/use-feature-flag.d.ts +2 -2
  395. package/dist/react/use-feature-flag.d.ts.map +1 -1
  396. package/dist/react/use-feature-flag.js +3 -2
  397. package/dist/react/use-feature-flag.js.map +1 -1
  398. package/dist/react/use-kortix-master.d.ts +1 -1
  399. package/dist/react/use-opencode-config.d.ts +7 -1
  400. package/dist/react/use-opencode-config.d.ts.map +1 -1
  401. package/dist/react/use-opencode-config.js +9 -1
  402. package/dist/react/use-opencode-config.js.map +1 -1
  403. package/dist/react/use-opencode-events/diagnostics.d.ts +1 -1
  404. package/dist/react/use-opencode-events/diagnostics.d.ts.map +1 -1
  405. package/dist/react/use-opencode-events/handle-event.d.ts +4 -6
  406. package/dist/react/use-opencode-events/handle-event.d.ts.map +1 -1
  407. package/dist/react/use-opencode-events/handle-event.js +43 -594
  408. package/dist/react/use-opencode-events/handle-event.js.map +1 -1
  409. package/dist/react/use-opencode-events/handle-interaction-event.d.ts +4 -0
  410. package/dist/react/use-opencode-events/handle-interaction-event.d.ts.map +1 -0
  411. package/dist/react/use-opencode-events/handle-interaction-event.js +42 -0
  412. package/dist/react/use-opencode-events/handle-interaction-event.js.map +1 -0
  413. package/dist/react/use-opencode-events/handle-message-event.d.ts +4 -0
  414. package/dist/react/use-opencode-events/handle-message-event.d.ts.map +1 -0
  415. package/dist/react/use-opencode-events/handle-message-event.js +33 -0
  416. package/dist/react/use-opencode-events/handle-message-event.js.map +1 -0
  417. package/dist/react/use-opencode-events/handle-session-event.d.ts +5 -0
  418. package/dist/react/use-opencode-events/handle-session-event.d.ts.map +1 -0
  419. package/dist/react/use-opencode-events/handle-session-event.js +243 -0
  420. package/dist/react/use-opencode-events/handle-session-event.js.map +1 -0
  421. package/dist/react/use-opencode-events/handle-workspace-event.d.ts +4 -0
  422. package/dist/react/use-opencode-events/handle-workspace-event.d.ts.map +1 -0
  423. package/dist/react/use-opencode-events/handle-workspace-event.js +113 -0
  424. package/dist/react/use-opencode-events/handle-workspace-event.js.map +1 -0
  425. package/dist/react/use-opencode-events/handler-context.d.ts +29 -0
  426. package/dist/react/use-opencode-events/handler-context.d.ts.map +1 -0
  427. package/dist/react/use-opencode-events/handler-context.js +2 -0
  428. package/dist/react/use-opencode-events/handler-context.js.map +1 -0
  429. package/dist/react/use-opencode-events/hydrate-core.d.ts +23 -0
  430. package/dist/react/use-opencode-events/hydrate-core.d.ts.map +1 -0
  431. package/dist/react/use-opencode-events/hydrate-core.js +126 -0
  432. package/dist/react/use-opencode-events/hydrate-core.js.map +1 -0
  433. package/dist/react/use-opencode-events/index.d.ts +1 -0
  434. package/dist/react/use-opencode-events/index.d.ts.map +1 -1
  435. package/dist/react/use-opencode-events/index.js +40 -143
  436. package/dist/react/use-opencode-events/index.js.map +1 -1
  437. package/dist/react/use-opencode-events/runtime-stream-signals.d.ts +45 -0
  438. package/dist/react/use-opencode-events/runtime-stream-signals.d.ts.map +1 -0
  439. package/dist/react/use-opencode-events/runtime-stream-signals.js +32 -0
  440. package/dist/react/use-opencode-events/runtime-stream-signals.js.map +1 -0
  441. package/dist/react/use-opencode-events/stream-revival.d.ts +0 -21
  442. package/dist/react/use-opencode-events/stream-revival.d.ts.map +1 -1
  443. package/dist/react/use-opencode-events/stream-revival.js +33 -2
  444. package/dist/react/use-opencode-events/stream-revival.js.map +1 -1
  445. package/dist/react/use-opencode-events/use-event-stream-refs.d.ts +1 -1
  446. package/dist/react/use-opencode-events/use-event-stream-refs.d.ts.map +1 -1
  447. package/dist/react/use-opencode-local.d.ts +1 -1
  448. package/dist/react/use-opencode-local.d.ts.map +1 -1
  449. package/dist/react/use-opencode-sessions/agents.d.ts +1 -1
  450. package/dist/react/use-opencode-sessions/agents.d.ts.map +1 -1
  451. package/dist/react/use-opencode-sessions/commands.d.ts +4 -1
  452. package/dist/react/use-opencode-sessions/commands.d.ts.map +1 -1
  453. package/dist/react/use-opencode-sessions/commands.js +6 -1
  454. package/dist/react/use-opencode-sessions/commands.js.map +1 -1
  455. package/dist/react/use-opencode-sessions/files.d.ts.map +1 -1
  456. package/dist/react/use-opencode-sessions/files.js +8 -33
  457. package/dist/react/use-opencode-sessions/files.js.map +1 -1
  458. package/dist/react/use-opencode-sessions/keys.d.ts +12 -1
  459. package/dist/react/use-opencode-sessions/keys.d.ts.map +1 -1
  460. package/dist/react/use-opencode-sessions/keys.js +10 -0
  461. package/dist/react/use-opencode-sessions/keys.js.map +1 -1
  462. package/dist/react/use-opencode-sessions/mcp.d.ts +1 -1
  463. package/dist/react/use-opencode-sessions/mcp.d.ts.map +1 -1
  464. package/dist/react/use-opencode-sessions/messages.d.ts.map +1 -1
  465. package/dist/react/use-opencode-sessions/messages.js +8 -2
  466. package/dist/react/use-opencode-sessions/messages.js.map +1 -1
  467. package/dist/react/use-opencode-sessions/parts.d.ts +2 -2
  468. package/dist/react/use-opencode-sessions/parts.d.ts.map +1 -1
  469. package/dist/react/use-opencode-sessions/projects.d.ts +1 -1
  470. package/dist/react/use-opencode-sessions/projects.d.ts.map +1 -1
  471. package/dist/react/use-opencode-sessions/providers.d.ts +1 -1
  472. package/dist/react/use-opencode-sessions/providers.d.ts.map +1 -1
  473. package/dist/react/use-opencode-sessions/providers.js +12 -2
  474. package/dist/react/use-opencode-sessions/providers.js.map +1 -1
  475. package/dist/react/use-opencode-sessions/sessions.d.ts +8 -3
  476. package/dist/react/use-opencode-sessions/sessions.d.ts.map +1 -1
  477. package/dist/react/use-opencode-sessions/sessions.js +9 -2
  478. package/dist/react/use-opencode-sessions/sessions.js.map +1 -1
  479. package/dist/react/use-opencode-sessions/shared.d.ts.map +1 -1
  480. package/dist/react/use-opencode-sessions/shared.js +6 -1
  481. package/dist/react/use-opencode-sessions/shared.js.map +1 -1
  482. package/dist/react/use-opencode-sessions/sharing.d.ts +1 -1
  483. package/dist/react/use-opencode-sessions/sharing.d.ts.map +1 -1
  484. package/dist/react/use-opencode-sessions/vcs.d.ts +1 -1
  485. package/dist/react/use-opencode-sessions/vcs.d.ts.map +1 -1
  486. package/dist/react/use-project-apps.d.ts +6 -0
  487. package/dist/react/use-project-apps.d.ts.map +1 -1
  488. package/dist/react/use-project-gateway.d.ts +28 -0
  489. package/dist/react/use-project-gateway.d.ts.map +1 -0
  490. package/dist/react/use-project-gateway.js +120 -0
  491. package/dist/react/use-project-gateway.js.map +1 -0
  492. package/dist/react/use-project-secrets.d.ts +6 -6
  493. package/dist/react/use-project-sessions.d.ts +1 -1
  494. package/dist/react/use-project-sessions.d.ts.map +1 -1
  495. package/dist/react/use-project-sessions.js +2 -3
  496. package/dist/react/use-project-sessions.js.map +1 -1
  497. package/dist/react/use-session-messages.d.ts +4 -2
  498. package/dist/react/use-session-messages.d.ts.map +1 -1
  499. package/dist/react/use-session-messages.js +1 -1
  500. package/dist/react/use-session-messages.js.map +1 -1
  501. package/dist/react/use-session-participants.d.ts +10 -0
  502. package/dist/react/use-session-participants.d.ts.map +1 -0
  503. package/dist/react/use-session-participants.js +19 -0
  504. package/dist/react/use-session-participants.js.map +1 -0
  505. package/dist/react/use-session-prompts.d.ts +6 -0
  506. package/dist/react/use-session-prompts.d.ts.map +1 -1
  507. package/dist/react/use-session-prompts.js +17 -1
  508. package/dist/react/use-session-prompts.js.map +1 -1
  509. package/dist/react/use-session-sync.d.ts +4 -5
  510. package/dist/react/use-session-sync.d.ts.map +1 -1
  511. package/dist/react/use-session-sync.js +4 -1
  512. package/dist/react/use-session-sync.js.map +1 -1
  513. package/dist/react/use-session-transcript-history.d.ts.map +1 -1
  514. package/dist/react/use-session-transcript-history.js +14 -5
  515. package/dist/react/use-session-transcript-history.js.map +1 -1
  516. package/dist/react/use-session-working.d.ts +1 -1
  517. package/dist/react/use-session-working.d.ts.map +1 -1
  518. package/dist/react/use-session.d.ts +21 -9
  519. package/dist/react/use-session.d.ts.map +1 -1
  520. package/dist/react/use-session.js +64 -17
  521. package/dist/react/use-session.js.map +1 -1
  522. package/dist/react/use-teams-installations.d.ts +14 -0
  523. package/dist/react/use-teams-installations.d.ts.map +1 -1
  524. package/dist/react/use-teams-installations.js.map +1 -1
  525. package/dist/react/use-tunnel.d.ts +9 -0
  526. package/dist/react/use-tunnel.d.ts.map +1 -1
  527. package/dist/react/use-tunnel.js +9 -3
  528. package/dist/react/use-tunnel.js.map +1 -1
  529. package/dist/react/use-visible-agents.d.ts +1 -1
  530. package/dist/react/use-visible-agents.d.ts.map +1 -1
  531. package/dist/transcript.d.ts +1 -1
  532. package/dist/transcript.d.ts.map +1 -1
  533. package/dist/workspace-search/client.d.ts +20 -0
  534. package/dist/workspace-search/client.d.ts.map +1 -0
  535. package/dist/workspace-search/client.js +235 -0
  536. package/dist/workspace-search/client.js.map +1 -0
  537. package/dist/workspace-search/core.d.ts +2 -2
  538. package/dist/workspace-search/core.d.ts.map +1 -1
  539. package/dist/workspace-search/core.js +44 -4
  540. package/dist/workspace-search/core.js.map +1 -1
  541. package/dist/workspace-search/index.d.ts +3 -0
  542. package/dist/workspace-search/index.d.ts.map +1 -0
  543. package/dist/workspace-search/index.js +3 -0
  544. package/dist/workspace-search/index.js.map +1 -0
  545. package/package.json +7 -5
  546. package/dist/core/runtime/opencode-v2-event-aliases.d.ts +0 -184
  547. package/dist/core/runtime/opencode-v2-event-aliases.d.ts.map +0 -1
  548. package/dist/core/runtime/opencode-v2-event-aliases.js +0 -2
  549. package/dist/core/runtime/opencode-v2-event-aliases.js.map +0 -1
@@ -0,0 +1,33 @@
1
+ import type { SessionTurn } from '../rest/projects-client/sessions.js';
2
+ import type { WorkingServerInput, WorkingStreamInput } from './working.js';
3
+ /**
4
+ * Whether the runtime has already finished this turn.
5
+ *
6
+ * "Newer read wins" is the rule this replaces, and it is wrong here, because
7
+ * the two observers do not learn the same fact at the same time. The idle
8
+ * frame comes straight off the runtime over SSE. The ledger row is closed by
9
+ * a SEPARATE daemon relay (`POST .../turn-stream` `kind:"end"`) — so a `/turn`
10
+ * read ISSUED after the frame is still ABOUT a turn the frame already ended.
11
+ *
12
+ * MEASURED, local stack 2026-08-21, one ordinary composer turn: the idle
13
+ * frame reached the tab at 00:03:59.964, the refetch that frame itself
14
+ * triggers landed at 00:04:00.150 stamped 44ms later and still reported the
15
+ * turn `active`, and the ledger did not record `ended_at` until 00:04:15.132
16
+ * — the relay for that turn never arrived and a reconciliation sweep closed
17
+ * it 15.1s late. The composer's Stop button and the turn's shimmer came back
18
+ * 186ms after they left and stayed for fifteen seconds, with the finished
19
+ * reply already on screen. Even in the healthy case the relay lands ~200ms
20
+ * after the frame, which is still inside the window its own refetch lands in.
21
+ *
22
+ * `started_at` is what separates the two turns the rule has to tell apart: a
23
+ * turn that began BEFORE the frame is the turn that frame ended, and a turn
24
+ * that began after it is a NEW one the frame knows nothing about — a queued
25
+ * prompt draining, a trigger firing, a second device sending. That one keeps
26
+ * the ledger's full authority, with no delay and no window.
27
+ *
28
+ * A row with no start instant (a legacy `activeTurn`) cannot be ranked
29
+ * against the frame at all, and inventing an order there would hide a live
30
+ * turn. The ledger keeps it.
31
+ */
32
+ export declare function endedByRuntime(candidate: SessionTurn, idleFrame: WorkingStreamInput | null, server: WorkingServerInput | null): boolean;
33
+ //# sourceMappingURL=working-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"working-runtime.d.ts","sourceRoot":"","sources":["../../../src/core/session/working-runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAIxE;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,WAAW,EACtB,SAAS,EAAE,kBAAkB,GAAG,IAAI,EACpC,MAAM,EAAE,kBAAkB,GAAG,IAAI,GAChC,OAAO,CAcT"}
@@ -0,0 +1,46 @@
1
+ import { instant } from './working-time.js';
2
+ /**
3
+ * Whether the runtime has already finished this turn.
4
+ *
5
+ * "Newer read wins" is the rule this replaces, and it is wrong here, because
6
+ * the two observers do not learn the same fact at the same time. The idle
7
+ * frame comes straight off the runtime over SSE. The ledger row is closed by
8
+ * a SEPARATE daemon relay (`POST .../turn-stream` `kind:"end"`) — so a `/turn`
9
+ * read ISSUED after the frame is still ABOUT a turn the frame already ended.
10
+ *
11
+ * MEASURED, local stack 2026-08-21, one ordinary composer turn: the idle
12
+ * frame reached the tab at 00:03:59.964, the refetch that frame itself
13
+ * triggers landed at 00:04:00.150 stamped 44ms later and still reported the
14
+ * turn `active`, and the ledger did not record `ended_at` until 00:04:15.132
15
+ * — the relay for that turn never arrived and a reconciliation sweep closed
16
+ * it 15.1s late. The composer's Stop button and the turn's shimmer came back
17
+ * 186ms after they left and stayed for fifteen seconds, with the finished
18
+ * reply already on screen. Even in the healthy case the relay lands ~200ms
19
+ * after the frame, which is still inside the window its own refetch lands in.
20
+ *
21
+ * `started_at` is what separates the two turns the rule has to tell apart: a
22
+ * turn that began BEFORE the frame is the turn that frame ended, and a turn
23
+ * that began after it is a NEW one the frame knows nothing about — a queued
24
+ * prompt draining, a trigger firing, a second device sending. That one keeps
25
+ * the ledger's full authority, with no delay and no window.
26
+ *
27
+ * A row with no start instant (a legacy `activeTurn`) cannot be ranked
28
+ * against the frame at all, and inventing an order there would hide a live
29
+ * turn. The ledger keeps it.
30
+ */
31
+ export function endedByRuntime(candidate, idleFrame, server) {
32
+ if (!idleFrame)
33
+ return false;
34
+ const startedAt = instant(candidate.started_at);
35
+ if (startedAt === null || startedAt >= idleFrame.atMs)
36
+ return false;
37
+ const lastEnded = server?.lastEnded;
38
+ const endedAt = instant(lastEnded?.ended_at);
39
+ if (lastEnded &&
40
+ endedAt !== null &&
41
+ Math.abs(endedAt - idleFrame.atMs) <= 1_000 &&
42
+ lastEnded.turn_token !== candidate.turn_token)
43
+ return false;
44
+ return true;
45
+ }
46
+ //# sourceMappingURL=working-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"working-runtime.js","sourceRoot":"","sources":["../../../src/core/session/working-runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,UAAU,cAAc,CAC5B,SAAsB,EACtB,SAAoC,EACpC,MAAiC;IAEjC,IAAI,CAAC,SAAS;QAAE,OAAO,KAAK,CAAC;IAC7B,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAChD,IAAI,SAAS,KAAK,IAAI,IAAI,SAAS,IAAI,SAAS,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IACpE,MAAM,SAAS,GAAG,MAAM,EAAE,SAAS,CAAC;IACpC,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7C,IACE,SAAS;QACT,OAAO,KAAK,IAAI;QAChB,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,KAAK;QAC3C,SAAS,CAAC,UAAU,KAAK,SAAS,CAAC,UAAU;QAE7C,OAAO,KAAK,CAAC;IACf,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function instant(value: string | null | undefined): number | null;
2
+ //# sourceMappingURL=working-time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"working-time.d.ts","sourceRoot":"","sources":["../../../src/core/session/working-time.ts"],"names":[],"mappings":"AAAA,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAIvE"}
@@ -0,0 +1,7 @@
1
+ export function instant(value) {
2
+ if (!value)
3
+ return null;
4
+ const parsed = Date.parse(value);
5
+ return Number.isNaN(parsed) ? null : parsed;
6
+ }
7
+ //# sourceMappingURL=working-time.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"working-time.js","sourceRoot":"","sources":["../../../src/core/session/working-time.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,OAAO,CAAC,KAAgC;IACtD,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,M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oB;IACnC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;uDACuD;AACvD,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB;0EACsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;;;;;;;;;;;OAkBG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,iBAAiB,EAC5B,OAAO,EAAE,iBAAiB,GAAG,IAAI,GAAG,SAAS,GAC5C,OAAO,CAMT;AAED,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IAC/B,uEAAuE;IACvE,KAAK,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC5B,0EAA0E;IAC1E,KAAK,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAClC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAClC,uEAAuE;IACvE,QAAQ,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACvC,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAO/E;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,iBAAiB,CAEvE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAwBtE"}
@@ -122,13 +122,7 @@ export function countLiveInboxPrompts(prompts) {
122
122
  }
123
123
  return live;
124
124
  }
125
- /** ms epoch, or null for an absent/unparseable instant. */
126
- function instant(value) {
127
- if (!value)
128
- return null;
129
- const parsed = Date.parse(value);
130
- return Number.isNaN(parsed) ? null : parsed;
131
- }
125
+ import { decideWorking } from './working-project.js';
132
126
  /**
133
127
  * The one place a session's working state is decided.
134
128
  *
@@ -167,315 +161,7 @@ function instant(value) {
167
161
  * must re-evaluate at those instants — see `workingExpiryAtMs`.
168
162
  */
169
163
  export function projectWorking(inputs) {
170
- const { optimistic, abort, inbox, server, stream, activity, nowMs } = inputs;
171
- const receiptLive = !!optimistic && nowMs - optimistic.atMs < OPTIMISTIC_RECEIPT_MAX_MS;
172
- const receiptTurnId = optimistic
173
- ? optimistic.turnId === undefined
174
- ? optimistic.messageId
175
- : optimistic.turnId
176
- : null;
177
- // TWO floors, because the two server-side observers have different knowledge.
178
- //
179
- // `GET .../turn` reads the control plane's ledger, and there is NO row in it
180
- // until `POST .../prompts` returns. A read issued in that window is stamped
181
- // after the receipt and still provably cannot see the send, so it may not
182
- // answer for it at all — hence the infinity while `acceptedAtMs` is null.
183
- //
184
- // The SSE stream is the RUNTIME's own voice, and the store stamps a frame
185
- // when this tab observed it — which only moves when the frame itself changes.
186
- // So a frame stamped after the send is a NEW transition, not a stale reading,
187
- // and it is the freshest thing there is. Blocking it too would leave a
188
- // command's receipt (nothing ever "accepts" a command) claiming `working` for
189
- // a full minute after its turn had visibly ended.
190
- const serverFloor = receiptLive
191
- ? (optimistic.acceptedAtMs ?? Number.POSITIVE_INFINITY)
192
- : Number.NEGATIVE_INFINITY;
193
- const streamFloor = receiptLive ? optimistic.atMs : Number.NEGATIVE_INFINITY;
194
- // The stop's floor, built exactly like the send's. A `/turn` read issued
195
- // before the cancel was ACKNOWLEDGED still reports the turn the cancel is
196
- // ending, so it may not report `working` from it — the read is honest and
197
- // out of date. Infinite while the acknowledgement is outstanding, and gone
198
- // entirely once the receipt ages out, so a cancel nobody answers cannot pin
199
- // the composer on idle over a turn that is really still running.
200
- const abortLive = !!abort && nowMs - abort.atMs < OPTIMISTIC_ABORT_MAX_MS;
201
- const abortFloor = abortLive
202
- ? (abort.settledAtMs ?? Number.POSITIVE_INFINITY)
203
- : Number.NEGATIVE_INFINITY;
204
- const serverFresh = !!server && nowMs - server.atMs <= SERVER_OBSERVATION_MAX_MS;
205
- const streamFresh = !!stream && nowMs - stream.atMs <= STREAM_OBSERVATION_MAX_MS;
206
- const inboxFresh = !!inbox && nowMs - inbox.atMs <= INBOX_OBSERVATION_MAX_MS;
207
- // The runtime's own end-of-turn frame.
208
- //
209
- // NOT gated on `streamFresh`, unlike every branch that decides `working` from
210
- // the stream. The bound exists because an old frame cannot testify to what is
211
- // happening NOW — but this frame is not asked that. It is asked whether a turn
212
- // that started BEFORE it has ended, and that answer does not rot: a turn which
213
- // resumed would have produced a newer, non-idle frame, and then this is not an
214
- // idle frame at all. Gating it cost exactly what the 3s window cost, 42s later
215
- // and permanently — at `stream.atMs + STREAM_OBSERVATION_MAX_MS` the veto
216
- // vanished with no new input, and a row the relay never closed put the
217
- // composer back on Stop until its deadline (240 MINUTES for an accepted turn).
218
- // WIRE frames only. A fabricated local idle (`origin: 'local'`) is the tab
219
- // inferring, not the runtime speaking, and this veto is unbounded — one wrong
220
- // local frame silenced every fresh `/turn` read for the rest of a quiet turn
221
- // (dev, 2026-08-24: busy indicator gone, composer on Send, transcript poll
222
- // switched off, all mid-run). See `WorkingStreamInput.origin`.
223
- const idleFrame = stream && stream.type === 'idle' && stream.origin !== 'local' ? stream : null;
224
- // CONTENT FIRST. Bounded by the stream's own freshness rule, because it
225
- // arrives on the same transport and goes stale for the same reasons — but
226
- // within that window it outranks every observer, including an idle frame it
227
- // postdates. A runtime that is emitting parts is working, whatever the last
228
- // status frame said and whatever a poll that has not answered yet will say.
229
- const activityFresh = !!activity && nowMs - activity.atMs <= STREAM_OBSERVATION_MAX_MS;
230
- const activityAfterIdle = activityFresh && (!idleFrame || activity.atMs > idleFrame.atMs);
231
- /**
232
- * Whether the runtime has already finished this turn.
233
- *
234
- * "Newer read wins" is the rule this replaces, and it is wrong here, because
235
- * the two observers do not learn the same fact at the same time. The idle
236
- * frame comes straight off the runtime over SSE. The ledger row is closed by
237
- * a SEPARATE daemon relay (`POST .../turn-stream` `kind:"end"`) — so a `/turn`
238
- * read ISSUED after the frame is still ABOUT a turn the frame already ended.
239
- *
240
- * MEASURED, local stack 2026-08-21, one ordinary composer turn: the idle
241
- * frame reached the tab at 00:03:59.964, the refetch that frame itself
242
- * triggers landed at 00:04:00.150 stamped 44ms later and still reported the
243
- * turn `active`, and the ledger did not record `ended_at` until 00:04:15.132
244
- * — the relay for that turn never arrived and a reconciliation sweep closed
245
- * it 15.1s late. The composer's Stop button and the turn's shimmer came back
246
- * 186ms after they left and stayed for fifteen seconds, with the finished
247
- * reply already on screen. Even in the healthy case the relay lands ~200ms
248
- * after the frame, which is still inside the window its own refetch lands in.
249
- *
250
- * `started_at` is what separates the two turns the rule has to tell apart: a
251
- * turn that began BEFORE the frame is the turn that frame ended, and a turn
252
- * that began after it is a NEW one the frame knows nothing about — a queued
253
- * prompt draining, a trigger firing, a second device sending. That one keeps
254
- * the ledger's full authority, with no delay and no window.
255
- *
256
- * A row with no start instant (a legacy `activeTurn`) cannot be ranked
257
- * against the frame at all, and inventing an order there would hide a live
258
- * turn. The ledger keeps it.
259
- */
260
- const endedByRuntime = (candidate) => {
261
- if (!idleFrame)
262
- return false;
263
- // Only a turn that began BEFORE the frame — a turn started after it is a
264
- // new one the frame knows nothing about.
265
- const startedAt = instant(candidate.started_at);
266
- if (startedAt === null || startedAt >= idleFrame.atMs)
267
- return false;
268
- // Another turn may have remained active while this one finished. The
269
- // control plane names the completed turn even when others are still live.
270
- const lastEnded = server?.lastEnded;
271
- const endedAt = instant(lastEnded?.ended_at);
272
- if (lastEnded &&
273
- endedAt !== null &&
274
- Math.abs(endedAt - idleFrame.atMs) <= 1_000 &&
275
- lastEnded.turn_token !== candidate.turn_token)
276
- return false;
277
- // Otherwise the frame ends the only turn we can identify.
278
- // It used to expire after
279
- // `TURN_END_LEDGER_LAG_MS`, on the theory that a row still open past the
280
- // relay's lag must mean the frame was a retry's `session.error` rather than
281
- // the end of anything. But time is not evidence: when the `kind:"end"`
282
- // relay is simply DROPPED — the documented failure mode, closed by a
283
- // reconciliation sweep 15.1s late in this file's own measurement — the row
284
- // stays open for exactly the same reason and the turn is exactly as
285
- // finished. Expiring the veto therefore announced a finished turn again,
286
- // and the user watched "Gathering thoughts…" and the Stop button come back
287
- // for seconds with the answer already on screen (dev, 2026-08-23).
288
- //
289
- // A turn that is genuinely still running says so, and that is what returns
290
- // authority to the ledger: any newer frame is not idle, so `idleFrame` is
291
- // null on the next evaluation and the row decides again — immediately, with
292
- // no window to tune.
293
- //
294
- // "Says so" assumes the stream is delivering. When it is NOT — a
295
- // black-holed SSE proxy answers 200 and never writes a byte, and the
296
- // client heartbeat is the only detector (apps/api injects no keepalives)
297
- // — this veto is deliberately NOT expired by `STREAM_OBSERVATION_MAX_MS`
298
- // (a row still open past any time bound is more often a dropped
299
- // `kind:"end"` relay than a live turn). The repair for the wrong case —
300
- // a running turn behind a dead stream, prod 2026-08-26 — is EVIDENCE,
301
- // not time: the transcript liveness poll stays on while the server holds
302
- // a turn open (`livenessBusy`'s `serverHoldsTurn`), its runtime read
303
- // stamps `sessionActivityAt` when the transcript moved with an open tail
304
- // (`sync-store.hydrate`), and `activityAfterIdle` above then outranks
305
- // this frame. Also note `started_at` is server clock while `atMs` is this
306
- // tab's clock — skew can misclassify a NEW turn as ended, and the same
307
- // evidence path is what recovers it.
308
- return true;
309
- };
310
- if (activityAfterIdle && activity.atMs >= abortFloor) {
311
- return {
312
- state: 'working',
313
- source: 'stream',
314
- // Activity proves liveness; the ledger identifies which prompt owns it.
315
- // Keep that identity while an older inbox snapshot still lists the prompt.
316
- turnId: serverFresh
317
- ? server.turns.find((turn) => turn.state === 'active' && !endedByRuntime(turn))?.message_id ?? null
318
- : null,
319
- since: activity.atMs,
320
- serverOpenTurnToken: server?.turns[0]?.turn_token ?? null,
321
- };
322
- }
323
- // NOT gated on `serverFresh`. A read going stale is a fact about the READ, not
324
- // about the row: the control plane does not release a turn because this tab's
325
- // last look got old. Gating it here made being wrong self-sealing — the token
326
- // nulls, `serverHoldsTurn` (use-session.ts) goes false, `livenessBusy` goes
327
- // false, and the transcript fallback poll clears its own interval. The one
328
- // mechanism that could have produced fresh evidence was switched off BY the
329
- // staleness it existed to repair, so a false idle could never be discovered.
330
- // The token is retired by end-of-turn evidence, never by age.
331
- const ledgerTurn = server?.turns[0];
332
- // `serverOpenTurnToken` deliberately keeps reporting the LEDGER's turn even
333
- // when the runtime's frame has decided the state above — see its docstring.
334
- // It answers "is the control plane still holding authority", which is what a
335
- // `/` command must check before going straight at OpenCode with no admission
336
- // gate in front of it, and that stays true for as long as the row does.
337
- // Only the WORKING decision moves.
338
- const serverOpenTurnToken = ledgerTurn?.turn_token ?? null;
339
- // EVERY row, not just the first. The ledger holds more than one open turn
340
- // whenever a prompt is forwarded while another is running — measured on the
341
- // local stack as `turns: [B@00:28:56, A@00:28:22]` — and the list is not
342
- // ordered newest-first. Testing only `turns[0]` would let one spent row hide
343
- // a live one behind it, so the projection keeps the first turn the runtime
344
- // has NOT finished.
345
- const openTurns = serverFresh ? server.turns.filter((t) => !endedByRuntime(t)) : [];
346
- const openTurn = openTurns.find((turn) => turn.state === 'active') ?? openTurns[0];
347
- // A turn the authority is holding open, unless the stream has since said the
348
- // session went idle. The stream frame is newer BY OBSERVATION, and the daemon
349
- // relays `turn_end` to the control plane at the same moment the frame is
350
- // emitted — so a fresher idle frame means this read is simply out of date.
351
- //
352
- // A LOCAL idle frame is exempt from that ordering: it is not the runtime
353
- // speaking, so "newer" buys it nothing against the lifecycle authority. It
354
- // lands between polls by construction (the sweep runs on connect), and
355
- // waiting one poll interval for the row to outrank it again is exactly the
356
- // flicker being fixed.
357
- const streamContradicts = !!stream && !(stream.type === 'idle' && stream.origin === 'local');
358
- if (openTurn && server.atMs >= abortFloor && (!streamContradicts || server.atMs >= stream.atMs)) {
359
- return {
360
- ...(openTurn.state === 'delivering' ? { pendingDelivery: true } : {}),
361
- state: 'working',
362
- source: 'server',
363
- turnId: openTurn.message_id,
364
- since: instant(openTurn.started_at) ?? server.atMs,
365
- serverOpenTurnToken,
366
- };
367
- }
368
- // Durable rows outrank an idle read: the read is right that no TURN is
369
- // running and wrong that nothing is happening.
370
- //
371
- // Every live row counts, INCLUDING the ones already forwarded to the runtime.
372
- // A prompt queued behind a running turn is handed to OpenCode early and sits
373
- // in `delivering` ACROSS the turn boundary, so the idle frame that ends the
374
- // turn in front of it says nothing about it. Measured on the local stack
375
- // 2026-08-21: suppressing forwarded rows on that frame left the composer idle
376
- // for 13.8s with the user's queued prompt still waiting to run.
377
- if (inboxFresh && inbox.pending > 0 && inbox.atMs >= abortFloor) {
378
- const runtimeIsResponding = streamFresh && stream.type !== 'idle' &&
379
- (!serverFresh || stream.atMs > server.atMs) && stream.atMs >= abortFloor;
380
- return {
381
- ...(!runtimeIsResponding ? { pendingDelivery: true } : {}),
382
- state: 'working',
383
- source: 'server',
384
- turnId: receiptLive ? receiptTurnId : null,
385
- since: inbox.atMs,
386
- serverOpenTurnToken,
387
- };
388
- }
389
- // A ROW THE SERVER TOOK OFF THE QUEUE. The list is empty because the control
390
- // plane handed the prompt to the runtime, and the ledger row for the turn
391
- // that hand-off opens is written by a request this tab has not read since.
392
- // So both readings below are honest AND out of date, and rule 3 would call a
393
- // starting turn idle.
394
- //
395
- // EVIDENCE, NOT A TIMER, in three parts:
396
- //
397
- // * Only a SERVER READ retires it — one that could have seen the turn, i.e.
398
- // taken at or after the drain, whatever it then says. A stream frame may
399
- // not: a box that has just come up answers `idle` in its status snapshot
400
- // while the turn it was handed is not on the wire yet, and the SSE-connect
401
- // sweep fabricates a `local` idle at the same moment. Neither knows about
402
- // a hand-off the control plane made. `useSessionWorking` invalidates
403
- // `/turn` the instant this arms, so the wait is one round trip.
404
- // * A live stop never arms it. Stop marks the queue `held`, which drops the
405
- // live count to zero — the same shape as a drain, the opposite meaning.
406
- // * It dies with the reading that carried it (`inboxFresh`), so there is no
407
- // second bound to tune and `workingExpiryAtMs` already schedules the
408
- // instant it stops deciding.
409
- //
410
- // `turnId` is null on purpose, even under a live receipt. A send made during
411
- // another response names THAT response's turn, and once the row drains the
412
- // association is stale: naming it puts the shimmer on a turn whose answer is
413
- // complete, where `suppressWorkingTurnBusy` then draws nothing at all.
414
- const drainedAtMs = inbox?.drainedAtMs;
415
- const drainFloorHolds = inboxFresh &&
416
- inbox.pending === 0 &&
417
- drainedAtMs != null &&
418
- !abortLive &&
419
- !(serverFresh && server.atMs >= drainedAtMs);
420
- if (drainFloorHolds) {
421
- return {
422
- pendingDelivery: true,
423
- state: 'working',
424
- source: 'server',
425
- turnId: null,
426
- since: drainedAtMs,
427
- serverOpenTurnToken,
428
- };
429
- }
430
- const serverAnswers = serverFresh && !openTurn && server.atMs >= serverFloor;
431
- const streamAnswers = streamFresh && stream.atMs >= streamFloor &&
432
- (stream.type === 'idle' || stream.atMs >= abortFloor);
433
- if (serverAnswers && (!stream || server.atMs >= stream.atMs)) {
434
- return {
435
- state: 'idle',
436
- source: 'server',
437
- turnId: null,
438
- since: instant(server.lastEnded?.ended_at) ?? server.atMs,
439
- serverOpenTurnToken,
440
- };
441
- }
442
- if (streamAnswers) {
443
- return {
444
- state: stream.type === 'idle' ? 'idle' : 'working',
445
- source: 'stream',
446
- turnId: null,
447
- since: stream.atMs,
448
- serverOpenTurnToken,
449
- };
450
- }
451
- if (receiptLive) {
452
- return {
453
- pendingDelivery: true,
454
- state: 'working',
455
- source: 'optimistic',
456
- turnId: receiptTurnId,
457
- since: optimistic.atMs,
458
- serverOpenTurnToken,
459
- };
460
- }
461
- // Nothing has answered. Idle is the only honest default: a session is not
462
- // working because a page failed to ask.
463
- const newest = server && stream
464
- ? server.atMs >= stream.atMs
465
- ? { source: 'server', atMs: server.atMs }
466
- : { source: 'stream', atMs: stream.atMs }
467
- : server
468
- ? { source: 'server', atMs: server.atMs }
469
- : stream
470
- ? { source: 'stream', atMs: stream.atMs }
471
- : { source: 'server', atMs: nowMs };
472
- return {
473
- state: 'idle',
474
- source: newest.source,
475
- turnId: null,
476
- since: newest.atMs,
477
- serverOpenTurnToken,
478
- };
164
+ return decideWorking(inputs);
479
165
  }
480
166
  /**
481
167
  * The next instant at which `projectWorking` could answer differently on its
@@ -1 +1 @@
1
- {"version":3,"file":"working.js","sourceRoot":"","sources":["../../../src/core/session/working.ts"],"names":[],"mappings":"AA0DA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEhD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEhD;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAC5C,+EAA+E;AAC/E,gFAAgF;AAChF,iFAAiF;AACjF,8EAA8E;AAC9E,8CAA8C;AAE9C;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAiK9C;;;;;;;;;;GAUG;AACH,MAAM,UAAU,0BAA0B,CACxC,SAA4B,EAC5B,OAA6C;IAE7C,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,IAAI,OAAO,CAAC,UAAU,IAAI,IAAI,IAAI,SAAS,CAAC,UAAU,IAAI,IAAI,EAAE,CAAC;QAC/D,OAAO,SAAS,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC;IACpD,CAAC;IACD,OAAO,SAAS,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;AACxC,CAAC;AAeD;;;;;;;GAOG;AACH,MAAM,UAAU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AE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IAC7E,MAAM,SAAS,GAAG;QAChB,2EAA2E;QAC3E,2EAA2E;QAC3E,qEAAqE;QACrE,wEAAwE;QACxE,mEAAmE;QACnE,IAAI;QACJ,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,GAAG,yBAAyB,CAAC,CAAC,CAAC,IAAI;QAC/D,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,uBAAuB,CAAC,CAAC,CAAC,IAAI;QACnD,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,wBAAwB,CAAC,CAAC,CAAC,IAAI;QACpD,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,yBAAyB,CAAC,CAAC,CAAC,IAAI;QACvD,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,GAAG,yBAAyB,CAAC,CAAC,CAAC,IAAI;QACvD,0EAA0E;QAC1E,mBAAmB;QACnB,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,GAAG,yBAAyB,CAAC,CAAC,CAAC,IAAI;KAC5D,CAAC;IACF,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,IAAI,KAAK;YAAE,SAAS;QACrD,IAAI,IAAI,KAAK,IAAI,IAAI,QAAQ,GAAG,IAAI;YAAE,IAAI,GAAG,QAAQ,CAAC;IACxD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { Message, Part, SessionStatus } from '@opencode-ai/sdk/v2/client';
1
+ import type { Message, Part, SessionStatus } from '../runtime/runtime-types.js';
2
2
  export declare const SESSION_SYNC_PAGE_SIZE = 100;
3
3
  /**
4
4
  * The FIRST page — the one the user waits on.
@@ -1 +1 @@
1
- {"version":3,"file":"session-sync-controller.d.ts","sourceRoot":"","sources":["../../../src/core/session-sync/session-sync-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAmC/E,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,oBAAoB,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;IAClE,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;IACjE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C;A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AY;IAepB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,MAAM;CAYf"}
1
+ {"version":3,"file":"session-sync-controller.d.ts","sourceRoot":"","sources":["../../../src/core/session-sync/session-sync-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAmC7E,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,2BAA2B,KAAK,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEpF,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,IAAI,EAAE,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,kBAAkB,EAAE,CAAC;IAC/B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,oBAAoB,CAAC;IAChC,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,MAAM,CAAC;IAClB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC;IAClE,aAAa,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,IAAI,EAAE,SAAS,EAAE,MA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;YA4BrB,gBAAgB;IAgE9B,OAAO,CAAC,oBAAoB;YAQd,aAAa;IA4B3B,kFAAkF;IAClF,OAAO,CAAC,YAAY;IAepB,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,UAAU;IAMlB,OAAO,CAAC,WAAW;IASnB,OAAO,CAAC,MAAM;CAYf"}
@@ -16,7 +16,7 @@
16
16
  * the give-up "parked" terminal state for streams pointed at dead sandboxes
17
17
  * (see `maxConsecutiveHardFailures`/`onParked`).
18
18
  */
19
- import type { Event as OpenCodeSdkEvent } from '@opencode-ai/sdk/v2/client';
19
+ import type { Event as OpenCodeSdkEvent } from '../runtime/runtime-types.js';
20
20
  /**
21
21
  * The event union this stream dispatches. Re-exported (unchanged shape) from
22
22
  * `react/use-opencode-events/types.ts` so existing importers keep working —
@@ -30,7 +30,7 @@ export type RuntimeEvent = OpenCodeSdkEvent | {
30
30
  path: string;
31
31
  };
32
32
  };
33
- /** The minimal slice of `OpencodeClient` this machine actually calls. */
33
+ /** The minimal slice of `RuntimeClient` this machine actually calls. */
34
34
  export interface EventStreamClient {
35
35
  global: {
36
36
  event: (opts: {
@@ -54,12 +54,22 @@ export interface EventStreamTimers {
54
54
  clearTimeout: (handle: EventStreamTimerHandle | undefined) => void;
55
55
  }
56
56
  export interface OpenEventStreamOptions {
57
- /** The opencode client to stream events from (same client the rest of the
58
- * SDK obtains via `getClient()`). */
59
- client: EventStreamClient;
57
+ /** The session runtime to stream from: `${backendUrl}/p/{externalId}/{port}`
58
+ * (a session handle's `runtimeUrl`). Streams to one URL share one connection. */
59
+ url?: string;
60
+ /**
61
+ * A runtime client to stream from, instead of `url`.
62
+ * @deprecated Pass `url`. Removed in the next major.
63
+ */
64
+ client?: EventStreamClient;
60
65
  /** Called once per event, in dispatch order, after coalescing/flush. A
61
66
  * throw here is caught and logged — one bad handler must never break the
62
- * stream or crash the host. */
67
+ * stream or crash the host.
68
+ *
69
+ * Consecutive `message.part.delta` events of one part field that land in
70
+ * the same 16ms flush arrive as ONE event: `properties.delta` is their
71
+ * text joined, `id` is the last one's, and `coalesced` lists the wire
72
+ * events it replaced. Appending `delta` gives the same text either way. */
63
73
  onEvent: (event: RuntimeEvent) => void;
64
74
  /** Called once a reconnect is ESTABLISHED, with the gap in ms from the last
65
75
  * frame received to the new connection. Fires when the dropped stream had
@@ -108,9 +118,18 @@ export interface OpenEventStreamOptions {
108
118
  * handle stays safe/idempotent.
109
119
  */
110
120
  onParked?: (reason: EventStreamParkedInfo) => void;
121
+ /**
122
+ * The connection's state, for a host indicator: `connecting` when an attempt
123
+ * starts, `open` on the attempt's first frame, `lost` when it drops and a
124
+ * retry is scheduled. A park reports through `onParked`, a `close()` reports
125
+ * nothing. A subscriber that joins a live stream is told its current state.
126
+ */
127
+ onConnectionChange?: (state: EventStreamConnectionState) => void;
111
128
  /** Test-only clock/timer override. Defaults to real `Date.now`/`setTimeout`. */
112
129
  timers?: EventStreamTimers;
113
130
  }
131
+ /** See {@link OpenEventStreamOptions.onConnectionChange}. */
132
+ export type EventStreamConnectionState = 'connecting' | 'open' | 'lost';
114
133
  /** Payload for {@link OpenEventStreamOptions.onParked}. */
115
134
  export interface EventStreamParkedInfo {
116
135
  /** How many consecutive hard failures triggered the park. */
@@ -1 +1 @@
1
- {"version":3,"file":"event-stream.d.ts","sourceRoot":"","sources":["../../../src/core/stream/event-stream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,KAAK,IAAI,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAI5E;;;;GAIG;AACH,MAAM,MAAM,YAAY,GACpB,gBAAgB,GAChB;IACE,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,wBAAwB,CAAC;IAC/B,UAAU,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAChD,CAAC;AAEN,yEAAyE;AACzE,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