@cluesmith/codev 3.3.3 → 3.3.4

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 (176) hide show
  1. package/dashboard-dist/assets/{index-CUIjS_Vb.js → index-DZf6pNPE.js} +2 -2
  2. package/dashboard-dist/assets/{index-CUIjS_Vb.js.map → index-DZf6pNPE.js.map} +1 -1
  3. package/dashboard-dist/index.html +1 -1
  4. package/dist/agent-farm/cli.d.ts.map +1 -1
  5. package/dist/agent-farm/cli.js +48 -0
  6. package/dist/agent-farm/cli.js.map +1 -1
  7. package/dist/agent-farm/commands/ide.d.ts +20 -0
  8. package/dist/agent-farm/commands/ide.d.ts.map +1 -0
  9. package/dist/agent-farm/commands/ide.js +138 -0
  10. package/dist/agent-farm/commands/ide.js.map +1 -0
  11. package/dist/agent-farm/commands/inbox.d.ts.map +1 -1
  12. package/dist/agent-farm/commands/inbox.js +15 -3
  13. package/dist/agent-farm/commands/inbox.js.map +1 -1
  14. package/dist/agent-farm/commands/send.d.ts.map +1 -1
  15. package/dist/agent-farm/commands/send.js +16 -1
  16. package/dist/agent-farm/commands/send.js.map +1 -1
  17. package/dist/agent-farm/commands/spawn-worktree.d.ts.map +1 -1
  18. package/dist/agent-farm/commands/spawn-worktree.js +16 -7
  19. package/dist/agent-farm/commands/spawn-worktree.js.map +1 -1
  20. package/dist/agent-farm/commands/tower.d.ts +21 -9
  21. package/dist/agent-farm/commands/tower.d.ts.map +1 -1
  22. package/dist/agent-farm/commands/tower.js +90 -30
  23. package/dist/agent-farm/commands/tower.js.map +1 -1
  24. package/dist/agent-farm/db/tower-owner.d.ts +168 -0
  25. package/dist/agent-farm/db/tower-owner.d.ts.map +1 -0
  26. package/dist/agent-farm/db/tower-owner.js +369 -0
  27. package/dist/agent-farm/db/tower-owner.js.map +1 -0
  28. package/dist/agent-farm/db/types.d.ts +30 -5
  29. package/dist/agent-farm/db/types.d.ts.map +1 -1
  30. package/dist/agent-farm/db/types.js.map +1 -1
  31. package/dist/agent-farm/lib/ide-record.d.ts +65 -0
  32. package/dist/agent-farm/lib/ide-record.d.ts.map +1 -0
  33. package/dist/agent-farm/lib/ide-record.js +118 -0
  34. package/dist/agent-farm/lib/ide-record.js.map +1 -0
  35. package/dist/agent-farm/lib/tunnel-client.d.ts +22 -0
  36. package/dist/agent-farm/lib/tunnel-client.d.ts.map +1 -1
  37. package/dist/agent-farm/lib/tunnel-client.js +53 -5
  38. package/dist/agent-farm/lib/tunnel-client.js.map +1 -1
  39. package/dist/agent-farm/servers/gate-profiles.d.ts +23 -2
  40. package/dist/agent-farm/servers/gate-profiles.d.ts.map +1 -1
  41. package/dist/agent-farm/servers/gate-profiles.js +43 -2
  42. package/dist/agent-farm/servers/gate-profiles.js.map +1 -1
  43. package/dist/agent-farm/servers/ide-forward.d.ts +62 -0
  44. package/dist/agent-farm/servers/ide-forward.d.ts.map +1 -0
  45. package/dist/agent-farm/servers/ide-forward.js +274 -0
  46. package/dist/agent-farm/servers/ide-forward.js.map +1 -0
  47. package/dist/agent-farm/servers/ide-server.d.ts +68 -0
  48. package/dist/agent-farm/servers/ide-server.d.ts.map +1 -0
  49. package/dist/agent-farm/servers/ide-server.js +281 -0
  50. package/dist/agent-farm/servers/ide-server.js.map +1 -0
  51. package/dist/agent-farm/servers/mailbox-delivery.d.ts +213 -4
  52. package/dist/agent-farm/servers/mailbox-delivery.d.ts.map +1 -1
  53. package/dist/agent-farm/servers/mailbox-delivery.js +489 -68
  54. package/dist/agent-farm/servers/mailbox-delivery.js.map +1 -1
  55. package/dist/agent-farm/servers/mailbox-wiring.d.ts +18 -4
  56. package/dist/agent-farm/servers/mailbox-wiring.d.ts.map +1 -1
  57. package/dist/agent-farm/servers/mailbox-wiring.js +94 -21
  58. package/dist/agent-farm/servers/mailbox-wiring.js.map +1 -1
  59. package/dist/agent-farm/servers/message-write.d.ts +138 -11
  60. package/dist/agent-farm/servers/message-write.d.ts.map +1 -1
  61. package/dist/agent-farm/servers/message-write.js +144 -35
  62. package/dist/agent-farm/servers/message-write.js.map +1 -1
  63. package/dist/agent-farm/servers/overview.d.ts +28 -12
  64. package/dist/agent-farm/servers/overview.d.ts.map +1 -1
  65. package/dist/agent-farm/servers/overview.js +130 -79
  66. package/dist/agent-farm/servers/overview.js.map +1 -1
  67. package/dist/agent-farm/servers/render-gate.d.ts +53 -0
  68. package/dist/agent-farm/servers/render-gate.d.ts.map +1 -1
  69. package/dist/agent-farm/servers/render-gate.js +135 -24
  70. package/dist/agent-farm/servers/render-gate.js.map +1 -1
  71. package/dist/agent-farm/servers/session-submit.d.ts +7 -4
  72. package/dist/agent-farm/servers/session-submit.d.ts.map +1 -1
  73. package/dist/agent-farm/servers/session-submit.js +7 -4
  74. package/dist/agent-farm/servers/session-submit.js.map +1 -1
  75. package/dist/agent-farm/servers/tower-cron.d.ts.map +1 -1
  76. package/dist/agent-farm/servers/tower-cron.js +4 -1
  77. package/dist/agent-farm/servers/tower-cron.js.map +1 -1
  78. package/dist/agent-farm/servers/tower-instances.d.ts.map +1 -1
  79. package/dist/agent-farm/servers/tower-instances.js +6 -7
  80. package/dist/agent-farm/servers/tower-instances.js.map +1 -1
  81. package/dist/agent-farm/servers/tower-routes.d.ts.map +1 -1
  82. package/dist/agent-farm/servers/tower-routes.js +53 -13
  83. package/dist/agent-farm/servers/tower-routes.js.map +1 -1
  84. package/dist/agent-farm/servers/tower-server.js +64 -7
  85. package/dist/agent-farm/servers/tower-server.js.map +1 -1
  86. package/dist/agent-farm/servers/tower-terminals.d.ts.map +1 -1
  87. package/dist/agent-farm/servers/tower-terminals.js +53 -8
  88. package/dist/agent-farm/servers/tower-terminals.js.map +1 -1
  89. package/dist/agent-farm/servers/tower-websocket.d.ts.map +1 -1
  90. package/dist/agent-farm/servers/tower-websocket.js +18 -1
  91. package/dist/agent-farm/servers/tower-websocket.js.map +1 -1
  92. package/dist/agent-farm/utils/message-format.d.ts.map +1 -1
  93. package/dist/agent-farm/utils/message-format.js +5 -6
  94. package/dist/agent-farm/utils/message-format.js.map +1 -1
  95. package/dist/agent-farm/utils/port.d.ts +22 -0
  96. package/dist/agent-farm/utils/port.d.ts.map +1 -0
  97. package/dist/agent-farm/utils/port.js +35 -0
  98. package/dist/agent-farm/utils/port.js.map +1 -0
  99. package/dist/agent-farm/utils/server-utils.d.ts +26 -0
  100. package/dist/agent-farm/utils/server-utils.d.ts.map +1 -1
  101. package/dist/agent-farm/utils/server-utils.js +36 -0
  102. package/dist/agent-farm/utils/server-utils.js.map +1 -1
  103. package/dist/cli.js +2 -2
  104. package/dist/cli.js.map +1 -1
  105. package/dist/commands/consult/index.d.ts.map +1 -1
  106. package/dist/commands/consult/index.js +61 -1
  107. package/dist/commands/consult/index.js.map +1 -1
  108. package/dist/commands/consult/tree-tripwire.d.ts +177 -0
  109. package/dist/commands/consult/tree-tripwire.d.ts.map +1 -0
  110. package/dist/commands/consult/tree-tripwire.js +356 -0
  111. package/dist/commands/consult/tree-tripwire.js.map +1 -0
  112. package/dist/commands/doctor.d.ts +69 -0
  113. package/dist/commands/doctor.d.ts.map +1 -1
  114. package/dist/commands/doctor.js +163 -0
  115. package/dist/commands/doctor.js.map +1 -1
  116. package/dist/commands/generate-image.d.ts +5 -0
  117. package/dist/commands/generate-image.d.ts.map +1 -1
  118. package/dist/commands/generate-image.js +225 -4
  119. package/dist/commands/generate-image.js.map +1 -1
  120. package/dist/lib/agent-env.d.ts +86 -0
  121. package/dist/lib/agent-env.d.ts.map +1 -0
  122. package/dist/lib/agent-env.js +126 -0
  123. package/dist/lib/agent-env.js.map +1 -0
  124. package/dist/lib/forge-contracts.d.ts +10 -0
  125. package/dist/lib/forge-contracts.d.ts.map +1 -1
  126. package/dist/lib/forge-contracts.js.map +1 -1
  127. package/dist/lib/forge-rate-limit.d.ts +45 -0
  128. package/dist/lib/forge-rate-limit.d.ts.map +1 -0
  129. package/dist/lib/forge-rate-limit.js +89 -0
  130. package/dist/lib/forge-rate-limit.js.map +1 -0
  131. package/dist/lib/forge.d.ts +28 -0
  132. package/dist/lib/forge.d.ts.map +1 -1
  133. package/dist/lib/forge.js +63 -10
  134. package/dist/lib/forge.js.map +1 -1
  135. package/dist/lib/github.d.ts +13 -1
  136. package/dist/lib/github.d.ts.map +1 -1
  137. package/dist/lib/github.js +58 -15
  138. package/dist/lib/github.js.map +1 -1
  139. package/dist/lib/test-env.d.ts +17 -0
  140. package/dist/lib/test-env.d.ts.map +1 -1
  141. package/dist/lib/test-env.js +20 -0
  142. package/dist/lib/test-env.js.map +1 -1
  143. package/dist/terminal/pty-session.d.ts +122 -4
  144. package/dist/terminal/pty-session.d.ts.map +1 -1
  145. package/dist/terminal/pty-session.js +142 -7
  146. package/dist/terminal/pty-session.js.map +1 -1
  147. package/dist/terminal/session-manager.d.ts +23 -2
  148. package/dist/terminal/session-manager.d.ts.map +1 -1
  149. package/dist/terminal/session-manager.js +115 -36
  150. package/dist/terminal/session-manager.js.map +1 -1
  151. package/dist/terminal/session-screen.d.ts +34 -5
  152. package/dist/terminal/session-screen.d.ts.map +1 -1
  153. package/dist/terminal/session-screen.js +52 -6
  154. package/dist/terminal/session-screen.js.map +1 -1
  155. package/dist/terminal/terminal-replies.d.ts +102 -0
  156. package/dist/terminal/terminal-replies.d.ts.map +1 -0
  157. package/dist/terminal/terminal-replies.js +181 -0
  158. package/dist/terminal/terminal-replies.js.map +1 -0
  159. package/package.json +4 -4
  160. package/scripts/forge/github/pr-list.sh +6 -2
  161. package/scripts/forge/github/pr-search.sh +4 -2
  162. package/scripts/forge/gitlab/issue-search.sh +1 -0
  163. package/scripts/forge/gitlab/pr-search.sh +35 -2
  164. package/scripts/forge/linear/auth-status.sh +1 -0
  165. package/scripts/forge/linear/issue-comment.sh +1 -0
  166. package/scripts/forge/linear/issue-list.sh +1 -0
  167. package/scripts/forge/linear/issue-search.sh +1 -0
  168. package/scripts/forge/linear/issue-view.sh +1 -0
  169. package/scripts/forge/linear/recently-closed.sh +1 -0
  170. package/scripts/forge/linear/user-identity.sh +1 -0
  171. package/skeleton/.claude/skills/generate-image/SKILL.md +19 -2
  172. package/skeleton/.codex/skills/generate-image/SKILL.md +19 -2
  173. package/skeleton/resources/commands/agent-farm.md +27 -2
  174. package/skeleton/roles/consultant.md +32 -0
  175. package/skeleton/templates/AGENTS.md +1 -1
  176. package/skeleton/templates/CLAUDE.md +1 -1
