@reticlehq/server 2.2.1 → 2.4.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 (790) 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 +102 -12
  6. package/dist/bridge.test-harness.d.ts +5 -1
  7. package/dist/bridge.test-harness.js +12 -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 +47 -3
  27. package/dist/cli-parse.js +147 -13
  28. package/dist/cli-port.d.ts +3 -1
  29. package/dist/cli-port.js +21 -1
  30. package/dist/cli-verify.d.ts +0 -1
  31. package/dist/cli-verify.js +1 -2
  32. package/dist/cli.d.ts +0 -1
  33. package/dist/cli.js +88 -69
  34. package/dist/cloud/cloud-config.d.ts +0 -1
  35. package/dist/cloud/cloud-config.js +0 -1
  36. package/dist/cloud/cloud-sync.d.ts +4 -5
  37. package/dist/cloud/cloud-sync.js +0 -1
  38. package/dist/cloud-cli.d.ts +0 -1
  39. package/dist/cloud-cli.js +9 -2
  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 +36 -24
  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 -7
  99. package/dist/flows/decision.js +47 -7
  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 +2 -3
  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 +44 -14
  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 +0 -1
  139. package/dist/flows/server-verify.js +0 -1
  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/capabilities.d.ts +17 -0
  167. package/dist/init/capabilities.js +51 -0
  168. package/dist/init/cursor.d.ts +0 -1
  169. package/dist/init/cursor.js +0 -1
  170. package/dist/init/desktop-doctor.d.ts +40 -0
  171. package/dist/init/desktop-doctor.js +198 -0
  172. package/dist/init/detect.d.ts +25 -1
  173. package/dist/init/detect.js +65 -4
  174. package/dist/init/mcp.d.ts +0 -1
  175. package/dist/init/mcp.js +0 -1
  176. package/dist/init/next-patch.d.ts +41 -0
  177. package/dist/init/next-patch.js +106 -0
  178. package/dist/init/node-io.d.ts +0 -1
  179. package/dist/init/node-io.js +25 -1
  180. package/dist/init/patch-kind.d.ts +20 -0
  181. package/dist/init/patch-kind.js +10 -0
  182. package/dist/init/plan-framework.d.ts +35 -0
  183. package/dist/init/plan-framework.js +217 -0
  184. package/dist/init/plan.d.ts +55 -4
  185. package/dist/init/plan.js +130 -112
  186. package/dist/init/project-id.d.ts +0 -1
  187. package/dist/init/project-id.js +0 -1
  188. package/dist/init/run.d.ts +17 -1
  189. package/dist/init/run.js +237 -18
  190. package/dist/init/slash-command.d.ts +18 -0
  191. package/dist/init/slash-command.js +52 -0
  192. package/dist/init/snippets.d.ts +48 -3
  193. package/dist/init/snippets.js +156 -6
  194. package/dist/init/vite-config.d.ts +4 -11
  195. package/dist/init/vite-config.js +15 -8
  196. package/dist/input/driven-redaction.d.ts +15 -0
  197. package/dist/input/driven-redaction.js +76 -0
  198. package/dist/input/network-detail.d.ts +9 -4
  199. package/dist/input/network-detail.js +35 -16
  200. package/dist/input/network-mock-tools.d.ts +0 -1
  201. package/dist/input/network-mock-tools.js +3 -4
  202. package/dist/input/network-mock.d.ts +0 -1
  203. package/dist/input/network-mock.js +0 -1
  204. package/dist/input/real-input.d.ts +14 -1
  205. package/dist/input/real-input.js +45 -3
  206. package/dist/input/scroll-find.d.ts +0 -1
  207. package/dist/input/scroll-find.js +0 -1
  208. package/dist/input/scroll-tools.d.ts +0 -1
  209. package/dist/input/scroll-tools.js +0 -1
  210. package/dist/input/viewport-tools.d.ts +0 -1
  211. package/dist/input/viewport-tools.js +3 -4
  212. package/dist/journal/ambient-store.d.ts +0 -1
  213. package/dist/journal/ambient-store.js +0 -1
  214. package/dist/journal/ambient.d.ts +0 -1
  215. package/dist/journal/ambient.js +0 -1
  216. package/dist/journal/attach-journal.d.ts +0 -1
  217. package/dist/journal/attach-journal.js +0 -1
  218. package/dist/journal/deviation-report.d.ts +0 -1
  219. package/dist/journal/deviation-report.js +0 -1
  220. package/dist/journal/deviation-service.d.ts +0 -1
  221. package/dist/journal/deviation-service.js +0 -1
  222. package/dist/journal/envelope-store.d.ts +0 -1
  223. package/dist/journal/envelope-store.js +0 -1
  224. package/dist/journal/envelope.d.ts +8 -9
  225. package/dist/journal/envelope.js +0 -1
  226. package/dist/journal/journal-query.d.ts +0 -1
  227. package/dist/journal/journal-query.js +0 -1
  228. package/dist/journal/journal-recorder.d.ts +0 -1
  229. package/dist/journal/journal-recorder.js +0 -1
  230. package/dist/journal/retention.d.ts +0 -1
  231. package/dist/journal/retention.js +0 -1
  232. package/dist/journal/rollups.d.ts +0 -1
  233. package/dist/journal/rollups.js +0 -1
  234. package/dist/journal/session-end.d.ts +0 -1
  235. package/dist/journal/session-end.js +0 -1
  236. package/dist/journal/session-journal.d.ts +0 -1
  237. package/dist/journal/session-journal.js +0 -1
  238. package/dist/license/license.d.ts +0 -1
  239. package/dist/license/license.js +0 -1
  240. package/dist/log.d.ts +0 -1
  241. package/dist/log.js +0 -1
  242. package/dist/mcp-proxy.d.ts +35 -4
  243. package/dist/mcp-proxy.js +174 -28
  244. package/dist/mcp.d.ts +15 -1
  245. package/dist/mcp.js +145 -17
  246. package/dist/oracles/flow-instrument-gaps.d.ts +0 -1
  247. package/dist/oracles/flow-instrument-gaps.js +0 -1
  248. package/dist/oracles/propose-consequences.d.ts +0 -1
  249. package/dist/oracles/propose-consequences.js +0 -1
  250. package/dist/oracles/self-instrument.d.ts +0 -1
  251. package/dist/oracles/self-instrument.js +0 -1
  252. package/dist/pairing-token.d.ts +0 -1
  253. package/dist/pairing-token.js +0 -1
  254. package/dist/phenomena/phenomena.d.ts +0 -1
  255. package/dist/phenomena/phenomena.js +0 -1
  256. package/dist/pool/browser-pool.d.ts +0 -1
  257. package/dist/pool/browser-pool.js +0 -1
  258. package/dist/pool/lease-reaper.d.ts +0 -1
  259. package/dist/pool/lease-reaper.js +0 -1
  260. package/dist/pool/playwright-launcher.d.ts +0 -1
  261. package/dist/pool/playwright-launcher.js +10 -2
  262. package/dist/project/baselines.d.ts +0 -1
  263. package/dist/project/baselines.js +0 -1
  264. package/dist/project/file-lock.d.ts +2 -1
  265. package/dist/project/file-lock.js +12 -2
  266. package/dist/project/fs-port.d.ts +0 -1
  267. package/dist/project/fs-port.js +0 -1
  268. package/dist/project/project-store.d.ts +0 -1
  269. package/dist/project/project-store.js +0 -1
  270. package/dist/project/project-tools.d.ts +0 -1
  271. package/dist/project/project-tools.js +29 -4
  272. package/dist/project/reticle-dir.d.ts +0 -1
  273. package/dist/project/reticle-dir.js +0 -1
  274. package/dist/runs/build-verification-run.d.ts +0 -1
  275. package/dist/runs/build-verification-run.js +0 -1
  276. package/dist/runs/profile-redact.d.ts +0 -1
  277. package/dist/runs/profile-redact.js +0 -1
  278. package/dist/runs/render-report.d.ts +0 -1
  279. package/dist/runs/render-report.js +0 -1
  280. package/dist/runs/repair-prompt.d.ts +0 -1
  281. package/dist/runs/repair-prompt.js +0 -1
  282. package/dist/runs/replay-mapping.d.ts +0 -1
  283. package/dist/runs/replay-mapping.js +0 -1
  284. package/dist/runs/reticle-runner.d.ts +0 -1
  285. package/dist/runs/reticle-runner.js +4 -2
  286. package/dist/runs/risk-classify.d.ts +0 -1
  287. package/dist/runs/risk-classify.js +0 -1
  288. package/dist/runs/run-diff.d.ts +0 -1
  289. package/dist/runs/run-diff.js +0 -1
  290. package/dist/runs/run-store.d.ts +0 -1
  291. package/dist/runs/run-store.js +0 -1
  292. package/dist/runs/run-tools.d.ts +0 -1
  293. package/dist/runs/run-tools.js +0 -1
  294. package/dist/runs/runner-port.d.ts +0 -1
  295. package/dist/runs/runner-port.js +0 -1
  296. package/dist/runs/verification-sync.d.ts +0 -1
  297. package/dist/runs/verification-sync.js +0 -1
  298. package/dist/runs/verify-http.d.ts +0 -1
  299. package/dist/runs/verify-http.js +0 -1
  300. package/dist/runs/verify-server.d.ts +0 -1
  301. package/dist/runs/verify-server.js +0 -1
  302. package/dist/server-version.d.ts +0 -1
  303. package/dist/server-version.js +0 -1
  304. package/dist/session/command-timeout.d.ts +35 -0
  305. package/dist/session/command-timeout.js +41 -0
  306. package/dist/session/control-envelope.d.ts +2 -3
  307. package/dist/session/control-envelope.js +2 -3
  308. package/dist/session/last-act.d.ts +31 -0
  309. package/dist/session/last-act.js +24 -0
  310. package/dist/session/live-control-tools.d.ts +0 -1
  311. package/dist/session/live-control-tools.js +3 -4
  312. package/dist/session/live-control.d.ts +0 -1
  313. package/dist/session/live-control.js +0 -1
  314. package/dist/session/observed-state.d.ts +12 -2
  315. package/dist/session/observed-state.js +29 -2
  316. package/dist/session/output-budget.d.ts +0 -1
  317. package/dist/session/output-budget.js +0 -1
  318. package/dist/session/pending-commands.d.ts +12 -0
  319. package/dist/session/pending-commands.js +36 -0
  320. package/dist/session/presenter-args.d.ts +0 -1
  321. package/dist/session/presenter-args.js +0 -1
  322. package/dist/session/review-store.d.ts +0 -1
  323. package/dist/session/review-store.js +0 -1
  324. package/dist/session/session-health.d.ts +26 -2
  325. package/dist/session/session-health.js +13 -1
  326. package/dist/session/session-info.d.ts +29 -0
  327. package/dist/session/session-info.js +1 -0
  328. package/dist/session/session-lease.d.ts +25 -0
  329. package/dist/session/session-lease.js +14 -0
  330. package/dist/session/session-manager.d.ts +7 -19
  331. package/dist/session/session-manager.js +35 -2
  332. package/dist/session/session-readiness.d.ts +0 -1
  333. package/dist/session/session-readiness.js +3 -4
  334. package/dist/session/session-reaper.d.ts +0 -1
  335. package/dist/session/session-reaper.js +0 -1
  336. package/dist/session/session-recommendation.d.ts +0 -1
  337. package/dist/session/session-recommendation.js +0 -1
  338. package/dist/session/session-tools.d.ts +0 -1
  339. package/dist/session/session-tools.js +2 -3
  340. package/dist/session/session.d.ts +33 -53
  341. package/dist/session/session.js +102 -66
  342. package/dist/session/state-select.d.ts +0 -1
  343. package/dist/session/state-select.js +0 -1
  344. package/dist/telemetry/argument-shape.d.ts +41 -0
  345. package/dist/telemetry/argument-shape.js +87 -0
  346. package/dist/telemetry/bug-found.d.ts +33 -0
  347. package/dist/telemetry/bug-found.js +95 -0
  348. package/dist/telemetry/cli-telemetry.d.ts +13 -0
  349. package/dist/telemetry/cli-telemetry.js +43 -0
  350. package/dist/telemetry/connect-failure.d.ts +16 -0
  351. package/dist/telemetry/connect-failure.js +44 -0
  352. package/dist/telemetry/daemon-telemetry.d.ts +19 -0
  353. package/dist/telemetry/daemon-telemetry.js +76 -0
  354. package/dist/telemetry/dev-repo.d.ts +10 -0
  355. package/dist/telemetry/dev-repo.js +80 -0
  356. package/dist/telemetry/error-fingerprint.d.ts +24 -0
  357. package/dist/telemetry/error-fingerprint.js +88 -0
  358. package/dist/telemetry/feedback-cli.d.ts +31 -0
  359. package/dist/telemetry/feedback-cli.js +102 -0
  360. package/dist/telemetry/feedback-context.d.ts +32 -0
  361. package/dist/telemetry/feedback-context.js +143 -0
  362. package/dist/telemetry/feedback.d.ts +66 -0
  363. package/dist/telemetry/feedback.js +175 -0
  364. package/dist/telemetry/git-facts.d.ts +21 -0
  365. package/dist/telemetry/git-facts.js +109 -0
  366. package/dist/telemetry/identify.d.ts +22 -0
  367. package/dist/telemetry/identify.js +73 -0
  368. package/dist/telemetry/init-telemetry.d.ts +26 -0
  369. package/dist/telemetry/init-telemetry.js +33 -0
  370. package/dist/telemetry/machine-snapshot.d.ts +6 -0
  371. package/dist/telemetry/machine-snapshot.js +39 -0
  372. package/dist/telemetry/mcp-connection.d.ts +5 -0
  373. package/dist/telemetry/mcp-connection.js +44 -0
  374. package/dist/telemetry/project-profile.d.ts +44 -0
  375. package/dist/telemetry/project-profile.js +205 -0
  376. package/dist/telemetry/run-telemetry.d.ts +21 -0
  377. package/dist/telemetry/run-telemetry.js +62 -0
  378. package/dist/telemetry/session-metrics.d.ts +103 -0
  379. package/dist/telemetry/session-metrics.js +329 -0
  380. package/dist/telemetry/telemetry.d.ts +35 -8
  381. package/dist/telemetry/telemetry.js +105 -12
  382. package/dist/token-auth.d.ts +0 -1
  383. package/dist/token-auth.js +0 -1
  384. package/dist/tools/act-capsule.d.ts +23 -0
  385. package/dist/tools/act-capsule.js +47 -0
  386. package/dist/tools/act-danger.d.ts +7 -0
  387. package/dist/tools/act-danger.js +44 -0
  388. package/dist/tools/act-helpers.d.ts +17 -0
  389. package/dist/tools/act-helpers.js +40 -0
  390. package/dist/tools/act-tools.d.ts +8 -1
  391. package/dist/tools/act-tools.js +96 -98
  392. package/dist/tools/act-view.d.ts +7 -1
  393. package/dist/tools/act-view.js +13 -1
  394. package/dist/tools/assert-grade.d.ts +22 -1
  395. package/dist/tools/assert-grade.js +46 -1
  396. package/dist/tools/assert-verdict.d.ts +21 -0
  397. package/dist/tools/assert-verdict.js +62 -0
  398. package/dist/tools/browser-tools.d.ts +0 -1
  399. package/dist/tools/browser-tools.js +2 -2
  400. package/dist/tools/contract-tools.d.ts +0 -1
  401. package/dist/tools/contract-tools.js +0 -1
  402. package/dist/tools/coverage-tools.d.ts +9 -0
  403. package/dist/tools/coverage-tools.js +92 -0
  404. package/dist/tools/dynamic-tools.d.ts +0 -1
  405. package/dist/tools/dynamic-tools.js +21 -2
  406. package/dist/tools/error-recovery.d.ts +18 -2
  407. package/dist/tools/error-recovery.js +42 -7
  408. package/dist/tools/feedback-tools.d.ts +24 -0
  409. package/dist/tools/feedback-tools.js +180 -0
  410. package/dist/tools/invoke-tool.d.ts +0 -1
  411. package/dist/tools/invoke-tool.js +115 -5
  412. package/dist/tools/lease-tools.d.ts +0 -1
  413. package/dist/tools/lease-tools.js +6 -5
  414. package/dist/tools/merge-tools.d.ts +0 -1
  415. package/dist/tools/merge-tools.js +0 -1
  416. package/dist/tools/observe-tools.d.ts +0 -1
  417. package/dist/tools/observe-tools.js +91 -39
  418. package/dist/tools/profiles.d.ts +1 -2
  419. package/dist/tools/profiles.js +43 -16
  420. package/dist/tools/query-paginate.d.ts +0 -1
  421. package/dist/tools/query-paginate.js +0 -1
  422. package/dist/tools/read-tools.d.ts +0 -1
  423. package/dist/tools/read-tools.js +14 -8
  424. package/dist/tools/reconcile-tools.d.ts +2 -0
  425. package/dist/tools/reconcile-tools.js +111 -0
  426. package/dist/tools/snapshot-delta.d.ts +0 -1
  427. package/dist/tools/snapshot-delta.js +0 -0
  428. package/dist/tools/tool-invoker.d.ts +0 -1
  429. package/dist/tools/tool-invoker.js +0 -1
  430. package/dist/tools/tool-kit.d.ts +16 -1
  431. package/dist/tools/tool-kit.js +8 -2
  432. package/dist/tools/tool-names.d.ts +6 -1
  433. package/dist/tools/tool-names.js +6 -1
  434. package/dist/tools/tools-helpers.d.ts +0 -1
  435. package/dist/tools/tools-helpers.js +0 -1
  436. package/dist/tools/tools.d.ts +0 -1
  437. package/dist/tools/tools.js +24 -4
  438. package/dist/update/update-checker.d.ts +0 -1
  439. package/dist/update/update-checker.js +0 -1
  440. package/dist/update/update-nudge.d.ts +20 -0
  441. package/dist/update/update-nudge.js +72 -0
  442. package/dist/update/updater.d.ts +14 -1
  443. package/dist/update/updater.js +33 -2
  444. package/dist/visual/visual-diff.d.ts +0 -1
  445. package/dist/visual/visual-diff.js +0 -1
  446. package/dist/visual/visual-store.d.ts +0 -1
  447. package/dist/visual/visual-store.js +0 -1
  448. package/dist/visual/visual-tools.d.ts +0 -1
  449. package/dist/visual/visual-tools.js +103 -16
  450. package/package.json +2 -2
  451. package/dist/bridge-security.d.ts.map +0 -1
  452. package/dist/bridge-security.js.map +0 -1
  453. package/dist/bridge.d.ts.map +0 -1
  454. package/dist/bridge.js.map +0 -1
  455. package/dist/bridge.test-harness.d.ts.map +0 -1
  456. package/dist/bridge.test-harness.js.map +0 -1
  457. package/dist/capsule/capsule-store.d.ts.map +0 -1
  458. package/dist/capsule/capsule-store.js.map +0 -1
  459. package/dist/capsule/capsule.d.ts.map +0 -1
  460. package/dist/capsule/capsule.js.map +0 -1
  461. package/dist/capsule/causal-summary.d.ts.map +0 -1
  462. package/dist/capsule/causal-summary.js.map +0 -1
  463. package/dist/capsule/divergence.d.ts.map +0 -1
  464. package/dist/capsule/divergence.js.map +0 -1
  465. package/dist/capsule/minimize.d.ts.map +0 -1
  466. package/dist/capsule/minimize.js.map +0 -1
  467. package/dist/capsule/predicate-to-links.d.ts.map +0 -1
  468. package/dist/capsule/predicate-to-links.js.map +0 -1
  469. package/dist/cli-flow-commands.d.ts.map +0 -1
  470. package/dist/cli-flow-commands.js.map +0 -1
  471. package/dist/cli-launch.d.ts.map +0 -1
  472. package/dist/cli-launch.js.map +0 -1
  473. package/dist/cli-parse.d.ts.map +0 -1
  474. package/dist/cli-parse.js.map +0 -1
  475. package/dist/cli-port.d.ts.map +0 -1
  476. package/dist/cli-port.js.map +0 -1
  477. package/dist/cli-verify.d.ts.map +0 -1
  478. package/dist/cli-verify.js.map +0 -1
  479. package/dist/cli.d.ts.map +0 -1
  480. package/dist/cli.js.map +0 -1
  481. package/dist/cloud/cloud-config.d.ts.map +0 -1
  482. package/dist/cloud/cloud-config.js.map +0 -1
  483. package/dist/cloud/cloud-sync.d.ts.map +0 -1
  484. package/dist/cloud/cloud-sync.js.map +0 -1
  485. package/dist/cloud-cli.d.ts.map +0 -1
  486. package/dist/cloud-cli.js.map +0 -1
  487. package/dist/crawl/crawl-tools.d.ts.map +0 -1
  488. package/dist/crawl/crawl-tools.js.map +0 -1
  489. package/dist/crawl/crawl.d.ts.map +0 -1
  490. package/dist/crawl/crawl.js.map +0 -1
  491. package/dist/daemon-resilience.d.ts.map +0 -1
  492. package/dist/daemon-resilience.js.map +0 -1
  493. package/dist/daemon.d.ts.map +0 -1
  494. package/dist/daemon.js.map +0 -1
  495. package/dist/domain/domain-model.d.ts.map +0 -1
  496. package/dist/domain/domain-model.js.map +0 -1
  497. package/dist/domain/domain-tools.d.ts.map +0 -1
  498. package/dist/domain/domain-tools.js.map +0 -1
  499. package/dist/domain/flow-risk.d.ts.map +0 -1
  500. package/dist/domain/flow-risk.js.map +0 -1
  501. package/dist/ee/audit-log.d.ts.map +0 -1
  502. package/dist/ee/audit-log.js.map +0 -1
  503. package/dist/events/event-filters.d.ts.map +0 -1
  504. package/dist/events/event-filters.js.map +0 -1
  505. package/dist/events/predicate-eval.d.ts.map +0 -1
  506. package/dist/events/predicate-eval.js.map +0 -1
  507. package/dist/events/predicate.d.ts.map +0 -1
  508. package/dist/events/predicate.js.map +0 -1
  509. package/dist/events/reaction.d.ts.map +0 -1
  510. package/dist/events/reaction.js.map +0 -1
  511. package/dist/events/ring-buffer.d.ts.map +0 -1
  512. package/dist/events/ring-buffer.js.map +0 -1
  513. package/dist/flows/affected.d.ts.map +0 -1
  514. package/dist/flows/affected.js.map +0 -1
  515. package/dist/flows/annotate-tools.d.ts.map +0 -1
  516. package/dist/flows/annotate-tools.js.map +0 -1
  517. package/dist/flows/annotate.d.ts.map +0 -1
  518. package/dist/flows/annotate.js.map +0 -1
  519. package/dist/flows/annotation-store.d.ts.map +0 -1
  520. package/dist/flows/annotation-store.js.map +0 -1
  521. package/dist/flows/assertion-integrity.d.ts.map +0 -1
  522. package/dist/flows/assertion-integrity.js.map +0 -1
  523. package/dist/flows/assertion-tiers-store.d.ts.map +0 -1
  524. package/dist/flows/assertion-tiers-store.js.map +0 -1
  525. package/dist/flows/buddy-status.d.ts.map +0 -1
  526. package/dist/flows/buddy-status.js.map +0 -1
  527. package/dist/flows/coverage.d.ts.map +0 -1
  528. package/dist/flows/coverage.js.map +0 -1
  529. package/dist/flows/decision.d.ts.map +0 -1
  530. package/dist/flows/decision.js.map +0 -1
  531. package/dist/flows/flake-store.d.ts.map +0 -1
  532. package/dist/flows/flake-store.js.map +0 -1
  533. package/dist/flows/flake.d.ts.map +0 -1
  534. package/dist/flows/flake.js.map +0 -1
  535. package/dist/flows/flow-classify.d.ts.map +0 -1
  536. package/dist/flows/flow-classify.js.map +0 -1
  537. package/dist/flows/flow-replay-run.d.ts.map +0 -1
  538. package/dist/flows/flow-replay-run.js.map +0 -1
  539. package/dist/flows/flow-replay.d.ts.map +0 -1
  540. package/dist/flows/flow-replay.js.map +0 -1
  541. package/dist/flows/flow-report.d.ts.map +0 -1
  542. package/dist/flows/flow-report.js.map +0 -1
  543. package/dist/flows/flow-scope.d.ts.map +0 -1
  544. package/dist/flows/flow-scope.js.map +0 -1
  545. package/dist/flows/flow-sources.d.ts.map +0 -1
  546. package/dist/flows/flow-sources.js.map +0 -1
  547. package/dist/flows/flow-success.d.ts.map +0 -1
  548. package/dist/flows/flow-success.js.map +0 -1
  549. package/dist/flows/flow-tools.d.ts.map +0 -1
  550. package/dist/flows/flow-tools.js.map +0 -1
  551. package/dist/flows/flows.d.ts.map +0 -1
  552. package/dist/flows/flows.js.map +0 -1
  553. package/dist/flows/gate.d.ts.map +0 -1
  554. package/dist/flows/gate.js.map +0 -1
  555. package/dist/flows/git-changed.d.ts.map +0 -1
  556. package/dist/flows/git-changed.js.map +0 -1
  557. package/dist/flows/heal-run.d.ts.map +0 -1
  558. package/dist/flows/heal-run.js.map +0 -1
  559. package/dist/flows/heal.d.ts.map +0 -1
  560. package/dist/flows/heal.js.map +0 -1
  561. package/dist/flows/parallel-suite.d.ts.map +0 -1
  562. package/dist/flows/parallel-suite.js.map +0 -1
  563. package/dist/flows/recordings.d.ts.map +0 -1
  564. package/dist/flows/recordings.js.map +0 -1
  565. package/dist/flows/replay.d.ts.map +0 -1
  566. package/dist/flows/replay.js.map +0 -1
  567. package/dist/flows/server-verify.d.ts.map +0 -1
  568. package/dist/flows/server-verify.js.map +0 -1
  569. package/dist/flows/watch-batcher.d.ts.map +0 -1
  570. package/dist/flows/watch-batcher.js.map +0 -1
  571. package/dist/honesty/blind-spots.d.ts.map +0 -1
  572. package/dist/honesty/blind-spots.js.map +0 -1
  573. package/dist/honesty/honesty.d.ts.map +0 -1
  574. package/dist/honesty/honesty.js.map +0 -1
  575. package/dist/http-server.d.ts.map +0 -1
  576. package/dist/http-server.js.map +0 -1
  577. package/dist/idle-shutdown.d.ts.map +0 -1
  578. package/dist/idle-shutdown.js.map +0 -1
  579. package/dist/index.d.ts.map +0 -1
  580. package/dist/index.js.map +0 -1
  581. package/dist/init/agent-rules.d.ts.map +0 -1
  582. package/dist/init/agent-rules.js.map +0 -1
  583. package/dist/init/cursor.d.ts.map +0 -1
  584. package/dist/init/cursor.js.map +0 -1
  585. package/dist/init/detect.d.ts.map +0 -1
  586. package/dist/init/detect.js.map +0 -1
  587. package/dist/init/mcp.d.ts.map +0 -1
  588. package/dist/init/mcp.js.map +0 -1
  589. package/dist/init/node-io.d.ts.map +0 -1
  590. package/dist/init/node-io.js.map +0 -1
  591. package/dist/init/plan.d.ts.map +0 -1
  592. package/dist/init/plan.js.map +0 -1
  593. package/dist/init/project-id.d.ts.map +0 -1
  594. package/dist/init/project-id.js.map +0 -1
  595. package/dist/init/run.d.ts.map +0 -1
  596. package/dist/init/run.js.map +0 -1
  597. package/dist/init/snippets.d.ts.map +0 -1
  598. package/dist/init/snippets.js.map +0 -1
  599. package/dist/init/vite-config.d.ts.map +0 -1
  600. package/dist/init/vite-config.js.map +0 -1
  601. package/dist/input/network-detail.d.ts.map +0 -1
  602. package/dist/input/network-detail.js.map +0 -1
  603. package/dist/input/network-mock-tools.d.ts.map +0 -1
  604. package/dist/input/network-mock-tools.js.map +0 -1
  605. package/dist/input/network-mock.d.ts.map +0 -1
  606. package/dist/input/network-mock.js.map +0 -1
  607. package/dist/input/real-input.d.ts.map +0 -1
  608. package/dist/input/real-input.js.map +0 -1
  609. package/dist/input/scroll-find.d.ts.map +0 -1
  610. package/dist/input/scroll-find.js.map +0 -1
  611. package/dist/input/scroll-tools.d.ts.map +0 -1
  612. package/dist/input/scroll-tools.js.map +0 -1
  613. package/dist/input/viewport-tools.d.ts.map +0 -1
  614. package/dist/input/viewport-tools.js.map +0 -1
  615. package/dist/journal/ambient-store.d.ts.map +0 -1
  616. package/dist/journal/ambient-store.js.map +0 -1
  617. package/dist/journal/ambient.d.ts.map +0 -1
  618. package/dist/journal/ambient.js.map +0 -1
  619. package/dist/journal/attach-journal.d.ts.map +0 -1
  620. package/dist/journal/attach-journal.js.map +0 -1
  621. package/dist/journal/deviation-report.d.ts.map +0 -1
  622. package/dist/journal/deviation-report.js.map +0 -1
  623. package/dist/journal/deviation-service.d.ts.map +0 -1
  624. package/dist/journal/deviation-service.js.map +0 -1
  625. package/dist/journal/envelope-store.d.ts.map +0 -1
  626. package/dist/journal/envelope-store.js.map +0 -1
  627. package/dist/journal/envelope.d.ts.map +0 -1
  628. package/dist/journal/envelope.js.map +0 -1
  629. package/dist/journal/journal-query.d.ts.map +0 -1
  630. package/dist/journal/journal-query.js.map +0 -1
  631. package/dist/journal/journal-recorder.d.ts.map +0 -1
  632. package/dist/journal/journal-recorder.js.map +0 -1
  633. package/dist/journal/retention.d.ts.map +0 -1
  634. package/dist/journal/retention.js.map +0 -1
  635. package/dist/journal/rollups.d.ts.map +0 -1
  636. package/dist/journal/rollups.js.map +0 -1
  637. package/dist/journal/session-end.d.ts.map +0 -1
  638. package/dist/journal/session-end.js.map +0 -1
  639. package/dist/journal/session-journal.d.ts.map +0 -1
  640. package/dist/journal/session-journal.js.map +0 -1
  641. package/dist/license/license.d.ts.map +0 -1
  642. package/dist/license/license.js.map +0 -1
  643. package/dist/log.d.ts.map +0 -1
  644. package/dist/log.js.map +0 -1
  645. package/dist/mcp-proxy.d.ts.map +0 -1
  646. package/dist/mcp-proxy.js.map +0 -1
  647. package/dist/mcp.d.ts.map +0 -1
  648. package/dist/mcp.js.map +0 -1
  649. package/dist/oracles/flow-instrument-gaps.d.ts.map +0 -1
  650. package/dist/oracles/flow-instrument-gaps.js.map +0 -1
  651. package/dist/oracles/propose-consequences.d.ts.map +0 -1
  652. package/dist/oracles/propose-consequences.js.map +0 -1
  653. package/dist/oracles/self-instrument.d.ts.map +0 -1
  654. package/dist/oracles/self-instrument.js.map +0 -1
  655. package/dist/pairing-token.d.ts.map +0 -1
  656. package/dist/pairing-token.js.map +0 -1
  657. package/dist/phenomena/phenomena.d.ts.map +0 -1
  658. package/dist/phenomena/phenomena.js.map +0 -1
  659. package/dist/pool/browser-pool.d.ts.map +0 -1
  660. package/dist/pool/browser-pool.js.map +0 -1
  661. package/dist/pool/lease-reaper.d.ts.map +0 -1
  662. package/dist/pool/lease-reaper.js.map +0 -1
  663. package/dist/pool/playwright-launcher.d.ts.map +0 -1
  664. package/dist/pool/playwright-launcher.js.map +0 -1
  665. package/dist/project/baselines.d.ts.map +0 -1
  666. package/dist/project/baselines.js.map +0 -1
  667. package/dist/project/file-lock.d.ts.map +0 -1
  668. package/dist/project/file-lock.js.map +0 -1
  669. package/dist/project/fs-port.d.ts.map +0 -1
  670. package/dist/project/fs-port.js.map +0 -1
  671. package/dist/project/project-store.d.ts.map +0 -1
  672. package/dist/project/project-store.js.map +0 -1
  673. package/dist/project/project-tools.d.ts.map +0 -1
  674. package/dist/project/project-tools.js.map +0 -1
  675. package/dist/project/reticle-dir.d.ts.map +0 -1
  676. package/dist/project/reticle-dir.js.map +0 -1
  677. package/dist/runs/build-verification-run.d.ts.map +0 -1
  678. package/dist/runs/build-verification-run.js.map +0 -1
  679. package/dist/runs/profile-redact.d.ts.map +0 -1
  680. package/dist/runs/profile-redact.js.map +0 -1
  681. package/dist/runs/render-report.d.ts.map +0 -1
  682. package/dist/runs/render-report.js.map +0 -1
  683. package/dist/runs/repair-prompt.d.ts.map +0 -1
  684. package/dist/runs/repair-prompt.js.map +0 -1
  685. package/dist/runs/replay-mapping.d.ts.map +0 -1
  686. package/dist/runs/replay-mapping.js.map +0 -1
  687. package/dist/runs/reticle-runner.d.ts.map +0 -1
  688. package/dist/runs/reticle-runner.js.map +0 -1
  689. package/dist/runs/risk-classify.d.ts.map +0 -1
  690. package/dist/runs/risk-classify.js.map +0 -1
  691. package/dist/runs/run-diff.d.ts.map +0 -1
  692. package/dist/runs/run-diff.js.map +0 -1
  693. package/dist/runs/run-store.d.ts.map +0 -1
  694. package/dist/runs/run-store.js.map +0 -1
  695. package/dist/runs/run-tools.d.ts.map +0 -1
  696. package/dist/runs/run-tools.js.map +0 -1
  697. package/dist/runs/runner-port.d.ts.map +0 -1
  698. package/dist/runs/runner-port.js.map +0 -1
  699. package/dist/runs/verification-sync.d.ts.map +0 -1
  700. package/dist/runs/verification-sync.js.map +0 -1
  701. package/dist/runs/verify-http.d.ts.map +0 -1
  702. package/dist/runs/verify-http.js.map +0 -1
  703. package/dist/runs/verify-server.d.ts.map +0 -1
  704. package/dist/runs/verify-server.js.map +0 -1
  705. package/dist/server-version.d.ts.map +0 -1
  706. package/dist/server-version.js.map +0 -1
  707. package/dist/session/control-envelope.d.ts.map +0 -1
  708. package/dist/session/control-envelope.js.map +0 -1
  709. package/dist/session/live-control-tools.d.ts.map +0 -1
  710. package/dist/session/live-control-tools.js.map +0 -1
  711. package/dist/session/live-control.d.ts.map +0 -1
  712. package/dist/session/live-control.js.map +0 -1
  713. package/dist/session/observed-state.d.ts.map +0 -1
  714. package/dist/session/observed-state.js.map +0 -1
  715. package/dist/session/output-budget.d.ts.map +0 -1
  716. package/dist/session/output-budget.js.map +0 -1
  717. package/dist/session/presenter-args.d.ts.map +0 -1
  718. package/dist/session/presenter-args.js.map +0 -1
  719. package/dist/session/review-store.d.ts.map +0 -1
  720. package/dist/session/review-store.js.map +0 -1
  721. package/dist/session/session-health.d.ts.map +0 -1
  722. package/dist/session/session-health.js.map +0 -1
  723. package/dist/session/session-manager.d.ts.map +0 -1
  724. package/dist/session/session-manager.js.map +0 -1
  725. package/dist/session/session-readiness.d.ts.map +0 -1
  726. package/dist/session/session-readiness.js.map +0 -1
  727. package/dist/session/session-reaper.d.ts.map +0 -1
  728. package/dist/session/session-reaper.js.map +0 -1
  729. package/dist/session/session-recommendation.d.ts.map +0 -1
  730. package/dist/session/session-recommendation.js.map +0 -1
  731. package/dist/session/session-tools.d.ts.map +0 -1
  732. package/dist/session/session-tools.js.map +0 -1
  733. package/dist/session/session.d.ts.map +0 -1
  734. package/dist/session/session.js.map +0 -1
  735. package/dist/session/state-select.d.ts.map +0 -1
  736. package/dist/session/state-select.js.map +0 -1
  737. package/dist/telemetry/telemetry.d.ts.map +0 -1
  738. package/dist/telemetry/telemetry.js.map +0 -1
  739. package/dist/token-auth.d.ts.map +0 -1
  740. package/dist/token-auth.js.map +0 -1
  741. package/dist/tools/act-tools.d.ts.map +0 -1
  742. package/dist/tools/act-tools.js.map +0 -1
  743. package/dist/tools/act-view.d.ts.map +0 -1
  744. package/dist/tools/act-view.js.map +0 -1
  745. package/dist/tools/assert-grade.d.ts.map +0 -1
  746. package/dist/tools/assert-grade.js.map +0 -1
  747. package/dist/tools/browser-tools.d.ts.map +0 -1
  748. package/dist/tools/browser-tools.js.map +0 -1
  749. package/dist/tools/contract-tools.d.ts.map +0 -1
  750. package/dist/tools/contract-tools.js.map +0 -1
  751. package/dist/tools/dynamic-tools.d.ts.map +0 -1
  752. package/dist/tools/dynamic-tools.js.map +0 -1
  753. package/dist/tools/error-recovery.d.ts.map +0 -1
  754. package/dist/tools/error-recovery.js.map +0 -1
  755. package/dist/tools/invoke-tool.d.ts.map +0 -1
  756. package/dist/tools/invoke-tool.js.map +0 -1
  757. package/dist/tools/lease-tools.d.ts.map +0 -1
  758. package/dist/tools/lease-tools.js.map +0 -1
  759. package/dist/tools/merge-tools.d.ts.map +0 -1
  760. package/dist/tools/merge-tools.js.map +0 -1
  761. package/dist/tools/observe-tools.d.ts.map +0 -1
  762. package/dist/tools/observe-tools.js.map +0 -1
  763. package/dist/tools/profiles.d.ts.map +0 -1
  764. package/dist/tools/profiles.js.map +0 -1
  765. package/dist/tools/query-paginate.d.ts.map +0 -1
  766. package/dist/tools/query-paginate.js.map +0 -1
  767. package/dist/tools/read-tools.d.ts.map +0 -1
  768. package/dist/tools/read-tools.js.map +0 -1
  769. package/dist/tools/snapshot-delta.d.ts.map +0 -1
  770. package/dist/tools/snapshot-delta.js.map +0 -1
  771. package/dist/tools/tool-invoker.d.ts.map +0 -1
  772. package/dist/tools/tool-invoker.js.map +0 -1
  773. package/dist/tools/tool-kit.d.ts.map +0 -1
  774. package/dist/tools/tool-kit.js.map +0 -1
  775. package/dist/tools/tool-names.d.ts.map +0 -1
  776. package/dist/tools/tool-names.js.map +0 -1
  777. package/dist/tools/tools-helpers.d.ts.map +0 -1
  778. package/dist/tools/tools-helpers.js.map +0 -1
  779. package/dist/tools/tools.d.ts.map +0 -1
  780. package/dist/tools/tools.js.map +0 -1
  781. package/dist/update/update-checker.d.ts.map +0 -1
  782. package/dist/update/update-checker.js.map +0 -1
  783. package/dist/update/updater.d.ts.map +0 -1
  784. package/dist/update/updater.js.map +0 -1
  785. package/dist/visual/visual-diff.d.ts.map +0 -1
  786. package/dist/visual/visual-diff.js.map +0 -1
  787. package/dist/visual/visual-store.d.ts.map +0 -1
  788. package/dist/visual/visual-store.js.map +0 -1
  789. package/dist/visual/visual-tools.d.ts.map +0 -1
  790. package/dist/visual/visual-tools.js.map +0 -1
