@cluesmith/codev 3.3.0 → 3.3.2
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.
- package/dashboard-dist/assets/{index-JCbkpAcV.js → index-D3XaKpZW.js} +45 -43
- package/dashboard-dist/assets/index-D3XaKpZW.js.map +1 -0
- package/dashboard-dist/index.html +1 -1
- package/dist/agent-farm/cli.d.ts.map +1 -1
- package/dist/agent-farm/cli.js +99 -36
- package/dist/agent-farm/cli.js.map +1 -1
- package/dist/agent-farm/commands/reset/constants.d.ts +119 -1
- package/dist/agent-farm/commands/reset/constants.d.ts.map +1 -1
- package/dist/agent-farm/commands/reset/constants.js +119 -1
- package/dist/agent-farm/commands/reset/constants.js.map +1 -1
- package/dist/agent-farm/commands/reset/context.d.ts +20 -2
- package/dist/agent-farm/commands/reset/context.d.ts.map +1 -1
- package/dist/agent-farm/commands/reset/context.js +44 -3
- package/dist/agent-farm/commands/reset/context.js.map +1 -1
- package/dist/agent-farm/commands/reset/index.d.ts +7 -7
- package/dist/agent-farm/commands/reset/index.js +8 -8
- package/dist/agent-farm/commands/reset/index.js.map +1 -1
- package/dist/agent-farm/commands/reset/receipt.d.ts +1 -1
- package/dist/agent-farm/commands/reset/receipt.d.ts.map +1 -1
- package/dist/agent-farm/commands/reset/receipt.js +19 -8
- package/dist/agent-farm/commands/reset/receipt.js.map +1 -1
- package/dist/agent-farm/commands/reset/reorient.d.ts +1 -1
- package/dist/agent-farm/commands/reset/reorient.d.ts.map +1 -1
- package/dist/agent-farm/commands/reset/reorient.js +12 -5
- package/dist/agent-farm/commands/reset/reorient.js.map +1 -1
- package/dist/agent-farm/commands/reset/self.d.ts +335 -0
- package/dist/agent-farm/commands/reset/self.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset/self.js +636 -0
- package/dist/agent-farm/commands/reset/self.js.map +1 -0
- package/dist/agent-farm/commands/reset.d.ts +18 -3
- package/dist/agent-farm/commands/reset.d.ts.map +1 -1
- package/dist/agent-farm/commands/reset.js +55 -33
- package/dist/agent-farm/commands/reset.js.map +1 -1
- package/dist/agent-farm/commands/self-refresh.d.ts +60 -0
- package/dist/agent-farm/commands/self-refresh.d.ts.map +1 -0
- package/dist/agent-farm/commands/self-refresh.js +506 -0
- package/dist/agent-farm/commands/self-refresh.js.map +1 -0
- package/dist/agent-farm/commands/send.d.ts.map +1 -1
- package/dist/agent-farm/commands/send.js +27 -2
- package/dist/agent-farm/commands/send.js.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.js +1 -1
- package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
- package/dist/agent-farm/commands/spawn.d.ts +7 -0
- package/dist/agent-farm/commands/spawn.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn.js +13 -1
- package/dist/agent-farm/commands/spawn.js.map +1 -1
- package/dist/agent-farm/commands/tower.d.ts.map +1 -1
- package/dist/agent-farm/commands/tower.js +13 -0
- package/dist/agent-farm/commands/tower.js.map +1 -1
- package/dist/agent-farm/lib/reconnect-backoff.d.ts +10 -0
- package/dist/agent-farm/lib/reconnect-backoff.d.ts.map +1 -1
- package/dist/agent-farm/lib/reconnect-backoff.js +10 -0
- package/dist/agent-farm/lib/reconnect-backoff.js.map +1 -1
- package/dist/agent-farm/lib/tower-client.d.ts +12 -0
- package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
- package/dist/agent-farm/lib/tower-client.js +12 -0
- package/dist/agent-farm/lib/tower-client.js.map +1 -1
- package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -1
- package/dist/agent-farm/lib/tunnel-client.js +7 -3
- package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
- package/dist/agent-farm/servers/canvas-relay.d.ts +60 -0
- package/dist/agent-farm/servers/canvas-relay.d.ts.map +1 -0
- package/dist/agent-farm/servers/canvas-relay.js +376 -0
- package/dist/agent-farm/servers/canvas-relay.js.map +1 -0
- package/dist/agent-farm/servers/gate-profiles.d.ts +1 -1
- package/dist/agent-farm/servers/gate-profiles.js +1 -1
- package/dist/agent-farm/servers/mailbox-delivery.d.ts +141 -13
- package/dist/agent-farm/servers/mailbox-delivery.d.ts.map +1 -1
- package/dist/agent-farm/servers/mailbox-delivery.js +172 -16
- package/dist/agent-farm/servers/mailbox-delivery.js.map +1 -1
- package/dist/agent-farm/servers/mailbox-wiring.d.ts +24 -2
- package/dist/agent-farm/servers/mailbox-wiring.d.ts.map +1 -1
- package/dist/agent-farm/servers/mailbox-wiring.js +92 -32
- package/dist/agent-farm/servers/mailbox-wiring.js.map +1 -1
- package/dist/agent-farm/servers/message-write.d.ts +58 -18
- package/dist/agent-farm/servers/message-write.d.ts.map +1 -1
- package/dist/agent-farm/servers/message-write.js +73 -28
- package/dist/agent-farm/servers/message-write.js.map +1 -1
- package/dist/agent-farm/servers/overview.d.ts +19 -0
- package/dist/agent-farm/servers/overview.d.ts.map +1 -1
- package/dist/agent-farm/servers/overview.js +78 -1
- package/dist/agent-farm/servers/overview.js.map +1 -1
- package/dist/agent-farm/servers/render-gate.d.ts +13 -0
- package/dist/agent-farm/servers/render-gate.d.ts.map +1 -1
- package/dist/agent-farm/servers/render-gate.js +21 -0
- package/dist/agent-farm/servers/render-gate.js.map +1 -1
- package/dist/agent-farm/servers/session-submit.d.ts +221 -28
- package/dist/agent-farm/servers/session-submit.d.ts.map +1 -1
- package/dist/agent-farm/servers/session-submit.js +334 -43
- package/dist/agent-farm/servers/session-submit.js.map +1 -1
- package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-routes.js +269 -64
- package/dist/agent-farm/servers/tower-routes.js.map +1 -1
- package/dist/agent-farm/servers/tower-server.js +25 -3
- package/dist/agent-farm/servers/tower-server.js.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.d.ts +6 -0
- package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.js +30 -5
- package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
- package/dist/agent-farm/servers/tower-tunnel.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-tunnel.js +14 -0
- package/dist/agent-farm/servers/tower-tunnel.js.map +1 -1
- package/dist/agent-farm/servers/tower-websocket.d.ts +6 -1
- package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-websocket.js +90 -37
- package/dist/agent-farm/servers/tower-websocket.js.map +1 -1
- package/dist/agent-farm/types.d.ts +37 -2
- package/dist/agent-farm/types.d.ts.map +1 -1
- package/dist/agent-farm/utils/harness.d.ts +3 -3
- package/dist/agent-farm/utils/harness.js +1 -1
- package/dist/agent-farm/utils/message-format.d.ts +67 -3
- package/dist/agent-farm/utils/message-format.d.ts.map +1 -1
- package/dist/agent-farm/utils/message-format.js +127 -14
- package/dist/agent-farm/utils/message-format.js.map +1 -1
- package/dist/agent-farm/utils/server-utils.d.ts +86 -4
- package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
- package/dist/agent-farm/utils/server-utils.js +303 -5
- package/dist/agent-farm/utils/server-utils.js.map +1 -1
- package/dist/commands/porch/context-refresh.d.ts +181 -0
- package/dist/commands/porch/context-refresh.d.ts.map +1 -0
- package/dist/commands/porch/context-refresh.js +270 -0
- package/dist/commands/porch/context-refresh.js.map +1 -0
- package/dist/commands/porch/index.d.ts +6 -0
- package/dist/commands/porch/index.d.ts.map +1 -1
- package/dist/commands/porch/index.js +46 -0
- package/dist/commands/porch/index.js.map +1 -1
- package/dist/commands/porch/next.d.ts +0 -9
- package/dist/commands/porch/next.d.ts.map +1 -1
- package/dist/commands/porch/next.js +133 -4
- package/dist/commands/porch/next.js.map +1 -1
- package/dist/commands/porch/protocol.d.ts.map +1 -1
- package/dist/commands/porch/protocol.js +102 -0
- package/dist/commands/porch/protocol.js.map +1 -1
- package/dist/commands/porch/types.d.ts +61 -0
- package/dist/commands/porch/types.d.ts.map +1 -1
- package/dist/lib/forge-contracts.d.ts +9 -0
- package/dist/lib/forge-contracts.d.ts.map +1 -1
- package/dist/lib/forge-contracts.js.map +1 -1
- package/dist/lib/github.d.ts +15 -1
- package/dist/lib/github.d.ts.map +1 -1
- package/dist/lib/github.js +17 -0
- package/dist/lib/github.js.map +1 -1
- package/dist/lib/self-refresh-invocation.d.ts +60 -0
- package/dist/lib/self-refresh-invocation.d.ts.map +1 -0
- package/dist/lib/self-refresh-invocation.js +64 -0
- package/dist/lib/self-refresh-invocation.js.map +1 -0
- package/dist/lib/test-env.d.ts +50 -0
- package/dist/lib/test-env.d.ts.map +1 -1
- package/dist/lib/test-env.js +76 -0
- package/dist/lib/test-env.js.map +1 -1
- package/dist/terminal/attach-replay.d.ts +39 -0
- package/dist/terminal/attach-replay.d.ts.map +1 -0
- package/dist/terminal/attach-replay.js +76 -0
- package/dist/terminal/attach-replay.js.map +1 -0
- package/dist/terminal/pty-manager.d.ts.map +1 -1
- package/dist/terminal/pty-manager.js +35 -17
- package/dist/terminal/pty-manager.js.map +1 -1
- package/dist/terminal/pty-session.d.ts +81 -12
- package/dist/terminal/pty-session.d.ts.map +1 -1
- package/dist/terminal/pty-session.js +113 -25
- package/dist/terminal/pty-session.js.map +1 -1
- package/dist/terminal/session-screen.d.ts +25 -0
- package/dist/terminal/session-screen.d.ts.map +1 -1
- package/dist/terminal/session-screen.js +53 -8
- package/dist/terminal/session-screen.js.map +1 -1
- package/package.json +10 -7
- package/scripts/forge/gitea/pr-view.sh +4 -1
- package/scripts/forge/github/pr-view.sh +1 -1
- package/scripts/forge/gitlab/pr-view.sh +4 -1
- package/skeleton/.claude/skills/afx/SKILL.md +54 -0
- package/skeleton/.claude/skills/arch-save/SKILL.md +8 -2
- package/skeleton/.claude/skills/builder-refresh/SKILL.md +138 -0
- package/skeleton/.codex/skills/afx/SKILL.md +54 -0
- package/skeleton/.codex/skills/arch-save/SKILL.md +8 -2
- package/skeleton/.codex/skills/builder-refresh/SKILL.md +138 -0
- package/skeleton/protocol-schema.json +17 -0
- package/skeleton/protocols/air/protocol.json +1 -1
- package/skeleton/protocols/aspir/protocol.json +5 -1
- package/skeleton/protocols/bugfix/protocol.json +1 -1
- package/skeleton/protocols/experiment/protocol.json +1 -1
- package/skeleton/protocols/maintain/protocol.json +1 -1
- package/skeleton/protocols/pir/builder-prompt.md +3 -2
- package/skeleton/protocols/pir/prompts/implement.md +1 -1
- package/skeleton/protocols/pir/prompts/plan.md +1 -1
- package/skeleton/protocols/pir/prompts/review.md +1 -1
- package/skeleton/protocols/pir/protocol.json +1 -1
- package/skeleton/protocols/pir/protocol.md +4 -4
- package/skeleton/protocols/protocol-schema.json +17 -0
- package/skeleton/protocols/research/protocol.json +1 -1
- package/skeleton/protocols/spike/protocol.json +1 -1
- package/skeleton/protocols/spir/protocol.json +5 -1
- package/skeleton/resources/commands/agent-farm.md +14 -11
- package/skeleton/roles/builder.md +3 -4
- package/templates/3d-viewer.html +32 -4
- package/templates/open.html +58 -12
- package/templates/tower.html +26 -7
- package/templates/vendor/three-3MFLoader.js +1478 -0
- package/templates/vendor/three-STLLoader.js +410 -0
- package/templates/vendor/three-TrackballControls.js +828 -0
- package/templates/vendor/three-fflate.module.js +2474 -0
- package/templates/vendor/three.module.js +53044 -0
- package/dashboard-dist/assets/index-JCbkpAcV.js.map +0 -1
|
@@ -12,9 +12,16 @@
|
|
|
12
12
|
* TWO deliberate exceptions write a body OUTSIDE this path, both explicit human
|
|
13
13
|
* gate-bypasses documented at their `tower-routes.ts` call sites: immediate `--interrupt`
|
|
14
14
|
* (Ctrl+C then the message) and `--escape` (a bare ESC). They are the operator's "I am at
|
|
15
|
-
* this terminal now" actions
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* this terminal now" actions — every autonomous/scheduled/held send, by contrast, delivers
|
|
16
|
+
* through this gate.
|
|
17
|
+
*
|
|
18
|
+
* They are no longer on a DISJOINT lock, though (Issue #1365). This path's write edge takes
|
|
19
|
+
* the same per-terminal submission lock (`session-submit.ts`) those bypasses take, as a leaf
|
|
20
|
+
* inside the per-agent serializer below — so a `^C`/ESC can no longer land inside a
|
|
21
|
+
* delivery's own text→Enter window, clear or truncate the composer, and leave the row marked
|
|
22
|
+
* `delivered` for a message the agent never saw whole. Lock order is always per-agent →
|
|
23
|
+
* per-terminal; see `session-submit.ts` for the full boundary, including what the lock does
|
|
24
|
+
* NOT cover.
|
|
18
25
|
*
|
|
19
26
|
* This module replaces the in-memory `SendBuffer` (retired in this phase): held
|
|
20
27
|
* messages now live in the durable `mailbox` table, so nothing is lost to a Tower
|
|
@@ -28,6 +35,7 @@
|
|
|
28
35
|
import type Database from 'better-sqlite3';
|
|
29
36
|
import type { DbMailbox, MailboxReason } from '../db/types.js';
|
|
30
37
|
import type { GateProfile, GateVerdict } from './render-gate.js';
|
|
38
|
+
import type { PacedSubmitResult } from './message-write.js';
|
|
31
39
|
/**
|
|
32
40
|
* The structural view of a live PTY session the delivery path needs. `PtySession`
|
|
33
41
|
* satisfies this (ringBuffer + info getter + the Spec 1313 identity getters +
|
|
@@ -35,6 +43,13 @@ import type { GateProfile, GateVerdict } from './render-gate.js';
|
|
|
35
43
|
* imports the terminal layer.
|
|
36
44
|
*/
|
|
37
45
|
export interface DeliverySession {
|
|
46
|
+
/**
|
|
47
|
+
* The live terminal/session id — the key of the per-terminal submission lock the write
|
|
48
|
+
* edge takes (Issue #1365). `PtySession` already carries it; a test double MUST supply a
|
|
49
|
+
* real, distinct one, and {@link submitMessagePaced} throws if it is missing rather than
|
|
50
|
+
* letting every lock collapse onto a single `undefined` key.
|
|
51
|
+
*/
|
|
52
|
+
readonly id: string;
|
|
38
53
|
/**
|
|
39
54
|
* The session's MONOTONE cumulative output-byte counter (Spec 1313 render-gate round 2) —
|
|
40
55
|
* the gate's change token. It advances on ANY new output and NEVER decreases, so two samples
|
|
@@ -48,6 +63,15 @@ export interface DeliverySession {
|
|
|
48
63
|
* {@link MailboxDrainer}). `PtySession` exposes it (sourced from `RingBuffer.bytesWritten`).
|
|
49
64
|
*/
|
|
50
65
|
readonly bytesWritten: number;
|
|
66
|
+
/**
|
|
67
|
+
* Epoch ms of the session's most recent OUTPUT byte (Issue #1573 settle-before-write).
|
|
68
|
+
* `PtySession` tracks it at the same chokepoint that feeds the ring and the gate mirror.
|
|
69
|
+
* The delivery path requires a quiet interval here before it writes: the render gate
|
|
70
|
+
* proves a screen IS a clean prompt, but says nothing about whether it is still being
|
|
71
|
+
* PAINTED — a composer that repainted 1 ms ago classifies identically to one idle a
|
|
72
|
+
* minute, and writing into a settling composer is what ate the leading bytes in #1521.
|
|
73
|
+
*/
|
|
74
|
+
readonly lastDataAt: number;
|
|
51
75
|
readonly info: {
|
|
52
76
|
cols: number;
|
|
53
77
|
rows: number;
|
|
@@ -66,6 +90,22 @@ export interface DeliverySession {
|
|
|
66
90
|
readonly writable: boolean;
|
|
67
91
|
write(data: string): boolean;
|
|
68
92
|
}
|
|
93
|
+
/**
|
|
94
|
+
* Why a gated write abandoned inside the per-terminal lock (Issue #1365), decided by
|
|
95
|
+
* {@link deliverAgentMail}'s precheck at the write instant rather than before the lock.
|
|
96
|
+
*/
|
|
97
|
+
export type WriteAbort =
|
|
98
|
+
/** Re-hold the row for this reason and retry on a later clean pass. */
|
|
99
|
+
{
|
|
100
|
+
kind: 'hold';
|
|
101
|
+
reason: MailboxReason;
|
|
102
|
+
}
|
|
103
|
+
/** The row was dismissed/superseded under us — a terminal state, so it must NOT be re-held. */
|
|
104
|
+
| {
|
|
105
|
+
kind: 'row-resolved';
|
|
106
|
+
};
|
|
107
|
+
/** Outcome of the gated write edge. See {@link PacedSubmitResult}. */
|
|
108
|
+
export type WriteResult = PacedSubmitResult<WriteAbort>;
|
|
69
109
|
/** Broadcast frame for a delivered message (the dashboard/inbox message event). */
|
|
70
110
|
export interface DeliveredBroadcast {
|
|
71
111
|
type: 'message';
|
|
@@ -98,17 +138,24 @@ export interface DeliveryPorts {
|
|
|
98
138
|
*/
|
|
99
139
|
classify(session: DeliverySession, profile: GateProfile): Promise<GateVerdict>;
|
|
100
140
|
/**
|
|
101
|
-
* Write a formatted message (text + Enter, unless `noEnter`) to the session
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* `await`s it for two reasons: (1) completion chaining — the per-agent
|
|
106
|
-
* holds the line until the submit is entirely on the wire, so the next
|
|
107
|
-
* never starts mid-write; (2) the
|
|
108
|
-
*
|
|
109
|
-
*
|
|
141
|
+
* Write a formatted message (text + Enter, unless `noEnter`) to the session as ONE
|
|
142
|
+
* submission on the session's per-terminal lock, and report what actually happened.
|
|
143
|
+
* Resolves only once the paced write — trailing Enter included — has completed.
|
|
144
|
+
*
|
|
145
|
+
* The delivery `await`s it for two reasons: (1) completion chaining — the per-agent
|
|
146
|
+
* serializer holds the line until the submit is entirely on the wire, so the next
|
|
147
|
+
* delivery never starts mid-write; (2) the result gates markDelivered — anything but
|
|
148
|
+
* `written` must never be reported as delivered (Spec 1313 integration review — the
|
|
149
|
+
* silent-loss finding; Issue #1365 extended the same rule to in-lock refusals).
|
|
150
|
+
*
|
|
151
|
+
* `precheck` is invoked by the binding INSIDE the lock, immediately before the first
|
|
152
|
+
* byte, and returning non-null aborts with nothing written. It exists because taking
|
|
153
|
+
* the lock alone would only move the race: a delivery that classified a clean screen
|
|
154
|
+
* and then waited behind another submission would write onto the screen that
|
|
155
|
+
* submission just changed. All of the reason authority stays here in the delivery
|
|
156
|
+
* module — the binding only relays the verdict.
|
|
110
157
|
*/
|
|
111
|
-
writeMessage(session: DeliverySession, formattedMessage: string, noEnter: boolean):
|
|
158
|
+
writeMessage(session: DeliverySession, formattedMessage: string, noEnter: boolean, precheck: () => WriteAbort | null): WriteResult | Promise<WriteResult>;
|
|
112
159
|
/** Emit the delivered-message broadcast frame. */
|
|
113
160
|
broadcast(frame: DeliveredBroadcast): void;
|
|
114
161
|
/**
|
|
@@ -157,6 +204,31 @@ export interface DeliveryPorts {
|
|
|
157
204
|
* already-delivered notice. OPTIONAL, like {@link escalateHeldToOwner}.
|
|
158
205
|
*/
|
|
159
206
|
clearHeldOwnerNotice?(workspacePath: string, toAgent: string): void;
|
|
207
|
+
/**
|
|
208
|
+
* Begin watching for evidence that a message actually LANDS on the receiving terminal
|
|
209
|
+
* (Issue #1573). Called with the normalized needle from {@link echoNeedle} immediately
|
|
210
|
+
* BEFORE the write; the returned {@link EchoWatch} is consulted after it and before
|
|
211
|
+
* `markDelivered`.
|
|
212
|
+
*
|
|
213
|
+
* This is the only end-to-end evidence the delivery path has. Everything upstream of it
|
|
214
|
+
* proves the bytes were QUEUED, never that the terminal absorbed them: `session.write`
|
|
215
|
+
* returns true whenever the socket object is connected, so a receiving composer that ate
|
|
216
|
+
* the leading bytes (#1564) still produced a clean `written`, and the row was marked
|
|
217
|
+
* delivered for a message the agent never saw whole.
|
|
218
|
+
*
|
|
219
|
+
* Split into watch-then-verify rather than a single after-the-fact check because mere
|
|
220
|
+
* PRESENCE of the header proves nothing (CMAP round 1 — codex): a prior attempt's echo
|
|
221
|
+
* sits in the same scrollback, so a redelivery whose bytes were swallowed would match the
|
|
222
|
+
* copy the FIRST attempt left behind and be certified. The watch samples what the screen
|
|
223
|
+
* already showed, so verification can require evidence the write itself produced.
|
|
224
|
+
*
|
|
225
|
+
* DELIBERATELY NARROW: presence of the header line, nothing else. No screen diffing, no
|
|
226
|
+
* repair, no per-harness branches. A negative therefore means "could not confirm", not
|
|
227
|
+
* "definitely lost" — so the caller HOLDS the row for the existing redelivery machinery
|
|
228
|
+
* rather than dropping it, making the direction of error a duplicate delivery instead of
|
|
229
|
+
* a silent loss.
|
|
230
|
+
*/
|
|
231
|
+
watchEcho(session: DeliverySession, needle: string): Promise<EchoWatch>;
|
|
160
232
|
log(message: string): void;
|
|
161
233
|
now(): number;
|
|
162
234
|
}
|
|
@@ -218,6 +290,62 @@ export interface DeliveryOutcome {
|
|
|
218
290
|
*/
|
|
219
291
|
detail?: GateVerdict['detail'];
|
|
220
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* How long the receiving session's screen must have been QUIET before a gated delivery may
|
|
295
|
+
* write onto it (Issue #1573).
|
|
296
|
+
*
|
|
297
|
+
* The render gate answers "is this a clean prompt?" and nothing else — it has no stability
|
|
298
|
+
* requirement, so a composer captured 1 ms into its post-turn repaint passes exactly like one
|
|
299
|
+
* idle for a minute. Writing into that window is how #1521's leading bytes were eaten
|
|
300
|
+
* (`[USER via VS Code]` arriving as `ER via VS Code`). The quiescence drain trigger happened to
|
|
301
|
+
* be safe because it only fires after an output-idle debounce; the request path (`handleSend`'s
|
|
302
|
+
* immediate delivery attempt) and the `'submit'` fast trigger had no such gap. This gives all
|
|
303
|
+
* three the same floor.
|
|
304
|
+
*
|
|
305
|
+
* A hold here is cheap and self-correcting: the backstop drainer retries on its existing
|
|
306
|
+
* schedule, so the cost of being early is at most one tick of latency.
|
|
307
|
+
*/
|
|
308
|
+
export declare const SETTLE_BEFORE_WRITE_MS = 250;
|
|
309
|
+
/**
|
|
310
|
+
* A pre-write sample of the receiving terminal, plus the confirmation that the write added
|
|
311
|
+
* something to it (Issue #1573). Returned by {@link DeliveryPorts.watchEcho}.
|
|
312
|
+
*/
|
|
313
|
+
export interface EchoWatch {
|
|
314
|
+
/**
|
|
315
|
+
* Did the message's header appear on the terminal as a result of the write this watch was
|
|
316
|
+
* opened for? Bounded — it waits a short interval and then answers false, which the caller
|
|
317
|
+
* treats as "could not confirm" and holds.
|
|
318
|
+
*/
|
|
319
|
+
verify(): Promise<boolean>;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Reduce text to its alphanumeric skeleton for echo matching (Issue #1573).
|
|
323
|
+
*
|
|
324
|
+
* Matching the header line literally does not survive contact with real harnesses. Measured
|
|
325
|
+
* 2026-09-01 against live PTYs: claude echoes `### [ARCHITECT INSTRUCTION | <ts>] ###`
|
|
326
|
+
* verbatim into its composer, then — once the message is SUBMITTED — re-renders it as
|
|
327
|
+
* `[ARCHITECT INSTRUCTION | <ts>]`, the `###` fences consumed as a markdown H3. codex keeps the
|
|
328
|
+
* fences. Dropping every non-alphanumeric byte makes both forms the same string, and
|
|
329
|
+
* incidentally absorbs the other three ways a TUI mangles a line it is only *displaying*: a
|
|
330
|
+
* `> `/`❯ ` quote prefix, indentation, and wrapping at the viewport width (line breaks vanish
|
|
331
|
+
* with everything else, so a header split across two rows still matches).
|
|
332
|
+
*
|
|
333
|
+
* It is a presence probe, not a fidelity check — it deliberately cannot tell you the body
|
|
334
|
+
* arrived intact, only that the head of the message reached the screen.
|
|
335
|
+
*/
|
|
336
|
+
export declare function normalizeForEcho(text: string): string;
|
|
337
|
+
/**
|
|
338
|
+
* The needle {@link DeliveryPorts.watchEcho} opens on: the formatted message's FIRST line,
|
|
339
|
+
* normalized. Returns `''` when it is too short to be distinctive (see
|
|
340
|
+
* {@link MIN_ECHO_NEEDLE_LENGTH}), which the caller reads as "skip verification".
|
|
341
|
+
*
|
|
342
|
+
* The first line and only the first line. A formatted send puts its `### [ARCHITECT
|
|
343
|
+
* INSTRUCTION | <iso timestamp>] ###` header there — long, and unique per message thanks to the
|
|
344
|
+
* timestamp. The TAIL would be the easier thing to find on a scrolled screen and is exactly the
|
|
345
|
+
* wrong choice: #1564's message arrived as its FINAL ~30 characters, so a footer needle would
|
|
346
|
+
* have certified the very corruption this check exists to catch.
|
|
347
|
+
*/
|
|
348
|
+
export declare function echoNeedle(formattedMessage: string): string;
|
|
221
349
|
/**
|
|
222
350
|
* Composite key identifying an agent within a workspace, used to dedupe the
|
|
223
351
|
* backstop's per-agent work and to key the liveness-telemetry streak map (which
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mailbox-delivery.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/servers/mailbox-delivery.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"mailbox-delivery.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/servers/mailbox-delivery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAGH,OAAO,KAAK,QAAQ,M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AC,IAAI,CAAC;CAgCrE"}
|
|
@@ -12,9 +12,16 @@
|
|
|
12
12
|
* TWO deliberate exceptions write a body OUTSIDE this path, both explicit human
|
|
13
13
|
* gate-bypasses documented at their `tower-routes.ts` call sites: immediate `--interrupt`
|
|
14
14
|
* (Ctrl+C then the message) and `--escape` (a bare ESC). They are the operator's "I am at
|
|
15
|
-
* this terminal now" actions
|
|
16
|
-
*
|
|
17
|
-
*
|
|
15
|
+
* this terminal now" actions — every autonomous/scheduled/held send, by contrast, delivers
|
|
16
|
+
* through this gate.
|
|
17
|
+
*
|
|
18
|
+
* They are no longer on a DISJOINT lock, though (Issue #1365). This path's write edge takes
|
|
19
|
+
* the same per-terminal submission lock (`session-submit.ts`) those bypasses take, as a leaf
|
|
20
|
+
* inside the per-agent serializer below — so a `^C`/ESC can no longer land inside a
|
|
21
|
+
* delivery's own text→Enter window, clear or truncate the composer, and leave the row marked
|
|
22
|
+
* `delivered` for a message the agent never saw whole. Lock order is always per-agent →
|
|
23
|
+
* per-terminal; see `session-submit.ts` for the full boundary, including what the lock does
|
|
24
|
+
* NOT cover.
|
|
18
25
|
*
|
|
19
26
|
* This module replaces the in-memory `SendBuffer` (retired in this phase): held
|
|
20
27
|
* messages now live in the durable `mailbox` table, so nothing is lost to a Tower
|
|
@@ -41,6 +48,72 @@ import { KeyedSerializer } from './write-queue.js';
|
|
|
41
48
|
function isClassifierStuck(reason, detail) {
|
|
42
49
|
return reason === 'no-profile' || detail === 'no-region-end' || detail === 'no-composer-marker';
|
|
43
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* How long the receiving session's screen must have been QUIET before a gated delivery may
|
|
53
|
+
* write onto it (Issue #1573).
|
|
54
|
+
*
|
|
55
|
+
* The render gate answers "is this a clean prompt?" and nothing else — it has no stability
|
|
56
|
+
* requirement, so a composer captured 1 ms into its post-turn repaint passes exactly like one
|
|
57
|
+
* idle for a minute. Writing into that window is how #1521's leading bytes were eaten
|
|
58
|
+
* (`[USER via VS Code]` arriving as `ER via VS Code`). The quiescence drain trigger happened to
|
|
59
|
+
* be safe because it only fires after an output-idle debounce; the request path (`handleSend`'s
|
|
60
|
+
* immediate delivery attempt) and the `'submit'` fast trigger had no such gap. This gives all
|
|
61
|
+
* three the same floor.
|
|
62
|
+
*
|
|
63
|
+
* A hold here is cheap and self-correcting: the backstop drainer retries on its existing
|
|
64
|
+
* schedule, so the cost of being early is at most one tick of latency.
|
|
65
|
+
*/
|
|
66
|
+
export const SETTLE_BEFORE_WRITE_MS = 250;
|
|
67
|
+
/**
|
|
68
|
+
* Has the session's screen been quiet long enough to write onto (Issue #1573)?
|
|
69
|
+
*
|
|
70
|
+
* Phrased as a positive `>=` rather than a negated `<` so that a session carrying no usable
|
|
71
|
+
* timestamp — the comparison yields NaN, and every NaN comparison is false — reads as NOT
|
|
72
|
+
* settled and holds. An unknown screen age is exactly the case that must not be written into.
|
|
73
|
+
*/
|
|
74
|
+
function settled(ports, session) {
|
|
75
|
+
return ports.now() - session.lastDataAt >= SETTLE_BEFORE_WRITE_MS;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Minimum length of a normalized {@link echoNeedle} for it to be worth matching. Below this a
|
|
79
|
+
* needle is not distinctive enough to prove anything — a two-character raw message would match
|
|
80
|
+
* incidental screen text and turn verification into a rubber stamp. Short raw sends therefore
|
|
81
|
+
* skip verification (today's behavior) rather than being confirmed by an accident.
|
|
82
|
+
*/
|
|
83
|
+
const MIN_ECHO_NEEDLE_LENGTH = 12;
|
|
84
|
+
/**
|
|
85
|
+
* Reduce text to its alphanumeric skeleton for echo matching (Issue #1573).
|
|
86
|
+
*
|
|
87
|
+
* Matching the header line literally does not survive contact with real harnesses. Measured
|
|
88
|
+
* 2026-09-01 against live PTYs: claude echoes `### [ARCHITECT INSTRUCTION | <ts>] ###`
|
|
89
|
+
* verbatim into its composer, then — once the message is SUBMITTED — re-renders it as
|
|
90
|
+
* `[ARCHITECT INSTRUCTION | <ts>]`, the `###` fences consumed as a markdown H3. codex keeps the
|
|
91
|
+
* fences. Dropping every non-alphanumeric byte makes both forms the same string, and
|
|
92
|
+
* incidentally absorbs the other three ways a TUI mangles a line it is only *displaying*: a
|
|
93
|
+
* `> `/`❯ ` quote prefix, indentation, and wrapping at the viewport width (line breaks vanish
|
|
94
|
+
* with everything else, so a header split across two rows still matches).
|
|
95
|
+
*
|
|
96
|
+
* It is a presence probe, not a fidelity check — it deliberately cannot tell you the body
|
|
97
|
+
* arrived intact, only that the head of the message reached the screen.
|
|
98
|
+
*/
|
|
99
|
+
export function normalizeForEcho(text) {
|
|
100
|
+
return text.replace(/[^A-Za-z0-9]/g, '');
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The needle {@link DeliveryPorts.watchEcho} opens on: the formatted message's FIRST line,
|
|
104
|
+
* normalized. Returns `''` when it is too short to be distinctive (see
|
|
105
|
+
* {@link MIN_ECHO_NEEDLE_LENGTH}), which the caller reads as "skip verification".
|
|
106
|
+
*
|
|
107
|
+
* The first line and only the first line. A formatted send puts its `### [ARCHITECT
|
|
108
|
+
* INSTRUCTION | <iso timestamp>] ###` header there — long, and unique per message thanks to the
|
|
109
|
+
* timestamp. The TAIL would be the easier thing to find on a scrolled screen and is exactly the
|
|
110
|
+
* wrong choice: #1564's message arrived as its FINAL ~30 characters, so a footer needle would
|
|
111
|
+
* have certified the very corruption this check exists to catch.
|
|
112
|
+
*/
|
|
113
|
+
export function echoNeedle(formattedMessage) {
|
|
114
|
+
const needle = normalizeForEcho(formattedMessage.split('\n', 1)[0]);
|
|
115
|
+
return needle.length >= MIN_ECHO_NEEDLE_LENGTH ? needle : '';
|
|
116
|
+
}
|
|
44
117
|
/**
|
|
45
118
|
* Composite key identifying an agent within a workspace, used to dedupe the
|
|
46
119
|
* backstop's per-agent work and to key the liveness-telemetry streak map (which
|
|
@@ -160,6 +233,12 @@ export async function deliverAgentMail(ports, db, workspacePath, toAgent, memo)
|
|
|
160
233
|
// trivially.)
|
|
161
234
|
if (ringToken(session, profile) !== tokenBefore)
|
|
162
235
|
return hold('busy');
|
|
236
|
+
// Settle-before-write (Issue #1573). A clean verdict says the composer is EMPTY, not that it
|
|
237
|
+
// has finished being drawn. Require a quiet interval since the session's last output byte
|
|
238
|
+
// before putting anything on the line; see {@link SETTLE_BEFORE_WRITE_MS}. Re-checked inside
|
|
239
|
+
// the per-terminal lock below, because that is where the last byte before ours can land.
|
|
240
|
+
if (!settled(ports, session))
|
|
241
|
+
return hold('busy');
|
|
163
242
|
// Clean, verified-empty prompt → deliver the oldest held message. Await the
|
|
164
243
|
// write's paced completion so a serialized follow-up delivery never begins
|
|
165
244
|
// until this message's text + Enter is fully on the wire.
|
|
@@ -185,11 +264,42 @@ export async function deliverAgentMail(ports, db, workspacePath, toAgent, memo)
|
|
|
185
264
|
// delivered off the paced-write timer.
|
|
186
265
|
if (!session.writable)
|
|
187
266
|
return hold('no-live-pty');
|
|
188
|
-
//
|
|
189
|
-
//
|
|
190
|
-
|
|
267
|
+
// Re-validate EVERYTHING at the write instant, inside the per-terminal lock (Issue #1365).
|
|
268
|
+
// The three checks above (screen unchanged, session writable, row still held) were made
|
|
269
|
+
// before the lock; between them and the first byte another writer may hold the terminal,
|
|
270
|
+
// and this delivery may have waited. Without this, routing the write through the lock would
|
|
271
|
+
// merely relocate the race it exists to close: a delivery could write onto a screen that an
|
|
272
|
+
// `--interrupt`/`--escape` had just cleared. Cheap enough to repeat — a synchronous ring
|
|
273
|
+
// read and one indexed better-sqlite3 lookup.
|
|
274
|
+
//
|
|
275
|
+
// The residual it CANNOT close: `ringToken` counts OUTPUT bytes, so input written by a
|
|
276
|
+
// path that does not take this lock (the raw `/api/terminals/:id/write` passthrough, or a
|
|
277
|
+
// human's keystrokes over the WebSocket) can sit un-echoed on the line and read as
|
|
278
|
+
// unchanged. Serialization — not this precheck — is what makes the lock-taking writers
|
|
279
|
+
// safe; the echo-lag residual for the rest is #1473's territory.
|
|
280
|
+
const precheck = () => {
|
|
281
|
+
if (!session.writable)
|
|
282
|
+
return { kind: 'hold', reason: 'no-live-pty' };
|
|
283
|
+
if (ringToken(session, profile) !== tokenBefore)
|
|
284
|
+
return { kind: 'hold', reason: 'busy' };
|
|
285
|
+
if (!settled(ports, session))
|
|
286
|
+
return { kind: 'hold', reason: 'busy' };
|
|
287
|
+
const stillHeld = getById(db, row.id);
|
|
288
|
+
if (!stillHeld || stillHeld.status !== 'held')
|
|
289
|
+
return { kind: 'row-resolved' };
|
|
290
|
+
return null;
|
|
291
|
+
};
|
|
292
|
+
// Open the echo watch BEFORE the write (Issue #1573). It samples what the terminal already
|
|
293
|
+
// shows, so the check after the write can require evidence THIS write produced rather than
|
|
294
|
+
// accepting a copy an earlier attempt left in scrollback. Null when the message has no
|
|
295
|
+
// header distinctive enough to look for (see {@link echoNeedle}).
|
|
296
|
+
const needle = echoNeedle(current.formatted_message);
|
|
297
|
+
const echo = needle ? await ports.watchEcho(session, needle) : null;
|
|
298
|
+
// Default to a hold so an unobserved result is the SAFE failure mode (hold, never a false
|
|
299
|
+
// delivery); the try either assigns the real result or throws past this point.
|
|
300
|
+
let result = { status: 'aborted', abort: { kind: 'hold', reason: 'busy' } };
|
|
191
301
|
try {
|
|
192
|
-
|
|
302
|
+
result = await ports.writeMessage(session, current.formatted_message, current.no_enter === 1, precheck);
|
|
193
303
|
}
|
|
194
304
|
finally {
|
|
195
305
|
// Invalidate the memo on EVERY write outcome — a clean `true`, a dropped-write `false`, OR a
|
|
@@ -209,16 +319,62 @@ export async function deliverAgentMail(ports, db, workspacePath, toAgent, memo)
|
|
|
209
319
|
// the pre-existing gate→write INPUT race in the review's Technical Debt.
|
|
210
320
|
memo?.delete(cacheKey);
|
|
211
321
|
}
|
|
212
|
-
//
|
|
213
|
-
//
|
|
214
|
-
//
|
|
215
|
-
//
|
|
216
|
-
//
|
|
217
|
-
//
|
|
218
|
-
//
|
|
219
|
-
//
|
|
220
|
-
|
|
322
|
+
// Anything short of a complete submit holds the row — a delivery is marked delivered only when
|
|
323
|
+
// every byte, Enter included, reached the terminal.
|
|
324
|
+
//
|
|
325
|
+
// • `dropped` — a PTY write was dropped (#1198): zero-or-partial bytes reached the terminal,
|
|
326
|
+
// the exact silent loss this spec exists to prevent (Spec 1313 integration review — Codex).
|
|
327
|
+
// The t=0 `writable` precheck cannot catch a socket that dies mid-pace (the text/lines/Enter
|
|
328
|
+
// fire across setTimeout gaps). Any bytes already on the wire only make the line dirty; the
|
|
329
|
+
// render gate then holds on that draft until the session recovers or is torn down.
|
|
330
|
+
// • `contended` — another submission (an `--interrupt`/`--escape`, or a delivery to an agent
|
|
331
|
+
// sharing this terminal) held the lock, so nothing was written. `busy` is the honest reason:
|
|
332
|
+
// the line is occupied. Declining rather than queueing is deliberate — see
|
|
333
|
+
// {@link trySubmitToSession}: the drainer walks agents sequentially, so a blocking wait here
|
|
334
|
+
// would stall every OTHER agent's delivery behind this one terminal.
|
|
335
|
+
// • `aborted` — the in-lock precheck refused, with nothing written. A `hold` abort re-holds for
|
|
336
|
+
// the stated reason; `row-resolved` means the row was dismissed/superseded while we waited,
|
|
337
|
+
// which is a TERMINAL state and must not be re-held (same handling as the pre-lock check
|
|
338
|
+
// above, which this one backstops for the duration of the lock wait).
|
|
339
|
+
// • `preempted` — the bytes went out, but an operator submission whose wait ceiling expired
|
|
340
|
+
// wrote unserialized while they did, so the composer may have been cleared or truncated
|
|
341
|
+
// under them. Hold rather than mark delivered. This trades a possible DUPLICATE (if the
|
|
342
|
+
// message did land intact, the gate re-delivers it later) for never reporting a delivery
|
|
343
|
+
// that did not happen — the same call the `dropped` branch already makes, and the failure
|
|
344
|
+
// this whole issue exists to remove. It is the one hole the ceiling opens, and it is
|
|
345
|
+
// detected by counting lock bypasses, not by re-reading the screen.
|
|
346
|
+
if (result.status === 'dropped')
|
|
221
347
|
return hold('no-live-pty');
|
|
348
|
+
if (result.status === 'preempted') {
|
|
349
|
+
ports.log(`[mailbox] write to ${toAgent} @ ${path.basename(workspacePath)} was raced by an unserialized ` +
|
|
350
|
+
`operator write — holding ${row.id.slice(0, 8)}… for redelivery rather than reporting it delivered`);
|
|
351
|
+
return hold('busy');
|
|
352
|
+
}
|
|
353
|
+
if (result.status === 'contended')
|
|
354
|
+
return hold('busy');
|
|
355
|
+
if (result.status === 'aborted') {
|
|
356
|
+
if (result.abort.kind === 'row-resolved') {
|
|
357
|
+
ports.onHeldStateChange(); // the held set changed under us → refresh the indicator
|
|
358
|
+
return { delivered: [], reason: null };
|
|
359
|
+
}
|
|
360
|
+
return hold(result.abort.reason);
|
|
361
|
+
}
|
|
362
|
+
// The write completed — every byte, Enter included, was accepted by the session. That is
|
|
363
|
+
// still only proof the bytes were QUEUED (Issue #1573): `session.write` reports true whenever
|
|
364
|
+
// the socket object is connected, so a composer that ate the leading bytes (#1564) lands here
|
|
365
|
+
// looking identical to a clean delivery. Ask the screen before claiming success.
|
|
366
|
+
//
|
|
367
|
+
// A `false` here is "could not confirm", so the row is HELD, not dropped: the existing
|
|
368
|
+
// redelivery machinery retries it on a later clean gate, and the escalation path already makes
|
|
369
|
+
// a row that never confirms visible. That inverts the failure this issue exists to remove —
|
|
370
|
+
// the worst case becomes a duplicate delivery the agent can see, instead of a silent loss the
|
|
371
|
+
// sender was told was a success.
|
|
372
|
+
if (echo && !(await echo.verify())) {
|
|
373
|
+
ports.log(`[mailbox] write to ${toAgent} @ ${path.basename(workspacePath)} completed but its header ` +
|
|
374
|
+
`never appeared on the terminal — holding ${row.id.slice(0, 8)}… for redelivery rather ` +
|
|
375
|
+
`than reporting it delivered`);
|
|
376
|
+
return hold('busy');
|
|
377
|
+
}
|
|
222
378
|
// markDelivered is guarded (held→delivered only). If it did NOT transition, the row
|
|
223
379
|
// was dismissed/superseded during the paced write — accept that terminal state and
|
|
224
380
|
// do not broadcast a delivery for it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mailbox-delivery.js","sourceRoot":"","sources":["../../../src/agent-farm/servers/mailbox-delivery.ts"],"names":[],"mappings":"AAAA;;;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AAC,GAAG,EAAE,GAAG,CAAC,CAAC;QACnC,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
import { type PtySession } from '../../terminal/pty-session.js';
|
|
15
15
|
import { type GateProfile, type GateVerdict } from './render-gate.js';
|
|
16
|
-
import { MailboxDrainer, type DeliveryPorts, type DeliverySession } from './mailbox-delivery.js';
|
|
16
|
+
import { MailboxDrainer, type EchoWatch, type DeliveryPorts, type DeliverySession } from './mailbox-delivery.js';
|
|
17
17
|
type LogFn = (level: 'INFO' | 'ERROR' | 'WARN', message: string) => void;
|
|
18
18
|
/**
|
|
19
19
|
* The SSE broadcast fn (Tower's `broadcastNotification`), wired once at boot via
|
|
@@ -65,7 +65,7 @@ export declare function resolveAgentForSession(sessionId: string): {
|
|
|
65
65
|
* The classifier profile for a session, resolving the wrapped-launch case. A real
|
|
66
66
|
* builder runs through `.builder-start.sh`, so `session.command` is the shell, not
|
|
67
67
|
* the agent, and the pure {@link resolveProfile} returns `null`. We then read the
|
|
68
|
-
* launch script (exactly as `afx
|
|
68
|
+
* launch script (exactly as `afx refresh` does) to recover the underlying harness
|
|
69
69
|
* command and resolve against that. Still `null` → the delivery holds `no-profile`
|
|
70
70
|
* (fail-safe by construction: an unknown agent is held and surfaced, never guessed
|
|
71
71
|
* — this is what correctly trips on wrapper/boot/relaunch screens too).
|
|
@@ -98,6 +98,28 @@ export declare function resolveProfileForSession(session: DeliverySession): Gate
|
|
|
98
98
|
* delivery path sampled — the property its gate→write TOCTOU relies on.
|
|
99
99
|
*/
|
|
100
100
|
export declare function classifyAgentScreen(session: DeliverySession, profile: GateProfile): Promise<GateVerdict>;
|
|
101
|
+
/**
|
|
102
|
+
* Open an echo watch on a session (Issue #1573) — the live binding for
|
|
103
|
+
* {@link DeliveryPorts.watchEcho}.
|
|
104
|
+
*
|
|
105
|
+
* Samples the terminal BEFORE the write, then `verify()` polls until the needle appears MORE
|
|
106
|
+
* often than it did in that sample. New evidence, not mere presence.
|
|
107
|
+
*
|
|
108
|
+
* A session with no mirror has produced no output and therefore cannot echo anything, so its
|
|
109
|
+
* watch verifies `false` rather than passing.
|
|
110
|
+
*
|
|
111
|
+
* Known residuals, all of which fail in the SAFE direction (a redelivery, never a dropped
|
|
112
|
+
* message), and none of which are designed around here:
|
|
113
|
+
* - a harness on the ALTERNATE screen buffer has no scrollback, so a message longer than one
|
|
114
|
+
* viewport can scroll its header out of reach and never confirm. The agy profile boots into
|
|
115
|
+
* the alternate buffer and was not measurable here (unauthenticated).
|
|
116
|
+
* - a very long write can evict the pre-write copy from the 1000-line mirror, so the count
|
|
117
|
+
* comes back equal rather than greater and a genuine delivery reads as unconfirmed.
|
|
118
|
+
* - an unconfirmed delivery re-reads and re-normalizes the retained buffer once per poll
|
|
119
|
+
* while the `afx send` request waits. Bounded by the timeout, and off the happy path
|
|
120
|
+
* entirely — the measured case confirms on the first read.
|
|
121
|
+
*/
|
|
122
|
+
export declare function watchEchoOnScreen(session: DeliverySession, needle: string): Promise<EchoWatch>;
|
|
101
123
|
/**
|
|
102
124
|
* Build the {@link DeliveryPorts} bound to the live Tower. Cheap (closures over
|
|
103
125
|
* module singletons), so `handleSend` may construct one per request and the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mailbox-wiring.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/servers/mailbox-wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"mailbox-wiring.d.ts","sourceRoot":"","sources":["../../../src/agent-farm/servers/mailbox-wiring.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,OAAO,EAA2B,KAAK,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAKzF,OAAO,EAA+B,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAYnG,OAAO,EACL,cAAc,EAEd,KAAK,SAAS,EAC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