@@ -8,8 +8,9 @@
8
8
  *
9
9
  * @see codev/specs/589-non-github-repository-support.md
10
10
  */
11
+ import { execFile } from 'node:child_process';
11
12
  import { UNCATEGORIZED_AREA } from '@cluesmith/codev-sdk/constants';
12
- import { executeForgeCommand } from './forge.js';
13
+ import { executeForgeCommand, executeForgeCommandDetailed, resolveForgeBackend } from './forge.js';
13
14
  import { getRepoInfo } from './team-github.js';
14
15
  // =============================================================================
15
16
  // Core forge API functions (non-fatal, via concept commands)
@@ -141,19 +142,25 @@ export async function fetchRecentlyClosed(cwd, forgeConfig) {
141
142
  // entire sinceDate day, collapsing the 24h window to "since UTC midnight"
142
143
  // (≈0h just after 00:00Z) and silently hiding genuinely-recent closures.
143
144
  // Seconds precision (no millis) matches GitHub's documented format.
144
- const since = new Date(Date.now() - 24 * 60 * 60 * 1000)
145
- .toISOString().replace(/\.\d{3}Z$/, 'Z');
146
145
  const result = await executeForgeCommand('recently-closed', {
147
- CODEV_SINCE_DATE: since,
146
+ CODEV_SINCE_DATE: sinceTimestamp24h(),
148
147
  }, {
149
148
  cwd,
150
149
  forgeConfig,
151
150
  });
151
+ return withinLast24h(result, 'closedAt');
152
+ }
153
+ const DAY_MS = 24 * 60 * 60 * 1000;
154
+ /** ISO-8601 at seconds precision, 24 h ago (GitHub's documented datetime format). */
155
+ function sinceTimestamp24h() {
156
+ return new Date(Date.now() - DAY_MS).toISOString().replace(/\.\d{3}Z$/, 'Z');
157
+ }
158
+ /** Filter concept output to the last 24 hours (a concept command may return more). */
159
+ function withinLast24h(result, field) {
152
160
  if (!result || !Array.isArray(result))
153
161
  return result;
154
- // Filter to last 24 hours (concept command may return more)
155
- const cutoff = Date.now() - 24 * 60 * 60 * 1000;
156
- return result.filter(i => i.closedAt && new Date(i.closedAt).getTime() >= cutoff);
162
+ const cutoff = Date.now() - DAY_MS;
163
+ return result.filter(item => item[field] && new Date(item[field]).getTime() >= cutoff);
157
164
  }
