@reticlehq/server 2.2.0 → 2.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.
Files changed (768) hide show
  1. package/README.md +1 -1
  2. package/dist/bridge-security.d.ts +0 -1
  3. package/dist/bridge-security.js +0 -1
  4. package/dist/bridge.d.ts +0 -1
  5. package/dist/bridge.js +60 -10
  6. package/dist/bridge.test-harness.d.ts +0 -1
  7. package/dist/bridge.test-harness.js +0 -1
  8. package/dist/capsule/capsule-store.d.ts +2 -3
  9. package/dist/capsule/capsule-store.js +0 -1
  10. package/dist/capsule/capsule.d.ts +0 -1
  11. package/dist/capsule/capsule.js +0 -1
  12. package/dist/capsule/causal-summary.d.ts +21 -1
  13. package/dist/capsule/causal-summary.js +20 -2
  14. package/dist/capsule/divergence.d.ts +0 -1
  15. package/dist/capsule/divergence.js +0 -1
  16. package/dist/capsule/minimize.d.ts +0 -1
  17. package/dist/capsule/minimize.js +0 -1
  18. package/dist/capsule/predicate-to-links.d.ts +0 -1
  19. package/dist/capsule/predicate-to-links.js +0 -1
  20. package/dist/cli-doctor.d.ts +6 -0
  21. package/dist/cli-doctor.js +60 -0
  22. package/dist/cli-flow-commands.d.ts +0 -1
  23. package/dist/cli-flow-commands.js +0 -1
  24. package/dist/cli-launch.d.ts +0 -1
  25. package/dist/cli-launch.js +7 -3
  26. package/dist/cli-parse.d.ts +52 -2
  27. package/dist/cli-parse.js +147 -3
  28. package/dist/cli-port.d.ts +0 -1
  29. package/dist/cli-port.js +0 -1
  30. package/dist/cli-verify.d.ts +2 -1
  31. package/dist/cli-verify.js +24 -3
  32. package/dist/cli.d.ts +2 -4
  33. package/dist/cli.js +109 -10
  34. package/dist/cloud/cloud-config.d.ts +36 -0
  35. package/dist/cloud/cloud-config.js +86 -0
  36. package/dist/cloud/cloud-sync.d.ts +96 -4
  37. package/dist/cloud/cloud-sync.js +131 -3
  38. package/dist/cloud-cli.d.ts +3 -0
  39. package/dist/cloud-cli.js +514 -0
  40. package/dist/crawl/crawl-tools.d.ts +0 -1
  41. package/dist/crawl/crawl-tools.js +1 -2
  42. package/dist/crawl/crawl.d.ts +17 -3
  43. package/dist/crawl/crawl.js +43 -4
  44. package/dist/daemon-resilience.d.ts +6 -1
  45. package/dist/daemon-resilience.js +63 -1
  46. package/dist/daemon.d.ts +23 -3
  47. package/dist/daemon.js +78 -21
  48. package/dist/domain/domain-model.d.ts +0 -1
  49. package/dist/domain/domain-model.js +1 -2
  50. package/dist/domain/domain-tools.d.ts +0 -7
  51. package/dist/domain/domain-tools.js +21 -4
  52. package/dist/domain/flow-risk.d.ts +0 -1
  53. package/dist/domain/flow-risk.js +0 -1
  54. package/dist/ee/audit-log.d.ts +0 -1
  55. package/dist/ee/audit-log.js +0 -1
  56. package/dist/events/body-failures.d.ts +4 -0
  57. package/dist/events/body-failures.js +113 -0
  58. package/dist/events/contradictions.d.ts +53 -0
  59. package/dist/events/contradictions.js +282 -0
  60. package/dist/events/echo-mismatch.d.ts +4 -0
  61. package/dist/events/echo-mismatch.js +138 -0
  62. package/dist/events/event-filters.d.ts +17 -3
  63. package/dist/events/event-filters.js +13 -3
  64. package/dist/events/json-salvage.d.ts +32 -0
  65. package/dist/events/json-salvage.js +96 -0
  66. package/dist/events/predicate-eval.d.ts +2 -1
  67. package/dist/events/predicate-eval.js +56 -9
  68. package/dist/events/predicate.d.ts +0 -1
  69. package/dist/events/predicate.js +56 -2
  70. package/dist/events/reaction.d.ts +0 -1
  71. package/dist/events/reaction.js +0 -1
  72. package/dist/events/reconcile.d.ts +39 -0
  73. package/dist/events/reconcile.js +211 -0
  74. package/dist/events/ring-buffer.d.ts +0 -1
  75. package/dist/events/ring-buffer.js +0 -1
  76. package/dist/events/stale-response.d.ts +4 -0
  77. package/dist/events/stale-response.js +139 -0
  78. package/dist/events/unit-mismatch.d.ts +16 -0
  79. package/dist/events/unit-mismatch.js +167 -0
  80. package/dist/flows/affected-tools.d.ts +18 -0
  81. package/dist/flows/affected-tools.js +52 -0
  82. package/dist/flows/affected.d.ts +0 -1
  83. package/dist/flows/affected.js +0 -1
  84. package/dist/flows/annotate-tools.d.ts +0 -1
  85. package/dist/flows/annotate-tools.js +21 -3
  86. package/dist/flows/annotate.d.ts +0 -1
  87. package/dist/flows/annotate.js +0 -1
  88. package/dist/flows/annotation-store.d.ts +0 -1
  89. package/dist/flows/annotation-store.js +0 -1
  90. package/dist/flows/assertion-integrity.d.ts +0 -1
  91. package/dist/flows/assertion-integrity.js +0 -1
  92. package/dist/flows/assertion-tiers-store.d.ts +0 -1
  93. package/dist/flows/assertion-tiers-store.js +0 -1
  94. package/dist/flows/buddy-status.d.ts +0 -1
  95. package/dist/flows/buddy-status.js +0 -1
  96. package/dist/flows/coverage.d.ts +0 -1
  97. package/dist/flows/coverage.js +0 -1
  98. package/dist/flows/decision.d.ts +0 -1
  99. package/dist/flows/decision.js +0 -1
  100. package/dist/flows/flake-store.d.ts +0 -1
  101. package/dist/flows/flake-store.js +0 -1
  102. package/dist/flows/flake.d.ts +0 -1
  103. package/dist/flows/flake.js +0 -1
  104. package/dist/flows/flow-classify.d.ts +0 -1
  105. package/dist/flows/flow-classify.js +0 -1
  106. package/dist/flows/flow-replay-run.d.ts +0 -1
  107. package/dist/flows/flow-replay-run.js +24 -8
  108. package/dist/flows/flow-replay.d.ts +20 -4
  109. package/dist/flows/flow-replay.js +9 -43
  110. package/dist/flows/flow-report.d.ts +0 -1
  111. package/dist/flows/flow-report.js +0 -1
  112. package/dist/flows/flow-scope.d.ts +0 -1
  113. package/dist/flows/flow-scope.js +0 -1
  114. package/dist/flows/flow-sources.d.ts +0 -1
  115. package/dist/flows/flow-sources.js +0 -1
  116. package/dist/flows/flow-step-runners.d.ts +23 -0
  117. package/dist/flows/flow-step-runners.js +102 -0
  118. package/dist/flows/flow-success.d.ts +0 -1
  119. package/dist/flows/flow-success.js +0 -1
  120. package/dist/flows/flow-tools.d.ts +0 -1
  121. package/dist/flows/flow-tools.js +54 -16
  122. package/dist/flows/flows.d.ts +6 -2
  123. package/dist/flows/flows.js +15 -2
  124. package/dist/flows/gate.d.ts +0 -1
  125. package/dist/flows/gate.js +0 -1
  126. package/dist/flows/git-changed.d.ts +0 -1
  127. package/dist/flows/git-changed.js +0 -1
  128. package/dist/flows/heal-run.d.ts +0 -1
  129. package/dist/flows/heal-run.js +0 -1
  130. package/dist/flows/heal.d.ts +0 -1
  131. package/dist/flows/heal.js +0 -1
  132. package/dist/flows/parallel-suite.d.ts +0 -1
  133. package/dist/flows/parallel-suite.js +0 -1
  134. package/dist/flows/recordings.d.ts +0 -1
  135. package/dist/flows/recordings.js +0 -1
  136. package/dist/flows/replay.d.ts +0 -1
  137. package/dist/flows/replay.js +71 -4
  138. package/dist/flows/server-verify.d.ts +15 -0
  139. package/dist/flows/server-verify.js +42 -0
  140. package/dist/flows/verify-change-tools.d.ts +2 -0
  141. package/dist/flows/verify-change-tools.js +187 -0
  142. package/dist/flows/watch-batcher.d.ts +0 -1
  143. package/dist/flows/watch-batcher.js +0 -1
  144. package/dist/honesty/accepted-write.d.ts +14 -0
  145. package/dist/honesty/accepted-write.js +17 -0
  146. package/dist/honesty/blind-spots.d.ts +18 -1
  147. package/dist/honesty/blind-spots.js +47 -5
  148. package/dist/honesty/honesty.d.ts +0 -1
  149. package/dist/honesty/honesty.js +0 -1
  150. package/dist/honesty/uncaptured-bodies.d.ts +19 -0
  151. package/dist/honesty/uncaptured-bodies.js +30 -0
  152. package/dist/honesty/unread-outcome.d.ts +2 -0
  153. package/dist/honesty/unread-outcome.js +50 -0
  154. package/dist/honesty/verified.d.ts +40 -0
  155. package/dist/honesty/verified.js +86 -0
  156. package/dist/http-server.d.ts +0 -1
  157. package/dist/http-server.js +5 -1
  158. package/dist/hunt/hunt-report.d.ts +50 -0
  159. package/dist/hunt/hunt-report.js +84 -0
  160. package/dist/idle-shutdown.d.ts +0 -1
  161. package/dist/idle-shutdown.js +0 -1
  162. package/dist/index.d.ts +0 -1
  163. package/dist/index.js +0 -1
  164. package/dist/init/agent-rules.d.ts +0 -1
  165. package/dist/init/agent-rules.js +4 -2
  166. package/dist/init/cursor.d.ts +0 -1
  167. package/dist/init/cursor.js +0 -1
  168. package/dist/init/desktop-doctor.d.ts +40 -0
  169. package/dist/init/desktop-doctor.js +198 -0
  170. package/dist/init/detect.d.ts +0 -1
  171. package/dist/init/detect.js +0 -1
  172. package/dist/init/mcp.d.ts +0 -1
  173. package/dist/init/mcp.js +0 -1
  174. package/dist/init/node-io.d.ts +0 -1
  175. package/dist/init/node-io.js +0 -1
  176. package/dist/init/plan.d.ts +4 -1
  177. package/dist/init/plan.js +23 -5
  178. package/dist/init/project-id.d.ts +0 -1
  179. package/dist/init/project-id.js +0 -1
  180. package/dist/init/run.d.ts +0 -1
  181. package/dist/init/run.js +31 -3
  182. package/dist/init/snippets.d.ts +5 -1
  183. package/dist/init/snippets.js +5 -1
  184. package/dist/init/vite-config.d.ts +0 -1
  185. package/dist/init/vite-config.js +0 -1
  186. package/dist/input/network-detail.d.ts +0 -1
  187. package/dist/input/network-detail.js +0 -1
  188. package/dist/input/network-mock-tools.d.ts +0 -1
  189. package/dist/input/network-mock-tools.js +3 -4
  190. package/dist/input/network-mock.d.ts +0 -1
  191. package/dist/input/network-mock.js +0 -1
  192. package/dist/input/real-input.d.ts +14 -1
  193. package/dist/input/real-input.js +45 -3
  194. package/dist/input/scroll-find.d.ts +0 -1
  195. package/dist/input/scroll-find.js +0 -1
  196. package/dist/input/scroll-tools.d.ts +0 -1
  197. package/dist/input/scroll-tools.js +0 -1
  198. package/dist/input/viewport-tools.d.ts +0 -1
  199. package/dist/input/viewport-tools.js +3 -4
  200. package/dist/journal/ambient-store.d.ts +0 -1
  201. package/dist/journal/ambient-store.js +0 -1
  202. package/dist/journal/ambient.d.ts +0 -1
  203. package/dist/journal/ambient.js +0 -1
  204. package/dist/journal/attach-journal.d.ts +0 -1
  205. package/dist/journal/attach-journal.js +0 -1
  206. package/dist/journal/deviation-report.d.ts +0 -1
  207. package/dist/journal/deviation-report.js +0 -1
  208. package/dist/journal/deviation-service.d.ts +0 -1
  209. package/dist/journal/deviation-service.js +0 -1
  210. package/dist/journal/envelope-store.d.ts +0 -1
  211. package/dist/journal/envelope-store.js +0 -1
  212. package/dist/journal/envelope.d.ts +8 -9
  213. package/dist/journal/envelope.js +0 -1
  214. package/dist/journal/journal-query.d.ts +0 -1
  215. package/dist/journal/journal-query.js +0 -1
  216. package/dist/journal/journal-recorder.d.ts +0 -1
  217. package/dist/journal/journal-recorder.js +0 -1
  218. package/dist/journal/retention.d.ts +0 -1
  219. package/dist/journal/retention.js +0 -1
  220. package/dist/journal/rollups.d.ts +0 -1
  221. package/dist/journal/rollups.js +0 -1
  222. package/dist/journal/session-end.d.ts +0 -1
  223. package/dist/journal/session-end.js +0 -1
  224. package/dist/journal/session-journal.d.ts +0 -1
  225. package/dist/journal/session-journal.js +0 -1
  226. package/dist/license/license.d.ts +0 -1
  227. package/dist/license/license.js +0 -1
  228. package/dist/log.d.ts +0 -1
  229. package/dist/log.js +0 -1
  230. package/dist/mcp-proxy.d.ts +0 -1
  231. package/dist/mcp-proxy.js +0 -1
  232. package/dist/mcp.d.ts +15 -1
  233. package/dist/mcp.js +145 -17
  234. package/dist/oracles/flow-instrument-gaps.d.ts +0 -1
  235. package/dist/oracles/flow-instrument-gaps.js +0 -1
  236. package/dist/oracles/propose-consequences.d.ts +0 -1
  237. package/dist/oracles/propose-consequences.js +0 -1
  238. package/dist/oracles/self-instrument.d.ts +0 -1
  239. package/dist/oracles/self-instrument.js +0 -1
  240. package/dist/pairing-token.d.ts +0 -1
  241. package/dist/pairing-token.js +0 -1
  242. package/dist/phenomena/phenomena.d.ts +0 -1
  243. package/dist/phenomena/phenomena.js +0 -1
  244. package/dist/pool/browser-pool.d.ts +0 -1
  245. package/dist/pool/browser-pool.js +0 -1
  246. package/dist/pool/lease-reaper.d.ts +0 -1
  247. package/dist/pool/lease-reaper.js +0 -1
  248. package/dist/pool/playwright-launcher.d.ts +2 -1
  249. package/dist/pool/playwright-launcher.js +22 -2
  250. package/dist/project/baselines.d.ts +0 -1
  251. package/dist/project/baselines.js +5 -4
  252. package/dist/project/file-lock.d.ts +2 -1
  253. package/dist/project/file-lock.js +12 -2
  254. package/dist/project/fs-port.d.ts +0 -1
  255. package/dist/project/fs-port.js +0 -1
  256. package/dist/project/project-store.d.ts +0 -1
  257. package/dist/project/project-store.js +20 -9
  258. package/dist/project/project-tools.d.ts +0 -1
  259. package/dist/project/project-tools.js +57 -9
  260. package/dist/project/reticle-dir.d.ts +0 -1
  261. package/dist/project/reticle-dir.js +0 -1
  262. package/dist/runs/build-verification-run.d.ts +0 -1
  263. package/dist/runs/build-verification-run.js +0 -1
  264. package/dist/runs/profile-redact.d.ts +0 -1
  265. package/dist/runs/profile-redact.js +0 -1
  266. package/dist/runs/render-report.d.ts +0 -1
  267. package/dist/runs/render-report.js +0 -1
  268. package/dist/runs/repair-prompt.d.ts +0 -1
  269. package/dist/runs/repair-prompt.js +0 -1
  270. package/dist/runs/replay-mapping.d.ts +0 -1
  271. package/dist/runs/replay-mapping.js +0 -1
  272. package/dist/runs/reticle-runner.d.ts +0 -1
  273. package/dist/runs/reticle-runner.js +4 -2
  274. package/dist/runs/risk-classify.d.ts +0 -1
  275. package/dist/runs/risk-classify.js +0 -1
  276. package/dist/runs/run-diff.d.ts +0 -1
  277. package/dist/runs/run-diff.js +0 -1
  278. package/dist/runs/run-store.d.ts +0 -1
  279. package/dist/runs/run-store.js +0 -1
  280. package/dist/runs/run-tools.d.ts +0 -1
  281. package/dist/runs/run-tools.js +0 -1
  282. package/dist/runs/runner-port.d.ts +0 -1
  283. package/dist/runs/runner-port.js +0 -1
  284. package/dist/runs/verification-sync.d.ts +23 -0
  285. package/dist/runs/verification-sync.js +66 -0
  286. package/dist/runs/verify-http.d.ts +0 -1
  287. package/dist/runs/verify-http.js +0 -1
  288. package/dist/runs/verify-server.d.ts +0 -1
  289. package/dist/runs/verify-server.js +0 -1
  290. package/dist/server-version.d.ts +0 -1
  291. package/dist/server-version.js +0 -1
  292. package/dist/session/command-timeout.d.ts +35 -0
  293. package/dist/session/command-timeout.js +41 -0
  294. package/dist/session/control-envelope.d.ts +2 -3
  295. package/dist/session/control-envelope.js +2 -3
  296. package/dist/session/last-act.d.ts +31 -0
  297. package/dist/session/last-act.js +24 -0
  298. package/dist/session/live-control-tools.d.ts +0 -1
  299. package/dist/session/live-control-tools.js +3 -4
  300. package/dist/session/live-control.d.ts +0 -1
  301. package/dist/session/live-control.js +0 -1
  302. package/dist/session/observed-state.d.ts +12 -2
  303. package/dist/session/observed-state.js +29 -2
  304. package/dist/session/output-budget.d.ts +0 -1
  305. package/dist/session/output-budget.js +0 -1
  306. package/dist/session/pending-commands.d.ts +12 -0
  307. package/dist/session/pending-commands.js +36 -0
  308. package/dist/session/presenter-args.d.ts +0 -1
  309. package/dist/session/presenter-args.js +0 -1
  310. package/dist/session/review-store.d.ts +0 -1
  311. package/dist/session/review-store.js +0 -1
  312. package/dist/session/session-health.d.ts +26 -2
  313. package/dist/session/session-health.js +13 -1
  314. package/dist/session/session-info.d.ts +29 -0
  315. package/dist/session/session-info.js +1 -0
  316. package/dist/session/session-lease.d.ts +25 -0
  317. package/dist/session/session-lease.js +14 -0
  318. package/dist/session/session-manager.d.ts +7 -19
  319. package/dist/session/session-manager.js +29 -2
  320. package/dist/session/session-readiness.d.ts +0 -1
  321. package/dist/session/session-readiness.js +3 -4
  322. package/dist/session/session-reaper.d.ts +0 -1
  323. package/dist/session/session-reaper.js +0 -1
  324. package/dist/session/session-recommendation.d.ts +0 -1
  325. package/dist/session/session-recommendation.js +0 -1
  326. package/dist/session/session-tools.d.ts +0 -1
  327. package/dist/session/session-tools.js +2 -3
  328. package/dist/session/session.d.ts +27 -53
  329. package/dist/session/session.js +95 -66
  330. package/dist/session/state-select.d.ts +0 -1
  331. package/dist/session/state-select.js +0 -1
  332. package/dist/telemetry/argument-shape.d.ts +41 -0
  333. package/dist/telemetry/argument-shape.js +87 -0
  334. package/dist/telemetry/bug-found.d.ts +33 -0
  335. package/dist/telemetry/bug-found.js +95 -0
  336. package/dist/telemetry/cli-telemetry.d.ts +13 -0
  337. package/dist/telemetry/cli-telemetry.js +43 -0
  338. package/dist/telemetry/connect-failure.d.ts +16 -0
  339. package/dist/telemetry/connect-failure.js +44 -0
  340. package/dist/telemetry/daemon-telemetry.d.ts +19 -0
  341. package/dist/telemetry/daemon-telemetry.js +76 -0
  342. package/dist/telemetry/dev-repo.d.ts +10 -0
  343. package/dist/telemetry/dev-repo.js +80 -0
  344. package/dist/telemetry/error-fingerprint.d.ts +24 -0
  345. package/dist/telemetry/error-fingerprint.js +88 -0
  346. package/dist/telemetry/feedback-cli.d.ts +31 -0
  347. package/dist/telemetry/feedback-cli.js +102 -0
  348. package/dist/telemetry/feedback-context.d.ts +32 -0
  349. package/dist/telemetry/feedback-context.js +143 -0
  350. package/dist/telemetry/feedback.d.ts +66 -0
  351. package/dist/telemetry/feedback.js +175 -0
  352. package/dist/telemetry/git-facts.d.ts +21 -0
  353. package/dist/telemetry/git-facts.js +109 -0
  354. package/dist/telemetry/identify.d.ts +22 -0
  355. package/dist/telemetry/identify.js +73 -0
  356. package/dist/telemetry/init-telemetry.d.ts +26 -0
  357. package/dist/telemetry/init-telemetry.js +33 -0
  358. package/dist/telemetry/machine-snapshot.d.ts +6 -0
  359. package/dist/telemetry/machine-snapshot.js +39 -0
  360. package/dist/telemetry/mcp-connection.d.ts +5 -0
  361. package/dist/telemetry/mcp-connection.js +44 -0
  362. package/dist/telemetry/project-profile.d.ts +44 -0
  363. package/dist/telemetry/project-profile.js +205 -0
  364. package/dist/telemetry/run-telemetry.d.ts +21 -0
  365. package/dist/telemetry/run-telemetry.js +62 -0
  366. package/dist/telemetry/session-metrics.d.ts +103 -0
  367. package/dist/telemetry/session-metrics.js +329 -0
  368. package/dist/telemetry/telemetry.d.ts +68 -0
  369. package/dist/telemetry/telemetry.js +313 -0
  370. package/dist/token-auth.d.ts +0 -1
  371. package/dist/token-auth.js +0 -1
  372. package/dist/tools/act-capsule.d.ts +23 -0
  373. package/dist/tools/act-capsule.js +47 -0
  374. package/dist/tools/act-danger.d.ts +7 -0
  375. package/dist/tools/act-danger.js +44 -0
  376. package/dist/tools/act-helpers.d.ts +17 -0
  377. package/dist/tools/act-helpers.js +40 -0
  378. package/dist/tools/act-tools.d.ts +8 -1
  379. package/dist/tools/act-tools.js +96 -98
  380. package/dist/tools/act-view.d.ts +7 -1
  381. package/dist/tools/act-view.js +13 -1
  382. package/dist/tools/assert-grade.d.ts +22 -1
  383. package/dist/tools/assert-grade.js +46 -1
  384. package/dist/tools/assert-verdict.d.ts +21 -0
  385. package/dist/tools/assert-verdict.js +62 -0
  386. package/dist/tools/browser-tools.d.ts +0 -1
  387. package/dist/tools/browser-tools.js +2 -2
  388. package/dist/tools/contract-tools.d.ts +0 -1
  389. package/dist/tools/contract-tools.js +0 -1
  390. package/dist/tools/coverage-tools.d.ts +9 -0
  391. package/dist/tools/coverage-tools.js +92 -0
  392. package/dist/tools/dynamic-tools.d.ts +0 -1
  393. package/dist/tools/dynamic-tools.js +21 -2
  394. package/dist/tools/error-recovery.d.ts +18 -2
  395. package/dist/tools/error-recovery.js +42 -7
  396. package/dist/tools/feedback-tools.d.ts +24 -0
  397. package/dist/tools/feedback-tools.js +180 -0
  398. package/dist/tools/invoke-tool.d.ts +0 -1
  399. package/dist/tools/invoke-tool.js +116 -2
  400. package/dist/tools/lease-tools.d.ts +0 -1
  401. package/dist/tools/lease-tools.js +6 -5
  402. package/dist/tools/merge-tools.d.ts +0 -1
  403. package/dist/tools/merge-tools.js +0 -1
  404. package/dist/tools/observe-tools.d.ts +0 -1
  405. package/dist/tools/observe-tools.js +91 -39
  406. package/dist/tools/profiles.d.ts +1 -2
  407. package/dist/tools/profiles.js +43 -16
  408. package/dist/tools/query-paginate.d.ts +0 -1
  409. package/dist/tools/query-paginate.js +0 -1
  410. package/dist/tools/read-tools.d.ts +0 -1
  411. package/dist/tools/read-tools.js +10 -8
  412. package/dist/tools/reconcile-tools.d.ts +2 -0
  413. package/dist/tools/reconcile-tools.js +111 -0
  414. package/dist/tools/snapshot-delta.d.ts +0 -1
  415. package/dist/tools/snapshot-delta.js +0 -0
  416. package/dist/tools/tool-invoker.d.ts +0 -1
  417. package/dist/tools/tool-invoker.js +0 -1
  418. package/dist/tools/tool-kit.d.ts +16 -1
  419. package/dist/tools/tool-kit.js +8 -2
  420. package/dist/tools/tool-names.d.ts +6 -1
  421. package/dist/tools/tool-names.js +6 -1
  422. package/dist/tools/tools-helpers.d.ts +0 -1
  423. package/dist/tools/tools-helpers.js +0 -1
  424. package/dist/tools/tools.d.ts +0 -1
  425. package/dist/tools/tools.js +24 -4
  426. package/dist/update/update-checker.d.ts +0 -1
  427. package/dist/update/update-checker.js +26 -2
  428. package/dist/update/update-nudge.d.ts +20 -0
  429. package/dist/update/update-nudge.js +72 -0
  430. package/dist/update/updater.d.ts +14 -1
  431. package/dist/update/updater.js +33 -2
  432. package/dist/visual/visual-diff.d.ts +0 -1
  433. package/dist/visual/visual-diff.js +0 -1
  434. package/dist/visual/visual-store.d.ts +0 -1
  435. package/dist/visual/visual-store.js +0 -1
  436. package/dist/visual/visual-tools.d.ts +0 -1
  437. package/dist/visual/visual-tools.js +103 -16
  438. package/package.json +2 -2
  439. package/dist/bridge-security.d.ts.map +0 -1
  440. package/dist/bridge-security.js.map +0 -1
  441. package/dist/bridge.d.ts.map +0 -1
  442. package/dist/bridge.js.map +0 -1
  443. package/dist/bridge.test-harness.d.ts.map +0 -1
  444. package/dist/bridge.test-harness.js.map +0 -1
  445. package/dist/capsule/capsule-store.d.ts.map +0 -1
  446. package/dist/capsule/capsule-store.js.map +0 -1
  447. package/dist/capsule/capsule.d.ts.map +0 -1
  448. package/dist/capsule/capsule.js.map +0 -1
  449. package/dist/capsule/causal-summary.d.ts.map +0 -1
  450. package/dist/capsule/causal-summary.js.map +0 -1
  451. package/dist/capsule/divergence.d.ts.map +0 -1
  452. package/dist/capsule/divergence.js.map +0 -1
  453. package/dist/capsule/minimize.d.ts.map +0 -1
  454. package/dist/capsule/minimize.js.map +0 -1
  455. package/dist/capsule/predicate-to-links.d.ts.map +0 -1
  456. package/dist/capsule/predicate-to-links.js.map +0 -1
  457. package/dist/cli-flow-commands.d.ts.map +0 -1
  458. package/dist/cli-flow-commands.js.map +0 -1
  459. package/dist/cli-launch.d.ts.map +0 -1
  460. package/dist/cli-launch.js.map +0 -1
  461. package/dist/cli-parse.d.ts.map +0 -1
  462. package/dist/cli-parse.js.map +0 -1
  463. package/dist/cli-port.d.ts.map +0 -1
  464. package/dist/cli-port.js.map +0 -1
  465. package/dist/cli-verify.d.ts.map +0 -1
  466. package/dist/cli-verify.js.map +0 -1
  467. package/dist/cli.d.ts.map +0 -1
  468. package/dist/cli.js.map +0 -1
  469. package/dist/cloud/cloud-sync.d.ts.map +0 -1
  470. package/dist/cloud/cloud-sync.js.map +0 -1
  471. package/dist/crawl/crawl-tools.d.ts.map +0 -1
  472. package/dist/crawl/crawl-tools.js.map +0 -1
  473. package/dist/crawl/crawl.d.ts.map +0 -1
  474. package/dist/crawl/crawl.js.map +0 -1
  475. package/dist/daemon-resilience.d.ts.map +0 -1
  476. package/dist/daemon-resilience.js.map +0 -1
  477. package/dist/daemon.d.ts.map +0 -1
  478. package/dist/daemon.js.map +0 -1
  479. package/dist/domain/domain-model.d.ts.map +0 -1
  480. package/dist/domain/domain-model.js.map +0 -1
  481. package/dist/domain/domain-tools.d.ts.map +0 -1
  482. package/dist/domain/domain-tools.js.map +0 -1
  483. package/dist/domain/flow-risk.d.ts.map +0 -1
  484. package/dist/domain/flow-risk.js.map +0 -1
  485. package/dist/ee/audit-log.d.ts.map +0 -1
  486. package/dist/ee/audit-log.js.map +0 -1
  487. package/dist/events/event-filters.d.ts.map +0 -1
  488. package/dist/events/event-filters.js.map +0 -1
  489. package/dist/events/predicate-eval.d.ts.map +0 -1
  490. package/dist/events/predicate-eval.js.map +0 -1
  491. package/dist/events/predicate.d.ts.map +0 -1
  492. package/dist/events/predicate.js.map +0 -1
  493. package/dist/events/reaction.d.ts.map +0 -1
  494. package/dist/events/reaction.js.map +0 -1
  495. package/dist/events/ring-buffer.d.ts.map +0 -1
  496. package/dist/events/ring-buffer.js.map +0 -1
  497. package/dist/flows/affected.d.ts.map +0 -1
  498. package/dist/flows/affected.js.map +0 -1
  499. package/dist/flows/annotate-tools.d.ts.map +0 -1
  500. package/dist/flows/annotate-tools.js.map +0 -1
  501. package/dist/flows/annotate.d.ts.map +0 -1
  502. package/dist/flows/annotate.js.map +0 -1
  503. package/dist/flows/annotation-store.d.ts.map +0 -1
  504. package/dist/flows/annotation-store.js.map +0 -1
  505. package/dist/flows/assertion-integrity.d.ts.map +0 -1
  506. package/dist/flows/assertion-integrity.js.map +0 -1
  507. package/dist/flows/assertion-tiers-store.d.ts.map +0 -1
  508. package/dist/flows/assertion-tiers-store.js.map +0 -1
  509. package/dist/flows/buddy-status.d.ts.map +0 -1
  510. package/dist/flows/buddy-status.js.map +0 -1
  511. package/dist/flows/coverage.d.ts.map +0 -1
  512. package/dist/flows/coverage.js.map +0 -1
  513. package/dist/flows/decision.d.ts.map +0 -1
  514. package/dist/flows/decision.js.map +0 -1
  515. package/dist/flows/flake-store.d.ts.map +0 -1
  516. package/dist/flows/flake-store.js.map +0 -1
  517. package/dist/flows/flake.d.ts.map +0 -1
  518. package/dist/flows/flake.js.map +0 -1
  519. package/dist/flows/flow-classify.d.ts.map +0 -1
  520. package/dist/flows/flow-classify.js.map +0 -1
  521. package/dist/flows/flow-replay-run.d.ts.map +0 -1
  522. package/dist/flows/flow-replay-run.js.map +0 -1
  523. package/dist/flows/flow-replay.d.ts.map +0 -1
  524. package/dist/flows/flow-replay.js.map +0 -1
  525. package/dist/flows/flow-report.d.ts.map +0 -1
  526. package/dist/flows/flow-report.js.map +0 -1
  527. package/dist/flows/flow-scope.d.ts.map +0 -1
  528. package/dist/flows/flow-scope.js.map +0 -1
  529. package/dist/flows/flow-sources.d.ts.map +0 -1
  530. package/dist/flows/flow-sources.js.map +0 -1
  531. package/dist/flows/flow-success.d.ts.map +0 -1
  532. package/dist/flows/flow-success.js.map +0 -1
  533. package/dist/flows/flow-tools.d.ts.map +0 -1
  534. package/dist/flows/flow-tools.js.map +0 -1
  535. package/dist/flows/flows.d.ts.map +0 -1
  536. package/dist/flows/flows.js.map +0 -1
  537. package/dist/flows/gate.d.ts.map +0 -1
  538. package/dist/flows/gate.js.map +0 -1
  539. package/dist/flows/git-changed.d.ts.map +0 -1
  540. package/dist/flows/git-changed.js.map +0 -1
  541. package/dist/flows/heal-run.d.ts.map +0 -1
  542. package/dist/flows/heal-run.js.map +0 -1
  543. package/dist/flows/heal.d.ts.map +0 -1
  544. package/dist/flows/heal.js.map +0 -1
  545. package/dist/flows/parallel-suite.d.ts.map +0 -1
  546. package/dist/flows/parallel-suite.js.map +0 -1
  547. package/dist/flows/recordings.d.ts.map +0 -1
  548. package/dist/flows/recordings.js.map +0 -1
  549. package/dist/flows/replay.d.ts.map +0 -1
  550. package/dist/flows/replay.js.map +0 -1
  551. package/dist/flows/watch-batcher.d.ts.map +0 -1
  552. package/dist/flows/watch-batcher.js.map +0 -1
  553. package/dist/honesty/blind-spots.d.ts.map +0 -1
  554. package/dist/honesty/blind-spots.js.map +0 -1
  555. package/dist/honesty/honesty.d.ts.map +0 -1
  556. package/dist/honesty/honesty.js.map +0 -1
  557. package/dist/http-server.d.ts.map +0 -1
  558. package/dist/http-server.js.map +0 -1
  559. package/dist/idle-shutdown.d.ts.map +0 -1
  560. package/dist/idle-shutdown.js.map +0 -1
  561. package/dist/index.d.ts.map +0 -1
  562. package/dist/index.js.map +0 -1
  563. package/dist/init/agent-rules.d.ts.map +0 -1
  564. package/dist/init/agent-rules.js.map +0 -1
  565. package/dist/init/cursor.d.ts.map +0 -1
  566. package/dist/init/cursor.js.map +0 -1
  567. package/dist/init/detect.d.ts.map +0 -1
  568. package/dist/init/detect.js.map +0 -1
  569. package/dist/init/mcp.d.ts.map +0 -1
  570. package/dist/init/mcp.js.map +0 -1
  571. package/dist/init/node-io.d.ts.map +0 -1
  572. package/dist/init/node-io.js.map +0 -1
  573. package/dist/init/plan.d.ts.map +0 -1
  574. package/dist/init/plan.js.map +0 -1
  575. package/dist/init/project-id.d.ts.map +0 -1
  576. package/dist/init/project-id.js.map +0 -1
  577. package/dist/init/run.d.ts.map +0 -1
  578. package/dist/init/run.js.map +0 -1
  579. package/dist/init/snippets.d.ts.map +0 -1
  580. package/dist/init/snippets.js.map +0 -1
  581. package/dist/init/vite-config.d.ts.map +0 -1
  582. package/dist/init/vite-config.js.map +0 -1
  583. package/dist/input/network-detail.d.ts.map +0 -1
  584. package/dist/input/network-detail.js.map +0 -1
  585. package/dist/input/network-mock-tools.d.ts.map +0 -1
  586. package/dist/input/network-mock-tools.js.map +0 -1
  587. package/dist/input/network-mock.d.ts.map +0 -1
  588. package/dist/input/network-mock.js.map +0 -1
  589. package/dist/input/real-input.d.ts.map +0 -1
  590. package/dist/input/real-input.js.map +0 -1
  591. package/dist/input/scroll-find.d.ts.map +0 -1
  592. package/dist/input/scroll-find.js.map +0 -1
  593. package/dist/input/scroll-tools.d.ts.map +0 -1
  594. package/dist/input/scroll-tools.js.map +0 -1
  595. package/dist/input/viewport-tools.d.ts.map +0 -1
  596. package/dist/input/viewport-tools.js.map +0 -1
  597. package/dist/journal/ambient-store.d.ts.map +0 -1
  598. package/dist/journal/ambient-store.js.map +0 -1
  599. package/dist/journal/ambient.d.ts.map +0 -1
  600. package/dist/journal/ambient.js.map +0 -1
  601. package/dist/journal/attach-journal.d.ts.map +0 -1
  602. package/dist/journal/attach-journal.js.map +0 -1
  603. package/dist/journal/deviation-report.d.ts.map +0 -1
  604. package/dist/journal/deviation-report.js.map +0 -1
  605. package/dist/journal/deviation-service.d.ts.map +0 -1
  606. package/dist/journal/deviation-service.js.map +0 -1
  607. package/dist/journal/envelope-store.d.ts.map +0 -1
  608. package/dist/journal/envelope-store.js.map +0 -1
  609. package/dist/journal/envelope.d.ts.map +0 -1
  610. package/dist/journal/envelope.js.map +0 -1
  611. package/dist/journal/journal-query.d.ts.map +0 -1
  612. package/dist/journal/journal-query.js.map +0 -1
  613. package/dist/journal/journal-recorder.d.ts.map +0 -1
  614. package/dist/journal/journal-recorder.js.map +0 -1
  615. package/dist/journal/retention.d.ts.map +0 -1
  616. package/dist/journal/retention.js.map +0 -1
  617. package/dist/journal/rollups.d.ts.map +0 -1
  618. package/dist/journal/rollups.js.map +0 -1
  619. package/dist/journal/session-end.d.ts.map +0 -1
  620. package/dist/journal/session-end.js.map +0 -1
  621. package/dist/journal/session-journal.d.ts.map +0 -1
  622. package/dist/journal/session-journal.js.map +0 -1
  623. package/dist/license/license.d.ts.map +0 -1
  624. package/dist/license/license.js.map +0 -1
  625. package/dist/log.d.ts.map +0 -1
  626. package/dist/log.js.map +0 -1
  627. package/dist/mcp-proxy.d.ts.map +0 -1
  628. package/dist/mcp-proxy.js.map +0 -1
  629. package/dist/mcp.d.ts.map +0 -1
  630. package/dist/mcp.js.map +0 -1
  631. package/dist/oracles/flow-instrument-gaps.d.ts.map +0 -1
  632. package/dist/oracles/flow-instrument-gaps.js.map +0 -1
  633. package/dist/oracles/propose-consequences.d.ts.map +0 -1
  634. package/dist/oracles/propose-consequences.js.map +0 -1
  635. package/dist/oracles/self-instrument.d.ts.map +0 -1
  636. package/dist/oracles/self-instrument.js.map +0 -1
  637. package/dist/pairing-token.d.ts.map +0 -1
  638. package/dist/pairing-token.js.map +0 -1
  639. package/dist/phenomena/phenomena.d.ts.map +0 -1
  640. package/dist/phenomena/phenomena.js.map +0 -1
  641. package/dist/pool/browser-pool.d.ts.map +0 -1
  642. package/dist/pool/browser-pool.js.map +0 -1
  643. package/dist/pool/lease-reaper.d.ts.map +0 -1
  644. package/dist/pool/lease-reaper.js.map +0 -1
  645. package/dist/pool/playwright-launcher.d.ts.map +0 -1
  646. package/dist/pool/playwright-launcher.js.map +0 -1
  647. package/dist/project/baselines.d.ts.map +0 -1
  648. package/dist/project/baselines.js.map +0 -1
  649. package/dist/project/file-lock.d.ts.map +0 -1
  650. package/dist/project/file-lock.js.map +0 -1
  651. package/dist/project/fs-port.d.ts.map +0 -1
  652. package/dist/project/fs-port.js.map +0 -1
  653. package/dist/project/project-store.d.ts.map +0 -1
  654. package/dist/project/project-store.js.map +0 -1
  655. package/dist/project/project-tools.d.ts.map +0 -1
  656. package/dist/project/project-tools.js.map +0 -1
  657. package/dist/project/reticle-dir.d.ts.map +0 -1
  658. package/dist/project/reticle-dir.js.map +0 -1
  659. package/dist/runs/build-verification-run.d.ts.map +0 -1
  660. package/dist/runs/build-verification-run.js.map +0 -1
  661. package/dist/runs/profile-redact.d.ts.map +0 -1
  662. package/dist/runs/profile-redact.js.map +0 -1
  663. package/dist/runs/render-report.d.ts.map +0 -1
  664. package/dist/runs/render-report.js.map +0 -1
  665. package/dist/runs/repair-prompt.d.ts.map +0 -1
  666. package/dist/runs/repair-prompt.js.map +0 -1
  667. package/dist/runs/replay-mapping.d.ts.map +0 -1
  668. package/dist/runs/replay-mapping.js.map +0 -1
  669. package/dist/runs/reticle-runner.d.ts.map +0 -1
  670. package/dist/runs/reticle-runner.js.map +0 -1
  671. package/dist/runs/risk-classify.d.ts.map +0 -1
  672. package/dist/runs/risk-classify.js.map +0 -1
  673. package/dist/runs/run-diff.d.ts.map +0 -1
  674. package/dist/runs/run-diff.js.map +0 -1
  675. package/dist/runs/run-store.d.ts.map +0 -1
  676. package/dist/runs/run-store.js.map +0 -1
  677. package/dist/runs/run-tools.d.ts.map +0 -1
  678. package/dist/runs/run-tools.js.map +0 -1
  679. package/dist/runs/runner-port.d.ts.map +0 -1
  680. package/dist/runs/runner-port.js.map +0 -1
  681. package/dist/runs/verify-http.d.ts.map +0 -1
  682. package/dist/runs/verify-http.js.map +0 -1
  683. package/dist/runs/verify-server.d.ts.map +0 -1
  684. package/dist/runs/verify-server.js.map +0 -1
  685. package/dist/server-version.d.ts.map +0 -1
  686. package/dist/server-version.js.map +0 -1
  687. package/dist/session/control-envelope.d.ts.map +0 -1
  688. package/dist/session/control-envelope.js.map +0 -1
  689. package/dist/session/live-control-tools.d.ts.map +0 -1
  690. package/dist/session/live-control-tools.js.map +0 -1
  691. package/dist/session/live-control.d.ts.map +0 -1
  692. package/dist/session/live-control.js.map +0 -1
  693. package/dist/session/observed-state.d.ts.map +0 -1
  694. package/dist/session/observed-state.js.map +0 -1
  695. package/dist/session/output-budget.d.ts.map +0 -1
  696. package/dist/session/output-budget.js.map +0 -1
  697. package/dist/session/presenter-args.d.ts.map +0 -1
  698. package/dist/session/presenter-args.js.map +0 -1
  699. package/dist/session/review-store.d.ts.map +0 -1
  700. package/dist/session/review-store.js.map +0 -1
  701. package/dist/session/session-health.d.ts.map +0 -1
  702. package/dist/session/session-health.js.map +0 -1
  703. package/dist/session/session-manager.d.ts.map +0 -1
  704. package/dist/session/session-manager.js.map +0 -1
  705. package/dist/session/session-readiness.d.ts.map +0 -1
  706. package/dist/session/session-readiness.js.map +0 -1
  707. package/dist/session/session-reaper.d.ts.map +0 -1
  708. package/dist/session/session-reaper.js.map +0 -1
  709. package/dist/session/session-recommendation.d.ts.map +0 -1
  710. package/dist/session/session-recommendation.js.map +0 -1
  711. package/dist/session/session-tools.d.ts.map +0 -1
  712. package/dist/session/session-tools.js.map +0 -1
  713. package/dist/session/session.d.ts.map +0 -1
  714. package/dist/session/session.js.map +0 -1
  715. package/dist/session/state-select.d.ts.map +0 -1
  716. package/dist/session/state-select.js.map +0 -1
  717. package/dist/token-auth.d.ts.map +0 -1
  718. package/dist/token-auth.js.map +0 -1
  719. package/dist/tools/act-tools.d.ts.map +0 -1
  720. package/dist/tools/act-tools.js.map +0 -1
  721. package/dist/tools/act-view.d.ts.map +0 -1
  722. package/dist/tools/act-view.js.map +0 -1
  723. package/dist/tools/assert-grade.d.ts.map +0 -1
  724. package/dist/tools/assert-grade.js.map +0 -1
  725. package/dist/tools/browser-tools.d.ts.map +0 -1
  726. package/dist/tools/browser-tools.js.map +0 -1
  727. package/dist/tools/contract-tools.d.ts.map +0 -1
  728. package/dist/tools/contract-tools.js.map +0 -1
  729. package/dist/tools/dynamic-tools.d.ts.map +0 -1
  730. package/dist/tools/dynamic-tools.js.map +0 -1
  731. package/dist/tools/error-recovery.d.ts.map +0 -1
  732. package/dist/tools/error-recovery.js.map +0 -1
  733. package/dist/tools/invoke-tool.d.ts.map +0 -1
  734. package/dist/tools/invoke-tool.js.map +0 -1
  735. package/dist/tools/lease-tools.d.ts.map +0 -1
  736. package/dist/tools/lease-tools.js.map +0 -1
  737. package/dist/tools/merge-tools.d.ts.map +0 -1
  738. package/dist/tools/merge-tools.js.map +0 -1
  739. package/dist/tools/observe-tools.d.ts.map +0 -1
  740. package/dist/tools/observe-tools.js.map +0 -1
  741. package/dist/tools/profiles.d.ts.map +0 -1
  742. package/dist/tools/profiles.js.map +0 -1
  743. package/dist/tools/query-paginate.d.ts.map +0 -1
  744. package/dist/tools/query-paginate.js.map +0 -1
  745. package/dist/tools/read-tools.d.ts.map +0 -1
  746. package/dist/tools/read-tools.js.map +0 -1
  747. package/dist/tools/snapshot-delta.d.ts.map +0 -1
  748. package/dist/tools/snapshot-delta.js.map +0 -1
  749. package/dist/tools/tool-invoker.d.ts.map +0 -1
  750. package/dist/tools/tool-invoker.js.map +0 -1
  751. package/dist/tools/tool-kit.d.ts.map +0 -1
  752. package/dist/tools/tool-kit.js.map +0 -1
  753. package/dist/tools/tool-names.d.ts.map +0 -1
  754. package/dist/tools/tool-names.js.map +0 -1
  755. package/dist/tools/tools-helpers.d.ts.map +0 -1
  756. package/dist/tools/tools-helpers.js.map +0 -1
  757. package/dist/tools/tools.d.ts.map +0 -1
  758. package/dist/tools/tools.js.map +0 -1
  759. package/dist/update/update-checker.d.ts.map +0 -1
  760. package/dist/update/update-checker.js.map +0 -1
  761. package/dist/update/updater.d.ts.map +0 -1
  762. package/dist/update/updater.js.map +0 -1
  763. package/dist/visual/visual-diff.d.ts.map +0 -1
  764. package/dist/visual/visual-diff.js.map +0 -1
  765. package/dist/visual/visual-store.d.ts.map +0 -1
  766. package/dist/visual/visual-store.js.map +0 -1
  767. package/dist/visual/visual-tools.d.ts.map +0 -1
  768. package/dist/visual/visual-tools.js.map +0 -1
