@cluesmith/codev 3.2.4 → 3.3.0
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-BZRTEMtH.css +32 -0
- package/dashboard-dist/assets/{index-BZ1x7x1X.js → index-JCbkpAcV.js} +33 -33
- package/dashboard-dist/assets/index-JCbkpAcV.js.map +1 -0
- package/dashboard-dist/index.html +2 -2
- package/dist/agent-farm/cli.d.ts.map +1 -1
- package/dist/agent-farm/cli.js +142 -0
- package/dist/agent-farm/cli.js.map +1 -1
- package/dist/agent-farm/commands/cleanup.d.ts.map +1 -1
- package/dist/agent-farm/commands/cleanup.js +16 -0
- package/dist/agent-farm/commands/cleanup.js.map +1 -1
- package/dist/agent-farm/commands/inbox.d.ts +42 -0
- package/dist/agent-farm/commands/inbox.d.ts.map +1 -0
- package/dist/agent-farm/commands/inbox.js +129 -0
- package/dist/agent-farm/commands/inbox.js.map +1 -0
- package/dist/agent-farm/commands/interrupt.d.ts +20 -0
- package/dist/agent-farm/commands/interrupt.d.ts.map +1 -0
- package/dist/agent-farm/commands/interrupt.js +65 -0
- package/dist/agent-farm/commands/interrupt.js.map +1 -0
- package/dist/agent-farm/commands/reset/constants.d.ts +52 -0
- package/dist/agent-farm/commands/reset/constants.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset/constants.js +52 -0
- package/dist/agent-farm/commands/reset/constants.js.map +1 -0
- package/dist/agent-farm/commands/reset/context.d.ts +230 -0
- package/dist/agent-farm/commands/reset/context.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset/context.js +428 -0
- package/dist/agent-farm/commands/reset/context.js.map +1 -0
- package/dist/agent-farm/commands/reset/index.d.ts +192 -0
- package/dist/agent-farm/commands/reset/index.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset/index.js +488 -0
- package/dist/agent-farm/commands/reset/index.js.map +1 -0
- package/dist/agent-farm/commands/reset/receipt.d.ts +97 -0
- package/dist/agent-farm/commands/reset/receipt.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset/receipt.js +149 -0
- package/dist/agent-farm/commands/reset/receipt.js.map +1 -0
- package/dist/agent-farm/commands/reset/reorient.d.ts +117 -0
- package/dist/agent-farm/commands/reset/reorient.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset/reorient.js +313 -0
- package/dist/agent-farm/commands/reset/reorient.js.map +1 -0
- package/dist/agent-farm/commands/reset.d.ts +19 -0
- package/dist/agent-farm/commands/reset.d.ts.map +1 -0
- package/dist/agent-farm/commands/reset.js +292 -0
- package/dist/agent-farm/commands/reset.js.map +1 -0
- package/dist/agent-farm/commands/send.d.ts.map +1 -1
- package/dist/agent-farm/commands/send.js +49 -8
- package/dist/agent-farm/commands/send.js.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.d.ts +105 -6
- package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
- package/dist/agent-farm/commands/spawn-worktree.js +289 -66
- package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
- 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/status.d.ts.map +1 -1
- package/dist/agent-farm/commands/status.js +80 -8
- package/dist/agent-farm/commands/status.js.map +1 -1
- package/dist/agent-farm/db/index.d.ts +1 -1
- package/dist/agent-farm/db/index.d.ts.map +1 -1
- package/dist/agent-farm/db/index.js +80 -1
- package/dist/agent-farm/db/index.js.map +1 -1
- package/dist/agent-farm/db/mailbox.d.ts +222 -0
- package/dist/agent-farm/db/mailbox.d.ts.map +1 -0
- package/dist/agent-farm/db/mailbox.js +304 -0
- package/dist/agent-farm/db/mailbox.js.map +1 -0
- package/dist/agent-farm/db/schema.d.ts +1 -1
- package/dist/agent-farm/db/schema.d.ts.map +1 -1
- package/dist/agent-farm/db/schema.js +35 -0
- package/dist/agent-farm/db/schema.js.map +1 -1
- package/dist/agent-farm/db/types.d.ts +45 -0
- package/dist/agent-farm/db/types.d.ts.map +1 -1
- package/dist/agent-farm/db/types.js.map +1 -1
- package/dist/agent-farm/lib/builder-lookup.d.ts +1 -1
- package/dist/agent-farm/lib/builder-lookup.js +2 -2
- package/dist/agent-farm/lib/builder-lookup.js.map +1 -1
- package/dist/agent-farm/lib/reconnect-backoff.d.ts +54 -0
- package/dist/agent-farm/lib/reconnect-backoff.d.ts.map +1 -0
- package/dist/agent-farm/lib/reconnect-backoff.js +47 -0
- package/dist/agent-farm/lib/reconnect-backoff.js.map +1 -0
- package/dist/agent-farm/lib/tower-client.d.ts +16 -6
- package/dist/agent-farm/lib/tower-client.d.ts.map +1 -1
- package/dist/agent-farm/lib/tower-client.js +37 -6
- package/dist/agent-farm/lib/tower-client.js.map +1 -1
- package/dist/agent-farm/lib/tunnel-client.d.ts +69 -1
- package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -1
- package/dist/agent-farm/lib/tunnel-client.js +218 -27
- package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
- package/dist/agent-farm/servers/cron-delivery.d.ts +72 -0
- package/dist/agent-farm/servers/cron-delivery.d.ts.map +1 -0
- package/dist/agent-farm/servers/cron-delivery.js +80 -0
- package/dist/agent-farm/servers/cron-delivery.js.map +1 -0
- package/dist/agent-farm/servers/delayed-send.d.ts +85 -0
- package/dist/agent-farm/servers/delayed-send.d.ts.map +1 -0
- package/dist/agent-farm/servers/delayed-send.js +165 -0
- package/dist/agent-farm/servers/delayed-send.js.map +1 -0
- package/dist/agent-farm/servers/gate-profiles.d.ts +67 -0
- package/dist/agent-farm/servers/gate-profiles.d.ts.map +1 -0
- package/dist/agent-farm/servers/gate-profiles.js +113 -0
- package/dist/agent-farm/servers/gate-profiles.js.map +1 -0
- package/dist/agent-farm/servers/mailbox-delivery.d.ts +370 -0
- package/dist/agent-farm/servers/mailbox-delivery.d.ts.map +1 -0
- package/dist/agent-farm/servers/mailbox-delivery.js +617 -0
- package/dist/agent-farm/servers/mailbox-delivery.js.map +1 -0
- package/dist/agent-farm/servers/mailbox-wiring.d.ts +125 -0
- package/dist/agent-farm/servers/mailbox-wiring.d.ts.map +1 -0
- package/dist/agent-farm/servers/mailbox-wiring.js +425 -0
- package/dist/agent-farm/servers/mailbox-wiring.js.map +1 -0
- package/dist/agent-farm/servers/message-write.d.ts +53 -1
- package/dist/agent-farm/servers/message-write.d.ts.map +1 -1
- package/dist/agent-farm/servers/message-write.js +63 -0
- package/dist/agent-farm/servers/message-write.js.map +1 -1
- package/dist/agent-farm/servers/overview.d.ts.map +1 -1
- package/dist/agent-farm/servers/overview.js +23 -4
- package/dist/agent-farm/servers/overview.js.map +1 -1
- package/dist/agent-farm/servers/render-gate.d.ts +141 -0
- package/dist/agent-farm/servers/render-gate.d.ts.map +1 -0
- package/dist/agent-farm/servers/render-gate.js +251 -0
- package/dist/agent-farm/servers/render-gate.js.map +1 -0
- package/dist/agent-farm/servers/session-submit.d.ts +90 -0
- package/dist/agent-farm/servers/session-submit.d.ts.map +1 -0
- package/dist/agent-farm/servers/session-submit.js +127 -0
- package/dist/agent-farm/servers/session-submit.js.map +1 -0
- package/dist/agent-farm/servers/tower-cron.d.ts +10 -7
- package/dist/agent-farm/servers/tower-cron.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-cron.js +58 -53
- package/dist/agent-farm/servers/tower-cron.js.map +1 -1
- package/dist/agent-farm/servers/tower-instances.d.ts +14 -2
- package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-instances.js +78 -16
- package/dist/agent-farm/servers/tower-instances.js.map +1 -1
- package/dist/agent-farm/servers/tower-messages.d.ts +38 -1
- package/dist/agent-farm/servers/tower-messages.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-messages.js +106 -1
- package/dist/agent-farm/servers/tower-messages.js.map +1 -1
- package/dist/agent-farm/servers/tower-routes.d.ts +16 -4
- package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-routes.js +670 -105
- package/dist/agent-farm/servers/tower-routes.js.map +1 -1
- package/dist/agent-farm/servers/tower-server.js +163 -31
- package/dist/agent-farm/servers/tower-server.js.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.d.ts +17 -2
- package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-terminals.js +104 -122
- 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 +63 -4
- package/dist/agent-farm/servers/tower-tunnel.js.map +1 -1
- package/dist/agent-farm/servers/tower-types.d.ts +2 -1
- package/dist/agent-farm/servers/tower-types.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-utils.d.ts +64 -1
- package/dist/agent-farm/servers/tower-utils.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-utils.js +168 -1
- package/dist/agent-farm/servers/tower-utils.js.map +1 -1
- package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -1
- package/dist/agent-farm/servers/tower-websocket.js +6 -21
- package/dist/agent-farm/servers/tower-websocket.js.map +1 -1
- package/dist/agent-farm/servers/write-queue.d.ts +35 -0
- package/dist/agent-farm/servers/write-queue.d.ts.map +1 -0
- package/dist/agent-farm/servers/write-queue.js +56 -0
- package/dist/agent-farm/servers/write-queue.js.map +1 -0
- package/dist/agent-farm/types.d.ts +39 -0
- package/dist/agent-farm/types.d.ts.map +1 -1
- package/dist/agent-farm/utils/agent-names.d.ts +2 -2
- package/dist/agent-farm/utils/agent-names.d.ts.map +1 -1
- package/dist/agent-farm/utils/agent-names.js +3 -3
- package/dist/agent-farm/utils/agent-names.js.map +1 -1
- package/dist/agent-farm/utils/architect-name.d.ts +2 -2
- package/dist/agent-farm/utils/architect-name.d.ts.map +1 -1
- package/dist/agent-farm/utils/architect-name.js +3 -3
- package/dist/agent-farm/utils/architect-name.js.map +1 -1
- package/dist/agent-farm/utils/config.d.ts +13 -0
- package/dist/agent-farm/utils/config.d.ts.map +1 -1
- package/dist/agent-farm/utils/config.js +33 -1
- package/dist/agent-farm/utils/config.js.map +1 -1
- package/dist/agent-farm/utils/harness.d.ts +103 -7
- package/dist/agent-farm/utils/harness.d.ts.map +1 -1
- package/dist/agent-farm/utils/harness.js +126 -19
- package/dist/agent-farm/utils/harness.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +6 -32
- package/dist/cli.js.map +1 -1
- package/dist/commands/consult/cli-options.d.ts +34 -0
- package/dist/commands/consult/cli-options.d.ts.map +1 -0
- package/dist/commands/consult/cli-options.js +67 -0
- package/dist/commands/consult/cli-options.js.map +1 -0
- package/dist/commands/consult/index.d.ts +56 -2
- package/dist/commands/consult/index.d.ts.map +1 -1
- package/dist/commands/consult/index.js +272 -28
- package/dist/commands/consult/index.js.map +1 -1
- package/dist/commands/consult/metrics.d.ts +42 -0
- package/dist/commands/consult/metrics.d.ts.map +1 -1
- package/dist/commands/consult/metrics.js +129 -9
- package/dist/commands/consult/metrics.js.map +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +71 -19
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/porch/checks.d.ts +23 -0
- package/dist/commands/porch/checks.d.ts.map +1 -1
- package/dist/commands/porch/checks.js +60 -0
- package/dist/commands/porch/checks.js.map +1 -1
- package/dist/commands/porch/config.d.ts +20 -0
- package/dist/commands/porch/config.d.ts.map +1 -1
- package/dist/commands/porch/config.js +20 -0
- package/dist/commands/porch/config.js.map +1 -1
- package/dist/commands/porch/index.js +21 -28
- package/dist/commands/porch/index.js.map +1 -1
- package/dist/commands/porch/next.d.ts.map +1 -1
- package/dist/commands/porch/next.js +2 -41
- package/dist/commands/porch/next.js.map +1 -1
- package/dist/lib/config.d.ts +69 -3
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +67 -3
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/consult-lanes.d.ts +149 -0
- package/dist/lib/consult-lanes.d.ts.map +1 -0
- package/dist/lib/consult-lanes.js +360 -0
- package/dist/lib/consult-lanes.js.map +1 -0
- package/dist/lib/github.js +1 -1
- package/dist/lib/github.js.map +1 -1
- package/dist/lib/prompt-behavior-metrics.d.ts +67 -0
- package/dist/lib/prompt-behavior-metrics.d.ts.map +1 -0
- package/dist/lib/prompt-behavior-metrics.js +290 -0
- package/dist/lib/prompt-behavior-metrics.js.map +1 -0
- package/dist/lib/skeleton.d.ts +22 -1
- package/dist/lib/skeleton.d.ts.map +1 -1
- package/dist/lib/skeleton.js +120 -0
- package/dist/lib/skeleton.js.map +1 -1
- package/dist/lib/test-env.d.ts +74 -0
- package/dist/lib/test-env.d.ts.map +1 -0
- package/dist/lib/test-env.js +92 -0
- package/dist/lib/test-env.js.map +1 -0
- package/dist/terminal/pty-manager.d.ts +2 -0
- package/dist/terminal/pty-manager.d.ts.map +1 -1
- package/dist/terminal/pty-manager.js +16 -6
- package/dist/terminal/pty-manager.js.map +1 -1
- package/dist/terminal/pty-session.d.ts +131 -0
- package/dist/terminal/pty-session.d.ts.map +1 -1
- package/dist/terminal/pty-session.js +232 -39
- package/dist/terminal/pty-session.js.map +1 -1
- package/dist/terminal/ring-buffer.d.ts +39 -6
- package/dist/terminal/ring-buffer.d.ts.map +1 -1
- package/dist/terminal/ring-buffer.js +74 -6
- package/dist/terminal/ring-buffer.js.map +1 -1
- package/dist/terminal/session-manager.d.ts +53 -0
- package/dist/terminal/session-manager.d.ts.map +1 -1
- package/dist/terminal/session-manager.js +94 -9
- package/dist/terminal/session-manager.js.map +1 -1
- package/dist/terminal/session-screen.d.ts +91 -0
- package/dist/terminal/session-screen.d.ts.map +1 -0
- package/dist/terminal/session-screen.js +135 -0
- package/dist/terminal/session-screen.js.map +1 -0
- package/dist/terminal/shellper-main.js +2 -1
- package/dist/terminal/shellper-main.js.map +1 -1
- package/dist/terminal/shellper-process.d.ts +1 -1
- package/dist/terminal/shellper-process.d.ts.map +1 -1
- package/dist/terminal/shellper-process.js +17 -8
- package/dist/terminal/shellper-process.js.map +1 -1
- package/dist/terminal/shellper-replay-buffer.d.ts +69 -7
- package/dist/terminal/shellper-replay-buffer.d.ts.map +1 -1
- package/dist/terminal/shellper-replay-buffer.js +167 -31
- package/dist/terminal/shellper-replay-buffer.js.map +1 -1
- package/package.json +8 -6
- package/skeleton/.claude/skills/afx/SKILL.md +14 -1
- package/skeleton/.claude/skills/arch-init/SKILL.md +22 -9
- package/skeleton/.claude/skills/arch-save/SKILL.md +183 -0
- package/skeleton/.claude/skills/codev/SKILL.md +31 -0
- package/skeleton/.claude/skills/runnable-worktrees/SKILL.md +119 -0
- package/skeleton/.codex/skills/afx/SKILL.md +14 -1
- package/skeleton/.codex/skills/arch-init/SKILL.md +22 -9
- package/skeleton/.codex/skills/arch-save/SKILL.md +183 -0
- package/skeleton/.codex/skills/codev/SKILL.md +31 -0
- package/skeleton/.codex/skills/runnable-worktrees/SKILL.md +119 -0
- package/skeleton/protocols/air/builder-prompt.md +28 -47
- package/skeleton/protocols/air/consult-types/impl-review.md +17 -34
- package/skeleton/protocols/air/consult-types/pr-review.md +14 -37
- package/skeleton/protocols/air/prompts/implement.md +20 -73
- package/skeleton/protocols/air/prompts/pr.md +22 -54
- package/skeleton/protocols/air/protocol.md +40 -71
- package/skeleton/protocols/aspir/builder-prompt.md +29 -66
- package/skeleton/protocols/aspir/consult-types/impl-review.md +17 -44
- package/skeleton/protocols/aspir/consult-types/phase-review.md +17 -44
- package/skeleton/protocols/aspir/consult-types/plan-review.md +14 -38
- package/skeleton/protocols/aspir/consult-types/pr-review.md +13 -39
- package/skeleton/protocols/aspir/consult-types/spec-review.md +13 -33
- package/skeleton/protocols/aspir/prompts/implement.md +27 -196
- package/skeleton/protocols/aspir/prompts/plan.md +21 -85
- package/skeleton/protocols/aspir/prompts/review.md +29 -228
- package/skeleton/protocols/aspir/prompts/specify.md +25 -111
- package/skeleton/protocols/aspir/protocol.json +10 -0
- package/skeleton/protocols/aspir/protocol.md +36 -82
- package/skeleton/protocols/bugfix/builder-prompt.md +23 -45
- package/skeleton/protocols/bugfix/consult-types/impl-review.md +21 -45
- package/skeleton/protocols/bugfix/consult-types/pr-review.md +18 -52
- package/skeleton/protocols/bugfix/prompts/fix.md +16 -61
- package/skeleton/protocols/bugfix/prompts/investigate.md +18 -62
- package/skeleton/protocols/bugfix/prompts/pr.md +22 -57
- package/skeleton/protocols/bugfix/protocol.md +44 -50
- package/skeleton/protocols/experiment/builder-prompt.md +25 -58
- package/skeleton/protocols/experiment/protocol.md +22 -188
- package/skeleton/protocols/experiment/templates/notes.md +11 -71
- package/skeleton/protocols/maintain/builder-prompt.md +24 -45
- package/skeleton/protocols/maintain/consult-types/impl-review.md +17 -44
- package/skeleton/protocols/maintain/consult-types/pr-review.md +13 -39
- package/skeleton/protocols/maintain/prompts/maintain.md +1 -1
- package/skeleton/protocols/maintain/protocol.md +32 -266
- package/skeleton/protocols/maintain/templates/maintenance-run.md +11 -0
- package/skeleton/protocols/pir/builder-prompt.md +30 -64
- package/skeleton/protocols/pir/consult-types/impl-review.md +17 -50
- package/skeleton/protocols/pir/consult-types/pr-review.md +11 -40
- package/skeleton/protocols/pir/prompts/implement.md +1 -2
- package/skeleton/protocols/pir/prompts/plan.md +0 -3
- package/skeleton/protocols/pir/prompts/review.md +1 -1
- package/skeleton/protocols/pir/protocol.md +54 -177
- package/skeleton/protocols/research/builder-prompt.md +27 -58
- package/skeleton/protocols/research/protocol.md +28 -153
- package/skeleton/protocols/spike/builder-prompt.md +30 -48
- package/skeleton/protocols/spike/protocol.md +24 -107
- package/skeleton/protocols/spike/templates/findings.md +9 -39
- package/skeleton/protocols/spir/builder-prompt.md +33 -62
- package/skeleton/protocols/spir/consult-types/impl-review.md +17 -44
- package/skeleton/protocols/spir/consult-types/phase-review.md +17 -44
- package/skeleton/protocols/spir/consult-types/plan-review.md +14 -38
- package/skeleton/protocols/spir/consult-types/pr-review.md +13 -39
- package/skeleton/protocols/spir/consult-types/spec-review.md +13 -33
- package/skeleton/protocols/spir/prompts/implement.md +26 -195
- package/skeleton/protocols/spir/prompts/plan.md +20 -84
- package/skeleton/protocols/spir/prompts/review.md +28 -227
- package/skeleton/protocols/spir/prompts/specify.md +24 -110
- package/skeleton/protocols/spir/protocol.json +10 -0
- package/skeleton/protocols/spir/protocol.md +84 -633
- package/skeleton/protocols/spir/templates/plan.md +28 -147
- package/skeleton/protocols/spir/templates/review.md +21 -80
- package/skeleton/protocols/spir/templates/spec.md +24 -118
- package/skeleton/resources/commands/agent-farm.md +259 -0
- package/skeleton/resources/commands/consult.md +236 -8
- package/skeleton/resources/commands/overview.md +1 -0
- package/skeleton/roles/architect.md +67 -317
- package/skeleton/roles/builder.md +77 -191
- package/skeleton/templates/AGENTS.md +2 -0
- package/skeleton/templates/CLAUDE.md +2 -0
- package/templates/tower.html +39 -2
- package/dashboard-dist/assets/index-BZ1x7x1X.js.map +0 -1
- package/dashboard-dist/assets/index-DB1KBSNE.css +0 -32
- package/dist/agent-farm/servers/send-buffer.d.ts +0 -59
- package/dist/agent-farm/servers/send-buffer.d.ts.map +0 -1
- package/dist/agent-farm/servers/send-buffer.js +0 -116
- package/dist/agent-farm/servers/send-buffer.js.map +0 -1
- package/skeleton/porch/prompts/defend.md +0 -108
- package/skeleton/porch/prompts/diagnose.md +0 -70
- package/skeleton/porch/prompts/evaluate.md +0 -132
- package/skeleton/porch/prompts/fix.md +0 -59
- package/skeleton/porch/prompts/implement.md +0 -88
- package/skeleton/porch/prompts/plan.md +0 -74
- package/skeleton/porch/prompts/pr.md +0 -84
- package/skeleton/porch/prompts/review.md +0 -249
- package/skeleton/porch/prompts/specify.md +0 -53
- package/skeleton/porch/prompts/test.md +0 -63
- package/skeleton/protocols/aspir/templates/plan.md +0 -184
- package/skeleton/protocols/aspir/templates/review.md +0 -120
- package/skeleton/protocols/aspir/templates/spec.md +0 -154
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mailbox delivery orchestration (Spec 1313, Phase 4).
|
|
3
|
+
*
|
|
4
|
+
* The single gate-checked delivery path: **persist → serialize → gate → deliver |
|
|
5
|
+
* hold**. Both the send request (`handleSend`, after it enqueues) and the periodic
|
|
6
|
+
* backstop drainer route every GATED delivery through {@link deliverAgentMail}, so for
|
|
7
|
+
* gate-checked delivery a message body reaches a PTY in exactly one place — and only
|
|
8
|
+
* onto a prompt the render-gate has proven empty. This is what eliminates corruption by
|
|
9
|
+
* construction for that path: a message can never fuse with a draft, because it is never
|
|
10
|
+
* delivered while one exists; and there is no force path.
|
|
11
|
+
*
|
|
12
|
+
* TWO deliberate exceptions write a body OUTSIDE this path, both explicit human
|
|
13
|
+
* gate-bypasses documented at their `tower-routes.ts` call sites: immediate `--interrupt`
|
|
14
|
+
* (Ctrl+C then the message) and `--escape` (a bare ESC). They are the operator's "I am at
|
|
15
|
+
* this terminal now" actions and take the separate per-terminal submission lock
|
|
16
|
+
* (`session-submit.ts`), not the per-agent serializer here — every autonomous/scheduled/
|
|
17
|
+
* held send, by contrast, delivers through this gate.
|
|
18
|
+
*
|
|
19
|
+
* This module replaces the in-memory `SendBuffer` (retired in this phase): held
|
|
20
|
+
* messages now live in the durable `mailbox` table, so nothing is lost to a Tower
|
|
21
|
+
* crash/restart, and shutdown no longer force-flushes onto the line.
|
|
22
|
+
*
|
|
23
|
+
* Everything the delivery logic touches at the edges — resolving the live session
|
|
24
|
+
* for an agent, resolving its classifier profile (incl. the wrapped-launch
|
|
25
|
+
* fallback), running the gate, writing, broadcasting — is injected via
|
|
26
|
+
* {@link DeliveryPorts}, so the orchestration is unit-testable without a live Tower.
|
|
27
|
+
*/
|
|
28
|
+
import type Database from 'better-sqlite3';
|
|
29
|
+
import type { DbMailbox, MailboxReason } from '../db/types.js';
|
|
30
|
+
import type { GateProfile, GateVerdict } from './render-gate.js';
|
|
31
|
+
/**
|
|
32
|
+
* The structural view of a live PTY session the delivery path needs. `PtySession`
|
|
33
|
+
* satisfies this (ringBuffer + info getter + the Spec 1313 identity getters +
|
|
34
|
+
* write); tests pass a fake. Kept minimal and structural so the module never
|
|
35
|
+
* imports the terminal layer.
|
|
36
|
+
*/
|
|
37
|
+
export interface DeliverySession {
|
|
38
|
+
/**
|
|
39
|
+
* The session's MONOTONE cumulative output-byte counter (Spec 1313 render-gate round 2) —
|
|
40
|
+
* the gate's change token. It advances on ANY new output and NEVER decreases, so two samples
|
|
41
|
+
* that match prove the classified screen is byte-for-byte unchanged. This replaces the old
|
|
42
|
+
* `currentSeq:partialBytes` pair, which was non-monotone once #1205 capped the ring's partial:
|
|
43
|
+
* a `trimPartial` makes `partialBytes` FALL, so two distinct screens could produce the same
|
|
44
|
+
* token and alias a stale memoized verdict. The delivery path samples it around the async
|
|
45
|
+
* classify to re-validate the screen hasn't moved (a keystroke landing mid-classify) before
|
|
46
|
+
* writing onto it, and the drainer memoizes the gate verdict on it so a STATIC screen is
|
|
47
|
+
* classified once, not re-checked every backstop tick (see {@link ringToken} and
|
|
48
|
+
* {@link MailboxDrainer}). `PtySession` exposes it (sourced from `RingBuffer.bytesWritten`).
|
|
49
|
+
*/
|
|
50
|
+
readonly bytesWritten: number;
|
|
51
|
+
readonly info: {
|
|
52
|
+
cols: number;
|
|
53
|
+
rows: number;
|
|
54
|
+
};
|
|
55
|
+
readonly command: string;
|
|
56
|
+
readonly launchArgs: string[];
|
|
57
|
+
readonly cwd: string;
|
|
58
|
+
/**
|
|
59
|
+
* Whether input can reach the process right now (Spec 1313 iter-1 review). A
|
|
60
|
+
* shellper-backed session whose socket died still reports status 'running' until
|
|
61
|
+
* teardown, and writes to it are silently dropped (#1198) — `PtySession.writable`
|
|
62
|
+
* checks the live connection, not just status. The delivery path re-checks this at
|
|
63
|
+
* the write instant so a torn-down PTY holds the row (spec: "an errored PTY write
|
|
64
|
+
* leaves the row held") instead of being marked delivered off the paced-write timer.
|
|
65
|
+
*/
|
|
66
|
+
readonly writable: boolean;
|
|
67
|
+
write(data: string): boolean;
|
|
68
|
+
}
|
|
69
|
+
/** Broadcast frame for a delivered message (the dashboard/inbox message event). */
|
|
70
|
+
export interface DeliveredBroadcast {
|
|
71
|
+
type: 'message';
|
|
72
|
+
from: {
|
|
73
|
+
project?: string;
|
|
74
|
+
agent?: string;
|
|
75
|
+
};
|
|
76
|
+
to: {
|
|
77
|
+
project: string;
|
|
78
|
+
agent: string;
|
|
79
|
+
};
|
|
80
|
+
content: string;
|
|
81
|
+
metadata: {
|
|
82
|
+
source: 'mailbox';
|
|
83
|
+
};
|
|
84
|
+
timestamp: number;
|
|
85
|
+
}
|
|
86
|
+
/** Injected edges — everything the orchestration calls into the live system through. */
|
|
87
|
+
export interface DeliveryPorts {
|
|
88
|
+
/** The currently-live session for an agent, or null when no PTY is live (→ held `no-live-pty`). */
|
|
89
|
+
getSessionForAgent(workspacePath: string, toAgent: string): DeliverySession | null;
|
|
90
|
+
/** The classifier profile for a session (incl. wrapped-launch resolution), or null (→ held `no-profile`). */
|
|
91
|
+
resolveProfile(session: DeliverySession): GateProfile | null;
|
|
92
|
+
/**
|
|
93
|
+
* The render-gate: classify the session's CURRENT screen against a profile (Spec 1313
|
|
94
|
+
* render-gate round 2). The live binding reads the session's persistent {@link SessionScreen}
|
|
95
|
+
* mirror and runs the classifier on its bounded viewport — no whole-ring re-render, so the
|
|
96
|
+
* capped ring can no longer hand the gate a torn frame. A session with no mirror yet (no
|
|
97
|
+
* output) classifies not-clean (`no-composer-marker`), exactly as an empty replay always did.
|
|
98
|
+
*/
|
|
99
|
+
classify(session: DeliverySession, profile: GateProfile): Promise<GateVerdict>;
|
|
100
|
+
/**
|
|
101
|
+
* Write a formatted message (text + Enter, unless `noEnter`) to the session and
|
|
102
|
+
* report whether every byte reached the terminal. Resolves `true` when the paced
|
|
103
|
+
* write — including the trailing Enter — has fully completed; `false` when any
|
|
104
|
+
* write was dropped (#1198: a shellper socket that died mid-pace). The delivery
|
|
105
|
+
* `await`s it for two reasons: (1) completion chaining — the per-agent serializer
|
|
106
|
+
* holds the line until the submit is entirely on the wire, so the next delivery
|
|
107
|
+
* never starts mid-write; (2) the boolean gates markDelivered — a dropped write
|
|
108
|
+
* holds the row (`no-live-pty`) instead of falsely reporting delivery (Spec 1313
|
|
109
|
+
* integration review — the silent-loss finding).
|
|
110
|
+
*/
|
|
111
|
+
writeMessage(session: DeliverySession, formattedMessage: string, noEnter: boolean): boolean | Promise<boolean>;
|
|
112
|
+
/** Emit the delivered-message broadcast frame. */
|
|
113
|
+
broadcast(frame: DeliveredBroadcast): void;
|
|
114
|
+
/**
|
|
115
|
+
* Fire the SSE `overview-changed` event so the held-count indicator refetches (Spec
|
|
116
|
+
* 1313, Phase 7). Called whenever the held SET changes via this module — a delivery
|
|
117
|
+
* here removes a held row; the other transitions (hold/supersede/dismiss) fire it
|
|
118
|
+
* from their own call sites. Cheap and idempotent (it only triggers a refetch), so an
|
|
119
|
+
* extra fire is harmless. A no-op in unit fakes.
|
|
120
|
+
*/
|
|
121
|
+
onHeldStateChange(): void;
|
|
122
|
+
/**
|
|
123
|
+
* Fire the SSE `mailbox-escalation` event when a held row crosses the escalation age
|
|
124
|
+
* (Spec 1313, Phase 7). VISIBILITY ONLY — the caller never delivers as a result. A
|
|
125
|
+
* no-op in unit fakes.
|
|
126
|
+
*/
|
|
127
|
+
onEscalation(info: EscalationInfo): void;
|
|
128
|
+
/**
|
|
129
|
+
* Raise the liveness-telemetry diagnostic when an agent's mail has been held
|
|
130
|
+
* `no-profile` for a sustained streak (Spec 1313, Phase 7 — spec line 91). The pure
|
|
131
|
+
* module just reports the streak crossing; the live binding applies the spec's "with
|
|
132
|
+
* recent output" condition (only a session actively producing output is a genuinely
|
|
133
|
+
* broken/unknown classifier worth alarming) and does the loud log + broadcast. A
|
|
134
|
+
* no-op in unit fakes.
|
|
135
|
+
*/
|
|
136
|
+
onLiveness(info: LivenessInfo): void;
|
|
137
|
+
/**
|
|
138
|
+
* Raise a starvation notice to a starving NON-architect agent's OWNER (Spec 1313 round 3,
|
|
139
|
+
* change 3). Fired once per episode when the agent's oldest eligible held row has been stuck
|
|
140
|
+
* past the owner-notice threshold. The live binding resolves the recipient architect
|
|
141
|
+
* (spawning → workspace `main` → first-registered, mirroring `afx send architect`), skips
|
|
142
|
+
* agents that are themselves architects (a notice would land in the same starved mailbox —
|
|
143
|
+
* `afx status` covers that), and enqueues ONE coalesced (supersede-keyed), gate-delivered
|
|
144
|
+
* mailbox row — never a force path. OPTIONAL: unit fakes that don't exercise the notice omit
|
|
145
|
+
* it, so the drainer calls it via `?.`.
|
|
146
|
+
*
|
|
147
|
+
* RETURNS `true` iff a notice was actually enqueued; `false` on a no-op (recipient is itself
|
|
148
|
+
* an architect, or no architect is registered yet). The drainer only records the agent as
|
|
149
|
+
* notified on `true` — a no-op must NOT arm the once-per-episode guard, or the alarm would be
|
|
150
|
+
* suppressed for the whole episode even after an architect later registers (it retries each
|
|
151
|
+
* tick until one enqueues).
|
|
152
|
+
*/
|
|
153
|
+
escalateHeldToOwner?(info: HeldOwnerNoticeInfo): boolean;
|
|
154
|
+
/**
|
|
155
|
+
* Clear (dismiss) any pending owner notice for an agent whose eligible held set has drained
|
|
156
|
+
* (Spec 1313 round 3) — the starvation is over, so the alarm is moot. A no-op on an
|
|
157
|
+
* already-delivered notice. OPTIONAL, like {@link escalateHeldToOwner}.
|
|
158
|
+
*/
|
|
159
|
+
clearHeldOwnerNotice?(workspacePath: string, toAgent: string): void;
|
|
160
|
+
log(message: string): void;
|
|
161
|
+
now(): number;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Metadata for a starving agent whose owner should be alarmed (Spec 1313 round 3, change 3).
|
|
165
|
+
* Carries NO message body (metadata only, per the redaction rule) — the live binding formats a
|
|
166
|
+
* human notice naming the agent, its held count, how long it has been stuck, and the remedy.
|
|
167
|
+
*/
|
|
168
|
+
export interface HeldOwnerNoticeInfo {
|
|
169
|
+
/** The starving agent's workspace (the notice is enqueued within it). */
|
|
170
|
+
workspacePath: string;
|
|
171
|
+
/** The starving NON-architect agent (a builder id). */
|
|
172
|
+
toAgent: string;
|
|
173
|
+
/** Its current why-held reason (busy/no-profile/no-live-pty), if the gate set one. */
|
|
174
|
+
reason: MailboxReason | null;
|
|
175
|
+
/** How long the oldest eligible held row has been stuck, in ms. */
|
|
176
|
+
ageMs: number;
|
|
177
|
+
/** How many eligible held rows are backed up for the agent. */
|
|
178
|
+
heldCount: number;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* A sustained `no-profile` hold streak for an agent — carried to the liveness-telemetry
|
|
182
|
+
* binding (Spec 1313, Phase 7). Metadata only (no body): the diagnostic names the agent
|
|
183
|
+
* and how many consecutive checks failed to classify, so a broken/unknown classifier is
|
|
184
|
+
* discoverable rather than silent.
|
|
185
|
+
*/
|
|
186
|
+
export interface LivenessInfo {
|
|
187
|
+
workspacePath: string;
|
|
188
|
+
toAgent: string;
|
|
189
|
+
/** Consecutive not-clean (`no-profile`) checks at the moment the streak crossed the threshold. */
|
|
190
|
+
streak: number;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Metadata for a held row that has crossed the escalation age. Carries NO message body
|
|
194
|
+
* (ids + metadata only, per the spec's redaction rule) — this rides the SSE bus to the
|
|
195
|
+
* dashboard/VSCode indicator, which is count/attention only.
|
|
196
|
+
*/
|
|
197
|
+
export interface EscalationInfo {
|
|
198
|
+
workspacePath: string;
|
|
199
|
+
toAgent: string;
|
|
200
|
+
mailboxId: string;
|
|
201
|
+
/** How long the row had been held when it escalated, in ms. */
|
|
202
|
+
ageMs: number;
|
|
203
|
+
reason: MailboxReason | null;
|
|
204
|
+
}
|
|
205
|
+
/** Outcome of one delivery pass over an agent's held mail. */
|
|
206
|
+
export interface DeliveryOutcome {
|
|
207
|
+
/** Row ids delivered this pass — 0 or 1 (one message per clean gate; its Enter makes the line busy). */
|
|
208
|
+
delivered: string[];
|
|
209
|
+
/** When nothing was delivered, why the agent's mail stays held; null if delivered or the mailbox was empty. */
|
|
210
|
+
reason: MailboxReason | null;
|
|
211
|
+
/**
|
|
212
|
+
* The gate's internal detail when a `busy` hold came from the render-gate (Spec 1313
|
|
213
|
+
* render-gate hardening) — telemetry only. Distinguishes a legitimately-occupied line
|
|
214
|
+
* (`user-text`, a human present) from a classifier that CANNOT verify the composer
|
|
215
|
+
* (`no-region-end`/`no-composer-marker` = a drifted profile or an unrenderable frame),
|
|
216
|
+
* which {@link MailboxDrainer.recordStreak} escalates to liveness telemetry. Absent
|
|
217
|
+
* for non-gate holds (`no-live-pty`/`no-profile`) and deliveries.
|
|
218
|
+
*/
|
|
219
|
+
detail?: GateVerdict['detail'];
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Composite key identifying an agent within a workspace, used to dedupe the
|
|
223
|
+
* backstop's per-agent work and to key the liveness-telemetry streak map (which
|
|
224
|
+
* Phase 7 consumes). Joined on a NUL — a byte that can appear in neither a
|
|
225
|
+
* filesystem path nor an agent id — so the key is collision-proof (a space
|
|
226
|
+
* separator would be ambiguous for paths/ids that contain spaces). Kept explicit
|
|
227
|
+
* (visible `\0`) and shared so callers never hand-roll the separator.
|
|
228
|
+
*/
|
|
229
|
+
export declare function agentKey(workspacePath: string, toAgent: string): string;
|
|
230
|
+
/**
|
|
231
|
+
* A gate verdict cached against BOTH the live session instance and the {@link ringToken}
|
|
232
|
+
* that produced it (Spec 1313 render-gate verdict memo). Reuse requires the SAME session
|
|
233
|
+
* object AND an unchanged token, so a cached verdict can never be served for a screen that
|
|
234
|
+
* has moved. The `session` guard closes the RESPAWN route: a replacement `PtySession` for the
|
|
235
|
+
* same `agentKey` starts a fresh `bytesWritten` at 0 and could transiently reproduce a low
|
|
236
|
+
* token value — but it is a DIFFERENT object, so `cached.session === session` misses. (The old
|
|
237
|
+
* `RingBuffer.clear()`-during-teardown aliasing route — which left `currentSeq` untouched while
|
|
238
|
+
* wiping content — is now closed by the token itself: `bytesWritten` is monotone and `clear()`
|
|
239
|
+
* does NOT reset it, so a cleared ring's token can only advance, never collide with a prior
|
|
240
|
+
* value; the `!session.writable` filter still keeps a torn-down session out of the memo anyway.)
|
|
241
|
+
* CMAP round 1/2: Gemini/Codex/Claude. Holding the session pins it for at most one tick (the
|
|
242
|
+
* drainer prunes to the held-agent set each tick).
|
|
243
|
+
* Keyed/bounded by {@link MailboxDrainer}; see {@link deliverAgentMail}.
|
|
244
|
+
*/
|
|
245
|
+
interface CachedVerdict {
|
|
246
|
+
session: DeliverySession;
|
|
247
|
+
token: string;
|
|
248
|
+
verdict: GateVerdict;
|
|
249
|
+
}
|
|
250
|
+
/** Reconstruct the delivered-message broadcast frame from a persisted row. */
|
|
251
|
+
export declare function broadcastForRow(row: DbMailbox, now: number): DeliveredBroadcast;
|
|
252
|
+
/**
|
|
253
|
+
* Run one delivery pass for a single agent against the live gate.
|
|
254
|
+
*
|
|
255
|
+
* Delivers the **oldest** held message when — and only when — the composer is a
|
|
256
|
+
* render-verified empty prompt; the rest wait for the next clean gate (the just-
|
|
257
|
+
* delivered message's Enter submits and makes the line busy, so at most one lands
|
|
258
|
+
* per pass — never a blob). When it cannot deliver, it refreshes every held row's
|
|
259
|
+
* `reason` to the current gate verdict so `afx inbox` and the send response stay
|
|
260
|
+
* accurate. Idempotent and race-safe: `markDelivered` only transitions a still-held
|
|
261
|
+
* row, so a backstop tick racing a request-path delivery can never double-send.
|
|
262
|
+
*/
|
|
263
|
+
export declare function deliverAgentMail(ports: DeliveryPorts, db: Database.Database, workspacePath: string, toAgent: string, memo?: Map<string, CachedVerdict>): Promise<DeliveryOutcome>;
|
|
264
|
+
/**
|
|
265
|
+
* {@link deliverAgentMail}, serialized per agent through the shared
|
|
266
|
+
* {@link KeyedSerializer}. This is the entry point every live caller must use;
|
|
267
|
+
* the bare `deliverAgentMail` is exported only so unit tests can drive a single
|
|
268
|
+
* pass deterministically.
|
|
269
|
+
*/
|
|
270
|
+
export declare function deliverAgentMailSerialized(ports: DeliveryPorts, db: Database.Database, workspacePath: string, toAgent: string, memo?: Map<string, CachedVerdict>): Promise<DeliveryOutcome>;
|
|
271
|
+
/**
|
|
272
|
+
* The poll backstop that replaces `SendBuffer`'s flush timer. On each tick it walks
|
|
273
|
+
* every agent with held mail and runs {@link deliverAgentMail}, so a message held
|
|
274
|
+
* on a busy line delivers on the first tick after the line clears (Phase 5 adds the
|
|
275
|
+
* fast submit/quiescence triggers on top). It also prunes terminal rows on boot and
|
|
276
|
+
* per tick, and tracks a per-agent consecutive-not-clean streak for liveness
|
|
277
|
+
* telemetry (Phase 7 surfaces it as a loud log/broadcast). Shutdown just stops the
|
|
278
|
+
* timer — nothing is force-flushed, because every held row is already persisted.
|
|
279
|
+
*/
|
|
280
|
+
export declare class MailboxDrainer {
|
|
281
|
+
private timer;
|
|
282
|
+
private ticking;
|
|
283
|
+
private ports;
|
|
284
|
+
private db;
|
|
285
|
+
private readonly intervalMs;
|
|
286
|
+
private readonly retentionDays;
|
|
287
|
+
private readonly escalationMs;
|
|
288
|
+
private readonly ownerNoticeMs;
|
|
289
|
+
private readonly notCleanStreak;
|
|
290
|
+
private readonly notifiedAgents;
|
|
291
|
+
private readonly scheduledDrains;
|
|
292
|
+
private readonly verdictMemo;
|
|
293
|
+
private generation;
|
|
294
|
+
constructor(opts?: {
|
|
295
|
+
intervalMs?: number;
|
|
296
|
+
pruneRetentionDays?: number;
|
|
297
|
+
escalationMs?: number;
|
|
298
|
+
ownerNoticeMs?: number;
|
|
299
|
+
});
|
|
300
|
+
start(ports: DeliveryPorts, db: Database.Database): void;
|
|
301
|
+
stop(): void;
|
|
302
|
+
/** Per-agent consecutive not-clean count (liveness telemetry; Phase 7 reads this). */
|
|
303
|
+
get streaks(): ReadonlyMap<string, number>;
|
|
304
|
+
/**
|
|
305
|
+
* Agent keys that currently hold a cached gate verdict (render-gate memo).
|
|
306
|
+
* Observability/test only: {@link tick} prunes this to the current held-agent set, so
|
|
307
|
+
* it never grows past the number of agents holding mail.
|
|
308
|
+
*/
|
|
309
|
+
get memoizedAgents(): ReadonlyArray<string>;
|
|
310
|
+
/** One backstop pass. Guarded against re-entry so a slow gate can't overlap ticks. */
|
|
311
|
+
tick(): Promise<void>;
|
|
312
|
+
/**
|
|
313
|
+
* Escalation pass (Spec 1313, Phase 7). Flags every held row that has crossed the
|
|
314
|
+
* escalation age (`escalationMs`, default 60s) as `escalated` and emits the
|
|
315
|
+
* `onEscalation` visibility broadcast + a loud log. **VISIBILITY ONLY — it never
|
|
316
|
+
* delivers.** `findEscalatable` returns only not-yet-escalated held rows and
|
|
317
|
+
* `markEscalated` is idempotent, so each row escalates (and broadcasts) exactly
|
|
318
|
+
* once; the row still delivers only on a later clean gate pass, and the attention
|
|
319
|
+
* state clears when it resolves (the row leaves the held set).
|
|
320
|
+
*/
|
|
321
|
+
private escalateOverdue;
|
|
322
|
+
/** Agents with a pending owner starvation notice this lifetime (test/observability). */
|
|
323
|
+
get notifiedOwnerAgents(): ReadonlyArray<string>;
|
|
324
|
+
/**
|
|
325
|
+
* Owner starvation-notice pass (Spec 1313 round 3, change 3). When an agent's OLDEST eligible
|
|
326
|
+
* held row has been deliverable-but-stuck past the owner-notice threshold, alarm the agent's
|
|
327
|
+
* OWNER exactly once per episode via {@link DeliveryPorts.escalateHeldToOwner} — the live
|
|
328
|
+
* binding resolves the recipient architect (spawning → workspace `main` → first-registered),
|
|
329
|
+
* skips agents that are themselves architects, and enqueues ONE coalesced, gate-delivered
|
|
330
|
+
* notice. When a previously-notified agent's eligible held set drains, the pending notice is
|
|
331
|
+
* cleared via {@link DeliveryPorts.clearHeldOwnerNotice}. VISIBILITY ONLY — never delivers.
|
|
332
|
+
*
|
|
333
|
+
* The two spec guards hold by construction: {@link findStarvingAgents} excludes PRE-DUE
|
|
334
|
+
* delayed rows (a scheduled send is not stuck) and NOTICE rows themselves (a notice can never
|
|
335
|
+
* trigger a notice). The once-per-episode guard is {@link notifiedAgents}, armed ONLY after a
|
|
336
|
+
* notice is actually enqueued (an `escalateHeldToOwner` that no-ops — no architect yet, or the
|
|
337
|
+
* recipient is itself an architect — leaves the guard unset and retries next tick);
|
|
338
|
+
* `escalateHeldToOwner` additionally coalesces via a supersede key, so even a post-restart
|
|
339
|
+
* re-notify stays a single pending row.
|
|
340
|
+
*/
|
|
341
|
+
private noticeOverdue;
|
|
342
|
+
/**
|
|
343
|
+
* Update the per-agent liveness streak from a delivery outcome (Phase 7 surfaces
|
|
344
|
+
* it): a delivered or empty pass clears the streak; a held pass grows it. Shared by
|
|
345
|
+
* the backstop {@link tick} and the fast {@link scheduleDrain} trigger so both feed
|
|
346
|
+
* the same telemetry.
|
|
347
|
+
*/
|
|
348
|
+
private recordStreak;
|
|
349
|
+
/**
|
|
350
|
+
* Fast, event-driven delivery trigger (Spec 1313, Phase 5). A submit (Enter) or
|
|
351
|
+
* output-quiescence signal for a session schedules a single coalesced delivery pass
|
|
352
|
+
* for that agent, so a held message delivers within a microtask of the line
|
|
353
|
+
* clearing instead of waiting up to one backstop interval.
|
|
354
|
+
*
|
|
355
|
+
* Triggers are schedulers, never authority (spec Constraint): this runs the SAME
|
|
356
|
+
* gated {@link deliverAgentMailSerialized} the backstop does, so a spurious trigger
|
|
357
|
+
* on a still-busy screen simply re-holds, and a missed trigger only defers delivery
|
|
358
|
+
* to the next backstop tick — a trigger can never corrupt anything.
|
|
359
|
+
*
|
|
360
|
+
* Coalescing: while a pass is already queued for an agent, further triggers return
|
|
361
|
+
* the same in-flight promise (the gate runs once, not once per trigger). The slot is
|
|
362
|
+
* released just before the pass runs, so a trigger arriving *during* a pass queues
|
|
363
|
+
* exactly one follow-up; the per-agent {@link KeyedSerializer} keeps passes from
|
|
364
|
+
* overlapping. No-op (resolved) until the drainer is started, and never rejects — a
|
|
365
|
+
* gate/write error is logged and left for the backstop, mirroring the tick.
|
|
366
|
+
*/
|
|
367
|
+
scheduleDrain(workspacePath: string, toAgent: string): Promise<void>;
|
|
368
|
+
}
|
|
369
|
+
export {};
|
|
370
|
+
//# sourceMappingURL=mailbox-delivery.d.ts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