@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,50 +0,0 @@
1
- /**
2
- * Which `init` steps decide whether the app can dial the daemon.
3
- *
4
- * Lifted out of `plan.ts` when that file reached the size backstop. A cohesive unit on its own
5
- * terms: one question, asked of a step title, with one consequence — a manual step in this set makes
6
- * `init` exit non-zero instead of reporting a success over an app that can never connect.
7
- *
8
- * Matched on TITLES, which is the fragile part and worth stating: renaming a step in
9
- * `plan-framework.ts` silently drops it out of this set and nothing goes red. `connect-steps.test.ts`
10
- * pins the membership for exactly that reason.
11
- */
12
- /**
13
- * Titles of the steps WITHOUT which no session ever appears.
14
- *
15
- * A ⚠ on one of these is not a warning, it is a guaranteed failure: nothing performs the manual step,
16
- * so the app will not connect and every Reticle tool will answer "no browser session connected".
17
- * Reported from a field sweep, where the ⚠ count and "did it connect" were treated as independent
18
- * signals and are not.
19
- */
20
- const CONNECT_STEP_TITLES = new Set([
21
- 'Connect snippet',
22
- 'Connect snippet (CRA)',
23
- 'Connect snippet (Astro)',
24
- 'Connect snippet (Nuxt)',
25
- 'Reticle client hook',
26
- 'Reticle connect module',
27
- 'ReticleDev component',
28
- // Writing the component and MOUNTING it are two steps, and only the write was here. A root layout
29
- // whose shape `init` does not recognise leaves the component on disk and never rendered: the SDK
30
- // is in the project, nothing imports it, and `init` exited 0 over an app that could not connect.
31
- 'Mount ReticleDev',
32
- // NOT here, and the reason is worth keeping: 'Pairing token'.
33
- //
34
- // It is a genuine connect step — CRA inlines only REACT_APP_*, so without the token in the env
35
- // file the bridge refuses every connection and the app boots, looks correct, and never pairs. But
36
- // it goes MANUAL in exactly one situation: no daemon has ever run on this machine, so there is no
37
- // token to inline. That is the FIRST CRA install on a fresh machine, i.e. the first-time user —
38
- // and making that exit non-zero reports a broken install to the one person least able to tell
39
- // that it is not.
40
- //
41
- // The real fix is for `init` to mint the token rather than only read it, which is what both the
42
- // daemon and the Vite plugin already do. `runInit` is synchronous and the existing helpers are
43
- // not, and `gate:install` scaffolds no CRA app, so that change would ship with no coverage of the
44
- // path it changes. It is worth doing, and worth doing with a scaffold behind it.
45
- 'Vite plugin',
46
- ]);
47
- /** True when this step is what makes the app dial the daemon. */
48
- export function isConnectStep(title) {
49
- return CONNECT_STEP_TITLES.has(title);
50
- }
@@ -1,79 +0,0 @@
1
- /**
2
- * Wiring Reticle into a Create React App project.
3
- *
4
- * CRA had no automated path: init reported `⚠ Connect snippet → index.html`, a target that cannot
5
- * work. CRA's `public/index.html` is a static template the bundler never processes for modules, so a
6
- * bare import in it resolves to nothing. `src/index.tsx` is what gets bundled, and that is where the
7
- * connect has to arrive.
8
- *
9
- * The token is the second half of the problem. Every other stack has somewhere to inline it —
10
- * Vite defines `__RETICLE_TOKEN__`, the Astro and HTML snippets read the file in Node. `src/index.tsx`
11
- * is browser code inside a bundler that inlines exactly one thing: environment variables prefixed
12
- * `REACT_APP_`. So it travels through `.env.development.local`, which is CRA's own documented
13
- * mechanism and is gitignored by CRA's own template.
14
- */
15
- /** The line added to `src/index.tsx` / `src/index.js`. Side-effect import: the module guards itself on NODE_ENV. */
16
- export declare const CRA_DEV_MODULE_IMPORT = "import './reticle-dev';";
17
- /**
18
- * Where the connect module lands — `.ts` only when the app already speaks TypeScript.
19
- *
20
- * A JavaScript CRA project has no tsconfig and cannot resolve `.ts` (#675). Emitting `.ts` there
21
- * makes the first compile after init fail while the plan still reports `[✓]`.
22
- */
23
- export declare function craDevModulePath(typescript: boolean): string;
24
- /** TypeScript default path — prefer `craDevModulePath` when the project's language is known. */
25
- export declare const CRA_DEV_MODULE_PATH: string;
26
- export declare const CRA_ENV_PATH = ".env.development.local";
27
- export declare const TOKEN_VAR = "REACT_APP_RETICLE_TOKEN";
28
- /**
29
- * The bridge URL, carried through the same channel as the token.
30
- *
31
- * CRA is the one supported stack with no build-time hook of ours: no plugin, no config wrapper, no
32
- * `define`. Vite and Astro re-resolve the daemon every dev-server start and Next does it through
33
- * `withReticle`; CRA has nowhere to run that code. So the URL goes where the token already goes, and
34
- * is refreshed by the same `init` step that refreshes the token.
35
- *
36
- * That makes `reticle init` the heal rather than the dev server, which is weaker and is stated
37
- * plainly in the step's own detail. It is still strictly better than a URL frozen into a source file
38
- * the owner has to hand-edit, and `.env.development.local` is already the per-machine file.
39
- */
40
- export declare const URL_VAR = "REACT_APP_RETICLE_URL";
41
- /**
42
- * What the app itself says when the token is not there.
43
- *
44
- * The token is a per-machine secret and CRA's own template gitignores the file it lives in, so it
45
- * CANNOT travel with the repo — that part is correct and must stay. What was wrong is that it failed
46
- * silently: a teammate clones, runs `npm start`, and the app connects with an empty token, so the
47
- * only signal is the bridge's generic `authentication failed` in a console nobody had open. Naming
48
- * the variable, the gitignored file and the one command that fixes it turns a dead app into a
49
- * one-line repair. Every other stack reads the token in Node at dev-server start (the Vite plugin,
50
- * withReticle); CRA has no such hook without ejecting, so this message is the fix.
51
- */
52
- export declare const CRA_TOKEN_MISSING_NOTE: string;
53
- /**
54
- * Said as its own NOTICE line, beside the write — not inside it.
55
- *
56
- * The caveat has always been in the write step's `detail`, and the write step renders `[✓]`. But
57
- * `SKILL.md` tells whoever reads the report: *"If every line is `✓`, `·` or `–`, skip to Step 4 and
58
- * validate."* So the one fact that makes this install conditional sat in the one place the reading
59
- * protocol says to ignore — which is exactly how it was reported to us as "4 OK marks and no
60
- * warning". The words were on screen; the reader was following instructions.
61
- *
62
- * It cannot simply be promoted: `run.ts` only writes steps whose status is APPLY, so demoting the
63
- * token step to NOTICE would stop it writing the token and break the install outright.
64
- */
65
- export declare const CRA_TOKEN_PER_MACHINE_NOTICE: string;
66
- /** Add the import after the last existing one, or null when it is already present. */
67
- export declare function craImportPatch(source: string): string | null;
68
- /** Set the token variable, or null when nothing needs to change. */
69
- export declare function craEnvPatch(existing: string | null, token: string, url?: string): string | null;
70
- /** Options for the CRA connect module. */
71
- export interface CraDevModuleOptions {
72
- /**
73
- * When false, emit a `.js`-shaped body (no `export {}`). Default true for callers that predate
74
- * the language branch.
75
- */
76
- typescript?: boolean;
77
- }
78
- /** The dev-only connect module imported from the app entry. */
79
- export declare function craDevModuleFile(port: number | undefined, projectId?: string, options?: CraDevModuleOptions): string;
package/dist/init/cra.js DELETED
@@ -1,178 +0,0 @@
1
- /**
2
- * Wiring Reticle into a Create React App project.
3
- *
4
- * CRA had no automated path: init reported `⚠ Connect snippet → index.html`, a target that cannot
5
- * work. CRA's `public/index.html` is a static template the bundler never processes for modules, so a
6
- * bare import in it resolves to nothing. `src/index.tsx` is what gets bundled, and that is where the
7
- * connect has to arrive.
8
- *
9
- * The token is the second half of the problem. Every other stack has somewhere to inline it —
10
- * Vite defines `__RETICLE_TOKEN__`, the Astro and HTML snippets read the file in Node. `src/index.tsx`
11
- * is browser code inside a bundler that inlines exactly one thing: environment variables prefixed
12
- * `REACT_APP_`. So it travels through `.env.development.local`, which is CRA's own documented
13
- * mechanism and is gitignored by CRA's own template.
14
- */
15
- import { bridgeWsUrl } from '@reticlehq/core';
16
- import { CLI } from './agent-rules.js';
17
- /** The line added to `src/index.tsx` / `src/index.js`. Side-effect import: the module guards itself on NODE_ENV. */
18
- export const CRA_DEV_MODULE_IMPORT = "import './reticle-dev';";
19
- /**
20
- * Where the connect module lands — `.ts` only when the app already speaks TypeScript.
21
- *
22
- * A JavaScript CRA project has no tsconfig and cannot resolve `.ts` (#675). Emitting `.ts` there
23
- * makes the first compile after init fail while the plan still reports `[✓]`.
24
- */
25
- export function craDevModulePath(typescript) {
26
- return typescript ? 'src/reticle-dev.ts' : 'src/reticle-dev.js';
27
- }
28
- /** TypeScript default path — prefer `craDevModulePath` when the project's language is known. */
29
- export const CRA_DEV_MODULE_PATH = craDevModulePath(true);
30
- export const CRA_ENV_PATH = '.env.development.local';
31
- export const TOKEN_VAR = 'REACT_APP_RETICLE_TOKEN';
32
- /**
33
- * The bridge URL, carried through the same channel as the token.
34
- *
35
- * CRA is the one supported stack with no build-time hook of ours: no plugin, no config wrapper, no
36
- * `define`. Vite and Astro re-resolve the daemon every dev-server start and Next does it through
37
- * `withReticle`; CRA has nowhere to run that code. So the URL goes where the token already goes, and
38
- * is refreshed by the same `init` step that refreshes the token.
39
- *
40
- * That makes `reticle init` the heal rather than the dev server, which is weaker and is stated
41
- * plainly in the step's own detail. It is still strictly better than a URL frozen into a source file
42
- * the owner has to hand-edit, and `.env.development.local` is already the per-machine file.
43
- */
44
- export const URL_VAR = 'REACT_APP_RETICLE_URL';
45
- /**
46
- * What the app itself says when the token is not there.
47
- *
48
- * The token is a per-machine secret and CRA's own template gitignores the file it lives in, so it
49
- * CANNOT travel with the repo — that part is correct and must stay. What was wrong is that it failed
50
- * silently: a teammate clones, runs `npm start`, and the app connects with an empty token, so the
51
- * only signal is the bridge's generic `authentication failed` in a console nobody had open. Naming
52
- * the variable, the gitignored file and the one command that fixes it turns a dead app into a
53
- * one-line repair. Every other stack reads the token in Node at dev-server start (the Vite plugin,
54
- * withReticle); CRA has no such hook without ejecting, so this message is the fix.
55
- */
56
- export const CRA_TOKEN_MISSING_NOTE = `${TOKEN_VAR} is not set, so Reticle cannot pair with the daemon. ` +
57
- `The pairing token is per-machine and ${CRA_ENV_PATH} is gitignored by CRA's template, ` +
58
- `so it does not survive a clone. Run \`${CLI} init\` in this project to write it for this machine.`;
59
- /**
60
- * Said as its own NOTICE line, beside the write — not inside it.
61
- *
62
- * The caveat has always been in the write step's `detail`, and the write step renders `[✓]`. But
63
- * `SKILL.md` tells whoever reads the report: *"If every line is `✓`, `·` or `–`, skip to Step 4 and
64
- * validate."* So the one fact that makes this install conditional sat in the one place the reading
65
- * protocol says to ignore — which is exactly how it was reported to us as "4 OK marks and no
66
- * warning". The words were on screen; the reader was following instructions.
67
- *
68
- * It cannot simply be promoted: `run.ts` only writes steps whose status is APPLY, so demoting the
69
- * token step to NOTICE would stop it writing the token and break the install outright.
70
- */
71
- export const CRA_TOKEN_PER_MACHINE_NOTICE = `${CRA_ENV_PATH} is in CRA's own .gitignore, so the token just written does not travel. ` +
72
- 'It works on THIS machine and nowhere else: a teammate cloning the repo, CI, or a container ' +
73
- 'gets an app that boots, never pairs, and reports it only in the browser console. ' +
74
- `Each developer runs \`${CLI} init\` once locally.`;
75
- /** Add the import after the last existing one, or null when it is already present. */
76
- export function craImportPatch(source) {
77
- if (source.includes(CRA_DEV_MODULE_IMPORT))
78
- return null;
79
- const lines = source.split('\n');
80
- // After the LAST import: React's own imports must still run first, and a side-effect import placed
81
- // above them would connect before the app exists.
82
- let lastImport = -1;
83
- for (const [index, line] of lines.entries()) {
84
- if (/^\s*import\s/.test(line))
85
- lastImport = index;
86
- }
87
- lines.splice(lastImport + 1, 0, CRA_DEV_MODULE_IMPORT);
88
- return lines.join('\n');
89
- }
90
- /** Set the token variable, or null when nothing needs to change. */
91
- export function craEnvPatch(existing, token, url) {
92
- if ('' === token)
93
- return null;
94
- const pairs = [
95
- [TOKEN_VAR, token],
96
- ...(url !== undefined && url.length > 0 ? [[URL_VAR, url]] : []),
97
- ];
98
- let next = null === existing || '' === existing.trim() ? '' : existing;
99
- for (const [name, value] of pairs) {
100
- const line = `${name}=${value}`;
101
- if (next.includes(line))
102
- continue;
103
- // Replace rather than append: two assignments of one variable is a silent coin flip on which
104
- // wins, and for the URL that coin decides which daemon the app talks to.
105
- if (new RegExp(`^${name}=`, 'm').test(next)) {
106
- next = next.replace(new RegExp(`^${name}=.*$`, 'm'), line);
107
- }
108
- else {
109
- next = `${'' === next || next.endsWith('\n') ? next : `${next}\n`}${line}\n`;
110
- }
111
- }
112
- return next === (existing ?? '') ? null : next;
113
- }
114
- /** The dev-only connect module imported from the app entry. */
115
- export function craDevModuleFile(port, projectId, options = {}) {
116
- const typescript = false !== options.typescript;
117
- const fields = [];
118
- // `bridgeWsUrl`, not a hand-written string. This was the only client URL in the product spelling
119
- // the host as `127.0.0.1` while every other generator said `localhost` — same endpoint, but a
120
- // difference with no reason behind it is the kind that becomes a real one after somebody edits half
121
- // of it.
122
- if (port !== undefined)
123
- fields.push(`url: '${bridgeWsUrl(port)}'`);
124
- if (projectId !== undefined && projectId.length > 0)
125
- fields.push(`projectId: '${projectId}'`);
126
- // Multiline on purpose (#684): a single-line connect + console.error fails CRA boilerplate
127
- // Prettier (printWidth 80) and the project's own lint blocks a clean install.
128
- const connectFields = [
129
- ...fields.map((f) => ` ${f},`),
130
- ' ...(url.length > 0 ? { url } : {}),',
131
- ' ...(token.length > 0 ? { token } : {}),',
132
- ].join('\n');
133
- // Split so every emitted line stays under a CRA boilerplate printWidth of 80 (#684). A single
134
- // JSON.stringify of the whole note is ~290 characters and fails prettier-as-eslint on install.
135
- // Chunks are joined with `+` in the emitted file; together they equal `[reticle] ${CRA_TOKEN_MISSING_NOTE}`.
136
- const missingChunks = [
137
- `[reticle] ${TOKEN_VAR} is not set, so Reticle `,
138
- 'cannot pair with the daemon. The pairing token is ',
139
- `per-machine and ${CRA_ENV_PATH} is gitignored by `,
140
- "CRA's template, so it does not survive a clone. Run ",
141
- `\`${CLI} init\` in this project to write it for this `,
142
- 'machine.',
143
- ].map((c) => JSON.stringify(c));
144
- // Eight spaces match the indent inside `console.error(` below.
145
- const missingExpr = missingChunks.join(' +\n ');
146
- // `export {}` is a TypeScript empty-module marker. A `.js` file with it is fine under Babel, but
147
- // the workaround reporters used was to drop it when renaming to `.js` — keep the JS emit clean.
148
- const trailer = typescript ? '\nexport {};\n' : '\n';
149
- return `// Dev-only: connect Reticle. Imported for its side effect from src/index.tsx.
150
- //
151
- // CRA's public/index.html is a static template the bundler never processes for
152
- // modules, so the connect cannot live there. The pairing token arrives through
153
- // REACT_APP_RETICLE_TOKEN because REACT_APP_* is the only thing CRA inlines
154
- // into browser code.
155
- if (process.env.NODE_ENV === 'development') {
156
- void import('@reticlehq/react').then(({ reticle, install }) => {
157
- install();
158
- const token = process.env.${TOKEN_VAR} ?? '';
159
- // Written by \`reticle init\` from the daemon that was live when it ran, and
160
- // refreshed by re-running it. CRA gives us no hook to resolve this at
161
- // dev-server start, so if the daemon moves, re-run \`reticle init\` rather
162
- // than editing the url below.
163
- const url = process.env.${URL_VAR} ?? '';
164
- // Loud on purpose: without this the only symptom is the bridge's generic
165
- // auth failure.
166
- if (token.length === 0) {
167
- console.error(
168
- ${missingExpr},
169
- );
170
- }
171
- // Still attempt it — a bridge running without a token pairs fine.
172
- reticle.connect({
173
- ${connectFields}
174
- });
175
- });
176
- }
177
- ${trailer}`;
178
- }
@@ -1,38 +0,0 @@
1
- /**
2
- * Does this app's Content-Security-Policy let the browser reach the Reticle bridge?
3
- *
4
- * Two independent field reports, both Next: `init` reported every step successful, the SDK mounted,
5
- * the dial URL was correct, and the app never connected because a strict `connect-src` excluded
6
- * `ws://localhost:<port>`. The browser blocks the WebSocket and says so in its own console, which
7
- * nothing on the Reticle side reads — so `status` and `doctor` reported perfect health at an app
8
- * that could not connect at all, forever. A setup step that exits 0 while leaving the user broken is
9
- * the worst failure mode this repo has.
10
- *
11
- * A TEXT SCAN, deliberately. `headers()` is a function; `init` cannot execute a user's Next config
12
- * without importing their whole app, and the thing worth finding is the policy string a developer
13
- * typed — in `next.config.*`, in middleware, or in a `<meta http-equiv>` tag. The scan finds the
14
- * string wherever it is written.
15
- *
16
- * NARROW on purpose: it fires only when a `connect-src` exists AND does not admit the bridge. No
17
- * CSP, or one that already covers us, produces nothing. A warning that fires on a working setup
18
- * costs precisely what a green check on a broken one costs, and this file exists because of the
19
- * second kind.
20
- */
21
- /**
22
- * The problem with this app's `connect-src`, or undefined if there is not one.
23
- *
24
- * `https:` counts as a wildcard here only in the sense that a policy written that loosely will not
25
- * be the thing blocking a dev WebSocket; the check stays quiet rather than arguing about it.
26
- */
27
- export declare function cspConnectSrcProblem(text: string, port: number): string | undefined;
28
- /** The exact addition to paste. Text to copy, not advice to interpret. */
29
- export declare function devCspAddition(port: number): string;
30
- /** The step title, named here so `doctor` and the plan cannot drift apart on what this check is called. */
31
- export declare const CSP_STEP_TITLE = "Content-Security-Policy";
32
- /**
33
- * The first blocking policy among the sources `init` already has in hand, or undefined.
34
- *
35
- * At most one finding: a second copy of the same policy in a second file is the same problem, and
36
- * two identical notices read as two problems.
37
- */
38
- export declare function cspPlanProblem(sources: readonly (string | null | undefined)[], port: number): string | undefined;
@@ -1,107 +0,0 @@
1
- /**
2
- * Does this app's Content-Security-Policy let the browser reach the Reticle bridge?
3
- *
4
- * Two independent field reports, both Next: `init` reported every step successful, the SDK mounted,
5
- * the dial URL was correct, and the app never connected because a strict `connect-src` excluded
6
- * `ws://localhost:<port>`. The browser blocks the WebSocket and says so in its own console, which
7
- * nothing on the Reticle side reads — so `status` and `doctor` reported perfect health at an app
8
- * that could not connect at all, forever. A setup step that exits 0 while leaving the user broken is
9
- * the worst failure mode this repo has.
10
- *
11
- * A TEXT SCAN, deliberately. `headers()` is a function; `init` cannot execute a user's Next config
12
- * without importing their whole app, and the thing worth finding is the policy string a developer
13
- * typed — in `next.config.*`, in middleware, or in a `<meta http-equiv>` tag. The scan finds the
14
- * string wherever it is written.
15
- *
16
- * NARROW on purpose: it fires only when a `connect-src` exists AND does not admit the bridge. No
17
- * CSP, or one that already covers us, produces nothing. A warning that fires on a working setup
18
- * costs precisely what a green check on a broken one costs, and this file exists because of the
19
- * second kind.
20
- */
21
- /** Sources that admit any ws origin, so the bridge is already reachable. */
22
- const WILDCARDS = ['*', 'ws:', 'wss:', 'ws://*', 'https:'];
23
- /** The two hosts the SDK may dial. `localhost` and the IPv4 loopback are different CSP sources. */
24
- function bridgeOrigins(port) {
25
- return [`ws://localhost:${String(port)}`, `ws://127.0.0.1:${String(port)}`];
26
- }
27
- /**
28
- * The `connect-src` directive's source list, or undefined when the text declares none.
29
- *
30
- * Matches to the end of the directive (`;`) or the end of the enclosing quoted string, which is how
31
- * these are written in both a Next `headers()` value and a `<meta content="...">`.
32
- */
33
- function directiveSources(text, directive) {
34
- // Stops at the directive separator or the closing double quote of the enclosing string. Single
35
- // quotes are NOT terminators: `'self'` is a source, not the end of the list.
36
- const match = new RegExp(`${directive}([^;"]*)`, 'i').exec(text);
37
- const list = match?.[1];
38
- if (list === undefined)
39
- return undefined;
40
- return list
41
- .split(/\s+/)
42
- .map((source) => source.trim())
43
- .filter((source) => source.length > 0);
44
- }
45
- /**
46
- * What this policy allows a WebSocket to reach — `connect-src`, or `default-src` when it is absent.
47
- *
48
- * The fallback is the CSP spec's, and leaving it out made the check blind to the commonest strict
49
- * policy there is. MarkText, a production Electron editor, declares
50
- * `default-src 'self'; script-src 'self'; …` with NO `connect-src`: its WebSockets are restricted to
51
- * 'self', the bridge is blocked, and this returned "no problem" because it was looking for a
52
- * directive that was not written. Every fetch-directive falls back to `default-src`; that is what
53
- * `default` means, and it is why an author does not repeat themselves.
54
- *
55
- * Still undefined when NEITHER is present — a policy that constrains neither is not blocking us.
56
- */
57
- function connectSrcSources(text) {
58
- return directiveSources(text, 'connect-src') ?? directiveSources(text, 'default-src');
59
- }
60
- /**
61
- * The problem with this app's `connect-src`, or undefined if there is not one.
62
- *
63
- * `https:` counts as a wildcard here only in the sense that a policy written that loosely will not
64
- * be the thing blocking a dev WebSocket; the check stays quiet rather than arguing about it.
65
- */
66
- export function cspConnectSrcProblem(text, port) {
67
- const sources = connectSrcSources(text);
68
- if (sources === undefined || 0 === sources.length)
69
- return undefined;
70
- if (sources.some((source) => WILDCARDS.includes(source)))
71
- return undefined;
72
- const wanted = bridgeOrigins(port);
73
- // BOTH, not either: the SDK picks its host from how the page was served, and a policy that admits
74
- // one is a coin flip. A coin flip that fails is indistinguishable from every other silent
75
- // non-connect, which is the whole cost being avoided here.
76
- if (wanted.every((origin) => sources.includes(origin)))
77
- return undefined;
78
- const missing = wanted.filter((origin) => !sources.includes(origin));
79
- return (`this app declares a Content-Security-Policy whose \`connect-src\` does not admit the Reticle ` +
80
- `bridge: ${missing.join(' and ')} ${1 === missing.length ? 'is' : 'are'} missing. The browser ` +
81
- `will block the WebSocket and report it in ITS console only — every check on the Reticle side ` +
82
- `will pass while the app never connects. ${devCspAddition(port)}`);
83
- }
84
- /** The exact addition to paste. Text to copy, not advice to interpret. */
85
- export function devCspAddition(port) {
86
- return (`Add to \`connect-src\` in development only (e.g. behind ` +
87
- `\`process.env.NODE_ENV === 'development'\`): ` +
88
- `${bridgeOrigins(port).join(' ')}`);
89
- }
90
- /** The step title, named here so `doctor` and the plan cannot drift apart on what this check is called. */
91
- export const CSP_STEP_TITLE = 'Content-Security-Policy';
92
- /**
93
- * The first blocking policy among the sources `init` already has in hand, or undefined.
94
- *
95
- * At most one finding: a second copy of the same policy in a second file is the same problem, and
96
- * two identical notices read as two problems.
97
- */
98
- export function cspPlanProblem(sources, port) {
99
- for (const source of sources) {
100
- if ('string' !== typeof source)
101
- continue;
102
- const problem = cspConnectSrcProblem(source, port);
103
- if (problem !== undefined)
104
- return problem;
105
- }
106
- return undefined;
107
- }
@@ -1,32 +0,0 @@
1
- /**
2
- * `doctor`'s web CSP check — the sibling of the desktop one next door.
3
- *
4
- * The desktop findings exist because a Tauri app with the default CSP runs perfectly and never
5
- * connects. The WEB version of that failure had no check at all, and it arrived twice in one batch
6
- * of field reports: two Next apps where `init` printed success for every step, the SDK mounted, the
7
- * dial URL was right, and the browser silently refused the WebSocket because `connect-src` excluded
8
- * the bridge. The violation is reported in the browser's console and nowhere else, so every check on
9
- * this side stayed green while the app was permanently unreachable.
10
- *
11
- * Reads the files a CSP is actually written in, by name — a full source scan would be slower and
12
- * would find policy strings in test fixtures and documentation.
13
- */
14
- /** Read a project-relative file, or undefined when it is absent/unreadable. */
15
- type ReadFile = (relative: string) => string | undefined;
16
- export interface CspDiagnosis {
17
- /** Which file to look at. */
18
- file: string;
19
- /** What is wrong, in one line. */
20
- problem: string;
21
- /** Exactly what to add — copy-pasteable, with the port actually in use. */
22
- fix: string;
23
- }
24
- /**
25
- * The places a Content-Security-Policy gets written in a JS app.
26
- *
27
- * Next config and middleware cover `headers()` and the edge-middleware style; the layouts and the
28
- * plain `index.html` cover the `<meta http-equiv>` style. Both reported cases were in this list.
29
- */
30
- export declare const CSP_FILES: readonly string[];
31
- export declare function diagnoseWebCsp(read: ReadFile, port: number, alsoCheck?: readonly string[]): CspDiagnosis[];
32
- export {};
@@ -1,54 +0,0 @@
1
- /**
2
- * `doctor`'s web CSP check — the sibling of the desktop one next door.
3
- *
4
- * The desktop findings exist because a Tauri app with the default CSP runs perfectly and never
5
- * connects. The WEB version of that failure had no check at all, and it arrived twice in one batch
6
- * of field reports: two Next apps where `init` printed success for every step, the SDK mounted, the
7
- * dial URL was right, and the browser silently refused the WebSocket because `connect-src` excluded
8
- * the bridge. The violation is reported in the browser's console and nowhere else, so every check on
9
- * this side stayed green while the app was permanently unreachable.
10
- *
11
- * Reads the files a CSP is actually written in, by name — a full source scan would be slower and
12
- * would find policy strings in test fixtures and documentation.
13
- */
14
- import { cspConnectSrcProblem, devCspAddition } from './csp-check.js';
15
- /**
16
- * The places a Content-Security-Policy gets written in a JS app.
17
- *
18
- * Next config and middleware cover `headers()` and the edge-middleware style; the layouts and the
19
- * plain `index.html` cover the `<meta http-equiv>` style. Both reported cases were in this list.
20
- */
21
- export const CSP_FILES = [
22
- 'next.config.js',
23
- 'next.config.mjs',
24
- 'next.config.ts',
25
- 'middleware.ts',
26
- 'middleware.js',
27
- 'src/middleware.ts',
28
- 'app/layout.tsx',
29
- 'app/layout.js',
30
- 'pages/_document.tsx',
31
- 'pages/_document.js',
32
- 'index.html',
33
- 'public/index.html',
34
- // Vite puts the entry HTML at the project root; electron-vite and Tauri put the RENDERER's one
35
- // under src/. MarkText declares its policy in `src/renderer/index.html`, and a desktop app is the
36
- // likeliest place to meet a strict CSP at all — Electron's own security guidance asks for one.
37
- 'src/index.html',
38
- 'src/renderer/index.html',
39
- 'vercel.json',
40
- 'netlify.toml',
41
- ];
42
- export function diagnoseWebCsp(read, port, alsoCheck = []) {
43
- const findings = [];
44
- for (const file of [...alsoCheck, ...CSP_FILES]) {
45
- const source = read(file);
46
- if (source === undefined)
47
- continue;
48
- const problem = cspConnectSrcProblem(source, port);
49
- if (problem === undefined)
50
- continue;
51
- findings.push({ file, problem, fix: devCspAddition(port) });
52
- }
53
- return findings;
54
- }
@@ -1,41 +0,0 @@
1
- /**
2
- * Setup RCA for desktop apps.
3
- *
4
- * Every failure this catches is SILENT. A Tauri app with the default CSP runs perfectly and simply
5
- * never appears in `reticle status` — the WebSocket is blocked before it opens, and nothing in the
6
- * app's own console says so. An Electron app missing the preload line works fine and reports zero
7
- * network activity forever, which reads as "the app makes no backend calls" rather than "you are
8
- * blind to all of them".
9
- *
10
- * Silent misconfiguration is the same disease as a false green: the tool answers confidently and the
11
- * answer is wrong. So the diagnosis names the file, the reason, and the exact line to add.
12
- *
13
- * Pure: a `read` function in, findings out. No fs, no cwd, no process.
14
- */
15
- export declare const DesktopFinding: {
16
- /** Tauri's CSP will block the bridge WebSocket — the app will never connect, with no error. */
17
- readonly TAURI_CSP_BLOCKS_BRIDGE: "tauri-csp-blocks-bridge";
18
- /** A custom CSP dropped the `ipc:` source Tauri needs for `invoke` itself. */
19
- readonly TAURI_CSP_BLOCKS_IPC: "tauri-csp-blocks-ipc";
20
- /** The preload never requires the shim, so every IPC call is invisible. */
21
- readonly ELECTRON_PRELOAD_MISSING: "electron-preload-missing";
22
- /** The main process never installs the capture helper, so screenshots are unavailable. */
23
- readonly ELECTRON_CAPTURE_MISSING: "electron-capture-missing";
24
- };
25
- export type DesktopFinding = (typeof DesktopFinding)[keyof typeof DesktopFinding];
26
- interface DesktopDiagnosis {
27
- code: DesktopFinding;
28
- /** Which file to look at. */
29
- file: string;
30
- /** What is wrong, in one line. */
31
- problem: string;
32
- /** Exactly what to add — copy-pasteable, with the port actually in use. */
33
- fix: string;
34
- }
35
- /** Reads a project-relative path. Undefined means the file does not exist. */
36
- type ReadFile = (path: string) => string | undefined;
37
- /** Is this project a desktop shell at all? Used to print a positive result instead of silence. */
38
- export declare function isDesktopProject(read: ReadFile): boolean;
39
- /** Which desktop shell (if any) this project is, and what is missing from its Reticle wiring. */
40
- export declare function diagnoseDesktop(read: ReadFile, port: number): DesktopDiagnosis[];
41
- export {};