@agent-watch-ai/edge 0.6.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. package/CHANGELOG.md +288 -9
  2. package/README.md +307 -5
  3. package/dist/billing/billing-mode.d.ts +37 -5
  4. package/dist/billing/billing-mode.js +28 -19
  5. package/dist/billing/constants/billing.constants.d.ts +0 -2
  6. package/dist/billing/constants/billing.constants.js +0 -2
  7. package/dist/billing/index.d.ts +2 -1
  8. package/dist/billing/index.js +1 -1
  9. package/dist/billing/session-billing.d.ts +7 -3
  10. package/dist/billing/session-billing.js +34 -13
  11. package/dist/billing/types/billing.types.d.ts +7 -0
  12. package/dist/capture/capture-env.d.ts +147 -0
  13. package/dist/capture/capture-env.js +301 -0
  14. package/dist/capture/captured-step.d.ts +88 -0
  15. package/dist/capture/captured-step.js +503 -0
  16. package/dist/capture/constants/capture.constants.d.ts +85 -0
  17. package/dist/capture/constants/capture.constants.js +87 -0
  18. package/dist/capture/launched-runs.d.ts +43 -0
  19. package/dist/capture/launched-runs.js +157 -0
  20. package/dist/capture/node.cjs +697 -0
  21. package/dist/capture/node.d.cts +32 -0
  22. package/dist/capture/python/sitecustomize.py +832 -0
  23. package/dist/capture/schemas/capture.schema.d.ts +35 -0
  24. package/dist/capture/schemas/capture.schema.js +31 -0
  25. package/dist/capture/types/capture.types.d.ts +20 -0
  26. package/dist/capture/venv-loader.d.ts +68 -0
  27. package/dist/capture/venv-loader.js +189 -0
  28. package/dist/cli/constants/cli.constants.d.ts +23 -6
  29. package/dist/cli/constants/cli.constants.js +24 -7
  30. package/dist/cli/context.d.ts +19 -22
  31. package/dist/cli/context.js +23 -54
  32. package/dist/cli/doctor-run-capture.d.ts +21 -0
  33. package/dist/cli/doctor-run-capture.js +33 -0
  34. package/dist/cli/doctor.js +21 -68
  35. package/dist/cli/hook-check.d.ts +7 -2
  36. package/dist/cli/hook-check.js +30 -15
  37. package/dist/cli/hook.d.ts +14 -0
  38. package/dist/cli/hook.js +82 -1
  39. package/dist/cli/index.d.ts +1 -1
  40. package/dist/cli/index.js +1 -1
  41. package/dist/cli/misc.js +10 -2
  42. package/dist/cli/npm-global.d.ts +24 -0
  43. package/dist/cli/npm-global.js +77 -0
  44. package/dist/cli/npx-install.js +22 -6
  45. package/dist/cli/replay.d.ts +33 -0
  46. package/dist/cli/replay.js +228 -0
  47. package/dist/cli/setup.d.ts +10 -2
  48. package/dist/cli/setup.js +200 -31
  49. package/dist/cli/status.js +45 -5
  50. package/dist/cli/toggle.js +10 -0
  51. package/dist/cli/types/cli.types.d.ts +15 -1
  52. package/dist/cli/uninstall.js +42 -23
  53. package/dist/cli/update.js +3 -2
  54. package/dist/cli.js +104 -17
  55. package/dist/config/config-store.d.ts +15 -4
  56. package/dist/config/config-store.js +31 -7
  57. package/dist/config/config.d.ts +0 -2
  58. package/dist/config/config.js +0 -1
  59. package/dist/config/constants/config.constants.d.ts +8 -1
  60. package/dist/config/constants/config.constants.js +10 -1
  61. package/dist/config/events-transport.d.ts +15 -0
  62. package/dist/config/events-transport.js +29 -0
  63. package/dist/config/index.d.ts +2 -1
  64. package/dist/config/index.js +1 -0
  65. package/dist/config/root-config.d.ts +12 -0
  66. package/dist/config/root-config.js +24 -0
  67. package/dist/config/schemas/config.schema.d.ts +15 -2
  68. package/dist/config/schemas/config.schema.js +52 -8
  69. package/dist/config/types/config.types.d.ts +7 -0
  70. package/dist/core/index.d.ts +1 -1
  71. package/dist/core/index.js +1 -1
  72. package/dist/core/version.d.ts +9 -0
  73. package/dist/core/version.js +14 -0
  74. package/dist/core/which.d.ts +11 -0
  75. package/dist/core/which.js +18 -0
  76. package/dist/credentials/cloud-claim.d.ts +34 -0
  77. package/dist/credentials/cloud-claim.js +61 -0
  78. package/dist/credentials/constants/credentials.constants.d.ts +16 -1
  79. package/dist/credentials/constants/credentials.constants.js +17 -2
  80. package/dist/credentials/credential-status.js +1 -1
  81. package/dist/credentials/credentials.d.ts +3 -3
  82. package/dist/credentials/credentials.js +26 -12
  83. package/dist/credentials/device-api.d.ts +15 -1
  84. package/dist/credentials/device-api.js +12 -1
  85. package/dist/credentials/identity.d.ts +2 -2
  86. package/dist/credentials/identity.js +2 -2
  87. package/dist/credentials/install-key.d.ts +31 -0
  88. package/dist/credentials/install-key.js +58 -0
  89. package/dist/credentials/migration.d.ts +9 -7
  90. package/dist/credentials/migration.js +58 -18
  91. package/dist/credentials/secret-store.d.ts +12 -0
  92. package/dist/credentials/secret-store.js +18 -1
  93. package/dist/credentials/sign-in.d.ts +27 -0
  94. package/dist/credentials/sign-in.js +31 -1
  95. package/dist/credentials/token-refresher.d.ts +5 -1
  96. package/dist/credentials/token-refresher.js +10 -2
  97. package/dist/enforcement/enforcement.js +1 -1
  98. package/dist/events/constants/events.constants.d.ts +5 -2
  99. package/dist/events/constants/events.constants.js +4 -1
  100. package/dist/events/enrich.d.ts +14 -0
  101. package/dist/events/enrich.js +1 -1
  102. package/dist/events/index.d.ts +1 -0
  103. package/dist/events/product-event.d.ts +6 -3
  104. package/dist/events/types/events.types.d.ts +6 -0
  105. package/dist/events/types/replay-progress.types.d.ts +26 -0
  106. package/dist/events/types/replay-progress.types.js +1 -0
  107. package/dist/events/types/repo-tree.types.d.ts +2 -1
  108. package/dist/feature/ticket-candidates.d.ts +1 -1
  109. package/dist/git/checkout-root.d.ts +15 -0
  110. package/dist/git/checkout-root.js +18 -0
  111. package/dist/git/code-state.d.ts +2 -16
  112. package/dist/git/code-state.js +11 -12
  113. package/dist/git/constants/git.constants.d.ts +33 -11
  114. package/dist/git/constants/git.constants.js +45 -12
  115. package/dist/git/fingerprint.d.ts +3 -6
  116. package/dist/git/fingerprint.js +5 -8
  117. package/dist/git/git-context.js +5 -1
  118. package/dist/git/index.d.ts +1 -2
  119. package/dist/git/index.js +1 -1
  120. package/dist/git/repo-snapshot.d.ts +13 -4
  121. package/dist/git/repo-snapshot.js +53 -9
  122. package/dist/git/types/snapshot.types.d.ts +6 -0
  123. package/dist/pipeline/constants/pipeline.constants.d.ts +3 -0
  124. package/dist/pipeline/constants/pipeline.constants.js +3 -0
  125. package/dist/pipeline/hook-pipeline.js +82 -57
  126. package/dist/privacy/product-capture.js +2 -0
  127. package/dist/providers/antigravity/antigravity.capture.d.ts +2 -0
  128. package/dist/providers/antigravity/antigravity.capture.js +5 -0
  129. package/dist/providers/antigravity/antigravity.detect.js +8 -22
  130. package/dist/providers/antigravity/antigravity.provider.js +10 -3
  131. package/dist/providers/antigravity/constants/antigravity.constants.d.ts +1 -0
  132. package/dist/providers/antigravity/constants/antigravity.constants.js +1 -0
  133. package/dist/providers/claude/claude.adapter.js +9 -6
  134. package/dist/providers/claude/claude.detect.js +2 -17
  135. package/dist/providers/claude/claude.otel.d.ts +21 -3
  136. package/dist/providers/claude/claude.otel.js +216 -61
  137. package/dist/providers/claude/claude.provider.js +21 -1
  138. package/dist/providers/claude/claude.version.d.ts +9 -0
  139. package/dist/providers/claude/claude.version.js +28 -0
  140. package/dist/providers/claude/constants/claude.constants.d.ts +27 -0
  141. package/dist/providers/claude/constants/claude.constants.js +27 -0
  142. package/dist/providers/claude/constants/claude.otel.constants.d.ts +27 -0
  143. package/dist/providers/claude/constants/claude.otel.constants.js +45 -5
  144. package/dist/providers/claude/types/claude.types.d.ts +13 -0
  145. package/dist/providers/codex/codex.capture.d.ts +76 -0
  146. package/dist/providers/codex/codex.capture.js +454 -0
  147. package/dist/providers/codex/codex.detect.js +2 -4
  148. package/dist/providers/codex/codex.otel.d.ts +38 -2
  149. package/dist/providers/codex/codex.otel.js +50 -6
  150. package/dist/providers/codex/codex.provider.js +8 -0
  151. package/dist/providers/codex/codex.surface.d.ts +9 -0
  152. package/dist/{turns/codex-originator.js → providers/codex/codex.surface.js} +17 -3
  153. package/dist/providers/codex/codex.titles.d.ts +14 -0
  154. package/dist/providers/codex/codex.titles.js +35 -0
  155. package/dist/providers/codex/constants/codex.constants.d.ts +4 -0
  156. package/dist/providers/codex/constants/codex.constants.js +4 -0
  157. package/dist/providers/cursor/constants/cursor.constants.d.ts +17 -4
  158. package/dist/providers/cursor/constants/cursor.constants.js +25 -5
  159. package/dist/providers/cursor/cursor-mcp-memo.d.ts +34 -0
  160. package/dist/providers/cursor/cursor-mcp-memo.js +94 -0
  161. package/dist/providers/cursor/cursor.adapter.js +20 -82
  162. package/dist/providers/cursor/cursor.capture.d.ts +1 -0
  163. package/dist/providers/cursor/cursor.capture.js +4 -0
  164. package/dist/providers/cursor/cursor.detect.d.ts +5 -1
  165. package/dist/providers/cursor/cursor.detect.js +11 -26
  166. package/dist/providers/cursor/cursor.hooks.js +2 -2
  167. package/dist/providers/cursor/cursor.provider.js +16 -7
  168. package/dist/providers/cursor/cursor.titles.d.ts +14 -0
  169. package/dist/providers/cursor/cursor.titles.js +20 -0
  170. package/dist/providers/cursor/schemas/cursor.schema.d.ts +3 -3
  171. package/dist/providers/cursor/schemas/cursor.schema.js +5 -3
  172. package/dist/providers/gemini/constants/gemini.constants.d.ts +16 -0
  173. package/dist/providers/gemini/constants/gemini.constants.js +17 -0
  174. package/dist/providers/gemini/gemini.capture.d.ts +81 -0
  175. package/dist/providers/gemini/gemini.capture.js +210 -0
  176. package/dist/providers/gemini/gemini.detect.js +57 -24
  177. package/dist/providers/gemini/gemini.otel.d.ts +38 -2
  178. package/dist/providers/gemini/gemini.otel.js +56 -125
  179. package/dist/providers/gemini/gemini.provider.js +5 -0
  180. package/dist/providers/index.d.ts +1 -0
  181. package/dist/providers/index.js +1 -0
  182. package/dist/providers/provider.d.ts +8 -0
  183. package/dist/providers/provider.js +9 -0
  184. package/dist/providers/registry.d.ts +14 -0
  185. package/dist/providers/registry.js +14 -0
  186. package/dist/providers/shared/constants/hook-config.constants.d.ts +2 -0
  187. package/dist/providers/shared/constants/hook-config.constants.js +2 -0
  188. package/dist/providers/shared/constants/terminal-capture.constants.d.ts +6 -0
  189. package/dist/providers/shared/constants/terminal-capture.constants.js +6 -0
  190. package/dist/providers/shared/editor-paths.d.ts +8 -0
  191. package/dist/providers/shared/editor-paths.js +18 -0
  192. package/dist/providers/shared/hook-config.d.ts +5 -0
  193. package/dist/providers/shared/hook-config.js +39 -1
  194. package/dist/providers/shared/hooks-marker.d.ts +14 -0
  195. package/dist/providers/shared/hooks-marker.js +23 -0
  196. package/dist/providers/shared/install-record.d.ts +29 -0
  197. package/dist/providers/shared/install-record.js +52 -0
  198. package/dist/providers/shared/session-title-store.d.ts +23 -0
  199. package/dist/providers/shared/session-title-store.js +50 -0
  200. package/dist/providers/shared/terminal-capture.d.ts +41 -0
  201. package/dist/providers/shared/terminal-capture.js +109 -0
  202. package/dist/providers/shared/tooling.d.ts +21 -0
  203. package/dist/providers/shared/tooling.js +36 -1
  204. package/dist/providers/types/provider.types.d.ts +57 -4
  205. package/dist/replay/checkout-resolver.d.ts +56 -0
  206. package/dist/replay/checkout-resolver.js +173 -0
  207. package/dist/replay/codex-turns.d.ts +24 -0
  208. package/dist/replay/codex-turns.js +221 -0
  209. package/dist/replay/constants/replay.constants.d.ts +99 -0
  210. package/dist/replay/constants/replay.constants.js +102 -0
  211. package/dist/replay/describe.d.ts +10 -0
  212. package/dist/replay/describe.js +31 -0
  213. package/dist/replay/gemini-turns.d.ts +36 -0
  214. package/dist/replay/gemini-turns.js +192 -0
  215. package/dist/replay/machine.d.ts +34 -0
  216. package/dist/replay/machine.js +68 -0
  217. package/dist/replay/progress-event.d.ts +21 -0
  218. package/dist/replay/progress-event.js +45 -0
  219. package/dist/replay/replay-runner.d.ts +60 -0
  220. package/dist/replay/replay-runner.js +581 -0
  221. package/dist/replay/replay-scan.d.ts +84 -0
  222. package/dist/replay/replay-scan.js +182 -0
  223. package/dist/replay/replay-state.d.ts +108 -0
  224. package/dist/replay/replay-state.js +199 -0
  225. package/dist/replay/resume.d.ts +18 -0
  226. package/dist/replay/resume.js +34 -0
  227. package/dist/replay/start.d.ts +23 -0
  228. package/dist/replay/start.js +39 -0
  229. package/dist/replay/throttle.d.ts +36 -0
  230. package/dist/replay/throttle.js +44 -0
  231. package/dist/replay/transcript-turns.d.ts +35 -0
  232. package/dist/replay/transcript-turns.js +241 -0
  233. package/dist/replay/turn-event.d.ts +40 -0
  234. package/dist/replay/turn-event.js +127 -0
  235. package/dist/replay/types/replay.types.d.ts +198 -0
  236. package/dist/replay/types/replay.types.js +1 -0
  237. package/dist/replay/window.d.ts +28 -0
  238. package/dist/replay/window.js +41 -0
  239. package/dist/replay/worktree-map.d.ts +42 -0
  240. package/dist/replay/worktree-map.js +134 -0
  241. package/dist/snapshot/branch-selection.d.ts +40 -23
  242. package/dist/snapshot/branch-selection.js +71 -41
  243. package/dist/snapshot/constants/snapshot-stages.constants.d.ts +3 -1
  244. package/dist/snapshot/constants/snapshot-stages.constants.js +3 -1
  245. package/dist/snapshot/constants/snapshot.constants.d.ts +34 -7
  246. package/dist/snapshot/constants/snapshot.constants.js +34 -7
  247. package/dist/snapshot/index.d.ts +2 -2
  248. package/dist/snapshot/index.js +1 -1
  249. package/dist/snapshot/snapshot-pipeline.js +100 -26
  250. package/dist/snapshot/snapshot-state.js +6 -2
  251. package/dist/snapshot/tree-pipeline.d.ts +1 -1
  252. package/dist/snapshot/tree-pipeline.js +34 -15
  253. package/dist/snapshot/types/snapshot.types.d.ts +22 -3
  254. package/dist/storage/schemas/storage.schema.d.ts +2 -0
  255. package/dist/storage/schemas/storage.schema.js +6 -0
  256. package/dist/transport/delivery-stats.d.ts +13 -1
  257. package/dist/transport/delivery-stats.js +18 -2
  258. package/dist/transport/delivery.d.ts +4 -3
  259. package/dist/transport/delivery.js +21 -7
  260. package/dist/transport/identity-delivery.d.ts +20 -0
  261. package/dist/transport/identity-delivery.js +41 -0
  262. package/dist/transport/index.d.ts +2 -0
  263. package/dist/transport/index.js +1 -0
  264. package/dist/transport/types/delivery-flow.types.d.ts +7 -0
  265. package/dist/turns/claude-transcript.js +4 -12
  266. package/dist/turns/codex-transcript.d.ts +9 -0
  267. package/dist/turns/codex-transcript.js +27 -19
  268. package/dist/turns/constants/turns.constants.d.ts +29 -12
  269. package/dist/turns/constants/turns.constants.js +31 -19
  270. package/dist/turns/gemini-transcript.d.ts +19 -1
  271. package/dist/turns/gemini-transcript.js +29 -18
  272. package/dist/turns/index.d.ts +3 -4
  273. package/dist/turns/index.js +2 -3
  274. package/dist/turns/run-state.d.ts +71 -0
  275. package/dist/turns/run-state.js +114 -0
  276. package/dist/turns/tool-events.d.ts +11 -1
  277. package/dist/turns/tool-events.js +32 -9
  278. package/dist/turns/transcript.d.ts +15 -14
  279. package/dist/turns/transcript.js +23 -4
  280. package/dist/turns/turn-state.d.ts +82 -7
  281. package/dist/turns/turn-state.js +157 -10
  282. package/dist/turns/turn-summary.js +7 -2
  283. package/dist/turns/turn-tracker.d.ts +9 -16
  284. package/dist/turns/turn-tracker.js +163 -87
  285. package/dist/turns/types/transcript.types.d.ts +11 -1
  286. package/dist/turns/types/turn-provider.types.d.ts +33 -0
  287. package/dist/turns/types/turn-provider.types.js +1 -0
  288. package/dist/turns/types/turn-state.types.d.ts +9 -0
  289. package/dist/turns/types/turn-summary.types.d.ts +17 -1
  290. package/dist/turns/types/turn-tracker.types.d.ts +3 -1
  291. package/dist/turns/work-checkout.js +1 -2
  292. package/docs/AUDIT_PROMPT.md +10 -0
  293. package/docs/DATA_HANDLING.md +201 -13
  294. package/docs/ENTERPRISE_DEPLOYMENT.md +3 -3
  295. package/docs/PERFORMANCE.md +10 -0
  296. package/package.json +3 -2
  297. package/dist/events/canonical-event.d.ts +0 -10
  298. package/dist/events/canonical-event.js +0 -9
  299. package/dist/git/repository-root.d.ts +0 -39
  300. package/dist/git/repository-root.js +0 -131
  301. package/dist/git/types/repository-root.types.d.ts +0 -11
  302. package/dist/transport/transport.d.ts +0 -6
  303. package/dist/turns/codex-originator.d.ts +0 -11
  304. package/dist/turns/cursor-transcript.d.ts +0 -21
  305. package/dist/turns/cursor-transcript.js +0 -66
  306. package/dist/turns/native-session-titles.d.ts +0 -26
  307. package/dist/turns/native-session-titles.js +0 -102
  308. /package/dist/{git/types/repository-root.types.js → billing/types/billing.types.js} +0 -0
  309. /package/dist/{transport/transport.js → capture/types/capture.types.js} +0 -0