@@ -0,0 +1,167 @@
1
+ import { ContradictionKind, EventType } from '@reticlehq/core';
2
+ /**
3
+ * The app sent a money value back in a DIFFERENT unit than the API gave it.
4
+ *
5
+ * Payment APIs overwhelmingly speak minor units — Stripe, Razorpay, Adyen, PayPal all state amounts
6
+ * in paise/cents as integers. A UI renders that as a major-unit string, and the bug is writing the
7
+ * rendered number back into the field the integer came from.
8
+ *
9
+ * Measured on a real payments dashboard: `GET /payments` returns `amount: 118701` for a payment, the
10
+ * row renders "₹1,187.01", and the refund posts `{"amount": 1187.01}` into the same field. The server
11
+ * takes 1187 paise and answers `200 {"status": "processed"}`. That is a 100x UNDER-REFUND, and every
12
+ * channel agrees it worked: the status is 200, the payload says processed, the UI advances, the page
13
+ * settles, and the number in the request is exactly the number on the screen. Nothing disagrees,
14
+ * because the disagreement is with a value the API returned EARLIER in the session.
15
+ *
16
+ * Which is the point: this is only visible to something holding the whole request timeline with
17
+ * bodies. A snapshot cannot see it, a status column cannot see it, and a human reading the request
18
+ * sees the amount they expected.
19
+ *
20
+ * Not a heuristic about decimals. Firing on "an amount had a fractional part" would accuse every API
21
+ * that legitimately uses major units. This fires only when the SAME field of the SAME entity was
22
+ * observed at a different scale — a comparison, not a guess.
23
+ */
24
+ /** Fields worth comparing. Deliberately short: money, not every number an app sends. */
25
+ const MONEY_FIELDS = new Set(['amount', 'value', 'price', 'total', 'fee', 'cost', 'balance']);
26
+ /**
27
+ * Scales that indicate a minor/major confusion. 100 covers two-decimal currencies; 1000 covers the
28
+ * three-decimal ones (KWD, BHD, JOD, TND).
29
+ */
30
+ const SCALES = [100, 1000];
31
+ /**
32
+ * Prefixed ids (`pay_NkT10001`) and uuids, matched anywhere in a URL or a string field.
33
+ *
34
+ * Numeric ids are handled separately by path segment: `/api/orders/9/capture` is at least as common
35
+ * as a prefixed id, and a bare `9` cannot be pattern-matched out of arbitrary text without matching
36
+ * every other number too.
37
+ */
38
+ const ID_PATTERN = /[A-Za-z]{2,}_[A-Za-z0-9]{2,}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}/g;
39
+ function parse(raw) {
40
+ if (typeof raw !== 'string' || raw.length === 0)
41
+ return undefined;
42
+ try {
43
+ return JSON.parse(raw);
44
+ }
45
+ catch {
46
+ return undefined;
47
+ }
48
+ }
49
+ /** Every (id, field, value) triple in a payload, from objects that carry an id of their own. */
50
+ function moneyByEntity(node, into) {
51
+ if (Array.isArray(node)) {
52
+ for (const item of node)
53
+ moneyByEntity(item, into);
54
+ return;
55
+ }
56
+ if (typeof node !== 'object' || node === null)
57
+ return;
58
+ const record = node;
59
+ // An id may arrive as a number (`{"id": 9}`) — normalised so a numeric path segment matches it.
60
+ const raw = record['id'];
61
+ const id = typeof raw === 'string' ? raw : typeof raw === 'number' ? String(raw) : undefined;
62
+ if (id !== undefined) {
63
+ for (const [key, value] of Object.entries(record)) {
64
+ if (!MONEY_FIELDS.has(key) || typeof value !== 'number')
65
+ continue;
66
+ const fields = into.get(id) ?? new Map();
67
+ fields.set(key, value);
68
+ into.set(id, fields);
69
+ }
70
+ }
71
+ for (const value of Object.values(record))
72
+ moneyByEntity(value, into);
73
+ }
74
+ /** Ids named anywhere in a URL or a request payload — how a write says which entity it targets. */
75
+ function idsIn(url, body) {
76
+ const found = new Set(url.match(ID_PATTERN) ?? []);
77
+ // Numeric path segments: `/api/orders/9/capture` names entity 9.
78
+ for (const segment of url.split('?')[0]?.split('/') ?? []) {
79
+ if (segment.length > 0 && /^\d+$/.test(segment))
80
+ found.add(segment);
81
+ }
82
+ if (typeof body === 'object' && body !== null) {
83
+ for (const value of Object.values(body)) {
84
+ if (typeof value === 'string')
85
+ for (const id of value.match(ID_PATTERN) ?? [])
86
+ found.add(id);
87
+ }
88
+ }
89
+ return Array.from(found);
90
+ }
91
+ /** The scale between a known value and a sent one, or undefined when they are consistent. */
92
+ function scaleBetween(known, sent) {
93
+ if (sent === 0 || known === 0)
94
+ return undefined;
95
+ for (const scale of SCALES) {
96
+ // A tolerance, because the major-unit form is a rounded render of the minor one.
97
+ if (Math.abs(known - sent * scale) <= scale / 2)
98
+ return scale;
99
+ }
100
+ return undefined;
101
+ }
102
+ /**
103
+ * @param prior events from BEFORE the window, used only to learn what the API has stated.
104
+ *
105
+ * The scale error is a disagreement with a value the API gave EARLIER — by definition before the
106
+ * action that sends it back. `reticle_assert` scopes its window to the last act's cursor, so the
107
+ * stating response falls outside it and `known` is empty exactly when it matters. Measured live on
108
+ * the payments panel: `reticle_observe` over a wide window reported the mismatch while `assert` on
109
+ * the same session reported none — the verdict tool, the one an agent gates on, was the blind one.
110
+ *
111
+ * Prior events TEACH, they are never themselves findings: widening the window instead would make
112
+ * every other rule blame this action for events it did not cause, and would re-report every earlier
113
+ * mistake on every assert.
114
+ */
115
+ export function findUnitMismatches(events, prior = []) {
116
+ // What the API has told us about each entity so far, in the API's own units.
117
+ const known = new Map();
118
+ for (const event of prior) {
119
+ if (event.type !== EventType.NET_REQUEST)
120
+ continue;
121
+ const body = parse(event.data['responseBody']);
122
+ if (body !== undefined)
123
+ moneyByEntity(body, known);
124
+ }
125
+ const found = [];
126
+ const seen = new Set();
127
+ for (const event of events) {
128
+ if (event.type !== EventType.NET_REQUEST)
129
+ continue;
130
+ const url = typeof event.data['url'] === 'string' ? event.data['url'] : '';
131
+ const requestBody = parse(event.data['requestBody']);
132
+ // Compare BEFORE recording this call's own response, or a request that echoes its own reply
133
+ // would compare against itself.
134
+ if (typeof requestBody === 'object' && requestBody !== null) {
135
+ const sentFields = requestBody;
136
+ for (const id of idsIn(url, requestBody)) {
137
+ const fields = known.get(id);
138
+ if (fields === undefined)
139
+ continue;
140
+ for (const [key, sent] of Object.entries(sentFields)) {
141
+ if (!MONEY_FIELDS.has(key) || typeof sent !== 'number')
142
+ continue;
143
+ const priorValue = fields.get(key);
144
+ if (priorValue === undefined)
145
+ continue;
146
+ const scale = scaleBetween(priorValue, sent);
147
+ if (scale === undefined)
148
+ continue;
149
+ const key2 = `${id}:${key}`;
150
+ if (seen.has(key2))
151
+ continue;
152
+ seen.add(key2);
153
+ found.push({
154
+ kind: ContradictionKind.UNIT_MISMATCH,
155
+ claim: `the request sent ${key}=${String(sent)} and the server accepted it`,
156
+ counter: `the API reports ${key}=${String(priorValue)} for ${id} — the value sent is ${String(scale)}x SMALLER, i.e. a major-unit number written into a minor-unit field`,
157
+ detail: `${url} — at this scale the operation moves ${String(sent)} minor units instead of ${String(priorValue)}; nothing else can see this, because the number sent is exactly the number rendered on screen`,
158
+ });
159
+ }
160
+ }
161
+ }
162
+ const responseBody = parse(event.data['responseBody']);
163
+ if (responseBody !== undefined)
164
+ moneyByEntity(responseBody, known);
165
+ }
166
+ return found;
167
+ }
@@ -0,0 +1,18 @@
1
+ import type { ToolDef } from '../tools/tools.js';
2
+ /**
3
+ * `reticle_affected` — which saved flows must re-verify for a set of changed files.
4
+ *
5
+ * This logic already existed as `reticle affected`, deliberately kept off the MCP surface because an
6
+ * advertised tool costs tokens on every turn whether or not it is used. That reasoning is right, and
7
+ * this does not change it: the tool is NOT advertised by any profile. It is reachable through
8
+ * `reticle_run`, so it costs nothing per turn and is still discoverable via `reticle_tools`.
9
+ *
10
+ * What the reasoning missed is who holds the question. The AGENT is the one that just edited files
11
+ * and has to decide what to re-check; a shell command it may not be able to run is not an answer for
12
+ * an MCP client that has no shell. Leaving it CLI-only meant the party with the diff could not ask
13
+ * the party with the index.
14
+ *
15
+ * Unknown-provenance flows are returned as affected (fail-safe) AND listed separately, so "re-verify
16
+ * this" is never confused with "this definitely touches your change".
17
+ */
18
+ export declare const AFFECTED_TOOLS: ToolDef[];
@@ -0,0 +1,52 @@
1
+ import { z } from 'zod';
2
+ import { ReticleTool } from '../tools/tool-names.js';
3
+ import { loadNamedFlows, resolveChangedFiles } from '../cli-flow-commands.js';
4
+ import { affectedSavedFlows } from './flow-sources.js';
5
+ /**
6
+ * `reticle_affected` — which saved flows must re-verify for a set of changed files.
7
+ *
8
+ * This logic already existed as `reticle affected`, deliberately kept off the MCP surface because an
9
+ * advertised tool costs tokens on every turn whether or not it is used. That reasoning is right, and
10
+ * this does not change it: the tool is NOT advertised by any profile. It is reachable through
11
+ * `reticle_run`, so it costs nothing per turn and is still discoverable via `reticle_tools`.
12
+ *
13
+ * What the reasoning missed is who holds the question. The AGENT is the one that just edited files
14
+ * and has to decide what to re-check; a shell command it may not be able to run is not an answer for
15
+ * an MCP client that has no shell. Leaving it CLI-only meant the party with the diff could not ask
16
+ * the party with the index.
17
+ *
18
+ * Unknown-provenance flows are returned as affected (fail-safe) AND listed separately, so "re-verify
19
+ * this" is never confused with "this definitely touches your change".
20
+ */
21
+ export const AFFECTED_TOOLS = [
22
+ {
23
+ name: ReticleTool.AFFECTED,
24
+ description: 'Which saved flows must re-verify for a set of changed files. Pass the files you edited (and/or `since` for a git ref to diff against). Returns { changedFiles, affected, unknownProvenance } — `affected` is what to re-run, and `unknownProvenance` are flows included only because Reticle cannot tell which sources they cover, so they are re-verified by default rather than silently skipped.',
25
+ example: { files: ['src/App.tsx'] },
26
+ inputSchema: {
27
+ files: z
28
+ .array(z.string())
29
+ .optional()
30
+ .describe('Changed file paths, repo-relative (e.g. ["src/App.tsx"]).'),
31
+ since: z
32
+ .string()
33
+ .optional()
34
+ .describe('Git ref to diff against (e.g. "HEAD~1", "main"). Unioned with `files`.'),
35
+ },
36
+ outputSchema: {
37
+ changedFiles: z.array(z.string()),
38
+ affected: z.array(z.string()),
39
+ unknownProvenance: z.array(z.string()),
40
+ },
41
+ handler: async (deps, args) => {
42
+ const files = Array.isArray(args['files'])
43
+ ? args['files'].filter((f) => typeof f === 'string')
44
+ : [];
45
+ const since = typeof args['since'] === 'string' ? args['since'] : undefined;
46
+ const changedFiles = await resolveChangedFiles(files, since);
47
+ const flows = await loadNamedFlows(deps.fs, deps.reticleRoot);
48
+ const result = affectedSavedFlows(flows, changedFiles);
49
+ return { changedFiles, ...result };
50
+ },
51
+ },
52
+ ];
@@ -22,4 +22,3 @@ export interface AffectedResult {
22
22
  * a repo-relative change matches an absolute stamp and vice-versa.
23
23
  */
24
24
  export declare function affectedFlows(flows: readonly FlowSources[], changedFiles: readonly string[]): AffectedResult;
25
- //# sourceMappingURL=affected.d.ts.map
@@ -33,4 +33,3 @@ export function affectedFlows(flows, changedFiles) {
33
33
  }
34
34
  return { affected, unknownProvenance };
35
35
  }