@@ -1,12 +1,18 @@
1
- import { EventType, HumanControlDataSchema, HumanControlKind, HumanMarkDataSchema, ReticleCommand, MessageKind, PresenterTone, SESSION_HEALTH, SESSION_LEASE, SESSION_LIFECYCLE, SessionState, } from '@reticlehq/core';
1
+ import { LastAct } from './last-act.js';
2
+ import { commandTimeoutMessage } from './command-timeout.js';
3
+ import { readHealthEvent } from './session-health.js';
4
+ import { PendingCommands } from './pending-commands.js';
5
+ import { EventType, HumanControlDataSchema, HumanControlKind, HumanMarkDataSchema, ReticleCommand, MessageKind, parseEventPayload, PresenterTone, SESSION_HEALTH, SESSION_LEASE, SESSION_LIFECYCLE, SessionState, } from '@reticlehq/core';
2
6
  import { RingBuffer } from '../events/ring-buffer.js';
3
7
  import { filterEvents, mergeEventsBySeq, } from '../journal/journal-query.js';
4
8
  import {} from '../journal/ambient.js';
5
9
  import { ObservedState } from './observed-state.js';
10
+ import { recordBrowserLatency, recordSdkFailure } from '../telemetry/session-metrics.js';
6
11
  import { LiveControl } from './live-control.js';