@@ -1,71 +1,101 @@
1
- import { SNAPSHOT_REFRESH_MS } from './constants/snapshot.constants.js';
1
+ import { SNAPSHOT_BRANCH_COUNT, SNAPSHOT_REFRESH_MS } from './constants/snapshot.constants.js';
2
2
  /**
3
- * Which branches are worth describing again.
3
+ * The branches the snapshot walks, newest commit first, and which of them are due.
4
4
  *
5
- * Four reasons, and each one is a bug if it is missing:
5
+ * A branch already found on the trunk, at the same head and against the same
6
+ * base, is left out without a git process: merged stays merged, and that is
7
+ * what lets the walk pass the dozens of finished branches a busy repository
8
+ * keeps to reach the live ones behind them. Every other branch is a candidate,
9
+ * due when one of these holds — and each one is a bug if it is missing:
6
10
  *
7
- * - the branch is new — nothing has ever been reported about it;
8
- * - its head moved — the obvious one;
9
- * - the default branch changed since the last send, because every delta was
10
- * computed against the wrong base and no head has to move for that to be
11
- * true;
12
- * - the entry is older than the heartbeat, which is the only thing that ever
13
- * re-offers a finished branch to a tracker connected after the fact.
11
+ * - the branch is new — nothing has ever been checked about it;
12
+ * - its head moved — the obvious one, and how a merged branch with new work
13
+ * comes back;
14
+ * - the default branch changed since it was checked, because its delta and its
15
+ * verdict were computed against the wrong base and no head has to move for
16
+ * that to be true;
17
+ * - it was last sent longer ago than the heartbeat, which is the only thing
18
+ * that ever re-offers a finished branch to a tracker connected after the fact.
14
19
  *
15
- * @param input - The refs git reported and what was last sent.
16
- * @returns The branches to describe. Empty means send nothing at all.
20
+ * @param input - The refs git reported and what was last recorded.
21
+ * @returns The candidates in walk order.
17
22
  */
