@reticlehq/server 2.13.0 → 2.14.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 (451) hide show
  1. package/SKILL.md +8 -18
  2. package/bin/reticle.js +3 -0
  3. package/dist/bridge/auth-failure-reason.js +12 -1
  4. package/dist/bridge/bridge-security.d.ts +8 -0
  5. package/dist/bridge/bridge-security.js +6 -1
  6. package/dist/bridge/bridge.d.ts +3 -0
  7. package/dist/bridge/bridge.js +23 -1
  8. package/dist/bridge/bridge.test-harness.d.ts +10 -1
  9. package/dist/bridge/bridge.test-harness.js +7 -1
  10. package/dist/bridge/pairing-token.d.ts +17 -0
  11. package/dist/bridge/pairing-token.js +26 -0
  12. package/dist/bridge/token-auth.d.ts +7 -0
  13. package/dist/bridge/token-auth.js +7 -1
  14. package/dist/capsule/capsule-store.d.ts +4 -4
  15. package/dist/capsule/capsule.d.ts +1 -1
  16. package/dist/capsule/capsule.js +3 -3
  17. package/dist/capsule/causal-summary.d.ts +21 -1
  18. package/dist/capsule/causal-summary.js +8 -6
  19. package/dist/capsule/divergence.d.ts +1 -1
  20. package/dist/capsule/divergence.js +26 -10
  21. package/dist/chromium-launch-options.d.ts +2 -1
  22. package/dist/cli/adhoc-verdict.d.ts +58 -0
  23. package/dist/cli/adhoc-verdict.js +115 -0
  24. package/dist/cli/chromium-hint.d.ts +18 -4
  25. package/dist/cli/chromium-hint.js +54 -6
  26. package/dist/cli/cli-doctor.js +1 -2
  27. package/dist/cli/cli-flow-commands.d.ts +16 -2
  28. package/dist/cli/cli-flow-commands.js +28 -9
  29. package/dist/cli/cli-parse-feedback.js +1 -1
  30. package/dist/cli/cli-parse.d.ts +2 -1
  31. package/dist/cli/cli-parse.js +38 -0
  32. package/dist/cli/cli-port.d.ts +5 -13
  33. package/dist/cli/cli-port.js +5 -38
  34. package/dist/cli/cli-update-commands.js +4 -4
  35. package/dist/cli/cli-verify.d.ts +24 -7
  36. package/dist/cli/cli-verify.js +87 -13
  37. package/dist/cli/cloud-keystore.d.ts +2 -1
  38. package/dist/cli/cloud-login.d.ts +2 -1
  39. package/dist/cli/cloud-session.d.ts +2 -1
  40. package/dist/cli/cloud-session.js +1 -1
  41. package/dist/cli/daemon-start-options.d.ts +2 -1
  42. package/dist/cli/device-flow.d.ts +2 -2
  43. package/dist/cli/doctor-daemon-line.d.ts +2 -1
  44. package/dist/cli/doctor-project-line.d.ts +2 -1
  45. package/dist/cli/doctor-rows.d.ts +2 -1
  46. package/dist/cli/drive-attach.d.ts +4 -3
  47. package/dist/cli/gate-hook-message.d.ts +2 -1
  48. package/dist/cli/status-next-action.js +10 -11
  49. package/dist/cli.d.ts +1 -0
  50. package/dist/cli.js +21 -9
  51. package/dist/cloud/account-state.d.ts +20 -0
  52. package/dist/cloud/account-state.js +65 -0
  53. package/dist/cloud/cloud-sync.d.ts +46 -3
  54. package/dist/cloud/cloud-sync.js +116 -0
  55. package/dist/cloud/sync-cycle.d.ts +5 -4
  56. package/dist/cloud/sync-cycle.js +1 -1
  57. package/dist/cloud/sync-daemon.d.ts +3 -19
  58. package/dist/cloud/sync-daemon.js +2 -2
  59. package/dist/crawl/crawl-tools.js +1 -1
  60. package/dist/crawl/crawl.d.ts +5 -5
  61. package/dist/crawl/crawl.js +138 -4
  62. package/dist/daemon/daemon-resilience.d.ts +3 -2
  63. package/dist/daemon/daemon-resilience.js +43 -4
  64. package/dist/daemon/daemon-resolve.d.ts +0 -9
  65. package/dist/daemon/daemon-resolve.js +2 -2
  66. package/dist/daemon/dev-servers.d.ts +1 -1
  67. package/dist/daemon/dev-servers.js +1 -1
  68. package/dist/daemon/loopback-alias.d.ts +2 -1
  69. package/dist/daemon/startup-failure.d.ts +11 -0
  70. package/dist/daemon/startup-failure.js +46 -0
  71. package/dist/events/contradictions.d.ts +10 -16
  72. package/dist/events/contradictions.js +149 -17
  73. package/dist/events/declared.d.ts +13 -1
  74. package/dist/events/declared.js +59 -3
  75. package/dist/events/echo-mismatch.js +75 -6
  76. package/dist/events/lineage.d.ts +52 -0
  77. package/dist/events/lineage.js +122 -0
  78. package/dist/events/net-evidence.d.ts +21 -0
  79. package/dist/events/net-evidence.js +81 -0
  80. package/dist/events/predicate-console.d.ts +13 -0
  81. package/dist/events/predicate-console.js +138 -0
  82. package/dist/events/predicate-element.d.ts +13 -0
  83. package/dist/events/predicate-element.js +214 -0
  84. package/dist/events/predicate-eval.d.ts +15 -3
  85. package/dist/events/predicate-eval.js +128 -110
  86. package/dist/events/predicate-parse.js +34 -1
  87. package/dist/events/predicate-request-body.d.ts +50 -0
  88. package/dist/events/predicate-request-body.js +120 -0
  89. package/dist/events/predicate-route.d.ts +21 -1
  90. package/dist/events/predicate-route.js +149 -21
  91. package/dist/events/predicate-schema.d.ts +8 -1
  92. package/dist/events/predicate-schema.js +34 -0
  93. package/dist/events/predicate.d.ts +2 -0
  94. package/dist/events/predicate.js +52 -159
  95. package/dist/events/split-text-miss.d.ts +6 -4
  96. package/dist/events/split-text-miss.js +12 -5
  97. package/dist/flows/affected-tools.js +22 -9
  98. package/dist/flows/annotate.d.ts +2 -1
  99. package/dist/flows/annotate.js +19 -1
  100. package/dist/flows/coverage.d.ts +2 -2
  101. package/dist/flows/flake.d.ts +3 -3
  102. package/dist/flows/flow-expect-grammar.d.ts +33 -0
  103. package/dist/flows/flow-expect-grammar.js +155 -0
  104. package/dist/flows/flow-replay-run.d.ts +1 -1
  105. package/dist/flows/flow-replay-run.js +28 -15
  106. package/dist/flows/flow-replay.d.ts +10 -0
  107. package/dist/flows/flow-replay.js +57 -22
  108. package/dist/flows/flow-secret-field.d.ts +14 -0
  109. package/dist/flows/flow-secret-field.js +22 -0
  110. package/dist/flows/flow-step-runners.d.ts +1 -0
  111. package/dist/flows/flow-step-runners.js +91 -34
  112. package/dist/flows/flow-success.js +22 -0
  113. package/dist/flows/flow-tools.js +27 -8
  114. package/dist/flows/flow-upload-resolve.d.ts +23 -0
  115. package/dist/flows/flow-upload-resolve.js +46 -0
  116. package/dist/flows/flows.d.ts +15 -0
  117. package/dist/flows/flows.js +17 -14
  118. package/dist/flows/git-changed.d.ts +23 -4
  119. package/dist/flows/git-changed.js +32 -6
  120. package/dist/flows/heal-run.js +2 -2
  121. package/dist/flows/predicate-to-expect.d.ts +3 -2
  122. package/dist/flows/predicate-to-expect.js +11 -5
  123. package/dist/flows/recording-backtrack.d.ts +24 -0
  124. package/dist/flows/recording-backtrack.js +73 -0
  125. package/dist/flows/recordings.d.ts +6 -0
  126. package/dist/flows/replay-halt.d.ts +26 -0
  127. package/dist/flows/replay-halt.js +30 -0
  128. package/dist/flows/replay.d.ts +0 -8
  129. package/dist/flows/replay.js +15 -3
  130. package/dist/flows/suite-flakes.d.ts +2 -1
  131. package/dist/flows/verify-change-tools.js +16 -4
  132. package/dist/honesty/already-true.d.ts +14 -0
  133. package/dist/honesty/already-true.js +47 -4
  134. package/dist/honesty/blind-spots.d.ts +3 -1
  135. package/dist/honesty/blind-spots.js +24 -1
  136. package/dist/honesty/body-capture-remedy.d.ts +42 -0
  137. package/dist/honesty/body-capture-remedy.js +95 -0
  138. package/dist/honesty/feature-capture.d.ts +3 -2
  139. package/dist/honesty/feature-capture.js +1 -1
  140. package/dist/honesty/gap-ledger.d.ts +1 -1
  141. package/dist/honesty/gap-ledger.js +1 -1
  142. package/dist/honesty/instrumentation-gaps.d.ts +8 -1
  143. package/dist/honesty/instrumentation-gaps.js +12 -2
  144. package/dist/honesty/observability.d.ts +4 -3
  145. package/dist/honesty/tool-hit-rate.d.ts +3 -2
  146. package/dist/honesty/uncaptured-bodies.d.ts +3 -1
  147. package/dist/honesty/uncaptured-bodies.js +6 -2
  148. package/dist/honesty/unsettled.d.ts +9 -0
  149. package/dist/honesty/unsettled.js +45 -0
  150. package/dist/honesty/verified.d.ts +32 -1
  151. package/dist/honesty/verified.js +37 -10
  152. package/dist/impact/impact-store.d.ts +5 -14
  153. package/dist/impact/impact-store.js +49 -6
  154. package/dist/index.js +1 -1
  155. package/dist/input/network-detail.d.ts +26 -1
  156. package/dist/input/network-detail.js +44 -12
  157. package/dist/input/network-mock-tools.js +24 -17
  158. package/dist/input/real-input.js +1 -1
  159. package/dist/input/viewport-tools.js +25 -13
  160. package/dist/intent/inline-intent.d.ts +0 -10
  161. package/dist/intent/inline-intent.js +1 -1
  162. package/dist/intent/intent-shard-store.d.ts +3 -2
  163. package/dist/intent/intent-shard-store.js +1 -1
  164. package/dist/intent/intent-shard.d.ts +14 -14
  165. package/dist/intent/intent-shard.js +4 -4
  166. package/dist/intent/intent-store.d.ts +1 -1
  167. package/dist/intent/intent-store.js +1 -1
  168. package/dist/intent/intent-subject.d.ts +2 -1
  169. package/dist/intent/open-intents.d.ts +3 -2
  170. package/dist/license/license.d.ts +4 -4
  171. package/dist/license/license.js +1 -1
  172. package/dist/mcp/attach-memory.d.ts +2 -1
  173. package/dist/mcp/client-identity.d.ts +2 -1
  174. package/dist/mcp/mcp-outage.d.ts +1 -1
  175. package/dist/mcp/mcp-outage.js +1 -1
  176. package/dist/mcp/mcp-proxy.d.ts +3 -1
  177. package/dist/mcp/mcp-proxy.js +32 -7
  178. package/dist/mcp/mcp.js +3 -1
  179. package/dist/mcp/proxy-handshake.d.ts +2 -1
  180. package/dist/mcp/proxy-idle-exit.d.ts +45 -0
  181. package/dist/mcp/proxy-idle-exit.js +94 -0
  182. package/dist/mcp/server-instructions.d.ts +2 -1
  183. package/dist/memory/project-memory.d.ts +2 -3
  184. package/dist/memory/project-memory.js +1 -1
  185. package/dist/oracles/propose-consequences.js +5 -5
  186. package/dist/oracles/self-instrument.d.ts +2 -2
  187. package/dist/oracles/self-instrument.js +1 -1
  188. package/dist/platform.d.ts +3 -5
  189. package/dist/platform.js +3 -5
  190. package/dist/pool/browser-pool.d.ts +92 -0
  191. package/dist/pool/browser-pool.js +119 -5
  192. package/dist/pool/playwright-launcher.js +29 -2
  193. package/dist/pool/storage-seed.d.ts +23 -0
  194. package/dist/pool/storage-seed.js +198 -0
  195. package/dist/project/artifact-root.d.ts +2 -1
  196. package/dist/project/memory-fs.d.ts +2 -1
  197. package/dist/project/reticle-dir.js +1 -1
  198. package/dist/project/session-root.d.ts +8 -0
  199. package/dist/project/session-root.js +9 -2
  200. package/dist/runs/reticle-runner.d.ts +14 -1
  201. package/dist/runs/reticle-runner.js +39 -2
  202. package/dist/session/attachment-history.d.ts +2 -1
  203. package/dist/session/fake-session.d.ts +37 -0
  204. package/dist/session/fake-session.js +81 -0
  205. package/dist/session/lease-visibility.d.ts +2 -1
  206. package/dist/session/live-control-tools.js +6 -0
  207. package/dist/session/no-session-diagnosis.d.ts +17 -1
  208. package/dist/session/no-session-diagnosis.js +32 -6
  209. package/dist/session/no-session-next-action.d.ts +14 -0
  210. package/dist/session/no-session-next-action.js +18 -0
  211. package/dist/session/no-session-watch.js +46 -3
  212. package/dist/session/registered-projects.d.ts +54 -0
  213. package/dist/session/registered-projects.js +73 -0
  214. package/dist/session/review-store.d.ts +2 -1
  215. package/dist/session/session-health.d.ts +62 -1
  216. package/dist/session/session-health.js +82 -2
  217. package/dist/session/session-manager.d.ts +11 -1
  218. package/dist/session/session-manager.js +18 -3
  219. package/dist/session/session-replaced.d.ts +24 -0
  220. package/dist/session/session-replaced.js +29 -0
  221. package/dist/session/session-successor.js +20 -4
  222. package/dist/session/session.d.ts +13 -5
  223. package/dist/session/session.js +31 -23
  224. package/dist/setup/agent-configs.d.ts +3 -2
  225. package/dist/setup/agent-writer.d.ts +3 -2
  226. package/dist/setup/approval-migration.d.ts +2 -1
  227. package/dist/setup/approval-migration.js +1 -1
  228. package/dist/setup/auto-approve.d.ts +11 -19
  229. package/dist/setup/auto-approve.js +15 -12
  230. package/dist/{init → setup}/confirm.js +1 -1
  231. package/dist/setup/desktop-shape.d.ts +3 -2
  232. package/dist/setup/dev-server-wait.d.ts +8 -0
  233. package/dist/setup/dev-server-wait.js +3 -1
  234. package/dist/setup/drive-agent.d.ts +2 -3
  235. package/dist/setup/drive-agent.js +1 -1
  236. package/dist/setup/drive-plan.d.ts +3 -2
  237. package/dist/setup/ensure-daemon.d.ts +2 -1
  238. package/dist/setup/existing-app.d.ts +12 -0
  239. package/dist/setup/existing-app.js +13 -0
  240. package/dist/setup/init-host.d.ts +11 -0
  241. package/dist/setup/init-host.js +26 -0
  242. package/dist/setup/init-runtime.d.ts +4 -10
  243. package/dist/setup/init-runtime.js +23 -16
  244. package/dist/setup/license-key.d.ts +2 -1
  245. package/dist/setup/listeners.d.ts +2 -1
  246. package/dist/setup/loopback-probe-urls.d.ts +18 -0
  247. package/dist/setup/loopback-probe-urls.js +52 -0
  248. package/dist/setup/node-effects.d.ts +3 -0
  249. package/dist/setup/node-effects.js +26 -11
  250. package/dist/setup/page-probe.d.ts +5 -0
  251. package/dist/setup/relaunch.d.ts +2 -1
  252. package/dist/setup/run-setup.d.ts +5 -1
  253. package/dist/setup/run-setup.js +155 -48
  254. package/dist/setup/setup-command.d.ts +3 -2
  255. package/dist/setup/setup-command.js +8 -0
  256. package/dist/setup/setup-options.d.ts +5 -3
  257. package/dist/setup/setup-options.js +3 -2
  258. package/dist/setup/wait-progress.d.ts +28 -0
  259. package/dist/setup/wait-progress.js +43 -0
  260. package/dist/telemetry/app-instrumented.d.ts +2 -1
  261. package/dist/telemetry/app-instrumented.js +1 -1
  262. package/dist/telemetry/automation-hint.d.ts +1 -1
  263. package/dist/telemetry/automation-hint.js +1 -1
  264. package/dist/telemetry/cli-telemetry.js +1 -1
  265. package/dist/telemetry/connect-failure.d.ts +1 -1
  266. package/dist/telemetry/connect-failure.js +1 -1
  267. package/dist/telemetry/crash-cause.d.ts +3 -2
  268. package/dist/telemetry/crash-cause.js +1 -1
  269. package/dist/telemetry/daemon-telemetry.d.ts +3 -2
  270. package/dist/telemetry/daemon-telemetry.js +1 -1
  271. package/dist/telemetry/error-class.d.ts +3 -2
  272. package/dist/telemetry/error-class.js +1 -1
  273. package/dist/telemetry/feedback-cli.js +1 -1
  274. package/dist/telemetry/feedback-context.d.ts +3 -2
  275. package/dist/telemetry/feedback-context.js +5 -4
  276. package/dist/telemetry/feedback-local.d.ts +3 -2
  277. package/dist/telemetry/feedback.d.ts +4 -3
  278. package/dist/telemetry/feedback.js +1 -1
  279. package/dist/telemetry/git-facts.d.ts +2 -2
  280. package/dist/telemetry/git-facts.js +1 -1
  281. package/dist/telemetry/identify.d.ts +1 -1
  282. package/dist/telemetry/identify.js +1 -1
  283. package/dist/telemetry/init-telemetry.d.ts +2 -14
  284. package/dist/telemetry/init-telemetry.js +4 -13
  285. package/dist/telemetry/install-source.d.ts +7 -13
  286. package/dist/telemetry/install-source.js +7 -29
  287. package/dist/telemetry/license-activation.d.ts +3 -2
  288. package/dist/telemetry/license-activation.js +1 -1
  289. package/dist/telemetry/machine-snapshot.d.ts +1 -1
  290. package/dist/telemetry/mcp-connection.js +1 -1
  291. package/dist/telemetry/project-profile.d.ts +0 -14
  292. package/dist/telemetry/project-profile.js +1 -1
  293. package/dist/telemetry/proxy-telemetry.js +1 -1
  294. package/dist/telemetry/session-metrics.d.ts +1 -1
  295. package/dist/telemetry/session-metrics.js +1 -1
  296. package/dist/telemetry/telemetry.d.ts +1 -17
  297. package/dist/telemetry/telemetry.js +4 -4
  298. package/dist/telemetry/tool-refused.d.ts +1 -1
  299. package/dist/telemetry/tool-refused.js +1 -1
  300. package/dist/tools/act-observation.d.ts +3 -2
  301. package/dist/tools/act-preflight.js +8 -3
  302. package/dist/tools/act-target.d.ts +4 -0
  303. package/dist/tools/act-target.js +14 -5
  304. package/dist/tools/act-tools.d.ts +0 -2
  305. package/dist/tools/act-tools.js +45 -15
  306. package/dist/tools/assert-source.d.ts +30 -0
  307. package/dist/tools/assert-source.js +21 -0
  308. package/dist/tools/assert-verdict.d.ts +1 -1
  309. package/dist/tools/assert-verdict.js +14 -4
  310. package/dist/tools/browser-tools.js +28 -8
  311. package/dist/tools/complete-snapshot.d.ts +3 -2
  312. package/dist/tools/dynamic-tools.js +8 -0
  313. package/dist/tools/error-recovery.d.ts +10 -0
  314. package/dist/tools/error-recovery.js +23 -0
  315. package/dist/tools/feedback-tools.js +1 -1
  316. package/dist/tools/invoke-tool.js +2 -0
  317. package/dist/tools/lease-tools.d.ts +48 -20
  318. package/dist/tools/lease-tools.js +311 -76
  319. package/dist/tools/lineage-tools.d.ts +14 -0
  320. package/dist/tools/lineage-tools.js +64 -0
  321. package/dist/tools/merge-tools.js +1 -3
  322. package/dist/tools/navigate-arrival.d.ts +45 -1
  323. package/dist/tools/navigate-arrival.js +39 -6
  324. package/dist/tools/navigate-result.d.ts +8 -1
  325. package/dist/tools/navigate-result.js +14 -4
  326. package/dist/tools/numeric-bounds.d.ts +0 -11
  327. package/dist/tools/numeric-bounds.js +4 -4
  328. package/dist/tools/observe-tools.js +22 -26
  329. package/dist/tools/observed-nothing.d.ts +9 -0
  330. package/dist/tools/observed-nothing.js +2 -1
  331. package/dist/tools/read-tools.js +12 -17
  332. package/dist/tools/real-input-attempt.d.ts +14 -6
  333. package/dist/tools/real-input-attempt.js +75 -18
  334. package/dist/tools/reconcile-tools.js +2 -1
  335. package/dist/tools/reload-result.d.ts +6 -1
  336. package/dist/tools/reload-result.js +7 -2
  337. package/dist/tools/resolve-target.d.ts +7 -1
  338. package/dist/tools/resolve-target.js +72 -9
  339. package/dist/tools/settle-in-flight.d.ts +1 -1
  340. package/dist/tools/settle-in-flight.js +9 -2
  341. package/dist/tools/snapshot-delta.d.ts +24 -1
  342. package/dist/tools/snapshot-delta.js +66 -7
  343. package/dist/tools/tool-names.d.ts +1 -0
  344. package/dist/tools/tool-names.js +1 -0
  345. package/dist/tools/tool-surface.js +20 -2
  346. package/dist/tools/tools.js +120 -11
  347. package/dist/tools/verify-next-baton.d.ts +2 -1
  348. package/dist/update/sdk-sync.d.ts +1 -1
  349. package/dist/update/sdk-sync.js +1 -1
  350. package/dist/update/updater.js +1 -1
  351. package/dist/version/sdk-fix.d.ts +2 -1
  352. package/dist/version/version-skew.d.ts +0 -8
  353. package/dist/version/version-skew.js +1 -1
  354. package/docs/README.md +8 -6
  355. package/docs/actions.mdx +1 -1
  356. package/docs/agent-cheatsheet.md +4 -2
  357. package/docs/architecture.md +1 -1
  358. package/docs/cli/mcp.mdx +3 -1
  359. package/docs/cli/watch.mdx +1 -1
  360. package/docs/cli.mdx +1 -1
  361. package/docs/desktop.mdx +1 -1
  362. package/docs/docs.json +8 -3
  363. package/docs/faq.mdx +9 -0
  364. package/docs/first-drive.md +136 -0
  365. package/docs/frameworks.mdx +29 -7
  366. package/docs/gate-plan.md +2 -2
  367. package/docs/gates.md +19 -11
  368. package/docs/getting-started.md +7 -1
  369. package/docs/http-transport.md +164 -0
  370. package/docs/index.mdx +5 -3
  371. package/docs/install-manual.mdx +1 -1
  372. package/docs/packages/tauri.mdx +1 -1
  373. package/docs/packages.mdx +15 -3
  374. package/docs/platform-integration.md +1 -1
  375. package/docs/predicates.mdx +2 -0
  376. package/docs/system-map.md +2 -2
  377. package/docs/telemetry-contract.md +4 -4
  378. package/docs/telemetry-events.mdx +1 -1
  379. package/docs/telemetry.md +3 -3
  380. package/docs/tools-navigate.mdx +14 -6
  381. package/docs/usage.md +4 -4
  382. package/package.json +7 -4
  383. package/dist/init/agent-rules.d.ts +0 -116
  384. package/dist/init/agent-rules.js +0 -279
  385. package/dist/init/app-choice.d.ts +0 -20
  386. package/dist/init/app-choice.js +0 -25
  387. package/dist/init/astro-host.d.ts +0 -21
  388. package/dist/init/astro-host.js +0 -27
  389. package/dist/init/astro-patch.d.ts +0 -33
  390. package/dist/init/astro-patch.js +0 -300
  391. package/dist/init/capabilities.d.ts +0 -40
  392. package/dist/init/capabilities.js +0 -150
  393. package/dist/init/closing-hint.d.ts +0 -36
  394. package/dist/init/closing-hint.js +0 -120
  395. package/dist/init/connect-steps.d.ts +0 -2
  396. package/dist/init/connect-steps.js +0 -50
  397. package/dist/init/cra.d.ts +0 -79
  398. package/dist/init/cra.js +0 -178
  399. package/dist/init/csp-check.d.ts +0 -38
  400. package/dist/init/csp-check.js +0 -107
  401. package/dist/init/csp-doctor.d.ts +0 -32
  402. package/dist/init/csp-doctor.js +0 -54
  403. package/dist/init/desktop-doctor.d.ts +0 -41
  404. package/dist/init/desktop-doctor.js +0 -198
  405. package/dist/init/detect.d.ts +0 -96
  406. package/dist/init/detect.js +0 -209
  407. package/dist/init/dev-script.d.ts +0 -50
  408. package/dist/init/dev-script.js +0 -66
  409. package/dist/init/format-generated.d.ts +0 -18
  410. package/dist/init/format-generated.js +0 -39
  411. package/dist/init/install-hint.d.ts +0 -9
  412. package/dist/init/install-hint.js +0 -29
  413. package/dist/init/mcp-clients.d.ts +0 -89
  414. package/dist/init/mcp-clients.js +0 -299
  415. package/dist/init/mcp-registered.d.ts +0 -12
  416. package/dist/init/mcp-registered.js +0 -14
  417. package/dist/init/mcp.d.ts +0 -89
  418. package/dist/init/mcp.js +0 -129
  419. package/dist/init/next-patch.d.ts +0 -39
  420. package/dist/init/next-patch.js +0 -196
  421. package/dist/init/node-io.d.ts +0 -7
  422. package/dist/init/node-io.js +0 -117
  423. package/dist/init/non-js-project.d.ts +0 -27
  424. package/dist/init/non-js-project.js +0 -84
  425. package/dist/init/patch-kind.d.ts +0 -20
  426. package/dist/init/patch-kind.js +0 -10
  427. package/dist/init/plan-framework.d.ts +0 -64
  428. package/dist/init/plan-framework.js +0 -565
  429. package/dist/init/plan.d.ts +0 -242
  430. package/dist/init/plan.js +0 -703
  431. package/dist/init/preflight.d.ts +0 -28
  432. package/dist/init/preflight.js +0 -38
  433. package/dist/init/project-id.d.ts +0 -12
  434. package/dist/init/project-id.js +0 -25
  435. package/dist/init/refresh-rules.d.ts +0 -39
  436. package/dist/init/refresh-rules.js +0 -51
  437. package/dist/init/run.d.ts +0 -117
  438. package/dist/init/run.js +0 -806
  439. package/dist/init/slash-command.d.ts +0 -27
  440. package/dist/init/slash-command.js +0 -132
  441. package/dist/init/snippets.d.ts +0 -134
  442. package/dist/init/snippets.js +0 -572
  443. package/dist/init/vite-config.d.ts +0 -18
  444. package/dist/init/vite-config.js +0 -114
  445. package/dist/init/windows-quote.d.ts +0 -38
  446. package/dist/init/windows-quote.js +0 -70
  447. package/dist/init/workspace-apps.d.ts +0 -30
  448. package/dist/init/workspace-apps.js +0 -178
  449. package/dist/project/remember-project.d.ts +0 -24
  450. package/dist/project/remember-project.js +0 -40
  451. /package/dist/{init → setup}/confirm.d.ts +0 -0
