aicodeman 1.2.2 → 1.3.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 (227) hide show
  1. package/README.md +264 -90
  2. package/dist/attachment-magic.d.ts +13 -0
  3. package/dist/attachment-magic.d.ts.map +1 -1
  4. package/dist/attachment-magic.js +47 -0
  5. package/dist/attachment-magic.js.map +1 -1
  6. package/dist/attachment-registry.d.ts.map +1 -1
  7. package/dist/attachment-registry.js +13 -2
  8. package/dist/attachment-registry.js.map +1 -1
  9. package/dist/config/buffer-limits.d.ts +1 -2
  10. package/dist/config/buffer-limits.d.ts.map +1 -1
  11. package/dist/config/buffer-limits.js +1 -2
  12. package/dist/config/buffer-limits.js.map +1 -1
  13. package/dist/config/map-limits.d.ts +11 -0
  14. package/dist/config/map-limits.d.ts.map +1 -1
  15. package/dist/config/map-limits.js +11 -0
  16. package/dist/config/map-limits.js.map +1 -1
  17. package/dist/config/server-timing.d.ts +6 -0
  18. package/dist/config/server-timing.d.ts.map +1 -1
  19. package/dist/config/server-timing.js +9 -0
  20. package/dist/config/server-timing.js.map +1 -1
  21. package/dist/config/terminal-history.d.ts +11 -6
  22. package/dist/config/terminal-history.d.ts.map +1 -1
  23. package/dist/config/terminal-history.js +18 -8
  24. package/dist/config/terminal-history.js.map +1 -1
  25. package/dist/cron/cron-input.d.ts +30 -0
  26. package/dist/cron/cron-input.d.ts.map +1 -0
  27. package/dist/cron/cron-input.js +7 -0
  28. package/dist/cron/cron-input.js.map +1 -0
  29. package/dist/cron/cron-service.d.ts +92 -0
  30. package/dist/cron/cron-service.d.ts.map +1 -0
  31. package/dist/cron/cron-service.js +606 -0
  32. package/dist/cron/cron-service.js.map +1 -0
  33. package/dist/cron/cron-time.d.ts +29 -0
  34. package/dist/cron/cron-time.d.ts.map +1 -0
  35. package/dist/cron/cron-time.js +87 -0
  36. package/dist/cron/cron-time.js.map +1 -0
  37. package/dist/document-thumbnailer.d.ts +1 -1
  38. package/dist/document-thumbnailer.d.ts.map +1 -1
  39. package/dist/document-thumbnailer.js +11 -2
  40. package/dist/document-thumbnailer.js.map +1 -1
  41. package/dist/generated-artifact-attachments.d.ts +26 -0
  42. package/dist/generated-artifact-attachments.d.ts.map +1 -0
  43. package/dist/generated-artifact-attachments.js +61 -0
  44. package/dist/generated-artifact-attachments.js.map +1 -0
  45. package/dist/index.js +11 -0
  46. package/dist/index.js.map +1 -1
  47. package/dist/mux-interface.d.ts +31 -5
  48. package/dist/mux-interface.d.ts.map +1 -1
  49. package/dist/remote-hosts.d.ts +66 -0
  50. package/dist/remote-hosts.d.ts.map +1 -0
  51. package/dist/remote-hosts.js +198 -0
  52. package/dist/remote-hosts.js.map +1 -0
  53. package/dist/services/unified-session-service.d.ts +115 -0
  54. package/dist/services/unified-session-service.d.ts.map +1 -0
  55. package/dist/services/unified-session-service.js +173 -0
  56. package/dist/services/unified-session-service.js.map +1 -0
  57. package/dist/session-cli-builder.d.ts +3 -1
  58. package/dist/session-cli-builder.d.ts.map +1 -1
  59. package/dist/session-cli-builder.js +26 -7
  60. package/dist/session-cli-builder.js.map +1 -1
  61. package/dist/session-pty-exit-breaker.d.ts +66 -0
  62. package/dist/session-pty-exit-breaker.d.ts.map +1 -0
  63. package/dist/session-pty-exit-breaker.js +77 -0
  64. package/dist/session-pty-exit-breaker.js.map +1 -0
  65. package/dist/session.d.ts +24 -1
  66. package/dist/session.d.ts.map +1 -1
  67. package/dist/session.js +94 -11
  68. package/dist/session.js.map +1 -1
  69. package/dist/state-store.d.ts +14 -0
  70. package/dist/state-store.d.ts.map +1 -1
  71. package/dist/state-store.js +49 -0
  72. package/dist/state-store.js.map +1 -1
  73. package/dist/tmux-manager.d.ts +94 -8
  74. package/dist/tmux-manager.d.ts.map +1 -1
  75. package/dist/tmux-manager.js +222 -26
  76. package/dist/tmux-manager.js.map +1 -1
  77. package/dist/types/api.d.ts +11 -0
  78. package/dist/types/api.d.ts.map +1 -1
  79. package/dist/types/api.js.map +1 -1
  80. package/dist/types/app-state.d.ts +5 -0
  81. package/dist/types/app-state.d.ts.map +1 -1
  82. package/dist/types/app-state.js.map +1 -1
  83. package/dist/types/cron.d.ts +88 -0
  84. package/dist/types/cron.d.ts.map +1 -0
  85. package/dist/types/cron.js +13 -0
  86. package/dist/types/cron.js.map +1 -0
  87. package/dist/types/session.d.ts +57 -0
  88. package/dist/types/session.d.ts.map +1 -1
  89. package/dist/types/session.js.map +1 -1
  90. package/dist/web/heic-jpeg-converter.d.ts +24 -0
  91. package/dist/web/heic-jpeg-converter.d.ts.map +1 -0
  92. package/dist/web/heic-jpeg-converter.js +76 -0
  93. package/dist/web/heic-jpeg-converter.js.map +1 -0
  94. package/dist/web/heic-jpeg-worker.d.ts +44 -0
  95. package/dist/web/heic-jpeg-worker.d.ts.map +1 -0
  96. package/dist/web/heic-jpeg-worker.js +78 -0
  97. package/dist/web/heic-jpeg-worker.js.map +1 -0
  98. package/dist/web/ports/cron-port.d.ts +9 -0
  99. package/dist/web/ports/cron-port.d.ts.map +1 -0
  100. package/dist/web/ports/cron-port.js +6 -0
  101. package/dist/web/ports/cron-port.js.map +1 -0
  102. package/dist/web/ports/index.d.ts +1 -0
  103. package/dist/web/ports/index.d.ts.map +1 -1
  104. package/dist/web/public/api-client.c9b1cddc.js.gz +0 -0
  105. package/dist/web/public/app.b0534652.js +38 -0
  106. package/dist/web/public/app.b0534652.js.br +0 -0
  107. package/dist/web/public/app.b0534652.js.gz +0 -0
  108. package/dist/web/public/{constants.1c779517.js → constants.5b18ed64.js} +65 -0
  109. package/dist/web/public/constants.5b18ed64.js.br +0 -0
  110. package/dist/web/public/constants.5b18ed64.js.gz +0 -0
  111. package/dist/web/public/cron-ui.js +328 -0
  112. package/dist/web/public/cron-ui.js.br +0 -0
  113. package/dist/web/public/cron-ui.js.gz +0 -0
  114. package/dist/web/public/image-input.ee16ad88.js.gz +0 -0
  115. package/dist/web/public/index.html +313 -25
  116. package/dist/web/public/index.html.br +0 -0
  117. package/dist/web/public/index.html.gz +0 -0
  118. package/dist/web/public/input-cjk.63794d0b.js +1 -0
  119. package/dist/web/public/input-cjk.63794d0b.js.br +0 -0
  120. package/dist/web/public/input-cjk.63794d0b.js.gz +0 -0
  121. package/dist/web/public/keyboard-accessory.3f91acef.js.gz +0 -0
  122. package/dist/web/public/mobile-handlers.b5a667ef.js.gz +0 -0
  123. package/dist/web/public/mobile.0644e3ac.css +1 -0
  124. package/dist/web/public/mobile.0644e3ac.css.br +0 -0
  125. package/dist/web/public/mobile.0644e3ac.css.gz +0 -0
  126. package/dist/web/public/notification-manager.ca9dc40d.js.gz +0 -0
  127. package/dist/web/public/orchestrator-panel.js.gz +0 -0
  128. package/dist/web/public/{panels-ui.772e92c9.js → panels-ui.ca03853f.js} +25 -17
  129. package/dist/web/public/panels-ui.ca03853f.js.br +0 -0
  130. package/dist/web/public/panels-ui.ca03853f.js.gz +0 -0
  131. package/dist/web/public/ralph-panel.6de2d0f8.js.gz +0 -0
  132. package/dist/web/public/ralph-wizard.13a1831e.js.gz +0 -0
  133. package/dist/web/public/respawn-ui.2d249da9.js.gz +0 -0
  134. package/dist/web/public/sanitize-html.bc7078d6.js.gz +0 -0
  135. package/dist/web/public/session-ui.b51814ef.js +49 -0
  136. package/dist/web/public/session-ui.b51814ef.js.br +0 -0
  137. package/dist/web/public/session-ui.b51814ef.js.gz +0 -0
  138. package/dist/web/public/settings-ui.6c67c125.js +67 -0
  139. package/dist/web/public/settings-ui.6c67c125.js.br +0 -0
  140. package/dist/web/public/settings-ui.6c67c125.js.gz +0 -0
  141. package/dist/web/public/styles.be7d626b.css +1 -0
  142. package/dist/web/public/styles.be7d626b.css.br +0 -0
  143. package/dist/web/public/styles.be7d626b.css.gz +0 -0
  144. package/dist/web/public/subagent-windows.69b60c35.js.gz +0 -0
  145. package/dist/web/public/sw.js.gz +0 -0
  146. package/dist/web/public/terminal-ui.dbf141fa.js +3 -0
  147. package/dist/web/public/terminal-ui.dbf141fa.js.br +0 -0
  148. package/dist/web/public/terminal-ui.dbf141fa.js.gz +0 -0
  149. package/dist/web/public/ultracode-panel.js.gz +0 -0
  150. package/dist/web/public/ultracode-windows.js.gz +0 -0
  151. package/dist/web/public/upload.html.gz +0 -0
  152. package/dist/web/public/vendor/dompurify.min.js.gz +0 -0
  153. package/dist/web/public/vendor/marked.min.js.gz +0 -0
  154. package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
  155. package/dist/web/public/vendor/xterm-addon-serialize.min.js.gz +0 -0
  156. package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
  157. package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
  158. package/dist/web/public/vendor/xterm-zerolag-input.137ad9f0.js.gz +0 -0
  159. package/dist/web/public/vendor/xterm.css.gz +0 -0
  160. package/dist/web/public/vendor/xterm.min.js.gz +0 -0
  161. package/dist/web/public/voice-input.085e9e73.js.gz +0 -0
  162. package/dist/web/routes/case-routes.d.ts.map +1 -1
  163. package/dist/web/routes/case-routes.js +115 -1
  164. package/dist/web/routes/case-routes.js.map +1 -1
  165. package/dist/web/routes/cron-routes.d.ts +11 -0
  166. package/dist/web/routes/cron-routes.d.ts.map +1 -0
  167. package/dist/web/routes/cron-routes.js +70 -0
  168. package/dist/web/routes/cron-routes.js.map +1 -0
  169. package/dist/web/routes/index.d.ts +1 -0
  170. package/dist/web/routes/index.d.ts.map +1 -1
  171. package/dist/web/routes/index.js +1 -0
  172. package/dist/web/routes/index.js.map +1 -1
  173. package/dist/web/routes/respawn-routes.d.ts.map +1 -1
  174. package/dist/web/routes/respawn-routes.js +3 -0
  175. package/dist/web/routes/respawn-routes.js.map +1 -1
  176. package/dist/web/routes/session-routes.d.ts.map +1 -1
  177. package/dist/web/routes/session-routes.js +610 -68
  178. package/dist/web/routes/session-routes.js.map +1 -1
  179. package/dist/web/routes/ws-routes.d.ts.map +1 -1
  180. package/dist/web/routes/ws-routes.js +56 -17
  181. package/dist/web/routes/ws-routes.js.map +1 -1
  182. package/dist/web/schemas.d.ts +113 -0
  183. package/dist/web/schemas.d.ts.map +1 -1
  184. package/dist/web/schemas.js +145 -0
  185. package/dist/web/schemas.js.map +1 -1
  186. package/dist/web/server.d.ts +8 -2
  187. package/dist/web/server.d.ts.map +1 -1
  188. package/dist/web/server.js +75 -13
  189. package/dist/web/server.js.map +1 -1
  190. package/dist/web/session-listener-wiring.d.ts +5 -1
  191. package/dist/web/session-listener-wiring.d.ts.map +1 -1
  192. package/dist/web/session-listener-wiring.js +23 -1
  193. package/dist/web/session-listener-wiring.js.map +1 -1
  194. package/dist/web/sse-events.d.ts +15 -0
  195. package/dist/web/sse-events.d.ts.map +1 -1
  196. package/dist/web/sse-events.js +17 -0
  197. package/dist/web/sse-events.js.map +1 -1
  198. package/dist/web/ws-connection-registry.d.ts +77 -0
  199. package/dist/web/ws-connection-registry.d.ts.map +1 -0
  200. package/dist/web/ws-connection-registry.js +99 -0
  201. package/dist/web/ws-connection-registry.js.map +1 -0
  202. package/package.json +3 -1
  203. package/dist/web/public/app.a8d73c32.js +0 -38
  204. package/dist/web/public/app.a8d73c32.js.br +0 -0
  205. package/dist/web/public/app.a8d73c32.js.gz +0 -0
  206. package/dist/web/public/constants.1c779517.js.br +0 -0
  207. package/dist/web/public/constants.1c779517.js.gz +0 -0
  208. package/dist/web/public/input-cjk.4e950e0a.js +0 -1
  209. package/dist/web/public/input-cjk.4e950e0a.js.br +0 -0
  210. package/dist/web/public/input-cjk.4e950e0a.js.gz +0 -0
  211. package/dist/web/public/mobile.8a9aff7a.css +0 -1
  212. package/dist/web/public/mobile.8a9aff7a.css.br +0 -0
  213. package/dist/web/public/mobile.8a9aff7a.css.gz +0 -0
  214. package/dist/web/public/panels-ui.772e92c9.js.br +0 -0
  215. package/dist/web/public/panels-ui.772e92c9.js.gz +0 -0
  216. package/dist/web/public/session-ui.da3e53f2.js +0 -36
  217. package/dist/web/public/session-ui.da3e53f2.js.br +0 -0
  218. package/dist/web/public/session-ui.da3e53f2.js.gz +0 -0
  219. package/dist/web/public/settings-ui.38feb956.js +0 -61
  220. package/dist/web/public/settings-ui.38feb956.js.br +0 -0
  221. package/dist/web/public/settings-ui.38feb956.js.gz +0 -0
  222. package/dist/web/public/styles.1b3e6147.css +0 -1
  223. package/dist/web/public/styles.1b3e6147.css.br +0 -0
  224. package/dist/web/public/styles.1b3e6147.css.gz +0 -0
  225. package/dist/web/public/terminal-ui.865f21f6.js +0 -3
  226. package/dist/web/public/terminal-ui.865f21f6.js.br +0 -0
  227. package/dist/web/public/terminal-ui.865f21f6.js.gz +0 -0