18
- export function selectChangedBranches(input) {
19
- const rebased = input.stored.defaultBranch !== input.defaultBranch;
20
- return input.refs.filter((ref) => {
21
- if (rebased)
22
- return true;
23
+ export function snapshotCandidates(input) {
24
+ const candidates = [];
25
+ for (const ref of input.refs) {
23
26
  const entry = input.stored.branches[ref.name];
24
- if (!entry)
25
- return true;
26
- if (entry.headSha !== ref.headSha)
27
- return true;
28
- return input.now - entry.lastSentAt >= SNAPSHOT_REFRESH_MS;
29
- });
27
+ const current = entry !== undefined && entry.headSha === ref.headSha && entryBase(entry, input.stored) === input.defaultBranch;
28
+ if (current && entry.merged)
29
+ continue;
30
+ candidates.push({ ref, due: !current || input.now - entry.lastSentAt >= SNAPSHOT_REFRESH_MS });
31
+ }
32
+ return candidates;
33
+ }
34
+ /**
35
+ * Whether the walk would reach a due branch before the window is full.
36
+ *
37
+ * The cheap exit on an ordinary closing turn: the first ten live branches are
38
+ * all as they were sent, so no git process runs and nothing is queued.
39
+ *
40
+ * @param candidates - The walk, from {@link snapshotCandidates}.
41
+ * @returns True when something has to be checked.
42
+ */
43
+ export function anyDue(candidates) {
44
+ const reached = candidates.slice(0, SNAPSHOT_BRANCH_COUNT);
45
+ return reached.some((candidate) => candidate.due);
30
46
  }
31
47
  /**
32
48
  * The state to store once a snapshot has been queued.
33
49
  *
34
- * A branch is recorded as reported only if it was actually described. The
35
- * cache is a record of what the platform has been told, not of what git said:
36
- * a branch whose head moved and which then fell outside the budget must keep
37
- * its *old* head here, or the next turn compares the new head against the new
38
- * head, finds them equal, and the work disappears until the heartbeat six hours
39
- * later.
50
+ * A branch is recorded only if it was actually checked. The cache is a record
51
+ * of what the platform has been told, not of what git said: a branch whose head
52
+ * moved and which then fell outside the budget must keep its *old* head here,
53
+ * or the next turn compares the new head against the new head, finds them
54
+ * equal, and the work disappears until the heartbeat six hours later.
40
55
  *
41
- * A branch that was listed but never sent is therefore left exactly as it was —
42
- * and one that has never been sent at all is left out, so it stays new.
56
+ * A branch found on the trunk is recorded as merged: the platform has been told
57
+ * all there is, and the verdict is what keeps every later turn from checking it
58
+ * again. Each entry carries the base it was checked against, so a trunk change
59
+ * re-checks branch by branch and a budget cut part-way loses nothing.
43
60
  *
44
61
  * @param input - Refs, previous state and the send's own clock.
45
- * @param sent - The branches this snapshot actually described.
62
+ * @param sent - The live branches this snapshot described.
63
+ * @param merged - The branches it found already on the trunk.
46
64
  * @returns The state to write.
47
65
  */
48
- export function nextSnapshotState(input, sent) {
66
+ export function nextSnapshotState(input, sent, merged = []) {
49
67
  const sentNames = new Set(sent.map((ref) => ref.name));
68
+ const mergedNames = new Set(merged.map((ref) => ref.name));
50
69
  const branches = {};
51
70
  for (const ref of input.refs) {
52
71
  if (sentNames.has(ref.name)) {
53
- branches[ref.name] = { headSha: ref.headSha, lastSentAt: input.now };
72
+ branches[ref.name] = { headSha: ref.headSha, lastSentAt: input.now, base: input.defaultBranch };
73
+ continue;
74
+ }
75
+ if (mergedNames.has(ref.name)) {
76
+ branches[ref.name] = { headSha: ref.headSha, lastSentAt: input.now, base: input.defaultBranch, merged: true };
54
77
  continue;
55
78
  }
56
79
  const previous = input.stored.branches[ref.name];
80
+ // An entry from before bases were per branch takes the repository's, so
81
+ // the recorded default branch below can move without re-dating it.
57
82
  if (previous)
58
- branches[ref.name] = previous;
83
+ branches[ref.name] = { ...previous, base: entryBase(previous, input.stored) };
59
84
  }
60
- // The recorded base only moves once every branch has been described against
61
- // it. Recording it early would end the `rebased` selection for branches whose
62
- // deltas were never recomputed, and they would sit on the wrong base until
63
- // their heads happened to move.
64
- const described = input.refs.every((ref) => sentNames.has(ref.name));
65
85
  // The tree is the tree flow's to write; a branch send carries it over untouched.
66
86
  return {
67
- defaultBranch: described ? input.defaultBranch : input.stored.defaultBranch,
87
+ defaultBranch: input.defaultBranch,
68
88
  branches,
69
89
  ...(input.stored.tree ? { tree: input.stored.tree } : {})
70
90
  };
71
91
  }
92
+ /**
93
+ * The base an entry was checked against.
94
+ *
95
+ * @param entry - One stored branch.
96
+ * @param stored - Its state, whose default branch an older entry inherits.
97
+ * @returns The base name, or undefined when there was none.
98
+ */
99
+ function entryBase(entry, stored) {
100
+ return entry.base ?? stored.defaultBranch;
101
+ }
@@ -7,13 +7,15 @@ export declare const STAGE_ENQUEUE = "enqueue";
7
7
  /** Reasons a stage ends the flow early. */
8
8
  export declare const STOP_NOT_A_REPOSITORY = "no branches: not a repository, or it has none";
9
9
  export declare const STOP_NOTHING_CHANGED = "no branch moved and none is due a refresh";
10
+ export declare const STOP_ALL_ON_TRUNK = "every checked branch is already on the trunk";
10
11
  export declare const STOP_BUDGET_SPENT = "snapshot budget spent";
11
12
  export declare const STOP_NO_EVENT = "no snapshot event was built";
12
13
  /** The tree flow's stages and stops. */
13
14
  export declare const STAGE_TREE_DUE = "tree-due";
14
15
  export declare const STAGE_TREE_RESOLVE = "tree-resolve";
16
+ export declare const STAGE_TREE_CHANGED = "tree-changed";
15
17
  export declare const STAGE_TREE_COLLECT = "tree-collect";
16
- export declare const STOP_TREE_SENT = "tree already sent for this repository and identity";
18
+ export declare const STOP_TREE_SENT = "trunk tree already sent for this repository and identity";
17
19
  export declare const STOP_TREE_NOT_DUE = "tree attempt failed within the last hour";
18
20
  export declare const STOP_TREE_NO_TRUNK = "no default branch tree to list";
19
21
  export declare const STOP_TREE_UNLISTED = "tree could not be listed";
@@ -7,13 +7,15 @@ export const STAGE_ENQUEUE = 'enqueue';
7
7
  /** Reasons a stage ends the flow early. */
8
8
  export const STOP_NOT_A_REPOSITORY = 'no branches: not a repository, or it has none';
9
9
  export const STOP_NOTHING_CHANGED = 'no branch moved and none is due a refresh';
10
+ export const STOP_ALL_ON_TRUNK = 'every checked branch is already on the trunk';
10
11
  export const STOP_BUDGET_SPENT = 'snapshot budget spent';
11
12
  export const STOP_NO_EVENT = 'no snapshot event was built';
12
13
  /** The tree flow's stages and stops. */
13
14
  export const STAGE_TREE_DUE = 'tree-due';
14
15
  export const STAGE_TREE_RESOLVE = 'tree-resolve';
16
+ export const STAGE_TREE_CHANGED = 'tree-changed';
15
17
  export const STAGE_TREE_COLLECT = 'tree-collect';
16
- export const STOP_TREE_SENT = 'tree already sent for this repository and identity';
18
+ export const STOP_TREE_SENT = 'trunk tree already sent for this repository and identity';
17
19
  export const STOP_TREE_NOT_DUE = 'tree attempt failed within the last hour';
18
20
  export const STOP_TREE_NO_TRUNK = 'no default branch tree to list';
19
21
  export const STOP_TREE_UNLISTED = 'tree could not be listed';
@@ -1,11 +1,37 @@
1
1
  /**
2
- * How many branches one snapshot describes.
2
+ * How many live branches one snapshot describes.
3
3
  *
4
- * The ten most recently committed: enough to cover what anyone is actually
5
- * working on, few enough that the listing is one cheap git process and the
6
- * backend's per-branch transaction count stays bounded.
4
+ * The ten most recently committed that are not already on the trunk: enough to
5
+ * cover what anyone is actually working on, few enough that the backend's
6
+ * per-branch transaction count stays bounded.
7
7
  */
8
8
  export declare const SNAPSHOT_BRANCH_COUNT = 10;
9
+ /**
10
+ * How many branches the listing reads, newest commit first, to find those ten.
11
+ *
12
+ * Merged branches are passed over, so the ten live ones can sit deep: 46 down
13
+ * on agent-watch-core (294 local branches, October 2026). Still one process —
14
+ * all 294 list in ~40 ms — and the bound keeps the state file small.
15
+ */
16
+ export declare const SNAPSHOT_SCAN_COUNT = 100;
17
+ /**
18
+ * How many branches one snapshot may check with git.
19
+ *
20
+ * A check is the delta log plus, when it has commits, a merge-tree and a tree
21
+ * read: ~70 ms on agent-watch-core. Finding its ten live branches from an empty
22
+ * cache took 18 checks (27 more were passed for a gone upstream at no cost); the
23
+ * budget usually ends a first snapshot before this does, and verdicts are
24
+ * remembered, so the next turn continues where it stopped.
25
+ */
26
+ export declare const SNAPSHOT_MAX_CHECKS = 20;
27
+ /**
28
+ * Budget the checks leave for queueing the event and writing the state.
29
+ *
30
+ * Without it a walk that ran to the deadline would queue nothing and record
31
+ * nothing, and on a repository that always needs more than the budget no turn
32
+ * would ever make progress.
33
+ */
34
+ export declare const SNAPSHOT_WRITE_RESERVE_MS = 100;
9
35
  /**
10
36
  * How many of a branch's own commits travel with it.
11
37
  *
@@ -87,8 +113,9 @@ export declare const SNAPSHOT_RE_CONTROL_CHARACTER: RegExp;
87
113
  /** Hex characters kept from the repository digest that names a state file. */
88
114
  export declare const SNAPSHOT_STATE_HASH_LENGTH = 32;
89
115
  /**
90
- * How long a repository whose `repo.tree` attempt failed (no trunk, listing
91
- * failed, budget spent) waits before the next one. The tree is sent once per
92
- * repository and identity; this only bounds the cost of not managing to.
116
+ * How long a repository waits between `repo.tree` checks: after a failed
117
+ * attempt (no trunk, listing failed, budget spent), and between comparisons of
118
+ * the trunk's tree oid with the one already sent. Bounds the git cost to one
119
+ * oid lookup an hour per repository.
93
120
  */
94
121
  export declare const TREE_RETRY_INTERVAL_MS: number;
@@ -1,11 +1,37 @@
1
1
  /**
2
- * How many branches one snapshot describes.
2
+ * How many live branches one snapshot describes.
3
3
  *
4
- * The ten most recently committed: enough to cover what anyone is actually
5
- * working on, few enough that the listing is one cheap git process and the
6
- * backend's per-branch transaction count stays bounded.
4
+ * The ten most recently committed that are not already on the trunk: enough to
5
+ * cover what anyone is actually working on, few enough that the backend's
6
+ * per-branch transaction count stays bounded.
7
7
  */
8
8
  export const SNAPSHOT_BRANCH_COUNT = 10;
9
+ /**
10
+ * How many branches the listing reads, newest commit first, to find those ten.
11
+ *
12
+ * Merged branches are passed over, so the ten live ones can sit deep: 46 down
13
+ * on agent-watch-core (294 local branches, October 2026). Still one process —
14
+ * all 294 list in ~40 ms — and the bound keeps the state file small.
15
+ */
16
+ export const SNAPSHOT_SCAN_COUNT = 100;
17
+ /**
18
+ * How many branches one snapshot may check with git.
19
+ *
20
+ * A check is the delta log plus, when it has commits, a merge-tree and a tree
21
+ * read: ~70 ms on agent-watch-core. Finding its ten live branches from an empty
22
+ * cache took 18 checks (27 more were passed for a gone upstream at no cost); the
23
+ * budget usually ends a first snapshot before this does, and verdicts are
24
+ * remembered, so the next turn continues where it stopped.
25
+ */
26
+ export const SNAPSHOT_MAX_CHECKS = 20;
27
+ /**
28
+ * Budget the checks leave for queueing the event and writing the state.
29
+ *
30
+ * Without it a walk that ran to the deadline would queue nothing and record
31
+ * nothing, and on a repository that always needs more than the budget no turn
32
+ * would ever make progress.
33
+ */
34
+ export const SNAPSHOT_WRITE_RESERVE_MS = 100;
9
35
  /**
10
36
  * How many of a branch's own commits travel with it.
11
37
  *
@@ -88,8 +114,9 @@ export const SNAPSHOT_RE_CONTROL_CHARACTER = /[\x00-\x1f\x7f]/;
88
114
  /** Hex characters kept from the repository digest that names a state file. */
89
115
  export const SNAPSHOT_STATE_HASH_LENGTH = 32;
90
116
  /**
91
- * How long a repository whose `repo.tree` attempt failed (no trunk, listing
92
- * failed, budget spent) waits before the next one. The tree is sent once per
93
- * repository and identity; this only bounds the cost of not managing to.
117
+ * How long a repository waits between `repo.tree` checks: after a failed
118
+ * attempt (no trunk, listing failed, budget spent), and between comparisons of
119
+ * the trunk's tree oid with the one already sent. Bounds the git cost to one
120
+ * oid lookup an hour per repository.
94
121
  */
95
122
  export const TREE_RETRY_INTERVAL_MS = 60 * 60 * 1000;
@@ -8,11 +8,11 @@
8
8
  * of work exists at all.
9
9
  *
10
10
  * The tree flow beside it sends the trunk's source paths and declaration names
11
- * (`repo.tree`) once per repository and identity, for a tenant whose code nothing may clone.
11
+ * (`repo.tree`) per repository and identity, again when the trunk's tree changes, for a tenant whose code nothing may clone.
12
12
  */
13
13
  export type { BuildSnapshotInput, SelectionInput, SnapshotFlowInput, SnapshotFlowState, SnapshotIdentity, SnapshotPipelineInput, SnapshotQueue, SnapshotState, SnapshotStateEntry, SnapshotStateReader } from './types/snapshot.types.js';
14
14
  export { SNAPSHOT_BRANCH_COUNT, SNAPSHOT_BUDGET_MS, SNAPSHOT_COMMITS_PER_BRANCH, SNAPSHOT_REFRESH_MS } from './constants/snapshot.constants.js';
15
- export { nextSnapshotState, selectChangedBranches } from './branch-selection.js';
15
+ export { anyDue, nextSnapshotState, snapshotCandidates } from './branch-selection.js';
16
16
  export { budgetedRunner, remainingMs, withinBudget } from './budget.js';
17
17
  export { buildRepoSnapshot } from './snapshot-event.js';
18
18
  export { runSnapshotPipeline } from './snapshot-pipeline.js';
@@ -1,5 +1,5 @@
1
1
  export { SNAPSHOT_BRANCH_COUNT, SNAPSHOT_BUDGET_MS, SNAPSHOT_COMMITS_PER_BRANCH, SNAPSHOT_REFRESH_MS } from './constants/snapshot.constants.js';
2
- export { nextSnapshotState, selectChangedBranches } from './branch-selection.js';
2
+ export { anyDue, nextSnapshotState, snapshotCandidates } from './branch-selection.js';
3
3
  export { budgetedRunner, remainingMs, withinBudget } from './budget.js';
4
4
  export { buildRepoSnapshot } from './snapshot-event.js';
5
5
  export { runSnapshotPipeline } from './snapshot-pipeline.js';
@@ -2,12 +2,12 @@ import { debugLog } from '../core/logger.js';
2
2
  import { next, runFlow, step, stop } from '../core/pipe.js';
3
3
  import { collectBranchCommits, collectBranchRefs, resolveDefaultBranch } from '../git/repo-snapshot.js';
4
4
  import { sanitizeValue } from '../privacy/sanitizer.js';
5
- import { nextSnapshotState, selectChangedBranches } from './branch-selection.js';
5
+ import { anyDue, nextSnapshotState, snapshotCandidates } from './branch-selection.js';
6
6
  import { budgetedRunner, remainingMs, withinBudget } from './budget.js';
7
7
  import { buildRepoSnapshot } from './snapshot-event.js';
8
8
  import { emptyState } from './snapshot-state.js';
9
- import { SNAPSHOT_BRANCH_COUNT, SNAPSHOT_COMMITS_PER_BRANCH } from './constants/snapshot.constants.js';
10
- import { STAGE_COLLECT_COMMITS, STAGE_COLLECT_REFS, STAGE_ENQUEUE, STAGE_SANITIZE, STAGE_SELECT_CHANGED, STOP_BUDGET_SPENT, STOP_NOTHING_CHANGED, STOP_NO_EVENT, STOP_NOT_A_REPOSITORY } from './constants/snapshot-stages.constants.js';
9
+ import { SNAPSHOT_BRANCH_COUNT, SNAPSHOT_COMMITS_PER_BRANCH, SNAPSHOT_MAX_CHECKS, SNAPSHOT_SCAN_COUNT, SNAPSHOT_WRITE_RESERVE_MS } from './constants/snapshot.constants.js';
10
+ import { STAGE_COLLECT_COMMITS, STAGE_COLLECT_REFS, STAGE_ENQUEUE, STAGE_SANITIZE, STAGE_SELECT_CHANGED, STOP_ALL_ON_TRUNK, STOP_BUDGET_SPENT, STOP_NOTHING_CHANGED, STOP_NO_EVENT, STOP_NOT_A_REPOSITORY } from './constants/snapshot-stages.constants.js';
11
11
  /**
12
12
  * The snapshot flow, as the list of stages it is.
13
13
  *
@@ -43,7 +43,8 @@ export function runSnapshotPipeline(pipeline) {
43
43
  // sequential seconds of the hook's answer if nothing bounds them.
44
44
  run: budgetedRunner(pipeline.input.run, pipeline.input.deadline),
45
45
  refs: [],
46
- selected: [],
46
+ candidates: [],
47
+ merged: [],
47
48
  branches: []
48
49
  };
49
50
  return runFlow(SNAPSHOT_STAGES, initial, (trace) => {
@@ -60,48 +61,103 @@ export function runSnapshotPipeline(pipeline) {
60
61
  */
61
62
  async function collectRefs(state) {
62
63
  const { cwd } = state.input;
63
- const refs = await collectBranchRefs({ cwd, branchCount: SNAPSHOT_BRANCH_COUNT }, state.run);
64
+ const refs = await collectBranchRefs({ cwd, branchCount: SNAPSHOT_SCAN_COUNT, ...(state.input.requiredBranches ? { requiredBranches: state.input.requiredBranches } : {}) }, state.run);
64
65
  if (refs.length === 0)
65
66
  return stop(state, STOP_NOT_A_REPOSITORY);
66
67
  const defaultBranch = await resolveDefaultBranch(cwd, state.run);
67
68
  return next({ ...state, refs, defaultBranch });
68
69
  }
69
70
  /**
70
- * Compare the heads against what was last sent.
71
+ * Compare the heads against what was last recorded.
71
72
  *
72
73
  * @param state - Current flow state.
73
- * @returns The state with its selection, or a stop when nothing is due.
74
+ * @returns The state with its walk, or a stop when nothing in reach is due.
74
75
  */
75
76
  async function selectChanged(state) {
76
77
  const stored = await state.store.read(state.input.repository);
77
- const selected = selectChangedBranches(selectionInput({ ...state, stored }));
78
- if (selected.length === 0)
78
+ const selected = snapshotCandidates(selectionInput({ ...state, stored }));
79
+ const required = new Set(state.input.requiredBranches);
80
+ const candidates = [
81
+ ...state.refs.filter((ref) => required.has(ref.name)).map((ref) => ({ ref, due: true })),
82
+ ...selected.filter(({ ref }) => !required.has(ref.name))
83
+ ];
84
+ if (!anyDue(candidates))
79
85
  return stop({ ...state, stored }, STOP_NOTHING_CHANGED);
80
- return next({ ...state, stored, selected });
86
+ return next({ ...state, stored, candidates });
81
87
  }
82
88
  /**
83
- * The commits each selected branch has that the trunk does not.
89
+ * Walk the branches newest first until ten live ones are in hand.
84
90
  *
85
- * The budget is checked per branch rather than once: the listing is cheap and
86
- * the logs are not, so an overrun stops here with the branches already
87
- * described rather than discarding the work.
91
+ * A branch found already on the trunk does not count toward the ten, so the
92
+ * window fills from the next-newest live branches instead of shrinking. One
93
+ * that was described and has not moved counts without a git process. The walk
94
+ * ends at ten, at {@link SNAPSHOT_MAX_CHECKS} checks, or when the checks have
95
+ * spent all but the reserve the queue write needs; what it did not reach keeps
96
+ * its old entry and is checked on a later turn.
97
+ *
98
+ * A gone upstream is a verdict without a git process, but only for a branch
99
+ * the cache has never recorded: once one is recorded, a moved head or a
100
+ * heartbeat means a real check, so commits made after its pull request merged
101
+ * are seen as the new work they are, on this turn and every later one.
88
102
  *
89
103
  * @param state - Current flow state.
90
- * @returns The state with its branches, or a stop when the budget ran out
91
- * before any branch was described.
104
+ * @returns The state with its live and merged branches, or a stop when the
105
+ * budget ran out before any branch was checked.
92
106
  */
93
107
  async function collectCommits(state) {
94
- const { cwd, deadline } = state.input;
108
+ const checkDeadline = state.input.deadline - SNAPSHOT_WRITE_RESERVE_MS;
109
+ const run = budgetedRunner(state.run, checkDeadline);
110
+ const merged = [];
95
111
  const branches = [];
96
- for (const ref of state.selected) {
97
- if (remainingMs(deadline) === 0)
112
+ let live = 0;
113
+ let checks = 0;
114
+ for (const { ref, due } of state.candidates) {
115
+ if (live >= SNAPSHOT_BRANCH_COUNT)
116
+ break;
117
+ if (!due) {
118
+ live += 1;
119
+ continue;
120
+ }
121
+ if (!state.input.requiredBranches?.includes(ref.name) && ref.upstreamGone && !state.stored?.branches[ref.name]) {
122
+ merged.push(ref);
123
+ continue;
124
+ }
125
+ if (checks >= SNAPSHOT_MAX_CHECKS || remainingMs(checkDeadline) === 0)
98
126
  break;
99
- const commits = await collectBranchCommits(ref.name, { cwd, defaultBranch: state.defaultBranch, commitCount: SNAPSHOT_COMMITS_PER_BRANCH, withFiles: state.input.files }, state.run);
127
+ checks += 1;
128
+ const commits = await checkBranch(ref, state, run);
129
+ // A check the budget cut short is unknown, not live: its merge test may
130
+ // have been the call that was skipped, and failing open there would send
131
+ // a merged branch.
132
+ if (remainingMs(checkDeadline) === 0)
133
+ break;
134
+ if (!commits) {
135
+ merged.push(ref);
136
+ continue;
137
+ }
138
+ live += 1;
100
139
  branches.push({ ...ref, commits });
101
140
  }
102
- if (branches.length === 0)
141
+ if (merged.length === 0 && branches.length === 0)
103
142
  return stop(state, STOP_BUDGET_SPENT);
104
- return next({ ...state, branches });
143
+ return next({ ...state, merged, branches });
144
+ }
145
+ /**
146
+ * One branch's delta, or undefined when its work is already on the trunk.
147
+ *
148
+ * @param ref - The branch.
149
+ * @param state - Current flow state.
150
+ * @param run - The checks' budgeted runner.
151
+ * @returns What {@link collectBranchCommits} says.
152
+ */
153
+ function checkBranch(ref, state, run) {
154
+ return collectBranchCommits(ref.name, {
155
+ cwd: state.input.cwd,
156
+ defaultBranch: state.defaultBranch,
157
+ commitCount: SNAPSHOT_COMMITS_PER_BRANCH,
158
+ withFiles: state.input.files,
159
+ includeMerged: state.input.requiredBranches?.includes(ref.name)
160
+ }, run);
105
161
  }
106
162
  /**
107
163
  * Build the event and put it through the same scrubber prompt text gets.
@@ -114,6 +170,8 @@ async function collectCommits(state) {
114
170
  * @returns The state carrying the event to send.
115
171
  */
116
172
  async function sanitize(state) {
173
+ if (state.branches.length === 0)
174
+ return next(state);
117
175
  const event = buildRepoSnapshot({
118
176
  identity: state.input,
119
177
  defaultBranch: state.defaultBranch,
@@ -122,27 +180,43 @@ async function sanitize(state) {
122
180
  return next({ ...state, event: sanitizeValue(event) });
123
181
  }
124
182
  /**
125
- * Queue the event, then record what was sent.
183
+ * Queue the event, then record what was checked.
126
184
  *
127
185
  * The cache is written only after the queue accepted the event. Written first,
128
186
  * a failed enqueue would mark the branches as reported and nothing would ever
129
187
  * offer them again.
130
188
  *
189
+ * Branches already on the trunk are recorded too, as merged, with nothing
190
+ * queued when they are all there is: otherwise every turn would check them
191
+ * again. Their heads are what is recorded, so new commits select them again.
192
+ *
131
193
  * @param state - Current flow state.
132
194
  * @returns The state, unchanged.
133
195
  */
134
196
  async function enqueue(state) {
197
+ if (state.branches.length === 0) {
198
+ await record(state);
199
+ return stop(state, STOP_ALL_ON_TRUNK);
200
+ }
135
201
  if (!state.event)
136
202
  return stop(state, STOP_NO_EVENT);
137
- const { deadline } = state.input;
138
- const queued = await withinBudget(state.queue.enqueue([state.event]), deadline);
203
+ const queued = await withinBudget(state.queue.enqueue([state.event]), state.input.deadline);
139
204
  // Recording a send that may not have happened is the one thing this flow must
140
205
  // never do: the branches would be marked reported and never offered again.
141
206
  if (!queued)
142
207
  return stop(state, STOP_BUDGET_SPENT);
143
- await withinBudget(state.store.write(state.input.repository, nextSnapshotState(selectionInput(state), state.branches)), deadline);
208
+ await record(state);
144
209
  return next(state);
145
210
  }
211
+ /**
212
+ * Write the checked branches to the cache, within the budget.
213
+ *
214
+ * @param state - Current flow state.
215
+ * @returns Nothing; an abandoned write only means the branches are offered again.
216
+ */
217
+ async function record(state) {
218
+ await withinBudget(state.store.write(state.input.repository, nextSnapshotState(selectionInput(state), state.branches, state.merged)), state.input.deadline);
219
+ }
146
220
  /**
147
221
  * The selection's view of this flow.
148
222
  *
@@ -86,7 +86,9 @@ function readEntries(value) {
86
86
  continue;
87
87
  entries[name] = {
88
88
  headSha: entry.headSha,
89
- lastSentAt: typeof entry.lastSentAt === 'number' ? entry.lastSentAt : 0
89
+ lastSentAt: typeof entry.lastSentAt === 'number' ? entry.lastSentAt : 0,
90
+ ...(typeof entry.base === 'string' ? { base: entry.base } : {}),
91
+ ...(entry.merged === true ? { merged: true } : {})
90
92
  };
91
93
  }
92
94
  return entries;
@@ -105,7 +107,9 @@ function readTree(value) {
105
107
  sha: typeof record.sha === 'string' ? record.sha : undefined,
106
108
  sentAt: typeof record.sentAt === 'number' ? record.sentAt : undefined,
107
109
  sentFor: typeof record.sentFor === 'string' ? record.sentFor : undefined,
108
- triedAt: typeof record.triedAt === 'number' ? record.triedAt : undefined
110
+ checkedAt: typeof record.checkedAt === 'number' ? record.checkedAt : undefined,
111
+ triedAt: typeof record.triedAt === 'number' ? record.triedAt : undefined,
112
+ triedFor: typeof record.triedFor === 'string' ? record.triedFor : undefined
109
113
  };
110
114
  }
111
115
  /**
@@ -1,7 +1,7 @@
1
1
  import type { FlowResult } from '../core/types/core.types.js';
2
2
  import type { TreeFlowState, TreePipelineInput } from './types/snapshot.types.js';
3
3
  /**
4
- * Send the default branch's source paths and declaration names, once per repository and identity.
4
+ * Send the default branch's source paths and declaration names, and again whenever the trunk's tree changes.
5
5
  *
6
6
  * Shares the snapshot's deadline and never outlives it: an overrun stops
7
7
  * without recording anything, so the next turn tries again. Never throws.