@kortix/sdk 0.12.8 → 0.13.1

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 (274) hide show
  1. package/README.md +3 -6
  2. package/dist/browser/session-sync/session-sync-registry.d.ts +7 -2
  3. package/dist/browser/session-sync/session-sync-registry.d.ts.map +1 -1
  4. package/dist/browser/session-sync/session-sync-registry.js +33 -44
  5. package/dist/browser/session-sync/session-sync-registry.js.map +1 -1
  6. package/dist/browser/session-sync/session-transcript-cache.d.ts +9 -2
  7. package/dist/browser/session-sync/session-transcript-cache.d.ts.map +1 -1
  8. package/dist/browser/session-sync/session-transcript-cache.js +15 -5
  9. package/dist/browser/session-sync/session-transcript-cache.js.map +1 -1
  10. package/dist/browser/stores/opencode-compaction-store.d.ts +9 -3
  11. package/dist/browser/stores/opencode-compaction-store.d.ts.map +1 -1
  12. package/dist/browser/stores/opencode-compaction-store.js +5 -12
  13. package/dist/browser/stores/opencode-compaction-store.js.map +1 -1
  14. package/dist/browser/stores/sandbox-connection-store.d.ts +28 -17
  15. package/dist/browser/stores/sandbox-connection-store.d.ts.map +1 -1
  16. package/dist/browser/stores/sandbox-connection-store.js +32 -84
  17. package/dist/browser/stores/sandbox-connection-store.js.map +1 -1
  18. package/dist/browser/stores/session-working-store.d.ts +73 -0
  19. package/dist/browser/stores/session-working-store.d.ts.map +1 -0
  20. package/dist/browser/stores/session-working-store.js +86 -0
  21. package/dist/browser/stores/session-working-store.js.map +1 -0
  22. package/dist/browser/stores/sync-store/types.d.ts +14 -4
  23. package/dist/browser/stores/sync-store/types.d.ts.map +1 -1
  24. package/dist/browser/stores/sync-store.d.ts +179 -4
  25. package/dist/browser/stores/sync-store.d.ts.map +1 -1
  26. package/dist/browser/stores/sync-store.js +777 -65
  27. package/dist/browser/stores/sync-store.js.map +1 -1
  28. package/dist/core/client/kortix.d.ts +95 -0
  29. package/dist/core/client/kortix.d.ts.map +1 -1
  30. package/dist/core/client/kortix.js +78 -0
  31. package/dist/core/client/kortix.js.map +1 -1
  32. package/dist/core/files/client.d.ts +50 -2
  33. package/dist/core/files/client.d.ts.map +1 -1
  34. package/dist/core/files/client.js +253 -44
  35. package/dist/core/files/client.js.map +1 -1
  36. package/dist/core/files/types.d.ts +11 -0
  37. package/dist/core/files/types.d.ts.map +1 -1
  38. package/dist/core/http/abort-error.d.ts +89 -0
  39. package/dist/core/http/abort-error.d.ts.map +1 -0
  40. package/dist/core/http/abort-error.js +190 -0
  41. package/dist/core/http/abort-error.js.map +1 -0
  42. package/dist/core/http/api-client.d.ts.map +1 -1
  43. package/dist/core/http/api-client.js +18 -4
  44. package/dist/core/http/api-client.js.map +1 -1
  45. package/dist/core/http/opencode-errors.d.ts +7 -0
  46. package/dist/core/http/opencode-errors.d.ts.map +1 -1
  47. package/dist/core/http/opencode-errors.js +45 -13
  48. package/dist/core/http/opencode-errors.js.map +1 -1
  49. package/dist/core/rest/platform-client/github-app.d.ts +13 -0
  50. package/dist/core/rest/platform-client/github-app.d.ts.map +1 -1
  51. package/dist/core/rest/platform-client/github-app.js +2 -0
  52. package/dist/core/rest/platform-client/github-app.js.map +1 -1
  53. package/dist/core/rest/platform-client/members.d.ts +10 -64
  54. package/dist/core/rest/platform-client/members.d.ts.map +1 -1
  55. package/dist/core/rest/platform-client/members.js +10 -28
  56. package/dist/core/rest/platform-client/members.js.map +1 -1
  57. package/dist/core/rest/projects-client/accounts.d.ts +30 -5
  58. package/dist/core/rest/projects-client/accounts.d.ts.map +1 -1
  59. package/dist/core/rest/projects-client/accounts.js +1 -1
  60. package/dist/core/rest/projects-client/accounts.js.map +1 -1
  61. package/dist/core/rest/projects-client/apps.d.ts +13 -0
  62. package/dist/core/rest/projects-client/apps.d.ts.map +1 -1
  63. package/dist/core/rest/projects-client/apps.js.map +1 -1
  64. package/dist/core/rest/projects-client/assignments.d.ts +114 -0
  65. package/dist/core/rest/projects-client/assignments.d.ts.map +1 -0
  66. package/dist/core/rest/projects-client/assignments.js +91 -0
  67. package/dist/core/rest/projects-client/assignments.js.map +1 -0
  68. package/dist/core/rest/projects-client/billing.d.ts +10 -1
  69. package/dist/core/rest/projects-client/billing.d.ts.map +1 -1
  70. package/dist/core/rest/projects-client/billing.js +11 -2
  71. package/dist/core/rest/projects-client/billing.js.map +1 -1
  72. package/dist/core/rest/projects-client/connectors.d.ts +69 -1
  73. package/dist/core/rest/projects-client/connectors.d.ts.map +1 -1
  74. package/dist/core/rest/projects-client/connectors.js +17 -0
  75. package/dist/core/rest/projects-client/connectors.js.map +1 -1
  76. package/dist/core/rest/projects-client/files.js +2 -2
  77. package/dist/core/rest/projects-client/files.js.map +1 -1
  78. package/dist/core/rest/projects-client/gateway.d.ts +51 -0
  79. package/dist/core/rest/projects-client/gateway.d.ts.map +1 -1
  80. package/dist/core/rest/projects-client/gateway.js.map +1 -1
  81. package/dist/core/rest/projects-client/iam.d.ts +51 -3
  82. package/dist/core/rest/projects-client/iam.d.ts.map +1 -1
  83. package/dist/core/rest/projects-client/iam.js +18 -1
  84. package/dist/core/rest/projects-client/iam.js.map +1 -1
  85. package/dist/core/rest/projects-client/index.d.ts +1 -0
  86. package/dist/core/rest/projects-client/index.d.ts.map +1 -1
  87. package/dist/core/rest/projects-client/index.js +1 -0
  88. package/dist/core/rest/projects-client/index.js.map +1 -1
  89. package/dist/core/rest/projects-client/projects.d.ts +1 -1
  90. package/dist/core/rest/projects-client/projects.d.ts.map +1 -1
  91. package/dist/core/rest/projects-client/projects.js +2 -0
  92. package/dist/core/rest/projects-client/projects.js.map +1 -1
  93. package/dist/core/rest/projects-client/secrets.d.ts +19 -1
  94. package/dist/core/rest/projects-client/secrets.d.ts.map +1 -1
  95. package/dist/core/rest/projects-client/secrets.js +1 -1
  96. package/dist/core/rest/projects-client/secrets.js.map +1 -1
  97. package/dist/core/rest/projects-client/session-costs.d.ts +33 -0
  98. package/dist/core/rest/projects-client/session-costs.d.ts.map +1 -1
  99. package/dist/core/rest/projects-client/session-costs.js.map +1 -1
  100. package/dist/core/rest/projects-client/sessions.d.ts +261 -2
  101. package/dist/core/rest/projects-client/sessions.d.ts.map +1 -1
  102. package/dist/core/rest/projects-client/sessions.js +106 -4
  103. package/dist/core/rest/projects-client/sessions.js.map +1 -1
  104. package/dist/core/rest/projects-client/shared.d.ts +10 -1
  105. package/dist/core/rest/projects-client/shared.d.ts.map +1 -1
  106. package/dist/core/rest/projects-client/shared.js.map +1 -1
  107. package/dist/core/rest/projects-client/tokens.d.ts +13 -1
  108. package/dist/core/rest/projects-client/tokens.d.ts.map +1 -1
  109. package/dist/core/rest/projects-client/tokens.js +7 -2
  110. package/dist/core/rest/projects-client/tokens.js.map +1 -1
  111. package/dist/core/rest/projects-client/triggers.d.ts +69 -2
  112. package/dist/core/rest/projects-client/triggers.d.ts.map +1 -1
  113. package/dist/core/rest/projects-client/triggers.js +1 -1
  114. package/dist/core/rest/projects-client/triggers.js.map +1 -1
  115. package/dist/core/session/compaction.d.ts +98 -0
  116. package/dist/core/session/compaction.d.ts.map +1 -0
  117. package/dist/core/session/compaction.js +108 -0
  118. package/dist/core/session/compaction.js.map +1 -0
  119. package/dist/core/session/health.d.ts +22 -0
  120. package/dist/core/session/health.d.ts.map +1 -1
  121. package/dist/core/session/health.js +31 -5
  122. package/dist/core/session/health.js.map +1 -1
  123. package/dist/core/session/index.d.ts +2 -0
  124. package/dist/core/session/index.d.ts.map +1 -1
  125. package/dist/core/session/index.js +2 -0
  126. package/dist/core/session/index.js.map +1 -1
  127. package/dist/core/session/message-queue.d.ts +79 -15
  128. package/dist/core/session/message-queue.d.ts.map +1 -1
  129. package/dist/core/session/message-queue.js +73 -27
  130. package/dist/core/session/message-queue.js.map +1 -1
  131. package/dist/core/session/rewind.d.ts +76 -10
  132. package/dist/core/session/rewind.d.ts.map +1 -1
  133. package/dist/core/session/rewind.js +68 -11
  134. package/dist/core/session/rewind.js.map +1 -1
  135. package/dist/core/session/working.d.ts +241 -0
  136. package/dist/core/session/working.d.ts.map +1 -0
  137. package/dist/core/session/working.js +261 -0
  138. package/dist/core/session/working.js.map +1 -0
  139. package/dist/core/session-sync/session-sync-controller.d.ts +35 -20
  140. package/dist/core/session-sync/session-sync-controller.d.ts.map +1 -1
  141. package/dist/core/session-sync/session-sync-controller.js +48 -115
  142. package/dist/core/session-sync/session-sync-controller.js.map +1 -1
  143. package/dist/core/stream/event-stream.d.ts +22 -0
  144. package/dist/core/stream/event-stream.d.ts.map +1 -1
  145. package/dist/core/stream/event-stream.js +132 -36
  146. package/dist/core/stream/event-stream.js.map +1 -1
  147. package/dist/core/turns/grouping.d.ts +18 -2
  148. package/dist/core/turns/grouping.d.ts.map +1 -1
  149. package/dist/core/turns/grouping.js +45 -2
  150. package/dist/core/turns/grouping.js.map +1 -1
  151. package/dist/core/turns/index.d.ts +1 -0
  152. package/dist/core/turns/index.d.ts.map +1 -1
  153. package/dist/core/turns/index.js +1 -0
  154. package/dist/core/turns/index.js.map +1 -1
  155. package/dist/core/turns/open-turn.d.ts +81 -0
  156. package/dist/core/turns/open-turn.d.ts.map +1 -0
  157. package/dist/core/turns/open-turn.js +77 -0
  158. package/dist/core/turns/open-turn.js.map +1 -0
  159. package/dist/core/turns/state.js +26 -26
  160. package/dist/core/turns/state.js.map +1 -1
  161. package/dist/core/turns/types.d.ts +5 -0
  162. package/dist/core/turns/types.d.ts.map +1 -1
  163. package/dist/index.d.ts +2 -1
  164. package/dist/index.d.ts.map +1 -1
  165. package/dist/index.js +2 -1
  166. package/dist/index.js.map +1 -1
  167. package/dist/kortix.esm.min.js +25 -25
  168. package/dist/kortix.global.js +25 -25
  169. package/dist/node/server.d.ts.map +1 -1
  170. package/dist/node/server.js +14 -2
  171. package/dist/node/server.js.map +1 -1
  172. package/dist/react/index.d.ts +2 -1
  173. package/dist/react/index.d.ts.map +1 -1
  174. package/dist/react/index.js +7 -1
  175. package/dist/react/index.js.map +1 -1
  176. package/dist/react/initial-session-pin.d.ts +17 -0
  177. package/dist/react/initial-session-pin.d.ts.map +1 -1
  178. package/dist/react/initial-session-pin.js +58 -0
  179. package/dist/react/initial-session-pin.js.map +1 -1
  180. package/dist/react/opencode.d.ts +6 -2
  181. package/dist/react/opencode.d.ts.map +1 -1
  182. package/dist/react/opencode.js +5 -1
  183. package/dist/react/opencode.js.map +1 -1
  184. package/dist/react/prefetch-session-start.d.ts +10 -4
  185. package/dist/react/prefetch-session-start.d.ts.map +1 -1
  186. package/dist/react/prefetch-session-start.js +10 -4
  187. package/dist/react/prefetch-session-start.js.map +1 -1
  188. package/dist/react/query-contracts.d.ts +2 -0
  189. package/dist/react/query-contracts.d.ts.map +1 -1
  190. package/dist/react/query-contracts.js +2 -0
  191. package/dist/react/query-contracts.js.map +1 -1
  192. package/dist/react/query-keys.d.ts +13 -2
  193. package/dist/react/query-keys.d.ts.map +1 -1
  194. package/dist/react/query-keys.js +13 -2
  195. package/dist/react/query-keys.js.map +1 -1
  196. package/dist/react/session-start-stash.d.ts +25 -0
  197. package/dist/react/session-start-stash.d.ts.map +1 -1
  198. package/dist/react/session-start-stash.js +34 -3
  199. package/dist/react/session-start-stash.js.map +1 -1
  200. package/dist/react/session-title-sync.d.ts +5 -1
  201. package/dist/react/session-title-sync.d.ts.map +1 -1
  202. package/dist/react/session-title-sync.js +16 -4
  203. package/dist/react/session-title-sync.js.map +1 -1
  204. package/dist/react/use-can.d.ts +105 -0
  205. package/dist/react/use-can.d.ts.map +1 -0
  206. package/dist/react/use-can.js +190 -0
  207. package/dist/react/use-can.js.map +1 -0
  208. package/dist/react/use-canonical-opencode-session.d.ts +6 -1
  209. package/dist/react/use-canonical-opencode-session.d.ts.map +1 -1
  210. package/dist/react/use-canonical-opencode-session.js +46 -3
  211. package/dist/react/use-canonical-opencode-session.js.map +1 -1
  212. package/dist/react/use-opencode-events/handle-event.d.ts +10 -0
  213. package/dist/react/use-opencode-events/handle-event.d.ts.map +1 -1
  214. package/dist/react/use-opencode-events/handle-event.js +76 -7
  215. package/dist/react/use-opencode-events/handle-event.js.map +1 -1
  216. package/dist/react/use-opencode-events/helpers.d.ts +21 -8
  217. package/dist/react/use-opencode-events/helpers.d.ts.map +1 -1
  218. package/dist/react/use-opencode-events/helpers.js +25 -26
  219. package/dist/react/use-opencode-events/helpers.js.map +1 -1
  220. package/dist/react/use-opencode-events/index.d.ts.map +1 -1
  221. package/dist/react/use-opencode-events/index.js +43 -26
  222. package/dist/react/use-opencode-events/index.js.map +1 -1
  223. package/dist/react/use-opencode-events/use-event-stream-refs.d.ts.map +1 -1
  224. package/dist/react/use-opencode-events/use-event-stream-refs.js +66 -3
  225. package/dist/react/use-opencode-events/use-event-stream-refs.js.map +1 -1
  226. package/dist/react/use-opencode-local.d.ts +17 -0
  227. package/dist/react/use-opencode-local.d.ts.map +1 -1
  228. package/dist/react/use-opencode-local.js +41 -7
  229. package/dist/react/use-opencode-local.js.map +1 -1
  230. package/dist/react/use-opencode-sessions/messages.d.ts +101 -1
  231. package/dist/react/use-opencode-sessions/messages.d.ts.map +1 -1
  232. package/dist/react/use-opencode-sessions/messages.js +481 -63
  233. package/dist/react/use-opencode-sessions/messages.js.map +1 -1
  234. package/dist/react/use-project-apps.d.ts +24 -1
  235. package/dist/react/use-project-apps.d.ts.map +1 -1
  236. package/dist/react/use-project-apps.js +5 -3
  237. package/dist/react/use-project-apps.js.map +1 -1
  238. package/dist/react/use-runtime-boot-stalled.d.ts +32 -0
  239. package/dist/react/use-runtime-boot-stalled.d.ts.map +1 -0
  240. package/dist/react/use-runtime-boot-stalled.js +48 -0
  241. package/dist/react/use-runtime-boot-stalled.js.map +1 -0
  242. package/dist/react/use-runtime-reconnect.d.ts +67 -1
  243. package/dist/react/use-runtime-reconnect.d.ts.map +1 -1
  244. package/dist/react/use-runtime-reconnect.js +116 -18
  245. package/dist/react/use-runtime-reconnect.js.map +1 -1
  246. package/dist/react/use-session-prompts.d.ts +113 -0
  247. package/dist/react/use-session-prompts.d.ts.map +1 -0
  248. package/dist/react/use-session-prompts.js +250 -0
  249. package/dist/react/use-session-prompts.js.map +1 -0
  250. package/dist/react/use-session-send.d.ts +169 -20
  251. package/dist/react/use-session-send.d.ts.map +1 -1
  252. package/dist/react/use-session-send.js +183 -30
  253. package/dist/react/use-session-send.js.map +1 -1
  254. package/dist/react/use-session-sync.d.ts +35 -2
  255. package/dist/react/use-session-sync.d.ts.map +1 -1
  256. package/dist/react/use-session-sync.js +49 -11
  257. package/dist/react/use-session-sync.js.map +1 -1
  258. package/dist/react/use-session-working.d.ts +57 -0
  259. package/dist/react/use-session-working.d.ts.map +1 -0
  260. package/dist/react/use-session-working.js +178 -0
  261. package/dist/react/use-session-working.js.map +1 -0
  262. package/dist/react/use-session.d.ts +131 -5
  263. package/dist/react/use-session.d.ts.map +1 -1
  264. package/dist/react/use-session.js +358 -69
  265. package/dist/react/use-session.js.map +1 -1
  266. package/package.json +2 -2
  267. package/dist/browser/stores/tab-store.d.ts +0 -91
  268. package/dist/browser/stores/tab-store.d.ts.map +0 -1
  269. package/dist/browser/stores/tab-store.js +0 -369
  270. package/dist/browser/stores/tab-store.js.map +0 -1
  271. package/dist/core/session/send-queue.d.ts +0 -70
  272. package/dist/core/session/send-queue.d.ts.map +0 -1
  273. package/dist/core/session/send-queue.js +0 -116
  274. package/dist/core/session/send-queue.js.map +0 -1
