@cluesmith/codev 3.3.1 → 3.3.3

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 (248) hide show
  1. package/dashboard-dist/assets/{index-D3XaKpZW.js → index-CUIjS_Vb.js} +41 -41
  2. package/dashboard-dist/assets/index-CUIjS_Vb.js.map +1 -0
  3. package/dashboard-dist/assets/index-DnYLy5C_.css +32 -0
  4. package/dashboard-dist/index.html +2 -2
  5. package/dist/agent-farm/cli.d.ts.map +1 -1
  6. package/dist/agent-farm/cli.js +52 -1
  7. package/dist/agent-farm/cli.js.map +1 -1
  8. package/dist/agent-farm/commands/inbox.d.ts.map +1 -1
  9. package/dist/agent-farm/commands/inbox.js +67 -10
  10. package/dist/agent-farm/commands/inbox.js.map +1 -1
  11. package/dist/agent-farm/commands/interrupt.d.ts +4 -1
  12. package/dist/agent-farm/commands/interrupt.d.ts.map +1 -1
  13. package/dist/agent-farm/commands/interrupt.js +6 -3
  14. package/dist/agent-farm/commands/interrupt.js.map +1 -1
  15. package/dist/agent-farm/commands/reset/constants.d.ts +118 -0
  16. package/dist/agent-farm/commands/reset/constants.d.ts.map +1 -1
  17. package/dist/agent-farm/commands/reset/constants.js +118 -0
  18. package/dist/agent-farm/commands/reset/constants.js.map +1 -1
  19. package/dist/agent-farm/commands/reset/context.d.ts +18 -0
  20. package/dist/agent-farm/commands/reset/context.d.ts.map +1 -1
  21. package/dist/agent-farm/commands/reset/context.js +41 -0
  22. package/dist/agent-farm/commands/reset/context.js.map +1 -1
  23. package/dist/agent-farm/commands/reset/receipt.d.ts.map +1 -1
  24. package/dist/agent-farm/commands/reset/receipt.js +16 -5
  25. package/dist/agent-farm/commands/reset/receipt.js.map +1 -1
  26. package/dist/agent-farm/commands/reset/reorient.d.ts +1 -1
  27. package/dist/agent-farm/commands/reset/reorient.d.ts.map +1 -1
  28. package/dist/agent-farm/commands/reset/reorient.js +8 -1
  29. package/dist/agent-farm/commands/reset/reorient.js.map +1 -1
  30. package/dist/agent-farm/commands/reset/self.d.ts +335 -0
  31. package/dist/agent-farm/commands/reset/self.d.ts.map +1 -0
  32. package/dist/agent-farm/commands/reset/self.js +636 -0
  33. package/dist/agent-farm/commands/reset/self.js.map +1 -0
  34. package/dist/agent-farm/commands/reset.d.ts +4 -1
  35. package/dist/agent-farm/commands/reset.d.ts.map +1 -1
  36. package/dist/agent-farm/commands/reset.js +29 -21
  37. package/dist/agent-farm/commands/reset.js.map +1 -1
  38. package/dist/agent-farm/commands/self-refresh.d.ts +60 -0
  39. package/dist/agent-farm/commands/self-refresh.d.ts.map +1 -0
  40. package/dist/agent-farm/commands/self-refresh.js +506 -0
  41. package/dist/agent-farm/commands/self-refresh.js.map +1 -0
  42. package/dist/agent-farm/commands/send.d.ts +28 -0
  43. package/dist/agent-farm/commands/send.d.ts.map +1 -1
  44. package/dist/agent-farm/commands/send.js +90 -7
  45. package/dist/agent-farm/commands/send.js.map +1 -1
  46. package/dist/agent-farm/commands/spawn.d.ts +7 -0
  47. package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
  48. package/dist/agent-farm/commands/spawn.js +13 -1
  49. package/dist/agent-farm/commands/spawn.js.map +1 -1
  50. package/dist/agent-farm/db/index.d.ts +3 -1
  51. package/dist/agent-farm/db/index.d.ts.map +1 -1
  52. package/dist/agent-farm/db/index.js +8 -443
  53. package/dist/agent-farm/db/index.js.map +1 -1
  54. package/dist/agent-farm/db/mailbox.d.ts +47 -7
  55. package/dist/agent-farm/db/mailbox.d.ts.map +1 -1
  56. package/dist/agent-farm/db/mailbox.js +56 -12
  57. package/dist/agent-farm/db/mailbox.js.map +1 -1
  58. package/dist/agent-farm/db/migrations.d.ts +57 -0
  59. package/dist/agent-farm/db/migrations.d.ts.map +1 -0
  60. package/dist/agent-farm/db/migrations.js +530 -0
  61. package/dist/agent-farm/db/migrations.js.map +1 -0
  62. package/dist/agent-farm/db/schema.d.ts +1 -1
  63. package/dist/agent-farm/db/schema.d.ts.map +1 -1
  64. package/dist/agent-farm/db/schema.js +1 -0
  65. package/dist/agent-farm/db/schema.js.map +1 -1
  66. package/dist/agent-farm/db/types.d.ts +22 -0
  67. package/dist/agent-farm/db/types.d.ts.map +1 -1
  68. package/dist/agent-farm/db/types.js.map +1 -1
  69. package/dist/agent-farm/lib/tower-client.d.ts +12 -0
  70. package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
  71. package/dist/agent-farm/lib/tower-client.js +12 -0
  72. package/dist/agent-farm/lib/tower-client.js.map +1 -1
  73. package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -1
  74. package/dist/agent-farm/lib/tunnel-client.js +43 -14
  75. package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
  76. package/dist/agent-farm/servers/cron-delivery.d.ts +7 -1
  77. package/dist/agent-farm/servers/cron-delivery.d.ts.map +1 -1
  78. package/dist/agent-farm/servers/cron-delivery.js +2 -1
  79. package/dist/agent-farm/servers/cron-delivery.js.map +1 -1
  80. package/dist/agent-farm/servers/gate-profiles.d.ts +21 -0
  81. package/dist/agent-farm/servers/gate-profiles.d.ts.map +1 -1
  82. package/dist/agent-farm/servers/gate-profiles.js +36 -4
  83. package/dist/agent-farm/servers/gate-profiles.js.map +1 -1
  84. package/dist/agent-farm/servers/mailbox-delivery.d.ts +218 -15
  85. package/dist/agent-farm/servers/mailbox-delivery.d.ts.map +1 -1
  86. package/dist/agent-farm/servers/mailbox-delivery.js +259 -27
  87. package/dist/agent-farm/servers/mailbox-delivery.js.map +1 -1
  88. package/dist/agent-farm/servers/mailbox-wiring.d.ts +66 -11
  89. package/dist/agent-farm/servers/mailbox-wiring.d.ts.map +1 -1
  90. package/dist/agent-farm/servers/mailbox-wiring.js +202 -48
  91. package/dist/agent-farm/servers/mailbox-wiring.js.map +1 -1
  92. package/dist/agent-farm/servers/message-write.d.ts +58 -18
  93. package/dist/agent-farm/servers/message-write.d.ts.map +1 -1
  94. package/dist/agent-farm/servers/message-write.js +73 -28
  95. package/dist/agent-farm/servers/message-write.js.map +1 -1
  96. package/dist/agent-farm/servers/render-gate.d.ts +37 -1
  97. package/dist/agent-farm/servers/render-gate.d.ts.map +1 -1
  98. package/dist/agent-farm/servers/render-gate.js +71 -12
  99. package/dist/agent-farm/servers/render-gate.js.map +1 -1
  100. package/dist/agent-farm/servers/session-submit.d.ts +220 -27
  101. package/dist/agent-farm/servers/session-submit.d.ts.map +1 -1
  102. package/dist/agent-farm/servers/session-submit.js +333 -42
  103. package/dist/agent-farm/servers/session-submit.js.map +1 -1
  104. package/dist/agent-farm/servers/tower-cron.d.ts.map +1 -1
  105. package/dist/agent-farm/servers/tower-cron.js +3 -2
  106. package/dist/agent-farm/servers/tower-cron.js.map +1 -1
  107. package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
  108. package/dist/agent-farm/servers/tower-instances.js +11 -3
  109. package/dist/agent-farm/servers/tower-instances.js.map +1 -1
  110. package/dist/agent-farm/servers/tower-routes.d.ts +32 -0
  111. package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
  112. package/dist/agent-farm/servers/tower-routes.js +245 -36
  113. package/dist/agent-farm/servers/tower-routes.js.map +1 -1
  114. package/dist/agent-farm/servers/tower-server.js +15 -2
  115. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  116. package/dist/agent-farm/servers/tower-terminals.d.ts +21 -0
  117. package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
  118. package/dist/agent-farm/servers/tower-terminals.js +53 -5
  119. package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
  120. package/dist/agent-farm/servers/tower-tunnel.d.ts.map +1 -1
  121. package/dist/agent-farm/servers/tower-tunnel.js +14 -0
  122. package/dist/agent-farm/servers/tower-tunnel.js.map +1 -1
  123. package/dist/agent-farm/servers/tower-utils.d.ts +35 -0
  124. package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -1
  125. package/dist/agent-farm/servers/tower-utils.js +39 -0
  126. package/dist/agent-farm/servers/tower-utils.js.map +1 -1
  127. package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -1
  128. package/dist/agent-farm/servers/tower-websocket.js +8 -1
  129. package/dist/agent-farm/servers/tower-websocket.js.map +1 -1
  130. package/dist/agent-farm/types.d.ts +36 -1
  131. package/dist/agent-farm/types.d.ts.map +1 -1
  132. package/dist/agent-farm/utils/message-format.d.ts +136 -4
  133. package/dist/agent-farm/utils/message-format.d.ts.map +1 -1
  134. package/dist/agent-farm/utils/message-format.js +212 -22
  135. package/dist/agent-farm/utils/message-format.js.map +1 -1
  136. package/dist/agent-farm/utils/server-utils.d.ts +8 -2
  137. package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
  138. package/dist/agent-farm/utils/server-utils.js +19 -2
  139. package/dist/agent-farm/utils/server-utils.js.map +1 -1
  140. package/dist/cli.d.ts.map +1 -1
  141. package/dist/cli.js +3 -1
  142. package/dist/cli.js.map +1 -1
  143. package/dist/commands/doctor.js +2 -2
  144. package/dist/commands/generate-image.d.ts +20 -1
  145. package/dist/commands/generate-image.d.ts.map +1 -1
  146. package/dist/commands/generate-image.js +188 -1
  147. package/dist/commands/generate-image.js.map +1 -1
  148. package/dist/commands/porch/context-refresh.d.ts +181 -0
  149. package/dist/commands/porch/context-refresh.d.ts.map +1 -0
  150. package/dist/commands/porch/context-refresh.js +270 -0
  151. package/dist/commands/porch/context-refresh.js.map +1 -0
  152. package/dist/commands/porch/index.d.ts +6 -0
  153. package/dist/commands/porch/index.d.ts.map +1 -1
  154. package/dist/commands/porch/index.js +46 -0
  155. package/dist/commands/porch/index.js.map +1 -1
  156. package/dist/commands/porch/next.d.ts +0 -9
  157. package/dist/commands/porch/next.d.ts.map +1 -1
  158. package/dist/commands/porch/next.js +133 -4
  159. package/dist/commands/porch/next.js.map +1 -1
  160. package/dist/commands/porch/prompts.d.ts.map +1 -1
  161. package/dist/commands/porch/prompts.js +18 -2
  162. package/dist/commands/porch/prompts.js.map +1 -1
  163. package/dist/commands/porch/protocol.d.ts.map +1 -1
  164. package/dist/commands/porch/protocol.js +102 -0
  165. package/dist/commands/porch/protocol.js.map +1 -1
  166. package/dist/commands/porch/types.d.ts +61 -0
  167. package/dist/commands/porch/types.d.ts.map +1 -1
  168. package/dist/lib/forge-contracts.d.ts +66 -5
  169. package/dist/lib/forge-contracts.d.ts.map +1 -1
  170. package/dist/lib/forge-contracts.js.map +1 -1
  171. package/dist/lib/forge.d.ts +1 -1
  172. package/dist/lib/forge.d.ts.map +1 -1
  173. package/dist/lib/forge.js +33 -11
  174. package/dist/lib/forge.js.map +1 -1
  175. package/dist/lib/self-refresh-invocation.d.ts +60 -0
  176. package/dist/lib/self-refresh-invocation.d.ts.map +1 -0
  177. package/dist/lib/self-refresh-invocation.js +64 -0
  178. package/dist/lib/self-refresh-invocation.js.map +1 -0
  179. package/dist/lib/test-env.d.ts +50 -0
  180. package/dist/lib/test-env.d.ts.map +1 -1
  181. package/dist/lib/test-env.js +76 -0
  182. package/dist/lib/test-env.js.map +1 -1
  183. package/dist/terminal/pty-manager.d.ts +10 -1
  184. package/dist/terminal/pty-manager.d.ts.map +1 -1
  185. package/dist/terminal/pty-manager.js +38 -9
  186. package/dist/terminal/pty-manager.js.map +1 -1
  187. package/dist/terminal/pty-session.d.ts +52 -4
  188. package/dist/terminal/pty-session.d.ts.map +1 -1
  189. package/dist/terminal/pty-session.js +157 -18
  190. package/dist/terminal/pty-session.js.map +1 -1
  191. package/dist/terminal/shellper-client.d.ts +73 -0
  192. package/dist/terminal/shellper-client.d.ts.map +1 -1
  193. package/dist/terminal/shellper-client.js +151 -0
  194. package/dist/terminal/shellper-client.js.map +1 -1
  195. package/dist/terminal/shellper-main.js +20 -3
  196. package/dist/terminal/shellper-main.js.map +1 -1
  197. package/dist/terminal/shellper-process.d.ts +2 -0
  198. package/dist/terminal/shellper-process.d.ts.map +1 -1
  199. package/dist/terminal/shellper-process.js +17 -1
  200. package/dist/terminal/shellper-process.js.map +1 -1
  201. package/dist/terminal/shellper-protocol.d.ts +28 -0
  202. package/dist/terminal/shellper-protocol.d.ts.map +1 -1
  203. package/dist/terminal/shellper-protocol.js.map +1 -1
  204. package/package.json +4 -4
  205. package/scripts/forge/gitea/_lib.sh +214 -0
  206. package/scripts/forge/gitea/issue-comment.sh +8 -1
  207. package/scripts/forge/gitea/issue-view.sh +95 -4
  208. package/scripts/forge/gitea/pr-create.sh +155 -0
  209. package/scripts/forge/gitea/pr-exists.sh +32 -4
  210. package/scripts/forge/gitea/pr-list.sh +40 -31
  211. package/scripts/forge/gitea/pr-view.sh +65 -4
  212. package/scripts/forge/gitea/recently-merged.sh +91 -21
  213. package/scripts/forge/gitea/user-identity.sh +30 -1
  214. package/scripts/forge/github/issue-view.sh +5 -2
  215. package/scripts/forge/github/pr-create.sh +47 -0
  216. package/scripts/forge/github/pr-search.sh +3 -1
  217. package/scripts/forge/gitlab/issue-view.sh +24 -4
  218. package/scripts/forge/gitlab/pr-create.sh +53 -0
  219. package/scripts/forge/gitlab/pr-search.sh +3 -1
  220. package/scripts/forge/linear/issue-view.sh +13 -2
  221. package/skeleton/.claude/skills/arch-save/SKILL.md +8 -2
  222. package/skeleton/.claude/skills/builder-refresh/SKILL.md +138 -0
  223. package/skeleton/.claude/skills/generate-image/SKILL.md +22 -1
  224. package/skeleton/.codex/skills/arch-save/SKILL.md +8 -2
  225. package/skeleton/.codex/skills/builder-refresh/SKILL.md +138 -0
  226. package/skeleton/.codex/skills/generate-image/SKILL.md +22 -1
  227. package/skeleton/protocol-schema.json +17 -0
  228. package/skeleton/protocols/air/prompts/pr.md +6 -1
  229. package/skeleton/protocols/air/protocol.json +1 -1
  230. package/skeleton/protocols/aspir/prompts/review.md +6 -1
  231. package/skeleton/protocols/aspir/protocol.json +5 -1
  232. package/skeleton/protocols/bugfix/prompts/pr.md +6 -1
  233. package/skeleton/protocols/bugfix/protocol.json +1 -1
  234. package/skeleton/protocols/bugfix/protocol.md +2 -1
  235. package/skeleton/protocols/experiment/protocol.json +1 -1
  236. package/skeleton/protocols/maintain/prompts/review.md +6 -1
  237. package/skeleton/protocols/maintain/protocol.json +1 -1
  238. package/skeleton/protocols/pir/prompts/review.md +10 -7
  239. package/skeleton/protocols/pir/protocol.json +1 -1
  240. package/skeleton/protocols/protocol-schema.json +17 -0
  241. package/skeleton/protocols/research/protocol.json +1 -1
  242. package/skeleton/protocols/spike/protocol.json +1 -1
  243. package/skeleton/protocols/spir/prompts/review.md +6 -1
  244. package/skeleton/protocols/spir/protocol.json +5 -1
  245. package/skeleton/resources/commands/agent-farm.md +1 -1
  246. package/templates/tower.html +16 -1
  247. package/dashboard-dist/assets/index-BZRTEMtH.css +0 -32
  248. package/dashboard-dist/assets/index-D3XaKpZW.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"message-write.js","sourceRoot":"","sources":["../../../src/agent-farm/servers/message-write.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,2EAA2E;AAC3E,0EAA0E;AAC1E,kCAAkC;AAClC,MAAM,0BAA0B,GAAG,CAAC,CAAC;AACrC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAChC,MAAM,qBAAqB,GAAG,EAAE,CAAC;AAEjC,iEAAiE;AACjE,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,qBAAqB,CAAC;AAE3D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAwB,EAAE,OAAgB;IAC7E,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,IAAI,OAAO;QAAE,OAAO,CAAC,CAAC;IACtB,UAAU,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,qBAAqB,CAAC,CAAC;IAC7D,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,qBAAqB,CAC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AM,EAAE,SAAS,EAAE,CAAC;QAC1D,IAAI,QAAQ,CAAC,KAAK,EAAE;YAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;QACrD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC/B,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,OAAO,EAAE,CAAC;IACrB,CAAC;AACH,CAAC"}