@@ -1,300 +0,0 @@
1
- /**
2
- * Pure, conservative patchers for an Astro app: the config gets the token/root `define` and the
3
- * raised build target, one layout gets the dev-only connect `<script>`.
4
- *
5
- * Astro was the last gated framework where `init` printed a correct recipe and applied none of it —
6
- * the only ⚠ left on a supported stack, and the user's first session was two hand-copied snippets
7
- * away. Astro is Vite-based but renders its own HTML, so the Vite plugin's injection never fires and
8
- * there is no entry module to wire: the connect has to live in a page or layout `<script>`, and the
9
- * token has to be inlined by the config because nothing else is in the page's path to inject it.
10
- *
11
- * Both patchers bail to `manual` (the printed recipe) on any shape they do not fully recognise.
12
- * Half-editing a build config is worse than a documented manual step.
13
- */
14
- import { RETICLE_DEFAULT_PORT, ReticleDir, bridgeWsUrl } from '@reticlehq/core';
15
- import { PatchKind } from './patch-kind.js';
16
- import { UiLibrary } from './detect.js';
17
- import { sdkImport } from './snippets.js';
18
- /** Present in a patched config AND in a hand-followed recipe — so both count as already wired. */
19
- const CONFIG_MARKER = '__RETICLE_TOKEN__';
20
- /** Present in a patched layout and in the printed recipe's script. */
21
- const LAYOUT_MARKER = 'reticle.connect';
22
- /**
23
- * The SDK, declared so Vite pre-bundles it BEFORE the first page load.
24
- *
25
- * The connect script does `await import('@reticlehq/react')`. Undeclared, Vite meets that import
26
- * mid-load, pre-bundles it, and the hashed `/node_modules/.vite/deps/@reticlehq_react.js?v=…` URL
27
- * the browser already requested stops existing — the import rejects with "Failed to fetch
28
- * dynamically imported module", connect() never runs, and the page looks entirely normal. Measured
29
- * on astro-nanostores, intermittent on whether the dep cache was warm. The Vite plugin has declared
30
- * the SDK for this exact reason since the bug was first found on React; Astro is hand-patched and
31
- * never got it.
32
- */
33
- const SDK_INCLUDE_LITERAL = `'@reticlehq/react'`;
34
- /**
35
- * The daemon's journal directory, kept out of the dev server's watcher.
36
- *
37
- * The daemon writes `.reticle/` into the project root and rewrites `ambient.json` atomically
38
- * (`.tmp` + rename) for as long as a session is live. Astro dev is a Vite dev server watching that
39
- * root, and `.reticle/` is not in Vite's default ignore list — so every journal write read as a
40
- * project file changing and Vite answered with a full page reload. That closes a loop with no exit:
41
- * the page loads, the SDK connects and streams events, the daemon journals them, Vite reloads the
42
- * page, the SDK reconnects. It ran several times a second for as long as the dev server was up,
43
- * and the symptom looked nothing like the cause — stale refs, actions dying mid-flight, and a log
44
- * full of connect/disconnect pairs that read as a flapping SDK.
45
- *
46
- * The Vite plugin sets the same ignore in its `config` hook. Astro is hand-patched and never loads
47
- * that plugin, so it needs its own.
48
- *
49
- * A RegExp, not a glob. chokidar dropped glob support in v4 and Vite 7+ ships v4/v5, where a
50
- * double-star pattern is accepted and matches nothing — the ignore would be visibly present in the
51
- * config and do nothing at all. Measured against the chokidar this repo resolves.
52
- */
53
- const WATCH_IGNORE_LITERAL = `/(^|[\\\\/])\\.${ReticleDir.ROOT.slice(1)}([\\\\/]|$)/`;
54
- /**
55
- * An `include:` the app already declared — ours joins that array instead of adding a second key.
56
- * Deliberately not anchored to a newline: `optimizeDeps: { include: ['x'] }` on one line is the
57
- * common way to write it, and requiring a line break made the merge miss it and duplicate the key.
58
- */
59
- const EXISTING_INCLUDE = /(\s*include\s*:\s*\[)/;
60
- const DEFINE_CONFIG = /defineConfig\s*\(\s*\{/;
61
- /** A `vite:` key whose value is an object LITERAL — the one shape we can merge into safely. */
62
- const VITE_OBJECT_KEY = /(^\s*vite\s*:\s*\{)/m;
63
- /** Any `vite:` key at all. One that is not an object literal (a spread, an imported config) is ours to refuse. */
64
- const ANY_VITE_KEY = /^\s*vite\s*:/m;
65
- const BODY_CLOSE = '</body>';
66
- const HELPER = `
67
- function reticleToken() {
68
- const dir = process.env['RETICLE_PAIRING_TOKEN_DIR'] || join(homedir(), '.reticle');
69
- try { return readFileSync(join(dir, 'pairing-token'), 'utf8').trim(); } catch { return ''; }
70
- }
71
- `;
72
- const HELPER_IMPORTS = `import { readFileSync } from 'node:fs';
73
- import { homedir } from 'node:os';
74
- import { join } from 'node:path';
75
- `;
76
- /**
77
- * The keys we add inside `vite:`, each with what it must contain.
78
- *
79
- * Kept as a list rather than one blob because a config that already sets one of these must be merged
80
- * INTO, not duplicated: the real astro-nanostores config has `build: { chunkSizeWarningLimit }`, and
81
- * inserting our own `build` beside it gave the object two — where the last one wins, so
82
- * `target: 'es2022'` was silently discarded while init reported success. Losing that target is not
83
- * cosmetic: Astro's default down-levels the modern SDK bundle and dies on a destructuring transform.
84
- */
85
- const VITE_KEYS = [
86
- { key: 'build', inner: `\n target: 'es2022',` },
87
- {
88
- key: 'optimizeDeps',
89
- inner: `\n include: [${SDK_INCLUDE_LITERAL}],\n esbuildOptions: { target: 'es2022' },`,
90
- },
91
- {
92
- key: 'define',
93
- inner: `\n __RETICLE_TOKEN__: JSON.stringify(reticleToken()),\n __RETICLE_ROOT__: JSON.stringify(process.cwd()),`,
94
- },
95
- // Merged in first, so a `server: { port }` the app already set keeps its port. An app that
96
- // already sets `server.watch` itself is the one shape this loses to — the inner `watch` key would
97
- // be duplicated and the app's would win — which is the same nested-merge ceiling `build` has.
98
- { key: 'server', inner: `\n watch: { ignored: [${WATCH_IGNORE_LITERAL}] },` },
99
- ];
100
- /** Whole-key form, for a `vite:` block that does not have the key at all. */
101
- const WHOLE = {
102
- build: `\n build: { target: 'es2022' },`,
103
- optimizeDeps: `\n optimizeDeps: { include: [${SDK_INCLUDE_LITERAL}], esbuildOptions: { target: 'es2022' } },`,
104
- define: `\n define: {\n __RETICLE_TOKEN__: JSON.stringify(reticleToken()),\n __RETICLE_ROOT__: JSON.stringify(process.cwd()),\n },`,
105
- server: `\n server: { watch: { ignored: [${WATCH_IGNORE_LITERAL}] } },`,
106
- };
107
- /**
108
- * Add our keys to an existing `vite: { ... }` block, merging into any the app already set.
109
- *
110
- * Returns null when a colliding key is not an object literal (`build: sharedConfig`) — there is no
111
- * brace to merge into, and duplicating or replacing it would corrupt someone's build.
112
- */
113
- function mergeIntoViteBlock(source, braceAt) {
114
- let out = source;
115
- for (const { key, inner } of VITE_KEYS) {
116
- // Scoped to the vite block by searching from its opening brace: a `build:` under `markdown:` or
117
- // at the top level is somebody else's key and must not be touched.
118
- const existing = new RegExp(`(\\n\\s*${key}\\s*:\\s*)([\\{A-Za-z_])`).exec(out.slice(braceAt));
119
- if (existing?.index === undefined) {
120
- out = `${out.slice(0, braceAt)}${WHOLE[key] ?? ''}${out.slice(braceAt)}`;
121
- continue;
122
- }
123
- // The character after the colon decides: `{` is a literal we can open; anything else is a
124
- // reference we must not touch.
125
- if (existing[2] !== '{')
126
- return null;
127
- const at = braceAt + existing.index + existing[0].length; // just past the `{`
128
- // An `include:` the app already wrote is an ARRAY, and a second `include:` key in the same
129
- // object literal is not a merge — the last one wins and one of the two silently disappears.
130
- // That is how `build.target` was lost while init still reported success. Join their array.
131
- // Scoped to THIS block's braces: an `include:` under a later key is somebody else's array, and
132
- // appending the SDK to it would both miss the target and edit a config we were not asked to.
133
- const own = 'optimizeDeps' === key ? EXISTING_INCLUDE.exec(blockAfter(out, at)) : null;
134
- if (own?.index === undefined) {
135
- out = insertAt(out, at, inner);
136
- continue;
137
- }
138
- // Their array first, then the rest of our keys at the block's start — inserting at the LOWER
139
- // offset second keeps the first offset valid.
140
- out = insertAt(out, at + own.index + own[0].length, `${SDK_INCLUDE_LITERAL}, `);
141
- out = insertAt(out, at, withoutInclude(inner));
142
- }
143
- return out;
144
- }
145
- function insertAt(source, at, text) {
146
- return `${source.slice(0, at)}${text}${source.slice(at)}`;
147
- }
148
- /**
149
- * The text from just inside an opening brace to its match — a brace count, not a parser.
150
- *
151
- * Enough for the one question asked of it (does THIS object literal already declare `include`), and
152
- * honest about its limit: a `{` or `}` inside a string literal in someone's Vite config would fool
153
- * it. That only ever shortens or lengthens the window we search for `include:` in, so the worst case
154
- * is the same duplicate-key merge we would have done before, never a corrupted file.
155
- */
156
- function blockAfter(source, at) {
157
- let depth = 1;
158
- for (let i = at; i < source.length; i++) {
159
- if ('{' === source[i])
160
- depth += 1;
161
- else if ('}' === source[i]) {
162
- depth -= 1;
163
- if (0 === depth)
164
- return source.slice(at, i);
165
- }
166
- }
167
- return source.slice(at);
168
- }
169
- /** The optimizeDeps inner minus our `include:` line, for when the app already has one to join. */
170
- function withoutInclude(inner) {
171
- return inner.replace(`\n include: [${SDK_INCLUDE_LITERAL}],`, '');
172
- }
173
- /**
174
- * The `vite:` block Astro needs. `build.target` is raised because Astro's default down-levels the
175
- * modern SDK bundle and dies on a destructuring transform; `__RETICLE_ROOT__` is defined because
176
- * without it every source pointer comes back as an absolute path from the machine that ran `init`.
177
- */
178
- const VITE_BLOCK = ` vite: {
179
- build: { target: 'es2022' },
180
- optimizeDeps: { include: [${SDK_INCLUDE_LITERAL}], esbuildOptions: { target: 'es2022' } },
181
- define: {
182
- __RETICLE_TOKEN__: JSON.stringify(reticleToken()),
183
- __RETICLE_ROOT__: JSON.stringify(process.cwd()),
184
- },
185
- server: { watch: { ignored: [${WATCH_IGNORE_LITERAL}] } },
186
- },
187
- `;
188
- export function patchAstroConfig(source) {
189
- if (source.includes(CONFIG_MARKER))
190
- return { kind: PatchKind.ALREADY };
191
- // A `vite: { ... }` block is an object literal, so our keys can go straight after the brace and
192
- // whatever is already in there is untouched. Refusing outright was the only genuine install defect
193
- // left in the gate: the config bailed while the LAYOUT patch applied anyway, leaving an app with a
194
- // connect snippet, no inlined token and no raised build target — which cannot connect, reported as
195
- // one OK step and one warning.
196
- const viteObject = VITE_OBJECT_KEY.exec(source);
197
- if (viteObject?.index !== undefined) {
198
- const at = viteObject.index + viteObject[0].length;
199
- const merged = mergeIntoViteBlock(source, at);
200
- if (merged !== null) {
201
- return {
202
- kind: PatchKind.APPLY,
203
- code: `${HELPER_IMPORTS}${merged.trimStart()}\n${HELPER}`.trimEnd() + '\n',
204
- };
205
- }
206
- return {
207
- kind: PatchKind.MANUAL,
208
- reason: 'this config sets a `vite` key Reticle needs (build / optimizeDeps / define) to something ' +
209
- 'other than an object literal — merging into it is your call, not a text edit Reticle should make',
210
- };
211
- }
212
- if (ANY_VITE_KEY.test(source)) {
213
- // `vite: sharedConfig` — not an object literal, so there is no brace to merge into and guessing
214
- // would corrupt a build config. The recipe is the honest answer here.
215
- return {
216
- kind: PatchKind.MANUAL,
217
- reason: 'this config sets `vite:` to something other than an object literal — merging into it is your call, not a text edit Reticle should make',
218
- };
219
- }
220
- const opening = DEFINE_CONFIG.exec(source);
221
- if (opening?.index === undefined) {
222
- return {
223
- kind: PatchKind.MANUAL,
224
- reason: "couldn't find a `defineConfig({ ... })` call to extend",
225
- };
226
- }
227
- const at = opening.index + opening[0].length;
228
- const withBlock = `${source.slice(0, at)}\n${VITE_BLOCK}${source.slice(at)}`;
229
- return {
230
- kind: PatchKind.APPLY,
231
- code: `${HELPER_IMPORTS}${withBlock.trimStart()}\n${HELPER}`.trimEnd() + '\n',
232
- };
233
- }
234
- /** The dev-only connect that goes inside the layout's `<body>`. */
235
- function astroConnectScript(port, projectId, uiLibrary) {
236
- // Must match what `frameworkPackages` installed. Astro hosts islands from any framework, so an
237
- // Astro app whose islands are Vue or Svelte gets the sensor, and a script importing the React
238
- // adapter would load a package that is not in node_modules. See sdkImport.
239
- const sdk = sdkImport(uiLibrary);
240
- const url = port !== undefined && port !== RETICLE_DEFAULT_PORT
241
- ? `\n url: '${bridgeWsUrl(port)}',`
242
- : '';
243
- const id = projectId !== undefined && projectId.length > 0 ? `\n projectId: '${projectId}',` : '';
244
- return ` <script>
245
- if (import.meta.env.DEV) {
246
- const token = typeof __RETICLE_TOKEN__ !== 'undefined' ? __RETICLE_TOKEN__ : '';
247
- const root = typeof __RETICLE_ROOT__ !== 'undefined' ? __RETICLE_ROOT__ : '';
248
- const { reticle${sdk.usesInstall ? ', install' : ''} } = await import('${sdk.specifier}');
249
- ${sdk.usesInstall ? 'install();' : '// The sensor has no install(); that is the React adapter.'}
250
- reticle.connect({${id}${url}
251
- ...(token.length > 0 ? { token } : {}),
252
- ...(root.length > 0 ? { root } : {}),
253
- });
254
- }
255
- </script>
256
- `;
257
- }
258
- export function patchAstroLayout(source, port, projectId, uiLibrary = UiLibrary.REACT) {
259
- if (source.includes(LAYOUT_MARKER))
260
- return { kind: PatchKind.ALREADY };
261
- const at = source.lastIndexOf(BODY_CLOSE);
262
- if (at < 0) {
263
- return {
264
- kind: PatchKind.MANUAL,
265
- reason: "couldn't find a `</body>` to place the connect script before",
266
- };
267
- }
268
- return {
269
- kind: PatchKind.APPLY,
270
- code: `${source.slice(0, at)}${astroConnectScript(port, projectId, uiLibrary)}${source.slice(at)}`,
271
- };
272
- }
273
- /** Where Astro keeps ambient types — `create-astro` ships this file. */
274
- export const ASTRO_ENV_DTS_PATH = 'src/env.d.ts';
275
- /**
276
- * The declarations `astro check` needs for the Vite `define` names (#677).
277
- *
278
- * Matching SvelteKit's `hooks.client.ts` typing: `string | undefined`, because the define can be
279
- * absent when the pairing token file is missing.
280
- */
281
- export const ASTRO_ENV_DTS_DECLARES = 'declare const __RETICLE_TOKEN__: string | undefined;\n' +
282
- 'declare const __RETICLE_ROOT__: string | undefined;\n';
283
- /** Present once either declare is in the file — both are written together. */
284
- const ENV_DTS_MARKER = '__RETICLE_TOKEN__';
285
- /**
286
- * Append the Vite-define ambient declarations to `src/env.d.ts`, or create the file.
287
- *
288
- * Without this, `create-astro`'s default `"astro check && astro build"` fails with four
289
- * `ts(2304) Cannot find name '__RETICLE_TOKEN__'` errors after a clean init (#677).
290
- */
291
- export function patchAstroEnvDts(existing) {
292
- if (null !== existing && existing.includes(ENV_DTS_MARKER)) {
293
- return { kind: PatchKind.ALREADY };
294
- }
295
- if (null === existing || '' === existing.trim()) {
296
- return { kind: PatchKind.APPLY, code: ASTRO_ENV_DTS_DECLARES };
297
- }
298
- const base = existing.endsWith('\n') ? existing : `${existing}\n`;
299
- return { kind: PatchKind.APPLY, code: `${base}${ASTRO_ENV_DTS_DECLARES}` };
300
- }
@@ -1,40 +0,0 @@
1
- /**
2
- * What the app can be driven by: its `data-testid` values, and which state library holds its truth.
3
- *
4
- * `init` wired none of this, so every app came up with `hasCapabilities: false`, empty capabilities,
5
- * and a `reticle_state` holding nothing but `__reticle_renders` — the state-truth read that SKILL.md
6
- * calls the highest-value line was unavailable on every app out of the box. Measured across six.
7
- *
8
- * Testids are scanned rather than asked for. Stores are NAMED but not wired: detecting that an app
9
- * depends on zustand is easy, knowing which module exports the store instance is not, and generating
10
- * a wrong import would break the dev module that everything else now hangs off.
11
- */
12
- /** Cap the generated list. A capabilities block is a hint for an agent, not an inventory. */
13
- export declare const MAX_TESTIDS = 60;
14
- /** Every distinct `data-testid` literal in the given sources, in first-seen order. */
15
- export declare function scanTestids(sources: readonly string[]): string[];
16
- /**
17
- * The store libraries this app depends on AND the running app cannot reveal on its own, as
18
- * ready-to-uncomment registration lines.
19
- */
20
- export declare function storeHints(deps: ReadonlySet<string>): string[];
21
- /** A store instance we found in the app's own source, with everything needed to import and register it. */
22
- export interface FoundStore {
23
- /** The name it registers under — what `reticle_state` keys its output by. */
24
- key: string;
25
- /** The exported identifier. */
26
- ident: string;
27
- /** Module specifier relative to `src/reticle-dev.ts`. */
28
- importPath: string;
29
- }
30
- /**
31
- * Store instances declared in the app's own source, ready to import and register.
32
- *
33
- * Only exported declarations of a factory the app actually depends on: anything less certain would
34
- * generate an import that breaks the dev module everything else hangs off, and a broken module is
35
- * worse than the commented hint it replaces.
36
- */
37
- export declare function scanStores(files: readonly {
38
- path: string;
39
- source: string;
40
- }[], deps: ReadonlySet<string>, fromDir?: string): FoundStore[];
@@ -1,150 +0,0 @@
1
- /**
2
- * What the app can be driven by: its `data-testid` values, and which state library holds its truth.
3
- *
4
- * `init` wired none of this, so every app came up with `hasCapabilities: false`, empty capabilities,
5
- * and a `reticle_state` holding nothing but `__reticle_renders` — the state-truth read that SKILL.md
6
- * calls the highest-value line was unavailable on every app out of the box. Measured across six.
7
- *
8
- * Testids are scanned rather than asked for. Stores are NAMED but not wired: detecting that an app
9
- * depends on zustand is easy, knowing which module exports the store instance is not, and generating
10
- * a wrong import would break the dev module that everything else now hangs off.
11
- */
12
- import { posix } from 'node:path';
13
- /** `data-testid="foo"` / `data-testid='foo'` / `data-testid={"foo"}` — the forms people actually write. */
14
- const TESTID_ATTR = /data-testid\s*=\s*[{]?\s*["'`]([^"'`]+)["'`]/g;
15
- /** Cap the generated list. A capabilities block is a hint for an agent, not an inventory. */
16
- export const MAX_TESTIDS = 60;
17
- /** Every distinct `data-testid` literal in the given sources, in first-seen order. */
18
- export function scanTestids(sources) {
19
- const found = new Set();
20
- for (const src of sources) {
21
- for (const m of src.matchAll(TESTID_ATTR)) {
22
- const id = m[1];
23
- if (id !== undefined && id.length > 0)
24
- found.add(id);
25
- if (found.size >= MAX_TESTIDS)
26
- return [...found];
27
- }
28
- }
29
- return [...found];
30
- }
31
- /**
32
- * State libraries the browser SDK has an adapter for, in the order we would recommend registering
33
- * them. TanStack Query is first on purpose: a stale cache served as fresh fires NO network request,
34
- * so the network log shows silence and the DOM shows a plausible number — the cache is the only
35
- * witness, which makes it the highest-value store in the list and the least obvious one to add.
36
- */
37
- const STORE_LIBRARIES = [
38
- ['@tanstack/react-query', "registerStore('queries', tanstackQueryStore(queryClient))"],
39
- [
40
- 'zustand',
41
- "registerStore('app', useStore) // pass the store itself, not () => store.getState()",
42
- ],
43
- ['@reduxjs/toolkit', "registerStore('app', store)"],
44
- ['redux', "registerStore('app', store)"],
45
- ['jotai', "registerStore('app', jotaiStore(getDefaultStore(), { cart, user }))"],
46
- ['valtio', "registerStore('app', valtioStore(state))"],
47
- ['mobx', "registerStore('app', mobxStore(state))"],
48
- ['xstate', "registerStore('machine', xstateStore(actor))"],
49
- ['pinia', "registerStore('cart', piniaStore(useCartStore()))"],
50
- ['svelte', "registerStore('cart', svelteStore(cartStore))"],
51
- ];
52
- /**
53
- * Libraries that hand their store to React through a context provider, and therefore need no hint.
54
- *
55
- * `<Provider store>` and `<QueryClientProvider client>` put the store instance in the fiber tree as
56
- * a prop, so the React adapter finds and registers it on the first commit — see `auto-stores.ts` in
57
- * `@reticlehq/react`. Offering a commented `registerStore` line for these was asking someone to do
58
- * by hand, and be nagged about, work that is already done by the time they read the report.
59
- *
60
- * Everything absent from this set is module-scope (Zustand, Valtio, a MobX singleton) or needs an
61
- * argument only the source supplies (Jotai atoms, an XState actor). Nothing in the running app
62
- * points at those, so they still need the app to hand them over, and the hint still earns its place.
63
- */
64
- const AUTO_DISCOVERED_DEPS = new Set([
65
- '@tanstack/react-query',
66
- '@reduxjs/toolkit',
67
- 'redux',
68
- ]);
69
- /**
70
- * The store libraries this app depends on AND the running app cannot reveal on its own, as
71
- * ready-to-uncomment registration lines.
72
- */
73
- export function storeHints(deps) {
74
- return STORE_LIBRARIES.filter(([dep]) => deps.has(dep) && !AUTO_DISCOVERED_DEPS.has(dep)).map(([, hint]) => hint);
75
- }
76
- /**
77
- * Store factories whose EXPORTED result is the store instance itself — the form `registerStore`
78
- * takes directly. Each is gated on the app actually depending on that library, so a local helper
79
- * called `create` in an app with no store library is never mistaken for one.
80
- *
81
- * Deliberately short. The adapter-wrapped libraries (Jotai, XState, Valtio, MobX, TanStack Query)
82
- * need an argument we cannot infer — which atoms, which actor, which queryClient — so they keep the
83
- * commented hint. Guessing there produces a module that throws on import, which is strictly worse
84
- * than a comment.
85
- */
86
- const STORE_FACTORIES = [
87
- ['zustand', 'create'],
88
- ['@reduxjs/toolkit', 'configureStore'],
89
- ['redux', 'createStore'],
90
- ];
91
- /** `export const useCart = create<S>()(...)` / `export const store = configureStore({...})`. */
92
- function storeDeclaration(factory) {
93
- return new RegExp(`export\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*${factory}\\s*[<(]`, 'g');
94
- }
95
- /**
96
- * `src/cart-store.ts` → `cart`; `src/store.ts` → `app`. The key is what the agent reads state under,
97
- * so it has to be stable and distinct — two stores sharing one key would silently overwrite.
98
- */
99
- function storeKey(path, taken) {
100
- const file = (path.split('/').pop() ?? '').replace(/\.[^.]+$/, '');
101
- const base = file.replace(/[-_.]?stores?$/i, '').replace(/[^a-z0-9]+/gi, '-') || 'app';
102
- const key = base.toLowerCase();
103
- if (!taken.has(key))
104
- return key;
105
- for (let n = 2;; n += 1) {
106
- const candidate = `${key}-${String(n)}`;
107
- if (!taken.has(candidate))
108
- return candidate;
109
- }
110
- }
111
- /**
112
- * Module specifier for `store.ts` as seen FROM the generated dev module.
113
- *
114
- * The dev module is not always a sibling: Vite puts it at `src/reticle-dev.ts`, Next at
115
- * `app/reticle-dev.tsx` or `src/app/reticle-dev.tsx`. A specifier computed for one is dead in the
116
- * other, and a dead import in this file breaks the module every other capability hangs off — so the
117
- * relative path is computed, not assumed.
118
- */
119
- function importPathFor(storePath, fromDir) {
120
- const noExt = storePath.replace(/\.[^./]+$/, '');
121
- const rel = posix.relative(fromDir, noExt);
122
- return rel.startsWith('.') ? rel : `./${rel}`;
123
- }
124
- /** Where the generated dev module lives, for Vite. Next passes its own. */
125
- const DEFAULT_DEV_MODULE_DIR = 'src';
126
- /**
127
- * Store instances declared in the app's own source, ready to import and register.
128
- *
129
- * Only exported declarations of a factory the app actually depends on: anything less certain would
130
- * generate an import that breaks the dev module everything else hangs off, and a broken module is
131
- * worse than the commented hint it replaces.
132
- */
133
- export function scanStores(files, deps, fromDir = DEFAULT_DEV_MODULE_DIR) {
134
- const factories = STORE_FACTORIES.filter(([dep]) => deps.has(dep)).map(([, f]) => f);
135
- const found = [];
136
- const keys = new Set();
137
- for (const { path, source } of files) {
138
- for (const factory of factories) {
139
- for (const m of source.matchAll(storeDeclaration(factory))) {
140
- const ident = m[1];
141
- if (ident === undefined)
142
- continue;
143
- const key = storeKey(path, keys);
144
- keys.add(key);
145
- found.push({ key, ident, importPath: importPathFor(path, fromDir) });
146
- }
147
- }
148
- }
149
- return found;
150
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * The last thing `init` prints, and the only part of it a user is asked to act on.
3
- *
4
- * Split out of `run.ts` because that file sits exactly at the 1000-line cohesion cap, and because
5
- * this IS a separate concern: everything else in `run.ts` decides what to write, and this decides
6
- * what to say afterwards. The two failure modes are different too — a wrong write breaks an
7
- * install, a wrong sentence loses a user quietly.
8
- */
9
- import { Framework } from './detect.js';
10
- import { StepStatus } from './plan.js';
11
- /**
12
- * The standing ask, printed at the end of every `init`.
13
- *
14
- * Addressed to the agent as much as the human: whichever of them just ran this command is the one
15
- * holding the experience, and neither has a Reticle tool surface to file through at this point.
16
- *
17
- * Printed by the `runInit` wrapper, NOT by `report()` — see the comment there for why, and for how
18
- * the workspace redirect is kept from asking twice.
19
- */
20
- export declare const FEEDBACK_HINT: string;
21
- /**
22
- * The last two lines a user reads, and the order matters.
23
- *
24
- * This used to say only "Restart <dev server>, then ask your agent: List Reticle sessions" — and
25
- * asking the agent was the one thing that could not work yet. `init` registers the MCP server, but
26
- * an agent client reads its tool list when it STARTS and never re-reads it, so the session that
27
- * just ran `init` has no `reticle_*` tools however clean the install was. The user follows the
28
- * instruction, the agent answers "unknown tool", and the obvious conclusion is that the install
29
- * failed.
30
- *
31
- * So the reload is named FIRST, before the sentence that depends on it. Omitted entirely when this
32
- * run did not register MCP (`--no-mcp`), where it would be advice about something we did not do.
33
- */
34
- export declare function restartHint(framework: Framework, mcpStatus: StepStatus | undefined,
35
- /** The project's own dev command, when package.json named one. */
36
- devCommand?: string): string;
@@ -1,120 +0,0 @@
1
- /**
2
- * The last thing `init` prints, and the only part of it a user is asked to act on.
3
- *
4
- * Split out of `run.ts` because that file sits exactly at the 1000-line cohesion cap, and because
5
- * this IS a separate concern: everything else in `run.ts` decides what to write, and this decides
6
- * what to say afterwards. The two failure modes are different too — a wrong write breaks an
7
- * install, a wrong sentence loses a user quietly.
8
- */
9
- import { Framework } from './detect.js';
10
- import { StepStatus } from './plan.js';
11
- import { wasMcpRegistered } from './mcp-registered.js';
12
- import { CLI } from './agent-rules.js';
13
- /**
14
- * The standing ask, printed at the end of every `init`.
15
- *
16
- * Addressed to the agent as much as the human: whichever of them just ran this command is the one
17
- * holding the experience, and neither has a Reticle tool surface to file through at this point.
18
- *
19
- * Printed by the `runInit` wrapper, NOT by `report()` — see the comment there for why, and for how
20
- * the workspace redirect is kept from asking twice.
21
- */
22
- export const FEEDBACK_HINT = 'Anything wrong, missing, or awkward — in this setup or in Reticle itself? Tell us; it is the ' +
23
- 'one thing that decides what gets fixed:\n' +
24
- ` ${CLI} feedback --agent --kind <bug|gap|ambiguity|feature_request|improvement> "what happened" (agents)\n` +
25
- ` ${CLI} feedback "what worked, what didn't" (humans)`;
26
- /**
27
- * What to say about the dev server.
28
- *
29
- * Names the project's own script when `package.json` has a recognisable one, and otherwise says the
30
- * THING rather than guessing the command.
31
- *
32
- * The guesses that used to live here — `vite`, `next dev`, `astro dev` — were wrong often enough to
33
- * be worth deleting. Measured on a real app: rowy has no `dev` script at all, so "Restart `vite`"
34
- * sent the reader to work out what was meant instead of starting a server. Nobody needs the guess:
35
- * an agent reading this can open package.json, and a human already knows how they start their own
36
- * app. A wrong command costs more than a missing one.
37
- */
38
- function devServerRestart(_framework, devCommand) {
39
- return devCommand === undefined
40
- ? 'Restart your dev server'
41
- : `Restart your dev server (\`${devCommand}\`)`;
42
- }
43
- /**
44
- * The last two lines a user reads, and the order matters.
45
- *
46
- * This used to say only "Restart <dev server>, then ask your agent: List Reticle sessions" — and
47
- * asking the agent was the one thing that could not work yet. `init` registers the MCP server, but
48
- * an agent client reads its tool list when it STARTS and never re-reads it, so the session that
49
- * just ran `init` has no `reticle_*` tools however clean the install was. The user follows the
50
- * instruction, the agent answers "unknown tool", and the obvious conclusion is that the install
51
- * failed.
52
- *
53
- * So the reload is named FIRST, before the sentence that depends on it. Omitted entirely when this
54
- * run did not register MCP (`--no-mcp`), where it would be advice about something we did not do.
55
- */
56
- export function restartHint(framework, mcpStatus,
57
- /** The project's own dev command, when package.json named one. */
58
- devCommand) {
59
- const dev = `${devServerRestart(framework, devCommand)}.`;
60
- // NAME THE COMMAND THAT PROVES IT, not one that merely asks.
61
- //
62
- // `init` writes files and stops; the install is not finished until an app carrying the SDK has
63
- // actually dialled the daemon, and nothing here confirmed that. The field shape is unambiguous:
64
- // people complete the agent half, never complete the app half, and keep a daemon running for
65
- // weeks with nothing to drive — so this is the last instruction most of them read.
66
- //
67
- // "Ask your agent: List Reticle sessions" asks a question whose failure is a dead end. `reticle
68
- // status` ANSWERS it: as of 2.7.0 it reports the session, or says why there is none — no app
69
- // running, an app running that never dialled us, a tab that closed — with the fix for each.
70
- // The one thing that works BEFORE the restart, so it goes before it.
71
- //
72
- // What comes after the restart, named as a JOB rather than as a capability.
73
- //
74
- // This used to point at a `reticle demo` command that opened its own browser and drove one
75
- // control. It was cut: a demo command is a side show. The thing a user needs to see is THEIR app,
76
- // instrumented in THEIR codebase, driven by THEIR agent through the tools they just installed —
77
- // because that is the workflow they are deciding whether to adopt, and a bespoke demo path proves
78
- // nothing about it.
79
- //
80
- // So the close hands the agent the sequence instead. It is deliberately one drive of one real
81
- // flow ending in a verdict, because an install that ends in "the tools are available" is an
82
- // install that ends in nothing.
83
- const demo = 'Then drive one real flow of your app end to end and report the verdict — that is the install ' +
84
- "proving itself, and it is the agent's job, not a separate command.";
85
- const prove = 'Then run `npx @reticlehq/server status` — it confirms the app connected, or says exactly why ' +
86
- 'it has not.';
87
- // Nothing registered this run (`--no-mcp`, or a client that needs a manual edit): a restart picks
88
- // up nothing, so advice about one would be advice about something we did not do.
89
- if (!wasMcpRegistered(mcpStatus))
90
- return `${dev}\n${demo}\n${prove}`;
91
- // ALREADY: the tools are reachable RIGHT NOW, and this is the branch that used to lie.
92
- //
93
- // `wasMcpRegistered` is true for both APPLY and ALREADY, which is correct for the funnel field it
94
- // was written for and wrong here, because the two cases have opposite answers to "must anybody
95
- // restart". Every second project on a machine, and every Claude Code plugin install, took the
96
- // APPLY text: "restart your agent — the tools only appear after that". An agent reads this AFTER
97
- // whatever its skill file said, and it describes the output in front of it, so it wins. The agent
98
- // stops with the project wired and nothing driven, which is the exact failure the install path
99
- // exists to prevent, caused by the install path itself.
100
- if (mcpStatus === StepStatus.ALREADY) {
101
- return (`${dev}\n` +
102
- `${demo}\n` +
103
- 'The Reticle MCP server was already registered on this machine, so there is no restart to do ' +
104
- 'and the tools are available now.\n' +
105
- `${prove}\n` +
106
- 'Once it shows a session, drive a flow — that is the install finished. Carry straight on; ' +
107
- 'nothing here is waiting on a human.');
108
- }
109
- return (`${dev}\n` +
110
- `${demo}\n` +
111
- 'Then restart your agent so it picks up the new MCP server — restart Claude Code, reload the ' +
112
- 'window in Cursor, or hit Start in `.vscode/mcp.json` in VS Code.\n' +
113
- 'The tools only appear after that: your agent read its server list before Reticle existed, ' +
114
- 'and no slash command re-reads it (`/mcp` manages servers already loaded, so it cannot pick ' +
115
- 'up a new one). This is once per machine — Reticle is registered globally, so every later ' +
116
- 'project starts with the tools already there.\n' +
117
- `${prove}\n` +
118
- 'Once it shows a session, drive one flow and report the verdict — that is the install ' +
119
- 'finished. Do it now; nothing here is waiting on a human.');
120
- }
@@ -1,2 +0,0 @@
1
- /** True when this step is what makes the app dial the daemon. */
2
- export declare function isConnectStep(title: string): boolean;