@@ -0,0 +1,66 @@
1
+ /**
2
+ * @fileoverview Circuit breaker bounding repeated non-zero interactive-PTY exits (COD-118).
3
+ *
4
+ * Defense-in-depth after COD-115: if the interactive PTY exits non-zero repeatedly,
5
+ * external recovery/reconnect paths recreate it indefinitely (COD-115 observed 114
6
+ * `exited with code: 1` events + orphan sessions). This breaker tracks recent
7
+ * non-zero exits within a sliding window and "trips" once they exceed a threshold,
8
+ * so the Session can refuse to respawn and surface an error state instead of looping.
9
+ *
10
+ * Design notes:
11
+ * - PURE + dependency-free. Time is INJECTED (`nowMs` passed to `recordExit`); the
12
+ * breaker never calls `Date.now()` itself, so trip/window logic is deterministically
13
+ * unit-testable with no real timers.
14
+ * - A clean (exit code 0) exit resets the counter — a session that exited normally is
15
+ * not on a crash-loop. (It does NOT clear an already-tripped breaker; only an explicit
16
+ * `reset()` — e.g. a user-initiated restart — does that.)
17
+ * - Once tripped, stays tripped until `reset()`.
18
+ *
19
+ * @consumedby session (instantiates one per session; records exits in the interactive
20
+ * PTY `onExit` handler; gates `startInteractive()` when tripped; `reset()` on restart)
21
+ * @module session-pty-exit-breaker
22
+ */
23
+ /** Non-zero interactive-PTY exits within the window required to trip the breaker. */
24
+ export declare const DEFAULT_BREAKER_THRESHOLD = 5;
25
+ /** Sliding window (ms) over which non-zero exits accumulate toward the threshold. */
26
+ export declare const DEFAULT_BREAKER_WINDOW_MS = 10000;
27
+ export interface InteractivePtyExitBreakerOptions {
28
+ /** Trip after this many non-zero exits within `windowMs` (default 5). */
29
+ threshold?: number;
30
+ /** Sliding window length in ms (default 10_000). */
31
+ windowMs?: number;
32
+ }
33
+ export interface RecordExitResult {
34
+ /** True once the breaker has tripped (stays true until `reset()`). */
35
+ tripped: boolean;
36
+ /** Number of non-zero exits currently inside the window. */
37
+ count: number;
38
+ }
39
+ /**
40
+ * Sliding-window counter that trips on rapid repeated non-zero exits.
41
+ *
42
+ * 5 within 10s safely clears normal usage (a single exit, an intentional restart)
43
+ * while tripping fast on a real loop — COD-115 saw 114 exits, far above 5.
44
+ */
45
+ export declare class InteractivePtyExitBreaker {
46
+ private readonly _threshold;
47
+ private readonly _windowMs;
48
+ /** Timestamps (ms, injected) of recent non-zero exits, oldest first. */
49
+ private _exitTimes;
50
+ private _tripped;
51
+ constructor(opts?: InteractivePtyExitBreakerOptions);
52
+ /** Whether the breaker has tripped (respawn should be blocked). */
53
+ get tripped(): boolean;
54
+ /**
55
+ * Record a PTY exit. A zero (clean) exit resets the non-zero counter; a non-zero
56
+ * exit is added to the window, stale entries are evicted, and the breaker trips
57
+ * once the in-window count reaches the threshold.
58
+ *
59
+ * @param exitCode the PTY exit code (0 = clean)
60
+ * @param nowMs injected current time in ms (never read from a real clock)
61
+ */
62
+ recordExit(exitCode: number, nowMs: number): RecordExitResult;
63
+ /** Clear the tripped state and the non-zero counter (e.g. on intentional restart). */
64
+ reset(): void;
65
+ }
66
+ //# sourceMappingURL=session-pty-exit-breaker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-pty-exit-breaker.d.ts","sourceRoot":"","sources":["../src/session-pty-exit-breaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,qFAAqF;AACrF,eAAO,MAAM,yBAAyB,IAAI,CAAC;AAE3C,qFAAqF;AACrF,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAEhD,MAAM,WAAW,gCAAgC;IAC/C,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,sEAAsE;IACtE,OAAO,EAAE,OAAO,CAAC;IACjB,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,qBAAa,yBAAyB;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IAEnC,wEAAwE;IACxE,OAAO,CAAC,UAAU,CAAgB;IAElC,OAAO,CAAC,QAAQ,CAAS;gBAEb,IAAI,GAAE,gCAAqC;IAKvD,mEAAmE;IACnE,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,gBAAgB;IAoB7D,sFAAsF;IACtF,KAAK,IAAI,IAAI;CAId"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * @fileoverview Circuit breaker bounding repeated non-zero interactive-PTY exits (COD-118).
3
+ *
4
+ * Defense-in-depth after COD-115: if the interactive PTY exits non-zero repeatedly,
5
+ * external recovery/reconnect paths recreate it indefinitely (COD-115 observed 114
6
+ * `exited with code: 1` events + orphan sessions). This breaker tracks recent
7
+ * non-zero exits within a sliding window and "trips" once they exceed a threshold,
8
+ * so the Session can refuse to respawn and surface an error state instead of looping.
9
+ *
10
+ * Design notes:
11
+ * - PURE + dependency-free. Time is INJECTED (`nowMs` passed to `recordExit`); the
12
+ * breaker never calls `Date.now()` itself, so trip/window logic is deterministically
13
+ * unit-testable with no real timers.
14
+ * - A clean (exit code 0) exit resets the counter — a session that exited normally is
15
+ * not on a crash-loop. (It does NOT clear an already-tripped breaker; only an explicit
16
+ * `reset()` — e.g. a user-initiated restart — does that.)
17
+ * - Once tripped, stays tripped until `reset()`.
18
+ *
19
+ * @consumedby session (instantiates one per session; records exits in the interactive
20
+ * PTY `onExit` handler; gates `startInteractive()` when tripped; `reset()` on restart)
21
+ * @module session-pty-exit-breaker
22
+ */
23
+ /** Non-zero interactive-PTY exits within the window required to trip the breaker. */
24
+ export const DEFAULT_BREAKER_THRESHOLD = 5;
25
+ /** Sliding window (ms) over which non-zero exits accumulate toward the threshold. */
26
+ export const DEFAULT_BREAKER_WINDOW_MS = 10_000;
27
+ /**
28
+ * Sliding-window counter that trips on rapid repeated non-zero exits.
29
+ *
30
+ * 5 within 10s safely clears normal usage (a single exit, an intentional restart)
31
+ * while tripping fast on a real loop — COD-115 saw 114 exits, far above 5.
32
+ */
33
+ export class InteractivePtyExitBreaker {
34
+ _threshold;
35
+ _windowMs;
36
+ /** Timestamps (ms, injected) of recent non-zero exits, oldest first. */
37
+ _exitTimes = [];
38
+ _tripped = false;
39
+ constructor(opts = {}) {
40
+ this._threshold = opts.threshold ?? DEFAULT_BREAKER_THRESHOLD;
41
+ this._windowMs = opts.windowMs ?? DEFAULT_BREAKER_WINDOW_MS;
42
+ }
43
+ /** Whether the breaker has tripped (respawn should be blocked). */
44
+ get tripped() {
45
+ return this._tripped;
46
+ }
47
+ /**
48
+ * Record a PTY exit. A zero (clean) exit resets the non-zero counter; a non-zero
49
+ * exit is added to the window, stale entries are evicted, and the breaker trips
50
+ * once the in-window count reaches the threshold.
51
+ *
52
+ * @param exitCode the PTY exit code (0 = clean)
53
+ * @param nowMs injected current time in ms (never read from a real clock)
54
+ */
55
+ recordExit(exitCode, nowMs) {
56
+ if (exitCode === 0) {
57
+ // Clean exit: a normal stop, not a crash-loop. Clear accumulated non-zero
58
+ // exits. Does NOT un-trip an already-tripped breaker (only reset() does).
59
+ this._exitTimes = [];
60
+ return { tripped: this._tripped, count: 0 };
61
+ }
62
+ // Evict exits strictly older than the window, then record this one.
63
+ const cutoff = nowMs - this._windowMs;
64
+ this._exitTimes = this._exitTimes.filter((t) => t > cutoff);
65
+ this._exitTimes.push(nowMs);
66
+ if (this._exitTimes.length >= this._threshold) {
67
+ this._tripped = true;
68
+ }
69
+ return { tripped: this._tripped, count: this._exitTimes.length };
70
+ }
71
+ /** Clear the tripped state and the non-zero counter (e.g. on intentional restart). */
72
+ reset() {
73
+ this._exitTimes = [];
74
+ this._tripped = false;
75
+ }
76
+ }
77
+ //# sourceMappingURL=session-pty-exit-breaker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-pty-exit-breaker.js","sourceRoot":"","sources":["../src/session-pty-exit-breaker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,qFAAqF;AACrF,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAE3C,qFAAqF;AACrF,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAgBhD;;;;;GAKG;AACH,MAAM,OAAO,yBAAyB;IACnB,UAAU,CAAS;IACnB,SAAS,CAAS;IAEnC,wEAAwE;IAChE,UAAU,GAAa,EAAE,CAAC;IAE1B,QAAQ,GAAG,KAAK,CAAC;IAEzB,YAAY,OAAyC,EAAE;QACrD,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,IAAI,yBAAyB,CAAC;QAC9D,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,IAAI,yBAAyB,CAAC;IAC9D,CAAC;IAED,mEAAmE;IACnE,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED;;;;;;;OAOG;IACH,UAAU,CAAC,QAAgB,EAAE,KAAa;QACxC,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;YACnB,0EAA0E;YAC1E,0EAA0E;YAC1E,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;YACrB,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QAC9C,CAAC;QAED,oEAAoE;QACpE,MAAM,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC;QACtC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;QAC5D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE5B,IAAI,IAAI,CAAC,UAAU,CAAC,MAAM,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YAC9C,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC;QAED,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC;IACnE,CAAC;IAED,sFAAsF;IACtF,KAAK;QACH,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;QACrB,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;IACxB,CAAC;CACF"}
package/dist/session.d.ts CHANGED
@@ -28,7 +28,7 @@
28
28
  * @module session