7
12
  import { ReviewStore } from './review-store.js';
8
13
  import { buildSessionRecommendation } from './session-recommendation.js';
9
14
  import { buildPresenterArgs } from './presenter-args.js';
15
+ import { buildSessionLease } from './session-lease.js';
10
16
  const DEFAULT_COMMAND_TIMEOUT_MS = 8000;
11
17
  /** Prefix on correlated command ids (c1, c2, …) — distinguishes them from mark ids. */
12
18
  const COMMAND_ID_PREFIX = 'c';
@@ -26,19 +32,25 @@ export class Session {
26
32
  title;
27
33
  adapters;
28
34
  hasCapabilities;
35
+ /**
36
+ * Extra key names this app declared sensitive via `connect({ redact: { keys } })`. Held so the
37
+ * DRIVEN path can redact them too — a request body the daemon captures from the network stack
38
+ * never passes through the SDK, so nothing else would.
39
+ */
40
+ redactKeys;
29
41
  #socket;
30
42
  #clock;
31
43
  #startedAt;
32
44
  #buffer = new RingBuffer();
33
- #pending = new Map();
45
+ #pending = new PendingCommands();
34
46
  #listeners = new Set();
35
- #seq = 0;
36
47
  #actionSeq = 0;
37
48
  #lastSeenAt;
38
49
  #hidden = false;
50
+ /** Which shell the page reported (PAGE_HEALTH). Undefined until the first report lands. */
51
+ #runtime;
52
+ #engine;
39
53
  #focused = true;
40
- #lastActCursor;
41
- #lastActSource;
42
54
  /** Liveness: wall-clock of the last AGENT command (distinct from browser chatter / lastSeen). */
43
55
  #lastAgentActivityAt;
44
56
  /** Server-side mirror of the agent-tuned idle window, so the reaper honors reticle_session. */
@@ -64,6 +76,7 @@ export class Session {
64
76
  this.title = hello.title;
65
77
  this.adapters = hello.adapters;
66
78
  this.hasCapabilities = hello.hasCapabilities ?? false;
79
+ this.redactKeys = hello.redactKeys ?? [];
67
80
  this.#socket = socket;
68
81
  this.#clock = clock;
69
82
  this.#startedAt = clock();
@@ -82,10 +95,27 @@ export class Session {
82
95
  lastSeenMs() {
83
96
  return this.#clock() - this.#lastSeenAt;
84
97
  }
85
- /** Record the latest page visibility/focus state from a PAGE_HEALTH event. */
86
- applyHealth(hidden, focused) {
98
+ /**
99
+ * Record the latest page visibility/focus state from a PAGE_HEALTH event.
100
+ *
101
+ * `runtime` is optional so an older SDK (which does not report it) still works — it simply loses
102
+ * the desktop-specific timeout diagnosis rather than breaking.
103
+ */
104
+ applyHealth(hidden, focused, runtime, engine) {
87
105
  this.#hidden = hidden;
88
106
  this.#focused = focused;
107
+ if (runtime === 'electron' || runtime === 'tauri' || runtime === 'web') {
108
+ this.#runtime = runtime;
109
+ }
110
+ if (engine !== undefined)
111
+ this.#engine = engine;
112
+ }
113
+ /** The shell (web/electron/tauri) and rendering engine the SDK reported. Undefined on an older SDK. */
114
+ get runtime() {
115
+ return this.#runtime;
116
+ }
117
+ get engine() {
118
+ return this.#engine;
89
119
  }
90
120
  /** Throttled if the tab is hidden OR we have not heard from it recently. */
91
121
  throttled() {
@@ -120,14 +150,14 @@ export class Session {
120
150
  if (this.staleMs() > SESSION_LEASE.STALE_AFTER_MS) {
121
151
  base.stale = true;
122
152
  base.cleanup_suggestion =
123
- 'Call reticle_end_session to free this session before starting new work.';
153
+ 'Call reticle_session{action:"end"} to free this session before starting new work.';
124
154
  }
125
155
  // Surface human bug reports in reticle_sessions (only when > 0, so a clean session adds nothing).
126
156
  const marks = this.#review.pendingCount();
127
157
  if (marks > 0) {
128
158
  base.pendingMarks = marks;
129
159
  const s = marks === 1 ? '' : 's';
130
- base.review_suggestion = `The human flagged ${String(marks)} issue${s} on this tab — call reticle_review to see and fix ${marks === 1 ? 'it' : 'them'}.`;
160
+ base.review_suggestion = `The human flagged ${String(marks)} issue${s} on this tab — call reticle_session{action:"review"} to see and fix ${marks === 1 ? 'it' : 'them'}.`;
131
161
  }
132
162
  return base;
133
163
  }
@@ -138,10 +168,15 @@ export class Session {
138
168
  /** Re-stamp an incoming event with server-relative time, buffer it, and fan out. */
139
169
  pushEvent(event, byteSize) {
140
170
  if (event.type === EventType.PAGE_HEALTH) {
141
- const data = event.data;
142
- const hidden = typeof data['hidden'] === 'boolean' ? data['hidden'] : this.#hidden;
143
- const focused = typeof data['focused'] === 'boolean' ? data['focused'] : this.#focused;
144
- this.applyHealth(hidden, focused);
171
+ const r = readHealthEvent(event.data);
172
+ this.applyHealth(r.hidden ?? this.#hidden, r.focused ?? this.#focused, r.runtime, r.engine);
173
+ }
174
+ // The in-page half of Reticle reporting its own failure — recorded like a tool error
175
+ // (fingerprinted, variables stripped) so a broken observer is as visible as a broken tool.
176
+ if (event.type === EventType.SDK_FAILED) {
177
+ const sdk = parseEventPayload(EventType.SDK_FAILED, event.data);
178
+ if (sdk.success)
179
+ recordSdkFailure(sdk.data);
145
180
  }
146
181
  if (event.type === EventType.HUMAN_CONTROL) {
147
182
  // Narrow unknown at the boundary; an invalid/unknown control is ignored (never thrown).
@@ -178,7 +213,17 @@ export class Session {
178
213
  for (const listener of this.#listeners)
179
214
  listener(attributed);
180
215
  }
181
- /** Latest count per blind-spot kind; survives buffer eviction. See ObservedState for why. */
216
+ // Passthroughs to ObservedState, which owns the per-session facts that must SURVIVE buffer
217
+ // eviction: refs the agent drove, and what the layer could not see. See observed-state.ts.
218
+ recordActedRef(ref) {
219
+ this.#observed.recordActedRef(ref);
220
+ }
221
+ actedRefs() {
222
+ return this.#observed.actedRefs();
223
+ }
224
+ noteRateLimited(dropped) {
225
+ this.#observed.noteRateLimited(dropped);
226
+ }
182
227
  blindSpots() {
183
228
  return this.#observed.blindSpots();
184
229
  }
@@ -241,24 +286,12 @@ export class Session {
241
286
  return this.#buffer.since(cursor);
242
287
  }
243
288
  /**
244
- * Honesty: remember the event cursor of the most recent act so wait_for/assert can default their
245
- * evaluation floor to it — a signal buffered before this act can never fake a later pass.
289
+ * What the most recent act was: its cursor, its source, and what it changed inside its target.
290
+ *
291
+ * Exposed as the object rather than six pass-through methods — act writes to it and observe reads
292
+ * from it, and the split between those two tool calls is the whole reason it exists.
246
293
  */
247
- markActCursor(cursor) {
248
- this.#lastActCursor = cursor;
249
- }
250
- /** The cursor of the last act, or undefined if nothing has acted yet. */
251
- lastActCursor() {
252
- return this.#lastActCursor;
253
- }
254
- /** Remember where the last acted control is written (`file:line`), for failures with no element. */
255
- markActSource(source) {
256
- this.#lastActSource = source;
257
- }
258
- /** Where the last acted control is written, or undefined if nothing has acted yet. */
259
- lastActSource() {
260
- return this.#lastActSource;
261
- }
294
+ lastAct = new LastAct();
262
295
  // ── Server-authoritative liveness (immune to browser-tab throttling) ──────────────
263
296
  /**
264
297
  * Stamp the wall-clock of the latest AGENT command (called whenever a tool resolves this session).
@@ -309,8 +342,16 @@ export class Session {
309
342
  }
310
343
  /** Send a command to the browser and await its reply (or time out). */
311
344
  command(name, args = {}, timeoutMs = DEFAULT_COMMAND_TIMEOUT_MS) {
312
- this.#seq += 1;
313
- const id = `${COMMAND_ID_PREFIX}${String(this.#seq)}`;
345
+ // Recorded HERE rather than at the tool call sites: this is the one place every driven action
346
+ // passes through, so act_sequence and flow replay count too. Doing it per-tool missed both, and
347
+ // an under-counted "exercised" reports worse coverage than reality — the safe direction, but
348
+ // still wrong, and it made the number depend on which tool the agent happened to use.
349
+ if (name === ReticleCommand.ACT) {
350
+ const ref = args['ref'];
351
+ if (typeof ref === 'string')
352
+ this.recordActedRef(ref);
353
+ }
354
+ const id = this.#pending.nextId(COMMAND_ID_PREFIX);
314
355
  const payload = JSON.stringify({
315
356
  kind: MessageKind.COMMAND,
316
357
  id,
@@ -318,30 +359,24 @@ export class Session {
318
359
  name,
319
360
  args,
320
361
  });
321
- return new Promise((resolve, reject) => {
322
- const timer = setTimeout(() => {
323
- this.#pending.delete(id);
324
- reject(new Error(`command '${name}' timed out after ${String(timeoutMs)}ms`));
325
- }, timeoutMs);
326
- this.#pending.set(id, { resolve, reject, timer });
327
- this.#socket.send(payload);
328
- });
362
+ // The timeout message is built LAZILY: health can change while a command is in flight, and the
363
+ // diagnosis should describe the page as it was when the command actually gave up.
364
+ const awaited = this.#pending.track(id, timeoutMs, () => commandTimeoutMessage(name, timeoutMs, {
365
+ url: this.url,
366
+ hidden: this.#hidden,
367
+ lastSeenMs: this.lastSeenMs(),
368
+ ...(this.#runtime === undefined ? {} : { runtime: this.#runtime }),
369
+ }));
370
+ this.#socket.send(payload);
371
+ const sentAt = Date.now(); // browser-leg timing; see recordBrowserLatency for why it is split out
372
+ return awaited.finally(() => recordBrowserLatency(Date.now() - sentAt));
329
373
  }
330
374
  handleResult(result) {
331
- const pending = this.#pending.get(result.id);
332
- if (pending === undefined)
333
- return;
334
- clearTimeout(pending.timer);
335
- this.#pending.delete(result.id);
336
- pending.resolve(result);
375
+ this.#pending.settle(result);
337
376
  }
338
377
  /** Reject everything still in flight — used on disconnect. */
339
378
  rejectAll(reason) {
340
- for (const [id, pending] of this.#pending) {
341
- clearTimeout(pending.timer);
342
- pending.reject(new Error(reason));
343
- this.#pending.delete(id);
344
- }
379
+ this.#pending.rejectAll(reason);
345
380
  }
346
381
  /** End this transport without letting a stale socket remove its replacement session. */
347
382
  disconnect(reason) {
@@ -424,20 +459,12 @@ export class Session {
424
459
  pushNarration(text) {
425
460
  this.#post(ReticleCommand.NARRATE, { text, level: 'info' });
426
461
  }
427
- /**
428
- * Returns the one-time session lease block on the very first agent command, then undefined
429
- * forever after. The lease carries an IMPORTANT reminder to call reticle_end_session. Coding agents
430
- * (Claude Code, Codex) read tool results — they will see this and remember to clean up.
431
- */
462
+ /** The one-time lease block on the first agent command, then undefined forever after. */
432
463
  takeSessionLease() {
433
464
  if (this.#firstCommandDone)
434
465
  return undefined;
435
466
  this.#firstCommandDone = true;
436
- return {
437
- sessionId: this.id,
438
- opened_at: this.#startedAt,
439
- IMPORTANT: 'MANDATORY: the moment you stop driving — finishing a reply or waiting on the human — call reticle_session {action:"yield", mode:"waiting"} (or mode:"ask" with your question) so the panel never falsely reads "live". Call reticle_session {action:"end"} only when the whole task is done. The session revives on your next action.',
440
- };
467
+ return buildSessionLease(this.id, this.#startedAt);
441
468
  }
442
469
  /**
443
470
  * Returns a human-readable age warning after SESSION_LEASE.WARN_AFTER_MS (10 min), else undefined.
@@ -449,14 +476,24 @@ export class Session {
449
476
  if (ageMs < SESSION_LEASE.WARN_AFTER_MS)
450
477
  return undefined;
451
478
  const minutes = Math.floor(ageMs / 60_000);
452
- return `Session ${this.id} has been open for ${String(minutes)} minutes. If your task is complete, call reticle_end_session now.`;
479
+ return `Session ${this.id} has been open for ${String(minutes)} minutes. If your task is complete, call reticle_session{action:"end"} now.`;
453
480
  }
454
481
  /** Fire-and-forget command send — NOT registered in #pending (no correlated result expected). */
455
482
  #post(name, args) {
456
483
  if (this.#socket.readyState !== WS_OPEN)
457
484
  return;
458
- this.#seq += 1;
459
- const id = `${COMMAND_ID_PREFIX}${String(this.#seq)}`;
485
+ // Shares the same counter as tracked commands, so a fire-and-forget id can never collide with
486
+ // one that IS awaiting a reply.
487
+ // Recorded HERE rather than at the tool call sites: this is the one place every driven action
488
+ // passes through, so act_sequence and flow replay count too. Doing it per-tool missed both, and
489
+ // an under-counted "exercised" reports worse coverage than reality — the safe direction, but
490
+ // still wrong, and it made the number depend on which tool the agent happened to use.
491
+ if (name === ReticleCommand.ACT) {
492
+ const ref = args['ref'];
493
+ if (typeof ref === 'string')
494
+ this.recordActedRef(ref);
495
+ }
496
+ const id = this.#pending.nextId(COMMAND_ID_PREFIX);
460
497
  const payload = JSON.stringify({
461
498
  kind: MessageKind.COMMAND,
462
499
  id,
@@ -478,4 +515,3 @@ export class Session {
478
515
  * units under the file-size cap.
479
516
  */
480
517
  export { SessionManager } from './session-manager.js';
481
- //# sourceMappingURL=session.js.map
@@ -5,4 +5,3 @@
5
5
  * (an older browser that returns the whole store) and for the predicate engine's `state` assertion.
6
6
  */
7
7
  export { selectPath, capDepth, type PathSelection } from '@reticlehq/core';
8
- //# sourceMappingURL=state-select.d.ts.map
@@ -5,4 +5,3 @@
5
5
  * (an older browser that returns the whole store) and for the predicate engine's `state` assertion.
6
6
  */
7
7
  export { selectPath, capDepth } from '@reticlehq/core';
8
- //# sourceMappingURL=state-select.js.map
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Which flags and parameters people actually use — WITHOUT ever sending what they set them to.
3
+ *
4
+ * This is the most dangerous data in the product to collect, and the split that makes it safe is
5
+ * NAMES versus VALUES:
6
+ *
7
+ * - A flag or parameter NAME comes from a closed vocabulary we wrote ourselves. `--headed`,
8
+ * `--port`, `ref`, `timeout_ms` — there are a few dozen, none of them describe the user, and
9
+ * knowing which ones get used is the whole product question ("is anyone passing `fullPage`?
10
+ * does anybody use `--storage-state`?").
11
+ * - A VALUE is the user's. `--http-token` holds a secret. `--drive` holds a URL. `reticle_act`'s
12
+ * `args` holds the text being typed into the app, which on a login form is a password. A rule
13
+ * like "send short values, they're probably enums" would leak all three.
14
+ *
15
+ * So values are never sent, with one narrow exception: a handful of parameters whose values ARE our
16
+ * own enums, listed explicitly below. `action: "click"` is our vocabulary, not the user's, and it
17
+ * answers a real question. Membership in that list is opt-in per parameter and each entry names the
18
+ * exact values allowed — anything outside the list is reported as `other`, so a schema change can
19
+ * never quietly start forwarding free text.
20
+ */
21
+ export declare const OTHER_VALUE = "other";
22
+ /** True for anything we are willing to report a value for. */
23
+ export declare function isSafeEnumParam(name: string): boolean;
24
+ /**
25
+ * The reportable form of one parameter: `name` on its own, or `name:value` when the parameter is a
26
+ * known enum. Never the raw value of anything else.
27
+ */
28
+ export declare function describeParam(name: string, value: unknown): string;
29
+ /** Every parameter an agent actually passed to one tool call, reduced to names (+ safe enums). */
30
+ export declare function describeToolParams(args: Record<string, unknown>): string[];
31
+ /**
32
+ * The flags PRESENT on a CLI invocation, by name only.
33
+ *
34
+ * Values are dropped without exception here — no enum allowlist — because the CLI's flag values are
35
+ * uniformly the user's: a port, a URL, a file path, a pairing token. `--http-token` alone is reason
36
+ * enough to make this rule absolute rather than case-by-case.
37
+ *
38
+ * Anything not starting with `--` is an argument, not a flag, and is dropped entirely: that is where
39
+ * the URL, the file list, and the feedback message live.
40
+ */
41
+ export declare function describeCliFlags(argv: readonly string[]): string[];
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Which flags and parameters people actually use — WITHOUT ever sending what they set them to.
3
+ *
4
+ * This is the most dangerous data in the product to collect, and the split that makes it safe is
5
+ * NAMES versus VALUES:
6
+ *
7
+ * - A flag or parameter NAME comes from a closed vocabulary we wrote ourselves. `--headed`,
8
+ * `--port`, `ref`, `timeout_ms` — there are a few dozen, none of them describe the user, and
9
+ * knowing which ones get used is the whole product question ("is anyone passing `fullPage`?
10
+ * does anybody use `--storage-state`?").
11
+ * - A VALUE is the user's. `--http-token` holds a secret. `--drive` holds a URL. `reticle_act`'s
12
+ * `args` holds the text being typed into the app, which on a login form is a password. A rule
13
+ * like "send short values, they're probably enums" would leak all three.
14
+ *
15
+ * So values are never sent, with one narrow exception: a handful of parameters whose values ARE our
16
+ * own enums, listed explicitly below. `action: "click"` is our vocabulary, not the user's, and it
17
+ * answers a real question. Membership in that list is opt-in per parameter and each entry names the
18
+ * exact values allowed — anything outside the list is reported as `other`, so a schema change can
19
+ * never quietly start forwarding free text.
20
+ */
21
+ import { ActionType, FeedbackKind, QueryBy, SnapshotMode } from '@reticlehq/core';
22
+ /**
23
+ * Parameters whose values are enums WE define, and the exact values allowed on the wire. An
24
+ * unrecognized value reports `other` rather than itself; that fallback is what makes this safe
25
+ * against a future where one of these params starts accepting free text.
26
+ */
27
+ const SAFE_ENUM_PARAMS = new Map([
28
+ // Every entry DERIVED from the enum core already owns, never hand-listed. The first version listed
29
+ // them literally and was wrong on the day it shipped, not merely at risk: `action` was missing
30
+ // `fill`, `dblclick`, `submit`, `scrollIntoView`, `drag` and `webmcp` — so `fill`, one of the most
31
+ // common actions there is, silently reported as `other` — while carrying a `scroll` that
32
+ // `ActionType` does not define. `mode` mixed SnapshotMode with unrelated session-lifecycle values.
33
+ // Deriving is not tidiness here; it is the difference between the data being right and being wrong.
34
+ ['action', new Set(Object.values(ActionType))],
35
+ ['by', new Set(Object.values(QueryBy))],
36
+ ['mode', new Set(Object.values(SnapshotMode))],
37
+ ['kind', new Set(Object.values(FeedbackKind))],
38
+ // `level` has no core enum — console levels come from the DOM console API, not from us. Listed
39
+ // literally BECAUSE there is nothing to derive from, which is a different situation from the four
40
+ // above and the reason it is called out rather than left looking like an oversight.
41
+ ['level', new Set(['error', 'warn', 'info', 'log', 'debug'])],
42
+ ]);
43
+ export const OTHER_VALUE = 'other';
44
+ /** True for anything we are willing to report a value for. */
45
+ export function isSafeEnumParam(name) {
46
+ return SAFE_ENUM_PARAMS.has(name);
47
+ }
48
+ /**
49
+ * The reportable form of one parameter: `name` on its own, or `name:value` when the parameter is a
50
+ * known enum. Never the raw value of anything else.
51
+ */
52
+ export function describeParam(name, value) {
53
+ const allowed = SAFE_ENUM_PARAMS.get(name);
54
+ if (allowed === undefined)
55
+ return name;
56
+ if (typeof value !== 'string')
57
+ return name;
58
+ return `${name}:${allowed.has(value) ? value : OTHER_VALUE}`;
59
+ }
60
+ /** Every parameter an agent actually passed to one tool call, reduced to names (+ safe enums). */
61
+ export function describeToolParams(args) {
62
+ return Object.keys(args)
63
+ .filter((key) => args[key] !== undefined)
64
+ .map((key) => describeParam(key, args[key]))
65
+ .sort();
66
+ }
67
+ /**
68
+ * The flags PRESENT on a CLI invocation, by name only.
69
+ *
70
+ * Values are dropped without exception here — no enum allowlist — because the CLI's flag values are
71
+ * uniformly the user's: a port, a URL, a file path, a pairing token. `--http-token` alone is reason
72
+ * enough to make this rule absolute rather than case-by-case.
73
+ *
74
+ * Anything not starting with `--` is an argument, not a flag, and is dropped entirely: that is where
75
+ * the URL, the file list, and the feedback message live.
76
+ */
77
+ export function describeCliFlags(argv) {
78
+ const flags = new Set();
79
+ for (const arg of argv) {
80
+ if (!arg.startsWith('--'))
81
+ continue;
82
+ // `--port=9000` — split so the NAME is reported and the value is discarded with everything else.
83
+ const name = arg.split('=')[0] ?? arg;
84
+ flags.add(name);
85
+ }
86
+ return [...flags].sort();
87
+ }
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Counting the defects Reticle actually finds.
3
+ *
4
+ * Every other metric in this product measures whether Reticle is USED. This one measures whether it
5
+ * WORKS — and it is the only number that can honestly be put in front of an investor or published,
6
+ * because it counts outcomes for users rather than activity by them.
7
+ *
8
+ * It is read off tool RESULTS at the single chokepoint every tool already crosses, rather than
9
+ * emitted from the four places that produce findings. That is deliberate: the detectors are pure
10
+ * functions and should stay that way, and reading results means a fifth source of findings is covered
11
+ * the day it starts returning one of these shapes, instead of the day someone remembers to instrument
12
+ * it.
13
+ *
14
+ * What is sent is the KIND from Reticle's own findings vocabulary — `signal-contradicted`,
15
+ * `console-error`, `duplicate-request`. Never a selector, a URL, an element, or a description of
16
+ * anyone's app: that a class of defect was found, never what it was found in.
17
+ */
18
+ import { type BugFound } from '@reticlehq/core';
19
+ /**
20
+ * A defect as the CLASSIFIER sees it — everything except `repeat`.
21
+ *
22
+ * Whether a kind is new belongs to the session, and these detectors are pure functions that know
23
+ * nothing about sessions and should stay that way. The emission site owns the dedup flag.
24
+ */
25
+ export type BugCandidate = Omit<BugFound, 'repeat'>;
26
+ /**
27
+ * The defects in one tool result.
28
+ *
29
+ * Ordering matters for the false-green flag: a contradiction found alongside a PASSING assertion is
30
+ * the case the product exists for — the screen looked right, the write failed, and every other tool
31
+ * on the market would have called it green. That pairing is what `falseGreen` marks.
32
+ */
33
+ export declare function bugsInResult(toolName: string, result: Record<string, unknown>): BugCandidate[];
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Counting the defects Reticle actually finds.
3
+ *
4
+ * Every other metric in this product measures whether Reticle is USED. This one measures whether it
5
+ * WORKS — and it is the only number that can honestly be put in front of an investor or published,
6
+ * because it counts outcomes for users rather than activity by them.
7
+ *
8
+ * It is read off tool RESULTS at the single chokepoint every tool already crosses, rather than
9
+ * emitted from the four places that produce findings. That is deliberate: the detectors are pure
10
+ * functions and should stay that way, and reading results means a fifth source of findings is covered
11
+ * the day it starts returning one of these shapes, instead of the day someone remembers to instrument
12
+ * it.
13
+ *
14
+ * What is sent is the KIND from Reticle's own findings vocabulary — `signal-contradicted`,
15
+ * `console-error`, `duplicate-request`. Never a selector, a URL, an element, or a description of
16
+ * anyone's app: that a class of defect was found, never what it was found in.
17
+ */
18
+ import { BugSource, ContradictionKind } from '@reticlehq/core';
19
+ /** Cap per tool call — a pathological crawl must not turn one call into a thousand events. */
20
+ const MAX_BUGS_PER_CALL = 25;
21
+ function kindsOf(value) {
22
+ if (!Array.isArray(value))
23
+ return [];
24
+ return value
25
+ .map((entry) => {
26
+ const kind = entry?.kind;
27
+ return typeof kind === 'string' ? kind : undefined;
28
+ })
29
+ .filter((kind) => kind !== undefined);
30
+ }
31
+ /**
32
+ * The defects in one tool result.
33
+ *
34
+ * Ordering matters for the false-green flag: a contradiction found alongside a PASSING assertion is
35
+ * the case the product exists for — the screen looked right, the write failed, and every other tool
36
+ * on the market would have called it green. That pairing is what `falseGreen` marks.
37
+ */
38
+ export function bugsInResult(toolName, result) {
39
+ const bugs = [];
40
+ const passed = result['pass'] === true;
41
+ // 1. Contradictions — channels disagreeing. Invisible to a human watching the screen.
42
+ for (const kind of kindsOf(result['contradictions'])) {
43
+ bugs.push({ source: BugSource.CONTRADICTION, kind, falseGreen: passed, tool: toolName });
44
+ }
45
+ // 2. Crawl anomalies — found autonomously, with nobody writing a test. Crawl reports its own
46
+ // contradictions inside `anomalies` too, so classify by kind rather than by which array it sat in.
47
+ for (const kind of kindsOf(result['anomalies'])) {
48
+ bugs.push({
49
+ source: BugSource.CRAWL,
50
+ kind,
51
+ // A crawl contradiction presents as success too — the click looked fine and its write did not
52
+ // — even though no assertion was made. See the definition on `falseGreen`.
53
+ falseGreen: CONTRADICTION_KINDS.has(kind),
54
+ tool: toolName,
55
+ });
56
+ }
57
+ // 3. A failed assertion — the agent declared a consequence and it did not hold.
58
+ // Only when nothing above already explained it, or one defect would be counted twice.
59
+ if (result['pass'] === false && bugs.length === 0) {
60
+ const reason = result['assertion'];
61
+ bugs.push({
62
+ source: BugSource.ASSERTION,
63
+ kind: typeof reason === 'string' && reason.length > 0 ? reason.slice(0, 64) : 'assertion-failed',
64
+ falseGreen: false,
65
+ tool: toolName,
66
+ });
67
+ }
68
+ // 4. Replay failures — a saved flow that used to pass no longer does. That is a regression caught,
69
+ // which is a different and stronger claim than "a check failed".
70
+ if (result['status'] === 'fail' && Array.isArray(result['failures'])) {
71
+ for (const _failure of result['failures'].slice(0, MAX_BUGS_PER_CALL)) {
72
+ bugs.push({
73
+ source: BugSource.REPLAY,
74
+ kind: 'flow-regression',
75
+ falseGreen: false,
76
+ tool: toolName,
77
+ });
78
+ }
79
+ }
80
+ return bugs.slice(0, MAX_BUGS_PER_CALL);
81
+ }
82
+ /**
83
+ * Crawl anomaly kinds that are CONTRADICTIONS rather than single-channel faults.
84
+ *
85
+ * `reticle_crawl` returns both classes in one `anomalies` array — a console error is one channel
86
+ * complaining, while a UI that advanced over a failed write is two channels disagreeing. Only the
87
+ * second presents as success, and collapsing them would inflate the one claim that has to be exact.
88
+ *
89
+ * DERIVED from core's `ContradictionKind`, never hand-listed. The first version copied the twelve
90
+ * strings into a literal here, which matched on the day it was written and would have silently
91
+ * misclassified the thirteenth: a new contradiction kind would have been counted as an ordinary
92
+ * fault, quietly deflating the exact number we intend to publish. A copied enum is a drift hazard
93
+ * wherever it appears; it is a correctness hazard when the thing that drifts is a public claim.
94
+ */
95
+ const CONTRADICTION_KINDS = new Set(Object.values(ContradictionKind));
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Report that a person ran a `reticle` subcommand.
3
+ *
4
+ * `_daemon` is EXCLUDED, and that exclusion is the whole point of this function. `reticle mcp` and
5
+ * `reticle serve` start the daemon by re-running this very binary, so the child re-entered the CLI
6
+ * entry point and emitted a second event for what a person experienced as ONE action. The old
7
+ * `invoke` metric was therefore inflated ~2x — and inflated worst on the agent-driven sessions that
8
+ * matter most, while one-shot commands like `version` counted once. That skewed the RATIO between
9
+ * commands, not merely the scale, which is the kind of error you cannot correct for after the fact.
10
+ * The daemon\'s own lifecycle is already reported by `daemon_started` / `daemon_stopped`; a spawned
11
+ * daemon is not a CLI run.
12
+ */
13
+ export declare function reportCliRun(argv: readonly string[]): void;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The one telemetry event a human directly causes: they typed a `reticle` command.
3
+ *
4
+ * Lives in its own module so `cli.ts` stays a dispatcher, and so the `_daemon` exclusion below sits
5
+ * next to the explanation of why it exists rather than buried in a startup function.
6
+ */
7
+ import { TelemetryActor, TelemetryEventKind } from '@reticlehq/core';
8
+ import { DAEMON_INNER_COMMAND, knownCommand } from '../cli-parse.js';
9
+ import { getTelemetry } from './telemetry.js';
10
+ import { describeCliFlags } from './argument-shape.js';
11
+ /**
12
+ * Report that a person ran a `reticle` subcommand.
13
+ *
14
+ * `_daemon` is EXCLUDED, and that exclusion is the whole point of this function. `reticle mcp` and
15
+ * `reticle serve` start the daemon by re-running this very binary, so the child re-entered the CLI
16
+ * entry point and emitted a second event for what a person experienced as ONE action. The old
17
+ * `invoke` metric was therefore inflated ~2x — and inflated worst on the agent-driven sessions that
18
+ * matter most, while one-shot commands like `version` counted once. That skewed the RATIO between
19
+ * commands, not merely the scale, which is the kind of error you cannot correct for after the fact.
20
+ * The daemon\'s own lifecycle is already reported by `daemon_started` / `daemon_stopped`; a spawned
21
+ * daemon is not a CLI run.
22
+ */
23
+ export function reportCliRun(argv) {
24
+ const firstArg = argv[0];
25
+ if (firstArg === DAEMON_INNER_COMMAND)
26
+ return;
27
+ const telemetry = getTelemetry();
28
+ // `detach` so a quick command (`version`/`gate`) exits immediately instead of waiting out the POST.
29
+ if (telemetry.firstRun)
30
+ void telemetry.emit(TelemetryEventKind.RETICLE_INSTALLED, { detach: true });
31
+ void telemetry.emit(TelemetryEventKind.CLI_COMMAND_RUN, {
32
+ detach: true,
33
+ actor: TelemetryActor.HUMAN,
34
+ // A fixed, low-cardinality vocabulary WE define, so it is safe to send whole and it is the closest
35
+ // honest read we have on intent: `verify` and `gate` mean something very different from `status`.
36
+ // An unrecognized first arg reports as `unknown` rather than being echoed — an echo would put
37
+ // whatever someone mistyped, including a path or a URL, straight onto the wire.
38
+ command: knownCommand(firstArg),
39
+ // Which flags were PRESENT, by name only — never their values. `--http-token` alone makes that
40
+ // rule absolute rather than case-by-case; `--drive` and `--storage-state` carry a URL and a path.
41
+ flags: describeCliFlags(argv),
42
+ });
43
+ }
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Classifying WHY a browser connection failed, into causes that each have a different fix.
3
+ *
4
+ * A raw error message cannot be sent — it carries CDP URLs, executable paths, and home directories —
5
+ * and would be useless if it could, because the same cause arrives worded five different ways from
6
+ * Playwright, Node and the OS. What we need is the small set of THINGS THAT ACTUALLY GO WRONG:
7
+ * a missing browser binary is a docs problem, a refused CDP endpoint is a configuration problem, a
8
+ * pool timeout is a capacity problem. Three very different responses from us.
9
+ *
10
+ * `OTHER` is the bucket to watch. A large `OTHER` count means the classifier has a blind spot and
11
+ * this list needs another entry — which is a signal in itself, and the reason it is never merged
12
+ * into one of the known causes.
13
+ */
14
+ import { ConnectFailure } from '@reticlehq/core';
15
+ /** The cause behind a connection error, or `OTHER` when we do not recognize it. */
16
+ export declare function classifyConnectFailure(error: unknown): ConnectFailure;