@@ -35,7 +35,10 @@
35
35
  * the same capped seed), not a round-2 regression; tracked as #1361.
36
36
  *
37
37
  * Classifier (fail-toward-not-clean): CLEAN requires
38
- * (a) a recognized composer marker on the screen, AND
38
+ * (a) a recognized composer marker on the screen — a text match, plus whatever further
39
+ * positive evidence the profile demands that the row is the LIVE composer and not
40
+ * just a row the app prefixes alike (agy anchors on the cursor row and the marker's
41
+ * own palette color; see `markerRequiresCursorRow` / `markerFgPalette`), AND
39
42
  * (b) a positively-bounded composer region (a rule/status line BELOW the
40
43
  * marker — never a scan to the screen bottom), AND
41
44
  * (c) zero normal-intensity (non-dim), non-whitespace, non-chrome cells in that
@@ -86,6 +89,26 @@ export interface GateProfile {
86
89
  * below the composer is never counted as user text.
87
90
  */
88
91
  regionEndPatterns: RegExp[];
92
+ /**
93
+ * Optional per-app marker anchor: when true, the marker row must ALSO be the row
94
+ * holding the buffer cursor. `markerPattern` alone is a text test, and a text test
95
+ * cannot tell a composer from any other row an app happens to prefix the same way —
96
+ * agy's `> ` matches its slash-menu selection cursor and its per-turn transcript echo
97
+ * as readily as its composer (measured, #1474). The cursor is the one signal only the
98
+ * live input row carries, so this converts "a row that looks like a prompt" into "the
99
+ * row the user would actually type into". Fail-safe: an app whose cursor is parked
100
+ * elsewhere yields NO marker ⇒ `no-composer-marker` ⇒ hold. Left unset, the marker is
101
+ * the text match alone (claude/codex behavior is unchanged).
102
+ */
103
+ markerRequiresCursorRow?: boolean;
104
+ /**
105
+ * Optional per-app marker anchor: the 16-color palette index the marker GLYPH cell must
106
+ * render in. The color-attribute analogue of {@link markerRequiresCursorRow}, and the
107
+ * signal that separates agy's composer marker (palette 12, bright blue) from its
108
+ * transcript echo of a submitted turn (palette 4 — measured, #1474). Left unset, the
109
+ * marker cell's color is not examined.
110
+ */
111
+ markerFgPalette?: number;
89
112
  /**
90
113
  * Optional per-app placeholder signal: a 16-color palette index whose cells are
91
114
  * treated as placeholder/hint chrome (ignored), NOT user text. This is the
@@ -112,6 +135,19 @@ export interface GateVerdict {
112
135
  */
113
136
  detail: 'no-composer-marker' | 'no-region-end' | 'user-text' | 'empty';
114
137
  }