36
- //# sourceMappingURL=affected.js.map
@@ -13,4 +13,3 @@ import type { ToolDef } from '../tools/tools.js';
13
13
  * agent that annotates at the wrong moment gets a clear error rather than a crash.
14
14
  */
15
15
  export declare const ANNOTATE_TOOLS: ToolDef[];
16
- //# sourceMappingURL=annotate-tools.d.ts.map
@@ -1,5 +1,14 @@
1
1
  import { z } from 'zod';
2
2
  import { AnnotationErrorCode, AnnotationSchema } from '@reticlehq/core';
3
+ import { RECOVERY } from '../tools/error-recovery.js';
4
+ /**
5
+ * An unknown kind is almost always a free-text annotation, which this tool deliberately refuses to
6
+ * guess into a predicate. Naming the six kinds turns a dead end into one retry.
7
+ */
8
+ const UNKNOWN_KIND_RECOVERY = 'Annotations are structured, never free text. Pass one of: ' +
9
+ '{ kind: "assert-signal", name }, { kind: "assert-visible", testid }, ' +
10
+ '{ kind: "assert-state", statePath }, { kind: "mark-dynamic", testid }, ' +
11
+ '{ kind: "success-state", signal|testid }, or { kind: "intent", text }.';
3
12
  import { ReticleTool } from '../tools/tool-names.js';