158
165
  /**
159
166
  * Fetch recently merged PRs (last 24 hours).
@@ -164,19 +171,55 @@ export async function fetchRecentMergedPRs(cwd, forgeConfig) {
164
171
  // Full ISO-8601 timestamp (seconds precision), not a bare date — same
165
172
  // GitHub bare-date `>` day-exclusion bug as fetchRecentlyClosed.
166
173
  // `merged:>$CODEV_SINCE_DATE` against a precise timestamp is exact.
167
- const since = new Date(Date.now() - 24 * 60 * 60 * 1000)
168
- .toISOString().replace(/\.\d{3}Z$/, 'Z');
169
174
  const result = await executeForgeCommand('recently-merged', {
170
- CODEV_SINCE_DATE: since,
175
+ CODEV_SINCE_DATE: sinceTimestamp24h(),
171
176
  }, {
172
177
  cwd,
173
178
  forgeConfig,
174
179
  });
175
- if (!result || !Array.isArray(result))
176
- return result;
177
- // Filter to last 24 hours (concept command may return more)
178
- const cutoff = Date.now() - 24 * 60 * 60 * 1000;
179
- return result.filter(pr => pr.mergedAt && new Date(pr.mergedAt).getTime() >= cutoff);
180
+ return withinLast24h(result, 'mergedAt');
181
+ }
182
+ /** Resolved backend key for an overview concept in `cwd` (see `resolveForgeBackend`). */
183
+ export function overviewBackend(concept, cwd) {
184
+ return resolveForgeBackend(concept, { cwd });
185
+ }
186
+ /** Run one overview concept, post-processed exactly like its `fetch*` counterpart. */
187
+ export async function fetchForOverview(concept, cwd) {
188
+ switch (concept) {
189
+ case 'user-identity': {
190
+ const r = await executeForgeCommandDetailed(concept, {}, { cwd, raw: true });
191
+ return { ...r, data: typeof r.data === 'string' && r.data.trim() ? r.data.trim() : null };
192
+ }
193
+ case 'recently-closed':
194
+ case 'recently-merged': {
195
+ const r = await executeForgeCommandDetailed(concept, { CODEV_SINCE_DATE: sinceTimestamp24h() }, { cwd });
196
+ return { ...r, data: withinLast24h(r.data, concept === 'recently-closed' ? 'closedAt' : 'mergedAt') };
197
+ }
198
+ default:
199
+ return executeForgeCommandDetailed(concept, {}, { cwd });
200
+ }
201
+ }
202
+ /**
203
+ * Ask gh for the GraphQL bucket's reset instant. `gh api rate_limit` is free
204
+ * (it spends no quota) but is known to misreport a healthy bucket, so callers
205
+ * only trust it when it agrees the budget is gone (`remaining === 0`).
206
+ */
207
+ export function probeGhGraphqlRateLimit(_backend, cwd) {
208
+ return new Promise(resolvePromise => {
209
+ execFile('gh', ['api', 'rate_limit', '--jq', '.resources.graphql'], { cwd, timeout: 15_000 }, (err, stdout) => {
210
+ if (err)
211
+ return resolvePromise(null);
212
+ try {
213
+ const parsed = JSON.parse(stdout);
214
+ if (typeof parsed.remaining !== 'number' || typeof parsed.reset !== 'number')
215
+ return resolvePromise(null);
216
+ resolvePromise({ remaining: parsed.remaining, resetAt: parsed.reset * 1000 });
217
+ }
218
+ catch {
219
+ resolvePromise(null);
220
+ }
221
+ });
222
+ });
180
223
  }