138
+ /**
139
+ * Every line the mirror still holds — scrollback AND viewport — right-trimmed (Issue #1573).
140
+ *
141
+ * The gate itself deliberately reads only the viewport ({@link screenLines}): a composer lives
142
+ * at the bottom of the screen, and history is noise for classifying it. Echo verification wants
143
+ * the opposite reach. A long message pushes its own header off the top while it is still being
144
+ * typed, so the only place the header survives is scrollback — measured with a 300-line send,
145
+ * where the header sat at buffer line 6 under a viewport starting at 209.
146
+ *
147
+ * Bounded by the mirror's own `SCREEN_SCROLLBACK` (1000 lines), and read once per delivery
148
+ * rather than per gate check, so the O(history) scan is not on any hot path.
149
+ */
150
+ export declare function bufferLines(term: HeadlessTerminal): string[];
115
151
  /**
116
152
  * The classifier CORE (Spec 1313 render-gate round 2): classify an already-rendered
117
153
  * headless buffer against a profile. Synchronous — it only READS the live buffer, it never
@@ -1 +1 @@
1
- {"version":3,"file":"render-gate.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/servers/render-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAWH,OAAO,KAAK,EAAE,QAAQ,IAAI,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAWpE;;;;;;;;GAQG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;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,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B;;;;;;;;;;OAUG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;OAQG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,kFAAkF;AAClF,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,OAAO,CAAC;IACf,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;;OAOG;IACH,MAAM,EAAE,oBAAoB,GAAG,eAAe,GAAG,WAAW,GAAG,OAAO,CAAC;CACxE;AAwBD;;;;;;;;;;;GAWG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAQ5D;AAsHD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,gBAAgB,EACtB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,WAAW,GACnB,WAAW,CA2Db;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAYvG"}
@@ -35,7 +35,10 @@
35
35
  * the same capped seed), not a round-2 regression; tracked as #1361.
36
36
  *
37
37
  * Classifier (fail-toward-not-clean): CLEAN requires
38
- * (a) a recognized composer marker on the screen, AND
38
+ * (a) a recognized composer marker on the screen — a text match, plus whatever further
39
+ * positive evidence the profile demands that the row is the LIVE composer and not
40
+ * just a row the app prefixes alike (agy anchors on the cursor row and the marker's
41
+ * own palette color; see `markerRequiresCursorRow` / `markerFgPalette`), AND
39
42
  * (b) a positively-bounded composer region (a rule/status line BELOW the
40
43
  * marker — never a scan to the screen bottom), AND
41
44
  * (c) zero normal-intensity (non-dim), non-whitespace, non-chrome cells in that
@@ -81,12 +84,63 @@ function screenLines(term, rows) {
81
84
  }
82
85
  return lines;
83
86
  }
84
- /** Last row index whose text starts with the profile's composer marker, or -1. */
85
- function findMarkerRow(lines, markerPattern) {
87
+ /**
88
+ * Every line the mirror still holds — scrollback AND viewport — right-trimmed (Issue #1573).
89
+ *
90
+ * The gate itself deliberately reads only the viewport ({@link screenLines}): a composer lives
91
+ * at the bottom of the screen, and history is noise for classifying it. Echo verification wants
92
+ * the opposite reach. A long message pushes its own header off the top while it is still being
93
+ * typed, so the only place the header survives is scrollback — measured with a 300-line send,
94
+ * where the header sat at buffer line 6 under a viewport starting at 209.
95
+ *
96
+ * Bounded by the mirror's own `SCREEN_SCROLLBACK` (1000 lines), and read once per delivery
97
+ * rather than per gate check, so the O(history) scan is not on any hot path.
98
+ */
99
+ export function bufferLines(term) {
100
+ const buf = term.buffer.active;
101
+ const lines = [];
102
+ for (let i = 0; i < buf.length; i++) {
103
+ const line = buf.getLine(i);
104
+ lines.push(line ? line.translateToString(true).trimEnd() : '');
105
+ }
106
+ return lines;
107
+ }
108
+ /**
109
+ * Last row index that is the profile's composer marker, or -1 when no row qualifies.
110
+ *
111
+ * The text match (`markerPattern`) is the necessary condition; a profile may demand
112
+ * further POSITIVE evidence that the row is the live composer and not merely a row the
113
+ * app prefixes the same way (`markerRequiresCursorRow`, `markerFgPalette` — both measured
114
+ * per app, see their docs on {@link GateProfile}). Last-match-wins is retained: with the
115
+ * anchors applied, the qualifying rows are the composer, and the lowest one is it.
116
+ *
117
+ * Why the anchors exist (#1474): agy's marker is `> `, which its slash-menu selection
118
+ * cursor and its per-turn transcript echo also render — and the menu's item rows sit BELOW
119
+ * the composer, so text-only last-match-wins bounded the wrong region on real screens.
120
+ * Requiring the cursor row (and the marker's own color) makes the composer the only row
121
+ * that can qualify. A row that fails the anchors is simply not a marker, so an app that
122
+ * drifts fails toward `no-composer-marker` ⇒ hold, never toward a false clean.
123
+ *
124
+ * `cursorRow` is viewport-relative, matching `lines`' indexing from `viewportY` (the same
125
+ * convention {@link isGhostCursorCell} uses) — the caller converts it from xterm's
126
+ * baseY-relative `cursorY`.
127
+ */
128
+ function findMarkerRow(lines, profile, buf, top, cursorRow, cell) {
86
129
  let markerRow = -1;
87
130
  for (let i = 0; i < lines.length; i++) {
88
- if (markerPattern.test(lines[i]))
89
- markerRow = i;
131
+ if (!profile.markerPattern.test(lines[i]))
132
+ continue;
133
+ if (profile.markerRequiresCursorRow && i !== cursorRow)
134
+ continue;
135
+ if (profile.markerFgPalette !== undefined) {
136
+ const line = buf.getLine(top + i);
137
+ if (!line)
138
+ continue;
139
+ line.getCell(0, cell);
140
+ if (!cell.isFgPalette() || cell.getFgColor() !== profile.markerFgPalette)
141
+ continue;
142
+ }
143
+ markerRow = i;
90
144
  }
91
145
  return markerRow;
92
146
  }
@@ -176,7 +230,18 @@ function isGhostCursorCell(line, row, col, cols, cursorRow, cursorCol, cell, pro
176
230
  export function classifyBuffer(term, cols, rows, profile) {
177
231
  const buf = term.buffer.active;
178
232
  const lines = screenLines(term, rows);
179
- const markerRow = findMarkerRow(lines, profile.markerPattern);
233
+ const top = buf.viewportY;
234
+ const cell = buf.getNullCell();
235
+ const probe = buf.getNullCell(); // scratch cell for the ghost-tail look-ahead (never clobbers `cell`)
236
+ // Cursor position, made viewport-relative to match `lines`/`row`, which index from
237
+ // `viewportY`. `cursorY` is baseY-relative, NOT viewport-relative — the two coincide only
238
+ // while the viewport sits at the bottom of the scrollback, which is the usual case but not
239
+ // xterm's contract. Converting through baseY costs nothing and removes the assumption; the
240
+ // marker anchor below compares row indices, so a stale scroll position would otherwise
241
+ // move the cursor off the composer row and hold forever.
242
+ const cursorRow = buf.baseY + buf.cursorY - top;
243
+ const cursorCol = buf.cursorX;
244
+ const markerRow = findMarkerRow(lines, profile, buf, top, cursorRow, cell);
180
245
  if (markerRow === -1) {
181
246
  // No composer marker: a wrapper/boot screen, a full-screen picker with no marker, a
182
247
  // mirror that has not yet repainted a coherent frame, or an unrenderable snapshot.
@@ -191,12 +256,6 @@ export function classifyBuffer(term, cols, rows, profile) {
191
256
  // empty/dim, return a false CLEAN).
192
257
  return { clean: false, reason: 'busy', detail: 'no-region-end' };
193
258
  }
194
- const top = buf.viewportY;
195
- const cell = buf.getNullCell();
196
- const probe = buf.getNullCell(); // scratch cell for the ghost-tail look-ahead (never clobbers `cell`)
197
- // Cursor position is viewport-relative (matching `row`, which indexes from `viewportY`).
198
- const cursorRow = buf.cursorY;
199
- const cursorCol = buf.cursorX;
200
259
  let userCells = 0;
201
260
  for (let row = markerRow; row < endRow; row++) {
202
261
  const line = buf.getLine(top + row);
@@ -1 +1 @@
1
- {"version":3,"file":"render-gate.js","sourceRoot":"","sources":["../../../src/agent-farm/servers/render-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AAEH,yEAAyE;AACzE,6EAA6E;AAC7E,4EAA4E;AAC5E,iFAAiF;AACjF,4EAA4E;AAC5E,yEAAyE;AACzE,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAK5C,MAAM,EAAE,QAAQ,EAAE,GAAG,aAAa,CAAC;AAqEnC;;;;GAIG;AACH,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,CAAC;AAE/F,wEAAwE;AACxE,MAAM,UAAU,GAAG,QAAQ,CAAC;AAE5B,yFAAyF;AACzF,SAAS,WAAW,CAAC,IAAsB,EAAE,IAAY;IACvD,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC/B,MAAM,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC;IAC1B,MAAM,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  *
44
- * A lock only serialises writers that take it. Currently that is the `escape`
45
- * and `interrupt` paths of `/api/send`. Every other PTY writer still writes
46
- * directly, and it is worth being precise about why:
47
- *
48
- * - The mailbox delivery path (`deliverAgentMailSerialized`, Spec 1313) — every
49
- * normal `/api/send` AND every cron notification (Phase 6 rerouted cron here; the
50
- * old blind `writeMessageToSession` is gone). NOT covered by this lock, and does not
51
- * need it: it runs its OWN per-agent write serializer that completion-chains each
52
- * delivery on the prior one's paced write (text + Enter), so two mailbox deliveries
53
- * to one agent cannot interleave. That is a disjoint lock from this per-session one,
54
- * so a mailbox delivery is not serialised against a concurrent `escape`/`interrupt`
55
- * here — but a normal mailbox delivery only ever writes onto a render-gate-verified
56
- * empty prompt, and `interrupt` is the explicit gate-bypassing human action (see
57
- * tower-routes.ts), so that residual cross-path race is an accepted, documented
58
- * boundary, not a regression this lock must close.
59
- * - `POST /api/terminals/:id/write` — NOT covered. It is a raw passthrough
60
- * with no Enter semantics of its own.
61
- * - `tower-websocket.ts` keystrokes and the shellper frame relay — DELIBERATELY
62
- * not covered. That is a human typing into their own terminal; serialising
63
- * it behind an agent's message would make the UI feel stuck, and the human
64
- * is the composer's owner.
65
- *
66
- * So the guarantee is: **two lock-taking `/api/send` submissions (escape/interrupt)
67
- * to one session cannot interleave**, which is the failure that reached production.
68
- * Anything stronger requires the remaining writers to take the lock too.
44
+ * A lock only serialises writers that take it. As of Issue #1365 that is every writer
45
+ * that puts a *message* on a terminal:
46
+ *
47
+ * - `escape` and `interrupt` on `/api/send`, and the delayed `--interrupt` `^C`
48
+ * (`tower-routes.ts`) — the explicit human gate-bypasses.
49
+ * - The mailbox delivery path (`deliverAgentMailSerialized`, Spec 1313) — every normal
50
+ * `/api/send`, every cron notification, every backstop drain. It takes this lock as a
51
+ * LEAF inside its own per-agent serializer, via `submitMessagePaced`.
52
+ *
53
+ * These stay deliberately uncovered:
54
+ *
55
+ * - `POST /api/terminals/:id/write` — a raw passthrough with no Enter semantics of its own.
56
+ * - `tower-websocket.ts` keystrokes and the shellper frame relay — a human typing into
57
+ * their own terminal. Serialising that behind an agent's message would make the UI feel
58
+ * stuck, and the human is the composer's owner.
59
+ *
60
+ * ### Why the mailbox path was converged (Issue #1365)
61
+ *
62
+ * Until #1365 the delivery path held only its per-AGENT serializer — a disjoint lock — and
63
+ * the resulting cross-path race was accepted on the grounds that a gated delivery only ever
64
+ * writes onto a render-verified empty prompt and `interrupt` is an explicit human action.
65
+ * That reasoning covered one ordering (a delivery landing inside the interrupt's `^C`→settle
66
+ * →text window) and missed two:
67
+ *
68
+ * - a `^C` landing inside the DELIVERY's own text→Enter window (50–130 ms+) cleared the
69
+ * composer, so the delivery's Enter submitted nothing — yet every byte had reached the
70
+ * PTY, so the write reported success and the row was marked `delivered`. Silent loss with
71
+ * a false audit record, which is the one outcome Spec 1313 exists to exclude;
72
+ * - `--escape` (ESC, then Enter 50 ms later) produced the truncated variant, and is the
73
+ * MORE likely trigger for a multi-line body, because the delivery's exposed window is
74
+ * longest exactly when the body is long.
75
+ *
76
+ * The "a human is standing at this terminal" premise also does not hold for the DELAYED
77
+ * `^C`, which fires unattended on a timer.
78
+ *
79
+ * ### Lock order, and why there is no cycle
80
+ *
81
+ * Always per-agent → per-terminal. The delivery path takes this lock as a leaf inside
82
+ * `KeyedSerializer`; the operator paths take only this one and never enter the per-agent
83
+ * serializer. Re-entrancy is impossible in the other direction too: `PtySession.write()`
84
+ * emits no `'submit'` signal (only `handleUserInput` does, for human keystrokes), so no
85
+ * write from inside a lock can schedule a delivery synchronously.
86
+ *
87
+ * The lock is a leaf around the WRITE only, never the gate classify. `--interrupt` is the
88
+ * human's escape hatch for a wedged agent; making it queue behind a screen classification
89
+ * would be a real regression for the one action that must always get through.
90
+ *
91
+ * ### Asymmetric acquisition: deliveries decline, operators wait
92
+ *
93
+ * A delivery uses {@link trySubmitToSession} and abandons its turn on contention, because
94
+ * `MailboxDrainer.tick` walks agents SEQUENTIALLY — one delivery parked on a terminal lock
95
+ * would stall every other agent's mail, plus that tick's escalation and prune passes. It
96
+ * costs nothing: a contended terminal means the delivery's in-lock precheck would have
97
+ * aborted it anyway, and the row simply re-delivers on the next clean pass.
98
+ *
99
+ * Operators block — bounded by {@link OPERATOR_SUBMIT_WAIT_CEILING_MS}, because a paced
100
+ * write runs `(lines−1)×10+80` ms and a body is capped only by `parseJsonBody`'s 1 MiB.
101
+ *
102
+ * The ceiling may only ever bypass a DELIVERY write, never another operator (codex review of
103
+ * PR #1492). Operator-vs-operator was ALWAYS fully serialized before #1365 — `submitToSession`
104
+ * had no ceiling — so a ceiling that could skip a queued or in-flight operator would make that
105
+ * one pair strictly WORSE than the old behaviour, which is the opposite of the point. The
106
+ * {@link SubmissionKind} tag plus the pending-operator count is what keeps the guarantee true
107
+ * per pair:
108
+ *
109
+ * - operator vs operator — fully serialized, unbounded wait, exactly as before #1365;
110
+ * - operator vs delivery — serialized under the ceiling, and above it degraded to the
111
+ * pre-#1365 behaviour (two disjoint locks, i.e. no serialization at all), so never worse;
112
+ * - delivery vs delivery — the per-agent serializer, unchanged, plus a declined contention.
113
+ *
114
+ * ### What is guaranteed, and what is not
115
+ *
116
+ * **Serialization is the structural guarantee**: no lock-taking writer can put bytes on a
117
+ * terminal while another lock-taking writer's submission is in flight. That is a property of
118
+ * the lock, not of any check.
119
+ *
120
+ * The delivery path ALSO re-validates its preconditions inside the lock (`writable`, the
121
+ * gate's `ringToken`, and the row's own status). That re-check narrows a window; it does not
122
+ * close one, and it should not be described as if it did:
123
+ *
124
+ * - `ringToken` counts OUTPUT bytes, so input written by an uncovered path (the raw
125
+ * passthrough, or a human's keystrokes) can sit un-echoed on the line and read as
126
+ * unchanged. That echo-lag residual survives this change by design — it is #1473's
127
+ * territory.
128
+ * - Its real structural value is that it makes the ACQUISITION POLICY a free choice: were
129
+ * the delivery ever switched from declining to waiting (e.g. to order an interrupt ahead
130
+ * of its own body, per #1481), the precheck is what would keep that safe.
131
+ *
132
+ * The one hole this lock opens is its own degraded path: an operator whose ceiling expires
133
+ * writes unserialized. Rather than leave that as a second silent-loss route, degraded writes
134
+ * are COUNTED per session ({@link unserializedWriteCount}); `submitMessagePaced` holds a
135
+ * {@link watchBypasses} watch across its write and reports `preempted`, so the delivery holds
136
+ * its row for redelivery instead of reporting a delivery that may have been clobbered.
137
+ * Deliberately no screen re-classification — the question is only "did anyone bypass the lock
138
+ * while I held it?", and a counter answers exactly that. The count is BYTES, not intent: a
139
+ * degraded write whose callback declines to write anything (the delayed `^C` re-checks
140
+ * liveness inside the lock) bumps nothing, because there is nothing for a delivery to have
141
+ * been raced by.
69
142
  */
70
143
  /** Injectable for tests; real timers otherwise. */
71
144
  export interface SubmitClock {
72
145
  sleep(ms: number): Promise<void>;
73
146
  }
147
+ /**
148
+ * What kind of writer a submission is (Issue #1365, codex review).
149
+ *
150
+ * Load-bearing for the wait ceiling: the ceiling may only ever let a writer bypass a
151
+ * DELIVERY write, never another operator. See {@link SubmitOptions.waitCeilingMs}.
152
+ */
153
+ export type SubmissionKind = 'operator' | 'delivery-write';
154
+ /** Options for an operator submission that must not wait unboundedly (Issue #1365). */
155
+ export interface SubmitOptions {
156
+ /**
157
+ * What this submission is. Defaults to `operator` — every pre-#1365 caller of this
158
+ * function is one, and defaulting to the kind that is never bypassable is the safe way
159
+ * round.
160
+ */
161
+ kind?: SubmissionKind;
162
+ /**
163
+ * Max ms to wait for an in-flight submission before proceeding UNSERIALIZED.
164
+ * Omitted (the default) means wait as long as it takes.
165
+ *
166
+ * **Only armed when nothing ahead of us is an operator submission.** Two operator
167
+ * submissions to one terminal were ALWAYS fully serialized before #1365, and a ceiling
168
+ * that could bypass an operator would make this pair strictly worse than that — the one
169
+ * corner where "never worse than the old status quo" would otherwise be false. The
170
+ * ceiling exists to keep the escape hatch responsive against a long DELIVERY, which is
171
+ * the only thing it may skip.
172
+ */
173
+ waitCeilingMs?: number;
174
+ /** Called instead of the write's serialization when {@link waitCeilingMs} expires. */
175
+ onCeilingExpired?: (waitedMs: number) => void;
176
+ /**
177
+ * Consulted immediately after the write callback returns, on the DEGRADED path only:
178
+ * did the write actually put bytes on the terminal? Defaults to yes.
179
+ *
180
+ * The delayed `^C` re-checks `isStillLive()` and `writable` INSIDE the lock and can
181
+ * legitimately write nothing. Counting that as a bypass would make a concurrent delivery
182
+ * report `preempted` and re-deliver — a duplicate charged for a race that never happened.
183
+ * {@link unserializedWriteCount} answers "did bytes bypass the lock while I held it?", so
184
+ * only bytes may bump it.
185
+ */
186
+ wroteBytes?: () => boolean;
187
+ }
188
+ /**
189
+ * How long an OPERATOR submission (`--interrupt`, `--escape`, the delayed `^C`) waits for an
190
+ * in-flight submission before proceeding unserialized (Issue #1365).
191
+ *
192
+ * Needed because a paced write's duration is `(lines−1)×10+80` ms and a request body is capped
193
+ * only by `parseJsonBody`'s 1 MiB, so a 48 KB `--file` of short lines is ~8 minutes on the wire.
194
+ * Blocking `--interrupt` — the human's escape hatch for a wedged agent — behind that would be a
195
+ * worse regression than the interleaving this lock closes. Two seconds comfortably covers every
196
+ * realistic message while keeping the escape hatch responsive.
197
+ *
198
+ * It applies ONLY against a delivery write; behind another operator the wait stays unbounded
199
+ * (see {@link SubmitOptions.waitCeilingMs}). And when it does expire, the caller must SAY so —
200
+ * `/api/send` reports `degraded: true` — because a degraded operator write may interleave with
201
+ * the write it skipped, and the interrupt path has already claimed its row `delivered`.
202
+ */
203
+ export declare const OPERATOR_SUBMIT_WAIT_CEILING_MS = 2000;
204
+ /** A live comparison window over a session's degraded-write count. See {@link watchBypasses}. */
205
+ export interface BypassWatch {
206
+ /** Did a degraded write put bytes on this terminal since the watch opened? */
207
+ raced(): boolean;
208
+ /** Close the watch. Idempotent; call it from a `finally` so no path leaks a watcher. */
209
+ release(): void;
210
+ }
211
+ /**
212
+ * Watch a session for degraded (ceiling-bypassing) writes across your own write.
213
+ *
214
+ * Open before the first byte, {@link BypassWatch.raced} after the last, and
215
+ * {@link BypassWatch.release} in a `finally`. Holding the watch is what pins the underlying
216
+ * count in place: without it the entry may be evicted the moment the session goes idle, and
217
+ * a reset between the two reads would look like "no race".
218
+ */
219
+ export declare function watchBypasses(sessionId: string): BypassWatch;
220
+ /**
221
+ * How many unserialized (ceiling-expired) writes this session has seen.
222
+ *
223
+ * The point of comparison for a writer that wants to know whether its own submission was
224
+ * raced: sample before the first byte, compare after the last. Cheaper and far more
225
+ * direct than re-classifying the screen — it asks "did anyone bypass the lock while I
226
+ * held it?", which is exactly the question, and needs no terminal rendering at all.
227
+ */
228
+ export declare function unserializedWriteCount(sessionId: string): number;
229
+ /**
230
+ * Whether a submission is queued or in flight for this session RIGHT NOW.
231
+ *
232
+ * Read by {@link trySubmitToSession} and exposed for telemetry. Safe to act on
233
+ * without a lock of its own: the runtime is single-threaded and every mutation of
234
+ * `chains` happens with no await in between, so a caller that observes `false`
235
+ * cannot be beaten to the install by another caller in the same tick.
236
+ */
237
+ export declare function isSubmissionInFlight(sessionId: string): boolean;
74
238
  /**
75
239
  * Run a write against a session so that it completes before any other
76
240
  * submission to the same session begins.
@@ -80,11 +244,40 @@ export interface SubmitClock {
80
244
  * keystroke (the Enter) has been written. This is exactly what
81
245
  * `writeMessageToSession` / `writeEscapeToSession` already
82
246
  * return, so callers pass them through unchanged.
247
+ * @param clock injectable sleeper; real timers by default
248
+ * @param options {@link SubmitOptions} — the operator paths pass a wait ceiling
83
249
  * @returns resolves once the submission is complete
84
250
  */
85
- export declare function submitToSession(sessionId: string, write: () => number, clock?: SubmitClock): Promise<void>;
251
+ export declare function submitToSession(sessionId: string, write: () => number, clock?: SubmitClock, options?: SubmitOptions): Promise<void>;
252
+ /**
253
+ * {@link submitToSession} for a writer that would rather skip its turn than wait
254
+ * for one — the gated mailbox delivery path (Issue #1365).
255
+ *
256
+ * Resolves `false` **without writing anything** when another submission already
257
+ * holds the session. That is the right trade for a gated delivery and the wrong one
258
+ * for an operator action, which is why the two differ:
259
+ *
260
+ * - A contended terminal means some other writer is mid-submission, so the
261
+ * delivery's in-lock precheck would have aborted it anyway (the screen has
262
+ * moved, or is about to). Nothing is lost by declining now: the row stays held
263
+ * and the backstop re-delivers within one tick.
264
+ * - Blocking instead would be a genuine liveness regression, because
265
+ * `MailboxDrainer.tick` walks agents SEQUENTIALLY — one agent parked on a
266
+ * terminal lock would stall every other agent's delivery, plus that tick's
267
+ * escalation, owner-notice and prune passes.
268
+ *
269
+ * @returns `true` when the write ran (and completed), `false` when the session was
270
+ * contended and nothing was written.
271
+ */
272
+ export declare function trySubmitToSession(sessionId: string, write: () => number, clock?: SubmitClock): Promise<boolean>;
86
273
  /** Number of sessions with a submission in flight. Test/observability only. */
87
274
  export declare function pendingSubmissionSessions(): number;
88
- /** Drop all chains. Test-only; a live Tower should let them drain. */
275
+ /** Drop all chains and degraded-write counters. Test-only; a live Tower should let them drain. */
89
276
  export declare function resetSubmissionChains(): void;
277
+ /**
278
+ * How many sessions still carry a degraded-write count. Test/observability only — the
279
+ * assertion that {@link unserializedWrites} self-evicts rather than growing for the life of
280
+ * a Tower.
281
+ */
282
+ export declare function bypassCountedSessions(): number;
90
283
  //# sourceMappingURL=session-submit.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"session-submit.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/servers/session-submit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAUH,mDAAmD;AACnD,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,MAAM,EACnB,KAAK,GAAE,WAAuB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAgCf;AAED,+EAA+E;AAC/E,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED,sEAAsE;AACtE,wBAAg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