4
13
  import { asString } from '../tools/tools-helpers.js';
5
14
  import { compileAnnotation } from './annotate.js';
@@ -20,6 +29,7 @@ const DEFAULT_RECORDING = 'default';
20
29
  export const ANNOTATE_TOOLS = [
21
30
  {
22
31
  name: ReticleTool.ANNOTATE,
32
+ example: { kind: 'assert-signal', name: 'todos:loaded' },
23
33
  description: 'Attach a STRUCTURED annotation to the active recording, compiling it into the flow. kind: ' +
24
34
  'assert-signal { name, dataMatches? } → the last step asserts that signal; assert-visible ' +
25
35
  '{ testid } → the last step asserts that element is present; assert-state ' +
@@ -98,6 +108,7 @@ export const ANNOTATE_TOOLS = [
98
108
  },
99
109
  outputSchema: {
100
110
  ok: z.boolean(),
111
+ recovery: z.string().optional(),
101
112
  target: z.string().optional(),
102
113
  compiled: z.string().optional(),
103
114
  code: z.string().optional(),
@@ -107,12 +118,20 @@ export const ANNOTATE_TOOLS = [
107
118
  // Structured boundary: a free NL string / unknown kind fails the schema → UNKNOWN_KIND.
108
119
  const parsed = AnnotationSchema.safeParse(args);
109
120
  if (!parsed.success) {
110
- return Promise.resolve({ ok: false, code: AnnotationErrorCode.UNKNOWN_KIND });
121
+ return Promise.resolve({
122
+ ok: false,
123
+ code: AnnotationErrorCode.UNKNOWN_KIND,
124
+ recovery: UNKNOWN_KIND_RECOVERY,
125
+ });
111
126
  }
112
127
  const stepCount = deps.recordings.stepCount(name);
113
128
  const compiled = deps.recordings.getCompiled(name) !== undefined;
114
129
  if (stepCount === undefined && !compiled) {
115
- return Promise.resolve({ ok: false, code: AnnotationErrorCode.NO_ACTIVE_RECORDING });
130
+ return Promise.resolve({
131
+ ok: false,
132
+ code: AnnotationErrorCode.NO_ACTIVE_RECORDING,
133
+ recovery: RECOVERY.MISSING_RECORDING,
134
+ });
116
135
  }
117
136
  const outcome = compileAnnotation(parsed.data, stepCount ?? 0);
118
137
  if (!outcome.result.ok)
@@ -133,4 +152,3 @@ export const ANNOTATE_TOOLS = [
133
152
  },
134
153
  },
135
154
  ];
136
- //# sourceMappingURL=annotate-tools.js.map
@@ -19,4 +19,3 @@ export declare function compileAnnotation(a: Annotation, stepCount: number): Ann
19
19
  * e.g. `will assert signal diff:shown`. The leading word is the named COMPILED_PREDICATE_PREFIX.
20
20
  */
21
21
  export declare function describeCompiled(a: Annotation): string;
22
- //# sourceMappingURL=annotate.d.ts.map
@@ -131,4 +131,3 @@ export function describeCompiled(a) {
131
131
  return `${COMPILED_PREDICATE_PREFIX} intent: ${a.text}`;
132
132
  }
133
133
  }
134
- //# sourceMappingURL=annotate.js.map
@@ -20,4 +20,3 @@ export declare class AnnotationStore {
20
20
  /** Drop a recording's annotations (called after reticle_flow_save folds them onto disk). */
21
21
  clear(name: string): void;
22
22
  }
23
- //# sourceMappingURL=annotation-store.d.ts.map
@@ -48,4 +48,3 @@ export class AnnotationStore {
48
48
  this.#byName.delete(name);
49
49
  }
50
50
  }