29
29
  */
30
30
  import { EventEmitter } from 'node:events';
31
- import { SessionState, SessionStatus, SessionConfig, RalphTrackerState, RalphTodoItem, ActiveBashTool, NiceConfig, type ClaudeMode, type SessionMode, type OpenCodeConfig, type CodexConfig, type EffortLevel, type GeminiConfig } from './types.js';
31
+ import { SessionState, SessionStatus, SessionConfig, RalphTrackerState, RalphTodoItem, ActiveBashTool, NiceConfig, type ClaudeMode, type SessionMode, type OpenCodeConfig, type CodexConfig, type EffortLevel, type GeminiConfig, type SessionRemote } from './types.js';
32
32
  import type { TerminalMultiplexer, MuxSession } from './mux-interface.js';
33
33
  import { TaskTracker, type BackgroundTask } from './task-tracker.js';
34
34
  import { RalphTracker } from './ralph-tracker.js';
@@ -69,6 +69,7 @@ export declare function queryTmuxWindowSize(muxName: string, socket: string): {
69
69
  cols: number;
70
70
  rows: number;
71
71
  };
72
+ export declare function resolveMuxAttachCwd(workingDir: string, remote?: SessionRemote): string;
72
73
  /**
73
74
  * Represents a JSON message from Claude CLI's stream-json output format.
74
75
  * Messages are newline-delimited JSON objects parsed from PTY output.
@@ -146,6 +147,8 @@ export declare class Session extends EventEmitter {
146
147
  private _pid;
147
148
  private _status;
148
149
  private _currentTaskId;
150
+ private readonly _ptyExitBreaker;
151
+ private _respawnBlocked;
149
152
  private _terminalBuffer;
150
153
  private _textOutput;
151
154
  private _errorBuffer;
@@ -198,6 +201,7 @@ export declare class Session extends EventEmitter {
198
201
  private _envOverrides;
199
202
  private _effort;
200
203
  private readonly _tmuxHistoryLimit;
204
+ private readonly _remote?;
201
205
  private _color;
202
206
  private _taskTrackerHandlers;
203
207
  private _ralphHandlers;
@@ -240,6 +244,8 @@ export declare class Session extends EventEmitter {
240
244
  tmuxHistoryLimit?: number;
241
245
  /** Restored per-session attachment history. May include server-private external paths. */