@@ -0,0 +1,241 @@
1
+ import type { SessionPrompt, SessionTurn, SessionTurnEnded } from '../rest/projects-client/sessions.js';
2
+ /**
3
+ * WHICH observation decided the state.
4
+ *
5
+ * `server` — `GET .../turn`, the control plane's lifecycle authority, or the
6
+ * session's durable prompt inbox. Both are rows the server owns.
7
+ * `stream` — a `session.status` / `session.idle` frame off the live SSE stream.
8
+ * `optimistic` — this tab's own send receipt, which no server source has
9
+ * answered yet.
10
+ *
11
+ * Provenance is part of the answer because the failure this replaces was a
12
+ * projection nobody could attribute: three machines wrote "busy" into one
13
+ * slot — a stall timer, a 30s safety timeout, a status latch — and when the
14
+ * session stayed busy forever, no one could say which of them was lying.
15
+ */
16
+ export type WorkingSource = 'server' | 'stream' | 'optimistic';
17
+ export interface WorkingProjection {
18
+ state: 'idle' | 'working';
19
+ /** WHICH observation decided this. Never inferred, never fabricated. */
20
+ source: WorkingSource;
21
+ /** The wire message id (server) or the optimistic receipt id. */
22
+ turnId: string | null;
23
+ /** ms epoch at which THIS state began, from the deciding observation. */
24
+ since: number;
25
+ /**
26
+ * The `turn_token` of the turn the control plane is holding open in the
27
+ * freshest read we have, EVEN WHEN something newer outranked it above.
28
+ *
29
+ * `state` is the answer; this is the raw fact behind one of its inputs, and
30
+ * the two are deliberately separable. A caller that must not act while the
31
+ * server still holds authority — a `/` command, which goes straight at
32
+ * OpenCode with no admission gate in front of it — needs to see that
33
+ * authority even in the window where a fresher status frame is (correctly)
34
+ * deciding `idle`. `null` when no fresh read reports one, so a read too old
35
+ * to decide cannot latch it.
36
+ *
37
+ * The TOKEN, never `message_id`. `message_id` is the WIRE id of the prompt
38
+ * that opened the turn, and most producers send none: `postPrompt` omits
39
+ * `messageID` for triggers, Slack/Teams/Telegram, approval-resume and email,
40
+ * and `buildSessionCommandInput` omits it for every `/` command. `GET
41
+ * .../turn` answers `message_id: null` for all of them (the field is
42
+ * `z.string().nullable()`), so an authority check keyed on it read "the
43
+ * server holds nothing" over turns that were streaming. `turn_token` is
44
+ * minted by the control plane for every turn and is never null.
45
+ */
46
+ serverOpenTurnToken: string | null;
47
+ }
48
+ /**
49
+ * How long an unanswered optimistic receipt may claim `working` on its own.
50
+ *
51
+ * Bounded because a send whose response never arrives must not latch the UI —
52
+ * the failure this whole phase exists to end. Released the moment a server
53
+ * source that CAN know about the send answers; the cap only covers the case
54
+ * where none ever does.
55
+ */
56
+ export declare const OPTIMISTIC_RECEIPT_MAX_MS = 60000;
57
+ /**
58
+ * How long a server observation keeps deciding anything.
59
+ *
60
+ * `useSessionWorking` polls `GET .../turn` every 5s while working and every
61
+ * 15s while idle, and react-query hands back the last SUCCESSFUL read for as
62
+ * long as the ones after it fail. Without this bound, one successful read of an
63
+ * open turn followed by a dev-api 503, an expired JWT, or a closed laptop lid
64
+ * pinned the composer on "working" for the lifetime of the tab — literally the
65
+ * reported bug. Three idle cadences is long enough that an ordinary retry or a
66
+ * backgrounded tab never trips it, and short enough that a dead poll stops
67
+ * being believed.
68
+ */
69
+ export declare const SERVER_OBSERVATION_MAX_MS = 45000;
70
+ /**
71
+ * How long a status frame keeps deciding anything.
72
+ *
73
+ * The stream needs its own bound for the same reason the server read does, and
74
+ * the failure it covers is the SAME one: the SSE stream reaches this tab
75
+ * through the API that serves `/turn`, so when that API drains they stop
76
+ * together. The stream does not go `null` when it stops — the last `busy`
77
+ * frame this tab ever observed stays in the store — so bounding only the
78
+ * server read moved the latch one source over instead of ending it.
79
+ *
80
+ * Equal to the server bound on purpose: while the API answers at all, a fresh
81
+ * `/turn` read decides and this bound is never reached; once it stops
82
+ * answering, both observations are equally blind and neither may stand.
83
+ */
84
+ export declare const STREAM_OBSERVATION_MAX_MS = 45000;
85
+ /**
86
+ * How long ONE reading of the durable inbox keeps deciding.
87
+ *
88
+ * Three cadences of the prompt list's own poll (3s), not of `/turn`'s. A
89
+ * reading says "the server still intends to run N rows", and that claim decays
90
+ * fast: the row it counted may already have been delivered, run, and finished.
91
+ * Held for the server bound instead, a finished prompt left the composer on
92
+ * Stop with its reply on screen for up to 45s.
93
+ */
94
+ export declare const INBOX_OBSERVATION_MAX_MS = 10000;
95
+ /**
96
+ * How long a stop this tab issued may bar a server read from reporting the
97
+ * turn it is ending.
98
+ *
99
+ * Bounded for the same reason the send receipt is, in the other direction: an
100
+ * abort whose acknowledgement never comes must not pin the composer on `idle`
101
+ * over a turn that is genuinely still running. Generous next to the ~1.6s a
102
+ * cancel takes to reach the daemon, and far below the send receipt's cap
103
+ * because the evidence arrives sooner.
104
+ */
105
+ export declare const OPTIMISTIC_ABORT_MAX_MS = 15000;
106
+ /** This tab's own record that a prompt went out. */
107
+ export interface SendReceipt {
108
+ /** The submission's tab-local name — never sent anywhere. It exists so a
109
+ * `working` state can say WHICH send it is standing on. */
110
+ messageId: string;
111
+ /** ms epoch at which the send left this tab. */
112
+ atMs: number;
113
+ /**
114
+ * ms epoch at which the SERVER durably accepted the send (`POST .../prompts`
115
+ * returned, or the REST prompt was acknowledged), or null while the request
116
+ * is still on the wire.
117
+ *
118
+ * This is the instant from which a server read can speak for the send AT ALL.
119
+ * A `/turn` read issued while the POST is still in flight is stamped after
120
+ * the receipt and honestly answers "no turns" — because there is nothing for
121
+ * it to see yet. Believing it swapped the composer's Stop back to Send in the
122
+ * middle of the send and opened the queue drain into the turn about to start.
123
+ */
124
+ acceptedAtMs?: number | null;
125
+ }
126
+ /**
127
+ * This tab's own record that it asked the running turn to END.
128
+ *
129
+ * The mirror of `SendReceipt`, and it exists for the mirror-image failure. Stop
130
+ * paints the session idle and issues the cancel; the cancel needs a round trip
131
+ * through the control plane and the daemon (~1.6s measured) before the turn
132
+ * authority is actually released. Every `/turn` read issued inside that window
133
+ * still reports the doomed turn — including the one the optimistic idle FRAME
134
+ * itself triggers — so the composer swapped Send back to Stop about 120ms
135
+ * after the click and stayed there for the whole abort.
136
+ */
137
+ export interface AbortReceipt {
138
+ /** ms epoch at which the cancel left this tab. */
139
+ atMs: number;
140
+ /**
141
+ * ms epoch at which the server acknowledged the cancel, or null while it is
142
+ * still on the wire.
143
+ *
144
+ * This is the instant from which a server read can see the abort's EFFECT.
145
+ * A read issued before it is honest and out of date, exactly like a `/turn`
146
+ * read issued before `POST .../prompts` returns.
147
+ */
148
+ settledAtMs?: number | null;
149
+ }
150
+ /** One read of `GET .../turn`, stamped with the instant the read was ISSUED —
151
+ * not when it landed. An answer is only as fresh as the moment it was asked. */
152
+ export interface WorkingServerInput {
153
+ turns: SessionTurn[];
154
+ lastEnded?: SessionTurnEnded;
155
+ atMs: number;
156
+ }
157
+ /** One observed runtime status frame, stamped when this tab observed it. */
158
+ export interface WorkingStreamInput {
159
+ type: 'busy' | 'retry' | 'idle';
160
+ atMs: number;
161
+ }
162
+ /** One read of the session's durable prompt inbox: how many rows the server is
163
+ * still going to run, and when that list was read. */
164
+ export interface WorkingInboxInput {
165
+ pending: number;
166
+ atMs: number;
167
+ }
168
+ export interface WorkingInputs {
169
+ optimistic: SendReceipt | null;
170
+ /** This tab's pending stop. `null`/absent means it is not stopping. */
171
+ abort?: AbortReceipt | null;
172
+ /** The durable inbox. `null`/absent means it has never been read here. */
173
+ inbox?: WorkingInboxInput | null;
174
+ server: WorkingServerInput | null;
175
+ stream: WorkingStreamInput | null;
176
+ nowMs: number;
177
+ }
178
+ /**
179
+ * How many inbox rows are work the server still intends to run.
180
+ *
181
+ * `held` is excluded on purpose: it is the Stop button's own state — the row
182
+ * stays, deliberately not due, until the user sends something or presses "send
183
+ * now". Counting it would leave the composer on Stop with nothing running.
184
+ * `failed` is excluded for the same reason in the other direction: it is over.
185
+ */
186
+ export declare function countLiveInboxPrompts(prompts: readonly SessionPrompt[]): number;
187
+ /**
188
+ * The one place a session's working state is decided.
189
+ *
190
+ * Pure, so every rule below is asserted rather than observed by hand. No
191
+ * timers, no latch, no fabricated `SessionStatus` write — a caller that wants
192
+ * to re-evaluate simply calls again with a newer `nowMs`.
193
+ *
194
+ * Precedence:
195
+ *
196
+ * 1. The server is holding a turn open, and no NEWER stream frame contradicts
197
+ * it → working. `GET .../turn` reads the lifecycle authority rather than the
198
+ * ledger, so it is the strongest answer there is — but it is still a read
199
+ * taken at an instant, and an SSE frame from after that instant knows more.
200
+ * 2. The server holds durable inbox rows for this session → working. A prompt
201
+ * is accepted long before it is a turn: the row has to be drained, the box
202
+ * may have to resume (18.9s Daytona / 24.5s Platinum, measured), and only
203
+ * then does `beginSandboxTurn` run. "No turn is running" and "nothing of
204
+ * yours is in flight" stopped being the same statement when the inbox
205
+ * landed.
206
+ * 3. The server says no turns, and its read is at least as new as the stream's
207
+ * last frame → idle. (A dropped end-of-turn frame is exactly why the server
208
+ * has to be able to outrank a stale stream busy.)
209
+ * 4. The stream's own frame decides.
210
+ * 5. A live optimistic receipt → working.
211
+ * 6. Nothing observed → idle.
212
+ *
213
+ * With TWO cross-cutting freshness rules:
214
+ *
215
+ * * An observation that could not yet know about a live LOCAL action cannot
216
+ * answer for it — the send's floors (`SendReceipt.acceptedAtMs`) and the
217
+ * stop's (`AbortReceipt.settledAtMs`), all built the same way.
218
+ * * EVERY observation has a maximum age, and past it decides nothing at all in
219
+ * either direction: `SERVER_OBSERVATION_MAX_MS`, `STREAM_OBSERVATION_MAX_MS`,
220
+ * `INBOX_OBSERVATION_MAX_MS`. An observation the poll has failed to refresh
221
+ * for that long is not evidence, and standing on one is the latch. Callers
222
+ * must re-evaluate at those instants — see `workingExpiryAtMs`.
223
+ */
224
+ export declare function projectWorking(inputs: WorkingInputs): WorkingProjection;
225
+ /**
226
+ * The next instant at which `projectWorking` could answer differently on its
227
+ * own — i.e. when the OLDEST-lived input ages past its bound.
228
+ *
229
+ * The projection is pure and moves with `nowMs`, which means something has to
230
+ * ask it again at that instant or the bound is never applied. Nothing did: the
231
+ * hook re-renders when react-query hands it new `data`, and a run of failed
232
+ * reads hands back the SAME retained `data` — the observer does not even
233
+ * notify. `SERVER_OBSERVATION_MAX_MS` was therefore evaluated only on renders
234
+ * that happened for some unrelated reason, and in the exact outage it was
235
+ * written for (one success, then a run of 503s) there are none.
236
+ *
237
+ * `null` when nothing is left to expire. Deadlines already in the past are
238
+ * skipped, so re-arming from the timer this returns terminates.
239
+ */
240
+ export declare function workingExpiryAtMs(inputs: WorkingInputs): number | null;
241
+ //# sourceMappingURL=working.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"working.d.ts","sourceRoot":"","sources":["../../../src/core/session/working.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,gBAAgB,EACjB,MAAM,kCAAkC,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAC;AAE/D,MAAM,WAAW,iBAAiB;IAChC,KAAK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AM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;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,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,SAAS,aAAa,EAAE,GAAG,MAAM,CAO/E;AASD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,iBAAiB,CAmHvE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,GAAG,IAAI,CAetE"}
@@ -0,0 +1,261 @@
1
+ /**
2
+ * How long an unanswered optimistic receipt may claim `working` on its own.
3
+ *
4
+ * Bounded because a send whose response never arrives must not latch the UI —
5
+ * the failure this whole phase exists to end. Released the moment a server
6
+ * source that CAN know about the send answers; the cap only covers the case
7
+ * where none ever does.
8
+ */
9
+ export const OPTIMISTIC_RECEIPT_MAX_MS = 60_000;
10
+ /**
11
+ * How long a server observation keeps deciding anything.
12
+ *
13
+ * `useSessionWorking` polls `GET .../turn` every 5s while working and every
14
+ * 15s while idle, and react-query hands back the last SUCCESSFUL read for as
15
+ * long as the ones after it fail. Without this bound, one successful read of an
16
+ * open turn followed by a dev-api 503, an expired JWT, or a closed laptop lid
17
+ * pinned the composer on "working" for the lifetime of the tab — literally the
18
+ * reported bug. Three idle cadences is long enough that an ordinary retry or a
19
+ * backgrounded tab never trips it, and short enough that a dead poll stops
20
+ * being believed.
21
+ */
22
+ export const SERVER_OBSERVATION_MAX_MS = 45_000;
23
+ /**
24
+ * How long a status frame keeps deciding anything.
25
+ *
26
+ * The stream needs its own bound for the same reason the server read does, and
27
+ * the failure it covers is the SAME one: the SSE stream reaches this tab
28
+ * through the API that serves `/turn`, so when that API drains they stop
29
+ * together. The stream does not go `null` when it stops — the last `busy`
30
+ * frame this tab ever observed stays in the store — so bounding only the
31
+ * server read moved the latch one source over instead of ending it.
32
+ *
33
+ * Equal to the server bound on purpose: while the API answers at all, a fresh
34
+ * `/turn` read decides and this bound is never reached; once it stops
35
+ * answering, both observations are equally blind and neither may stand.
36
+ */
37
+ export const STREAM_OBSERVATION_MAX_MS = 45_000;
38
+ /**
39
+ * How long ONE reading of the durable inbox keeps deciding.
40
+ *
41
+ * Three cadences of the prompt list's own poll (3s), not of `/turn`'s. A
42
+ * reading says "the server still intends to run N rows", and that claim decays
43
+ * fast: the row it counted may already have been delivered, run, and finished.
44
+ * Held for the server bound instead, a finished prompt left the composer on
45
+ * Stop with its reply on screen for up to 45s.
46
+ */
47
+ export const INBOX_OBSERVATION_MAX_MS = 10_000;
48
+ /**
49
+ * How long a stop this tab issued may bar a server read from reporting the
50
+ * turn it is ending.
51
+ *
52
+ * Bounded for the same reason the send receipt is, in the other direction: an
53
+ * abort whose acknowledgement never comes must not pin the composer on `idle`
54
+ * over a turn that is genuinely still running. Generous next to the ~1.6s a
55
+ * cancel takes to reach the daemon, and far below the send receipt's cap
56
+ * because the evidence arrives sooner.
57
+ */
58
+ export const OPTIMISTIC_ABORT_MAX_MS = 15_000;
59
+ /**
60
+ * How many inbox rows are work the server still intends to run.
61
+ *
62
+ * `held` is excluded on purpose: it is the Stop button's own state — the row
63
+ * stays, deliberately not due, until the user sends something or presses "send
64
+ * now". Counting it would leave the composer on Stop with nothing running.
65
+ * `failed` is excluded for the same reason in the other direction: it is over.
66
+ */
67
+ export function countLiveInboxPrompts(prompts) {
68
+ let live = 0;
69
+ for (const prompt of prompts) {
70
+ if (prompt.state === 'queued' || prompt.state === 'delivering')
71
+ live += 1;
72
+ else if (prompt.state === 'waiting' && prompt.reason !== 'held')
73
+ live += 1;
74
+ }
75
+ return live;
76
+ }
77
+ /** ms epoch, or null for an absent/unparseable instant. */
78
+ function instant(value) {
79
+ if (!value)
80
+ return null;
81
+ const parsed = Date.parse(value);
82
+ return Number.isNaN(parsed) ? null : parsed;
83
+ }
84
+ /**
85
+ * The one place a session's working state is decided.
86
+ *
87
+ * Pure, so every rule below is asserted rather than observed by hand. No
88
+ * timers, no latch, no fabricated `SessionStatus` write — a caller that wants
89
+ * to re-evaluate simply calls again with a newer `nowMs`.
90
+ *
91
+ * Precedence:
92
+ *
93
+ * 1. The server is holding a turn open, and no NEWER stream frame contradicts
94
+ * it → working. `GET .../turn` reads the lifecycle authority rather than the
95
+ * ledger, so it is the strongest answer there is — but it is still a read
96
+ * taken at an instant, and an SSE frame from after that instant knows more.
97
+ * 2. The server holds durable inbox rows for this session → working. A prompt
98
+ * is accepted long before it is a turn: the row has to be drained, the box
99
+ * may have to resume (18.9s Daytona / 24.5s Platinum, measured), and only
100
+ * then does `beginSandboxTurn` run. "No turn is running" and "nothing of
101
+ * yours is in flight" stopped being the same statement when the inbox
102
+ * landed.
103
+ * 3. The server says no turns, and its read is at least as new as the stream's
104
+ * last frame → idle. (A dropped end-of-turn frame is exactly why the server
105
+ * has to be able to outrank a stale stream busy.)
106
+ * 4. The stream's own frame decides.
107
+ * 5. A live optimistic receipt → working.
108
+ * 6. Nothing observed → idle.
109
+ *
110
+ * With TWO cross-cutting freshness rules:
111
+ *
112
+ * * An observation that could not yet know about a live LOCAL action cannot
113
+ * answer for it — the send's floors (`SendReceipt.acceptedAtMs`) and the
114
+ * stop's (`AbortReceipt.settledAtMs`), all built the same way.
115
+ * * EVERY observation has a maximum age, and past it decides nothing at all in
116
+ * either direction: `SERVER_OBSERVATION_MAX_MS`, `STREAM_OBSERVATION_MAX_MS`,
117
+ * `INBOX_OBSERVATION_MAX_MS`. An observation the poll has failed to refresh
118
+ * for that long is not evidence, and standing on one is the latch. Callers
119
+ * must re-evaluate at those instants — see `workingExpiryAtMs`.
120
+ */
121
+ export function projectWorking(inputs) {
122
+ const { optimistic, abort, inbox, server, stream, nowMs } = inputs;
123
+ const receiptLive = !!optimistic && nowMs - optimistic.atMs < OPTIMISTIC_RECEIPT_MAX_MS;
124
+ // TWO floors, because the two server-side observers have different knowledge.
125
+ //
126
+ // `GET .../turn` reads the control plane's ledger, and there is NO row in it
127
+ // until `POST .../prompts` returns. A read issued in that window is stamped
128
+ // after the receipt and still provably cannot see the send, so it may not
129
+ // answer for it at all — hence the infinity while `acceptedAtMs` is null.
130
+ //
131
+ // The SSE stream is the RUNTIME's own voice, and the store stamps a frame
132
+ // when this tab observed it — which only moves when the frame itself changes.
133
+ // So a frame stamped after the send is a NEW transition, not a stale reading,
134
+ // and it is the freshest thing there is. Blocking it too would leave a
135
+ // command's receipt (nothing ever "accepts" a command) claiming `working` for
136
+ // a full minute after its turn had visibly ended.
137
+ const serverFloor = receiptLive
138
+ ? (optimistic.acceptedAtMs ?? Number.POSITIVE_INFINITY)
139
+ : Number.NEGATIVE_INFINITY;
140
+ const streamFloor = receiptLive ? optimistic.atMs : Number.NEGATIVE_INFINITY;
141
+ // The stop's floor, built exactly like the send's. A `/turn` read issued
142
+ // before the cancel was ACKNOWLEDGED still reports the turn the cancel is
143
+ // ending, so it may not report `working` from it — the read is honest and
144
+ // out of date. Infinite while the acknowledgement is outstanding, and gone
145
+ // entirely once the receipt ages out, so a cancel nobody answers cannot pin
146
+ // the composer on idle over a turn that is really still running.
147
+ const abortLive = !!abort && nowMs - abort.atMs < OPTIMISTIC_ABORT_MAX_MS;
148
+ const abortFloor = abortLive
149
+ ? (abort.settledAtMs ?? Number.POSITIVE_INFINITY)
150
+ : Number.NEGATIVE_INFINITY;
151
+ const serverFresh = !!server && nowMs - server.atMs <= SERVER_OBSERVATION_MAX_MS;
152
+ const streamFresh = !!stream && nowMs - stream.atMs <= STREAM_OBSERVATION_MAX_MS;
153
+ const inboxFresh = !!inbox && nowMs - inbox.atMs <= INBOX_OBSERVATION_MAX_MS;
154
+ const openTurn = serverFresh ? server.turns[0] : undefined;
155
+ const serverOpenTurnToken = openTurn?.turn_token ?? null;
156
+ // A turn the authority is holding open, unless the stream has since said the
157
+ // session went idle. The stream frame is newer BY OBSERVATION, and the daemon
158
+ // relays `turn_end` to the control plane at the same moment the frame is
159
+ // emitted — so a fresher idle frame means this read is simply out of date.
160
+ if (openTurn && server.atMs >= abortFloor && (!stream || server.atMs >= stream.atMs)) {
161
+ return {
162
+ state: 'working',
163
+ source: 'server',
164
+ turnId: openTurn.message_id,
165
+ since: instant(openTurn.started_at) ?? server.atMs,
166
+ serverOpenTurnToken,
167
+ };
168
+ }
169
+ // Durable rows outrank an idle read: the read is right that no TURN is
170
+ // running and wrong that nothing is happening.
171
+ if (inboxFresh && inbox.pending > 0) {
172
+ return {
173
+ state: 'working',
174
+ source: 'server',
175
+ turnId: null,
176
+ since: inbox.atMs,
177
+ serverOpenTurnToken,
178
+ };
179
+ }
180
+ const serverAnswers = serverFresh && !openTurn && server.atMs >= serverFloor;
181
+ const streamAnswers = streamFresh && stream.atMs >= streamFloor;
182
+ if (serverAnswers && (!stream || server.atMs >= stream.atMs)) {
183
+ return {
184
+ state: 'idle',
185
+ source: 'server',
186
+ turnId: null,
187
+ since: instant(server.lastEnded?.ended_at) ?? server.atMs,
188
+ serverOpenTurnToken,
189
+ };
190
+ }
191
+ if (streamAnswers) {
192
+ return {
193
+ state: stream.type === 'idle' ? 'idle' : 'working',
194
+ source: 'stream',
195
+ turnId: null,
196
+ since: stream.atMs,
197
+ serverOpenTurnToken,
198
+ };
199
+ }
200
+ if (receiptLive) {
201
+ return {
202
+ state: 'working',
203
+ source: 'optimistic',
204
+ turnId: optimistic.messageId,
205
+ since: optimistic.atMs,
206
+ serverOpenTurnToken,
207
+ };
208
+ }
209
+ // Nothing has answered. Idle is the only honest default: a session is not
210
+ // working because a page failed to ask.
211
+ const newest = server && stream
212
+ ? server.atMs >= stream.atMs
213
+ ? { source: 'server', atMs: server.atMs }
214
+ : { source: 'stream', atMs: stream.atMs }
215
+ : server
216
+ ? { source: 'server', atMs: server.atMs }
217
+ : stream
218
+ ? { source: 'stream', atMs: stream.atMs }
219
+ : { source: 'server', atMs: nowMs };
220
+ return {
221
+ state: 'idle',
222
+ source: newest.source,
223
+ turnId: null,
224
+ since: newest.atMs,
225
+ serverOpenTurnToken,
226
+ };
227
+ }
228
+ /**
229
+ * The next instant at which `projectWorking` could answer differently on its
230
+ * own — i.e. when the OLDEST-lived input ages past its bound.
231
+ *
232
+ * The projection is pure and moves with `nowMs`, which means something has to
233
+ * ask it again at that instant or the bound is never applied. Nothing did: the
234
+ * hook re-renders when react-query hands it new `data`, and a run of failed
235
+ * reads hands back the SAME retained `data` — the observer does not even
236
+ * notify. `SERVER_OBSERVATION_MAX_MS` was therefore evaluated only on renders
237
+ * that happened for some unrelated reason, and in the exact outage it was
238
+ * written for (one success, then a run of 503s) there are none.
239
+ *
240
+ * `null` when nothing is left to expire. Deadlines already in the past are
241
+ * skipped, so re-arming from the timer this returns terminates.
242
+ */
243
+ export function workingExpiryAtMs(inputs) {
244
+ const { optimistic, abort, inbox, server, stream, nowMs } = inputs;
245
+ const deadlines = [
246
+ optimistic ? optimistic.atMs + OPTIMISTIC_RECEIPT_MAX_MS : null,
247
+ abort ? abort.atMs + OPTIMISTIC_ABORT_MAX_MS : null,
248
+ inbox ? inbox.atMs + INBOX_OBSERVATION_MAX_MS : null,
249
+ server ? server.atMs + SERVER_OBSERVATION_MAX_MS : null,
250
+ stream ? stream.atMs + STREAM_OBSERVATION_MAX_MS : null,
251
+ ];
252
+ let next = null;
253
+ for (const deadline of deadlines) {
254
+ if (deadline === null || deadline <= nowMs)
255
+ continue;
256
+ if (next === null || deadline < next)
257
+ next = deadline;
258
+ }
259
+ return next;
260
+ }
261
+ //# sourceMappingURL=working.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"working.js","sourceRoot":"","sources":["../../../src/core/session/working.ts"],"names":[],"mappings":"AAsDA;;;;;;;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;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC;AAgF9C;;;;;;;GAOG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAiC;IACrE,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,KAAK,KAAK,YAAY;YAAE,IAAI,IAAI,CAAC,CAAC;aACrE,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM;YAAE,IAAI,IAAI,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,2DAA2D;AAC3D,SAAS,OAAO,CAAC,KAAgC;IAC/C,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IACxB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;AAC9C,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,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
+ /**
23
+ * Transcript state, and nothing else.
24
+ *
25
+ * This snapshot used to carry `isPromptObservedBusy` — a busy OPINION inferred
26
+ * from silence by a phase machine with a stall timer, a retry budget and an
27
+ * epoch counter. It was one of four disagreeing answers to "is this session
28
+ * working?", and the one that latched: every signal that could release it
29
+ * (`session.idle`, a status frame, the poll) can be lost, and losing them left
30
+ * the composer pinned on "stop" until the user reloaded. The answer now comes
31
+ * from `projectWorking` over the server's own turn authority
32
+ * (`core/session/working.ts`), so this controller holds no opinion about it.
33
+ */
22
34
  export interface SessionSyncSnapshot {
23
35
  freshness: SessionSyncFreshness;
24
36
  hasOlder: boolean;
25
37
  isLoadingOlder: boolean;
26
- /** True while an accepted REST prompt has not reached stable runtime idle. */
27
- isPromptObservedBusy?: boolean;
28
38
  }
