@jevitate/cli 0.1.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (410) hide show
  1. package/README.md +23 -0
  2. package/dist/ai-cli.d.ts +31 -11
  3. package/dist/ai-cli.js +131 -88
  4. package/dist/ai-cli.js.map +1 -1
  5. package/dist/author-journey-cli.d.ts +4 -0
  6. package/dist/author-journey-cli.js +111 -0
  7. package/dist/author-journey-cli.js.map +1 -0
  8. package/dist/bin.js +60349 -16477
  9. package/dist/bin.js.map +1 -1
  10. package/dist/browser-run-options.d.ts +89 -0
  11. package/dist/browser-run-options.js +175 -0
  12. package/dist/browser-run-options.js.map +1 -0
  13. package/dist/build-info.generated.d.ts +2 -0
  14. package/dist/build-info.generated.js +10 -0
  15. package/dist/build-info.generated.js.map +1 -0
  16. package/dist/campaign-api.d.ts +151 -0
  17. package/dist/campaign-api.js +446 -0
  18. package/dist/campaign-api.js.map +1 -0
  19. package/dist/campaign-cli.d.ts +6 -0
  20. package/dist/campaign-cli.js +66 -0
  21. package/dist/campaign-cli.js.map +1 -0
  22. package/dist/check-api.d.ts +5 -0
  23. package/dist/check-api.js +234 -0
  24. package/dist/check-api.js.map +1 -0
  25. package/dist/check-budget.d.ts +26 -0
  26. package/dist/check-budget.js +90 -0
  27. package/dist/check-budget.js.map +1 -0
  28. package/dist/check-cli.d.ts +31 -0
  29. package/dist/check-cli.js +109 -0
  30. package/dist/check-cli.js.map +1 -0
  31. package/dist/check-execute.d.ts +29 -0
  32. package/dist/check-execute.js +420 -0
  33. package/dist/check-execute.js.map +1 -0
  34. package/dist/check-plan.d.ts +118 -0
  35. package/dist/check-plan.js +516 -0
  36. package/dist/check-plan.js.map +1 -0
  37. package/dist/check-suite.d.ts +184 -0
  38. package/dist/check-suite.js +540 -0
  39. package/dist/check-suite.js.map +1 -0
  40. package/dist/check-types.d.ts +181 -0
  41. package/dist/check-types.js +35 -0
  42. package/dist/check-types.js.map +1 -0
  43. package/dist/cli-args.d.ts +26 -0
  44. package/dist/cli-args.js +50 -0
  45. package/dist/cli-args.js.map +1 -0
  46. package/dist/cli-output.d.ts +106 -0
  47. package/dist/cli-output.js +563 -0
  48. package/dist/cli-output.js.map +1 -0
  49. package/dist/cli-reference.d.ts +3 -0
  50. package/dist/cli-reference.js +81 -0
  51. package/dist/cli-reference.js.map +1 -0
  52. package/dist/cli-refusal.d.ts +12 -0
  53. package/dist/cli-refusal.js +52 -0
  54. package/dist/cli-refusal.js.map +1 -0
  55. package/dist/cli-shared.d.ts +340 -0
  56. package/dist/cli-shared.js +537 -0
  57. package/dist/cli-shared.js.map +1 -0
  58. package/dist/cli-surface.d.ts +33 -0
  59. package/dist/cli-surface.js +48 -0
  60. package/dist/cli-surface.js.map +1 -0
  61. package/dist/conversation-options.d.ts +15 -0
  62. package/dist/conversation-options.js +10 -0
  63. package/dist/conversation-options.js.map +1 -0
  64. package/dist/credentials-file.d.ts +15 -0
  65. package/dist/credentials-file.js +56 -0
  66. package/dist/credentials-file.js.map +1 -0
  67. package/dist/data-dir.d.ts +1 -1
  68. package/dist/data-dir.js +1 -1
  69. package/dist/defect-evidence.d.ts +141 -0
  70. package/dist/defect-evidence.js +505 -0
  71. package/dist/defect-evidence.js.map +1 -0
  72. package/dist/demo-aspect-api.d.ts +209 -0
  73. package/dist/demo-aspect-api.js +398 -0
  74. package/dist/demo-aspect-api.js.map +1 -0
  75. package/dist/demo-aspect-cli.d.ts +3 -0
  76. package/dist/demo-aspect-cli.js +243 -0
  77. package/dist/demo-aspect-cli.js.map +1 -0
  78. package/dist/demo-capture.d.ts +142 -0
  79. package/dist/demo-capture.js +537 -0
  80. package/dist/demo-capture.js.map +1 -0
  81. package/dist/engine.d.ts +35 -0
  82. package/dist/engine.js +25 -0
  83. package/dist/engine.js.map +1 -0
  84. package/dist/environments.d.ts +155 -0
  85. package/dist/environments.js +364 -0
  86. package/dist/environments.js.map +1 -0
  87. package/dist/exit-codes.d.ts +46 -0
  88. package/dist/exit-codes.js +91 -0
  89. package/dist/exit-codes.js.map +1 -0
  90. package/dist/explore-adversarial.d.ts +144 -0
  91. package/dist/explore-adversarial.js +227 -0
  92. package/dist/explore-adversarial.js.map +1 -0
  93. package/dist/explore-api.d.ts +7 -187
  94. package/dist/explore-api.js +7 -301
  95. package/dist/explore-api.js.map +1 -1
  96. package/dist/explore-author.d.ts +79 -0
  97. package/dist/explore-author.js +86 -0
  98. package/dist/explore-author.js.map +1 -0
  99. package/dist/explore-cli.d.ts +7 -0
  100. package/dist/explore-cli.js +1199 -0
  101. package/dist/explore-cli.js.map +1 -0
  102. package/dist/explore-coverage.d.ts +173 -0
  103. package/dist/explore-coverage.js +246 -0
  104. package/dist/explore-coverage.js.map +1 -0
  105. package/dist/explore-feature.d.ts +125 -0
  106. package/dist/explore-feature.js +218 -0
  107. package/dist/explore-feature.js.map +1 -0
  108. package/dist/explore-goal.d.ts +271 -0
  109. package/dist/explore-goal.js +417 -0
  110. package/dist/explore-goal.js.map +1 -0
  111. package/dist/explore-shared.d.ts +177 -0
  112. package/dist/explore-shared.js +149 -0
  113. package/dist/explore-shared.js.map +1 -0
  114. package/dist/explore-specs.d.ts +53 -0
  115. package/dist/explore-specs.js +333 -0
  116. package/dist/explore-specs.js.map +1 -0
  117. package/dist/findings-filing.d.ts +64 -0
  118. package/dist/findings-filing.js +108 -0
  119. package/dist/findings-filing.js.map +1 -0
  120. package/dist/fixture-auth.d.ts +63 -0
  121. package/dist/fixture-auth.js +95 -0
  122. package/dist/fixture-auth.js.map +1 -0
  123. package/dist/fixture-cli.d.ts +99 -0
  124. package/dist/fixture-cli.js +292 -0
  125. package/dist/fixture-cli.js.map +1 -0
  126. package/dist/github-issue-filer.d.ts +62 -0
  127. package/dist/github-issue-filer.js +189 -0
  128. package/dist/github-issue-filer.js.map +1 -0
  129. package/dist/host-health-run.d.ts +25 -0
  130. package/dist/host-health-run.js +33 -0
  131. package/dist/host-health-run.js.map +1 -0
  132. package/dist/http-5xx-outcome.d.ts +6 -0
  133. package/dist/http-5xx-outcome.js +39 -0
  134. package/dist/http-5xx-outcome.js.map +1 -0
  135. package/dist/inbox-cli.d.ts +7 -0
  136. package/dist/inbox-cli.js +197 -0
  137. package/dist/inbox-cli.js.map +1 -0
  138. package/dist/index.d.ts +1 -0
  139. package/dist/index.js +1 -0
  140. package/dist/index.js.map +1 -1
  141. package/dist/init-cli.d.ts +4 -0
  142. package/dist/init-cli.js +156 -0
  143. package/dist/init-cli.js.map +1 -0
  144. package/dist/init-keys.d.ts +30 -2
  145. package/dist/init-keys.js +19 -5
  146. package/dist/init-keys.js.map +1 -1
  147. package/dist/init-next-steps.d.ts +35 -0
  148. package/dist/init-next-steps.js +79 -0
  149. package/dist/init-next-steps.js.map +1 -0
  150. package/dist/invariants-file.d.ts +34 -0
  151. package/dist/invariants-file.js +68 -0
  152. package/dist/invariants-file.js.map +1 -0
  153. package/dist/invariants-validate.d.ts +30 -0
  154. package/dist/invariants-validate.js +105 -0
  155. package/dist/invariants-validate.js.map +1 -0
  156. package/dist/journey-annotate-api.d.ts +76 -0
  157. package/dist/journey-annotate-api.js +269 -0
  158. package/dist/journey-annotate-api.js.map +1 -0
  159. package/dist/journey-annotate-cli.d.ts +9 -0
  160. package/dist/journey-annotate-cli.js +181 -0
  161. package/dist/journey-annotate-cli.js.map +1 -0
  162. package/dist/journey-api.d.ts +104 -2
  163. package/dist/journey-api.js +163 -20
  164. package/dist/journey-api.js.map +1 -1
  165. package/dist/journey-cli.d.ts +4 -0
  166. package/dist/journey-cli.js +411 -0
  167. package/dist/journey-cli.js.map +1 -0
  168. package/dist/journey-demo-api.d.ts +114 -0
  169. package/dist/journey-demo-api.js +405 -0
  170. package/dist/journey-demo-api.js.map +1 -0
  171. package/dist/journey-demo-cli.d.ts +10 -0
  172. package/dist/journey-demo-cli.js +158 -0
  173. package/dist/journey-demo-cli.js.map +1 -0
  174. package/dist/journey-prefix.d.ts +194 -0
  175. package/dist/journey-prefix.js +279 -0
  176. package/dist/journey-prefix.js.map +1 -0
  177. package/dist/key-report.d.ts +49 -0
  178. package/dist/key-report.js +101 -0
  179. package/dist/key-report.js.map +1 -0
  180. package/dist/kill-signal.d.ts +193 -0
  181. package/dist/kill-signal.js +283 -0
  182. package/dist/kill-signal.js.map +1 -0
  183. package/dist/launch-armed.d.ts +37 -0
  184. package/dist/launch-armed.js +31 -0
  185. package/dist/launch-armed.js.map +1 -0
  186. package/dist/ledger-api.d.ts +106 -0
  187. package/dist/ledger-api.js +239 -0
  188. package/dist/ledger-api.js.map +1 -0
  189. package/dist/ledger-cli.d.ts +18 -0
  190. package/dist/ledger-cli.js +107 -0
  191. package/dist/ledger-cli.js.map +1 -0
  192. package/dist/load-api.d.ts +29 -11
  193. package/dist/load-api.js +23 -15
  194. package/dist/load-api.js.map +1 -1
  195. package/dist/load-cli.d.ts +4 -0
  196. package/dist/load-cli.js +97 -0
  197. package/dist/load-cli.js.map +1 -0
  198. package/dist/log-correlation.d.ts +200 -0
  199. package/dist/log-correlation.js +394 -0
  200. package/dist/log-correlation.js.map +1 -0
  201. package/dist/log-lines.d.ts +131 -0
  202. package/dist/log-lines.js +389 -0
  203. package/dist/log-lines.js.map +1 -0
  204. package/dist/log-sources.d.ts +71 -0
  205. package/dist/log-sources.js +236 -0
  206. package/dist/log-sources.js.map +1 -0
  207. package/dist/log-trace.d.ts +80 -0
  208. package/dist/log-trace.js +210 -0
  209. package/dist/log-trace.js.map +1 -0
  210. package/dist/logs-cli.d.ts +3 -0
  211. package/dist/logs-cli.js +51 -0
  212. package/dist/logs-cli.js.map +1 -0
  213. package/dist/logs-retention.d.ts +28 -0
  214. package/dist/logs-retention.js +85 -0
  215. package/dist/logs-retention.js.map +1 -0
  216. package/dist/masked-input.d.ts +22 -0
  217. package/dist/masked-input.js +99 -0
  218. package/dist/masked-input.js.map +1 -0
  219. package/dist/mcp-api.d.ts +91 -1
  220. package/dist/mcp-api.js +514 -18
  221. package/dist/mcp-api.js.map +1 -1
  222. package/dist/mcp-args.d.ts +50 -0
  223. package/dist/mcp-args.js +164 -0
  224. package/dist/mcp-args.js.map +1 -0
  225. package/dist/mcp-cli-bridge.d.ts +34 -0
  226. package/dist/mcp-cli-bridge.js +62 -0
  227. package/dist/mcp-cli-bridge.js.map +1 -0
  228. package/dist/mcp-cli-runner.d.ts +29 -0
  229. package/dist/mcp-cli-runner.js +44 -0
  230. package/dist/mcp-cli-runner.js.map +1 -0
  231. package/dist/mcp-cli-tools.d.ts +129 -0
  232. package/dist/mcp-cli-tools.js +737 -0
  233. package/dist/mcp-cli-tools.js.map +1 -0
  234. package/dist/mcp-paths.d.ts +28 -0
  235. package/dist/mcp-paths.js +76 -0
  236. package/dist/mcp-paths.js.map +1 -0
  237. package/dist/mission-actors.d.ts +40 -0
  238. package/dist/mission-actors.js +72 -0
  239. package/dist/mission-actors.js.map +1 -0
  240. package/dist/mission-api.d.ts +35 -0
  241. package/dist/mission-api.js +60 -3
  242. package/dist/mission-api.js.map +1 -1
  243. package/dist/mission-cli.d.ts +4 -0
  244. package/dist/mission-cli.js +248 -0
  245. package/dist/mission-cli.js.map +1 -0
  246. package/dist/mission-exit.d.ts +22 -0
  247. package/dist/mission-exit.js +26 -0
  248. package/dist/mission-exit.js.map +1 -0
  249. package/dist/mission-fixtures.d.ts +234 -0
  250. package/dist/mission-fixtures.js +862 -0
  251. package/dist/mission-fixtures.js.map +1 -0
  252. package/dist/mission-journal.d.ts +60 -0
  253. package/dist/mission-journal.js +115 -0
  254. package/dist/mission-journal.js.map +1 -0
  255. package/dist/mission-queue-cli.d.ts +10 -0
  256. package/dist/mission-queue-cli.js +198 -0
  257. package/dist/mission-queue-cli.js.map +1 -0
  258. package/dist/mission-queue-runner.d.ts +126 -0
  259. package/dist/mission-queue-runner.js +406 -0
  260. package/dist/mission-queue-runner.js.map +1 -0
  261. package/dist/multi-run-cli.d.ts +37 -0
  262. package/dist/multi-run-cli.js +116 -0
  263. package/dist/multi-run-cli.js.map +1 -0
  264. package/dist/multi-run.d.ts +339 -0
  265. package/dist/multi-run.js +619 -0
  266. package/dist/multi-run.js.map +1 -0
  267. package/dist/openrouter-call.d.ts +22 -0
  268. package/dist/openrouter-call.js +64 -0
  269. package/dist/openrouter-call.js.map +1 -0
  270. package/dist/profile-cli.d.ts +4 -0
  271. package/dist/profile-cli.js +57 -0
  272. package/dist/profile-cli.js.map +1 -0
  273. package/dist/program.d.ts +3 -75
  274. package/dist/program.js +123 -1921
  275. package/dist/program.js.map +1 -1
  276. package/dist/project-dir.d.ts +96 -0
  277. package/dist/project-dir.js +221 -0
  278. package/dist/project-dir.js.map +1 -0
  279. package/dist/record-api.d.ts +13 -7
  280. package/dist/record-api.js +44 -30
  281. package/dist/record-api.js.map +1 -1
  282. package/dist/record-cli.d.ts +4 -0
  283. package/dist/record-cli.js +76 -0
  284. package/dist/record-cli.js.map +1 -0
  285. package/dist/recording-cli.d.ts +4 -0
  286. package/dist/recording-cli.js +248 -0
  287. package/dist/recording-cli.js.map +1 -0
  288. package/dist/regression-api.d.ts +107 -0
  289. package/dist/regression-api.js +387 -6
  290. package/dist/regression-api.js.map +1 -1
  291. package/dist/regression-cli.d.ts +4 -0
  292. package/dist/regression-cli.js +284 -0
  293. package/dist/regression-cli.js.map +1 -0
  294. package/dist/report-api.d.ts +146 -0
  295. package/dist/report-api.js +431 -0
  296. package/dist/report-api.js.map +1 -0
  297. package/dist/report-cli.d.ts +12 -0
  298. package/dist/report-cli.js +147 -0
  299. package/dist/report-cli.js.map +1 -0
  300. package/dist/resource-preflight.d.ts +87 -0
  301. package/dist/resource-preflight.js +160 -0
  302. package/dist/resource-preflight.js.map +1 -0
  303. package/dist/result-schema.d.ts +22 -0
  304. package/dist/result-schema.js +28 -0
  305. package/dist/result-schema.js.map +1 -0
  306. package/dist/run-index.d.ts +29 -0
  307. package/dist/run-index.js +70 -0
  308. package/dist/run-index.js.map +1 -0
  309. package/dist/run-key-preflight.d.ts +42 -0
  310. package/dist/run-key-preflight.js +82 -0
  311. package/dist/run-key-preflight.js.map +1 -0
  312. package/dist/run-screenshots.d.ts +123 -0
  313. package/dist/run-screenshots.js +235 -0
  314. package/dist/run-screenshots.js.map +1 -0
  315. package/dist/runtime-env.d.ts +8 -0
  316. package/dist/runtime-env.js +23 -0
  317. package/dist/runtime-env.js.map +1 -0
  318. package/dist/secret-args.d.ts +23 -0
  319. package/dist/secret-args.js +45 -0
  320. package/dist/secret-args.js.map +1 -0
  321. package/dist/serve-cli.d.ts +4 -0
  322. package/dist/serve-cli.js +95 -0
  323. package/dist/serve-cli.js.map +1 -0
  324. package/dist/server-log-verify.d.ts +36 -0
  325. package/dist/server-log-verify.js +120 -0
  326. package/dist/server-log-verify.js.map +1 -0
  327. package/dist/session-check.d.ts +14 -0
  328. package/dist/session-check.js +44 -0
  329. package/dist/session-check.js.map +1 -0
  330. package/dist/site-cli.d.ts +4 -0
  331. package/dist/site-cli.js +127 -0
  332. package/dist/site-cli.js.map +1 -0
  333. package/dist/site-gate-cli.d.ts +28 -0
  334. package/dist/site-gate-cli.js +59 -0
  335. package/dist/site-gate-cli.js.map +1 -0
  336. package/dist/source-api.js +20 -4
  337. package/dist/source-api.js.map +1 -1
  338. package/dist/source-cli.d.ts +4 -0
  339. package/dist/source-cli.js +284 -0
  340. package/dist/source-cli.js.map +1 -0
  341. package/dist/source-run-api.d.ts +27 -1
  342. package/dist/source-run-api.js +22 -11
  343. package/dist/source-run-api.js.map +1 -1
  344. package/dist/storage-state-snapshot.d.ts +50 -0
  345. package/dist/storage-state-snapshot.js +87 -0
  346. package/dist/storage-state-snapshot.js.map +1 -0
  347. package/dist/suite-explore-options.d.ts +321 -0
  348. package/dist/suite-explore-options.js +162 -0
  349. package/dist/suite-explore-options.js.map +1 -0
  350. package/dist/target-config.d.ts +115 -0
  351. package/dist/target-config.js +225 -0
  352. package/dist/target-config.js.map +1 -0
  353. package/dist/transcript-file.d.ts +12 -0
  354. package/dist/transcript-file.js +23 -0
  355. package/dist/transcript-file.js.map +1 -0
  356. package/dist/type-fixture-file.d.ts +9 -0
  357. package/dist/type-fixture-file.js +48 -0
  358. package/dist/type-fixture-file.js.map +1 -0
  359. package/dist/ui-api.d.ts +3 -0
  360. package/dist/ui-api.js +11 -4
  361. package/dist/ui-api.js.map +1 -1
  362. package/dist/usability-capture.d.ts +43 -0
  363. package/dist/usability-capture.js +327 -0
  364. package/dist/usability-capture.js.map +1 -0
  365. package/dist/usage-config.d.ts +36 -0
  366. package/dist/usage-config.js +114 -0
  367. package/dist/usage-config.js.map +1 -0
  368. package/dist/ux-api.d.ts +3 -75
  369. package/dist/ux-api.js +3 -220
  370. package/dist/ux-api.js.map +1 -1
  371. package/dist/ux-claim-probe.d.ts +45 -0
  372. package/dist/ux-claim-probe.js +386 -0
  373. package/dist/ux-claim-probe.js.map +1 -0
  374. package/dist/ux-cli.d.ts +4 -0
  375. package/dist/ux-cli.js +109 -0
  376. package/dist/ux-cli.js.map +1 -0
  377. package/dist/ux-config.d.ts +29 -0
  378. package/dist/ux-config.js +103 -0
  379. package/dist/ux-config.js.map +1 -0
  380. package/dist/ux-evidence.d.ts +54 -0
  381. package/dist/ux-evidence.js +197 -0
  382. package/dist/ux-evidence.js.map +1 -0
  383. package/dist/ux-product.d.ts +14 -0
  384. package/dist/ux-product.js +39 -0
  385. package/dist/ux-product.js.map +1 -0
  386. package/dist/ux-review.d.ts +116 -0
  387. package/dist/ux-review.js +171 -0
  388. package/dist/ux-review.js.map +1 -0
  389. package/dist/ux-usability.d.ts +263 -0
  390. package/dist/ux-usability.js +580 -0
  391. package/dist/ux-usability.js.map +1 -0
  392. package/dist/verify-fix-api.d.ts +194 -0
  393. package/dist/verify-fix-api.js +506 -0
  394. package/dist/verify-fix-api.js.map +1 -0
  395. package/dist/verify-fix-cli.d.ts +4 -0
  396. package/dist/verify-fix-cli.js +115 -0
  397. package/dist/verify-fix-cli.js.map +1 -0
  398. package/package.json +23 -18
  399. package/skills/jevitate-ci-check/SKILL.md +77 -0
  400. package/skills/jevitate-demo/SKILL.md +61 -0
  401. package/skills/jevitate-explore/SKILL.md +96 -87
  402. package/skills/jevitate-getting-started/SKILL.md +89 -0
  403. package/skills/jevitate-load-test/SKILL.md +11 -2
  404. package/skills/jevitate-mission-scope/SKILL.md +19 -11
  405. package/skills/jevitate-record/SKILL.md +23 -5
  406. package/skills/jevitate-run-journey/SKILL.md +61 -17
  407. package/skills/jevitate-sources/SKILL.md +57 -14
  408. package/skills/jevitate-test-campaign/SKILL.md +203 -0
  409. package/skills/jevitate-ux-review/SKILL.md +106 -16
  410. package/skills/jevitate-verify-fix/SKILL.md +76 -0