242
246
  attachmentHistory?: SessionAttachmentHistoryItem[];
247
+ /** Remote execution metadata for sessions launched through SSH inside local tmux. */
248
+ remote?: SessionRemote;
243
249
  });
244
250
  get status(): SessionStatus;
245
251
  get currentTaskId(): string | null;
@@ -407,6 +413,7 @@ export declare class Session extends EventEmitter {
407
413
  pid: number | null;
408
414
  status: SessionStatus;
409
415
  workingDir: string;
416
+ remote?: SessionRemote;
410
417
  currentTaskId: string | null;
411
418
  createdAt: number;
412
419
  lastActivityAt: number;
@@ -443,6 +450,7 @@ export declare class Session extends EventEmitter {
443
450
  resumeSessionId?: string;
444
451
  effort?: EffortLevel;
445
452
  attachmentHistory?: SessionAttachmentHistoryItem[];
453
+ respawnBlocked?: boolean;
446
454
  };
447
455
  /**
448
456
  * Lightweight detailed state that excludes heavy buffers (textOutput, terminalBuffer).
@@ -497,6 +505,7 @@ export declare class Session extends EventEmitter {
497
505
  pid: number | null;
498
506
  status: SessionStatus;
499
507
  workingDir: string;
508
+ remote?: SessionRemote;
500
509
  currentTaskId: string | null;
501
510
  createdAt: number;
502
511
  lastActivityAt: number;
@@ -533,6 +542,7 @@ export declare class Session extends EventEmitter {
533
542
  resumeSessionId?: string;
534
543
  effort?: EffortLevel;
535
544
  attachmentHistory?: SessionAttachmentHistoryItem[];
545
+ respawnBlocked?: boolean;
536
546
  };
537
547
  /**
538
548
  * Starts an interactive Claude CLI session with full terminal support.
@@ -554,6 +564,16 @@ export declare class Session extends EventEmitter {
554
564
  private _setupOrAttachMuxSession;
555
565
  private _handleTerminalOutput;
556
566
  startInteractive(): Promise<void>;
567
+ /**
568
+ * Clear the interactive-PTY exit circuit breaker (COD-118).
569
+ *
570
+ * Called on an EXPLICIT, user-initiated (re)start so an intentional restart is
571
+ * never blocked by a prior crash-loop trip. Automatic recovery/reconnect paths
572
+ * must NOT call this — that's the whole point of the breaker.
573
+ */
574
+ resetRespawnBreaker(): void;
575
+ /** Whether the interactive-PTY exit circuit breaker is currently tripped (COD-118). */
576
+ get respawnBlocked(): boolean;
557
577
  /**
558
578
  * Process expensive parsers (ANSI strip, Ralph, bash tool, token, CLI info, task descriptions).
559
579
  * Called on a throttled schedule (every EXPENSIVE_PROCESS_INTERVAL_MS) instead of on every
@@ -658,6 +678,9 @@ export declare class Session extends EventEmitter {
658
678
  * ```
659
679
  */
660
680
  write(data: string): void;
681
+ private _codexLastSubmitAt;
682
+ get codexLastSubmitAt(): number;
683
+ private _trackCodexSubmit;
661
684
  /**
662
685
  * Per-client highest-applied input sequence, for exactly-once input delivery.
663
686
  * Keyed by the web client's stable `clientId`. Bounded so many devices over a
@@ -1 +1 @@
1
- {"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,cAAc,EACd,UAAU,EAIV,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,cAA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M,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,YAAY,CAAC,EAAE,kBAAkB,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,IAAI;IAyBxG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAKtB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmB7C;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAmC/B;;;;;;;;;;;;;;;;OAgBG;IACG,IAAI,CAAC,OAAO,GAAE,OAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAyFlD,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAUhC,SAAS,IAAI,IAAI;IAMjB,SAAS,IAAI,MAAM;IAInB,QAAQ,IAAI,MAAM;IAIlB,iBAAiB,IAAI,MAAM;IAI3B,YAAY,IAAI,IAAI;CASrB"}
package/dist/session.js CHANGED
@@ -43,7 +43,8 @@ import { buildInteractiveArgs, buildPromptArgs, buildClaudeEnv, buildMuxAttachEn
43
43
  import { SessionAutoOps } from './session-auto-ops.js';
44
44
  import { detectUsageLimitPause } from './usage-limit-patterns.js';
45
45
  import { SessionTaskCache } from './session-task-cache.js';
46
- import { parseAttachmentMagicLinks } from './attachment-magic.js';
46
+ import { InteractivePtyExitBreaker } from './session-pty-exit-breaker.js';
47
+ import { parseTerminalAttachmentRequests } from './attachment-magic.js';
47
48
  import { sanitizeAttachmentHistory, upsertAttachmentHistory as upsertAttachmentHistoryList, } from './session-attachment-history.js';
48
49
  /** Line buffer flush interval (100ms) - forces processing of partial lines */
49
50
  const LINE_BUFFER_FLUSH_INTERVAL = 100;
@@ -142,6 +143,9 @@ export function queryTmuxWindowSize(muxName, socket) {
142
143
  }
143
144
  return { cols: DEFAULT_PTY_COLS, rows: DEFAULT_PTY_ROWS };
144
145
  }