181
224
  /**
182
225
  * Fetch merged PRs, optionally filtered to those merged since a given date.
@@ -1 +1 @@
1
- {"version":3,"file":"github.js","sourceRoot":"","sources":["../../src/lib/github.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAoB,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAuB/C,gFAAgF;AAChF,6DAA6D;AAC7D,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,OAAwB,EACxB,OAA4D;IAE5D,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,YAAY,EAAE;QACrD,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC;KAChC,EAAE;QACD,GAAG,EAAE,OAAO,EAAE,GA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,CAAC;AACxC,CAAC"}
@@ -71,6 +71,23 @@ export declare function realAgyOptIn(): boolean;
71
71
  * `agy-integration.e2e.test.ts` short-circuits on the opt-in before resolving.
72
72
  */
73
73
  export declare function assertAgyLaneAllowedUnderTest(): void;
74
+ /**
75
+ * Explicit opt-in for a test that drives the REAL Claude Agent SDK (#1649).
76
+ *
77
+ * The #1649 acceptance check is behavioural: put a review prompt in front of the
78
+ * claude lane that tempts it to edit the code under review, and assert the tree
79
+ * comes back unchanged. Only a real model can answer that — a mock would be
80
+ * asserting my own stub's manners.
81
+ *
82
+ * It is opt-in for two reasons. It costs real tokens on the developer's
83
+ * subscription, and its outcome is probabilistic in a way the rest of the suite
84
+ * is not: the lane *may* write, which is the whole point of measuring it. A
85
+ * probabilistic check cannot gate CI without eventually being ignored, so it
86
+ * runs on request and its evidence goes in the review:
87
+ *
88
+ * CODEV_ALLOW_REAL_CLAUDE_SDK=1 pnpm --filter @cluesmith/codev test:e2e:cli
89
+ */
90
+ export declare function realClaudeSdkOptIn(): boolean;
74
91
  /**
75
92
  * True when cloud-mutating side effects must be refused because we are running
76
93
  * under a test (#1515).
@@ -1 +1 @@
1
- {"version":3,"file":"test-env.d.ts","sourceRoot":"","sources":["../../src/lib/test-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAGtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAYpD;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAG5C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAKD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,MAAM,EACZ,uBAAuB,EAAE,OAAO,GAC/B,IAAI,CAgBN"}
1
+ {"version":3,"file":"test-env.d.ts","sourceRoot":"","sources":["../../src/lib/test-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAGtC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,6BAA6B,IAAI,IAAI,CAYpD;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAG5C;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAG5C;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C;AAKD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oCAAoC,CAClD,IAAI,EAAE,MAAM,EACZ,uBAAuB,EAAE,OAAO,GAC/B,IAAI,CAgBN"}
@@ -89,6 +89,26 @@ export function assertAgyLaneAllowedUnderTest() {
89
89
  '(the vitest harness in vitest-setup.ts does this for every suite), or set ' +
90
90
  'CODEV_ALLOW_REAL_AGY=1 if this test genuinely means to run the real CLI.');
91
91
  }
92
+ /**
93
+ * Explicit opt-in for a test that drives the REAL Claude Agent SDK (#1649).
94
+ *
95
+ * The #1649 acceptance check is behavioural: put a review prompt in front of the
96
+ * claude lane that tempts it to edit the code under review, and assert the tree
97
+ * comes back unchanged. Only a real model can answer that — a mock would be
98
+ * asserting my own stub's manners.
99
+ *
100
+ * It is opt-in for two reasons. It costs real tokens on the developer's
101
+ * subscription, and its outcome is probabilistic in a way the rest of the suite
102
+ * is not: the lane *may* write, which is the whole point of measuring it. A
103
+ * probabilistic check cannot gate CI without eventually being ignored, so it
104
+ * runs on request and its evidence goes in the review:
105
+ *
106
+ * CODEV_ALLOW_REAL_CLAUDE_SDK=1 pnpm --filter @cluesmith/codev test:e2e:cli
107
+ */
108
+ export function realClaudeSdkOptIn() {
109
+ const raw = process.env.CODEV_ALLOW_REAL_CLAUDE_SDK;
110
+ return raw === '1' || raw === 'true';
111
+ }
92
112
  /**
93
113
  * True when cloud-mutating side effects must be refused because we are running
94
114
  * under a test (#1515).
@@ -1 +1 @@
1
- {"version":3,"file":"test-env.js","sourceRoot":"","sources":["../../src/lib/test-env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,iBAAiB;IAC/B,OAAO,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AACzE,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY;IAC1B,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC;IAC7C,OAAO,GAAG,KAAK,GAAG,IAAI,GAAG,KAAK,MAAM,CAAC;AACvC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,UAAU,6BAA6B;IAC3C,IAAI,CAAC,iBAAiB,EAAE;QAAE,OAAO;IACjC,IAAI,YAAY,EAAE;QAAE,OAAO;IAC3B,IAAI,OAAO,CAAC,GAAG,CAAC,aAAa;QAAE,OAAO;IACtC,MAAM,IAAI,KAAK,CACb,0EAA0E;QAC1E,sEAAsE;QACtE,yEAAyE;QACzE,wEAAwE;QACxE,4EAA4E;QAC5E,0EAA0E,CAC3E,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,WAAW;IACzB,OAAO,iBAAiB,EAAE,IAAI,O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C,CAClD,IAAY,EACZ,uBAAgC;IAEhC,IAAI,CAAC,uBAAuB;QAAE,OAAO;IACrC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO;IAC7C,IAAI,CAAC,oBAAoB,EAAE;QAAE,OAAO;IAEpC,MAAM,OAAO,GACX,oBAAoB,IAAI,+CAA+C;QACvE,4EAA4E;QAC5E,yEAAyE;QACzE,6EAA6E;QAC7E,8EAA8E;QAC9E,6CAA6C,CAAC;IAChD,8EAA8E;IAC9E,0CAA0C;IAC1C,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC"}
@@ -31,6 +31,26 @@ export declare const terminalDeliverySignals: EventEmitter<[never]>;
31
31
  * fire is harmless — the gate still decides — so this favours fewer wasted checks).
32
32
  */