51
- //# sourceMappingURL=annotation-store.js.map
@@ -21,4 +21,3 @@ export interface DowngradeFinding {
21
21
  * lives with the affected index.
22
22
  */
23
23
  export declare function detectDowngrades(before: readonly StepExpect[], after: readonly StepExpect[]): DowngradeFinding[];
24
- //# sourceMappingURL=assertion-integrity.d.ts.map
@@ -24,4 +24,3 @@ export function detectDowngrades(before, after) {
24
24
  }
25
25
  return findings;
26
26
  }
27
- //# sourceMappingURL=assertion-integrity.js.map
@@ -77,4 +77,3 @@ export declare class AssertionTiersStore {
77
77
  /** Record one flow's assertion shape + covered sources after it PASSED. Never breaks a replay. */
78
78
  recordPassing(name: string, steps: readonly StepExpect[], sources?: readonly string[]): Promise<void>;
79
79
  }
80
- //# sourceMappingURL=assertion-tiers-store.d.ts.map
@@ -96,4 +96,3 @@ export class AssertionTiersStore {
96
96
  }
97
97
  }
98
98
  }
99
- //# sourceMappingURL=assertion-tiers-store.js.map
@@ -22,4 +22,3 @@ export interface BuddyStatusInput {
22
22
  * `✗ 2 deviations: checkout, billing · 39 nominal · 1 flaky quarantined`
23
23
  */
24
24
  export declare function formatBuddyStatus(input: BuddyStatusInput): string;
25
- //# sourceMappingURL=buddy-status.d.ts.map
@@ -30,4 +30,3 @@ export function formatBuddyStatus(input) {
30
30
  }
31
31
  return parts.join(' · ');
32
32
  }