146
+ export function resolveMuxAttachCwd(workingDir, remote) {
147
+ return remote ? '/tmp' : workingDir;
148
+ }
145
149
  /**
146
150
  * Event signatures emitted by the Session class.
147
151
  * Subscribe using `session.on('eventName', handler)`.
@@ -189,6 +193,12 @@ export class Session extends EventEmitter {
189
193
  _pid = null;
190
194
  _status = 'idle';
191
195
  _currentTaskId = null;
196
+ // COD-118: bound repeated non-zero interactive-PTY exits. Recorded in the
197
+ // interactive PTY onExit handler; when it trips, the session flips to 'error'
198
+ // and startInteractive() refuses to respawn until an explicit user restart
199
+ // calls resetRespawnBreaker(). Defense-in-depth over the COD-115 crash-loop.
200
+ _ptyExitBreaker = new InteractivePtyExitBreaker();
201
+ _respawnBlocked = false;
192
202
  // Use BufferAccumulator for hot-path buffers to reduce GC pressure
193
203
  _terminalBuffer = new BufferAccumulator(MAX_TERMINAL_BUFFER_SIZE, TERMINAL_BUFFER_TRIM_SIZE);
194
204
  _textOutput = new BufferAccumulator(MAX_TEXT_OUTPUT_SIZE, TEXT_OUTPUT_TRIM_SIZE);
@@ -268,6 +278,8 @@ export class Session extends EventEmitter {
268
278
  _effort;
269
279
  // tmux history-limit (scrollback lines) applied to this session's pane.
270
280
  _tmuxHistoryLimit;
281
+ // Remote execution metadata, present when this session runs over SSH through local tmux.
282
+ _remote;
271
283
  // Session color for visual differentiation
272
284
  _color = 'default';
273
285
  // Store handler references for cleanup (prevents memory leaks)
@@ -345,6 +357,7 @@ export class Session extends EventEmitter {
345
357
  this._effort = config.effort;
346
358
  }
347
359
  this._tmuxHistoryLimit = config.tmuxHistoryLimit ?? DEFAULT_TMUX_HISTORY_LIMIT;
360
+ this._remote = config.remote;
348
361
  if (config.attachmentHistory && config.attachmentHistory.length > 0) {
349
362
  this.restoreAttachmentHistory(config.attachmentHistory);
350
363
  }
@@ -728,6 +741,7 @@ export class Session extends EventEmitter {
728
741
  pid: this.pid,
729
742
  status: this._status,
730
743
  workingDir: this.workingDir,
744
+ remote: this._remote,
731
745
  currentTaskId: this._currentTaskId,
732
746
  createdAt: this.createdAt,
733
747
  lastActivityAt: this._lastActivityAt,
@@ -762,6 +776,11 @@ export class Session extends EventEmitter {
762
776
  geminiConfig: this._geminiConfig,
763
777
  resumeSessionId: this._resumeSessionId,
764
778
  effort: this._effort,
779
+ // COD-118: runtime-only — surfaced so the frontend can require explicit user
780
+ // intent before restarting a crash-looped session. Deliberately NOT restored
781
+ // by the constructor: a Codeman restart starts with a fresh breaker so boot
782
+ // recovery can re-attach.
783
+ respawnBlocked: this._respawnBlocked || undefined,
765
784
  attachmentHistory: this.attachmentHistory.length > 0 ? this.attachmentHistory : undefined,
766
785
  // envOverrides intentionally NOT on the public SessionState type — they must not
767
786
  // leak into SSE / GET /api/sessions broadcasts (schema allows OPENCODE_*, which
@@ -904,8 +923,10 @@ export class Session extends EventEmitter {
904
923
  name: 'xterm-256color',
905
924
  cols: ptyCols,
906
925
  rows: ptyRows,
907
- cwd: this.workingDir,
908
- env: buildMuxAttachEnv(),
926
+ cwd: resolveMuxAttachCwd(this.workingDir, this._remote),
927
+ // COD-75: codex/gemini get COLORTERM=truecolor — mirrors buildEnvExports()
928
+ // in tmux-manager.ts so the attach client and the tmux session agree.
929
+ env: buildMuxAttachEnv(this.mode === 'codex' || this.mode === 'gemini'),
909
930
  });
910
931
  }
911
932
  catch (spawnErr) {
@@ -962,20 +983,28 @@ export class Session extends EventEmitter {
962
983
  // eslint-disable-next-line no-control-regex
963
984
  .replace(/\x1b\[\?(?:1000|1001|1002|1003|1005|1006|1007)[hl]/g, '');
964
985
  }
965
- // Scan terminal output for `codeman://attach?path=...` magic links and emit
966
- // an attachmentRequested event for each newly-seen absolute path. The web
967
- // server turns these into registered attachment cards.
968
- const attachmentPaths = parseAttachmentMagicLinks(data);
969
- for (const attachmentPath of attachmentPaths) {
970
- if (this._attachmentMagicSeen.has(attachmentPath))
986
+ // Scan terminal output for attachment requests. `codeman://attach?...` is an
987
+ // explicit magic link (all modes); Codex generated images report
988
+ // `Saved to: file://...` that scanner (and its relaxed trust policy) is
989
+ // only enabled for codex-mode sessions. The web server applies the trust
990
+ // boundary for each request source.
991
+ const attachmentRequests = parseTerminalAttachmentRequests(data, { codexArtifacts: this.mode === 'codex' });
992
+ for (const request of attachmentRequests) {
993
+ const seenKey = `${request.source}:${request.path}`;
994
+ if (this._attachmentMagicSeen.has(seenKey))
971
995
  continue;
972
- this._attachmentMagicSeen.add(attachmentPath);
996
+ this._attachmentMagicSeen.add(seenKey);
973
997
  if (this._attachmentMagicSeen.size > 200) {
974
998
  const oldest = this._attachmentMagicSeen.values().next().value;
975
999
  if (oldest)
976
1000
  this._attachmentMagicSeen.delete(oldest);
977
1001
  }
978
- this.emit('attachmentRequested', { sessionId: this.id, path: attachmentPath, timestamp: Date.now() });
1002
+ this.emit('attachmentRequested', {
1003
+ sessionId: this.id,
1004
+ path: request.path,
1005
+ source: request.source,
1006
+ timestamp: Date.now(),
1007
+ });
979
1008
  }
980
1009
  // BufferAccumulator handles auto-trimming when max size exceeded
981
1010
  this._terminalBuffer.append(data);
@@ -987,6 +1016,13 @@ export class Session extends EventEmitter {
987
1016
  if (this.ptyProcess) {
988
1017
  throw new Error('Session already has a running process');
989
1018
  }
1019
+ // COD-118: if the PTY exit breaker has tripped (repeated non-zero exits in a
1020
+ // short window), refuse to respawn. This is the uniform choke point that stops
1021
+ // automatic recovery/reconnect callers from re-creating a crash-looping PTY.
1022
+ // An explicit user restart clears it via resetRespawnBreaker().
1023
+ if (this._respawnBlocked) {
1024
+ throw new Error('Respawn blocked: interactive PTY exited non-zero too many times in a short window (circuit breaker tripped). Restart the session to clear it.');
1025
+ }
990
1026
  this._resetBuffers();
991
1027
  const modeLabel = getModeLabel(this.mode);
992
1028
  console.log(`[Session] Starting interactive ${modeLabel} session` + (this._useMux ? ` (with ${this._mux.backend})` : ''));
@@ -1009,6 +1045,7 @@ export class Session extends EventEmitter {
1009
1045
  envOverrides: this._envOverrides,
1010
1046
  effort: this._effort,
1011
1047
  historyLimit: this._tmuxHistoryLimit,
1048
+ remote: this._remote,
1012
1049
  },
1013
1050
  createSessionOptions: {
1014
1051
  sessionId: this.id,
@@ -1026,6 +1063,7 @@ export class Session extends EventEmitter {
1026
1063
  envOverrides: this._envOverrides,
1027
1064
  effort: this._effort,
1028
1065
  historyLimit: this._tmuxHistoryLimit,
1066
+ remote: this._remote,
1029
1067
  },
1030
1068
  spawnErrLabel: 'mux attachment',
1031
1069
  });
@@ -1219,6 +1257,9 @@ export class Session extends EventEmitter {
1219
1257
  });
1220
1258
  this.ptyProcess.onExit(({ exitCode }) => {
1221
1259
  console.log('[Session] Interactive PTY exited with code:', exitCode);
1260
+ // COD-118: record the exit in the circuit breaker BEFORE status bookkeeping.
1261
+ // A clean (0) exit resets the counter; rapid non-zero repeats trip it.
1262
+ const breakerResult = this._ptyExitBreaker.recordExit(exitCode, Date.now());
1222
1263
  this.ptyProcess = null;
1223
1264
  this._pid = null;
1224
1265
  this._status = 'idle';
@@ -1246,9 +1287,33 @@ export class Session extends EventEmitter {
1246
1287
  if (this._muxSession && this._mux) {
1247
1288
  this._mux.setAttached(this.id, false);
1248
1289
  }
1290
+ // COD-118: if the breaker tripped, surface an error state and block the NEXT
1291
+ // respawn so recovery/reconnect callers stop looping. Still emit 'exit' below
1292
+ // for normal cleanup. Cleared by an explicit user restart (resetRespawnBreaker()).
1293
+ if (breakerResult.tripped && !this._respawnBlocked) {
1294
+ this._respawnBlocked = true;
1295
+ this._status = 'error';
1296
+ console.error(`[Session] PTY exit circuit breaker tripped for ${this.id} (${breakerResult.count} non-zero exits within window); blocking respawn.`);
1297
+ this.emit('respawnBreakerTripped', { count: breakerResult.count });
1298
+ }
1249
1299
  this.emit('exit', exitCode);
1250
1300
  });
1251
1301
  }
1302
+ /**
1303
+ * Clear the interactive-PTY exit circuit breaker (COD-118).
1304
+ *
1305
+ * Called on an EXPLICIT, user-initiated (re)start so an intentional restart is
1306
+ * never blocked by a prior crash-loop trip. Automatic recovery/reconnect paths
1307
+ * must NOT call this — that's the whole point of the breaker.
1308
+ */
1309
+ resetRespawnBreaker() {
1310
+ this._ptyExitBreaker.reset();
1311
+ this._respawnBlocked = false;
1312
+ }
1313
+ /** Whether the interactive-PTY exit circuit breaker is currently tripped (COD-118). */
1314
+ get respawnBlocked() {
1315
+ return this._respawnBlocked;
1316
+ }
1252
1317
  /**
1253
1318
  * Process expensive parsers (ANSI strip, Ralph, bash tool, token, CLI info, task descriptions).
1254
1319
  * Called on a throttled schedule (every EXPENSIVE_PROCESS_INTERVAL_MS) instead of on every
@@ -1344,6 +1409,7 @@ export class Session extends EventEmitter {
1344
1409
  niceConfig: this._niceConfig,
1345
1410
  envOverrides: this._envOverrides,
1346
1411
  historyLimit: this._tmuxHistoryLimit,
1412
+ remote: this._remote,
1347
1413
  },
1348
1414
  createSessionOptions: {
1349
1415
  sessionId: this.id,
@@ -1353,6 +1419,7 @@ export class Session extends EventEmitter {
1353
1419
  niceConfig: this._niceConfig,
1354
1420
  envOverrides: this._envOverrides,
1355
1421
  historyLimit: this._tmuxHistoryLimit,
1422
+ remote: this._remote,
1356
1423
  },
1357
1424
  spawnErrLabel: 'shell mux attachment',
1358
1425
  });
@@ -1883,10 +1950,25 @@ export class Session extends EventEmitter {
1883
1950
  * ```
1884
1951
  */