@@ -0,0 +1,194 @@
1
+ import { type JourneyBranchPoint } from "@jevitate/journey";
2
+ import { type Actor } from "@jevitate/screenplay";
3
+ import type { Recording } from "@jevitate/recording";
4
+ import type { BrowserSession } from "@jevitate/playwright";
5
+ import { type ResolvedJourneyEnvironment } from "./environments.js";
6
+ import type { BrowserRunOptions } from "./browser-run-options.js";
7
+ /**
8
+ * #293 — journey-anchored exploration: `jevitate explore --from-journey <id> --at-step <n|name>`.
9
+ *
10
+ * The mission's browser session opens as usual (its storage state, emulation, demo mode); then the
11
+ * promoted Journey's PREFIX — its first `step` top-level steps — is replayed INTO that session by the
12
+ * one Journey replay there is (`runJourneyProgrammatically`: fail-closed, never self-healing, the
13
+ * site policy and `--env` environment applied), and the mission starts on the live page it left:
14
+ * same page, form contents and session, no fresh navigation. A prefix that no longer replays ends
15
+ * the run with a typed `journey-stale` outcome (exit 2) — never a silent restart from a URL.
16
+ *
17
+ * Everything that can be refused is refused before any browser opens (`resolveJourneyPrefix`): an
18
+ * unknown or unpromoted Journey, a step or anchor it does not have, params that do not fit, a
19
+ * Journey that needs a session the run was not given.
20
+ */
21
+ /** The strategies a mission can branch off a Journey with (`--feature` and multi-runs are refused). */
22
+ export { ANCHORED_STRATEGIES, type AnchoredStrategy } from "@jevitate/journey";
23
+ /** `--from-journey`/`--at-step` cannot be used as given (exit 64, nothing ran). */
24
+ export declare class JourneyPrefixArgsError extends Error {
25
+ readonly code: "E_EXPLORE_ARGS";
26
+ constructor(message: string);
27
+ }
28
+ /**
29
+ * The Journey prefix did not replay up to the anchor: the Journey is stale (a step's target is gone,
30
+ * the app changed). The run ends `inconclusive` with `failure.kind: "journey-stale"` (exit 2).
31
+ */
32
+ export declare class JourneyPrefixStaleError extends Error {
33
+ readonly branch: JourneyBranchPoint;
34
+ /** The 1-based Journey step that failed, when the replay names it. */
35
+ readonly failedStep?: number | undefined;
36
+ readonly code: "E_JOURNEY_STALE";
37
+ constructor(message: string, branch: JourneyBranchPoint,
38
+ /** The 1-based Journey step that failed, when the replay names it. */
39
+ failedStep?: number | undefined);
40
+ }
41
+ export interface JourneyPrefix {
42
+ readonly branch: JourneyBranchPoint;
43
+ /**
44
+ * Where the prefix is expected to land, from the Recording alone (on the environment's origin) —
45
+ * the run's origin, allowlist and per-target settings are decided from it before any browser
46
+ * opens. The mission itself starts from the LIVE page URL the replay leaves.
47
+ */
48
+ readonly startUrl: string;
49
+ /** The origins the Journey's steps may be on: the environment's, else the Journey's own site. */
50
+ readonly allowedOrigins: readonly string[];
51
+ /**
52
+ * The values of the prefix's SECRET params (declared `secret: true`, or credential-like names): the
53
+ * replay types them into the page the mission then perceives, so the mission must redact them.
54
+ */
55
+ readonly secrets: readonly string[];
56
+ /** Top-level steps the prefix replays: what one re-replay on a reset costs against `maxActions`. */
57
+ readonly steps: number;
58
+ /**
59
+ * What a later replay of a finding needs to go through the same prefix (persisted on the result
60
+ * as `branch.replay`): never a secret param's value — only its name, re-supplied as `--param`.
61
+ */
62
+ readonly replayInfo: BranchReplayInfo;
63
+ /**
64
+ * Replays the prefix into `session` (left open) and returns the live URL the mission starts on.
65
+ * `browser` is how the run launched (a Journey recorded with extensions needs the same build).
66
+ * Throws `JourneyPrefixStaleError` when the replay stops before the anchor.
67
+ */
68
+ replay(session: BrowserSession, browser?: BrowserRunOptions): Promise<string>;
69
+ }
70
+ export interface ResolveJourneyPrefixOptions {
71
+ /** The Journey store directory. */
72
+ readonly dir: string;
73
+ readonly id: string;
74
+ /** `--at-step`: a 1-based step number or an anchor name. */
75
+ readonly atStep: string;
76
+ readonly params: Record<string, string>;
77
+ /** `--env`/`--base-url` (#247): the Journey's recorded URLs move onto this environment. */
78
+ readonly environment?: ResolvedJourneyEnvironment;
79
+ /** The mission's session file (also checked against the Journey's `requiresAuth`). */
80
+ readonly storageState?: string;
81
+ /** The site-policy database (`jevitate site policy`): pacing and budgets apply to the replay. */
82
+ readonly dbPath?: string;
83
+ /** The `--env`/`--base-url` names `environment` came from (persisted for later replays). */
84
+ readonly environmentFlags?: {
85
+ readonly env?: string;
86
+ readonly baseUrl?: string;
87
+ };
88
+ }
89
+ /** #293: how a finding's replay goes back through its run's Journey prefix (`result.branch.replay`). */
90
+ export interface BranchReplayInfo {
91
+ /** The Journey store the prefix was read from (absolute). */
92
+ readonly journeysDir: string;
93
+ /** The prefix's NON-secret params, by value. */
94
+ readonly params: Readonly<Record<string, string>>;
95
+ /** The prefix's secret params, by NAME only: a replay is given them again (`--param`). */
96
+ readonly secretParams: readonly string[];
97
+ readonly env?: string;
98
+ readonly baseUrl?: string;
99
+ }
100
+ /** A result's `branch`, as an anchored run persists it (#293): the branch point plus how to replay it. */
101
+ export type RecordedBranch = JourneyBranchPoint & {
102
+ readonly replay?: BranchReplayInfo;
103
+ };
104
+ /**
105
+ * Resolves `--from-journey <id> --at-step <n|name>` into a replayable prefix — refusing, before any
106
+ * browser opens, an unknown Journey (`UnknownJourneyError`), an unpromoted one or a step it lacks
107
+ * (`JourneyPrefixArgsError`), params that do not fit (`ParamValidationError`), and a Journey that
108
+ * declares `requiresAuth` with no session (`JourneyRequiresAuthError`).
109
+ */
110
+ export declare function resolveJourneyPrefix(opts: ResolveJourneyPrefixOptions): Promise<JourneyPrefix>;
111
+ /** What an anchored run starts from: the live URL after the prefix, its branch point, and how it resets. */
112
+ export interface AnchoredStart {
113
+ readonly url: string;
114
+ readonly branch?: RecordedBranch;
115
+ /**
116
+ * #293: what a reset inside the mission uses instead of re-navigating to the anchor URL — the
117
+ * prefix replayed again into the mission's (current) session, costing `restartCost` actions.
118
+ */
119
+ readonly restart?: {
120
+ readonly restartAtStart: (actor: Actor) => Promise<boolean>;
121
+ readonly restartCost: number;
122
+ };
123
+ }
124
+ /**
125
+ * #293: a reset's prefix re-replay — into the actor's current session; `false` (never a throw) when
126
+ * the prefix no longer replays or lands off the allowlist, so the mission stops there honestly.
127
+ */
128
+ export declare function prefixRestart(prefix: JourneyPrefix, allowlist: readonly string[], browser?: BrowserRunOptions): (actor: Actor) => Promise<boolean>;
129
+ /**
130
+ * The runners' one call (#293): with no prefix, the mission starts at `url` as always; with one, the
131
+ * prefix is replayed into `session` and the mission starts on the live page it left — which must
132
+ * still be an authorized origin (`UnauthorizedExploreTargetError` otherwise).
133
+ */
134
+ export declare function startFromJourney(prefix: JourneyPrefix | undefined, session: BrowserSession, url: string, allowlist: readonly string[], browser?: BrowserRunOptions): Promise<AnchoredStart>;
135
+ /** The result fields an anchored run adds (#293, additive): its branch point (and how to replay it). */
136
+ export declare function branchFields(start: AnchoredStart): {
137
+ branch?: RecordedBranch;
138
+ };
139
+ /** The typed result of a run whose prefix did not replay (exit 2): `inconclusive`, `failure.kind: "journey-stale"`. */
140
+ export interface JourneyStaleResult {
141
+ readonly strategy: string;
142
+ readonly outcome: "inconclusive";
143
+ readonly missionOutcome: "inconclusive";
144
+ readonly reason: string;
145
+ readonly failure: {
146
+ readonly kind: "journey-stale";
147
+ readonly message: string;
148
+ };
149
+ readonly branch: JourneyBranchPoint;
150
+ /** The 1-based Journey step whose replay failed, when known. */
151
+ readonly failedStep?: number;
152
+ readonly exitCode: 2;
153
+ }
154
+ export declare function journeyStaleResult(err: JourneyPrefixStaleError, strategy: string): JourneyStaleResult;
155
+ /** A finding's result names a branch point it was found from (with how to replay through it). */
156
+ export declare function recordedBranchOf(result: unknown): RecordedBranch | undefined;
157
+ /** `verify-fix`/`regression` of a branch-point finding cannot replay through its prefix (exit 64). */
158
+ export declare class BranchReplayInputError extends Error {
159
+ readonly code: "E_VERIFY_FIX_INPUT";
160
+ constructor(message: string);
161
+ }
162
+ export interface PrefixFromBranchOptions {
163
+ /** `--param` values: the branch's secret params (by name), or overrides of its recorded ones. */
164
+ readonly params?: Readonly<Record<string, string>>;
165
+ readonly storageState?: string;
166
+ readonly dbPath?: string;
167
+ readonly environmentSeams?: {
168
+ readonly environmentsFile?: string;
169
+ readonly targetsFile?: string;
170
+ };
171
+ }
172
+ /**
173
+ * The Journey prefix a finding's run branched from, resolved again from `branch.replay` (the
174
+ * Journey store, its non-secret params, the environment) — a secret param must be given again.
175
+ * Refused (`BranchReplayInputError`) when the result predates replay info or a secret is missing.
176
+ */
177
+ export declare function prefixFromBranch(branch: RecordedBranch, opts?: PrefixFromBranchOptions): Promise<JourneyPrefix>;
178
+ /**
179
+ * A branch-point finding's Recording, for a replay that starts on the prefix's live page: its
180
+ * leading navigate to the anchor URL (which would reload the page and lose in-page state) becomes
181
+ * an `assert urlIncludes <path>` — the same flat step indices, so `recordingStepIndex` still holds.
182
+ */
183
+ export declare function anchoredRecording(rec: Recording): Recording;
184
+ /**
185
+ * Wraps a fresh-session opener so every replay session first goes through the Journey prefix.
186
+ * A stale prefix is remembered (`stale()`), and the opener throws — the replay then has no evidence,
187
+ * and the caller reports a typed `journey-stale` inconclusive.
188
+ */
189
+ export declare function prefixedOpener<S extends {
190
+ readonly actor: Actor;
191
+ }>(open: () => Promise<S>, prefix: JourneyPrefix, allowlist: readonly string[], browser?: BrowserRunOptions): {
192
+ open: () => Promise<S>;
193
+ stale: () => JourneyPrefixStaleError | undefined;
194
+ };
@@ -0,0 +1,279 @@
1
+ import { FsJourneyStore, JourneyRegistry, JourneyStepError, deriveParamSchema, journeyBranchPoint, journeyPrefix, prefixLandingPath, resolveJourneyStep, secretParamNames, secretParamValues, validateParams, } from "@jevitate/journey";
2
+ import { resolve as resolvePath } from "node:path";
3
+ import { UnauthorizedExploreTargetError, assertAuthorizedExploreTarget } from "@jevitate/explore";
4
+ import { BrowseTheWebToken } from "@jevitate/screenplay";
5
+ import { SiteGateRefusedError } from "@jevitate/runtime";
6
+ import { applyJourneyEnvironment, environmentFromFlags } from "./environments.js";
7
+ import { JourneyRequiresAuthError, UnknownJourneyError, prefixParams, runJourneyProgrammatically } from "./journey-api.js";
8
+ import { withSiteGate } from "./site-gate-cli.js";
9
+ /**
10
+ * #293 — journey-anchored exploration: `jevitate explore --from-journey <id> --at-step <n|name>`.
11
+ *
12
+ * The mission's browser session opens as usual (its storage state, emulation, demo mode); then the
13
+ * promoted Journey's PREFIX — its first `step` top-level steps — is replayed INTO that session by the
14
+ * one Journey replay there is (`runJourneyProgrammatically`: fail-closed, never self-healing, the
15
+ * site policy and `--env` environment applied), and the mission starts on the live page it left:
16
+ * same page, form contents and session, no fresh navigation. A prefix that no longer replays ends
17
+ * the run with a typed `journey-stale` outcome (exit 2) — never a silent restart from a URL.
18
+ *
19
+ * Everything that can be refused is refused before any browser opens (`resolveJourneyPrefix`): an
20
+ * unknown or unpromoted Journey, a step or anchor it does not have, params that do not fit, a
21
+ * Journey that needs a session the run was not given.
22
+ */
23
+ /** The strategies a mission can branch off a Journey with (`--feature` and multi-runs are refused). */
24
+ export { ANCHORED_STRATEGIES } from "@jevitate/journey";
25
+ /** `--from-journey`/`--at-step` cannot be used as given (exit 64, nothing ran). */
26
+ export class JourneyPrefixArgsError extends Error {
27
+ code = "E_EXPLORE_ARGS";
28
+ constructor(message) {
29
+ super(message);
30
+ this.name = "JourneyPrefixArgsError";
31
+ }
32
+ }
33
+ /**
34
+ * The Journey prefix did not replay up to the anchor: the Journey is stale (a step's target is gone,
35
+ * the app changed). The run ends `inconclusive` with `failure.kind: "journey-stale"` (exit 2).
36
+ */
37
+ export class JourneyPrefixStaleError extends Error {
38
+ branch;
39
+ failedStep;
40
+ code = "E_JOURNEY_STALE";
41
+ constructor(message, branch,
42
+ /** The 1-based Journey step that failed, when the replay names it. */
43
+ failedStep) {
44
+ super(message);
45
+ this.branch = branch;
46
+ this.failedStep = failedStep;
47
+ this.name = "JourneyPrefixStaleError";
48
+ }
49
+ }
50
+ /**
51
+ * Resolves `--from-journey <id> --at-step <n|name>` into a replayable prefix — refusing, before any
52
+ * browser opens, an unknown Journey (`UnknownJourneyError`), an unpromoted one or a step it lacks
53
+ * (`JourneyPrefixArgsError`), params that do not fit (`ParamValidationError`), and a Journey that
54
+ * declares `requiresAuth` with no session (`JourneyRequiresAuthError`).
55
+ */
56
+ export async function resolveJourneyPrefix(opts) {
57
+ const stored = await new JourneyRegistry(new FsJourneyStore(opts.dir)).get(opts.id);
58
+ if (stored === null)
59
+ throw new UnknownJourneyError(`unknown journey '${opts.id}'`);
60
+ if (!stored.metadata.promoted) {
61
+ throw new JourneyPrefixArgsError(`journey '${opts.id}' is not promoted — missions branch only off promoted Journeys (a person promotes it: jevitate journey promote ${opts.id})`);
62
+ }
63
+ const full = applyJourneyEnvironment(stored, opts.environment);
64
+ let resolved;
65
+ try {
66
+ resolved = resolveJourneyStep(full, opts.atStep);
67
+ }
68
+ catch (err) {
69
+ if (err instanceof JourneyStepError)
70
+ throw new JourneyPrefixArgsError(err.message);
71
+ throw err;
72
+ }
73
+ if (full.metadata.requiresAuth === true && opts.storageState === undefined) {
74
+ throw new JourneyRequiresAuthError(`journey '${opts.id}' requires auth (metadata.requiresAuth) — run with --storage-state <file>`);
75
+ }
76
+ const prefix = journeyPrefix(full, resolved.step);
77
+ const used = prefixParams(full, prefix, opts.params);
78
+ validateParams(deriveParamSchema(prefix.recording), used);
79
+ const branch = journeyBranchPoint(full, resolved);
80
+ const site = full.recording.site;
81
+ let startUrl;
82
+ try {
83
+ startUrl = new URL(prefixLandingPath(full, resolved.step), site).href;
84
+ }
85
+ catch {
86
+ throw new JourneyPrefixArgsError(`journey '${opts.id}' has no usable site URL (${JSON.stringify(site)})`);
87
+ }
88
+ const allowedOrigins = opts.environment === undefined ? [new URL(site).origin] : [...opts.environment.allowedOrigins];
89
+ const where = `step ${branch.step}${branch.anchor === undefined ? "" : ` (anchor ${branch.anchor})`}`;
90
+ const secretNames = secretParamNames(full, used).filter((n) => n in used);
91
+ return {
92
+ branch,
93
+ startUrl,
94
+ allowedOrigins,
95
+ secrets: secretParamValues(full, used),
96
+ steps: resolved.step,
97
+ replayInfo: {
98
+ journeysDir: resolvePath(opts.dir),
99
+ params: Object.fromEntries(Object.entries(used).filter(([k]) => !secretNames.includes(k))),
100
+ secretParams: secretNames,
101
+ ...(opts.environmentFlags?.env === undefined ? {} : { env: opts.environmentFlags.env }),
102
+ ...(opts.environmentFlags?.baseUrl === undefined ? {} : { baseUrl: opts.environmentFlags.baseUrl }),
103
+ },
104
+ replay: async (session, browser) => {
105
+ let run;
106
+ try {
107
+ run = await withSiteGate(opts.dbPath, (siteGate) => runJourneyProgrammatically({
108
+ dir: opts.dir,
109
+ id: opts.id,
110
+ params: opts.params,
111
+ session,
112
+ stopAfterStep: resolved.step,
113
+ ...(siteGate === undefined ? {} : { siteGate }),
114
+ ...(opts.environment === undefined ? {} : { environment: opts.environment }),
115
+ ...(opts.storageState === undefined ? {} : { storageState: opts.storageState }),
116
+ ...(browser === undefined ? {} : { browser }),
117
+ }));
118
+ }
119
+ catch (err) {
120
+ // The site policy's own refusal keeps its code; anything else that stopped the replay means
121
+ // the Journey did not reach its anchor — typed, never a restart from a URL.
122
+ if (err instanceof SiteGateRefusedError)
123
+ throw err;
124
+ const message = err instanceof Error ? (err.message.split("\n")[0] ?? err.message) : String(err);
125
+ throw new JourneyPrefixStaleError(`journey '${opts.id}' did not replay to ${where}: ${message}`, branch);
126
+ }
127
+ if (run.outcome !== "ok") {
128
+ const failed = run.outcome === "quarantined" && run.at !== undefined ? run.at + 1 : undefined;
129
+ const reason = run.outcome === "quarantined" ? run.reason : "the replay healed a step (a self-healed prefix is never a branch point)";
130
+ throw new JourneyPrefixStaleError(`journey '${opts.id}' is stale: it no longer reaches ${where} — ${reason}`, branch, failed);
131
+ }
132
+ return session.page.url();
133
+ },
134
+ };
135
+ }
136
+ /**
137
+ * #293: a reset's prefix re-replay — into the actor's current session; `false` (never a throw) when
138
+ * the prefix no longer replays or lands off the allowlist, so the mission stops there honestly.
139
+ */
140
+ export function prefixRestart(prefix, allowlist, browser) {
141
+ return async (actor) => {
142
+ try {
143
+ const live = await prefix.replay(actor.ability(BrowseTheWebToken).session, browser);
144
+ assertAuthorizedExploreTarget(live, allowlist);
145
+ return true;
146
+ }
147
+ catch (err) {
148
+ if (err instanceof JourneyPrefixStaleError || err instanceof UnauthorizedExploreTargetError)
149
+ return false;
150
+ throw err;
151
+ }
152
+ };
153
+ }
154
+ /**
155
+ * The runners' one call (#293): with no prefix, the mission starts at `url` as always; with one, the
156
+ * prefix is replayed into `session` and the mission starts on the live page it left — which must
157
+ * still be an authorized origin (`UnauthorizedExploreTargetError` otherwise).
158
+ */
159
+ export async function startFromJourney(prefix, session, url, allowlist, browser) {
160
+ if (prefix === undefined)
161
+ return { url };
162
+ const live = await prefix.replay(session, browser);
163
+ assertAuthorizedExploreTarget(live, allowlist);
164
+ const restart = { restartAtStart: prefixRestart(prefix, allowlist, browser), restartCost: prefix.steps };
165
+ return { url: live, branch: { ...prefix.branch, replay: prefix.replayInfo }, restart };
166
+ }
167
+ /** The result fields an anchored run adds (#293, additive): its branch point (and how to replay it). */
168
+ export function branchFields(start) {
169
+ return start.branch === undefined ? {} : { branch: start.branch };
170
+ }
171
+ export function journeyStaleResult(err, strategy) {
172
+ return {
173
+ strategy,
174
+ outcome: "inconclusive",
175
+ missionOutcome: "inconclusive",
176
+ reason: err.message,
177
+ failure: { kind: "journey-stale", message: err.message },
178
+ branch: err.branch,
179
+ ...(err.failedStep === undefined ? {} : { failedStep: err.failedStep }),
180
+ exitCode: 2,
181
+ };
182
+ }
183
+ // ── Replaying a finding through its branch point (#293) ─────────────────────────────────────────
184
+ /** A finding's result names a branch point it was found from (with how to replay through it). */
185
+ export function recordedBranchOf(result) {
186
+ const b = result?.branch;
187
+ if (b === null || typeof b !== "object")
188
+ return undefined;
189
+ const r = b;
190
+ if (typeof r.journeyId !== "string" || typeof r.step !== "number")
191
+ return undefined;
192
+ return r;
193
+ }
194
+ /** `verify-fix`/`regression` of a branch-point finding cannot replay through its prefix (exit 64). */
195
+ export class BranchReplayInputError extends Error {
196
+ code = "E_VERIFY_FIX_INPUT";
197
+ constructor(message) {
198
+ super(message);
199
+ this.name = "BranchReplayInputError";
200
+ }
201
+ }
202
+ /**
203
+ * The Journey prefix a finding's run branched from, resolved again from `branch.replay` (the
204
+ * Journey store, its non-secret params, the environment) — a secret param must be given again.
205
+ * Refused (`BranchReplayInputError`) when the result predates replay info or a secret is missing.
206
+ */
207
+ export async function prefixFromBranch(branch, opts = {}) {
208
+ const info = branch.replay;
209
+ if (info === undefined)
210
+ throw new BranchReplayInputError(`the finding branched from journey '${branch.journeyId}' step ${branch.step}, but its result records no replay info — re-run the anchored mission`);
211
+ const params = { ...info.params, ...(opts.params ?? {}) };
212
+ const missing = info.secretParams.filter((n) => !(n in params));
213
+ if (missing.length > 0) {
214
+ throw new BranchReplayInputError(`the finding's Journey prefix types secret param(s) ${missing.join(", ")}: give them again with --param <name>=<value>`);
215
+ }
216
+ try {
217
+ const environment = environmentFromFlags({ ...(info.env === undefined ? {} : { env: info.env }), ...(info.baseUrl === undefined ? {} : { baseUrl: info.baseUrl }) }, opts.environmentSeams ?? {});
218
+ return await resolveJourneyPrefix({
219
+ dir: info.journeysDir,
220
+ id: branch.journeyId,
221
+ atStep: String(branch.step),
222
+ params,
223
+ ...(environment === undefined ? {} : { environment }),
224
+ ...(opts.storageState === undefined ? {} : { storageState: opts.storageState }),
225
+ ...(opts.dbPath === undefined ? {} : { dbPath: opts.dbPath }),
226
+ });
227
+ }
228
+ catch (err) {
229
+ if (err instanceof Error && !(err instanceof JourneyPrefixStaleError))
230
+ throw new BranchReplayInputError(`cannot replay through journey '${branch.journeyId}' step ${branch.step}: ${err.message}`);
231
+ throw err;
232
+ }
233
+ }
234
+ /**
235
+ * A branch-point finding's Recording, for a replay that starts on the prefix's live page: its
236
+ * leading navigate to the anchor URL (which would reload the page and lose in-page state) becomes
237
+ * an `assert urlIncludes <path>` — the same flat step indices, so `recordingStepIndex` still holds.
238
+ */
239
+ export function anchoredRecording(rec) {
240
+ const first = rec.pages[0]?.steps[0];
241
+ if (first === undefined || first.step.kind !== "navigate")
242
+ return rec;
243
+ let path;
244
+ try {
245
+ path = new URL(first.step.url, rec.site).pathname;
246
+ }
247
+ catch {
248
+ path = first.step.url;
249
+ }
250
+ const replaced = { step: { kind: "assert", label: "the Journey prefix reached the anchor", check: { kind: "urlIncludes", text: path } } };
251
+ const [page0, ...rest] = rec.pages;
252
+ return { ...rec, pages: [{ ...page0, steps: [replaced, ...page0.steps.slice(1)] }, ...rest] };
253
+ }
254
+ /**
255
+ * Wraps a fresh-session opener so every replay session first goes through the Journey prefix.
256
+ * A stale prefix is remembered (`stale()`), and the opener throws — the replay then has no evidence,
257
+ * and the caller reports a typed `journey-stale` inconclusive.
258
+ */
259
+ export function prefixedOpener(open, prefix, allowlist, browser) {
260
+ let stale;
261
+ return {
262
+ stale: () => stale,
263
+ open: async () => {
264
+ const s = await open();
265
+ try {
266
+ const live = await prefix.replay(s.actor.ability(BrowseTheWebToken).session, browser);
267
+ assertAuthorizedExploreTarget(live, allowlist);
268
+ }
269
+ catch (err) {
270
+ if (err instanceof JourneyPrefixStaleError)
271
+ stale ??= err;
272
+ await s.close?.();
273
+ throw err;
274
+ }
275
+ return s;
276
+ },
277
+ };
278
+ }
279
+ //# sourceMappingURL=journey-prefix.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journey-prefix.js","sourceRoot":"","sources":["../src/journey-prefix.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,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E,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IACxJ,MAAM,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC;IACnC,OAAO,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,KAAM,EAAE,KAAK,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;AAClG,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAsB,EACtB,MAAqB,EACrB,SAA4B,EAC5B,OAA2B;IAE3B,IAAI,KAA0C,CAAC;IAC/C,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,KAAK;QAClB,IAAI,EAAE,KAAK,IAAI,EAAE;YACf,MAAM,CAAC,GAAG,MAAM,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC;gBACH,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;gBACtF,6BAA6B,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACjD,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,uBAAuB;oBAAE,KAAK,KAAK,GAAG,CAAC;gBAC1D,MAAO,CAAgD,CAAC,KAAK,EAAE,EAAE,CAAC;gBAClE,MAAM,GAAG,CAAC;YACZ,CAAC;YACD,OAAO,CAAC,CAAC;QACX,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { type CredentialKey, type CredentialStore, type Feature, type KeyVerdict, type VerifyFetch } from "@jevitate/ai-core";
2
+ /**
3
+ * Key provenance + live verification for `init`, `ai status` and `ai setup` (#268, #291). Names,
4
+ * providers, sources and verdicts only — no function here returns, prints or logs a key value.
5
+ */
6
+ /** Where one required key comes from (`--json`: `keys[feature].sources`, additive). */
7
+ export interface KeySourceReport {
8
+ readonly key: CredentialKey;
9
+ readonly provider: string;
10
+ readonly source: "env" | "file" | "missing";
11
+ /** The env var the value is read from (the key's own name, or an accepted alias). */
12
+ readonly envVar?: string;
13
+ /** The credentials file (`~/.jevitate/credentials.json`). */
14
+ readonly path?: string;
15
+ /** An env var is set AND the file holds the key: the env value wins (the stored one is unused). */
16
+ readonly shadowsStored?: true;
17
+ }
18
+ /** One key's live check (`--json`: `verification`, additive). */
19
+ export interface KeyVerificationReport {
20
+ readonly key: CredentialKey;
21
+ readonly provider: string;
22
+ readonly status: KeyVerdict["status"];
23
+ readonly httpStatus?: number;
24
+ readonly reason?: string;
25
+ /** The value looks like another provider's key (a key stored in the wrong slot). */
26
+ readonly looksLike?: CredentialKey;
27
+ }
28
+ /** `~/.jevitate/credentials.json` — the file path with the home directory abbreviated. */
29
+ export declare function displayCredentialsPath(): string;
30
+ export declare function keySources(feature: Feature, env: Record<string, string | undefined>, localConfig: Partial<Record<CredentialKey, string>>): KeySourceReport[];
31
+ /** The default verifier: one HTTPS GET with the key in the Authorization header. */
32
+ export declare const realVerifyFetch: VerifyFetch;
33
+ /** Verifies every required key of `feature` (the effective value: env wins). `known` skips a re-check. */
34
+ export declare function verifyFeatureKeys(feature: Feature, store: CredentialStore, fetchFn: VerifyFetch, known?: ReadonlyMap<CredentialKey, KeyVerdict>): Promise<KeyVerificationReport[]>;
35
+ /** `OPENROUTER_API_KEY (OpenRouter), from env OPENROUTER_API_KEY` / `…, from ~/.jevitate/credentials.json`. */
36
+ export declare function describeSource(s: KeySourceReport): string;
37
+ /** One verification as a human phrase (never a value). */
38
+ export declare function describeVerification(v: KeyVerificationReport): string;
39
+ /** A feature's key state without its name: `ready — <sources>: <verdicts>` or `missing <names> — …`. */
40
+ export declare function featureKeysBody(feature: Feature, sources: readonly KeySourceReport[], verification: readonly KeyVerificationReport[] | undefined): string;
41
+ /** A feature's whole key line (`ai status`): `generation: ready — OPENROUTER_API_KEY (OpenRouter), from env …: valid`. */
42
+ export declare function describeFeatureKeys(feature: Feature, sources: readonly KeySourceReport[], verification: readonly KeyVerificationReport[] | undefined): string;
43
+ /** Any verification that is not a pass (invalid or unreachable). */
44
+ export declare function verificationProblems(verification: readonly KeyVerificationReport[]): {
45
+ invalid: KeyVerificationReport[];
46
+ unreachable: KeyVerificationReport[];
47
+ };
48
+ /** Env vars that shadow a key just stored (the stored value is unused while they are set). */
49
+ export declare function shadowWarnings(collected: readonly CredentialKey[], sources: readonly KeySourceReport[]): string[];
@@ -0,0 +1,101 @@
1
+ import { homedir } from "node:os";
2
+ import { FEATURE_KEYS, KEY_PROVIDERS, credentialProvenance, describeVerdict, looksLikeOtherKey, verifyKey, } from "@jevitate/ai-core";
3
+ import { credentialsFilePath } from "./credentials-file.js";
4
+ /** `~/.jevitate/credentials.json` — the file path with the home directory abbreviated. */
5
+ export function displayCredentialsPath() {
6
+ const p = credentialsFilePath();
7
+ const home = homedir();
8
+ return home !== "" && p.startsWith(home) ? `~${p.slice(home.length)}` : p;
9
+ }
10
+ export function keySources(feature, env, localConfig) {
11
+ return FEATURE_KEYS[feature].map((key) => {
12
+ const p = credentialProvenance(key, env, localConfig);
13
+ const base = { key, provider: p.provider };
14
+ if (p.source.kind === "env")
15
+ return { ...base, source: "env", envVar: p.source.envVar, ...(p.shadowsStored ? { shadowsStored: true } : {}) };
16
+ if (p.source.kind === "file")
17
+ return { ...base, source: "file", path: displayCredentialsPath() };
18
+ return { ...base, source: "missing" };
19
+ });
20
+ }
21
+ /** The default verifier: one HTTPS GET with the key in the Authorization header. */
22
+ export const realVerifyFetch = async (url, init) => {
23
+ const res = await fetch(url, { method: init.method, headers: init.headers, signal: init.signal });
24
+ // The body is never read (it may describe the key); only the status decides.
25
+ await res.body?.cancel().catch(() => undefined);
26
+ return { status: res.status };
27
+ };
28
+ /** Verifies every required key of `feature` (the effective value: env wins). `known` skips a re-check. */
29
+ export async function verifyFeatureKeys(feature, store, fetchFn, known = new Map()) {
30
+ const out = [];
31
+ for (const key of FEATURE_KEYS[feature]) {
32
+ const value = store.read(key);
33
+ const verdict = value === undefined ? { status: "missing" } : (known.get(key) ?? (await verifyKey(key, value, fetchFn)));
34
+ const other = value === undefined || verdict.status === "valid" ? null : looksLikeOtherKey(key, value);
35
+ out.push({
36
+ key,
37
+ provider: KEY_PROVIDERS[key],
38
+ status: verdict.status,
39
+ ...(verdict.status === "invalid" ? { httpStatus: verdict.httpStatus } : {}),
40
+ ...(verdict.status === "unreachable" ? { reason: verdict.reason } : {}),
41
+ ...(other === null ? {} : { looksLike: other }),
42
+ });
43
+ }
44
+ return out;
45
+ }
46
+ function verdictOf(v) {
47
+ if (v.status === "invalid")
48
+ return { status: "invalid", httpStatus: v.httpStatus ?? 0 };
49
+ if (v.status === "unreachable")
50
+ return { status: "unreachable", reason: v.reason ?? "unknown" };
51
+ return { status: v.status };
52
+ }
53
+ /** `OPENROUTER_API_KEY (OpenRouter), from env OPENROUTER_API_KEY` / `…, from ~/.jevitate/credentials.json`. */
54
+ export function describeSource(s) {
55
+ const name = `${s.key} (${s.provider})`;
56
+ if (s.source === "env") {
57
+ return `${name}, from env ${s.envVar ?? s.key}${s.shadowsStored === true ? ` (overrides the key stored in ${displayCredentialsPath()})` : ""}`;
58
+ }
59
+ if (s.source === "file")
60
+ return `${name}, from ${s.path ?? displayCredentialsPath()}`;
61
+ return `${name} missing`;
62
+ }
63
+ /** One verification as a human phrase (never a value). */
64
+ export function describeVerification(v) {
65
+ const other = v.looksLike === undefined ? "" : KEY_PROVIDERS[v.looksLike];
66
+ const misplaced = v.looksLike === undefined ? "" : ` — looks like ${/^[aeiou]/i.test(other) ? "an" : "a"} ${other} key (${v.looksLike})`;
67
+ return `${describeVerdict(verdictOf(v))}${misplaced}`;
68
+ }
69
+ /** A feature's key state without its name: `ready — <sources>: <verdicts>` or `missing <names> — …`. */
70
+ export function featureKeysBody(feature, sources, verification) {
71
+ const missing = sources.filter((s) => s.source === "missing");
72
+ if (missing.length > 0) {
73
+ return `missing ${missing.map((s) => `${s.key} (${s.provider})`).join(", ")} — set it in the environment or run \`jevitate ai setup ${feature}\``;
74
+ }
75
+ const parts = sources.map((s) => {
76
+ const v = verification?.find((x) => x.key === s.key);
77
+ return `${describeSource(s)}${v === undefined ? "" : `: ${describeVerification(v)}`}`;
78
+ });
79
+ const bad = verification?.filter((v) => v.status === "invalid") ?? [];
80
+ const hint = bad.length > 0 ? ` — replace it: \`jevitate ai setup ${feature} --replace\`` : "";
81
+ const state = bad.length > 0 ? "NOT ready" : verification?.some((v) => v.status === "unreachable") ? "configured (unverified)" : "ready";
82
+ return `${state} — ${parts.join("; ")}${hint}`;
83
+ }
84
+ /** A feature's whole key line (`ai status`): `generation: ready — OPENROUTER_API_KEY (OpenRouter), from env …: valid`. */
85
+ export function describeFeatureKeys(feature, sources, verification) {
86
+ return `${feature}: ${featureKeysBody(feature, sources, verification)}`;
87
+ }
88
+ /** Any verification that is not a pass (invalid or unreachable). */
89
+ export function verificationProblems(verification) {
90
+ return {
91
+ invalid: verification.filter((v) => v.status === "invalid"),
92
+ unreachable: verification.filter((v) => v.status === "unreachable"),
93
+ };
94
+ }
95
+ /** Env vars that shadow a key just stored (the stored value is unused while they are set). */
96
+ export function shadowWarnings(collected, sources) {
97
+ return sources
98
+ .filter((s) => collected.includes(s.key) && s.source === "env")
99
+ .map((s) => `env ${s.envVar ?? s.key} is set and overrides the ${s.key} just stored — unset it to use the stored key`);
100
+ }
101
+ //# sourceMappingURL=key-report.js.map