33
- //# sourceMappingURL=buddy-status.js.map
@@ -25,4 +25,3 @@ export interface Coverage {
25
25
  overallPct: number;
26
26
  }
27
27
  export declare function computeCoverage(declared: DeclaredSurface, exercised: DeclaredSurface): Coverage;
28
- //# sourceMappingURL=coverage.d.ts.map
@@ -19,4 +19,3 @@ export function computeCoverage(declared, exercised) {
19
19
  const overallPct = total === 0 ? 100 : Math.round((covered / total) * 100);
20
20
  return { testids, signals, flows, overallPct };
21
21
  }
22
- //# sourceMappingURL=coverage.js.map
@@ -10,4 +10,3 @@ export declare function buildSuiteVerdict(runs: ReadonlyArray<{
10
10
  replay: FlowReplayResult;
11
11
  flow?: FlowFile;
12
12
  }>): SuiteVerdict;
13
- //# sourceMappingURL=decision.d.ts.map
@@ -117,4 +117,3 @@ export function buildSuiteVerdict(runs) {
117
117
  : `${passed}/${total} flows pass — ${failed} need attention: ${failures.map((f) => f.flow).join(', ')}`;
118
118
  return { status, total, passed, failed, summary, failures };
119
119
  }
120
- //# sourceMappingURL=decision.js.map
@@ -17,4 +17,3 @@ export declare class FlakeStore {
17
17
  /** The flows currently quarantined as flaky — what the gate excludes from blocking. */
18
18
  flakyFlows(): Promise<string[]>;
19
19
  }