1885
1952
  write(data) {
1953
+ this._trackCodexSubmit(data);
1886
1954
  if (this.ptyProcess) {
1887
1955
  this.ptyProcess.write(data);
1888
1956
  }
1889
1957
  }
1958
+ // ── Codex thread tracking ─────────────────────────────────────────────
1959
+ // When a codex pane last submitted a message (Enter). The response-viewer
1960
+ // correlates this against ~/.codex/history.jsonl entry timestamps to find
1961
+ // the thread the pane is ACTUALLY on — the only signal that survives
1962
+ // /resume, /new and /fork typed inside the codex TUI itself.
1963
+ _codexLastSubmitAt = 0;
1964
+ get codexLastSubmitAt() {
1965
+ return this._codexLastSubmitAt;
1966
+ }
1967
+ _trackCodexSubmit(data) {
1968
+ if (this.mode === 'codex' && (data.includes('\r') || data.includes('\n'))) {
1969
+ this._codexLastSubmitAt = Date.now();
1970
+ }
1971
+ }
1890
1972
  /**
1891
1973
  * Per-client highest-applied input sequence, for exactly-once input delivery.
1892
1974
  * Keyed by the web client's stable `clientId`. Bounded so many devices over a
@@ -1941,6 +2023,7 @@ export class Session extends EventEmitter {
1941
2023
  * ```
1942
2024
  */
1943
2025
  async writeViaMux(data) {
2026
+ this._trackCodexSubmit(data);
1944
2027
  if (this._mux && this._muxSession) {
1945
2028
  return this._mux.sendInput(this.id, data);
1946
2029
  }