29
39
  export interface SessionSyncScheduler {
30
40
  now: () => number;
@@ -47,9 +57,23 @@ export interface SessionSyncControllerOptions {
47
57
  limit: number;
48
58
  before?: string;
49
59
  }) => Promise<SessionSyncPage>;
60
+ /**
61
+ * @deprecated Never called. The liveness poll no longer reads status: `GET
62
+ * .../turn` is the status authority, and this controller's own `setBusy` is
63
+ * already driven FROM that projection, so a status read here could only
64
+ * confirm or latch — never correct. Retained (ignored) because 0.12.8
65
+ * published it on this options type; removed in the next major.
66
+ */
50
67
  loadStatus?: () => Promise<SessionStatus>;
51
68
  hydrate: (messages: SessionSyncMessage[]) => void;
52
69
  markLoaded: () => void;
70
+ /**
71
+ * @deprecated Never called. Writing a REST poll's answer into the slot SSE
72
+ * status frames land in made a poll indistinguishable from the runtime's own
73
+ * voice, and re-stamped the stream observation on every tick so its age
74
+ * bound was never reached. Retained (ignored) because 0.12.8 published it;
75
+ * removed in the next major.
76
+ */
53
77
  setStatus?: (status: SessionStatus) => void;
54
78
  onTelemetry?: (event: SessionSyncTelemetryEvent) => void;