20
- //# sourceMappingURL=flake-store.d.ts.map
@@ -56,4 +56,3 @@ export class FlakeStore {
56
56
  .map(([flow]) => flow);
57
57
  }
58
58
  }
59
- //# sourceMappingURL=flake-store.js.map
@@ -55,4 +55,3 @@ export declare function recordOutcome(record: FlakeRecord, passed: boolean): Fla
55
55
  export declare function isFlaky(record: FlakeRecord, minRuns?: number): boolean;
56
56
  /** Observed intermittent-failure rate (0 when too few runs to judge). */
57
57
  export declare function flakeRate(record: FlakeRecord): number;
58
- //# sourceMappingURL=flake.d.ts.map
@@ -33,4 +33,3 @@ export function isFlaky(record, minRuns = DEFAULT_MIN_FLAKE_RUNS) {
33
33
  export function flakeRate(record) {
34
34
  return record.runs === 0 ? 0 : record.fails / record.runs;
35
35
  }
36
- //# sourceMappingURL=flake.js.map
@@ -49,4 +49,3 @@ export interface FlowAssertionClassification {
49
49
  warning?: string;
50
50
  }
51
51
  export declare function classifyFlowAssertions(flow: FlowFile): FlowAssertionClassification;
52
- //# sourceMappingURL=flow-classify.d.ts.map
@@ -88,4 +88,3 @@ export function classifyFlowAssertions(flow) {
88
88
  ...(warning !== undefined ? { warning } : {}),
89
89
  };
90
90
  }