33
33
  export declare const QUIESCENCE_DEBOUNCE_MS = 500;
34
+ /**
35
+ * Who is putting bytes on this session's line (Issue #1473) — the only thing that decides
36
+ * whether a write moves the delivery gate's INPUT signal.
37
+ *
38
+ * The default is `'external'` on purpose: the failure this closes is a new input path that
39
+ * forgets to announce itself, and an opt-OUT makes that impossible — a forgotten origin
40
+ * over-counts (a spurious hold, self-correcting) instead of under-counting (a delivery
41
+ * written onto a draft, the corruption). Exactly one caller opts out, and it hard-codes the
42
+ * value rather than forwarding a parameter: a 1-arg function is assignable to a 2-arg
43
+ * function type, so a wrapper that dropped the argument would compile cleanly and present as
44
+ * "mail never delivers".
45
+ */
46
+ export type WriteOrigin =
47
+ /** An unknown or foreign writer — a live client's keystrokes, the raw write route, an
48
+ * operator `^C`/ESC. Counts as input. */
49
+ 'external'
50
+ /** The gated mailbox delivery's own paced write. Must never trip the input signal: its
51
+ * bytes are the thing the gate just authorised, and counting them would make every
52
+ * delivery block the next one. */
53
+ | 'delivery';
34
54
  export interface PtySessionConfig {
35
55
  id: string;
36
56
  command: string;
@@ -45,6 +65,18 @@ export interface PtySessionConfig {
45
65
  diskLogEnabled?: boolean;
46
66
  diskLogMaxBytes?: number;
47
67
  reconnectTimeoutMs?: number;
68
+ /**
69
+ * Injectable clock for the input-signal timestamps (Issue #1473). Defaults to `Date.now`.
70
+ *
71
+ * It exists because the delivery gate reads `lastInputAt` through its own `ports.now()`,
72
+ * which tests replace with a fake clock, while `recordUserInput` was hard-wired to
73
+ * `Date.now()`. Any test pairing a fake gate clock with a REAL `PtySession` therefore
74
+ * compares two unrelated time bases, and no amount of adding fields fixes it — the two
75
+ * clocks have to be the same one. `lastDataAt` never needed this seam because
76
+ * {@link attachShellper} hydrates it from the shellper's tracker; the input timestamps have
77
+ * no such hydration path, so this is theirs.
78
+ */
79
+ clock?: () => number;
48
80
  }
49
81
  export interface PtySessionInfo {
50
82
  id: string;
@@ -139,8 +171,10 @@ export declare class PtySession extends EventEmitter {
139
171
  private _quiescenceTimer;
140
172
  private clients;
141
173
  private _lastInputAt;
174
+ private _inputSeq;
142
175
  private _lastDataAt;
143
176
  private _composing;
177
+ private readonly clock;
144
178
  constructor(config: PtySessionConfig);
145
179
  /** Spawn the PTY process. Must be called after construction. */
146
180
  spawn(): Promise<void>;
@@ -236,8 +270,29 @@ export declare class PtySession extends EventEmitter {
236
270
  /**
237
271
  * Write user input to the PTY or shellper.
238
272
  * Returns false when the input was dropped (#1198).
273
+ *
274
+ * THE GATE'S INPUT OBSERVATION POINT (Issue #1473). This is the single funnel every write
275
+ * to a session passes through, so it is where the delivery gate learns that somebody put
276
+ * something on the line. Until now it recorded nothing: `bytesWritten` counts OUTPUT and
277
+ * `lastDataAt` tracks OUTPUT, so a keystroke was invisible to the gate until the TUI
278
+ * happened to echo it — which is the whole of the echo-lag hole.
279
+ *
280
+ * Two things are deliberate here:
281
+ *
282
+ * - **The filter, not just the counter.** xterm forwards terminal REPLIES (DA, CPR,
283
+ * DECRPM, focus, …) through the same upstream path as keystrokes, so counting the raw
284
+ * chunk would hold mail with nobody at the keyboard — and would SELF-TRIP, since our own
285
+ * delivery repaints the TUI, which queries the client, which answers. Only the human
286
+ * residue is recorded; see {@link stripTerminalReplies}. The PTY still receives the
287
+ * chunk VERBATIM, because the application asked for the reply and blocks on it.
288
+ * - **The bump ignores the return value.** The question the gate asks is "did a foreign
289
+ * writer put input at this session?", not "did it land". A dropped write cannot
290
+ * misreport itself as `busy` instead of `no-live-pty` either, because the delivery
291
+ * precheck tests `writable` BEFORE the token.
292
+ *
293
+ * Record-then-write is atomic with respect to the event loop: this method has no await.
239
294
  */
240
- write(data: string): boolean;
295
+ write(data: string, origin?: WriteOrigin): boolean;
241
296
  /**
242
297
  * Resize the PTY or shellper.
243
298
  * Returns false when the resize was dropped (#1198).
@@ -372,8 +427,52 @@ export declare class PtySession extends EventEmitter {
372
427
  * moved. Monotone (never falls on a partial trim), unlike the retired `partialBytes` token.
373
428
  */
374
429
  get bytesWritten(): number;
375
- /** Record that a user sent input to this session. */
376
- recordUserInput(): void;
430
+ /**
431
+ * One `AF_LOG_INPUT_SIGNAL` trace line. See {@link LOG_INPUT_SIGNAL}.
432
+ *
433
+ * `survived=<NOTHING>` is the line to look for with hands off the keyboard: it means the
434
+ * chunk was entirely terminal replies and moved no input signal. A line with a non-empty
435
+ * `survived` while nobody is typing names the exact bytes the filter failed to recognise —
436
+ * which is the whole finding, so they are printed escaped rather than summarised.
437
+ *
438
+ * SENSITIVE: that same fidelity means a `survived` run is the operator's literal keystrokes.
439
+ * The diagnostic is only useful if it prints the bytes exactly, so there is no redaction to
440
+ * add here without destroying it — the control is the flag, which is off by default. See
441
+ * {@link LOG_INPUT_SIGNAL}.
442
+ */
443
+ private logInputSignal;
444
+ /**
445
+ * The gate's MONOTONE input-change counter (Issue #1473) — the input-side twin of
446
+ * {@link bytesWritten}.
447
+ *
448
+ * *A change counter, not a total.* It exists to DIFFER between two samples, never to be
449
+ * read as a byte count: it advances by the recorded chunk's `.length`, which is UTF-16 code
450
+ * units, so an emoji moves it by two and a stripped reply by nothing. Naming it `inputBytes`
451
+ * would have been a lie.
452
+ *
453
+ * The delivery path folds it into the gate's change token, which is what makes a keystroke
454
+ * landing during the async classify invalidate the clean verdict instead of being written
455
+ * over — and, just as importantly, what keeps a memoized CLEAN verdict from being reused
456
+ * across one.
457
+ *
458
+ * NEVER RESET. Not on `spawn()`, not on {@link attachShellper}: those replace the PTY while
459
+ * KEEPING this `PtySession` object, and the gate's verdict memo is keyed on object identity
460
+ * plus the token — so a counter that fell back to 0 could reproduce an earlier token value
461
+ * on the same object and alias a stale verdict. (`attachShellper` does hydrate
462
+ * `_lastDataAt` from the shellper's tracker; the input signals get no such hydration, and
463
+ * must not.)
464
+ */
465
+ get inputSeq(): number;
466
+ /**
467
+ * Record that a user sent input to this session.
468
+ *
469
+ * `chunk` is the HUMAN residue of the write — replies already stripped by
470
+ * {@link stripTerminalReplies} — and is what advances {@link inputSeq}. Called with no
471
+ * argument (Spec 403's original typing-awareness contract) it still moves
472
+ * {@link lastInputAt}, so an existing caller keeps working; it just contributes no change
473
+ * to the counter, since there is no chunk to measure.
474
+ */
475
+ recordUserInput(chunk?: string): void;
377
476
  /**
378
477
  * Handle one chunk of user keyboard input from a live terminal client: record it for
379
478
  * typing-awareness (Spec 403), track composing/submit state (Bugfix #450 — Enter
@@ -383,11 +482,30 @@ export declare class PtySession extends EventEmitter {
383
482
  * fast-delivery trigger emitted by {@link stopComposing}) can never diverge between
384
483
  * clients. Automated mailbox delivery calls {@link write} directly and so, correctly,
385
484
  * never trips a submit signal.
485
+ *
486
+ * The input RECORDING moved down into {@link write} (Issue #1473), so it covers every
487
+ * writer rather than only this one — the raw `POST /api/terminals/:id/write` route and the
488
+ * operator `^C`/ESC bypasses are counted for free, and a future input path is counted by
489
+ * default. What stays here is what only a live client can tell us: whether the chunk ends a
490
+ * draft. Composing state is tracked on the RAW chunk deliberately — a reply already called
491
+ * `startComposing()` before this change, `stopComposing` drives the `'submit'` delivery
492
+ * trigger, and perturbing a delivery trigger inside a delivery-safety fix is not a trade
493
+ * worth making for a getter with no production consumer.
386
494
  */
387
495
  handleUserInput(data: string): void;
388
496
  /** Whether the user has been idle (no input) for at least thresholdMs. */
389
497
  isUserIdle(thresholdMs: number): boolean;
390
- /** Timestamp (epoch ms) of the last user input, or 0 if none. */
498
+ /**
499
+ * Timestamp (epoch ms) of the last user input, or 0 if none.
500
+ *
501
+ * Beyond Spec 403's typing-awareness, this is now the delivery gate's INPUT-SETTLE signal
502
+ * (Issue #1473). A change counter can only catch input that arrives AFTER the gate sampled
503
+ * it; input that landed just BEFORE the sample and has not been echoed yet moves no counter
504
+ * — both samples agree, correctly — and the classifier reads a genuinely empty composer.
505
+ * Only a clock can see that, so the delivery path requires a quiet interval here before it
506
+ * writes. `0` for a session that has never received input, which reads as settled from
507
+ * birth.
508
+ */
391
509
  get lastInputAt(): number;
392
510
  /** Timestamp (epoch ms) of the last PTY output data. Initialized to creation time. */
393
511
  get lastDataAt(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"pty-session.d.ts","sourceRoot":"","sources":["../../src/terminal/pty-session.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAG5D;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,uBAAqB,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;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e,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IASnC,0EAA0E;IAC1E,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO;IAIxC;;;;;;;;;;OAUG;IACH,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,sFAAsF;IACtF,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,0EAA0E;IAC1E,cAAc,IAAI,IAAI;IAItB,iEAAiE;IACjE,aAAa,IAAI,IAAI;IAOrB,mFAAmF;IACnF,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,OAAO,CAAC,OAAO;CAsBhB"}
@@ -7,6 +7,31 @@ import path from 'node:path';
7
7
  import { EventEmitter } from 'node:events';
8
8
  import { RingBuffer } from './ring-buffer.js';
9
9
  import { SessionScreen } from './session-screen.js';
10
+ import { stripTerminalReplies, terminalReplyMatches, escapeBytes } from './terminal-replies.js';
11
+ /**
12
+ * Set `AF_LOG_INPUT_SIGNAL=1` to trace every external write's effect on the delivery gate's
13
+ * input signal (Issue #1473): the raw chunk, what the reply filter removed, and what survived
14
+ * as human input.
15
+ *
16
+ * It exists because the filter's correctness is otherwise INVISIBLE. An under-strip shows up as
17
+ * a hold with nobody at the keyboard and an over-strip shows up as nothing at all, and neither
18
+ * can be told apart from normal operation by watching the outside of the system. The one
19
+ * measurement that settles it — sit with hands off the keyboard and see whether anything is
20
+ * recorded as input — needs this trace to be readable.
21
+ *
22
+ * Read once at module load: this is on the write path for every keystroke, and a per-write
23
+ * `process.env` lookup is a string-map hit on the hottest line in the terminal layer.
24
+ *
25
+ * ## SENSITIVE DATA — this logs what a human types, verbatim
26
+ *
27
+ * `survived="..."` is literal keystrokes. Everything typed into any composer on this Tower goes
28
+ * to the log while the flag is on: prompts, pasted content, and anything a person types into a
29
+ * password or token field an app happens to be showing. It is off by default and must stay a
30
+ * short, deliberate, supervised diagnostic session — never a setting left on in a shared or
31
+ * long-lived Tower, never enabled in an environment whose logs are shipped or retained. Delete
32
+ * or truncate the captured output when the session ends.
33
+ */
34
+ const LOG_INPUT_SIGNAL = process.env.AF_LOG_INPUT_SIGNAL === '1';
10
35
  import { isDeliberateExit } from './shellper-protocol.js';
11
36
  /**
12
37
  * Terminal delivery-signal bus (Spec 1313, Phase 5).
@@ -104,8 +129,12 @@ export class PtySession extends EventEmitter {
104
129
  _quiescenceTimer = null;
105
130
  clients = new Set();
106
131
  _lastInputAt = 0;
132
+ // Issue #1473: the gate's MONOTONE input-change counter. Never reset — not on respawn, not
133
+ // on re-attach — see the `inputSeq` getter.
134
+ _inputSeq = 0;
107
135
  _lastDataAt = Date.now();
108
136
  _composing = false;
137
+ clock;
109
138
  constructor(config) {
110
139
  super();
111
140
  this.config = config;
@@ -120,6 +149,7 @@ export class PtySession extends EventEmitter {
120
149
  this.diskLogEnabled = config.diskLogEnabled ?? true;
121
150
  this.diskLogMaxBytes = config.diskLogMaxBytes ?? 50 * 1024 * 1024; // DEFAULT_DISK_LOG_MAX_BYTES
122
151
  this.reconnectTimeoutMs = config.reconnectTimeoutMs ?? 300_000;
152
+ this.clock = config.clock ?? Date.now;
123
153
  this.logPath = path.join(config.logDir, `${config.id}.log`);
124
154
  }
125
155
  /** Spawn the PTY process. Must be called after construction. */
@@ -192,6 +222,12 @@ export class PtySession extends EventEmitter {
192
222
  // it has a value (WELCOME-side hydration carries genuine activity
193
223
  // history across Tower restart). The data-frame subscription below
194
224
  // keeps it bumped going forward via onPtyData.
225
+ //
226
+ // The INPUT signals (`_inputSeq`, `_lastInputAt`) get no such hydration and must be left
227
+ // strictly alone here (Issue #1473). The shellper has no view of them, and this object
228
+ // survives the re-attach — so resetting the counter could reproduce an earlier gate token
229
+ // on the same session identity and alias a stale CLEAN verdict, while resetting the
230
+ // timestamp would erase a keystroke that is still un-echoed on the line.
195
231
  this._lastDataAt = client.lastDataAt;
196
232
  // Ensure log directory exists. Guarded on logFd: with #1198 re-attach is
197
233
  // a routine recovery step, and reopening unconditionally would leak one
@@ -542,8 +578,36 @@ export class PtySession extends EventEmitter {
542
578
  /**
543
579
  * Write user input to the PTY or shellper.
544
580
  * Returns false when the input was dropped (#1198).
581
+ *
582
+ * THE GATE'S INPUT OBSERVATION POINT (Issue #1473). This is the single funnel every write
583
+ * to a session passes through, so it is where the delivery gate learns that somebody put
584
+ * something on the line. Until now it recorded nothing: `bytesWritten` counts OUTPUT and
585
+ * `lastDataAt` tracks OUTPUT, so a keystroke was invisible to the gate until the TUI
586
+ * happened to echo it — which is the whole of the echo-lag hole.
587
+ *
588
+ * Two things are deliberate here:
589
+ *
590
+ * - **The filter, not just the counter.** xterm forwards terminal REPLIES (DA, CPR,
591
+ * DECRPM, focus, …) through the same upstream path as keystrokes, so counting the raw
592
+ * chunk would hold mail with nobody at the keyboard — and would SELF-TRIP, since our own
593
+ * delivery repaints the TUI, which queries the client, which answers. Only the human
594
+ * residue is recorded; see {@link stripTerminalReplies}. The PTY still receives the
595
+ * chunk VERBATIM, because the application asked for the reply and blocks on it.
596
+ * - **The bump ignores the return value.** The question the gate asks is "did a foreign
597
+ * writer put input at this session?", not "did it land". A dropped write cannot
598
+ * misreport itself as `busy` instead of `no-live-pty` either, because the delivery
599
+ * precheck tests `writable` BEFORE the token.
600
+ *
601
+ * Record-then-write is atomic with respect to the event loop: this method has no await.
545
602
  */
546
- write(data) {
603
+ write(data, origin = 'external') {
604
+ if (origin === 'external') {
605
+ const human = stripTerminalReplies(data);
606
+ if (LOG_INPUT_SIGNAL)
607
+ this.logInputSignal(data, human);
608
+ if (human)
609
+ this.recordUserInput(human);
610
+ }
547
611
  if (this._shellperBacked) {
548
612
  if (this.shellperClient && this.status === 'running') {
549
613
  return this.shellperClient.write(data);
@@ -837,9 +901,62 @@ export class PtySession extends EventEmitter {
837
901
  get bytesWritten() {
838
902
  return this.ringBuffer.bytesWritten;
839
903
  }
840
- /** Record that a user sent input to this session. */
841
- recordUserInput() {
842
- this._lastInputAt = Date.now();
904
+ /**
905
+ * One `AF_LOG_INPUT_SIGNAL` trace line. See {@link LOG_INPUT_SIGNAL}.
906
+ *
907
+ * `survived=<NOTHING>` is the line to look for with hands off the keyboard: it means the
908
+ * chunk was entirely terminal replies and moved no input signal. A line with a non-empty
909
+ * `survived` while nobody is typing names the exact bytes the filter failed to recognise —
910
+ * which is the whole finding, so they are printed escaped rather than summarised.
911
+ *
912
+ * SENSITIVE: that same fidelity means a `survived` run is the operator's literal keystrokes.
913
+ * The diagnostic is only useful if it prints the bytes exactly, so there is no redaction to
914
+ * add here without destroying it — the control is the flag, which is off by default. See
915
+ * {@link LOG_INPUT_SIGNAL}.
916
+ */
917
+ logInputSignal(raw, survived) {
918
+ const stripped = terminalReplyMatches(raw);
919
+ console.log(`[input-signal ${this.id.slice(0, 8)}] raw="${escapeBytes(raw)}" ` +
920
+ `stripped=${stripped.length === 0 ? '<none>' : stripped.map((r) => `"${escapeBytes(r)}"`).join(' ')} ` +
921
+ `survived=${survived === '' ? '<NOTHING>' : `"${escapeBytes(survived)}"`} ` +
922
+ `inputSeq=${this._inputSeq}→${this._inputSeq + survived.length}`);
923
+ }
924
+ /**
925
+ * The gate's MONOTONE input-change counter (Issue #1473) — the input-side twin of
926
+ * {@link bytesWritten}.
927
+ *
928
+ * *A change counter, not a total.* It exists to DIFFER between two samples, never to be
929
+ * read as a byte count: it advances by the recorded chunk's `.length`, which is UTF-16 code
930
+ * units, so an emoji moves it by two and a stripped reply by nothing. Naming it `inputBytes`
931
+ * would have been a lie.
932
+ *
933
+ * The delivery path folds it into the gate's change token, which is what makes a keystroke
934
+ * landing during the async classify invalidate the clean verdict instead of being written
935
+ * over — and, just as importantly, what keeps a memoized CLEAN verdict from being reused
936
+ * across one.
937
+ *
938
+ * NEVER RESET. Not on `spawn()`, not on {@link attachShellper}: those replace the PTY while
939
+ * KEEPING this `PtySession` object, and the gate's verdict memo is keyed on object identity
940
+ * plus the token — so a counter that fell back to 0 could reproduce an earlier token value
941
+ * on the same object and alias a stale verdict. (`attachShellper` does hydrate
942
+ * `_lastDataAt` from the shellper's tracker; the input signals get no such hydration, and
943
+ * must not.)
944
+ */
945
+ get inputSeq() {
946
+ return this._inputSeq;
947
+ }
948
+ /**
949
+ * Record that a user sent input to this session.
950
+ *
951
+ * `chunk` is the HUMAN residue of the write — replies already stripped by
952
+ * {@link stripTerminalReplies} — and is what advances {@link inputSeq}. Called with no
953
+ * argument (Spec 403's original typing-awareness contract) it still moves
954
+ * {@link lastInputAt}, so an existing caller keeps working; it just contributes no change
955
+ * to the counter, since there is no chunk to measure.
956
+ */
957
+ recordUserInput(chunk = '') {
958
+ this._lastInputAt = this.clock();
959
+ this._inputSeq += chunk.length;
843
960
  }
844
961
  /**
845
962
  * Handle one chunk of user keyboard input from a live terminal client: record it for
@@ -850,9 +967,17 @@ export class PtySession extends EventEmitter {
850
967
  * fast-delivery trigger emitted by {@link stopComposing}) can never diverge between
851
968
  * clients. Automated mailbox delivery calls {@link write} directly and so, correctly,
852
969
  * never trips a submit signal.
970
+ *
971
+ * The input RECORDING moved down into {@link write} (Issue #1473), so it covers every
972
+ * writer rather than only this one — the raw `POST /api/terminals/:id/write` route and the
973
+ * operator `^C`/ESC bypasses are counted for free, and a future input path is counted by
974
+ * default. What stays here is what only a live client can tell us: whether the chunk ends a
975
+ * draft. Composing state is tracked on the RAW chunk deliberately — a reply already called
976
+ * `startComposing()` before this change, `stopComposing` drives the `'submit'` delivery
977
+ * trigger, and perturbing a delivery trigger inside a delivery-safety fix is not a trade
978
+ * worth making for a getter with no production consumer.
853
979
  */
854
980
  handleUserInput(data) {
855
- this.recordUserInput();
856
981
  if (data.includes('\r') || data.includes('\n')) {
857
982
  this.stopComposing();
858
983
  }
@@ -863,9 +988,19 @@ export class PtySession extends EventEmitter {
863
988
  }
864
989
  /** Whether the user has been idle (no input) for at least thresholdMs. */
865
990
  isUserIdle(thresholdMs) {
866
- return Date.now() - this._lastInputAt >= thresholdMs;
991
+ return this.clock() - this._lastInputAt >= thresholdMs;
867
992
  }
868
- /** Timestamp (epoch ms) of the last user input, or 0 if none. */
993
+ /**
994
+ * Timestamp (epoch ms) of the last user input, or 0 if none.
995
+ *
996
+ * Beyond Spec 403's typing-awareness, this is now the delivery gate's INPUT-SETTLE signal
997
+ * (Issue #1473). A change counter can only catch input that arrives AFTER the gate sampled
998
+ * it; input that landed just BEFORE the sample and has not been echoed yet moves no counter
999
+ * — both samples agree, correctly — and the classifier reads a genuinely empty composer.
1000
+ * Only a clock can see that, so the delivery path requires a quiet interval here before it
1001
+ * writes. `0` for a session that has never received input, which reads as settled from
1002
+ * birth.
1003
+ */
869
1004
  get lastInputAt() {
870
1005
  return this._lastInputAt;
871
1006
  }