55
79
  scheduler?: SessionSyncScheduler;
@@ -81,8 +105,6 @@ export declare class SessionSyncController {
81
105
  private tailRequest;
82
106
  private olderRequest;
83
107
  private livenessTimer;
84
- private promptSettlementTimer;
85
- private promptObservationPhase;
86
108
  private lastActivityAt;
87
109
  private listeners;
88
110
  private destroyed;
@@ -94,19 +116,13 @@ export declare class SessionSyncController {
94
116
  loadOlder: () => Promise<void>;
95
117
  noteActivity(): void;
96
118
  /**
97
- * Start monotonic completion observation for an accepted REST prompt.
119
+ * Switch the liveness poll on or off.
98
120
  *
99
- * OpenCode can publish an idle snapshot from before the prompt and publish
100
- * the real busy event later. Keep the public projection busy until real work
101
- * starts and the following idle state remains quiet.
121
+ * NOT an opinion about whether the session is working that answer belongs
122
+ * to `projectWorking` alone. This only says whether anyone still needs the
123
+ * transcript refreshed behind the SSE stream: a caller passes the working
124
+ * state it already has, and the last consumer leaving passes `false`.
102
125
  */
103
- beginPromptObservation(): void;
104
- /** Observe an authoritative runtime status from SSE or status reconciliation. */
105
- observePromptStatus(status: SessionStatus): void;
106
- /** Mark assistant output as proof that the accepted prompt started. */
107
- observePromptActivity(): void;
108
- /** End observation after rejection, cancellation, or a terminal runtime error. */
109
- endPromptObservation(): void;
110
126
  setBusy(isBusy: boolean): void;
111
127
  destroy(): void;
112
128
  private loadTail;
@@ -115,13 +131,12 @@ export declare class SessionSyncController {
115
131
  private loadCompleteTurn;
116
132
  private rememberUserMessages;
117
133
  private checkLiveness;
118
- private containsNewPromptReply;
119
- private reconcileStatus;
134
+ /** Resolve when `work` settles, or when `timeoutMs` elapses — whichever first. */
135
+ private raceDeadline;
120
136
  private setCursor;
121
137
  private stopLivenessTimer;
122
- private markPromptRunning;
123
- private schedulePromptSettlement;
124
- private clearPromptSettlementTimer;
138
+ private startTimer;
139
+ private cancelTimer;
125
140
  private update;
126
141
  }
127
142
  export {};
@@ -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,4BAA4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,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI;IAUhD,uEAAuE;IACvE,qBAAqB,IAAI,IAAI;IAK7B,kFAAkF;IAClF,oBAAoB,IAAI,IAAI;IAO5B,OAAO,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAa9B,OAAO,IAAI,IAAI;YAOD,QAAQ;YAuBR,QAAQ;YA+BR,qBAAqB;YAKrB,gBAAgB;IA4C9B,OAAO,CAAC,oBAAoB;YAQd,aAAa;IAY3B,OAAO,CAAC,sBAAsB;YAmBhB,eAAe;IAS7B,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,iBAAiB;IAKzB,OAAO,CAAC,wBAAwB;IAgBhC,OAAO,CAAC,0BAA0B;IAUlC,OAAO,CAAC,MAAM;CAaf"}
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;AAE/E;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,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,E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