91
- //# sourceMappingURL=flow-classify.js.map
@@ -30,4 +30,3 @@ export declare function replayNamedFlow(deps: ToolDeps, args: Record<string, unk
30
30
  * documented to work headless), so a missing/unknown session degrades to the global/legacy store.
31
31
  */
32
32
  export declare function sessionProjectId(deps: ToolDeps, sessionId: string | undefined): string | undefined;
33
- //# sourceMappingURL=flow-replay-run.d.ts.map
@@ -9,6 +9,10 @@ import { AssertionTiersStore } from './assertion-tiers-store.js';
9
9
  import { toFlowSources } from './flow-sources.js';
10
10
  import { reportAndAccumulate } from '../journal/deviation-service.js';
11
11
  import { EnvelopeStore } from '../journal/envelope-store.js';
12
+ import { homedir } from 'node:os';
13
+ import { syncRunRecordToCloud, SyncOutcome } from '../cloud/cloud-sync.js';
14
+ import { resolveProjectCloud } from '../cloud/cloud-config.js';
15
+ import { log } from '../log.js';
12
16
  export function latestRecordedFlow(events) {
13
17
  for (let i = events.length - 1; i >= 0; i--) {
14
18
  const event = events[i];
@@ -26,11 +30,11 @@ export function flowErrorMessage(code) {
26
30
  case FlowErrorCode.INVALID_NAME:
27
31
  return 'invalid flow name — use a single safe segment (letters/digits/-/_), no path separators';
28
32
  case FlowErrorCode.NOT_FOUND:
29
- return 'no such flow on disk — run reticle_flow_list to see saved flows';
33
+ return 'no such flow on disk — run reticle_flow{action:"list"} to see saved flows';
30
34
  case FlowErrorCode.PARSE_FAILED:
31
35
  return 'flow file is malformed — fix or regenerate it with reticle_flow_save';
32
36
  case FlowErrorCode.NO_RECORDING:
33
- return 'no compiled recording by that name — record one (reticle_record_start/stop) first';
37
+ return 'no compiled recording by that name — record one (reticle_record{action:"start"|"stop"}) first';
34
38
  }
35
39
  }
36
40
  /** Map the wire ReplayStatus onto the persisted RunStatus (ok→pass). */
@@ -44,15 +48,28 @@ function replayToRunStatus(status) {
44
48
  return RunStatus.ERROR;
45
49
  }
46
50
  }
47
- /** Append a flow-replay outcome to .reticle/project.json (never throws into replay). */
48
- async function recordReplayRun(deps, name, status, driftSteps, durationMs) {
51
+ /**
52
+ * Append a flow-replay outcome to .reticle/project.json (never throws into replay) and, when logged in,
53
+ * best-effort mirror it to Reticle Cloud so the team's server-side regression history stays current. The
54
+ * cloud push is fire-and-forget: not logged in → skipped, a network failure is logged and swallowed.
55
+ */
56
+ async function recordReplayRun(deps, name, status, driftSteps, durationMs, projectId) {
57
+ const runStatus = replayToRunStatus(status);
49
58
  await deps.project.recordRun({
50
59
  kind: RunKind.FLOW_REPLAY,
51
60
  name,
52
- status: replayToRunStatus(status),
61
+ status: runStatus,
53
62
  evidence: { driftSteps },
54
63
  durationMs,
55
64
  });
65
+ // Per-project cloud: push memory outcomes only when cloud is attached AND memory sync is enabled.
66
+ const cloud = await resolveProjectCloud(deps.fs, deps.reticleRoot, homedir(), process.env);
67
+ if (cloud.config === null || !cloud.policy.memory)
68
+ return; // not attached / memory disabled → local only
69
+ const result = await syncRunRecordToCloud({ kind: RunKind.FLOW_REPLAY, name, status: runStatus, at: deps.now(), durationMs }, projectId, cloud.config, (url, init) => fetch(url, init));
70
+ if (result.outcome !== SyncOutcome.SYNCED) {
71
+ log('cloud-run-record-sync-failed', { flow: name, status: result.status, error: result.error });
72
+ }
56
73
  }
57
74
  /**
58
75
  * When a flow records the page its journey started on (`startPath`) and the tab is currently on a
@@ -95,7 +112,7 @@ export async function replayNamedFlow(deps, args) {
95
112
  }
96
113
  const loaded = await deps.flows.load(name, projectId);
97
114
  if (!loaded.ok) {
98
- await recordReplayRun(deps, name, ReplayStatus.ERROR, 0, deps.now() - startedAt);
115
+ await recordReplayRun(deps, name, ReplayStatus.ERROR, 0, deps.now() - startedAt, projectId);
99
116
  return {
100
117
  name,
101
118
  status: ReplayStatus.ERROR,
@@ -129,7 +146,7 @@ export async function replayNamedFlow(deps, args) {
129
146
  const driftSteps = steps.filter((s) => s.drift !== undefined).length;
130
147
  const allOk = steps.every((s) => s.ok);
131
148
  const status = driftSteps > 0 ? ReplayStatus.DRIFT : allOk ? ReplayStatus.OK : ReplayStatus.ERROR;
132
- await recordReplayRun(deps, name, status, driftSteps, deps.now() - startedAt);
149
+ await recordReplayRun(deps, name, status, driftSteps, deps.now() - startedAt, projectId);
133
150
  // Anti-reward-hacking baseline: record what this flow asserted ONLY when it passed clean. A
134
151
  // failing run must never become the baseline a later weakening is measured against.
135
152
  if (status === ReplayStatus.OK) {
@@ -199,4 +216,3 @@ export function sessionProjectId(deps, sessionId) {
199
216
  return undefined;
200
217
  }
201
218
  }
202
- //# sourceMappingURL=flow-replay-run.js.map
@@ -1,4 +1,4 @@
1
- import { type CommandResult, type FlowFile, type FlowStepResult, type ReticleEvent } from '@reticlehq/core';
1
+ import { AnchorKind, type CommandResult, type FlowAnchor, type FlowFile, type FlowStepResult, type ReticleEvent, type QueryEmptyHint } from '@reticlehq/core';
2
2
  import type { EvalResult, Predicate } from '../events/predicate.js';
3
3
  /**
4
4
  * The session surface flow-replay needs: QUERY to re-resolve a testid anchor against the live
@@ -40,13 +40,31 @@ export declare function editDistance(a: string, b: string): number;
40
40
  */
41
41
  export declare function nearestTestid(missing: string, present: string[]): string | null;
42
42
  /** Injected sleeper so tests drive replay with a no-op clock; production waits on a real timer. */
43
- type Sleep = (ms: number) => Promise<void>;
43
+ export type Sleep = (ms: number) => Promise<void>;
44
44
  /**
45
45
  * True when ≥2 present testids tie at the minimum edit distance to the missing one — `nearest` is
46
46
  * then an arbitrary lexical-tiebreak pick, so auto-healing would be a coin-flip between candidates.
47
47
  * Such a drift is surfaced (with a nearest) but never auto-healed.
48
48
  */
49
49
  export declare function nearestIsAmbiguous(missing: string, present: string[]): boolean;
50
+ /**
51
+ * Re-resolve any QUERY against the live DOM, tolerating an in-flight render: QUERY, and while it
52
+ * returns zero refs, sleep and retry up to ANCHOR_SETTLE_ATTEMPTS. Returns as soon as refs appear,
53
+ * so a present anchor costs one query; a genuinely missing one costs the full (bounded) settle and
54
+ * then drifts. The last result's near-miss hint is returned for the drift record.
55
+ */
56
+ export declare function resolveQuery(session: FlowReplaySession, queryArgs: Record<string, unknown>, sleep: Sleep): Promise<{
57
+ refs: string[];
58
+ hint?: QueryEmptyHint;
59
+ }>;
60
+ /** A compact, legible label for a component auto-anchor (component@file:line, or its best part). */
61
+ export declare function componentLabel(anchor: Extract<FlowAnchor, {
62
+ kind: typeof AnchorKind.COMPONENT;
63
+ }>): string;
64
+ /** QUERY args for a component auto-anchor — source (precise) + component name (coarse) as given. */
65
+ export declare function componentQueryArgs(anchor: Extract<FlowAnchor, {
66
+ kind: typeof AnchorKind.COMPONENT;
67
+ }>): Record<string, unknown>;
50
68
  /**
51
69
  * Replay a loaded flow by RE-RESOLVING every step's semantic anchor against the live DOM — never
52
70
  * a stale ref. A testid anchor is re-found by reticle_query; a signal anchor waits on a predicate.
@@ -54,5 +72,3 @@ export declare function nearestIsAmbiguous(missing: string, present: string[]):
54
72
  * results. This is the "whose fault is it" contract, not a blind "command failed".
55
73
  */
56
74
  export declare function replayFlow(session: FlowReplaySession, flow: FlowFile, waitForSignal: WaitForSignal, signalTimeoutMs: number, confirmDangerous?: boolean, sleep?: Sleep): Promise<FlowStepResult[]>;
57
- export {};
58
- //# sourceMappingURL=flow-replay.d.ts.map